deepline 0.3.406 → 0.3.408
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/bundling-sources/sdk/src/client.ts +56 -57
- package/dist/bundling-sources/sdk/src/play.ts +21 -5
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +27 -3
- package/dist/bundling-sources/shared_libs/play-runtime/admission-timings.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +11 -1
- package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +1 -4
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +15 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +275 -73
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +22 -4
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +10 -4
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +72 -0
- package/dist/bundling-sources/shared_libs/play-runtime/webhook-receipt-source-commit-retry.ts +90 -0
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +5 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -1
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +6 -0
- package/dist/cli/auth-3GB2K636.js +40 -0
- package/dist/cli/{auth-U7LIMXIS.mjs → auth-UVD3CUBB.mjs} +4 -4
- package/dist/cli/{billing-KGGS3444.mjs → billing-BZVTXXLM.mjs} +23 -16
- package/dist/cli/{billing-5ABVIJFU.js → billing-BZVYAF6T.js} +92 -85
- package/dist/cli/{chunk-KPU53YBB.js → chunk-2XXXFPTD.js} +67 -67
- package/dist/cli/{chunk-FQBKK5DG.js → chunk-3ZB6IIA7.js} +26 -26
- package/dist/cli/{chunk-5IGBBYXH.mjs → chunk-4CFULMRB.mjs} +73 -4
- package/dist/cli/{chunk-OPHLT4TM.mjs → chunk-4QFT5LGV.mjs} +2 -2
- package/dist/cli/{chunk-W2BAO4OR.js → chunk-4RNDKFNQ.js} +2 -2
- package/dist/cli/{chunk-GAMFK2ZP.mjs → chunk-67RWR34T.mjs} +10 -3
- package/dist/cli/{chunk-APLRSERF.js → chunk-AUMD2VXP.js} +60 -63
- package/dist/cli/{chunk-N6DJQQ2S.js → chunk-BRJUESQV.js} +50 -50
- package/dist/cli/{chunk-W3ZNQE5Y.js → chunk-D6FFBSM5.js} +1 -1
- package/dist/cli/{chunk-AYHLUHE5.js → chunk-E3PJF6YP.js} +6 -2
- package/dist/cli/{chunk-IE6IKRQA.js → chunk-ECVLPS67.js} +15 -15
- package/dist/cli/{chunk-QJBJZVG6.js → chunk-HQY2SG3K.js} +15 -8
- package/dist/cli/{chunk-2OFPPAUY.mjs → chunk-I3DHIXVJ.mjs} +4 -4
- package/dist/cli/{chunk-RXDJKAM2.mjs → chunk-IOHRWLQE.mjs} +6 -6
- package/dist/cli/{chunk-2MLY2ZBT.mjs → chunk-IWBXJDZA.mjs} +2 -2
- package/dist/cli/{chunk-URWF7NGQ.js → chunk-J5PTX66Y.js} +28 -14
- package/dist/cli/{chunk-7ZMVAV2B.mjs → chunk-LOYISF7S.mjs} +55 -58
- package/dist/cli/{chunk-T7YF4MQH.mjs → chunk-MJELBQBU.mjs} +4 -4
- package/dist/cli/{chunk-WJYPBHTE.js → chunk-OSFWFV72.js} +11 -4
- package/dist/cli/{chunk-ZI2ZNDJK.mjs → chunk-PYZZMAJQ.mjs} +28 -14
- package/dist/cli/{chunk-N43PX2CA.js → chunk-Q3LFI3VH.js} +8 -8
- package/dist/cli/{chunk-NYDRX6JJ.js → chunk-Q3PUHXOY.js} +99 -30
- package/dist/cli/{chunk-YSAZVLJD.js → chunk-QUAQX3FQ.js} +4 -4
- package/dist/cli/{chunk-4REBZQNK.js → chunk-RWCY6YI2.js} +53 -53
- package/dist/cli/{chunk-CGX4NSS3.mjs → chunk-SD7MXAJA.mjs} +1 -1
- package/dist/cli/{chunk-UFS752TU.mjs → chunk-SJVVBWRL.mjs} +5 -1
- package/dist/cli/{chunk-V3OTRWVK.mjs → chunk-URACNNLO.mjs} +2 -2
- package/dist/cli/{chunk-WXLOW623.mjs → chunk-WPAB4DCU.mjs} +14 -7
- package/dist/cli/{chunk-42RUJLQI.mjs → chunk-WTT6CLED.mjs} +1 -1
- package/dist/cli/{chunk-YLV6PT6B.mjs → chunk-XXLXOUUU.mjs} +1 -1
- package/dist/cli/{chunk-77UGRG6X.mjs → chunk-YMOFWHGO.mjs} +3 -3
- package/dist/cli/{chunk-EKS2FXL5.js → chunk-ZBABPK6Y.js} +8 -8
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-HXJAAW3H.mjs → csv-WPSXG6ZZ.mjs} +3 -3
- package/dist/cli/{csv-U36TIOKU.js → csv-XLGLHJ6P.js} +12 -12
- package/dist/cli/{db-T5MLQQWJ.js → db-5PTNJG4X.js} +25 -25
- package/dist/cli/{db-GRWD3JAC.mjs → db-ABS57ABJ.mjs} +4 -4
- package/dist/cli/{describe-NFX6THJE.js → describe-EZS6PQXA.js} +11 -11
- package/dist/cli/{describe-HXFEIZFO.mjs → describe-PVWQJ2PB.mjs} +7 -7
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-KBHTDL3A.js → executions-FNTAFQ7Y.js} +6 -6
- package/dist/cli/{executions-YGOS5E44.mjs → executions-OKJGATQZ.mjs} +4 -4
- package/dist/cli/{feedback-VP3GWJIH.js → feedback-6YBOMSUA.js} +7 -7
- package/dist/cli/{feedback-NEQGCSHB.mjs → feedback-W27HDMRR.mjs} +3 -3
- package/dist/cli/git-YKUXXJOR.js +24 -0
- package/dist/cli/{git-JJ3CHOTL.mjs → git-YOOUEL6M.mjs} +4 -4
- package/dist/cli/index.js +204 -127
- package/dist/cli/index.mjs +124 -47
- package/dist/cli/{legacy-noops-ITTD33ZN.js → legacy-noops-2VZ7XT6C.js} +7 -7
- package/dist/cli/{legacy-noops-A6KGBODU.mjs → legacy-noops-V6OKW7VR.mjs} +4 -4
- package/dist/cli/{monitors-DXVP5YFC.js → monitors-FBWGVIUS.js} +84 -84
- package/dist/cli/{monitors-NGEXCUEY.mjs → monitors-P2YYWTWT.mjs} +4 -4
- package/dist/cli/{org-C4ZTOSQC.js → org-3XUSVX5T.js} +64 -64
- package/dist/cli/{org-34DBJSFP.mjs → org-DVMG6H3C.mjs} +4 -4
- package/dist/cli/{play-SVLQKZBG.mjs → play-GNC5CQAS.mjs} +70 -18
- package/dist/cli/{play-5FWTZCHN.js → play-YG5L4BWQ.js} +345 -293
- package/dist/cli/{providers-QWR2HRNY.js → providers-7PSWG2OV.js} +7 -7
- package/dist/cli/{providers-RQTSGYE4.mjs → providers-JR33SLWL.mjs} +4 -4
- package/dist/cli/{quickstart-DHFNEMGY.js → quickstart-FDVZ5BL3.js} +5 -5
- package/dist/cli/{quickstart-W5UHZAEU.mjs → quickstart-VUOBQYIQ.mjs} +3 -3
- package/dist/cli/{search-U4AJC3FH.mjs → search-JZYLO33K.mjs} +5 -5
- package/dist/cli/search-PPPYC5OZ.js +30 -0
- package/dist/cli/{secrets-YSMQ7CVZ.mjs → secrets-3MCYBT4I.mjs} +4 -4
- package/dist/cli/{secrets-HH4H7BLE.js → secrets-VS266FVA.js} +13 -13
- package/dist/cli/{sessions-URONRCTV.mjs → sessions-ELLLT23E.mjs} +4 -4
- package/dist/cli/{sessions-AJZXYUCJ.js → sessions-TEHEWW7O.js} +5 -5
- package/dist/cli/{settings-QAW62BH4.js → settings-7364NMMA.js} +75 -75
- package/dist/cli/{settings-KGAMW4MN.mjs → settings-PZCKAFII.mjs} +8 -8
- package/dist/cli/{setup-P54DPBFO.mjs → setup-A7GQ4KIA.mjs} +7 -7
- package/dist/cli/{setup-KAMFU5VE.js → setup-PMWYLCT6.js} +42 -42
- package/dist/cli/skills-SYS7VRRK.js +29 -0
- package/dist/cli/{skills-UMWRJ6TL.mjs → skills-WS6BIFPQ.mjs} +5 -5
- package/dist/cli/{tools-HN4EFVY7.mjs → tools-BR4DOZA2.mjs} +7 -7
- package/dist/cli/{tools-HX3BHT55.js → tools-KK4BKVQR.js} +8 -8
- package/dist/cli/update-2IV5JTX2.js +29 -0
- package/dist/cli/{update-7AFQCJ75.mjs → update-D2B7UNFT.mjs} +7 -7
- package/dist/cli/{workflow-7EHU5ZPX.js → workflow-6ODTCYXU.js} +15 -15
- package/dist/cli/{workflow-ARDO4VHU.mjs → workflow-PQXC2R47.mjs} +5 -5
- package/dist/{client-Db1jFLpF.d.ts → client-BcvhDfJJ.d.ts} +80 -58
- package/dist/{client-Buv1_ktG.d.mts → client-Z9Pye1Wm.d.mts} +80 -58
- package/dist/{compiler-manifest-N77W75Py.d.ts → compiler-manifest-Ycx-hoAr.d.mts} +8 -1
- package/dist/{compiler-manifest-N77W75Py.d.mts → compiler-manifest-Ycx-hoAr.d.ts} +8 -1
- package/dist/{index-3WOfyVhW.d.mts → index-CZXgiN3E.d.mts} +1 -1
- package/dist/{index-CtIJFTCl.d.ts → index-NPG5pqxQ.d.ts} +1 -1
- package/dist/index.d.mts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.js +28 -11
- package/dist/index.mjs +25 -8
- package/dist/install-integrity.json +86 -84
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
- package/dist/cli/auth-K5QAZH42.js +0 -40
- package/dist/cli/git-63RYCZSI.js +0 -24
- package/dist/cli/search-YAYYU3WD.js +0 -30
- package/dist/cli/skills-M2GGHYJU.js +0 -29
- package/dist/cli/update-I23NN5QI.js +0 -29
|
@@ -335,7 +335,13 @@ function formatInsufficientCreditsMessage(input: {
|
|
|
335
335
|
getStringField(input.billing, 'operation_id') ??
|
|
336
336
|
getStringField(input.billing, 'operation') ??
|
|
337
337
|
input.toolId;
|
|
338
|
-
|
|
338
|
+
// The explicit field is authoritative, including null. The older
|
|
339
|
+
// balance_credits field remains a fallback for already persisted errors.
|
|
340
|
+
const spendableBalance =
|
|
341
|
+
input.billing.spendable_balance_credits !== undefined
|
|
342
|
+
? input.billing.spendable_balance_credits
|
|
343
|
+
: input.billing.balance_credits;
|
|
344
|
+
const balance = formatCreditAmount(spendableBalance);
|
|
339
345
|
const required = formatCreditAmount(input.billing.required_credits);
|
|
340
346
|
const recommended = formatCreditAmount(
|
|
341
347
|
input.billing.recommended_add_credits ?? input.billing.needed_credits,
|
|
@@ -357,7 +363,7 @@ function formatInsufficientCreditsMessage(input: {
|
|
|
357
363
|
typeof minimum === 'number' &&
|
|
358
364
|
input.billing.required_credits === minimum
|
|
359
365
|
) {
|
|
360
|
-
return `
|
|
366
|
+
return `Spendable workspace balance ${balance} credits is below the ${formatCreditAmount(minimum)}-credit workspace minimum for starting a billable call (${operation}); this is a workspace-wide minimum, separate from the tool's own price.${estimatedPrice} Spendable credits exclude pending spending and can be lower than the posted balance shown by billing balance.${addSuffix}`;
|
|
361
367
|
}
|
|
362
368
|
// A required balance above the call's estimate is headroom, not a price.
|
|
363
369
|
if (
|
|
@@ -365,9 +371,9 @@ function formatInsufficientCreditsMessage(input: {
|
|
|
365
371
|
typeof input.billing.required_credits === 'number' &&
|
|
366
372
|
input.billing.required_credits > estimate
|
|
367
373
|
) {
|
|
368
|
-
return `
|
|
374
|
+
return `Spendable workspace balance ${balance} credits is below the ${required}-credit balance required to start ${operation}; this is a required balance, not the price.${estimatedPrice} Spendable credits exclude pending spending and can be lower than the posted balance shown by billing balance.${addSuffix}`;
|
|
369
375
|
}
|
|
370
|
-
return `
|
|
376
|
+
return `Spendable workspace balance ${balance} credits < required ${required} for ${operation}. Spendable credits exclude pending spending and can be lower than the posted balance shown by billing balance.${addSuffix}`;
|
|
371
377
|
}
|
|
372
378
|
|
|
373
379
|
/** An HTML document, as an edge proxy (Cloudflare, Vercel) serves for a 5xx. */
|
|
@@ -561,6 +561,16 @@ function parseExecuteToolMetadata(
|
|
|
561
561
|
extractors: readExtractors(record.extractors),
|
|
562
562
|
targetGetters: readGetters(record.targetGetters),
|
|
563
563
|
listExtractorPaths,
|
|
564
|
+
...(isRecord(record.listExtractorAliases)
|
|
565
|
+
? {
|
|
566
|
+
listExtractorAliases: Object.fromEntries(
|
|
567
|
+
Object.entries(record.listExtractorAliases).filter(
|
|
568
|
+
(entry): entry is [string, string] =>
|
|
569
|
+
typeof entry[1] === 'string' && entry[1].length > 0,
|
|
570
|
+
),
|
|
571
|
+
),
|
|
572
|
+
}
|
|
573
|
+
: {}),
|
|
564
574
|
listIdentityGetters: readGetters(record.listIdentityGetters),
|
|
565
575
|
};
|
|
566
576
|
}
|
|
@@ -725,6 +735,9 @@ function candidateResultPaths(path: string): string[] {
|
|
|
725
735
|
providerPath,
|
|
726
736
|
normalizeResultPath(path),
|
|
727
737
|
toV2RawToolOutputPathPreservingProviderData(path),
|
|
738
|
+
...(path.startsWith('result.data.')
|
|
739
|
+
? [`toolResponse.raw.${path.slice('result.data.'.length)}`]
|
|
740
|
+
: []),
|
|
728
741
|
];
|
|
729
742
|
return candidates.filter(
|
|
730
743
|
(candidate, index, all) =>
|
|
@@ -1142,6 +1155,7 @@ function coerceToEnum(
|
|
|
1142
1155
|
function resolveListRows(
|
|
1143
1156
|
result: unknown,
|
|
1144
1157
|
listExtractorPaths: readonly string[] | undefined,
|
|
1158
|
+
aliases?: Readonly<Record<string, string>>,
|
|
1145
1159
|
): Record<string, { path: string; rows: Record<string, unknown>[] }> {
|
|
1146
1160
|
const lists: Record<
|
|
1147
1161
|
string,
|
|
@@ -1178,6 +1192,9 @@ function resolveListRows(
|
|
|
1178
1192
|
}
|
|
1179
1193
|
lists[listName] = resolved;
|
|
1180
1194
|
}
|
|
1195
|
+
for (const [alias, source] of Object.entries(aliases ?? {})) {
|
|
1196
|
+
if (!lists[alias] && lists[source]) lists[alias] = lists[source];
|
|
1197
|
+
}
|
|
1181
1198
|
return lists;
|
|
1182
1199
|
}
|
|
1183
1200
|
|
|
@@ -1546,6 +1563,7 @@ export function createToolExecuteResult<TResult = unknown>(input: {
|
|
|
1546
1563
|
const resolvedLists = resolveListRows(
|
|
1547
1564
|
resultRoot,
|
|
1548
1565
|
input.metadata.listExtractorPaths,
|
|
1566
|
+
input.metadata.listExtractorAliases,
|
|
1549
1567
|
);
|
|
1550
1568
|
const lists = buildLists(resolvedLists, input.metadata);
|
|
1551
1569
|
const metadata = {
|
|
@@ -1553,6 +1571,9 @@ export function createToolExecuteResult<TResult = unknown>(input: {
|
|
|
1553
1571
|
execution: input.execution,
|
|
1554
1572
|
targets,
|
|
1555
1573
|
listExtractorPaths: [...(input.metadata.listExtractorPaths ?? [])],
|
|
1574
|
+
...(input.metadata.listExtractorAliases
|
|
1575
|
+
? { listExtractorAliases: { ...input.metadata.listExtractorAliases } }
|
|
1576
|
+
: {}),
|
|
1556
1577
|
...(input.metadata.extractors
|
|
1557
1578
|
? { extractors: input.metadata.extractors }
|
|
1558
1579
|
: {}),
|
|
@@ -1849,6 +1870,7 @@ function serializedListRowsFromRaw(input: {
|
|
|
1849
1870
|
const resolved = resolveListRows(
|
|
1850
1871
|
{ toolResponse: { raw: input.raw } },
|
|
1851
1872
|
input.metadata.listExtractorPaths,
|
|
1873
|
+
input.metadata.listExtractorAliases,
|
|
1852
1874
|
);
|
|
1853
1875
|
const entries = Object.entries(resolved).map(([name, list]) => [
|
|
1854
1876
|
name,
|
|
@@ -2134,6 +2156,9 @@ function metadataInputFromToolExecuteResult(
|
|
|
2134
2156
|
listExtractorPaths:
|
|
2135
2157
|
value._metadata.listExtractorPaths ??
|
|
2136
2158
|
Object.values(value._metadata.lists).map((list) => list.path),
|
|
2159
|
+
...(value._metadata.listExtractorAliases
|
|
2160
|
+
? { listExtractorAliases: { ...value._metadata.listExtractorAliases } }
|
|
2161
|
+
: {}),
|
|
2137
2162
|
listIdentityGetters: Object.fromEntries(
|
|
2138
2163
|
Object.values(value._metadata.lists)
|
|
2139
2164
|
.flatMap((list) => Object.entries(list.keys))
|
|
@@ -2479,6 +2504,53 @@ export function cloneToolExecuteResultWithExecution<TResult>(
|
|
|
2479
2504
|
}) as ToolExecuteResult<TResult>;
|
|
2480
2505
|
}
|
|
2481
2506
|
|
|
2507
|
+
/**
|
|
2508
|
+
* Add current list getter declarations when replaying a result written by an
|
|
2509
|
+
* older catalog. Stored declarations keep their precedence; the canonical
|
|
2510
|
+
* provider response remains the source for any newly exposed getters.
|
|
2511
|
+
*/
|
|
2512
|
+
export function mergeToolExecuteResultListGetterMetadata(
|
|
2513
|
+
value: ToolExecuteResult,
|
|
2514
|
+
currentMetadata: Pick<
|
|
2515
|
+
ToolResultMetadataInput,
|
|
2516
|
+
'listExtractorPaths' | 'listExtractorAliases'
|
|
2517
|
+
>,
|
|
2518
|
+
): ToolExecuteResult {
|
|
2519
|
+
const serialized = serializeToolExecuteResult(value);
|
|
2520
|
+
const storedMetadata = serialized.metadata;
|
|
2521
|
+
const listExtractorPaths = [
|
|
2522
|
+
...new Set([
|
|
2523
|
+
...(storedMetadata.listExtractorPaths ?? []),
|
|
2524
|
+
...(currentMetadata.listExtractorPaths ?? []),
|
|
2525
|
+
]),
|
|
2526
|
+
];
|
|
2527
|
+
const listExtractorAliases = {
|
|
2528
|
+
...(currentMetadata.listExtractorAliases ?? {}),
|
|
2529
|
+
...(storedMetadata.listExtractorAliases ?? {}),
|
|
2530
|
+
};
|
|
2531
|
+
const hasAliases = Object.keys(listExtractorAliases).length > 0;
|
|
2532
|
+
if (
|
|
2533
|
+
sameJsonValue(
|
|
2534
|
+
listExtractorPaths,
|
|
2535
|
+
storedMetadata.listExtractorPaths ?? [],
|
|
2536
|
+
) &&
|
|
2537
|
+
sameJsonValue(
|
|
2538
|
+
hasAliases ? listExtractorAliases : undefined,
|
|
2539
|
+
storedMetadata.listExtractorAliases,
|
|
2540
|
+
)
|
|
2541
|
+
) {
|
|
2542
|
+
return value;
|
|
2543
|
+
}
|
|
2544
|
+
return deserializeToolExecuteResult({
|
|
2545
|
+
...serialized,
|
|
2546
|
+
metadata: {
|
|
2547
|
+
...storedMetadata,
|
|
2548
|
+
listExtractorPaths,
|
|
2549
|
+
...(hasAliases ? { listExtractorAliases } : {}),
|
|
2550
|
+
},
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2482
2554
|
/**
|
|
2483
2555
|
* Native splitters return the logical source response; the historical adapter
|
|
2484
2556
|
* stores it inside an extra `{ data }` layer. Keep that immutable receipt and
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retries only the idempotent Play webhook source transaction under known
|
|
3
|
+
* Convex OCC or availability failures. Keep application errors loud: this
|
|
4
|
+
* operation creates the durable delivery identity and delayed recovery work
|
|
5
|
+
* atomically, so callers may replay only this narrow boundary.
|
|
6
|
+
*/
|
|
7
|
+
const MAX_RETRIES = 5;
|
|
8
|
+
const RETRY_BASE_MS = 25;
|
|
9
|
+
const RETRY_MAX_MS = 400;
|
|
10
|
+
|
|
11
|
+
function errorChainText(error: unknown): string {
|
|
12
|
+
const parts: string[] = [];
|
|
13
|
+
let current = error;
|
|
14
|
+
for (let depth = 0; depth < 4 && current instanceof Error; depth += 1) {
|
|
15
|
+
parts.push(`${current.name}: ${current.message}`);
|
|
16
|
+
current = current.cause;
|
|
17
|
+
}
|
|
18
|
+
return parts.join('\n');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function retryClass(error: unknown): 'occ' | 'service_unavailable' | null {
|
|
22
|
+
const message = errorChainText(error);
|
|
23
|
+
if (
|
|
24
|
+
/OptimisticConcurrencyControlFailure|write conflict|changed while this mutation was being run/i.test(
|
|
25
|
+
message,
|
|
26
|
+
)
|
|
27
|
+
) {
|
|
28
|
+
return 'occ';
|
|
29
|
+
}
|
|
30
|
+
// Keep this narrow to Convex transport/outage/admission responses. A source
|
|
31
|
+
// commit is replay-safe, but an arbitrary application failure must stay loud.
|
|
32
|
+
if (
|
|
33
|
+
/TypeError:\s*fetch failed|ServiceUnavailable|Service temporarily unavailable|temporarily unavailable \(Code:\s*\d+\)|"code"\s*:\s*"(?:ExpiredInQueue|TooManyConcurrentRequests)"|"code"\s*:\s*"InternalServerError"[\s\S]*(?:Your request couldn't be completed\. Try again later\.|Your request timed out performing too many system operations\.)/i.test(
|
|
34
|
+
message,
|
|
35
|
+
)
|
|
36
|
+
) {
|
|
37
|
+
return 'service_unavailable';
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function retryDelayMs(attempt: number): number {
|
|
43
|
+
const ceiling = Math.min(RETRY_MAX_MS, RETRY_BASE_MS * 2 ** attempt);
|
|
44
|
+
return Math.floor(Math.random() * (ceiling + 1));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Replay the exact receipt mutation, not a broader provider or admission call. */
|
|
48
|
+
export async function retryPlayWebhookReceiptSourceCommit<T>(
|
|
49
|
+
operation: () => Promise<T>,
|
|
50
|
+
): Promise<T> {
|
|
51
|
+
const startedAt = Date.now();
|
|
52
|
+
let totalDelayMs = 0;
|
|
53
|
+
let failureClass: 'occ' | 'service_unavailable' | null = null;
|
|
54
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
55
|
+
try {
|
|
56
|
+
const result = await operation();
|
|
57
|
+
if (attempt > 0) {
|
|
58
|
+
console.info('[play.webhook_delivery.source_commit_retry_outcome]', {
|
|
59
|
+
attemptsTotal: attempt + 1,
|
|
60
|
+
retriesTotal: attempt,
|
|
61
|
+
retryClass: failureClass,
|
|
62
|
+
recovered: true,
|
|
63
|
+
exhausted: false,
|
|
64
|
+
totalDelayMs,
|
|
65
|
+
totalElapsedMs: Date.now() - startedAt,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
failureClass = retryClass(error);
|
|
71
|
+
if (failureClass === null || attempt >= MAX_RETRIES) {
|
|
72
|
+
if (failureClass !== null) {
|
|
73
|
+
console.warn('[play.webhook_delivery.source_commit_retry_outcome]', {
|
|
74
|
+
attemptsTotal: attempt + 1,
|
|
75
|
+
retriesTotal: attempt,
|
|
76
|
+
retryClass: failureClass,
|
|
77
|
+
recovered: false,
|
|
78
|
+
exhausted: attempt >= MAX_RETRIES,
|
|
79
|
+
totalDelayMs,
|
|
80
|
+
totalElapsedMs: Date.now() - startedAt,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
const delayMs = retryDelayMs(attempt);
|
|
86
|
+
totalDelayMs += delayMs;
|
|
87
|
+
await new Promise<void>((resolve) => setTimeout(resolve, delayMs));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -64,6 +64,11 @@ export const MODAL_SANDBOX_COMPUTE_PRICING_USD = {
|
|
|
64
64
|
memoryGiBSecond: 0.00000667,
|
|
65
65
|
} as const;
|
|
66
66
|
|
|
67
|
+
// Modal bills one physical core as two vCPUs. This matches Deepline's standard
|
|
68
|
+
// one-vCPU / one-GiB sandbox and stays beside the pure pricing contract so
|
|
69
|
+
// Convex billing can use it without importing Modal's Node runtime config.
|
|
70
|
+
export const MODAL_SANDBOX_CPU_CORES = 0.5;
|
|
71
|
+
|
|
67
72
|
const NEON_COMPUTE_PRICING_USD = {
|
|
68
73
|
cuHour: 0.106,
|
|
69
74
|
defaultCu: 1,
|
|
@@ -1403,7 +1403,12 @@ export type PlayAuthoringFetchResponse = {
|
|
|
1403
1403
|
/** Full response body as text, with any known secret values redacted. */
|
|
1404
1404
|
bodyText: string;
|
|
1405
1405
|
/**
|
|
1406
|
-
* The
|
|
1406
|
+
* The runtime parses the body at request time.
|
|
1407
|
+
* Read the property with `const body = res.json`. Do not call `await res.json()`.
|
|
1408
|
+
* The value is null when the body is empty or is not valid JSON.
|
|
1409
|
+
* Malformed JSON produces null instead of an error.
|
|
1410
|
+
*
|
|
1411
|
+
* Check `res.ok`. Check `res.bodyText` before you interpret null as an empty response.
|
|
1407
1412
|
*/
|
|
1408
1413
|
json: unknown | null;
|
|
1409
1414
|
};
|
|
@@ -94,6 +94,8 @@ export type ToolResultMetadata = {
|
|
|
94
94
|
lists: Record<string, ToolResultListMetadata>;
|
|
95
95
|
/** Original declarations preserve semantic accessor names across replay. */
|
|
96
96
|
listExtractorPaths?: readonly string[];
|
|
97
|
+
/** Additional semantic names for another declared list; original names win. */
|
|
98
|
+
listExtractorAliases?: Readonly<Record<string, string>>;
|
|
97
99
|
extractors?: Record<string, ToolResultExtractorDescriptor>;
|
|
98
100
|
};
|
|
99
101
|
|
|
@@ -164,6 +166,8 @@ export type ToolResultMetadataInput = {
|
|
|
164
166
|
extractors?: Record<string, ToolResultExtractorDescriptor>;
|
|
165
167
|
targetGetters?: Record<string, readonly string[]>;
|
|
166
168
|
listExtractorPaths?: readonly string[];
|
|
169
|
+
/** Additional semantic names for another declared list; original names win. */
|
|
170
|
+
listExtractorAliases?: Readonly<Record<string, string>>;
|
|
167
171
|
listIdentityGetters?: Record<string, readonly string[]>;
|
|
168
172
|
};
|
|
169
173
|
|
|
@@ -269,6 +273,8 @@ export type ToolExecuteResultBase<
|
|
|
269
273
|
>;
|
|
270
274
|
/** Original declarations preserve semantic accessor names across replay. */
|
|
271
275
|
listExtractorPaths?: readonly string[];
|
|
276
|
+
/** Additional semantic names for another declared list; original names win. */
|
|
277
|
+
listExtractorAliases?: Readonly<Record<string, string>>;
|
|
272
278
|
};
|
|
273
279
|
};
|
|
274
280
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkBRJUESQVjs = require('./chunk-BRJUESQV.js');
|
|
17
|
+
require('./chunk-Q3PUHXOY.js');
|
|
18
|
+
require('./chunk-QUAQX3FQ.js');
|
|
19
|
+
require('./chunk-Q2E4E4FJ.js');
|
|
20
|
+
require('./chunk-XNYIZMNQ.js');
|
|
21
|
+
require('./chunk-7P5AA3SN.js');
|
|
22
|
+
require('./chunk-D6FFBSM5.js');
|
|
23
|
+
require('./chunk-OG64RBAC.js');
|
|
24
|
+
require('./chunk-COGTRVWW.js');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkBRJUESQVjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkBRJUESQVjs.authStatusLine; exports.clearPendingClaim = _chunkBRJUESQVjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkBRJUESQVjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkBRJUESQVjs.handleRegister; exports.handleStatus = _chunkBRJUESQVjs.handleStatus; exports.handleWait = _chunkBRJUESQVjs.handleWait; exports.httpJson = _chunkBRJUESQVjs.httpJson; exports.readPendingAuthClaim = _chunkBRJUESQVjs.readPendingAuthClaim; exports.readStatusBanner = _chunkBRJUESQVjs.readStatusBanner; exports.registerAuthCommands = _chunkBRJUESQVjs.registerAuthCommands; exports.reportSetupCompleted = _chunkBRJUESQVjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkBRJUESQVjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkBRJUESQVjs.statusBannerLine;
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
reportSetupCompleted,
|
|
14
14
|
resolvePendingAuthClaimForResume,
|
|
15
15
|
statusBannerLine
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-IWBXJDZA.mjs";
|
|
17
|
+
import "./chunk-4CFULMRB.mjs";
|
|
18
|
+
import "./chunk-SD7MXAJA.mjs";
|
|
19
19
|
import "./chunk-YHPYUZZX.mjs";
|
|
20
20
|
import "./chunk-DLIRSHV6.mjs";
|
|
21
21
|
import "./chunk-NXGCO4JB.mjs";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-WTT6CLED.mjs";
|
|
23
23
|
import "./chunk-WZYKRD7T.mjs";
|
|
24
24
|
import "./chunk-KRD6H754.mjs";
|
|
25
25
|
export {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
DeeplineClient,
|
|
3
3
|
iterateCursorPages,
|
|
4
4
|
requireBillingIdempotencyKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LOYISF7S.mjs";
|
|
6
6
|
import "./chunk-6IKARAYD.mjs";
|
|
7
7
|
import "./chunk-JI2B4RZP.mjs";
|
|
8
8
|
import "./chunk-EIMG75BT.mjs";
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
openInBrowser,
|
|
14
14
|
printCommandEnvelope,
|
|
15
15
|
shouldEmitJson
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-4CFULMRB.mjs";
|
|
17
|
+
import "./chunk-SD7MXAJA.mjs";
|
|
18
18
|
import {
|
|
19
19
|
AuthError,
|
|
20
20
|
ConfigError
|
|
@@ -23,7 +23,7 @@ import "./chunk-DLIRSHV6.mjs";
|
|
|
23
23
|
import {
|
|
24
24
|
DeeplineError
|
|
25
25
|
} from "./chunk-NXGCO4JB.mjs";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-WTT6CLED.mjs";
|
|
27
27
|
import "./chunk-WZYKRD7T.mjs";
|
|
28
28
|
import "./chunk-KRD6H754.mjs";
|
|
29
29
|
|
|
@@ -307,6 +307,22 @@ async function handleBalance(options) {
|
|
|
307
307
|
const needsCredits = status === "no_billing" || status === "zero_balance" || status === "payment_method_only";
|
|
308
308
|
const recovery = needsCredits ? balanceRecoveryForCredits() : null;
|
|
309
309
|
const lines = [`Balance: ${payload.balance ?? "(unknown)"} credits`];
|
|
310
|
+
const spendable = payload.spendable_balance_credits;
|
|
311
|
+
if (payload.spendable_balance_status === "complete" && typeof spendable === "number") {
|
|
312
|
+
if (typeof payload.posted_balance_credits === "number") {
|
|
313
|
+
lines.push(`Posted wallet: ${payload.posted_balance_credits} credits.`);
|
|
314
|
+
}
|
|
315
|
+
lines.push(`Spendable: ${spendable} credits.`);
|
|
316
|
+
if (typeof payload.pending_spend_credits === "number") {
|
|
317
|
+
lines.push(
|
|
318
|
+
`Pending spending: ${payload.pending_spend_credits} credits \u2014 already committed, not yet debited.`
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
} else if (payload.spendable_balance_status !== void 0 || payload.exposure_status === "partial" || options.verbose) {
|
|
322
|
+
lines.push(
|
|
323
|
+
"Spendable balance is unavailable; the posted balance does not establish capacity for another call."
|
|
324
|
+
);
|
|
325
|
+
}
|
|
310
326
|
const detail = [];
|
|
311
327
|
const temporaryHolds = payload.temporary_hold_credits;
|
|
312
328
|
if (typeof temporaryHolds === "number" && temporaryHolds > 0) {
|
|
@@ -1598,10 +1614,7 @@ Examples:
|
|
|
1598
1614
|
).option("--output <path>", "Write CSV to an explicit path").option("--run-id <run_id>", "Export ledger rows for one play run.").option("--operation <id>", "Export rows for one tool operation.").option(
|
|
1599
1615
|
"--since <timestamp>",
|
|
1600
1616
|
"Only export rows since ISO-8601 time or Unix milliseconds."
|
|
1601
|
-
).option(
|
|
1602
|
-
"--json",
|
|
1603
|
-
"Emit JSON output"
|
|
1604
|
-
).action(handleLedgerExportAll)
|
|
1617
|
+
).option("--json", "Emit JSON output").action(handleLedgerExportAll)
|
|
1605
1618
|
)
|
|
1606
1619
|
);
|
|
1607
1620
|
billing.command("history").description("Export billing ledger history to CSV.").addHelpText(
|
|
@@ -1771,10 +1784,7 @@ Examples:
|
|
|
1771
1784
|
deepline billing subscription status
|
|
1772
1785
|
deepline billing subscription status
|
|
1773
1786
|
`
|
|
1774
|
-
).option(
|
|
1775
|
-
"--json",
|
|
1776
|
-
"Emit JSON output"
|
|
1777
|
-
).action(handleSubscriptionStatus)
|
|
1787
|
+
).option("--json", "Emit JSON output").action(handleSubscriptionStatus)
|
|
1778
1788
|
).addCommand(
|
|
1779
1789
|
new Command("cancel").description("Cancel the subscription at period end. Credits are kept.").addHelpText(
|
|
1780
1790
|
"after",
|
|
@@ -1802,10 +1812,7 @@ Examples:
|
|
|
1802
1812
|
).option("--undo", "Reverse a pending cancellation before period end").option(
|
|
1803
1813
|
"--dry-run",
|
|
1804
1814
|
"Print the planned cancellation without calling the cancel endpoint"
|
|
1805
|
-
).option(
|
|
1806
|
-
"--json",
|
|
1807
|
-
"Emit JSON output"
|
|
1808
|
-
).action(handleSubscriptionCancel)
|
|
1815
|
+
).option("--json", "Emit JSON output").action(handleSubscriptionCancel)
|
|
1809
1816
|
);
|
|
1810
1817
|
billing.command("invoices").description("List subscription invoices and credit purchase receipts.").addHelpText(
|
|
1811
1818
|
"after",
|