@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.
Files changed (110) hide show
  1. package/README.md +64 -15
  2. package/dist/activation-B0ZD7nfX.d.ts +63 -0
  3. package/dist/agent.d.ts +6 -193
  4. package/dist/agent.js +10 -234
  5. package/dist/agent.js.map +1 -1
  6. package/dist/analyst-loop.d.ts +7 -10
  7. package/dist/analyst-loop.js +1 -2
  8. package/dist/candidate-execution/index.d.ts +43 -16
  9. package/dist/candidate-execution/index.js +17 -8
  10. package/dist/{chunk-VYA2YEKA.js → chunk-2KGAN2HM.js} +83 -14
  11. package/dist/chunk-2KGAN2HM.js.map +1 -0
  12. package/dist/chunk-3XKSBI2U.js +474 -0
  13. package/dist/chunk-3XKSBI2U.js.map +1 -0
  14. package/dist/{chunk-TVJQAYQM.js → chunk-6XKPVJAZ.js} +107 -716
  15. package/dist/chunk-6XKPVJAZ.js.map +1 -0
  16. package/dist/chunk-BLQIYRVR.js +699 -0
  17. package/dist/chunk-BLQIYRVR.js.map +1 -0
  18. package/dist/{chunk-QDSOD7RC.js → chunk-FD2MBMOH.js} +13 -101
  19. package/dist/chunk-FD2MBMOH.js.map +1 -0
  20. package/dist/{chunk-U33YZ7B2.js → chunk-FXF2OL34.js} +8 -8
  21. package/dist/{chunk-EP6RVHMX.js → chunk-HZDEXTSL.js} +848 -2
  22. package/dist/chunk-HZDEXTSL.js.map +1 -0
  23. package/dist/{chunk-WIPGQ4GT.js → chunk-IMSNJSXH.js} +1 -1
  24. package/dist/{chunk-WIPGQ4GT.js.map → chunk-IMSNJSXH.js.map} +1 -1
  25. package/dist/{chunk-VSWBYWFK.js → chunk-M6MD6JBS.js} +20 -27
  26. package/dist/chunk-M6MD6JBS.js.map +1 -0
  27. package/dist/chunk-PSOCBNM3.js +2069 -0
  28. package/dist/chunk-PSOCBNM3.js.map +1 -0
  29. package/dist/{chunk-AEG3NGJ2.js → chunk-Q2JSAVQ3.js} +34 -2
  30. package/dist/chunk-Q2JSAVQ3.js.map +1 -0
  31. package/dist/{chunk-XP5KDM3R.js → chunk-SGQ4YIQW.js} +4 -4
  32. package/dist/{chunk-C3UKLQ54.js → chunk-UQ6PNNXM.js} +18 -10
  33. package/dist/chunk-UQ6PNNXM.js.map +1 -0
  34. package/dist/{chunk-33OG2NN3.js → chunk-WYC2XJF2.js} +2 -2
  35. package/dist/{chunk-ZEYAT33L.js → chunk-Y3SRWZMP.js} +2 -2
  36. package/dist/{chunk-CNH7DF7Z.js → chunk-YOLKCWRV.js} +1116 -591
  37. package/dist/chunk-YOLKCWRV.js.map +1 -0
  38. package/dist/{completion-gate-D1gX1-hg.d.ts → completion-gate-C80jiRfN.d.ts} +1 -1
  39. package/dist/conversation.d.ts +12 -1
  40. package/dist/conversation.js +2 -3
  41. package/dist/{coordination-Dr_axlAf.d.ts → coordination-BFE3Den7.d.ts} +10 -11
  42. package/dist/environment-provider.d.ts +2 -2
  43. package/dist/environment-provider.js +1 -2
  44. package/dist/{agentic-generator-DDMM45kZ.d.ts → improve-g75IE2Cx.d.ts} +152 -4
  45. package/dist/{improvement-adapter-BieWeK5J.d.ts → improvement-adapter-HAZz-7vK.d.ts} +8 -31
  46. package/dist/index.d.ts +55 -28
  47. package/dist/index.js +206 -82
  48. package/dist/index.js.map +1 -1
  49. package/dist/intelligence.d.ts +185 -120
  50. package/dist/intelligence.js +509 -345
  51. package/dist/intelligence.js.map +1 -1
  52. package/dist/knowledge.d.ts +40 -12
  53. package/dist/knowledge.js +13 -7
  54. package/dist/{loop-runner-bin-BRQSQdHa.d.ts → loop-runner-bin-Cn1N2rRo.d.ts} +3 -3
  55. package/dist/loop-runner-bin.d.ts +6 -6
  56. package/dist/loop-runner-bin.js +8 -10
  57. package/dist/loops.d.ts +13 -13
  58. package/dist/loops.js +6 -8
  59. package/dist/mcp/bin.js +5 -7
  60. package/dist/mcp/bin.js.map +1 -1
  61. package/dist/mcp/index.d.ts +6 -6
  62. package/dist/mcp/index.js +12 -14
  63. package/dist/mcp/index.js.map +1 -1
  64. package/dist/platform.js +0 -2
  65. package/dist/platform.js.map +1 -1
  66. package/dist/primeintellect/index.js +1 -2
  67. package/dist/primeintellect/index.js.map +1 -1
  68. package/dist/profile-DbfaMTdk.d.ts +233 -0
  69. package/dist/profiles.d.ts +1 -1
  70. package/dist/profiles.js +0 -1
  71. package/dist/profiles.js.map +1 -1
  72. package/dist/{supervise-DmYOug5f.d.ts → supervise-BLPI50-w.d.ts} +3 -3
  73. package/dist/{types-ByAYqlVb.d.ts → types-B3vAW0Oq.d.ts} +1 -1
  74. package/dist/{prepare-CtdtsFNG.d.ts → types-CWqfCO8s.d.ts} +67 -298
  75. package/dist/{types-BC3bZpH0.d.ts → types-CmYCMbFT.d.ts} +12 -54
  76. package/dist/{types-1d5QGK3t.d.ts → types-CmnA2iL3.d.ts} +3 -3
  77. package/dist/{worktree-fanout-CPprU-qI.d.ts → worktree-fanout-DCA3G4bO.d.ts} +3 -3
  78. package/package.json +14 -16
  79. package/skills/build-with-agent-runtime/SKILL.md +122 -213
  80. package/dist/chunk-6O73TRHW.js +0 -142
  81. package/dist/chunk-6O73TRHW.js.map +0 -1
  82. package/dist/chunk-AEG3NGJ2.js.map +0 -1
  83. package/dist/chunk-C3UKLQ54.js.map +0 -1
  84. package/dist/chunk-CNH7DF7Z.js.map +0 -1
  85. package/dist/chunk-D3H7F6L2.js +0 -626
  86. package/dist/chunk-D3H7F6L2.js.map +0 -1
  87. package/dist/chunk-DGUM43GV.js +0 -11
  88. package/dist/chunk-DGUM43GV.js.map +0 -1
  89. package/dist/chunk-EP6RVHMX.js.map +0 -1
  90. package/dist/chunk-HGRW27YY.js +0 -214
  91. package/dist/chunk-HGRW27YY.js.map +0 -1
  92. package/dist/chunk-ISTDY47H.js +0 -849
  93. package/dist/chunk-ISTDY47H.js.map +0 -1
  94. package/dist/chunk-PCURO3DL.js +0 -661
  95. package/dist/chunk-PCURO3DL.js.map +0 -1
  96. package/dist/chunk-QDSOD7RC.js.map +0 -1
  97. package/dist/chunk-TVJQAYQM.js.map +0 -1
  98. package/dist/chunk-VSWBYWFK.js.map +0 -1
  99. package/dist/chunk-VYA2YEKA.js.map +0 -1
  100. package/dist/generator-YkAQrOoD.d.ts +0 -382
  101. package/dist/improve-BN3HyXIO.d.ts +0 -172
  102. package/dist/lifecycle.d.ts +0 -870
  103. package/dist/lifecycle.js +0 -981
  104. package/dist/lifecycle.js.map +0 -1
  105. package/dist/mcp-serve-verifier-DQQDbuyz.d.ts +0 -34
  106. package/skills/agent-runtime-adoption/SKILL.md +0 -246
  107. /package/dist/{chunk-U33YZ7B2.js.map → chunk-FXF2OL34.js.map} +0 -0
  108. /package/dist/{chunk-XP5KDM3R.js.map → chunk-SGQ4YIQW.js.map} +0 -0
  109. /package/dist/{chunk-33OG2NN3.js.map → chunk-WYC2XJF2.js.map} +0 -0
  110. /package/dist/{chunk-ZEYAT33L.js.map → chunk-Y3SRWZMP.js.map} +0 -0
@@ -1,35 +1,40 @@
1
1
  import {
2
- applyImprovementWinnerToProfile,
3
- improve
4
- } from "./chunk-PCURO3DL.js";
2
+ AgentCandidateExperimentCellExecutionError,
3
+ buildAgentImprovementActivationTargets,
4
+ createAgentImprovementActivation,
5
+ createAgentImprovementActivationResult,
6
+ createAgentImprovementMeasuredComparison,
7
+ createAgentImprovementProposal,
8
+ executeAgentCandidateExperimentCell,
9
+ executeAgentImprovementActivation,
10
+ proposeAgentImprovement,
11
+ reviewAgentImprovementProposal,
12
+ runAgentCandidateExperiment,
13
+ verifyAgentImprovementActivation,
14
+ verifyAgentImprovementActivationResult,
15
+ verifyAgentImprovementProposal,
16
+ verifyAgentImprovementReview,
17
+ verifyCandidateExecutionEvidence
18
+ } from "./chunk-PSOCBNM3.js";
5
19
  import {
6
- assertCandidateProfileBinding,
7
- canonicalCandidateDigest,
8
- canonicalCandidateDocument,
9
- executePreparedAgentCandidate,
10
- immutableCandidateValue,
11
- omitTopLevelDigest,
12
- parseExactAgentProfile,
13
- prepareAgentCandidateExecution,
14
- sealAgentCandidateBundle,
15
- verifyAgentCandidateBundle
16
- } from "./chunk-CNH7DF7Z.js";
20
+ AGENT_CANDIDATE_EXECUTION_SUPPORT,
21
+ CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV,
22
+ CANDIDATE_KNOWLEDGE_ROOT_ENV,
23
+ candidateKnowledgeExecutionPaths,
24
+ canonicalCandidateBytes,
25
+ parseAgentCandidateProfileActivation
26
+ } from "./chunk-YOLKCWRV.js";
17
27
  import {
18
28
  buildLoopOtelSpans,
19
29
  buildRuntimeEventOtelSpans,
20
30
  createOtelExporter,
21
31
  flatOtelSpan
22
- } from "./chunk-ISTDY47H.js";
23
- import "./chunk-WIPGQ4GT.js";
32
+ } from "./chunk-HZDEXTSL.js";
33
+ import "./chunk-IMSNJSXH.js";
24
34
  import "./chunk-3MDZX7YU.js";
25
- import {
26
- runAnalystLoop
27
- } from "./chunk-QDSOD7RC.js";
35
+ import "./chunk-FD2MBMOH.js";
28
36
  import "./chunk-M22PL4GH.js";
29
- import "./chunk-D3H7F6L2.js";
30
- import "./chunk-EP6RVHMX.js";
31
37
  import "./chunk-YEJR7IXO.js";
32
- import "./chunk-DGUM43GV.js";
33
38
 
34
39
  // src/intelligence/index.ts
35
40
  import { contentHash } from "@tangle-network/agent-eval";
@@ -414,318 +419,6 @@ function isJsonSchema(v) {
414
419
  return typeof v === "object" && v !== null && !Array.isArray(v);
415
420
  }
416
421
 
417
- // src/intelligence/improvement-cycle.ts
418
- import { assertNoJudgeVerdict } from "@tangle-network/agent-eval/analyst";
419
- import { agentCandidateBundleSchema } from "@tangle-network/agent-interface";
420
- async function rethrowAfterImprovementDispose(cause, improvement) {
421
- const disposeErrors = [];
422
- for (let attempt = 0; attempt < 2; attempt += 1) {
423
- try {
424
- await improvement.dispose();
425
- } catch (disposeCause) {
426
- disposeErrors.push(disposeCause);
427
- continue;
428
- }
429
- if (disposeErrors.length === 0) throw cause;
430
- throw new AggregateError(
431
- [cause, ...disposeErrors],
432
- "proposeAgentImprovement failed; the improvement cleanup retry succeeded"
433
- );
434
- }
435
- throw new AggregateError(
436
- [cause, ...disposeErrors],
437
- "proposeAgentImprovement failed and its improvement resources could not be cleaned"
438
- );
439
- }
440
- async function proposeAgentImprovement(options) {
441
- const writeBackSurface = options.improvement.skills?.writeBack ? "skill" : options.improvement.memory?.writeBack ? "memory" : null;
442
- if (writeBackSurface) {
443
- throw new Error(
444
- `proposeAgentImprovement cannot write ${writeBackSurface} before human approval`
445
- );
446
- }
447
- const analysis = await runAnalystLoop({
448
- ...options.analysis,
449
- runId: options.runId
450
- });
451
- const findings = assertNoJudgeVerdict(
452
- analysis.analystResult.findings,
453
- "proposeAgentImprovement findings"
454
- );
455
- const improvement = await improve(options.profile, [...findings], options.improvement);
456
- try {
457
- const candidateBundle = improvement.shipped && options.buildCandidate ? await options.buildCandidate({ analysis, improvement }) : void 0;
458
- const proposal = createAgentImprovementProposal({
459
- runId: options.runId,
460
- surface: options.improvement.surface ?? "prompt",
461
- baselineProfile: options.profile,
462
- candidateProfile: improvement.profile,
463
- findings,
464
- evaluation: improvement.raw,
465
- ...candidateBundle ? { candidateBundle } : {},
466
- ...options.now ? { now: options.now } : {}
467
- });
468
- return { analysis, improvement, proposal };
469
- } catch (cause) {
470
- return rethrowAfterImprovementDispose(cause, improvement);
471
- }
472
- }
473
- function createAgentImprovementProposal(options) {
474
- const findings = assertNoJudgeVerdict(
475
- [...options.findings],
476
- "createAgentImprovementProposal findings"
477
- );
478
- const candidateBundle = options.candidateBundle ? sealBuiltCandidate(options.candidateBundle) : void 0;
479
- const baselineProfile = parseExactAgentProfile(
480
- options.baselineProfile,
481
- "proposal baseline profile"
482
- );
483
- const candidateProfile = parseExactAgentProfile(
484
- options.candidateProfile,
485
- "proposal candidate profile"
486
- );
487
- assertMeasuredProfileBinding({
488
- surface: options.surface,
489
- baselineProfile,
490
- candidateProfile,
491
- evaluation: options.evaluation,
492
- hasExecutableBundle: candidateBundle !== void 0
493
- });
494
- if (candidateBundle) {
495
- if (options.evaluation.gateDecision !== "ship") {
496
- throw new Error("executable candidate bundle requires a passing measured comparison");
497
- }
498
- assertCandidateProfileBinding(candidateProfile, candidateBundle.profile);
499
- }
500
- const withoutDigest = {
501
- schemaVersion: 1,
502
- kind: "agent-improvement-proposal",
503
- runId: options.runId,
504
- surface: options.surface,
505
- proposedAt: (options.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(),
506
- baselineProfile,
507
- baselineProfileHash: canonicalCandidateDigest(baselineProfile),
508
- candidateProfile,
509
- candidateProfileHash: canonicalCandidateDigest(candidateProfile),
510
- findings: canonicalJsonValue([...findings]),
511
- evaluation: canonicalJsonValue(improvementEvaluation(options.evaluation)),
512
- ...candidateBundle ? { candidateBundle } : {}
513
- };
514
- return canonicalCandidateDocument(withoutDigest).value;
515
- }
516
- function reviewAgentImprovementProposal(inputProposal, input) {
517
- const proposal = verifyAgentImprovementProposal(inputProposal);
518
- if (!input.reviewedBy.trim()) throw new Error("candidate review requires reviewedBy");
519
- if (!input.reason.trim()) throw new Error("candidate review requires a reason");
520
- if (input.decision === "approve") {
521
- if (proposal.evaluation.gateDecision !== "ship") {
522
- throw new Error("candidate cannot be approved without a passing measured comparison");
523
- }
524
- if (!proposal.candidateBundle) {
525
- throw new Error("candidate cannot be approved until an executable bundle is sealed");
526
- }
527
- }
528
- const withoutDigest = {
529
- schemaVersion: 1,
530
- kind: "agent-improvement-review",
531
- proposalDigest: proposal.digest,
532
- ...proposal.candidateBundle ? { candidateBundleDigest: proposal.candidateBundle.digest } : {},
533
- decision: input.decision,
534
- reviewedBy: input.reviewedBy,
535
- reviewedAt: (input.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(),
536
- reason: input.reason,
537
- ...input.feedback === void 0 ? {} : { feedback: input.feedback }
538
- };
539
- return canonicalCandidateDocument(withoutDigest).value;
540
- }
541
- async function executeApprovedAgentCandidate(options) {
542
- const proposal = verifyAgentImprovementProposal(options.proposal);
543
- const review = verifyAgentImprovementReview(options.review);
544
- if (review.decision !== "approve") throw new Error("candidate review is not an approval");
545
- if (review.proposalDigest !== proposal.digest) {
546
- throw new Error("candidate approval does not match the proposed improvement");
547
- }
548
- const bundle = proposal.candidateBundle;
549
- if (!bundle) throw new Error("approved proposal does not contain an executable candidate bundle");
550
- if (review.candidateBundleDigest !== bundle.digest) {
551
- throw new Error("candidate approval does not match the executable bundle");
552
- }
553
- if (!await options.authorizeReview(review, proposal)) {
554
- throw new Error("candidate approval was not authorized by the configured authority");
555
- }
556
- const verified = await verifyAgentCandidateBundle(bundle, options.ports);
557
- const prepared = await prepareAgentCandidateExecution(
558
- verified,
559
- options.task,
560
- options.ports,
561
- options.preparation
562
- );
563
- const finalization = await executePreparedAgentCandidate(prepared, options.execution);
564
- return {
565
- finalization,
566
- evidence: {
567
- proposalDigest: proposal.digest,
568
- reviewDigest: review.digest,
569
- bundleDigest: bundle.digest,
570
- executionId: prepared.executionId,
571
- executionPlanDigest: prepared.executionPlan.value.digest,
572
- materializationReceiptDigest: prepared.materializationReceipt.digest,
573
- succeeded: finalization.succeeded,
574
- ...finalization.succeeded ? { runReceiptDigest: finalization.receipt.digest } : {}
575
- }
576
- };
577
- }
578
- function verifyAgentImprovementProposal(input) {
579
- if (!isRecord(input) || input.kind !== "agent-improvement-proposal" || input.schemaVersion !== 1) {
580
- throw new Error("invalid agent improvement proposal");
581
- }
582
- const proposal = input;
583
- const parsedBaselineProfile = parseExactAgentProfile(
584
- proposal.baselineProfile,
585
- "proposal baseline profile"
586
- );
587
- if (proposal.baselineProfileHash !== canonicalCandidateDigest(parsedBaselineProfile)) {
588
- throw new Error("proposal baselineProfileHash does not match baselineProfile");
589
- }
590
- const parsedProfile = parseExactAgentProfile(
591
- proposal.candidateProfile,
592
- "proposal candidate profile"
593
- );
594
- if (proposal.candidateProfileHash !== canonicalCandidateDigest(parsedProfile)) {
595
- throw new Error("proposal candidateProfileHash does not match candidateProfile");
596
- }
597
- assertMeasuredProfileBinding({
598
- surface: proposal.surface,
599
- baselineProfile: parsedBaselineProfile,
600
- candidateProfile: parsedProfile,
601
- evaluation: proposal.evaluation,
602
- hasExecutableBundle: proposal.candidateBundle !== void 0
603
- });
604
- if (!Array.isArray(proposal.findings)) throw new Error("proposal findings must be an array");
605
- if (!isSha256Digest(proposal.digest)) throw new Error("proposal digest is invalid");
606
- if (proposal.candidateBundle) {
607
- const parsedBundle = agentCandidateBundleSchema.parse(proposal.candidateBundle);
608
- const sealed = sealAgentCandidateBundle(omitTopLevelDigest(parsedBundle));
609
- if (sealed.digest !== parsedBundle.digest)
610
- throw new Error("proposal candidate bundle digest is invalid");
611
- assertCandidateProfileBinding(parsedProfile, sealed.profile);
612
- }
613
- const actual = canonicalCandidateDigest(omitTopLevelDigest(proposal));
614
- if (actual !== proposal.digest)
615
- throw new Error("agent improvement proposal digest does not match");
616
- return immutableCandidateValue(proposal);
617
- }
618
- function assertMeasuredProfileBinding(input) {
619
- const baselineDigest = canonicalCandidateDigest(input.baselineProfile);
620
- if (input.evaluation.gateDecision !== "ship") {
621
- if (canonicalCandidateDigest(input.candidateProfile) !== baselineDigest) {
622
- throw new Error("non-shipping evaluation must retain the baseline candidate profile");
623
- }
624
- return;
625
- }
626
- const measured = measuredWinnerProfile(
627
- input.baselineProfile,
628
- input.surface,
629
- input.evaluation.winner.surface
630
- );
631
- if (!measured) {
632
- if (input.hasExecutableBundle) {
633
- throw new Error(
634
- `executable '${input.surface}' candidate cannot be bound to its measured winner surface`
635
- );
636
- }
637
- if (canonicalCandidateDigest(input.candidateProfile) !== baselineDigest) {
638
- throw new Error(
639
- `unbound '${input.surface}' improvement must retain the baseline candidate profile`
640
- );
641
- }
642
- return;
643
- }
644
- if (canonicalCandidateDigest(input.candidateProfile) !== canonicalCandidateDigest(measured)) {
645
- throw new Error("proposal candidate profile does not match the measured winner surface");
646
- }
647
- }
648
- function measuredWinnerProfile(baselineProfile, surface, winner) {
649
- if (surface === "code" || surface === "memory") return null;
650
- if (typeof winner !== "string") {
651
- throw new Error(`measured '${surface}' winner is not a serializable profile surface`);
652
- }
653
- if (surface !== "skills") {
654
- return applyImprovementWinnerToProfile(baselineProfile, surface, winner);
655
- }
656
- try {
657
- return applyImprovementWinnerToProfile(baselineProfile, surface, winner);
658
- } catch {
659
- return null;
660
- }
661
- }
662
- function sealBuiltCandidate(input) {
663
- if (!("digest" in input)) return sealAgentCandidateBundle(input);
664
- const parsed = agentCandidateBundleSchema.parse(input);
665
- const sealed = sealAgentCandidateBundle(omitTopLevelDigest(parsed));
666
- if (sealed.digest !== parsed.digest) {
667
- throw new Error("built candidate bundle digest is invalid");
668
- }
669
- return sealed;
670
- }
671
- function verifyAgentImprovementReview(input) {
672
- if (!isRecord(input) || input.kind !== "agent-improvement-review" || input.schemaVersion !== 1) {
673
- throw new Error("invalid agent improvement review");
674
- }
675
- const review = input;
676
- if (!isSha256Digest(review.digest) || !isSha256Digest(review.proposalDigest)) {
677
- throw new Error("candidate review digest is invalid");
678
- }
679
- if (review.candidateBundleDigest !== void 0 && !isSha256Digest(review.candidateBundleDigest)) {
680
- throw new Error("candidate review bundle digest is invalid");
681
- }
682
- if (!["approve", "reject", "request-changes"].includes(review.decision)) {
683
- throw new Error("candidate review decision is invalid");
684
- }
685
- const actual = canonicalCandidateDigest(omitTopLevelDigest(review));
686
- if (actual !== review.digest) throw new Error("agent improvement review digest does not match");
687
- return immutableCandidateValue(review);
688
- }
689
- function improvementEvaluation(result) {
690
- return {
691
- baseline: result.baseline,
692
- winner: result.winner,
693
- lift: result.lift,
694
- diff: result.diff,
695
- provenance: result.provenance,
696
- gateDecision: result.gateDecision,
697
- generationsExplored: result.generationsExplored,
698
- durationMs: result.durationMs,
699
- totalCostUsd: result.totalCostUsd,
700
- insight: result.insight,
701
- ...result.power === void 0 ? {} : { power: result.power }
702
- };
703
- }
704
- function isRecord(value) {
705
- return value !== null && typeof value === "object" && !Array.isArray(value);
706
- }
707
- function isSha256Digest(value) {
708
- return typeof value === "string" && /^sha256:[a-f0-9]{64}$/.test(value);
709
- }
710
- function canonicalJsonValue(value, path = "$") {
711
- if (value === null || typeof value === "string" || typeof value === "boolean") return value;
712
- if (typeof value === "number") {
713
- if (!Number.isFinite(value)) throw new Error(`non-finite number at ${path}`);
714
- return value;
715
- }
716
- if (Array.isArray(value)) {
717
- return value.map((entry, index) => {
718
- if (entry === void 0) throw new Error(`undefined array entry at ${path}[${index}]`);
719
- return canonicalJsonValue(entry, `${path}[${index}]`);
720
- });
721
- }
722
- if (typeof value === "object") {
723
- const entries = Object.entries(value).filter(([, entry]) => entry !== void 0).map(([key, entry]) => [key, canonicalJsonValue(entry, `${path}.${key}`)]);
724
- return Object.fromEntries(entries);
725
- }
726
- throw new Error(`unsupported proposal value at ${path}`);
727
- }
728
-
729
422
  // src/intelligence/resolver.ts
730
423
  function emptyAccumulator() {
731
424
  return {
@@ -1101,6 +794,467 @@ async function composeCertifiedProfileFromWire(base, profile, ctx = {}) {
1101
794
  return composeCertifiedProfile(base, manifestFromProfile(profile), ctx);
1102
795
  }
1103
796
 
797
+ // src/intelligence/sandbox-approved-candidate.ts
798
+ import { posix } from "path";
799
+ var sandboxCandidateExperimentExecutionSupport = Object.freeze({
800
+ outcomes: Object.freeze(["output"]),
801
+ outputMediaTypes: Object.freeze(["text/*", "application/json", "*+json"]),
802
+ code: Object.freeze(["disabled"]),
803
+ memory: Object.freeze(["disabled"]),
804
+ knowledge: true,
805
+ profile: AGENT_CANDIDATE_EXECUTION_SUPPORT.profile,
806
+ isolation: Object.freeze({
807
+ freshSandbox: true,
808
+ exactProcess: true,
809
+ egress: Object.freeze(["blocked", "strict"])
810
+ })
811
+ });
812
+ function createSandboxCandidateExperimentExecutor(options) {
813
+ const executor = new SandboxAgentCandidateExecutor(
814
+ options.client,
815
+ options.sandbox,
816
+ options.resultTimeoutMs
817
+ );
818
+ return Object.freeze({
819
+ executor,
820
+ async execute(input) {
821
+ return await executeAgentCandidateExperimentCell({
822
+ ...input,
823
+ attempt: input.attempt ?? 1,
824
+ executionId: input.executionId,
825
+ executionRoots: input.executionRoots,
826
+ stagingRoots: input.stagingRoots,
827
+ ports: options.ports,
828
+ ...input.preparation ? { preparation: input.preparation } : {},
829
+ execution: {
830
+ executor,
831
+ grader: options.grader,
832
+ outputArtifacts: options.outputArtifacts,
833
+ traceStore: options.traceStore,
834
+ claimStore: options.claimStore,
835
+ ...options.cleanupTimeoutMs === void 0 ? {} : { cleanupTimeoutMs: options.cleanupTimeoutMs },
836
+ ...options.resultTimeoutMs === void 0 ? {} : { resultTimeoutMs: options.resultTimeoutMs }
837
+ }
838
+ });
839
+ }
840
+ });
841
+ }
842
+ var SandboxAgentCandidateExecutor = class {
843
+ constructor(client, options = {}, captureTimeoutMs = 12e4) {
844
+ this.client = client;
845
+ this.options = options;
846
+ this.captureTimeoutMs = captureTimeoutMs;
847
+ }
848
+ client;
849
+ options;
850
+ captureTimeoutMs;
851
+ states = /* @__PURE__ */ new Map();
852
+ async execute(request, context) {
853
+ assertSupportedRequest(request);
854
+ const outcome = request.benchmark.task.outcome;
855
+ if (outcome.kind !== "output") throw new Error("sandbox executor requires an output task");
856
+ const key = executionKey(request.executionId, request.executionPlan.value.digest);
857
+ const sandbox = await this.client.create(sandboxCreateOptions(request, this.options), {
858
+ signal: context.signal,
859
+ timeoutMs: this.options.createTimeoutMs ?? 12e4
860
+ });
861
+ const state = { sandbox };
862
+ this.states.set(key, state);
863
+ if ((await sandbox.process.list()).length !== 0) {
864
+ throw new Error("fresh candidate sandbox already contains a process");
865
+ }
866
+ await materializeRequest(sandbox, request);
867
+ const launch = exactLaunch(request);
868
+ const startedAt = Date.now();
869
+ state.trace = {
870
+ runId: request.trace.runId,
871
+ scenarioId: request.benchmark.task.scenario.id,
872
+ startedAt,
873
+ deadlineAtMs: context.deadlineAtMs,
874
+ timeoutMs: request.hardLimits.timeoutMs,
875
+ tags: { ...request.trace.tags, sandboxId: sandbox.id },
876
+ written: false
877
+ };
878
+ const process2 = await sandbox.process.spawnExact(launch.executable, launch.args, {
879
+ cwd: request.launch.cwd,
880
+ env: { ...request.launch.env },
881
+ ...launch.stdin === void 0 ? {} : { stdin: launch.stdin },
882
+ timeoutMs: request.hardLimits.timeoutMs
883
+ });
884
+ const outputPromise = collectOutput(process2, outcome.maxBytes);
885
+ let cancellation;
886
+ let cancellationTermination;
887
+ let processExited = false;
888
+ const cancel = () => {
889
+ if (processExited) return;
890
+ cancellationTermination = Date.now() >= context.deadlineAtMs ? { kind: "timeout", timeoutMs: request.hardLimits.timeoutMs } : { kind: "cancelled" };
891
+ cancellation ??= killProcess(process2);
892
+ };
893
+ context.signal.addEventListener("abort", cancel, { once: true });
894
+ if (context.signal.aborted) cancel();
895
+ try {
896
+ const waitedExitCode = await process2.wait();
897
+ processExited = true;
898
+ context.signal.removeEventListener("abort", cancel);
899
+ if (cancellation) await cancellation;
900
+ const status = await process2.status();
901
+ if (status.running || status.exitCode !== waitedExitCode) {
902
+ throw new Error("sandbox process returned an inconsistent terminal status");
903
+ }
904
+ state.output = await awaitOutput(outputPromise, context.signal, context.deadlineAtMs);
905
+ state.termination = cancellationTermination ?? processTermination(status);
906
+ await appendSandboxTrace(state, context.traceStore, status);
907
+ return { executionId: request.executionId, termination: state.termination };
908
+ } finally {
909
+ context.signal.removeEventListener("abort", cancel);
910
+ void outputPromise.catch(() => void 0);
911
+ }
912
+ }
913
+ async stop(request, context) {
914
+ context.signal.throwIfAborted();
915
+ const sandbox = await this.resolve(request, true);
916
+ if (!sandbox) return { stopped: true };
917
+ const statuses = await sandbox.process.list();
918
+ if (statuses.length > 1) throw new Error("candidate sandbox contains more than one process");
919
+ const status = statuses[0];
920
+ if (status?.running) {
921
+ const process2 = await sandbox.process.get(status.pid);
922
+ if (!process2) throw new Error("candidate sandbox lost its running process handle");
923
+ await killProcess(process2);
924
+ }
925
+ context.signal.throwIfAborted();
926
+ const remaining = await sandbox.process.list();
927
+ if (remaining.some((entry) => entry.running)) {
928
+ throw new Error("candidate sandbox process termination is not proven");
929
+ }
930
+ const state = this.states.get(executionKey(request.executionId, request.executionPlanDigest));
931
+ if (state) {
932
+ if (context.reason === "timeout") {
933
+ state.termination = { kind: "timeout", timeoutMs: state.trace?.timeoutMs ?? 0 };
934
+ }
935
+ await appendSandboxTrace(state, context.traceStore, remaining[0]);
936
+ }
937
+ return { stopped: true };
938
+ }
939
+ async capture(request, context) {
940
+ context.signal.throwIfAborted();
941
+ const sandbox = await this.resolve(request, false);
942
+ const statuses = await sandbox.process.list();
943
+ if (statuses.length > 1 || statuses.some((entry) => entry.running)) {
944
+ throw new Error("candidate sandbox must contain one stopped process before capture");
945
+ }
946
+ const state = this.states.get(executionKey(request.executionId, request.executionPlanDigest));
947
+ let output = state?.output;
948
+ let termination = state?.termination;
949
+ const status = statuses[0];
950
+ if (status && !output) {
951
+ const process2 = await sandbox.process.get(status.pid);
952
+ if (!process2) throw new Error("candidate sandbox lost its captured process handle");
953
+ const expected = sandboxOutputSpec(sandbox);
954
+ output = await awaitOutput(
955
+ collectOutput(process2, expected.maxBytes),
956
+ context.signal,
957
+ Date.now() + this.captureTimeoutMs
958
+ );
959
+ }
960
+ if (status && !termination) {
961
+ termination = processTermination(status);
962
+ }
963
+ context.signal.throwIfAborted();
964
+ const evidence = canonicalCandidateBytes({
965
+ kind: "sandbox-agent-candidate-capture",
966
+ sandboxId: sandbox.id,
967
+ executionId: request.executionId,
968
+ executionPlanDigest: request.executionPlanDigest,
969
+ ...status ? {
970
+ process: {
971
+ pid: status.pid,
972
+ exitCode: status.exitCode,
973
+ ...status.exitSignal ? { exitSignal: status.exitSignal } : {}
974
+ }
975
+ } : {},
976
+ ...termination ? { termination } : {}
977
+ });
978
+ return {
979
+ ...output ? { taskOutcome: { kind: "output", bytes: output } } : {},
980
+ evidence
981
+ };
982
+ }
983
+ async dispose(request, context) {
984
+ context.signal.throwIfAborted();
985
+ const sandbox = await this.resolve(request, true);
986
+ if (!sandbox) return { disposed: true };
987
+ try {
988
+ await sandbox.delete();
989
+ } catch (error) {
990
+ if (await this.client.get(sandbox.id)) throw error;
991
+ }
992
+ context.signal.throwIfAborted();
993
+ this.states.delete(executionKey(request.executionId, request.executionPlanDigest));
994
+ return { disposed: true };
995
+ }
996
+ async resolve(request, missingIsDeleted) {
997
+ const key = executionKey(request.executionId, request.executionPlanDigest);
998
+ const active = this.states.get(key)?.sandbox;
999
+ if (active) return active;
1000
+ const matches = [];
1001
+ const scope = this.options.teamId ? `team:${this.options.teamId}` : "personal";
1002
+ for (let offset = 0; ; offset += 100) {
1003
+ const page = await this.client.list({ scope, limit: 100, offset });
1004
+ for (const candidate of page) {
1005
+ if (matchesExecution(candidate, request)) matches.push(candidate);
1006
+ }
1007
+ if (page.length < 100) break;
1008
+ }
1009
+ if (matches.length === 1) return matches[0];
1010
+ if (matches.length > 1) throw new Error("multiple sandboxes match one candidate execution");
1011
+ if (missingIsDeleted) return void 0;
1012
+ throw new Error("candidate sandbox evidence is unavailable");
1013
+ }
1014
+ };
1015
+ async function appendSandboxTrace(state, traceStore, status) {
1016
+ const trace = state.trace;
1017
+ if (!trace || trace.written) return;
1018
+ const endedAt = Math.max(trace.startedAt, Math.min(Date.now(), trace.deadlineAtMs));
1019
+ await traceStore.appendRun({
1020
+ runId: trace.runId,
1021
+ scenarioId: trace.scenarioId,
1022
+ startedAt: trace.startedAt,
1023
+ endedAt,
1024
+ status: state.termination?.kind !== "timeout" && status?.running === false && status.exitCode === 0 ? "completed" : "failed",
1025
+ tags: trace.tags
1026
+ });
1027
+ trace.written = true;
1028
+ }
1029
+ function assertSupportedRequest(request) {
1030
+ if (request.benchmark.task.outcome.kind !== "output") {
1031
+ throw new Error("sandbox candidate executor does not support workspace outcomes; use Pier");
1032
+ }
1033
+ if (request.executionPlan.value.material.codeKind !== "disabled" || request.inputs.candidate) {
1034
+ throw new Error("sandbox candidate executor does not support code workspaces; use Pier");
1035
+ }
1036
+ if (request.memory.mode !== "disabled") {
1037
+ throw new Error("sandbox candidate executor does not support isolated memory");
1038
+ }
1039
+ const mediaType = request.benchmark.task.outcome.mediaType.toLowerCase();
1040
+ if (!(mediaType.startsWith("text/") || mediaType === "application/json" || mediaType.endsWith("+json"))) {
1041
+ throw new Error("sandbox candidate executor supports only UTF-8 text and JSON outputs");
1042
+ }
1043
+ }
1044
+ function sandboxCreateOptions(request, options = {}) {
1045
+ const material = request.executionPlan.value.material;
1046
+ const retentionSeconds = options.evidenceRetentionSeconds ?? 900;
1047
+ if (!Number.isSafeInteger(retentionSeconds) || retentionSeconds < 60) {
1048
+ throw new Error("sandbox evidence retention must be at least 60 seconds");
1049
+ }
1050
+ const maxLifetimeSeconds = Math.ceil(request.hardLimits.timeoutMs / 1e3) + retentionSeconds;
1051
+ const network = material.model.access.network;
1052
+ const egressPolicy = network.mode === "disabled" ? { mode: "blocked" } : {
1053
+ mode: "strict",
1054
+ allowDomains: [...network.domains],
1055
+ includeImplicitDomains: false
1056
+ };
1057
+ const value = {
1058
+ image: exactImage(material.container.image, material.container.manifestDigest),
1059
+ bare: true,
1060
+ publicEdge: false,
1061
+ ephemeral: true,
1062
+ sshEnabled: false,
1063
+ webTerminalEnabled: false,
1064
+ secrets: [],
1065
+ capabilities: [],
1066
+ egressPolicy,
1067
+ maxLifetimeSeconds,
1068
+ idempotencyKey: `candidate-${request.executionPlan.value.digest.slice("sha256:".length)}`,
1069
+ metadata: {
1070
+ kind: "agent-candidate-execution",
1071
+ executionId: request.executionId,
1072
+ executionPlanDigest: request.executionPlan.value.digest,
1073
+ outputMediaType: request.benchmark.task.outcome.kind === "output" ? request.benchmark.task.outcome.mediaType : "",
1074
+ outputMaxBytes: request.benchmark.task.outcome.kind === "output" ? request.benchmark.task.outcome.maxBytes : 0
1075
+ },
1076
+ ...options.teamId ? { teamId: options.teamId } : {},
1077
+ ...options.resources ? { resources: options.resources } : {}
1078
+ };
1079
+ return value;
1080
+ }
1081
+ async function materializeRequest(sandbox, request) {
1082
+ const knowledgePaths = assertKnowledgeExecutionBinding(request);
1083
+ for (const file of request.inputs.task.files) {
1084
+ await writeExactFile(sandbox, beneath(request.roots.taskRoot, file.path), file.bytes, file.mode);
1085
+ }
1086
+ const profileRoot = request.executionPlan.value.material.profile.targetWorkspace === "task" ? request.roots.taskRoot : request.roots.candidateRoot;
1087
+ if (!profileRoot) throw new Error("candidate profile targets a missing workspace");
1088
+ for (const file of request.profileActivation.files) {
1089
+ await writeExactFile(
1090
+ sandbox,
1091
+ beneath(profileRoot, file.path),
1092
+ Buffer.from(file.content, "utf8"),
1093
+ file.mode
1094
+ );
1095
+ }
1096
+ if (request.knowledge && knowledgePaths) {
1097
+ for (const file of request.knowledge.files) {
1098
+ await writeExactFile(sandbox, beneath(knowledgePaths.root, file.path), file.bytes, file.mode);
1099
+ }
1100
+ if (request.knowledge.retrievalConfig && knowledgePaths.retrievalConfig) {
1101
+ await writeExactFile(
1102
+ sandbox,
1103
+ knowledgePaths.retrievalConfig,
1104
+ request.knowledge.retrievalConfig,
1105
+ 420
1106
+ );
1107
+ }
1108
+ }
1109
+ if (request.instruction.delivery.kind === "utf8-file") {
1110
+ await writeExactFile(
1111
+ sandbox,
1112
+ request.instruction.delivery.path,
1113
+ request.instruction.bytes,
1114
+ 420
1115
+ );
1116
+ }
1117
+ }
1118
+ function assertKnowledgeExecutionBinding(request) {
1119
+ const knowledge = request.knowledge;
1120
+ if (!knowledge) {
1121
+ if (request.launch.env[CANDIDATE_KNOWLEDGE_ROOT_ENV] !== void 0 || request.launch.env[CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV] !== void 0) {
1122
+ throw new Error("candidate launch declares knowledge paths without verified knowledge");
1123
+ }
1124
+ return void 0;
1125
+ }
1126
+ const paths = candidateKnowledgeExecutionPaths(
1127
+ request.roots.taskRoot,
1128
+ knowledge.retrievalConfig !== void 0
1129
+ );
1130
+ if (request.launch.env[CANDIDATE_KNOWLEDGE_ROOT_ENV] !== paths.root || request.launch.env[CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV] !== paths.retrievalConfig) {
1131
+ throw new Error("candidate knowledge paths do not match the signed launch environment");
1132
+ }
1133
+ const reserved = [paths.root, paths.retrievalConfig].filter(
1134
+ (value) => value !== void 0
1135
+ );
1136
+ const profileRoot = request.executionPlan.value.material.profile.targetWorkspace === "task" ? request.roots.taskRoot : request.roots.candidateRoot;
1137
+ const otherFiles = [
1138
+ ...request.inputs.task.files.map((file) => beneath(request.roots.taskRoot, file.path)),
1139
+ ...profileRoot ? request.profileActivation.files.map((file) => beneath(profileRoot, file.path)) : [],
1140
+ ...request.instruction.delivery.kind === "utf8-file" ? [request.instruction.delivery.path] : []
1141
+ ];
1142
+ if (otherFiles.some(
1143
+ (path) => reserved.some(
1144
+ (reservedPath) => path === reservedPath || path.startsWith(`${reservedPath}/`) || reservedPath.startsWith(`${path}/`)
1145
+ )
1146
+ )) {
1147
+ throw new Error("candidate knowledge paths overlap other execution inputs");
1148
+ }
1149
+ return paths;
1150
+ }
1151
+ function exactLaunch(request) {
1152
+ const instruction = new TextDecoder("utf-8", { fatal: true }).decode(request.instruction.bytes);
1153
+ switch (request.instruction.delivery.kind) {
1154
+ case "argv-append":
1155
+ return { executable: request.launch.executable, args: [...request.launch.args, instruction] };
1156
+ case "stdin-utf8":
1157
+ return {
1158
+ executable: request.launch.executable,
1159
+ args: request.launch.args,
1160
+ stdin: instruction
1161
+ };
1162
+ case "utf8-file":
1163
+ return { executable: request.launch.executable, args: request.launch.args };
1164
+ }
1165
+ }
1166
+ async function writeExactFile(sandbox, path, bytes, mode) {
1167
+ await sandbox.fs.write(path, Buffer.from(bytes).toString("base64"), {
1168
+ encoding: "base64",
1169
+ mode
1170
+ });
1171
+ }
1172
+ async function collectOutput(process2, maxBytes) {
1173
+ const chunks = [];
1174
+ let byteLength = 0;
1175
+ for await (const chunk of process2.stdout()) {
1176
+ const bytes = Buffer.from(chunk, "utf8");
1177
+ byteLength += bytes.byteLength;
1178
+ if (byteLength > maxBytes) {
1179
+ await killProcess(process2);
1180
+ throw new Error(`sandbox candidate output exceeds its ${maxBytes}-byte maximum`);
1181
+ }
1182
+ chunks.push(bytes);
1183
+ }
1184
+ return Uint8Array.from(Buffer.concat(chunks, byteLength));
1185
+ }
1186
+ async function awaitOutput(output, signal, deadlineAtMs) {
1187
+ signal.throwIfAborted();
1188
+ const remainingMs = deadlineAtMs - Date.now();
1189
+ if (remainingMs <= 0) throw new Error("sandbox candidate output deadline expired");
1190
+ let timer;
1191
+ let onAbort;
1192
+ try {
1193
+ return await Promise.race([
1194
+ output,
1195
+ new Promise((_resolve, reject) => {
1196
+ onAbort = () => reject(signal.reason ?? new Error("sandbox candidate output cancelled"));
1197
+ signal.addEventListener("abort", onAbort, { once: true });
1198
+ timer = setTimeout(
1199
+ () => reject(new Error("sandbox candidate output deadline expired")),
1200
+ remainingMs
1201
+ );
1202
+ })
1203
+ ]);
1204
+ } finally {
1205
+ if (onAbort) signal.removeEventListener("abort", onAbort);
1206
+ if (timer) clearTimeout(timer);
1207
+ }
1208
+ }
1209
+ async function killProcess(process2) {
1210
+ const before = await process2.status();
1211
+ if (!before.running) return;
1212
+ try {
1213
+ await process2.kill("SIGKILL", { tree: true });
1214
+ } catch (error) {
1215
+ if ((await process2.status()).running) throw error;
1216
+ }
1217
+ }
1218
+ function processTermination(status) {
1219
+ if (status.running) throw new Error("candidate process is still running");
1220
+ if (status.exitSignal) {
1221
+ if (!/^SIG[A-Z0-9]+$/.test(status.exitSignal)) {
1222
+ throw new Error("sandbox returned an invalid process signal");
1223
+ }
1224
+ return { kind: "signal", signal: status.exitSignal };
1225
+ }
1226
+ return { kind: "exit", exitCode: status.exitCode };
1227
+ }
1228
+ function matchesExecution(sandbox, request) {
1229
+ return sandbox.metadata?.kind === "agent-candidate-execution" && sandbox.metadata.executionId === request.executionId && sandbox.metadata.executionPlanDigest === request.executionPlanDigest;
1230
+ }
1231
+ function sandboxOutputSpec(sandbox) {
1232
+ const maxBytes = sandbox.metadata?.outputMaxBytes;
1233
+ if (!Number.isSafeInteger(maxBytes) || Number(maxBytes) < 1) {
1234
+ throw new Error("candidate sandbox output bound is unavailable");
1235
+ }
1236
+ return { maxBytes: Number(maxBytes) };
1237
+ }
1238
+ function executionKey(executionId, executionPlanDigest) {
1239
+ return `${executionId}\0${executionPlanDigest}`;
1240
+ }
1241
+ function exactImage(image, manifestDigest) {
1242
+ const marker = image.lastIndexOf("@");
1243
+ if (marker < 0) return `${image}@${manifestDigest}`;
1244
+ if (image.slice(marker + 1) !== manifestDigest) {
1245
+ throw new Error("candidate container image conflicts with its resolved manifest");
1246
+ }
1247
+ return image;
1248
+ }
1249
+ function beneath(root, relativePath) {
1250
+ if (posix.isAbsolute(relativePath)) throw new Error("candidate input path must be relative");
1251
+ const path = posix.normalize(relativePath);
1252
+ if (path === ".." || path.startsWith("../")) {
1253
+ throw new Error("candidate input path escapes its execution root");
1254
+ }
1255
+ return posix.join(root, path);
1256
+ }
1257
+
1104
1258
  // src/intelligence/with-intelligence.ts
1105
1259
  import { applyAgentProfileDiff } from "@tangle-network/agent-interface";
1106
1260
  function summarizeRuntimeEvents(events) {
@@ -1373,16 +1527,13 @@ function createIntelligenceClient(config) {
1373
1527
  } : {},
1374
1528
  ...record.runtimeEvents ? { "tangle.runtime.event_count": record.runtimeEvents.length } : {},
1375
1529
  ...record.candidateExecution ? {
1376
- "tangle.candidate.proposal_digest": record.candidateExecution.proposalDigest,
1377
- "tangle.candidate.review_digest": record.candidateExecution.reviewDigest,
1378
- "tangle.candidate.bundle_digest": record.candidateExecution.bundleDigest,
1379
- "tangle.candidate.execution_id": record.candidateExecution.executionId,
1380
- "tangle.candidate.execution_plan_digest": record.candidateExecution.executionPlanDigest,
1381
- "tangle.candidate.materialization_receipt_digest": record.candidateExecution.materializationReceiptDigest,
1382
- "tangle.candidate.succeeded": record.candidateExecution.succeeded,
1383
- ...record.candidateExecution.runReceiptDigest ? {
1384
- "tangle.candidate.run_receipt_digest": record.candidateExecution.runReceiptDigest
1385
- } : {}
1530
+ "tangle.candidate.bundle_digest": record.candidateExecution.receipt.bundleDigest,
1531
+ "tangle.candidate.experiment_digest": record.candidateExecution.materializationReceipt.executionPlan.material.runCell.experimentDigest,
1532
+ "tangle.candidate.execution_id": record.candidateExecution.materializationReceipt.executionPlan.material.executionId,
1533
+ "tangle.candidate.execution_plan_digest": record.candidateExecution.receipt.executionPlanDigest,
1534
+ "tangle.candidate.materialization_receipt_digest": record.candidateExecution.receipt.materializationReceiptDigest,
1535
+ "tangle.candidate.succeeded": record.candidateExecution.receipt.termination.kind === "exit" && record.candidateExecution.receipt.termination.exitCode === 0 && record.candidateExecution.receipt.benchmarkResult.material.passed,
1536
+ "tangle.candidate.run_receipt_digest": record.candidateExecution.receipt.digest
1386
1537
  } : {}
1387
1538
  };
1388
1539
  if (record.profile) {
@@ -1532,28 +1683,41 @@ function createIntelligenceClient(config) {
1532
1683
  };
1533
1684
  }
1534
1685
  export {
1686
+ AgentCandidateExperimentCellExecutionError,
1535
1687
  CapabilityNotAdmittedError,
1688
+ buildAgentImprovementActivationTargets,
1536
1689
  compileEffort,
1537
1690
  composeCertifiedProfile,
1538
1691
  composeCertifiedProfileFromWire,
1539
1692
  composeCertifiedPrompt,
1693
+ createAgentImprovementActivation,
1694
+ createAgentImprovementActivationResult,
1695
+ createAgentImprovementMeasuredComparison,
1540
1696
  createAgentImprovementProposal,
1541
1697
  createCertifiedPromptSource,
1542
1698
  createIntelligenceClient,
1699
+ createSandboxCandidateExperimentExecutor,
1543
1700
  defaultEffortTier,
1544
1701
  defaultRedactor,
1545
- executeApprovedAgentCandidate,
1702
+ executeAgentCandidateExperimentCell,
1703
+ executeAgentImprovementActivation,
1546
1704
  isIntelligenceOff,
1547
1705
  manifestFromProfile,
1548
1706
  normalizeCertifiedProfile,
1707
+ parseAgentCandidateProfileActivation as parseCandidateProfileMaterialization,
1549
1708
  proposeAgentImprovement,
1550
1709
  pullCertified,
1551
1710
  resolveEffort,
1552
1711
  resolveIntelligenceBaseUrl,
1553
1712
  resolveRedactor,
1554
1713
  reviewAgentImprovementProposal,
1714
+ runAgentCandidateExperiment,
1715
+ sandboxCandidateExperimentExecutionSupport,
1716
+ verifyAgentImprovementActivation,
1717
+ verifyAgentImprovementActivationResult,
1555
1718
  verifyAgentImprovementProposal,
1556
1719
  verifyAgentImprovementReview,
1720
+ verifyCandidateExecutionEvidence,
1557
1721
  withIntelligence
1558
1722
  };
1559
1723
  //# sourceMappingURL=intelligence.js.map