@cortexkit/aft-opencode 0.27.1 → 0.28.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAwBH,+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;CACjC;AAkDD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAqXD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAwEnB"}
1
+ {"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA4BH,+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;CACjC;AA8DD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAqXD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAwEnB"}
@@ -22,6 +22,20 @@ export interface NpmServerSpec {
22
22
  readonly extensions: readonly string[];
23
23
  /** Project-root marker files (presence triggers install). Optional. */
24
24
  readonly rootMarkers?: readonly string[];
25
+ /**
26
+ * Package names whose presence in `<projectRoot>/package.json` `dependencies`,
27
+ * `devDependencies`, or `peerDependencies` triggers auto-install. Useful for
28
+ * frameworks where the config file alone (`vite.config.ts`, etc.) doesn't
29
+ * reveal which language server is needed — e.g. a Vite project is only a
30
+ * Vue project if `vue` is in package.json. Optional.
31
+ *
32
+ * GitHub issue #48: Vue, Astro, and Svelte projects can have their .vue
33
+ * /.astro/.svelte files deep enough in a monorepo (or behind skipped
34
+ * directories like `apps/`) that the bounded extension walk misses them.
35
+ * Without rootMarkers OR this hint, auto-install never triggers and the
36
+ * user sees a recurring `lsp_binary_missing` warning.
37
+ */
38
+ readonly packageJsonDeps?: readonly string[];
25
39
  }
26
40
  export declare const NPM_LSP_TABLE: readonly NpmServerSpec[];
27
41
  /** Find an entry by AFT server id. */
@@ -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,yFAAyF;IACzF,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;CAC1C;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAoEjD,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"}
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,yFAAyF;IACzF,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;CAC9C;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAoFjD,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"}
@@ -1,4 +1,17 @@
1
1
  export declare function hasRootMarker(projectRoot: string, rootMarkers?: readonly string[]): boolean;
2
+ /**
3
+ * True when `<projectRoot>/package.json` lists any name from `depNames`
4
+ * in its `dependencies`, `devDependencies`, or `peerDependencies` maps.
5
+ *
6
+ * GitHub issue #48: Vue/Astro/Svelte projects fail the bounded extension
7
+ * walk for monorepo layouts. Detecting them by package.json dep name
8
+ * catches Vite-based setups and other frameworks where no framework-
9
+ * specific config file exists at the project root.
10
+ *
11
+ * Reads package.json once per call. Failures (missing file, invalid JSON,
12
+ * I/O error) return false — this signal is additive, never blocking.
13
+ */
14
+ export declare function hasPackageJsonDep(projectRoot: string, depNames?: readonly string[]): boolean;
2
15
  /**
3
16
  * Bounded extension scan for project relevance decisions.
4
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-project-relevance.d.ts","sourceRoot":"","sources":["../src/lsp-project-relevance.ts"],"names":[],"mappings":"AAiBA,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAM3F;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,GACvD,GAAG,CAAC,MAAM,CAAC,CAmCb"}
1
+ {"version":3,"file":"lsp-project-relevance.d.ts","sourceRoot":"","sources":["../src/lsp-project-relevance.ts"],"names":[],"mappings":"AAiBA,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAM3F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAe5F;AAmBD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,GACvD,GAAG,CAAC,MAAM,CAAC,CAmCb"}
@@ -74,7 +74,7 @@ export declare function sendStatus(opts: NotificationOptions, message: string):
74
74
  * Desktop: ignored message in the active session.
75
75
  * TUI: toast with info variant.
76
76
  */
77
- export declare function sendFeatureAnnouncement(opts: NotificationOptions, version: string, features: string[], storageDir?: string): Promise<void>;
77
+ export declare function sendFeatureAnnouncement(opts: NotificationOptions, version: string, features: string[], footer: string, storageDir?: string): Promise<void>;
78
78
  export declare function deliverConfigureWarnings(opts: ConfigureWarningOptions, warnings: ConfigureWarning[]): Promise<void>;
79
79
  /**
80
80
  * Clean up stale AFT warning messages from previous runs.
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA;;;;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,CAC5C,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C9E"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Workaround helper for the OpenCode plugin promptAsync runner-split bug
3
+ * (https://github.com/anomalyco/opencode/issues/28202).
4
+ *
5
+ * OpenCode's plugin-provided `input.client` is constructed with
6
+ * `fetch: async (...args) => Server.Default().app.fetch(...args)`, which
7
+ * routes requests through `HttpApiApp.webHandler()` and a SEPARATE Effect
8
+ * `memoMap` from the one used by the live HTTP listener. Since
9
+ * `SessionRunState` is a per-memo-map in-memory layer, plugin-origin
10
+ * `promptAsync` calls observe an "idle" runner while the live UI turn is
11
+ * still running. The result is that `ensureRunning` fails to coalesce and
12
+ * OpenCode persists multiple assistant children under a single synthetic
13
+ * user parent — what users see as duplicate "stop" messages after every
14
+ * background-bash completion reminder.
15
+ *
16
+ * The workaround is to bypass `input.client` for the wake path and build
17
+ * a separate `createOpencodeClient` configured to hit `input.serverUrl`
18
+ * via `globalThis.fetch`. That client enters the same live listener the
19
+ * UI uses, so the active session's `SessionRunState` is the one that
20
+ * resolves `ensureRunning` and overlapping turns coalesce correctly.
21
+ *
22
+ * Tracked upstream as anomalyco/opencode#28202. When OpenCode fixes the
23
+ * runtime split, this helper and its single consumer in `bg-notifications.ts`
24
+ * can be deleted and the wake path can go back to `input.client`.
25
+ */
26
+ import { createOpencodeClient } from "@opencode-ai/sdk";
27
+ export type LiveServerClient = ReturnType<typeof createOpencodeClient>;
28
+ /**
29
+ * Return a cached `createOpencodeClient` pointed at the live HTTP listener
30
+ * for the given `(serverUrl, directory)` pair. One client object is reused
31
+ * across many wakes for a given session.
32
+ *
33
+ * The `fetch` is bound to `globalThis.fetch` explicitly. Without this, the
34
+ * SDK would fall back to `globalThis.fetch` anyway in normal Node runtimes,
35
+ * but we set it on purpose so anyone reading this code (or grepping for the
36
+ * bug fix) can see that we intentionally chose the live HTTP transport.
37
+ */
38
+ export declare function getLiveServerClient(serverUrl: string, directory: string): LiveServerClient;
39
+ /** Test helper — drop the cache between cases so each test starts clean. */
40
+ export declare function __resetLiveServerClientCacheForTests(): void;
41
+ /**
42
+ * True when the current runtime is Bun. OpenCode's TUI ships with Bun;
43
+ * the Electron Desktop app ships with Node. We use this to gate the
44
+ * `--port 0` nudge: Desktop is unaffected by anomalyco/opencode#28202
45
+ * because Node's webidl polyfill is complete, so undici v8 (and the live
46
+ * HTTP server) work without additional flags.
47
+ */
48
+ export declare function isBunRuntime(): boolean;
49
+ /**
50
+ * Probe whether `serverUrl` accepts a connection within `timeoutMs`.
51
+ * Returns `true` for any HTTP response (including 4xx / 5xx) since the
52
+ * goal is to confirm the listener exists. Returns `false` on connection
53
+ * refused, DNS failure, timeout, or undefined URL.
54
+ *
55
+ * Used at plugin init under Bun to detect TUI sessions started without
56
+ * `opencode --port 0` — those bind an internal-only listener that 404s
57
+ * for `/session/...` endpoints and breaks AFT's wake path.
58
+ */
59
+ export declare function probeServerReachable(serverUrl: string | undefined, timeoutMs?: number): Promise<boolean>;
60
+ //# sourceMappingURL=live-server-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-server-client.d.ts","sourceRoot":"","sources":["../../src/shared/live-server-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AA6BvE;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAY1F;AAED,4EAA4E;AAC5E,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,SAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAqBlB"}
@@ -1,18 +1,28 @@
1
1
  export declare class AftRpcClient {
2
2
  private port;
3
3
  private token;
4
- private portFilePath;
5
- private healthChecked;
4
+ private portsDir;
5
+ private legacyPortFile;
6
6
  constructor(storageDir: string, directory: string);
7
7
  /** Call an RPC method. Retries port resolution if the server isn't ready yet. */
8
8
  call<T = Record<string, unknown>>(method: string, params?: Record<string, unknown>): Promise<T>;
9
- private callResolved;
10
- private retryAfterReset;
11
- /** Check if the RPC server is reachable. */
9
+ private callOne;
10
+ /**
11
+ * Heuristic for "this response is the lazy-spawn placeholder, not the real
12
+ * data." We treat any `not_initialized` status as a placeholder so the
13
+ * client knows to try the next port (the warm one).
14
+ */
15
+ private looksLikePlaceholder;
16
+ /** Check if any RPC server is reachable. */
12
17
  isAvailable(): Promise<boolean>;
13
- private resolvePort;
14
- private resolvePortInfo;
15
- private readPortFile;
18
+ /**
19
+ * Discover all live RPC port files for this project. Tries the per-instance
20
+ * directory first (v0.28.2+), then falls back to the single legacy `port`
21
+ * file (older plugin versions in mixed deployments).
22
+ */
23
+ private resolvePortInfos;
24
+ private readAllPortFiles;
25
+ private parsePortFile;
16
26
  private healthCheck;
17
27
  private fetchWithTimeout;
18
28
  reset(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAQA,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAIjD,iFAAiF;IAC3E,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,OAAO,CAAC,CAAC,CAAC;YASC,YAAY;YA6BZ,eAAe;IAe7B,4CAA4C;IACtC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YASvB,WAAW;YAIX,eAAe;IAoC7B,OAAO,CAAC,YAAY;YAuBN,WAAW;YAWX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAKd"}
1
+ {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAWA,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,cAAc,CAAS;gBAEnB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,iFAAiF;IAC3E,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,OAAO,CAAC,CAAC,CAAC;YAoCC,OAAO;IAiBrB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAM5B,4CAA4C;IACtC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IASrC;;;;OAIG;YACW,gBAAgB;IAmB9B,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,aAAa;YAuBP,WAAW;YAWX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAId"}
@@ -5,6 +5,9 @@ export declare class AftRpcServer {
5
5
  private token;
6
6
  private handlers;
7
7
  private portFilePath;
8
+ private portsDir;
9
+ /** Unique per-instance ID — distinguishes our entry from duplicate plugin loads. */
10
+ private instanceId;
8
11
  constructor(storageDir: string, directory: string);
9
12
  /** Register an RPC method handler. */
10
13
  handle(method: string, handler: RpcHandler): void;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAOA,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAExF,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,YAAY,CAAS;gBAEjB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAIjD,sCAAsC;IACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;IAIjD,6DAA6D;IACvD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IA0C9B,8CAA8C;IAC9C,IAAI,IAAI,IAAI;IAaZ,OAAO,CAAC,QAAQ;CAoEjB"}
1
+ {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAOA,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAExF,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,oFAAoF;IACpF,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAMjD,sCAAsC;IACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;IAIjD,6DAA6D;IACvD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IA0C9B,8CAA8C;IAC9C,IAAI,IAAI,IAAI;IAaZ,OAAO,CAAC,QAAQ;CAoEjB"}
@@ -5,7 +5,25 @@
5
5
  */
6
6
  export declare function projectHash(directory: string): string;
7
7
  /**
8
- * Get the per-project RPC port file path.
8
+ * Legacy per-project RPC port file path (single file).
9
+ *
10
+ * Kept exported for backward-compatibility readers — when an older plugin
11
+ * instance is running alongside a newer one, the older one still writes
12
+ * to this path. New code prefers `rpcPortFileDir` (one file per instance)
13
+ * so that two plugin instances under `opencode --port 0` don't overwrite
14
+ * each other's port info. The client falls back to the legacy file if
15
+ * the new directory has no entries.
9
16
  */
10
17
  export declare function rpcPortFilePath(storageDir: string, directory: string): string;
18
+ /**
19
+ * Per-project RPC port directory. Each plugin instance writes a file
20
+ * `<instance-id>.json` into this directory so the client can discover
21
+ * ALL active plugin instances (e.g. the two created by OpenCode TUI when
22
+ * launched with `--port 0`). The client tries each port and uses the
23
+ * first one whose bridge is warm.
24
+ *
25
+ * Replaces the single `port` file used pre-v0.28.2 (which suffered from
26
+ * last-write-wins racing under `--port 0`).
27
+ */
28
+ export declare function rpcPortFileDir(storageDir: string, directory: string): string;
11
29
  //# sourceMappingURL=rpc-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-utils.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-utils.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7E"}
1
+ {"version":3,"file":"rpc-utils.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-utils.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuEjD,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,GAAI,IAAI,MAAM,EAAE,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,MAChD,CAAC;AAqRtC;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA+JjE;AAmmCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAwB/E;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAgGnF"}
1
+ {"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,OAAO,KAAK,EAAE,a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