veryfront 0.1.873 → 0.1.874

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.873",
3
+ "version": "0.1.874",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1,12 +1,5 @@
1
1
  import type { AgUiRuntimeStreamEvent } from "../ag-ui/browser-encoder.js";
2
- /** Normalize provider tool input by removing transient empty-object prefixes. */
3
- export declare function stripLeadingEmptyObjectPlaceholder(rawArgs: string): string;
4
- /** Merge tool input delta helper. */
5
- export declare function mergeToolInputDelta(currentArguments: string, nextDelta: string): string;
6
- /** Input payload for merge tool call. */
7
- export declare function mergeToolCallInput(currentArguments: string, nextInput: string): string;
8
- /** Parses tool input object. */
9
- export declare function parseToolInputObject(input: unknown): Record<string, unknown>;
2
+ export { mergeToolCallInput, mergeToolInputDelta, parseToolInputObject, stripLeadingEmptyObjectPlaceholder, } from "./tool-input.js";
10
3
  /** Parses data stream sse events. */
11
4
  export declare function parseDataStreamSseEvents(chunk: string): {
12
5
  events: AgUiRuntimeStreamEvent[];
@@ -1 +1 @@
1
- {"version":3,"file":"data-stream.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/streaming/data-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAQ1E,iFAAiF;AACjF,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmB1E;AAwBD,qCAAqC;AACrC,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAuDvF;AAED,yCAAyC;AACzC,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAoBtF;AAED,gCAAgC;AAChC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiB5E;AAED,qCAAqC;AACrC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG;IACvD,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAoBA;AAED,wCAAwC;AACxC,wBAAuB,sBAAsB,CAC3C,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GACjC,cAAc,CAAC,sBAAsB,CAAC,CAsCxC"}
1
+ {"version":3,"file":"data-stream.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/streaming/data-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kCAAkC,GACnC,MAAM,iBAAiB,CAAC;AAIzB,qCAAqC;AACrC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG;IACvD,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAoBA;AAED,wCAAwC;AACxC,wBAAuB,sBAAsB,CAC3C,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GACjC,cAAc,CAAC,sBAAsB,CAAC,CAsCxC"}
@@ -1,130 +1,6 @@
1
1
  import { serverLogger } from "../../utils/index.js";
2
+ export { mergeToolCallInput, mergeToolInputDelta, parseToolInputObject, stripLeadingEmptyObjectPlaceholder, } from "./tool-input.js";
2
3
  const logger = serverLogger.component("agent-data-stream");
3
- function isRecord(value) {
4
- return typeof value === "object" && value !== null && !Array.isArray(value);
5
- }
6
- /** Normalize provider tool input by removing transient empty-object prefixes. */
7
- export function stripLeadingEmptyObjectPlaceholder(rawArgs) {
8
- let normalized = rawArgs.trim();
9
- while (normalized.startsWith("{}")) {
10
- const remainder = normalized.slice(2).trimStart();
11
- if (remainder.startsWith("{")) {
12
- normalized = remainder;
13
- continue;
14
- }
15
- if (remainder.startsWith('"')) {
16
- normalized = `{${remainder}`;
17
- continue;
18
- }
19
- break;
20
- }
21
- return normalized;
22
- }
23
- /**
24
- * Minimum overlap length at which `mergeToolInputDelta` will accept a
25
- * tail-overlap as an intentional retransmission from the provider and
26
- * dedup the leading chunk of the next delta.
27
- *
28
- * Empirically, overlaps of 1–3 characters are almost always coincidental
29
- * in streamed JSON (e.g. `"`, `,`, `":`, `,"`). Accepting them as dedup
30
- * causes silent character drops — the exact pathology observed in staging
31
- * on 2026-04-15 where `create_file` tool calls arrived at the classifier
32
- * with 2–5 chars missing from the middle of the buffer. Requiring at
33
- * least 4 chars of overlap makes false matches vanishingly unlikely while
34
- * still honoring the real "retransmitted content-suffix" case pinned by
35
- * the existing "overlapping suffix dedup" regression test (which relies
36
- * on a 6-char `Report` overlap).
37
- *
38
- * Similarly, short deltas (< 4 chars) are treated as append-mode
39
- * regardless of what they look like: a 1-char delta literally cannot
40
- * contain enough signal to distinguish retransmission from append, and
41
- * we will not silently drop it.
42
- */
43
- const MIN_OVERLAP_DEDUP_LENGTH = 4;
44
- /** Merge tool input delta helper. */
45
- export function mergeToolInputDelta(currentArguments, nextDelta) {
46
- const normalizedDelta = nextDelta.trimStart();
47
- const candidateDeltas = normalizedDelta.startsWith('"')
48
- ? [normalizedDelta, `{${normalizedDelta}`]
49
- : [normalizedDelta];
50
- if (currentArguments === "{}" || currentArguments.length === 0) {
51
- for (const candidate of candidateDeltas) {
52
- if (candidate.startsWith("{")) {
53
- return candidate;
54
- }
55
- }
56
- }
57
- if (nextDelta.length === 0) {
58
- return currentArguments;
59
- }
60
- if (currentArguments.length === 0) {
61
- return nextDelta;
62
- }
63
- // Short deltas are trusted as append-mode. Retransmission at this size
64
- // is indistinguishable from append and would produce more corruption
65
- // than it prevents — see MIN_OVERLAP_DEDUP_LENGTH.
66
- if (nextDelta.length < MIN_OVERLAP_DEDUP_LENGTH) {
67
- return currentArguments + nextDelta;
68
- }
69
- for (const candidate of candidateDeltas) {
70
- // Exact duplicate: the provider resent the same full buffer.
71
- if (candidate === currentArguments) {
72
- return currentArguments;
73
- }
74
- // Cumulative mode: the delta is a strict extension of the current
75
- // buffer and supersedes it verbatim.
76
- if (candidate.startsWith(currentArguments)) {
77
- return candidate;
78
- }
79
- // Tail retransmission: the provider resent a suffix of the current
80
- // buffer as the prefix of the new delta. Only accept overlaps of
81
- // MIN_OVERLAP_DEDUP_LENGTH or longer — trivial 1-3 char matches in
82
- // streamed JSON are overwhelmingly coincidental and deduping them
83
- // corrupts append-mode streams.
84
- const maxOverlap = Math.min(currentArguments.length, candidate.length);
85
- for (let overlap = maxOverlap; overlap >= MIN_OVERLAP_DEDUP_LENGTH; overlap--) {
86
- if (currentArguments.endsWith(candidate.slice(0, overlap))) {
87
- return currentArguments + candidate.slice(overlap);
88
- }
89
- }
90
- }
91
- return currentArguments + nextDelta;
92
- }
93
- /** Input payload for merge tool call. */
94
- export function mergeToolCallInput(currentArguments, nextInput) {
95
- if (currentArguments.length === 0) {
96
- return nextInput;
97
- }
98
- const normalizedCurrent = stripLeadingEmptyObjectPlaceholder(currentArguments);
99
- if (nextInput.trim() === "{}" && currentArguments.trim().startsWith("{")) {
100
- return currentArguments;
101
- }
102
- if (nextInput.trim() === "{}" && normalizedCurrent.trim().startsWith("{")) {
103
- return normalizedCurrent;
104
- }
105
- if (currentArguments.trim() === "{}" && nextInput.trim().startsWith("{")) {
106
- return nextInput;
107
- }
108
- return nextInput;
109
- }
110
- /** Parses tool input object. */
111
- export function parseToolInputObject(input) {
112
- if (isRecord(input)) {
113
- return input;
114
- }
115
- if (typeof input === "string") {
116
- try {
117
- const parsed = JSON.parse(stripLeadingEmptyObjectPlaceholder(input));
118
- if (isRecord(parsed)) {
119
- return parsed;
120
- }
121
- }
122
- catch {
123
- return {};
124
- }
125
- }
126
- return {};
127
- }
128
4
  /** Parses data stream sse events. */
129
5
  export function parseDataStreamSseEvents(chunk) {
130
6
  const blocks = chunk.split("\n\n");
@@ -0,0 +1,9 @@
1
+ /** Normalize provider tool input by removing transient empty-object prefixes. */
2
+ export declare function stripLeadingEmptyObjectPlaceholder(rawArgs: string): string;
3
+ /** Merge tool input delta helper. */
4
+ export declare function mergeToolInputDelta(currentArguments: string, nextDelta: string): string;
5
+ /** Input payload for merge tool call. */
6
+ export declare function mergeToolCallInput(currentArguments: string, nextInput: string): string;
7
+ /** Parses tool input object. */
8
+ export declare function parseToolInputObject(input: unknown): Record<string, unknown>;
9
+ //# sourceMappingURL=tool-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-input.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/streaming/tool-input.ts"],"names":[],"mappings":"AAIA,iFAAiF;AACjF,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmB1E;AAwBD,qCAAqC;AACrC,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAuDvF;AAED,yCAAyC;AACzC,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAoBtF;AAED,gCAAgC;AAChC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiB5E"}
@@ -0,0 +1,125 @@
1
+ function isRecord(value) {
2
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3
+ }
4
+ /** Normalize provider tool input by removing transient empty-object prefixes. */
5
+ export function stripLeadingEmptyObjectPlaceholder(rawArgs) {
6
+ let normalized = rawArgs.trim();
7
+ while (normalized.startsWith("{}")) {
8
+ const remainder = normalized.slice(2).trimStart();
9
+ if (remainder.startsWith("{")) {
10
+ normalized = remainder;
11
+ continue;
12
+ }
13
+ if (remainder.startsWith('"')) {
14
+ normalized = `{${remainder}`;
15
+ continue;
16
+ }
17
+ break;
18
+ }
19
+ return normalized;
20
+ }
21
+ /**
22
+ * Minimum overlap length at which `mergeToolInputDelta` will accept a
23
+ * tail-overlap as an intentional retransmission from the provider and
24
+ * dedup the leading chunk of the next delta.
25
+ *
26
+ * Empirically, overlaps of 1-3 characters are almost always coincidental
27
+ * in streamed JSON (e.g. `"`, `,`, `":`, `,"`). Accepting them as dedup
28
+ * causes silent character drops - the exact pathology observed in staging
29
+ * on 2026-04-15 where `create_file` tool calls arrived at the classifier
30
+ * with 2-5 chars missing from the middle of the buffer. Requiring at
31
+ * least 4 chars of overlap makes false matches vanishingly unlikely while
32
+ * still honoring the real "retransmitted content-suffix" case pinned by
33
+ * the existing "overlapping suffix dedup" regression test (which relies
34
+ * on a 6-char `Report` overlap).
35
+ *
36
+ * Similarly, short deltas (< 4 chars) are treated as append-mode
37
+ * regardless of what they look like: a 1-char delta literally cannot
38
+ * contain enough signal to distinguish retransmission from append, and
39
+ * it will not silently drop it.
40
+ */
41
+ const MIN_OVERLAP_DEDUP_LENGTH = 4;
42
+ /** Merge tool input delta helper. */
43
+ export function mergeToolInputDelta(currentArguments, nextDelta) {
44
+ const normalizedDelta = nextDelta.trimStart();
45
+ const candidateDeltas = normalizedDelta.startsWith('"')
46
+ ? [normalizedDelta, `{${normalizedDelta}`]
47
+ : [normalizedDelta];
48
+ if (currentArguments === "{}" || currentArguments.length === 0) {
49
+ for (const candidate of candidateDeltas) {
50
+ if (candidate.startsWith("{")) {
51
+ return candidate;
52
+ }
53
+ }
54
+ }
55
+ if (nextDelta.length === 0) {
56
+ return currentArguments;
57
+ }
58
+ if (currentArguments.length === 0) {
59
+ return nextDelta;
60
+ }
61
+ // Short deltas are trusted as append-mode. Retransmission at this size
62
+ // is indistinguishable from append and would produce more corruption
63
+ // than it prevents; see MIN_OVERLAP_DEDUP_LENGTH.
64
+ if (nextDelta.length < MIN_OVERLAP_DEDUP_LENGTH) {
65
+ return currentArguments + nextDelta;
66
+ }
67
+ for (const candidate of candidateDeltas) {
68
+ // Exact duplicate: the provider resent the same full buffer.
69
+ if (candidate === currentArguments) {
70
+ return currentArguments;
71
+ }
72
+ // Cumulative mode: the delta is a strict extension of the current
73
+ // buffer and supersedes it verbatim.
74
+ if (candidate.startsWith(currentArguments)) {
75
+ return candidate;
76
+ }
77
+ // Tail retransmission: the provider resent a suffix of the current
78
+ // buffer as the prefix of the new delta. Only accept overlaps of
79
+ // MIN_OVERLAP_DEDUP_LENGTH or longer. Trivial 1-3 char matches in
80
+ // streamed JSON are overwhelmingly coincidental and deduping them
81
+ // corrupts append-mode streams.
82
+ const maxOverlap = Math.min(currentArguments.length, candidate.length);
83
+ for (let overlap = maxOverlap; overlap >= MIN_OVERLAP_DEDUP_LENGTH; overlap--) {
84
+ if (currentArguments.endsWith(candidate.slice(0, overlap))) {
85
+ return currentArguments + candidate.slice(overlap);
86
+ }
87
+ }
88
+ }
89
+ return currentArguments + nextDelta;
90
+ }
91
+ /** Input payload for merge tool call. */
92
+ export function mergeToolCallInput(currentArguments, nextInput) {
93
+ if (currentArguments.length === 0) {
94
+ return nextInput;
95
+ }
96
+ const normalizedCurrent = stripLeadingEmptyObjectPlaceholder(currentArguments);
97
+ if (nextInput.trim() === "{}" && currentArguments.trim().startsWith("{")) {
98
+ return currentArguments;
99
+ }
100
+ if (nextInput.trim() === "{}" && normalizedCurrent.trim().startsWith("{")) {
101
+ return normalizedCurrent;
102
+ }
103
+ if (currentArguments.trim() === "{}" && nextInput.trim().startsWith("{")) {
104
+ return nextInput;
105
+ }
106
+ return nextInput;
107
+ }
108
+ /** Parses tool input object. */
109
+ export function parseToolInputObject(input) {
110
+ if (isRecord(input)) {
111
+ return input;
112
+ }
113
+ if (typeof input === "string") {
114
+ try {
115
+ const parsed = JSON.parse(stripLeadingEmptyObjectPlaceholder(input));
116
+ if (isRecord(parsed)) {
117
+ return parsed;
118
+ }
119
+ }
120
+ catch {
121
+ return {};
122
+ }
123
+ }
124
+ return {};
125
+ }
@@ -1,4 +1,4 @@
1
- import { mergeToolInputDelta, parseToolInputObject, } from "../agent/streaming/data-stream.js";
1
+ import { mergeToolInputDelta, parseToolInputObject, } from "../agent/streaming/tool-input.js";
2
2
  import { formatToolErrorText, isCommentOnlySseFrame, isRecord, mapFinishReason, normalizeNewlines, parseSerializedToolResult, splitSseFrames, toRenderableCustomChunk, } from "./ag-ui-helpers.js";
3
3
  import { tryResolve } from "../extensions/contracts.js";
4
4
  import { defineSchema } from "../schemas/index.js";
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.873";
2
+ export declare const VERSION = "0.1.874";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.873";
4
+ export const VERSION = "0.1.874";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.873",
3
+ "version": "0.1.874",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",