@ulpi/cli 0.1.5 → 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-BFFBUJUC.js → auth-HDK7ECJL.js} +2 -1
- package/dist/{chunk-RJIRWQJD.js → chunk-3BCW6ABU.js} +402 -142
- package/dist/{chunk-L3PWNHSA.js → chunk-3WB5CXH4.js} +180 -5
- package/dist/{chunk-K4OVPFY2.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-AV5RB3N2.js → chunk-76D3BYJD.js} +48 -0
- package/dist/{chunk-DOIKS6C5.js → chunk-AWOSRA5F.js} +1 -1
- package/dist/{chunk-UCMT5OKP.js → chunk-BFEKZZHM.js} +274 -57
- package/dist/chunk-C7CLUQI6.js +1286 -0
- package/dist/{chunk-ELTGWMDE.js → chunk-E3B5NROU.js} +7 -7
- package/dist/chunk-EJ7TW77N.js +1418 -0
- package/dist/{chunk-6OURRFP7.js → chunk-IV6MWETF.js} +383 -168
- package/dist/chunk-IZPJHSPX.js +1478 -0
- package/dist/chunk-JLHNLM3C.js +228 -0
- package/dist/{chunk-P2RESJRN.js → chunk-KYYI23AQ.js} +2 -2
- 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-EWYUE7RU.js → chunk-TSLDGT5O.js} +73 -35
- package/dist/{chunk-EIWYSP3A.js → chunk-UXHCHOWQ.js} +83 -62
- package/dist/chunk-V2H5D6Y3.js +146 -0
- package/dist/{chunk-5SCG7UYM.js → chunk-VVEDXI7E.js} +1 -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-JQ56YIKC.js → ci-X3U2W4HC.js} +124 -26
- package/dist/cloud-2F3NLVHN.js +274 -0
- package/dist/{codemap-HMYBXJL2.js → codemap-XNGMAF3F.js} +37 -37
- package/dist/codex-MB5YTMRT.js +132 -0
- package/dist/{config-YYWEN7U2.js → config-OOELBYTH.js} +1 -1
- package/dist/dist-2BJYR5EI.js +59 -0
- package/dist/dist-3EIQTZHT.js +1380 -0
- package/dist/{dist-WAMAQVPK.js → dist-4U5L2X2C.js} +2 -2
- package/dist/{dist-4XTJ6HLM.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-U7ZIJMZD.js → dist-FKFEJRPX.js} +16 -15
- package/dist/dist-GTEJUBBT.js +66 -0
- package/dist/dist-HA74OKJZ.js +40 -0
- package/dist/{dist-XG2GG5SD.js → dist-HU5RZAON.js} +14 -2
- package/dist/dist-IYE3OBRB.js +374 -0
- package/dist/{dist-7WLLPWWB.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-GWGTAHNM.js → dist-NUXMDXZ3.js} +31 -3
- package/dist/{dist-5R4RYNQO.js → dist-YCNWHSLN.js} +15 -5
- package/dist/{dist-6MFVWIFF.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-RNUWO4JZ.js → history-5NE46ZAH.js} +7 -7
- package/dist/{hooks-installer-K2JXEBNN.js → hooks-installer-UN5JZLDQ.js} +2 -2
- package/dist/index.js +394 -618
- package/dist/{init-NQWFZPKO.js → init-5FK3VKRT.js} +76 -10
- 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-OYXUAVW6.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-D6ZFFCI2.js → memory-ZNAEAK3B.js} +17 -17
- package/dist/{ollama-3XCUZMZT-FYKHW4TZ.js → ollama-3XCUZMZT-4JMH6B7P.js} +1 -1
- package/dist/{openai-E7G2YAHU-IG33BFYF.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-3OFGWHP4.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-GY2CTPWN.js → skills-QEYU2N27.js} +4 -2
- package/dist/start-JYOEL7AJ.js +303 -0
- package/dist/{status-SE43TIFJ.js → status-BHQYYGAL.js} +2 -2
- package/dist/{templates-O2XDKB5R.js → templates-CBRUJ66V.js} +6 -5
- package/dist/tui-DP7736EX.js +61 -0
- package/dist/ulpi-5EN6JCAS-LFE3WSL4.js +10 -0
- package/dist/{uninstall-KWGSGZTI.js → uninstall-ICUV6DDV.js} +3 -3
- package/dist/{update-QYZA4D23.js → update-7ZMAYRBH.js} +3 -3
- package/dist/{version-checker-MVB74DEX.js → version-checker-4ZFMZA7Y.js} +2 -2
- package/package.json +39 -31
- package/dist/chunk-26LLDX2T.js +0 -553
- package/dist/chunk-DDRLI6JU.js +0 -331
- package/dist/chunk-IFATANHR.js +0 -453
- package/dist/chunk-JWUUVXIV.js +0 -13694
- package/dist/chunk-LD52XG3X.js +0 -4273
- package/dist/chunk-MIAQVCFW.js +0 -39
- package/dist/chunk-YYZOFYS6.js +0 -415
- package/dist/dist-XD4YI27T.js +0 -26
- package/dist/mcp-installer-TOYDP77X.js +0 -124
- package/dist/projects-COUJP4ZC.js +0 -271
- package/dist/review-KMGP2S25.js +0 -152
- package/dist/server-USLHY6GH-F4JSXCWA.js +0 -18
- package/dist/server-X5P6WH2M-ULZF5WHZ.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-4SM2SUI6.js +0 -167
- package/dist/ui.html +0 -698
|
@@ -1630,9 +1630,10 @@ var PipelineRuleInputSchema = external_exports.object({
|
|
|
1630
1630
|
priority: external_exports.number().int().nonnegative().default(100)
|
|
1631
1631
|
});
|
|
1632
1632
|
var NotifyChannelSchema = external_exports.object({
|
|
1633
|
-
type: external_exports.enum(["desktop", "webhook", "log", "terminal"]),
|
|
1633
|
+
type: external_exports.enum(["desktop", "webhook", "log", "terminal", "sound"]),
|
|
1634
1634
|
sound: external_exports.boolean().optional(),
|
|
1635
1635
|
sound_file: external_exports.string().optional(),
|
|
1636
|
+
sound_name: external_exports.string().optional(),
|
|
1636
1637
|
url: external_exports.string().optional(),
|
|
1637
1638
|
template: external_exports.string().optional(),
|
|
1638
1639
|
path: external_exports.string().optional(),
|
|
@@ -1917,6 +1918,9 @@ function buildPermissionOutput(decision, reason, hookEventName = "PreToolUse") {
|
|
|
1917
1918
|
}
|
|
1918
1919
|
};
|
|
1919
1920
|
}
|
|
1921
|
+
function evaluatePermission(rule) {
|
|
1922
|
+
return buildPermissionOutput(rule.decision, rule.message);
|
|
1923
|
+
}
|
|
1920
1924
|
function collectPostconditions(input, rules, projectDir) {
|
|
1921
1925
|
const results = [];
|
|
1922
1926
|
const toolName = input.tool_name ?? "";
|
|
@@ -2153,11 +2157,53 @@ function evaluateRules(hookInput, rules, state, projectDir) {
|
|
|
2153
2157
|
}
|
|
2154
2158
|
return allowResult(matchedRules, postconditionCommands, postconditionResults);
|
|
2155
2159
|
}
|
|
2160
|
+
function resolveVariables(template, config, input) {
|
|
2161
|
+
const pm = config.package_manager ?? "npm";
|
|
2162
|
+
const vars = {
|
|
2163
|
+
file_path: input?.tool_input?.file_path,
|
|
2164
|
+
command: input?.tool_input?.command,
|
|
2165
|
+
package_manager: pm,
|
|
2166
|
+
test_command: config.test_command ?? `${pm} test`,
|
|
2167
|
+
lint_command: config.lint_command ?? `${pm} lint`,
|
|
2168
|
+
build_command: config.build_command ?? `${pm} build`,
|
|
2169
|
+
format_command: config.format_command,
|
|
2170
|
+
project_name: config.name
|
|
2171
|
+
};
|
|
2172
|
+
return template.replace(/\{(\w+)\}/g, (_match, key) => {
|
|
2173
|
+
const value = vars[key];
|
|
2174
|
+
return value !== void 0 ? value : `{${key}}`;
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2156
2177
|
|
|
2157
2178
|
export {
|
|
2179
|
+
HookEventSchema,
|
|
2180
|
+
SessionStateFlagSchema,
|
|
2181
|
+
RuleSourceSchema,
|
|
2182
|
+
PermissionDecisionSchema,
|
|
2183
|
+
PipelineOnFailureSchema,
|
|
2184
|
+
StackConfigSchema,
|
|
2185
|
+
PreconditionRuleInputSchema,
|
|
2186
|
+
PostconditionRuleInputSchema,
|
|
2187
|
+
PermissionRuleInputSchema,
|
|
2188
|
+
PipelineStepSchema,
|
|
2189
|
+
PipelineRuleInputSchema,
|
|
2190
|
+
NotifyChannelSchema,
|
|
2191
|
+
EventResponseConfigSchema,
|
|
2158
2192
|
ResponseConfigSchema,
|
|
2193
|
+
ReviewSettingsConfigSchema,
|
|
2194
|
+
RulesConfigSchema,
|
|
2159
2195
|
parseRules,
|
|
2160
2196
|
loadRulesSync,
|
|
2197
|
+
matchesTool,
|
|
2198
|
+
normalizePath,
|
|
2161
2199
|
matchesFilePattern,
|
|
2162
|
-
|
|
2200
|
+
matchesCommand,
|
|
2201
|
+
isDangerousCommand,
|
|
2202
|
+
checkPrecondition,
|
|
2203
|
+
buildPermissionOutput,
|
|
2204
|
+
evaluatePermission,
|
|
2205
|
+
collectPostconditions,
|
|
2206
|
+
checkPipelinePrereqs,
|
|
2207
|
+
evaluateRules,
|
|
2208
|
+
resolveVariables
|
|
2163
2209
|
};
|
|
@@ -1,7 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
external_exports
|
|
3
|
+
} from "./chunk-KIKPIH6N.js";
|
|
4
|
+
|
|
1
5
|
// ../../packages/ci-engine/dist/index.js
|
|
2
6
|
import * as fs4 from "fs";
|
|
3
7
|
import * as path3 from "path";
|
|
4
8
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
9
|
+
var GITHUB_API = "https://api.github.com";
|
|
10
|
+
async function githubFetch(path4, token, options) {
|
|
11
|
+
const url = `${GITHUB_API}${path4}`;
|
|
12
|
+
const res = await fetch(url, {
|
|
13
|
+
...options,
|
|
14
|
+
headers: {
|
|
15
|
+
Accept: "application/vnd.github+json",
|
|
16
|
+
Authorization: `Bearer ${token}`,
|
|
17
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
18
|
+
...options?.headers ?? {}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
if (!res.ok) {
|
|
22
|
+
const body = await res.text().catch(() => "");
|
|
23
|
+
throw new Error(
|
|
24
|
+
`GitHub API ${res.status}: ${path4} - ${body.slice(0, 200)}`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
function extractDescription(desc) {
|
|
30
|
+
if (typeof desc === "string") return desc;
|
|
31
|
+
if (!desc || typeof desc !== "object") return void 0;
|
|
32
|
+
try {
|
|
33
|
+
return extractAdfText(desc);
|
|
34
|
+
} catch {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function extractAdfText(node) {
|
|
39
|
+
if (node.type === "text") return node.text ?? "";
|
|
40
|
+
const content = node.content;
|
|
41
|
+
if (!content) return "";
|
|
42
|
+
return content.map(extractAdfText).join("").trim();
|
|
43
|
+
}
|
|
5
44
|
function buildPrompt(config, context) {
|
|
6
45
|
const sections = [];
|
|
7
46
|
sections.push("# Task");
|
|
@@ -164,8 +203,17 @@ function getCredentialExpiry(blob) {
|
|
|
164
203
|
}
|
|
165
204
|
}
|
|
166
205
|
}
|
|
206
|
+
var PlanTierSchema = external_exports.enum([
|
|
207
|
+
"free",
|
|
208
|
+
"starter",
|
|
209
|
+
"pro",
|
|
210
|
+
"team",
|
|
211
|
+
"enterprise"
|
|
212
|
+
]);
|
|
167
213
|
|
|
168
214
|
export {
|
|
215
|
+
githubFetch,
|
|
216
|
+
extractDescription,
|
|
169
217
|
buildPrompt,
|
|
170
218
|
extractCredentials,
|
|
171
219
|
validateCredentials,
|
|
@@ -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
|
};
|