@proofhound/shared 0.1.6

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 (98) hide show
  1. package/LICENSE +190 -0
  2. package/dist/classification-options.d.ts +9 -0
  3. package/dist/classification-options.d.ts.map +1 -0
  4. package/dist/classification-options.js +121 -0
  5. package/dist/classification-options.js.map +1 -0
  6. package/dist/dto/annotation.dto.d.ts +291 -0
  7. package/dist/dto/annotation.dto.d.ts.map +1 -0
  8. package/dist/dto/annotation.dto.js +127 -0
  9. package/dist/dto/annotation.dto.js.map +1 -0
  10. package/dist/dto/canary-release.dto.d.ts +483 -0
  11. package/dist/dto/canary-release.dto.d.ts.map +1 -0
  12. package/dist/dto/canary-release.dto.js +276 -0
  13. package/dist/dto/canary-release.dto.js.map +1 -0
  14. package/dist/dto/connector.dto.d.ts +1568 -0
  15. package/dist/dto/connector.dto.d.ts.map +1 -0
  16. package/dist/dto/connector.dto.js +472 -0
  17. package/dist/dto/connector.dto.js.map +1 -0
  18. package/dist/dto/dataset-import.dto.d.ts +128 -0
  19. package/dist/dto/dataset-import.dto.d.ts.map +1 -0
  20. package/dist/dto/dataset-import.dto.js +53 -0
  21. package/dist/dto/dataset-import.dto.js.map +1 -0
  22. package/dist/dto/dataset-modality.d.ts +9 -0
  23. package/dist/dto/dataset-modality.d.ts.map +1 -0
  24. package/dist/dto/dataset-modality.js +17 -0
  25. package/dist/dto/dataset-modality.js.map +1 -0
  26. package/dist/dto/dataset.dto.d.ts +240 -0
  27. package/dist/dto/dataset.dto.d.ts.map +1 -0
  28. package/dist/dto/dataset.dto.js +110 -0
  29. package/dist/dto/dataset.dto.js.map +1 -0
  30. package/dist/dto/experiment.dto.d.ts +393 -0
  31. package/dist/dto/experiment.dto.d.ts.map +1 -0
  32. package/dist/dto/experiment.dto.js +121 -0
  33. package/dist/dto/experiment.dto.js.map +1 -0
  34. package/dist/dto/model.dto.d.ts +356 -0
  35. package/dist/dto/model.dto.d.ts.map +1 -0
  36. package/dist/dto/model.dto.js +183 -0
  37. package/dist/dto/model.dto.js.map +1 -0
  38. package/dist/dto/monitoring.dto.d.ts +354 -0
  39. package/dist/dto/monitoring.dto.d.ts.map +1 -0
  40. package/dist/dto/monitoring.dto.js +102 -0
  41. package/dist/dto/monitoring.dto.js.map +1 -0
  42. package/dist/dto/optimization.dto.d.ts +2086 -0
  43. package/dist/dto/optimization.dto.d.ts.map +1 -0
  44. package/dist/dto/optimization.dto.js +418 -0
  45. package/dist/dto/optimization.dto.js.map +1 -0
  46. package/dist/dto/production-release.dto.d.ts +317 -0
  47. package/dist/dto/production-release.dto.d.ts.map +1 -0
  48. package/dist/dto/production-release.dto.js +146 -0
  49. package/dist/dto/production-release.dto.js.map +1 -0
  50. package/dist/dto/prompt.dto.d.ts +469 -0
  51. package/dist/dto/prompt.dto.d.ts.map +1 -0
  52. package/dist/dto/prompt.dto.js +177 -0
  53. package/dist/dto/prompt.dto.js.map +1 -0
  54. package/dist/dto/quick-start.dto.d.ts +450 -0
  55. package/dist/dto/quick-start.dto.d.ts.map +1 -0
  56. package/dist/dto/quick-start.dto.js +106 -0
  57. package/dist/dto/quick-start.dto.js.map +1 -0
  58. package/dist/dto/release-line.dto.d.ts +1099 -0
  59. package/dist/dto/release-line.dto.d.ts.map +1 -0
  60. package/dist/dto/release-line.dto.js +190 -0
  61. package/dist/dto/release-line.dto.js.map +1 -0
  62. package/dist/dto/run-result.dto.d.ts +419 -0
  63. package/dist/dto/run-result.dto.d.ts.map +1 -0
  64. package/dist/dto/run-result.dto.js +200 -0
  65. package/dist/dto/run-result.dto.js.map +1 -0
  66. package/dist/dto/token.dto.d.ts +80 -0
  67. package/dist/dto/token.dto.d.ts.map +1 -0
  68. package/dist/dto/token.dto.js +65 -0
  69. package/dist/dto/token.dto.js.map +1 -0
  70. package/dist/index.d.ts +22 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +41 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/model-presets.d.ts +28 -0
  75. package/dist/model-presets.d.ts.map +1 -0
  76. package/dist/model-presets.js +295 -0
  77. package/dist/model-presets.js.map +1 -0
  78. package/dist/output-format/build.d.ts +18 -0
  79. package/dist/output-format/build.d.ts.map +1 -0
  80. package/dist/output-format/build.js +126 -0
  81. package/dist/output-format/build.js.map +1 -0
  82. package/dist/output-format/index.d.ts +3 -0
  83. package/dist/output-format/index.d.ts.map +1 -0
  84. package/dist/output-format/index.js +9 -0
  85. package/dist/output-format/index.js.map +1 -0
  86. package/dist/output-format/schema-bridge.d.ts +14 -0
  87. package/dist/output-format/schema-bridge.d.ts.map +1 -0
  88. package/dist/output-format/schema-bridge.js +58 -0
  89. package/dist/output-format/schema-bridge.js.map +1 -0
  90. package/dist/project-context.d.ts +13 -0
  91. package/dist/project-context.d.ts.map +1 -0
  92. package/dist/project-context.js +9 -0
  93. package/dist/project-context.js.map +1 -0
  94. package/dist/run-result-failure.d.ts +4 -0
  95. package/dist/run-result-failure.d.ts.map +1 -0
  96. package/dist/run-result-failure.js +16 -0
  97. package/dist/run-result-failure.js.map +1 -0
  98. package/package.json +45 -0
@@ -0,0 +1,295 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODEL_PRESETS = exports.MODEL_PRESET_GROUPS = void 0;
4
+ const model_dto_1 = require("./dto/model.dto");
5
+ exports.MODEL_PRESET_GROUPS = [
6
+ { key: 'openai', label: 'OpenAI' },
7
+ { key: 'claude', label: 'Claude' },
8
+ { key: 'deepseek', label: 'DeepSeek' },
9
+ { key: 'kimi', label: 'KIMI' },
10
+ { key: 'minimax', label: 'MiniMax' },
11
+ { key: 'qwen', label: 'Qwen' },
12
+ { key: 'ernie', label: 'ERNIE' },
13
+ ];
14
+ const UNPUBLISHED_RATE_LIMITS = {
15
+ rpmLimit: model_dto_1.MODEL_UNLIMITED_RATE_LIMIT,
16
+ tpmLimit: model_dto_1.MODEL_UNLIMITED_RATE_LIMIT,
17
+ };
18
+ const openAiTier1Limits = {
19
+ rpmLimit: 500,
20
+ tpmLimit: 500_000,
21
+ };
22
+ const anthropicOpusTier1Limits = {
23
+ rpmLimit: 50,
24
+ tpmLimit: 580_000,
25
+ };
26
+ const anthropicSonnetTier1Limits = {
27
+ rpmLimit: 50,
28
+ tpmLimit: 38_000,
29
+ };
30
+ const anthropicHaikuTier1Limits = {
31
+ rpmLimit: 50,
32
+ tpmLimit: 60_000,
33
+ };
34
+ const textPreset = {
35
+ ...UNPUBLISHED_RATE_LIMITS,
36
+ concurrencyLimit: model_dto_1.MODEL_DEFAULT_CONCURRENCY_LIMIT,
37
+ inputTokenPricePerMillion: 0,
38
+ outputTokenPricePerMillion: 0,
39
+ capabilities: { image: 'none' },
40
+ };
41
+ const visionPreset = {
42
+ ...textPreset,
43
+ capabilities: { image: 'both' },
44
+ };
45
+ exports.MODEL_PRESETS = [
46
+ {
47
+ ...visionPreset,
48
+ key: 'openai:gpt-5.5',
49
+ group: 'openai',
50
+ name: 'OpenAI GPT-5.5',
51
+ providerType: 'openai',
52
+ providerLabel: 'OpenAI',
53
+ providerModelId: 'gpt-5.5',
54
+ endpoint: 'https://api.openai.com/v1',
55
+ contextWindowTokens: 1_000_000,
56
+ ...openAiTier1Limits,
57
+ inputTokenPricePerMillion: 5,
58
+ outputTokenPricePerMillion: 30,
59
+ featured: true,
60
+ },
61
+ {
62
+ ...visionPreset,
63
+ key: 'openai:gpt-5.4',
64
+ group: 'openai',
65
+ name: 'OpenAI GPT-5.4',
66
+ providerType: 'openai',
67
+ providerLabel: 'OpenAI',
68
+ providerModelId: 'gpt-5.4',
69
+ endpoint: 'https://api.openai.com/v1',
70
+ contextWindowTokens: 1_000_000,
71
+ ...openAiTier1Limits,
72
+ inputTokenPricePerMillion: 2.5,
73
+ outputTokenPricePerMillion: 15,
74
+ },
75
+ {
76
+ ...visionPreset,
77
+ key: 'openai:gpt-5.4-mini',
78
+ group: 'openai',
79
+ name: 'OpenAI GPT-5.4 Mini',
80
+ providerType: 'openai',
81
+ providerLabel: 'OpenAI',
82
+ providerModelId: 'gpt-5.4-mini',
83
+ endpoint: 'https://api.openai.com/v1',
84
+ contextWindowTokens: 400_000,
85
+ ...openAiTier1Limits,
86
+ inputTokenPricePerMillion: 0.75,
87
+ outputTokenPricePerMillion: 4.5,
88
+ },
89
+ {
90
+ ...visionPreset,
91
+ key: 'claude:opus-4.7',
92
+ group: 'claude',
93
+ name: 'Claude Opus 4.7',
94
+ providerType: 'anthropic',
95
+ providerLabel: 'Claude / Anthropic',
96
+ providerModelId: 'claude-opus-4-7',
97
+ endpoint: 'https://api.anthropic.com',
98
+ contextWindowTokens: 1_000_000,
99
+ ...anthropicOpusTier1Limits,
100
+ inputTokenPricePerMillion: 5,
101
+ outputTokenPricePerMillion: 25,
102
+ featured: true,
103
+ },
104
+ {
105
+ ...visionPreset,
106
+ key: 'claude:sonnet-4.6',
107
+ group: 'claude',
108
+ name: 'Claude Sonnet 4.6',
109
+ providerType: 'anthropic',
110
+ providerLabel: 'Claude / Anthropic',
111
+ providerModelId: 'claude-sonnet-4-6',
112
+ endpoint: 'https://api.anthropic.com',
113
+ contextWindowTokens: 1_000_000,
114
+ ...anthropicSonnetTier1Limits,
115
+ inputTokenPricePerMillion: 3,
116
+ outputTokenPricePerMillion: 15,
117
+ },
118
+ {
119
+ ...visionPreset,
120
+ key: 'claude:haiku-4.5',
121
+ group: 'claude',
122
+ name: 'Claude Haiku 4.5',
123
+ providerType: 'anthropic',
124
+ providerLabel: 'Claude / Anthropic',
125
+ providerModelId: 'claude-haiku-4-5-20251001',
126
+ endpoint: 'https://api.anthropic.com',
127
+ contextWindowTokens: 200_000,
128
+ ...anthropicHaikuTier1Limits,
129
+ inputTokenPricePerMillion: 1,
130
+ outputTokenPricePerMillion: 5,
131
+ },
132
+ {
133
+ ...textPreset,
134
+ key: 'deepseek:v4-pro',
135
+ group: 'deepseek',
136
+ name: 'DeepSeek V4 Pro',
137
+ providerType: 'deepseek',
138
+ providerLabel: 'DeepSeek',
139
+ providerModelId: 'deepseek-v4-pro',
140
+ endpoint: 'https://api.deepseek.com/chat/completions',
141
+ contextWindowTokens: 1_000_000,
142
+ inputTokenPricePerMillion: 0.435,
143
+ outputTokenPricePerMillion: 0.87,
144
+ featured: true,
145
+ },
146
+ {
147
+ ...textPreset,
148
+ key: 'deepseek:v4-flash',
149
+ group: 'deepseek',
150
+ name: 'DeepSeek V4 Flash',
151
+ providerType: 'deepseek',
152
+ providerLabel: 'DeepSeek',
153
+ providerModelId: 'deepseek-v4-flash',
154
+ endpoint: 'https://api.deepseek.com/chat/completions',
155
+ contextWindowTokens: 1_000_000,
156
+ inputTokenPricePerMillion: 0.14,
157
+ outputTokenPricePerMillion: 0.28,
158
+ },
159
+ {
160
+ ...visionPreset,
161
+ key: 'kimi:k2.6',
162
+ group: 'kimi',
163
+ name: 'KIMI K2.6',
164
+ providerType: 'kimi',
165
+ providerLabel: 'KIMI / Moonshot',
166
+ providerModelId: 'kimi-k2.6',
167
+ endpoint: 'https://api.moonshot.ai/v1',
168
+ contextWindowTokens: 256_000,
169
+ inputTokenPricePerMillion: 0.95,
170
+ outputTokenPricePerMillion: 4,
171
+ featured: true,
172
+ },
173
+ {
174
+ ...visionPreset,
175
+ key: 'kimi:k2.5',
176
+ group: 'kimi',
177
+ name: 'KIMI K2.5',
178
+ providerType: 'kimi',
179
+ providerLabel: 'KIMI / Moonshot',
180
+ providerModelId: 'kimi-k2.5',
181
+ endpoint: 'https://api.moonshot.ai/v1',
182
+ contextWindowTokens: 256_000,
183
+ inputTokenPricePerMillion: 0.6,
184
+ outputTokenPricePerMillion: 3,
185
+ },
186
+ {
187
+ ...textPreset,
188
+ key: 'minimax:m2.7',
189
+ group: 'minimax',
190
+ name: 'MiniMax M2.7',
191
+ providerType: 'minimax',
192
+ providerLabel: 'MiniMax',
193
+ providerModelId: 'MiniMax-M2.7',
194
+ endpoint: 'https://api.minimaxi.com/v1',
195
+ contextWindowTokens: 204_800,
196
+ rpmLimit: 500,
197
+ tpmLimit: 20_000_000,
198
+ inputTokenPricePerMillion: 0.3,
199
+ outputTokenPricePerMillion: 1.2,
200
+ featured: true,
201
+ },
202
+ {
203
+ ...textPreset,
204
+ key: 'minimax:m2.7-highspeed',
205
+ group: 'minimax',
206
+ name: 'MiniMax M2.7 Highspeed',
207
+ providerType: 'minimax',
208
+ providerLabel: 'MiniMax',
209
+ providerModelId: 'MiniMax-M2.7-highspeed',
210
+ endpoint: 'https://api.minimaxi.com/v1',
211
+ contextWindowTokens: 204_800,
212
+ rpmLimit: 500,
213
+ tpmLimit: 20_000_000,
214
+ inputTokenPricePerMillion: 0.6,
215
+ outputTokenPricePerMillion: 2.4,
216
+ },
217
+ {
218
+ ...visionPreset,
219
+ key: 'qwen:qwen3.6-max-preview',
220
+ group: 'qwen',
221
+ name: 'Qwen 3.6 Max Preview',
222
+ providerType: 'qwen',
223
+ providerLabel: 'Qwen / DashScope',
224
+ providerModelId: 'qwen3.6-max-preview',
225
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
226
+ contextWindowTokens: 256_000,
227
+ rpmLimit: 600,
228
+ tpmLimit: 1_000_000,
229
+ inputTokenPricePerMillion: 1.29,
230
+ outputTokenPricePerMillion: 7.76,
231
+ featured: true,
232
+ },
233
+ {
234
+ ...visionPreset,
235
+ key: 'qwen:qwen3.6-plus',
236
+ group: 'qwen',
237
+ name: 'Qwen 3.6 Plus',
238
+ providerType: 'qwen',
239
+ providerLabel: 'Qwen / DashScope',
240
+ providerModelId: 'qwen3.6-plus',
241
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
242
+ contextWindowTokens: 1_000_000,
243
+ rpmLimit: 30_000,
244
+ tpmLimit: 5_000_000,
245
+ inputTokenPricePerMillion: 0.29,
246
+ outputTokenPricePerMillion: 1.72,
247
+ },
248
+ {
249
+ ...visionPreset,
250
+ key: 'qwen:qwen3.6-flash',
251
+ group: 'qwen',
252
+ name: 'Qwen 3.6 Flash',
253
+ providerType: 'qwen',
254
+ providerLabel: 'Qwen / DashScope',
255
+ providerModelId: 'qwen3.6-flash',
256
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
257
+ contextWindowTokens: 1_000_000,
258
+ rpmLimit: 30_000,
259
+ tpmLimit: 10_000_000,
260
+ inputTokenPricePerMillion: 0.17,
261
+ outputTokenPricePerMillion: 1.03,
262
+ },
263
+ {
264
+ ...textPreset,
265
+ key: 'ernie:4.5-turbo-20260402',
266
+ group: 'ernie',
267
+ name: 'ERNIE 4.5 Turbo',
268
+ providerType: 'ernie',
269
+ providerLabel: 'ERNIE / Qianfan',
270
+ providerModelId: 'ernie-4.5-turbo-20260402',
271
+ endpoint: 'https://qianfan.baidubce.com/v2',
272
+ contextWindowTokens: 128_000,
273
+ rpmLimit: 60,
274
+ tpmLimit: 150_000,
275
+ inputTokenPricePerMillion: 0.11,
276
+ outputTokenPricePerMillion: 0.46,
277
+ featured: true,
278
+ },
279
+ {
280
+ ...visionPreset,
281
+ key: 'ernie:4.5-turbo-vl',
282
+ group: 'ernie',
283
+ name: 'ERNIE 4.5 Turbo VL',
284
+ providerType: 'ernie',
285
+ providerLabel: 'ERNIE / Qianfan',
286
+ providerModelId: 'ernie-4.5-turbo-vl',
287
+ endpoint: 'https://qianfan.baidubce.com/v2',
288
+ contextWindowTokens: 128_000,
289
+ rpmLimit: 1_000,
290
+ tpmLimit: 200_000,
291
+ inputTokenPricePerMillion: 0.43,
292
+ outputTokenPricePerMillion: 1.29,
293
+ },
294
+ ];
295
+ //# sourceMappingURL=model-presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-presets.js","sourceRoot":"","sources":["../src/model-presets.ts"],"names":[],"mappings":";;;AAAA,+CAKyB;AAgCZ,QAAA,mBAAmB,GAAoD;IAClF,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IAClC,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE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AO;QAC5B,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,OAAO;QACjB,yBAAyB,EAAE,IAAI;QAC/B,0BAA0B,EAAE,IAAI;QAChC,QAAQ,EAAE,IAAI;KACf;IACD;QACE,GAAG,YAAY;QACf,GAAG,EAAE,oBAAoB;QACzB,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,oBAAoB;QAC1B,YAAY,EAAE,OAAO;QACrB,aAAa,EAAE,iBAAiB;QAChC,eAAe,EAAE,oBAAoB;QACrC,QAAQ,EAAE,iCAAiC;QAC3C,mBAAmB,EAAE,OAAO;QAC5B,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,OAAO;QACjB,yBAAyB,EAAE,IAAI;QAC/B,0BAA0B,EAAE,IAAI;KACjC;CACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type PromptLanguageDto } from '../dto/prompt.dto';
2
+ export interface OutputFormatInstructionOptions {
3
+ language?: PromptLanguageDto;
4
+ }
5
+ /**
6
+ * Auto-generates the localized "Output Format" section from outputSchema.
7
+ *
8
+ * - JSON Schema (type=object + properties): list a JSON template + field descriptions (including enum labels).
9
+ * - Missing / non-object: returns an empty string (the caller should skip concatenation).
10
+ * - Unrecognized schema structures: fall back to a JSON.stringify-wrapped schema block.
11
+ */
12
+ export declare function buildOutputFormatInstruction(outputSchema: unknown, options?: OutputFormatInstructionOptions): string;
13
+ /**
14
+ * Concatenates the LLM-generated prompt body with the auto-generated output format section.
15
+ * The business LLM caller calls this function to get the "final complete prompt sent to the business model".
16
+ */
17
+ export declare function composeFullPrompt(body: string, outputSchema: unknown, options?: OutputFormatInstructionOptions): string;
18
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/output-format/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAyBpF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAyFD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,OAAO,EACrB,OAAO,GAAE,8BAAmC,GAC3C,MAAM,CAsCR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,EACrB,OAAO,GAAE,8BAAmC,GAC3C,MAAM,CAIR"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildOutputFormatInstruction = buildOutputFormatInstruction;
4
+ exports.composeFullPrompt = composeFullPrompt;
5
+ const prompt_dto_1 = require("../dto/prompt.dto");
6
+ const COPY = {
7
+ 'zh-CN': {
8
+ heading: '## 输出格式',
9
+ schemaInstruction: '请严格按以下 JSON Schema 输出对应的 JSON(仅输出 JSON,不要任何额外字符):',
10
+ objectInstruction: '请严格按以下 JSON 输出(仅输出 JSON 对象,不要任何额外字符,不要 Markdown 包裹):',
11
+ emptyObjectInstruction: '请输出一个合法 JSON 对象(无强约束字段)。',
12
+ fieldDescriptions: '字段说明:',
13
+ enumPrefix: '枚举值,必须是以下之一:',
14
+ typePrefix: '类型',
15
+ bulletColon: ':',
16
+ partSeparator: ';',
17
+ },
18
+ 'en-US': {
19
+ heading: '## Output Format',
20
+ schemaInstruction: 'Output JSON that strictly follows this JSON Schema. Output only JSON with no extra text:',
21
+ objectInstruction: 'Output JSON that strictly follows this shape. Output only a JSON object with no extra text and no Markdown wrapper:',
22
+ emptyObjectInstruction: 'Output a valid JSON object. No additional fields are constrained.',
23
+ fieldDescriptions: 'Field descriptions:',
24
+ enumPrefix: 'Enum value; must be one of: ',
25
+ typePrefix: 'Type',
26
+ bulletColon: ': ',
27
+ partSeparator: '; ',
28
+ },
29
+ };
30
+ function isPlainObject(v) {
31
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
32
+ }
33
+ function isObjectSchema(schema) {
34
+ if (!isPlainObject(schema))
35
+ return false;
36
+ const t = schema.type;
37
+ const props = schema.properties;
38
+ return (t === undefined || t === 'object') && isPlainObject(props);
39
+ }
40
+ function placeholderFor(prop) {
41
+ if (Array.isArray(prop.enum) && prop.enum.length > 0) {
42
+ return `<${prop.enum.map((v) => String(v)).join(' | ')}>`;
43
+ }
44
+ switch (prop.type) {
45
+ case 'string':
46
+ return '<string>';
47
+ case 'number':
48
+ case 'integer':
49
+ return '<number>';
50
+ case 'boolean':
51
+ return '<boolean>';
52
+ case 'array':
53
+ return prop.items ? `[${placeholderFor(prop.items)}, ...]` : '[<...>]';
54
+ case 'object':
55
+ return '{...}';
56
+ default:
57
+ return '<value>';
58
+ }
59
+ }
60
+ function getCopy(language) {
61
+ return COPY[language ?? prompt_dto_1.DEFAULT_PROMPT_LANGUAGE] ?? COPY[prompt_dto_1.DEFAULT_PROMPT_LANGUAGE];
62
+ }
63
+ function describeField(name, prop, language) {
64
+ const parts = [];
65
+ const copy = getCopy(language);
66
+ if (Array.isArray(prop.enum) && prop.enum.length > 0) {
67
+ parts.push(`${copy.enumPrefix}${prop.enum.map((v) => `\`${String(v)}\``).join(' / ')}`);
68
+ }
69
+ else if (prop.type) {
70
+ parts.push(`${copy.typePrefix} \`${prop.type}\``);
71
+ }
72
+ if (prop.description)
73
+ parts.push(prop.description);
74
+ return `- \`${name}\`${copy.bulletColon}${parts.join(copy.partSeparator)}`;
75
+ }
76
+ /**
77
+ * Auto-generates the localized "Output Format" section from outputSchema.
78
+ *
79
+ * - JSON Schema (type=object + properties): list a JSON template + field descriptions (including enum labels).
80
+ * - Missing / non-object: returns an empty string (the caller should skip concatenation).
81
+ * - Unrecognized schema structures: fall back to a JSON.stringify-wrapped schema block.
82
+ */
83
+ function buildOutputFormatInstruction(outputSchema, options = {}) {
84
+ if (outputSchema === undefined || outputSchema === null)
85
+ return '';
86
+ const language = options.language ?? prompt_dto_1.DEFAULT_PROMPT_LANGUAGE;
87
+ const copy = getCopy(language);
88
+ if (!isObjectSchema(outputSchema)) {
89
+ return [copy.heading, '', copy.schemaInstruction, '', '```json', JSON.stringify(outputSchema, null, 2), '```'].join('\n');
90
+ }
91
+ const properties = outputSchema.properties ?? {};
92
+ const entries = Object.entries(properties);
93
+ if (entries.length === 0) {
94
+ return [copy.heading, '', copy.emptyObjectInstruction].join('\n');
95
+ }
96
+ const templateLines = entries.map(([name, prop], i) => {
97
+ const comma = i < entries.length - 1 ? ',' : '';
98
+ return ` "${name}": ${placeholderFor(prop)}${comma}`;
99
+ });
100
+ const fieldDescriptions = entries.map(([name, prop]) => describeField(name, prop, language));
101
+ return [
102
+ copy.heading,
103
+ '',
104
+ copy.objectInstruction,
105
+ '',
106
+ '```json',
107
+ '{',
108
+ ...templateLines,
109
+ '}',
110
+ '```',
111
+ '',
112
+ copy.fieldDescriptions,
113
+ ...fieldDescriptions,
114
+ ].join('\n');
115
+ }
116
+ /**
117
+ * Concatenates the LLM-generated prompt body with the auto-generated output format section.
118
+ * The business LLM caller calls this function to get the "final complete prompt sent to the business model".
119
+ */
120
+ function composeFullPrompt(body, outputSchema, options = {}) {
121
+ const instruction = buildOutputFormatInstruction(outputSchema, options);
122
+ if (instruction.length === 0)
123
+ return body;
124
+ return `${body.trimEnd()}\n\n${instruction}`;
125
+ }
126
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/output-format/build.ts"],"names":[],"mappings":";;AA2HA,oEAyCC;AAMD,8CAQC;AAlLD,kDAAoF;AA6BpF,MAAM,IAAI,GAaN;IACF,OAAO,EAAE;QACP,OAAO,EAAE,SAAS;QAClB,iBAAiB,EAAE,mDAAmD;QACtE,iBAAiB,EAAE,sDAAsD;QACzE,sBAAsB,EAAE,0BAA0B;QAClD,iBAAiB,EAAE,OAAO;QAC1B,UAAU,EAAE,cAAc;QAC1B,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,GAAG;QAChB,aAAa,EAAE,GAAG;K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C;IACH,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE7F,OAAO;QACL,IAAI,CAAC,OAAO;QACZ,EAAE;QACF,IAAI,CAAC,iBAAiB;QACtB,EAAE;QACF,SAAS;QACT,GAAG;QACH,GAAG,aAAa;QAChB,GAAG;QACH,KAAK;QACL,EAAE;QACF,IAAI,CAAC,iBAAiB;QACtB,GAAG,iBAAiB;KACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAC/B,IAAY,EACZ,YAAqB,EACrB,UAA0C,EAAE;IAE5C,MAAM,WAAW,GAAG,4BAA4B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,WAAW,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { buildOutputFormatInstruction, composeFullPrompt } from './build';
2
+ export { outputSchemaToJsonSchema, type JsonSchemaObject, type JsonSchemaProperty, } from './schema-bridge';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/output-format/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EACL,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.outputSchemaToJsonSchema = exports.composeFullPrompt = exports.buildOutputFormatInstruction = void 0;
4
+ var build_1 = require("./build");
5
+ Object.defineProperty(exports, "buildOutputFormatInstruction", { enumerable: true, get: function () { return build_1.buildOutputFormatInstruction; } });
6
+ Object.defineProperty(exports, "composeFullPrompt", { enumerable: true, get: function () { return build_1.composeFullPrompt; } });
7
+ var schema_bridge_1 = require("./schema-bridge");
8
+ Object.defineProperty(exports, "outputSchemaToJsonSchema", { enumerable: true, get: function () { return schema_bridge_1.outputSchemaToJsonSchema; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output-format/index.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAAjE,qHAAA,4BAA4B,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AACxD,iDAIyB;AAHvB,yHAAA,wBAAwB,OAAA"}
@@ -0,0 +1,14 @@
1
+ export interface JsonSchemaProperty {
2
+ type?: string;
3
+ description?: string;
4
+ enum?: unknown[];
5
+ items?: JsonSchemaProperty;
6
+ }
7
+ export interface JsonSchemaObject {
8
+ type: 'object';
9
+ properties: Record<string, JsonSchemaProperty>;
10
+ required: string[];
11
+ additionalProperties: boolean;
12
+ }
13
+ export declare function outputSchemaToJsonSchema(outputSchema: unknown): JsonSchemaObject | undefined;
14
+ //# sourceMappingURL=schema-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-bridge.d.ts","sourceRoot":"","sources":["../../src/output-format/schema-bridge.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC/C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAwBD,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAkC5F"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ // Bridges prompt_versions.output_schema into a "standard JSON Schema object", shared between composeFullPrompt
3
+ // and the LLM response_format, so both use one conversion logic.
4
+ //
5
+ // Historically the ph_assets.prompt_versions.output_schema column has stored two shapes:
6
+ // 1. {fields:[{key, value, isJudgment}, ...]} — manually edited / DTO shape
7
+ // 2. {type:'object', properties:{...}, ...} — directly produced by the optimization generate LLM and persisted
8
+ // Therefore the bridge function recognizes both input shapes. Anything else returns undefined (the caller should treat it as "no schema").
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.outputSchemaToJsonSchema = outputSchemaToJsonSchema;
11
+ function isPlainObject(v) {
12
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
13
+ }
14
+ function isOutputSchemaDto(v) {
15
+ if (!isPlainObject(v))
16
+ return false;
17
+ return Array.isArray(v.fields);
18
+ }
19
+ function isJsonSchemaObject(v) {
20
+ if (!isPlainObject(v))
21
+ return false;
22
+ const t = v.type;
23
+ const props = v.properties;
24
+ return (t === undefined || t === 'object') && isPlainObject(props);
25
+ }
26
+ function outputSchemaToJsonSchema(outputSchema) {
27
+ if (outputSchema === null || outputSchema === undefined)
28
+ return undefined;
29
+ if (isOutputSchemaDto(outputSchema)) {
30
+ const fields = outputSchema.fields ?? [];
31
+ if (fields.length === 0)
32
+ return undefined;
33
+ return {
34
+ type: 'object',
35
+ properties: Object.fromEntries(fields.map((field) => [
36
+ field.key,
37
+ {
38
+ type: 'string',
39
+ description: field.value && field.value.length > 0 ? field.value : undefined,
40
+ },
41
+ ])),
42
+ required: fields.map((field) => field.key),
43
+ additionalProperties: false,
44
+ };
45
+ }
46
+ if (isJsonSchemaObject(outputSchema)) {
47
+ const properties = outputSchema.properties;
48
+ const rawRequired = outputSchema.required;
49
+ const required = Array.isArray(rawRequired)
50
+ ? rawRequired.filter((k) => typeof k === 'string')
51
+ : Object.keys(properties);
52
+ const rawAdditional = outputSchema.additionalProperties;
53
+ const additionalProperties = typeof rawAdditional === 'boolean' ? rawAdditional : false;
54
+ return { type: 'object', properties, required, additionalProperties };
55
+ }
56
+ return undefined;
57
+ }
58
+ //# sourceMappingURL=schema-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-bridge.js","sourceRoot":"","sources":["../../src/output-format/schema-bridge.ts"],"names":[],"mappings":";AAAA,+GAA+G;AAC/G,iEAAiE;AACjE,EAAE;AACF,yFAAyF;AACzF,+EAA+E;AAC/E,oHAAoH;AACpH,2IAA2I;;AAsC3I,4DAkCC;AAlDD,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAU;IACnC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,KAAK,CAAC,OAAO,CAAE,CAA0B,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAU;IACpC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,MAAM,CAAC,GAAI,CAAwB,CAAC,IAAI,CAAC;IACzC,MAAM,KAAK,GAAI,CAA8B,CAAC,UAAU,CAAC;IACzD,OAAO,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,QAAQ,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,wBAAwB,CAAC,YAAqB;IAC5D,IAAI,YAAY,KAAK,IAAI,IAAI,YAA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,CAAC,CAAC,KAAK,CAAC;QACxF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACxE,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface ProjectContext {
2
+ projectId: string;
3
+ source: 'local';
4
+ /**
5
+ * SaaS-only: the org this project belongs to. Carried so a SaaS LimiterKeyStrategy can derive an
6
+ * org-scoped rate-limit key (e.g. `org:<orgId>:model:<id>`) without re-querying. OSS never sets it,
7
+ * and the default LocalLimiterKeyStrategy ignores it. Mirrors ActorContext.orgId.
8
+ */
9
+ orgId?: string;
10
+ }
11
+ export declare const LOCAL_PROJECT_ID = "00000000-0000-4000-8000-000000000001";
12
+ export declare const LOCAL_PROJECT_CONTEXT: ProjectContext;
13
+ //# sourceMappingURL=project-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-context.d.ts","sourceRoot":"","sources":["../src/project-context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB,yCAAyC,CAAC;AAEvE,eAAO,MAAM,qBAAqB,EAAE,cAGlC,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOCAL_PROJECT_CONTEXT = exports.LOCAL_PROJECT_ID = void 0;
4
+ exports.LOCAL_PROJECT_ID = '00000000-0000-4000-8000-000000000001';
5
+ exports.LOCAL_PROJECT_CONTEXT = Object.freeze({
6
+ projectId: exports.LOCAL_PROJECT_ID,
7
+ source: 'local',
8
+ });
9
+ //# sourceMappingURL=project-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-context.js","sourceRoot":"","sources":["../src/project-context.ts"],"names":[],"mappings":";;;AAWa,QAAA,gBAAgB,GAAG,sCAAsC,CAAC;AAE1D,QAAA,qBAAqB,GAAmB,MAAM,CAAC,MAAM,CAAC;IACjE,SAAS,EAAE,wBAAgB;IAC3B,MAAM,EAAE,OAAO;CAChB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RunResultJudgmentStatusDto, RunResultStatusDto } from './dto/run-result.dto';
2
+ export declare const RUN_RESULT_FAILURE_JUDGMENT_STATUSES: readonly ["parse_error", "judge_error"];
3
+ export declare function isRunResultFailure(status: RunResultStatusDto | string | null | undefined, judgmentStatus: RunResultJudgmentStatusDto | string | null | undefined, expectedOutput?: unknown): boolean;
4
+ //# sourceMappingURL=run-result-failure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-result-failure.d.ts","sourceRoot":"","sources":["../src/run-result-failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE3F,eAAO,MAAM,oCAAoC,yCAA0C,CAAC;AAG5F,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACtD,cAAc,EAAE,0BAA0B,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACtE,cAAc,GAAE,OAAsC,GACrD,OAAO,CAKT"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RUN_RESULT_FAILURE_JUDGMENT_STATUSES = void 0;
4
+ exports.isRunResultFailure = isRunResultFailure;
5
+ exports.RUN_RESULT_FAILURE_JUDGMENT_STATUSES = ['parse_error', 'judge_error'];
6
+ const EXPECTED_OUTPUT_NOT_PROVIDED = Symbol('expected_output_not_provided');
7
+ function isRunResultFailure(status, judgmentStatus, expectedOutput = EXPECTED_OUTPUT_NOT_PROVIDED) {
8
+ if (status !== 'success')
9
+ return true;
10
+ if (judgmentStatus === 'parse_error')
11
+ return true;
12
+ if (judgmentStatus !== 'judge_error')
13
+ return false;
14
+ return expectedOutput === EXPECTED_OUTPUT_NOT_PROVIDED || (expectedOutput !== null && expectedOutput !== undefined);
15
+ }
16
+ //# sourceMappingURL=run-result-failure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-result-failure.js","sourceRoot":"","sources":["../src/run-result-failure.ts"],"names":[],"mappings":";;;AAKA,gDASC;AAZY,QAAA,oCAAoC,GAAG,CAAC,aAAa,EAAE,aAAa,CAAU,CAAC;AAC5F,MAAM,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAE5E,SAAgB,kBAAkB,CAChC,MAAsD,EACtD,cAAsE,EACtE,iBAA0B,4BAA4B;IAEtD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,cAAc,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IAClD,IAAI,cAAc,KAAK,aAAa;QAAE,OAAO,KAAK,CAAC;IACnD,OAAO,cAAc,KAAK,4BAA4B,IAAI,CAAC,cAAc,KAAK,IAAI,IAAI,cAAc,KAAK,SAAS,CAAC,CAAC;AACtH,CAAC"}