@cortexkit/aft-opencode 0.61.0 → 0.63.4
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 +1 -0
- package/dist/bash-wait-detach.d.ts.map +1 -1
- package/dist/bg-notifications.d.ts +37 -12
- package/dist/bg-notifications.d.ts.map +1 -1
- package/dist/bridge-bootstrap.d.ts +1 -1
- package/dist/bridge-bootstrap.d.ts.map +1 -1
- package/dist/config-live-reload.d.ts +18 -2
- package/dist/config-live-reload.d.ts.map +1 -1
- package/dist/config.d.ts +43 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/entry/server.js +4869 -1622
- package/dist/hooks/auto-update-checker/index.d.ts +5 -1
- package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3996 -1482
- package/dist/logger.d.ts +6 -10
- package/dist/logger.d.ts.map +1 -1
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/lsp.d.ts +1 -0
- package/dist/lsp.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts +2 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/session-cleanup.d.ts +6 -0
- package/dist/shared/session-cleanup.d.ts.map +1 -0
- package/dist/shared/session-directory.d.ts +24 -0
- package/dist/shared/session-directory.d.ts.map +1 -1
- package/dist/shared/status.d.ts +12 -1
- package/dist/shared/status.d.ts.map +1 -1
- package/dist/shared/subagent-detect.d.ts +24 -8
- package/dist/shared/subagent-detect.d.ts.map +1 -1
- package/dist/shared/wake-admission.d.ts +68 -0
- package/dist/shared/wake-admission.d.ts.map +1 -0
- package/dist/shutdown-hooks.d.ts +2 -0
- package/dist/shutdown-hooks.d.ts.map +1 -1
- package/dist/subc-tool-schemas.d.ts +13 -2
- package/dist/subc-tool-schemas.d.ts.map +1 -1
- package/dist/tools/_shared.d.ts +5 -1
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +1 -0
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash_watch.d.ts +4 -0
- package/dist/tools/bash_watch.d.ts.map +1 -1
- package/dist/tools/definitions/v2.d.ts +2 -1
- package/dist/tools/definitions/v2.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts +8 -1
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/inspect.d.ts.map +1 -1
- package/dist/tools/metadata.d.ts +7 -0
- package/dist/tools/metadata.d.ts.map +1 -0
- package/dist/tools/outside-permissions.d.ts +35 -0
- package/dist/tools/outside-permissions.d.ts.map +1 -0
- package/dist/tools/permissions.d.ts +9 -11
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/reading.d.ts.map +1 -1
- package/dist/tools/safety.d.ts +1 -1
- package/dist/tools/safety.d.ts.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/semantic.d.ts.map +1 -1
- package/dist/tui/notification-socket.d.ts.map +1 -1
- package/dist/tui/preferences.d.ts +11 -0
- package/dist/tui/preferences.d.ts.map +1 -1
- package/dist/v2-session-lifecycle.d.ts +7 -0
- package/dist/v2-session-lifecycle.d.ts.map +1 -1
- package/dist/v2-tool-hooks.d.ts +1 -0
- package/dist/v2-tool-hooks.d.ts.map +1 -1
- package/dist/wakes/runtime-consumer.d.ts +14 -3
- package/dist/wakes/runtime-consumer.d.ts.map +1 -1
- package/dist/wakes/session-delivery.d.ts +24 -4
- package/dist/wakes/session-delivery.d.ts.map +1 -1
- package/dist/wakes/subc-recovery.d.ts +8 -0
- package/dist/wakes/subc-recovery.d.ts.map +1 -0
- package/package.json +10 -10
- package/src/entry/server-runtime.mjs +67 -19
- package/src/logger.ts +12 -5
- package/src/shared/rpc-client.ts +35 -28
- package/src/shared/rpc-notifications.ts +5 -3
- package/src/shared/rpc-server.ts +65 -7
- package/src/shared/session-cleanup.ts +13 -0
- package/src/shared/session-directory.ts +59 -3
- package/src/shared/status.ts +32 -2
- package/src/shared/subagent-detect.ts +53 -25
- package/src/shared/wake-admission.ts +340 -0
- package/src/tui/notification-socket.ts +30 -4
- package/src/tui/preferences.ts +66 -29
- package/src/tui/sidebar-view.tsx +1 -0
- package/src/tui/v2.tsx +49 -1
- package/src/tui-compiled/notification-socket.ts +30 -4
- package/src/tui-compiled/preferences.ts +66 -29
- package/src/tui-compiled/sidebar-view.tsx +2 -1
- package/src/tui-compiled/v2.tsx +54 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ToolContext } from "@opencode-ai/plugin";
|
|
2
|
+
type Runtime = Partial<Pick<ToolContext, "ask">> & {
|
|
3
|
+
effectAbort?: AbortSignal;
|
|
4
|
+
/** OpenCode 1's per-call cancellation signal (`ToolContext.abort`). */
|
|
5
|
+
abort?: AbortSignal;
|
|
6
|
+
hostVersion?: 2;
|
|
7
|
+
sessionID?: string;
|
|
8
|
+
messageID?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
callID?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function permissionOperation(tool: string, args: Record<string, unknown>): string;
|
|
13
|
+
export declare function inheritHostPermissionGrants(source: object, target: object): void;
|
|
14
|
+
/** Shell approvals come from the plugin's permission loop, never agent fields. */
|
|
15
|
+
export declare function withHostPermissionGrants(args: Record<string, unknown>, grants: readonly string[]): {
|
|
16
|
+
[x: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
/** Hard ceiling on sends for one call. The engine reports one refused outside
|
|
19
|
+
* path per attempt, so a batch needs one round per distinct outside path plus
|
|
20
|
+
* the final run; this is far above any real batch. */
|
|
21
|
+
export declare const MAX_OUTSIDE_PERMISSION_ROUNDS = 256;
|
|
22
|
+
/** How many times one operation and path may be asked again because the
|
|
23
|
+
* user's approval arrived after its token expired. */
|
|
24
|
+
export declare const MAX_EXPIRED_REASKS_PER_PATH = 2;
|
|
25
|
+
/** The engine asked again for outside access that was already approved in
|
|
26
|
+
* this call, or the ceiling was reached: retrying would not make progress. */
|
|
27
|
+
export declare class OutsidePermissionStalled extends Error {
|
|
28
|
+
readonly code = "outside_permission_stalled";
|
|
29
|
+
constructor(message: string);
|
|
30
|
+
}
|
|
31
|
+
/** Present AFT's outside-path requests through the host callback: OpenCode 2
|
|
32
|
+
* binds it to permission.assert, while OpenCode 1 binds it to context.ask. */
|
|
33
|
+
export declare function withOutsidePermissions<T extends Record<string, unknown>>(runtime: Runtime, args: Record<string, unknown>, send: (args: Record<string, unknown>) => Promise<T>, preview?: boolean, operation?: string): Promise<T>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=outside-permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outside-permissions.d.ts","sourceRoot":"","sources":["../../src/tools/outside-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,GAAG;IACjD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,uEAAuE;IACvE,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAKF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAWvF;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAGhF;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE;;EAIhG;AAED;;sDAEsD;AACtD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD;sDACsD;AACtD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;8EAC8E;AAC9E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,gCAAgC;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;8EAC8E;AAC9E,wBAAsB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5E,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EACnD,OAAO,UAAQ,EACf,SAAS,SAAK,GACb,OAAO,CAAC,CAAC,CAAC,CAoJZ"}
|
|
@@ -7,6 +7,8 @@ export type PermissionAskFailure = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare function classifyPermissionError(error: unknown, fallbackMessage?: string): PermissionAskFailure;
|
|
9
9
|
export declare function permissionRuleDenial(permission: string, root?: string): string;
|
|
10
|
+
/** Discard notices and decisions when the host removes a session. */
|
|
11
|
+
export declare function clearSessionPermissions(sessionID: string): void;
|
|
10
12
|
export type AftSearchExternalPermissionDenial = PermissionAskFailure & {
|
|
11
13
|
permission: "aft_search_external";
|
|
12
14
|
root: string;
|
|
@@ -31,8 +33,10 @@ export declare function resolveRelativePattern(context: ToolContext, target: str
|
|
|
31
33
|
export declare function resolveRelativePatternFromAbsolute(context: ToolContext, absolutePath: string): string;
|
|
32
34
|
export declare function resolveRelativePatterns(context: ToolContext, targets: string[]): string[];
|
|
33
35
|
export declare function workspacePattern(_context: ToolContext): string;
|
|
34
|
-
/**
|
|
36
|
+
/** Other OC2 source tools opt into read rules without changing their OC1 policy. */
|
|
35
37
|
export declare function assertV2ReadPermission(context: ToolContext, targetPath: string): Promise<string | undefined>;
|
|
38
|
+
/** Use the read tool's permission path and denial message on both supported hosts. */
|
|
39
|
+
export declare function assertReadPermission(context: ToolContext, targetPath: string): Promise<string | undefined>;
|
|
36
40
|
export declare function askEditPermission(context: ToolContext, patterns: string[], metadata?: Record<string, unknown>): Promise<string | undefined>;
|
|
37
41
|
/**
|
|
38
42
|
* Check if `child` is inside `parent`. Mirrors `AppFileSystem.contains` in
|
|
@@ -62,15 +66,9 @@ export declare const _permissionsInternalsForTest: {
|
|
|
62
66
|
normalizePathPattern: typeof normalizePathPattern;
|
|
63
67
|
};
|
|
64
68
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* Why this exists: AFT hoisted tools previously only called `permission: "edit"`,
|
|
70
|
-
* which bypassed OpenCode's separate `external_directory` rule (default `ask`).
|
|
71
|
-
* This helper keeps that rule active for ordinary out-of-root paths while
|
|
72
|
-
* suppressing asks for system temp directories, which are unstable world-writable
|
|
73
|
-
* scratch space.
|
|
69
|
+
* Preserve the plugin's hard restriction during configuration reloads. Outside
|
|
70
|
+
* access prompts are decided by the engine and presented by the bridge loop;
|
|
71
|
+
* lexical plugin containment must not approve a symlink's outside target.
|
|
74
72
|
*
|
|
75
73
|
* Returns `undefined` on allow (or when target is inside project), or a
|
|
76
74
|
* denial message string on deny so callers can wrap with
|
|
@@ -127,6 +125,6 @@ export declare function askSearchPermission(context: ToolContext, pattern: strin
|
|
|
127
125
|
export declare function askGlobPermission(context: ToolContext, pattern: string, metadata?: {
|
|
128
126
|
path?: string;
|
|
129
127
|
}): Promise<string | undefined>;
|
|
130
|
-
export declare function permissionDeniedResponse(message: string): string;
|
|
128
|
+
export declare function permissionDeniedResponse(message: string, context?: ToolContext): string;
|
|
131
129
|
export {};
|
|
132
130
|
//# source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AAE,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;AA2CjD,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,CAqW/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"}
|
package/dist/tools/safety.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ToolDefinition } from "@opencode-ai/plugin";
|
|
|
2
2
|
import type { PluginContext } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Tool definitions for safety & recovery commands: undo, edit_history,
|
|
5
|
-
* checkpoint, restore_checkpoint, list_checkpoints.
|
|
5
|
+
* checkpoint, restore_checkpoint, list_checkpoints, purge.
|
|
6
6
|
*/
|
|
7
7
|
export declare function safetyTools(ctx: PluginContext): Record<string, ToolDefinition>;
|
|
8
8
|
//# sourceMappingURL=safety.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"AAGA,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,CA+L9E"}
|
|
@@ -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,CAkM9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA+GjD,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAsJhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../src/tui/notification-socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA8C,MAAM,sBAAsB,CAAC;AAGhG,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAClF;AAED,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CACd,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,EAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,I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* Whether OpenCode 2 shows AFT's health line (`AFT E0 W0 | D0 U0 C0 | T0`)
|
|
14
|
+
* in the prompt footer. Off hides it entirely; the sidebar and the status
|
|
15
|
+
* dialog are unaffected.
|
|
16
|
+
*/
|
|
17
|
+
footer: boolean;
|
|
12
18
|
header: {
|
|
13
19
|
label: string;
|
|
14
20
|
showVersion: boolean;
|
|
@@ -27,6 +33,11 @@ export declare function resolveAftPrefs(root: Record<string, unknown>): AftTuiPr
|
|
|
27
33
|
export declare function computeEffectiveOrder(root: Record<string, unknown>, pluginKey: string, defaultOrder: number): number;
|
|
28
34
|
type JsonValue = string | number | boolean | null;
|
|
29
35
|
export declare function queueTuiPreferenceUpdate(pluginKey: string, path: string[], value: JsonValue): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Calls `onChange` after the preferences file's content changes, including
|
|
38
|
+
* when the file is deleted (callers then read defaults) and when it is
|
|
39
|
+
* created again.
|
|
40
|
+
*/
|
|
30
41
|
export declare function watchTuiPreferences(onChange: () => void): () => void;
|
|
31
42
|
export declare function persistCollapsedIfEnabled(prefs: AftTuiPrefs, collapsed: boolean): void;
|
|
32
43
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/tui/preferences.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,kCAAkC,CAAC;AAGlE,wBAAgB,qBAAqB,IAAI,MAAM,CAO9C;AAMD,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAQ/E;AAED,eAAO,MAAM,UAAU,QAAQ,CAAC;AAChC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EA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ElE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CA0B1E;AAID,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,MAAM,CAOR;AASD,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAkDlD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,IAAI,CAAC,CAKf;AA2BD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAsCpE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAItF"}
|
|
@@ -3,6 +3,13 @@ import type { PluginContext } from "./types.js";
|
|
|
3
3
|
/** Hold a racing wake until the host classifies an interrupted tool's execution. */
|
|
4
4
|
export declare function noteV2ToolAbort(client: unknown, sessionID: string): void;
|
|
5
5
|
export declare function awaitV2ExecutionSettlement(client: unknown, sessionID: string): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* True once the host has deleted this session in this Location. Wake routes
|
|
8
|
+
* use it to drop a late completion without recreating per-session state.
|
|
9
|
+
*/
|
|
10
|
+
export declare function v2SessionDeleted(client: unknown, sessionID: string): boolean;
|
|
11
|
+
/** Test-only visibility into retained session entries, including task-kill closures. */
|
|
12
|
+
export declare function _v2SessionCountForTest(client: object): number;
|
|
6
13
|
export declare function v2SubagentStopped(client: unknown, sessionID: string): boolean;
|
|
7
14
|
export declare function v2StopEpoch(client: unknown, sessionID: string): number;
|
|
8
15
|
/** Only a command's spawning call records ownership; watching another session's task does not. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-session-lifecycle.d.ts","sourceRoot":"","sources":["../src/v2-session-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"v2-session-lifecycle.d.ts","sourceRoot":"","sources":["../src/v2-session-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAU,MAAM,QAAQ,CAAC;AAM/C,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;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAE5E;AAeD,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AA4BD,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;AA0BD,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,CAmBf;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,aAAa,4DA8I/E"}
|
package/dist/v2-tool-hooks.d.ts
CHANGED
|
@@ -14,5 +14,6 @@ import type { PluginContext } from "./types.js";
|
|
|
14
14
|
export declare function registerV2ToolHooks(context: unknown, runtime: {
|
|
15
15
|
hashlineEffective?: boolean;
|
|
16
16
|
pool?: PluginContext["pool"];
|
|
17
|
+
drainBgNotifications?: (sessionID: string) => Promise<void>;
|
|
17
18
|
}, registeredTools: ReadonlySet<string>, bashDescription?: string): Effect.Effect<void, never, import("effect/Scope").Scope>;
|
|
18
19
|
//# 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;AAOxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAsDhD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IACP,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D,EACD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EACpC,eAAe,CAAC,EAAE,MAAM,4DAsHzB"}
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import type { BridgeOptions } from "@cortexkit/aft-bridge";
|
|
1
|
+
import type { AftProjectTransport, AftTransportFactoryOptions, AftTransportPool, BridgeOptions } from "@cortexkit/aft-bridge";
|
|
2
2
|
import type { AftConfig } from "../config.js";
|
|
3
3
|
import type { V2ToolConsumers } from "../tools/definitions/v2.js";
|
|
4
4
|
import { type V2SessionAdmission } from "./session-delivery.js";
|
|
5
5
|
export interface V2WakeHostContext {
|
|
6
6
|
readonly session: V2SessionAdmission;
|
|
7
7
|
}
|
|
8
|
+
export interface V2RuntimeConsumerOptions {
|
|
9
|
+
/** Delays before each automatic retry of a failed standalone wake; tests shorten them. */
|
|
10
|
+
readonly standaloneRetryDelaysMs?: readonly number[];
|
|
11
|
+
}
|
|
8
12
|
/** Test-only: forget every route and held completion in the process-wide table. */
|
|
9
13
|
export declare function __resetV2WakeRoutesForTests(): void;
|
|
10
|
-
declare const sharedBridgeOptions: Pick<BridgeOptions, "onBashCompletion" | "onBashLongRunning">;
|
|
14
|
+
declare const sharedBridgeOptions: Pick<BridgeOptions, "onBashCompletion" | "onBashLongRunning" | "onBashPatternMatch">;
|
|
15
|
+
declare const sharedTransportOptions: Pick<AftTransportFactoryOptions, "onBgEventsNudge">;
|
|
11
16
|
export interface V2RuntimeConsumer extends V2ToolConsumers {
|
|
12
17
|
readonly bridgeOptions: typeof sharedBridgeOptions;
|
|
18
|
+
readonly transportOptions: typeof sharedTransportOptions;
|
|
13
19
|
dispose(): void;
|
|
20
|
+
subcWakes(getPool: () => AftTransportPool, directory: string): {
|
|
21
|
+
handlers: Pick<AftTransportFactoryOptions, "onBgEventsNudge" | "onBgEventsNudgeRef">;
|
|
22
|
+
drainSession(sessionID: string): Promise<void>;
|
|
23
|
+
restoreSession(sessionID: string): Promise<void>;
|
|
24
|
+
};
|
|
14
25
|
}
|
|
15
26
|
/**
|
|
16
27
|
* Creates the V2 execution consumers for one OpenCode Location. The bridge owns
|
|
@@ -21,6 +32,6 @@ export interface V2RuntimeConsumer extends V2ToolConsumers {
|
|
|
21
32
|
* replaces it); it decides whether an admitted completion detaches the
|
|
22
33
|
* session's waits.
|
|
23
34
|
*/
|
|
24
|
-
export declare function createV2RuntimeConsumer(context: V2WakeHostContext, getConfig?: () => AftConfig): V2RuntimeConsumer;
|
|
35
|
+
export declare function createV2RuntimeConsumer(context: V2WakeHostContext, getConfig?: () => AftConfig, getBridge?: (root?: string) => AftProjectTransport, options?: V2RuntimeConsumerOptions): V2RuntimeConsumer;
|
|
25
36
|
export {};
|
|
26
37
|
//# 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,
|
|
1
|
+
{"version":3,"file":"runtime-consumer.d.ts","sourceRoot":"","sources":["../../src/wakes/runtime-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAMhB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAoB/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AASlE,OAAO,EAAE,KAAK,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Effect } from "effect";
|
|
2
|
+
export declare const MAX_ADMITTED_WAKES = 4096;
|
|
3
|
+
export declare class WakeDeliveryOverflow extends Error {
|
|
4
|
+
readonly type = "wake_delivery_overflow";
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* The `metadata.source` marker for AFT-written session input. Synthetic wakes
|
|
4
9
|
* retain it, and the prompt hook recognises it on machine-originated prompts
|
|
@@ -36,6 +41,14 @@ export interface CompletionWake {
|
|
|
36
41
|
readonly taskIDs: readonly string[];
|
|
37
42
|
readonly text: string;
|
|
38
43
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
44
|
+
/** Distinguish a watch match from the later terminal completion of the same task. */
|
|
45
|
+
readonly notificationID?: string;
|
|
46
|
+
}
|
|
47
|
+
export type WakeAdmission = "delivered" | "already-delivered" | "not-delivered";
|
|
48
|
+
export interface PatternMatchWake extends CompletionWake {
|
|
49
|
+
readonly watchID: string;
|
|
50
|
+
readonly matchOffset: number;
|
|
51
|
+
readonly reason?: string;
|
|
39
52
|
}
|
|
40
53
|
export interface StatusOnlyUpdate {
|
|
41
54
|
readonly sessionID: string;
|
|
@@ -45,14 +58,21 @@ export interface StatusOnlyUpdate {
|
|
|
45
58
|
}
|
|
46
59
|
/**
|
|
47
60
|
* Admit V2 session updates as synthetic input so machine-written notices are
|
|
48
|
-
* not rendered as user turns. Completions wake execution;
|
|
61
|
+
* not rendered as user turns. Completions and pattern matches wake execution;
|
|
62
|
+
* status does not.
|
|
49
63
|
*/
|
|
50
64
|
export declare class V2SessionDelivery {
|
|
51
65
|
private readonly session;
|
|
52
|
-
private readonly
|
|
66
|
+
private readonly retainedWakeLimit;
|
|
67
|
+
private readonly admittedWakes;
|
|
53
68
|
private disposed;
|
|
54
|
-
constructor(session: V2SessionAdmission);
|
|
55
|
-
completion(input: CompletionWake): Effect.Effect<
|
|
69
|
+
constructor(session: V2SessionAdmission, retainedWakeLimit?: number);
|
|
70
|
+
completion(input: CompletionWake): Effect.Effect<WakeAdmission, unknown>;
|
|
71
|
+
patternMatch(input: PatternMatchWake): Effect.Effect<WakeAdmission, unknown>;
|
|
72
|
+
private patternKey;
|
|
73
|
+
retirePatternMatch(input: PatternMatchWake): void;
|
|
74
|
+
retireCompletion(input: Pick<CompletionWake, "sessionID" | "taskIDs" | "notificationID">): void;
|
|
75
|
+
private admitWake;
|
|
56
76
|
status(input: StatusOnlyUpdate): Effect.Effect<void, unknown>;
|
|
57
77
|
dispose(): void;
|
|
58
78
|
}
|
|
@@ -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;
|
|
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;AAGtC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,4BAA4B;;CAI1C;AAED;;;;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,C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
|
+
* A Location owns no subc subscriptions after release. Recover a small recent
|
|
4
|
+
* host-owned set, using each session's own route, without delaying startup.
|
|
5
|
+
* Older sessions recover when they next call a tool or send a prompt.
|
|
6
|
+
*/
|
|
7
|
+
export declare function recoverV2SubcSessions(context: unknown, directory: string, restoreSession: (sessionID: string) => Promise<void>): Effect.Effect<void, never, never>;
|
|
8
|
+
//# sourceMappingURL=subc-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subc-recovery.d.ts","sourceRoot":"","sources":["../../src/wakes/subc-recovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,MAAM,EAAE,MAAM,QAAQ,CAAC;AAM1C;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,qCAyCrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.4",
|
|
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,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@clack/prompts": "^1.6.0",
|
|
42
|
-
"@cortexkit/aft-bridge": "0.
|
|
42
|
+
"@cortexkit/aft-bridge": "0.63.4",
|
|
43
43
|
"@opentui/core": "0.4.3",
|
|
44
44
|
"@opentui/solid": "0.4.3",
|
|
45
45
|
"comment-json": "^4.6.2",
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"zod": "^4.4.3"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
53
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
54
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
55
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
56
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
57
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
52
|
+
"@cortexkit/aft-darwin-arm64": "0.63.4",
|
|
53
|
+
"@cortexkit/aft-darwin-x64": "0.63.4",
|
|
54
|
+
"@cortexkit/aft-linux-arm64": "0.63.4",
|
|
55
|
+
"@cortexkit/aft-linux-x64": "0.63.4",
|
|
56
|
+
"@cortexkit/aft-win32-arm64": "0.63.4",
|
|
57
|
+
"@cortexkit/aft-win32-x64": "0.63.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@opencode-ai/plugin": "^1.17.11",
|
|
61
61
|
"@opencode-ai/sdk": "^1.17.11",
|
|
62
|
-
"@opencode/client": "2.0
|
|
63
|
-
"@opencode/plugin": "
|
|
62
|
+
"@opencode/client": "2.1.0",
|
|
63
|
+
"@opencode/plugin": "2.1.0",
|
|
64
64
|
"@types/node": "^22.0.0",
|
|
65
65
|
"typescript": "^5.8.0"
|
|
66
66
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { acquireBridge, releaseBridge } from "@cortexkit/aft-bridge";
|
|
2
|
-
import { Effect } from "effect";
|
|
2
|
+
import { Cause, Effect } from "effect";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
applyToolSurfaceOverrides,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { resolveBridgePoolTransportOptions } from "../config.js";
|
|
15
15
|
import { buildConfigErrorToolMap } from "../config-error-surface.js";
|
|
16
16
|
import { startOpenCodeLiveConfigReload } from "../config-live-reload.js";
|
|
17
|
-
import { debug, log, warn } from "../logger.js";
|
|
17
|
+
import { debug, error, log, warn } from "../logger.js";
|
|
18
18
|
import { resolvePluginVersion } from "../plugin-version.js";
|
|
19
19
|
import { registerAftConfigErrorRpc, registerAftRpc } from "../rpc/register.js";
|
|
20
20
|
import { hoistedV2ToolConsumers } from "../tools/hoisted/v2.js";
|
|
@@ -27,6 +27,7 @@ import { registerV2ToolHooks } from "../v2-tool-hooks.js";
|
|
|
27
27
|
import { registerV2SessionLifecycle } from "../v2-session-lifecycle.js";
|
|
28
28
|
import { registerV2WorkflowHints } from "../v2-workflow-hints.js";
|
|
29
29
|
import { createV2RuntimeConsumer } from "../wakes/runtime-consumer.js";
|
|
30
|
+
import { recoverV2SubcSessions } from "../wakes/subc-recovery.js";
|
|
30
31
|
import { buildHintsForRegisteredTools } from "../workflow-hints.js";
|
|
31
32
|
import {
|
|
32
33
|
buildAftToolDefinitions,
|
|
@@ -48,9 +49,9 @@ const defaults = {
|
|
|
48
49
|
registerWorkflowHints: registerV2WorkflowHints,
|
|
49
50
|
// `getConfig` returns the Location's current config, which a live reload
|
|
50
51
|
// replaces; the wake consumer reads it when a completion arrives.
|
|
51
|
-
toolConsumers: (context, config, getConfig = () => config) => ({
|
|
52
|
+
toolConsumers: (context, config, getConfig = () => config, getBridge) => ({
|
|
52
53
|
...hoistedV2ToolConsumers(context),
|
|
53
|
-
...createV2RuntimeConsumer(context, getConfig),
|
|
54
|
+
...createV2RuntimeConsumer(context, getConfig, getBridge),
|
|
54
55
|
}),
|
|
55
56
|
acquireBridge,
|
|
56
57
|
releaseBridge,
|
|
@@ -88,14 +89,24 @@ async function bootLocation(context, location, dependencies) {
|
|
|
88
89
|
{ configRoot: directory, lspDirectory: directory, config, pluginVersion, notify },
|
|
89
90
|
dependencies,
|
|
90
91
|
);
|
|
91
|
-
const canonicalDirectory = location.project?.canonical ?? directory;
|
|
92
92
|
let liveConfig = config;
|
|
93
|
-
const consumers = dependencies.toolConsumers(
|
|
93
|
+
const consumers = dependencies.toolConsumers(
|
|
94
|
+
context,
|
|
95
|
+
config,
|
|
96
|
+
() => liveConfig,
|
|
97
|
+
(root = directory) => pool.getBridge(root),
|
|
98
|
+
);
|
|
94
99
|
// Only a rejected configuration keeps AFT out of a project; there is no
|
|
95
100
|
// config switch that turns it off.
|
|
96
101
|
const isProjectEnabled = createProjectAcceptance(directory, dependencies);
|
|
102
|
+
const subcWakes = config.subc?.connection_file?.trim()
|
|
103
|
+
? consumers.subcWakes?.(() => pool, directory)
|
|
104
|
+
: undefined;
|
|
97
105
|
// getPool is only called on a version mismatch, after the pool exists.
|
|
98
|
-
|
|
106
|
+
let pool;
|
|
107
|
+
let liveConfigReload;
|
|
108
|
+
try {
|
|
109
|
+
pool = await dependencies.acquireBridge(directory, {
|
|
99
110
|
harness: "opencode",
|
|
100
111
|
binaryPath: environment.binaryPath,
|
|
101
112
|
poolOptions: {
|
|
@@ -111,6 +122,8 @@ async function bootLocation(context, location, dependencies) {
|
|
|
111
122
|
},
|
|
112
123
|
configOverrides: environment.configOverrides,
|
|
113
124
|
subcConnectionFile: config.subc?.connection_file,
|
|
125
|
+
...consumers.transportOptions,
|
|
126
|
+
...subcWakes?.handlers,
|
|
114
127
|
});
|
|
115
128
|
environment.attach(pool);
|
|
116
129
|
const toolContext = {
|
|
@@ -126,6 +139,7 @@ async function bootLocation(context, location, dependencies) {
|
|
|
126
139
|
hostToolNames: V2_HOST_TOOL_NAMES,
|
|
127
140
|
storageDir: environment.storageDir,
|
|
128
141
|
isProjectEnabled,
|
|
142
|
+
drainBgNotifications: subcWakes?.drainSession,
|
|
129
143
|
};
|
|
130
144
|
const tools = dependencies.buildToolMap(
|
|
131
145
|
toolContext,
|
|
@@ -141,7 +155,7 @@ async function bootLocation(context, location, dependencies) {
|
|
|
141
155
|
const hintsBlock = hints === null ? null : renameV2ToolReferences(hints);
|
|
142
156
|
// Keep this Location's live config keys current when a config file changes.
|
|
143
157
|
// The finalizer that releases the bridge also stops the watch.
|
|
144
|
-
|
|
158
|
+
liveConfigReload = dependencies.startLiveConfigReload({
|
|
145
159
|
directory,
|
|
146
160
|
initialSources: bootstrap.sources ?? [],
|
|
147
161
|
initialSourceTexts: bootstrap.sourceTexts,
|
|
@@ -152,7 +166,16 @@ async function bootLocation(context, location, dependencies) {
|
|
|
152
166
|
},
|
|
153
167
|
notify,
|
|
154
168
|
});
|
|
155
|
-
return { consumers, pool, tools, liveConfigReload, toolContext, directory, hintsBlock };
|
|
169
|
+
return { consumers, pool, tools, liveConfigReload, toolContext, directory, hintsBlock, subcWakes };
|
|
170
|
+
} catch (error) {
|
|
171
|
+
// Boot failures precede finalizer ownership, so unwind every acquired resource here.
|
|
172
|
+
await Promise.allSettled([
|
|
173
|
+
Promise.resolve().then(() => liveConfigReload?.stop()),
|
|
174
|
+
Promise.resolve().then(() => consumers.dispose?.()),
|
|
175
|
+
Promise.resolve().then(() => pool && dependencies.releaseBridge(pool)),
|
|
176
|
+
]);
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
156
179
|
}
|
|
157
180
|
|
|
158
181
|
/**
|
|
@@ -216,7 +239,32 @@ export function makeServerEffect(overrides = {}) {
|
|
|
216
239
|
// finalizer logs when the host disposes the Location.
|
|
217
240
|
const logRuntimeStop = logRuntimeStart(location);
|
|
218
241
|
yield* Effect.addFinalizer(() => Effect.sync(logRuntimeStop));
|
|
219
|
-
|
|
242
|
+
// The host runs this program under Effect.ignoreCause, so a rejected boot
|
|
243
|
+
// would otherwise leave the Location without AFT and without any log.
|
|
244
|
+
// Interruption is the host disposing the Location mid-boot, not a failure.
|
|
245
|
+
const runtime = yield* Effect.acquireRelease(
|
|
246
|
+
Effect.promise(() => bootLocation(context, location, dependencies)),
|
|
247
|
+
(runtime) => Effect.promise(async () => {
|
|
248
|
+
try {
|
|
249
|
+
runtime.liveConfigReload?.stop();
|
|
250
|
+
} finally {
|
|
251
|
+
try {
|
|
252
|
+
runtime.consumers.dispose?.();
|
|
253
|
+
} finally {
|
|
254
|
+
if (runtime.pool) await dependencies.releaseBridge(runtime.pool);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
258
|
+
).pipe(
|
|
259
|
+
Effect.tapCause((cause) =>
|
|
260
|
+
Effect.sync(() => {
|
|
261
|
+
if (Cause.hasInterruptsOnly(cause)) return;
|
|
262
|
+
error(
|
|
263
|
+
`AFT V2 boot failed for Location ${location.id ?? "(no id)"} at ${location.directory}: ${Cause.pretty(cause)}`,
|
|
264
|
+
);
|
|
265
|
+
}),
|
|
266
|
+
),
|
|
267
|
+
);
|
|
220
268
|
if (!runtime) return;
|
|
221
269
|
|
|
222
270
|
if (runtime.configError !== undefined) {
|
|
@@ -226,13 +274,6 @@ export function makeServerEffect(overrides = {}) {
|
|
|
226
274
|
return;
|
|
227
275
|
}
|
|
228
276
|
|
|
229
|
-
yield* Effect.addFinalizer(() =>
|
|
230
|
-
Effect.promise(async () => {
|
|
231
|
-
runtime.liveConfigReload?.stop();
|
|
232
|
-
runtime.consumers.dispose?.();
|
|
233
|
-
await dependencies.releaseBridge(runtime.pool);
|
|
234
|
-
}),
|
|
235
|
-
);
|
|
236
277
|
const rpc = yield* dependencies.registerRpc(context, location, runtime.pool);
|
|
237
278
|
yield* Effect.addFinalizer(() => Effect.promise(() => rpc.dispose()));
|
|
238
279
|
yield* registerV2SessionLifecycle(context, runtime.toolContext);
|
|
@@ -241,8 +282,8 @@ export function makeServerEffect(overrides = {}) {
|
|
|
241
282
|
// The config is read through the tool context so live reloads apply.
|
|
242
283
|
// The bridge asked first is the one this Location's tools run on, the
|
|
243
284
|
// Location's own directory; for a Location in a linked git worktree that
|
|
244
|
-
// is the worktree, not the canonical main checkout
|
|
245
|
-
//
|
|
285
|
+
// is the worktree, not the canonical main checkout. Other bridges are
|
|
286
|
+
// still tried after it.
|
|
246
287
|
yield* dependencies.registerPromptHook(context, {
|
|
247
288
|
pool: runtime.pool,
|
|
248
289
|
projectRoot: runtime.directory,
|
|
@@ -262,6 +303,13 @@ export function makeServerEffect(overrides = {}) {
|
|
|
262
303
|
runtime.tools.bash?.description,
|
|
263
304
|
);
|
|
264
305
|
yield* dependencies.registerWorkflowHints(context, runtime.hintsBlock);
|
|
306
|
+
if (runtime.subcWakes) {
|
|
307
|
+
yield* Effect.forkScoped(recoverV2SubcSessions(
|
|
308
|
+
context,
|
|
309
|
+
runtime.directory,
|
|
310
|
+
runtime.subcWakes.restoreSession,
|
|
311
|
+
));
|
|
312
|
+
}
|
|
265
313
|
});
|
|
266
314
|
};
|
|
267
315
|
}
|
package/src/logger.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RotatingLogSink, resolvePluginLogPath } from "@cortexkit/aft-bridge";
|
|
1
|
+
import { type LogMeta, RotatingLogSink, resolvePluginLogPath } from "@cortexkit/aft-bridge";
|
|
2
2
|
|
|
3
3
|
const TAG = "[aft-plugin]";
|
|
4
4
|
|
|
@@ -125,17 +125,24 @@ export function flushLog(): void {
|
|
|
125
125
|
/**
|
|
126
126
|
* Adapter that exposes this logger as a {@link import("@cortexkit/aft-bridge").Logger}
|
|
127
127
|
* for the shared bridge package. The bridge package never knows about this log
|
|
128
|
-
* file or the `[aft-plugin]` tag — it just calls `log/warn/error` and we map
|
|
128
|
+
* file or the `[aft-plugin]` tag — it just calls `log/debug/warn/error` and we map
|
|
129
129
|
* its `LogMeta.sessionId` into our internal session-prefix shape.
|
|
130
130
|
*/
|
|
131
131
|
export const bridgeLogger = {
|
|
132
|
-
|
|
132
|
+
debug(message: string, meta?: LogMeta) {
|
|
133
|
+
if (meta?.engineRecord) return;
|
|
134
|
+
sessionDebug(meta?.sessionId, message);
|
|
135
|
+
},
|
|
136
|
+
log(message: string, meta?: LogMeta) {
|
|
137
|
+
if (meta?.engineRecord) return;
|
|
133
138
|
sessionLog(meta?.sessionId, message);
|
|
134
139
|
},
|
|
135
|
-
warn(message: string, meta?:
|
|
140
|
+
warn(message: string, meta?: LogMeta) {
|
|
141
|
+
if (meta?.engineRecord) return;
|
|
136
142
|
sessionWarn(meta?.sessionId, message);
|
|
137
143
|
},
|
|
138
|
-
error(message: string, meta?:
|
|
144
|
+
error(message: string, meta?: LogMeta) {
|
|
145
|
+
if (meta?.engineRecord) return;
|
|
139
146
|
sessionError(meta?.sessionId, message);
|
|
140
147
|
},
|
|
141
148
|
getLogFilePath: () => logFile,
|