@roll-agent/protocol 0.9.0 → 0.11.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/index.js CHANGED
@@ -172,6 +172,7 @@ export function isRuntimeServerRequestMethodRequired(version, method) {
172
172
  return getRuntimeProtocolCapabilities(version).requiredServerRequestMethods.some((requiredMethod) => requiredMethod === method);
173
173
  }
174
174
  export const RUNTIME_METHODS = {
175
+ reasoningTextSubscribe: "reasoning.text.subscribe",
175
176
  operationResultGet: "operation.result.get",
176
177
  initialize: "initialize",
177
178
  clientCapabilitiesSet: "client.capabilities.set",
@@ -253,22 +254,29 @@ export const TOOL_OUTCOME_KINDS = [
253
254
  "cancelled",
254
255
  "tool_failed",
255
256
  ];
256
- export const threadIdSchema = z.string().uuid().brand();
257
- export const turnIdSchema = z.string().uuid().brand();
258
- export const approvalIdSchema = z.string().uuid().brand();
259
- export const interactionIdSchema = z.string().uuid().brand();
260
- export const runtimeInstanceIdSchema = z.string().uuid().brand();
261
- export const requestIdSchema = z.string().uuid().brand();
262
- export const streamIdSchema = z.string().uuid().brand();
263
- export const operationIdSchema = z.string().uuid().brand();
264
- export const runtimeEventIdSchema = z.string().uuid().brand();
265
- export const attachmentIdSchema = z.string().uuid().brand();
257
+ // Wire formats are owned by Protocol: dependency upgrades must not broaden UUIDs or
258
+ // reject timestamps that existing clients could send (including minute precision).
259
+ export const uuidSchema = z
260
+ .string()
261
+ .check(z.stringFormat("uuid", /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/));
262
+ export const timestampSchema = z
263
+ .string()
264
+ .check(z.stringFormat("datetime", /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-]\d{2}:\d{2})))$/));
265
+ export const threadIdSchema = uuidSchema.clone().brand();
266
+ export const turnIdSchema = uuidSchema.clone().brand();
267
+ export const approvalIdSchema = uuidSchema.clone().brand();
268
+ export const interactionIdSchema = uuidSchema.clone().brand();
269
+ export const runtimeInstanceIdSchema = uuidSchema.clone().brand();
270
+ export const requestIdSchema = uuidSchema.clone().brand();
271
+ export const streamIdSchema = uuidSchema.clone().brand();
272
+ export const operationIdSchema = uuidSchema.clone().brand();
273
+ export const runtimeEventIdSchema = uuidSchema.clone().brand();
274
+ export const attachmentIdSchema = uuidSchema.clone().brand();
266
275
  export const runtimeEventCursorSchema = z
267
276
  .string()
268
277
  .max(128)
269
278
  .regex(/^rte1:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}:(?:0|[1-9]\d*):[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/u)
270
279
  .brand();
271
- export const timestampSchema = z.string().datetime({ offset: true });
272
280
  export const jsonValueSchema = z.json();
273
281
  export const jsonRpcIdSchema = z.union([z.string(), z.number()]);
274
282
  export const runtimeProtocolVersionSchema = z.enum(SUPPORTED_RUNTIME_PROTOCOL_VERSIONS);
@@ -934,14 +942,8 @@ const recoveryThreadSummarySchema = z
934
942
  id: threadIdSchema,
935
943
  title: z.string().max(RUNTIME_V13_RECOVERY_SNAPSHOT_METADATA_MAX_CHARS).optional(),
936
944
  model: z.string().max(RUNTIME_V13_RECOVERY_SNAPSHOT_METADATA_MAX_CHARS).optional(),
937
- createdAt: z
938
- .string()
939
- .max(RUNTIME_V13_RECOVERY_SNAPSHOT_TIMESTAMP_MAX_CHARS)
940
- .datetime({ offset: true }),
941
- updatedAt: z
942
- .string()
943
- .max(RUNTIME_V13_RECOVERY_SNAPSHOT_TIMESTAMP_MAX_CHARS)
944
- .datetime({ offset: true }),
945
+ createdAt: timestampSchema.max(RUNTIME_V13_RECOVERY_SNAPSHOT_TIMESTAMP_MAX_CHARS),
946
+ updatedAt: timestampSchema.max(RUNTIME_V13_RECOVERY_SNAPSHOT_TIMESTAMP_MAX_CHARS),
945
947
  messageCount: z.number().int().nonnegative(),
946
948
  })
947
949
  .strict()
@@ -964,10 +966,7 @@ const recoveryActiveTurnSchema = z
964
966
  .object({
965
967
  id: turnIdSchema,
966
968
  status: z.enum(["running", "cancelling", "waiting-for-user"]),
967
- startedAt: z
968
- .string()
969
- .max(RUNTIME_V13_RECOVERY_SNAPSHOT_TIMESTAMP_MAX_CHARS)
970
- .datetime({ offset: true }),
969
+ startedAt: timestampSchema.max(RUNTIME_V13_RECOVERY_SNAPSHOT_TIMESTAMP_MAX_CHARS),
971
970
  })
972
971
  .strict()
973
972
  .readonly();
@@ -1016,7 +1015,7 @@ export const threadSnapshotV15Schema = z.union([
1016
1015
  /** Bounded Harness state only; no model-authored recovery notes or fact contents cross the wire. */
1017
1016
  export const contextRecoveryViewSchema = z
1018
1017
  .object({
1019
- checkpointId: z.string().uuid(),
1018
+ checkpointId: uuidSchema.clone(),
1020
1019
  required: z.boolean(),
1021
1020
  unextracted: z.boolean(),
1022
1021
  requiredItemCount: z.number().int().nonnegative(),
@@ -1481,13 +1480,12 @@ const messageCompletedEventSchema = z
1481
1480
  .object({ type: z.literal("message.completed"), streamId: streamIdSchema, text: z.string() })
1482
1481
  .strict()
1483
1482
  .readonly();
1483
+ const reasoningDeltaFields = { reasoningId: z.string().min(1), delta: z.string() };
1484
1484
  const reasoningSummaryDeltaEventSchema = z
1485
- .object({
1486
- type: z.literal("reasoning.summary.delta"),
1487
- reasoningId: z.string().min(1),
1488
- delta: z.string(),
1489
- })
1490
- .strict()
1485
+ .strictObject({ type: z.literal("reasoning.summary.delta"), ...reasoningDeltaFields })
1486
+ .readonly();
1487
+ const reasoningTextDeltaEventSchema = z
1488
+ .strictObject({ type: z.literal("reasoning.text.delta"), ...reasoningDeltaFields })
1491
1489
  .readonly();
1492
1490
  const toolStartedEventSchema = z
1493
1491
  .object({
@@ -1622,9 +1620,13 @@ export const runtimeDurableEventV16Schema = z.discriminatedUnion("type", [
1622
1620
  ...runtimeDurableEventV15Schema.options,
1623
1621
  contextRecoveryChangedEventSchema,
1624
1622
  ]);
1623
+ export const runtimeEphemeralEventV16Schema = z.discriminatedUnion("type", [
1624
+ ...runtimeEphemeralEventV13Schema.options,
1625
+ reasoningTextDeltaEventSchema,
1626
+ ]);
1625
1627
  export const runtimeEventV16Schema = z.union([
1626
1628
  runtimeDurableEventV16Schema,
1627
- runtimeEphemeralEventV13Schema,
1629
+ runtimeEphemeralEventV16Schema,
1628
1630
  ]);
1629
1631
  /** Latest Runtime Protocol event payloads. */
1630
1632
  export const runtimeEventSchema = runtimeEventV16Schema;
@@ -1744,16 +1746,27 @@ export const runtimeEventEnvelopeV15Schema = z.discriminatedUnion("durability",
1744
1746
  runtimeEphemeralEventEnvelopeV15Schema,
1745
1747
  ]);
1746
1748
  /** Any currently supported Runtime Event envelope. */
1747
- export const runtimeDurableEventEnvelopeV16Schema = runtimeDurableEventEnvelopeV15Schema.def.innerType
1748
- .extend({
1749
+ export const runtimeDurableEventEnvelopeV16Schema = z
1750
+ .object({
1749
1751
  protocolVersion: z.literal("1.6"),
1752
+ ...runtimeEventEnvelopeFields,
1753
+ durability: z.literal("durable"),
1754
+ eventId: runtimeEventIdSchema,
1755
+ cursor: runtimeEventCursorSchema,
1750
1756
  event: runtimeDurableEventV16Schema,
1751
1757
  })
1758
+ .strict()
1759
+ .superRefine(validateRuntimeEventCapabilities)
1752
1760
  .readonly();
1753
- export const runtimeEphemeralEventEnvelopeV16Schema = runtimeEphemeralEventEnvelopeV15Schema.def.innerType
1754
- .extend({
1761
+ export const runtimeEphemeralEventEnvelopeV16Schema = z
1762
+ .object({
1755
1763
  protocolVersion: z.literal("1.6"),
1764
+ ...runtimeEventEnvelopeFields,
1765
+ durability: z.literal("ephemeral"),
1766
+ event: runtimeEphemeralEventV16Schema,
1756
1767
  })
1768
+ .strict()
1769
+ .superRefine(validateRuntimeEventCapabilities)
1757
1770
  .readonly();
1758
1771
  export const runtimeEventEnvelopeV16Schema = z.discriminatedUnion("durability", [
1759
1772
  runtimeDurableEventEnvelopeV16Schema,
@@ -1952,6 +1965,10 @@ export const runtimeMethodSchemasV15 = {
1952
1965
  };
1953
1966
  export const runtimeMethodSchemasV16 = {
1954
1967
  ...runtimeMethodSchemasV15,
1968
+ [RUNTIME_METHODS.reasoningTextSubscribe]: {
1969
+ params: z.object({}).strict().readonly(),
1970
+ result: z.object({ subscribed: z.boolean() }).strict().readonly(),
1971
+ },
1955
1972
  [RUNTIME_METHODS.approvalPreview]: {
1956
1973
  params: approvalPreviewParamsSchema,
1957
1974
  result: approvalPreviewResultSchema,
@@ -744,6 +744,29 @@
744
744
  "delta"
745
745
  ],
746
746
  "additionalProperties": false
747
+ },
748
+ {
749
+ "readOnly": true,
750
+ "type": "object",
751
+ "properties": {
752
+ "type": {
753
+ "type": "string",
754
+ "const": "reasoning.text.delta"
755
+ },
756
+ "reasoningId": {
757
+ "type": "string",
758
+ "minLength": 1
759
+ },
760
+ "delta": {
761
+ "type": "string"
762
+ }
763
+ },
764
+ "required": [
765
+ "type",
766
+ "reasoningId",
767
+ "delta"
768
+ ],
769
+ "additionalProperties": false
747
770
  }
748
771
  ]
749
772
  }
@@ -5483,6 +5506,25 @@
5483
5506
  ],
5484
5507
  "additionalProperties": false
5485
5508
  },
5509
+ "reasoningTextSubscribeParams": {
5510
+ "readOnly": true,
5511
+ "type": "object",
5512
+ "properties": {},
5513
+ "additionalProperties": false
5514
+ },
5515
+ "reasoningTextSubscribeResult": {
5516
+ "readOnly": true,
5517
+ "type": "object",
5518
+ "properties": {
5519
+ "subscribed": {
5520
+ "type": "boolean"
5521
+ }
5522
+ },
5523
+ "required": [
5524
+ "subscribed"
5525
+ ],
5526
+ "additionalProperties": false
5527
+ },
5486
5528
  "approvalPreviewParams": {
5487
5529
  "readOnly": true,
5488
5530
  "type": "object",
@@ -6602,6 +6644,30 @@
6602
6644
  ],
6603
6645
  "additionalProperties": false
6604
6646
  },
6647
+ "reasoningTextSubscribeRequest": {
6648
+ "type": "object",
6649
+ "properties": {
6650
+ "jsonrpc": {
6651
+ "const": "2.0"
6652
+ },
6653
+ "id": {
6654
+ "$ref": "#/$defs/jsonRpcId"
6655
+ },
6656
+ "method": {
6657
+ "const": "reasoning.text.subscribe"
6658
+ },
6659
+ "params": {
6660
+ "$ref": "#/$defs/reasoningTextSubscribeParams"
6661
+ }
6662
+ },
6663
+ "required": [
6664
+ "jsonrpc",
6665
+ "id",
6666
+ "method",
6667
+ "params"
6668
+ ],
6669
+ "additionalProperties": false
6670
+ },
6605
6671
  "approvalPreviewRequest": {
6606
6672
  "type": "object",
6607
6673
  "properties": {
@@ -6736,6 +6802,9 @@
6736
6802
  {
6737
6803
  "$ref": "#/$defs/operationResultGetRequest"
6738
6804
  },
6805
+ {
6806
+ "$ref": "#/$defs/reasoningTextSubscribeRequest"
6807
+ },
6739
6808
  {
6740
6809
  "$ref": "#/$defs/approvalPreviewRequest"
6741
6810
  }
@@ -6862,6 +6931,9 @@
6862
6931
  {
6863
6932
  "$ref": "#/$defs/operationResultGetResult"
6864
6933
  },
6934
+ {
6935
+ "$ref": "#/$defs/reasoningTextSubscribeResult"
6936
+ },
6865
6937
  {
6866
6938
  "$ref": "#/$defs/approvalPreviewResult"
6867
6939
  },
@@ -7147,6 +7219,17 @@
7147
7219
  "$ref": "#/$defs/operationResultGetRequest"
7148
7220
  }
7149
7221
  },
7222
+ "reasoning.text.subscribe": {
7223
+ "params": {
7224
+ "$ref": "#/$defs/reasoningTextSubscribeParams"
7225
+ },
7226
+ "result": {
7227
+ "$ref": "#/$defs/reasoningTextSubscribeResult"
7228
+ },
7229
+ "request": {
7230
+ "$ref": "#/$defs/reasoningTextSubscribeRequest"
7231
+ }
7232
+ },
7150
7233
  "approval.preview": {
7151
7234
  "params": {
7152
7235
  "$ref": "#/$defs/approvalPreviewParams"
@@ -744,6 +744,29 @@
744
744
  "delta"
745
745
  ],
746
746
  "additionalProperties": false
747
+ },
748
+ {
749
+ "readOnly": true,
750
+ "type": "object",
751
+ "properties": {
752
+ "type": {
753
+ "type": "string",
754
+ "const": "reasoning.text.delta"
755
+ },
756
+ "reasoningId": {
757
+ "type": "string",
758
+ "minLength": 1
759
+ },
760
+ "delta": {
761
+ "type": "string"
762
+ }
763
+ },
764
+ "required": [
765
+ "type",
766
+ "reasoningId",
767
+ "delta"
768
+ ],
769
+ "additionalProperties": false
747
770
  }
748
771
  ]
749
772
  }
@@ -5483,6 +5506,25 @@
5483
5506
  ],
5484
5507
  "additionalProperties": false
5485
5508
  },
5509
+ "reasoningTextSubscribeParams": {
5510
+ "readOnly": true,
5511
+ "type": "object",
5512
+ "properties": {},
5513
+ "additionalProperties": false
5514
+ },
5515
+ "reasoningTextSubscribeResult": {
5516
+ "readOnly": true,
5517
+ "type": "object",
5518
+ "properties": {
5519
+ "subscribed": {
5520
+ "type": "boolean"
5521
+ }
5522
+ },
5523
+ "required": [
5524
+ "subscribed"
5525
+ ],
5526
+ "additionalProperties": false
5527
+ },
5486
5528
  "approvalPreviewParams": {
5487
5529
  "readOnly": true,
5488
5530
  "type": "object",
@@ -6602,6 +6644,30 @@
6602
6644
  ],
6603
6645
  "additionalProperties": false
6604
6646
  },
6647
+ "reasoningTextSubscribeRequest": {
6648
+ "type": "object",
6649
+ "properties": {
6650
+ "jsonrpc": {
6651
+ "const": "2.0"
6652
+ },
6653
+ "id": {
6654
+ "$ref": "#/$defs/jsonRpcId"
6655
+ },
6656
+ "method": {
6657
+ "const": "reasoning.text.subscribe"
6658
+ },
6659
+ "params": {
6660
+ "$ref": "#/$defs/reasoningTextSubscribeParams"
6661
+ }
6662
+ },
6663
+ "required": [
6664
+ "jsonrpc",
6665
+ "id",
6666
+ "method",
6667
+ "params"
6668
+ ],
6669
+ "additionalProperties": false
6670
+ },
6605
6671
  "approvalPreviewRequest": {
6606
6672
  "type": "object",
6607
6673
  "properties": {
@@ -6736,6 +6802,9 @@
6736
6802
  {
6737
6803
  "$ref": "#/$defs/operationResultGetRequest"
6738
6804
  },
6805
+ {
6806
+ "$ref": "#/$defs/reasoningTextSubscribeRequest"
6807
+ },
6739
6808
  {
6740
6809
  "$ref": "#/$defs/approvalPreviewRequest"
6741
6810
  }
@@ -6862,6 +6931,9 @@
6862
6931
  {
6863
6932
  "$ref": "#/$defs/operationResultGetResult"
6864
6933
  },
6934
+ {
6935
+ "$ref": "#/$defs/reasoningTextSubscribeResult"
6936
+ },
6865
6937
  {
6866
6938
  "$ref": "#/$defs/approvalPreviewResult"
6867
6939
  },
@@ -7147,6 +7219,17 @@
7147
7219
  "$ref": "#/$defs/operationResultGetRequest"
7148
7220
  }
7149
7221
  },
7222
+ "reasoning.text.subscribe": {
7223
+ "params": {
7224
+ "$ref": "#/$defs/reasoningTextSubscribeParams"
7225
+ },
7226
+ "result": {
7227
+ "$ref": "#/$defs/reasoningTextSubscribeResult"
7228
+ },
7229
+ "request": {
7230
+ "$ref": "#/$defs/reasoningTextSubscribeRequest"
7231
+ }
7232
+ },
7150
7233
  "approval.preview": {
7151
7234
  "params": {
7152
7235
  "$ref": "#/$defs/approvalPreviewParams"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/protocol",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "fixtures"
43
43
  ],
44
44
  "dependencies": {
45
- "zod": "3.25.76"
45
+ "zod": "4.6.6"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^22.0.0",