deepline 0.3.328 → 0.3.329
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/index.ts +1 -0
- package/dist/bundling-sources/sdk/src/play.ts +55 -45
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +16 -0
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +31 -15
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +22 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +29 -11
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +145 -19
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -10
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +59 -10
- package/dist/cli/{auth-ANHHABWT.mjs → auth-MFFVOITR.mjs} +4 -4
- package/dist/cli/auth-W2MQM6GQ.js +31 -0
- package/dist/cli/{billing-R6NYYO6G.mjs → billing-LRBHWLIQ.mjs} +4 -4
- package/dist/cli/{billing-GGVKLFE6.js → billing-V4Y4OVQ7.js} +70 -70
- package/dist/cli/{chunk-7MABE3ZK.mjs → chunk-3RZJ3GEG.mjs} +135 -5
- package/dist/cli/{chunk-UDIPEHNJ.js → chunk-4FLEXYUC.js} +141 -11
- package/dist/cli/{chunk-LJWC5HSO.js → chunk-75ZOTF3K.js} +15 -15
- package/dist/cli/{chunk-6ENR652E.mjs → chunk-7T6DX5RK.mjs} +21 -14
- package/dist/cli/{chunk-Y4LXIUHX.js → chunk-AD23W4S5.js} +1 -1
- package/dist/cli/{chunk-B2R66UTW.mjs → chunk-EROOAI5G.mjs} +1 -1
- package/dist/cli/{chunk-UM4ZE3P7.mjs → chunk-ERU2OR6F.mjs} +2 -2
- package/dist/cli/{chunk-YIY74KUF.mjs → chunk-EV4QJE4J.mjs} +1 -1
- package/dist/cli/{chunk-WWVE4HFN.mjs → chunk-FK7PW6BP.mjs} +1 -1
- package/dist/cli/{chunk-2HKPAZVJ.js → chunk-FKKNYKDY.js} +14 -3
- package/dist/cli/{chunk-YFCHBN3C.mjs → chunk-GCNER3HV.mjs} +1 -1
- package/dist/cli/{chunk-ITFUZEHE.js → chunk-GY2EEO2Y.js} +9 -9
- package/dist/cli/{chunk-GZV5F6CL.mjs → chunk-HI7TAWFS.mjs} +79 -26
- package/dist/cli/{chunk-AKKQ26RX.mjs → chunk-HVPRQGF4.mjs} +1 -1
- package/dist/cli/{chunk-ZFKUVDOM.js → chunk-J2E5R2VH.js} +60 -60
- package/dist/cli/{chunk-XVKQ6D4K.js → chunk-KHZQFFOQ.js} +2 -2
- package/dist/cli/{chunk-SMGNDW7O.mjs → chunk-MFQQINUY.mjs} +2 -2
- package/dist/cli/{chunk-ZND34HL7.mjs → chunk-MO2XSC5I.mjs} +4 -4
- package/dist/cli/{chunk-KP7W5NO6.mjs → chunk-NTVTZAVZ.mjs} +13 -2
- package/dist/cli/{chunk-7DDNACAQ.js → chunk-OUTIWGKY.js} +26 -26
- package/dist/cli/{chunk-7R6KQSFA.mjs → chunk-OZGU7P2S.mjs} +1 -1
- package/dist/cli/{chunk-BC7FMQ2G.mjs → chunk-SJV5MTOJ.mjs} +1 -1
- package/dist/cli/{chunk-DNMV2L7Q.js → chunk-U2N4CYT7.js} +6 -6
- package/dist/cli/{chunk-W6WV6UME.js → chunk-U4CTHVN7.js} +255 -248
- package/dist/cli/{chunk-AGH6YP2T.js → chunk-UQV5M6HN.js} +3 -3
- package/dist/cli/{chunk-O5GPNPOC.js → chunk-VDIHLKGG.js} +4 -4
- package/dist/cli/{chunk-DNYRAZSK.js → chunk-VLDLJZ75.js} +48 -48
- package/dist/cli/{chunk-2FPVWL4W.js → chunk-XRYKLK56.js} +119 -66
- package/dist/cli/{chunk-OOLIEDIJ.mjs → chunk-YNSCELIJ.mjs} +2 -2
- package/dist/cli/{chunk-LEEXRXQQ.js → chunk-ZXGUYTIT.js} +6 -6
- package/dist/cli/client-5AIFBLKQ.js +20 -0
- package/dist/cli/{client-ZABA5NMD.mjs → client-BNLD775D.mjs} +3 -3
- package/dist/cli/{csv-VECE3PWX.mjs → csv-7MVQECWG.mjs} +3 -3
- package/dist/cli/{csv-4ZK5ZJAJ.js → csv-ZT6ZRQ3Z.js} +12 -12
- package/dist/cli/{db-6VE4OEWW.mjs → db-ABLWLMX5.mjs} +4 -4
- package/dist/cli/{db-UJPCDBV7.js → db-C4BMZXJK.js} +29 -29
- package/dist/cli/{describe-W6X5G4JR.mjs → describe-XWOWAR32.mjs} +10 -10
- package/dist/cli/{describe-CFUZZ326.js → describe-YALVN4WH.js} +17 -17
- package/dist/cli/{executions-ZZWB75DF.mjs → executions-7IZVKQ3O.mjs} +4 -4
- package/dist/cli/{executions-AI4DTQQL.js → executions-U4TNRP26.js} +6 -6
- package/dist/cli/{feedback-IM5Z6T5K.mjs → feedback-GO5XPEKY.mjs} +3 -3
- package/dist/cli/{feedback-FYSNSYUU.js → feedback-NWMRT5W4.js} +6 -6
- package/dist/cli/{git-YNYTK3YW.mjs → git-R53WS4WA.mjs} +4 -4
- package/dist/cli/git-YWRLAOBY.js +23 -0
- package/dist/cli/index.js +79 -79
- package/dist/cli/index.mjs +31 -31
- package/dist/cli/{legacy-noops-4DTMYYUY.mjs → legacy-noops-6QAZW7WJ.mjs} +4 -4
- package/dist/cli/{legacy-noops-PHJE2XFK.js → legacy-noops-NJWM53DE.js} +7 -7
- package/dist/cli/{monitors-27JP76WE.js → monitors-2I2MYAPS.js} +85 -85
- package/dist/cli/{monitors-HUP4MVWJ.mjs → monitors-2N4BRU5M.mjs} +4 -4
- package/dist/cli/{org-L3B2RR4U.mjs → org-D3RHK2Q7.mjs} +4 -4
- package/dist/cli/{org-RHVDMUKN.js → org-XVNAE2JV.js} +60 -60
- package/dist/cli/{play-UXIJVYNF.mjs → play-L7MYJZ65.mjs} +9 -9
- package/dist/cli/play-OYRHI7G3.js +153 -0
- package/dist/cli/{providers-VL6VY56M.js → providers-5BTDAZHN.js} +7 -7
- package/dist/cli/{providers-FABWTNKR.mjs → providers-YM4E7WZD.mjs} +4 -4
- package/dist/cli/{quickstart-IIPZ6DSY.js → quickstart-5A3FHAH3.js} +5 -5
- package/dist/cli/{quickstart-OA54A4IE.mjs → quickstart-ARPLJOLH.mjs} +3 -3
- package/dist/cli/{search-YDK4V2EW.mjs → search-KKJEVV27.mjs} +5 -5
- package/dist/cli/search-VE3O3ZEM.js +26 -0
- package/dist/cli/{secrets-4MQF6RF6.mjs → secrets-DGRJ4DO5.mjs} +4 -4
- package/dist/cli/{secrets-JGU7ZRUW.js → secrets-DVPVCSZD.js} +13 -13
- package/dist/cli/{sessions-PTHOMSZ5.mjs → sessions-56EHXLZD.mjs} +4 -4
- package/dist/cli/{sessions-I7ZZYSYW.js → sessions-VG4ATQ5Y.js} +5 -5
- package/dist/cli/{settings-X4ENSGNK.mjs → settings-4U5XG7QI.mjs} +7 -7
- package/dist/cli/{settings-ZUUBKIG6.js → settings-BLOTIW2G.js} +74 -74
- package/dist/cli/{setup-6L576TQE.js → setup-L7AMAXCH.js} +41 -41
- package/dist/cli/{setup-4UM6FCZL.mjs → setup-RHJAHPOR.mjs} +6 -6
- package/dist/cli/skills-QB4OQGGP.js +28 -0
- package/dist/cli/{skills-U3BS5KUI.mjs → skills-VU55YFCI.mjs} +4 -4
- package/dist/cli/tools-2CPFYNK7.js +40 -0
- package/dist/cli/{tools-O4PX6UVB.mjs → tools-JS3YIDOH.mjs} +7 -6
- package/dist/cli/{update-OHWSK2WN.mjs → update-EHI5QUXM.mjs} +6 -6
- package/dist/cli/update-WXP24GU5.js +28 -0
- package/dist/cli/{workflow-RVMGBMLX.mjs → workflow-BITLTLRF.mjs} +5 -5
- package/dist/cli/{workflow-QWTZBLT3.js → workflow-NE4SYRAT.js} +15 -15
- package/dist/{client-wiWPZhnI.d.mts → client-D5XOQKsA.d.mts} +20 -1
- package/dist/{client-DHq8dJ56.d.ts → client-l-IoLh8Z.d.ts} +20 -1
- package/dist/{compiler-manifest-9TkZ_ykI.d.mts → compiler-manifest-82q4jtfQ.d.mts} +44 -17
- package/dist/{compiler-manifest-9TkZ_ykI.d.ts → compiler-manifest-82q4jtfQ.d.ts} +44 -17
- package/dist/{index-B-5_Xhud.d.mts → index-BPbW2XHF.d.mts} +1 -1
- package/dist/{index-ykksoEyR.d.ts → index-k0rquHIm.d.ts} +1 -1
- package/dist/index.d.mts +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +194 -69
- package/dist/index.mjs +162 -37
- package/dist/install-integrity.json +84 -84
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +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 +2 -1
- package/dist/cli/auth-EKRB4GMP.js +0 -31
- package/dist/cli/client-55BDB4LE.js +0 -20
- package/dist/cli/git-VWXH6LCP.js +0 -23
- package/dist/cli/play-UKH4VFPF.js +0 -153
- package/dist/cli/search-JD2VTR4A.js +0 -26
- package/dist/cli/skills-TLPNCERR.js +0 -28
- package/dist/cli/tools-26JTFFU4.js +0 -39
- package/dist/cli/update-35RRCU2G.js +0 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkGY2EEO2Yjs = require('./chunk-GY2EEO2Y.js');
|
|
5
5
|
require('./chunk-LA46MMTL.js');
|
|
6
6
|
|
|
7
7
|
|
|
@@ -9,13 +9,13 @@ require('./chunk-LA46MMTL.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkU2N4CYT7js = require('./chunk-U2N4CYT7.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkVDIHLKGGjs = require('./chunk-VDIHLKGG.js');
|
|
17
17
|
require('./chunk-XNYIZMNQ.js');
|
|
18
|
-
require('./chunk-
|
|
18
|
+
require('./chunk-AD23W4S5.js');
|
|
19
19
|
require('./chunk-S6R3OX7B.js');
|
|
20
20
|
|
|
21
21
|
|
|
@@ -34,7 +34,7 @@ var SUBSCRIPTION_CANCEL_PATH = "/api/v2/billing/subscription/cancel";
|
|
|
34
34
|
var BILLING_TOP_UP_PATH = "/api/v2/billing/top-up";
|
|
35
35
|
var DEFAULT_BALANCE_RECOVERY_CREDITS = 100;
|
|
36
36
|
function billingFailureFromError(error, options) {
|
|
37
|
-
if (error instanceof
|
|
37
|
+
if (error instanceof _chunkVDIHLKGGjs.AuthError) {
|
|
38
38
|
return {
|
|
39
39
|
exitCode: 3,
|
|
40
40
|
code: "AUTH_ERROR",
|
|
@@ -68,7 +68,7 @@ function reportBillingFailure(failure, options) {
|
|
|
68
68
|
if (failure.next) {
|
|
69
69
|
textLines.push(`Next: ${failure.next}`);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
72
72
|
{
|
|
73
73
|
ok: false,
|
|
74
74
|
exitCode: failure.exitCode,
|
|
@@ -130,7 +130,7 @@ function apiErrorCode(error) {
|
|
|
130
130
|
return _nullishCoalesce(error.code, () => ( "BILLING_API_ERROR"));
|
|
131
131
|
}
|
|
132
132
|
function billingTopUpFailureFromError(error, input) {
|
|
133
|
-
if (error instanceof
|
|
133
|
+
if (error instanceof _chunkVDIHLKGGjs.AuthError || error instanceof _chunkVDIHLKGGjs.ConfigError) {
|
|
134
134
|
return {
|
|
135
135
|
exitCode: 3,
|
|
136
136
|
code: "AUTH_ERROR",
|
|
@@ -299,7 +299,7 @@ function defaultLedgerExportPath() {
|
|
|
299
299
|
);
|
|
300
300
|
}
|
|
301
301
|
async function handleBalance(options) {
|
|
302
|
-
const { http } =
|
|
302
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
303
303
|
const payload = await http.get(
|
|
304
304
|
"/api/v2/billing/balance"
|
|
305
305
|
);
|
|
@@ -363,7 +363,7 @@ async function handleBalance(options) {
|
|
|
363
363
|
lines.push(`If checkout is required, run: ${recovery.checkout_command}`);
|
|
364
364
|
}
|
|
365
365
|
const text = [lines[0], ...options.verbose ? detail : [], ...lines.slice(1)];
|
|
366
|
-
|
|
366
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
367
367
|
{
|
|
368
368
|
...payload,
|
|
369
369
|
...recovery ? { recovery } : {},
|
|
@@ -384,7 +384,7 @@ function quoteShellArgument(value) {
|
|
|
384
384
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
385
385
|
}
|
|
386
386
|
async function handleUsage(options) {
|
|
387
|
-
const { http } =
|
|
387
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
388
388
|
const params = new URLSearchParams();
|
|
389
389
|
if (options.requestId !== void 0) {
|
|
390
390
|
const requestId = options.requestId.trim();
|
|
@@ -465,7 +465,7 @@ async function handleUsage(options) {
|
|
|
465
465
|
"No continuation is available for this view. Use deepline billing ledger export all --json for the full ledger."
|
|
466
466
|
] : []
|
|
467
467
|
];
|
|
468
|
-
|
|
468
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
469
469
|
{
|
|
470
470
|
...payload,
|
|
471
471
|
recent: {
|
|
@@ -479,7 +479,7 @@ async function handleUsage(options) {
|
|
|
479
479
|
);
|
|
480
480
|
}
|
|
481
481
|
async function handleLimit(options) {
|
|
482
|
-
const { http } =
|
|
482
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
483
483
|
const payload = await http.get(
|
|
484
484
|
"/api/v2/billing/limit"
|
|
485
485
|
);
|
|
@@ -487,7 +487,7 @@ async function handleLimit(options) {
|
|
|
487
487
|
`Monthly usage cap: ${_nullishCoalesce(payload.monthly_credits_limit, () => ( "(unknown)"))}`,
|
|
488
488
|
"Enforcement: checked before new calls; in-flight work can exceed the cap."
|
|
489
489
|
] : ["Monthly usage cap: off"];
|
|
490
|
-
|
|
490
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
491
491
|
{
|
|
492
492
|
...payload,
|
|
493
493
|
render: { sections: [{ title: "billing limit", lines }] }
|
|
@@ -496,12 +496,12 @@ async function handleLimit(options) {
|
|
|
496
496
|
);
|
|
497
497
|
}
|
|
498
498
|
async function handleSetLimit(credits, options) {
|
|
499
|
-
const { http } =
|
|
499
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
500
500
|
const payload = await http.request("/api/v2/billing/limit", {
|
|
501
501
|
method: "PUT",
|
|
502
502
|
body: { monthly_credits_limit: Number.parseInt(credits, 10) }
|
|
503
503
|
});
|
|
504
|
-
|
|
504
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
505
505
|
{
|
|
506
506
|
...payload,
|
|
507
507
|
render: {
|
|
@@ -517,11 +517,11 @@ async function handleSetLimit(credits, options) {
|
|
|
517
517
|
);
|
|
518
518
|
}
|
|
519
519
|
async function handleLimitOff(options) {
|
|
520
|
-
const { http } =
|
|
520
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
521
521
|
const payload = await http.request("/api/v2/billing/limit", {
|
|
522
522
|
method: "DELETE"
|
|
523
523
|
});
|
|
524
|
-
|
|
524
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
525
525
|
{
|
|
526
526
|
...payload,
|
|
527
527
|
render: {
|
|
@@ -541,7 +541,7 @@ async function exportLedger(http, outputPath, options) {
|
|
|
541
541
|
let initialized = false;
|
|
542
542
|
let pageNumber = 0;
|
|
543
543
|
console.error(`Exporting billing ledger to ${outputPath}`);
|
|
544
|
-
for await (const entries of
|
|
544
|
+
for await (const entries of _chunkGY2EEO2Yjs.iterateCursorPages.call(void 0, async (cursor) => {
|
|
545
545
|
pageNumber += 1;
|
|
546
546
|
console.error(
|
|
547
547
|
`Fetching page ${pageNumber}; ${summary.row_count} rows written.`
|
|
@@ -580,7 +580,7 @@ async function exportLedger(http, outputPath, options) {
|
|
|
580
580
|
return summary;
|
|
581
581
|
}
|
|
582
582
|
async function handleHistory(options) {
|
|
583
|
-
const { http } =
|
|
583
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
584
584
|
const windows = {
|
|
585
585
|
"1d": 86400,
|
|
586
586
|
"1w": 604800,
|
|
@@ -592,10 +592,10 @@ async function handleHistory(options) {
|
|
|
592
592
|
process.cwd(),
|
|
593
593
|
"deepline",
|
|
594
594
|
"data",
|
|
595
|
-
|
|
595
|
+
_chunkU2N4CYT7js.createTimestampedName.call(void 0, `billing-history-${options.time}`, "csv")
|
|
596
596
|
);
|
|
597
597
|
const summary = await exportLedger(http, outputPath, { sinceAt });
|
|
598
|
-
|
|
598
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
599
599
|
{
|
|
600
600
|
output_path: outputPath,
|
|
601
601
|
row_count: summary.row_count,
|
|
@@ -632,14 +632,14 @@ async function handleLedgerExportAll(options) {
|
|
|
632
632
|
);
|
|
633
633
|
return;
|
|
634
634
|
}
|
|
635
|
-
const { http } =
|
|
635
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
636
636
|
const outputPath = options.output ? _path.resolve.call(void 0, String(options.output)) : defaultLedgerExportPath();
|
|
637
637
|
const summary = await exportLedger(http, outputPath, {
|
|
638
638
|
sinceAt,
|
|
639
639
|
runId: options.runId,
|
|
640
640
|
operation: options.operation
|
|
641
641
|
});
|
|
642
|
-
|
|
642
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
643
643
|
{
|
|
644
644
|
output_path: outputPath,
|
|
645
645
|
row_count: summary.row_count,
|
|
@@ -678,7 +678,7 @@ function targetPlanLine(plan) {
|
|
|
678
678
|
return `${plan.name} (${plan.sku}) | ${planPriceText(plan.recurring_price_usd, plan.interval)} | ${plan.included_credits} included credits/month | $${plan.purchased_credit_price_usd}/purchased credit | ${plan.acquisition_enabled ? "available" : "unavailable"}`;
|
|
679
679
|
}
|
|
680
680
|
async function handlePlans(options) {
|
|
681
|
-
const client = new (0,
|
|
681
|
+
const client = new (0, _chunkGY2EEO2Yjs.DeeplineClient)();
|
|
682
682
|
const payload = await client.billing.targetPlans();
|
|
683
683
|
const listedCurrentPlan = payload.plans.find(
|
|
684
684
|
(plan) => plan.sku === payload.current_plan_sku
|
|
@@ -691,8 +691,8 @@ async function handlePlans(options) {
|
|
|
691
691
|
...payload.plans.length === 0 ? ["Plans: none available"] : ["Plans:", ...payload.plans.map(targetPlanLine)],
|
|
692
692
|
"Change plan: deepline billing change-plan <plan_sku> --json"
|
|
693
693
|
];
|
|
694
|
-
const legacyPayload =
|
|
695
|
-
|
|
694
|
+
const legacyPayload = _chunkU2N4CYT7js.shouldEmitJson.call(void 0, options.json) ? await client.billing.plans() : null;
|
|
695
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
696
696
|
{
|
|
697
697
|
..._nullishCoalesce(legacyPayload, () => ( payload)),
|
|
698
698
|
...legacyPayload ? { target_billing: payload } : {},
|
|
@@ -702,7 +702,7 @@ async function handlePlans(options) {
|
|
|
702
702
|
);
|
|
703
703
|
}
|
|
704
704
|
async function handleSubscribe(planVersionId, options) {
|
|
705
|
-
const { http } =
|
|
705
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
706
706
|
const payload = await http.request(
|
|
707
707
|
"/api/v2/billing/subscription/checkout",
|
|
708
708
|
{
|
|
@@ -711,8 +711,8 @@ async function handleSubscribe(planVersionId, options) {
|
|
|
711
711
|
}
|
|
712
712
|
);
|
|
713
713
|
const url = String(payload.checkout_url || "");
|
|
714
|
-
if (!options.json && options.open !== false && url)
|
|
715
|
-
|
|
714
|
+
if (!options.json && options.open !== false && url) _chunkU2N4CYT7js.openInBrowser.call(void 0, url);
|
|
715
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
716
716
|
{
|
|
717
717
|
...payload,
|
|
718
718
|
render: {
|
|
@@ -728,7 +728,7 @@ async function handleSubscribe(planVersionId, options) {
|
|
|
728
728
|
);
|
|
729
729
|
}
|
|
730
730
|
async function handleSubscriptionStatus(options) {
|
|
731
|
-
const client = new (0,
|
|
731
|
+
const client = new (0, _chunkGY2EEO2Yjs.DeeplineClient)();
|
|
732
732
|
const payload = await client.billing.subscription.status();
|
|
733
733
|
const pools = _nullishCoalesce(payload.credit_pools, () => ( []));
|
|
734
734
|
const lines = [
|
|
@@ -748,7 +748,7 @@ async function handleSubscriptionStatus(options) {
|
|
|
748
748
|
],
|
|
749
749
|
`Assigned by: ${_nullishCoalesce(payload.assigned_by, () => ( "default"))}`
|
|
750
750
|
];
|
|
751
|
-
|
|
751
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
752
752
|
{
|
|
753
753
|
...payload,
|
|
754
754
|
render: { sections: [{ title: "billing subscription", lines }] }
|
|
@@ -757,7 +757,7 @@ async function handleSubscriptionStatus(options) {
|
|
|
757
757
|
);
|
|
758
758
|
}
|
|
759
759
|
async function handleSubscriptionCancel(options) {
|
|
760
|
-
const client = new (0,
|
|
760
|
+
const client = new (0, _chunkGY2EEO2Yjs.DeeplineClient)();
|
|
761
761
|
const action = options.undo ? "undo_cancel" : "cancel";
|
|
762
762
|
if (options.dryRun) {
|
|
763
763
|
const status = await client.billing.subscription.status();
|
|
@@ -774,7 +774,7 @@ async function handleSubscriptionCancel(options) {
|
|
|
774
774
|
return;
|
|
775
775
|
}
|
|
776
776
|
const consequence = action === "cancel" ? `Would schedule cancellation at period end${status.current_period_end ? ` (${status.current_period_end})` : ""}. The subscription stays active until then and remaining credits are kept.` : "Would reverse the pending cancellation; the subscription would renew normally.";
|
|
777
|
-
|
|
777
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
778
778
|
{
|
|
779
779
|
ok: true,
|
|
780
780
|
dry_run: true,
|
|
@@ -829,7 +829,7 @@ async function handleSubscriptionCancel(options) {
|
|
|
829
829
|
"Remaining credits are yours to keep \u2014 cancellation never removes credits.",
|
|
830
830
|
"Undo with: deepline billing subscription cancel --undo"
|
|
831
831
|
];
|
|
832
|
-
|
|
832
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
833
833
|
{
|
|
834
834
|
ok: true,
|
|
835
835
|
...result,
|
|
@@ -883,7 +883,7 @@ async function handleInvoices(options) {
|
|
|
883
883
|
return;
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
const client = new (0,
|
|
886
|
+
const client = new (0, _chunkGY2EEO2Yjs.DeeplineClient)();
|
|
887
887
|
let payload;
|
|
888
888
|
try {
|
|
889
889
|
payload = await client.billing.invoices.list(
|
|
@@ -912,7 +912,7 @@ async function handleInvoices(options) {
|
|
|
912
912
|
url: entry.url
|
|
913
913
|
}))
|
|
914
914
|
} : { ...payload, count: entries.length };
|
|
915
|
-
|
|
915
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
916
916
|
{
|
|
917
917
|
...envelope,
|
|
918
918
|
render: { sections: [{ title: "billing invoices", lines }] }
|
|
@@ -921,7 +921,7 @@ async function handleInvoices(options) {
|
|
|
921
921
|
);
|
|
922
922
|
}
|
|
923
923
|
async function handleCheckout(options) {
|
|
924
|
-
const { http } =
|
|
924
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
925
925
|
const payload = await http.post(
|
|
926
926
|
"/api/v2/billing/checkout",
|
|
927
927
|
{
|
|
@@ -931,8 +931,8 @@ async function handleCheckout(options) {
|
|
|
931
931
|
}
|
|
932
932
|
);
|
|
933
933
|
const url = String(payload.url || payload.checkout_url || "");
|
|
934
|
-
if (!options.json && !options.noOpen && url)
|
|
935
|
-
|
|
934
|
+
if (!options.json && !options.noOpen && url) _chunkU2N4CYT7js.openInBrowser.call(void 0, url);
|
|
935
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
936
936
|
{
|
|
937
937
|
...payload,
|
|
938
938
|
render: {
|
|
@@ -963,7 +963,7 @@ async function handleTopUp(creditsRaw, options) {
|
|
|
963
963
|
}
|
|
964
964
|
const idempotencyKey = topUpIdempotencyKey(options.idempotencyKey);
|
|
965
965
|
if (options.dryRun) {
|
|
966
|
-
|
|
966
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
967
967
|
{
|
|
968
968
|
ok: true,
|
|
969
969
|
dry_run: true,
|
|
@@ -992,7 +992,7 @@ async function handleTopUp(creditsRaw, options) {
|
|
|
992
992
|
);
|
|
993
993
|
return;
|
|
994
994
|
}
|
|
995
|
-
const client = new (0,
|
|
995
|
+
const client = new (0, _chunkGY2EEO2Yjs.DeeplineClient)();
|
|
996
996
|
let payload;
|
|
997
997
|
try {
|
|
998
998
|
payload = await client.billing.topUpWithReceipt({
|
|
@@ -1009,7 +1009,7 @@ async function handleTopUp(creditsRaw, options) {
|
|
|
1009
1009
|
return;
|
|
1010
1010
|
}
|
|
1011
1011
|
if (payload.status === "pending") {
|
|
1012
|
-
|
|
1012
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1013
1013
|
{
|
|
1014
1014
|
ok: true,
|
|
1015
1015
|
...payload,
|
|
@@ -1073,17 +1073,17 @@ async function handleTopUp(creditsRaw, options) {
|
|
|
1073
1073
|
]
|
|
1074
1074
|
}
|
|
1075
1075
|
};
|
|
1076
|
-
|
|
1076
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0, options.compact ? compactEnvelope : fullEnvelope, {
|
|
1077
1077
|
json: options.json
|
|
1078
1078
|
});
|
|
1079
1079
|
}
|
|
1080
1080
|
async function handleTargetStatus(options) {
|
|
1081
|
-
const client = new (0,
|
|
1081
|
+
const client = new (0, _chunkGY2EEO2Yjs.DeeplineClient)();
|
|
1082
1082
|
const payload = await client.billing.targetStatus();
|
|
1083
1083
|
const balanceCommand = "deepline billing balance --json";
|
|
1084
1084
|
const recentChargesCommand = "deepline billing usage --limit 5 --json";
|
|
1085
1085
|
const exactChargeCommand = "deepline billing usage --request-id <job_id> --json";
|
|
1086
|
-
|
|
1086
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1087
1087
|
{
|
|
1088
1088
|
ok: true,
|
|
1089
1089
|
...payload,
|
|
@@ -1113,7 +1113,7 @@ async function handleTargetStatus(options) {
|
|
|
1113
1113
|
);
|
|
1114
1114
|
}
|
|
1115
1115
|
async function handleAutoRechargeStatus(options) {
|
|
1116
|
-
const payload = await new (0,
|
|
1116
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.autoRecharge.get();
|
|
1117
1117
|
const state = payload.available ? payload.enabled ? "on" : "off" : "unavailable";
|
|
1118
1118
|
const lines = [
|
|
1119
1119
|
`State: ${state}`,
|
|
@@ -1123,7 +1123,7 @@ async function handleAutoRechargeStatus(options) {
|
|
|
1123
1123
|
`Automatic credit purchase cap: ${payload.purchase_limit_credits} credits per rolling 30 days`
|
|
1124
1124
|
] : []
|
|
1125
1125
|
];
|
|
1126
|
-
|
|
1126
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1127
1127
|
{
|
|
1128
1128
|
ok: true,
|
|
1129
1129
|
...payload,
|
|
@@ -1172,7 +1172,7 @@ async function handleAutoRechargeSet(options) {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
1174
1174
|
if (options.dryRun) {
|
|
1175
|
-
|
|
1175
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1176
1176
|
{
|
|
1177
1177
|
ok: true,
|
|
1178
1178
|
dry_run: true,
|
|
@@ -1193,7 +1193,7 @@ async function handleAutoRechargeSet(options) {
|
|
|
1193
1193
|
);
|
|
1194
1194
|
return;
|
|
1195
1195
|
}
|
|
1196
|
-
const payload = await new (0,
|
|
1196
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.autoRecharge.update({
|
|
1197
1197
|
enabled: true,
|
|
1198
1198
|
thresholdCredits,
|
|
1199
1199
|
refillToCredits,
|
|
@@ -1201,7 +1201,7 @@ async function handleAutoRechargeSet(options) {
|
|
|
1201
1201
|
...rollingLimitCredits !== void 0 ? { purchaseLimitCredits: rollingLimitCredits } : {},
|
|
1202
1202
|
idempotencyKey
|
|
1203
1203
|
});
|
|
1204
|
-
|
|
1204
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1205
1205
|
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
1206
1206
|
{ json: options.json }
|
|
1207
1207
|
);
|
|
@@ -1209,7 +1209,7 @@ async function handleAutoRechargeSet(options) {
|
|
|
1209
1209
|
async function handleAutoRechargeOff(options) {
|
|
1210
1210
|
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
1211
1211
|
if (options.dryRun) {
|
|
1212
|
-
|
|
1212
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1213
1213
|
{
|
|
1214
1214
|
ok: true,
|
|
1215
1215
|
dry_run: true,
|
|
@@ -1224,11 +1224,11 @@ async function handleAutoRechargeOff(options) {
|
|
|
1224
1224
|
);
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
1227
|
-
const payload = await new (0,
|
|
1227
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.autoRecharge.update({
|
|
1228
1228
|
enabled: false,
|
|
1229
1229
|
idempotencyKey
|
|
1230
1230
|
});
|
|
1231
|
-
|
|
1231
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1232
1232
|
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
1233
1233
|
{ json: options.json }
|
|
1234
1234
|
);
|
|
@@ -1247,11 +1247,11 @@ async function handleBuyCredits(creditsRaw, options) {
|
|
|
1247
1247
|
return;
|
|
1248
1248
|
}
|
|
1249
1249
|
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
1250
|
-
const payload = await new (0,
|
|
1250
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.purchaseCredits({
|
|
1251
1251
|
credits,
|
|
1252
1252
|
idempotencyKey
|
|
1253
1253
|
});
|
|
1254
|
-
|
|
1254
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1255
1255
|
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
1256
1256
|
{ json: options.json }
|
|
1257
1257
|
);
|
|
@@ -1287,7 +1287,7 @@ async function handleTopUpRecover(creditsRaw, options) {
|
|
|
1287
1287
|
return;
|
|
1288
1288
|
}
|
|
1289
1289
|
if (options.dryRun) {
|
|
1290
|
-
|
|
1290
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1291
1291
|
{
|
|
1292
1292
|
ok: true,
|
|
1293
1293
|
dry_run: true,
|
|
@@ -1300,12 +1300,12 @@ async function handleTopUpRecover(creditsRaw, options) {
|
|
|
1300
1300
|
);
|
|
1301
1301
|
return;
|
|
1302
1302
|
}
|
|
1303
|
-
const payload = await new (0,
|
|
1303
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.recoverCreditPurchase({
|
|
1304
1304
|
credits,
|
|
1305
1305
|
orgId: options.orgId,
|
|
1306
1306
|
idempotencyKey: options.idempotencyKey
|
|
1307
1307
|
});
|
|
1308
|
-
|
|
1308
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1309
1309
|
{ ok: true, idempotency_key: options.idempotencyKey, ...payload },
|
|
1310
1310
|
{ json: options.json }
|
|
1311
1311
|
);
|
|
@@ -1325,37 +1325,37 @@ async function handleTargetPlan(planSku, options) {
|
|
|
1325
1325
|
return;
|
|
1326
1326
|
}
|
|
1327
1327
|
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
1328
|
-
const payload = await new (0,
|
|
1328
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.transitionPlan({
|
|
1329
1329
|
action: "start_or_change",
|
|
1330
1330
|
targetPlanSku: planSku,
|
|
1331
1331
|
...options.billingEmail ? { billingEmail: options.billingEmail } : {},
|
|
1332
1332
|
idempotencyKey
|
|
1333
1333
|
});
|
|
1334
|
-
|
|
1334
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1335
1335
|
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
1336
1336
|
{ json: options.json }
|
|
1337
1337
|
);
|
|
1338
1338
|
}
|
|
1339
1339
|
async function handleTargetPlanCancellation(options) {
|
|
1340
1340
|
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
1341
|
-
const payload = await new (0,
|
|
1341
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.transitionPlan({
|
|
1342
1342
|
action: options.undo ? "undo_cancel" : "cancel",
|
|
1343
1343
|
idempotencyKey
|
|
1344
1344
|
});
|
|
1345
|
-
|
|
1345
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1346
1346
|
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
1347
1347
|
{ json: options.json }
|
|
1348
1348
|
);
|
|
1349
1349
|
}
|
|
1350
1350
|
async function handleTargetPortal(options) {
|
|
1351
|
-
const payload = await new (0,
|
|
1351
|
+
const payload = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.portalSession(
|
|
1352
1352
|
options.billingAddress ? { flow: "customer_update" } : void 0
|
|
1353
1353
|
);
|
|
1354
|
-
if (!options.json && !options.noOpen)
|
|
1355
|
-
|
|
1354
|
+
if (!options.json && !options.noOpen) _chunkU2N4CYT7js.openInBrowser.call(void 0, payload.url);
|
|
1355
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0, { ok: true, ...payload }, { json: options.json });
|
|
1356
1356
|
}
|
|
1357
1357
|
async function handleRedeemCode(code, options) {
|
|
1358
|
-
const { http } =
|
|
1358
|
+
const { http } = _chunkU2N4CYT7js.getAuthedHttpClient.call(void 0, );
|
|
1359
1359
|
const payload = await http.post(
|
|
1360
1360
|
"/api/v2/billing/checkout",
|
|
1361
1361
|
{
|
|
@@ -1363,8 +1363,8 @@ async function handleRedeemCode(code, options) {
|
|
|
1363
1363
|
}
|
|
1364
1364
|
);
|
|
1365
1365
|
const url = String(payload.url || payload.checkout_url || "");
|
|
1366
|
-
if (!options.json && !options.noOpen && url)
|
|
1367
|
-
|
|
1366
|
+
if (!options.json && !options.noOpen && url) _chunkU2N4CYT7js.openInBrowser.call(void 0, url);
|
|
1367
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0,
|
|
1368
1368
|
{
|
|
1369
1369
|
...payload,
|
|
1370
1370
|
render: {
|
|
@@ -1630,8 +1630,8 @@ Examples:
|
|
|
1630
1630
|
new (0, _commander.Command)("trigger").description(
|
|
1631
1631
|
"Evaluate capped automatic recharge and resume any pending purchase."
|
|
1632
1632
|
).option("--json", "Emit JSON output").action(async (options) => {
|
|
1633
|
-
const result = await new (0,
|
|
1634
|
-
|
|
1633
|
+
const result = await new (0, _chunkGY2EEO2Yjs.DeeplineClient)().billing.autoRecharge.trigger();
|
|
1634
|
+
_chunkU2N4CYT7js.printCommandEnvelope.call(void 0, { ok: true, ...result }, { json: options.json });
|
|
1635
1635
|
})
|
|
1636
1636
|
);
|
|
1637
1637
|
billing.command("change-plan").description("Start or change the target billing plan.").argument("<plan_sku>", "payg-v1, builder-v1, growth-v1, or team-v1").option(
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeeplineClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OZGU7P2S.mjs";
|
|
4
4
|
import {
|
|
5
|
-
printCommandEnvelope
|
|
6
|
-
|
|
5
|
+
printCommandEnvelope,
|
|
6
|
+
renderCommandEnvelopeText
|
|
7
|
+
} from "./chunk-EROOAI5G.mjs";
|
|
7
8
|
import {
|
|
8
9
|
resolveConfig,
|
|
9
10
|
sdkCliStateDirPath
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FK7PW6BP.mjs";
|
|
11
12
|
|
|
12
13
|
// src/cli/search-ref.ts
|
|
13
14
|
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -36,6 +37,132 @@ function recentSearchRef() {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
// src/cli/text-table.ts
|
|
41
|
+
import { getBorderCharacters, table } from "table";
|
|
42
|
+
function formatTextTable(rows, columns) {
|
|
43
|
+
if (columns.length === 0) return "";
|
|
44
|
+
const data = [
|
|
45
|
+
columns.map((column) => column.header),
|
|
46
|
+
...rows.map((row) => columns.map((column) => column.value(row)))
|
|
47
|
+
];
|
|
48
|
+
return table(data, {
|
|
49
|
+
border: getBorderCharacters("void"),
|
|
50
|
+
drawHorizontalLine: () => false,
|
|
51
|
+
columnDefault: { paddingLeft: 0, paddingRight: 2 },
|
|
52
|
+
columns: columns.map((column, index) => ({
|
|
53
|
+
alignment: column.alignment ?? "left",
|
|
54
|
+
// table@6's word wrapper counts UTF-16 characters instead of display
|
|
55
|
+
// cells. Use its display-width-safe character wrapper for Unicode;
|
|
56
|
+
// unbounded identifiers never need wrapping in the first place.
|
|
57
|
+
wrapWord: column.width !== void 0 && data.every((row) => new RegExp("^\\p{ASCII}*$", "u").test(row[index])),
|
|
58
|
+
...column.width === void 0 ? {} : { width: column.width }
|
|
59
|
+
}))
|
|
60
|
+
}).split("\n").map((line) => line.trimEnd()).join("\n").trimEnd();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/cli/search-output.ts
|
|
64
|
+
function clipSummary(value) {
|
|
65
|
+
const characters = Array.from(value.replace(/\s+/gu, " ").trim());
|
|
66
|
+
return characters.length <= 78 ? characters.join("") : `${characters.slice(0, 77).join("")}\u2026`;
|
|
67
|
+
}
|
|
68
|
+
function pricingDisplay(item) {
|
|
69
|
+
const pricing = item.pricing;
|
|
70
|
+
if (!pricing)
|
|
71
|
+
return { cost: item.kind === "tool" ? "unknown" : "\u2014", notes: [] };
|
|
72
|
+
const range = pricing.estimatedRange;
|
|
73
|
+
if (range && item.billingSource !== "own_provider_credentials") {
|
|
74
|
+
return {
|
|
75
|
+
cost: `${range.minCreditsPerUnit}\u2013${range.maxCreditsPerUnit}/${pricing.unit} (estimate)`,
|
|
76
|
+
notes: [range.scope]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const observed = pricing.observedReference;
|
|
80
|
+
if (observed) {
|
|
81
|
+
return {
|
|
82
|
+
cost: `${observed.creditsPerCall}/call (observed)`,
|
|
83
|
+
notes: [
|
|
84
|
+
`Observed reference: ${observed.sampleSize} call(s), ${observed.observedAt}; ${observed.inputMode} Not a quote.`
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (item.billingSource === "own_provider_credentials") {
|
|
89
|
+
return {
|
|
90
|
+
cost: "0 (own credentials)",
|
|
91
|
+
notes: ["Your provider quota still applies."]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const display = pricing.displayText ?? "";
|
|
95
|
+
const rate = display.match(
|
|
96
|
+
/^([\d.,]+) Deepline credits(?: \/ \$[\d.,]+)? per (call|result|page)( \(estimate\))?$/
|
|
97
|
+
);
|
|
98
|
+
if (rate)
|
|
99
|
+
return {
|
|
100
|
+
cost: `${rate[1]}/${rate[2]}${rate[3] ?? ""}${pricing.summary || pricing.details?.length ? "*" : ""}`,
|
|
101
|
+
notes: []
|
|
102
|
+
};
|
|
103
|
+
if (pricing.creditsPerUnit === 0 && /^Free\b/.test(display)) {
|
|
104
|
+
return { cost: "0 (free)", notes: [] };
|
|
105
|
+
}
|
|
106
|
+
if (!display || display === "Pricing unavailable.")
|
|
107
|
+
return { cost: "unknown", notes: [] };
|
|
108
|
+
return {
|
|
109
|
+
cost: pricing.unit === "usage" ? "usage-based" : "variable",
|
|
110
|
+
notes: display ? [clipSummary(display)] : []
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function searchRow(item) {
|
|
114
|
+
const { cost, notes } = pricingDisplay(item);
|
|
115
|
+
if (item.credentialStatus === "requires_connection") {
|
|
116
|
+
notes.push("Requires your credentials \u2014 not connected (connect to use).");
|
|
117
|
+
} else if (item.connected === false && item.credentialStatus === "managed") {
|
|
118
|
+
notes.push("Temporarily unavailable.");
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
id: item.id,
|
|
122
|
+
kind: item.kind,
|
|
123
|
+
cost,
|
|
124
|
+
summary: clipSummary(item.description ?? ""),
|
|
125
|
+
notes
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function renderSearchResults(result) {
|
|
129
|
+
if (result.results.length === 0)
|
|
130
|
+
return renderCommandEnvelopeText(result);
|
|
131
|
+
const rows = result.results.map(searchRow);
|
|
132
|
+
const kinds = new Set(rows.map((row) => row.kind));
|
|
133
|
+
const onlyTools = kinds.size === 1 && kinds.has("tool");
|
|
134
|
+
const columns = [
|
|
135
|
+
{ header: onlyTools ? "TOOL" : "ID", value: (row) => row.id },
|
|
136
|
+
...!onlyTools ? [{ header: "KIND", value: (row) => row.kind }] : [],
|
|
137
|
+
{ header: "CREDITS", value: (row) => row.cost, alignment: "right" },
|
|
138
|
+
{ header: "SUMMARY", value: (row) => row.summary }
|
|
139
|
+
];
|
|
140
|
+
const render = result.render;
|
|
141
|
+
const title = render?.sections?.[0]?.title ?? `${result.total ?? rows.length} matches \u2014 showing ${rows.length}`;
|
|
142
|
+
const remaining = {
|
|
143
|
+
sections: render?.sections?.slice(1),
|
|
144
|
+
actions: render?.actions
|
|
145
|
+
};
|
|
146
|
+
const followUps = remaining.sections?.length || remaining.actions?.length ? `
|
|
147
|
+
${renderCommandEnvelopeText({ render: remaining })}` : "";
|
|
148
|
+
const notes = rows.flatMap(
|
|
149
|
+
(row) => row.notes.map((note) => ` ${row.id}: ${note}`)
|
|
150
|
+
);
|
|
151
|
+
const details = [
|
|
152
|
+
...notes.length ? ["Notes", ...notes, ""] : [],
|
|
153
|
+
...rows.some((row) => row.cost.endsWith("*")) ? [
|
|
154
|
+
"* Additional pricing conditions apply; see full pricing before execution."
|
|
155
|
+
] : [],
|
|
156
|
+
"Full descriptions and pricing: deepline tools describe <toolId> or search --json."
|
|
157
|
+
].join("\n");
|
|
158
|
+
return `${title}
|
|
159
|
+
|
|
160
|
+
${formatTextTable(rows, columns)}
|
|
161
|
+
|
|
162
|
+
${details}
|
|
163
|
+
${followUps}`;
|
|
164
|
+
}
|
|
165
|
+
|
|
39
166
|
// src/cli/commands/search.ts
|
|
40
167
|
var SEARCH_TYPES = [
|
|
41
168
|
"tools",
|
|
@@ -112,7 +239,8 @@ async function runSearch(queryInput, options, types, exclude = []) {
|
|
|
112
239
|
if (searchRef) rememberSearchRef(searchRef);
|
|
113
240
|
pointAtDescribe(result);
|
|
114
241
|
printCommandEnvelope(result, {
|
|
115
|
-
json: options.json === true
|
|
242
|
+
json: options.json === true,
|
|
243
|
+
text: renderSearchResults(result)
|
|
116
244
|
});
|
|
117
245
|
return 0;
|
|
118
246
|
}
|
|
@@ -166,6 +294,8 @@ Notes:
|
|
|
166
294
|
materially improves ranking, especially for short queries.
|
|
167
295
|
Search prints a readable result list by default, piped or not, and that is
|
|
168
296
|
the recommended form. Pass --json only when a program parses the result.
|
|
297
|
+
Readable prices are Deepline credits with a per-row unit. Estimates and
|
|
298
|
+
observed historical charges are labelled; usage-based prices are not quotes.
|
|
169
299
|
|
|
170
300
|
Examples:
|
|
171
301
|
deepline search "find work email"
|