@openapi-flow/langchain 0.2.0 → 0.3.1
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/README.md +123 -1
- 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.js +43 -28
- package/dist/arguments/select-api-request-media-type.js +8 -37
- package/dist/bindings/plan-api-bindings.js +30 -23
- 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/prompts/api-arguments-prompt.d.ts +1 -1
- package/dist/prompts/api-arguments-prompt.js +1 -1
- package/dist/prompts/api-bindings-prompt.d.ts +1 -1
- package/dist/prompts/api-bindings-prompt.js +1 -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 -1
- package/dist/prompts/api-request-media-type-prompt.js +1 -1
- 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 -1
- package/dist/prompts/native-node-planning-prompt.js +14 -1
- package/dist/prompts/reviewable-workflow-graph-prompt.d.ts +1 -1
- package/dist/prompts/workflow-connections-prompt.d.ts +1 -1
- package/dist/prompts/workflow-connections-prompt.js +4 -1
- 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 -1
- package/dist/prompts/workflow-graph-prompt.js +2 -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 +47 -0
- package/dist/public-api.js +34 -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 +7 -2
- package/dist/schemas/api-binding-plan-schema.js +11 -1
- 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 +5 -2
- package/dist/schemas/api-request-media-type-schema.js +14 -2
- 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 +14 -1
- package/dist/schemas/api-selection-schema.js +6 -5
- 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 +4 -2
- package/dist/schemas/reviewable-workflow-graph-schema.js +13 -1
- 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 +2 -2
- package/dist/schemas/workflow-graph-proposal-schema.js +14 -7
- 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 +1 -1
- package/dist/selection/select-api-operations.js +39 -6
- 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 +11 -5
- package/dist/types/binding-planning.d.ts +7 -5
- package/dist/types/native-node-planning.d.ts +67 -16
- package/dist/types/operation-selection.d.ts +5 -1
- package/dist/types/request-media-selection.d.ts +7 -2
- package/dist/types/reviewable-workflow-planning.d.ts +11 -2
- 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 +13 -15
- package/dist/types/workflow-planning.d.ts +19 -7
- package/dist/types/workflow-review-suggestions.d.ts +12 -0
- package/dist/types/workflow-review-suggestions.js +1 -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/orchestrate-workflow.js +2 -2
- 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.js +63 -66
- package/dist/workflow/plan-reviewable-workflow-graph.js +33 -64
- package/dist/workflow/plan-workflow-connections.js +35 -30
- package/dist/workflow/plan-workflow-graph.js +45 -64
- 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/select-native-node-instances.d.ts +4 -0
- package/dist/workflow/select-native-node-instances.js +57 -0
- package/package.json +7 -4
- package/dist/schemas/native-node-plan-schema.d.ts +0 -4
- package/dist/schemas/native-node-plan-schema.js +0 -26
- package/dist/workflow/assemble-native-node-materials.d.ts +0 -3
- package/dist/workflow/assemble-native-node-materials.js +0 -8
- package/dist/workflow/create-prepared-native-node-materials.d.ts +0 -4
- package/dist/workflow/create-prepared-native-node-materials.js +0 -15
- package/dist/workflow/prepare-workflow-connection-materials.d.ts +0 -3
- package/dist/workflow/prepare-workflow-connection-materials.js +0 -66
|
@@ -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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowDraftNativeReferenceRepairInput } from '@openapi-flow/core';
|
|
3
|
+
export interface PlanWorkflowDraftNativeReferenceRepairInput extends WorkflowDraftNativeReferenceRepairInput {
|
|
4
|
+
model: BaseChatModel;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkflowDraftNativeReferenceRepairPlanningFailure {
|
|
7
|
+
stage: 'proposal-schema' | 'proposal-validation';
|
|
8
|
+
output: unknown;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WorkflowMessageEvidence } from '@openapi-flow/core';
|
|
2
|
+
/** Model input contains identities; the parsed result contains code-owned exact source text. */
|
|
3
|
+
export type WorkflowMessageEvidenceSelection = Pick<WorkflowMessageEvidence, 'kind' | 'messageId'>;
|
|
4
|
+
export type WorkflowMessageSelectionOutput<Output> = Output extends WorkflowMessageEvidence ? WorkflowMessageEvidenceSelection : Output extends Array<infer Item> ? WorkflowMessageSelectionOutput<Item>[] : Output extends object ? {
|
|
5
|
+
[Key in keyof Output]: WorkflowMessageSelectionOutput<Output[Key]>;
|
|
6
|
+
} : Output;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { PlannedNativeNode, WorkflowConnectionPlanningInput, WorkflowConnectionDecision, WorkflowConnectionProposal, ExplainedWorkflowBlockedCall, ExplainedWorkflowConnection } from '@openapi-flow/core';
|
|
3
|
+
import type { ReviewableWorkflowGraphOutput } from './reviewable-workflow-planning.js';
|
|
4
|
+
export interface PlanWorkflowConnectionsInput extends WorkflowConnectionPlanningInput {
|
|
5
5
|
model: BaseChatModel;
|
|
6
|
-
|
|
7
|
-
capabilities?: WorkflowCapability[];
|
|
8
|
-
nativeNodes?: PlannedNativeNode[];
|
|
9
|
-
gaps?: WorkflowReviewGap[];
|
|
10
|
-
edges?: WorkflowPlanEdge[];
|
|
6
|
+
includeExplanations?: boolean;
|
|
11
7
|
}
|
|
12
8
|
export interface OrchestrateWorkflowInput extends Omit<PlanWorkflowConnectionsInput, 'nativeNodes'> {
|
|
13
9
|
workflowId: string;
|
|
14
10
|
preparedNativeNodes?: PlannedNativeNode[];
|
|
15
11
|
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
export interface WorkflowConnectionModelDecision extends ReviewableWorkflowGraphOutput {
|
|
13
|
+
reason: string;
|
|
14
|
+
edges: ExplainedWorkflowConnection[];
|
|
15
|
+
blockedCalls?: ExplainedWorkflowBlockedCall[];
|
|
16
|
+
}
|
|
17
|
+
export type WorkflowConnectionPlanningOutput = ReviewableWorkflowGraphOutput | WorkflowConnectionModelDecision;
|
|
18
|
+
export interface ResolvedWorkflowConnectionOutput {
|
|
19
|
+
proposal: WorkflowConnectionProposal;
|
|
20
|
+
decision?: WorkflowConnectionDecision;
|
|
23
21
|
}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type { WorkflowApiMaterial, WorkflowCapability, WorkflowGraphProposal, PlannedNativeNode } from '@openapi-flow/core';
|
|
2
|
+
import type { WorkflowApiMaterial, WorkflowCapability, WorkflowGraphProposal, PlannedNativeNode, ExplainedWorkflowConnection, WorkflowGraphPlanningProposal, WorkflowGraphPlanningAssessment } from '@openapi-flow/core';
|
|
3
3
|
export interface PlanWorkflowGraphInput {
|
|
4
4
|
scenario: string;
|
|
5
5
|
model: BaseChatModel;
|
|
6
6
|
materials: WorkflowApiMaterial[];
|
|
7
7
|
capabilities: WorkflowCapability[];
|
|
8
8
|
preparedNativeNodes?: PlannedNativeNode[];
|
|
9
|
+
includeExplanations?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
-
inputPorts: string[];
|
|
12
|
-
outputPorts: string[];
|
|
13
|
-
}
|
|
11
|
+
export type { PreparedNativeNodeMaterial } from '@openapi-flow/core';
|
|
14
12
|
export type WorkflowGraphOutput = Omit<WorkflowGraphProposal, 'nativeNodes'> & {
|
|
15
|
-
additionalNativeNodes
|
|
13
|
+
additionalNativeNodes?: PlannedNativeNode[];
|
|
16
14
|
};
|
|
15
|
+
export interface ExplainedGraphNativeNode extends PlannedNativeNode {
|
|
16
|
+
reason: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ExplainedWorkflowGraphOutput extends WorkflowGraphOutput {
|
|
19
|
+
reason: string;
|
|
20
|
+
additionalNativeNodes?: ExplainedGraphNativeNode[];
|
|
21
|
+
edges: ExplainedWorkflowConnection[];
|
|
22
|
+
}
|
|
23
|
+
export type WorkflowGraphModelOutput = WorkflowGraphOutput | ExplainedWorkflowGraphOutput;
|
|
24
|
+
export interface ResolvedWorkflowGraphOutput {
|
|
25
|
+
proposal: WorkflowGraphPlanningProposal;
|
|
26
|
+
assessment?: WorkflowGraphPlanningAssessment;
|
|
27
|
+
}
|
|
28
|
+
export type WorkflowGraphExplanationMode = 'none' | 'connections' | 'graph';
|
|
17
29
|
export type WorkflowGraphPlanningFailure = {
|
|
18
30
|
stage: 'proposal-schema';
|
|
19
31
|
output: unknown;
|
|
20
32
|
} | {
|
|
21
33
|
stage: 'graph-validation';
|
|
22
|
-
output:
|
|
34
|
+
output: WorkflowGraphModelOutput;
|
|
23
35
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { WorkflowReviewSuggestionsInput, WorkflowReviewSuggestionsProposal, WorkflowReviewQuestionEvidence } from '@openapi-flow/core';
|
|
3
|
+
import type { ProposedWorkflowPlanningEvidence } from './workflow-clarification.js';
|
|
4
|
+
export interface SuggestWorkflowReviewFollowUpsInput extends WorkflowReviewSuggestionsInput {
|
|
5
|
+
model: BaseChatModel;
|
|
6
|
+
}
|
|
7
|
+
export type ProposedWorkflowReviewSuggestionEvidence = ProposedWorkflowPlanningEvidence | WorkflowReviewQuestionEvidence;
|
|
8
|
+
export type WorkflowReviewSuggestionsModelOutput = WorkflowReviewSuggestionsProposal<ProposedWorkflowReviewSuggestionEvidence>;
|
|
9
|
+
export interface WorkflowReviewSuggestionPlanningFailure {
|
|
10
|
+
stage: 'proposal-schema' | 'source-validation';
|
|
11
|
+
output: unknown;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NativeNodeParameterResult } from '@openapi-flow/core';
|
|
2
|
+
import type { GenerateNativeNodeParametersInput } from '../types/native-node-planning.js';
|
|
3
|
+
/** Zero or one value call for one selected instance; no hidden ownership or connection planning. */
|
|
4
|
+
export declare function generateNativeNodeParameters(input: GenerateNativeNodeParametersInput): Promise<NativeNodeParameterResult>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
|
+
import { createNativeNodeParametersSchema, describeNativeNodeConfiguration, resolveNativeNodeParameters, } from '@openapi-flow/core';
|
|
3
|
+
import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
|
|
4
|
+
import { nativeNodeParametersPrompt } from '../prompts/native-node-planning-prompt.js';
|
|
5
|
+
import { NativeNodePlanningError } from './native-node-planning-error.js';
|
|
6
|
+
/** Zero or one value call for one selected instance; no hidden ownership or connection planning. */
|
|
7
|
+
export async function generateNativeNodeParameters(input) {
|
|
8
|
+
if (input.model !== undefined &&
|
|
9
|
+
(!input.model || typeof input.model.withStructuredOutput !== 'function'))
|
|
10
|
+
throw new Error('generateNativeNodeParameters.model must support structured output when supplied');
|
|
11
|
+
const description = describeNativeNodeConfiguration(input);
|
|
12
|
+
if (!description.instance.hasLiteralParameters)
|
|
13
|
+
return resolveNativeNodeParameters({
|
|
14
|
+
...input,
|
|
15
|
+
fingerprint: description.fingerprint,
|
|
16
|
+
proposal: {
|
|
17
|
+
decision: {
|
|
18
|
+
status: 'provided',
|
|
19
|
+
parameters: {},
|
|
20
|
+
...(input.includeExplanations
|
|
21
|
+
? {
|
|
22
|
+
reason: 'The validated ownership contract leaves no literal parameter choice.',
|
|
23
|
+
}
|
|
24
|
+
: {}),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
if (!input.model || typeof input.model.withStructuredOutput !== 'function')
|
|
29
|
+
throw new Error('generateNativeNodeParameters.model must support structured output for remaining values');
|
|
30
|
+
const schema = createNativeNodeParametersSchema(input);
|
|
31
|
+
const capability = description.context.capabilities.find((entry) => entry.name === description.instance.capability);
|
|
32
|
+
if (!capability)
|
|
33
|
+
throw new Error('Native parameter generation has no selected capability material');
|
|
34
|
+
const output = await input.model
|
|
35
|
+
.withStructuredOutput(serializeStructuredOutputSchema(schema, 'draft-2020-12'), {
|
|
36
|
+
name: 'generate_native_node_parameters',
|
|
37
|
+
method: 'jsonSchema',
|
|
38
|
+
strict: true,
|
|
39
|
+
})
|
|
40
|
+
.invoke([
|
|
41
|
+
new SystemMessage(nativeNodeParametersPrompt),
|
|
42
|
+
new HumanMessage(JSON.stringify({
|
|
43
|
+
scenario: description.context.scenario,
|
|
44
|
+
purpose: description.instance.purpose,
|
|
45
|
+
target: {
|
|
46
|
+
id: description.instance.id,
|
|
47
|
+
capability: {
|
|
48
|
+
name: capability.name,
|
|
49
|
+
description: capability.description,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
parametersSchema: description.instance.literalParametersSchema,
|
|
53
|
+
runtimeParameters: description.instance.runtimeParameters,
|
|
54
|
+
apiMaterials: description.context.apiMaterials,
|
|
55
|
+
preparedNativeNodes: description.context.preparedNativeNodes,
|
|
56
|
+
configuredNodes: description.configuredNodes,
|
|
57
|
+
outputs: description.outputs,
|
|
58
|
+
...(description.sourceDependencies === undefined
|
|
59
|
+
? {}
|
|
60
|
+
: { sourceDependencies: description.sourceDependencies }),
|
|
61
|
+
...(description.replies === undefined
|
|
62
|
+
? {}
|
|
63
|
+
: { replies: description.replies }),
|
|
64
|
+
})),
|
|
65
|
+
]);
|
|
66
|
+
try {
|
|
67
|
+
// Validate output separately so callers can distinguish a malformed reply from stale source material.
|
|
68
|
+
schema.parse(output);
|
|
69
|
+
}
|
|
70
|
+
catch (cause) {
|
|
71
|
+
if (!(cause instanceof Error))
|
|
72
|
+
throw cause;
|
|
73
|
+
throw new NativeNodePlanningError({ stage: 'parameter-schema', output }, cause);
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
return resolveNativeNodeParameters({
|
|
77
|
+
...input,
|
|
78
|
+
fingerprint: description.fingerprint,
|
|
79
|
+
proposal: output,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (cause) {
|
|
83
|
+
if (!(cause instanceof Error))
|
|
84
|
+
throw cause;
|
|
85
|
+
throw new NativeNodePlanningError({ stage: 'parameter-validation', output }, cause);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { planNativeNodes } from './plan-native-nodes.js';
|
|
2
2
|
import { planWorkflowConnections } from './plan-workflow-connections.js';
|
|
3
|
-
import { assembleNativeNodeMaterials } from '
|
|
4
|
-
import { prepareWorkflowConnectionMaterials } from '
|
|
3
|
+
import { assembleNativeNodeMaterials } from '@openapi-flow/core';
|
|
4
|
+
import { prepareWorkflowConnectionMaterials } from '@openapi-flow/core';
|
|
5
5
|
/** Optional material groups mean absence, never an implicit capability registry. */
|
|
6
6
|
export async function orchestrateWorkflow(input) {
|
|
7
7
|
if (!input.workflowId?.trim())
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NativeInstanceDependencyPlan } from '@openapi-flow/core';
|
|
2
|
+
import type { PlanNativeInstanceDependenciesInput } from '../types/native-node-planning.js';
|
|
3
|
+
/** Zero or one producer-choice call; no parameters, output contracts or runtime DAG edges. */
|
|
4
|
+
export declare function planNativeInstanceDependencies(input: PlanNativeInstanceDependenciesInput): Promise<NativeInstanceDependencyPlan>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
+
import { describeNativeInstanceDependencies, createNativeInstanceDependenciesSchema, resolveNativeInstanceDependencies, } from '@openapi-flow/core';
|
|
4
|
+
import { nativeInstanceDependenciesPrompt } from '../prompts/native-instance-dependencies-prompt.js';
|
|
5
|
+
import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
|
|
6
|
+
import { NativeNodePlanningError } from './native-node-planning-error.js';
|
|
7
|
+
/** Zero or one producer-choice call; no parameters, output contracts or runtime DAG edges. */
|
|
8
|
+
export async function planNativeInstanceDependencies(input) {
|
|
9
|
+
if (input.model !== undefined &&
|
|
10
|
+
(!input.model || typeof input.model.withStructuredOutput !== 'function'))
|
|
11
|
+
throw new Error('planNativeInstanceDependencies.model must support structured output when supplied');
|
|
12
|
+
const context = describeNativeInstanceDependencies(input);
|
|
13
|
+
const explanations = input.includeExplanations;
|
|
14
|
+
if (Object.values(context.sourceCandidatesByNodeId).every((ids) => ids.length === 0))
|
|
15
|
+
return resolveNativeInstanceDependencies({
|
|
16
|
+
...input,
|
|
17
|
+
proposal: {
|
|
18
|
+
sourcesByNodeId: Object.fromEntries(context.instances.map((node) => [node.id, { sourceNodeIds: [] }])),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
if (!input.model || typeof input.model.withStructuredOutput !== 'function')
|
|
22
|
+
throw new Error('planNativeInstanceDependencies.model must support structured output for producer choices');
|
|
23
|
+
const schema = createNativeInstanceDependenciesSchema(input);
|
|
24
|
+
const output = await input.model
|
|
25
|
+
.withStructuredOutput(serializeStructuredOutputSchema(schema, 'draft-2020-12'), {
|
|
26
|
+
name: 'plan_native_instance_dependencies',
|
|
27
|
+
method: 'jsonSchema',
|
|
28
|
+
strict: true,
|
|
29
|
+
})
|
|
30
|
+
.invoke([
|
|
31
|
+
new SystemMessage(nativeInstanceDependenciesPrompt),
|
|
32
|
+
new HumanMessage(JSON.stringify(context)),
|
|
33
|
+
]);
|
|
34
|
+
try {
|
|
35
|
+
if (!isDeepStrictEqual(describeNativeInstanceDependencies(input), context) ||
|
|
36
|
+
explanations !== input.includeExplanations)
|
|
37
|
+
throw new Error('Native dependency source contracts changed during planning; no automatic rebase');
|
|
38
|
+
return resolveNativeInstanceDependencies({ ...input, proposal: output });
|
|
39
|
+
}
|
|
40
|
+
catch (cause) {
|
|
41
|
+
if (!(cause instanceof Error))
|
|
42
|
+
throw cause;
|
|
43
|
+
throw new NativeNodePlanningError({ stage: 'dependency-plan', output }, cause);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,70 +1,64 @@
|
|
|
1
1
|
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
2
|
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { describeNativeNodePlanning, createNativeNodePlan, createNativeNodePlanningRecord, } from '@openapi-flow/core';
|
|
4
|
+
import { createNativeNodePlanningContract } from '../schemas/native-node-planning-contract.js';
|
|
5
|
+
import { nativeNodeExplanationOptionsSchema } from '../schemas/native-node-explanation-schema.js';
|
|
6
6
|
import { nativeNodePlanningPrompt } from '../prompts/native-node-planning-prompt.js';
|
|
7
7
|
import { assertSelectionInput } from '../legacy/planning/select-operation.js';
|
|
8
8
|
import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { resolveNativeNodePlanningOutput } from './resolve-native-node-planning-output.js';
|
|
10
|
+
import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
|
|
11
11
|
import { NativeNodePlanningError } from './native-node-planning-error.js';
|
|
12
12
|
export async function planNativeNodes(input) {
|
|
13
|
-
assertSelectionInput(input.scenario, input.model);
|
|
14
13
|
if (!input.planId?.trim())
|
|
15
14
|
throw new Error('planNativeNodes.planId is required');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const existingIds = [...apiIds, ...prepared.map((node) => node.id)];
|
|
22
|
-
if (existingIds.some((id) => !id.trim()) ||
|
|
23
|
-
new Set(existingIds).size !== existingIds.length)
|
|
24
|
-
throw new Error('native planning materials require unique non-empty IDs');
|
|
25
|
-
validateNativeApiResponseReferences({
|
|
26
|
-
nativeNodes: prepared,
|
|
27
|
-
capabilities,
|
|
28
|
-
apiCallIds: apiIds,
|
|
15
|
+
if (input.model !== undefined &&
|
|
16
|
+
(!input.model || typeof input.model.withStructuredOutput !== 'function'))
|
|
17
|
+
throw new Error('planNativeNodes.model must support structured output when supplied');
|
|
18
|
+
const options = nativeNodeExplanationOptionsSchema.parse({
|
|
19
|
+
includeExplanations: input.includeExplanations,
|
|
29
20
|
});
|
|
21
|
+
const { input: snapshot, context, planningCapabilities, } = describeNativeNodePlanning(input);
|
|
30
22
|
// No registered choice means no native-selection model call, not an inferred registry.
|
|
31
|
-
if (!capabilities.length)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
if (!snapshot.capabilities.length) {
|
|
24
|
+
const plan = createNativeNodePlan({
|
|
25
|
+
...snapshot,
|
|
26
|
+
proposal: { nativeNodes: [], gaps: [] },
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
...plan,
|
|
30
|
+
...(options.includeExplanations === true
|
|
31
|
+
? {
|
|
32
|
+
nativePlanning: createNativeNodePlanningRecord({
|
|
33
|
+
...snapshot,
|
|
34
|
+
plan,
|
|
35
|
+
}),
|
|
36
|
+
}
|
|
37
|
+
: {}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const model = input.model;
|
|
41
|
+
if (!model)
|
|
42
|
+
throw new Error('planNativeNodes.model is required when supplied capabilities need a planning decision');
|
|
43
|
+
assertSelectionInput(snapshot.scenario, model);
|
|
44
|
+
const contract = createNativeNodePlanningContract(planningCapabilities, snapshot.allowRuntimeParameters === true, options.includeExplanations === true);
|
|
45
|
+
if (!isDeepStrictEqual(contract.capabilities, context.capabilities))
|
|
46
|
+
throw new Error('native planning schema differs from its supplied capability material');
|
|
47
|
+
const { schema } = contract;
|
|
48
|
+
const output = await model
|
|
49
|
+
.withStructuredOutput(serializeStructuredOutputSchema(schema, 'draft-2020-12'), {
|
|
40
50
|
name: 'plan_native_nodes',
|
|
41
51
|
method: 'functionCalling',
|
|
42
52
|
strict: true,
|
|
43
53
|
})
|
|
44
54
|
.invoke([
|
|
45
55
|
new SystemMessage(nativeNodePlanningPrompt),
|
|
46
|
-
new HumanMessage(JSON.stringify(
|
|
47
|
-
scenario: input.scenario,
|
|
48
|
-
apiMaterials: apiMaterials.map(({ callId, operation }) => ({
|
|
49
|
-
callId,
|
|
50
|
-
key: operation.key,
|
|
51
|
-
method: operation.method,
|
|
52
|
-
path: operation.path,
|
|
53
|
-
operation: operation.operation,
|
|
54
|
-
effective: operation.effective,
|
|
55
|
-
})),
|
|
56
|
-
preparedNativeNodes: createPreparedNativeNodeMaterials(prepared, capabilities),
|
|
57
|
-
capabilities: planningCapabilities.map((capability) => ({
|
|
58
|
-
name: capability.name,
|
|
59
|
-
description: capability.description,
|
|
60
|
-
parametersSchema: z.toJSONSchema(capability.parametersSchema),
|
|
61
|
-
})),
|
|
62
|
-
})),
|
|
56
|
+
new HumanMessage(JSON.stringify(context)),
|
|
63
57
|
]);
|
|
64
|
-
let
|
|
58
|
+
let parsed;
|
|
65
59
|
try {
|
|
66
|
-
|
|
67
|
-
if (!isDeepStrictEqual(
|
|
60
|
+
parsed = parseStructuredOutput(schema, output, 'model native node plan');
|
|
61
|
+
if (!isDeepStrictEqual(parsed, output))
|
|
68
62
|
throw new Error('native model schema must validate without defaults, coercion or transformation');
|
|
69
63
|
}
|
|
70
64
|
catch (error) {
|
|
@@ -72,28 +66,31 @@ export async function planNativeNodes(input) {
|
|
|
72
66
|
throw error;
|
|
73
67
|
throw new NativeNodePlanningError({ stage: 'proposal-schema', output }, error);
|
|
74
68
|
}
|
|
69
|
+
const { proposal, assessment } = resolveNativeNodePlanningOutput(parsed);
|
|
75
70
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
throw new Error('native planning gap ID collides with a declared node');
|
|
92
|
-
return { nativeNodes: proposal.nativeNodes, gaps };
|
|
71
|
+
if (!isDeepStrictEqual(describeNativeNodePlanning(snapshot).context, context))
|
|
72
|
+
throw new Error('native planning source contracts changed during the model invocation');
|
|
73
|
+
const plan = createNativeNodePlan({ ...snapshot, proposal });
|
|
74
|
+
return {
|
|
75
|
+
...plan,
|
|
76
|
+
...(options.includeExplanations === true
|
|
77
|
+
? {
|
|
78
|
+
nativePlanning: createNativeNodePlanningRecord({
|
|
79
|
+
...snapshot,
|
|
80
|
+
plan,
|
|
81
|
+
assessment,
|
|
82
|
+
}),
|
|
83
|
+
}
|
|
84
|
+
: {}),
|
|
85
|
+
};
|
|
93
86
|
}
|
|
94
87
|
catch (error) {
|
|
95
88
|
if (!(error instanceof Error))
|
|
96
89
|
throw error;
|
|
97
|
-
throw new NativeNodePlanningError({
|
|
90
|
+
throw new NativeNodePlanningError({
|
|
91
|
+
stage: 'node-validation',
|
|
92
|
+
output: proposal,
|
|
93
|
+
sourceOutput: parsed,
|
|
94
|
+
}, error);
|
|
98
95
|
}
|
|
99
96
|
}
|