@silverprotocol/core 0.6.6 → 0.7.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.
Files changed (52) hide show
  1. package/README.md +54 -6
  2. package/dist/agjson.d.ts +29 -8
  3. package/dist/agjson.d.ts.map +1 -1
  4. package/dist/agjson.js +28 -7
  5. package/dist/agjson.js.map +1 -1
  6. package/dist/atomic-push.d.ts +51 -0
  7. package/dist/atomic-push.d.ts.map +1 -0
  8. package/dist/atomic-push.js +188 -0
  9. package/dist/atomic-push.js.map +1 -0
  10. package/dist/copy-json.d.ts +12 -0
  11. package/dist/copy-json.d.ts.map +1 -0
  12. package/dist/copy-json.js +21 -0
  13. package/dist/copy-json.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/ingest.d.ts +41 -5
  19. package/dist/ingest.d.ts.map +1 -1
  20. package/dist/ingest.js +53 -30
  21. package/dist/ingest.js.map +1 -1
  22. package/dist/input-check.d.ts +51 -0
  23. package/dist/input-check.d.ts.map +1 -0
  24. package/dist/input-check.js +113 -0
  25. package/dist/input-check.js.map +1 -0
  26. package/dist/record.d.ts +68 -0
  27. package/dist/record.d.ts.map +1 -0
  28. package/dist/record.js +112 -0
  29. package/dist/record.js.map +1 -0
  30. package/dist/reduce.d.ts +0 -14
  31. package/dist/reduce.d.ts.map +1 -1
  32. package/dist/reduce.js +270 -68
  33. package/dist/reduce.js.map +1 -1
  34. package/dist/stream-assembler.d.ts +47 -4
  35. package/dist/stream-assembler.d.ts.map +1 -1
  36. package/dist/stream-assembler.js +55 -4
  37. package/dist/stream-assembler.js.map +1 -1
  38. package/dist/wire.d.ts +96 -0
  39. package/dist/wire.d.ts.map +1 -1
  40. package/dist/wire.js +309 -0
  41. package/dist/wire.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/agjson.ts +33 -10
  44. package/src/atomic-push.ts +217 -0
  45. package/src/copy-json.ts +27 -0
  46. package/src/index.ts +3 -0
  47. package/src/ingest.ts +71 -26
  48. package/src/input-check.ts +124 -0
  49. package/src/record.ts +132 -0
  50. package/src/reduce.ts +234 -56
  51. package/src/stream-assembler.ts +74 -8
  52. package/src/wire.ts +303 -0
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <p align="center">
13
13
  <a href="https://www.npmjs.com/package/@silverprotocol/core"><img src="https://img.shields.io/npm/v/%40silverprotocol%2Fcore?color=0a7"></a>
14
14
  <a href="https://github.com/silverprotocol/AgJSON/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue"></a>
15
- <a href="https://silverprotocol.io/AgJSON"><img src="https://img.shields.io/badge/spec-1.0.0--draft.1-6ee7ff"></a>
15
+ <a href="https://silverprotocol.io/AgJSON"><img src="https://img.shields.io/badge/spec-1.0.0--draft.4-6ee7ff"></a>
16
16
  </p>
17
17
 
18
18
  ---
@@ -57,7 +57,9 @@ the object graph, with the same code regardless of which framework produced it:
57
57
  ```ts
58
58
  import { ingestAgEvents, Reducer, AGJSON_VERSION } from "@silverprotocol/core";
59
59
 
60
- const events = ingestAgEvents(rawWireObjects); // parse-known-else-skip
60
+ const events = ingestAgEvents(rawWireObjects, {
61
+ onReject: ({ input, reason }) => console.warn("not an AgJSON event:", reason, input),
62
+ });
61
63
 
62
64
  const reducer = new Reducer();
63
65
  for (const ev of events) reducer.push(ev);
@@ -66,10 +68,56 @@ const { messages, turns, artifacts, memory } = reducer.result();
66
68
  console.log(AGJSON_VERSION, messages);
67
69
  ```
68
70
 
69
- `ingestAgEvents` validates raw wire objects against `AgEvent` and drops anything
70
- unparseable (the consumer posture); `Reducer` folds the validated stream into the
71
- normative snapshot; `AGJSON_VERSION` is the wire version this build implements
72
- (`1.0.0-draft.3`).
71
+ `ingestAgEvents` validates raw wire objects against `AgEvent` and never throws
72
+ (the consumer posture). Unknown fields pass through at every depth. An event it
73
+ cannot validate (a newer event type, an unknown enum value, a malformed known
74
+ type) is not folded: it rides in place as `{type: "ext.agjson.ignored", seq,
75
+ ignoredType, raw}`, which keeps its `seq` slot so the `Reducer` never mistakes it
76
+ for a gap. `raw` is for live inspection only; don't persist it. Input that is not
77
+ an event at all (not an object, no string `type`, no number `seq`) returns
78
+ nothing and goes to the optional `onReject` callback. `Reducer` folds the
79
+ validated stream into the normative snapshot; `AGJSON_VERSION` is the wire
80
+ version this build implements (`1.0.0-draft.4`).
81
+
82
+ ### Stored records and inputs
83
+
84
+ Messages and memory records you read back from storage, and inputs a client
85
+ sends, follow the same forward-compatible posture (AgJSON draft.4 §0.2):
86
+
87
+ ```ts
88
+ import { readStoredAgMessages, readStoredAgMemoryRecords, checkAgInput } from "@silverprotocol/core";
89
+
90
+ const { value: messages, reports } = readStoredAgMessages(rowsFromYourStore);
91
+ for (const r of reports) console.warn("unreadable", r.path, r.ignoredType, r.raw);
92
+
93
+ const checked = checkAgInput(requestBody);
94
+ if (!checked.ok) return reply(400, { code: checked.code, path: checked.path }); // "unknown-value" | "malformed" | "major-mismatch"
95
+ ```
96
+
97
+ - `readStoredAgMessage(s)` and `readStoredAgMemoryRecords` omit what they
98
+ cannot read and report it: a `content` element that fails at any depth is
99
+ omitted whole, and a record that fails is omitted from its array. Each report
100
+ carries its `path`, the element's `type` when it has one, and the verbatim
101
+ value, so inserting every report back at its index rebuilds the stored
102
+ record. Unknown fields pass through at every depth; nothing is coerced. What
103
+ they return is a view: keep storing and forwarding the record as received,
104
+ never the view. A record carried inside an event keeps the event rule above:
105
+ a `messages.snapshot` with one unknown block is ignored whole, so it cannot
106
+ resync a parked live fold, while the same message read from storage keeps its
107
+ readable blocks.
108
+ - `checkAgInput` rejects the whole input, before you act on any of it, when it
109
+ fails the schema in any way other than an unknown field, and names one path
110
+ and one class. `unknown-value`: a string outside a closed set this version
111
+ defines (a `kind`, an answer `status`, a reasoning `effort`, a block `type` in
112
+ `messages`, `run.system`, `run.context` or `results[].content`, …).
113
+ `major-mismatch`: another major `version`. `malformed`: everything else,
114
+ including a missing value, a wrong JSON type, a non-object input, or a
115
+ `protocol` other than `"agjson"`. It judges `protocol` first, then `version`,
116
+ then the rest; it checks the envelope members whatever the `kind`, and when
117
+ the rest has both kinds of problem the class is `malformed`. An accepted
118
+ input comes back with its unknown fields intact.
119
+ - `validateHitlAnswer` rejects an answer whose `status` is not a defined one
120
+ (`unknown-status`), so an unrecognized status is never read as a grant.
73
121
 
74
122
  ## Produce AgJSON
75
123
 
package/dist/agjson.d.ts CHANGED
@@ -321,7 +321,7 @@ export type AgHitlAnswerValidation = {
321
321
  ok: true;
322
322
  } | {
323
323
  ok: false;
324
- code: "ask-id-mismatch" | "grant-mode-missing" | "grant-mode-undeclared" | "grant-mode-without-declaration" | "grant-mode-on-nonresolved" | "request-state-mismatch";
324
+ code: "ask-id-mismatch" | "grant-mode-missing" | "grant-mode-undeclared" | "grant-mode-without-declaration" | "grant-mode-on-nonresolved" | "request-state-mismatch" | "unknown-status";
325
325
  message: string;
326
326
  };
327
327
  export declare function validateHitlAnswer(ask: AgPausedAsk, answer: AgHitlAnswer): AgHitlAnswerValidation;
@@ -339,6 +339,7 @@ export type AgBlock = ({
339
339
  type: "text";
340
340
  text: string;
341
341
  citations?: AgCitation[];
342
+ phase?: string;
342
343
  } & BlockMeta) | ({
343
344
  type: "image";
344
345
  source: AgSource;
@@ -379,6 +380,7 @@ export type AgBlock = ({
379
380
  } | ({
380
381
  type: "reasoning";
381
382
  text?: string;
383
+ phase?: string;
382
384
  opaque?: AgOpaque;
383
385
  provider?: string;
384
386
  providerDetails?: JsonValue;
@@ -694,6 +696,7 @@ export declare const AgTurnRecord: z.ZodObject<{
694
696
  rejected: "rejected";
695
697
  other: "other";
696
698
  }>>;
699
+ finishReasonRaw: z.ZodOptional<z.ZodString>;
697
700
  usage: z.ZodOptional<z.ZodType<AgUsage, unknown, z.core.$ZodTypeInternals<AgUsage, unknown>>>;
698
701
  safety: z.ZodOptional<z.ZodArray<z.ZodObject<{
699
702
  category: z.ZodString;
@@ -1007,6 +1010,7 @@ export declare const AgReduceResult: z.ZodObject<{
1007
1010
  rejected: "rejected";
1008
1011
  other: "other";
1009
1012
  }>>;
1013
+ finishReasonRaw: z.ZodOptional<z.ZodString>;
1010
1014
  usage: z.ZodOptional<z.ZodType<AgUsage, unknown, z.core.$ZodTypeInternals<AgUsage, unknown>>>;
1011
1015
  safety: z.ZodOptional<z.ZodArray<z.ZodObject<{
1012
1016
  category: z.ZodString;
@@ -1199,6 +1203,7 @@ export declare const AgClientCapabilities: z.ZodObject<{
1199
1203
  uiResources: z.ZodOptional<z.ZodObject<{
1200
1204
  catalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
1201
1205
  htmlResources: z.ZodOptional<z.ZodBoolean>;
1206
+ viewMessageTurns: z.ZodOptional<z.ZodBoolean>;
1202
1207
  }, z.core.$strip>>;
1203
1208
  state: z.ZodOptional<z.ZodObject<{
1204
1209
  jsonPatch: z.ZodOptional<z.ZodBoolean>;
@@ -1305,7 +1310,7 @@ export declare const AgRunConfig: z.ZodObject<{
1305
1310
  }, z.core.$strip>>;
1306
1311
  }, z.core.$strip>;
1307
1312
  export type AgRunConfig = z.infer<typeof AgRunConfig>;
1308
- export declare const AGJSON_VERSION = "1.0.0-draft.3";
1313
+ export declare const AGJSON_VERSION = "1.0.0-draft.4";
1309
1314
  export declare const AgInputEnvelope: z.ZodObject<{
1310
1315
  protocol: z.ZodLiteral<"agjson">;
1311
1316
  version: z.ZodString;
@@ -1331,6 +1336,7 @@ export declare const AgInputEnvelope: z.ZodObject<{
1331
1336
  uiResources: z.ZodOptional<z.ZodObject<{
1332
1337
  catalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
1333
1338
  htmlResources: z.ZodOptional<z.ZodBoolean>;
1339
+ viewMessageTurns: z.ZodOptional<z.ZodBoolean>;
1334
1340
  }, z.core.$strip>>;
1335
1341
  state: z.ZodOptional<z.ZodObject<{
1336
1342
  jsonPatch: z.ZodOptional<z.ZodBoolean>;
@@ -1501,7 +1507,7 @@ export declare const AgOpenAiWidgetAction: z.ZodDiscriminatedUnion<[z.ZodObject<
1501
1507
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
1502
1508
  }, z.core.$strip>], "method">;
1503
1509
  export type AgOpenAiWidgetAction = z.infer<typeof AgOpenAiWidgetAction>;
1504
- export declare const AgSurfaceInteraction: z.ZodUnion<readonly [z.ZodObject<{
1510
+ export declare const AgSurfaceInteraction: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
1505
1511
  surface: z.ZodLiteral<"a2ui">;
1506
1512
  a2uiMessage: z.ZodLiteral<"action">;
1507
1513
  name: z.ZodString;
@@ -1538,7 +1544,7 @@ export declare const AgSurfaceInteraction: z.ZodUnion<readonly [z.ZodObject<{
1538
1544
  turnId: z.ZodOptional<z.ZodString>;
1539
1545
  threadId: z.ZodOptional<z.ZodString>;
1540
1546
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
1541
- }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1547
+ }, z.core.$strip>], "a2uiMessage">, z.ZodDiscriminatedUnion<[z.ZodObject<{
1542
1548
  surface: z.ZodLiteral<"mcp-app">;
1543
1549
  method: z.ZodLiteral<"ui/update-model-context">;
1544
1550
  params: z.ZodObject<{
@@ -1639,7 +1645,7 @@ export declare const AgSurfaceInteraction: z.ZodUnion<readonly [z.ZodObject<{
1639
1645
  turnId: z.ZodOptional<z.ZodString>;
1640
1646
  threadId: z.ZodOptional<z.ZodString>;
1641
1647
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
1642
- }, z.core.$strip>], "method">]>;
1648
+ }, z.core.$strip>], "method">], "surface">;
1643
1649
  export type AgSurfaceInteraction = z.infer<typeof AgSurfaceInteraction>;
1644
1650
  export declare const AgInputToolResult: z.ZodObject<{
1645
1651
  toolCallId: z.ZodString;
@@ -1798,6 +1804,7 @@ export declare const AgInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
1798
1804
  uiResources: z.ZodOptional<z.ZodObject<{
1799
1805
  catalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
1800
1806
  htmlResources: z.ZodOptional<z.ZodBoolean>;
1807
+ viewMessageTurns: z.ZodOptional<z.ZodBoolean>;
1801
1808
  }, z.core.$strip>>;
1802
1809
  state: z.ZodOptional<z.ZodObject<{
1803
1810
  jsonPatch: z.ZodOptional<z.ZodBoolean>;
@@ -1821,7 +1828,7 @@ export declare const AgInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
1821
1828
  token: z.ZodOptional<z.ZodString>;
1822
1829
  requestState: z.ZodOptional<z.ZodString>;
1823
1830
  }, z.core.$strip>>>;
1824
- uiActions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1831
+ uiActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
1825
1832
  surface: z.ZodLiteral<"a2ui">;
1826
1833
  a2uiMessage: z.ZodLiteral<"action">;
1827
1834
  name: z.ZodString;
@@ -1858,7 +1865,7 @@ export declare const AgInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
1858
1865
  turnId: z.ZodOptional<z.ZodString>;
1859
1866
  threadId: z.ZodOptional<z.ZodString>;
1860
1867
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
1861
- }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1868
+ }, z.core.$strip>], "a2uiMessage">, z.ZodDiscriminatedUnion<[z.ZodObject<{
1862
1869
  surface: z.ZodLiteral<"mcp-app">;
1863
1870
  method: z.ZodLiteral<"ui/update-model-context">;
1864
1871
  params: z.ZodObject<{
@@ -1959,7 +1966,7 @@ export declare const AgInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
1959
1966
  turnId: z.ZodOptional<z.ZodString>;
1960
1967
  threadId: z.ZodOptional<z.ZodString>;
1961
1968
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
1962
- }, z.core.$strip>], "method">]>>>;
1969
+ }, z.core.$strip>], "method">], "surface">>>;
1963
1970
  protocol: z.ZodLiteral<"agjson">;
1964
1971
  version: z.ZodString;
1965
1972
  threadId: z.ZodString;
@@ -1984,6 +1991,7 @@ export declare const AgInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
1984
1991
  uiResources: z.ZodOptional<z.ZodObject<{
1985
1992
  catalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
1986
1993
  htmlResources: z.ZodOptional<z.ZodBoolean>;
1994
+ viewMessageTurns: z.ZodOptional<z.ZodBoolean>;
1987
1995
  }, z.core.$strip>>;
1988
1996
  state: z.ZodOptional<z.ZodObject<{
1989
1997
  jsonPatch: z.ZodOptional<z.ZodBoolean>;
@@ -2055,6 +2063,7 @@ export declare const AgInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
2055
2063
  uiResources: z.ZodOptional<z.ZodObject<{
2056
2064
  catalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2057
2065
  htmlResources: z.ZodOptional<z.ZodBoolean>;
2066
+ viewMessageTurns: z.ZodOptional<z.ZodBoolean>;
2058
2067
  }, z.core.$strip>>;
2059
2068
  state: z.ZodOptional<z.ZodObject<{
2060
2069
  jsonPatch: z.ZodOptional<z.ZodBoolean>;
@@ -2177,6 +2186,7 @@ export declare const AgClosedEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
2177
2186
  rejected: "rejected";
2178
2187
  other: "other";
2179
2188
  }>;
2189
+ finishReasonRaw: z.ZodOptional<z.ZodString>;
2180
2190
  usage: z.ZodOptional<z.ZodType<AgUsage, unknown, z.core.$ZodTypeInternals<AgUsage, unknown>>>;
2181
2191
  safety: z.ZodOptional<z.ZodArray<z.ZodObject<{
2182
2192
  category: z.ZodString;
@@ -2264,6 +2274,7 @@ export declare const AgClosedEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
2264
2274
  type: z.ZodLiteral<"text.start">;
2265
2275
  id: z.ZodString;
2266
2276
  role: z.ZodOptional<z.ZodLiteral<"assistant">>;
2277
+ phase: z.ZodOptional<z.ZodString>;
2267
2278
  index: z.ZodOptional<z.ZodNumber>;
2268
2279
  previousPartKind: z.ZodOptional<z.ZodString>;
2269
2280
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
@@ -2286,6 +2297,7 @@ export declare const AgClosedEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
2286
2297
  }, z.core.$strip>, z.ZodObject<{
2287
2298
  type: z.ZodLiteral<"text.end">;
2288
2299
  id: z.ZodString;
2300
+ phase: z.ZodOptional<z.ZodString>;
2289
2301
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
2290
2302
  citations: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2291
2303
  kind: z.ZodLiteral<"char">;
@@ -2496,6 +2508,7 @@ export declare const AgClosedEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
2496
2508
  summarized: "summarized";
2497
2509
  full: "full";
2498
2510
  }>>;
2511
+ phase: z.ZodOptional<z.ZodString>;
2499
2512
  partIndex: z.ZodOptional<z.ZodNumber>;
2500
2513
  previousPartKind: z.ZodOptional<z.ZodString>;
2501
2514
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
@@ -2521,6 +2534,7 @@ export declare const AgClosedEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
2521
2534
  type: z.ZodLiteral<"reasoning.end">;
2522
2535
  id: z.ZodString;
2523
2536
  provider: z.ZodOptional<z.ZodString>;
2537
+ phase: z.ZodOptional<z.ZodString>;
2524
2538
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
2525
2539
  seq: z.ZodNumber;
2526
2540
  turnId: z.ZodOptional<z.ZodString>;
@@ -2931,6 +2945,7 @@ export declare const AgClosedEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
2931
2945
  rejected: "rejected";
2932
2946
  other: "other";
2933
2947
  }>>;
2948
+ finishReasonRaw: z.ZodOptional<z.ZodString>;
2934
2949
  usage: z.ZodOptional<z.ZodType<AgUsage, unknown, z.core.$ZodTypeInternals<AgUsage, unknown>>>;
2935
2950
  safety: z.ZodOptional<z.ZodArray<z.ZodObject<{
2936
2951
  category: z.ZodString;
@@ -3424,6 +3439,7 @@ export declare const AgEvent: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
3424
3439
  rejected: "rejected";
3425
3440
  other: "other";
3426
3441
  }>;
3442
+ finishReasonRaw: z.ZodOptional<z.ZodString>;
3427
3443
  usage: z.ZodOptional<z.ZodType<AgUsage, unknown, z.core.$ZodTypeInternals<AgUsage, unknown>>>;
3428
3444
  safety: z.ZodOptional<z.ZodArray<z.ZodObject<{
3429
3445
  category: z.ZodString;
@@ -3511,6 +3527,7 @@ export declare const AgEvent: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
3511
3527
  type: z.ZodLiteral<"text.start">;
3512
3528
  id: z.ZodString;
3513
3529
  role: z.ZodOptional<z.ZodLiteral<"assistant">>;
3530
+ phase: z.ZodOptional<z.ZodString>;
3514
3531
  index: z.ZodOptional<z.ZodNumber>;
3515
3532
  previousPartKind: z.ZodOptional<z.ZodString>;
3516
3533
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
@@ -3533,6 +3550,7 @@ export declare const AgEvent: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
3533
3550
  }, z.core.$strip>, z.ZodObject<{
3534
3551
  type: z.ZodLiteral<"text.end">;
3535
3552
  id: z.ZodString;
3553
+ phase: z.ZodOptional<z.ZodString>;
3536
3554
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
3537
3555
  citations: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
3538
3556
  kind: z.ZodLiteral<"char">;
@@ -3743,6 +3761,7 @@ export declare const AgEvent: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
3743
3761
  summarized: "summarized";
3744
3762
  full: "full";
3745
3763
  }>>;
3764
+ phase: z.ZodOptional<z.ZodString>;
3746
3765
  partIndex: z.ZodOptional<z.ZodNumber>;
3747
3766
  previousPartKind: z.ZodOptional<z.ZodString>;
3748
3767
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
@@ -3768,6 +3787,7 @@ export declare const AgEvent: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
3768
3787
  type: z.ZodLiteral<"reasoning.end">;
3769
3788
  id: z.ZodString;
3770
3789
  provider: z.ZodOptional<z.ZodString>;
3790
+ phase: z.ZodOptional<z.ZodString>;
3771
3791
  providerMetadata: z.ZodOptional<z.core.$ZodBranded<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>, "AgProviderMeta", "out">>;
3772
3792
  seq: z.ZodNumber;
3773
3793
  turnId: z.ZodOptional<z.ZodString>;
@@ -4178,6 +4198,7 @@ export declare const AgEvent: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
4178
4198
  rejected: "rejected";
4179
4199
  other: "other";
4180
4200
  }>>;
4201
+ finishReasonRaw: z.ZodOptional<z.ZodString>;
4181
4202
  usage: z.ZodOptional<z.ZodType<AgUsage, unknown, z.core.$ZodTypeInternals<AgUsage, unknown>>>;
4182
4203
  safety: z.ZodOptional<z.ZodArray<z.ZodObject<{
4183
4204
  category: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"agjson.d.ts","sourceRoot":"","sources":["../src/agjson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AACpG,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAS1C,CAAC;AAGF,eAAO,MAAM,MAAM,uGAAkC,CAAC;AACtD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAG5C,eAAO,MAAM,QAAQ;;;;;;;;;;;;2BAInB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAKhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;mBAS1B,CAAC;AAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mGAKlB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC"}
package/dist/agjson.js CHANGED
@@ -222,6 +222,13 @@ export const AgHitlAnswer = z
222
222
  message: "grantModeId is only valid on a resolved answer (declining is not a mode — spec §7)",
223
223
  });
224
224
  export function validateHitlAnswer(ask, answer) {
225
+ // draft.4 §0.2 (workspace#20 decision 6): an undefined status is rejected
226
+ // before dispatch, never read as a grant. The typed path already fails at
227
+ // parse; this closes the fail-open for a raw or hand-built answer.
228
+ const statuses = AgHitlAnswer.shape.status.options;
229
+ if (!statuses.includes(answer.status)) {
230
+ return { ok: false, code: "unknown-status", message: `status ${JSON.stringify(answer.status) ?? "undefined"} is not a defined AgHitlAnswer status (spec §0.2, §7)` };
231
+ }
225
232
  if (answer.askId !== ask.askId) {
226
233
  return { ok: false, code: "ask-id-mismatch", message: `answer.askId ${JSON.stringify(answer.askId)} does not name ask ${JSON.stringify(ask.askId)}` };
227
234
  }
@@ -272,6 +279,7 @@ export const AgBlock = z.lazy(() => z.discriminatedUnion("type", [
272
279
  type: z.literal("text"),
273
280
  text: z.string(),
274
281
  citations: z.array(AgCitation).optional(),
282
+ phase: z.string().optional(), // draft.4: OPEN string, never z.enum (a closed value would drop the event)
275
283
  }),
276
284
  z.object({ ...blockMeta, type: z.literal("image"), source: AgSource }),
277
285
  z.object({ ...blockMeta, type: z.literal("audio"), source: AgSource }),
@@ -290,6 +298,7 @@ export const AgBlock = z.lazy(() => z.discriminatedUnion("type", [
290
298
  ...blockMeta,
291
299
  type: z.literal("reasoning"),
292
300
  text: z.string().optional(),
301
+ phase: z.string().optional(), // draft.4: OPEN string, never z.enum
293
302
  opaque: AgOpaque.optional(),
294
303
  provider: z.string().optional(),
295
304
  providerDetails: JsonValue.optional(),
@@ -452,6 +461,7 @@ export const AgTurnRecord = z.object({
452
461
  threadId: z.string(),
453
462
  outcome: AgOutcome.optional(),
454
463
  finishReason: AgFinishReason.optional(),
464
+ finishReasonRaw: z.string().optional(), // the native finish value verbatim, folded from turn.done (§2, draft.4)
455
465
  usage: AgUsage.optional(),
456
466
  safety: z.array(AgSafety).optional(),
457
467
  handoffs: z.array(AgHandoffRecord).optional(),
@@ -526,6 +536,7 @@ export const AgClientCapabilities = z.object({
526
536
  .object({
527
537
  catalogs: z.array(z.string()).optional(),
528
538
  htmlResources: z.boolean().optional(),
539
+ viewMessageTurns: z.boolean().optional(), // draft.4: view ui/message + sendFollowUpMessage delivered as a later kind:"start" turn (spec §6)
529
540
  })
530
541
  .optional(),
531
542
  state: z.object({ jsonPatch: z.boolean().optional() }).optional(),
@@ -593,7 +604,7 @@ export const AgRunConfig = z.object({
593
604
  });
594
605
  // The spec version this SDK implements (SPEC.md status line + §12). Consumers
595
606
  // reject a MAJOR mismatch and accept any same-major version (§12 negotiation).
596
- export const AGJSON_VERSION = "1.0.0-draft.3";
607
+ export const AGJSON_VERSION = "1.0.0-draft.4";
597
608
  const agjsonWireVersion = z
598
609
  .string()
599
610
  .refine((v) => /^\d+\./.test(v) && v.split(".")[0] === AGJSON_VERSION.split(".")[0], {
@@ -768,10 +779,14 @@ export const AgOpenAiWidgetAction = z.discriminatedUnion("method", [
768
779
  // The surface-interaction union (spec §3 / §6). Element type of
769
780
  // resume.uiActions[]. Discriminated on `surface`; the three A2UI legs narrow
770
781
  // further on the inner `a2uiMessage` discriminant.
771
- export const AgSurfaceInteraction = z.union([
772
- AgA2uiSurfaceAction,
773
- AgA2uiFunctionResponse,
774
- AgA2uiError,
782
+ // Discriminated on `surface` FIRST, then each surface's own discriminant
783
+ // (a2uiMessage / method), so a validation issue names the member that is
784
+ // actually wrong: a plain z.union let every non-matching branch report its
785
+ // own `surface` literal, and the input check (input-check.ts) misclassified
786
+ // e.g. an mcp-app ui/open-link with a non-string url (CB-9). Same members,
787
+ // same literals, same accepted values; only the failure path is exact.
788
+ export const AgSurfaceInteraction = z.discriminatedUnion("surface", [
789
+ z.discriminatedUnion("a2uiMessage", [AgA2uiSurfaceAction, AgA2uiFunctionResponse, AgA2uiError]),
775
790
  AgMcpAppViewMessage,
776
791
  AgOpenAiWidgetAction,
777
792
  ]);
@@ -830,7 +845,7 @@ export const AgSurfaceError = z.object({
830
845
  message: z.string(),
831
846
  path: z.string().optional(),
832
847
  });
833
- // Event base (spec §4): `seq` = global monotonic ordinal; `turnId` names the owning turn;
848
+ // Event base (spec §4): `seq` = per-invoke gap-free ordinal from 0 (INV-SEQ: backward only as a new invoke's 0-restart); `turnId` names the owning turn;
834
849
  // `messageId` (when present) names the open message the event attaches to.
835
850
  // Spread FIRST in each arm so an arm's required field overrides the optional base field.
836
851
  const base = {
@@ -854,6 +869,7 @@ export const AgClosedEvent = z.discriminatedUnion("type", [
854
869
  turnId: z.string(),
855
870
  outcome: AgOutcome,
856
871
  finishReason: AgFinishReason,
872
+ finishReasonRaw: z.string().optional(), // the native finish value verbatim, e.g. when finishReason is "other"/"unknown" (§4, draft.4)
857
873
  usage: AgUsage.optional(), // EXTENDED — per-turn usage (spec §4)
858
874
  safety: z.array(AgSafety).optional(), // EXTENDED — safety signals (spec §4)
859
875
  messageId: z.string().optional(),
@@ -898,6 +914,7 @@ export const AgClosedEvent = z.discriminatedUnion("type", [
898
914
  type: z.literal("text.start"),
899
915
  id: z.string(),
900
916
  role: z.literal("assistant").optional(),
917
+ phase: z.string().optional(), // draft.4 open-string label, folds onto the block
901
918
  index: z.number().optional(),
902
919
  previousPartKind: z.string().optional(),
903
920
  providerMetadata: AgProviderMeta.optional(),
@@ -914,6 +931,7 @@ export const AgClosedEvent = z.discriminatedUnion("type", [
914
931
  ...base,
915
932
  type: z.literal("text.end"),
916
933
  id: z.string(),
934
+ phase: z.string().optional(), // draft.4: REPLACES the start value when present
917
935
  providerMetadata: AgProviderMeta.optional(),
918
936
  // STREAMED-text citations carrier (audit M22): citations for a streamed text
919
937
  // block arrive here (not as a duplicate id-less supplement block) and attach
@@ -991,6 +1009,7 @@ export const AgClosedEvent = z.discriminatedUnion("type", [
991
1009
  type: z.literal("reasoning.start"),
992
1010
  id: z.string(),
993
1011
  mode: z.enum(["summarized", "full"]).optional(),
1012
+ phase: z.string().optional(), // draft.4 open-string label, folds onto the block
994
1013
  partIndex: z.number().optional(),
995
1014
  previousPartKind: z.string().optional(),
996
1015
  providerMetadata: AgProviderMeta.optional(),
@@ -1010,6 +1029,7 @@ export const AgClosedEvent = z.discriminatedUnion("type", [
1010
1029
  type: z.literal("reasoning.end"),
1011
1030
  id: z.string(),
1012
1031
  provider: z.string().optional(),
1032
+ phase: z.string().optional(), // draft.4: REPLACES the start value when present
1013
1033
  providerMetadata: AgProviderMeta.optional(),
1014
1034
  }),
1015
1035
  // REPLACE — sets `opaque` on the reasoning block named by `id` (replay-load-bearing).
@@ -1123,7 +1143,8 @@ export const AgClosedEvent = z.discriminatedUnion("type", [
1123
1143
  // ── OPAQUE / ADVANCED STATE PASSTHROUGH (LangGraph values/updates) ──
1124
1144
  // `snapshot` = full graph-state dict ("values" stream mode); REPLACE on fold (§5).
1125
1145
  z.object({ ...base, type: z.literal("state.snapshot"), snapshot: JsonValue }),
1126
- // `patch` = LangGraph "updates" ({node:{key:value}}) OR an RFC-6902 JSON Patch — both opaque.
1146
+ // `patch` = an RFC-6902 JSON Patch array OR a key-replace object (each top-level key
1147
+ // replaces the state's key whole, draft.4 §5; ADK's actions.stateDelta is one).
1127
1148
  z.object({ ...base, type: z.literal("state.delta"), patch: JsonValue }),
1128
1149
  // ── STREAMED ARTIFACTS (A2A) — side-channel landing (§5) ──
1129
1150
  z.object({