@silverprotocol/claude-agent-sdk 0.6.7 → 0.7.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.
package/README.md CHANGED
@@ -101,4 +101,4 @@ framework produced the stream.
101
101
 
102
102
  Spec: [silverprotocol.io/AgJSON](https://silverprotocol.io/AgJSON) — canonical
103
103
  in [silverprotocol/AgJSON](https://github.com/silverprotocol/AgJSON); wire
104
- version `1.0.0-draft.3`.
104
+ version `1.0.0-draft.4`.
package/dist/index.d.ts CHANGED
@@ -59,12 +59,44 @@ export interface ClaudeNormalizerOptions {
59
59
  * construction.
60
60
  */
61
61
  threadId?: string;
62
+ /**
63
+ * The stem of this invoke's POSITIONAL fallback turn ids,
64
+ * `turn_<invokeId>_frame_<n>`, minted only for a top-level or nested turn
65
+ * whose frame carries no usable message id or uuid (the normal path names a
66
+ * turn by its SDK message id or frame uuid, unique by construction). A host
67
+ * folds every invoke of a conversation into ONE Reducer, so a stem that
68
+ * restarted with each invoke repeated those ids across invokes (DC-10, from
69
+ * sp-protocol's D3 bar). Absent, each normalizer draws a random
70
+ * `claude_<16 hex>` stem at most once, lazily (only when a fallback id is
71
+ * first needed, so the common path draws no randomness), and holds it
72
+ * OUTSIDE the atomic-push rebuild, so a rebuild reproduces it. Pass a fixed
73
+ * value only where one invoke's output must be byte-reproducible (capture,
74
+ * replay, tests), as vercel-ai's `invokeId`.
75
+ */
76
+ invokeId?: string;
62
77
  }
63
78
  /**
64
- * Build a stateful Claude-facet normalizer over a fresh {@link StreamAssembler}.
65
- * Each `push(native)` validates `native` → `SDKMessage`, drives the engine via
66
- * primitive calls, and drains the buffered `AgEvent[]`. `flush()` closes any
67
- * dangling open message (none, in Claude's complete-message model) and drains.
79
+ * Build the Claude-facet normalizer: the inner normalizer wrapped in core's
80
+ * withAtomicPush (the fleet guard ruling, 2026-09-24, binding). push() never
81
+ * throws (SPEC:933):
82
+ * - each native is first read as plain JSON (core toJsonValueSafe): a host
83
+ * may hand in the in-process object, whose members need not be JSON (an
84
+ * undefined member, a Date, NaN, a BigInt, a function, a cycle); a JSON
85
+ * frame passes by reference, anything else folds exactly as its JSON form,
86
+ * which is what every capture already is (the SDK itself parses the CLI's
87
+ * NDJSON, so no 0.3.280 SDK frame needs it);
88
+ * - an envelope-valid but malformed frame (a required field missing or
89
+ * mistyped below the isSDKMessage discriminants: 61 single-point fuzz
90
+ * mutants of the corpus's 25 frame shapes threw, from ~17 sites, most after
91
+ * the frame had emitted) no longer throws: its partial batch is discarded
92
+ * with its state (the inner is rebuilt and re-driven from the journal) and
93
+ * one core `error {message: "normalizer error", code: <constructor name>}`
94
+ * takes the next seq. Over every committed native it fires zero times
95
+ * (e2e agents/claude-agent-sdk/guard.corpus.test.ts).
96
+ * The fallback id stem is held HERE, outside the rebuild's factory: drawn at
97
+ * most once, and only when a fallback id is first needed, so the common path
98
+ * never touches randomness (core's atomic-guard differential runs with it
99
+ * poisoned) and a rebuild re-reads the same stem.
68
100
  */
69
101
  export declare function createClaudeNormalizer(options?: ClaudeNormalizerOptions): Normalizer;
70
102
  export default createClaudeNormalizer;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAGL,KAAK,cAAc,EAQnB,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAO9B,KAAK,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAE/D,KAAK,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAE5C,KAAK,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;AAiC/D,iBAAS,aAAa,CAAC,IAAI,EAAE,cAA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