@tangle-network/agent-runtime 0.94.11 → 0.94.13

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 (67) hide show
  1. package/README.md +65 -1
  2. package/dist/agent.d.ts +2 -1
  3. package/dist/agent.js +2 -1
  4. package/dist/agent.js.map +1 -1
  5. package/dist/{agentic-generator-JT47GnAp.d.ts → agentic-generator-DDMM45kZ.d.ts} +2 -2
  6. package/dist/analyst-loop.d.ts +2 -1
  7. package/dist/backends-BO4Jqoe2.d.ts +134 -0
  8. package/dist/candidate-execution/index.d.ts +2 -2
  9. package/dist/candidate-execution/index.js +2 -2
  10. package/dist/chunk-AEG3NGJ2.js +639 -0
  11. package/dist/chunk-AEG3NGJ2.js.map +1 -0
  12. package/dist/{chunk-37V4KQDC.js → chunk-CNH7DF7Z.js} +173 -84
  13. package/dist/chunk-CNH7DF7Z.js.map +1 -0
  14. package/dist/{chunk-OLZ6ZZQ2.js → chunk-D3H7F6L2.js} +11 -8
  15. package/dist/chunk-D3H7F6L2.js.map +1 -0
  16. package/dist/{chunk-5LIOH5DR.js → chunk-PCURO3DL.js} +4 -4
  17. package/dist/chunk-PCURO3DL.js.map +1 -0
  18. package/dist/{chunk-FTXM7Q7P.js → chunk-TVJQAYQM.js} +13 -21
  19. package/dist/chunk-TVJQAYQM.js.map +1 -0
  20. package/dist/{chunk-YP6B7RZ2.js → chunk-U33YZ7B2.js} +6 -635
  21. package/dist/chunk-U33YZ7B2.js.map +1 -0
  22. package/dist/chunk-VYA2YEKA.js +1187 -0
  23. package/dist/chunk-VYA2YEKA.js.map +1 -0
  24. package/dist/{chunk-MXBQNVFE.js → chunk-XP5KDM3R.js} +5 -5
  25. package/dist/{completion-gate-Bn4AZ_Kw.d.ts → completion-gate-D1gX1-hg.d.ts} +1 -1
  26. package/dist/conversation.d.ts +793 -0
  27. package/dist/conversation.js +56 -0
  28. package/dist/conversation.js.map +1 -0
  29. package/dist/{coordination-DzwagV_s.d.ts → coordination-Dr_axlAf.d.ts} +5 -4
  30. package/dist/environment-provider.d.ts +3 -2
  31. package/dist/{improve-BucbjddC.d.ts → improve-BN3HyXIO.d.ts} +1 -1
  32. package/dist/index.d.ts +29 -943
  33. package/dist/index.js +60 -1161
  34. package/dist/index.js.map +1 -1
  35. package/dist/intelligence.d.ts +6 -5
  36. package/dist/intelligence.js +6 -6
  37. package/dist/knowledge.d.ts +7 -6
  38. package/dist/lifecycle.d.ts +2 -2
  39. package/dist/lifecycle.js +1 -1
  40. package/dist/{loop-runner-bin-D6K_C6op.d.ts → loop-runner-bin-BRQSQdHa.d.ts} +2 -2
  41. package/dist/loop-runner-bin.d.ts +6 -5
  42. package/dist/loop-runner-bin.js +4 -3
  43. package/dist/loops.d.ts +15 -14
  44. package/dist/loops.js +2 -1
  45. package/dist/mcp/index.d.ts +9 -8
  46. package/dist/mcp/index.js +2 -1
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/{mcp-serve-verifier-i6nTNSnu.d.ts → mcp-serve-verifier-DQQDbuyz.d.ts} +1 -1
  49. package/dist/{openai-tools-0wACz8f8.d.ts → openai-tools-fnj6SRVg.d.ts} +1 -1
  50. package/dist/{prepare-DIeVgQG3.d.ts → prepare-CtdtsFNG.d.ts} +18 -14
  51. package/dist/primeintellect/index.d.ts +214 -0
  52. package/dist/primeintellect/index.js +1120 -0
  53. package/dist/primeintellect/index.js.map +1 -0
  54. package/dist/profiles.d.ts +2 -1
  55. package/dist/{sanitize-Dcbjp0tU.d.ts → sanitize-BTSsdBXw.d.ts} +1 -1
  56. package/dist/{supervise-CzyytS-o.d.ts → supervise-DmYOug5f.d.ts} +4 -4
  57. package/dist/{types-CogNCaw7.d.ts → types-1d5QGK3t.d.ts} +1 -1
  58. package/dist/types-BwoZWq-i.d.ts +510 -0
  59. package/dist/{types-CKmyZ9TP.d.ts → types-ByAYqlVb.d.ts} +3 -509
  60. package/dist/{worktree-fanout-Bn7w_1bM.d.ts → worktree-fanout-CPprU-qI.d.ts} +3 -3
  61. package/package.json +17 -5
  62. package/dist/chunk-37V4KQDC.js.map +0 -1
  63. package/dist/chunk-5LIOH5DR.js.map +0 -1
  64. package/dist/chunk-FTXM7Q7P.js.map +0 -1
  65. package/dist/chunk-OLZ6ZZQ2.js.map +0 -1
  66. package/dist/chunk-YP6B7RZ2.js.map +0 -1
  67. /package/dist/{chunk-MXBQNVFE.js.map → chunk-XP5KDM3R.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { AgentCandidateBundle, AgentCandidateArtifactRef, AgentCandidateTermination, AgentCandidateTaskOutcomeEvidence, Sha256Digest, AgentCandidateContainer, AgentCandidateOciPlatform, AgentCandidateGitHubRepository, AgentCandidateWorkspaceSnapshotEvidence, AgentCandidateResolvedModel, AgentCandidateAttemptPolicy, AgentCandidateExecutionLimits, AgentCandidateModelAccessNetwork, AgentCandidateCapturedArtifact, AgentCandidateWorkspaceManifestMaterialV1, AgentCandidateProfilePlanEvidence, AgentCandidateExecutionPlanEvidence, AgentCandidateMaterializationReceipt, AgentCandidateInstructionDelivery, AgentCandidateEffectiveMemory, AgentCandidateRunReceiptV2, AgentCandidateSpend, ReasoningEffort } from '@tangle-network/agent-interface';
1
+ import { AgentCandidateBundle, AgentCandidateArtifactRef, AgentCandidateTermination, AgentCandidateTaskOutcomeEvidence, Sha256Digest, AgentCandidateContainer, AgentCandidateOciPlatform, AgentCandidateGitHubRepository, AgentCandidateWorkspaceSnapshotEvidence, AgentCandidateResolvedModel, AgentCandidateAttemptPolicy, AgentCandidateExecutionLimits, AgentCandidateModelAccessNetwork, AgentCandidateCapturedArtifact, AgentCandidateWorkspaceManifestMaterial, AgentCandidateProfilePlanEvidence, AgentCandidateExecutionPlanEvidence, AgentCandidateMaterializationReceipt, AgentCandidateInstructionDelivery, AgentCandidateKnowledgeRef, AgentCandidateEffectiveMemory, AgentCandidateRunReceipt, AgentCandidateSpend, ReasoningEffort } from '@tangle-network/agent-interface';
2
2
  import { BenchmarkEvaluation, TraceStore } from '@tangle-network/agent-eval';
3
3
 
4
4
  /** Exact candidate wire shape before the runtime computes its canonical digest. */
@@ -13,7 +13,7 @@ declare const verifiedTaskOutcomeBrand: unique symbol;
13
13
  interface AgentCandidateArtifactPort {
14
14
  read(ref: AgentCandidateArtifactRef): Promise<Uint8Array>;
15
15
  }
16
- type AgentCandidateOutputPurpose = 'candidate-workspace-manifest' | 'candidate-workspace-archive' | 'task-manifest' | 'task-archive' | 'task-patch' | 'task-outcome' | 'memory-after-manifest' | 'memory-after-archive' | 'grader-evidence' | 'benchmark-result' | 'model-settlement' | 'trace' | 'run-receipt' | 'failure-evidence';
16
+ type AgentCandidateOutputPurpose = 'candidate-workspace-manifest' | 'candidate-workspace-archive' | 'task-manifest' | 'task-archive' | 'task-patch' | 'task-outcome' | 'memory-after-manifest' | 'memory-after-archive' | 'grader-evidence' | 'benchmark-result' | 'model-settlement' | 'trace' | 'executor-capture' | 'run-receipt' | 'failure-evidence';
17
17
  /** Durable content-addressed evidence store controlled only by the evaluator. */
18
18
  interface AgentCandidateOutputArtifactPort extends AgentCandidateArtifactPort {
19
19
  /** Must be idempotent for identical bytes and return only a durable S3/IPFS locator. */
@@ -42,7 +42,7 @@ interface AgentCandidateVerificationPorts {
42
42
  */
43
43
  interface AgentCandidateWorkspacePort {
44
44
  materialize(input: {
45
- role: 'task' | 'candidate' | 'memory';
45
+ role: 'task' | 'candidate' | 'knowledge' | 'memory';
46
46
  snapshot: AgentCandidateWorkspaceSnapshotEvidence;
47
47
  archive: Uint8Array;
48
48
  destination: string;
@@ -263,6 +263,13 @@ interface PreparedAgentCandidateInstruction {
263
263
  bytes: Uint8Array;
264
264
  delivery: AgentCandidateInstructionDelivery;
265
265
  }
266
+ /** Exact file-backed knowledge admitted by the candidate bundle. */
267
+ interface PreparedAgentCandidateKnowledge {
268
+ readonly candidate: AgentCandidateKnowledgeRef;
269
+ readonly snapshot: AgentCandidateWorkspaceSnapshotEvidence;
270
+ readonly files: readonly AgentCandidateExecutorWorkspaceFile[];
271
+ readonly retrievalConfig?: Uint8Array;
272
+ }
266
273
  interface PreparedAgentCandidateTrace {
267
274
  runId: string;
268
275
  tags: Readonly<Record<string, string>>;
@@ -295,11 +302,7 @@ interface PreparedAgentCandidateExecution {
295
302
  readonly launch: PreparedAgentCandidateLaunch;
296
303
  readonly instruction: PreparedAgentCandidateInstruction;
297
304
  readonly resolvedModel: AgentCandidateResolvedModel;
298
- readonly knowledge?: {
299
- snapshotId: string;
300
- manifestDigest: Sha256Digest;
301
- manifest: Uint8Array;
302
- };
305
+ readonly knowledge?: PreparedAgentCandidateKnowledge;
303
306
  readonly trace: PreparedAgentCandidateTrace;
304
307
  readonly memory: AgentCandidateEffectiveMemory;
305
308
  readonly [preparedCandidateBrand]: true;
@@ -313,7 +316,7 @@ interface AgentCandidateExecutorTaskOutcomeCapture {
313
316
  /** Claimed final tree. The runtime recomputes it independently from `gitDiff`. */
314
317
  resultTree: string;
315
318
  /** Complete evaluator-captured workspace description after candidate execution. */
316
- afterState: AgentCandidateWorkspaceManifestMaterialV1;
319
+ afterState: AgentCandidateWorkspaceManifestMaterial;
317
320
  /** Reproducible workspace archive corresponding to `afterState`. */
318
321
  archive: Uint8Array;
319
322
  /** Exact binary patch from the signed task base to `afterState`. */
@@ -321,7 +324,7 @@ interface AgentCandidateExecutorTaskOutcomeCapture {
321
324
  }
322
325
  /** Raw isolated-memory capture made only after access has been revoked. */
323
326
  interface AgentCandidateExecutorMemoryCapture {
324
- readonly afterState: AgentCandidateWorkspaceManifestMaterialV1;
327
+ readonly afterState: AgentCandidateWorkspaceManifestMaterial;
325
328
  readonly archive: Uint8Array;
326
329
  }
327
330
  /** Idempotent executor result after process death and trace drain. */
@@ -447,18 +450,19 @@ interface AgentCandidateExecutorWorkspaceInput {
447
450
  }
448
451
  interface AgentCandidateExecutorWorkspaceFile {
449
452
  readonly path: string;
450
- readonly mode: 0o644 | 0o755;
453
+ readonly mode: number;
451
454
  readonly bytes: Uint8Array;
452
455
  }
453
456
  interface AgentCandidateExecutorProfileFile {
454
457
  readonly path: string;
455
- readonly mode: 0o644 | 0o755;
458
+ readonly mode: number;
456
459
  readonly bytes: Uint8Array;
457
460
  }
458
461
  type AgentCandidateRunFinalization = {
459
462
  succeeded: true;
460
- receipt: CanonicalCandidateDocument<AgentCandidateRunReceiptV2>;
463
+ receipt: CanonicalCandidateDocument<AgentCandidateRunReceipt>;
461
464
  artifacts: {
465
+ executorCapture: AgentCandidateArtifactRef;
462
466
  modelSettlement: AgentCandidateArtifactRef;
463
467
  taskOutcome: AgentCandidateArtifactRef;
464
468
  benchmarkResult: AgentCandidateArtifactRef;
@@ -715,4 +719,4 @@ interface PrepareAgentCandidateExecutionOptions {
715
719
  /** Materializes a verified candidate into one immutable evaluator-owned execution plan. */
716
720
  declare function prepareAgentCandidateExecution(candidate: VerifiedAgentCandidate, task: AgentCandidateTaskExecution, ports: AgentCandidateExecutionPorts, options?: PrepareAgentCandidateExecutionOptions): Promise<PreparedAgentCandidateExecution>;
717
721
 
718
- export { InMemoryAgentCandidateExecutionClaimStore as $, type AgentCandidateBundleInput as A, type AgentCandidateExecutorProfileFile as B, type AgentCandidateExecutorRequest as C, type AgentCandidateExecutorStopRequest as D, type ExecutePreparedAgentCandidateOptions as E, type AgentCandidateExecutorTaskOutcomeCapture as F, type AgentCandidateExecutorWorkspaceFile as G, type AgentCandidateExecutorWorkspaceInput as H, type AgentCandidateMemoryPort as I, type AgentCandidateMemoryResetResult as J, type AgentCandidateModelLimits as K, type AgentCandidateModelPort as L, type AgentCandidateOutputArtifactPort as M, type AgentCandidateOutputPurpose as N, type AgentCandidateProtectedModelActivation as O, type PrepareAgentCandidateExecutionOptions as P, type AgentCandidateProtectedModelCall as Q, type AgentCandidateProtectedModelReservation as R, type AgentCandidateProtectedModelSettlement as S, type AgentCandidateProtectedRunCapture as T, type AgentCandidateRepositoryPort as U, type AgentCandidateRetryRejection as V, type AgentCandidateVerificationPorts as W, type AgentCandidateWorkspacePort as X, CANDIDATE_TRACE_ENV as Y, CANDIDATE_TRACE_TAGS as Z, type CanonicalCandidateDocument as _, type AgentCandidateTaskExecution as a, type PreparedAgentCandidateExecution as a0, type PreparedAgentCandidateInstruction as a1, type PreparedAgentCandidateLaunch as a2, type PreparedAgentCandidateTrace as a3, type ResolvedAgentCandidateContainer as a4, type VerifiedAgentCandidate as a5, type VerifiedAgentCandidateTaskOutcome as a6, executePreparedAgentCandidate as a7, prepareAgentCandidateExecution as a8, sealAgentCandidateBundle as a9, type AgentCandidateExecutionPorts as b, type AgentCandidateRunFinalization as c, type AgentCandidateArtifactPort as d, type AgentCandidateBenchmarkGraderIdentity as e, type AgentCandidateBenchmarkGraderPort as f, type AgentCandidateContainerPort as g, type AgentCandidateExecutionAttemptRecord as h, type AgentCandidateExecutionAttemptRef as i, type AgentCandidateExecutionClaim as j, type AgentCandidateExecutionClaimResult as k, type AgentCandidateExecutionClaimStore as l, type AgentCandidateExecutionCleanupHandles as m, type AgentCandidateExecutionFailureClass as n, type AgentCandidateExecutionFinishResult as o, type AgentCandidateExecutionLease as p, type AgentCandidateExecutionPhase as q, type AgentCandidateExecutionPhaseResult as r, type AgentCandidateExecutionRecoveryEvidence as s, type AgentCandidateExecutionStageResult as t, type AgentCandidateExecutionTerminalRecord as u, type AgentCandidateExecutionTerminalResult as v, type AgentCandidateExecutionUsage as w, type AgentCandidateExecutorFinalCapture as x, type AgentCandidateExecutorMemoryCapture as y, type AgentCandidateExecutorPort as z };
722
+ export { InMemoryAgentCandidateExecutionClaimStore as $, type AgentCandidateBundleInput as A, type AgentCandidateExecutorProfileFile as B, type AgentCandidateExecutorRequest as C, type AgentCandidateExecutorStopRequest as D, type ExecutePreparedAgentCandidateOptions as E, type AgentCandidateExecutorTaskOutcomeCapture as F, type AgentCandidateExecutorWorkspaceFile as G, type AgentCandidateExecutorWorkspaceInput as H, type AgentCandidateMemoryPort as I, type AgentCandidateMemoryResetResult as J, type AgentCandidateModelLimits as K, type AgentCandidateModelPort as L, type AgentCandidateOutputArtifactPort as M, type AgentCandidateOutputPurpose as N, type AgentCandidateProtectedModelActivation as O, type PrepareAgentCandidateExecutionOptions as P, type AgentCandidateProtectedModelCall as Q, type AgentCandidateProtectedModelReservation as R, type AgentCandidateProtectedModelSettlement as S, type AgentCandidateProtectedRunCapture as T, type AgentCandidateRepositoryPort as U, type AgentCandidateRetryRejection as V, type AgentCandidateVerificationPorts as W, type AgentCandidateWorkspacePort as X, CANDIDATE_TRACE_ENV as Y, CANDIDATE_TRACE_TAGS as Z, type CanonicalCandidateDocument as _, type AgentCandidateTaskExecution as a, type PreparedAgentCandidateExecution as a0, type PreparedAgentCandidateInstruction as a1, type PreparedAgentCandidateKnowledge as a2, type PreparedAgentCandidateLaunch as a3, type PreparedAgentCandidateTrace as a4, type ResolvedAgentCandidateContainer as a5, type VerifiedAgentCandidate as a6, type VerifiedAgentCandidateTaskOutcome as a7, executePreparedAgentCandidate as a8, prepareAgentCandidateExecution as a9, sealAgentCandidateBundle as aa, type AgentCandidateExecutionPorts as b, type AgentCandidateRunFinalization as c, type AgentCandidateArtifactPort as d, type AgentCandidateBenchmarkGraderIdentity as e, type AgentCandidateBenchmarkGraderPort as f, type AgentCandidateContainerPort as g, type AgentCandidateExecutionAttemptRecord as h, type AgentCandidateExecutionAttemptRef as i, type AgentCandidateExecutionClaim as j, type AgentCandidateExecutionClaimResult as k, type AgentCandidateExecutionClaimStore as l, type AgentCandidateExecutionCleanupHandles as m, type AgentCandidateExecutionFailureClass as n, type AgentCandidateExecutionFinishResult as o, type AgentCandidateExecutionLease as p, type AgentCandidateExecutionPhase as q, type AgentCandidateExecutionPhaseResult as r, type AgentCandidateExecutionRecoveryEvidence as s, type AgentCandidateExecutionStageResult as t, type AgentCandidateExecutionTerminalRecord as u, type AgentCandidateExecutionTerminalResult as v, type AgentCandidateExecutionUsage as w, type AgentCandidateExecutorFinalCapture as x, type AgentCandidateExecutorMemoryCapture as y, type AgentCandidateExecutorPort as z };
@@ -0,0 +1,214 @@
1
+ import { c as AgentExecutionBackend, A as AgentBackendInput } from '../types-BwoZWq-i.js';
2
+ import { c as createOpenAICompatibleBackend } from '../backends-BO4Jqoe2.js';
3
+ import { RunRecord } from '@tangle-network/agent-eval';
4
+
5
+ type PrimeIntellectSplit = 'train' | 'eval';
6
+ type PrimeIntellectJson = null | boolean | number | string | PrimeIntellectJson[] | {
7
+ [key: string]: PrimeIntellectJson;
8
+ };
9
+ type PrimeIntellectContent = string | Array<{
10
+ type: 'text';
11
+ text: string;
12
+ } | {
13
+ type: 'image_url';
14
+ image_url: {
15
+ url: string;
16
+ };
17
+ }>;
18
+ type PrimeIntellectMessage = {
19
+ role: 'system' | 'user';
20
+ content: PrimeIntellectContent;
21
+ } | {
22
+ role: 'assistant';
23
+ content?: string | null;
24
+ reasoning_content?: string | null;
25
+ tool_calls?: Array<{
26
+ id: string;
27
+ name: string;
28
+ arguments: string;
29
+ }>;
30
+ provider_state?: Array<Record<string, PrimeIntellectJson>>;
31
+ } | {
32
+ role: 'tool';
33
+ tool_call_id: string;
34
+ content: PrimeIntellectContent;
35
+ name?: string;
36
+ };
37
+ /** One immutable problem. References stay inside Prime's task process. */
38
+ interface PrimeIntellectTask {
39
+ id: string;
40
+ split: PrimeIntellectSplit;
41
+ prompt: string | PrimeIntellectMessage[];
42
+ systemPrompt?: string;
43
+ answer?: string | string[];
44
+ metadata?: Record<string, PrimeIntellectJson>;
45
+ }
46
+ type PrimeIntellectScoring = {
47
+ kind: 'exact';
48
+ normalization?: 'none' | 'trim' | 'trim-casefold';
49
+ } | {
50
+ kind: 'reference-judge';
51
+ model: string;
52
+ prompt?: string;
53
+ view?: 'last_reply' | 'full_trace';
54
+ } | {
55
+ kind: 'command';
56
+ command: readonly [string, ...string[]];
57
+ files?: Readonly<Record<string, string>>;
58
+ forwardEnv?: readonly string[];
59
+ timeoutSeconds?: number;
60
+ };
61
+ type PrimeIntellectSetupCommand = readonly [string, ...string[]];
62
+ /** Files and commands that make the caller's real agent program runnable. */
63
+ interface PrimeIntellectRunner {
64
+ command: readonly [string, ...string[]];
65
+ files?: Readonly<Record<string, string>>;
66
+ setup?: readonly PrimeIntellectSetupCommand[];
67
+ forwardEnv?: readonly string[];
68
+ /** Container image used by the generated eval config. */
69
+ image: string;
70
+ }
71
+ interface PrimeIntellectPackageOptions {
72
+ name: string;
73
+ version: string;
74
+ description?: string;
75
+ tasks: readonly PrimeIntellectTask[];
76
+ scoring: PrimeIntellectScoring;
77
+ runner: PrimeIntellectRunner;
78
+ /** Prime-enforced model turn cap. Default 16. */
79
+ maxTurns?: number;
80
+ maxInputTokens?: number;
81
+ maxOutputTokens?: number;
82
+ maxTotalTokens?: number;
83
+ rolloutTimeoutSeconds?: number;
84
+ scoringTimeoutSeconds?: number;
85
+ }
86
+ interface PrimeIntellectPackageManifest {
87
+ schema: 'tangle.primeintellect.package/v1';
88
+ name: string;
89
+ moduleName: string;
90
+ version: string;
91
+ verifiers: '>=0.2.0,<0.3.0';
92
+ taskCount: number;
93
+ splits: Record<PrimeIntellectSplit, number>;
94
+ taskIdsSha256: string;
95
+ filesSha256: Record<string, string>;
96
+ }
97
+ interface PrimeIntellectPackageBundle {
98
+ manifest: PrimeIntellectPackageManifest;
99
+ /** Relative package path to UTF-8 contents. */
100
+ files: Readonly<Record<string, string>>;
101
+ }
102
+ /** The answer-free task exposed to the caller's runtime program. */
103
+ interface PrimeIntellectPublicTask {
104
+ id: string;
105
+ split: PrimeIntellectSplit;
106
+ prompt: string | PrimeIntellectMessage[];
107
+ systemPrompt?: string;
108
+ metadata?: Record<string, PrimeIntellectJson>;
109
+ }
110
+ interface PrimeIntellectEpisodeContext {
111
+ protocol: 'tangle.primeintellect.episode/v1';
112
+ task: PrimeIntellectPublicTask;
113
+ model: {
114
+ name: string;
115
+ baseUrl: string;
116
+ apiKey: string;
117
+ };
118
+ mcpServers: Readonly<Record<string, string>>;
119
+ }
120
+
121
+ interface WritePrimeIntellectPackageOptions {
122
+ /** Replace an existing generated package and restore it if the final swap fails. */
123
+ replace?: boolean;
124
+ }
125
+ /** Build a complete PrimeIntellect Verifiers v1 package without writing to disk. */
126
+ declare function createPrimeIntellectPackage(options: PrimeIntellectPackageOptions): PrimeIntellectPackageBundle;
127
+ /** Write a bundle through a sibling temporary directory, then rename it into place. */
128
+ declare function writePrimeIntellectPackage(bundle: PrimeIntellectPackageBundle, outputDirectory: string, options?: WritePrimeIntellectPackageOptions): Promise<string>;
129
+
130
+ interface RunPrimeIntellectProgramOptions {
131
+ env?: NodeJS.ProcessEnv;
132
+ }
133
+ type PrimeIntellectBackendOptions = Omit<Parameters<typeof createOpenAICompatibleBackend>[0], 'apiKey' | 'baseUrl' | 'model'>;
134
+ /** Read and validate the private process contract installed by the generated Prime harness. */
135
+ declare function readPrimeIntellectEpisodeContext(env?: NodeJS.ProcessEnv): PrimeIntellectEpisodeContext;
136
+ /** Build the existing runtime backend against Prime's intercepted model endpoint. */
137
+ declare function createPrimeIntellectBackend(context: PrimeIntellectEpisodeContext, options?: PrimeIntellectBackendOptions): AgentExecutionBackend<AgentBackendInput>;
138
+ /**
139
+ * Execute the caller's canonical runtime program inside a Prime rollout.
140
+ * The callback may call runPersonified, runAgentic, runLoop, or any product wrapper.
141
+ */
142
+ declare function runPrimeIntellectProgram<Result>(run: (context: PrimeIntellectEpisodeContext) => Promise<Result>, options?: RunPrimeIntellectProgramOptions): Promise<Result>;
143
+
144
+ interface PrimeUsage {
145
+ prompt_tokens: number;
146
+ completion_tokens: number;
147
+ cached_input_tokens?: number | null;
148
+ reasoning_tokens?: number | null;
149
+ cost?: number | null;
150
+ }
151
+ interface PrimeTraceNode {
152
+ parent?: number | null;
153
+ sampled?: boolean;
154
+ usage?: PrimeUsage | null;
155
+ message?: unknown;
156
+ }
157
+ interface PrimeTimeSpan {
158
+ start?: number;
159
+ end?: number;
160
+ }
161
+ interface PrimeIntellectTrace {
162
+ id: string;
163
+ task: {
164
+ type: string;
165
+ data: {
166
+ idx: number;
167
+ name?: string | null;
168
+ split?: 'train' | 'eval';
169
+ prompt?: unknown;
170
+ system_prompt?: string | null;
171
+ metadata?: Record<string, unknown>;
172
+ [key: string]: unknown;
173
+ };
174
+ };
175
+ runtime?: unknown;
176
+ nodes: PrimeTraceNode[];
177
+ rewards: Record<string, number>;
178
+ metrics: Record<string, number>;
179
+ info?: Record<string, unknown>;
180
+ extra_usage?: PrimeUsage[];
181
+ is_completed?: boolean;
182
+ stop_condition?: string | null;
183
+ errors?: Array<{
184
+ type: string;
185
+ message: string;
186
+ traceback?: string | null;
187
+ }>;
188
+ timing?: {
189
+ start?: number;
190
+ setup?: PrimeTimeSpan;
191
+ generation?: PrimeTimeSpan;
192
+ finalize?: PrimeTimeSpan;
193
+ scoring?: PrimeTimeSpan;
194
+ };
195
+ }
196
+ interface PrimeIntellectTraceImportOptions {
197
+ experimentId: string;
198
+ candidateId: string;
199
+ seed: number;
200
+ /** Snapshot-pinned model id required by RunRecord validation. */
201
+ model: string;
202
+ promptHash: string;
203
+ configHash: string;
204
+ commitSha: string;
205
+ }
206
+ type PrimeIntellectImportDefaults = PrimeIntellectTraceImportOptions;
207
+ /** Parse Prime's durable `traces.jsonl` and reject malformed rows with a line number. */
208
+ declare function parsePrimeIntellectTraces(jsonl: string): PrimeIntellectTrace[];
209
+ /** Convert all Prime traces to agent-eval RunRecords while retaining one shared run config. */
210
+ declare function importPrimeIntellectTraces(jsonl: string, defaults: PrimeIntellectImportDefaults): RunRecord[];
211
+ /** Project one complete Prime trace into the common agent-eval analysis row. */
212
+ declare function primeIntellectTraceToRunRecord(trace: PrimeIntellectTrace, options: PrimeIntellectTraceImportOptions): RunRecord;
213
+
214
+ export { type PrimeIntellectBackendOptions, type PrimeIntellectContent, type PrimeIntellectEpisodeContext, type PrimeIntellectImportDefaults, type PrimeIntellectJson, type PrimeIntellectMessage, type PrimeIntellectPackageBundle, type PrimeIntellectPackageManifest, type PrimeIntellectPackageOptions, type PrimeIntellectPublicTask, type PrimeIntellectRunner, type PrimeIntellectScoring, type PrimeIntellectSetupCommand, type PrimeIntellectSplit, type PrimeIntellectTask, type PrimeIntellectTrace, type PrimeIntellectTraceImportOptions, type RunPrimeIntellectProgramOptions, type WritePrimeIntellectPackageOptions, createPrimeIntellectBackend, createPrimeIntellectPackage, importPrimeIntellectTraces, parsePrimeIntellectTraces, primeIntellectTraceToRunRecord, readPrimeIntellectEpisodeContext, runPrimeIntellectProgram, writePrimeIntellectPackage };