@openapi-flow/langchain 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +152 -2
- package/THIRD_PARTY_NOTICES.md +3 -0
- package/dist/arguments/analyze-api-input-answers.d.ts +3 -0
- package/dist/arguments/analyze-api-input-answers.js +87 -0
- package/dist/arguments/analyze-api-request-media-type.d.ts +4 -0
- package/dist/arguments/analyze-api-request-media-type.js +50 -0
- package/dist/arguments/extract-api-input-answers.d.ts +3 -0
- package/dist/arguments/extract-api-input-answers.js +4 -0
- package/dist/arguments/generate-api-arguments.d.ts +3 -0
- package/dist/arguments/generate-api-arguments.js +60 -0
- package/dist/arguments/select-api-request-media-type.d.ts +2 -0
- package/dist/arguments/select-api-request-media-type.js +10 -0
- package/dist/bindings/plan-api-bindings.d.ts +3 -0
- package/dist/bindings/plan-api-bindings.js +50 -0
- package/dist/draft/analyze-workflow-draft-edit.d.ts +4 -0
- package/dist/draft/analyze-workflow-draft-edit.js +84 -0
- package/dist/draft/generate-workflow-draft-api-call-arguments.d.ts +3 -0
- package/dist/draft/generate-workflow-draft-api-call-arguments.js +88 -0
- package/dist/draft/generate-workflow-draft-api-input-edits.d.ts +4 -0
- package/dist/draft/generate-workflow-draft-api-input-edits.js +58 -0
- package/dist/draft/generate-workflow-draft-native-node-addition.d.ts +4 -0
- package/dist/draft/generate-workflow-draft-native-node-addition.js +137 -0
- package/dist/draft/generate-workflow-draft-native-parameter-edits.d.ts +3 -0
- package/dist/draft/generate-workflow-draft-native-parameter-edits.js +71 -0
- package/dist/draft/plan-workflow-draft-api-binding-edit.d.ts +4 -0
- package/dist/draft/plan-workflow-draft-api-binding-edit.js +103 -0
- package/dist/draft/plan-workflow-draft-api-call-bindings.d.ts +3 -0
- package/dist/draft/plan-workflow-draft-api-call-bindings.js +114 -0
- package/dist/draft/plan-workflow-draft-clarification-scopes.d.ts +4 -0
- package/dist/draft/plan-workflow-draft-clarification-scopes.js +77 -0
- package/dist/draft/plan-workflow-draft-connection-edit.d.ts +4 -0
- package/dist/draft/plan-workflow-draft-connection-edit.js +79 -0
- package/dist/draft/plan-workflow-draft-native-dependencies.d.ts +4 -0
- package/dist/draft/plan-workflow-draft-native-dependencies.js +45 -0
- package/dist/draft/plan-workflow-draft-native-reference-repair.d.ts +4 -0
- package/dist/draft/plan-workflow-draft-native-reference-repair.js +68 -0
- package/dist/draft/resolve-workflow-draft-edit-proposal.d.ts +3 -0
- package/dist/draft/resolve-workflow-draft-edit-proposal.js +39 -0
- package/dist/draft/select-workflow-draft-api-binding-inputs.d.ts +4 -0
- package/dist/draft/select-workflow-draft-api-binding-inputs.js +83 -0
- package/dist/draft/select-workflow-draft-api-input-edit-targets.d.ts +4 -0
- package/dist/draft/select-workflow-draft-api-input-edit-targets.js +55 -0
- package/dist/draft/select-workflow-draft-native-node-parameter-ownership.d.ts +4 -0
- package/dist/draft/select-workflow-draft-native-node-parameter-ownership.js +81 -0
- package/dist/draft/select-workflow-draft-native-parameter-edit-targets.d.ts +3 -0
- package/dist/draft/select-workflow-draft-native-parameter-edit-targets.js +51 -0
- package/dist/draft/workflow-draft-api-binding-edit-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-api-binding-edit-planning-error.js +10 -0
- package/dist/draft/workflow-draft-api-call-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-api-call-planning-error.js +10 -0
- package/dist/draft/workflow-draft-api-input-edit-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-api-input-edit-planning-error.js +10 -0
- package/dist/draft/workflow-draft-clarification-scope-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-clarification-scope-planning-error.js +8 -0
- package/dist/draft/workflow-draft-connection-edit-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-connection-edit-planning-error.js +10 -0
- package/dist/draft/workflow-draft-edit-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-edit-planning-error.js +8 -0
- package/dist/draft/workflow-draft-native-node-addition-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-native-node-addition-planning-error.js +10 -0
- package/dist/draft/workflow-draft-native-parameter-edit-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-native-parameter-edit-planning-error.js +8 -0
- package/dist/draft/workflow-draft-native-reference-repair-planning-error.d.ts +5 -0
- package/dist/draft/workflow-draft-native-reference-repair-planning-error.js +8 -0
- package/dist/legacy/planning/operation-plan-inputs.d.ts +3 -0
- package/dist/legacy/planning/operation-plan-inputs.js +17 -0
- package/dist/legacy/planning/parse-structured-output.d.ts +2 -0
- package/dist/legacy/planning/parse-structured-output.js +9 -0
- package/dist/legacy/planning/propose-catalog-scenario.d.ts +3 -0
- package/dist/legacy/planning/propose-catalog-scenario.js +136 -0
- package/dist/legacy/planning/select-operation.d.ts +4 -0
- package/dist/legacy/planning/select-operation.js +43 -0
- package/dist/legacy/schemas/catalog-selection-schema.d.ts +19 -0
- package/dist/legacy/schemas/catalog-selection-schema.js +39 -0
- package/dist/legacy/schemas/catalog-step-schema.d.ts +16 -0
- package/dist/legacy/schemas/catalog-step-schema.js +39 -0
- package/dist/legacy/schemas/operation-selection-schema.d.ts +6 -0
- package/dist/legacy/schemas/operation-selection-schema.js +14 -0
- package/dist/legacy-api.d.ts +9 -0
- package/dist/legacy-api.js +7 -0
- package/dist/prompts/api-arguments-prompt.d.ts +1 -0
- package/dist/prompts/api-arguments-prompt.js +1 -0
- package/dist/prompts/api-bindings-prompt.d.ts +1 -0
- package/dist/prompts/api-bindings-prompt.js +13 -0
- package/dist/prompts/api-input-answers-prompt.d.ts +1 -0
- package/dist/prompts/api-input-answers-prompt.js +7 -0
- package/dist/prompts/api-request-media-type-prompt.d.ts +1 -0
- package/dist/prompts/api-request-media-type-prompt.js +1 -0
- package/dist/prompts/api-selection-analysis-prompt.d.ts +1 -0
- package/dist/prompts/api-selection-analysis-prompt.js +5 -0
- package/dist/prompts/api-selection-explanation-prompt.d.ts +1 -0
- package/dist/prompts/api-selection-explanation-prompt.js +1 -0
- package/dist/prompts/native-instance-dependencies-prompt.d.ts +1 -0
- package/dist/prompts/native-instance-dependencies-prompt.js +8 -0
- package/dist/prompts/native-node-planning-prompt.d.ts +3 -0
- package/dist/prompts/native-node-planning-prompt.js +22 -0
- package/dist/prompts/operation-selection-prompt.d.ts +1 -0
- package/dist/prompts/operation-selection-prompt.js +1 -0
- package/dist/prompts/reviewable-workflow-graph-prompt.d.ts +1 -0
- package/dist/prompts/reviewable-workflow-graph-prompt.js +7 -0
- package/dist/prompts/workflow-connections-prompt.d.ts +1 -0
- package/dist/prompts/workflow-connections-prompt.js +11 -0
- package/dist/prompts/workflow-draft-api-binding-edit-prompt.d.ts +1 -0
- package/dist/prompts/workflow-draft-api-binding-edit-prompt.js +9 -0
- package/dist/prompts/workflow-draft-api-call-planning-prompt.d.ts +3 -0
- package/dist/prompts/workflow-draft-api-call-planning-prompt.js +39 -0
- package/dist/prompts/workflow-draft-api-input-edit-prompt.d.ts +2 -0
- package/dist/prompts/workflow-draft-api-input-edit-prompt.js +14 -0
- package/dist/prompts/workflow-draft-clarification-scope-prompt.d.ts +1 -0
- package/dist/prompts/workflow-draft-clarification-scope-prompt.js +10 -0
- package/dist/prompts/workflow-draft-connection-edit-prompt.d.ts +1 -0
- package/dist/prompts/workflow-draft-connection-edit-prompt.js +7 -0
- package/dist/prompts/workflow-draft-edit-prompt.d.ts +1 -0
- package/dist/prompts/workflow-draft-edit-prompt.js +15 -0
- package/dist/prompts/workflow-draft-native-dependencies-prompt.d.ts +1 -0
- package/dist/prompts/workflow-draft-native-dependencies-prompt.js +5 -0
- package/dist/prompts/workflow-draft-native-node-addition-prompt.d.ts +2 -0
- package/dist/prompts/workflow-draft-native-node-addition-prompt.js +6 -0
- package/dist/prompts/workflow-draft-native-parameter-edit-prompt.d.ts +2 -0
- package/dist/prompts/workflow-draft-native-parameter-edit-prompt.js +2 -0
- package/dist/prompts/workflow-draft-native-reference-repair-prompt.d.ts +1 -0
- package/dist/prompts/workflow-draft-native-reference-repair-prompt.js +7 -0
- package/dist/prompts/workflow-graph-prompt.d.ts +1 -0
- package/dist/prompts/workflow-graph-prompt.js +15 -0
- package/dist/prompts/workflow-requirements-prompt.d.ts +1 -0
- package/dist/prompts/workflow-requirements-prompt.js +14 -0
- package/dist/prompts/workflow-review-suggestions-prompt.d.ts +1 -0
- package/dist/prompts/workflow-review-suggestions-prompt.js +4 -0
- package/dist/prompts/workflow-user-action-evidence-prompt.d.ts +1 -0
- package/dist/prompts/workflow-user-action-evidence-prompt.js +1 -0
- package/dist/public-api.d.ts +67 -0
- package/dist/public-api.js +46 -0
- package/dist/requirements/clarify-workflow-requirements.d.ts +4 -0
- package/dist/requirements/clarify-workflow-requirements.js +53 -0
- package/dist/requirements/resolve-workflow-requirements-evidence.d.ts +4 -0
- package/dist/requirements/resolve-workflow-requirements-evidence.js +58 -0
- package/dist/review/suggest-workflow-review-follow-ups.d.ts +4 -0
- package/dist/review/suggest-workflow-review-follow-ups.js +87 -0
- package/dist/review/workflow-review-suggestion-planning-error.d.ts +5 -0
- package/dist/review/workflow-review-suggestion-planning-error.js +8 -0
- package/dist/schemas/api-binding-plan-schema.d.ts +8 -0
- package/dist/schemas/api-binding-plan-schema.js +59 -0
- package/dist/schemas/api-input-answer-source-schema.d.ts +16 -0
- package/dist/schemas/api-input-answer-source-schema.js +28 -0
- package/dist/schemas/api-literal-generation-output-schema.d.ts +11 -0
- package/dist/schemas/api-literal-generation-output-schema.js +20 -0
- package/dist/schemas/api-request-media-type-schema.d.ts +6 -0
- package/dist/schemas/api-request-media-type-schema.js +23 -0
- package/dist/schemas/api-selection-analysis-schema.d.ts +41 -0
- package/dist/schemas/api-selection-analysis-schema.js +23 -0
- package/dist/schemas/api-selection-options-schema.d.ts +4 -0
- package/dist/schemas/api-selection-options-schema.js +4 -0
- package/dist/schemas/api-selection-schema.d.ts +25 -0
- package/dist/schemas/api-selection-schema.js +31 -0
- package/dist/schemas/create-workflow-message-evidence-selection-schema.d.ts +16 -0
- package/dist/schemas/create-workflow-message-evidence-selection-schema.js +22 -0
- package/dist/schemas/native-node-explanation-schema.d.ts +5 -0
- package/dist/schemas/native-node-explanation-schema.js +9 -0
- package/dist/schemas/native-node-parameter-contract.d.ts +3 -0
- package/dist/schemas/native-node-parameter-contract.js +30 -0
- package/dist/schemas/native-node-planning-contract.d.ts +3 -0
- package/dist/schemas/native-node-planning-contract.js +44 -0
- package/dist/schemas/request-media-selection-options-schema.d.ts +4 -0
- package/dist/schemas/request-media-selection-options-schema.js +4 -0
- package/dist/schemas/reviewable-workflow-graph-schema.d.ts +6 -0
- package/dist/schemas/reviewable-workflow-graph-schema.js +75 -0
- package/dist/schemas/serialize-structured-output-schema.d.ts +5 -0
- package/dist/schemas/serialize-structured-output-schema.js +10 -0
- package/dist/schemas/serialize-workflow-requirements-schema.d.ts +4 -0
- package/dist/schemas/serialize-workflow-requirements-schema.js +5 -0
- package/dist/schemas/with-api-selection-explanation.d.ts +10 -0
- package/dist/schemas/with-api-selection-explanation.js +15 -0
- package/dist/schemas/workflow-connection-explanation-schema.d.ts +5 -0
- package/dist/schemas/workflow-connection-explanation-schema.js +9 -0
- package/dist/schemas/workflow-draft-edit-schema.d.ts +3 -0
- package/dist/schemas/workflow-draft-edit-schema.js +17 -0
- package/dist/schemas/workflow-graph-explanation-schema.d.ts +5 -0
- package/dist/schemas/workflow-graph-explanation-schema.js +9 -0
- package/dist/schemas/workflow-graph-proposal-schema.d.ts +4 -0
- package/dist/schemas/workflow-graph-proposal-schema.js +45 -0
- package/dist/schemas/workflow-planning-evidence-schemas.d.ts +20 -0
- package/dist/schemas/workflow-planning-evidence-schemas.js +44 -0
- package/dist/schemas/workflow-requirements-schema.d.ts +3 -0
- package/dist/schemas/workflow-requirements-schema.js +6 -0
- package/dist/schemas/workflow-review-suggestions-schema.d.ts +4 -0
- package/dist/schemas/workflow-review-suggestions-schema.js +18 -0
- package/dist/selection/analyze-api-selection.d.ts +4 -0
- package/dist/selection/analyze-api-selection.js +117 -0
- package/dist/selection/resolve-api-selection-options.d.ts +3 -0
- package/dist/selection/resolve-api-selection-options.js +6 -0
- package/dist/selection/select-api-operations.d.ts +3 -0
- package/dist/selection/select-api-operations.js +84 -0
- package/dist/types/api-input-answers.d.ts +16 -0
- package/dist/types/api-input-answers.js +1 -0
- package/dist/types/api-selection-analysis.d.ts +3 -0
- package/dist/types/api-selection-analysis.js +1 -0
- package/dist/types/argument-generation.d.ts +13 -0
- package/dist/types/argument-generation.js +1 -0
- package/dist/types/binding-planning.d.ts +10 -0
- package/dist/types/binding-planning.js +1 -0
- package/dist/types/legacy/catalog-planning.d.ts +16 -0
- package/dist/types/legacy/catalog-planning.js +1 -0
- package/dist/types/legacy/planning.d.ts +5 -0
- package/dist/types/legacy/planning.js +1 -0
- package/dist/types/native-node-planning.d.ts +76 -0
- package/dist/types/native-node-planning.js +1 -0
- package/dist/types/operation-selection.d.ts +14 -0
- package/dist/types/operation-selection.js +1 -0
- package/dist/types/request-media-selection.d.ts +15 -0
- package/dist/types/request-media-selection.js +1 -0
- package/dist/types/reviewable-workflow-planning.d.ts +28 -0
- package/dist/types/reviewable-workflow-planning.js +1 -0
- package/dist/types/structured-output-schema.d.ts +3 -0
- package/dist/types/structured-output-schema.js +1 -0
- package/dist/types/workflow-clarification.d.ts +23 -0
- package/dist/types/workflow-clarification.js +1 -0
- package/dist/types/workflow-draft-api-binding-edit.d.ts +9 -0
- package/dist/types/workflow-draft-api-binding-edit.js +1 -0
- package/dist/types/workflow-draft-api-call-planning.d.ts +15 -0
- package/dist/types/workflow-draft-api-call-planning.js +1 -0
- package/dist/types/workflow-draft-api-input-edit.d.ts +13 -0
- package/dist/types/workflow-draft-api-input-edit.js +1 -0
- package/dist/types/workflow-draft-clarification.d.ts +9 -0
- package/dist/types/workflow-draft-clarification.js +1 -0
- package/dist/types/workflow-draft-connection-edit.d.ts +9 -0
- package/dist/types/workflow-draft-connection-edit.js +1 -0
- package/dist/types/workflow-draft-edit.d.ts +16 -0
- package/dist/types/workflow-draft-edit.js +1 -0
- package/dist/types/workflow-draft-native-node-addition.d.ts +18 -0
- package/dist/types/workflow-draft-native-node-addition.js +1 -0
- package/dist/types/workflow-draft-native-parameter-edit.d.ts +13 -0
- package/dist/types/workflow-draft-native-parameter-edit.js +1 -0
- package/dist/types/workflow-draft-native-reference-repair.d.ts +9 -0
- package/dist/types/workflow-draft-native-reference-repair.js +1 -0
- package/dist/types/workflow-message-evidence-selection.d.ts +6 -0
- package/dist/types/workflow-message-evidence-selection.js +1 -0
- package/dist/types/workflow-orchestration.d.ts +21 -0
- package/dist/types/workflow-orchestration.js +1 -0
- package/dist/types/workflow-planning.d.ts +35 -0
- package/dist/types/workflow-planning.js +1 -0
- package/dist/types/workflow-review-suggestions.d.ts +12 -0
- package/dist/types/workflow-review-suggestions.js +1 -0
- package/dist/workflow/complete-reviewable-workflow-graph-proposal.d.ts +4 -0
- package/dist/workflow/complete-reviewable-workflow-graph-proposal.js +13 -0
- package/dist/workflow/generate-native-node-parameters.d.ts +4 -0
- package/dist/workflow/generate-native-node-parameters.js +87 -0
- package/dist/workflow/native-node-planning-error.d.ts +5 -0
- package/dist/workflow/native-node-planning-error.js +10 -0
- package/dist/workflow/orchestrate-workflow.d.ts +4 -0
- package/dist/workflow/orchestrate-workflow.js +31 -0
- package/dist/workflow/plan-native-instance-dependencies.d.ts +4 -0
- package/dist/workflow/plan-native-instance-dependencies.js +45 -0
- package/dist/workflow/plan-native-nodes.d.ts +2 -0
- package/dist/workflow/plan-native-nodes.js +96 -0
- package/dist/workflow/plan-reviewable-workflow-graph.d.ts +3 -0
- package/dist/workflow/plan-reviewable-workflow-graph.js +70 -0
- package/dist/workflow/plan-workflow-connections.d.ts +3 -0
- package/dist/workflow/plan-workflow-connections.js +67 -0
- package/dist/workflow/plan-workflow-graph.d.ts +3 -0
- package/dist/workflow/plan-workflow-graph.js +80 -0
- package/dist/workflow/resolve-native-node-parameter-source.d.ts +4 -0
- package/dist/workflow/resolve-native-node-parameter-source.js +7 -0
- package/dist/workflow/resolve-native-node-planning-output.d.ts +3 -0
- package/dist/workflow/resolve-native-node-planning-output.js +33 -0
- package/dist/workflow/resolve-workflow-connection-output.d.ts +3 -0
- package/dist/workflow/resolve-workflow-connection-output.js +22 -0
- package/dist/workflow/resolve-workflow-graph-output.d.ts +5 -0
- package/dist/workflow/resolve-workflow-graph-output.js +69 -0
- package/dist/workflow/reviewable-workflow-graph-planning-error.d.ts +5 -0
- package/dist/workflow/reviewable-workflow-graph-planning-error.js +8 -0
- package/dist/workflow/select-native-node-instances.d.ts +4 -0
- package/dist/workflow/select-native-node-instances.js +57 -0
- package/dist/workflow/workflow-graph-planning-error.d.ts +5 -0
- package/dist/workflow/workflow-graph-planning-error.js +10 -0
- package/package.json +47 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
3
|
+
import { describeApiSelectionContext, createApiSelectionExplanation, } from '@openapi-flow/core';
|
|
4
|
+
import { createApiSelectionAnalysisSchema } from '../schemas/api-selection-analysis-schema.js';
|
|
5
|
+
import { apiSelectionAnalysisPrompt } from '../prompts/api-selection-analysis-prompt.js';
|
|
6
|
+
import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
|
|
7
|
+
import { assertSelectionInput } from '../legacy/planning/select-operation.js';
|
|
8
|
+
import { selectApiOperations } from './select-api-operations.js';
|
|
9
|
+
import { resolveApiSelectionOptions } from './resolve-api-selection-options.js';
|
|
10
|
+
import { apiSelectionExplanationPrompt } from '../prompts/api-selection-explanation-prompt.js';
|
|
11
|
+
/** Additive clarification boundary; the existing selector keeps its output contract. */
|
|
12
|
+
export async function analyzeApiSelection(input) {
|
|
13
|
+
assertSelectionInput(input.scenario, input.model);
|
|
14
|
+
if (!Array.isArray(input.operations))
|
|
15
|
+
throw new Error('operations must be an array');
|
|
16
|
+
const includeExplanations = resolveApiSelectionOptions({
|
|
17
|
+
includeExplanations: input.includeExplanations,
|
|
18
|
+
});
|
|
19
|
+
const context = describeApiSelectionContext({
|
|
20
|
+
scenario: input.scenario,
|
|
21
|
+
operations: input.operations,
|
|
22
|
+
});
|
|
23
|
+
if (!input.operations.length)
|
|
24
|
+
return { selection: await selectApiOperations(input), questions: [] };
|
|
25
|
+
const candidates = context.operations.map((operation, index) => ({
|
|
26
|
+
...operation,
|
|
27
|
+
candidateId: `candidate-${index + 1}`,
|
|
28
|
+
}));
|
|
29
|
+
const schema = createApiSelectionAnalysisSchema(candidates.map((item) => item.candidateId), includeExplanations);
|
|
30
|
+
const proposed = await input.model
|
|
31
|
+
.withStructuredOutput(schema, {
|
|
32
|
+
name: 'analyze_api_selection',
|
|
33
|
+
method: 'jsonSchema',
|
|
34
|
+
strict: true,
|
|
35
|
+
})
|
|
36
|
+
.invoke([
|
|
37
|
+
new SystemMessage(`${apiSelectionAnalysisPrompt}\n${apiSelectionExplanationPrompt}`),
|
|
38
|
+
new HumanMessage(JSON.stringify({ scenario: context.scenario, candidates })),
|
|
39
|
+
]);
|
|
40
|
+
const parsed = parseStructuredOutput(schema, proposed, 'model API selection analysis');
|
|
41
|
+
const byId = new Map(candidates.map((item) => [item.candidateId, item]));
|
|
42
|
+
const selected = parsed.operations.map((item) => {
|
|
43
|
+
const candidate = byId.get(item.candidateId);
|
|
44
|
+
if (!candidate)
|
|
45
|
+
throw new Error(`Unknown API candidate ${item.candidateId}`);
|
|
46
|
+
return {
|
|
47
|
+
key: structuredClone(candidate.key),
|
|
48
|
+
purpose: item.purpose,
|
|
49
|
+
...('explanation' in item
|
|
50
|
+
? {
|
|
51
|
+
explanation: createApiSelectionExplanation({
|
|
52
|
+
context,
|
|
53
|
+
basis: { kind: 'candidates', operations: [candidate.key] },
|
|
54
|
+
reason: item.explanation.reason,
|
|
55
|
+
}),
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
const questions = parsed.questions.map((question, index) => {
|
|
61
|
+
if (new Set(question.candidateIds).size !== question.candidateIds.length)
|
|
62
|
+
throw new Error('API alternatives must be distinct');
|
|
63
|
+
const alternatives = question.candidateIds.map((id) => {
|
|
64
|
+
const candidate = byId.get(id);
|
|
65
|
+
if (!candidate)
|
|
66
|
+
throw new Error(`Unknown API alternative ${id}`);
|
|
67
|
+
return structuredClone(context.operations[candidates.indexOf(candidate)]);
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
kind: 'operation-choice',
|
|
71
|
+
id: createHash('sha256')
|
|
72
|
+
.update(JSON.stringify([
|
|
73
|
+
context.scenario,
|
|
74
|
+
index,
|
|
75
|
+
question.purpose,
|
|
76
|
+
alternatives.map((item) => item.key),
|
|
77
|
+
]))
|
|
78
|
+
.digest('hex'),
|
|
79
|
+
message: question.message,
|
|
80
|
+
purpose: question.purpose,
|
|
81
|
+
candidates: alternatives,
|
|
82
|
+
...('explanation' in question
|
|
83
|
+
? {
|
|
84
|
+
explanation: createApiSelectionExplanation({
|
|
85
|
+
context,
|
|
86
|
+
basis: {
|
|
87
|
+
kind: 'candidates',
|
|
88
|
+
operations: alternatives.map((candidate) => candidate.key),
|
|
89
|
+
},
|
|
90
|
+
reason: question.explanation.reason,
|
|
91
|
+
}),
|
|
92
|
+
}
|
|
93
|
+
: {}),
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
if (!selected.length && !questions.length && !parsed.gaps.length)
|
|
97
|
+
throw new Error('API analysis must contain operations, questions or gaps');
|
|
98
|
+
return {
|
|
99
|
+
selection: {
|
|
100
|
+
operations: selected,
|
|
101
|
+
gaps: parsed.gaps.map((gap) => ({
|
|
102
|
+
kind: 'missing_operation',
|
|
103
|
+
description: gap.description,
|
|
104
|
+
...('explanation' in gap
|
|
105
|
+
? {
|
|
106
|
+
explanation: createApiSelectionExplanation({
|
|
107
|
+
context,
|
|
108
|
+
basis: { kind: 'catalog' },
|
|
109
|
+
reason: gap.explanation.reason,
|
|
110
|
+
}),
|
|
111
|
+
}
|
|
112
|
+
: {}),
|
|
113
|
+
})),
|
|
114
|
+
},
|
|
115
|
+
questions,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { apiSelectionOptionsSchema } from '../schemas/api-selection-options-schema.js';
|
|
2
|
+
/** Optional standalone selector feature; absence preserves the non-explanation API. */
|
|
3
|
+
export function resolveApiSelectionOptions(input) {
|
|
4
|
+
const options = apiSelectionOptionsSchema.parse(input);
|
|
5
|
+
return options.includeExplanations === true;
|
|
6
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { SystemMessage, HumanMessage } from '@langchain/core/messages';
|
|
2
|
+
import { describeApiSelectionContext, createApiSelectionExplanation, } from '@openapi-flow/core';
|
|
3
|
+
import { createApiSelectionSchema } from '../schemas/api-selection-schema.js';
|
|
4
|
+
import { operationSelectionPrompt } from '../prompts/operation-selection-prompt.js';
|
|
5
|
+
import { assertSelectionInput } from '../legacy/planning/select-operation.js';
|
|
6
|
+
import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
|
|
7
|
+
import { resolveApiSelectionOptions } from './resolve-api-selection-options.js';
|
|
8
|
+
import { apiSelectionExplanationPrompt } from '../prompts/api-selection-explanation-prompt.js';
|
|
9
|
+
export async function selectApiOperations(input) {
|
|
10
|
+
const { scenario, model } = input;
|
|
11
|
+
assertSelectionInput(scenario, model);
|
|
12
|
+
if (!Array.isArray(input.operations))
|
|
13
|
+
throw new Error('operations must be an array');
|
|
14
|
+
const includeExplanations = resolveApiSelectionOptions({
|
|
15
|
+
includeExplanations: input.includeExplanations,
|
|
16
|
+
});
|
|
17
|
+
const context = describeApiSelectionContext({
|
|
18
|
+
scenario,
|
|
19
|
+
operations: input.operations,
|
|
20
|
+
});
|
|
21
|
+
const { operations } = context;
|
|
22
|
+
if (operations.length === 0)
|
|
23
|
+
return {
|
|
24
|
+
operations: [],
|
|
25
|
+
gaps: [
|
|
26
|
+
{
|
|
27
|
+
kind: 'missing_operation',
|
|
28
|
+
description: 'Supplied documents contain no REST operation candidates.',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
const candidates = operations.map((operation, index) => ({
|
|
33
|
+
...operation,
|
|
34
|
+
candidateId: `candidate-${index + 1}`,
|
|
35
|
+
}));
|
|
36
|
+
const schema = createApiSelectionSchema(candidates.map((candidate) => candidate.candidateId), includeExplanations);
|
|
37
|
+
const proposed = await model
|
|
38
|
+
.withStructuredOutput(schema, {
|
|
39
|
+
name: 'select_api_operations',
|
|
40
|
+
method: 'jsonSchema',
|
|
41
|
+
strict: true,
|
|
42
|
+
})
|
|
43
|
+
.invoke([
|
|
44
|
+
new SystemMessage(`${operationSelectionPrompt}\n${apiSelectionExplanationPrompt}`),
|
|
45
|
+
new HumanMessage(JSON.stringify({ scenario, candidates })),
|
|
46
|
+
]);
|
|
47
|
+
const selection = parseStructuredOutput(schema, proposed, 'model API selection');
|
|
48
|
+
if (selection.operations.length === 0 && selection.gaps.length === 0)
|
|
49
|
+
throw new Error('model API selection must contain operations or gaps');
|
|
50
|
+
const byId = new Map(candidates.map((candidate) => [candidate.candidateId, candidate]));
|
|
51
|
+
return {
|
|
52
|
+
operations: selection.operations.map((item) => {
|
|
53
|
+
const candidate = byId.get(item.candidateId);
|
|
54
|
+
if (!candidate)
|
|
55
|
+
throw new Error(`model API selection references unknown ${item.candidateId}`);
|
|
56
|
+
return {
|
|
57
|
+
key: { ...candidate.key },
|
|
58
|
+
purpose: item.purpose,
|
|
59
|
+
...('explanation' in item
|
|
60
|
+
? {
|
|
61
|
+
explanation: createApiSelectionExplanation({
|
|
62
|
+
context,
|
|
63
|
+
basis: { kind: 'candidates', operations: [candidate.key] },
|
|
64
|
+
reason: item.explanation.reason,
|
|
65
|
+
}),
|
|
66
|
+
}
|
|
67
|
+
: {}),
|
|
68
|
+
};
|
|
69
|
+
}),
|
|
70
|
+
gaps: selection.gaps.map((gap) => ({
|
|
71
|
+
kind: 'missing_operation',
|
|
72
|
+
description: gap.description,
|
|
73
|
+
...('explanation' in gap
|
|
74
|
+
? {
|
|
75
|
+
explanation: createApiSelectionExplanation({
|
|
76
|
+
context,
|
|
77
|
+
basis: { kind: 'catalog' },
|
|
78
|
+
reason: gap.explanation.reason,
|
|
79
|
+
}),
|
|
80
|
+
}
|
|
81
|
+
: {}),
|
|
82
|
+
})),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiInputRequirement } from '@openapi-flow/core';
|
|
2
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { createApiInputAnswerSourceSchema } from '../schemas/api-input-answer-source-schema.js';
|
|
5
|
+
export interface ExtractApiInputAnswersInput {
|
|
6
|
+
requirements: ApiInputRequirement[];
|
|
7
|
+
reply: string;
|
|
8
|
+
model: BaseChatModel;
|
|
9
|
+
}
|
|
10
|
+
export interface AnalyzeApiInputAnswersInput extends Omit<ExtractApiInputAnswersInput, 'model'> {
|
|
11
|
+
/** Required only when pending questions and a nonempty reply need interpretation. */
|
|
12
|
+
model?: BaseChatModel;
|
|
13
|
+
includeExplanations?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type ApiInputAnswersOutput = z.infer<ReturnType<typeof createApiInputAnswerSourceSchema>>;
|
|
16
|
+
export type ApiInputAnswerProposal = ApiInputAnswersOutput['answers'][number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ApiLiteralGenerationInput, ApiArgumentGenerationContract, ApiArgumentProposalSchemaShape } from '@openapi-flow/core';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { createApiLiteralGenerationOutputSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
5
|
+
import type { apiLiteralGenerationReasonSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
6
|
+
export interface GenerateApiArgumentsInput extends ApiLiteralGenerationInput {
|
|
7
|
+
model?: BaseChatModel;
|
|
8
|
+
includeExplanations?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ApiLiteralGenerationOutput = z.infer<ReturnType<typeof createApiLiteralGenerationOutputSchema>>;
|
|
11
|
+
export type ApiLiteralGenerationOutputSchema = ApiArgumentGenerationContract['schema'] | z.ZodObject<ApiArgumentProposalSchemaShape & {
|
|
12
|
+
explanation: typeof apiLiteralGenerationReasonSchema;
|
|
13
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ApiBindingPlanningInput, ApiBindingPlanProposal, ExplainedApiBindingCall } from '@openapi-flow/core';
|
|
3
|
+
export interface PlanApiBindingsInput extends ApiBindingPlanningInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
includeExplanations?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ExplainedApiBindingPlanOutput extends Omit<ApiBindingPlanProposal, 'calls'> {
|
|
8
|
+
calls: ExplainedApiBindingCall[];
|
|
9
|
+
}
|
|
10
|
+
export type ApiBindingPlanOutput = ApiBindingPlanProposal | ExplainedApiBindingPlanOutput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { CatalogSource } from '@openapi-flow/core/internal';
|
|
4
|
+
import type { createCatalogSelectionSchema } from '../../legacy/schemas/catalog-selection-schema.js';
|
|
5
|
+
import type { createCatalogStepSchema } from '../../legacy/schemas/catalog-step-schema.js';
|
|
6
|
+
export type CatalogSelectionOutput = z.infer<ReturnType<typeof createCatalogSelectionSchema>>;
|
|
7
|
+
export type CatalogStepOutput = z.infer<ReturnType<typeof createCatalogStepSchema>>;
|
|
8
|
+
export interface PriorStepSummary {
|
|
9
|
+
id: string;
|
|
10
|
+
responseFields: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ProposeCatalogScenarioInput {
|
|
13
|
+
sources: CatalogSource[];
|
|
14
|
+
scenario: string;
|
|
15
|
+
model: BaseChatModel;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { createOperationPlanSchema } from '@openapi-flow/core/internal';
|
|
3
|
+
import type { createOperationSelectionSchema } from '../../legacy/schemas/operation-selection-schema.js';
|
|
4
|
+
export type OperationSelectionOutput = z.infer<ReturnType<typeof createOperationSelectionSchema>>;
|
|
5
|
+
export type OperationPlanOutput = z.infer<ReturnType<typeof createOperationPlanSchema>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { JsonValueObject, NativeNodePlanningInput, NativePlanningProposal, NativePlanningResult, NativePlanningAssessment, NativePlanningCapabilityMaterial, NativeNodePlanningRecord, NativeInstanceSelectionInput, NativeNodeConfigurationInput, NativeSelectedPlanningInput } from '@openapi-flow/core';
|
|
4
|
+
export interface PlanNativeNodesInput extends NativeNodePlanningInput {
|
|
5
|
+
model?: BaseChatModel;
|
|
6
|
+
includeExplanations?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type NativeNodeProposal = NativePlanningProposal;
|
|
9
|
+
export type { NativePlanningCapabilityMaterial } from '@openapi-flow/core';
|
|
10
|
+
export interface NativeLiteralNodeOutput {
|
|
11
|
+
id: string;
|
|
12
|
+
capability: string;
|
|
13
|
+
parameters: JsonValueObject;
|
|
14
|
+
}
|
|
15
|
+
export interface NativeOwnedLiteralNodeOutput extends NativeLiteralNodeOutput {
|
|
16
|
+
parameterSource: 'literal';
|
|
17
|
+
}
|
|
18
|
+
export interface NativeRuntimeNodeOutput {
|
|
19
|
+
id: string;
|
|
20
|
+
capability: string;
|
|
21
|
+
parameterSource: 'workflow-input';
|
|
22
|
+
}
|
|
23
|
+
export type NativeNodeModelInstance = NativeLiteralNodeOutput | NativeOwnedLiteralNodeOutput | NativeRuntimeNodeOutput;
|
|
24
|
+
export interface NativeNodeModelProposal {
|
|
25
|
+
nativeNodes: NativeNodeModelInstance[];
|
|
26
|
+
gaps: NativePlanningProposal['gaps'];
|
|
27
|
+
}
|
|
28
|
+
export interface ExplainedNativeNodeProposal {
|
|
29
|
+
node: NativeNodeModelInstance;
|
|
30
|
+
reason: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ExplainedNativeNodePlanningOutput {
|
|
33
|
+
decision: {
|
|
34
|
+
additions: ExplainedNativeNodeProposal[];
|
|
35
|
+
gaps: NativePlanningProposal['gaps'];
|
|
36
|
+
} | {
|
|
37
|
+
noAdditionalNodesReason: string;
|
|
38
|
+
gaps: NativePlanningProposal['gaps'];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export type NativeNodePlanningOutput = NativeNodeModelProposal | ExplainedNativeNodePlanningOutput;
|
|
42
|
+
export interface ResolvedNativeNodePlanningOutput {
|
|
43
|
+
proposal: NativeNodeProposal;
|
|
44
|
+
assessment?: NativePlanningAssessment;
|
|
45
|
+
}
|
|
46
|
+
export interface NativeNodeParameterContract {
|
|
47
|
+
schemas: z.ZodType<NativeNodeModelInstance>[];
|
|
48
|
+
material: NativePlanningCapabilityMaterial;
|
|
49
|
+
}
|
|
50
|
+
export interface NativeNodePlanningContract {
|
|
51
|
+
schema: z.ZodType<NativeNodePlanningOutput>;
|
|
52
|
+
capabilities: NativePlanningCapabilityMaterial[];
|
|
53
|
+
}
|
|
54
|
+
export interface NativeNodePlan extends NativePlanningResult {
|
|
55
|
+
nativePlanning?: NativeNodePlanningRecord;
|
|
56
|
+
}
|
|
57
|
+
export type NativeNodePlanningFailure = {
|
|
58
|
+
stage: 'instance-selection' | 'dependency-plan' | 'parameter-schema' | 'parameter-validation';
|
|
59
|
+
output: unknown;
|
|
60
|
+
} | {
|
|
61
|
+
stage: 'proposal-schema';
|
|
62
|
+
output: unknown;
|
|
63
|
+
} | {
|
|
64
|
+
stage: 'node-validation';
|
|
65
|
+
output: NativeNodeProposal;
|
|
66
|
+
sourceOutput?: NativeNodePlanningOutput;
|
|
67
|
+
};
|
|
68
|
+
export interface SelectNativeNodeInstancesInput extends NativeInstanceSelectionInput {
|
|
69
|
+
model?: BaseChatModel;
|
|
70
|
+
}
|
|
71
|
+
export interface GenerateNativeNodeParametersInput extends NativeNodeConfigurationInput {
|
|
72
|
+
model?: BaseChatModel;
|
|
73
|
+
}
|
|
74
|
+
export interface PlanNativeInstanceDependenciesInput extends NativeSelectedPlanningInput {
|
|
75
|
+
model?: BaseChatModel;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ApiOperationCandidate } from '@openapi-flow/core';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { createApiSelectionSchema } from '../schemas/api-selection-schema.js';
|
|
5
|
+
export interface ApiSelectionModelOptions {
|
|
6
|
+
/** Opt in to reasons in the same call and code-owned discovery evidence. */
|
|
7
|
+
includeExplanations?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectApiOperationsInput extends ApiSelectionModelOptions {
|
|
10
|
+
operations: ApiOperationCandidate[];
|
|
11
|
+
scenario: string;
|
|
12
|
+
model: BaseChatModel;
|
|
13
|
+
}
|
|
14
|
+
export type ApiSelectionOutput = z.infer<ReturnType<typeof createApiSelectionSchema>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ApiOperationContract } from '@openapi-flow/core';
|
|
3
|
+
import type { z } from 'zod';
|
|
4
|
+
import type { createApiRequestMediaTypeSchema } from '../schemas/api-request-media-type-schema.js';
|
|
5
|
+
export interface SelectApiRequestMediaTypeInput {
|
|
6
|
+
operation: ApiOperationContract;
|
|
7
|
+
scenario: string;
|
|
8
|
+
purpose?: string;
|
|
9
|
+
model: BaseChatModel;
|
|
10
|
+
}
|
|
11
|
+
export interface AnalyzeApiRequestMediaTypeInput extends SelectApiRequestMediaTypeInput {
|
|
12
|
+
/** Optional same-call model reason; code attaches unchanged request-body sources. */
|
|
13
|
+
includeExplanations?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type ApiRequestMediaTypeOutput = z.infer<ReturnType<typeof createApiRequestMediaTypeSchema>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ReviewableWorkflowGraphProposal, ReviewableWorkflowPlanningContext, WorkflowReviewGap, PlannedNativeNode, ExplainedWorkflowConnection, ExplainedWorkflowBlockedCall } from '@openapi-flow/core';
|
|
3
|
+
import type { ExplainedGraphNativeNode } from './workflow-planning.js';
|
|
4
|
+
export interface PlanReviewableWorkflowGraphInput extends ReviewableWorkflowPlanningContext {
|
|
5
|
+
scenario: string;
|
|
6
|
+
model: BaseChatModel;
|
|
7
|
+
gaps: WorkflowReviewGap[];
|
|
8
|
+
preparedNativeNodes?: PlannedNativeNode[];
|
|
9
|
+
includeExplanations?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type ReviewableWorkflowGraphPlanningFailure = {
|
|
12
|
+
stage: 'proposal-schema';
|
|
13
|
+
output: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
stage: 'graph-validation';
|
|
16
|
+
output: ReviewableWorkflowGraphModelOutput;
|
|
17
|
+
};
|
|
18
|
+
export type ReviewableWorkflowGraphOutput = Omit<ReviewableWorkflowGraphProposal, 'nativeNodes' | 'blockedCalls'> & {
|
|
19
|
+
additionalNativeNodes?: ReviewableWorkflowGraphProposal['nativeNodes'];
|
|
20
|
+
blockedCalls?: ReviewableWorkflowGraphProposal['blockedCalls'];
|
|
21
|
+
};
|
|
22
|
+
export interface ExplainedReviewableWorkflowGraphOutput extends ReviewableWorkflowGraphOutput {
|
|
23
|
+
reason: string;
|
|
24
|
+
additionalNativeNodes?: ExplainedGraphNativeNode[];
|
|
25
|
+
edges: ExplainedWorkflowConnection[];
|
|
26
|
+
blockedCalls?: ExplainedWorkflowBlockedCall[];
|
|
27
|
+
}
|
|
28
|
+
export type ReviewableWorkflowGraphModelOutput = ReviewableWorkflowGraphOutput | ExplainedReviewableWorkflowGraphOutput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ApiOperationContract, ClarificationQuestionLimits, WorkflowClarificationOptions, WorkflowDecisionExplanation, WorkflowMessageEvidence, WorkflowNativeEvidence, WorkflowEntryPointEvidence, WorkflowPlanningContext, WorkflowRequirementsProposal, WorkflowSourceMessage } from '@openapi-flow/core';
|
|
3
|
+
export interface ClarifyWorkflowRequirementsInput {
|
|
4
|
+
context: WorkflowPlanningContext;
|
|
5
|
+
limits: ClarificationQuestionLimits;
|
|
6
|
+
options?: WorkflowClarificationOptions;
|
|
7
|
+
model: BaseChatModel;
|
|
8
|
+
/** Earlier intent, not authority for a new statement or answer. */
|
|
9
|
+
backgroundMessages?: WorkflowSourceMessage[];
|
|
10
|
+
}
|
|
11
|
+
export interface WorkflowClarificationOasCandidate {
|
|
12
|
+
candidateId: string;
|
|
13
|
+
operation: ApiOperationContract;
|
|
14
|
+
}
|
|
15
|
+
export interface ProposedWorkflowOasEvidence {
|
|
16
|
+
kind: 'oas';
|
|
17
|
+
candidateId: string;
|
|
18
|
+
}
|
|
19
|
+
export type ProposedWorkflowPlanningEvidence = WorkflowMessageEvidence | WorkflowNativeEvidence | WorkflowEntryPointEvidence | ProposedWorkflowOasEvidence;
|
|
20
|
+
export type WorkflowRequirementsModelOutput = WorkflowRequirementsProposal<ProposedWorkflowPlanningEvidence>;
|
|
21
|
+
export interface CanonicalWorkflowExplanationFields {
|
|
22
|
+
explanation?: WorkflowDecisionExplanation;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftApiBindingEditInput } from '@openapi-flow/core';
|
|
3
|
+
export interface PlanWorkflowDraftApiBindingEditInput extends WorkflowDraftApiBindingEditInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkflowDraftApiBindingEditPlanningFailure {
|
|
7
|
+
stage: 'proposal-schema' | 'proposal-validation';
|
|
8
|
+
output: unknown;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftApiCallPlanningInput, WorkflowDraftApiCallBindingsInput, WorkflowDraftApiCallArgumentsInput } from '@openapi-flow/core';
|
|
3
|
+
export interface SelectWorkflowDraftApiBindingInputsInput extends WorkflowDraftApiCallPlanningInput {
|
|
4
|
+
model?: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface PlanWorkflowDraftApiCallBindingsInput extends WorkflowDraftApiCallBindingsInput {
|
|
7
|
+
model?: BaseChatModel;
|
|
8
|
+
}
|
|
9
|
+
export interface GenerateWorkflowDraftApiCallArgumentsInput extends WorkflowDraftApiCallArgumentsInput {
|
|
10
|
+
model?: BaseChatModel;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkflowDraftApiCallPlanningFailure {
|
|
13
|
+
stage: 'binding-inputs' | 'bindings' | 'arguments';
|
|
14
|
+
output: unknown;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftApiInputEditInput, WorkflowDraftApiInputEditContractInput } from '@openapi-flow/core';
|
|
3
|
+
export interface SelectWorkflowDraftApiInputEditTargetsInput extends WorkflowDraftApiInputEditInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface GenerateWorkflowDraftApiInputEditsInput extends WorkflowDraftApiInputEditContractInput {
|
|
7
|
+
/** Not needed when the explicit contract contains removals only. */
|
|
8
|
+
model?: BaseChatModel;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkflowDraftApiInputEditPlanningFailure {
|
|
11
|
+
stage: 'targets' | 'values';
|
|
12
|
+
output: unknown;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftClarificationScopeInput } from '@openapi-flow/core';
|
|
3
|
+
export interface PlanWorkflowDraftClarificationScopesInput extends WorkflowDraftClarificationScopeInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkflowDraftClarificationScopePlanningFailure {
|
|
7
|
+
stage: 'scope-schema' | 'scope-resolution';
|
|
8
|
+
output: unknown;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftConnectionEditInput } from '@openapi-flow/core';
|
|
3
|
+
export interface PlanWorkflowDraftConnectionEditInput extends WorkflowDraftConnectionEditInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkflowDraftConnectionEditPlanningFailure {
|
|
7
|
+
stage: 'proposal-schema' | 'proposal-validation';
|
|
8
|
+
output: unknown;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftEditInput, WorkflowDraftEditOptions, WorkflowDraftEditProposal, ApiOperationContract } from '@openapi-flow/core';
|
|
3
|
+
import type { ProposedWorkflowPlanningEvidence } from './workflow-clarification.js';
|
|
4
|
+
export interface AnalyzeWorkflowDraftEditInput extends WorkflowDraftEditInput {
|
|
5
|
+
options?: WorkflowDraftEditOptions;
|
|
6
|
+
model: BaseChatModel;
|
|
7
|
+
}
|
|
8
|
+
export type WorkflowDraftEditModelOutput = WorkflowDraftEditProposal<string, ProposedWorkflowPlanningEvidence>;
|
|
9
|
+
export interface WorkflowDraftEditOperationCandidate {
|
|
10
|
+
candidateId: string;
|
|
11
|
+
operation: ApiOperationContract;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowDraftEditPlanningFailure {
|
|
14
|
+
stage: 'proposal-schema' | 'proposal-validation';
|
|
15
|
+
proposal: unknown;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftNativeNodeAdditionInput, WorkflowDraftNativeDependenciesInput } from '@openapi-flow/core';
|
|
3
|
+
export interface PlanWorkflowDraftNativeDependenciesInput extends WorkflowDraftNativeDependenciesInput {
|
|
4
|
+
/** Required only when the original plan offers a producer choice. */
|
|
5
|
+
model?: BaseChatModel;
|
|
6
|
+
}
|
|
7
|
+
export interface GenerateWorkflowDraftNativeNodeAdditionInput extends WorkflowDraftNativeNodeAdditionInput {
|
|
8
|
+
/** Not required when the implementation proves the sole valid setting is {}. */
|
|
9
|
+
model?: BaseChatModel;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectWorkflowDraftNativeNodeParameterOwnershipInput extends WorkflowDraftNativeNodeAdditionInput {
|
|
12
|
+
/** No model is needed when policy or the implementation permits only literals. */
|
|
13
|
+
model?: BaseChatModel;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkflowDraftNativeNodeAdditionPlanningFailure {
|
|
16
|
+
stage: 'proposal-schema' | 'node-validation' | 'ownership' | 'producer-dependencies';
|
|
17
|
+
output: unknown;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftNativeParameterEditInput, WorkflowDraftNativeParameterEditContractInput } from '@openapi-flow/core';
|
|
3
|
+
export interface SelectWorkflowDraftNativeParameterEditTargetsInput extends WorkflowDraftNativeParameterEditInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface GenerateWorkflowDraftNativeParameterEditsInput extends WorkflowDraftNativeParameterEditContractInput {
|
|
7
|
+
/** Required only when selected set targets contain actual values to generate. */
|
|
8
|
+
model?: BaseChatModel;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkflowDraftNativeParameterEditPlanningFailure {
|
|
11
|
+
stage: 'targets' | 'values';
|
|
12
|
+
output: unknown;
|
|
13
|
+
}
|