@anna-ai/cli 0.1.28 → 0.1.30
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/{_lifecycle-shared-BpSOfVCP.js → _lifecycle-shared-CUK2CE76.js} +1 -1
- package/dist/account-B6n0XkpV.js +30 -0
- package/dist/{agent-CaZVCPs6.js → agent-J2bELWfv.js} +1 -1
- package/dist/{app-bundle-upload-BhAYo6yj.js → app-bundle-upload-CPf_nGou.js} +2 -2
- package/dist/{app-cache-Bl7cE5fm.js → app-cache-BqnTkxUw.js} +1 -0
- package/dist/{apps-CCdtLmxQ.js → apps-73pdBAFE.js} +17 -1
- package/dist/{apps-3VcdHIBK.js → apps-BpJ-TvHP.js} +2 -2
- package/dist/{apps-cut-BOhg9RHy.js → apps-cut-C5SH9qZN.js} +11 -11
- package/dist/{apps-destructive-DWF4eTHn.js → apps-destructive-PY0wKjqu.js} +3 -3
- package/dist/{apps-discard-Dy3vzpCM.js → apps-discard-CfdkwUZ_.js} +11 -11
- package/dist/{apps-grants-DgvymPBT.js → apps-grants-BtXXiuJt.js} +2 -2
- package/dist/apps-publish-3wbhXfAg.js +14 -0
- package/dist/{apps-publish-Dgi4lBlu.js → apps-publish-B-ZVNmgn.js} +7 -7
- package/dist/{apps-push-DbUEFdCK.js → apps-push-Bh8zwT--.js} +12 -12
- package/dist/{apps-release-DJFG4BV3.js → apps-release-DNlN_8gz.js} +4 -4
- package/dist/apps-rename-slug-Bp-nQ_6I.js +62 -0
- package/dist/{apps-status-F6aVlzDW.js → apps-status-5DV9cY4A.js} +2 -2
- package/dist/{apps-submit-review-BVmZlhmB.js → apps-submit-review-DH-bzbDZ.js} +3 -3
- package/dist/{apps-sync-meta-CQQC_Heb.js → apps-sync-meta-DdPnXuIU.js} +4 -4
- package/dist/{apps-versions-BIKsJzIT.js → apps-versions-vGihRRje.js} +2 -2
- package/dist/bridge-CmoKMMcG.js +3 -0
- package/dist/{bundled-executas-DeBhDjd8.js → bundled-executas-06keEPP_.js} +1 -1
- package/dist/cli.js +61 -40
- package/dist/dev-C9VpI_AL.js +4 -0
- package/dist/{dev-DXODERsf.js → dev-aWkfWGLD.js} +5 -5
- package/dist/{dev-app-cache-TSjL4D4n.js → dev-app-cache-CP2P8SCZ.js} +1 -0
- package/dist/{doctor-DCsBgyRg.js → doctor-DnCYaREu.js} +1 -1
- package/dist/{executa-cache-Kx3rfQD-.js → executa-cache-B0O79Hpb.js} +1 -1
- package/dist/{executa-destructive-PL2ooHpZ.js → executa-destructive-8iSnfmcn.js} +3 -3
- package/dist/{executa-dev-Deo8ag5o.js → executa-dev-0XdBPTDy.js} +13 -10
- package/dist/{executa-install-BHQpOskj.js → executa-install-A-BgavhA.js} +2 -2
- package/dist/executa-install-Bc1WRrWu.js +7 -0
- package/dist/executa-publish-9XQRncyN.js +9 -0
- package/dist/{executa-publish-CkPAB34b.js → executa-publish-Xmm4DMO9.js} +4 -4
- package/dist/{executa-reads-CjGZq1yP.js → executa-reads-CjIr8BuD.js} +2 -2
- package/dist/{publish-BYWuujP3.js → publish-NTT1Libd.js} +10 -10
- package/dist/{sampling-BcML4teS.js → sampling-Cc0qaj8a.js} +92 -3
- package/dist/{server-F_VA-5tS.js → server-DtnMLKQS.js} +1 -1
- package/dist/{storage-CKTmE87u.js → storage-C95wApr2.js} +1 -1
- package/dist/{token-Cg7BZGp6.js → token-hGGfoge2.js} +1 -1
- package/dist/{working-orchestration-Pjm4YC_U.js → working-orchestration-CX0ONKIq.js} +30 -13
- package/package.json +1 -1
- package/dist/apps-publish-Do7M5je3.js +0 -14
- package/dist/bridge-6GIQG63S.js +0 -3
- package/dist/dev-CQkCFVXu.js +0 -4
- package/dist/executa-install-Bvf_Lvvg.js +0 -7
- package/dist/executa-publish-IXWSwva0.js +0 -9
- /package/dist/{bridge-DAY7bsje.js → bridge-DXH59CmP.js} +0 -0
- /package/dist/{bundled-executas-B6b8gIfp.js → bundled-executas-_H1A9M50.js} +0 -0
- /package/dist/{confirm-h_qMrx0I.js → confirm-BuT56E_B.js} +0 -0
- /package/dist/{dev-account-CGo8k9_2.js → dev-account-WXEjIE16.js} +0 -0
- /package/dist/{executa-cache-CXiEgFZY.js → executa-cache-Do1D7xC0.js} +0 -0
- /package/dist/{executa-init-DXea7yRN.js → executa-init-BCqJUZXT.js} +0 -0
- /package/dist/{executa-register-BUiPzPIU.js → executa-register-CMmlKyKB.js} +0 -0
- /package/dist/{executas-CK3er6f9.js → executas-BhFed1B-.js} +0 -0
- /package/dist/{fixture-BvP5umlN.js → fixture-BJqc1IfX.js} +0 -0
- /package/dist/{host_upload-BXeHTgJs.js → host_upload-sfo4UHlR.js} +0 -0
- /package/dist/{image-CSEXEfD-.js → image-Bdi4Hu0m.js} +0 -0
- /package/dist/{login-BGZjMAlh.js → login-CslsHbsq.js} +0 -0
- /package/dist/{logout-mh2_QlyM.js → logout-B4_b9ZL0.js} +0 -0
- /package/dist/{manifest-Bljz8Y6T.js → manifest-CMc7RM57.js} +0 -0
- /package/dist/{runner-BuYbm-ex.js → runner-DVu-o_U8.js} +0 -0
- /package/dist/{whoami-l_kIkfbI.js → whoami-ChzwOaN2.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import "./apps-
|
|
2
|
+
import "./apps-73pdBAFE.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import "./
|
|
5
|
-
import "./executas-
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
8
|
-
import "./
|
|
9
|
-
import
|
|
10
|
-
import "./app-cache-
|
|
11
|
-
import "./app-bundle-upload-
|
|
12
|
-
import { runAppsPublish } from "./apps-publish-
|
|
4
|
+
import { withErrorHandling } from "./_lifecycle-shared-CUK2CE76.js";
|
|
5
|
+
import "./bundled-executas-_H1A9M50.js";
|
|
6
|
+
import "./executas-BhFed1B-.js";
|
|
7
|
+
import "./executa-cache-Do1D7xC0.js";
|
|
8
|
+
import { runExecutaPublish } from "./executa-publish-Xmm4DMO9.js";
|
|
9
|
+
import "./manifest-CMc7RM57.js";
|
|
10
|
+
import "./app-cache-BqnTkxUw.js";
|
|
11
|
+
import "./app-bundle-upload-CPf_nGou.js";
|
|
12
|
+
import { runAppsPublish } from "./apps-publish-B-ZVNmgn.js";
|
|
13
13
|
import { resolve } from "node:path";
|
|
14
14
|
import { existsSync } from "node:fs";
|
|
15
15
|
import { 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 = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalHost, getAccount } from "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import { BridgeRequestError } from "./bridge-
|
|
2
|
+
import { BridgeRequestError } from "./bridge-DXH59CmP.js";
|
|
3
3
|
import { dirname, join, normalize, resolve } from "node:path";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createReadStream, existsSync, readFileSync, statSync, watch } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import { hostOf, requireAccount, withCode } from "./dev-account-
|
|
2
|
+
import { hostOf, requireAccount, withCode } from "./dev-account-WXEjIE16.js";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import "./client-D-_z1ALk.js";
|
|
3
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
3
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-CUK2CE76.js";
|
|
4
4
|
import { bold, cyan, dim, green, red, yellow } from "kleur/colors";
|
|
5
5
|
|
|
6
6
|
//#region src/api/tokens.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import { createApp, findAppBySlug, getApp } from "./apps-
|
|
2
|
+
import { createApp, findAppBySlug, getApp } from "./apps-73pdBAFE.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-
|
|
5
|
-
import { runExecutaPublish } from "./executa-publish-
|
|
6
|
-
import { loadExecutaManifest } from "./manifest-
|
|
7
|
-
import { runExecutaInstall } from "./executa-install-
|
|
8
|
-
import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-
|
|
4
|
+
import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-_H1A9M50.js";
|
|
5
|
+
import { runExecutaPublish } from "./executa-publish-Xmm4DMO9.js";
|
|
6
|
+
import { loadExecutaManifest } from "./manifest-CMc7RM57.js";
|
|
7
|
+
import { runExecutaInstall } from "./executa-install-A-BgavhA.js";
|
|
8
|
+
import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-BqnTkxUw.js";
|
|
9
9
|
import { join, resolve } from "node:path";
|
|
10
10
|
import { dim, green, yellow } from "kleur/colors";
|
|
11
11
|
import { homedir } from "node:os";
|
|
@@ -174,24 +174,40 @@ async function resolveAppIdentity(params) {
|
|
|
174
174
|
const found = await findAppBySlug(client, manifest.slug);
|
|
175
175
|
let appId;
|
|
176
176
|
let serverSlug;
|
|
177
|
+
let serverHandle;
|
|
177
178
|
let firstPublish = false;
|
|
178
179
|
if (found) {
|
|
179
180
|
appId = found.id;
|
|
180
181
|
serverSlug = found.slug;
|
|
182
|
+
serverHandle = typeof found.handle === "string" ? found.handle : void 0;
|
|
181
183
|
} else {
|
|
182
184
|
if (dryRun) {
|
|
183
185
|
if (!json) console.log(yellow(`[dry-run] would create AnnaApp slug=${manifest.slug}`));
|
|
184
186
|
return null;
|
|
185
187
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
let created;
|
|
189
|
+
try {
|
|
190
|
+
created = await createApp(client, {
|
|
191
|
+
slug: manifest.slug,
|
|
192
|
+
name: manifest.name,
|
|
193
|
+
category: manifest.category,
|
|
194
|
+
tagline: manifest.tagline,
|
|
195
|
+
description: manifest.description
|
|
196
|
+
});
|
|
197
|
+
} catch (e) {
|
|
198
|
+
if (e instanceof CliError && e.status === 409) {
|
|
199
|
+
const body = e.body;
|
|
200
|
+
const code = body?.detail?.code;
|
|
201
|
+
if (code === "HANDLE_REQUIRED") throw new CliError("you must set a developer handle before creating an app.\n Run: anna-app account set-handle <handle>\n Your apps will then publish as @<handle>/" + manifest.slug + ".", 5, {
|
|
202
|
+
status: 409,
|
|
203
|
+
body
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
throw e;
|
|
207
|
+
}
|
|
193
208
|
appId = created.id;
|
|
194
209
|
serverSlug = created.slug;
|
|
210
|
+
serverHandle = typeof created.handle === "string" ? created.handle : void 0;
|
|
195
211
|
firstPublish = true;
|
|
196
212
|
}
|
|
197
213
|
writeAppIdentity(cwd, {
|
|
@@ -199,6 +215,7 @@ async function resolveAppIdentity(params) {
|
|
|
199
215
|
host: canonicalHost(host),
|
|
200
216
|
app_id: appId,
|
|
201
217
|
slug: serverSlug,
|
|
218
|
+
handle: serverHandle,
|
|
202
219
|
first_published_at: cached?.first_published_at ?? new Date().toISOString()
|
|
203
220
|
});
|
|
204
221
|
return {
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import "./apps-CCdtLmxQ.js";
|
|
3
|
-
import "./client-D-_z1ALk.js";
|
|
4
|
-
import "./bundled-executas-B6b8gIfp.js";
|
|
5
|
-
import "./executas-CK3er6f9.js";
|
|
6
|
-
import "./executa-cache-CXiEgFZY.js";
|
|
7
|
-
import "./executa-publish-CkPAB34b.js";
|
|
8
|
-
import "./manifest-Bljz8Y6T.js";
|
|
9
|
-
import "./_lifecycle-shared-BpSOfVCP.js";
|
|
10
|
-
import "./app-cache-Bl7cE5fm.js";
|
|
11
|
-
import "./app-bundle-upload-BhAYo6yj.js";
|
|
12
|
-
import { runAppsPublish } from "./apps-publish-Dgi4lBlu.js";
|
|
13
|
-
|
|
14
|
-
export { runAppsPublish };
|
package/dist/bridge-6GIQG63S.js
DELETED
package/dist/dev-CQkCFVXu.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import "./client-D-_z1ALk.js";
|
|
3
|
-
import "./executas-CK3er6f9.js";
|
|
4
|
-
import "./executa-cache-CXiEgFZY.js";
|
|
5
|
-
import { runExecutaPublish } from "./executa-publish-CkPAB34b.js";
|
|
6
|
-
import "./manifest-Bljz8Y6T.js";
|
|
7
|
-
import "./_lifecycle-shared-BpSOfVCP.js";
|
|
8
|
-
|
|
9
|
-
export { runExecutaPublish };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|