@tangle-network/agent-interface 0.28.0 → 0.30.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 (30) hide show
  1. package/dist/agent-candidate-code-schema.d.ts +0 -8
  2. package/dist/agent-candidate-code-schema.js +0 -1
  3. package/dist/agent-candidate-execution-plan-schema.d.ts +193 -350
  4. package/dist/agent-candidate-execution-plan-schema.js +98 -131
  5. package/dist/agent-candidate-lineage-schema.d.ts +1 -28
  6. package/dist/agent-candidate-lineage-schema.js +3 -33
  7. package/dist/agent-candidate-outcome-schema.d.ts +48 -18
  8. package/dist/agent-candidate-outcome-schema.js +19 -24
  9. package/dist/agent-candidate-profile-schema.d.ts +3 -28
  10. package/dist/agent-candidate-profile-schema.js +15 -27
  11. package/dist/agent-candidate-promotion-schema.d.ts +10981 -2356
  12. package/dist/agent-candidate-promotion-schema.js +495 -105
  13. package/dist/agent-candidate-receipt-schema.d.ts +268 -303
  14. package/dist/agent-candidate-receipt-schema.js +82 -8
  15. package/dist/agent-candidate-schema-common.d.ts +8 -0
  16. package/dist/agent-candidate-schema-common.js +35 -1
  17. package/dist/agent-candidate-schema.d.ts +3 -52
  18. package/dist/agent-candidate-schema.js +3 -28
  19. package/dist/agent-candidate-task-schema.d.ts +643 -0
  20. package/dist/agent-candidate-task-schema.js +191 -0
  21. package/dist/agent-candidate.d.ts +191 -75
  22. package/dist/agent-candidate.test-fixture.d.ts +0 -26
  23. package/dist/agent-candidate.test-fixture.js +0 -26
  24. package/dist/agent-profile.d.ts +33 -9
  25. package/dist/harness-capabilities.d.ts +2 -2
  26. package/dist/harness-capabilities.js +23 -14
  27. package/dist/profile-schema.d.ts +65 -84
  28. package/dist/profile-schema.js +82 -32
  29. package/dist/profile-security.js +2 -0
  30. package/package.json +2 -2
@@ -0,0 +1,191 @@
1
+ import { z } from "zod";
2
+ import { agentCandidateArtifactRefSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, } from "./agent-candidate-artifact-schema.js";
3
+ import { agentCandidateBenchmarkGraderIdentitySchema, agentCandidateBenchmarkCellRefSchema, agentCandidateExecutionLimitsSchema, agentCandidateResolvedModelSchema, agentCandidateResolvedTaskContainerSchema, agentCandidateRetryPolicySchema, agentCandidateTaskRepositorySchema, agentCandidateTaskOutcomeSpecSchema, } from "./agent-candidate-execution-plan-schema.js";
4
+ import { isCanonicalJsonValue, isWellFormedUnicode, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
5
+ export const agentCandidateBenchmarkTaskMaterialSchema = z
6
+ .object({
7
+ kind: z.literal("agent-candidate-benchmark-task"),
8
+ digestAlgorithm: z.literal("rfc8785-sha256"),
9
+ benchmark: z
10
+ .object({
11
+ name: z.string().min(1).max(512),
12
+ version: z.string().min(1).max(256),
13
+ splitDigest: sha256DigestSchema,
14
+ })
15
+ .strict(),
16
+ scenario: z
17
+ .object({
18
+ id: z.string().min(1).max(512),
19
+ kind: z.string().min(1).max(512),
20
+ scenarioDigest: sha256DigestSchema,
21
+ })
22
+ .strict(),
23
+ datasetSnapshot: agentCandidateArtifactRefSchema.optional(),
24
+ instruction: z
25
+ .string()
26
+ .min(1)
27
+ .max(4 * 1024 * 1024)
28
+ .refine(isWellFormedUnicode, "task instruction must be well-formed Unicode"),
29
+ repository: agentCandidateTaskRepositorySchema.optional(),
30
+ outcome: agentCandidateTaskOutcomeSpecSchema,
31
+ workspace: agentCandidateWorkspaceSnapshotEvidenceSchema,
32
+ grader: agentCandidateBenchmarkGraderIdentitySchema,
33
+ model: agentCandidateResolvedModelSchema,
34
+ attempt: z
35
+ .object({
36
+ maxAttempts: z.number().int().min(1),
37
+ retryPolicy: agentCandidateRetryPolicySchema,
38
+ })
39
+ .strict(),
40
+ evaluatorTaskContainer: agentCandidateResolvedTaskContainerSchema.optional(),
41
+ limits: agentCandidateExecutionLimitsSchema,
42
+ })
43
+ .strict()
44
+ .superRefine((task, ctx) => {
45
+ if (!isCanonicalJsonValue(task)) {
46
+ ctx.addIssue({
47
+ code: "custom",
48
+ message: "candidate benchmark task must contain finite, acyclic canonical JSON",
49
+ });
50
+ }
51
+ if (task.outcome.kind === "workspace" && task.repository === undefined) {
52
+ ctx.addIssue({
53
+ code: "custom",
54
+ path: ["repository"],
55
+ message: "workspace outcomes require an exact source repository",
56
+ });
57
+ }
58
+ if (task.attempt.retryPolicy === "none" && task.attempt.maxAttempts !== 1) {
59
+ ctx.addIssue({
60
+ code: "custom",
61
+ path: ["attempt", "maxAttempts"],
62
+ message: "a no-retry task must allow exactly one attempt",
63
+ });
64
+ }
65
+ if (task.datasetSnapshot?.byteLength === 0) {
66
+ ctx.addIssue({
67
+ code: "custom",
68
+ path: ["datasetSnapshot", "byteLength"],
69
+ message: "dataset snapshot provenance must contain bytes",
70
+ });
71
+ }
72
+ });
73
+ /** Structural parse only; Runtime recomputes the canonical digest before use. */
74
+ export const agentCandidateBenchmarkTaskSchema = agentCandidateBenchmarkTaskMaterialSchema
75
+ .extend({ digest: sha256DigestSchema })
76
+ .strict();
77
+ export const agentCandidateBenchmarkSuiteMaterialSchema = z
78
+ .object({
79
+ kind: z.literal("agent-candidate-benchmark-suite"),
80
+ digestAlgorithm: z.literal("rfc8785-sha256"),
81
+ taskDigests: z
82
+ .tuple([sha256DigestSchema])
83
+ .rest(sha256DigestSchema),
84
+ reps: z.number().int().positive(),
85
+ seeds: z
86
+ .tuple([
87
+ z
88
+ .number()
89
+ .int()
90
+ .min(Number.MIN_SAFE_INTEGER)
91
+ .max(Number.MAX_SAFE_INTEGER),
92
+ ])
93
+ .rest(z
94
+ .number()
95
+ .int()
96
+ .min(Number.MIN_SAFE_INTEGER)
97
+ .max(Number.MAX_SAFE_INTEGER)),
98
+ })
99
+ .strict()
100
+ .superRefine((suite, ctx) => {
101
+ const taskDigests = new Set();
102
+ for (const [index, digest] of suite.taskDigests.entries()) {
103
+ if (taskDigests.has(digest)) {
104
+ ctx.addIssue({
105
+ code: "custom",
106
+ path: ["taskDigests", index],
107
+ message: "benchmark suite task digests must be unique",
108
+ });
109
+ }
110
+ taskDigests.add(digest);
111
+ }
112
+ const expectedSeeds = suite.taskDigests.length * suite.reps;
113
+ if (suite.seeds.length !== expectedSeeds) {
114
+ ctx.addIssue({
115
+ code: "custom",
116
+ path: ["seeds"],
117
+ message: "benchmark suite must provide one seed per task repetition",
118
+ });
119
+ }
120
+ if (!isCanonicalJsonValue(suite)) {
121
+ ctx.addIssue({
122
+ code: "custom",
123
+ message: "benchmark suite must contain finite, acyclic canonical JSON",
124
+ });
125
+ }
126
+ });
127
+ export const agentCandidateBenchmarkSuiteSchema = agentCandidateBenchmarkSuiteMaterialSchema
128
+ .extend({ digest: sha256DigestSchema })
129
+ .strict();
130
+ export const agentCandidateBenchmarkSuiteInputsSchema = z
131
+ .object({
132
+ suite: agentCandidateBenchmarkSuiteSchema,
133
+ tasks: z
134
+ .tuple([agentCandidateBenchmarkTaskSchema])
135
+ .rest(agentCandidateBenchmarkTaskSchema),
136
+ })
137
+ .strict()
138
+ .superRefine((input, ctx) => {
139
+ if (input.tasks.length !== input.suite.taskDigests.length) {
140
+ ctx.addIssue({
141
+ code: "custom",
142
+ path: ["tasks"],
143
+ message: "benchmark suite inputs must contain every signed task exactly once",
144
+ });
145
+ }
146
+ const taskIds = new Set();
147
+ const scenarioDigests = new Set();
148
+ const benchmark = input.tasks[0]?.benchmark;
149
+ for (const [index, task] of input.tasks.entries()) {
150
+ if (task.digest !== input.suite.taskDigests[index]) {
151
+ ctx.addIssue({
152
+ code: "custom",
153
+ path: ["tasks", index, "digest"],
154
+ message: "benchmark task order must match the signed suite",
155
+ });
156
+ }
157
+ if (taskIds.has(task.scenario.id)) {
158
+ ctx.addIssue({
159
+ code: "custom",
160
+ path: ["tasks", index, "scenario", "id"],
161
+ message: "benchmark suite task ids must be unique",
162
+ });
163
+ }
164
+ taskIds.add(task.scenario.id);
165
+ if (scenarioDigests.has(task.scenario.scenarioDigest)) {
166
+ ctx.addIssue({
167
+ code: "custom",
168
+ path: ["tasks", index, "scenario", "scenarioDigest"],
169
+ message: "benchmark suite scenario digests must be unique",
170
+ });
171
+ }
172
+ scenarioDigests.add(task.scenario.scenarioDigest);
173
+ if (benchmark &&
174
+ (task.benchmark.name !== benchmark.name ||
175
+ task.benchmark.version !== benchmark.version ||
176
+ task.benchmark.splitDigest !== benchmark.splitDigest)) {
177
+ ctx.addIssue({
178
+ code: "custom",
179
+ path: ["tasks", index, "benchmark"],
180
+ message: "benchmark suite tasks must share one benchmark identity",
181
+ });
182
+ }
183
+ }
184
+ if (!isCanonicalJsonValue(input)) {
185
+ ctx.addIssue({
186
+ code: "custom",
187
+ message: "benchmark suite inputs must contain finite, acyclic canonical JSON",
188
+ });
189
+ }
190
+ });
191
+ export { agentCandidateBenchmarkCellRefSchema };
@@ -1,4 +1,4 @@
1
- import type { AgentProfile, AgentProfileFileMount, AgentProfileHookCommand, AgentProfileMcpServer, AgentProfileMode, AgentProfileModelHints, AgentProfileResources, AgentSubagentProfile, ReasoningEffort } from "./agent-profile.js";
1
+ import type { AgentProfile, AgentProfileFileMount, AgentProfileHookCommand, AgentProfileMode, AgentProfileModelHints, AgentProfileResources, AgentSubagentProfile, ReasoningEffort } from "./agent-profile.js";
2
2
  import type { HarnessType } from "./harness.js";
3
3
  /** Full SHA-256 digest with an explicit algorithm prefix. */
4
4
  export type Sha256Digest = `sha256:${string}`;
@@ -78,11 +78,23 @@ export interface AgentCandidateResources extends Omit<AgentProfileResources, "fi
78
78
  instructions?: string | AgentCandidateResourceRef;
79
79
  failOnError: true;
80
80
  }
81
- export interface AgentCandidateMcpServer extends Omit<AgentProfileMcpServer, "transport" | "args" | "env" | "headers" | "url" | "metadata"> {
81
+ interface AgentCandidateLocalMcpServer {
82
82
  transport?: "stdio";
83
+ command: string;
83
84
  args?: AgentCandidateConfigValue[];
84
85
  env?: Record<string, AgentCandidateConfigValue>;
85
- }
86
+ cwd?: string;
87
+ enabled?: true;
88
+ }
89
+ interface AgentCandidateDisabledMcpServer {
90
+ enabled: false;
91
+ transport?: never;
92
+ command?: never;
93
+ args?: never;
94
+ env?: never;
95
+ cwd?: never;
96
+ }
97
+ export type AgentCandidateMcpServer = AgentCandidateLocalMcpServer | AgentCandidateDisabledMcpServer;
86
98
  export type AgentCandidateModelHints = Omit<AgentProfileModelHints, "metadata">;
87
99
  export type AgentCandidateSubagentProfile = Omit<AgentSubagentProfile, "metadata">;
88
100
  export type AgentCandidateMode = Omit<AgentProfileMode, "metadata">;
@@ -106,8 +118,6 @@ export interface AgentCandidateProfile extends Omit<AgentProfile, "model" | "mcp
106
118
  }
107
119
  export interface AgentCandidateCodeDisabled {
108
120
  kind: "disabled";
109
- /** `control` marks a comparison arm; `not-applicable` disables only the code surface. */
110
- reason: "control" | "not-applicable";
111
121
  }
112
122
  /** A code proposer ran against this exact tree and returned no change. */
113
123
  export interface AgentCandidateCodeNoOp {
@@ -224,14 +234,6 @@ export type AgentCandidateMemoryPolicy = {
224
234
  scope: "task";
225
235
  seed?: AgentCandidateArtifactRef;
226
236
  };
227
- /** Captured model spend for one phase of candidate production. */
228
- export interface AgentCandidateSpend {
229
- costUsd: number;
230
- inputTokens: number;
231
- outputTokens: number;
232
- cachedInputTokens?: number;
233
- modelCalls: number;
234
- }
235
237
  /** Lossless evaluator-owned usage totals for one candidate execution. */
236
238
  export interface AgentCandidateFixedSpend {
237
239
  inputTokens: number;
@@ -249,15 +251,8 @@ export interface AgentCandidateLineage {
249
251
  runIds?: string[];
250
252
  profileDiffIds?: string[];
251
253
  modelSnapshots?: string[];
252
- benchmark?: {
253
- name: string;
254
- version: string;
255
- splitDigest: Sha256Digest;
256
- };
257
- spend?: {
258
- proposal: AgentCandidateSpend;
259
- evaluation: AgentCandidateSpend;
260
- };
254
+ /** Exact development split used to produce a generated candidate. */
255
+ developmentSplitDigest?: Sha256Digest;
261
256
  }
262
257
  /**
263
258
  * Portable, immutable output of agent improvement.
@@ -275,7 +270,6 @@ export interface AgentCandidateBundle {
275
270
  execution: AgentCandidateExecution;
276
271
  knowledge?: AgentCandidateKnowledge;
277
272
  memory: AgentCandidateMemoryPolicy;
278
- lineage: AgentCandidateLineage;
279
273
  digest: Sha256Digest;
280
274
  }
281
275
  export interface AgentCandidateEntrypointReceipt {
@@ -288,6 +282,14 @@ export interface AgentCandidateOciPlatform {
288
282
  architecture: string;
289
283
  variant?: string;
290
284
  }
285
+ /** Exact evaluator-selected task image used when the candidate does not pin one. */
286
+ export interface AgentCandidateResolvedTaskContainer {
287
+ source: "evaluator-task-container";
288
+ image: string;
289
+ indexDigest: Sha256Digest;
290
+ manifestDigest: Sha256Digest;
291
+ platform: AgentCandidateOciPlatform;
292
+ }
291
293
  export interface AgentCandidateResolvedModel {
292
294
  requested: string;
293
295
  provider: string;
@@ -297,6 +299,8 @@ export interface AgentCandidateResolvedModel {
297
299
  }
298
300
  /** Canonical, digest-free profile-plan identity document. */
299
301
  export interface AgentCandidateProfilePlanMaterial {
302
+ /** Canonical digest of the complete frozen profile that produced this plan. */
303
+ sourceProfileDigest: Sha256Digest;
300
304
  harness: HarnessType;
301
305
  files: Array<{
302
306
  relPath: string;
@@ -305,6 +309,8 @@ export interface AgentCandidateProfilePlanMaterial {
305
309
  }>;
306
310
  env: Record<string, AgentCandidateConfigValue>;
307
311
  flags: AgentCandidateConfigValue[];
312
+ /** Exact system-prompt replacement supplied to the harness, when supported. */
313
+ systemPrompt?: AgentCandidateConfigValue;
308
314
  unsupported: Array<{
309
315
  dimension: string;
310
316
  reason: string;
@@ -390,6 +396,103 @@ export type AgentCandidateTaskOutcomeSpec = {
390
396
  } | ({
391
397
  kind: "output";
392
398
  } & AgentCandidateTaskOutputSpec);
399
+ /** Immutable grader identity admitted for one benchmark task. */
400
+ export interface AgentCandidateBenchmarkGraderIdentity {
401
+ name: string;
402
+ version: string;
403
+ format: "tangle-grader";
404
+ artifact: AgentCandidateArtifactRef;
405
+ }
406
+ /** Portable task bytes shared by evaluation, approval, and execution. */
407
+ export interface AgentCandidateBenchmarkTaskMaterial {
408
+ kind: "agent-candidate-benchmark-task";
409
+ digestAlgorithm: AgentCandidateDigestAlgorithm;
410
+ benchmark: {
411
+ name: string;
412
+ version: string;
413
+ splitDigest: Sha256Digest;
414
+ };
415
+ scenario: {
416
+ id: string;
417
+ kind: string;
418
+ scenarioDigest: Sha256Digest;
419
+ };
420
+ datasetSnapshot?: AgentCandidateArtifactRef;
421
+ instruction: string;
422
+ repository?: AgentCandidateTaskRepository;
423
+ outcome: AgentCandidateTaskOutcomeSpec;
424
+ workspace: AgentCandidateWorkspaceSnapshotEvidence;
425
+ grader: AgentCandidateBenchmarkGraderIdentity;
426
+ model: AgentCandidateResolvedModel;
427
+ attempt: Omit<AgentCandidateAttemptPolicy, "number">;
428
+ evaluatorTaskContainer?: AgentCandidateResolvedTaskContainer;
429
+ limits: AgentCandidateExecutionLimits;
430
+ }
431
+ /** Content-addressed benchmark task approved and executed without reinterpretation. */
432
+ export interface AgentCandidateBenchmarkTask extends AgentCandidateBenchmarkTaskMaterial {
433
+ digest: Sha256Digest;
434
+ }
435
+ /** Complete measured denominator shared by evaluation and execution. */
436
+ export interface AgentCandidateBenchmarkSuiteMaterial {
437
+ kind: "agent-candidate-benchmark-suite";
438
+ digestAlgorithm: AgentCandidateDigestAlgorithm;
439
+ taskDigests: [Sha256Digest, ...Sha256Digest[]];
440
+ reps: number;
441
+ /** Task-major, then repetition-major: seeds[taskIndex * reps + repetition]. */
442
+ seeds: [number, ...number[]];
443
+ }
444
+ export interface AgentCandidateBenchmarkSuite extends AgentCandidateBenchmarkSuiteMaterial {
445
+ digest: Sha256Digest;
446
+ }
447
+ /** Canonical task documents transported alongside their signed suite. */
448
+ export interface AgentCandidateBenchmarkSuiteInputs {
449
+ suite: AgentCandidateBenchmarkSuite;
450
+ tasks: [AgentCandidateBenchmarkTask, ...AgentCandidateBenchmarkTask[]];
451
+ }
452
+ /** One cell in a signed suite; task identity and seed are derived by position. */
453
+ export interface AgentCandidateBenchmarkCellRef {
454
+ suiteDigest: Sha256Digest;
455
+ taskIndex: number;
456
+ repetition: number;
457
+ }
458
+ /** Decision rules frozen before either experiment arm executes. */
459
+ export interface AgentCandidateEvaluationPolicy {
460
+ confidenceLevel: number;
461
+ resamples: number;
462
+ bootstrapSeed: number;
463
+ deltaThreshold: number;
464
+ minProductiveRuns: number;
465
+ budgetUsd?: number;
466
+ criticalDimensions: string[];
467
+ regressionTolerance: number;
468
+ }
469
+ /** Both complete agent states and the exact held-out work used to compare them. */
470
+ export interface AgentCandidateExperimentMaterial {
471
+ kind: "agent-candidate-experiment";
472
+ digestAlgorithm: AgentCandidateDigestAlgorithm;
473
+ baseline: AgentCandidateBundle;
474
+ candidate: AgentCandidateBundle;
475
+ candidateLineage: AgentCandidateLineage;
476
+ benchmark: AgentCandidateBenchmarkSuiteInputs;
477
+ policy: AgentCandidateEvaluationPolicy;
478
+ }
479
+ export interface AgentCandidateExperiment extends AgentCandidateExperimentMaterial {
480
+ digest: Sha256Digest;
481
+ }
482
+ /** Digest-free identity of one exact attempt in a frozen experiment. */
483
+ export interface AgentCandidateRunCellMaterial extends AgentCandidateBenchmarkCellRef {
484
+ kind: "agent-candidate-run-cell";
485
+ experimentDigest: Sha256Digest;
486
+ arm: "baseline" | "candidate";
487
+ bundleDigest: Sha256Digest;
488
+ taskDigest: Sha256Digest;
489
+ seed: number;
490
+ attempt: number;
491
+ }
492
+ /** One immutable experiment attempt used by plans, receipts, traces, and results. */
493
+ export interface AgentCandidateRunCell extends AgentCandidateRunCellMaterial {
494
+ digest: Sha256Digest;
495
+ }
393
496
  /**
394
497
  * Canonical, digest-free per-task execution identity document.
395
498
  *
@@ -398,24 +501,8 @@ export type AgentCandidateTaskOutcomeSpec = {
398
501
  */
399
502
  export interface AgentCandidateExecutionPlanMaterial {
400
503
  kind: "agent-candidate-execution-plan-material";
401
- bundleDigest: Sha256Digest;
504
+ runCell: AgentCandidateRunCell;
402
505
  executionId: string;
403
- attempt: AgentCandidateAttemptPolicy;
404
- task: {
405
- benchmark: string;
406
- benchmarkVersion: string;
407
- taskId: string;
408
- splitDigest: Sha256Digest;
409
- instruction: {
410
- encoding: "utf8";
411
- sha256: Sha256Digest;
412
- byteLength: number;
413
- delivery: AgentCandidateInstructionDelivery;
414
- };
415
- repository?: AgentCandidateTaskRepository;
416
- outcome: AgentCandidateTaskOutcomeSpec;
417
- workspace: AgentCandidateWorkspaceSnapshotEvidence;
418
- };
419
506
  workspaces: {
420
507
  taskRoot: string;
421
508
  candidateRoot?: string;
@@ -425,6 +512,8 @@ export interface AgentCandidateExecutionPlanMaterial {
425
512
  profile: AgentCandidateProfileApplication;
426
513
  harness: HarnessType;
427
514
  harnessVersion: string;
515
+ instructionDelivery: AgentCandidateInstructionDelivery;
516
+ limits: AgentCandidateExecutionLimits;
428
517
  container: {
429
518
  source: AgentCandidateExecutionEnvironment["kind"];
430
519
  image: string;
@@ -456,12 +545,6 @@ export interface AgentCandidateExecutionPlanMaterial {
456
545
  requested: string;
457
546
  }>;
458
547
  };
459
- /** Exact evaluator grader implementation admitted for this plan. */
460
- grader: {
461
- name: string;
462
- version: string;
463
- artifact: AgentCandidateArtifactRef;
464
- };
465
548
  launch: {
466
549
  executable: string;
467
550
  args: AgentCandidateConfigValue[];
@@ -470,7 +553,6 @@ export interface AgentCandidateExecutionPlanMaterial {
470
553
  };
471
554
  knowledgeManifestDigest?: Sha256Digest;
472
555
  memory: AgentCandidateEffectiveMemory;
473
- limits: AgentCandidateExecutionLimits;
474
556
  network: {
475
557
  mode: "disabled";
476
558
  };
@@ -498,6 +580,17 @@ export interface AgentCandidateExecutionPlanEvidence {
498
580
  material: AgentCandidateExecutionPlanMaterial;
499
581
  artifact: AgentCandidateCapturedArtifact;
500
582
  }
583
+ /** Exact suite and task material selected for one execution plan. */
584
+ export interface AgentCandidateBenchmarkInputEvidence {
585
+ suite: {
586
+ digest: Sha256Digest;
587
+ material: AgentCandidateCapturedArtifact;
588
+ };
589
+ task: {
590
+ digest: Sha256Digest;
591
+ material: AgentCandidateCapturedArtifact;
592
+ };
593
+ }
501
594
  export interface AgentCandidateTraceEvidence {
502
595
  artifact: AgentCandidateCapturedArtifact;
503
596
  eventCount: number;
@@ -518,7 +611,8 @@ export interface AgentCandidateMaterializationReceipt {
518
611
  kind: "agent-candidate-materialization";
519
612
  digestAlgorithm: AgentCandidateDigestAlgorithm;
520
613
  bundleDigest: Sha256Digest;
521
- profilePlan: AgentCandidateProfilePlanEvidence;
614
+ benchmark: AgentCandidateBenchmarkInputEvidence;
615
+ profileActivation: AgentCandidateProfileActivation;
522
616
  executionPlan: AgentCandidateExecutionPlanEvidence;
523
617
  candidateWorkspace?: AgentCandidateWorkspaceSnapshotEvidence;
524
618
  codeKind: AgentCandidateCode["kind"];
@@ -555,8 +649,14 @@ export interface AgentCandidateRunReceipt {
555
649
  kind: "agent-candidate-run";
556
650
  digestAlgorithm: AgentCandidateDigestAlgorithm;
557
651
  bundleDigest: Sha256Digest;
652
+ runCellDigest: Sha256Digest;
558
653
  materializationReceiptDigest: Sha256Digest;
559
654
  executionPlanDigest: Sha256Digest;
655
+ timing: {
656
+ startedAtMs: number;
657
+ endedAtMs: number;
658
+ durationMs: number;
659
+ };
560
660
  memory: AgentCandidateMemoryReceipt;
561
661
  trace: AgentCandidateTraceEvidence;
562
662
  termination: AgentCandidateTermination;
@@ -567,16 +667,16 @@ export interface AgentCandidateRunReceipt {
567
667
  digest: Sha256Digest;
568
668
  }
569
669
  export type AgentImprovementSurface = "prompt" | "skills" | "tools" | "mcp" | "hooks" | "subagents" | "agent-profile" | "memory" | "code" | "knowledge";
670
+ /** One paired Runtime execution from the exact signed experiment. */
671
+ export interface AgentCandidateExperimentMeasurement {
672
+ baseline: CandidateExecutionEvidence;
673
+ candidate: CandidateExecutionEvidence;
674
+ }
570
675
  /** Portable paired held-out comparison produced by an evaluation package. */
571
676
  export interface AgentImprovementMeasuredComparison {
572
677
  kind: "agent-improvement-measured-comparison";
573
- benchmark: {
574
- name: string;
575
- version: string;
576
- splitDigest: Sha256Digest;
577
- };
578
- baselineProfileDigest: Sha256Digest;
579
- candidateBundleDigest: Sha256Digest;
678
+ experiment: AgentCandidateExperiment;
679
+ measurements: AgentCandidateExperimentMeasurement[];
580
680
  overall: {
581
681
  name: "composite";
582
682
  baseline: number;
@@ -665,7 +765,11 @@ export interface AgentImprovementMeasuredComparison {
665
765
  diff: string;
666
766
  evaluation: {
667
767
  generationsExplored: number;
768
+ searchDurationMs: number;
769
+ executionDurationMs: number;
668
770
  durationMs: number;
771
+ searchCostUsd: number;
772
+ executionCostUsd: number;
669
773
  totalCostUsd: number;
670
774
  };
671
775
  metadata?: {
@@ -677,12 +781,10 @@ export interface AgentImprovementProposal {
677
781
  runId: string;
678
782
  changedSurfaces: [AgentImprovementSurface, ...AgentImprovementSurface[]];
679
783
  proposedAt: string;
680
- baselineProfile: AgentProfile;
681
784
  findings: {
682
785
  [key: string]: AgentCandidateJsonValue;
683
786
  }[];
684
787
  evaluation: AgentImprovementMeasuredComparison;
685
- candidateBundle: AgentCandidateBundle;
686
788
  digest: Sha256Digest;
687
789
  }
688
790
  export type AgentImprovementReviewDecision = "approve" | "reject" | "request-changes";
@@ -690,7 +792,6 @@ export type AgentImprovementReviewDecision = "approve" | "reject" | "request-cha
690
792
  export interface AgentImprovementReview {
691
793
  kind: "agent-improvement-review";
692
794
  proposalDigest: Sha256Digest;
693
- candidateBundleDigest: Sha256Digest;
694
795
  decision: AgentImprovementReviewDecision;
695
796
  reviewedBy: string;
696
797
  reviewedAt: string;
@@ -698,15 +799,30 @@ export interface AgentImprovementReview {
698
799
  feedback?: string;
699
800
  digest: Sha256Digest;
700
801
  }
701
- /** Successful post-approval execution, carrying the exact Runtime receipt. */
702
- export interface CandidateExecutionEvidence {
703
- kind: "agent-candidate-execution-evidence";
802
+ export interface AgentImprovementActivationTarget {
803
+ surface: AgentImprovementSurface;
804
+ /** Product-owned stable identity, such as an agent profile, repository, or knowledge base. */
805
+ identity: string;
806
+ /** Current target state that activation is allowed to replace. */
807
+ expectedBaseDigest: Sha256Digest;
808
+ }
809
+ /** Authority receipt permitting activation of one already-measured candidate. */
810
+ export interface AgentImprovementActivation {
811
+ kind: "agent-improvement-activation";
704
812
  proposalDigest: Sha256Digest;
705
813
  reviewDigest: Sha256Digest;
706
- executionId: string;
707
- succeeded: true;
814
+ experimentDigest: Sha256Digest;
815
+ candidateBundleDigest: Sha256Digest;
816
+ targets: [AgentImprovementActivationTarget, ...AgentImprovementActivationTarget[]];
817
+ fundingOwner: string;
818
+ authorizedBy: string;
819
+ authorizedAt: string;
820
+ digest: Sha256Digest;
821
+ }
822
+ /** Complete execution of one exact experiment attempt. */
823
+ export interface CandidateExecutionEvidence {
824
+ kind: "agent-candidate-execution-evidence";
708
825
  materializationReceipt: AgentCandidateMaterializationReceipt;
709
- profileActivation: AgentCandidateProfileActivation;
710
826
  receipt: AgentCandidateRunReceipt;
711
827
  digest: Sha256Digest;
712
828
  }
@@ -783,19 +899,18 @@ export interface AgentCandidateBenchmarkResultMaterial {
783
899
  kind: "agent-candidate-benchmark-result-material";
784
900
  executionPlanDigest: Sha256Digest;
785
901
  taskOutcomeDigest: Sha256Digest;
786
- benchmark: {
787
- name: string;
788
- version: string;
789
- taskId: string;
790
- splitDigest: Sha256Digest;
791
- };
792
- grader: {
793
- name: string;
794
- version: string;
795
- artifact: AgentCandidateArtifactRef;
796
- };
902
+ grader: AgentCandidateBenchmarkGraderIdentity;
797
903
  /** Raw grader output required to independently audit the reported verdict. */
798
904
  evidence: AgentCandidateArtifactRef;
905
+ /** Evaluator-owned model usage and elapsed time, separate from candidate usage. */
906
+ grading: {
907
+ usage: AgentCandidateFixedSpend;
908
+ timing: {
909
+ startedAtMs: number;
910
+ endedAtMs: number;
911
+ durationMs: number;
912
+ };
913
+ };
799
914
  score: number;
800
915
  passed: boolean;
801
916
  dimensions: AgentCandidateBenchmarkDimension[];
@@ -808,3 +923,4 @@ export interface AgentCandidateBenchmarkResultEvidence {
808
923
  }
809
924
  /** Declare a candidate bundle while retaining literal inference. */
810
925
  export declare function defineAgentCandidateBundle<T extends AgentCandidateBundle>(bundle: T): T;
926
+ export {};
@@ -158,31 +158,5 @@ export declare function candidateFixture(): {
158
158
  mode: "isolated";
159
159
  scope: "task";
160
160
  };
161
- lineage: {
162
- source: "optimizer";
163
- parentDigests: `sha256:${string}`[];
164
- runIds: string[];
165
- profileDiffIds: string[];
166
- modelSnapshots: string[];
167
- benchmark: {
168
- name: string;
169
- version: string;
170
- splitDigest: `sha256:${string}`;
171
- };
172
- spend: {
173
- proposal: {
174
- costUsd: number;
175
- inputTokens: number;
176
- outputTokens: number;
177
- modelCalls: number;
178
- };
179
- evaluation: {
180
- costUsd: number;
181
- inputTokens: number;
182
- outputTokens: number;
183
- modelCalls: number;
184
- };
185
- };
186
- };
187
161
  digest: `sha256:${string}`;
188
162
  };
@@ -148,32 +148,6 @@ export function candidateFixture() {
148
148
  mode: "isolated",
149
149
  scope: "task",
150
150
  },
151
- lineage: {
152
- source: "optimizer",
153
- parentDigests: [candidateSha("8")],
154
- runIds: ["r360-search"],
155
- profileDiffIds: ["profile-diff-3"],
156
- modelSnapshots: ["openai/gpt-5.4-2026-06-15"],
157
- benchmark: {
158
- name: "pier",
159
- version: "0.3",
160
- splitDigest: candidateSha("9"),
161
- },
162
- spend: {
163
- proposal: {
164
- costUsd: 3.5,
165
- inputTokens: 100,
166
- outputTokens: 20,
167
- modelCalls: 2,
168
- },
169
- evaluation: {
170
- costUsd: 9,
171
- inputTokens: 900,
172
- outputTokens: 200,
173
- modelCalls: 8,
174
- },
175
- },
176
- },
177
151
  digest: candidateSha("a"),
178
152
  });
179
153
  }