@cortexkit/aft-opencode 0.59.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/bash-wait-detach.d.ts +17 -5
  2. package/dist/bash-wait-detach.d.ts.map +1 -1
  3. package/dist/bg-notifications.d.ts +5 -0
  4. package/dist/bg-notifications.d.ts.map +1 -1
  5. package/dist/bridge-bootstrap.d.ts +7 -5
  6. package/dist/bridge-bootstrap.d.ts.map +1 -1
  7. package/dist/config-live-reload.d.ts +8 -10
  8. package/dist/config-live-reload.d.ts.map +1 -1
  9. package/dist/config.d.ts +24 -19
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/entry/server.js +25133 -25815
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +24767 -22902
  14. package/dist/lsp-auto-install.d.ts.map +1 -1
  15. package/dist/lsp-github-install.d.ts +5 -117
  16. package/dist/lsp-github-install.d.ts.map +1 -1
  17. package/dist/permissions/v2.d.ts +9 -158
  18. package/dist/permissions/v2.d.ts.map +1 -1
  19. package/dist/shared/status.d.ts +9 -4
  20. package/dist/shared/status.d.ts.map +1 -1
  21. package/dist/subc-tool-schemas.d.ts +1 -1
  22. package/dist/tool-registration.d.ts +3 -0
  23. package/dist/tool-registration.d.ts.map +1 -1
  24. package/dist/tools/_shared.d.ts +4 -5
  25. package/dist/tools/_shared.d.ts.map +1 -1
  26. package/dist/tools/ast.d.ts.map +1 -1
  27. package/dist/tools/bash.d.ts.map +1 -1
  28. package/dist/tools/bash_watch.d.ts.map +1 -1
  29. package/dist/tools/definitions/v2.d.ts +13 -3
  30. package/dist/tools/definitions/v2.d.ts.map +1 -1
  31. package/dist/tools/hoisted/v2.d.ts +3 -17
  32. package/dist/tools/hoisted/v2.d.ts.map +1 -1
  33. package/dist/tools/hoisted.d.ts.map +1 -1
  34. package/dist/tools/inspect.d.ts.map +1 -1
  35. package/dist/tools/navigation.d.ts.map +1 -1
  36. package/dist/tools/permissions.d.ts +2 -0
  37. package/dist/tools/permissions.d.ts.map +1 -1
  38. package/dist/tools/reading.d.ts.map +1 -1
  39. package/dist/tools/safety.d.ts.map +1 -1
  40. package/dist/tools/search.d.ts.map +1 -1
  41. package/dist/tui/v2-status.d.ts.map +1 -1
  42. package/dist/types.d.ts +7 -1
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/v2-host-tool-names.d.ts +43 -0
  45. package/dist/v2-host-tool-names.d.ts.map +1 -0
  46. package/dist/v2-prompt-detach.d.ts +6 -1
  47. package/dist/v2-prompt-detach.d.ts.map +1 -1
  48. package/dist/v2-session-lifecycle.d.ts +22 -0
  49. package/dist/v2-session-lifecycle.d.ts.map +1 -0
  50. package/dist/v2-tool-hooks.d.ts +14 -2
  51. package/dist/v2-tool-hooks.d.ts.map +1 -1
  52. package/dist/wakes/runtime-consumer.d.ts +6 -1
  53. package/dist/wakes/runtime-consumer.d.ts.map +1 -1
  54. package/dist/wakes/session-delivery.d.ts +12 -7
  55. package/dist/wakes/session-delivery.d.ts.map +1 -1
  56. package/package.json +20 -12
  57. package/src/entry/server-runtime.mjs +32 -18
  58. package/src/shared/status.ts +25 -4
  59. package/src/tui/v2-status.ts +1 -0
  60. package/src/tui/v2.tsx +7 -4
  61. package/src/tui-compiled/v2-status.ts +1 -0
  62. package/src/tui-compiled/v2.tsx +7 -4
  63. package/dist/lsp-github-probe.d.ts +0 -81
  64. package/dist/lsp-github-probe.d.ts.map +0 -1
  65. package/dist/lsp-github-table.d.ts +0 -55
  66. package/dist/lsp-github-table.d.ts.map +0 -1
  67. package/dist/permissions/v2-service.d.ts +0 -135
  68. package/dist/permissions/v2-service.d.ts.map +0 -1
  69. package/dist/v2-host-tool-overlap.d.ts +0 -66
  70. package/dist/v2-host-tool-overlap.d.ts.map +0 -1
@@ -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,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,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EA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AgB,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"}
@@ -1,66 +0,0 @@
1
- /**
2
- * On OpenCode 2, AFT's `apply_patch` and `bash` sit beside the host's own
3
- * `patch` and `shell` tools unless the user's opencode config turns the host
4
- * plugins off (`-opencode.tool.patch` / `-opencode.tool.shell` under
5
- * `plugins`, which `aft setup` and `aft doctor --fix` write). Someone who
6
- * installed AFT without setup, or turned the host tools back on, gets two
7
- * editing tools and two shells with nothing saying why. This module tells the
8
- * user once per host process and points at `doctor --fix`.
9
- *
10
- * What counts is what the host actually registered: `context.tool.list()`
11
- * returns the host's tools after every plugin's transform, keyed by the name
12
- * the model sees. The check waits for the first user prompt rather than
13
- * running at plugin start, because at start other plugins (the host's own
14
- * patch and shell plugins included) may not have registered yet, and because
15
- * the notice is an RPC event the host does not replay: a TUI that has not
16
- * subscribed yet would miss it, while a prompt typed into the TUI proves its
17
- * subscription is live. A host without `tool.list()`
18
- * (OpenCode 2.0.3 has none) or a list call that fails gets no notice: the
19
- * reason is logged once at debug level and nothing is guessed.
20
- *
21
- * The notice must reach the user and never the model. Nothing is written into
22
- * the session: OpenCode 2 sends a synthetic session record to the model as a
23
- * user message on every later turn, where a notice would read as an
24
- * instruction. A server plugin has no toast or dialog of its own, so the
25
- * notice goes out as an AFT RPC event and AFT's OpenCode 2 TUI plugin shows
26
- * it as a toast. The desktop and web apps run no TUI plugin and show nothing;
27
- * `aft doctor` reports the same problem there.
28
- */
29
- import { Effect } from "effect";
30
- /** An AFT tool and the OpenCode 2 built-in that does the same job. */
31
- export interface HostToolOverlap {
32
- readonly aft: "apply_patch" | "bash";
33
- readonly host: "patch" | "shell";
34
- }
35
- /**
36
- * The pairs where AFT registered its tool (it is not in `disabled_tools`) and
37
- * the host also has its built-in, in a fixed order. `hostToolNames` is the
38
- * host's whole registry after every transform, AFT's own tools included, so a
39
- * name AFT registered itself is never taken for the host's built-in.
40
- */
41
- export declare function findHostToolOverlaps(hostToolNames: ReadonlySet<string>, registeredAftTools: ReadonlySet<string>): HostToolOverlap[];
42
- /** One notice for every overlapping pair, or null when there is none. */
43
- export declare function hostToolOverlapNotice(overlaps: readonly HostToolOverlap[]): string | null;
44
- /** Reset the once-per-process state. Tests only. */
45
- export declare function __resetHostToolOverlapNoticeForTests(): void;
46
- interface PromptEvent {
47
- readonly sessionID: string;
48
- readonly metadata?: Record<string, unknown>;
49
- }
50
- /** Hands the notice text to the user-only channel (the TUI toast event). */
51
- export type HostToolOverlapDelivery = (message: string) => Promise<void>;
52
- /**
53
- * The session `prompt` hook for one Location. It never fails and never waits:
54
- * the host holds the prompt until the hook returns, so the check runs in the
55
- * background after it.
56
- */
57
- export declare function createHostToolOverlapPromptHook(context: unknown, registeredAftTools: ReadonlySet<string>, deliver: HostToolOverlapDelivery, onChecked?: (done: Promise<void>) => void): (event: PromptEvent) => Effect.Effect<void>;
58
- /**
59
- * Register the overlap check on an OpenCode 2 host's session `prompt` hook.
60
- * `registeredAftTools` is AFT's final tool surface, so a tool listed in
61
- * `disabled_tools` never counts as an overlap. `deliver` must reach the user
62
- * only, never the session.
63
- */
64
- export declare function registerV2HostToolOverlapNotice(context: unknown, registeredAftTools: ReadonlySet<string>, deliver: HostToolOverlapDelivery, onChecked?: (done: Promise<void>) => void): Effect.Effect<boolean, never, unknown>;
65
- export {};
66
- //# sourceMappingURL=v2-host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