@adaptic/lumic-utils 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apollo-client.client-D6jG5B1n.js → apollo-client.client-DD13VF_T.js} +3 -3
- package/dist/{apollo-client.client-D6jG5B1n.js.map → apollo-client.client-DD13VF_T.js.map} +1 -1
- package/dist/{apollo-client.client-DLW-p46Y.js → apollo-client.client-eo-xgmdi.js} +4 -4
- package/dist/{apollo-client.client-DLW-p46Y.js.map → apollo-client.client-eo-xgmdi.js.map} +1 -1
- package/dist/{apollo-client.server-Cx30LaNh.js → apollo-client.server-2zi9dbLa.js} +3 -3
- package/dist/{apollo-client.server-Cx30LaNh.js.map → apollo-client.server-2zi9dbLa.js.map} +1 -1
- package/dist/{apollo-client.server-CXLiLmSz.js → apollo-client.server-BxpJcsVI.js} +3 -3
- package/dist/{apollo-client.server-CXLiLmSz.js.map → apollo-client.server-BxpJcsVI.js.map} +1 -1
- package/dist/{index-CqnZ-XiI.js → index-BQ1buNZm.js} +2 -2
- package/dist/{index-CqnZ-XiI.js.map → index-BQ1buNZm.js.map} +1 -1
- package/dist/{index-Bvc61lYS.js → index-BbwdRyPk.js} +232 -84
- package/dist/{index-ChygDqeG.js.map → index-BbwdRyPk.js.map} +1 -1
- package/dist/{index-D2TPDKw0.js → index-CV0UmY0w.js} +2 -2
- package/dist/{index-D2TPDKw0.js.map → index-CV0UmY0w.js.map} +1 -1
- package/dist/{index-ChygDqeG.js → index-zDK1X6HR.js} +232 -84
- package/dist/{index-Bvc61lYS.js.map → index-zDK1X6HR.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test.cjs +1 -1
- package/dist/test.mjs +1 -1
- package/dist/types/functions/llm-deepseek.d.ts +4 -0
- package/dist/types/types/openai-types.d.ts +37 -1
- package/package.json +1 -1
|
@@ -99,7 +99,38 @@ const OPENAI_COMPATIBLE_PROVIDERS = {
|
|
|
99
99
|
* Supported models with their capabilities
|
|
100
100
|
*/
|
|
101
101
|
const SUPPORTED_MODELS = {
|
|
102
|
-
// ── OpenAI GPT-5.
|
|
102
|
+
// ── OpenAI GPT-5.6 series (current flagship) ─────────────────────────
|
|
103
|
+
// sol / terra / luna are the 2026 flagship trio (developers.openai.com/
|
|
104
|
+
// api/docs/models/all). Same GPT-5.x API surface + the temperature
|
|
105
|
+
// constraint documented below.
|
|
106
|
+
'gpt-5.6-sol': {
|
|
107
|
+
provider: 'openai',
|
|
108
|
+
supportsTools: true,
|
|
109
|
+
supportsJson: true,
|
|
110
|
+
supportsStructuredOutput: true,
|
|
111
|
+
supportsDeveloperPrompt: true,
|
|
112
|
+
supportsTemperature: false,
|
|
113
|
+
isReasoningModel: false,
|
|
114
|
+
},
|
|
115
|
+
'gpt-5.6-terra': {
|
|
116
|
+
provider: 'openai',
|
|
117
|
+
supportsTools: true,
|
|
118
|
+
supportsJson: true,
|
|
119
|
+
supportsStructuredOutput: true,
|
|
120
|
+
supportsDeveloperPrompt: true,
|
|
121
|
+
supportsTemperature: false,
|
|
122
|
+
isReasoningModel: false,
|
|
123
|
+
},
|
|
124
|
+
'gpt-5.6-luna': {
|
|
125
|
+
provider: 'openai',
|
|
126
|
+
supportsTools: true,
|
|
127
|
+
supportsJson: true,
|
|
128
|
+
supportsStructuredOutput: true,
|
|
129
|
+
supportsDeveloperPrompt: true,
|
|
130
|
+
supportsTemperature: false,
|
|
131
|
+
isReasoningModel: false,
|
|
132
|
+
},
|
|
133
|
+
// ── OpenAI GPT-5.5 series ────────────────────────────────────────────
|
|
103
134
|
// GPT-5.x series: OpenAI's 2026 API constraint — only the default
|
|
104
135
|
// temperature value (1.0) is accepted. Passing any other value returns
|
|
105
136
|
// HTTP 400: "Unsupported value: 'temperature' does not support 0.2 with
|
|
@@ -154,6 +185,15 @@ const SUPPORTED_MODELS = {
|
|
|
154
185
|
supportsTemperature: false,
|
|
155
186
|
isReasoningModel: false,
|
|
156
187
|
},
|
|
188
|
+
'gpt-5.4-pro': {
|
|
189
|
+
provider: 'openai',
|
|
190
|
+
supportsTools: true,
|
|
191
|
+
supportsJson: true,
|
|
192
|
+
supportsStructuredOutput: true,
|
|
193
|
+
supportsDeveloperPrompt: true,
|
|
194
|
+
supportsTemperature: false,
|
|
195
|
+
isReasoningModel: false,
|
|
196
|
+
},
|
|
157
197
|
// ── OpenAI GPT-5 series ──────────────────────────────────────────────
|
|
158
198
|
'gpt-5': {
|
|
159
199
|
provider: 'openai',
|
|
@@ -574,7 +614,7 @@ function getModelProvider(model) {
|
|
|
574
614
|
* Default model tiers per provider for use with LLM_MODEL_MINI/NORMAL/ADVANCED env vars
|
|
575
615
|
*/
|
|
576
616
|
const PROVIDER_DEFAULT_MODELS = {
|
|
577
|
-
openai: { mini: 'gpt-5.4-nano', normal: 'gpt-5.4-mini', advanced: 'gpt-5.
|
|
617
|
+
openai: { mini: 'gpt-5.4-nano', normal: 'gpt-5.4-mini', advanced: 'gpt-5.6-sol' },
|
|
578
618
|
anthropic: { mini: 'claude-haiku-4-5', normal: 'claude-sonnet-4-6', advanced: 'claude-opus-4-7' },
|
|
579
619
|
deepseek: { mini: 'deepseek-v4-flash', normal: 'deepseek-v4-flash', advanced: 'deepseek-v4-pro' },
|
|
580
620
|
kimi: { mini: 'kimi-k2-0905-preview', normal: 'kimi-k2.5', advanced: 'kimi-k2.6' },
|
|
@@ -1648,8 +1688,17 @@ async function parseResponse(content, responseFormat, options = {}) {
|
|
|
1648
1688
|
getLumicLogger().info(`Code block for type ${detectedType} detected and removed. Cleaned content: ${cleanedContent}`);
|
|
1649
1689
|
}
|
|
1650
1690
|
}
|
|
1651
|
-
//
|
|
1652
|
-
//
|
|
1691
|
+
// Whether the cleaned content structurally resembles JSON. Used to gate the
|
|
1692
|
+
// lenient fixBrokenJson strategy, which will otherwise coerce arbitrary
|
|
1693
|
+
// prose into a bogus object/array.
|
|
1694
|
+
const inputResemblesJson = cleanedContent.startsWith('{') || cleanedContent.startsWith('[');
|
|
1695
|
+
// Multiple JSON parsing strategies.
|
|
1696
|
+
// Default pipeline: direct parse -> extract from brackets -> remove
|
|
1697
|
+
// leading/trailing text -> GATED fixBrokenJson -> FAIL. fixBrokenJson is
|
|
1698
|
+
// deliberately gated (Strategy 4): its output is accepted only when the
|
|
1699
|
+
// input looked like JSON AND the repaired value round-trips through
|
|
1700
|
+
// JSON.stringify/JSON.parse, so a "successful" repair of non-JSON text is
|
|
1701
|
+
// rejected instead of silently returned as garbage.
|
|
1653
1702
|
const jsonParsingStrategies = [
|
|
1654
1703
|
// Strategy 1: Direct parsing
|
|
1655
1704
|
() => {
|
|
@@ -1683,45 +1732,65 @@ async function parseResponse(content, responseFormat, options = {}) {
|
|
|
1683
1732
|
return null;
|
|
1684
1733
|
}
|
|
1685
1734
|
},
|
|
1686
|
-
// Strategy 4:
|
|
1735
|
+
// Strategy 4: Gated fixBrokenJson (string manipulation only, no AI)
|
|
1687
1736
|
() => {
|
|
1688
|
-
|
|
1737
|
+
if (!inputResemblesJson) {
|
|
1738
|
+
return null;
|
|
1739
|
+
}
|
|
1740
|
+
const fixed = fixBrokenJson(cleanedContent);
|
|
1741
|
+
if (fixed === null) {
|
|
1742
|
+
return null;
|
|
1743
|
+
}
|
|
1744
|
+
try {
|
|
1745
|
+
// Round-trip guard: ensures the repaired value is genuinely
|
|
1746
|
+
// JSON-serializable before we trust it.
|
|
1747
|
+
return JSON.parse(JSON.stringify(fixed));
|
|
1748
|
+
}
|
|
1749
|
+
catch {
|
|
1750
|
+
return null;
|
|
1751
|
+
}
|
|
1689
1752
|
},
|
|
1690
1753
|
];
|
|
1691
1754
|
// Try each parsing strategy
|
|
1692
1755
|
for (const strategy of jsonParsingStrategies) {
|
|
1693
|
-
const result =
|
|
1756
|
+
const result = strategy();
|
|
1694
1757
|
if (result !== null) {
|
|
1695
|
-
return result;
|
|
1758
|
+
return finalizeJsonResult(result, responseFormat);
|
|
1696
1759
|
}
|
|
1697
1760
|
}
|
|
1698
1761
|
// Strategy 5: Use AI fixing (only if explicitly enabled)
|
|
1699
1762
|
if (enableAiFix) {
|
|
1700
1763
|
getLumicLogger().warn('Using AI-powered JSON fixing. This adds cost and latency. Consider improving JSON generation instead.');
|
|
1764
|
+
let aiFixedJson = null;
|
|
1701
1765
|
try {
|
|
1702
|
-
|
|
1703
|
-
if (aiFixedJson !== null) {
|
|
1704
|
-
// Validate the AI-fixed JSON by attempting to stringify and re-parse it
|
|
1705
|
-
// This ensures it's actually valid JSON and not just something that passed fixJsonWithAI
|
|
1706
|
-
try {
|
|
1707
|
-
const validated = JSON.parse(JSON.stringify(aiFixedJson));
|
|
1708
|
-
return validated;
|
|
1709
|
-
}
|
|
1710
|
-
catch {
|
|
1711
|
-
// AI returned something that looks like JSON but isn't valid
|
|
1712
|
-
// Increment recursion depth and try parsing the AI response
|
|
1713
|
-
getLumicLogger().warn('AI fixing returned invalid JSON, attempting recursive parse...');
|
|
1714
|
-
return parseResponse(JSON.stringify(aiFixedJson), responseFormat, {
|
|
1715
|
-
...options,
|
|
1716
|
-
_recursionDepth: recursionDepth + 1,
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1766
|
+
aiFixedJson = await fixJsonWithAI(cleanedContent);
|
|
1720
1767
|
}
|
|
1721
1768
|
catch (error) {
|
|
1722
1769
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
1723
1770
|
getLumicLogger().error(`AI JSON fixing failed: ${errorMessage}`);
|
|
1724
|
-
//
|
|
1771
|
+
// Fall through to the final error below.
|
|
1772
|
+
}
|
|
1773
|
+
if (aiFixedJson !== null) {
|
|
1774
|
+
let validated;
|
|
1775
|
+
try {
|
|
1776
|
+
// Validate the AI-fixed JSON by attempting to stringify and re-parse
|
|
1777
|
+
// it. This ensures it is actually valid JSON, not just something that
|
|
1778
|
+
// passed fixJsonWithAI.
|
|
1779
|
+
validated = JSON.parse(JSON.stringify(aiFixedJson));
|
|
1780
|
+
}
|
|
1781
|
+
catch {
|
|
1782
|
+
// AI returned something that looks like JSON but isn't valid.
|
|
1783
|
+
// Increment recursion depth and try parsing the AI response.
|
|
1784
|
+
getLumicLogger().warn('AI fixing returned invalid JSON, attempting recursive parse...');
|
|
1785
|
+
return parseResponse(JSON.stringify(aiFixedJson), responseFormat, {
|
|
1786
|
+
...options,
|
|
1787
|
+
_recursionDepth: recursionDepth + 1,
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
// Schema validation (json_schema format) happens here, OUTSIDE the
|
|
1791
|
+
// JSON.parse try/catch, so a schema mismatch propagates as a thrown
|
|
1792
|
+
// JsonParseError rather than being mistaken for invalid JSON.
|
|
1793
|
+
return finalizeJsonResult(validated, responseFormat);
|
|
1725
1794
|
}
|
|
1726
1795
|
}
|
|
1727
1796
|
// If all strategies fail, throw an error
|
|
@@ -1732,6 +1801,106 @@ async function parseResponse(content, responseFormat, options = {}) {
|
|
|
1732
1801
|
return content;
|
|
1733
1802
|
}
|
|
1734
1803
|
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Reports the JSON type of a runtime value for schema-validation diagnostics.
|
|
1806
|
+
*
|
|
1807
|
+
* @param value The value whose JSON type should be described.
|
|
1808
|
+
* @returns One of `'null' | 'array' | 'object' | 'string' | 'number' | 'boolean' | 'undefined'`.
|
|
1809
|
+
*/
|
|
1810
|
+
function jsonTypeOf(value) {
|
|
1811
|
+
if (value === null)
|
|
1812
|
+
return 'null';
|
|
1813
|
+
if (Array.isArray(value))
|
|
1814
|
+
return 'array';
|
|
1815
|
+
return typeof value;
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Extracts a declared primitive `type` string from a property schema, if present.
|
|
1819
|
+
*
|
|
1820
|
+
* @param propertySchema The (untyped) per-property JSON-Schema fragment.
|
|
1821
|
+
* @returns The declared type string, or null when none is declared.
|
|
1822
|
+
*/
|
|
1823
|
+
function extractSchemaType(propertySchema) {
|
|
1824
|
+
if (typeof propertySchema === 'object' && propertySchema !== null && 'type' in propertySchema) {
|
|
1825
|
+
const declared = propertySchema.type;
|
|
1826
|
+
return typeof declared === 'string' ? declared : null;
|
|
1827
|
+
}
|
|
1828
|
+
return null;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Checks whether a runtime value satisfies a declared JSON-Schema primitive
|
|
1832
|
+
* type. Unknown/unsupported type keywords are treated permissively (they never
|
|
1833
|
+
* cause a rejection), so this validator only ever rejects clear mismatches.
|
|
1834
|
+
*
|
|
1835
|
+
* @param value The runtime value to check.
|
|
1836
|
+
* @param expectedType The declared JSON-Schema type keyword.
|
|
1837
|
+
* @returns True when the value matches (or the keyword is unsupported).
|
|
1838
|
+
*/
|
|
1839
|
+
function valueMatchesJsonType(value, expectedType) {
|
|
1840
|
+
switch (expectedType) {
|
|
1841
|
+
case 'string':
|
|
1842
|
+
return typeof value === 'string';
|
|
1843
|
+
case 'number':
|
|
1844
|
+
return typeof value === 'number';
|
|
1845
|
+
case 'integer':
|
|
1846
|
+
return typeof value === 'number' && Number.isInteger(value);
|
|
1847
|
+
case 'boolean':
|
|
1848
|
+
return typeof value === 'boolean';
|
|
1849
|
+
case 'object':
|
|
1850
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
1851
|
+
case 'array':
|
|
1852
|
+
return Array.isArray(value);
|
|
1853
|
+
case 'null':
|
|
1854
|
+
return value === null;
|
|
1855
|
+
default:
|
|
1856
|
+
return true;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Validates a parsed value against a `json_schema` object schema. Enforces that
|
|
1861
|
+
* the value is a plain object, that every `required` property is present, and
|
|
1862
|
+
* that present properties whose schema declares a primitive `type` match it.
|
|
1863
|
+
*
|
|
1864
|
+
* @param value The parsed value to validate.
|
|
1865
|
+
* @param schema The object schema supplied on the response format.
|
|
1866
|
+
* @throws {JsonParseError} When the value violates the schema.
|
|
1867
|
+
*/
|
|
1868
|
+
function validateJsonSchema(value, schema) {
|
|
1869
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
1870
|
+
throw new JsonParseError(`JSON schema validation failed: expected an object but received ${jsonTypeOf(value)}.`);
|
|
1871
|
+
}
|
|
1872
|
+
const record = value;
|
|
1873
|
+
const missing = (schema.required ?? []).filter((key) => !(key in record));
|
|
1874
|
+
if (missing.length > 0) {
|
|
1875
|
+
throw new JsonParseError(`JSON schema validation failed: missing required properties: ${missing.join(', ')}.`);
|
|
1876
|
+
}
|
|
1877
|
+
for (const [key, propertySchema] of Object.entries(schema.properties)) {
|
|
1878
|
+
if (!(key in record))
|
|
1879
|
+
continue;
|
|
1880
|
+
const expectedType = extractSchemaType(propertySchema);
|
|
1881
|
+
if (expectedType !== null && !valueMatchesJsonType(record[key], expectedType)) {
|
|
1882
|
+
throw new JsonParseError(`JSON schema validation failed: property "${key}" expected type "${expectedType}" but received ${jsonTypeOf(record[key])}.`);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Finalizes a successfully-parsed JSON value. When the caller supplied a
|
|
1888
|
+
* `json_schema` response format, the value is validated against that schema
|
|
1889
|
+
* before being returned so schema violations surface as a thrown
|
|
1890
|
+
* {@link JsonParseError} instead of flowing silently downstream. For plain
|
|
1891
|
+
* `json` formats the value is returned unchanged.
|
|
1892
|
+
*
|
|
1893
|
+
* @param value The parsed value produced by a parsing strategy.
|
|
1894
|
+
* @param responseFormat The originally requested response format.
|
|
1895
|
+
* @returns The value narrowed to `T`.
|
|
1896
|
+
* @throws {JsonParseError} When a supplied json_schema is not satisfied.
|
|
1897
|
+
*/
|
|
1898
|
+
function finalizeJsonResult(value, responseFormat) {
|
|
1899
|
+
if (typeof responseFormat === 'object' && responseFormat?.type === 'json_schema') {
|
|
1900
|
+
validateJsonSchema(value, responseFormat.schema);
|
|
1901
|
+
}
|
|
1902
|
+
return value;
|
|
1903
|
+
}
|
|
1735
1904
|
|
|
1736
1905
|
/**
|
|
1737
1906
|
* Default timeout values (in milliseconds) for external service calls.
|
|
@@ -9068,6 +9237,10 @@ async function createDeepseekCompletion(content, responseFormat, options = {}) {
|
|
|
9068
9237
|
* @param responseFormat The format of the response. Defaults to 'json'.
|
|
9069
9238
|
* @param options Configuration options including model ('deepseek-chat' or 'deepseek-reasoner'), tools, and apiKey.
|
|
9070
9239
|
* @return A promise that resolves to the response from the Deepseek API.
|
|
9240
|
+
* @throws {Error} If the requested capability (JSON output / tool calling) is
|
|
9241
|
+
* unsupported by the model, or if the underlying API call fails. This matches
|
|
9242
|
+
* the OpenAI and Anthropic providers, which surface failures by throwing
|
|
9243
|
+
* rather than returning a success-shaped response carrying an error payload.
|
|
9071
9244
|
*/
|
|
9072
9245
|
const makeDeepseekCall = async (content, responseFormat = 'json', options = {}) => {
|
|
9073
9246
|
// Set default model if not provided
|
|
@@ -9078,43 +9251,15 @@ const makeDeepseekCall = async (content, responseFormat = 'json', options = {})
|
|
|
9078
9251
|
mergedOptions.model = DEFAULT_DEEPSEEK_OPTIONS.defaultModel;
|
|
9079
9252
|
}
|
|
9080
9253
|
const modelName = normalizeModelName(mergedOptions.model);
|
|
9081
|
-
// Check if the requested response format is compatible with the model
|
|
9254
|
+
// Check if the requested response format is compatible with the model.
|
|
9255
|
+
// Throw rather than returning a fake-success LLMResponse: a caller that
|
|
9256
|
+
// asked for JSON must not silently receive an { error } payload typed as T.
|
|
9082
9257
|
if (responseFormat !== 'text' && !supportsJsonOutput(modelName)) {
|
|
9083
|
-
|
|
9084
|
-
return {
|
|
9085
|
-
response: {
|
|
9086
|
-
error: `Model ${modelName} does not support JSON output format.`
|
|
9087
|
-
},
|
|
9088
|
-
usage: {
|
|
9089
|
-
prompt_tokens: 0,
|
|
9090
|
-
completion_tokens: 0,
|
|
9091
|
-
reasoning_tokens: 0,
|
|
9092
|
-
provider: 'deepseek',
|
|
9093
|
-
model: modelName,
|
|
9094
|
-
cached_tokens: 0,
|
|
9095
|
-
cost: 0,
|
|
9096
|
-
},
|
|
9097
|
-
tool_calls: undefined,
|
|
9098
|
-
};
|
|
9258
|
+
throw new Error(`Model ${modelName} does not support JSON output format.`);
|
|
9099
9259
|
}
|
|
9100
|
-
// Check if tools are requested with a model that doesn't support them
|
|
9260
|
+
// Check if tools are requested with a model that doesn't support them.
|
|
9101
9261
|
if (mergedOptions.tools && mergedOptions.tools.length > 0 && !supportsToolCalling(modelName)) {
|
|
9102
|
-
|
|
9103
|
-
return {
|
|
9104
|
-
response: {
|
|
9105
|
-
error: `Model ${modelName} does not support tool calling.`
|
|
9106
|
-
},
|
|
9107
|
-
usage: {
|
|
9108
|
-
prompt_tokens: 0,
|
|
9109
|
-
completion_tokens: 0,
|
|
9110
|
-
reasoning_tokens: 0,
|
|
9111
|
-
provider: 'deepseek',
|
|
9112
|
-
model: modelName,
|
|
9113
|
-
cached_tokens: 0,
|
|
9114
|
-
cost: 0,
|
|
9115
|
-
},
|
|
9116
|
-
tool_calls: undefined,
|
|
9117
|
-
};
|
|
9262
|
+
throw new Error(`Model ${modelName} does not support tool calling.`);
|
|
9118
9263
|
}
|
|
9119
9264
|
try {
|
|
9120
9265
|
const completion = await createDeepseekCompletion(content, responseFormat, mergedOptions);
|
|
@@ -9164,23 +9309,13 @@ const makeDeepseekCall = async (content, responseFormat = 'json', options = {})
|
|
|
9164
9309
|
};
|
|
9165
9310
|
}
|
|
9166
9311
|
catch (error) {
|
|
9167
|
-
//
|
|
9312
|
+
// Mirror the OpenAI/Anthropic providers: log with sanitized context and
|
|
9313
|
+
// rethrow so callers observe the failure. Returning a success-shaped
|
|
9314
|
+
// response with an { error } payload here previously let hard failures
|
|
9315
|
+
// (auth, timeout, rate-limit exhaustion, unparseable output) masquerade as
|
|
9316
|
+
// successful completions downstream.
|
|
9168
9317
|
getLumicLogger().error(`Error in Deepseek API call: ${sanitizeError(error)}`);
|
|
9169
|
-
|
|
9170
|
-
response: {
|
|
9171
|
-
error: sanitizeError(error)
|
|
9172
|
-
},
|
|
9173
|
-
usage: {
|
|
9174
|
-
prompt_tokens: 0,
|
|
9175
|
-
completion_tokens: 0,
|
|
9176
|
-
reasoning_tokens: 0,
|
|
9177
|
-
provider: 'deepseek',
|
|
9178
|
-
model: modelName,
|
|
9179
|
-
cached_tokens: 0,
|
|
9180
|
-
cost: 0,
|
|
9181
|
-
},
|
|
9182
|
-
tool_calls: undefined,
|
|
9183
|
-
};
|
|
9318
|
+
throw error;
|
|
9184
9319
|
}
|
|
9185
9320
|
};
|
|
9186
9321
|
|
|
@@ -10114,14 +10249,27 @@ async function downloadFile(s3Client, bucketName, s3Key, localFilePath) {
|
|
|
10114
10249
|
async function unzipFile(zipPath, destPath) {
|
|
10115
10250
|
const zip = new AdmZip(zipPath);
|
|
10116
10251
|
try {
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10252
|
+
// extractAllToAsync is fire-and-forget: it returns void and reports
|
|
10253
|
+
// failures through its callback. The previous call neither awaited it nor
|
|
10254
|
+
// observed the callback, so getDirectoryStats raced an in-flight (or
|
|
10255
|
+
// failed) extraction and any extraction error was silently dropped. Wrap
|
|
10256
|
+
// it in a Promise so the extraction is fully awaited and errors surface.
|
|
10257
|
+
await new Promise((resolve, reject) => {
|
|
10258
|
+
zip.extractAllToAsync(destPath, true, false, (error) => {
|
|
10259
|
+
if (error) {
|
|
10260
|
+
reject(error);
|
|
10261
|
+
}
|
|
10262
|
+
else {
|
|
10263
|
+
resolve();
|
|
10264
|
+
}
|
|
10265
|
+
});
|
|
10266
|
+
});
|
|
10267
|
+
return await getDirectoryStats(destPath);
|
|
10120
10268
|
}
|
|
10121
10269
|
catch (error) {
|
|
10122
10270
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
10123
10271
|
getLumicLogger().error(`Error unzipping file: ${errorMessage}`);
|
|
10124
|
-
throw error;
|
|
10272
|
+
throw new ZipError(`Failed to extract archive "${zipPath}" to "${destPath}": ${errorMessage}`, error);
|
|
10125
10273
|
}
|
|
10126
10274
|
}
|
|
10127
10275
|
async function getDirectoryStats(dirPath) {
|
|
@@ -23075,11 +23223,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
|
|
|
23075
23223
|
async function loadApolloModules() {
|
|
23076
23224
|
if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
|
|
23077
23225
|
// Server-side (or Lambda): load the CommonJS‑based implementation.
|
|
23078
|
-
return (await Promise.resolve().then(function () { return require('./apollo-client.server-
|
|
23226
|
+
return (await Promise.resolve().then(function () { return require('./apollo-client.server-2zi9dbLa.js'); }));
|
|
23079
23227
|
}
|
|
23080
23228
|
else {
|
|
23081
23229
|
// Client-side: load the ESM‑based implementation.
|
|
23082
|
-
return (await Promise.resolve().then(function () { return require('./apollo-client.client-
|
|
23230
|
+
return (await Promise.resolve().then(function () { return require('./apollo-client.client-DD13VF_T.js'); }));
|
|
23083
23231
|
}
|
|
23084
23232
|
}
|
|
23085
23233
|
/**
|
|
@@ -81790,4 +81938,4 @@ exports.withCorrelationId = withCorrelationId;
|
|
|
81790
81938
|
exports.withMetrics = withMetrics;
|
|
81791
81939
|
exports.withRateLimit = withRateLimit;
|
|
81792
81940
|
exports.withRetry = withRetry;
|
|
81793
|
-
//# sourceMappingURL=index-
|
|
81941
|
+
//# sourceMappingURL=index-zDK1X6HR.js.map
|