@akanjs/cli 3.1.1-rc.8 → 3.1.1-rc.9

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 (28) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-3sy7kjgj.js → CodeAgent-8d5qs787.js} +2 -2
  3. package/{CodeTui-rqxarxsn.js → CodeTui-z5vkm9ea.js} +1 -1
  4. package/{TunnelShare-2ef94kha.js → TunnelShare-qkm8zp03.js} +3 -3
  5. package/akanCode.js +2 -2
  6. package/{application.command-14xsthcr.js → application.command-wthg8nn9.js} +5 -5
  7. package/{cloud.command-rmw1kcf1.js → cloud.command-sz11hpre.js} +6 -6
  8. package/{cloud.script-v1ysyerg.js → cloud.script-nqevg5qw.js} +6 -6
  9. package/{code.command-719k3e9q.js → code.command-9h3yrzhe.js} +4 -4
  10. package/{context.command-c4t4z1vy.js → context.command-15j9b7c0.js} +4 -4
  11. package/{context.runner-qb15sjf8.js → context.runner-8gg030b0.js} +3 -3
  12. package/{index-myc22sgv.js → index-2azahjaw.js} +4 -3
  13. package/{index-hmmv2cah.js → index-2mwc0g0d.js} +1 -1
  14. package/{index-mdqr41sp.js → index-301pdbzz.js} +4 -4
  15. package/{index-8ap5z1n5.js → index-55j120r8.js} +1 -1
  16. package/{index-0p37cz91.js → index-6txx6a9p.js} +2 -2
  17. package/{index-pa3c2mb8.js → index-9th4gszy.js} +3 -3
  18. package/{index-8w76g4rm.js → index-a58emady.js} +2 -2
  19. package/{index-5phjb48k.js → index-a5dhqkdr.js} +3 -3
  20. package/{index-5max10jx.js → index-bt438yxm.js} +67 -49
  21. package/{index-qd5km521.js → index-js6geqjn.js} +1 -1
  22. package/{index-zrte51fn.js → index-qfp55x1y.js} +1 -1
  23. package/index.js +8 -8
  24. package/{localRegistry.command-2t3fghje.js → localRegistry.command-jtd8gaes.js} +5 -5
  25. package/package.json +2 -2
  26. package/{subspace.command-kvxmyxtf.js → subspace.command-822qx2bx.js} +3 -3
  27. package/{tunnel.command-kxv0ddmp.js → tunnel.command-ycmja19q.js} +3 -3
  28. package/{workspace.command-tsc99yec.js → workspace.command-qm7cw29v.js} +8 -8
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- 5bc34f19ccee615879fdbf1e588c2c52ebd7a1c93f6a04638c896b62af49fe67
1
+ 42363667f84aef22fbcce178eacbf051433df76537e7f770a2d50758c994c327
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgent2
4
- } from "./index-5phjb48k.js";
5
- import"./index-8ap5z1n5.js";
4
+ } from "./index-a5dhqkdr.js";
5
+ import"./index-55j120r8.js";
6
6
  import"./index-7md2g9vw.js";
7
7
  export {
8
8
  CodeAgent2 as CodeAgent
@@ -5,7 +5,7 @@ import {
5
5
  McpTokenStore,
6
6
  McpSignIn,
7
7
  AkanCodeCompaction2
8
- } from "./index-8ap5z1n5.js";
8
+ } from "./index-55j120r8.js";
9
9
  import {
10
10
  CodeTuiLines2,
11
11
  CodeTuiAgents2,
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  TunnelShare2
4
- } from "./index-hmmv2cah.js";
5
- import"./index-myc22sgv.js";
6
- import"./index-5max10jx.js";
4
+ } from "./index-2mwc0g0d.js";
5
+ import"./index-2azahjaw.js";
6
+ import"./index-bt438yxm.js";
7
7
  import"./index-m9jj544v.js";
8
8
  import"./index-xb8809yb.js";
9
9
  import"./index-0fz95kxe.js";
package/akanCode.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  CodeMailbox2,
29
29
  CodeSessionFork2,
30
30
  CodeAgent2
31
- } from "./index-5phjb48k.js";
31
+ } from "./index-a5dhqkdr.js";
32
32
  import {
33
33
  akanCodeDefaultModel2,
34
34
  akanCodeModel2,
@@ -40,7 +40,7 @@ import {
40
40
  SubagentPool2,
41
41
  akanCodePaths2,
42
42
  AkanCodeCompaction2
43
- } from "./index-8ap5z1n5.js";
43
+ } from "./index-55j120r8.js";
44
44
  import"./index-7md2g9vw.js";
45
45
  import {
46
46
  CodeAgentRpcHost2
@@ -11,15 +11,15 @@ import {
11
11
  import"./index-52w0fvh8.js";
12
12
  import"./index-wcej7g4z.js";
13
13
  import"./index-5nd1wtkv.js";
14
- import"./index-5max10jx.js";
15
- import"./index-qd5km521.js";
14
+ import"./index-bt438yxm.js";
15
+ import"./index-js6geqjn.js";
16
16
  import"./index-m9jj544v.js";
17
17
  import"./index-xb8809yb.js";
18
18
  import"./index-0fz95kxe.js";
19
19
  import"./index-2xcc2ax5.js";
20
20
  import {
21
21
  ApplicationScript
22
- } from "./index-pa3c2mb8.js";
22
+ } from "./index-9th4gszy.js";
23
23
  import"./index-7md2g9vw.js";
24
24
  import {
25
25
  writeOption,
@@ -266,11 +266,11 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
266
266
  desc: `${signDesc}; a signed app takes only a release signed the same way`,
267
267
  default: false
268
268
  }).option("notarize", Boolean, { desc: notarizeDesc, default: false }).option("revoke", String, {
269
- desc: "android, ios: keyIds of updates.publicKeys this release starts revoking, comma-separated (update-keygen prints a key's); it is signed with a key listed after them",
269
+ desc: "keyIds of updates.publicKeys this release starts revoking, comma-separated (update-keygen prints a key's); it is signed with a key listed after them",
270
270
  nullable: true
271
271
  }).option("resetSequence", Boolean, {
272
272
  flag: "R",
273
- desc: "android, ios: with --revoke, phones compare the release with their own bundle instead of the running one",
273
+ desc: "with --revoke, apps compare the release with their own build instead of the running release",
274
274
  default: false
275
275
  }).option("write", Boolean, writeOption).option("allowLocalRelease", Boolean, allowLocalOption("release")).exec(async function(app, platform, target, env, channel, upload, arch, sign, notarize, revoke, resetSequence, write, allowLocalRelease) {
276
276
  const revoked = revoke?.split(",").map((keyId) => keyId.trim()).filter(Boolean);
@@ -6,24 +6,24 @@ import {
6
6
  } from "./index-3wypz6xj.js";
7
7
  import"./index-52w0fvh8.js";
8
8
  import"./index-wcej7g4z.js";
9
- import"./index-myc22sgv.js";
9
+ import"./index-2azahjaw.js";
10
10
  import {
11
11
  PlatformTestRun
12
- } from "./index-0p37cz91.js";
13
- import"./index-5max10jx.js";
14
- import"./index-qd5km521.js";
12
+ } from "./index-6txx6a9p.js";
13
+ import"./index-bt438yxm.js";
14
+ import"./index-js6geqjn.js";
15
15
  import"./index-m9jj544v.js";
16
16
  import"./index-xb8809yb.js";
17
17
  import"./index-0fz95kxe.js";
18
18
  import"./index-5nd1wtkv.js";
19
19
  import"./index-2xcc2ax5.js";
20
- import"./index-pa3c2mb8.js";
20
+ import"./index-9th4gszy.js";
21
21
  import"./index-7md2g9vw.js";
22
22
  import"./index-tvehn2sp.js";
23
23
  import"./index-42j4a8zq.js";
24
24
  import {
25
25
  CloudScript2
26
- } from "./index-mdqr41sp.js";
26
+ } from "./index-301pdbzz.js";
27
27
  import {
28
28
  writeOption,
29
29
  oneNativeTargetOption,
@@ -1,15 +1,15 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudScript2
4
- } from "./index-mdqr41sp.js";
5
- import"./index-0p37cz91.js";
6
- import"./index-pa3c2mb8.js";
4
+ } from "./index-301pdbzz.js";
5
+ import"./index-6txx6a9p.js";
6
+ import"./index-9th4gszy.js";
7
7
  import"./index-pcwzkdqb.js";
8
8
  import"./index-2xcc2ax5.js";
9
9
  import"./index-42j4a8zq.js";
10
- import"./index-qd5km521.js";
11
- import"./index-myc22sgv.js";
12
- import"./index-5max10jx.js";
10
+ import"./index-js6geqjn.js";
11
+ import"./index-2azahjaw.js";
12
+ import"./index-bt438yxm.js";
13
13
  import"./index-m9jj544v.js";
14
14
  import"./index-3wypz6xj.js";
15
15
  import"./index-7md2g9vw.js";
@@ -19,7 +19,7 @@ class CodeRunner extends runner("code") {
19
19
  async serve(options, listen) {
20
20
  await import("./consoleToStderr-h5bryj94.js");
21
21
  const [{ CodeAgent }, { CodeAgentRpcHost }, { CodeAgentRpcListener }] = await Promise.all([
22
- import("./CodeAgent-3sy7kjgj.js"),
22
+ import("./CodeAgent-8d5qs787.js"),
23
23
  import("./CodeAgentRpcHost-9g27hmer.js"),
24
24
  import("./CodeAgentRpcListener-7p7z5dd7.js")
25
25
  ]);
@@ -34,8 +34,8 @@ class CodeRunner extends runner("code") {
34
34
  }
35
35
  async tui(options, seed) {
36
36
  const [{ CodeAgent }, { CodeTui }] = await Promise.all([
37
- import("./CodeAgent-3sy7kjgj.js"),
38
- import("./CodeTui-rqxarxsn.js")
37
+ import("./CodeAgent-8d5qs787.js"),
38
+ import("./CodeTui-z5vkm9ea.js")
39
39
  ]);
40
40
  const agentOptions = await CodeRunner.#agentOptions(options, false);
41
41
  let resume = options.resume;
@@ -67,7 +67,7 @@ class CodeRunner extends runner("code") {
67
67
  }
68
68
  }
69
69
  async run(prompt, options) {
70
- const { CodeAgent } = await import("./CodeAgent-3sy7kjgj.js");
70
+ const { CodeAgent } = await import("./CodeAgent-8d5qs787.js");
71
71
  const agent = await CodeAgent.create(await CodeRunner.#agentOptions(options, false));
72
72
  const printer = new CodeAgentStreamPrinter2({ json: options.json, thinking: options.thinking });
73
73
  agent.on((event) => printer.print(event));
@@ -8,9 +8,9 @@ import"./index-wcej7g4z.js";
8
8
  import"./index-hj6w4ka1.js";
9
9
  import"./index-xjf5j657.js";
10
10
  import"./index-31es1yev.js";
11
- import"./index-8w76g4rm.js";
12
- import"./index-5max10jx.js";
13
- import"./index-qd5km521.js";
11
+ import"./index-a58emady.js";
12
+ import"./index-bt438yxm.js";
13
+ import"./index-js6geqjn.js";
14
14
  import"./index-m9jj544v.js";
15
15
  import"./index-xb8809yb.js";
16
16
  import"./index-0fz95kxe.js";
@@ -23,7 +23,7 @@ import"./index-skk9zc1x.js";
23
23
  import"./index-b70zct19.js";
24
24
  import {
25
25
  ContextScript
26
- } from "./index-zrte51fn.js";
26
+ } from "./index-qfp55x1y.js";
27
27
 
28
28
  // pkgs/@akanjs/cli/context/context.command.ts
29
29
  class ContextCommand extends command("context", [ContextScript], ({ public: target }) => ({
@@ -1,15 +1,15 @@
1
1
  // @bun
2
2
  import {
3
3
  ContextRunner2
4
- } from "./index-8w76g4rm.js";
4
+ } from "./index-a58emady.js";
5
5
  import"./index-b70zct19.js";
6
6
  import"./index-skk9zc1x.js";
7
7
  import"./index-74tjjsnc.js";
8
8
  import"./index-j9vyj3dj.js";
9
9
  import"./index-hmt54t45.js";
10
10
  import"./index-905qdgqp.js";
11
- import"./index-qd5km521.js";
12
- import"./index-5max10jx.js";
11
+ import"./index-js6geqjn.js";
12
+ import"./index-bt438yxm.js";
13
13
  import"./index-m9jj544v.js";
14
14
  import"./index-31es1yev.js";
15
15
  import"./index-xjf5j657.js";
@@ -9,7 +9,7 @@ import {
9
9
  UpdatePackFolder,
10
10
  NativePublicEnv,
11
11
  NativeApp
12
- } from "./index-5max10jx.js";
12
+ } from "./index-bt438yxm.js";
13
13
  import {
14
14
  ExitCodeError
15
15
  } from "./index-3wypz6xj.js";
@@ -583,8 +583,9 @@ ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
583
583
  if (record.status === "rejected")
584
584
  throw new ExitCodeError(`The project rejected ${label}:
585
585
  ${problems}`, 2);
586
- const manifestUrl = typeof record.manifestUrl === "string" ? record.manifestUrl : `${url}/${platform}-${arch}/${channel}.json`;
587
- const what = `${label} (${release.manifest.bundle}, ${release.payloads.length + 3} files)`;
586
+ const manifestUrl = typeof record.manifestUrl === "string" ? record.manifestUrl : `${url}/${platform}-${arch}/${channel}/app.json`;
587
+ const files = 1 + release.manifestFiles.length + release.payloads.length;
588
+ const what = `${label} (${release.manifest.bundle}, ${files} files)`;
588
589
  Logger3.rawLog(record.status === "published" ? `Published ${what}. Installed apps read ${manifestUrl}.` : `Staged ${what}. Publish it from the project's release screen; installed apps read ${manifestUrl}.`);
589
590
  if (problems)
590
591
  Logger3.rawLog(`The project noted:
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-myc22sgv.js";
5
+ } from "./index-2azahjaw.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
@@ -4,7 +4,7 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-myc22sgv.js";
7
+ } from "./index-2azahjaw.js";
8
8
  import {
9
9
  PkgExecutor
10
10
  } from "./index-wcej7g4z.js";
@@ -12,19 +12,19 @@ import {
12
12
  UpdatePackFolder,
13
13
  NativePublicEnv,
14
14
  NativeApp
15
- } from "./index-5max10jx.js";
15
+ } from "./index-bt438yxm.js";
16
16
  import {
17
17
  script
18
18
  } from "./index-3wypz6xj.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-pa3c2mb8.js";
21
+ } from "./index-9th4gszy.js";
22
22
  import {
23
23
  PackageScript
24
24
  } from "./index-42j4a8zq.js";
25
25
  import {
26
26
  CloudRunner
27
- } from "./index-0p37cz91.js";
27
+ } from "./index-6txx6a9p.js";
28
28
 
29
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
30
30
  import { Logger } from "akanjs/common";
@@ -179,7 +179,7 @@ class SubagentPool2 {
179
179
  }
180
180
  }
181
181
  async#run(id, kind, prompt, signal) {
182
- const { CodeAgent } = await import("./CodeAgent-3sy7kjgj.js");
182
+ const { CodeAgent } = await import("./CodeAgent-8d5qs787.js");
183
183
  const budget = this.#options.parent.tools.subagent;
184
184
  const child = SubagentPool2.childOf(this.#options.parent, kind);
185
185
  const agent = await CodeAgent.create({
@@ -6,7 +6,7 @@ import {
6
6
  CloudApi,
7
7
  CloudUpdates,
8
8
  PipelineSecrets
9
- } from "./index-myc22sgv.js";
9
+ } from "./index-2azahjaw.js";
10
10
  import {
11
11
  resolveMobileTargets
12
12
  } from "./index-m9jj544v.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./index-wcej7g4z.js";
17
17
  import {
18
18
  NativeApp
19
- } from "./index-5max10jx.js";
19
+ } from "./index-bt438yxm.js";
20
20
  import {
21
21
  runner,
22
22
  assertPromptable
@@ -56,10 +56,10 @@ import {
56
56
  UpdateUploader,
57
57
  NativePublicEnv,
58
58
  NativeApp
59
- } from "./index-5max10jx.js";
59
+ } from "./index-bt438yxm.js";
60
60
  import {
61
61
  DesktopServerStage
62
- } from "./index-qd5km521.js";
62
+ } from "./index-js6geqjn.js";
63
63
  import {
64
64
  resolveMobileTargets,
65
65
  resolveAppId
@@ -3708,7 +3708,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3708
3708
  await Promise.all(shares.map(async (share) => await share.close()));
3709
3709
  }, "Abandoning the tunnel release; the shares expire on their own.");
3710
3710
  await Promise.all(apps.map(async (app) => {
3711
- const { TunnelShare } = await import("./TunnelShare-2ef94kha.js");
3711
+ const { TunnelShare } = await import("./TunnelShare-qkm8zp03.js");
3712
3712
  const share = await TunnelShare.open(app, { workspace: app.workspace });
3713
3713
  shares.push(share);
3714
3714
  urls.set(app.name, share.url);
@@ -23,10 +23,10 @@ import {
23
23
  } from "./index-3wypz6xj.js";
24
24
  import {
25
25
  NativeApp
26
- } from "./index-5max10jx.js";
26
+ } from "./index-bt438yxm.js";
27
27
  import {
28
28
  isPlaceholderAppId
29
- } from "./index-qd5km521.js";
29
+ } from "./index-js6geqjn.js";
30
30
  import {
31
31
  getMobileTargets,
32
32
  appIdsOf
@@ -5,7 +5,7 @@ import {
5
5
  McpServerConfig,
6
6
  McpSignIn,
7
7
  AkanCodeCompaction2
8
- } from "./index-8ap5z1n5.js";
8
+ } from "./index-55j120r8.js";
9
9
  import {
10
10
  stripAnsi
11
11
  } from "./index-7md2g9vw.js";
@@ -809,7 +809,7 @@ class AkanToolPack2 {
809
809
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
810
810
  }
811
811
  async names() {
812
- const { ContextRunner } = await import("./context.runner-qb15sjf8.js");
812
+ const { ContextRunner } = await import("./context.runner-8gg030b0.js");
813
813
  return [
814
814
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
815
815
  AkanToolPack2.verifyToolName
@@ -817,7 +817,7 @@ class AkanToolPack2 {
817
817
  }
818
818
  static verifyToolName = "akan_verify";
819
819
  async#register(pi) {
820
- const { ContextRunner } = await import("./context.runner-qb15sjf8.js");
820
+ const { ContextRunner } = await import("./context.runner-8gg030b0.js");
821
821
  const runner = new ContextRunner;
822
822
  const guidelineNames = await AkanToolPack2.#guidelineNames();
823
823
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -138,7 +138,6 @@ class DesktopBin {
138
138
  }
139
139
 
140
140
  // pkgs/@akanjs/devkit/mobile/desktopRelease.ts
141
- import { createPublicKey, verify } from "crypto";
142
141
  import { mkdtemp as mkdtemp2, readFile, rm as rm3 } from "fs/promises";
143
142
  import os2 from "os";
144
143
  import path4 from "path";
@@ -337,25 +336,28 @@ class UpdateUploader {
337
336
  }
338
337
  static async releaseFiles(updatesDir, { dir, channel, bundle }) {
339
338
  const keyOf = (file) => UpdateUploader.#keyOf(updatesDir, dir, file);
340
- const desktop = await UpdateUploader.#read(path3.join(dir, `${channel}.json`));
341
- if (desktop?.bundle === bundle) {
342
- const archive = desktop.archive?.url;
343
- const patches = UpdateUploader.#field(desktop.patches, "url");
344
- return [archive, ...patches, `${channel}.json.sig`, `${channel}.json`].map(keyOf);
345
- }
339
+ const v1 = await UpdateUploader.#read(path3.join(dir, `${channel}.json`));
340
+ const pair = v1?.bundle === bundle ? [`${channel}.json.sig`, `${channel}.json`] : [];
346
341
  const names = await readdir(path3.join(dir, channel)).catch(() => []);
347
342
  for (const name of names.filter((name) => name.endsWith(".json"))) {
348
343
  const envelope = await UpdateUploader.#read(path3.join(dir, channel, name));
349
344
  const manifest = typeof envelope?.manifest === "string" ? UpdateUploader.#parse(Buffer.from(envelope.manifest, "base64").toString("utf8")) : null;
350
345
  if (manifest?.bundle !== bundle)
351
346
  continue;
347
+ if (manifest.kind === "app")
348
+ return [...UpdateUploader.#appFiles(manifest), ...pair, `${channel}/${name}`].map(keyOf);
352
349
  const hashes = [...new Set(UpdateUploader.#field(manifest.files, "sha256"))];
353
350
  if (!hashes.every((hash) => typeof hash === "string" && /^[0-9a-f]{64}$/.test(hash)))
354
351
  throw new Error(`${path3.join(dir, channel, name)} lists a file whose sha256 is not 64 hex digits; nothing was uploaded.`);
355
352
  return [...hashes.map((hash) => `${UpdatePackFolder.filesDir}/${hash}`), `${channel}/${name}`].map(keyOf);
356
353
  }
354
+ if (v1 && pair.length)
355
+ return [...UpdateUploader.#appFiles(v1), ...pair].map(keyOf);
357
356
  throw new Error(`${dir} holds no ${channel} manifest of release ${bundle}; nothing was uploaded.`);
358
357
  }
358
+ static #appFiles(manifest) {
359
+ return [manifest.archive?.url, ...UpdateUploader.#field(manifest.patches, "url")];
360
+ }
359
361
  static #keyOf(updatesDir, dir, file) {
360
362
  const resolved = typeof file === "string" ? path3.resolve(dir, file) : "";
361
363
  const key = path3.relative(updatesDir, resolved);
@@ -416,46 +418,46 @@ class DesktopRelease {
416
418
  platform;
417
419
  arch;
418
420
  channel;
419
- manifestBytes;
420
- signatureBytes;
421
- static #ed25519Spki = Buffer.from("302a300506032b6570032100", "hex");
421
+ manifestFiles;
422
422
  static #authenticode = `$ErrorActionPreference = 'Stop'
423
423
  $ProgressPreference = 'SilentlyContinue'
424
424
  $signature = Get-AuthenticodeSignature -LiteralPath $env:AKAN_RELEASE_EXE
425
425
  $subject = if ("$($signature.Status)" -ceq 'Valid') { "$($signature.SignerCertificate.Subject)" } else { '' }
426
426
  Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
427
- constructor(dir, manifest, payloads, platform, arch, channel, manifestBytes, signatureBytes) {
427
+ constructor(dir, manifest, payloads, platform, arch, channel, manifestFiles) {
428
428
  this.dir = dir;
429
429
  this.manifest = manifest;
430
430
  this.payloads = payloads;
431
431
  this.platform = platform;
432
432
  this.arch = arch;
433
433
  this.channel = channel;
434
- this.manifestBytes = manifestBytes;
435
- this.signatureBytes = signatureBytes;
434
+ this.manifestFiles = manifestFiles;
436
435
  }
437
436
  static async read(updatesDir, {
438
437
  platform,
439
438
  arch,
440
439
  channel,
441
440
  appId,
442
- publicKey
441
+ target,
442
+ publicKeys,
443
+ revokedKeys = [],
444
+ api
443
445
  }) {
444
446
  const folder = `${platform}-${arch}`;
445
447
  const dir = path4.join(updatesDir, folder);
446
- const manifestPath = path4.join(dir, `${channel}.json`);
447
- const [manifestBytes, signatureBytes] = await Promise.all([
448
- readFile(manifestPath).catch(() => null),
449
- readFile(`${manifestPath}.sig`).catch(() => null)
450
- ]);
451
- if (!manifestBytes || !signatureBytes)
452
- throw new Error(`${manifestBytes ? `${manifestPath}.sig` : manifestPath} is missing: run \`akan publish-update\` first.`);
453
- if (!DesktopRelease.#verifies(manifestBytes, signatureBytes, publicKey))
454
- throw new Error(`${manifestPath}.sig does not verify with updates.publicKeys[0], the one key installed apps trust: publish the release again.`);
455
- const manifest = DesktopRelease.#parse(manifestBytes);
456
- if (manifest?.schema !== 1 || manifest.kind !== "app" || manifest.app !== appId || manifest.platform !== platform || manifest.arch !== arch || manifest.channel !== channel || typeof manifest.bundle !== "string" || typeof manifest.sequence !== "number" || typeof manifest.build !== "number" || !manifest.archive)
457
- throw new Error(`${manifestPath} is not a release of ${appId} for ${folder} on channel ${channel}.`);
448
+ const envelopeName = `${channel}/app.json`;
449
+ const envelopePath = path4.join(dir, channel, "app.json");
450
+ const envelope = await readFile(envelopePath).catch(() => null);
451
+ if (!envelope)
452
+ throw new Error(`${envelopePath} is missing: run \`akan publish-update\` first.`);
453
+ const opened = DesktopRelease.#open(api, envelope, publicKeys, revokedKeys);
454
+ if (typeof opened === "string")
455
+ throw new Error(`${envelopePath}: ${opened}; publish the release again.`);
456
+ const manifest = DesktopRelease.#parse(opened);
457
+ if (manifest?.schema !== 2 || manifest.kind !== "app" || manifest.app !== appId || manifest.platform !== platform || manifest.arch !== arch || manifest.channel !== channel || manifest.target !== target || typeof manifest.bundle !== "string" || typeof manifest.sequence !== "number" || typeof manifest.build !== "number" || !manifest.archive)
458
+ throw new Error(`${envelopePath} is not a release of ${appId}${target ? ` target ${target}` : ""} for ${folder} on channel ${channel}.`);
458
459
  const { archive, bundle, sequence, build } = manifest;
460
+ const legacy = await DesktopRelease.#legacyPair(api, dir, channel, publicKeys[0], manifest);
459
461
  const keys = await UpdateUploader.releaseFiles(updatesDir, { dir, channel, bundle });
460
462
  const expected = new Map([{ url: archive.url, size: archive.size, sha256: archive.gzSha256 }, ...manifest.patches ?? []].map(({ url, size, sha256 }) => [path4.posix.normalize(url), { size, sha256 }]));
461
463
  const payloads = keys.flatMap((key) => {
@@ -463,12 +465,26 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
463
465
  const digest = expected.get(name);
464
466
  return digest ? [{ name, ...digest }] : [];
465
467
  });
466
- return new DesktopRelease(dir, { ...manifest, archive, bundle, sequence, build }, payloads, platform, arch, channel, manifestBytes, signatureBytes);
468
+ return new DesktopRelease(dir, { ...manifest, archive, bundle, sequence, build }, payloads, platform, arch, channel, [{ name: envelopeName, bytes: envelope }, ...legacy]);
469
+ }
470
+ static async#legacyPair(api, dir, channel, publicKey, manifest) {
471
+ const [bytes, signature] = await Promise.all([`${channel}.json`, `${channel}.json.sig`].map((name) => readFile(path4.join(dir, name)).catch(() => null)));
472
+ if (!bytes || !signature || !publicKey)
473
+ return [];
474
+ const v1 = DesktopRelease.#parse(bytes);
475
+ if (v1?.schema !== 1 || v1.bundle !== manifest.bundle || v1.sequence !== manifest.sequence)
476
+ return [];
477
+ if (!api.verifyManifest(bytes, new TextDecoder().decode(signature).trim(), publicKey))
478
+ return [];
479
+ return [
480
+ { name: `${channel}.json`, bytes },
481
+ { name: `${channel}.json.sig`, bytes: signature }
482
+ ];
467
483
  }
468
484
  record(signer) {
469
485
  const { platform, arch, channel } = this;
470
486
  const builtAt = new Date(this.manifest.build * 1000).toISOString();
471
- return { schema: 1, cli: AkanAppConfig.akanVersion, platform, arch, channel, signer, builtAt };
487
+ return { schema: 2, cli: AkanAppConfig.akanVersion, platform, arch, channel, signer, builtAt };
472
488
  }
473
489
  async withArchive(record, use) {
474
490
  const tmp = await mkdtemp2(path4.join(os2.tmpdir(), "akan-release-"));
@@ -478,11 +494,11 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
478
494
  try {
479
495
  await tar.add("./release.json", new Blob([`${JSON.stringify(record, null, 2)}
480
496
  `]));
481
- await tar.add(`./${this.channel}.json`, new Blob([this.manifestBytes]));
482
- await tar.add(`./${this.channel}.json.sig`, new Blob([this.signatureBytes]));
497
+ for (const { name, bytes } of this.manifestFiles)
498
+ await tar.add(`./${name}`, new Blob([bytes]));
483
499
  for (const { name, size, sha256 } of this.payloads) {
484
500
  const file = Bun.file(path4.join(this.dir, name));
485
- const what = `${path4.join(this.dir, name)} is not the file ${this.channel}.json names`;
501
+ const what = `${path4.join(this.dir, name)} is not the file ${this.channel}/app.json names`;
486
502
  if (!await file.exists() || file.size !== size)
487
503
  throw new Error(`${what}: publish the release again.`);
488
504
  if (await tar.add(`./${name}`, file) !== sha256)
@@ -507,7 +523,7 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
507
523
  return { signer: null, unread: null };
508
524
  const app = this.manifest.files?.[0]?.path;
509
525
  if (!app || !/^[^/\\]+$/.test(app) || app === "." || app === "..")
510
- return { signer: null, unread: `${this.channel}.json names no app folder` };
526
+ return { signer: null, unread: `${this.channel}/app.json names no app folder` };
511
527
  if (this.platform === "macos" && host !== "darwin")
512
528
  return { signer: null, unread: "codesign reads a macOS app's signer on macOS only" };
513
529
  if (this.platform === "windows" && host !== "win32")
@@ -559,16 +575,11 @@ Set-Content -LiteralPath $env:AKAN_SIGNER_OUT -Value $subject -Encoding UTF8`;
559
575
  const subject = (await readFile(out, "utf8").catch(() => "")).replace(/^\uFEFF/, "").trim();
560
576
  return { signer: subject ? { subject } : null, unread: null };
561
577
  }
562
- static #verifies(manifest, signature, publicKey) {
578
+ static #open(api, envelope, publicKeys, revokedKeys) {
563
579
  try {
564
- const key = createPublicKey({
565
- key: Buffer.concat([DesktopRelease.#ed25519Spki, Buffer.from(publicKey, "base64")]),
566
- format: "der",
567
- type: "spki"
568
- });
569
- return verify(null, manifest, key, Buffer.from(new TextDecoder().decode(signature).trim(), "base64"));
570
- } catch {
571
- return false;
580
+ return api.openEnvelope(new TextDecoder().decode(envelope), publicKeys, revokedKeys).manifest;
581
+ } catch (error) {
582
+ return toError(error).message;
572
583
  }
573
584
  }
574
585
  static #parse(bytes) {
@@ -604,7 +615,7 @@ import path5 from "path";
604
615
 
605
616
  class NativeApi {
606
617
  static supportedMajor = 0;
607
- static minimumVersion = "0.12.0";
618
+ static minimumVersion = "0.13.0";
608
619
  static entryOf(appDir) {
609
620
  const workspaceEntry = NativeApi.#resolve("@akanjs/native/api", appDir);
610
621
  if (workspaceEntry)
@@ -894,7 +905,7 @@ class NativeConfig {
894
905
  static #updates(target, env) {
895
906
  const { url, publicKey, publicKeys, channel = env, ...rest } = target.updates ?? {};
896
907
  const keys = publicKeys ? { publicKeys: [...publicKeys] } : publicKey ? { publicKey } : null;
897
- return url && keys ? { ...rest, url, ...keys, ...channel ? { channel } : {} } : undefined;
908
+ return url && keys ? { ...rest, url, ...keys, ...channel ? { channel } : {}, target: target.name } : undefined;
898
909
  }
899
910
  static fileNameOf(name) {
900
911
  return /[^-.](?:.*[^-.])?/.exec(name.replace(/[^A-Za-z0-9._-]/g, "-"))?.[0] ?? "app";
@@ -1432,18 +1443,25 @@ class NativeApp {
1432
1443
  }
1433
1444
  async publishedRelease(platform, { arch, channel }) {
1434
1445
  this.#assertUpdates();
1435
- const { config } = await this.config({ platform, stageBin: false });
1436
- const publicKey = config.updates?.publicKeys?.[0] ?? config.updates?.publicKey;
1437
- if (!config.updates || !publicKey)
1446
+ const [api, { config }] = await Promise.all([
1447
+ NativeApi.load(this.app.cwdPath),
1448
+ this.config({ platform, stageBin: false })
1449
+ ]);
1450
+ const { updates } = config;
1451
+ const publicKeys = updates?.publicKeys ?? (updates?.publicKey ? [updates.publicKey] : []);
1452
+ if (!updates || !publicKeys.length)
1438
1453
  throw new Error(`Native target '${this.target.name}' has no updates key.`);
1439
1454
  const release = await DesktopRelease.read(this.updatesDir, {
1440
1455
  platform,
1441
1456
  arch,
1442
- channel: channel ?? config.updates.channel ?? "production",
1457
+ channel: channel ?? updates.channel ?? "production",
1443
1458
  appId: config.app.id,
1444
- publicKey
1459
+ ...updates.target ? { target: updates.target } : {},
1460
+ publicKeys,
1461
+ revokedKeys: updates.revokedKeys ?? [],
1462
+ api
1445
1463
  });
1446
- return { release, url: config.updates.url, exeName: config.app.fileName ?? "" };
1464
+ return { release, url: updates.url, exeName: config.app.fileName ?? "" };
1447
1465
  }
1448
1466
  async publishUpdate(platform, {
1449
1467
  channel,
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  DesktopBin
4
- } from "./index-5max10jx.js";
4
+ } from "./index-bt438yxm.js";
5
5
  // pkgs/@akanjs/devkit/mobile/desktopServerStage.ts
6
6
  import { cp, mkdir, readdir, rm, writeFile } from "fs/promises";
7
7
  import path from "path";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./index-3wypz6xj.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-8w76g4rm.js";
13
+ } from "./index-a58emady.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
package/index.js CHANGED
@@ -22,18 +22,18 @@ import path from "path";
22
22
 
23
23
  // pkgs/@akanjs/cli/commandModules.ts
24
24
  var commandModules = {
25
- workspace: async () => (await import("./workspace.command-tsc99yec.js")).WorkspaceCommand,
25
+ workspace: async () => (await import("./workspace.command-qm7cw29v.js")).WorkspaceCommand,
26
26
  agent: async () => (await import("./agent.command-ydftceda.js")).AgentCommand,
27
- code: async () => (await import("./code.command-719k3e9q.js")).CodeCommand,
28
- application: async () => (await import("./application.command-14xsthcr.js")).ApplicationCommand,
27
+ code: async () => (await import("./code.command-9h3yrzhe.js")).CodeCommand,
28
+ application: async () => (await import("./application.command-wthg8nn9.js")).ApplicationCommand,
29
29
  library: async () => (await import("./library.command-gycrwhf1.js")).LibraryCommand,
30
- localRegistry: async () => (await import("./localRegistry.command-2t3fghje.js")).LocalRegistryCommand,
30
+ localRegistry: async () => (await import("./localRegistry.command-jtd8gaes.js")).LocalRegistryCommand,
31
31
  package: async () => (await import("./package.command-shzpcfph.js")).PackageCommand,
32
32
  module: async () => (await import("./module.command-v6hgs1bc.js")).ModuleCommand,
33
33
  page: async () => (await import("./page.command-ptxn5kqk.js")).PageCommand,
34
- context: async () => (await import("./context.command-c4t4z1vy.js")).ContextCommand,
35
- cloud: async () => (await import("./cloud.command-rmw1kcf1.js")).CloudCommand,
36
- subspace: async () => (await import("./subspace.command-kvxmyxtf.js")).SubspaceCommand,
34
+ context: async () => (await import("./context.command-15j9b7c0.js")).ContextCommand,
35
+ cloud: async () => (await import("./cloud.command-sz11hpre.js")).CloudCommand,
36
+ subspace: async () => (await import("./subspace.command-822qx2bx.js")).SubspaceCommand,
37
37
  guideline: async () => (await import("./guideline.command-snh85ctf.js")).GuidelineCommand,
38
38
  scalar: async () => (await import("./scalar.command-0acvyp26.js")).ScalarCommand,
39
39
  primitive: async () => (await import("./primitive.command-a1vse91z.js")).PrimitiveCommand,
@@ -41,7 +41,7 @@ var commandModules = {
41
41
  repair: async () => (await import("./repair.command-cvazbz99.js")).RepairCommand,
42
42
  workflow: async () => (await import("./workflow.command-abb1d5xy.js")).WorkflowCommand,
43
43
  pipeline: async () => (await import("./pipeline.command-zz31pgax.js")).PipelineCommand,
44
- tunnel: async () => (await import("./tunnel.command-kxv0ddmp.js")).TunnelCommand
44
+ tunnel: async () => (await import("./tunnel.command-ycmja19q.js")).TunnelCommand
45
45
  };
46
46
  var commandModuleIds = Object.keys(commandModules);
47
47
 
@@ -10,21 +10,21 @@ import {
10
10
  PkgExecutor
11
11
  } from "./index-wcej7g4z.js";
12
12
  import"./index-5nd1wtkv.js";
13
- import"./index-5max10jx.js";
14
- import"./index-qd5km521.js";
13
+ import"./index-bt438yxm.js";
14
+ import"./index-js6geqjn.js";
15
15
  import"./index-m9jj544v.js";
16
16
  import"./index-xb8809yb.js";
17
17
  import"./index-0fz95kxe.js";
18
18
  import"./index-2xcc2ax5.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-pa3c2mb8.js";
21
+ } from "./index-9th4gszy.js";
22
22
  import"./index-7md2g9vw.js";
23
- import"./index-myc22sgv.js";
23
+ import"./index-2azahjaw.js";
24
24
  import {
25
25
  getNpmRegistryUrl,
26
26
  CloudRunner
27
- } from "./index-0p37cz91.js";
27
+ } from "./index-6txx6a9p.js";
28
28
  import"./index-tvehn2sp.js";
29
29
  import {
30
30
  PackageScript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.1.1-rc.8",
3
+ "version": "3.1.1-rc.9",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -39,7 +39,7 @@
39
39
  "@earendil-works/pi-tui": "1.3.0",
40
40
  "@inquirer/prompts": "^8.7.3",
41
41
  "@tailwindcss/node": "^4.3.3",
42
- "akanjs": "3.1.1-rc.8",
42
+ "akanjs": "3.1.1-rc.9",
43
43
  "chalk": "^6.0.1",
44
44
  "commander": "^15.0.0",
45
45
  "dayjs": "^1.11.23",
@@ -17,9 +17,9 @@ import {
17
17
  } from "./index-wcej7g4z.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-myc22sgv.js";
20
+ } from "./index-2azahjaw.js";
21
21
  import"./index-m9jj544v.js";
22
- import"./index-5max10jx.js";
22
+ import"./index-bt438yxm.js";
23
23
  import"./index-xb8809yb.js";
24
24
  import"./index-0fz95kxe.js";
25
25
  import {
@@ -816,7 +816,7 @@ class SubspaceRunner extends runner("subspace") {
816
816
  if (!asked)
817
817
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
818
818
  const { libs } = await subspace.slice();
819
- const { CloudScript } = await import("./cloud.script-v1ysyerg.js");
819
+ const { CloudScript } = await import("./cloud.script-nqevg5qw.js");
820
820
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
821
821
  host,
822
822
  workspaceId,
@@ -12,14 +12,14 @@ import {
12
12
  import {
13
13
  GlobalConfig,
14
14
  CloudApi
15
- } from "./index-myc22sgv.js";
15
+ } from "./index-2azahjaw.js";
16
16
  import"./index-m9jj544v.js";
17
- import"./index-5max10jx.js";
17
+ import"./index-bt438yxm.js";
18
18
  import"./index-xb8809yb.js";
19
19
  import"./index-0fz95kxe.js";
20
20
  import {
21
21
  TunnelShare2
22
- } from "./index-hmmv2cah.js";
22
+ } from "./index-2mwc0g0d.js";
23
23
  import {
24
24
  writeClipboard
25
25
  } from "./index-p6pbz9n5.js";
@@ -36,8 +36,8 @@ import {
36
36
  AgentScript
37
37
  } from "./index-4vgbysa0.js";
38
38
  import"./index-5nd1wtkv.js";
39
- import"./index-5max10jx.js";
40
- import"./index-qd5km521.js";
39
+ import"./index-bt438yxm.js";
40
+ import"./index-js6geqjn.js";
41
41
  import"./index-m9jj544v.js";
42
42
  import"./index-xb8809yb.js";
43
43
  import"./index-0fz95kxe.js";
@@ -46,9 +46,9 @@ import {
46
46
  } from "./index-2xcc2ax5.js";
47
47
  import {
48
48
  ApplicationScript
49
- } from "./index-pa3c2mb8.js";
49
+ } from "./index-9th4gszy.js";
50
50
  import"./index-7md2g9vw.js";
51
- import"./index-myc22sgv.js";
51
+ import"./index-2azahjaw.js";
52
52
  import"./index-tvehn2sp.js";
53
53
  import {
54
54
  PackageScript
@@ -56,11 +56,11 @@ import {
56
56
  import {
57
57
  getNpmRegistryUrl,
58
58
  getLatestPackageVersion
59
- } from "./index-0p37cz91.js";
59
+ } from "./index-6txx6a9p.js";
60
60
  import {
61
61
  CloudScript2
62
- } from "./index-mdqr41sp.js";
63
- import"./index-8w76g4rm.js";
62
+ } from "./index-301pdbzz.js";
63
+ import"./index-a58emady.js";
64
64
  import"./index-j9vyj3dj.js";
65
65
  import"./index-905qdgqp.js";
66
66
  import"./index-hmt54t45.js";
@@ -69,7 +69,7 @@ import"./index-skk9zc1x.js";
69
69
  import"./index-b70zct19.js";
70
70
  import {
71
71
  ContextScript
72
- } from "./index-zrte51fn.js";
72
+ } from "./index-qfp55x1y.js";
73
73
  import"./index-pcwzkdqb.js";
74
74
 
75
75
  // pkgs/@akanjs/cli/workspace/workspace.runner.ts