@tangle-network/agent-runtime 0.116.0 → 0.119.0

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 (95) hide show
  1. package/README.md +9 -1
  2. package/dist/{activation-DuqQhee6.js → activation-DdIpwQ0k.js} +3 -3
  3. package/dist/{activation-DuqQhee6.js.map → activation-DdIpwQ0k.js.map} +1 -1
  4. package/dist/agent.d.ts +3 -64
  5. package/dist/agent.js +5 -207
  6. package/dist/agent.js.map +1 -1
  7. package/dist/{analyst-loop-BoNIG2hA.js → analyst-loop-DvSciOfB.js} +2 -2
  8. package/dist/{analyst-loop-BoNIG2hA.js.map → analyst-loop-DvSciOfB.js.map} +1 -1
  9. package/dist/analyst-loop.js +1 -1
  10. package/dist/candidate-execution/index.d.ts +3 -3
  11. package/dist/candidate-execution/index.js +5 -5
  12. package/dist/{candidate-execution-CfpJrd3o.js → candidate-execution-DDkSRPjY.js} +4 -4
  13. package/dist/{candidate-execution-CfpJrd3o.js.map → candidate-execution-DDkSRPjY.js.map} +1 -1
  14. package/dist/{environment-provider-CWsRh6Uz.d.ts → environment-provider-Bh4nX2qt.d.ts} +306 -32
  15. package/dist/{environment-provider-CCaEhA-l.js → environment-provider-Cr75N-rU.js} +141 -32
  16. package/dist/environment-provider-Cr75N-rU.js.map +1 -0
  17. package/dist/environment-provider.d.ts +1 -1
  18. package/dist/environment-provider.js +1 -1
  19. package/dist/{improvement-cycle-C1cmjvPD.js → improvement-cycle-zjR-MXwK.js} +163 -22
  20. package/dist/improvement-cycle-zjR-MXwK.js.map +1 -0
  21. package/dist/{index-C-FYUuFG.d.ts → index-B3bHsVLw.d.ts} +2 -2
  22. package/dist/{index-CYkDeM5L.d.ts → index-BLsKcxNd.d.ts} +3 -3
  23. package/dist/{index-COumPQka.d.ts → index-CGADWaa_.d.ts} +864 -437
  24. package/dist/{index-DcLMNnG5.d.ts → index-I35151Fr.d.ts} +9 -9
  25. package/dist/index.d.ts +9 -9
  26. package/dist/index.js +13 -13
  27. package/dist/index.js.map +1 -1
  28. package/dist/intelligence.d.ts +10 -9
  29. package/dist/intelligence.js +15 -9
  30. package/dist/intelligence.js.map +1 -1
  31. package/dist/kernel.d.ts +4 -4
  32. package/dist/kernel.js +9 -8
  33. package/dist/{knowledge-DOzbywZT.js → knowledge-I1e9zQGj.js} +7 -7
  34. package/dist/knowledge-I1e9zQGj.js.map +1 -0
  35. package/dist/knowledge.d.ts +1 -1
  36. package/dist/knowledge.js +1 -1
  37. package/dist/{local-harness-t6cDWDQ2.d.ts → local-harness-BIajef4A.d.ts} +29 -7
  38. package/dist/{loop-runner-bin-BFrhPLKt.d.ts → loop-runner-bin-BeG9vTdE.d.ts} +3 -3
  39. package/dist/{loop-runner-bin-BuQjc5DR.js → loop-runner-bin-L996YVPS.js} +4 -4
  40. package/dist/{loop-runner-bin-BuQjc5DR.js.map → loop-runner-bin-L996YVPS.js.map} +1 -1
  41. package/dist/loop-runner-bin.d.ts +1 -1
  42. package/dist/loop-runner-bin.js +1 -1
  43. package/dist/mcp/bin.js +43 -10
  44. package/dist/mcp/bin.js.map +1 -1
  45. package/dist/mcp/index.d.ts +5 -45
  46. package/dist/mcp/index.js +8 -212
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/{openai-tools-_Wyp4udO.js → openai-tools-CvFEzw6f.js} +2 -2
  49. package/dist/{openai-tools-_Wyp4udO.js.map → openai-tools-CvFEzw6f.js.map} +1 -1
  50. package/dist/{prepare-BHQBb02e.js → prepare-DpV6np9e.js} +47 -34
  51. package/dist/prepare-DpV6np9e.js.map +1 -0
  52. package/dist/primeintellect/index.d.ts +1 -1
  53. package/dist/{protected-model-port-BP6Z4eau.d.ts → protected-model-port-CoJOiINX.d.ts} +11 -3
  54. package/dist/{protected-model-port-DqAH1Z2M.js → protected-model-port-vQLBRoAQ.js} +2 -2
  55. package/dist/{protected-model-port-DqAH1Z2M.js.map → protected-model-port-vQLBRoAQ.js.map} +1 -1
  56. package/dist/{redact-BEtQtvd6.d.ts → redact-PQzmE1Jn.d.ts} +4 -4
  57. package/dist/run-layout-C2FGmZ3v.js +158 -0
  58. package/dist/run-layout-C2FGmZ3v.js.map +1 -0
  59. package/dist/{runtime-Ut1pkd2n.js → runtime-D4e3GP5K.js} +147 -190
  60. package/dist/runtime-D4e3GP5K.js.map +1 -0
  61. package/dist/{sandbox-events-DeI5xX8P.js → sandbox-events-Yhd1GYWl.js} +4 -2
  62. package/dist/sandbox-events-Yhd1GYWl.js.map +1 -0
  63. package/dist/spawn-journal-IeXpidO2.js +857 -0
  64. package/dist/spawn-journal-IeXpidO2.js.map +1 -0
  65. package/dist/{structural-rollout-CVY_0hJp.js → structural-rollout-DQHO3b2Y.js} +4 -4
  66. package/dist/structural-rollout-DQHO3b2Y.js.map +1 -0
  67. package/dist/{supervise-BUR9ByF7.js → supervise-Cq50UT5-.js} +2874 -1892
  68. package/dist/supervise-Cq50UT5-.js.map +1 -0
  69. package/dist/{supervisor-BBbPBXpe.js → supervisor-CpT9yAxL.js} +2896 -983
  70. package/dist/supervisor-CpT9yAxL.js.map +1 -0
  71. package/dist/testing.js +98 -76
  72. package/dist/testing.js.map +1 -1
  73. package/dist/top-app-5unxqovu.js +1088 -0
  74. package/dist/top-app-5unxqovu.js.map +1 -0
  75. package/dist/tui/bin.d.ts +1 -0
  76. package/dist/tui/bin.js +19 -0
  77. package/dist/tui/bin.js.map +1 -0
  78. package/dist/tui/index.d.ts +209 -0
  79. package/dist/tui/index.js +2 -0
  80. package/dist/{util-Cc9g9Y-o.js → util-MVgdwuIS.js} +2 -2
  81. package/dist/{util-Cc9g9Y-o.js.map → util-MVgdwuIS.js.map} +1 -1
  82. package/dist/{workspace-archive-DXzJq7WP.js → workspace-archive-B4SkNJjw.js} +2 -2
  83. package/dist/{workspace-archive-DXzJq7WP.js.map → workspace-archive-B4SkNJjw.js.map} +1 -1
  84. package/package.json +8 -2
  85. package/dist/environment-provider-CCaEhA-l.js.map +0 -1
  86. package/dist/improvement-cycle-C1cmjvPD.js.map +0 -1
  87. package/dist/knowledge-DOzbywZT.js.map +0 -1
  88. package/dist/prepare-BHQBb02e.js.map +0 -1
  89. package/dist/runtime-Ut1pkd2n.js.map +0 -1
  90. package/dist/sandbox-events-DeI5xX8P.js.map +0 -1
  91. package/dist/spawn-journal-DCPbicXB.js +0 -457
  92. package/dist/spawn-journal-DCPbicXB.js.map +0 -1
  93. package/dist/structural-rollout-CVY_0hJp.js.map +0 -1
  94. package/dist/supervise-BUR9ByF7.js.map +0 -1
  95. package/dist/supervisor-BBbPBXpe.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as contentAddress } from "./spawn-journal-DCPbicXB.js";
1
+ import { x as contentAddress } from "./spawn-journal-IeXpidO2.js";
2
2
  import { i as redactProtectedValue, n as createProtectedRecordRedactor, r as redactProtectedReason, t as assertNoProtectedBytes } from "./protected-redaction--F3v1oo8.js";
3
3
  import { REDACTION_VERSION, canonicalJson, isLlmSpan } from "@tangle-network/agent-eval";
4
4
  import { agentCandidateArtifactRefSchema, agentCandidateBenchmarkResultEvidenceSchema, agentCandidateBenchmarkSuiteSchema, agentCandidateBenchmarkTaskSchema, agentCandidateBundleSchema, agentCandidateContainerSchema, agentCandidateExecutionLimitsSchema, agentCandidateExecutionPlanEvidenceSchema, agentCandidateExecutionPlanMaterialSchema, agentCandidateMaterializationReceiptSchema, agentCandidateModelAccessNetworkSchema, agentCandidateModelSettlementEvidenceSchema, agentCandidateProfileActivationSchema, agentCandidateProfilePlanEvidenceSchema, agentCandidateProfileSchema, agentCandidateResolvedModelSchema, agentCandidateRunCellSchema, agentCandidateRunReceiptSchema, agentCandidateTaskOutcomeEvidenceSchema, agentCandidateTaskOutcomeSpecSchema, agentCandidateTerminationSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, agentProfileDiffSchema, agentProfileSchema, applyAgentProfileDiff, sha256DigestSchema } from "@tangle-network/agent-interface";
@@ -177,6 +177,7 @@ function parseExactAgentProfileDiff(input, label) {
177
177
  function applyExactAgentProfileDiff(baseInput, diffInput, label) {
178
178
  return parseExactAgentProfile(omitUndefinedObjectFields(applyAgentProfileDiff(parseExactAgentProfile(baseInput, `${label} base profile`), parseExactAgentProfileDiff(diffInput, `${label} diff`)), label), `${label} result`);
179
179
  }
180
+ /** Parse a candidate profile without silently discarding unsupported or non-canonical fields. */
180
181
  function parseExactCandidateProfile(input) {
181
182
  const parsed = agentCandidateProfileSchema.parse(input);
182
183
  assertCanonicalParse(input, parsed, "candidate profile");
@@ -192,6 +193,7 @@ function assertCandidateProfileExecutionSupport(profile) {
192
193
  ].filter((field) => hasEntries(profile[field]));
193
194
  if (unsupported.length > 0) throw new Error(`candidate execution cannot prove in-session effects for non-empty AgentProfile fields: ${unsupported.join(", ")}`);
194
195
  }
196
+ /** Convert the candidate profile contract into the portable interface profile it represents. */
195
197
  function agentCandidateProfileAsAgentProfile(candidate) {
196
198
  const output = {};
197
199
  copyDirectProfileFields(output, candidate);
@@ -225,6 +227,7 @@ function agentCandidateProfileAsAgentProfile(candidate) {
225
227
  }
226
228
  return output;
227
229
  }
230
+ /** Recursively remove undefined object fields while refusing undefined array entries. */
228
231
  function omitUndefinedObjectFields(value, path) {
229
232
  if (Array.isArray(value)) return value.map((entry, index) => {
230
233
  if (entry === void 0) throw new Error(`${path} produced an undefined array entry at ${index}`);
@@ -3733,33 +3736,55 @@ var CandidateExecutionDeadlineError = class extends Error {
3733
3736
  };
3734
3737
  //#endregion
3735
3738
  //#region src/candidate-execution/system-prompt.ts
3736
- const NATIVE_EXECUTABLES = {
3737
- "claude-code": "claude",
3738
- codex: "codex",
3739
- opencode: "opencode",
3740
- pi: "pi"
3741
- };
3742
3739
  const SYSTEM_PROMPT_FILE = ".tangle/system-prompt.md";
3740
+ const SYSTEM_PROMPT_FLAGS = ["--system-prompt", "--system-prompt-file"];
3741
+ /** Shared by the harnesses whose native control IS a `--system-prompt*` flag. */
3742
+ function argsSetSystemPromptFlag(values) {
3743
+ return values.some((value) => SYSTEM_PROMPT_FLAGS.some((flag) => value === flag || value.startsWith(`${flag}=`)));
3744
+ }
3745
+ function argsSetCodexDeveloperInstructions(values) {
3746
+ for (let index = 0; index < values.length; index++) {
3747
+ const value = values[index];
3748
+ if ((value === "-c" || value === "--config" ? values[index + 1] : value.startsWith("--config=") ? value.slice(9) : void 0)?.trimStart().startsWith("developer_instructions=")) return true;
3749
+ }
3750
+ return false;
3751
+ }
3752
+ const HARNESS_SYSTEM_PROMPTS = {
3753
+ "claude-code": {
3754
+ executable: "claude",
3755
+ project: (plan, systemPrompt, path) => appendFlags(addSystemPromptFile(plan, systemPrompt), "--system-prompt-file", path),
3756
+ conflictsWithArgs: argsSetSystemPromptFlag
3757
+ },
3758
+ codex: {
3759
+ executable: "codex",
3760
+ project: (plan, systemPrompt) => appendFlags(plan, "-c", `developer_instructions=${tomlString(systemPrompt)}`),
3761
+ conflictsWithArgs: argsSetCodexDeveloperInstructions
3762
+ },
3763
+ opencode: {
3764
+ executable: "opencode",
3765
+ project: (plan, systemPrompt) => ({
3766
+ ...plan,
3767
+ files: projectOpenCodeSystemPrompt(plan.files, systemPrompt)
3768
+ }),
3769
+ conflictsWithArgs: () => false
3770
+ },
3771
+ pi: {
3772
+ executable: "pi",
3773
+ project: (plan, systemPrompt, path) => appendFlags(addSystemPromptFile(plan, systemPrompt), "--system-prompt", path),
3774
+ conflictsWithArgs: argsSetSystemPromptFlag
3775
+ }
3776
+ };
3743
3777
  /** Project a replacement system prompt onto the exact native process control. */
3744
3778
  function projectCandidateSystemPrompt(plan, launch, systemPromptFilePath) {
3745
3779
  const systemPrompt = plan.systemPrompt;
3746
3780
  if (systemPrompt === void 0) return plan;
3747
- const expectedExecutable = NATIVE_EXECUTABLES[plan.harness];
3748
- if (!expectedExecutable) throw new Error(`candidate system prompt has no native launch projection for ${plan.harness}`);
3781
+ const projection = HARNESS_SYSTEM_PROMPTS[plan.harness];
3782
+ if (!projection) throw new Error(`candidate system prompt has no native launch projection for ${plan.harness}`);
3783
+ const expectedExecutable = projection.executable;
3749
3784
  if (launch.kind !== "container-command") throw new Error(`candidate-entrypoint launch cannot prove ${plan.harness} system-prompt replacement`);
3750
3785
  if (launch.executable !== expectedExecutable && !(posix.isAbsolute(launch.executable) && posix.basename(launch.executable) === expectedExecutable)) throw new Error(`${plan.harness} system-prompt replacement requires the native ${expectedExecutable} executable`);
3751
- assertNoSystemPromptOverride(plan.harness, launch.args ?? []);
3752
- const projectedPlan = omitUnappliedSystemPrompt(plan);
3753
- switch (plan.harness) {
3754
- case "codex": return appendFlags(projectedPlan, "-c", `developer_instructions=${tomlString(systemPrompt.value)}`);
3755
- case "claude-code": return appendFlags(addSystemPromptFile(projectedPlan, systemPrompt.value), "--system-prompt-file", systemPromptFilePath);
3756
- case "opencode": return {
3757
- ...projectedPlan,
3758
- files: projectOpenCodeSystemPrompt(projectedPlan.files, systemPrompt.value)
3759
- };
3760
- case "pi": return appendFlags(addSystemPromptFile(projectedPlan, systemPrompt.value), "--system-prompt", systemPromptFilePath);
3761
- default: throw new Error(`candidate system prompt has no native launch projection for ${plan.harness}`);
3762
- }
3786
+ if (projection.conflictsWithArgs((launch.args ?? []).map((value) => value.value))) throw new Error(`${plan.harness} launch arguments conflict with the candidate profile system prompt`);
3787
+ return projection.project(omitUnappliedSystemPrompt(plan), systemPrompt.value, systemPromptFilePath);
3763
3788
  }
3764
3789
  function omitUnappliedSystemPrompt(plan) {
3765
3790
  const { systemPrompt: _systemPrompt, ...projected } = plan;
@@ -3788,18 +3813,6 @@ function addSystemPromptFile(plan, systemPrompt) {
3788
3813
  }]
3789
3814
  };
3790
3815
  }
3791
- function assertNoSystemPromptOverride(harness, args) {
3792
- const values = args.map((value) => value.value);
3793
- if (harness === "claude-code" || harness === "pi") {
3794
- if (values.some((value) => value === "--system-prompt" || value.startsWith("--system-prompt=") || value === "--system-prompt-file" || value.startsWith("--system-prompt-file="))) throw new Error(`${harness} launch arguments conflict with the candidate profile system prompt`);
3795
- return;
3796
- }
3797
- if (harness !== "codex") return;
3798
- for (let index = 0; index < values.length; index++) {
3799
- const value = values[index];
3800
- if ((value === "-c" || value === "--config" ? values[index + 1] : value.startsWith("--config=") ? value.slice(9) : void 0)?.trimStart().startsWith("developer_instructions=")) throw new Error("codex launch arguments conflict with the candidate profile system prompt");
3801
- }
3802
- }
3803
3816
  function projectOpenCodeSystemPrompt(files, prompt) {
3804
3817
  const configIndex = files.findIndex((file) => file.relPath === "opencode.json");
3805
3818
  if (configIndex === -1) return [...files, {
@@ -4442,4 +4455,4 @@ function errorMessage(error) {
4442
4455
  //#endregion
4443
4456
  export { parseExactAgentProfile as $, verifyMaterializedWorkspace as A, rejectedStage as B, assertNoGitIndirection as C, captureMaterializedWorkspace as D, candidateWorkspaceManifest as E, assertTerminalAllowedInPhase as F, agentCandidateProfileAsAgentProfile as G, sealTerminalDigest as H, assertTerminalMatchesClaim as I, candidateMaterializerHarness as J, applyExactAgentProfileDiff as K, assertTerminalMatchesStaged as L, candidateCleanupTimeout as M, withinCandidateCleanupDeadline as N, readVerifiedArtifact as O, assertRecoveryMatchesStaged as P, parseAgentCandidateProfileActivation as Q, recoveredTerminalRecord as R, CANDIDATE_TRACE_TAGS as S, runCandidateGit as T, terminalRecord as U, requireStagedTerminal as V, assertExactObjectKeys as W, freezeGenericAgentCandidateProfile as X, createAgentCandidateProfileActivation as Y, omitUndefinedObjectFields as Z, candidateExecutionClaim as _, persistCandidateOutputArtifact as a, deepFreezeCandidate as at, consumePreparedCandidateExecution as b, CANDIDATE_KNOWLEDGE_ROOT_ENV as c, omitTopLevelDigest as ct, verifiedResourceTextByDigest as d, parseExactAgentProfileDiff as et, verifyAgentCandidateBundle as f, candidateClaimFileInternals as g, InMemoryAgentCandidateExecutionClaimStore as h, persistCandidateModelSettlementEvidence as i, canonicalCandidateDocument as it, candidateCleanupDeadline as j, verifyBytes as k, candidateKnowledgeExecutionPaths as l, sha256Bytes as lt, usdToNanos as m, executePreparedAgentCandidate as n, canonicalCandidateBytes as nt, sealAgentCandidateExecutorStopAcknowledgement as o, embeddedCandidateArtifact as ot, sealAgentCandidateModelSettlement as p, assertCandidateProfileBinding as q, RecoveryAgentCandidateTraceStore as r, canonicalCandidateDigest$1 as rt, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV as s, immutableCandidateValue as st, prepareAgentCandidateExecution as t, parseExactCandidateProfile as tt, AGENT_CANDIDATE_EXECUTION_SUPPORT as u, verifyCanonicalCandidateDocument as ut, assertPreparedCandidateIntegrity as v, readCandidateGitTreeFiles as w, CANDIDATE_TRACE_ENV as x, beginPreparedCandidateDisposal as y, rejectedFinish as z };
4444
4457
 
4445
- //# sourceMappingURL=prepare-BHQBb02e.js.map
4458
+ //# sourceMappingURL=prepare-DpV6np9e.js.map