Skip to content

Commit f51d4b2

Browse files
committed
fix(core): merge shell tracing while retaining cancellation cleanup
2 parents 3abdeba + adb0053 commit f51d4b2

90 files changed

Lines changed: 2247 additions & 707 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎bun.lock‎

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎bunfig.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
exact = true
33
# Only install newly resolved package versions published at least 3 days ago.
44
minimumReleaseAge = 259200
5-
minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@brendonovich/vite-plugin-opencode", "@hona/strobe", "@hona/strobe-darwin-arm64", "@hona/strobe-darwin-x64", "@hona/strobe-linux-arm64", "@hona/strobe-linux-x64", "@hona/strobe-win32-x64", "@kitlangton/knobs", "@kitlangton/solid-motion", "@opencode/sdk", "@opencode/pty", "@opencode/pty-darwin-arm64", "@opencode/pty-darwin-x64", "@opencode/pty-linux-arm64-gnu", "@opencode/pty-linux-arm64-musl", "@opencode/pty-linux-x64-gnu", "@opencode/pty-linux-x64-musl", "@opencode/pty-win32-arm64", "@opencode/pty-win32-x64", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "@opentunnel/client", "@opentunnel/protocol", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/highlights", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron", "electron-builder", "electron-publish", "blume", "pele", "bun-types", "[email protected]", "@textjs/app", "@textjs/core", "@textjs/opencode", "@textjs/react"]
5+
minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@brendonovich/vite-plugin-opencode", "@hona/strobe", "@hona/strobe-darwin-arm64", "@hona/strobe-darwin-x64", "@hona/strobe-linux-arm64", "@hona/strobe-linux-x64", "@hona/strobe-win32-arm64", "@hona/strobe-win32-x64", "@kitlangton/knobs", "@kitlangton/solid-motion", "@opencode/sdk", "@opencode/pty", "@opencode/pty-darwin-arm64", "@opencode/pty-darwin-x64", "@opencode/pty-linux-arm64-gnu", "@opencode/pty-linux-arm64-musl", "@opencode/pty-linux-x64-gnu", "@opencode/pty-linux-x64-musl", "@opencode/pty-win32-arm64", "@opencode/pty-win32-x64", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "@opentunnel/client", "@opentunnel/protocol", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/highlights", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron", "electron-builder", "electron-publish", "blume", "pele", "bun-types", "[email protected]", "@textjs/app", "@textjs/core", "@textjs/opencode", "@textjs/react"]
66

77
[test]
88
root = "./do-not-run-tests-from-root"

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@effect/sql-sqlite-node": "4.1.0",
5050
"@npmcli/arborist": "9.4.0",
5151
"@types/bun": "1.4.3",
52-
"@hona/strobe": "0.19.0",
52+
"@hona/strobe": "0.23.0",
5353
"@types/cross-spawn": "6.0.6",
5454
"@octokit/rest": "22.0.0",
5555
"@opentui/core": "0.8.1",

‎packages/app/perf/tabs.bench.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ const exported = exportFile ? (JSON.parse(readFileSync(exportFile, "utf8")) as S
3636

3737
// The destination was rendered before and is cached: switching back and forth. A cached transcript is not fetched
3838
// again (`net.requests` on the history endpoint stays 0), and the switch moves nothing that was already on screen.
39+
// The run ends on the frame after the answer shows: headless, it ends at its last step, and the wait at the first
40+
// match, so the style and layout the switch left for that frame would count in main.work but not run.duration.
3941
const warm: Case<{}> = {
4042
primary: "main.work",
4143
metrics: ["run.duration", "interaction.p50", "net.requests{/api/session/*/message}", "layout.shift"],
42-
run: ({ page, prepared }) => page.click(tab(prepared.target), { until: prepared.targetReady }),
44+
run: ({ page, prepared }) => page.click(tab(prepared.target), { until: [prepared.targetReady, "frame"] }),
4345
async reset({ page, prepared }) {
4446
await page.click(tab(prepared.source), { until: prepared.sourceReady })
4547
await page.idle()
@@ -71,7 +73,7 @@ const cases = {
7173
...warm,
7274
async run({ page, prepared }) {
7375
await page.click(tab(prepared.target), { until: prepared.targetReady })
74-
await page.click(tab(prepared.source), { until: prepared.sourceReady })
76+
await page.click(tab(prepared.source), { until: [prepared.sourceReady, "frame"] })
7577
},
7678
reset: ({ page }) => page.idle(),
7779
},

‎packages/app/src/session/screen.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ function SessionScreenContent(props: {
9393
closed: attachment.closed,
9494
open: (key) => attachment.openTab(key, props.view()),
9595
side: () => session.layout.view().side,
96-
// Closing the last tab closes the side region, which opens with a new tab next time. The user's own hand closed
97-
// it, so it goes at once.
96+
// Closing the last tab closes the side region, which opens with a new tab next time. It slides shut as the toggle
97+
// closes it.
9898
onEmptied: () => {
9999
if (!session.layout.view().side.opened()) return
100100
session.layout.view().side.toggle()
101-
sideMotion.sync(false)
102101
},
103102
settled: (run) => sideMotion.whenSettled(run),
104103
})

‎packages/client/src/promise/generated/types.ts‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/core/src/app.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ export interface Info {
99
readonly channel: string
1010
}
1111

12-
export const Metadata = Context.Reference<Info>("@opencode/App", {
13-
defaultValue: () => make(),
14-
})
12+
export class Service extends Context.Service<Service, Info>()("@opencode/App") {}
1513

1614
export function make(input: Partial<Info> = {}): Info {
1715
return {
@@ -25,9 +23,9 @@ export function useragent(app: Info) {
2523
return `opencode/${app.channel}/${app.version}/${app.name}`
2624
}
2725

28-
export const layer = (input?: Partial<Info>) => Layer.succeed(Metadata, make(input))
26+
export const layer = (input?: Partial<Info>) => Layer.succeed(Service, make(input))
2927

3028
export const configured = (input?: Partial<Info>) =>
31-
makeGlobalNode({ service: Metadata, layer: layer(input), deps: [] })
29+
makeGlobalNode({ service: Service, layer: layer(input), deps: [] })
3230

3331
export const node = configured()

‎packages/core/src/artifact.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import type { SessionID } from "@opencode/schema/session-id"
1919
import { Global } from "@opencode/util/global"
2020
import { makeLocationNode } from "@opencode/util/effect/app-node"
2121
import { Clock, Context, Effect, Layer, Option, Schema } from "effect"
22-
import { App } from "./app.js"
2322
import { Bus } from "./bus.js"
24-
import { Config } from "./config.js"
2523
import { Flag } from "./flag.js"
2624
import { KV } from "./kv.js"
2725
import { Location } from "./location.js"
@@ -206,12 +204,11 @@ const layer = Layer.effect(
206204
Service,
207205
Effect.gen(function* () {
208206
const bus = yield* Bus.Service
209-
const config = yield* Config.Service
207+
const flags = yield* Flag.Service
210208
const global = yield* Global.Service
211209
const kv = yield* KV.Service
212210
const location = yield* Location.Service
213211
const sessions = yield* Session.Service
214-
const flags = yield* Flag.resolver
215212

216213
const rootDir = path.join(global.data, "artifacts")
217214
const itemDir = (id: ID) => path.join(rootDir, id)
@@ -266,10 +263,7 @@ const layer = Layer.effect(
266263
notify: State.changes(snapshotProviders, () => bus.publish(Event.Updated, {}).pipe(Effect.asVoid)),
267264
})
268265

269-
const isEnabled = Effect.fn("Artifact.enabled")(function* () {
270-
const entries = yield* config.entries()
271-
return flags(entries).artifacts.enabled
272-
})
266+
const isEnabled = Effect.fn("Artifact.enabled")(() => flags.enabled("artifacts"))
273267

274268
const requireEnabled = () =>
275269
isEnabled().pipe(Effect.flatMap((on) => (on ? Effect.void : Effect.fail(new DisabledError()))))
@@ -458,7 +452,7 @@ const layer = Layer.effect(
458452
export const node = makeLocationNode({
459453
service: Service,
460454
layer,
461-
deps: [App.node, Bus.node, Config.node, Global.node, KV.node, Location.node, Session.node],
455+
deps: [Bus.node, Flag.node, Global.node, KV.node, Location.node, Session.node],
462456
})
463457

464458
function encodeStringFiles(files: Readonly<Record<string, string>>) {

0 commit comments

Comments
 (0)