cotal-ai 0.171.1 → 0.171.3

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.
Files changed (68) hide show
  1. package/dist/cotal-program.js +33 -1
  2. package/dist/cotal.js +2 -1
  3. package/dist/daemon/command.js +21 -9
  4. package/dist/daemon/connect.js +2 -3
  5. package/dist/daemon/guidance.js +12 -1
  6. package/dist/daemon/server.js +30 -2
  7. package/dist/daemon/setup.js +4 -1
  8. package/dist/daemon/update-entry.js +14 -4
  9. package/dist/mcp-host.js +6 -2
  10. package/dist/run.js +0 -7
  11. package/dist/update-notice.js +2 -1
  12. package/package.json +23 -20
  13. package/scripts/pin-npm-node.mjs +39 -0
  14. package/seeded-connectors/_shared/docs-bundle.bin +0 -0
  15. package/seeded-connectors/_shared/docs-index.bin +0 -0
  16. package/seeded-connectors/_shared/placements.json +2 -2
  17. package/seeded-connectors/claude/dist/agui-map.d.ts +2 -0
  18. package/seeded-connectors/claude/dist/agui-map.d.ts.map +1 -1
  19. package/seeded-connectors/claude/dist/extension.d.ts.map +1 -1
  20. package/seeded-connectors/claude/dist/hook.cjs +2 -2
  21. package/seeded-connectors/claude/dist/hooks.d.ts.map +1 -1
  22. package/seeded-connectors/claude/dist/index.js +4 -4
  23. package/seeded-connectors/claude/dist/interrupt-watch.d.ts +13 -0
  24. package/seeded-connectors/claude/dist/interrupt-watch.d.ts.map +1 -0
  25. package/seeded-connectors/claude/dist/mcp.cjs +23 -21
  26. package/seeded-connectors/claude/package.json +1 -1
  27. package/seeded-connectors/codex/dist/extension.d.ts.map +1 -1
  28. package/seeded-connectors/codex/dist/host.js +15 -15
  29. package/seeded-connectors/codex/dist/index.js +4 -4
  30. package/seeded-connectors/codex/dist/personal.js +16 -14
  31. package/seeded-connectors/codex/package.json +1 -1
  32. package/seeded-connectors/hermes/dist/extension.d.ts.map +1 -1
  33. package/seeded-connectors/hermes/dist/index.js +5 -5
  34. package/seeded-connectors/hermes/dist/launch.d.ts.map +1 -1
  35. package/seeded-connectors/hermes/dist/launch.js +12 -12
  36. package/seeded-connectors/hermes/package.json +1 -1
  37. package/seeded-connectors/hermes/plugin/cotal/_sidecar/standalone.cjs +13 -13
  38. package/seeded-connectors/jcode/dist/extension.d.ts.map +1 -1
  39. package/seeded-connectors/jcode/dist/host.js +14 -14
  40. package/seeded-connectors/jcode/dist/index.js +4 -4
  41. package/seeded-connectors/jcode/dist/mcp.js +6 -6
  42. package/seeded-connectors/jcode/package.json +1 -1
  43. package/seeded-connectors/opencode/dist/extension.d.ts.map +1 -1
  44. package/seeded-connectors/opencode/dist/index.js +4 -4
  45. package/seeded-connectors/opencode/dist/launch.d.ts.map +1 -1
  46. package/seeded-connectors/opencode/dist/launch.js +2 -2
  47. package/seeded-connectors/opencode/dist/plugin/index.js +16 -16
  48. package/seeded-connectors/opencode/dist/serve.js +2 -2
  49. package/seeded-connectors/opencode/package.json +1 -1
  50. package/seeded-connectors/pi/dist/agui-map.d.ts.map +1 -1
  51. package/seeded-connectors/pi/dist/connector.d.ts.map +1 -1
  52. package/seeded-connectors/pi/dist/driver.d.ts.map +1 -1
  53. package/seeded-connectors/pi/dist/index.js +7 -7
  54. package/seeded-connectors/pi/dist/standalone.js +15 -15
  55. package/seeded-connectors/pi/package.json +1 -1
  56. package/seeded-connectors/web/dist/web-post.d.ts +87 -0
  57. package/seeded-connectors/web/dist/web-post.d.ts.map +1 -0
  58. package/seeded-connectors/web/dist/web-post.js +171 -0
  59. package/seeded-connectors/web/dist/web-post.js.map +1 -0
  60. package/seeded-connectors/web/dist/web-read.d.ts +306 -0
  61. package/seeded-connectors/web/dist/web-read.d.ts.map +1 -0
  62. package/seeded-connectors/web/dist/web-read.js +471 -0
  63. package/seeded-connectors/web/dist/web-read.js.map +1 -0
  64. package/seeded-connectors/web/dist/web.d.ts +3 -374
  65. package/seeded-connectors/web/dist/web.d.ts.map +1 -1
  66. package/seeded-connectors/web/dist/web.js +8 -632
  67. package/seeded-connectors/web/dist/web.js.map +1 -1
  68. package/seeded-connectors/web/package.json +1 -1
@@ -1,7 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  /** The generation-local Node preflight and CLI entry. Reached through the built-ins bootstrap. */
3
+ import { dirname, isAbsolute } from "node:path";
3
4
  import { setFlagsFromString } from "node:v8";
4
5
  import { ensureSupportedNode } from "./cotal.js";
6
+ // The updater probes this form. Leave usage and invalid-home diagnostics to the dispatcher.
7
+ async function runVersionFlag() {
8
+ if (process.argv.length !== 3 || (process.argv[2] !== "--version" && process.argv[2] !== "-V"))
9
+ return false;
10
+ const { c, cotalHomeProblem, stderrLine } = await import("@cotal-ai/workspace");
11
+ const home = process.env.COTAL_HOME;
12
+ if ((home && !isAbsolute(home)) || cotalHomeProblem())
13
+ return false;
14
+ const { completeFileWrites, stdoutError } = await import("@cotal-ai/cli/dispatch");
15
+ const { cliVersion, printVersion, readExtensionVersions } = await import("@cotal-ai/cli/version");
16
+ (await import("./update-notice.js")).installUpdateNotice(process.argv.slice(2), cliVersion());
17
+ const inventory = readExtensionVersions();
18
+ if (inventory.unreadable !== undefined) {
19
+ stderrLine("✗ ", inventory.unreadable, c.red);
20
+ process.exitCode = 1;
21
+ }
22
+ else {
23
+ process.stdout.on("error", stdoutError);
24
+ completeFileWrites();
25
+ await (await import("./startup-interrupt.js")).releaseStartupInterrupt();
26
+ printVersion(inventory.versions);
27
+ }
28
+ return true;
29
+ }
5
30
  ensureSupportedNode();
6
31
  setFlagsFromString("--no-maglev");
7
32
  setFlagsFromString("--no-concurrent-sparkplug");
@@ -18,5 +43,12 @@ else if (!bearerDone) {
18
43
  const commandWord = process.argv.slice(2).find((word) => !word.startsWith("-"));
19
44
  if (!commandWord?.startsWith("__"))
20
45
  (await import("./startup-interrupt.js")).holdStartupInterrupt();
21
- await import("./run.js");
46
+ const { executionIdentity } = await import("@cotal-ai/workspace");
47
+ const identity = executionIdentity();
48
+ if (identity && identity.logicalEntry === identity.loadedEntry) {
49
+ const { retireSupersededExecutionDescriptor } = await import("./execution-transaction.js");
50
+ retireSupersededExecutionDescriptor(dirname(dirname(identity.logicalEntry)));
51
+ }
52
+ if (!(await runVersionFlag()))
53
+ await import("./run.js");
22
54
  }
package/dist/cotal.js CHANGED
@@ -172,7 +172,8 @@ export function executionInventory(root) {
172
172
  export function executionLaunchBinding(root, entry) {
173
173
  const logical = resolve(entry), physical = realpathSync.native(logical);
174
174
  const canonicalRoot = realpathSync.native(root);
175
- if (physical !== join(canonicalRoot, "dist", "cotal.js"))
175
+ // npm's postinstall can repoint the saved entry to this package's wrapper.
176
+ if (physical !== join(canonicalRoot, "dist", "cotal.js") && physical !== join(canonicalRoot, "dist", "cotal-npm"))
176
177
  throw new Error("execution launch route does not resolve to this bootstrap");
177
178
  let path = join(canonicalRoot, "package.json");
178
179
  for (let current = dirname(logical); current !== dirname(current); current = dirname(current)) {
@@ -36,7 +36,7 @@ import { connectCheckViaDaemon, managerViaDaemon, queryDaemon, registerViaDaemon
36
36
  import { admitWindowsNativeDaemon, applyInstall, applyUninstall, observeDaemonOwnedService, planInstall, planUninstall, repairMissingInstalledProgram, startInstalled } from "./install.js";
37
37
  import { exchangeDesktopRequest, runDesktopBridge } from "./desktop.js";
38
38
  import { runAccountSetup, runSetup } from "./setup.js";
39
- import { daemonCommandCopy } from "./guidance.js";
39
+ import { daemonCommandCopy, daemonServiceRequirement } from "./guidance.js";
40
40
  import { forgetHostedManagerIntents } from "./manager.js";
41
41
  import { automaticUpdates } from "./auto-update.js";
42
42
  import { watchDaemonGeneration } from "./generation.js";
@@ -119,7 +119,7 @@ function resolveTarget(args, recoverMissingHome = false) {
119
119
  }
120
120
  const REFUSAL = {
121
121
  UNSUPPORTED_PLATFORM: { code: "UNSUPPORTED" },
122
- NO_RUNTIME_DIR: { code: "TARGET_UNAVAILABLE", remedy: "run as the intended operating-system user with its private runtime directory available" },
122
+ NO_RUNTIME_DIR: { code: "TARGET_UNAVAILABLE", remedy: "Use a private runtime directory provisioned by systemd-logind or pam_rundir, or create one owned by your user with mode 0700 and set XDG_RUNTIME_DIR to it" },
123
123
  NOT_RUNNING: { code: "TARGET_UNAVAILABLE", remedy: "start it with `cotal daemon serve`" },
124
124
  ALREADY_RUNNING: { code: "CONFLICT", remedy: "run `cotal daemon status` for the same daemon home; inspect the conflicting endpoint with your operating system before changing it. No foreign endpoint was removed" },
125
125
  DIR_NOT_DIRECTORY: { code: "PERMISSION_DENIED", remedy: "inspect the path; nothing was changed" },
@@ -133,13 +133,15 @@ const REFUSAL = {
133
133
  PEER_NOT_LOCK_OWNER: { code: "PERMISSION_DENIED", remedy: "inspect the conflicting listener with your operating system. For the default daemon use its COTAL_HOME. For an explicit --daemon-home use the same directory as the intended daemon. No process was stopped" },
134
134
  LOCK_HELD: { code: "CONFLICT", remedy: "a daemon already holds this lifetime lock; run `cotal daemon status`, with the same --daemon-home when you passed one" },
135
135
  };
136
- function asFailure(e) {
136
+ function asFailure(e, home) {
137
137
  if (e instanceof IdpConfigurationError)
138
138
  return new CommandFailure("refused", "USAGE_INVALID", e.message, { remedy: "correct COTAL_IDP_TIMEOUT_MS in the daemon environment before starting it again" });
139
139
  if (!(e instanceof EndpointRefusal))
140
140
  return e;
141
141
  const r = REFUSAL[e.code];
142
- const remedy = e.remedy ?? r.remedy;
142
+ const remedy = e.remedy ?? (e.code === "NOT_RUNNING" && home !== undefined
143
+ ? `start it with ${codeSpan(daemonCommandCopy("serve", home))}`
144
+ : r.remedy);
143
145
  return new CommandFailure("refused", r.code, e.message, { ...(remedy ? { remedy } : {}), native: { code: e.code } });
144
146
  }
145
147
  function capacityText(total, free) {
@@ -188,7 +190,7 @@ async function status(args) {
188
190
  native: { code: e.code },
189
191
  });
190
192
  }
191
- throw asFailure(e);
193
+ throw asFailure(e, home);
192
194
  }
193
195
  if (!reply.ok)
194
196
  throw new CommandFailure("failed", "OPERATION_FAILED", `the daemon refused the status request: ${reply.error.code} ${reply.error.message}`);
@@ -359,13 +361,13 @@ async function serviceCommand(args, op) {
359
361
  const space = args.values.space;
360
362
  if (typeof space !== "string" || !space)
361
363
  throw new CommandFailure("refused", "USAGE_INVALID", `cotal daemon ${op} needs --space <s>`);
362
- const { paths } = resolveTarget(args);
364
+ const { paths, home } = resolveTarget(args);
363
365
  let reply;
364
366
  try {
365
367
  reply = await serviceViaDaemon({ paths, peerUid, peerPid, space, op });
366
368
  }
367
369
  catch (e) {
368
- throw asFailure(e);
370
+ throw asFailure(e, home);
369
371
  }
370
372
  if (!reply.ok)
371
373
  throw new CommandFailure("refused", "USAGE_INVALID", `the daemon refused the service request: ${reply.code} ${reply.message}`, { native: { code: reply.code } });
@@ -397,6 +399,11 @@ async function serviceCommand(args, op) {
397
399
  async function unitCommand(args, op) {
398
400
  const presentation = presentationOf(args.values);
399
401
  const values = args.values;
402
+ if (op === "install" && (values["daemon-home"] === undefined || isAbsolute(values["daemon-home"]))) {
403
+ const requirement = daemonServiceRequirement(values["daemon-home"]);
404
+ if (requirement)
405
+ throw requirement;
406
+ }
400
407
  const { paths, home } = resolveTarget(args, true);
401
408
  if (op === "install") {
402
409
  const dry = values["dry-run"] === true;
@@ -448,8 +455,6 @@ async function setupCommand(args) {
448
455
  throw new CommandFailure("refused", "USAGE_INVALID", "space must be 1-64 characters of [A-Za-z0-9_-]", { native: { code: "BAD_FIELD" } });
449
456
  if (args.values.cloud && values.idp !== undefined)
450
457
  throw new CommandFailure("refused", "USAGE_INVALID", "--cloud and --idp cannot be combined");
451
- let choice = values.idp !== undefined || args.values.cloud === true ? await daemonAccountChoice(args) : undefined;
452
- let idp = choice?.url;
453
458
  if (values["client-id"] !== undefined && !values["client-id"].trim())
454
459
  throw new CommandFailure("refused", "USAGE_INVALID", "--client-id cannot be empty");
455
460
  const waitSeconds = values.wait === undefined ? 900 : Number(values.wait);
@@ -457,6 +462,13 @@ async function setupCommand(args) {
457
462
  throw new CommandFailure("refused", "USAGE_INVALID", "--wait takes whole seconds from 0 to 86400");
458
463
  if (values.wait !== undefined && values["no-manager"] !== true)
459
464
  throw new CommandFailure("refused", "USAGE_INVALID", "--wait requires --no-manager; Manager setup never waits for machine approval");
465
+ if (values["daemon-home"] === undefined || isAbsolute(values["daemon-home"])) {
466
+ const requirement = daemonServiceRequirement(values["daemon-home"]);
467
+ if (requirement)
468
+ throw requirement;
469
+ }
470
+ let choice = values.idp !== undefined || args.values.cloud === true ? await daemonAccountChoice(args) : undefined;
471
+ let idp = choice?.url;
460
472
  const { paths, home } = resolveTarget(args);
461
473
  let newSignIn = values.idp !== undefined || args.values.cloud === true;
462
474
  if (!space && !idp) {
@@ -21,7 +21,7 @@ import { base64url, decodeJwt, decodeProtectedHeader } from "jose";
21
21
  import { assertLifecycleToken, isAccountNkey, mintLifecycleUid, resolveAuthProvider } from "@cotal-ai/core";
22
22
  import { claimIdentityRecord, codeSpan, findMesh, homeCotalDir, spaceSegment, userAuthStateDir, workspaceSecretStore } from "@cotal-ai/workspace";
23
23
  import { fetchIdpJwt, IdpSessionRejectedError, IdpUnreachableError, loadIdpSession } from "@cotal-ai/auth";
24
- import { daemonCommandCopy } from "./guidance.js";
24
+ import { daemonCommandCopy, NON_USER_AUTH_MESSAGE, NON_USER_AUTH_REMEDY } from "./guidance.js";
25
25
  /** The service name the daemon proposes for itself. Single-label names are reserved for reference
26
26
  * endpoints and a third-party name must be reverse-DNS, so this is the reverse-DNS of cotal.ai.
27
27
  * Binding it still needs the space operator's `name-bind`; the daemon never claims it. */
@@ -65,7 +65,6 @@ export function readDaemonServiceIdentity(space, home) {
65
65
  /** The fixed sentence per failure. Nothing from the remote side is quoted. */
66
66
  const SENTENCE = {
67
67
  "not-registered": "this space is not registered on this machine; add it with `cotal meshes add`",
68
- "not-user-auth": "this space does not use user sign-in, so the daemon cannot connect to it as its own service",
69
68
  "not-signed-in": "this machine is not signed in to the space's provider",
70
69
  "unsupported-by-space": "the space's auth service does not host service endpoints, so the daemon cannot register with it",
71
70
  unreachable: "the space's auth service could not be reached",
@@ -80,7 +79,7 @@ export async function connectCheck(space, home = homeCotalDir(), signal) {
80
79
  return { outcome: "not-registered", space, message: SENTENCE["not-registered"] };
81
80
  const ua = entry.mode === "user" ? entry.userAuth : undefined;
82
81
  if (!ua)
83
- return { outcome: "not-user-auth", space, message: SENTENCE["not-user-auth"] };
82
+ return { outcome: "not-user-auth", space, message: NON_USER_AUTH_MESSAGE, remedy: NON_USER_AUTH_REMEDY };
84
83
  let session;
85
84
  try {
86
85
  session = loadIdpSession(home, ua.idp.url);
@@ -1,4 +1,15 @@
1
- import { homeCotalDir, shellPath } from "@cotal-ai/workspace";
1
+ import { existsSync } from "node:fs";
2
+ import { codeSpan, CommandFailure, homeCotalDir, resolveOnPath, shellPath } from "@cotal-ai/workspace";
3
+ /** An unavailable systemd installation is different from an unreachable systemd user manager. */
4
+ export function daemonServiceRequirement(home) {
5
+ if (process.platform !== "linux" || (existsSync("/run/systemd/system") && resolveOnPath("systemctl")))
6
+ return undefined;
7
+ return new CommandFailure("refused", "UNSUPPORTED", "The Linux background service requires systemd. This environment does not provide both a running systemd and systemctl on PATH.", {
8
+ remedy: `Manage an existing systemd service from an environment with systemd and systemctl on PATH as the same user. If no daemon is installed or running, run ${codeSpan(daemonCommandCopy("serve", home))} under your own supervisor. Use \`cotal update --self\` for manual updates.`,
9
+ });
10
+ }
11
+ export const NON_USER_AUTH_MESSAGE = "this space does not use user sign-in. The machine service hosts Managers only for user-auth participant spaces";
12
+ export const NON_USER_AUTH_REMEDY = "run `cotal up` in the folder that hosts the local space. Its stack runs the Manager";
2
13
  /** A copyable command for this daemon. Tuples keep option values distinct from boolean flags;
3
14
  * leading-hyphen values need `=` even when shell-quoted. Windows copy targets PowerShell. */
4
15
  export function daemonCommandCopy(op, home, args = []) {
@@ -26,7 +26,8 @@ import { encode, parseRequest } from "./protocol.js";
26
26
  import { createLoginCoordinator } from "./login.js";
27
27
  import { connectCheck } from "./connect.js";
28
28
  import { createServiceConnections } from "./service.js";
29
- import { findMesh, homeCotalDir, isCommandFailure, readUpdateSettings, setUpdateSetting } from "@cotal-ai/workspace";
29
+ import { findMesh, homeCotalDir, isCommandFailure, isMeshRegistryError, meshFile, readMeshRegistry, readUpdateSettings, setUpdateSetting } from "@cotal-ai/workspace";
30
+ import { NON_USER_AUTH_MESSAGE, NON_USER_AUTH_REMEDY } from "./guidance.js";
30
31
  import { desktopSpaces } from "./desktop-state.js";
31
32
  import { idpTimeoutMs, signOutIdpSession, withIdpSessionDir } from "@cotal-ai/auth";
32
33
  import { createHostedManagers, HostedManagerRefusal } from "./manager.js";
@@ -414,7 +415,34 @@ async function serveLocked(opts, uid, lock) {
414
415
  counters.serviceAnswered++;
415
416
  if (req.op === "service-connect" && result.state === "not-registered")
416
417
  return result;
417
- return { ...result, manager: req.op === "service-status" ? await managers.refresh(req.space) : managers.status(req.space) };
418
+ const manager = req.op === "service-status" ? await managers.refresh(req.space) : managers.status(req.space);
419
+ // Read guidance only for these replies, after disconnect has finished removing records.
420
+ if (!manager.registrationCleanup && ((req.op === "service-status" && (result.state === "not-requested" || result.state === "unsupported")) ||
421
+ (req.op === "service-disconnect" && result.state === "disconnected"))) {
422
+ let damaged = false;
423
+ try {
424
+ const { entries, unusable } = readMeshRegistry();
425
+ // Keep pre-hex registrations visible without mistaking a damaged canonical record for a legacy one.
426
+ damaged = unusable.some(error => error.file === meshFile(req.space));
427
+ if (!damaged && entries.some(entry => entry.space === req.space && entry.mode !== "user")) {
428
+ if (req.op === "service-status")
429
+ return { space: req.space, state: "unsupported", message: NON_USER_AUTH_MESSAGE, remedy: NON_USER_AUTH_REMEDY };
430
+ return { ...result, manager: { ...manager, next: NON_USER_AUTH_REMEDY } };
431
+ }
432
+ }
433
+ catch (error) {
434
+ if (!isMeshRegistryError(error))
435
+ throw error;
436
+ damaged = true;
437
+ }
438
+ if (damaged) {
439
+ const remedy = "run `cotal daemon spaces` to identify unreadable records, then restore the mesh registry";
440
+ if (req.op === "service-status")
441
+ return { space: req.space, state: "unavailable", message: "the mesh registry could not be read for this space", remedy };
442
+ return { ...result, manager: { ...manager, next: remedy } };
443
+ }
444
+ }
445
+ return { ...result, manager };
418
446
  });
419
447
  return;
420
448
  }
@@ -23,7 +23,7 @@ import { exchangeDesktopRequest } from "./desktop.js";
23
23
  import { applyInstall, installedDaemonIdentity, planUninstall, planInstalledPathRefresh, startInstalled, restartInstalled } from "./install.js";
24
24
  import { fromRegister } from "./service.js";
25
25
  import { DAEMON_PROTOCOL_VERSION } from "./endpoint.js";
26
- import { daemonCommandCopy } from "./guidance.js";
26
+ import { daemonCommandCopy, NON_USER_AUTH_MESSAGE, NON_USER_AUTH_REMEDY } from "./guidance.js";
27
27
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
28
28
  /** Wait for the daemon to answer its endpoint after a start, so the steps below reach a live one. */
29
29
  async function waitForDaemon(opts, seconds) {
@@ -261,6 +261,9 @@ async function ensureSignedIn(opts, steps) {
261
261
  const check = await connectCheckViaDaemon({ paths: opts.paths, peerUid: opts.peerUid, peerPid: opts.peerPid, space: opts.space });
262
262
  if (!check.ok)
263
263
  throw new CommandFailure("refused", "USAGE_INVALID", `the daemon refused the connection check: ${check.code} ${check.message}`, { native: { code: check.code } });
264
+ if (check.result.outcome === "not-user-auth") {
265
+ throw new CommandFailure("refused", "UNSUPPORTED", NON_USER_AUTH_MESSAGE, { remedy: NON_USER_AUTH_REMEDY, native: { code: "NOT_USER_AUTH" } });
266
+ }
264
267
  if (check.result.outcome === "credential-expired") {
265
268
  throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", check.result.message, { native: { code: "CREDENTIAL_EXPIRED" } });
266
269
  }
@@ -23,6 +23,7 @@ import { reportRunningManagers } from "@cotal-ai/cli/update";
23
23
  import { adoptAutomaticUpdateChild } from "./update-scope.js";
24
24
  import { captureWindowsGeneration, closeWindowsGeneration, windowsGenerationLifecycle } from "./update-generation-win32.js";
25
25
  import { observeUpdateDaemon, sameUpdateDaemon } from "./update-lifetime.js";
26
+ import { daemonServiceRequirement } from "./guidance.js";
26
27
  /** A reconcile child of a parent that said it waits after the child and prints the line. A parent
27
28
  * from before that marker never waits there, so its child keeps the line. */
28
29
  export function currentParentWaits(env, parentPid, journaled) {
@@ -271,7 +272,7 @@ const composed = { ...command, async run(args) {
271
272
  }
272
273
  }
273
274
  const runtime = { ...updateRuntime, automaticGenerationWait: process.platform === "linux",
274
- claimGlobalUpdate: (root) => claimGlobalNpmUpdateLock(root, legacyRepair && root === interruptedChildRoot ? { waitMs: 10 * 60_000, repairAmbiguous: () => {
275
+ claimGlobalUpdate: (root, onWait) => claimGlobalNpmUpdateLock(root, legacyRepair && root === interruptedChildRoot ? { waitMs: 10 * 60_000, onWait, repairAmbiguous: () => {
275
276
  if (repairService) {
276
277
  const plan = planUninstall(repairService, undefined);
277
278
  if (!installedDaemonIdentity(repairService).same || plan.mechanism !== "systemd-user")
@@ -318,7 +319,7 @@ const composed = { ...command, async run(args) {
318
319
  }
319
320
  }
320
321
  console.log("Retaining the interrupted update marker after confirming this account has no other application process.");
321
- } } : { waitMs: 10 * 60_000 }),
322
+ } } : { waitMs: 10 * 60_000, onWait }),
322
323
  ...(logicalExecutionEntry() && !updateRuntime.checkout() && (process.platform === "linux" || process.platform === "darwin") ? {
323
324
  preflightExecution: preflightExecutionUpdate,
324
325
  repairInstallModes: (root) => repairExecutionInstallModes(executionInstallRoot(), () => repairInstallModes(root)),
@@ -378,6 +379,10 @@ const composed = { ...command, async run(args) {
378
379
  currentPackages = updateRuntime.isCurrent?.() === true;
379
380
  return currentPackages;
380
381
  }, async automaticUpdateAdvice() {
382
+ const systemdAdvice = () => {
383
+ const requirement = daemonServiceRequirement();
384
+ return requirement && `${requirement.message} ${requirement.remedy}`;
385
+ };
381
386
  try {
382
387
  const reply = await queryDaemon({ paths: daemonPaths() });
383
388
  if (!reply.ok)
@@ -386,11 +391,16 @@ const composed = { ...command, async run(args) {
386
391
  throw new Error("machine daemon returned no update schedule; run `cotal daemon status` to inspect it");
387
392
  if (reply.result.update.automatic && typeof reply.result.update.nextAttempt === "string")
388
393
  return undefined;
389
- return "The daemon is not scheduling automatic installation. Run `cotal daemon status` to inspect it. If no daemon service is installed, run `cotal daemon install`.";
394
+ const inactive = "The daemon is not scheduling automatic installation. Run `cotal daemon status` to inspect it.";
395
+ const unsupported = systemdAdvice();
396
+ return `${inactive} ${unsupported ?? "If no daemon service is installed, run `cotal daemon install`."}`;
390
397
  }
391
398
  catch (error) {
399
+ if (error instanceof EndpointRefusal && error.code === "PEER_NOT_LOCK_OWNER") {
400
+ return `Could not check the automatic update schedule: ${error.message}.`;
401
+ }
392
402
  if (error instanceof EndpointRefusal && ["NOT_RUNNING", "NO_RUNTIME_DIR"].includes(error.code)) {
393
- return "No daemon service is running the automatic update schedule. Run `cotal daemon install`, then inspect `cotal daemon status`.";
403
+ return systemdAdvice() ?? "No daemon service is running the automatic update schedule. Run `cotal daemon install`, then inspect `cotal daemon status`.";
394
404
  }
395
405
  throw error;
396
406
  }
package/dist/mcp-host.js CHANGED
@@ -3,6 +3,7 @@ import { execFile } from "node:child_process";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { configFromEnv, MeshAgent, NameTaken, } from "@cotal-ai/connector-core";
5
5
  import { resolveTargetOrThrow } from "@cotal-ai/workspace";
6
+ import { retireLocalAppIdentity } from "@cotal-ai/cli/app-identity";
6
7
  import { selfArgv } from "@cotal-ai/cli/self-exec";
7
8
  /** The host never invents a native conversation for a signed-in space. Static identities use the
8
9
  * terminal-seat contract: the credential and generation last to its horizon, without renewal. */
@@ -34,9 +35,12 @@ export function createMcpHost(space) {
34
35
  // A failed retirement remains owned, but may never route another tool to a stopped agent.
35
36
  held.stopped = true;
36
37
  await held.connection?.agent.stop();
37
- const result = await plumbing(["retire", "--dir", held.dir]);
38
- if (!result.ok)
38
+ try {
39
+ await retireLocalAppIdentity(held.dir);
40
+ }
41
+ catch {
39
42
  throw new Error("identity cleanup is unfinished; call cotal_disconnect again to retry it");
43
+ }
40
44
  held = undefined;
41
45
  };
42
46
  const open = async (name, selection) => {
package/dist/run.js CHANGED
@@ -60,13 +60,6 @@ registry.provide({ provides: commands("mcp"), load: importing("mcp") });
60
60
  // The dispatch module reads the command word as `runCli` will, and loads no command. A word a
61
61
  // provider declares imports that provider's surfaces; any other word imports them all.
62
62
  const { commandWord, completeFileWrites, runCli, stdoutError } = await import("@cotal-ai/cli/dispatch");
63
- const { executionIdentity } = await import("@cotal-ai/workspace");
64
- const identity = executionIdentity();
65
- if (identity && identity.logicalEntry === identity.loadedEntry) {
66
- const { retireSupersededExecutionDescriptor } = await import("./execution-transaction.js");
67
- const { dirname } = await import("node:path");
68
- retireSupersededExecutionDescriptor(dirname(dirname(identity.logicalEntry)));
69
- }
70
63
  const argv = process.argv.slice(2);
71
64
  const { readFileSync } = await import("node:fs");
72
65
  const currentVersion = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
@@ -25,8 +25,9 @@ export function installUpdateNotice(argv, current) {
25
25
  child.unref();
26
26
  }
27
27
  const recovery = readUpdateRecovery();
28
+ const decision = recovery && recoveryDisposition(recovery);
28
29
  const remedy = existsSync(fileURLToPath(new URL("../desktop-runtime.json", import.meta.url))) ? "Update the desktop app with its signed platform installer." : "Run `cotal update --self`.";
29
- const message = recovery ? `Cotal update needs repair (installed ${recovery.installed}, previous ${recovery.previous}). ${recoveryDisposition(recovery).instruction}` : cached?.latest && newerUpdate(cached.latest, current) ? `Cotal update available: ${current} -> ${cached.latest}. ${remedy}` : undefined;
30
+ const message = recovery && decision ? (decision.action === "active" ? decision.instruction : `Cotal update needs repair (installed ${recovery.installed}, previous ${recovery.previous}). ${decision.instruction}`) : cached?.latest && newerUpdate(cached.latest, current) ? `Cotal update available: ${current} -> ${cached.latest}. ${remedy}` : undefined;
30
31
  if (message)
31
32
  process.once("exit", () => process.stderr.write(`${message}\n`));
32
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cotal-ai",
3
- "version": "0.171.1",
3
+ "version": "0.171.3",
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,34 +37,36 @@
37
37
  "node": ">=22.10"
38
38
  },
39
39
  "dependencies": {
40
- "@cotal-ai/auth": "0.171.1",
41
- "@cotal-ai/cli": "0.171.1",
42
- "@cotal-ai/connector-core": "0.171.1",
43
- "@cotal-ai/core": "0.171.1",
44
- "@cotal-ai/delivery": "0.171.1",
45
- "@cotal-ai/manager": "0.171.1",
46
- "@cotal-ai/registry": "0.171.1",
47
- "@cotal-ai/runtime": "0.171.1",
48
- "@cotal-ai/seat": "0.171.1",
49
- "@cotal-ai/workspace": "0.171.1",
40
+ "@cotal-ai/auth": "0.171.3",
41
+ "@cotal-ai/cli": "0.171.3",
42
+ "@cotal-ai/connector-core": "0.171.3",
43
+ "@cotal-ai/core": "0.171.3",
44
+ "@cotal-ai/delivery": "0.171.3",
45
+ "@cotal-ai/manager": "0.171.3",
46
+ "@cotal-ai/registry": "0.171.3",
47
+ "@cotal-ai/runtime": "0.171.3",
48
+ "@cotal-ai/seat": "0.171.3",
49
+ "@cotal-ai/workspace": "0.171.3",
50
50
  "jose": "^6.2.3"
51
51
  },
52
52
  "devDependencies": {
53
- "@cotal-ai/connector-claude-code": "0.171.1",
54
- "@cotal-ai/connector-codex": "0.171.1",
55
- "@cotal-ai/connector-hermes": "0.171.1",
56
- "@cotal-ai/connector-jcode": "0.171.1",
57
- "@cotal-ai/connector-opencode": "0.171.1",
58
- "@cotal-ai/linear": "0.171.1",
59
- "@cotal-ai/pi": "0.171.1",
53
+ "@cotal-ai/connector-claude-code": "0.171.3",
54
+ "@cotal-ai/connector-codex": "0.171.3",
55
+ "@cotal-ai/connector-hermes": "0.171.3",
56
+ "@cotal-ai/connector-jcode": "0.171.3",
57
+ "@cotal-ai/connector-opencode": "0.171.3",
58
+ "@cotal-ai/linear": "0.171.3",
59
+ "@cotal-ai/pi": "0.171.3",
60
60
  "@cotal-ai/smoke-kit": "0.0.0",
61
- "@cotal-ai/web": "0.171.1",
61
+ "@cotal-ai/web": "0.171.3",
62
+ "@modelcontextprotocol/sdk": "1.29.0",
62
63
  "@nats-io/jetstream": "3.4.0",
63
64
  "@nats-io/transport-node": "3.4.0",
64
65
  "typescript": "^5.9.3"
65
66
  },
66
67
  "files": [
67
68
  "dist",
69
+ "scripts/pin-npm-node.mjs",
68
70
  "seeded-connectors",
69
71
  "README.md",
70
72
  "LICENSE"
@@ -76,6 +78,7 @@
76
78
  "test": "tsx smoke/dep-pins.smoke.ts && tsx smoke/capability-census.smoke.ts",
77
79
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.smoke.json",
78
80
  "build": "tsc -p tsconfig.json",
79
- "seeded-connectors": "node scripts/copy-seeded-connectors.mjs"
81
+ "seeded-connectors": "node scripts/copy-seeded-connectors.mjs",
82
+ "postinstall": "node scripts/pin-npm-node.mjs"
80
83
  }
81
84
  }
@@ -0,0 +1,39 @@
1
+ import { mkdtempSync, readlinkSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
2
+ import { basename, dirname, join, relative, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ // Leave Windows shims, local installs and script-disabled npm installs alone. The JavaScript
6
+ // entry remains the declared bin and the stable entry for daemons and retained generations.
7
+ if (process.platform === "linux" || process.platform === "darwin") {
8
+ const root = realpathSync(fileURLToPath(new URL("..", import.meta.url)));
9
+ const modules = dirname(root);
10
+ if (basename(root) === "cotal-ai" && basename(modules) === "node_modules" && basename(dirname(modules)) === "lib") {
11
+ const link = join(dirname(dirname(modules)), "bin", "cotal");
12
+ let target;
13
+ try { target = resolve(dirname(link), readlinkSync(link)); }
14
+ catch (error) { if (error.code !== "ENOENT" && error.code !== "EINVAL") throw error; }
15
+ if (target === join(root, "dist", "cotal.js")) {
16
+ const launcher = join(root, "dist", "cotal-npm");
17
+ const quote = value => "'" + value.replaceAll("'", "'\\''") + "'";
18
+ const node = realpathSync(process.execPath);
19
+ writeFileSync(launcher, `#!/bin/sh
20
+ if command -v node >/dev/null 2>&1; then
21
+ exec node ${quote(target)} "$@"
22
+ fi
23
+ if [ -x ${quote(node)} ]; then
24
+ PATH="$PATH":${quote(dirname(node))}
25
+ export PATH
26
+ exec ${quote(node)} ${quote(target)} "$@"
27
+ fi
28
+ printf '%s\\n' 'cotal: Node.js 22.10 or later is required. Restore Node to PATH and reinstall Cotal with npm.' >&2
29
+ exit 127
30
+ `, { flag: "wx", mode: 0o755 });
31
+ const temporary = mkdtempSync(join(dirname(link), ".cotal-node-"));
32
+ try {
33
+ const pending = join(temporary, "cotal");
34
+ symlinkSync(relative(dirname(link), launcher), pending);
35
+ if (resolve(dirname(link), readlinkSync(link)) === target) renameSync(pending, link);
36
+ } finally { rmSync(temporary, { recursive: true, force: true }); }
37
+ }
38
+ }
39
+ }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "v": 1,
3
3
  "files": {
4
- "docs-bundle.bin": "b9806c25c302ad74063d04a0ba9d3183e5f545e006d0b824cece45f203bb08c7",
5
- "docs-index.bin": "a7b80bc8fccb8c313cf7052e8c5dcc7528e1099bb6caef5010e27e29cbbce440"
4
+ "docs-bundle.bin": "1b60c67007ec5e34be7b1fc27a95e4c43e557238ea9fc79d19209b2cbc8e49fa",
5
+ "docs-index.bin": "41aa74ee5a6e1b6ddee60f95a70b331eacec5346f3aab5aedb33ab3ba7783e96"
6
6
  },
7
7
  "placements": {
8
8
  "claude": [
@@ -126,6 +126,8 @@ export interface ClaudeEntry {
126
126
  content?: string | ClaudeBlock[];
127
127
  };
128
128
  }
129
+ /** The interrupt text when `entry` is Claude Code's record of its user interrupting a turn. */
130
+ export declare function userInterrupt(entry: ClaudeEntry): string | undefined;
129
131
  /** A content block. Same reasoning as above: shape-tolerant, read narrowly. */
130
132
  export interface ClaudeBlock {
131
133
  type?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agui-map.d.ts","sourceRoot":"","sources":["../src/agui-map.ts"],"names":[],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C;IAC/B;;;;;;;;;;;;;;;OAeG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAiBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,YAAY,CAyO1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwE,KAAK,SAAS,EAA8E,MAAM,gBAAgB,CAAC;AAWlM;;;;;;;;;4FAS4F;AAC5F,eAAO,MAAM,oBAAoB,8/DA4EvB,CAAC;AAkJX;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SA4P7B,CAAC"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwE,KAAK,SAAS,EAA8E,MAAM,gBAAgB,CAAC;AAWlM;;;;;;;;;4FAS4F;AAC5F,eAAO,MAAM,oBAAoB,8/DA4EvB,CAAC;AAkJX;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SA8P7B,CAAC"}