@cotal-ai/workspace 0.90.0 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/build/Release/win32-arm64/build.json +1 -1
  2. package/build/Release/win32-x64/build.json +1 -1
  3. package/dist/agent-secrets.d.ts +2 -2
  4. package/dist/agent-secrets.d.ts.map +1 -1
  5. package/dist/agent-secrets.js +2 -2
  6. package/dist/agent-secrets.js.map +1 -1
  7. package/dist/auth-paths.d.ts +8 -2
  8. package/dist/auth-paths.d.ts.map +1 -1
  9. package/dist/auth-paths.js +12 -5
  10. package/dist/auth-paths.js.map +1 -1
  11. package/dist/broker-display.d.ts +4 -0
  12. package/dist/broker-display.d.ts.map +1 -0
  13. package/dist/broker-display.js +29 -0
  14. package/dist/broker-display.js.map +1 -0
  15. package/dist/colors.d.ts +11 -4
  16. package/dist/colors.d.ts.map +1 -1
  17. package/dist/colors.js +36 -9
  18. package/dist/colors.js.map +1 -1
  19. package/dist/connect.d.ts +64 -6
  20. package/dist/connect.d.ts.map +1 -1
  21. package/dist/connect.js +170 -74
  22. package/dist/connect.js.map +1 -1
  23. package/dist/control-target.d.ts +2 -2
  24. package/dist/control-target.js +2 -2
  25. package/dist/credential-actions.d.ts +91 -0
  26. package/dist/credential-actions.d.ts.map +1 -0
  27. package/dist/credential-actions.js +74 -0
  28. package/dist/credential-actions.js.map +1 -0
  29. package/dist/deprecated-daemon-entries.d.ts +30 -0
  30. package/dist/deprecated-daemon-entries.d.ts.map +1 -0
  31. package/dist/deprecated-daemon-entries.js +37 -0
  32. package/dist/deprecated-daemon-entries.js.map +1 -0
  33. package/dist/endpoint-actions.d.ts +31 -0
  34. package/dist/endpoint-actions.d.ts.map +1 -0
  35. package/dist/endpoint-actions.js +2 -0
  36. package/dist/endpoint-actions.js.map +1 -0
  37. package/dist/endpoint-caller.d.ts +74 -0
  38. package/dist/endpoint-caller.d.ts.map +1 -0
  39. package/dist/endpoint-caller.js +118 -0
  40. package/dist/endpoint-caller.js.map +1 -0
  41. package/dist/endpoint-contract.d.ts +32 -0
  42. package/dist/endpoint-contract.d.ts.map +1 -0
  43. package/dist/endpoint-contract.js +92 -0
  44. package/dist/endpoint-contract.js.map +1 -0
  45. package/dist/extension-mutation.d.ts.map +1 -1
  46. package/dist/extension-mutation.js +4 -1
  47. package/dist/extension-mutation.js.map +1 -1
  48. package/dist/extensions.d.ts +28 -8
  49. package/dist/extensions.d.ts.map +1 -1
  50. package/dist/extensions.js +20 -8
  51. package/dist/extensions.js.map +1 -1
  52. package/dist/flags.d.ts +8 -1
  53. package/dist/flags.d.ts.map +1 -1
  54. package/dist/flags.js +9 -7
  55. package/dist/flags.js.map +1 -1
  56. package/dist/index.d.ts +25 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +25 -0
  59. package/dist/index.js.map +1 -1
  60. package/dist/launch-persona.d.ts +10 -0
  61. package/dist/launch-persona.d.ts.map +1 -0
  62. package/dist/launch-persona.js +34 -0
  63. package/dist/launch-persona.js.map +1 -0
  64. package/dist/local-process.d.ts +16 -12
  65. package/dist/local-process.d.ts.map +1 -1
  66. package/dist/local-process.js +7 -2
  67. package/dist/local-process.js.map +1 -1
  68. package/dist/maintenance.d.ts +267 -4
  69. package/dist/maintenance.d.ts.map +1 -1
  70. package/dist/maintenance.js +666 -12
  71. package/dist/maintenance.js.map +1 -1
  72. package/dist/mesh-manifest-schema.d.ts +118 -0
  73. package/dist/mesh-manifest-schema.d.ts.map +1 -0
  74. package/dist/mesh-manifest-schema.js +96 -0
  75. package/dist/mesh-manifest-schema.js.map +1 -0
  76. package/dist/mesh-registry.d.ts +27 -0
  77. package/dist/mesh-registry.d.ts.map +1 -1
  78. package/dist/mesh-registry.js +69 -13
  79. package/dist/mesh-registry.js.map +1 -1
  80. package/dist/mesh-target.d.ts +15 -7
  81. package/dist/mesh-target.d.ts.map +1 -1
  82. package/dist/mesh-target.js +77 -26
  83. package/dist/mesh-target.js.map +1 -1
  84. package/dist/official-connectors.d.ts +13 -0
  85. package/dist/official-connectors.d.ts.map +1 -1
  86. package/dist/official-connectors.js +18 -2
  87. package/dist/official-connectors.js.map +1 -1
  88. package/dist/output.d.ts +147 -0
  89. package/dist/output.d.ts.map +1 -0
  90. package/dist/output.js +186 -0
  91. package/dist/output.js.map +1 -0
  92. package/dist/pid.d.ts +5 -3
  93. package/dist/pid.d.ts.map +1 -1
  94. package/dist/pid.js +25 -13
  95. package/dist/pid.js.map +1 -1
  96. package/dist/preferences.d.ts +93 -0
  97. package/dist/preferences.d.ts.map +1 -0
  98. package/dist/preferences.js +272 -0
  99. package/dist/preferences.js.map +1 -0
  100. package/dist/preflight.d.ts +3 -0
  101. package/dist/preflight.d.ts.map +1 -1
  102. package/dist/preflight.js +6 -3
  103. package/dist/preflight.js.map +1 -1
  104. package/dist/prepared-spaces.d.ts +27 -0
  105. package/dist/prepared-spaces.d.ts.map +1 -0
  106. package/dist/prepared-spaces.js +57 -0
  107. package/dist/prepared-spaces.js.map +1 -0
  108. package/dist/present.d.ts +108 -0
  109. package/dist/present.d.ts.map +1 -0
  110. package/dist/present.js +249 -0
  111. package/dist/present.js.map +1 -0
  112. package/dist/prompt-input.d.ts +12 -0
  113. package/dist/prompt-input.d.ts.map +1 -0
  114. package/dist/prompt-input.js +35 -0
  115. package/dist/prompt-input.js.map +1 -0
  116. package/dist/protected-records.d.ts +102 -0
  117. package/dist/protected-records.d.ts.map +1 -0
  118. package/dist/protected-records.js +465 -0
  119. package/dist/protected-records.js.map +1 -0
  120. package/dist/registration-policy.d.ts +4 -1
  121. package/dist/registration-policy.d.ts.map +1 -1
  122. package/dist/registration-policy.js +4 -3
  123. package/dist/registration-policy.js.map +1 -1
  124. package/dist/render.d.ts +8 -0
  125. package/dist/render.d.ts.map +1 -1
  126. package/dist/render.js +49 -32
  127. package/dist/render.js.map +1 -1
  128. package/dist/service-adapter.d.ts +198 -0
  129. package/dist/service-adapter.d.ts.map +1 -0
  130. package/dist/service-adapter.js +294 -0
  131. package/dist/service-adapter.js.map +1 -0
  132. package/dist/service-custody.d.ts +5 -0
  133. package/dist/service-custody.d.ts.map +1 -0
  134. package/dist/service-custody.js +41 -0
  135. package/dist/service-custody.js.map +1 -0
  136. package/dist/service-definition.d.ts +52 -0
  137. package/dist/service-definition.d.ts.map +1 -0
  138. package/dist/service-definition.js +85 -0
  139. package/dist/service-definition.js.map +1 -0
  140. package/dist/service-definition.schema.json +79 -0
  141. package/dist/service-extension-metadata.d.ts +11 -0
  142. package/dist/service-extension-metadata.d.ts.map +1 -0
  143. package/dist/service-extension-metadata.js +66 -0
  144. package/dist/service-extension-metadata.js.map +1 -0
  145. package/dist/service-identity.d.ts +51 -0
  146. package/dist/service-identity.d.ts.map +1 -0
  147. package/dist/service-identity.js +103 -0
  148. package/dist/service-identity.js.map +1 -0
  149. package/dist/service-observation.d.ts +32 -0
  150. package/dist/service-observation.d.ts.map +1 -0
  151. package/dist/service-observation.js +134 -0
  152. package/dist/service-observation.js.map +1 -0
  153. package/dist/service-preset.d.ts +12 -0
  154. package/dist/service-preset.d.ts.map +1 -0
  155. package/dist/service-preset.js +10 -0
  156. package/dist/service-preset.js.map +1 -0
  157. package/dist/service-startup.d.ts +23 -0
  158. package/dist/service-startup.d.ts.map +1 -0
  159. package/dist/service-startup.js +39 -0
  160. package/dist/service-startup.js.map +1 -0
  161. package/dist/service-stop.d.ts +47 -0
  162. package/dist/service-stop.d.ts.map +1 -0
  163. package/dist/service-stop.js +152 -0
  164. package/dist/service-stop.js.map +1 -0
  165. package/dist/service-target.d.ts +5 -0
  166. package/dist/service-target.d.ts.map +1 -0
  167. package/dist/service-target.js +19 -0
  168. package/dist/service-target.js.map +1 -0
  169. package/dist/signer-export.d.ts +31 -0
  170. package/dist/signer-export.d.ts.map +1 -0
  171. package/dist/signer-export.js +114 -0
  172. package/dist/signer-export.js.map +1 -0
  173. package/dist/space-segmentation.d.ts +13 -2
  174. package/dist/space-segmentation.d.ts.map +1 -1
  175. package/dist/space-segmentation.js +7 -3
  176. package/dist/space-segmentation.js.map +1 -1
  177. package/dist/space.d.ts +5 -5
  178. package/dist/space.d.ts.map +1 -1
  179. package/dist/space.js +8 -6
  180. package/dist/space.js.map +1 -1
  181. package/dist/system-rotation.d.ts +4 -3
  182. package/dist/system-rotation.d.ts.map +1 -1
  183. package/dist/system-rotation.js +16 -6
  184. package/dist/system-rotation.js.map +1 -1
  185. package/dist/web-session.d.ts +7 -0
  186. package/dist/web-session.d.ts.map +1 -1
  187. package/dist/web-session.js +9 -0
  188. package/dist/web-session.js.map +1 -1
  189. package/package.json +6 -2
package/dist/render.js CHANGED
@@ -1,98 +1,115 @@
1
+ import { brokerAddressForDisplay } from "./broker-display.js";
1
2
  import { PREFLIGHT_CONFIRM_TIMEOUT_MS } from "./preflight.js";
2
- /** Render a workspace failure as the canonical one-line `cotal …` sentence. */
3
- export function renderWorkspaceError(e) {
3
+ const parts = (message, remedy) => (remedy === undefined ? { message } : { message, remedy });
4
+ /** A workspace failure as its message and remedy, for a caller that reports them apart, such as a
5
+ * structured command's `error.message` and `error.remedy`. */
6
+ export function workspaceErrorParts(e) {
4
7
  switch (e.kind) {
5
8
  case "target":
6
- return renderTargetError(e.error);
9
+ return targetErrorParts(e.error);
7
10
  case "preflight":
8
- return renderPreflightFailure(e.failure, e.target, e.pruned);
11
+ return preflightFailureParts(e.failure, e.target, e.pruned);
9
12
  case "reachable":
10
- return renderReachable(e.reason, e.server, e.hasAuth);
13
+ return reachableParts(e.reason, e.server, e.hasAuth);
11
14
  }
12
15
  }
16
+ /** Render a workspace failure as the canonical one-line `cotal …` sentence. */
17
+ export function renderWorkspaceError(e) {
18
+ const { message, remedy } = workspaceErrorParts(e);
19
+ return `✗ ${message}${remedy === undefined ? "" : ` - ${remedy}`}`;
20
+ }
13
21
  /** "Which mesh" resolution failures — maps a {@link MeshTargetError}'s `{code, details}` to copy. */
14
- function renderTargetError(err) {
22
+ function targetErrorParts(err) {
15
23
  const d = err.details;
16
24
  switch (err.code) {
17
25
  case "no-meshes":
18
- return "✗ no mesh running - run `cotal up` in a project, or pass `--server`";
26
+ return parts("no mesh running", "run `cotal up` in a project, or pass `--server`");
19
27
  case "unknown-space":
20
- return `✗ no mesh named "${d.requested}" is running - see \`cotal meshes\``;
28
+ return d.selected
29
+ ? parts(`the selected space "${d.requested}" is not registered here`, "select one with `cotal use <name>` (`cotal space` lists them), or name one with `--space`")
30
+ : parts(`no space named "${d.requested}" is registered here`, "see `cotal space`");
21
31
  case "ambiguous-target":
22
- return `✗ multiple meshes running - ${(d.available ?? []).join(", ")}. Pick one with \`--space <name>\` or set a default with \`cotal use <name>\`.`;
32
+ return parts(`multiple meshes running: ${(d.available ?? []).join(", ")}`, "pick one with `--space <name>` or set a default with `cotal use <name>`");
23
33
  case "default-occupied":
24
- return `✗ another mesh ("${d.space}") is running at ${d.server} - run \`cotal up\` here to start yours, or \`--space ${d.space}\` to join it`;
34
+ return parts(`another mesh ("${d.space}") is running at ${brokerAddressForDisplay(d.server ?? "") ?? "an invalid broker address"}`, `run \`cotal up\` here to start yours, or \`--space ${d.space}\` to join it`);
25
35
  case "stale-auth-root":
26
36
  // An operator-registered entry is KEPT (only `cotal meshes rm` drops it), so the recovery
27
37
  // there is to point it at the right root — never a claim that it was removed for you.
28
38
  return d.removed === false
29
- ? `✗ registry entry "${d.space}" points at ${d.root}, whose auth is now for "${d.found}" - re-register it with \`cotal meshes add ${d.space} --server <url> --root <dir>\` (\`--force\` replaces), or \`cotal meshes rm ${d.space}\``
30
- : `✗ registry entry "${d.space}" points at ${d.root}, whose auth is now for "${d.found}" - stale entry removed; re-run \`cotal up\` or check \`cotal meshes\``;
39
+ ? parts(`registry entry "${d.space}" points at ${d.root}, whose auth is now for "${d.found}"`, `re-register it with \`cotal meshes add ${d.space} --server <url> --root <dir>\` (\`--force\` replaces), or \`cotal meshes rm ${d.space}\``)
40
+ : parts(`registry entry "${d.space}" points at ${d.root}, whose auth is now for "${d.found}"; stale entry removed`, "re-run `cotal up` or check `cotal meshes`");
31
41
  case "unreadable-auth":
32
- return `✗ space "${d.space}"'s trust material under ${d.root} will not load (${err.message}) - repair or remove the account record, then re-run \`cotal up\``;
42
+ return parts(`space "${d.space}"'s trust material under ${d.root} will not load (${err.message})`, "repair or remove the account record, then re-run `cotal up`");
43
+ case "not-started":
44
+ // A prepared space names itself. A root whose stack journal recorded a broker names that broker.
45
+ return d.space === undefined
46
+ ? parts(`the stack in ${d.root} recorded ${d.server === undefined ? "a broker" : `the broker ${brokerAddressForDisplay(d.server) ?? "at an invalid address"}`}, and no space is registered for it here`, `start it with \`cotal up\` in ${d.root}`)
47
+ : parts(`"${d.space}" is prepared but not started`, `start it with \`cotal up\` in ${d.root}`);
33
48
  case "user-auth-unrecorded":
34
49
  // U11: without a TRUSTED local record of the space's IdP there is no actionable
35
50
  // `cotal login --idp <?>` line to print — the honest recovery is re-registering the mesh
36
51
  // where its user-auth state lives, and remote discovery is explicitly not supported yet.
37
- return `✗ space "${d.space}" requires user auth, but no trusted IdP config for it is registered on this machine - re-run \`cotal up --user-auth\` in ${d.root ?? "its broker root"} to re-register it (user-auth spaces are configured where their broker runs; remote discovery is not supported yet)`;
52
+ return parts(`space "${d.space}" requires user auth, but no trusted IdP config for it is registered on this machine`, `re-run \`cotal up --user-auth\` in ${d.root ?? "its broker root"} to re-register it (user-auth spaces are configured where their broker runs; remote discovery is not supported yet)`);
38
53
  }
39
54
  }
40
55
  /** "Is it live" failures on a registry-resolved target — the classified preflight sentence. */
41
- function renderPreflightFailure(kind, t, pruned) {
56
+ function preflightFailureParts(kind, t, pruned) {
57
+ const server = brokerAddressForDisplay(t.server) ?? "an invalid broker address";
42
58
  switch (kind) {
43
59
  case "unreachable":
44
60
  // An operator-registered mesh usually runs on ANOTHER machine, so `cotal up` is the wrong
45
61
  // remedy here — this machine can only wait for it or stop pointing at it.
46
62
  if (t.origin === "manual" || t.origin === "catalog")
47
- return `✗ no broker answered at ${t.server} - "${t.space}" is registered here but its mesh is not up; start it where it runs, or \`cotal meshes rm ${t.space}\` to unregister it`;
63
+ return parts(`no broker answered at ${server}; "${t.space}" is registered here but its mesh is not up`, `start it where it runs, or \`cotal meshes rm ${t.space}\` to unregister it`);
48
64
  // An `up` / pre-origin record is KEPT on a liveness miss. Keep `no mesh running at`
49
65
  // so existing attach/mint cells still recognise the classified refusal, and name
50
66
  // the recorded root so the operator restarts THAT mesh, not a new one from cwd.
51
- return `✗ no mesh running at ${t.server} - mesh "${t.space}" is recorded at ${t.root} but not running; run \`cotal up\` there to restart`;
67
+ return parts(`no mesh running at ${server}; mesh "${t.space}" is recorded at ${t.root} but not running`, "run `cotal up` there to restart");
52
68
  // The registry-mismatch pair, like `unreachable`, must not prescribe `cotal up` for a mesh this
53
69
  // machine only registered: the repair there is the credentials under `--root`, or re-registering
54
70
  // the entry — `cotal up` would start a DIFFERENT, local mesh under that name.
55
71
  case "registry-creds-rejected":
56
72
  return t.origin === "manual" || t.origin === "catalog"
57
- ? `✗ mesh "${t.space}" at ${t.server} rejected the credentials under ${t.root} - re-mint them where that mesh runs, or re-register it with \`cotal meshes add ${t.space} --server <url> --root <dir> --force\``
58
- : `✗ mesh "${t.space}" at ${t.server} no longer matches its registry entry (credentials rejected - port reused?) - re-run \`cotal up\` from ${t.root}, or \`cotal meshes\` to see what's live`;
73
+ ? parts(`mesh "${t.space}" at ${server} rejected the credentials under ${t.root}`, `re-mint them where that mesh runs, or re-register it with \`cotal meshes add ${t.space} --server <url> --root <dir> --force\``)
74
+ : parts(`mesh "${t.space}" at ${server} no longer matches its registry entry (credentials rejected - port reused?)`, `re-run \`cotal up\` from ${t.root}, or \`cotal meshes\` to see what's live`);
59
75
  case "registry-open-now-auth":
60
76
  return t.origin === "manual" || t.origin === "catalog"
61
- ? `✗ "${t.space}" is registered as an open mesh, but the broker at ${t.server} requires auth - copy that mesh's account + creds under ${t.root} and re-register with \`cotal meshes add ${t.space} --server ${t.server} --mode auth --force\``
62
- : `✗ open mesh "${t.space}" at ${t.server} no longer matches its registry entry (broker now requires auth - port reused?) - re-run \`cotal up\` from ${t.root}, or \`cotal meshes\` to see what's live`;
77
+ ? parts(`"${t.space}" is registered as an open mesh, but the broker at ${server} requires auth`, `copy that mesh's account + creds under ${t.root} and re-register with \`cotal meshes add ${t.space} --server <url> --mode auth --force\``)
78
+ : parts(`open mesh "${t.space}" at ${server} no longer matches its registry entry (broker now requires auth - port reused?)`, `re-run \`cotal up\` from ${t.root}, or \`cotal meshes\` to see what's live`);
63
79
  case "creds-rejected":
64
- return `✗ credentials for "${t.space}" were rejected at ${t.server} - a different mesh may be running there. Run \`cotal meshes\` to check, or \`cotal up\` here to start yours`;
80
+ return parts(`credentials for "${t.space}" were rejected at ${server}; a different mesh may be running there`, "run `cotal meshes` to check, or `cotal up` here to start yours");
65
81
  case "open-wants-auth":
66
- return `✗ broker at ${t.server} requires auth, but this mesh is open (no trust material) - use \`--space <name>\` for an auth mesh, or run \`cotal up\` here without \`--open\``;
82
+ return parts(`broker at ${server} requires auth, but this mesh is open (no trust material)`, "use `--space <name>` for an auth mesh, or run `cotal up` here without `--open`");
67
83
  case "stale-auth":
68
- return `✗ credentials for "${t.space}" have EXPIRED - this mesh enforces bounded credential lifetimes; run \`cotal doctor auth\` in ${t.root} for the diagnosis + exact repair (the mesh itself is up)`;
84
+ return parts(`credentials for "${t.space}" have EXPIRED; this mesh enforces bounded credential lifetimes`, `run \`cotal doctor auth\` in ${t.root} for the diagnosis + exact repair (the mesh itself is up)`);
69
85
  case "tls-trust":
70
86
  // INFO advertised tls_required (shape evidence only — unauthenticated). Never claims removal
71
87
  // or peer identity; conservatively keep the record and point at the trust-store repair.
72
- return `✗ mesh "${t.space}" at ${t.server} requires TLS but this client could not complete the handshake (untrusted or missing CA?) - set \`NODE_EXTRA_CA_CERTS\` to the issuing CA for a private CA, or fix the trust store; a TLS-required NATS listener still greets there (INFO is unauthenticated — not mesh identity) so the registry entry was conservatively kept`;
88
+ return parts(`mesh "${t.space}" at ${server} requires TLS but this client could not complete the handshake (untrusted or missing CA?)`, "set `NODE_EXTRA_CA_CERTS` to the issuing CA for a private CA, or fix the trust store; a TLS-required NATS listener still greets there (INFO is unauthenticated — not mesh identity) so the registry entry was conservatively kept");
73
89
  case "slow-link":
74
90
  // No CA guidance here: the confirm probe never reached a conclusive answer, so there is no
75
91
  // trust evidence to diagnose. The broker answered TCP; only the credentialed connect ran out
76
92
  // of its budget.
77
- return `✗ mesh "${t.space}" at ${t.server} answered TCP but the credentialed connect did not complete within ${PREFLIGHT_CONFIRM_TIMEOUT_MS / 1000}s - the registry entry was kept; retry, or raise the connect budget if this link is consistently slow`;
93
+ return parts(`mesh "${t.space}" at ${server} answered TCP but the credentialed connect did not complete within ${PREFLIGHT_CONFIRM_TIMEOUT_MS / 1000}s; the registry entry was kept`, "retry, or raise the connect budget if this link is consistently slow");
78
94
  }
79
95
  }
80
96
  /** Plain reachability for a RAW (off-registry) probe — the `--creds` / `--server`+unregistered-`--space`
81
97
  * escape hatch, which never touches the registry (no prune, no stale-entry wording). */
82
- function renderReachable(reason, server, hasAuth) {
98
+ function reachableParts(reason, rawServer, hasAuth) {
99
+ const server = brokerAddressForDisplay(rawServer) ?? "an invalid broker address";
83
100
  if (reason === "stale-auth")
84
- return `✗ credential EXPIRED at ${server} - bounded lifetime reached (credential death); run \`cotal doctor auth\` where the mesh runs, or re-mint the credential`;
101
+ return parts(`credential EXPIRED at ${server}; bounded lifetime reached (credential death)`, "run `cotal doctor auth` where the mesh runs, or re-mint the credential");
85
102
  if (reason === "unreachable")
86
- return `✗ can't reach a broker at ${server} - is it running? (\`cotal up\`)`;
103
+ return parts(`can't reach a broker at ${server}`, "is it running? (`cotal up`)");
87
104
  if (reason === "timeout")
88
- return `✗ the connect to ${server} did not complete within ${PREFLIGHT_CONFIRM_TIMEOUT_MS / 1000}s - the broker may just be slow to reach; retry, or raise the connect budget if this link is consistently slow`;
105
+ return parts(`the connect to ${server} did not complete within ${PREFLIGHT_CONFIRM_TIMEOUT_MS / 1000}s; the broker may just be slow to reach`, "retry, or raise the connect budget if this link is consistently slow");
89
106
  // `auth-required` is two different user situations with two different repairs, and this path used
90
107
  // to collapse them. The registry path never did: `classifyPreflightFailure` branches on the same
91
108
  // bit into `creds-rejected` vs `open-wants-auth`. Told "credentials rejected" after sending NO
92
109
  // credentials, a caller goes looking for what is wrong with creds they never had, when the actual
93
110
  // next step is to obtain some.
94
111
  return hasAuth
95
- ? `✗ credentials rejected at ${server} - check your creds, or the broker wants different auth`
96
- : `✗ broker at ${server} requires auth, but no credentials were supplied - pass \`--creds <file>\`, or \`cotal join\` with a link/token`;
112
+ ? parts(`credentials rejected at ${server}`, "check your creds, or the broker wants different auth")
113
+ : parts(`broker at ${server} requires auth, but no credentials were supplied`, "pass `--creds <file>`, or `cotal join` with a link/token");
97
114
  }
98
115
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAkB9D,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,CAAiB;IACpD,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACpC,KAAK,WAAW;YACd,OAAO,sBAAsB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAC/D,KAAK,WAAW;YACd,OAAO,eAAe,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,qGAAqG;AACrG,SAAS,iBAAiB,CAAC,GAAoB;IAC7C,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACtB,QAAQ,GAAG,CA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AkE,EAClE,SAAiB,EACjB,OAAgB;IAEhB,MAAM,MAAM,GAAG,uBAAuB,CAAC,SAAS,CAAC,IAAI,2BAA2B,CAAC;IACjF,IAAI,MAAM,KAAK,YAAY;QACzB,OAAO,KAAK,CAAC,yBAAyB,MAAM,+CAA+C,EAAE,wEAAwE,CAAC,CAAC;IACzK,IAAI,MAAM,KAAK,aAAa;QAAE,OAAO,KAAK,CAAC,2BAA2B,MAAM,EAAE,EAAE,6BAA6B,CAAC,CAAC;IAC/G,IAAI,MAAM,KAAK,SAAS;QACtB,OAAO,KAAK,CAAC,kBAAkB,MAAM,4BAA4B,4BAA4B,GAAG,IAAI,yCAAyC,EAAE,sEAAsE,CAAC,CAAC;IACzN,kGAAkG;IAClG,iGAAiG;IACjG,+FAA+F;IAC/F,kGAAkG;IAClG,+BAA+B;IAC/B,OAAO,OAAO;QACZ,CAAC,CAAC,KAAK,CAAC,2BAA2B,MAAM,EAAE,EAAE,sDAAsD,CAAC;QACpG,CAAC,CAAC,KAAK,CAAC,aAAa,MAAM,kDAAkD,EAAE,0DAA0D,CAAC,CAAC;AAC/I,CAAC"}
@@ -0,0 +1,198 @@
1
+ import type { ControllerStackView } from "./maintenance.js";
2
+ import type { ProcessIdentityRecord } from "./pid.js";
3
+ import { type ServiceDefinitionInput } from "./service-definition.js";
4
+ /** Workstation ABI only. A declaration grants no native endpoint or OS process authority. */
5
+ export interface ServiceAdapterDeclaration {
6
+ readonly abiVersion: 1;
7
+ readonly requiresCli?: true;
8
+ readonly optionsSchema: Readonly<Record<string, unknown>>;
9
+ /** Top-level string options that reference local paths, never file contents. */
10
+ readonly paths?: Readonly<Record<string, "file" | "directory" | "private-file">>;
11
+ readonly capabilities: {
12
+ readonly multiInstance: boolean;
13
+ readonly foreground: boolean;
14
+ readonly logs: boolean;
15
+ };
16
+ /** `listener` is a launch-bound listener report from the exact pinned child, never endpoint serving. */
17
+ readonly readiness: "process" | "endpoint" | "listener";
18
+ /** Native stop hooks own their reservation, impact recheck and request-bound terminal evidence.
19
+ * `kernel-exit` stops only the exact pinned child and records the observed kernel exit; it has no
20
+ * native acknowledgement, endpoint identity or cleanup proof. */
21
+ readonly stop?: "native" | "kernel-exit";
22
+ }
23
+ export interface ServiceAdapterContext {
24
+ readonly space: string;
25
+ readonly definition: string;
26
+ readonly definitionRevision: string;
27
+ readonly instanceId: string;
28
+ readonly launchRequestId: string;
29
+ readonly stateDirectory: string;
30
+ readonly cliInvocation?: readonly string[];
31
+ readonly options: Readonly<Record<string, unknown>>;
32
+ readonly credentialRef?: ServiceDefinitionInput["credentialRef"];
33
+ /** Launch-only inputs bound to one maintenance attempt. Never part of a saved definition, an
34
+ * instance record or a receipt; only the controller's resume passes it, and each adapter accepts
35
+ * only its own closed fields (see {@link serviceAdapterAttempt}). */
36
+ readonly attempt?: ServiceAdapterAttempt;
37
+ /** Launch-only facts of the root's controller stack journal, passed to a manager-service launch
38
+ * while that root holds a maintenance journal. The adapter compares them through
39
+ * `admittedControllerRestore`; they grant nothing by themselves and are never saved. */
40
+ readonly stack?: ControllerStackView;
41
+ }
42
+ /** A resume attempt's per-launch inputs. `resumeCommit` names a protected handoff file by path and
43
+ * digest; the token bytes never travel here. */
44
+ export interface ServiceAdapterAttempt {
45
+ readonly kind: "maintenance-resume";
46
+ readonly attemptId: string;
47
+ readonly serverName?: string;
48
+ readonly resumeCommit?: {
49
+ readonly path: string;
50
+ readonly sha256: string;
51
+ };
52
+ }
53
+ /** A plan is returned only on an explicit start, before the controller launches its direct child.
54
+ * Providers must not launch processes, mint credentials or start dependencies while planning. */
55
+ export interface ServiceAdapterLaunch {
56
+ readonly executable: string;
57
+ readonly args: readonly string[];
58
+ readonly cwd: string;
59
+ }
60
+ /** A listener the exact pinned child reported for its own launch. It is not endpoint, trust or
61
+ * storage readiness, and a port answer alone never produces it. */
62
+ export interface ServiceAdapterListenerReport {
63
+ readonly kind: "nats-ports-file";
64
+ readonly nats: readonly string[];
65
+ }
66
+ export type ServiceAdapterReadiness = {
67
+ readonly state: "pending";
68
+ } | {
69
+ readonly state: "ready";
70
+ readonly process: ProcessIdentityRecord;
71
+ readonly observedAt: string;
72
+ readonly native?: {
73
+ readonly endpoint: string;
74
+ readonly instanceId: string;
75
+ readonly owner: string;
76
+ readonly actor: string;
77
+ readonly lifecycleUid: string;
78
+ readonly epoch: number;
79
+ };
80
+ /** Present only with `native`: the coordinates are the pinned child's own request-bound local
81
+ * receipt, not an attributed endpoint response. */
82
+ readonly evidence?: ServiceAdapterNativeEvidence;
83
+ readonly listener?: ServiceAdapterListenerReport;
84
+ };
85
+ export type ServiceAdapterNativeEvidence = "local-process-receipt";
86
+ export interface ServiceAdapterStopPlan {
87
+ readonly scopeSha256: string;
88
+ readonly observedAt: string;
89
+ readonly withAgents: boolean;
90
+ readonly native: NonNullable<Extract<ServiceAdapterReadiness, {
91
+ state: "ready";
92
+ }>["native"]>;
93
+ readonly evidence?: ServiceAdapterNativeEvidence;
94
+ readonly subjects: readonly {
95
+ readonly name: string;
96
+ readonly id: string;
97
+ readonly lifecycleUid: string;
98
+ readonly action: "stop" | "release-custody" | "stop-retaining-state";
99
+ }[];
100
+ /** A preserved-exit preview only, with `withAgents: false`: the scope binds this attempt and
101
+ * inventory digest. */
102
+ readonly preserved?: ServiceAdapterPreservedStop;
103
+ }
104
+ export interface ServiceAdapterPreservedStop {
105
+ readonly attemptId: string;
106
+ readonly inventorySha256: string;
107
+ }
108
+ export type ServiceAdapterStopContext = ServiceAdapterContext & {
109
+ readonly process: ProcessIdentityRecord;
110
+ readonly withAgents: boolean;
111
+ readonly signal: AbortSignal;
112
+ /** Present only for a preserved-exit stop. An adapter that does not declare it must refuse. */
113
+ readonly preserved?: ServiceAdapterPreservedStop;
114
+ };
115
+ export interface ServiceAdapterStopResult {
116
+ readonly requestId: string;
117
+ readonly scopeSha256: string;
118
+ readonly process: ProcessIdentityRecord;
119
+ /** `preserved-exit-returned` only answers a preserved request; the caller checks that pairing. */
120
+ readonly nativeStop: "returned" | "preserved-exit-returned";
121
+ readonly cleanup: "not-checked";
122
+ readonly observedAt: string;
123
+ }
124
+ /** The exact local broker configuration a kernel-exit stop is bound to. It names no mesh endpoint,
125
+ * principal or epoch, because a broker process has none. */
126
+ export interface ServiceAdapterBrokerBinding {
127
+ readonly kind: "nats-broker";
128
+ readonly root: string;
129
+ readonly space: string;
130
+ readonly server: string;
131
+ readonly configSha256: string;
132
+ }
133
+ /** Closed kernel-exit preview. Observation data only: it reserves nothing and grants no signal. */
134
+ export interface ServiceAdapterKernelStopPlan {
135
+ readonly kind: "kernel-exit";
136
+ readonly scopeSha256: string;
137
+ readonly observedAt: string;
138
+ readonly binding: ServiceAdapterBrokerBinding;
139
+ }
140
+ /** The observed exit of the exact pinned process after this request's signal. A removed ports file
141
+ * is the broker's own shutdown trace for that launch, not an acknowledgement or cleanup proof. */
142
+ export interface ServiceAdapterKernelStopResult {
143
+ readonly kind: "kernel-exit";
144
+ readonly requestId: string;
145
+ readonly scopeSha256: string;
146
+ readonly process: ProcessIdentityRecord;
147
+ readonly observation: "exact-process-exit";
148
+ readonly brokerShutdownTrace: "ports-file-removed" | "ports-file-retained";
149
+ readonly cleanup: "not-checked";
150
+ readonly observedAt: string;
151
+ }
152
+ export type ServiceAdapterKernelStopContext = ServiceAdapterContext & {
153
+ readonly process: ProcessIdentityRecord;
154
+ readonly signal: AbortSignal;
155
+ };
156
+ export interface ServiceAdapterHooks {
157
+ /** Kernel-exit stop scope: the exact binding and every dependant guard, rechecked at effect. */
158
+ readonly prepareKernelStop?: (context: ServiceAdapterKernelStopContext) => Promise<ServiceAdapterKernelStopPlan>;
159
+ /** After the exact process exit, report only the broker's own launch-bound shutdown trace. */
160
+ readonly observeKernelStop?: (context: ServiceAdapterContext & {
161
+ readonly process: ProcessIdentityRecord;
162
+ }) => "ports-file-removed" | "ports-file-retained";
163
+ readonly prepareServiceStop?: (context: ServiceAdapterStopContext) => Promise<ServiceAdapterStopPlan>;
164
+ readonly stopService?: (context: ServiceAdapterStopContext & {
165
+ readonly requestId: string;
166
+ readonly plan: ServiceAdapterStopPlan;
167
+ }) => Promise<ServiceAdapterStopResult>;
168
+ readonly buildServiceLaunch?: (context: ServiceAdapterContext) => ServiceAdapterLaunch | Promise<ServiceAdapterLaunch>;
169
+ readonly checkServiceReadiness?: (context: ServiceAdapterContext & {
170
+ readonly process: ProcessIdentityRecord;
171
+ readonly signal: AbortSignal;
172
+ }) => Promise<ServiceAdapterReadiness>;
173
+ }
174
+ /** Closed reader for a launch attempt, with the fields one adapter role may receive. Any other key
175
+ * refuses. Messages name fields, never values, because `resumeCommit` points at a secret file. */
176
+ export declare function serviceAdapterAttempt(input: unknown, allowed: readonly ("serverName" | "resumeCommit")[]): ServiceAdapterAttempt;
177
+ /** Finite JSON and sorted keys give cached declarations a stable fingerprint, not a signature. */
178
+ export declare function serviceMetadataDigest(value: unknown): string;
179
+ /** A deliberately closed, bounded JSON Schema subset. No references, regexes, formats, executable
180
+ * keywords, schema fetching, coercion, defaults or removal of unknown options are admitted. */
181
+ export declare function serviceAdapterDeclaration(input: unknown): ServiceAdapterDeclaration;
182
+ export declare function validateServiceAdapterOptions(declaration: ServiceAdapterDeclaration, options: Readonly<Record<string, unknown>>): void;
183
+ /** Public readiness evidence is closed and bound to a creation-pinned process. The installed
184
+ * adapter must itself correlate the native instance/lifecycle using its supported authority. */
185
+ export declare function serviceAdapterReadiness(input: unknown): ServiceAdapterReadiness;
186
+ /** Reference protection is checked without reading file contents or importing provider code. A
187
+ * refusal names the option, the path that failed and what that path's metadata shows. */
188
+ export declare function validateServiceAdapterPaths(declaration: ServiceAdapterDeclaration, options: Readonly<Record<string, unknown>>): void;
189
+ /** Full controller-assigned IDs only. These are local operation coordinates, not wire grants. */
190
+ export declare function serviceOperationId(value: unknown): string;
191
+ /** Closed public stop preview. It is observation data, never a reservation or native grant. */
192
+ export declare function serviceAdapterStopPlan(input: unknown, process: ProcessIdentityRecord): ServiceAdapterStopPlan;
193
+ /** Closed kernel-exit preview. A broker binding carries no fabricated endpoint identity. */
194
+ export declare function serviceAdapterKernelStopPlan(input: unknown): ServiceAdapterKernelStopPlan;
195
+ /** Closed kernel-exit receipt: observed exact process exit, never a broker acknowledgement. */
196
+ export declare function serviceAdapterKernelStopResult(input: unknown): ServiceAdapterKernelStopResult;
197
+ export declare function serviceAdapterStopResult(input: unknown): ServiceAdapterStopResult;
198
+ //# sourceMappingURL=service-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-adapter.d.ts","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAI3F,6FAA6F;AAC7F,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC;IACjF,QAAQ,CAAC,YAAY,EAAE;QAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACjH,wGAAwG;IACxG,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IACxD;;sEAEkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC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