@cortexkit/aft-opencode 0.59.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bash-wait-detach.d.ts +17 -5
- package/dist/bash-wait-detach.d.ts.map +1 -1
- package/dist/bg-notifications.d.ts +5 -0
- package/dist/bg-notifications.d.ts.map +1 -1
- package/dist/bridge-bootstrap.d.ts +7 -5
- package/dist/bridge-bootstrap.d.ts.map +1 -1
- package/dist/config-live-reload.d.ts +8 -10
- package/dist/config-live-reload.d.ts.map +1 -1
- package/dist/config.d.ts +24 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/entry/server.js +25133 -25815
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24767 -22902
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/lsp-github-install.d.ts +5 -117
- package/dist/lsp-github-install.d.ts.map +1 -1
- package/dist/permissions/v2.d.ts +9 -158
- package/dist/permissions/v2.d.ts.map +1 -1
- package/dist/shared/status.d.ts +9 -4
- package/dist/shared/status.d.ts.map +1 -1
- package/dist/subc-tool-schemas.d.ts +1 -1
- package/dist/tool-registration.d.ts +3 -0
- package/dist/tool-registration.d.ts.map +1 -1
- package/dist/tools/_shared.d.ts +4 -5
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/ast.d.ts.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash_watch.d.ts.map +1 -1
- package/dist/tools/definitions/v2.d.ts +13 -3
- package/dist/tools/definitions/v2.d.ts.map +1 -1
- package/dist/tools/hoisted/v2.d.ts +3 -17
- package/dist/tools/hoisted/v2.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/inspect.d.ts.map +1 -1
- package/dist/tools/navigation.d.ts.map +1 -1
- package/dist/tools/permissions.d.ts +2 -0
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/reading.d.ts.map +1 -1
- package/dist/tools/safety.d.ts.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tui/v2-status.d.ts.map +1 -1
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/v2-host-tool-names.d.ts +43 -0
- package/dist/v2-host-tool-names.d.ts.map +1 -0
- package/dist/v2-prompt-detach.d.ts +6 -1
- package/dist/v2-prompt-detach.d.ts.map +1 -1
- package/dist/v2-session-lifecycle.d.ts +22 -0
- package/dist/v2-session-lifecycle.d.ts.map +1 -0
- package/dist/v2-tool-hooks.d.ts +14 -2
- package/dist/v2-tool-hooks.d.ts.map +1 -1
- package/dist/wakes/runtime-consumer.d.ts +6 -1
- package/dist/wakes/runtime-consumer.d.ts.map +1 -1
- package/dist/wakes/session-delivery.d.ts +12 -7
- package/dist/wakes/session-delivery.d.ts.map +1 -1
- package/package.json +20 -12
- package/src/entry/server-runtime.mjs +32 -18
- package/src/shared/status.ts +25 -4
- package/src/tui/v2-status.ts +1 -0
- package/src/tui/v2.tsx +7 -4
- package/src/tui-compiled/v2-status.ts +1 -0
- package/src/tui-compiled/v2.tsx +7 -4
- package/dist/lsp-github-probe.d.ts +0 -81
- package/dist/lsp-github-probe.d.ts.map +0 -1
- package/dist/lsp-github-table.d.ts +0 -55
- package/dist/lsp-github-table.d.ts.map +0 -1
- package/dist/permissions/v2-service.d.ts +0 -135
- package/dist/permissions/v2-service.d.ts.map +0 -1
- package/dist/v2-host-tool-overlap.d.ts +0 -66
- package/dist/v2-host-tool-overlap.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/tools/permissions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/tools/permissions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,q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AAA;CAAO,GACjD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgB7B;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reading.d.ts","sourceRoot":"","sources":["../../src/tools/reading.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAe,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAInF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"reading.d.ts","sourceRoot":"","sources":["../../src/tools/reading.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAe,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAInF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAwDjD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,eAAe;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAsBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAwW/E;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GACnC,eAAe,CAyBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA6CjD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAkJ9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyGjD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CA0BrD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyGjD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CA0BrD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA2L9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-status.d.ts","sourceRoot":"","sources":["../../src/tui/v2-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAwC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"v2-status.d.ts","sourceRoot":"","sources":["../../src/tui/v2-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAwC,MAAM,kBAAkB,CAAC;AAyBhG;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAY/E;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAWF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,iBAAiB,CAsBvF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AftTransportPool } from "@cortexkit/aft-bridge";
|
|
1
|
+
import type { AftTransportPool, HostToolNames } from "@cortexkit/aft-bridge";
|
|
2
2
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
3
3
|
import type { AftConfig } from "./config.js";
|
|
4
4
|
interface ShellEnvPluginHost {
|
|
@@ -25,6 +25,12 @@ export interface PluginContext {
|
|
|
25
25
|
config: AftConfig;
|
|
26
26
|
/** Whether hashline edit/read mode is active for this plugin registration. */
|
|
27
27
|
hashlineEffective?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* What this host calls AFT's command and patch tools, sent on every request
|
|
30
|
+
* so AFT's reply text names them. Set by the OpenCode 2 runtime only; absent
|
|
31
|
+
* leaves AFT's own names.
|
|
32
|
+
*/
|
|
33
|
+
hostToolNames?: HostToolNames;
|
|
28
34
|
/** Absolute path to AFT's storage dir (e.g. ~/.local/share/opencode/storage/plugin/aft) */
|
|
29
35
|
storageDir: string;
|
|
30
36
|
/** Returns false when user and project config merge to `enabled: false` for this project. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,CACR,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAC7D,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KACnC,OAAO,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CACnF;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,2FAA2F;IAC3F,UAAU,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;CACrD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names AFT registers its command and patch tools under on OpenCode 2.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode 2's timeline gives its rich rows (title, command and output for a
|
|
5
|
+
* command; file count and diff for a patch) only to tools it recognises by
|
|
6
|
+
* name, and those names are `shell` and `patch`. OpenCode 2 also files shell
|
|
7
|
+
* permission rules under `shell`. So on OpenCode 2 AFT's `bash` is registered
|
|
8
|
+
* as `shell` and its `apply_patch` as `patch`, replacing the host's built-ins
|
|
9
|
+
* under the same names. OpenCode 1 and Pi keep `bash` and `apply_patch`.
|
|
10
|
+
*
|
|
11
|
+
* Only the name the host and the model see changes. Inside the plugin the
|
|
12
|
+
* tool map, `disabled_tools`, the config keys and every call into AFT's engine
|
|
13
|
+
* keep the AFT names; this module translates at the host boundary in both
|
|
14
|
+
* directions. The engine gets the same map on every request (the
|
|
15
|
+
* `host_tool_names` field beside the session), so the text it renders names
|
|
16
|
+
* the tools the model can actually call.
|
|
17
|
+
*/
|
|
18
|
+
/** AFT tool name -> the name it is registered under on OpenCode 2. */
|
|
19
|
+
export declare const V2_HOST_TOOL_NAMES: Readonly<Record<"bash" | "apply_patch", string>>;
|
|
20
|
+
/** The name an AFT tool is registered under on OpenCode 2. */
|
|
21
|
+
export declare function v2HostToolName(aftName: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* The AFT tool a host-side tool name refers to, for hook events the host keys
|
|
24
|
+
* by the registered name. A name AFT never renamed comes back unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function aftToolNameForV2Host(hostName: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Rewrite the references to `bash` and `apply_patch` as tools in a description
|
|
29
|
+
* or hint written for OpenCode 1, so it names the tools an OpenCode 2 model
|
|
30
|
+
* can call.
|
|
31
|
+
*
|
|
32
|
+
* The shared descriptions are built once for both hosts, and on OpenCode 1
|
|
33
|
+
* they must stay byte-identical (a changed byte rebuilds every session's
|
|
34
|
+
* prompt cache), so they are rewritten here instead of being parameterised at
|
|
35
|
+
* every call site. Only a tool reference changes:
|
|
36
|
+
* - `bash(` and `` `bash` `` and a bare word `bash` become `shell`;
|
|
37
|
+
* - `` `apply_patch` `` and `apply_patch(` become `patch`.
|
|
38
|
+
* These stay: config keys (`bash.background`), companion tools (`bash_status`),
|
|
39
|
+
* task ids (`bash-6b45…`), and `bash` as a program or a syntax ("python/node/
|
|
40
|
+
* bash REPLs", "bash itself", "bash syntax").
|
|
41
|
+
*/
|
|
42
|
+
export declare function renameV2ToolReferences(text: string): string;
|
|
43
|
+
//# sourceMappingURL=v2-host-tool-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2-host-tool-names.d.ts","sourceRoot":"","sources":["../src/v2-host-tool-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,aAAa,EAAE,MAAM,CAAC,CAG9E,CAAC;AAMH,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI3D"}
|
|
@@ -13,6 +13,7 @@ interface MentionCarrier {
|
|
|
13
13
|
/** The fields of OpenCode 2's `SessionHooks["prompt"]` event this hook reads or edits. */
|
|
14
14
|
export interface V2PromptHookEvent {
|
|
15
15
|
readonly sessionID: string;
|
|
16
|
+
readonly delivery: "steer" | "queue";
|
|
16
17
|
prompt: {
|
|
17
18
|
text: string;
|
|
18
19
|
files?: MentionCarrier[];
|
|
@@ -31,7 +32,7 @@ export interface V2PromptDetachRuntime {
|
|
|
31
32
|
*/
|
|
32
33
|
readonly projectRoot: string;
|
|
33
34
|
/**
|
|
34
|
-
* Read
|
|
35
|
+
* Read when deciding whether to detach so a live config reload of
|
|
35
36
|
* `bash.detach_on_user_message` applies to the next message.
|
|
36
37
|
*/
|
|
37
38
|
getConfig(): AftConfig;
|
|
@@ -59,6 +60,10 @@ export declare function interruptBashWaitsForV2Prompt(runtime: V2PromptDetachRun
|
|
|
59
60
|
* detach request it may start is not awaited.
|
|
60
61
|
*/
|
|
61
62
|
export declare function createV2PromptDetachHook(runtime: V2PromptDetachRuntime): (event: V2PromptHookEvent) => Effect.Effect<void>;
|
|
63
|
+
/** OpenCode 2 prepares model-step context after admitting queued prompts, so old requests can be cleared. */
|
|
64
|
+
export declare function createV2DetachDeliveryHook(runtime: V2PromptDetachRuntime): (event: {
|
|
65
|
+
sessionID: string;
|
|
66
|
+
}) => Effect.Effect<void>;
|
|
62
67
|
/**
|
|
63
68
|
* Register the prompt hook on an OpenCode 2 host context. The registration is
|
|
64
69
|
* scoped by the host, so it ends with the Location. A host context without
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-prompt-detach.d.ts","sourceRoot":"","sources":["../src/v2-prompt-detach.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,
|
|
1
|
+
{"version":3,"file":"v2-prompt-detach.d.ts","sourceRoot":"","sources":["../src/v2-prompt-detach.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAEL,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,8DAA8D;AAC9D,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,0FAA0F;AAC1F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;IACrC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;QACzB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;QAC1B,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,SAAS,IAAI,SAAS,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAqCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,qBAAqB,EAC9B,KAAK,EAAE,iBAAiB,GACvB,OAAO,CA4BT;AAMD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,qBAAqB,GAC7B,CAAC,KAAK,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAgBnD;AAOD,6GAA6G;AAC7G,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,qBAAqB,GAC7B,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAuBxC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { PluginContext } from "./types.js";
|
|
3
|
+
/** Hold a racing wake until the host classifies an interrupted tool's execution. */
|
|
4
|
+
export declare function noteV2ToolAbort(client: unknown, sessionID: string): void;
|
|
5
|
+
export declare function awaitV2ExecutionSettlement(client: unknown, sessionID: string): Promise<void>;
|
|
6
|
+
export declare function v2SubagentStopped(client: unknown, sessionID: string): boolean;
|
|
7
|
+
export declare function v2StopEpoch(client: unknown, sessionID: string): number;
|
|
8
|
+
/** Only a command's spawning call records ownership; watching another session's task does not. */
|
|
9
|
+
export declare function trackV2BackgroundTask(ctx: PluginContext, runtime: {
|
|
10
|
+
sessionID: string;
|
|
11
|
+
directory: string;
|
|
12
|
+
}, taskId: string, startedEpoch: number): Promise<void>;
|
|
13
|
+
export declare function allowV2WatchWake(client: unknown, sessionID: string, taskId: string): void;
|
|
14
|
+
export declare function v2WatchWakeAllowed(client: unknown, sessionID: string, taskId: string): boolean;
|
|
15
|
+
export declare function forgetV2Watch(client: unknown, sessionID: string, taskId: string): void;
|
|
16
|
+
export declare function trackV2Watch(ctx: PluginContext, runtime: {
|
|
17
|
+
sessionID: string;
|
|
18
|
+
directory: string;
|
|
19
|
+
}, taskId: string, watchId: unknown): Promise<void>;
|
|
20
|
+
/** Own the lazy host subscription before any tool can register a watch. */
|
|
21
|
+
export declare function registerV2SessionLifecycle(context: unknown, ctx?: PluginContext): Effect.Effect<void, never, import("effect/Scope").Scope>;
|
|
22
|
+
//# sourceMappingURL=v2-session-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2-session-lifecycle.d.ts","sourceRoot":"","sources":["../src/v2-session-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAKxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAWhD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAQxE;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf;AAqBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAoBD,kGAAkG;AAClG,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACjD,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAWf;AA0DD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAGzF;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAG9F;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQtF;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,aAAa,4DAqF/E"}
|
package/dist/v2-tool-hooks.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
|
|
2
|
+
import type { PluginContext } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Register the OpenCode 2 hooks that do what AFT's OpenCode 1 hooks do:
|
|
5
|
+
* normalise a call's raw arguments before the host validates them, append the
|
|
6
|
+
* merge-conflict hint to a command's result text, gate the editing tools by
|
|
7
|
+
* model and remember the session's current model.
|
|
8
|
+
*
|
|
9
|
+
* `registeredTools` holds AFT tool names; the host's events name tools by the
|
|
10
|
+
* name they are registered under, which differs for `bash` (`shell`) and
|
|
11
|
+
* `apply_patch` (`patch`). `bashDescription` is the description AFT's bash
|
|
12
|
+
* tool was built with, as written for OpenCode 1.
|
|
13
|
+
*/
|
|
3
14
|
export declare function registerV2ToolHooks(context: unknown, runtime: {
|
|
4
15
|
hashlineEffective?: boolean;
|
|
5
|
-
|
|
16
|
+
pool?: PluginContext["pool"];
|
|
17
|
+
}, registeredTools: ReadonlySet<string>, bashDescription?: string): Effect.Effect<void, never, import("effect/Scope").Scope>;
|
|
6
18
|
//# sourceMappingURL=v2-tool-hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-tool-hooks.d.ts","sourceRoot":"","sources":["../src/v2-tool-hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"v2-tool-hooks.d.ts","sourceRoot":"","sources":["../src/v2-tool-hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAKxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAsDhD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,EACtE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EACpC,eAAe,CAAC,EAAE,MAAM,4DAgGzB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BridgeOptions } from "@cortexkit/aft-bridge";
|
|
2
|
+
import type { AftConfig } from "../config.js";
|
|
2
3
|
import type { V2ToolConsumers } from "../tools/definitions/v2.js";
|
|
3
4
|
import { type V2SessionAdmission } from "./session-delivery.js";
|
|
4
5
|
export interface V2WakeHostContext {
|
|
@@ -15,7 +16,11 @@ export interface V2RuntimeConsumer extends V2ToolConsumers {
|
|
|
15
16
|
* Creates the V2 execution consumers for one OpenCode Location. The bridge owns
|
|
16
17
|
* one process-wide `onBashCompletion` callback, so it routes each notification
|
|
17
18
|
* by session to the delivery object owned by that Location's Effect scope.
|
|
19
|
+
*
|
|
20
|
+
* `getConfig` returns the Location's current AFT config (a live reload
|
|
21
|
+
* replaces it); it decides whether an admitted completion detaches the
|
|
22
|
+
* session's waits.
|
|
18
23
|
*/
|
|
19
|
-
export declare function createV2RuntimeConsumer(context: V2WakeHostContext): V2RuntimeConsumer;
|
|
24
|
+
export declare function createV2RuntimeConsumer(context: V2WakeHostContext, getConfig?: () => AftConfig): V2RuntimeConsumer;
|
|
20
25
|
export {};
|
|
21
26
|
//# sourceMappingURL=runtime-consumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-consumer.d.ts","sourceRoot":"","sources":["../../src/wakes/runtime-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EACd,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-consumer.d.ts","sourceRoot":"","sources":["../../src/wakes/runtime-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQlE,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,uBAAuB,CAAC;AAEnF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CACtC;AAyJD,mFAAmF;AACnF,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD;AAED,QAAA,MAAM,mBAAmB,EAAE,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,mBAAmB,CAGtF,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,QAAQ,CAAC,aAAa,EAAE,OAAO,mBAAmB,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC;CACjB;AAwCD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,SAAS,GAAE,MAAM,SAAsB,GACtC,iBAAiB,CAsFnB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
/**
|
|
3
|
-
* The `metadata.source`
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* tell AFT's machine-written text from text an operator typed, never the text.
|
|
3
|
+
* The `metadata.source` marker for AFT-written session input. Synthetic wakes
|
|
4
|
+
* retain it, and the prompt hook recognises it on machine-originated prompts
|
|
5
|
+
* so they are not treated as text an operator typed.
|
|
7
6
|
*/
|
|
8
7
|
export declare const AFT_PROMPT_SOURCE = "aft";
|
|
9
8
|
/** True when a prompt's metadata marks it as one AFT admitted itself. */
|
|
@@ -20,9 +19,15 @@ export interface V2SessionSyntheticInput {
|
|
|
20
19
|
readonly text: string;
|
|
21
20
|
readonly description?: string;
|
|
22
21
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
23
|
-
readonly
|
|
22
|
+
readonly delivery?: "steer" | "queue";
|
|
23
|
+
readonly resume?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export interface V2SessionAdmission {
|
|
26
|
+
get(input: {
|
|
27
|
+
readonly sessionID: string;
|
|
28
|
+
}): Effect.Effect<{
|
|
29
|
+
readonly revert?: unknown;
|
|
30
|
+
}, unknown>;
|
|
26
31
|
prompt(input: V2SessionPromptInput): Effect.Effect<unknown, unknown>;
|
|
27
32
|
synthetic(input: V2SessionSyntheticInput): Effect.Effect<unknown, unknown>;
|
|
28
33
|
}
|
|
@@ -39,8 +44,8 @@ export interface StatusOnlyUpdate {
|
|
|
39
44
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
|
-
* Admit V2 session updates
|
|
43
|
-
*
|
|
47
|
+
* Admit V2 session updates as synthetic input so machine-written notices are
|
|
48
|
+
* not rendered as user turns. Completions wake execution; status does not.
|
|
44
49
|
*/
|
|
45
50
|
export declare class V2SessionDelivery {
|
|
46
51
|
private readonly session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-delivery.d.ts","sourceRoot":"","sources":["../../src/wakes/session-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"session-delivery.d.ts","sourceRoot":"","sources":["../../src/wakes/session-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAEvC,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAMhE;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,QAAQ,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,EAAE,kBAAkB;IAExD,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IAgDlE,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;IAe7D,OAAO,IAAI,IAAI;CAKhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,28 +39,28 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@clack/prompts": "^1.6.0",
|
|
42
|
-
"@cortexkit/aft-bridge": "0.
|
|
43
|
-
"@opencode/client": "2.0.11",
|
|
42
|
+
"@cortexkit/aft-bridge": "0.61.0",
|
|
44
43
|
"@opentui/core": "0.4.3",
|
|
45
44
|
"@opentui/solid": "0.4.3",
|
|
46
45
|
"comment-json": "^4.6.2",
|
|
47
|
-
"effect": "4.0.
|
|
46
|
+
"effect": "4.0.1",
|
|
48
47
|
"solid-js": "1.9.12",
|
|
49
48
|
"undici": "^7.25.0",
|
|
50
49
|
"zod": "^4.4.3"
|
|
51
50
|
},
|
|
52
51
|
"optionalDependencies": {
|
|
53
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
54
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
55
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
56
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
57
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
58
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
52
|
+
"@cortexkit/aft-darwin-arm64": "0.61.0",
|
|
53
|
+
"@cortexkit/aft-darwin-x64": "0.61.0",
|
|
54
|
+
"@cortexkit/aft-linux-arm64": "0.61.0",
|
|
55
|
+
"@cortexkit/aft-linux-x64": "0.61.0",
|
|
56
|
+
"@cortexkit/aft-win32-arm64": "0.61.0",
|
|
57
|
+
"@cortexkit/aft-win32-x64": "0.61.0"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
61
60
|
"@opencode-ai/plugin": "^1.17.11",
|
|
62
61
|
"@opencode-ai/sdk": "^1.17.11",
|
|
63
|
-
"@opencode/
|
|
62
|
+
"@opencode/client": "2.0.29",
|
|
63
|
+
"@opencode/plugin": "^2.0.29",
|
|
64
64
|
"@types/node": "^22.0.0",
|
|
65
65
|
"typescript": "^5.8.0"
|
|
66
66
|
},
|
|
@@ -80,6 +80,14 @@
|
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@opencode-ai/plugin": ">=0.0.0-beta-0",
|
|
83
|
-
"@opencode/plugin": "2.0.
|
|
83
|
+
"@opencode/plugin": "^2.0.29"
|
|
84
|
+
},
|
|
85
|
+
"peerDependenciesMeta": {
|
|
86
|
+
"@opencode-ai/plugin": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@opencode/plugin": {
|
|
90
|
+
"optional": true
|
|
91
|
+
}
|
|
84
92
|
}
|
|
85
93
|
}
|
|
@@ -17,10 +17,14 @@ import { startOpenCodeLiveConfigReload } from "../config-live-reload.js";
|
|
|
17
17
|
import { debug, log, warn } from "../logger.js";
|
|
18
18
|
import { resolvePluginVersion } from "../plugin-version.js";
|
|
19
19
|
import { registerAftConfigErrorRpc, registerAftRpc } from "../rpc/register.js";
|
|
20
|
-
import { hoistedV2ToolConsumers
|
|
21
|
-
import {
|
|
20
|
+
import { hoistedV2ToolConsumers } from "../tools/hoisted/v2.js";
|
|
21
|
+
import {
|
|
22
|
+
renameV2ToolReferences,
|
|
23
|
+
V2_HOST_TOOL_NAMES,
|
|
24
|
+
} from "../v2-host-tool-names.js";
|
|
22
25
|
import { registerV2PromptDetachHook } from "../v2-prompt-detach.js";
|
|
23
26
|
import { registerV2ToolHooks } from "../v2-tool-hooks.js";
|
|
27
|
+
import { registerV2SessionLifecycle } from "../v2-session-lifecycle.js";
|
|
24
28
|
import { registerV2WorkflowHints } from "../v2-workflow-hints.js";
|
|
25
29
|
import { createV2RuntimeConsumer } from "../wakes/runtime-consumer.js";
|
|
26
30
|
import { buildHintsForRegisteredTools } from "../workflow-hints.js";
|
|
@@ -42,12 +46,11 @@ const defaults = {
|
|
|
42
46
|
registerPromptHook: registerV2PromptDetachHook,
|
|
43
47
|
registerToolHooks: registerV2ToolHooks,
|
|
44
48
|
registerWorkflowHints: registerV2WorkflowHints,
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
...
|
|
50
|
-
...createV2RuntimeConsumer(context),
|
|
49
|
+
// `getConfig` returns the Location's current config, which a live reload
|
|
50
|
+
// replaces; the wake consumer reads it when a completion arrives.
|
|
51
|
+
toolConsumers: (context, config, getConfig = () => config) => ({
|
|
52
|
+
...hoistedV2ToolConsumers(context),
|
|
53
|
+
...createV2RuntimeConsumer(context, getConfig),
|
|
51
54
|
}),
|
|
52
55
|
acquireBridge,
|
|
53
56
|
releaseBridge,
|
|
@@ -86,7 +89,8 @@ async function bootLocation(context, location, dependencies) {
|
|
|
86
89
|
dependencies,
|
|
87
90
|
);
|
|
88
91
|
const canonicalDirectory = location.project?.canonical ?? directory;
|
|
89
|
-
|
|
92
|
+
let liveConfig = config;
|
|
93
|
+
const consumers = dependencies.toolConsumers(context, config, () => liveConfig);
|
|
90
94
|
// Only a rejected configuration keeps AFT out of a project; there is no
|
|
91
95
|
// config switch that turns it off.
|
|
92
96
|
const isProjectEnabled = createProjectAcceptance(directory, dependencies);
|
|
@@ -114,6 +118,12 @@ async function bootLocation(context, location, dependencies) {
|
|
|
114
118
|
client: context,
|
|
115
119
|
config,
|
|
116
120
|
hashlineEffective: openCodeHashlineEffective(config),
|
|
121
|
+
// The engine's reply text names AFT's command and patch tools ("Prefer
|
|
122
|
+
// `read` tool over bash."), and on OpenCode 2 they are `shell` and
|
|
123
|
+
// `patch`. Every tool request sends this map, beside its session; it is
|
|
124
|
+
// never configure state, because one AFT process can serve an OpenCode 1
|
|
125
|
+
// head, an OpenCode 2 session and a Pi session on the same project.
|
|
126
|
+
hostToolNames: V2_HOST_TOOL_NAMES,
|
|
117
127
|
storageDir: environment.storageDir,
|
|
118
128
|
isProjectEnabled,
|
|
119
129
|
};
|
|
@@ -126,7 +136,9 @@ async function bootLocation(context, location, dependencies) {
|
|
|
126
136
|
const { hashlineEditRegistered } = applyToolSurfaceOverrides(pool, config, registeredTools);
|
|
127
137
|
reportHashlineDowngrade(config, registeredTools, notify);
|
|
128
138
|
toolContext.hashlineEffective = hashlineEditRegistered;
|
|
129
|
-
|
|
139
|
+
// The hints are written for OpenCode 1's tool names; name OpenCode 2's.
|
|
140
|
+
const hints = buildHintsForRegisteredTools(config, registeredTools, hashlineEditRegistered);
|
|
141
|
+
const hintsBlock = hints === null ? null : renameV2ToolReferences(hints);
|
|
130
142
|
// Keep this Location's live config keys current when a config file changes.
|
|
131
143
|
// The finalizer that releases the bridge also stops the watch.
|
|
132
144
|
const liveConfigReload = dependencies.startLiveConfigReload({
|
|
@@ -136,6 +148,7 @@ async function bootLocation(context, location, dependencies) {
|
|
|
136
148
|
getConfig: () => toolContext.config,
|
|
137
149
|
setConfig: (next) => {
|
|
138
150
|
toolContext.config = next;
|
|
151
|
+
liveConfig = next;
|
|
139
152
|
},
|
|
140
153
|
notify,
|
|
141
154
|
});
|
|
@@ -194,6 +207,10 @@ export function makeServerEffect(overrides = {}) {
|
|
|
194
207
|
return Effect.void;
|
|
195
208
|
}
|
|
196
209
|
|
|
210
|
+
if (typeof context.permission?.assert !== "function") {
|
|
211
|
+
throw new Error("AFT requires OpenCode 2.0.29 or newer: this V2 host has no permission.assert. Upgrade OpenCode before loading AFT.");
|
|
212
|
+
}
|
|
213
|
+
|
|
197
214
|
return Effect.gen(function* () {
|
|
198
215
|
// Logged when the program runs, so every start pairs with the stop its
|
|
199
216
|
// finalizer logs when the host disposes the Location.
|
|
@@ -218,6 +235,7 @@ export function makeServerEffect(overrides = {}) {
|
|
|
218
235
|
);
|
|
219
236
|
const rpc = yield* dependencies.registerRpc(context, location, runtime.pool);
|
|
220
237
|
yield* Effect.addFinalizer(() => Effect.promise(() => rpc.dispose()));
|
|
238
|
+
yield* registerV2SessionLifecycle(context, runtime.toolContext);
|
|
221
239
|
// OpenCode 2 has no chat.message hook; its session prompt hook is where a
|
|
222
240
|
// new message detaches a waiting bash, as chat.message does on OpenCode 1.
|
|
223
241
|
// The config is read through the tool context so live reloads apply.
|
|
@@ -237,17 +255,13 @@ export function makeServerEffect(overrides = {}) {
|
|
|
237
255
|
runtime.tools,
|
|
238
256
|
runtime.consumers,
|
|
239
257
|
);
|
|
240
|
-
yield* dependencies.registerToolHooks(
|
|
241
|
-
yield* dependencies.registerWorkflowHints(context, runtime.hintsBlock);
|
|
242
|
-
// Tell the user once when the host's own patch or shell tool still runs
|
|
243
|
-
// beside AFT's apply_patch or bash. Checked on the first prompt, once
|
|
244
|
-
// every plugin has registered its tools, and shown by AFT's TUI plugin
|
|
245
|
-
// as a toast; nothing is written into the session, which the model reads.
|
|
246
|
-
yield* dependencies.registerHostToolOverlapNotice(
|
|
258
|
+
yield* dependencies.registerToolHooks(
|
|
247
259
|
context,
|
|
260
|
+
runtime.toolContext,
|
|
248
261
|
new Set(Object.keys(runtime.tools)),
|
|
249
|
-
|
|
262
|
+
runtime.tools.bash?.description,
|
|
250
263
|
);
|
|
264
|
+
yield* dependencies.registerWorkflowHints(context, runtime.hintsBlock);
|
|
251
265
|
});
|
|
252
266
|
};
|
|
253
267
|
}
|
package/src/shared/status.ts
CHANGED
|
@@ -64,11 +64,12 @@ export interface StatusBar {
|
|
|
64
64
|
todos?: number;
|
|
65
65
|
tier2_stale?: boolean;
|
|
66
66
|
/**
|
|
67
|
-
* `
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* `no_language_server` means no server is running. `producer_missing`
|
|
68
|
+
* masks both counts when an expected project producer has failed, even if
|
|
69
|
+
* another server supplied counts; diagnostics_gaps identifies the failures.
|
|
70
70
|
*/
|
|
71
|
-
diagnostics?: "no_language_server";
|
|
71
|
+
diagnostics?: "no_language_server" | "producer_missing";
|
|
72
|
+
diagnostics_gaps?: Array<{ language: string; producer: string; root: string }>;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
export interface AftStatusSnapshot {
|
|
@@ -225,6 +226,22 @@ function readStatusBar(value: unknown): StatusBar | undefined {
|
|
|
225
226
|
const duplicates = readOptionalNumber(bar.duplicates);
|
|
226
227
|
const todos = readOptionalNumber(bar.todos);
|
|
227
228
|
const noLanguageServer = bar.diagnostics === "no_language_server";
|
|
229
|
+
const producerMissing = bar.diagnostics === "producer_missing";
|
|
230
|
+
const diagnosticsGaps = Array.isArray(bar.diagnostics_gaps)
|
|
231
|
+
? bar.diagnostics_gaps
|
|
232
|
+
.map(asRecord)
|
|
233
|
+
.filter(
|
|
234
|
+
(gap) =>
|
|
235
|
+
typeof gap.language === "string" &&
|
|
236
|
+
typeof gap.producer === "string" &&
|
|
237
|
+
typeof gap.root === "string",
|
|
238
|
+
)
|
|
239
|
+
.map((gap) => ({
|
|
240
|
+
language: gap.language as string,
|
|
241
|
+
producer: gap.producer as string,
|
|
242
|
+
root: gap.root as string,
|
|
243
|
+
}))
|
|
244
|
+
: [];
|
|
228
245
|
if (
|
|
229
246
|
errors === null &&
|
|
230
247
|
warnings === null &&
|
|
@@ -233,6 +250,7 @@ function readStatusBar(value: unknown): StatusBar | undefined {
|
|
|
233
250
|
duplicates === null &&
|
|
234
251
|
todos === null &&
|
|
235
252
|
!noLanguageServer &&
|
|
253
|
+
!producerMissing &&
|
|
236
254
|
disabled.length === 0
|
|
237
255
|
) {
|
|
238
256
|
return undefined;
|
|
@@ -247,6 +265,9 @@ function readStatusBar(value: unknown): StatusBar | undefined {
|
|
|
247
265
|
...(todos !== null ? { todos } : {}),
|
|
248
266
|
...(bar.tier2_stale === true ? { tier2_stale: true } : {}),
|
|
249
267
|
...(noLanguageServer ? { diagnostics: "no_language_server" as const } : {}),
|
|
268
|
+
...(producerMissing
|
|
269
|
+
? { diagnostics: "producer_missing" as const, diagnostics_gaps: diagnosticsGaps }
|
|
270
|
+
: {}),
|
|
250
271
|
};
|
|
251
272
|
}
|
|
252
273
|
|
package/src/tui/v2-status.ts
CHANGED
|
@@ -12,6 +12,7 @@ function count(value: number | undefined, off = false): string {
|
|
|
12
12
|
*/
|
|
13
13
|
function diagnosticsPart(bar: StatusBar): string {
|
|
14
14
|
if (bar.disabled_categories?.includes("diagnostics")) return "E○ W○";
|
|
15
|
+
if (bar.diagnostics === "producer_missing") return "E? W?";
|
|
15
16
|
if (
|
|
16
17
|
bar.errors === undefined &&
|
|
17
18
|
bar.warnings === undefined &&
|
package/src/tui/v2.tsx
CHANGED
|
@@ -333,10 +333,13 @@ function AftStatusCommands(props: { context: V2TuiContext; rpc: AftRpcClient })
|
|
|
333
333
|
const HOST_TOOL_OVERLAP_TOAST_MS = 15_000;
|
|
334
334
|
|
|
335
335
|
/**
|
|
336
|
-
* Show
|
|
337
|
-
* reaches the person at the terminal and nothing else
|
|
338
|
-
*
|
|
339
|
-
*
|
|
336
|
+
* Show a server's one-off built-in tool overlap notice as a toast. A toast
|
|
337
|
+
* reaches the person at the terminal and nothing else. The current server no
|
|
338
|
+
* longer sends this notice: on OpenCode 2 AFT registers its command and patch
|
|
339
|
+
* tools as `shell` and `patch`, replacing the host's built-ins instead of
|
|
340
|
+
* sitting beside them. The subscription stays so a TUI still shows the notice
|
|
341
|
+
* from an older AFT server running in the same host during an upgrade. A host
|
|
342
|
+
* without a toast surface shows nothing.
|
|
340
343
|
*/
|
|
341
344
|
export function subscribeV2HostToolOverlapToast(
|
|
342
345
|
context: Pick<V2TuiContext, "ui">,
|
|
@@ -12,6 +12,7 @@ function count(value: number | undefined, off = false): string {
|
|
|
12
12
|
*/
|
|
13
13
|
function diagnosticsPart(bar: StatusBar): string {
|
|
14
14
|
if (bar.disabled_categories?.includes("diagnostics")) return "E○ W○";
|
|
15
|
+
if (bar.diagnostics === "producer_missing") return "E? W?";
|
|
15
16
|
if (
|
|
16
17
|
bar.errors === undefined &&
|
|
17
18
|
bar.warnings === undefined &&
|
package/src/tui-compiled/v2.tsx
CHANGED
|
@@ -251,10 +251,13 @@ function AftStatusCommands(props) {
|
|
|
251
251
|
const HOST_TOOL_OVERLAP_TOAST_MS = 15_000;
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* Show
|
|
255
|
-
* reaches the person at the terminal and nothing else
|
|
256
|
-
*
|
|
257
|
-
*
|
|
254
|
+
* Show a server's one-off built-in tool overlap notice as a toast. A toast
|
|
255
|
+
* reaches the person at the terminal and nothing else. The current server no
|
|
256
|
+
* longer sends this notice: on OpenCode 2 AFT registers its command and patch
|
|
257
|
+
* tools as `shell` and `patch`, replacing the host's built-ins instead of
|
|
258
|
+
* sitting beside them. The subscription stays so a TUI still shows the notice
|
|
259
|
+
* from an older AFT server running in the same host during an upgrade. A host
|
|
260
|
+
* without a toast surface shows nothing.
|
|
258
261
|
*/
|
|
259
262
|
export function subscribeV2HostToolOverlapToast(context, rpc, options) {
|
|
260
263
|
return rpc.events.on("hostToolOverlap", event => {
|