hanoman 0.9.1 → 0.9.2
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/dist/build-info.json +3 -3
- package/dist/server.js +47 -1
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
package/dist/server.js
CHANGED
|
@@ -41231,6 +41231,14 @@ async function reconcileHistory(liveSessionIds) {
|
|
|
41231
41231
|
}
|
|
41232
41232
|
return closed;
|
|
41233
41233
|
}
|
|
41234
|
+
async function reconciledSpecIdsSince(cutoff) {
|
|
41235
|
+
const rows = await prisma.sessionHistory.findMany({
|
|
41236
|
+
where: { endedReason: RECONCILED, reconciledAt: { gte: cutoff }, specId: { not: null } },
|
|
41237
|
+
select: { specId: true },
|
|
41238
|
+
distinct: ["specId"]
|
|
41239
|
+
});
|
|
41240
|
+
return rows.map((r) => r.specId);
|
|
41241
|
+
}
|
|
41234
41242
|
function installSessionHistory() {
|
|
41235
41243
|
registerSessionHooks({
|
|
41236
41244
|
onBirth: (b) => {
|
|
@@ -41938,7 +41946,7 @@ function buildResumeCtx(repoDir, id2, flow2, worktreeKept) {
|
|
|
41938
41946
|
}
|
|
41939
41947
|
async function startSpecSession(spec, opts) {
|
|
41940
41948
|
const id2 = sessionIdForSpec(spec.id);
|
|
41941
|
-
return withSessionAdmission({ id: id2, force: opts.force }, async () => {
|
|
41949
|
+
return withSessionAdmission({ id: id2, force: opts.force || opts.bypassCapacity }, async () => {
|
|
41942
41950
|
const pane = await getSessionAsync(id2);
|
|
41943
41951
|
if (!pane) {
|
|
41944
41952
|
const view13 = await presenceView();
|
|
@@ -53146,6 +53154,36 @@ function registerTriaseSource() {
|
|
|
53146
53154
|
registerSchedulerSource({ id: "triase", check: checkTriase });
|
|
53147
53155
|
}
|
|
53148
53156
|
|
|
53157
|
+
// src/services/session-boot-resume.ts
|
|
53158
|
+
init_src();
|
|
53159
|
+
init_db();
|
|
53160
|
+
init_notifications2();
|
|
53161
|
+
var prodDeps2 = {
|
|
53162
|
+
// ADR-0169 · `bypassCapacity: true` — SATU-SATUNYA jalur yang melewati cap ADR-0161; gerbang
|
|
53163
|
+
// dependency ADR-0093 TETAP berlaku (tak diberi `force`). Keputusan sadar risiko: mesin 8 GB
|
|
53164
|
+
// operator sudah pernah kernel panic akibat sesi paralel berlebih (memori
|
|
53165
|
+
// mac-mini-8gb-panic-agen-paralel) — operator memilih "semua kembali" di atas throttle.
|
|
53166
|
+
startSpec: (spec) => startSpecSession(spec, { flow: flowForSource(spec.source), bypassCapacity: true }),
|
|
53167
|
+
recordFail: recordFailure
|
|
53168
|
+
};
|
|
53169
|
+
async function resumeReconciledSessions(cutoff, deps = prodDeps2) {
|
|
53170
|
+
const report = { resumed: [], failed: [] };
|
|
53171
|
+
const specIds = await reconciledSpecIdsSince(cutoff);
|
|
53172
|
+
if (!specIds.length) return report;
|
|
53173
|
+
const specs = await prisma.spec.findMany({ where: { id: { in: specIds }, stage: { not: "done" } } });
|
|
53174
|
+
for (const spec of specs) {
|
|
53175
|
+
try {
|
|
53176
|
+
await deps.startSpec(spec);
|
|
53177
|
+
report.resumed.push(spec.id);
|
|
53178
|
+
} catch (e) {
|
|
53179
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
53180
|
+
await deps.recordFail(spec.id, spec.title, spec.projectId, `gagal dilanjutkan otomatis \u2014 ${reason}`);
|
|
53181
|
+
report.failed.push(spec.id);
|
|
53182
|
+
}
|
|
53183
|
+
}
|
|
53184
|
+
return report;
|
|
53185
|
+
}
|
|
53186
|
+
|
|
53149
53187
|
// src/server.ts
|
|
53150
53188
|
init_event_log();
|
|
53151
53189
|
init_settings3();
|
|
@@ -53905,11 +53943,19 @@ bootstrapReady.then(async () => {
|
|
|
53905
53943
|
if (bootSetting.logShipping.server) installConsoleTap();
|
|
53906
53944
|
try {
|
|
53907
53945
|
const liveIds = listSessions().map((s2) => s2.id);
|
|
53946
|
+
const reconcileCutoff = /* @__PURE__ */ new Date();
|
|
53908
53947
|
void reconcileHistory(liveIds).then(async (n2) => {
|
|
53909
53948
|
if (n2) console.log(`riwayat sesi: ${n2} baris berjalan direkonsiliasi`);
|
|
53910
53949
|
for (const row of await detectOrphanWorktrees()) {
|
|
53911
53950
|
console.log(`worktree yatim: ${row.projectId} \u2014 ${row.count} menunggu konfirmasi di tab Worktrees`);
|
|
53912
53951
|
}
|
|
53952
|
+
if (n2) {
|
|
53953
|
+
const { resumed, failed } = await resumeReconciledSessions(reconcileCutoff);
|
|
53954
|
+
if (resumed.length)
|
|
53955
|
+
console.log(`auto-resume: ${resumed.length} sesi dilanjutkan otomatis (${resumed.join(", ")})`);
|
|
53956
|
+
if (failed.length)
|
|
53957
|
+
console.log(`auto-resume: ${failed.length} sesi gagal dilanjutkan otomatis, lihat notifikasi (${failed.join(", ")})`);
|
|
53958
|
+
}
|
|
53913
53959
|
}).catch((e) => console.error("rekonsiliasi riwayat sesi:", e));
|
|
53914
53960
|
void reconcileAgentInvocations(liveIds).then((n2) => {
|
|
53915
53961
|
if (n2) console.log(`custom agent: ${n2} invocation ditandai abandoned`);
|