@akanjs/cli 3.1.0-rc.8 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-rkjyxgec.js → CodeAgent-c53dm40p.js} +2 -2
  3. package/{CodeAgentRpcHost-p7h6n2hp.js → CodeAgentRpcHost-9g27hmer.js} +1 -1
  4. package/{CodeTui-h7pyj6xa.js → CodeTui-xz9jtrn3.js} +47 -4
  5. package/README.ko.md +1 -1
  6. package/README.md +1 -1
  7. package/TunnelShare-59zd4j8n.js +14 -0
  8. package/{agent.command-3qxf4xcj.js → agent.command-qawf7z4s.js} +5 -5
  9. package/akanCode.js +7 -5
  10. package/{application.command-m1kcd7jf.js → application.command-jqrgqk6j.js} +35 -9
  11. package/{applicationBuildRunner-dj0xkrep.js → applicationBuildRunner-grgrey5c.js} +23 -8
  12. package/buildBatch.proc.js +9 -9
  13. package/{cloud.command-3jzym8q7.js → cloud.command-p9067ssj.js} +13 -13
  14. package/cloud.script-f0r4ce7j.js +24 -0
  15. package/{code.command-0ad6gw2a.js → code.command-t6j55sbk.js} +25 -12
  16. package/commandManifest.json +1 -1
  17. package/{context.command-0qx447mb.js → context.command-eqbzbgth.js} +16 -16
  18. package/context.runner-1cs88ags.js +25 -0
  19. package/{guideline.command-cv5bmrx2.js → guideline.command-w905q73w.js} +2 -2
  20. package/guidelines/agentRule/agentRule.instruction.md +25 -10
  21. package/guidelines/conventions/conventions.instruction.md +71 -24
  22. package/guidelines/fieldRule/fieldRule.instruction.md +17 -0
  23. package/guidelines/mcpRule/mcpRule.instruction.md +93 -48
  24. package/guidelines/modelDocument/modelDocument.instruction.md +2 -1
  25. package/guidelines/modelStore/modelStore.instruction.md +7 -0
  26. package/guidelines/pageRule/pageRule.instruction.md +55 -8
  27. package/guidelines/queryRule/queryRule.instruction.md +24 -10
  28. package/guidelines/runtimeRule/runtimeRule.instruction.md +12 -4
  29. package/guidelines/ssrRule/ssrRule.instruction.md +9 -6
  30. package/guidelines/transportRule/transportRule.instruction.md +36 -5
  31. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +5 -3
  32. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +28 -8
  33. package/incrementalBuilder.proc.js +3 -3
  34. package/{index-j4mkhz93.js → index-0dd6z4b9.js} +3 -3
  35. package/{index-h47cf1gg.js → index-1de5f0qq.js} +7 -7
  36. package/{index-6xn2n442.js → index-1enc9rga.js} +4 -4
  37. package/index-25ks6x4k.js +643 -0
  38. package/{index-wa5jbxj1.js → index-2mrn1mrg.js} +1 -0
  39. package/{index-qwa5k1j8.js → index-3aynkpf8.js} +1 -1
  40. package/{index-vk0pa0mn.js → index-3hvmytbs.js} +2 -1
  41. package/{index-w44cy4vs.js → index-45c0mxb6.js} +2 -2
  42. package/{index-fyq1z6kt.js → index-48n4yhm4.js} +3 -3
  43. package/{index-192ha4xh.js → index-64pjry21.js} +1 -1
  44. package/{index-5edzv8fn.js → index-aqwdjn4x.js} +2 -2
  45. package/{index-d2242ksy.js → index-at7bz0xq.js} +3 -0
  46. package/{index-9z426msb.js → index-avjqbtkj.js} +7 -6
  47. package/{index-20bxxyvn.js → index-bs9yr4we.js} +40 -2
  48. package/{index-d72hfmdm.js → index-cgexcnwd.js} +8 -8
  49. package/{index-1xj2t7cb.js → index-dkfadmrx.js} +7 -7
  50. package/{index-35hc95h5.js → index-eabfsarf.js} +1 -1
  51. package/{index-pydbnfez.js → index-er62k6w3.js} +35 -9
  52. package/{index-1p98exm2.js → index-f2gfq0yh.js} +2 -2
  53. package/{index-jw1zm273.js → index-fbw3kmt5.js} +54 -10
  54. package/{index-4mhy6qme.js → index-fnqj2d2w.js} +4 -4
  55. package/{index-awbdfcf2.js → index-hqh4mpgt.js} +4 -4
  56. package/{index-fmzcs8v6.js → index-j4dzazmw.js} +4 -4
  57. package/{index-va06nr10.js → index-n8dsax1f.js} +64 -19
  58. package/{index-g1mbppa9.js → index-nr8m4j21.js} +5 -5
  59. package/{index-86jt2a0e.js → index-qh73jnyb.js} +1 -1
  60. package/{index-8fp3b47h.js → index-vtj332gj.js} +281 -46
  61. package/{index-tamvyvj3.js → index-wt7m1hfc.js} +3 -3
  62. package/{index-cpb3nvma.js → index-yfy3t4kw.js} +2 -2
  63. package/{index-trpasv9q.js → index-yyxy7aff.js} +1 -1
  64. package/{index-d47ypebv.js → index-z5cxrbvv.js} +75 -19
  65. package/index.js +40 -22
  66. package/{library.command-erp2f56n.js → library.command-z1v7zepj.js} +3 -3
  67. package/{localRegistry.command-xxpqgxjw.js → localRegistry.command-48n23bjy.js} +12 -12
  68. package/{module.command-gs2r615e.js → module.command-rv307dk7.js} +5 -5
  69. package/{package.command-7343f74r.js → package.command-7xkzc8m1.js} +3 -3
  70. package/package.json +22 -22
  71. package/{page.command-4h4a8pnh.js → page.command-34hpdt7v.js} +3 -3
  72. package/{pipeline.command-a2nrk26m.js → pipeline.command-ckvhrpyg.js} +2 -2
  73. package/{primitive.command-w6t0asqz.js → primitive.command-em0twr5a.js} +6 -6
  74. package/{projectTypecheck-f534enqj.js → projectTypecheck-fy6hn05y.js} +1 -1
  75. package/{quality.command-77x7vbbx.js → quality.command-c6p2819k.js} +2 -2
  76. package/{repair.command-y6sstev7.js → repair.command-j6czdgrv.js} +5 -5
  77. package/{routeSourceValidator-7ycnfz0e.js → routeSourceValidator-6jd0q6r6.js} +47 -14
  78. package/{scalar.command-20b8cy0k.js → scalar.command-17e20sj2.js} +4 -4
  79. package/skills/akan-code/SKILL.md +4 -0
  80. package/skills/akan-store/SKILL.md +4 -2
  81. package/{subspace.command-92xkc0s0.js → subspace.command-n3j7vv0w.js} +8 -17
  82. package/templates/migration/__migrationId__.ts +23 -0
  83. package/templates/server.ts +8 -1
  84. package/templates/workspaceRoot/.gitignore.template +1 -1
  85. package/templates/workspaceRoot/biome.json.template +1 -1
  86. package/{tunnel.command-2kw8vt9g.js → tunnel.command-cm578f4s.js} +7 -7
  87. package/{workflow.command-2djwmpqf.js → workflow.command-h9vkr6jb.js} +10 -10
  88. package/{workspace.command-5se6spqb.js → workspace.command-tp8ysvjs.js} +30 -28
  89. package/TunnelShare-661cxz5e.js +0 -14
  90. package/cloud.script-r4nskbc6.js +0 -24
  91. package/context.runner-1vsjztjg.js +0 -25
  92. package/index-665zp9rs.js +0 -271
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- 3635a63bc83f65e4da1346c9e7ab1f80ae3486df535a61e9b25622ea7c155c2f
1
+ fb5b6641f9bed488754323089b9882e5e7bcc8b1410fd52f7334ee0e3eb64fc6
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgent2
4
- } from "./index-8fp3b47h.js";
5
- import"./index-20bxxyvn.js";
4
+ } from "./index-vtj332gj.js";
5
+ import"./index-bs9yr4we.js";
6
6
  import"./index-7md2g9vw.js";
7
7
  export {
8
8
  CodeAgent2 as CodeAgent
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgentRpcHost2
4
- } from "./index-d2242ksy.js";
4
+ } from "./index-at7bz0xq.js";
5
5
  export {
6
6
  CodeAgentRpcHost2 as CodeAgentRpcHost
7
7
  };
@@ -3,8 +3,9 @@ import {
3
3
  SubagentPool2,
4
4
  McpServerConfig,
5
5
  McpTokenStore,
6
- McpSignIn
7
- } from "./index-20bxxyvn.js";
6
+ McpSignIn,
7
+ AkanCodeCompaction2
8
+ } from "./index-bs9yr4we.js";
8
9
  import {
9
10
  CodeTuiLines2,
10
11
  CodeTuiAgents2,
@@ -14,7 +15,7 @@ import {
14
15
  CodeTuiFiles2,
15
16
  CodeTuiMarkdown2,
16
17
  CodeTuiParts2
17
- } from "./index-wa5jbxj1.js";
18
+ } from "./index-2mrn1mrg.js";
18
19
  import {
19
20
  openBrowser
20
21
  } from "./index-9dp031by.js";
@@ -345,6 +346,34 @@ var CodeTuiApp = ({ actions }) => {
345
346
  }, undefined, true, undefined, this);
346
347
  };
347
348
 
349
+ // pkgs/@akanjs/cli/code/CodeTuiAutoCompact.ts
350
+ class CodeTuiAutoCompact {
351
+ static parse(argument) {
352
+ const percent = Number(argument.trim().replace(/%$/, ""));
353
+ return argument.trim() && AkanCodeCompaction2.isStep(percent) ? percent : undefined;
354
+ }
355
+ static describe(info) {
356
+ const percent = info?.autoCompactAt;
357
+ const label = `autocompact ${percent ? `${percent}%` : "default"}`;
358
+ const window = info?.contextTokens;
359
+ if (!window)
360
+ return label;
361
+ const threshold = AkanCodeCompaction2.thresholdOf(window, percent);
362
+ const k = (tokens) => `${Math.round(tokens / 1000)}k`;
363
+ const capped = percent && threshold < Math.floor(window * percent / 100) ? `, the latest that still leaves ${k(window - threshold)} for the reply` : "";
364
+ return `${label} \xB7 compacts above ${k(threshold)} of ${k(window)}${capped}`;
365
+ }
366
+ static usage(info) {
367
+ return [
368
+ "Usage: /autocompact <percent>",
369
+ "",
370
+ `now: ${CodeTuiAutoCompact.describe(info)}`,
371
+ `${AkanCodeCompaction2.steps.join(" \xB7 ")} \u2014 100 is the default`
372
+ ].join(`
373
+ `);
374
+ }
375
+ }
376
+
348
377
  // pkgs/@akanjs/cli/code/CodeTuiMcp.ts
349
378
  class CodeTuiMcp {
350
379
  static namePattern = /^[a-zA-Z0-9_-]+$/;
@@ -897,7 +926,8 @@ class CodeTui {
897
926
  const context = this.#transcript.context;
898
927
  const window = info.contextTokens ? `${Math.round(info.contextTokens / 1000)}k` : "";
899
928
  const used = context?.max ? `${Math.round(context.used / context.max * 100)}% of ${window}` : "";
900
- return [info.model?.name ?? "no model", used || window && `${window} ctx`, info.profile, info.effort].filter((part) => !!part).join(" \xB7 ");
929
+ const compactsAt = info.autoCompactAt ? `compacts at ${info.autoCompactAt}%` : "";
930
+ return [info.model?.name ?? "no model", used || window && `${window} ctx`, compactsAt, info.profile, info.effort].filter((part) => !!part).join(" \xB7 ");
901
931
  }
902
932
  #status() {
903
933
  if (this.#transcript.compacting)
@@ -1248,6 +1278,8 @@ class CodeTui {
1248
1278
  return this.#say("screen cleared \xB7 the model still remembers \xB7 /compact shortens what it carries");
1249
1279
  case "compact":
1250
1280
  return void this.#agent.compact(argument || undefined).catch((error) => this.#fail(error));
1281
+ case "autocompact":
1282
+ return this.#setAutoCompact(argument);
1251
1283
  case "thinking":
1252
1284
  this.#thinking = !this.#thinking;
1253
1285
  return this.#say(this.#thinking ? "showing the model's reasoning" : "reasoning folded back to one line");
@@ -1410,6 +1442,17 @@ ${levels.join(" \xB7 ")}`);
1410
1442
  this.#fail(error);
1411
1443
  }
1412
1444
  }
1445
+ #setAutoCompact(argument) {
1446
+ const percent = CodeTuiAutoCompact.parse(argument);
1447
+ if (percent === undefined)
1448
+ return this.#open("autocompact", CodeTuiAutoCompact.usage(this.#transcript.info));
1449
+ try {
1450
+ this.#agent.setAutoCompactAt(percent);
1451
+ this.#say(CodeTuiAutoCompact.describe(this.#transcript.info));
1452
+ } catch (error) {
1453
+ this.#fail(error);
1454
+ }
1455
+ }
1413
1456
  #setModel(argument) {
1414
1457
  const wanted = argument.trim();
1415
1458
  const [provider, ...rest] = wanted.split("/");
package/README.ko.md CHANGED
@@ -118,7 +118,7 @@ Akan 프레임워크 패키지는 `dist/pkgs/*`에서만 배포합니다. `verif
118
118
 
119
119
  ## 요구사항
120
120
 
121
- - [Bun](https://bun.sh) `>=1.4.0`
121
+ - [Bun](https://bun.sh) `>=1.4.4`
122
122
  - TypeScript Akan 워크스페이스
123
123
  - 네이티브 빌드: Xcode(iOS), Android SDK와 JDK 21(Android), Rust(데스크톱)
124
124
 
package/README.md CHANGED
@@ -119,7 +119,7 @@ artifact is built last and is not overwritten by the root `akan` bootstrap scrip
119
119
 
120
120
  ## Requirements
121
121
 
122
- - [Bun](https://bun.sh) `>=1.4.0`
122
+ - [Bun](https://bun.sh) `>=1.4.4`
123
123
  - A TypeScript Akan workspace
124
124
  - For native builds: Xcode (iOS), the Android SDK and JDK 21 (Android), or Rust (desktop)
125
125
 
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ import {
3
+ TunnelShare2
4
+ } from "./index-3aynkpf8.js";
5
+ import"./index-yfy3t4kw.js";
6
+ import"./index-nr8m4j21.js";
7
+ import"./index-m9jj544v.js";
8
+ import"./index-25ks6x4k.js";
9
+ import"./index-64pjry21.js";
10
+ import"./index-n8dsax1f.js";
11
+ import"./index-52w0fvh8.js";
12
+ export {
13
+ TunnelShare2 as TunnelShare
14
+ };
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-fbw3kmt5.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-va06nr10.js";
7
+ import"./index-n8dsax1f.js";
8
8
  import"./index-hj6w4ka1.js";
9
- import"./index-trpasv9q.js";
10
- import"./index-5edzv8fn.js";
9
+ import"./index-yyxy7aff.js";
10
+ import"./index-aqwdjn4x.js";
11
11
  import"./index-zzvvc845.js";
12
12
  import {
13
13
  AgentScript
14
- } from "./index-tamvyvj3.js";
14
+ } from "./index-wt7m1hfc.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/agent/agent.command.ts
17
17
  class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
package/akanCode.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  CodeMailbox2,
29
29
  CodeSessionFork2,
30
30
  CodeAgent2
31
- } from "./index-8fp3b47h.js";
31
+ } from "./index-vtj332gj.js";
32
32
  import {
33
33
  akanCodeDefaultModel2,
34
34
  akanCodeModel2,
@@ -38,12 +38,13 @@ import {
38
38
  } from "./index-c6eggbee.js";
39
39
  import {
40
40
  SubagentPool2,
41
- akanCodePaths2
42
- } from "./index-20bxxyvn.js";
41
+ akanCodePaths2,
42
+ AkanCodeCompaction2
43
+ } from "./index-bs9yr4we.js";
43
44
  import"./index-7md2g9vw.js";
44
45
  import {
45
46
  CodeAgentRpcHost2
46
- } from "./index-d2242ksy.js";
47
+ } from "./index-at7bz0xq.js";
47
48
  import {
48
49
  CodeTuiLines2,
49
50
  CodeTuiAgents2,
@@ -53,9 +54,10 @@ import {
53
54
  CodeTuiFiles2,
54
55
  CodeTuiMarkdown2,
55
56
  CodeTuiParts2
56
- } from "./index-wa5jbxj1.js";
57
+ } from "./index-2mrn1mrg.js";
57
58
  export {
58
59
  AkanCli2 as AkanCli,
60
+ AkanCodeCompaction2 as AkanCodeCompaction,
59
61
  AkanCodePlugins2 as AkanCodePlugins,
60
62
  AkanCodeServices2 as AkanCodeServices,
61
63
  AkanEditScope2 as AkanEditScope,
@@ -7,18 +7,19 @@ import {
7
7
  Exec,
8
8
  Workspace,
9
9
  command
10
- } from "./index-jw1zm273.js";
10
+ } from "./index-fbw3kmt5.js";
11
11
  import"./index-52w0fvh8.js";
12
- import"./index-va06nr10.js";
12
+ import"./index-n8dsax1f.js";
13
13
  import"./index-5nd1wtkv.js";
14
- import"./index-vk0pa0mn.js";
14
+ import"./index-3hvmytbs.js";
15
15
  import"./index-m9jj544v.js";
16
- import"./index-g1mbppa9.js";
17
- import"./index-192ha4xh.js";
18
- import"./index-pydbnfez.js";
16
+ import"./index-nr8m4j21.js";
17
+ import"./index-25ks6x4k.js";
18
+ import"./index-64pjry21.js";
19
+ import"./index-er62k6w3.js";
19
20
  import {
20
21
  ApplicationScript
21
- } from "./index-d47ypebv.js";
22
+ } from "./index-z5cxrbvv.js";
22
23
  import"./index-7md2g9vw.js";
23
24
  import {
24
25
  writeOption,
@@ -27,10 +28,11 @@ import {
27
28
  allowLocalOption,
28
29
  publicEnvOption
29
30
  } from "./index-mdjc93e1.js";
30
- import"./index-35hc95h5.js";
31
- import"./index-665zp9rs.js";
31
+ import"./index-eabfsarf.js";
32
32
 
33
33
  // pkgs/@akanjs/cli/application/application.command.ts
34
+ import { MigrationCommand } from "akanjs/server/migration/migrationCommand";
35
+ import { MigrationError } from "akanjs/server/migration/migrationError";
34
36
  var deviceOption = {
35
37
  desc: "simulator, emulator or device to run on: its id or name (e.g. 'iPhone 17' or 'Pixel_10')",
36
38
  default: ""
@@ -62,6 +64,30 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
62
64
  script: target({ desc: "Run a custom script in the application" }).with(App).arg("filename", String, { desc: "name of script", nullable: true }).exec(async function(app, filename) {
63
65
  await this.applicationScript.script(app, filename);
64
66
  }),
67
+ migrate: target({
68
+ desc: "List, plan, apply, verify or roll back the app's data migrations in script/migration",
69
+ stdio: true,
70
+ usageExitCode: 2,
71
+ onFailure: async (error, { usage, given }) => {
72
+ if (given.json !== true)
73
+ return;
74
+ const failure = usage ? new MigrationError("usage", MigrationError.messageOf(error)) : error;
75
+ await MigrationCommand.print(MigrationCommand.failure(null, failure), true);
76
+ }
77
+ }).with(App).arg("action", String, { desc: "list, plan, apply, verify or rollback", default: "list" }).arg("target", String, { desc: "migration id; for rollback, an apply's run id too", nullable: true }).option("param", String, { desc: "a param the migration declares, as name=value", multiple: true }).option("expect", String, { desc: "the plan hash an apply must still match", nullable: true }).option("items", Number, { desc: "how many planned decisions to print", nullable: true }).option("actor", String, { desc: "who runs it, as the ledger records", nullable: true }).option("json", Boolean, { desc: "print the result as one JSON line", default: false }).exec(async function(app, action, target, param, expect, items, actor, json) {
78
+ await this.applicationScript.migrate(app, [
79
+ action,
80
+ ...target ? [target] : [],
81
+ ...param.map((each) => `--param=${each}`),
82
+ ...expect ? [`--expect=${expect}`] : [],
83
+ ...items === null ? [] : [`--items=${items}`],
84
+ ...actor ? [`--actor=${actor}`] : [],
85
+ ...json ? ["--json"] : []
86
+ ]);
87
+ }),
88
+ createMigration: target({ desc: "Create a data migration in the app's script/migration" }).arg("migrationName", String, { desc: "what it does, in camelCase", example: "bizLicenseOwnership" }).with(App).exec(async function(migrationName, app) {
89
+ await this.applicationScript.createMigration(app, migrationName);
90
+ }),
65
91
  console: target({ desc: "Open an interactive server console for the application" }).with(App).exec(async function(app) {
66
92
  await this.applicationScript.console(app);
67
93
  }),
@@ -4,20 +4,20 @@ import {
4
4
  Spinner,
5
5
  ProjectTypecheck2,
6
6
  WorkspaceExecutor
7
- } from "./index-va06nr10.js";
7
+ } from "./index-n8dsax1f.js";
8
8
  import"./index-52w0fvh8.js";
9
- import"./index-w44cy4vs.js";
10
- import"./index-192ha4xh.js";
9
+ import"./index-45c0mxb6.js";
10
+ import"./index-64pjry21.js";
11
11
  import {
12
12
  AllRoutesBuilder,
13
13
  FontPruner,
14
14
  precompressArtifacts,
15
15
  SsrBaseArtifactBuilder
16
- } from "./index-9z426msb.js";
17
- import"./index-62md4dwy.js";
16
+ } from "./index-avjqbtkj.js";
18
17
  import {
19
18
  CsrArtifactBuilder
20
- } from "./index-665zp9rs.js";
19
+ } from "./index-25ks6x4k.js";
20
+ import"./index-62md4dwy.js";
21
21
 
22
22
  // pkgs/@akanjs/devkit/applicationBuildRunner.ts
23
23
  import path2 from "path";
@@ -124,12 +124,26 @@ class ApplicationBuildRunner {
124
124
  get #envDir() {
125
125
  return path2.join(this.#app.cwdPath, "env");
126
126
  }
127
+ #pinImageEnv(baseDevEnv, environment) {
128
+ const imageEnv = {
129
+ AKAN_PUBLIC_ENV: environment,
130
+ AKAN_PUBLIC_REPO_NAME: baseDevEnv.repoName,
131
+ AKAN_PUBLIC_SERVE_DOMAIN: baseDevEnv.serveDomain
132
+ };
133
+ const outranked = Object.entries(imageEnv).filter(([key, value]) => {
134
+ const given = process.env[key];
135
+ return !!given && given !== value && !(key === "AKAN_PUBLIC_ENV" && this.#environment);
136
+ });
137
+ if (outranked.length)
138
+ this.#app.logger.warn(`The workspace .env outranks this process's environment: the bundles and the image take ${outranked.map(([key, value]) => `${key}=${value} (not ${process.env[key]})`).join(", ")}.`);
139
+ Object.assign(process.env, imageEnv);
140
+ }
127
141
  async build({ spinner = false } = {}) {
128
142
  this.#spinner = spinner;
129
143
  const { web, assets, baseDevEnv } = await this.#app.getConfig();
130
144
  const environment = this.#environment ?? baseDevEnv.env;
131
145
  WorkspaceExecutor.assertDeployableEnv(baseDevEnv, environment, "akan build");
132
- process.env.AKAN_PUBLIC_ENV = environment;
146
+ this.#pinImageEnv(baseDevEnv, environment);
133
147
  if (this.#profile)
134
148
  await ServerEnvProfile.assertShippable({ envDir: this.#envDir, environment, profile: this.#profile });
135
149
  await this.#runPhase("prepare", "Preparing output directory", () => this.#app.prepareCommand("build"));
@@ -317,7 +331,8 @@ void run().catch((error) => {
317
331
  return { base, allRoutes };
318
332
  }
319
333
  async#buildOrThrow(label, config) {
320
- const metafileDir = process.env.AKAN_BUILD_METAFILE ? path2.join(this.#app.workspace.workspaceRoot, "local", "build-meta", path2.basename(this.#app.cwdPath)) : null;
334
+ const flag = process.env.AKAN_BUILD_METAFILE;
335
+ const metafileDir = flag && flag !== "0" && flag !== "false" ? path2.join(this.#app.workspace.workspaceRoot, "local", "build-meta", path2.basename(this.#app.cwdPath)) : null;
321
336
  const result = await Bun.build(metafileDir ? { ...config, metafile: true } : config);
322
337
  if (!result.success)
323
338
  throw new AggregateError(result.logs, `[${label}] Bun.build failed`);
@@ -6,27 +6,27 @@ import {
6
6
  resolveSsrPageEntriesForApp,
7
7
  WorkspaceExecutor,
8
8
  AppExecutor
9
- } from "./index-va06nr10.js";
9
+ } from "./index-n8dsax1f.js";
10
10
  import {
11
11
  computeRouteSeedIndex,
12
12
  saveRouteSeedIndex,
13
13
  CsrDevBundler,
14
14
  SsrDevBundler
15
- } from "./index-w44cy4vs.js";
15
+ } from "./index-45c0mxb6.js";
16
16
  import"./index-52w0fvh8.js";
17
17
  import {
18
18
  ServerGraphFile,
19
19
  PagesBundleBuilder
20
- } from "./index-192ha4xh.js";
20
+ } from "./index-64pjry21.js";
21
21
  import {
22
22
  CssCompiler,
23
23
  FontOptimizer,
24
24
  SsrBaseArtifactBuilder
25
- } from "./index-9z426msb.js";
26
- import"./index-62md4dwy.js";
25
+ } from "./index-avjqbtkj.js";
27
26
  import {
28
27
  CsrArtifactBuilder
29
- } from "./index-665zp9rs.js";
28
+ } from "./index-25ks6x4k.js";
29
+ import"./index-62md4dwy.js";
30
30
 
31
31
  // pkgs/@akanjs/devkit/incrementalBuilder/buildBatch.proc.ts
32
32
  import path from "path";
@@ -116,10 +116,10 @@ class BuildBatch {
116
116
  async#buildShell() {
117
117
  const started = Date.now();
118
118
  try {
119
- await new CsrArtifactBuilder(this.#app, "start", "en", { cssAssets: this.#request.cssAssets }).build();
120
- this.#logger.verbose(`csr-shell ok (${Date.now() - started}ms)`);
119
+ await new CsrArtifactBuilder(this.#app, "start", "en", { cssAssets: this.#request.cssAssets }).buildMcpAppViews();
120
+ this.#logger.verbose(`mcp-app-views ok (${Date.now() - started}ms)`);
121
121
  } catch (err) {
122
- this.#fail("shell", "csr-shell", err);
122
+ this.#fail("shell", "mcp-app-views", err);
123
123
  }
124
124
  }
125
125
  async#rebuildCsrArtifact(started) {
@@ -3,26 +3,27 @@ import {
3
3
  App,
4
4
  Workspace,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
9
- import"./index-cpb3nvma.js";
8
+ import"./index-n8dsax1f.js";
9
+ import"./index-yfy3t4kw.js";
10
10
  import {
11
11
  PlatformTestRun
12
- } from "./index-fyq1z6kt.js";
13
- import"./index-vk0pa0mn.js";
12
+ } from "./index-48n4yhm4.js";
13
+ import"./index-3hvmytbs.js";
14
14
  import"./index-m9jj544v.js";
15
- import"./index-g1mbppa9.js";
16
- import"./index-192ha4xh.js";
15
+ import"./index-nr8m4j21.js";
16
+ import"./index-25ks6x4k.js";
17
+ import"./index-64pjry21.js";
17
18
  import"./index-5nd1wtkv.js";
18
- import"./index-pydbnfez.js";
19
- import"./index-d47ypebv.js";
19
+ import"./index-er62k6w3.js";
20
+ import"./index-z5cxrbvv.js";
20
21
  import"./index-7md2g9vw.js";
21
22
  import"./index-tvehn2sp.js";
22
- import"./index-6xn2n442.js";
23
+ import"./index-1enc9rga.js";
23
24
  import {
24
25
  CloudScript2
25
- } from "./index-h47cf1gg.js";
26
+ } from "./index-1de5f0qq.js";
26
27
  import {
27
28
  writeOption,
28
29
  oneNativeTargetOption,
@@ -33,8 +34,7 @@ import {
33
34
  hostOption,
34
35
  subspaceOption
35
36
  } from "./index-mdjc93e1.js";
36
- import"./index-35hc95h5.js";
37
- import"./index-665zp9rs.js";
37
+ import"./index-eabfsarf.js";
38
38
 
39
39
  // pkgs/@akanjs/cli/cloud/cloud.command.ts
40
40
  var localRegistryUrl = () => process.env.AKAN_NPM_REGISTRY ?? "http://127.0.0.1:4873";
@@ -0,0 +1,24 @@
1
+ // @bun
2
+ import {
3
+ CloudScript2
4
+ } from "./index-1de5f0qq.js";
5
+ import"./index-48n4yhm4.js";
6
+ import"./index-z5cxrbvv.js";
7
+ import"./index-eabfsarf.js";
8
+ import"./index-er62k6w3.js";
9
+ import"./index-1enc9rga.js";
10
+ import"./index-3hvmytbs.js";
11
+ import"./index-yfy3t4kw.js";
12
+ import"./index-nr8m4j21.js";
13
+ import"./index-m9jj544v.js";
14
+ import"./index-fbw3kmt5.js";
15
+ import"./index-7md2g9vw.js";
16
+ import"./index-25ks6x4k.js";
17
+ import"./index-5nd1wtkv.js";
18
+ import"./index-64pjry21.js";
19
+ import"./index-n8dsax1f.js";
20
+ import"./index-tvehn2sp.js";
21
+ import"./index-52w0fvh8.js";
22
+ export {
23
+ CloudScript2 as CloudScript
24
+ };
@@ -4,9 +4,9 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-jw1zm273.js";
7
+ } from "./index-fbw3kmt5.js";
8
8
  import"./index-52w0fvh8.js";
9
- import"./index-va06nr10.js";
9
+ import"./index-n8dsax1f.js";
10
10
  import {
11
11
  akanCodeDefaultModel2,
12
12
  CodeAgentStreamPrinter2
@@ -19,8 +19,8 @@ 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-rkjyxgec.js"),
23
- import("./CodeAgentRpcHost-p7h6n2hp.js"),
22
+ import("./CodeAgent-c53dm40p.js"),
23
+ import("./CodeAgentRpcHost-9g27hmer.js"),
24
24
  import("./CodeAgentRpcListener-7p7z5dd7.js")
25
25
  ]);
26
26
  const address = listen ? CodeAgentRpcListener.parse(listen) : null;
@@ -34,21 +34,28 @@ class CodeRunner extends runner("code") {
34
34
  }
35
35
  async tui(options, seed) {
36
36
  const [{ CodeAgent }, { CodeTui }] = await Promise.all([
37
- import("./CodeAgent-rkjyxgec.js"),
38
- import("./CodeTui-h7pyj6xa.js")
37
+ import("./CodeAgent-c53dm40p.js"),
38
+ import("./CodeTui-xz9jtrn3.js")
39
39
  ]);
40
40
  const agentOptions = await CodeRunner.#agentOptions(options, false);
41
41
  let resume = options.resume;
42
+ let autoCompactAt = agentOptions.autoCompactAt;
42
43
  let prompt = seed;
43
44
  let notice;
44
45
  for (;; ) {
45
- const agent = await CodeAgent.create({ ...agentOptions, mode: "tui", ...resume ? { resume } : {} });
46
+ const agent = await CodeAgent.create({
47
+ ...agentOptions,
48
+ mode: "tui",
49
+ ...resume ? { resume } : {},
50
+ ...autoCompactAt ? { autoCompactAt } : {}
51
+ });
46
52
  let next;
47
53
  try {
48
54
  next = await new CodeTui(agent, {
49
55
  thinking: options.thinking,
50
56
  ...notice ? { notice } : {}
51
57
  }).run(prompt);
58
+ autoCompactAt = agent.info.autoCompactAt;
52
59
  } finally {
53
60
  agent.dispose();
54
61
  }
@@ -60,7 +67,7 @@ class CodeRunner extends runner("code") {
60
67
  }
61
68
  }
62
69
  async run(prompt, options) {
63
- const { CodeAgent } = await import("./CodeAgent-rkjyxgec.js");
70
+ const { CodeAgent } = await import("./CodeAgent-c53dm40p.js");
64
71
  const agent = await CodeAgent.create(await CodeRunner.#agentOptions(options, false));
65
72
  const printer = new CodeAgentStreamPrinter2({ json: options.json, thinking: options.thinking });
66
73
  agent.on((event) => printer.print(event));
@@ -80,7 +87,8 @@ class CodeRunner extends runner("code") {
80
87
  cwd: profile.paths.root,
81
88
  profile,
82
89
  apps: options.app ? [options.app] : await options.workspace.getApps(),
83
- model: CodeRunner.modelOf(options.model)
90
+ model: CodeRunner.modelOf(options.model),
91
+ ...options.compactAt !== undefined ? { autoCompactAt: options.compactAt } : {}
84
92
  };
85
93
  }
86
94
  static profileOf(options, { hostAttached }) {
@@ -116,6 +124,7 @@ class CodeScript extends script("code", [CodeRunner]) {
116
124
  ...options.app ? { app: options.app } : {},
117
125
  profile: options.profile,
118
126
  ...options.model ? { model: options.model } : {},
127
+ ...options.compactAt !== null ? { compactAt: options.compactAt } : {},
119
128
  json: options.json,
120
129
  thinking: options.thinking,
121
130
  ...options.resume ? { resume: options.resume } : {}
@@ -135,7 +144,11 @@ class CodeScript extends script("code", [CodeRunner]) {
135
144
 
136
145
  // pkgs/@akanjs/cli/code/code.command.ts
137
146
  class CodeCommand extends command("code", [CodeScript], ({ public: target }) => ({
138
- code: target({ desc: "Run the akan coding agent on a prompt" }).arg("prompt", String, { desc: "what the agent should do", nullable: true }).option("app", String, { desc: "narrow the agent to one app instead of the whole repo", nullable: true }).option("profile", String, { desc: "local, pod, review, or web", default: "local" }).option("model", String, { desc: "<provider>/<id>, e.g. deepseek/deepseek-flash", nullable: true }).option("json", Boolean, { desc: "print one event per line as JSON", default: false }).option("thinking", Boolean, { desc: "print the model's reasoning", default: false }).option("rpc", Boolean, { desc: "serve the agent over stdio for another process to drive", default: false }).option("rpcListen", String, {
147
+ code: target({ desc: "Run the akan coding agent on a prompt" }).arg("prompt", String, { desc: "what the agent should do", nullable: true }).option("app", String, { desc: "narrow the agent to one app instead of the whole repo", nullable: true }).option("profile", String, { desc: "local, pod, review, or web", default: "local" }).option("model", String, { desc: "<provider>/<id>, e.g. deepseek/deepseek-flash", nullable: true }).option("compactAt", Number, {
148
+ desc: "compact once the context window is this full, in percent: 10, 20, \u2026 100",
149
+ flag: "c",
150
+ nullable: true
151
+ }).option("json", Boolean, { desc: "print one event per line as JSON", default: false }).option("thinking", Boolean, { desc: "print the model's reasoning", default: false }).option("rpc", Boolean, { desc: "serve the agent over stdio for another process to drive", default: false }).option("rpcListen", String, {
139
152
  desc: "serve the RPC wire on unix:<path> or tcp:[host:]<port> instead of stdio",
140
153
  flag: "L",
141
154
  nullable: true
@@ -143,8 +156,8 @@ class CodeCommand extends command("code", [CodeScript], ({ public: target }) =>
143
156
  desc: "open the full-screen session even when a prompt is given",
144
157
  flag: "i",
145
158
  default: false
146
- }).with(Workspace).exec(async function(prompt, app, profile, model, json, thinking, rpc, rpcListen, resume, interactive, workspace) {
147
- const options = { app, profile, model, json, thinking, rpc, rpcListen, interactive, resume };
159
+ }).with(Workspace).exec(async function(prompt, app, profile, model, compactAt, json, thinking, rpc, rpcListen, resume, interactive, workspace) {
160
+ const options = { app, profile, model, compactAt, json, thinking, rpc, rpcListen, interactive, resume };
148
161
  await this.codeScript.run(workspace, prompt ?? "", options);
149
162
  })
150
163
  })) {
@@ -1 +1 @@
1
- {"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","machine-keygen":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","code":"code","create-application":"application","remove-application":"application","plan-slice":"application","sync":"application","script":"application","console":"application","logs":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","build-desktop":"application","bd":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","start-desktop":"application","sd":"application","release-ios":"application","release-android":"application","pack-update":"application","update-keygen":"application","publish-update":"application","dbup":"application","db-export":"application","db-import":"application","dbdown":"application","create-library":"library","remove-library":"library","sync-library":"library","library-status":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","deploy-akan":"cloud","test-platforms":"cloud","update":"cloud","push-update":"cloud","register-binary":"cloud","upload-secret":"cloud","list-secrets":"cloud","remove-secret":"cloud","download-env":"cloud","upload-env":"cloud","subspace":"subspace","guideline":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","repair":"repair","workflow":"workflow","pipeline":"pipeline","tunnel":"tunnel"}}
1
+ {"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","machine-keygen":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","code":"code","create-application":"application","remove-application":"application","plan-slice":"application","sync":"application","script":"application","migrate":"application","create-migration":"application","console":"application","logs":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","build-desktop":"application","bd":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","start-desktop":"application","sd":"application","release-ios":"application","release-android":"application","pack-update":"application","update-keygen":"application","publish-update":"application","dbup":"application","db-export":"application","db-import":"application","dbdown":"application","create-library":"library","remove-library":"library","sync-library":"library","library-status":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","deploy-akan":"cloud","test-platforms":"cloud","update":"cloud","push-update":"cloud","register-binary":"cloud","upload-secret":"cloud","list-secrets":"cloud","remove-secret":"cloud","download-env":"cloud","upload-env":"cloud","subspace":"subspace","guideline":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","repair":"repair","workflow":"workflow","pipeline":"pipeline","tunnel":"tunnel"}}
@@ -2,28 +2,28 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-fbw3kmt5.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-va06nr10.js";
7
+ import"./index-n8dsax1f.js";
8
8
  import"./index-hj6w4ka1.js";
9
- import"./index-trpasv9q.js";
10
- import"./index-5edzv8fn.js";
11
- import"./index-d72hfmdm.js";
12
- import"./index-vk0pa0mn.js";
9
+ import"./index-yyxy7aff.js";
10
+ import"./index-aqwdjn4x.js";
11
+ import"./index-cgexcnwd.js";
12
+ import"./index-3hvmytbs.js";
13
13
  import"./index-m9jj544v.js";
14
- import"./index-g1mbppa9.js";
15
- import"./index-192ha4xh.js";
14
+ import"./index-nr8m4j21.js";
15
+ import"./index-25ks6x4k.js";
16
+ import"./index-64pjry21.js";
16
17
  import"./index-zzvvc845.js";
17
- import"./index-j4mkhz93.js";
18
- import"./index-86jt2a0e.js";
19
- import"./index-fmzcs8v6.js";
20
- import"./index-awbdfcf2.js";
21
- import"./index-1p98exm2.js";
22
- import"./index-1xj2t7cb.js";
18
+ import"./index-0dd6z4b9.js";
19
+ import"./index-qh73jnyb.js";
20
+ import"./index-j4dzazmw.js";
21
+ import"./index-hqh4mpgt.js";
22
+ import"./index-f2gfq0yh.js";
23
+ import"./index-dkfadmrx.js";
23
24
  import {
24
25
  ContextScript
25
- } from "./index-4mhy6qme.js";
26
- import"./index-665zp9rs.js";
26
+ } from "./index-fnqj2d2w.js";
27
27
 
28
28
  // pkgs/@akanjs/cli/context/context.command.ts
29
29
  class ContextCommand extends command("context", [ContextScript], ({ public: target }) => ({