@tangle-network/agent-interface 5.10.23 → 5.10.25

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 (35) hide show
  1. package/README.md +30 -0
  2. package/dist/agent-candidate-code-schema.d.ts +7 -7
  3. package/dist/agent-candidate-execution-plan-schema.d.ts +21 -21
  4. package/dist/agent-candidate-profile-schema.d.ts +4 -4
  5. package/dist/agent-candidate-promotion-schema.d.ts +155 -80
  6. package/dist/agent-candidate-receipt-schema.d.ts +10 -10
  7. package/dist/agent-candidate-schema-common.d.ts +3 -3
  8. package/dist/agent-candidate-schema.d.ts +5 -5
  9. package/dist/agent-execution-preparation-receipt.d.ts +4 -2
  10. package/dist/agent-profile-improvement-schema.d.ts +469 -0
  11. package/dist/agent-profile-improvement-schema.js +116 -16
  12. package/dist/agent-profile-improvement.d.ts +34 -6
  13. package/dist/agent-profile-materialization.d.ts +1 -1
  14. package/dist/agent-profile-materialization.js +3 -0
  15. package/dist/agent-profile.d.ts +3 -0
  16. package/dist/agent-profile.js +0 -13
  17. package/dist/environment-interactive-control.d.ts +20 -10
  18. package/dist/environment-interactive-start.d.ts +6 -2
  19. package/dist/environment-observation.d.ts +3 -3
  20. package/dist/environment-provider.d.ts +1 -0
  21. package/dist/environment-provider.js +1 -0
  22. package/dist/environment-retained-file.d.ts +124 -0
  23. package/dist/environment-retained-file.js +37 -0
  24. package/dist/environment-runtime.d.ts +23 -6
  25. package/dist/environment-runtime.js +1 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/portable-context-transfer.d.ts +6 -2
  29. package/dist/profile-diff.d.ts +2 -1
  30. package/dist/profile-diff.js +3 -0
  31. package/dist/profile-file-output.d.ts +10 -0
  32. package/dist/profile-file-output.js +8 -0
  33. package/dist/profile-schema.d.ts +15 -10
  34. package/dist/profile-schema.js +3 -0
  35. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { changedAgentProfileAxes } from "./profile-diff.js";
2
+ import { applyAgentProfileDiff, changedAgentProfileAxes } from "./profile-diff.js";
3
3
  import { agentCandidateLineageSchema, isGeneratedCandidateSource, } from "./agent-candidate-lineage-schema.js";
4
4
  import { canonicalCandidateDigest, isCanonicalJsonValue, omitTopLevelDigest, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
5
5
  import { refineAgentExecutionWithinLimits } from "./agent-execution-limits.js";
@@ -8,7 +8,7 @@ import { agentCandidateBenchmarkDimensionSchema, agentCandidateFixedSpendSchema,
8
8
  import { agentCandidateEvaluationPolicySchema, createMeasuredComparisonIdentityRegistry, measuredComparisonCommonShape, refineMeasuredComparisonSummary, } from "./agent-improvement-measurement-schema.js";
9
9
  import { agentImprovementSourceSchema } from "./agent-improvement-source.js";
10
10
  import { numbersApproximatelyEqual } from "./number-validation.js";
11
- import { agentProfileDiffSchema } from "./profile-schema.js";
11
+ import { agentProfileDiffSchema, agentProfileModelHintsSchema } from "./profile-schema.js";
12
12
  const profileImprovementScenarioSchema = z
13
13
  .object({
14
14
  id: z.string().min(1).max(500),
@@ -158,6 +158,54 @@ export const agentProfileImprovementChangeSchema = z
158
158
  });
159
159
  }
160
160
  });
161
+ const profileModelBindingArmSchema = z.strictObject({
162
+ authored: agentProfileModelHintsSchema,
163
+ resolved: agentCandidateResolvedModelSchema,
164
+ });
165
+ export const agentProfileImprovementModelBindingSchema = z.discriminatedUnion("kind", [
166
+ z.strictObject({ kind: z.literal("fixed-task") }),
167
+ z.strictObject({
168
+ kind: z.literal("profile-default"),
169
+ baseline: profileModelBindingArmSchema,
170
+ candidate: profileModelBindingArmSchema,
171
+ }),
172
+ ]);
173
+ /** One model-policy interpretation for schema, measurement and the source-owning executor.
174
+ * Pass the actual profile when sealing/executing to prove its authored default matches the binding.
175
+ * The host must independently observe the exact returned model and snapshot for each run. */
176
+ export function agentProfileImprovementExpectedModel(experiment, task, arm, profile) {
177
+ const policy = agentProfileImprovementModelBindingSchema.parse(experiment.modelBinding ?? { kind: "fixed-task" });
178
+ if (policy.kind === "fixed-task")
179
+ return agentCandidateResolvedModelSchema.parse(task.model);
180
+ for (const binding of [policy.baseline, policy.candidate]) {
181
+ const { authored, resolved } = binding;
182
+ const { default: requested, provider, reasoningEffort } = authored;
183
+ const concrete = (value) => value !== undefined && /^[A-Za-z0-9][A-Za-z0-9._:/@+-]*$/.test(value);
184
+ if (!concrete(requested) || !concrete(provider) || reasoningEffort === undefined ||
185
+ authored.small !== undefined || authored.metadata !== undefined)
186
+ throw new Error("profile model binding requires an exact static default/provider/effort without fallback or metadata routing");
187
+ const model = requested.startsWith(`${provider}/`)
188
+ ? requested.slice(provider.length + 1) : requested;
189
+ if (resolved.requested !== requested || resolved.provider !== provider ||
190
+ resolved.reasoningEffort !== reasoningEffort || resolved.model !== model ||
191
+ !concrete(resolved.snapshot))
192
+ throw new Error("profile model binding contradicts its authored default or exact resolved identity");
193
+ }
194
+ if (canonicalCandidateDigest(task.model) !== canonicalCandidateDigest(policy.baseline.resolved))
195
+ throw new Error("profile model treatment task.model must equal the exact baseline model");
196
+ const changed = experiment.change.reduce((value, diff) => applyAgentProfileDiff(value, diff), { model: policy.baseline.authored });
197
+ if (changed.seats?.length || Object.values(changed.modes ?? {}).some(value => value.model !== undefined) || Object.values(changed.subagents ?? {}).some(value => value.model !== undefined))
198
+ throw new Error("profile model binding does not permit fallback or alternate model routes");
199
+ if (canonicalCandidateDigest(changed.model) !== canonicalCandidateDigest(policy.candidate.authored))
200
+ throw new Error("profile model binding contradicts the measured profile changes");
201
+ const expected = policy[arm];
202
+ if (profile && (canonicalCandidateDigest(profile.model) !== canonicalCandidateDigest(expected.authored) ||
203
+ profile.seats?.length ||
204
+ Object.values(profile.modes ?? {}).some(value => value.model !== undefined) ||
205
+ Object.values(profile.subagents ?? {}).some(value => value.model !== undefined)))
206
+ throw new Error("profile model binding does not describe the exact static single-model profile");
207
+ return expected.resolved;
208
+ }
161
209
  export const agentProfileImprovementExperimentSchema = z
162
210
  .object({
163
211
  kind: z.literal("agent-profile-improvement-experiment"),
@@ -167,6 +215,7 @@ export const agentProfileImprovementExperimentSchema = z
167
215
  baseline: agentProfileImprovementArmSchema,
168
216
  candidate: agentProfileImprovementArmSchema,
169
217
  change: agentProfileImprovementChangeSchema,
218
+ modelBinding: agentProfileImprovementModelBindingSchema.optional(),
170
219
  candidateLineage: agentCandidateLineageSchema,
171
220
  benchmark: agentProfileImprovementSuiteInputsSchema,
172
221
  policy: agentCandidateEvaluationPolicySchema,
@@ -174,6 +223,14 @@ export const agentProfileImprovementExperimentSchema = z
174
223
  })
175
224
  .strict()
176
225
  .superRefine((experiment, ctx) => {
226
+ try {
227
+ for (const task of experiment.benchmark.tasks)
228
+ for (const arm of ["baseline", "candidate"])
229
+ agentProfileImprovementExpectedModel(experiment, task, arm);
230
+ }
231
+ catch (error) {
232
+ ctx.addIssue({ code: "custom", path: ["modelBinding"], message: error instanceof Error ? error.message : "Invalid profile model binding" });
233
+ }
177
234
  if (experiment.baseline.stateDigest !== experiment.source.sourceDigest) {
178
235
  ctx.addIssue({
179
236
  code: "custom",
@@ -260,8 +317,7 @@ const timingSchema = z
260
317
  });
261
318
  }
262
319
  });
263
- const agentProfileImprovementGradingSchema = z
264
- .object({
320
+ const profileGradingShape = {
265
321
  grader: agentCandidateBenchmarkGraderIdentitySchema,
266
322
  evidence: profileImprovementEvidenceSchema,
267
323
  timing: timingSchema,
@@ -269,9 +325,8 @@ const agentProfileImprovementGradingSchema = z
269
325
  score: z.number().finite(),
270
326
  passed: z.boolean(),
271
327
  dimensions: z.array(agentCandidateBenchmarkDimensionSchema),
272
- })
273
- .strict()
274
- .superRefine((grading, ctx) => {
328
+ };
329
+ function refineProfileGrading(grading, ctx) {
275
330
  const names = grading.dimensions.map((dimension) => dimension.name);
276
331
  if (new Set(names).size !== names.length) {
277
332
  ctx.addIssue({
@@ -287,9 +342,31 @@ const agentProfileImprovementGradingSchema = z
287
342
  message: "profile improvement grading evidence must be distinct from its grader",
288
343
  });
289
344
  }
345
+ }
346
+ const agentProfileImprovementGradingSchema = z.strictObject(profileGradingShape).superRefine(refineProfileGrading);
347
+ export const agentProfileImprovementUnavailableAccountingSchema = z.strictObject({
348
+ availability: z.literal("unavailable"),
349
+ reason: z.string().min(1).max(4000),
350
+ facts: z.strictObject({
351
+ inputTokens: agentCandidateFixedSpendSchema.shape.inputTokens.nullable(),
352
+ outputTokens: agentCandidateFixedSpendSchema.shape.outputTokens.nullable(),
353
+ cachedInputTokens: agentCandidateFixedSpendSchema.shape.cachedInputTokens.nullable(),
354
+ reasoningTokens: agentCandidateFixedSpendSchema.shape.reasoningTokens.nullable(),
355
+ modelCalls: agentCandidateFixedSpendSchema.shape.modelCalls.nullable(),
356
+ costUsdNanos: agentCandidateFixedSpendSchema.shape.costUsdNanos.nullable(),
357
+ costProvenance: agentCandidateFixedSpendSchema.shape.costProvenance.nullable(),
358
+ }),
359
+ }).superRefine((accounting, ctx) => {
360
+ if (!Object.values(accounting.facts).includes(null))
361
+ ctx.addIssue({ code: "custom", path: ["facts"], message: "complete accounting must use the fixed-spend contract" });
362
+ if ((accounting.facts.costUsdNanos === null) !== (accounting.facts.costProvenance === null))
363
+ ctx.addIssue({ code: "custom", path: ["facts", "costProvenance"], message: "known cost and provenance must be retained together" });
290
364
  });
291
- export const agentProfileImprovementRunReceiptSchema = z
292
- .object({
365
+ export const agentProfileImprovementAccountingSchema = z.union([agentCandidateFixedSpendSchema, agentProfileImprovementUnavailableAccountingSchema]);
366
+ export function isAgentProfileImprovementAccountingUnavailable(accounting) {
367
+ return "availability" in accounting;
368
+ }
369
+ const profileRunReceiptShape = {
293
370
  kind: z.literal("agent-profile-improvement-run"),
294
371
  digestAlgorithm: z.literal("rfc8785-sha256"),
295
372
  executionId: z.string().min(1).max(500),
@@ -324,9 +401,8 @@ export const agentProfileImprovementRunReceiptSchema = z
324
401
  ]),
325
402
  grading: agentProfileImprovementGradingSchema,
326
403
  digest: sha256DigestSchema,
327
- })
328
- .strict()
329
- .superRefine((receipt, ctx) => {
404
+ };
405
+ function refineProfileRunReceipt(receipt, ctx) {
330
406
  if (evidenceKey(receipt.output) === evidenceKey(receipt.grading.evidence)) {
331
407
  ctx.addIssue({
332
408
  code: "custom",
@@ -334,7 +410,8 @@ export const agentProfileImprovementRunReceiptSchema = z
334
410
  message: "profile improvement grading evidence must be distinct from the agent output",
335
411
  });
336
412
  }
337
- if (receipt.trace.modelCallCount !== receipt.usage.modelCalls) {
413
+ const executionUsage = isAgentProfileImprovementAccountingUnavailable(receipt.usage) ? receipt.usage.facts : receipt.usage;
414
+ if (executionUsage.modelCalls !== null && receipt.trace.modelCallCount !== executionUsage.modelCalls) {
338
415
  ctx.addIssue({
339
416
  code: "custom",
340
417
  path: ["trace", "modelCallCount"],
@@ -348,10 +425,18 @@ export const agentProfileImprovementRunReceiptSchema = z
348
425
  message: "profile trace must retain at least one event for every model call",
349
426
  });
350
427
  }
428
+ // Missing nonnegative counters supply only lower bounds for refusing known limit violations.
429
+ // These values are never persisted as measured usage or admitted to a comparison.
430
+ const lowerBound = (usage) => {
431
+ if (!isAgentProfileImprovementAccountingUnavailable(usage))
432
+ return usage;
433
+ const { facts } = usage;
434
+ return { inputTokens: facts.inputTokens ?? 0, outputTokens: facts.outputTokens ?? 0, cachedInputTokens: facts.cachedInputTokens ?? 0, reasoningTokens: facts.reasoningTokens ?? 0, modelCalls: facts.modelCalls ?? 0, costUsdNanos: facts.costUsdNanos ?? 0, costProvenance: facts.costProvenance ?? "estimated" };
435
+ };
351
436
  refineAgentExecutionWithinLimits(receipt.limits, {
352
437
  durationMs: receipt.timing.durationMs,
353
438
  steps: receipt.steps,
354
- usage: combinedProfileUsage(receipt.usage, receipt.grading.usage),
439
+ usage: combinedProfileUsage(lowerBound(receipt.usage), lowerBound(receipt.grading.usage)),
355
440
  }, ctx);
356
441
  const billing = receipt.billing.map(evidenceKey);
357
442
  if (new Set(billing).size !== billing.length) {
@@ -368,7 +453,14 @@ export const agentProfileImprovementRunReceiptSchema = z
368
453
  message: "profile improvement run receipt digest is invalid",
369
454
  });
370
455
  }
371
- });
456
+ }
457
+ export const agentProfileImprovementRunReceiptSchema = z.strictObject(profileRunReceiptShape).superRefine(refineProfileRunReceipt);
458
+ /** Opt-in recording preserves gaps; the publishable comparison still accepts only complete receipts. */
459
+ export const agentProfileImprovementRecordedRunReceiptSchema = z.strictObject({
460
+ ...profileRunReceiptShape,
461
+ usage: agentProfileImprovementAccountingSchema,
462
+ grading: z.strictObject({ ...profileGradingShape, usage: agentProfileImprovementAccountingSchema }).superRefine(refineProfileGrading),
463
+ }).superRefine(refineProfileRunReceipt);
372
464
  function combinedProfileUsage(execution, grading) {
373
465
  return {
374
466
  inputTokens: execution.inputTokens + grading.inputTokens,
@@ -507,6 +599,14 @@ function refineProfileImprovementComparison(comparison, ctx) {
507
599
  const cell = receipt.runCell;
508
600
  const profile = comparison.experiment[arm];
509
601
  const armPath = ["measurements", index, arm];
602
+ let expectedModel;
603
+ try {
604
+ expectedModel = agentProfileImprovementExpectedModel(comparison.experiment, task, arm);
605
+ }
606
+ catch (error) {
607
+ ctx.addIssue({ code: "custom", path: ["experiment", "modelBinding"], message: error instanceof Error ? error.message : "Invalid profile model binding" });
608
+ continue;
609
+ }
510
610
  const checks = [
511
611
  [
512
612
  cell.experimentDigest === comparison.experiment.digest,
@@ -544,7 +644,7 @@ function refineProfileImprovementComparison(comparison, ctx) {
544
644
  "profile run receipt must bind the signed evaluator",
545
645
  ],
546
646
  [
547
- JSON.stringify(receipt.resolvedModel) === JSON.stringify(task.model),
647
+ canonicalCandidateDigest(receipt.resolvedModel) === canonicalCandidateDigest(expectedModel),
548
648
  [...armPath, "resolvedModel"],
549
649
  "profile run receipt must bind the signed model snapshot",
550
650
  ],
@@ -1,5 +1,6 @@
1
1
  import type { AgentCandidateBenchmarkDimension, AgentCandidateBenchmarkGraderIdentity, AgentCandidateDigestAlgorithm, AgentCandidateEvaluationPolicy, AgentCandidateExecutionLimits, AgentCandidateFixedSpend, AgentCandidateLineage, AgentCandidateResolvedModel, AgentImprovementMeasuredComparisonBase, Sha256Digest } from "./agent-candidate.js";
2
2
  import type { AgentImprovementSource } from "./agent-improvement-source.js";
3
+ import type { AgentProfileModelHints } from "./agent-profile.js";
3
4
  import type { AgentProfileDiff } from "./profile-diff.js";
4
5
  /** An access-controlled evidence record emitted by a host-owned profile run. */
5
6
  export interface AgentProfileImprovementEvidence {
@@ -57,6 +58,20 @@ export interface AgentProfileImprovementExecutionRef extends AgentProfileImprove
57
58
  * control and redaction.
58
59
  */
59
60
  export type AgentProfileImprovementChange = [AgentProfileDiff, ...AgentProfileDiff[]];
61
+ /** Fixed-task is the historical default. Profile-default explicitly treats model selection. */
62
+ export type AgentProfileImprovementModelBinding = {
63
+ kind: "fixed-task";
64
+ } | {
65
+ kind: "profile-default";
66
+ baseline: {
67
+ authored: AgentProfileModelHints;
68
+ resolved: AgentCandidateResolvedModel;
69
+ };
70
+ candidate: {
71
+ authored: AgentProfileModelHints;
72
+ resolved: AgentCandidateResolvedModel;
73
+ };
74
+ };
60
75
  /** A measured comparison of two states of one host-owned agent profile. */
61
76
  export interface AgentProfileImprovementExperimentMaterial {
62
77
  kind: "agent-profile-improvement-experiment";
@@ -66,6 +81,7 @@ export interface AgentProfileImprovementExperimentMaterial {
66
81
  baseline: AgentProfileImprovementArm;
67
82
  candidate: AgentProfileImprovementArm;
68
83
  change: AgentProfileImprovementChange;
84
+ modelBinding?: AgentProfileImprovementModelBinding;
69
85
  candidateLineage: AgentCandidateLineage;
70
86
  benchmark: AgentProfileImprovementSuiteInputs;
71
87
  policy: AgentCandidateEvaluationPolicy;
@@ -89,8 +105,17 @@ export interface AgentProfileImprovementRunCellMaterial {
89
105
  export interface AgentProfileImprovementRunCell extends AgentProfileImprovementRunCellMaterial {
90
106
  digest: Sha256Digest;
91
107
  }
108
+ /** Missing profile-run facts remain explicit; this branch cannot support promotion. */
109
+ export interface AgentProfileImprovementUnavailableAccounting {
110
+ availability: "unavailable";
111
+ reason: string;
112
+ facts: {
113
+ [K in keyof AgentCandidateFixedSpend]: AgentCandidateFixedSpend[K] | null;
114
+ };
115
+ }
116
+ export type AgentProfileImprovementAccounting = AgentCandidateFixedSpend | AgentProfileImprovementUnavailableAccounting;
92
117
  /** Verifiable output from one profile execution and its frozen evaluator. */
93
- export interface AgentProfileImprovementRunReceipt {
118
+ export interface AgentProfileImprovementRunReceipt<TAccounting extends AgentProfileImprovementAccounting = AgentCandidateFixedSpend> {
94
119
  kind: "agent-profile-improvement-run";
95
120
  digestAlgorithm: AgentCandidateDigestAlgorithm;
96
121
  executionId: string;
@@ -106,7 +131,7 @@ export interface AgentProfileImprovementRunReceipt {
106
131
  steps: number;
107
132
  resolvedModel: AgentCandidateResolvedModel;
108
133
  limits: AgentCandidateExecutionLimits;
109
- usage: AgentCandidateFixedSpend;
134
+ usage: TAccounting;
110
135
  trace: {
111
136
  evidence: AgentProfileImprovementEvidence;
112
137
  eventCount: number;
@@ -128,7 +153,7 @@ export interface AgentProfileImprovementRunReceipt {
128
153
  endedAtMs: number;
129
154
  durationMs: number;
130
155
  };
131
- usage: AgentCandidateFixedSpend;
156
+ usage: TAccounting;
132
157
  score: number;
133
158
  passed: boolean;
134
159
  dimensions: AgentCandidateBenchmarkDimension[];
@@ -136,10 +161,13 @@ export interface AgentProfileImprovementRunReceipt {
136
161
  digest: Sha256Digest;
137
162
  }
138
163
  /** One paired result from the exact same task, seed, and evaluator. */
139
- export interface AgentProfileImprovementMeasurement {
140
- baseline: AgentProfileImprovementRunReceipt;
141
- candidate: AgentProfileImprovementRunReceipt;
164
+ export interface AgentProfileImprovementMeasurement<TAccounting extends AgentProfileImprovementAccounting = AgentCandidateFixedSpend> {
165
+ baseline: AgentProfileImprovementRunReceipt<TAccounting>;
166
+ candidate: AgentProfileImprovementRunReceipt<TAccounting>;
142
167
  }
168
+ /** Opt-in retained records can include accounting gaps; complete legacy types stay complete. */
169
+ export type AgentProfileImprovementRecordedRunReceipt = AgentProfileImprovementRunReceipt<AgentProfileImprovementAccounting>;
170
+ export type AgentProfileImprovementRecordedMeasurement = AgentProfileImprovementMeasurement<AgentProfileImprovementAccounting>;
143
171
  /** Portable paired comparison from ordinary profile executions. */
144
172
  export interface AgentProfileImprovementMeasuredComparison extends AgentImprovementMeasuredComparisonBase<AgentProfileImprovementExperiment, AgentProfileImprovementMeasurement, "agent-profile-improvement-measured-comparison"> {
145
173
  kind: "agent-profile-improvement-measured-comparison";
@@ -9,7 +9,7 @@ import type { AgentProfile } from "./agent-profile.js";
9
9
  * can only add text must report the requested replacement as unsatisfied rather
10
10
  * than acknowledge it.
11
11
  */
12
- export declare const AGENT_PROFILE_MATERIALIZATION_AXES: readonly ["name", "description", "version", "tags", "systemPrompt", "appendSystemPrompt", "instructions", "modelDefault", "modelSmall", "modelProvider", "modelReasoningEffort", "modelMaxVisibleOutputTokens", "modelMaxReasoningTokens", "modelMaxTotalOutputTokens", "modelMetadata", "harness", "seats", "proxySecrets", "permissions", "tools", "mcp", "connections", "subagents", "files", "resourceTools", "skills", "resourceAgents", "commands", "knowledge", "resourceInstructions", "resourceFailOnError", "hooks", "modes", "confidential", "metadata", "extensions"];
12
+ export declare const AGENT_PROFILE_MATERIALIZATION_AXES: readonly ["outputFile", "name", "description", "version", "tags", "systemPrompt", "appendSystemPrompt", "instructions", "modelDefault", "modelSmall", "modelProvider", "modelReasoningEffort", "modelMaxVisibleOutputTokens", "modelMaxReasoningTokens", "modelMaxTotalOutputTokens", "modelMetadata", "harness", "seats", "proxySecrets", "permissions", "tools", "mcp", "connections", "subagents", "files", "resourceTools", "skills", "resourceAgents", "commands", "knowledge", "resourceInstructions", "resourceFailOnError", "hooks", "modes", "confidential", "metadata", "extensions"];
13
13
  /** One exact leaf of the public AgentProfile contract. */
14
14
  export type AgentProfileMaterializationAxis = (typeof AGENT_PROFILE_MATERIALIZATION_AXES)[number];
15
15
  /** Compatibility name used by runtimes that distinguish canonical axes. */
@@ -9,6 +9,7 @@
9
9
  * than acknowledge it.
10
10
  */
11
11
  export const AGENT_PROFILE_MATERIALIZATION_AXES = [
12
+ "outputFile",
12
13
  "name",
13
14
  "description",
14
15
  "version",
@@ -47,6 +48,7 @@ export const AGENT_PROFILE_MATERIALIZATION_AXES = [
47
48
  "extensions",
48
49
  ];
49
50
  const profileProperties = [
51
+ "outputFile",
50
52
  "prompt",
51
53
  "model",
52
54
  "harness",
@@ -77,6 +79,7 @@ const MODEL_AXES = {
77
79
  metadata: "modelMetadata",
78
80
  };
79
81
  const AXIS_DESCRIPTORS = [
82
+ { axis: "outputFile", rootPath: "/outputFile", value: (profile) => profile.outputFile },
80
83
  { axis: "name", rootPath: "/name", value: (profile) => profile.name },
81
84
  {
82
85
  axis: "description",
@@ -1,3 +1,4 @@
1
+ import type { AgentFileOutputPolicy } from "./profile-file-output.js";
1
2
  /**
2
3
  * Provider-neutral agent profile types for public SDK consumers.
3
4
  *
@@ -409,6 +410,8 @@ export interface AgentProfileMetadata extends Record<string, unknown> {
409
410
  * Public provider-neutral agent profile contract.
410
411
  */
411
412
  export interface AgentProfile {
413
+ /** Runtime-owned retained regular-file output for this profile only. */
414
+ outputFile?: AgentFileOutputPolicy;
412
415
  name?: string;
413
416
  description?: string;
414
417
  version?: string;
@@ -1,16 +1,3 @@
1
- /**
2
- * Provider-neutral agent profile types for public SDK consumers.
3
- *
4
- * These model portable agent intent at the application boundary. Individual
5
- * backends translate this shape into their own native profile/configuration
6
- * formats internally. Profile content participates in unsalted public identity.
7
- * Prompts, resources, metadata, commands, paths, and secret-reference keys are
8
- * caller-declared public data; recognizable credential patterns are refused as
9
- * defense in depth, not as proof that arbitrary text is non-secret. MCP and hook
10
- * secret-capable fields structurally require tagged public values or opaque
11
- * secret references, which a private executor resolves only after identity is
12
- * fixed. This package is the canonical public home for these symbols.
13
- */
14
1
  /**
15
2
  * Helper for creating typed inline resource refs.
16
3
  */
@@ -97,10 +97,11 @@ export declare const AgentInteractiveSessionRefSchema: z.ZodObject<{
97
97
  axis: z.ZodEnum<{
98
98
  metadata: "metadata";
99
99
  description: "description";
100
- files: "files";
101
100
  name: "name";
101
+ files: "files";
102
102
  version: "version";
103
103
  tags: "tags";
104
+ outputFile: "outputFile";
104
105
  harness: "harness";
105
106
  seats: "seats";
106
107
  proxySecrets: "proxySecrets";
@@ -279,10 +280,11 @@ export declare const AgentInteractiveSessionControlClaimRequestSchema: z.ZodObje
279
280
  axis: z.ZodEnum<{
280
281
  metadata: "metadata";
281
282
  description: "description";
282
- files: "files";
283
283
  name: "name";
284
+ files: "files";
284
285
  version: "version";
285
286
  tags: "tags";
287
+ outputFile: "outputFile";
286
288
  harness: "harness";
287
289
  seats: "seats";
288
290
  proxySecrets: "proxySecrets";
@@ -452,10 +454,11 @@ export declare const AgentInteractiveSessionControlClaimAcknowledgementSchema: z
452
454
  axis: z.ZodEnum<{
453
455
  metadata: "metadata";
454
456
  description: "description";
455
- files: "files";
456
457
  name: "name";
458
+ files: "files";
457
459
  version: "version";
458
460
  tags: "tags";
461
+ outputFile: "outputFile";
459
462
  harness: "harness";
460
463
  seats: "seats";
461
464
  proxySecrets: "proxySecrets";
@@ -647,10 +650,11 @@ export declare const AgentInteractiveSessionStatusSchema: z.ZodDiscriminatedUnio
647
650
  axis: z.ZodEnum<{
648
651
  metadata: "metadata";
649
652
  description: "description";
650
- files: "files";
651
653
  name: "name";
654
+ files: "files";
652
655
  version: "version";
653
656
  tags: "tags";
657
+ outputFile: "outputFile";
654
658
  harness: "harness";
655
659
  seats: "seats";
656
660
  proxySecrets: "proxySecrets";
@@ -801,10 +805,11 @@ export declare const AgentInteractiveSessionStatusSchema: z.ZodDiscriminatedUnio
801
805
  axis: z.ZodEnum<{
802
806
  metadata: "metadata";
803
807
  description: "description";
804
- files: "files";
805
808
  name: "name";
809
+ files: "files";
806
810
  version: "version";
807
811
  tags: "tags";
812
+ outputFile: "outputFile";
808
813
  harness: "harness";
809
814
  seats: "seats";
810
815
  proxySecrets: "proxySecrets";
@@ -963,10 +968,11 @@ export declare const AgentInteractiveSessionStatusSchema: z.ZodDiscriminatedUnio
963
968
  axis: z.ZodEnum<{
964
969
  metadata: "metadata";
965
970
  description: "description";
966
- files: "files";
967
971
  name: "name";
972
+ files: "files";
968
973
  version: "version";
969
974
  tags: "tags";
975
+ outputFile: "outputFile";
970
976
  harness: "harness";
971
977
  seats: "seats";
972
978
  proxySecrets: "proxySecrets";
@@ -1131,10 +1137,11 @@ export declare const AgentInteractiveSessionStopCommandSchema: z.ZodObject<{
1131
1137
  axis: z.ZodEnum<{
1132
1138
  metadata: "metadata";
1133
1139
  description: "description";
1134
- files: "files";
1135
1140
  name: "name";
1141
+ files: "files";
1136
1142
  version: "version";
1137
1143
  tags: "tags";
1144
+ outputFile: "outputFile";
1138
1145
  harness: "harness";
1139
1146
  seats: "seats";
1140
1147
  proxySecrets: "proxySecrets";
@@ -1306,10 +1313,11 @@ export declare const AgentInteractiveSessionStopAcknowledgementSchema: z.ZodObje
1306
1313
  axis: z.ZodEnum<{
1307
1314
  metadata: "metadata";
1308
1315
  description: "description";
1309
- files: "files";
1310
1316
  name: "name";
1317
+ files: "files";
1311
1318
  version: "version";
1312
1319
  tags: "tags";
1320
+ outputFile: "outputFile";
1313
1321
  harness: "harness";
1314
1322
  seats: "seats";
1315
1323
  proxySecrets: "proxySecrets";
@@ -1499,10 +1507,11 @@ export declare const AgentInteractiveSessionPromptCommandSchema: z.ZodObject<{
1499
1507
  axis: z.ZodEnum<{
1500
1508
  metadata: "metadata";
1501
1509
  description: "description";
1502
- files: "files";
1503
1510
  name: "name";
1511
+ files: "files";
1504
1512
  version: "version";
1505
1513
  tags: "tags";
1514
+ outputFile: "outputFile";
1506
1515
  harness: "harness";
1507
1516
  seats: "seats";
1508
1517
  proxySecrets: "proxySecrets";
@@ -1673,10 +1682,11 @@ export declare const AgentInteractiveSessionPromptAcknowledgementSchema: z.ZodOb
1673
1682
  axis: z.ZodEnum<{
1674
1683
  metadata: "metadata";
1675
1684
  description: "description";
1676
- files: "files";
1677
1685
  name: "name";
1686
+ files: "files";
1678
1687
  version: "version";
1679
1688
  tags: "tags";
1689
+ outputFile: "outputFile";
1680
1690
  harness: "harness";
1681
1691
  seats: "seats";
1682
1692
  proxySecrets: "proxySecrets";
@@ -25,6 +25,10 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
25
25
  requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
26
26
  }, z.core.$strict>;
27
27
  profile: z.ZodObject<{
28
+ outputFile: z.ZodOptional<z.ZodObject<{
29
+ name: z.ZodString;
30
+ path: z.ZodString;
31
+ }, z.core.$strict>>;
28
32
  name: z.ZodOptional<z.ZodString>;
29
33
  description: z.ZodOptional<z.ZodString>;
30
34
  version: z.ZodOptional<z.ZodString>;
@@ -258,7 +262,7 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
258
262
  env?: Record<string, {
259
263
  kind: "secret-ref";
260
264
  key: string;
261
- format?: "raw" | "bearer" | undefined;
265
+ format?: "bearer" | "raw" | undefined;
262
266
  } | {
263
267
  kind: "public";
264
268
  value: string;
@@ -271,7 +275,7 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
271
275
  env?: Record<string, {
272
276
  kind: "secret-ref";
273
277
  key: string;
274
- format?: "raw" | "bearer" | undefined;
278
+ format?: "bearer" | "raw" | undefined;
275
279
  } | {
276
280
  kind: "public";
277
281
  value: string;
@@ -121,8 +121,8 @@ export declare const EnvironmentLifecycleSchema: z.ZodObject<{
121
121
  resumable: z.ZodBoolean;
122
122
  mode: z.ZodOptional<z.ZodEnum<{
123
123
  none: "none";
124
- replayed: "replayed";
125
124
  native: "native";
125
+ replayed: "replayed";
126
126
  }>>;
127
127
  }, z.core.$strict>>;
128
128
  persistence: z.ZodOptional<z.ZodObject<{
@@ -445,8 +445,8 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
445
445
  resumable: z.ZodBoolean;
446
446
  mode: z.ZodOptional<z.ZodEnum<{
447
447
  none: "none";
448
- replayed: "replayed";
449
448
  native: "native";
449
+ replayed: "replayed";
450
450
  }>>;
451
451
  }, z.core.$strict>>;
452
452
  persistence: z.ZodOptional<z.ZodObject<{
@@ -493,8 +493,8 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
493
493
  resumable: z.ZodBoolean;
494
494
  mode: z.ZodOptional<z.ZodEnum<{
495
495
  none: "none";
496
- replayed: "replayed";
497
496
  native: "native";
497
+ replayed: "replayed";
498
498
  }>>;
499
499
  }, z.core.$strict>>;
500
500
  persistence: z.ZodOptional<z.ZodObject<{
@@ -10,5 +10,6 @@ export * from "./environment-command-turn.js";
10
10
  export * from "./environment-provider-error.js";
11
11
  export * from "./workspace-cwd.js";
12
12
  export * from "./workspace-snapshot.js";
13
+ export * from "./environment-retained-file.js";
13
14
  export * from "./proxy-secrets.js";
14
15
  export { AgentTurnFailureSchema, type AgentTurnFailure } from "./execution-failure.js";
@@ -10,5 +10,6 @@ export * from "./environment-command-turn.js";
10
10
  export * from "./environment-provider-error.js";
11
11
  export * from "./workspace-cwd.js";
12
12
  export * from "./workspace-snapshot.js";
13
+ export * from "./environment-retained-file.js";
13
14
  export * from "./proxy-secrets.js";
14
15
  export { AgentTurnFailureSchema } from "./execution-failure.js";