@proposit/proposit-core 1.0.2 → 1.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 +62 -27
- package/dist/cli/commands/parse.js.map +1 -1
- package/dist/cli/llm/index.d.ts +5 -4
- package/dist/cli/llm/index.d.ts.map +1 -1
- package/dist/cli/llm/index.js +15 -3
- package/dist/cli/llm/index.js.map +1 -1
- package/dist/extensions/argument-ingestion/index.d.ts +9 -0
- package/dist/extensions/argument-ingestion/index.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/index.js +11 -0
- package/dist/extensions/argument-ingestion/index.js.map +1 -0
- package/dist/extensions/argument-ingestion/shared/basics-extension.d.ts +9 -0
- package/dist/extensions/argument-ingestion/shared/basics-extension.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/shared/basics-extension.js +25 -0
- package/dist/extensions/argument-ingestion/shared/basics-extension.js.map +1 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response.d.ts +21 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response.js +33 -0
- package/dist/extensions/argument-ingestion/shared/finalize-response.js.map +1 -0
- package/dist/extensions/argument-ingestion/shared/role-derivation.d.ts +11 -0
- package/dist/extensions/argument-ingestion/shared/role-derivation.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/shared/role-derivation.js +26 -0
- package/dist/extensions/argument-ingestion/shared/role-derivation.js.map +1 -0
- package/dist/extensions/argument-ingestion/shared/types.d.ts +34 -0
- package/dist/extensions/argument-ingestion/shared/types.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/shared/types.js +16 -0
- package/dist/extensions/argument-ingestion/shared/types.js.map +1 -0
- package/dist/extensions/argument-ingestion/v1-single-shot.d.ts +18 -0
- package/dist/extensions/argument-ingestion/v1-single-shot.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/v1-single-shot.js +105 -0
- package/dist/extensions/argument-ingestion/v1-single-shot.js.map +1 -0
- package/dist/extensions/basics/schemata.d.ts +39 -0
- package/dist/extensions/basics/schemata.d.ts.map +1 -1
- package/dist/extensions/basics/schemata.js +21 -7
- package/dist/extensions/basics/schemata.js.map +1 -1
- package/dist/extensions/openai/errors.d.ts +49 -0
- package/dist/extensions/openai/errors.d.ts.map +1 -0
- package/dist/extensions/openai/errors.js +85 -0
- package/dist/extensions/openai/errors.js.map +1 -0
- package/dist/extensions/openai/index.d.ts +7 -0
- package/dist/extensions/openai/index.d.ts.map +1 -0
- package/dist/extensions/openai/index.js +10 -0
- package/dist/extensions/openai/index.js.map +1 -0
- package/dist/extensions/openai/provider.d.ts +22 -0
- package/dist/extensions/openai/provider.d.ts.map +1 -0
- package/dist/extensions/openai/provider.js +385 -0
- package/dist/extensions/openai/provider.js.map +1 -0
- package/dist/extensions/openai/structured-output.d.ts +18 -0
- package/dist/extensions/openai/structured-output.d.ts.map +1 -0
- package/dist/extensions/openai/structured-output.js +201 -0
- package/dist/extensions/openai/structured-output.js.map +1 -0
- package/dist/extensions/openai/types.d.ts +81 -0
- package/dist/extensions/openai/types.d.ts.map +1 -0
- package/dist/extensions/openai/types.js +21 -0
- package/dist/extensions/openai/types.js.map +1 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +15 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/llm/index.d.ts +2 -0
- package/dist/lib/llm/index.d.ts.map +1 -0
- package/dist/lib/llm/index.js +3 -0
- package/dist/lib/llm/index.js.map +1 -0
- package/dist/lib/llm/types.d.ts +49 -0
- package/dist/lib/llm/types.d.ts.map +1 -0
- package/dist/lib/llm/types.js +15 -0
- package/dist/lib/llm/types.js.map +1 -0
- package/dist/lib/pipelines/execute.d.ts +23 -0
- package/dist/lib/pipelines/execute.d.ts.map +1 -0
- package/dist/lib/pipelines/execute.js +541 -0
- package/dist/lib/pipelines/execute.js.map +1 -0
- package/dist/lib/pipelines/index.d.ts +7 -0
- package/dist/lib/pipelines/index.d.ts.map +1 -0
- package/dist/lib/pipelines/index.js +5 -0
- package/dist/lib/pipelines/index.js.map +1 -0
- package/dist/lib/pipelines/stage-helpers.d.ts +94 -0
- package/dist/lib/pipelines/stage-helpers.d.ts.map +1 -0
- package/dist/lib/pipelines/stage-helpers.js +384 -0
- package/dist/lib/pipelines/stage-helpers.js.map +1 -0
- package/dist/lib/pipelines/types.d.ts +108 -0
- package/dist/lib/pipelines/types.d.ts.map +1 -0
- package/dist/lib/pipelines/types.js +36 -0
- package/dist/lib/pipelines/types.js.map +1 -0
- package/package.json +14 -1
- package/dist/cli/llm/openai.d.ts +0 -4
- package/dist/cli/llm/openai.d.ts.map +0 -1
- package/dist/cli/llm/openai.js +0 -44
- package/dist/cli/llm/openai.js.map +0 -1
- package/dist/cli/llm/types.d.ts +0 -14
- package/dist/cli/llm/types.d.ts.map +0 -1
- package/dist/cli/llm/types.js +0 -2
- package/dist/cli/llm/types.js.map +0 -1
|
@@ -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;
|
|
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,CA0NxD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BasicsArgumentParser, BasicsParsingSchema, } from "../../extensions/basics/index.js";
|
|
1
|
+
import { BasicsArgumentParser } from "../../extensions/basics/index.js";
|
|
3
2
|
import { hydratePropositCore, persistEngine, persistCore } from "../engine.js";
|
|
4
3
|
import { PropositCore } from "../../lib/core/proposit-core.js";
|
|
5
4
|
import { ClaimLibrary } from "../../lib/core/claim-library.js";
|
|
@@ -7,6 +6,8 @@ import { ClaimCitationLibrary } from "../../lib/core/claim-citation-library.js";
|
|
|
7
6
|
import { cliLog } from "../logging.js";
|
|
8
7
|
import { errorExit, printJson, printLine, printWarning } from "../output.js";
|
|
9
8
|
import { resolveApiKey, createLlmProvider } from "../llm/index.js";
|
|
9
|
+
import { basicsExtension, createIngestionV1Pipeline, executePipeline, } from "../../lib/index.js";
|
|
10
|
+
const DEFAULT_PARSE_MODEL = "gpt-5.4";
|
|
10
11
|
class CliArgumentParser extends BasicsArgumentParser {
|
|
11
12
|
cliTitle;
|
|
12
13
|
cliDescription;
|
|
@@ -39,11 +40,23 @@ export function registerParseCommand(args) {
|
|
|
39
40
|
.option("--llm <provider>", "LLM provider name", "openai")
|
|
40
41
|
.option("--api-key <key>", "API key (overrides env var)")
|
|
41
42
|
.option("--model <model>", "Model override")
|
|
43
|
+
.option("--pipeline <version>", "Ingestion pipeline version (v1 only in Phase 1; v2 lands in Phase 2)", "v1")
|
|
42
44
|
.option("--title <title>", "Argument title (overrides LLM-generated title)")
|
|
43
45
|
.option("--description <desc>", "Argument description", "")
|
|
44
46
|
.option("--dry-run", "Print raw LLM JSON without persisting")
|
|
45
47
|
.action(async (text, opts) => {
|
|
46
|
-
// 1. Resolve
|
|
48
|
+
// 1. Resolve pipeline version. v1 is the only
|
|
49
|
+
// supported value in Phase 1; v2 lands in Phase 2
|
|
50
|
+
// (slice 2A) and is wired as a clean rejection
|
|
51
|
+
// until then so users discover the flag exists
|
|
52
|
+
// without silent fallbacks.
|
|
53
|
+
if (opts.pipeline !== "v1") {
|
|
54
|
+
if (opts.pipeline === "v2") {
|
|
55
|
+
errorExit("v2 pipeline not yet shipped — coming in Phase 2.");
|
|
56
|
+
}
|
|
57
|
+
errorExit(`Unknown pipeline version "${opts.pipeline}". Supported: v1.`);
|
|
58
|
+
}
|
|
59
|
+
// 2. Resolve API key
|
|
47
60
|
let apiKey;
|
|
48
61
|
try {
|
|
49
62
|
apiKey = resolveApiKey(opts.llm, opts.apiKey);
|
|
@@ -51,7 +64,7 @@ export function registerParseCommand(args) {
|
|
|
51
64
|
catch (error) {
|
|
52
65
|
errorExit(error instanceof Error ? error.message : String(error));
|
|
53
66
|
}
|
|
54
|
-
//
|
|
67
|
+
// 3. Resolve input text
|
|
55
68
|
let inputText;
|
|
56
69
|
if (text) {
|
|
57
70
|
inputText = text;
|
|
@@ -65,44 +78,66 @@ export function registerParseCommand(args) {
|
|
|
65
78
|
if (!inputText.trim()) {
|
|
66
79
|
errorExit("Input text is empty.");
|
|
67
80
|
}
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
const provider = createLlmProvider(opts.llm, {
|
|
73
|
-
|
|
74
|
-
model: opts.model,
|
|
81
|
+
// 4. Build the v1 ingestion pipeline and execute.
|
|
82
|
+
// The pipeline owns the LLM call + structured-
|
|
83
|
+
// output validation; the CLI is left with engine
|
|
84
|
+
// construction + persistence.
|
|
85
|
+
const provider = createLlmProvider(opts.llm, { apiKey });
|
|
86
|
+
const pipeline = createIngestionV1Pipeline(basicsExtension, {
|
|
87
|
+
model: opts.model ?? DEFAULT_PARSE_MODEL,
|
|
75
88
|
});
|
|
76
|
-
let
|
|
89
|
+
let pipelineResult;
|
|
77
90
|
try {
|
|
78
|
-
|
|
79
|
-
systemPrompt,
|
|
80
|
-
userMessage: inputText,
|
|
81
|
-
responseSchema,
|
|
82
|
-
});
|
|
91
|
+
pipelineResult = await executePipeline(pipeline, { text: inputText }, { llm: provider });
|
|
83
92
|
}
|
|
84
93
|
catch (error) {
|
|
85
94
|
const msg = error instanceof Error ? error.message : String(error);
|
|
86
|
-
await cliLog("parse:
|
|
95
|
+
await cliLog("parse:pipeline-error", { error: msg });
|
|
87
96
|
errorExit(msg);
|
|
88
97
|
}
|
|
98
|
+
// Forward-compatibility branch — `output === null` is
|
|
99
|
+
// not reachable under the v1 single-shot pipeline
|
|
100
|
+
// (the `parse-argument` stage either completes or
|
|
101
|
+
// throws via `LlmStageRetryExhaustedError`, both of
|
|
102
|
+
// which surface here as a failures-non-empty + null
|
|
103
|
+
// output OR an outer `executePipeline` throw caught
|
|
104
|
+
// above). Slice 2A's v2 multi-stage pipeline will
|
|
105
|
+
// reach this branch when its finalize returns null
|
|
106
|
+
// on irresolvable-conclusion / empty-canonicalization
|
|
107
|
+
// outcomes (per spec §7.5). Leave the branch wired
|
|
108
|
+
// so the v2 cutover doesn't need to revisit the CLI.
|
|
109
|
+
if (pipelineResult.output === null) {
|
|
110
|
+
const failureSummary = pipelineResult.failures
|
|
111
|
+
.map((f) => `[${f.code}] ${f.message}`)
|
|
112
|
+
.join("; ");
|
|
113
|
+
await cliLog("parse:pipeline-null-output", {
|
|
114
|
+
provider: opts.llm,
|
|
115
|
+
model: opts.model ?? "(default)",
|
|
116
|
+
failures: pipelineResult.failures,
|
|
117
|
+
});
|
|
118
|
+
errorExit(failureSummary ||
|
|
119
|
+
"Ingestion pipeline returned no output.");
|
|
120
|
+
}
|
|
121
|
+
const response = pipelineResult.output;
|
|
89
122
|
// 5. Log raw LLM response
|
|
90
123
|
await cliLog("parse:llm-response", {
|
|
91
124
|
provider: opts.llm,
|
|
92
125
|
model: opts.model ?? "(default)",
|
|
93
126
|
inputText,
|
|
94
|
-
response
|
|
127
|
+
response,
|
|
95
128
|
});
|
|
96
129
|
// 6. Dry-run: print raw response and exit
|
|
97
130
|
if (opts.dryRun) {
|
|
98
|
-
printJson(
|
|
131
|
+
printJson(response);
|
|
99
132
|
return;
|
|
100
133
|
}
|
|
101
|
-
// 7. Validate
|
|
134
|
+
// 7. Validate via the parser (re-validates against
|
|
135
|
+
// the parser's schema; idempotent in the happy
|
|
136
|
+
// path).
|
|
102
137
|
const parser = new CliArgumentParser(opts.title, opts.description);
|
|
103
|
-
let
|
|
138
|
+
let validated;
|
|
104
139
|
try {
|
|
105
|
-
|
|
140
|
+
validated = parser.validate(response);
|
|
106
141
|
}
|
|
107
142
|
catch (error) {
|
|
108
143
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -110,18 +145,18 @@ export function registerParseCommand(args) {
|
|
|
110
145
|
errorExit(`Validation failed: ${msg}`);
|
|
111
146
|
}
|
|
112
147
|
// 8. Check for null argument
|
|
113
|
-
if (
|
|
114
|
-
const msg =
|
|
148
|
+
if (validated.argument === null) {
|
|
149
|
+
const msg = validated.failureText ??
|
|
115
150
|
"The LLM could not parse the input as an argument.";
|
|
116
151
|
await cliLog("parse:null-argument", {
|
|
117
|
-
failureText:
|
|
152
|
+
failureText: validated.failureText,
|
|
118
153
|
});
|
|
119
154
|
errorExit(msg);
|
|
120
155
|
}
|
|
121
156
|
// 9. Build engine
|
|
122
157
|
let built;
|
|
123
158
|
try {
|
|
124
|
-
built = parser.build(
|
|
159
|
+
built = parser.build(validated, { strict: false });
|
|
125
160
|
}
|
|
126
161
|
catch (error) {
|
|
127
162
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/cli/commands/parse.ts"],"names":[],"mappings":"
|
|
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,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,S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AK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM;aAC1C;SACJ,CAAC,CAAA;QACF,MAAM,eAAe,GAAG,oBAAoB,CAAC,YAAY,CACrD;YACI,WAAW,EAAE;gBACT,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,WAAW;gBAC5C,GAAG,KAAK,CAAC,oBAAoB,CAAC,QAAQ,EAAE;qBACnC,WAAW;aACnB;SACJ,EACD,YAAY,CACf,CAAA;QAED,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC5B,YAAY,EAAE,YAAY;YAC1B,oBAAoB,EAAE,eAAe;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"}
|
package/dist/cli/llm/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type TCreateOpenAiResponsesProviderOptions } from "../../extensions/openai/index.js";
|
|
2
|
+
import type { TLlmProvider } from "../../lib/llm/index.js";
|
|
3
|
+
export declare const OPENAI_API_KEY_ENV = "OPENAI_API_KEY";
|
|
4
4
|
export declare function resolveApiKey(providerName: string, explicit?: string): string;
|
|
5
|
-
export
|
|
5
|
+
export type TCliLlmProviderOptions = Pick<TCreateOpenAiResponsesProviderOptions, "apiKey" | "baseUrl">;
|
|
6
|
+
export declare function createLlmProvider(name: string, options: TCliLlmProviderOptions): TLlmProvider;
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/llm/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/llm/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAEH,KAAK,qCAAqC,EAC7C,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAMlD,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAW7E;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACrC,qCAAqC,EACrC,QAAQ,GAAG,SAAS,CACvB,CAAA;AAED,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,GAChC,YAAY,CAYd"}
|
package/dist/cli/llm/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// CLI-side LLM factory.
|
|
2
|
+
//
|
|
3
|
+
// Slice 1B moved the concrete OpenAI provider into
|
|
4
|
+
// `src/extensions/openai/`. This module now provides only the CLI's
|
|
5
|
+
// API-key resolution + the named-provider factory; the provider
|
|
6
|
+
// itself is constructed from `createOpenAiResponsesProvider` in the
|
|
7
|
+
// extensions tree. Callers should depend on `TLlmProvider` (from
|
|
8
|
+
// `src/lib/llm/`) as their provider contract, not on this CLI
|
|
9
|
+
// factory's shape.
|
|
10
|
+
import { createOpenAiResponsesProvider, } from "../../extensions/openai/index.js";
|
|
11
|
+
export const OPENAI_API_KEY_ENV = "OPENAI_API_KEY";
|
|
3
12
|
const PROVIDER_ENV_VARS = {
|
|
4
13
|
openai: OPENAI_API_KEY_ENV,
|
|
5
14
|
};
|
|
@@ -18,7 +27,10 @@ export function resolveApiKey(providerName, explicit) {
|
|
|
18
27
|
export function createLlmProvider(name, options) {
|
|
19
28
|
switch (name) {
|
|
20
29
|
case "openai":
|
|
21
|
-
return
|
|
30
|
+
return createOpenAiResponsesProvider({
|
|
31
|
+
apiKey: options.apiKey,
|
|
32
|
+
baseUrl: options.baseUrl,
|
|
33
|
+
});
|
|
22
34
|
default:
|
|
23
35
|
throw new Error(`Unknown LLM provider "${name}". Supported: openai.`);
|
|
24
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/llm/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/llm/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,EAAE;AACF,mDAAmD;AACnD,oEAAoE;AACpE,gEAAgE;AAChE,oEAAoE;AACpE,iEAAiE;AACjE,8DAA8D;AAC9D,mBAAmB;AAEnB,OAAO,EACH,6BAA6B,GAEhC,MAAM,kCAAkC,CAAA;AAGzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAA;AAElD,MAAM,iBAAiB,GAA2B;IAC9C,MAAM,EAAE,kBAAkB;CAC7B,CAAA;AAED,MAAM,UAAU,aAAa,CAAC,YAAoB,EAAE,QAAiB;IACjE,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAC7B,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC9C,IAAI,MAAM,EAAE,CAAC;QACT,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACjC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAA;IAC3B,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACjD,MAAM,IAAI,KAAK,CACX,4BAA4B,YAAY,mBAAmB,OAAO,GAAG,CACxE,CAAA;AACL,CAAC;AAOD,MAAM,UAAU,iBAAiB,CAC7B,IAAY,EACZ,OAA+B;IAE/B,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,QAAQ;YACT,OAAO,6BAA6B,CAAC;gBACjC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;aAC3B,CAAC,CAAA;QACN;YACI,MAAM,IAAI,KAAK,CACX,yBAAyB,IAAI,uBAAuB,CACvD,CAAA;IACT,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { createIngestionV1Pipeline } from "./v1-single-shot.js";
|
|
2
|
+
export type { TCreateIngestionV1PipelineOptions } from "./v1-single-shot.js";
|
|
3
|
+
export { basicsExtension } from "./shared/basics-extension.js";
|
|
4
|
+
export type { TIngestionExtension, TIngestionInput } from "./shared/types.js";
|
|
5
|
+
export { finalizeResponse } from "./shared/finalize-response.js";
|
|
6
|
+
export type { TFinalizeResponseInput } from "./shared/finalize-response.js";
|
|
7
|
+
export { deriveRoles } from "./shared/role-derivation.js";
|
|
8
|
+
export type { TClaimRole, TDeriveRolesInput } from "./shared/role-derivation.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,YAAY,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Barrel for the argument-ingestion extension.
|
|
2
|
+
//
|
|
3
|
+
// Exposes the v1 single-shot pipeline factory + the default
|
|
4
|
+
// `basicsExtension`. v2 (Phase 2 / slice 2A) will add
|
|
5
|
+
// `createIngestionV2Pipeline` alongside the v1 entry-point; the
|
|
6
|
+
// `TIngestionExtension` descriptor is forward-compatible across both.
|
|
7
|
+
export { createIngestionV1Pipeline } from "./v1-single-shot.js";
|
|
8
|
+
export { basicsExtension } from "./shared/basics-extension.js";
|
|
9
|
+
export { finalizeResponse } from "./shared/finalize-response.js";
|
|
10
|
+
export { deriveRoles } from "./shared/role-derivation.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AACtD,gEAAgE;AAChE,sEAAsE;AAEtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TIngestionExtension } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default ingestion extension composing the `basics` per-entity
|
|
4
|
+
* fields. Matches what the CLI's `parse` command and the server's
|
|
5
|
+
* argument-ingestion endpoint use today. Hand to
|
|
6
|
+
* `createIngestionV1Pipeline(basicsExtension)` for a drop-in pipeline.
|
|
7
|
+
*/
|
|
8
|
+
export declare const basicsExtension: TIngestionExtension;
|
|
9
|
+
//# sourceMappingURL=basics-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basics-extension.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/basics-extension.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,mBAM7B,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// `basicsExtension` — the default `TIngestionExtension` value used by
|
|
2
|
+
// CLI / server consumers that don't ship a custom per-entity field
|
|
3
|
+
// set. Composes the per-entity extension shapes from
|
|
4
|
+
// `src/extensions/basics/schemata.ts` directly so the composite
|
|
5
|
+
// `BasicsParsingSchema` and the per-entity slots in this descriptor
|
|
6
|
+
// stay structurally identical without manual duplication.
|
|
7
|
+
//
|
|
8
|
+
// Slice 2A's multi-stage pipeline will consume the per-entity slots
|
|
9
|
+
// to wire decomposed stage outputs; for v1 only `responseSchema` is
|
|
10
|
+
// consumed by the factory.
|
|
11
|
+
import { BasicsArgumentExtension, BasicsClaimExtension, BasicsParsingSchema, BasicsPremiseExtension, BasicsVariableExtension, } from "../../basics/schemata.js";
|
|
12
|
+
/**
|
|
13
|
+
* Default ingestion extension composing the `basics` per-entity
|
|
14
|
+
* fields. Matches what the CLI's `parse` command and the server's
|
|
15
|
+
* argument-ingestion endpoint use today. Hand to
|
|
16
|
+
* `createIngestionV1Pipeline(basicsExtension)` for a drop-in pipeline.
|
|
17
|
+
*/
|
|
18
|
+
export const basicsExtension = {
|
|
19
|
+
responseSchema: BasicsParsingSchema,
|
|
20
|
+
claimSchema: BasicsClaimExtension,
|
|
21
|
+
variableSchema: BasicsVariableExtension,
|
|
22
|
+
premiseSchema: BasicsPremiseExtension,
|
|
23
|
+
argumentSchema: BasicsArgumentExtension,
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=basics-extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basics-extension.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/basics-extension.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,mEAAmE;AACnE,qDAAqD;AACrD,gEAAgE;AAChE,oEAAoE;AACpE,0DAA0D;AAC1D,EAAE;AACF,oEAAoE;AACpE,oEAAoE;AACpE,2BAA2B;AAE3B,OAAO,EACH,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,GAC1B,MAAM,0BAA0B,CAAA;AAGjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwB;IAChD,cAAc,EAAE,mBAAmB;IACnC,WAAW,EAAE,oBAAoB;IACjC,cAAc,EAAE,uBAAuB;IACvC,aAAa,EAAE,sBAAsB;IACrC,cAAc,EAAE,uBAAuB;CAC1C,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TParsedArgumentResponse } from "../../../lib/parsing/index.js";
|
|
2
|
+
import type { TProcessingFailure } from "../../../lib/pipelines/index.js";
|
|
3
|
+
export type TFinalizeResponseInput = {
|
|
4
|
+
/** Output of the single `parse-argument` llmStage in v1. */
|
|
5
|
+
parsedResponse: TParsedArgumentResponse;
|
|
6
|
+
/**
|
|
7
|
+
* Pipeline-level failures aggregated so far. v1's single stage
|
|
8
|
+
* either succeeds (empty array) or the executor skips finalize.
|
|
9
|
+
* v2 stages will add warnings/errors here.
|
|
10
|
+
*/
|
|
11
|
+
failures: readonly TProcessingFailure[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Wire the per-stage outputs into the final response shape. v1's
|
|
15
|
+
* implementation is a passthrough of `parsedResponse` with the v1's
|
|
16
|
+
* empty `processingFailures` slot wired through. Returning a plain
|
|
17
|
+
* `TParsedArgumentResponse` keeps the existing `ArgumentParser.build()`
|
|
18
|
+
* consumer path unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export declare function finalizeResponse(input: TFinalizeResponseInput): TParsedArgumentResponse;
|
|
21
|
+
//# sourceMappingURL=finalize-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-response.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/finalize-response.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEzE,MAAM,MAAM,sBAAsB,GAAG;IACjC,4DAA4D;IAC5D,cAAc,EAAE,uBAAuB,CAAA;IACvC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAC1C,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,sBAAsB,GAC9B,uBAAuB,CAczB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// `finalize-response` — assembles the final `TParsedArgumentResponse`
|
|
2
|
+
// from per-stage outputs accumulated by the pipeline executor.
|
|
3
|
+
//
|
|
4
|
+
// v1 is a single-shot pipeline: the LLM emits the full response in
|
|
5
|
+
// one call, the `parse-argument` stage outputs that response verbatim,
|
|
6
|
+
// and `finalize` just attaches an empty `processingFailures` array
|
|
7
|
+
// (a forward-compat slot reserved for v2's per-stage failure aggregation).
|
|
8
|
+
//
|
|
9
|
+
// v2 will do most of the assembly here: each per-stage output
|
|
10
|
+
// (claims, variables, premises, conclusion selection, …) is merged
|
|
11
|
+
// into a single response and per-stage failures get folded into
|
|
12
|
+
// `processingFailures`. Today the function is intentionally trivial.
|
|
13
|
+
/**
|
|
14
|
+
* Wire the per-stage outputs into the final response shape. v1's
|
|
15
|
+
* implementation is a passthrough of `parsedResponse` with the v1's
|
|
16
|
+
* empty `processingFailures` slot wired through. Returning a plain
|
|
17
|
+
* `TParsedArgumentResponse` keeps the existing `ArgumentParser.build()`
|
|
18
|
+
* consumer path unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export function finalizeResponse(input) {
|
|
21
|
+
const passthrough = {
|
|
22
|
+
...input.parsedResponse,
|
|
23
|
+
};
|
|
24
|
+
// Reserve a `processingFailures` slot on the response. Today
|
|
25
|
+
// `TParsedArgumentResponse` carries `additionalProperties: true`
|
|
26
|
+
// so attaching this field is type-safe at runtime; v2 will
|
|
27
|
+
// populate it from real stage warnings/errors. v1 always emits
|
|
28
|
+
// an empty array so server-side consumers can rely on the slot
|
|
29
|
+
// being present.
|
|
30
|
+
passthrough.processingFailures = [...input.failures];
|
|
31
|
+
return passthrough;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=finalize-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-response.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/finalize-response.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,+DAA+D;AAC/D,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,mEAAmE;AACnE,2EAA2E;AAC3E,EAAE;AACF,8DAA8D;AAC9D,mEAAmE;AACnE,gEAAgE;AAChE,qEAAqE;AAgBrE;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC5B,KAA6B;IAE7B,MAAM,WAAW,GAAG;QAChB,GAAG,KAAK,CAAC,cAAc;KAG1B,CAAA;IACD,6DAA6D;IAC7D,iEAAiE;IACjE,2DAA2D;IAC3D,+DAA+D;IAC/D,+DAA+D;IAC/D,iBAAiB;IACjB,WAAW,CAAC,kBAAkB,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAA;IACpD,OAAO,WAAW,CAAA;AACtB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TParsedClaim } from "../../../lib/parsing/index.js";
|
|
2
|
+
export type TClaimRole = "conclusion" | "premise" | "intermediate";
|
|
3
|
+
export type TDeriveRolesInput = {
|
|
4
|
+
claims: readonly TParsedClaim[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Returns a `claimMiniId -> role` map. v1 trusts the LLM's
|
|
8
|
+
* self-assigned roles; v2 will compute roles from premise relations.
|
|
9
|
+
*/
|
|
10
|
+
export declare function deriveRoles(input: TDeriveRolesInput): Record<string, TClaimRole>;
|
|
11
|
+
//# sourceMappingURL=role-derivation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-derivation.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/role-derivation.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,CAAA;AAElE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACvB,KAAK,EAAE,iBAAiB,GACzB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAM5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// `role-derivation` — pure helper that assigns each claim a role
|
|
2
|
+
// (`'conclusion'` | `'premise'` | `'intermediate'`) given the
|
|
3
|
+
// argument's premise/variable graph + the selected conclusion premise.
|
|
4
|
+
//
|
|
5
|
+
// v1 is trivial: the LLM already emits per-claim roles in its
|
|
6
|
+
// `parsed.argument.claims[].role` field; v1's pipeline just trusts
|
|
7
|
+
// that assignment and `deriveRoles` returns the LLM-provided map.
|
|
8
|
+
//
|
|
9
|
+
// v2 will derive roles from the relations graph + selected conclusion
|
|
10
|
+
// (the LLM no longer self-assigns roles in the multi-stage pipeline).
|
|
11
|
+
// The helper signature is forward-compatible: it accepts a generic
|
|
12
|
+
// `claims` collection plus the selected conclusion premise miniId and
|
|
13
|
+
// the per-premise variable wiring, so v2 can swap in a real
|
|
14
|
+
// derivation without breaking v1 callers.
|
|
15
|
+
/**
|
|
16
|
+
* Returns a `claimMiniId -> role` map. v1 trusts the LLM's
|
|
17
|
+
* self-assigned roles; v2 will compute roles from premise relations.
|
|
18
|
+
*/
|
|
19
|
+
export function deriveRoles(input) {
|
|
20
|
+
const out = {};
|
|
21
|
+
for (const claim of input.claims) {
|
|
22
|
+
out[claim.miniId] = claim.role;
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=role-derivation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-derivation.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/role-derivation.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,8DAA8D;AAC9D,uEAAuE;AACvE,EAAE;AACF,8DAA8D;AAC9D,mEAAmE;AACnE,kEAAkE;AAClE,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,mEAAmE;AACnE,sEAAsE;AACtE,4DAA4D;AAC5D,0CAA0C;AAU1C;;;GAGG;AACH,MAAM,UAAU,WAAW,CACvB,KAAwB;IAExB,MAAM,GAAG,GAA+B,EAAE,CAAA;IAC1C,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/B,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAA;IAClC,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TSchema } from "typebox";
|
|
2
|
+
/**
|
|
3
|
+
* Bundle of TypeBox schemas a caller hands to an ingestion pipeline
|
|
4
|
+
* factory. Only `responseSchema` is consumed by v1; the per-entity
|
|
5
|
+
* slots are forward-compat surface for v2's stage decomposition (see
|
|
6
|
+
* Phase 2 / slice 2A).
|
|
7
|
+
*
|
|
8
|
+
* `responseSchema` is the full `TParsedArgumentResponse` shape with
|
|
9
|
+
* any caller extensions merged in — typically built via
|
|
10
|
+
* `buildParsingResponseSchema({ claimSchema, premiseSchema,
|
|
11
|
+
* parsedArgumentSchema })` from `src/lib/parsing/`.
|
|
12
|
+
*/
|
|
13
|
+
export type TIngestionExtension = {
|
|
14
|
+
/** Full extended TParsedArgumentResponse schema (the LLM's output schema). */
|
|
15
|
+
responseSchema: TSchema;
|
|
16
|
+
/** Extension shape for individual claims (Type.Object or discriminated Type.Union of Type.Objects). */
|
|
17
|
+
claimSchema: TSchema;
|
|
18
|
+
/** Extension shape for individual variables. */
|
|
19
|
+
variableSchema: TSchema;
|
|
20
|
+
/** Extension shape for individual premises. */
|
|
21
|
+
premiseSchema: TSchema;
|
|
22
|
+
/** Extension shape for the top-level argument object. */
|
|
23
|
+
argumentSchema: TSchema;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Input shape every ingestion pipeline accepts: the raw natural-
|
|
27
|
+
* language text to parse. Wrapped in an object so future v2 stages
|
|
28
|
+
* can attach side-input (per-stage hints, prior corrections, …)
|
|
29
|
+
* without breaking the wire-shape.
|
|
30
|
+
*/
|
|
31
|
+
export type TIngestionInput = {
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/types.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,8EAA8E;IAC9E,cAAc,EAAE,OAAO,CAAA;IACvB,uGAAuG;IACvG,WAAW,EAAE,OAAO,CAAA;IACpB,gDAAgD;IAChD,cAAc,EAAE,OAAO,CAAA;IACvB,+CAA+C;IAC/C,aAAa,EAAE,OAAO,CAAA;IACtB,yDAAyD;IACzD,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Shared types for the argument-ingestion extension.
|
|
2
|
+
//
|
|
3
|
+
// The v1 single-shot pipeline and the (future) v2 multi-stage pipeline
|
|
4
|
+
// both produce a `TParsedArgumentResponse`-shaped output that the
|
|
5
|
+
// existing `ArgumentParser.build()` consumes. They share an extension
|
|
6
|
+
// descriptor — `TIngestionExtension` — so callers can plug in custom
|
|
7
|
+
// per-entity field shapes (titles, bodies, URLs, axiom labels, …)
|
|
8
|
+
// without reimplementing the pipelines.
|
|
9
|
+
//
|
|
10
|
+
// For v1 the descriptor is consumed in exactly one place:
|
|
11
|
+
// `createIngestionV1Pipeline` reads `responseSchema` and hands it to
|
|
12
|
+
// the single `llmStage`'s `outputSchema` (and to `buildParsingPrompt`
|
|
13
|
+
// for system-prompt construction). The per-entity slots are retained
|
|
14
|
+
// in the descriptor so v2 stages can compose them.
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/shared/types.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,sEAAsE;AACtE,qEAAqE;AACrE,kEAAkE;AAClE,wCAAwC;AACxC,EAAE;AACF,0DAA0D;AAC1D,qEAAqE;AACrE,sEAAsE;AACtE,qEAAqE;AACrE,mDAAmD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TPipeline } from "../../lib/pipelines/index.js";
|
|
2
|
+
import type { TParsedArgumentResponse } from "../../lib/parsing/index.js";
|
|
3
|
+
import type { TIngestionExtension, TIngestionInput } from "./shared/types.js";
|
|
4
|
+
export type TCreateIngestionV1PipelineOptions = {
|
|
5
|
+
/** Override the default `gpt-5.4` model. */
|
|
6
|
+
model?: string;
|
|
7
|
+
/** Optional caller-supplied custom-instructions appendix. */
|
|
8
|
+
customInstructions?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Build the v1 ingestion pipeline for the supplied extension.
|
|
12
|
+
*
|
|
13
|
+
* The returned `TPipeline` accepts a `{ text }` input, calls one
|
|
14
|
+
* `llmStage` against `extension.responseSchema`, and finalizes into
|
|
15
|
+
* the parser-consumable `TParsedArgumentResponse` shape.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createIngestionV1Pipeline(extension: TIngestionExtension, options?: TCreateIngestionV1PipelineOptions): TPipeline<TIngestionInput, TParsedArgumentResponse>;
|
|
18
|
+
//# sourceMappingURL=v1-single-shot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v1-single-shot.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v1-single-shot.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAEzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAQ7E,MAAM,MAAM,iCAAiC,GAAG;IAC5C,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,iCAAiC,GAC5C,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAkErD"}
|