@triedotdev/mcp 1.0.137 → 1.0.139
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/README.md +188 -43
- package/dist/{autonomy-config-QA6ATWLJ.js → autonomy-config-ZCOSTMPD.js} +3 -3
- package/dist/{chat-store-HFOOWZYN.js → chat-store-OJLJCJFI.js} +3 -3
- package/dist/{chunk-DFPVUMVE.js → chunk-23RJT5WT.js} +5 -4
- package/dist/chunk-23RJT5WT.js.map +1 -0
- package/dist/{chunk-QNKBXOIQ.js → chunk-3MUCUZ46.js} +3 -5
- package/dist/chunk-3MUCUZ46.js.map +1 -0
- package/dist/{chunk-WHIQAGB7.js → chunk-4C67GV3O.js} +2 -2
- package/dist/{chunk-AXYNWBME.js → chunk-4O2KRHK4.js} +1907 -414
- package/dist/chunk-4O2KRHK4.js.map +1 -0
- package/dist/{chunk-ZEXMMTIQ.js → chunk-5KJ4UJOY.js} +10 -5
- package/dist/chunk-5KJ4UJOY.js.map +1 -0
- package/dist/chunk-62POBLFC.js +1925 -0
- package/dist/chunk-62POBLFC.js.map +1 -0
- package/dist/{chunk-HUR67JXG.js → chunk-75ADWWUF.js} +38 -19
- package/dist/chunk-75ADWWUF.js.map +1 -0
- package/dist/{chunk-4JQ6W7LW.js → chunk-7OJ6JIPL.js} +40 -608
- package/dist/chunk-7OJ6JIPL.js.map +1 -0
- package/dist/{chunk-6VIMBFUZ.js → chunk-AF2APASP.js} +58 -20
- package/dist/chunk-AF2APASP.js.map +1 -0
- package/dist/{chunk-Z4DN527J.js → chunk-FG467PDD.js} +156 -39
- package/dist/chunk-FG467PDD.js.map +1 -0
- package/dist/{chunk-55CBWOEZ.js → chunk-FH335WL5.js} +10 -2
- package/dist/chunk-FH335WL5.js.map +1 -0
- package/dist/{chunk-O6OTJI3W.js → chunk-FPEMP54L.js} +22 -16
- package/dist/chunk-FPEMP54L.js.map +1 -0
- package/dist/{chunk-K6NTRSDF.js → chunk-GXF6JOCN.js} +24 -326
- package/dist/chunk-GXF6JOCN.js.map +1 -0
- package/dist/chunk-LD7ZEFNY.js +132 -0
- package/dist/chunk-LD7ZEFNY.js.map +1 -0
- package/dist/{chunk-6EP2VTHC.js → chunk-LT6VUZG2.js} +7 -4
- package/dist/chunk-LT6VUZG2.js.map +1 -0
- package/dist/chunk-NKHO34UZ.js +467 -0
- package/dist/chunk-NKHO34UZ.js.map +1 -0
- package/dist/{chunk-QM5VIDFN.js → chunk-OQ4A3RDY.js} +46 -30
- package/dist/chunk-OQ4A3RDY.js.map +1 -0
- package/dist/{chunk-45Y5TLQZ.js → chunk-SH7H3WRU.js} +3 -6
- package/dist/chunk-SH7H3WRU.js.map +1 -0
- package/dist/{chunk-G74XEI7K.js → chunk-UOSTOLU7.js} +21 -21
- package/dist/chunk-UOSTOLU7.js.map +1 -0
- package/dist/{chunk-DPZLABUC.js → chunk-XTTZAQWJ.js} +28 -22
- package/dist/chunk-XTTZAQWJ.js.map +1 -0
- package/dist/{chunk-A6PWS6ZV.js → chunk-YEIJW6X6.js} +15 -5
- package/dist/chunk-YEIJW6X6.js.map +1 -0
- package/dist/chunk-YOJGSRZK.js +216 -0
- package/dist/chunk-YOJGSRZK.js.map +1 -0
- package/dist/cli/create-agent.js +1 -1
- package/dist/cli/main.js +636 -99
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +21 -19
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{client-BZHI675W.js → client-INNE2GGZ.js} +3 -3
- package/dist/{codebase-index-CR6Q2HEI.js → codebase-index-5SEOESWM.js} +4 -4
- package/dist/fast-analyzer-AYLZB5TW.js +216 -0
- package/dist/fast-analyzer-AYLZB5TW.js.map +1 -0
- package/dist/github-ingester-J2ZFYXVE.js +11 -0
- package/dist/{goal-manager-62IL6WGY.js → goal-manager-ZBWKWEML.js} +6 -6
- package/dist/{goal-validator-HPPBSDXD.js → goal-validator-HNXXUCPW.js} +5 -5
- package/dist/{graph-PAUZ5EMP.js → graph-J4OGTYCO.js} +3 -3
- package/dist/{hypothesis-W37VG6DA.js → hypothesis-JCUMZKTG.js} +6 -6
- package/dist/{incident-index-ZCDSJ42L.js → incident-index-BWW2UEY7.js} +3 -3
- package/dist/index.js +1168 -137
- package/dist/index.js.map +1 -1
- package/dist/{insight-store-U3NYTOJE.js → insight-store-A5XXMFD6.js} +3 -5
- package/dist/{issue-store-EZMBHOVN.js → issue-store-LZWZIGM7.js} +3 -3
- package/dist/linear-ingester-JRDQAIAA.js +11 -0
- package/dist/{tiered-storage-QW2G7GSG.js → tiered-storage-VZL7KK64.js} +3 -3
- package/dist/tiered-storage-VZL7KK64.js.map +1 -0
- package/dist/trie-agent-M6PHM6UD.js +26 -0
- package/dist/trie-agent-M6PHM6UD.js.map +1 -0
- package/dist/ui/chat.html +260 -67
- package/dist/ui/goals.html +246 -3
- package/dist/ui/hypotheses.html +248 -5
- package/dist/ui/ledger.html +252 -9
- package/dist/ui/nudges.html +244 -1
- package/package.json +15 -8
- package/dist/chunk-45Y5TLQZ.js.map +0 -1
- package/dist/chunk-4JQ6W7LW.js.map +0 -1
- package/dist/chunk-55CBWOEZ.js.map +0 -1
- package/dist/chunk-6EP2VTHC.js.map +0 -1
- package/dist/chunk-6VIMBFUZ.js.map +0 -1
- package/dist/chunk-A6PWS6ZV.js.map +0 -1
- package/dist/chunk-AXYNWBME.js.map +0 -1
- package/dist/chunk-DFPVUMVE.js.map +0 -1
- package/dist/chunk-DPZLABUC.js.map +0 -1
- package/dist/chunk-G74XEI7K.js.map +0 -1
- package/dist/chunk-HUR67JXG.js.map +0 -1
- package/dist/chunk-K6NTRSDF.js.map +0 -1
- package/dist/chunk-O6OTJI3W.js.map +0 -1
- package/dist/chunk-QM5VIDFN.js.map +0 -1
- package/dist/chunk-QNKBXOIQ.js.map +0 -1
- package/dist/chunk-R3WZI6QZ.js +0 -883
- package/dist/chunk-R3WZI6QZ.js.map +0 -1
- package/dist/chunk-Z4DN527J.js.map +0 -1
- package/dist/chunk-ZEXMMTIQ.js.map +0 -1
- package/dist/guardian-agent-YKG5XURG.js +0 -30
- /package/dist/{autonomy-config-QA6ATWLJ.js.map → autonomy-config-ZCOSTMPD.js.map} +0 -0
- /package/dist/{chat-store-HFOOWZYN.js.map → chat-store-OJLJCJFI.js.map} +0 -0
- /package/dist/{chunk-WHIQAGB7.js.map → chunk-4C67GV3O.js.map} +0 -0
- /package/dist/{client-BZHI675W.js.map → client-INNE2GGZ.js.map} +0 -0
- /package/dist/{codebase-index-CR6Q2HEI.js.map → codebase-index-5SEOESWM.js.map} +0 -0
- /package/dist/{goal-manager-62IL6WGY.js.map → github-ingester-J2ZFYXVE.js.map} +0 -0
- /package/dist/{goal-validator-HPPBSDXD.js.map → goal-manager-ZBWKWEML.js.map} +0 -0
- /package/dist/{graph-PAUZ5EMP.js.map → goal-validator-HNXXUCPW.js.map} +0 -0
- /package/dist/{guardian-agent-YKG5XURG.js.map → graph-J4OGTYCO.js.map} +0 -0
- /package/dist/{hypothesis-W37VG6DA.js.map → hypothesis-JCUMZKTG.js.map} +0 -0
- /package/dist/{incident-index-ZCDSJ42L.js.map → incident-index-BWW2UEY7.js.map} +0 -0
- /package/dist/{insight-store-U3NYTOJE.js.map → insight-store-A5XXMFD6.js.map} +0 -0
- /package/dist/{issue-store-EZMBHOVN.js.map → issue-store-LZWZIGM7.js.map} +0 -0
- /package/dist/{tiered-storage-QW2G7GSG.js.map → linear-ingester-JRDQAIAA.js.map} +0 -0
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IncidentIndex
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4C67GV3O.js";
|
|
4
4
|
import {
|
|
5
5
|
TriePatternDiscovery
|
|
6
6
|
} from "./chunk-ZV2K6M7T.js";
|
|
7
|
+
import {
|
|
8
|
+
ContextGraph
|
|
9
|
+
} from "./chunk-FH335WL5.js";
|
|
10
|
+
import {
|
|
11
|
+
getDiff,
|
|
12
|
+
getRecentCommits,
|
|
13
|
+
getStagedChanges,
|
|
14
|
+
getUncommittedChanges,
|
|
15
|
+
getWorkingTreeDiff,
|
|
16
|
+
storeIssues
|
|
17
|
+
} from "./chunk-62POBLFC.js";
|
|
7
18
|
import {
|
|
8
19
|
scanForVulnerabilities
|
|
9
20
|
} from "./chunk-F4NJ4CBP.js";
|
|
10
21
|
import {
|
|
11
22
|
scanForVibeCodeIssues
|
|
12
23
|
} from "./chunk-IXO4G4D3.js";
|
|
13
|
-
import {
|
|
14
|
-
ContextGraph
|
|
15
|
-
} from "./chunk-55CBWOEZ.js";
|
|
16
|
-
import {
|
|
17
|
-
storeIssues
|
|
18
|
-
} from "./chunk-R3WZI6QZ.js";
|
|
19
24
|
import {
|
|
20
25
|
getTrieDirectory,
|
|
21
26
|
getWorkingDirectory
|
|
22
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SH7H3WRU.js";
|
|
23
28
|
import {
|
|
24
29
|
isInteractiveMode
|
|
25
30
|
} from "./chunk-APMV77PU.js";
|
|
@@ -252,304 +257,6 @@ function formatFriendlyError(error) {
|
|
|
252
257
|
};
|
|
253
258
|
}
|
|
254
259
|
|
|
255
|
-
// src/skills/audit-logger.ts
|
|
256
|
-
function formatAuditLog(_entry) {
|
|
257
|
-
return "Audit logging has been integrated into the decision ledger";
|
|
258
|
-
}
|
|
259
|
-
function getAuditStatistics() {
|
|
260
|
-
return {
|
|
261
|
-
totalScans: 0,
|
|
262
|
-
totalIssues: 0,
|
|
263
|
-
criticalCount: 0,
|
|
264
|
-
seriousCount: 0,
|
|
265
|
-
moderateCount: 0,
|
|
266
|
-
lowCount: 0,
|
|
267
|
-
totalExecutions: 0,
|
|
268
|
-
successfulExecutions: 0,
|
|
269
|
-
failedExecutions: 0,
|
|
270
|
-
uniqueSkills: 0,
|
|
271
|
-
totalCommands: 0,
|
|
272
|
-
blockedCommands: 0,
|
|
273
|
-
totalNetworkCalls: 0,
|
|
274
|
-
blockedNetworkCalls: 0
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function createAuditEntry(skillName, skillSource, triggeredBy, targetPath) {
|
|
278
|
-
return {
|
|
279
|
-
skillName,
|
|
280
|
-
skillSource,
|
|
281
|
-
triggeredBy,
|
|
282
|
-
targetPath,
|
|
283
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
284
|
-
commands: []
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function completeAuditEntry(entry, success, error) {
|
|
288
|
-
const result = {
|
|
289
|
-
...entry,
|
|
290
|
-
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
291
|
-
success
|
|
292
|
-
};
|
|
293
|
-
if (error !== void 0) {
|
|
294
|
-
result.error = error;
|
|
295
|
-
}
|
|
296
|
-
return result;
|
|
297
|
-
}
|
|
298
|
-
async function logSkillExecution(_execution) {
|
|
299
|
-
}
|
|
300
|
-
async function getRecentAuditLogs(_limit = 10) {
|
|
301
|
-
return [];
|
|
302
|
-
}
|
|
303
|
-
async function getSkillAuditLogs(_skillName) {
|
|
304
|
-
return [];
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// src/agent/git.ts
|
|
308
|
-
import { existsSync as existsSync3 } from "fs";
|
|
309
|
-
import path2 from "path";
|
|
310
|
-
|
|
311
|
-
// src/utils/command-runner.ts
|
|
312
|
-
import { exec, execFile, execSync } from "child_process";
|
|
313
|
-
import { promisify } from "util";
|
|
314
|
-
var execAsync = promisify(exec);
|
|
315
|
-
var execFileAsync = promisify(execFile);
|
|
316
|
-
function redact(text) {
|
|
317
|
-
return text.replace(/\b(AWS|ANTHROPIC|OPENAI|GITHUB)_[A-Z0-9_]*\s*=\s*([^\s"'`]+)/gi, "$1_<REDACTED>=<REDACTED>").replace(/\bBearer\s+[A-Za-z0-9\-._~+/]+=*\b/g, "Bearer <REDACTED>").replace(/\bghp_[A-Za-z0-9]{20,}\b/g, "ghp_<REDACTED>").replace(/\b(?:xox[baprs]-)[A-Za-z0-9-]{10,}\b/g, "<REDACTED_SLACK_TOKEN>").replace(/\bAKIA[0-9A-Z]{16}\b/g, "AKIA<REDACTED>");
|
|
318
|
-
}
|
|
319
|
-
function clampOutput(text, maxChars) {
|
|
320
|
-
if (text.length <= maxChars) return text;
|
|
321
|
-
return text.slice(0, maxChars) + `
|
|
322
|
-
\u2026(truncated ${text.length - maxChars} chars)`;
|
|
323
|
-
}
|
|
324
|
-
function buildCommandRecord(command) {
|
|
325
|
-
return {
|
|
326
|
-
command,
|
|
327
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
async function finalizeAndWrite(entry, cmd, outcome, options) {
|
|
331
|
-
const duration = Date.now() - outcome.startedAt;
|
|
332
|
-
cmd.duration = duration;
|
|
333
|
-
if (outcome.exitCode !== void 0) {
|
|
334
|
-
cmd.exitCode = outcome.exitCode;
|
|
335
|
-
}
|
|
336
|
-
const captureOutput = options?.captureOutput ?? false;
|
|
337
|
-
const redactOutput = options?.redactOutput ?? true;
|
|
338
|
-
const maxOutputChars = options?.maxOutputChars ?? 2e3;
|
|
339
|
-
if (captureOutput) {
|
|
340
|
-
const out = outcome.stdout ?? "";
|
|
341
|
-
const err = outcome.stderr ?? "";
|
|
342
|
-
cmd.stdout = redactOutput ? redact(clampOutput(out, maxOutputChars)) : clampOutput(out, maxOutputChars);
|
|
343
|
-
cmd.stderr = redactOutput ? redact(clampOutput(err, maxOutputChars)) : clampOutput(err, maxOutputChars);
|
|
344
|
-
}
|
|
345
|
-
const completed = completeAuditEntry(entry, outcome.success, outcome.error);
|
|
346
|
-
await logSkillExecution(completed);
|
|
347
|
-
}
|
|
348
|
-
function runShellCommandSync(command, audit, options) {
|
|
349
|
-
const startedAt = Date.now();
|
|
350
|
-
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
351
|
-
const cmd = buildCommandRecord(command);
|
|
352
|
-
entry.commands?.push(cmd);
|
|
353
|
-
try {
|
|
354
|
-
const stdout = execSync(command, {
|
|
355
|
-
cwd: options?.cwd,
|
|
356
|
-
timeout: options?.timeoutMs,
|
|
357
|
-
maxBuffer: options?.maxBuffer,
|
|
358
|
-
encoding: "utf-8",
|
|
359
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
360
|
-
});
|
|
361
|
-
void finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout, stderr: "", startedAt }, options);
|
|
362
|
-
return { stdout: stdout ?? "", exitCode: 0 };
|
|
363
|
-
} catch (e) {
|
|
364
|
-
const err = e;
|
|
365
|
-
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
366
|
-
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
367
|
-
const exitCode = typeof err.status === "number" ? err.status : 1;
|
|
368
|
-
void finalizeAndWrite(
|
|
369
|
-
entry,
|
|
370
|
-
cmd,
|
|
371
|
-
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
372
|
-
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
373
|
-
);
|
|
374
|
-
return { stdout, exitCode };
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
async function runExecFile(file, args, audit, options) {
|
|
378
|
-
const startedAt = Date.now();
|
|
379
|
-
const command = [file, ...args].join(" ");
|
|
380
|
-
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
381
|
-
const cmd = buildCommandRecord(command);
|
|
382
|
-
entry.commands?.push(cmd);
|
|
383
|
-
try {
|
|
384
|
-
const { stdout, stderr } = await execFileAsync(file, args, {
|
|
385
|
-
cwd: options?.cwd,
|
|
386
|
-
timeout: options?.timeoutMs,
|
|
387
|
-
maxBuffer: options?.maxBuffer
|
|
388
|
-
});
|
|
389
|
-
await finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout: String(stdout ?? ""), stderr: String(stderr ?? ""), startedAt }, options);
|
|
390
|
-
return { stdout: String(stdout ?? ""), stderr: String(stderr ?? ""), exitCode: 0 };
|
|
391
|
-
} catch (e) {
|
|
392
|
-
const err = e;
|
|
393
|
-
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
394
|
-
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
395
|
-
const exitCode = typeof err.code === "number" ? err.code : 1;
|
|
396
|
-
await finalizeAndWrite(
|
|
397
|
-
entry,
|
|
398
|
-
cmd,
|
|
399
|
-
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
400
|
-
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
401
|
-
);
|
|
402
|
-
return { stdout, stderr, exitCode };
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// src/agent/git.ts
|
|
407
|
-
async function execGit(args, cwd) {
|
|
408
|
-
try {
|
|
409
|
-
const { stdout } = await runExecFile(
|
|
410
|
-
"git",
|
|
411
|
-
["-C", cwd, ...args],
|
|
412
|
-
{ actor: "internal:git", triggeredBy: "manual", targetPath: cwd },
|
|
413
|
-
{ maxBuffer: 10 * 1024 * 1024, captureOutput: false }
|
|
414
|
-
);
|
|
415
|
-
return stdout.trim();
|
|
416
|
-
} catch (error) {
|
|
417
|
-
const stderr = error?.stderr?.toString();
|
|
418
|
-
if (stderr?.includes("not a git repository") || stderr?.includes("does not have any commits")) {
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
throw error;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
async function ensureRepo(projectPath) {
|
|
425
|
-
const result = await execGit(["rev-parse", "--is-inside-work-tree"], projectPath);
|
|
426
|
-
return result === "true";
|
|
427
|
-
}
|
|
428
|
-
function parseNameStatus(output) {
|
|
429
|
-
return output.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => {
|
|
430
|
-
const parts = line.split(" ");
|
|
431
|
-
const status = parts[0] ?? "";
|
|
432
|
-
const filePath = parts[1] ?? "";
|
|
433
|
-
const oldPath = parts[2];
|
|
434
|
-
const change = { status, path: filePath };
|
|
435
|
-
if (oldPath) change.oldPath = oldPath;
|
|
436
|
-
return change;
|
|
437
|
-
}).filter((entry) => entry.path.length > 0);
|
|
438
|
-
}
|
|
439
|
-
async function getRecentCommits(projectPath, limit) {
|
|
440
|
-
const isRepo = await ensureRepo(projectPath);
|
|
441
|
-
if (!isRepo) return [];
|
|
442
|
-
const output = await execGit(
|
|
443
|
-
["log", `-n`, String(limit), "--pretty=format:%H%x09%an%x09%ad%x09%s", "--date=iso"],
|
|
444
|
-
projectPath
|
|
445
|
-
);
|
|
446
|
-
if (!output) return [];
|
|
447
|
-
return output.split("\n").map((line) => {
|
|
448
|
-
const [hash, author, date, message] = line.split(" ");
|
|
449
|
-
return { hash, author, date, message };
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
async function getStagedChanges(projectPath) {
|
|
453
|
-
const isRepo = await ensureRepo(projectPath);
|
|
454
|
-
if (!isRepo) return [];
|
|
455
|
-
const output = await execGit(["diff", "--cached", "--name-status"], projectPath);
|
|
456
|
-
if (!output) return [];
|
|
457
|
-
return parseNameStatus(output);
|
|
458
|
-
}
|
|
459
|
-
async function getUncommittedChanges(projectPath) {
|
|
460
|
-
const isRepo = await ensureRepo(projectPath);
|
|
461
|
-
if (!isRepo) return [];
|
|
462
|
-
const changes = [];
|
|
463
|
-
const unstaged = await execGit(["diff", "--name-status"], projectPath);
|
|
464
|
-
if (unstaged) {
|
|
465
|
-
changes.push(...parseNameStatus(unstaged));
|
|
466
|
-
}
|
|
467
|
-
const untracked = await execGit(["ls-files", "--others", "--exclude-standard"], projectPath);
|
|
468
|
-
if (untracked) {
|
|
469
|
-
changes.push(
|
|
470
|
-
...untracked.split("\n").map((p) => p.trim()).filter(Boolean).map((p) => ({ status: "??", path: p }))
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
return changes;
|
|
474
|
-
}
|
|
475
|
-
async function getGitChangedFiles(projectPath) {
|
|
476
|
-
const isRepo = await ensureRepo(projectPath);
|
|
477
|
-
if (!isRepo) return null;
|
|
478
|
-
const [staged, uncommitted] = await Promise.all([
|
|
479
|
-
getStagedChanges(projectPath).catch(() => []),
|
|
480
|
-
getUncommittedChanges(projectPath).catch(() => [])
|
|
481
|
-
]);
|
|
482
|
-
const paths = /* @__PURE__ */ new Set();
|
|
483
|
-
for (const change of [...staged, ...uncommitted]) {
|
|
484
|
-
if (change.path) paths.add(change.path);
|
|
485
|
-
if (change.oldPath) paths.add(change.oldPath);
|
|
486
|
-
}
|
|
487
|
-
return [...paths];
|
|
488
|
-
}
|
|
489
|
-
async function getDiff(projectPath, commitHash) {
|
|
490
|
-
const isRepo = await ensureRepo(projectPath);
|
|
491
|
-
if (!isRepo) return "";
|
|
492
|
-
const diff = await execGit(["show", commitHash, "--unified=3", "--no-color"], projectPath);
|
|
493
|
-
return diff ?? "";
|
|
494
|
-
}
|
|
495
|
-
async function getWorkingTreeDiff(projectPath, stagedOnly = false) {
|
|
496
|
-
const isRepo = await ensureRepo(projectPath);
|
|
497
|
-
if (!isRepo) return "";
|
|
498
|
-
const args = stagedOnly ? ["diff", "--cached", "--unified=3", "--no-color"] : ["diff", "--unified=3", "--no-color"];
|
|
499
|
-
const diff = await execGit(args, projectPath);
|
|
500
|
-
return diff ?? "";
|
|
501
|
-
}
|
|
502
|
-
async function isGitRepo(projectPath) {
|
|
503
|
-
const result = await execGit(["rev-parse", "--is-inside-work-tree"], projectPath);
|
|
504
|
-
return result === "true";
|
|
505
|
-
}
|
|
506
|
-
async function getChangedFilesSinceTimestamp(projectPath, timestamp) {
|
|
507
|
-
const isRepo = await isGitRepo(projectPath);
|
|
508
|
-
if (!isRepo) return null;
|
|
509
|
-
try {
|
|
510
|
-
const sinceDate = new Date(timestamp).toISOString();
|
|
511
|
-
const GIT_TIMEOUT_MS = 5e3;
|
|
512
|
-
const startTime = Date.now();
|
|
513
|
-
const committedChangesPromise = execGit(
|
|
514
|
-
["log", `--since=${sinceDate}`, "--name-only", "--pretty=format:"],
|
|
515
|
-
projectPath
|
|
516
|
-
);
|
|
517
|
-
const committedChangesTimeout = new Promise((resolve) => {
|
|
518
|
-
setTimeout(() => resolve(null), GIT_TIMEOUT_MS);
|
|
519
|
-
});
|
|
520
|
-
const committedChanges = await Promise.race([committedChangesPromise, committedChangesTimeout]);
|
|
521
|
-
if (Date.now() - startTime > GIT_TIMEOUT_MS) {
|
|
522
|
-
return null;
|
|
523
|
-
}
|
|
524
|
-
const stagedPromise = execGit(["diff", "--cached", "--name-only"], projectPath);
|
|
525
|
-
const unstagedPromise = execGit(["diff", "--name-only"], projectPath);
|
|
526
|
-
const untrackedPromise = execGit(
|
|
527
|
-
["ls-files", "--others", "--exclude-standard"],
|
|
528
|
-
projectPath
|
|
529
|
-
);
|
|
530
|
-
const timeoutPromise = new Promise((resolve) => {
|
|
531
|
-
setTimeout(() => resolve(null), Math.max(0, GIT_TIMEOUT_MS - (Date.now() - startTime)));
|
|
532
|
-
});
|
|
533
|
-
const [stagedChanges, unstagedChanges, untrackedFiles] = await Promise.race([
|
|
534
|
-
Promise.all([stagedPromise, unstagedPromise, untrackedPromise]),
|
|
535
|
-
timeoutPromise.then(() => [null, null, null])
|
|
536
|
-
]);
|
|
537
|
-
const changedFiles = /* @__PURE__ */ new Set();
|
|
538
|
-
const addFiles = (output) => {
|
|
539
|
-
if (output) {
|
|
540
|
-
output.split("\n").map((f) => f.trim()).filter(Boolean).forEach((f) => changedFiles.add(path2.join(projectPath, f)));
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
addFiles(committedChanges);
|
|
544
|
-
addFiles(stagedChanges);
|
|
545
|
-
addFiles(unstagedChanges);
|
|
546
|
-
addFiles(untrackedFiles);
|
|
547
|
-
return Array.from(changedFiles);
|
|
548
|
-
} catch {
|
|
549
|
-
return null;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
260
|
// src/agent/confidence.ts
|
|
554
261
|
function adjustConfidence(current, outcome, step = 0.1) {
|
|
555
262
|
const delta = outcome === "positive" ? step : -step;
|
|
@@ -614,8 +321,8 @@ var LearningSystem = class {
|
|
|
614
321
|
}
|
|
615
322
|
};
|
|
616
323
|
|
|
617
|
-
// src/
|
|
618
|
-
import
|
|
324
|
+
// src/agent/learning-engine.ts
|
|
325
|
+
import path2 from "path";
|
|
619
326
|
var LearningEngine = class {
|
|
620
327
|
projectPath;
|
|
621
328
|
graph;
|
|
@@ -664,7 +371,7 @@ var LearningEngine = class {
|
|
|
664
371
|
}
|
|
665
372
|
}
|
|
666
373
|
if (issuesToStore.length > 0) {
|
|
667
|
-
const result = await storeIssues(issuesToStore,
|
|
374
|
+
const result = await storeIssues(issuesToStore, path2.basename(this.projectPath), this.projectPath);
|
|
668
375
|
return result.stored;
|
|
669
376
|
}
|
|
670
377
|
return 0;
|
|
@@ -757,7 +464,7 @@ var LearningEngine = class {
|
|
|
757
464
|
};
|
|
758
465
|
|
|
759
466
|
// src/agent/perceive.ts
|
|
760
|
-
import
|
|
467
|
+
import path3 from "path";
|
|
761
468
|
|
|
762
469
|
// src/agent/diff-analyzer.ts
|
|
763
470
|
var RISKY_PATTERNS = [/auth/i, /token/i, /password/i, /secret/i, /validate/i, /sanitize/i];
|
|
@@ -861,7 +568,7 @@ async function upsertWorkingChange(graph, files, projectPath) {
|
|
|
861
568
|
return change.id;
|
|
862
569
|
}
|
|
863
570
|
async function ensureFileNode(graph, filePath, projectPath) {
|
|
864
|
-
const normalized =
|
|
571
|
+
const normalized = path3.resolve(projectPath, filePath);
|
|
865
572
|
const existing = await graph.getNode("file", normalized);
|
|
866
573
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
867
574
|
if (existing) {
|
|
@@ -874,7 +581,7 @@ async function ensureFileNode(graph, filePath, projectPath) {
|
|
|
874
581
|
}
|
|
875
582
|
const data = {
|
|
876
583
|
path: filePath,
|
|
877
|
-
extension:
|
|
584
|
+
extension: path3.extname(filePath),
|
|
878
585
|
purpose: "",
|
|
879
586
|
riskLevel: "medium",
|
|
880
587
|
whyRisky: null,
|
|
@@ -887,7 +594,7 @@ async function ensureFileNode(graph, filePath, projectPath) {
|
|
|
887
594
|
}
|
|
888
595
|
|
|
889
596
|
// src/agent/risk-scorer.ts
|
|
890
|
-
import
|
|
597
|
+
import path4 from "path";
|
|
891
598
|
var BASE_RISK = {
|
|
892
599
|
low: 10,
|
|
893
600
|
medium: 35,
|
|
@@ -907,7 +614,7 @@ function levelFromScore(score) {
|
|
|
907
614
|
}
|
|
908
615
|
async function scoreFile(graph, filePath, matchedPatterns = []) {
|
|
909
616
|
const reasons = [];
|
|
910
|
-
const normalized =
|
|
617
|
+
const normalized = path4.resolve(graph.projectRoot, filePath);
|
|
911
618
|
const node = await graph.getNode("file", normalized);
|
|
912
619
|
const incidents = await graph.getIncidentsForFile(filePath);
|
|
913
620
|
let score = 10;
|
|
@@ -1031,7 +738,7 @@ var Triager = class {
|
|
|
1031
738
|
// src/utils/parallel-executor.ts
|
|
1032
739
|
import { Worker } from "worker_threads";
|
|
1033
740
|
import { cpus } from "os";
|
|
1034
|
-
import { existsSync as
|
|
741
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1035
742
|
import { fileURLToPath } from "url";
|
|
1036
743
|
var ParallelExecutor = class {
|
|
1037
744
|
maxWorkers;
|
|
@@ -1188,7 +895,7 @@ var ParallelExecutor = class {
|
|
|
1188
895
|
return this.workerAvailable;
|
|
1189
896
|
}
|
|
1190
897
|
const workerUrl = this.getWorkerUrl();
|
|
1191
|
-
this.workerAvailable =
|
|
898
|
+
this.workerAvailable = existsSync3(fileURLToPath(workerUrl));
|
|
1192
899
|
if (!this.workerAvailable && !this.warnedWorkerFallback && !isInteractiveMode()) {
|
|
1193
900
|
console.error("Worker threads unavailable; falling back to in-process agents.");
|
|
1194
901
|
this.warnedWorkerFallback = true;
|
|
@@ -1738,15 +1445,6 @@ export {
|
|
|
1738
1445
|
exportToJson,
|
|
1739
1446
|
importFromJson,
|
|
1740
1447
|
formatFriendlyError,
|
|
1741
|
-
formatAuditLog,
|
|
1742
|
-
getAuditStatistics,
|
|
1743
|
-
getRecentAuditLogs,
|
|
1744
|
-
getSkillAuditLogs,
|
|
1745
|
-
runShellCommandSync,
|
|
1746
|
-
getStagedChanges,
|
|
1747
|
-
getUncommittedChanges,
|
|
1748
|
-
getGitChangedFiles,
|
|
1749
|
-
getChangedFilesSinceTimestamp,
|
|
1750
1448
|
LearningEngine,
|
|
1751
1449
|
perceiveCurrentChanges,
|
|
1752
1450
|
reasonAboutChangesHumanReadable,
|
|
@@ -1756,4 +1454,4 @@ export {
|
|
|
1756
1454
|
handleCheckpointCommand,
|
|
1757
1455
|
isTrieInitialized
|
|
1758
1456
|
};
|
|
1759
|
-
//# sourceMappingURL=chunk-
|
|
1457
|
+
//# sourceMappingURL=chunk-GXF6JOCN.js.map
|