@anna-ai/cli 0.1.27 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apps-cut-DKl5I9bf.js → apps-cut-BOhg9RHy.js} +3 -3
- package/dist/{apps-discard-zg1nu2HN.js → apps-discard-Dy3vzpCM.js} +3 -3
- package/dist/{apps-push-C1-QDzF8.js → apps-push-DbUEFdCK.js} +3 -3
- package/dist/cli.js +8 -7
- package/dist/dev-CQkCFVXu.js +4 -0
- package/dist/{dev-DGTtVCNj.js → dev-DXODERsf.js} +1 -1
- package/dist/{executa-dev-BOo6xpVy.js → executa-dev-DEpBrEIH.js} +7 -4
- package/dist/{executa-install-BGirXLX5.js → executa-install-BHQpOskj.js} +1 -1
- package/dist/executa-install-Bvf_Lvvg.js +7 -0
- package/dist/{sampling-BcML4teS.js → sampling-DwV7VPfT.js} +92 -3
- package/dist/{server-D7zabdJY.js → server-F_VA-5tS.js} +2 -1
- package/dist/{working-orchestration-Dh1gCwGg.js → working-orchestration-Pjm4YC_U.js} +1 -1
- package/package.json +1 -1
- package/dist/dev-DVCIv8mJ.js +0 -4
- package/dist/executa-install-Cuq0Y_H4.js +0 -7
|
@@ -8,10 +8,10 @@ import "./executa-cache-CXiEgFZY.js";
|
|
|
8
8
|
import "./executa-publish-CkPAB34b.js";
|
|
9
9
|
import "./manifest-Bljz8Y6T.js";
|
|
10
10
|
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-BpSOfVCP.js";
|
|
11
|
-
import "./dev-
|
|
12
|
-
import "./executa-install-
|
|
11
|
+
import "./dev-DXODERsf.js";
|
|
12
|
+
import "./executa-install-BHQpOskj.js";
|
|
13
13
|
import "./app-cache-Bl7cE5fm.js";
|
|
14
|
-
import { resolveAppBySlugOrCache } from "./working-orchestration-
|
|
14
|
+
import { resolveAppBySlugOrCache } from "./working-orchestration-Pjm4YC_U.js";
|
|
15
15
|
import { resolve } from "node:path";
|
|
16
16
|
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
17
17
|
|
|
@@ -8,10 +8,10 @@ import "./executa-cache-CXiEgFZY.js";
|
|
|
8
8
|
import "./executa-publish-CkPAB34b.js";
|
|
9
9
|
import "./manifest-Bljz8Y6T.js";
|
|
10
10
|
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-BpSOfVCP.js";
|
|
11
|
-
import "./dev-
|
|
12
|
-
import "./executa-install-
|
|
11
|
+
import "./dev-DXODERsf.js";
|
|
12
|
+
import "./executa-install-BHQpOskj.js";
|
|
13
13
|
import "./app-cache-Bl7cE5fm.js";
|
|
14
|
-
import { resolveAppBySlugOrCache } from "./working-orchestration-
|
|
14
|
+
import { resolveAppBySlugOrCache } from "./working-orchestration-Pjm4YC_U.js";
|
|
15
15
|
import { dim, green, yellow } from "kleur/colors";
|
|
16
16
|
|
|
17
17
|
//#region src/commands/apps-discard.ts
|
|
@@ -8,10 +8,10 @@ import "./executa-cache-CXiEgFZY.js";
|
|
|
8
8
|
import { bumpVersion, bundleHash, manifestHash, rewriteVersion } from "./executa-publish-CkPAB34b.js";
|
|
9
9
|
import { loadAppManifest } from "./manifest-Bljz8Y6T.js";
|
|
10
10
|
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-BpSOfVCP.js";
|
|
11
|
-
import "./dev-
|
|
12
|
-
import "./executa-install-
|
|
11
|
+
import "./dev-DXODERsf.js";
|
|
12
|
+
import "./executa-install-BHQpOskj.js";
|
|
13
13
|
import "./app-cache-Bl7cE5fm.js";
|
|
14
|
-
import { installLocalBundledShims, resolveAppIdentity, resolveBundledExecutas } from "./working-orchestration-
|
|
14
|
+
import { installLocalBundledShims, resolveAppIdentity, resolveBundledExecutas } from "./working-orchestration-Pjm4YC_U.js";
|
|
15
15
|
import { isExistingDir, uploadWorkingBundle } from "./app-bundle-upload-BhAYo6yj.js";
|
|
16
16
|
import { resolve } from "node:path";
|
|
17
17
|
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
package/dist/cli.js
CHANGED
|
@@ -470,7 +470,7 @@ program.command("validate").description("Run schema + ACL checks on a manifest+b
|
|
|
470
470
|
process.exit(code);
|
|
471
471
|
});
|
|
472
472
|
program.command("dev").description("Run a local harness (in-process dispatcher + iframe + SSE relay)").option("--manifest <path>", "manifest.json path", "manifest.json").option("--bundle <dir>", "bundle directory (default: ./bundle)").option("--slug <slug>", "App slug (overrides manifest.slug/name)").option("--view <name>", "View name to open (default: manifest default)").option("--matrix-nexus-root <path>", "matrix-nexus checkout (auto-detected if omitted; can also use $ANNA_NEXUS_ROOT)").option("--port <number>", "HTTP port", "5180").option("--user-id <id>", "Harness user_id", "1").option("--cwd <dir>", "Project root (default: cwd)").option("--no-watch", "Disable bundle file watcher (default: enabled)").option("--executa <spec>", "Explicit executa registration; repeatable. Spec: comma-separated key=value (dir=<path>[,tool_id=<id>][,type=python|node|go|binary][,command=\"<argv>\"]). When only `dir=` is given, the executa is auto-detected from executa.json / pyproject.toml / package.json / go.mod. Overrides directory auto-discovery under <manifest-dir>/executas/.", (val, prev) => prev ? [...prev, val] : [val]).option("--no-llm", "Disable LLM bridge (anna.llm/agent return llm_disabled)").option("--mock-llm <fixture>", "Serve canned LLM responses from a JSONL fixture").option("--llm-account <host>", "Saved account host to use (default: current)").option("--llm-app-slug <slug>", "Override the manifest slug used to register / look up the dev AnnaApp (default: manifest.slug)").option("--storage <mode>", "Storage backend: \"legacy\" (in-memory runtime_state, default) or \"aps\" (real nexus APS via /api/v1/storage/* — requires `anna-app login`).", "legacy").action(async (opts) => {
|
|
473
|
-
const { runDev, parseExecutaSpec } = await import("./dev-
|
|
473
|
+
const { runDev, parseExecutaSpec } = await import("./dev-CQkCFVXu.js");
|
|
474
474
|
const cwd = opts.cwd ?? process.cwd();
|
|
475
475
|
let executas;
|
|
476
476
|
if (opts.executa && opts.executa.length > 0) {
|
|
@@ -582,7 +582,7 @@ executa.command("register").description("Register a HARNESS AnnaApp(kind=executa
|
|
|
582
582
|
process.exit(code);
|
|
583
583
|
});
|
|
584
584
|
executa.command("install").description("Install a local-dev shim for an Executa under its minted tool_id so the Agent can discover it via 'Rediscover Local' (for distribution_type: local). Resolves the tool_id from .anna/executa.json (written by `executa publish` / `apps push`) unless --tool-id is given.").option("--dir <path>", "Executa project dir (default: CWD)").option("--tool-id <id>", "Install the shim under this exact id (default: minted id from .anna/executa.json, else executa.json tool_id)").option("--bin-dir <path>", "Install dir for the shim (default: ~/.anna/executa/bin)").option("--force", "Overwrite an existing shim of the same name", false).option("--json", "Emit machine-readable JSON", false).action(async (opts) => {
|
|
585
|
-
const { runExecutaInstall } = await import("./executa-install-
|
|
585
|
+
const { runExecutaInstall } = await import("./executa-install-Bvf_Lvvg.js");
|
|
586
586
|
const code = await runExecutaInstall({
|
|
587
587
|
dir: opts.dir,
|
|
588
588
|
toolId: opts.toolId,
|
|
@@ -592,8 +592,8 @@ executa.command("install").description("Install a local-dev shim for an Executa
|
|
|
592
592
|
});
|
|
593
593
|
process.exit(code);
|
|
594
594
|
});
|
|
595
|
-
executa.command("dev").description("Run one Executa plugin in isolation (REPL or one-shot describe/invoke)").option("--dir <path>", "Executa project dir (default: CWD)").option("--spec <spec>", "Override discovery: comma-separated key=value (tool_id=...,type=...,command=\"...\")").option("--describe", "Print MANIFEST and exit", false).option("--health", "Print health and exit", false).option("--invoke <tool>", "Invoke one tool and exit").option("--args <json>", "JSON object passed as tool arguments", "{}").option("--json", "One-shot: emit compact JSON (no banners)", false).option("--no-sampling", "Hard-disable sampling reverse RPC (returns sampling_disabled)").option("--mock-sampling <fixture>", "Serve canned sampling responses from a JSONL fixture (offline)").option("--app-slug <slug>", "Forward sampling to nexus on behalf of this dev AnnaApp slug").option("--sampling-account <host>", "Saved account host for nexus sampling (default: current)").option("--no-agent", "Hard-disable agent reverse RPC (returns agent_not_granted)").option("--mock-agent <fixture>", "Serve canned agent/* responses from a JSONL fixture (offline)").option("--agent-account <host>", "Saved account host for nexus agent (default: --sampling-account or current)").option("--storage <mode>", "Storage backend: off | memory | mock | real (default: memory)").option("--mock-storage <fixture>", "Serve canned storage/* + files/* responses from a JSONL fixture").option("--storage-account <host>", "Saved account host for nexus storage (default: --sampling-account or current)").option("--storage-scopes <list>", "Comma-separated scopes for real storage tokens (default: user,app,tool)").option("--no-image", "Hard-disable image reverse RPC (returns image_not_granted)").option("--mock-image <fixture>", "Serve canned image/generate + image/edit responses from a JSONL fixture").option("--image-account <host>", "Saved account host for nexus image (default: --sampling-account or current)").option("--no-upload", "Hard-disable host/uploadFile reverse RPC (returns upload_not_granted)").option("--mock-upload <fixture>", "Serve canned host/uploadFile responses from a JSONL fixture").option("--upload-account <host>", "Saved account host for nexus uploads (default: --sampling-account or current)").action(async (opts) => {
|
|
596
|
-
const { runExecutaDev } = await import("./executa-dev-
|
|
595
|
+
executa.command("dev").description("Run one Executa plugin in isolation (REPL or one-shot describe/invoke)").option("--dir <path>", "Executa project dir (default: CWD)").option("--spec <spec>", "Override discovery: comma-separated key=value (tool_id=...,type=...,command=\"...\")").option("--describe", "Print MANIFEST and exit", false).option("--health", "Print health and exit", false).option("--invoke <tool>", "Invoke one tool and exit").option("--args <json>", "JSON object passed as tool arguments", "{}").option("--json", "One-shot: emit compact JSON (no banners)", false).option("--no-sampling", "Hard-disable sampling reverse RPC (returns sampling_disabled)").option("--mock-sampling <fixture>", "Serve canned sampling responses from a JSONL fixture (offline)").option("--sampling-unsupported-format", "Simulate a model without json_schema support — exercises responseFormat onUnsupported branches (-32010 / downgrade)").option("--app-slug <slug>", "Forward sampling to nexus on behalf of this dev AnnaApp slug").option("--sampling-account <host>", "Saved account host for nexus sampling (default: current)").option("--no-agent", "Hard-disable agent reverse RPC (returns agent_not_granted)").option("--mock-agent <fixture>", "Serve canned agent/* responses from a JSONL fixture (offline)").option("--agent-account <host>", "Saved account host for nexus agent (default: --sampling-account or current)").option("--storage <mode>", "Storage backend: off | memory | mock | real (default: memory)").option("--mock-storage <fixture>", "Serve canned storage/* + files/* responses from a JSONL fixture").option("--storage-account <host>", "Saved account host for nexus storage (default: --sampling-account or current)").option("--storage-scopes <list>", "Comma-separated scopes for real storage tokens (default: user,app,tool)").option("--no-image", "Hard-disable image reverse RPC (returns image_not_granted)").option("--mock-image <fixture>", "Serve canned image/generate + image/edit responses from a JSONL fixture").option("--image-account <host>", "Saved account host for nexus image (default: --sampling-account or current)").option("--no-upload", "Hard-disable host/uploadFile reverse RPC (returns upload_not_granted)").option("--mock-upload <fixture>", "Serve canned host/uploadFile responses from a JSONL fixture").option("--upload-account <host>", "Saved account host for nexus uploads (default: --sampling-account or current)").action(async (opts) => {
|
|
596
|
+
const { runExecutaDev } = await import("./executa-dev-DEpBrEIH.js");
|
|
597
597
|
const storageMode = opts.storage === void 0 ? void 0 : (() => {
|
|
598
598
|
const m = opts.storage;
|
|
599
599
|
if (m === "off" || m === "memory" || m === "mock" || m === "real") return m;
|
|
@@ -610,6 +610,7 @@ executa.command("dev").description("Run one Executa plugin in isolation (REPL or
|
|
|
610
610
|
json: opts.json,
|
|
611
611
|
noSampling: opts.sampling === false,
|
|
612
612
|
mockSampling: opts.mockSampling,
|
|
613
|
+
samplingUnsupportedFormat: opts.samplingUnsupportedFormat,
|
|
613
614
|
appSlug: opts.appSlug,
|
|
614
615
|
samplingAccount: opts.samplingAccount,
|
|
615
616
|
noAgent: opts.agent === false,
|
|
@@ -678,7 +679,7 @@ apps.command("push").description("Upsert the mutable working draft (manifest + b
|
|
|
678
679
|
process.exit(2);
|
|
679
680
|
}
|
|
680
681
|
}
|
|
681
|
-
const { runAppsPush } = await import("./apps-push-
|
|
682
|
+
const { runAppsPush } = await import("./apps-push-DbUEFdCK.js");
|
|
682
683
|
process.exit(await runAppsPush({
|
|
683
684
|
cwd: opts.cwd,
|
|
684
685
|
manifest: opts.manifest,
|
|
@@ -697,7 +698,7 @@ apps.command("push").description("Upsert the mutable working draft (manifest + b
|
|
|
697
698
|
}));
|
|
698
699
|
});
|
|
699
700
|
apps.command("cut <version>").description("Snapshot the working draft into an immutable version (freeze deps)").option("--changelog <text>", "Override the working draft changelog for this version").option("--slug <slug>", "App slug (default: resolve from .anna/app.json cache)").option("--cwd <dir>", "Project root for identity cache (default: cwd)").option("--dry-run", "Resolve target but don't cut", false).option("--account <host>", "Saved account host (default: current)").option("--json", "Emit machine-readable JSON", false).action(async (version, opts) => {
|
|
700
|
-
const { runAppsCut } = await import("./apps-cut-
|
|
701
|
+
const { runAppsCut } = await import("./apps-cut-BOhg9RHy.js");
|
|
701
702
|
process.exit(await runAppsCut({
|
|
702
703
|
version,
|
|
703
704
|
changelog: opts.changelog,
|
|
@@ -709,7 +710,7 @@ apps.command("cut <version>").description("Snapshot the working draft into an im
|
|
|
709
710
|
}));
|
|
710
711
|
});
|
|
711
712
|
apps.command("discard").description("Drop the mutable working draft (leaves cut versions intact)").option("--slug <slug>", "App slug (default: resolve from .anna/app.json cache)").option("--cwd <dir>", "Project root for identity cache (default: cwd)").option("--dry-run", "Resolve target but don't discard", false).option("--account <host>", "Saved account host (default: current)").option("--json", "Emit machine-readable JSON", false).action(async (opts) => {
|
|
712
|
-
const { runAppsDiscard } = await import("./apps-discard-
|
|
713
|
+
const { runAppsDiscard } = await import("./apps-discard-Dy3vzpCM.js");
|
|
713
714
|
process.exit(await runAppsDiscard({
|
|
714
715
|
slug: opts.slug,
|
|
715
716
|
cwd: opts.cwd,
|
|
@@ -50,7 +50,7 @@ async function runDev(opts) {
|
|
|
50
50
|
process.env.ANNA_APP_RUNTIME_STORAGE_MODE = "aps";
|
|
51
51
|
}
|
|
52
52
|
const { PythonBridge, PINNED_RUNTIME_VERSION } = await import("./bridge-6GIQG63S.js");
|
|
53
|
-
const { HarnessServer } = await import("./server-
|
|
53
|
+
const { HarnessServer } = await import("./server-F_VA-5tS.js");
|
|
54
54
|
const bridge = new PythonBridge({
|
|
55
55
|
mode,
|
|
56
56
|
matrixNexusRoot: matrixNexusRoot ?? void 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./nexus-root-BlPwOusj.js";
|
|
2
|
-
import { parseExecutaSpec } from "./dev-
|
|
2
|
+
import { parseExecutaSpec } from "./dev-DXODERsf.js";
|
|
3
3
|
import { isAbsolute, resolve } from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { bold, cyan, dim, green, red, yellow } from "kleur/colors";
|
|
@@ -57,14 +57,17 @@ async function runExecutaDev(opts) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
const { SamplingBridge } = await import("./sampling-
|
|
60
|
+
const { SamplingBridge } = await import("./sampling-DwV7VPfT.js");
|
|
61
|
+
const simulateUnsupportedResponseFormat = opts.samplingUnsupportedFormat;
|
|
61
62
|
const sampling = opts.noSampling ? new SamplingBridge({ mode: "off" }) : opts.mockSampling ? new SamplingBridge({
|
|
62
63
|
mode: "mock",
|
|
63
|
-
mockFile: opts.mockSampling
|
|
64
|
+
mockFile: opts.mockSampling,
|
|
65
|
+
simulateUnsupportedResponseFormat
|
|
64
66
|
}) : effectiveAppSlug ? new SamplingBridge({
|
|
65
67
|
mode: "real",
|
|
66
68
|
account: opts.samplingAccount,
|
|
67
|
-
appSlug: effectiveAppSlug
|
|
69
|
+
appSlug: effectiveAppSlug,
|
|
70
|
+
simulateUnsupportedResponseFormat
|
|
68
71
|
}) : new SamplingBridge({ mode: "off" });
|
|
69
72
|
const { AgentBridge } = await import("./agent-CaZVCPs6.js");
|
|
70
73
|
const agent = opts.noAgent ? new AgentBridge({ mode: "off" }) : opts.mockAgent ? new AgentBridge({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readExecutaIdentity } from "./executa-cache-CXiEgFZY.js";
|
|
2
|
-
import { parseExecutaSpec } from "./dev-
|
|
2
|
+
import { parseExecutaSpec } from "./dev-DXODERsf.js";
|
|
3
3
|
import { isAbsolute, join, resolve } from "node:path";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { bold, cyan, dim, green, red, yellow } from "kleur/colors";
|
|
@@ -20,8 +20,43 @@ var SamplingBridge = class {
|
|
|
20
20
|
}
|
|
21
21
|
async createMessage(req) {
|
|
22
22
|
if (this.opts.mode === "off") throw withCode(new Error("sampling disabled — rerun without `--no-sampling`"), -32008);
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
validateResponseFormat(req);
|
|
24
|
+
const { effective, downgraded } = this.negotiateResponseFormat(req);
|
|
25
|
+
const result = this.opts.mode === "mock" ? this.mockMessage(req) : await this.realMessage(req, effective);
|
|
26
|
+
if (req.responseFormat) result._meta = {
|
|
27
|
+
...result._meta ?? {},
|
|
28
|
+
responseFormat: {
|
|
29
|
+
requested: req.responseFormat.type,
|
|
30
|
+
applied: effective?.type ?? null,
|
|
31
|
+
structuredValid: isParseableJson(result.content?.text),
|
|
32
|
+
downgraded
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Local stand-in for the nexus gate's capability negotiation. With
|
|
39
|
+
* `simulateUnsupportedResponseFormat` the bridge behaves like a model
|
|
40
|
+
* without `supports_structured_output`; otherwise everything is
|
|
41
|
+
* "supported" (mock fixtures decide what comes back anyway).
|
|
42
|
+
*/
|
|
43
|
+
negotiateResponseFormat(req) {
|
|
44
|
+
let effective = req.responseFormat;
|
|
45
|
+
let downgraded = false;
|
|
46
|
+
if (effective?.type === "json_schema" && this.opts.simulateUnsupportedResponseFormat) {
|
|
47
|
+
const on = req.onUnsupported ?? "error";
|
|
48
|
+
if (on === "error") {
|
|
49
|
+
const err = withCode(new Error("model 'mock-model' does not support json_schema response format (simulated)"), -32010);
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
if (on === "json_object") effective = { type: "json_object" };
|
|
53
|
+
else effective = void 0;
|
|
54
|
+
downgraded = true;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
effective,
|
|
58
|
+
downgraded
|
|
59
|
+
};
|
|
25
60
|
}
|
|
26
61
|
mockMessage(req) {
|
|
27
62
|
const content = collectContent(req);
|
|
@@ -69,10 +104,11 @@ var SamplingBridge = class {
|
|
|
69
104
|
};
|
|
70
105
|
return this.cachedSession;
|
|
71
106
|
}
|
|
72
|
-
async realMessage(req) {
|
|
107
|
+
async realMessage(req, effectiveResponseFormat) {
|
|
73
108
|
const acc = this.account();
|
|
74
109
|
const session = await this.mint();
|
|
75
110
|
const body = mcpToCompleteBody(req);
|
|
111
|
+
if (effectiveResponseFormat) body.response_format = effectiveResponseFormat;
|
|
76
112
|
const res = await fetch(`${canonicalHost(acc.host)}/api/v1/copilot/app/complete`, {
|
|
77
113
|
method: "POST",
|
|
78
114
|
headers: {
|
|
@@ -93,6 +129,59 @@ function withCode(err, code) {
|
|
|
93
129
|
err.rpcCode = code;
|
|
94
130
|
return err;
|
|
95
131
|
}
|
|
132
|
+
const RF_TYPES = new Set(["json_object", "json_schema"]);
|
|
133
|
+
const RF_ON_UNSUPPORTED = new Set([
|
|
134
|
+
"error",
|
|
135
|
+
"json_object",
|
|
136
|
+
"text"
|
|
137
|
+
]);
|
|
138
|
+
const RF_MAX_SCHEMA_BYTES = 32 * 1024;
|
|
139
|
+
const RF_MAX_SCHEMA_DEPTH = 8;
|
|
140
|
+
const RF_MAX_SCHEMA_NODES = 512;
|
|
141
|
+
const RF_NAME_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
142
|
+
function invalid(message) {
|
|
143
|
+
return withCode(new Error(message), -32004);
|
|
144
|
+
}
|
|
145
|
+
/** Same hard limits the platform enforces — local dev fails identically. */
|
|
146
|
+
function validateResponseFormat(req) {
|
|
147
|
+
const on = req.onUnsupported;
|
|
148
|
+
if (on != null && !RF_ON_UNSUPPORTED.has(on)) throw invalid(`'onUnsupported' must be one of ${[...RF_ON_UNSUPPORTED].sort().join(", ")}`);
|
|
149
|
+
const rf = req.responseFormat;
|
|
150
|
+
if (rf == null) return;
|
|
151
|
+
if (typeof rf !== "object" || Array.isArray(rf)) throw invalid("'responseFormat' must be an object");
|
|
152
|
+
if (!RF_TYPES.has(rf.type)) throw invalid(`responseFormat.type must be one of ${[...RF_TYPES].sort().join(", ")}`);
|
|
153
|
+
if (rf.type === "json_schema") {
|
|
154
|
+
const js = rf.json_schema;
|
|
155
|
+
if (js == null || typeof js !== "object" || Array.isArray(js)) throw invalid("responseFormat.json_schema must be an object");
|
|
156
|
+
if (typeof js.name !== "string" || !RF_NAME_RE.test(js.name)) throw invalid("json_schema.name must match ^[a-zA-Z0-9_-]{1,64}$");
|
|
157
|
+
if (js.strict !== void 0 && typeof js.strict !== "boolean") throw invalid("json_schema.strict must be a bool");
|
|
158
|
+
const schema = js.schema;
|
|
159
|
+
if (schema == null || typeof schema !== "object" || Array.isArray(schema)) throw invalid("json_schema.schema must be an object");
|
|
160
|
+
enforceSchemaLimits(schema);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function enforceSchemaLimits(schema) {
|
|
164
|
+
const raw = JSON.stringify(schema);
|
|
165
|
+
if (Buffer.byteLength(raw, "utf8") > RF_MAX_SCHEMA_BYTES) throw invalid(`json_schema.schema too large (> ${RF_MAX_SCHEMA_BYTES} bytes)`);
|
|
166
|
+
let nodes = 0;
|
|
167
|
+
const walk = (node, depth) => {
|
|
168
|
+
if (depth > RF_MAX_SCHEMA_DEPTH) throw invalid(`json_schema nesting too deep (> ${RF_MAX_SCHEMA_DEPTH})`);
|
|
169
|
+
nodes += 1;
|
|
170
|
+
if (nodes > RF_MAX_SCHEMA_NODES) throw invalid(`json_schema too many nodes (> ${RF_MAX_SCHEMA_NODES})`);
|
|
171
|
+
if (Array.isArray(node)) for (const v of node) walk(v, depth + 1);
|
|
172
|
+
else if (node !== null && typeof node === "object") for (const v of Object.values(node)) walk(v, depth + 1);
|
|
173
|
+
};
|
|
174
|
+
walk(schema, 0);
|
|
175
|
+
}
|
|
176
|
+
function isParseableJson(text) {
|
|
177
|
+
if (typeof text !== "string") return false;
|
|
178
|
+
try {
|
|
179
|
+
JSON.parse(text);
|
|
180
|
+
return true;
|
|
181
|
+
} catch {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
96
185
|
/** Collect a single string view of a sampling request — used for mock matching. */
|
|
97
186
|
function collectContent(req) {
|
|
98
187
|
const parts = [];
|
|
@@ -187,7 +187,8 @@ var LlmBridge = class {
|
|
|
187
187
|
fixed_client_id: args.fixed_client_id ?? args.fixedClientId ?? null,
|
|
188
188
|
app_slug: slug,
|
|
189
189
|
label: args.label ?? "anna-app dev",
|
|
190
|
-
quota_caps: args.quotaCaps ?? null
|
|
190
|
+
quota_caps: args.quotaCaps ?? null,
|
|
191
|
+
system_prompt: args.systemPrompt ?? args.system_prompt ?? null
|
|
191
192
|
};
|
|
192
193
|
const minted = await this.callMint(acc.host, body);
|
|
193
194
|
const ms = {
|
|
@@ -4,7 +4,7 @@ import { CliError } from "./client-D-_z1ALk.js";
|
|
|
4
4
|
import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-B6b8gIfp.js";
|
|
5
5
|
import { runExecutaPublish } from "./executa-publish-CkPAB34b.js";
|
|
6
6
|
import { loadExecutaManifest } from "./manifest-Bljz8Y6T.js";
|
|
7
|
-
import { runExecutaInstall } from "./executa-install-
|
|
7
|
+
import { runExecutaInstall } from "./executa-install-BHQpOskj.js";
|
|
8
8
|
import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-Bl7cE5fm.js";
|
|
9
9
|
import { join, resolve } from "node:path";
|
|
10
10
|
import { dim, green, yellow } from "kleur/colors";
|
package/package.json
CHANGED
package/dist/dev-DVCIv8mJ.js
DELETED