@cotal-ai/workspace 0.13.1 → 0.14.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.
- package/dist/auth-paths.d.ts +180 -18
- package/dist/auth-paths.d.ts.map +1 -1
- package/dist/auth-paths.js +739 -31
- package/dist/auth-paths.js.map +1 -1
- package/dist/connect.js +3 -3
- package/dist/connect.js.map +1 -1
- package/dist/extension-mutation.d.ts +27 -0
- package/dist/extension-mutation.d.ts.map +1 -0
- package/dist/extension-mutation.js +229 -0
- package/dist/extension-mutation.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/local-process.d.ts +2 -1
- package/dist/local-process.d.ts.map +1 -1
- package/dist/local-process.js +37 -3
- package/dist/local-process.js.map +1 -1
- package/dist/materialize.d.ts.map +1 -1
- package/dist/materialize.js +5 -5
- package/dist/materialize.js.map +1 -1
- package/dist/mesh-registry.d.ts +3 -1
- package/dist/mesh-registry.d.ts.map +1 -1
- package/dist/mesh-registry.js +59 -6
- package/dist/mesh-registry.js.map +1 -1
- package/dist/mesh-target.d.ts +1 -1
- package/dist/mesh-target.d.ts.map +1 -1
- package/dist/mesh-target.js +98 -30
- package/dist/mesh-target.js.map +1 -1
- package/dist/official-connectors.d.ts +12 -0
- package/dist/official-connectors.d.ts.map +1 -1
- package/dist/official-connectors.js +4 -0
- package/dist/official-connectors.js.map +1 -1
- package/dist/render.js +2 -0
- package/dist/render.js.map +1 -1
- package/dist/renewal.d.ts +43 -13
- package/dist/renewal.d.ts.map +1 -1
- package/dist/renewal.js +85 -21
- package/dist/renewal.js.map +1 -1
- package/dist/space.d.ts +4 -2
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +6 -4
- package/dist/space.js.map +1 -1
- package/package.json +2 -2
package/dist/mesh-registry.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readFileSync, readdirSync, realpathSync, renameSync, rmSync } from "nod
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import { mkSecretDir, writeSecretFile } from "@cotal-ai/core";
|
|
5
|
+
import { spaceSegment } from "./auth-paths.js";
|
|
5
6
|
/** Runtime-validate a provider's opaque `publicAuth` blob into a {@link UserAuthInfo} — the
|
|
6
7
|
* workstation layer owns this shape (core stays IdP-agnostic), so the boundary where an
|
|
7
8
|
* arbitrary provider's metadata enters the registry is checked here, fail-loud. */
|
|
@@ -34,8 +35,43 @@ export function homeCotalDir() {
|
|
|
34
35
|
export function meshesDir() {
|
|
35
36
|
return join(homeCotalDir(), "meshes");
|
|
36
37
|
}
|
|
38
|
+
/** The canonical registry filename for a space: the workspace-wide injective `space.<hex>` segment
|
|
39
|
+
* (see {@link spaceSegment}). Raw `encodeURIComponent` stems preserved ASCII case, so on a
|
|
40
|
+
* case-insensitive filesystem two case-differing spaces addressed ONE registry file and the
|
|
41
|
+
* second `up` silently swallowed the first mesh's record. The space's real name is authoritative
|
|
42
|
+
* in the document; the filename only locates it. */
|
|
43
|
+
function meshFileName(space) {
|
|
44
|
+
return `${spaceSegment(space)}.json`;
|
|
45
|
+
}
|
|
37
46
|
function meshFile(space) {
|
|
38
|
-
return join(meshesDir(),
|
|
47
|
+
return join(meshesDir(), meshFileName(space));
|
|
48
|
+
}
|
|
49
|
+
/** Remove every PRE-HEX registry file that records `space` (`<encodeURIComponent>.json` stems from
|
|
50
|
+
* older builds). Matched by each document's own `space` - never by decoding the filename, which
|
|
51
|
+
* would case-fold on this filesystem - so a legacy record can neither shadow nor resurrect a mesh
|
|
52
|
+
* the canonical file no longer records. A file that will not parse is left for {@link loadMeshes}
|
|
53
|
+
* to skip. */
|
|
54
|
+
function removeLegacyMeshFiles(space) {
|
|
55
|
+
let files;
|
|
56
|
+
try {
|
|
57
|
+
files = readdirSync(meshesDir());
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return; // no registry yet
|
|
61
|
+
}
|
|
62
|
+
const canonical = meshFileName(space);
|
|
63
|
+
for (const f of files) {
|
|
64
|
+
if (f === canonical || !f.endsWith(".json"))
|
|
65
|
+
continue;
|
|
66
|
+
try {
|
|
67
|
+
const doc = JSON.parse(readFileSync(join(meshesDir(), f), "utf8"));
|
|
68
|
+
if (doc.space === space)
|
|
69
|
+
rmSync(join(meshesDir(), f), { force: true });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
/* unparseable stray - not provably this space's record, leave it */
|
|
73
|
+
}
|
|
74
|
+
}
|
|
39
75
|
}
|
|
40
76
|
function currentFile() {
|
|
41
77
|
return join(homeCotalDir(), "current-mesh");
|
|
@@ -52,10 +88,12 @@ export function recordMesh(m) {
|
|
|
52
88
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
53
89
|
writeSecretFile(tmp, JSON.stringify(m, null, 2)); // hardened before rename; rename preserves the ACL/mode
|
|
54
90
|
renameSync(tmp, file); // atomic replace — a reader never sees a half-written record
|
|
91
|
+
removeLegacyMeshFiles(m.space); // a pre-hex record for this space must not survive as a duplicate
|
|
55
92
|
}
|
|
56
93
|
/** Drop a mesh from the registry (on `cotal down` / a stale-entry prune). Absent ⇒ no-op. */
|
|
57
94
|
export function removeMesh(space) {
|
|
58
95
|
rmSync(meshFile(space), { force: true });
|
|
96
|
+
removeLegacyMeshFiles(space); // else a pre-hex record would resurrect the mesh in every listing
|
|
59
97
|
}
|
|
60
98
|
/** Canonicalize a project root for comparison. A recorded root is whatever spelling `cotal up` was
|
|
61
99
|
* run under, so the same directory reaches us by several names: a symlinked root (macOS `/var` →
|
|
@@ -93,7 +131,9 @@ export function removeMeshesByRoot(root) {
|
|
|
93
131
|
return removed;
|
|
94
132
|
}
|
|
95
133
|
/** All currently-recorded meshes. An unparseable/partially-written entry is skipped, not fatal —
|
|
96
|
-
* one bad file must not hide the rest.
|
|
134
|
+
* one bad file must not hide the rest. One record per space: if a pre-hex legacy file and the
|
|
135
|
+
* canonical `space.<hex>` file both name the same space (a crash between {@link recordMesh}'s
|
|
136
|
+
* write and its legacy sweep), the canonical one wins — it is the newer scheme's write. */
|
|
97
137
|
export function loadMeshes() {
|
|
98
138
|
let files;
|
|
99
139
|
try {
|
|
@@ -102,16 +142,29 @@ export function loadMeshes() {
|
|
|
102
142
|
catch {
|
|
103
143
|
return []; // no registry yet
|
|
104
144
|
}
|
|
105
|
-
const
|
|
145
|
+
const bySpace = new Map();
|
|
106
146
|
for (const f of files.sort()) {
|
|
147
|
+
let entry;
|
|
148
|
+
try {
|
|
149
|
+
entry = JSON.parse(readFileSync(join(meshesDir(), f), "utf8"));
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
continue; /* skip a corrupt/half-written entry rather than fail the whole listing */
|
|
153
|
+
}
|
|
154
|
+
if (typeof entry.space !== "string" || !entry.space)
|
|
155
|
+
continue; // every consumer keys on space
|
|
156
|
+
let canonical = false;
|
|
107
157
|
try {
|
|
108
|
-
|
|
158
|
+
canonical = f === meshFileName(entry.space);
|
|
109
159
|
}
|
|
110
160
|
catch {
|
|
111
|
-
/*
|
|
161
|
+
/* a degenerate space name in the doc has no canonical filename - rank it as legacy */
|
|
112
162
|
}
|
|
163
|
+
const prev = bySpace.get(entry.space);
|
|
164
|
+
if (!prev || (canonical && !prev.canonical))
|
|
165
|
+
bySpace.set(entry.space, { entry, canonical });
|
|
113
166
|
}
|
|
114
|
-
return
|
|
167
|
+
return [...bySpace.values()].map((v) => v.entry);
|
|
115
168
|
}
|
|
116
169
|
export function findMesh(space) {
|
|
117
170
|
return loadMeshes().find((m) => m.space === space);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-registry.js","sourceRoot":"","sources":["../src/mesh-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MA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arget} can't pick a single mesh. Each
|
|
44
44
|
* maps 1:1 to a former prose-throw; the recovery copy (`cotal up`/`meshes`/`use`) is the renderer's
|
|
45
45
|
* job ({@link renderWorkspaceError}), not the protocol's. */
|
|
46
|
-
export type MeshTargetErrorCode = "no-meshes" | "unknown-space" | "ambiguous-target" | "default-occupied" | "stale-auth-root" | "user-auth-unrecorded";
|
|
46
|
+
export type MeshTargetErrorCode = "no-meshes" | "unknown-space" | "ambiguous-target" | "default-occupied" | "stale-auth-root" | "unreadable-auth" | "user-auth-unrecorded";
|
|
47
47
|
/** Structured context for a {@link MeshTargetError} — enough for any surface to render its own
|
|
48
48
|
* recovery affordance (a CLI sentence, a web button, an SDK embed that wants no command at all). */
|
|
49
49
|
export interface MeshTargetErrorDetails {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-target.d.ts","sourceRoot":"","sources":["../src/mesh-target.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAML,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;uFACmF;IACnF,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB;;sEAEkE;IAClE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;4GAMwG;IACxG,MAAM,EACF,aAAa,GACb,YAAY,GACZ,qBAAqB,GACrB,aAAa,GACb,gBAAgB,GAChB,UAAU,GACV,SAAS,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,kDAAkD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mBAAmB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAEvC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,sBAA2B,EACpC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAOhC;AAED;uGACuG;AACvG,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CAMvE;AAiJD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,YAAiB,GAAG,UAAU,CA4FnF"}
|
package/dist/mesh-target.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { existsSync
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { DEFAULT_SERVER, DEFAULT_SPACE } from "@cotal-ai/core";
|
|
4
|
-
import { authDir, findCotalRoot, loadSpaceAuth,
|
|
4
|
+
import { accountInventory, authDir, findCotalRoot, hasUserAuthState, listSpaceAccounts, loadSpaceAuth, soleSpaceOf, userAuthSpacesOnDisk } from "./auth-paths.js";
|
|
5
5
|
import { findMesh, getCurrent, homeCotalDir, loadMeshes, removeMesh, } from "./mesh-registry.js";
|
|
6
6
|
const WORKSPACE_TARGET_ERROR = "cotal:workspace:mesh-target-error";
|
|
7
7
|
/**
|
|
@@ -31,6 +31,43 @@ export function isWorkspaceTargetError(e) {
|
|
|
31
31
|
function personaRoot(root) {
|
|
32
32
|
return join(root, ".cotal", "agents");
|
|
33
33
|
}
|
|
34
|
+
/** Refuse to resolve a single mesh when ROOT's on-disk account inventory says it hosts more than
|
|
35
|
+
* one tenant (or an unreadable one). The disk is the tenant authority ahead of the registry: a
|
|
36
|
+
* broker with several account records is several tenants even if only one is registered, so any
|
|
37
|
+
* path that would otherwise auto-pick (a bare local root, a `--server` that names this broker)
|
|
38
|
+
* must refuse here. `--space` is the way to name one. A root with 0 or 1 accounts (open or
|
|
39
|
+
* single-tenant) passes untouched. */
|
|
40
|
+
/** Load a space's composed trust, converting a COMPOSITION failure into a typed target error. The
|
|
41
|
+
* record can pass the on-disk shape gate yet fail to compose - a malformed account JWT, or a
|
|
42
|
+
* well-formed one signed by a foreign operator - and `loadSpaceAuth` throws a raw error there.
|
|
43
|
+
* Every resolver caller is a surface (`status`, `spawn`, the web dashboard) that must present a
|
|
44
|
+
* legible failure, not crash on an uncaught throw, so the throw becomes `unreadable-auth`. An
|
|
45
|
+
* absent record is not a failure here - it returns undefined, same as `loadSpaceAuth`. */
|
|
46
|
+
function loadTrustOrThrow(root, space) {
|
|
47
|
+
try {
|
|
48
|
+
return loadSpaceAuth(authDir(root), space);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
throw new MeshTargetError("unreadable-auth", e.message, { space, root });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function assertRootIsSingleTenant(root) {
|
|
55
|
+
// `accountInventory`'s readdir can THROW (EACCES/ELOOP on `.cotal/auth`): it lets that propagate
|
|
56
|
+
// so the broker-wide guards fail CLOSED, but the resolver is a presentation surface and must
|
|
57
|
+
// convert it to a typed error, or `status`/`spawn` crash on the raw throw. An unreadable auth dir
|
|
58
|
+
// is unreadable trust.
|
|
59
|
+
let inv;
|
|
60
|
+
try {
|
|
61
|
+
inv = accountInventory(authDir(root));
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
throw new MeshTargetError("unreadable-auth", e.message, { root });
|
|
65
|
+
}
|
|
66
|
+
if (inv.corrupt.length > 0)
|
|
67
|
+
throw new MeshTargetError("ambiguous-target", `${root} holds ${inv.corrupt.length} unreadable account record(s) (${inv.corrupt.join(", ")}) - the tenant list is uncertain; repair or remove them`, { root });
|
|
68
|
+
if (inv.spaces.length > 1)
|
|
69
|
+
throw new MeshTargetError("ambiguous-target", `${root}'s broker holds accounts for ${inv.spaces.length} spaces (${inv.spaces.join(", ")}) - name one with --space`, { root, available: inv.spaces });
|
|
70
|
+
}
|
|
34
71
|
function targetFromEntry(m, server, source) {
|
|
35
72
|
// Honor the recorded mode: an OPEN mesh connects credlessly even if its root still has auth
|
|
36
73
|
// material on disk (e.g. a root that once ran auth mode). Loading it would make `spawn` mint
|
|
@@ -39,13 +76,23 @@ function targetFromEntry(m, server, source) {
|
|
|
39
76
|
let auth;
|
|
40
77
|
let userAuth;
|
|
41
78
|
if (m.mode === "auth") {
|
|
42
|
-
auth
|
|
43
|
-
//
|
|
79
|
+
// Space-KEYED load: ask for this entry's own space rather than "the" auth of the root, so a
|
|
80
|
+
// root serving several spaces can never hand back a neighbour's account. A record that will not
|
|
81
|
+
// COMPOSE into usable trust (malformed account JWT, or one signed by a foreign operator) throws
|
|
82
|
+
// inside `loadSpaceAuth`; convert it to a typed target error so a caller like `status` reports
|
|
83
|
+
// it and exits 0 instead of crashing on the raw compose throw.
|
|
84
|
+
auth = loadTrustOrThrow(m.root, m.space);
|
|
85
|
+
// Defense in depth: the root's on-disk auth must still cover THIS space. A divergence (the root
|
|
44
86
|
// was re-`up`ed as a different space without re-recording) would otherwise mint mesh-A creds
|
|
45
|
-
// against the entry for space B.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
87
|
+
// against the entry for space B. Now that the load is space-keyed the divergence surfaces as an
|
|
88
|
+
// ABSENT account rather than a mismatched one, so detect it by what the root DOES hold; prune
|
|
89
|
+
// the stale entry and fail loud rather than connect wrong.
|
|
90
|
+
if (!auth) {
|
|
91
|
+
const found = listSpaceAccounts(authDir(m.root));
|
|
92
|
+
if (found.length) {
|
|
93
|
+
removeMesh(m.space);
|
|
94
|
+
throw new MeshTargetError("stale-auth-root", `registry entry "${m.space}" points at ${m.root}, whose on-disk auth is now for "${found.join('", "')}"`, { space: m.space, root: m.root, found: found.join(", ") });
|
|
95
|
+
}
|
|
49
96
|
}
|
|
50
97
|
}
|
|
51
98
|
else if (m.mode === "user") {
|
|
@@ -67,8 +114,18 @@ function targetFromEntry(m, server, source) {
|
|
|
67
114
|
};
|
|
68
115
|
}
|
|
69
116
|
function localTarget(root, server, source) {
|
|
70
|
-
|
|
71
|
-
|
|
117
|
+
// No registry entry and no explicit space, so the root itself must name exactly one space;
|
|
118
|
+
// `soleSpaceOf` fails loud rather than picking one when it holds several (or the tenant list is
|
|
119
|
+
// unreadable). Surface that as a catchable target error so a caller like `status` reports it as an
|
|
120
|
+
// ambiguous target instead of crashing on an uncaught throw.
|
|
121
|
+
let space;
|
|
122
|
+
try {
|
|
123
|
+
space = soleSpaceOf(authDir(root)) ?? DEFAULT_SPACE;
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
throw new MeshTargetError("ambiguous-target", e.message, { root });
|
|
127
|
+
}
|
|
128
|
+
const auth = loadTrustOrThrow(root, space);
|
|
72
129
|
// U10 guard: a user-auth space resolved WITHOUT its registry entry (pruned/never recorded) must
|
|
73
130
|
// not silently static-mint — static creds DO work on a user-auth broker, which would connect the
|
|
74
131
|
// operator on the wrong identity plane. The on-disk marker is the space-scoped user-auth state
|
|
@@ -77,7 +134,7 @@ function localTarget(root, server, source) {
|
|
|
77
134
|
// proves user auth was enabled here, and the alternative would classify the root "open" and
|
|
78
135
|
// connect credlessly toward a user-auth broker. Fail closed on the marker, whichever half died.
|
|
79
136
|
const userSpace = auth
|
|
80
|
-
?
|
|
137
|
+
? hasUserAuthState(root, space)
|
|
81
138
|
? space
|
|
82
139
|
: undefined
|
|
83
140
|
: userAuthSpacesOnDisk(authDir(root))[0];
|
|
@@ -85,21 +142,6 @@ function localTarget(root, server, source) {
|
|
|
85
142
|
throw new MeshTargetError("user-auth-unrecorded", `space "${userSpace}" has user auth enabled on disk but no usable registry entry`, { space: userSpace, root });
|
|
86
143
|
return { root, server, space, mode: auth ? "auth" : "open", auth, personaRoot: personaRoot(root), source };
|
|
87
144
|
}
|
|
88
|
-
/** Space names with user-auth state under a root's auth dir, detectable WITHOUT `auth.json`: each
|
|
89
|
-
* enabled space is a subdirectory (encodeURIComponent(space)) holding the provider's pinned
|
|
90
|
-
* material — `idp.json` is written first at enable, `callout.json` right after, so either one
|
|
91
|
-
* marks the dir as user-auth state (never confusable with a stray empty folder). */
|
|
92
|
-
function userAuthSpacesOnDisk(dir) {
|
|
93
|
-
try {
|
|
94
|
-
return readdirSync(dir, { withFileTypes: true })
|
|
95
|
-
.filter((e) => e.isDirectory() &&
|
|
96
|
-
(existsSync(join(dir, e.name, "idp.json")) || existsSync(join(dir, e.name, "callout.json"))))
|
|
97
|
-
.map((e) => decodeURIComponent(e.name));
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
return []; // no auth dir at all — nothing user-auth here
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
145
|
/** A `.cotal/` that a user actually created here — not the machine-home dir the cwd walk-up lands on
|
|
104
146
|
* from outside any project (which has no space, just the daemon's pid/onboard files). */
|
|
105
147
|
function isGenuineSpace(root) {
|
|
@@ -131,9 +173,22 @@ export function resolveMeshTarget(cwd, flags = {}) {
|
|
|
131
173
|
return targetFromEntry(m, flags.server ?? m.server, overriding ? "flag-space-override" : "flag-space");
|
|
132
174
|
}
|
|
133
175
|
if (flags.server) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
176
|
+
// One broker can host several spaces, and each records its own registry entry under the SAME
|
|
177
|
+
// server URL - so "the entry on that server" is not a single thing. `.find()` would silently
|
|
178
|
+
// hand back whichever sorted first, connecting the caller to an arbitrary tenant; refuse and
|
|
179
|
+
// name them instead (`--space` picks one explicitly, handled above).
|
|
180
|
+
const onServer = loadMeshes().filter((e) => e.server === flags.server);
|
|
181
|
+
if (onServer.length > 1)
|
|
182
|
+
throw new MeshTargetError("ambiguous-target", `${onServer.length} spaces are recorded at ${flags.server} (${onServer.map((e) => e.space).join(", ")}) - name one with --space`, { server: flags.server, available: onServer.map((e) => `${e.space} (${e.root})`) });
|
|
183
|
+
if (onServer[0]) {
|
|
184
|
+
// `--server` names a BROKER, not a tenant. One registry row at that server does not prove the
|
|
185
|
+
// broker hosts one tenant: the row's own root may hold several account records on disk with
|
|
186
|
+
// only this one registered (a pruned/partial registration). The disk is the authority - if it
|
|
187
|
+
// shows several tenants (or an unreadable one), `--server` alone cannot pick, same as the bare
|
|
188
|
+
// local branch below.
|
|
189
|
+
assertRootIsSingleTenant(onServer[0].root);
|
|
190
|
+
return targetFromEntry(onServer[0], flags.server, "flag-server");
|
|
191
|
+
}
|
|
137
192
|
return localTarget(findCotalRoot(cwd), flags.server, "flag-server");
|
|
138
193
|
}
|
|
139
194
|
const meshes = loadMeshes();
|
|
@@ -143,11 +198,24 @@ export function resolveMeshTarget(cwd, flags = {}) {
|
|
|
143
198
|
return targetFromEntry(cur, cur.server, "current");
|
|
144
199
|
const root = findCotalRoot(cwd);
|
|
145
200
|
if (isGenuineSpace(root)) {
|
|
201
|
+
// The DISK is the tenant authority for this root, before any registry record: a broker whose
|
|
202
|
+
// auth dir holds several accounts stays several tenants even when only one of them happens to
|
|
203
|
+
// be registered (a pruned entry, a partial registration). Trusting the single surviving record
|
|
204
|
+
// here would silently resolve a multi-tenant root to whichever tenant kept its record - the
|
|
205
|
+
// same auto-pick `soleSpaceOf` refuses on the unrecorded path. And an UNREADABLE record means
|
|
206
|
+
// the tenant count itself is uncertain, which cannot resolve to a single mesh either.
|
|
207
|
+
assertRootIsSingleTenant(root);
|
|
146
208
|
// For a local project, if its mesh is in the registry, use the RECORDED server +
|
|
147
209
|
// mode, not DEFAULT_SERVER: a project started with `--server …:4333` must spawn against :4333,
|
|
148
210
|
// and a recorded OPEN mesh must not mint creds off stale `.cotal/auth` left on disk. Fall back
|
|
149
211
|
// to the local default only when nothing is recorded for this root.
|
|
150
|
-
const
|
|
212
|
+
const rootMatches = meshes.filter((m) => resolve(m.root) === resolve(root));
|
|
213
|
+
// A broker that runs several spaces records one entry per space, all under this same root. With no
|
|
214
|
+
// `--space` to pick one, `.find()` would silently resolve whichever sorted first; name the tenants
|
|
215
|
+
// and refuse instead (the same posture as `soleSpaceOf` for an unrecorded multi-space root).
|
|
216
|
+
if (rootMatches.length > 1)
|
|
217
|
+
throw new MeshTargetError("ambiguous-target", `this folder's broker hosts ${rootMatches.length} spaces (${rootMatches.map((m) => m.space).join(", ")}) - name one with --space`, { available: rootMatches.map((m) => `${m.space} (${m.root})`) });
|
|
218
|
+
const recorded = rootMatches[0];
|
|
151
219
|
if (recorded)
|
|
152
220
|
return targetFromEntry(recorded, recorded.server, "local-recorded");
|
|
153
221
|
// No record for this root (migration, or our broker went down and the entry was just pruned).
|
package/dist/mesh-target.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-target.js","sourceRoot":"","sources":["../src/mesh-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"mesh-target.js","sourceRoot":"","sources":["../src/mesh-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAClK,OAAO,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,GAGX,MAAM,oBAAoB,CAAC;AAgF5B,MAAM,sBAAsB,GAAG,mCAAmC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,mFAAmF;IAC1E,KAAK,GAAG,sBAAsB,CAAC;IAC/B,IAAI,CAAsB;IAC1B,OAAO,CAAyB;IACzC,YACE,IAAyB,EACz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,IAAI,eAAe,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IACnF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAEzF,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;IAC1D,MAAM,IAAI,eAAe,CAAC,kBAAkB,EAAE,4BAA4B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;QAC5F,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
* must not import the CLI — it is pure data supplied to the generic materialize/hint path.
|
|
10
10
|
*/
|
|
11
11
|
export declare const OFFICIAL_CONNECTORS: Readonly<Record<string, string>>;
|
|
12
|
+
/** A first-party extension the umbrella (`cotal-ai`) bundles and versions in lockstep: its npm package
|
|
13
|
+
* plus the repo-relative source dir the prepack copy and dev seeding resolve it from. This is the four
|
|
14
|
+
* connectors PLUS the web dashboard — every first-party piece the binary ships and the seed reconcile
|
|
15
|
+
* keeps at the binary's own version, so `npm i -g cotal-ai@X` carries them all at X with no separate
|
|
16
|
+
* fetch and no version skew. A third-party `cotal ext add`ed package is NOT here; it versions on its
|
|
17
|
+
* own line. web lives in `implementations/web` (the connectors under `extensions/`), hence the explicit
|
|
18
|
+
* source dir rather than a derived `extensions/<name>`. */
|
|
19
|
+
export interface SeededExtension {
|
|
20
|
+
readonly pkg: string;
|
|
21
|
+
readonly srcDir: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const SEEDED_EXTENSIONS: Readonly<Record<string, SeededExtension>>;
|
|
12
24
|
/** The default connector/agent type when `COTAL_DEFAULT_AGENT` is unset (David's locked decision). */
|
|
13
25
|
export declare const DEFAULT_CONNECTOR = "claude";
|
|
14
26
|
/** `cotal` is reserved: it is the binary's own name, so a connector must never claim it (there is no
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"official-connectors.d.ts","sourceRoot":"","sources":["../src/official-connectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKhE,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C;kFACkF;AAClF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAc,CAAC;AAErE;mGACmG;AACnG,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzD"}
|
|
1
|
+
{"version":3,"file":"official-connectors.d.ts","sourceRoot":"","sources":["../src/official-connectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKhE,CAAC;AAEF;;;;;;4DAM4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAKvE,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C;kFACkF;AAClF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAc,CAAC;AAErE;mGACmG;AACnG,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzD"}
|
|
@@ -14,6 +14,10 @@ export const OFFICIAL_CONNECTORS = {
|
|
|
14
14
|
hermes: "@cotal-ai/connector-hermes",
|
|
15
15
|
pi: "@cotal-ai/pi",
|
|
16
16
|
};
|
|
17
|
+
export const SEEDED_EXTENSIONS = {
|
|
18
|
+
...Object.fromEntries(Object.entries(OFFICIAL_CONNECTORS).map(([name, pkg]) => [name, { pkg, srcDir: `extensions/${pkg.split("/")[1]}` }])),
|
|
19
|
+
web: { pkg: "@cotal-ai/web", srcDir: "implementations/web" },
|
|
20
|
+
};
|
|
17
21
|
/** The default connector/agent type when `COTAL_DEFAULT_AGENT` is unset (David's locked decision). */
|
|
18
22
|
export const DEFAULT_CONNECTOR = "claude";
|
|
19
23
|
/** `cotal` is reserved: it is the binary's own name, so a connector must never claim it (there is no
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"official-connectors.js","sourceRoot":"","sources":["../src/official-connectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE,MAAM,EAAE,iCAAiC;IACzC,QAAQ,EAAE,8BAA8B;IACxC,MAAM,EAAE,4BAA4B;IACpC,EAAE,EAAE,cAAc;CACnB,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C;kFACkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,OAAO,CAAC,CAAC;AAErE;mGACmG;AACnG,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,GAAG,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,GAAG;QACR,CAAC,CAAC,iBAAiB,IAAI,6CAA6C,GAAG,IAAI;QAC3E,CAAC,CAAC,iBAAiB,IAAI,qFAAqF,CAAC;AACjH,CAAC"}
|
|
1
|
+
{"version":3,"file":"official-connectors.js","sourceRoot":"","sources":["../src/official-connectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE,MAAM,EAAE,iCAAiC;IACzC,QAAQ,EAAE,8BAA8B;IACxC,MAAM,EAAE,4BAA4B;IACpC,EAAE,EAAE,cAAc;CACnB,CAAC;AAcF,MAAM,CAAC,MAAM,iBAAiB,GAA8C;IAC1E,GAAI,MAAM,CAAC,WAAW,CACpB,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CACjF;IACrC,GAAG,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,qBAAqB,EAAE;CAC7D,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C;kFACkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,OAAO,CAAC,CAAC;AAErE;mGACmG;AACnG,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,GAAG,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,GAAG;QACR,CAAC,CAAC,iBAAiB,IAAI,6CAA6C,GAAG,IAAI;QAC3E,CAAC,CAAC,iBAAiB,IAAI,qFAAqF,CAAC;AACjH,CAAC"}
|
package/dist/render.js
CHANGED
|
@@ -23,6 +23,8 @@ function renderTargetError(err) {
|
|
|
23
23
|
return `✗ another mesh ("${d.space}") is running at ${d.server} - run \`cotal up\` here to start yours, or \`--space ${d.space}\` to join it`;
|
|
24
24
|
case "stale-auth-root":
|
|
25
25
|
return `✗ 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\``;
|
|
26
|
+
case "unreadable-auth":
|
|
27
|
+
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\``;
|
|
26
28
|
case "user-auth-unrecorded":
|
|
27
29
|
// U11: without a TRUSTED local record of the space's IdP there is no actionable
|
|
28
30
|
// `cotal login --idp <?>` line to print — the honest recovery is re-registering the mesh
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAmBA,+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,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,qGAAqG;AACrG,SAAS,iBAAiB,CAAC,GAAoB;IAC7C,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACtB,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,WAAW;YACd,OAAO,qEAAqE,CAAC;QAC/E,KAAK,eAAe;YAClB,OAAO,oBAAoB,CAAC,CAAC,SAAS,qCAAqC,CAAC;QAC9E,KAAK,kBAAkB;YACrB,OAAO,+BAA+B,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gFAAgF,CAAC;QACvJ,KAAK,kBAAkB;YACrB,OAAO,oBAAoB,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,MAAM,yDAAyD,CAAC,CAAC,KAAK,eAAe,CAAC;QAChJ,KAAK,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/B,CAAC,CAAC,6BAA6B,MAAM,yDAAyD;QAC9F,CAAC,CAAC,6BAA6B,MAAM,kCAAkC,CAAC;AAC5E,CAAC"}
|
package/dist/renewal.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { type Profile, type SecretStore } from "@cotal-ai/core";
|
|
|
2
2
|
/**
|
|
3
3
|
* D5 slice 5 class-2 standing renewal — the RENEWAL OWNER'S half, shared by the manager (the
|
|
4
4
|
* resident owner in every mesh mode) and `cotal doctor auth --fix` (the operator repair). The
|
|
5
|
-
* daemon's half is the explicit `reloadCreds` adoption op on the delivery-admin rail
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* daemon's half is the explicit `reloadCreds` adoption op on the delivery-admin rail, plus each
|
|
6
|
+
* daemon's own 75% renewal timer (the delivery endpoint re-reads its source; the membership feed
|
|
7
|
+
* preflight-proves each candidate). Machine-local file work lives here in the workspace layer:
|
|
8
|
+
* implementations never import each other.
|
|
8
9
|
*/
|
|
9
10
|
/** The canonical secret-store key of the delivery daemon's scoped cred — by the FS convention the
|
|
10
11
|
* key IS the filename under `.cotal/`. The single source for every tier (the CLI writer, the
|
|
@@ -12,6 +13,10 @@ import { type Profile, type SecretStore } from "@cotal-ai/core";
|
|
|
12
13
|
* the kind across two store entries with no compile error. Lives in workspace because the
|
|
13
14
|
* key↔filename convention is the workspace layout's; implementations never import each other. */
|
|
14
15
|
export declare const DELIVERY_CREDS_KEY = "delivery.creds";
|
|
16
|
+
/** The membership feed's data-account rw cred key — the same key↔filename discipline as
|
|
17
|
+
* {@link DELIVERY_CREDS_KEY}. Named (not a bare literal) so the renewal owner can map a remint
|
|
18
|
+
* result back to the daemon's `membership` component without a hand-copied string. */
|
|
19
|
+
export declare const MEMBERSHIP_RW_CREDS_KEY = "membership-rw.creds";
|
|
15
20
|
/** The seed-less daemon creds files a renewal owner re-signs. The $SYS files
|
|
16
21
|
* (membership-observer, connection-evictor) are deliberately ABSENT: they are rotation-renewed —
|
|
17
22
|
* no persisted seed can re-sign them, by design. */
|
|
@@ -25,21 +30,46 @@ export interface RemintResult {
|
|
|
25
30
|
ok: boolean;
|
|
26
31
|
skipped?: "missing-file" | "no-auth";
|
|
27
32
|
error?: string;
|
|
33
|
+
/** EPHEMERAL SHA-256 of the JUST-RE-SIGNED cred's USER JWT — the EXPECTED-generation token the
|
|
34
|
+
* renewal owner hands the daemon so an adoption reply can prove it adopted THIS generation, not
|
|
35
|
+
* merely re-read some file. Present only on `ok`. NEVER persisted: the caller strips it before
|
|
36
|
+
* writing the renewal record (a stable secret-derived token must not land on disk). */
|
|
37
|
+
fingerprint?: string;
|
|
28
38
|
}
|
|
29
39
|
/** Re-sign the daemon creds files for their EXISTING nkeys (a renewal must never swap a daemon's
|
|
30
40
|
* identity — the daemon side pins it). Reads and writes through the secret-store seam; `store` is
|
|
31
41
|
* the renewal owner's injection point, SYMMETRIC with the daemon's `runDelivery(args, store?)`.
|
|
32
42
|
* The manager — the D5 standing-renewal owner, and a hosted-path caller (manager.ts calls this
|
|
33
|
-
* unconditionally) —
|
|
34
|
-
* re-signs into
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* re-
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
+
* unconditionally) — passes the SAME store it gives the daemon (its `ManagerOptions.secretStore`),
|
|
44
|
+
* so a hosted composition re-signs into the store the daemon renews from, never a divergent one; no
|
|
45
|
+
* store means the local workspace FS composition (keys = the filenames under `.cotal/`).
|
|
46
|
+
*
|
|
47
|
+
* `expectedSpace` (the caller's known space — the manager's `this.space`, doctor's resolved space) is
|
|
48
|
+
* a REQUIRED positional and is validated against the store's signer: the daemon creds are SPACE-SCOPED,
|
|
49
|
+
* so a store whose signer is for a DIFFERENT space (a swap after start, a misconfigured hosted mount)
|
|
50
|
+
* must NOT re-sign — that would overwrite each last-good cred with one the space's broker rejects,
|
|
51
|
+
* breaking the daemon on a value that looks freshly renewed. It is required (not optional) so the
|
|
52
|
+
* unsafe no-space call cannot compile — the same claim-exceeds-enforcement trap the cross-space fix
|
|
53
|
+
* would otherwise leave for the next caller. A signer that fails validation fails EVERY file
|
|
54
|
+
* (`ok:false`), leaving the standing creds intact toward their loud expiry rather than clobbering them.
|
|
55
|
+
* The store's ATOMIC put is load-bearing here, because the daemons re-read these values LIVE (the
|
|
56
|
+
* delivery endpoint's 75% source refresh, the membership feed's 75% renewal fetch).
|
|
57
|
+
*
|
|
58
|
+
* The last-good cred is NEVER overwritten with an UNPROVEN one — a bundle's JWT chain is self-bound,
|
|
59
|
+
* not broker-bound (two `createSpaceAuth(space)` calls yield same-named, DIFFERENT-account chains), so
|
|
60
|
+
* a same-label alternate signer could mint a broker-dead cred and CLOBBER the last-good (availability
|
|
61
|
+
* loss). Proof before overwrite is one of: (1) `opts.preflight` — a disposable "does the broker accept
|
|
62
|
+
* this cred" probe the caller owns (the manager passes a {@link probeConnect} over `this.servers`),
|
|
63
|
+
* which gates EVERY candidate when supplied; or (2) AUTHORITY CONTINUITY — the candidate is signed by
|
|
64
|
+
* the SAME account signing key (`iss`) as the current (last-good, already broker-accepted) cred, the
|
|
65
|
+
* same authority the broker trusts, which the OFFLINE local repair (`doctor auth --fix`) relies on. A
|
|
66
|
+
* same-label alternate account breaks continuity, so with no preflight it is refused, not clobbered.
|
|
67
|
+
*
|
|
68
|
+
* Structured per-file results, never throws: a failed remint leaves the old cred running toward its
|
|
69
|
+
* loud expiry and the caller records/reports the failure. */
|
|
70
|
+
export declare function remintDaemonCreds(root: string, expectedSpace: string, store?: SecretStore, opts?: {
|
|
71
|
+
preflight?: (creds: string) => Promise<boolean>;
|
|
72
|
+
}): Promise<RemintResult[]>;
|
|
43
73
|
/** The renewal owner's audit record — what `cotal doctor auth` renders so "file re-signed" and
|
|
44
74
|
* "daemon adopted" are distinguishable states, per the D5 panel gate. One file, overwritten per
|
|
45
75
|
* pass: the CURRENT renewal state, not a log (history is the git/ops layer's job). */
|
package/dist/renewal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../src/renewal.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../src/renewal.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAIxB;;;;;;;GAOG;AAEH;;;;kGAIkG;AAClG,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD;;uFAEuF;AACvF,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAE7D;;qDAEqD;AACrD,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAGrF,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;4FAGwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DA8B8D;AAC9D,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,GACzD,OAAO,CAAC,YAAY,EAAE,CAAC,CAsDzB;AAED;;uFAEuF;AACvF,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,KAAK,EAAE,MAAM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