@akanjs/cli 3.2.0-rc.7 → 3.2.0-rc.8
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 +2 -2
- package/{CodeAgent-aq43sq64.js → CodeAgent-x2p3a3e0.js} +2 -2
- package/{CodeTui-pmychb3m.js → CodeTui-qstk5vpj.js} +1 -1
- package/README.ko.md +23 -0
- package/README.md +23 -0
- package/TunnelShare-c4xsfzg5.js +15 -0
- package/{agent.command-pdmb75bk.js → agent.command-9et2e27p.js} +19 -18
- package/akanCode.js +2 -2
- package/{application.command-xwch7rww.js → application.command-m4rq4wc2.js} +23 -16
- package/{applicationBuildRunner-6yjrxfqs.js → applicationBuildRunner-df7rx3ra.js} +7 -6
- package/buildBatch.proc.js +7 -6
- package/{cloud.command-6angaryd.js → cloud.command-a0gy0qq2.js} +21 -22
- package/cloud.script-xze4zh7n.js +31 -0
- package/{code.command-ceyhrgrc.js → code.command-5rsdqw8s.js} +7 -6
- package/{context.command-n7dbh0ca.js → context.command-rk1dwrg4.js} +18 -17
- package/context.runner-83ky5m1b.js +30 -0
- package/{guideline.command-h5dfzrng.js → guideline.command-mffxknbr.js} +3 -2
- package/guidelines/mcpRule/mcpRule.instruction.md +9 -0
- package/incrementalBuilder.proc.js +5 -4
- package/{index-bza4z89k.js → index-0gg15zwa.js} +4 -4
- package/{index-t0a5mng5.js → index-0hbtve0a.js} +10 -9
- package/{index-mtxbw4fy.js → index-28x1aszt.js} +13 -10
- package/{index-mcdezskv.js → index-2mf1aen9.js} +2 -2
- package/{index-g6ss1r1w.js → index-2r9ff9qm.js} +1 -1
- package/{index-z0r6bhqe.js → index-2vgv7fs7.js} +98 -18
- package/{index-dnqznx16.js → index-34792nh7.js} +1 -1
- package/{index-0fq1b5jp.js → index-3ghdb7p5.js} +9 -15
- package/{index-y9xbhs20.js → index-43f4h4cm.js} +3 -3
- package/{index-8bh9en9m.js → index-5radqwn2.js} +9 -9
- package/{index-dtxntsfx.js → index-5zwr4n6k.js} +1 -1
- package/{index-yp6mpazs.js → index-99qvtff2.js} +3 -3
- package/{index-df0r4008.js → index-an76bdrv.js} +1 -1
- package/{index-ggzb32a9.js → index-exn38bzx.js} +106 -69
- package/{index-y1a7dc7t.js → index-gcx48get.js} +1 -1
- package/{index-2b3n00gz.js → index-grxs6fts.js} +27 -17
- package/{index-qn5xmscz.js → index-gxav1bjz.js} +7 -7
- package/{index-ttrrm805.js → index-hqv34wzq.js} +4 -4
- package/{index-2m6gaatn.js → index-j3v29pq7.js} +78 -43
- package/index-j4yvgfhr.js +70 -0
- package/{index-n0vev0fv.js → index-j6gc8n14.js} +2 -2
- package/{index-kj7vyjng.js → index-j9790rhk.js} +67 -77
- package/{index-xzscbgx2.js → index-k92x3vne.js} +1 -1
- package/{index-qx12c8k5.js → index-nmvhjn8c.js} +1 -1
- package/{index-146p5x0r.js → index-ra9fvn7s.js} +6 -4
- package/{index-9km2h20g.js → index-rfzp4pqs.js} +2 -2
- package/{index-1kj847m5.js → index-rp4yf32g.js} +5 -4
- package/{index-80yc5q5y.js → index-skmtj8rm.js} +13 -6
- package/{index-w0nztbs0.js → index-swwjakt0.js} +3 -3
- package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
- package/{index-p9f6dsf2.js → index-vm0dn0mt.js} +3 -4
- package/{index-qtcm6s8p.js → index-w8yasvpc.js} +3 -3
- package/{index-wnxc9n5v.js → index-x40bdsca.js} +4 -4
- package/{index-36dywqhv.js → index-xvk2a75m.js} +2 -2
- package/{index-1xfdzwrt.js → index-xyn02k0w.js} +4 -4
- package/{index-fq72hk0a.js → index-yckz5t8b.js} +2 -2
- package/index.js +24 -23
- package/{library.command-4c2yjfqa.js → library.command-bmd7zc5m.js} +4 -3
- package/{localRegistry.command-mgb4fg60.js → localRegistry.command-y6en1599.js} +16 -15
- package/{module.command-c6284z1b.js → module.command-7exfffqw.js} +6 -5
- package/{package.command-3wh1hh2j.js → package.command-adskw2rj.js} +5 -4
- package/package.json +2 -2
- package/{page.command-sx22j4yv.js → page.command-dw01272p.js} +4 -3
- package/{pipeline.command-8kdcgy47.js → pipeline.command-0b1r3y5r.js} +3 -2
- package/{primitive.command-4jaegn0m.js → primitive.command-byw6vc04.js} +7 -6
- package/{projectTypecheck-t0r9argb.js → projectTypecheck-kkrpq60a.js} +2 -1
- package/{quality.command-46jhrbm2.js → quality.command-6rqnhzct.js} +6 -5
- package/{repair.command-dj4ke29k.js → repair.command-rw5zymak.js} +6 -5
- package/{scalar.command-qwvbhytf.js → scalar.command-2dyp9nh9.js} +5 -4
- package/skills/akan-debug/SKILL.md +1 -1
- package/skills/akan-mcp/SKILL.md +2 -1
- package/skills/akan-scaffold/SKILL.md +1 -1
- package/skills/akan-validate/SKILL.md +1 -0
- package/{subspace.command-48d86hvc.js → subspace.command-111ynwv1.js} +9 -8
- package/{tunnel.command-00v81x42.js → tunnel.command-2gcpfbdj.js} +8 -7
- package/typecheck.proc.js +5 -2
- package/{verify.command-sz542tvy.js → verify.command-djgs86ma.js} +17 -15
- package/{workflow.command-0ra9304f.js → workflow.command-n0k2mxr5.js} +30 -16
- package/{workspace.command-5mm9ahzc.js → workspace.command-fh1qwxfx.js} +31 -30
- package/TunnelShare-11a3fqxb.js +0 -14
- package/cloud.script-w5b0a1sm.js +0 -30
- package/context.runner-9d5rbt2p.js +0 -29
|
@@ -7,18 +7,21 @@ import {
|
|
|
7
7
|
AppExecutor,
|
|
8
8
|
LibExecutor,
|
|
9
9
|
PkgExecutor
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-3ghdb7p5.js";
|
|
11
11
|
import {
|
|
12
12
|
FileSys2
|
|
13
13
|
} from "./index-bns3wcpc.js";
|
|
14
|
+
import {
|
|
15
|
+
CliError
|
|
16
|
+
} from "./index-j4yvgfhr.js";
|
|
14
17
|
import {
|
|
15
18
|
UNAVAILABLE_REDIS_HOST,
|
|
16
19
|
redisTunnelPolicy,
|
|
20
|
+
backendRecoveryPolicy,
|
|
17
21
|
BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS,
|
|
18
22
|
SOURCE_EXTS,
|
|
19
23
|
shouldRestartBackendByDevPlan,
|
|
20
24
|
shouldRestartBuilderByDevPlan,
|
|
21
|
-
shouldAbandonBackendRecovery,
|
|
22
25
|
normalizeBackendReportedGeneration,
|
|
23
26
|
shouldRestartDevHostByDevPlan,
|
|
24
27
|
devHostStateOf,
|
|
@@ -46,28 +49,27 @@ import {
|
|
|
46
49
|
filesChangedSince,
|
|
47
50
|
HmrWatcher,
|
|
48
51
|
WatchRootResolver
|
|
49
|
-
} from "./index-
|
|
52
|
+
} from "./index-vm0dn0mt.js";
|
|
50
53
|
import {
|
|
51
54
|
runner,
|
|
52
|
-
ExitCodeError,
|
|
53
55
|
assertPromptable
|
|
54
|
-
} from "./index-
|
|
56
|
+
} from "./index-exn38bzx.js";
|
|
55
57
|
import {
|
|
56
58
|
UpdatePackFolder,
|
|
57
59
|
UpdateUploader,
|
|
58
60
|
NativePublicEnv,
|
|
59
61
|
NativeApp
|
|
60
|
-
} from "./index-
|
|
62
|
+
} from "./index-43f4h4cm.js";
|
|
61
63
|
import {
|
|
62
64
|
DesktopServerStage
|
|
63
|
-
} from "./index-
|
|
65
|
+
} from "./index-an76bdrv.js";
|
|
64
66
|
import {
|
|
65
67
|
resolveMobileTargets,
|
|
66
68
|
resolveAppId
|
|
67
69
|
} from "./index-m9jj544v.js";
|
|
68
70
|
import {
|
|
69
71
|
SlicePlanner
|
|
70
|
-
} from "./index-
|
|
72
|
+
} from "./index-gcx48get.js";
|
|
71
73
|
import {
|
|
72
74
|
openBrowser
|
|
73
75
|
} from "./index-9dp031by.js";
|
|
@@ -84,7 +86,7 @@ import path7 from "path";
|
|
|
84
86
|
|
|
85
87
|
// pkgs/@akanjs/devkit/akanApp/akanApp.host.ts
|
|
86
88
|
import path4 from "path";
|
|
87
|
-
import { Logger as Logger2 } from "akanjs/common";
|
|
89
|
+
import { Logger as Logger2, RestartSchedule as RestartSchedule2 } from "akanjs/common";
|
|
88
90
|
|
|
89
91
|
// pkgs/@akanjs/devkit/createTunnel.ts
|
|
90
92
|
import { readFileSync } from "fs";
|
|
@@ -325,7 +327,7 @@ var createTunnel = async (service, { app, environment, port = service === "postg
|
|
|
325
327
|
// pkgs/@akanjs/devkit/incrementalBuilder/incrementalBuilder.host.ts
|
|
326
328
|
import fs from "fs";
|
|
327
329
|
import path2 from "path";
|
|
328
|
-
import { Logger } from "akanjs/common";
|
|
330
|
+
import { Logger, RestartSchedule } from "akanjs/common";
|
|
329
331
|
import { CSR_DEV_DIRNAME, CSR_DEV_PATCHING_MARKER, SSR_DEV_DIRNAME } from "akanjs/server/hmr/csrDevManifest";
|
|
330
332
|
import { MemoryLimit } from "akanjs/server/memoryLimit";
|
|
331
333
|
var builderMsgTypeSet = new Set([
|
|
@@ -344,8 +346,6 @@ var builderMsgTypeSet = new Set([
|
|
|
344
346
|
]);
|
|
345
347
|
|
|
346
348
|
class IncrementalBuilderHost {
|
|
347
|
-
static #restartBaseDelayMs = 1000;
|
|
348
|
-
static #restartMaxDelayMs = 30000;
|
|
349
349
|
static #recycleDrainTimeoutMs = 30000;
|
|
350
350
|
static #devMaxRssBytes = 2048 * 1024 * 1024;
|
|
351
351
|
logger = new Logger("IncrementalBuilderHost");
|
|
@@ -358,8 +358,7 @@ class IncrementalBuilderHost {
|
|
|
358
358
|
#onOutput;
|
|
359
359
|
#proc = null;
|
|
360
360
|
#status = "stopped";
|
|
361
|
-
#
|
|
362
|
-
#restartTimer = null;
|
|
361
|
+
#restart = new RestartSchedule({ min: 1000, max: 30000 });
|
|
363
362
|
#recycleTimer = null;
|
|
364
363
|
#recycleRequested = false;
|
|
365
364
|
#spawnAfterRecycle = false;
|
|
@@ -430,7 +429,7 @@ class IncrementalBuilderHost {
|
|
|
430
429
|
if (msg.type === "builder-ready" && !this.ready) {
|
|
431
430
|
this.ready = true;
|
|
432
431
|
this.#status = "ready";
|
|
433
|
-
this.#
|
|
432
|
+
this.#restart.reset();
|
|
434
433
|
if (isRestart)
|
|
435
434
|
this.#startOptions.onRestartReady?.();
|
|
436
435
|
else
|
|
@@ -495,19 +494,15 @@ class IncrementalBuilderHost {
|
|
|
495
494
|
} catch {}
|
|
496
495
|
}
|
|
497
496
|
#scheduleRestart() {
|
|
498
|
-
if (this.#manualStop || this.#
|
|
497
|
+
if (this.#manualStop || this.#restart.pending)
|
|
499
498
|
return;
|
|
500
499
|
this.#status = "restarting";
|
|
501
|
-
const
|
|
502
|
-
const delay = Math.min(IncrementalBuilderHost.#restartBaseDelayMs * 2 ** attempt, IncrementalBuilderHost.#restartMaxDelayMs);
|
|
503
|
-
this.#restartAttempts = attempt + 1;
|
|
504
|
-
this.logger.warn(`builder exited after ready; restarting in ${delay}ms (attempt ${this.#restartAttempts})`);
|
|
505
|
-
this.#restartTimer = setTimeout(() => {
|
|
506
|
-
this.#restartTimer = null;
|
|
500
|
+
const delay = this.#restart.schedule(() => {
|
|
507
501
|
if (this.#manualStop)
|
|
508
502
|
return;
|
|
509
503
|
this.#spawn(true);
|
|
510
|
-
}
|
|
504
|
+
});
|
|
505
|
+
this.logger.warn(`builder exited after ready; restarting in ${delay}ms (attempt ${this.#restart.attempts})`);
|
|
511
506
|
}
|
|
512
507
|
recycle(reason) {
|
|
513
508
|
if (!this.#proc || this.#status !== "ready" || this.#recycleRequested)
|
|
@@ -575,10 +570,7 @@ class IncrementalBuilderHost {
|
|
|
575
570
|
this.#manualStop = true;
|
|
576
571
|
this.#clearRecycle();
|
|
577
572
|
this.#failInFlight("builder was stopped before answering");
|
|
578
|
-
|
|
579
|
-
clearTimeout(this.#restartTimer);
|
|
580
|
-
this.#restartTimer = null;
|
|
581
|
-
}
|
|
573
|
+
this.#restart.cancel();
|
|
582
574
|
if (this.#proc)
|
|
583
575
|
this.#proc.kill();
|
|
584
576
|
this.#proc = null;
|
|
@@ -818,16 +810,12 @@ var backendMsgTypeSet = new Set(["build-route", "build-csr", "build-graph"]);
|
|
|
818
810
|
var asMib = (bytes) => Math.round(bytes / 1024 / 1024);
|
|
819
811
|
var BACKEND_RESTART_DEBOUNCE_MS = 120;
|
|
820
812
|
var BACKEND_GRACEFUL_TIMEOUT_MS = 8000;
|
|
821
|
-
var BACKEND_RECOVERY_BASE_DELAY_MS = 1000;
|
|
822
|
-
var BACKEND_RECOVERY_MAX_DELAY_MS = 30000;
|
|
823
813
|
var BACKEND_STDERR_TAIL_LIMIT = 40;
|
|
824
814
|
var BUILDER_READY_TIMEOUT_MS = 150000;
|
|
825
815
|
var BUILDER_START_MAX_ATTEMPTS = 3;
|
|
826
816
|
var BUILDER_RSS_RECYCLE_QUIET_MS = 750;
|
|
827
817
|
var BUILDER_RSS_SETTLE_MS = 20000;
|
|
828
818
|
var PS_RSS_TIMEOUT_MS = 2000;
|
|
829
|
-
var BUILDER_RECOVERY_BASE_DELAY_MS = 2000;
|
|
830
|
-
var BUILDER_RECOVERY_MAX_DELAY_MS = 60000;
|
|
831
819
|
|
|
832
820
|
class AkanAppHost {
|
|
833
821
|
app;
|
|
@@ -843,8 +831,7 @@ class AkanAppHost {
|
|
|
843
831
|
#backendReady = false;
|
|
844
832
|
#plannedBackendStops = new WeakSet;
|
|
845
833
|
#restartTimer = null;
|
|
846
|
-
#
|
|
847
|
-
#backendRecoveryAttempts = 0;
|
|
834
|
+
#backendRecovery = new RestartSchedule2(backendRecoveryPolicy);
|
|
848
835
|
#backendGaveUp = false;
|
|
849
836
|
#backendLifecycleState = "stopped";
|
|
850
837
|
#pendingRestartReason = null;
|
|
@@ -852,8 +839,8 @@ class AkanAppHost {
|
|
|
852
839
|
#pendingRecycle = null;
|
|
853
840
|
#restartFailedAfterApply = null;
|
|
854
841
|
#stopping = false;
|
|
855
|
-
#
|
|
856
|
-
#
|
|
842
|
+
#builderRecovery = new RestartSchedule2({ min: 2000, max: 60000 });
|
|
843
|
+
#abandonBuilderStart = null;
|
|
857
844
|
#backendStartStatus = null;
|
|
858
845
|
#backendBuildStatusGeneration = 0;
|
|
859
846
|
#backendStderrTail = [];
|
|
@@ -920,6 +907,7 @@ class AkanAppHost {
|
|
|
920
907
|
this.#cancelIdleSuspend();
|
|
921
908
|
this.#stopIdleWatcher();
|
|
922
909
|
this.#clearRestartTimers();
|
|
910
|
+
this.#abandonBuilderStart?.(new Error("dev server stopped before the builder was ready"));
|
|
923
911
|
this.#pendingRestartReason = null;
|
|
924
912
|
this.#failPendingBuilderMessages("dev server is shutting down");
|
|
925
913
|
await this.#backendRestart;
|
|
@@ -928,10 +916,11 @@ class AkanAppHost {
|
|
|
928
916
|
return this;
|
|
929
917
|
}
|
|
930
918
|
#clearRestartTimers() {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
this.#
|
|
919
|
+
if (this.#restartTimer)
|
|
920
|
+
clearTimeout(this.#restartTimer);
|
|
921
|
+
this.#restartTimer = null;
|
|
922
|
+
this.#backendRecovery.cancel();
|
|
923
|
+
this.#builderRecovery.cancel();
|
|
935
924
|
}
|
|
936
925
|
kill() {
|
|
937
926
|
this.stop();
|
|
@@ -973,7 +962,7 @@ class AkanAppHost {
|
|
|
973
962
|
return;
|
|
974
963
|
if (msg.type === "backend-ready") {
|
|
975
964
|
this.#backendReady = true;
|
|
976
|
-
this.#
|
|
965
|
+
this.#backendRecovery.reset();
|
|
977
966
|
this.#setBackendLifecycleState("ready", `pid=${msg.pid}`);
|
|
978
967
|
this.#recordBackendReadyStatus();
|
|
979
968
|
this.logger.verbose(`backend ready pid=${msg.pid}`);
|
|
@@ -1131,10 +1120,7 @@ class AkanAppHost {
|
|
|
1131
1120
|
this.#pendingRestartReason = mergeBackendRestartReasons(this.#pendingRestartReason, reason);
|
|
1132
1121
|
const pending = this.#pendingRestartReason;
|
|
1133
1122
|
this.#setBackendLifecycleState("restart-pending", `generation=${pending.generation ?? "(unknown)"} files=${pending.files.length} roles=${pending.roles.join(",") || "(none)"}`);
|
|
1134
|
-
|
|
1135
|
-
clearTimeout(this.#backendRecoveryTimer);
|
|
1136
|
-
this.#backendRecoveryTimer = null;
|
|
1137
|
-
}
|
|
1123
|
+
this.#backendRecovery.cancel();
|
|
1138
1124
|
if (this.#restartTimer)
|
|
1139
1125
|
clearTimeout(this.#restartTimer);
|
|
1140
1126
|
this.#restartTimer = setTimeout(() => {
|
|
@@ -1153,17 +1139,17 @@ class AkanAppHost {
|
|
|
1153
1139
|
}
|
|
1154
1140
|
async#restartBackend(reason) {
|
|
1155
1141
|
this.logger.verbose(`[backend-reload] restarting backend generation=${reason.generation ?? "(unknown)"} files=${reason.files.length} roles=${reason.roles.join(",") || "(none)"}`);
|
|
1156
|
-
this.#
|
|
1142
|
+
this.#backendRecovery.reset();
|
|
1157
1143
|
await Promise.all([this.#stopBackend(), this.#backendGraph.refresh()]);
|
|
1158
1144
|
this.#startBackend({ generation: reason.generation, files: reason.files });
|
|
1159
1145
|
}
|
|
1160
1146
|
#scheduleBackendRecovery(reason) {
|
|
1161
|
-
if (this.#
|
|
1147
|
+
if (this.#backendRecovery.pending || this.#backend)
|
|
1162
1148
|
return;
|
|
1163
|
-
if (
|
|
1164
|
-
const message = `Backend exited ${this.#
|
|
1149
|
+
if (this.#backendRecovery.exhausted) {
|
|
1150
|
+
const message = `Backend exited ${this.#backendRecovery.attempts} times in a row (${reason}); waiting for an edit or a green build to retry.`;
|
|
1165
1151
|
this.#backendGaveUp = true;
|
|
1166
|
-
this.#setBackendLifecycleState("stopped", `gave up after ${this.#
|
|
1152
|
+
this.#setBackendLifecycleState("stopped", `gave up after ${this.#backendRecovery.attempts} recovery attempts`);
|
|
1167
1153
|
this.logger.error(`[backend-recovery] ${message}`);
|
|
1168
1154
|
if (this.#backendStderrTail.length > 0) {
|
|
1169
1155
|
this.logger.error(`[backend-recovery] recent backend stderr:
|
|
@@ -1175,30 +1161,27 @@ ${this.#backendStderrTail.join(`
|
|
|
1175
1161
|
return;
|
|
1176
1162
|
}
|
|
1177
1163
|
this.#setBackendLifecycleState("recovering", reason);
|
|
1178
|
-
const
|
|
1179
|
-
const delay = Math.min(BACKEND_RECOVERY_BASE_DELAY_MS * 2 ** attempt, BACKEND_RECOVERY_MAX_DELAY_MS);
|
|
1180
|
-
this.#backendRecoveryAttempts = attempt + 1;
|
|
1164
|
+
const delay = this.#backendRecovery.next();
|
|
1181
1165
|
const failureStatus = this.#recordBackendBuildStatus({
|
|
1182
1166
|
ok: false,
|
|
1183
1167
|
files: [],
|
|
1184
1168
|
message: `Backend exited unexpectedly (${reason}); restarting in ${delay}ms`
|
|
1185
1169
|
});
|
|
1186
1170
|
this.#sendOrQueueBuildStatus(failureStatus);
|
|
1187
|
-
this.logger.warn(`[backend-recovery] backend exited unexpectedly (${reason}); restarting in ${delay}ms (attempt ${this.#
|
|
1171
|
+
this.logger.warn(`[backend-recovery] backend exited unexpectedly (${reason}); restarting in ${delay}ms (attempt ${this.#backendRecovery.attempts})`);
|
|
1188
1172
|
if (this.#backendStderrTail.length > 0) {
|
|
1189
1173
|
this.logger.warn(`[backend-recovery] recent backend stderr:
|
|
1190
1174
|
${this.#backendStderrTail.join(`
|
|
1191
1175
|
`)}`);
|
|
1192
1176
|
}
|
|
1193
|
-
this.#
|
|
1194
|
-
this.#backendRecoveryTimer = null;
|
|
1177
|
+
this.#backendRecovery.arm(delay, () => {
|
|
1195
1178
|
if (this.#backend)
|
|
1196
1179
|
return;
|
|
1197
1180
|
this.#backendGraph.refresh().finally(() => {
|
|
1198
1181
|
if (!this.#backend)
|
|
1199
1182
|
this.#startBackend({ generation: failureStatus.generation, files: failureStatus.files });
|
|
1200
1183
|
});
|
|
1201
|
-
}
|
|
1184
|
+
});
|
|
1202
1185
|
}
|
|
1203
1186
|
#enqueueBuilderMessage(message) {
|
|
1204
1187
|
this.#builderMessageQueue = this.#builderMessageQueue.then(() => this.#handleBuilderMessage(message)).catch((err) => {
|
|
@@ -1463,7 +1446,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1463
1446
|
this.logger.info(`[idle-suspend] no build activity for ${Math.round(idleMs / 1000)}s; released the builder \u2014 the next edit or route request brings it back`);
|
|
1464
1447
|
}
|
|
1465
1448
|
get #restartPending() {
|
|
1466
|
-
return !!(this.#pendingRecycle || this.#restartTimer || this.#backendRestart || this.#
|
|
1449
|
+
return !!(this.#pendingRecycle || this.#restartTimer || this.#backendRestart || this.#backendRecovery.pending || this.#builderRecovery.pending || this.#rssRecycleReason);
|
|
1467
1450
|
}
|
|
1468
1451
|
async#startIdleWatcher() {
|
|
1469
1452
|
try {
|
|
@@ -1707,28 +1690,26 @@ ${this.#backendStderrTail.join(`
|
|
|
1707
1690
|
this.#scheduleBuilderRecovery({ generation, files: message.files });
|
|
1708
1691
|
}
|
|
1709
1692
|
#scheduleBuilderRecovery(reason) {
|
|
1710
|
-
if (this.#
|
|
1711
|
-
return;
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1714
|
-
this.#builderRecoveryAttempts = attempt + 1;
|
|
1715
|
-
this.logger.warn(`[builder-recovery] builder is down; retrying start in ${delay}ms (attempt ${this.#builderRecoveryAttempts})`);
|
|
1716
|
-
this.#builderRecoveryTimer = setTimeout(() => {
|
|
1717
|
-
this.#builderRecoveryTimer = null;
|
|
1718
|
-
if (this.#builder)
|
|
1693
|
+
if (this.#stopping || this.#builderRecovery.pending || this.#builder)
|
|
1694
|
+
return;
|
|
1695
|
+
const delay = this.#builderRecovery.schedule(() => {
|
|
1696
|
+
if (this.#stopping || this.#builder)
|
|
1719
1697
|
return;
|
|
1720
1698
|
this.#recoverBuilder(reason);
|
|
1721
|
-
}
|
|
1699
|
+
});
|
|
1700
|
+
this.logger.warn(`[builder-recovery] builder is down; retrying start in ${delay}ms (attempt ${this.#builderRecovery.attempts})`);
|
|
1722
1701
|
}
|
|
1723
1702
|
async#recoverBuilder(reason) {
|
|
1724
1703
|
try {
|
|
1725
1704
|
await this.#startBuilder();
|
|
1726
1705
|
} catch (err) {
|
|
1706
|
+
if (this.#stopping)
|
|
1707
|
+
return;
|
|
1727
1708
|
this.logger.warn(`[builder-recovery] builder start failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1728
1709
|
this.#scheduleBuilderRecovery(reason);
|
|
1729
1710
|
return;
|
|
1730
1711
|
}
|
|
1731
|
-
this.#
|
|
1712
|
+
this.#builderRecovery.reset();
|
|
1732
1713
|
this.logger.info("[builder-recovery] builder recovered");
|
|
1733
1714
|
this.#restartBackendForGapChanges();
|
|
1734
1715
|
const failedAfterApply = this.#restartFailedAfterApply;
|
|
@@ -1742,15 +1723,15 @@ ${this.#backendStderrTail.join(`
|
|
|
1742
1723
|
};
|
|
1743
1724
|
this.#recordBuildStatus(status);
|
|
1744
1725
|
this.#sendOrQueueBuildStatus(status);
|
|
1745
|
-
if (!this.#backend && !this.#
|
|
1726
|
+
if (!this.#backend && !this.#backendRecovery.pending) {
|
|
1746
1727
|
this.#startBackend({ generation: reason.generation, files: reason.files });
|
|
1747
1728
|
}
|
|
1748
1729
|
}
|
|
1749
1730
|
#reviveBackendAfterGreenBuild(status) {
|
|
1750
|
-
if (!status.ok || !this.#backendGaveUp || this.#backend || this.#
|
|
1731
|
+
if (!status.ok || !this.#backendGaveUp || this.#backend || this.#backendRecovery.pending)
|
|
1751
1732
|
return;
|
|
1752
1733
|
this.logger.info(`[backend-recovery] build went green (generation=${status.generation}); retrying backend`);
|
|
1753
|
-
this.#
|
|
1734
|
+
this.#backendRecovery.reset();
|
|
1754
1735
|
this.#startBackend({ generation: status.generation, files: status.files });
|
|
1755
1736
|
}
|
|
1756
1737
|
async#restartDevChildren(message) {
|
|
@@ -1766,7 +1747,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1766
1747
|
async#recycleDevChildren(message, { refreshConfig = false, progress } = {}) {
|
|
1767
1748
|
const generation = message.devPlan?.generation ?? message.generation;
|
|
1768
1749
|
this.#clearRestartTimers();
|
|
1769
|
-
this.#
|
|
1750
|
+
this.#builderRecovery.reset();
|
|
1770
1751
|
this.#pendingRestartReason = null;
|
|
1771
1752
|
await this.#backendRestart;
|
|
1772
1753
|
this.#lastGoodFrontend = {};
|
|
@@ -1886,13 +1867,18 @@ ${this.#backendStderrTail.join(`
|
|
|
1886
1867
|
this.app.verbose(`[cli] waiting for builder to complete initial base build\u2026`);
|
|
1887
1868
|
let lastError;
|
|
1888
1869
|
for (let attempt = 1;attempt <= BUILDER_START_MAX_ATTEMPTS; attempt++) {
|
|
1889
|
-
|
|
1870
|
+
const builder = await IncrementalBuilderHost.create(this.app, this.env, (msg) => {
|
|
1890
1871
|
this.#enqueueBuilderMessage(msg);
|
|
1891
1872
|
}, {
|
|
1892
1873
|
stdio: this.stdio,
|
|
1893
1874
|
onOutput: (kind, text) => void (kind === "stderr" ? process.stderr : process.stdout).write(text),
|
|
1894
1875
|
patcherOff: this.#patcherOff
|
|
1895
1876
|
});
|
|
1877
|
+
if (this.#stopping) {
|
|
1878
|
+
builder.stop();
|
|
1879
|
+
throw new Error("dev server stopped before the builder started");
|
|
1880
|
+
}
|
|
1881
|
+
this.#builder = builder;
|
|
1896
1882
|
try {
|
|
1897
1883
|
await this.#waitForBuilderReady(attempt, { announceBootState });
|
|
1898
1884
|
this.app.verbose(`[cli] base build ready in ${Date.now() - startTime}ms \u2014 starting backend`);
|
|
@@ -1900,7 +1886,7 @@ ${this.#backendStderrTail.join(`
|
|
|
1900
1886
|
} catch (err) {
|
|
1901
1887
|
lastError = err;
|
|
1902
1888
|
this.#stopBuilder();
|
|
1903
|
-
if (attempt >= BUILDER_START_MAX_ATTEMPTS)
|
|
1889
|
+
if (attempt >= BUILDER_START_MAX_ATTEMPTS || this.#stopping)
|
|
1904
1890
|
break;
|
|
1905
1891
|
this.app.verbose(`[cli] builder failed before ready; retrying (${attempt + 1}/${BUILDER_START_MAX_ATTEMPTS})`);
|
|
1906
1892
|
}
|
|
@@ -1918,8 +1904,12 @@ ${this.#backendStderrTail.join(`
|
|
|
1918
1904
|
return;
|
|
1919
1905
|
settled = true;
|
|
1920
1906
|
clearTimeout(timeout);
|
|
1907
|
+
if (this.#abandonBuilderStart === abandon)
|
|
1908
|
+
this.#abandonBuilderStart = null;
|
|
1921
1909
|
fn();
|
|
1922
1910
|
};
|
|
1911
|
+
const abandon = (error) => settle(() => reject(error));
|
|
1912
|
+
this.#abandonBuilderStart = abandon;
|
|
1923
1913
|
const timeout = setTimeout(() => {
|
|
1924
1914
|
settle(() => reject(new Error("[cli] builder timed out before emitting builder-ready")));
|
|
1925
1915
|
}, BUILDER_READY_TIMEOUT_MS);
|
|
@@ -2038,7 +2028,7 @@ var reportsNoTestFile = (exec) => {
|
|
|
2038
2028
|
};
|
|
2039
2029
|
|
|
2040
2030
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
2041
|
-
var loadBuildRunner = async () => (await import("./applicationBuildRunner-
|
|
2031
|
+
var loadBuildRunner = async () => (await import("./applicationBuildRunner-df7rx3ra.js")).ApplicationBuildRunner;
|
|
2042
2032
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
2043
2033
|
|
|
2044
2034
|
class ApplicationRunner extends runner("application") {
|
|
@@ -2239,7 +2229,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
|
|
|
2239
2229
|
await new (await loadBuildRunner())(app).typecheck(options);
|
|
2240
2230
|
}
|
|
2241
2231
|
async typecheckLibrary(lib, options = {}) {
|
|
2242
|
-
const { ProjectTypecheck } = await import("./projectTypecheck-
|
|
2232
|
+
const { ProjectTypecheck } = await import("./projectTypecheck-kkrpq60a.js");
|
|
2243
2233
|
const root = lib.workspace.workspaceRoot;
|
|
2244
2234
|
await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
|
|
2245
2235
|
"../../server.ts",
|
|
@@ -2715,7 +2705,7 @@ class VerifyScope {
|
|
|
2715
2705
|
const targets = requested.map((name) => {
|
|
2716
2706
|
const target = known.find((candidate) => candidate.name === name);
|
|
2717
2707
|
if (!target)
|
|
2718
|
-
throw new
|
|
2708
|
+
throw new CliError("unknownTarget", `${name} is not an app, library or package of this workspace`);
|
|
2719
2709
|
return { ...target, files: changedFilesOf(target.dir) };
|
|
2720
2710
|
});
|
|
2721
2711
|
return new VerifyScope(targets);
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ApplicationBuildReporter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-vm0dn0mt.js";
|
|
5
5
|
import {
|
|
6
6
|
parseBiomeReport,
|
|
7
7
|
Linter,
|
|
8
|
-
TypecheckFailure,
|
|
9
8
|
ProjectTypecheck2,
|
|
10
9
|
AppExecutor,
|
|
11
10
|
LibExecutor,
|
|
12
11
|
PkgExecutor
|
|
13
|
-
} from "./index-
|
|
12
|
+
} from "./index-3ghdb7p5.js";
|
|
13
|
+
import {
|
|
14
|
+
TypecheckFailure
|
|
15
|
+
} from "./index-j4yvgfhr.js";
|
|
14
16
|
import {
|
|
15
17
|
WorkspaceRunner,
|
|
16
18
|
AkanQualityScanner
|
|
17
|
-
} from "./index-
|
|
19
|
+
} from "./index-xyn02k0w.js";
|
|
18
20
|
|
|
19
21
|
// pkgs/@akanjs/cli/verify/verifyComments.ts
|
|
20
22
|
import { existsSync } from "fs";
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
UpdatePackFolder,
|
|
10
10
|
NativePublicEnv,
|
|
11
11
|
NativeApp
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-43f4h4cm.js";
|
|
13
13
|
import {
|
|
14
14
|
ExitCodeError
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-exn38bzx.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigLock
|
|
18
18
|
} from "./index-bqbf654f.js";
|
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-rfzp4pqs.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor,
|
|
15
15
|
AppExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-3ghdb7p5.js";
|
|
17
17
|
import {
|
|
18
18
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-43f4h4cm.js";
|
|
20
20
|
import {
|
|
21
21
|
runner,
|
|
22
22
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-exn38bzx.js";
|
|
24
24
|
import {
|
|
25
25
|
getNpmRegistryUrl,
|
|
26
26
|
getPublishedVersions,
|
|
@@ -1067,6 +1067,7 @@ ${run.format(results)}
|
|
|
1067
1067
|
if (!interactive)
|
|
1068
1068
|
continue;
|
|
1069
1069
|
assertPromptable(`${result.platform} did not pass (${reason}) \u2014 ${run.logDir}`, {
|
|
1070
|
+
code: "failed",
|
|
1070
1071
|
remedy: "leave it out of --platforms to publish without it, or run it in a terminal to be asked"
|
|
1071
1072
|
});
|
|
1072
1073
|
const proceed = await confirm({
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
SubagentPool2,
|
|
20
20
|
McpSignIn,
|
|
21
21
|
AkanCodeCompaction2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-2r9ff9qm.js";
|
|
23
23
|
import {
|
|
24
24
|
codeAgentIsLoopback,
|
|
25
25
|
codeAgentHostListed,
|
|
@@ -659,7 +659,7 @@ class AkanToolPack2 {
|
|
|
659
659
|
return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
|
|
660
660
|
}
|
|
661
661
|
async names() {
|
|
662
|
-
const { ContextRunner } = await import("./context.runner-
|
|
662
|
+
const { ContextRunner } = await import("./context.runner-83ky5m1b.js");
|
|
663
663
|
return [
|
|
664
664
|
...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
|
|
665
665
|
AkanToolPack2.verifyToolName
|
|
@@ -667,7 +667,7 @@ class AkanToolPack2 {
|
|
|
667
667
|
}
|
|
668
668
|
static verifyToolName = "akan_verify";
|
|
669
669
|
async#register(pi) {
|
|
670
|
-
const { ContextRunner } = await import("./context.runner-
|
|
670
|
+
const { ContextRunner } = await import("./context.runner-83ky5m1b.js");
|
|
671
671
|
const runner = new ContextRunner;
|
|
672
672
|
const guidelineNames = await AkanToolPack2.#guidelineNames();
|
|
673
673
|
for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
|
|
@@ -854,6 +854,7 @@ import {
|
|
|
854
854
|
import { Type as Type4 } from "typebox";
|
|
855
855
|
|
|
856
856
|
// pkgs/@akanjs/devkit/codeAgent/tools/McpClient.ts
|
|
857
|
+
import { FailureCode, MCP_FAILURE_META } from "akanjs/common";
|
|
857
858
|
var protocolVersion = "2025-06-18";
|
|
858
859
|
|
|
859
860
|
class McpUnauthorized2 extends Error {
|
|
@@ -909,8 +910,14 @@ class McpClient2 {
|
|
|
909
910
|
async callTool(name, args) {
|
|
910
911
|
const response = await this.#call("tools/call", { name, arguments: args });
|
|
911
912
|
if (response.error)
|
|
912
|
-
return { text: response.error.message, isError: true };
|
|
913
|
-
|
|
913
|
+
return { text: response.error.message, isError: true, ...McpClient2.#coded(response.error.data) };
|
|
914
|
+
const isError = !!response.result?.isError;
|
|
915
|
+
const failure = isError ? response.result?._meta?.[MCP_FAILURE_META] : undefined;
|
|
916
|
+
return { text: McpClient2.#renderContent(response.result?.content), isError, ...McpClient2.#coded(failure) };
|
|
917
|
+
}
|
|
918
|
+
static #coded(carrier) {
|
|
919
|
+
const code = carrier && typeof carrier === "object" ? carrier.code : undefined;
|
|
920
|
+
return FailureCode.is(code) ? { code } : {};
|
|
914
921
|
}
|
|
915
922
|
close() {
|
|
916
923
|
this.#proc?.kill();
|
|
@@ -1098,7 +1105,7 @@ class McpToolPack2 {
|
|
|
1098
1105
|
const result = await this.#call(server, tool.name, params ?? {});
|
|
1099
1106
|
return {
|
|
1100
1107
|
content: [{ type: "text", text: codeAgentClip(result.text, codeAgentOutputChars) }],
|
|
1101
|
-
details: undefined,
|
|
1108
|
+
details: result.code === undefined ? undefined : { code: result.code },
|
|
1102
1109
|
isError: result.isError
|
|
1103
1110
|
};
|
|
1104
1111
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-exn38bzx.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys2
|
|
8
8
|
} from "./index-bns3wcpc.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-3ghdb7p5.js";
|
|
12
12
|
import {
|
|
13
13
|
TypeScriptDependencyScanner2
|
|
14
14
|
} from "./index-qd7xn2bk.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./index-cmg5ngqa.js";
|
|
18
18
|
import {
|
|
19
19
|
MaintainabilityBaseline
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-5zwr4n6k.js";
|
|
21
21
|
import {
|
|
22
22
|
assertPackageName
|
|
23
23
|
} from "./index-va90m8nd.js";
|
|
@@ -95,7 +95,7 @@ var addFieldWorkflowSpec = {
|
|
|
95
95
|
type: {
|
|
96
96
|
type: "string",
|
|
97
97
|
required: true,
|
|
98
|
-
description: "Field type or scalar name. Use Int for integer fields or Float for decimal fields; do not use Number."
|
|
98
|
+
description: "Field type: a built-in or akanjs/base type, or a scalar or model of the target by class name, which apply imports. Use Int for integer fields or Float for decimal fields; do not use Number."
|
|
99
99
|
},
|
|
100
100
|
values: { type: "string-list", description: "Comma-separated enum values when type is enum." },
|
|
101
101
|
default: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
JsonFormatter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-3ghdb7p5.js";
|
|
5
5
|
|
|
6
6
|
// pkgs/@akanjs/devkit/applicationBuildReporter.ts
|
|
7
7
|
import { realpathSync } from "fs";
|
|
@@ -954,7 +954,7 @@ var redisTunnelPolicy = ({
|
|
|
954
954
|
environment,
|
|
955
955
|
databaseMode
|
|
956
956
|
}) => environment === "local" ? "none" : databaseMode === "single" ? "optional" : "required";
|
|
957
|
-
var
|
|
957
|
+
var backendRecoveryPolicy = { min: 1000, max: 30000, maxAttempts: 5 };
|
|
958
958
|
var HELD_BUILDER_REQUEST_LIMIT = 64;
|
|
959
959
|
var BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS = 30000;
|
|
960
960
|
var BUILDER_TIGHT_RSS_REPORT_LIMIT = 2;
|
|
@@ -975,7 +975,6 @@ var shouldRestartBackendByDevPlan = (message) => {
|
|
|
975
975
|
return message.devPlan.actions.includes("restart-backend");
|
|
976
976
|
};
|
|
977
977
|
var shouldRestartBuilderByDevPlan = (message) => message.devPlan?.actions.includes("restart-builder") ?? false;
|
|
978
|
-
var shouldAbandonBackendRecovery = (attempts, maxAttempts = BACKEND_RECOVERY_MAX_ATTEMPTS) => attempts >= maxAttempts;
|
|
979
978
|
var normalizeBackendReportedGeneration = (generation) => generation >= 0 ? generation : undefined;
|
|
980
979
|
var shouldRestartDevHostByDevPlan = (message) => message.devPlan?.actions.includes("restart-dev-host") ?? message.kinds.includes("config");
|
|
981
980
|
var devHostStateByBackendState = {
|
|
@@ -1712,4 +1711,4 @@ class HmrWatcher {
|
|
|
1712
1711
|
}
|
|
1713
1712
|
}
|
|
1714
1713
|
|
|
1715
|
-
export { UNAVAILABLE_REDIS_HOST, redisTunnelPolicy, BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS, SOURCE_EXTS, shouldRestartBackendByDevPlan, shouldRestartBuilderByDevPlan,
|
|
1714
|
+
export { UNAVAILABLE_REDIS_HOST, redisTunnelPolicy, backendRecoveryPolicy, BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS, SOURCE_EXTS, shouldRestartBackendByDevPlan, shouldRestartBuilderByDevPlan, normalizeBackendReportedGeneration, shouldRestartDevHostByDevPlan, devHostStateOf, isLegacyBackendFallbackFile, shouldMarkBuildPhaseRecovered, shouldKeepBuildFailure, createBackendBuildStatus, backendRestartReasonFromMessage, mergeBackendRestartReasons, shouldReplaceLastGoodMessage, shouldQueueBuildStatusReplay, hasBuildFailureForGeneration, decideBuilderRssRecycle, decideBuilderRssSettle, decideIdleSuspend, resolveIdleSuspendMs, hasAnyBuildFailure, shouldRefreshConfigOnIdleWake, shouldHoldForReturningBuilder, shouldWarnBuilderRssCeilingTight, isRssCeilingUnreachable, shouldRelayRecycledFrontendState, mergeInvalidateMessages, buildStatusReplaySequence, filesChangedSince, HmrWatcher, WatchRootResolver, FontOptimizer, FontPruner, RouteJsBudget, ApplicationBuildReporter };
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
SOURCE_EXTS,
|
|
7
7
|
WatchRootResolver
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-vm0dn0mt.js";
|
|
9
9
|
import {
|
|
10
10
|
loaderFor,
|
|
11
11
|
BarrelAnalyzer,
|
|
@@ -21,12 +21,12 @@ import {
|
|
|
21
21
|
CsrDevPaths,
|
|
22
22
|
PagesEntrySourceGenerator,
|
|
23
23
|
PagesBundleBuilder
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-nmvhjn8c.js";
|
|
25
25
|
import {
|
|
26
26
|
AsyncDefaultExportDetector,
|
|
27
27
|
StoreBootstrap,
|
|
28
28
|
resolveSsrPageEntriesForApp
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-3ghdb7p5.js";
|
|
30
30
|
|
|
31
31
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
32
32
|
import { readdir, readFile, stat } from "fs/promises";
|