@cotal-ai/cli 0.6.0 → 0.8.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/channels.d.ts +4 -2
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +17 -18
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +13 -29
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/down-manifest.d.ts +6 -0
- package/dist/commands/down-manifest.d.ts.map +1 -0
- package/dist/commands/down-manifest.js +282 -0
- package/dist/commands/down-manifest.js.map +1 -0
- package/dist/commands/down.d.ts +5 -3
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +30 -3
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +6 -13
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +20 -7
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/meshes.d.ts +5 -0
- package/dist/commands/meshes.d.ts.map +1 -0
- package/dist/commands/meshes.js +25 -0
- package/dist/commands/meshes.js.map +1 -0
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +2 -1
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +66 -16
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/spawn-manifest.d.ts +10 -0
- package/dist/commands/spawn-manifest.d.ts.map +1 -0
- package/dist/commands/spawn-manifest.js +197 -0
- package/dist/commands/spawn-manifest.js.map +1 -0
- package/dist/commands/spawn.d.ts +4 -2
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +84 -25
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/topology.d.ts +10 -0
- package/dist/commands/topology.d.ts.map +1 -0
- package/dist/commands/topology.js +46 -0
- package/dist/commands/topology.js.map +1 -0
- package/dist/commands/up.d.ts +4 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +223 -6
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/use.d.ts +7 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +27 -0
- package/dist/commands/use.js.map +1 -0
- package/dist/commands/web.d.ts.map +1 -1
- package/dist/commands/web.js +60 -28
- package/dist/commands/web.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/connect.d.ts +74 -0
- package/dist/lib/connect.d.ts.map +1 -0
- package/dist/lib/connect.js +91 -0
- package/dist/lib/connect.js.map +1 -0
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +2 -1
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/manager-proc.d.ts +4 -0
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +17 -0
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/apply.d.ts +29 -0
- package/dist/lib/manifest/apply.d.ts.map +1 -0
- package/dist/lib/manifest/apply.js +138 -0
- package/dist/lib/manifest/apply.js.map +1 -0
- package/dist/lib/manifest/errors.d.ts +21 -0
- package/dist/lib/manifest/errors.d.ts.map +1 -0
- package/dist/lib/manifest/errors.js +19 -0
- package/dist/lib/manifest/errors.js.map +1 -0
- package/dist/lib/manifest/index.d.ts +13 -0
- package/dist/lib/manifest/index.d.ts.map +1 -0
- package/dist/lib/manifest/index.js +21 -0
- package/dist/lib/manifest/index.js.map +1 -0
- package/dist/lib/manifest/ledger.d.ts +81 -0
- package/dist/lib/manifest/ledger.d.ts.map +1 -0
- package/dist/lib/manifest/ledger.js +213 -0
- package/dist/lib/manifest/ledger.js.map +1 -0
- package/dist/lib/manifest/live.d.ts +25 -0
- package/dist/lib/manifest/live.d.ts.map +1 -0
- package/dist/lib/manifest/live.js +61 -0
- package/dist/lib/manifest/live.js.map +1 -0
- package/dist/lib/manifest/model.d.ts +71 -0
- package/dist/lib/manifest/model.d.ts.map +1 -0
- package/dist/lib/manifest/model.js +2 -0
- package/dist/lib/manifest/model.js.map +1 -0
- package/dist/lib/manifest/preflight.d.ts +12 -0
- package/dist/lib/manifest/preflight.d.ts.map +1 -0
- package/dist/lib/manifest/preflight.js +43 -0
- package/dist/lib/manifest/preflight.js.map +1 -0
- package/dist/lib/manifest/prepare.d.ts +57 -0
- package/dist/lib/manifest/prepare.d.ts.map +1 -0
- package/dist/lib/manifest/prepare.js +95 -0
- package/dist/lib/manifest/prepare.js.map +1 -0
- package/dist/lib/manifest/render.d.ts +41 -0
- package/dist/lib/manifest/render.d.ts.map +1 -0
- package/dist/lib/manifest/render.js +177 -0
- package/dist/lib/manifest/render.js.map +1 -0
- package/dist/lib/manifest/resolve.d.ts +5 -0
- package/dist/lib/manifest/resolve.d.ts.map +1 -0
- package/dist/lib/manifest/resolve.js +185 -0
- package/dist/lib/manifest/resolve.js.map +1 -0
- package/dist/lib/manifest/schema.d.ts +103 -0
- package/dist/lib/manifest/schema.d.ts.map +1 -0
- package/dist/lib/manifest/schema.js +77 -0
- package/dist/lib/manifest/schema.js.map +1 -0
- package/dist/lib/manifest/spawn-plan.d.ts +87 -0
- package/dist/lib/manifest/spawn-plan.d.ts.map +1 -0
- package/dist/lib/manifest/spawn-plan.js +75 -0
- package/dist/lib/manifest/spawn-plan.js.map +1 -0
- package/dist/lib/meshes.d.ts +2 -0
- package/dist/lib/meshes.d.ts.map +1 -0
- package/dist/lib/meshes.js +6 -0
- package/dist/lib/meshes.js.map +1 -0
- package/dist/lib/onboard.js +6 -6
- package/dist/lib/onboard.js.map +1 -1
- package/dist/lib/paths.js +1 -1
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +2 -1
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/transient.d.ts +7 -6
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +6 -25
- package/dist/lib/transient.js.map +1 -1
- package/dist/web/graph.html +207 -0
- package/dist/web/graph.js +508 -0
- package/dist/web/index.html +6 -0
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/lib/manifest/render.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAKhC,MAAM,KAAK,GAAG;IACZ,SAAS,EAAE,kCAAkC;IAC7C,cAAc,EAAE,gCAAgC;IAChD,YAAY,EAAE,yBAAyB;CACxC,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,EAAY,EAAU,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AAErF,0GAA0G;AAC1G,MAAM,UAAU,cAAc,CAAC,CAAmB;IAChD,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IACrB,MAAM,GAAG,GAAa,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,IAAI,oBAAoB,CAAC;IACzD,GAAG,CAAC,IAAI,CACN,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,GAAG,CAAC;QACzB,CAAC,CAAC,GAAG,CAAC,cAAc,MAAM,cAAc,CAAC,CAAC,OAAO,IAAI,KAAK,0BAA0B,CAAC,CAAC,kBAAkB,GAAG,CAAC,CAC/G,CAAC;IAEF,iEAAiE;IACjE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACxD,KAAK,MA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AE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjK,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,GAAG;QAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,KAAK,aAAa,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACnE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,iBAAiB,GAAG,CAAC,YAAY,UAAU,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACzG,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ResolvedManifest } from "./model.js";
|
|
2
|
+
/** Parse + validate a manifest source into the resolved model. `sourcePath` anchors relative
|
|
3
|
+
* persona refs and locates errors. */
|
|
4
|
+
export declare function resolveManifest(src: string, sourcePath: string): ResolvedManifest;
|
|
5
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/lib/manifest/resolve.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAmE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGpH;uCACuC;AACvC,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB,CA4EjF"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure manifest pipeline (no network, no persona-file reads — those are preflight):
|
|
3
|
+
*
|
|
4
|
+
* parse (YAML, keep line/col) → schema (strict Zod) → normalize + invert (channel-centric →
|
|
5
|
+
* per-agent ACLs) → semantic checks (names resolve, allowSubscribe ⊇ subscribe, concrete tokens).
|
|
6
|
+
*
|
|
7
|
+
* Returns a {@link ResolvedManifest}; throws {@link ManifestError} with every problem located by
|
|
8
|
+
* file + line. Stages 1–4 of the plan — deterministic and unit-testable.
|
|
9
|
+
*/
|
|
10
|
+
import { isAbsolute, resolve as resolvePath, dirname } from "node:path";
|
|
11
|
+
import { parseDocument, LineCounter } from "yaml";
|
|
12
|
+
import { assertValidChannel, assertValidName, isConcreteChannel } from "@cotal-ai/core";
|
|
13
|
+
import { MeshManifestSchema } from "./schema.js";
|
|
14
|
+
import { ManifestError } from "./errors.js";
|
|
15
|
+
/** Parse + validate a manifest source into the resolved model. `sourcePath` anchors relative
|
|
16
|
+
* persona refs and locates errors. */
|
|
17
|
+
export function resolveManifest(src, sourcePath) {
|
|
18
|
+
const lc = new LineCounter();
|
|
19
|
+
const doc = parseDocument(src, { lineCounter: lc });
|
|
20
|
+
// Best-effort location: try the exact node, then walk up the path (union/object-level errors
|
|
21
|
+
// often have no node of their own), finally the document root. Diagnostics only — never on the
|
|
22
|
+
// resolved model (engineer, round-6).
|
|
23
|
+
const locate = (path) => {
|
|
24
|
+
if (!path)
|
|
25
|
+
return {};
|
|
26
|
+
const p = [...path];
|
|
27
|
+
for (;;) {
|
|
28
|
+
const node = doc.getIn(p, true);
|
|
29
|
+
if (node?.range) {
|
|
30
|
+
const { line, col } = lc.linePos(node.range[0]);
|
|
31
|
+
return { line, col };
|
|
32
|
+
}
|
|
33
|
+
if (p.length === 0)
|
|
34
|
+
return {};
|
|
35
|
+
p.pop();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// 1. Parse. Syntax errors + duplicate map keys (yaml enforces unique keys) surface here.
|
|
39
|
+
if (doc.errors.length)
|
|
40
|
+
throw new ManifestError(sourcePath, doc.errors.map((e) => ({ message: e.message.split("\n")[0], line: e.linePos?.[0]?.line, col: e.linePos?.[0]?.col })));
|
|
41
|
+
// Targeted message for the single-space deferral before the strict schema rejects it generically.
|
|
42
|
+
if (doc.has("spaces"))
|
|
43
|
+
throw new ManifestError(sourcePath, [
|
|
44
|
+
{ message: "`spaces:` is not supported in v1 (single-space) — use a scalar `space:`", path: ["spaces"], ...locate(["spaces"]) },
|
|
45
|
+
]);
|
|
46
|
+
// 2. Schema (strict): shape + unknown-key rejection. Map every Zod issue back to a located line.
|
|
47
|
+
const parsed = MeshManifestSchema.safeParse(doc.toJS());
|
|
48
|
+
if (!parsed.success)
|
|
49
|
+
throw new ManifestError(sourcePath, parsed.error.issues.map((iss) => {
|
|
50
|
+
const path = iss.path.filter((p) => typeof p !== "symbol");
|
|
51
|
+
// Point the line at the offending unknown key, not just its containing object.
|
|
52
|
+
const keys = iss.keys;
|
|
53
|
+
const locPath = iss.code === "unrecognized_keys" && keys?.length ? [...path, keys[0]] : path;
|
|
54
|
+
return { message: iss.message, path, ...locate(locPath) };
|
|
55
|
+
}));
|
|
56
|
+
const raw = parsed.data;
|
|
57
|
+
// 3 + 4. Normalize/invert and run pure semantic checks, collecting every problem in one pass.
|
|
58
|
+
const issues = [];
|
|
59
|
+
const add = (message, path) => issues.push({ message, path, ...locate(path) });
|
|
60
|
+
const agentNames = new Set(Object.keys(raw.agents ?? {}));
|
|
61
|
+
for (const name of agentNames)
|
|
62
|
+
try {
|
|
63
|
+
assertValidName(name);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
add(e.message, ["agents", name]);
|
|
67
|
+
}
|
|
68
|
+
if (raw.broker)
|
|
69
|
+
validateBroker(raw.broker, add);
|
|
70
|
+
const channels = normalizeChannels(raw, agentNames, add);
|
|
71
|
+
const agents = resolveAgents(raw, channels, sourcePath, add);
|
|
72
|
+
if (issues.length)
|
|
73
|
+
throw new ManifestError(sourcePath, issues);
|
|
74
|
+
return {
|
|
75
|
+
space: raw.space,
|
|
76
|
+
broker: raw.broker,
|
|
77
|
+
runtime: raw.runtime,
|
|
78
|
+
personaPermissions: raw.personaPermissions ?? "reject",
|
|
79
|
+
defaults: raw.defaults,
|
|
80
|
+
agents,
|
|
81
|
+
channels,
|
|
82
|
+
sourcePath,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Normalize each channel (default `allowSubscribe` ⇐ `subscribe`, dedup) and run the channel-level
|
|
86
|
+
* semantic checks: concrete token, every referenced name resolves, `allowSubscribe ⊇ subscribe`. */
|
|
87
|
+
function normalizeChannels(raw, agentNames, add) {
|
|
88
|
+
const out = [];
|
|
89
|
+
for (const [name, entry] of Object.entries(raw.channels)) {
|
|
90
|
+
try {
|
|
91
|
+
assertValidChannel(name);
|
|
92
|
+
if (!isConcreteChannel(name))
|
|
93
|
+
throw new Error(`channel "${name}" must be concrete — wildcard channels are not supported in v1`);
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
add(e.message, ["channels", name]);
|
|
97
|
+
}
|
|
98
|
+
const subscribe = dedupe(entry.subscribe ?? []);
|
|
99
|
+
const allowSubscribe = entry.allowSubscribe ? dedupe(entry.allowSubscribe) : [...subscribe];
|
|
100
|
+
const allowPublish = dedupe(entry.allowPublish ?? []);
|
|
101
|
+
// Every name listed under a channel must resolve to an `agents:` entry (no silent default).
|
|
102
|
+
for (const [field, names] of [["subscribe", subscribe], ["allowSubscribe", allowSubscribe], ["allowPublish", allowPublish]])
|
|
103
|
+
for (const n of names)
|
|
104
|
+
if (!agentNames.has(n))
|
|
105
|
+
add(`"${n}" is not declared in agents:`, ["channels", name, field]);
|
|
106
|
+
// An explicit allowSubscribe must be a superset of subscribe (the read-ACL invariant).
|
|
107
|
+
const missing = subscribe.filter((n) => !allowSubscribe.includes(n));
|
|
108
|
+
if (missing.length)
|
|
109
|
+
add(`subscribe [${missing.join(", ")}] not in allowSubscribe — a subscriber must be allowed to read`, ["channels", name, "allowSubscribe"]);
|
|
110
|
+
out.push({
|
|
111
|
+
name,
|
|
112
|
+
description: entry.description,
|
|
113
|
+
instructions: entry.instructions,
|
|
114
|
+
subscribe,
|
|
115
|
+
allowSubscribe,
|
|
116
|
+
allowPublish,
|
|
117
|
+
replay: entry.replay,
|
|
118
|
+
replayWindow: entry.replayWindow,
|
|
119
|
+
deliveryClass: entry.deliveryClass,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
/** Build each agent's resolved form: its persona source (file/inline) + the per-agent ACLs inverted
|
|
125
|
+
* from channel membership. Behavior overrides are carried verbatim; the persona default is filled
|
|
126
|
+
* in during preflight (which reads the file). */
|
|
127
|
+
function resolveAgents(raw, channels, sourcePath, add) {
|
|
128
|
+
const topPolicy = raw.personaPermissions ?? "reject";
|
|
129
|
+
const dir = dirname(sourcePath);
|
|
130
|
+
const personaPath = (ref) => (isAbsolute(ref) ? ref : resolvePath(dir, ref));
|
|
131
|
+
// No silent default connector (matches roster.yaml): an agent needs its own `agent:` or the
|
|
132
|
+
// top-level default. Fail loud rather than guessing claude/opencode.
|
|
133
|
+
const connector = (name, own) => {
|
|
134
|
+
const t = own ?? raw.agent;
|
|
135
|
+
if (!t)
|
|
136
|
+
add(`no connector for "${name}" — set \`agent:\` on it or a top-level \`agent:\` default`, ["agents", name]);
|
|
137
|
+
return t ?? "";
|
|
138
|
+
};
|
|
139
|
+
// After schema preprocessing every entry is the object form (a bare string was normalized to
|
|
140
|
+
// `{ persona }`), so there's a single shape to read here.
|
|
141
|
+
return Object.entries(raw.agents ?? {}).map(([name, entry]) => ({
|
|
142
|
+
name,
|
|
143
|
+
agentType: connector(name, entry.agent),
|
|
144
|
+
persona: entry.persona ? personaPath(entry.persona) : undefined,
|
|
145
|
+
model: entry.model,
|
|
146
|
+
role: entry.role,
|
|
147
|
+
description: entry.description,
|
|
148
|
+
instructions: entry.instructions,
|
|
149
|
+
capabilities: entry.capabilities,
|
|
150
|
+
personaPermissions: entry.personaPermissions ?? topPolicy,
|
|
151
|
+
policy: invertPolicy(name, channels),
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
/** Invert channel-centric membership into one agent's per-channel ACLs (the channels it appears in). */
|
|
155
|
+
function invertPolicy(name, channels) {
|
|
156
|
+
return {
|
|
157
|
+
subscribe: channels.filter((c) => c.subscribe.includes(name)).map((c) => c.name),
|
|
158
|
+
allowSubscribe: channels.filter((c) => c.allowSubscribe.includes(name)).map((c) => c.name),
|
|
159
|
+
allowPublish: channels.filter((c) => c.allowPublish.includes(name)).map((c) => c.name),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** Reject inline credentials in the broker config: a `nats://user:pass@host` URL must use the
|
|
163
|
+
* auth creds/profile path, not embedded secrets (critic, round-6); `host` is a bind address, not
|
|
164
|
+
* a URL. Each server entry must parse as a URL (no silent fallback). */
|
|
165
|
+
function validateBroker(broker, add) {
|
|
166
|
+
if (broker.host?.includes("://"))
|
|
167
|
+
add(`broker.host is a bind address (e.g. 127.0.0.1), not a URL — drop the scheme`, ["broker", "host"]);
|
|
168
|
+
if (broker.servers)
|
|
169
|
+
for (const s of broker.servers.split(",").map((x) => x.trim()).filter(Boolean)) {
|
|
170
|
+
let u;
|
|
171
|
+
try {
|
|
172
|
+
u = new URL(s);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
add(`broker.servers entry "${s}" is not a valid URL (e.g. nats://127.0.0.1:4222)`, ["broker", "servers"]);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (u.username || u.password)
|
|
179
|
+
add(`broker.servers must not embed credentials ("${u.username}:***@…") — use auth creds/profile, not inline secrets`, ["broker", "servers"]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function dedupe(xs) {
|
|
183
|
+
return [...new Set(xs)];
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../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AC,QAAQ,uDAAuD,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;QACjJ,CAAC;AACL,CAAC;AAED,SAAS,MAAM,CAAI,EAAO;IACxB,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mesh-manifest schema (`cotal.yaml`, `kind: Mesh`) — the strict Zod shape the parser
|
|
3
|
+
* validates before any normalization. Strict objects reject unknown keys (no silent ignore —
|
|
4
|
+
* matches the repo's "no fallbacks" rule); the resolved/inverted model lives in {@link ./model.js}.
|
|
5
|
+
*
|
|
6
|
+
* This is shape-only: cross-field rules (names resolve to an agent, `allowSubscribe ⊇ subscribe`,
|
|
7
|
+
* concrete channel tokens) are pure semantic checks in {@link ./resolve.js}, where they can report
|
|
8
|
+
* the offending file + line.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/** An `agents:` value is a string (bare persona path) OR the object above. A plain `z.union`
|
|
12
|
+
* collapses an object with a bad key to a useless "Invalid input", so normalize the string form to
|
|
13
|
+
* `{ persona }` first and validate the one strict object — its real errors (unrecognized key, …)
|
|
14
|
+
* then surface with their path. */
|
|
15
|
+
declare const AgentEntry: z.ZodPreprocess<z.ZodObject<{
|
|
16
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
17
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
18
|
+
model: z.ZodOptional<z.ZodString>;
|
|
19
|
+
role: z.ZodOptional<z.ZodString>;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
22
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
personaPermissions: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
reject: "reject";
|
|
25
|
+
include: "include";
|
|
26
|
+
}>>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
/** A channel carries its registry card (description/instructions + replay knobs — the existing
|
|
29
|
+
* ChannelConfig fields) plus the three native access verbs listed per-channel (agents under it). */
|
|
30
|
+
declare const ChannelEntry: z.ZodObject<{
|
|
31
|
+
description: z.ZodOptional<z.ZodString>;
|
|
32
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
33
|
+
subscribe: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
allowSubscribe: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
allowPublish: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
replay: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
replayWindow: z.ZodOptional<z.ZodString>;
|
|
38
|
+
deliveryClass: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
live: "live";
|
|
40
|
+
durable: "durable";
|
|
41
|
+
}>>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
/** The whole manifest. `apiVersion`/`kind` are literals so a foreign YAML doc is rejected up front;
|
|
44
|
+
* `agents` and `channels` are required maps. */
|
|
45
|
+
export declare const MeshManifestSchema: z.ZodObject<{
|
|
46
|
+
apiVersion: z.ZodLiteral<"cotal/v1">;
|
|
47
|
+
kind: z.ZodLiteral<"Mesh">;
|
|
48
|
+
space: z.ZodString;
|
|
49
|
+
broker: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
servers: z.ZodOptional<z.ZodString>;
|
|
51
|
+
host: z.ZodOptional<z.ZodString>;
|
|
52
|
+
auth: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
runtime: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
pty: "pty";
|
|
56
|
+
tmux: "tmux";
|
|
57
|
+
cmux: "cmux";
|
|
58
|
+
}>>;
|
|
59
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
60
|
+
personaPermissions: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
reject: "reject";
|
|
62
|
+
include: "include";
|
|
63
|
+
}>>;
|
|
64
|
+
agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
65
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
66
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
67
|
+
model: z.ZodOptional<z.ZodString>;
|
|
68
|
+
role: z.ZodOptional<z.ZodString>;
|
|
69
|
+
description: z.ZodOptional<z.ZodString>;
|
|
70
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
71
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
personaPermissions: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
reject: "reject";
|
|
74
|
+
include: "include";
|
|
75
|
+
}>>;
|
|
76
|
+
}, z.core.$strict>>>>;
|
|
77
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
replay: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
replayWindow: z.ZodOptional<z.ZodString>;
|
|
80
|
+
deliveryClass: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
live: "live";
|
|
82
|
+
durable: "durable";
|
|
83
|
+
}>>;
|
|
84
|
+
}, z.core.$strict>>;
|
|
85
|
+
channels: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
86
|
+
description: z.ZodOptional<z.ZodString>;
|
|
87
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
88
|
+
subscribe: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
allowSubscribe: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
allowPublish: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
replay: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
replayWindow: z.ZodOptional<z.ZodString>;
|
|
93
|
+
deliveryClass: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
live: "live";
|
|
95
|
+
durable: "durable";
|
|
96
|
+
}>>;
|
|
97
|
+
}, z.core.$strict>>;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
export type RawManifest = z.infer<typeof MeshManifestSchema>;
|
|
100
|
+
export type RawAgentEntry = z.infer<typeof AgentEntry>;
|
|
101
|
+
export type RawChannelEntry = z.infer<typeof ChannelEntry>;
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/lib/manifest/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB;;;oCAGoC;AACpC,QAAA,MAAM,UAAU;;;;;;;;;;;;mBAAsF,CAAC;AAEvG;qGACqG;AACrG,QAAA,MAAM,YAAY;;;;;;;;;;;;kBAShB,CAAC;AAcH;iDACiD;AACjD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAc7B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mesh-manifest schema (`cotal.yaml`, `kind: Mesh`) — the strict Zod shape the parser
|
|
3
|
+
* validates before any normalization. Strict objects reject unknown keys (no silent ignore —
|
|
4
|
+
* matches the repo's "no fallbacks" rule); the resolved/inverted model lives in {@link ./model.js}.
|
|
5
|
+
*
|
|
6
|
+
* This is shape-only: cross-field rules (names resolve to an agent, `allowSubscribe ⊇ subscribe`,
|
|
7
|
+
* concrete channel tokens) are pure semantic checks in {@link ./resolve.js}, where they can report
|
|
8
|
+
* the offending file + line.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
const DeliveryClass = z.enum(["live", "durable"]);
|
|
12
|
+
const PersonaPermissions = z.enum(["reject", "include"]);
|
|
13
|
+
/** An `agents:` value is a string (a bare persona path) OR an object — either an override on a
|
|
14
|
+
* persona file (`persona:` present) or a fully inline agent (no `persona:`). One object schema
|
|
15
|
+
* covers both; {@link ./resolve.js} splits them on the presence of `persona`. */
|
|
16
|
+
const AgentEntryObject = z
|
|
17
|
+
.strictObject({
|
|
18
|
+
persona: z.string().min(1).optional(),
|
|
19
|
+
/** Connector type to spawn this agent with (claude / opencode / hermes / …). Overrides the
|
|
20
|
+
* top-level `agent:` default; one of the two must be set (no silent default — matches roster). */
|
|
21
|
+
agent: z.string().min(1).optional(),
|
|
22
|
+
model: z.string().min(1).optional(),
|
|
23
|
+
role: z.string().min(1).optional(),
|
|
24
|
+
description: z.string().optional(),
|
|
25
|
+
instructions: z.string().optional(),
|
|
26
|
+
capabilities: z.array(z.string().min(1)).optional(),
|
|
27
|
+
/** Per-agent override of the top-level `personaPermissions` policy. */
|
|
28
|
+
personaPermissions: PersonaPermissions.optional(),
|
|
29
|
+
})
|
|
30
|
+
.refine((v) => v.persona !== undefined || v.model !== undefined || v.instructions !== undefined, {
|
|
31
|
+
message: "inline agent (no `persona:`) needs at least `model` or `instructions` — otherwise reference a persona file",
|
|
32
|
+
});
|
|
33
|
+
/** An `agents:` value is a string (bare persona path) OR the object above. A plain `z.union`
|
|
34
|
+
* collapses an object with a bad key to a useless "Invalid input", so normalize the string form to
|
|
35
|
+
* `{ persona }` first and validate the one strict object — its real errors (unrecognized key, …)
|
|
36
|
+
* then surface with their path. */
|
|
37
|
+
const AgentEntry = z.preprocess((v) => (typeof v === "string" ? { persona: v } : v), AgentEntryObject);
|
|
38
|
+
/** A channel carries its registry card (description/instructions + replay knobs — the existing
|
|
39
|
+
* ChannelConfig fields) plus the three native access verbs listed per-channel (agents under it). */
|
|
40
|
+
const ChannelEntry = z.strictObject({
|
|
41
|
+
description: z.string().optional(),
|
|
42
|
+
instructions: z.string().optional(),
|
|
43
|
+
subscribe: z.array(z.string().min(1)).optional(),
|
|
44
|
+
allowSubscribe: z.array(z.string().min(1)).optional(),
|
|
45
|
+
allowPublish: z.array(z.string().min(1)).optional(),
|
|
46
|
+
replay: z.boolean().optional(),
|
|
47
|
+
replayWindow: z.string().optional(),
|
|
48
|
+
deliveryClass: DeliveryClass.optional(),
|
|
49
|
+
});
|
|
50
|
+
const Defaults = z.strictObject({
|
|
51
|
+
replay: z.boolean().optional(),
|
|
52
|
+
replayWindow: z.string().optional(),
|
|
53
|
+
deliveryClass: DeliveryClass.optional(),
|
|
54
|
+
});
|
|
55
|
+
const Broker = z.strictObject({
|
|
56
|
+
servers: z.string().min(1).optional(),
|
|
57
|
+
host: z.string().min(1).optional(),
|
|
58
|
+
auth: z.boolean().optional(),
|
|
59
|
+
});
|
|
60
|
+
/** The whole manifest. `apiVersion`/`kind` are literals so a foreign YAML doc is rejected up front;
|
|
61
|
+
* `agents` and `channels` are required maps. */
|
|
62
|
+
export const MeshManifestSchema = z.strictObject({
|
|
63
|
+
apiVersion: z.literal("cotal/v1"),
|
|
64
|
+
kind: z.literal("Mesh"),
|
|
65
|
+
space: z.string().min(1),
|
|
66
|
+
broker: Broker.optional(),
|
|
67
|
+
runtime: z.enum(["pty", "tmux", "cmux"]).optional(),
|
|
68
|
+
/** Default connector for agents that don't set their own `agent:`. */
|
|
69
|
+
agent: z.string().min(1).optional(),
|
|
70
|
+
personaPermissions: PersonaPermissions.optional(),
|
|
71
|
+
// `agents` is optional — a channels-first manifest can seed the rooms now and add agents later.
|
|
72
|
+
// A channel that references an undeclared name is still a hard error (in resolve.ts).
|
|
73
|
+
agents: z.record(z.string().min(1), AgentEntry).optional(),
|
|
74
|
+
defaults: Defaults.optional(),
|
|
75
|
+
channels: z.record(z.string().min(1), ChannelEntry),
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/lib/manifest/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAClD,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAEzD;;kFAEkF;AAClF,MAAM,gBAAgB,GAAG,CAAC;KACvB,YAAY,CAAC;IACZ,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC;uGACmG;IACnG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnD,uEAAuE;IACvE,kBAAkB,EAAE,kBAAkB,CAAC,QAAQ,EAAE;CAClD,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EA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,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;CACpD,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cotal spawn -f` classification — the pure decision layer over a running mesh's live state (the
|
|
3
|
+
* channel registry, the roster, the broker-sourced membership feed) plus any prior ledger for this
|
|
4
|
+
* manifest. It never mutates: it produces the plan that drives `--dry-run`, the apply grouping, and
|
|
5
|
+
* the SECURITY warnings. Creation-only by construction — a pre-existing unmanaged channel/agent is
|
|
6
|
+
* classified, never adopted or patched.
|
|
7
|
+
*/
|
|
8
|
+
import { type ChannelConfig, type ChannelRegistryFile, type MembershipSnapshot, type Presence } from "@cotal-ai/core";
|
|
9
|
+
import type { ResolvedChannel } from "./model.js";
|
|
10
|
+
import type { PreparedAgent } from "./prepare.js";
|
|
11
|
+
import type { MeshLedger } from "./ledger.js";
|
|
12
|
+
export interface ChannelPlan {
|
|
13
|
+
/** Brand-new registry keys this run will create + seed + ledger-own. */
|
|
14
|
+
create: ResolvedChannel[];
|
|
15
|
+
/** Keys that already exist and are NOT owned by this run — left untouched (no card mutation); the
|
|
16
|
+
* manifest-desired card is shown against the live one. */
|
|
17
|
+
existsUnmanaged: Array<{
|
|
18
|
+
channel: ResolvedChannel;
|
|
19
|
+
live: ChannelConfig;
|
|
20
|
+
}>;
|
|
21
|
+
/** Keys this run already owns (prior ledger) — ours to additively re-seed. */
|
|
22
|
+
owned: ResolvedChannel[];
|
|
23
|
+
}
|
|
24
|
+
/** Classify each declared channel against the live registry + this run's owned keys. Only brand-new
|
|
25
|
+
* keys are creatable/ownable; a key present but unowned is `exists-unmanaged` (never adopted). */
|
|
26
|
+
export declare function classifyChannels(declared: ResolvedChannel[], live: ChannelRegistryFile, ownedKeys: Set<string>): ChannelPlan;
|
|
27
|
+
export type AgentDisposition = "will-create" | "already-owned" | "stale";
|
|
28
|
+
export interface PriorAgent {
|
|
29
|
+
requested: string;
|
|
30
|
+
name: string;
|
|
31
|
+
id: string;
|
|
32
|
+
hash: string;
|
|
33
|
+
}
|
|
34
|
+
export interface AgentPlanEntry {
|
|
35
|
+
agent: PreparedAgent;
|
|
36
|
+
/** Resolved hash of the declared agent (drift key). */
|
|
37
|
+
hash: string;
|
|
38
|
+
disposition: AgentDisposition;
|
|
39
|
+
/** The prior ledger entry, for `already-owned` / `stale`. */
|
|
40
|
+
prior?: PriorAgent;
|
|
41
|
+
/** Whether the prior spawned agent is currently present on the mesh (stale wording). */
|
|
42
|
+
running?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface AgentPlan {
|
|
45
|
+
entries: AgentPlanEntry[];
|
|
46
|
+
willCreate: AgentPlanEntry[];
|
|
47
|
+
alreadyOwned: AgentPlanEntry[];
|
|
48
|
+
stale: AgentPlanEntry[];
|
|
49
|
+
}
|
|
50
|
+
/** Classify declared agents against any prior ledger (matched by manifest key) + the live roster:
|
|
51
|
+
* not previously created → `will-create`; previously created + same resolved hash → `already-owned`
|
|
52
|
+
* (no-op); previously created + hash changed → `stale` (restart required). */
|
|
53
|
+
export declare function classifyAgents(agents: PreparedAgent[], roster: Presence[], prior?: MeshLedger): AgentPlan;
|
|
54
|
+
export interface UnmanagedActor {
|
|
55
|
+
id: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
/** How the access was observed: a durable membership record, or a live (CONNZ) subscription. */
|
|
58
|
+
via: "durable" | "live";
|
|
59
|
+
}
|
|
60
|
+
export interface ChannelExposure {
|
|
61
|
+
channel: string;
|
|
62
|
+
actors: UnmanagedActor[];
|
|
63
|
+
}
|
|
64
|
+
export interface UnmanagedReport {
|
|
65
|
+
/** Per declared channel: unmanaged actors observed with read access to it (a SECURITY conflict). */
|
|
66
|
+
perChannel: ChannelExposure[];
|
|
67
|
+
/** True when the broker-sourced membership feed was readable (the per-channel signal is meaningful).
|
|
68
|
+
* When false, the report is presence-only — an explicit LOWER BOUND, not "no unmanaged access." */
|
|
69
|
+
feedAvailable: boolean;
|
|
70
|
+
/** Feed freshness (epoch ms) when available. */
|
|
71
|
+
asOf?: number;
|
|
72
|
+
/** Present peers not owned by this run — mesh-level context (not necessarily on a declared channel). */
|
|
73
|
+
presentUnowned: Array<{
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
role?: string;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
/** Observe unmanaged actors with read access to a manifest-declared channel — an isolation conflict
|
|
80
|
+
* on a shared mesh. v1 is an explicit LOWER BOUND: it uses the roster (presence) + the broker
|
|
81
|
+
* membership feed (durable members + CONNZ live subscriptions); when the feed is absent it falls back
|
|
82
|
+
* to presence only and says so. `owned` is this run's agents (ids + spawned names) to exclude. */
|
|
83
|
+
export declare function detectUnmanagedActors(declared: string[], snapshot: MembershipSnapshot | null, roster: Presence[], owned: {
|
|
84
|
+
ids: Set<string>;
|
|
85
|
+
names: Set<string>;
|
|
86
|
+
}): UnmanagedReport;
|
|
87
|
+
//# sourceMappingURL=spawn-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-plan.d.ts","sourceRoot":"","sources":["../../../src/lib/manifest/spawn-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtI,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B;+DAC2D;IAC3D,eAAe,EAAE,KAAK,CAAC;QAAE,OAAO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e;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,oGAAoG;IACpG,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B;wGACoG;IACpG,aAAa,EAAE,OAAO,CAAC;IACvB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wGAAwG;IACxG,cAAc,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAED;;;mGAGmG;AACnG,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,kBAAkB,GAAG,IAAI,EACnC,MAAM,EAAE,QAAQ,EAAE,EAClB,KAAK,EAAE;IAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,GAC9C,eAAe,CAmBjB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cotal spawn -f` classification — the pure decision layer over a running mesh's live state (the
|
|
3
|
+
* channel registry, the roster, the broker-sourced membership feed) plus any prior ledger for this
|
|
4
|
+
* manifest. It never mutates: it produces the plan that drives `--dry-run`, the apply grouping, and
|
|
5
|
+
* the SECURITY warnings. Creation-only by construction — a pre-existing unmanaged channel/agent is
|
|
6
|
+
* classified, never adopted or patched.
|
|
7
|
+
*/
|
|
8
|
+
import { subjectMatches } from "@cotal-ai/core";
|
|
9
|
+
import { hashAgent } from "./apply.js";
|
|
10
|
+
/** Classify each declared channel against the live registry + this run's owned keys. Only brand-new
|
|
11
|
+
* keys are creatable/ownable; a key present but unowned is `exists-unmanaged` (never adopted). */
|
|
12
|
+
export function classifyChannels(declared, live, ownedKeys) {
|
|
13
|
+
const create = [];
|
|
14
|
+
const existsUnmanaged = [];
|
|
15
|
+
const owned = [];
|
|
16
|
+
for (const ch of declared) {
|
|
17
|
+
const liveCfg = live.channels?.[ch.name];
|
|
18
|
+
if (!liveCfg)
|
|
19
|
+
create.push(ch);
|
|
20
|
+
else if (ownedKeys.has(ch.name))
|
|
21
|
+
owned.push(ch);
|
|
22
|
+
else
|
|
23
|
+
existsUnmanaged.push({ channel: ch, live: liveCfg });
|
|
24
|
+
}
|
|
25
|
+
return { create, existsUnmanaged, owned };
|
|
26
|
+
}
|
|
27
|
+
/** Classify declared agents against any prior ledger (matched by manifest key) + the live roster:
|
|
28
|
+
* not previously created → `will-create`; previously created + same resolved hash → `already-owned`
|
|
29
|
+
* (no-op); previously created + hash changed → `stale` (restart required). */
|
|
30
|
+
export function classifyAgents(agents, roster, prior) {
|
|
31
|
+
const present = new Set(roster.filter((p) => p.status !== "offline").map((p) => p.card.name));
|
|
32
|
+
const priorByKey = new Map((prior?.created.agents ?? []).map((a) => [a.requested, a]));
|
|
33
|
+
const entries = agents.map((agent) => {
|
|
34
|
+
const hash = hashAgent(agent);
|
|
35
|
+
const p = priorByKey.get(agent.name); // PreparedAgent.name is the manifest `agents:` key
|
|
36
|
+
if (!p)
|
|
37
|
+
return { agent, hash, disposition: "will-create" };
|
|
38
|
+
const running = present.has(p.name);
|
|
39
|
+
return { agent, hash, disposition: p.hash === hash ? "already-owned" : "stale", prior: p, running };
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
entries,
|
|
43
|
+
willCreate: entries.filter((e) => e.disposition === "will-create"),
|
|
44
|
+
alreadyOwned: entries.filter((e) => e.disposition === "already-owned"),
|
|
45
|
+
stale: entries.filter((e) => e.disposition === "stale"),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Observe unmanaged actors with read access to a manifest-declared channel — an isolation conflict
|
|
49
|
+
* on a shared mesh. v1 is an explicit LOWER BOUND: it uses the roster (presence) + the broker
|
|
50
|
+
* membership feed (durable members + CONNZ live subscriptions); when the feed is absent it falls back
|
|
51
|
+
* to presence only and says so. `owned` is this run's agents (ids + spawned names) to exclude. */
|
|
52
|
+
export function detectUnmanagedActors(declared, snapshot, roster, owned) {
|
|
53
|
+
const presentUnowned = roster
|
|
54
|
+
.filter((p) => p.status !== "offline" && !owned.ids.has(p.card.id) && !owned.names.has(p.card.name))
|
|
55
|
+
.map((p) => ({ id: p.card.id, name: p.card.name, role: p.card.role }));
|
|
56
|
+
const nameOf = new Map(roster.map((p) => [p.card.id, p.card.name]));
|
|
57
|
+
const perChannel = [];
|
|
58
|
+
if (snapshot) {
|
|
59
|
+
for (const channel of declared) {
|
|
60
|
+
const actors = [];
|
|
61
|
+
for (const m of snapshot.members) {
|
|
62
|
+
if (owned.ids.has(m.id))
|
|
63
|
+
continue;
|
|
64
|
+
const durable = m.durable.includes(channel);
|
|
65
|
+
const live = !durable && m.live.some((pat) => subjectMatches(pat, channel)); // channel-token wildcards (`team.>`)
|
|
66
|
+
if (durable || live)
|
|
67
|
+
actors.push({ id: m.id, name: nameOf.get(m.id), via: durable ? "durable" : "live" });
|
|
68
|
+
}
|
|
69
|
+
if (actors.length)
|
|
70
|
+
perChannel.push({ channel, actors });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { perChannel, feedAvailable: Boolean(snapshot?.asOf), asOf: snapshot?.asOf, presentUnowned };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=spawn-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-plan.js","sourceRoot":"","sources":["../../../src/lib/manifest/spawn-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAwF,MAAM,gBAAgB,CAAC;AAItI,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAcvC;mGACmG;AACnG,MAAM,UAAU,gBAAgB,CAAC,QAA2B,EAAE,IAAyB,EAAE,SAAsB;IAC7G,MAAM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AC;YAC5G,CAAC;YACD,IAAI,MAAM,CAAC,MAAM;gBAAE,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meshes.d.ts","sourceRoot":"","sources":["../../src/lib/meshes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// `pruneStaleMeshes` lives in `@cotal-ai/workspace` (`preflight.ts`) — the workstation layer the
|
|
2
|
+
// manager control commands share too. Re-exported from here so its CLI importers (`connect`,
|
|
3
|
+
// `commands/meshes`, `commands/use`) and the `spawn-from-anywhere` smokes keep resolving it from
|
|
4
|
+
// this module unchanged.
|
|
5
|
+
export { pruneStaleMeshes } from "@cotal-ai/workspace";
|
|
6
|
+
//# sourceMappingURL=meshes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meshes.js","sourceRoot":"","sources":["../../src/lib/meshes.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,6FAA6F;AAC7F,iGAAiG;AACjG,yBAAyB;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|