@cotal-ai/cli 0.92.2 → 0.94.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/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/dist/lib/manifest/apply.d.ts +0 -4
- package/dist/lib/manifest/apply.d.ts.map +1 -1
- package/dist/lib/manifest/apply.js +0 -9
- package/dist/lib/manifest/apply.js.map +1 -1
- package/dist/lib/manifest/live.d.ts +7 -18
- package/dist/lib/manifest/live.d.ts.map +1 -1
- package/dist/lib/manifest/live.js +8 -52
- package/dist/lib/manifest/live.js.map +1 -1
- package/dist/lib/manifest/render.d.ts +0 -30
- package/dist/lib/manifest/render.d.ts.map +1 -1
- package/dist/lib/manifest/render.js +0 -92
- package/dist/lib/manifest/render.js.map +1 -1
- package/package.json +4 -4
- package/dist/commands/spawn-manifest.d.ts +0 -10
- package/dist/commands/spawn-manifest.d.ts.map +0 -1
- package/dist/commands/spawn-manifest.js +0 -346
- package/dist/commands/spawn-manifest.js.map +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type ParsedArgs } from "@cotal-ai/core";
|
|
1
|
+
import { type ConversationGrant, type ConversationPending, type ParsedArgs } from "@cotal-ai/core";
|
|
2
2
|
/**
|
|
3
|
-
* `cotal app-identity`: machine-facing plumbing for a Claude app conversation
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* and a later provision retires what a process that died without retiring left behind.
|
|
3
|
+
* `cotal app-identity`: machine-facing plumbing for a Claude app conversation. The Claude
|
|
4
|
+
* connector's local server runs it to open one conversation's own identity on the selected mesh,
|
|
5
|
+
* and again to retire it. It prints one JSON line on stdout and nothing else there. The credential is
|
|
6
|
+
* never in that line: it goes to a 0600 file whose path the env names. A new identity opens only
|
|
7
|
+
* after a person approves it at the mesh's authority, so a mesh without one opens none.
|
|
9
8
|
*/
|
|
10
9
|
export declare const appIdentityFlags: readonly [{
|
|
11
10
|
readonly name: "name";
|
|
@@ -22,17 +21,38 @@ export declare const appIdentityFlags: readonly [{
|
|
|
22
21
|
readonly type: "string";
|
|
23
22
|
readonly value: "<dir>";
|
|
24
23
|
readonly description: "retire: the credential directory provision returned";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "session";
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly value: "<id>";
|
|
28
|
+
readonly description: "provision: the native conversation identity";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "events";
|
|
31
|
+
readonly type: "boolean";
|
|
32
|
+
readonly description: "provision: a real native transcript source is bound";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "selection";
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly value: "<json>";
|
|
37
|
+
readonly description: "provision: channels, role and capabilities to request within your own grant";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "require-approval";
|
|
40
|
+
readonly type: "boolean";
|
|
41
|
+
readonly description: "provision: the caller accepts only an identity a person approved";
|
|
25
42
|
}];
|
|
43
|
+
/** `pending` names the request a person has not decided yet and the page where they decide it. It
|
|
44
|
+
* carries no credential, secret or path. Provisioning again replays that same request. */
|
|
26
45
|
export type AppIdentityReply = {
|
|
27
46
|
ok: true;
|
|
28
47
|
env: Record<string, string>;
|
|
29
48
|
retire?: {
|
|
30
49
|
dir: string;
|
|
31
50
|
};
|
|
32
|
-
|
|
51
|
+
grant?: ConversationGrant;
|
|
52
|
+
} | ({
|
|
33
53
|
ok: false;
|
|
34
|
-
|
|
35
|
-
} | {
|
|
54
|
+
pending: true;
|
|
55
|
+
} & ConversationPending) | {
|
|
36
56
|
ok: false;
|
|
37
57
|
error: string;
|
|
38
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-identity.d.ts","sourceRoot":"","sources":["../../src/commands/app-identity.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"app-identity.d.ts","sourceRoot":"","sources":["../../src/commands/app-identity.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAGxB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAUxB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUW,CAAC;AAUzC;2FAC2F;AAC3F,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAC9F,CAAC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG,mBAAmB,CAAC,GACpD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAWjC,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAWjE"}
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import { existsSync, lstatSync,
|
|
1
|
+
import { existsSync, lstatSync, readdirSync, readFileSync, rmdirSync, rmSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { checkConversationSelection, deprovisionAgent, isReachable, mintCreds, newIdentity, } from "@cotal-ai/core";
|
|
5
|
+
import { resolveTargetOrThrow } from "@cotal-ai/workspace";
|
|
6
|
+
import { isUserAppDir, provisionUserApp, retireDeadUserApps, retireUserApp } from "../lib/app-user-identity.js";
|
|
7
|
+
/** Every credential directory an earlier static-mesh provision made was a fresh `mkdtemp` under the
|
|
8
|
+
* OS temp dir with this prefix. Provision makes none now; retire still removes them. */
|
|
9
9
|
const CRED_DIR_PREFIX = "cotal-app-identity-";
|
|
10
10
|
/** The file in that directory that says what to retire. It carries no secret. */
|
|
11
11
|
const RECORD = "identity.json";
|
|
12
12
|
/**
|
|
13
|
-
* `cotal app-identity`: machine-facing plumbing for a Claude app conversation
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* and a later provision retires what a process that died without retiring left behind.
|
|
13
|
+
* `cotal app-identity`: machine-facing plumbing for a Claude app conversation. The Claude
|
|
14
|
+
* connector's local server runs it to open one conversation's own identity on the selected mesh,
|
|
15
|
+
* and again to retire it. It prints one JSON line on stdout and nothing else there. The credential is
|
|
16
|
+
* never in that line: it goes to a 0600 file whose path the env names. A new identity opens only
|
|
17
|
+
* after a person approves it at the mesh's authority, so a mesh without one opens none.
|
|
19
18
|
*/
|
|
20
19
|
export const appIdentityFlags = [
|
|
21
20
|
{ name: "name", type: "string", value: "<name>", description: "provision: the agent name to open, exactly" },
|
|
22
21
|
{ name: "space", type: "string", value: "<space>", description: "the mesh to use; defaults as `cotal spawn` does" },
|
|
23
22
|
{ name: "dir", type: "string", value: "<dir>", description: "retire: the credential directory provision returned" },
|
|
23
|
+
{ name: "session", type: "string", value: "<id>", description: "provision: the native conversation identity" },
|
|
24
|
+
{ name: "events", type: "boolean", description: "provision: a real native transcript source is bound" },
|
|
25
|
+
{ name: "selection", type: "string", value: "<json>", description: "provision: channels, role and capabilities to request within your own grant" },
|
|
26
|
+
// Every provision here needs a person's approval, with or without this flag. A caller passes it so
|
|
27
|
+
// that an earlier CLI, which opened identities without approval, refuses the unknown flag first.
|
|
28
|
+
{ name: "require-approval", type: "boolean", description: "provision: the caller accepts only an identity a person approved" },
|
|
24
29
|
];
|
|
25
30
|
function reply(r) {
|
|
26
31
|
process.stdout.write(`${JSON.stringify(r)}\n`);
|
|
@@ -37,7 +42,9 @@ export async function appIdentity(args) {
|
|
|
37
42
|
return reply(await provision(values));
|
|
38
43
|
if (verb === "retire" && args.positionals.length === 1)
|
|
39
44
|
return reply(await retire(values));
|
|
40
|
-
|
|
45
|
+
if (verb === "reap" && args.positionals.length === 1)
|
|
46
|
+
return reply(await reap(values));
|
|
47
|
+
reply({ ok: false, error: "usage: cotal app-identity provision --name <name> [--space <space>] | retire --dir <dir> | reap [--space <space>]" });
|
|
41
48
|
}
|
|
42
49
|
catch (e) {
|
|
43
50
|
reply({ ok: false, error: errorText(e) });
|
|
@@ -50,94 +57,36 @@ export async function appIdentity(args) {
|
|
|
50
57
|
function target(space) {
|
|
51
58
|
return resolveTargetOrThrow(space ? { space } : {});
|
|
52
59
|
}
|
|
53
|
-
/** What to run when the persona a bare spawn loads is missing. `up` in the root of a space this
|
|
54
|
-
* machine started writes the `default` one; another name comes from `COTAL_DEFAULT_PERSONA`. */
|
|
55
|
-
function missingPersonaNext(persona, t) {
|
|
56
|
-
if (persona !== "default")
|
|
57
|
-
return "Create it, or point COTAL_DEFAULT_PERSONA at a persona that exists.";
|
|
58
|
-
const fix = defaultPersonaFix(t);
|
|
59
|
-
return fix.cwd ? `Run \`${fix.command}\` in ${fix.cwd} to write it.` : `Create it with \`${fix.command}\`.`;
|
|
60
|
-
}
|
|
61
60
|
async function provision(values) {
|
|
62
61
|
const name = values.name?.trim();
|
|
63
62
|
if (!name)
|
|
64
63
|
return { ok: false, error: "provision needs --name <name>" };
|
|
64
|
+
const selection = values.selection === undefined ? undefined : checkConversationSelection(JSON.parse(values.selection));
|
|
65
65
|
const t = await target(values.space);
|
|
66
|
-
if (t.mode === "user")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (!taken)
|
|
70
|
-
return { ok: false, error: `the mesh "${t.space}" at ${t.server} is not answering. Start it with \`cotal up\`.` };
|
|
71
|
-
if (taken.has(name))
|
|
72
|
-
return { ok: false, taken: true };
|
|
73
|
-
// Channels and role come from the persona a bare `cotal spawn` loads. Its capabilities do not:
|
|
74
|
-
// the remote surface offers no seat authority, so the credential carries none.
|
|
75
|
-
const persona = defaultPersonaRef();
|
|
76
|
-
let def;
|
|
77
|
-
try {
|
|
78
|
-
def = loadAgentFile(agentFilePath(t.root, persona));
|
|
66
|
+
if (t.mode === "user") {
|
|
67
|
+
const connection = await provisionUserApp(t, name, values.session, values.events === true, selection);
|
|
68
|
+
return "pending" in connection ? { ok: false, pending: true, ...connection.pending } : { ok: true, ...connection };
|
|
79
69
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return { ok: false, error: `no "${persona}" persona in ${t.personaRoot} for the mesh "${t.space}". ${missingPersonaNext(persona, t)}` };
|
|
83
|
-
throw e;
|
|
84
|
-
}
|
|
85
|
-
// Derived as a foreground spawn derives them, and handed to the connector too, so the session's
|
|
86
|
-
// runtime read and post sets match what its credential allows.
|
|
87
|
-
const subscribe = def.subscribe ?? [];
|
|
88
|
-
const channels = { subscribe, allowSubscribe: resolveReadAcl(subscribe, def.allowSubscribe), allowPublish: def.allowPublish ?? [] };
|
|
89
|
-
const env = {
|
|
90
|
-
COTAL_SPACE: t.space,
|
|
91
|
-
COTAL_SERVERS: t.server,
|
|
92
|
-
COTAL_NAME: name,
|
|
93
|
-
COTAL_SUBSCRIBE: channels.subscribe.join(","),
|
|
94
|
-
COTAL_ALLOW_SUBSCRIBE: channels.allowSubscribe.join(","),
|
|
95
|
-
COTAL_ALLOW_PUBLISH: channels.allowPublish.join(","),
|
|
96
|
-
...(def.role ? { COTAL_ROLE: def.role } : {}),
|
|
97
|
-
};
|
|
98
|
-
if (!t.auth)
|
|
99
|
-
return { ok: true, env };
|
|
70
|
+
// A static or open mesh has no authority where a person approves a connection, so it opens none.
|
|
71
|
+
// What a host that died without retiring left behind is still retired here.
|
|
100
72
|
await retireOrphans();
|
|
101
|
-
|
|
102
|
-
const lifecycleUid = mintLifecycleUid();
|
|
103
|
-
const prov = new CotalEndpoint({
|
|
104
|
-
space: t.space,
|
|
105
|
-
servers: t.server,
|
|
106
|
-
creds: await mintCreds(t.auth, newIdentity(), "provisioner"),
|
|
107
|
-
channels: [],
|
|
108
|
-
consume: false,
|
|
109
|
-
registerPresence: false,
|
|
110
|
-
watchPresence: false,
|
|
111
|
-
watchChannels: false,
|
|
112
|
-
card: { name: "app-provisioner", role: "provisioner", kind: "endpoint" },
|
|
113
|
-
});
|
|
114
|
-
// The awaited calls below own the verdict; the provisioner's own events would only reach stdout.
|
|
115
|
-
prov.on("error", () => { });
|
|
116
|
-
const ignoreProvisionerWarning = () => { };
|
|
117
|
-
prov.on("warning", ignoreProvisionerWarning);
|
|
118
|
-
const dir = mkdtempSync(join(tmpdir(), CRED_DIR_PREFIX));
|
|
119
|
-
// Written before anything reaches the broker, so a provision killed partway still leaves a record.
|
|
120
|
-
const record = { space: t.space, id: identity.id, lifecycleUid, owner: process.ppid };
|
|
121
|
-
writeFileSync(join(dir, RECORD), JSON.stringify(record), { mode: 0o600 });
|
|
122
|
-
try {
|
|
123
|
-
await prov.start();
|
|
124
|
-
// The same durable footprint a foreground spawn provisions (DM and delivery durables, read-ACL
|
|
125
|
-
// row), so a connection that blips misses nothing, and the same retirement removes it.
|
|
126
|
-
const creds = await provisionAgent(prov, t.auth, identity, { ...channels, role: def.role, lifecycleUid });
|
|
127
|
-
writeFileSync(join(dir, "agent.creds"), creds, { mode: 0o600 });
|
|
128
|
-
}
|
|
129
|
-
catch (e) {
|
|
130
|
-
await prov.stop().catch(() => { });
|
|
131
|
-
await retireDir(dir).catch(() => { });
|
|
132
|
-
throw e;
|
|
133
|
-
}
|
|
134
|
-
await prov.stop();
|
|
135
|
-
return { ok: true, env: { ...env, COTAL_CREDS: join(dir, "agent.creds"), COTAL_LIFECYCLE_UID: lifecycleUid }, retire: { dir } };
|
|
73
|
+
return { ok: false, error: `the mesh "${t.space}" has no human approval for app conversations, so no identity was opened; connect through a signed-in mesh whose authority offers connection approval` };
|
|
136
74
|
}
|
|
137
75
|
async function retire(values) {
|
|
138
76
|
if (!values.dir)
|
|
139
77
|
return { ok: false, error: "retire needs --dir <dir>" };
|
|
140
|
-
|
|
78
|
+
if (isUserAppDir(values.dir))
|
|
79
|
+
await retireUserApp(values.dir);
|
|
80
|
+
else
|
|
81
|
+
await retireDir(values.dir);
|
|
82
|
+
return { ok: true };
|
|
83
|
+
}
|
|
84
|
+
/** On a signed-in mesh, retire the saved conversations whose server process has exited. The
|
|
85
|
+
* connector runs this after a connection, so the connection never waits for that cleanup. */
|
|
86
|
+
async function reap(values) {
|
|
87
|
+
const t = await target(values.space);
|
|
88
|
+
if (t.mode === "user")
|
|
89
|
+
await retireDeadUserApps(t);
|
|
141
90
|
return { ok: true };
|
|
142
91
|
}
|
|
143
92
|
/** Remove what provision made in `dirArg`: on an auth mesh the identity's broker footprint first,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-identity.js","sourceRoot":"","sources":["../../src/commands/app-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"app-identity.js","sourceRoot":"","sources":["../../src/commands/app-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QA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e,CAAC;YAAE,SAAS;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC;gBAAE,SAAS;YACzE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAmB,CAAC;YACrF,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,SAAS;YAClC,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;QACzE,CAAC;IACH,CAAC;AACH,CAAC;AAED,oGAAoG;AACpG,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAQ,CAA2B,CAAC,IAAI,KAAK,OAAO,CAAC;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ConversationGrant, type ConversationPending, type ConversationSelection } from "@cotal-ai/core";
|
|
2
|
+
import { type MeshTarget } from "@cotal-ai/workspace";
|
|
3
|
+
/** A connected conversation identity: its environment, where to retire it, and its exact grant. */
|
|
4
|
+
export interface UserAppConnection {
|
|
5
|
+
env: Record<string, string>;
|
|
6
|
+
retire: {
|
|
7
|
+
dir: string;
|
|
8
|
+
};
|
|
9
|
+
grant: ConversationGrant;
|
|
10
|
+
}
|
|
11
|
+
/** The session key is supplied by the native host, not guessed from a parent pid or an open inbox.
|
|
12
|
+
* A new request waits for a person's approval: until it is decided this returns `pending`, and
|
|
13
|
+
* connecting again replays the same saved request and secret. */
|
|
14
|
+
export declare function provisionUserApp(target: MeshTarget, name: string, session: string | undefined, events: boolean, selection?: ConversationSelection): Promise<UserAppConnection | {
|
|
15
|
+
pending: ConversationPending;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function isUserAppDir(dir: string): boolean;
|
|
18
|
+
/** Retain the record and secret until exact lifecycle revocation and footprint cleanup are observed. */
|
|
19
|
+
export declare function retireUserApp(dir: string): Promise<void>;
|
|
20
|
+
/** Retire this mesh's saved conversations whose consumer process is provably gone, such as a
|
|
21
|
+
* gateway killed before it could retire them. A live or unknown consumer keeps its identity, and a
|
|
22
|
+
* retirement that does not finish stays saved for a later run. A live record is never locked. */
|
|
23
|
+
export declare function retireDeadUserApps(target: MeshTarget): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=app-user-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-user-identity.d.ts","sourceRoot":"","sources":["../../src/lib/app-user-identity.ts"],"names":[],"mappings":"AAGA,OAAO,EAI6B,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAC/G,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAA4F,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgIhJ,mGAAmG;AACnG,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED;;kEAEkE;AAClE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,qBAAqB,GAChH,OAAO,CAAC,iBAAiB,GAAG;IAAE,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAiH/D;AAUD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExD;AAED;;kGAEkG;AAClG,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAS1E"}
|