@cotal-ai/cli 0.92.1 → 0.93.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/commands/app-identity.d.ts +30 -10
- package/dist/commands/app-identity.d.ts.map +1 -1
- package/dist/commands/app-identity.js +39 -90
- package/dist/commands/app-identity.js.map +1 -1
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +11 -3
- package/dist/commands/spawn.js.map +1 -1
- package/dist/lib/app-user-identity.d.ts +24 -0
- package/dist/lib/app-user-identity.d.ts.map +1 -0
- package/dist/lib/app-user-identity.js +364 -0
- package/dist/lib/app-user-identity.js.map +1 -0
- package/dist/lib/conversation-identity.d.ts +47 -0
- package/dist/lib/conversation-identity.d.ts.map +1 -0
- package/dist/lib/conversation-identity.js +119 -0
- package/dist/lib/conversation-identity.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import { closeSync, existsSync, fsyncSync, lstatSync, openSync, readFileSync, readdirSync, rmdirSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { CotalEndpoint, acquireLock, assertLifecycleToken, canonicalJson, checkConversationApprovalPending, checkConversationPendingAnswer, checkConversationSelection, conversationApprovalRefusal, conversationGrant, deprovisionAgent, mintCreds, mkSecretDir, newIdentity, principalKey, provisionAgentDurables, processStartToken, resolveAuthProvider, writeSecretFileAtomic, } from "@cotal-ai/core";
|
|
5
|
+
import { getSpaceAuth, homeCotalDir, resolveTargetOrThrow, userAuthStateDir, workspaceSecretStore } from "@cotal-ai/workspace";
|
|
6
|
+
import { checkConversationMaterial, conversationRetirementPhase, discoverConversationAuthority, selectionRefusal, } from "./conversation-identity.js";
|
|
7
|
+
const RECORD = "identity.json";
|
|
8
|
+
const hash = (text) => createHash("sha256").update(text).digest("hex");
|
|
9
|
+
const identityRoot = () => join(homeCotalDir(), "app-identities");
|
|
10
|
+
const trust = (t) => hash(JSON.stringify({ space: t.space, root: t.root, server: t.server, tlsRequired: t.tlsRequired, userAuth: t.userAuth }));
|
|
11
|
+
function syncFile(path) {
|
|
12
|
+
const fd = openSync(path, "r");
|
|
13
|
+
try {
|
|
14
|
+
fsyncSync(fd);
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
closeSync(fd);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function save(dir, record) {
|
|
21
|
+
writeSecretFileAtomic(join(dir, RECORD), JSON.stringify(record));
|
|
22
|
+
syncFile(join(dir, RECORD));
|
|
23
|
+
if (process.platform !== "win32")
|
|
24
|
+
syncFile(dir);
|
|
25
|
+
}
|
|
26
|
+
function privateDir(dir) {
|
|
27
|
+
const st = lstatSync(dir);
|
|
28
|
+
if (!st.isDirectory() || (process.getuid && (st.uid !== process.getuid() || (st.mode & 0o077) !== 0)))
|
|
29
|
+
throw new Error("conversation identity state is not an owner-private directory");
|
|
30
|
+
}
|
|
31
|
+
function read(dir) {
|
|
32
|
+
privateDir(dir);
|
|
33
|
+
const file = join(dir, RECORD);
|
|
34
|
+
const st = lstatSync(file);
|
|
35
|
+
if (!st.isFile() || (process.getuid && (st.uid !== process.getuid() || (st.mode & 0o077) !== 0)))
|
|
36
|
+
throw new Error("conversation identity record is not an owner-private regular file");
|
|
37
|
+
const record = JSON.parse(readFileSync(file, "utf8"));
|
|
38
|
+
if (record.v !== 1 || typeof record.space !== "string" || typeof record.root !== "string" ||
|
|
39
|
+
typeof record.session !== "string" || !/^[A-Za-z0-9_-]{22,64}$/.test(record.requestId) ||
|
|
40
|
+
!/^[A-Za-z0-9_-]{43}$/.test(record.token) || !["creating", "ready", "retiring"].includes(record.state) ||
|
|
41
|
+
!record.consumer || !Number.isInteger(record.consumer.pid) || record.consumer.pid <= 0 ||
|
|
42
|
+
Boolean(record.remote) === Boolean(record.local))
|
|
43
|
+
throw new Error("conversation identity recovery record is invalid; it was retained");
|
|
44
|
+
if (record.selection !== undefined)
|
|
45
|
+
checkConversationSelection(record.selection);
|
|
46
|
+
const pending = record.remote?.approval?.pending;
|
|
47
|
+
if (pending !== undefined)
|
|
48
|
+
checkConversationApprovalPending(pending, new URL(record.remote.url).origin);
|
|
49
|
+
return record;
|
|
50
|
+
}
|
|
51
|
+
/** Only the kernel's "no such process" proves a consumer gone, before its identity is reissued or
|
|
52
|
+
* retired. A live pid whose start token reads differently is not proof: macOS reads that token
|
|
53
|
+
* through `ps` in the reader's locale and time zone. */
|
|
54
|
+
function consumerGone(consumer) {
|
|
55
|
+
try {
|
|
56
|
+
process.kill(consumer.pid, 0);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return error.code === "ESRCH";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** The creation body. A replay sends the same one, so its digest names the same request. */
|
|
64
|
+
function creationBody(record) {
|
|
65
|
+
return { v: 1, requestId: record.requestId, tokenHash: hash(record.token), label: record.label,
|
|
66
|
+
...(record.selection ? { selection: record.selection } : {}) };
|
|
67
|
+
}
|
|
68
|
+
/** An issued answer must carry the person's decision on the approval the request saw. Only the exact
|
|
69
|
+
* replay of an identity saved as issued before connection approval may carry none. */
|
|
70
|
+
function approvalExpectation(remote) {
|
|
71
|
+
if (remote.material && !remote.approval)
|
|
72
|
+
return undefined;
|
|
73
|
+
return { required: true, ...(remote.approval?.pending ? { id: remote.approval.pending.id } : {}) };
|
|
74
|
+
}
|
|
75
|
+
/** Mark a request with no issued identity as under approval before it is sent, so every answer to it
|
|
76
|
+
* from then on, including one replayed after a crash, needs the person's decision. */
|
|
77
|
+
function markUnderApproval(dir, record) {
|
|
78
|
+
if (record.remote.material || record.remote.approval)
|
|
79
|
+
return;
|
|
80
|
+
record.remote.approval = {};
|
|
81
|
+
save(dir, record);
|
|
82
|
+
}
|
|
83
|
+
/** What one creation answer proves. A selection refusal, a recorded denial or expiry, and a pending
|
|
84
|
+
* approval each prove that nothing was issued. Any other answer than an exact issued identity
|
|
85
|
+
* leaves the outcome unknown, so it throws and the request stays saved. */
|
|
86
|
+
function creationOutcome(record, authority, response, what) {
|
|
87
|
+
const remote = record.remote;
|
|
88
|
+
if (!remote.material) {
|
|
89
|
+
const refusal = selectionRefusal(response.status, response.body);
|
|
90
|
+
if (refusal)
|
|
91
|
+
return { refused: `${refusal}; no identity was issued` };
|
|
92
|
+
const decided = conversationApprovalRefusal(response.status, response.body);
|
|
93
|
+
if (decided === "denied")
|
|
94
|
+
return { refused: "the person denied this connection; no identity was issued" };
|
|
95
|
+
if (decided === "expired")
|
|
96
|
+
return { refused: "the approval expired before anyone decided; no identity was issued. Connect again to ask again" };
|
|
97
|
+
if (response.status === 202) {
|
|
98
|
+
const pending = checkConversationPendingAnswer(response.body, { requestId: record.requestId, authorityOrigin: new URL(authority.url).origin, proposed: record.selection ?? null });
|
|
99
|
+
if (remote.approval?.pending && canonicalJson(remote.approval.pending) !== canonicalJson(pending.approval))
|
|
100
|
+
throw new Error("conversation identity approval changed while it was pending; its request was retained");
|
|
101
|
+
return { pending };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (response.status !== 200 && response.status !== 201)
|
|
105
|
+
throw new Error(`conversation identity ${what} answered HTTP ${response.status}; its original request was retained`);
|
|
106
|
+
return { material: checkConversationMaterial(response.body, authority, record.requestId, record.selection, approvalExpectation(remote)) };
|
|
107
|
+
}
|
|
108
|
+
function request(provider) {
|
|
109
|
+
if (!provider.requestConversationIdentity)
|
|
110
|
+
throw new Error("the auth provider does not support conversation identity authority");
|
|
111
|
+
return provider.requestConversationIdentity.bind(provider);
|
|
112
|
+
}
|
|
113
|
+
/** The session key is supplied by the native host, not guessed from a parent pid or an open inbox.
|
|
114
|
+
* A new request waits for a person's approval: until it is decided this returns `pending`, and
|
|
115
|
+
* connecting again replays the same saved request and secret. */
|
|
116
|
+
export async function provisionUserApp(target, name, session, events, selection) {
|
|
117
|
+
if (!session || !/^[A-Za-z0-9_-]{1,128}$/.test(session))
|
|
118
|
+
throw new Error("a signed-in conversation needs its native session identity before connecting");
|
|
119
|
+
const store = workspaceSecretStore(target.root);
|
|
120
|
+
const infra = target.userAuth?.remote === true ? undefined : await getSpaceAuth(store, target.space);
|
|
121
|
+
const authority = infra ? undefined : await discoverConversationAuthority(target);
|
|
122
|
+
const policy = authority?.bundle.policy ?? target.policy;
|
|
123
|
+
if (policy?.events === "required" && !events)
|
|
124
|
+
throw new Error("this mesh requires a real native conversation event source; no identity was requested");
|
|
125
|
+
const provider = resolveAuthProvider();
|
|
126
|
+
if (authority)
|
|
127
|
+
request(provider);
|
|
128
|
+
if (selection && authority && !authority.selection)
|
|
129
|
+
throw new Error("the selected mesh does not offer selection for conversation identities; no identity was requested");
|
|
130
|
+
const root = identityRoot();
|
|
131
|
+
mkSecretDir(root);
|
|
132
|
+
privateDir(root);
|
|
133
|
+
const dir = join(root, hash(`${target.space}\0${session}`));
|
|
134
|
+
// A reconnect first finishes the previous explicit departure. Only a confirmed terminal
|
|
135
|
+
// retirement can release this session key for a new request and a new secret.
|
|
136
|
+
if (existsSync(join(dir, RECORD)) && read(dir).state === "retiring") {
|
|
137
|
+
try {
|
|
138
|
+
await retireUserApp(dir);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
throw new Error(`this conversation's previous identity is still retiring: ${error.message}. Connect again to retry it`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const lock = acquireLock(`${dir}.lock`, { waitMs: 0 });
|
|
145
|
+
try {
|
|
146
|
+
let record;
|
|
147
|
+
if (existsSync(join(dir, RECORD))) {
|
|
148
|
+
record = read(dir);
|
|
149
|
+
if (record.session !== session || record.trust !== trust(target) || record.label !== name)
|
|
150
|
+
throw new Error("this conversation has a saved identity under different mesh pins or a different name; disconnect it before connecting again");
|
|
151
|
+
if (canonicalJson(record.selection ?? null) !== canonicalJson(selection ?? null))
|
|
152
|
+
throw new Error("this conversation has a saved identity with a different selection; connect with that selection to resume it, then disconnect before choosing another");
|
|
153
|
+
if (record.state === "retiring")
|
|
154
|
+
throw new Error("this conversation's prior identity is still retiring; retry disconnect before connecting again");
|
|
155
|
+
if (record.consumer.pid !== process.ppid && !consumerGone(record.consumer))
|
|
156
|
+
throw new Error("this native conversation still has a live inbox consumer; no identity was reissued");
|
|
157
|
+
record.consumer = { pid: process.ppid, start: processStartToken(process.ppid) };
|
|
158
|
+
save(dir, record);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// A new identity needs a person's approval. Nothing local can give one, and a remote authority
|
|
162
|
+
// must advertise connection approval before anything authenticated is sent.
|
|
163
|
+
if (!authority)
|
|
164
|
+
throw new Error("this mesh has no human approval for a new conversation identity, so none was requested");
|
|
165
|
+
if (!authority.approval)
|
|
166
|
+
throw new Error("the selected mesh does not advertise connection approval v1; no identity was requested");
|
|
167
|
+
mkSecretDir(dir);
|
|
168
|
+
privateDir(dir);
|
|
169
|
+
if (readdirSync(dir).length)
|
|
170
|
+
throw new Error("conversation identity state is incomplete; it was retained for recovery");
|
|
171
|
+
const token = randomBytes(32).toString("base64url");
|
|
172
|
+
record = {
|
|
173
|
+
v: 1, space: target.space, root: target.root, trust: trust(target), session,
|
|
174
|
+
requestId: randomBytes(24).toString("base64url"), label: name, token, state: "creating",
|
|
175
|
+
consumer: { pid: process.ppid, start: processStartToken(process.ppid) }, ...(selection ? { selection } : {}),
|
|
176
|
+
remote: { url: authority.url, idpUrl: target.userAuth.idp.url, approval: {} },
|
|
177
|
+
};
|
|
178
|
+
save(dir, record);
|
|
179
|
+
if (process.platform !== "win32") {
|
|
180
|
+
syncFile(root);
|
|
181
|
+
syncFile(dirname(root));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (record.remote) {
|
|
185
|
+
if (!authority || record.remote.url !== authority.url || record.remote.idpUrl !== target.userAuth?.idp.url)
|
|
186
|
+
throw new Error("conversation identity authority changed; the saved identity was retained");
|
|
187
|
+
// Only an exact replay of an issued identity may go to an authority without approval.
|
|
188
|
+
if (!record.remote.material && !authority.approval)
|
|
189
|
+
throw new Error("the selected mesh does not advertise connection approval v1; the saved request was retained and not sent");
|
|
190
|
+
markUnderApproval(dir, record);
|
|
191
|
+
const response = await request(provider)({ url: authority.url, idpUrl: record.remote.idpUrl, method: "POST", body: creationBody(record) });
|
|
192
|
+
const outcome = creationOutcome(record, authority, response, "creation");
|
|
193
|
+
if ("refused" in outcome) {
|
|
194
|
+
discard(dir);
|
|
195
|
+
throw new Error(outcome.refused);
|
|
196
|
+
}
|
|
197
|
+
if ("pending" in outcome) {
|
|
198
|
+
record.remote.approval = { pending: outcome.pending.approval };
|
|
199
|
+
save(dir, record);
|
|
200
|
+
return { pending: outcome.pending };
|
|
201
|
+
}
|
|
202
|
+
if (record.remote.material && JSON.stringify(record.remote.material) !== JSON.stringify(outcome.material))
|
|
203
|
+
throw new Error("conversation identity replay changed its saved lifecycle or grant");
|
|
204
|
+
record.remote.material = outcome.material;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
// An identity granted here before connection approval resumes exactly. One without a
|
|
208
|
+
// confirmed grant is not issued now: no human approval exists on this path.
|
|
209
|
+
const local = record.local;
|
|
210
|
+
if (!local.sentinelCreds)
|
|
211
|
+
throw new Error("this mesh has no human approval for a new conversation identity, so this unfinished one was not issued; disconnect it to remove its saved request");
|
|
212
|
+
const grant = conversationGrant(local, record.selection);
|
|
213
|
+
const provisioner = new CotalEndpoint({ space: target.space, servers: target.server,
|
|
214
|
+
creds: await mintCreds(infra, newIdentity(), "provisioner"), channels: [], consume: false,
|
|
215
|
+
registerPresence: false, watchPresence: false, watchChannels: false,
|
|
216
|
+
card: { name: "app-provisioner", kind: "endpoint" } });
|
|
217
|
+
provisioner.on("error", () => { });
|
|
218
|
+
provisioner.on("warning", () => { });
|
|
219
|
+
try {
|
|
220
|
+
await provisioner.start();
|
|
221
|
+
await provisionAgentDurables(provisioner, local, { subscribe: [], allowSubscribe: grant.allowSubscribe, ...(grant.role ? { role: grant.role } : {}) });
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
await provisioner.stop();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
record.state = "ready";
|
|
228
|
+
save(dir, record);
|
|
229
|
+
const material = record.remote?.material ?? record.local;
|
|
230
|
+
const grant = record.remote?.material?.grant ?? conversationGrant(record.local, record.selection);
|
|
231
|
+
writeSecretFileAtomic(join(dir, "actor.token"), record.token);
|
|
232
|
+
writeSecretFileAtomic(join(dir, "sentinel.creds"), material.sentinelCreds);
|
|
233
|
+
const bearer = [process.execPath, ...process.execArgv, process.argv[1], provider.agentBearerCommand,
|
|
234
|
+
...(record.remote ? ["--exchange-url", record.remote.material.exchangeUrl] : ["--dir", userAuthStateDir(target.root, target.space)]),
|
|
235
|
+
"--space", target.space, "--owner", material.owner, "--actor", material.actor, "--token-file", join(dir, "actor.token")];
|
|
236
|
+
return { env: {
|
|
237
|
+
COTAL_SPACE: target.space, COTAL_SERVERS: target.server, COTAL_NAME: name, COTAL_TLS: target.tlsRequired ? "1" : "0",
|
|
238
|
+
COTAL_OWNER: material.owner, COTAL_ACTOR: material.actor, COTAL_LIFECYCLE_UID: material.lifecycleUid,
|
|
239
|
+
COTAL_SENTINEL_CREDS: join(dir, "sentinel.creds"), COTAL_BEARER_CMD: JSON.stringify(bearer),
|
|
240
|
+
COTAL_SUBSCRIBE: "", COTAL_ALLOW_SUBSCRIBE: grant.allowSubscribe.join(","), COTAL_ALLOW_PUBLISH: grant.allowPublish.join(","),
|
|
241
|
+
...(grant.role ? { COTAL_ROLE: grant.role } : {}), ...(grant.scope.length ? { COTAL_CAPABILITIES: grant.scope.join(",") } : {}),
|
|
242
|
+
COTAL_WORKSPACE_ROOT: homeCotalDir(), ...(events ? { COTAL_EVENTS: "1" } : {}),
|
|
243
|
+
...(policy?.events === "required" ? { COTAL_EVENTS_REQUIRED: "1" } : {}),
|
|
244
|
+
}, retire: { dir }, grant };
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
lock.release();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/** Remove a creation record the authority refused before writing anything. */
|
|
251
|
+
function discard(dir) {
|
|
252
|
+
if (readdirSync(dir).some((name) => name !== RECORD))
|
|
253
|
+
throw new Error("conversation identity directory contains unrecognized files; recovery state was retained");
|
|
254
|
+
unlinkSync(join(dir, RECORD));
|
|
255
|
+
rmdirSync(dir);
|
|
256
|
+
if (process.platform !== "win32")
|
|
257
|
+
syncFile(identityRoot());
|
|
258
|
+
}
|
|
259
|
+
export function isUserAppDir(dir) {
|
|
260
|
+
return dirname(resolve(dir)) === resolve(identityRoot()) && /^[a-f0-9]{64}$/.test(basename(dir));
|
|
261
|
+
}
|
|
262
|
+
/** Retain the record and secret until exact lifecycle revocation and footprint cleanup are observed. */
|
|
263
|
+
export function retireUserApp(dir) {
|
|
264
|
+
return retire(dir);
|
|
265
|
+
}
|
|
266
|
+
/** Retire this mesh's saved conversations whose consumer process is provably gone, such as a
|
|
267
|
+
* gateway killed before it could retire them. A live or unknown consumer keeps its identity, and a
|
|
268
|
+
* retirement that does not finish stays saved for a later run. A live record is never locked. */
|
|
269
|
+
export async function retireDeadUserApps(target) {
|
|
270
|
+
const root = identityRoot();
|
|
271
|
+
if (!existsSync(root))
|
|
272
|
+
return;
|
|
273
|
+
const dead = (record) => record.trust === trust(target) && consumerGone(record.consumer);
|
|
274
|
+
for (const name of readdirSync(root)) {
|
|
275
|
+
const dir = join(root, name);
|
|
276
|
+
try {
|
|
277
|
+
if (isUserAppDir(dir) && existsSync(join(dir, RECORD)) && dead(read(dir)))
|
|
278
|
+
await retire(dir, dead);
|
|
279
|
+
}
|
|
280
|
+
catch { /* retained for a later run */ }
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/** `when` is decided under the record's lock, so a consumer that reissued it in between keeps it. */
|
|
284
|
+
async function retire(dir, when) {
|
|
285
|
+
if (!isUserAppDir(dir))
|
|
286
|
+
throw new Error("not a saved conversation identity directory");
|
|
287
|
+
const lock = acquireLock(`${dir}.lock`, { waitMs: 0 });
|
|
288
|
+
try {
|
|
289
|
+
const record = read(dir);
|
|
290
|
+
if (when && !when(record))
|
|
291
|
+
return;
|
|
292
|
+
const target = await resolveTargetOrThrow({ space: record.space });
|
|
293
|
+
if (trust(target) !== record.trust)
|
|
294
|
+
throw new Error("conversation identity mesh trust changed; retirement was not sent");
|
|
295
|
+
const provider = resolveAuthProvider();
|
|
296
|
+
record.state = "retiring";
|
|
297
|
+
save(dir, record);
|
|
298
|
+
if (record.remote) {
|
|
299
|
+
const authority = await discoverConversationAuthority(target);
|
|
300
|
+
if (authority.url !== record.remote.url || record.remote.idpUrl !== target.userAuth?.idp.url)
|
|
301
|
+
throw new Error("conversation identity authority changed; recovery was not sent");
|
|
302
|
+
let material = record.remote.material;
|
|
303
|
+
if (!material) {
|
|
304
|
+
if (record.selection && !authority.selection)
|
|
305
|
+
throw new Error("the selected mesh no longer offers selection for conversation identities; recovery was not sent");
|
|
306
|
+
if (!authority.approval)
|
|
307
|
+
throw new Error("the selected mesh does not advertise connection approval v1; recovery was not sent");
|
|
308
|
+
markUnderApproval(dir, record);
|
|
309
|
+
const replay = await request(provider)({ url: authority.url, idpUrl: record.remote.idpUrl, method: "POST", body: creationBody(record) });
|
|
310
|
+
const outcome = creationOutcome(record, authority, replay, "recovery");
|
|
311
|
+
// Refused, or still pending: the authority issued nothing, so there is nothing to retire.
|
|
312
|
+
if (!("material" in outcome)) {
|
|
313
|
+
discard(dir);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
material = outcome.material;
|
|
317
|
+
record.remote.material = material;
|
|
318
|
+
save(dir, record);
|
|
319
|
+
}
|
|
320
|
+
material = checkConversationMaterial(material, authority, record.requestId, record.selection, approvalExpectation(record.remote));
|
|
321
|
+
const expected = new URL(`${authority.url}/${material.actor}`);
|
|
322
|
+
expected.searchParams.set("lifecycleUid", assertLifecycleToken(material.lifecycleUid));
|
|
323
|
+
if (material.retire.url !== expected.href)
|
|
324
|
+
throw new Error("saved retirement URL does not name the exact lifecycle");
|
|
325
|
+
const response = await request(provider)({ url: expected.href, idpUrl: record.remote.idpUrl, method: "DELETE" });
|
|
326
|
+
const phase = conversationRetirementPhase(response.status, response.body, material);
|
|
327
|
+
if (phase !== "terminal")
|
|
328
|
+
throw new Error(`conversation identity retirement is pending at phase ${JSON.stringify(phase)}; its saved lifecycle was retained for an exact retry`);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
const local = record.local;
|
|
332
|
+
const store = workspaceSecretStore(target.root);
|
|
333
|
+
const infra = await getSpaceAuth(store, target.space);
|
|
334
|
+
if (!infra)
|
|
335
|
+
throw new Error("local conversation retirement has no space authority");
|
|
336
|
+
const stateDir = userAuthStateDir(target.root, target.space);
|
|
337
|
+
const revoked = await provider.revokeAgent({ dir: stateDir, owner: local.owner, actor: local.actor,
|
|
338
|
+
lifecycleUid: local.lifecycleUid, expectCustody: { kind: "foreground" },
|
|
339
|
+
...(local.sentinelCreds ? { actorToken: record.token } : {}) });
|
|
340
|
+
if (!revoked && await provider.actorScope({ dir: stateDir, owner: local.owner, actor: local.actor }) !== undefined)
|
|
341
|
+
throw new Error("the saved local conversation no longer matches its live grant; no broker footprint was removed");
|
|
342
|
+
const creds = await mintCreds(infra, newIdentity(), "deprovisioner", { deprovisionTarget: {
|
|
343
|
+
principal: principalKey(local.owner, local.actor).key, lifecycleUid: local.lifecycleUid
|
|
344
|
+
} });
|
|
345
|
+
await deprovisionAgent({ servers: target.server, space: target.space, targetId: principalKey(local.owner, local.actor).key,
|
|
346
|
+
lifecycleUid: local.lifecycleUid, creds });
|
|
347
|
+
}
|
|
348
|
+
const files = ["actor.token", "sentinel.creds", RECORD];
|
|
349
|
+
if (readdirSync(dir).some((name) => !files.includes(name)))
|
|
350
|
+
throw new Error("conversation identity directory contains unrecognized files; recovery state was retained");
|
|
351
|
+
for (const file of files) {
|
|
352
|
+
const path = join(dir, file);
|
|
353
|
+
if (existsSync(path))
|
|
354
|
+
unlinkSync(path);
|
|
355
|
+
}
|
|
356
|
+
rmdirSync(dir);
|
|
357
|
+
if (process.platform !== "win32")
|
|
358
|
+
syncFile(identityRoot());
|
|
359
|
+
}
|
|
360
|
+
finally {
|
|
361
|
+
lock.release();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=app-user-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-user-identity.js","sourceRoot":"","sources":["../../src/lib/app-user-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClI,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,EAAE,gCAAgC,EAAE,8BAA8B,EACjI,0BAA0B,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EACjI,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,qBAAqB,GAEpG,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAoB,EAAmB,MAAM,qBAAqB,CAAC;AAChJ,OAAO,EACL,yBAAyB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,gBAAgB,GAExG,MAAM,4BAA4B,CAAC;AAuBpC,MAAM,MAAM,GAAG,eAAe,CAAC;AAC/B,MAAM,IAAI,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AC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG;gBACxH,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;QACxD,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;QAC9G,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC7B,IAAI,UAAU,CAAC,IAAI,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,CAAC;QACf,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;YAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7D,CAAC;YAAS,CAAC;QAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ConversationApprovalDecision, type ConversationGrant, type ConversationSelection } from "@cotal-ai/core";
|
|
2
|
+
import { type MeshTarget, type UserBundle } from "@cotal-ai/workspace";
|
|
3
|
+
export interface ConversationAuthority {
|
|
4
|
+
url: string;
|
|
5
|
+
bundle: UserBundle;
|
|
6
|
+
/** The authority advertises selection v1, so a request may carry a {@link ConversationSelection}. */
|
|
7
|
+
selection: boolean;
|
|
8
|
+
/** The authority advertises connection approval v1: a person decides every new request. */
|
|
9
|
+
approval: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Discover without human proof, then bind every returned trust pin to the selected registration. */
|
|
12
|
+
export declare function discoverConversationAuthority(target: MeshTarget): Promise<ConversationAuthority>;
|
|
13
|
+
export interface ConversationMaterial {
|
|
14
|
+
v: 1;
|
|
15
|
+
requestId: string;
|
|
16
|
+
space: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
actor: string;
|
|
19
|
+
lifecycleUid: string;
|
|
20
|
+
grant: ConversationGrant;
|
|
21
|
+
policy?: {
|
|
22
|
+
events: "required";
|
|
23
|
+
};
|
|
24
|
+
sentinelCreds: string;
|
|
25
|
+
exchangeUrl: string;
|
|
26
|
+
retire: {
|
|
27
|
+
url: string;
|
|
28
|
+
};
|
|
29
|
+
/** The person's recorded decision. `null` or absent only for an identity issued before approval. */
|
|
30
|
+
approval?: ConversationApprovalDecision | null;
|
|
31
|
+
}
|
|
32
|
+
/** A successful HTTP status is not authority: require the exact pins and exactly the grant the
|
|
33
|
+
* person approved. When `approval` is not required, for an identity requested before approval, an
|
|
34
|
+
* answer may carry no decision; its grant is then the one the request implies: the selection's, or
|
|
35
|
+
* the own-event-only grant without one. `approval.id` binds a decision to the pending approval the
|
|
36
|
+
* client saw. */
|
|
37
|
+
export declare function checkConversationMaterial(value: unknown, authority: ConversationAuthority, requestId: string, selection?: ConversationSelection, approval?: {
|
|
38
|
+
required: true;
|
|
39
|
+
id?: string;
|
|
40
|
+
}): ConversationMaterial;
|
|
41
|
+
/** The items a 409 says exceed the caller's own access, as one bounded line, or undefined when the
|
|
42
|
+
* answer is not that refusal. The authority wrote nothing for such a request. */
|
|
43
|
+
export declare function selectionRefusal(status: number, value: unknown): string | undefined;
|
|
44
|
+
/** The phase a retirement reached, `terminal` once it is complete. Pending, malformed and unconfirmed
|
|
45
|
+
* retirement all keep the saved identity for an exact retry. */
|
|
46
|
+
export declare function conversationRetirementPhase(status: number, value: unknown, material: ConversationMaterial): string;
|
|
47
|
+
//# sourceMappingURL=conversation-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-identity.d.ts","sourceRoot":"","sources":["../../src/lib/conversation-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAAE,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EACtF,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAyC,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE9G,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,qGAAqG;IACrG,SAAS,EAAE,OAAO,CAAC;IACnB,2FAA2F;IAC3F,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qGAAqG;AACrG,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAwBtG;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,EAAE,CAAC,CAAC;IACL,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAC;CAChD;AAcD;;;;kBAIkB;AAClB,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,qBAAqB,EACtG,QAAQ,CAAC,EAAE;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,oBAAoB,CA+BtB;AAKD;kFACkF;AAClF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAenF;AAED;iEACiE;AACjE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,GAAG,MAAM,CAQlH"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { assertLifecycleToken, canonicalJson, checkConversationApprovalDecision, conversationGrant, principalKey, } from "@cotal-ai/core";
|
|
2
|
+
import { checkUserBundle, discoveryDocumentUrl } from "@cotal-ai/workspace";
|
|
3
|
+
/** Discover without human proof, then bind every returned trust pin to the selected registration. */
|
|
4
|
+
export async function discoverConversationAuthority(target) {
|
|
5
|
+
const pinned = target.userAuth;
|
|
6
|
+
if (!pinned?.endpoints?.url)
|
|
7
|
+
throw new Error("the selected mesh has no pinned user-auth exchange");
|
|
8
|
+
const url = discoveryDocumentUrl(new URL(pinned.endpoints.url));
|
|
9
|
+
secureUrl(url.href);
|
|
10
|
+
const response = await fetch(url, { redirect: "manual", credentials: "omit", signal: AbortSignal.timeout(5_000) });
|
|
11
|
+
if (!response.ok)
|
|
12
|
+
throw new Error(`conversation identity discovery answered HTTP ${response.status}; no identity was requested`);
|
|
13
|
+
const raw = await response.text();
|
|
14
|
+
const checked = checkUserBundle(raw);
|
|
15
|
+
if (!checked.ok)
|
|
16
|
+
throw new Error("conversation identity discovery returned an invalid registration");
|
|
17
|
+
const bundle = checked.value;
|
|
18
|
+
if (bundle.space !== target.space || bundle.server !== target.server || bundle.tlsRequired !== target.tlsRequired ||
|
|
19
|
+
bundle.userAuth.provider !== pinned.provider || bundle.userAuth.idp.url !== pinned.idp.url || bundle.userAuth.idp.issuer !== pinned.idp.issuer ||
|
|
20
|
+
bundle.userAuth.idp.audience !== pinned.idp.audience || bundle.userAuth.endpoints?.url !== pinned.endpoints.url)
|
|
21
|
+
throw new Error("conversation identity discovery changed the selected registration's trust pins");
|
|
22
|
+
const capabilities = JSON.parse(raw)?.cloudCapabilities;
|
|
23
|
+
const capability = capabilities?.conversationIdentity;
|
|
24
|
+
if (capability?.version !== 1 || typeof capability.url !== "string")
|
|
25
|
+
throw new Error("the selected mesh does not advertise conversation identity v1; no identity was requested");
|
|
26
|
+
const authority = secureUrl(capability.url);
|
|
27
|
+
if (authority.origin !== url.origin || authority.pathname !== `/api/spaces/${encodeURIComponent(target.space)}/conversation-identities` || authority.search)
|
|
28
|
+
throw new Error("conversation identity authority does not name the selected origin and space");
|
|
29
|
+
return { url: authority.href, bundle, selection: capabilities?.conversationIdentitySelection?.version === 1,
|
|
30
|
+
approval: capabilities?.connectionApproval?.version === 1 };
|
|
31
|
+
}
|
|
32
|
+
function object(value) {
|
|
33
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
34
|
+
throw new Error("invalid conversation identity response");
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
function secureUrl(value) {
|
|
38
|
+
const url = new URL(value);
|
|
39
|
+
if (url.protocol !== "https:" || url.username || url.password || url.hash || url.href !== value)
|
|
40
|
+
throw new Error("conversation identity URL must be canonical HTTPS without userinfo or a fragment");
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
/** A successful HTTP status is not authority: require the exact pins and exactly the grant the
|
|
44
|
+
* person approved. When `approval` is not required, for an identity requested before approval, an
|
|
45
|
+
* answer may carry no decision; its grant is then the one the request implies: the selection's, or
|
|
46
|
+
* the own-event-only grant without one. `approval.id` binds a decision to the pending approval the
|
|
47
|
+
* client saw. */
|
|
48
|
+
export function checkConversationMaterial(value, authority, requestId, selection, approval) {
|
|
49
|
+
const body = object(value);
|
|
50
|
+
const known = ["v", "requestId", "space", "owner", "actor", "lifecycleUid", "grant", "policy", "sentinelCreds", "exchangeUrl", "retire", "approval"];
|
|
51
|
+
if (Object.keys(body).some((key) => !known.includes(key)) || body.v !== 1 || body.requestId !== requestId ||
|
|
52
|
+
body.space !== authority.bundle.space || typeof body.owner !== "string" || typeof body.actor !== "string" ||
|
|
53
|
+
!/^pa_[a-z2-7]{26}$/.test(body.actor) || typeof body.lifecycleUid !== "string")
|
|
54
|
+
throw new Error("conversation identity response does not match the saved request");
|
|
55
|
+
principalKey(body.owner, body.actor);
|
|
56
|
+
assertLifecycleToken(body.lifecycleUid);
|
|
57
|
+
const principal = { owner: body.owner, actor: body.actor };
|
|
58
|
+
if (body.approval === undefined || body.approval === null) {
|
|
59
|
+
if (approval)
|
|
60
|
+
throw new Error("conversation identity was issued without a recorded approval");
|
|
61
|
+
if (canonicalJson(object(body.grant)) !== canonicalJson(conversationGrant(principal, selection)))
|
|
62
|
+
throw new Error(selection ? "conversation identity grant is not the exact grant its selection asked for"
|
|
63
|
+
: "conversation identity grant is not the exact own-event-only grant");
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const decision = checkConversationApprovalDecision(body.approval);
|
|
67
|
+
if (approval?.id !== undefined && decision.id !== approval.id)
|
|
68
|
+
throw new Error("conversation identity names another approval than the one requested");
|
|
69
|
+
if (canonicalJson(object(body.grant)) !== canonicalJson(conversationGrant(principal, decision.approved)))
|
|
70
|
+
throw new Error("conversation identity grant is not the exact grant the person approved");
|
|
71
|
+
}
|
|
72
|
+
if (JSON.stringify(body.policy ?? null) !== JSON.stringify(authority.bundle.policy ?? null))
|
|
73
|
+
throw new Error("conversation identity response changed the selected event policy");
|
|
74
|
+
if (body.sentinelCreds !== authority.bundle.sentinelCreds || body.exchangeUrl !== authority.bundle.userAuth.endpoints?.url)
|
|
75
|
+
throw new Error("conversation identity response changed the sentinel or exchange pin");
|
|
76
|
+
const retire = object(body.retire);
|
|
77
|
+
if (Object.keys(retire).length !== 1 || typeof retire.url !== "string")
|
|
78
|
+
throw new Error("conversation identity has no exact retirement URL");
|
|
79
|
+
const expected = new URL(`${authority.url}/${body.actor}`);
|
|
80
|
+
expected.searchParams.set("lifecycleUid", body.lifecycleUid);
|
|
81
|
+
if (secureUrl(retire.url).href !== expected.href)
|
|
82
|
+
throw new Error("conversation identity retirement names another lifecycle");
|
|
83
|
+
return body;
|
|
84
|
+
}
|
|
85
|
+
/** How many refused items one refusal line names. */
|
|
86
|
+
const REFUSED_SHOWN = 8;
|
|
87
|
+
/** The items a 409 says exceed the caller's own access, as one bounded line, or undefined when the
|
|
88
|
+
* answer is not that refusal. The authority wrote nothing for such a request. */
|
|
89
|
+
export function selectionRefusal(status, value) {
|
|
90
|
+
if (status !== 409 || !value || typeof value !== "object")
|
|
91
|
+
return undefined;
|
|
92
|
+
const body = value;
|
|
93
|
+
if (body.error !== "selection exceeds your own access" || !Array.isArray(body.refused) || !body.refused.length)
|
|
94
|
+
return undefined;
|
|
95
|
+
const text = (value) => JSON.stringify(typeof value === "string" ? value.slice(0, 160) : "");
|
|
96
|
+
const items = body.refused.slice(0, REFUSED_SHOWN).map((entry) => {
|
|
97
|
+
const { kind, item } = (entry ?? {});
|
|
98
|
+
if (kind === "channel" && item && typeof item === "object") {
|
|
99
|
+
const { channel, access } = item;
|
|
100
|
+
return `channel ${text(channel)} (${access === "read-post" ? "read-post" : "read"})`;
|
|
101
|
+
}
|
|
102
|
+
return `${kind === "role" ? "role" : "capability"} ${text(item)}`;
|
|
103
|
+
});
|
|
104
|
+
const more = body.refused.length - items.length;
|
|
105
|
+
return `the selection exceeds your own access: ${items.join(", ")}${more > 0 ? ` and ${more} more` : ""}`;
|
|
106
|
+
}
|
|
107
|
+
/** The phase a retirement reached, `terminal` once it is complete. Pending, malformed and unconfirmed
|
|
108
|
+
* retirement all keep the saved identity for an exact retry. */
|
|
109
|
+
export function conversationRetirementPhase(status, value, material) {
|
|
110
|
+
const body = object(value);
|
|
111
|
+
if (body.v !== 1 || body.actor !== material.actor || body.lifecycleUid !== material.lifecycleUid)
|
|
112
|
+
throw new Error("conversation retirement response does not match the saved lifecycle");
|
|
113
|
+
if (status === 200 && body.complete === true && body.phase === "terminal")
|
|
114
|
+
return "terminal";
|
|
115
|
+
if (status === 202 && body.complete === false && typeof body.phase === "string" && /^[A-Za-z0-9_.-]{1,64}$/.test(body.phase) && body.phase !== "terminal")
|
|
116
|
+
return body.phase;
|
|
117
|
+
throw new Error("conversation retirement is unconfirmed; its saved identity was retained");
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=conversation-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-identity.js","sourceRoot":"","sources":["../../src/lib/conversation-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAAE,aAAa,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,YAAY,GAExG,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAoC,MAAM,qBAAqB,CAAC;AAW9G,qGAAqG;AACrG,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,MAAkB;IACpE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACnG,MAAM,GAAG,GAAG,oBAAoB,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnH,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC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AC,KAAK,CAAC;IACpB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;AAC7F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/cli",
|
|
3
3
|
"description": "Cotal mesh CLI: up, join, watch, console, spawn, mint, channels, history, ext.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.93.0",
|
|
5
5
|
"homepage": "https://cotal.ai",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cotal-ai/core": "0.
|
|
23
|
-
"@cotal-ai/workspace": "0.
|
|
22
|
+
"@cotal-ai/core": "0.93.0",
|
|
23
|
+
"@cotal-ai/workspace": "0.93.0",
|
|
24
24
|
"@nats-io/jetstream": "^3.4.0",
|
|
25
25
|
"@nats-io/kv": "^3.4.0",
|
|
26
26
|
"@nats-io/obj": "^3.4.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@eplightning/nats-server-win32-x64": "^2.14.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@cotal-ai/auth": "0.
|
|
44
|
+
"@cotal-ai/auth": "0.93.0",
|
|
45
45
|
"@cotal-ai/smoke-kit": "0.0.0",
|
|
46
46
|
"@types/react": "^19.0.0",
|
|
47
47
|
"@types/ws": "^8.18.1"
|