@cef-ai/cli 2.2.4 → 2.4.1

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.
@@ -0,0 +1,321 @@
1
+ /**
2
+ * `cef push --kind widget` — publish a widget that belongs to the agent
3
+ * SERVICE rather than to any one agent.
4
+ *
5
+ * WHY THIS EXISTS. A widget has only ever been publishable inside an agent's
6
+ * bundle: `cef build` stages it under `dist/<agent>/widgets/<id>/` and `cef
7
+ * push` links it into that agent's version node. That makes the widget a
8
+ * property of one agent, which is wrong for the screens people actually build
9
+ * — a runs board, a curation console, a report — because those read the whole
10
+ * service, and because deleting or re-versioning an agent should not take a
11
+ * dashboard with it. This publishes one from its own directory, under the
12
+ * bucket's `widgets` registry root, keyed by the service.
13
+ *
14
+ * NOTHING IS REPLACED. Agent-shipped widgets keep working exactly as they did:
15
+ * same staging, same version-node link, same manifest entry. A bucket can hold
16
+ * both roots at once, and a reader resolves `{bucketId, cid}` + `entry` the
17
+ * same way whichever root a widget came from.
18
+ *
19
+ * THE PROJECT IT READS. A widget subproject is an ordinary JS package — its
20
+ * own `package.json`, its own build, its output in `dist/`. That is the whole
21
+ * contract; there is no second config format to learn. `package.json` supplies
22
+ * the name and the version, an optional `cef` block overrides the id and the
23
+ * entry file.
24
+ */
25
+ import fs from "node:fs/promises";
26
+ import path from "node:path";
27
+ import { parseBucketId, pushWidgetVersion, resolveDdcCredential, } from "../lib/ddc.js";
28
+ import { envConfig, WIDGET_WALLET_APP_ID } from "../lib/env.js";
29
+ import { canonicalAsPubkey } from "../lib/identity.js";
30
+ import { patchBakedWidgetManifest } from "../lib/widget-manifest.js";
31
+ import { resolveWidgetRuntimeBundle, WIDGET_RUNTIME_BUNDLE_BASENAME, } from "../lib/widget-runtime-bundle.js";
32
+ import { buildWidgetManifest, injectWidgetBridge } from "@cef-ai/widget-runtime/build-tools";
33
+ const DEFAULT_ENTRY = "index.html";
34
+ /**
35
+ * What the runtime cannot do without, checked before the bytes go up.
36
+ *
37
+ * Every one of these is read on mount or on the first query, and every one of
38
+ * them fails LATE and quietly when absent: a missing `scope` sends the query to
39
+ * `/scopes/undefined/…`, missing `endpoints` sends it nowhere at all, and the
40
+ * author sees a 404 in a browser console rather than an error from the command
41
+ * that published it. `agentId` is deliberately not here — it is empty until
42
+ * `--as-pubkey` stamps it, and that is a warning rather than a refusal because
43
+ * a widget can legitimately be published before its service is known.
44
+ */
45
+ function manifestProblems(m) {
46
+ const problems = [];
47
+ const str = (key) => typeof m[key] === "string" && m[key] !== "";
48
+ if (m.schemaVersion !== 1)
49
+ problems.push("schemaVersion must be 1");
50
+ for (const key of ["widgetId", "name", "scope"]) {
51
+ if (!str(key))
52
+ problems.push(`${key} is required`);
53
+ }
54
+ if (typeof m.cubbyAlias !== "string")
55
+ problems.push("cubbyAlias is required (may be empty)");
56
+ const wallet = m.wallet;
57
+ if (!wallet || typeof wallet.appId !== "string" || typeof wallet.env !== "string") {
58
+ problems.push("wallet must be { appId, env }");
59
+ }
60
+ const endpoints = m.endpoints;
61
+ for (const key of ["vault", "gar", "marketplace", "s3GatewayAuthInfo", "rpc"]) {
62
+ if (!endpoints || typeof endpoints[key] !== "string" || endpoints[key] === "") {
63
+ problems.push(`endpoints.${key} is required`);
64
+ }
65
+ }
66
+ if (!Array.isArray(m.queries))
67
+ problems.push("queries is required");
68
+ return problems;
69
+ }
70
+ /**
71
+ * The entry HTML must have somewhere to render, for every kind but `custom`.
72
+ *
73
+ * REFUSED AT PUSH, because the failure at runtime is silence. The widget
74
+ * runtime mounts a declared kind into `#app`; with no such element it boots,
75
+ * resolves its identity, and renders whatever static markup the file happens to
76
+ * contain. The page looks finished and shows no data, which reads as "the query
77
+ * returned nothing" — so the one place it is cheap to catch is here, before the
78
+ * bytes go up.
79
+ *
80
+ * `custom` is exempt: such a widget self-boots from its own <body> script and
81
+ * owns its DOM, so requiring an element it does not use would be wrong.
82
+ *
83
+ * A text scan, not a parse: the CLI has no DOM, the id is written the same way
84
+ * in every real entry file, and a false NEGATIVE here only restores today's
85
+ * behaviour while a false positive would refuse a correct widget.
86
+ */
87
+ export function entryHasMountPoint(html) {
88
+ return /\sid\s*=\s*("app"|'app'|app[\s>])/i.test(html);
89
+ }
90
+ /**
91
+ * A registry name from an npm package name.
92
+ *
93
+ * A scoped name (`@acme/runs-board`) keeps only its last segment, because the
94
+ * scope is a publishing detail of npm and the registry link name is a path
95
+ * segment people type. Everything outside the alias alphabet becomes a hyphen
96
+ * so the result is addressable.
97
+ */
98
+ export function widgetIdFromPackageName(name) {
99
+ const last = name.split("/").pop() ?? name;
100
+ const slug = last.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
101
+ if (!slug) {
102
+ throw new Error(`[cef push] cannot derive a widget id from the package name "${name}" — pass --widget-id`);
103
+ }
104
+ return slug;
105
+ }
106
+ /**
107
+ * Every file under `dir`, named by its path RELATIVE to it.
108
+ *
109
+ * Recursive, unlike the agent path's staged-widget reader: that one reads a
110
+ * directory `cef build` flattened itself, whereas this reads whatever a
111
+ * bundler emitted, and every bundler emits an `assets/` directory.
112
+ */
113
+ export async function readBuiltFiles(dir, prefix = "") {
114
+ let entries;
115
+ try {
116
+ entries = await fs.readdir(dir, { withFileTypes: true });
117
+ }
118
+ catch (e) {
119
+ if (e.code === "ENOENT")
120
+ return null;
121
+ throw e;
122
+ }
123
+ const files = [];
124
+ // Sorted, so the same tree produces the same link order and therefore the
125
+ // same version CID on every machine. `readdir` returns whatever order the
126
+ // filesystem holds, which would make a rebuild of identical bytes look like
127
+ // a new release.
128
+ entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
129
+ for (const entry of entries) {
130
+ const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
131
+ if (entry.isDirectory()) {
132
+ const nested = await readBuiltFiles(path.join(dir, entry.name), rel);
133
+ if (nested)
134
+ files.push(...nested);
135
+ }
136
+ else if (entry.isFile()) {
137
+ files.push({ name: rel, bytes: await fs.readFile(path.join(dir, entry.name)) });
138
+ }
139
+ }
140
+ return files;
141
+ }
142
+ export async function cefPushWidget(opts) {
143
+ const cwd = opts.cwd ? path.resolve(opts.cwd) : process.cwd();
144
+ const projectDir = opts.dir ? path.resolve(cwd, opts.dir) : cwd;
145
+ const outDir = path.resolve(projectDir, opts.outDir ?? "dist");
146
+ const bucketId = parseBucketId(opts.bucket);
147
+ const credential = resolveDdcCredential({
148
+ ...(opts.secretPhrase !== undefined ? { secretPhrase: opts.secretPhrase } : {}),
149
+ ...(opts.accessToken !== undefined ? { accessToken: opts.accessToken } : {}),
150
+ });
151
+ let pkg = {};
152
+ try {
153
+ pkg = JSON.parse(await fs.readFile(path.join(projectDir, "package.json"), "utf8"));
154
+ }
155
+ catch (e) {
156
+ if (e.code !== "ENOENT")
157
+ throw e;
158
+ // No package.json is survivable as long as --widget-id and --widget-version
159
+ // were given; the checks below say so in those words rather than reporting
160
+ // a missing file the user may not have expected to need.
161
+ }
162
+ const id = opts.id ?? pkg.cef?.id ?? (pkg.name ? widgetIdFromPackageName(pkg.name) : undefined);
163
+ if (!id) {
164
+ throw new Error(`[cef push] no widget id — ${projectDir} has no package.json "name", and --widget-id was not given`);
165
+ }
166
+ const version = opts.version ?? pkg.version;
167
+ if (!version) {
168
+ throw new Error(`[cef push] widget "${id}" has no version — set one in package.json or pass --widget-version`);
169
+ }
170
+ const files = await readBuiltFiles(outDir);
171
+ if (files === null) {
172
+ throw new Error(`[cef push] widget "${id}": no build output at ${outDir} — build it first (or pass --out)`);
173
+ }
174
+ if (files.length === 0) {
175
+ throw new Error(`[cef push] widget "${id}": ${outDir} is empty — build it first`);
176
+ }
177
+ const entry = pkg.cef?.entry ?? DEFAULT_ENTRY;
178
+ const entryFile = files.find((f) => f.name === entry);
179
+ if (!entryFile) {
180
+ throw new Error(`[cef push] widget "${id}": entry "${entry}" is not in ${outDir} — `
181
+ + `set "cef": { "entry": … } in package.json if the build names it something else`);
182
+ }
183
+ // THE MANIFEST, built or patched, then checked.
184
+ //
185
+ // `cef build` writes a `window.WidgetSandbox` block for a widget shipped
186
+ // inside an agent; a standalone widget either carries one already (built by
187
+ // some other means) or declares itself in `package.json`'s `cef` block and
188
+ // has one written here. Either way the deploy-time facts are stamped in —
189
+ // the identity it connects as and the environment it calls — because `cef
190
+ // build` is deliberately env-agnostic and without the stamp the widget talks
191
+ // to whichever environment was baked in.
192
+ //
193
+ // The agentId it gets is `<asPubkey>:<id>`. There is no agent behind it, and
194
+ // that is the point: the widget runtime reads the part BEFORE the colon to
195
+ // find the agent service whose cubbies a `sql` query may read, so a
196
+ // service-owned widget needs a service-owned identity of the same shape.
197
+ const asPub = opts.agentServicePubkey ? canonicalAsPubkey(opts.agentServicePubkey) : undefined;
198
+ const widgetEnv = envConfig(opts.env);
199
+ const agentId = asPub ? `${asPub}:${id}` : "";
200
+ const endpoints = {
201
+ vault: widgetEnv.vault,
202
+ gar: widgetEnv.gar,
203
+ marketplace: widgetEnv.marketplace,
204
+ s3GatewayAuthInfo: widgetEnv.s3GatewayAuthInfo,
205
+ rpc: widgetEnv.rpc,
206
+ };
207
+ const entryHtml = new TextDecoder().decode(entryFile.bytes);
208
+ let manifest;
209
+ const patched = patchBakedWidgetManifest(entryHtml, (mf) => {
210
+ if (asPub)
211
+ mf.agentId = agentId;
212
+ mf.endpoints = endpoints;
213
+ // Preserve the baked wallet appId (an app identity, possibly custom); only
214
+ // the wallet ENV follows --env.
215
+ const wallet = mf.wallet && typeof mf.wallet === "object"
216
+ ? mf.wallet
217
+ : { appId: WIDGET_WALLET_APP_ID };
218
+ mf.wallet = { ...wallet, env: widgetEnv.wallet.env };
219
+ manifest = mf;
220
+ });
221
+ if (patched !== null) {
222
+ entryFile.bytes = new TextEncoder().encode(patched);
223
+ }
224
+ else if (pkg.cef?.queries) {
225
+ // No block, but the package declares the widget — build one and inject it,
226
+ // exactly as `cef build` does for an agent's widget, and vendor the runtime
227
+ // the injected script tag points at.
228
+ manifest = buildWidgetManifest({
229
+ widgetId: id,
230
+ name: pkg.cef.name ?? pkg.name ?? id,
231
+ // buildWidgetManifest refuses an empty agentId, and rightly — a widget
232
+ // with no identity cannot connect. A push that names no service is still
233
+ // legal (the widget is published, not yet attributed), so it is given a
234
+ // placeholder here and blanked again below, where the warning is.
235
+ agentId: agentId || "0x0:placeholder",
236
+ scope: pkg.cef.scope ?? "default",
237
+ cubbyAlias: pkg.cef.cubbyAlias ?? "",
238
+ wallet: { appId: WIDGET_WALLET_APP_ID, env: widgetEnv.wallet.env },
239
+ endpoints,
240
+ queries: pkg.cef.queries,
241
+ ...(pkg.cef.events ? { events: pkg.cef.events } : {}),
242
+ ...(pkg.cef.kind ? { kind: pkg.cef.kind } : {}),
243
+ ...(pkg.cef.config ? { config: pkg.cef.config } : {}),
244
+ });
245
+ if (!asPub)
246
+ manifest.agentId = "";
247
+ const runtime = resolveWidgetRuntimeBundle();
248
+ if (!runtime) {
249
+ throw new Error(`[cef push] widget "${id}": cannot vendor the widget runtime — `
250
+ + `@cef-ai/widget-runtime is not resolvable from ${projectDir}`);
251
+ }
252
+ files.push({
253
+ name: WIDGET_RUNTIME_BUNDLE_BASENAME,
254
+ bytes: await fs.readFile(runtime),
255
+ });
256
+ entryFile.bytes = new TextEncoder().encode(injectWidgetBridge(entryHtml, {
257
+ manifest: manifest,
258
+ runtimeUrl: `./${WIDGET_RUNTIME_BUNDLE_BASENAME}`,
259
+ }));
260
+ }
261
+ else {
262
+ throw new Error(`[cef push] widget "${id}": "${entry}" carries no window.WidgetSandbox manifest `
263
+ + `and package.json declares no "cef": { queries: [...] } to build one from. `
264
+ + `A widget without a manifest loads and then fails every query at runtime, `
265
+ + `so this is refused rather than published.`);
266
+ }
267
+ // CHECKED BEFORE THE BYTES GO UP. Everything below fails late and quietly at
268
+ // runtime; naming it here costs one line and saves a browser console.
269
+ const kind = manifest?.kind ?? "";
270
+ if (kind && kind !== "custom") {
271
+ const finalHtml = new TextDecoder().decode(entryFile.bytes);
272
+ if (!entryHasMountPoint(finalHtml)) {
273
+ throw new Error(`[cef push] widget "${id}": "${entry}" declares kind "${kind}" but has no `
274
+ + `<div id="app"></div>, so the runtime has nowhere to render and the widget `
275
+ + `would publish fine and then show nothing. Add the element, or declare `
276
+ + `"kind": "custom" and mount it yourself.`);
277
+ }
278
+ }
279
+ const problems = manifestProblems(manifest ?? {});
280
+ if (problems.length > 0) {
281
+ throw new Error(`[cef push] widget "${id}": its manifest is not usable — ${problems.join("; ")}`);
282
+ }
283
+ if (!asPub) {
284
+ console.warn(`[cef push] WARNING: widget "${id}" was published with no --as-pubkey, so its `
285
+ + `agentId is empty: it cannot connect, and a "service" query has no service to read. `
286
+ + `Re-push with --as-pubkey once the agent service is known.`);
287
+ }
288
+ const descriptor = {
289
+ id,
290
+ name: pkg.cef?.name ?? pkg.name ?? id,
291
+ version,
292
+ entry,
293
+ ...(asPub ? { agentServicePubkey: asPub } : {}),
294
+ bucketId: bucketId.toString(),
295
+ files: files.map((f) => f.name),
296
+ };
297
+ const result = await pushWidgetVersion({
298
+ bucketId,
299
+ widgetName: id,
300
+ version,
301
+ files,
302
+ descriptorBytes: new TextEncoder().encode(JSON.stringify(descriptor, null, 2) + "\n"),
303
+ ...credential,
304
+ ...(opts.preset !== undefined ? { preset: opts.preset } : {}),
305
+ ...(opts.endpoint !== undefined ? { endpoint: opts.endpoint } : {}),
306
+ ...(opts.cdn !== undefined ? { cdn: opts.cdn } : {}),
307
+ ...(opts.ddcModuleImpl !== undefined ? { ddcModuleImpl: opts.ddcModuleImpl } : {}),
308
+ });
309
+ return {
310
+ id,
311
+ version,
312
+ bucketId: bucketId.toString(),
313
+ cid: result.versionCid,
314
+ entry,
315
+ recordCid: result.recordCid,
316
+ directoryCid: result.directoryCid,
317
+ fileCount: files.length,
318
+ size: result.size,
319
+ };
320
+ }
321
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/commands/widget.ts"],"names":[],"mappings":"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ACd,OAAO;QACP,KAAK;QACL,eAAe,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;QACrF,GAAG,UAAU;QACb,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnF,CAAC,CAAC;IAEH,OAAO;QACL,EAAE;QACF,OAAO;QACP,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;QAC7B,GAAG,EAAE,MAAM,CAAC,UAAU;QACtB,KAAK;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC;AACJ,CAAC"}
package/dist/lib/ddc.d.ts CHANGED
@@ -23,6 +23,31 @@
23
23
  export type DdcPreset = "MAINNET" | "TESTNET" | "DEVNET";
24
24
  /** CNS name for the agents directory DAG (analogous to model-cli's "models"). */
25
25
  export declare const CNS_AGENTS_NAME = "agents";
26
+ /**
27
+ * CNS name for the STANDALONE widgets directory DAG.
28
+ *
29
+ * A widget shipped inside an agent's bundle still lives under that agent's
30
+ * version node (`VERSION_WIDGETS_NAME`) and is unaffected by this. This root is
31
+ * for a widget published on its own — one that belongs to the agent SERVICE
32
+ * rather than to any single agent, and therefore has no agent version to hang
33
+ * off. The two coexist: the same bucket can carry both roots, and a reader
34
+ * finds a widget wherever it was published.
35
+ */
36
+ export declare const CNS_WIDGETS_NAME = "widgets";
37
+ /**
38
+ * CNS name for the cubby DECLARATIONS directory DAG.
39
+ *
40
+ * A third root beside `agents` and `widgets`, and for the same reason: the
41
+ * bucket IS the registry. An agent's cubbies travel inside its manifest, so a
42
+ * cubby the agent SERVICE owns — belonging to no single agent — sits here, and
43
+ * the orchestrator reads it the same way it reads a manifest:
44
+ * `{cdn}/{bucketId}/cubbies/{alias}/{version|latest}/cubby.json`.
45
+ */
46
+ export declare const CNS_CUBBIES_NAME = "cubbies";
47
+ /** Link name of the declaration leaf inside a cubby version node. */
48
+ export declare const CUBBY_DESCRIPTOR_NAME = "cubby.json";
49
+ /** Link name for the descriptor leaf inside a standalone widget version node. */
50
+ export declare const WIDGET_DESCRIPTOR_NAME = "widget.json";
26
51
  /** Link name for the manifest leaf inside a version node. */
27
52
  export declare const VERSION_MANIFEST_NAME = "manifest.json";
28
53
  /** Link name for the bundle leaf inside a version node. */
@@ -174,6 +199,12 @@ interface DdcClientLike {
174
199
  }>;
175
200
  disconnect?(): Promise<unknown>;
176
201
  }
202
+ /** Network-selection subset shared by every DDC upload entrypoint. */
203
+ interface DdcNetworkInput {
204
+ preset?: DdcPreset;
205
+ endpoint?: string;
206
+ cdn?: string;
207
+ }
177
208
  /**
178
209
  * A bucket id, or a readable refusal. Shared so `--bucket abc` cannot die with
179
210
  * `SyntaxError: Cannot convert abc to a BigInt` on one path and a proper
@@ -199,5 +230,71 @@ export declare function resolveDdcCredential(opts: {
199
230
  accessToken?: string;
200
231
  };
201
232
  export declare function pushAgentVersion(input: PushAgentVersionInput): Promise<PushAgentVersionResult>;
233
+ /** What a standalone widget push needs, beyond the network/credential pair. */
234
+ export interface PushWidgetVersionInput extends DdcNetworkInput {
235
+ bucketId: bigint;
236
+ /** Registry name — the link name under the `widgets` directory. */
237
+ widgetName: string;
238
+ version: string;
239
+ /**
240
+ * The built widget: the entry HTML and everything beside it. Names are paths
241
+ * relative to the build output (`index.html`, `assets/index-abc.js`) and the
242
+ * directory shape is preserved in the DAG.
243
+ */
244
+ files: {
245
+ name: string;
246
+ bytes: Uint8Array;
247
+ }[];
248
+ /**
249
+ * The descriptor stored beside them, already serialised. It is the widget's
250
+ * equivalent of an agent's `manifest.json`: who owns it, what its entry file
251
+ * is called, which version this is.
252
+ */
253
+ descriptorBytes: Uint8Array;
254
+ secretPhrase?: string;
255
+ accessToken?: string;
256
+ ddcModuleImpl?: DdcModule;
257
+ }
258
+ export interface PushWidgetVersionResult {
259
+ /** Per-version DAG CID. This IS the servable directory — see below. */
260
+ versionCid: string;
261
+ /** Leaf CID of the stored `widget.json`. */
262
+ descriptorCid: string;
263
+ /** Per-widget record DAG CID (`<version>` + `latest`). */
264
+ recordCid: string;
265
+ /** `widgets` directory DAG CID (the CNS target). */
266
+ directoryCid: string;
267
+ /** Bytes uploaded across the widget's files (the descriptor excluded). */
268
+ size: number;
269
+ }
270
+ export declare function pushWidgetVersion(input: PushWidgetVersionInput): Promise<PushWidgetVersionResult>;
271
+ /** One cubby declaration, ready to publish. */
272
+ export interface PushCubbyVersionInput extends DdcNetworkInput {
273
+ bucketId: bigint;
274
+ /** Registry name — the link name under the `cubbies` directory, and the alias. */
275
+ alias: string;
276
+ version: string;
277
+ /** The declaration itself, already serialised. */
278
+ descriptorBytes: Uint8Array;
279
+ secretPhrase?: string;
280
+ accessToken?: string;
281
+ ddcModuleImpl?: DdcModule;
282
+ }
283
+ export interface PushCubbyVersionResult {
284
+ versionCid: string;
285
+ descriptorCid: string;
286
+ recordCid: string;
287
+ directoryCid: string;
288
+ size: number;
289
+ }
290
+ /**
291
+ * Publish one cubby declaration.
292
+ *
293
+ * The version node holds exactly one leaf, `cubby.json`, so the CID the registry
294
+ * resolves to serves the declaration directly — the same
295
+ * `{root}/{name}/{version}/{file}` walk an agent manifest is read by, which is
296
+ * why the orchestrator needed no new kind of reader.
297
+ */
298
+ export declare function pushCubbyVersion(input: PushCubbyVersionInput): Promise<PushCubbyVersionResult>;
202
299
  export {};
203
300
  //# sourceMappingURL=ddc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ddc.d.ts","sourceRoot":"","sources":["../../src/lib/ddc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzD,iFAAiF;AACjF,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AACrD,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AACvD,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,EAAE,CAAC;CAC9C;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA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