@namzu/cli 45.9.2 → 45.10.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.
- package/CHANGELOG.md +13 -0
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-XQR3O5Z5.js → acp-3BPCM2WA.js} +8 -8
- package/dist/chunks/{add-G57WA2GJ.js → add-OHTAZUMT.js} +5 -5
- package/dist/chunks/{agent-K547PXS7.js → agent-CP7TJMBB.js} +4 -4
- package/dist/chunks/{agent-session-JFGRPZHQ.js → agent-session-RIIQB63L.js} +5 -5
- package/dist/chunks/{bin-main-COD43DP4.js → bin-main-KOGFY7YP.js} +3 -3
- package/dist/chunks/{chat-BBW3FSWW.js → chat-XLIEE6C2.js} +2 -2
- package/dist/chunks/{chunk-H5HR43HQ.js → chunk-2PVFI6GK.js} +223 -66
- package/dist/chunks/chunk-2PVFI6GK.js.map +6 -0
- package/dist/chunks/{chunk-4MZSEJ5J.js → chunk-36QUG4CL.js} +5 -5
- package/dist/chunks/{chunk-7JX7V5P4.js → chunk-4YGXTFAE.js} +2 -2
- package/dist/chunks/{chunk-5FXZQ42Q.js → chunk-5C2PVGLX.js} +2 -2
- package/dist/chunks/{chunk-UZ75A4DA.js → chunk-5OIMQOJG.js} +4 -3
- package/dist/chunks/chunk-5OIMQOJG.js.map +6 -0
- package/dist/chunks/{chunk-TAPS6JOC.js → chunk-A6NKIHAU.js} +2 -2
- package/dist/chunks/{chunk-RP6O2GVC.js → chunk-DP35HQBK.js} +3 -3
- package/dist/chunks/{chunk-VTYV7ZXP.js → chunk-GXPRMEBI.js} +2 -2
- package/dist/chunks/{chunk-WBDSJSAB.js → chunk-HUNGHFGK.js} +2 -2
- package/dist/chunks/{chunk-4IUTV7UN.js → chunk-ITSDVVZ7.js} +3 -3
- package/dist/chunks/{chunk-C2SLVYIT.js → chunk-KXRUF6WE.js} +2 -2
- package/dist/chunks/{chunk-JG2ZBJOQ.js → chunk-L6MFBL7H.js} +17 -17
- package/dist/chunks/{chunk-KD6UPZT7.js → chunk-L7VMS5JX.js} +3 -3
- package/dist/chunks/{chunk-GP3ZE47C.js → chunk-LDTCQCX2.js} +3 -3
- package/dist/chunks/{chunk-WNC7MDAC.js → chunk-LFBTW453.js} +2 -2
- package/dist/chunks/{chunk-4E7CFJKP.js → chunk-LN2JFGCM.js} +2 -2
- package/dist/chunks/{chunk-CNKZ5OEN.js → chunk-QHQHQFTY.js} +2 -2
- package/dist/chunks/{chunk-PTBVQOSI.js → chunk-RZ74SRZR.js} +2 -2
- package/dist/chunks/{chunk-3XPCMW6Y.js → chunk-VYTQ3GJF.js} +2 -2
- package/dist/chunks/{chunk-Q275XU7A.js → chunk-WL2KAT7X.js} +2 -2
- package/dist/chunks/{chunk-76ZHDUSD.js → chunk-X7ODFDJW.js} +2 -2
- package/dist/chunks/{cli-runtime-FI5IMJQW.js → cli-runtime-7LU3JUKO.js} +3 -3
- package/dist/chunks/{doctor-NPOW6W7J.js → doctor-5JZJK4AJ.js} +6 -6
- package/dist/chunks/{drain-BH55K7YU.js → drain-WVJZCIHU.js} +2 -2
- package/dist/chunks/{exec-MX3B2UN3.js → exec-GHHQAUM5.js} +7 -7
- package/dist/chunks/{host-queries-HZWZJC3A.js → host-queries-TTVZPVFH.js} +2 -2
- package/dist/chunks/{learn-USAWIP7K.js → learn-QWKYL537.js} +2 -2
- package/dist/chunks/{learn-builtin-E2VD4DHQ.js → learn-builtin-TDSK4FNG.js} +3 -3
- package/dist/chunks/{lifecycle-7VSEDBPU.js → lifecycle-QVPXT3GP.js} +6 -6
- package/dist/chunks/{list-ZM3IAEUT.js → list-CVEFKJW7.js} +3 -3
- package/dist/chunks/{live-7SJSBRSQ.js → live-ZJXXVGTH.js} +5 -5
- package/dist/chunks/{mcp-L4CZFIYN.js → mcp-FKSBFVBF.js} +2 -2
- package/dist/chunks/{message-command-V2J24YP5.js → message-command-OSVRQUH7.js} +7 -7
- package/dist/chunks/{pal-7IB7RW64.js → pal-M3GCQRFL.js} +3 -3
- package/dist/chunks/{resident-3RTS73JY.js → resident-3U5NY24H.js} +4 -4
- package/dist/chunks/{schedule-2K3YV2MJ.js → schedule-N5YZBH26.js} +5 -5
- package/dist/chunks/{service-YYTU36DB.js → service-ZZH7EKSL.js} +5 -5
- package/dist/chunks/{session-step-AUWOQOPI.js → session-step-4JBIREGL.js} +2 -2
- package/dist/chunks/{start-check-YXOI4UKE.js → start-check-OVCPWK4G.js} +2 -2
- package/dist/chunks/{tui-VJUFUWQH.js → tui-GBZ7SLVJ.js} +67 -154
- package/dist/chunks/tui-GBZ7SLVJ.js.map +6 -0
- package/dist/chunks/{upgrade-PBDROOBR.js → upgrade-GWJDTRRD.js} +3 -3
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +3 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/integrations/decision/memory-admit.d.ts +27 -0
- package/dist/integrations/decision/memory-admit.d.ts.map +1 -0
- package/dist/integrations/resident/runner-worker.js +1 -1
- package/dist/tui/agent.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/chunks/chunk-H5HR43HQ.js.map +0 -6
- package/dist/chunks/chunk-UZ75A4DA.js.map +0 -6
- package/dist/chunks/tui-VJUFUWQH.js.map +0 -6
- /package/dist/chunks/{acp-XQR3O5Z5.js.map → acp-3BPCM2WA.js.map} +0 -0
- /package/dist/chunks/{add-G57WA2GJ.js.map → add-OHTAZUMT.js.map} +0 -0
- /package/dist/chunks/{agent-K547PXS7.js.map → agent-CP7TJMBB.js.map} +0 -0
- /package/dist/chunks/{agent-session-JFGRPZHQ.js.map → agent-session-RIIQB63L.js.map} +0 -0
- /package/dist/chunks/{bin-main-COD43DP4.js.map → bin-main-KOGFY7YP.js.map} +0 -0
- /package/dist/chunks/{chat-BBW3FSWW.js.map → chat-XLIEE6C2.js.map} +0 -0
- /package/dist/chunks/{chunk-4MZSEJ5J.js.map → chunk-36QUG4CL.js.map} +0 -0
- /package/dist/chunks/{chunk-7JX7V5P4.js.map → chunk-4YGXTFAE.js.map} +0 -0
- /package/dist/chunks/{chunk-5FXZQ42Q.js.map → chunk-5C2PVGLX.js.map} +0 -0
- /package/dist/chunks/{chunk-TAPS6JOC.js.map → chunk-A6NKIHAU.js.map} +0 -0
- /package/dist/chunks/{chunk-RP6O2GVC.js.map → chunk-DP35HQBK.js.map} +0 -0
- /package/dist/chunks/{chunk-VTYV7ZXP.js.map → chunk-GXPRMEBI.js.map} +0 -0
- /package/dist/chunks/{chunk-WBDSJSAB.js.map → chunk-HUNGHFGK.js.map} +0 -0
- /package/dist/chunks/{chunk-4IUTV7UN.js.map → chunk-ITSDVVZ7.js.map} +0 -0
- /package/dist/chunks/{chunk-C2SLVYIT.js.map → chunk-KXRUF6WE.js.map} +0 -0
- /package/dist/chunks/{chunk-JG2ZBJOQ.js.map → chunk-L6MFBL7H.js.map} +0 -0
- /package/dist/chunks/{chunk-KD6UPZT7.js.map → chunk-L7VMS5JX.js.map} +0 -0
- /package/dist/chunks/{chunk-GP3ZE47C.js.map → chunk-LDTCQCX2.js.map} +0 -0
- /package/dist/chunks/{chunk-WNC7MDAC.js.map → chunk-LFBTW453.js.map} +0 -0
- /package/dist/chunks/{chunk-4E7CFJKP.js.map → chunk-LN2JFGCM.js.map} +0 -0
- /package/dist/chunks/{chunk-CNKZ5OEN.js.map → chunk-QHQHQFTY.js.map} +0 -0
- /package/dist/chunks/{chunk-PTBVQOSI.js.map → chunk-RZ74SRZR.js.map} +0 -0
- /package/dist/chunks/{chunk-3XPCMW6Y.js.map → chunk-VYTQ3GJF.js.map} +0 -0
- /package/dist/chunks/{chunk-Q275XU7A.js.map → chunk-WL2KAT7X.js.map} +0 -0
- /package/dist/chunks/{chunk-76ZHDUSD.js.map → chunk-X7ODFDJW.js.map} +0 -0
- /package/dist/chunks/{cli-runtime-FI5IMJQW.js.map → cli-runtime-7LU3JUKO.js.map} +0 -0
- /package/dist/chunks/{doctor-NPOW6W7J.js.map → doctor-5JZJK4AJ.js.map} +0 -0
- /package/dist/chunks/{drain-BH55K7YU.js.map → drain-WVJZCIHU.js.map} +0 -0
- /package/dist/chunks/{exec-MX3B2UN3.js.map → exec-GHHQAUM5.js.map} +0 -0
- /package/dist/chunks/{host-queries-HZWZJC3A.js.map → host-queries-TTVZPVFH.js.map} +0 -0
- /package/dist/chunks/{learn-USAWIP7K.js.map → learn-QWKYL537.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-E2VD4DHQ.js.map → learn-builtin-TDSK4FNG.js.map} +0 -0
- /package/dist/chunks/{lifecycle-7VSEDBPU.js.map → lifecycle-QVPXT3GP.js.map} +0 -0
- /package/dist/chunks/{list-ZM3IAEUT.js.map → list-CVEFKJW7.js.map} +0 -0
- /package/dist/chunks/{live-7SJSBRSQ.js.map → live-ZJXXVGTH.js.map} +0 -0
- /package/dist/chunks/{mcp-L4CZFIYN.js.map → mcp-FKSBFVBF.js.map} +0 -0
- /package/dist/chunks/{message-command-V2J24YP5.js.map → message-command-OSVRQUH7.js.map} +0 -0
- /package/dist/chunks/{pal-7IB7RW64.js.map → pal-M3GCQRFL.js.map} +0 -0
- /package/dist/chunks/{resident-3RTS73JY.js.map → resident-3U5NY24H.js.map} +0 -0
- /package/dist/chunks/{schedule-2K3YV2MJ.js.map → schedule-N5YZBH26.js.map} +0 -0
- /package/dist/chunks/{service-YYTU36DB.js.map → service-ZZH7EKSL.js.map} +0 -0
- /package/dist/chunks/{session-step-AUWOQOPI.js.map → session-step-4JBIREGL.js.map} +0 -0
- /package/dist/chunks/{start-check-YXOI4UKE.js.map → start-check-OVCPWK4G.js.map} +0 -0
- /package/dist/chunks/{upgrade-PBDROOBR.js.map → upgrade-GWJDTRRD.js.map} +0 -0
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
ensureLocalConfigIgnored,
|
|
61
61
|
logIgnoreOutcome,
|
|
62
62
|
writeLocalAllows
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-QHQHQFTY.js";
|
|
64
64
|
import {
|
|
65
65
|
createBrowserControl
|
|
66
66
|
} from "./chunk-WHODOMXA.js";
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
takeConfigWarnings,
|
|
107
107
|
unmatchedPassthroughTools,
|
|
108
108
|
workflowTokenCeiling
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-5OIMQOJG.js";
|
|
110
110
|
import {
|
|
111
111
|
require_dist
|
|
112
112
|
} from "./chunk-KONYGNG6.js";
|
|
@@ -1963,7 +1963,7 @@ __name(screenApprover, "screenApprover");
|
|
|
1963
1963
|
|
|
1964
1964
|
// src/tui/agent.ts
|
|
1965
1965
|
import { realpath as realpath4, stat as stat5 } from "node:fs/promises";
|
|
1966
|
-
import { join as
|
|
1966
|
+
import { join as join17, parse, resolve as resolve13 } from "node:path";
|
|
1967
1967
|
|
|
1968
1968
|
// src/checkpoints/store.ts
|
|
1969
1969
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -4990,8 +4990,8 @@ async function git(cwd, args) {
|
|
|
4990
4990
|
}
|
|
4991
4991
|
__name(git, "git");
|
|
4992
4992
|
function boundLine(line) {
|
|
4993
|
-
const
|
|
4994
|
-
return
|
|
4993
|
+
const printable2 = line.replace(new RegExp("\\p{Cc}", "gu"), "");
|
|
4994
|
+
return printable2.length > MAX_LINE_CHARS2 ? `${printable2.slice(0, MAX_LINE_CHARS2)}\u2026` : printable2;
|
|
4995
4995
|
}
|
|
4996
4996
|
__name(boundLine, "boundLine");
|
|
4997
4997
|
async function readTurnSnapshot(cwd) {
|
|
@@ -5147,6 +5147,155 @@ function createRepositorySnapshotStep(snapshot) {
|
|
|
5147
5147
|
}
|
|
5148
5148
|
__name(createRepositorySnapshotStep, "createRepositorySnapshotStep");
|
|
5149
5149
|
|
|
5150
|
+
// src/integrations/decision/points.ts
|
|
5151
|
+
import { appendFileSync, mkdirSync, renameSync, statSync as statSync2 } from "node:fs";
|
|
5152
|
+
import { join as join5 } from "node:path";
|
|
5153
|
+
var DEFAULT_TIMEOUT_MS = 1500;
|
|
5154
|
+
var LOG_ROTATE_BYTES = 1e6;
|
|
5155
|
+
function createDecisionPoints(options) {
|
|
5156
|
+
const { model } = options;
|
|
5157
|
+
const now = options.now ?? Date.now;
|
|
5158
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
5159
|
+
const log = options.log ?? appendDecisionLog;
|
|
5160
|
+
const mode = /* @__PURE__ */ __name((point) => model === void 0 ? "off" : options.modes?.[point] ?? "off", "mode");
|
|
5161
|
+
return {
|
|
5162
|
+
mode,
|
|
5163
|
+
async ask(question, signal) {
|
|
5164
|
+
const current = mode(question.point);
|
|
5165
|
+
if (current === "off" || model === void 0) return void 0;
|
|
5166
|
+
const startedAt = now();
|
|
5167
|
+
const controller = new AbortController();
|
|
5168
|
+
let timer;
|
|
5169
|
+
const onOuterAbort = /* @__PURE__ */ __name(() => controller.abort(), "onOuterAbort");
|
|
5170
|
+
signal?.addEventListener("abort", onOuterAbort, { once: true });
|
|
5171
|
+
if (signal?.aborted) controller.abort();
|
|
5172
|
+
let p;
|
|
5173
|
+
let outcome = "answered";
|
|
5174
|
+
try {
|
|
5175
|
+
const timedOut = new Promise((_, reject) => {
|
|
5176
|
+
timer = setTimeout(() => {
|
|
5177
|
+
controller.abort();
|
|
5178
|
+
reject(new Error("timeout"));
|
|
5179
|
+
}, timeoutMs);
|
|
5180
|
+
});
|
|
5181
|
+
const answer = await Promise.race([
|
|
5182
|
+
model.yesno(question.state, question.instructions, { signal: controller.signal }),
|
|
5183
|
+
timedOut
|
|
5184
|
+
]);
|
|
5185
|
+
p = answer.p;
|
|
5186
|
+
if (typeof p !== "number" || !Number.isFinite(p) || p < 0 || p > 1) {
|
|
5187
|
+
p = void 0;
|
|
5188
|
+
outcome = "error";
|
|
5189
|
+
}
|
|
5190
|
+
} catch (error) {
|
|
5191
|
+
outcome = error instanceof Error && error.message === "timeout" ? "timeout" : "error";
|
|
5192
|
+
} finally {
|
|
5193
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
5194
|
+
signal?.removeEventListener("abort", onOuterAbort);
|
|
5195
|
+
}
|
|
5196
|
+
try {
|
|
5197
|
+
log({
|
|
5198
|
+
at: startedAt,
|
|
5199
|
+
point: question.point,
|
|
5200
|
+
mode: current,
|
|
5201
|
+
...p !== void 0 ? { p } : {},
|
|
5202
|
+
rule: question.rule,
|
|
5203
|
+
latencyMs: Math.max(0, now() - startedAt),
|
|
5204
|
+
outcome,
|
|
5205
|
+
chars: question.state.length
|
|
5206
|
+
});
|
|
5207
|
+
} catch {
|
|
5208
|
+
}
|
|
5209
|
+
return current === "on" ? p : void 0;
|
|
5210
|
+
}
|
|
5211
|
+
};
|
|
5212
|
+
}
|
|
5213
|
+
__name(createDecisionPoints, "createDecisionPoints");
|
|
5214
|
+
function appendDecisionLog(entry, home = namzuHomePath()) {
|
|
5215
|
+
try {
|
|
5216
|
+
const directory = join5(home, "decision");
|
|
5217
|
+
const file = join5(directory, "points.jsonl");
|
|
5218
|
+
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
5219
|
+
try {
|
|
5220
|
+
if (statSync2(file).size >= LOG_ROTATE_BYTES) renameSync(file, `${file}.1`);
|
|
5221
|
+
} catch {
|
|
5222
|
+
}
|
|
5223
|
+
appendFileSync(file, `${JSON.stringify(entry)}
|
|
5224
|
+
`, { mode: 384 });
|
|
5225
|
+
} catch {
|
|
5226
|
+
}
|
|
5227
|
+
}
|
|
5228
|
+
__name(appendDecisionLog, "appendDecisionLog");
|
|
5229
|
+
var CONFIDENT_YES = 0.7;
|
|
5230
|
+
var CONFIDENT_NO = 0.3;
|
|
5231
|
+
function verdictOf(p) {
|
|
5232
|
+
if (p === void 0) return "unsure";
|
|
5233
|
+
if (p >= CONFIDENT_YES) return "yes";
|
|
5234
|
+
if (p <= CONFIDENT_NO) return "no";
|
|
5235
|
+
return "unsure";
|
|
5236
|
+
}
|
|
5237
|
+
__name(verdictOf, "verdictOf");
|
|
5238
|
+
|
|
5239
|
+
// src/integrations/decision/memory-admit.ts
|
|
5240
|
+
var MEMORY_ADMIT_INSTRUCTIONS = "Would a later working session in the same project be helped by remembering this? Answer yes for requirements the person stated, decisions with their reasons, non-obvious discoveries about how the project works, and mistakes worth not repeating. Answer no for routine progress, facts that are easy to read again from the code, and details of this one turn that will not matter later.";
|
|
5241
|
+
var MEMORY_ADMIT_STATE_CHARS = 1600;
|
|
5242
|
+
var SECTIONS = [
|
|
5243
|
+
["userRequirements", "The person requires"],
|
|
5244
|
+
["decisions", "Decisions"],
|
|
5245
|
+
["discoveries", "Discoveries"],
|
|
5246
|
+
["failures", "What did not work"],
|
|
5247
|
+
["environment", "Environment"]
|
|
5248
|
+
];
|
|
5249
|
+
function claims(candidate) {
|
|
5250
|
+
const out = [];
|
|
5251
|
+
for (const [key, heading] of SECTIONS) {
|
|
5252
|
+
const items = candidate[key].map((item) => item.trim()).filter(Boolean);
|
|
5253
|
+
if (items.length > 0) out.push([heading, items]);
|
|
5254
|
+
}
|
|
5255
|
+
return out;
|
|
5256
|
+
}
|
|
5257
|
+
__name(claims, "claims");
|
|
5258
|
+
function holdsClaims(candidate) {
|
|
5259
|
+
return claims(candidate).length > 0;
|
|
5260
|
+
}
|
|
5261
|
+
__name(holdsClaims, "holdsClaims");
|
|
5262
|
+
function printable(text2) {
|
|
5263
|
+
let out = "";
|
|
5264
|
+
for (const ch of text2) {
|
|
5265
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
5266
|
+
if (code < 32 && code !== 10 && code !== 9 || code === 127) continue;
|
|
5267
|
+
out += ch;
|
|
5268
|
+
}
|
|
5269
|
+
return out;
|
|
5270
|
+
}
|
|
5271
|
+
__name(printable, "printable");
|
|
5272
|
+
function memoryAdmitQuestion(candidate) {
|
|
5273
|
+
const text2 = [
|
|
5274
|
+
`Task: ${candidate.task.trim()}`,
|
|
5275
|
+
...claims(candidate).map(
|
|
5276
|
+
([heading, items]) => `${heading}:
|
|
5277
|
+
${items.map((i) => `- ${i}`).join("\n")}`
|
|
5278
|
+
)
|
|
5279
|
+
].join("\n\n");
|
|
5280
|
+
return {
|
|
5281
|
+
point: "memory-admit",
|
|
5282
|
+
state: [...printable(text2)].slice(0, MEMORY_ADMIT_STATE_CHARS).join(""),
|
|
5283
|
+
instructions: MEMORY_ADMIT_INSTRUCTIONS,
|
|
5284
|
+
// The rule writes whenever there is a claim.
|
|
5285
|
+
rule: true
|
|
5286
|
+
};
|
|
5287
|
+
}
|
|
5288
|
+
__name(memoryAdmitQuestion, "memoryAdmitQuestion");
|
|
5289
|
+
function gateMemoryPromotion(promote, points) {
|
|
5290
|
+
return async (candidate) => {
|
|
5291
|
+
if (points.mode("memory-admit") === "off" || !holdsClaims(candidate)) return promote(candidate);
|
|
5292
|
+
const p = await points.ask(memoryAdmitQuestion(candidate));
|
|
5293
|
+
if (verdictOf(p) === "no") return;
|
|
5294
|
+
return promote(candidate);
|
|
5295
|
+
};
|
|
5296
|
+
}
|
|
5297
|
+
__name(gateMemoryPromotion, "gateMemoryPromotion");
|
|
5298
|
+
|
|
5150
5299
|
// ../decision/dist/contract.js
|
|
5151
5300
|
var DecisionError = class extends Error {
|
|
5152
5301
|
static {
|
|
@@ -6671,7 +6820,7 @@ __name(readWorkStatus, "readWorkStatus");
|
|
|
6671
6820
|
|
|
6672
6821
|
// src/integrations/plugins/files.ts
|
|
6673
6822
|
import { readdirSync as readdirSync2, realpathSync as realpathSync3 } from "node:fs";
|
|
6674
|
-
import { isAbsolute as isAbsolute6, join as
|
|
6823
|
+
import { isAbsolute as isAbsolute6, join as join7, relative as relative6, sep as sep4 } from "node:path";
|
|
6675
6824
|
|
|
6676
6825
|
// src/integrations/plugins/settings.ts
|
|
6677
6826
|
import { createHash as createHash3, randomUUID as randomUUID4 } from "node:crypto";
|
|
@@ -6683,16 +6832,16 @@ import {
|
|
|
6683
6832
|
lstatSync as lstatSync2,
|
|
6684
6833
|
openSync,
|
|
6685
6834
|
readSync,
|
|
6686
|
-
renameSync,
|
|
6835
|
+
renameSync as renameSync2,
|
|
6687
6836
|
unlinkSync,
|
|
6688
6837
|
writeFileSync
|
|
6689
6838
|
} from "node:fs";
|
|
6690
|
-
import { join as
|
|
6839
|
+
import { join as join6 } from "node:path";
|
|
6691
6840
|
var MAX_RECORD_BYTES = 64 * 1024;
|
|
6692
6841
|
var PluginSettingsStore = class {
|
|
6693
6842
|
constructor(home) {
|
|
6694
6843
|
this.home = home;
|
|
6695
|
-
this.directory =
|
|
6844
|
+
this.directory = join6(home, "plugin-settings");
|
|
6696
6845
|
}
|
|
6697
6846
|
home;
|
|
6698
6847
|
static {
|
|
@@ -6701,7 +6850,7 @@ var PluginSettingsStore = class {
|
|
|
6701
6850
|
directory;
|
|
6702
6851
|
path(plugin) {
|
|
6703
6852
|
const key = createHash3("sha256").update(JSON.stringify([plugin.rootDir, plugin.name])).digest("hex");
|
|
6704
|
-
return
|
|
6853
|
+
return join6(this.directory, `${key}.json`);
|
|
6705
6854
|
}
|
|
6706
6855
|
read(plugin) {
|
|
6707
6856
|
const path = this.path(plugin);
|
|
@@ -6762,7 +6911,7 @@ var PluginSettingsStore = class {
|
|
|
6762
6911
|
closeSync(fd);
|
|
6763
6912
|
}
|
|
6764
6913
|
restrictToOwner(temporary);
|
|
6765
|
-
|
|
6914
|
+
renameSync2(temporary, path);
|
|
6766
6915
|
} finally {
|
|
6767
6916
|
try {
|
|
6768
6917
|
unlinkSync(temporary);
|
|
@@ -6783,7 +6932,7 @@ function resolvePluginFileDirs(plugin, rootDir, declared) {
|
|
|
6783
6932
|
const problems = [];
|
|
6784
6933
|
for (const rel of declared ?? []) {
|
|
6785
6934
|
try {
|
|
6786
|
-
const real = realpathSync3(
|
|
6935
|
+
const real = realpathSync3(join7(rootDir, rel));
|
|
6787
6936
|
const within2 = relative6(realpathSync3(rootDir), real);
|
|
6788
6937
|
if (within2 === ".." || within2.startsWith(`..${sep4}`) || isAbsolute6(within2)) {
|
|
6789
6938
|
problems.push(
|
|
@@ -7675,13 +7824,13 @@ __name(createSideModel, "createSideModel");
|
|
|
7675
7824
|
var CLI_CHECKPOINT_RETENTION = 10;
|
|
7676
7825
|
|
|
7677
7826
|
// src/integrations/subagents/definitions.ts
|
|
7678
|
-
import { join as
|
|
7827
|
+
import { join as join8 } from "node:path";
|
|
7679
7828
|
function userAgentsDir(home) {
|
|
7680
|
-
return
|
|
7829
|
+
return join8(namzuHomePath(home), "agents");
|
|
7681
7830
|
}
|
|
7682
7831
|
__name(userAgentsDir, "userAgentsDir");
|
|
7683
7832
|
function projectAgentsDir(cwd) {
|
|
7684
|
-
return
|
|
7833
|
+
return join8(cwd, ".namzu", "agents");
|
|
7685
7834
|
}
|
|
7686
7835
|
__name(projectAgentsDir, "projectAgentsDir");
|
|
7687
7836
|
var AGENT_FILE_PERMISSION_MODES = /* @__PURE__ */ new Set([
|
|
@@ -7780,7 +7929,7 @@ __name(prepareDelegatedEffort, "prepareDelegatedEffort");
|
|
|
7780
7929
|
|
|
7781
7930
|
// src/integrations/subagents/operator-journal.ts
|
|
7782
7931
|
import { appendFile, open as open2 } from "node:fs/promises";
|
|
7783
|
-
import { join as
|
|
7932
|
+
import { join as join9 } from "node:path";
|
|
7784
7933
|
var MAX_READ_BYTES = 256 * 1024;
|
|
7785
7934
|
var MAX_CONTEXT_CHARACTERS = 32e3;
|
|
7786
7935
|
function formatChildOperatorAdmission(input) {
|
|
@@ -7790,7 +7939,7 @@ function formatChildOperatorAdmission(input) {
|
|
|
7790
7939
|
}
|
|
7791
7940
|
__name(formatChildOperatorAdmission, "formatChildOperatorAdmission");
|
|
7792
7941
|
async function readChildOperatorNotices(paths, sessionId) {
|
|
7793
|
-
const path =
|
|
7942
|
+
const path = join9(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl");
|
|
7794
7943
|
let file;
|
|
7795
7944
|
try {
|
|
7796
7945
|
file = await open2(path, "r");
|
|
@@ -7861,7 +8010,7 @@ async function acknowledgeChildOperatorNotices(paths, sessionId, notices) {
|
|
|
7861
8010
|
})
|
|
7862
8011
|
).join("\n");
|
|
7863
8012
|
await appendFile(
|
|
7864
|
-
|
|
8013
|
+
join9(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl"),
|
|
7865
8014
|
`${lines}
|
|
7866
8015
|
`,
|
|
7867
8016
|
{ mode: 384 }
|
|
@@ -7870,7 +8019,7 @@ async function acknowledgeChildOperatorNotices(paths, sessionId, notices) {
|
|
|
7870
8019
|
__name(acknowledgeChildOperatorNotices, "acknowledgeChildOperatorNotices");
|
|
7871
8020
|
async function recordChildOperatorReport(paths, sessionId, notice2) {
|
|
7872
8021
|
await appendFile(
|
|
7873
|
-
|
|
8022
|
+
join9(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl"),
|
|
7874
8023
|
`${JSON.stringify({ ...notice2, status: "child-report", source: "host", at: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
7875
8024
|
`,
|
|
7876
8025
|
{ mode: 384 }
|
|
@@ -8897,7 +9046,7 @@ __name(errorMessage2, "errorMessage");
|
|
|
8897
9046
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
8898
9047
|
import { existsSync } from "node:fs";
|
|
8899
9048
|
import { appendFile as appendFile2, mkdir as mkdir4 } from "node:fs/promises";
|
|
8900
|
-
import { join as
|
|
9049
|
+
import { join as join13 } from "node:path";
|
|
8901
9050
|
|
|
8902
9051
|
// src/integrations/subagents/fork.ts
|
|
8903
9052
|
var FORK_SUBAGENT = "fork";
|
|
@@ -9011,7 +9160,7 @@ __name(describeQuietTask, "describeQuietTask");
|
|
|
9011
9160
|
// src/memory/typed.ts
|
|
9012
9161
|
import { createHash as createHash4 } from "node:crypto";
|
|
9013
9162
|
import { access, readFile as readFile3, rename as rename3, writeFile as writeFile2 } from "node:fs/promises";
|
|
9014
|
-
import { join as
|
|
9163
|
+
import { join as join12 } from "node:path";
|
|
9015
9164
|
|
|
9016
9165
|
// src/memory/io.ts
|
|
9017
9166
|
import {
|
|
@@ -9019,13 +9168,13 @@ import {
|
|
|
9019
9168
|
closeSync as closeSync2,
|
|
9020
9169
|
fstatSync as fstatSync2,
|
|
9021
9170
|
lstatSync as lstatSync3,
|
|
9022
|
-
mkdirSync,
|
|
9171
|
+
mkdirSync as mkdirSync2,
|
|
9023
9172
|
openSync as openSync2,
|
|
9024
9173
|
readSync as readSync2,
|
|
9025
9174
|
realpathSync as realpathSync4,
|
|
9026
9175
|
writeSync
|
|
9027
9176
|
} from "node:fs";
|
|
9028
|
-
import { isAbsolute as isAbsolute7, join as
|
|
9177
|
+
import { isAbsolute as isAbsolute7, join as join10, relative as relative7, resolve as resolve8, sep as sep5 } from "node:path";
|
|
9029
9178
|
var MEMORY_FILE_MAX_BYTES = 1024 * 1024;
|
|
9030
9179
|
function missing(error) {
|
|
9031
9180
|
return error.code === "ENOENT";
|
|
@@ -9046,7 +9195,7 @@ function resolveMemoryPath(location, createParents = false) {
|
|
|
9046
9195
|
} catch (error) {
|
|
9047
9196
|
if (!missing(error)) throw error;
|
|
9048
9197
|
if (!createParents) return null;
|
|
9049
|
-
|
|
9198
|
+
mkdirSync2(root, { recursive: true, mode: 448 });
|
|
9050
9199
|
rootStat = lstatSync3(root);
|
|
9051
9200
|
}
|
|
9052
9201
|
if (rootStat.isSymbolicLink())
|
|
@@ -9058,7 +9207,7 @@ function resolveMemoryPath(location, createParents = false) {
|
|
|
9058
9207
|
for (let i = 0; i < parts.length; i += 1) {
|
|
9059
9208
|
const part = parts[i];
|
|
9060
9209
|
if (part === void 0) throw new Error("Memory path has an invalid segment.");
|
|
9061
|
-
candidate =
|
|
9210
|
+
candidate = join10(candidate, part);
|
|
9062
9211
|
const leaf = i === parts.length - 1;
|
|
9063
9212
|
let stat6;
|
|
9064
9213
|
try {
|
|
@@ -9067,7 +9216,7 @@ function resolveMemoryPath(location, createParents = false) {
|
|
|
9067
9216
|
if (!missing(error)) throw error;
|
|
9068
9217
|
if (!createParents) return null;
|
|
9069
9218
|
if (leaf) return candidate;
|
|
9070
|
-
|
|
9219
|
+
mkdirSync2(candidate, { mode: 448 });
|
|
9071
9220
|
stat6 = lstatSync3(candidate);
|
|
9072
9221
|
}
|
|
9073
9222
|
if (stat6.isSymbolicLink()) {
|
|
@@ -9183,18 +9332,18 @@ __name(appendMemoryFile, "appendMemoryFile");
|
|
|
9183
9332
|
|
|
9184
9333
|
// src/memory/store.ts
|
|
9185
9334
|
import { realpathSync as realpathSync5 } from "node:fs";
|
|
9186
|
-
import { join as
|
|
9335
|
+
import { join as join11, resolve as resolve9 } from "node:path";
|
|
9187
9336
|
var MEMORY_SECTION_MAX_CHARS = 8e3;
|
|
9188
9337
|
function memoryDir(home) {
|
|
9189
9338
|
return namzuHomePath(home);
|
|
9190
9339
|
}
|
|
9191
9340
|
__name(memoryDir, "memoryDir");
|
|
9192
9341
|
function userFilePath(home) {
|
|
9193
|
-
return
|
|
9342
|
+
return join11(memoryDir(home), "USER.md");
|
|
9194
9343
|
}
|
|
9195
9344
|
__name(userFilePath, "userFilePath");
|
|
9196
9345
|
function memoryFilePath(home) {
|
|
9197
|
-
return
|
|
9346
|
+
return join11(memoryDir(home), "MEMORY.md");
|
|
9198
9347
|
}
|
|
9199
9348
|
__name(memoryFilePath, "memoryFilePath");
|
|
9200
9349
|
function projectMemoryFilePath(cwd) {
|
|
@@ -9205,9 +9354,9 @@ function projectMemoryFilePath(cwd) {
|
|
|
9205
9354
|
if (error.code !== "ENOENT") throw error;
|
|
9206
9355
|
}
|
|
9207
9356
|
const root = cliProjectRoot(directory);
|
|
9208
|
-
const local =
|
|
9357
|
+
const local = join11(directory, ".namzu", "MEMORY.md");
|
|
9209
9358
|
if (resolveMemoryPath({ path: local, root }) !== null) return local;
|
|
9210
|
-
return
|
|
9359
|
+
return join11(root, ".namzu", "MEMORY.md");
|
|
9211
9360
|
}
|
|
9212
9361
|
__name(projectMemoryFilePath, "projectMemoryFilePath");
|
|
9213
9362
|
function projectMemoryLocation(cwd) {
|
|
@@ -9237,15 +9386,15 @@ function readMemory(home, cwd) {
|
|
|
9237
9386
|
}
|
|
9238
9387
|
}, "read");
|
|
9239
9388
|
const userRoot = memoryDir(home);
|
|
9240
|
-
const user = read2(
|
|
9389
|
+
const user = read2(join11(userRoot, "USER.md"), () => ({
|
|
9241
9390
|
root: userRoot,
|
|
9242
|
-
path:
|
|
9391
|
+
path: join11(userRoot, "USER.md")
|
|
9243
9392
|
}));
|
|
9244
|
-
const memory = read2(
|
|
9393
|
+
const memory = read2(join11(userRoot, "MEMORY.md"), () => ({
|
|
9245
9394
|
root: userRoot,
|
|
9246
|
-
path:
|
|
9395
|
+
path: join11(userRoot, "MEMORY.md")
|
|
9247
9396
|
}));
|
|
9248
|
-
const project = cwd && !isUserMemoryFile(
|
|
9397
|
+
const project = cwd && !isUserMemoryFile(join11(resolve9(cwd), ".namzu", "MEMORY.md"), userRoot) ? read2(join11(resolve9(cwd), ".namzu", "MEMORY.md"), () => projectLocation(cwd)) : null;
|
|
9249
9398
|
return { user, memory, project, ...diagnostics.length > 0 ? { diagnostics } : {} };
|
|
9250
9399
|
}
|
|
9251
9400
|
__name(readMemory, "readMemory");
|
|
@@ -9257,7 +9406,7 @@ function isUserMemoryFile(projectPath, userRoot) {
|
|
|
9257
9406
|
return resolve9(path);
|
|
9258
9407
|
}
|
|
9259
9408
|
}, "canonical");
|
|
9260
|
-
return canonical(projectPath) === canonical(
|
|
9409
|
+
return canonical(projectPath) === canonical(join11(userRoot, "MEMORY.md"));
|
|
9261
9410
|
}
|
|
9262
9411
|
__name(isUserMemoryFile, "isUserMemoryFile");
|
|
9263
9412
|
function capped(text2, file) {
|
|
@@ -9349,7 +9498,7 @@ async function saveTypedNote(store, text2, type = "project") {
|
|
|
9349
9498
|
saved: false,
|
|
9350
9499
|
duplicate: true,
|
|
9351
9500
|
type: record.entry.type ?? type,
|
|
9352
|
-
...record.entry.name ? { name: record.entry.name, path:
|
|
9501
|
+
...record.entry.name ? { name: record.entry.name, path: join12(store.path, `${record.entry.name}.md`) } : {}
|
|
9353
9502
|
};
|
|
9354
9503
|
}
|
|
9355
9504
|
}
|
|
@@ -9364,7 +9513,7 @@ async function saveTypedNote(store, text2, type = "project") {
|
|
|
9364
9513
|
return {
|
|
9365
9514
|
saved: true,
|
|
9366
9515
|
type,
|
|
9367
|
-
...entry.name ? { name: entry.name, path:
|
|
9516
|
+
...entry.name ? { name: entry.name, path: join12(store.path, `${entry.name}.md`) } : {}
|
|
9368
9517
|
};
|
|
9369
9518
|
}
|
|
9370
9519
|
__name(saveTypedNote, "saveTypedNote");
|
|
@@ -9407,7 +9556,7 @@ __name(composeMemoryGuidance, "composeMemoryGuidance");
|
|
|
9407
9556
|
var MARKER2 = "migration.json";
|
|
9408
9557
|
async function readMarker(directory) {
|
|
9409
9558
|
try {
|
|
9410
|
-
const parsed = JSON.parse(await readFile3(
|
|
9559
|
+
const parsed = JSON.parse(await readFile3(join12(directory, MARKER2), "utf8"));
|
|
9411
9560
|
return parsed !== null && typeof parsed === "object" ? parsed : {};
|
|
9412
9561
|
} catch (error) {
|
|
9413
9562
|
if (error.code === "ENOENT") return {};
|
|
@@ -9420,7 +9569,7 @@ async function markCuratedFile(directory, path, state) {
|
|
|
9420
9569
|
const files = { ...marker.curatedFiles ?? {} };
|
|
9421
9570
|
files[path] = { ...files[path] ?? {}, ...state };
|
|
9422
9571
|
await writeFile2(
|
|
9423
|
-
|
|
9572
|
+
join12(directory, MARKER2),
|
|
9424
9573
|
`${JSON.stringify({ ...marker, curatedFiles: files }, null, 2)}
|
|
9425
9574
|
`,
|
|
9426
9575
|
{ mode: 384 }
|
|
@@ -9487,7 +9636,7 @@ async function migrateMemoryOnce(options) {
|
|
|
9487
9636
|
const skippedRecords = [];
|
|
9488
9637
|
let importedRecords = 0;
|
|
9489
9638
|
let notesOffer;
|
|
9490
|
-
const indexPath =
|
|
9639
|
+
const indexPath = join12(directory, "index.json");
|
|
9491
9640
|
if (await exists(indexPath)) {
|
|
9492
9641
|
try {
|
|
9493
9642
|
const disk = new DiskMemoryStore({ baseDir: directory, directory });
|
|
@@ -9510,11 +9659,11 @@ async function migrateMemoryOnce(options) {
|
|
|
9510
9659
|
}
|
|
9511
9660
|
}
|
|
9512
9661
|
await retire(indexPath);
|
|
9513
|
-
const content =
|
|
9662
|
+
const content = join12(directory, "content");
|
|
9514
9663
|
const retiredContent = await exists(content) ? await retire(content) : content;
|
|
9515
9664
|
for (const record of refused) {
|
|
9516
9665
|
skippedRecords.push(
|
|
9517
|
-
`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${
|
|
9666
|
+
`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${join12(retiredContent, `${record.id}.json`)}.`
|
|
9518
9667
|
);
|
|
9519
9668
|
}
|
|
9520
9669
|
} catch (error) {
|
|
@@ -11925,7 +12074,7 @@ ${step}`;
|
|
|
11925
12074
|
sessionId: parent.sessionId
|
|
11926
12075
|
});
|
|
11927
12076
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
11928
|
-
journal =
|
|
12077
|
+
journal = join13(directory, "child-operator-messages.jsonl");
|
|
11929
12078
|
}
|
|
11930
12079
|
await audit("submitted");
|
|
11931
12080
|
signal.throwIfAborted();
|
|
@@ -12383,7 +12532,7 @@ __name(buildDefinition, "buildDefinition");
|
|
|
12383
12532
|
|
|
12384
12533
|
// src/integrations/workflows/history.ts
|
|
12385
12534
|
import { readFile as readFile4, readdir as readdir2 } from "node:fs/promises";
|
|
12386
|
-
import { join as
|
|
12535
|
+
import { join as join14 } from "node:path";
|
|
12387
12536
|
var RUN_ID = /^w[0-9a-z]{8}$/;
|
|
12388
12537
|
async function readWorkflowJournal(file) {
|
|
12389
12538
|
let text2;
|
|
@@ -12409,7 +12558,7 @@ async function readWorkflowJournal(file) {
|
|
|
12409
12558
|
__name(readWorkflowJournal, "readWorkflowJournal");
|
|
12410
12559
|
async function readWorkflowRun(runsDirectory, runId) {
|
|
12411
12560
|
if (!RUN_ID.test(runId)) return void 0;
|
|
12412
|
-
const records = await readWorkflowJournal(
|
|
12561
|
+
const records = await readWorkflowJournal(join14(runsDirectory, runId, "workflow", "journal.jsonl"));
|
|
12413
12562
|
return viewFromJournal(records);
|
|
12414
12563
|
}
|
|
12415
12564
|
__name(readWorkflowRun, "readWorkflowRun");
|
|
@@ -12432,7 +12581,7 @@ __name(listWorkflowRuns, "listWorkflowRuns");
|
|
|
12432
12581
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
12433
12582
|
import { existsSync as existsSync2 } from "node:fs";
|
|
12434
12583
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
12435
|
-
import { join as
|
|
12584
|
+
import { join as join15 } from "node:path";
|
|
12436
12585
|
|
|
12437
12586
|
// src/integrations/workflows/offering.ts
|
|
12438
12587
|
var WORKFLOW_TOOL_NAME = "workflow";
|
|
@@ -12882,7 +13031,7 @@ function createWorkflowHost(options) {
|
|
|
12882
13031
|
}
|
|
12883
13032
|
let checked;
|
|
12884
13033
|
try {
|
|
12885
|
-
checked = await new FileWorkflowJournal(
|
|
13034
|
+
checked = await new FileWorkflowJournal(join15(runs, runId, "workflow"), {
|
|
12886
13035
|
runId,
|
|
12887
13036
|
...key !== void 0 ? { key } : {}
|
|
12888
13037
|
}).read();
|
|
@@ -12902,7 +13051,7 @@ function createWorkflowHost(options) {
|
|
|
12902
13051
|
}
|
|
12903
13052
|
resumeState = loadWorkflowResume(checked);
|
|
12904
13053
|
if (!resumeState.resumable) {
|
|
12905
|
-
const mismatch = key !== void 0 && await readFile5(
|
|
13054
|
+
const mismatch = key !== void 0 && await readFile5(join15(runs, runId, "workflow", "journal.jsonl"), "utf8").then(
|
|
12906
13055
|
(text2) => journalKeyMismatch(text2, runId, key),
|
|
12907
13056
|
() => false
|
|
12908
13057
|
);
|
|
@@ -12922,12 +13071,12 @@ function createWorkflowHost(options) {
|
|
|
12922
13071
|
if (state === "ended") registry.discard(runId);
|
|
12923
13072
|
} else {
|
|
12924
13073
|
runId = createWorkflowRunId(
|
|
12925
|
-
(id) => registry.get(id) !== void 0 || runs !== void 0 && existsSync2(
|
|
13074
|
+
(id) => registry.get(id) !== void 0 || runs !== void 0 && existsSync2(join15(runs, id))
|
|
12926
13075
|
);
|
|
12927
13076
|
}
|
|
12928
13077
|
const turn = options.openRunTurn(context.turnId, runId);
|
|
12929
13078
|
const limits = options.limitsFor?.(context.turnId);
|
|
12930
|
-
const journalDirectory = runs === void 0 ? void 0 :
|
|
13079
|
+
const journalDirectory = runs === void 0 ? void 0 : join15(runs, runId, "workflow");
|
|
12931
13080
|
const journal = journalDirectory === void 0 ? void 0 : new FileWorkflowJournal(journalDirectory, {
|
|
12932
13081
|
runId,
|
|
12933
13082
|
...key !== void 0 ? { key } : {}
|
|
@@ -12961,7 +13110,7 @@ function createWorkflowHost(options) {
|
|
|
12961
13110
|
...journal ? { journal } : {},
|
|
12962
13111
|
...resumeState ? { resume: resumeState } : {},
|
|
12963
13112
|
...editable !== void 0 ? { scriptPath: editable } : {},
|
|
12964
|
-
...journalDirectory !== void 0 ? { journalPath:
|
|
13113
|
+
...journalDirectory !== void 0 ? { journalPath: join15(journalDirectory, "journal.jsonl") } : {},
|
|
12965
13114
|
spawn: /* @__PURE__ */ __name(async (request, signal, viewed) => {
|
|
12966
13115
|
const detail = phaseDetail(request.phaseTitle);
|
|
12967
13116
|
const outcome2 = await options.subagents.launchWorkflowAgent({
|
|
@@ -13046,7 +13195,7 @@ __name(createWorkflowHost, "createWorkflowHost");
|
|
|
13046
13195
|
// src/integrations/workflows/orphans.ts
|
|
13047
13196
|
import { existsSync as existsSync3 } from "node:fs";
|
|
13048
13197
|
import { readFile as readFile6, readdir as readdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
13049
|
-
import { join as
|
|
13198
|
+
import { join as join16 } from "node:path";
|
|
13050
13199
|
var NOTICE_FILE = "orphan-notice.json";
|
|
13051
13200
|
var MAX_ORPHAN_NOTICES = 20;
|
|
13052
13201
|
var NO_USAGE = {
|
|
@@ -13065,7 +13214,7 @@ function quotedName(name) {
|
|
|
13065
13214
|
}
|
|
13066
13215
|
__name(quotedName, "quotedName");
|
|
13067
13216
|
function noticePath(runsDirectory, runId) {
|
|
13068
|
-
return
|
|
13217
|
+
return join16(runsDirectory, runId, "workflow", NOTICE_FILE);
|
|
13069
13218
|
}
|
|
13070
13219
|
__name(noticePath, "noticePath");
|
|
13071
13220
|
async function readStored(runsDirectory, runId) {
|
|
@@ -13097,7 +13246,7 @@ async function recoverUnfinishedWorkflows(options) {
|
|
|
13097
13246
|
for (const runId of entries.filter((name) => RUN_ID_PATTERN.test(name)).sort()) {
|
|
13098
13247
|
if (options.liveRunIds.has(runId)) continue;
|
|
13099
13248
|
const stored = await readStored(options.runsDirectory, runId);
|
|
13100
|
-
const dir =
|
|
13249
|
+
const dir = join16(options.runsDirectory, runId, "workflow");
|
|
13101
13250
|
const journal = new FileWorkflowJournal(dir, {
|
|
13102
13251
|
runId,
|
|
13103
13252
|
...options.key !== void 0 ? { key: options.key } : {}
|
|
@@ -13206,7 +13355,7 @@ __name(recoverUnfinishedWorkflows, "recoverUnfinishedWorkflows");
|
|
|
13206
13355
|
async function keyMismatchOf(dir, runId, key) {
|
|
13207
13356
|
if (key === void 0) return false;
|
|
13208
13357
|
try {
|
|
13209
|
-
return journalKeyMismatch(await readFile6(
|
|
13358
|
+
return journalKeyMismatch(await readFile6(join16(dir, "journal.jsonl"), "utf8"), runId, key);
|
|
13210
13359
|
} catch {
|
|
13211
13360
|
return false;
|
|
13212
13361
|
}
|
|
@@ -15621,7 +15770,7 @@ __name(clipRequestContext, "clipRequestContext");
|
|
|
15621
15770
|
async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
15622
15771
|
const modelEnvironment = readModelLaunchEnvironment();
|
|
15623
15772
|
if (options.palEnvironment) {
|
|
15624
|
-
const { createPalAgentSession } = await import("./agent-session-
|
|
15773
|
+
const { createPalAgentSession } = await import("./agent-session-RIIQB63L.js");
|
|
15625
15774
|
return createPalAgentSession(prefs, detectedProviders, options);
|
|
15626
15775
|
}
|
|
15627
15776
|
let detected = detectedProviders;
|
|
@@ -16666,7 +16815,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
16666
16815
|
runsDirectory: /* @__PURE__ */ __name((turnId) => {
|
|
16667
16816
|
if (options.ephemeral) return void 0;
|
|
16668
16817
|
const owner = delegationScopes.get(turnId) ?? scope2;
|
|
16669
|
-
return
|
|
16818
|
+
return join17(paths.sessionDir({ sessionId: owner.sessionId }), "runs");
|
|
16670
16819
|
}, "runsDirectory"),
|
|
16671
16820
|
refusal: /* @__PURE__ */ __name((turnId) => {
|
|
16672
16821
|
const auth = delegatedWorkflowAuth.get(turnId);
|
|
@@ -16951,7 +17100,13 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
16951
17100
|
}), "screenPolicyFor");
|
|
16952
17101
|
const liveModeControls = /* @__PURE__ */ new Set();
|
|
16953
17102
|
const recordedModes = /* @__PURE__ */ new Map();
|
|
16954
|
-
const promoteMemory =
|
|
17103
|
+
const promoteMemory = gateMemoryPromotion(
|
|
17104
|
+
createMemoryPromoter({ store: memoryStore }),
|
|
17105
|
+
createDecisionPoints({
|
|
17106
|
+
model: maybeCreateDecisionModel(options.decision, process.env),
|
|
17107
|
+
modes: options.decision?.points
|
|
17108
|
+
})
|
|
17109
|
+
);
|
|
16955
17110
|
const skillCatalog = await createSessionSkillCatalog({
|
|
16956
17111
|
cwd,
|
|
16957
17112
|
...options.skills ? { config: options.skills } : {},
|
|
@@ -17750,7 +17905,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
17750
17905
|
const live = host.registry.list();
|
|
17751
17906
|
const known = new Set(live.map((view) => view.runId));
|
|
17752
17907
|
const saved = options.ephemeral ? [] : await listWorkflowRuns(
|
|
17753
|
-
|
|
17908
|
+
join17(paths.sessionDir({ sessionId: scope2.sessionId }), "runs")
|
|
17754
17909
|
).catch(() => []);
|
|
17755
17910
|
return [
|
|
17756
17911
|
...[...live].sort((a, b) => b.startedAt - a.startedAt),
|
|
@@ -17760,14 +17915,14 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
17760
17915
|
readScript: /* @__PURE__ */ __name((path) => {
|
|
17761
17916
|
const saved = readSavedScript(
|
|
17762
17917
|
path,
|
|
17763
|
-
scriptsDirectory(
|
|
17918
|
+
scriptsDirectory(join17(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"))
|
|
17764
17919
|
);
|
|
17765
17920
|
if (!saved.ok) return void 0;
|
|
17766
17921
|
reviewedScripts.record(saved.path, saved.text);
|
|
17767
17922
|
return saved.text;
|
|
17768
17923
|
}, "readScript"),
|
|
17769
17924
|
describeResume: /* @__PURE__ */ __name((runId, script) => describeResume(
|
|
17770
|
-
|
|
17925
|
+
join17(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"),
|
|
17771
17926
|
runId,
|
|
17772
17927
|
script,
|
|
17773
17928
|
options.ephemeral ? void 0 : workflowJournalKey(paths.home)
|
|
@@ -17775,13 +17930,13 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
17775
17930
|
recoverUnfinished: /* @__PURE__ */ __name(async () => {
|
|
17776
17931
|
if (options.ephemeral) return [];
|
|
17777
17932
|
return recoverUnfinishedWorkflows({
|
|
17778
|
-
runsDirectory:
|
|
17933
|
+
runsDirectory: join17(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"),
|
|
17779
17934
|
liveRunIds: new Set(host.registry.list().map((view) => view.runId)),
|
|
17780
17935
|
...workflowJournalKey(paths.home) !== void 0 ? { key: workflowJournalKey(paths.home) } : {}
|
|
17781
17936
|
});
|
|
17782
17937
|
}, "recoverUnfinished"),
|
|
17783
17938
|
noticesDelivered: /* @__PURE__ */ __name((runIds) => markOrphanNoticesDelivered(
|
|
17784
|
-
|
|
17939
|
+
join17(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"),
|
|
17785
17940
|
runIds
|
|
17786
17941
|
), "noticesDelivered"),
|
|
17787
17942
|
onEnd: /* @__PURE__ */ __name((listener) => {
|
|
@@ -20074,6 +20229,8 @@ export {
|
|
|
20074
20229
|
AGENT_LAUNCH_TOOL,
|
|
20075
20230
|
visibleProjectInstructionPath,
|
|
20076
20231
|
DEFERRED_TOOL_GUIDANCE,
|
|
20232
|
+
createDecisionPoints,
|
|
20233
|
+
verdictOf,
|
|
20077
20234
|
createQuestionGate,
|
|
20078
20235
|
PROGRESS_LOOK_MS,
|
|
20079
20236
|
PROGRESS_LOOK_MIN_GAP_MS,
|
|
@@ -20136,4 +20293,4 @@ export {
|
|
|
20136
20293
|
RESULT_SUMMARY_WHOLE_MAX,
|
|
20137
20294
|
resultSummaryLine
|
|
20138
20295
|
};
|
|
20139
|
-
//# sourceMappingURL=chunk-
|
|
20296
|
+
//# sourceMappingURL=chunk-2PVFI6GK.js.map
|