@adea-ai/contracts 3.0.0 → 3.0.1

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.
@@ -267,38 +267,6 @@ export type CredentialGetRequest = z.input<typeof CredentialGetRequestSchema>;
267
267
  export type CredentialListRequest = z.input<typeof CredentialListRequestSchema>;
268
268
  export type CredentialResponse = z.output<typeof CredentialResponseSchema>;
269
269
  export type CredentialListResponse = z.output<typeof CredentialListResponseSchema>;
270
- declare const RuntimeNodeCredentialIdSchema: z.ZodString;
271
- export declare const RuntimeNodeCredentialRevokeRequestSchema: z.ZodObject<{
272
- caller: typeof ServiceCallerAssertionSchema;
273
- contractVersion: typeof ContractVersionSchema;
274
- requestId: typeof IdentifierSchemas.requestId;
275
- workspaceId: typeof IdentifierSchemas.workspaceId;
276
- correlation: typeof CorrelationMetadataSchema;
277
- commandId: typeof IdentifierSchemas.commandId;
278
- idempotencyKey: typeof IdempotencyKeySchema;
279
- payloadHash: typeof PayloadHashSchema;
280
- operation: z.ZodLiteral<"runtime-node-credential.revoke">;
281
- issuedAt: typeof TimestampSchema;
282
- payload: z.ZodObject<{
283
- credentialId: z.ZodString;
284
- }, z.core.$strict>;
285
- }, z.core.$strict>;
286
- export declare const RuntimeNodeCredentialRevocationResponseSchema: z.ZodObject<{
287
- contractVersion: typeof ContractVersionSchema;
288
- requestId: typeof IdentifierSchemas.requestId;
289
- correlation: typeof CorrelationMetadataSchema;
290
- data: z.ZodObject<{
291
- credential: z.ZodObject<{
292
- credentialId: typeof RuntimeNodeCredentialIdSchema;
293
- nodeId: z.ZodString;
294
- workspaceId: typeof IdentifierSchemas.workspaceId;
295
- revocationVersion: z.ZodNumber;
296
- revokedAt: typeof TimestampSchema;
297
- }, z.core.$strict>;
298
- }, z.core.$strict>;
299
- }, z.core.$strip>;
300
- export type RuntimeNodeCredentialRevokeRequest = z.input<typeof RuntimeNodeCredentialRevokeRequestSchema>;
301
- export type RuntimeNodeCredentialRevocationResponse = z.output<typeof RuntimeNodeCredentialRevocationResponseSchema>;
302
270
  export declare const ProjectStateResolutionRequestSchema: z.ZodObject<{
303
271
  caller: typeof ServiceCallerAssertionSchema;
304
272
  contractVersion: typeof ContractVersionSchema;
@@ -1265,4 +1233,212 @@ export declare const CredentialApiFixtures: Readonly<{
1265
1233
  };
1266
1234
  };
1267
1235
  }>;
1236
+ export declare const DeviceSyncUploadRequestSchema: z.ZodObject<{
1237
+ caller: typeof ServiceCallerAssertionSchema;
1238
+ contractVersion: typeof ContractVersionSchema;
1239
+ requestId: typeof IdentifierSchemas.requestId;
1240
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1241
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1242
+ correlation: typeof CorrelationMetadataSchema;
1243
+ commandId: typeof IdentifierSchemas.commandId;
1244
+ idempotencyKey: typeof IdempotencyKeySchema;
1245
+ payloadHash: typeof PayloadHashSchema;
1246
+ operation: z.ZodLiteral<"device-sync.upload">;
1247
+ issuedAt: typeof TimestampSchema;
1248
+ payload: z.ZodObject<{
1249
+ objectId: z.ZodString;
1250
+ size: z.ZodNumber;
1251
+ ciphertextSha256: z.ZodString;
1252
+ authorKeyId: z.ZodString;
1253
+ }, z.core.$strict>;
1254
+ }, z.core.$strip>;
1255
+ export declare const DeviceSyncUploadResponseSchema: z.ZodObject<{
1256
+ contractVersion: typeof ContractVersionSchema;
1257
+ requestId: typeof IdentifierSchemas.requestId;
1258
+ correlation: typeof CorrelationMetadataSchema;
1259
+ data: z.ZodObject<{
1260
+ objectId: z.ZodString;
1261
+ url: z.ZodURL;
1262
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
1263
+ expiresAt: z.ZodISODateTime;
1264
+ }, z.core.$strict>;
1265
+ }, z.core.$strip>;
1266
+ export declare const DeviceSyncCommitRequestSchema: z.ZodObject<{
1267
+ caller: typeof ServiceCallerAssertionSchema;
1268
+ contractVersion: typeof ContractVersionSchema;
1269
+ requestId: typeof IdentifierSchemas.requestId;
1270
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1271
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1272
+ correlation: typeof CorrelationMetadataSchema;
1273
+ commandId: typeof IdentifierSchemas.commandId;
1274
+ idempotencyKey: typeof IdempotencyKeySchema;
1275
+ payloadHash: typeof PayloadHashSchema;
1276
+ operation: z.ZodLiteral<"device-sync.commit">;
1277
+ issuedAt: typeof TimestampSchema;
1278
+ payload: z.ZodObject<{
1279
+ objectId: z.ZodString;
1280
+ }, z.core.$strict>;
1281
+ }, z.core.$strip>;
1282
+ export declare const DeviceSyncCommitResponseSchema: z.ZodObject<{
1283
+ contractVersion: typeof ContractVersionSchema;
1284
+ requestId: typeof IdentifierSchemas.requestId;
1285
+ correlation: typeof CorrelationMetadataSchema;
1286
+ data: z.ZodObject<{
1287
+ objectId: z.ZodString;
1288
+ size: z.ZodNumber;
1289
+ }, z.core.$strict>;
1290
+ }, z.core.$strip>;
1291
+ export declare const DeviceSyncDownloadRequestSchema: z.ZodObject<{
1292
+ caller: typeof ServiceCallerAssertionSchema;
1293
+ contractVersion: typeof ContractVersionSchema;
1294
+ requestId: typeof IdentifierSchemas.requestId;
1295
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1296
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1297
+ correlation: typeof CorrelationMetadataSchema;
1298
+ operation: z.ZodLiteral<"device-sync.download">;
1299
+ requestedAt: typeof TimestampSchema;
1300
+ parameters: z.ZodObject<{
1301
+ objectIds: z.ZodArray<z.ZodString>;
1302
+ }, z.core.$strict>;
1303
+ }, z.core.$strip>;
1304
+ export declare const DeviceSyncDownloadResponseSchema: z.ZodObject<{
1305
+ contractVersion: typeof ContractVersionSchema;
1306
+ requestId: typeof IdentifierSchemas.requestId;
1307
+ correlation: typeof CorrelationMetadataSchema;
1308
+ data: z.ZodObject<{
1309
+ downloads: z.ZodArray<z.ZodObject<{
1310
+ objectId: z.ZodString;
1311
+ url: z.ZodURL;
1312
+ size: z.ZodNumber;
1313
+ }, z.core.$strict>>;
1314
+ missing: z.ZodArray<z.ZodString>;
1315
+ expiresAt: z.ZodISODateTime;
1316
+ }, z.core.$strict>;
1317
+ }, z.core.$strip>;
1318
+ export declare const DeviceSyncReleaseRequestSchema: z.ZodObject<{
1319
+ caller: typeof ServiceCallerAssertionSchema;
1320
+ contractVersion: typeof ContractVersionSchema;
1321
+ requestId: typeof IdentifierSchemas.requestId;
1322
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1323
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1324
+ correlation: typeof CorrelationMetadataSchema;
1325
+ commandId: typeof IdentifierSchemas.commandId;
1326
+ idempotencyKey: typeof IdempotencyKeySchema;
1327
+ payloadHash: typeof PayloadHashSchema;
1328
+ operation: z.ZodLiteral<"device-sync.release">;
1329
+ issuedAt: typeof TimestampSchema;
1330
+ payload: z.ZodObject<{
1331
+ objectIds: z.ZodArray<z.ZodString>;
1332
+ }, z.core.$strict>;
1333
+ }, z.core.$strip>;
1334
+ export declare const DeviceSyncReleaseResponseSchema: z.ZodObject<{
1335
+ contractVersion: typeof ContractVersionSchema;
1336
+ requestId: typeof IdentifierSchemas.requestId;
1337
+ correlation: typeof CorrelationMetadataSchema;
1338
+ data: z.ZodObject<{
1339
+ released: z.ZodNumber;
1340
+ }, z.core.$strict>;
1341
+ }, z.core.$strip>;
1342
+ export declare const DeviceSyncAppendRequestSchema: z.ZodObject<{
1343
+ caller: typeof ServiceCallerAssertionSchema;
1344
+ contractVersion: typeof ContractVersionSchema;
1345
+ requestId: typeof IdentifierSchemas.requestId;
1346
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1347
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1348
+ correlation: typeof CorrelationMetadataSchema;
1349
+ commandId: typeof IdentifierSchemas.commandId;
1350
+ idempotencyKey: typeof IdempotencyKeySchema;
1351
+ payloadHash: typeof PayloadHashSchema;
1352
+ operation: z.ZodLiteral<"device-sync.append">;
1353
+ issuedAt: typeof TimestampSchema;
1354
+ payload: z.ZodObject<{
1355
+ entries: z.ZodArray<z.ZodObject<{
1356
+ entryId: z.ZodString;
1357
+ authorKeyId: z.ZodString;
1358
+ objectIds: z.ZodArray<z.ZodString>;
1359
+ ckv: z.ZodNumber;
1360
+ nonce: z.ZodString;
1361
+ ciphertext: z.ZodString;
1362
+ signature: z.ZodString;
1363
+ }, z.core.$strict>>;
1364
+ }, z.core.$strict>;
1365
+ }, z.core.$strip>;
1366
+ export declare const DeviceSyncAppendResponseSchema: z.ZodObject<{
1367
+ contractVersion: typeof ContractVersionSchema;
1368
+ requestId: typeof IdentifierSchemas.requestId;
1369
+ correlation: typeof CorrelationMetadataSchema;
1370
+ data: z.ZodObject<{
1371
+ entries: z.ZodArray<z.ZodObject<{
1372
+ entryId: z.ZodString;
1373
+ seq: z.ZodNumber;
1374
+ }, z.core.$strict>>;
1375
+ }, z.core.$strict>;
1376
+ }, z.core.$strip>;
1377
+ export declare const DeviceSyncLogRequestSchema: z.ZodObject<{
1378
+ caller: typeof ServiceCallerAssertionSchema;
1379
+ contractVersion: typeof ContractVersionSchema;
1380
+ requestId: typeof IdentifierSchemas.requestId;
1381
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1382
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1383
+ correlation: typeof CorrelationMetadataSchema;
1384
+ operation: z.ZodLiteral<"device-sync.log">;
1385
+ requestedAt: typeof TimestampSchema;
1386
+ parameters: z.ZodObject<{
1387
+ afterSeq: z.ZodNumber;
1388
+ limit: z.ZodOptional<z.ZodNumber>;
1389
+ }, z.core.$strict>;
1390
+ }, z.core.$strip>;
1391
+ export declare const DeviceSyncLogResponseSchema: z.ZodObject<{
1392
+ contractVersion: typeof ContractVersionSchema;
1393
+ requestId: typeof IdentifierSchemas.requestId;
1394
+ correlation: typeof CorrelationMetadataSchema;
1395
+ data: z.ZodObject<{
1396
+ entries: z.ZodArray<z.ZodObject<{
1397
+ entryId: z.ZodString;
1398
+ authorKeyId: z.ZodString;
1399
+ objectIds: z.ZodArray<z.ZodString>;
1400
+ ckv: z.ZodNumber;
1401
+ nonce: z.ZodString;
1402
+ ciphertext: z.ZodString;
1403
+ signature: z.ZodString;
1404
+ seq: z.ZodNumber;
1405
+ createdAt: z.ZodISODateTime;
1406
+ }, z.core.$strict>>;
1407
+ headSeq: z.ZodNumber;
1408
+ }, z.core.$strict>;
1409
+ }, z.core.$strip>;
1410
+ export declare const DeviceSyncUsageRequestSchema: z.ZodObject<{
1411
+ caller: typeof ServiceCallerAssertionSchema;
1412
+ contractVersion: typeof ContractVersionSchema;
1413
+ requestId: typeof IdentifierSchemas.requestId;
1414
+ workspaceId: typeof IdentifierSchemas.workspaceId;
1415
+ projectId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"project ID">, string>>>;
1416
+ correlation: typeof CorrelationMetadataSchema;
1417
+ operation: z.ZodLiteral<"device-sync.usage">;
1418
+ requestedAt: typeof TimestampSchema;
1419
+ parameters: z.ZodObject<{}, z.core.$strict>;
1420
+ }, z.core.$strip>;
1421
+ export declare const DeviceSyncUsageResponseSchema: z.ZodObject<{
1422
+ contractVersion: typeof ContractVersionSchema;
1423
+ requestId: typeof IdentifierSchemas.requestId;
1424
+ correlation: typeof CorrelationMetadataSchema;
1425
+ data: z.ZodObject<{
1426
+ usedBytes: z.ZodNumber;
1427
+ quotaBytes: z.ZodNumber;
1428
+ }, z.core.$strict>;
1429
+ }, z.core.$strip>;
1430
+ export type DeviceSyncUploadRequest = z.input<typeof DeviceSyncUploadRequestSchema>;
1431
+ export type DeviceSyncUploadResponse = z.output<typeof DeviceSyncUploadResponseSchema>;
1432
+ export type DeviceSyncCommitRequest = z.input<typeof DeviceSyncCommitRequestSchema>;
1433
+ export type DeviceSyncCommitResponse = z.output<typeof DeviceSyncCommitResponseSchema>;
1434
+ export type DeviceSyncDownloadRequest = z.input<typeof DeviceSyncDownloadRequestSchema>;
1435
+ export type DeviceSyncDownloadResponse = z.output<typeof DeviceSyncDownloadResponseSchema>;
1436
+ export type DeviceSyncReleaseRequest = z.input<typeof DeviceSyncReleaseRequestSchema>;
1437
+ export type DeviceSyncReleaseResponse = z.output<typeof DeviceSyncReleaseResponseSchema>;
1438
+ export type DeviceSyncAppendRequest = z.input<typeof DeviceSyncAppendRequestSchema>;
1439
+ export type DeviceSyncAppendResponse = z.output<typeof DeviceSyncAppendResponseSchema>;
1440
+ export type DeviceSyncLogRequest = z.input<typeof DeviceSyncLogRequestSchema>;
1441
+ export type DeviceSyncLogResponse = z.output<typeof DeviceSyncLogResponseSchema>;
1442
+ export type DeviceSyncUsageRequest = z.input<typeof DeviceSyncUsageRequestSchema>;
1443
+ export type DeviceSyncUsageResponse = z.output<typeof DeviceSyncUsageResponseSchema>;
1268
1444
  export {};
@@ -5,6 +5,7 @@ import { ModelIdSchema } from './decision-resolution.js';
5
5
  import { CorrelationMetadataSchema } from './envelopes.js';
6
6
  import { IdentifierSchemas } from './identifiers.js';
7
7
  import { CursorSchema } from './pagination.js';
8
+ import { SyncAppendRequestSchema, SyncAppendResponseSchema, SyncAuthorKeyIdSchema, SyncCommitResponseSchema, SyncDownloadRequestSchema, SyncDownloadResponseSchema, SyncLogPageSchema, SyncLogRequestSchema, SyncObjectRequestSchema, SyncReleaseResponseSchema, SyncUploadRequestSchema, SyncUploadResponseSchema, SyncUsageSchema, } from './device-sync.js';
8
9
  import { ContractVersionSchema } from './versioning.js';
9
10
  const TimestampSchema = z.iso.datetime();
10
11
  const DigestSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
@@ -209,32 +210,6 @@ export const CredentialListResponseSchema = successResponse(z
209
210
  nextCursor: CursorSchema.optional(),
210
211
  })
211
212
  .strict());
212
- // Hosted RuntimeNode credential revocation. Shares the connector credential scope
213
- // (`credential:write`) and envelope workspace binding; the credential ID is the
214
- // RuntimeNode `rgc_` identifier, which is distinct from connector credential IDs.
215
- const RuntimeNodeCredentialIdSchema = z
216
- .string()
217
- .min(8)
218
- .max(128)
219
- .regex(/^rgc_[A-Za-z0-9_-]+$/);
220
- export const RuntimeNodeCredentialRevokeRequestSchema = CredentialCommandContextSchema.extend({
221
- operation: z.literal('runtime-node-credential.revoke'),
222
- issuedAt: TimestampSchema,
223
- payload: z.object({ credentialId: RuntimeNodeCredentialIdSchema }).strict(),
224
- }).strict();
225
- export const RuntimeNodeCredentialRevocationResponseSchema = successResponse(z
226
- .object({
227
- credential: z
228
- .object({
229
- credentialId: RuntimeNodeCredentialIdSchema,
230
- nodeId: z.string().regex(/^rnr_[0-9A-HJKMNP-TV-Z]{26}$/),
231
- workspaceId: IdentifierSchemas.workspaceId,
232
- revocationVersion: z.number().int().positive(),
233
- revokedAt: TimestampSchema,
234
- })
235
- .strict(),
236
- })
237
- .strict());
238
213
  export const ProjectStateResolutionRequestSchema = RequestContextSchema.extend({
239
214
  operation: z.literal('project-state.resolve'),
240
215
  requestedAt: TimestampSchema,
@@ -1039,3 +1014,29 @@ export const CredentialApiFixtures = Object.freeze({
1039
1014
  response: { ...responseContext, data: { credentials: [credentialFixtureMetadata] } },
1040
1015
  },
1041
1016
  });
1017
+ // ---------------------------------------------------------------------------------------------
1018
+ // Encrypted device sync envelopes (adea-ai/control-plane#1566); the bodies live in device-sync.ts.
1019
+ const deviceSyncCommand = (operation, payload) => CommandContextSchema.extend({
1020
+ operation: z.literal(operation),
1021
+ issuedAt: TimestampSchema,
1022
+ payload,
1023
+ });
1024
+ const deviceSyncRead = (operation, parameters) => RequestContextSchema.extend({
1025
+ operation: z.literal(operation),
1026
+ requestedAt: TimestampSchema,
1027
+ parameters,
1028
+ });
1029
+ export const DeviceSyncUploadRequestSchema = deviceSyncCommand('device-sync.upload', SyncUploadRequestSchema.extend({ authorKeyId: SyncAuthorKeyIdSchema }).strict());
1030
+ export const DeviceSyncUploadResponseSchema = successResponse(SyncUploadResponseSchema);
1031
+ export const DeviceSyncCommitRequestSchema = deviceSyncCommand('device-sync.commit', SyncObjectRequestSchema);
1032
+ export const DeviceSyncCommitResponseSchema = successResponse(SyncCommitResponseSchema);
1033
+ export const DeviceSyncDownloadRequestSchema = deviceSyncRead('device-sync.download', SyncDownloadRequestSchema);
1034
+ export const DeviceSyncDownloadResponseSchema = successResponse(SyncDownloadResponseSchema);
1035
+ export const DeviceSyncReleaseRequestSchema = deviceSyncCommand('device-sync.release', SyncDownloadRequestSchema);
1036
+ export const DeviceSyncReleaseResponseSchema = successResponse(SyncReleaseResponseSchema);
1037
+ export const DeviceSyncAppendRequestSchema = deviceSyncCommand('device-sync.append', SyncAppendRequestSchema);
1038
+ export const DeviceSyncAppendResponseSchema = successResponse(SyncAppendResponseSchema);
1039
+ export const DeviceSyncLogRequestSchema = deviceSyncRead('device-sync.log', SyncLogRequestSchema);
1040
+ export const DeviceSyncLogResponseSchema = successResponse(SyncLogPageSchema);
1041
+ export const DeviceSyncUsageRequestSchema = deviceSyncRead('device-sync.usage', z.object({}).strict());
1042
+ export const DeviceSyncUsageResponseSchema = successResponse(SyncUsageSchema);
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import type { RuntimeConnectionDiscoveryReadModel } from './runtime-discovery.js';
3
2
  /**
4
3
  * Decision-layer contract (control-plane#558).
5
4
  *
@@ -115,13 +114,11 @@ export declare const AvailableRuntimeSchema: z.ZodObject<{
115
114
  }>;
116
115
  transport: z.ZodEnum<{
117
116
  "direct-local": "direct-local";
118
- "remote-gateway": "remote-gateway";
119
117
  }>;
120
118
  harnessIds: z.ZodArray<z.ZodString>;
121
119
  capabilities: z.ZodArray<z.ZodString>;
122
120
  }, z.core.$strict>;
123
121
  export type AvailableRuntime = z.output<typeof AvailableRuntimeSchema>;
124
- export declare function availableRuntimesFromDiscovery(models: readonly RuntimeConnectionDiscoveryReadModel[]): AvailableRuntime[];
125
122
  export declare const DecisionResolutionRequestSchema: z.ZodObject<{
126
123
  contractVersion: z.ZodObject<{
127
124
  major: z.ZodNumber;
@@ -153,7 +150,6 @@ export declare const DecisionResolutionRequestSchema: z.ZodObject<{
153
150
  }>;
154
151
  transport: z.ZodEnum<{
155
152
  "direct-local": "direct-local";
156
- "remote-gateway": "remote-gateway";
157
153
  }>;
158
154
  harnessIds: z.ZodArray<z.ZodString>;
159
155
  capabilities: z.ZodArray<z.ZodString>;
@@ -373,7 +369,6 @@ export declare const DecisionLayerResolutionSchema: z.ZodObject<{
373
369
  }>;
374
370
  transport: z.ZodEnum<{
375
371
  "direct-local": "direct-local";
376
- "remote-gateway": "remote-gateway";
377
372
  }>;
378
373
  harnessIds: z.ZodArray<z.ZodString>;
379
374
  capabilities: z.ZodArray<z.ZodString>;
@@ -99,39 +99,11 @@ export const AvailableRuntimeSchema = z
99
99
  .object({
100
100
  runtimeDefinitionId: IdentifierSchemas.runtimeDefinitionId,
101
101
  kind: z.enum(['local', 'self-hosted', 'cloud']),
102
- transport: z.enum(['direct-local', 'remote-gateway']),
102
+ transport: z.enum(['direct-local']),
103
103
  harnessIds: z.array(HarnessIdSchema).max(16),
104
104
  capabilities: z.array(CapabilityNameSchema).max(64),
105
105
  })
106
106
  .strict();
107
- /**
108
- * Maps runtime-discovery read models onto the decision layer's runtime view
109
- * (#74 / M12 wiring). The discovery `family` is the harness family id — the
110
- * same kebab-case shape HarnessIdSchema requires — so a runtime advertising
111
- * family `pi` exposes harness id `pi`. Unavailable and revoked connections are
112
- * not offered to resolution; degraded ones remain selectable because policy
113
- * decides whether a degraded runtime is acceptable.
114
- */
115
- function runtimeKind(model) {
116
- // The discovery model's location is local_device | agent_hq_cloud; the
117
- // managed/external connection types resolve the remaining distinction.
118
- if (model.connectionType === 'managed_cloud')
119
- return 'cloud';
120
- if (model.connectionType === 'managed_local')
121
- return 'local';
122
- return model.location === 'local_device' ? 'local' : 'self-hosted';
123
- }
124
- export function availableRuntimesFromDiscovery(models) {
125
- return models
126
- .filter((model) => model.status === 'available' || model.status === 'degraded')
127
- .map((model) => AvailableRuntimeSchema.parse({
128
- runtimeDefinitionId: model.runtimeDefinitionId,
129
- kind: runtimeKind(model),
130
- transport: 'remote-gateway',
131
- harnessIds: [model.family],
132
- capabilities: [...model.capabilities],
133
- }));
134
- }
135
107
  export const DecisionResolutionRequestSchema = z
136
108
  .object({
137
109
  contractVersion: ContractVersionSchema,
@@ -0,0 +1,128 @@
1
+ import { z } from 'zod';
2
+ export declare const DeviceSyncErrorCodeSchema: z.ZodEnum<{
3
+ SYNC_AUTHOR_REVOKED: "SYNC_AUTHOR_REVOKED";
4
+ SYNC_AUTHOR_UNKNOWN: "SYNC_AUTHOR_UNKNOWN";
5
+ SYNC_BLOB_INVALID: "SYNC_BLOB_INVALID";
6
+ SYNC_BLOB_TOO_LARGE: "SYNC_BLOB_TOO_LARGE";
7
+ SYNC_DECRYPTION_FAILED: "SYNC_DECRYPTION_FAILED";
8
+ SYNC_ENTRY_CONFLICT: "SYNC_ENTRY_CONFLICT";
9
+ SYNC_ENTRY_INVALID: "SYNC_ENTRY_INVALID";
10
+ SYNC_ENTRY_TOO_LARGE: "SYNC_ENTRY_TOO_LARGE";
11
+ SYNC_KEY_UNAVAILABLE: "SYNC_KEY_UNAVAILABLE";
12
+ SYNC_LOG_ROLLED_BACK: "SYNC_LOG_ROLLED_BACK";
13
+ SYNC_OBJECT_CONFLICT: "SYNC_OBJECT_CONFLICT";
14
+ SYNC_OBJECT_NOT_COMMITTED: "SYNC_OBJECT_NOT_COMMITTED";
15
+ SYNC_QUOTA_EXCEEDED: "SYNC_QUOTA_EXCEEDED";
16
+ SYNC_REQUEST_EXPIRED: "SYNC_REQUEST_EXPIRED";
17
+ SYNC_REQUEST_INVALID: "SYNC_REQUEST_INVALID";
18
+ SYNC_SIGNATURE_INVALID: "SYNC_SIGNATURE_INVALID";
19
+ SYNC_UNAVAILABLE: "SYNC_UNAVAILABLE";
20
+ }>;
21
+ export type DeviceSyncErrorCode = z.infer<typeof DeviceSyncErrorCodeSchema>;
22
+ /** The largest sealed log entry plaintext. */
23
+ export declare const MAX_SYNC_ENTRY_BYTES: number;
24
+ /** Entries per append and object ids per download or release. */
25
+ export declare const MAX_SYNC_BATCH = 100;
26
+ export declare const MAX_SYNC_LOG_PAGE = 500;
27
+ /** The smallest sealed object: a 12-byte header, the 8-byte length prefix and one 16-byte tag. */
28
+ export declare const MIN_SYNC_CIPHERTEXT_BYTES = 36;
29
+ /** The sealed size of the largest (256 MiB) object; device-sync tests pin it to the blob format. */
30
+ export declare const MAX_SYNC_CIPHERTEXT_BYTES = 276828300;
31
+ export declare const SyncAuthorKeyIdSchema: z.ZodString;
32
+ export declare const SyncObjectIdSchema: z.ZodString;
33
+ export declare const SyncEntryIdSchema: z.ZodString;
34
+ /** What the server stores and serves for one entry, signed by its author over these fields. */
35
+ export declare const SignedSyncEntrySchema: z.ZodObject<{
36
+ entryId: z.ZodString;
37
+ authorKeyId: z.ZodString;
38
+ objectIds: z.ZodArray<z.ZodString>;
39
+ ckv: z.ZodNumber;
40
+ nonce: z.ZodString;
41
+ ciphertext: z.ZodString;
42
+ signature: z.ZodString;
43
+ }, z.core.$strict>;
44
+ export type SignedSyncEntry = z.infer<typeof SignedSyncEntrySchema>;
45
+ export declare const StoredSyncEntrySchema: z.ZodObject<{
46
+ entryId: z.ZodString;
47
+ authorKeyId: z.ZodString;
48
+ objectIds: z.ZodArray<z.ZodString>;
49
+ ckv: z.ZodNumber;
50
+ nonce: z.ZodString;
51
+ ciphertext: z.ZodString;
52
+ signature: z.ZodString;
53
+ seq: z.ZodNumber;
54
+ createdAt: z.ZodISODateTime;
55
+ }, z.core.$strict>;
56
+ export type StoredSyncEntry = z.infer<typeof StoredSyncEntrySchema>;
57
+ export declare const SyncUploadRequestSchema: z.ZodObject<{
58
+ objectId: z.ZodString;
59
+ size: z.ZodNumber;
60
+ ciphertextSha256: z.ZodString;
61
+ }, z.core.$strict>;
62
+ export declare const SyncUploadResponseSchema: z.ZodObject<{
63
+ objectId: z.ZodString;
64
+ url: z.ZodURL;
65
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
66
+ expiresAt: z.ZodISODateTime;
67
+ }, z.core.$strict>;
68
+ export declare const SyncObjectRequestSchema: z.ZodObject<{
69
+ objectId: z.ZodString;
70
+ }, z.core.$strict>;
71
+ export declare const SyncCommitResponseSchema: z.ZodObject<{
72
+ objectId: z.ZodString;
73
+ size: z.ZodNumber;
74
+ }, z.core.$strict>;
75
+ export declare const SyncDownloadRequestSchema: z.ZodObject<{
76
+ objectIds: z.ZodArray<z.ZodString>;
77
+ }, z.core.$strict>;
78
+ export declare const SyncDownloadResponseSchema: z.ZodObject<{
79
+ downloads: z.ZodArray<z.ZodObject<{
80
+ objectId: z.ZodString;
81
+ url: z.ZodURL;
82
+ size: z.ZodNumber;
83
+ }, z.core.$strict>>;
84
+ missing: z.ZodArray<z.ZodString>;
85
+ expiresAt: z.ZodISODateTime;
86
+ }, z.core.$strict>;
87
+ export declare const SyncReleaseResponseSchema: z.ZodObject<{
88
+ released: z.ZodNumber;
89
+ }, z.core.$strict>;
90
+ export declare const SyncAppendRequestSchema: z.ZodObject<{
91
+ entries: z.ZodArray<z.ZodObject<{
92
+ entryId: z.ZodString;
93
+ authorKeyId: z.ZodString;
94
+ objectIds: z.ZodArray<z.ZodString>;
95
+ ckv: z.ZodNumber;
96
+ nonce: z.ZodString;
97
+ ciphertext: z.ZodString;
98
+ signature: z.ZodString;
99
+ }, z.core.$strict>>;
100
+ }, z.core.$strict>;
101
+ export declare const SyncAppendResponseSchema: z.ZodObject<{
102
+ entries: z.ZodArray<z.ZodObject<{
103
+ entryId: z.ZodString;
104
+ seq: z.ZodNumber;
105
+ }, z.core.$strict>>;
106
+ }, z.core.$strict>;
107
+ export declare const SyncLogRequestSchema: z.ZodObject<{
108
+ afterSeq: z.ZodNumber;
109
+ limit: z.ZodOptional<z.ZodNumber>;
110
+ }, z.core.$strict>;
111
+ export declare const SyncLogPageSchema: z.ZodObject<{
112
+ entries: z.ZodArray<z.ZodObject<{
113
+ entryId: z.ZodString;
114
+ authorKeyId: z.ZodString;
115
+ objectIds: z.ZodArray<z.ZodString>;
116
+ ckv: z.ZodNumber;
117
+ nonce: z.ZodString;
118
+ ciphertext: z.ZodString;
119
+ signature: z.ZodString;
120
+ seq: z.ZodNumber;
121
+ createdAt: z.ZodISODateTime;
122
+ }, z.core.$strict>>;
123
+ headSeq: z.ZodNumber;
124
+ }, z.core.$strict>;
125
+ export declare const SyncUsageSchema: z.ZodObject<{
126
+ usedBytes: z.ZodNumber;
127
+ quotaBytes: z.ZodNumber;
128
+ }, z.core.$strict>;
@@ -0,0 +1,115 @@
1
+ // Encrypted device sync (adea-ai/control-plane#1566): the wire bodies only. Every field is an
2
+ // opaque id, a padded size, an author key id or ciphertext. The crypto lives in
3
+ // @adea-ai/runtime-gateway-protocol/device-sync, which re-exports these schemas; this
4
+ // module has no other import so browser bundles stay small.
5
+ import { z } from 'zod';
6
+ const TimestampSchema = z.iso.datetime();
7
+ export const DeviceSyncErrorCodeSchema = z.enum([
8
+ 'SYNC_BLOB_INVALID',
9
+ 'SYNC_BLOB_TOO_LARGE',
10
+ 'SYNC_DECRYPTION_FAILED',
11
+ 'SYNC_KEY_UNAVAILABLE',
12
+ 'SYNC_ENTRY_INVALID',
13
+ 'SYNC_ENTRY_TOO_LARGE',
14
+ 'SYNC_SIGNATURE_INVALID',
15
+ 'SYNC_AUTHOR_UNKNOWN',
16
+ 'SYNC_AUTHOR_REVOKED',
17
+ 'SYNC_REQUEST_INVALID',
18
+ 'SYNC_REQUEST_EXPIRED',
19
+ 'SYNC_LOG_ROLLED_BACK',
20
+ 'SYNC_QUOTA_EXCEEDED',
21
+ 'SYNC_OBJECT_NOT_COMMITTED',
22
+ 'SYNC_OBJECT_CONFLICT',
23
+ 'SYNC_ENTRY_CONFLICT',
24
+ 'SYNC_UNAVAILABLE',
25
+ ]);
26
+ /** The largest sealed log entry plaintext. */
27
+ export const MAX_SYNC_ENTRY_BYTES = 16 * 1024;
28
+ /** Entries per append and object ids per download or release. */
29
+ export const MAX_SYNC_BATCH = 100;
30
+ export const MAX_SYNC_LOG_PAGE = 500;
31
+ /** The smallest sealed object: a 12-byte header, the 8-byte length prefix and one 16-byte tag. */
32
+ export const MIN_SYNC_CIPHERTEXT_BYTES = 36;
33
+ /** The sealed size of the largest (256 MiB) object; device-sync tests pin it to the blob format. */
34
+ export const MAX_SYNC_CIPHERTEXT_BYTES = 276_828_300;
35
+ const SyncBase64UrlSchema = z
36
+ .string()
37
+ .min(1)
38
+ .regex(/^[A-Za-z0-9_-]+$/);
39
+ export const SyncAuthorKeyIdSchema = z.string().regex(/^(?:spk|dpk)_[a-f0-9]{32}$/);
40
+ export const SyncObjectIdSchema = z.string().regex(/^sob_[a-f0-9]{32}$/);
41
+ export const SyncEntryIdSchema = z.string().regex(/^sen_[a-f0-9]{32}$/);
42
+ const SyncSha256Schema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
43
+ /** What the server stores and serves for one entry, signed by its author over these fields. */
44
+ export const SignedSyncEntrySchema = z
45
+ .object({
46
+ entryId: SyncEntryIdSchema,
47
+ authorKeyId: SyncAuthorKeyIdSchema,
48
+ objectIds: z.array(SyncObjectIdSchema).max(1),
49
+ ckv: z.number().int().min(1),
50
+ nonce: SyncBase64UrlSchema.length(16),
51
+ ciphertext: SyncBase64UrlSchema.max(Math.ceil(((MAX_SYNC_ENTRY_BYTES + 16) * 4) / 3)),
52
+ signature: SyncBase64UrlSchema.length(86),
53
+ })
54
+ .strict();
55
+ export const StoredSyncEntrySchema = SignedSyncEntrySchema.extend({
56
+ seq: z.number().int().min(1),
57
+ createdAt: TimestampSchema,
58
+ }).strict();
59
+ export const SyncUploadRequestSchema = z
60
+ .object({
61
+ objectId: SyncObjectIdSchema,
62
+ size: z.number().int().min(MIN_SYNC_CIPHERTEXT_BYTES).max(MAX_SYNC_CIPHERTEXT_BYTES),
63
+ ciphertextSha256: SyncSha256Schema,
64
+ })
65
+ .strict();
66
+ const PresignedSyncUrlSchema = z.url().max(4096);
67
+ export const SyncUploadResponseSchema = z
68
+ .object({
69
+ objectId: SyncObjectIdSchema,
70
+ url: PresignedSyncUrlSchema,
71
+ headers: z.record(z.string(), z.string()),
72
+ expiresAt: TimestampSchema,
73
+ })
74
+ .strict();
75
+ export const SyncObjectRequestSchema = z.object({ objectId: SyncObjectIdSchema }).strict();
76
+ export const SyncCommitResponseSchema = z
77
+ .object({ objectId: SyncObjectIdSchema, size: z.number().int().min(1) })
78
+ .strict();
79
+ export const SyncDownloadRequestSchema = z
80
+ .object({ objectIds: z.array(SyncObjectIdSchema).min(1).max(MAX_SYNC_BATCH) })
81
+ .strict();
82
+ export const SyncDownloadResponseSchema = z
83
+ .object({
84
+ downloads: z.array(z
85
+ .object({
86
+ objectId: SyncObjectIdSchema,
87
+ url: PresignedSyncUrlSchema,
88
+ size: z.number().int().min(1),
89
+ })
90
+ .strict()),
91
+ missing: z.array(SyncObjectIdSchema),
92
+ expiresAt: TimestampSchema,
93
+ })
94
+ .strict();
95
+ export const SyncReleaseResponseSchema = z.object({ released: z.number().int().min(0) }).strict();
96
+ export const SyncAppendRequestSchema = z
97
+ .object({ entries: z.array(SignedSyncEntrySchema).min(1).max(MAX_SYNC_BATCH) })
98
+ .strict();
99
+ export const SyncAppendResponseSchema = z
100
+ .object({
101
+ entries: z.array(z.object({ entryId: SyncEntryIdSchema, seq: z.number().int().min(1) }).strict()),
102
+ })
103
+ .strict();
104
+ export const SyncLogRequestSchema = z
105
+ .object({
106
+ afterSeq: z.number().int().min(0),
107
+ limit: z.number().int().min(1).max(MAX_SYNC_LOG_PAGE).optional(),
108
+ })
109
+ .strict();
110
+ export const SyncLogPageSchema = z
111
+ .object({ entries: z.array(StoredSyncEntrySchema), headSeq: z.number().int().min(0) })
112
+ .strict();
113
+ export const SyncUsageSchema = z
114
+ .object({ usedBytes: z.number().int().min(0), quotaBytes: z.number().int().min(0) })
115
+ .strict();
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './canonical-json.js';
5
5
  export * from './control-api.js';
6
6
  export * from './context-providers.js';
7
7
  export * from './decision-resolution.js';
8
+ export * from './device-sync.js';
8
9
  export * from './envelopes.js';
9
10
  export * from './execution-scope.js';
10
11
  export * from './fixtures.js';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from './canonical-json.js';
9
9
  export * from './control-api.js';
10
10
  export * from './context-providers.js';
11
11
  export * from './decision-resolution.js';
12
+ export * from './device-sync.js';
12
13
  export * from './envelopes.js';
13
14
  export * from './execution-scope.js';
14
15
  export * from './fixtures.js';
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { CursorSchema } from './pagination.js';
2
3
  export declare const ModelFundingSourceSchema: z.ZodEnum<{
3
4
  byo_api: "byo_api";
4
5
  external_subscription: "external_subscription";
@@ -165,6 +166,8 @@ export type ModelExecutionTarget = z.output<typeof ModelExecutionTargetSchema>;
165
166
  export type ModelChoice = z.output<typeof ModelChoiceSchema>;
166
167
  export type WorkspaceModelDefaults = z.output<typeof WorkspaceModelDefaultsSchema>;
167
168
  export type ModelReadinessReason = z.output<typeof ModelReadinessReasonSchema>;
169
+ /** The most connections one `model-connections.list` page carries; the default page size. */
170
+ export declare const MODEL_CONNECTIONS_PAGE_MAX = 32;
168
171
  export declare const ModelConnectionListRequestSchema: z.ZodObject<{
169
172
  contractVersion: z.ZodObject<{
170
173
  major: z.ZodNumber;
@@ -201,6 +204,8 @@ export declare const ModelConnectionListRequestSchema: z.ZodObject<{
201
204
  pi_model_runtime: "pi_model_runtime";
202
205
  }>;
203
206
  }, z.core.$strict>;
207
+ limit: z.ZodOptional<z.ZodNumber>;
208
+ cursor: z.ZodOptional<typeof CursorSchema>;
204
209
  }, z.core.$strict>;
205
210
  }, z.core.$strict>;
206
211
  export declare const ModelDefaultsGetRequestSchema: z.ZodObject<{
@@ -378,6 +383,9 @@ export declare const ModelConnectionListResponseSchema: z.ZodObject<{
378
383
  }, z.core.$strict>;
379
384
  }, z.core.$strict>>;
380
385
  }, z.core.$strict>>;
386
+ connectionsPage: z.ZodObject<{
387
+ nextCursor: z.ZodOptional<z.ZodString>;
388
+ }, z.core.$strict>;
381
389
  }, z.core.$strict>;
382
390
  }, z.core.$strict>;
383
391
  export declare const ModelDefaultsResponseSchema: z.ZodObject<{
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { ReadRequestEnvelopeSchema, StateChangingCommandEnvelopeSchema, SuccessResponseEnvelopeSchema, } from './envelopes.js';
3
3
  import { ServiceCallerAssertionSchema } from './authentication.js';
4
4
  import { IdentifierSchemas } from './identifiers.js';
5
+ import { CursorSchema } from './pagination.js';
5
6
  const Ref = z
6
7
  .string()
7
8
  .min(1)
@@ -130,9 +131,17 @@ const Read = ReadRequestEnvelopeSchema.omit({ projectId: true }).extend({
130
131
  const Command = StateChangingCommandEnvelopeSchema.omit({ projectId: true }).extend({
131
132
  caller: ServiceCallerAssertionSchema,
132
133
  });
134
+ /** The most connections one `model-connections.list` page carries; the default page size. */
135
+ export const MODEL_CONNECTIONS_PAGE_MAX = 32;
133
136
  export const ModelConnectionListRequestSchema = Read.extend({
134
137
  operation: z.literal('model-connections.list'),
135
- parameters: z.strictObject({ target: ModelExecutionTargetSchema }),
138
+ parameters: z.strictObject({
139
+ target: ModelExecutionTargetSchema,
140
+ // Additive paging of `connections`, in connection-ref order: at most `limit` (default and
141
+ // maximum MODEL_CONNECTIONS_PAGE_MAX) per response, continued with `connectionsPage.nextCursor`.
142
+ limit: z.number().int().min(1).max(MODEL_CONNECTIONS_PAGE_MAX).optional(),
143
+ cursor: CursorSchema.optional(),
144
+ }),
136
145
  }).strict();
137
146
  export const ModelDefaultsGetRequestSchema = Read.extend({
138
147
  operation: z.literal('model-defaults.get'),
@@ -170,7 +179,8 @@ export const ModelConnectionListResponseSchema = SuccessResponseEnvelopeSchema.e
170
179
  }))
171
180
  .max(256),
172
181
  }))
173
- .max(128),
182
+ .max(MODEL_CONNECTIONS_PAGE_MAX),
183
+ connectionsPage: z.strictObject({ nextCursor: CursorSchema.optional() }),
174
184
  }),
175
185
  }).strict();
176
186
  export const ModelDefaultsResponseSchema = SuccessResponseEnvelopeSchema.extend({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/contracts",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Runtime-independent service boundary between Adea and the Control Plane: canonical identifiers, envelopes, Control API schemas, pagination, and versioning.",
5
5
  "keywords": [
6
6
  "agents",
@@ -32,11 +32,14 @@
32
32
  "./canonical-json": {
33
33
  "types": "./dist/canonical-json.d.ts",
34
34
  "default": "./dist/canonical-json.js"
35
+ },
36
+ "./device-sync": {
37
+ "types": "./dist/device-sync.d.ts",
38
+ "default": "./dist/device-sync.js"
35
39
  }
36
40
  },
37
41
  "publishConfig": {
38
- "access": "public",
39
- "provenance": true
42
+ "access": "public"
40
43
  },
41
44
  "scripts": {
42
45
  "build": "tsc -p tsconfig.json",