@tangle-network/agent-interface 1.7.1 → 1.9.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 (39) hide show
  1. package/README.md +5 -0
  2. package/dist/agent-candidate-code-schema.d.ts +17 -17
  3. package/dist/agent-candidate-execution-plan-schema.d.ts +179 -179
  4. package/dist/agent-candidate-lineage-schema.d.ts +2 -2
  5. package/dist/agent-candidate-outcome-schema.d.ts +56 -56
  6. package/dist/agent-candidate-profile-schema.d.ts +17 -17
  7. package/dist/agent-candidate-promotion-schema.d.ts +1085 -1085
  8. package/dist/agent-candidate-receipt-schema.d.ts +195 -195
  9. package/dist/agent-candidate-schema.d.ts +30 -30
  10. package/dist/agent-candidate-task-schema.d.ts +16 -16
  11. package/dist/agent-execution-limits.d.ts +1 -1
  12. package/dist/agent-execution-preparation-receipt.d.ts +71 -71
  13. package/dist/agent-improvement-measurement-schema.d.ts +26 -26
  14. package/dist/agent-instance.d.ts +2 -2
  15. package/dist/agent-profile-improvement-schema.d.ts +75 -75
  16. package/dist/agent-workspace-lease.d.ts +4 -4
  17. package/dist/certified-context.d.ts +2 -2
  18. package/dist/environment-interactive-control.d.ts +422 -422
  19. package/dist/environment-interactive-start.d.ts +17 -17
  20. package/dist/environment-observation.d.ts +39 -39
  21. package/dist/environment-runtime.d.ts +97 -21
  22. package/dist/environment-runtime.js +70 -1
  23. package/dist/harness.d.ts +11 -11
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/interaction-envelope.d.ts +26 -26
  27. package/dist/interaction-fields.d.ts +22 -22
  28. package/dist/interaction-permissions.d.ts +2 -2
  29. package/dist/portable-context-base.d.ts +1 -1
  30. package/dist/portable-context-continuation.d.ts +4 -4
  31. package/dist/portable-context-plan-request.d.ts +1 -1
  32. package/dist/portable-context-plan.d.ts +5 -5
  33. package/dist/portable-context-shared.d.ts +1 -1
  34. package/dist/portable-context-transfer.d.ts +6 -6
  35. package/dist/profile-schema.d.ts +37 -37
  36. package/dist/runtime-control.d.ts +10 -10
  37. package/dist/workspace-cleanup.d.ts +3 -3
  38. package/dist/workspace-fork.d.ts +4 -4
  39. package/package.json +4 -4
@@ -39,13 +39,13 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
39
39
  small: z.ZodOptional<z.ZodString>;
40
40
  provider: z.ZodOptional<z.ZodString>;
41
41
  reasoningEffort: z.ZodOptional<z.ZodEnum<{
42
- none: "none";
43
- minimal: "minimal";
42
+ high: "high";
44
43
  low: "low";
45
44
  medium: "medium";
46
- high: "high";
47
- xhigh: "xhigh";
45
+ minimal: "minimal";
46
+ none: "none";
48
47
  ultracode: "ultracode";
48
+ xhigh: "xhigh";
49
49
  }>>;
50
50
  maxVisibleOutputTokens: z.ZodOptional<z.ZodNumber>;
51
51
  maxReasoningTokens: z.ZodOptional<z.ZodNumber>;
@@ -53,22 +53,22 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
53
53
  metadata: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
54
54
  }, z.core.$strict>>;
55
55
  harness: z.ZodOptional<z.ZodEnum<{
56
+ acp: "acp";
57
+ amp: "amp";
56
58
  "claude-code": "claude-code";
57
- nanoclaw: "nanoclaw";
59
+ "cli-base": "cli-base";
58
60
  codex: "codex";
59
- opencode: "opencode";
60
- "kimi-code": "kimi-code";
61
- pi: "pi";
62
- prime: "prime";
61
+ cursor: "cursor";
62
+ "factory-droids": "factory-droids";
63
+ forge: "forge";
63
64
  gemini: "gemini";
64
65
  hermes: "hermes";
66
+ "kimi-code": "kimi-code";
67
+ nanoclaw: "nanoclaw";
65
68
  openclaw: "openclaw";
66
- amp: "amp";
67
- "factory-droids": "factory-droids";
68
- forge: "forge";
69
- cursor: "cursor";
70
- acp: "acp";
71
- "cli-base": "cli-base";
69
+ opencode: "opencode";
70
+ pi: "pi";
71
+ prime: "prime";
72
72
  }>>;
73
73
  permissions: z.ZodOptional<z.ZodType<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown, z.core.$ZodTypeInternals<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown>>>;
74
74
  tools: z.ZodOptional<z.ZodType<Record<string, boolean>, unknown, z.core.$ZodTypeInternals<Record<string, boolean>, unknown>>>;
@@ -179,7 +179,7 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
179
179
  } | {
180
180
  kind: "secret-ref";
181
181
  key: string;
182
- format?: "raw" | "bearer" | undefined;
182
+ format?: "bearer" | "raw" | undefined;
183
183
  }> | undefined;
184
184
  }[]>, unknown, z.core.$ZodTypeInternals<Record<string, {
185
185
  command: string;
@@ -192,7 +192,7 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
192
192
  } | {
193
193
  kind: "secret-ref";
194
194
  key: string;
195
- format?: "raw" | "bearer" | undefined;
195
+ format?: "bearer" | "raw" | undefined;
196
196
  }> | undefined;
197
197
  }[]>, unknown>>>;
198
198
  modes: z.ZodOptional<z.ZodType<Record<string, {
@@ -7,11 +7,11 @@ import { z } from "zod";
7
7
  */
8
8
  export type ObservationState = "known" | "stale" | "unavailable" | "redacted" | "unknown";
9
9
  export declare const ObservationStateSchema: z.ZodEnum<{
10
- unknown: "unknown";
11
- unavailable: "unavailable";
12
10
  known: "known";
13
- stale: "stale";
14
11
  redacted: "redacted";
12
+ stale: "stale";
13
+ unavailable: "unavailable";
14
+ unknown: "unknown";
15
15
  }>;
16
16
  /** How a known or stale value was obtained, and when. */
17
17
  export interface ObservationProvenance {
@@ -102,31 +102,31 @@ export declare const ProviderIdentitySchema: z.ZodObject<{
102
102
  backend: z.ZodOptional<z.ZodString>;
103
103
  }, z.core.$strict>;
104
104
  export declare const AgentEnvironmentStatusSchema: z.ZodEnum<{
105
- unknown: "unknown";
106
- failed: "failed";
107
105
  expired: "expired";
108
- stopped: "stopped";
106
+ failed: "failed";
109
107
  pending: "pending";
110
- running: "running";
111
108
  provisioning: "provisioning";
109
+ running: "running";
110
+ stopped: "stopped";
111
+ unknown: "unknown";
112
112
  }>;
113
113
  /** Lifecycle, cleanup, continuity, and persistence of one environment. */
114
114
  export declare const EnvironmentLifecycleSchema: z.ZodObject<{
115
115
  status: z.ZodEnum<{
116
- unknown: "unknown";
117
- failed: "failed";
118
116
  expired: "expired";
119
- stopped: "stopped";
117
+ failed: "failed";
120
118
  pending: "pending";
121
- running: "running";
122
119
  provisioning: "provisioning";
120
+ running: "running";
121
+ stopped: "stopped";
122
+ unknown: "unknown";
123
123
  }>;
124
124
  cleanup: z.ZodOptional<z.ZodObject<{
125
125
  policy: z.ZodOptional<z.ZodEnum<{
126
- manual: "manual";
127
126
  idle: "idle";
128
- scheduled: "scheduled";
127
+ manual: "manual";
129
128
  "on-exit": "on-exit";
129
+ scheduled: "scheduled";
130
130
  }>>;
131
131
  scheduledAt: z.ZodOptional<z.ZodISODateTime>;
132
132
  confirmed: z.ZodOptional<z.ZodBoolean>;
@@ -134,17 +134,17 @@ export declare const EnvironmentLifecycleSchema: z.ZodObject<{
134
134
  continuity: z.ZodOptional<z.ZodObject<{
135
135
  resumable: z.ZodBoolean;
136
136
  mode: z.ZodOptional<z.ZodEnum<{
137
+ native: "native";
137
138
  none: "none";
138
139
  replayed: "replayed";
139
- native: "native";
140
140
  }>>;
141
141
  }, z.core.$strict>>;
142
142
  persistence: z.ZodOptional<z.ZodObject<{
143
143
  durable: z.ZodBoolean;
144
144
  scope: z.ZodOptional<z.ZodEnum<{
145
- session: "session";
146
145
  durable: "durable";
147
146
  ephemeral: "ephemeral";
147
+ session: "session";
148
148
  }>>;
149
149
  }, z.core.$strict>>;
150
150
  }, z.core.$strict>;
@@ -183,10 +183,10 @@ export type ResourceUseSample = z.infer<typeof ResourceUseSampleSchema>;
183
183
  /** Where an environment was requested or verified to run. */
184
184
  export declare const PlacementDescriptorSchema: z.ZodObject<{
185
185
  kind: z.ZodEnum<{
186
- provider: "provider";
186
+ fleet: "fleet";
187
187
  local: "local";
188
+ provider: "provider";
188
189
  sandbox: "sandbox";
189
- fleet: "fleet";
190
190
  }>;
191
191
  sandboxId: z.ZodOptional<z.ZodString>;
192
192
  fleetId: z.ZodOptional<z.ZodString>;
@@ -438,20 +438,20 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
438
438
  state: z.ZodLiteral<"known">;
439
439
  value: z.ZodObject<{
440
440
  status: z.ZodEnum<{
441
- unknown: "unknown";
442
- failed: "failed";
443
441
  expired: "expired";
444
- stopped: "stopped";
442
+ failed: "failed";
445
443
  pending: "pending";
446
- running: "running";
447
444
  provisioning: "provisioning";
445
+ running: "running";
446
+ stopped: "stopped";
447
+ unknown: "unknown";
448
448
  }>;
449
449
  cleanup: z.ZodOptional<z.ZodObject<{
450
450
  policy: z.ZodOptional<z.ZodEnum<{
451
- manual: "manual";
452
451
  idle: "idle";
453
- scheduled: "scheduled";
452
+ manual: "manual";
454
453
  "on-exit": "on-exit";
454
+ scheduled: "scheduled";
455
455
  }>>;
456
456
  scheduledAt: z.ZodOptional<z.ZodISODateTime>;
457
457
  confirmed: z.ZodOptional<z.ZodBoolean>;
@@ -459,17 +459,17 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
459
459
  continuity: z.ZodOptional<z.ZodObject<{
460
460
  resumable: z.ZodBoolean;
461
461
  mode: z.ZodOptional<z.ZodEnum<{
462
+ native: "native";
462
463
  none: "none";
463
464
  replayed: "replayed";
464
- native: "native";
465
465
  }>>;
466
466
  }, z.core.$strict>>;
467
467
  persistence: z.ZodOptional<z.ZodObject<{
468
468
  durable: z.ZodBoolean;
469
469
  scope: z.ZodOptional<z.ZodEnum<{
470
- session: "session";
471
470
  durable: "durable";
472
471
  ephemeral: "ephemeral";
472
+ session: "session";
473
473
  }>>;
474
474
  }, z.core.$strict>>;
475
475
  }, z.core.$strict>;
@@ -486,20 +486,20 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
486
486
  state: z.ZodLiteral<"stale">;
487
487
  value: z.ZodObject<{
488
488
  status: z.ZodEnum<{
489
- unknown: "unknown";
490
- failed: "failed";
491
489
  expired: "expired";
492
- stopped: "stopped";
490
+ failed: "failed";
493
491
  pending: "pending";
494
- running: "running";
495
492
  provisioning: "provisioning";
493
+ running: "running";
494
+ stopped: "stopped";
495
+ unknown: "unknown";
496
496
  }>;
497
497
  cleanup: z.ZodOptional<z.ZodObject<{
498
498
  policy: z.ZodOptional<z.ZodEnum<{
499
- manual: "manual";
500
499
  idle: "idle";
501
- scheduled: "scheduled";
500
+ manual: "manual";
502
501
  "on-exit": "on-exit";
502
+ scheduled: "scheduled";
503
503
  }>>;
504
504
  scheduledAt: z.ZodOptional<z.ZodISODateTime>;
505
505
  confirmed: z.ZodOptional<z.ZodBoolean>;
@@ -507,17 +507,17 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
507
507
  continuity: z.ZodOptional<z.ZodObject<{
508
508
  resumable: z.ZodBoolean;
509
509
  mode: z.ZodOptional<z.ZodEnum<{
510
+ native: "native";
510
511
  none: "none";
511
512
  replayed: "replayed";
512
- native: "native";
513
513
  }>>;
514
514
  }, z.core.$strict>>;
515
515
  persistence: z.ZodOptional<z.ZodObject<{
516
516
  durable: z.ZodBoolean;
517
517
  scope: z.ZodOptional<z.ZodEnum<{
518
- session: "session";
519
518
  durable: "durable";
520
519
  ephemeral: "ephemeral";
520
+ session: "session";
521
521
  }>>;
522
522
  }, z.core.$strict>>;
523
523
  }, z.core.$strict>;
@@ -587,10 +587,10 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
587
587
  placement: z.ZodOptional<z.ZodObject<{
588
588
  requested: z.ZodOptional<z.ZodObject<{
589
589
  kind: z.ZodEnum<{
590
- provider: "provider";
590
+ fleet: "fleet";
591
591
  local: "local";
592
+ provider: "provider";
592
593
  sandbox: "sandbox";
593
- fleet: "fleet";
594
594
  }>;
595
595
  sandboxId: z.ZodOptional<z.ZodString>;
596
596
  fleetId: z.ZodOptional<z.ZodString>;
@@ -601,10 +601,10 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
601
601
  state: z.ZodLiteral<"known">;
602
602
  value: z.ZodObject<{
603
603
  kind: z.ZodEnum<{
604
- provider: "provider";
604
+ fleet: "fleet";
605
605
  local: "local";
606
+ provider: "provider";
606
607
  sandbox: "sandbox";
607
- fleet: "fleet";
608
608
  }>;
609
609
  sandboxId: z.ZodOptional<z.ZodString>;
610
610
  fleetId: z.ZodOptional<z.ZodString>;
@@ -624,10 +624,10 @@ export declare const AgentEnvironmentObservationSchema: z.ZodObject<{
624
624
  state: z.ZodLiteral<"stale">;
625
625
  value: z.ZodObject<{
626
626
  kind: z.ZodEnum<{
627
- provider: "provider";
627
+ fleet: "fleet";
628
628
  local: "local";
629
+ provider: "provider";
629
630
  sandbox: "sandbox";
630
- fleet: "fleet";
631
631
  }>;
632
632
  sandboxId: z.ZodOptional<z.ZodString>;
633
633
  fleetId: z.ZodOptional<z.ZodString>;
@@ -5,8 +5,8 @@ import type { InputPart } from "./parts.js";
5
5
  import type { StreamEvent } from "./stream-events.js";
6
6
  import type { TokenUsage } from "./execution-types.js";
7
7
  import { type InteractionAcknowledgement, type InteractionCapabilities, type InteractionResponseCommand, type RequestedInteractions } from "./interaction.js";
8
- import { type ContextTransferReceipt, type ContextTransferRequest, type NativeContextBoundaryProof, type NativeContextContinuationRequest, type NativeContextContinuationTurn } from "./portable-context.js";
9
- import { type AgentRunCancellationAcknowledgement, type AgentRunCancellationRequest, type AgentRunControlRef } from "./runtime-control.js";
8
+ import { type ContextTransferReceipt, type ContextTransferRequest, type ContextTransferResult, type NativeContextBoundaryProof, type NativeContextContinuationRequest, type NativeContextContinuationTurn } from "./portable-context.js";
9
+ import { type AgentExactRunControlRef, type AgentRunCancellationAcknowledgement, type AgentRunCancellationRequest, type AgentRunControlRef } from "./runtime-control.js";
10
10
  import type { AgentWorkspaceBranching, AgentWorkspaceBranchingProvider } from "./workspace-branching.js";
11
11
  import type { AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSessionStatus, CheckpointRef, CheckpointRequest, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from "./environment-requests.js";
12
12
  import type { AgentExactProcessEgressMode, AgentExactProcessProvider } from "./environment-exact-process.js";
@@ -92,9 +92,9 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
92
92
  messages: z.ZodArray<z.ZodObject<{
93
93
  id: z.ZodString;
94
94
  role: z.ZodEnum<{
95
- user: "user";
96
95
  assistant: "assistant";
97
96
  system: "system";
97
+ user: "user";
98
98
  }>;
99
99
  parts: z.ZodArray<z.ZodCustom<unknown, unknown>>;
100
100
  timestamp: z.ZodISODateTime;
@@ -128,9 +128,9 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
128
128
  parts: z.ZodArray<z.ZodObject<{
129
129
  partIndex: z.ZodNumber;
130
130
  action: z.ZodEnum<{
131
- transform: "transform";
132
131
  include: "include";
133
132
  omit: "omit";
133
+ transform: "transform";
134
134
  }>;
135
135
  output: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
136
136
  type: z.ZodLiteral<"text">;
@@ -171,9 +171,9 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
171
171
  messages: z.ZodArray<z.ZodObject<{
172
172
  id: z.ZodString;
173
173
  role: z.ZodEnum<{
174
- user: "user";
175
174
  assistant: "assistant";
176
175
  system: "system";
176
+ user: "user";
177
177
  }>;
178
178
  parts: z.ZodArray<z.ZodCustom<unknown, unknown>>;
179
179
  timestamp: z.ZodISODateTime;
@@ -197,8 +197,8 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
197
197
  acceptedAt: z.ZodISODateTime;
198
198
  acceptedBy: z.ZodEnum<{
199
199
  policy: "policy";
200
- user: "user";
201
200
  system: "system";
201
+ user: "user";
202
202
  }>;
203
203
  }, z.core.$strict>;
204
204
  }, z.core.$strict>>;
@@ -365,13 +365,13 @@ export declare const AgentNativeContextContinuationResultSchema: z.ZodUnion<read
365
365
  operationId: z.ZodString;
366
366
  requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
367
367
  status: z.ZodEnum<{
368
- conflict: "conflict";
369
368
  accepted: "accepted";
370
- transport_failure: "transport_failure";
371
- replayed: "replayed";
372
369
  boundary_mismatch: "boundary_mismatch";
373
- unverified: "unverified";
370
+ conflict: "conflict";
371
+ replayed: "replayed";
372
+ transport_failure: "transport_failure";
374
373
  unknown_session: "unknown_session";
374
+ unverified: "unverified";
375
375
  }>;
376
376
  historyMessagesSent: z.ZodNumber;
377
377
  existingRequestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
@@ -524,13 +524,13 @@ export declare const AgentNativeContextContinuationResultSchema: z.ZodUnion<read
524
524
  operationId: z.ZodString;
525
525
  requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
526
526
  status: z.ZodEnum<{
527
- conflict: "conflict";
528
527
  accepted: "accepted";
529
- transport_failure: "transport_failure";
530
- replayed: "replayed";
531
528
  boundary_mismatch: "boundary_mismatch";
532
- unverified: "unverified";
529
+ conflict: "conflict";
530
+ replayed: "replayed";
531
+ transport_failure: "transport_failure";
533
532
  unknown_session: "unknown_session";
533
+ unverified: "unverified";
534
534
  }>;
535
535
  historyMessagesSent: z.ZodNumber;
536
536
  existingRequestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
@@ -561,20 +561,69 @@ export declare const AgentNativeContextContinuationResultSchema: z.ZodUnion<read
561
561
  retryable: z.ZodOptional<z.ZodBoolean>;
562
562
  }, z.core.$strict>, z.ZodObject<{
563
563
  status: z.ZodEnum<{
564
+ boundary_mismatch: "boundary_mismatch";
564
565
  conflict: "conflict";
565
566
  transport_failure: "transport_failure";
566
- boundary_mismatch: "boundary_mismatch";
567
- unverified: "unverified";
568
567
  unknown_session: "unknown_session";
568
+ unverified: "unverified";
569
569
  }>;
570
570
  }, z.core.$strip>>;
571
571
  }, z.core.$strict>]>;
572
572
  export type AgentNativeContextContinuationResult = z.infer<typeof AgentNativeContextContinuationResultSchema>;
573
+ /** Exact continued-run identity returned after durable admission. */
574
+ export declare const AgentNativeContextContinuationAdmissionSchema: z.ZodObject<{
575
+ phase: z.ZodLiteral<"admitted">;
576
+ acknowledgement: z.ZodObject<{
577
+ operationId: z.ZodString;
578
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
579
+ historyMessagesSent: z.ZodLiteral<0>;
580
+ actualBoundary: z.ZodObject<{
581
+ runId: z.ZodString;
582
+ provider: z.ZodString;
583
+ environmentId: z.ZodString;
584
+ sessionId: z.ZodString;
585
+ executionId: z.ZodString;
586
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
587
+ boundary: z.ZodDiscriminatedUnion<[z.ZodObject<{
588
+ kind: z.ZodLiteral<"token">;
589
+ token: z.ZodString;
590
+ }, z.core.$strict>, z.ZodObject<{
591
+ kind: z.ZodLiteral<"revision">;
592
+ revision: z.ZodString;
593
+ }, z.core.$strict>, z.ZodObject<{
594
+ kind: z.ZodLiteral<"digest">;
595
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
596
+ }, z.core.$strict>, z.ZodObject<{
597
+ kind: z.ZodLiteral<"messages">;
598
+ messageIds: z.ZodArray<z.ZodString>;
599
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
600
+ }, z.core.$strict>], "kind">;
601
+ observedAt: z.ZodISODateTime;
602
+ }, z.core.$strict>;
603
+ }, z.core.$strict>;
604
+ controlRef: z.ZodObject<{
605
+ runId: z.ZodString;
606
+ provider: z.ZodString;
607
+ environmentId: z.ZodString;
608
+ sessionId: z.ZodString;
609
+ executionId: z.ZodString;
610
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
611
+ }, z.core.$strict>;
612
+ }, z.core.$strict>;
613
+ export type AgentNativeContextContinuationAdmission = z.infer<typeof AgentNativeContextContinuationAdmissionSchema>;
614
+ /** Cross-check one early admission against its exact continuation request. */
615
+ export declare function agentNativeContextContinuationAdmissionMatchesRequest(request: NativeContextContinuationRequest, admission: AgentNativeContextContinuationAdmission): boolean;
573
616
  /** Runtime-only controls kept outside the digest-bound user turn. */
574
617
  export interface AgentNativeContextContinuationOptions {
575
618
  turn: NativeContextContinuationTurn;
576
619
  timeoutMs?: number;
577
620
  signal?: AbortSignal;
621
+ /**
622
+ * Receives the exact new run identity after durable admission and before the
623
+ * provider waits for terminal output. Providers call this once only when
624
+ * `nativeContinuation.admissionControl` is true.
625
+ */
626
+ onAdmission?: (controlRef: AgentExactRunControlRef) => void;
578
627
  }
579
628
  /** Cross-check a successful native continuation against its retained session. */
580
629
  export declare function agentNativeContextContinuationResultMatchesRequest(request: NativeContextContinuationRequest, outcome: AgentNativeContextContinuationResult): boolean;
@@ -638,8 +687,8 @@ export interface AgentSession {
638
687
  */
639
688
  export type AgentEnvironmentCreation = "created" | "replayed";
640
689
  export declare const AgentEnvironmentCreationSchema: z.ZodEnum<{
641
- replayed: "replayed";
642
690
  created: "created";
691
+ replayed: "replayed";
643
692
  }>;
644
693
  export interface AgentEnvironment {
645
694
  readonly id: string;
@@ -751,6 +800,14 @@ export interface AgentEnvironmentCapabilities {
751
800
  nativeContinuation?: {
752
801
  atomicBoundary: boolean;
753
802
  requestIdempotency: boolean;
803
+ /** The provider exposes the exact continued run before terminal output. */
804
+ admissionControl?: boolean;
805
+ };
806
+ /** Present only when fresh-session portable context transfer is durable. */
807
+ contextTransfer?: {
808
+ freshSession: boolean;
809
+ requestIdempotency: boolean;
810
+ lookup: boolean;
754
811
  };
755
812
  /** Absent when the provider cannot originate or answer interactions. */
756
813
  interactions?: InteractionCapabilities;
@@ -859,20 +916,26 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
859
916
  nativeContinuation: z.ZodOptional<z.ZodObject<{
860
917
  atomicBoundary: z.ZodBoolean;
861
918
  requestIdempotency: z.ZodBoolean;
919
+ admissionControl: z.ZodOptional<z.ZodBoolean>;
920
+ }, z.core.$strict>>;
921
+ contextTransfer: z.ZodOptional<z.ZodObject<{
922
+ freshSession: z.ZodBoolean;
923
+ requestIdempotency: z.ZodBoolean;
924
+ lookup: z.ZodBoolean;
862
925
  }, z.core.$strict>>;
863
926
  interactions: z.ZodOptional<z.ZodObject<{
864
927
  kinds: z.ZodArray<z.ZodString>;
865
928
  answerFieldTypes: z.ZodArray<z.ZodEnum<{
866
- number: "number";
867
929
  boolean: "boolean";
868
- text: "text";
869
- select: "select";
930
+ number: "number";
870
931
  secret: "secret";
932
+ select: "select";
933
+ text: "text";
871
934
  }>>;
872
935
  responseScopes: z.ZodArray<z.ZodEnum<{
873
936
  interaction: "interaction";
874
- session: "session";
875
937
  persistent: "persistent";
938
+ session: "session";
876
939
  }>>;
877
940
  secretAnswers: z.ZodBoolean;
878
941
  concurrentRequests: z.ZodBoolean;
@@ -934,6 +997,8 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
934
997
  }, z.core.$strict>;
935
998
  export interface CreateAgentEnvironmentInput {
936
999
  profile: AgentProfileRef;
1000
+ /** Exact caller-owned id required by an accepted destination contract. */
1001
+ requestedId?: string;
937
1002
  /** Agent backend inside the provider, for example "opencode" or "codex". */
938
1003
  backend?: string;
939
1004
  workspace?: WorkspaceRequest;
@@ -997,6 +1062,8 @@ export declare function createAgentEnvironmentWithIdempotency<T extends object>(
997
1062
  export interface AgentEnvironmentProvider {
998
1063
  readonly name: string;
999
1064
  readonly exactProcess?: AgentExactProcessProvider;
1065
+ /** Durable fresh-session portable context admission, when supported. */
1066
+ readonly contextTransfer?: AgentContextTransferProvider;
1000
1067
  /**
1001
1068
  * Reconstruct a source-scoped branching handle after a coordinator restart.
1002
1069
  *
@@ -1023,3 +1090,12 @@ export interface AgentEnvironmentProvider {
1023
1090
  signal?: AbortSignal;
1024
1091
  }): Promise<AgentEnvironmentSummary[]>;
1025
1092
  }
1093
+ /** Provider-owned portable context admission with retry-safe lookup. */
1094
+ export interface AgentContextTransferProvider {
1095
+ transfer(request: ContextTransferRequest, options?: {
1096
+ signal?: AbortSignal;
1097
+ }): Promise<ContextTransferResult>;
1098
+ lookup(request: ContextTransferRequest, options?: {
1099
+ signal?: AbortSignal;
1100
+ }): Promise<ContextTransferResult | undefined>;
1101
+ }
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { canonicalCandidateDigest } from "./agent-candidate-schema-common.js";
3
3
  import { InteractionCapabilitiesSchema, RequestedInteractionsSchema } from "./interaction.js";
4
- import { ContextTransferReceiptSchema, ContextTransferRequestSchema, NativeContextContinuationAcknowledgementSchema, NativeContextContinuationRequestSchema, nativeContextContinuationAcknowledgementMatches } from "./portable-context.js";
4
+ import { ContextTransferReceiptSchema, ContextTransferRequestSchema, NativeContextBoundaryProofSchema, NativeContextContinuationAcknowledgementSchema, NativeContextContinuationRequestSchema, nativeContextContinuationAcknowledgementMatches } from "./portable-context.js";
5
5
  import { AgentExactRunControlRefSchema, AgentRunControlRefSchema, CanonicalStreamEventSchema } from "./runtime-control.js";
6
6
  import { AgentProfileCapabilitiesSchema } from "./environment-profile-capabilities.js";
7
7
  import { boundedIdentifierSchema, boundedJsonRecordSchema, boundedJsonSchema, boundedStringSchema, CONTRACT_MAX_ARRAY_LENGTH } from "./contract-limits.js";
@@ -92,6 +92,49 @@ export const AgentNativeContextContinuationResultSchema = z.union([
92
92
  }
93
93
  }),
94
94
  ]);
95
+ /** Exact continued-run identity returned after durable admission. */
96
+ export const AgentNativeContextContinuationAdmissionSchema = z
97
+ .strictObject({
98
+ phase: z.literal("admitted"),
99
+ acknowledgement: z.strictObject({
100
+ operationId: boundedIdentifierSchema,
101
+ requestDigest: AgentExactRunControlRefSchema.shape.requestDigest,
102
+ historyMessagesSent: z.literal(0),
103
+ actualBoundary: NativeContextBoundaryProofSchema,
104
+ }),
105
+ controlRef: AgentExactRunControlRefSchema,
106
+ })
107
+ .superRefine((admission, refinement) => {
108
+ const source = admission.acknowledgement.actualBoundary;
109
+ const current = admission.controlRef;
110
+ if (source.provider !== current.provider ||
111
+ source.environmentId !== current.environmentId ||
112
+ source.sessionId !== current.sessionId) {
113
+ refinement.addIssue({
114
+ code: "custom",
115
+ path: ["controlRef"],
116
+ message: "native continuation admission must stay in the retained session",
117
+ });
118
+ }
119
+ });
120
+ /** Cross-check one early admission against its exact continuation request. */
121
+ export function agentNativeContextContinuationAdmissionMatchesRequest(request, admission) {
122
+ const parsedRequest = NativeContextContinuationRequestSchema.safeParse(request);
123
+ const parsedAdmission = AgentNativeContextContinuationAdmissionSchema.safeParse(admission);
124
+ if (!parsedRequest.success || !parsedAdmission.success)
125
+ return false;
126
+ const expected = parsedRequest.data;
127
+ const actual = parsedAdmission.data;
128
+ const boundary = actual.acknowledgement.actualBoundary;
129
+ return (actual.acknowledgement.operationId === expected.operationId &&
130
+ actual.acknowledgement.requestDigest === expected.requestDigest &&
131
+ boundary.runId === expected.run.runId &&
132
+ boundary.provider === expected.run.provider &&
133
+ boundary.environmentId === expected.run.environmentId &&
134
+ boundary.sessionId === expected.run.sessionId &&
135
+ boundary.executionId === expected.run.executionId &&
136
+ boundary.requestDigest === expected.run.requestDigest);
137
+ }
95
138
  /** Cross-check a successful native continuation against its retained session. */
96
139
  export function agentNativeContextContinuationResultMatchesRequest(request, outcome) {
97
140
  const parsedRequest = NativeContextContinuationRequestSchema.safeParse(request);
@@ -144,6 +187,14 @@ export const AgentEnvironmentCapabilitiesSchema = z
144
187
  .strictObject({
145
188
  atomicBoundary: z.boolean(),
146
189
  requestIdempotency: z.boolean(),
190
+ admissionControl: z.boolean().optional(),
191
+ })
192
+ .optional(),
193
+ contextTransfer: z
194
+ .strictObject({
195
+ freshSession: z.boolean(),
196
+ requestIdempotency: z.boolean(),
197
+ lookup: z.boolean(),
147
198
  })
148
199
  .optional(),
149
200
  interactions: InteractionCapabilitiesSchema.optional(),
@@ -234,6 +285,24 @@ export const AgentEnvironmentCapabilitiesSchema = z
234
285
  message: "native continuation requires session continuation, atomic boundary admission, and request idempotency together",
235
286
  });
236
287
  }
288
+ if (capabilities.nativeContinuation?.admissionControl === true &&
289
+ capabilities.retainedControl === undefined) {
290
+ refinement.addIssue({
291
+ code: "custom",
292
+ path: ["nativeContinuation", "admissionControl"],
293
+ message: "native continuation requires retained control for early admission",
294
+ });
295
+ }
296
+ if (capabilities.contextTransfer !== undefined &&
297
+ (!capabilities.contextTransfer.freshSession ||
298
+ !capabilities.contextTransfer.requestIdempotency ||
299
+ !capabilities.contextTransfer.lookup)) {
300
+ refinement.addIssue({
301
+ code: "custom",
302
+ path: ["contextTransfer"],
303
+ message: "context transfer requires fresh-session admission, request idempotency, and lookup together",
304
+ });
305
+ }
237
306
  const durableBranching = [
238
307
  capabilities.branching.retrySafe ?? false,
239
308
  capabilities.branching.lookup ?? false,
package/dist/harness.d.ts CHANGED
@@ -23,20 +23,20 @@ import { z } from "zod";
23
23
  export type HarnessType = "claude-code" | "nanoclaw" | "codex" | "opencode" | "kimi-code" | "pi" | "prime" | "gemini" | "hermes" | "openclaw" | "amp" | "factory-droids" | "forge" | "cursor" | "acp" | "cli-base";
24
24
  /** Runtime validator for {@link HarnessType}. Kept in lockstep with the type by the drift guard below. */
25
25
  export declare const harnessTypeSchema: z.ZodEnum<{
26
+ acp: "acp";
27
+ amp: "amp";
26
28
  "claude-code": "claude-code";
27
- nanoclaw: "nanoclaw";
29
+ "cli-base": "cli-base";
28
30
  codex: "codex";
29
- opencode: "opencode";
30
- "kimi-code": "kimi-code";
31
- pi: "pi";
32
- prime: "prime";
31
+ cursor: "cursor";
32
+ "factory-droids": "factory-droids";
33
+ forge: "forge";
33
34
  gemini: "gemini";
34
35
  hermes: "hermes";
36
+ "kimi-code": "kimi-code";
37
+ nanoclaw: "nanoclaw";
35
38
  openclaw: "openclaw";
36
- amp: "amp";
37
- "factory-droids": "factory-droids";
38
- forge: "forge";
39
- cursor: "cursor";
40
- acp: "acp";
41
- "cli-base": "cli-base";
39
+ opencode: "opencode";
40
+ pi: "pi";
41
+ prime: "prime";
42
42
  }>;