@cef-ai/cli 1.3.1 → 1.5.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/README.md +5 -1
- package/dist/build/load-config.d.ts +65 -4
- package/dist/build/load-config.d.ts.map +1 -1
- package/dist/build/load-config.js.map +1 -1
- package/dist/build/manifest.d.ts +103 -1
- package/dist/build/manifest.d.ts.map +1 -1
- package/dist/build/manifest.js +64 -2
- package/dist/build/manifest.js.map +1 -1
- package/dist/cli-program.d.ts +6 -0
- package/dist/cli-program.d.ts.map +1 -1
- package/dist/cli-program.js +131 -3
- package/dist/cli-program.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +113 -3
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/deploy.d.ts +38 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +317 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/init.d.ts +41 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +191 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/publish.d.ts +1 -2
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +32 -24
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/push.d.ts +31 -3
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +94 -10
- package/dist/commands/push.js.map +1 -1
- package/dist/lib/ddc.d.ts +87 -15
- package/dist/lib/ddc.d.ts.map +1 -1
- package/dist/lib/ddc.js +128 -32
- package/dist/lib/ddc.js.map +1 -1
- package/dist/lib.d.ts +4 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +2 -0
- package/dist/lib.js.map +1 -1
- package/package.json +4 -3
- package/templates/hello-world/AGENTS.md +41 -0
- package/templates/hello-world/CLAUDE.md +9 -0
- package/templates/hello-world/README.md +55 -0
- package/templates/hello-world/cef.config.ts +24 -0
- package/templates/hello-world/claude/settings.json +23 -0
- package/templates/hello-world/deployments/default.jsonc +9 -0
- package/templates/hello-world/deployments/sandbox-canary.jsonc +12 -0
- package/templates/hello-world/gitignore +3 -0
- package/templates/hello-world/migrations/history/001-init.sql +5 -0
- package/templates/hello-world/package.json +23 -0
- package/templates/hello-world/src/agent.ts +44 -0
- package/templates/hello-world/test/agent.test.ts +28 -0
- package/templates/hello-world/tsconfig.json +19 -0
- package/templates/hello-world/widgets/hello/app.js +8 -0
- package/templates/hello-world/widgets/hello/hello.html +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EACL,gBAAgB,GAIjB,MAAM,eAAe,CAAC;AAoEvB,MAAM,YAAY,GAAG,MAAM,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAoB;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO;QAC1B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC;QACjC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,aA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U,GAAa,EAAE,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;YAAE,SAAS;QACnC,MAAM,GAAG,GAAG,MAAM,EAAE;aACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;aAC/C,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;aAChB,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,GAAG;YAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,uCAAuC,OAAO,4BAA4B,CAC3E,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,uCAAuC,OAAO,KAAK,UAAU;aAC1D,IAAI,EAAE;aACN,IAAI,CAAC,IAAI,CAAC,uCAAuC,CACrD,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC,CAAC,CAAE,CAAC;AACxB,CAAC"}
|
package/dist/lib/ddc.d.ts
CHANGED
|
@@ -7,18 +7,55 @@
|
|
|
7
7
|
* Copies the lazy-import + optional-dep pattern from
|
|
8
8
|
* `packages/vault-sdk/src/internal/delegation-token.ts`.
|
|
9
9
|
*
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* The bucket IS the agent registry. `cef push` builds a DAG hierarchy
|
|
11
|
+
*
|
|
12
|
+
* CNS "agents" → agents directory → per-agent record → per-version node
|
|
13
|
+
*
|
|
14
|
+
* and each per-version node is SELF-DESCRIBING — it links the version's
|
|
15
|
+
* `bundle.js`, its `manifest.json`, and a `widgets/` sub-directory. Readers
|
|
16
|
+
* (ROC, the orchestrator, the marketplace) walk this DAG via the content
|
|
17
|
+
* gateway: `<gateway>/<bucketId>/<cid>/manifest.json`, `.../bundle.js`,
|
|
18
|
+
* `.../widgets/<id>/<entry>`. The manifest still records the bundle's leaf
|
|
19
|
+
* `{bucketId, cid}` (agent runtime fetches it directly), but the version node
|
|
20
|
+
* makes the whole release browsable and content-addressed as one unit.
|
|
16
21
|
*/
|
|
17
22
|
/** Network preset name, mapped to a DDC SDK `ConfigPreset`. */
|
|
18
23
|
export type DdcPreset = "MAINNET" | "TESTNET" | "DEVNET";
|
|
19
24
|
/** CNS name for the agents directory DAG (analogous to model-cli's "models"). */
|
|
20
25
|
export declare const CNS_AGENTS_NAME = "agents";
|
|
21
|
-
|
|
26
|
+
/** Link name for the manifest leaf inside a version node. */
|
|
27
|
+
export declare const VERSION_MANIFEST_NAME = "manifest.json";
|
|
28
|
+
/** Link name for the bundle leaf inside a version node. */
|
|
29
|
+
export declare const VERSION_BUNDLE_NAME = "bundle.js";
|
|
30
|
+
/** Link name for the widgets sub-directory inside a version node. */
|
|
31
|
+
export declare const VERSION_WIDGETS_NAME = "widgets";
|
|
32
|
+
/** One widget's built directory, ready to upload as a directory DAG. */
|
|
33
|
+
export interface WidgetUpload {
|
|
34
|
+
/** Widget id — the link name under the version node's `widgets/` sub-dir. */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Flat file listing (entry HTML + sibling assets). */
|
|
37
|
+
files: {
|
|
38
|
+
name: string;
|
|
39
|
+
bytes: Uint8Array;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Content-addressed refs produced while uploading a version, handed to the
|
|
44
|
+
* caller's {@link PushAgentVersionInput.buildManifestBytes} so it can stamp
|
|
45
|
+
* them into the manifest BEFORE the manifest leaf is stored (the version node
|
|
46
|
+
* must contain the final, stamped manifest).
|
|
47
|
+
*/
|
|
48
|
+
export interface ManifestRefs {
|
|
49
|
+
/** Leaf CID of `bundle.js`. */
|
|
50
|
+
bundleCid: string;
|
|
51
|
+
/** One entry per uploaded widget, in input order. */
|
|
52
|
+
widgets: Array<{
|
|
53
|
+
id: string;
|
|
54
|
+
dirCid: string;
|
|
55
|
+
fileCount: number;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export interface PushAgentVersionInput {
|
|
22
59
|
/** DDC bucket id (the substrate signer must own it). */
|
|
23
60
|
bucketId: bigint;
|
|
24
61
|
/** Marketplace alias / agent name — the per-agent record name in the DAG. */
|
|
@@ -27,11 +64,30 @@ export interface PushBundleInput {
|
|
|
27
64
|
version: string;
|
|
28
65
|
/** Raw `bundle.js` bytes. */
|
|
29
66
|
bundleBytes: Uint8Array;
|
|
67
|
+
/** Widgets to upload as directory DAGs under the version node's `widgets/`. */
|
|
68
|
+
widgets?: WidgetUpload[];
|
|
69
|
+
/**
|
|
70
|
+
* Produce the final `manifest.json` bytes given the content-addressed refs.
|
|
71
|
+
* Called after the bundle + widgets are stored (so their CIDs can be stamped)
|
|
72
|
+
* and before the manifest leaf + version node are stored. Kept as a callback
|
|
73
|
+
* so this module stays manifest-shape-agnostic.
|
|
74
|
+
*/
|
|
75
|
+
buildManifestBytes: (refs: ManifestRefs) => Uint8Array | Promise<Uint8Array>;
|
|
30
76
|
/**
|
|
31
77
|
* Substrate secret phrase (Sr25519) — the DDC bucket owner. Distinct from
|
|
32
78
|
* the AS Ed25519 keypair `cef publish` uses for the marketplace envelope.
|
|
79
|
+
* Exactly one of `secretPhrase` or `accessToken` must be provided.
|
|
80
|
+
*/
|
|
81
|
+
secretPhrase?: string;
|
|
82
|
+
/**
|
|
83
|
+
* DDC access token (base58) authorizing writes to the bucket, granted by the
|
|
84
|
+
* bucket owner. Lets a developer who does NOT hold the bucket's secret phrase
|
|
85
|
+
* still push — e.g. a token minted in ROC by the wallet that owns the AS's
|
|
86
|
+
* bucket. When set, the DDC client is constructed with a throwaway signer and
|
|
87
|
+
* the token carries the authority. Exactly one of `secretPhrase` or
|
|
88
|
+
* `accessToken` must be provided.
|
|
33
89
|
*/
|
|
34
|
-
|
|
90
|
+
accessToken?: string;
|
|
35
91
|
/** Network preset. Defaults to MAINNET. Ignored when `endpoint` is set. */
|
|
36
92
|
preset?: DdcPreset;
|
|
37
93
|
/** Explicit blockchain endpoint (overrides `preset`). */
|
|
@@ -44,15 +100,25 @@ export interface PushBundleInput {
|
|
|
44
100
|
*/
|
|
45
101
|
ddcModuleImpl?: DdcModule;
|
|
46
102
|
}
|
|
47
|
-
export interface
|
|
103
|
+
export interface PushAgentVersionResult {
|
|
48
104
|
/** LEAF `bundle.js` piece CID — what the manifest records. */
|
|
49
105
|
leafCid: string;
|
|
50
|
-
/**
|
|
106
|
+
/** LEAF `manifest.json` piece CID stored inside the version node. */
|
|
107
|
+
manifestCid: string;
|
|
108
|
+
/** Per-version DAG CID (links bundle.js + manifest.json + widgets/). */
|
|
51
109
|
versionCid: string;
|
|
52
110
|
/** Per-agent record DAG CID. */
|
|
53
111
|
recordCid: string;
|
|
54
|
-
/** `agents` directory DAG CID (the
|
|
112
|
+
/** `agents` directory DAG CID (the CNS target). */
|
|
55
113
|
directoryCid: string;
|
|
114
|
+
/** `widgets/` sub-directory DAG CID, or "" when the version has no widgets. */
|
|
115
|
+
widgetsCid: string;
|
|
116
|
+
/** One entry per widget uploaded (empty when none). */
|
|
117
|
+
widgets: Array<{
|
|
118
|
+
id: string;
|
|
119
|
+
dirCid: string;
|
|
120
|
+
fileCount: number;
|
|
121
|
+
}>;
|
|
56
122
|
}
|
|
57
123
|
/**
|
|
58
124
|
* Minimal structural type of the bits of `@cere-ddc-sdk/ddc-client` we use.
|
|
@@ -91,11 +157,17 @@ interface DdcClientLike {
|
|
|
91
157
|
disconnect?(): Promise<unknown>;
|
|
92
158
|
}
|
|
93
159
|
/**
|
|
94
|
-
* Upload
|
|
160
|
+
* Upload one agent version to DDC as a self-describing version node and
|
|
161
|
+
* (re)build the DAG hierarchy + CNS pointer around it.
|
|
162
|
+
*
|
|
163
|
+
* Order matters: the bundle and widgets are stored first so their CIDs can be
|
|
164
|
+
* stamped into the manifest (via `buildManifestBytes`); only then is the
|
|
165
|
+
* manifest leaf stored and the version node assembled — so the version node
|
|
166
|
+
* always contains the final, stamped manifest.
|
|
95
167
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
168
|
+
* Version node links: `bundle.js` (leaf), `manifest.json` (leaf), and — when
|
|
169
|
+
* the version has widgets — `widgets` (a directory DAG of per-widget dirs).
|
|
98
170
|
*/
|
|
99
|
-
export declare function
|
|
171
|
+
export declare function pushAgentVersion(input: PushAgentVersionInput): Promise<PushAgentVersionResult>;
|
|
100
172
|
export {};
|
|
101
173
|
//# sourceMappingURL=ddc.d.ts.map
|
package/dist/lib/ddc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddc.d.ts","sourceRoot":"","sources":["../../src/lib/ddc.ts"],"names":[],"mappings":"AAAA
|
|
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;AAE9C,wEAAwE;AACxE,MAAM,W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E,OAAO,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC,CAAC;IACtE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,IAAI,MAAM,CAAA;KAAE,CAAC,CAAC;IAChF,UAAU,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAgKD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CA6GjC"}
|
package/dist/lib/ddc.js
CHANGED
|
@@ -7,15 +7,26 @@
|
|
|
7
7
|
* Copies the lazy-import + optional-dep pattern from
|
|
8
8
|
* `packages/vault-sdk/src/internal/delegation-token.ts`.
|
|
9
9
|
*
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* The bucket IS the agent registry. `cef push` builds a DAG hierarchy
|
|
11
|
+
*
|
|
12
|
+
* CNS "agents" → agents directory → per-agent record → per-version node
|
|
13
|
+
*
|
|
14
|
+
* and each per-version node is SELF-DESCRIBING — it links the version's
|
|
15
|
+
* `bundle.js`, its `manifest.json`, and a `widgets/` sub-directory. Readers
|
|
16
|
+
* (ROC, the orchestrator, the marketplace) walk this DAG via the content
|
|
17
|
+
* gateway: `<gateway>/<bucketId>/<cid>/manifest.json`, `.../bundle.js`,
|
|
18
|
+
* `.../widgets/<id>/<entry>`. The manifest still records the bundle's leaf
|
|
19
|
+
* `{bucketId, cid}` (agent runtime fetches it directly), but the version node
|
|
20
|
+
* makes the whole release browsable and content-addressed as one unit.
|
|
16
21
|
*/
|
|
17
22
|
/** CNS name for the agents directory DAG (analogous to model-cli's "models"). */
|
|
18
23
|
export const CNS_AGENTS_NAME = "agents";
|
|
24
|
+
/** Link name for the manifest leaf inside a version node. */
|
|
25
|
+
export const VERSION_MANIFEST_NAME = "manifest.json";
|
|
26
|
+
/** Link name for the bundle leaf inside a version node. */
|
|
27
|
+
export const VERSION_BUNDLE_NAME = "bundle.js";
|
|
28
|
+
/** Link name for the widgets sub-directory inside a version node. */
|
|
29
|
+
export const VERSION_WIDGETS_NAME = "widgets";
|
|
19
30
|
/**
|
|
20
31
|
* Lazy-load the DDC SDK. Throws an actionable error when the optional
|
|
21
32
|
* dependency is not installed.
|
|
@@ -103,41 +114,123 @@ function presetConfig(ddc, input) {
|
|
|
103
114
|
// caller explicitly passed one.
|
|
104
115
|
if (input.cdn)
|
|
105
116
|
base.cdnUrl = input.cdn;
|
|
117
|
+
// `cef push` reports its own success/failure. Silence the ddc-client's
|
|
118
|
+
// internal `bindErrorLogger` output ("Error in <method>" + stack trace) so an
|
|
119
|
+
// EXPECTED miss — resolving the not-yet-created `agents` CNS root on a fresh
|
|
120
|
+
// bucket's first push — does not surface as a crash-looking red stack trace.
|
|
121
|
+
// The error is still thrown (and handled by the caller); only the noisy log
|
|
122
|
+
// is suppressed. Set CEF_DEBUG to restore full ddc-client error logging.
|
|
123
|
+
if (!process.env.CEF_DEBUG)
|
|
124
|
+
base.logErrors = false;
|
|
106
125
|
return base;
|
|
107
126
|
}
|
|
108
127
|
/**
|
|
109
|
-
*
|
|
128
|
+
* Throwaway substrate URI used to construct the DDC client in access-token
|
|
129
|
+
* mode. This key signs nothing that matters — the access token (minted by the
|
|
130
|
+
* bucket owner) is what authorizes every write; the storage node validates the
|
|
131
|
+
* token, not this identity. See {@link pushAgentVersion}.
|
|
132
|
+
*/
|
|
133
|
+
const ANON_SIGNER_URI = "//cef-push-anon";
|
|
134
|
+
/** Store raw bytes as a leaf `File` piece → `{cid, size}`. */
|
|
135
|
+
async function storeLeaf(client, ddc, bucketId, bytes, storeOpts) {
|
|
136
|
+
const file = new ddc.File(bytes, { size: bytes.length });
|
|
137
|
+
const uri = await client.store(bucketId, file, storeOpts);
|
|
138
|
+
return { cid: uri.cid, size: bytes.length };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Store one widget's flat file list as a directory DAG: each file → leaf piece,
|
|
142
|
+
* wrapped in a single `DagNode` whose links are the files' basenames. The
|
|
143
|
+
* content gateway then serves `<gateway>/<bucketId>/<dirCid>/<entry>` and the
|
|
144
|
+
* entry HTML's relative `./sibling.js` refs resolve by name under the dir CID.
|
|
145
|
+
*/
|
|
146
|
+
async function storeWidgetDir(client, ddc, bucketId, files, storeOpts) {
|
|
147
|
+
const links = [];
|
|
148
|
+
let total = 0;
|
|
149
|
+
for (const f of files) {
|
|
150
|
+
const { cid, size } = await storeLeaf(client, ddc, bucketId, f.bytes, storeOpts);
|
|
151
|
+
links.push(new ddc.Link(cid, size, f.name));
|
|
152
|
+
total += size;
|
|
153
|
+
}
|
|
154
|
+
const dirNode = new ddc.DagNode(null, links);
|
|
155
|
+
const dirUri = await client.store(bucketId, dirNode, storeOpts);
|
|
156
|
+
return { dirCid: dirUri.cid, size: total };
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Upload one agent version to DDC as a self-describing version node and
|
|
160
|
+
* (re)build the DAG hierarchy + CNS pointer around it.
|
|
110
161
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
162
|
+
* Order matters: the bundle and widgets are stored first so their CIDs can be
|
|
163
|
+
* stamped into the manifest (via `buildManifestBytes`); only then is the
|
|
164
|
+
* manifest leaf stored and the version node assembled — so the version node
|
|
165
|
+
* always contains the final, stamped manifest.
|
|
166
|
+
*
|
|
167
|
+
* Version node links: `bundle.js` (leaf), `manifest.json` (leaf), and — when
|
|
168
|
+
* the version has widgets — `widgets` (a directory DAG of per-widget dirs).
|
|
113
169
|
*/
|
|
114
|
-
export async function
|
|
170
|
+
export async function pushAgentVersion(input) {
|
|
115
171
|
const ddc = await loadDdc(input.ddcModuleImpl);
|
|
116
|
-
const { bucketId, agentName, version, bundleBytes } = input;
|
|
117
|
-
|
|
172
|
+
const { bucketId, agentName, version, bundleBytes, widgets = [] } = input;
|
|
173
|
+
// Authority for the writes comes from either the bucket owner's secret
|
|
174
|
+
// phrase or an access token minted by that owner. In token mode the client
|
|
175
|
+
// still needs *a* signer to construct, so we use a throwaway URI — the token
|
|
176
|
+
// (validated by the storage node) is what grants the writes, not this key.
|
|
177
|
+
const signer = new ddc.UriSigner(input.secretPhrase ?? ANON_SIGNER_URI);
|
|
118
178
|
const client = await ddc.DdcClient.create(signer, presetConfig(ddc, input));
|
|
179
|
+
const storeOpts = input.accessToken ? { accessToken: input.accessToken } : undefined;
|
|
119
180
|
try {
|
|
120
|
-
// Step 1: store the
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
181
|
+
// Step 1: store the bundle.js leaf.
|
|
182
|
+
const bundle = await storeLeaf(client, ddc, bucketId, bundleBytes, storeOpts);
|
|
183
|
+
// Step 2: store each widget directory DAG (leaf pieces + one DagNode).
|
|
184
|
+
const widgetDirs = [];
|
|
185
|
+
for (const w of widgets) {
|
|
186
|
+
const { dirCid, size } = await storeWidgetDir(client, ddc, bucketId, w.files, storeOpts);
|
|
187
|
+
widgetDirs.push({ id: w.id, dirCid, size, fileCount: w.files.length });
|
|
188
|
+
}
|
|
189
|
+
// Step 3: build the final manifest (bundle + widget CIDs stamped) and store it.
|
|
190
|
+
const manifestBytes = await input.buildManifestBytes({
|
|
191
|
+
bundleCid: bundle.cid,
|
|
192
|
+
widgets: widgetDirs.map((w) => ({ id: w.id, dirCid: w.dirCid, fileCount: w.fileCount })),
|
|
193
|
+
});
|
|
194
|
+
const manifest = await storeLeaf(client, ddc, bucketId, manifestBytes, storeOpts);
|
|
195
|
+
// Step 4: assemble the version node — bundle.js + manifest.json (+ widgets/).
|
|
196
|
+
const versionLinks = [
|
|
197
|
+
new ddc.Link(bundle.cid, bundle.size, VERSION_BUNDLE_NAME),
|
|
198
|
+
new ddc.Link(manifest.cid, manifest.size, VERSION_MANIFEST_NAME),
|
|
199
|
+
];
|
|
200
|
+
let widgetsCid = "";
|
|
201
|
+
if (widgetDirs.length > 0) {
|
|
202
|
+
const widgetLinks = widgetDirs.map((w) => new ddc.Link(w.dirCid, w.size, w.id));
|
|
203
|
+
const widgetsNode = new ddc.DagNode(null, widgetLinks);
|
|
204
|
+
const widgetsUri = await client.store(bucketId, widgetsNode, storeOpts);
|
|
205
|
+
widgetsCid = widgetsUri.cid;
|
|
206
|
+
const widgetsTotal = widgetDirs.reduce((n, w) => n + w.size, 0);
|
|
207
|
+
versionLinks.push(new ddc.Link(widgetsCid, widgetsTotal, VERSION_WIDGETS_NAME));
|
|
208
|
+
}
|
|
127
209
|
const versionNode = new ddc.DagNode(null, versionLinks);
|
|
128
|
-
const versionUri = await client.store(bucketId, versionNode);
|
|
210
|
+
const versionUri = await client.store(bucketId, versionNode, storeOpts);
|
|
129
211
|
const versionCid = versionUri.cid;
|
|
212
|
+
// Advisory size recorded on the record/dir links (metadata only).
|
|
213
|
+
const versionSize = bundle.size + manifest.size;
|
|
130
214
|
// Resolve the existing agents directory (if any) for read-modify-write.
|
|
215
|
+
// A brand-new bucket has no `agents` root yet, so the resolve throws
|
|
216
|
+
// `Cannot resolve CNS name: "agents"`; we treat the bucket as empty and
|
|
217
|
+
// Step 6 creates the root. Announce that case so the (now-silenced)
|
|
218
|
+
// ddc-client miss is not mistaken for a failure. Any other resolve error is
|
|
219
|
+
// likewise treated as "no directory here", matching prior behaviour.
|
|
131
220
|
let directoryCid = "";
|
|
132
221
|
try {
|
|
133
222
|
const resolved = await client.resolveName(bucketId, CNS_AGENTS_NAME);
|
|
134
223
|
directoryCid = resolved.toString();
|
|
135
224
|
}
|
|
136
|
-
catch {
|
|
225
|
+
catch (e) {
|
|
226
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
227
|
+
if (msg.includes("Cannot resolve CNS name")) {
|
|
228
|
+
console.log(` first push to bucket ${bucketId}: creating the "${CNS_AGENTS_NAME}" registry root`);
|
|
229
|
+
}
|
|
137
230
|
directoryCid = "";
|
|
138
231
|
}
|
|
139
|
-
// Step
|
|
140
|
-
//
|
|
232
|
+
// Step 5: per-agent record DAG — `<version>` + `latest` links. Read the
|
|
233
|
+
// existing record (via the directory) so we preserve other versions.
|
|
141
234
|
let existingRecordLinks = [];
|
|
142
235
|
let dirLinks = [];
|
|
143
236
|
if (directoryCid) {
|
|
@@ -147,24 +240,27 @@ export async function pushBundle(input) {
|
|
|
147
240
|
existingRecordLinks = await readLinks(client, bucketId, recordLink.cid);
|
|
148
241
|
}
|
|
149
242
|
}
|
|
150
|
-
let recordLinks = upsertLink(existingRecordLinks, ddc, version, versionCid,
|
|
151
|
-
recordLinks = upsertLink(recordLinks, ddc, "latest", versionCid,
|
|
243
|
+
let recordLinks = upsertLink(existingRecordLinks, ddc, version, versionCid, versionSize);
|
|
244
|
+
recordLinks = upsertLink(recordLinks, ddc, "latest", versionCid, versionSize);
|
|
152
245
|
const recordNode = new ddc.DagNode(null, recordLinks);
|
|
153
|
-
const recordUri = await client.store(bucketId, recordNode);
|
|
246
|
+
const recordUri = await client.store(bucketId, recordNode, storeOpts);
|
|
154
247
|
const recordCid = recordUri.cid;
|
|
155
|
-
// Step
|
|
156
|
-
//
|
|
157
|
-
const newDirLinks = upsertLink(dirLinks, ddc, agentName, recordCid,
|
|
248
|
+
// Step 6: agents directory DAG — upsert the agent's record link, then store
|
|
249
|
+
// WITH the CNS `name` option so the pointer is written atomically.
|
|
250
|
+
const newDirLinks = upsertLink(dirLinks, ddc, agentName, recordCid, versionSize);
|
|
158
251
|
const dirNode = new ddc.DagNode(null, newDirLinks);
|
|
159
252
|
const dirUri = await client.store(bucketId, dirNode, {
|
|
160
253
|
name: CNS_AGENTS_NAME,
|
|
254
|
+
...(storeOpts ?? {}),
|
|
161
255
|
});
|
|
162
|
-
const newDirectoryCid = dirUri.cid;
|
|
163
256
|
return {
|
|
164
|
-
leafCid,
|
|
257
|
+
leafCid: bundle.cid,
|
|
258
|
+
manifestCid: manifest.cid,
|
|
165
259
|
versionCid,
|
|
166
260
|
recordCid,
|
|
167
|
-
directoryCid:
|
|
261
|
+
directoryCid: dirUri.cid,
|
|
262
|
+
widgetsCid,
|
|
263
|
+
widgets: widgetDirs.map((w) => ({ id: w.id, dirCid: w.dirCid, fileCount: w.fileCount })),
|
|
168
264
|
};
|
|
169
265
|
}
|
|
170
266
|
finally {
|
package/dist/lib/ddc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddc.js","sourceRoot":"","sources":["../../src/lib/ddc.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ddc.js","sourceRoot":"","sources":["../../src/lib/ddc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,iFAAiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AAExC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AACrD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAC/C,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAwH9C;;;GAGG;AACH,KAAK,UAAU,OAAO,CAAC,QAAoB;IACzC,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAyB,CAAC;IAC5E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,0EAA0E;cACtE,oEAAoE;cACpE,qBAAqB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAA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AE,QAAQ,CAAC,GAAG;YACzB,UAAU;YACV,SAAS;YACT,YAAY,EAAE,MAAM,CAAC,GAAG;YACxB,UAAU;YACV,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;SACzF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
package/dist/lib.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* underlying command functions directly without going through the CLI
|
|
4
4
|
* binary. The CLI entry point (`./cli.ts`) wires these into commander.
|
|
5
5
|
*/
|
|
6
|
+
export { cefInit, detectPackageManager } from "./commands/init.js";
|
|
7
|
+
export type { CefInitOptions, CefInitResult, PackageManager, } from "./commands/init.js";
|
|
6
8
|
export { cefBuild } from "./commands/build.js";
|
|
7
9
|
export type { CefBuildOptions, CefBuildResult } from "./commands/build.js";
|
|
8
10
|
export { cefTypegen } from "./commands/typegen.js";
|
|
@@ -13,6 +15,8 @@ export { cefPublish } from "./commands/publish.js";
|
|
|
13
15
|
export type { CefPublishOptions, CefPublishResult, } from "./commands/publish.js";
|
|
14
16
|
export { cefPush } from "./commands/push.js";
|
|
15
17
|
export type { CefPushOptions, CefPushResult } from "./commands/push.js";
|
|
18
|
+
export { cefDeploy } from "./commands/deploy.js";
|
|
19
|
+
export type { CefDeployOptions, CefDeployResult } from "./commands/deploy.js";
|
|
16
20
|
export { cefKeypairGenerate } from "./commands/keypair.js";
|
|
17
21
|
export type { CefKeypairGenerateOptions, CefKeypairGenerateResult, } from "./commands/keypair.js";
|
|
18
22
|
export { resolveCredentials, CredentialsError, defaultCredentialsFilePath, } from "./lib/credentials.js";
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnE,YAAY,EACV,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
package/dist/lib.js
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* underlying command functions directly without going through the CLI
|
|
4
4
|
* binary. The CLI entry point (`./cli.ts`) wires these into commander.
|
|
5
5
|
*/
|
|
6
|
+
export { cefInit, detectPackageManager } from "./commands/init.js";
|
|
6
7
|
export { cefBuild } from "./commands/build.js";
|
|
7
8
|
export { cefTypegen } from "./commands/typegen.js";
|
|
8
9
|
export { cefInspect } from "./commands/inspect.js";
|
|
9
10
|
export { cefPublish } from "./commands/publish.js";
|
|
10
11
|
export { cefPush } from "./commands/push.js";
|
|
12
|
+
export { cefDeploy } from "./commands/deploy.js";
|
|
11
13
|
export { cefKeypairGenerate } from "./commands/keypair.js";
|
|
12
14
|
export { resolveCredentials, CredentialsError, defaultCredentialsFilePath, } from "./lib/credentials.js";
|
|
13
15
|
//# sourceMappingURL=lib.js.map
|
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAOnE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cef-ai/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"cef": "./dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"templates"
|
|
12
13
|
],
|
|
13
14
|
"publishConfig": {
|
|
14
15
|
"access": "public"
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"esbuild": "^0.21.0",
|
|
21
22
|
"json-schema-to-typescript": "^14.0.0",
|
|
22
23
|
"typescript": "^5.4.0",
|
|
23
|
-
"@cef-ai/agent-sdk": "1.
|
|
24
|
+
"@cef-ai/agent-sdk": "1.4.0",
|
|
24
25
|
"@cef-ai/transport": "1.0.0"
|
|
25
26
|
},
|
|
26
27
|
"optionalDependencies": {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# {{projectName}} — agent context
|
|
2
|
+
|
|
3
|
+
This is a **CEF agent** project. Agents are authored with `@cef-ai/agent-sdk`,
|
|
4
|
+
built/shipped with the `cef` CLI, and run on the Cere Agent Runtime.
|
|
5
|
+
|
|
6
|
+
## Dev loop
|
|
7
|
+
|
|
8
|
+
- `pnpm test` — run the agent test (`@cef-ai/testing`).
|
|
9
|
+
- `pnpm run build` — `cef build`: lint + bundle to `dist/<agentId>/`.
|
|
10
|
+
- `pnpm run push` — `cef push`: upload bundle + widgets to DDC. Needs a DDC bucket id,
|
|
11
|
+
a **registry access token minted in the ROC UI** (`--access-token` / `$CEF_DDC_ACCESS_TOKEN`),
|
|
12
|
+
and your AS pubkey (`--as-pubkey`) — both from ROC.
|
|
13
|
+
- `pnpm run deploy` — `cef deploy`: apply the `deployments/` folder to make a
|
|
14
|
+
version live/testable (incl. sandbox). Needs the platform `--endpoint`
|
|
15
|
+
(defaults to dev) + AS pubkey. **This — not publish — is what makes an agent run.**
|
|
16
|
+
- `pnpm run publish` — `cef publish`: **optional, last.** Lists the card in the
|
|
17
|
+
marketplace for discovery (needs AS credentials). Skip for debug/test.
|
|
18
|
+
|
|
19
|
+
## Structure
|
|
20
|
+
|
|
21
|
+
- `cef.config.ts` — declares id, cubbies, widgets.
|
|
22
|
+
- `src/agent.ts` — default-exported class; `@Engagement`, `@OnEvent`, `@OnStart`, `@OnClose`.
|
|
23
|
+
- `migrations/history/*.sql` — schema for the `history` cubby (used via `ctx.cubby`).
|
|
24
|
+
- `widgets/hello/` — a self-contained static widget.
|
|
25
|
+
- `deployments/*.jsonc` — deployment records (one per file, filename = name)
|
|
26
|
+
applied by `cef deploy`; `default.jsonc` is the required catch-all. `targeting`
|
|
27
|
+
(CEL over `vault.*`/`event.type`) + `priority`/`weight` express audiences / A-B.
|
|
28
|
+
- `test/agent.test.ts` — `testAgent` → dispatch an event → assert output.
|
|
29
|
+
|
|
30
|
+
## Runtime constraints (important)
|
|
31
|
+
|
|
32
|
+
- No Node built-ins (`fs`, `net`, `http`, `child_process`, …). Use the global
|
|
33
|
+
`fetch` for HTTP and `ctx.cubby` for state.
|
|
34
|
+
- Use `globalThis.crypto` (WebCrypto), not `node:crypto`.
|
|
35
|
+
- `@OnEvent("...")` and `ctx.publish("...")` take **string literals**.
|
|
36
|
+
- `ctx.cubby("alias")` must reference a cubby declared in `cef.config.ts`.
|
|
37
|
+
|
|
38
|
+
## Deeper guidance
|
|
39
|
+
|
|
40
|
+
The full authoring playbook lives in the `cef` Claude Code plugin
|
|
41
|
+
(`CEF-AI/cef-plugins`) — see `.claude/settings.json`, which auto-wires it.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Claude Code notes
|
|
4
|
+
|
|
5
|
+
- This project auto-wires the **`cef`** authoring plugin via
|
|
6
|
+
`.claude/settings.json`. When available, the `cef:develop` skill (authoring)
|
|
7
|
+
and `cef:deploy` skill (build → push → deploy) load automatically.
|
|
8
|
+
- If the plugin isn't installed, add it once:
|
|
9
|
+
`/plugin marketplace add CEF-AI/cef-plugins` then `/plugin install cef@cef`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
A hello-world **CEF agent** scaffolded by `cef init`. It has one engagement,
|
|
4
|
+
one cubby (SQLite state), one widget, and a passing test.
|
|
5
|
+
|
|
6
|
+
## Layout
|
|
7
|
+
|
|
8
|
+
- `cef.config.ts` — agent id, cubbies, widgets (read by the `cef` CLI).
|
|
9
|
+
- `src/agent.ts` — the agent class (`@Engagement` / `@OnEvent` / lifecycle).
|
|
10
|
+
- `migrations/history/` — SQL migrations for the `history` cubby.
|
|
11
|
+
- `widgets/hello/` — a self-contained widget.
|
|
12
|
+
- `deployments/` — deployment records (which version runs for which audience),
|
|
13
|
+
applied by `cef deploy`. `default.jsonc` is the required catch-all.
|
|
14
|
+
- `test/agent.test.ts` — a `@cef-ai/testing` test.
|
|
15
|
+
|
|
16
|
+
## Develop
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
pnpm test # run the agent test
|
|
20
|
+
pnpm run build # cef build → dist/<agentId>/{bundle.js,manifest.json}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Ship (build → push → deploy)
|
|
24
|
+
|
|
25
|
+
Each step and the external inputs it needs:
|
|
26
|
+
|
|
27
|
+
1. `pnpm run build` — no external inputs.
|
|
28
|
+
2. `pnpm run push` — uploads the bundle + widgets to DDC. Needs a **DDC bucket
|
|
29
|
+
id**, a **registry access token you mint in the ROC UI** (ROC → your Agent
|
|
30
|
+
Service → **Access** → generate token), and your **AS pubkey** (also shown
|
|
31
|
+
in ROC):
|
|
32
|
+
`cef push --bucket <id> --access-token <token> --as-pubkey <hex>`
|
|
33
|
+
(or set `$CEF_DDC_ACCESS_TOKEN`; see `cef push --help`).
|
|
34
|
+
3. `pnpm run deploy` — **makes a version live so you can run and test the agent**
|
|
35
|
+
(including in a sandbox). Applies the `deployments/` folder; edit those files
|
|
36
|
+
to target audiences or run A/B splits. Needs the platform `--endpoint`
|
|
37
|
+
(defaults to dev; `$CEF_ENDPOINT` to override) + your AS pubkey.
|
|
38
|
+
4. `pnpm run publish` — **optional, and last.** Lists the agent's card in the
|
|
39
|
+
marketplace for discovery (needs your **AS Ed25519 credentials** —
|
|
40
|
+
`cef keypair generate` if you don't have them). Skip it for debug/test/sandbox;
|
|
41
|
+
an agent runs because it's *deployed*, not because it's published.
|
|
42
|
+
|
|
43
|
+
## AI-assisted development (Claude Code)
|
|
44
|
+
|
|
45
|
+
This project auto-wires the **`cef`** authoring plugin via
|
|
46
|
+
`.claude/settings.json` — trust the folder and Claude Code installs it and
|
|
47
|
+
keeps it updated. To install it manually / at user scope:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/plugin marketplace add CEF-AI/cef-plugins
|
|
51
|
+
/plugin install cef@cef
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then just ask Claude to help build the agent — the `cef:develop` skill loads
|
|
55
|
+
automatically; `cef:deploy` walks you through shipping.
|