@cortexkit/aft-opencode 0.58.0 → 0.58.2
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/bridge-bootstrap.d.ts +8 -0
- package/dist/bridge-bootstrap.d.ts.map +1 -1
- package/dist/config-live-reload.d.ts +323 -0
- package/dist/config-live-reload.d.ts.map +1 -0
- package/dist/config.d.ts +59 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/entry/server.js +2543 -989
- package/dist/hashline-tag-sources.d.ts +18 -0
- package/dist/hashline-tag-sources.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -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 +1901 -748
- package/dist/lsp-auto-install.d.ts +30 -0
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/lsp-github-table.d.ts +4 -3
- package/dist/lsp-github-table.d.ts.map +1 -1
- package/dist/lsp-npm-table.d.ts +11 -1
- package/dist/lsp-npm-table.d.ts.map +1 -1
- package/dist/lsp-registry-probe.d.ts +8 -4
- package/dist/lsp-registry-probe.d.ts.map +1 -1
- package/dist/permissions/v2-service.d.ts +110 -5
- package/dist/permissions/v2-service.d.ts.map +1 -1
- package/dist/rpc/register.d.ts +0 -4
- package/dist/rpc/register.d.ts.map +1 -1
- package/dist/shared/read-vision.d.ts +10 -0
- package/dist/shared/read-vision.d.ts.map +1 -0
- package/dist/shared/session-directory.d.ts +7 -0
- package/dist/shared/session-directory.d.ts.map +1 -1
- package/dist/shared/subagent-detect.d.ts +11 -4
- package/dist/shared/subagent-detect.d.ts.map +1 -1
- package/dist/tool-perf.d.ts +1 -0
- package/dist/tool-perf.d.ts.map +1 -1
- package/dist/tool-registration.d.ts +8 -5
- package/dist/tool-registration.d.ts.map +1 -1
- package/dist/tools/_shared.d.ts +16 -15
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +24 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash_watch.d.ts +5 -2
- package/dist/tools/bash_watch.d.ts.map +1 -1
- package/dist/tools/bash_write.d.ts.map +1 -1
- package/dist/tools/definitions/v2.d.ts +2 -0
- package/dist/tools/definitions/v2.d.ts.map +1 -1
- package/dist/tools/hoisted/v2.d.ts +8 -1
- package/dist/tools/hoisted/v2.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts +9 -7
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/reading.d.ts +0 -3
- package/dist/tools/reading.d.ts.map +1 -1
- package/dist/v2-prompt-detach.d.ts +69 -0
- package/dist/v2-prompt-detach.d.ts.map +1 -0
- package/dist/wakes/runtime-consumer.d.ts +2 -0
- package/dist/wakes/runtime-consumer.d.ts.map +1 -1
- package/dist/wakes/session-delivery.d.ts +9 -0
- package/dist/wakes/session-delivery.d.ts.map +1 -1
- package/dist/workflow-hints.d.ts +20 -7
- package/dist/workflow-hints.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/entry/server-runtime.mjs +36 -5
- package/src/shared/read-vision.ts +100 -0
- package/src/shared/session-directory.ts +92 -0
- package/src/shared/subagent-detect.ts +89 -28
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
* avoids mid-session bridge restarts.
|
|
29
29
|
*/
|
|
30
30
|
import { type AftTransportPool } from "@cortexkit/aft-bridge";
|
|
31
|
+
import { type NpmServerSpec } from "./lsp-npm-table.js";
|
|
32
|
+
import { type VersionPickResult } from "./lsp-registry-probe.js";
|
|
31
33
|
/** Per-call configuration drawn from `lsp.*` plugin config. */
|
|
32
34
|
export interface AutoInstallConfig {
|
|
33
35
|
/** Master enable. Default: true. */
|
|
@@ -74,6 +76,27 @@ export interface AutoInstallResult {
|
|
|
74
76
|
getCachedBinDirs: () => string[];
|
|
75
77
|
}
|
|
76
78
|
export declare function abortInFlightAutoInstalls(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve which version to install for `spec`, honoring user pins,
|
|
81
|
+
* cached version checks, and the 7-day grace.
|
|
82
|
+
*
|
|
83
|
+
* Returns the version string to install, or null when:
|
|
84
|
+
* - probe failed and nothing is cached
|
|
85
|
+
* - all candidates are within grace (blockedByGrace)
|
|
86
|
+
*
|
|
87
|
+
* `null` callers should fall back to whatever's installed (if anything),
|
|
88
|
+
* else skip + warn.
|
|
89
|
+
*
|
|
90
|
+
* Apart from a user pin, the result always satisfies the entry's
|
|
91
|
+
* `supportedMajor`: a cached decision outside it is treated as a cache miss.
|
|
92
|
+
* Callers compare the result against the installed version, so a cached
|
|
93
|
+
* install of the wrong major is then replaced.
|
|
94
|
+
*/
|
|
95
|
+
export declare function resolveTargetVersion(spec: NpmServerSpec, config: AutoInstallConfig, fetchImpl?: typeof fetch): Promise<{
|
|
96
|
+
version: string | null;
|
|
97
|
+
pinned: boolean;
|
|
98
|
+
probe: VersionPickResult | null;
|
|
99
|
+
}>;
|
|
77
100
|
/**
|
|
78
101
|
* Spawn `npm install --no-save <pkg>@<version>` in the cache dir.
|
|
79
102
|
*
|
|
@@ -104,6 +127,13 @@ export declare function abortInFlightAutoInstalls(): Promise<void>;
|
|
|
104
127
|
* Idempotent: only writes when absent. Failures are non-fatal (logged).
|
|
105
128
|
*/
|
|
106
129
|
export declare function ensureInstallAnchor(cwd: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* True when the cached install's recorded version is one this entry may use:
|
|
132
|
+
* inside `supportedMajor`, or exactly the user's `lsp.versions` pin. A cached
|
|
133
|
+
* install outside it is neither surfaced to the binary nor kept as a fallback,
|
|
134
|
+
* so the next install replaces it.
|
|
135
|
+
*/
|
|
136
|
+
export declare function installedVersionAllowed(spec: NpmServerSpec, config: AutoInstallConfig): boolean;
|
|
107
137
|
/**
|
|
108
138
|
* Top-level entry point. Returns the list of bin directories that already
|
|
109
139
|
* have an installed binary AND kicks off background installs for missing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAcH,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAcH,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM3F,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,MAAM,EAAE,CAAC;CAClC;AAiED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAAC,CA6CvF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAYrD;AAoXD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAI/F;AAWD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CA+EnB;AAED,gFAAgF;AAChF,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,aAAa,CAAC,EACpE,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
* NOTE: terraform-ls uses HashiCorp's release API, not GitHub. It's a
|
|
11
11
|
* separate code path; not included in this table.
|
|
12
12
|
*
|
|
13
|
-
* NOTE: oxlint
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* NOTE: install oxlint in the project (`npm install --save-dev oxlint`).
|
|
14
|
+
* AFT resolves `node_modules/.bin/oxlint` and starts it with `--lsp`, or
|
|
15
|
+
* prefers the standalone `oxc_language_server` shipped by older releases.
|
|
16
|
+
* It stays project-managed rather than being downloaded by AFT.
|
|
16
17
|
*
|
|
17
18
|
* NOTE: kotlin-language-server is hosted on JetBrains CDN, not GitHub.
|
|
18
19
|
* Skipped from auto-download for v0.17.0 — users install via Homebrew /
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-github-table.d.ts","sourceRoot":"","sources":["../src/lsp-github-table.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lsp-github-table.d.ts","sourceRoot":"","sources":["../src/lsp-github-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAEnC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,QAAQ,CAAC,YAAY,EAAE,CACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,KACZ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3F;AA4HD,eAAO,MAAM,gBAAgB,EAAE,SAAS,gBAAgB,EAMvD,CAAC;AAEF,sCAAsC;AACtC,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE7E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,IAAI,CAQ9E"}
|
package/dist/lsp-npm-table.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 3. Special (eslint/prisma — uses project's own node_modules)
|
|
13
13
|
*/
|
|
14
14
|
export interface NpmServerSpec {
|
|
15
|
-
/**
|
|
15
|
+
/** Server ID, or a separate ID for a runtime installed alongside a server (e.g. `typescript-sdk`). */
|
|
16
16
|
readonly id: string;
|
|
17
17
|
/** npm package name. */
|
|
18
18
|
readonly npm: string;
|
|
@@ -36,10 +36,20 @@ export interface NpmServerSpec {
|
|
|
36
36
|
* user sees a recurring `lsp_binary_missing` warning.
|
|
37
37
|
*/
|
|
38
38
|
readonly packageJsonDeps?: readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* Install only releases of this major version. Registry versions and cached
|
|
41
|
+
* version decisions outside it are ignored, and a cached install of another
|
|
42
|
+
* major counts as out of date. Omit it to track the newest release.
|
|
43
|
+
*/
|
|
44
|
+
readonly supportedMajor?: number;
|
|
39
45
|
}
|
|
40
46
|
export declare const NPM_LSP_TABLE: readonly NpmServerSpec[];
|
|
41
47
|
/** Find an entry by AFT server id. */
|
|
42
48
|
export declare function findNpmServerById(id: string): NpmServerSpec | undefined;
|
|
43
49
|
/** Find an entry by binary name. */
|
|
44
50
|
export declare function findNpmServerByBinary(binary: string): NpmServerSpec | undefined;
|
|
51
|
+
/** Leading major version of a version string such as `5.9.3`, or null. */
|
|
52
|
+
export declare function majorVersionOf(version: string): number | null;
|
|
53
|
+
/** True when `version` is a release `spec` may install or keep. */
|
|
54
|
+
export declare function isVersionSupported(spec: NpmServerSpec, version: string): boolean;
|
|
45
55
|
//# sourceMappingURL=lsp-npm-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-npm-table.d.ts","sourceRoot":"","sources":["../src/lsp-npm-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,aAAa;IAC5B,
|
|
1
|
+
{"version":3,"file":"lsp-npm-table.d.ts","sourceRoot":"","sources":["../src/lsp-npm-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,aAAa;IAC5B,sGAAsG;IACtG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0FAA0F;IAC1F,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAkGjD,CAAC;AAEF,sCAAsC;AACtC,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEvE;AAED,oCAAoC;AACpC,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE/E;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7D;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGhF"}
|
|
@@ -25,6 +25,8 @@ export interface VersionPickResult {
|
|
|
25
25
|
version: string | null;
|
|
26
26
|
/** True when the registry has versions but none is older than `graceDays`. */
|
|
27
27
|
blockedByGrace: boolean;
|
|
28
|
+
/** True when the registry has versions but none passes the caller's version filter. */
|
|
29
|
+
outsideSupportedRange: boolean;
|
|
28
30
|
/** All eligible versions sorted by publish date (newest first). For tests/logs. */
|
|
29
31
|
eligible: ReadonlyArray<{
|
|
30
32
|
version: string;
|
|
@@ -36,15 +38,17 @@ export interface VersionPickResult {
|
|
|
36
38
|
* 1. is published at least `graceDays` ago
|
|
37
39
|
* 2. is the newest such version (per ISO publish time)
|
|
38
40
|
*
|
|
39
|
-
* Pre-release versions (semver "-" tags) are skipped
|
|
41
|
+
* Pre-release versions (semver "-" tags) are skipped, and so are versions
|
|
42
|
+
* `accept` rejects (for example, a major version the caller cannot use).
|
|
40
43
|
*/
|
|
41
|
-
export declare function pickEligibleVersion(response: RegistryResponse, graceDays: number, now?: number): VersionPickResult;
|
|
44
|
+
export declare function pickEligibleVersion(response: RegistryResponse, graceDays: number, now?: number, accept?: (version: string) => boolean): VersionPickResult;
|
|
42
45
|
/**
|
|
43
|
-
* Fetch the registry document for `npmPackage` and apply the grace filter
|
|
46
|
+
* Fetch the registry document for `npmPackage` and apply the grace filter
|
|
47
|
+
* plus the optional `accept` version filter.
|
|
44
48
|
*
|
|
45
49
|
* Returns `null` on HTTP/network failure (logs a warning) so callers can
|
|
46
50
|
* fall back to "use whatever's currently installed".
|
|
47
51
|
*/
|
|
48
|
-
export declare function probeRegistry(npmPackage: string, graceDays: number, fetchImpl?: typeof fetch): Promise<VersionPickResult | null>;
|
|
52
|
+
export declare function probeRegistry(npmPackage: string, graceDays: number, fetchImpl?: typeof fetch, accept?: (version: string) => boolean): Promise<VersionPickResult | null>;
|
|
49
53
|
export {};
|
|
50
54
|
//# sourceMappingURL=lsp-registry-probe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-registry-probe.d.ts","sourceRoot":"","sources":["../src/lsp-registry-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,2DAA2D;AAC3D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,UAAU,gBAAgB;IACxB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,8EAA8E;IAC9E,cAAc,EAAE,OAAO,CAAC;IACxB,mFAAmF;IACnF,QAAQ,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE;AAED
|
|
1
|
+
{"version":3,"file":"lsp-registry-probe.d.ts","sourceRoot":"","sources":["../src/lsp-registry-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,2DAA2D;AAC3D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,UAAU,gBAAgB;IACxB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,8EAA8E;IAC9E,cAAc,EAAE,OAAO,CAAC;IACxB,uFAAuF;IACvF,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mFAAmF;IACnF,QAAQ,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAAmB,EACxB,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAoB,GAChD,iBAAiB,CA8BnB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,OAAO,KAAa,EAC/B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACpC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAoBnC"}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { V2PermissionClient } from "./v2.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Why no prompt client could be built, as a stable name next to the sentence.
|
|
4
|
+
*
|
|
5
|
+
* - `server_url_invalid`: the user's `opencode.server_url` setting cannot be
|
|
6
|
+
* used as written (not an http(s) URL, or its password variable is unset).
|
|
7
|
+
* - `server_url_unreachable`: the configured server did not answer, or refused
|
|
8
|
+
* AFT's credentials.
|
|
9
|
+
* - `own_server_unaddressable`: no setting, and AFT could not find and
|
|
10
|
+
* authenticate to the OpenCode server it runs inside.
|
|
11
|
+
*/
|
|
12
|
+
export type V2PromptUnavailableReason = "server_url_invalid" | "server_url_unreachable" | "own_server_unaddressable";
|
|
13
|
+
/**
|
|
14
|
+
* The outcome of looking for the OpenCode server that can show a prompt.
|
|
4
15
|
*
|
|
5
16
|
* The failure branch carries what was actually observed rather than a verdict,
|
|
6
17
|
* because it ends up in the sentence the user reads when a prompt could not be
|
|
7
|
-
* raised.
|
|
18
|
+
* raised, and that sentence has to say how to fix it.
|
|
8
19
|
*/
|
|
9
20
|
export type V2PromptChannelResult = {
|
|
10
21
|
readonly client: V2PermissionClient;
|
|
@@ -12,19 +23,113 @@ export type V2PromptChannelResult = {
|
|
|
12
23
|
} | {
|
|
13
24
|
readonly client?: undefined;
|
|
14
25
|
readonly unavailable: string;
|
|
26
|
+
readonly reason?: V2PromptUnavailableReason;
|
|
15
27
|
};
|
|
16
28
|
export interface V2PromptChannel {
|
|
17
|
-
/** The client for the
|
|
29
|
+
/** The client for the OpenCode server, or why none could be reached. */
|
|
18
30
|
client(): Promise<V2PromptChannelResult>;
|
|
19
31
|
}
|
|
32
|
+
/** The user-tier `opencode` config block (see config.ts). */
|
|
33
|
+
export interface V2PromptServerSettings {
|
|
34
|
+
readonly server_url?: string;
|
|
35
|
+
readonly server_password_env?: string;
|
|
36
|
+
}
|
|
37
|
+
/** One TCP socket a process is listening on, as the operating system reports it. */
|
|
38
|
+
export interface V2ListeningSocket {
|
|
39
|
+
/** Bind address: a concrete IP, or a wildcard such as `0.0.0.0`, `::` or `*`. */
|
|
40
|
+
readonly address: string;
|
|
41
|
+
readonly port: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What discovery reads about the process AFT runs in.
|
|
45
|
+
*
|
|
46
|
+
* OpenCode 2 loads plugins inside its server process, so this process's own
|
|
47
|
+
* pid, command line, environment and listening sockets are the server's.
|
|
48
|
+
* Tests replace it.
|
|
49
|
+
*/
|
|
50
|
+
export interface V2ServerProcess {
|
|
51
|
+
readonly pid: number;
|
|
52
|
+
readonly argv: readonly string[];
|
|
53
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
54
|
+
/** Every OpenCode service registration file on this machine, by path. */
|
|
55
|
+
registrations(): Promise<readonly {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
readonly text: string;
|
|
58
|
+
}[]>;
|
|
59
|
+
/**
|
|
60
|
+
* The TCP ports this process listens on. Rejects when the operating system
|
|
61
|
+
* could not be asked, which is different from an empty answer.
|
|
62
|
+
*/
|
|
63
|
+
listeningSockets(): Promise<readonly V2ListeningSocket[]>;
|
|
64
|
+
fetch(url: string, init: {
|
|
65
|
+
headers: Record<string, string>;
|
|
66
|
+
signal: AbortSignal;
|
|
67
|
+
}): Promise<Response>;
|
|
68
|
+
}
|
|
69
|
+
export interface V2DiscoveryOptions {
|
|
70
|
+
/** Bound on each health call. */
|
|
71
|
+
readonly timeoutMs?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The username OpenCode 2's server checks Basic auth against.
|
|
75
|
+
*
|
|
76
|
+
* It is fixed: the server's auth layer (`server/auth.ts`, `ServerAuth.Config`)
|
|
77
|
+
* always sets `username: "opencode"` and ignores OPENCODE_SERVER_USERNAME,
|
|
78
|
+
* which only OpenCode 1 honored. Sending that variable's value would be refused.
|
|
79
|
+
*/
|
|
80
|
+
export declare const OPENCODE_BASIC_AUTH_USERNAME = "opencode";
|
|
81
|
+
interface ListenAddress {
|
|
82
|
+
readonly hostname: string;
|
|
83
|
+
readonly port?: number;
|
|
84
|
+
readonly stdio: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Where this process's own server listens, read from its command line.
|
|
88
|
+
*
|
|
89
|
+
* `opencode serve` takes `--hostname` (default 127.0.0.1) and `--port`. A
|
|
90
|
+
* wildcard bind is reached on loopback. `--stdio` is how `opencode --standalone`
|
|
91
|
+
* starts its private server: on a random port, with the password removed from
|
|
92
|
+
* the environment, so it is reported rather than probed.
|
|
93
|
+
*/
|
|
94
|
+
export declare function ownListenAddress(argv: readonly string[]): ListenAddress;
|
|
95
|
+
/**
|
|
96
|
+
* Pick the OpenCode server a permission prompt is raised on.
|
|
97
|
+
*
|
|
98
|
+
* The user's `opencode.server_url` wins and skips discovery. Without it, AFT
|
|
99
|
+
* looks for the server it is itself running in: first a service registration
|
|
100
|
+
* whose pid is this process, then the TCP ports this process listens on, with
|
|
101
|
+
* the password it was started with. Every candidate is verified with one
|
|
102
|
+
* authenticated health call whose answer must name this process, so a prompt
|
|
103
|
+
* never goes to some other OpenCode server that happens to be running.
|
|
104
|
+
*/
|
|
105
|
+
export declare function discoverPromptServer(settings: V2PromptServerSettings | undefined, server?: V2ServerProcess, options?: V2DiscoveryOptions): Promise<V2PromptChannelResult>;
|
|
106
|
+
/** This process, as discovery sees it. */
|
|
107
|
+
export declare function currentServerProcess(): V2ServerProcess;
|
|
108
|
+
/** Parse `lsof -F n` output: one `n<address>:<port>` line per socket. */
|
|
109
|
+
export declare function parseLsofListening(output: string): V2ListeningSocket[];
|
|
110
|
+
/**
|
|
111
|
+
* Parse `netstat -ano` output for one pid. A listening row is recognized by
|
|
112
|
+
* its zero foreign port rather than by the state column, which Windows
|
|
113
|
+
* translates on non-English systems.
|
|
114
|
+
*/
|
|
115
|
+
export declare function parseNetstatListening(output: string, pid: number): V2ListeningSocket[];
|
|
116
|
+
/**
|
|
117
|
+
* Parse `/proc/net/tcp` or `/proc/net/tcp6` rows that are listening (state
|
|
118
|
+
* `0A`) on one of the given socket inodes.
|
|
119
|
+
*/
|
|
120
|
+
export declare function parseProcNetListening(table: string, inodes: ReadonlySet<string>): V2ListeningSocket[];
|
|
121
|
+
/** Ask the operating system which TCP ports `pid` listens on. */
|
|
122
|
+
export declare function listeningSocketsOf(pid: number): Promise<V2ListeningSocket[]>;
|
|
20
123
|
/**
|
|
21
124
|
* One prompt channel for one OpenCode Location.
|
|
22
125
|
*
|
|
23
126
|
* The discovered client is kept so a session that answers many prompts pays for
|
|
24
127
|
* discovery once, and it is held in this closure rather than in module state so
|
|
25
128
|
* it is dropped with the Location's consumers when that scope is torn down.
|
|
26
|
-
* Only a successful discovery is remembered: a host whose
|
|
27
|
-
* yet must be able to raise the next prompt.
|
|
129
|
+
* Only a successful discovery is remembered: a host whose server was not up
|
|
130
|
+
* yet must be able to raise the next prompt. The first failure is logged, once,
|
|
131
|
+
* so the plugin log names the reason even when no prompt refusal is read.
|
|
28
132
|
*/
|
|
29
133
|
export declare function createV2PromptChannel(discovery?: () => Promise<V2PromptChannelResult>): V2PromptChannel;
|
|
134
|
+
export {};
|
|
30
135
|
//# sourceMappingURL=v2-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-service.d.ts","sourceRoot":"","sources":["../../src/permissions/v2-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v2-service.d.ts","sourceRoot":"","sources":["../../src/permissions/v2-service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAA2B,MAAM,SAAS,CAAC;AAE3E;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GACjC,oBAAoB,GACpB,wBAAwB,GACxB,0BAA0B,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;CAAE,GACzE;IACE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,yBAAyB,CAAC;CAC7C,CAAC;AAEN,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,MAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC1C;AAED,6DAA6D;AAC7D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAA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,IAAI,eAAe,CAsBtD;AA4BD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAWtF;AAsBD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAC1B,iBAAiB,EAAE,CAUrB;AAmBD,iEAAiE;AACjE,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAelF;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,GAAE,MAAM,OAAO,CAAC,qBAAqB,CAAyC,GACtF,eAAe,CAmBjB"}
|
package/dist/rpc/register.d.ts
CHANGED
|
@@ -16,10 +16,6 @@ export type AftRpcContext = {
|
|
|
16
16
|
};
|
|
17
17
|
export type AftRpcLocation = {
|
|
18
18
|
directory: string;
|
|
19
|
-
project?: {
|
|
20
|
-
directory?: string;
|
|
21
|
-
canonical?: string;
|
|
22
|
-
};
|
|
23
19
|
};
|
|
24
20
|
export type RegisteredAftRpc = {
|
|
25
21
|
emitStatusInvalidated(payload?: AftRpcSession): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/rpc/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQ5C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/E,KAAK,eAAe,GAAG;IACrB,OAAO,EA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,CAAC,KAAK,CAAC,CAwBvD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const VISION_HOST_TIMEOUT_MS = 1500;
|
|
2
|
+
type Model = {
|
|
3
|
+
providerID: string;
|
|
4
|
+
modelID: string;
|
|
5
|
+
};
|
|
6
|
+
/** Host hooks are authoritative; history is only a fallback before the first hook. */
|
|
7
|
+
export declare function rememberReadModel(client: object, sessionID: string, model: Model): void;
|
|
8
|
+
export declare function currentSessionVisionCapability(client: object, sessionID: string | undefined): Promise<boolean | undefined>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=read-vision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-vision.d.ts","sourceRoot":"","sources":["../../src/shared/read-vision.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,KAAK,KAAK,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAgBrD,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAEvF;AAuBD,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAmD9B"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long an OpenCode 2 session lookup may run. The lookup is awaited before
|
|
3
|
+
* the first tool call of a session is routed, so a host that never answers
|
|
4
|
+
* must not hold that call; after this long the call proceeds with the
|
|
5
|
+
* Location's directory instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const V2_SESSION_LOOKUP_TIMEOUT_MS = 3000;
|
|
1
8
|
/**
|
|
2
9
|
* Resolve the project directory the session was created with from the SDK's
|
|
3
10
|
* session object. Returns the SDK-reported directory, or `null` when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-directory.d.ts","sourceRoot":"","sources":["../../src/shared/session-directory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-directory.d.ts","sourceRoot":"","sources":["../../src/shared/session-directory.ts"],"names":[],"mappings":"AAqEA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,OAAQ,CAAC;AAsBlD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgDxB;AAmDD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,IAAI,GAAG,SAAS,CAK3B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,iBAAiB,EAAE,MAAM,GACxB,IAAI,CAIN;AAoBD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgCxB;AAED,qDAAqD;AACrD,wBAAgB,kCAAkC,IAAI,IAAI,CAGzD"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
/** Longest a caller waits for the host's session lookup. */
|
|
2
|
+
export declare const LOOKUP_TIMEOUT_MS = 1000;
|
|
3
|
+
/** How long a failed or timed-out lookup is answered as "primary" before retrying. */
|
|
4
|
+
export declare const FAILED_LOOKUP_RETRY_MS = 30000;
|
|
1
5
|
/**
|
|
2
6
|
* Returns `true` when the given session has a non-empty `parentID`
|
|
3
7
|
* (subagent). Returns `false` for primary sessions, when the SDK is
|
|
4
|
-
* unavailable, or when
|
|
5
|
-
* primary sessions working
|
|
8
|
+
* unavailable, or when the lookup fails or takes longer than
|
|
9
|
+
* LOOKUP_TIMEOUT_MS; the false default keeps primary sessions working
|
|
10
|
+
* exactly as before.
|
|
6
11
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
12
|
+
* A known answer is an O(1) cache hit. Otherwise at most one host lookup
|
|
13
|
+
* per session is in flight, and it is bounded by LOOKUP_TIMEOUT_MS.
|
|
9
14
|
*/
|
|
10
15
|
export declare function resolveIsSubagent(client: unknown, sessionId: string | undefined, _fallbackDirectory?: string): Promise<boolean>;
|
|
11
16
|
/** Test-only cache reset. Not exported from the public surface. */
|
|
12
17
|
export declare function _resetSubagentCacheForTest(): void;
|
|
18
|
+
/** Test-only clock override for the failed-lookup retry window. */
|
|
19
|
+
export declare function _setSubagentClockForTest(clock: () => number): void;
|
|
13
20
|
//# sourceMappingURL=subagent-detect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-detect.d.ts","sourceRoot":"","sources":["../../src/shared/subagent-detect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subagent-detect.d.ts","sourceRoot":"","sources":["../../src/shared/subagent-detect.ts"],"names":[],"mappings":"AA+DA,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AACvC,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAM7C;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAmJD,mEAAmE;AACnE,wBAAgB,0BAA0B,IAAI,IAAI,CAIjD;AAED,mEAAmE;AACnE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,MAAM,GAAG,IAAI,CAElE"}
|
package/dist/tool-perf.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { ToolDefinition } from "@opencode-ai/plugin";
|
|
|
7
7
|
export declare function markBridgeStart(): void;
|
|
8
8
|
/** Mark the instant just after the bridge responds (last response wins). */
|
|
9
9
|
export declare function markBridgeEnd(): void;
|
|
10
|
+
export declare function measurePreStage<T>(stage: "directory" | "permission" | "capability", operation: () => Promise<T>): Promise<T>;
|
|
10
11
|
/**
|
|
11
12
|
* Wrap every tool's execute() so each invocation logs a one-line latency
|
|
12
13
|
* breakdown: total, pre-bridge (arg/permission/session-dir work), bridge
|
package/dist/tool-perf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-perf.d.ts","sourceRoot":"","sources":["../src/tool-perf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-perf.d.ts","sourceRoot":"","sources":["../src/tool-perf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAoB1D;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAKtC;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAsB,eAAe,CAAC,CAAC,EACrC,KAAK,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,EAChD,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC,CAWZ;AAsBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAoBhC"}
|
|
@@ -46,11 +46,14 @@ export declare function openCodeHashlineDowngrade(config: AftConfig, registeredT
|
|
|
46
46
|
/**
|
|
47
47
|
* Build the exact OpenCode registration map without starting a bridge.
|
|
48
48
|
*
|
|
49
|
-
* A tool is registered
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
49
|
+
* A tool is registered when its canonical name is absent from the resolved
|
|
50
|
+
* `disabled_tools`, with one exception: the bash companions (`bash_status`,
|
|
51
|
+
* `bash_watch`, `bash_write`, `bash_kill`) also need `bash.background`, since
|
|
52
|
+
* they only act on background tasks. Index state, backends and the other
|
|
53
|
+
* runtime gates (`bash.enabled`, backup, inspect) never remove a registration;
|
|
54
|
+
* those tools report their runtime state when called. Production calls this
|
|
55
|
+
* after startup has prepared the transport context, and the registration tests
|
|
56
|
+
* call the same function.
|
|
54
57
|
*
|
|
55
58
|
* `onUnknownDisabled` receives, once per call, the sorted distinct disabled
|
|
56
59
|
* names that are not in the canonical tool inventory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-registration.d.ts","sourceRoot":"","sources":["../src/tool-registration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"tool-registration.d.ts","sourceRoot":"","sources":["../src/tool-registration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,KAAK,SAAS,EAA4C,MAAM,aAAa,CAAC;AAKvF,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AASnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAehD,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE;QACJ,SAAS,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,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C,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,EACrD,SAAS,GAAE,eAAoB,GAC9B,OAAO,CAWT"}
|
package/dist/tools/_shared.d.ts
CHANGED
|
@@ -56,6 +56,16 @@ export interface ToolRuntime {
|
|
|
56
56
|
directory: string;
|
|
57
57
|
/** Opaque OpenCode session identifier. Missing in CLI tests / some hosts. */
|
|
58
58
|
sessionID?: string;
|
|
59
|
+
/**
|
|
60
|
+
* True when `directory` is the directory the host placed this session in, so
|
|
61
|
+
* it, not `worktree`, is the root to use while no session directory is
|
|
62
|
+
* cached. OpenCode 2 sets this: its `directory` is the session's Location
|
|
63
|
+
* directory, while its `worktree` is the project's main checkout, which is
|
|
64
|
+
* the wrong root for a session in a linked git worktree (issue #387).
|
|
65
|
+
* OpenCode 1 leaves it unset because its `directory` can be the launch cwd
|
|
66
|
+
* of a resumed session rather than the session's project.
|
|
67
|
+
*/
|
|
68
|
+
directoryIsSessionRoot?: boolean;
|
|
59
69
|
/** Effect-owned cancellation is explicit so V1 ToolContext signals remain unchanged. */
|
|
60
70
|
effectAbort?: AbortSignal;
|
|
61
71
|
}
|
|
@@ -73,6 +83,12 @@ export interface ToolRuntime {
|
|
|
73
83
|
* stored directory wins. This is the workaround for OpenCode's bug where
|
|
74
84
|
* `ctx.directory` is set to `process.cwd()` rather than the resumed
|
|
75
85
|
* session's actual project directory.
|
|
86
|
+
*
|
|
87
|
+
* With no cached directory, an OpenCode 2 runtime (`directoryIsSessionRoot`)
|
|
88
|
+
* resolves to its `directory`, never to `worktree`: there `worktree` is the
|
|
89
|
+
* main checkout, which for a session in a linked git worktree is the one
|
|
90
|
+
* wrong answer (issue #387). `worktree` keeps that meaning for the permission
|
|
91
|
+
* checks that treat the main checkout as part of the project.
|
|
76
92
|
*/
|
|
77
93
|
export declare function projectRootFor(runtime: ToolRuntime): string;
|
|
78
94
|
/**
|
|
@@ -107,21 +123,6 @@ export declare function resolvePathArg(ctx: PluginContext, runtime: ToolRuntime,
|
|
|
107
123
|
* subsequent calls in the same session.
|
|
108
124
|
*/
|
|
109
125
|
export declare function bridgeFor(ctx: PluginContext, runtime: ToolRuntime): AftProjectTransport;
|
|
110
|
-
/**
|
|
111
|
-
* Send a single command to the Rust binary with `session_id` injected.
|
|
112
|
-
*
|
|
113
|
-
* This is the canonical way for a tool handler to call AFT: the helper picks
|
|
114
|
-
* the right bridge (project-keyed), attaches the session namespace from
|
|
115
|
-
* `context.sessionID`, and returns whatever the binary responds.
|
|
116
|
-
*
|
|
117
|
-
* Before routing, it ensures the session-directory cache is warm so the
|
|
118
|
-
* very first tool call on a resumed-from-wrong-cwd session still reaches
|
|
119
|
-
* the correct project bridge. Subsequent calls hit the cache synchronously.
|
|
120
|
-
*
|
|
121
|
-
* The Rust side falls back to a shared default namespace when `session_id`
|
|
122
|
-
* is absent (see `RawRequest::session()`), so hosts that don't expose a
|
|
123
|
-
* session identifier still work — they just share undo/checkpoint state.
|
|
124
|
-
*/
|
|
125
126
|
export declare function callBridge(ctx: PluginContext, runtime: ToolRuntime, command: string, params?: Record<string, unknown>, options?: BridgeRequestOptions): Promise<Record<string, unknown>>;
|
|
126
127
|
/**
|
|
127
128
|
* Dispatch one hoisted agent tool through the server-side `tool_call` command.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAC;AAc/B,OAAO,KAAK,EAAE,aAAa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AG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,mBAAmB,CAYvF;AA2BD,wBAAsB,UAAU,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA0ClC;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CA+BzB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC"}
|
package/dist/tools/bash.d.ts
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import type { ToolDefinition } from "@opencode-ai/plugin";
|
|
2
2
|
import type { PluginContext } from "../types.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Whether a bash companion tool (`bash_status`, `bash_watch`, `bash_write`,
|
|
5
|
+
* `bash_kill`) is registered for this configuration: it needs
|
|
6
|
+
* `bash.background` and must not be in `disabled_tools`. Descriptions use this
|
|
7
|
+
* to name a companion only when the model can call it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function bashCompanionRegistered(config: PluginContext["config"], companion: "bash_status" | "bash_watch" | "bash_write" | "bash_kill"): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Which neighbouring tools the bash description may name. Each defaults to
|
|
12
|
+
* registered; `watchToolRegistered`, `aftSearchRegistered` and `zoomEnabled`
|
|
13
|
+
* are separate positional arguments for historical reasons.
|
|
14
|
+
*/
|
|
15
|
+
export interface BashDescriptionSurface {
|
|
16
|
+
outline?: boolean;
|
|
17
|
+
status?: boolean;
|
|
18
|
+
write?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function bashToolDescription(aftSearchRegistered: boolean, compressionOn: boolean, backgroundOn: boolean, detachOnUserMessage?: boolean, zoomEnabled?: boolean, watchToolRegistered?: boolean, surface?: BashDescriptionSurface): string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the native bash sandbox is on for this configuration. The `sandbox`
|
|
23
|
+
* argument only asks to leave that sandbox for one command, so it is offered
|
|
24
|
+
* only when there is a sandbox to leave.
|
|
25
|
+
*/
|
|
26
|
+
export declare function nativeSandboxEnabled(config: PluginContext["config"]): boolean;
|
|
4
27
|
export declare function createBashTool(ctx: PluginContext, aftSearchRegisteredOverride?: boolean): ToolDefinition;
|
|
5
28
|
export declare function createBashStatusTool(ctx: PluginContext): ToolDefinition;
|
|
6
29
|
export declare function createBashKillTool(ctx: PluginContext): ToolDefinition;
|
package/dist/tools/bash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAgKjD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAC/B,SAAS,EAAE,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,GACnE,OAAO,CAET;AAgCD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,OAAO,EAC5B,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,mBAAmB,UAAO,EAC1B,WAAW,UAAO,EAClB,mBAAmB,UAAO,EAC1B,OAAO,GAAE,sBAA2B,GACnC,MAAM,CAmBR;AAoHD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,OAAO,CAE7E;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,aAAa,EAClB,2BAA2B,CAAC,EAAE,OAAO,GACpC,cAAc,CA+ThB;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAqCvE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAwBrE"}
|
|
@@ -8,8 +8,11 @@ export type BashWaitPattern = {
|
|
|
8
8
|
source: string;
|
|
9
9
|
};
|
|
10
10
|
export type BashStatusWaited = {
|
|
11
|
-
reason: "matched" | "exited" | "timeout" | "user_message" | "unavailable";
|
|
11
|
+
reason: "matched" | "exited" | "timeout" | "user_message" | "unavailable" | "aborted";
|
|
12
|
+
/** Real time the watch held the call, measured on a monotonic clock. */
|
|
12
13
|
elapsed_ms: number;
|
|
14
|
+
/** Longest time this watch was allowed to hold the call; absent when it had no deadline. */
|
|
15
|
+
limit_ms?: number;
|
|
13
16
|
match?: string;
|
|
14
17
|
match_offset?: number;
|
|
15
18
|
match_stream?: "stdout" | "stderr";
|
|
@@ -18,7 +21,7 @@ type BashStatusWithWait = Record<string, unknown> & {
|
|
|
18
21
|
waited?: BashStatusWaited;
|
|
19
22
|
};
|
|
20
23
|
export declare function createBashWatchTool(ctx: PluginContext): ToolDefinition;
|
|
21
|
-
export declare function waitForBashStatus(ctx: PluginContext, runtime: ToolContext, taskId: string, outputMode: string | undefined, waitFor: BashWaitPattern | undefined, effectiveWaitMs: number): Promise<BashStatusWithWait>;
|
|
24
|
+
export declare function waitForBashStatus(ctx: PluginContext, runtime: ToolContext, taskId: string, outputMode: string | undefined, waitFor: BashWaitPattern | undefined, effectiveWaitMs: number | undefined): Promise<BashStatusWithWait>;
|
|
22
25
|
export declare function parseWaitPattern(value: unknown): BashWaitPattern | undefined;
|
|
23
26
|
export declare function __trimWaitScanBufferForTests(text: string, baseOffset: number, pattern: BashWaitPattern): {
|
|
24
27
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash_watch.d.ts","sourceRoot":"","sources":["../../src/tools/bash_watch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bash_watch.d.ts","sourceRoot":"","sources":["../../src/tools/bash_watch.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAavE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,aAAa,GAAG,SAAS,CAAC;IACtF,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACpC,CAAC;AAUF,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAqBlF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAkHtE;AAgJD,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,eAAe,GAAG,SAAS,EACpC,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAyJ7B;AA6CD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAI5E;AAkGD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,eAAe,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAEtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash_write.d.ts","sourceRoot":"","sources":["../../src/tools/bash_write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"bash_write.d.ts","sourceRoot":"","sources":["../../src/tools/bash_write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAiDtE"}
|
|
@@ -28,6 +28,8 @@ export interface V2PermissionRequest {
|
|
|
28
28
|
}
|
|
29
29
|
export interface V2DefinitionRuntime extends V2ExecutionContext {
|
|
30
30
|
directory: string;
|
|
31
|
+
/** Always true here; see `ToolRuntime.directoryIsSessionRoot` in `tools/_shared.ts`. */
|
|
32
|
+
directoryIsSessionRoot: true;
|
|
31
33
|
effectAbort: AbortSignal;
|
|
32
34
|
worktree: string;
|
|
33
35
|
abort: AbortSignal;
|