@autobe/agent 0.3.22 → 0.3.24

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 (28) hide show
  1. package/lib/constants/AutoBeSystemPromptConstant.d.ts +1 -0
  2. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  3. package/lib/index.mjs +453 -149
  4. package/lib/index.mjs.map +1 -1
  5. package/lib/orchestrate/interface/orchestrateInterface.js +5 -4
  6. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  7. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -0
  8. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +482 -0
  9. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -0
  10. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +3 -109
  11. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  12. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -8
  13. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  14. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +5 -8
  15. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  16. package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
  17. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  18. package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +2 -1
  19. package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +1 -1
  20. package/package.json +4 -4
  21. package/src/constants/AutoBeSystemPromptConstant.ts +1 -0
  22. package/src/orchestrate/interface/orchestrateInterface.ts +6 -6
  23. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +235 -0
  24. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +19 -57
  25. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -7
  26. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +4 -7
  27. package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
  28. package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +3 -1
@@ -0,0 +1,482 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.orchestrateInterfaceComplement = orchestrateInterfaceComplement;
49
+ const __typia_transform__accessExpressionAsString = __importStar(require("typia/lib/internal/_accessExpressionAsString.js"));
50
+ const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
51
+ const core_1 = require("@agentica/core");
52
+ const openapi_1 = require("@samchon/openapi");
53
+ const OpenApiV3_1Emender_1 = require("@samchon/openapi/lib/converters/OpenApiV3_1Emender");
54
+ const typia_1 = __importDefault(require("typia"));
55
+ const assertSchemaModel_1 = require("../../context/assertSchemaModel");
56
+ const transformInterfaceHistories_1 = require("./transformInterfaceHistories");
57
+ function orchestrateInterfaceComplement(ctx, document, retry = 8) {
58
+ return step(ctx, document, retry);
59
+ }
60
+ function step(ctx, document, retry) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ var _a, _b, _c;
63
+ const missed = getMissed(document);
64
+ if (missed.length === 0 || retry <= 0)
65
+ return document.components;
66
+ const pointer = {
67
+ value: null,
68
+ };
69
+ const agentica = new core_1.MicroAgentica({
70
+ model: ctx.model,
71
+ vendor: ctx.vendor,
72
+ config: Object.assign(Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})), { executor: {
73
+ describe: null,
74
+ } }),
75
+ histories: [
76
+ ...(0, transformInterfaceHistories_1.transformInterfaceHistories)(ctx.state(), "# OpenAPI Schema Complement Agent\n\nYou are an AI agent specialized in complementing missing schema definitions in OpenAPI documents. Your primary responsibility is to identify and fill in schema types that are referenced via `$ref` but not yet defined in the `components.schemas` section.\n\n## Your Role\n\nYou analyze OpenAPI documents to find missing schema definitions and generate complete, accurate JSON Schema definitions for those missing types. You work as part of a larger OpenAPI document generation workflow, specifically handling the final step of ensuring all referenced schemas are properly defined.\n\n## Key Responsibilities\n\n1. **Identify Missing Schemas**: Scan the OpenAPI document for `$ref` references pointing to `#/components/schemas/[ISchemaName]` that don't have corresponding definitions\n2. **Generate Schema Definitions**: Create complete JSON Schema definitions for missing types based on context clues from API operations, database schemas, and usage patterns\n3. **Handle Nested References**: When creating new schemas, identify any new `$ref` references introduced in those schemas and ensure they are also defined\n4. **Iterative Completion**: Continue the process recursively until all referenced schemas (including nested ones) are properly defined\n5. **Ensure Completeness**: Make sure all generated schemas follow JSON Schema specifications and are consistent with OpenAPI 3.0+ standards\n\n## Function Calling\n\nYou have access to the `complementComponents` function which you should call when you identify missing schemas:\n\n```typescript\ncomplementComponents({\n schemas: {\n ISchemaName: {\n // Complete JSON Schema definition\n description: \"Description must be clear and detailed\"\n }\n }\n})\n```\n\n## Guidelines for Schema Generation\n\n1. **Type Inference**: Infer appropriate types based on context (API operations, database fields, naming conventions)\n2. **Property Requirements**: Determine which properties should be required vs optional based on usage patterns\n3. **Data Formats**: Apply appropriate formats (email, date-time, uri, etc.) when evident from context\n4. **Nested References**: Handle schemas that reference other schemas appropriately\n5. **Validation Rules**: Include reasonable validation constraints (minLength, maxLength, pattern, etc.) when applicable\n6. **Recursive Schema Detection**: When creating new schemas, scan them for additional `$ref` references and ensure those referenced schemas are also created\n7. **Dependency Chain Completion**: Continue generating schemas until no more missing references exist in the entire schema dependency chain\n8. **Comprehensive Descriptions**: Add detailed, clear descriptions to every schema and property that explain:\n - What the schema/property represents\n - Its purpose and usage context\n - Any business logic or constraints\n - Examples of valid values when helpful\n - Relationships to other entities or concepts\n\n## Response Format\n\n- Analyze the provided OpenAPI document systematically\n- Identify all missing schema references (including those in newly created schemas)\n- Generate appropriate schema definitions for all missing references\n- Recursively check for new `$ref` references introduced in generated schemas\n- Call the `complementComponents` function with all missing schemas (may require multiple calls if nested dependencies are discovered)\n- Provide a brief summary of what schemas were added and any dependency chains that were resolved\n\n## Quality Standards\n\n- Ensure all generated schemas are valid JSON Schema\n- Maintain consistency with existing schema patterns in the document\n- Use descriptive and clear property names\n- **Add comprehensive descriptions**: Every schema object and property must include detailed descriptions that are:\n - Clear and understandable to anyone reading the API documentation\n - Specific about the purpose and usage of each field\n - Include examples or context when helpful\n - Explain any business rules or constraints\n - Describe relationships between different entities\n- Follow OpenAPI best practices for schema design\n- Make the API documentation self-explanatory through excellent descriptions\n\nFocus on accuracy, completeness, and maintaining the integrity of the OpenAPI specification." /* AutoBeSystemPromptConstant.INTERFACE_COMPLEMENT */),
77
+ {
78
+ type: "assistantMessage",
79
+ text: [
80
+ "Here is the OpenAPI document what you've made:",
81
+ "",
82
+ "```json",
83
+ JSON.stringify(document),
84
+ "```",
85
+ ].join("\n"),
86
+ },
87
+ {
88
+ type: "assistantMessage",
89
+ text: [
90
+ "You have missed below schema types in the document.components.schemas:",
91
+ "",
92
+ ...missed.map((s) => `- ${s}`),
93
+ ].join("\n"),
94
+ },
95
+ ],
96
+ tokenUsage: ctx.usage(),
97
+ controllers: [
98
+ createApplication({
99
+ model: ctx.model,
100
+ build: (next) => {
101
+ var _a;
102
+ pointer.value = ((_a = OpenApiV3_1Emender_1.OpenApiV3_1Emender.convertComponents({
103
+ schemas: next,
104
+ }).schemas) !== null && _a !== void 0 ? _a : {});
105
+ },
106
+ }),
107
+ ],
108
+ });
109
+ agentica.on("request", (event) => __awaiter(this, void 0, void 0, function* () {
110
+ event.body.tool_choice = "required";
111
+ }));
112
+ yield agentica.conversate("Fill missing schema types please");
113
+ if (pointer.value === null) {
114
+ // unreachable
115
+ throw new Error("Failed to fill missing schema types. No response from agentica.");
116
+ }
117
+ ctx.dispatch({
118
+ type: "interfaceComplement",
119
+ missed,
120
+ schemas: pointer.value,
121
+ step: (_c = (_b = ctx.state().analyze) === null || _b === void 0 ? void 0 : _b.step) !== null && _c !== void 0 ? _c : 0,
122
+ created_at: new Date().toISOString(),
123
+ });
124
+ const newComponents = {
125
+ schemas: Object.assign(Object.assign({}, pointer.value), document.components.schemas),
126
+ authorization: document.components.authorization,
127
+ };
128
+ return step(ctx, Object.assign(Object.assign({}, document), { components: newComponents }), retry - 1);
129
+ });
130
+ }
131
+ const getMissed = (document) => {
132
+ const missed = new Set();
133
+ const check = (name) => {
134
+ if (document.components.schemas[name] === undefined)
135
+ missed.add(name);
136
+ };
137
+ for (const op of document.operations) {
138
+ if (op.requestBody !== null)
139
+ check(op.requestBody.typeName);
140
+ if (op.responseBody !== null)
141
+ check(op.responseBody.typeName);
142
+ }
143
+ for (const value of Object.values(document.components.schemas))
144
+ openapi_1.OpenApiTypeChecker.visit({
145
+ components: document.components,
146
+ schema: value,
147
+ closure: (next) => {
148
+ if (openapi_1.OpenApiTypeChecker.isReference(next))
149
+ check(next.$ref.split("/").pop());
150
+ },
151
+ });
152
+ return Array.from(missed);
153
+ };
154
+ function createApplication(props) {
155
+ (0, assertSchemaModel_1.assertSchemaModel)(props.model);
156
+ const application = collection[props.model];
157
+ return {
158
+ protocol: "class",
159
+ name: "interface",
160
+ application,
161
+ execute: {
162
+ complementComponents: (next) => {
163
+ props.build(next.schemas);
164
+ },
165
+ },
166
+ };
167
+ }
168
+ const claude = {
169
+ model: "claude",
170
+ options: {
171
+ reference: true,
172
+ separate: null
173
+ },
174
+ functions: [
175
+ {
176
+ name: "complementComponents",
177
+ parameters: {
178
+ description: "Current Type: {@link IComplementComponentsProps}",
179
+ type: "object",
180
+ properties: {
181
+ schemas: {
182
+ description: "A collection of missing schema definitions that need to be added to the\nOpenAPI document's `components.schemas` section.\n\nThis object contains schema definitions for types that are referenced but\nnot yet defined:\n\n- Key: Schema name (`string`): The name of the schema type that will be\n referenced in $ref statements\n- Value: `AutoBeOpenApi.IJsonSchema` - The complete JSON Schema definition\n for that type\n\nExample structure:\n\n```typescript\n{\n \"UserProfile\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\", \"format\": \"email\" }\n },\n \"required\": [\"id\", \"name\", \"email\"]\n }\n}\n```\n\nEach schema definition follows the JSON Schema specification and will be\ndirectly inserted into the OpenAPI document's components.schemas section,\nmaking them available for $ref references throughout the API\nspecification.\n\n------------------------------\n\nDescription of the current {@link RecordstringAutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Construct a type with a set of properties K of type T",
183
+ type: "object",
184
+ properties: {},
185
+ required: [],
186
+ additionalProperties: {
187
+ description: "Description of the current {@link AutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Descriptive type schema info.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` is a type schema info of the OpenAPI\n> Generative, but it has a `description` property which is required.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` basically follows the JSON schema\n> specification of OpenAPI v3.1, but a little bit shrunk to remove ambiguous\n> and duplicated expressions of OpenAPI v3.1 for the convenience, clarity,\n> and AI generation.\n> \n> CRITICAL INSTRUCTIONS FOR OPTIMAL AI GENERATION:\n> \n> When creating descriptions for components, types, and properties:\n> \n> 1. ALWAYS refer to and incorporate the description comments from the\n> corresponding Prisma DB schema tables and columns. The descriptions\n> should match the style, level of detail, and terminology used in the\n> Prisma schema.\n> 2. ALL descriptions MUST be organized into MULTIPLE PARAGRAPHS separated by\n> line breaks. Single-paragraph descriptions should be avoided.\n> 3. Descriptions should comprehensively cover:\n> \n> - The purpose and business meaning of the type or property\n> - Relationships to other entities\n> - Validation rules, constraints, and edge cases\n> - Usage context and examples when helpful\n> 4. For each property of an object type, ensure its description reflects the\n> corresponding column description in the Prisma DB schema, maintaining\n> the same level of detail and terminology\n> 5. Descriptions should be so detailed and clear that anyone reading them can\n> fully understand the type or property without needing to reference any\n> other documentation",
188
+ type: "object",
189
+ properties: {
190
+ description: {
191
+ title: "Description about the type",
192
+ description: "Description about the type.\n\nCRITICAL: This description MUST be extensively detailed and MUST\nreference and align with the description comments from the\ncorresponding Prisma DB schema tables and columns.\n\nThe description MUST be organized into MULTIPLE PARAGRAPHS (separated\nby line breaks) based on different aspects of the type:\n\n- The purpose and business meaning of the type\n- Relationships to other entities in the system\n- Validation rules, constraints, and edge cases\n- Usage context and examples when helpful\n\nThis structured approach improves readability and helps readers better\nunderstand the type's various characteristics and use cases. The\ndescription should be so comprehensive that anyone reading it can fully\nunderstand the type without needing to reference other documentation.\n\n> MUST be written in English. Never use other languages.",
193
+ type: "string"
194
+ }
195
+ },
196
+ required: [
197
+ "description"
198
+ ]
199
+ }
200
+ }
201
+ },
202
+ required: [
203
+ "schemas"
204
+ ],
205
+ additionalProperties: false,
206
+ $defs: {}
207
+ },
208
+ description: "Complements missing schema types\n\nThis method fills in schema definitions that are referenced via $ref but\nnot yet defined in the `components.schemas` section. For example, if an API\noperation references `{ \"$ref\": \"#/components/schemas/UserProfile\" }` but\n`UserProfile` type is not defined in `components.schemas`, this method will\nadd the missing schema definition.\n\nThis function is designed to be called via AI function calling mechanism to\nensure the OpenAPI document is complete and all referenced schemas are\nproperly defined.",
209
+ validate: (() => { const _io0 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io1(input.schemas); const _io1 = input => Object.keys(input).every(key => {
210
+ const value = input[key];
211
+ if (undefined === value)
212
+ return true;
213
+ return "object" === typeof value && null !== value && _io2(value);
214
+ }); const _io2 = input => "string" === typeof input.description; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
215
+ path: _path + ".schemas",
216
+ expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
217
+ value: input.schemas
218
+ })) && _vo1(input.schemas, _path + ".schemas", true && _exceptionable) || _report(_exceptionable, {
219
+ path: _path + ".schemas",
220
+ expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
221
+ value: input.schemas
222
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
223
+ const value = input[key];
224
+ if (undefined === value)
225
+ return true;
226
+ return ("object" === typeof value && null !== value || _report(_exceptionable, {
227
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
228
+ expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
229
+ value: value
230
+ })) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
231
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
232
+ expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
233
+ value: value
234
+ });
235
+ }).every(flag => flag)].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.description || _report(_exceptionable, {
236
+ path: _path + ".description",
237
+ expected: "string",
238
+ value: input.description
239
+ })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
240
+ if (false === __is(input)) {
241
+ errors = [];
242
+ _report = __typia_transform__validateReport._validateReport(errors);
243
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
244
+ path: _path + "",
245
+ expected: "IComplementComponentsProps",
246
+ value: input
247
+ })) && _vo0(input, _path + "", true) || _report(true, {
248
+ path: _path + "",
249
+ expected: "IComplementComponentsProps",
250
+ value: input
251
+ }))(input, "$input", true);
252
+ const success = 0 === errors.length;
253
+ return success ? {
254
+ success,
255
+ data: input
256
+ } : {
257
+ success,
258
+ errors,
259
+ data: input
260
+ };
261
+ }
262
+ return {
263
+ success: true,
264
+ data: input
265
+ };
266
+ }; })()
267
+ }
268
+ ]
269
+ };
270
+ const collection = {
271
+ chatgpt: {
272
+ model: "chatgpt",
273
+ options: {
274
+ reference: true,
275
+ strict: false,
276
+ separate: null
277
+ },
278
+ functions: [
279
+ {
280
+ name: "complementComponents",
281
+ parameters: {
282
+ description: "Current Type: {@link IComplementComponentsProps}",
283
+ type: "object",
284
+ properties: {
285
+ schemas: {
286
+ description: "A collection of missing schema definitions that need to be added to the\nOpenAPI document's `components.schemas` section.\n\nThis object contains schema definitions for types that are referenced but\nnot yet defined:\n\n- Key: Schema name (`string`): The name of the schema type that will be\n referenced in $ref statements\n- Value: `AutoBeOpenApi.IJsonSchema` - The complete JSON Schema definition\n for that type\n\nExample structure:\n\n```typescript\n{\n \"UserProfile\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\", \"format\": \"email\" }\n },\n \"required\": [\"id\", \"name\", \"email\"]\n }\n}\n```\n\nEach schema definition follows the JSON Schema specification and will be\ndirectly inserted into the OpenAPI document's components.schemas section,\nmaking them available for $ref references throughout the API\nspecification.\n\n------------------------------\n\nDescription of the current {@link RecordstringAutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Construct a type with a set of properties K of type T",
287
+ type: "object",
288
+ properties: {},
289
+ required: [],
290
+ additionalProperties: {
291
+ description: "Description of the current {@link AutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Descriptive type schema info.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` is a type schema info of the OpenAPI\n> Generative, but it has a `description` property which is required.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` basically follows the JSON schema\n> specification of OpenAPI v3.1, but a little bit shrunk to remove ambiguous\n> and duplicated expressions of OpenAPI v3.1 for the convenience, clarity,\n> and AI generation.\n> \n> CRITICAL INSTRUCTIONS FOR OPTIMAL AI GENERATION:\n> \n> When creating descriptions for components, types, and properties:\n> \n> 1. ALWAYS refer to and incorporate the description comments from the\n> corresponding Prisma DB schema tables and columns. The descriptions\n> should match the style, level of detail, and terminology used in the\n> Prisma schema.\n> 2. ALL descriptions MUST be organized into MULTIPLE PARAGRAPHS separated by\n> line breaks. Single-paragraph descriptions should be avoided.\n> 3. Descriptions should comprehensively cover:\n> \n> - The purpose and business meaning of the type or property\n> - Relationships to other entities\n> - Validation rules, constraints, and edge cases\n> - Usage context and examples when helpful\n> 4. For each property of an object type, ensure its description reflects the\n> corresponding column description in the Prisma DB schema, maintaining\n> the same level of detail and terminology\n> 5. Descriptions should be so detailed and clear that anyone reading them can\n> fully understand the type or property without needing to reference any\n> other documentation",
292
+ type: "object",
293
+ properties: {
294
+ description: {
295
+ title: "Description about the type",
296
+ description: "Description about the type.\n\nCRITICAL: This description MUST be extensively detailed and MUST\nreference and align with the description comments from the\ncorresponding Prisma DB schema tables and columns.\n\nThe description MUST be organized into MULTIPLE PARAGRAPHS (separated\nby line breaks) based on different aspects of the type:\n\n- The purpose and business meaning of the type\n- Relationships to other entities in the system\n- Validation rules, constraints, and edge cases\n- Usage context and examples when helpful\n\nThis structured approach improves readability and helps readers better\nunderstand the type's various characteristics and use cases. The\ndescription should be so comprehensive that anyone reading it can fully\nunderstand the type without needing to reference other documentation.\n\n> MUST be written in English. Never use other languages.",
297
+ type: "string"
298
+ }
299
+ },
300
+ required: [
301
+ "description"
302
+ ]
303
+ }
304
+ }
305
+ },
306
+ required: [
307
+ "schemas"
308
+ ],
309
+ additionalProperties: false,
310
+ $defs: {}
311
+ },
312
+ description: "Complements missing schema types\n\nThis method fills in schema definitions that are referenced via $ref but\nnot yet defined in the `components.schemas` section. For example, if an API\noperation references `{ \"$ref\": \"#/components/schemas/UserProfile\" }` but\n`UserProfile` type is not defined in `components.schemas`, this method will\nadd the missing schema definition.\n\nThis function is designed to be called via AI function calling mechanism to\nensure the OpenAPI document is complete and all referenced schemas are\nproperly defined.",
313
+ validate: (() => { const _io0 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io1(input.schemas); const _io1 = input => Object.keys(input).every(key => {
314
+ const value = input[key];
315
+ if (undefined === value)
316
+ return true;
317
+ return "object" === typeof value && null !== value && _io2(value);
318
+ }); const _io2 = input => "string" === typeof input.description; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
319
+ path: _path + ".schemas",
320
+ expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
321
+ value: input.schemas
322
+ })) && _vo1(input.schemas, _path + ".schemas", true && _exceptionable) || _report(_exceptionable, {
323
+ path: _path + ".schemas",
324
+ expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
325
+ value: input.schemas
326
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
327
+ const value = input[key];
328
+ if (undefined === value)
329
+ return true;
330
+ return ("object" === typeof value && null !== value || _report(_exceptionable, {
331
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
332
+ expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
333
+ value: value
334
+ })) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
335
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
336
+ expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
337
+ value: value
338
+ });
339
+ }).every(flag => flag)].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.description || _report(_exceptionable, {
340
+ path: _path + ".description",
341
+ expected: "string",
342
+ value: input.description
343
+ })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
344
+ if (false === __is(input)) {
345
+ errors = [];
346
+ _report = __typia_transform__validateReport._validateReport(errors);
347
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
348
+ path: _path + "",
349
+ expected: "IComplementComponentsProps",
350
+ value: input
351
+ })) && _vo0(input, _path + "", true) || _report(true, {
352
+ path: _path + "",
353
+ expected: "IComplementComponentsProps",
354
+ value: input
355
+ }))(input, "$input", true);
356
+ const success = 0 === errors.length;
357
+ return success ? {
358
+ success,
359
+ data: input
360
+ } : {
361
+ success,
362
+ errors,
363
+ data: input
364
+ };
365
+ }
366
+ return {
367
+ success: true,
368
+ data: input
369
+ };
370
+ }; })()
371
+ }
372
+ ]
373
+ },
374
+ claude,
375
+ llama: claude,
376
+ deepseek: claude,
377
+ "3.1": claude,
378
+ "3.0": {
379
+ model: "3.0",
380
+ options: {
381
+ constraint: true,
382
+ recursive: 3,
383
+ separate: null
384
+ },
385
+ functions: [
386
+ {
387
+ name: "complementComponents",
388
+ parameters: {
389
+ type: "object",
390
+ properties: {
391
+ schemas: {
392
+ type: "object",
393
+ properties: {},
394
+ required: [],
395
+ description: "A collection of missing schema definitions that need to be added to the\nOpenAPI document's `components.schemas` section.\n\nThis object contains schema definitions for types that are referenced but\nnot yet defined:\n\n- Key: Schema name (`string`): The name of the schema type that will be\n referenced in $ref statements\n- Value: `AutoBeOpenApi.IJsonSchema` - The complete JSON Schema definition\n for that type\n\nExample structure:\n\n```typescript\n{\n \"UserProfile\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\", \"format\": \"email\" }\n },\n \"required\": [\"id\", \"name\", \"email\"]\n }\n}\n```\n\nEach schema definition follows the JSON Schema specification and will be\ndirectly inserted into the OpenAPI document's components.schemas section,\nmaking them available for $ref references throughout the API\nspecification.\n\n------------------------------\n\nDescription of the current {@link RecordstringAutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Construct a type with a set of properties K of type T",
396
+ additionalProperties: {
397
+ type: "object",
398
+ properties: {
399
+ description: {
400
+ type: "string",
401
+ title: "Description about the type",
402
+ description: "Description about the type.\n\nCRITICAL: This description MUST be extensively detailed and MUST\nreference and align with the description comments from the\ncorresponding Prisma DB schema tables and columns.\n\nThe description MUST be organized into MULTIPLE PARAGRAPHS (separated\nby line breaks) based on different aspects of the type:\n\n- The purpose and business meaning of the type\n- Relationships to other entities in the system\n- Validation rules, constraints, and edge cases\n- Usage context and examples when helpful\n\nThis structured approach improves readability and helps readers better\nunderstand the type's various characteristics and use cases. The\ndescription should be so comprehensive that anyone reading it can fully\nunderstand the type without needing to reference other documentation.\n\n> MUST be written in English. Never use other languages."
403
+ }
404
+ },
405
+ required: [
406
+ "description"
407
+ ],
408
+ description: "Description of the current {@link AutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Descriptive type schema info.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` is a type schema info of the OpenAPI\n> Generative, but it has a `description` property which is required.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` basically follows the JSON schema\n> specification of OpenAPI v3.1, but a little bit shrunk to remove ambiguous\n> and duplicated expressions of OpenAPI v3.1 for the convenience, clarity,\n> and AI generation.\n> \n> CRITICAL INSTRUCTIONS FOR OPTIMAL AI GENERATION:\n> \n> When creating descriptions for components, types, and properties:\n> \n> 1. ALWAYS refer to and incorporate the description comments from the\n> corresponding Prisma DB schema tables and columns. The descriptions\n> should match the style, level of detail, and terminology used in the\n> Prisma schema.\n> 2. ALL descriptions MUST be organized into MULTIPLE PARAGRAPHS separated by\n> line breaks. Single-paragraph descriptions should be avoided.\n> 3. Descriptions should comprehensively cover:\n> \n> - The purpose and business meaning of the type or property\n> - Relationships to other entities\n> - Validation rules, constraints, and edge cases\n> - Usage context and examples when helpful\n> 4. For each property of an object type, ensure its description reflects the\n> corresponding column description in the Prisma DB schema, maintaining\n> the same level of detail and terminology\n> 5. Descriptions should be so detailed and clear that anyone reading them can\n> fully understand the type or property without needing to reference any\n> other documentation",
409
+ additionalProperties: false
410
+ }
411
+ }
412
+ },
413
+ required: [
414
+ "schemas"
415
+ ],
416
+ description: "Current Type: {@link IComplementComponentsProps}",
417
+ additionalProperties: false
418
+ },
419
+ description: "Complements missing schema types\n\nThis method fills in schema definitions that are referenced via $ref but\nnot yet defined in the `components.schemas` section. For example, if an API\noperation references `{ \"$ref\": \"#/components/schemas/UserProfile\" }` but\n`UserProfile` type is not defined in `components.schemas`, this method will\nadd the missing schema definition.\n\nThis function is designed to be called via AI function calling mechanism to\nensure the OpenAPI document is complete and all referenced schemas are\nproperly defined.",
420
+ validate: (() => { const _io0 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io1(input.schemas); const _io1 = input => Object.keys(input).every(key => {
421
+ const value = input[key];
422
+ if (undefined === value)
423
+ return true;
424
+ return "object" === typeof value && null !== value && _io2(value);
425
+ }); const _io2 = input => "string" === typeof input.description; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
426
+ path: _path + ".schemas",
427
+ expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
428
+ value: input.schemas
429
+ })) && _vo1(input.schemas, _path + ".schemas", true && _exceptionable) || _report(_exceptionable, {
430
+ path: _path + ".schemas",
431
+ expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
432
+ value: input.schemas
433
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
434
+ const value = input[key];
435
+ if (undefined === value)
436
+ return true;
437
+ return ("object" === typeof value && null !== value || _report(_exceptionable, {
438
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
439
+ expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
440
+ value: value
441
+ })) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
442
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
443
+ expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
444
+ value: value
445
+ });
446
+ }).every(flag => flag)].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.description || _report(_exceptionable, {
447
+ path: _path + ".description",
448
+ expected: "string",
449
+ value: input.description
450
+ })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
451
+ if (false === __is(input)) {
452
+ errors = [];
453
+ _report = __typia_transform__validateReport._validateReport(errors);
454
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
455
+ path: _path + "",
456
+ expected: "IComplementComponentsProps",
457
+ value: input
458
+ })) && _vo0(input, _path + "", true) || _report(true, {
459
+ path: _path + "",
460
+ expected: "IComplementComponentsProps",
461
+ value: input
462
+ }))(input, "$input", true);
463
+ const success = 0 === errors.length;
464
+ return success ? {
465
+ success,
466
+ data: input
467
+ } : {
468
+ success,
469
+ errors,
470
+ data: input
471
+ };
472
+ }
473
+ return {
474
+ success: true,
475
+ data: input
476
+ };
477
+ }; })()
478
+ }
479
+ ]
480
+ },
481
+ };
482
+ //# sourceMappingURL=orchestrateInterfaceComplement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateInterfaceComplement.js","sourceRoot":"","sources":["../../../src/orchestrate/interface/orchestrateInterfaceComplement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wEAMC;;;AAtBD,yCAAoE;AAEpE,8CAI0B;AAC1B,2FAAwF;AAExF,kDAA0B;AAI1B,uEAAoE;AACpE,+EAA4E;AAE5E,SAAgB,8BAA8B,CAC5C,GAAyB,EACzB,QAAiC,EACjC,QAAgB,CAAC;IAEjB,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,SAAe,IAAI,CACjB,GAAyB,EACzB,QAAiC,EACj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