@openapi-flow/core 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arguments/clarification/extraction/create-api-input-answer-extraction-record.js +1 -0
- package/dist/arguments/clarification/extraction/resolve-api-input-answer-interpretations.js +1 -0
- package/dist/arguments/clarification/extraction/resolve-api-input-answer-sources.js +1 -0
- package/dist/arguments/clarification/extraction/resolve-api-input-source-selections.js +1 -0
- package/dist/arguments/clarification/extraction/validate-api-input-answer-analysis.js +1 -0
- package/dist/arguments/clarification/extraction/validate-api-input-answer-extraction-record.js +1 -0
- package/dist/arguments/enum/describe-api-argument-enum-context.d.ts +4 -0
- package/dist/arguments/enum/describe-api-argument-enum-context.js +41 -0
- package/dist/arguments/enum/expand-requested-enum-requirements.d.ts +4 -0
- package/dist/arguments/enum/expand-requested-enum-requirements.js +45 -0
- package/dist/arguments/enum/resolve-api-argument-enum-interpretation.d.ts +3 -0
- package/dist/arguments/enum/resolve-api-argument-enum-interpretation.js +26 -0
- package/dist/arguments/sources/resolve-api-literal-proposal-sources.d.ts +3 -0
- package/dist/arguments/sources/resolve-api-literal-proposal-sources.js +58 -0
- package/dist/draft/edits/api/resolve-workflow-draft-api-literal-sources.js +9 -56
- package/dist/public-api.d.ts +7 -0
- package/dist/public-api.js +5 -0
- package/dist/schemas/api-input-answer-extraction-schema.d.ts +1 -0
- package/dist/schemas/api-input-answer-extraction-schema.js +5 -0
- package/dist/types/api-argument-enum.d.ts +23 -0
- package/dist/types/api-argument-enum.js +1 -0
- package/dist/types/api-arguments.d.ts +6 -0
- package/dist/types/api-input-answer-extraction.d.ts +2 -0
- package/dist/types/api-input-literal-source.d.ts +15 -0
- package/dist/types/workflow-draft-api-literal-sources.d.ts +3 -9
- package/package.json +1 -1
package/dist/arguments/clarification/extraction/create-api-input-answer-extraction-record.js
CHANGED
|
@@ -5,6 +5,7 @@ export function createApiInputAnswerExtractionRecord(input) {
|
|
|
5
5
|
const evidence = captureApiInputAnswerContext({
|
|
6
6
|
reply: input.reply,
|
|
7
7
|
requirements: input.requirements,
|
|
8
|
+
...(input.purpose === undefined ? {} : { purpose: input.purpose }),
|
|
8
9
|
...(input.selectOasEnums === undefined
|
|
9
10
|
? {}
|
|
10
11
|
: { selectOasEnums: input.selectOasEnums }),
|
|
@@ -8,6 +8,7 @@ export function resolveApiInputAnswerInterpretations(input) {
|
|
|
8
8
|
const context = captureApiInputAnswerContext({
|
|
9
9
|
reply: input.reply,
|
|
10
10
|
requirements: input.requirements,
|
|
11
|
+
...(input.purpose === undefined ? {} : { purpose: input.purpose }),
|
|
11
12
|
...(input.selectOasEnums === undefined
|
|
12
13
|
? {}
|
|
13
14
|
: { selectOasEnums: input.selectOasEnums }),
|
|
@@ -8,6 +8,7 @@ export function resolveApiInputAnswerSources(input) {
|
|
|
8
8
|
const context = captureApiInputAnswerContext({
|
|
9
9
|
reply: input.reply,
|
|
10
10
|
requirements: input.requirements,
|
|
11
|
+
...(input.purpose === undefined ? {} : { purpose: input.purpose }),
|
|
11
12
|
});
|
|
12
13
|
const selections = apiInputAnswerSourcesSchema.parse(input.selections);
|
|
13
14
|
const answered = new Set();
|
|
@@ -6,6 +6,7 @@ export function resolveApiInputSourceSelections(input) {
|
|
|
6
6
|
const context = captureApiInputAnswerContext({
|
|
7
7
|
reply: input.reply,
|
|
8
8
|
requirements: input.requirements,
|
|
9
|
+
...(input.purpose === undefined ? {} : { purpose: input.purpose }),
|
|
9
10
|
});
|
|
10
11
|
const catalog = describeApiInputSources(context.reply);
|
|
11
12
|
const selections = apiInputAnswerSelectionsSchema.parse(input.selections);
|
|
@@ -6,6 +6,7 @@ export function validateApiInputAnswerAnalysis(input) {
|
|
|
6
6
|
const context = {
|
|
7
7
|
reply: input.reply,
|
|
8
8
|
requirements: input.requirements,
|
|
9
|
+
...(input.purpose === undefined ? {} : { purpose: input.purpose }),
|
|
9
10
|
...(input.selectOasEnums === undefined
|
|
10
11
|
? {}
|
|
11
12
|
: { selectOasEnums: input.selectOasEnums }),
|
package/dist/arguments/clarification/extraction/validate-api-input-answer-extraction-record.js
CHANGED
|
@@ -5,6 +5,7 @@ export function validateApiInputAnswerExtractionRecord(input) {
|
|
|
5
5
|
const expected = createApiInputAnswerExtractionRecord({
|
|
6
6
|
reply: input.reply,
|
|
7
7
|
requirements: input.requirements,
|
|
8
|
+
...(input.purpose === undefined ? {} : { purpose: input.purpose }),
|
|
8
9
|
...(input.selectOasEnums === undefined
|
|
9
10
|
? {}
|
|
10
11
|
: { selectOasEnums: input.selectOasEnums }),
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiArgumentEnumContextInput } from '../../types/api-argument-enum.js';
|
|
2
|
+
import type { ApiInputAnswerContext } from '../../types/api-input-answer-extraction.js';
|
|
3
|
+
/** Derive real unanswered OAS enum questions, not a synthetic draft/edit plan. */
|
|
4
|
+
export declare function describeApiArgumentEnumContext(input: ApiArgumentEnumContextInput): ApiInputAnswerContext;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describeApiLiteralGeneration } from '../generation/describe-api-literal-generation.js';
|
|
2
|
+
import { inspectApiArgumentRequirements } from '../clarification/inspect-api-argument-requirements.js';
|
|
3
|
+
import { describeApiInputEnumAnswerChoices } from './describe-api-input-enum-answer-choices.js';
|
|
4
|
+
import { applyConfirmedApiInputs } from '../clarification/apply-confirmed-api-inputs.js';
|
|
5
|
+
import { resolveApiLiteralProposalSources } from '../sources/resolve-api-literal-proposal-sources.js';
|
|
6
|
+
import { expandRequestedEnumRequirements } from './expand-requested-enum-requirements.js';
|
|
7
|
+
/** Derive real unanswered OAS enum questions, not a synthetic draft/edit plan. */
|
|
8
|
+
export function describeApiArgumentEnumContext(input) {
|
|
9
|
+
const { input: snapshot, contract } = describeApiLiteralGeneration(input);
|
|
10
|
+
const proposal = contract.schema.parse(input.proposal);
|
|
11
|
+
resolveApiLiteralProposalSources({
|
|
12
|
+
callId: snapshot.callId,
|
|
13
|
+
values: proposal.values,
|
|
14
|
+
sources: input.literalSources,
|
|
15
|
+
messages: [{ id: 'scenario', text: snapshot.scenario }],
|
|
16
|
+
});
|
|
17
|
+
const values = applyConfirmedApiInputs({
|
|
18
|
+
...snapshot,
|
|
19
|
+
values: proposal.values,
|
|
20
|
+
});
|
|
21
|
+
const inspected = inspectApiArgumentRequirements({
|
|
22
|
+
...snapshot,
|
|
23
|
+
values,
|
|
24
|
+
requestedInputs: input.requestedInputs,
|
|
25
|
+
});
|
|
26
|
+
const context = {
|
|
27
|
+
reply: snapshot.scenario,
|
|
28
|
+
requirements: expandRequestedEnumRequirements({
|
|
29
|
+
...input,
|
|
30
|
+
values,
|
|
31
|
+
requirements: inspected.requirements,
|
|
32
|
+
}),
|
|
33
|
+
selectOasEnums: true,
|
|
34
|
+
...(snapshot.purpose === undefined ? {} : { purpose: snapshot.purpose }),
|
|
35
|
+
};
|
|
36
|
+
const ids = new Set(describeApiInputEnumAnswerChoices(context).map((choice) => choice.requirementId));
|
|
37
|
+
return {
|
|
38
|
+
...context,
|
|
39
|
+
requirements: context.requirements.filter((item) => ids.has(item.id)),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiArgumentEnumRequirementsInput } from '../../types/api-argument-enum.js';
|
|
2
|
+
import type { ApiInputRequirement } from '../../types/api-clarification.js';
|
|
3
|
+
/** Missing containers need no fabricated value to expose their explicitly requested OAS descendants. */
|
|
4
|
+
export declare function expandRequestedEnumRequirements(input: ApiArgumentEnumRequirementsInput): ApiInputRequirement[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { requestBindingSchemas } from '../../bindings/request-binding-schema.js';
|
|
3
|
+
import { unionBindingSchemas } from '../../bindings/combine-binding-schemas.js';
|
|
4
|
+
import { hasPointer } from '../../bindings/json-pointer.js';
|
|
5
|
+
/** Missing containers need no fabricated value to expose their explicitly requested OAS descendants. */
|
|
6
|
+
export function expandRequestedEnumRequirements(input) {
|
|
7
|
+
const requirements = structuredClone(input.requirements);
|
|
8
|
+
const owned = [
|
|
9
|
+
...input.bindings.map((binding) => binding.targetPointer),
|
|
10
|
+
...(input.confirmedInputs === undefined
|
|
11
|
+
? []
|
|
12
|
+
: input.confirmedInputs.map((value) => value.targetPointer)),
|
|
13
|
+
];
|
|
14
|
+
for (const parent of input.requirements) {
|
|
15
|
+
if (parent.requestedInputs === undefined)
|
|
16
|
+
continue;
|
|
17
|
+
for (const targetPointer of parent.requestedInputs) {
|
|
18
|
+
if (requirements.some((item) => item.targetPointer === targetPointer) ||
|
|
19
|
+
hasPointer(input.values, targetPointer) ||
|
|
20
|
+
owned.some((pointer) => overlaps(pointer, targetPointer)))
|
|
21
|
+
continue;
|
|
22
|
+
const schemas = requestBindingSchemas(input, targetPointer);
|
|
23
|
+
if (!schemas.length)
|
|
24
|
+
throw new Error(`Requested enum input ${targetPointer} has no original OAS contract`);
|
|
25
|
+
const schema = unionBindingSchemas(schemas);
|
|
26
|
+
requirements.push({
|
|
27
|
+
...parent,
|
|
28
|
+
kind: 'requested-input',
|
|
29
|
+
id: createHash('sha256')
|
|
30
|
+
.update(JSON.stringify([parent.id, targetPointer, schema]))
|
|
31
|
+
.digest('hex'),
|
|
32
|
+
targetPointer,
|
|
33
|
+
schema,
|
|
34
|
+
requestedInputs: [targetPointer],
|
|
35
|
+
message: `Provide scenario-requested value ${targetPointer} for ${input.operation.method} ${input.operation.path}.`,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return requirements;
|
|
40
|
+
}
|
|
41
|
+
function overlaps(left, right) {
|
|
42
|
+
return (left === right ||
|
|
43
|
+
left.startsWith(right + '/') ||
|
|
44
|
+
right.startsWith(left + '/'));
|
|
45
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResolveApiArgumentEnumInterpretationInput, ApiArgumentEnumResolution } from '../../types/api-argument-enum.js';
|
|
2
|
+
/** Replay copied OAS values against independently supplied input; keep semantic evidence separate. */
|
|
3
|
+
export declare function resolveApiArgumentEnumInterpretation(input: ResolveApiArgumentEnumInterpretationInput): ApiArgumentEnumResolution;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describeApiArgumentEnumContext } from './describe-api-argument-enum-context.js';
|
|
2
|
+
import { validateApiInputAnswerAnalysis } from '../clarification/extraction/validate-api-input-answer-analysis.js';
|
|
3
|
+
import { assignApiInputValue } from '../clarification/assign-api-input-value.js';
|
|
4
|
+
import { inspectApiArgumentRequirements } from '../clarification/inspect-api-argument-requirements.js';
|
|
5
|
+
import { applyConfirmedApiInputs } from '../clarification/apply-confirmed-api-inputs.js';
|
|
6
|
+
/** Replay copied OAS values against independently supplied input; keep semantic evidence separate. */
|
|
7
|
+
export function resolveApiArgumentEnumInterpretation(input) {
|
|
8
|
+
const context = describeApiArgumentEnumContext(input);
|
|
9
|
+
validateApiInputAnswerAnalysis({ ...context, analysis: input.analysis });
|
|
10
|
+
const values = applyConfirmedApiInputs({
|
|
11
|
+
...input,
|
|
12
|
+
values: input.proposal.values,
|
|
13
|
+
});
|
|
14
|
+
for (const answer of input.analysis.answers) {
|
|
15
|
+
const requirement = context.requirements.find((item) => item.id === answer.requirementId);
|
|
16
|
+
if (!requirement)
|
|
17
|
+
throw new Error(`API enum answer ${answer.requirementId} has no current OAS requirement`);
|
|
18
|
+
assignApiInputValue(values, requirement.targetPointer, structuredClone(answer.value), input);
|
|
19
|
+
}
|
|
20
|
+
const inspected = inspectApiArgumentRequirements({ ...input, values });
|
|
21
|
+
return {
|
|
22
|
+
values,
|
|
23
|
+
unresolvedInputs: inspected.requirements.map((item) => item.targetPointer),
|
|
24
|
+
interpretation: structuredClone({ ...context, analysis: input.analysis }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResolveApiLiteralProposalSourcesInput, VerifiedApiLiteralProposalSource } from '../../types/api-input-literal-source.js';
|
|
2
|
+
/** The same source/coverage checks serve independent generation and draft editing. */
|
|
3
|
+
export declare function resolveApiLiteralProposalSources(input: ResolveApiLiteralProposalSourcesInput): VerifiedApiLiteralProposalSource[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { pointerTokens, pointerValue } from '../../bindings/json-pointer.js';
|
|
2
|
+
import { verifyApiInputLiteralSource } from './verify-api-input-literal-source.js';
|
|
3
|
+
/** The same source/coverage checks serve independent generation and draft editing. */
|
|
4
|
+
export function resolveApiLiteralProposalSources(input) {
|
|
5
|
+
if (!input.callId?.trim() ||
|
|
6
|
+
!Array.isArray(input.sources) ||
|
|
7
|
+
!Array.isArray(input.messages))
|
|
8
|
+
throw new Error('Literal sources require callId, sources and original messages');
|
|
9
|
+
const sources = [];
|
|
10
|
+
for (const selection of input.sources) {
|
|
11
|
+
pointerTokens(selection.targetPointer);
|
|
12
|
+
const label = `API ${input.callId} literal ${selection.targetPointer}`;
|
|
13
|
+
if (sources.some((source) => overlaps(source.targetPointer, selection.targetPointer)))
|
|
14
|
+
throw new Error(`${label} has duplicate or overlapping literalSources`);
|
|
15
|
+
const message = input.messages.find((entry) => entry.id === selection.messageId);
|
|
16
|
+
if (!message)
|
|
17
|
+
throw new Error(`${label} cites unavailable user message ${selection.messageId}`);
|
|
18
|
+
const proposed = pointerValue(input.values, selection.targetPointer);
|
|
19
|
+
if (proposed === undefined)
|
|
20
|
+
throw new Error(`${label} source targets an absent proposed value`);
|
|
21
|
+
const parsed = verifyApiInputLiteralSource({
|
|
22
|
+
...selection,
|
|
23
|
+
text: message.text,
|
|
24
|
+
label,
|
|
25
|
+
value: proposed,
|
|
26
|
+
});
|
|
27
|
+
sources.push({ ...selection, occurrences: parsed.occurrences });
|
|
28
|
+
}
|
|
29
|
+
function check(value, pointer) {
|
|
30
|
+
if (sources.some((source) => isAncestor(source.targetPointer, pointer)))
|
|
31
|
+
return;
|
|
32
|
+
if (value !== null &&
|
|
33
|
+
typeof value === 'object' &&
|
|
34
|
+
Object.keys(value).length) {
|
|
35
|
+
for (const [key, child] of Object.entries(value))
|
|
36
|
+
check(child, `${pointer}/${key.replaceAll('~', '~0').replaceAll('/', '~1')}`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`API ${input.callId} literal ${pointer} requires an exact user source in literalSources`);
|
|
40
|
+
}
|
|
41
|
+
for (const [root, value] of Object.entries(input.values)) {
|
|
42
|
+
if (root !== 'body' &&
|
|
43
|
+
value !== null &&
|
|
44
|
+
typeof value === 'object' &&
|
|
45
|
+
!Object.keys(value).length)
|
|
46
|
+
continue;
|
|
47
|
+
check(value, `/${root}`);
|
|
48
|
+
}
|
|
49
|
+
return sources;
|
|
50
|
+
}
|
|
51
|
+
function isAncestor(ancestor, pointer) {
|
|
52
|
+
return (ancestor === '' ||
|
|
53
|
+
pointer === ancestor ||
|
|
54
|
+
pointer.startsWith(`${ancestor}/`));
|
|
55
|
+
}
|
|
56
|
+
function overlaps(left, right) {
|
|
57
|
+
return isAncestor(left, right) || isAncestor(right, left);
|
|
58
|
+
}
|
|
@@ -1,60 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { verifyApiInputLiteralSource } from '../../../arguments/sources/verify-api-input-literal-source.js';
|
|
1
|
+
import { resolveApiLiteralProposalSources } from '../../../arguments/sources/resolve-api-literal-proposal-sources.js';
|
|
3
2
|
/** OAS validation and message existence alone do not establish a literal's origin. */
|
|
4
3
|
export function resolveWorkflowDraftApiLiteralSources(input) {
|
|
5
4
|
const { description, proposal } = input;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const message = messages.find((entry) => entry.id === selection.messageId);
|
|
15
|
-
if (!message)
|
|
16
|
-
throw new Error(`${label} cites unavailable user message ${selection.messageId}`);
|
|
17
|
-
const proposed = pointerValue(proposal.values, selection.targetPointer);
|
|
18
|
-
if (proposed === undefined)
|
|
19
|
-
throw new Error(`${label} source targets an absent proposed value`);
|
|
20
|
-
const parsed = verifyApiInputLiteralSource({
|
|
21
|
-
...selection,
|
|
22
|
-
text: message.text,
|
|
23
|
-
label,
|
|
24
|
-
value: proposed,
|
|
25
|
-
});
|
|
26
|
-
sources.push({ ...selection, occurrences: parsed.occurrences });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function check(value, pointer) {
|
|
30
|
-
if (sources.some((source) => isAncestor(source.targetPointer, pointer)))
|
|
31
|
-
return;
|
|
32
|
-
if (value !== null &&
|
|
33
|
-
typeof value === 'object' &&
|
|
34
|
-
Object.keys(value).length) {
|
|
35
|
-
for (const [key, child] of Object.entries(value))
|
|
36
|
-
check(child, `${pointer}/${key.replaceAll('~', '~0').replaceAll('/', '~1')}`);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
throw new Error(`API ${description.nodeId} literal ${pointer} requires an exact user source in literalSources`);
|
|
40
|
-
}
|
|
41
|
-
for (const [root, value] of Object.entries(proposal.values)) {
|
|
42
|
-
// Empty parameter-location objects contain no request values. Empty body
|
|
43
|
-
// objects/arrays are actual data and still require their own source.
|
|
44
|
-
if (root !== 'body' &&
|
|
45
|
-
value !== null &&
|
|
46
|
-
typeof value === 'object' &&
|
|
47
|
-
!Object.keys(value).length)
|
|
48
|
-
continue;
|
|
49
|
-
check(value, `/${root}`);
|
|
50
|
-
}
|
|
51
|
-
return sources;
|
|
52
|
-
}
|
|
53
|
-
function isAncestor(ancestor, pointer) {
|
|
54
|
-
return (ancestor === '' ||
|
|
55
|
-
pointer === ancestor ||
|
|
56
|
-
pointer.startsWith(`${ancestor}/`));
|
|
57
|
-
}
|
|
58
|
-
function overlaps(left, right) {
|
|
59
|
-
return isAncestor(left, right) || isAncestor(right, left);
|
|
5
|
+
// Empty parameter-location objects contain no request values. Empty body
|
|
6
|
+
// objects/arrays are actual data and still require their own source.
|
|
7
|
+
return resolveApiLiteralProposalSources({
|
|
8
|
+
callId: description.nodeId,
|
|
9
|
+
values: proposal.values,
|
|
10
|
+
sources: proposal.literalSources === undefined ? [] : proposal.literalSources,
|
|
11
|
+
messages: [...description.messages, ...description.backgroundMessages],
|
|
12
|
+
});
|
|
60
13
|
}
|
package/dist/public-api.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export type * from './types/api-operation.js';
|
|
|
14
14
|
export { createApiArgumentsSchema } from './schemas/create-api-arguments-schema.js';
|
|
15
15
|
export { createApiArgumentGenerationContract } from './schemas/create-api-argument-generation-contract.js';
|
|
16
16
|
export type * from './types/api-argument-generation.js';
|
|
17
|
+
export type * from './types/api-argument-enum.js';
|
|
18
|
+
export type * from './types/api-input-literal-source.js';
|
|
19
|
+
export { apiInputLiteralSourceSchema } from './schemas/api-input-literal-source-schema.js';
|
|
20
|
+
export { resolveApiLiteralProposalSources } from './arguments/sources/resolve-api-literal-proposal-sources.js';
|
|
21
|
+
export { createApiRequestInputPointerSchema } from './schemas/create-api-request-input-pointer-schema.js';
|
|
22
|
+
export { describeApiArgumentEnumContext } from './arguments/enum/describe-api-argument-enum-context.js';
|
|
23
|
+
export { resolveApiArgumentEnumInterpretation } from './arguments/enum/resolve-api-argument-enum-interpretation.js';
|
|
17
24
|
export type * from './types/api-literal-generation.js';
|
|
18
25
|
export { describeApiLiteralGeneration } from './arguments/generation/describe-api-literal-generation.js';
|
|
19
26
|
export { createApiLiteralGenerationRecord } from './arguments/generation/create-api-literal-generation-record.js';
|
package/dist/public-api.js
CHANGED
|
@@ -10,6 +10,11 @@ export { createApiSelectionExplanation } from './openapi/selection/evidence/crea
|
|
|
10
10
|
export { validateApiSelectionExplanation } from './openapi/selection/evidence/validate-api-selection-explanation.js';
|
|
11
11
|
export { createApiArgumentsSchema } from './schemas/create-api-arguments-schema.js';
|
|
12
12
|
export { createApiArgumentGenerationContract } from './schemas/create-api-argument-generation-contract.js';
|
|
13
|
+
export { apiInputLiteralSourceSchema } from './schemas/api-input-literal-source-schema.js';
|
|
14
|
+
export { resolveApiLiteralProposalSources } from './arguments/sources/resolve-api-literal-proposal-sources.js';
|
|
15
|
+
export { createApiRequestInputPointerSchema } from './schemas/create-api-request-input-pointer-schema.js';
|
|
16
|
+
export { describeApiArgumentEnumContext } from './arguments/enum/describe-api-argument-enum-context.js';
|
|
17
|
+
export { resolveApiArgumentEnumInterpretation } from './arguments/enum/resolve-api-argument-enum-interpretation.js';
|
|
13
18
|
export { describeApiLiteralGeneration } from './arguments/generation/describe-api-literal-generation.js';
|
|
14
19
|
export { createApiLiteralGenerationRecord } from './arguments/generation/create-api-literal-generation-record.js';
|
|
15
20
|
export { validateApiLiteralGenerationRecord } from './arguments/generation/validate-api-literal-generation-record.js';
|
|
@@ -43,6 +43,7 @@ export declare const apiInputAnswerContextSchema: z.ZodObject<{
|
|
|
43
43
|
parameterDescription: z.ZodOptional<z.ZodString>;
|
|
44
44
|
message: z.ZodString;
|
|
45
45
|
}, z.core.$strict>>;
|
|
46
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
46
47
|
selectOasEnums: z.ZodOptional<z.ZodBoolean>;
|
|
47
48
|
}, z.core.$strict>;
|
|
48
49
|
export declare const apiInputAnswerSourceSchema: z.ZodObject<{
|
|
@@ -20,6 +20,11 @@ export const apiInputRequirementSchema = z.strictObject({
|
|
|
20
20
|
export const apiInputAnswerContextSchema = z.strictObject({
|
|
21
21
|
reply: z.string(),
|
|
22
22
|
requirements: z.array(apiInputRequirementSchema),
|
|
23
|
+
purpose: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.refine((value) => value.trim().length > 0)
|
|
27
|
+
.optional(),
|
|
23
28
|
selectOasEnums: z.boolean().optional(),
|
|
24
29
|
});
|
|
25
30
|
export const apiInputAnswerSourceSchema = apiInputLiteralSourceSchema.extend({
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ApiLiteralGenerationInput } from './api-literal-generation.js';
|
|
2
|
+
import type { ApiArgumentValues, ApiArgumentProposal } from './api-arguments.js';
|
|
3
|
+
import type { ApiInputAnswerAnalysis, ValidateApiInputAnswerAnalysisInput } from './api-input-answer-extraction.js';
|
|
4
|
+
import type { ApiLiteralProposalSource } from './api-input-literal-source.js';
|
|
5
|
+
import type { ApiInputRequirement } from './api-clarification.js';
|
|
6
|
+
export interface ApiArgumentEnumRequirementsInput extends ApiArgumentEnumContextInput {
|
|
7
|
+
requirements: ApiInputRequirement[];
|
|
8
|
+
values: ApiArgumentValues;
|
|
9
|
+
}
|
|
10
|
+
export interface ApiArgumentEnumContextInput extends ApiLiteralGenerationInput {
|
|
11
|
+
/** Original literal proposal, before confirmed inputs or semantic OAS values are merged. */
|
|
12
|
+
proposal: ApiArgumentProposal;
|
|
13
|
+
literalSources: ApiLiteralProposalSource[];
|
|
14
|
+
requestedInputs?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ResolveApiArgumentEnumInterpretationInput extends ApiArgumentEnumContextInput {
|
|
17
|
+
analysis: ApiInputAnswerAnalysis;
|
|
18
|
+
}
|
|
19
|
+
export interface ApiArgumentEnumResolution {
|
|
20
|
+
values: ApiArgumentValues;
|
|
21
|
+
unresolvedInputs: string[];
|
|
22
|
+
interpretation: ValidateApiInputAnswerAnalysisInput;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ApiOperationContract } from './api-operation.js';
|
|
2
2
|
import type { ApiLiteralGenerationRecord } from './api-literal-generation.js';
|
|
3
|
+
import type { ValidateApiInputAnswerAnalysisInput } from './api-input-answer-extraction.js';
|
|
4
|
+
import type { VerifiedApiLiteralProposalSource } from './api-input-literal-source.js';
|
|
3
5
|
export type JsonValue = string | number | boolean | null | JsonValue[] | JsonValueObject;
|
|
4
6
|
export interface JsonValueObject {
|
|
5
7
|
[key: string]: JsonValue;
|
|
@@ -35,6 +37,10 @@ export interface ApiCallArguments extends ApiArgumentProposal {
|
|
|
35
37
|
requestMediaType?: string;
|
|
36
38
|
/** Optional immutable attribution of the original literal proposal, not final merged values. */
|
|
37
39
|
literalGeneration?: ApiLiteralGenerationRecord;
|
|
40
|
+
/** Opt-in interpretation of unresolved OAS enum inputs; never verbatim literal attribution. */
|
|
41
|
+
enumInterpretation?: ValidateApiInputAnswerAnalysisInput;
|
|
42
|
+
/** Code-verified coverage of the original literal proposal, excluding copied OAS values. */
|
|
43
|
+
literalSources?: VerifiedApiLiteralProposalSource[];
|
|
38
44
|
}
|
|
39
45
|
export interface ValidateApiArgumentsInput extends ApiArgumentsSchemaInput {
|
|
40
46
|
values: ApiArgumentValues;
|
|
@@ -3,6 +3,8 @@ import type { ApiInputEnumAnswerSelection, ResolvedApiInputAnswerInterpretations
|
|
|
3
3
|
export interface ApiInputAnswerContext {
|
|
4
4
|
reply: string;
|
|
5
5
|
requirements: ApiInputRequirement[];
|
|
6
|
+
/** Caller-supplied call role, separate from the quoted answer/value source. */
|
|
7
|
+
purpose?: string;
|
|
6
8
|
/** Allow semantic selection of original OAS enum values, never arbitrary generation. */
|
|
7
9
|
selectOasEnums?: boolean;
|
|
8
10
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { JsonValue } from './api-arguments.js';
|
|
2
2
|
import type { ApiInputAnswerSourceLocation } from './api-input-answer-extraction.js';
|
|
3
|
+
import type { ApiArgumentValues } from './api-arguments.js';
|
|
4
|
+
import type { WorkflowSourceMessage } from './workflow-draft.js';
|
|
5
|
+
export interface ApiLiteralProposalSource extends ApiInputLiteralSource {
|
|
6
|
+
targetPointer: string;
|
|
7
|
+
messageId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface VerifiedApiLiteralProposalSource extends ApiLiteralProposalSource {
|
|
10
|
+
occurrences: ApiInputAnswerSourceLocation[];
|
|
11
|
+
}
|
|
12
|
+
export interface ResolveApiLiteralProposalSourcesInput {
|
|
13
|
+
callId: string;
|
|
14
|
+
values: ApiArgumentValues;
|
|
15
|
+
sources: ApiLiteralProposalSource[];
|
|
16
|
+
messages: WorkflowSourceMessage[];
|
|
17
|
+
}
|
|
3
18
|
export interface ApiInputLiteralSource {
|
|
4
19
|
sourceFormat: 'text' | 'json';
|
|
5
20
|
sourceText: string;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ApiInputAnswerSourceLocation } from './api-input-answer-extraction.js';
|
|
1
|
+
import type { ApiLiteralProposalSource, VerifiedApiLiteralProposalSource } from './api-input-literal-source.js';
|
|
3
2
|
import type { WorkflowDraftApiCallPlanningDescription, WorkflowDraftApiCallArgumentsProposal } from './workflow-draft-api-call-planning.js';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
messageId: string;
|
|
7
|
-
}
|
|
8
|
-
export interface VerifiedWorkflowDraftApiLiteralSource extends WorkflowDraftApiLiteralSource {
|
|
9
|
-
occurrences: ApiInputAnswerSourceLocation[];
|
|
10
|
-
}
|
|
3
|
+
export type WorkflowDraftApiLiteralSource = ApiLiteralProposalSource;
|
|
4
|
+
export type VerifiedWorkflowDraftApiLiteralSource = VerifiedApiLiteralProposalSource;
|
|
11
5
|
export interface ResolveWorkflowDraftApiLiteralSourcesInput {
|
|
12
6
|
description: WorkflowDraftApiCallPlanningDescription;
|
|
13
7
|
proposal: WorkflowDraftApiCallArgumentsProposal;
|