deepline 0.3.409 → 0.3.410
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/agent-runtime.ts +18 -1
- package/dist/bundling-sources/sdk/src/client.ts +206 -333
- package/dist/bundling-sources/sdk/src/compat.ts +45 -2
- package/dist/bundling-sources/sdk/src/db/query.ts +9 -10
- package/dist/bundling-sources/sdk/src/http.ts +38 -20
- package/dist/bundling-sources/sdk/src/index.ts +4 -5
- package/dist/bundling-sources/sdk/src/play.ts +10 -10
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +6 -4
- package/dist/bundling-sources/sdk/src/plays/check-local-play-graph.ts +114 -0
- package/dist/bundling-sources/sdk/src/plays/client.ts +431 -0
- package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +2 -2
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +106 -16
- package/dist/bundling-sources/sdk/src/release.ts +13 -7
- package/dist/bundling-sources/sdk/src/runs/read-errors.ts +8 -0
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +124 -13
- package/dist/bundling-sources/sdk/src/tool-calls.ts +108 -19
- package/dist/bundling-sources/sdk/src/types.ts +18 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/execute-retry-contract.ts +37 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/package.json +3 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +277 -76
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/dataset-row-input.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +6 -62
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +67 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +64 -6
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +1 -5
- package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/egress-probe.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +26 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +36 -11
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +35 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +21 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +11 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +85 -20
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +71 -13
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-execution-queries.ts +100 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +9 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +337 -146
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +26 -12
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +425 -102
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +181 -124
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +152 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +5 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +31 -0
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +10 -0
- package/dist/bundling-sources/shared_libs/plays/ambiguous-write-error.ts +25 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +63 -68
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +129 -63
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
- package/dist/bundling-sources/shared_libs/plays/enrich-play-compiler.ts +58 -16
- package/dist/bundling-sources/shared_libs/plays/fetch-http-error.ts +50 -0
- package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +351 -0
- package/dist/bundling-sources/shared_libs/plays/tool-list-getter-mode.ts +9 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/cli/{auth-5HIIACF7.mjs → auth-LLXLIILR.mjs} +6 -6
- package/dist/cli/auth-UG4WOYGL.js +40 -0
- package/dist/cli/{billing-EVZ3ZWKC.mjs → billing-5FVXZYAC.mjs} +8 -8
- package/dist/cli/{billing-4275N7FL.js → billing-NFPK7GYP.js} +84 -84
- package/dist/cli/{chunk-ZAAKSJAS.js → chunk-27GJKC5Q.js} +17 -10
- package/dist/cli/{chunk-UHNDVD3P.js → chunk-2H4EY7KH.js} +100 -41
- package/dist/cli/{chunk-TQNHMWUR.mjs → chunk-2YR7BIIC.mjs} +5 -2
- package/dist/cli/{chunk-AU4OFDFX.js → chunk-36AHOWVS.js} +26 -26
- package/dist/cli/{chunk-OSDXE27V.mjs → chunk-4PG4ARL2.mjs} +17 -10
- package/dist/cli/{chunk-PBZYY7VZ.mjs → chunk-4XQLVUC7.mjs} +734 -511
- package/dist/cli/chunk-5TUGWDEB.js +313 -0
- package/dist/cli/{chunk-DEC3JECC.js → chunk-5UUQAGJS.js} +5 -2
- package/dist/cli/{chunk-JRAVVJ3T.mjs → chunk-5V5Y37BC.mjs} +2 -2
- package/dist/cli/{chunk-PMVFAYL7.mjs → chunk-63ILLN5H.mjs} +2 -2
- package/dist/cli/{chunk-V76R6HMV.js → chunk-63S7X326.js} +1029 -806
- package/dist/cli/{chunk-VWBTTJYQ.mjs → chunk-6PGATQ6L.mjs} +6 -3
- package/dist/cli/{chunk-6BJK4EJ3.mjs → chunk-AARWVK4C.mjs} +2132 -65
- package/dist/cli/{chunk-FERRDNMO.js → chunk-AD47BXN2.js} +5 -5
- package/dist/cli/{chunk-GAICVLKL.js → chunk-D37FEBES.js} +2 -2
- package/dist/cli/{chunk-S6R3OX7B.js → chunk-E4CABWXL.js} +25 -2
- package/dist/cli/{chunk-NXGCO4JB.mjs → chunk-E4IXDAZI.mjs} +5 -0
- package/dist/cli/chunk-EQ4Z7RJW.mjs +35 -0
- package/dist/cli/chunk-FR2ILQ4G.mjs +8 -0
- package/dist/cli/{chunk-FJCIUF34.js → chunk-FVLNYDI4.js} +128 -376
- package/dist/cli/{chunk-O3VSXP2F.js → chunk-FZJAM576.js} +50 -50
- package/dist/cli/{chunk-BZAMOCPA.mjs → chunk-IMZ56EOH.mjs} +3 -3
- package/dist/cli/{chunk-N44JHMKY.mjs → chunk-IPG42SD2.mjs} +452 -138
- package/dist/cli/chunk-J33TSWO5.js +8 -0
- package/dist/cli/{chunk-BEVLCKXG.mjs → chunk-JNXJZ577.mjs} +1 -1
- package/dist/cli/{chunk-JI2B4RZP.mjs → chunk-KCC3FKIW.mjs} +71 -12
- package/dist/cli/{chunk-6IKARAYD.mjs → chunk-L2VKAASU.mjs} +23 -0
- package/dist/cli/{chunk-WLOCMJWV.js → chunk-LTFL4JRN.js} +426 -721
- package/dist/cli/{chunk-YHPYUZZX.mjs → chunk-MAMVGOSC.mjs} +1 -1
- package/dist/cli/{chunk-NZSF57UO.mjs → chunk-MN2OWLFA.mjs} +2 -2
- package/dist/cli/{chunk-YD7B53RW.js → chunk-NF4V5DTY.js} +12 -12
- package/dist/cli/{chunk-Q2E4E4FJ.js → chunk-NPBJI7RE.js} +8 -8
- package/dist/cli/chunk-NTVLGHFM.js +501 -0
- package/dist/cli/{chunk-HQXL5526.mjs → chunk-NUX2QHNC.mjs} +1 -1
- package/dist/cli/{chunk-JGHG4NBA.js → chunk-OBB4QXHA.js} +19 -4
- package/dist/cli/{chunk-SEFMGO3Z.js → chunk-OQQOXSYA.js} +2184 -117
- package/dist/cli/chunk-OZ6E3IRZ.js +6084 -0
- package/dist/cli/{chunk-7P5AA3SN.js → chunk-PPDBRJRW.js} +6 -1
- package/dist/cli/{chunk-FHPCKULR.mjs → chunk-PZSLPBDA.mjs} +2 -2
- package/dist/cli/{chunk-ILHRA7AD.js → chunk-QADCFSGH.js} +7 -7
- package/dist/cli/{chunk-RTCDW2GU.js → chunk-QJI5FIOW.js} +170 -49
- package/dist/cli/{chunk-WYQO2CBS.mjs → chunk-QL22Y56M.mjs} +149 -28
- package/dist/cli/{chunk-2PRO2JTX.mjs → chunk-RFB25DSQ.mjs} +36 -284
- package/dist/cli/chunk-T44IIOT6.mjs +501 -0
- package/dist/cli/chunk-VK2LZ5IP.js +35 -0
- package/dist/cli/chunk-VKKVSFRD.js +62 -0
- package/dist/cli/{chunk-2GI3QD3L.js → chunk-VYKV5XHL.js} +644 -330
- package/dist/cli/{chunk-GSK6NHVM.js → chunk-WU4U6VSB.js} +5 -5
- package/dist/cli/chunk-XHLKJOTN.mjs +313 -0
- package/dist/cli/{chunk-IT3XBJQR.mjs → chunk-XIHWSXSV.mjs} +330 -625
- package/dist/cli/chunk-XNZJKRJA.mjs +6084 -0
- package/dist/cli/chunk-ZCALLYF6.mjs +62 -0
- package/dist/cli/{chunk-WHG43Z67.js → chunk-ZFZ427HN.js} +11 -8
- package/dist/cli/{chunk-J6DCKJNM.mjs → chunk-ZKYEW55U.mjs} +16 -1
- package/dist/cli/{csv-BBOTCGQY.js → csv-7U3FJYKZ.js} +14 -14
- package/dist/cli/{csv-A2MP6EFV.mjs → csv-ZWLDMM4A.mjs} +5 -5
- package/dist/cli/{db-G4CODDCA.js → db-DNCGV5PC.js} +42 -47
- package/dist/cli/{db-3W5DMTUX.mjs → db-IMYXVMGI.mjs} +15 -20
- package/dist/cli/{describe-XYJ2ZT4M.mjs → describe-Q23DWJUK.mjs} +20 -15
- package/dist/cli/{describe-PQTQ5B6F.js → describe-S34JUX5W.js} +27 -22
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +6 -6
- package/dist/cli/describe-core.mjs +5 -5
- package/dist/cli/{executions-UR67CA5H.mjs → executions-A73EUGSI.mjs} +8 -8
- package/dist/cli/{executions-TLANVR7Y.js → executions-XOMPX2YJ.js} +10 -10
- package/dist/cli/{feedback-WHCMGEIL.mjs → feedback-N4GJ2POI.mjs} +11 -7
- package/dist/cli/{feedback-6C2YTRJL.js → feedback-QTCHNJJH.js} +13 -9
- package/dist/cli/{git-GWLB6VSA.mjs → git-4Q3JIQYZ.mjs} +6 -6
- package/dist/cli/git-I6CPBEVG.js +24 -0
- package/dist/cli/index.js +236 -348
- package/dist/cli/index.mjs +162 -274
- package/dist/cli/{legacy-noops-KF4XIFEF.mjs → legacy-noops-3SOVGFF7.mjs} +6 -6
- package/dist/cli/{legacy-noops-ZUFA7RWI.js → legacy-noops-4OSHZM34.js} +9 -9
- package/dist/cli/{monitors-TB3K2IVE.js → monitors-LVE2KZNG.js} +94 -94
- package/dist/cli/{monitors-6UOIDIMB.mjs → monitors-QP2XID2B.mjs} +8 -8
- package/dist/cli/{org-WGHHMVDZ.mjs → org-IVRETVQA.mjs} +8 -8
- package/dist/cli/{org-CKWMBPIR.js → org-XFLK5IAP.js} +68 -68
- package/dist/cli/{play-LYPAXCLD.mjs → play-DE7VH6NU.mjs} +533 -98
- package/dist/cli/{play-N2B3KAVS.js → play-XXTPPP23.js} +1067 -632
- package/dist/cli/{providers-UR42MD6Z.js → providers-DLD3I4JF.js} +11 -11
- package/dist/cli/{providers-6DI5BVZJ.mjs → providers-GX2NIZQQ.mjs} +8 -8
- package/dist/cli/{quickstart-MNA2S6PO.mjs → quickstart-72B4L4PK.mjs} +5 -5
- package/dist/cli/{quickstart-FCJG4XGB.js → quickstart-XNS3HSWC.js} +7 -7
- package/dist/cli/search-6NCH4HB5.js +30 -0
- package/dist/cli/{search-VPPYUJ2M.mjs → search-SUTRANJI.mjs} +9 -9
- package/dist/cli/{secrets-QOSMVO36.js → secrets-6OBLOVEV.js} +17 -17
- package/dist/cli/{secrets-DRI4W7Z5.mjs → secrets-FPFXXNUH.mjs} +8 -8
- package/dist/cli/sessions-235532DR.js +16 -0
- package/dist/cli/{sessions-DQNUKP43.mjs → sessions-R25I4QKN.mjs} +6 -6
- package/dist/cli/{settings-DWDK3Y2R.mjs → settings-AOP6F5PZ.mjs} +12 -12
- package/dist/cli/{settings-JUGGCOPS.js → settings-VL5FOFPN.js} +79 -79
- package/dist/cli/{setup-AWBHNYXK.js → setup-BSC67YT3.js} +45 -44
- package/dist/cli/{setup-D5DWVNY4.mjs → setup-ZMPHBHVJ.mjs} +11 -10
- package/dist/cli/skills-3IWLYYRL.js +29 -0
- package/dist/cli/{skills-YV2XR35J.mjs → skills-KF65TVFO.mjs} +7 -7
- package/dist/cli/tools-LR66SPYU.js +44 -0
- package/dist/cli/{tools-VFJYHNV2.mjs → tools-SX4XIPM7.mjs} +19 -14
- package/dist/cli/{update-IM6VOTGL.mjs → update-QRMFRAQQ.mjs} +11 -9
- package/dist/cli/update-SP7UEO53.js +31 -0
- package/dist/cli/{workflow-26URBWPV.mjs → workflow-FOEEEB7G.mjs} +44 -20
- package/dist/cli/{workflow-3BS6U6SL.js → workflow-KOCK2FLW.js} +54 -30
- package/dist/{client-BfInrZPB.d.mts → client-74k4IPh6.d.mts} +135 -54
- package/dist/{client-BMjJFpan.d.ts → client-C1IK1f8c.d.ts} +135 -54
- package/dist/{compiler-manifest-Ycx-hoAr.d.mts → compiler-manifest-lzWpbV3w.d.mts} +83 -66
- package/dist/{compiler-manifest-Ycx-hoAr.d.ts → compiler-manifest-lzWpbV3w.d.ts} +83 -66
- package/dist/{index-CZXgiN3E.d.mts → index-C8Cy-YTm.d.ts} +5 -1
- package/dist/{index-NPG5pqxQ.d.ts → index-CtNK-0nI.d.mts} +5 -1
- package/dist/index.d.mts +47 -9
- package/dist/index.d.ts +47 -9
- package/dist/index.js +17 -14
- package/dist/index.mjs +13 -10
- package/dist/install-integrity.json +118 -102
- 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 +5 -4
- package/dist/plays/csv-data-input.js +3 -3
- package/dist/plays/csv-data-input.mjs +2 -2
- 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/plays/run-request.js +11 -3
- package/dist/plays/run-request.mjs +10 -2
- package/dist/release.d.mts +15 -6
- package/dist/release.d.ts +15 -6
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +2 -2
- package/dist/cli/auth-F6BX32XZ.js +0 -40
- package/dist/cli/chunk-264PC2RN.mjs +0 -83
- package/dist/cli/chunk-44ZTYHMQ.mjs +0 -155
- package/dist/cli/chunk-53HN7WZN.js +0 -392
- package/dist/cli/chunk-7AALNGTA.mjs +0 -392
- package/dist/cli/chunk-ALD4COBH.js +0 -155
- package/dist/cli/chunk-CLJGSOVM.mjs +0 -1716
- package/dist/cli/chunk-WNUR6VP5.js +0 -83
- package/dist/cli/chunk-Z4VNJOF7.js +0 -1716
- package/dist/cli/git-VQFF6D7C.js +0 -24
- package/dist/cli/search-NCEEONMQ.js +0 -30
- package/dist/cli/sessions-3WYKQABW.js +0 -16
- package/dist/cli/skills-AKPAJVSO.js +0 -29
- package/dist/cli/tools-RBKEK6PM.js +0 -39
- package/dist/cli/update-VFNUBLDA.js +0 -29
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
observedMaxText
|
|
3
|
-
} from "./chunk-LJ5747UC.mjs";
|
|
4
|
-
import {
|
|
5
|
-
DeeplineClient
|
|
6
|
-
} from "./chunk-PBZYY7VZ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
printCommandEnvelope,
|
|
9
|
-
renderCommandEnvelopeText
|
|
10
|
-
} from "./chunk-JRAVVJ3T.mjs";
|
|
11
|
-
import {
|
|
12
|
-
resolveConfig,
|
|
13
|
-
sdkCliStateDirPath
|
|
14
|
-
} from "./chunk-2PRO2JTX.mjs";
|
|
15
|
-
|
|
16
|
-
// src/cli/commands/search.ts
|
|
17
|
-
import { Option } from "commander";
|
|
18
|
-
|
|
19
|
-
// src/cli/search-ref.ts
|
|
20
|
-
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
21
|
-
import { dirname, join } from "path";
|
|
22
|
-
var SEARCH_REF_TTL_MS = 15 * 6e4;
|
|
23
|
-
function lastSearchPath() {
|
|
24
|
-
return join(sdkCliStateDirPath(resolveConfig().baseUrl), "last-search.json");
|
|
25
|
-
}
|
|
26
|
-
function rememberSearchRef(searchRef) {
|
|
27
|
-
try {
|
|
28
|
-
mkdirSync(dirname(lastSearchPath()), { recursive: true });
|
|
29
|
-
writeFileSync(
|
|
30
|
-
lastSearchPath(),
|
|
31
|
-
JSON.stringify({ searchRef, at: Date.now() }),
|
|
32
|
-
{ mode: 384 }
|
|
33
|
-
);
|
|
34
|
-
} catch {
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function recentSearchRef() {
|
|
38
|
-
try {
|
|
39
|
-
const saved = JSON.parse(readFileSync(lastSearchPath(), "utf8"));
|
|
40
|
-
return typeof saved.searchRef === "string" && typeof saved.at === "number" && Date.now() - saved.at < SEARCH_REF_TTL_MS ? saved.searchRef : void 0;
|
|
41
|
-
} catch {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/cli/text-table.ts
|
|
47
|
-
import { getBorderCharacters, table } from "table";
|
|
48
|
-
function formatTextTable(rows, columns) {
|
|
49
|
-
if (columns.length === 0) return "";
|
|
50
|
-
const data = [
|
|
51
|
-
columns.map((column) => column.header),
|
|
52
|
-
...rows.map((row) => columns.map((column) => column.value(row)))
|
|
53
|
-
];
|
|
54
|
-
return table(data, {
|
|
55
|
-
border: getBorderCharacters("void"),
|
|
56
|
-
drawHorizontalLine: () => false,
|
|
57
|
-
columnDefault: { paddingLeft: 0, paddingRight: 2 },
|
|
58
|
-
columns: columns.map((column, index) => ({
|
|
59
|
-
alignment: column.alignment ?? "left",
|
|
60
|
-
// table@6's word wrapper counts UTF-16 characters instead of display
|
|
61
|
-
// cells. Use its display-width-safe character wrapper for Unicode;
|
|
62
|
-
// unbounded identifiers never need wrapping in the first place.
|
|
63
|
-
wrapWord: column.width !== void 0 && data.every((row) => new RegExp("^\\p{ASCII}*$", "u").test(row[index])),
|
|
64
|
-
...column.width === void 0 ? {} : { width: column.width }
|
|
65
|
-
}))
|
|
66
|
-
}).split("\n").map((line) => line.trimEnd()).join("\n").trimEnd();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// src/cli/search-output.ts
|
|
70
|
-
function clipSummary(value) {
|
|
71
|
-
const characters = Array.from(value.replace(/\s+/gu, " ").trim());
|
|
72
|
-
return characters.length <= 78 ? characters.join("") : `${characters.slice(0, 77).join("")}\u2026`;
|
|
73
|
-
}
|
|
74
|
-
function pricingDisplay(item) {
|
|
75
|
-
const pricing = item.pricing;
|
|
76
|
-
const observedCost = item.observedCost;
|
|
77
|
-
if (observedCost) {
|
|
78
|
-
return observedCost.status === "available" ? {
|
|
79
|
-
cost: `${observedCost.avgCredits}/${observedCost.unit} (observed)`,
|
|
80
|
-
// Unclipped: the sample size at the end is what qualifies the figure.
|
|
81
|
-
notes: [`Cost: ${observedCost.displayText}`]
|
|
82
|
-
} : { cost: "no data yet", notes: [] };
|
|
83
|
-
}
|
|
84
|
-
if (!pricing)
|
|
85
|
-
return { cost: item.kind === "tool" ? "unknown" : "\u2014", notes: [] };
|
|
86
|
-
const range = pricing.estimatedRange;
|
|
87
|
-
if (range && item.billingSource !== "own_provider_credentials") {
|
|
88
|
-
return {
|
|
89
|
-
cost: `${range.minCreditsPerUnit}\u2013${range.maxCreditsPerUnit}/${pricing.unit} (estimate)`,
|
|
90
|
-
notes: [range.scope]
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
const observed = pricing.observedReference;
|
|
94
|
-
if (observed) {
|
|
95
|
-
return {
|
|
96
|
-
cost: `${observed.creditsPerCall}/call (observed)`,
|
|
97
|
-
notes: [
|
|
98
|
-
`Observed reference: ${observed.sampleSize} call(s), ${observed.observedAt}; ${observed.inputMode} Not a quote.`
|
|
99
|
-
]
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
if (item.billingSource === "own_provider_credentials") {
|
|
103
|
-
return {
|
|
104
|
-
cost: "0 (own credentials)",
|
|
105
|
-
notes: ["Your provider quota still applies."]
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
const display = pricing.displayText ?? "";
|
|
109
|
-
const rate = display.match(
|
|
110
|
-
/^([\d.,]+) Deepline credits(?: \/ \$[\d.,]+)? per (call|result|page)( \(estimate\))?$/
|
|
111
|
-
);
|
|
112
|
-
if (rate)
|
|
113
|
-
return {
|
|
114
|
-
cost: `${rate[1]}/${rate[2]}${rate[3] ?? ""}${pricing.summary || pricing.details?.length ? "*" : ""}`,
|
|
115
|
-
notes: []
|
|
116
|
-
};
|
|
117
|
-
if (pricing.creditsPerUnit === 0 && /^Free\b/.test(display)) {
|
|
118
|
-
return { cost: "0 (free)", notes: [] };
|
|
119
|
-
}
|
|
120
|
-
if (!display || display === "Pricing unavailable.")
|
|
121
|
-
return { cost: "unknown", notes: [] };
|
|
122
|
-
return {
|
|
123
|
-
cost: pricing.unit === "usage" ? "usage-based" : "variable",
|
|
124
|
-
notes: display ? [clipSummary(display)] : []
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
var RATE_WINDOW_UNITS = {
|
|
128
|
-
1e3: "s",
|
|
129
|
-
6e4: "min",
|
|
130
|
-
36e5: "hr"
|
|
131
|
-
};
|
|
132
|
-
function rateLimitDisplay(item) {
|
|
133
|
-
const limits = (Array.isArray(item.rateLimits) ? item.rateLimits : []).filter(
|
|
134
|
-
(limit) => typeof limit?.requestsPerWindow === "number" && typeof limit?.windowMs === "number" && limit.windowMs > 0
|
|
135
|
-
);
|
|
136
|
-
const [tightest] = limits.sort(
|
|
137
|
-
(a, b) => a.requestsPerWindow / a.windowMs - b.requestsPerWindow / b.windowMs
|
|
138
|
-
);
|
|
139
|
-
return tightest ? `${tightest.requestsPerWindow}/${RATE_WINDOW_UNITS[tightest.windowMs] ?? `${tightest.windowMs / 1e3}s`}` : "\u2014";
|
|
140
|
-
}
|
|
141
|
-
function failureRateDisplay(rate) {
|
|
142
|
-
if (typeof rate !== "number") return "\u2014";
|
|
143
|
-
const percent = Math.round(rate * 100);
|
|
144
|
-
return percent === 0 && rate > 0 ? "<1%" : `${percent}%`;
|
|
145
|
-
}
|
|
146
|
-
function searchRow(item) {
|
|
147
|
-
const { cost, notes } = pricingDisplay(item);
|
|
148
|
-
const observedMax = item.billingSource === "own_provider_credentials" ? "" : observedMaxText(item.pricing);
|
|
149
|
-
if (observedMax)
|
|
150
|
-
notes.push(`${observedMax[0].toUpperCase()}${observedMax.slice(1)}.`);
|
|
151
|
-
if (item.credentialStatus === "requires_connection") {
|
|
152
|
-
notes.push("Requires your credentials \u2014 not connected (connect to use).");
|
|
153
|
-
} else if (item.connected === false && item.credentialStatus === "managed") {
|
|
154
|
-
notes.push("Temporarily unavailable.");
|
|
155
|
-
}
|
|
156
|
-
return {
|
|
157
|
-
id: item.id,
|
|
158
|
-
kind: item.kind,
|
|
159
|
-
cost,
|
|
160
|
-
rateLimit: rateLimitDisplay(item),
|
|
161
|
-
// Production share of errored or rate-limited calls; absent when too few
|
|
162
|
-
// calls or orgs used the tool to say.
|
|
163
|
-
failureRate: failureRateDisplay(item.failureRate),
|
|
164
|
-
summary: clipSummary(item.description ?? ""),
|
|
165
|
-
notes
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function renderSearchResults(result) {
|
|
169
|
-
if (result.results.length === 0)
|
|
170
|
-
return renderCommandEnvelopeText(result);
|
|
171
|
-
const rows = result.results.map(searchRow);
|
|
172
|
-
const kinds = new Set(rows.map((row) => row.kind));
|
|
173
|
-
const onlyTools = kinds.size === 1 && kinds.has("tool");
|
|
174
|
-
const columns = [
|
|
175
|
-
{ header: onlyTools ? "TOOL" : "ID", value: (row) => row.id },
|
|
176
|
-
...!onlyTools ? [{ header: "KIND", value: (row) => row.kind }] : [],
|
|
177
|
-
{ header: "CREDITS", value: (row) => row.cost, alignment: "right" },
|
|
178
|
-
...rows.some((row) => row.rateLimit !== "\u2014") ? [
|
|
179
|
-
{
|
|
180
|
-
header: "RATE LIMIT",
|
|
181
|
-
value: (row) => row.rateLimit,
|
|
182
|
-
alignment: "right"
|
|
183
|
-
}
|
|
184
|
-
] : [],
|
|
185
|
-
...rows.some((row) => row.failureRate !== "\u2014") ? [
|
|
186
|
-
{
|
|
187
|
-
header: "FAILURES",
|
|
188
|
-
value: (row) => row.failureRate,
|
|
189
|
-
alignment: "right"
|
|
190
|
-
}
|
|
191
|
-
] : [],
|
|
192
|
-
{ header: "SUMMARY", value: (row) => row.summary }
|
|
193
|
-
];
|
|
194
|
-
const render = result.render;
|
|
195
|
-
const title = render?.sections?.[0]?.title ?? `${result.total ?? rows.length} matches \u2014 showing ${rows.length}`;
|
|
196
|
-
const remaining = {
|
|
197
|
-
sections: render?.sections?.slice(1),
|
|
198
|
-
actions: render?.actions
|
|
199
|
-
};
|
|
200
|
-
const followUps = remaining.sections?.length || remaining.actions?.length ? `
|
|
201
|
-
${renderCommandEnvelopeText({ render: remaining })}` : "";
|
|
202
|
-
const notes = rows.flatMap(
|
|
203
|
-
(row) => row.notes.map((note) => ` ${row.id}: ${note}`)
|
|
204
|
-
);
|
|
205
|
-
const details = [
|
|
206
|
-
...notes.length ? ["Notes", ...notes, ""] : [],
|
|
207
|
-
...rows.some((row) => row.cost.endsWith("*")) ? [
|
|
208
|
-
"* Additional pricing conditions apply; see full pricing before execution."
|
|
209
|
-
] : [],
|
|
210
|
-
"Full descriptions and pricing: deepline describe <toolId>."
|
|
211
|
-
].join("\n");
|
|
212
|
-
return `${title}
|
|
213
|
-
|
|
214
|
-
${formatTextTable(rows, columns)}
|
|
215
|
-
|
|
216
|
-
${details}
|
|
217
|
-
${followUps}`;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/cli/commands/search.ts
|
|
221
|
-
var SEARCH_TYPES = [
|
|
222
|
-
"tools",
|
|
223
|
-
"plays",
|
|
224
|
-
"monitors",
|
|
225
|
-
"prebuilts",
|
|
226
|
-
"custom"
|
|
227
|
-
];
|
|
228
|
-
var USAGE = "Usage: deepline search [task] [--type <types>] [--categories <categories>] [--search_terms <terms>] [--json]";
|
|
229
|
-
function parseTypes(flag, raw) {
|
|
230
|
-
const names = (raw ?? "").split(",").map((name) => name.trim().toLowerCase()).filter(Boolean);
|
|
231
|
-
const unknown = names.filter(
|
|
232
|
-
(name) => !SEARCH_TYPES.includes(name)
|
|
233
|
-
);
|
|
234
|
-
if (unknown.length > 0) {
|
|
235
|
-
throw new Error(
|
|
236
|
-
`Unknown ${flag} ${unknown.join(", ")}. Use any of: ${SEARCH_TYPES.join(", ")}.`
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
return names;
|
|
240
|
-
}
|
|
241
|
-
function optionalInteger(raw) {
|
|
242
|
-
return raw === void 0 ? void 0 : Number.parseInt(raw, 10);
|
|
243
|
-
}
|
|
244
|
-
function appendCsv(value, previous) {
|
|
245
|
-
return previous ? `${previous},${value}` : value;
|
|
246
|
-
}
|
|
247
|
-
function addSearchOptions(command) {
|
|
248
|
-
return command.option(
|
|
249
|
-
"--categories <categories>",
|
|
250
|
-
"Comma-separated tool categories; may be used without a task"
|
|
251
|
-
).option(
|
|
252
|
-
"--search_terms <terms>",
|
|
253
|
-
"Comma-separated structured search terms; may be used without a task"
|
|
254
|
-
).option("--search-terms <terms>", "Alias for --search_terms").addOption(new Option("--task <sentence>").hideHelp()).option("--limit <count>", "Maximum ranked results to return (1-50)").option("--offset <count>", "Zero-based ranked result offset").option("--search-mode <mode>", "Ranked search mode: v1 or v2").option("--include-search-debug", "Include ranked search debug metadata").option("--json", "Emit JSON output instead of the readable default");
|
|
255
|
-
}
|
|
256
|
-
function pointAtDescribe(result) {
|
|
257
|
-
const old = /`deepline (tools|plays) describe [^`]*`/;
|
|
258
|
-
const render = result.render;
|
|
259
|
-
for (const section of render?.sections ?? []) {
|
|
260
|
-
if (!section.lines?.some((line) => old.test(line))) continue;
|
|
261
|
-
section.lines = [
|
|
262
|
-
"Run `deepline describe <id>` before executing a tool or running a play.",
|
|
263
|
-
...section.lines.filter((line) => !old.test(line))
|
|
264
|
-
];
|
|
265
|
-
}
|
|
266
|
-
const templates = result.commandTemplates;
|
|
267
|
-
for (const template of Object.values(templates ?? {})) {
|
|
268
|
-
if (template.describe) template.describe = "deepline describe <id>";
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
async function runSearch(queryInput, options, types, exclude = []) {
|
|
272
|
-
const query = queryInput?.trim() ?? "";
|
|
273
|
-
const searchTerms = options.searchTerms ?? options.search_terms;
|
|
274
|
-
if (!query && !options.categories?.trim() && !searchTerms?.trim()) {
|
|
275
|
-
console.error(USAGE);
|
|
276
|
-
return 1;
|
|
277
|
-
}
|
|
278
|
-
const { search_ref: searchRef, ...result } = await new DeeplineClient().search({
|
|
279
|
-
query,
|
|
280
|
-
types,
|
|
281
|
-
exclude,
|
|
282
|
-
categories: options.categories,
|
|
283
|
-
searchTerms,
|
|
284
|
-
task: options.task,
|
|
285
|
-
limit: optionalInteger(options.limit),
|
|
286
|
-
offset: optionalInteger(options.offset),
|
|
287
|
-
searchMode: options.searchMode === "v1" || options.searchMode === "v2" ? options.searchMode : void 0,
|
|
288
|
-
includeSearchDebug: Boolean(options.includeSearchDebug)
|
|
289
|
-
});
|
|
290
|
-
if (searchRef) rememberSearchRef(searchRef);
|
|
291
|
-
pointAtDescribe(result);
|
|
292
|
-
printCommandEnvelope(result, {
|
|
293
|
-
json: options.json === true,
|
|
294
|
-
text: renderSearchResults(result)
|
|
295
|
-
});
|
|
296
|
-
return 0;
|
|
297
|
-
}
|
|
298
|
-
function registerDeprecatedSearchCommand(parent, typesFor) {
|
|
299
|
-
const name = `deepline ${parent.name()} search`;
|
|
300
|
-
addSearchOptions(
|
|
301
|
-
parent.command("search [task]").description(`Deprecated. Use deepline search --type <types>.`).addHelpText(
|
|
302
|
-
"after",
|
|
303
|
-
`
|
|
304
|
-
Notes:
|
|
305
|
-
Deprecated alias for the unified search. It runs deepline search with the
|
|
306
|
-
matching --type and returns the same results envelope.
|
|
307
|
-
|
|
308
|
-
Examples:
|
|
309
|
-
deepline search "name and company domain -> work email" --type ${typesFor({}).join(",")}
|
|
310
|
-
`
|
|
311
|
-
).option("--all", "Include plays your workspace created").option("--compact", "Accepted for compatibility; results are compact")
|
|
312
|
-
).action(async (query, options) => {
|
|
313
|
-
const types = typesFor(options);
|
|
314
|
-
console.error(
|
|
315
|
-
`${name} is deprecated. Use: deepline search${query ? ` ${JSON.stringify(query)}` : ""} --type ${types.join(",")}`
|
|
316
|
-
);
|
|
317
|
-
process.exitCode = await runSearch(query, options, types);
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
function registerSearchCommand(program) {
|
|
321
|
-
addSearchOptions(
|
|
322
|
-
program.command("search [task]").description(
|
|
323
|
-
"Search tools, monitors, and plays together, ranked by intent."
|
|
324
|
-
).addHelpText(
|
|
325
|
-
"after",
|
|
326
|
-
`
|
|
327
|
-
Notes:
|
|
328
|
-
One ranked search across everything Deepline can run, deploy, or explain.
|
|
329
|
-
Every result carries a kind: tool, monitor_type, prebuilt_play, custom_play
|
|
330
|
-
(a play your workspace created), or doc. Narrow with --type, a
|
|
331
|
-
comma-separated list of:
|
|
332
|
-
tools atomic provider operations (deepline tools execute)
|
|
333
|
-
monitors monitor types you can deploy
|
|
334
|
-
prebuilts Deepline-maintained plays
|
|
335
|
-
custom plays your workspace created
|
|
336
|
-
plays prebuilts and custom together
|
|
337
|
-
--exclude takes the same names and leaves those kinds out instead.
|
|
338
|
-
Ranking uses a third-party AI relevance model. For plays your workspace
|
|
339
|
-
created it is sent only the play name and description, never play code.
|
|
340
|
-
Both flags may be repeated: --type tools --type prebuilts.
|
|
341
|
-
The task is one sentence on what you are trying to accomplish, written as
|
|
342
|
-
the input you have -> the result you need. Do not send keywords: the
|
|
343
|
-
sentence is what ranks the results. Omit it only when --categories and/or
|
|
344
|
-
--search_terms is supplied. Use --limit and --offset to page (limit 1-50,
|
|
345
|
-
offset zero-based); JSON includes next_offset.
|
|
346
|
-
Search prints a readable result list by default, and that is
|
|
347
|
-
the recommended form. Pass --json only when a program parses the result.
|
|
348
|
-
Readable prices are Deepline credits with a per-row unit. Estimates and
|
|
349
|
-
observed historical charges are labelled; usage-based prices are not quotes.
|
|
350
|
-
RATE LIMIT is the tightest request rate Deepline paces the tool at; a dash
|
|
351
|
-
means none is declared, not that the tool is unlimited.
|
|
352
|
-
|
|
353
|
-
Examples:
|
|
354
|
-
deepline search "first name, last name and company domain -> verified work email"
|
|
355
|
-
deepline search "200 LinkedIn profile URLs -> each person's current title and company" --type tools --limit 10
|
|
356
|
-
deepline search "company domain -> contacts in sales leadership" --type plays
|
|
357
|
-
deepline search "company domain -> headcount, funding and industry" --exclude monitors,custom
|
|
358
|
-
deepline search --type tools --categories company_search --search_terms "investors,funding"
|
|
359
|
-
`
|
|
360
|
-
).option(
|
|
361
|
-
"--type <types>",
|
|
362
|
-
`Kinds to search, comma-separated or repeated: ${SEARCH_TYPES.join(", ")}`,
|
|
363
|
-
appendCsv
|
|
364
|
-
).option(
|
|
365
|
-
"--exclude <types>",
|
|
366
|
-
"Kinds to leave out, comma-separated or repeated; the opposite of --type",
|
|
367
|
-
appendCsv
|
|
368
|
-
)
|
|
369
|
-
).action(async (query, options) => {
|
|
370
|
-
let types;
|
|
371
|
-
let exclude;
|
|
372
|
-
try {
|
|
373
|
-
types = parseTypes("--type", options.type);
|
|
374
|
-
exclude = parseTypes("--exclude", options.exclude);
|
|
375
|
-
} catch (error) {
|
|
376
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
377
|
-
process.exitCode = 1;
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
process.exitCode = await runSearch(query, options, types, exclude);
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
export {
|
|
385
|
-
recentSearchRef,
|
|
386
|
-
SEARCH_TYPES,
|
|
387
|
-
parseTypes,
|
|
388
|
-
appendCsv,
|
|
389
|
-
pointAtDescribe,
|
|
390
|
-
registerDeprecatedSearchCommand,
|
|
391
|
-
registerSearchCommand
|
|
392
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; } var _class;
|
|
2
|
-
|
|
3
|
-
var _chunkYD7B53RWjs = require('./chunk-YD7B53RW.js');
|
|
4
|
-
|
|
5
|
-
// src/cli/progress.ts
|
|
6
|
-
var _worker_threads = require('worker_threads');
|
|
7
|
-
var CliProgress = (_class = class {
|
|
8
|
-
__init() {this.lastMessage = null}
|
|
9
|
-
__init2() {this.interactive = Boolean(process.stderr.isTTY)}
|
|
10
|
-
__init3() {this.grey = "\x1B[90m"}
|
|
11
|
-
__init4() {this.cyan = "\x1B[36m"}
|
|
12
|
-
__init5() {this.dim = "\x1B[2m"}
|
|
13
|
-
__init6() {this.reset = "\x1B[0m"}
|
|
14
|
-
__init7() {this.worker = null}
|
|
15
|
-
|
|
16
|
-
// --json output is one JSON document: progress never renders under it.
|
|
17
|
-
constructor(enabled) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);
|
|
18
|
-
this.enabled = enabled && !_chunkYD7B53RWjs.isJsonOutputMode.call(void 0, );
|
|
19
|
-
}
|
|
20
|
-
phase(message) {
|
|
21
|
-
if (!this.enabled || this.lastMessage === message) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (this.interactive && this.lastMessage) {
|
|
25
|
-
this.settle("\u2713");
|
|
26
|
-
}
|
|
27
|
-
this.lastMessage = message;
|
|
28
|
-
if (!this.interactive) {
|
|
29
|
-
process.stderr.write(`${message}
|
|
30
|
-
`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
this.ensureWorker();
|
|
34
|
-
_optionalChain([this, 'access', _ => _.worker, 'optionalAccess', _2 => _2.postMessage, 'call', _3 => _3({ type: "phase", message })]);
|
|
35
|
-
}
|
|
36
|
-
complete() {
|
|
37
|
-
this.settle("\u2713");
|
|
38
|
-
}
|
|
39
|
-
fail() {
|
|
40
|
-
this.settle("\u2717");
|
|
41
|
-
}
|
|
42
|
-
writeLogLine(line) {
|
|
43
|
-
if (_chunkYD7B53RWjs.isJsonOutputMode.call(void 0, )) return;
|
|
44
|
-
if (!this.enabled) {
|
|
45
|
-
process.stderr.write(`${line}
|
|
46
|
-
`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const message = this.interactive ? `${this.cyan}[logs]${this.reset} ${this.dim}${line}${this.reset}` : `[logs] ${line}`;
|
|
50
|
-
if (!this.interactive) {
|
|
51
|
-
process.stderr.write(`${message}
|
|
52
|
-
`);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const activeMessage = this.lastMessage;
|
|
56
|
-
_optionalChain([this, 'access', _4 => _4.worker, 'optionalAccess', _5 => _5.terminate, 'call', _6 => _6(), 'access', _7 => _7.catch, 'call', _8 => _8(() => void 0)]);
|
|
57
|
-
this.worker = null;
|
|
58
|
-
process.stderr.write(`\r\x1B[2K${message}
|
|
59
|
-
`);
|
|
60
|
-
if (activeMessage) {
|
|
61
|
-
this.startWorker().postMessage({ type: "phase", message: activeMessage });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
writeLine(line, stream = process.stderr) {
|
|
65
|
-
if (!this.enabled || !this.interactive) {
|
|
66
|
-
stream.write(`${line}
|
|
67
|
-
`);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const activeMessage = this.lastMessage;
|
|
71
|
-
_optionalChain([this, 'access', _9 => _9.worker, 'optionalAccess', _10 => _10.terminate, 'call', _11 => _11(), 'access', _12 => _12.catch, 'call', _13 => _13(() => void 0)]);
|
|
72
|
-
this.worker = null;
|
|
73
|
-
stream.write(`\r\x1B[2K${line}
|
|
74
|
-
`);
|
|
75
|
-
if (activeMessage) {
|
|
76
|
-
this.startWorker().postMessage({ type: "phase", message: activeMessage });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
settle(mark) {
|
|
80
|
-
if (!this.enabled || !this.lastMessage) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (this.interactive) {
|
|
84
|
-
_optionalChain([this, 'access', _14 => _14.worker, 'optionalAccess', _15 => _15.terminate, 'call', _16 => _16(), 'access', _17 => _17.catch, 'call', _18 => _18(() => void 0)]);
|
|
85
|
-
this.worker = null;
|
|
86
|
-
process.stderr.write(
|
|
87
|
-
`\r\x1B[2K${this.grey}${mark} ${this.lastMessage}${this.reset}
|
|
88
|
-
`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
this.lastMessage = null;
|
|
92
|
-
}
|
|
93
|
-
ensureWorker() {
|
|
94
|
-
this.startWorker();
|
|
95
|
-
}
|
|
96
|
-
startWorker() {
|
|
97
|
-
if (this.worker) {
|
|
98
|
-
return this.worker;
|
|
99
|
-
}
|
|
100
|
-
this.worker = new (0, _worker_threads.Worker)(
|
|
101
|
-
`
|
|
102
|
-
const { parentPort } = require('node:worker_threads');
|
|
103
|
-
const { writeSync } = require('node:fs');
|
|
104
|
-
const frames = ['\u2014', '\\\\', '|', '/'];
|
|
105
|
-
const grey = '\\x1b[90m';
|
|
106
|
-
const reset = '\\x1b[0m';
|
|
107
|
-
let message = '';
|
|
108
|
-
let frameIndex = 0;
|
|
109
|
-
let timer = null;
|
|
110
|
-
function render() {
|
|
111
|
-
if (!message) return;
|
|
112
|
-
const frame = frames[frameIndex % frames.length] || '\u2014';
|
|
113
|
-
frameIndex += 1;
|
|
114
|
-
writeSync(2, '\\r\\x1b[2K' + grey + frame + ' ' + message + reset);
|
|
115
|
-
}
|
|
116
|
-
parentPort.on('message', (event) => {
|
|
117
|
-
if (event.type === 'phase') {
|
|
118
|
-
message = String(event.message || '');
|
|
119
|
-
frameIndex = 0;
|
|
120
|
-
render();
|
|
121
|
-
if (!timer) {
|
|
122
|
-
timer = setInterval(render, 120);
|
|
123
|
-
timer.unref && timer.unref();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (event.type === 'stop') {
|
|
127
|
-
if (timer) clearInterval(timer);
|
|
128
|
-
timer = null;
|
|
129
|
-
writeSync(2, '\\r\\x1b[2K');
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
`,
|
|
133
|
-
{ eval: true }
|
|
134
|
-
);
|
|
135
|
-
this.worker.unref();
|
|
136
|
-
return this.worker;
|
|
137
|
-
}
|
|
138
|
-
}, _class);
|
|
139
|
-
var activeProgress = null;
|
|
140
|
-
function setActiveCliProgress(progress) {
|
|
141
|
-
activeProgress = progress;
|
|
142
|
-
}
|
|
143
|
-
function getActiveCliProgress() {
|
|
144
|
-
return activeProgress;
|
|
145
|
-
}
|
|
146
|
-
function createCliProgress(enabled) {
|
|
147
|
-
const progress = new CliProgress(enabled);
|
|
148
|
-
setActiveCliProgress(progress);
|
|
149
|
-
return progress;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
exports.getActiveCliProgress = getActiveCliProgress; exports.createCliProgress = createCliProgress;
|