@cotal-ai/connector-opencode 0.8.0 → 0.8.2
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/extension.d.ts +2 -2
- package/dist/extension.d.ts.map +1 -1
- package/dist/extension.js +27 -5
- package/dist/extension.js.map +1 -1
- package/dist/plugin.bundle.js +219 -13
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +79 -11
- package/dist/plugin.js.map +1 -1
- package/dist/serve.js +41 -6
- package/dist/serve.js.map +1 -1
- package/package.json +3 -3
package/dist/extension.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { type Connector } from "@cotal-ai/core";
|
|
|
4
4
|
* OpenCode's client/server split (see serve.ts). The Cotal mesh bridge runs as an in-process plugin
|
|
5
5
|
* inside a headless `opencode serve`: it holds the {@link MeshAgent}, registers the cotal_* tools
|
|
6
6
|
* natively (from the shared specs, at parity with Claude Code), reports presence off the event bus,
|
|
7
|
-
* and owns ONE session it drives — injecting each incoming peer batch
|
|
8
|
-
*
|
|
7
|
+
* and owns ONE session it drives — injecting each incoming peer batch through the authenticated
|
|
8
|
+
* OpenCode server API on the same serve process the TUI attaches to. The shim then attaches a
|
|
9
9
|
* foreground TUI to that session, so a human watching sees the agent work and can type into it.
|
|
10
10
|
*
|
|
11
11
|
* Config rides in `OPENCODE_CONFIG_CONTENT` (inline JSON, the highest merge layer), so the
|
package/dist/extension.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,SAAS,EAAoC,MAAM,gBAAgB,CAAC;AAa3G;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,SAAS,EAAoC,MAAM,gBAAgB,CAAC;AAa3G;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAmG/B,CAAC"}
|
package/dist/extension.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { loadAgentFile, registry } from "@cotal-ai/core";
|
|
4
|
-
import { aclEnv, launchEnv, MODEL_PROVIDER_KEYS } from "@cotal-ai/connector-core";
|
|
4
|
+
import { aclEnv, launchEnv, controlEndpoint, MODEL_PROVIDER_KEYS } from "@cotal-ai/connector-core";
|
|
5
5
|
/** The bundled in-process plugin (esbuild → `dist/plugin.bundle.js`). `opencode serve` loads it by
|
|
6
6
|
* absolute path from the inline config, so it runs *inside* the server and shares its SDK client.
|
|
7
7
|
* Resolved relative to this module — beside the built `dist/extension.js`, so the connector must be
|
|
@@ -15,8 +15,8 @@ const SERVE_SHIM = fileURLToPath(new URL("./serve.js", import.meta.url));
|
|
|
15
15
|
* OpenCode's client/server split (see serve.ts). The Cotal mesh bridge runs as an in-process plugin
|
|
16
16
|
* inside a headless `opencode serve`: it holds the {@link MeshAgent}, registers the cotal_* tools
|
|
17
17
|
* natively (from the shared specs, at parity with Claude Code), reports presence off the event bus,
|
|
18
|
-
* and owns ONE session it drives — injecting each incoming peer batch
|
|
19
|
-
*
|
|
18
|
+
* and owns ONE session it drives — injecting each incoming peer batch through the authenticated
|
|
19
|
+
* OpenCode server API on the same serve process the TUI attaches to. The shim then attaches a
|
|
20
20
|
* foreground TUI to that session, so a human watching sees the agent work and can type into it.
|
|
21
21
|
*
|
|
22
22
|
* Config rides in `OPENCODE_CONFIG_CONTENT` (inline JSON, the highest merge layer), so the
|
|
@@ -57,6 +57,12 @@ export const opencodeConnector = {
|
|
|
57
57
|
env.COTAL_CREDS = opts.creds;
|
|
58
58
|
if (opts.servers)
|
|
59
59
|
env.COTAL_SERVERS = opts.servers;
|
|
60
|
+
// Where serve.ts roots this agent's SQLite DB + serve pidfile. Pin it to the manager's
|
|
61
|
+
// workspace root so a per-agent launch cwd (which the manager can point at any repo) doesn't
|
|
62
|
+
// drop `.cotal/opencode/<name>` into the target tree. Standalone `cotal spawn` has no manager
|
|
63
|
+
// workspace → root it at the launch dir (this process's cwd, which the child inherits), the
|
|
64
|
+
// prior behavior. serve.ts requires this env (no silent cwd fallback).
|
|
65
|
+
env.COTAL_OPENCODE_HOME = opts.workspaceRoot ?? process.cwd();
|
|
60
66
|
const config = {
|
|
61
67
|
$schema: "https://opencode.ai/config.json",
|
|
62
68
|
permission: "allow",
|
|
@@ -87,15 +93,31 @@ export const opencodeConnector = {
|
|
|
87
93
|
if (face)
|
|
88
94
|
env.COTAL_FACE_PERSONA = face; // shim swaps the TUI for the face viewer
|
|
89
95
|
}
|
|
90
|
-
// The `--model` flag wins over the agent file, and applies even with no agent file.
|
|
91
|
-
|
|
96
|
+
// The `--model` flag wins over the agent file, and applies even with no agent file. Pin it to a
|
|
97
|
+
// dedicated primary agent made the default, so an operator's own `default_agent` in
|
|
98
|
+
// ~/.config/opencode (with its own model) can't override the model a Cotal spawn asks for — the
|
|
99
|
+
// session the plugin drives runs the persona's model, not the operator's default agent's.
|
|
100
|
+
if (model) {
|
|
92
101
|
config.model = model;
|
|
102
|
+
config.agent = { cotal: { mode: "primary", model } };
|
|
103
|
+
config.default_agent = "cotal";
|
|
104
|
+
}
|
|
93
105
|
env.OPENCODE_CONFIG_CONTENT = JSON.stringify(config);
|
|
106
|
+
// Local control endpoint: the manager sends a cooperative {op:"shutdown"} here on a signal-less
|
|
107
|
+
// runtime (ConPTY/Windows), where a hard kill skips cleanup and the agent lingers until its
|
|
108
|
+
// presence TTL expires. The plugin (in the opencode server process) starts the control server and
|
|
109
|
+
// leaves the mesh cleanly on shutdown. Minted here; passed to the plugin in the child env (the
|
|
110
|
+
// token never on argv/logs) — opencode serve inherits this process env, the attached TUI strips
|
|
111
|
+
// COTAL_*. Returned in the LaunchSpec so the manager holds it in memory to drive the stop.
|
|
112
|
+
const control = controlEndpoint(opts.space, opts.name);
|
|
113
|
+
env.COTAL_CONTROL_SOCKET = control.path;
|
|
114
|
+
env.COTAL_CONTROL_TOKEN = control.token;
|
|
94
115
|
// Run the shim (node dist/serve.js): `opencode serve` + an attached foreground TUI.
|
|
95
116
|
return {
|
|
96
117
|
command: process.execPath,
|
|
97
118
|
args: [SERVE_SHIM],
|
|
98
119
|
env,
|
|
120
|
+
control,
|
|
99
121
|
};
|
|
100
122
|
},
|
|
101
123
|
};
|
package/dist/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAoD,MAAM,gBAAgB,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAoD,MAAM,gBAAgB,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEnG;;;oCAGoC;AACpC,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEnF;uFACuF;AACvF,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,YAAY,EA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AC;QAErD,gGAAgG;QAChG,4FAA4F;QAC5F,kGAAkG;QAClG,+FAA+F;QAC/F,gGAAgG;QAChG,2FAA2F;QAC3F,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,GAAG,CAAC,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;QACxC,GAAG,CAAC,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC;QAExC,oFAAoF;QACpF,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,QAAQ;YACzB,IAAI,EAAE,CAAC,UAAU,CAAC;YAClB,GAAG;YACH,OAAO;SACR,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC"}
|
package/dist/plugin.bundle.js
CHANGED
|
@@ -2993,7 +2993,7 @@ var require_nkeys = __commonJS({
|
|
|
2993
2993
|
exports.createAccount = createAccount2;
|
|
2994
2994
|
exports.createUser = createUser2;
|
|
2995
2995
|
exports.createCluster = createCluster;
|
|
2996
|
-
exports.createServer =
|
|
2996
|
+
exports.createServer = createServer2;
|
|
2997
2997
|
exports.createCurve = createCurve;
|
|
2998
2998
|
exports.fromPublic = fromPublic2;
|
|
2999
2999
|
exports.fromCurveSeed = fromCurveSeed;
|
|
@@ -3021,7 +3021,7 @@ var require_nkeys = __commonJS({
|
|
|
3021
3021
|
function createCluster() {
|
|
3022
3022
|
return createPair(Prefix2.Cluster);
|
|
3023
3023
|
}
|
|
3024
|
-
function
|
|
3024
|
+
function createServer2() {
|
|
3025
3025
|
return createPair(Prefix2.Server);
|
|
3026
3026
|
}
|
|
3027
3027
|
function createCurve() {
|
|
@@ -14856,6 +14856,10 @@ function deliveryBucket(space) {
|
|
|
14856
14856
|
function leaseKey(shardIndex) {
|
|
14857
14857
|
return `lease.${shardIndex}`;
|
|
14858
14858
|
}
|
|
14859
|
+
function managerBucket(space) {
|
|
14860
|
+
return `cotal_manager_${token(space)}`;
|
|
14861
|
+
}
|
|
14862
|
+
var MANAGER_LEASE_KEY = "lease";
|
|
14859
14863
|
function chatStream(space) {
|
|
14860
14864
|
return `CHAT_${token(space)}`;
|
|
14861
14865
|
}
|
|
@@ -14940,6 +14944,8 @@ function assertValidName(name) {
|
|
|
14940
14944
|
throw new Error(`invalid name ${JSON.stringify(name)}: must be a single line`);
|
|
14941
14945
|
if (name.includes("/"))
|
|
14942
14946
|
throw new Error(`invalid name ${JSON.stringify(name)}: "/" is reserved (the owner/name separator)`);
|
|
14947
|
+
if (name.includes("\\"))
|
|
14948
|
+
throw new Error(`invalid name ${JSON.stringify(name)}: "\\" is reserved (a Windows path separator)`);
|
|
14943
14949
|
}
|
|
14944
14950
|
|
|
14945
14951
|
// ../../packages/core/dist/link.js
|
|
@@ -16613,6 +16619,7 @@ var import_kv = __toESM(require_mod6(), 1);
|
|
|
16613
16619
|
var MAX_MSGS_PER_SUBJECT = 1e3;
|
|
16614
16620
|
var PLANE3_DEDUP_WINDOW_MS = 2 * 60 * 60 * 1e3;
|
|
16615
16621
|
var DINBOX_MAX_ACK_PENDING = 1e3;
|
|
16622
|
+
var MANAGER_LEASE_TTL_MS = 1e4;
|
|
16616
16623
|
var MEMBERSHIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
16617
16624
|
async function createSpaceStreams(jsm, space) {
|
|
16618
16625
|
const p = spacePrefix(space);
|
|
@@ -17033,10 +17040,13 @@ function loadAgentFile(path) {
|
|
|
17033
17040
|
};
|
|
17034
17041
|
}
|
|
17035
17042
|
|
|
17043
|
+
// ../../packages/core/dist/secret-fs.js
|
|
17044
|
+
var isWin = process.platform === "win32";
|
|
17045
|
+
|
|
17036
17046
|
// ../../packages/core/dist/endpoint.js
|
|
17037
|
-
var import_transport_node5 = __toESM(require_transport_node(), 1);
|
|
17038
17047
|
import { EventEmitter } from "node:events";
|
|
17039
17048
|
import { randomUUID } from "node:crypto";
|
|
17049
|
+
var import_transport_node5 = __toESM(require_transport_node(), 1);
|
|
17040
17050
|
var import_jetstream2 = __toESM(require_mod4(), 1);
|
|
17041
17051
|
var import_kv7 = __toESM(require_mod6(), 1);
|
|
17042
17052
|
var DEFAULT_SERVER = "nats://127.0.0.1:4222";
|
|
@@ -17068,6 +17078,7 @@ var CotalEndpoint = class extends EventEmitter {
|
|
|
17068
17078
|
membersKv;
|
|
17069
17079
|
aclKv;
|
|
17070
17080
|
deliveryKv;
|
|
17081
|
+
managerLeaseKv;
|
|
17071
17082
|
membershipKv;
|
|
17072
17083
|
/** The live `ctl.delivery` serve subscription (delivery daemon) — re-created on every (re)connect by
|
|
17073
17084
|
* {@link armDeliveryControl}; tracked so the stale one is dropped on reconnect. */
|
|
@@ -17997,6 +18008,68 @@ var CotalEndpoint = class extends EventEmitter {
|
|
|
17997
18008
|
return void 0;
|
|
17998
18009
|
}
|
|
17999
18010
|
}
|
|
18011
|
+
/** Ensure + bind the manager singleton-lease bucket. NOTE: `Kvm.open` binds LAZILY — it does NOT
|
|
18012
|
+
* verify the stream exists or throw when it's missing, so it can't "create if absent" (a fresh bucket
|
|
18013
|
+
* then fails 'stream not found' on the first write — unlike the delivery bucket, which is pre-created
|
|
18014
|
+
* at `cotal up`). `create` is the ensure-exists call: it makes the bucket (bucket-level TTL) or, when
|
|
18015
|
+
* another manager already did, throws — and we bind the now-existing one. Either way the per-KEY CAS
|
|
18016
|
+
* create stays the only single-flight gate, so a lost bucket-create race never reads as "lease held".
|
|
18017
|
+
* The manager is allow-all, so it may create. */
|
|
18018
|
+
async managerLeaseRegistry() {
|
|
18019
|
+
if (!this.nc)
|
|
18020
|
+
throw new Error("endpoint not started");
|
|
18021
|
+
if (this.managerLeaseKv)
|
|
18022
|
+
return this.managerLeaseKv;
|
|
18023
|
+
const kvm = new import_kv7.Kvm(this.nc);
|
|
18024
|
+
try {
|
|
18025
|
+
this.managerLeaseKv = await kvm.create(managerBucket(this.space), { ttl: MANAGER_LEASE_TTL_MS });
|
|
18026
|
+
} catch {
|
|
18027
|
+
this.managerLeaseKv = await kvm.open(managerBucket(this.space));
|
|
18028
|
+
}
|
|
18029
|
+
return this.managerLeaseKv;
|
|
18030
|
+
}
|
|
18031
|
+
encodeManagerLease(info) {
|
|
18032
|
+
return new TextEncoder().encode(JSON.stringify(info));
|
|
18033
|
+
}
|
|
18034
|
+
/** Acquire the singleton manager lease via ATOMIC CAS create. THROWS if a live lease exists (a loud
|
|
18035
|
+
* refusal-to-start, never a retry) so two managers never split control. A crashed holder's lease
|
|
18036
|
+
* auto-expires (bucket TTL). Returns the lease revision (for renew). */
|
|
18037
|
+
async acquireManagerLease(info) {
|
|
18038
|
+
return (await this.managerLeaseRegistry()).create(MANAGER_LEASE_KEY, this.encodeManagerLease({ ...info, since: Date.now() }));
|
|
18039
|
+
}
|
|
18040
|
+
/** Renew the held lease (CAS update against `revision`) before the bucket TTL expires it. Throws if the
|
|
18041
|
+
* revision moved (lost the lease). Returns the new revision. */
|
|
18042
|
+
async renewManagerLease(info, revision) {
|
|
18043
|
+
return (await this.managerLeaseRegistry()).update(MANAGER_LEASE_KEY, this.encodeManagerLease({ ...info, since: Date.now() }), revision);
|
|
18044
|
+
}
|
|
18045
|
+
/** Release the held lease on clean shutdown so a replacement manager acquires immediately. CAS-guarded
|
|
18046
|
+
* by `revision`: if we already LOST the lease (renew gap / another manager took over) the stored
|
|
18047
|
+
* revision has moved, the conditional delete no-ops, and we never delete the replacement's live lease. */
|
|
18048
|
+
async releaseManagerLease(revision) {
|
|
18049
|
+
try {
|
|
18050
|
+
const kv = await this.managerLeaseRegistry();
|
|
18051
|
+
if (revision === void 0)
|
|
18052
|
+
await kv.delete(MANAGER_LEASE_KEY);
|
|
18053
|
+
else
|
|
18054
|
+
await kv.delete(MANAGER_LEASE_KEY, { previousSeq: revision });
|
|
18055
|
+
} catch {
|
|
18056
|
+
}
|
|
18057
|
+
}
|
|
18058
|
+
/** Read the live manager lease, or undefined if none (bucket absent / key deleted/expired). Open-only —
|
|
18059
|
+
* never creates the bucket, so a probe that finds no manager leaves none behind. */
|
|
18060
|
+
async readManagerLease() {
|
|
18061
|
+
if (!this.nc)
|
|
18062
|
+
return void 0;
|
|
18063
|
+
try {
|
|
18064
|
+
const kv = await new import_kv7.Kvm(this.nc).open(managerBucket(this.space));
|
|
18065
|
+
const e = await kv.get(MANAGER_LEASE_KEY);
|
|
18066
|
+
if (!e || e.operation === "DEL" || e.operation === "PURGE")
|
|
18067
|
+
return void 0;
|
|
18068
|
+
return e.json();
|
|
18069
|
+
} catch {
|
|
18070
|
+
return void 0;
|
|
18071
|
+
}
|
|
18072
|
+
}
|
|
18000
18073
|
/** Privileged: one owner's NON-TOMBSTONED durable memberships as `{channel, generation, activated}` —
|
|
18001
18074
|
* the server-side delivery daemon serves this to a connecting agent (the `listMemberships` op on
|
|
18002
18075
|
* `ctl.delivery`). The agent seeds its leave mirror from the ACTIVATED ones (the confirmed backstops),
|
|
@@ -19638,14 +19711,15 @@ var MeshAgent = class extends EventEmitter2 {
|
|
|
19638
19711
|
/** Ask the manager to spawn a new teammate into this space (its `start` op).
|
|
19639
19712
|
* How it lands — a detached PTY, a tmux window, a cmux tab — is the manager's
|
|
19640
19713
|
* runtime; from here it just joins the mesh as a lateral peer. `opts.agent` picks
|
|
19641
|
-
* the harness (default the manager's `cotal`/Claude)
|
|
19642
|
-
* persona file's `model
|
|
19714
|
+
* the harness (default the manager's `cotal`/Claude), `opts.model` overrides the
|
|
19715
|
+
* persona file's `model:`, and `opts.cwd` roots the new peer at a different folder/repo
|
|
19716
|
+
* than the manager's workspace — the same knobs the operator's `cotal start` carries, so
|
|
19643
19717
|
* the agent and operator spawn doors share one control-op contract. */
|
|
19644
19718
|
async spawn(name, role, opts) {
|
|
19645
19719
|
this.assertConnected();
|
|
19646
19720
|
return this.ep.requestControl(CONTROL_PRIVILEGED, {
|
|
19647
19721
|
op: "start",
|
|
19648
|
-
args: { name, role, agent: opts?.agent, model: opts?.model }
|
|
19722
|
+
args: { name, role, agent: opts?.agent, model: opts?.model, cwd: opts?.cwd }
|
|
19649
19723
|
});
|
|
19650
19724
|
}
|
|
19651
19725
|
/** Ask the manager to tear a teammate down (its `stop` op). Graceful by default —
|
|
@@ -34722,11 +34796,12 @@ ${info}${caught}`);
|
|
|
34722
34796
|
name: external_exports.string().describe("Which persona to spawn \u2014 the persona FILENAME in .cotal/agents (e.g. `review-critic`), without the .md. The new peer joins under the persona's own `name:` (auto-numbered, e.g. socrates-2, if that's taken). Fails if no such persona file exists \u2014 spawn an existing persona, don't invent a name."),
|
|
34723
34797
|
role: external_exports.string().optional().describe("Optional role for the new peer (e.g. worker, reviewer); overrides the persona file's role."),
|
|
34724
34798
|
agent: external_exports.string().optional().describe("Optional harness the new peer runs on \u2014 the agent/connector type (claude, opencode, hermes), NOT the persona to spawn (that's `name`). Defaults to the manager's default (Claude)."),
|
|
34725
|
-
model: external_exports.string().optional().describe("Optional model override (e.g. opus, sonnet) \u2014 wins over the persona file's model:.")
|
|
34799
|
+
model: external_exports.string().optional().describe("Optional model override (e.g. opus, sonnet) \u2014 wins over the persona file's model:."),
|
|
34800
|
+
cwd: external_exports.string().optional().describe("Optional working directory to root the new peer at (e.g. a different repo). A relative path resolves against the manager's workspace; omitted \u2192 it shares the manager's workspace.")
|
|
34726
34801
|
},
|
|
34727
|
-
async run(agent, _config, { name, role, agent: agentType, model }) {
|
|
34802
|
+
async run(agent, _config, { name, role, agent: agentType, model, cwd }) {
|
|
34728
34803
|
try {
|
|
34729
|
-
const reply = await agent.spawn(name, role, { agent: agentType, model });
|
|
34804
|
+
const reply = await agent.spawn(name, role, { agent: agentType, model, cwd });
|
|
34730
34805
|
if (!reply.ok)
|
|
34731
34806
|
return err(`Couldn't spawn ${name}: ${reply.error ?? "manager refused"}`);
|
|
34732
34807
|
const d = reply.data;
|
|
@@ -34844,6 +34919,16 @@ ${info}${caught}`);
|
|
|
34844
34919
|
}
|
|
34845
34920
|
|
|
34846
34921
|
// ../connector-core/dist/control.js
|
|
34922
|
+
import { createServer } from "node:net";
|
|
34923
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
34924
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
34925
|
+
var MAX_FRAME_BYTES = 1 << 20;
|
|
34926
|
+
var AUTH_DEADLINE_MS = 5e3;
|
|
34927
|
+
function tokenMatches(presented, digest) {
|
|
34928
|
+
if (typeof presented !== "string")
|
|
34929
|
+
return false;
|
|
34930
|
+
return timingSafeEqual(createHash("sha256").update(presented).digest(), digest);
|
|
34931
|
+
}
|
|
34847
34932
|
function who(i) {
|
|
34848
34933
|
return i.fromRole ? `${i.fromName}/${i.fromRole}` : i.fromName;
|
|
34849
34934
|
}
|
|
@@ -34864,6 +34949,76 @@ function formatInjection(items) {
|
|
|
34864
34949
|
${items.map(fmtItem2).join("\n")}
|
|
34865
34950
|
${tail}`;
|
|
34866
34951
|
}
|
|
34952
|
+
function startControlServer(agent, endpoint, handle, opts = {}) {
|
|
34953
|
+
const { path } = endpoint;
|
|
34954
|
+
const digest = createHash("sha256").update(endpoint.token).digest();
|
|
34955
|
+
if (process.platform !== "win32" && existsSync(path)) {
|
|
34956
|
+
try {
|
|
34957
|
+
unlinkSync(path);
|
|
34958
|
+
} catch {
|
|
34959
|
+
}
|
|
34960
|
+
}
|
|
34961
|
+
const server = createServer((sock) => {
|
|
34962
|
+
let buf = "";
|
|
34963
|
+
let handled = false;
|
|
34964
|
+
sock.setEncoding("utf8");
|
|
34965
|
+
const deadline = setTimeout(() => sock.destroy(), AUTH_DEADLINE_MS);
|
|
34966
|
+
deadline.unref?.();
|
|
34967
|
+
sock.on("close", () => clearTimeout(deadline));
|
|
34968
|
+
sock.on("data", async (d) => {
|
|
34969
|
+
if (handled)
|
|
34970
|
+
return;
|
|
34971
|
+
buf += d;
|
|
34972
|
+
if (buf.length > MAX_FRAME_BYTES) {
|
|
34973
|
+
sock.destroy();
|
|
34974
|
+
return;
|
|
34975
|
+
}
|
|
34976
|
+
const nl = buf.indexOf("\n");
|
|
34977
|
+
if (nl < 0)
|
|
34978
|
+
return;
|
|
34979
|
+
handled = true;
|
|
34980
|
+
clearTimeout(deadline);
|
|
34981
|
+
let frame = {};
|
|
34982
|
+
try {
|
|
34983
|
+
frame = JSON.parse(buf.slice(0, nl) || "{}");
|
|
34984
|
+
} catch {
|
|
34985
|
+
}
|
|
34986
|
+
if (!tokenMatches(frame.token, digest)) {
|
|
34987
|
+
sock.destroy();
|
|
34988
|
+
return;
|
|
34989
|
+
}
|
|
34990
|
+
if (frame.op === "shutdown") {
|
|
34991
|
+
try {
|
|
34992
|
+
sock.end(JSON.stringify({ ok: true }) + "\n");
|
|
34993
|
+
} catch {
|
|
34994
|
+
}
|
|
34995
|
+
opts.onShutdown?.();
|
|
34996
|
+
return;
|
|
34997
|
+
}
|
|
34998
|
+
const ev = frame.event ?? {};
|
|
34999
|
+
const reply = await handle(agent, ev);
|
|
35000
|
+
try {
|
|
35001
|
+
sock.end(JSON.stringify(reply) + "\n");
|
|
35002
|
+
} catch {
|
|
35003
|
+
}
|
|
35004
|
+
});
|
|
35005
|
+
sock.on("error", () => {
|
|
35006
|
+
});
|
|
35007
|
+
});
|
|
35008
|
+
let bound = false;
|
|
35009
|
+
server.on("error", (e) => {
|
|
35010
|
+
process.stderr.write(`[cotal-connector] control server error: ${e.message}
|
|
35011
|
+
`);
|
|
35012
|
+
if (opts.fatalBind && !bound)
|
|
35013
|
+
process.exit(1);
|
|
35014
|
+
});
|
|
35015
|
+
server.listen(path, () => {
|
|
35016
|
+
bound = true;
|
|
35017
|
+
process.stderr.write(`[cotal-connector] control socket: ${path}
|
|
35018
|
+
`);
|
|
35019
|
+
});
|
|
35020
|
+
return server;
|
|
35021
|
+
}
|
|
34867
35022
|
|
|
34868
35023
|
// src/tools.ts
|
|
34869
35024
|
import { tool } from "@opencode-ai/plugin";
|
|
@@ -34900,7 +35055,7 @@ function log(msg) {
|
|
|
34900
35055
|
`);
|
|
34901
35056
|
}
|
|
34902
35057
|
var guard = globalThis;
|
|
34903
|
-
var cotal = async (
|
|
35058
|
+
var cotal = async () => {
|
|
34904
35059
|
if (!hasIdentity()) {
|
|
34905
35060
|
log("no COTAL_NAME \u2014 not a managed session; staying off the mesh");
|
|
34906
35061
|
return {};
|
|
@@ -34908,8 +35063,27 @@ var cotal = async ({ client }) => {
|
|
|
34908
35063
|
if (guard.__cotalOpencodeHooks) return guard.__cotalOpencodeHooks;
|
|
34909
35064
|
const config2 = configFromEnv();
|
|
34910
35065
|
config2.connector = "opencode";
|
|
35066
|
+
const serverUrl = process.env.COTAL_OPENCODE_SERVER_URL?.trim();
|
|
35067
|
+
const serverUsername = process.env.OPENCODE_SERVER_USERNAME?.trim() || "opencode";
|
|
35068
|
+
const serverPassword = process.env.OPENCODE_SERVER_PASSWORD?.trim();
|
|
35069
|
+
if (!serverUrl || !serverPassword) throw new Error("opencode connector: missing COTAL_OPENCODE_SERVER_URL/OPENCODE_SERVER_PASSWORD");
|
|
35070
|
+
const serverAuth = `Basic ${Buffer.from(`${serverUsername}:${serverPassword}`).toString("base64")}`;
|
|
34911
35071
|
const agent = new MeshAgent(config2);
|
|
34912
35072
|
agent.start();
|
|
35073
|
+
async function opencodeApi(path, init, timeoutMs = 1e4) {
|
|
35074
|
+
const res = await fetch(`${serverUrl}${path}`, {
|
|
35075
|
+
...init,
|
|
35076
|
+
signal: init?.signal ?? AbortSignal.timeout(timeoutMs),
|
|
35077
|
+
headers: {
|
|
35078
|
+
authorization: serverAuth,
|
|
35079
|
+
"content-type": "application/json",
|
|
35080
|
+
...init?.headers ?? {}
|
|
35081
|
+
}
|
|
35082
|
+
});
|
|
35083
|
+
if (!res.ok) throw new Error(`OpenCode HTTP ${res.status} ${res.statusText} for ${path}`);
|
|
35084
|
+
if (res.status === 204) return void 0;
|
|
35085
|
+
return await res.json();
|
|
35086
|
+
}
|
|
34913
35087
|
const def = process.env.COTAL_AGENT_FILE?.trim() ? loadAgentFile(process.env.COTAL_AGENT_FILE.trim()) : void 0;
|
|
34914
35088
|
const facePrompt = process.env.COTAL_FACE_PERSONA?.trim() ? 'You speak through an animated pixel-art avatar of yourself. Hard formatting rule: the text you pass to the cotal send tools (cotal_send / cotal_dm) must START with an emotion tag [[face:X]], where X is one of: neutral, happy, sad, angry, surprised \u2014 pick the one matching your mood, and insert another tag mid-text whenever your mood shifts. Example: "[[face:angry]] That race condition cost me three days. [[face:happy]] But watch it run now." Never mention or explain the tags \u2014 they are stripped before peers see your message.' : void 0;
|
|
34915
35089
|
const persona = [def?.persona, facePrompt].filter(Boolean).join("\n\n") || void 0;
|
|
@@ -34927,6 +35101,31 @@ var cotal = async ({ client }) => {
|
|
|
34927
35101
|
} catch {
|
|
34928
35102
|
}
|
|
34929
35103
|
};
|
|
35104
|
+
let controlServer;
|
|
35105
|
+
const shutdown = async () => {
|
|
35106
|
+
try {
|
|
35107
|
+
controlServer?.close();
|
|
35108
|
+
} catch {
|
|
35109
|
+
}
|
|
35110
|
+
try {
|
|
35111
|
+
await safeStatus("offline");
|
|
35112
|
+
await agent.stop();
|
|
35113
|
+
} finally {
|
|
35114
|
+
process.exit(0);
|
|
35115
|
+
}
|
|
35116
|
+
};
|
|
35117
|
+
const controlPath = process.env.COTAL_CONTROL_SOCKET?.trim();
|
|
35118
|
+
const controlToken = process.env.COTAL_CONTROL_TOKEN?.trim();
|
|
35119
|
+
if (controlPath && controlToken) {
|
|
35120
|
+
const handle = async () => ({
|
|
35121
|
+
ok: false,
|
|
35122
|
+
error: "opencode runs cotal hooks in-process; only the shutdown control op is supported"
|
|
35123
|
+
});
|
|
35124
|
+
controlServer = startControlServer(agent, { path: controlPath, token: controlToken }, handle, {
|
|
35125
|
+
fatalBind: true,
|
|
35126
|
+
onShutdown: () => void shutdown()
|
|
35127
|
+
});
|
|
35128
|
+
}
|
|
34930
35129
|
function pendingForWake() {
|
|
34931
35130
|
return agent.pendingWake();
|
|
34932
35131
|
}
|
|
@@ -34948,8 +35147,11 @@ var cotal = async ({ client }) => {
|
|
|
34948
35147
|
}
|
|
34949
35148
|
const sessionReady = (async () => {
|
|
34950
35149
|
try {
|
|
34951
|
-
const res = await
|
|
34952
|
-
|
|
35150
|
+
const res = await opencodeApi("/session", {
|
|
35151
|
+
method: "POST",
|
|
35152
|
+
body: JSON.stringify({ title: `cotal:${config2.space}:${config2.name}` })
|
|
35153
|
+
}, 1e4);
|
|
35154
|
+
const id = res.id;
|
|
34953
35155
|
if (id) {
|
|
34954
35156
|
adoptSession(id, "boot");
|
|
34955
35157
|
process.stderr.write(`[cotal-session] ${id}
|
|
@@ -34994,7 +35196,7 @@ ${ORIENTATION_BOOTSTRAP}`;
|
|
|
34994
35196
|
busy = true;
|
|
34995
35197
|
surfaced = ids;
|
|
34996
35198
|
awaitingTurnEnd = true;
|
|
34997
|
-
await
|
|
35199
|
+
await opencodeApi(`/session/${encodeURIComponent(id)}/prompt_async`, { method: "POST", body: JSON.stringify(body) }, 1e4);
|
|
34998
35200
|
primed = true;
|
|
34999
35201
|
} catch (e) {
|
|
35000
35202
|
busy = false;
|
|
@@ -35092,6 +35294,10 @@ ${ORIENTATION_BOOTSTRAP}`;
|
|
|
35092
35294
|
await safeStatus("working", input.tool);
|
|
35093
35295
|
},
|
|
35094
35296
|
dispose: async () => {
|
|
35297
|
+
try {
|
|
35298
|
+
controlServer?.close();
|
|
35299
|
+
} catch {
|
|
35300
|
+
}
|
|
35095
35301
|
await safeStatus("offline");
|
|
35096
35302
|
await agent.stop();
|
|
35097
35303
|
}
|
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":"AA+BA,OAAO,KAAK,EAAE,MAAM,EAAS,MAAM,qBAAqB,CAAC;AAazD,eAAO,MAAM,KAAK,EAAE,MAwVnB,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* • registers the cotal_* tools natively, rendered from the SHARED {@link cotalToolSpecs}
|
|
9
9
|
* (`./tools.ts`) — same surface as Claude Code, incl. channels / join / leave / channel_info;
|
|
10
10
|
* • maps OpenCode bus events to presence (idle | working | waiting | offline);
|
|
11
|
-
* • owns ONE session (created at boot) and drives it: it injects each inbox batch as a turn
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* • owns ONE session (created at boot) and drives it: it injects each inbox batch as a turn through
|
|
12
|
+
* the authenticated OpenCode server HTTP API (the same server the TUI is attached to), acking ON
|
|
13
|
+
* TURN COMPLETION (so a crash/error redelivers).
|
|
14
14
|
* Delivery is **attention-aware** (open/dnd/focus) and never interrupts a running turn — a
|
|
15
15
|
* message that arrives mid-turn waits for the turn to end (matching Claude's no-interrupt
|
|
16
16
|
* behavior), then drives.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* No identity → inert, so an operator's own `opencode` never joins as a stray peer.
|
|
20
20
|
*/
|
|
21
21
|
import { loadAgentFile } from "@cotal-ai/core";
|
|
22
|
-
import { configFromEnv, hasIdentity, MeshAgent, formatInjection, fmtFrom, ORIENTATION_BOOTSTRAP, } from "@cotal-ai/connector-core";
|
|
22
|
+
import { configFromEnv, hasIdentity, MeshAgent, startControlServer, formatInjection, fmtFrom, ORIENTATION_BOOTSTRAP, } from "@cotal-ai/connector-core";
|
|
23
23
|
import { buildCotalTools } from "./tools.js";
|
|
24
24
|
function log(msg) {
|
|
25
25
|
process.stderr.write(`[cotal-connector] ${msg}\n`);
|
|
@@ -29,7 +29,7 @@ function log(msg) {
|
|
|
29
29
|
* call wires up the agent, and every call returns the *same* hooks (the same tools, bound to that
|
|
30
30
|
* one agent), whichever scope opencode ends up using. */
|
|
31
31
|
const guard = globalThis;
|
|
32
|
-
export const cotal = async (
|
|
32
|
+
export const cotal = async () => {
|
|
33
33
|
// No identity → a plain `opencode`, not a launcher-spawned agent. Stay inert.
|
|
34
34
|
if (!hasIdentity()) {
|
|
35
35
|
log("no COTAL_NAME — not a managed session; staying off the mesh");
|
|
@@ -39,8 +39,30 @@ export const cotal = async ({ client }) => {
|
|
|
39
39
|
return guard.__cotalOpencodeHooks; // one agent; reuse the hooks
|
|
40
40
|
const config = configFromEnv();
|
|
41
41
|
config.connector = "opencode"; // advertise the host harness on our AgentCard (meta.connector)
|
|
42
|
+
const serverUrl = process.env.COTAL_OPENCODE_SERVER_URL?.trim();
|
|
43
|
+
const serverUsername = process.env.OPENCODE_SERVER_USERNAME?.trim() || "opencode";
|
|
44
|
+
const serverPassword = process.env.OPENCODE_SERVER_PASSWORD?.trim();
|
|
45
|
+
if (!serverUrl || !serverPassword)
|
|
46
|
+
throw new Error("opencode connector: missing COTAL_OPENCODE_SERVER_URL/OPENCODE_SERVER_PASSWORD");
|
|
47
|
+
const serverAuth = `Basic ${Buffer.from(`${serverUsername}:${serverPassword}`).toString("base64")}`;
|
|
42
48
|
const agent = new MeshAgent(config);
|
|
43
49
|
agent.start(); // background connect with retry — never blocks startup
|
|
50
|
+
async function opencodeApi(path, init, timeoutMs = 10_000) {
|
|
51
|
+
const res = await fetch(`${serverUrl}${path}`, {
|
|
52
|
+
...init,
|
|
53
|
+
signal: init?.signal ?? AbortSignal.timeout(timeoutMs),
|
|
54
|
+
headers: {
|
|
55
|
+
authorization: serverAuth,
|
|
56
|
+
"content-type": "application/json",
|
|
57
|
+
...(init?.headers ?? {}),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
throw new Error(`OpenCode HTTP ${res.status} ${res.statusText} for ${path}`);
|
|
62
|
+
if (res.status === 204)
|
|
63
|
+
return undefined;
|
|
64
|
+
return (await res.json());
|
|
65
|
+
}
|
|
44
66
|
const def = process.env.COTAL_AGENT_FILE?.trim() ? loadAgentFile(process.env.COTAL_AGENT_FILE.trim()) : undefined;
|
|
45
67
|
// Face-hosted (`face:` in the agent file → the shim attaches the face viewer): teach the agent
|
|
46
68
|
// to steer its avatar's expression with inline [[face:X]] tags in the text it passes to the
|
|
@@ -67,7 +89,7 @@ export const cotal = async ({ client }) => {
|
|
|
67
89
|
let sessionID;
|
|
68
90
|
let busy = false; // a turn is running (ours via drive(), OR the human's via session.status) → don't
|
|
69
91
|
// prompt: opencode would COALESCE onto it (no reject). Released at EVERY turn end (completeTurn).
|
|
70
|
-
let driving = false; // re-entrancy guard around an in-flight
|
|
92
|
+
let driving = false; // re-entrancy guard around an in-flight server prompt
|
|
71
93
|
let primed = false; // persona is prepended to the first turn's text once
|
|
72
94
|
let briefed = false; // the boot channel briefing is prepended once, on the first turn
|
|
73
95
|
let surfaced = []; // ids surfaced into the current turn, acked on completion (by id, not count)
|
|
@@ -81,6 +103,43 @@ export const cotal = async ({ client }) => {
|
|
|
81
103
|
/* presence is best-effort — never throw into opencode */
|
|
82
104
|
}
|
|
83
105
|
};
|
|
106
|
+
// Cooperative shutdown. The manager sends an authenticated {op:"shutdown"} to this agent's local
|
|
107
|
+
// control endpoint on a signal-less runtime (ConPTY/Windows), where a hard kill would skip cleanup
|
|
108
|
+
// and leave the agent online until its presence TTL expires. We leave the mesh cleanly instead, then
|
|
109
|
+
// exit (the runtime hard-kills as a backstop). The endpoint (path + token) is minted by the
|
|
110
|
+
// connector's buildLaunch and arrives in the child env; the plugin runs inside the opencode server
|
|
111
|
+
// process, so it reads it there. Hooks are in-process (no external relay connects), so only the
|
|
112
|
+
// shutdown op is used — the handle path is inert. fatalBind: a managed agent MUST own its control
|
|
113
|
+
// endpoint, so a squatter (or a runtime that can't host the pipe) fails loud rather than running a
|
|
114
|
+
// hijacked or absent control plane.
|
|
115
|
+
let controlServer;
|
|
116
|
+
const shutdown = async () => {
|
|
117
|
+
try {
|
|
118
|
+
controlServer?.close();
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
/* ignore */
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
await safeStatus("offline");
|
|
125
|
+
await agent.stop();
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
process.exit(0);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const controlPath = process.env.COTAL_CONTROL_SOCKET?.trim();
|
|
132
|
+
const controlToken = process.env.COTAL_CONTROL_TOKEN?.trim();
|
|
133
|
+
if (controlPath && controlToken) {
|
|
134
|
+
const handle = async () => ({
|
|
135
|
+
ok: false,
|
|
136
|
+
error: "opencode runs cotal hooks in-process; only the shutdown control op is supported",
|
|
137
|
+
});
|
|
138
|
+
controlServer = startControlServer(agent, { path: controlPath, token: controlToken }, handle, {
|
|
139
|
+
fatalBind: true,
|
|
140
|
+
onShutdown: () => void shutdown(),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
84
143
|
function pendingForWake() {
|
|
85
144
|
return agent.pendingWake(); // mode-and-channel-aware: excludes held dnd/quiet ambient
|
|
86
145
|
}
|
|
@@ -108,8 +167,11 @@ export const cotal = async ({ client }) => {
|
|
|
108
167
|
* can't be picked. Awaited by ensureSession before the first drive. */
|
|
109
168
|
const sessionReady = (async () => {
|
|
110
169
|
try {
|
|
111
|
-
const res = await
|
|
112
|
-
|
|
170
|
+
const res = await opencodeApi("/session", {
|
|
171
|
+
method: "POST",
|
|
172
|
+
body: JSON.stringify({ title: `cotal:${config.space}:${config.name}` }),
|
|
173
|
+
}, 10_000);
|
|
174
|
+
const id = res.id;
|
|
113
175
|
if (id) {
|
|
114
176
|
adoptSession(id, "boot");
|
|
115
177
|
process.stderr.write(`[cotal-session] ${id}\n`);
|
|
@@ -127,7 +189,7 @@ export const cotal = async ({ client }) => {
|
|
|
127
189
|
return sessionID ?? (await sessionReady);
|
|
128
190
|
}
|
|
129
191
|
/** Drive a turn carrying the current inbox batch (and the boot briefing once) into the visible
|
|
130
|
-
* session via the
|
|
192
|
+
* session via the server API — server-side, so it can't race like the TUI input box, and the TUI
|
|
131
193
|
* renders it live (it subscribes to that session's events). Surfaces the items but does NOT ack
|
|
132
194
|
* them — ackSurfaced runs on turn completion, so a crash/error redelivers. `override` replaces
|
|
133
195
|
* the body (a bare nudge, e.g. a focus @mention pull) and surfaces nothing to ack. Self-guards
|
|
@@ -171,10 +233,10 @@ export const cotal = async ({ client }) => {
|
|
|
171
233
|
body.system = `${persona}\n\n${ORIENTATION_BOOTSTRAP}`;
|
|
172
234
|
busy = true;
|
|
173
235
|
surfaced = ids;
|
|
174
|
-
// Arm BEFORE the await: a turn-end signal can land before
|
|
236
|
+
// Arm BEFORE the await: a turn-end signal can land before the server request resolves, and
|
|
175
237
|
// completeTurn bails unless armed — arming after would drop it and wedge the agent.
|
|
176
238
|
awaitingTurnEnd = true;
|
|
177
|
-
await
|
|
239
|
+
await opencodeApi(`/session/${encodeURIComponent(id)}/prompt_async`, { method: "POST", body: JSON.stringify(body) }, 10_000);
|
|
178
240
|
primed = true;
|
|
179
241
|
}
|
|
180
242
|
catch (e) {
|
|
@@ -325,6 +387,12 @@ export const cotal = async ({ client }) => {
|
|
|
325
387
|
await safeStatus("working", input.tool);
|
|
326
388
|
},
|
|
327
389
|
dispose: async () => {
|
|
390
|
+
try {
|
|
391
|
+
controlServer?.close();
|
|
392
|
+
}
|
|
393
|
+
catch {
|
|
394
|
+
/* ignore */
|
|
395
|
+
}
|
|
328
396
|
await safeStatus("offline");
|
|
329
397
|
await agent.stop();
|
|
330
398
|
},
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,aAAa,EAAuB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EACL,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,qBAAqB,GAEtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,SAAS,GAAG,CAAC,GA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AAC,CAAC,CAAC,UAAU,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC3H,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/dist/serve.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 2. poke it once so the lazily-loaded plugin initializes (joins the mesh, creates ONE session);
|
|
7
7
|
* 3. the plugin announces that session's id on stderr (`[cotal-session] <id>`);
|
|
8
8
|
* 4. launch a foreground `opencode attach <url> --session <id>` — the TUI opens straight onto the
|
|
9
|
-
* agent's session, and every turn the plugin drives
|
|
9
|
+
* agent's session, and every turn the plugin drives through this exact server renders live.
|
|
10
10
|
*
|
|
11
11
|
* The attach TUI is a pure viewer (it connects to the running server); its env strips the plugin
|
|
12
12
|
* config + COTAL_* so it never loads a *second* mesh endpoint.
|
|
@@ -22,8 +22,30 @@ import { createServer } from "node:net";
|
|
|
22
22
|
import { once } from "node:events";
|
|
23
23
|
import { randomBytes } from "node:crypto";
|
|
24
24
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
25
|
-
import { join } from "node:path";
|
|
26
|
-
|
|
25
|
+
import { delimiter, join } from "node:path";
|
|
26
|
+
/** The opencode binary to spawn. `COTAL_OPENCODE_BIN` overrides. On Windows, `opencode` on PATH is
|
|
27
|
+
* an npm `.cmd` shim that child_process can't spawn, and the real `opencode.exe` it wraps
|
|
28
|
+
* (`<bindir>/node_modules/opencode-ai/bin/opencode.exe`) isn't itself on PATH — resolve and spawn
|
|
29
|
+
* it directly, so there's no `cmd.exe` wrapper to orphan the server on kill. POSIX spawns the name
|
|
30
|
+
* as-is. Unresolved on Windows → returns the bare name so spawn fails with a clear ENOENT. */
|
|
31
|
+
function resolveOpencodeBin() {
|
|
32
|
+
const override = process.env.COTAL_OPENCODE_BIN?.trim();
|
|
33
|
+
if (override)
|
|
34
|
+
return override;
|
|
35
|
+
if (process.platform !== "win32")
|
|
36
|
+
return "opencode";
|
|
37
|
+
for (const dir of (process.env.PATH ?? "").split(delimiter)) {
|
|
38
|
+
if (!dir)
|
|
39
|
+
continue;
|
|
40
|
+
for (const exe of [join(dir, "opencode.exe"), join(dir, "node_modules", "opencode-ai", "bin", "opencode.exe")]) {
|
|
41
|
+
if (existsSync(exe))
|
|
42
|
+
return exe;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return "opencode";
|
|
46
|
+
}
|
|
47
|
+
const BIN = resolveOpencodeBin();
|
|
48
|
+
const USERNAME = "opencode";
|
|
27
49
|
/** Per-launch secret gating the spawned server's HTTP API (see SECURITY above). */
|
|
28
50
|
const SECRET = randomBytes(24).toString("hex");
|
|
29
51
|
/** Ask the OS for a free port (bind :0, read it, release) so co-located peers don't collide. */
|
|
@@ -56,7 +78,13 @@ async function main() {
|
|
|
56
78
|
// Own SQLite DB per agent: opencode auth/config stay on the operator's normal HOME/XDG roots,
|
|
57
79
|
// while sessions avoid the global DB write lock that stalls concurrent `opencode serve`s.
|
|
58
80
|
const name = process.env.COTAL_NAME?.trim() || "agent";
|
|
59
|
-
|
|
81
|
+
// Data root the connector pins (the manager's workspace, or the launch dir for standalone spawn) —
|
|
82
|
+
// NOT process.cwd(), which the manager can point at any repo per-agent. Fail loud if it's missing
|
|
83
|
+
// rather than silently scattering the DB/pidfile into the launch cwd.
|
|
84
|
+
const dataRoot = process.env.COTAL_OPENCODE_HOME?.trim();
|
|
85
|
+
if (!dataRoot)
|
|
86
|
+
throw new Error("COTAL_OPENCODE_HOME is not set — the connector must pin the agent's data root");
|
|
87
|
+
const agentHome = join(dataRoot, ".cotal", "opencode", name);
|
|
60
88
|
const dbPath = join(agentHome, "opencode.db");
|
|
61
89
|
// Two serves on one agent DB share the SQLite file and stall each other — refuse up front.
|
|
62
90
|
const pidFile = join(agentHome, "serve.pid");
|
|
@@ -76,7 +104,13 @@ async function main() {
|
|
|
76
104
|
}
|
|
77
105
|
mkdirSync(agentHome, { recursive: true });
|
|
78
106
|
const serve = spawn(BIN, ["serve", "--hostname", "127.0.0.1", "--port", port], {
|
|
79
|
-
env: {
|
|
107
|
+
env: {
|
|
108
|
+
...process.env,
|
|
109
|
+
COTAL_OPENCODE_SERVER_URL: url,
|
|
110
|
+
OPENCODE_SERVER_USERNAME: USERNAME,
|
|
111
|
+
OPENCODE_SERVER_PASSWORD: SECRET,
|
|
112
|
+
OPENCODE_DB: dbPath,
|
|
113
|
+
},
|
|
80
114
|
stdio: ["ignore", "pipe", "pipe"],
|
|
81
115
|
});
|
|
82
116
|
writeFileSync(pidFile, String(serve.pid));
|
|
@@ -109,7 +143,7 @@ async function main() {
|
|
|
109
143
|
// bootstrap that loads the plugin. Each poke carries its own abort timeout: a request that
|
|
110
144
|
// lands in the early-boot window can hang with no response, and an un-timed fetch would pin
|
|
111
145
|
// the loop on it forever (undici queues later requests behind it on the pooled connection).
|
|
112
|
-
const auth = `Basic ${Buffer.from(
|
|
146
|
+
const auth = `Basic ${Buffer.from(`${USERNAME}:${SECRET}`).toString("base64")}`;
|
|
113
147
|
void (async () => {
|
|
114
148
|
for (let i = 0; i < 300 && !sessionId; i++) {
|
|
115
149
|
try {
|
|
@@ -135,6 +169,7 @@ async function main() {
|
|
|
135
169
|
}
|
|
136
170
|
const tuiEnv = {
|
|
137
171
|
...process.env,
|
|
172
|
+
OPENCODE_SERVER_USERNAME: USERNAME,
|
|
138
173
|
OPENCODE_SERVER_PASSWORD: SECRET,
|
|
139
174
|
OPENCODE_DB: dbPath,
|
|
140
175
|
};
|
package/dist/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa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al connector for OpenCode: a native in-process plugin that joins a session to the mesh.",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@cotal-ai/connector-core": "0.8.
|
|
21
|
+
"@cotal-ai/connector-core": "0.8.2"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@cotal-ai/core": ">=0.1.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@opencode-ai/sdk": "^1.16.2",
|
|
31
31
|
"esbuild": "^0.28.0",
|
|
32
32
|
"tsx": "^4.22.4",
|
|
33
|
-
"@cotal-ai/core": "0.8.
|
|
33
|
+
"@cotal-ai/core": "0.8.2"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist"
|