promptopskit 0.3.7 → 0.3.9

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 (69) hide show
  1. package/README.md +37 -11
  2. package/SKILL.md +26 -3
  3. package/dist/{chunk-IXPIBZXT.js → chunk-4LEPCCSA.js} +60 -8
  4. package/dist/chunk-4LEPCCSA.js.map +1 -0
  5. package/dist/{chunk-5TLHYSP7.js → chunk-AN3OR7YC.js} +26 -3
  6. package/dist/chunk-AN3OR7YC.js.map +1 -0
  7. package/dist/{chunk-QPOHKVY5.js → chunk-LMURMZUA.js} +22 -3
  8. package/dist/chunk-LMURMZUA.js.map +1 -0
  9. package/dist/{chunk-KFSP5KN4.js → chunk-O6RQZYS4.js} +49 -7
  10. package/dist/chunk-O6RQZYS4.js.map +1 -0
  11. package/dist/{chunk-6XKV4YVK.js → chunk-V7QY7MRM.js} +85 -8
  12. package/dist/chunk-V7QY7MRM.js.map +1 -0
  13. package/dist/{chunk-DGLLQ3FR.js → chunk-YAD6COQX.js} +3 -3
  14. package/dist/chunk-YNIAA4ZJ.js +111 -0
  15. package/dist/chunk-YNIAA4ZJ.js.map +1 -0
  16. package/dist/cli/index.js +95 -11
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/index.cjs +354 -26
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +9 -5
  21. package/dist/index.d.ts +9 -5
  22. package/dist/index.js +28 -12
  23. package/dist/index.js.map +1 -1
  24. package/dist/providers/anthropic.cjs +189 -18
  25. package/dist/providers/anthropic.cjs.map +1 -1
  26. package/dist/providers/anthropic.d.cts +2 -2
  27. package/dist/providers/anthropic.d.ts +2 -2
  28. package/dist/providers/anthropic.js +3 -3
  29. package/dist/providers/gemini.cjs +166 -14
  30. package/dist/providers/gemini.cjs.map +1 -1
  31. package/dist/providers/gemini.d.cts +2 -2
  32. package/dist/providers/gemini.d.ts +2 -2
  33. package/dist/providers/gemini.js +3 -3
  34. package/dist/providers/openai-responses.cjs +1059 -0
  35. package/dist/providers/openai-responses.cjs.map +1 -0
  36. package/dist/providers/openai-responses.d.cts +11 -0
  37. package/dist/providers/openai-responses.d.ts +11 -0
  38. package/dist/providers/openai-responses.js +9 -0
  39. package/dist/providers/openai-responses.js.map +1 -0
  40. package/dist/providers/openai.cjs +162 -14
  41. package/dist/providers/openai.cjs.map +1 -1
  42. package/dist/providers/openai.d.cts +2 -2
  43. package/dist/providers/openai.d.ts +2 -2
  44. package/dist/providers/openai.js +3 -3
  45. package/dist/providers/openrouter.cjs +162 -14
  46. package/dist/providers/openrouter.cjs.map +1 -1
  47. package/dist/providers/openrouter.d.cts +2 -2
  48. package/dist/providers/openrouter.d.ts +2 -2
  49. package/dist/providers/openrouter.js +4 -4
  50. package/dist/schema-BKkg93rL.d.cts +1923 -0
  51. package/dist/schema-BKkg93rL.d.ts +1923 -0
  52. package/dist/testing.cjs +59 -7
  53. package/dist/testing.cjs.map +1 -1
  54. package/dist/testing.d.cts +1 -1
  55. package/dist/testing.d.ts +1 -1
  56. package/dist/testing.js +1 -1
  57. package/dist/{types-7U58bgVW.d.cts → types-7cC17GWp.d.cts} +24 -5
  58. package/dist/{types-HnZ46u5Q.d.ts → types-CsQ8tON_.d.ts} +24 -5
  59. package/dist/usagetap/index.d.cts +2 -2
  60. package/dist/usagetap/index.d.ts +2 -2
  61. package/package.json +11 -1
  62. package/dist/chunk-5TLHYSP7.js.map +0 -1
  63. package/dist/chunk-6XKV4YVK.js.map +0 -1
  64. package/dist/chunk-IXPIBZXT.js.map +0 -1
  65. package/dist/chunk-KFSP5KN4.js.map +0 -1
  66. package/dist/chunk-QPOHKVY5.js.map +0 -1
  67. package/dist/schema-Bgoff-CN.d.cts +0 -805
  68. package/dist/schema-Bgoff-CN.d.ts +0 -805
  69. /package/dist/{chunk-DGLLQ3FR.js.map → chunk-YAD6COQX.js.map} +0 -0
@@ -0,0 +1,1059 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/providers/openai-responses.ts
31
+ var openai_responses_exports = {};
32
+ __export(openai_responses_exports, {
33
+ openaiResponsesAdapter: () => openaiResponsesAdapter
34
+ });
35
+ module.exports = __toCommonJS(openai_responses_exports);
36
+
37
+ // src/renderer/interpolate.ts
38
+ var VARIABLE_RE = /\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
39
+ var ESCAPED_OPEN = /\\\{\\\{/g;
40
+ var ESCAPE_PLACEHOLDER = "\0ESCAPED_OPEN\0";
41
+ function interpolate(template, variables, options = {}) {
42
+ const { strict = false } = options;
43
+ let result = template.replace(ESCAPED_OPEN, ESCAPE_PLACEHOLDER);
44
+ result = result.replace(VARIABLE_RE, (match, name) => {
45
+ if (name in variables) {
46
+ return variables[name];
47
+ }
48
+ if (strict) {
49
+ throw new Error(`Missing required variable: "${name}"`);
50
+ }
51
+ return match;
52
+ });
53
+ result = result.replaceAll(ESCAPE_PLACEHOLDER, "{{");
54
+ return result;
55
+ }
56
+
57
+ // src/renderer/renderer.ts
58
+ function renderSections(asset, options = {}) {
59
+ const { variables = {}, strict = false } = options;
60
+ const result = {};
61
+ if (asset.sections.system_instructions) {
62
+ result.system_instructions = interpolate(
63
+ asset.sections.system_instructions,
64
+ variables,
65
+ { strict }
66
+ );
67
+ }
68
+ if (asset.sections.prompt_template) {
69
+ result.prompt_template = interpolate(
70
+ asset.sections.prompt_template,
71
+ variables,
72
+ { strict }
73
+ );
74
+ }
75
+ return result;
76
+ }
77
+
78
+ // src/overrides/apply-overrides.ts
79
+ function applyOverrides(asset, options = {}) {
80
+ let result = { ...asset };
81
+ if (options.environment && result.environments?.[options.environment]) {
82
+ result = mergeOverride(result, result.environments[options.environment]);
83
+ }
84
+ if (options.tier && result.tiers?.[options.tier]) {
85
+ result = mergeOverride(result, result.tiers[options.tier]);
86
+ }
87
+ if (options.runtime) {
88
+ result = mergeOverride(result, options.runtime);
89
+ }
90
+ return result;
91
+ }
92
+ function mergeOverride(base, override) {
93
+ const result = { ...base };
94
+ if (override.model !== void 0) result.model = override.model;
95
+ if (override.fallback_models !== void 0) result.fallback_models = override.fallback_models;
96
+ if (override.tools !== void 0) result.tools = override.tools;
97
+ if (override.reasoning !== void 0) {
98
+ result.reasoning = { ...result.reasoning, ...override.reasoning };
99
+ }
100
+ if (override.sampling !== void 0) {
101
+ result.sampling = { ...result.sampling, ...override.sampling };
102
+ }
103
+ if (override.response !== void 0) {
104
+ result.response = { ...result.response, ...override.response };
105
+ }
106
+ if (override.provider_options !== void 0) {
107
+ result.provider_options = {
108
+ ...result.provider_options,
109
+ ...override.provider_options,
110
+ anthropic: {
111
+ ...result.provider_options?.anthropic,
112
+ ...override.provider_options.anthropic
113
+ },
114
+ gemini: {
115
+ ...result.provider_options?.gemini,
116
+ ...override.provider_options.gemini
117
+ }
118
+ };
119
+ }
120
+ return result;
121
+ }
122
+
123
+ // src/providers/resolve-asset.ts
124
+ function resolveAssetForProvider(asset, runtime = {}) {
125
+ if (!runtime.environment && !runtime.tier && !runtime.runtime) {
126
+ return asset;
127
+ }
128
+ return applyOverrides(asset, {
129
+ environment: runtime.environment,
130
+ tier: runtime.tier,
131
+ runtime: runtime.runtime
132
+ });
133
+ }
134
+
135
+ // src/prompt-resolution.ts
136
+ var import_promises3 = require("fs/promises");
137
+ var import_node_fs2 = require("fs");
138
+ var import_node_path3 = require("path");
139
+
140
+ // src/cache.ts
141
+ var import_node_fs = require("fs");
142
+ var PromptCache = class {
143
+ cache = /* @__PURE__ */ new Map();
144
+ maxSize;
145
+ constructor(maxSize = 100) {
146
+ this.maxSize = maxSize;
147
+ }
148
+ get(filePath) {
149
+ const entry = this.cache.get(filePath);
150
+ if (!entry) return void 0;
151
+ try {
152
+ const stat = (0, import_node_fs.statSync)(filePath);
153
+ if (stat.mtimeMs !== entry.mtime) {
154
+ this.cache.delete(filePath);
155
+ return void 0;
156
+ }
157
+ } catch {
158
+ this.cache.delete(filePath);
159
+ return void 0;
160
+ }
161
+ this.cache.delete(filePath);
162
+ this.cache.set(filePath, entry);
163
+ return entry.value;
164
+ }
165
+ set(filePath, value) {
166
+ try {
167
+ const stat = (0, import_node_fs.statSync)(filePath);
168
+ if (this.cache.has(filePath)) {
169
+ this.cache.delete(filePath);
170
+ } else if (this.cache.size >= this.maxSize) {
171
+ const oldest = this.cache.keys().next().value;
172
+ if (oldest) this.cache.delete(oldest);
173
+ }
174
+ this.cache.set(filePath, { value, mtime: stat.mtimeMs });
175
+ } catch {
176
+ }
177
+ }
178
+ clear() {
179
+ this.cache.clear();
180
+ }
181
+ get size() {
182
+ return this.cache.size;
183
+ }
184
+ };
185
+
186
+ // src/composition/resolve-includes.ts
187
+ var import_promises2 = require("fs/promises");
188
+ var import_node_path2 = require("path");
189
+
190
+ // src/parser/parser.ts
191
+ var import_gray_matter = __toESM(require("gray-matter"), 1);
192
+
193
+ // src/schema/schema.ts
194
+ var import_zod = require("zod");
195
+ var InlineToolDefSchema = import_zod.z.object({
196
+ name: import_zod.z.string(),
197
+ description: import_zod.z.string().optional(),
198
+ input_schema: import_zod.z.record(import_zod.z.unknown()).optional()
199
+ });
200
+ var ToolRefSchema = import_zod.z.union([import_zod.z.string(), InlineToolDefSchema]);
201
+ var MCPServerRefSchema = import_zod.z.union([
202
+ import_zod.z.string(),
203
+ import_zod.z.object({
204
+ name: import_zod.z.string(),
205
+ config: import_zod.z.record(import_zod.z.unknown()).optional()
206
+ })
207
+ ]);
208
+ var ReasoningSchema = import_zod.z.object({
209
+ effort: import_zod.z.enum(["low", "medium", "high"]).optional(),
210
+ budget_tokens: import_zod.z.number().int().positive().optional()
211
+ });
212
+ var SamplingSchema = import_zod.z.object({
213
+ temperature: import_zod.z.number().min(0).max(2).optional(),
214
+ top_p: import_zod.z.number().min(0).max(1).optional(),
215
+ frequency_penalty: import_zod.z.number().optional(),
216
+ presence_penalty: import_zod.z.number().optional(),
217
+ stop: import_zod.z.array(import_zod.z.string()).optional(),
218
+ max_output_tokens: import_zod.z.number().int().positive().optional()
219
+ });
220
+ var ResponseSchema = import_zod.z.object({
221
+ format: import_zod.z.enum(["text", "json", "markdown"]).optional(),
222
+ stream: import_zod.z.boolean().optional(),
223
+ schema: import_zod.z.record(import_zod.z.unknown()).optional(),
224
+ schema_name: import_zod.z.string().optional(),
225
+ schema_strict: import_zod.z.boolean().optional()
226
+ });
227
+ var AnthropicProviderOptionsSchema = import_zod.z.object({
228
+ top_k: import_zod.z.number().int().min(0).optional(),
229
+ tool_choice: import_zod.z.record(import_zod.z.unknown()).optional()
230
+ });
231
+ var GeminiProviderOptionsSchema = import_zod.z.object({
232
+ candidate_count: import_zod.z.number().int().positive().optional(),
233
+ top_k: import_zod.z.number().int().min(0).optional(),
234
+ seed: import_zod.z.number().int().optional(),
235
+ response_schema: import_zod.z.record(import_zod.z.unknown()).optional(),
236
+ response_modalities: import_zod.z.array(import_zod.z.string()).optional(),
237
+ thinking_budget_tokens: import_zod.z.number().int().positive().optional()
238
+ });
239
+ var ProviderOptionsSchema = import_zod.z.object({
240
+ anthropic: AnthropicProviderOptionsSchema.optional(),
241
+ gemini: GeminiProviderOptionsSchema.optional()
242
+ });
243
+ var OpenAICacheSchema = import_zod.z.object({
244
+ prompt_cache_key: import_zod.z.string().min(1).optional(),
245
+ retention: import_zod.z.enum(["in_memory", "24h"]).optional()
246
+ });
247
+ var AnthropicCacheSchema = import_zod.z.object({
248
+ mode: import_zod.z.enum(["automatic", "explicit"]).optional(),
249
+ type: import_zod.z.literal("ephemeral").optional(),
250
+ ttl: import_zod.z.enum(["5m", "1h"]).optional(),
251
+ cache_system_instructions: import_zod.z.boolean().optional(),
252
+ cache_tools: import_zod.z.boolean().optional(),
253
+ cache_prompt_template: import_zod.z.boolean().optional()
254
+ });
255
+ var GeminiCacheSchema = import_zod.z.object({
256
+ cached_content: import_zod.z.string().min(1).optional()
257
+ });
258
+ var CacheSchema = import_zod.z.object({
259
+ openai: OpenAICacheSchema.optional(),
260
+ anthropic: AnthropicCacheSchema.optional(),
261
+ gemini: GeminiCacheSchema.optional(),
262
+ google: GeminiCacheSchema.optional()
263
+ });
264
+ var HistorySchema = import_zod.z.object({
265
+ max_items: import_zod.z.number().int().positive().optional()
266
+ });
267
+ var ContextRegexSchema = import_zod.z.union([
268
+ import_zod.z.string(),
269
+ import_zod.z.object({
270
+ pattern: import_zod.z.string(),
271
+ flags: import_zod.z.string().optional(),
272
+ return_message: import_zod.z.string().optional()
273
+ })
274
+ ]);
275
+ var ContextBuiltInValidatorSchema = import_zod.z.union([
276
+ import_zod.z.boolean(),
277
+ import_zod.z.object({
278
+ return_message: import_zod.z.string().optional()
279
+ })
280
+ ]);
281
+ var ContextInputDefinitionObjectSchema = import_zod.z.object({
282
+ name: import_zod.z.string(),
283
+ max_size: import_zod.z.number().int().positive().optional(),
284
+ trim: import_zod.z.union([import_zod.z.boolean(), import_zod.z.enum(["start", "end", "both"])]).optional(),
285
+ allow_regex: ContextRegexSchema.optional(),
286
+ deny_regex: ContextRegexSchema.optional(),
287
+ non_empty: ContextBuiltInValidatorSchema.optional(),
288
+ reject_secrets: ContextBuiltInValidatorSchema.optional()
289
+ });
290
+ var ContextInputDefinitionSchema = import_zod.z.union([
291
+ import_zod.z.string(),
292
+ ContextInputDefinitionObjectSchema
293
+ ]);
294
+ var ContextSchema = import_zod.z.object({
295
+ inputs: import_zod.z.array(ContextInputDefinitionSchema).optional(),
296
+ history: HistorySchema.optional()
297
+ });
298
+ var MetadataSchema = import_zod.z.object({
299
+ owner: import_zod.z.string().optional(),
300
+ tags: import_zod.z.array(import_zod.z.string()).optional(),
301
+ review_required: import_zod.z.boolean().optional(),
302
+ stable: import_zod.z.boolean().optional()
303
+ });
304
+ var MCPSchema = import_zod.z.object({
305
+ servers: import_zod.z.array(MCPServerRefSchema).optional()
306
+ });
307
+ var PromptAssetOverridesSchema = import_zod.z.object({
308
+ model: import_zod.z.string().optional(),
309
+ fallback_models: import_zod.z.array(import_zod.z.string()).optional(),
310
+ reasoning: ReasoningSchema.optional(),
311
+ sampling: SamplingSchema.optional(),
312
+ response: ResponseSchema.optional(),
313
+ cache: CacheSchema.optional(),
314
+ tools: import_zod.z.array(ToolRefSchema).optional(),
315
+ provider_options: ProviderOptionsSchema.optional()
316
+ });
317
+ var SourceSchema = import_zod.z.object({
318
+ file_path: import_zod.z.string().optional(),
319
+ checksum: import_zod.z.string().optional()
320
+ });
321
+ var SectionsSchema = import_zod.z.object({
322
+ system_instructions: import_zod.z.string().optional(),
323
+ prompt_template: import_zod.z.string().optional(),
324
+ notes: import_zod.z.string().optional()
325
+ });
326
+ var PromptDefaultsSchema = import_zod.z.object({
327
+ provider: import_zod.z.enum(["openai", "openai-responses", "anthropic", "google", "gemini", "openrouter", "any"]).optional(),
328
+ model: import_zod.z.string().optional(),
329
+ cache: CacheSchema.optional(),
330
+ metadata: MetadataSchema.optional(),
331
+ sections: import_zod.z.object({
332
+ system_instructions: import_zod.z.string().optional()
333
+ }).optional()
334
+ });
335
+ var PromptAssetSchema = import_zod.z.object({
336
+ id: import_zod.z.string(),
337
+ schema_version: import_zod.z.number().int().positive().default(1),
338
+ description: import_zod.z.string().optional(),
339
+ provider: import_zod.z.enum(["openai", "openai-responses", "anthropic", "google", "gemini", "openrouter", "any"]).optional(),
340
+ model: import_zod.z.string().optional(),
341
+ fallback_models: import_zod.z.array(import_zod.z.string()).optional(),
342
+ reasoning: ReasoningSchema.optional(),
343
+ sampling: SamplingSchema.optional(),
344
+ response: ResponseSchema.optional(),
345
+ cache: CacheSchema.optional(),
346
+ tools: import_zod.z.array(ToolRefSchema).optional(),
347
+ provider_options: ProviderOptionsSchema.optional(),
348
+ mcp: MCPSchema.optional(),
349
+ context: ContextSchema.optional(),
350
+ includes: import_zod.z.array(import_zod.z.string()).optional(),
351
+ environments: import_zod.z.record(PromptAssetOverridesSchema).optional(),
352
+ tiers: import_zod.z.record(PromptAssetOverridesSchema).optional(),
353
+ metadata: MetadataSchema.optional(),
354
+ // Populated by parser, not authored in YAML
355
+ sections: SectionsSchema.optional(),
356
+ source: SourceSchema.optional()
357
+ });
358
+
359
+ // src/parser/sections.ts
360
+ var SECTION_MAP = {
361
+ "system instructions": "system_instructions",
362
+ "prompt template": "prompt_template",
363
+ "notes": "notes"
364
+ };
365
+ function extractSections(body) {
366
+ const lines = body.split(/\r?\n/);
367
+ const sections = {};
368
+ let currentKey = null;
369
+ let currentLines = [];
370
+ let foundAnyH1 = false;
371
+ for (const line of lines) {
372
+ const h1Match = line.match(/^#\s+(.+)$/);
373
+ if (h1Match) {
374
+ if (currentKey) {
375
+ sections[currentKey] = currentLines.join("\n").trim();
376
+ }
377
+ foundAnyH1 = true;
378
+ const heading = h1Match[1].trim().toLowerCase();
379
+ currentKey = SECTION_MAP[heading] ?? null;
380
+ currentLines = [];
381
+ } else {
382
+ currentLines.push(line);
383
+ }
384
+ }
385
+ if (currentKey) {
386
+ sections[currentKey] = currentLines.join("\n").trim();
387
+ }
388
+ if (!foundAnyH1) {
389
+ const trimmed = body.trim();
390
+ if (trimmed) {
391
+ sections.prompt_template = trimmed;
392
+ }
393
+ }
394
+ return sections;
395
+ }
396
+
397
+ // src/parser/parser.ts
398
+ function parsePrompt(content, filePath) {
399
+ const { data: frontMatter, content: body } = (0, import_gray_matter.default)(content);
400
+ const sections = extractSections(body);
401
+ const raw = {
402
+ ...frontMatter,
403
+ sections,
404
+ source: filePath ? { file_path: filePath } : void 0
405
+ };
406
+ const asset = PromptAssetSchema.parse(raw);
407
+ return {
408
+ asset,
409
+ raw: {
410
+ frontMatter,
411
+ body
412
+ }
413
+ };
414
+ }
415
+
416
+ // src/parser/loader.ts
417
+ var import_promises = require("fs/promises");
418
+ var import_node_path = require("path");
419
+ var import_gray_matter2 = __toESM(require("gray-matter"), 1);
420
+ var DEFAULTS_FILE_NAME = "defaults.md";
421
+ async function loadPromptFile(filePath, options = {}) {
422
+ const content = await (0, import_promises.readFile)(filePath, "utf-8");
423
+ const parsed = parsePrompt(content, filePath);
424
+ const root = options.defaultsRoot ?? (0, import_node_path.dirname)(filePath);
425
+ const defaults = await loadDefaultsForPath(filePath, root);
426
+ const asset = applyDefaults(parsed.asset, defaults);
427
+ return {
428
+ ...parsed,
429
+ asset
430
+ };
431
+ }
432
+ async function loadDefaultsForPath(filePath, defaultsRoot) {
433
+ const directories = getDirectoriesToCheck(filePath, defaultsRoot);
434
+ let merged = {};
435
+ for (const dir of directories) {
436
+ const defaultsPath = (0, import_node_path.join)(dir, DEFAULTS_FILE_NAME);
437
+ try {
438
+ const defaultsContent = await (0, import_promises.readFile)(defaultsPath, "utf-8");
439
+ const defaults = parseDefaults(defaultsContent);
440
+ merged = mergeDefaults(merged, defaults);
441
+ } catch (error) {
442
+ if (error.code !== "ENOENT") {
443
+ throw error;
444
+ }
445
+ }
446
+ }
447
+ return merged;
448
+ }
449
+ function getDirectoriesToCheck(filePath, defaultsRoot) {
450
+ const dirs = [];
451
+ let current = (0, import_node_path.resolve)((0, import_node_path.dirname)(filePath));
452
+ const boundary = defaultsRoot ? (0, import_node_path.resolve)(defaultsRoot) : void 0;
453
+ while (true) {
454
+ dirs.unshift(current);
455
+ if (boundary && current === boundary || current === (0, import_node_path.dirname)(current)) {
456
+ break;
457
+ }
458
+ current = (0, import_node_path.dirname)(current);
459
+ }
460
+ return dirs;
461
+ }
462
+ function parseDefaults(content) {
463
+ const { data: frontMatter, content: body } = (0, import_gray_matter2.default)(content);
464
+ const sections = extractSections(body);
465
+ return PromptDefaultsSchema.parse({
466
+ ...frontMatter,
467
+ sections: {
468
+ system_instructions: sections.system_instructions
469
+ }
470
+ });
471
+ }
472
+ function mergeDefaults(base, local) {
473
+ return {
474
+ provider: local.provider ?? base.provider,
475
+ model: local.model ?? base.model,
476
+ metadata: {
477
+ ...base.metadata ?? {},
478
+ ...local.metadata ?? {}
479
+ },
480
+ sections: {
481
+ ...base.sections ?? {},
482
+ ...local.sections ?? {}
483
+ }
484
+ };
485
+ }
486
+ function applyDefaults(asset, defaults) {
487
+ const hasDefaultMetadata = defaults.metadata && Object.keys(defaults.metadata).length > 0;
488
+ const hasDefaultSystem = !!defaults.sections?.system_instructions;
489
+ const hasDefaultScalars = defaults.provider !== void 0 || defaults.model !== void 0;
490
+ if (!hasDefaultMetadata && !hasDefaultSystem && !hasDefaultScalars) {
491
+ return asset;
492
+ }
493
+ const mergedMetadata = {
494
+ ...defaults.metadata ?? {},
495
+ ...asset.metadata ?? {}
496
+ };
497
+ const metadata = Object.keys(mergedMetadata).length > 0 ? mergedMetadata : void 0;
498
+ const systemInstructions = asset.sections?.system_instructions ?? defaults.sections?.system_instructions;
499
+ const sections = asset.sections ? { ...asset.sections, system_instructions: systemInstructions } : systemInstructions ? { system_instructions: systemInstructions } : void 0;
500
+ return {
501
+ ...asset,
502
+ provider: asset.provider ?? defaults.provider,
503
+ model: asset.model ?? defaults.model,
504
+ metadata,
505
+ sections
506
+ };
507
+ }
508
+
509
+ // src/composition/resolve-includes.ts
510
+ async function resolveIncludes(asset, basePath, visited = /* @__PURE__ */ new Set()) {
511
+ if (!asset.includes || asset.includes.length === 0) {
512
+ return asset;
513
+ }
514
+ const baseDir = (0, import_node_path2.dirname)(basePath);
515
+ const resolvedPath = (0, import_node_path2.resolve)(basePath);
516
+ if (visited.has(resolvedPath)) {
517
+ throw new Error(`Circular include detected: ${resolvedPath}`);
518
+ }
519
+ visited.add(resolvedPath);
520
+ let mergedSystemInstructions = "";
521
+ for (const includePath of asset.includes) {
522
+ const fullPath = (0, import_node_path2.resolve)(baseDir, includePath);
523
+ if (visited.has(fullPath)) {
524
+ throw new Error(`Circular include detected: ${fullPath} (included from ${basePath})`);
525
+ }
526
+ const content = await (0, import_promises2.readFile)(fullPath, "utf-8");
527
+ const { asset: includedAsset } = parsePrompt(content, fullPath);
528
+ const resolved = await resolveIncludes(includedAsset, fullPath, new Set(visited));
529
+ if (resolved.sections?.system_instructions) {
530
+ mergedSystemInstructions += resolved.sections.system_instructions + "\n\n";
531
+ }
532
+ }
533
+ const localSystem = asset.sections?.system_instructions ?? "";
534
+ const combinedSystem = (mergedSystemInstructions + localSystem).trim() || void 0;
535
+ return {
536
+ ...asset,
537
+ sections: {
538
+ ...asset.sections,
539
+ system_instructions: combinedSystem
540
+ },
541
+ // Drop includes from the resolved asset — they've been inlined
542
+ includes: void 0
543
+ };
544
+ }
545
+
546
+ // src/prompt-resolution.ts
547
+ var DEFAULT_PROMPTS_DIR = "./prompts";
548
+ var DEFAULT_COMPILED_JSON_DIR = "./.generated-prompts/json";
549
+ function withPromptResolutionDefaults(config) {
550
+ return {
551
+ ...config,
552
+ sourceDir: config.sourceDir ?? DEFAULT_PROMPTS_DIR,
553
+ compiledDir: config.compiledDir ?? DEFAULT_COMPILED_JSON_DIR
554
+ };
555
+ }
556
+ var sharedPromptCache = new PromptCache();
557
+ async function loadPromptAsset(promptPath, config, promptCache = sharedPromptCache) {
558
+ const resolvedConfig = withPromptResolutionDefaults(config);
559
+ const mode = resolvedConfig.mode ?? "auto";
560
+ if (mode !== "source-only" && resolvedConfig.compiledDir) {
561
+ const compiledFile = (0, import_node_path3.resolve)(resolvedConfig.compiledDir, promptPath + ".json");
562
+ if ((0, import_node_fs2.existsSync)(compiledFile)) {
563
+ if (mode === "auto") {
564
+ const sourceFile = (0, import_node_path3.resolve)(resolvedConfig.sourceDir, promptPath + ".md");
565
+ if ((0, import_node_fs2.existsSync)(sourceFile)) {
566
+ const compiledMtime = (0, import_node_fs2.statSync)(compiledFile).mtimeMs;
567
+ const sourceMtime = (0, import_node_fs2.statSync)(sourceFile).mtimeMs;
568
+ if (sourceMtime > compiledMtime) {
569
+ console.warn(
570
+ `[promptopskit] Warning: compiled artifact for "${promptPath}" is older than source .md file.
571
+ Run "promptopskit compile" or switch to source-only mode.`
572
+ );
573
+ }
574
+ }
575
+ }
576
+ const content = await (0, import_promises3.readFile)(compiledFile, "utf-8");
577
+ return JSON.parse(content);
578
+ }
579
+ if (mode === "compiled-only") {
580
+ throw new Error(
581
+ `Compiled artifact not found: ${compiledFile}
582
+ Run "promptopskit compile" to generate it.`
583
+ );
584
+ }
585
+ }
586
+ if (mode !== "compiled-only") {
587
+ const sourceFile = (0, import_node_path3.resolve)(resolvedConfig.sourceDir, promptPath + ".md");
588
+ if (resolvedConfig.cache !== false) {
589
+ const cached = promptCache.get(sourceFile);
590
+ if (cached) {
591
+ return cached;
592
+ }
593
+ }
594
+ if (!(0, import_node_fs2.existsSync)(sourceFile)) {
595
+ const paths = [sourceFile];
596
+ if (resolvedConfig.compiledDir) {
597
+ paths.unshift((0, import_node_path3.resolve)(resolvedConfig.compiledDir, promptPath + ".json"));
598
+ }
599
+ throw new Error(
600
+ `Prompt not found: "${promptPath}"
601
+ Searched:
602
+ ${paths.map((candidate) => ` - ${candidate}`).join("\n")}`
603
+ );
604
+ }
605
+ const { asset } = await loadPromptFile(sourceFile, { defaultsRoot: resolvedConfig.sourceDir });
606
+ if (resolvedConfig.cache !== false) {
607
+ promptCache.set(sourceFile, asset);
608
+ }
609
+ return asset;
610
+ }
611
+ throw new Error(`Prompt not found: "${promptPath}"`);
612
+ }
613
+ async function resolvePromptAsset(promptPath, config, options = {}, promptCache = sharedPromptCache) {
614
+ const resolvedConfig = withPromptResolutionDefaults(config);
615
+ let asset = await loadPromptAsset(promptPath, resolvedConfig, promptCache);
616
+ const sourceFile = (0, import_node_path3.resolve)(resolvedConfig.sourceDir, promptPath + ".md");
617
+ if (asset.includes && asset.includes.length > 0 && (0, import_node_fs2.existsSync)(sourceFile)) {
618
+ asset = await resolveIncludes(asset, sourceFile);
619
+ }
620
+ asset = applyOverrides(asset, {
621
+ environment: options.environment,
622
+ tier: options.tier,
623
+ runtime: options.runtime
624
+ });
625
+ return asset;
626
+ }
627
+ function resolveInlinePromptSource(source, options = {}) {
628
+ const { asset } = parsePrompt(source);
629
+ return applyOverrides(asset, {
630
+ environment: options.environment,
631
+ tier: options.tier,
632
+ runtime: options.runtime
633
+ });
634
+ }
635
+
636
+ // src/context.ts
637
+ var textEncoder = new TextEncoder();
638
+ var REJECT_SECRETS_PATTERN = "(secret|api[_-]?key|password)";
639
+ var REJECT_SECRETS_FLAGS = "i";
640
+ function getContextInputs(asset) {
641
+ return (asset.context?.inputs ?? []).map(normalizeContextInput);
642
+ }
643
+ function normalizeContextInput(input) {
644
+ if (typeof input === "string") {
645
+ return { name: input };
646
+ }
647
+ return {
648
+ name: input.name,
649
+ max_size: input.max_size,
650
+ trim: input.trim,
651
+ allow_regex: normalizeContextRegex(input.allow_regex),
652
+ deny_regex: normalizeContextRegex(input.deny_regex),
653
+ non_empty: normalizeBuiltInValidator(input.non_empty),
654
+ reject_secrets: normalizeBuiltInValidator(input.reject_secrets)
655
+ };
656
+ }
657
+ function normalizeContextRegex(value) {
658
+ if (value === void 0) {
659
+ return void 0;
660
+ }
661
+ if (typeof value === "string") {
662
+ const literal = parseRegexLiteral(value);
663
+ if (value.startsWith("/") && !literal) {
664
+ return {
665
+ pattern: value,
666
+ flags: "",
667
+ raw: value,
668
+ invalidLiteral: true
669
+ };
670
+ }
671
+ return {
672
+ pattern: literal?.pattern ?? value,
673
+ flags: literal?.flags ?? "",
674
+ raw: value
675
+ };
676
+ }
677
+ return {
678
+ pattern: value.pattern,
679
+ flags: value.flags ?? "",
680
+ raw: JSON.stringify(value),
681
+ returnMessage: value.return_message
682
+ };
683
+ }
684
+ function normalizeBuiltInValidator(value) {
685
+ if (value === void 0 || value === false) {
686
+ return void 0;
687
+ }
688
+ if (value === true) {
689
+ return {};
690
+ }
691
+ return {
692
+ returnMessage: value.return_message
693
+ };
694
+ }
695
+ function parseRegexLiteral(value) {
696
+ if (!value.startsWith("/")) {
697
+ return void 0;
698
+ }
699
+ for (let index = value.length - 1; index > 0; index -= 1) {
700
+ if (value[index] !== "/") {
701
+ continue;
702
+ }
703
+ let backslashCount = 0;
704
+ for (let cursor = index - 1; cursor >= 0 && value[cursor] === "\\"; cursor -= 1) {
705
+ backslashCount += 1;
706
+ }
707
+ if (backslashCount % 2 === 1) {
708
+ continue;
709
+ }
710
+ return {
711
+ pattern: value.slice(1, index),
712
+ flags: value.slice(index + 1)
713
+ };
714
+ }
715
+ return void 0;
716
+ }
717
+ function formatInvalidContextRegexMessage(details) {
718
+ return [
719
+ `Invalid context regex for prompt "${details.promptId}"`,
720
+ `variable "${details.variable}"`,
721
+ `field "${details.field}"`,
722
+ `value ${JSON.stringify(details.raw)}: ${details.reason}`
723
+ ].join(", ");
724
+ }
725
+ function compileContextRegex(regex, details) {
726
+ if (regex.invalidLiteral) {
727
+ throw new Error(
728
+ `POK013: ${formatInvalidContextRegexMessage({
729
+ ...details,
730
+ raw: regex.raw,
731
+ reason: "Malformed regex literal. Use /pattern/flags or { pattern, flags }."
732
+ })}`
733
+ );
734
+ }
735
+ try {
736
+ return new RegExp(regex.pattern, regex.flags);
737
+ } catch (error) {
738
+ const reason = error instanceof Error ? error.message : String(error);
739
+ throw new Error(`POK013: ${formatInvalidContextRegexMessage({ ...details, raw: regex.raw, reason })}`);
740
+ }
741
+ }
742
+ function getRejectSecretsRegex() {
743
+ return {
744
+ pattern: REJECT_SECRETS_PATTERN,
745
+ flags: REJECT_SECRETS_FLAGS,
746
+ raw: JSON.stringify({ pattern: REJECT_SECRETS_PATTERN, flags: REJECT_SECRETS_FLAGS })
747
+ };
748
+ }
749
+ function isTrimEnabled(mode) {
750
+ return mode === true || mode === "start" || mode === "end" || mode === "both";
751
+ }
752
+ function normalizeTrimMode(mode) {
753
+ if (mode === "start") {
754
+ return "start";
755
+ }
756
+ return "end";
757
+ }
758
+ function trimToMaxSize(value, maxSize, mode) {
759
+ const measured = measureContextValueSize(value);
760
+ if (measured <= maxSize) {
761
+ return value;
762
+ }
763
+ const characters = Array.from(value);
764
+ const normalizedMode = normalizeTrimMode(mode);
765
+ if (normalizedMode === "start") {
766
+ let collected2 = "";
767
+ let size2 = 0;
768
+ for (let i = characters.length - 1; i >= 0; i -= 1) {
769
+ const next = characters[i];
770
+ const charSize = measureContextValueSize(next);
771
+ if (size2 + charSize > maxSize) {
772
+ break;
773
+ }
774
+ collected2 = next + collected2;
775
+ size2 += charSize;
776
+ }
777
+ return collected2;
778
+ }
779
+ let collected = "";
780
+ let size = 0;
781
+ for (const char of characters) {
782
+ const charSize = measureContextValueSize(char);
783
+ if (size + charSize > maxSize) {
784
+ break;
785
+ }
786
+ collected += char;
787
+ size += charSize;
788
+ }
789
+ return collected;
790
+ }
791
+ function sanitizeContextVariables(asset, variables = {}, options = {}) {
792
+ const { onContextOverflow } = options;
793
+ const sanitized = { ...variables };
794
+ for (const input of getContextInputs(asset)) {
795
+ const value = sanitized[input.name];
796
+ if (value === void 0) {
797
+ continue;
798
+ }
799
+ let candidate = value;
800
+ if (input.max_size !== void 0) {
801
+ const actualSize = measureContextValueSize(candidate);
802
+ if (actualSize > input.max_size && onContextOverflow) {
803
+ candidate = onContextOverflow({
804
+ promptId: asset.id,
805
+ variable: input.name,
806
+ value: candidate,
807
+ maxSize: input.max_size,
808
+ actualSize
809
+ });
810
+ }
811
+ }
812
+ if (isTrimEnabled(input.trim) && input.max_size !== void 0) {
813
+ candidate = trimToMaxSize(candidate, input.max_size, input.trim);
814
+ }
815
+ sanitized[input.name] = candidate;
816
+ if (input.allow_regex) {
817
+ const candidate2 = sanitized[input.name];
818
+ const matcher = compileContextRegex(input.allow_regex, {
819
+ promptId: asset.id,
820
+ variable: input.name,
821
+ field: "allow_regex"
822
+ });
823
+ if (!matcher.test(candidate2)) {
824
+ if (input.allow_regex.returnMessage) {
825
+ return {
826
+ variables: sanitized,
827
+ shortCircuit: {
828
+ returnMessage: input.allow_regex.returnMessage,
829
+ code: "POK031",
830
+ variable: input.name,
831
+ field: "allow_regex"
832
+ }
833
+ };
834
+ }
835
+ throw new Error(
836
+ `POK031: Context variable "${input.name}" failed allow_regex validation for prompt "${asset.id}".`
837
+ );
838
+ }
839
+ }
840
+ if (input.deny_regex) {
841
+ const candidate2 = sanitized[input.name];
842
+ const matcher = compileContextRegex(input.deny_regex, {
843
+ promptId: asset.id,
844
+ variable: input.name,
845
+ field: "deny_regex"
846
+ });
847
+ if (matcher.test(candidate2)) {
848
+ if (input.deny_regex.returnMessage) {
849
+ return {
850
+ variables: sanitized,
851
+ shortCircuit: {
852
+ returnMessage: input.deny_regex.returnMessage,
853
+ code: "POK032",
854
+ variable: input.name,
855
+ field: "deny_regex"
856
+ }
857
+ };
858
+ }
859
+ throw new Error(
860
+ `POK032: Context variable "${input.name}" matched deny_regex for prompt "${asset.id}".`
861
+ );
862
+ }
863
+ }
864
+ if (input.non_empty && candidate.trim().length === 0) {
865
+ if (input.non_empty.returnMessage) {
866
+ return {
867
+ variables: sanitized,
868
+ shortCircuit: {
869
+ returnMessage: input.non_empty.returnMessage,
870
+ code: "POK033",
871
+ variable: input.name,
872
+ field: "non_empty"
873
+ }
874
+ };
875
+ }
876
+ throw new Error(
877
+ `POK033: Context variable "${input.name}" failed non_empty validation for prompt "${asset.id}".`
878
+ );
879
+ }
880
+ if (input.reject_secrets) {
881
+ const matcher = compileContextRegex(getRejectSecretsRegex(), {
882
+ promptId: asset.id,
883
+ variable: input.name,
884
+ field: "reject_secrets"
885
+ });
886
+ if (matcher.test(candidate)) {
887
+ if (input.reject_secrets.returnMessage) {
888
+ return {
889
+ variables: sanitized,
890
+ shortCircuit: {
891
+ returnMessage: input.reject_secrets.returnMessage,
892
+ code: "POK034",
893
+ variable: input.name,
894
+ field: "reject_secrets"
895
+ }
896
+ };
897
+ }
898
+ throw new Error(
899
+ `POK034: Context variable "${input.name}" matched reject_secrets validation for prompt "${asset.id}".`
900
+ );
901
+ }
902
+ }
903
+ }
904
+ return { variables: sanitized };
905
+ }
906
+ function measureContextValueSize(value) {
907
+ return textEncoder.encode(value).length;
908
+ }
909
+
910
+ // src/providers/prompt-input.ts
911
+ function isPromptLookup(input) {
912
+ return "path" in input && typeof input.path === "string";
913
+ }
914
+ function isInlinePromptSource(input) {
915
+ return "source" in input && typeof input.source === "string";
916
+ }
917
+ async function resolveProviderPromptInput(input, runtime) {
918
+ if (isPromptLookup(input)) {
919
+ return resolvePromptAsset(input.path, input, runtime);
920
+ }
921
+ if (isInlinePromptSource(input)) {
922
+ return resolveInlinePromptSource(input.source, runtime);
923
+ }
924
+ return input;
925
+ }
926
+ function withPromptInputSupport(adapter) {
927
+ const validatePrompt = async (input, runtime) => {
928
+ const resolved = await resolveProviderPromptInput(input, runtime);
929
+ return adapter.validate(resolved, runtime);
930
+ };
931
+ const renderPrompt = async (input, runtime) => {
932
+ const resolved = await resolveProviderPromptInput(input, runtime);
933
+ const sanitization = sanitizeContextVariables(resolved, runtime.variables, {
934
+ onContextOverflow: runtime.onContextOverflow
935
+ });
936
+ if (sanitization.shortCircuit) {
937
+ return {
938
+ provider: adapter.name,
939
+ model: resolved.model ?? "",
940
+ returnMessage: sanitization.shortCircuit.returnMessage
941
+ };
942
+ }
943
+ return adapter.render(resolved, {
944
+ ...runtime,
945
+ variables: sanitization.variables
946
+ });
947
+ };
948
+ return {
949
+ ...adapter,
950
+ validatePrompt,
951
+ renderPrompt
952
+ };
953
+ }
954
+
955
+ // src/providers/openai-responses.ts
956
+ var openaiResponsesAdapter = withPromptInputSupport({
957
+ name: "openai-responses",
958
+ validate(asset, runtime) {
959
+ const resolvedAsset = resolveAssetForProvider(asset, runtime);
960
+ const errors = [];
961
+ const warnings = [];
962
+ if (!resolvedAsset.model) {
963
+ errors.push("OpenAI Responses adapter requires a model to be specified.");
964
+ }
965
+ if (resolvedAsset.reasoning?.budget_tokens !== void 0) {
966
+ warnings.push("OpenAI Responses uses reasoning.effort, not budget_tokens. budget_tokens will be ignored.");
967
+ }
968
+ if (resolvedAsset.response?.schema !== void 0 && resolvedAsset.response?.format !== "json") {
969
+ warnings.push("OpenAI Responses response.schema requires response.format: json. schema will still be applied as JSON schema output.");
970
+ }
971
+ if (runtime?.openaiResponses?.conversation !== void 0 && runtime?.openaiResponses?.previous_response_id !== void 0) {
972
+ errors.push('OpenAI Responses options "conversation" and "previous_response_id" cannot both be set.');
973
+ }
974
+ return { valid: errors.length === 0, errors, warnings };
975
+ },
976
+ render(asset, runtime) {
977
+ const resolvedAsset = resolveAssetForProvider(asset, runtime);
978
+ const sections = renderSections(resolvedAsset, {
979
+ variables: runtime.variables,
980
+ strict: runtime.strict
981
+ });
982
+ const responseOptions = runtime.openaiResponses;
983
+ const input = [];
984
+ if (runtime.history) {
985
+ for (const msg of runtime.history) {
986
+ input.push({ role: msg.role, content: msg.content });
987
+ }
988
+ }
989
+ if (sections.prompt_template) {
990
+ input.push({ role: "user", content: sections.prompt_template });
991
+ }
992
+ const body = {
993
+ model: resolvedAsset.model,
994
+ input
995
+ };
996
+ if (responseOptions?.instructions !== void 0) {
997
+ body.instructions = responseOptions.instructions;
998
+ } else if (sections.system_instructions) {
999
+ body.instructions = sections.system_instructions;
1000
+ }
1001
+ if (resolvedAsset.sampling?.temperature !== void 0) body.temperature = resolvedAsset.sampling.temperature;
1002
+ if (resolvedAsset.sampling?.top_p !== void 0) body.top_p = resolvedAsset.sampling.top_p;
1003
+ if (resolvedAsset.sampling?.frequency_penalty !== void 0) body.frequency_penalty = resolvedAsset.sampling.frequency_penalty;
1004
+ if (resolvedAsset.sampling?.presence_penalty !== void 0) body.presence_penalty = resolvedAsset.sampling.presence_penalty;
1005
+ if (resolvedAsset.sampling?.stop !== void 0) body.stop = resolvedAsset.sampling.stop;
1006
+ if (resolvedAsset.sampling?.max_output_tokens !== void 0) body.max_output_tokens = resolvedAsset.sampling.max_output_tokens;
1007
+ if (resolvedAsset.reasoning?.effort) {
1008
+ body.reasoning = { effort: resolvedAsset.reasoning.effort };
1009
+ }
1010
+ if (resolvedAsset.response?.schema) {
1011
+ body.text = {
1012
+ format: {
1013
+ type: "json_schema",
1014
+ name: resolvedAsset.response.schema_name ?? `${resolvedAsset.id}_response`,
1015
+ schema: resolvedAsset.response.schema,
1016
+ strict: resolvedAsset.response.schema_strict ?? true
1017
+ }
1018
+ };
1019
+ } else if (resolvedAsset.response?.format === "json") {
1020
+ body.text = { format: { type: "json_object" } };
1021
+ }
1022
+ if (resolvedAsset.response?.stream !== void 0) {
1023
+ body.stream = resolvedAsset.response.stream;
1024
+ }
1025
+ if (resolvedAsset.tools && resolvedAsset.tools.length > 0) {
1026
+ body.tools = resolvedAsset.tools.map((tool) => {
1027
+ if (typeof tool === "string") {
1028
+ const def = runtime.toolRegistry?.[tool];
1029
+ if (def) return def;
1030
+ return { type: "function", name: tool };
1031
+ }
1032
+ return {
1033
+ type: "function",
1034
+ name: tool.name,
1035
+ description: tool.description,
1036
+ parameters: tool.input_schema
1037
+ };
1038
+ });
1039
+ }
1040
+ if (responseOptions?.previous_response_id !== void 0) body.previous_response_id = responseOptions.previous_response_id;
1041
+ if (responseOptions?.conversation !== void 0) body.conversation = responseOptions.conversation;
1042
+ if (responseOptions?.parallel_tool_calls !== void 0) body.parallel_tool_calls = responseOptions.parallel_tool_calls;
1043
+ if (responseOptions?.max_tool_calls !== void 0) body.max_tool_calls = responseOptions.max_tool_calls;
1044
+ if (responseOptions?.store !== void 0) body.store = responseOptions.store;
1045
+ if (responseOptions?.metadata !== void 0) body.metadata = responseOptions.metadata;
1046
+ if (responseOptions?.include !== void 0) body.include = responseOptions.include;
1047
+ if (responseOptions?.background !== void 0) body.background = responseOptions.background;
1048
+ return {
1049
+ body,
1050
+ provider: "openai-responses",
1051
+ model: resolvedAsset.model ?? "unknown"
1052
+ };
1053
+ }
1054
+ });
1055
+ // Annotate the CommonJS export names for ESM import in node:
1056
+ 0 && (module.exports = {
1057
+ openaiResponsesAdapter
1058
+ });
1059
+ //# sourceMappingURL=openai-responses.cjs.map