@ulpi/cli 0.1.4 → 0.1.6
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/LICENSE +21 -0
- package/dist/{auth-PN7TMQHV-2W4ICG64.js → auth-FWM7MM4Q-VZC3U2XZ.js} +1 -1
- package/dist/{auth-ECQ3IB4E.js → auth-HDK7ECJL.js} +2 -1
- package/dist/{chunk-3SBPZRB5.js → chunk-3BCW6ABU.js} +402 -142
- package/dist/{chunk-JGBXM5NC.js → chunk-3WB5CXH4.js} +180 -5
- package/dist/{chunk-2HEE5OKX.js → chunk-4UCJIAOU.js} +2 -2
- package/dist/chunk-4XTHZVDS.js +109 -0
- package/dist/chunk-4ZPOZULQ.js +6522 -0
- package/dist/{chunk-SIAQVRKG.js → chunk-5MI5GIXM.js} +48 -2
- package/dist/{chunk-KLEASXUR.js → chunk-6ZL6NXMV.js} +1 -1
- package/dist/chunk-76D3BYJD.js +221 -0
- package/dist/{chunk-ZLYRPD7I.js → chunk-AWOSRA5F.js} +1 -1
- package/dist/{chunk-PDR55ZNW.js → chunk-BFEKZZHM.js} +274 -57
- package/dist/chunk-C7CLUQI6.js +1286 -0
- package/dist/{chunk-7AL4DOEJ.js → chunk-E3B5NROU.js} +7 -7
- package/dist/chunk-EJ7TW77N.js +1418 -0
- package/dist/{chunk-5J6NLQUN.js → chunk-IV6MWETF.js} +383 -168
- package/dist/chunk-IZPJHSPX.js +1478 -0
- package/dist/chunk-JLHNLM3C.js +228 -0
- package/dist/{chunk-BZL5H4YQ.js → chunk-KYYI23AQ.js} +2 -2
- package/dist/{chunk-2CLNOKPA.js → chunk-RSFJ6QSR.js} +18 -0
- package/dist/chunk-S6ANCSYO.js +1271 -0
- package/dist/chunk-SEU7WWNQ.js +1251 -0
- package/dist/chunk-SNQ7NAIS.js +453 -0
- package/dist/{ulpi-RMMCUAGP-JCJ273T6.js → chunk-TSLDGT5O.js} +73 -35
- package/dist/{chunk-SPOI23SB.js → chunk-UXHCHOWQ.js} +83 -62
- package/dist/chunk-V2H5D6Y3.js +146 -0
- package/dist/{chunk-QJ5GSMEC.js → chunk-VVEDXI7E.js} +2 -1
- package/dist/chunk-VXH5Y4FO.js +6761 -0
- package/dist/chunk-WED4LM5N.js +322 -0
- package/dist/{chunk-74WVVWJ4.js → chunk-YOKL7RB5.js} +184 -15
- package/dist/chunk-Z53CAR7G.js +298 -0
- package/dist/ci-X3U2W4HC.js +854 -0
- package/dist/cloud-2F3NLVHN.js +274 -0
- package/dist/{codemap-RKSD4MIE.js → codemap-XNGMAF3F.js} +37 -37
- package/dist/codex-MB5YTMRT.js +132 -0
- package/dist/{config-EGAXXCGL.js → config-OOELBYTH.js} +1 -1
- package/dist/dist-2BJYR5EI.js +59 -0
- package/dist/dist-2K7IEVTA.js +43 -0
- package/dist/dist-3EIQTZHT.js +1380 -0
- package/dist/{dist-YA2BWZB2.js → dist-4U5L2X2C.js} +2 -2
- package/dist/{dist-UKMCJBB2.js → dist-54KAMNLO.js} +16 -15
- package/dist/dist-6M4MZWZW.js +58 -0
- package/dist/dist-6X576SU2.js +27 -0
- package/dist/dist-7QOEYLFX.js +103 -0
- package/dist/dist-AYBGHEDY.js +2541 -0
- package/dist/dist-EK45QNEM.js +45 -0
- package/dist/{dist-CS2VKNYS.js → dist-FKFEJRPX.js} +16 -15
- package/dist/dist-GTEJUBBT.js +66 -0
- package/dist/dist-HA74OKJZ.js +40 -0
- package/dist/dist-HU5RZAON.js +48 -0
- package/dist/dist-IYE3OBRB.js +374 -0
- package/dist/{dist-GJYT2OQV.js → dist-JLU26AB6.js} +12 -9
- package/dist/{dist-6G7JC2RA.js → dist-KUCI6JFE.js} +49 -9
- package/dist/dist-NUEMFZFL.js +33 -0
- package/dist/{dist-RKOGLK7R.js → dist-NUXMDXZ3.js} +31 -3
- package/dist/{dist-QAU3LGJN.js → dist-YCNWHSLN.js} +15 -5
- package/dist/{dist-CB5D5LMO.js → dist-YFFG2ZD6.js} +9 -16
- package/dist/dist-ZG4OKCSR.js +15 -0
- package/dist/doctor-SI4LLLDZ.js +345 -0
- package/dist/{export-import-4A5MWLIA.js → export-import-JFQH4KSJ.js} +1 -1
- package/dist/{history-3MOBX4MA.js → history-5NE46ZAH.js} +7 -7
- package/dist/hooks-installer-UN5JZLDQ.js +19 -0
- package/dist/index.js +395 -619
- package/dist/{init-6CH4HV5T.js → init-5FK3VKRT.js} +79 -13
- package/dist/job-HIDMAFW2.js +376 -0
- package/dist/jobs.memory-PLMMSFHB-VBECCTHN.js +33 -0
- package/dist/kiro-VMUHDFGK.js +153 -0
- package/dist/{launchd-LF2QMSKZ.js → launchd-6AWT54HR.js} +9 -17
- package/dist/mcp-PDUD7SGP.js +249 -0
- package/dist/mcp-installer-PQU3XOGO.js +259 -0
- package/dist/mcp-setup-OA7IB3H3.js +263 -0
- package/dist/{memory-Y6OZTXJ2.js → memory-ZNAEAK3B.js} +17 -17
- package/dist/{ollama-3XCUZMZT-FYKHW4TZ.js → ollama-3XCUZMZT-4JMH6B7P.js} +1 -1
- package/dist/{openai-E7G2YAHU-UYY4ZWON.js → openai-E7G2YAHU-T3HMBPH7.js} +2 -2
- package/dist/portal-JYWVHXDU.js +210 -0
- package/dist/prd-Q4J5NVAR.js +408 -0
- package/dist/repos-WWZXNN3P.js +271 -0
- package/dist/review-integration-5WHEJU2A.js +14 -0
- package/dist/{rules-E427DKYJ.js → rules-Y4VSOY5Y.js} +3 -3
- package/dist/run-VPNXEIBY.js +687 -0
- package/dist/server-COL4AXKU-P7S7NNF6.js +11 -0
- package/dist/server-KKSETHDV-XSSLEENT.js +20 -0
- package/dist/{skills-CX73O3IV.js → skills-QEYU2N27.js} +4 -2
- package/dist/start-JYOEL7AJ.js +303 -0
- package/dist/{status-4DFHDJMN.js → status-BHQYYGAL.js} +2 -2
- package/dist/{templates-U7T6MARD.js → templates-CBRUJ66V.js} +4 -3
- package/dist/tui-DP7736EX.js +61 -0
- package/dist/ulpi-5EN6JCAS-LFE3WSL4.js +10 -0
- package/dist/{uninstall-6SW35IK4.js → uninstall-ICUV6DDV.js} +3 -3
- package/dist/{update-M6IBJNYP.js → update-7ZMAYRBH.js} +3 -3
- package/dist/{version-checker-Q6YTYAGP.js → version-checker-4ZFMZA7Y.js} +2 -2
- package/package.json +39 -31
- package/dist/chunk-2MZER6ND.js +0 -415
- package/dist/chunk-2VYFVYJL.js +0 -4273
- package/dist/chunk-6OCEY7JY.js +0 -422
- package/dist/chunk-7LXY5UVC.js +0 -330
- package/dist/chunk-B55DDP24.js +0 -136
- package/dist/chunk-JWUUVXIV.js +0 -13694
- package/dist/chunk-MIAQVCFW.js +0 -39
- package/dist/chunk-YM2HV4IA.js +0 -505
- package/dist/ci-STSL2LSP.js +0 -370
- package/dist/mcp-installer-NQCGKQ23.js +0 -124
- package/dist/projects-ATHDD3D6.js +0 -271
- package/dist/review-ADUPV3PN.js +0 -152
- package/dist/server-USLHY6GH-AEOJC5ST.js +0 -18
- package/dist/server-X5P6WH2M-7K2RY34N.js +0 -11
- package/dist/skills/ulpi-generate-guardian/SKILL.md +0 -750
- package/dist/skills/ulpi-generate-guardian/references/framework-rules.md +0 -849
- package/dist/skills/ulpi-generate-guardian/references/language-rules.md +0 -591
- package/dist/ui-OWXZ3YSR.js +0 -167
- package/dist/ui.html +0 -698
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEmbedder,
|
|
3
|
+
embedAll,
|
|
4
|
+
embedOne,
|
|
3
5
|
loadCodemapIgnore,
|
|
4
6
|
matchesDenyPattern
|
|
5
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IV6MWETF.js";
|
|
6
8
|
import {
|
|
7
9
|
commitInWorktree,
|
|
8
10
|
copyAndStage,
|
|
9
11
|
historyBranchExists,
|
|
10
12
|
withWorktree,
|
|
11
13
|
writeAndStage
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3WB5CXH4.js";
|
|
13
15
|
import {
|
|
14
16
|
readEvents
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
ClassificationResultSchema,
|
|
18
|
-
MemoryConfigSchema
|
|
19
|
-
} from "./chunk-74WVVWJ4.js";
|
|
17
|
+
} from "./chunk-SEU7WWNQ.js";
|
|
20
18
|
import {
|
|
21
19
|
getMemoryBranch,
|
|
22
20
|
memoryConfigFile,
|
|
@@ -26,7 +24,11 @@ import {
|
|
|
26
24
|
memoryStatsFile,
|
|
27
25
|
memoryWatermarksDir,
|
|
28
26
|
projectMemoryDir
|
|
29
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-C7CLUQI6.js";
|
|
28
|
+
import {
|
|
29
|
+
ClassificationResultSchema,
|
|
30
|
+
MemoryConfigSchema
|
|
31
|
+
} from "./chunk-YOKL7RB5.js";
|
|
30
32
|
|
|
31
33
|
// ../../packages/memory-engine/dist/index.js
|
|
32
34
|
import * as fs from "fs";
|
|
@@ -57,6 +59,8 @@ import * as os3 from "os";
|
|
|
57
59
|
import * as path9 from "path";
|
|
58
60
|
import { readFileSync as readFileSync8, writeFileSync as writeFileSync8, unlinkSync as unlinkSync3, existsSync as existsSync10 } from "fs";
|
|
59
61
|
import { join as join8 } from "path";
|
|
62
|
+
import * as fs10 from "fs";
|
|
63
|
+
import * as path10 from "path";
|
|
60
64
|
var DEFAULT_MEMORY_CONFIG = MemoryConfigSchema.parse({});
|
|
61
65
|
function loadMemoryConfig(projectDir) {
|
|
62
66
|
const configPath = memoryConfigFile(projectDir);
|
|
@@ -807,7 +811,7 @@ async function searchMemory(projectDir, options) {
|
|
|
807
811
|
const config = loadMemoryConfig(projectDir);
|
|
808
812
|
const limit = options.limit ?? 10;
|
|
809
813
|
const embedder = await createEmbedder(config.embedding);
|
|
810
|
-
const
|
|
814
|
+
const queryVector = await embedOne(embedder, options.query);
|
|
811
815
|
acquireMemoryLock(projectDir);
|
|
812
816
|
let results;
|
|
813
817
|
let trimmed;
|
|
@@ -1162,7 +1166,7 @@ async function classifySession(projectDir, sessionId, onProgress) {
|
|
|
1162
1166
|
});
|
|
1163
1167
|
const embedder = await createEmbedder(config.embedding);
|
|
1164
1168
|
const texts = allMemories.map((m) => m.summary);
|
|
1165
|
-
const embeddings = await
|
|
1169
|
+
const embeddings = await embedAll(embedder, texts);
|
|
1166
1170
|
onProgress?.({
|
|
1167
1171
|
phase: "storing",
|
|
1168
1172
|
current: 0,
|
|
@@ -1250,20 +1254,12 @@ async function reindexMemories(projectDir, onProgress) {
|
|
|
1250
1254
|
if (entries.length === 0) {
|
|
1251
1255
|
return { reindexed: 0, durationMs: Date.now() - startMs };
|
|
1252
1256
|
}
|
|
1257
|
+
const total = entries.length;
|
|
1253
1258
|
onProgress?.({
|
|
1254
1259
|
phase: "embedding",
|
|
1255
1260
|
current: 0,
|
|
1256
|
-
total
|
|
1257
|
-
message: `Re-embedding ${
|
|
1258
|
-
});
|
|
1259
|
-
const embedder = await createEmbedder(config.embedding);
|
|
1260
|
-
const texts = entries.map((m) => m.summary);
|
|
1261
|
-
const embeddings = await embedWithBatch(embedder, texts);
|
|
1262
|
-
onProgress?.({
|
|
1263
|
-
phase: "storing",
|
|
1264
|
-
current: 0,
|
|
1265
|
-
total: entries.length,
|
|
1266
|
-
message: "Rebuilding vector index..."
|
|
1261
|
+
total,
|
|
1262
|
+
message: `Re-embedding ${total} memories...`
|
|
1267
1263
|
});
|
|
1268
1264
|
acquireMemoryLock(projectDir);
|
|
1269
1265
|
try {
|
|
@@ -1273,52 +1269,52 @@ async function reindexMemories(projectDir, onProgress) {
|
|
|
1273
1269
|
}
|
|
1274
1270
|
const store = new MemoryVectorStore(projectDir);
|
|
1275
1271
|
await store.initialize();
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1272
|
+
const embedder = await createEmbedder(config.embedding);
|
|
1273
|
+
const texts = entries.map((m) => m.summary);
|
|
1274
|
+
await embedAll(embedder, texts, {
|
|
1275
|
+
onProgress: (info) => {
|
|
1276
|
+
onProgress?.({
|
|
1277
|
+
phase: "embedding",
|
|
1278
|
+
current: info.current,
|
|
1279
|
+
total: info.total,
|
|
1280
|
+
message: info.message
|
|
1281
|
+
});
|
|
1282
|
+
},
|
|
1283
|
+
onBatch: async (embeddings, startIndex, count) => {
|
|
1284
|
+
const vectorItems = [];
|
|
1285
|
+
for (let i = 0; i < count; i++) {
|
|
1286
|
+
const entry = entries[startIndex + i];
|
|
1287
|
+
vectorItems.push({
|
|
1288
|
+
id: entry.id,
|
|
1289
|
+
vector: embeddings[i],
|
|
1290
|
+
metadata: {
|
|
1291
|
+
id: entry.id,
|
|
1292
|
+
type: entry.type,
|
|
1293
|
+
importance: entry.importance,
|
|
1294
|
+
snippet: entry.summary.slice(0, 200),
|
|
1295
|
+
createdAt: entry.createdAt,
|
|
1296
|
+
tags: entry.tags.join(",")
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
await store.upsertItems(vectorItems);
|
|
1286
1301
|
}
|
|
1287
|
-
})
|
|
1288
|
-
await store.upsertItems(vectorItems);
|
|
1302
|
+
});
|
|
1289
1303
|
onProgress?.({
|
|
1290
1304
|
phase: "finalizing",
|
|
1291
|
-
current:
|
|
1292
|
-
total
|
|
1293
|
-
message: `Re-indexed ${
|
|
1305
|
+
current: total,
|
|
1306
|
+
total,
|
|
1307
|
+
message: `Re-indexed ${total} memories`
|
|
1294
1308
|
});
|
|
1295
|
-
return { reindexed:
|
|
1309
|
+
return { reindexed: total, durationMs: Date.now() - startMs };
|
|
1296
1310
|
} finally {
|
|
1297
1311
|
releaseMemoryLock(projectDir);
|
|
1298
1312
|
}
|
|
1299
1313
|
}
|
|
1300
|
-
async function embedWithBatch(embedder, texts) {
|
|
1301
|
-
if (texts.length === 0) return [];
|
|
1302
|
-
if (embedder.supportsBatch && embedder.submitBatch && embedder.pollBatch) {
|
|
1303
|
-
const batchId = await embedder.submitBatch(texts);
|
|
1304
|
-
const POLL_MS = 2e3;
|
|
1305
|
-
while (true) {
|
|
1306
|
-
const status = await embedder.pollBatch(batchId);
|
|
1307
|
-
if (status.status === "completed" && status.results) {
|
|
1308
|
-
return status.results;
|
|
1309
|
-
}
|
|
1310
|
-
if (status.status === "failed") {
|
|
1311
|
-
throw new Error(`Batch embedding failed (batch ${batchId})`);
|
|
1312
|
-
}
|
|
1313
|
-
await new Promise((resolve2) => setTimeout(resolve2, POLL_MS));
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
return embedder.embed(texts);
|
|
1317
|
-
}
|
|
1318
1314
|
async function rememberMemory(projectDir, entry) {
|
|
1319
1315
|
const config = loadMemoryConfig(projectDir);
|
|
1320
1316
|
const embedder = await createEmbedder(config.embedding);
|
|
1321
|
-
const
|
|
1317
|
+
const vector = await embedOne(embedder, entry.summary);
|
|
1322
1318
|
acquireMemoryLock(projectDir);
|
|
1323
1319
|
try {
|
|
1324
1320
|
const store = new MemoryVectorStore(projectDir);
|
|
@@ -1626,6 +1622,226 @@ function clearClassifyBatchProgress(projectDir) {
|
|
|
1626
1622
|
} catch {
|
|
1627
1623
|
}
|
|
1628
1624
|
}
|
|
1625
|
+
var NOISE_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
1626
|
+
"agent:output",
|
|
1627
|
+
"worker-progress",
|
|
1628
|
+
"engine:paused",
|
|
1629
|
+
"engine:resumed",
|
|
1630
|
+
"iteration:retrying",
|
|
1631
|
+
"iteration:rate-limited",
|
|
1632
|
+
"agent:recovery-attempted"
|
|
1633
|
+
]);
|
|
1634
|
+
function jobEventToClassificationEvent(event) {
|
|
1635
|
+
const ts = event.ts ?? event.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1636
|
+
const type = event.type;
|
|
1637
|
+
switch (type) {
|
|
1638
|
+
// --- Loop engine events ---
|
|
1639
|
+
case "engine:started":
|
|
1640
|
+
return {
|
|
1641
|
+
ts,
|
|
1642
|
+
event: "engine_started",
|
|
1643
|
+
hookEvent: "SessionStart",
|
|
1644
|
+
message: `Loop started with ${event.totalTasks ?? 0} tasks`
|
|
1645
|
+
};
|
|
1646
|
+
case "iteration:started":
|
|
1647
|
+
return {
|
|
1648
|
+
ts,
|
|
1649
|
+
event: "iteration_started",
|
|
1650
|
+
hookEvent: "PreToolUse",
|
|
1651
|
+
message: `Starting task: ${taskTitle(event)}`
|
|
1652
|
+
};
|
|
1653
|
+
case "iteration:completed": {
|
|
1654
|
+
const result = event.result;
|
|
1655
|
+
const durMs = result?.durationMs ?? event.durationMs ?? 0;
|
|
1656
|
+
return {
|
|
1657
|
+
ts,
|
|
1658
|
+
event: "iteration_completed",
|
|
1659
|
+
hookEvent: "PostToolUse",
|
|
1660
|
+
message: `Task completed: ${taskTitle(event)} in ${durMs}ms`
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
case "iteration:failed":
|
|
1664
|
+
return {
|
|
1665
|
+
ts,
|
|
1666
|
+
event: "iteration_failed",
|
|
1667
|
+
hookEvent: "PostToolUse",
|
|
1668
|
+
message: `Task failed: ${taskTitle(event)} \u2014 ${event.error ?? "unknown error"}`
|
|
1669
|
+
};
|
|
1670
|
+
case "task:skipped":
|
|
1671
|
+
return {
|
|
1672
|
+
ts,
|
|
1673
|
+
event: "task_skipped",
|
|
1674
|
+
hookEvent: "PostToolUse",
|
|
1675
|
+
message: `Task skipped: ${taskTitle(event)} \u2014 ${event.reason ?? ""}`
|
|
1676
|
+
};
|
|
1677
|
+
case "task:auto-committed":
|
|
1678
|
+
return {
|
|
1679
|
+
ts,
|
|
1680
|
+
event: "git_commit",
|
|
1681
|
+
hookEvent: "PostToolUse",
|
|
1682
|
+
command: "git commit",
|
|
1683
|
+
message: String(event.commitMessage ?? "")
|
|
1684
|
+
};
|
|
1685
|
+
case "task:auto-commit-failed":
|
|
1686
|
+
return {
|
|
1687
|
+
ts,
|
|
1688
|
+
event: "auto_commit_failed",
|
|
1689
|
+
hookEvent: "PostToolUse",
|
|
1690
|
+
message: `Auto-commit failed: ${event.error ?? "unknown"}`
|
|
1691
|
+
};
|
|
1692
|
+
case "agent:switched":
|
|
1693
|
+
return {
|
|
1694
|
+
ts,
|
|
1695
|
+
event: "agent_switched",
|
|
1696
|
+
hookEvent: "Notification",
|
|
1697
|
+
message: `Switched ${event.previousAgent ?? "?"} \u2192 ${event.newAgent ?? "?"}: ${event.reason ?? ""}`
|
|
1698
|
+
};
|
|
1699
|
+
case "agent:all-limited":
|
|
1700
|
+
return {
|
|
1701
|
+
ts,
|
|
1702
|
+
event: "all_agents_limited",
|
|
1703
|
+
hookEvent: "Notification",
|
|
1704
|
+
message: `All agents rate-limited: ${Array.isArray(event.triedAgents) ? event.triedAgents.join(", ") : ""}`
|
|
1705
|
+
};
|
|
1706
|
+
case "engine:error":
|
|
1707
|
+
return {
|
|
1708
|
+
ts,
|
|
1709
|
+
event: "engine_error",
|
|
1710
|
+
hookEvent: "Notification",
|
|
1711
|
+
message: `Engine error: ${event.error ?? "unknown"}`
|
|
1712
|
+
};
|
|
1713
|
+
case "engine:stopped":
|
|
1714
|
+
return {
|
|
1715
|
+
ts,
|
|
1716
|
+
event: "engine_stopped",
|
|
1717
|
+
hookEvent: "SessionEnd",
|
|
1718
|
+
message: `Engine stopped: ${event.reason ?? "completed"}`
|
|
1719
|
+
};
|
|
1720
|
+
// --- Parallel engine events ---
|
|
1721
|
+
case "worker-started":
|
|
1722
|
+
return {
|
|
1723
|
+
ts,
|
|
1724
|
+
event: "worker_started",
|
|
1725
|
+
hookEvent: "PreToolUse",
|
|
1726
|
+
message: `Parallel worker started: ${event.taskId ?? event.workerId ?? ""}`
|
|
1727
|
+
};
|
|
1728
|
+
case "worker-completed":
|
|
1729
|
+
return {
|
|
1730
|
+
ts,
|
|
1731
|
+
event: "worker_completed",
|
|
1732
|
+
hookEvent: "PostToolUse",
|
|
1733
|
+
message: `Parallel worker completed: ${event.taskId ?? event.workerId ?? ""}`
|
|
1734
|
+
};
|
|
1735
|
+
case "worker-failed":
|
|
1736
|
+
return {
|
|
1737
|
+
ts,
|
|
1738
|
+
event: "worker_failed",
|
|
1739
|
+
hookEvent: "PostToolUse",
|
|
1740
|
+
message: `Parallel worker failed: ${event.error ?? "unknown error"}`
|
|
1741
|
+
};
|
|
1742
|
+
case "merge-completed":
|
|
1743
|
+
return {
|
|
1744
|
+
ts,
|
|
1745
|
+
event: "merge_completed",
|
|
1746
|
+
hookEvent: "PostToolUse",
|
|
1747
|
+
command: "git merge",
|
|
1748
|
+
message: `Merged ${event.taskId ?? ""}`
|
|
1749
|
+
};
|
|
1750
|
+
case "merge-failed":
|
|
1751
|
+
return {
|
|
1752
|
+
ts,
|
|
1753
|
+
event: "merge_failed",
|
|
1754
|
+
hookEvent: "PostToolUse",
|
|
1755
|
+
message: `Merge failed: ${event.taskId ?? ""} \u2014 ${event.error ?? "unknown error"}`
|
|
1756
|
+
};
|
|
1757
|
+
case "group-completed": {
|
|
1758
|
+
const completed = event.tasksCompleted ?? 0;
|
|
1759
|
+
const failed = event.tasksFailed ?? 0;
|
|
1760
|
+
return {
|
|
1761
|
+
ts,
|
|
1762
|
+
event: "group_completed",
|
|
1763
|
+
hookEvent: "PostToolUse",
|
|
1764
|
+
message: `Group ${event.groupIndex ?? "?"}: ${completed} ok, ${failed} failed`
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
case "all-completed":
|
|
1768
|
+
return {
|
|
1769
|
+
ts,
|
|
1770
|
+
event: "all_completed",
|
|
1771
|
+
hookEvent: "SessionEnd",
|
|
1772
|
+
message: `Parallel run done: ${event.totalCompleted ?? 0} tasks`
|
|
1773
|
+
};
|
|
1774
|
+
case "all:complete":
|
|
1775
|
+
return {
|
|
1776
|
+
ts,
|
|
1777
|
+
event: "all_completed",
|
|
1778
|
+
hookEvent: "SessionEnd",
|
|
1779
|
+
message: `All tasks complete: ${event.totalCompleted ?? 0} completed in ${event.totalIterations ?? 0} iterations`
|
|
1780
|
+
};
|
|
1781
|
+
// Also capture task:completed / task:failed from loop
|
|
1782
|
+
case "task:completed":
|
|
1783
|
+
return {
|
|
1784
|
+
ts,
|
|
1785
|
+
event: "task_completed",
|
|
1786
|
+
hookEvent: "PostToolUse",
|
|
1787
|
+
message: `Task completed: ${taskTitle(event)}`
|
|
1788
|
+
};
|
|
1789
|
+
case "task:failed":
|
|
1790
|
+
return {
|
|
1791
|
+
ts,
|
|
1792
|
+
event: "task_failed",
|
|
1793
|
+
hookEvent: "PostToolUse",
|
|
1794
|
+
message: `Task failed: ${taskTitle(event)} \u2014 ${event.error ?? ""}`
|
|
1795
|
+
};
|
|
1796
|
+
default:
|
|
1797
|
+
return null;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
function taskTitle(event) {
|
|
1801
|
+
const task = event.task;
|
|
1802
|
+
if (task) {
|
|
1803
|
+
return String(task.title ?? task.id ?? "unknown");
|
|
1804
|
+
}
|
|
1805
|
+
return String(event.taskId ?? "unknown");
|
|
1806
|
+
}
|
|
1807
|
+
function captureJobForClassification(projectDir, jobId, jobEvents, meta) {
|
|
1808
|
+
const sessionId = jobId;
|
|
1809
|
+
const dir = path10.join(memoryHistoryDir(projectDir), `sess_${sessionId}`);
|
|
1810
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
1811
|
+
const config = loadMemoryConfig(projectDir);
|
|
1812
|
+
const redactPatterns = config.redactPatterns;
|
|
1813
|
+
const classificationEvents = [];
|
|
1814
|
+
for (const event of jobEvents) {
|
|
1815
|
+
const type = event.type;
|
|
1816
|
+
if (NOISE_EVENT_TYPES.has(type)) continue;
|
|
1817
|
+
const ce = jobEventToClassificationEvent(event);
|
|
1818
|
+
if (!ce) continue;
|
|
1819
|
+
if (ce.command && redactPatterns.length > 0) {
|
|
1820
|
+
ce.command = redactContent(ce.command, redactPatterns);
|
|
1821
|
+
}
|
|
1822
|
+
if (ce.message && redactPatterns.length > 0) {
|
|
1823
|
+
ce.message = redactContent(ce.message, redactPatterns);
|
|
1824
|
+
}
|
|
1825
|
+
classificationEvents.push(ce);
|
|
1826
|
+
}
|
|
1827
|
+
if (classificationEvents.length === 0) return;
|
|
1828
|
+
const eventsPath = path10.join(dir, "events.jsonl");
|
|
1829
|
+
const lines = classificationEvents.map((ce) => JSON.stringify(ce));
|
|
1830
|
+
fs10.writeFileSync(eventsPath, lines.join("\n") + "\n", "utf-8");
|
|
1831
|
+
const sessionMeta = {
|
|
1832
|
+
sessionId,
|
|
1833
|
+
projectDir,
|
|
1834
|
+
startedAt: meta.startedAt,
|
|
1835
|
+
endedAt: meta.endedAt,
|
|
1836
|
+
filesRead: 0,
|
|
1837
|
+
filesWritten: meta.tasksCompleted,
|
|
1838
|
+
commandsRun: meta.totalIterations,
|
|
1839
|
+
transcriptCaptured: false,
|
|
1840
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1841
|
+
};
|
|
1842
|
+
const metaPath = path10.join(dir, "meta.json");
|
|
1843
|
+
fs10.writeFileSync(metaPath, JSON.stringify(sessionMeta, null, 2) + "\n", "utf-8");
|
|
1844
|
+
}
|
|
1629
1845
|
|
|
1630
1846
|
export {
|
|
1631
1847
|
DEFAULT_MEMORY_CONFIG,
|
|
@@ -1677,5 +1893,6 @@ export {
|
|
|
1677
1893
|
importMemories,
|
|
1678
1894
|
writeClassifyBatchProgress,
|
|
1679
1895
|
readClassifyBatchProgress,
|
|
1680
|
-
clearClassifyBatchProgress
|
|
1896
|
+
clearClassifyBatchProgress,
|
|
1897
|
+
captureJobForClassification
|
|
1681
1898
|
};
|