@tangle-network/agent-runtime 0.94.13 → 0.96.1
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 +64 -15
- package/dist/activation-B0ZD7nfX.d.ts +63 -0
- package/dist/agent.d.ts +6 -193
- package/dist/agent.js +10 -234
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +7 -10
- package/dist/analyst-loop.js +1 -2
- package/dist/candidate-execution/index.d.ts +43 -16
- package/dist/candidate-execution/index.js +17 -8
- package/dist/{chunk-VYA2YEKA.js → chunk-2KGAN2HM.js} +83 -14
- package/dist/chunk-2KGAN2HM.js.map +1 -0
- package/dist/chunk-3XKSBI2U.js +474 -0
- package/dist/chunk-3XKSBI2U.js.map +1 -0
- package/dist/{chunk-TVJQAYQM.js → chunk-6XKPVJAZ.js} +107 -716
- package/dist/chunk-6XKPVJAZ.js.map +1 -0
- package/dist/chunk-BLQIYRVR.js +699 -0
- package/dist/chunk-BLQIYRVR.js.map +1 -0
- package/dist/{chunk-QDSOD7RC.js → chunk-FD2MBMOH.js} +13 -101
- package/dist/chunk-FD2MBMOH.js.map +1 -0
- package/dist/{chunk-U33YZ7B2.js → chunk-FXF2OL34.js} +8 -8
- package/dist/{chunk-EP6RVHMX.js → chunk-HZDEXTSL.js} +848 -2
- package/dist/chunk-HZDEXTSL.js.map +1 -0
- package/dist/{chunk-WIPGQ4GT.js → chunk-IMSNJSXH.js} +1 -1
- package/dist/{chunk-WIPGQ4GT.js.map → chunk-IMSNJSXH.js.map} +1 -1
- package/dist/{chunk-VSWBYWFK.js → chunk-M6MD6JBS.js} +20 -27
- package/dist/chunk-M6MD6JBS.js.map +1 -0
- package/dist/chunk-PSOCBNM3.js +2069 -0
- package/dist/chunk-PSOCBNM3.js.map +1 -0
- package/dist/{chunk-AEG3NGJ2.js → chunk-Q2JSAVQ3.js} +34 -2
- package/dist/chunk-Q2JSAVQ3.js.map +1 -0
- package/dist/{chunk-XP5KDM3R.js → chunk-SGQ4YIQW.js} +4 -4
- package/dist/{chunk-C3UKLQ54.js → chunk-UQ6PNNXM.js} +18 -10
- package/dist/chunk-UQ6PNNXM.js.map +1 -0
- package/dist/{chunk-33OG2NN3.js → chunk-WYC2XJF2.js} +2 -2
- package/dist/{chunk-ZEYAT33L.js → chunk-Y3SRWZMP.js} +2 -2
- package/dist/{chunk-CNH7DF7Z.js → chunk-YOLKCWRV.js} +1116 -591
- package/dist/chunk-YOLKCWRV.js.map +1 -0
- package/dist/{completion-gate-D1gX1-hg.d.ts → completion-gate-C80jiRfN.d.ts} +1 -1
- package/dist/conversation.d.ts +12 -1
- package/dist/conversation.js +2 -3
- package/dist/{coordination-Dr_axlAf.d.ts → coordination-BFE3Den7.d.ts} +10 -11
- package/dist/environment-provider.d.ts +2 -2
- package/dist/environment-provider.js +1 -2
- package/dist/{agentic-generator-DDMM45kZ.d.ts → improve-g75IE2Cx.d.ts} +152 -4
- package/dist/{improvement-adapter-BieWeK5J.d.ts → improvement-adapter-HAZz-7vK.d.ts} +8 -31
- package/dist/index.d.ts +55 -28
- package/dist/index.js +206 -82
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +185 -120
- package/dist/intelligence.js +509 -345
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +40 -12
- package/dist/knowledge.js +13 -7
- package/dist/{loop-runner-bin-BRQSQdHa.d.ts → loop-runner-bin-Cn1N2rRo.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +6 -6
- package/dist/loop-runner-bin.js +8 -10
- package/dist/loops.d.ts +13 -13
- package/dist/loops.js +6 -8
- package/dist/mcp/bin.js +5 -7
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +12 -14
- package/dist/mcp/index.js.map +1 -1
- package/dist/platform.js +0 -2
- package/dist/platform.js.map +1 -1
- package/dist/primeintellect/index.js +1 -2
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profile-DbfaMTdk.d.ts +233 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +0 -1
- package/dist/profiles.js.map +1 -1
- package/dist/{supervise-DmYOug5f.d.ts → supervise-BLPI50-w.d.ts} +3 -3
- package/dist/{types-ByAYqlVb.d.ts → types-B3vAW0Oq.d.ts} +1 -1
- package/dist/{prepare-CtdtsFNG.d.ts → types-CWqfCO8s.d.ts} +67 -298
- package/dist/{types-BC3bZpH0.d.ts → types-CmYCMbFT.d.ts} +12 -54
- package/dist/{types-1d5QGK3t.d.ts → types-CmnA2iL3.d.ts} +3 -3
- package/dist/{worktree-fanout-CPprU-qI.d.ts → worktree-fanout-DCA3G4bO.d.ts} +3 -3
- package/package.json +14 -16
- package/skills/build-with-agent-runtime/SKILL.md +122 -213
- package/dist/chunk-6O73TRHW.js +0 -142
- package/dist/chunk-6O73TRHW.js.map +0 -1
- package/dist/chunk-AEG3NGJ2.js.map +0 -1
- package/dist/chunk-C3UKLQ54.js.map +0 -1
- package/dist/chunk-CNH7DF7Z.js.map +0 -1
- package/dist/chunk-D3H7F6L2.js +0 -626
- package/dist/chunk-D3H7F6L2.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EP6RVHMX.js.map +0 -1
- package/dist/chunk-HGRW27YY.js +0 -214
- package/dist/chunk-HGRW27YY.js.map +0 -1
- package/dist/chunk-ISTDY47H.js +0 -849
- package/dist/chunk-ISTDY47H.js.map +0 -1
- package/dist/chunk-PCURO3DL.js +0 -661
- package/dist/chunk-PCURO3DL.js.map +0 -1
- package/dist/chunk-QDSOD7RC.js.map +0 -1
- package/dist/chunk-TVJQAYQM.js.map +0 -1
- package/dist/chunk-VSWBYWFK.js.map +0 -1
- package/dist/chunk-VYA2YEKA.js.map +0 -1
- package/dist/generator-YkAQrOoD.d.ts +0 -382
- package/dist/improve-BN3HyXIO.d.ts +0 -172
- package/dist/lifecycle.d.ts +0 -870
- package/dist/lifecycle.js +0 -981
- package/dist/lifecycle.js.map +0 -1
- package/dist/mcp-serve-verifier-DQQDbuyz.d.ts +0 -34
- package/skills/agent-runtime-adoption/SKILL.md +0 -246
- /package/dist/{chunk-U33YZ7B2.js.map → chunk-FXF2OL34.js.map} +0 -0
- /package/dist/{chunk-XP5KDM3R.js.map → chunk-SGQ4YIQW.js.map} +0 -0
- /package/dist/{chunk-33OG2NN3.js.map → chunk-WYC2XJF2.js.map} +0 -0
- /package/dist/{chunk-ZEYAT33L.js.map → chunk-Y3SRWZMP.js.map} +0 -0
package/dist/agent.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-FXF2OL34.js";
|
|
2
|
+
import "./chunk-Q2JSAVQ3.js";
|
|
2
3
|
import {
|
|
3
4
|
createSandboxForSpec
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UQ6PNNXM.js";
|
|
5
6
|
import "./chunk-DPEUKJRO.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-VSWBYWFK.js";
|
|
7
|
+
import "./chunk-HZDEXTSL.js";
|
|
8
|
+
import "./chunk-IMSNJSXH.js";
|
|
9
|
+
import "./chunk-M6MD6JBS.js";
|
|
10
10
|
import "./chunk-3MDZX7YU.js";
|
|
11
11
|
import {
|
|
12
12
|
mapSandboxEvent
|
|
13
13
|
} from "./chunk-M22PL4GH.js";
|
|
14
|
-
import "./chunk-EP6RVHMX.js";
|
|
15
14
|
import {
|
|
16
15
|
ValidationError
|
|
17
16
|
} from "./chunk-YEJR7IXO.js";
|
|
18
|
-
import {
|
|
19
|
-
__require
|
|
20
|
-
} from "./chunk-DGUM43GV.js";
|
|
21
17
|
|
|
22
18
|
// src/agent/surfaces.ts
|
|
23
19
|
import { existsSync, statSync } from "fs";
|
|
@@ -277,7 +273,7 @@ function defineAgent(manifest) {
|
|
|
277
273
|
}
|
|
278
274
|
|
|
279
275
|
// src/agent/improvement-adapter.ts
|
|
280
|
-
import {
|
|
276
|
+
import { createHash } from "crypto";
|
|
281
277
|
import { readFileSync } from "fs";
|
|
282
278
|
import { parseFindingSubject } from "@tangle-network/agent-eval/analyst";
|
|
283
279
|
var DEFAULT_CREATE_KINDS = [
|
|
@@ -286,8 +282,7 @@ var DEFAULT_CREATE_KINDS = [
|
|
|
286
282
|
"knowledge.raw",
|
|
287
283
|
"new-tool"
|
|
288
284
|
];
|
|
289
|
-
function
|
|
290
|
-
const mode = opts.mode ?? "none";
|
|
285
|
+
function createSurfaceImprovementProposer(opts) {
|
|
291
286
|
const allowCreate = opts.allowCreateForKinds ?? DEFAULT_CREATE_KINDS;
|
|
292
287
|
return {
|
|
293
288
|
async proposeFromFindings(findings) {
|
|
@@ -363,228 +358,11 @@ function createSurfaceImprovementAdapter(opts) {
|
|
|
363
358
|
});
|
|
364
359
|
}
|
|
365
360
|
return { edits, skipped, errors };
|
|
366
|
-
},
|
|
367
|
-
async apply(edits) {
|
|
368
|
-
const applied = [];
|
|
369
|
-
const warnings = [];
|
|
370
|
-
if (mode === "none") {
|
|
371
|
-
warnings.push(
|
|
372
|
-
"createSurfaceImprovementAdapter: mode=none; no edits applied \u2014 adjust manifest.autoApply.improvement.mode"
|
|
373
|
-
);
|
|
374
|
-
return { applied, warnings };
|
|
375
|
-
}
|
|
376
|
-
if (mode === "open-pr" && !opts.ghRepo) {
|
|
377
|
-
warnings.push(
|
|
378
|
-
"createSurfaceImprovementAdapter: mode=open-pr requires `ghRepo`; falling back to no-op"
|
|
379
|
-
);
|
|
380
|
-
return { applied, warnings };
|
|
381
|
-
}
|
|
382
|
-
for (const edit of edits) {
|
|
383
|
-
const current = edit.target.exists ? readFileSync(edit.target.absolutePath, "utf-8") : "";
|
|
384
|
-
if (sha256(current) !== edit.baseSha256) {
|
|
385
|
-
warnings.push(
|
|
386
|
-
`${edit.target.repoRelativePath}: base SHA mismatch; file changed after draft. Skipping.`
|
|
387
|
-
);
|
|
388
|
-
continue;
|
|
389
|
-
}
|
|
390
|
-
const ok = applyPatchInPlace(edit, opts.repoRoot);
|
|
391
|
-
if (!ok) {
|
|
392
|
-
warnings.push(`${edit.target.repoRelativePath}: git apply failed`);
|
|
393
|
-
continue;
|
|
394
|
-
}
|
|
395
|
-
applied.push(edit.target.repoRelativePath);
|
|
396
|
-
}
|
|
397
|
-
if (mode === "open-pr" && applied.length > 0 && opts.ghRepo) {
|
|
398
|
-
const prUrl = openPullRequest(
|
|
399
|
-
applied,
|
|
400
|
-
edits.filter((e) => applied.includes(e.target.repoRelativePath)),
|
|
401
|
-
opts.repoRoot,
|
|
402
|
-
opts.ghRepo,
|
|
403
|
-
opts.baseBranch ?? "main"
|
|
404
|
-
);
|
|
405
|
-
if (prUrl) warnings.push(`opened PR: ${prUrl}`);
|
|
406
|
-
else warnings.push("PR creation failed; edits are committed to a local branch only");
|
|
407
|
-
}
|
|
408
|
-
return { applied, warnings };
|
|
409
361
|
}
|
|
410
362
|
};
|
|
411
363
|
}
|
|
412
|
-
function applyPatchInPlace(edit, repoRoot) {
|
|
413
|
-
const result = spawnSync("git", ["apply", "--whitespace=fix", "-p0", "-"], {
|
|
414
|
-
cwd: repoRoot,
|
|
415
|
-
input: edit.patch,
|
|
416
|
-
encoding: "utf-8"
|
|
417
|
-
});
|
|
418
|
-
return result.status === 0;
|
|
419
|
-
}
|
|
420
|
-
function openPullRequest(paths, edits, repoRoot, ghRepo, baseBranch) {
|
|
421
|
-
const branch = `analyst-loop/${Date.now()}-${edits[0]?.sourceFindingId.slice(0, 12) ?? "edits"}`;
|
|
422
|
-
const checkout = spawnSync("git", ["checkout", "-b", branch], { cwd: repoRoot });
|
|
423
|
-
if (checkout.status !== 0) return null;
|
|
424
|
-
const add = spawnSync("git", ["add", ...paths], { cwd: repoRoot });
|
|
425
|
-
if (add.status !== 0) return null;
|
|
426
|
-
const title = `analyst-loop: ${edits[0]?.summary ?? `${edits.length} improvement edits`}`;
|
|
427
|
-
const body = [
|
|
428
|
-
`Automated analyst-loop edits \u2014 review carefully before merge.`,
|
|
429
|
-
"",
|
|
430
|
-
`Source findings:`,
|
|
431
|
-
...edits.map(
|
|
432
|
-
(e) => ` - ${e.sourceFindingId} (confidence ${e.confidence.toFixed(2)}, severity ${e.severity})`
|
|
433
|
-
),
|
|
434
|
-
"",
|
|
435
|
-
"Rationales:",
|
|
436
|
-
...edits.map((e) => `
|
|
437
|
-
## ${e.target.repoRelativePath}
|
|
438
|
-
|
|
439
|
-
${e.rationale}`)
|
|
440
|
-
].join("\n");
|
|
441
|
-
const commit = spawnSync("git", ["commit", "-m", title, "-m", body], { cwd: repoRoot });
|
|
442
|
-
if (commit.status !== 0) return null;
|
|
443
|
-
const push = spawnSync("git", ["push", "-u", "origin", branch], { cwd: repoRoot });
|
|
444
|
-
if (push.status !== 0) return null;
|
|
445
|
-
const pr = spawnSync(
|
|
446
|
-
"gh",
|
|
447
|
-
[
|
|
448
|
-
"pr",
|
|
449
|
-
"create",
|
|
450
|
-
"--repo",
|
|
451
|
-
ghRepo,
|
|
452
|
-
"--title",
|
|
453
|
-
title,
|
|
454
|
-
"--body",
|
|
455
|
-
body,
|
|
456
|
-
"--base",
|
|
457
|
-
baseBranch,
|
|
458
|
-
"--head",
|
|
459
|
-
branch
|
|
460
|
-
],
|
|
461
|
-
{ cwd: repoRoot, encoding: "utf-8" }
|
|
462
|
-
);
|
|
463
|
-
if (pr.status !== 0) return null;
|
|
464
|
-
return pr.stdout.trim();
|
|
465
|
-
}
|
|
466
364
|
function sha256(s) {
|
|
467
|
-
|
|
468
|
-
return crypto.createHash("sha256").update(s, "utf-8").digest("hex");
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// src/agent/knowledge-adapter.ts
|
|
472
|
-
function createSurfaceKnowledgeAdapter(opts, deps) {
|
|
473
|
-
return {
|
|
474
|
-
proposeFromFindings(findings) {
|
|
475
|
-
const batch = deps.proposeFromFindings(findings);
|
|
476
|
-
return {
|
|
477
|
-
proposals: batch.proposals,
|
|
478
|
-
skipped: batch.skipped,
|
|
479
|
-
errors: batch.errors
|
|
480
|
-
};
|
|
481
|
-
},
|
|
482
|
-
async apply(proposals) {
|
|
483
|
-
const written = [];
|
|
484
|
-
const warnings = [];
|
|
485
|
-
for (const p of proposals) {
|
|
486
|
-
const proposalText = renderProposalAsWriteBlock(p);
|
|
487
|
-
if (proposalText === null) {
|
|
488
|
-
warnings.push(
|
|
489
|
-
`proposal has no writeBlocks/content; skipping (sourceFindingId=${getSourceFindingId(p)})`
|
|
490
|
-
);
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
try {
|
|
494
|
-
const r = await deps.applyKnowledgeWriteBlocks(opts.knowledgeRoot, proposalText);
|
|
495
|
-
written.push(...r.written);
|
|
496
|
-
warnings.push(...r.warnings);
|
|
497
|
-
} catch (err) {
|
|
498
|
-
warnings.push(
|
|
499
|
-
`applyKnowledgeWriteBlocks failed: ${err instanceof Error ? err.message : String(err)}`
|
|
500
|
-
);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
if (deps.lintAfterApply && written.length > 0) {
|
|
504
|
-
try {
|
|
505
|
-
const lintIssues = await deps.lintAfterApply(opts.knowledgeRoot);
|
|
506
|
-
for (const issue of lintIssues) warnings.push(`lint: ${issue}`);
|
|
507
|
-
} catch (err) {
|
|
508
|
-
warnings.push(
|
|
509
|
-
`lintAfterApply failed: ${err instanceof Error ? err.message : String(err)}`
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
return { written, warnings };
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
function renderProposalAsWriteBlock(p) {
|
|
518
|
-
if (!p || typeof p !== "object") return null;
|
|
519
|
-
const obj = p;
|
|
520
|
-
if (Array.isArray(obj.writeBlocks)) {
|
|
521
|
-
const blocks = obj.writeBlocks;
|
|
522
|
-
if (blocks.length === 0) return null;
|
|
523
|
-
return blocks.map((b) => typeof b.content === "string" ? b.content : "").filter((s) => s.length > 0).join("\n\n");
|
|
524
|
-
}
|
|
525
|
-
if (typeof obj.proposalText === "string") return obj.proposalText;
|
|
526
|
-
if (typeof obj.content === "string") return obj.content;
|
|
527
|
-
return null;
|
|
528
|
-
}
|
|
529
|
-
function getSourceFindingId(p) {
|
|
530
|
-
if (!p || typeof p !== "object") return "<unknown>";
|
|
531
|
-
const obj = p;
|
|
532
|
-
if (typeof obj.sourceFindingId === "string") return obj.sourceFindingId;
|
|
533
|
-
if (typeof obj.id === "string") return obj.id;
|
|
534
|
-
return "<unknown>";
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// src/agent/outcome.ts
|
|
538
|
-
async function measureOutcome(result, opts) {
|
|
539
|
-
const applied = result.knowledge?.applied ?? [];
|
|
540
|
-
const improvementsApplied = result.improvement?.applied ?? [];
|
|
541
|
-
const allApplied = [...applied, ...improvementsApplied];
|
|
542
|
-
if (allApplied.length === 0) {
|
|
543
|
-
return {
|
|
544
|
-
...result,
|
|
545
|
-
outcome: {
|
|
546
|
-
baselineComposite: meanComposite(opts.baseline),
|
|
547
|
-
afterComposite: meanComposite(opts.baseline),
|
|
548
|
-
delta: 0,
|
|
549
|
-
perPersona: opts.baseline.map((b) => ({
|
|
550
|
-
personaId: b.personaId,
|
|
551
|
-
before: b.composite,
|
|
552
|
-
after: b.composite,
|
|
553
|
-
delta: 0
|
|
554
|
-
})),
|
|
555
|
-
rolledBackPaths: []
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
const personaIds = opts.baseline.map((b) => b.personaId);
|
|
560
|
-
const after = await opts.reRunCohort(personaIds);
|
|
561
|
-
const afterByPersona = new Map(after.map((r) => [r.personaId, r.composite]));
|
|
562
|
-
const perPersona = opts.baseline.map((b) => {
|
|
563
|
-
const a = afterByPersona.get(b.personaId) ?? b.composite;
|
|
564
|
-
return { personaId: b.personaId, before: b.composite, after: a, delta: a - b.composite };
|
|
565
|
-
});
|
|
566
|
-
const baselineComposite = meanComposite(opts.baseline);
|
|
567
|
-
const afterComposite = meanComposite(after);
|
|
568
|
-
const delta = afterComposite - baselineComposite;
|
|
569
|
-
let rolledBackPaths = [];
|
|
570
|
-
if (delta < 0 && opts.rollbackOnRegression && opts.revert) {
|
|
571
|
-
await opts.revert(allApplied);
|
|
572
|
-
rolledBackPaths = [...allApplied];
|
|
573
|
-
}
|
|
574
|
-
return {
|
|
575
|
-
...result,
|
|
576
|
-
outcome: {
|
|
577
|
-
baselineComposite,
|
|
578
|
-
afterComposite,
|
|
579
|
-
delta,
|
|
580
|
-
perPersona,
|
|
581
|
-
rolledBackPaths
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
function meanComposite(rows) {
|
|
586
|
-
if (rows.length === 0) return 0;
|
|
587
|
-
return rows.reduce((acc, r) => acc + r.composite, 0) / rows.length;
|
|
365
|
+
return createHash("sha256").update(s, "utf-8").digest("hex");
|
|
588
366
|
}
|
|
589
367
|
|
|
590
368
|
// src/agent/profile-materialization.ts
|
|
@@ -801,11 +579,9 @@ export {
|
|
|
801
579
|
assertProfileMaterialization,
|
|
802
580
|
collectAgentRun,
|
|
803
581
|
createSandboxAct,
|
|
804
|
-
|
|
805
|
-
createSurfaceKnowledgeAdapter,
|
|
582
|
+
createSurfaceImprovementProposer,
|
|
806
583
|
defineAgent,
|
|
807
584
|
defineProfileMaterializationContract,
|
|
808
|
-
measureOutcome,
|
|
809
585
|
promptOnlyProfileMaterialization,
|
|
810
586
|
promptResourceProfileMaterialization,
|
|
811
587
|
renderProfileMaterializationIssues,
|