@cotal-ai/cli 0.172.1 → 0.172.2
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/command.d.ts.map +1 -1
- package/dist/command.js +19 -13
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +8 -6
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +2 -1
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +11 -7
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/clean.js +1 -1
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +27 -7
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-authoring.d.ts.map +1 -1
- package/dist/commands/endpoint-authoring.js +16 -4
- package/dist/commands/endpoint-authoring.js.map +1 -1
- package/dist/commands/history-clear.d.ts.map +1 -1
- package/dist/commands/history-clear.js +10 -3
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/history-limit.js +2 -2
- package/dist/commands/history-limit.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +49 -19
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +30 -7
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/manager-service.d.ts.map +1 -1
- package/dist/commands/manager-service.js +5 -1
- package/dist/commands/manager-service.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +4 -0
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +35 -1
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +5 -5
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +4 -3
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/persona-remote.js +2 -2
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +13 -5
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +4 -1
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.js +2 -2
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.d.ts +2 -2
- package/dist/commands/reset-store-apply.d.ts.map +1 -1
- package/dist/commands/reset-store-apply.js +10 -7
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/reset.js +2 -2
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +21 -9
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts.map +1 -1
- package/dist/commands/service-actions.js +15 -4
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +16 -5
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/space-delete.d.ts.map +1 -1
- package/dist/commands/space-delete.js +46 -31
- package/dist/commands/space-delete.js.map +1 -1
- package/dist/commands/space-registration.d.ts +4 -3
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +57 -37
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +3 -1
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-flags.d.ts +205 -0
- package/dist/commands/spawn-flags.d.ts.map +1 -0
- package/dist/commands/spawn-flags.js +34 -0
- package/dist/commands/spawn-flags.js.map +1 -0
- package/dist/commands/spawn-foreground.d.ts +74 -0
- package/dist/commands/spawn-foreground.d.ts.map +1 -0
- package/dist/commands/spawn-foreground.js +355 -0
- package/dist/commands/spawn-foreground.js.map +1 -0
- package/dist/commands/spawn-managed-launch.d.ts +43 -0
- package/dist/commands/spawn-managed-launch.d.ts.map +1 -0
- package/dist/commands/spawn-managed-launch.js +631 -0
- package/dist/commands/spawn-managed-launch.js.map +1 -0
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +7 -4
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts +6 -220
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +20 -1008
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +7 -4
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-up.d.ts +2 -0
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +9 -5
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status-stop-impact.d.ts +3 -0
- package/dist/commands/status-stop-impact.d.ts.map +1 -0
- package/dist/commands/status-stop-impact.js +34 -0
- package/dist/commands/status-stop-impact.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +20 -41
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +21 -4
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +25 -23
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/telemetry.d.ts +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +17 -7
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/up-target.d.ts +7 -0
- package/dist/commands/up-target.d.ts.map +1 -0
- package/dist/commands/up-target.js +42 -0
- package/dist/commands/up-target.js.map +1 -0
- package/dist/commands/up.d.ts +3 -10
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +44 -126
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update-caches.d.ts +4 -0
- package/dist/commands/update-caches.d.ts.map +1 -0
- package/dist/commands/update-caches.js +82 -0
- package/dist/commands/update-caches.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +29 -115
- package/dist/commands/update.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +2 -1
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/broker-log.d.ts +8 -0
- package/dist/lib/broker-log.d.ts.map +1 -0
- package/dist/lib/broker-log.js +27 -0
- package/dist/lib/broker-log.js.map +1 -0
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +22 -5
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/restore.d.ts +2 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +4 -3
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-preset-target.d.ts.map +1 -1
- package/dist/lib/service-preset-target.js +6 -2
- package/dist/lib/service-preset-target.js.map +1 -1
- package/dist/lib/service-presets.d.ts +2 -0
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +19 -2
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/spawn-defaults.d.ts +5 -0
- package/dist/lib/spawn-defaults.d.ts.map +1 -1
- package/dist/lib/spawn-defaults.js +5 -0
- package/dist/lib/spawn-defaults.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +4 -4
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +6 -5
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/up-broker-address.d.ts +7 -0
- package/dist/lib/up-broker-address.d.ts.map +1 -0
- package/dist/lib/up-broker-address.js +76 -0
- package/dist/lib/up-broker-address.js.map +1 -0
- package/dist/lib/up-report.d.ts +2 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +8 -1
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/update-connector-config.d.ts +6 -0
- package/dist/lib/update-connector-config.d.ts.map +1 -0
- package/dist/lib/update-connector-config.js +44 -0
- package/dist/lib/update-connector-config.js.map +1 -0
- package/dist/seed/reconcile.d.ts +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +28 -11
- package/dist/seed/reconcile.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type LaunchOpts, type SpaceAuth } from "@cotal-ai/core";
|
|
2
|
+
import { type MeshTarget } from "@cotal-ai/workspace";
|
|
3
|
+
import { HANDOFF_REFUSALS, type RemoteAgentMaterial } from "./spawn-enrollment.js";
|
|
4
|
+
/**
|
|
5
|
+
* Auto-number `requested` past any peer already present on the mesh (foo → foo_2 → foo_3) — the same
|
|
6
|
+
* series the manager's spawn funnel uses (firstFreeName). Foreground `cotal spawn` doesn't go through
|
|
7
|
+
* the manager, so it has no name reservation: this is a best-effort, advisory check. It connects a
|
|
8
|
+
* transient presence-watching endpoint, lets the roster settle, and snapshots the live names; two
|
|
9
|
+
* simultaneous `cotal spawn`s can still race onto the same number. If the mesh is unreachable the
|
|
10
|
+
* agent couldn't join it anyway, so dedup is skipped and the requested name stands.
|
|
11
|
+
*/
|
|
12
|
+
export declare function uniqueMeshName(requested: string, target: {
|
|
13
|
+
space: string;
|
|
14
|
+
server: string;
|
|
15
|
+
auth?: SpaceAuth;
|
|
16
|
+
}): Promise<string>;
|
|
17
|
+
export declare function provisionFreshForeground<T>(requested: string, autoName: boolean, userMode: boolean, provision: (name: string) => Promise<T>): Promise<{
|
|
18
|
+
name: string;
|
|
19
|
+
provisioned: T;
|
|
20
|
+
}>;
|
|
21
|
+
/** Foreground REMOTE-USER onboarding — the participant path for a mesh registered with
|
|
22
|
+
* `meshes add --from` that advertises an agent-provisioning endpoint (U6 §2).
|
|
23
|
+
*
|
|
24
|
+
* The local twin below ({@link provisionUserForeground}) cannot run here and must not try: it
|
|
25
|
+
* needs the space's owner secret and account signer to grant a row and pre-create durables, and
|
|
26
|
+
* those never leave the machine the mesh runs on. Instead the mesh's own endpoint does that work
|
|
27
|
+
* inside the owner's delegation envelope and hands back ready material; this function's job is to
|
|
28
|
+
* present the login bearer, validate what comes back, land it 0600, and prove the bearer chain
|
|
29
|
+
* before launch — the same preflight discipline, with the grant performed remotely.
|
|
30
|
+
*
|
|
31
|
+
* Deliberately NOT reusing the local path's cleanup: nothing here created broker state locally, so
|
|
32
|
+
* teardown is the mesh's business (its lifecycle owns the row and the durables). The spawned
|
|
33
|
+
* agent's material is shredded on exit; the row is not revoked from here, because this machine
|
|
34
|
+
* holds no authority to revoke it. For a managed handoff, `refusals` replaces the sentences of the
|
|
35
|
+
* local-state, material and bearer steps, which quote the space, the actor or the exchange URL. */
|
|
36
|
+
export declare function provisionRemoteUserForeground(target: MeshTarget, name: string, source: {
|
|
37
|
+
provisioningUrl: string;
|
|
38
|
+
} | {
|
|
39
|
+
body: unknown;
|
|
40
|
+
exchangeUrl: string;
|
|
41
|
+
}, refusals?: typeof HANDOFF_REFUSALS): Promise<{
|
|
42
|
+
userAuth: NonNullable<LaunchOpts["userAuth"]>;
|
|
43
|
+
cleanup: () => Promise<void>;
|
|
44
|
+
material: RemoteAgentMaterial;
|
|
45
|
+
}>;
|
|
46
|
+
/** Foreground USER-MODE onboarding — the CLI-side twin of the manager's user spawn provisioning:
|
|
47
|
+
* owner = the logged-in operator (offline, from the login cache + local user-auth material);
|
|
48
|
+
* principal-keyed durables on an ephemeral provisioner (LIVE-ONLY, like static foreground);
|
|
49
|
+
* fresh ledger grant that refuses an occupied actor; 0600 secret/sentinel files; and a
|
|
50
|
+
* one-shot bearer preflight whose operator-exact sentence is the refusal. Exits on any failure —
|
|
51
|
+
* the agent process is never launched into a broken auth chain. */
|
|
52
|
+
export declare function provisionUserForeground(target: MeshTarget, name: string, ref: string, opts: {
|
|
53
|
+
eventPayloads?: boolean;
|
|
54
|
+
subscribe?: string[];
|
|
55
|
+
allowSubscribe: string[];
|
|
56
|
+
allowPublish?: string[];
|
|
57
|
+
role?: string;
|
|
58
|
+
capabilities?: string[];
|
|
59
|
+
lifecycleUid: string;
|
|
60
|
+
liveOnly?: boolean;
|
|
61
|
+
eventChannel?: (p: {
|
|
62
|
+
owner: string;
|
|
63
|
+
actor: string;
|
|
64
|
+
}) => string;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
userAuth: NonNullable<LaunchOpts["userAuth"]>;
|
|
67
|
+
cleanup: () => Promise<void>;
|
|
68
|
+
eventChannel?: string;
|
|
69
|
+
}>;
|
|
70
|
+
/** Run the one-shot bearer proof with an explicit credential-scrubbed environment. The enrollment
|
|
71
|
+
* path removes the variables from the parent before any child, and this boundary independently
|
|
72
|
+
* refuses to inherit them if another caller reaches it with ambient enrollment input. */
|
|
73
|
+
export declare function runBearerPreflight(bearerCmd: string[], env?: NodeJS.ProcessEnv): Promise<void>;
|
|
74
|
+
//# sourceMappingURL=spawn-foreground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-foreground.d.ts","sourceRoot":"","sources":["../../src/commands/spawn-foreground.ts"],"names":[],"mappings":"AACA,OAAO,EAaL,KAAK,UAAU,EACf,KAAK,SAAS,EAKf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAYL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAsB,gBAAgB,EAAE,KAAK,mBAAmB,EAAoE,MAAM,uBAAuB,CAAC;AAGzK;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GAC1D,OA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C,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAA;CAAE,GAC3P,OAAO,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAqIjH;AAED;;yFAEyF;AACzF,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjH"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { rmSync } from "node:fs";
|
|
2
|
+
import { AgentGrantConflictError, deprovisionAgent, firstFreeName, mintCreds, newIdentity, principalKey, provisionAgentDurables, resolveAuthProvider, runAgentBearer, acquireLock, inspectLock, localConsumerClaimPath, attemptCleanup, describeCleanupFailures, rejectionText, } from "@cotal-ai/core";
|
|
3
|
+
import { CommandFailure, agentActorTokenKey, agentSecretFilePaths, agentSentinelCredsKey, authDir, getSpaceAuth, materializeSecretToFile, provenance, spaceAccountPath, userAuthStateDir, workspaceSecretStore, } from "@cotal-ai/workspace";
|
|
4
|
+
import { c, stderrLine } from "../ui.js";
|
|
5
|
+
import { liveMeshNames } from "../lib/live-names.js";
|
|
6
|
+
import { withProvisioner } from "../lib/provisioner.js";
|
|
7
|
+
import { entryScript } from "../seed/paths.js";
|
|
8
|
+
import { AgentAlreadyRunning, heldAnswer, settleHeldName } from "../lib/held-name.js";
|
|
9
|
+
import { scrubEnrollmentEnv, HANDOFF_REFUSALS, checkRemoteAgentMaterial, shredAgentMaterial, noExchangeEndpoint } from "./spawn-enrollment.js";
|
|
10
|
+
import { meshRelease } from "./spawn-managed-launch.js";
|
|
11
|
+
/**
|
|
12
|
+
* Auto-number `requested` past any peer already present on the mesh (foo → foo_2 → foo_3) — the same
|
|
13
|
+
* series the manager's spawn funnel uses (firstFreeName). Foreground `cotal spawn` doesn't go through
|
|
14
|
+
* the manager, so it has no name reservation: this is a best-effort, advisory check. It connects a
|
|
15
|
+
* transient presence-watching endpoint, lets the roster settle, and snapshots the live names; two
|
|
16
|
+
* simultaneous `cotal spawn`s can still race onto the same number. If the mesh is unreachable the
|
|
17
|
+
* agent couldn't join it anyway, so dedup is skipped and the requested name stands.
|
|
18
|
+
*/
|
|
19
|
+
export async function uniqueMeshName(requested, target) {
|
|
20
|
+
const taken = await liveMeshNames(target);
|
|
21
|
+
return taken ? firstFreeName(requested, (n) => taken.has(n)) : requested;
|
|
22
|
+
}
|
|
23
|
+
/** Only an occupied actor is retryable; authorization and provisioning failures stay failures.
|
|
24
|
+
* Thrown only where the collision is found before anything is launched, issued or redeemed, so
|
|
25
|
+
* it is a refusal. */
|
|
26
|
+
class ForegroundActorCollision extends CommandFailure {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super("refused", "CONFLICT", message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export async function provisionFreshForeground(requested, autoName, userMode, provision) {
|
|
32
|
+
const occupied = new Set();
|
|
33
|
+
for (;;) {
|
|
34
|
+
let name;
|
|
35
|
+
try {
|
|
36
|
+
// The cap belongs to user mode alone, where the numbered name is the actor. Static and open
|
|
37
|
+
// mode key the actor on the minted nkey, so a numbered name there has no length to fit.
|
|
38
|
+
name = firstFreeName(requested, (candidate) => occupied.has(candidate), userMode ? { actorBound: true } : undefined);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
// The series stops at the actor bound, so a base whose every fitting candidate is taken is a
|
|
42
|
+
// refusal, not a crash: nothing has been launched, issued or redeemed yet.
|
|
43
|
+
throw new CommandFailure("refused", "CONFLICT", e instanceof Error ? e.message : String(e));
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
return { name, provisioned: await provision(name) };
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
if (!autoName || !(e instanceof ForegroundActorCollision || e instanceof AgentGrantConflictError || e instanceof AgentAlreadyRunning))
|
|
50
|
+
throw e;
|
|
51
|
+
occupied.add(name);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Foreground REMOTE-USER onboarding — the participant path for a mesh registered with
|
|
56
|
+
* `meshes add --from` that advertises an agent-provisioning endpoint (U6 §2).
|
|
57
|
+
*
|
|
58
|
+
* The local twin below ({@link provisionUserForeground}) cannot run here and must not try: it
|
|
59
|
+
* needs the space's owner secret and account signer to grant a row and pre-create durables, and
|
|
60
|
+
* those never leave the machine the mesh runs on. Instead the mesh's own endpoint does that work
|
|
61
|
+
* inside the owner's delegation envelope and hands back ready material; this function's job is to
|
|
62
|
+
* present the login bearer, validate what comes back, land it 0600, and prove the bearer chain
|
|
63
|
+
* before launch — the same preflight discipline, with the grant performed remotely.
|
|
64
|
+
*
|
|
65
|
+
* Deliberately NOT reusing the local path's cleanup: nothing here created broker state locally, so
|
|
66
|
+
* teardown is the mesh's business (its lifecycle owns the row and the durables). The spawned
|
|
67
|
+
* agent's material is shredded on exit; the row is not revoked from here, because this machine
|
|
68
|
+
* holds no authority to revoke it. For a managed handoff, `refusals` replaces the sentences of the
|
|
69
|
+
* local-state, material and bearer steps, which quote the space, the actor or the exchange URL. */
|
|
70
|
+
export async function provisionRemoteUserForeground(target, name, source, refusals) {
|
|
71
|
+
const { space } = target;
|
|
72
|
+
const store = workspaceSecretStore(target.root);
|
|
73
|
+
const composition = { injected: false, root: target.root };
|
|
74
|
+
const fail = (msg) => {
|
|
75
|
+
stderrLine("✗ ", `${msg}`, c.red);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
};
|
|
78
|
+
// Resolved first, as by every consumer of the space's local state: each resolution migrates a
|
|
79
|
+
// pre-hex or root-scoped layout, or refuses an ambiguous one, before any request or material.
|
|
80
|
+
let paths;
|
|
81
|
+
try {
|
|
82
|
+
userAuthStateDir(target.root, space);
|
|
83
|
+
paths = agentSecretFilePaths(target.root, space, name);
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
return fail(refusals?.registration ?? e.message);
|
|
87
|
+
}
|
|
88
|
+
let provider;
|
|
89
|
+
try {
|
|
90
|
+
provider = resolveAuthProvider();
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
return fail(e.message);
|
|
94
|
+
}
|
|
95
|
+
// Checked before the grant is requested, because `fail` exits without running the shred in the
|
|
96
|
+
// catch below and would leave the granted material on disk.
|
|
97
|
+
const exchangeUrl = "body" in source ? source.exchangeUrl : target.userAuth?.endpoints?.url;
|
|
98
|
+
if (!exchangeUrl)
|
|
99
|
+
return fail(noExchangeEndpoint(space));
|
|
100
|
+
let body;
|
|
101
|
+
const held = `foreground actor material for "${name}" is already held; preserve its session and choose a distinct actor for a new launch`;
|
|
102
|
+
const materialClaim = acquireLock(`${paths.actorToken}.launch.lock`, {
|
|
103
|
+
waitMs: 0,
|
|
104
|
+
// A supplied body comes from an enrollment that was already redeemed, so its collision is not
|
|
105
|
+
// a refusal: the one-time enrollment is spent.
|
|
106
|
+
onTimeout: () => "body" in source ? new Error(held) : new ForegroundActorCollision(held),
|
|
107
|
+
});
|
|
108
|
+
if ("body" in source) {
|
|
109
|
+
body = source.body;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const idpUrl = target.userAuth?.idp.url;
|
|
113
|
+
if (!idpUrl)
|
|
114
|
+
return fail(`mesh "${space}" records no IdP to sign in against - re-register it with \`cotal meshes add ${space} --from <url> --mode user\``);
|
|
115
|
+
// The login proof rides the provisioning request, so the POST is the PROVIDER's (this package
|
|
116
|
+
// never touches the session cache); its thrown sentences are already operator-exact — the
|
|
117
|
+
// no-login gate names the `cotal login --idp …` line, a refusal carries the mesh's own reason.
|
|
118
|
+
if (!provider.postAgentProvisioning)
|
|
119
|
+
return fail(`the registered auth provider "${provider.name}" cannot provision agents on a remote mesh - run the agent where the mesh runs`);
|
|
120
|
+
// A name held by a lifecycle that is not running is released and asked for again.
|
|
121
|
+
try {
|
|
122
|
+
body = await settleHeldName({ space }, () => provider.postAgentProvisioning({ url: source.provisioningUrl, idpUrl, actor: name }), (o) => "error" in o
|
|
123
|
+
? heldAnswer({ code: o.error?.code, details: o.error?.details, message: rejectionText(o.error) }, name) : undefined, meshRelease(target));
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
materialClaim.release();
|
|
127
|
+
// No sign-in refuses before any request. Any failure after the request, an endpoint refusal
|
|
128
|
+
// included, may have provisioned the actor.
|
|
129
|
+
if (e.code === "signed-out")
|
|
130
|
+
throw new CommandFailure("refused", "AUTH_REQUIRED", e.message);
|
|
131
|
+
throw e;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const checked = checkRemoteAgentMaterial(body, name);
|
|
135
|
+
if (!checked.ok) {
|
|
136
|
+
materialClaim.release();
|
|
137
|
+
if (checked.exists && "provisioningUrl" in source)
|
|
138
|
+
throw new ForegroundActorCollision(checked.message);
|
|
139
|
+
return fail(refusals?.bundle ?? checked.message);
|
|
140
|
+
}
|
|
141
|
+
const material = checked.material;
|
|
142
|
+
const { actorToken: tokenPath, sentinelCreds: sentinelPath, health: healthPath } = paths;
|
|
143
|
+
if (inspectLock(localConsumerClaimPath(target.server, space, material.owner, name, material.lifecycleUid)).state === "active") {
|
|
144
|
+
materialClaim.release();
|
|
145
|
+
return fail(`local inbox already has a consuming session for ${material.owner}.${name}; no local material was replaced`);
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
// Land both secrets 0600 through the store, exactly as the local path does — the bearer
|
|
149
|
+
// re-exec and the launch handoff read FILES.
|
|
150
|
+
await store.put(agentActorTokenKey(space, name, composition), material.actorToken);
|
|
151
|
+
await store.put(agentSentinelCredsKey(space, name, composition), material.sentinelCreds);
|
|
152
|
+
await materializeSecretToFile(store, agentActorTokenKey(space, name, composition), tokenPath);
|
|
153
|
+
await materializeSecretToFile(store, agentSentinelCredsKey(space, name, composition), sentinelPath);
|
|
154
|
+
rmSync(healthPath, { force: true });
|
|
155
|
+
provenance.wrote(`remote actor material ${material.owner}.${name} (user mode)`, tokenPath);
|
|
156
|
+
// The bearer preflight — the same one-shot proof the local path runs, pointed at the pinned
|
|
157
|
+
// exchange instead of a local service. A dead auth chain stops the spawn here. The agent runs
|
|
158
|
+
// this command for every renewal, so it names the resolved entry: an install can replace the
|
|
159
|
+
// bin link meanwhile (get.cotal.ai writes a shell launcher over `~/.local/bin/cotal`).
|
|
160
|
+
const bearerCmd = [
|
|
161
|
+
process.execPath,
|
|
162
|
+
...process.execArgv,
|
|
163
|
+
entryScript(),
|
|
164
|
+
provider.agentBearerCommand,
|
|
165
|
+
"--exchange-url", exchangeUrl,
|
|
166
|
+
"--space", space,
|
|
167
|
+
"--owner", material.owner,
|
|
168
|
+
"--actor", name,
|
|
169
|
+
"--token-file", tokenPath,
|
|
170
|
+
"--health-file", healthPath,
|
|
171
|
+
];
|
|
172
|
+
await runBearerPreflight(bearerCmd);
|
|
173
|
+
return {
|
|
174
|
+
userAuth: { owner: material.owner, actor: name, sentinelCredsPath: sentinelPath, bearerCmd },
|
|
175
|
+
material,
|
|
176
|
+
// Local shred only. The remote row and its durables belong to the mesh's lifecycle; this
|
|
177
|
+
// machine has no authority to retire them and must not pretend otherwise.
|
|
178
|
+
cleanup: async () => {
|
|
179
|
+
const failed = [];
|
|
180
|
+
if (await store.get(agentActorTokenKey(space, name, composition)) === material.actorToken)
|
|
181
|
+
await shredAgentMaterial(failed, store, space, name, composition, paths);
|
|
182
|
+
materialClaim.release();
|
|
183
|
+
if (failed.length)
|
|
184
|
+
throw new Error(describeCleanupFailures(failed));
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
// What the shred left behind joins the refusal after its cause. A handoff refusal keeps its
|
|
190
|
+
// fixed sentence and names only the failed steps, because their errors quote paths named for
|
|
191
|
+
// the handoff's actor.
|
|
192
|
+
const failed = [];
|
|
193
|
+
if (await store.get(agentActorTokenKey(space, name, composition)) === material.actorToken)
|
|
194
|
+
await shredAgentMaterial(failed, store, space, name, composition, paths);
|
|
195
|
+
materialClaim.release();
|
|
196
|
+
const steps = refusals ? failed.map((f) => f.step).join("; ") : describeCleanupFailures(failed);
|
|
197
|
+
const leftover = failed.length ? `; cleanup failed: ${steps}` : "";
|
|
198
|
+
return fail(`${refusals?.bearer ?? `agent auth preflight failed for "${name}": ${rejectionText(e)}`}${leftover}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** Foreground USER-MODE onboarding — the CLI-side twin of the manager's user spawn provisioning:
|
|
202
|
+
* owner = the logged-in operator (offline, from the login cache + local user-auth material);
|
|
203
|
+
* principal-keyed durables on an ephemeral provisioner (LIVE-ONLY, like static foreground);
|
|
204
|
+
* fresh ledger grant that refuses an occupied actor; 0600 secret/sentinel files; and a
|
|
205
|
+
* one-shot bearer preflight whose operator-exact sentence is the refusal. Exits on any failure —
|
|
206
|
+
* the agent process is never launched into a broken auth chain. */
|
|
207
|
+
export async function provisionUserForeground(target, name, ref, opts) {
|
|
208
|
+
const { space, server } = target;
|
|
209
|
+
const dir = userAuthStateDir(target.root, space);
|
|
210
|
+
const store = workspaceSecretStore(target.root);
|
|
211
|
+
const composition = { injected: false, root: target.root };
|
|
212
|
+
const fail = (msg) => {
|
|
213
|
+
stderrLine("✗ ", `${msg}`, c.red);
|
|
214
|
+
process.exit(1);
|
|
215
|
+
};
|
|
216
|
+
let provider;
|
|
217
|
+
let owner;
|
|
218
|
+
try {
|
|
219
|
+
provider = resolveAuthProvider();
|
|
220
|
+
owner = await provider.ownerForLogin({ store, dir, space });
|
|
221
|
+
}
|
|
222
|
+
catch (e) {
|
|
223
|
+
return fail(e.message);
|
|
224
|
+
}
|
|
225
|
+
// The provisioner cred is INFRA (pre-flip static coexistence, like the manager's own creds) —
|
|
226
|
+
// loaded explicitly here for durable pre-creation only, never for the agent's identity.
|
|
227
|
+
// The event grant, derived HERE because this is the first point at which the owner exists: in
|
|
228
|
+
// user mode the principal is (resolved owner, actor name), and neither half is known to the
|
|
229
|
+
// caller before `ownerForLogin` answers.
|
|
230
|
+
const eventGrant = opts.eventChannel?.({ owner, actor: name });
|
|
231
|
+
const publish = eventGrant ? [...(opts.allowPublish ?? []), eventGrant] : (opts.allowPublish ?? []);
|
|
232
|
+
const infra = await getSpaceAuth(store, space); // cross-check the bundle names the space we resolved this root for
|
|
233
|
+
if (!infra)
|
|
234
|
+
return fail(`space "${space}" has user-auth state but no trust record under ${authDir(target.root)} (expected ${spaceAccountPath(authDir(target.root), space)} or the legacy auth.json) - re-run \`cotal up --user-auth\` here`);
|
|
235
|
+
const paths = agentSecretFilePaths(target.root, space, name);
|
|
236
|
+
const { actorToken: tokenPath, sentinelCreds: sentinelPath, health: healthPath } = paths;
|
|
237
|
+
const materialClaim = acquireLock(`${tokenPath}.launch.lock`, {
|
|
238
|
+
waitMs: 0,
|
|
239
|
+
onTimeout: () => new ForegroundActorCollision(`foreground actor material for "${name}" is already held; preserve its session and choose a distinct actor for a new launch`),
|
|
240
|
+
});
|
|
241
|
+
// An existing row is not this new launch's property. In particular, a dead launcher may
|
|
242
|
+
// leave its consuming child alive. Never overwrite the row to discover occupancy later.
|
|
243
|
+
if (await provider.actorScope({ dir, owner, actor: name }) !== undefined) {
|
|
244
|
+
materialClaim.release();
|
|
245
|
+
throw new ForegroundActorCollision(`actor "${name}" already has a grant; preserve its session and choose a distinct actor for a new launch`);
|
|
246
|
+
}
|
|
247
|
+
let ownedToken;
|
|
248
|
+
// Revoke the row, shred the secret material, and retire the broker footprint the durable
|
|
249
|
+
// provisioning below creates (DM/DLV durables + ACL row). Every step is attempted, so a failed
|
|
250
|
+
// removal cannot strand the durables on the broker, and the failures go back to the caller.
|
|
251
|
+
const teardown = async () => {
|
|
252
|
+
const failed = [];
|
|
253
|
+
if (ownedToken === undefined)
|
|
254
|
+
return failed;
|
|
255
|
+
let revoked = false;
|
|
256
|
+
await attemptCleanup(failed, "revoke agent grant", async () => {
|
|
257
|
+
revoked = await provider.revokeAgent({ dir, owner, actor: name, lifecycleUid: opts.lifecycleUid, actorToken: ownedToken });
|
|
258
|
+
});
|
|
259
|
+
if (await store.get(agentActorTokenKey(space, name, composition)) === ownedToken)
|
|
260
|
+
await shredAgentMaterial(failed, store, space, name, composition, paths);
|
|
261
|
+
if (!revoked)
|
|
262
|
+
return failed;
|
|
263
|
+
const targetId = principalKey(owner, name).key;
|
|
264
|
+
await attemptCleanup(failed, "deprovision", () => mintCreds(infra, newIdentity(), "deprovisioner", { deprovisionTarget: { principal: targetId, lifecycleUid: opts.lifecycleUid } })
|
|
265
|
+
.then((creds) => deprovisionAgent({ servers: server, space, targetId, lifecycleUid: opts.lifecycleUid, creds })));
|
|
266
|
+
return failed;
|
|
267
|
+
};
|
|
268
|
+
try {
|
|
269
|
+
// The GRANT first — it is the envelope-rule enforcement point (a delegation must sit within
|
|
270
|
+
// the spawner's own grant), so a refused delegation exits here with zero broker footprint —
|
|
271
|
+
// the same ordering as Manager.provisionUserAgent, for the same reason.
|
|
272
|
+
const grant = await provider.grantAgent({
|
|
273
|
+
store,
|
|
274
|
+
dir,
|
|
275
|
+
space,
|
|
276
|
+
owner,
|
|
277
|
+
actor: name,
|
|
278
|
+
scope: (opts.capabilities ?? []).filter((s) => s === "spawn" || s === "run" || s === "admin" || /^role:[A-Za-z0-9_-]+$/.test(s)),
|
|
279
|
+
allowSubscribe: opts.allowSubscribe,
|
|
280
|
+
allowPublish: publish,
|
|
281
|
+
...(opts.eventPayloads === false ? { eventPayloads: false } : {}),
|
|
282
|
+
role: opts.role,
|
|
283
|
+
parent: `${owner}.cli`,
|
|
284
|
+
label: ref,
|
|
285
|
+
lifecycleUid: opts.lifecycleUid,
|
|
286
|
+
fresh: true,
|
|
287
|
+
// A foreground launch has no manager; its row says so.
|
|
288
|
+
custody: { kind: "foreground" },
|
|
289
|
+
});
|
|
290
|
+
ownedToken = grant.actorToken;
|
|
291
|
+
await withProvisioner({ space, servers: server, auth: infra }, "spawn-provisioner", (prov) =>
|
|
292
|
+
// Full durable footprint, same as the static foreground path: the ACL row is what lets the
|
|
293
|
+
// delivery daemon authorize this agent's durable joins. `--live-only` opts out.
|
|
294
|
+
provisionAgentDurables(prov, { owner, actor: name, lifecycleUid: opts.lifecycleUid }, {
|
|
295
|
+
subscribe: opts.subscribe,
|
|
296
|
+
allowSubscribe: opts.allowSubscribe,
|
|
297
|
+
role: opts.role,
|
|
298
|
+
...(opts.liveOnly ? { durableMembership: false } : {}),
|
|
299
|
+
}));
|
|
300
|
+
// The store holds the source of truth; the bearer re-exec (`--token-file`) and the launch's
|
|
301
|
+
// sentinel handoff read FILES — materialize both at the canonical paths (byte-identical
|
|
302
|
+
// rewrites under this, the local FS, composition).
|
|
303
|
+
await store.put(agentActorTokenKey(space, name, composition), grant.actorToken);
|
|
304
|
+
await store.put(agentSentinelCredsKey(space, name, composition), grant.sentinelCreds);
|
|
305
|
+
await materializeSecretToFile(store, agentActorTokenKey(space, name, composition), tokenPath);
|
|
306
|
+
await materializeSecretToFile(store, agentSentinelCredsKey(space, name, composition), sentinelPath);
|
|
307
|
+
rmSync(healthPath, { force: true });
|
|
308
|
+
provenance.wrote(`actor grant ${owner}.${name} (user mode)`, tokenPath);
|
|
309
|
+
// The resolved entry, for the same reason as the remote arm above.
|
|
310
|
+
const bearerCmd = [
|
|
311
|
+
process.execPath,
|
|
312
|
+
...process.execArgv,
|
|
313
|
+
entryScript(),
|
|
314
|
+
provider.agentBearerCommand,
|
|
315
|
+
"--dir", dir,
|
|
316
|
+
"--space", space,
|
|
317
|
+
"--owner", owner,
|
|
318
|
+
"--actor", name,
|
|
319
|
+
"--token-file", tokenPath,
|
|
320
|
+
"--health-file", healthPath,
|
|
321
|
+
];
|
|
322
|
+
await runBearerPreflight(bearerCmd);
|
|
323
|
+
return {
|
|
324
|
+
userAuth: { owner, actor: name, sentinelCredsPath: sentinelPath, bearerCmd },
|
|
325
|
+
...(eventGrant ? { eventChannel: eventGrant } : {}),
|
|
326
|
+
// The foreground departure's half of the runtime-grant invariant: the caller runs this when
|
|
327
|
+
// the agent process exits, the same teardown the rollback below runs on a failed preflight.
|
|
328
|
+
cleanup: async () => {
|
|
329
|
+
const failed = await teardown();
|
|
330
|
+
if (failed.length)
|
|
331
|
+
throw new Error(describeCleanupFailures(failed));
|
|
332
|
+
materialClaim.release();
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
catch (e) {
|
|
337
|
+
// Roll back EVERYTHING this attempt materialized: a refused spawn leaves no row, no secret, no
|
|
338
|
+
// orphaned durables. What the teardown could not remove joins the refusal after its cause.
|
|
339
|
+
const failed = await teardown();
|
|
340
|
+
materialClaim.release();
|
|
341
|
+
if (e instanceof AgentGrantConflictError && ownedToken === undefined && failed.length === 0)
|
|
342
|
+
throw e;
|
|
343
|
+
const leftover = failed.length ? `; cleanup failed: ${describeCleanupFailures(failed)}` : "";
|
|
344
|
+
return fail(`agent auth preflight failed for "${name}": ${rejectionText(e)}${leftover}`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/** Run the one-shot bearer proof with an explicit credential-scrubbed environment. The enrollment
|
|
348
|
+
* path removes the variables from the parent before any child, and this boundary independently
|
|
349
|
+
* refuses to inherit them if another caller reaches it with ambient enrollment input. */
|
|
350
|
+
export async function runBearerPreflight(bearerCmd, env = process.env) {
|
|
351
|
+
const childEnv = { ...env };
|
|
352
|
+
scrubEnrollmentEnv(childEnv);
|
|
353
|
+
await runAgentBearer(bearerCmd, { env: childEnv });
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=spawn-foreground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-foreground.js","sourceRoot":"","sources":["../../src/commands/spawn-foreground.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA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C,QAAQ,CAAC,CAAC;IAC7B,MAAM,cAAc,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type FlagValues, type AgentLifecycleRelease } from "@cotal-ai/core";
|
|
2
|
+
import { type OutputWarning, type Report, type MeshTarget } from "@cotal-ai/workspace";
|
|
3
|
+
import { type ManagedLaunchResult } from "@cotal-ai/workspace/launch";
|
|
4
|
+
import { AgentAlreadyRunning } from "../lib/held-name.js";
|
|
5
|
+
import { spawnFlags } from "./spawn-flags.js";
|
|
6
|
+
/** Whether the installed manifest lists a connector named `name`. An unreadable manifest answers
|
|
7
|
+
* true, so the import's own refusal reports it. */
|
|
8
|
+
export declare function connectorListed(name: string): boolean;
|
|
9
|
+
/** #867: the name a spawn sends must already be a mintable identity, and the check must not wait
|
|
10
|
+
* for the manager's round trip. `spawnNameError` is the SAME predicate the manager applies at its
|
|
11
|
+
* door (manager.ts `start`), so the operator sees core's own refusal — offending character,
|
|
12
|
+
* reservation reason, and the `_` remedy — before any request leaves. A courtesy only: the
|
|
13
|
+
* manager door stays the enforcement point; this is why the CLI passes the target mesh's auth
|
|
14
|
+
* mode rather than restating the grammar (static mode keys the actor on the nkey, not the name). */
|
|
15
|
+
export declare function refuseUnmintableName(name: string, userMode: boolean): void;
|
|
16
|
+
/** Whether a managed launch can reach only this root's own manager: the instance it names, or else
|
|
17
|
+
* the only one the registry lists, is the one recorded under the target's root. An unread registry
|
|
18
|
+
* or an unreadable record proves nothing, and the launch then goes to whichever manager serves it. */
|
|
19
|
+
export declare function launchServedHere(t: {
|
|
20
|
+
space: string;
|
|
21
|
+
root?: string;
|
|
22
|
+
}, serving: string | undefined, live: readonly string[] | undefined): boolean;
|
|
23
|
+
export interface ManagedLaunchObserver {
|
|
24
|
+
/** A native joined receipt, not task completion. A composite command owns its one envelope. */
|
|
25
|
+
ready(result: ManagedLaunchResult, warnings: readonly OutputWarning[]): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function managedLaunchView(r: ManagedLaunchResult): Report;
|
|
28
|
+
/** Shared managed launch. The manager resolves its persona and returns real readiness before
|
|
29
|
+
* any view opens. Detach changes terminal attachment, not the launch or caller authority. */
|
|
30
|
+
export declare function launchManagedPersona(values: FlagValues<typeof spawnFlags>, positionals: string[], events: boolean | undefined, launchOptions: Record<string, string> | undefined, observer?: ManagedLaunchObserver): Promise<void>;
|
|
31
|
+
/** The mesh's release of one agent lifecycle, when `mesh` is a remote user-auth mesh that advertises
|
|
32
|
+
* an agent-provisioning endpoint and the auth provider can call it there. */
|
|
33
|
+
export declare function meshRelease(mesh: MeshTarget | undefined): ((lifecycleUid: string, agent: string) => Promise<AgentLifecycleRelease>) | undefined;
|
|
34
|
+
/** The agent a spawn asked for already runs, so nothing new is launched: say where it runs, then
|
|
35
|
+
* attach to it in this terminal unless the spawn was detached or cannot attach, or print the
|
|
36
|
+
* command that does. */
|
|
37
|
+
export declare function reportAlreadyRunning(running: AgentAlreadyRunning, values: {
|
|
38
|
+
detach?: boolean;
|
|
39
|
+
creds?: string;
|
|
40
|
+
json?: boolean;
|
|
41
|
+
plain?: boolean;
|
|
42
|
+
}, space: string, server: string | undefined): Promise<void>;
|
|
43
|
+
//# sourceMappingURL=spawn-managed-launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-managed-launch.d.ts","sourceRoot":"","sources":["../../src/commands/spawn-managed-launch.ts"],"names":[],"mappings":"AAGA,OAAO,EAYL,KAAK,UAAU,EACf,KAAK,qBAAqB,EAE3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAUL,KAAK,aAAa,EAElB,KAAK,MAAM,EAgBX,KAAK,UAAU,EAIhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA2C,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAS/G,OAAO,EAAE,mBAAmB,EAA8B,MAAM,qBAAqB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