@cotal-ai/connector-opencode 0.189.0 → 0.191.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.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,qBAAqB,CAAC;AAezE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAC;AAW3B,eAAO,MAAM,KAAK,EAAE,MAq1CnB,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAwEA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,qBAAqB,CAAC;AAezE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAC;AAW3B,eAAO,MAAM,KAAK,EAAE,MAs1CnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin2.d.ts","sourceRoot":"","sources":["../src/plugin2.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,sBAAsB,CAAC;AAkE7E;0FAC0F;AAC1F,wBAAsB,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAsB7F"}
1
+ {"version":3,"file":"plugin2.d.ts","sourceRoot":"","sources":["../src/plugin2.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,sBAAsB,CAAC;AAmE7E;0FAC0F;AAC1F,wBAAsB,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAsB7F"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The tie between an owner's turn and the run it shows in, for OpenCode (SPEC 13.22 `sent`, plan 5.3
3
+ * O1). Both versions take a caller-chosen id for the user message a prompt is stored as:
4
+ *
5
+ * - 2.x: `POST /api/session/:id/prompt` with `id`. Measured on 2.4.3 (oc2-id-probe.mjs): the id sent
6
+ * is answered and stored as the user message's id. The 2.x mapper opens a run on a user message.
7
+ * - 1.x: `POST /session/:id/prompt_async` with `messageID`. Measured on 1.19.6 (oc1-id-probe.mjs):
8
+ * the user message is stored under it, and the assistant message that answers it names it as
9
+ * `parentID`. The 1.x mapper opens a run on that assistant message.
10
+ *
11
+ * So the connector sends each owner turn under an id it derives from the turn's own store id, and
12
+ * ties the run that opens for that message back to the store id. A user message that is not an
13
+ * owner's turn (a mesh delivery, a TUI prompt) ties nothing. A steered prompt that joins a run already
14
+ * open opens no run, so it stays unplaced, as plan 5.3 asks.
15
+ */
16
+ import type { RecordMapper } from "@cotal-ai/connector-core";
17
+ /** A message id for the owner turn `id`. OpenCode orders messages by id, so it begins with the 12 hex
18
+ * digits of the time, as OpenCode's own ascending ids do (`msg_` + 12 hex + 14 more), and ends with
19
+ * the turn id's own letters, so no two owner turns share one. */
20
+ export declare function ownerMessageId(id: string, now?: number): string;
21
+ /** `map`, telling `opened` each run a 2.x user record opens, with that user message's id. */
22
+ export declare function withUserRunOpened<R extends object>(map: RecordMapper<R>, opened: (messageId: string, runId: string) => void): RecordMapper<R>;
23
+ /** The same for 1.x, whose runs open on the assistant message that answers a prompt: `opened` hears
24
+ * that message's `parentID`, the user message the prompt was stored as. */
25
+ export declare function withAnswerRunOpened<R extends object>(map: RecordMapper<R>, opened: (messageId: string, runId: string) => void): RecordMapper<R>;
26
+ /** The message ids this seat sent owner turns under, waiting for their runs: bounded, oldest out. */
27
+ export declare class OwnerMessages {
28
+ private readonly report;
29
+ private readonly max;
30
+ private readonly ids;
31
+ constructor(report: (id: string, run: {
32
+ threadId: string;
33
+ runId: string;
34
+ }) => void, max?: number);
35
+ /** The message id to send the owner turn `id` under. */
36
+ send(id: string): string;
37
+ /** A run opened for the user message `messageId` in session `threadId`. */
38
+ opened(threadId: string, messageId: string, runId: string): void;
39
+ }
40
+ //# sourceMappingURL=sent-runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sent-runs.d.ts","sourceRoot":"","sources":["../src/sent-runs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAO7D;;kEAEkE;AAClE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAG3E;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAO7I;AAED;4EAC4E;AAC5E,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAO/I;AAED,qGAAqG;AACrG,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;gBAG9B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,EACtE,GAAG,SAAK;IAG3B,wDAAwD;IACxD,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAOxB,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAMjE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-opencode",
3
3
  "description": "Cotal connector for OpenCode: a native in-process plugin that joins a session to the mesh.",
4
- "version": "0.189.0",
4
+ "version": "0.191.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,9 +21,9 @@
21
21
  "@cotal-ai/core": ">=0.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@cotal-ai/auth": "0.189.0",
25
- "@cotal-ai/connector-core": "0.189.0",
26
- "@cotal-ai/core": "0.189.0",
24
+ "@cotal-ai/auth": "0.191.0",
25
+ "@cotal-ai/connector-core": "0.191.0",
26
+ "@cotal-ai/core": "0.191.0",
27
27
  "@cotal-ai/smoke-kit": "0.0.0",
28
28
  "@nats-io/transport-node": "3.4.0",
29
29
  "@opencode-ai/plugin": "^1.16.2",