@akanjs/cli 3.0.0-beta.22 → 3.0.0-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- 08c3bcbe3929872aa6553969f446ac5addc06b6cafef84d442ba7c0d845c099f
1
+ d1115d8b0bbb9ee80f54ccd68f0cc8da997b4929b92fa7c0c9b7ed40ff253709
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  TunnelShare2
4
- } from "./index-smme4r47.js";
5
- import"./index-22d57v4c.js";
4
+ } from "./index-zabxte74.js";
5
+ import"./index-fzd22vjh.js";
6
6
  import"./index-5b6tavv3.js";
7
7
  export {
8
8
  TunnelShare2 as TunnelShare
@@ -16,7 +16,7 @@ import"./index-khpfpcsd.js";
16
16
  import"./index-1db2cw0y.js";
17
17
  import {
18
18
  ApplicationScript
19
- } from "./index-m79y8b2h.js";
19
+ } from "./index-ymgtbmf1.js";
20
20
  import"./index-7md2g9vw.js";
21
21
  import"./index-q44jbw48.js";
22
22
 
@@ -8,7 +8,7 @@ import {
8
8
  FontPruner,
9
9
  precompressArtifacts,
10
10
  SsrBaseArtifactBuilder
11
- } from "./index-aadpbnt2.js";
11
+ } from "./index-ne50hc2m.js";
12
12
  import"./index-fgq75haa.js";
13
13
  import"./index-5b6tavv3.js";
14
14
  import"./index-n68jx79w.js";
@@ -13,9 +13,10 @@ import {
13
13
  CssCompiler,
14
14
  PagesBundleBuilder,
15
15
  CsrArtifactBuilder,
16
+ CsrDevBundler,
16
17
  FontOptimizer,
17
18
  SsrBaseArtifactBuilder
18
- } from "./index-aadpbnt2.js";
19
+ } from "./index-ne50hc2m.js";
19
20
  import"./index-5b6tavv3.js";
20
21
  import"./index-fgq75haa.js";
21
22
  import"./index-n68jx79w.js";
@@ -23,6 +24,7 @@ import"./index-n68jx79w.js";
23
24
  // pkgs/@akanjs/devkit/incrementalBuilder/buildBatch.proc.ts
24
25
  import path from "path";
25
26
  import { Logger } from "akanjs/common";
27
+ import { resolveDevCsrMode } from "akanjs/server/hmr/csrDevManifest";
26
28
 
27
29
  class BuildBatch {
28
30
  #logger = new Logger("BuildBatch");
@@ -81,13 +83,44 @@ class BuildBatch {
81
83
  async#buildCsr() {
82
84
  const started = Date.now();
83
85
  try {
84
- await new CsrArtifactBuilder(this.#app).build();
85
- this.#logger.verbose(`csr-rebundle ok (${Date.now() - started}ms)`);
86
+ if (resolveDevCsrMode() === "registry")
87
+ await this.#updateCsrRegistry(started);
88
+ else
89
+ await this.#rebuildCsrArtifact(started);
86
90
  this.#emitStatus("csr");
87
91
  } catch (err) {
88
92
  this.#fail("csr", "csr-rebundle", err);
89
93
  }
90
94
  }
95
+ async#rebuildCsrArtifact(started) {
96
+ await new CsrArtifactBuilder(this.#app).build();
97
+ this.#logger.verbose(`csr-rebundle ok (${Date.now() - started}ms)`);
98
+ if (this.#request.changedFiles.length === 0)
99
+ return;
100
+ this.#emit({
101
+ type: "csr-updated",
102
+ data: { generation: Date.now(), mode: "artifact", reload: true, reason: "the CSR artifact was rebuilt" }
103
+ });
104
+ }
105
+ async#updateCsrRegistry(started) {
106
+ const update = await new CsrDevBundler(this.#app).update(this.#request.changedFiles);
107
+ if (!update) {
108
+ this.#logger.verbose(`csr-dev unchanged (${Date.now() - started}ms)`);
109
+ return;
110
+ }
111
+ this.#logger.verbose(`csr-dev generation=${update.generation} ${update.reload ? `reload (${update.reason})` : `patch modules=${update.changedIds.length}`} graph=${update.moduleCount} (${Date.now() - started}ms)`);
112
+ this.#emit({
113
+ type: "csr-updated",
114
+ data: {
115
+ generation: update.generation,
116
+ mode: "registry",
117
+ reload: update.reload,
118
+ reason: update.reason,
119
+ patchUrl: update.patchUrl,
120
+ changedIds: update.changedIds
121
+ }
122
+ });
123
+ }
91
124
  async#buildPages() {
92
125
  const started = Date.now();
93
126
  try {
@@ -2,7 +2,7 @@
2
2
  import"./index-5b6tavv3.js";
3
3
  import {
4
4
  GlobalConfig
5
- } from "./index-22d57v4c.js";
5
+ } from "./index-fzd22vjh.js";
6
6
  import {
7
7
  Workspace,
8
8
  command
@@ -10,17 +10,17 @@ import {
10
10
  import"./index-ga6hygxr.js";
11
11
  import {
12
12
  PlatformTestRun
13
- } from "./index-yjkte9aj.js";
13
+ } from "./index-zbc2q6a6.js";
14
14
  import"./index-khpfpcsd.js";
15
15
  import"./index-1db2cw0y.js";
16
- import"./index-m79y8b2h.js";
16
+ import"./index-ymgtbmf1.js";
17
17
  import"./index-ys6f0bvh.js";
18
18
  import"./index-7md2g9vw.js";
19
19
  import"./index-3t7g9e4r.js";
20
20
  import"./index-mgfx3mfs.js";
21
21
  import {
22
22
  CloudScript2
23
- } from "./index-sz0myv9k.js";
23
+ } from "./index-d4mfjgm0.js";
24
24
  import"./index-q44jbw48.js";
25
25
 
26
26
  // pkgs/@akanjs/cli/cloud/cloud.command.ts
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudScript2
4
- } from "./index-sz0myv9k.js";
5
- import"./index-yjkte9aj.js";
4
+ } from "./index-d4mfjgm0.js";
5
+ import"./index-zbc2q6a6.js";
6
6
  import"./index-mgfx3mfs.js";
7
- import"./index-m79y8b2h.js";
7
+ import"./index-ymgtbmf1.js";
8
8
  import"./index-q44jbw48.js";
9
9
  import"./index-1db2cw0y.js";
10
10
  import"./index-ys6f0bvh.js";
11
- import"./index-22d57v4c.js";
11
+ import"./index-fzd22vjh.js";
12
12
  import"./index-rmcw8yc8.js";
13
13
  import"./index-7md2g9vw.js";
14
14
  import"./index-khpfpcsd.js";
@@ -15,6 +15,13 @@ for. `Load` scopes, the route, and the live keys complete the context. The React
15
15
  apps and libs never import it directly (`no-import-external-library`) — everything reaches them through `st.*` and
16
16
  `akanjs/ui`.
17
17
 
18
+ **Mounted is not published: on a CSR stack only the current page is.** The page kept under the current one for a
19
+ swipe back stays mounted and live, and its declarations stay registered, but its tools, resources, guides and
20
+ `st.use` keys are parked until it is current again — the agent sees the screen the user sees, never two. Each page
21
+ container renders `use-agentic`'s `<AgentActivity active>` for this; a parked registration shadows nothing, two
22
+ pages declaring one name never clash, and a registry kept outside the surface reads the same gate through
23
+ `useAgentGate()`, as the store's live keys do.
24
+
18
25
  ## Mounting The Chat
19
26
  - **Mount `<Agent.Chat />` once in a layout.** That is the floating chat, the approval card, and the client-side
20
27
  loop. The default runner drives `runAgentTurn`, which the **framework serves on every app** — no lib to mount,
@@ -31,6 +31,10 @@ with it. `conventions` carries the invariants — this is the full contract behi
31
31
  A model with none renders ids and says so in the picker.
32
32
  - A slice's `exec` returns a `QueryOf` (an opaque query descriptor, `pkgs/akanjs/constant/types.ts`); you **cannot** chain `.sort()`/`.limit()` on it.
33
33
  - Apply ordering/paging via the store `init` fetch option instead: `initX(..., { sort, page, limit })` (`pkgs/akanjs/fetch/fetchType/sliceFetch.type.ts`).
34
+ - **Every sort ends with `id`, in the direction of its last key, and a missing value sorts below every other** —
35
+ first ascending, last descending, in every database mode and in the client placing a live row. Rows the declared
36
+ keys tie on (a midpoint priority dragged into one gap until the float runs out, two rows saved in one millisecond)
37
+ therefore keep one order across `loadMoreOf<Model>()` pages and live insertions.
34
38
  - **A slice list is either one window or an accumulated one, and the store says which.** `setPageOf<Model>` swaps
35
39
  the window and `pageOf<Model>` names it; `loadMoreOf<Model>()` appends the rows *after* the ones already loaded
36
40
  and takes no page number, because in an accumulated list no page number names anything. It skips by
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-22d57v4c.js";
5
+ } from "./index-fzd22vjh.js";
6
6
  import {
7
7
  script
8
8
  } from "./index-rmcw8yc8.js";
@@ -11,13 +11,13 @@ import {
11
11
  } from "./index-ga6hygxr.js";
12
12
  import {
13
13
  ApplicationScript
14
- } from "./index-m79y8b2h.js";
14
+ } from "./index-ymgtbmf1.js";
15
15
  import {
16
16
  PackageScript
17
17
  } from "./index-mgfx3mfs.js";
18
18
  import {
19
19
  CloudRunner
20
- } from "./index-yjkte9aj.js";
20
+ } from "./index-zbc2q6a6.js";
21
21
 
22
22
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
23
23
  import { Logger } from "akanjs/common";
@@ -40,12 +40,26 @@ class GlobalConfig {
40
40
  const temp = `${configPath}.${process.pid}.${crypto.randomUUID()}.tmp`;
41
41
  try {
42
42
  await writeFile(temp, JSON.stringify(akanConfig, null, 2), { mode: 384 });
43
- await rename(temp, configPath);
43
+ await GlobalConfig.#replace(temp, configPath);
44
44
  } catch (error) {
45
45
  await rm(temp, { force: true });
46
46
  throw error;
47
47
  }
48
48
  }
49
+ static #replaceAttempts = 100;
50
+ static async#replace(temp, target) {
51
+ for (let attempt = 1;; attempt++) {
52
+ try {
53
+ return await rename(temp, target);
54
+ } catch (error) {
55
+ const code = error.code;
56
+ const busy = process.platform === "win32" && (code === "EPERM" || code === "EACCES" || code === "EBUSY");
57
+ if (!busy || attempt >= GlobalConfig.#replaceAttempts)
58
+ throw error;
59
+ await Bun.sleep(Math.min(10 * attempt, 50));
60
+ }
61
+ }
62
+ }
49
63
  static #lockPath = `${configPath}.lock`;
50
64
  static async#update(mutate) {
51
65
  await ConfigLock.run(GlobalConfig.#lockPath, async () => {