@anna-ai/cli 0.1.49 → 0.1.51

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.
Files changed (62) hide show
  1. package/dist/{account-CPnwqXeh.js → account-C-IeQNNr.js} +1 -1
  2. package/dist/{agent-DAOr_aiE.js → agent-CX2VzG7e.js} +1 -1
  3. package/dist/{apps-HbfURK6y.js → apps-BRBufSyX.js} +1 -41
  4. package/dist/{apps-CzqMRLbS.js → apps-CTIiH6a_.js} +1 -1
  5. package/dist/apps-cut-35wivw1Z.js +19 -0
  6. package/dist/{apps-cut-BhTJwILv.js → apps-cut-L7T8b5RS.js} +20 -22
  7. package/dist/{apps-destructive-PlaU93EX.js → apps-destructive-DcG3T1Mx.js} +2 -2
  8. package/dist/{apps-discard-CFi-GzpU.js → apps-discard-CKA_m7Yw.js} +7 -7
  9. package/dist/{apps-grants-DqaX8UTy.js → apps-grants-B5MpWhSO.js} +1 -1
  10. package/dist/apps-publish-CGfzN7tI.js +92 -0
  11. package/dist/apps-publish-CUJILNOt.js +22 -0
  12. package/dist/apps-push-BcYNGSYx.js +20 -0
  13. package/dist/{app-bundle-upload-Ca0r-kPy.js → apps-push-d1C0eePp.js} +144 -69
  14. package/dist/{apps-release-DGQv6DDl.js → apps-release-DxRHjEYJ.js} +2 -2
  15. package/dist/{apps-rename-slug-CCEU_7JJ.js → apps-rename-slug-4_5lsDwg.js} +2 -2
  16. package/dist/{apps-status-C4Cxc2DF.js → apps-status-hMrRz356.js} +1 -1
  17. package/dist/{apps-submit-review--hZFZRJ3.js → apps-submit-review-CxoKgexX.js} +1 -1
  18. package/dist/{apps-sync-meta-DnFwFNl5.js → apps-sync-meta-BwN8g6TO.js} +3 -3
  19. package/dist/{apps-versions-C7NzG5Dk.js → apps-versions-gfG_sBFv.js} +1 -1
  20. package/dist/{bridge-sFHqOOat.js → bridge-Bo8eu3-d.js} +1 -1
  21. package/dist/bridge-nv-le8ff.js +3 -0
  22. package/dist/cli.js +45 -45
  23. package/dist/{dev-Bfv3WQC0.js → dev-BB1oS-1o.js} +4 -4
  24. package/dist/dev-DAkNdyJ-.js +4 -0
  25. package/dist/{doctor-CHnkbamq.js → doctor-qFe9sXxR.js} +1 -1
  26. package/dist/{executa-destructive-Du7RGJgn.js → executa-destructive-C06mgvfJ.js} +1 -1
  27. package/dist/{executa-dev-DYO87dzg.js → executa-dev-ONm9di1H.js} +8 -8
  28. package/dist/executa-install-DKMwLq-V.js +7 -0
  29. package/dist/{executa-install-DAposiBw.js → executa-install-n1oRAoYJ.js} +1 -1
  30. package/dist/{executa-publish-BKnsUoZq.js → executa-publish-BuakG1RK.js} +38 -11
  31. package/dist/{executa-publish-6awuH4Ma.js → executa-publish-CVlMaHIY.js} +3 -3
  32. package/dist/{executa-upload-binaries-FWM2yXfB.js → executa-upload-binaries-BVWs6MFF.js} +2 -2
  33. package/dist/{executa-upload-binaries-DwWQ18Dq.js → executa-upload-binaries-D0JWYOtK.js} +1 -1
  34. package/dist/{listing-meta-DgweMStT.js → listing-meta-rIni8tjd.js} +1 -1
  35. package/dist/{manifest-B_DjigtQ.js → manifest-BCHiC184.js} +49 -3
  36. package/dist/{publish-D5O5JKRb.js → publish-CIaosgo4.js} +13 -10
  37. package/dist/{server-Dr_htFv8.js → server-poDjwty-.js} +1 -1
  38. package/dist/{storage-aii8EyPC.js → storage-CZ4c4ibf.js} +1 -1
  39. package/dist/{working-orchestration-CpBJLs50.js → working-orchestration-BRU7FV-b.js} +9 -5
  40. package/package.json +3 -3
  41. package/dist/apps-publish-4IIbF2xr.js +0 -17
  42. package/dist/apps-publish-8N9x4VEM.js +0 -272
  43. package/dist/apps-push-CnSeLwdo.js +0 -152
  44. package/dist/bridge-BP28T06H.js +0 -3
  45. package/dist/dev-CnDh2_7r.js +0 -4
  46. package/dist/executa-install-LaAOSkY0.js +0 -7
  47. /package/dist/{confirm-ChZAVrZe.js → confirm-DplLyBSG.js} +0 -0
  48. /package/dist/{dev-account-CfVdGa9j.js → dev-account-IrYL4u4F.js} +0 -0
  49. /package/dist/{dev-app-cache-Dw2JESld.js → dev-app-cache-CScRa7c3.js} +0 -0
  50. /package/dist/{executa-init-DKy7DMSD.js → executa-init-BM0HR-K7.js} +0 -0
  51. /package/dist/{executa-reads-BYKUADoL.js → executa-reads-BJpmB-B1.js} +0 -0
  52. /package/dist/{executa-register-CmqKsoAU.js → executa-register-CDKG3L5c.js} +0 -0
  53. /package/dist/{executa-trusted-publisher-BGqz6hMt.js → executa-trusted-publisher-n9IbAO5D.js} +0 -0
  54. /package/dist/{fixture-BF1Z0Rry.js → fixture-CizypXzX.js} +0 -0
  55. /package/dist/{host_upload-CW_2Fxg6.js → host_upload-BvzJZKAO.js} +0 -0
  56. /package/dist/{image-B4UrufYH.js → image-C61zRJC8.js} +0 -0
  57. /package/dist/{login-DbETuUxy.js → login-BleVDjXE.js} +0 -0
  58. /package/dist/{logout-BzIEf-HU.js → logout-BO4brBaY.js} +0 -0
  59. /package/dist/{runner-Dq3cluPM.js → runner-aq0n-pdr.js} +0 -0
  60. /package/dist/{sampling-BpJcd6BC.js → sampling-BQwF3O-4.js} +0 -0
  61. /package/dist/{token-TgBQumgy.js → token-DeAZLyVz.js} +0 -0
  62. /package/dist/{whoami-Bn38ns8r.js → whoami-rvVc_nQ9.js} +0 -0
@@ -2,9 +2,9 @@ import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
2
  import { CliError } from "./client-sMzq2PWG.js";
3
3
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
4
4
  import { executaCacheMatches, invalidateExecutaCache, mintIdempotencyKey, readExecutaIdentity, writeExecutaIdentity } from "./executa-cache-BFoUtb4J.js";
5
- import { loadExecutaManifest } from "./manifest-B_DjigtQ.js";
5
+ import { loadExecutaManifest, protocolHostCapabilities } from "./manifest-BCHiC184.js";
6
6
  import { commitDraft, createDraft, getMySkill, getMyTool, listToolVersions, publishToolVersion, setSkillVisibility, setToolVisibility, updateMySkill, updateMyTool } from "./executas-CvQY_w2U.js";
7
- import { uploadExecutaBinaries } from "./executa-upload-binaries-DwWQ18Dq.js";
7
+ import { uploadExecutaBinaries } from "./executa-upload-binaries-D0JWYOtK.js";
8
8
  import { join, relative, resolve, sep } from "node:path";
9
9
  import { readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
10
10
  import { bold, cyan, dim, green, yellow } from "kleur/colors";
@@ -169,7 +169,8 @@ async function runExecutaPublish(opts) {
169
169
  executa_type: manifest.executa_type,
170
170
  slug: manifest.slug,
171
171
  version: manifest.version,
172
- ...distributionPayload(manifest.distribution)
172
+ ...distributionPayload(manifest.distribution),
173
+ ...manifest.protocolManifest ? { manifest_cache: manifest.protocolManifest } : {}
173
174
  };
174
175
  if (manifest.executa_type === "skill") {
175
176
  finalPayload.skill_content = manifest.skillContent;
@@ -202,12 +203,22 @@ async function runExecutaPublish(opts) {
202
203
  version: manifest.version,
203
204
  ...manifest.executionMode ? { skill_execution_mode: manifest.executionMode } : {}
204
205
  });
205
- else await updateMyTool(client, executaId, {
206
- name: manifest.name,
207
- description: manifest.description,
208
- version: manifest.version,
209
- ...distributionPayload(manifest.distribution)
210
- });
206
+ else {
207
+ await updateMyTool(client, executaId, {
208
+ name: manifest.name,
209
+ description: manifest.description,
210
+ version: manifest.version,
211
+ ...distributionPayload(manifest.distribution),
212
+ ...manifest.protocolManifest ? { manifest_cache: manifest.protocolManifest } : {}
213
+ });
214
+ if (!opts.json && !opts.quiet) {
215
+ if (manifest.protocolManifest && manifest.protocolManifestPath) {
216
+ const caps = protocolHostCapabilities(manifest.protocolManifest);
217
+ const capsNote = caps.length > 0 ? `${caps.length} host capabilit${caps.length === 1 ? "y" : "ies"}: ${caps.join(", ")}` : "no host_capabilities declared";
218
+ console.log(dim(` synced protocol manifest (${capsNote}) from ${manifest.protocolManifestPath.replace(cwd + "/", "")}`));
219
+ } else if (manifest.distribution) console.log(yellow("! no protocol manifest found (no `manifest.json` next to executa.json, no `manifest_file` field) — host-capability permissions (host.upload / aps.* / llm.* / web.*) declared by the plugin will NOT be grantable in the Executa permissions UI until an agent-side describe backfills them. Export the plugin's describe manifest to manifest.json and re-publish."));
220
+ }
221
+ }
211
222
  if (!isSkill && manifest.distribution?.binaryArtifacts && opts.freeze !== false) {
212
223
  const upLog = (msg) => {
213
224
  if (!opts.json && !opts.quiet) console.log(msg);
@@ -254,7 +265,10 @@ async function runExecutaPublish(opts) {
254
265
  first_publish: firstPublish,
255
266
  published_public: publishedToPublic,
256
267
  visibility: finalExecuta.visibility ?? null,
257
- latest_version_id: latest?.id ?? null
268
+ latest_version_id: latest?.id ?? null,
269
+ executa_type: manifest.executa_type,
270
+ manifest_synced: Boolean(manifest.protocolManifest),
271
+ host_capabilities: protocolHostCapabilities(manifest.protocolManifest)
258
272
  };
259
273
  opts.capture?.(result);
260
274
  if (opts.quiet) return 0;
@@ -270,6 +284,19 @@ async function runExecutaPublish(opts) {
270
284
  return 0;
271
285
  });
272
286
  }
287
+ /**
288
+ * One-line protocol-manifest sync note for a bundled `executa publish`
289
+ * result, printed by the `apps publish` / `apps push` orchestration
290
+ * (the nested publish itself runs `quiet`). `null` → nothing to print.
291
+ */
292
+ function manifestSyncNote(r) {
293
+ if (r.executa_type !== "tool") return null;
294
+ if (r.manifest_synced) {
295
+ const caps = r.host_capabilities;
296
+ return dim(" protocol manifest synced (" + (caps.length > 0 ? `host capabilities: ${caps.join(", ")}` : "no host_capabilities declared") + ")");
297
+ }
298
+ return yellow(" ! no protocol manifest for this bundled executa — add manifest.json (the plugin's describe response) next to its executa.json so declared host capabilities (host.upload / aps.* / llm.* / web.*) become grantable in the Executa permissions UI");
299
+ }
273
300
 
274
301
  //#endregion
275
- export { bumpVersion, bundleHash, canonicalize, manifestHash, rewriteVersion, runExecutaPublish };
302
+ export { bumpVersion, bundleHash, canonicalize, manifestHash, manifestSyncNote, rewriteVersion, runExecutaPublish };
@@ -2,10 +2,10 @@ import "./credentials-BTv2IfUZ.js";
2
2
  import "./client-sMzq2PWG.js";
3
3
  import "./_lifecycle-shared-_9BzQ9Y2.js";
4
4
  import "./executa-cache-BFoUtb4J.js";
5
- import "./manifest-B_DjigtQ.js";
5
+ import "./manifest-BCHiC184.js";
6
6
  import "./executas-CvQY_w2U.js";
7
- import { runExecutaPublish } from "./executa-publish-BKnsUoZq.js";
7
+ import { manifestSyncNote, runExecutaPublish } from "./executa-publish-BuakG1RK.js";
8
8
  import "./binary-upload-DVhQ0uY0.js";
9
- import "./executa-upload-binaries-DwWQ18Dq.js";
9
+ import "./executa-upload-binaries-D0JWYOtK.js";
10
10
 
11
11
  export { runExecutaPublish };
@@ -2,8 +2,8 @@ import "./credentials-BTv2IfUZ.js";
2
2
  import "./client-sMzq2PWG.js";
3
3
  import "./_lifecycle-shared-_9BzQ9Y2.js";
4
4
  import "./executa-cache-BFoUtb4J.js";
5
- import "./manifest-B_DjigtQ.js";
5
+ import "./manifest-BCHiC184.js";
6
6
  import "./binary-upload-DVhQ0uY0.js";
7
- import { expandArtifactPath, resolveArtifactPlan, runExecutaUploadBinaries, uploadExecutaBinaries, uploadPlannedParts } from "./executa-upload-binaries-DwWQ18Dq.js";
7
+ import { expandArtifactPath, resolveArtifactPlan, runExecutaUploadBinaries, uploadExecutaBinaries, uploadPlannedParts } from "./executa-upload-binaries-D0JWYOtK.js";
8
8
 
9
9
  export { runExecutaUploadBinaries };
@@ -2,7 +2,7 @@ import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
2
  import { CliError } from "./client-sMzq2PWG.js";
3
3
  import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
4
4
  import { readExecutaIdentity } from "./executa-cache-BFoUtb4J.js";
5
- import { loadExecutaManifest } from "./manifest-B_DjigtQ.js";
5
+ import { loadExecutaManifest } from "./manifest-BCHiC184.js";
6
6
  import { fetchGitHubIdToken, finalizeBinaryUpload, initBinaryUpload, mintUploadSession, mintUploadSessionViaOidc, uploadBinaryPart } from "./binary-upload-DVhQ0uY0.js";
7
7
  import { isAbsolute, resolve } from "node:path";
8
8
  import { closeSync, createReadStream, existsSync, openSync, readSync, statSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { patchApp, uploadAppLogo, uploadAppScreenshot } from "./apps-HbfURK6y.js";
1
+ import { patchApp, uploadAppLogo, uploadAppScreenshot } from "./apps-BRBufSyX.js";
2
2
  import { CliError } from "./client-sMzq2PWG.js";
3
3
  import { extname, resolve } from "node:path";
4
4
  import { existsSync, readFileSync } from "node:fs";
@@ -1,5 +1,5 @@
1
1
  import { CliError } from "./client-sMzq2PWG.js";
2
- import { resolve } from "node:path";
2
+ import { dirname, resolve } from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
 
5
5
  //#region src/publish/manifest.ts
@@ -118,6 +118,7 @@ function loadExecutaManifest(cwd, manifestPath, profileOverride) {
118
118
  skillContent = readFileSync(contentPath, "utf-8");
119
119
  if (!skillContent.trim()) throw new CliError(`skill content file "${contentFile}" is empty`, 4);
120
120
  }
121
+ const protocol = loadProtocolManifest(path, raw, t);
121
122
  return {
122
123
  kind: "executa",
123
124
  path,
@@ -130,10 +131,55 @@ function loadExecutaManifest(cwd, manifestPath, profileOverride) {
130
131
  changelog: pickString(raw, "changelog") ?? void 0,
131
132
  skillContent,
132
133
  executionMode: pickString(raw, "execution_mode") ?? void 0,
133
- distribution: parseExecutaDistribution(raw["distribution"], t, profileOverride)
134
+ distribution: parseExecutaDistribution(raw["distribution"], t, profileOverride),
135
+ protocolManifest: protocol?.manifest,
136
+ protocolManifestPath: protocol?.path
134
137
  };
135
138
  }
136
139
  /**
140
+ * Load the Executa JSON-RPC protocol manifest for a `tool` Executa.
141
+ *
142
+ * Resolution (relative to the directory holding `executa.json`):
143
+ * 1. explicit `executa.json` `manifest_file` path — must exist;
144
+ * 2. sibling `manifest.json` convention — optional.
145
+ *
146
+ * Returns `undefined` when no protocol manifest is available (the server
147
+ * `manifest_cache` field is then simply not synced — backwards compatible).
148
+ */
149
+ function loadProtocolManifest(executaJsonPath, raw, executaType) {
150
+ const declared = raw["manifest_file"];
151
+ if (declared !== void 0 && typeof declared !== "string") throw new CliError("executa.json `manifest_file` must be a string path", 4);
152
+ if (executaType === "skill") {
153
+ if (declared) throw new CliError("executa.json `manifest_file` is only valid for `executa_type: \"tool\"` — skills have no JSON-RPC protocol manifest", 4);
154
+ return void 0;
155
+ }
156
+ const dir = dirname(executaJsonPath);
157
+ const path = resolve(dir, declared ?? "manifest.json");
158
+ if (!existsSync(path)) {
159
+ if (declared) throw new CliError(`executa.json \`manifest_file\` points at "${declared}" but ${path} does not exist`, 4);
160
+ return void 0;
161
+ }
162
+ const manifest = readJson(path);
163
+ const caps = manifest["host_capabilities"] ?? manifest["hostCapabilities"];
164
+ if (caps !== void 0 && caps !== null) {
165
+ const isStrArray = Array.isArray(caps) && caps.every((c) => typeof c === "string");
166
+ const isBoolMap = !Array.isArray(caps) && typeof caps === "object" && Object.values(caps).every((v) => typeof v === "boolean");
167
+ if (!isStrArray && !isBoolMap) throw new CliError(`protocol manifest ${path} \`host_capabilities\` must be an array of strings (or a {capability: bool} map)`, 4);
168
+ }
169
+ return {
170
+ manifest,
171
+ path
172
+ };
173
+ }
174
+ /** Declared host capability strings of a protocol manifest (normalised). */
175
+ function protocolHostCapabilities(manifest) {
176
+ if (!manifest) return [];
177
+ const caps = manifest["host_capabilities"] ?? manifest["hostCapabilities"];
178
+ if (Array.isArray(caps)) return caps.filter((c) => typeof c === "string");
179
+ if (caps && typeof caps === "object") return Object.entries(caps).filter(([, v]) => v === true).map(([k]) => k);
180
+ return [];
181
+ }
182
+ /**
137
183
  * Parse + validate the optional `executa.json` `distribution` object.
138
184
  *
139
185
  * Returns `undefined` when absent (a dev-only Executa). Skills never carry
@@ -335,4 +381,4 @@ function pickStringArray(o, k) {
335
381
  }
336
382
 
337
383
  //#endregion
338
- export { loadAppManifest, loadExecutaManifest };
384
+ export { loadAppManifest, loadExecutaManifest, protocolHostCapabilities };
@@ -1,18 +1,23 @@
1
1
  import "./credentials-BTv2IfUZ.js";
2
- import "./apps-HbfURK6y.js";
2
+ import "./nexus-root-BlPwOusj.js";
3
+ import "./apps-BRBufSyX.js";
3
4
  import { CliError } from "./client-sMzq2PWG.js";
4
5
  import { withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
6
  import "./executa-cache-BFoUtb4J.js";
6
7
  import "./bundled-executas-BRyQkI9u.js";
7
- import "./manifest-B_DjigtQ.js";
8
+ import "./manifest-BCHiC184.js";
8
9
  import "./executas-CvQY_w2U.js";
9
- import { runExecutaPublish } from "./executa-publish-BKnsUoZq.js";
10
+ import { runExecutaPublish } from "./executa-publish-BuakG1RK.js";
10
11
  import "./binary-upload-DVhQ0uY0.js";
11
- import "./executa-upload-binaries-DwWQ18Dq.js";
12
+ import "./executa-upload-binaries-D0JWYOtK.js";
13
+ import "./dev-BB1oS-1o.js";
14
+ import "./executa-install-n1oRAoYJ.js";
12
15
  import "./app-cache-Cr3tKbux.js";
13
- import "./listing-meta-DgweMStT.js";
14
- import "./app-bundle-upload-Ca0r-kPy.js";
15
- import { runAppsPublish } from "./apps-publish-8N9x4VEM.js";
16
+ import "./working-orchestration-BRU7FV-b.js";
17
+ import "./apps-cut-L7T8b5RS.js";
18
+ import "./listing-meta-rIni8tjd.js";
19
+ import "./apps-push-d1C0eePp.js";
20
+ import { runAppsPublish } from "./apps-publish-CGfzN7tI.js";
16
21
  import { resolve } from "node:path";
17
22
  import { existsSync } from "node:fs";
18
23
  import { red, yellow } from "kleur/colors";
@@ -21,9 +26,8 @@ import { red, yellow } from "kleur/colors";
21
26
  function detectProjectKind(cwd) {
22
27
  const hasManifest = existsSync(resolve(cwd, "manifest.json"));
23
28
  const hasExecuta = existsSync(resolve(cwd, "executa.json"));
24
- if (hasManifest && hasExecuta) return "ambiguous";
25
- if (hasManifest) return "app";
26
29
  if (hasExecuta) return "executa";
30
+ if (hasManifest) return "app";
27
31
  return "unknown";
28
32
  }
29
33
 
@@ -33,7 +37,6 @@ async function runTopLevelPublish(opts) {
33
37
  return withErrorHandling(async () => {
34
38
  const cwd = resolve(opts.cwd ?? process.cwd());
35
39
  const kind = detectProjectKind(cwd);
36
- if (kind === "ambiguous") throw new CliError(`cannot auto-detect: ${cwd} has BOTH manifest.json and executa.json. Run \`anna-app apps publish\` or \`anna-app executa publish\` explicitly.`, 4);
37
40
  if (kind === "unknown") throw new CliError(`no manifest.json or executa.json found in ${cwd}`, 4);
38
41
  if (kind === "app") return runAppsPublish({
39
42
  cwd,
@@ -1,5 +1,5 @@
1
1
  import { canonicalHost, getAccount } from "./credentials-BTv2IfUZ.js";
2
- import { BridgeRequestError } from "./bridge-sFHqOOat.js";
2
+ import { BridgeRequestError } from "./bridge-Bo8eu3-d.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-CfVdGa9j.js";
2
+ import { hostOf, requireAccount, withCode } from "./dev-account-IrYL4u4F.js";
3
3
  import { resolve } from "node:path";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
 
@@ -1,10 +1,10 @@
1
1
  import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import { createApp, findAppBySlug, getApp } from "./apps-HbfURK6y.js";
2
+ import { createApp, findAppBySlug, getApp } from "./apps-BRBufSyX.js";
3
3
  import { CliError } from "./client-sMzq2PWG.js";
4
4
  import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-BRyQkI9u.js";
5
- import { loadExecutaManifest } from "./manifest-B_DjigtQ.js";
6
- import { runExecutaPublish } from "./executa-publish-BKnsUoZq.js";
7
- import { runExecutaInstall } from "./executa-install-DAposiBw.js";
5
+ import { loadExecutaManifest } from "./manifest-BCHiC184.js";
6
+ import { manifestSyncNote, runExecutaPublish } from "./executa-publish-BuakG1RK.js";
7
+ import { runExecutaInstall } from "./executa-install-n1oRAoYJ.js";
8
8
  import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-Cr3tKbux.js";
9
9
  import { join, resolve } from "node:path";
10
10
  import { dim, green, yellow } from "kleur/colors";
@@ -72,7 +72,11 @@ async function resolveBundledExecutas(params) {
72
72
  path: decl.path,
73
73
  source: params.lockSource ?? (freeze ? "published" : "working")
74
74
  };
75
- if (!json) console.log(green(` ✓ bundled:${decl.handle} → ${captured.tool_id}`) + dim(` (v${captured.version}${captured.idempotent_hit ? ", unchanged" : ""})`));
75
+ if (!json) {
76
+ console.log(green(` ✓ bundled:${decl.handle} → ${captured.tool_id}`) + dim(` (v${captured.version}${captured.idempotent_hit ? ", unchanged" : ""})`));
77
+ const note = manifestSyncNote(captured);
78
+ if (note) console.log(note);
79
+ }
76
80
  }
77
81
  for (const o of overrides) if (!(o.handle in resolved)) {
78
82
  resolved[o.handle] = o.toolId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anna-ai/cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Anna App developer CLI: scaffold, validate, harness (Phase 2 MVP: init + validate).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,8 +33,8 @@
33
33
  "prepublishOnly": "pnpm lint && pnpm test && pnpm build && node scripts/check-runtime-pin.mjs && node scripts/check-sdk-pin.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@anna-ai/app-runtime": "^0.15.0",
37
- "@anna-ai/app-schema": "^0.19.0",
36
+ "@anna-ai/app-runtime": "^0.16.0",
37
+ "@anna-ai/app-schema": "^0.22.0",
38
38
  "ajv": "^8.17.1",
39
39
  "ajv-formats": "^3.0.1",
40
40
  "commander": "^12.1.0",
@@ -1,17 +0,0 @@
1
- import "./credentials-BTv2IfUZ.js";
2
- import "./apps-HbfURK6y.js";
3
- import "./client-sMzq2PWG.js";
4
- import "./_lifecycle-shared-_9BzQ9Y2.js";
5
- import "./executa-cache-BFoUtb4J.js";
6
- import "./bundled-executas-BRyQkI9u.js";
7
- import "./manifest-B_DjigtQ.js";
8
- import "./executas-CvQY_w2U.js";
9
- import "./executa-publish-BKnsUoZq.js";
10
- import "./binary-upload-DVhQ0uY0.js";
11
- import "./executa-upload-binaries-DwWQ18Dq.js";
12
- import "./app-cache-Cr3tKbux.js";
13
- import "./listing-meta-DgweMStT.js";
14
- import "./app-bundle-upload-Ca0r-kPy.js";
15
- import { runAppsPublish } from "./apps-publish-8N9x4VEM.js";
16
-
17
- export { runAppsPublish };
@@ -1,272 +0,0 @@
1
- import { canonicalHost } from "./credentials-BTv2IfUZ.js";
2
- import { createApp, createVersion, findAppBySlug, getApp } from "./apps-HbfURK6y.js";
3
- import { CliError } from "./client-sMzq2PWG.js";
4
- import { resolveClient, withErrorHandling } from "./_lifecycle-shared-_9BzQ9Y2.js";
5
- import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-BRyQkI9u.js";
6
- import { loadAppManifest } from "./manifest-B_DjigtQ.js";
7
- import { bumpVersion, bundleHash, manifestHash, rewriteVersion, runExecutaPublish } from "./executa-publish-BKnsUoZq.js";
8
- import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-Cr3tKbux.js";
9
- import { syncAppListingMeta } from "./listing-meta-DgweMStT.js";
10
- import { isExistingDir, uploadAppBundle } from "./app-bundle-upload-Ca0r-kPy.js";
11
- import { resolve } from "node:path";
12
- import { bold, cyan, dim, green, yellow } from "kleur/colors";
13
-
14
- //#region src/commands/apps-publish.ts
15
- async function runAppsPublish(opts) {
16
- return withErrorHandling(async () => {
17
- const cwd = resolve(opts.cwd ?? process.cwd());
18
- const manifest = loadAppManifest(cwd, opts.manifest);
19
- const { client, host, source } = resolveClient({ account: opts.account });
20
- if (!opts.json) {
21
- console.log(dim(`using PAT from ${source} (host=${host})`));
22
- console.log(yellow("⚠ `apps publish` mints an immutable version directly. The Option-C working-draft flow is now preferred:"));
23
- console.log(dim(" anna-app apps push ") + dim("# upsert the mutable working draft (safe every commit)"));
24
- console.log(dim(" anna-app apps cut <version> ") + dim("# snapshot + freeze executa deps"));
25
- }
26
- if (opts.bump) {
27
- const next = bumpVersion(manifest.version, opts.bump);
28
- if (!opts.json) console.log(yellow(`↑ bumping manifest.version: ${manifest.version} → ${next}`));
29
- if (!opts.noWrite && !opts.dryRun) rewriteVersion(manifest.metadataPath, manifest.metadataRaw, next);
30
- manifest.version = next;
31
- manifest.metadataRaw.version = next;
32
- if (manifest.metadataRaw !== manifest.raw && "version" in manifest.raw) manifest.raw.version = next;
33
- }
34
- const overrides = parseExecutaIdOverrides(opts.executaId);
35
- const bundledActive = !opts.noBundledExecutas && (manifest.bundledExecutas.length > 0 || overrides.length > 0);
36
- let publishManifestRaw = manifest.raw;
37
- if (bundledActive) {
38
- const { referenced } = validateBundledHandles(manifest.raw, manifest.bundledExecutas, overrides);
39
- const overrideMap = new Map(overrides.map((o) => [o.handle, o.toolId]));
40
- const lock = readExecutasLock(cwd, host);
41
- const resolved = {};
42
- const lockEntries = {};
43
- for (const decl of manifest.bundledExecutas) {
44
- if (overrideMap.has(decl.handle)) {
45
- const id = overrideMap.get(decl.handle);
46
- resolved[decl.handle] = id;
47
- lockEntries[decl.handle] = {
48
- tool_id: id,
49
- path: decl.path,
50
- source: "override"
51
- };
52
- if (!opts.json) console.log(dim(` bundled:${decl.handle} → ${id} (override)`));
53
- continue;
54
- }
55
- if (opts.skipExecutaPublish) {
56
- const cachedId = lock?.executas[decl.handle]?.tool_id;
57
- if (!cachedId) throw new CliError(`--skip-executa-publish set but no cached tool_id for "${decl.handle}" in .anna/executas.lock.json (run without --skip-executa-publish first, or pass --executa-id ${decl.handle}=<tool-id>)`, 4);
58
- resolved[decl.handle] = cachedId;
59
- lockEntries[decl.handle] = {
60
- tool_id: cachedId,
61
- path: decl.path,
62
- source: "cache"
63
- };
64
- if (!opts.json) console.log(dim(` bundled:${decl.handle} → ${cachedId} (cache)`));
65
- continue;
66
- }
67
- const execCwd = resolve(cwd, decl.path);
68
- if (opts.dryRun) {
69
- if (!opts.json) console.log(yellow(` [dry-run] would publish bundled executa "${decl.handle}" from ${decl.path}`));
70
- continue;
71
- }
72
- if (!opts.json) console.log(dim(` publishing bundled executa "${decl.handle}" (${decl.path})…`));
73
- let captured;
74
- const code = await runExecutaPublish({
75
- cwd: execCwd,
76
- account: opts.account,
77
- quiet: true,
78
- profile: opts.profile,
79
- capture: (r) => {
80
- captured = r;
81
- }
82
- });
83
- if (code !== 0 || !captured) throw new CliError(`failed to publish bundled executa "${decl.handle}" (${decl.path})`, code === 0 ? 4 : code);
84
- resolved[decl.handle] = captured.tool_id;
85
- lockEntries[decl.handle] = {
86
- tool_id: captured.tool_id,
87
- path: decl.path,
88
- source: "published"
89
- };
90
- if (!opts.json) console.log(green(` ✓ bundled:${decl.handle} → ${captured.tool_id}`) + dim(` (v${captured.version}${captured.idempotent_hit ? ", unchanged" : ""})`));
91
- }
92
- for (const o of overrides) if (!(o.handle in resolved)) {
93
- resolved[o.handle] = o.toolId;
94
- lockEntries[o.handle] = {
95
- tool_id: o.toolId,
96
- source: "override"
97
- };
98
- if (!opts.json) console.log(dim(` bundled:${o.handle} → ${o.toolId} (override)`));
99
- }
100
- const missing = [...referenced].filter((h) => !(h in resolved));
101
- if (missing.length > 0 && !opts.dryRun) throw new CliError(`could not resolve bundled handle(s): ${missing.sort().join(", ")}`, 4);
102
- if (!opts.dryRun) {
103
- const merged = {
104
- $schema: "anna-executas-lock/v1",
105
- host: canonicalHost(host),
106
- executas: {
107
- ...lock?.executas ?? {},
108
- ...lockEntries
109
- }
110
- };
111
- writeExecutasLock(cwd, merged);
112
- publishManifestRaw = substituteBundledRefs(manifest.raw, resolved);
113
- const bundleEntry = manifest.raw.ui?.bundle?.entry;
114
- if (bundleEntry) {
115
- const bundleDir$1 = resolve(cwd, "bundle");
116
- if (Object.keys(resolved).length > 0) {
117
- const sidecar = writeBundleToolIdSidecar(bundleDir$1, resolved);
118
- if (!opts.json) console.log(dim(` wrote ${sidecar.replace(cwd + "/", "")}`));
119
- }
120
- }
121
- }
122
- }
123
- let cached = readAppIdentity(cwd);
124
- if (cached && cached.host !== canonicalHost(host)) cached = null;
125
- let appId;
126
- let serverSlug;
127
- let firstPublish = false;
128
- let appIdFromCache = false;
129
- if (cached && appCacheMatches(cached, host, manifest.slug)) {
130
- appId = cached.app_id;
131
- serverSlug = cached.slug;
132
- appIdFromCache = true;
133
- } else {
134
- const found = await findAppBySlug(client, manifest.slug);
135
- if (found) {
136
- appId = found.id;
137
- serverSlug = found.slug;
138
- } else {
139
- if (opts.dryRun) {
140
- if (!opts.json) console.log(yellow(`[dry-run] would create AnnaApp slug=${manifest.slug}, then upload version ${manifest.version}`));
141
- return 0;
142
- }
143
- const created = await createApp(client, {
144
- slug: manifest.slug,
145
- name: manifest.name,
146
- category: manifest.category,
147
- tagline: manifest.tagline,
148
- description: manifest.description
149
- });
150
- appId = created.id;
151
- serverSlug = created.slug;
152
- firstPublish = true;
153
- }
154
- writeAppIdentity(cwd, {
155
- $schema: "anna-app-identity/v1",
156
- host: canonicalHost(host),
157
- app_id: appId,
158
- slug: serverSlug,
159
- first_published_at: cached?.first_published_at ?? new Date().toISOString()
160
- });
161
- }
162
- if (opts.dryRun) {
163
- if (!opts.json) {
164
- console.log(yellow(`[dry-run] resolved app_id=${appId} slug=${serverSlug}; would POST version ${manifest.version}`));
165
- const uiEntry = publishManifestRaw.ui?.bundle?.entry;
166
- const dryBundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
167
- if (uiEntry && !opts.noBundle && isExistingDir(dryBundleDir)) console.log(yellow(`[dry-run] would upload UI bundle from ${dryBundleDir} (entry=${uiEntry})`));
168
- }
169
- return 0;
170
- }
171
- const hashInput = {
172
- version: manifest.version,
173
- manifest: publishManifestRaw
174
- };
175
- const hashBundleEntry = publishManifestRaw.ui?.bundle?.entry;
176
- const hashBundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
177
- const hash = hashBundleEntry && !opts.noBundle && isExistingDir(hashBundleDir) ? bundleHash(hashInput, hashBundleDir) : manifestHash(hashInput);
178
- let verResp;
179
- try {
180
- verResp = await createVersion(client, appId, {
181
- version: manifest.version,
182
- changelog: manifest.changelog,
183
- manifest: publishManifestRaw
184
- }, hash);
185
- } catch (e) {
186
- if (appIdFromCache && e instanceof CliError && e.status === 404) {
187
- if (!opts.json) console.log(yellow(`\u26a0 cached app_id=${appId} not found on server (deleted?); re-resolving identity and retrying\u2026`));
188
- const found = await findAppBySlug(client, manifest.slug);
189
- if (found) {
190
- appId = found.id;
191
- serverSlug = found.slug;
192
- } else {
193
- const created = await createApp(client, {
194
- slug: manifest.slug,
195
- name: manifest.name,
196
- category: manifest.category,
197
- tagline: manifest.tagline,
198
- description: manifest.description
199
- });
200
- appId = created.id;
201
- serverSlug = created.slug;
202
- firstPublish = true;
203
- }
204
- writeAppIdentity(cwd, {
205
- $schema: "anna-app-identity/v1",
206
- host: canonicalHost(host),
207
- app_id: appId,
208
- slug: serverSlug,
209
- first_published_at: cached?.first_published_at ?? new Date().toISOString()
210
- });
211
- verResp = await createVersion(client, appId, {
212
- version: manifest.version,
213
- changelog: manifest.changelog,
214
- manifest: publishManifestRaw
215
- }, hash);
216
- } else throw e;
217
- }
218
- let bundleResult = null;
219
- const uiBundle = publishManifestRaw.ui?.bundle;
220
- const bundleDir = resolve(cwd, opts.bundleDir ?? "bundle");
221
- if (uiBundle?.entry && !opts.noBundle) if (!isExistingDir(bundleDir)) {
222
- if (!opts.json) console.log(yellow(`⚠ manifest declares ui.bundle.entry="${uiBundle.entry}" but bundle dir not found (${bundleDir}); skipping UI bundle upload`));
223
- } else bundleResult = await uploadAppBundle({
224
- client,
225
- appId,
226
- versionId: verResp.version.id,
227
- bundleDir,
228
- entryPath: uiBundle.entry,
229
- bundleFormat: uiBundle.format,
230
- externalOrigins: Array.isArray(uiBundle.external_origins) ? uiBundle.external_origins : [],
231
- log: opts.json ? void 0 : (m) => console.log(dim(m))
232
- });
233
- try {
234
- await syncAppListingMeta(client, appId, manifest, { cwd });
235
- } catch (err) {
236
- if (!opts.json) console.log(yellow(`! listing metadata sync skipped: ${err.message}`));
237
- }
238
- const finalApp = await getApp(client, appId);
239
- if (opts.json) {
240
- console.log(JSON.stringify({
241
- app_id: appId,
242
- slug: serverSlug,
243
- host,
244
- version: verResp.version.version,
245
- version_id: verResp.version.id,
246
- content_hash: hash,
247
- idempotent_hit: verResp.idempotentHit,
248
- first_publish: firstPublish,
249
- status: finalApp.status,
250
- bundle: bundleResult ? {
251
- status: bundleResult.status,
252
- bundle_status: bundleResult.detail.status,
253
- file_count: bundleResult.detail.file_count,
254
- total_size_bytes: bundleResult.detail.total_size_bytes,
255
- sha256_manifest: bundleResult.detail.sha256_manifest
256
- } : null
257
- }, null, 2));
258
- return 0;
259
- }
260
- if (verResp.idempotentHit) console.log(green(`✓ apps/${serverSlug}: version ${manifest.version} already live (content hash unchanged)`));
261
- else console.log(green(`✓ apps/${serverSlug}: version ${manifest.version} published (id=${verResp.version.id})`));
262
- if (firstPublish) console.log(dim(` first publish — wrote .anna/app.json`));
263
- if (bundleResult) if (bundleResult.status === "skipped") console.log(dim(` UI bundle unchanged — skipped`));
264
- else console.log(green(` ✓ UI bundle: ${bundleResult.fileCount} files, ${(bundleResult.totalBytes / 1024).toFixed(1)} KB → ${bundleResult.detail.status}`));
265
- console.log(bold(cyan(`status: ${finalApp.status}`)));
266
- if (!verResp.idempotentHit) console.log(dim(`→ run `) + cyan(`anna-app apps release ${manifest.version}`) + dim(` to freeze & publish this version`));
267
- return 0;
268
- });
269
- }
270
-
271
- //#endregion
272
- export { runAppsPublish };