@canonmsg/backend-contracts 2.3.0 → 4.0.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.
@@ -25,7 +25,7 @@
25
25
  * cards, prompts, questions, tool names/summaries, details, diffs, and
26
26
  * self-contexts are body.
27
27
  */
28
- import { type CanonVerbName, type VerbSessionSelection } from './verbContract.js';
28
+ import { type CanonVerbName, type VerbNativeMetadata, type VerbSessionConfig, type VerbSessionSelection } from './verbContract.js';
29
29
  export declare const CANON_VERB_WIRE_SCHEMA_VERSION = "canon.verb-wire.v1";
30
30
  export declare const CANON_VERB_WIRE_SCHEMA_ID = "https://canonmsg.com/schemas/canon.verb-wire.v1.json";
31
31
  export type VerbWireBody = {
@@ -53,8 +53,9 @@ export interface VerbWireTurn {
53
53
  * Documented leak decisions (see e2ee-mls.md §10): `mentions` stays
54
54
  * plaintext for routing + mention-piercing pushes (D3); `contactUserId` on
55
55
  * share_contact reveals who was shared (explicitly accepted for v1);
56
- * `sessionConfig` may carry workspace ids — borderline, revisit with the
57
- * session-configuration encryption decision.
56
+ * `sessionConfig` carries only typed runtime option ids; `native` carries only
57
+ * typed correlation ids. Paths, labels, prompts, summaries, and other free
58
+ * text belong in the body or owner-local runtime state.
58
59
  */
59
60
  export interface CanonVerbWireEnvelope {
60
61
  conversationId?: string;
@@ -74,7 +75,7 @@ export interface CanonVerbWireEnvelope {
74
75
  risk?: 'low' | 'normal' | 'high' | 'destructive';
75
76
  category?: 'command' | 'file' | 'network' | 'browser' | 'mcp' | 'plugin' | 'canon' | 'tool';
76
77
  sessionSelection?: VerbSessionSelection;
77
- sessionConfig?: Record<string, unknown> | null;
78
+ sessionConfig?: VerbSessionConfig | null;
78
79
  idempotencyKey?: string;
79
80
  /** Target-message reference for react/forward — routing, not content. */
80
81
  messageId?: string;
@@ -84,7 +85,7 @@ export interface CanonVerbWireEnvelope {
84
85
  /** Group-membership routing ids (create_group) — distinct from mentions. */
85
86
  memberIds?: string[];
86
87
  turn?: VerbWireTurn;
87
- native?: Record<string, unknown>;
88
+ native?: VerbNativeMetadata;
88
89
  runtimeId?: string;
89
90
  limit?: number;
90
91
  }
@@ -268,7 +269,53 @@ export declare const CANON_VERB_WIRE_JSON_SCHEMA: {
268
269
  }];
269
270
  };
270
271
  readonly sessionConfig: {
271
- readonly type: readonly ["object", "null"];
272
+ readonly oneOf: readonly [{
273
+ readonly type: "object";
274
+ readonly description: string;
275
+ readonly additionalProperties: false;
276
+ readonly properties: {
277
+ readonly model: {
278
+ readonly type: "string";
279
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
280
+ readonly maxLength: 256;
281
+ };
282
+ readonly permissionMode: {
283
+ readonly type: "string";
284
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
285
+ readonly maxLength: 256;
286
+ };
287
+ readonly effort: {
288
+ readonly type: "string";
289
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
290
+ readonly maxLength: 256;
291
+ };
292
+ readonly workspaceId: {
293
+ readonly type: "string";
294
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
295
+ readonly maxLength: 256;
296
+ };
297
+ readonly executionMode: {
298
+ readonly enum: readonly ["worktree", "locked"];
299
+ };
300
+ readonly runtimeControlValues: {
301
+ readonly type: "object";
302
+ readonly maxProperties: 24;
303
+ readonly propertyNames: {
304
+ readonly pattern: "^[A-Za-z0-9_-]{1,80}$";
305
+ readonly not: {
306
+ readonly enum: readonly ["model", "workspace", "executionMode", "permissionMode", "effort", "interrupt", "runtimeControlValues", "updatedAt", "updatedBy"];
307
+ };
308
+ };
309
+ readonly additionalProperties: {
310
+ readonly type: "string";
311
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:/@+\\-]{0,255}$";
312
+ readonly maxLength: 256;
313
+ };
314
+ };
315
+ };
316
+ }, {
317
+ readonly type: "null";
318
+ }];
272
319
  };
273
320
  readonly idempotencyKey: {
274
321
  readonly type: "string";
@@ -307,6 +354,98 @@ export declare const CANON_VERB_WIRE_JSON_SCHEMA: {
307
354
  };
308
355
  readonly native: {
309
356
  readonly type: "object";
357
+ readonly description: string;
358
+ readonly maxProperties: 24;
359
+ readonly additionalProperties: false;
360
+ readonly properties: {
361
+ readonly runtime: {
362
+ readonly type: "string";
363
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
364
+ readonly maxLength: 256;
365
+ };
366
+ readonly method: {
367
+ readonly type: "string";
368
+ readonly pattern: "^[A-Za-z0-9_][A-Za-z0-9_./:\\-]{0,255}$";
369
+ readonly maxLength: 256;
370
+ };
371
+ readonly requestId: {
372
+ readonly type: "string";
373
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
374
+ readonly maxLength: 256;
375
+ };
376
+ readonly provider: {
377
+ readonly type: "string";
378
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
379
+ readonly maxLength: 256;
380
+ };
381
+ readonly origin: {
382
+ readonly type: "string";
383
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
384
+ readonly maxLength: 256;
385
+ };
386
+ readonly surface: {
387
+ readonly type: "string";
388
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
389
+ readonly maxLength: 256;
390
+ };
391
+ readonly threadId: {
392
+ readonly type: "string";
393
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
394
+ readonly maxLength: 256;
395
+ };
396
+ readonly turnId: {
397
+ readonly type: "string";
398
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
399
+ readonly maxLength: 256;
400
+ };
401
+ readonly runId: {
402
+ readonly type: "string";
403
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
404
+ readonly maxLength: 256;
405
+ };
406
+ readonly itemId: {
407
+ readonly type: "string";
408
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
409
+ readonly maxLength: 256;
410
+ };
411
+ readonly toolCallId: {
412
+ readonly type: "string";
413
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
414
+ readonly maxLength: 256;
415
+ };
416
+ readonly approvalId: {
417
+ readonly type: "string";
418
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
419
+ readonly maxLength: 256;
420
+ };
421
+ readonly pluginId: {
422
+ readonly type: "string";
423
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
424
+ readonly maxLength: 256;
425
+ };
426
+ readonly sessionKey: {
427
+ readonly type: "string";
428
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
429
+ readonly maxLength: 256;
430
+ };
431
+ readonly nodeId: {
432
+ readonly type: "string";
433
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
434
+ readonly maxLength: 256;
435
+ };
436
+ readonly handles: {
437
+ readonly type: "object";
438
+ readonly maxProperties: 16;
439
+ readonly propertyNames: {
440
+ readonly pattern: "^[A-Za-z0-9_.:-]{1,80}$";
441
+ };
442
+ readonly additionalProperties: {
443
+ readonly type: "string";
444
+ readonly pattern: "^[A-Za-z0-9@_][A-Za-z0-9_.:@+\\-]{0,255}$";
445
+ readonly maxLength: 256;
446
+ };
447
+ };
448
+ };
310
449
  };
311
450
  readonly runtimeId: {
312
451
  readonly type: "string";
package/dist/verbWire.js CHANGED
@@ -26,6 +26,7 @@
26
26
  * self-contexts are body.
27
27
  */
28
28
  import { CANON_VERB_NAMES, VERB_ID_PATTERNS, VERB_LIMITS, } from './verbContract.js';
29
+ import { VERB_NATIVE_METADATA_JSON_SCHEMA, VERB_SESSION_CONFIG_JSON_SCHEMA, } from './verbSchemas.js';
29
30
  export const CANON_VERB_WIRE_SCHEMA_VERSION = 'canon.verb-wire.v1';
30
31
  export const CANON_VERB_WIRE_SCHEMA_ID = 'https://canonmsg.com/schemas/canon.verb-wire.v1.json';
31
32
  // ---------------------------------------------------------------------------
@@ -198,7 +199,9 @@ const wireEnvelopeDef = {
198
199
  },
199
200
  ],
200
201
  },
201
- sessionConfig: { type: ['object', 'null'] },
202
+ sessionConfig: {
203
+ oneOf: [VERB_SESSION_CONFIG_JSON_SCHEMA, { type: 'null' }],
204
+ },
202
205
  idempotencyKey: {
203
206
  type: 'string',
204
207
  pattern: VERB_ID_PATTERNS.runtimeId,
@@ -221,7 +224,7 @@ const wireEnvelopeDef = {
221
224
  + 'overload the mention slot.',
222
225
  },
223
226
  turn: { $ref: '#/$defs/turn' },
224
- native: { type: 'object' },
227
+ native: VERB_NATIVE_METADATA_JSON_SCHEMA,
225
228
  runtimeId: { type: 'string', maxLength: VERB_LIMITS.turnIdChars },
226
229
  limit: { type: 'integer', minimum: 1 },
227
230
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/backend-contracts",
3
- "version": "2.3.0",
3
+ "version": "4.0.0",
4
4
  "description": "Canon backend contract helpers shared by Functions and stream-service",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",
@@ -43,7 +43,7 @@
43
43
  "access": "public"
44
44
  },
45
45
  "devDependencies": {
46
- "@canonmsg/rich-cards": "^0.8.2",
46
+ "@canonmsg/rich-cards": "^0.8.5",
47
47
  "@types/node": "^22.0.0",
48
48
  "ajv": "^8.20.0",
49
49
  "typescript": "~5.7.0",