@adea-ai/runtime-sdk 1.19.0 → 1.20.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.
@@ -65,6 +65,7 @@ export declare const PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION: {
65
65
  readonly minor: 2;
66
66
  };
67
67
  export declare function supportsPiDurableRemoteSessionReference(consumerVersion: unknown): boolean;
68
+ export declare function supportsPiDurableRemoteOwnerObservation(consumerVersion: unknown): boolean;
68
69
  export declare const PiDurableLeadPrepareRequestSchema: z.ZodObject<{
69
70
  contractVersion: z.ZodObject<{
70
71
  major: z.ZodNumber;
@@ -575,6 +576,18 @@ export declare const PiDurableLeadChildTargetResponseSchema: z.ZodObject<{
575
576
  NOT_STARTED: "NOT_STARTED";
576
577
  UNAVAILABLE: "UNAVAILABLE";
577
578
  }>>;
579
+ remoteOwnerObservation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
580
+ schemaVersion: z.ZodLiteral<"pi-child-owner-observation/v1">;
581
+ runtimeConnectionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"runtime-connection ID">, string>>;
582
+ nativeSessionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("@adea-ai/contracts").OpaqueIdentifier<"external-session ID">, string>>;
583
+ ownerInstanceId: z.ZodUUID;
584
+ permission: z.ZodLiteral<"none">;
585
+ }, z.core.$strict>>>;
586
+ remoteOwnerObservationUnavailableReason: z.ZodOptional<z.ZodEnum<{
587
+ NOT_CONFIGURED: "NOT_CONFIGURED";
588
+ NOT_STARTED: "NOT_STARTED";
589
+ UNAVAILABLE: "UNAVAILABLE";
590
+ }>>;
578
591
  }, z.core.$strict>;
579
592
  }, z.core.$strict>;
580
593
  export declare const PiDurableLeadHttpContract: Readonly<{
@@ -48,6 +48,13 @@ export function supportsPiDurableRemoteSessionReference(consumerVersion) {
48
48
  return (negotiated?.major === PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION.major &&
49
49
  negotiated.minor >= PI_DURABLE_REMOTE_SESSION_REFERENCE_CONTRACT_VERSION.minor);
50
50
  }
51
+ export function supportsPiDurableRemoteOwnerObservation(consumerVersion) {
52
+ const consumer = ContractVersionSchema.safeParse(consumerVersion);
53
+ if (!consumer.success)
54
+ return false;
55
+ const negotiated = negotiateContractVersion([PublicContractManifest.current], [consumer.data]);
56
+ return negotiated?.major === 3 && negotiated.minor >= 3;
57
+ }
51
58
  function fenceForeignGeneration(receipt, context) {
52
59
  const foreign = (generation) => generation !== undefined && generation.attemptId !== receipt.attemptId;
53
60
  if (foreign(receipt.observedTarget?.generation))
@@ -336,7 +343,40 @@ export const PiDurableLeadChildTargetResponseSchema = response.extend({
336
343
  remoteSessionReferenceUnavailableReason: z
337
344
  .enum(['NOT_STARTED', 'NOT_CONFIGURED', 'UNAVAILABLE'])
338
345
  .optional(),
346
+ remoteOwnerObservation: z
347
+ .strictObject({
348
+ schemaVersion: z.literal('pi-child-owner-observation/v1'),
349
+ runtimeConnectionId: IdentifierSchemas.runtimeConnectionId,
350
+ nativeSessionId: IdentifierSchemas.externalSessionId,
351
+ ownerInstanceId: z.uuid(),
352
+ permission: z.literal('none'),
353
+ })
354
+ .nullable()
355
+ .optional(),
356
+ remoteOwnerObservationUnavailableReason: z
357
+ .enum(['NOT_STARTED', 'NOT_CONFIGURED', 'UNAVAILABLE'])
358
+ .optional(),
339
359
  }).superRefine((value, context) => {
360
+ if ((value.remoteOwnerObservation === null) !==
361
+ (value.remoteOwnerObservationUnavailableReason !== undefined))
362
+ context.addIssue({
363
+ code: 'custom',
364
+ message: 'Unavailable owner observation requires a bounded reason',
365
+ });
366
+ if (value.remoteOwnerObservation &&
367
+ (!value.child.childAttemptId ||
368
+ (value.target !== null &&
369
+ (value.target.runtimeConnectionId !== value.remoteOwnerObservation.runtimeConnectionId ||
370
+ value.target.nativeSessionId !== value.remoteOwnerObservation.nativeSessionId)) ||
371
+ (value.remoteSessionReference &&
372
+ (value.remoteSessionReference.runtimeConnectionId !==
373
+ value.remoteOwnerObservation.runtimeConnectionId ||
374
+ value.remoteSessionReference.nativeSessionId !==
375
+ value.remoteOwnerObservation.nativeSessionId))))
376
+ context.addIssue({
377
+ code: 'custom',
378
+ message: 'Owner observation must bind the selected child reference',
379
+ });
340
380
  const reference = value.remoteSessionReference;
341
381
  if ((reference === null) !== (value.remoteSessionReferenceUnavailableReason !== undefined))
342
382
  context.addIssue({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/runtime-sdk",
3
- "version": "1.19.0",
3
+ "version": "1.20.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.24.0",
46
+ "@adea-ai/contracts": "^1.25.0",
47
47
  "zod": "4.6.6"
48
48
  },
49
49
  "engines": {