@proposit/proposit-core 1.5.1 → 1.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.
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.js +6 -0
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.js.map +1 -1
- package/dist/extensions/argument-ingestion/shared/types.d.ts +18 -7
- package/dist/extensions/argument-ingestion/shared/types.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js +4 -2
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js +4 -2
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js +2 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js +4 -2
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js +4 -2
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js +2 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js +2 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.js +2 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.js.map +1 -1
- package/dist/extensions/ollama/errors.d.ts +73 -0
- package/dist/extensions/ollama/errors.d.ts.map +1 -0
- package/dist/extensions/ollama/errors.js +228 -0
- package/dist/extensions/ollama/errors.js.map +1 -0
- package/dist/extensions/ollama/index.d.ts +6 -0
- package/dist/extensions/ollama/index.d.ts.map +1 -0
- package/dist/extensions/ollama/index.js +17 -0
- package/dist/extensions/ollama/index.js.map +1 -0
- package/dist/extensions/ollama/provider.d.ts +21 -0
- package/dist/extensions/ollama/provider.d.ts.map +1 -0
- package/dist/extensions/ollama/provider.js +375 -0
- package/dist/extensions/ollama/provider.js.map +1 -0
- package/dist/extensions/ollama/structured-output.d.ts +18 -0
- package/dist/extensions/ollama/structured-output.d.ts.map +1 -0
- package/dist/extensions/ollama/structured-output.js +164 -0
- package/dist/extensions/ollama/structured-output.js.map +1 -0
- package/dist/extensions/ollama/timeout-fetch.d.ts +24 -0
- package/dist/extensions/ollama/timeout-fetch.d.ts.map +1 -0
- package/dist/extensions/ollama/timeout-fetch.js +76 -0
- package/dist/extensions/ollama/timeout-fetch.js.map +1 -0
- package/dist/extensions/ollama/types.d.ts +179 -0
- package/dist/extensions/ollama/types.d.ts.map +1 -0
- package/dist/extensions/ollama/types.js +7 -0
- package/dist/extensions/ollama/types.js.map +1 -0
- package/dist/extensions/openai/provider.d.ts +26 -0
- package/dist/extensions/openai/provider.d.ts.map +1 -1
- package/dist/extensions/openai/provider.js +334 -9
- package/dist/extensions/openai/provider.js.map +1 -1
- package/dist/extensions/openai/types.d.ts +3 -0
- package/dist/extensions/openai/types.d.ts.map +1 -1
- package/package.json +17 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/extensions/ollama/provider.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,6BAA6B;AAC7B,EAAE;AACF,uEAAuE;AACvE,gEAAgE;AAChE,2DAA2D;AAC3D,yCAAyC;AACzC,EAAE;AACF,2DAA2D;AAC3D,wEAAwE;AACxE,oEAAoE;AACpE,mDAAmD;AACnD,+DAA+D;AAC/D,qEAAqE;AACrE,wCAAwC;AACxC,yDAAyD;AACzD,uEAAuE;AACvE,iEAAiE;AACjE,oEAAoE;AACpE,qEAAqE;AACrE,oEAAoE;AACpE,sEAAsE;AACtE,wEAAwE;AACxE,oDAAoD;AACpD,0EAA0E;AAC1E,qEAAqE;AACrE,yEAAyE;AACzE,qDAAqD;AACrD,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,EAAE;AACF,uEAAuE;AACvE,iEAAiE;AACjE,uEAAuE;AACvE,uEAAuE;AASvE,OAAO,EACH,eAAe,EACf,eAAe,EACf,gBAAgB,GACnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,GACtB,MAAM,aAAa,CAAA;AAYpB,MAAM,eAAe,GAAG,oCAAoC,CAAA;AAE5D,MAAM,gBAAgB,GAAG,wBAAwB,CAAA;AACjD,MAAM,uBAAuB,GAAG,CAAC,CAAA;AACjC,qEAAqE;AACrE,sEAAsE;AACtE,sEAAsE;AACtE,mFAAmF;AACnF,MAAM,eAAe,GAAG,KAAK,CAAA;AAC7B,wEAAwE;AACxE,6DAA6D;AAC7D,wEAAwE;AACxE,0EAA0E;AAC1E,uEAAuE;AACvE,MAAM,0BAA0B,GAAG,SAAS,CAAA;AAE5C,MAAM,OAAO,cAAc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;IAEZ,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACjD,OAAO,IAAI,CAAA;QACf,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TSchema } from "typebox";
|
|
2
|
+
/**
|
|
3
|
+
* The output shape is intentionally typed as a plain object literal
|
|
4
|
+
* (not a full JSON-Schema TS type). Ollama's `format` accepts this
|
|
5
|
+
* shape and we round-trip it through the SDK request body. Keeping the
|
|
6
|
+
* return type loose avoids dragging a JSON-Schema dependency into the
|
|
7
|
+
* converter.
|
|
8
|
+
*/
|
|
9
|
+
export type TOllamaJsonSchema = Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Convert a TypeBox schema into a standard JSON Schema document
|
|
12
|
+
* suitable for Ollama's `format` parameter.
|
|
13
|
+
*
|
|
14
|
+
* Throws `UnsupportedSchemaError` when the source schema contains a
|
|
15
|
+
* TypeBox primitive outside the supported subset.
|
|
16
|
+
*/
|
|
17
|
+
export declare function typeboxToJsonSchema(schema: TSchema): TOllamaJsonSchema;
|
|
18
|
+
//# sourceMappingURL=structured-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured-output.d.ts","sourceRoot":"","sources":["../../../src/extensions/ollama/structured-output.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AA6BvD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,CA0BtE"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// TypeBox → standard JSON Schema converter for the Ollama provider.
|
|
2
|
+
//
|
|
3
|
+
// Ollama's `format` parameter accepts a *standard* JSON Schema (the
|
|
4
|
+
// same shape `zodToJsonSchema` would emit). This converter deliberately
|
|
5
|
+
// does NOT apply the OpenAI Responses-API strict-mode folds that
|
|
6
|
+
// `typeboxToOpenAiSchema` (`../openai/structured-output.ts`) applies:
|
|
7
|
+
//
|
|
8
|
+
// * No forced `additionalProperties: false` on objects.
|
|
9
|
+
// * `Type.Optional(T)` → the key is simply OMITTED from `required`
|
|
10
|
+
// (standard JSON-schema optionality), NOT widened to
|
|
11
|
+
// `{ anyOf: [T, { type: "null" }] }` and kept in `required`.
|
|
12
|
+
//
|
|
13
|
+
// Those strict folds are correct for OpenAI strict mode and harmful for
|
|
14
|
+
// a standard `format` consumer, so the Ollama provider gets its own
|
|
15
|
+
// converter rather than reusing/renaming the OpenAI one.
|
|
16
|
+
//
|
|
17
|
+
// Supported TypeBox subset (same primitives the OpenAI converter
|
|
18
|
+
// covers): Object, Array, String, Number, Integer, Boolean, Literal,
|
|
19
|
+
// Union (including Union-of-Literals → enum shorthand, and Union
|
|
20
|
+
// containing Null for the Nullable pattern), Optional (modifier),
|
|
21
|
+
// Record, Null. Unsupported primitives throw a clear
|
|
22
|
+
// `UnsupportedSchemaError` at conversion time.
|
|
23
|
+
//
|
|
24
|
+
// The converter ignores TypeBox `$id` / `description` / other metadata
|
|
25
|
+
// on inner types — only structural fields are projected.
|
|
26
|
+
class UnsupportedSchemaError extends Error {
|
|
27
|
+
constructor(kind) {
|
|
28
|
+
super(`TypeBox primitive "${kind}" is not supported by the Ollama structured-output converter. ` +
|
|
29
|
+
`Supported subset: Object, Array, String, Number, Integer, Boolean, Literal, Union, Optional, Record, Null.`);
|
|
30
|
+
this.name = "UnsupportedSchemaError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function kindOf(schema) {
|
|
34
|
+
return schema["~kind"];
|
|
35
|
+
}
|
|
36
|
+
function isOptional(schema) {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
38
|
+
return schema["~optional"] === true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convert a TypeBox schema into a standard JSON Schema document
|
|
42
|
+
* suitable for Ollama's `format` parameter.
|
|
43
|
+
*
|
|
44
|
+
* Throws `UnsupportedSchemaError` when the source schema contains a
|
|
45
|
+
* TypeBox primitive outside the supported subset.
|
|
46
|
+
*/
|
|
47
|
+
export function typeboxToJsonSchema(schema) {
|
|
48
|
+
const kind = kindOf(schema);
|
|
49
|
+
switch (kind) {
|
|
50
|
+
case "String":
|
|
51
|
+
return { type: "string" };
|
|
52
|
+
case "Number":
|
|
53
|
+
return { type: "number" };
|
|
54
|
+
case "Integer":
|
|
55
|
+
return { type: "integer" };
|
|
56
|
+
case "Boolean":
|
|
57
|
+
return { type: "boolean" };
|
|
58
|
+
case "Null":
|
|
59
|
+
return { type: "null" };
|
|
60
|
+
case "Literal":
|
|
61
|
+
return convertLiteral(schema);
|
|
62
|
+
case "Union":
|
|
63
|
+
return convertUnion(schema);
|
|
64
|
+
case "Array":
|
|
65
|
+
return convertArray(schema);
|
|
66
|
+
case "Object":
|
|
67
|
+
return convertObject(schema);
|
|
68
|
+
case "Record":
|
|
69
|
+
return convertRecord(schema);
|
|
70
|
+
default:
|
|
71
|
+
throw new UnsupportedSchemaError(kind ?? "(unknown)");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function convertLiteral(schema) {
|
|
75
|
+
const literal = schema;
|
|
76
|
+
const value = literal.const;
|
|
77
|
+
const jsType = literal.type ?? jsonSchemaTypeOf(value);
|
|
78
|
+
return { type: jsType, enum: [value] };
|
|
79
|
+
}
|
|
80
|
+
function jsonSchemaTypeOf(value) {
|
|
81
|
+
if (value === null)
|
|
82
|
+
return "null";
|
|
83
|
+
switch (typeof value) {
|
|
84
|
+
case "string":
|
|
85
|
+
return "string";
|
|
86
|
+
case "number":
|
|
87
|
+
return "number";
|
|
88
|
+
case "bigint":
|
|
89
|
+
return "integer";
|
|
90
|
+
case "boolean":
|
|
91
|
+
return "boolean";
|
|
92
|
+
default:
|
|
93
|
+
throw new Error(`Literal value of type "${typeof value}" cannot be converted to a JSON Schema primitive type.`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function convertUnion(schema) {
|
|
97
|
+
const union = schema;
|
|
98
|
+
const branches = union.anyOf;
|
|
99
|
+
if (branches.length === 0) {
|
|
100
|
+
throw new Error("Cannot convert an empty Type.Union.");
|
|
101
|
+
}
|
|
102
|
+
// Shorthand: collapse a union of same-typed literals into a single
|
|
103
|
+
// `enum`. Mixed-type literal unions still convert correctly via the
|
|
104
|
+
// general anyOf branch — we only collapse when every literal shares
|
|
105
|
+
// the same JSON Schema type.
|
|
106
|
+
if (branches.every(isLiteralKind)) {
|
|
107
|
+
const literalTypes = new Set(branches.map((b) => b.type));
|
|
108
|
+
if (literalTypes.size === 1) {
|
|
109
|
+
const literalType = [...literalTypes][0] ?? "string";
|
|
110
|
+
return {
|
|
111
|
+
type: literalType,
|
|
112
|
+
enum: branches.map((b) => b.const),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return { anyOf: branches.map((b) => typeboxToJsonSchema(b)) };
|
|
117
|
+
}
|
|
118
|
+
function isLiteralKind(schema) {
|
|
119
|
+
return kindOf(schema) === "Literal";
|
|
120
|
+
}
|
|
121
|
+
function convertArray(schema) {
|
|
122
|
+
const array = schema;
|
|
123
|
+
return {
|
|
124
|
+
type: "array",
|
|
125
|
+
items: typeboxToJsonSchema(array.items),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function convertObject(schema) {
|
|
129
|
+
const object = schema;
|
|
130
|
+
const properties = {};
|
|
131
|
+
const required = [];
|
|
132
|
+
for (const [key, propSchema] of Object.entries(object.properties)) {
|
|
133
|
+
// Standard JSON-schema optionality: an `Type.Optional(T)`
|
|
134
|
+
// property is converted as its inner `T` and simply OMITTED
|
|
135
|
+
// from `required`. No null-widening, no forced
|
|
136
|
+
// `additionalProperties: false` — that is the OpenAI-strict
|
|
137
|
+
// fold the Ollama `format` consumer does not want.
|
|
138
|
+
properties[key] = typeboxToJsonSchema(propSchema);
|
|
139
|
+
if (!isOptional(propSchema)) {
|
|
140
|
+
required.push(key);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties,
|
|
146
|
+
required,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function convertRecord(schema) {
|
|
150
|
+
const record = schema;
|
|
151
|
+
// TypeBox encodes Record(Type.String(), V) as
|
|
152
|
+
// { patternProperties: { "^.*$": V } }. We collapse this to the
|
|
153
|
+
// canonical `additionalProperties: <V>` shape.
|
|
154
|
+
const patterns = Object.values(record.patternProperties);
|
|
155
|
+
if (patterns.length !== 1) {
|
|
156
|
+
throw new Error("Type.Record with multiple pattern keys is not supported by the converter.");
|
|
157
|
+
}
|
|
158
|
+
const valueSchema = patterns[0];
|
|
159
|
+
return {
|
|
160
|
+
type: "object",
|
|
161
|
+
additionalProperties: typeboxToJsonSchema(valueSchema),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=structured-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured-output.js","sourceRoot":"","sources":["../../../src/extensions/ollama/structured-output.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,iEAAiE;AACjE,sEAAsE;AACtE,EAAE;AACF,0DAA0D;AAC1D,qEAAqE;AACrE,yDAAyD;AACzD,iEAAiE;AACjE,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,yDAAyD;AACzD,EAAE;AACF,iEAAiE;AACjE,qEAAqE;AACrE,iEAAiE;AACjE,kEAAkE;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CAAC,GAAG,CAAC,CAAA;QACtB,CAAC;IACL,CAAC;IACD,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,UAAU;QACV,QAAQ;KACX,CAAA;AACL,CAAC;AAED,SAAS,aAAa,CAAC,MAAe;IAClC,MAAM,MAAM,GAAG,MAEd,CAAA;IACD,8CAA8C;IAC9C,gEAAgE;IAChE,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;IACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACX,2EAA2E,CAC9E,CAAA;IACL,CAAC;IACD,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC/B,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,mBAAmB,CAAC,WAAW,CAAC;KACzD,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TUndiciModule } from "./types.js";
|
|
2
|
+
type TUndiciImporter = () => Promise<TUndiciModule>;
|
|
3
|
+
/**
|
|
4
|
+
* Build a `fetch`-shaped function backed by a per-instance undici `Agent`
|
|
5
|
+
* whose `headersTimeout` and `bodyTimeout` are raised to `requestTimeoutMs`.
|
|
6
|
+
*
|
|
7
|
+
* The returned wrapper delegates to **the imported undici module's own
|
|
8
|
+
* `fetch`** (`mod.fetch`), passing the `Agent` as its `dispatcher`. The base
|
|
9
|
+
* fetch and the dispatcher MUST come from the same undici instance — handing
|
|
10
|
+
* this Agent to Node's bundled-undici global `fetch` is rejected with
|
|
11
|
+
* `UND_ERR_INVALID_ARG`. See the file header.
|
|
12
|
+
*
|
|
13
|
+
* Returns `undefined` when `requestTimeoutMs <= 0` (caller opted out) or
|
|
14
|
+
* when the optional `undici` peer cannot be imported (graceful fallback to
|
|
15
|
+
* the SDK's default fetch — Node's global fetch with no dispatcher, which
|
|
16
|
+
* works; the raised timeout is simply lost and `classifyOllamaError` maps
|
|
17
|
+
* any resulting timeout to a retryable transient error).
|
|
18
|
+
*
|
|
19
|
+
* @param requestTimeoutMs raised headers/body timeout in milliseconds
|
|
20
|
+
* @param importUndici injectable importer (test seam); defaults to `import("undici")`
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildTimeoutFetch(requestTimeoutMs: number, importUndici?: TUndiciImporter): Promise<typeof fetch | undefined>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=timeout-fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-fetch.d.ts","sourceRoot":"","sources":["../../../src/extensions/ollama/timeout-fetch.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,KAAK,eAAe,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;AAKnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACnC,gBAAgB,EAAE,MAAM,EACxB,YAAY,GAAE,eAAuC,GACtD,OAAO,CAAC,OAAO,KAAK,GAAG,SAAS,CAAC,CAqCnC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Per-provider request-timeout fetch for the Ollama provider.
|
|
2
|
+
//
|
|
3
|
+
// Local thinking models (e.g. qwen3.6 with thinking on) legitimately take
|
|
4
|
+
// many minutes per structured-extraction stage; undici's 300s default
|
|
5
|
+
// `headersTimeout`/`bodyTimeout` aborts them mid-generation with a
|
|
6
|
+
// `TypeError: fetch failed` whose `.cause.code` is `UND_ERR_HEADERS_TIMEOUT`.
|
|
7
|
+
//
|
|
8
|
+
// This builds a custom `fetch` that routes through a **per-instance** undici
|
|
9
|
+
// `Agent` with raised timeouts, passed to the `ollama` SDK client as its
|
|
10
|
+
// `fetch`. It deliberately does NOT call `setGlobalDispatcher` — a library
|
|
11
|
+
// must not mutate global state. `undici` is an optional peer (same posture
|
|
12
|
+
// as `ollama`); when it is unavailable, this returns `undefined` and the
|
|
13
|
+
// provider falls back to the SDK's default fetch (the `classifyOllamaError`
|
|
14
|
+
// transient-timeout mapping then makes the resulting 300s timeout retryable
|
|
15
|
+
// rather than fatal).
|
|
16
|
+
//
|
|
17
|
+
// CRITICAL — pair the Agent with its OWN fetch. The raised-timeout `Agent`
|
|
18
|
+
// is constructed from the separately-installed `undici` package, so the
|
|
19
|
+
// `dispatcher` must be handed to *that same module's* `fetch` (`mod.fetch`),
|
|
20
|
+
// NOT to Node's bundled-undici global `fetch`. Node's global `fetch` rejects
|
|
21
|
+
// a foreign-undici `Agent` dispatcher with `UND_ERR_INVALID_ARG`
|
|
22
|
+
// (`TypeError: fetch failed`), which would make every Ollama request fail
|
|
23
|
+
// instantly when `undici` is installed. Never mix the two undici instances.
|
|
24
|
+
//
|
|
25
|
+
// Scoped to `src/extensions/ollama/` — `src/lib/` never imports `undici`.
|
|
26
|
+
const defaultUndiciImporter = () => import("undici");
|
|
27
|
+
/**
|
|
28
|
+
* Build a `fetch`-shaped function backed by a per-instance undici `Agent`
|
|
29
|
+
* whose `headersTimeout` and `bodyTimeout` are raised to `requestTimeoutMs`.
|
|
30
|
+
*
|
|
31
|
+
* The returned wrapper delegates to **the imported undici module's own
|
|
32
|
+
* `fetch`** (`mod.fetch`), passing the `Agent` as its `dispatcher`. The base
|
|
33
|
+
* fetch and the dispatcher MUST come from the same undici instance — handing
|
|
34
|
+
* this Agent to Node's bundled-undici global `fetch` is rejected with
|
|
35
|
+
* `UND_ERR_INVALID_ARG`. See the file header.
|
|
36
|
+
*
|
|
37
|
+
* Returns `undefined` when `requestTimeoutMs <= 0` (caller opted out) or
|
|
38
|
+
* when the optional `undici` peer cannot be imported (graceful fallback to
|
|
39
|
+
* the SDK's default fetch — Node's global fetch with no dispatcher, which
|
|
40
|
+
* works; the raised timeout is simply lost and `classifyOllamaError` maps
|
|
41
|
+
* any resulting timeout to a retryable transient error).
|
|
42
|
+
*
|
|
43
|
+
* @param requestTimeoutMs raised headers/body timeout in milliseconds
|
|
44
|
+
* @param importUndici injectable importer (test seam); defaults to `import("undici")`
|
|
45
|
+
*/
|
|
46
|
+
export async function buildTimeoutFetch(requestTimeoutMs, importUndici = defaultUndiciImporter) {
|
|
47
|
+
if (!Number.isFinite(requestTimeoutMs) || requestTimeoutMs <= 0) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
let mod;
|
|
51
|
+
try {
|
|
52
|
+
mod = await importUndici();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// undici not installed — degrade to the SDK default fetch. The
|
|
56
|
+
// classify-timeout mapping keeps the resulting timeout retryable.
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const agent = new mod.Agent({
|
|
60
|
+
headersTimeout: requestTimeoutMs,
|
|
61
|
+
bodyTimeout: requestTimeoutMs,
|
|
62
|
+
connectTimeout: requestTimeoutMs,
|
|
63
|
+
});
|
|
64
|
+
// Pair the Agent with undici's OWN fetch — never Node's global fetch,
|
|
65
|
+
// which rejects a foreign-undici Agent dispatcher.
|
|
66
|
+
const undiciFetch = mod.fetch;
|
|
67
|
+
const timeoutFetch = ((input, init) => undiciFetch(input, {
|
|
68
|
+
...init,
|
|
69
|
+
// `dispatcher` is an undici-specific RequestInit extension that
|
|
70
|
+
// undici's fetch honors; it is not in the lib.dom RequestInit
|
|
71
|
+
// type, hence the structural widening.
|
|
72
|
+
...{ dispatcher: agent },
|
|
73
|
+
}));
|
|
74
|
+
return timeoutFetch;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=timeout-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-fetch.js","sourceRoot":"","sources":["../../../src/extensions/ollama/timeout-fetch.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,mEAAmE;AACnE,8EAA8E;AAC9E,EAA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O,YAAY,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { TOllamaJsonSchema } from "./structured-output.js";
|
|
2
|
+
/**
|
|
3
|
+
* The minimal subset of the `ollama` SDK's `chat()` response we read.
|
|
4
|
+
* We model only the fields the provider touches so a mock client (and
|
|
5
|
+
* a real `ChatResponse`) both satisfy it without importing the SDK type
|
|
6
|
+
* (which would force the optional peer into the type graph).
|
|
7
|
+
*/
|
|
8
|
+
export type TOllamaChatToolCall = {
|
|
9
|
+
function: {
|
|
10
|
+
name: string;
|
|
11
|
+
arguments: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type TOllamaChatMessage = {
|
|
15
|
+
role: string;
|
|
16
|
+
content: string;
|
|
17
|
+
tool_calls?: TOllamaChatToolCall[];
|
|
18
|
+
};
|
|
19
|
+
export type TOllamaChatResponse = {
|
|
20
|
+
message: TOllamaChatMessage;
|
|
21
|
+
done?: boolean;
|
|
22
|
+
prompt_eval_count?: number;
|
|
23
|
+
eval_count?: number;
|
|
24
|
+
};
|
|
25
|
+
/** Tool spec in the `ollama` SDK's `chat({ tools })` wire shape. */
|
|
26
|
+
export type TOllamaToolWire = {
|
|
27
|
+
type: "function";
|
|
28
|
+
function: {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
parameters: TOllamaJsonSchema;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** The `chat()` request body subset the provider builds. */
|
|
35
|
+
export type TOllamaChatRequest = {
|
|
36
|
+
model: string;
|
|
37
|
+
messages: TOllamaChatMessage[];
|
|
38
|
+
format?: string | object;
|
|
39
|
+
tools?: TOllamaToolWire[];
|
|
40
|
+
stream?: boolean;
|
|
41
|
+
options?: {
|
|
42
|
+
temperature?: number;
|
|
43
|
+
num_predict?: number;
|
|
44
|
+
num_ctx?: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The slice of the `ollama` SDK client surface the provider depends on:
|
|
49
|
+
* a single `chat()` method and an `abort()` to honor `AbortSignal`.
|
|
50
|
+
* Modeling it as a structural type (rather than importing `Ollama`)
|
|
51
|
+
* keeps the optional peer out of the type graph and gives tests a clean
|
|
52
|
+
* injection seam.
|
|
53
|
+
*/
|
|
54
|
+
export type TOllamaClient = {
|
|
55
|
+
chat(request: TOllamaChatRequest): Promise<TOllamaChatResponse | AsyncIterable<TOllamaChatResponse>>;
|
|
56
|
+
abort(): void;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The shape of the dynamically-imported `ollama` module. `Ollama` is
|
|
60
|
+
* the SDK's exported class-constructor name (an external symbol), so it
|
|
61
|
+
* is exempt from the in-repo camelCase property-naming rule. The SDK's
|
|
62
|
+
* `Config` accepts an optional `fetch` override (used by the
|
|
63
|
+
* per-provider raised-timeout dispatcher — see `./timeout-fetch.ts`).
|
|
64
|
+
*/
|
|
65
|
+
export type TOllamaModule = {
|
|
66
|
+
Ollama: new (config: {
|
|
67
|
+
host: string;
|
|
68
|
+
fetch?: typeof fetch;
|
|
69
|
+
}) => TOllamaClient;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Structural slice of the `undici` module the timeout-fetch helper uses.
|
|
73
|
+
* Modeled (not imported) so the optional `undici` peer stays out of the
|
|
74
|
+
* type graph — same pattern as {@link TOllamaModule} for the `ollama`
|
|
75
|
+
* peer. The undici `Agent` constructor accepts millisecond timeout
|
|
76
|
+
* options; we raise `headersTimeout` + `bodyTimeout` (and `connectTimeout`)
|
|
77
|
+
* so a long local thinking-model generation isn't aborted at undici's
|
|
78
|
+
* 300s default. `Agent` is undici's exported class-constructor name (an
|
|
79
|
+
* external symbol), exempt from the camelCase rule.
|
|
80
|
+
*/
|
|
81
|
+
export type TUndiciAgentOptions = {
|
|
82
|
+
headersTimeout?: number;
|
|
83
|
+
bodyTimeout?: number;
|
|
84
|
+
connectTimeout?: number;
|
|
85
|
+
};
|
|
86
|
+
export type TUndiciDispatcher = object;
|
|
87
|
+
export type TUndiciModule = {
|
|
88
|
+
Agent: new (options: TUndiciAgentOptions) => TUndiciDispatcher;
|
|
89
|
+
/**
|
|
90
|
+
* undici's own `fetch`. The raised-timeout `Agent` MUST be passed as
|
|
91
|
+
* a `dispatcher` to *this* fetch — the one from the same undici
|
|
92
|
+
* module the `Agent` was constructed from. Node's bundled-undici
|
|
93
|
+
* global `fetch` rejects a foreign-undici `Agent` dispatcher with
|
|
94
|
+
* `UND_ERR_INVALID_ARG`, so the base fetch and the dispatcher must
|
|
95
|
+
* come from the same undici instance. See `./timeout-fetch.ts`.
|
|
96
|
+
*/
|
|
97
|
+
fetch: typeof fetch;
|
|
98
|
+
};
|
|
99
|
+
export type TOllamaProviderConfig = {
|
|
100
|
+
/** Daemon base URL. Defaults to `http://localhost:11434`. */
|
|
101
|
+
baseUrl?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Pre-built SDK client. Primarily a test seam (inject a mock). When
|
|
104
|
+
* omitted, the provider dynamically imports the `ollama` package and
|
|
105
|
+
* constructs an `Ollama({ host: baseUrl })`; a missing package
|
|
106
|
+
* surfaces as an actionable error at construction time.
|
|
107
|
+
*/
|
|
108
|
+
client?: TOllamaClient;
|
|
109
|
+
/**
|
|
110
|
+
* Injectable `ollama`-module importer. Test seam — defaults to
|
|
111
|
+
* `import("ollama")`. Lets tests assert the SDK client is constructed
|
|
112
|
+
* with the per-provider timeout-fetch without touching the real
|
|
113
|
+
* package. Ignored when `client` is provided.
|
|
114
|
+
*
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
importOllama?: () => Promise<TOllamaModule>;
|
|
118
|
+
/**
|
|
119
|
+
* Injectable `undici`-module importer. Test seam — defaults to
|
|
120
|
+
* `import("undici")`. See {@link requestTimeoutMs}.
|
|
121
|
+
*
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
importUndici?: () => Promise<TUndiciModule>;
|
|
125
|
+
/**
|
|
126
|
+
* Per-request HTTP timeout in milliseconds, applied via a
|
|
127
|
+
* **per-provider** undici `Agent` (raised `headersTimeout` +
|
|
128
|
+
* `bodyTimeout`) passed as the `ollama` SDK client's `fetch`
|
|
129
|
+
* dispatcher. Defaults to **1_200_000 (20 min)** — local thinking
|
|
130
|
+
* models legitimately take many minutes per structured-extraction
|
|
131
|
+
* stage, and undici's 300s default aborts them mid-generation with a
|
|
132
|
+
* `UND_ERR_HEADERS_TIMEOUT` `fetch failed`.
|
|
133
|
+
*
|
|
134
|
+
* **No global state is mutated** — the raised timeout is scoped to
|
|
135
|
+
* this provider's client only (never `setGlobalDispatcher`). Requires
|
|
136
|
+
* the optional `undici` peer; if it is not installed the provider
|
|
137
|
+
* falls back to the SDK's default fetch (300s) and relies on
|
|
138
|
+
* `classifyOllamaError` retrying the resulting timeout as transient.
|
|
139
|
+
*
|
|
140
|
+
* Set `0` to disable the custom dispatcher entirely (use the SDK
|
|
141
|
+
* default). A finite positive value is recommended.
|
|
142
|
+
*/
|
|
143
|
+
requestTimeoutMs?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Context-window size sent as Ollama's `options.num_ctx`. Defaults
|
|
146
|
+
* to a generous **32768**.
|
|
147
|
+
*
|
|
148
|
+
* **Why this is set, and set generously.** Ollama's per-model
|
|
149
|
+
* default `num_ctx` is small (often ~4096) and Ollama **silently
|
|
150
|
+
* truncates** any prompt longer than `num_ctx` — no error is raised;
|
|
151
|
+
* the model dutifully emits schema-valid JSON from a truncated
|
|
152
|
+
* prompt, which then passes the framework's `Value.Check` and yields
|
|
153
|
+
* a quietly-wrong parse. A real v2 ingestion prompt (segmenting a
|
|
154
|
+
* multi-KB argument) easily exceeds 4096 tokens, so without a
|
|
155
|
+
* generous default the stated goal — running the *whole* pipeline
|
|
156
|
+
* locally on real text — would silently misbehave. Raise this
|
|
157
|
+
* further for very large inputs; lower it only if VRAM-constrained
|
|
158
|
+
* and inputs are known to be small.
|
|
159
|
+
*/
|
|
160
|
+
numCtx?: number;
|
|
161
|
+
/**
|
|
162
|
+
* Stream the `chat()` generation and accumulate the chunks inside
|
|
163
|
+
* the provider, returning a single synthesized response. Defaults
|
|
164
|
+
* to **`true`** — streaming is the primary fix for the hardcoded
|
|
165
|
+
* ~300s non-streaming Ollama timeout (ollama/ollama#5081): headers
|
|
166
|
+
* and the first chunk arrive immediately and undici's `bodyTimeout`
|
|
167
|
+
* resets per chunk, so a long local thinking-model generation is no
|
|
168
|
+
* longer aborted mid-flight. Set `false` to restore the legacy
|
|
169
|
+
* single one-shot (`stream: false`) request.
|
|
170
|
+
*/
|
|
171
|
+
stream?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Cap on function-tool agent-loop round-trips before throwing
|
|
174
|
+
* `ToolLoopExhaustedError`. Defaults to 6, mirroring the OpenAI
|
|
175
|
+
* provider. No ingestion stage uses tools, so this is secondary.
|
|
176
|
+
*/
|
|
177
|
+
maxToolCallRounds?: number;
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extensions/ollama/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D;;;;;GAKG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;QACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KACrC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,kBAAkB,CAAA;IAC3B,IAAI,CAAC,EAAE,OAAO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AAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AACD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAA;AACtC,MAAM,MAAM,aAAa,GAAG;IACxB,KAAK,EAAE,KAAK,OAAO,EAAE,mBAAmB,KAAK,iBAAiB,CAAA;IAC9D;;;;;;;OAOG;IACH,KAAK,EAAE,OAAO,KAAK,CAAA;CACtB,CAAA;AAGD,MAAM,MAAM,qBAAqB,GAAG;IAChC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;IAC3C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;IAC3C;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Extension-internal types for the Ollama provider.
|
|
2
|
+
//
|
|
3
|
+
// Property names on the SDK request/response shapes are *wire* names
|
|
4
|
+
// dictated by the Ollama HTTP API (snake_case); the in-repo brain-style
|
|
5
|
+
// camelCase rule does not apply to external wire formats.
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/extensions/ollama/types.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,wEAAwE;AACxE,0DAA0D"}
|
|
@@ -17,6 +17,32 @@ export type TCreateOpenAiResponsesProviderOptions = {
|
|
|
17
17
|
* count against this cap — they run server-side.
|
|
18
18
|
*/
|
|
19
19
|
maxToolCallRounds?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Stream the foreground response over SSE and accumulate to the
|
|
22
|
+
* terminal envelope inside the provider. Defaults to **`true`** —
|
|
23
|
+
* gives connection-drop resilience and parity with the Ollama
|
|
24
|
+
* provider. No data-retention implications (unlike `backgroundMode`).
|
|
25
|
+
* Set `false` to restore the blocking `response.json()` path.
|
|
26
|
+
*/
|
|
27
|
+
stream?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Run long reasoning calls in OpenAI **background mode**
|
|
30
|
+
* (submit-then-poll) so the result does not depend on a
|
|
31
|
+
* continuously-held connection. Defaults to **`false`**.
|
|
32
|
+
*
|
|
33
|
+
* Background mode requires `store: true`, which retains the
|
|
34
|
+
* response server-side (~10 min, for polling) and is **NOT
|
|
35
|
+
* ZDR-compatible**. Enable only where that data-retention posture
|
|
36
|
+
* is acceptable. V1 supports the **no-tools path only**: a request
|
|
37
|
+
* that sets `backgroundMode` and carries `tools` throws
|
|
38
|
+
* `NonRetryableLlmError`.
|
|
39
|
+
*/
|
|
40
|
+
backgroundMode?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Poll interval (ms) for the background submit-then-poll loop.
|
|
43
|
+
* Defaults to 2000. Ignored unless `backgroundMode` is `true`.
|
|
44
|
+
*/
|
|
45
|
+
backgroundPollIntervalMs?: number;
|
|
20
46
|
};
|
|
21
47
|
export declare function createOpenAiResponsesProvider(options: TCreateOpenAiResponsesProviderOptions): TLlmProvider;
|
|
22
48
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/extensions/openai/provider.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EACR,YAAY,EAKf,MAAM,wBAAwB,CAAA;AAe/B,OAAO,KAAK,EACR,YAAY,EAMf,MAAM,YAAY,CAAA;AAOnB,MAAM,MAAM,qCAAqC,GAAG;IAChD,MAAM,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/extensions/openai/provider.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EACR,YAAY,EAKf,MAAM,wBAAwB,CAAA;AAe/B,OAAO,KAAK,EACR,YAAY,EAMf,MAAM,YAAY,CAAA;AAOnB,MAAM,MAAM,qCAAqC,GAAG;IAChD,MAAM,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CACpC,CAAA;AAED,wBAAgB,6BAA6B,CACzC,OAAO,EAAE,qCAAqC,GAC/C,YAAY,CAwSd"}
|