@akanjs/cli 3.1.0-rc.2 → 3.1.0-rc.21

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 (103) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-q50k4s45.js → CodeAgent-gzfc5t52.js} +2 -2
  3. package/{CodeAgentRpcHost-p7h6n2hp.js → CodeAgentRpcHost-9g27hmer.js} +1 -1
  4. package/{CodeTui-62g35ztk.js → CodeTui-bpsjs8wz.js} +47 -4
  5. package/TunnelShare-tfrnftgr.js +14 -0
  6. package/{agent.command-adfd5299.js → agent.command-67ysh3n6.js} +5 -5
  7. package/akanCode.js +7 -5
  8. package/{application.command-hj3gv1rx.js → application.command-q0tqw5pc.js} +38 -11
  9. package/{applicationBuildRunner-by10r9gf.js → applicationBuildRunner-wsszr305.js} +16 -9
  10. package/buildBatch.proc.js +7 -7
  11. package/{cloud.command-k2fhaape.js → cloud.command-e7tkxyx6.js} +17 -16
  12. package/cloud.script-krzh3d7k.js +24 -0
  13. package/{code.command-kt5zgcc2.js → code.command-ttk8tje2.js} +25 -12
  14. package/commandManifest.json +1 -1
  15. package/{context.command-8fgn42jw.js → context.command-bdsk2z2r.js} +17 -16
  16. package/context.runner-bxzv0gm0.js +25 -0
  17. package/{dependencyScanner-06z2dmrr.js → dependencyScanner-3afj2vt1.js} +1 -1
  18. package/{guideline.command-3yxxr2mm.js → guideline.command-man90n70.js} +2 -2
  19. package/guidelines/agentRule/agentRule.instruction.md +25 -10
  20. package/guidelines/conventions/conventions.instruction.md +486 -1084
  21. package/guidelines/cssRule/cssRule.instruction.md +16 -1
  22. package/guidelines/fieldRule/fieldRule.instruction.md +74 -0
  23. package/guidelines/framework/framework.instruction.md +4 -7
  24. package/guidelines/mcpRule/mcpRule.instruction.md +16 -9
  25. package/guidelines/modelConstant/modelConstant.instruction.md +2 -1
  26. package/guidelines/modelStore/modelStore.instruction.md +16 -0
  27. package/guidelines/pageRule/pageRule.instruction.md +80 -0
  28. package/guidelines/queryRule/queryRule.instruction.md +47 -12
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +89 -2
  30. package/guidelines/ssrRule/ssrRule.instruction.md +13 -0
  31. package/guidelines/transportRule/transportRule.instruction.md +107 -8
  32. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +4 -4
  33. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +70 -7
  34. package/incrementalBuilder.proc.js +4 -4
  35. package/{index-rhbabmja.js → index-033wne2j.js} +260 -259
  36. package/{index-xpdgxsj5.js → index-1r5a8bzx.js} +2216 -2216
  37. package/{index-jwqtchha.js → index-27y8t17p.js} +1 -1
  38. package/{index-wa5jbxj1.js → index-2mrn1mrg.js} +1 -0
  39. package/{index-t7nws9mx.js → index-2w8j2fnv.js} +661 -448
  40. package/{index-0909wckt.js → index-35m6bzm7.js} +238 -236
  41. package/{index-sqfdmb5b.js → index-4393nb4b.js} +4 -4
  42. package/{index-sby8fe1p.js → index-48edp6q4.js} +1 -1
  43. package/{index-g0vwzy9m.js → index-4v43h00g.js} +20 -21
  44. package/{index-azh29dc8.js → index-54wc2phm.js} +19 -14
  45. package/{index-k9rrten6.js → index-5nd1wtkv.js} +92 -94
  46. package/index-62md4dwy.js +260 -0
  47. package/{index-hnby7p9n.js → index-75n5q4ph.js} +7 -7
  48. package/{index-fjsv10hd.js → index-844q7f8z.js} +7 -7
  49. package/{index-tv8fjaba.js → index-8jehkey8.js} +4 -4
  50. package/{index-bea2gwc6.js → index-9mt4smfy.js} +2 -2
  51. package/{index-d2242ksy.js → index-at7bz0xq.js} +3 -0
  52. package/{index-3hx1z96c.js → index-bqbf654f.js} +1 -1
  53. package/{index-8zdwpxef.js → index-cae9m5jz.js} +119 -81
  54. package/{index-tz5evhdr.js → index-ebarbgba.js} +6 -6
  55. package/{index-2etqq75t.js → index-g6ax17x4.js} +1114 -1082
  56. package/{index-h85cxfkg.js → index-g9ks2k8c.js} +2 -2
  57. package/{index-nq045px5.js → index-h3r3nr9y.js} +356 -307
  58. package/{index-20cebtth.js → index-h6czey01.js} +79 -24
  59. package/{index-6726qr1m.js → index-jrmzcp66.js} +57 -58
  60. package/{index-q958tqqg.js → index-m9jj544v.js} +1 -1
  61. package/{index-8935h3n1.js → index-mdjc93e1.js} +1 -1
  62. package/{index-rk9sdys3.js → index-nv79n88g.js} +5 -5
  63. package/{index-kc8z134d.js → index-nx64dz92.js} +38 -15
  64. package/{index-z507nzhg.js → index-p2r64bpa.js} +4 -4
  65. package/{index-nq2ja5e0.js → index-pg1t468s.js} +3 -3
  66. package/{index-3reaaa1h.js → index-rc51f9ht.js} +29 -27
  67. package/{index-e9prnmyt.js → index-ta1dychm.js} +3 -3
  68. package/{index-2ahj896a.js → index-tvehn2sp.js} +1 -1
  69. package/{index-31ce9vhg.js → index-vkb9m4z7.js} +80 -38
  70. package/{index-58vvz603.js → index-xsd96yzw.js} +1 -1
  71. package/{index-pyxn1b53.js → index-zv5s8x58.js} +13 -13
  72. package/index.js +22 -22
  73. package/{library.command-8tw59xzj.js → library.command-6amzsrb8.js} +3 -3
  74. package/{localRegistry.command-tf3dmznd.js → localRegistry.command-yqc0nyhh.js} +15 -14
  75. package/{module.command-9vm8hffy.js → module.command-10x6jv6c.js} +5 -5
  76. package/{package.command-erbxe2tz.js → package.command-pwfvecjf.js} +4 -4
  77. package/package.json +21 -21
  78. package/{page.command-jpavcj0p.js → page.command-ahhgx9y1.js} +3 -3
  79. package/{pipeline.command-b8rzvjvv.js → pipeline.command-1ptr3e9y.js} +3 -3
  80. package/{primitive.command-sm32chzk.js → primitive.command-g5xwv6tj.js} +6 -6
  81. package/{projectTypecheck-jamtx95x.js → projectTypecheck-fx8x7cat.js} +1 -1
  82. package/{quality.command-pkd17n6y.js → quality.command-fw9ck061.js} +4 -4
  83. package/{repair.command-8y4mq6hs.js → repair.command-g8kecj96.js} +5 -5
  84. package/{scalar.command-q8khmyx5.js → scalar.command-fprap51w.js} +4 -4
  85. package/skills/akan-code/SKILL.md +4 -0
  86. package/skills/akan-store/SKILL.md +2 -1
  87. package/{subspace.command-51n0ykbx.js → subspace.command-sc0t527y.js} +11 -10
  88. package/templates/appSample/lib/task/Task.Util.tsx +7 -7
  89. package/templates/appSample/lib/task/Task.Zone.tsx +1 -1
  90. package/templates/appSample/ui/QuantityControl.tsx +2 -2
  91. package/templates/crudSinglePage/page.tsx +1 -1
  92. package/templates/lib/cnst.ts +0 -1
  93. package/templates/migration/__migrationId__.ts +23 -0
  94. package/templates/server.ts +8 -1
  95. package/templates/workspaceRoot/.gitignore.template +23 -52
  96. package/templates/workspaceRoot/biome.json.template +1 -1
  97. package/{tunnel.command-7820vtxq.js → tunnel.command-mqnsqbwf.js} +8 -7
  98. package/{workflow.command-n5sv4wqz.js → workflow.command-j0jgkr13.js} +10 -10
  99. package/{workspace.command-zdy60jh8.js → workspace.command-1r9hvvw0.js} +29 -28
  100. package/TunnelShare-f1egrktx.js +0 -13
  101. package/cloud.script-z8p5dz7e.js +0 -23
  102. package/context.runner-hnh0rg7m.js +0 -24
  103. package/index-n68jx79w.js +0 -120
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- 852937b2e6f646ffc6c456f1ed255189da0cd8e52bef8028582dd4f030b93f68
1
+ 5cd1b4a580fd87bc2eb87ac99ed7ddef9d11f9cff7b04559b77daedc42dbe881
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgent2
4
- } from "./index-t7nws9mx.js";
5
- import"./index-8zdwpxef.js";
4
+ } from "./index-2w8j2fnv.js";
5
+ import"./index-cae9m5jz.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-8zdwpxef.js";
6
+ McpSignIn,
7
+ AkanCodeCompaction2
8
+ } from "./index-cae9m5jz.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("/");
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ import {
3
+ TunnelShare2
4
+ } from "./index-48edp6q4.js";
5
+ import"./index-jrmzcp66.js";
6
+ import"./index-35m6bzm7.js";
7
+ import"./index-m9jj544v.js";
8
+ import"./index-nx64dz92.js";
9
+ import"./index-h3r3nr9y.js";
10
+ import"./index-g6ax17x4.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-31ce9vhg.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-2etqq75t.js";
7
+ import"./index-g6ax17x4.js";
8
8
  import"./index-hj6w4ka1.js";
9
- import"./index-rhbabmja.js";
10
- import"./index-rk9sdys3.js";
9
+ import"./index-033wne2j.js";
10
+ import"./index-nv79n88g.js";
11
11
  import"./index-zzvvc845.js";
12
12
  import {
13
13
  AgentScript
14
- } from "./index-e9prnmyt.js";
14
+ } from "./index-ta1dychm.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-t7nws9mx.js";
31
+ } from "./index-2w8j2fnv.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-8zdwpxef.js";
41
+ akanCodePaths2,
42
+ AkanCodeCompaction2
43
+ } from "./index-cae9m5jz.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,17 +7,18 @@ import {
7
7
  Exec,
8
8
  Workspace,
9
9
  command
10
- } from "./index-31ce9vhg.js";
10
+ } from "./index-vkb9m4z7.js";
11
11
  import"./index-52w0fvh8.js";
12
- import"./index-2etqq75t.js";
13
- import"./index-k9rrten6.js";
14
- import"./index-g0vwzy9m.js";
15
- import"./index-0909wckt.js";
16
- import"./index-nq045px5.js";
17
- import"./index-bea2gwc6.js";
12
+ import"./index-g6ax17x4.js";
13
+ import"./index-5nd1wtkv.js";
14
+ import"./index-4v43h00g.js";
15
+ import"./index-m9jj544v.js";
16
+ import"./index-35m6bzm7.js";
17
+ import"./index-h3r3nr9y.js";
18
+ import"./index-9mt4smfy.js";
18
19
  import {
19
20
  ApplicationScript
20
- } from "./index-20cebtth.js";
21
+ } from "./index-h6czey01.js";
21
22
  import"./index-7md2g9vw.js";
22
23
  import {
23
24
  writeOption,
@@ -25,11 +26,13 @@ import {
25
26
  releaseEnvOption,
26
27
  allowLocalOption,
27
28
  publicEnvOption
28
- } from "./index-8935h3n1.js";
29
- import"./index-58vvz603.js";
30
- import"./index-kc8z134d.js";
29
+ } from "./index-mdjc93e1.js";
30
+ import"./index-xsd96yzw.js";
31
+ import"./index-nx64dz92.js";
31
32
 
32
33
  // pkgs/@akanjs/cli/application/application.command.ts
34
+ import { MigrationCommand } from "akanjs/server/migration/migrationCommand";
35
+ import { MigrationError } from "akanjs/server/migration/migrationError";
33
36
  var deviceOption = {
34
37
  desc: "simulator, emulator or device to run on: its id or name (e.g. 'iPhone 17' or 'Pixel_10')",
35
38
  default: ""
@@ -61,6 +64,30 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
61
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) {
62
65
  await this.applicationScript.script(app, filename);
63
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
+ }),
64
91
  console: target({ desc: "Open an interactive server console for the application" }).with(App).exec(async function(app) {
65
92
  await this.applicationScript.console(app);
66
93
  }),
@@ -2,21 +2,22 @@
2
2
  import {
3
3
  ServerEnvProfile,
4
4
  Spinner,
5
- ProjectTypecheck2
6
- } from "./index-2etqq75t.js";
7
- import"./index-xpdgxsj5.js";
8
- import"./index-nq045px5.js";
5
+ ProjectTypecheck2,
6
+ WorkspaceExecutor
7
+ } from "./index-g6ax17x4.js";
8
+ import"./index-52w0fvh8.js";
9
+ import"./index-1r5a8bzx.js";
10
+ import"./index-h3r3nr9y.js";
9
11
  import {
10
12
  AllRoutesBuilder,
11
13
  FontPruner,
12
14
  precompressArtifacts,
13
15
  SsrBaseArtifactBuilder
14
- } from "./index-azh29dc8.js";
15
- import"./index-52w0fvh8.js";
16
- import"./index-n68jx79w.js";
16
+ } from "./index-54wc2phm.js";
17
+ import"./index-62md4dwy.js";
17
18
  import {
18
19
  CsrArtifactBuilder
19
- } from "./index-kc8z134d.js";
20
+ } from "./index-nx64dz92.js";
20
21
 
21
22
  // pkgs/@akanjs/devkit/applicationBuildRunner.ts
22
23
  import path2 from "path";
@@ -127,6 +128,7 @@ class ApplicationBuildRunner {
127
128
  this.#spinner = spinner;
128
129
  const { web, assets, baseDevEnv } = await this.#app.getConfig();
129
130
  const environment = this.#environment ?? baseDevEnv.env;
131
+ WorkspaceExecutor.assertDeployableEnv(baseDevEnv, environment, "akan build");
130
132
  process.env.AKAN_PUBLIC_ENV = environment;
131
133
  if (this.#profile)
132
134
  await ServerEnvProfile.assertShippable({ envDir: this.#envDir, environment, profile: this.#profile });
@@ -315,9 +317,14 @@ void run().catch((error) => {
315
317
  return { base, allRoutes };
316
318
  }
317
319
  async#buildOrThrow(label, config) {
318
- const result = await Bun.build(config);
320
+ const metafileDir = process.env.AKAN_BUILD_METAFILE ? path2.join(this.#app.workspace.workspaceRoot, "local", "build-meta", path2.basename(this.#app.cwdPath)) : null;
321
+ const result = await Bun.build(metafileDir ? { ...config, metafile: true } : config);
319
322
  if (!result.success)
320
323
  throw new AggregateError(result.logs, `[${label}] Bun.build failed`);
324
+ if (metafileDir && result.metafile) {
325
+ const entry = path2.parse(String(config.entrypoints[0] ?? label)).name;
326
+ await Bun.write(path2.join(metafileDir, `${entry}.json`), JSON.stringify(result.metafile));
327
+ }
321
328
  return result;
322
329
  }
323
330
  #createExternalSpecifiersPlugin(externalLibs) {
@@ -1,32 +1,32 @@
1
1
  // @bun
2
2
  import {
3
3
  ApplicationBuildReporter
4
- } from "./index-k9rrten6.js";
4
+ } from "./index-5nd1wtkv.js";
5
5
  import {
6
6
  resolveSsrPageEntriesForApp,
7
7
  WorkspaceExecutor,
8
8
  AppExecutor
9
- } from "./index-2etqq75t.js";
9
+ } from "./index-g6ax17x4.js";
10
10
  import {
11
11
  computeRouteSeedIndex,
12
12
  saveRouteSeedIndex,
13
13
  CsrDevBundler,
14
14
  SsrDevBundler
15
- } from "./index-xpdgxsj5.js";
15
+ } from "./index-1r5a8bzx.js";
16
16
  import"./index-52w0fvh8.js";
17
17
  import {
18
18
  ServerGraphFile,
19
19
  PagesBundleBuilder
20
- } from "./index-nq045px5.js";
20
+ } from "./index-h3r3nr9y.js";
21
21
  import {
22
22
  CssCompiler,
23
23
  FontOptimizer,
24
24
  SsrBaseArtifactBuilder
25
- } from "./index-azh29dc8.js";
26
- import"./index-n68jx79w.js";
25
+ } from "./index-54wc2phm.js";
26
+ import"./index-62md4dwy.js";
27
27
  import {
28
28
  CsrArtifactBuilder
29
- } from "./index-kc8z134d.js";
29
+ } from "./index-nx64dz92.js";
30
30
 
31
31
  // pkgs/@akanjs/devkit/incrementalBuilder/buildBatch.proc.ts
32
32
  import path from "path";
@@ -3,25 +3,26 @@ import {
3
3
  App,
4
4
  Workspace,
5
5
  command
6
- } from "./index-31ce9vhg.js";
6
+ } from "./index-vkb9m4z7.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-2etqq75t.js";
9
- import"./index-6726qr1m.js";
8
+ import"./index-g6ax17x4.js";
9
+ import"./index-jrmzcp66.js";
10
10
  import {
11
11
  PlatformTestRun
12
- } from "./index-3reaaa1h.js";
13
- import"./index-g0vwzy9m.js";
14
- import"./index-0909wckt.js";
15
- import"./index-nq045px5.js";
16
- import"./index-k9rrten6.js";
17
- import"./index-bea2gwc6.js";
18
- import"./index-20cebtth.js";
12
+ } from "./index-rc51f9ht.js";
13
+ import"./index-4v43h00g.js";
14
+ import"./index-m9jj544v.js";
15
+ import"./index-35m6bzm7.js";
16
+ import"./index-h3r3nr9y.js";
17
+ import"./index-5nd1wtkv.js";
18
+ import"./index-9mt4smfy.js";
19
+ import"./index-h6czey01.js";
19
20
  import"./index-7md2g9vw.js";
20
- import"./index-2ahj896a.js";
21
- import"./index-tz5evhdr.js";
21
+ import"./index-tvehn2sp.js";
22
+ import"./index-ebarbgba.js";
22
23
  import {
23
24
  CloudScript2
24
- } from "./index-fjsv10hd.js";
25
+ } from "./index-844q7f8z.js";
25
26
  import {
26
27
  writeOption,
27
28
  oneNativeTargetOption,
@@ -31,9 +32,9 @@ import {
31
32
  publicEnvOption,
32
33
  hostOption,
33
34
  subspaceOption
34
- } from "./index-8935h3n1.js";
35
- import"./index-58vvz603.js";
36
- import"./index-kc8z134d.js";
35
+ } from "./index-mdjc93e1.js";
36
+ import"./index-xsd96yzw.js";
37
+ import"./index-nx64dz92.js";
37
38
 
38
39
  // pkgs/@akanjs/cli/cloud/cloud.command.ts
39
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-844q7f8z.js";
5
+ import"./index-rc51f9ht.js";
6
+ import"./index-h6czey01.js";
7
+ import"./index-xsd96yzw.js";
8
+ import"./index-9mt4smfy.js";
9
+ import"./index-ebarbgba.js";
10
+ import"./index-4v43h00g.js";
11
+ import"./index-jrmzcp66.js";
12
+ import"./index-35m6bzm7.js";
13
+ import"./index-m9jj544v.js";
14
+ import"./index-vkb9m4z7.js";
15
+ import"./index-7md2g9vw.js";
16
+ import"./index-nx64dz92.js";
17
+ import"./index-5nd1wtkv.js";
18
+ import"./index-h3r3nr9y.js";
19
+ import"./index-g6ax17x4.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-31ce9vhg.js";
7
+ } from "./index-vkb9m4z7.js";
8
8
  import"./index-52w0fvh8.js";
9
- import"./index-2etqq75t.js";
9
+ import"./index-g6ax17x4.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-q50k4s45.js"),
23
- import("./CodeAgentRpcHost-p7h6n2hp.js"),
22
+ import("./CodeAgent-gzfc5t52.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-q50k4s45.js"),
38
- import("./CodeTui-62g35ztk.js")
37
+ import("./CodeAgent-gzfc5t52.js"),
38
+ import("./CodeTui-bpsjs8wz.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-q50k4s45.js");
70
+ const { CodeAgent } = await import("./CodeAgent-gzfc5t52.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,27 +2,28 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-31ce9vhg.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-2etqq75t.js";
7
+ import"./index-g6ax17x4.js";
8
8
  import"./index-hj6w4ka1.js";
9
- import"./index-rhbabmja.js";
10
- import"./index-rk9sdys3.js";
11
- import"./index-pyxn1b53.js";
12
- import"./index-g0vwzy9m.js";
13
- import"./index-0909wckt.js";
14
- import"./index-nq045px5.js";
9
+ import"./index-033wne2j.js";
10
+ import"./index-nv79n88g.js";
11
+ import"./index-zv5s8x58.js";
12
+ import"./index-4v43h00g.js";
13
+ import"./index-m9jj544v.js";
14
+ import"./index-35m6bzm7.js";
15
+ import"./index-h3r3nr9y.js";
15
16
  import"./index-zzvvc845.js";
16
- import"./index-nq2ja5e0.js";
17
- import"./index-jwqtchha.js";
18
- import"./index-z507nzhg.js";
19
- import"./index-sqfdmb5b.js";
20
- import"./index-h85cxfkg.js";
21
- import"./index-hnby7p9n.js";
17
+ import"./index-pg1t468s.js";
18
+ import"./index-27y8t17p.js";
19
+ import"./index-p2r64bpa.js";
20
+ import"./index-4393nb4b.js";
21
+ import"./index-g9ks2k8c.js";
22
+ import"./index-75n5q4ph.js";
22
23
  import {
23
24
  ContextScript
24
- } from "./index-tv8fjaba.js";
25
- import"./index-kc8z134d.js";
25
+ } from "./index-8jehkey8.js";
26
+ import"./index-nx64dz92.js";
26
27
 
27
28
  // pkgs/@akanjs/cli/context/context.command.ts
28
29
  class ContextCommand extends command("context", [ContextScript], ({ public: target }) => ({
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ import {
3
+ ContextRunner2
4
+ } from "./index-zv5s8x58.js";
5
+ import"./index-75n5q4ph.js";
6
+ import"./index-g9ks2k8c.js";
7
+ import"./index-4393nb4b.js";
8
+ import"./index-pg1t468s.js";
9
+ import"./index-p2r64bpa.js";
10
+ import"./index-27y8t17p.js";
11
+ import"./index-4v43h00g.js";
12
+ import"./index-35m6bzm7.js";
13
+ import"./index-m9jj544v.js";
14
+ import"./index-nv79n88g.js";
15
+ import"./index-033wne2j.js";
16
+ import"./index-zzvvc845.js";
17
+ import"./index-vkb9m4z7.js";
18
+ import"./index-nx64dz92.js";
19
+ import"./index-h3r3nr9y.js";
20
+ import"./index-g6ax17x4.js";
21
+ import"./index-hj6w4ka1.js";
22
+ import"./index-52w0fvh8.js";
23
+ export {
24
+ ContextRunner2 as ContextRunner
25
+ };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeScriptDependencyScanner2
4
- } from "./index-2ahj896a.js";
4
+ } from "./index-tvehn2sp.js";
5
5
  import"./index-52w0fvh8.js";
6
6
  export {
7
7
  TypeScriptDependencyScanner2 as TypeScriptDependencyScanner