@adea-ai/runtime-sdk 1.17.2 → 1.18.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.
package/dist/adapter.d.ts CHANGED
@@ -185,10 +185,6 @@ export declare const RuntimeExecutionHandleSchema: z.ZodObject<{
185
185
  externalSessionId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"external-session ID">, string>>>;
186
186
  startedAt: z.ZodISODateTime;
187
187
  }, z.core.$strict>;
188
- /**
189
- * Reported runtime accounting provenance, not funding authorization. Consumers
190
- * must verify `sourceId` against a trusted authority before charging.
191
- */
192
188
  export declare const RuntimeUsageAccountingSchema: z.ZodObject<{
193
189
  schemaVersion: z.ZodLiteral<1>;
194
190
  sourceId: z.ZodString;
@@ -293,20 +289,6 @@ export declare const RuntimeExecutionStateSchema: z.ZodEnum<{
293
289
  timed_out: "timed_out";
294
290
  unknown: "unknown";
295
291
  }>;
296
- /**
297
- * The runtime's own observed generation identity for the execution's current
298
- * turn.
299
- *
300
- * Observed by construction: the runtime reports the generation it authorized
301
- * for this attempt, never a generation a caller claimed. A control that names
302
- * a generation the runtime did not observe is not bound to it, so this shape
303
- * is an identity, not a counter the caller can advance.
304
- *
305
- * The identity is self-verifying: the inference key is the turn's key extended
306
- * by the inference id, exactly as the runtime retained it. A key that names a
307
- * different turn or inference is refused here rather than accepted as an
308
- * observation of something else.
309
- */
310
292
  export declare const RuntimeObservedGenerationSchema: z.ZodObject<{
311
293
  schemaVersion: z.ZodLiteral<"runtime-observed-generation/v1">;
312
294
  attemptId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"attempt ID">, string>>;
@@ -464,7 +446,6 @@ export declare const RuntimeExecutionPlanSnapshotSchema: z.ZodObject<{
464
446
  }>>;
465
447
  }, z.core.$strip>>;
466
448
  }, z.core.$catchall<z.ZodUnknown>>;
467
- /** Allocation under an accepted allowance; not prepaid funds or charge authority. */
468
449
  export declare const RuntimeAttemptBudgetAuthoritySchema: z.ZodReadonly<z.ZodObject<{
469
450
  schemaVersion: z.ZodLiteral<1>;
470
451
  workspaceId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"workspace ID">, string>>;
package/dist/adapter.js CHANGED
@@ -42,7 +42,6 @@ export const RuntimeAdapterInspectionSchema = z
42
42
  health: z.enum(['healthy', 'degraded', 'unavailable']),
43
43
  capabilities: z.array(RuntimeCapabilitySchema).max(64),
44
44
  limitations: z.array(z.string().min(1).max(512)).max(64),
45
- // Optional until each adapter has published tested Agent Plugins evidence.
46
45
  agentPlugins: AgentPluginsCapabilityReportSchema.optional(),
47
46
  observedAt: TimestampSchema,
48
47
  capabilityEvaluation: CapabilityEvaluationSchema.optional(),
@@ -56,10 +55,6 @@ export const RuntimeExecutionHandleSchema = z
56
55
  startedAt: TimestampSchema,
57
56
  })
58
57
  .strict();
59
- /**
60
- * Reported runtime accounting provenance, not funding authorization. Consumers
61
- * must verify `sourceId` against a trusted authority before charging.
62
- */
63
58
  export const RuntimeUsageAccountingSchema = z
64
59
  .object({
65
60
  schemaVersion: z.literal(1),
@@ -183,20 +178,6 @@ export const RuntimeExecutionStateSchema = z.enum([
183
178
  'timed_out',
184
179
  'unknown',
185
180
  ]);
186
- /**
187
- * The runtime's own observed generation identity for the execution's current
188
- * turn.
189
- *
190
- * Observed by construction: the runtime reports the generation it authorized
191
- * for this attempt, never a generation a caller claimed. A control that names
192
- * a generation the runtime did not observe is not bound to it, so this shape
193
- * is an identity, not a counter the caller can advance.
194
- *
195
- * The identity is self-verifying: the inference key is the turn's key extended
196
- * by the inference id, exactly as the runtime retained it. A key that names a
197
- * different turn or inference is refused here rather than accepted as an
198
- * observation of something else.
199
- */
200
181
  export const RuntimeObservedGenerationSchema = z
201
182
  .object({
202
183
  schemaVersion: z.literal('runtime-observed-generation/v1'),
@@ -215,13 +196,8 @@ export const RuntimeExecutionStatusSchema = z
215
196
  handle: RuntimeExecutionHandleSchema,
216
197
  state: RuntimeExecutionStateSchema,
217
198
  observedAt: TimestampSchema,
218
- // The generation the runtime observed for this attempt, when it has one.
219
- // Additive in contract 3.1: a consumer that advertised an earlier version
220
- // parses with the pre-3.1 strict status shape, so a producer publishes it
221
- // only to a consumer whose negotiated version includes it.
222
199
  observedGeneration: RuntimeObservedGenerationSchema.optional(),
223
200
  result: RuntimeExecutionResultSchema.optional(),
224
- // Observed usage survives unsuccessful termination without fabricating a result.
225
201
  terminalUsage: RuntimeUsageSchema.optional(),
226
202
  error: RuntimeErrorSchema.optional(),
227
203
  })
@@ -262,7 +238,6 @@ export const RuntimeExecutionPlanSnapshotSchema = z
262
238
  runtimeRequirements: CapabilityRequirementSetSchema,
263
239
  })
264
240
  .catchall(z.unknown());
265
- /** Allocation under an accepted allowance; not prepaid funds or charge authority. */
266
241
  export const RuntimeAttemptBudgetAuthoritySchema = z
267
242
  .object({
268
243
  schemaVersion: z.literal(1),
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  import type { RuntimeAdapterInspection } from './adapter.js';
3
- /**
4
- * Capability evidence reported by a tested runtime adapter. A harness name is
5
- * intentionally not enough to claim Agent Plugins support.
6
- */
7
3
  export declare const AgentPluginsCapabilityReportSchema: z.ZodObject<{
8
4
  versions: z.ZodArray<z.ZodString>;
9
5
  skills: z.ZodBoolean;
@@ -1,8 +1,4 @@
1
1
  import { z } from 'zod';
2
- /**
3
- * Capability evidence reported by a tested runtime adapter. A harness name is
4
- * intentionally not enough to claim Agent Plugins support.
5
- */
6
2
  export const AgentPluginsCapabilityReportSchema = z
7
3
  .object({
8
4
  versions: z.array(z.string().min(1).max(32)).max(16),
@@ -35,11 +35,9 @@ export declare const RuntimeChannelSequenceRequestSchema: z.ZodObject<{
35
35
  minimum: z.ZodNumber;
36
36
  }, z.core.$strict>;
37
37
  export type RuntimeChannelSequenceRequest = z.output<typeof RuntimeChannelSequenceRequestSchema>;
38
- /** Reserve before sending; ambiguous/failed sends burn their range rather than reuse it. */
39
38
  export interface RuntimeChannelSequenceRepository {
40
39
  reserve(request: RuntimeChannelSequenceRequest): Promise<number>;
41
40
  }
42
- /** Durable fencing only; replacement notification is owned by the gateway coordinator. */
43
41
  export interface RuntimeChannelOwnershipRepository {
44
42
  claim(record: RuntimeChannelOwnership, credentialFence?: RuntimeChannelOwnershipCredentialFence): Promise<{
45
43
  accepted: boolean;
@@ -14,7 +14,6 @@ export declare const RuntimeInventoryScanSchema: z.ZodObject<{
14
14
  limit: z.ZodNumber;
15
15
  }, z.core.$strict>;
16
16
  export type RuntimeInventoryScan = z.output<typeof RuntimeInventoryScanSchema>;
17
- /** Internal worker scan across workspaces; not an end-user discovery operation. */
18
17
  export interface RuntimeInventoryCheckpointScanner {
19
18
  scan(input: RuntimeInventoryScan): Promise<readonly RuntimeInventoryCheckpoint[]>;
20
19
  }
@@ -43,50 +43,22 @@ export declare const PiDurableLeadReadEnvelopeSchema: z.ZodObject<{
43
43
  caller: typeof Caller;
44
44
  correlation: typeof Correlation;
45
45
  }, z.core.$strict>;
46
- /** Requested target reference: the session, task, and generation a caller
47
- * asks to bind to an intent, echoed back on every receipt. UNTRUSTED by
48
- * construction — the taskId is an opaque cross-system reference (Adea
49
- * UUIDs and control-plane tsk_ ids share no namespace), and no lookup
50
- * verifies the triple against session authority. Owners verify claimed
51
- * vs retained vs independently observed bindings together; the shape
52
- * alone proves nothing. */
53
46
  export declare const PiDurableLeadRequestedTargetSchema: z.ZodReadonly<z.ZodObject<{
54
47
  sessionId: z.ZodString;
55
48
  taskId: z.ZodString;
56
49
  generation: z.ZodNumber;
57
50
  }, z.core.$strict>>;
58
51
  export type PiDurableLeadRequestedTarget = z.output<typeof PiDurableLeadRequestedTargetSchema>;
59
- /** Server-owned execution observation: the session the runtime assigned
60
- * this execution, the authority-resolved plan task, and the generation the
61
- * runtime observed for the attempt that owns it. All three come from
62
- * server-held records (adapter handle + admitted plan + the runtime's own
63
- * observed generation), never from caller claims. A caller-claimed
64
- * generation is retained on the request and echoed back as a claim; it can
65
- * never appear here, because a claimed value laundered as an observation is
66
- * not an observation. The generation is additive in contract 3.1: a consumer
67
- * that advertised an earlier version parses with the strict pre-3.1 shape, so
68
- * a producer publishes it only to a negotiated consumer. */
69
52
  export declare const PiDurableLeadObservedTargetSchema: z.ZodReadonly<z.ZodObject<{
70
53
  sessionId: z.ZodString;
71
54
  taskId: z.ZodString;
72
55
  generation: z.ZodOptional<typeof RuntimeObservedGenerationSchema>;
73
56
  }, z.core.$strict>>;
74
57
  export type PiDurableLeadObservedTarget = z.output<typeof PiDurableLeadObservedTargetSchema>;
75
- /** The contract version that introduced the runtime-observed generation on the
76
- * lead receipt and on the runtime execution status. The field is optional and
77
- * additive within the major, but the pre-3.1 target and runtime-status shapes
78
- * are strict: a consumer that predates this version rejects an unknown key and
79
- * reports an invalid response. */
80
58
  export declare const PI_DURABLE_OBSERVED_GENERATION_CONTRACT_VERSION: {
81
59
  readonly major: 3;
82
60
  readonly minor: 1;
83
61
  };
84
- /** Whether a consumer that advertised `consumerVersion` negotiated a contract
85
- * that includes the runtime-observed generation. The producer and the consumer
86
- * negotiate the highest common major and the lower of the two minors, so an
87
- * earlier same-major consumer (or a consumer of another major) never receives
88
- * the field it cannot parse. A consumer that advertised a newer minor already
89
- * understands it. */
90
62
  export declare function supportsPiDurableObservedGeneration(consumerVersion: unknown): boolean;
91
63
  export declare const PiDurableLeadPrepareRequestSchema: z.ZodObject<{
92
64
  contractVersion: z.ZodObject<{
@@ -177,7 +149,6 @@ export declare const PiDurableLeadProgressRequestSchema: z.ZodObject<{
177
149
  afterSequence: z.ZodOptional<z.ZodNumber>;
178
150
  }, z.core.$strict>;
179
151
  }, z.core.$strict>;
180
- /** Position after which the next page of children starts: the last returned child's sort key. */
181
152
  export declare const PiDurableLeadChildrenCursorSchema: z.ZodReadonly<z.ZodObject<{
182
153
  acceptedAt: z.ZodISODateTime;
183
154
  delegationId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"delegation ID">, string>>;
@@ -202,6 +173,23 @@ export declare const PiDurableLeadChildrenRequestSchema: z.ZodObject<{
202
173
  limit: z.ZodOptional<z.ZodNumber>;
203
174
  }, z.core.$strict>;
204
175
  }, z.core.$strict>;
176
+ export declare const PiDurableLeadChildTargetRequestSchema: z.ZodObject<{
177
+ contractVersion: z.ZodObject<{
178
+ major: z.ZodNumber;
179
+ minor: z.ZodNumber;
180
+ }, z.core.$strict>;
181
+ requestId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"request ID">, string>>;
182
+ workspaceId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"workspace ID">, string>>;
183
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"project ID">, string>>>;
184
+ requestedAt: z.ZodISODateTime;
185
+ caller: typeof Caller;
186
+ correlation: typeof Correlation;
187
+ operation: z.ZodLiteral<"pi-durable.lead.child-target">;
188
+ parameters: z.ZodObject<{
189
+ dispatchId: typeof DispatchId;
190
+ delegationId: typeof IdentifierSchemas.delegationId;
191
+ }, z.core.$strict>;
192
+ }, z.core.$strict>;
205
193
  export declare const PiDurableLeadCancelRequestSchema: z.ZodObject<{
206
194
  contractVersion: z.ZodObject<{
207
195
  major: z.ZodNumber;
@@ -232,9 +220,6 @@ export declare const PiDurableLeadReceiptResponseSchema: z.ZodObject<{
232
220
  observedTarget: z.ZodOptional<typeof PiDurableLeadObservedTargetSchema>;
233
221
  }, z.core.$strict>;
234
222
  declare const PlanDigest: z.ZodString;
235
- /** What the accepted lead plan holds back for child executions. Disclosure only: never a funding,
236
- * admission or spending capability. `not_stated` means the plan holds nothing back, so only
237
- * balance the lead releases can fund children; it is not an error and not a missing disclosure. */
238
223
  export declare const PiDurableLeadChildAllowanceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
239
224
  schemaVersion: z.ZodLiteral<"pi-lead-child-allowance/v1">;
240
225
  executionPlanDigest: typeof PlanDigest;
@@ -259,7 +244,6 @@ export declare const PiDurableLeadChildAllowanceSchema: z.ZodDiscriminatedUnion<
259
244
  }, z.core.$strict>>;
260
245
  state: z.ZodLiteral<"not_stated">;
261
246
  }, z.core.$strict>], "state">;
262
- /** Disclosure bound to a prepared canonical attempt; never a spending or runtime capability. */
263
247
  export declare const PiDurableLeadPreparationSchema: z.ZodObject<{
264
248
  schemaVersion: z.ZodLiteral<"pi-lead-preparation/v1">;
265
249
  preparationRef: typeof PiDurableLeadPreparationRefSchema;
@@ -321,7 +305,6 @@ export declare const PiDurableLeadPrepareResponseSchema: z.ZodObject<{
321
305
  }, z.core.$strict>;
322
306
  data: typeof PiDurableLeadPreparationSchema;
323
307
  }, z.core.$strict>;
324
- /** Stored dispatch metadata; lookup never creates an execution or runtime session. */
325
308
  export declare const PiDurableLeadLookupResponseSchema: z.ZodObject<{
326
309
  contractVersion: z.ZodObject<{
327
310
  major: z.ZodNumber;
@@ -449,7 +432,6 @@ export declare const PiDurableLeadCancelResponseSchema: z.ZodObject<{
449
432
  }, z.core.$strict>;
450
433
  }, z.core.$strict>;
451
434
  declare const ChildReference: z.ZodString;
452
- /** Terminal child outcome as retained by the delegation record; identifiers and bounded codes only. */
453
435
  export declare const PiDurableLeadChildOutcomeSchema: z.ZodObject<{
454
436
  state: z.ZodEnum<{
455
437
  cancelled: "cancelled";
@@ -470,11 +452,6 @@ export declare const PiDurableLeadChildOutcomeSchema: z.ZodObject<{
470
452
  }>>;
471
453
  }, z.core.$strict>;
472
454
  }, z.core.$strict>;
473
- /**
474
- * Canonical, authorized view of one child job of a lead dispatch. It is read from retained
475
- * delegation records only: no prompt, objective, plan, digest, credential or native payload.
476
- * `awaitingInput` is the child's own approval/input state; it is observation, never a grant.
477
- */
478
455
  export declare const PiDurableLeadChildSchema: z.ZodObject<{
479
456
  delegationId: typeof IdentifierSchemas.delegationId;
480
457
  childExecutionId: typeof IdentifierSchemas.executionId;
@@ -497,12 +474,6 @@ export declare const PiDurableLeadChildSchema: z.ZodObject<{
497
474
  revision: z.ZodNumber;
498
475
  outcome: z.ZodOptional<typeof PiDurableLeadChildOutcomeSchema>;
499
476
  }, z.core.$strict>;
500
- /**
501
- * One page of the dispatch's children, ordered by acceptance time then delegation ID.
502
- * `totalChildren` counts every child of this dispatch at the time of the read, so a consumer
503
- * can tell a complete set from a page. `complete` is true only when this page ends the set;
504
- * otherwise `next` is the cursor for the following page. A page is never silently cut short.
505
- */
506
477
  export declare const PiDurableLeadChildrenResponseSchema: z.ZodObject<{
507
478
  contractVersion: z.ZodObject<{
508
479
  major: z.ZodNumber;
@@ -529,7 +500,52 @@ export declare const PiDurableLeadChildrenResponseSchema: z.ZodObject<{
529
500
  next: z.ZodOptional<typeof PiDurableLeadChildrenCursorSchema>;
530
501
  }, z.core.$strict>;
531
502
  }, z.core.$strict>;
532
- /** Existing versioned authenticated envelopes; payloads contain opaque references only. */
503
+ export declare const PiDurableLeadChildTargetSchema: z.ZodObject<{
504
+ source: z.ZodLiteral<"control_plane_reported">;
505
+ runtimeConnectionId: typeof IdentifierSchemas.runtimeConnectionId;
506
+ nativeSessionId: typeof IdentifierSchemas.externalSessionId;
507
+ nativeTaskId: typeof IdentifierSchemas.taskId;
508
+ nativeState: typeof RuntimeExecutionStateSchema;
509
+ observedAt: z.ZodISODateTime;
510
+ observedGeneration: z.ZodOptional<typeof RuntimeObservedGenerationSchema>;
511
+ }, z.core.$strict>;
512
+ export declare const PiDurableLeadChildTargetResponseSchema: z.ZodObject<{
513
+ contractVersion: z.ZodObject<{
514
+ major: z.ZodNumber;
515
+ minor: z.ZodNumber;
516
+ }, z.core.$strict>;
517
+ requestId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"request ID">, string>>;
518
+ correlation: z.ZodObject<{
519
+ traceId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"trace ID">, string>>;
520
+ causationCommandId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"command ID">, string>>>;
521
+ parentEventId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"event ID">, string>>>;
522
+ }, z.core.$strict>;
523
+ data: z.ZodObject<{
524
+ schemaVersion: z.ZodLiteral<"pi-lead-dispatch/v1">;
525
+ dispatchId: typeof DispatchId;
526
+ intentId: typeof IntentId;
527
+ executionId: typeof IdentifierSchemas.executionId;
528
+ attemptId: typeof IdentifierSchemas.attemptId;
529
+ runtimeSessionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"external-session ID">, string>>;
530
+ requestedTarget: z.ZodOptional<typeof PiDurableLeadRequestedTargetSchema>;
531
+ observedTarget: z.ZodOptional<typeof PiDurableLeadObservedTargetSchema>;
532
+ child: typeof PiDurableLeadChildSchema;
533
+ target: z.ZodNullable<z.ZodObject<{
534
+ source: z.ZodLiteral<"control_plane_reported">;
535
+ runtimeConnectionId: typeof IdentifierSchemas.runtimeConnectionId;
536
+ nativeSessionId: typeof IdentifierSchemas.externalSessionId;
537
+ nativeTaskId: typeof IdentifierSchemas.taskId;
538
+ nativeState: typeof RuntimeExecutionStateSchema;
539
+ observedAt: z.ZodISODateTime;
540
+ observedGeneration: z.ZodOptional<typeof RuntimeObservedGenerationSchema>;
541
+ }, z.core.$strict>>;
542
+ unavailableReason: z.ZodOptional<z.ZodEnum<{
543
+ NOT_CONFIGURED: "NOT_CONFIGURED";
544
+ NOT_STARTED: "NOT_STARTED";
545
+ UNAVAILABLE: "UNAVAILABLE";
546
+ }>>;
547
+ }, z.core.$strict>;
548
+ }, z.core.$strict>;
533
549
  export declare const PiDurableLeadHttpContract: Readonly<{
534
550
  schemaVersion: "pi-lead-dispatch/v1";
535
551
  basePath: "/v3/pi-durable/lead-dispatches";
@@ -576,6 +592,13 @@ export declare const PiDurableLeadHttpContract: Readonly<{
576
592
  requestSchema: typeof PiDurableLeadChildrenRequestSchema;
577
593
  responseSchema: typeof PiDurableLeadChildrenResponseSchema;
578
594
  }>;
595
+ childTarget: Readonly<{
596
+ route: "child-target";
597
+ operation: "pi-durable.lead.child-target";
598
+ scope: "execution:read";
599
+ requestSchema: typeof PiDurableLeadChildTargetRequestSchema;
600
+ responseSchema: typeof PiDurableLeadChildTargetResponseSchema;
601
+ }>;
579
602
  cancel: Readonly<{
580
603
  route: "cancel";
581
604
  operation: "pi-durable.lead.cancel";
@@ -601,4 +624,7 @@ export type PiDurableLeadChildrenResponse = z.output<typeof PiDurableLeadChildre
601
624
  export type PiDurableLeadChild = z.output<typeof PiDurableLeadChildSchema>;
602
625
  export type PiDurableLeadCancelRequest = z.output<typeof PiDurableLeadCancelRequestSchema>;
603
626
  export type PiDurableLeadCancelResponse = z.output<typeof PiDurableLeadCancelResponseSchema>;
627
+ export type PiDurableLeadChildTargetRequest = z.output<typeof PiDurableLeadChildTargetRequestSchema>;
628
+ export type PiDurableLeadChildTargetResponse = z.output<typeof PiDurableLeadChildTargetResponseSchema>;
629
+ export type PiDurableLeadChildTarget = z.output<typeof PiDurableLeadChildTargetSchema>;
604
630
  export {};
@@ -14,13 +14,6 @@ export const PiDurableLeadReadEnvelopeSchema = ReadRequestEnvelopeSchema.extend(
14
14
  caller: Caller,
15
15
  correlation: Correlation,
16
16
  }).strict();
17
- /** Requested target reference: the session, task, and generation a caller
18
- * asks to bind to an intent, echoed back on every receipt. UNTRUSTED by
19
- * construction — the taskId is an opaque cross-system reference (Adea
20
- * UUIDs and control-plane tsk_ ids share no namespace), and no lookup
21
- * verifies the triple against session authority. Owners verify claimed
22
- * vs retained vs independently observed bindings together; the shape
23
- * alone proves nothing. */
24
17
  export const PiDurableLeadRequestedTargetSchema = z
25
18
  .strictObject({
26
19
  sessionId: z.string().trim().min(1).max(256),
@@ -28,36 +21,14 @@ export const PiDurableLeadRequestedTargetSchema = z
28
21
  generation: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
29
22
  })
30
23
  .readonly();
31
- /** Server-owned execution observation: the session the runtime assigned
32
- * this execution, the authority-resolved plan task, and the generation the
33
- * runtime observed for the attempt that owns it. All three come from
34
- * server-held records (adapter handle + admitted plan + the runtime's own
35
- * observed generation), never from caller claims. A caller-claimed
36
- * generation is retained on the request and echoed back as a claim; it can
37
- * never appear here, because a claimed value laundered as an observation is
38
- * not an observation. The generation is additive in contract 3.1: a consumer
39
- * that advertised an earlier version parses with the strict pre-3.1 shape, so
40
- * a producer publishes it only to a negotiated consumer. */
41
24
  export const PiDurableLeadObservedTargetSchema = z
42
25
  .strictObject({
43
26
  sessionId: z.string().trim().min(1).max(256),
44
27
  taskId: z.string().trim().min(1).max(256),
45
- /** The runtime-observed generation, when the runtime has observed one. */
46
28
  generation: RuntimeObservedGenerationSchema.optional(),
47
29
  })
48
30
  .readonly();
49
- /** The contract version that introduced the runtime-observed generation on the
50
- * lead receipt and on the runtime execution status. The field is optional and
51
- * additive within the major, but the pre-3.1 target and runtime-status shapes
52
- * are strict: a consumer that predates this version rejects an unknown key and
53
- * reports an invalid response. */
54
31
  export const PI_DURABLE_OBSERVED_GENERATION_CONTRACT_VERSION = { major: 3, minor: 1 };
55
- /** Whether a consumer that advertised `consumerVersion` negotiated a contract
56
- * that includes the runtime-observed generation. The producer and the consumer
57
- * negotiate the highest common major and the lower of the two minors, so an
58
- * earlier same-major consumer (or a consumer of another major) never receives
59
- * the field it cannot parse. A consumer that advertised a newer minor already
60
- * understands it. */
61
32
  export function supportsPiDurableObservedGeneration(consumerVersion) {
62
33
  const consumer = ContractVersionSchema.safeParse(consumerVersion);
63
34
  if (!consumer.success)
@@ -68,12 +39,6 @@ export function supportsPiDurableObservedGeneration(consumerVersion) {
68
39
  return (negotiated.major === PI_DURABLE_OBSERVED_GENERATION_CONTRACT_VERSION.major &&
69
40
  negotiated.minor >= PI_DURABLE_OBSERVED_GENERATION_CONTRACT_VERSION.minor);
70
41
  }
71
- /** Every published observed generation must belong to the attempt the receipt
72
- * owns. A generation observed for another attempt is a late old-attempt
73
- * event: publishing it would fence the wrong attempt, so it is refused
74
- * instead. The fence covers both places a generation is published — the
75
- * observed target and the embedded runtime status — so no publication path
76
- * can carry a foreign generation. */
77
42
  function fenceForeignGeneration(receipt, context) {
78
43
  const foreign = (generation) => generation !== undefined && generation.attemptId !== receipt.attemptId;
79
44
  if (foreign(receipt.observedTarget?.generation))
@@ -120,7 +85,6 @@ export const PiDurableLeadProgressRequestSchema = PiDurableLeadReadEnvelopeSchem
120
85
  })
121
86
  .strict(),
122
87
  });
123
- /** Position after which the next page of children starts: the last returned child's sort key. */
124
88
  export const PiDurableLeadChildrenCursorSchema = z
125
89
  .object({ acceptedAt: z.iso.datetime(), delegationId: IdentifierSchemas.delegationId })
126
90
  .strict()
@@ -131,13 +95,20 @@ export const PiDurableLeadChildrenRequestSchema = PiDurableLeadReadEnvelopeSchem
131
95
  parameters: z
132
96
  .object({
133
97
  dispatchId: DispatchId,
134
- /** Resume strictly after this child (acceptance time, then delegation ID). */
135
98
  after: PiDurableLeadChildrenCursorSchema.optional(),
136
- /** Page size, 1..256; the default is the maximum. */
137
99
  limit: z.number().int().min(1).max(PI_DURABLE_LEAD_CHILDREN_MAX_PAGE).optional(),
138
100
  })
139
101
  .strict(),
140
102
  });
103
+ export const PiDurableLeadChildTargetRequestSchema = PiDurableLeadReadEnvelopeSchema.extend({
104
+ operation: z.literal('pi-durable.lead.child-target'),
105
+ parameters: z
106
+ .object({
107
+ dispatchId: DispatchId,
108
+ delegationId: IdentifierSchemas.delegationId,
109
+ })
110
+ .strict(),
111
+ });
141
112
  export const PiDurableLeadCancelRequestSchema = PiDurableLeadCommandEnvelopeSchema.extend({
142
113
  operation: z.literal('pi-durable.lead.cancel'),
143
114
  payload: z.object({ dispatchId: DispatchId }).strict(),
@@ -161,9 +132,7 @@ const response = SuccessResponseEnvelopeSchema.extend({ correlation: Correlation
161
132
  const PlanDigest = z.string().regex(/^sha256:[a-f0-9]{64}$/);
162
133
  const ChildAllowanceBinding = {
163
134
  schemaVersion: z.literal('pi-lead-child-allowance/v1'),
164
- /** The accepted plan the statement is read from; the same plan the lead attempt runs under. */
165
135
  executionPlanDigest: PlanDigest,
166
- /** Pinned profile version the plan was compiled from; matches a caller's opaque profile pin. */
167
136
  profile: z
168
137
  .strictObject({
169
138
  profileId: IdentifierSchemas.profileId,
@@ -173,9 +142,6 @@ const ChildAllowanceBinding = {
173
142
  })
174
143
  .readonly(),
175
144
  };
176
- /** What the accepted lead plan holds back for child executions. Disclosure only: never a funding,
177
- * admission or spending capability. `not_stated` means the plan holds nothing back, so only
178
- * balance the lead releases can fund children; it is not an error and not a missing disclosure. */
179
145
  export const PiDurableLeadChildAllowanceSchema = z.discriminatedUnion('state', [
180
146
  z.strictObject({
181
147
  ...ChildAllowanceBinding,
@@ -186,7 +152,6 @@ export const PiDurableLeadChildAllowanceSchema = z.discriminatedUnion('state', [
186
152
  }),
187
153
  z.strictObject({ ...ChildAllowanceBinding, state: z.literal('not_stated') }),
188
154
  ]);
189
- /** Disclosure bound to a prepared canonical attempt; never a spending or runtime capability. */
190
155
  export const PiDurableLeadPreparationSchema = z
191
156
  .object({
192
157
  schemaVersion: z.literal('pi-lead-preparation/v1'),
@@ -197,7 +162,6 @@ export const PiDurableLeadPreparationSchema = z
197
162
  selectionRef: ModelSelectionRefSchema,
198
163
  selectionRevision: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
199
164
  funding: ModelSelectionFundingViewSchema.options[0],
200
- /** Absent from a control plane that predates this disclosure; absence is not `not_stated`. */
201
165
  childAllowance: PiDurableLeadChildAllowanceSchema.optional(),
202
166
  expiresAt: z.iso.datetime(),
203
167
  replayed: z.boolean(),
@@ -222,7 +186,6 @@ export const PiDurableLeadPreparationSchema = z
222
186
  export const PiDurableLeadPrepareResponseSchema = response.extend({
223
187
  data: PiDurableLeadPreparationSchema,
224
188
  });
225
- /** Stored dispatch metadata; lookup never creates an execution or runtime session. */
226
189
  export const PiDurableLeadLookupResponseSchema = response.extend({
227
190
  data: z
228
191
  .object({
@@ -243,8 +206,6 @@ export const PiDurableLeadLookupResponseSchema = response.extend({
243
206
  })
244
207
  .strict()
245
208
  .superRefine((receipt, context) => {
246
- // Same fence as the live receipt: an observed generation belongs to
247
- // the attempt that owns it.
248
209
  fenceForeignGeneration(receipt, context);
249
210
  })
250
211
  .nullable(),
@@ -276,7 +237,6 @@ const ChildReference = z
276
237
  .min(1)
277
238
  .max(256)
278
239
  .regex(/^[A-Za-z0-9._:/-]+$/);
279
- /** Terminal child outcome as retained by the delegation record; identifiers and bounded codes only. */
280
240
  export const PiDurableLeadChildOutcomeSchema = z
281
241
  .object({
282
242
  state: z.enum(['completed', 'failed', 'cancelled']),
@@ -290,11 +250,6 @@ export const PiDurableLeadChildOutcomeSchema = z
290
250
  .strict(),
291
251
  })
292
252
  .strict();
293
- /**
294
- * Canonical, authorized view of one child job of a lead dispatch. It is read from retained
295
- * delegation records only: no prompt, objective, plan, digest, credential or native payload.
296
- * `awaitingInput` is the child's own approval/input state; it is observation, never a grant.
297
- */
298
253
  export const PiDurableLeadChildSchema = z
299
254
  .object({
300
255
  delegationId: IdentifierSchemas.delegationId,
@@ -319,12 +274,6 @@ export const PiDurableLeadChildSchema = z
319
274
  outcome: PiDurableLeadChildOutcomeSchema.optional(),
320
275
  })
321
276
  .strict();
322
- /**
323
- * One page of the dispatch's children, ordered by acceptance time then delegation ID.
324
- * `totalChildren` counts every child of this dispatch at the time of the read, so a consumer
325
- * can tell a complete set from a page. `complete` is true only when this page ends the set;
326
- * otherwise `next` is the cursor for the following page. A page is never silently cut short.
327
- */
328
277
  export const PiDurableLeadChildrenResponseSchema = response.extend({
329
278
  data: PiDurableLeadReceiptResponseSchema.extend({
330
279
  children: z
@@ -348,7 +297,33 @@ export const PiDurableLeadChildrenResponseSchema = response.extend({
348
297
  });
349
298
  }),
350
299
  });
351
- /** Existing versioned authenticated envelopes; payloads contain opaque references only. */
300
+ export const PiDurableLeadChildTargetSchema = z.strictObject({
301
+ source: z.literal('control_plane_reported'),
302
+ runtimeConnectionId: IdentifierSchemas.runtimeConnectionId,
303
+ nativeSessionId: IdentifierSchemas.externalSessionId,
304
+ nativeTaskId: IdentifierSchemas.taskId,
305
+ nativeState: RuntimeExecutionStateSchema,
306
+ observedAt: z.iso.datetime(),
307
+ observedGeneration: RuntimeObservedGenerationSchema.optional(),
308
+ });
309
+ export const PiDurableLeadChildTargetResponseSchema = response.extend({
310
+ data: PiDurableLeadReceiptResponseSchema.extend({
311
+ child: PiDurableLeadChildSchema,
312
+ target: PiDurableLeadChildTargetSchema.nullable(),
313
+ unavailableReason: z.enum(['NOT_STARTED', 'NOT_CONFIGURED', 'UNAVAILABLE']).optional(),
314
+ }).superRefine((value, context) => {
315
+ if ((value.target === null) !== (value.unavailableReason !== undefined))
316
+ context.addIssue({ code: 'custom', message: 'Unavailable target requires a bounded reason' });
317
+ if (value.target &&
318
+ (value.child.childAttemptId === undefined ||
319
+ (value.target.observedGeneration !== undefined &&
320
+ value.target.observedGeneration.attemptId !== value.child.childAttemptId)))
321
+ context.addIssue({
322
+ code: 'custom',
323
+ message: 'Native target must bind the selected child attempt',
324
+ });
325
+ }),
326
+ });
352
327
  export const PiDurableLeadHttpContract = Object.freeze({
353
328
  schemaVersion: 'pi-lead-dispatch/v1',
354
329
  basePath: '/v3/pi-durable/lead-dispatches',
@@ -395,6 +370,13 @@ export const PiDurableLeadHttpContract = Object.freeze({
395
370
  requestSchema: PiDurableLeadChildrenRequestSchema,
396
371
  responseSchema: PiDurableLeadChildrenResponseSchema,
397
372
  }),
373
+ childTarget: Object.freeze({
374
+ route: 'child-target',
375
+ operation: 'pi-durable.lead.child-target',
376
+ scope: 'execution:read',
377
+ requestSchema: PiDurableLeadChildTargetRequestSchema,
378
+ responseSchema: PiDurableLeadChildTargetResponseSchema,
379
+ }),
398
380
  cancel: Object.freeze({
399
381
  route: 'cancel',
400
382
  operation: 'pi-durable.lead.cancel',
package/dist/routing.js CHANGED
@@ -306,12 +306,7 @@ function normalizeRoutingInput(input) {
306
306
  .toSorted((left, right) => compareCodePointOrder(left.runtimeConnectionId, right.runtimeConnectionId)),
307
307
  };
308
308
  }
309
- // The digest below serializes fixed-order literals, so verification recomputes
310
- // over the persisted array order and stored decisions remain verifiable across
311
- // this ordering change (#612 in-place disposition, same rationale as #618).
312
309
  function compareCoded(left, right) {
313
- // Code-point ordering keeps decision serialization host-independent; stored
314
- // decisions always verify against their own persisted array order (#612).
315
310
  return compareCodePointOrder(`${left.code}:${left.capability ?? ''}`, `${right.code}:${right.capability ?? ''}`);
316
311
  }
317
312
  function digest(value) {
@@ -1,14 +1,6 @@
1
1
  import type { RuntimeAdapter, RuntimeAdapterInspection, RuntimeApprovalRequest, RuntimeCancelRequest, RuntimeExecutionHandle, RuntimeExecutionProgress, RuntimeExecutionStatus, RuntimeInputRequest, RuntimeProgressOptions, RuntimeSessionOperation, RuntimeSessionResult, RuntimeStartRequest } from './adapter.js';
2
2
  export type RuntimeTransportKind = 'direct-local' | 'remote-gateway';
3
- /**
4
- * Concrete runtime operations at the location where a harness executes.
5
- * Drivers do not decide whether their caller is co-located or remote.
6
- */
7
3
  export type RuntimeDriver = RuntimeAdapter;
8
- /**
9
- * Selects how normalized RuntimeAdapter operations reach a RuntimeDriver.
10
- * Transport choice is topology metadata and never changes semantic payloads.
11
- */
12
4
  export interface RuntimeTransport extends RuntimeAdapter {
13
5
  readonly kind: RuntimeTransportKind;
14
6
  }
@@ -32,7 +24,6 @@ declare abstract class DelegatingRuntimeAdapter implements RuntimeAdapter {
32
24
  declare abstract class DelegatingRuntimeTransport extends DelegatingRuntimeAdapter implements RuntimeTransport {
33
25
  abstract readonly kind: RuntimeTransportKind;
34
26
  }
35
- /** Adapter-side facade that records topology while preserving the driver's semantic surface. */
36
27
  export declare class TransportedRuntimeAdapter extends DelegatingRuntimeAdapter implements RuntimeAdapterWithTransport {
37
28
  protected readonly transport: RuntimeTransport;
38
29
  readonly expectedAdapterName: string;
@@ -40,14 +31,9 @@ export declare class TransportedRuntimeAdapter extends DelegatingRuntimeAdapter
40
31
  constructor(transport: RuntimeTransport, expectedAdapterName: string);
41
32
  inspect(requirements?: Parameters<RuntimeAdapter['inspect']>[0]): Promise<RuntimeAdapterInspection>;
42
33
  }
43
- /** In-process/IPC-free transport for a co-located Local or Hosted runtime driver. */
44
34
  export declare class DirectLocalRuntimeTransport extends DelegatingRuntimeTransport {
45
35
  readonly kind: 'direct-local';
46
36
  }
47
- /**
48
- * Semantic wrapper for a driver proxy backed by the authenticated Runtime Gateway.
49
- * Wire delivery, reconnect, and command-ledger behavior remain in the proxy driver.
50
- */
51
37
  export declare class RemoteRuntimeGatewayTransport extends DelegatingRuntimeTransport {
52
38
  readonly kind: 'remote-gateway';
53
39
  }
package/dist/transport.js CHANGED
@@ -37,7 +37,6 @@ class DelegatingRuntimeAdapter {
37
37
  }
38
38
  class DelegatingRuntimeTransport extends DelegatingRuntimeAdapter {
39
39
  }
40
- /** Adapter-side facade that records topology while preserving the driver's semantic surface. */
41
40
  export class TransportedRuntimeAdapter extends DelegatingRuntimeAdapter {
42
41
  transport;
43
42
  expectedAdapterName;
@@ -59,14 +58,9 @@ export class TransportedRuntimeAdapter extends DelegatingRuntimeAdapter {
59
58
  });
60
59
  }
61
60
  }
62
- /** In-process/IPC-free transport for a co-located Local or Hosted runtime driver. */
63
61
  export class DirectLocalRuntimeTransport extends DelegatingRuntimeTransport {
64
62
  kind = 'direct-local';
65
63
  }
66
- /**
67
- * Semantic wrapper for a driver proxy backed by the authenticated Runtime Gateway.
68
- * Wire delivery, reconnect, and command-ledger behavior remain in the proxy driver.
69
- */
70
64
  export class RemoteRuntimeGatewayTransport extends DelegatingRuntimeTransport {
71
65
  kind = 'remote-gateway';
72
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/runtime-sdk",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "description": "SDK for building Control Plane runtimes: adapters, capabilities, conformance, discovery, eligibility, health, sessions, transport, and routing.",
5
5
  "keywords": [
6
6
  "adapter",