@openapi-flow/langchain 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +152 -2
  3. package/THIRD_PARTY_NOTICES.md +3 -0
  4. package/dist/arguments/analyze-api-input-answers.d.ts +3 -0
  5. package/dist/arguments/analyze-api-input-answers.js +87 -0
  6. package/dist/arguments/analyze-api-request-media-type.d.ts +4 -0
  7. package/dist/arguments/analyze-api-request-media-type.js +50 -0
  8. package/dist/arguments/extract-api-input-answers.d.ts +3 -0
  9. package/dist/arguments/extract-api-input-answers.js +4 -0
  10. package/dist/arguments/generate-api-arguments.d.ts +3 -0
  11. package/dist/arguments/generate-api-arguments.js +60 -0
  12. package/dist/arguments/select-api-request-media-type.d.ts +2 -0
  13. package/dist/arguments/select-api-request-media-type.js +10 -0
  14. package/dist/bindings/plan-api-bindings.d.ts +3 -0
  15. package/dist/bindings/plan-api-bindings.js +50 -0
  16. package/dist/draft/analyze-workflow-draft-edit.d.ts +4 -0
  17. package/dist/draft/analyze-workflow-draft-edit.js +84 -0
  18. package/dist/draft/generate-workflow-draft-api-call-arguments.d.ts +3 -0
  19. package/dist/draft/generate-workflow-draft-api-call-arguments.js +88 -0
  20. package/dist/draft/generate-workflow-draft-api-input-edits.d.ts +4 -0
  21. package/dist/draft/generate-workflow-draft-api-input-edits.js +58 -0
  22. package/dist/draft/generate-workflow-draft-native-node-addition.d.ts +4 -0
  23. package/dist/draft/generate-workflow-draft-native-node-addition.js +137 -0
  24. package/dist/draft/generate-workflow-draft-native-parameter-edits.d.ts +3 -0
  25. package/dist/draft/generate-workflow-draft-native-parameter-edits.js +71 -0
  26. package/dist/draft/plan-workflow-draft-api-binding-edit.d.ts +4 -0
  27. package/dist/draft/plan-workflow-draft-api-binding-edit.js +103 -0
  28. package/dist/draft/plan-workflow-draft-api-call-bindings.d.ts +3 -0
  29. package/dist/draft/plan-workflow-draft-api-call-bindings.js +114 -0
  30. package/dist/draft/plan-workflow-draft-clarification-scopes.d.ts +4 -0
  31. package/dist/draft/plan-workflow-draft-clarification-scopes.js +77 -0
  32. package/dist/draft/plan-workflow-draft-connection-edit.d.ts +4 -0
  33. package/dist/draft/plan-workflow-draft-connection-edit.js +79 -0
  34. package/dist/draft/plan-workflow-draft-native-dependencies.d.ts +4 -0
  35. package/dist/draft/plan-workflow-draft-native-dependencies.js +45 -0
  36. package/dist/draft/plan-workflow-draft-native-reference-repair.d.ts +4 -0
  37. package/dist/draft/plan-workflow-draft-native-reference-repair.js +68 -0
  38. package/dist/draft/resolve-workflow-draft-edit-proposal.d.ts +3 -0
  39. package/dist/draft/resolve-workflow-draft-edit-proposal.js +39 -0
  40. package/dist/draft/select-workflow-draft-api-binding-inputs.d.ts +4 -0
  41. package/dist/draft/select-workflow-draft-api-binding-inputs.js +83 -0
  42. package/dist/draft/select-workflow-draft-api-input-edit-targets.d.ts +4 -0
  43. package/dist/draft/select-workflow-draft-api-input-edit-targets.js +55 -0
  44. package/dist/draft/select-workflow-draft-native-node-parameter-ownership.d.ts +4 -0
  45. package/dist/draft/select-workflow-draft-native-node-parameter-ownership.js +81 -0
  46. package/dist/draft/select-workflow-draft-native-parameter-edit-targets.d.ts +3 -0
  47. package/dist/draft/select-workflow-draft-native-parameter-edit-targets.js +51 -0
  48. package/dist/draft/workflow-draft-api-binding-edit-planning-error.d.ts +5 -0
  49. package/dist/draft/workflow-draft-api-binding-edit-planning-error.js +10 -0
  50. package/dist/draft/workflow-draft-api-call-planning-error.d.ts +5 -0
  51. package/dist/draft/workflow-draft-api-call-planning-error.js +10 -0
  52. package/dist/draft/workflow-draft-api-input-edit-planning-error.d.ts +5 -0
  53. package/dist/draft/workflow-draft-api-input-edit-planning-error.js +10 -0
  54. package/dist/draft/workflow-draft-clarification-scope-planning-error.d.ts +5 -0
  55. package/dist/draft/workflow-draft-clarification-scope-planning-error.js +8 -0
  56. package/dist/draft/workflow-draft-connection-edit-planning-error.d.ts +5 -0
  57. package/dist/draft/workflow-draft-connection-edit-planning-error.js +10 -0
  58. package/dist/draft/workflow-draft-edit-planning-error.d.ts +5 -0
  59. package/dist/draft/workflow-draft-edit-planning-error.js +8 -0
  60. package/dist/draft/workflow-draft-native-node-addition-planning-error.d.ts +5 -0
  61. package/dist/draft/workflow-draft-native-node-addition-planning-error.js +10 -0
  62. package/dist/draft/workflow-draft-native-parameter-edit-planning-error.d.ts +5 -0
  63. package/dist/draft/workflow-draft-native-parameter-edit-planning-error.js +8 -0
  64. package/dist/draft/workflow-draft-native-reference-repair-planning-error.d.ts +5 -0
  65. package/dist/draft/workflow-draft-native-reference-repair-planning-error.js +8 -0
  66. package/dist/legacy/planning/operation-plan-inputs.d.ts +3 -0
  67. package/dist/legacy/planning/operation-plan-inputs.js +17 -0
  68. package/dist/legacy/planning/parse-structured-output.d.ts +2 -0
  69. package/dist/legacy/planning/parse-structured-output.js +9 -0
  70. package/dist/legacy/planning/propose-catalog-scenario.d.ts +3 -0
  71. package/dist/legacy/planning/propose-catalog-scenario.js +136 -0
  72. package/dist/legacy/planning/select-operation.d.ts +4 -0
  73. package/dist/legacy/planning/select-operation.js +43 -0
  74. package/dist/legacy/schemas/catalog-selection-schema.d.ts +19 -0
  75. package/dist/legacy/schemas/catalog-selection-schema.js +39 -0
  76. package/dist/legacy/schemas/catalog-step-schema.d.ts +16 -0
  77. package/dist/legacy/schemas/catalog-step-schema.js +39 -0
  78. package/dist/legacy/schemas/operation-selection-schema.d.ts +6 -0
  79. package/dist/legacy/schemas/operation-selection-schema.js +14 -0
  80. package/dist/legacy-api.d.ts +9 -0
  81. package/dist/legacy-api.js +7 -0
  82. package/dist/prompts/api-arguments-prompt.d.ts +1 -0
  83. package/dist/prompts/api-arguments-prompt.js +1 -0
  84. package/dist/prompts/api-bindings-prompt.d.ts +1 -0
  85. package/dist/prompts/api-bindings-prompt.js +13 -0
  86. package/dist/prompts/api-input-answers-prompt.d.ts +1 -0
  87. package/dist/prompts/api-input-answers-prompt.js +7 -0
  88. package/dist/prompts/api-request-media-type-prompt.d.ts +1 -0
  89. package/dist/prompts/api-request-media-type-prompt.js +1 -0
  90. package/dist/prompts/api-selection-analysis-prompt.d.ts +1 -0
  91. package/dist/prompts/api-selection-analysis-prompt.js +5 -0
  92. package/dist/prompts/api-selection-explanation-prompt.d.ts +1 -0
  93. package/dist/prompts/api-selection-explanation-prompt.js +1 -0
  94. package/dist/prompts/native-instance-dependencies-prompt.d.ts +1 -0
  95. package/dist/prompts/native-instance-dependencies-prompt.js +8 -0
  96. package/dist/prompts/native-node-planning-prompt.d.ts +3 -0
  97. package/dist/prompts/native-node-planning-prompt.js +22 -0
  98. package/dist/prompts/operation-selection-prompt.d.ts +1 -0
  99. package/dist/prompts/operation-selection-prompt.js +1 -0
  100. package/dist/prompts/reviewable-workflow-graph-prompt.d.ts +1 -0
  101. package/dist/prompts/reviewable-workflow-graph-prompt.js +7 -0
  102. package/dist/prompts/workflow-connections-prompt.d.ts +1 -0
  103. package/dist/prompts/workflow-connections-prompt.js +11 -0
  104. package/dist/prompts/workflow-draft-api-binding-edit-prompt.d.ts +1 -0
  105. package/dist/prompts/workflow-draft-api-binding-edit-prompt.js +9 -0
  106. package/dist/prompts/workflow-draft-api-call-planning-prompt.d.ts +3 -0
  107. package/dist/prompts/workflow-draft-api-call-planning-prompt.js +39 -0
  108. package/dist/prompts/workflow-draft-api-input-edit-prompt.d.ts +2 -0
  109. package/dist/prompts/workflow-draft-api-input-edit-prompt.js +14 -0
  110. package/dist/prompts/workflow-draft-clarification-scope-prompt.d.ts +1 -0
  111. package/dist/prompts/workflow-draft-clarification-scope-prompt.js +10 -0
  112. package/dist/prompts/workflow-draft-connection-edit-prompt.d.ts +1 -0
  113. package/dist/prompts/workflow-draft-connection-edit-prompt.js +7 -0
  114. package/dist/prompts/workflow-draft-edit-prompt.d.ts +1 -0
  115. package/dist/prompts/workflow-draft-edit-prompt.js +15 -0
  116. package/dist/prompts/workflow-draft-native-dependencies-prompt.d.ts +1 -0
  117. package/dist/prompts/workflow-draft-native-dependencies-prompt.js +5 -0
  118. package/dist/prompts/workflow-draft-native-node-addition-prompt.d.ts +2 -0
  119. package/dist/prompts/workflow-draft-native-node-addition-prompt.js +6 -0
  120. package/dist/prompts/workflow-draft-native-parameter-edit-prompt.d.ts +2 -0
  121. package/dist/prompts/workflow-draft-native-parameter-edit-prompt.js +2 -0
  122. package/dist/prompts/workflow-draft-native-reference-repair-prompt.d.ts +1 -0
  123. package/dist/prompts/workflow-draft-native-reference-repair-prompt.js +7 -0
  124. package/dist/prompts/workflow-graph-prompt.d.ts +1 -0
  125. package/dist/prompts/workflow-graph-prompt.js +15 -0
  126. package/dist/prompts/workflow-requirements-prompt.d.ts +1 -0
  127. package/dist/prompts/workflow-requirements-prompt.js +14 -0
  128. package/dist/prompts/workflow-review-suggestions-prompt.d.ts +1 -0
  129. package/dist/prompts/workflow-review-suggestions-prompt.js +4 -0
  130. package/dist/prompts/workflow-user-action-evidence-prompt.d.ts +1 -0
  131. package/dist/prompts/workflow-user-action-evidence-prompt.js +1 -0
  132. package/dist/public-api.d.ts +67 -0
  133. package/dist/public-api.js +46 -0
  134. package/dist/requirements/clarify-workflow-requirements.d.ts +4 -0
  135. package/dist/requirements/clarify-workflow-requirements.js +53 -0
  136. package/dist/requirements/resolve-workflow-requirements-evidence.d.ts +4 -0
  137. package/dist/requirements/resolve-workflow-requirements-evidence.js +58 -0
  138. package/dist/review/suggest-workflow-review-follow-ups.d.ts +4 -0
  139. package/dist/review/suggest-workflow-review-follow-ups.js +87 -0
  140. package/dist/review/workflow-review-suggestion-planning-error.d.ts +5 -0
  141. package/dist/review/workflow-review-suggestion-planning-error.js +8 -0
  142. package/dist/schemas/api-binding-plan-schema.d.ts +8 -0
  143. package/dist/schemas/api-binding-plan-schema.js +59 -0
  144. package/dist/schemas/api-input-answer-source-schema.d.ts +16 -0
  145. package/dist/schemas/api-input-answer-source-schema.js +28 -0
  146. package/dist/schemas/api-literal-generation-output-schema.d.ts +11 -0
  147. package/dist/schemas/api-literal-generation-output-schema.js +20 -0
  148. package/dist/schemas/api-request-media-type-schema.d.ts +6 -0
  149. package/dist/schemas/api-request-media-type-schema.js +23 -0
  150. package/dist/schemas/api-selection-analysis-schema.d.ts +41 -0
  151. package/dist/schemas/api-selection-analysis-schema.js +23 -0
  152. package/dist/schemas/api-selection-options-schema.d.ts +4 -0
  153. package/dist/schemas/api-selection-options-schema.js +4 -0
  154. package/dist/schemas/api-selection-schema.d.ts +25 -0
  155. package/dist/schemas/api-selection-schema.js +31 -0
  156. package/dist/schemas/create-workflow-message-evidence-selection-schema.d.ts +16 -0
  157. package/dist/schemas/create-workflow-message-evidence-selection-schema.js +22 -0
  158. package/dist/schemas/native-node-explanation-schema.d.ts +5 -0
  159. package/dist/schemas/native-node-explanation-schema.js +9 -0
  160. package/dist/schemas/native-node-parameter-contract.d.ts +3 -0
  161. package/dist/schemas/native-node-parameter-contract.js +30 -0
  162. package/dist/schemas/native-node-planning-contract.d.ts +3 -0
  163. package/dist/schemas/native-node-planning-contract.js +44 -0
  164. package/dist/schemas/request-media-selection-options-schema.d.ts +4 -0
  165. package/dist/schemas/request-media-selection-options-schema.js +4 -0
  166. package/dist/schemas/reviewable-workflow-graph-schema.d.ts +6 -0
  167. package/dist/schemas/reviewable-workflow-graph-schema.js +75 -0
  168. package/dist/schemas/serialize-structured-output-schema.d.ts +5 -0
  169. package/dist/schemas/serialize-structured-output-schema.js +10 -0
  170. package/dist/schemas/serialize-workflow-requirements-schema.d.ts +4 -0
  171. package/dist/schemas/serialize-workflow-requirements-schema.js +5 -0
  172. package/dist/schemas/with-api-selection-explanation.d.ts +10 -0
  173. package/dist/schemas/with-api-selection-explanation.js +15 -0
  174. package/dist/schemas/workflow-connection-explanation-schema.d.ts +5 -0
  175. package/dist/schemas/workflow-connection-explanation-schema.js +9 -0
  176. package/dist/schemas/workflow-draft-edit-schema.d.ts +3 -0
  177. package/dist/schemas/workflow-draft-edit-schema.js +17 -0
  178. package/dist/schemas/workflow-graph-explanation-schema.d.ts +5 -0
  179. package/dist/schemas/workflow-graph-explanation-schema.js +9 -0
  180. package/dist/schemas/workflow-graph-proposal-schema.d.ts +4 -0
  181. package/dist/schemas/workflow-graph-proposal-schema.js +45 -0
  182. package/dist/schemas/workflow-planning-evidence-schemas.d.ts +20 -0
  183. package/dist/schemas/workflow-planning-evidence-schemas.js +44 -0
  184. package/dist/schemas/workflow-requirements-schema.d.ts +3 -0
  185. package/dist/schemas/workflow-requirements-schema.js +6 -0
  186. package/dist/schemas/workflow-review-suggestions-schema.d.ts +4 -0
  187. package/dist/schemas/workflow-review-suggestions-schema.js +18 -0
  188. package/dist/selection/analyze-api-selection.d.ts +4 -0
  189. package/dist/selection/analyze-api-selection.js +117 -0
  190. package/dist/selection/resolve-api-selection-options.d.ts +3 -0
  191. package/dist/selection/resolve-api-selection-options.js +6 -0
  192. package/dist/selection/select-api-operations.d.ts +3 -0
  193. package/dist/selection/select-api-operations.js +84 -0
  194. package/dist/types/api-input-answers.d.ts +16 -0
  195. package/dist/types/api-input-answers.js +1 -0
  196. package/dist/types/api-selection-analysis.d.ts +3 -0
  197. package/dist/types/api-selection-analysis.js +1 -0
  198. package/dist/types/argument-generation.d.ts +13 -0
  199. package/dist/types/argument-generation.js +1 -0
  200. package/dist/types/binding-planning.d.ts +10 -0
  201. package/dist/types/binding-planning.js +1 -0
  202. package/dist/types/legacy/catalog-planning.d.ts +16 -0
  203. package/dist/types/legacy/catalog-planning.js +1 -0
  204. package/dist/types/legacy/planning.d.ts +5 -0
  205. package/dist/types/legacy/planning.js +1 -0
  206. package/dist/types/native-node-planning.d.ts +76 -0
  207. package/dist/types/native-node-planning.js +1 -0
  208. package/dist/types/operation-selection.d.ts +14 -0
  209. package/dist/types/operation-selection.js +1 -0
  210. package/dist/types/request-media-selection.d.ts +15 -0
  211. package/dist/types/request-media-selection.js +1 -0
  212. package/dist/types/reviewable-workflow-planning.d.ts +28 -0
  213. package/dist/types/reviewable-workflow-planning.js +1 -0
  214. package/dist/types/structured-output-schema.d.ts +3 -0
  215. package/dist/types/structured-output-schema.js +1 -0
  216. package/dist/types/workflow-clarification.d.ts +23 -0
  217. package/dist/types/workflow-clarification.js +1 -0
  218. package/dist/types/workflow-draft-api-binding-edit.d.ts +9 -0
  219. package/dist/types/workflow-draft-api-binding-edit.js +1 -0
  220. package/dist/types/workflow-draft-api-call-planning.d.ts +15 -0
  221. package/dist/types/workflow-draft-api-call-planning.js +1 -0
  222. package/dist/types/workflow-draft-api-input-edit.d.ts +13 -0
  223. package/dist/types/workflow-draft-api-input-edit.js +1 -0
  224. package/dist/types/workflow-draft-clarification.d.ts +9 -0
  225. package/dist/types/workflow-draft-clarification.js +1 -0
  226. package/dist/types/workflow-draft-connection-edit.d.ts +9 -0
  227. package/dist/types/workflow-draft-connection-edit.js +1 -0
  228. package/dist/types/workflow-draft-edit.d.ts +16 -0
  229. package/dist/types/workflow-draft-edit.js +1 -0
  230. package/dist/types/workflow-draft-native-node-addition.d.ts +18 -0
  231. package/dist/types/workflow-draft-native-node-addition.js +1 -0
  232. package/dist/types/workflow-draft-native-parameter-edit.d.ts +13 -0
  233. package/dist/types/workflow-draft-native-parameter-edit.js +1 -0
  234. package/dist/types/workflow-draft-native-reference-repair.d.ts +9 -0
  235. package/dist/types/workflow-draft-native-reference-repair.js +1 -0
  236. package/dist/types/workflow-message-evidence-selection.d.ts +6 -0
  237. package/dist/types/workflow-message-evidence-selection.js +1 -0
  238. package/dist/types/workflow-orchestration.d.ts +21 -0
  239. package/dist/types/workflow-orchestration.js +1 -0
  240. package/dist/types/workflow-planning.d.ts +35 -0
  241. package/dist/types/workflow-planning.js +1 -0
  242. package/dist/types/workflow-review-suggestions.d.ts +12 -0
  243. package/dist/types/workflow-review-suggestions.js +1 -0
  244. package/dist/workflow/complete-reviewable-workflow-graph-proposal.d.ts +4 -0
  245. package/dist/workflow/complete-reviewable-workflow-graph-proposal.js +13 -0
  246. package/dist/workflow/generate-native-node-parameters.d.ts +4 -0
  247. package/dist/workflow/generate-native-node-parameters.js +87 -0
  248. package/dist/workflow/native-node-planning-error.d.ts +5 -0
  249. package/dist/workflow/native-node-planning-error.js +10 -0
  250. package/dist/workflow/orchestrate-workflow.d.ts +4 -0
  251. package/dist/workflow/orchestrate-workflow.js +31 -0
  252. package/dist/workflow/plan-native-instance-dependencies.d.ts +4 -0
  253. package/dist/workflow/plan-native-instance-dependencies.js +45 -0
  254. package/dist/workflow/plan-native-nodes.d.ts +2 -0
  255. package/dist/workflow/plan-native-nodes.js +96 -0
  256. package/dist/workflow/plan-reviewable-workflow-graph.d.ts +3 -0
  257. package/dist/workflow/plan-reviewable-workflow-graph.js +70 -0
  258. package/dist/workflow/plan-workflow-connections.d.ts +3 -0
  259. package/dist/workflow/plan-workflow-connections.js +67 -0
  260. package/dist/workflow/plan-workflow-graph.d.ts +3 -0
  261. package/dist/workflow/plan-workflow-graph.js +80 -0
  262. package/dist/workflow/resolve-native-node-parameter-source.d.ts +4 -0
  263. package/dist/workflow/resolve-native-node-parameter-source.js +7 -0
  264. package/dist/workflow/resolve-native-node-planning-output.d.ts +3 -0
  265. package/dist/workflow/resolve-native-node-planning-output.js +33 -0
  266. package/dist/workflow/resolve-workflow-connection-output.d.ts +3 -0
  267. package/dist/workflow/resolve-workflow-connection-output.js +22 -0
  268. package/dist/workflow/resolve-workflow-graph-output.d.ts +5 -0
  269. package/dist/workflow/resolve-workflow-graph-output.js +69 -0
  270. package/dist/workflow/reviewable-workflow-graph-planning-error.d.ts +5 -0
  271. package/dist/workflow/reviewable-workflow-graph-planning-error.js +8 -0
  272. package/dist/workflow/select-native-node-instances.d.ts +4 -0
  273. package/dist/workflow/select-native-node-instances.js +57 -0
  274. package/dist/workflow/workflow-graph-planning-error.d.ts +5 -0
  275. package/dist/workflow/workflow-graph-planning-error.js +10 -0
  276. package/package.json +47 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 carefreelife98
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,153 @@
1
- # Temporary Holding Version
1
+ # @openapi-flow/langchain
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Zod `^4.6.5` is a required host peer, alongside `@langchain/core`. The three libraries share the host's Zod for public schema types instead of creating an isolated pinned copy. Modern package managers install compatible missing peers; a host that directly creates Zod schemas should declare its own compatible Zod dependency.
4
+
5
+ Version **0.3.0**, with matching `@openapi-flow/core@0.3.0`. The host supplies its LangChain model and owns LangGraph, storage and review policies. The Core/n8n Ajv `properties.__proto__` validation limitation is documented in the [release record](https://github.com/carefreelife98/openapi-flow/blob/main/docs/releases/0.3.0.md); this release does not rewrite OAS or values to hide it.
6
+
7
+ `analyzeWorkflowDraftEdit` offers `report-capability-gap` in its existing
8
+ bounded semantic call. The model selects a role, scoped finding and mandatory
9
+ reason; Core owns IDs, original messages and inventory capture. No separate gap
10
+ agent, parameter-generation call, retry or synthesized contract is introduced.
11
+ See the [gap contract](../../docs/workflow-draft-conversation-host.md#explicit-capability-gaps).
12
+
13
+ `generateWorkflowDraftApiCallArguments({ trackRequestedInputs: true })`
14
+ asks for requested input pointers in the existing OAS-typed value call, including
15
+ optional literals whose actual value is not known. Core checks declaration and
16
+ presence; no extra model call, invented value or changed OAS required list is used.
17
+ See [requested inputs](../../docs/workflow-draft-api-binding-questions.md#값이-미정인-선택-입력의-요청-추적).
18
+
19
+ `selectWorkflowDraftApiBindingInputs` selects only requested
20
+ response-to-request target pointers before producer mapping. Passing its
21
+ `inputIntent` to `planWorkflowDraftApiCallBindings` narrows both the model-visible
22
+ target contracts and the output schema. An empty selection makes no binding-model
23
+ call; required literals remain the argument stage responsibility. These primitives
24
+ remain independently callable. See [input intent](../../docs/workflow-draft-api-binding-questions.md#요청-의도를-먼저-고정하는-선택-단계).
25
+
26
+ `analyzeApiInputAnswers` always returns code-checked `sources` for
27
+ revalidation; model reasons remain optional. The canonical example supports
28
+ [natural input replies](../../docs/canonical-natural-input-replies.md).
29
+
30
+ `analyzeWorkflowDraftEdit` offers `restore-requirement` only for
31
+ code-derived removed IDs. See
32
+ [requirement restoration](../../docs/workflow-draft-requirement-restoration.md).
33
+
34
+ `analyzeApiInputAnswers` selects code-owned JSON candidate IDs or
35
+ unquoted text-boundary IDs. The model writes neither values nor `sourceText`;
36
+ Core resolves original spans and validates them without coercion. See the
37
+ [answer extraction guide](../../docs/api-input-answer-extraction.md).
38
+
39
+ `planWorkflowGraph` and `planReviewableWorkflowGraph` accept
40
+ `includeExplanations: true` for same-call strategy, native-instance and edge reasons,
41
+ with separate code-owned source/verification records. Explicitly empty native
42
+ registries support API-only plans without requesting impossible node fields.
43
+ See the [combined graph guide](../../docs/graph-planning-records.md).
44
+
45
+ `planWorkflowConnections({ includeExplanations: true })` returns the
46
+ original execution plan plus separate per-new-edge/blocked-call reasons and
47
+ code-owned source receipts. No explanation-only call is added. The two combined
48
+ node-and-graph planners have their own explanation contract. See the
49
+ [connection planning guide](../../docs/connection-planning-records.md).
50
+
51
+ `planNativeNodes({ includeExplanations: true })` records same-call reasons
52
+ for each new instance or an explicit no-additions decision. Code attaches the source
53
+ context and implementation receipts. Runtime-enabled model contracts choose an
54
+ explicit `parameterSource`; code derives empty runtime parameters/flags, never from
55
+ placeholder text. See [native planning records](../../docs/native-planning-records.md).
56
+
57
+ `planApiBindings({ includeExplanations: true })` asks for a short reason
58
+ per call in the existing strict function call. Original gap descriptions remain
59
+ their reasons; code owns the supplied-contract evidence in `bindingPlanning`.
60
+ Executable `calls[].bindings` contain no audit metadata. See
61
+ [binding planning records](../../docs/binding-planning-records.md).
62
+
63
+ `generateApiArguments({ includeExplanations: true })` adds a same-call
64
+ short reason and a code-owned `literalGeneration` record for the original proposal,
65
+ not the final values after confirmed-input merge. Optional `purpose` scopes repeated
66
+ API roles. No remaining literals means zero calls and no required model; otherwise
67
+ a supplied structured-output model is required. See
68
+ [literal records and source boundaries](../../docs/literal-generation-records.md).
69
+
70
+ `analyzeApiRequestMediaType` returns the typed origin/resolution record,
71
+ with optional same-call reasons and code-attached original scenario/requestBody
72
+ evidence. Zero/one format needs no model; explicit null alone uses the existing
73
+ documented default. `selectApiRequestMediaType` remains the string-only projection
74
+ of the same implementation. Choose one API, not both in sequence. See
75
+ [request format decisions](../../docs/request-media-decisions.md).
76
+
77
+ `selectApiOperations` and `analyzeApiSelection` accept optional
78
+ `includeExplanations: true`. The same call returns only a short reason per decision;
79
+ core attaches the exact scenario and chosen/alternative/full discovery inventory.
80
+ Omission preserves the standalone selector's existing non-explanation output.
81
+ This is discovery provenance, not full OAS contract or semantic correctness proof.
82
+ See [API selection explanations](../../docs/api-selection-explanations.md).
83
+
84
+ selected-API binding questions now emit typed current-input pointers and
85
+ actual source alternatives, not free-form questions or claims about missing OAS.
86
+ Core renders/validates the question and resolves explicit human choices without
87
+ another model call. See [scoped binding questions](../../docs/workflow-draft-api-binding-questions.md).
88
+
89
+ `suggestWorkflowReviewFollowUps` makes one bounded structured-output call
90
+ for the actual current HITL boundary. The model proposes optional messages and source
91
+ references; core owns identities, evidence text and explicit adoption. No suggestion
92
+ becomes intent or a graph patch without a human action. See [the contract](../../docs/workflow-review-suggestions.md).
93
+
94
+ `planWorkflowDraftApiCallBindings` and `generateWorkflowDraftApiCallArguments`
95
+ separate one selected API instance's source choices from OAS-typed literal extraction.
96
+ Code-known mappings and fully owned inputs require no model-generated constants.
97
+ Optional literal extraction uses function calling with unchanged local validation,
98
+ not strict output that would force absent OAS values. See the
99
+ [API addition/replacement guide](../../docs/workflow-draft-api-call-planning.md).
100
+
101
+ `generateWorkflowDraftNativeNodeAddition` configures one code-identified `add-native-node` step with the actual registered schema. Optional `selectWorkflowDraftNativeNodeParameterOwnership` separates explicit field ownership from typed remaining values, so hosts can checkpoint/review between calls. Entirely deferred or fixed strict-empty settings need no value model. Evidence selects actual IDs instead of generated quotations. Connection planning and host review remain separate. See [native additions](../../docs/workflow-draft-native-node-addition.md).
102
+
103
+ `planWorkflowDraftNativeReferenceRepair` uses one bounded call for an actual native consumer task. Model output contains only code-keyed source decisions or questions; core owns reference locations, patches and validation. See the [native repair contract](../../docs/workflow-draft-native-reference-repairs.md). Material-dependent registry refresh and complete conversational composition remain unfinished.
104
+
105
+ `selectWorkflowDraftNativeParameterEditTargets` and `generateWorkflowDraftNativeParameterEdits` split an existing native revision into target choice and typed parameter values. Core owns schemas, identity and deterministic patches; removal/explicit field-deferral work needs no value call. Opted-in field deferral preserves unrelated literals/owners, and set transfers only the selected owner back to a literal. See the [native parameter-edit contract](../../docs/workflow-draft-native-parameter-edits.md). New draft-native instances use their separate ownership/value stages. Independent hosts can use `selectNativeNodeInstances` followed by `generateNativeNodeParameters` for mixed-field planning without constructing a fake draft. Each invocation is separately checkpointable; no nested planning calls are hidden in the compact planner.
106
+
107
+ `planWorkflowDraftConnectionEdit` makes one bounded connection-delta call only after actual material results and consumer repairs resolve. Its schema constrains real endpoint/port pairs and editable existing edges; code validates the full candidate DAG. Retained edges and parameter values are not regenerated. See the [connection-edit contract](../../docs/workflow-draft-connection-edits.md); material-dependent native repairs, new-instance models and full conversational host integration remain unfinished.
108
+
109
+ `planWorkflowDraftApiBindingEdit` makes one bounded source/ownership decision call for a pending reference-edit step or a code-derived consumer repair. Core re-derives staged authority, preserves unrelated mappings and values, and rejects stale/unknown sources or incompatible declarations without transforming data. Unknown producer choices return scoped questions, not a partial applied edit. Literal displacement is an explicit `replace-literal-with-binding` decision. See the [binding edit/staging contract](../../docs/workflow-draft-api-binding-edits.md); connection/native edits use separate stages. Material-dependent native repair, new-instance composition and host review/resume remain unfinished.
110
+
111
+ `selectWorkflowDraftApiInputEditTargets` and `generateWorkflowDraftApiInputEdits` split an existing literal edit into target selection and OAS-typed actual-value extraction. Core owns field schemas/IDs, exact source checks and deterministic patches; unchanged values are preserved. Missing actual values return `needs-input` without a partial resolution; removals need no value call. Hosts can review between the two calls or supply structured targets/values directly through core. See the [scoped input-edit contract](../../docs/workflow-draft-api-input-edits.md). Binding, connection and native edits use separate stages; registry refresh, new-instance models and complete LangGraph composition remain unfinished.
112
+
113
+ `analyzeWorkflowDraftEdit` makes one bounded call for semantic change decisions, supplied candidates and existing targets. Core resolves original OAS identities and validates exact current-request provenance, stale state and code-owned IDs. Values, settings, bindings, connections and atomic application remain separate stages. No whole-workflow regeneration or automatic retry is added. See the [edit analysis boundary and remaining composition](../../docs/workflow-draft-edit-analysis.md).
114
+
115
+ `planNativeNodes({ ..., allowRuntimeParameters: true })` offers explicit runtime parameter ownership only for implementing capabilities. One schema/material factory supplies both the output alternatives and HumanMessage `parameterSources`, so the model receives the same contract it may return. Omission stays literal-only; the model never supplies runtime slot IDs or schemas. Older combined planning compositions do not automatically forward this option. See the [native runtime input contract](../../docs/native-runtime-inputs.md).
116
+
117
+ `generateNativeNodeParameters` can resume a `needs-clarification` result with `replies: [{ question, text }]`, retaining the same selected role, original scenario and source snapshot. Append another pair for each actual follow-up; stale or out-of-order questions fail before invocation. The model receives validated question/reply data separately and still returns only the same typed setting decision. It does not repeat capability selection or acquire graph/ownership authority. The [native setting reply guide](../../docs/native-runtime-inputs.md#answering-a-selected-instances-questions) shows the host boundary.
118
+
119
+ `clarifyWorkflowRequirements({ model, context, limits, options? })` makes one described structured-output call for user-grounded requirements and necessary categorized questions. Optional explanations/suggestions are removed from the output schema when disabled. Core validates exact source references and allocates identities; the output has no runtime argument values and does not automatically adopt suggestions. Official Zod inline serialization owns the wire schema while the original Zod schema validates the response. See the [clarification contract](https://github.com/carefreelife98/openapi-flow/blob/main/docs/workflow-requirements-clarification.md). This does not add a host graph or guarantee model semantic accuracy.
120
+
121
+ source additions provide `analyzeApiSelection` and `extractApiInputAnswers`. The former separates consequential API-role choices from absent capabilities; the latter extracts only pending, OAS-typed answers and checks their complete value spans against the user's actual reply. Existing selectors remain available. These additions are not included in npm 0.2.0; see the [conversation guide](https://github.com/carefreelife98/openapi-flow/blob/main/docs/conversational-generation.md).
122
+
123
+ Independent model calls for OpenAPI workflows. Version `0.3.0` depends on matching core `0.3.0`.
124
+
125
+ - `selectApiOperations`: choose catalog candidates and describe capability gaps with structured output.
126
+ - `planApiBindings`: selected OAS contracts and optional declared `nativeOutputs` → output-to-request pointer bindings and request-data gaps, independently of native control-flow planning. API pointers read response bodies; native pointers read the declared JSON output. Neither changes value types or semantics.
127
+ - `generateApiArguments`: propose one call's OAS-typed request values and report missing inputs.
128
+ - `selectApiRequestMediaType`: choose among the full OAS body's declared formats using scenario-grounded structured output. Zero or one format needs no model call. Unspecified or ambiguous multiple-format requests use core's deterministic `selectDefaultApiRequestMediaType`: JSON, then form-urlencoded, then other concrete keys, then wildcard keys; ties use code-point order. Only declared formats can be chosen, explicit choices remain intact and invalid model output still fails.
129
+ - Requests with no remaining literal inputs return empty values without invoking the model, including fully bound nested closed bodies and whole-body bindings. OAS-permitted additional properties remain potential literal inputs.
130
+ - `planWorkflowGraph`: selected API contracts/values and registered native capabilities → typed native settings, conditions/assertions, explicit DAG edges/starts and gaps.
131
+ - `planReviewableWorkflowGraph`: ready/blocked API materials + identified gaps + native capabilities → a validated internal DAG retaining unresolved steps. Structured output contains `additionalNativeNodes`, `edges`, `additionalGaps` and `blockedCalls`; the returned plan's `nativeNodes` combines fixed prepared materials and new additions. Core derives roots and validates all references. Gap IDs have ports but no fabricated API output. Calls dependent on unavailable scenario work must be explicitly blocked; nonexistent API values/code are never invented. Graph array order does not define execution order.
132
+
133
+ Argument generation uses core's `createApiArgumentGenerationContract` for both the structured-output schema and `literalInputSchema` in the HumanMessage. It does not send the original parameter/body definitions or the binding plan to that model stage. Forbidden bound paths may appear as negative schema constraints, never as available inputs. Invalid proposals fail schema parsing rather than being repaired or silently trimmed. This literal-ownership contract is separate from the unchanged OAS contract used after runtime values are assembled.
134
+
135
+ The host supplies a LangChain chat model. No model endpoint, Chomsky adapter, agent loop, LangGraph checkpoint storage or n8n connection is created internally. These functions use named message classes and Zod output schemas with field descriptions. The host can place each invocation in its own LangGraph node and control retries/HITL. Plan bindings before literal arguments so response-supplied fields are not invented as constants. Final graph planning uses these dependencies together with scenario-required order and conditions.
136
+
137
+ This package depends on core and has a LangChain peer dependency; it does not depend on n8n. The graph schema is built from host-provided capability schemas. The planner validates executable proposals without repairing them; gap proposals remain non-executable and are returned for host review. It does not generate JavaScript, credential data, deployment origins or API-node JSON. Old single/linear planning functions live under `/legacy`; full generation compositions are private workspace examples, not this package's main API.
138
+
139
+ Binding gap output now requires `{ callId, targetPointer, description }`, not a description alone. Each target must exist in the request OAS. Assignment validation still runs on gap reports, so invalid bindings cannot be disguised as unmet requirements. The host decides whether to fail immediately or prepare a review workflow.
140
+
141
+ `planApiBindings` owns requested producer-to-request dependencies, not independent literal values. Calls without dependencies return `bindings: []`; absent dependencies are not failures. `gaps: []` means no requested dependency is blocked. Only an unavailable producer, an incompatible source contract or an unsupported explicitly requested transformation belongs in a binding gap. Independent literals (whether supplied or missing) belong to `generateApiArguments`; missing API capabilities belong to selection. These ownership rules are included in both the prompt and the field descriptions sent to the model. Validators check structural and OAS contracts, not the truth of free-text descriptions: genuine gaps remain blocked, and model-reported gaps are never silently discarded by a text heuristic.
142
+
143
+ Each API material sent by `planApiBindings` also includes core's `responsePointerCatalog`: code-derived body paths, declared types/descriptions and dynamic boundaries, alongside the unchanged full OAS contract. The model still chooses dependencies and source pointers; exact declared paths are supplied instead of requiring it to reconstruct those paths from the large contract alone. Response keys in the context are OAS metadata, not expected statuses to plan. The output remains `ApiBindingPlan`; no output-repair or pointer whitelist is added. This improves the available evidence but does not guarantee model choice or actual field presence.
144
+
145
+ `planNativeNodes` similarly reports unmet native behavior only. Selected API calls are OAS-backed materials compiled separately, not native HTTP capability choices. Deferred API argument generation, response-to-request binding and connection planning are not native gaps. This boundary is explicit in its prompt and field descriptions; it does not bypass contract validation or infer whether a free-text gap is true.
146
+
147
+ Native proposal schemas now use capability-owned `createPlanningParametersSchema({ apiCallIds })` hooks when supplied. Built-in n8n IF/assertion schemas constrain response IDs to actual supplied call instances; the model's capability context receives the same specialized schema. The two combined graph planners use this boundary too. With zero API calls, response operands are absent, not an empty enum. Custom capabilities without a hook retain their own schema without field-name rewriting. After proposal parsing, `planNativeNodes` validates declared API response references before returning a native plan; custom references and per-port dependencies receive the same check. Prepared native references also fail before native/connection model invocation. Schema errors remain `proposal-schema` failures with the original proposal; a custom schema-valid but unknown response ID fails `node-validation`. No value correction, defaulting or retry is introduced. ID membership does not replace the later dependency-route or source-response checks.
148
+
149
+ Discovery selection cannot produce `insufficient_contract` from metadata-only candidates. Model gap output has only `description`; the library assigns `missing_operation`. Detailed input and response limitations belong to stages that read full contracts. Review output omits known empty `blockedCalls`/`additionalNativeNodes` fields; code adds those constants only when the supplied context proves they are empty. Dynamic fields remain required. Real LangChain wire schemas are checked against the JSON Schema meta-schema, including all-blocked and empty-registry contexts.
150
+
151
+ See the [workspace guide](https://github.com/carefreelife98/openapi-flow#independent-stages). Our code is MIT-licensed; dependency terms remain separate.
152
+
153
+ Both graph planners accept optional `preparedNativeNodes`. These are fixed materials, not model output: their IDs/parameters and implementation-owned input/output ports are supplied explicitly while the model plans connections. Prepare such producers before binding/argument generation, deriving their schemas with core's `createNativeOutputContracts`. The model's `additionalNativeNodes` contains new nodes only, or `[]` if no addition is needed; the ambiguous old model field `nativeNodes` is not accepted as an alias. Repeating a prepared ID, guessing a producer, changing parameters through a coercing/defaulting schema or bypassing a required producer fails validation. Native output contracts must come from registered capability implementations, never model-generated declarations. Planning errors retain the raw model output, stage and original validation cause; hosts own persistence/privacy and retry policy.
@@ -0,0 +1,3 @@
1
+ # Third-party notices
2
+
3
+ This package depends on `@openapi-flow/core` and Zod and uses `@langchain/core` as a peer dependency. It does not depend on the n8n workflow SDK. Dependencies retain their own licenses; our MIT license applies only to openapi-flow's code.
@@ -0,0 +1,3 @@
1
+ import type { ApiInputAnswerAnalysis } from '@openapi-flow/core';
2
+ import type { AnalyzeApiInputAnswersInput } from '../types/api-input-answers.js';
3
+ export declare function analyzeApiInputAnswers(input: AnalyzeApiInputAnswersInput): Promise<ApiInputAnswerAnalysis>;
@@ -0,0 +1,87 @@
1
+ import { HumanMessage, SystemMessage } from '@langchain/core/messages';
2
+ import { captureApiInputAnswerContext, createApiInputAnswerExtractionRecord, resolveApiInputAnswerSources, describeApiInputSources, resolveApiInputSourceSelections, } from '@openapi-flow/core';
3
+ import { createApiInputAnswerSourceSchema, apiInputAnswerExplanationOptionsSchema, } from '../schemas/api-input-answer-source-schema.js';
4
+ import { apiInputAnswersPrompt } from '../prompts/api-input-answers-prompt.js';
5
+ import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
6
+ import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
7
+ export async function analyzeApiInputAnswers(input) {
8
+ const options = apiInputAnswerExplanationOptionsSchema.parse({
9
+ includeExplanations: input.includeExplanations,
10
+ });
11
+ const snapshot = captureApiInputAnswerContext({
12
+ reply: input.reply,
13
+ requirements: input.requirements,
14
+ });
15
+ if (input.model !== undefined &&
16
+ (!input.model || typeof input.model.withStructuredOutput !== 'function'))
17
+ throw new Error('analyzeApiInputAnswers.model must support structured output when supplied');
18
+ if (!snapshot.requirements.length || snapshot.reply === '')
19
+ return {
20
+ status: snapshot.requirements.length
21
+ ? 'empty-reply'
22
+ : 'no-pending-inputs',
23
+ answers: [],
24
+ sources: [],
25
+ unansweredRequirementIds: snapshot.requirements.map((item) => item.id),
26
+ };
27
+ const catalog = describeApiInputSources(snapshot.reply);
28
+ if (!catalog.json.length && !catalog.text.length)
29
+ return {
30
+ status: 'extracted',
31
+ answers: [],
32
+ sources: [],
33
+ unansweredRequirementIds: snapshot.requirements.map((item) => item.id),
34
+ };
35
+ if (!input.model)
36
+ throw new Error('analyzeApiInputAnswers.model is required for a nonempty reply with pending inputs');
37
+ const schema = createApiInputAnswerSourceSchema(snapshot.requirements, catalog, options.includeExplanations === true);
38
+ const output = await input.model
39
+ .withStructuredOutput(serializeStructuredOutputSchema(schema, 'draft-2020-12'), {
40
+ name: 'extract_api_input_answers',
41
+ method: 'functionCalling',
42
+ strict: true,
43
+ })
44
+ .invoke([
45
+ new SystemMessage(apiInputAnswersPrompt),
46
+ new HumanMessage(JSON.stringify({
47
+ reply: snapshot.reply,
48
+ questions: snapshot.requirements,
49
+ sources: catalog,
50
+ })),
51
+ ]);
52
+ const parsed = parseStructuredOutput(schema, output, 'model clarification answer sources');
53
+ const selections = resolveApiInputSourceSelections({
54
+ ...snapshot,
55
+ selections: parsed.answers.map(({ requirementId, source }) => ({
56
+ requirementId,
57
+ source,
58
+ })),
59
+ });
60
+ const resolved = resolveApiInputAnswerSources({
61
+ ...snapshot,
62
+ selections,
63
+ });
64
+ let extraction;
65
+ if (options.includeExplanations === true) {
66
+ if (typeof parsed.reason !== 'string')
67
+ throw new Error('model clarification answer sources require an explanation');
68
+ extraction = createApiInputAnswerExtractionRecord({
69
+ ...snapshot,
70
+ decision: {
71
+ reason: parsed.reason,
72
+ answers: parsed.answers.map((source, index) => {
73
+ if (typeof source.reason !== 'string')
74
+ throw new Error(`model answer ${source.requirementId} requires an explanation`);
75
+ return { ...selections[index], reason: source.reason };
76
+ }),
77
+ },
78
+ });
79
+ }
80
+ return {
81
+ status: 'extracted',
82
+ answers: resolved.answers,
83
+ sources: resolved.sources,
84
+ unansweredRequirementIds: resolved.unansweredRequirementIds,
85
+ ...(extraction === undefined ? {} : { extraction }),
86
+ };
87
+ }
@@ -0,0 +1,4 @@
1
+ import type { ApiRequestMediaTypeDecision } from '@openapi-flow/core';
2
+ import type { AnalyzeApiRequestMediaTypeInput } from '../types/request-media-selection.js';
3
+ /** One assessment call only for multiple formats; code owns resolution and sources. */
4
+ export declare function analyzeApiRequestMediaType(input: AnalyzeApiRequestMediaTypeInput): Promise<ApiRequestMediaTypeDecision>;
@@ -0,0 +1,50 @@
1
+ import { HumanMessage, SystemMessage } from '@langchain/core/messages';
2
+ import { createApiRequestMediaTypeDecision, describeApiRequestMediaTypeContext, } from '@openapi-flow/core';
3
+ import { createApiRequestMediaTypeSchema } from '../schemas/api-request-media-type-schema.js';
4
+ import { requestMediaSelectionOptionsSchema } from '../schemas/request-media-selection-options-schema.js';
5
+ import { apiRequestMediaTypePrompt } from '../prompts/api-request-media-type-prompt.js';
6
+ import { assertSelectionInput } from '../legacy/planning/select-operation.js';
7
+ import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
8
+ /** One assessment call only for multiple formats; code owns resolution and sources. */
9
+ export async function analyzeApiRequestMediaType(input) {
10
+ assertSelectionInput(input.scenario, input.model);
11
+ const options = requestMediaSelectionOptionsSchema.parse({
12
+ includeExplanations: input.includeExplanations,
13
+ });
14
+ const operation = structuredClone(input.operation);
15
+ const context = describeApiRequestMediaTypeContext({
16
+ operation,
17
+ scenario: input.scenario,
18
+ ...(input.purpose === undefined ? {} : { purpose: input.purpose }),
19
+ });
20
+ if (context.mediaTypes.length < 2)
21
+ return createApiRequestMediaTypeDecision({
22
+ operation,
23
+ scenario: context.scenario,
24
+ ...(context.purpose === undefined ? {} : { purpose: context.purpose }),
25
+ });
26
+ const schema = createApiRequestMediaTypeSchema(context.mediaTypes, options.includeExplanations === true);
27
+ const proposed = await input.model
28
+ .withStructuredOutput(schema, {
29
+ name: 'select_api_request_media_type',
30
+ method: 'functionCalling',
31
+ strict: true,
32
+ })
33
+ .invoke([
34
+ new SystemMessage(apiRequestMediaTypePrompt),
35
+ new HumanMessage(JSON.stringify({
36
+ scenario: context.scenario,
37
+ ...(context.purpose === undefined
38
+ ? {}
39
+ : { purpose: context.purpose }),
40
+ operation: context.operation,
41
+ })),
42
+ ]);
43
+ const assessment = parseStructuredOutput(schema, proposed, 'model API request media type');
44
+ return createApiRequestMediaTypeDecision({
45
+ operation,
46
+ scenario: context.scenario,
47
+ ...(context.purpose === undefined ? {} : { purpose: context.purpose }),
48
+ assessment,
49
+ });
50
+ }
@@ -0,0 +1,3 @@
1
+ import type { ApiInputAnswer } from '@openapi-flow/core';
2
+ import type { ExtractApiInputAnswersInput } from '../types/api-input-answers.js';
3
+ export declare function extractApiInputAnswers(input: ExtractApiInputAnswersInput): Promise<ApiInputAnswer[]>;
@@ -0,0 +1,4 @@
1
+ import { analyzeApiInputAnswers } from './analyze-api-input-answers.js';
2
+ export async function extractApiInputAnswers(input) {
3
+ return (await analyzeApiInputAnswers(input)).answers;
4
+ }
@@ -0,0 +1,3 @@
1
+ import type { ApiCallArguments } from '@openapi-flow/core';
2
+ import type { GenerateApiArgumentsInput } from '../types/argument-generation.js';
3
+ export declare function generateApiArguments(input: GenerateApiArgumentsInput): Promise<ApiCallArguments>;
@@ -0,0 +1,60 @@
1
+ import { SystemMessage, HumanMessage } from '@langchain/core/messages';
2
+ import { describeApiLiteralGeneration, createApiLiteralGenerationRecord, validateApiArguments, applyConfirmedApiInputs, } from '@openapi-flow/core';
3
+ import { apiLiteralGenerationOptionsSchema, createApiLiteralGenerationOutputSchema, } from '../schemas/api-literal-generation-output-schema.js';
4
+ import { apiArgumentsPrompt } from '../prompts/api-arguments-prompt.js';
5
+ import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
6
+ export async function generateApiArguments(input) {
7
+ if (input.model !== undefined &&
8
+ (!input.model || typeof input.model.withStructuredOutput !== 'function'))
9
+ throw new Error('generateApiArguments.model must support structured output when supplied');
10
+ if (typeof input.callId !== 'string' || !input.callId.trim())
11
+ throw new Error('callId must be non-empty');
12
+ const options = apiLiteralGenerationOptionsSchema.parse({
13
+ includeExplanations: input.includeExplanations,
14
+ });
15
+ const { input: snapshot, contract, context, } = describeApiLiteralGeneration(input);
16
+ const schema = createApiLiteralGenerationOutputSchema(contract, options.includeExplanations === true);
17
+ let proposed = { values: {} };
18
+ if (contract.hasLiteralInputs) {
19
+ const model = input.model;
20
+ if (!model || typeof model.withStructuredOutput !== 'function')
21
+ throw new Error('generateApiArguments.model must support structured output when literal inputs remain');
22
+ proposed = await model
23
+ .withStructuredOutput(schema, {
24
+ name: 'generate_api_arguments',
25
+ method: 'functionCalling',
26
+ })
27
+ .invoke([
28
+ new SystemMessage(apiArgumentsPrompt),
29
+ new HumanMessage(JSON.stringify(context)),
30
+ ]);
31
+ }
32
+ const parsed = parseStructuredOutput(schema, proposed, `model arguments for ${snapshot.callId}`);
33
+ const values = applyConfirmedApiInputs({
34
+ ...snapshot,
35
+ values: parsed.values,
36
+ });
37
+ const validation = validateApiArguments({ ...snapshot, values });
38
+ return {
39
+ callId: snapshot.callId,
40
+ values,
41
+ bindings: structuredClone(snapshot.bindings),
42
+ unresolvedInputs: validation.missingInputs,
43
+ ...(snapshot.requestMediaType === undefined
44
+ ? {}
45
+ : { requestMediaType: snapshot.requestMediaType }),
46
+ ...(options.includeExplanations === true
47
+ ? {
48
+ literalGeneration: createApiLiteralGenerationRecord({
49
+ ...snapshot,
50
+ ...('explanation' in parsed
51
+ ? {
52
+ proposal: { values: parsed.values },
53
+ reason: parsed.explanation.reason,
54
+ }
55
+ : {}),
56
+ }),
57
+ }
58
+ : {}),
59
+ };
60
+ }
@@ -0,0 +1,2 @@
1
+ import type { SelectApiRequestMediaTypeInput } from '../types/request-media-selection.js';
2
+ export declare function selectApiRequestMediaType(input: SelectApiRequestMediaTypeInput): Promise<string | undefined>;
@@ -0,0 +1,10 @@
1
+ import { analyzeApiRequestMediaType } from './analyze-api-request-media-type.js';
2
+ export async function selectApiRequestMediaType(input) {
3
+ const decision = await analyzeApiRequestMediaType({
4
+ operation: input.operation,
5
+ scenario: input.scenario,
6
+ ...(input.purpose === undefined ? {} : { purpose: input.purpose }),
7
+ model: input.model,
8
+ });
9
+ return decision.requestMediaType;
10
+ }
@@ -0,0 +1,3 @@
1
+ import type { ApiBindingPlan } from '@openapi-flow/core';
2
+ import type { PlanApiBindingsInput } from '../types/binding-planning.js';
3
+ export declare function planApiBindings(input: PlanApiBindingsInput): Promise<ApiBindingPlan>;
@@ -0,0 +1,50 @@
1
+ import { SystemMessage, HumanMessage } from '@langchain/core/messages';
2
+ import { validateApiBindingAssignments, validateApiBindingGaps, describeApiBindingPlanning, createApiBindingPlanningRecord, } from '@openapi-flow/core';
3
+ import { createApiBindingPlanSchema, apiBindingPlanningOptionsSchema, } from '../schemas/api-binding-plan-schema.js';
4
+ import { apiBindingsPrompt } from '../prompts/api-bindings-prompt.js';
5
+ import { assertSelectionInput } from '../legacy/planning/select-operation.js';
6
+ import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
7
+ export async function planApiBindings(input) {
8
+ assertSelectionInput(input.scenario, input.model);
9
+ const options = apiBindingPlanningOptionsSchema.parse({
10
+ includeExplanations: input.includeExplanations,
11
+ });
12
+ const { input: snapshot, context } = describeApiBindingPlanning(input);
13
+ const schema = createApiBindingPlanSchema(snapshot.materials, snapshot.nativeOutputs, options.includeExplanations === true);
14
+ const proposed = await input.model
15
+ .withStructuredOutput(schema, {
16
+ name: 'plan_api_bindings',
17
+ method: 'functionCalling',
18
+ strict: true,
19
+ })
20
+ .invoke([
21
+ new SystemMessage(apiBindingsPrompt),
22
+ new HumanMessage(JSON.stringify(context)),
23
+ ]);
24
+ const parsed = parseStructuredOutput(schema, proposed, 'model API bindings');
25
+ const plan = {
26
+ calls: parsed.calls.map(({ callId, bindings }) => ({
27
+ callId,
28
+ bindings: structuredClone(bindings),
29
+ })),
30
+ gaps: structuredClone(parsed.gaps),
31
+ };
32
+ validateApiBindingAssignments({
33
+ calls: plan.calls,
34
+ materials: snapshot.materials,
35
+ nativeOutputs: snapshot.nativeOutputs,
36
+ });
37
+ validateApiBindingGaps({ plan, materials: snapshot.materials });
38
+ if (options.includeExplanations === true) {
39
+ plan.bindingPlanning = createApiBindingPlanningRecord({
40
+ ...snapshot,
41
+ plan,
42
+ reasons: parsed.calls.map((call) => {
43
+ if (!('reason' in call))
44
+ throw new Error(`model API bindings are missing reason for ${call.callId}`);
45
+ return { callId: call.callId, reason: call.reason };
46
+ }),
47
+ });
48
+ }
49
+ return plan;
50
+ }
@@ -0,0 +1,4 @@
1
+ import type { WorkflowDraftEditPlan } from '@openapi-flow/core';
2
+ import type { AnalyzeWorkflowDraftEditInput } from '../types/workflow-draft-edit.js';
3
+ /** One semantic call. Resolution/values/bindings/edges and canonical mutation stay separate. */
4
+ export declare function analyzeWorkflowDraftEdit(input: AnalyzeWorkflowDraftEditInput): Promise<WorkflowDraftEditPlan>;
@@ -0,0 +1,84 @@
1
+ import { HumanMessage, SystemMessage } from '@langchain/core/messages';
2
+ import { createWorkflowDraftEditPlan, describeWorkflowDraftEditContext, resolveWorkflowDraftEditOptions, describeWorkflowDraftCapabilityGap, } from '@openapi-flow/core';
3
+ import { createWorkflowDraftEditSchema } from '../schemas/workflow-draft-edit-schema.js';
4
+ import { workflowDraftEditPrompt } from '../prompts/workflow-draft-edit-prompt.js';
5
+ import { workflowUserActionEvidencePrompt } from '../prompts/workflow-user-action-evidence-prompt.js';
6
+ import { parseStructuredOutput } from '../legacy/planning/parse-structured-output.js';
7
+ import { WorkflowDraftEditPlanningError } from './workflow-draft-edit-planning-error.js';
8
+ import { resolveWorkflowDraftEditProposal } from './resolve-workflow-draft-edit-proposal.js';
9
+ import { serializeStructuredOutputSchema } from '../schemas/serialize-structured-output-schema.js';
10
+ /** One semantic call. Resolution/values/bindings/edges and canonical mutation stay separate. */
11
+ export async function analyzeWorkflowDraftEdit(input) {
12
+ if (!input.model || typeof input.model.withStructuredOutput !== 'function')
13
+ throw new Error('analyzeWorkflowDraftEdit.model must support structured output');
14
+ const context = describeWorkflowDraftEditContext(input);
15
+ const options = resolveWorkflowDraftEditOptions(input.options);
16
+ const candidates = context.planning.operations.map((operation, index) => ({
17
+ candidateId: `candidate-${index + 1}`,
18
+ operation,
19
+ }));
20
+ const schema = createWorkflowDraftEditSchema(context, options, candidates.map((candidate) => candidate.candidateId));
21
+ const output = await input.model
22
+ .withStructuredOutput(serializeStructuredOutputSchema(schema, 'draft-7', 'input', 'ref'), {
23
+ name: 'analyze_workflow_draft_edit',
24
+ method: 'jsonSchema',
25
+ strict: true,
26
+ })
27
+ .invoke([
28
+ new SystemMessage(workflowDraftEditPrompt + '\n' + workflowUserActionEvidencePrompt),
29
+ new HumanMessage(JSON.stringify({
30
+ requestMessageIds: context.requestMessageIds,
31
+ draft: {
32
+ requirements: context.draft.requirements,
33
+ removedRequirements: context.removedRequirements,
34
+ apiCalls: context.draft.apiCalls,
35
+ nativeNodes: context.draft.nativeNodes,
36
+ nodeContracts: context.nodeContracts,
37
+ ...(context.draft.gapNodes === undefined
38
+ ? {}
39
+ : {
40
+ gapNodes: context.draft.gapNodes.map((gap) => describeWorkflowDraftCapabilityGap({
41
+ gap,
42
+ context: input.context,
43
+ })),
44
+ }),
45
+ edges: context.draft.edges,
46
+ },
47
+ messages: context.planning.messages,
48
+ candidates,
49
+ capabilities: context.planning.capabilities,
50
+ options,
51
+ ...(context.planning.clarification === undefined
52
+ ? {}
53
+ : { clarification: context.planning.clarification }),
54
+ })),
55
+ ]);
56
+ let proposed;
57
+ try {
58
+ proposed = parseStructuredOutput(schema, output, 'model draft edit');
59
+ }
60
+ catch (cause) {
61
+ if (!(cause instanceof Error))
62
+ throw cause;
63
+ throw new WorkflowDraftEditPlanningError({ stage: 'proposal-schema', proposal: output }, cause);
64
+ }
65
+ try {
66
+ const plan = createWorkflowDraftEditPlan({
67
+ ...input,
68
+ options,
69
+ proposal: resolveWorkflowDraftEditProposal(proposed, candidates),
70
+ });
71
+ if (plan.draftFingerprint !== context.draftFingerprint ||
72
+ plan.contextFingerprint !== context.contextFingerprint ||
73
+ plan.nodeContractsFingerprint !== context.nodeContractsFingerprint ||
74
+ JSON.stringify(plan.requestMessageIds) !==
75
+ JSON.stringify(context.requestMessageIds))
76
+ throw new Error('Draft edit input changed during model invocation; no automatic rebase is permitted');
77
+ return plan;
78
+ }
79
+ catch (cause) {
80
+ if (!(cause instanceof Error))
81
+ throw cause;
82
+ throw new WorkflowDraftEditPlanningError({ stage: 'proposal-validation', proposal: output }, cause);
83
+ }
84
+ }
@@ -0,0 +1,3 @@
1
+ import type { WorkflowDraftApiCallArgumentsResult } from '@openapi-flow/core';
2
+ import type { GenerateWorkflowDraftApiCallArgumentsInput } from '../types/workflow-draft-api-call-planning.js';
3
+ export declare function generateWorkflowDraftApiCallArguments(input: GenerateWorkflowDraftApiCallArgumentsInput): Promise<WorkflowDraftApiCallArgumentsResult>;