@proposit/proposit-core 2.0.0 → 2.2.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/cli/commands/parse.d.ts.map +1 -1
- package/dist/cli/commands/parse.js +27 -29
- package/dist/cli/commands/parse.js.map +1 -1
- package/dist/extensions/chat-completions/errors.d.ts +66 -0
- package/dist/extensions/chat-completions/errors.d.ts.map +1 -0
- package/dist/extensions/chat-completions/errors.js +139 -0
- package/dist/extensions/chat-completions/errors.js.map +1 -0
- package/dist/extensions/chat-completions/http.d.ts +10 -0
- package/dist/extensions/chat-completions/http.d.ts.map +1 -0
- package/dist/extensions/chat-completions/http.js +80 -0
- package/dist/extensions/chat-completions/http.js.map +1 -0
- package/dist/extensions/chat-completions/index.d.ts +7 -0
- package/dist/extensions/chat-completions/index.d.ts.map +1 -0
- package/dist/extensions/chat-completions/index.js +18 -0
- package/dist/extensions/chat-completions/index.js.map +1 -0
- package/dist/extensions/chat-completions/provider.d.ts +5 -0
- package/dist/extensions/chat-completions/provider.d.ts.map +1 -0
- package/dist/extensions/chat-completions/provider.js +192 -0
- package/dist/extensions/chat-completions/provider.js.map +1 -0
- package/dist/extensions/chat-completions/structured-output.d.ts +18 -0
- package/dist/extensions/chat-completions/structured-output.d.ts.map +1 -0
- package/dist/extensions/{ollama → chat-completions}/structured-output.js +14 -10
- package/dist/extensions/chat-completions/structured-output.js.map +1 -0
- package/dist/extensions/chat-completions/types.d.ts +65 -0
- package/dist/extensions/chat-completions/types.d.ts.map +1 -0
- package/dist/extensions/chat-completions/types.js +19 -0
- package/dist/extensions/chat-completions/types.js.map +1 -0
- package/dist/extensions/openai/errors.js +1 -1
- package/dist/extensions/openai/errors.js.map +1 -1
- package/dist/extensions/openai/provider.d.ts +2 -2
- package/dist/extensions/{argument-ingestion/shared → pipelines/base}/basics-extension.d.ts +1 -1
- package/dist/extensions/pipelines/base/basics-extension.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion/shared → pipelines/base}/basics-extension.js +5 -4
- package/dist/extensions/pipelines/base/basics-extension.js.map +1 -0
- package/dist/extensions/pipelines/base/finalize-response-v2.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion/shared → pipelines/base}/finalize-response-v2.js +1 -1
- package/dist/extensions/pipelines/base/finalize-response-v2.js.map +1 -0
- package/dist/extensions/pipelines/base/index.d.ts +9 -0
- package/dist/extensions/pipelines/base/index.d.ts.map +1 -0
- package/dist/extensions/pipelines/base/index.js +17 -0
- package/dist/extensions/pipelines/base/index.js.map +1 -0
- package/dist/extensions/pipelines/base/resolve-llm-stage-options.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion/shared → pipelines/base}/resolve-llm-stage-options.js +2 -2
- package/dist/extensions/pipelines/base/resolve-llm-stage-options.js.map +1 -0
- package/dist/extensions/pipelines/base/role-derivation.d.ts.map +1 -0
- package/dist/extensions/pipelines/base/role-derivation.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/axiom-indicator-detection.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/axiom-indicator-detection.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/axiom-indicator-detection.js +1 -1
- package/dist/extensions/pipelines/base/stages/axiom-indicator-detection.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/citation-source-detection.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/citation-source-detection.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/citation-source-detection.js +1 -1
- package/dist/extensions/pipelines/base/stages/citation-source-detection.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-canonicalization.d.ts +20 -3
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-canonicalization.js +20 -6
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-mention-extraction.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/claim-mention-extraction.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-mention-extraction.js +1 -1
- package/dist/extensions/pipelines/base/stages/claim-mention-extraction.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-reference-validation.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/claim-reference-validation.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-reference-validation.js +1 -1
- package/dist/extensions/pipelines/base/stages/claim-reference-validation.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-type-classification.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/claim-type-classification.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/claim-type-classification.js +2 -2
- package/dist/extensions/pipelines/base/stages/claim-type-classification.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/conclusion-selection.d.ts +21 -3
- package/dist/extensions/pipelines/base/stages/conclusion-selection.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/conclusion-selection.js +8 -2
- package/dist/extensions/pipelines/base/stages/conclusion-selection.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/formula-compilation.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/formula-compilation.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/formula-compilation.js +1 -1
- package/dist/extensions/pipelines/base/stages/formula-compilation.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/formula-validation.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/formula-validation.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/formula-validation.js +2 -2
- package/dist/extensions/pipelines/base/stages/formula-validation.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/index.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/index.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/index.js +5 -3
- package/dist/extensions/pipelines/base/stages/index.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/relation-extraction.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/relation-extraction.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/relation-extraction.js +1 -1
- package/dist/extensions/pipelines/base/stages/relation-extraction.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/schemas.d.ts +2 -0
- package/dist/extensions/pipelines/base/stages/schemas.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/schemas.js +8 -0
- package/dist/extensions/pipelines/base/stages/schemas.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/segmentation.d.ts +2 -2
- package/dist/extensions/pipelines/base/stages/segmentation.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/segmentation.js +2 -2
- package/dist/extensions/pipelines/base/stages/segmentation.js.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/variable-assignment.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/variable-assignment.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion → pipelines/base}/stages/variable-assignment.js +1 -1
- package/dist/extensions/pipelines/base/stages/variable-assignment.js.map +1 -0
- package/dist/extensions/{argument-ingestion/shared → pipelines/base}/types.d.ts +6 -5
- package/dist/extensions/pipelines/base/types.d.ts.map +1 -0
- package/dist/extensions/pipelines/base/types.js +15 -0
- package/dist/extensions/pipelines/base/types.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/index.d.ts +5 -0
- package/dist/extensions/pipelines/ingestion/index.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/index.js +5 -0
- package/dist/extensions/pipelines/ingestion/index.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scholar/index.d.ts +3 -0
- package/dist/extensions/pipelines/ingestion/scholar/index.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scholar/index.js +3 -0
- package/dist/extensions/pipelines/ingestion/scholar/index.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scholar/scholar.d.ts +48 -0
- package/dist/extensions/pipelines/ingestion/scholar/scholar.d.ts.map +1 -0
- package/dist/extensions/{argument-ingestion/v2-multi-stage.js → pipelines/ingestion/scholar/scholar.js} +25 -18
- package/dist/extensions/pipelines/ingestion/scholar/scholar.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts +33 -0
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js +103 -0
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/index.d.ts +3 -0
- package/dist/extensions/pipelines/ingestion/scribe/index.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/index.js +3 -0
- package/dist/extensions/pipelines/ingestion/scribe/index.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts +17 -0
- package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/schemas.js +26 -0
- package/dist/extensions/pipelines/ingestion/scribe/schemas.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/scribe.d.ts +20 -0
- package/dist/extensions/pipelines/ingestion/scribe/scribe.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/scribe.js +81 -0
- package/dist/extensions/pipelines/ingestion/scribe/scribe.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts +30 -0
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js +142 -0
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js.map +1 -0
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +7 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/pipelines/debug-log.js +1 -1
- package/dist/lib/pipelines/debug-log.js.map +1 -1
- package/dist/lib/pipelines/stage-helpers.d.ts.map +1 -1
- package/dist/lib/pipelines/stage-helpers.js +37 -1
- package/dist/lib/pipelines/stage-helpers.js.map +1 -1
- package/dist/lib/pipelines/types.d.ts +2 -2
- package/package.json +16 -16
- package/dist/extensions/argument-ingestion/index.d.ts +0 -15
- package/dist/extensions/argument-ingestion/index.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/index.js +0 -17
- package/dist/extensions/argument-ingestion/index.js.map +0 -1
- package/dist/extensions/argument-ingestion/shared/basics-extension.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/shared/basics-extension.js.map +0 -1
- package/dist/extensions/argument-ingestion/shared/finalize-response-v2.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/shared/finalize-response-v2.js.map +0 -1
- package/dist/extensions/argument-ingestion/shared/finalize-response.d.ts +0 -21
- package/dist/extensions/argument-ingestion/shared/finalize-response.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/shared/finalize-response.js +0 -33
- package/dist/extensions/argument-ingestion/shared/finalize-response.js.map +0 -1
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.js.map +0 -1
- package/dist/extensions/argument-ingestion/shared/role-derivation.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/shared/role-derivation.js.map +0 -1
- package/dist/extensions/argument-ingestion/shared/types.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/shared/types.js +0 -16
- package/dist/extensions/argument-ingestion/shared/types.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-reference-validation.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-reference-validation.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/formula-compilation.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/formula-compilation.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/formula-validation.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/formula-validation.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/index.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/index.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/schemas.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/schemas.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.js.map +0 -1
- package/dist/extensions/argument-ingestion/stages/variable-assignment.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/stages/variable-assignment.js.map +0 -1
- package/dist/extensions/argument-ingestion/v1-single-shot.d.ts +0 -26
- package/dist/extensions/argument-ingestion/v1-single-shot.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/v1-single-shot.js +0 -113
- package/dist/extensions/argument-ingestion/v1-single-shot.js.map +0 -1
- package/dist/extensions/argument-ingestion/v2-multi-stage.d.ts +0 -38
- package/dist/extensions/argument-ingestion/v2-multi-stage.d.ts.map +0 -1
- package/dist/extensions/argument-ingestion/v2-multi-stage.js.map +0 -1
- package/dist/extensions/ollama/errors.d.ts +0 -73
- package/dist/extensions/ollama/errors.d.ts.map +0 -1
- package/dist/extensions/ollama/errors.js +0 -228
- package/dist/extensions/ollama/errors.js.map +0 -1
- package/dist/extensions/ollama/index.d.ts +0 -6
- package/dist/extensions/ollama/index.d.ts.map +0 -1
- package/dist/extensions/ollama/index.js +0 -17
- package/dist/extensions/ollama/index.js.map +0 -1
- package/dist/extensions/ollama/provider.d.ts +0 -22
- package/dist/extensions/ollama/provider.d.ts.map +0 -1
- package/dist/extensions/ollama/provider.js +0 -417
- package/dist/extensions/ollama/provider.js.map +0 -1
- package/dist/extensions/ollama/structured-output.d.ts +0 -18
- package/dist/extensions/ollama/structured-output.d.ts.map +0 -1
- package/dist/extensions/ollama/structured-output.js.map +0 -1
- package/dist/extensions/ollama/timeout-fetch.d.ts +0 -24
- package/dist/extensions/ollama/timeout-fetch.d.ts.map +0 -1
- package/dist/extensions/ollama/timeout-fetch.js +0 -76
- package/dist/extensions/ollama/timeout-fetch.js.map +0 -1
- package/dist/extensions/ollama/types.d.ts +0 -219
- package/dist/extensions/ollama/types.d.ts.map +0 -1
- package/dist/extensions/ollama/types.js +0 -7
- package/dist/extensions/ollama/types.js.map +0 -1
- /package/dist/extensions/{argument-ingestion/shared → pipelines/base}/finalize-response-v2.d.ts +0 -0
- /package/dist/extensions/{argument-ingestion/shared → pipelines/base}/resolve-llm-stage-options.d.ts +0 -0
- /package/dist/extensions/{argument-ingestion/shared → pipelines/base}/role-derivation.d.ts +0 -0
- /package/dist/extensions/{argument-ingestion/shared → pipelines/base}/role-derivation.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmDxC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmDxC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAwNxD"}
|
|
@@ -6,8 +6,9 @@ import { ClaimCitationLibrary } from "../../lib/core/claim-citation-library.js";
|
|
|
6
6
|
import { cliLog } from "../logging.js";
|
|
7
7
|
import { errorExit, printJson, printLine, printWarning } from "../output.js";
|
|
8
8
|
import { resolveApiKey, createLlmProvider } from "../llm/index.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import { executePipeline } from "../../lib/index.js";
|
|
10
|
+
import { createScholarPipeline, createScribePipeline, } from "../../extensions/pipelines/ingestion/index.js";
|
|
11
|
+
import { basicsExtension } from "../../extensions/pipelines/base/index.js";
|
|
11
12
|
class CliArgumentParser extends BasicsArgumentParser {
|
|
12
13
|
cliTitle;
|
|
13
14
|
cliDescription;
|
|
@@ -40,20 +41,17 @@ export function registerParseCommand(args) {
|
|
|
40
41
|
.option("--llm <provider>", "LLM provider name", "openai")
|
|
41
42
|
.option("--api-key <key>", "API key (overrides env var)")
|
|
42
43
|
.option("--model <model>", "Model override")
|
|
43
|
-
.option("--pipeline <
|
|
44
|
+
.option("--pipeline <name>", "Ingestion pipeline (scholar = thorough, scribe = fast)", "scholar")
|
|
44
45
|
.option("--title <title>", "Argument title (overrides LLM-generated title)")
|
|
45
46
|
.option("--description <desc>", "Argument description", "")
|
|
46
47
|
.option("--dry-run", "Print raw LLM JSON without persisting")
|
|
47
48
|
.action(async (text, opts) => {
|
|
48
|
-
// 1. Resolve pipeline
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
if (opts.pipeline !== "
|
|
53
|
-
|
|
54
|
-
errorExit("v2 pipeline not yet shipped.");
|
|
55
|
-
}
|
|
56
|
-
errorExit(`Unknown pipeline version "${opts.pipeline}". Supported: v1.`);
|
|
49
|
+
// 1. Resolve the ingestion pipeline. `scholar` (thorough,
|
|
50
|
+
// multi-stage) is the default; `scribe` (fast, two
|
|
51
|
+
// cheap LLM calls) is opt-in. Both emit the same
|
|
52
|
+
// parsed-argument response shape.
|
|
53
|
+
if (opts.pipeline !== "scholar" && opts.pipeline !== "scribe") {
|
|
54
|
+
errorExit(`Unknown pipeline "${opts.pipeline}". Supported: scholar, scribe.`);
|
|
57
55
|
}
|
|
58
56
|
// 2. Resolve API key
|
|
59
57
|
let apiKey;
|
|
@@ -77,14 +75,19 @@ export function registerParseCommand(args) {
|
|
|
77
75
|
if (!inputText.trim()) {
|
|
78
76
|
errorExit("Input text is empty.");
|
|
79
77
|
}
|
|
80
|
-
// 4. Build the
|
|
81
|
-
// The pipeline owns the LLM
|
|
78
|
+
// 4. Build the selected ingestion pipeline and execute.
|
|
79
|
+
// The pipeline owns the LLM calls + structured-
|
|
82
80
|
// output validation; the CLI is left with engine
|
|
83
|
-
// construction + persistence.
|
|
81
|
+
// construction + persistence. `--model`, when given,
|
|
82
|
+
// overrides every stage's model via the pipeline-level
|
|
83
|
+
// `llm.defaults`.
|
|
84
84
|
const provider = createLlmProvider(opts.llm, { apiKey });
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
const buildPipeline = opts.pipeline === "scribe"
|
|
86
|
+
? createScribePipeline
|
|
87
|
+
: createScholarPipeline;
|
|
88
|
+
const pipeline = buildPipeline(basicsExtension, opts.model
|
|
89
|
+
? { llm: { defaults: { model: opts.model } } }
|
|
90
|
+
: undefined);
|
|
88
91
|
let pipelineResult;
|
|
89
92
|
try {
|
|
90
93
|
pipelineResult = await executePipeline(pipeline, { text: inputText }, { llm: provider });
|
|
@@ -94,17 +97,12 @@ export function registerParseCommand(args) {
|
|
|
94
97
|
await cliLog("parse:pipeline-error", { error: msg });
|
|
95
98
|
errorExit(msg);
|
|
96
99
|
}
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
// above). A v2 multi-stage pipeline would reach this
|
|
104
|
-
// branch when its finalize returns null on
|
|
105
|
-
// irresolvable-conclusion / empty-canonicalization
|
|
106
|
-
// outcomes. Leave the branch wired so a v2 cutover
|
|
107
|
-
// doesn't need to revisit the CLI.
|
|
100
|
+
// A degraded import: the pipeline's finalize returned no
|
|
101
|
+
// argument. Both scholar and scribe reach this when
|
|
102
|
+
// finalize returns null — empty canonicalization (no
|
|
103
|
+
// claims extracted) or an irresolvable conclusion — with
|
|
104
|
+
// the reason carried on `failures`. Surface those and
|
|
105
|
+
// exit non-zero rather than printing a null argument.
|
|
108
106
|
if (pipelineResult.output === null) {
|
|
109
107
|
const failureSummary = pipelineResult.failures
|
|
110
108
|
.map((f) => `[${f.code}] ${f.message}`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/cli/commands/parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EA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AAe;YACrC,WAAW,EAAE,QAAQ,CAAC,KAAK;SAC9B,CAAC,CAAA;QAEF,yBAAyB;QACzB,MAAM,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACjC,MAAM,WAAW,CAAC,MAAM,CAAC,CAAA;QACzB,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAA;IAC5C,CAAC,CACJ,CAAA;AACT,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare class TransientLlmError extends Error {
|
|
2
|
+
readonly retryReason: "transient";
|
|
3
|
+
readonly status?: number;
|
|
4
|
+
constructor(args: {
|
|
5
|
+
message: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export declare class RateLimitLlmError extends Error {
|
|
10
|
+
readonly retryReason: "rate_limit";
|
|
11
|
+
readonly status?: number;
|
|
12
|
+
constructor(args: {
|
|
13
|
+
message: string;
|
|
14
|
+
status?: number;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Persistent provider budget exhaustion — surfaced as a 429 whose body
|
|
19
|
+
* carries an `insufficient_quota` code/type. Distinct from the transient
|
|
20
|
+
* {@link RateLimitLlmError} throttle: the framework reads the
|
|
21
|
+
* `quota_exhausted` tag, which is absent from every default `retryOn`,
|
|
22
|
+
* so the stage fails fast on attempt 1.
|
|
23
|
+
*/
|
|
24
|
+
export declare class QuotaExhaustedLlmError extends Error {
|
|
25
|
+
readonly retryReason: "quota_exhausted";
|
|
26
|
+
readonly status?: number;
|
|
27
|
+
constructor(args: {
|
|
28
|
+
message: string;
|
|
29
|
+
status?: number;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when the endpoint rejects our request because the model's
|
|
34
|
+
* output failed server-side JSON-Schema enforcement (typical 422).
|
|
35
|
+
* Tagged `transient` so the framework's default retry policy retries — a
|
|
36
|
+
* single re-roll often produces conforming output.
|
|
37
|
+
*/
|
|
38
|
+
export declare class SchemaValidationLlmError extends Error {
|
|
39
|
+
readonly retryReason: "transient";
|
|
40
|
+
readonly status?: number;
|
|
41
|
+
constructor(args: {
|
|
42
|
+
message: string;
|
|
43
|
+
status?: number;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export declare class NonRetryableLlmError extends Error {
|
|
47
|
+
readonly status?: number;
|
|
48
|
+
constructor(args: {
|
|
49
|
+
message: string;
|
|
50
|
+
status?: number;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Route an HTTP status family (plus an optional structured provider
|
|
55
|
+
* error code) into the framework-recognized error class.
|
|
56
|
+
*/
|
|
57
|
+
export declare function classifyHttpError(status: number, message: string, providerErrorCode?: string): Error;
|
|
58
|
+
/**
|
|
59
|
+
* Map a low-level `fetch` failure (server unreachable, connection reset,
|
|
60
|
+
* the request timeout firing as a non-Abort transport error) to a
|
|
61
|
+
* transient error. Talking to a local OpenAI-compatible server that is
|
|
62
|
+
* down or mid-generation is retryable — a retry after backoff can
|
|
63
|
+
* succeed once the server is up / a slow generation completes.
|
|
64
|
+
*/
|
|
65
|
+
export declare function classifyFetchError(err: unknown): Error;
|
|
66
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/extensions/chat-completions/errors.ts"],"names":[],"mappings":"AAmCA,qBAAa,iBAAkB,SAAQ,KAAK;IACxC,SAAgB,WAAW,EAAG,WAAW,CAAS;IAClD,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEnB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAKzD;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IACxC,SAAgB,WAAW,EAAG,YAAY,CAAS;IACnD,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEnB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAKzD;AAED;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC7C,SAAgB,WAAW,EAAG,iBAAiB,CAAS;IACxD,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEnB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAKzD;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAC/C,SAAgB,WAAW,EAAG,WAAW,CAAS;IAClD,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEnB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAKzD;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC3C,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEnB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAKzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,iBAAiB,CAAC,EAAE,MAAM,GAC3B,KAAK,CA6BP;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAKtD"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// chat-completions-provider error classes + the `classifyHttpError` /
|
|
2
|
+
// `classifyFetchError` mappings.
|
|
3
|
+
//
|
|
4
|
+
// The framework's `llmStage` retry policy classifies provider errors by
|
|
5
|
+
// inspecting a `retryReason` tag on the thrown object (see
|
|
6
|
+
// `src/lib/pipelines/stage-helpers.ts#classifyError`). To play cleanly
|
|
7
|
+
// with that mechanism, each error class carries the appropriate tag as
|
|
8
|
+
// an own property. The framework derives the `TProcessingFailure.code`
|
|
9
|
+
// from the tag, so these classes need no `code` of their own.
|
|
10
|
+
//
|
|
11
|
+
// The class names intentionally mirror the OpenAI provider's names but
|
|
12
|
+
// are *distinct* classes living in this extension; they are surfaced
|
|
13
|
+
// only from this subpath (NOT the package root) to avoid colliding with
|
|
14
|
+
// the root-exported OpenAI error classes.
|
|
15
|
+
//
|
|
16
|
+
// Mapping for the framework's default retry policy
|
|
17
|
+
// (`retryOn: ["schema_validation", "transient"]`):
|
|
18
|
+
//
|
|
19
|
+
// * `TransientLlmError` — `retryReason: "transient"`. 5xx responses +
|
|
20
|
+
// low-level fetch failures (server unreachable, connection reset, a
|
|
21
|
+
// request timeout). Retried under the default policy.
|
|
22
|
+
// * `RateLimitLlmError` — `retryReason: "rate_limit"`. A 429 whose body
|
|
23
|
+
// is NOT `insufficient_quota`. Not retried by default — callers can
|
|
24
|
+
// opt into `retryOn: ["..., "rate_limit"]`.
|
|
25
|
+
// * `QuotaExhaustedLlmError` — `retryReason: "quota_exhausted"`.
|
|
26
|
+
// Persistent budget exhaustion (a 429 whose body code/type is
|
|
27
|
+
// `insufficient_quota`). Fail-fast: the tag is absent from every
|
|
28
|
+
// default `retryOn`, so the stage breaks on attempt 1.
|
|
29
|
+
// * `SchemaValidationLlmError` — `retryReason: "transient"`. The
|
|
30
|
+
// model's output failed schema enforcement on the server side
|
|
31
|
+
// (typical 422). A single re-roll often produces conforming output.
|
|
32
|
+
// * `NonRetryableLlmError` — no tag; the framework classifies it as
|
|
33
|
+
// `non_retryable` and surfaces it immediately. Used for 400/401/403
|
|
34
|
+
// and other unrecoverable 4xx.
|
|
35
|
+
export class TransientLlmError extends Error {
|
|
36
|
+
retryReason = "transient";
|
|
37
|
+
status;
|
|
38
|
+
constructor(args) {
|
|
39
|
+
super(args.message);
|
|
40
|
+
this.name = "TransientLlmError";
|
|
41
|
+
this.status = args.status;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class RateLimitLlmError extends Error {
|
|
45
|
+
retryReason = "rate_limit";
|
|
46
|
+
status;
|
|
47
|
+
constructor(args) {
|
|
48
|
+
super(args.message);
|
|
49
|
+
this.name = "RateLimitLlmError";
|
|
50
|
+
this.status = args.status;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Persistent provider budget exhaustion — surfaced as a 429 whose body
|
|
55
|
+
* carries an `insufficient_quota` code/type. Distinct from the transient
|
|
56
|
+
* {@link RateLimitLlmError} throttle: the framework reads the
|
|
57
|
+
* `quota_exhausted` tag, which is absent from every default `retryOn`,
|
|
58
|
+
* so the stage fails fast on attempt 1.
|
|
59
|
+
*/
|
|
60
|
+
export class QuotaExhaustedLlmError extends Error {
|
|
61
|
+
retryReason = "quota_exhausted";
|
|
62
|
+
status;
|
|
63
|
+
constructor(args) {
|
|
64
|
+
super(args.message);
|
|
65
|
+
this.name = "QuotaExhaustedLlmError";
|
|
66
|
+
this.status = args.status;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Thrown when the endpoint rejects our request because the model's
|
|
71
|
+
* output failed server-side JSON-Schema enforcement (typical 422).
|
|
72
|
+
* Tagged `transient` so the framework's default retry policy retries — a
|
|
73
|
+
* single re-roll often produces conforming output.
|
|
74
|
+
*/
|
|
75
|
+
export class SchemaValidationLlmError extends Error {
|
|
76
|
+
retryReason = "transient";
|
|
77
|
+
status;
|
|
78
|
+
constructor(args) {
|
|
79
|
+
super(args.message);
|
|
80
|
+
this.name = "SchemaValidationLlmError";
|
|
81
|
+
this.status = args.status;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export class NonRetryableLlmError extends Error {
|
|
85
|
+
status;
|
|
86
|
+
constructor(args) {
|
|
87
|
+
super(args.message);
|
|
88
|
+
this.name = "NonRetryableLlmError";
|
|
89
|
+
this.status = args.status;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Route an HTTP status family (plus an optional structured provider
|
|
94
|
+
* error code) into the framework-recognized error class.
|
|
95
|
+
*/
|
|
96
|
+
export function classifyHttpError(status, message, providerErrorCode) {
|
|
97
|
+
if (status >= 500) {
|
|
98
|
+
return new TransientLlmError({ message, status });
|
|
99
|
+
}
|
|
100
|
+
if (status === 429) {
|
|
101
|
+
// 429 splits on the body's structured error code: persistent
|
|
102
|
+
// budget exhaustion (`insufficient_quota`) is fail-fast, every
|
|
103
|
+
// other (and every unparseable) 429 stays the transient throttle.
|
|
104
|
+
// The safe default is always "transient + retryable" — never a
|
|
105
|
+
// false quota trip.
|
|
106
|
+
if (providerErrorCode === "insufficient_quota") {
|
|
107
|
+
return new QuotaExhaustedLlmError({ message, status });
|
|
108
|
+
}
|
|
109
|
+
return new RateLimitLlmError({ message, status });
|
|
110
|
+
}
|
|
111
|
+
// 400 is a malformed request — a converter bug, an unsupported
|
|
112
|
+
// parameter, or a request shape the endpoint doesn't accept;
|
|
113
|
+
// retrying just burns the second attempt, so classify non-retryable.
|
|
114
|
+
if (status === 400) {
|
|
115
|
+
return new NonRetryableLlmError({ message, status });
|
|
116
|
+
}
|
|
117
|
+
// 422 signals the model's structured-output reply failed server-side
|
|
118
|
+
// schema validation; a re-roll can succeed, so route it through the
|
|
119
|
+
// schema-validation class (tagged transient).
|
|
120
|
+
if (status === 422) {
|
|
121
|
+
return new SchemaValidationLlmError({ message, status });
|
|
122
|
+
}
|
|
123
|
+
// 401/403 and every other 4xx are unrecoverable.
|
|
124
|
+
return new NonRetryableLlmError({ message, status });
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Map a low-level `fetch` failure (server unreachable, connection reset,
|
|
128
|
+
* the request timeout firing as a non-Abort transport error) to a
|
|
129
|
+
* transient error. Talking to a local OpenAI-compatible server that is
|
|
130
|
+
* down or mid-generation is retryable — a retry after backoff can
|
|
131
|
+
* succeed once the server is up / a slow generation completes.
|
|
132
|
+
*/
|
|
133
|
+
export function classifyFetchError(err) {
|
|
134
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
135
|
+
return new TransientLlmError({
|
|
136
|
+
message: `Network error calling the chat-completions endpoint: ${message}`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/extensions/chat-completions/errors.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,wEAAwE;AACxE,2DAA2D;AAC3D,uEAAuE;AACvE,uEAAuE;AACvE,uEAAuE;AACvE,8DAA8D;AAC9D,EAAE;AACF,uEAAuE;AACvE,qEAAqE;AACrE,wEAAwE;AACxE,0CAA0C;AAC1C,EAAE;AACF,mDAAmD;AACnD,mDAAmD;AACnD,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,0DAA0D;AAC1D,0EAA0E;AAC1E,wEAAwE;AACxE,gDAAgD;AAChD,mEAAmE;AACnE,kEAAkE;AAClE,qEAAqE;AACrE,2DAA2D;AAC3D,mEAAmE;AACnE,kEAAkE;AAClE,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,mCAAmC;AAEnC,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxB,WAAW,GAAG,WAAoB,CAAA;IAClC,MAAM,CAAS;IAE/B,YAAY,IAA0C;QAClD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC7B,CAAC;CACJ;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxB,WAAW,GAAG,YAAqB,CAAA;IACnC,MAAM,CAAS;IAE/B,YAAY,IAA0C;QAClD,KAAK,CAAC,IAAI,CAAC,OA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+DAA+D;QAC/D,kEAAkE;QAClE,+DAA+D;QAC/D,oBAAoB;QACpB,IAAI,iBAAiB,KAAK,oBAAoB,EAAE,CAAC;YAC7C,OAAO,IAAI,sBAAsB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;QAC1D,CAAC;QACD,OAAO,IAAI,iBAAiB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IACrD,CAAC;IACD,+DAA+D;IAC/D,6DAA6D;IAC7D,qEAAqE;IACrE,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IACxD,CAAC;IACD,qEAAqE;IACrE,oEAAoE;IACpE,8CAA8C;IAC9C,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO,IAAI,wBAAwB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IAC5D,CAAC;IACD,iDAAiD;IACjD,OAAO,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC3C,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAChE,OAAO,IAAI,iBAAiB,CAAC;QACzB,OAAO,EAAE,wDAAwD,OAAO,EAAE;KAC7E,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TChatCompletionsFetch, TChatCompletionsResponse } from "./types.js";
|
|
2
|
+
export declare function requestJson(args: {
|
|
3
|
+
url: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
body: unknown;
|
|
6
|
+
fetchImpl: TChatCompletionsFetch;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
}): Promise<TChatCompletionsResponse>;
|
|
10
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/extensions/chat-completions/http.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACR,qBAAqB,EACrB,wBAAwB,EAC3B,MAAM,YAAY,CAAA;AA2BnB,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,qBAAqB,CAAA;IAChC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA2DpC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Raw-fetch HTTP transport for an OpenAI-compatible
|
|
2
|
+
// `/v1/chat/completions` endpoint: a single POST of JSON, a per-request
|
|
3
|
+
// timeout enforced via `AbortSignal.timeout` (composed with the caller's
|
|
4
|
+
// abort signal so a mid-flight cancel still propagates), and non-2xx →
|
|
5
|
+
// error-class classification. No SSE, no background poll — this provider
|
|
6
|
+
// is synchronous. The timeout is a standard `AbortSignal.timeout` with
|
|
7
|
+
// no extra HTTP-stack dependency.
|
|
8
|
+
import { classifyFetchError, classifyHttpError, TransientLlmError, } from "./errors.js";
|
|
9
|
+
function isAbortError(err) {
|
|
10
|
+
return (typeof err === "object" &&
|
|
11
|
+
err !== null &&
|
|
12
|
+
err.name === "AbortError");
|
|
13
|
+
}
|
|
14
|
+
// Compose the caller's AbortSignal with a timeout signal so EITHER one
|
|
15
|
+
// aborts the request. `AbortSignal.any` / `AbortSignal.timeout` are
|
|
16
|
+
// available on the supported Node floor (>=22). When no timeout is
|
|
17
|
+
// configured (timeoutMs <= 0) and no caller signal is present, returns
|
|
18
|
+
// undefined (no abort).
|
|
19
|
+
function resolveSignal(callerSignal, timeoutMs) {
|
|
20
|
+
const timeoutSignal = timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : undefined;
|
|
21
|
+
if (callerSignal && timeoutSignal) {
|
|
22
|
+
return AbortSignal.any([callerSignal, timeoutSignal]);
|
|
23
|
+
}
|
|
24
|
+
return callerSignal ?? timeoutSignal;
|
|
25
|
+
}
|
|
26
|
+
export async function requestJson(args) {
|
|
27
|
+
const signal = resolveSignal(args.signal, args.timeoutMs);
|
|
28
|
+
let response;
|
|
29
|
+
try {
|
|
30
|
+
response = await args.fetchImpl(args.url, {
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
Authorization: `Bearer ${args.apiKey}`,
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(args.body),
|
|
37
|
+
signal,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
// A caller-initiated abort propagates verbatim so `llmStage`'s
|
|
42
|
+
// mid-flight-abort detector marks the stage skipped — gated on the
|
|
43
|
+
// caller's signal actually having fired (a caller abort surfaces as
|
|
44
|
+
// an `AbortError`). A timeout surfaces as a `TimeoutError` (not an
|
|
45
|
+
// `AbortError`), and every other transport failure surfaces with
|
|
46
|
+
// its own name — so both fall through to `classifyFetchError` and
|
|
47
|
+
// are retried as transient.
|
|
48
|
+
if (isAbortError(err) && args.signal?.aborted) {
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
throw classifyFetchError(err);
|
|
52
|
+
}
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
const errorBody = await response.text().catch(() => "");
|
|
55
|
+
const message = `Chat-completions endpoint ${response.status.toString()}: ${errorBody || response.statusText}`;
|
|
56
|
+
// Best-effort structured extraction of the provider error
|
|
57
|
+
// code/type so a 429 can be split into persistent quota
|
|
58
|
+
// exhaustion vs. transient throttling. An unparseable body leaves
|
|
59
|
+
// `providerErrorCode` undefined, which `classifyHttpError` treats
|
|
60
|
+
// as the safe transient default.
|
|
61
|
+
let providerErrorCode;
|
|
62
|
+
try {
|
|
63
|
+
const parsed = JSON.parse(errorBody);
|
|
64
|
+
providerErrorCode = parsed.error?.code ?? parsed.error?.type;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
providerErrorCode = undefined;
|
|
68
|
+
}
|
|
69
|
+
throw classifyHttpError(response.status, message, providerErrorCode);
|
|
70
|
+
}
|
|
71
|
+
return response
|
|
72
|
+
.json()
|
|
73
|
+
.then((j) => j)
|
|
74
|
+
.catch((err) => {
|
|
75
|
+
throw new TransientLlmError({
|
|
76
|
+
message: `Chat-completions response body was not valid JSON: ${err instanceof Error ? err.message : String(err)}`,
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/extensions/chat-completions/http.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,yEAAyE;AACzE,uEAAuE;AACvE,kCAAkC;AAElC,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,aAAa,CAAA;AAMpB,SAAS,YAAY,CAAC,GAAY;IAC9B,OAAO,CACH,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACX,GAA0B,CAAC,IAAI,KAAK,YAAY,CACpD,CAAA;AACL,CAAC;AAED,uEAAuE;AACvE,oEAAoE;AACpE,mEAAmE;AACnE,uEAAuE;AACvE,wBAAwB;AACxB,SAAS,aAAa,CAClB,YAAqC,EACrC,SAAiB;IAEjB,MAAM,aAAa,GACf,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC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S,IAAI,QAAQ,CAAC,UAC1B,EAAE,CAAA;QACF,0DAA0D;QAC1D,wDAAwD;QACxD,kEAAkE;QAClE,kEAAkE;QAClE,iCAAiC;QACjC,IAAI,iBAAqC,CAAA;QACzC,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAElC,CAAA;YACD,iBAAiB,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,IAAI,CAAA;QAChE,CAAC;QAAC,MAAM,CAAC;YACL,iBAAiB,GAAG,SAAS,CAAA;QACjC,CAAC;QACD,MAAM,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAA;IACxE,CAAC;IAED,OAAO,QAAQ;SACV,IAAI,EAAE;SACN,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAA6B,CAAC;SAC1C,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACpB,MAAM,IAAI,iBAAiB,CAAC;YACxB,OAAO,EAAE,sDACL,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACnD,EAAE;SACL,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createChatCompletionsProvider } from "./provider.js";
|
|
2
|
+
export type { TCreateChatCompletionsProviderOptions } from "./provider.js";
|
|
3
|
+
export type { TChatCompletionsProviderConfig } from "./types.js";
|
|
4
|
+
export { typeboxToJsonSchema } from "./structured-output.js";
|
|
5
|
+
export type { TChatCompletionsJsonSchema } from "./structured-output.js";
|
|
6
|
+
export { NonRetryableLlmError, QuotaExhaustedLlmError, RateLimitLlmError, SchemaValidationLlmError, TransientLlmError, classifyHttpError, classifyFetchError, } from "./errors.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/chat-completions/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAA;AAC7D,YAAY,EAAE,qCAAqC,EAAE,MAAM,eAAe,CAAA;AAC1E,YAAY,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,YAAY,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Barrel for the chat-completions provider extension.
|
|
2
|
+
//
|
|
3
|
+
// Public surface consumed via the
|
|
4
|
+
// `@proposit/proposit-core/extensions/chat-completions` subpath: the
|
|
5
|
+
// provider factory + its config type + the lax JSON-schema converter +
|
|
6
|
+
// the error classes (which callers may `instanceof`-match for finer-
|
|
7
|
+
// grained observability) and the status/fetch classifiers.
|
|
8
|
+
//
|
|
9
|
+
// The error class names intentionally mirror the OpenAI provider's names
|
|
10
|
+
// but are *distinct* classes living in this extension; they are surfaced
|
|
11
|
+
// only from this subpath (NOT the package root) to avoid colliding with
|
|
12
|
+
// the root-exported OpenAI error classes. The framework classifies by
|
|
13
|
+
// the `retryReason` tag, not class identity, so the duplication is
|
|
14
|
+
// intentional and harmless.
|
|
15
|
+
export { createChatCompletionsProvider } from "./provider.js";
|
|
16
|
+
export { typeboxToJsonSchema } from "./structured-output.js";
|
|
17
|
+
export { NonRetryableLlmError, QuotaExhaustedLlmError, RateLimitLlmError, SchemaValidationLlmError, TransientLlmError, classifyHttpError, classifyFetchError, } from "./errors.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/chat-completions/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,kCAAkC;AAClC,qEAAqE;AACrE,uEAAuE;AACvE,qEAAqE;AACrE,2DAA2D;AAC3D,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AACtE,mEAAmE;AACnE,4BAA4B;AAE5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAA;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TLlmProvider } from "../../lib/llm/types.js";
|
|
2
|
+
import { type TChatCompletionsProviderConfig } from "./types.js";
|
|
3
|
+
export type TCreateChatCompletionsProviderOptions = TChatCompletionsProviderConfig;
|
|
4
|
+
export declare function createChatCompletionsProvider(options?: TChatCompletionsProviderConfig): TLlmProvider;
|
|
5
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/extensions/chat-completions/provider.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACR,YAAY,EAIf,MAAM,wBAAwB,CAAA;AAS/B,OAAO,EAMH,KAAK,8BAA8B,EAEtC,MAAM,YAAY,CAAA;AAInB,MAAM,MAAM,qCAAqC,GAC7C,8BAA8B,CAAA;AAoBlC,wBAAgB,6BAA6B,CACzC,OAAO,CAAC,EAAE,8BAA8B,GACzC,YAAY,CA8Jd"}
|