@cortexkit/aft-opencode 0.60.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/bridge-bootstrap.d.ts +4 -2
- 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 -15
- package/dist/config.d.ts.map +1 -1
- package/dist/entry/server.js +17364 -18912
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19829 -18876
- package/dist/lsp-auto-install.d.ts.map +1 -1
- package/dist/lsp-github-install.d.ts +5 -123
- 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/subc-tool-schemas.d.ts +1 -1
- package/dist/tools/_shared.d.ts +2 -0
- 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/definitions/v2.d.ts +4 -2
- 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/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/v2-prompt-detach.d.ts +6 -1
- package/dist/v2-prompt-detach.d.ts.map +1 -1
- package/dist/wakes/runtime-consumer.d.ts.map +1 -1
- package/package.json +20 -12
- package/src/entry/server-runtime.mjs +6 -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/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,7 +17,7 @@ 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
|
|
20
|
+
import { hoistedV2ToolConsumers } from "../tools/hoisted/v2.js";
|
|
21
21
|
import {
|
|
22
22
|
renameV2ToolReferences,
|
|
23
23
|
V2_HOST_TOOL_NAMES,
|
|
@@ -46,12 +46,10 @@ const defaults = {
|
|
|
46
46
|
registerPromptHook: registerV2PromptDetachHook,
|
|
47
47
|
registerToolHooks: registerV2ToolHooks,
|
|
48
48
|
registerWorkflowHints: registerV2WorkflowHints,
|
|
49
|
-
// The prompt server comes from the user-only `opencode` block of the
|
|
50
|
-
// Location's config; without it AFT finds the server it runs inside.
|
|
51
49
|
// `getConfig` returns the Location's current config, which a live reload
|
|
52
50
|
// replaces; the wake consumer reads it when a completion arrives.
|
|
53
51
|
toolConsumers: (context, config, getConfig = () => config) => ({
|
|
54
|
-
...hoistedV2ToolConsumers(context
|
|
52
|
+
...hoistedV2ToolConsumers(context),
|
|
55
53
|
...createV2RuntimeConsumer(context, getConfig),
|
|
56
54
|
}),
|
|
57
55
|
acquireBridge,
|
|
@@ -209,6 +207,10 @@ export function makeServerEffect(overrides = {}) {
|
|
|
209
207
|
return Effect.void;
|
|
210
208
|
}
|
|
211
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
|
+
|
|
212
214
|
return Effect.gen(function* () {
|
|
213
215
|
// Logged when the program runs, so every start pairs with the stop its
|
|
214
216
|
// finalizer logs when the host disposes the Location.
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Probes the GitHub releases API for a project's tagged releases and
|
|
3
|
-
* selects the newest tag whose asset publication satisfies AFT's
|
|
4
|
-
* supply-chain grace window.
|
|
5
|
-
*
|
|
6
|
-
* Same threat model as the npm registry probe — we want releases that
|
|
7
|
-
* have been observable for at least `graceDays` so the community has
|
|
8
|
-
* time to detect compromised tarballs and yank them.
|
|
9
|
-
*
|
|
10
|
-
* For repos that put release tags on a `published_at` field (almost
|
|
11
|
-
* all of them), we filter on that. Pre-releases are skipped by default.
|
|
12
|
-
*/
|
|
13
|
-
interface GithubRelease {
|
|
14
|
-
tag_name: string;
|
|
15
|
-
name?: string;
|
|
16
|
-
published_at?: string;
|
|
17
|
-
draft?: boolean;
|
|
18
|
-
prerelease?: boolean;
|
|
19
|
-
assets?: Array<{
|
|
20
|
-
name: string;
|
|
21
|
-
browser_download_url: string;
|
|
22
|
-
size?: number;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
export interface GithubVersionPickResult {
|
|
26
|
-
/** Chosen release tag (e.g. "v21.1.0" or "21.1.0"), or null if none qualifies. */
|
|
27
|
-
tag: string | null;
|
|
28
|
-
/** Asset list of the chosen release — used to find the right archive. */
|
|
29
|
-
assets: Array<{
|
|
30
|
-
name: string;
|
|
31
|
-
url: string;
|
|
32
|
-
size?: number;
|
|
33
|
-
}>;
|
|
34
|
-
/** True when releases exist but none is older than `graceDays`. */
|
|
35
|
-
blockedByGrace: boolean;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Pick the newest non-draft non-prerelease release whose `published_at`
|
|
39
|
-
* is at least `graceDays` ago.
|
|
40
|
-
*
|
|
41
|
-
* The GitHub `/releases` endpoint returns up to 30 releases sorted newest
|
|
42
|
-
* first by default — pagination ignored because servers we care about
|
|
43
|
-
* cycle stable releases on the order of weeks/months.
|
|
44
|
-
*/
|
|
45
|
-
export declare function pickEligibleRelease(releases: readonly GithubRelease[], graceDays: number, now?: number): GithubVersionPickResult;
|
|
46
|
-
/**
|
|
47
|
-
* Fetch the GitHub releases list for `owner/repo` and apply the grace filter.
|
|
48
|
-
*
|
|
49
|
-
* Returns `null` on HTTP/network failure — caller should keep using whatever's
|
|
50
|
-
* already cached.
|
|
51
|
-
*/
|
|
52
|
-
export declare function probeGithubReleases(githubRepo: string, graceDays: number, fetchImpl?: typeof fetch): Promise<GithubVersionPickResult | null>;
|
|
53
|
-
/**
|
|
54
|
-
* Throw if `version` contains anything outside the safe allowlist.
|
|
55
|
-
*
|
|
56
|
-
* Call this at every boundary where a version string is about to be
|
|
57
|
-
* concatenated into a path, command, or URL — defense-in-depth even
|
|
58
|
-
* when the surrounding code uses execFile (no shell).
|
|
59
|
-
*/
|
|
60
|
-
export declare function assertSafeVersion(version: string): void;
|
|
61
|
-
/**
|
|
62
|
-
* Non-throwing version of {@link assertSafeVersion}. Returns true when
|
|
63
|
-
* `version` is a non-null, non-empty string that matches the allowlist.
|
|
64
|
-
*
|
|
65
|
-
* Callers that read version strings from disk caches
|
|
66
|
-
* (where corruption is possible but not necessarily an attack) prefer
|
|
67
|
-
* this over throwing — they degrade to "treat as cache miss" instead of
|
|
68
|
-
* crashing the plugin.
|
|
69
|
-
*/
|
|
70
|
-
export declare function isSafeVersion(version: string | null | undefined): version is string;
|
|
71
|
-
/**
|
|
72
|
-
* Strip a leading `v` from a release tag to get a clean version for asset
|
|
73
|
-
* templates that don't include the `v` prefix.
|
|
74
|
-
*
|
|
75
|
-
* The returned value is asserted safe via {@link assertSafeVersion} so
|
|
76
|
-
* callers can pass it into paths and command arguments without
|
|
77
|
-
* additional validation.
|
|
78
|
-
*/
|
|
79
|
-
export declare function stripTagV(tag: string): string;
|
|
80
|
-
export {};
|
|
81
|
-
//# sourceMappingURL=lsp-github-probe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lsp-github-probe.d.ts","sourceRoot":"","sources":["../src/lsp-github-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,oBAAoB,EAAE,MAAM,CAAC;QAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,uBAAuB;IACtC,kFAAkF;IAClF,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,yEAAyE;IACzE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,mEAAmE;IACnE,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAAmB,GACvB,uBAAuB,CA4BzB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAyBzC;AAiBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,IAAI,MAAM,CAEnF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-server GitHub-release configuration for LSP servers AFT can
|
|
3
|
-
* auto-download.
|
|
4
|
-
*
|
|
5
|
-
* Each entry is a templated asset-name pattern keyed by `(platform, arch)`.
|
|
6
|
-
* The installer resolves the latest eligible release tag (with 7-day grace),
|
|
7
|
-
* matches the asset against `assetTemplate(platform, arch, version)`,
|
|
8
|
-
* downloads it, extracts to the cache, and exposes the binary.
|
|
9
|
-
*
|
|
10
|
-
* NOTE: terraform-ls uses HashiCorp's release API, not GitHub. It's a
|
|
11
|
-
* separate code path; not included in this table.
|
|
12
|
-
*
|
|
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.
|
|
17
|
-
*
|
|
18
|
-
* NOTE: kotlin-language-server is hosted on JetBrains CDN, not GitHub.
|
|
19
|
-
* Skipped from auto-download for v0.17.0 — users install via Homebrew /
|
|
20
|
-
* scoop / Snap / coursier.
|
|
21
|
-
*/
|
|
22
|
-
export type Platform = "darwin" | "linux" | "win32";
|
|
23
|
-
export type Arch = "x64" | "arm64";
|
|
24
|
-
export type ArchiveType = "tar.gz" | "tar.xz" | "zip";
|
|
25
|
-
export interface GithubServerSpec {
|
|
26
|
-
/** AFT server-kind id (matches `crates/aft/src/lsp/registry.rs::ServerKind::id_str`). */
|
|
27
|
-
readonly id: string;
|
|
28
|
-
/** GitHub `owner/repo`. */
|
|
29
|
-
readonly githubRepo: string;
|
|
30
|
-
/** Binary name placed under the cache `bin/` dir after extraction. */
|
|
31
|
-
readonly binary: string;
|
|
32
|
-
/** Returns the asset filename and archive type for the given platform/arch + version. */
|
|
33
|
-
readonly resolveAsset: (platform: Platform, arch: Arch, version: string) => {
|
|
34
|
-
name: string;
|
|
35
|
-
archive: ArchiveType;
|
|
36
|
-
} | null;
|
|
37
|
-
/**
|
|
38
|
-
* Path inside the extracted archive where the binary lives, relative to the
|
|
39
|
-
* extraction root. May contain `${version}` placeholder. The installer
|
|
40
|
-
* looks up this path and copies/symlinks it to `bin/<binary>`.
|
|
41
|
-
*/
|
|
42
|
-
readonly binaryPathInArchive: (platform: Platform, arch: Arch, version: string) => string;
|
|
43
|
-
}
|
|
44
|
-
export declare const GITHUB_LSP_TABLE: readonly GithubServerSpec[];
|
|
45
|
-
/** Find an entry by AFT server id. */
|
|
46
|
-
export declare function findGithubServerById(id: string): GithubServerSpec | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Map Node's `process.platform` and `process.arch` to our (Platform, Arch)
|
|
49
|
-
* pair, or null when the host isn't supported.
|
|
50
|
-
*/
|
|
51
|
-
export declare function detectHostPlatform(): {
|
|
52
|
-
platform: Platform;
|
|
53
|
-
arch: Arch;
|
|
54
|
-
} | null;
|
|
55
|
-
//# sourceMappingURL=lsp-github-table.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import type { V2PermissionClient } from "./v2.js";
|
|
2
|
-
/**
|
|
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.
|
|
15
|
-
*
|
|
16
|
-
* The failure branch carries what was actually observed rather than a verdict,
|
|
17
|
-
* because it ends up in the sentence the user reads when a prompt could not be
|
|
18
|
-
* raised, and that sentence has to say how to fix it.
|
|
19
|
-
*/
|
|
20
|
-
export type V2PromptChannelResult = {
|
|
21
|
-
readonly client: V2PermissionClient;
|
|
22
|
-
readonly unavailable?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
readonly client?: undefined;
|
|
25
|
-
readonly unavailable: string;
|
|
26
|
-
readonly reason?: V2PromptUnavailableReason;
|
|
27
|
-
};
|
|
28
|
-
export interface V2PromptChannel {
|
|
29
|
-
/** The client for the OpenCode server, or why none could be reached. */
|
|
30
|
-
client(): Promise<V2PromptChannelResult>;
|
|
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[]>;
|
|
123
|
-
/**
|
|
124
|
-
* One prompt channel for one OpenCode Location.
|
|
125
|
-
*
|
|
126
|
-
* The discovered client is kept so a session that answers many prompts pays for
|
|
127
|
-
* discovery once, and it is held in this closure rather than in module state so
|
|
128
|
-
* it is dropped with the Location's consumers when that scope is torn down.
|
|
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.
|
|
132
|
-
*/
|
|
133
|
-
export declare function createV2PromptChannel(discovery?: () => Promise<V2PromptChannelResult>): V2PromptChannel;
|
|
134
|
-
export {};
|
|
135
|
-
//# sourceMappingURL=v2-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CA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