@cotal-ai/workspace 0.100.1 → 0.101.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 (171) hide show
  1. package/build/Release/darwin-arm64/build.json +20 -0
  2. package/build/Release/darwin-arm64/process.node +0 -0
  3. package/build/Release/darwin-x64/build.json +20 -0
  4. package/build/Release/darwin-x64/process.node +0 -0
  5. package/build/Release/win32-arm64/build.json +4 -3
  6. package/build/Release/win32-x64/build.json +4 -3
  7. package/dist/agent-grants.d.ts +21 -0
  8. package/dist/agent-grants.d.ts.map +1 -0
  9. package/dist/agent-grants.js +21 -0
  10. package/dist/agent-grants.js.map +1 -0
  11. package/dist/auth-paths.d.ts +34 -0
  12. package/dist/auth-paths.d.ts.map +1 -1
  13. package/dist/auth-paths.js +99 -3
  14. package/dist/auth-paths.js.map +1 -1
  15. package/dist/broker-display.d.ts +12 -0
  16. package/dist/broker-display.d.ts.map +1 -1
  17. package/dist/broker-display.js +14 -0
  18. package/dist/broker-display.js.map +1 -1
  19. package/dist/connect.d.ts +21 -7
  20. package/dist/connect.d.ts.map +1 -1
  21. package/dist/connect.js +152 -22
  22. package/dist/connect.js.map +1 -1
  23. package/dist/control-target.d.ts.map +1 -1
  24. package/dist/control-target.js +12 -10
  25. package/dist/control-target.js.map +1 -1
  26. package/dist/cotal-config.d.ts +7 -0
  27. package/dist/cotal-config.d.ts.map +1 -1
  28. package/dist/cotal-config.js +29 -2
  29. package/dist/cotal-config.js.map +1 -1
  30. package/dist/cotal-home.d.ts +23 -0
  31. package/dist/cotal-home.d.ts.map +1 -0
  32. package/dist/cotal-home.js +36 -0
  33. package/dist/cotal-home.js.map +1 -0
  34. package/dist/credential-actions.d.ts +17 -3
  35. package/dist/credential-actions.d.ts.map +1 -1
  36. package/dist/credential-actions.js +62 -10
  37. package/dist/credential-actions.js.map +1 -1
  38. package/dist/darwin-process.d.ts +20 -0
  39. package/dist/darwin-process.d.ts.map +1 -0
  40. package/dist/darwin-process.js +24 -0
  41. package/dist/darwin-process.js.map +1 -0
  42. package/dist/deprecated-daemon-entries.d.ts +3 -0
  43. package/dist/deprecated-daemon-entries.d.ts.map +1 -1
  44. package/dist/deprecated-daemon-entries.js +6 -1
  45. package/dist/deprecated-daemon-entries.js.map +1 -1
  46. package/dist/extensions.d.ts +4 -2
  47. package/dist/extensions.d.ts.map +1 -1
  48. package/dist/extensions.js +7 -2
  49. package/dist/extensions.js.map +1 -1
  50. package/dist/flags.d.ts +2 -0
  51. package/dist/flags.d.ts.map +1 -1
  52. package/dist/flags.js +1 -1
  53. package/dist/flags.js.map +1 -1
  54. package/dist/index.d.ts +7 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +7 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/join-target.d.ts +3 -1
  59. package/dist/join-target.d.ts.map +1 -1
  60. package/dist/join-target.js +15 -3
  61. package/dist/join-target.js.map +1 -1
  62. package/dist/maintenance.d.ts +61 -2
  63. package/dist/maintenance.d.ts.map +1 -1
  64. package/dist/maintenance.js +153 -14
  65. package/dist/maintenance.js.map +1 -1
  66. package/dist/manager-name.d.ts +15 -0
  67. package/dist/manager-name.d.ts.map +1 -0
  68. package/dist/manager-name.js +54 -0
  69. package/dist/manager-name.js.map +1 -0
  70. package/dist/mesh-registry.d.ts +39 -35
  71. package/dist/mesh-registry.d.ts.map +1 -1
  72. package/dist/mesh-registry.js +57 -36
  73. package/dist/mesh-registry.js.map +1 -1
  74. package/dist/mesh-target.d.ts +120 -3
  75. package/dist/mesh-target.d.ts.map +1 -1
  76. package/dist/mesh-target.js +319 -48
  77. package/dist/mesh-target.js.map +1 -1
  78. package/dist/official-connectors.d.ts +3 -0
  79. package/dist/official-connectors.d.ts.map +1 -1
  80. package/dist/official-connectors.js +5 -0
  81. package/dist/official-connectors.js.map +1 -1
  82. package/dist/output.d.ts +34 -6
  83. package/dist/output.d.ts.map +1 -1
  84. package/dist/output.js +38 -5
  85. package/dist/output.js.map +1 -1
  86. package/dist/pid.d.ts +42 -7
  87. package/dist/pid.d.ts.map +1 -1
  88. package/dist/pid.js +189 -26
  89. package/dist/pid.js.map +1 -1
  90. package/dist/preferences.d.ts +25 -3
  91. package/dist/preferences.d.ts.map +1 -1
  92. package/dist/preferences.js +77 -14
  93. package/dist/preferences.js.map +1 -1
  94. package/dist/preflight.d.ts +17 -5
  95. package/dist/preflight.d.ts.map +1 -1
  96. package/dist/preflight.js +22 -32
  97. package/dist/preflight.js.map +1 -1
  98. package/dist/prepared-spaces.d.ts +20 -2
  99. package/dist/prepared-spaces.d.ts.map +1 -1
  100. package/dist/prepared-spaces.js +90 -15
  101. package/dist/prepared-spaces.js.map +1 -1
  102. package/dist/present.d.ts +2 -12
  103. package/dist/present.d.ts.map +1 -1
  104. package/dist/present.js +24 -40
  105. package/dist/present.js.map +1 -1
  106. package/dist/protected-records.d.ts +22 -3
  107. package/dist/protected-records.d.ts.map +1 -1
  108. package/dist/protected-records.js +198 -27
  109. package/dist/protected-records.js.map +1 -1
  110. package/dist/registration-policy.d.ts +2 -1
  111. package/dist/registration-policy.d.ts.map +1 -1
  112. package/dist/render.d.ts +2 -1
  113. package/dist/render.d.ts.map +1 -1
  114. package/dist/render.js +42 -11
  115. package/dist/render.js.map +1 -1
  116. package/dist/renewal.d.ts +4 -0
  117. package/dist/renewal.d.ts.map +1 -1
  118. package/dist/renewal.js +20 -1
  119. package/dist/renewal.js.map +1 -1
  120. package/dist/service-adapter.d.ts +1 -2
  121. package/dist/service-adapter.d.ts.map +1 -1
  122. package/dist/service-adapter.js +9 -4
  123. package/dist/service-adapter.js.map +1 -1
  124. package/dist/service-custody.js +2 -2
  125. package/dist/service-custody.js.map +1 -1
  126. package/dist/service-definition.d.ts +3 -0
  127. package/dist/service-definition.d.ts.map +1 -1
  128. package/dist/service-definition.js +56 -2
  129. package/dist/service-definition.js.map +1 -1
  130. package/dist/service-definition.schema.json +2 -1
  131. package/dist/service-identity.js +4 -4
  132. package/dist/service-identity.js.map +1 -1
  133. package/dist/service-stop.js +3 -3
  134. package/dist/service-stop.js.map +1 -1
  135. package/dist/service-target.d.ts.map +1 -1
  136. package/dist/service-target.js +9 -2
  137. package/dist/service-target.js.map +1 -1
  138. package/dist/signer-export.d.ts +1 -0
  139. package/dist/signer-export.d.ts.map +1 -1
  140. package/dist/signer-export.js +20 -4
  141. package/dist/signer-export.js.map +1 -1
  142. package/dist/space-streams.d.ts +18 -0
  143. package/dist/space-streams.d.ts.map +1 -0
  144. package/dist/space-streams.js +41 -0
  145. package/dist/space-streams.js.map +1 -0
  146. package/dist/space.d.ts +5 -0
  147. package/dist/space.d.ts.map +1 -1
  148. package/dist/space.js +5 -0
  149. package/dist/space.js.map +1 -1
  150. package/dist/store-entries.d.ts +6 -0
  151. package/dist/store-entries.d.ts.map +1 -0
  152. package/dist/store-entries.js +17 -0
  153. package/dist/store-entries.js.map +1 -0
  154. package/dist/system-rotation.d.ts +3 -1
  155. package/dist/system-rotation.d.ts.map +1 -1
  156. package/dist/system-rotation.js +19 -4
  157. package/dist/system-rotation.js.map +1 -1
  158. package/dist/telemetry.d.ts +4 -3
  159. package/dist/telemetry.d.ts.map +1 -1
  160. package/dist/telemetry.js +13 -6
  161. package/dist/telemetry.js.map +1 -1
  162. package/dist/text-wrap.d.ts +18 -0
  163. package/dist/text-wrap.d.ts.map +1 -0
  164. package/dist/text-wrap.js +60 -0
  165. package/dist/text-wrap.js.map +1 -0
  166. package/native/README.md +5 -3
  167. package/native/darwin-process.c +173 -0
  168. package/package.json +2 -2
  169. package/scripts/assert-shipped-natives.mjs +3 -3
  170. package/scripts/build-native.mjs +39 -25
  171. package/scripts/native-contract.mjs +36 -16
@@ -0,0 +1,15 @@
1
+ import { type LocalProcessContext } from "./local-process.js";
2
+ /** The name a manager started without one puts on its presence card. */
3
+ export declare const DEFAULT_MANAGER_NAME = "manager";
4
+ /** Where a root keeps the name of its manager for one space. The name belongs to the logical
5
+ * instance, which persists in the root across restarts, so a restart or a repair keeps it. */
6
+ export declare const MANAGER_NAME_RECORD = "manager.{space}.name.json";
7
+ /** Whether `value` has the shape of a manager instance id, which `--on` reads as an id. */
8
+ export declare function instanceIdShaped(value: string): boolean;
9
+ /** Check a manager name: the shared display-name rules, and not the shape of an instance id. */
10
+ export declare function assertManagerName(name: string): string;
11
+ /** The name recorded for this root's manager, or undefined when none was given. */
12
+ export declare function readManagerName(context: LocalProcessContext): string | undefined;
13
+ /** Record `name` as this root's manager name for the space. */
14
+ export declare function recordManagerName(context: LocalProcessContext, name: string): void;
15
+ //# sourceMappingURL=manager-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager-name.d.ts","sourceRoot":"","sources":["../src/manager-name.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzF,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C;+FAC+F;AAC/F,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAUhF;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAElF"}
@@ -0,0 +1,54 @@
1
+ import { assertLifecycleToken, assertValidName, writeSecretFileAtomic } from "@cotal-ai/core";
2
+ import { canonicalLocalProcessPath } from "./local-process.js";
3
+ import { CommandFailure } from "./output.js";
4
+ import { localRecordObject, localRecordText, readLocalRecordSource } from "./protected-records.js";
5
+ /** The name a manager started without one puts on its presence card. */
6
+ export const DEFAULT_MANAGER_NAME = "manager";
7
+ /** Where a root keeps the name of its manager for one space. The name belongs to the logical
8
+ * instance, which persists in the root across restarts, so a restart or a repair keeps it. */
9
+ export const MANAGER_NAME_RECORD = "manager.{space}.name.json";
10
+ /** Whether `value` has the shape of a manager instance id, which `--on` reads as an id. */
11
+ export function instanceIdShaped(value) {
12
+ try {
13
+ assertLifecycleToken(value);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ /** Check a manager name: the shared display-name rules, and not the shape of an instance id. */
21
+ export function assertManagerName(name) {
22
+ try {
23
+ assertValidName(name);
24
+ }
25
+ catch (error) {
26
+ throw new CommandFailure("refused", "USAGE_INVALID", error.message.replace(/^invalid name/, "invalid manager name"));
27
+ }
28
+ if (instanceIdShaped(name))
29
+ throw new CommandFailure("refused", "USAGE_INVALID", `manager name "${name}" has the shape of an instance id, so --on would read it as one; choose a name that is not 26 to 32 lowercase letters and digits`);
30
+ return name;
31
+ }
32
+ /** The name recorded for this root's manager, or undefined when none was given. */
33
+ export function readManagerName(context) {
34
+ const path = canonicalLocalProcessPath(MANAGER_NAME_RECORD, context);
35
+ const bytes = readLocalRecordSource(path, 4096, true);
36
+ if (bytes === undefined)
37
+ return undefined;
38
+ let value;
39
+ try {
40
+ value = JSON.parse(bytes.toString("utf8"));
41
+ }
42
+ catch {
43
+ throw new CommandFailure("refused", "SCHEMA_INVALID", "the manager name record is not valid JSON", { target: { path } });
44
+ }
45
+ const record = localRecordObject(value, ["version", "name"]);
46
+ if (record.version !== 1)
47
+ throw new CommandFailure("refused", "SCHEMA_INVALID", "the manager name record has an unsupported version", { target: { path } });
48
+ return assertManagerName(localRecordText(record.name, 128));
49
+ }
50
+ /** Record `name` as this root's manager name for the space. */
51
+ export function recordManagerName(context, name) {
52
+ writeSecretFileAtomic(canonicalLocalProcessPath(MANAGER_NAME_RECORD, context), JSON.stringify({ version: 1, name: assertManagerName(name) }));
53
+ }
54
+ //# sourceMappingURL=manager-name.js.map
@@ -0,0 +1 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,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;IACnD,MAAM,CAAC;QAAC,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,gBAAgB,EAAE,2CAA2C,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAAC,CAAC;IACnI,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC;QAAE,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,gBAAgB,EAAE,oDAAoD,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5J,OAAO,iBAAiB,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,OAA4B,EAAE,IAAY;IAC1E,qBAAqB,CAAC,yBAAyB,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAChJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { homeCotalDir, userCotalDir } from "./cotal-home.js";
1
2
  /**
2
3
  * The registry of meshes this machine can reach, so a `cotal spawn` from *any* directory can find
3
4
  * which mesh to join, with which creds and personas. One record per broker `cotal up` started here,
@@ -117,6 +118,10 @@ export interface MeshEntry {
117
118
  * rather than reading agreement out of an address. Absent means no such acceptance was given,
118
119
  * which is every record written before the flag existed. */
119
120
  unencryptedOverlay?: boolean;
121
+ /** Present and true when `space add --force` wrote the record without checking the broker, so its
122
+ * `mode` is what the operator gave, not what the broker was seen to enforce. Absent means it was
123
+ * checked, or the record predates this field. */
124
+ unchecked?: boolean;
120
125
  /** ISO timestamp of when the record was written. */
121
126
  ts: string;
122
127
  }
@@ -162,24 +167,9 @@ export interface UserAuthInfo {
162
167
  * workstation layer owns this shape (core stays IdP-agnostic), so the boundary where an
163
168
  * arbitrary provider's metadata enters the registry is checked here, fail-loud. */
164
169
  export declare function assertUserAuthInfo(v: unknown): UserAuthInfo;
165
- /** The cotal machine-home dir, overridable via `COTAL_HOME`.
166
- *
167
- * WHAT THE OVERRIDE ENFORCES (and only this): the mesh registry (`meshes/`), the current-mesh
168
- * pointer, the onboard marker, prepared spaces (`prepared/`) and service records (`services/`)
169
- * resolve under this directory. POSIX default `~/.cotal`; Windows `%LOCALAPPDATA%\Cotal`.
170
- *
171
- * WHAT IT DOES NOT ENFORCE: project-root state. `cotal up`, broker launch policy
172
- * (`.cotal/broker-policy.json`), the NATS store, manager/delivery pidfiles, and auth material all
173
- * resolve via {@link findCotalRoot} (walk up from cwd for a `.cotal/`). Setting only `COTAL_HOME`
174
- * does not redirect those paths. A test or probe that sets `COTAL_HOME` and runs a real
175
- * `cotal up` from a tree whose walked root is the operator home can still write live operator
176
- * config. Sandbox the project root too (temp dir with its own `.cotal/`, and run the CLI with
177
- * `cwd` there) — or you have sandboxed the registry label, not the launch surface. */
178
- export declare function homeCotalDir(): string;
179
- /** The OS user's own Cotal directory, which `COTAL_HOME` never redirects: POSIX `~/.cotal`, Windows
180
- * `%LOCALAPPDATA%\Cotal`. Telemetry keeps its settings here, so every workspace one person runs
181
- * under their own account shares one install id. */
182
- export declare function userCotalDir(): string;
170
+ /** Why `COTAL_HOME` can hold no record, or undefined when it is unset, a directory, or not created
171
+ * yet. A file, or a path under one, can never be read or written as the machine-home dir. */
172
+ export declare function cotalHomeProblem(): string | undefined;
183
173
  /** The variables {@link homeCotalDir} falls back to on `platform` when `COTAL_HOME` is unset:
184
174
  * `homedir()` reads `HOME` on POSIX, and Windows reads `LOCALAPPDATA`, then `USERPROFILE`. */
185
175
  export declare function homeCotalDirFallbacks(platform?: NodeJS.Platform): readonly string[];
@@ -200,28 +190,29 @@ export declare function removeMesh(space: string): void;
200
190
  * can act on each removal before the next one. An empty batch touches nothing. */
201
191
  export declare function removeMeshes(spaces: Iterable<string>): void;
202
192
  /**
203
- * Drop a record because an automatic sweep decided it should leave — as opposed to the operator
204
- * saying so. Returns whether the record was actually removed.
205
- *
206
- * Every automatic deletion goes through here rather than {@link removeMesh}, because the rule is one
207
- * rule and forgetting it at a single site is the whole failure. A `manual` record (`cotal meshes
208
- * add`) is NEVER auto-pruned. An `up` record (and a pre-origin record, which is `up`) is kept on a
209
- * liveness miss: the broker being down is a STATE the surfaces report (`offline`), not proof the
210
- * operator no longer wants the root. A mismatch — credentials rejected, an open record whose
211
- * broker now requires auth, or a root whose on-disk auth is now for a different space — still
212
- * drops an `up` record, because connecting through it would mint against the wrong mesh. A sleeping
213
- * laptop or a VPN blip must not unregister a perfectly healthy remote mesh (observed exactly once,
214
- * and once was enough), and the same erasure of a stopped local stack is the existence denial this
215
- * helper exists to prevent. `cotal meshes rm` / `cotal down` are how a kept record leaves.
193
+ * Drop a mismatched `up` record (including a pre-origin record). Returns whether it was removed.
194
+ * Call only after a credentials, mode, or on-disk space mismatch. A liveness miss is reported as
195
+ * `offline` without calling this helper. Manual and catalog records are never auto-pruned.
196
+ * Explicit removal belongs to {@link removeMesh} (`cotal meshes rm` / `cotal down`).
216
197
  */
217
- export type PruneReason = "gone" | "mismatch";
218
- export declare function pruneMesh(space: string, reason?: PruneReason): boolean;
198
+ export declare function pruneMesh(space: string): boolean;
219
199
  /** Canonicalize a project root for comparison. A recorded root is whatever spelling `cotal up` was
220
200
  * run under, so the same directory reaches us by several names: a symlinked root (macOS `/var` →
221
201
  * `/private/var`) or, on Windows, an 8.3 short name (`C:\Users\RUNNER~1\…`) — `process.cwd()` keeps
222
202
  * the short form there rather than expanding it. realpath collapses both. Falls back to `resolve`
223
203
  * for a root that no longer exists on disk. */
224
204
  export declare function canonicalRoot(p: string): string;
205
+ /** When this folder holds the records of `space`, started in `recordedRoot`, and was moved away from
206
+ * there: the sentence that says so and the way back. Only a folder whose stack journal names that
207
+ * root was moved from it. */
208
+ export declare function movedProject(space: string, recordedRoot: string): {
209
+ message: string;
210
+ remedy: string;
211
+ target: {
212
+ root: string;
213
+ recordedRoot: string;
214
+ };
215
+ } | undefined;
225
216
  /** Every registry entry recorded for THIS project root, matched {@link canonicalRoot}-wise so a
226
217
  * differently-spelled root still matches. The root is the only sound key for a local operation on
227
218
  * an OPEN mesh, which has no auth material to resolve its space NAME from — that would fall back
@@ -234,7 +225,9 @@ export declare function meshesForRoot(root: string): MeshEntry[];
234
225
  * or wiped (`cotal down` / `cotal clean all`), releasing the `current` pointer if it names one.
235
226
  * `keep` names a space the caller records again as prepared, as a controller stack's `down` does:
236
227
  * a selection naming it stays, so the next bare command refuses that stopped space rather than
237
- * falling through to another one. Returns the removed space names.
228
+ * falling through to another one. `retain` names a space whose registration stays, with a selection
229
+ * naming it, as a legacy `down` keeps one that {@link keepsRegistration}. Returns the removed space
230
+ * names.
238
231
  *
239
232
  * OPERATOR-REGISTERED entries are skipped. The root is shared, not owned: `cotal meshes add`
240
233
  * defaults `--root` to the project you run it in, so registering a mesh that runs elsewhere from
@@ -243,7 +236,11 @@ export declare function meshesForRoot(root: string): MeshEntry[];
243
236
  * rewrite what `up` wrote; nothing rewrites a hand-registered record). `cotal meshes rm` is how one
244
237
  * of those leaves.
245
238
  */
246
- export declare function removeMeshesByRoot(root: string, keep?: string): string[];
239
+ export declare function removeMeshesByRoot(root: string, keep?: string, retain?: string): string[];
240
+ /** Whether a stack's `down` keeps this registration: a space named after its own folder stays
241
+ * registered while stopped, so the name stays that folder's and another folder's bare `up` cannot
242
+ * take it. `space forget` frees it. */
243
+ export declare function keepsRegistration(entry: Pick<MeshEntry, "space" | "root">): boolean;
247
244
  /** The entries this root actually RUNS — what a local teardown or wipe may act on. The complement
248
245
  * of the skip in {@link removeMeshesByRoot}, exported so a caller that guards on "is this root's
249
246
  * mesh still live" asks about its OWN mesh: a hand-registered record co-rooted here points at a
@@ -258,8 +255,15 @@ export declare class MeshRegistryError extends Error {
258
255
  /** Brand for cross-package-safe detection, as {@link isMeshRegistryError} reads it. */
259
256
  readonly brand = "cotal:workspace:mesh-registry-error";
260
257
  readonly file: string;
258
+ /** A one-line account for a refusal, repeating no stored value, when calling the file an unreadable
259
+ * registry record would not fit. */
260
+ readonly summary?: string;
261
+ /** The step that clears it, when it is not the restore or remove a damaged record takes. */
262
+ readonly remedy?: string;
261
263
  constructor(file: string, message: string, options?: {
262
264
  cause?: unknown;
265
+ summary?: string;
266
+ remedy?: string;
263
267
  });
264
268
  }
265
269
  /** Detect a {@link MeshRegistryError} without `instanceof`, which two installed copies of this
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-registry.d.ts","sourceRoot":"","sources":["../src/mesh-registry.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,SAAS;IACxB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;IACb;;8FAE0F;IAC1F,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B;;;6FAGyF;IACzF,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;2GACuG;IACvG,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE,CAAC;IAChC;;;;;;wGAMoG;IACpG,UAAU,CA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Sync, readdirSync, realpathSync, renameSync, rmSync } from "node:fs";
2
- import { homedir } from "node:os";
3
- import { isAbsolute, join, resolve } from "node:path";
1
+ import { existsSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync } from "node:fs";
2
+ import { basename, isAbsolute, join, resolve } from "node:path";
4
3
  import { mkSecretDir, writeSecretFile } from "@cotal-ai/core";
5
- import { spaceSegment } from "./auth-paths.js";
4
+ import { findCotalRoot, movedRootRemedy, spaceSegment, stackJournalRoot } from "./auth-paths.js";
5
+ import { homeCotalDir } from "./cotal-home.js";
6
+ import { prepareCotalHomeForWrite } from "./protected-records.js";
7
+ export { homeCotalDir, userCotalDir } from "./cotal-home.js";
6
8
  /** Runtime-validate a provider's opaque `publicAuth` blob into a {@link UserAuthInfo} — the
7
9
  * workstation layer owns this shape (core stays IdP-agnostic), so the boundary where an
8
10
  * arbitrary provider's metadata enters the registry is checked here, fail-loud. */
@@ -36,31 +38,21 @@ export function assertUserAuthInfo(v) {
36
38
  ...(o.remote === true ? { remote: true } : {}),
37
39
  ...(o.sentinelCredsPath ? { sentinelCredsPath: o.sentinelCredsPath } : {}) };
38
40
  }
39
- /** The cotal machine-home dir, overridable via `COTAL_HOME`.
40
- *
41
- * WHAT THE OVERRIDE ENFORCES (and only this): the mesh registry (`meshes/`), the current-mesh
42
- * pointer, the onboard marker, prepared spaces (`prepared/`) and service records (`services/`)
43
- * resolve under this directory. POSIX default `~/.cotal`; Windows `%LOCALAPPDATA%\Cotal`.
44
- *
45
- * WHAT IT DOES NOT ENFORCE: project-root state. `cotal up`, broker launch policy
46
- * (`.cotal/broker-policy.json`), the NATS store, manager/delivery pidfiles, and auth material all
47
- * resolve via {@link findCotalRoot} (walk up from cwd for a `.cotal/`). Setting only `COTAL_HOME`
48
- * does not redirect those paths. A test or probe that sets `COTAL_HOME` and runs a real
49
- * `cotal up` from a tree whose walked root is the operator home can still write live operator
50
- * config. Sandbox the project root too (temp dir with its own `.cotal/`, and run the CLI with
51
- * `cwd` there) — or you have sandboxed the registry label, not the launch surface. */
52
- export function homeCotalDir() {
53
- if (process.env.COTAL_HOME)
54
- return process.env.COTAL_HOME;
55
- return userCotalDir();
56
- }
57
- /** The OS user's own Cotal directory, which `COTAL_HOME` never redirects: POSIX `~/.cotal`, Windows
58
- * `%LOCALAPPDATA%\Cotal`. Telemetry keeps its settings here, so every workspace one person runs
59
- * under their own account shares one install id. */
60
- export function userCotalDir() {
61
- if (process.platform === "win32" && process.env.LOCALAPPDATA)
62
- return join(process.env.LOCALAPPDATA, "Cotal");
63
- return join(homedir(), ".cotal");
41
+ /** Why `COTAL_HOME` can hold no record, or undefined when it is unset, a directory, or not created
42
+ * yet. A file, or a path under one, can never be read or written as the machine-home dir. */
43
+ export function cotalHomeProblem() {
44
+ const home = process.env.COTAL_HOME;
45
+ if (!home)
46
+ return undefined;
47
+ try {
48
+ if (statSync(home).isDirectory())
49
+ return undefined;
50
+ }
51
+ catch (e) {
52
+ if (e.code !== "ENOTDIR")
53
+ return undefined;
54
+ }
55
+ return `COTAL_HOME ${home} is not a directory, so it can hold no Cotal records`;
64
56
  }
65
57
  /** The variables {@link homeCotalDir} falls back to on `platform` when `COTAL_HOME` is unset:
66
58
  * `homedir()` reads `HOME` on POSIX, and Windows reads `LOCALAPPDATA`, then `USERPROFILE`. */
@@ -144,6 +136,7 @@ export function recordMeshes(entries) {
144
136
  // The filenames in here ARE the space names, so a world-traversable dir would leak them to other
145
137
  // local users even though the file contents are private. Keep the dir readable only by us
146
138
  // (0700 POSIX / hardened ACL win32).
139
+ prepareCotalHomeForWrite();
147
140
  mkSecretDir(meshesDir());
148
141
  const file = meshFile(m.space);
149
142
  // Per-process temp name so two concurrent `up`s for the same space can't stomp each other's
@@ -170,12 +163,16 @@ export function removeMeshes(spaces) {
170
163
  removeLegacyMeshFiles([space], (legacy ??= legacyMeshFiles())); // else a pre-hex record would resurrect the mesh in every listing
171
164
  }
172
165
  }
173
- export function pruneMesh(space, reason = "gone") {
166
+ /**
167
+ * Drop a mismatched `up` record (including a pre-origin record). Returns whether it was removed.
168
+ * Call only after a credentials, mode, or on-disk space mismatch. A liveness miss is reported as
169
+ * `offline` without calling this helper. Manual and catalog records are never auto-pruned.
170
+ * Explicit removal belongs to {@link removeMesh} (`cotal meshes rm` / `cotal down`).
171
+ */
172
+ export function pruneMesh(space) {
174
173
  const m = findMesh(space);
175
174
  if (!m || m.origin === "manual" || m.origin === "catalog")
176
175
  return false;
177
- if (reason === "gone")
178
- return false;
179
176
  removeMesh(space);
180
177
  return true;
181
178
  }
@@ -192,6 +189,15 @@ export function canonicalRoot(p) {
192
189
  return resolve(p);
193
190
  }
194
191
  }
192
+ /** When this folder holds the records of `space`, started in `recordedRoot`, and was moved away from
193
+ * there: the sentence that says so and the way back. Only a folder whose stack journal names that
194
+ * root was moved from it. */
195
+ export function movedProject(space, recordedRoot) {
196
+ const here = findCotalRoot();
197
+ if (canonicalRoot(here) === canonicalRoot(recordedRoot) || stackJournalRoot(here) !== recordedRoot)
198
+ return undefined;
199
+ return { message: `mesh "${space}" was started in ${recordedRoot}, and this folder ${here} holds its records, so this folder was moved from there`, remedy: movedRootRemedy(recordedRoot), target: { root: here, recordedRoot } };
200
+ }
195
201
  /** Every registry entry recorded for THIS project root, matched {@link canonicalRoot}-wise so a
196
202
  * differently-spelled root still matches. The root is the only sound key for a local operation on
197
203
  * an OPEN mesh, which has no auth material to resolve its space NAME from — that would fall back
@@ -221,7 +227,9 @@ function removeMeshesReleasingCurrent(spaces, keep) {
221
227
  * or wiped (`cotal down` / `cotal clean all`), releasing the `current` pointer if it names one.
222
228
  * `keep` names a space the caller records again as prepared, as a controller stack's `down` does:
223
229
  * a selection naming it stays, so the next bare command refuses that stopped space rather than
224
- * falling through to another one. Returns the removed space names.
230
+ * falling through to another one. `retain` names a space whose registration stays, with a selection
231
+ * naming it, as a legacy `down` keeps one that {@link keepsRegistration}. Returns the removed space
232
+ * names.
225
233
  *
226
234
  * OPERATOR-REGISTERED entries are skipped. The root is shared, not owned: `cotal meshes add`
227
235
  * defaults `--root` to the project you run it in, so registering a mesh that runs elsewhere from
@@ -230,11 +238,17 @@ function removeMeshesReleasingCurrent(spaces, keep) {
230
238
  * rewrite what `up` wrote; nothing rewrites a hand-registered record). `cotal meshes rm` is how one
231
239
  * of those leaves.
232
240
  */
233
- export function removeMeshesByRoot(root, keep) {
234
- const removed = localMeshesForRoot(root).map((m) => m.space);
241
+ export function removeMeshesByRoot(root, keep, retain) {
242
+ const removed = localMeshesForRoot(root).map((m) => m.space).filter((space) => space !== retain);
235
243
  removeMeshesReleasingCurrent(removed, keep);
236
244
  return removed;
237
245
  }
246
+ /** Whether a stack's `down` keeps this registration: a space named after its own folder stays
247
+ * registered while stopped, so the name stays that folder's and another folder's bare `up` cannot
248
+ * take it. `space forget` frees it. */
249
+ export function keepsRegistration(entry) {
250
+ return entry.space === basename(canonicalRoot(entry.root));
251
+ }
238
252
  /** The entries this root actually RUNS — what a local teardown or wipe may act on. The complement
239
253
  * of the skip in {@link removeMeshesByRoot}, exported so a caller that guards on "is this root's
240
254
  * mesh still live" asks about its OWN mesh: a hand-registered record co-rooted here points at a
@@ -268,10 +282,17 @@ export class MeshRegistryError extends Error {
268
282
  /** Brand for cross-package-safe detection, as {@link isMeshRegistryError} reads it. */
269
283
  brand = MESH_REGISTRY_ERROR;
270
284
  file;
285
+ /** A one-line account for a refusal, repeating no stored value, when calling the file an unreadable
286
+ * registry record would not fit. */
287
+ summary;
288
+ /** The step that clears it, when it is not the restore or remove a damaged record takes. */
289
+ remedy;
271
290
  constructor(file, message, options) {
272
291
  super(message, options);
273
292
  this.name = "MeshRegistryError";
274
293
  this.file = file;
294
+ this.summary = options?.summary;
295
+ this.remedy = options?.remedy;
275
296
  }
276
297
  }
277
298
  /** Detect a {@link MeshRegistryError} without `instanceof`, which two installed copies of this
@@ -409,7 +430,7 @@ export function readCurrent() {
409
430
  return space;
410
431
  }
411
432
  export function setCurrent(space) {
412
- mkSecretDir(homeCotalDir());
433
+ prepareCotalHomeForWrite();
413
434
  writeSecretFile(currentFile(), space);
414
435
  }
415
436
  export function clearCurrent() {
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-registry.js","sourceRoot":"","sources":["../src/mesh-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA0J/C;;oFAEoF;AACpF,MAAM,UAAU,kBAAkB,CAAC,CAAU;IAC3C,MAAM,CAAC,GAAG,CAAiB,CAAC;IAC5B,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ;QACtF,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG;QAC1F,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ;QAC5G,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACrG,IAAI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AAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED;;oBAEoB;AACpB,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC;QACH,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;kDAGkD;AAClD,MAAM,UAAU,WAAW;IACzB,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC;QACH,KAAK,GAAG,YAAY,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAK,CAA2B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACrE,MAAM,IAAI,iBAAiB,CAAC,WAAW,EAAE,EAAE,GAAG,WAAW,EAAE,uBAAwB,CAAW,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1H,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,iBAAiB,CAAC,WAAW,EAAE,EAAE,GAAG,WAAW,EAAE,yEAAyE,CAAC,CAAC;IAClJ,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,wBAAwB,EAAE,CAAC;IAC3B,eAAe,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC"}
@@ -35,6 +35,10 @@ export interface MeshTarget {
35
35
  * the broker is down: an `up` mesh is restarted with `cotal up`, a `manual` one runs somewhere
36
36
  * this machine does not control (so the local remedy is `cotal meshes rm`, not `cotal up`). */
37
37
  origin?: MeshEntry["origin"];
38
+ /** For a broker address `--server` supplied: the address this machine records for the target's
39
+ * space, when it records one for this root. A probe of another address says nothing about that
40
+ * space's mesh, and surfaces read this to say which address did not answer. */
41
+ recordedServer?: string;
38
42
  /** `<root>/.cotal/agents` — the persona catalog for this mesh. */
39
43
  personaRoot: string;
40
44
  /** For `local-space`: the root's `.cotal/` holds records but names no space, as after `space
@@ -100,9 +104,32 @@ export interface MeshTargetErrorDetails {
100
104
  stackSpace?: string;
101
105
  /** For `not-started`: the Cotal home in use, when the root's stack runs under another one. */
102
106
  home?: string;
107
+ /** For `not-started` on a stack root whose journal another folder recorded, as a copy or a moved
108
+ * folder keeps it: that folder. */
109
+ recordedRoot?: string;
110
+ /** For `not-started` in a folder whose stack journal another folder recorded: the next step that
111
+ * `up` and `down` name there too, from {@link stackElsewhereRemedy}. */
112
+ stackRemedy?: string;
103
113
  /** For `not-started` on a prepared space: its root no longer exists, so `up` cannot start it there. */
104
114
  rootMissing?: boolean;
115
+ /** For `not-started` on a root with no registration: `server` is the broker its last start
116
+ * configured, which a bare `cotal up` there starts again. */
117
+ lastRun?: boolean;
118
+ /** For `not-started` on a prepared space whose controller stack launched a member and was
119
+ * stopped: its last recorded operation, and the file store cap it recorded, if any. */
120
+ stopped?: {
121
+ operation: string;
122
+ outcome: string;
123
+ storeCap?: number;
124
+ };
125
+ /** For `not-started` on a prepared space: the last whole-stack operation its root's stack journal
126
+ * records for it with no outcome, which `cotal status` there names the way out of. */
127
+ unsettled?: "up" | "down";
105
128
  }
129
+ /** The smallest JetStream file store cap a stack starts on: the bytes the space's membership bucket
130
+ * reserves, plus one. nats-server creates a stream with no byte limit only while at least one byte
131
+ * of the cap is unreserved, so a cap equal to the reservation fails every later stream with 10047. */
132
+ export declare const MIN_FILE_STORE: number;
106
133
  /**
107
134
  * A typed mesh-target resolution failure. `message` is **log/dev-safe and command-agnostic** — never
108
135
  * the canonical product copy (that's {@link renderWorkspaceError}'s job; don't let `message` become
@@ -125,6 +152,33 @@ export declare function targetFromEntry(m: MeshEntry, server: string, source: Me
125
152
  /** A `.cotal/` that a user actually created here — not the machine-home dir the cwd walk-up lands on
126
153
  * from outside any project (which has no space, just the daemon's pid/onboard files). */
127
154
  export declare function isGenuineSpace(root: string): boolean;
155
+ /** What the root a space was prepared in records about its stack, as a command that targets it
156
+ * reports it: `unsettled` when the last whole-stack `up` or `down` recorded no outcome, `stopped`
157
+ * once a stack that launched a member recorded one, else `prepared`. `lastOperation` names that
158
+ * operation and how it ended, such as `cotal down, completed`. */
159
+ export type PreparedLifecycle = {
160
+ state: "prepared";
161
+ lastOperation: null;
162
+ } | {
163
+ state: "stopped";
164
+ lastOperation: string;
165
+ stopped: NonNullable<MeshTargetErrorDetails["stopped"]>;
166
+ } | {
167
+ state: "unsettled";
168
+ lastOperation: string;
169
+ unsettled: "up" | "down";
170
+ stopped?: NonNullable<MeshTargetErrorDetails["stopped"]>;
171
+ };
172
+ /** {@link PreparedLifecycle} for `space`, prepared at `root`. */
173
+ export declare function preparedLifecycle(root: string, space: string): PreparedLifecycle;
174
+ /** The last operation and recorded store cap of `space`'s controller stack at `root`, when its
175
+ * journal names a member it launched. Undefined for a stack that never launched one, or a journal
176
+ * this read cannot use; the commands that act on the journal check it fully. */
177
+ export declare function stoppedStack(root: string, space: string): MeshTargetErrorDetails["stopped"];
178
+ /** The last whole-stack `up` or `down` that `root`'s own stack journal records for `space` with no
179
+ * outcome, as one cut off before it recorded one leaves it. Such a stack is not stopped, whatever
180
+ * members it launched. */
181
+ export declare function unsettledStackOperation(root: string, space: string): "up" | "down" | undefined;
128
182
  /** Whether `root`'s stack journal names member instances of which this Cotal home holds no record,
129
183
  * while a manager or delivery record under the root fronts a live process: the stack runs under
130
184
  * another `COTAL_HOME`, whose registration and service records this one cannot see. A journal that
@@ -133,13 +187,76 @@ export declare function stackRunsUnderOtherHome(root: string, journal: {
133
187
  space?: unknown;
134
188
  members?: unknown;
135
189
  }): boolean;
190
+ /** Whether `root`'s `.cotal` is a link to the `.cotal` directory of `holder`, whose stack journal was
191
+ * recorded at `root`: `root`'s own records, moved to `holder` and linked back. Through the link both
192
+ * folders seem to hold the journal, so each would name the other as the place to run from. */
193
+ export declare function recordsMovedTo(root: string, holder: string): boolean;
194
+ /** The way back for records moved from `root` to `holder` and linked back ({@link recordsMovedTo}):
195
+ * the link replaced by the directory it leads to. Nothing here moves them. */
196
+ export declare function moveRecordsBack(root: string, holder: string): string;
197
+ /** Why `space create --adopt` may not take over a stack journal another folder recorded. */
198
+ export interface StackAdoptionBlock {
199
+ kind: "link" | "copy" | "known" | "recorded";
200
+ message: string;
201
+ remedy: string;
202
+ }
203
+ /** Why `space create --adopt` may not take over, at `root`, the stack journal that `recordedRoot`
204
+ * recorded for `space` with these members: this folder's `.cotal` links to another's, the recorded
205
+ * root still holds the journal, this home records one of its member instances, or the space is
206
+ * prepared or registered on this machine. Undefined when it may. */
207
+ export declare function stackAdoptionBlock(root: string, recordedRoot: string, space: string, members: unknown): StackAdoptionBlock | undefined;
208
+ /** The next step in `root`, whose stack journal `recordedRoot` recorded for `space`, which every
209
+ * command run there names. A linked `.cotal`, and a copy whose recorded folder still holds the
210
+ * journal, use the stack from there. A moved folder moves back when this machine records its stack
211
+ * or its space, and is adopted with `space create --adopt` when it records neither, because moving
212
+ * it back would then not start it. A recorded path that `cotal up` refuses is never the way back. */
213
+ export declare function stackElsewhereRemedy(root: string, recordedRoot: string, space: string, members: unknown): string;
214
+ /** Whether the root holds a broker account, readable or not. */
215
+ export declare function rootHoldsAccount(root: string): boolean;
216
+ /** The broker this root's last start rendered: `.cotal/auth/server.conf` in static auth when the root
217
+ * holds an account, else `.cotal/server-open.conf` in open mode. Undefined when neither names one.
218
+ * A legacy `down` drops the registration that kept the root's broker address, or keeps one that
219
+ * only holds the name of a space named after its folder, and this file outlives it. */
220
+ export declare function retainedLegacyBroker(root: string): {
221
+ server: string;
222
+ open: boolean;
223
+ } | undefined;
224
+ /** Say under the run's `Mesh:` heading that `space` is this folder's and the selection `current`
225
+ * applies outside the folder. */
226
+ export declare function noteFolderSpace(space: string, current: string): void;
227
+ /** The one space registered or prepared at the root of the project folder `cwd` is in, which a
228
+ * command without `--space` targets there. Undefined outside a project and where the root has none
229
+ * or several. */
230
+ export declare function folderSpace(cwd: string): string | undefined;
231
+ /** The space a command without `--space` targets in the project folder `cwd` is in when that is not
232
+ * the selection `current`: the root's one registered or prepared space. Undefined with nothing
233
+ * selected, outside a project, and where the selection is the target. */
234
+ export declare function folderSpaceOverSelection(cwd: string, current: string | null): string | undefined;
235
+ /**
236
+ * The space a `--creds` command that names neither `--space` nor `--server` addresses, in
237
+ * {@link resolveMeshTarget}'s order: the selected space, unless this folder's project has one other
238
+ * space, else the space this folder's project is registered, set up or prepared as. `undefined`
239
+ * leaves the caller's default. It reads no trust, because the credential is the caller's own, and it
240
+ * never takes the only running space, because a credential goes only to a broker the caller paired
241
+ * it with.
242
+ */
243
+ export declare function credsSpace(cwd: string): {
244
+ space: string;
245
+ selected: boolean;
246
+ } | undefined;
247
+ /** Whether {@link resolveMeshTarget} reads liveness (`flags.offline`) for `flags` at `cwd`. A named
248
+ * `--space`, the selection where it is the target, and a registration of this project's root each
249
+ * pick the target without it, so a caller that sweeps the recorded brokers first has nothing to
250
+ * probe then. It follows the same precedence and records nothing. */
251
+ export declare function resolveReadsLiveness(cwd: string, flags?: ResolveFlags): boolean;
136
252
  /**
137
253
  * Resolve the mesh target by precedence (first match wins):
138
254
  * 1. `--space` — registry lookup (errors if that space isn't running).
139
255
  * 2. `--server` — registry entry on that server (for creds/personas), else the local project.
140
- * 3. The `current` selected by `cotal use`, from any directory. It stays the target when its broker
141
- * is down, and a selection that names no registration refuses rather than reaching another mesh.
142
- * Inside a project whose root has a different registered space, the run warns first.
256
+ * 3. The `current` selected by `cotal use`, except inside a project whose root has one space other
257
+ * than it, where step 4 applies. It stays the target when its broker is down, and a selection
258
+ * that names no registration refuses rather than reaching another mesh. Inside a project whose
259
+ * root has several spaces, none of them the selection, the run warns first.
143
260
  * 4. A genuine local project (`cwd` walks up to a real `.cotal/`).
144
261
  * 5. The registry's *running* meshes: 0 ⇒ error; 1 ⇒ use it; N ⇒ error naming
145
262
  * each + its root. `flags.offline` (from a sweep) is excluded here; a named `--space` and