@adonis-agora/agent 0.31.0 → 0.33.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.
Files changed (238) hide show
  1. package/CHANGELOG.md +795 -0
  2. package/dist/assets/spa/assets/index-DjIMQOxi.js +9 -0
  3. package/dist/assets/spa/index.html +1 -1
  4. package/dist/providers/agent_provider.d.ts.map +1 -1
  5. package/dist/providers/agent_provider.js +140 -2
  6. package/dist/providers/agent_provider.js.map +1 -1
  7. package/dist/src/agent-deps-factory.d.ts +16 -2
  8. package/dist/src/agent-deps-factory.d.ts.map +1 -1
  9. package/dist/src/agent-deps-factory.js +8 -0
  10. package/dist/src/agent-deps-factory.js.map +1 -1
  11. package/dist/src/agent-deps.d.ts +21 -1
  12. package/dist/src/agent-deps.d.ts.map +1 -1
  13. package/dist/src/agent-deps.js.map +1 -1
  14. package/dist/src/agent-loop.d.ts +228 -9
  15. package/dist/src/agent-loop.d.ts.map +1 -1
  16. package/dist/src/agent-loop.js +1360 -209
  17. package/dist/src/agent-loop.js.map +1 -1
  18. package/dist/src/agent-service.d.ts +27 -0
  19. package/dist/src/agent-service.d.ts.map +1 -1
  20. package/dist/src/agent-service.js +29 -0
  21. package/dist/src/agent-service.js.map +1 -1
  22. package/dist/src/ai-sdk/ai-sdk-model.d.ts.map +1 -1
  23. package/dist/src/ai-sdk/ai-sdk-model.js +21 -1
  24. package/dist/src/ai-sdk/ai-sdk-model.js.map +1 -1
  25. package/dist/src/client/sse.d.ts +32 -2
  26. package/dist/src/client/sse.d.ts.map +1 -1
  27. package/dist/src/client/sse.js +45 -2
  28. package/dist/src/client/sse.js.map +1 -1
  29. package/dist/src/define_config.d.ts +41 -7
  30. package/dist/src/define_config.d.ts.map +1 -1
  31. package/dist/src/define_config.js.map +1 -1
  32. package/dist/src/durable/agent-run-workflow.d.ts +10 -11
  33. package/dist/src/durable/agent-run-workflow.d.ts.map +1 -1
  34. package/dist/src/durable/agent-run-workflow.js +49 -21
  35. package/dist/src/durable/agent-run-workflow.js.map +1 -1
  36. package/dist/src/durable/durable-agent-runner.d.ts +3 -2
  37. package/dist/src/durable/durable-agent-runner.d.ts.map +1 -1
  38. package/dist/src/durable/durable-agent-runner.js +2 -2
  39. package/dist/src/durable/durable-agent-runner.js.map +1 -1
  40. package/dist/src/elicitation.d.ts +207 -0
  41. package/dist/src/elicitation.d.ts.map +1 -0
  42. package/dist/src/elicitation.js +315 -0
  43. package/dist/src/elicitation.js.map +1 -0
  44. package/dist/src/evals/approval-prior.d.ts +58 -0
  45. package/dist/src/evals/approval-prior.d.ts.map +1 -0
  46. package/dist/src/evals/approval-prior.js +82 -0
  47. package/dist/src/evals/approval-prior.js.map +1 -0
  48. package/dist/src/evals/evaluate.d.ts +51 -0
  49. package/dist/src/evals/evaluate.d.ts.map +1 -0
  50. package/dist/src/evals/evaluate.js +76 -0
  51. package/dist/src/evals/evaluate.js.map +1 -0
  52. package/dist/src/evals/governance-sample-source.d.ts +23 -0
  53. package/dist/src/evals/governance-sample-source.d.ts.map +1 -0
  54. package/dist/src/evals/governance-sample-source.js +93 -0
  55. package/dist/src/evals/governance-sample-source.js.map +1 -0
  56. package/dist/src/evals/in-memory-score-store.d.ts +16 -0
  57. package/dist/src/evals/in-memory-score-store.d.ts.map +1 -0
  58. package/dist/src/evals/in-memory-score-store.js +57 -0
  59. package/dist/src/evals/in-memory-score-store.js.map +1 -0
  60. package/dist/src/evals/index.d.ts +15 -0
  61. package/dist/src/evals/index.d.ts.map +1 -0
  62. package/dist/src/evals/index.js +14 -0
  63. package/dist/src/evals/index.js.map +1 -0
  64. package/dist/src/evals/judge.d.ts +30 -0
  65. package/dist/src/evals/judge.d.ts.map +1 -0
  66. package/dist/src/evals/judge.js +53 -0
  67. package/dist/src/evals/judge.js.map +1 -0
  68. package/dist/src/evals/live-scoring.d.ts +42 -0
  69. package/dist/src/evals/live-scoring.d.ts.map +1 -0
  70. package/dist/src/evals/live-scoring.js +103 -0
  71. package/dist/src/evals/live-scoring.js.map +1 -0
  72. package/dist/src/evals/sample-source.d.ts +40 -0
  73. package/dist/src/evals/sample-source.d.ts.map +1 -0
  74. package/dist/src/evals/sample-source.js +33 -0
  75. package/dist/src/evals/sample-source.js.map +1 -0
  76. package/dist/src/evals/score-store.d.ts +54 -0
  77. package/dist/src/evals/score-store.d.ts.map +1 -0
  78. package/dist/src/evals/score-store.js +2 -0
  79. package/dist/src/evals/score-store.js.map +1 -0
  80. package/dist/src/evals/scorers/answer-relevancy.scorer.d.ts +28 -0
  81. package/dist/src/evals/scorers/answer-relevancy.scorer.d.ts.map +1 -0
  82. package/dist/src/evals/scorers/answer-relevancy.scorer.js +42 -0
  83. package/dist/src/evals/scorers/answer-relevancy.scorer.js.map +1 -0
  84. package/dist/src/evals/scorers/approval-outcome.scorer.d.ts +22 -0
  85. package/dist/src/evals/scorers/approval-outcome.scorer.d.ts.map +1 -0
  86. package/dist/src/evals/scorers/approval-outcome.scorer.js +60 -0
  87. package/dist/src/evals/scorers/approval-outcome.scorer.js.map +1 -0
  88. package/dist/src/evals/scorers/approval-risk.scorer.d.ts +28 -0
  89. package/dist/src/evals/scorers/approval-risk.scorer.d.ts.map +1 -0
  90. package/dist/src/evals/scorers/approval-risk.scorer.js +54 -0
  91. package/dist/src/evals/scorers/approval-risk.scorer.js.map +1 -0
  92. package/dist/src/evals/scorers/run-completion.scorer.d.ts +18 -0
  93. package/dist/src/evals/scorers/run-completion.scorer.d.ts.map +1 -0
  94. package/dist/src/evals/scorers/run-completion.scorer.js +55 -0
  95. package/dist/src/evals/scorers/run-completion.scorer.js.map +1 -0
  96. package/dist/src/evals/summarize.d.ts +44 -0
  97. package/dist/src/evals/summarize.d.ts.map +1 -0
  98. package/dist/src/evals/summarize.js +87 -0
  99. package/dist/src/evals/summarize.js.map +1 -0
  100. package/dist/src/evals/types.d.ts +81 -0
  101. package/dist/src/evals/types.d.ts.map +1 -0
  102. package/dist/src/evals/types.js +15 -0
  103. package/dist/src/evals/types.js.map +1 -0
  104. package/dist/src/history-window.d.ts +50 -11
  105. package/dist/src/history-window.d.ts.map +1 -1
  106. package/dist/src/history-window.js +84 -12
  107. package/dist/src/history-window.js.map +1 -1
  108. package/dist/src/index.d.ts +9 -2
  109. package/dist/src/index.d.ts.map +1 -1
  110. package/dist/src/index.js +9 -2
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/mcp/server.d.ts +8 -0
  113. package/dist/src/mcp/server.d.ts.map +1 -1
  114. package/dist/src/mcp/server.js +27 -1
  115. package/dist/src/mcp/server.js.map +1 -1
  116. package/dist/src/mcp-client/importer.d.ts +75 -0
  117. package/dist/src/mcp-client/importer.d.ts.map +1 -0
  118. package/dist/src/mcp-client/importer.js +161 -0
  119. package/dist/src/mcp-client/importer.js.map +1 -0
  120. package/dist/src/mcp-client/index.d.ts +9 -0
  121. package/dist/src/mcp-client/index.d.ts.map +1 -0
  122. package/dist/src/mcp-client/index.js +8 -0
  123. package/dist/src/mcp-client/index.js.map +1 -0
  124. package/dist/src/mcp-client/options.d.ts +99 -0
  125. package/dist/src/mcp-client/options.d.ts.map +1 -0
  126. package/dist/src/mcp-client/options.js +2 -0
  127. package/dist/src/mcp-client/options.js.map +1 -0
  128. package/dist/src/mcp-client/tool-input.d.ts +39 -0
  129. package/dist/src/mcp-client/tool-input.d.ts.map +1 -0
  130. package/dist/src/mcp-client/tool-input.js +61 -0
  131. package/dist/src/mcp-client/tool-input.js.map +1 -0
  132. package/dist/src/mcp-client/tool-kind.d.ts +37 -0
  133. package/dist/src/mcp-client/tool-kind.d.ts.map +1 -0
  134. package/dist/src/mcp-client/tool-kind.js +20 -0
  135. package/dist/src/mcp-client/tool-kind.js.map +1 -0
  136. package/dist/src/mcp-client/tool-name.d.ts +22 -0
  137. package/dist/src/mcp-client/tool-name.d.ts.map +1 -0
  138. package/dist/src/mcp-client/tool-name.js +35 -0
  139. package/dist/src/mcp-client/tool-name.js.map +1 -0
  140. package/dist/src/mcp-client/tool-source.d.ts +75 -0
  141. package/dist/src/mcp-client/tool-source.d.ts.map +1 -0
  142. package/dist/src/mcp-client/tool-source.js +244 -0
  143. package/dist/src/mcp-client/tool-source.js.map +1 -0
  144. package/dist/src/mcp-client/transient.d.ts +28 -0
  145. package/dist/src/mcp-client/transient.d.ts.map +1 -0
  146. package/dist/src/mcp-client/transient.js +126 -0
  147. package/dist/src/mcp-client/transient.js.map +1 -0
  148. package/dist/src/mcp-client/unsafe-regex.d.ts +23 -0
  149. package/dist/src/mcp-client/unsafe-regex.d.ts.map +1 -0
  150. package/dist/src/mcp-client/unsafe-regex.js +194 -0
  151. package/dist/src/mcp-client/unsafe-regex.js.map +1 -0
  152. package/dist/src/memory.d.ts +448 -0
  153. package/dist/src/memory.d.ts.map +1 -0
  154. package/dist/src/memory.js +338 -0
  155. package/dist/src/memory.js.map +1 -0
  156. package/dist/src/processors.d.ts +134 -0
  157. package/dist/src/processors.d.ts.map +1 -0
  158. package/dist/src/processors.js +215 -0
  159. package/dist/src/processors.js.map +1 -0
  160. package/dist/src/rag/index.d.ts +1 -1
  161. package/dist/src/rag/index.d.ts.map +1 -1
  162. package/dist/src/rag/index.js +1 -1
  163. package/dist/src/rag/index.js.map +1 -1
  164. package/dist/src/rag/pg-vector-store.d.ts +41 -0
  165. package/dist/src/rag/pg-vector-store.d.ts.map +1 -1
  166. package/dist/src/rag/pg-vector-store.js +93 -15
  167. package/dist/src/rag/pg-vector-store.js.map +1 -1
  168. package/dist/src/replay-integrity.d.ts +17 -0
  169. package/dist/src/replay-integrity.d.ts.map +1 -0
  170. package/dist/src/replay-integrity.js +19 -0
  171. package/dist/src/replay-integrity.js.map +1 -0
  172. package/dist/src/runners/inline-agent-runner.d.ts +33 -7
  173. package/dist/src/runners/inline-agent-runner.d.ts.map +1 -1
  174. package/dist/src/runners/inline-agent-runner.js +113 -27
  175. package/dist/src/runners/inline-agent-runner.js.map +1 -1
  176. package/dist/src/skills.d.ts +291 -0
  177. package/dist/src/skills.d.ts.map +1 -0
  178. package/dist/src/skills.js +0 -0
  179. package/dist/src/skills.js.map +1 -0
  180. package/dist/src/spi/agent-runner.d.ts +20 -6
  181. package/dist/src/spi/agent-runner.d.ts.map +1 -1
  182. package/dist/src/spi/agent-store.d.ts +53 -0
  183. package/dist/src/spi/agent-store.d.ts.map +1 -1
  184. package/dist/src/spi/governance-queries.d.ts +5 -0
  185. package/dist/src/spi/governance-queries.d.ts.map +1 -1
  186. package/dist/src/spi/history-window.d.ts +64 -10
  187. package/dist/src/spi/history-window.d.ts.map +1 -1
  188. package/dist/src/spi/model-provider.d.ts +18 -0
  189. package/dist/src/spi/model-provider.d.ts.map +1 -1
  190. package/dist/src/spi/processors.d.ts +161 -0
  191. package/dist/src/spi/processors.d.ts.map +1 -0
  192. package/dist/src/spi/processors.js +57 -0
  193. package/dist/src/spi/processors.js.map +1 -0
  194. package/dist/src/spi/token-stream-sink.d.ts +43 -0
  195. package/dist/src/spi/token-stream-sink.d.ts.map +1 -1
  196. package/dist/src/spi/token-stream-sink.js +17 -1
  197. package/dist/src/spi/token-stream-sink.js.map +1 -1
  198. package/dist/src/sse.d.ts +5 -2
  199. package/dist/src/sse.d.ts.map +1 -1
  200. package/dist/src/sse.js +11 -2
  201. package/dist/src/sse.js.map +1 -1
  202. package/dist/src/stores/lucid-governance-queries.d.ts.map +1 -1
  203. package/dist/src/stores/lucid-governance-queries.js +3 -0
  204. package/dist/src/stores/lucid-governance-queries.js.map +1 -1
  205. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  206. package/dist/src/stores/lucid-schema.js +15 -0
  207. package/dist/src/stores/lucid-schema.js.map +1 -1
  208. package/dist/src/stores/lucid.d.ts +11 -3
  209. package/dist/src/stores/lucid.d.ts.map +1 -1
  210. package/dist/src/stores/lucid.js +65 -0
  211. package/dist/src/stores/lucid.js.map +1 -1
  212. package/dist/src/structured-output.d.ts +57 -0
  213. package/dist/src/structured-output.d.ts.map +1 -0
  214. package/dist/src/structured-output.js +80 -0
  215. package/dist/src/structured-output.js.map +1 -0
  216. package/dist/src/testing/fake-model-provider.d.ts +8 -4
  217. package/dist/src/testing/fake-model-provider.d.ts.map +1 -1
  218. package/dist/src/testing/fake-model-provider.js +6 -9
  219. package/dist/src/testing/fake-model-provider.js.map +1 -1
  220. package/dist/src/testing/in-memory-governance-queries.d.ts.map +1 -1
  221. package/dist/src/testing/in-memory-governance-queries.js +1 -0
  222. package/dist/src/testing/in-memory-governance-queries.js.map +1 -1
  223. package/dist/src/testing/in-memory-store.d.ts +4 -3
  224. package/dist/src/testing/in-memory-store.d.ts.map +1 -1
  225. package/dist/src/testing/in-memory-store.js +13 -7
  226. package/dist/src/testing/in-memory-store.js.map +1 -1
  227. package/dist/src/testing/index.d.ts +1 -1
  228. package/dist/src/testing/index.d.ts.map +1 -1
  229. package/dist/src/testing/index.js.map +1 -1
  230. package/dist/src/tool-registry.d.ts +9 -0
  231. package/dist/src/tool-registry.d.ts.map +1 -1
  232. package/dist/src/tool-registry.js +11 -0
  233. package/dist/src/tool-registry.js.map +1 -1
  234. package/dist/src/types.d.ts +70 -2
  235. package/dist/src/types.d.ts.map +1 -1
  236. package/package.json +38 -24
  237. package/skills/agent-personas-agents/SKILL.md +16 -12
  238. package/dist/assets/spa/assets/index-3Q2m5_Ax.js +0 -9
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Running the processor chains, and the stream buffering an output gate requires. See
3
+ * `./spi/processors.ts` for the seams themselves and the boundary against `HistoryWindow`.
4
+ */
5
+ import { DEFAULT_INCREMENTAL_LOOKBACK_CHARS, ProcessorFailedError, } from './spi/processors.js';
6
+ export function createFrameBuffer() {
7
+ const frames = [];
8
+ return {
9
+ writer: {
10
+ write: (frame) => {
11
+ frames.push(frame);
12
+ },
13
+ end: () => { },
14
+ },
15
+ frames: () => frames,
16
+ };
17
+ }
18
+ /**
19
+ * The frames a passed gate releases to the live stream: the held ones, with every text frame
20
+ * collapsed into ONE carrying `text` — the answer as the chain left it, which is the only version
21
+ * anything downstream is allowed to see. The substitution happens in place, so the answer keeps its
22
+ * position relative to any non-text frame the provider interleaved with it.
23
+ */
24
+ export function releaseGatedFrames(args) {
25
+ const { frames, text } = args;
26
+ const released = [];
27
+ let emitted = false;
28
+ for (const frame of frames) {
29
+ if (frame.t === 'text') {
30
+ if (!emitted && text.length > 0) {
31
+ released.push({ t: 'text', v: text });
32
+ emitted = true;
33
+ }
34
+ continue;
35
+ }
36
+ released.push(frame);
37
+ }
38
+ if (!emitted && text.length > 0) {
39
+ released.push({ t: 'text', v: text });
40
+ }
41
+ return released;
42
+ }
43
+ /**
44
+ * Fold the prompt through each processor in order, every one seeing what the previous one produced.
45
+ * A throw is wrapped so it cannot read as the model call failing — see {@link ProcessorFailedError}.
46
+ */
47
+ export async function runInputProcessors(args) {
48
+ let current = args.prompt;
49
+ for (const processor of args.processors) {
50
+ try {
51
+ current = await processor.process(current, args.ctx);
52
+ }
53
+ catch (error) {
54
+ throw new ProcessorFailedError('input', processor.name, error);
55
+ }
56
+ }
57
+ return current;
58
+ }
59
+ /**
60
+ * Fold the answer through each processor in order. The FIRST rejection ends the chain: a later
61
+ * processor has nothing to add about text that is never going anywhere, and running it would bill a
62
+ * moderation call for a turn already refused.
63
+ */
64
+ export async function runOutputProcessors(args) {
65
+ const { processors, answer, ctx } = args;
66
+ let text = answer.text;
67
+ for (const processor of processors) {
68
+ let verdict;
69
+ try {
70
+ verdict = await processor.process({ text, toolCalls: answer.toolCalls }, ctx);
71
+ }
72
+ catch (error) {
73
+ throw new ProcessorFailedError('output', processor.name, error);
74
+ }
75
+ if (verdict.action === 'reject') {
76
+ return { text, rejection: { processor: processor.name, reason: verdict.reason } };
77
+ }
78
+ if (verdict.action === 'replace') {
79
+ text = verdict.text;
80
+ }
81
+ }
82
+ return { text };
83
+ }
84
+ /**
85
+ * ALL or nothing: one undeclared processor puts the whole chain on the whole-answer path. Its author
86
+ * wrote `process` against the complete text, and a chain that ran it on a prefix because a neighbour
87
+ * opted in would be handing it an input it never agreed to read.
88
+ */
89
+ export function resolveOutputGateMode(processors) {
90
+ if (processors.length === 0) {
91
+ return 'off';
92
+ }
93
+ return processors.every((processor) => processor.incremental !== undefined)
94
+ ? 'incremental'
95
+ : 'whole';
96
+ }
97
+ /**
98
+ * The chain's window is the WIDEST any member asked for: a release safe for the shortest-sighted
99
+ * processor is not safe for the one that matches longer patterns, and the gate makes one release
100
+ * decision for all of them.
101
+ *
102
+ * An undeclared processor contributes nothing rather than the default — it has no window, because a
103
+ * chain containing one never reaches the incremental path at all.
104
+ */
105
+ export function resolveGateLookback(processors) {
106
+ let lookback = 0;
107
+ for (const processor of processors) {
108
+ if (processor.incremental !== undefined) {
109
+ lookback = Math.max(lookback, processor.incremental.lookbackChars ?? DEFAULT_INCREMENTAL_LOOKBACK_CHARS);
110
+ }
111
+ }
112
+ return lookback;
113
+ }
114
+ /**
115
+ * Releases a model call's answer to `writer` as it arrives, holding back the last `lookbackChars`
116
+ * characters of what the chain produces so a processor can still change them.
117
+ *
118
+ * The chain runs over the whole PREFIX accumulated so far rather than over each new frame, so a
119
+ * processor always sees well-formed text and never has to reassemble a pattern split across frames —
120
+ * which is what makes {@link import('./spi/processors.js').IncrementalGating}'s promise a claim
121
+ * about prefixes. It runs once per streamed text frame.
122
+ *
123
+ * Only an EXTENSION of what the reader already has is ever written: a chain whose output stops
124
+ * agreeing with its earlier output has broken its promise, and the loop's whole-answer pass reports
125
+ * that rather than this gate papering over it by re-sending a different answer.
126
+ *
127
+ * Frames that are not text are forwarded live, in arrival order — they are not the answer, so the
128
+ * gate does not own them.
129
+ */
130
+ export function createIncrementalGate(args) {
131
+ const { processors, ctx, lookbackChars, writer } = args;
132
+ let raw = '';
133
+ let released = '';
134
+ let rejection;
135
+ /** A prefix the chain could not rule on. Text stops flowing; the whole-answer pass decides. */
136
+ let stalled = false;
137
+ // The model is free to write without awaiting, and a verdict is asynchronous — serialize, or two
138
+ // prefixes race and the reader gets the answer out of order.
139
+ let queue = Promise.resolve();
140
+ async function advance() {
141
+ if (raw.length === 0) {
142
+ return;
143
+ }
144
+ let settled;
145
+ try {
146
+ settled = await runOutputProcessors({
147
+ processors,
148
+ answer: { text: raw, toolCalls: [] },
149
+ ctx,
150
+ });
151
+ }
152
+ catch {
153
+ // Swallowed HERE only: a prefix pass is an early release, not the verdict. The whole-answer
154
+ // pass runs the same chain and surfaces the failure with the processor's name on it.
155
+ stalled = true;
156
+ return;
157
+ }
158
+ if (settled.rejection !== undefined) {
159
+ rejection = settled.rejection;
160
+ return;
161
+ }
162
+ // The window is trimmed off the chain's OUTPUT, not off the text fed to it: a processor that
163
+ // only saw `raw` minus a tail could not match a pattern straddling that cut, and would release
164
+ // the very text it exists to rewrite.
165
+ const candidate = settled.text.slice(0, Math.max(0, settled.text.length - lookbackChars));
166
+ if (candidate.length <= released.length || !candidate.startsWith(released)) {
167
+ return;
168
+ }
169
+ const delta = candidate.slice(released.length);
170
+ released = candidate;
171
+ await writer.write({ t: 'text', v: delta });
172
+ }
173
+ async function handle(frame) {
174
+ if (rejection !== undefined) {
175
+ return;
176
+ }
177
+ if (frame.t === 'text') {
178
+ raw += frame.v;
179
+ if (!stalled) {
180
+ await advance();
181
+ }
182
+ return;
183
+ }
184
+ await writer.write(frame);
185
+ }
186
+ return {
187
+ writer: {
188
+ write: (frame) => {
189
+ queue = queue.then(() => handle(frame));
190
+ return queue;
191
+ },
192
+ end: () => { },
193
+ },
194
+ settled: () => queue,
195
+ released: () => released,
196
+ rejection: () => rejection,
197
+ };
198
+ }
199
+ /**
200
+ * The tail an incremental gate still owes the reader once the whole-answer pass has settled: the
201
+ * authoritative text minus the prefix already released.
202
+ *
203
+ * Throws when the settled answer is not an extension of that prefix. That check is the reason the
204
+ * final pass stays authoritative for both the stream and the store rather than the stream being
205
+ * stitched together from per-prefix results: agreement between what was streamed and what was stored
206
+ * becomes structural instead of assumed.
207
+ */
208
+ export function gateTail(args) {
209
+ const { processors, released, text } = args;
210
+ if (!text.startsWith(released)) {
211
+ throw new ProcessorFailedError('output', processors.map((processor) => processor.name).join(' → '), new Error(`the gated answer is not an extension of the ${released.length} characters this chain already released — a processor that declares "incremental" promises its result on a prefix stays a prefix of its result on the whole answer, outside the last lookbackChars`));
212
+ }
213
+ return text.slice(released.length);
214
+ }
215
+ //# sourceMappingURL=processors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processors.js","sourceRoot":"","sources":["../../src/processors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,kCAAkC,EAOlC,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAiB7B,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,OAAO;QACL,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;YACD,GAAG,EAAE,GAAG,EAAE,GAAE,CAAC;SACd;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;KACrB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAGlC;IACC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC9B,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBACtC,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;YACD,SAAS;QACX,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC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oMAAoM,CACnQ,CACF,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"}
@@ -5,7 +5,7 @@ export { HybridRetriever, type HybridRetrieverOptions } from './hybrid-retriever
5
5
  export { type ChunkRecord, chunkDocuments, type IngestChunksOptions, type IngestDocument, type IngestOptions, ingestChunks, ingestDocuments, } from './ingest.js';
6
6
  export { KeywordRetriever, type KeywordRetrieverOptions } from './keyword-retriever.js';
7
7
  export { cosineSimilarity, MemoryVectorStore } from './memory-vector-store.js';
8
- export { type PgVectorColumns, type PgVectorMetric, PgVectorRetriever, PgVectorStore, type PgVectorStoreOptions, toVectorLiteral, } from './pg-vector-store.js';
8
+ export { type PgVectorColumns, type PgVectorMetric, PgVectorRetriever, PgVectorStore, type PgVectorStoreOptions, stripNulBytes, toVectorLiteral, } from './pg-vector-store.js';
9
9
  export { RerankingRetriever, type RerankingRetrieverOptions, } from './reranking-retriever.js';
10
10
  export { applyMetadataPatch, assertRemovalFilter, documentIdOf, effectivePatchKeys, filterDeniesAll, type IndexedDocument, type MetadataPatch, UnsafeRemovalError, type VectorRecord, type VectorSearchOptions, type VectorStore, } from './vector-store.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EACL,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,YAAY,E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AK,cAAc,EACnB,iBAAiB,EACjB,aAAa,EACb,KAAK,oBAAoB,EACzB,aAAa,EACb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC"}
@@ -5,7 +5,7 @@ export { HybridRetriever } from './hybrid-retriever.js';
5
5
  export { chunkDocuments, ingestChunks, ingestDocuments, } from './ingest.js';
6
6
  export { KeywordRetriever } from './keyword-retriever.js';
7
7
  export { cosineSimilarity, MemoryVectorStore } from './memory-vector-store.js';
8
- export { PgVectorRetriever, PgVectorStore, toVectorLiteral, } from './pg-vector-store.js';
8
+ export { PgVectorRetriever, PgVectorStore, stripNulBytes, toVectorLiteral, } from './pg-vector-store.js';
9
9
  export { RerankingRetriever, } from './reranking-retriever.js';
10
10
  export { applyMetadataPatch, assertRemovalFilter, documentIdOf, effectivePatchKeys, filterDeniesAll, UnsafeRemovalError, } from './vector-store.js';
11
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAA+B,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAEL,cAAc,EAId,YAAY,EACZ,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAgC,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAGL,iBAAiB,EACjB,aAAa,EAEb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,GAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAGf,kBAAkB,GAInB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAA+B,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAEL,cAAc,EAId,YAAY,EACZ,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAgC,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAGL,iBAAiB,EACjB,aAAa,EAEb,aAAa,EACb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,GAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAGf,kBAAkB,GAInB,MAAM,mBAAmB,CAAC"}
@@ -39,6 +39,29 @@ export interface PgVectorStoreOptions {
39
39
  }
40
40
  /** pgvector accepts a `'[1,2,3]'` text literal cast to `vector`; the literal itself is a `?` binding. */
41
41
  export declare function toVectorLiteral(embedding: number[]): string;
42
+ /**
43
+ * Strip every NUL byte (`0x00`) from a value before it can reach a Postgres `text`/`jsonb` binding.
44
+ * Postgres rejects `0x00` in those types outright (`invalid byte sequence for encoding "UTF8": 0x00`),
45
+ * while source systems like Qdrant accept it — so text extracted from PDFs that happens to carry a stray
46
+ * NUL byte works fine right up until it is written to pgvector. Strings have the byte removed (the rest
47
+ * of the text is kept intact); arrays and PLAIN objects are walked recursively, including object KEYS
48
+ * (a NUL in a metadata key would otherwise reach `JSON.stringify` and then Postgres just the same); every
49
+ * other value (numbers, booleans, `null`, `undefined`, embeddings, a `Date`, a class instance, a
50
+ * `Buffer`, …) passes through unchanged, by reference.
51
+ *
52
+ * Two things a naive `for...in` + assignment walk gets wrong, both handled here:
53
+ *
54
+ * - **Only plain objects are walked.** The check is `Object.getPrototypeOf(v) === Object.prototype ||
55
+ * === null`, never `typeof v === 'object'` alone — a `Date`, a class instance, a `Buffer`, … would
56
+ * otherwise be torn down into a plain `{}` of its enumerable own properties, silently losing its
57
+ * prototype (and, for a `Date`, every method on it).
58
+ * - **The result is built with `Object.fromEntries`, never `result[key] = value` on a fresh `{}`.** A
59
+ * metadata key literally named `__proto__`, assigned that way, does not create an own property — it
60
+ * hits the inherited `Object.prototype` accessor instead, which (for the ordinary case, a string
61
+ * value) silently no-ops, so the key is dropped rather than round-tripped. `Object.fromEntries` uses
62
+ * `CreateDataProperty` under the hood, which always creates a real own property, `__proto__` included.
63
+ */
64
+ export declare function stripNulBytes<T>(value: T): T;
42
65
  /**
43
66
  * A pgvector-backed {@link VectorStore} — the production RAG adapter, the durable twin of
44
67
  * {@link import('./memory-vector-store.js').MemoryVectorStore}. It runs over the structural
@@ -69,7 +92,20 @@ export declare class PgVectorStore implements VectorStore {
69
92
  ensureSchema(): Promise<void>;
70
93
  /** The `CREATE EXTENSION` / `CREATE TABLE` / `CREATE INDEX` statements {@link ensureSchema} issues. */
71
94
  schemaStatements(): string[];
95
+ /**
96
+ * Every `text`/`jsonb` binding (id, text, source, metadata — including nested metadata values, array
97
+ * items and object keys) is run through {@link stripNulBytes} first: Postgres rejects the NUL byte
98
+ * (`0x00`) in `text`/`jsonb` outright, while upstream sources (PDF extraction, Qdrant) happily carry
99
+ * it, so an unstripped chunk would otherwise fail this INSERT with `invalid byte sequence for encoding
100
+ * "UTF8": 0x00`. The embedding is untouched — it is never text/jsonb.
101
+ */
72
102
  upsert(records: VectorRecord[]): Promise<void>;
103
+ /**
104
+ * `documentId` is run through {@link stripNulBytes} before binding — the stored `id` column never
105
+ * carries a NUL byte (it went through the same stripping on `upsert`), so a raw NUL in the lookup
106
+ * value could only ever fail to match; stripping it here keeps the lookup consistent with the data
107
+ * instead of trusting a caller-supplied string to already be clean.
108
+ */
73
109
  remove(documentId: string): Promise<void>;
74
110
  /**
75
111
  * {@link VectorStore.updateMetadata} — one `UPDATE` for the whole document, with the
@@ -84,6 +120,11 @@ export declare class PgVectorStore implements VectorStore {
84
120
  * pgvector never re-parses a vector literal either.
85
121
  *
86
122
  * `RETURNING` the id column yields the chunk count without a second query.
123
+ *
124
+ * The patch is run through {@link stripNulBytes} first (values AND keys) for the same reason as
125
+ * {@link PgVectorStore.upsert}: Postgres rejects the NUL byte (`0x00`) in `jsonb`, so an unstripped
126
+ * value or key would otherwise fail this `UPDATE`. `documentId` is stripped too, for the same
127
+ * lookup-consistency reason as {@link PgVectorStore.remove}.
87
128
  */
88
129
  updateMetadata(documentId: string, patch: MetadataPatch): Promise<number>;
89
130
  listDocuments(filter?: Record<string, unknown>): Promise<IndexedDocument[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"pg-vector-store.d.ts","sourceRoot":"","sources":["../../../src/rag/pg-vector-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,kBAAkB,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export function toVectorLiteral(embedding) {
38
38
  return `[${embedding.join(',')}]`;
39
39
  }
40
+ /**
41
+ * Strip every NUL byte (`0x00`) from a value before it can reach a Postgres `text`/`jsonb` binding.
42
+ * Postgres rejects `0x00` in those types outright (`invalid byte sequence for encoding "UTF8": 0x00`),
43
+ * while source systems like Qdrant accept it — so text extracted from PDFs that happens to carry a stray
44
+ * NUL byte works fine right up until it is written to pgvector. Strings have the byte removed (the rest
45
+ * of the text is kept intact); arrays and PLAIN objects are walked recursively, including object KEYS
46
+ * (a NUL in a metadata key would otherwise reach `JSON.stringify` and then Postgres just the same); every
47
+ * other value (numbers, booleans, `null`, `undefined`, embeddings, a `Date`, a class instance, a
48
+ * `Buffer`, …) passes through unchanged, by reference.
49
+ *
50
+ * Two things a naive `for...in` + assignment walk gets wrong, both handled here:
51
+ *
52
+ * - **Only plain objects are walked.** The check is `Object.getPrototypeOf(v) === Object.prototype ||
53
+ * === null`, never `typeof v === 'object'` alone — a `Date`, a class instance, a `Buffer`, … would
54
+ * otherwise be torn down into a plain `{}` of its enumerable own properties, silently losing its
55
+ * prototype (and, for a `Date`, every method on it).
56
+ * - **The result is built with `Object.fromEntries`, never `result[key] = value` on a fresh `{}`.** A
57
+ * metadata key literally named `__proto__`, assigned that way, does not create an own property — it
58
+ * hits the inherited `Object.prototype` accessor instead, which (for the ordinary case, a string
59
+ * value) silently no-ops, so the key is dropped rather than round-tripped. `Object.fromEntries` uses
60
+ * `CreateDataProperty` under the hood, which always creates a real own property, `__proto__` included.
61
+ */
62
+ export function stripNulBytes(value) {
63
+ if (typeof value === 'string') {
64
+ // split/join rather than a regex literal -- a bare NUL inside a RegExp trips biome's
65
+ // noControlCharactersInRegex lint, and split/join needs no escaping at all.
66
+ return value.split('\u0000').join('');
67
+ }
68
+ if (Array.isArray(value)) {
69
+ return value.map((item) => stripNulBytes(item));
70
+ }
71
+ if (value !== null && typeof value === 'object') {
72
+ const proto = Object.getPrototypeOf(value);
73
+ if (proto !== Object.prototype && proto !== null) {
74
+ // Not a plain object -- a Date, a class instance, a Buffer, a Map, ... -- leave it exactly as is.
75
+ return value;
76
+ }
77
+ return Object.fromEntries(Object.entries(value).map(([key, val]) => [
78
+ stripNulBytes(key),
79
+ stripNulBytes(val),
80
+ ]));
81
+ }
82
+ return value;
83
+ }
40
84
  /**
41
85
  * Build the metadata `WHERE` fragment for a filter, using Lucid/Knex positional `?` bindings (never
42
86
  * string interpolation). Two predicate kinds:
@@ -52,6 +96,11 @@ export function toVectorLiteral(embedding) {
52
96
  * binding (`metadata->?`), so a caller-supplied key can never inject SQL; only the (already validated)
53
97
  * table/column identifiers are ever spliced in. Returns `{ sql: '', bindings: [] }` when there is no
54
98
  * filter, preserving the previous unfiltered query shape.
99
+ *
100
+ * Every binding built here — the key, the scalar containment JSON, each array token — is run through
101
+ * {@link stripNulBytes} first, the same as every write path: a filter key or value can carry a NUL byte
102
+ * just as easily as stored text can, Postgres rejects it here exactly as it would on a write, and
103
+ * stripping it here keeps a filter lookup consistent with the already-stripped data it is matched against.
55
104
  */
56
105
  function buildMetadataWhere(filter, metadataColumn) {
57
106
  if (filter === undefined || Object.keys(filter).length === 0) {
@@ -59,8 +108,14 @@ function buildMetadataWhere(filter, metadataColumn) {
59
108
  }
60
109
  const clauses = [];
61
110
  const bindings = [];
62
- const scalar = {};
111
+ // Accumulated as [key, value] pairs, not `scalar[cleanKey] = value` on a fresh `{}` -- a filter key
112
+ // literally named `__proto__` would otherwise hit the inherited `Object.prototype` accessor instead
113
+ // of creating an own property, and (for the ordinary case, a non-object value) that setter silently
114
+ // no-ops, dropping the key before it ever reaches `JSON.stringify`. `Object.fromEntries` below builds
115
+ // the object with `CreateDataProperty`, the same fix {@link stripNulBytes} makes for its own walk.
116
+ const scalarEntries = [];
63
117
  for (const [key, value] of Object.entries(filter)) {
118
+ const cleanKey = stripNulBytes(key);
64
119
  if (Array.isArray(value)) {
65
120
  if (value.length === 0) {
66
121
  clauses.push('false');
@@ -70,15 +125,15 @@ function buildMetadataWhere(filter, metadataColumn) {
70
125
  // membership works uniformly, then test overlap with the caller's tokens.
71
126
  clauses.push(`jsonb_exists_any(CASE WHEN jsonb_typeof(${metadataColumn}->?) = 'array' ` +
72
127
  `THEN ${metadataColumn}->? ELSE jsonb_build_array(${metadataColumn}->?) END, ?::text[])`);
73
- bindings.push(key, key, key, value.map(String));
128
+ bindings.push(cleanKey, cleanKey, cleanKey, value.map((token) => stripNulBytes(String(token))));
74
129
  }
75
130
  else {
76
- scalar[key] = value;
131
+ scalarEntries.push([cleanKey, value]);
77
132
  }
78
133
  }
79
- if (Object.keys(scalar).length > 0) {
134
+ if (scalarEntries.length > 0) {
80
135
  clauses.push(`${metadataColumn} @> ?::jsonb`);
81
- bindings.push(JSON.stringify(scalar));
136
+ bindings.push(JSON.stringify(stripNulBytes(Object.fromEntries(scalarEntries))));
82
137
  }
83
138
  return { sql: `WHERE ${clauses.join(' AND ')}`, bindings };
84
139
  }
@@ -181,6 +236,13 @@ export class PgVectorStore {
181
236
  ON ${this.table} USING hnsw (${c.embedding} ${this.metric.opclass})`,
182
237
  ];
183
238
  }
239
+ /**
240
+ * Every `text`/`jsonb` binding (id, text, source, metadata — including nested metadata values, array
241
+ * items and object keys) is run through {@link stripNulBytes} first: Postgres rejects the NUL byte
242
+ * (`0x00`) in `text`/`jsonb` outright, while upstream sources (PDF extraction, Qdrant) happily carry
243
+ * it, so an unstripped chunk would otherwise fail this INSERT with `invalid byte sequence for encoding
244
+ * "UTF8": 0x00`. The embedding is untouched — it is never text/jsonb.
245
+ */
184
246
  async upsert(records) {
185
247
  const c = this.col;
186
248
  for (const record of records) {
@@ -191,17 +253,23 @@ export class PgVectorStore {
191
253
  ${c.source} = EXCLUDED.${c.source},
192
254
  ${c.metadata} = EXCLUDED.${c.metadata},
193
255
  ${c.embedding} = EXCLUDED.${c.embedding}`, [
194
- record.id,
195
- record.text,
196
- record.source ?? null,
197
- record.metadata !== undefined ? JSON.stringify(record.metadata) : null,
256
+ stripNulBytes(record.id),
257
+ stripNulBytes(record.text),
258
+ stripNulBytes(record.source ?? null),
259
+ record.metadata !== undefined ? JSON.stringify(stripNulBytes(record.metadata)) : null,
198
260
  toVectorLiteral(record.embedding),
199
261
  ]);
200
262
  }
201
263
  }
264
+ /**
265
+ * `documentId` is run through {@link stripNulBytes} before binding — the stored `id` column never
266
+ * carries a NUL byte (it went through the same stripping on `upsert`), so a raw NUL in the lookup
267
+ * value could only ever fail to match; stripping it here keeps the lookup consistent with the data
268
+ * instead of trusting a caller-supplied string to already be clean.
269
+ */
202
270
  async remove(documentId) {
203
271
  await this.db.rawQuery(`DELETE FROM ${this.table} WHERE ${documentIdExpr(this.col.id)} = ?`, [
204
- documentId,
272
+ stripNulBytes(documentId),
205
273
  ]);
206
274
  }
207
275
  /**
@@ -217,27 +285,37 @@ export class PgVectorStore {
217
285
  * pgvector never re-parses a vector literal either.
218
286
  *
219
287
  * `RETURNING` the id column yields the chunk count without a second query.
288
+ *
289
+ * The patch is run through {@link stripNulBytes} first (values AND keys) for the same reason as
290
+ * {@link PgVectorStore.upsert}: Postgres rejects the NUL byte (`0x00`) in `jsonb`, so an unstripped
291
+ * value or key would otherwise fail this `UPDATE`. `documentId` is stripped too, for the same
292
+ * lookup-consistency reason as {@link PgVectorStore.remove}.
220
293
  */
221
294
  async updateMetadata(documentId, patch) {
222
- const keys = effectivePatchKeys(patch);
295
+ const cleanPatch = stripNulBytes(patch);
296
+ const keys = effectivePatchKeys(cleanPatch);
223
297
  if (keys.length === 0) {
224
298
  return 0;
225
299
  }
226
- const set = {};
300
+ // Accumulated as [key, value] pairs, not `set[key] = cleanPatch[key]` on a fresh `{}` -- see the
301
+ // matching comment in `buildMetadataWhere`: a patch key literally named `__proto__` would otherwise
302
+ // be silently dropped by the inherited prototype setter instead of surviving as an own property.
303
+ const setEntries = [];
227
304
  const removed = [];
228
305
  for (const key of keys) {
229
- if (patch[key] === null) {
306
+ if (cleanPatch[key] === null) {
230
307
  removed.push(key);
231
308
  }
232
309
  else {
233
- set[key] = patch[key];
310
+ setEntries.push([key, cleanPatch[key]]);
234
311
  }
235
312
  }
313
+ const set = Object.fromEntries(setEntries);
236
314
  const c = this.col;
237
315
  const raw = await this.db.rawQuery(`UPDATE ${this.table}
238
316
  SET ${c.metadata} = (COALESCE(${c.metadata}, '{}'::jsonb) || ?::jsonb) - ?::text[]
239
317
  WHERE ${documentIdExpr(c.id)} = ?
240
- RETURNING ${c.id} AS id`, [JSON.stringify(set), removed, documentId]);
318
+ RETURNING ${c.id} AS id`, [JSON.stringify(set), removed, stripNulBytes(documentId)]);
241
319
  return normalizeRows(raw).length;
242
320
  }
243
321
  async listDocuments(filter) {
@@ -1 +1 @@
1
- {"version":3,"file":"pg-vector-store.js","sourceRoot":"","sources":["../../../src/rag/pg-vector-store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAqD7F,MAAM,OAAO,GAAuC;IAClD,MAAM,EAAE;QACN,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,mBAAmB;QAC5B,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,GAAG,iBAAiB;KAC7C;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,iBAAiB;KAC1C;IACD,KAAK,EAAE;QACL,kGAAkG;QAClG,iGAAiG;QACjG,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,iBAAiB;KAC1C;CACF,CAAC;AAEF,+GAA+G;AAC/G,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAE9C;;;;;GAKG;AACH,SAAS,gBAAgB,CA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;YAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;YAC1B,OAAO;gBACL,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;gBACtB,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;gBACxB,GAAG,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9E,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IACvD,kQAAkQ;IAClQ,YAAY,QAA2B,EAAE,KAAoB;QAC3D,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Is this the durable runtime refusing a checkpoint position, rather than anything the agent did?
3
+ *
4
+ * Matched by NAME, and by suffix, because `@adonis-agora/durable` raises the same contract under two
5
+ * class names: the in-process engine throws `NonDeterminismError` and the remote replay context
6
+ * throws `WorkflowNondeterminismError`. Same cross-runtime reasoning as the `isControlFlowError`
7
+ * hook, and as `isControlFlowSignal`'s name check, which exist for exactly this reason on the
8
+ * suspend path.
9
+ *
10
+ * Callers must let these through untouched. Every `catch` in a workflow body reacts by writing more
11
+ * checkpoints (a toolfail, a run-end), and on a journal that has already diverged each of those asks
12
+ * for a position the history cannot supply — so the recovery attempt raises its own refusal, and
13
+ * THAT is the error the operator reads: a message pointing at the wrong seq, naming checkpoints from
14
+ * the recovery path rather than the two that actually disagreed.
15
+ */
16
+ export declare function isReplayIntegrityError(error: unknown): boolean;
17
+ //# sourceMappingURL=replay-integrity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-integrity.d.ts","sourceRoot":"","sources":["../../src/replay-integrity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE9D"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Is this the durable runtime refusing a checkpoint position, rather than anything the agent did?
3
+ *
4
+ * Matched by NAME, and by suffix, because `@adonis-agora/durable` raises the same contract under two
5
+ * class names: the in-process engine throws `NonDeterminismError` and the remote replay context
6
+ * throws `WorkflowNondeterminismError`. Same cross-runtime reasoning as the `isControlFlowError`
7
+ * hook, and as `isControlFlowSignal`'s name check, which exist for exactly this reason on the
8
+ * suspend path.
9
+ *
10
+ * Callers must let these through untouched. Every `catch` in a workflow body reacts by writing more
11
+ * checkpoints (a toolfail, a run-end), and on a journal that has already diverged each of those asks
12
+ * for a position the history cannot supply — so the recovery attempt raises its own refusal, and
13
+ * THAT is the error the operator reads: a message pointing at the wrong seq, naming checkpoints from
14
+ * the recovery path rather than the two that actually disagreed.
15
+ */
16
+ export function isReplayIntegrityError(error) {
17
+ return error instanceof Error && error.name.toLowerCase().endsWith('nondeterminismerror');
18
+ }
19
+ //# sourceMappingURL=replay-integrity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-integrity.js","sourceRoot":"","sources":["../../src/replay-integrity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAC5F,CAAC"}