@cef-ai/cli 0.2.7 → 0.3.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 +75 -1247
- package/dist/build/duration.d.ts +22 -0
- package/dist/build/duration.d.ts.map +1 -0
- package/dist/build/duration.js +44 -0
- package/dist/build/duration.js.map +1 -0
- package/dist/build/esbuild-plugin.d.ts +32 -0
- package/dist/build/esbuild-plugin.d.ts.map +1 -0
- package/dist/build/esbuild-plugin.js +53 -0
- package/dist/build/esbuild-plugin.js.map +1 -0
- package/dist/build/lints.d.ts +55 -0
- package/dist/build/lints.d.ts.map +1 -0
- package/dist/build/lints.js +214 -0
- package/dist/build/lints.js.map +1 -0
- package/dist/build/load-config.d.ts +114 -0
- package/dist/build/load-config.d.ts.map +1 -0
- package/dist/build/load-config.js +150 -0
- package/dist/build/load-config.js.map +1 -0
- package/dist/build/manifest.d.ts +156 -0
- package/dist/build/manifest.d.ts.map +1 -0
- package/dist/build/manifest.js +111 -0
- package/dist/build/manifest.js.map +1 -0
- package/dist/build/targeting.d.ts +15 -0
- package/dist/build/targeting.d.ts.map +1 -0
- package/dist/build/targeting.js +69 -0
- package/dist/build/targeting.js.map +1 -0
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +107 -62
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.d.ts +41 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +252 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/inspect.d.ts +49 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +135 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/typegen.d.ts +36 -0
- package/dist/commands/typegen.d.ts.map +1 -0
- package/dist/commands/typegen.js +210 -0
- package/dist/commands/typegen.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.d.ts +12 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +9 -0
- package/dist/lib.js.map +1 -0
- package/dist/typegen/augment.d.ts +57 -0
- package/dist/typegen/augment.d.ts.map +1 -0
- package/dist/typegen/augment.js +87 -0
- package/dist/typegen/augment.js.map +1 -0
- package/dist/typegen/fetch.d.ts +30 -0
- package/dist/typegen/fetch.d.ts.map +1 -0
- package/dist/typegen/fetch.js +38 -0
- package/dist/typegen/fetch.js.map +1 -0
- package/dist/typegen/lockfile.d.ts +42 -0
- package/dist/typegen/lockfile.d.ts.map +1 -0
- package/dist/typegen/lockfile.js +58 -0
- package/dist/typegen/lockfile.js.map +1 -0
- package/dist/typegen/schema-to-ts.d.ts +21 -0
- package/dist/typegen/schema-to-ts.d.ts.map +1 -0
- package/dist/typegen/schema-to-ts.js +29 -0
- package/dist/typegen/schema-to-ts.js.map +1 -0
- package/package.json +20 -58
- package/dist/commands/auth/index.d.ts +0 -2
- package/dist/commands/auth/index.js +0 -162
- package/dist/commands/deploy/clone.d.ts +0 -13
- package/dist/commands/deploy/clone.js +0 -143
- package/dist/commands/deploy/delete.d.ts +0 -14
- package/dist/commands/deploy/delete.js +0 -134
- package/dist/commands/deploy/deploy.d.ts +0 -24
- package/dist/commands/deploy/deploy.js +0 -654
- package/dist/commands/deploy/index.d.ts +0 -2
- package/dist/commands/deploy/index.js +0 -216
- package/dist/commands/deploy/status.d.ts +0 -14
- package/dist/commands/deploy/status.js +0 -61
- package/dist/commands/dev/index.d.ts +0 -2
- package/dist/commands/dev/index.js +0 -134
- package/dist/commands/dev/server.d.ts +0 -14
- package/dist/commands/dev/server.js +0 -195
- package/dist/commands/dev/static/app.js +0 -633
- package/dist/commands/dev/static/index.html +0 -205
- package/dist/commands/dev/static/static/app.js +0 -633
- package/dist/commands/dev/static/static/index.html +0 -205
- package/dist/commands/dev/static/static/style.css +0 -184
- package/dist/commands/dev/static/style.css +0 -184
- package/dist/commands/playground/index.d.ts +0 -2
- package/dist/commands/playground/index.js +0 -75
- package/dist/commands/playground/test.d.ts +0 -15
- package/dist/commands/playground/test.js +0 -166
- package/dist/commands/service/index.d.ts +0 -2
- package/dist/commands/service/index.js +0 -89
- package/dist/lib/api.d.ts +0 -146
- package/dist/lib/api.js +0 -330
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.js +0 -145
- package/dist/lib/credentials.d.ts +0 -19
- package/dist/lib/credentials.js +0 -68
- package/dist/lib/runtime/agent-router.d.ts +0 -12
- package/dist/lib/runtime/agent-router.js +0 -67
- package/dist/lib/runtime/context-builder.d.ts +0 -27
- package/dist/lib/runtime/context-builder.js +0 -166
- package/dist/lib/runtime/cubby-manager.d.ts +0 -20
- package/dist/lib/runtime/cubby-manager.js +0 -162
- package/dist/lib/runtime/index.d.ts +0 -51
- package/dist/lib/runtime/index.js +0 -181
- package/dist/lib/runtime/log-collector.d.ts +0 -17
- package/dist/lib/runtime/log-collector.js +0 -61
- package/dist/lib/runtime/stream-manager.d.ts +0 -10
- package/dist/lib/runtime/stream-manager.js +0 -77
- package/dist/lib/runtime/types.d.ts +0 -76
- package/dist/lib/runtime/types.js +0 -2
- package/dist/lib/transpile.d.ts +0 -1
- package/dist/lib/transpile.js +0 -9
- package/dist/lib/typecheck.d.ts +0 -31
- package/dist/lib/typecheck.js +0 -175
- package/dist/lib/types.d.ts +0 -246
- package/dist/lib/types.js +0 -2
- package/dist/lib/utils.d.ts +0 -4
- package/dist/lib/utils.js +0 -33
- package/example/.env.example +0 -6
- package/example/agents/object-detection/tasks/yolo.ts +0 -28
- package/example/agents/parking-violation-detector/tasks/detect.ts +0 -326
- package/example/cef.config.yaml +0 -91
- package/example/engagements/engagement.ts +0 -902
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* GET `<baseUrl>/<suffix>` and validate the response. Used by `cef typegen`
|
|
4
|
+
* to fetch model and peer-agent manifests declared in `cef.config.ts`.
|
|
5
|
+
*
|
|
6
|
+
* - Redirects are followed transparently (Node's built-in `fetch` does this
|
|
7
|
+
* by default with `redirect: "follow"`).
|
|
8
|
+
* - Content-Type is required to include `json` — anything else (HTML
|
|
9
|
+
* error page, plain text) is treated as a typegen failure rather than
|
|
10
|
+
* blindly trying to JSON.parse the bytes.
|
|
11
|
+
* - Non-2xx status codes throw with a `[cef typegen] fetch <url> → <status>`
|
|
12
|
+
* message so the CLI surfaces the failing URL to the author.
|
|
13
|
+
*/
|
|
14
|
+
export async function fetchJson(baseUrl, suffix) {
|
|
15
|
+
// `new URL(rel, base)` requires the base to end with `/` for the path to
|
|
16
|
+
// be appended rather than replacing the last segment.
|
|
17
|
+
const baseWithSlash = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
|
|
18
|
+
const url = new URL(suffix, baseWithSlash).href;
|
|
19
|
+
const res = await fetch(url, { redirect: "follow" });
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
throw new Error(`[cef typegen] fetch ${url} → ${res.status}`);
|
|
22
|
+
}
|
|
23
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
24
|
+
if (!ct.toLowerCase().includes("json")) {
|
|
25
|
+
throw new Error(`[cef typegen] fetch ${url} → non-JSON content-type "${ct}"`);
|
|
26
|
+
}
|
|
27
|
+
const body = await res.text();
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse(body);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
throw new Error(`[cef typegen] fetch ${url} → invalid JSON: ${err.message}`);
|
|
34
|
+
}
|
|
35
|
+
const integrity = "sha256-" + crypto.createHash("sha256").update(body).digest("base64");
|
|
36
|
+
return { body, parsed, resolvedUrl: res.url, integrity };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/typegen/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAmBjC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAe,EACf,MAAsC;IAEtC,yEAAyE;IACzE,sDAAsD;IACtD,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC;IACtE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC;IAEhD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,uBAAuB,GAAG,6BAA6B,EAAE,GAAG,CAC7D,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,uBAAuB,GAAG,oBAAqB,GAAa,CAAC,OAAO,EAAE,CACvE,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GACb,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAExE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cef.lock.json` schema, version 1.
|
|
3
|
+
*
|
|
4
|
+
* Modelled after the lockfile shape sketched in the SDK proposal: every
|
|
5
|
+
* fetched artefact (model spec, peer manifest) gets one entry keyed by the
|
|
6
|
+
* alias the user gave it in `cef.config.ts`. The entry records both the
|
|
7
|
+
* declared URL (which may carry a semver range like `agent@^1`) and the
|
|
8
|
+
* post-resolution / post-redirect URL the runtime should pin to.
|
|
9
|
+
*
|
|
10
|
+
* `integrity` is `sha256-<base64>` over the raw fetched bytes — same form
|
|
11
|
+
* Subresource Integrity uses, so existing tooling can validate it.
|
|
12
|
+
*/
|
|
13
|
+
export interface CefLockfile {
|
|
14
|
+
version: 1;
|
|
15
|
+
models: Record<string, LockEntry>;
|
|
16
|
+
uses: Record<string, LockEntry>;
|
|
17
|
+
}
|
|
18
|
+
export interface LockEntry {
|
|
19
|
+
/** URL exactly as declared in `cef.config.ts`. */
|
|
20
|
+
url: string;
|
|
21
|
+
/** Post-redirect / post-semver-resolution URL. */
|
|
22
|
+
resolvedUrl: string;
|
|
23
|
+
/** `sha256-<base64>` of the fetched body. */
|
|
24
|
+
integrity: string;
|
|
25
|
+
/** ISO 8601 timestamp at which the artefact was fetched. */
|
|
26
|
+
fetchedAt: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Read a lockfile from disk. Returns `null` if the file does not exist
|
|
30
|
+
* (first run) or fails to parse (corrupt — caller decides whether to
|
|
31
|
+
* regenerate or surface). The `version` field is verified; future format
|
|
32
|
+
* bumps will live behind explicit migration code rather than silently
|
|
33
|
+
* accepting older shapes.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readLockfile(path: string): Promise<CefLockfile | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Write the lockfile as pretty-printed, key-sorted JSON with a trailing
|
|
38
|
+
* newline. Sorted keys keep diffs stable across runs even when the
|
|
39
|
+
* iteration order of `models` / `uses` differs.
|
|
40
|
+
*/
|
|
41
|
+
export declare function writeLockfile(path: string, lock: CefLockfile): Promise<void>;
|
|
42
|
+
//# sourceMappingURL=lockfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../../src/typegen/lockfile.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAsB5E;AAeD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
/**
|
|
3
|
+
* Read a lockfile from disk. Returns `null` if the file does not exist
|
|
4
|
+
* (first run) or fails to parse (corrupt — caller decides whether to
|
|
5
|
+
* regenerate or surface). The `version` field is verified; future format
|
|
6
|
+
* bumps will live behind explicit migration code rather than silently
|
|
7
|
+
* accepting older shapes.
|
|
8
|
+
*/
|
|
9
|
+
export async function readLockfile(path) {
|
|
10
|
+
let raw;
|
|
11
|
+
try {
|
|
12
|
+
raw = await fs.readFile(path, "utf8");
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
if (err.code === "ENOENT")
|
|
16
|
+
return null;
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
19
|
+
let parsed;
|
|
20
|
+
try {
|
|
21
|
+
parsed = JSON.parse(raw);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (!parsed ||
|
|
27
|
+
typeof parsed !== "object" ||
|
|
28
|
+
parsed.version !== 1) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return parsed;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sort an object's keys for stable JSON output. We do this recursively for
|
|
35
|
+
* `models` / `uses` records so a re-run with no changes produces a
|
|
36
|
+
* byte-identical lockfile (good for diffs and content-addressing).
|
|
37
|
+
*/
|
|
38
|
+
function sortKeys(obj) {
|
|
39
|
+
const sorted = {};
|
|
40
|
+
for (const k of Object.keys(obj).sort()) {
|
|
41
|
+
sorted[k] = obj[k];
|
|
42
|
+
}
|
|
43
|
+
return sorted;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Write the lockfile as pretty-printed, key-sorted JSON with a trailing
|
|
47
|
+
* newline. Sorted keys keep diffs stable across runs even when the
|
|
48
|
+
* iteration order of `models` / `uses` differs.
|
|
49
|
+
*/
|
|
50
|
+
export async function writeLockfile(path, lock) {
|
|
51
|
+
const out = {
|
|
52
|
+
version: 1,
|
|
53
|
+
models: sortKeys(lock.models),
|
|
54
|
+
uses: sortKeys(lock.uses),
|
|
55
|
+
};
|
|
56
|
+
await fs.writeFile(path, JSON.stringify(out, null, 2) + "\n", "utf8");
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=lockfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockfile.js","sourceRoot":"","sources":["../../src/typegen/lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA+BlC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAClE,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,CAAC,MAAM;QACP,OAAO,MAAM,KAAK,QAAQ;QACzB,MAAgC,CAAC,OAAO,KAAK,CAAC,EAC/C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAqB,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAoC,GAAM;IACzD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAW,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,IAAiB;IAEjB,MAAM,GAAG,GAAgB;QACvB,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;QAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;KAC1B,CAAC;IACF,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile a JSON Schema into a TypeScript interface declaration string.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `json-schema-to-typescript`'s `compile` with the defaults the rest
|
|
5
|
+
* of the CLI assumes:
|
|
6
|
+
*
|
|
7
|
+
* - `bannerComment: ""` — we add our own banner once at the top of the
|
|
8
|
+
* generated file rather than per interface.
|
|
9
|
+
* - `additionalProperties: false` — typegen output should be strict by
|
|
10
|
+
* default; if a schema permits extra properties it can declare them
|
|
11
|
+
* itself with `additionalProperties: true`.
|
|
12
|
+
* - `format: false` — we already format the assembled output once at the
|
|
13
|
+
* end of `buildGeneratedDts`, so per-interface prettier passes are wasted
|
|
14
|
+
* work (and a perf cost on big schemas).
|
|
15
|
+
*
|
|
16
|
+
* Returns the raw output string (one or more `export interface` blocks,
|
|
17
|
+
* potentially with helper aliases for nested objects). Callers concatenate
|
|
18
|
+
* the returned strings into the final `.cef/generated.d.ts` body.
|
|
19
|
+
*/
|
|
20
|
+
export declare function schemaToTsInterface(name: string, schema: unknown): Promise<string>;
|
|
21
|
+
//# sourceMappingURL=schema-to-ts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-to-ts.d.ts","sourceRoot":"","sources":["../../src/typegen/schema-to-ts.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { compile } from "json-schema-to-typescript";
|
|
2
|
+
/**
|
|
3
|
+
* Compile a JSON Schema into a TypeScript interface declaration string.
|
|
4
|
+
*
|
|
5
|
+
* Wraps `json-schema-to-typescript`'s `compile` with the defaults the rest
|
|
6
|
+
* of the CLI assumes:
|
|
7
|
+
*
|
|
8
|
+
* - `bannerComment: ""` — we add our own banner once at the top of the
|
|
9
|
+
* generated file rather than per interface.
|
|
10
|
+
* - `additionalProperties: false` — typegen output should be strict by
|
|
11
|
+
* default; if a schema permits extra properties it can declare them
|
|
12
|
+
* itself with `additionalProperties: true`.
|
|
13
|
+
* - `format: false` — we already format the assembled output once at the
|
|
14
|
+
* end of `buildGeneratedDts`, so per-interface prettier passes are wasted
|
|
15
|
+
* work (and a perf cost on big schemas).
|
|
16
|
+
*
|
|
17
|
+
* Returns the raw output string (one or more `export interface` blocks,
|
|
18
|
+
* potentially with helper aliases for nested objects). Callers concatenate
|
|
19
|
+
* the returned strings into the final `.cef/generated.d.ts` body.
|
|
20
|
+
*/
|
|
21
|
+
export async function schemaToTsInterface(name, schema) {
|
|
22
|
+
const out = await compile(schema, name, {
|
|
23
|
+
bannerComment: "",
|
|
24
|
+
additionalProperties: false,
|
|
25
|
+
format: false,
|
|
26
|
+
});
|
|
27
|
+
return out.trim();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=schema-to-ts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-to-ts.js","sourceRoot":"","sources":["../../src/typegen/schema-to-ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,2BAA2B,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,MAAe;IAEf,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,MAAoB,EAAE,IAAI,EAAE;QACpD,aAAa,EAAE,EAAE;QACjB,oBAAoB,EAAE,KAAK;QAC3B,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,70 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cef-ai/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "CEF AI command-line interface",
|
|
3
|
+
"version": "0.3.0",
|
|
5
4
|
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
6
7
|
"bin": {
|
|
7
|
-
"cef": "dist/cli.js"
|
|
8
|
-
"cef-deploy": "dist/cli.js"
|
|
8
|
+
"cef": "./dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist
|
|
12
|
-
"README.md",
|
|
13
|
-
"example/agents",
|
|
14
|
-
"example/engagements",
|
|
15
|
-
"example/queries",
|
|
16
|
-
"example/.env.example",
|
|
17
|
-
"example/cef.config.yaml"
|
|
11
|
+
"dist"
|
|
18
12
|
],
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"url": "https://github.com/CEF-AI/deploy-sdk"
|
|
22
|
-
},
|
|
23
|
-
"homepage": "https://github.com/CEF-AI/deploy-sdk#readme",
|
|
24
|
-
"keywords": [
|
|
25
|
-
"cef",
|
|
26
|
-
"cef-ai",
|
|
27
|
-
"deploy",
|
|
28
|
-
"cli",
|
|
29
|
-
"cere"
|
|
30
|
-
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsc && cp -r src/commands/dev/static dist/commands/dev/static",
|
|
33
|
-
"prepublishOnly": "npm run build",
|
|
34
|
-
"test": "vitest run",
|
|
35
|
-
"test:watch": "vitest",
|
|
36
|
-
"test:coverage": "vitest run --coverage",
|
|
37
|
-
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
38
|
-
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
39
|
-
"typecheck": "tsc --noEmit",
|
|
40
|
-
"lint": "eslint src tests",
|
|
41
|
-
"dev": "tsx src/cli.ts"
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
42
15
|
},
|
|
43
16
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"esbuild": "^0.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"ora": "^9.3.0",
|
|
50
|
-
"sqlite-vec": "^0.1.9",
|
|
51
|
-
"typescript": "^5.4.5",
|
|
52
|
-
"ws": "^8.20.0",
|
|
53
|
-
"yaml": "^2.8.3"
|
|
17
|
+
"commander": "^12.0.0",
|
|
18
|
+
"esbuild": "^0.21.0",
|
|
19
|
+
"json-schema-to-typescript": "^14.0.0",
|
|
20
|
+
"typescript": "^5.4.0",
|
|
21
|
+
"@cef-ai/agent-sdk": "0.1.0"
|
|
54
22
|
},
|
|
55
23
|
"devDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"
|
|
58
|
-
"@types/node": "^20.14.0",
|
|
59
|
-
"@types/ws": "^8.18.1",
|
|
60
|
-
"@vitest/coverage-v8": "^4.1.0",
|
|
61
|
-
"eslint": "^9.15.0",
|
|
62
|
-
"tsx": "^4.15.7",
|
|
63
|
-
"typescript-eslint": "^8.15.0",
|
|
64
|
-
"vitest": "^4.1.0"
|
|
24
|
+
"@types/node": "^20.11.0",
|
|
25
|
+
"vitest": "^1.5.0"
|
|
65
26
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -b && chmod +x dist/cli.js",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"lint": "eslint src"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import http from 'http';
|
|
2
|
-
import { exec } from 'child_process';
|
|
3
|
-
import { saveCredentials, loadCredentials, clearCredentials, parseToken, getCredentialsPath, } from '../../lib/credentials.js';
|
|
4
|
-
const DEFAULT_ROB_URL = 'https://rob.compute.test.ddcdragon.com';
|
|
5
|
-
const LOGIN_TIMEOUT_MS = 300_000;
|
|
6
|
-
function openBrowser(url) {
|
|
7
|
-
const cmd = process.platform === 'darwin'
|
|
8
|
-
? `open "${url}"`
|
|
9
|
-
: process.platform === 'win32'
|
|
10
|
-
? `start "" "${url}"`
|
|
11
|
-
: `xdg-open "${url}"`;
|
|
12
|
-
exec(cmd, (err) => {
|
|
13
|
-
if (err) {
|
|
14
|
-
console.log(` Could not open browser automatically.`);
|
|
15
|
-
console.log(` Open this URL manually:\n ${url}\n`);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function saveAndPrint(token) {
|
|
20
|
-
const parsed = parseToken(token);
|
|
21
|
-
if (!parsed) {
|
|
22
|
-
console.error(' Error: Invalid token format. Expected: base64.base64.signature');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
const expiresAt = new Date(parsed.expiresAt).getTime();
|
|
26
|
-
if (expiresAt <= Date.now()) {
|
|
27
|
-
console.error(' Error: Token is already expired.');
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
saveCredentials({
|
|
31
|
-
email: parsed.email,
|
|
32
|
-
publicKey: parsed.publicKey,
|
|
33
|
-
token,
|
|
34
|
-
expiresAt: parsed.expiresAt,
|
|
35
|
-
});
|
|
36
|
-
const expiresIn = Math.round((expiresAt - Date.now()) / 3600000);
|
|
37
|
-
console.log(`\n Logged in as ${parsed.email}`);
|
|
38
|
-
console.log(` Token expires in ~${expiresIn}h`);
|
|
39
|
-
console.log(` Credentials saved to ${getCredentialsPath()}\n`);
|
|
40
|
-
}
|
|
41
|
-
function loginWithCallback(robUrl) {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
let port = 0;
|
|
44
|
-
const server = http.createServer((req, res) => {
|
|
45
|
-
// CORS preflight
|
|
46
|
-
if (req.method === 'OPTIONS') {
|
|
47
|
-
res.writeHead(204, {
|
|
48
|
-
'Access-Control-Allow-Origin': '*',
|
|
49
|
-
'Access-Control-Allow-Methods': 'POST',
|
|
50
|
-
'Access-Control-Allow-Headers': 'Content-Type',
|
|
51
|
-
});
|
|
52
|
-
res.end();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (req.method === 'POST' && req.url === '/callback') {
|
|
56
|
-
let body = '';
|
|
57
|
-
req.on('data', (chunk) => { body += chunk; });
|
|
58
|
-
req.on('end', () => {
|
|
59
|
-
try {
|
|
60
|
-
const { token } = JSON.parse(body);
|
|
61
|
-
if (!token)
|
|
62
|
-
throw new Error('Missing token');
|
|
63
|
-
res.writeHead(200, {
|
|
64
|
-
'Content-Type': 'application/json',
|
|
65
|
-
'Access-Control-Allow-Origin': '*',
|
|
66
|
-
});
|
|
67
|
-
res.end(JSON.stringify({ ok: true }));
|
|
68
|
-
saveAndPrint(token);
|
|
69
|
-
server.close();
|
|
70
|
-
resolve();
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
res.writeHead(400, {
|
|
74
|
-
'Content-Type': 'application/json',
|
|
75
|
-
'Access-Control-Allow-Origin': '*',
|
|
76
|
-
});
|
|
77
|
-
res.end(JSON.stringify({ error: 'Invalid request' }));
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
res.writeHead(404);
|
|
83
|
-
res.end();
|
|
84
|
-
});
|
|
85
|
-
server.on('error', (err) => {
|
|
86
|
-
reject(err);
|
|
87
|
-
});
|
|
88
|
-
server.listen(0, '127.0.0.1', () => {
|
|
89
|
-
const addr = server.address();
|
|
90
|
-
port = typeof addr === 'object' ? addr.port : 0;
|
|
91
|
-
const authUrl = `${robUrl}/#/cli-auth?port=${port}`;
|
|
92
|
-
console.log(`\n Opening browser for authentication...`);
|
|
93
|
-
console.log(` If the browser doesn't open, visit:\n ${authUrl}\n`);
|
|
94
|
-
console.log(` Waiting for login...`);
|
|
95
|
-
openBrowser(authUrl);
|
|
96
|
-
});
|
|
97
|
-
const timeout = setTimeout(() => {
|
|
98
|
-
server.close();
|
|
99
|
-
reject(new Error('Login timed out. Try again with: cef login'));
|
|
100
|
-
}, LOGIN_TIMEOUT_MS);
|
|
101
|
-
server.on('close', () => clearTimeout(timeout));
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async function handleLogin(opts) {
|
|
105
|
-
if (opts.token) {
|
|
106
|
-
saveAndPrint(opts.token);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
await loginWithCallback(DEFAULT_ROB_URL);
|
|
110
|
-
}
|
|
111
|
-
function handleLogout() {
|
|
112
|
-
const cleared = clearCredentials();
|
|
113
|
-
if (cleared) {
|
|
114
|
-
console.log('\n Logged out. Credentials cleared.\n');
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
console.log('\n Not logged in (no credentials found).\n');
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function handleWhoami() {
|
|
121
|
-
const creds = loadCredentials();
|
|
122
|
-
if (!creds) {
|
|
123
|
-
console.log('\n Not logged in. Run `cef login` to authenticate.\n');
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const expiresAt = new Date(creds.expiresAt);
|
|
127
|
-
const msLeft = expiresAt.getTime() - Date.now();
|
|
128
|
-
const hoursLeft = Math.max(0, Math.round(msLeft / 3600000));
|
|
129
|
-
const minutesLeft = Math.max(0, Math.round(msLeft / 60000));
|
|
130
|
-
console.log(`\n Email: ${creds.email}`);
|
|
131
|
-
console.log(` Public Key: ${creds.publicKey}`);
|
|
132
|
-
if (minutesLeft < 60) {
|
|
133
|
-
console.log(` Expires in: ${minutesLeft} minutes`);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
console.log(` Expires in: ~${hoursLeft} hours`);
|
|
137
|
-
}
|
|
138
|
-
console.log(` Stored at: ${getCredentialsPath()}\n`);
|
|
139
|
-
}
|
|
140
|
-
export function registerAuthCommands(program) {
|
|
141
|
-
program
|
|
142
|
-
.command('login')
|
|
143
|
-
.description('Authenticate with CEF platform')
|
|
144
|
-
.option('--token <token>', 'Manually provide a bearer token')
|
|
145
|
-
.action(async (opts) => {
|
|
146
|
-
try {
|
|
147
|
-
await handleLogin(opts);
|
|
148
|
-
}
|
|
149
|
-
catch (err) {
|
|
150
|
-
console.error(`\n Login failed: ${err.message}\n`);
|
|
151
|
-
process.exit(1);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
program
|
|
155
|
-
.command('logout')
|
|
156
|
-
.description('Clear stored credentials')
|
|
157
|
-
.action(() => handleLogout());
|
|
158
|
-
program
|
|
159
|
-
.command('whoami')
|
|
160
|
-
.description('Show current authentication status')
|
|
161
|
-
.action(() => handleWhoami());
|
|
162
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EnvConfig } from '../../lib/types.js';
|
|
2
|
-
export interface CloneOptions {
|
|
3
|
-
pubkey: string;
|
|
4
|
-
outputDir: string;
|
|
5
|
-
force: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface CloneResult {
|
|
8
|
-
entity: string;
|
|
9
|
-
name: string;
|
|
10
|
-
action: 'written' | 'skipped' | 'fetched';
|
|
11
|
-
file?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function runClone(env: EnvConfig, options: CloneOptions): Promise<CloneResult[]>;
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { stringify } from 'yaml';
|
|
4
|
-
import { createApiClient } from '../../lib/api.js';
|
|
5
|
-
import { toFileName, errorMessage } from '../../lib/utils.js';
|
|
6
|
-
function writeFileIfAllowed(filePath, content, force, allowedBase) {
|
|
7
|
-
if (allowedBase) {
|
|
8
|
-
const resolved = path.resolve(filePath);
|
|
9
|
-
const base = path.resolve(allowedBase);
|
|
10
|
-
if (!resolved.startsWith(base + path.sep) && resolved !== base) {
|
|
11
|
-
throw new Error(`Path traversal detected: ${filePath} escapes ${allowedBase}`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
if (fs.existsSync(filePath) && !force)
|
|
15
|
-
return 'skipped';
|
|
16
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
17
|
-
fs.writeFileSync(filePath, content, 'utf8');
|
|
18
|
-
return 'written';
|
|
19
|
-
}
|
|
20
|
-
async function safeFetch(label, fn) {
|
|
21
|
-
try {
|
|
22
|
-
return await fn();
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
console.warn(`Warning: Could not fetch ${label}: ${errorMessage(err)}`);
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export async function runClone(env, options) {
|
|
30
|
-
const { pubkey, outputDir, force } = options;
|
|
31
|
-
const api = createApiClient(env, pubkey);
|
|
32
|
-
const results = [];
|
|
33
|
-
// Fetch in parallel
|
|
34
|
-
const [engagementsRes, agentsRes, ontologyRes, cubbiesRes] = await Promise.all([
|
|
35
|
-
safeFetch('engagements', () => api.getEngagements()),
|
|
36
|
-
safeFetch('agents', () => api.getAgents()),
|
|
37
|
-
safeFetch('ontology', () => api.getOntology()),
|
|
38
|
-
safeFetch('cubbies', () => api.getCubbies()),
|
|
39
|
-
]);
|
|
40
|
-
const allAgents = agentsRes?.data ?? [];
|
|
41
|
-
const engagements = engagementsRes?.data ?? [];
|
|
42
|
-
// Separate concierge agents from user agents
|
|
43
|
-
const conciergeMap = new Map(allAgents.filter(a => a.isConcierge).map(a => [a.agentId, a]));
|
|
44
|
-
const userAgents = allAgents.filter(a => !a.isConcierge);
|
|
45
|
-
// ─── Write engagement files ────────────────────────────────────────────
|
|
46
|
-
const engagementConfigs = engagements.map(eng => {
|
|
47
|
-
const concierge = conciergeMap.get(eng.conciergeAgentId);
|
|
48
|
-
const tsCode = concierge?.tasks[0]?.tsCode ?? '';
|
|
49
|
-
let fileName = `${toFileName(eng.name)}.ts`;
|
|
50
|
-
if (fileName === 'unknown.ts')
|
|
51
|
-
fileName = `unknown-${eng.engagementId}.ts`;
|
|
52
|
-
const relPath = `./engagements/${fileName}`;
|
|
53
|
-
const absPath = path.join(outputDir, 'engagements', fileName);
|
|
54
|
-
if (tsCode) {
|
|
55
|
-
const action = writeFileIfAllowed(absPath, tsCode, force, outputDir);
|
|
56
|
-
results.push({ entity: 'engagement', name: eng.name, action, file: relPath });
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
name: eng.name,
|
|
60
|
-
description: eng.description || undefined,
|
|
61
|
-
engagementId: eng.engagementId,
|
|
62
|
-
file: relPath,
|
|
63
|
-
version: eng.version || '1.0.0',
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
// ─── Write agent task files ────────────────────────────────────────────
|
|
67
|
-
const agentConfigs = userAgents.map(agent => {
|
|
68
|
-
const tasks = agent.tasks.map(task => {
|
|
69
|
-
let taskFileName = `${toFileName(task.alias)}.ts`;
|
|
70
|
-
if (taskFileName === 'unknown.ts')
|
|
71
|
-
taskFileName = `unknown-${task.id}.ts`;
|
|
72
|
-
const relPath = `./agents/${agent.alias}/tasks/${taskFileName}`;
|
|
73
|
-
const absPath = path.join(outputDir, 'agents', agent.alias, 'tasks', taskFileName);
|
|
74
|
-
if (task.tsCode) {
|
|
75
|
-
const action = writeFileIfAllowed(absPath, task.tsCode, force, outputDir);
|
|
76
|
-
results.push({ entity: 'agent-task', name: `${agent.name}/${task.name}`, action, file: relPath });
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
name: task.name,
|
|
80
|
-
alias: task.alias,
|
|
81
|
-
file: relPath,
|
|
82
|
-
parameters: task.parameters,
|
|
83
|
-
returns: task.returns,
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
name: agent.name,
|
|
88
|
-
alias: agent.alias,
|
|
89
|
-
description: agent.description || undefined,
|
|
90
|
-
agentId: agent.agentId,
|
|
91
|
-
version: agent.version || '1.0.0',
|
|
92
|
-
tasks,
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
// ─── Map ontology to workspace config ──────────────────────────────────
|
|
96
|
-
const workspaceConfigs = ontologyRes?.workspaces?.map(ws => ({
|
|
97
|
-
name: ws.name,
|
|
98
|
-
description: ws.description || undefined,
|
|
99
|
-
workspaceId: ws.workspaceId,
|
|
100
|
-
streams: ws.streams?.map(s => ({
|
|
101
|
-
name: s.name,
|
|
102
|
-
description: s.description || undefined,
|
|
103
|
-
streamId: s.streamId,
|
|
104
|
-
selectors: s.selectors?.length ? s.selectors : undefined,
|
|
105
|
-
deployments: s.deployments?.map(d => ({
|
|
106
|
-
name: d.name,
|
|
107
|
-
description: d.description || undefined,
|
|
108
|
-
deploymentId: d.deploymentId,
|
|
109
|
-
engagement: d.engagements?.[0]?.name ?? '',
|
|
110
|
-
isActive: d.isActive,
|
|
111
|
-
triggers: d.triggers?.length ? d.triggers : undefined,
|
|
112
|
-
})),
|
|
113
|
-
})),
|
|
114
|
-
}));
|
|
115
|
-
// ─── Map remote cubbies to config ───────────────────────────────────────
|
|
116
|
-
const remoteCubbies = cubbiesRes ?? [];
|
|
117
|
-
const cubbyConfigs = remoteCubbies.map(cubby => ({
|
|
118
|
-
alias: cubby.alias,
|
|
119
|
-
name: cubby.name,
|
|
120
|
-
description: cubby.description || undefined,
|
|
121
|
-
cubbyId: cubby.cubbyId,
|
|
122
|
-
migrations: cubby.migrations,
|
|
123
|
-
maxSizeBytes: cubby.maxSizeBytes,
|
|
124
|
-
idleTimeout: cubby.idleTimeout,
|
|
125
|
-
}));
|
|
126
|
-
// ─── Build config ──────────────────────────────────────────────────────
|
|
127
|
-
const config = {
|
|
128
|
-
agentServicePubKey: pubkey,
|
|
129
|
-
};
|
|
130
|
-
if (engagementConfigs.length)
|
|
131
|
-
config.engagements = engagementConfigs;
|
|
132
|
-
if (agentConfigs.length)
|
|
133
|
-
config.agents = agentConfigs;
|
|
134
|
-
if (cubbyConfigs.length)
|
|
135
|
-
config.cubbies = cubbyConfigs;
|
|
136
|
-
if (workspaceConfigs && workspaceConfigs.length)
|
|
137
|
-
config.workspaces = workspaceConfigs;
|
|
138
|
-
// Write config file (respects --force)
|
|
139
|
-
const configPath = path.join(outputDir, 'cef.config.yaml');
|
|
140
|
-
const configAction = writeFileIfAllowed(configPath, stringify(config), force);
|
|
141
|
-
results.push({ entity: 'config', name: 'cef.config.yaml', action: configAction, file: configPath });
|
|
142
|
-
return results;
|
|
143
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ResolvedConfig } from '../../lib/types.js';
|
|
2
|
-
export interface DeleteResult {
|
|
3
|
-
entity: string;
|
|
4
|
-
name: string;
|
|
5
|
-
id: string;
|
|
6
|
-
action: 'deleted' | 'skipped' | 'failed';
|
|
7
|
-
error?: string;
|
|
8
|
-
}
|
|
9
|
-
interface DeleteOptions {
|
|
10
|
-
only?: string;
|
|
11
|
-
force?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare function runDelete(resolved: ResolvedConfig, options: DeleteOptions): Promise<DeleteResult[]>;
|
|
14
|
-
export {};
|