cotal-ai 0.166.0 → 0.166.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/daemon/client.js +11 -1
- package/dist/daemon/command.js +38 -10
- package/dist/daemon/connect.js +1 -1
- package/dist/daemon/endpoint.js +9 -2
- package/dist/daemon/execution-update.js +1 -1
- package/dist/daemon/generation.js +3 -4
- package/dist/daemon/install.js +115 -15
- package/dist/daemon/manager-cleanup.js +1 -6
- package/dist/daemon/protocol.js +2 -2
- package/dist/daemon/server.js +1 -1
- package/dist/daemon/service.js +1 -1
- package/dist/daemon/update-entry.js +45 -6
- package/dist/daemon/update-generation.js +4 -2
- package/dist/docs.js +1 -1
- package/dist/execution-transaction.js +21 -0
- package/dist/mcp-host.js +116 -0
- package/dist/mcp.js +64 -0
- package/dist/run.js +2 -0
- package/package.json +19 -19
- package/seeded-connectors/_shared/docs-bundle.bin +0 -0
- package/seeded-connectors/_shared/docs-index.bin +0 -0
- package/seeded-connectors/_shared/placements.json +2 -2
- package/seeded-connectors/claude/dist/index.js +2 -2
- package/seeded-connectors/claude/dist/mcp.cjs +6 -6
- package/seeded-connectors/claude/package.json +1 -1
- package/seeded-connectors/codex/dist/host.js +6 -6
- package/seeded-connectors/codex/dist/index.js +2 -2
- package/seeded-connectors/codex/dist/personal.js +6 -6
- package/seeded-connectors/codex/package.json +1 -1
- package/seeded-connectors/hermes/dist/index.js +2 -2
- package/seeded-connectors/hermes/dist/launch.js +6 -6
- package/seeded-connectors/hermes/package.json +1 -1
- package/seeded-connectors/hermes/plugin/cotal/_sidecar/standalone.cjs +6 -6
- package/seeded-connectors/jcode/dist/host.js +6 -6
- package/seeded-connectors/jcode/dist/index.js +2 -2
- package/seeded-connectors/jcode/dist/mcp.js +2 -2
- package/seeded-connectors/jcode/package.json +1 -1
- package/seeded-connectors/opencode/dist/index.js +2 -2
- package/seeded-connectors/opencode/dist/plugin/index.js +6 -6
- package/seeded-connectors/opencode/package.json +1 -1
- package/seeded-connectors/pi/README.md +8 -4
- package/seeded-connectors/pi/dist/driver.d.ts +2 -0
- package/seeded-connectors/pi/dist/driver.d.ts.map +1 -1
- package/seeded-connectors/pi/dist/index.js +6 -6
- package/seeded-connectors/pi/dist/standalone.js +9 -9
- package/seeded-connectors/pi/package.json +1 -1
- package/seeded-connectors/web/dist/service-adapter.d.ts.map +1 -1
- package/seeded-connectors/web/dist/service-adapter.js +16 -12
- package/seeded-connectors/web/dist/service-adapter.js.map +1 -1
- package/seeded-connectors/web/dist/web.d.ts +7 -1
- package/seeded-connectors/web/dist/web.d.ts.map +1 -1
- package/seeded-connectors/web/dist/web.js +15 -7
- package/seeded-connectors/web/dist/web.js.map +1 -1
- package/seeded-connectors/web/package.json +1 -1
|
@@ -111,6 +111,27 @@ export function executionStagingPrefix(installed) {
|
|
|
111
111
|
protectedExecutionEntry(store);
|
|
112
112
|
return mkdtempSync(join(store, ".installing-"));
|
|
113
113
|
}
|
|
114
|
+
/** Rebind only the already selected launch route after our own mode-only hardening. */
|
|
115
|
+
export function repairExecutionInstallModes(installed, repair) {
|
|
116
|
+
const selected = selectExecutionProgram(installed);
|
|
117
|
+
const descriptor = selected.retained ? executionRecord(executionDescriptorPath(installed)) : undefined;
|
|
118
|
+
const changed = repair();
|
|
119
|
+
if (descriptor?.launch) {
|
|
120
|
+
const launch = executionLaunchBinding(installed, descriptor.launch.entry);
|
|
121
|
+
const { ctime: before, ...previous } = descriptor.launch;
|
|
122
|
+
const { ctime: after, ...current } = launch;
|
|
123
|
+
if (JSON.stringify(previous) !== JSON.stringify(current))
|
|
124
|
+
throw new Error("execution launch route changed during permission repair");
|
|
125
|
+
if (before !== after) {
|
|
126
|
+
if (!changed)
|
|
127
|
+
throw new Error("execution launch route changed without a permission repair");
|
|
128
|
+
writeExecutionDescriptor(installed, { ...descriptor, launch });
|
|
129
|
+
}
|
|
130
|
+
if (selectExecutionProgram(installed).root !== selected.root)
|
|
131
|
+
throw new Error("selected execution changed during permission repair");
|
|
132
|
+
}
|
|
133
|
+
return changed;
|
|
134
|
+
}
|
|
114
135
|
/** Remove a superseded active descriptor after an in-place package-manager install took over. */
|
|
115
136
|
export function retireSupersededExecutionDescriptor(installed) {
|
|
116
137
|
if (existsSync(join(installed, "desktop-runtime.json")) || (process.platform !== "linux" && process.platform !== "darwin"))
|
package/dist/mcp-host.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** Identity custody for an MCP-only host. One stdio process owns one local mesh connection. */
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { configFromEnv, MeshAgent, NameTaken, } from "@cotal-ai/connector-core";
|
|
5
|
+
import { resolveTargetOrThrow } from "@cotal-ai/workspace";
|
|
6
|
+
import { selfArgv } from "@cotal-ai/cli/self-exec";
|
|
7
|
+
/** The host never invents a native conversation for a signed-in space. Static identities use the
|
|
8
|
+
* terminal-seat contract: the credential and generation last to its horizon, without renewal. */
|
|
9
|
+
export function createMcpHost(space) {
|
|
10
|
+
const session = `mcp-${randomUUID()}`;
|
|
11
|
+
const account = "stdio";
|
|
12
|
+
const cotal = selfArgv();
|
|
13
|
+
let held;
|
|
14
|
+
let ending = false;
|
|
15
|
+
let operations = Promise.resolve();
|
|
16
|
+
const serial = (fn) => {
|
|
17
|
+
const next = operations.then(fn);
|
|
18
|
+
operations = next.catch(() => { });
|
|
19
|
+
return next;
|
|
20
|
+
};
|
|
21
|
+
const plumbing = (args) => new Promise((resolve, reject) => {
|
|
22
|
+
execFile(cotal[0], [...cotal.slice(1), "app-identity", ...args], { timeout: 60_000 }, (_error, stdout) => {
|
|
23
|
+
try {
|
|
24
|
+
resolve(JSON.parse(stdout));
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
reject(new Error("the CLI returned no identity result; any recovery record was retained"));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
const release = async () => {
|
|
32
|
+
if (!held)
|
|
33
|
+
return;
|
|
34
|
+
// A failed retirement remains owned, but may never route another tool to a stopped agent.
|
|
35
|
+
held.stopped = true;
|
|
36
|
+
await held.connection?.agent.stop();
|
|
37
|
+
const result = await plumbing(["retire", "--dir", held.dir]);
|
|
38
|
+
if (!result.ok)
|
|
39
|
+
throw new Error("identity cleanup is unfinished; call cotal_disconnect again to retry it");
|
|
40
|
+
held = undefined;
|
|
41
|
+
};
|
|
42
|
+
const open = async (name, selection) => {
|
|
43
|
+
if (ending)
|
|
44
|
+
throw new Error("the MCP host is shutting down");
|
|
45
|
+
if (held && !held.stopped)
|
|
46
|
+
throw new Error("this stdio host already has a connection; disconnect it before connecting again");
|
|
47
|
+
await release();
|
|
48
|
+
const target = await resolveTargetOrThrow(space === undefined ? {} : { space });
|
|
49
|
+
if (target.mode === "user")
|
|
50
|
+
throw new Error("cotal mcp has no native conversation identity for a signed-in space; use its hosted connector or a native Cotal connector instead");
|
|
51
|
+
const result = await plumbing(["provision", "--name", name, "--space", target.space, "--session", session,
|
|
52
|
+
...(selection ? ["--selection", JSON.stringify(selection)] : [])]);
|
|
53
|
+
if (!result.ok) {
|
|
54
|
+
if (result.taken)
|
|
55
|
+
throw new NameTaken(name);
|
|
56
|
+
throw new Error(result.error ?? "identity provisioning failed");
|
|
57
|
+
}
|
|
58
|
+
if (!result.retire?.dir)
|
|
59
|
+
throw new Error("the CLI returned no identity retirement handle");
|
|
60
|
+
held = { dir: result.retire.dir, stopped: false };
|
|
61
|
+
try {
|
|
62
|
+
// Inherited launch metadata must never override the identity just issued for this host.
|
|
63
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith("COTAL_")));
|
|
64
|
+
Object.assign(env, result.env);
|
|
65
|
+
const config = configFromEnv(env);
|
|
66
|
+
config.connector = "mcp";
|
|
67
|
+
config.turnRelay = false;
|
|
68
|
+
const agent = new MeshAgent(config, env, { withholdProcessCwd: true });
|
|
69
|
+
const connection = { id: randomUUID(), agent, config };
|
|
70
|
+
held.connection = connection;
|
|
71
|
+
agent.on("error", () => process.stderr.write("[cotal mcp] connection error; inspect cotal_connection_status\n"));
|
|
72
|
+
// Keep the startup promise observed even when the bounded readiness wait fails first.
|
|
73
|
+
const start = agent.start();
|
|
74
|
+
void start.catch(() => { });
|
|
75
|
+
await agent.waitUntilConnected(20_000);
|
|
76
|
+
await start;
|
|
77
|
+
if (ending)
|
|
78
|
+
throw new Error("the MCP host is shutting down");
|
|
79
|
+
return connection;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
try {
|
|
83
|
+
await release();
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new Error("connection startup failed and identity cleanup is unfinished; connect again to retry cleanup");
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
account: () => account,
|
|
93
|
+
open: (caller, name, _context, selection) => serial(async () => {
|
|
94
|
+
if (caller !== account)
|
|
95
|
+
throw new Error("this connection belongs to another account");
|
|
96
|
+
return open(name, selection);
|
|
97
|
+
}),
|
|
98
|
+
async find(caller, id) {
|
|
99
|
+
if (caller !== account || held?.connection?.id !== id)
|
|
100
|
+
return undefined;
|
|
101
|
+
if (held.stopped || ending)
|
|
102
|
+
throw new Error("this connection stopped serving; disconnect to finish its identity cleanup");
|
|
103
|
+
return held.connection;
|
|
104
|
+
},
|
|
105
|
+
close: (caller, id) => serial(async () => {
|
|
106
|
+
if (caller !== account || held?.connection?.id !== id)
|
|
107
|
+
return false;
|
|
108
|
+
await release();
|
|
109
|
+
return true;
|
|
110
|
+
}),
|
|
111
|
+
closeAll() {
|
|
112
|
+
ending = true;
|
|
113
|
+
return serial(release);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Stock stdio MCP entry point, composed here so the CLI implementation stays adapter-independent. */
|
|
2
|
+
import { registry } from "@cotal-ai/core";
|
|
3
|
+
import { CommandFailure } from "@cotal-ai/workspace";
|
|
4
|
+
import { ownStdoutErrors } from "@cotal-ai/cli/dispatch";
|
|
5
|
+
const flags = [
|
|
6
|
+
{ name: "space", type: "string", value: "<name>", description: "the registered local space to connect to" },
|
|
7
|
+
];
|
|
8
|
+
const command = {
|
|
9
|
+
kind: "command",
|
|
10
|
+
name: "mcp",
|
|
11
|
+
group: "Agents",
|
|
12
|
+
summary: "serve Cotal tools over stdio for an MCP-only host",
|
|
13
|
+
usage: "cotal mcp [--space <name>]",
|
|
14
|
+
flags,
|
|
15
|
+
validate(args) {
|
|
16
|
+
if (args.positionals.length || (args.values.space !== undefined && !String(args.values.space).trim()))
|
|
17
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "usage: cotal mcp [--space <name>]");
|
|
18
|
+
},
|
|
19
|
+
async run(args) {
|
|
20
|
+
const { serveGatewayStdio } = await import("@cotal-ai/connector-core");
|
|
21
|
+
const { createMcpHost } = await import("./mcp-host.js");
|
|
22
|
+
const host = createMcpHost(args.values.space);
|
|
23
|
+
let served;
|
|
24
|
+
let ending;
|
|
25
|
+
let finish;
|
|
26
|
+
const done = new Promise((resolve) => { finish = resolve; });
|
|
27
|
+
const end = () => ending ??= (async () => {
|
|
28
|
+
try {
|
|
29
|
+
await host.closeAll();
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
process.stderr.write("[cotal mcp] identity cleanup is unfinished; recovery records were retained\n");
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
await served?.close();
|
|
37
|
+
finish();
|
|
38
|
+
}
|
|
39
|
+
})();
|
|
40
|
+
const onEnd = () => { void end(); };
|
|
41
|
+
const releaseOutput = ownStdoutErrors(onEnd);
|
|
42
|
+
process.stdin.once("end", onEnd);
|
|
43
|
+
process.stdin.once("close", onEnd);
|
|
44
|
+
process.on("SIGINT", onEnd);
|
|
45
|
+
process.on("SIGTERM", onEnd);
|
|
46
|
+
try {
|
|
47
|
+
served = await serveGatewayStdio(host, { source: "mcp", selection: true });
|
|
48
|
+
if (ending)
|
|
49
|
+
await served.close();
|
|
50
|
+
if (process.stdin.readableEnded || process.stdin.destroyed)
|
|
51
|
+
onEnd();
|
|
52
|
+
await done;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
await end();
|
|
56
|
+
process.stdin.off("end", onEnd);
|
|
57
|
+
process.stdin.off("close", onEnd);
|
|
58
|
+
process.off("SIGINT", onEnd);
|
|
59
|
+
process.off("SIGTERM", onEnd);
|
|
60
|
+
releaseOutput();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
registry.register(command);
|
package/dist/run.js
CHANGED
|
@@ -24,6 +24,7 @@ const surfaces = {
|
|
|
24
24
|
runtime: () => import("@cotal-ai/runtime"), // `run` — the workflow-run operator surface (start/resume/ps/journal/answer)
|
|
25
25
|
auth: () => import("@cotal-ai/auth"), // login / logout — per-user IdP sessions (device-code sign-in)
|
|
26
26
|
docs: () => import("./docs.js"), // `docs`; the docs bundle loads only when `docs` runs
|
|
27
|
+
mcp: () => import("./mcp.js"), // stock stdio gateway for hosts without a native connector
|
|
27
28
|
daemon: () => import("./daemon/command.js"), // `daemon`: the local machine daemon's authenticated control endpoint (Linux)
|
|
28
29
|
// The `ag-ui.frame` part renderer, so `cotal console` and `cotal join` draw an event frame instead
|
|
29
30
|
// of `[unrenderable part kind "ag-ui.frame"]`.
|
|
@@ -55,6 +56,7 @@ registry.provide({ provides: commands("auth-service", "__daemon-auth-service", "
|
|
|
55
56
|
registry.provide({ provides: [{ kind: "registry-service", name: "builtin" }], load: () => import("@cotal-ai/registry") });
|
|
56
57
|
registry.provide({ provides: commands("__service-unit"), load: () => import("@cotal-ai/cli/service-unit") });
|
|
57
58
|
registry.provide({ provides: commands("daemon"), load: importing("daemon", "auth") });
|
|
59
|
+
registry.provide({ provides: commands("mcp"), load: importing("mcp") });
|
|
58
60
|
// The dispatch module reads the command word as `runCli` will, and loads no command. A word a
|
|
59
61
|
// provider declares imports that provider's surfaces; any other word imports them all.
|
|
60
62
|
const { commandWord, completeFileWrites, runCli, stdoutError } = await import("@cotal-ai/cli/dispatch");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cotal-ai",
|
|
3
|
-
"version": "0.166.
|
|
3
|
+
"version": "0.166.1",
|
|
4
4
|
"description": "Cotal — lateral agent coordination over NATS. Run `npx cotal-ai` for the CLI.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -37,28 +37,28 @@
|
|
|
37
37
|
"node": ">=22.10"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cotal-ai/auth": "0.166.
|
|
41
|
-
"@cotal-ai/cli": "0.166.
|
|
42
|
-
"@cotal-ai/connector-core": "0.166.
|
|
43
|
-
"@cotal-ai/core": "0.166.
|
|
44
|
-
"@cotal-ai/delivery": "0.166.
|
|
45
|
-
"@cotal-ai/manager": "0.166.
|
|
46
|
-
"@cotal-ai/registry": "0.166.
|
|
47
|
-
"@cotal-ai/runtime": "0.166.
|
|
48
|
-
"@cotal-ai/seat": "0.166.
|
|
49
|
-
"@cotal-ai/workspace": "0.166.
|
|
40
|
+
"@cotal-ai/auth": "0.166.1",
|
|
41
|
+
"@cotal-ai/cli": "0.166.1",
|
|
42
|
+
"@cotal-ai/connector-core": "0.166.1",
|
|
43
|
+
"@cotal-ai/core": "0.166.1",
|
|
44
|
+
"@cotal-ai/delivery": "0.166.1",
|
|
45
|
+
"@cotal-ai/manager": "0.166.1",
|
|
46
|
+
"@cotal-ai/registry": "0.166.1",
|
|
47
|
+
"@cotal-ai/runtime": "0.166.1",
|
|
48
|
+
"@cotal-ai/seat": "0.166.1",
|
|
49
|
+
"@cotal-ai/workspace": "0.166.1",
|
|
50
50
|
"jose": "^6.2.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@cotal-ai/connector-claude-code": "0.166.
|
|
54
|
-
"@cotal-ai/connector-codex": "0.166.
|
|
55
|
-
"@cotal-ai/connector-hermes": "0.166.
|
|
56
|
-
"@cotal-ai/connector-jcode": "0.166.
|
|
57
|
-
"@cotal-ai/connector-opencode": "0.166.
|
|
58
|
-
"@cotal-ai/linear": "0.166.
|
|
59
|
-
"@cotal-ai/pi": "0.166.
|
|
53
|
+
"@cotal-ai/connector-claude-code": "0.166.1",
|
|
54
|
+
"@cotal-ai/connector-codex": "0.166.1",
|
|
55
|
+
"@cotal-ai/connector-hermes": "0.166.1",
|
|
56
|
+
"@cotal-ai/connector-jcode": "0.166.1",
|
|
57
|
+
"@cotal-ai/connector-opencode": "0.166.1",
|
|
58
|
+
"@cotal-ai/linear": "0.166.1",
|
|
59
|
+
"@cotal-ai/pi": "0.166.1",
|
|
60
60
|
"@cotal-ai/smoke-kit": "0.0.0",
|
|
61
|
-
"@cotal-ai/web": "0.166.
|
|
61
|
+
"@cotal-ai/web": "0.166.1",
|
|
62
62
|
"@nats-io/jetstream": "3.4.0",
|
|
63
63
|
"@nats-io/transport-node": "3.4.0",
|
|
64
64
|
"typescript": "^5.9.3"
|
|
Binary file
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"v": 1,
|
|
3
3
|
"files": {
|
|
4
|
-
"docs-bundle.bin": "
|
|
5
|
-
"docs-index.bin": "
|
|
4
|
+
"docs-bundle.bin": "285ae6b1d8c6705a77c6bab13234fe269b94b309862fdfd33b697e7adbe9c68b",
|
|
5
|
+
"docs-index.bin": "e45c7db4dedb68ca9e8cca79ffe309eb2c8f52df12193fa1f9725ca2c437b1d1"
|
|
6
6
|
},
|
|
7
7
|
"placements": {
|
|
8
8
|
"claude": [
|