@tanstack-ai-browser/apfel 0.0.0-stage → 0.1.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.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Tool calls Apple's model writes as text. apfel turns the model's tool
3
+ * calls into OpenAI `tool_calls`, but when it doesn't recognize one it
4
+ * passes it on as text instead, like
5
+ * `{"tool_calls": [{"function": "get_weather", "arguments": {…}}]}`.
6
+ */
7
+ export type ParsedToolCall = {
8
+ name: string;
9
+ args: Record<string, unknown>;
10
+ };
11
+ /** Where Apple's model starts a tool call it writes as text. */
12
+ export declare const JSON_TOOL_CALLS_MARKER = "{\"tool_calls\"";
13
+ /**
14
+ * Tool calls Apple's model wrote as JSON text. Its JSON varies and is often
15
+ * broken (`"function": "name"`, `"name: "name"`, stray strings in the
16
+ * arguments), so instead of parsing the whole thing, this finds each quoted
17
+ * name of a tool that exists and reads the `"arguments"` object after it.
18
+ */
19
+ export declare function parseJsonToolCalls(text: string, toolNames: Iterable<string>): Array<ParsedToolCall>;
20
+ /**
21
+ * Splits a streaming answer into the text before the first tool call written
22
+ * as text (passed through as it arrives) and the tool-call JSON after it
23
+ * (held back and parsed once the reply ends).
24
+ */
25
+ export declare function createToolCallSplitter(marker?: string): {
26
+ push: (text: string) => string;
27
+ flush: () => {
28
+ text: string;
29
+ markup: string | null;
30
+ };
31
+ };
32
+ //# sourceMappingURL=tool-calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-calls.d.ts","sourceRoot":"","sources":["../src/tool-calls.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAA;AAE5E,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,oBAAkB,CAAA;AAkCrD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC1B,KAAK,CAAC,cAAc,CAAC,CAiCvB;AAUD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,SAAyB;iBAKhD,MAAM;;;;;EA2B3B"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Tool calls Apple's model writes as text. apfel turns the model's tool
3
+ * calls into OpenAI `tool_calls`, but when it doesn't recognize one it
4
+ * passes it on as text instead, like
5
+ * `{"tool_calls": [{"function": "get_weather", "arguments": {…}}]}`.
6
+ */
7
+ /** Where Apple's model starts a tool call it writes as text. */
8
+ export const JSON_TOOL_CALLS_MARKER = '{"tool_calls"';
9
+ /** The `{…}` that starts at `text[start]`, braces in strings ignored. */
10
+ function balancedObject(text, start) {
11
+ let depth = 0;
12
+ let inString = false;
13
+ for (let i = start; i < text.length; i++) {
14
+ const c = text[i];
15
+ if (inString) {
16
+ if (c === "\\")
17
+ i++;
18
+ else if (c === '"')
19
+ inString = false;
20
+ }
21
+ else if (c === '"')
22
+ inString = true;
23
+ else if (c === "{")
24
+ depth++;
25
+ else if (c === "}" && --depth === 0)
26
+ return text.slice(start, i + 1);
27
+ }
28
+ return null;
29
+ }
30
+ /** JSON arguments, read leniently: stray strings without a key are dropped. */
31
+ function parseJsonArgs(raw) {
32
+ for (const candidate of [raw, raw.replace(/,\s*"[^"]*"\s*(?=[,}])/g, "")]) {
33
+ try {
34
+ const value = JSON.parse(candidate);
35
+ const args = typeof value === "string" ? JSON.parse(value) : value;
36
+ if (args && typeof args === "object") {
37
+ return args;
38
+ }
39
+ }
40
+ catch {
41
+ // Try the next reading.
42
+ }
43
+ }
44
+ return null;
45
+ }
46
+ /**
47
+ * Tool calls Apple's model wrote as JSON text. Its JSON varies and is often
48
+ * broken (`"function": "name"`, `"name: "name"`, stray strings in the
49
+ * arguments), so instead of parsing the whole thing, this finds each quoted
50
+ * name of a tool that exists and reads the `"arguments"` object after it.
51
+ */
52
+ export function parseJsonToolCalls(text, toolNames) {
53
+ const mentions = [];
54
+ for (const name of toolNames) {
55
+ const quoted = `"${name}"`;
56
+ for (let at = text.indexOf(quoted); at >= 0; at = text.indexOf(quoted, at + 1)) {
57
+ mentions.push({ name, at });
58
+ }
59
+ }
60
+ mentions.sort((a, b) => a.at - b.at);
61
+ const calls = [];
62
+ mentions.forEach(({ name, at }, i) => {
63
+ // The arguments belong to the last mention of a name before them. The
64
+ // model sometimes writes a broken "arguments" and then a good one: the
65
+ // first that reads is used.
66
+ const part = text.slice(at, mentions[i + 1]?.at ?? text.length);
67
+ for (const key of part.matchAll(/"arguments"?\s*:\s*/g)) {
68
+ const from = key.index + key[0].length;
69
+ const raw = part[from] === "{"
70
+ ? balancedObject(part, from)
71
+ : /^"(?:[^"\\]|\\.)*"/.exec(part.slice(from))?.[0];
72
+ const args = raw ? parseJsonArgs(raw) : null;
73
+ if (args) {
74
+ calls.push({ name, args });
75
+ return;
76
+ }
77
+ }
78
+ });
79
+ return calls;
80
+ }
81
+ /** Length of the longest end of `text` that could start `marker`. */
82
+ function partialMarker(text, marker) {
83
+ for (let n = Math.min(text.length, marker.length); n > 0; n--) {
84
+ if (marker.startsWith(text.slice(-n)))
85
+ return n;
86
+ }
87
+ return 0;
88
+ }
89
+ /**
90
+ * Splits a streaming answer into the text before the first tool call written
91
+ * as text (passed through as it arrives) and the tool-call JSON after it
92
+ * (held back and parsed once the reply ends).
93
+ */
94
+ export function createToolCallSplitter(marker = JSON_TOOL_CALLS_MARKER) {
95
+ let held = "";
96
+ let markup = null;
97
+ /** Text that can be shown now. */
98
+ function push(text) {
99
+ if (markup !== null) {
100
+ markup += text;
101
+ return "";
102
+ }
103
+ held += text;
104
+ const at = held.indexOf(marker);
105
+ if (at >= 0) {
106
+ const before = held.slice(0, at);
107
+ markup = held.slice(at);
108
+ held = "";
109
+ return before;
110
+ }
111
+ const keep = partialMarker(held, marker);
112
+ const out = held.slice(0, held.length - keep);
113
+ held = held.slice(out.length);
114
+ return out;
115
+ }
116
+ /** The rest of the text, and the tool-call JSON if any. */
117
+ function flush() {
118
+ const rest = held;
119
+ held = "";
120
+ return { text: rest, markup };
121
+ }
122
+ return { push, flush };
123
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Tool-call repair. Apple's model picks the right tool but often gets its
3
+ * arguments wrong: it renames fields (`limit` for `numResults`, `site` for
4
+ * `includeDomains`) and drops optional ones it was asked to set. So after the
5
+ * model calls a tool, its arguments are written again with apfel's guided
6
+ * generation, which holds the model to the tool's JSON Schema:
7
+ *
8
+ * 1. For each optional field, a yes/no answer: does the request give it a
9
+ * value? (Asked for the arguments directly, the model leaves out optional
10
+ * numbers and arrays even when the request states them.)
11
+ * 2. The arguments, with the fields from step 1 required and the rest left
12
+ * out. Fields the model already got right (schema name, right type) are
13
+ * kept as it wrote them.
14
+ *
15
+ * Works from the schema alone, for any tool, MCP tools included. Through
16
+ * `chat()` with search, calendar, file and weather tools, the calls came out
17
+ * right 27 times in 32 with this, against 18 without; the misses left are
18
+ * the model not calling a tool at all, which this can't fix.
19
+ */
20
+ type JsonSchema = Record<string, unknown>;
21
+ /**
22
+ * The schema in the subset guided generation enforces: types, properties,
23
+ * required, items, enum, const and descriptions. Local `$ref`s are inlined,
24
+ * `anyOf`/`oneOf`/type unions become their first non-null choice, and
25
+ * constraints it can't enforce (lengths, patterns, formats…) are dropped.
26
+ */
27
+ export declare function toGuidedSchema(schema: unknown, root?: JsonSchema, depth?: number): JsonSchema;
28
+ /**
29
+ * The name of the tool the model meant, when it got the name slightly wrong
30
+ * (case, `-` for `_`…). Undefined if no tool matches.
31
+ */
32
+ export declare function matchToolName(name: string, toolNames: Iterable<string>): string | undefined;
33
+ /** A chat completion request apfel answers with JSON matching `schema`. */
34
+ export type GuidedRequest = {
35
+ /** Instructions, sent before the conversation. */
36
+ instructions: string;
37
+ schema: JsonSchema;
38
+ name: string;
39
+ };
40
+ /** Sends a guided request; resolves to the model's JSON, parsed. */
41
+ export type GuidedComplete = (request: GuidedRequest) => Promise<unknown>;
42
+ export type RepairableTool = {
43
+ name: string;
44
+ description: string;
45
+ inputSchema?: unknown;
46
+ };
47
+ /**
48
+ * The tool call's arguments, written again under the tool's schema.
49
+ * Undefined if the tool takes no arguments or its schema isn't an object
50
+ * (the model's own arguments are used then).
51
+ */
52
+ export declare function repairToolArguments(tool: RepairableTool, complete: GuidedComplete,
53
+ /** The model's own arguments, which may use the wrong field names. */
54
+ draft?: string): Promise<Record<string, unknown> | undefined>;
55
+ export {};
56
+ //# sourceMappingURL=tool-repair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-repair.d.ts","sourceRoot":"","sources":["../src/tool-repair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAoBzC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,UAA2C,EACjD,KAAK,SAAI,GACR,UAAU,CAkEZ;AA4FD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,sBAMtE;AAED,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG;IAC1B,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAEzE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,cAAc;AACxB,sEAAsE;AACtE,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAyE9C"}
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Tool-call repair. Apple's model picks the right tool but often gets its
3
+ * arguments wrong: it renames fields (`limit` for `numResults`, `site` for
4
+ * `includeDomains`) and drops optional ones it was asked to set. So after the
5
+ * model calls a tool, its arguments are written again with apfel's guided
6
+ * generation, which holds the model to the tool's JSON Schema:
7
+ *
8
+ * 1. For each optional field, a yes/no answer: does the request give it a
9
+ * value? (Asked for the arguments directly, the model leaves out optional
10
+ * numbers and arrays even when the request states them.)
11
+ * 2. The arguments, with the fields from step 1 required and the rest left
12
+ * out. Fields the model already got right (schema name, right type) are
13
+ * kept as it wrote them.
14
+ *
15
+ * Works from the schema alone, for any tool, MCP tools included. Through
16
+ * `chat()` with search, calendar, file and weather tools, the calls came out
17
+ * right 27 times in 32 with this, against 18 without; the misses left are
18
+ * the model not calling a tool at all, which this can't fix.
19
+ */
20
+ /** Keywords guided generation can enforce; apfel rejects others with 400. */
21
+ const KEPT = ["type", "description", "enum", "const"];
22
+ const isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
23
+ /** The schema a local `$ref` (`#/$defs/X`, `#/definitions/X`) points to. */
24
+ function resolveRef(ref, root) {
25
+ if (!ref.startsWith("#/"))
26
+ return undefined;
27
+ let node = root;
28
+ for (const key of ref.slice(2).split("/")) {
29
+ node = isObject(node)
30
+ ? node[key.replace(/~1/g, "/").replace(/~0/g, "~")]
31
+ : undefined;
32
+ }
33
+ return isObject(node) ? node : undefined;
34
+ }
35
+ /**
36
+ * The schema in the subset guided generation enforces: types, properties,
37
+ * required, items, enum, const and descriptions. Local `$ref`s are inlined,
38
+ * `anyOf`/`oneOf`/type unions become their first non-null choice, and
39
+ * constraints it can't enforce (lengths, patterns, formats…) are dropped.
40
+ */
41
+ export function toGuidedSchema(schema, root = isObject(schema) ? schema : {}, depth = 0) {
42
+ if (!isObject(schema) || depth > 12)
43
+ return { type: "string" };
44
+ if (typeof schema.$ref === "string") {
45
+ const target = resolveRef(schema.$ref, root);
46
+ return target
47
+ ? toGuidedSchema({ ...target, ...withoutKey(schema, "$ref") }, root, depth + 1)
48
+ : { type: "string" };
49
+ }
50
+ const choices = (schema.anyOf ?? schema.oneOf);
51
+ if (Array.isArray(choices)) {
52
+ const choice = choices.find((c) => isObject(c) && c.type !== "null") ?? choices[0];
53
+ return toGuidedSchema({
54
+ ...(isObject(choice) ? choice : {}),
55
+ ...(schema.description !== undefined && {
56
+ description: schema.description
57
+ })
58
+ }, root, depth + 1);
59
+ }
60
+ if (Array.isArray(schema.allOf)) {
61
+ const merged = schema.allOf.reduce((all, part) => (isObject(part) ? mergeSchemas(all, part) : all), withoutKey(schema, "allOf"));
62
+ return toGuidedSchema(merged, root, depth + 1);
63
+ }
64
+ const out = {};
65
+ for (const key of KEPT) {
66
+ if (schema[key] !== undefined)
67
+ out[key] = schema[key];
68
+ }
69
+ if (Array.isArray(out.type)) {
70
+ out.type = out.type.find((t) => t !== "null") ?? "string";
71
+ }
72
+ if (out.type === undefined) {
73
+ if (isObject(schema.properties))
74
+ out.type = "object";
75
+ else if (schema.items !== undefined)
76
+ out.type = "array";
77
+ else if (Array.isArray(out.enum))
78
+ out.type = typeof out.enum[0];
79
+ else if (out.const === undefined)
80
+ out.type = "string";
81
+ }
82
+ if (out.type === "object") {
83
+ const properties = isObject(schema.properties) ? schema.properties : {};
84
+ out.properties = Object.fromEntries(Object.entries(properties).map(([key, value]) => [
85
+ key,
86
+ toGuidedSchema(value, root, depth + 1)
87
+ ]));
88
+ out.required = Array.isArray(schema.required)
89
+ ? schema.required.filter((key) => typeof key === "string" && key in properties)
90
+ : [];
91
+ }
92
+ if (out.type === "array") {
93
+ out.items = toGuidedSchema(schema.items ?? {}, root, depth + 1);
94
+ }
95
+ return out;
96
+ }
97
+ function withoutKey(schema, key) {
98
+ const rest = { ...schema };
99
+ delete rest[key];
100
+ return rest;
101
+ }
102
+ function mergeSchemas(a, b) {
103
+ const merged = { ...a, ...b };
104
+ if (isObject(a.properties) || isObject(b.properties)) {
105
+ merged.properties = {
106
+ ...(isObject(a.properties) ? a.properties : {}),
107
+ ...(isObject(b.properties) ? b.properties : {})
108
+ };
109
+ }
110
+ if (Array.isArray(a.required) || Array.isArray(b.required)) {
111
+ merged.required = [
112
+ ...new Set([
113
+ ...(Array.isArray(a.required) ? a.required : []),
114
+ ...(Array.isArray(b.required) ? b.required : [])
115
+ ])
116
+ ];
117
+ }
118
+ return merged;
119
+ }
120
+ /** Whether `value` fits a guided schema's type and choices. */
121
+ function fits(value, schema) {
122
+ if (Array.isArray(schema.enum) && !schema.enum.includes(value))
123
+ return false;
124
+ if (schema.const !== undefined)
125
+ return value === schema.const;
126
+ switch (schema.type) {
127
+ case "string":
128
+ return typeof value === "string";
129
+ case "integer":
130
+ return Number.isInteger(value);
131
+ case "number":
132
+ return typeof value === "number" && Number.isFinite(value);
133
+ case "boolean":
134
+ return typeof value === "boolean";
135
+ case "array":
136
+ return (Array.isArray(value) &&
137
+ value.every((item) => fits(item, (schema.items ?? {}))));
138
+ case "object":
139
+ return isObject(value);
140
+ default:
141
+ return true;
142
+ }
143
+ }
144
+ /**
145
+ * The fields of the model's own arguments that already have a schema's
146
+ * name and a value of the right type. They're kept as they are: with several
147
+ * calls to one tool in a reply, they're what tells the calls apart.
148
+ */
149
+ function validDraftFields(draft, properties) {
150
+ let parsed;
151
+ try {
152
+ parsed = draft ? JSON.parse(draft) : undefined;
153
+ }
154
+ catch {
155
+ return {};
156
+ }
157
+ if (!isObject(parsed))
158
+ return {};
159
+ return Object.fromEntries(Object.entries(parsed).filter(([key, value]) => Object.hasOwn(properties, key) &&
160
+ value !== null &&
161
+ fits(value, properties[key])));
162
+ }
163
+ /** One line per field: name, type or choices, and description. */
164
+ function describeFields(properties) {
165
+ return Object.entries(properties)
166
+ .map(([key, field]) => {
167
+ const kind = Array.isArray(field.enum)
168
+ ? field.enum.map((v) => JSON.stringify(v)).join(" | ")
169
+ : String(field.type ?? "any");
170
+ const about = typeof field.description === "string" ? `: ${field.description}` : "";
171
+ return `- ${key} (${kind})${about}`;
172
+ })
173
+ .join("\n");
174
+ }
175
+ /**
176
+ * The name of the tool the model meant, when it got the name slightly wrong
177
+ * (case, `-` for `_`…). Undefined if no tool matches.
178
+ */
179
+ export function matchToolName(name, toolNames) {
180
+ const names = [...toolNames];
181
+ if (names.includes(name))
182
+ return name;
183
+ const plain = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, "");
184
+ const matches = names.filter((n) => plain(n) === plain(name));
185
+ return matches.length === 1 ? matches[0] : undefined;
186
+ }
187
+ /**
188
+ * The tool call's arguments, written again under the tool's schema.
189
+ * Undefined if the tool takes no arguments or its schema isn't an object
190
+ * (the model's own arguments are used then).
191
+ */
192
+ export async function repairToolArguments(tool, complete,
193
+ /** The model's own arguments, which may use the wrong field names. */
194
+ draft) {
195
+ const schema = toGuidedSchema(tool.inputSchema);
196
+ const properties = (schema.properties ?? {});
197
+ if (schema.type !== "object" || Object.keys(properties).length === 0) {
198
+ return undefined;
199
+ }
200
+ const required = schema.required;
201
+ const optional = Object.keys(properties).filter((key) => !required.includes(key));
202
+ const about = `the tool ${tool.name}${tool.description ? ` (${tool.description})` : ""}`;
203
+ // With several calls in one reply, the draft says which one this is.
204
+ const attempt = draft && draft !== "{}"
205
+ ? `\nThe assistant's first attempt at this call, which may use wrong field names: ${draft.slice(0, 1000)}`
206
+ : "";
207
+ let chosen = [];
208
+ if (optional.length > 0) {
209
+ const answer = await complete({
210
+ name: "fields",
211
+ instructions: `You are deciding the arguments of a call to ${about}, for the user's latest request. Its fields:\n${describeFields(properties)}\nFor each optional field, answer true only if the conversation states a value for it, otherwise false.`,
212
+ schema: {
213
+ type: "object",
214
+ properties: Object.fromEntries(optional.map((key) => [
215
+ key,
216
+ {
217
+ type: "boolean",
218
+ description: `Does the request state a value for ${key}?`
219
+ }
220
+ ])),
221
+ required: optional
222
+ }
223
+ });
224
+ if (isObject(answer))
225
+ chosen = optional.filter((key) => answer[key] === true);
226
+ }
227
+ const kept = validDraftFields(draft, properties);
228
+ const fields = [
229
+ ...new Set([
230
+ ...required,
231
+ ...chosen,
232
+ ...optional.filter((key) => key in kept)
233
+ ])
234
+ ];
235
+ const args = await complete({
236
+ name: tool.name,
237
+ instructions: `Write the arguments for a call to ${about} that does what the user asks in their latest request.${attempt}`,
238
+ schema: {
239
+ type: "object",
240
+ properties: Object.fromEntries(fields.map((key) => [key, properties[key]])),
241
+ required: fields
242
+ }
243
+ });
244
+ if (!isObject(args))
245
+ return undefined;
246
+ // Optional fields left empty weren't really set.
247
+ const written = Object.fromEntries(Object.entries(args).filter(([key, value]) => required.includes(key) ||
248
+ !(value === "" ||
249
+ value === null ||
250
+ (Array.isArray(value) && value.length === 0))));
251
+ return { ...written, ...kept };
252
+ }
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@tanstack-ai-browser/apfel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "TanStack AI adapter for Apple's on-device Foundation Model, served by apfel",
5
+ "license": "MIT",
6
+ "author": "daveycodez",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/daveycodez/tanstack-ai-browser.git",
10
+ "directory": "packages/apfel"
11
+ },
12
+ "homepage": "https://github.com/daveycodez/tanstack-ai-browser/tree/main/packages/apfel#readme",
13
+ "bugs": "https://github.com/daveycodez/tanstack-ai-browser/issues",
14
+ "keywords": [
15
+ "tanstack-ai",
16
+ "tanstack",
17
+ "ai",
18
+ "llm",
19
+ "apple",
20
+ "foundation-models",
21
+ "apfel",
22
+ "on-device",
23
+ "local-ai"
24
+ ],
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "main": "./dist/index.js",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ "./package.json": "./package.json",
32
+ ".": {
33
+ "@tanstack-ai-browser/source": "./src/index.ts",
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js",
36
+ "default": "./dist/index.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "src",
41
+ "dist",
42
+ "!**/*.tsbuildinfo"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "nx": {
48
+ "name": "apfel"
49
+ },
50
+ "peerDependencies": {
51
+ "@tanstack/ai": "^1.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@tanstack/ai": "1.0.0"
55
+ }
6
56
  }