@openapi-flow/langchain 0.4.1 → 0.4.3
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 +44 -0
- package/dist/arguments/analyze-api-request-media-type.js +3 -2
- package/dist/arguments/generate-api-arguments.js +19 -7
- package/dist/arguments/interpret-api-argument-enums.js +2 -0
- package/dist/arguments/resolve-api-literal-generation-output.js +5 -1
- package/dist/bindings/plan-api-call-bindings.js +3 -2
- package/dist/bindings/select-api-binding-sources.js +3 -2
- package/dist/prompts/api-arguments-prompt.js +2 -0
- package/dist/prompts/native-instance-selection-review-prompt.d.ts +1 -1
- package/dist/prompts/native-instance-selection-review-prompt.js +6 -3
- package/dist/prompts/native-node-planning-prompt.d.ts +2 -2
- package/dist/prompts/native-node-planning-prompt.js +5 -0
- package/dist/prompts/workflow-connection-goal-review-prompt.d.ts +1 -1
- package/dist/prompts/workflow-connection-goal-review-prompt.js +2 -2
- package/dist/prompts/workflow-connections-prompt.d.ts +1 -1
- package/dist/prompts/workflow-connections-prompt.js +1 -0
- package/dist/prompts/workflow-intent-prompt.d.ts +1 -0
- package/dist/prompts/workflow-intent-prompt.js +8 -0
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.js +1 -0
- package/dist/schemas/api-call-binding-plan-schema.d.ts +2 -2
- package/dist/schemas/api-call-binding-plan-schema.js +7 -3
- package/dist/schemas/api-literal-generation-output-schema.d.ts +7 -4
- package/dist/schemas/api-literal-generation-output-schema.js +30 -12
- package/dist/schemas/api-request-media-type-schema.d.ts +1 -1
- package/dist/schemas/api-request-media-type-schema.js +6 -1
- package/dist/schemas/api-selection-analysis-schema.d.ts +36 -1
- package/dist/schemas/api-selection-analysis-schema.js +4 -4
- package/dist/schemas/api-selection-schema.d.ts +14 -1
- package/dist/schemas/api-selection-schema.js +3 -3
- package/dist/schemas/reviewable-workflow-graph-schema.d.ts +14 -3
- package/dist/schemas/with-api-selection-explanation.d.ts +11 -3
- package/dist/schemas/with-api-selection-explanation.js +21 -8
- package/dist/schemas/workflow-connection-execution-schema.d.ts +5 -0
- package/dist/schemas/workflow-connection-execution-schema.js +22 -0
- package/dist/schemas/workflow-connection-goal-review-schema.d.ts +1 -1
- package/dist/schemas/workflow-connection-goal-review-schema.js +8 -10
- package/dist/schemas/workflow-connection-selection-schema.d.ts +33 -0
- package/dist/schemas/workflow-connection-selection-schema.js +34 -0
- package/dist/selection/analyze-api-selection.js +6 -5
- package/dist/selection/select-api-operations.js +5 -4
- package/dist/types/argument-generation.d.ts +6 -6
- package/dist/types/incremental-connection-planning.d.ts +2 -0
- package/dist/types/native-instance-selection-review.d.ts +2 -2
- package/dist/types/reviewable-workflow-planning.d.ts +2 -1
- package/dist/types/workflow-connection-selection.d.ts +19 -0
- package/dist/types/workflow-connection-selection.js +1 -0
- package/dist/types/workflow-intent.d.ts +6 -0
- package/dist/types/workflow-intent.js +1 -0
- package/dist/types/workflow-orchestration.d.ts +2 -1
- package/dist/workflow/connections/invoke-connection-planning-model.js +4 -1
- package/dist/workflow/connections/review-workflow-connection-goals.js +1 -0
- package/dist/workflow/generate-native-node-parameters.js +6 -2
- package/dist/workflow/native-selection/review-native-instance-selection.js +2 -2
- package/dist/workflow/plan-workflow-connections.js +9 -8
- package/dist/workflow/plan-workflow-intent.d.ts +4 -0
- package/dist/workflow/plan-workflow-intent.js +49 -0
- package/dist/workflow/resolve-workflow-connection-output.d.ts +3 -2
- package/dist/workflow/resolve-workflow-connection-output.js +30 -18
- package/dist/workflow/resolve-workflow-connection-selection.d.ts +4 -0
- package/dist/workflow/resolve-workflow-connection-selection.js +24 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { createApiRequestInputPointerSchema, apiInputLiteralSourceSchema, } from '@openapi-flow/core';
|
|
2
|
+
import { createApiRequestInputPointerSchema, apiInputLiteralSourceSchema, optionalPlanningExplanationObjectSchema, } from '@openapi-flow/core';
|
|
3
3
|
export const apiLiteralGenerationOptionsSchema = z.strictObject({
|
|
4
4
|
includeExplanations: z.boolean().optional(),
|
|
5
5
|
selectOasEnums: z.boolean().optional(),
|
|
@@ -32,11 +32,13 @@ function createLiteralSourcesSchema(messages) {
|
|
|
32
32
|
export const apiLiteralNotProvidedSchema = z.strictObject({
|
|
33
33
|
state: z
|
|
34
34
|
.literal('not-provided')
|
|
35
|
-
.describe('No request literal was
|
|
35
|
+
.describe('No actual request literal was selected by the user for this call. Examples, unchosen alternatives and values the user will supply later are not selected literals. Code owns the empty values and source list. Do not supply a placeholder body, values, or literalSources in this decision.'),
|
|
36
36
|
});
|
|
37
37
|
export function createApiLiteralProvidedSchema(contract, messages) {
|
|
38
38
|
return z.strictObject({
|
|
39
|
-
state: z
|
|
39
|
+
state: z
|
|
40
|
+
.literal('provided')
|
|
41
|
+
.describe('The user explicitly directs using these actual values for this call. Source occurrence alone does not turn an example, an unchosen alternative or a future input into a selected literal.'),
|
|
40
42
|
values: contract.valuesSchema.refine((values) => Object.entries(values).some(([group, value]) => group === 'body' ||
|
|
41
43
|
(value !== null &&
|
|
42
44
|
typeof value === 'object' &&
|
|
@@ -44,7 +46,13 @@ export function createApiLiteralProvidedSchema(contract, messages) {
|
|
|
44
46
|
literalSources: createLiteralSourcesSchema(messages).describe('Every provided literal, including an empty object, empty array, empty string or null, needs its original exact user source. Never use a source-free placeholder.'),
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
|
-
export function
|
|
49
|
+
export function createApiEnumIntentInputsSchema(requestSchema) {
|
|
50
|
+
return z
|
|
51
|
+
.array(createApiRequestInputPointerSchema(requestSchema))
|
|
52
|
+
.refine((pointers) => new Set(pointers).size === pointers.length)
|
|
53
|
+
.describe('Only missing input paths whose actual requested value meaning is expressed in natural language and therefore needs OAS enum interpretation. Code includes these paths in requested-input presence; do not duplicate them solely for that purpose. Return [] for unknown values, examples, unchosen alternatives or values to supply later. Requiredness or a requested field name is not a supplied value meaning. Do not include already supplied literals, confirmed inputs or bindings. Code schedules the next semantic call only for this explicit list and validates each path against unanswered OAS enum contracts.');
|
|
54
|
+
}
|
|
55
|
+
export function createApiTrackedLiteralGenerationSchema(contract, requestSchema, messages, selectOasEnums = false) {
|
|
48
56
|
const provided = createApiLiteralProvidedSchema(contract, messages);
|
|
49
57
|
const schema = z.strictObject({
|
|
50
58
|
literalInputs: z.union([apiLiteralNotProvidedSchema, provided]),
|
|
@@ -53,21 +61,31 @@ export function createApiTrackedLiteralGenerationSchema(contract, requestSchema,
|
|
|
53
61
|
.refine((pointers) => new Set(pointers).size === pointers.length)
|
|
54
62
|
.describe('Exact OAS request pointers explicitly requested for this call, even when the value is not given verbatim. Include requested optional inputs. Do not select unrequested filters, OAS defaults or examples. Code validates the original OAS and missing presence. This field contains paths, never values or bindings.'),
|
|
55
63
|
});
|
|
56
|
-
return
|
|
64
|
+
return selectOasEnums
|
|
65
|
+
? schema.extend({
|
|
66
|
+
enumIntentInputs: createApiEnumIntentInputsSchema(requestSchema),
|
|
67
|
+
})
|
|
68
|
+
: schema;
|
|
57
69
|
}
|
|
58
|
-
export function createApiExplainedTrackedLiteralGenerationSchema(contract, requestSchema, messages) {
|
|
59
|
-
return createApiTrackedLiteralGenerationSchema(contract, requestSchema, messages).extend({
|
|
60
|
-
explanation:
|
|
70
|
+
export function createApiExplainedTrackedLiteralGenerationSchema(contract, requestSchema, messages, requireExplanations = true, selectOasEnums = false) {
|
|
71
|
+
return createApiTrackedLiteralGenerationSchema(contract, requestSchema, messages, selectOasEnums).extend({
|
|
72
|
+
explanation: requireExplanations
|
|
73
|
+
? apiLiteralGenerationReasonSchema
|
|
74
|
+
: optionalPlanningExplanationObjectSchema,
|
|
61
75
|
});
|
|
62
76
|
}
|
|
63
77
|
/** Tracked generation separates absence from literal empty values; the OAS value contract stays unchanged. */
|
|
64
|
-
export function createApiLiteralGenerationOutputSchema(contract, includeExplanations, requestSchema, messages) {
|
|
78
|
+
export function createApiLiteralGenerationOutputSchema(contract, includeExplanations, requestSchema, messages, requireExplanations = true, selectOasEnums = false) {
|
|
65
79
|
z.boolean().parse(includeExplanations);
|
|
66
80
|
if (requestSchema !== undefined)
|
|
67
81
|
return includeExplanations && contract.hasLiteralInputs
|
|
68
|
-
? createApiExplainedTrackedLiteralGenerationSchema(contract, requestSchema, messages)
|
|
69
|
-
: createApiTrackedLiteralGenerationSchema(contract, requestSchema, messages);
|
|
82
|
+
? createApiExplainedTrackedLiteralGenerationSchema(contract, requestSchema, messages, requireExplanations, selectOasEnums)
|
|
83
|
+
: createApiTrackedLiteralGenerationSchema(contract, requestSchema, messages, selectOasEnums);
|
|
70
84
|
return includeExplanations && contract.hasLiteralInputs
|
|
71
|
-
? contract.schema.extend({
|
|
85
|
+
? contract.schema.extend({
|
|
86
|
+
explanation: requireExplanations
|
|
87
|
+
? apiLiteralGenerationReasonSchema
|
|
88
|
+
: optionalPlanningExplanationObjectSchema,
|
|
89
|
+
})
|
|
72
90
|
: contract.schema;
|
|
73
91
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare function createApiRequestMediaTypeSchema(mediaTypes: string[], includeExplanations?: boolean): z.ZodObject<{
|
|
2
|
+
export declare function createApiRequestMediaTypeSchema(mediaTypes: string[], includeExplanations?: boolean, requireExplanations?: boolean): z.ZodObject<{
|
|
3
3
|
requestMediaType: z.ZodNullable<z.ZodEnum<{
|
|
4
4
|
[x: string]: string;
|
|
5
5
|
}>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
import { optionalPlanningExplanationObjectSchema } from '@openapi-flow/core';
|
|
3
|
+
export function createApiRequestMediaTypeSchema(mediaTypes, includeExplanations = false, requireExplanations = true) {
|
|
3
4
|
z.boolean().parse(includeExplanations);
|
|
4
5
|
if (mediaTypes.length < 2)
|
|
5
6
|
throw new Error('request media selection requires multiple declared media types');
|
|
@@ -9,6 +10,10 @@ export function createApiRequestMediaTypeSchema(mediaTypes, includeExplanations
|
|
|
9
10
|
.nullable()
|
|
10
11
|
.describe('Exact OAS requestBody.content key matching an explicitly requested format, or null when the scenario leaves the format unspecified or ambiguous so code can apply the documented default. This is the request Content-Type, not the response format.'),
|
|
11
12
|
});
|
|
13
|
+
if (!requireExplanations)
|
|
14
|
+
return schema.extend({
|
|
15
|
+
explanation: optionalPlanningExplanationObjectSchema,
|
|
16
|
+
});
|
|
12
17
|
return includeExplanations
|
|
13
18
|
? schema.extend({
|
|
14
19
|
explanation: z.strictObject({
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare function createApiSelectionAnalysisSchema(candidateIds: string[], includeExplanations?: boolean): z.ZodObject<{
|
|
2
|
+
export declare function createApiSelectionAnalysisSchema(candidateIds: string[], includeExplanations?: boolean, requireExplanations?: boolean): z.ZodObject<{
|
|
3
3
|
operations: z.ZodArray<z.ZodObject<{
|
|
4
4
|
candidateId: z.ZodEnum<{
|
|
5
5
|
[x: string]: string;
|
|
6
6
|
}>;
|
|
7
7
|
purpose: z.ZodString;
|
|
8
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
9
|
+
candidateId: z.ZodEnum<{
|
|
10
|
+
[x: string]: string;
|
|
11
|
+
}>;
|
|
12
|
+
purpose: z.ZodString;
|
|
13
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
14
|
+
reason: string;
|
|
15
|
+
} | undefined, unknown>>>;
|
|
8
16
|
}, z.core.$strict> | z.ZodObject<{
|
|
9
17
|
candidateId: z.ZodEnum<{
|
|
10
18
|
[x: string]: string;
|
|
@@ -16,6 +24,11 @@ export declare function createApiSelectionAnalysisSchema(candidateIds: string[],
|
|
|
16
24
|
}, z.core.$strict>>;
|
|
17
25
|
gaps: z.ZodArray<z.ZodObject<{
|
|
18
26
|
description: z.ZodString;
|
|
27
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
28
|
+
description: z.ZodString;
|
|
29
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
30
|
+
reason: string;
|
|
31
|
+
} | undefined, unknown>>>;
|
|
19
32
|
}, z.core.$strict> | z.ZodObject<{
|
|
20
33
|
description: z.ZodString;
|
|
21
34
|
explanation: z.ZodObject<{
|
|
@@ -29,6 +42,16 @@ export declare function createApiSelectionAnalysisSchema(candidateIds: string[],
|
|
|
29
42
|
candidateIds: z.ZodArray<z.ZodEnum<{
|
|
30
43
|
[x: string]: string;
|
|
31
44
|
}>>;
|
|
45
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"single-choice">;
|
|
47
|
+
message: z.ZodString;
|
|
48
|
+
purpose: z.ZodString;
|
|
49
|
+
candidateIds: z.ZodArray<z.ZodEnum<{
|
|
50
|
+
[x: string]: string;
|
|
51
|
+
}>>;
|
|
52
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
53
|
+
reason: string;
|
|
54
|
+
} | undefined, unknown>>>;
|
|
32
55
|
}, z.core.$strict> | z.ZodObject<{
|
|
33
56
|
kind: z.ZodLiteral<"single-choice">;
|
|
34
57
|
message: z.ZodString;
|
|
@@ -48,6 +71,18 @@ export declare function createApiSelectionAnalysisSchema(candidateIds: string[],
|
|
|
48
71
|
}>>;
|
|
49
72
|
minSelections: z.ZodNumber;
|
|
50
73
|
maxSelections: z.ZodNumber;
|
|
74
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
75
|
+
message: z.ZodString;
|
|
76
|
+
purpose: z.ZodString;
|
|
77
|
+
kind: z.ZodLiteral<"multiple-choice">;
|
|
78
|
+
candidateIds: z.ZodArray<z.ZodEnum<{
|
|
79
|
+
[x: string]: string;
|
|
80
|
+
}>>;
|
|
81
|
+
minSelections: z.ZodNumber;
|
|
82
|
+
maxSelections: z.ZodNumber;
|
|
83
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
84
|
+
reason: string;
|
|
85
|
+
} | undefined, unknown>>>;
|
|
51
86
|
}, z.core.$strict> | z.ZodObject<{
|
|
52
87
|
message: z.ZodString;
|
|
53
88
|
purpose: z.ZodString;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createApiSelectionSchema } from './api-selection-schema.js';
|
|
3
3
|
import { withApiSelectionExplanation } from './with-api-selection-explanation.js';
|
|
4
|
-
export function createApiSelectionAnalysisSchema(candidateIds, includeExplanations = false) {
|
|
4
|
+
export function createApiSelectionAnalysisSchema(candidateIds, includeExplanations = false, requireExplanations = true) {
|
|
5
5
|
const single = z.strictObject({
|
|
6
6
|
kind: z
|
|
7
7
|
.literal('single-choice')
|
|
@@ -40,13 +40,13 @@ export function createApiSelectionAnalysisSchema(candidateIds, includeExplanatio
|
|
|
40
40
|
.safe()
|
|
41
41
|
.describe('Maximum selections allowed by the user and offered candidate count. Must be at least minSelections.'),
|
|
42
42
|
});
|
|
43
|
-
return createApiSelectionSchema(candidateIds, includeExplanations).extend({
|
|
43
|
+
return createApiSelectionSchema(candidateIds, includeExplanations, requireExplanations).extend({
|
|
44
44
|
questions: z
|
|
45
45
|
.array(
|
|
46
46
|
// Literal kinds remain disjoint; z.union emits the provider-supported anyOf.
|
|
47
47
|
z.union([
|
|
48
|
-
withApiSelectionExplanation(single, includeExplanations),
|
|
49
|
-
withApiSelectionExplanation(multiple, includeExplanations),
|
|
48
|
+
withApiSelectionExplanation(single, includeExplanations, requireExplanations),
|
|
49
|
+
withApiSelectionExplanation(multiple, includeExplanations, requireExplanations),
|
|
50
50
|
]))
|
|
51
51
|
.describe('Empty when the requested API scope is clear. Multiple available APIs alone is not ambiguity. Never expand a short request into unrelated actions.'),
|
|
52
52
|
});
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare function createApiSelectionSchema(candidateIds: string[], includeExplanations?: boolean): z.ZodObject<{
|
|
2
|
+
export declare function createApiSelectionSchema(candidateIds: string[], includeExplanations?: boolean, requireExplanations?: boolean): z.ZodObject<{
|
|
3
3
|
operations: z.ZodArray<z.ZodObject<{
|
|
4
4
|
candidateId: z.ZodEnum<{
|
|
5
5
|
[x: string]: string;
|
|
6
6
|
}>;
|
|
7
7
|
purpose: z.ZodString;
|
|
8
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
9
|
+
candidateId: z.ZodEnum<{
|
|
10
|
+
[x: string]: string;
|
|
11
|
+
}>;
|
|
12
|
+
purpose: z.ZodString;
|
|
13
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
14
|
+
reason: string;
|
|
15
|
+
} | undefined, unknown>>>;
|
|
8
16
|
}, z.core.$strict> | z.ZodObject<{
|
|
9
17
|
candidateId: z.ZodEnum<{
|
|
10
18
|
[x: string]: string;
|
|
@@ -16,6 +24,11 @@ export declare function createApiSelectionSchema(candidateIds: string[], include
|
|
|
16
24
|
}, z.core.$strict>>;
|
|
17
25
|
gaps: z.ZodArray<z.ZodObject<{
|
|
18
26
|
description: z.ZodString;
|
|
27
|
+
}, z.core.$strict> | z.ZodObject<{
|
|
28
|
+
description: z.ZodString;
|
|
29
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
30
|
+
reason: string;
|
|
31
|
+
} | undefined, unknown>>>;
|
|
19
32
|
}, z.core.$strict> | z.ZodObject<{
|
|
20
33
|
description: z.ZodString;
|
|
21
34
|
explanation: z.ZodObject<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { withApiSelectionExplanation } from './with-api-selection-explanation.js';
|
|
3
|
-
export function createApiSelectionSchema(candidateIds, includeExplanations = false) {
|
|
3
|
+
export function createApiSelectionSchema(candidateIds, includeExplanations = false, requireExplanations = true) {
|
|
4
4
|
if (candidateIds.length === 0)
|
|
5
5
|
throw new Error('operations must contain candidates for model selection');
|
|
6
6
|
return z
|
|
@@ -16,7 +16,7 @@ export function createApiSelectionSchema(candidateIds, includeExplanations = fal
|
|
|
16
16
|
.min(1)
|
|
17
17
|
.describe('The scenario role of this one API call instance. Describe separate required calls separately; this is not an execution order.'),
|
|
18
18
|
})
|
|
19
|
-
.strict(), includeExplanations))
|
|
19
|
+
.strict(), includeExplanations, requireExplanations))
|
|
20
20
|
.describe('One entry per required API call instance, not a deduplicated API catalog. Repeat a candidateId only when the scenario requires separate calls to that API.'),
|
|
21
21
|
gaps: z.array(withApiSelectionExplanation(z
|
|
22
22
|
.object({
|
|
@@ -25,7 +25,7 @@ export function createApiSelectionSchema(candidateIds, includeExplanations = fal
|
|
|
25
25
|
.min(1)
|
|
26
26
|
.describe('Required API capability that no supplied discovery candidate matches. Do not judge missing parameters, response fields or security without a full contract.'),
|
|
27
27
|
})
|
|
28
|
-
.strict(), includeExplanations)),
|
|
28
|
+
.strict(), includeExplanations, requireExplanations)),
|
|
29
29
|
})
|
|
30
30
|
.strict();
|
|
31
31
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { WorkflowCapability } from '@openapi-flow/core';
|
|
3
|
-
import type { WorkflowConnectionPlanningOutput } from '../types/workflow-orchestration.js';
|
|
4
|
-
import type { ReviewableWorkflowGraphModelOutput } from '../types/reviewable-workflow-planning.js';
|
|
5
3
|
import type { WorkflowGraphExplanationMode } from '../types/workflow-planning.js';
|
|
6
|
-
export declare function createReviewableWorkflowGraphSchema(capabilities: WorkflowCapability[], readyCallIds: string[], explanationMode?: WorkflowGraphExplanationMode): z.
|
|
4
|
+
export declare function createReviewableWorkflowGraphSchema(capabilities: WorkflowCapability[], readyCallIds: string[], explanationMode?: WorkflowGraphExplanationMode): z.ZodObject<{
|
|
5
|
+
edges: z.ZodArray<z.ZodObject<{
|
|
6
|
+
from: z.ZodString;
|
|
7
|
+
output: z.ZodString;
|
|
8
|
+
to: z.ZodString;
|
|
9
|
+
input: z.ZodString;
|
|
10
|
+
reason?: z.ZodString | undefined;
|
|
11
|
+
}, z.core.$strict>>;
|
|
12
|
+
additionalGaps: z.ZodArray<z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
}, z.core.$strict>>;
|
|
16
|
+
reason?: z.ZodString | undefined;
|
|
17
|
+
}, z.core.$strict>;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare function withApiSelectionExplanation<Shape extends z.ZodRawShape>(schema: z.ZodObject<Shape, z.core.$strict>, includeExplanations: boolean): z.ZodObject<Shape, z.core.$strict> | z.ZodObject<(keyof Shape & "explanation" extends never ? Shape & {
|
|
2
|
+
export declare function withApiSelectionExplanation<Shape extends z.ZodRawShape>(schema: z.ZodObject<Shape, z.core.$strict>, includeExplanations: boolean, requireExplanations?: boolean): z.ZodObject<Shape, z.core.$strict> | z.ZodObject<(keyof Shape & "explanation" extends never ? Shape & {
|
|
3
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
4
|
+
reason: string;
|
|
5
|
+
} | undefined, unknown>>>;
|
|
6
|
+
} : { [K in keyof Shape as K extends "explanation" ? never : K]: Shape[K]; } & {
|
|
7
|
+
explanation: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
|
|
8
|
+
reason: string;
|
|
9
|
+
} | undefined, unknown>>>;
|
|
10
|
+
}) extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$strict> | z.ZodObject<(keyof Shape & "explanation" extends never ? Shape & {
|
|
3
11
|
explanation: z.ZodObject<{
|
|
4
12
|
reason: z.ZodString;
|
|
5
13
|
}, z.core.$strict>;
|
|
6
|
-
} : { [
|
|
14
|
+
} : { [K_1 in keyof Shape as K_1 extends "explanation" ? never : K_1]: Shape[K_1]; } & {
|
|
7
15
|
explanation: z.ZodObject<{
|
|
8
16
|
reason: z.ZodString;
|
|
9
17
|
}, z.core.$strict>;
|
|
10
|
-
}) extends infer
|
|
18
|
+
}) extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never, z.core.$strict>;
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
const apiSelectionExplanationSchema = z.strictObject({
|
|
3
|
+
reason: z
|
|
4
|
+
.string()
|
|
5
|
+
.min(1)
|
|
6
|
+
.refine((value) => value.trim().length > 0)
|
|
7
|
+
.describe('Short user-facing reason in the scenario language for this selection, missing capability or consequential API choice. Use only the supplied scenario and discovery metadata; code attaches those unchanged sources. Do not claim request, response or security contract validation, or expose private chain-of-thought.'),
|
|
8
|
+
});
|
|
9
|
+
export function withApiSelectionExplanation(schema, includeExplanations, requireExplanations = true) {
|
|
3
10
|
z.boolean().parse(includeExplanations);
|
|
11
|
+
if (!requireExplanations)
|
|
12
|
+
return schema.extend({
|
|
13
|
+
explanation: z
|
|
14
|
+
.unknown()
|
|
15
|
+
.transform((value) => {
|
|
16
|
+
const explanation = apiSelectionExplanationSchema.safeParse(value);
|
|
17
|
+
return includeExplanations && explanation.success
|
|
18
|
+
? explanation.data
|
|
19
|
+
: undefined;
|
|
20
|
+
})
|
|
21
|
+
.optional(),
|
|
22
|
+
});
|
|
4
23
|
return includeExplanations
|
|
5
24
|
? schema.extend({
|
|
6
|
-
explanation:
|
|
7
|
-
reason: z
|
|
8
|
-
.string()
|
|
9
|
-
.min(1)
|
|
10
|
-
.refine((value) => value.trim().length > 0)
|
|
11
|
-
.describe('Short user-facing reason in the scenario language for this selection, missing capability or consequential API choice. Use only the supplied scenario and discovery metadata; code attaches those unchanged sources. Do not claim request, response or security contract validation, or expose private chain-of-thought.'),
|
|
12
|
-
}),
|
|
25
|
+
explanation: apiSelectionExplanationSchema,
|
|
13
26
|
})
|
|
14
27
|
: schema;
|
|
15
28
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { WorkflowConnectionPlanningContext } from '@openapi-flow/core';
|
|
3
|
+
import type { WorkflowConnectionExecutionOutput } from '../types/workflow-connection-selection.js';
|
|
4
|
+
/** Validate executable fields independently of optional model-authored display text. */
|
|
5
|
+
export declare function createWorkflowConnectionExecutionSchema(context: WorkflowConnectionPlanningContext, includeExplanations: boolean): z.ZodType<WorkflowConnectionExecutionOutput>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { workflowConnectionProposalSchema } from '@openapi-flow/core';
|
|
3
|
+
import { createWorkflowConnectionSelectionSchema } from './workflow-connection-selection-schema.js';
|
|
4
|
+
/** Validate executable fields independently of optional model-authored display text. */
|
|
5
|
+
export function createWorkflowConnectionExecutionSchema(context, includeExplanations) {
|
|
6
|
+
const execution = createWorkflowConnectionSelectionSchema(context, false);
|
|
7
|
+
if (!includeExplanations)
|
|
8
|
+
return execution;
|
|
9
|
+
const display = { reason: z.unknown().optional() };
|
|
10
|
+
const base = execution.extend({
|
|
11
|
+
...display,
|
|
12
|
+
edges: z.array(execution.shape.edges.element.extend(display)),
|
|
13
|
+
});
|
|
14
|
+
if (context.readyCallIds.length)
|
|
15
|
+
return base.extend({
|
|
16
|
+
blockedCalls: z.array(workflowConnectionProposalSchema.shape.blockedCalls.element.extend({
|
|
17
|
+
callId: z.enum(context.readyCallIds),
|
|
18
|
+
...display,
|
|
19
|
+
})),
|
|
20
|
+
});
|
|
21
|
+
return base;
|
|
22
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { WorkflowConnectionGoalReviewDescription } from '@openapi-flow/core';
|
|
3
3
|
import type { WorkflowConnectionGoalReviewModelOutput } from '../types/workflow-connection-goal-review.js';
|
|
4
|
-
export declare function createWorkflowConnectionGoalReviewSchema(description: WorkflowConnectionGoalReviewDescription): z.ZodType<WorkflowConnectionGoalReviewModelOutput>;
|
|
4
|
+
export declare function createWorkflowConnectionGoalReviewSchema(description: WorkflowConnectionGoalReviewDescription, validatePresentation?: boolean): z.ZodType<WorkflowConnectionGoalReviewModelOutput>;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { workflowConnectionGoalAssessmentSchema } from '@openapi-flow/core';
|
|
3
|
-
export function createWorkflowConnectionGoalReviewSchema(description) {
|
|
3
|
+
export function createWorkflowConnectionGoalReviewSchema(description, validatePresentation = true) {
|
|
4
4
|
const assessment = workflowConnectionGoalAssessmentSchema
|
|
5
|
-
.omit({ factId: true })
|
|
5
|
+
.omit({ factId: true, sourceQuotes: true, explanationStatus: true })
|
|
6
6
|
.extend({
|
|
7
7
|
policyIds: workflowConnectionGoalAssessmentSchema.shape.policyIds.describe('Select only supplied code-enforced policy IDs for clauses actually covered by that policy. A protected-edge policy does not prove data semantics or implementation of new connections.'),
|
|
8
8
|
goalIds: z
|
|
9
9
|
.array(z.enum(description.goals.map((goal) => goal.id)))
|
|
10
10
|
.describe('Select only actual candidate goals. An omitted requirement may have no matching goal.'),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
.min(1)
|
|
18
|
-
.describe('Brief evidence-based explanation comparing the entire original requirement with goals and actual mappings. Not private reasoning.'),
|
|
11
|
+
reason: validatePresentation
|
|
12
|
+
? z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('Brief evidence-based explanation comparing the entire original requirement with goals and actual mappings. Not private reasoning.')
|
|
16
|
+
: z.unknown().optional(),
|
|
19
17
|
});
|
|
20
18
|
return z.strictObject({
|
|
21
19
|
assessments: z.strictObject(Object.fromEntries(description.requirements.map((fact) => [
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { WorkflowConnectionPlanningContext } from '@openapi-flow/core';
|
|
3
|
+
/** Existing identities are supplied choices. Only new gap identities belong to the model. */
|
|
4
|
+
export declare function createWorkflowConnectionSelectionSchema(context: WorkflowConnectionPlanningContext, includeExplanations: boolean): z.ZodObject<{
|
|
5
|
+
additionalGaps: z.ZodArray<z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
description: z.ZodString;
|
|
8
|
+
}, z.core.$strict>>;
|
|
9
|
+
reason?: z.ZodString | undefined;
|
|
10
|
+
edges: z.ZodArray<z.ZodObject<{
|
|
11
|
+
from: z.ZodObject<{
|
|
12
|
+
gapId: z.ZodString;
|
|
13
|
+
}, z.core.$strict> | z.ZodUnion<readonly [z.ZodEnum<{
|
|
14
|
+
[x: string]: string;
|
|
15
|
+
}>, z.ZodObject<{
|
|
16
|
+
gapId: z.ZodString;
|
|
17
|
+
}, z.core.$strict>]>;
|
|
18
|
+
output: z.ZodEnum<{
|
|
19
|
+
[x: string]: string;
|
|
20
|
+
}>;
|
|
21
|
+
to: z.ZodObject<{
|
|
22
|
+
gapId: z.ZodString;
|
|
23
|
+
}, z.core.$strict> | z.ZodUnion<readonly [z.ZodEnum<{
|
|
24
|
+
[x: string]: string;
|
|
25
|
+
}>, z.ZodObject<{
|
|
26
|
+
gapId: z.ZodString;
|
|
27
|
+
}, z.core.$strict>]>;
|
|
28
|
+
input: z.ZodEnum<{
|
|
29
|
+
[x: string]: string;
|
|
30
|
+
}>;
|
|
31
|
+
reason?: z.ZodString | undefined;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createReviewableWorkflowGraphSchema } from './reviewable-workflow-graph-schema.js';
|
|
3
|
+
import { workflowConnectionReasonSchema } from './workflow-connection-explanation-schema.js';
|
|
4
|
+
/** Existing identities are supplied choices. Only new gap identities belong to the model. */
|
|
5
|
+
export function createWorkflowConnectionSelectionSchema(context, includeExplanations) {
|
|
6
|
+
const nodeIds = context.nodes.map((node) => node.id);
|
|
7
|
+
const additionalGap = z.strictObject({
|
|
8
|
+
gapId: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.describe('ID of a NEW gap declared in additionalGaps, not an existing node.'),
|
|
12
|
+
});
|
|
13
|
+
const endpoint = nodeIds.length
|
|
14
|
+
? z.union([z.enum(nodeIds), additionalGap])
|
|
15
|
+
: additionalGap;
|
|
16
|
+
const outputs = [
|
|
17
|
+
...new Set(['main', ...context.nodes.flatMap((node) => node.outputs)]),
|
|
18
|
+
];
|
|
19
|
+
const inputs = [
|
|
20
|
+
...new Set(['main', ...context.nodes.flatMap((node) => node.inputs)]),
|
|
21
|
+
];
|
|
22
|
+
const base = createReviewableWorkflowGraphSchema([], context.readyCallIds, includeExplanations ? 'connections' : 'none');
|
|
23
|
+
return base.extend({
|
|
24
|
+
edges: z.array(z.strictObject({
|
|
25
|
+
...(includeExplanations
|
|
26
|
+
? { reason: workflowConnectionReasonSchema }
|
|
27
|
+
: {}),
|
|
28
|
+
from: endpoint.describe('Choose an exact supplied source ID, or explicitly reference a new gap.'),
|
|
29
|
+
output: z.enum(outputs),
|
|
30
|
+
to: endpoint.describe('Choose an exact supplied target ID, or explicitly reference a new gap.'),
|
|
31
|
+
input: z.enum(inputs),
|
|
32
|
+
})),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -8,6 +8,7 @@ import { assertSelectionInput } from '../legacy/planning/select-operation.js';
|
|
|
8
8
|
import { selectApiOperations } from './select-api-operations.js';
|
|
9
9
|
import { resolveApiSelectionOptions } from './resolve-api-selection-options.js';
|
|
10
10
|
import { apiSelectionExplanationPrompt } from '../prompts/api-selection-explanation-prompt.js';
|
|
11
|
+
import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
|
|
11
12
|
/** Additive clarification boundary; the existing selector keeps its output contract. */
|
|
12
13
|
export async function analyzeApiSelection(input) {
|
|
13
14
|
assertSelectionInput(input.scenario, input.model);
|
|
@@ -28,7 +29,7 @@ export async function analyzeApiSelection(input) {
|
|
|
28
29
|
}));
|
|
29
30
|
const schema = createApiSelectionAnalysisSchema(candidates.map((item) => item.candidateId), includeExplanations);
|
|
30
31
|
const proposed = await input.model
|
|
31
|
-
.withStructuredOutput(schema, {
|
|
32
|
+
.withStructuredOutput(serializeStructuredOutputSchema(schema, 'draft-2020-12'), {
|
|
32
33
|
name: 'analyze_api_selection',
|
|
33
34
|
method: 'jsonSchema',
|
|
34
35
|
strict: true,
|
|
@@ -37,7 +38,7 @@ export async function analyzeApiSelection(input) {
|
|
|
37
38
|
new SystemMessage(`${apiSelectionAnalysisPrompt}\n${apiSelectionExplanationPrompt}`),
|
|
38
39
|
new HumanMessage(JSON.stringify({ scenario: context.scenario, candidates })),
|
|
39
40
|
]);
|
|
40
|
-
const parsed = parseStructuredOutput(
|
|
41
|
+
const parsed = parseStructuredOutput(createApiSelectionAnalysisSchema(candidates.map((candidate) => candidate.candidateId), includeExplanations, false), proposed, 'model API selection analysis');
|
|
41
42
|
const byId = new Map(candidates.map((item) => [item.candidateId, item]));
|
|
42
43
|
const selected = parsed.operations.map((item) => {
|
|
43
44
|
const candidate = byId.get(item.candidateId);
|
|
@@ -46,7 +47,7 @@ export async function analyzeApiSelection(input) {
|
|
|
46
47
|
return {
|
|
47
48
|
key: structuredClone(candidate.key),
|
|
48
49
|
purpose: item.purpose,
|
|
49
|
-
...('explanation' in item
|
|
50
|
+
...('explanation' in item && item.explanation !== undefined
|
|
50
51
|
? {
|
|
51
52
|
explanation: createApiSelectionExplanation({
|
|
52
53
|
context,
|
|
@@ -85,7 +86,7 @@ export async function analyzeApiSelection(input) {
|
|
|
85
86
|
message: question.message,
|
|
86
87
|
purpose: question.purpose,
|
|
87
88
|
candidates: alternatives,
|
|
88
|
-
...('explanation' in question
|
|
89
|
+
...('explanation' in question && question.explanation !== undefined
|
|
89
90
|
? {
|
|
90
91
|
explanation: createApiSelectionExplanation({
|
|
91
92
|
context,
|
|
@@ -117,7 +118,7 @@ export async function analyzeApiSelection(input) {
|
|
|
117
118
|
gaps: parsed.gaps.map((gap) => ({
|
|
118
119
|
kind: 'missing_operation',
|
|
119
120
|
description: gap.description,
|
|
120
|
-
...('explanation' in gap
|
|
121
|
+
...('explanation' in gap && gap.explanation !== undefined
|
|
121
122
|
? {
|
|
122
123
|
explanation: createApiSelectionExplanation({
|
|
123
124
|
context,
|
|
@@ -7,6 +7,7 @@ import { parseStructuredOutput } from '../legacy/planning/parse-structured-outpu
|
|
|
7
7
|
import { resolveApiSelectionOptions } from './resolve-api-selection-options.js';
|
|
8
8
|
import { apiSelectionExplanationPrompt } from '../prompts/api-selection-explanation-prompt.js';
|
|
9
9
|
import { invokeStructuredModel } from '../model/invoke-structured-model.js';
|
|
10
|
+
import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
|
|
10
11
|
export async function selectApiOperations(input) {
|
|
11
12
|
const { scenario, model } = input;
|
|
12
13
|
const { includeExplanations, context } = runOpenApiFlowOperation({
|
|
@@ -46,7 +47,7 @@ export async function selectApiOperations(input) {
|
|
|
46
47
|
const schema = createApiSelectionSchema(candidates.map((candidate) => candidate.candidateId), includeExplanations);
|
|
47
48
|
const proposed = await invokeStructuredModel({
|
|
48
49
|
model,
|
|
49
|
-
schema,
|
|
50
|
+
schema: serializeStructuredOutputSchema(schema, 'draft-2020-12'),
|
|
50
51
|
operation: 'selectApiOperations',
|
|
51
52
|
name: 'select_api_operations',
|
|
52
53
|
method: 'jsonSchema',
|
|
@@ -62,7 +63,7 @@ export async function selectApiOperations(input) {
|
|
|
62
63
|
stage: 'contract-validation',
|
|
63
64
|
code: 'API_SELECTION_INVALID',
|
|
64
65
|
}, () => {
|
|
65
|
-
const selection = parseStructuredOutput(
|
|
66
|
+
const selection = parseStructuredOutput(createApiSelectionSchema(candidates.map((candidate) => candidate.candidateId), includeExplanations, false), proposed, 'model API selection');
|
|
66
67
|
if (selection.operations.length === 0 && selection.gaps.length === 0)
|
|
67
68
|
throw new Error('model API selection must contain operations or gaps');
|
|
68
69
|
const byId = new Map(candidates.map((candidate) => [candidate.candidateId, candidate]));
|
|
@@ -74,7 +75,7 @@ export async function selectApiOperations(input) {
|
|
|
74
75
|
return {
|
|
75
76
|
key: { ...candidate.key },
|
|
76
77
|
purpose: item.purpose,
|
|
77
|
-
...('explanation' in item
|
|
78
|
+
...('explanation' in item && item.explanation !== undefined
|
|
78
79
|
? {
|
|
79
80
|
explanation: createApiSelectionExplanation({
|
|
80
81
|
context,
|
|
@@ -88,7 +89,7 @@ export async function selectApiOperations(input) {
|
|
|
88
89
|
gaps: selection.gaps.map((gap) => ({
|
|
89
90
|
kind: 'missing_operation',
|
|
90
91
|
description: gap.description,
|
|
91
|
-
...('explanation' in gap
|
|
92
|
+
...('explanation' in gap && gap.explanation !== undefined
|
|
92
93
|
? {
|
|
93
94
|
explanation: createApiSelectionExplanation({
|
|
94
95
|
context,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type { ApiLiteralGenerationInput, ApiCallArguments, ApiArgumentProposal, ApiLiteralProposalSource, OpenApiFlowError, WorkflowConnectionApiRepairContext, ApiInputLiteralSource } from '@openapi-flow/core';
|
|
2
|
+
import type { ApiLiteralGenerationInput, ApiCallArguments, ApiArgumentProposal, ApiLiteralProposalSource, OpenApiFlowError, WorkflowConnectionApiRepairContext, ApiInputLiteralSource, ApiArgumentEnumContextInput } from '@openapi-flow/core';
|
|
3
3
|
import type { z } from 'zod';
|
|
4
4
|
import type { apiLiteralGenerationReasonSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
5
5
|
import type { apiLiteralNotProvidedSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
6
|
-
import type { createApiLiteralProvidedSchema, createApiTrackedLiteralGenerationSchema, createApiExplainedTrackedLiteralGenerationSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
6
|
+
import type { createApiLiteralProvidedSchema, createApiTrackedLiteralGenerationSchema, createApiExplainedTrackedLiteralGenerationSchema, createApiEnumIntentInputsSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
7
7
|
import type { apiLiteralGenerationOptionsSchema } from '../schemas/api-literal-generation-output-schema.js';
|
|
8
8
|
import type { apiArgumentRejectionSchema } from '../schemas/api-argument-rejection-schema.js';
|
|
9
9
|
export interface GenerateApiArgumentsInput extends ApiLiteralGenerationInput {
|
|
@@ -31,20 +31,20 @@ export interface ApiArgumentPlanningFailure {
|
|
|
31
31
|
sourceFingerprint: string;
|
|
32
32
|
output: unknown;
|
|
33
33
|
}
|
|
34
|
-
export interface InterpretApiArgumentEnumsInput extends GenerateApiArgumentsInput {
|
|
34
|
+
export interface InterpretApiArgumentEnumsInput extends GenerateApiArgumentsInput, Required<Pick<ApiArgumentEnumContextInput, 'enumIntentInputs'>> {
|
|
35
35
|
arguments: ApiCallArguments;
|
|
36
36
|
proposal: ApiArgumentProposal;
|
|
37
37
|
literalSources: ApiLiteralProposalSource[];
|
|
38
38
|
}
|
|
39
39
|
export type ApiLiteralProvidedDecision = z.infer<ReturnType<typeof createApiLiteralProvidedSchema>>;
|
|
40
40
|
export type ApiLiteralAvailabilityDecision = z.infer<typeof apiLiteralNotProvidedSchema> | ApiLiteralProvidedDecision;
|
|
41
|
-
export type ApiTrackedLiteralGenerationOutput = z.infer<ReturnType<typeof createApiTrackedLiteralGenerationSchema>> | z.infer<ReturnType<typeof createApiExplainedTrackedLiteralGenerationSchema
|
|
41
|
+
export type ApiTrackedLiteralGenerationOutput = (z.infer<ReturnType<typeof createApiTrackedLiteralGenerationSchema>> | z.infer<ReturnType<typeof createApiExplainedTrackedLiteralGenerationSchema>>) & Partial<Record<'enumIntentInputs', z.infer<ReturnType<typeof createApiEnumIntentInputsSchema>>>>;
|
|
42
42
|
export interface ApiExplainedLiteralGenerationOutput extends ApiArgumentProposal {
|
|
43
|
-
explanation
|
|
43
|
+
explanation?: z.infer<typeof apiLiteralGenerationReasonSchema>;
|
|
44
44
|
}
|
|
45
45
|
export type ApiLiteralGenerationOutput = ApiArgumentProposal | ApiExplainedLiteralGenerationOutput | ApiTrackedLiteralGenerationOutput;
|
|
46
46
|
export type ApiLiteralGenerationOutputSchema = z.ZodType<ApiLiteralGenerationOutput>;
|
|
47
|
-
export interface ResolvedApiLiteralGenerationOutput extends ApiArgumentProposal {
|
|
47
|
+
export interface ResolvedApiLiteralGenerationOutput extends ApiArgumentProposal, Pick<ApiArgumentEnumContextInput, 'enumIntentInputs'> {
|
|
48
48
|
requestedInputs?: string[];
|
|
49
49
|
literalSources?: ApiLiteralGenerationSource[];
|
|
50
50
|
explanation?: z.infer<typeof apiLiteralGenerationReasonSchema>;
|
|
@@ -61,6 +61,8 @@ export interface InvokeConnectionPlanningModelInput<Output extends object> {
|
|
|
61
61
|
operation: string;
|
|
62
62
|
name: string;
|
|
63
63
|
schema: ZodType<Output>;
|
|
64
|
+
/** Optional distinct receiver validation when display-only fields must not gate execution. */
|
|
65
|
+
validationSchema?: ZodType<Output>;
|
|
64
66
|
messages: BaseMessage[];
|
|
65
67
|
sourceFingerprint?: string;
|
|
66
68
|
requestFingerprint?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type { NativeSelectedPlanningInput } from '@openapi-flow/core';
|
|
2
|
+
import type { NativeSelectedPlanningInput, NativeInstanceSelectionReviewOptions } from '@openapi-flow/core';
|
|
3
3
|
import type { NativePlanningRejectedProposal } from './native-planning-rejection.js';
|
|
4
|
-
export interface ReviewNativeInstanceSelectionInput extends NativeSelectedPlanningInput {
|
|
4
|
+
export interface ReviewNativeInstanceSelectionInput extends NativeSelectedPlanningInput, NativeInstanceSelectionReviewOptions {
|
|
5
5
|
model?: BaseChatModel;
|
|
6
6
|
signal?: AbortSignal;
|
|
7
7
|
rejectedProposals?: NativePlanningRejectedProposal[];
|