@adea-ai/runtime-sdk 1.17.2 → 1.19.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 +0 -19
- package/dist/adapter.js +0 -25
- package/dist/agent-plugins.d.ts +0 -4
- package/dist/agent-plugins.js +0 -4
- package/dist/channel-ownership.d.ts +0 -2
- package/dist/inventory.d.ts +0 -1
- package/dist/pi-durable-lead.d.ts +104 -47
- package/dist/pi-durable-lead.js +83 -61
- package/dist/routing.js +0 -5
- package/dist/transport.d.ts +0 -14
- package/dist/transport.js +0 -6
- package/package.json +2 -2
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),
|
package/dist/agent-plugins.d.ts
CHANGED
|
@@ -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;
|
package/dist/agent-plugins.js
CHANGED
|
@@ -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;
|
package/dist/inventory.d.ts
CHANGED
|
@@ -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,51 +43,28 @@ 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;
|
|
63
|
+
export declare const PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION: {
|
|
64
|
+
readonly major: 3;
|
|
65
|
+
readonly minor: 2;
|
|
66
|
+
};
|
|
67
|
+
export declare function supportsPiDurableRemoteSessionReference(consumerVersion: unknown): boolean;
|
|
91
68
|
export declare const PiDurableLeadPrepareRequestSchema: z.ZodObject<{
|
|
92
69
|
contractVersion: z.ZodObject<{
|
|
93
70
|
major: z.ZodNumber;
|
|
@@ -177,7 +154,6 @@ export declare const PiDurableLeadProgressRequestSchema: z.ZodObject<{
|
|
|
177
154
|
afterSequence: z.ZodOptional<z.ZodNumber>;
|
|
178
155
|
}, z.core.$strict>;
|
|
179
156
|
}, z.core.$strict>;
|
|
180
|
-
/** Position after which the next page of children starts: the last returned child's sort key. */
|
|
181
157
|
export declare const PiDurableLeadChildrenCursorSchema: z.ZodReadonly<z.ZodObject<{
|
|
182
158
|
acceptedAt: z.ZodISODateTime;
|
|
183
159
|
delegationId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"delegation ID">, string>>;
|
|
@@ -202,6 +178,23 @@ export declare const PiDurableLeadChildrenRequestSchema: z.ZodObject<{
|
|
|
202
178
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
203
179
|
}, z.core.$strict>;
|
|
204
180
|
}, z.core.$strict>;
|
|
181
|
+
export declare const PiDurableLeadChildTargetRequestSchema: z.ZodObject<{
|
|
182
|
+
contractVersion: z.ZodObject<{
|
|
183
|
+
major: z.ZodNumber;
|
|
184
|
+
minor: z.ZodNumber;
|
|
185
|
+
}, z.core.$strict>;
|
|
186
|
+
requestId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"request ID">, string>>;
|
|
187
|
+
workspaceId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"workspace ID">, string>>;
|
|
188
|
+
projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"project ID">, string>>>;
|
|
189
|
+
requestedAt: z.ZodISODateTime;
|
|
190
|
+
caller: typeof Caller;
|
|
191
|
+
correlation: typeof Correlation;
|
|
192
|
+
operation: z.ZodLiteral<"pi-durable.lead.child-target">;
|
|
193
|
+
parameters: z.ZodObject<{
|
|
194
|
+
dispatchId: typeof DispatchId;
|
|
195
|
+
delegationId: typeof IdentifierSchemas.delegationId;
|
|
196
|
+
}, z.core.$strict>;
|
|
197
|
+
}, z.core.$strict>;
|
|
205
198
|
export declare const PiDurableLeadCancelRequestSchema: z.ZodObject<{
|
|
206
199
|
contractVersion: z.ZodObject<{
|
|
207
200
|
major: z.ZodNumber;
|
|
@@ -232,9 +225,6 @@ export declare const PiDurableLeadReceiptResponseSchema: z.ZodObject<{
|
|
|
232
225
|
observedTarget: z.ZodOptional<typeof PiDurableLeadObservedTargetSchema>;
|
|
233
226
|
}, z.core.$strict>;
|
|
234
227
|
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
228
|
export declare const PiDurableLeadChildAllowanceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
239
229
|
schemaVersion: z.ZodLiteral<"pi-lead-child-allowance/v1">;
|
|
240
230
|
executionPlanDigest: typeof PlanDigest;
|
|
@@ -259,7 +249,6 @@ export declare const PiDurableLeadChildAllowanceSchema: z.ZodDiscriminatedUnion<
|
|
|
259
249
|
}, z.core.$strict>>;
|
|
260
250
|
state: z.ZodLiteral<"not_stated">;
|
|
261
251
|
}, z.core.$strict>], "state">;
|
|
262
|
-
/** Disclosure bound to a prepared canonical attempt; never a spending or runtime capability. */
|
|
263
252
|
export declare const PiDurableLeadPreparationSchema: z.ZodObject<{
|
|
264
253
|
schemaVersion: z.ZodLiteral<"pi-lead-preparation/v1">;
|
|
265
254
|
preparationRef: typeof PiDurableLeadPreparationRefSchema;
|
|
@@ -321,7 +310,6 @@ export declare const PiDurableLeadPrepareResponseSchema: z.ZodObject<{
|
|
|
321
310
|
}, z.core.$strict>;
|
|
322
311
|
data: typeof PiDurableLeadPreparationSchema;
|
|
323
312
|
}, z.core.$strict>;
|
|
324
|
-
/** Stored dispatch metadata; lookup never creates an execution or runtime session. */
|
|
325
313
|
export declare const PiDurableLeadLookupResponseSchema: z.ZodObject<{
|
|
326
314
|
contractVersion: z.ZodObject<{
|
|
327
315
|
major: z.ZodNumber;
|
|
@@ -449,7 +437,6 @@ export declare const PiDurableLeadCancelResponseSchema: z.ZodObject<{
|
|
|
449
437
|
}, z.core.$strict>;
|
|
450
438
|
}, z.core.$strict>;
|
|
451
439
|
declare const ChildReference: z.ZodString;
|
|
452
|
-
/** Terminal child outcome as retained by the delegation record; identifiers and bounded codes only. */
|
|
453
440
|
export declare const PiDurableLeadChildOutcomeSchema: z.ZodObject<{
|
|
454
441
|
state: z.ZodEnum<{
|
|
455
442
|
cancelled: "cancelled";
|
|
@@ -470,11 +457,6 @@ export declare const PiDurableLeadChildOutcomeSchema: z.ZodObject<{
|
|
|
470
457
|
}>>;
|
|
471
458
|
}, z.core.$strict>;
|
|
472
459
|
}, 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
460
|
export declare const PiDurableLeadChildSchema: z.ZodObject<{
|
|
479
461
|
delegationId: typeof IdentifierSchemas.delegationId;
|
|
480
462
|
childExecutionId: typeof IdentifierSchemas.executionId;
|
|
@@ -497,12 +479,6 @@ export declare const PiDurableLeadChildSchema: z.ZodObject<{
|
|
|
497
479
|
revision: z.ZodNumber;
|
|
498
480
|
outcome: z.ZodOptional<typeof PiDurableLeadChildOutcomeSchema>;
|
|
499
481
|
}, 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
482
|
export declare const PiDurableLeadChildrenResponseSchema: z.ZodObject<{
|
|
507
483
|
contractVersion: z.ZodObject<{
|
|
508
484
|
major: z.ZodNumber;
|
|
@@ -529,7 +505,78 @@ export declare const PiDurableLeadChildrenResponseSchema: z.ZodObject<{
|
|
|
529
505
|
next: z.ZodOptional<typeof PiDurableLeadChildrenCursorSchema>;
|
|
530
506
|
}, z.core.$strict>;
|
|
531
507
|
}, z.core.$strict>;
|
|
532
|
-
|
|
508
|
+
export declare const PiDurableLeadChildTargetSchema: z.ZodObject<{
|
|
509
|
+
source: z.ZodLiteral<"control_plane_reported">;
|
|
510
|
+
runtimeConnectionId: typeof IdentifierSchemas.runtimeConnectionId;
|
|
511
|
+
nativeSessionId: typeof IdentifierSchemas.externalSessionId;
|
|
512
|
+
nativeTaskId: typeof IdentifierSchemas.taskId;
|
|
513
|
+
nativeState: typeof RuntimeExecutionStateSchema;
|
|
514
|
+
observedAt: z.ZodISODateTime;
|
|
515
|
+
observedGeneration: z.ZodOptional<typeof RuntimeObservedGenerationSchema>;
|
|
516
|
+
}, z.core.$strict>;
|
|
517
|
+
export declare const PiDurableLeadRemoteSessionReferenceSchema: z.ZodReadonly<z.ZodObject<{
|
|
518
|
+
schemaVersion: z.ZodLiteral<"pi-child-remote-session-reference/v1">;
|
|
519
|
+
source: z.ZodLiteral<"control_plane_reported">;
|
|
520
|
+
basis: z.ZodLiteral<"retained_native_attribution">;
|
|
521
|
+
runtimeConnectionId: typeof IdentifierSchemas.runtimeConnectionId;
|
|
522
|
+
nativeSessionId: typeof IdentifierSchemas.externalSessionId;
|
|
523
|
+
permission: z.ZodLiteral<"none">;
|
|
524
|
+
history: z.ZodLiteral<"adapter_journal_only">;
|
|
525
|
+
attachment: z.ZodLiteral<"unavailable">;
|
|
526
|
+
}, z.core.$strict>>;
|
|
527
|
+
export type PiDurableLeadRemoteSessionReference = z.output<typeof PiDurableLeadRemoteSessionReferenceSchema>;
|
|
528
|
+
export declare const PiDurableLeadChildTargetResponseSchema: z.ZodObject<{
|
|
529
|
+
contractVersion: z.ZodObject<{
|
|
530
|
+
major: z.ZodNumber;
|
|
531
|
+
minor: z.ZodNumber;
|
|
532
|
+
}, z.core.$strict>;
|
|
533
|
+
requestId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"request ID">, string>>;
|
|
534
|
+
correlation: z.ZodObject<{
|
|
535
|
+
traceId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"trace ID">, string>>;
|
|
536
|
+
causationCommandId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"command ID">, string>>>;
|
|
537
|
+
parentEventId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"event ID">, string>>>;
|
|
538
|
+
}, z.core.$strict>;
|
|
539
|
+
data: z.ZodObject<{
|
|
540
|
+
schemaVersion: z.ZodLiteral<"pi-lead-dispatch/v1">;
|
|
541
|
+
dispatchId: typeof DispatchId;
|
|
542
|
+
intentId: typeof IntentId;
|
|
543
|
+
executionId: typeof IdentifierSchemas.executionId;
|
|
544
|
+
attemptId: typeof IdentifierSchemas.attemptId;
|
|
545
|
+
runtimeSessionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"external-session ID">, string>>;
|
|
546
|
+
requestedTarget: z.ZodOptional<typeof PiDurableLeadRequestedTargetSchema>;
|
|
547
|
+
observedTarget: z.ZodOptional<typeof PiDurableLeadObservedTargetSchema>;
|
|
548
|
+
child: typeof PiDurableLeadChildSchema;
|
|
549
|
+
target: z.ZodNullable<z.ZodObject<{
|
|
550
|
+
source: z.ZodLiteral<"control_plane_reported">;
|
|
551
|
+
runtimeConnectionId: typeof IdentifierSchemas.runtimeConnectionId;
|
|
552
|
+
nativeSessionId: typeof IdentifierSchemas.externalSessionId;
|
|
553
|
+
nativeTaskId: typeof IdentifierSchemas.taskId;
|
|
554
|
+
nativeState: typeof RuntimeExecutionStateSchema;
|
|
555
|
+
observedAt: z.ZodISODateTime;
|
|
556
|
+
observedGeneration: z.ZodOptional<typeof RuntimeObservedGenerationSchema>;
|
|
557
|
+
}, z.core.$strict>>;
|
|
558
|
+
unavailableReason: z.ZodOptional<z.ZodEnum<{
|
|
559
|
+
NOT_CONFIGURED: "NOT_CONFIGURED";
|
|
560
|
+
NOT_STARTED: "NOT_STARTED";
|
|
561
|
+
UNAVAILABLE: "UNAVAILABLE";
|
|
562
|
+
}>>;
|
|
563
|
+
remoteSessionReference: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodObject<{
|
|
564
|
+
schemaVersion: z.ZodLiteral<"pi-child-remote-session-reference/v1">;
|
|
565
|
+
source: z.ZodLiteral<"control_plane_reported">;
|
|
566
|
+
basis: z.ZodLiteral<"retained_native_attribution">;
|
|
567
|
+
runtimeConnectionId: typeof IdentifierSchemas.runtimeConnectionId;
|
|
568
|
+
nativeSessionId: typeof IdentifierSchemas.externalSessionId;
|
|
569
|
+
permission: z.ZodLiteral<"none">;
|
|
570
|
+
history: z.ZodLiteral<"adapter_journal_only">;
|
|
571
|
+
attachment: z.ZodLiteral<"unavailable">;
|
|
572
|
+
}, z.core.$strict>>>>;
|
|
573
|
+
remoteSessionReferenceUnavailableReason: z.ZodOptional<z.ZodEnum<{
|
|
574
|
+
NOT_CONFIGURED: "NOT_CONFIGURED";
|
|
575
|
+
NOT_STARTED: "NOT_STARTED";
|
|
576
|
+
UNAVAILABLE: "UNAVAILABLE";
|
|
577
|
+
}>>;
|
|
578
|
+
}, z.core.$strict>;
|
|
579
|
+
}, z.core.$strict>;
|
|
533
580
|
export declare const PiDurableLeadHttpContract: Readonly<{
|
|
534
581
|
schemaVersion: "pi-lead-dispatch/v1";
|
|
535
582
|
basePath: "/v3/pi-durable/lead-dispatches";
|
|
@@ -576,6 +623,13 @@ export declare const PiDurableLeadHttpContract: Readonly<{
|
|
|
576
623
|
requestSchema: typeof PiDurableLeadChildrenRequestSchema;
|
|
577
624
|
responseSchema: typeof PiDurableLeadChildrenResponseSchema;
|
|
578
625
|
}>;
|
|
626
|
+
childTarget: Readonly<{
|
|
627
|
+
route: "child-target";
|
|
628
|
+
operation: "pi-durable.lead.child-target";
|
|
629
|
+
scope: "execution:read";
|
|
630
|
+
requestSchema: typeof PiDurableLeadChildTargetRequestSchema;
|
|
631
|
+
responseSchema: typeof PiDurableLeadChildTargetResponseSchema;
|
|
632
|
+
}>;
|
|
579
633
|
cancel: Readonly<{
|
|
580
634
|
route: "cancel";
|
|
581
635
|
operation: "pi-durable.lead.cancel";
|
|
@@ -601,4 +655,7 @@ export type PiDurableLeadChildrenResponse = z.output<typeof PiDurableLeadChildre
|
|
|
601
655
|
export type PiDurableLeadChild = z.output<typeof PiDurableLeadChildSchema>;
|
|
602
656
|
export type PiDurableLeadCancelRequest = z.output<typeof PiDurableLeadCancelRequestSchema>;
|
|
603
657
|
export type PiDurableLeadCancelResponse = z.output<typeof PiDurableLeadCancelResponseSchema>;
|
|
658
|
+
export type PiDurableLeadChildTargetRequest = z.output<typeof PiDurableLeadChildTargetRequestSchema>;
|
|
659
|
+
export type PiDurableLeadChildTargetResponse = z.output<typeof PiDurableLeadChildTargetResponseSchema>;
|
|
660
|
+
export type PiDurableLeadChildTarget = z.output<typeof PiDurableLeadChildTargetSchema>;
|
|
604
661
|
export {};
|
package/dist/pi-durable-lead.js
CHANGED
|
@@ -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,15 @@ 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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
42
|
+
export const PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION = { major: 3, minor: 2 };
|
|
43
|
+
export function supportsPiDurableRemoteSessionReference(consumerVersion) {
|
|
44
|
+
const consumer = ContractVersionSchema.safeParse(consumerVersion);
|
|
45
|
+
if (!consumer.success)
|
|
46
|
+
return false;
|
|
47
|
+
const negotiated = negotiateContractVersion([PublicContractManifest.current], [consumer.data]);
|
|
48
|
+
return (negotiated?.major === PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION.major &&
|
|
49
|
+
negotiated.minor >= PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION.minor);
|
|
50
|
+
}
|
|
77
51
|
function fenceForeignGeneration(receipt, context) {
|
|
78
52
|
const foreign = (generation) => generation !== undefined && generation.attemptId !== receipt.attemptId;
|
|
79
53
|
if (foreign(receipt.observedTarget?.generation))
|
|
@@ -120,7 +94,6 @@ export const PiDurableLeadProgressRequestSchema = PiDurableLeadReadEnvelopeSchem
|
|
|
120
94
|
})
|
|
121
95
|
.strict(),
|
|
122
96
|
});
|
|
123
|
-
/** Position after which the next page of children starts: the last returned child's sort key. */
|
|
124
97
|
export const PiDurableLeadChildrenCursorSchema = z
|
|
125
98
|
.object({ acceptedAt: z.iso.datetime(), delegationId: IdentifierSchemas.delegationId })
|
|
126
99
|
.strict()
|
|
@@ -131,13 +104,20 @@ export const PiDurableLeadChildrenRequestSchema = PiDurableLeadReadEnvelopeSchem
|
|
|
131
104
|
parameters: z
|
|
132
105
|
.object({
|
|
133
106
|
dispatchId: DispatchId,
|
|
134
|
-
/** Resume strictly after this child (acceptance time, then delegation ID). */
|
|
135
107
|
after: PiDurableLeadChildrenCursorSchema.optional(),
|
|
136
|
-
/** Page size, 1..256; the default is the maximum. */
|
|
137
108
|
limit: z.number().int().min(1).max(PI_DURABLE_LEAD_CHILDREN_MAX_PAGE).optional(),
|
|
138
109
|
})
|
|
139
110
|
.strict(),
|
|
140
111
|
});
|
|
112
|
+
export const PiDurableLeadChildTargetRequestSchema = PiDurableLeadReadEnvelopeSchema.extend({
|
|
113
|
+
operation: z.literal('pi-durable.lead.child-target'),
|
|
114
|
+
parameters: z
|
|
115
|
+
.object({
|
|
116
|
+
dispatchId: DispatchId,
|
|
117
|
+
delegationId: IdentifierSchemas.delegationId,
|
|
118
|
+
})
|
|
119
|
+
.strict(),
|
|
120
|
+
});
|
|
141
121
|
export const PiDurableLeadCancelRequestSchema = PiDurableLeadCommandEnvelopeSchema.extend({
|
|
142
122
|
operation: z.literal('pi-durable.lead.cancel'),
|
|
143
123
|
payload: z.object({ dispatchId: DispatchId }).strict(),
|
|
@@ -161,9 +141,7 @@ const response = SuccessResponseEnvelopeSchema.extend({ correlation: Correlation
|
|
|
161
141
|
const PlanDigest = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
162
142
|
const ChildAllowanceBinding = {
|
|
163
143
|
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
144
|
executionPlanDigest: PlanDigest,
|
|
166
|
-
/** Pinned profile version the plan was compiled from; matches a caller's opaque profile pin. */
|
|
167
145
|
profile: z
|
|
168
146
|
.strictObject({
|
|
169
147
|
profileId: IdentifierSchemas.profileId,
|
|
@@ -173,9 +151,6 @@ const ChildAllowanceBinding = {
|
|
|
173
151
|
})
|
|
174
152
|
.readonly(),
|
|
175
153
|
};
|
|
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
154
|
export const PiDurableLeadChildAllowanceSchema = z.discriminatedUnion('state', [
|
|
180
155
|
z.strictObject({
|
|
181
156
|
...ChildAllowanceBinding,
|
|
@@ -186,7 +161,6 @@ export const PiDurableLeadChildAllowanceSchema = z.discriminatedUnion('state', [
|
|
|
186
161
|
}),
|
|
187
162
|
z.strictObject({ ...ChildAllowanceBinding, state: z.literal('not_stated') }),
|
|
188
163
|
]);
|
|
189
|
-
/** Disclosure bound to a prepared canonical attempt; never a spending or runtime capability. */
|
|
190
164
|
export const PiDurableLeadPreparationSchema = z
|
|
191
165
|
.object({
|
|
192
166
|
schemaVersion: z.literal('pi-lead-preparation/v1'),
|
|
@@ -197,7 +171,6 @@ export const PiDurableLeadPreparationSchema = z
|
|
|
197
171
|
selectionRef: ModelSelectionRefSchema,
|
|
198
172
|
selectionRevision: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
199
173
|
funding: ModelSelectionFundingViewSchema.options[0],
|
|
200
|
-
/** Absent from a control plane that predates this disclosure; absence is not `not_stated`. */
|
|
201
174
|
childAllowance: PiDurableLeadChildAllowanceSchema.optional(),
|
|
202
175
|
expiresAt: z.iso.datetime(),
|
|
203
176
|
replayed: z.boolean(),
|
|
@@ -222,7 +195,6 @@ export const PiDurableLeadPreparationSchema = z
|
|
|
222
195
|
export const PiDurableLeadPrepareResponseSchema = response.extend({
|
|
223
196
|
data: PiDurableLeadPreparationSchema,
|
|
224
197
|
});
|
|
225
|
-
/** Stored dispatch metadata; lookup never creates an execution or runtime session. */
|
|
226
198
|
export const PiDurableLeadLookupResponseSchema = response.extend({
|
|
227
199
|
data: z
|
|
228
200
|
.object({
|
|
@@ -243,8 +215,6 @@ export const PiDurableLeadLookupResponseSchema = response.extend({
|
|
|
243
215
|
})
|
|
244
216
|
.strict()
|
|
245
217
|
.superRefine((receipt, context) => {
|
|
246
|
-
// Same fence as the live receipt: an observed generation belongs to
|
|
247
|
-
// the attempt that owns it.
|
|
248
218
|
fenceForeignGeneration(receipt, context);
|
|
249
219
|
})
|
|
250
220
|
.nullable(),
|
|
@@ -276,7 +246,6 @@ const ChildReference = z
|
|
|
276
246
|
.min(1)
|
|
277
247
|
.max(256)
|
|
278
248
|
.regex(/^[A-Za-z0-9._:/-]+$/);
|
|
279
|
-
/** Terminal child outcome as retained by the delegation record; identifiers and bounded codes only. */
|
|
280
249
|
export const PiDurableLeadChildOutcomeSchema = z
|
|
281
250
|
.object({
|
|
282
251
|
state: z.enum(['completed', 'failed', 'cancelled']),
|
|
@@ -290,11 +259,6 @@ export const PiDurableLeadChildOutcomeSchema = z
|
|
|
290
259
|
.strict(),
|
|
291
260
|
})
|
|
292
261
|
.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
262
|
export const PiDurableLeadChildSchema = z
|
|
299
263
|
.object({
|
|
300
264
|
delegationId: IdentifierSchemas.delegationId,
|
|
@@ -319,12 +283,6 @@ export const PiDurableLeadChildSchema = z
|
|
|
319
283
|
outcome: PiDurableLeadChildOutcomeSchema.optional(),
|
|
320
284
|
})
|
|
321
285
|
.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
286
|
export const PiDurableLeadChildrenResponseSchema = response.extend({
|
|
329
287
|
data: PiDurableLeadReceiptResponseSchema.extend({
|
|
330
288
|
children: z
|
|
@@ -348,7 +306,64 @@ export const PiDurableLeadChildrenResponseSchema = response.extend({
|
|
|
348
306
|
});
|
|
349
307
|
}),
|
|
350
308
|
});
|
|
351
|
-
|
|
309
|
+
export const PiDurableLeadChildTargetSchema = z.strictObject({
|
|
310
|
+
source: z.literal('control_plane_reported'),
|
|
311
|
+
runtimeConnectionId: IdentifierSchemas.runtimeConnectionId,
|
|
312
|
+
nativeSessionId: IdentifierSchemas.externalSessionId,
|
|
313
|
+
nativeTaskId: IdentifierSchemas.taskId,
|
|
314
|
+
nativeState: RuntimeExecutionStateSchema,
|
|
315
|
+
observedAt: z.iso.datetime(),
|
|
316
|
+
observedGeneration: RuntimeObservedGenerationSchema.optional(),
|
|
317
|
+
});
|
|
318
|
+
export const PiDurableLeadRemoteSessionReferenceSchema = z
|
|
319
|
+
.strictObject({
|
|
320
|
+
schemaVersion: z.literal('pi-child-remote-session-reference/v1'),
|
|
321
|
+
source: z.literal('control_plane_reported'),
|
|
322
|
+
basis: z.literal('retained_native_attribution'),
|
|
323
|
+
runtimeConnectionId: IdentifierSchemas.runtimeConnectionId,
|
|
324
|
+
nativeSessionId: IdentifierSchemas.externalSessionId,
|
|
325
|
+
permission: z.literal('none'),
|
|
326
|
+
history: z.literal('adapter_journal_only'),
|
|
327
|
+
attachment: z.literal('unavailable'),
|
|
328
|
+
})
|
|
329
|
+
.readonly();
|
|
330
|
+
export const PiDurableLeadChildTargetResponseSchema = response.extend({
|
|
331
|
+
data: PiDurableLeadReceiptResponseSchema.extend({
|
|
332
|
+
child: PiDurableLeadChildSchema,
|
|
333
|
+
target: PiDurableLeadChildTargetSchema.nullable(),
|
|
334
|
+
unavailableReason: z.enum(['NOT_STARTED', 'NOT_CONFIGURED', 'UNAVAILABLE']).optional(),
|
|
335
|
+
remoteSessionReference: PiDurableLeadRemoteSessionReferenceSchema.nullable().optional(),
|
|
336
|
+
remoteSessionReferenceUnavailableReason: z
|
|
337
|
+
.enum(['NOT_STARTED', 'NOT_CONFIGURED', 'UNAVAILABLE'])
|
|
338
|
+
.optional(),
|
|
339
|
+
}).superRefine((value, context) => {
|
|
340
|
+
const reference = value.remoteSessionReference;
|
|
341
|
+
if ((reference === null) !== (value.remoteSessionReferenceUnavailableReason !== undefined))
|
|
342
|
+
context.addIssue({
|
|
343
|
+
code: 'custom',
|
|
344
|
+
message: 'Unavailable remote reference requires a bounded reason',
|
|
345
|
+
});
|
|
346
|
+
if (reference &&
|
|
347
|
+
(value.child.childAttemptId === undefined ||
|
|
348
|
+
(value.target !== null &&
|
|
349
|
+
(reference.runtimeConnectionId !== value.target.runtimeConnectionId ||
|
|
350
|
+
reference.nativeSessionId !== value.target.nativeSessionId))))
|
|
351
|
+
context.addIssue({
|
|
352
|
+
code: 'custom',
|
|
353
|
+
message: 'Remote reference must bind the selected child target',
|
|
354
|
+
});
|
|
355
|
+
if ((value.target === null) !== (value.unavailableReason !== undefined))
|
|
356
|
+
context.addIssue({ code: 'custom', message: 'Unavailable target requires a bounded reason' });
|
|
357
|
+
if (value.target &&
|
|
358
|
+
(value.child.childAttemptId === undefined ||
|
|
359
|
+
(value.target.observedGeneration !== undefined &&
|
|
360
|
+
value.target.observedGeneration.attemptId !== value.child.childAttemptId)))
|
|
361
|
+
context.addIssue({
|
|
362
|
+
code: 'custom',
|
|
363
|
+
message: 'Native target must bind the selected child attempt',
|
|
364
|
+
});
|
|
365
|
+
}),
|
|
366
|
+
});
|
|
352
367
|
export const PiDurableLeadHttpContract = Object.freeze({
|
|
353
368
|
schemaVersion: 'pi-lead-dispatch/v1',
|
|
354
369
|
basePath: '/v3/pi-durable/lead-dispatches',
|
|
@@ -395,6 +410,13 @@ export const PiDurableLeadHttpContract = Object.freeze({
|
|
|
395
410
|
requestSchema: PiDurableLeadChildrenRequestSchema,
|
|
396
411
|
responseSchema: PiDurableLeadChildrenResponseSchema,
|
|
397
412
|
}),
|
|
413
|
+
childTarget: Object.freeze({
|
|
414
|
+
route: 'child-target',
|
|
415
|
+
operation: 'pi-durable.lead.child-target',
|
|
416
|
+
scope: 'execution:read',
|
|
417
|
+
requestSchema: PiDurableLeadChildTargetRequestSchema,
|
|
418
|
+
responseSchema: PiDurableLeadChildTargetResponseSchema,
|
|
419
|
+
}),
|
|
398
420
|
cancel: Object.freeze({
|
|
399
421
|
route: 'cancel',
|
|
400
422
|
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) {
|
package/dist/transport.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.19.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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test": "bun test src"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@adea-ai/contracts": "^1.
|
|
46
|
+
"@adea-ai/contracts": "^1.24.0",
|
|
47
47
|
"zod": "4.6.6"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|