@cotal-ai/connector-opencode 0.170.0 → 0.171.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.
- package/dist/index.js +4 -4
- package/dist/plugin/docs-bundle.bin +0 -0
- package/dist/plugin/docs-index.bin +0 -0
- package/dist/plugin/index.js +23 -23
- package/dist/plugin-seams.d.ts +93 -0
- package/dist/plugin-seams.d.ts.map +1 -0
- package/dist/plugin.d.ts +1 -63
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin2.d.ts.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type MeshAgent } from "@cotal-ai/connector-core";
|
|
2
|
+
export declare function log(msg: string): void;
|
|
3
|
+
/** The machine-stable half of the retirement line. The suite asserts on THIS, never on the sentence
|
|
4
|
+
* around it: a guard keyed on human prose dies the first time someone rewords a log message, and it
|
|
5
|
+
* dies silently, which is the failure mode a guard exists to prevent. Reword the sentence freely;
|
|
6
|
+
* do not change this token without updating the cells that import it. */
|
|
7
|
+
export declare const SESSION_RETIRED = "opencode-session-retired";
|
|
8
|
+
/** A bounded wait gave up. Exported so a cell keys on the token rather than on the sentence. */
|
|
9
|
+
export declare const SETTLE_ABANDONED = "opencode-settle-abandoned";
|
|
10
|
+
/** A retired session's write-ahead log was removed. Exported for the same reason as the two above:
|
|
11
|
+
* a cell keys on the token, never on the sentence around it. */
|
|
12
|
+
export declare const WAL_REAPED = "opencode-wal-reaped";
|
|
13
|
+
/** A retired session's write-ahead log was KEPT, and the line says which of the reasons applied.
|
|
14
|
+
* This is the token the reaping cell grades, because the lifetime is the claim and the deletion is
|
|
15
|
+
* only the easy half of it. */
|
|
16
|
+
export declare const WAL_KEPT = "opencode-wal-kept";
|
|
17
|
+
/** The shared shape of a pre-join model refusal: `"<model>: <detail>. Refusing before join"`.
|
|
18
|
+
* Exported so the 2.x adapter's own check (a different route, `/api/model`) produces the same
|
|
19
|
+
* sentence shape as `verifyServerModel` below without duplicating it. */
|
|
20
|
+
export declare function modelRefusalSentence(selectedModel: string, detail: string): string;
|
|
21
|
+
export declare function verifyServerModel(serverUrl: string, serverAuth: string, selectedModel: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* How long one swap step may hold the chain, or a teardown may hold the process, before it is
|
|
24
|
+
* abandoned out loud rather than waited on forever.
|
|
25
|
+
*
|
|
26
|
+
* A GENUINE-HANG BACKSTOP, deliberately far above normal settle latency. The distance is the point:
|
|
27
|
+
* a bound near normal latency would fire on steps that were merely slow, and releasing those early
|
|
28
|
+
* is the cost the distance buys down. It does NOT drop them, because nothing here cancels: a
|
|
29
|
+
* released step keeps running and can publish late and out of order. The
|
|
30
|
+
* measure comes from a cell rather than a guess: `reset:the /new drain puts the old session's tail
|
|
31
|
+
* and its close ON THE WIRE` asserts that a whole drain, flush plus run close plus settle plus the
|
|
32
|
+
* broker round trip, AND a read-back of the subject both complete inside the 2s the suite waits.
|
|
33
|
+
* So a healthy settle in that fixture is comfortably under two seconds and this is five times that.
|
|
34
|
+
* Reaching it is treated as a hang; it is NOT proof the step will never return. A broker or network
|
|
35
|
+
* pause can outlast the bound and then recover, which is exactly why the abandoned step is left
|
|
36
|
+
* uncancelled and may still publish afterwards.
|
|
37
|
+
*/
|
|
38
|
+
export declare const SWAP_SETTLE_MS = 10000;
|
|
39
|
+
/**
|
|
40
|
+
* How long teardown waits for interactive work it ALREADY ADMITTED before it attempts departure.
|
|
41
|
+
*
|
|
42
|
+
* DERIVED, NOT PICKED. It has to be under the shortest runtime grace window, which is 1.5s for tmux
|
|
43
|
+
* and cmux against 3s for the built-in pty, because a stop that spends longer than that waiting is a
|
|
44
|
+
* stop whose offline publish is killed before it lands. That is the failure the publish-before-join
|
|
45
|
+
* ordering exists to prevent, so a bound above the grace window would reintroduce it here. 1s leaves
|
|
46
|
+
* room for the publish itself, and what it waits on is one presence round trip or one tool call, not
|
|
47
|
+
* an event drain: those are excluded and joined afterwards.
|
|
48
|
+
*/
|
|
49
|
+
export declare const INTAKE_SETTLE_MS = 1000;
|
|
50
|
+
/**
|
|
51
|
+
* Races `work` against a `ms` timeout so a stuck settle is abandoned out loud rather than waited on
|
|
52
|
+
* forever (see the note at its call sites in `quiesce`). Exported: the 2.x adapter's own teardown
|
|
53
|
+
* uses the same bounded-settle shape rather than a second copy of it.
|
|
54
|
+
*/
|
|
55
|
+
declare function settleWithin(work: Promise<unknown> | undefined, ms: number, what: string): Promise<boolean>;
|
|
56
|
+
export { settleWithin };
|
|
57
|
+
/**
|
|
58
|
+
* The inbox batch a turn carries, by receive key: THE SEAT'S ACK BOUNDARY, defined here once and
|
|
59
|
+
* driven by both adapters (the 1.x hooks below and `plugin2.ts`), so they cannot drift on what is
|
|
60
|
+
* acked when a turn ends and what is left to redeliver. A batch is surfaced into a turn and held in
|
|
61
|
+
* flight while it runs; the turn's end acks it when the turn finished or was stopped, and releases
|
|
62
|
+
* it when the turn failed. It is OPEN from the surface until that end, and a native prompt carries
|
|
63
|
+
* nothing while it is: its deliveries are still in the inbox, so a second batch would carry them
|
|
64
|
+
* again and settle them with a turn that never ran them.
|
|
65
|
+
*/
|
|
66
|
+
export declare class SurfacedBatch {
|
|
67
|
+
private readonly agent;
|
|
68
|
+
private carried;
|
|
69
|
+
private inTurn;
|
|
70
|
+
constructor(agent: MeshAgent);
|
|
71
|
+
/** A surfaced batch's turn has not ended yet. */
|
|
72
|
+
get open(): boolean;
|
|
73
|
+
/** The receive keys the batch carries. */
|
|
74
|
+
get keys(): readonly string[];
|
|
75
|
+
/** Make `keys` the batch, HELD IN FLIGHT for as long as its turn runs. A turn outlasting the
|
|
76
|
+
* consumer's ack wait is ordinary, and while the batch is held the agent restarts that wait, so
|
|
77
|
+
* the broker does not hand a role request this seat is still working on to another reader of its
|
|
78
|
+
* role. Refused at the hold ceiling, and then nothing may be surfaced. */
|
|
79
|
+
surface(keys: string[]): boolean;
|
|
80
|
+
/** Carry the buffered inbox and pending run turns into a native prompt, returning the prefix that
|
|
81
|
+
* goes ahead of its text, or `undefined` when there is nothing to carry or a batch is open. The
|
|
82
|
+
* inbox keys it carries become the open batch; run turns alone open none, having nothing to ack.
|
|
83
|
+
* The prompt running with the prefix in place IS the delivery, so the run turns commit here. */
|
|
84
|
+
inject(): string | undefined;
|
|
85
|
+
/** Ack exactly the surfaced deliveries by their receive keys (#624: an id-less item's wire id
|
|
86
|
+
* would be "", unaddressable). Overflow may already have removed some; MeshAgent marks every
|
|
87
|
+
* confirmed delivery handled while only acking entries still present. */
|
|
88
|
+
ack(): void;
|
|
89
|
+
/** Stop holding the batch: its deliveries are no longer renewed, so whatever is still unacked
|
|
90
|
+
* redelivers once its ack wait runs out. */
|
|
91
|
+
abandon(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=plugin-seams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-seams.d.ts","sourceRoot":"","sources":["../src/plugin-seams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE3E,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAErC;AAED;;;0EAG0E;AAC1E,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAC1D,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAC5D;iEACiE;AACjE,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAChD;;gCAEgC;AAChC,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C;;0EAE0E;AAC1E,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAElF;AACD,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYnH;AACD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,OAAQ,CAAC;AAEtC;;;;GAIG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqB1G;AACD,OAAO,EAAE,YAAY,EAAE,CAAC;AAoBxB;;;;;;;;GAQG;AACH,qBAAa,aAAa;IAIZ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAHlC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,MAAM,CAAS;gBAEM,KAAK,EAAE,SAAS;IAE7C,iDAAiD;IACjD,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,0CAA0C;IAC1C,IAAI,IAAI,IAAI,SAAS,MAAM,EAAE,CAE5B;IAED;;;+EAG2E;IAC3E,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO;IAQhC;;;qGAGiG;IACjG,MAAM,IAAI,MAAM,GAAG,SAAS;IAS5B;;8EAE0E;IAC1E,GAAG,IAAI,IAAI;IAKX;iDAC6C;IAC7C,OAAO,IAAI,IAAI;CAKhB"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,66 +1,4 @@
|
|
|
1
|
-
import { MeshAgent } from "@cotal-ai/connector-core";
|
|
2
1
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
3
|
-
|
|
4
|
-
* around it: a guard keyed on human prose dies the first time someone rewords a log message, and it
|
|
5
|
-
* dies silently, which is the failure mode a guard exists to prevent. Reword the sentence freely;
|
|
6
|
-
* do not change this token without updating the cells that import it. */
|
|
7
|
-
export declare const SESSION_RETIRED = "opencode-session-retired";
|
|
8
|
-
/** A bounded wait gave up. Exported so a cell keys on the token rather than on the sentence. */
|
|
9
|
-
export declare const SETTLE_ABANDONED = "opencode-settle-abandoned";
|
|
10
|
-
/** A retired session's write-ahead log was removed. Exported for the same reason as the two above:
|
|
11
|
-
* a cell keys on the token, never on the sentence around it. */
|
|
12
|
-
export declare const WAL_REAPED = "opencode-wal-reaped";
|
|
13
|
-
/** A retired session's write-ahead log was KEPT, and the line says which of the reasons applied.
|
|
14
|
-
* This is the token the reaping cell grades, because the lifetime is the claim and the deletion is
|
|
15
|
-
* only the easy half of it. */
|
|
16
|
-
export declare const WAL_KEPT = "opencode-wal-kept";
|
|
17
|
-
/** The shared shape of a pre-join model refusal: `"<model>: <detail>. Refusing before join"`.
|
|
18
|
-
* Exported so the 2.x adapter's own check (a different route, `/api/model`) produces the same
|
|
19
|
-
* sentence shape as `verifyServerModel` below without duplicating it. */
|
|
20
|
-
export declare function modelRefusalSentence(selectedModel: string, detail: string): string;
|
|
21
|
-
export declare function verifyServerModel(serverUrl: string, serverAuth: string, selectedModel: string): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Races `work` against a `ms` timeout so a stuck settle is abandoned out loud rather than waited on
|
|
24
|
-
* forever (see the note at its call sites in `quiesce`). Exported: the 2.x adapter's own teardown
|
|
25
|
-
* uses the same bounded-settle shape rather than a second copy of it.
|
|
26
|
-
*/
|
|
27
|
-
declare function settleWithin(work: Promise<unknown> | undefined, ms: number, what: string): Promise<boolean>;
|
|
28
|
-
export { settleWithin };
|
|
29
|
-
/**
|
|
30
|
-
* The inbox batch a turn carries, by receive key: THE SEAT'S ACK BOUNDARY, defined here once and
|
|
31
|
-
* driven by both adapters (the 1.x hooks below and `plugin2.ts`), so they cannot drift on what is
|
|
32
|
-
* acked when a turn ends and what is left to redeliver. A batch is surfaced into a turn and held in
|
|
33
|
-
* flight while it runs; the turn's end acks it when the turn finished or was stopped, and releases
|
|
34
|
-
* it when the turn failed. It is OPEN from the surface until that end, and a native prompt carries
|
|
35
|
-
* nothing while it is: its deliveries are still in the inbox, so a second batch would carry them
|
|
36
|
-
* again and settle them with a turn that never ran them.
|
|
37
|
-
*/
|
|
38
|
-
export declare class SurfacedBatch {
|
|
39
|
-
private readonly agent;
|
|
40
|
-
private carried;
|
|
41
|
-
private inTurn;
|
|
42
|
-
constructor(agent: MeshAgent);
|
|
43
|
-
/** A surfaced batch's turn has not ended yet. */
|
|
44
|
-
get open(): boolean;
|
|
45
|
-
/** The receive keys the batch carries. */
|
|
46
|
-
get keys(): readonly string[];
|
|
47
|
-
/** Make `keys` the batch, HELD IN FLIGHT for as long as its turn runs. A turn outlasting the
|
|
48
|
-
* consumer's ack wait is ordinary, and while the batch is held the agent restarts that wait, so
|
|
49
|
-
* the broker does not hand a role request this seat is still working on to another reader of its
|
|
50
|
-
* role. Refused at the hold ceiling, and then nothing may be surfaced. */
|
|
51
|
-
surface(keys: string[]): boolean;
|
|
52
|
-
/** Carry the buffered inbox and pending run turns into a native prompt, returning the prefix that
|
|
53
|
-
* goes ahead of its text, or `undefined` when there is nothing to carry or a batch is open. The
|
|
54
|
-
* inbox keys it carries become the open batch; run turns alone open none, having nothing to ack.
|
|
55
|
-
* The prompt running with the prefix in place IS the delivery, so the run turns commit here. */
|
|
56
|
-
inject(): string | undefined;
|
|
57
|
-
/** Ack exactly the surfaced deliveries by their receive keys (#624: an id-less item's wire id
|
|
58
|
-
* would be "", unaddressable). Overflow may already have removed some; MeshAgent marks every
|
|
59
|
-
* confirmed delivery handled while only acking entries still present. */
|
|
60
|
-
ack(): void;
|
|
61
|
-
/** Stop holding the batch: its deliveries are no longer renewed, so whatever is still unacked
|
|
62
|
-
* redelivers once its ack wait runs out. */
|
|
63
|
-
abandon(): void;
|
|
64
|
-
}
|
|
2
|
+
export { SESSION_RETIRED, SETTLE_ABANDONED, WAL_REAPED, WAL_KEPT, modelRefusalSentence, verifyServerModel, settleWithin, SurfacedBatch, } from "./plugin-seams.js";
|
|
65
3
|
export declare const cotal: Plugin;
|
|
66
4
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,qBAAqB,CAAC;AAazE,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,MA00CnB,CAAC"}
|
package/dist/plugin2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin2.d.ts","sourceRoot":"","sources":["../src/plugin2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin2.d.ts","sourceRoot":"","sources":["../src/plugin2.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,sBAAsB,CAAC;AAmG7E;0FAC0F;AAC1F,wBAAsB,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAsB7F"}
|
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.
|
|
4
|
+
"version": "0.171.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,12 +21,14 @@
|
|
|
21
21
|
"@cotal-ai/core": ">=0.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@cotal-ai/
|
|
25
|
-
"@cotal-ai/core": "0.
|
|
24
|
+
"@cotal-ai/auth": "0.171.1",
|
|
25
|
+
"@cotal-ai/connector-core": "0.171.1",
|
|
26
|
+
"@cotal-ai/core": "0.171.1",
|
|
26
27
|
"@cotal-ai/smoke-kit": "0.0.0",
|
|
27
28
|
"@nats-io/transport-node": "3.4.0",
|
|
28
29
|
"@opencode-ai/plugin": "^1.16.2",
|
|
29
30
|
"esbuild": "^0.28.0",
|
|
31
|
+
"jose": "^6.2.3",
|
|
30
32
|
"tsx": "^4.22.4"
|
|
31
33
|
},
|
|
32
34
|
"files": [
|