deepline 0.3.503 → 0.3.505
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/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +5 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +35 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +144 -7
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +18 -0
- package/dist/bundling-sources/shared_libs/product-notifications/onboarding-unsubscribe.ts +23 -0
- package/dist/cli/{auth-IC4WLSE3.mjs → auth-AHE2EDQA.mjs} +5 -5
- package/dist/cli/auth-SEPKNRHV.js +43 -0
- package/dist/cli/{billing-2VOV64SD.mjs → billing-7CPWTGGI.mjs} +19 -12
- package/dist/cli/{billing-LWQOII22.js → billing-JOIZPHON.js} +92 -85
- package/dist/cli/{chunk-33JUK73X.js → chunk-3YEOOXD4.js} +96 -37
- package/dist/cli/{chunk-FVDTERO2.js → chunk-45XYW477.js} +21 -21
- package/dist/cli/{chunk-5GI6NKOE.mjs → chunk-4OFSAZN6.mjs} +1 -1
- package/dist/cli/{chunk-D27HP3HS.mjs → chunk-52FPW2RD.mjs} +2 -2
- package/dist/cli/chunk-5LUF4LAR.mjs +209 -0
- package/dist/cli/{chunk-VC5B462T.mjs → chunk-5XT4DZQL.mjs} +2 -2
- package/dist/cli/{chunk-26RSSTCF.js → chunk-6FEN6VWZ.js} +26 -26
- package/dist/cli/{chunk-7HEDCIR3.mjs → chunk-6U3AGJWI.mjs} +1 -1
- package/dist/cli/{chunk-KPBBT6OS.mjs → chunk-7AD565DO.mjs} +1 -1
- package/dist/cli/{chunk-FZHOWPSN.js → chunk-7DDACLMX.js} +16 -16
- package/dist/cli/{chunk-ZEQPCEV4.mjs → chunk-7DDKLFOY.mjs} +3 -3
- package/dist/cli/{chunk-WHP3FJ7T.js → chunk-7QLK2GHL.js} +5 -5
- package/dist/cli/{chunk-BI2Q45SY.mjs → chunk-ACI6CUDX.mjs} +11 -401
- package/dist/cli/{chunk-C5RQTTLP.js → chunk-BWAYMJ23.js} +7 -7
- package/dist/cli/{chunk-YXGPMTAK.js → chunk-CA3SYXCS.js} +2 -2
- package/dist/cli/{chunk-J6RBOLK7.mjs → chunk-CSLLQWAB.mjs} +1 -1
- package/dist/cli/{chunk-F73PD2XD.js → chunk-EMUFF6EU.js} +7 -7
- package/dist/cli/chunk-FIQ5UEIF.mjs +405 -0
- package/dist/cli/{chunk-2626LTU3.js → chunk-GAUNJCXQ.js} +96 -96
- package/dist/cli/{chunk-A2C6ONWA.js → chunk-GXMNOUHP.js} +6 -6
- package/dist/cli/{chunk-MJQOG4TZ.js → chunk-HASFFOSU.js} +16 -16
- package/dist/cli/{chunk-TCQYWZFS.js → chunk-IDAE5VDH.js} +5 -5
- package/dist/cli/{chunk-JJVN7OIX.mjs → chunk-IZYOYXG7.mjs} +4 -4
- package/dist/cli/{chunk-FHJ54BHH.mjs → chunk-JA7YBRP4.mjs} +1 -1
- package/dist/cli/{chunk-HRTDCXHI.js → chunk-JSTKLYYD.js} +2 -2
- package/dist/cli/{chunk-5M5WSFRZ.mjs → chunk-JVKEZT7L.mjs} +48 -8
- package/dist/cli/{chunk-4IIYSBEP.js → chunk-K26YOPDO.js} +50 -10
- package/dist/cli/{chunk-2K2QBLYO.js → chunk-LC4FG34E.js} +53 -53
- package/dist/cli/{chunk-XYZZZLN6.mjs → chunk-MAFZ64RN.mjs} +2 -2
- package/dist/cli/{chunk-B3X4YWQ6.js → chunk-MHZAG2ZQ.js} +80 -470
- package/dist/cli/{chunk-DPI5OYVU.mjs → chunk-NARJWXBR.mjs} +2 -2
- package/dist/cli/{chunk-GLZBFBJS.mjs → chunk-OA6U5NVB.mjs} +5 -5
- package/dist/cli/{chunk-URZNSJE2.mjs → chunk-OMEDQ77C.mjs} +93 -34
- package/dist/cli/{chunk-QIEYEY6Z.js → chunk-OORPAQVC.js} +8 -8
- package/dist/cli/{chunk-WS274KID.mjs → chunk-PDLOPF5L.mjs} +1 -1
- package/dist/cli/{chunk-KGLVATEB.mjs → chunk-PZN24YQQ.mjs} +2 -2
- package/dist/cli/{chunk-GIHNEYBG.mjs → chunk-QGNNAZ5M.mjs} +1 -1
- package/dist/cli/chunk-QYGYVCRI.js +405 -0
- package/dist/cli/chunk-R7J7CJPZ.js +209 -0
- package/dist/cli/{chunk-6XTE6C3W.mjs → chunk-RT3HJBIH.mjs} +12 -12
- package/dist/cli/{chunk-L3TZV625.mjs → chunk-SHKRL7CW.mjs} +1 -1
- package/dist/cli/{chunk-FIUTDSJX.js → chunk-SPN7U3MV.js} +4 -4
- package/dist/cli/{chunk-EQ3WMKFY.mjs → chunk-UZ24SF7N.mjs} +5 -5
- package/dist/cli/{chunk-AARF4SOW.js → chunk-VXKWF3AD.js} +9 -9
- package/dist/cli/{chunk-JPDD4Y53.mjs → chunk-W6I4N4JN.mjs} +6 -6
- package/dist/cli/{chunk-PVA3MWCO.js → chunk-WPCF7C6B.js} +3 -3
- package/dist/cli/{chunk-3CXHK4TW.js → chunk-WTQLUULB.js} +6 -6
- package/dist/cli/{chunk-EDMV4JT5.mjs → chunk-WTUC5VKB.mjs} +2 -2
- package/dist/cli/{chunk-IIP46RVC.js → chunk-XHPB6RGY.js} +1 -1
- package/dist/cli/{chunk-RVOBFO7C.js → chunk-Y52XY56V.js} +41 -41
- package/dist/cli/{chunk-K7NFFQFU.mjs → chunk-YBIVVAL7.mjs} +2 -2
- package/dist/cli/{chunk-HS63YBT5.js → chunk-ZLN2B5YA.js} +3 -3
- package/dist/cli/command-docs.d.mts +2 -1
- package/dist/cli/command-docs.d.ts +2 -1
- package/dist/cli/command-docs.js +6 -2
- package/dist/cli/command-docs.mjs +5 -1
- package/dist/cli/{csv-NEWCNOSZ.js → csv-DZHVIW3G.js} +13 -13
- package/dist/cli/{csv-2TXOI3UE.mjs → csv-WTPI6ZON.mjs} +4 -4
- package/dist/cli/{db-J3IJS4OG.js → db-D7LPPNCC.js} +27 -27
- package/dist/cli/{db-PX7EQEIG.mjs → db-NR4PJ6AF.mjs} +6 -6
- package/dist/cli/describe-HVQBTKFM.js +50 -0
- package/dist/cli/{describe-GQHGTZSL.mjs → describe-NCKAJPUG.mjs} +18 -17
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-FFKK24RY.mjs → executions-RQVJ4LAB.mjs} +6 -6
- package/dist/cli/{executions-RO3TJUXL.js → executions-UQG6LWEN.js} +8 -8
- package/dist/cli/{feedback-ZTO56SRL.mjs → feedback-RD4Y3YQR.mjs} +4 -4
- package/dist/cli/{feedback-XRR4HIS6.js → feedback-TCHA67IA.js} +8 -8
- package/dist/cli/git-TUB2ZUEH.js +25 -0
- package/dist/cli/{git-FIPBVFYZ.mjs → git-Z7434B7Y.mjs} +5 -5
- package/dist/cli/index.js +145 -141
- package/dist/cli/index.mjs +51 -47
- package/dist/cli/{legacy-noops-MTBBGM27.js → legacy-noops-23WRA7DH.js} +8 -8
- package/dist/cli/{legacy-noops-AMD2NWHF.mjs → legacy-noops-LQJU4UIV.mjs} +5 -5
- package/dist/cli/{monitors-42PIGLBF.js → monitors-KOWN7M3V.js} +95 -95
- package/dist/cli/{monitors-24LDKDJX.mjs → monitors-Z6VYUZ2W.mjs} +7 -7
- package/dist/cli/{org-GQMCA3MN.js → org-2T5K2VP5.js} +72 -72
- package/dist/cli/{org-4B7SCFRL.mjs → org-UBNRO5XO.mjs} +6 -6
- package/dist/cli/{pages-PD5EGL2R.mjs → pages-GHPJBVV3.mjs} +6 -6
- package/dist/cli/{pages-RL2M62GJ.js → pages-SRXTU7XO.js} +18 -18
- package/dist/cli/{play-FST6ZAHW.js → play-2HMZ57EZ.js} +324 -517
- package/dist/cli/{play-5V54VTUR.mjs → play-HRQKGTXA.mjs} +24 -217
- package/dist/cli/{providers-N5YVCKPL.mjs → providers-JWJRFRR5.mjs} +6 -6
- package/dist/cli/{providers-HBUUPN7J.js → providers-P5O676MZ.js} +9 -9
- package/dist/cli/{quickstart-NJDDVTQR.mjs → quickstart-S7NZUQRO.mjs} +4 -4
- package/dist/cli/{quickstart-4QIQNSHG.js → quickstart-YCY72TAO.js} +6 -6
- package/dist/cli/{run-FGOKCG4J.js → run-MHLLGF4G.js} +41 -40
- package/dist/cli/{run-JHI5MTHD.mjs → run-QWMRIUIU.mjs} +23 -22
- package/dist/cli/{search-EWIZBIY2.mjs → search-4BFTQUEP.mjs} +8 -7
- package/dist/cli/search-QPUHOEIL.js +33 -0
- package/dist/cli/{search-output-TMQTRC2W.js → search-output-62LBVZHN.js} +6 -6
- package/dist/cli/{search-output-NAK3MWBH.mjs → search-output-LIYHDTBP.mjs} +4 -4
- package/dist/cli/{secrets-ONQVW5SR.mjs → secrets-GW27V77E.mjs} +6 -6
- package/dist/cli/{secrets-5TSUEOJB.js → secrets-KKKHVSOO.js} +15 -15
- package/dist/cli/{sessions-BSGE5EET.js → sessions-R3OEINAR.js} +6 -6
- package/dist/cli/{sessions-B7F5O3ZR.mjs → sessions-R75LBGIL.mjs} +5 -5
- package/dist/cli/{settings-SGGFQV5R.mjs → settings-I3AQZSYG.mjs} +12 -11
- package/dist/cli/{settings-47LARBRU.js → settings-MQIHAEZN.js} +79 -78
- package/dist/cli/{setup-ATGNXQUK.mjs → setup-2YA5MYMS.mjs} +10 -9
- package/dist/cli/{setup-BNFZFXO6.js → setup-X3QRJERP.js} +50 -49
- package/dist/cli/{skills-CIMBRM5R.mjs → skills-7252FOOI.mjs} +8 -7
- package/dist/cli/skills-BPZWMZSL.js +37 -0
- package/dist/cli/tools-F7RVQ3IK.js +57 -0
- package/dist/cli/{tools-DTDXAULX.mjs → tools-SKQTSVGE.mjs} +17 -16
- package/dist/cli/{update-EOIJBJCO.mjs → update-GNBBSKTB.mjs} +10 -9
- package/dist/cli/update-TLSY6LC2.js +35 -0
- package/dist/cli/{workflow-IWXUJPWY.mjs → workflow-OJSAL5FO.mjs} +7 -7
- package/dist/cli/{workflow-V5VKPICQ.js → workflow-QB7YYWPP.js} +17 -17
- package/dist/{client-CIwenMFS.d.ts → client-B3GSaSFn.d.ts} +1 -1
- package/dist/{client-DYAfJpaN.d.mts → client-DEJg0CZn.d.mts} +1 -1
- package/dist/{client-core-DlzP8vEs.d.mts → client-core-C404E33V.d.mts} +5 -0
- package/dist/{client-core-CRjtyMAI.d.ts → client-core-GQmy3N8y.d.ts} +5 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +109 -104
- package/dist/plays/bundle-play-file.mjs +4 -4
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- 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/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-ZCMSXZO4.js +0 -43
- package/dist/cli/describe-LE7EZCL4.js +0 -49
- package/dist/cli/git-26AH4XIO.js +0 -25
- package/dist/cli/search-CTKSEVSO.js +0 -32
- package/dist/cli/skills-6RD25MVM.js +0 -36
- package/dist/cli/tools-TDZH4XHS.js +0 -56
- package/dist/cli/update-Y32VT4VL.js +0 -34
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return 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
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkZLN2B5YAjs = require('./chunk-ZLN2B5YA.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkSPN7U3MVjs = require('./chunk-SPN7U3MV.js');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkDIAWYWT5js = require('./chunk-DIAWYWT5.js');
|
|
14
|
+
|
|
15
|
+
// src/cli/failure-reporting.ts
|
|
16
|
+
var _os = require('os');
|
|
17
|
+
var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
|
|
18
|
+
var REPORT_FAILURE_TIMEOUT_MS = 1e4;
|
|
19
|
+
var BACKGROUND_REPORT_FAILURE_TIMEOUT_MS = 2e3;
|
|
20
|
+
var MAX_FAILURE_TEXT_CHARS = 4e3;
|
|
21
|
+
var MAX_COMMAND_TOKENS = 3;
|
|
22
|
+
var REPORTABLE_EXIT_CODES = /* @__PURE__ */ new Set([4, 5]);
|
|
23
|
+
var EMAIL_RE = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
|
|
24
|
+
var UNIX_PATH_RE = /(?:\/Users\/|\/home\/|\/var\/folders\/|\/tmp\/|\/sessions\/)[^"'\n\r`]+/g;
|
|
25
|
+
var WINDOWS_PATH_RE = /[A-Za-z]:(?:\\{1,2})(?:Users|Temp|tmp)(?:\\{1,2})[^"'\n\r`]+/g;
|
|
26
|
+
var ASSIGNMENT_SECRET_RE = /\b(access[_-]?token|api[_-]?key|apikey|auth(?:orization)?|bearer|password|secret|session)\b(\s*[:=]\s*)(?!Bearer\s+\[redacted-secret\])([^\s,;]+)/gi;
|
|
27
|
+
var BEARER_SECRET_RE = /\b(bearer)\s+([A-Za-z0-9._-]+)/gi;
|
|
28
|
+
var GENERIC_TOKEN_RE = /\b(?:dlp|sk|ghp|xox[baprs])[-_A-Za-z0-9]{8,}\b/g;
|
|
29
|
+
var SECRET_OPTION_RE = /^--?(?:access[-_]?token|api[-_]?key|apikey|auth(?:orization)?|bearer|password|secret|session|token)$/i;
|
|
30
|
+
function truthyEnv(name) {
|
|
31
|
+
return ["1", "true", "yes", "on"].includes(
|
|
32
|
+
String(_nullishCoalesce(process.env[name], () => ( ""))).trim().toLowerCase()
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function isFailureReportingDisabled() {
|
|
36
|
+
return truthyEnv(FAILURE_REPORT_DISABLE_ENV);
|
|
37
|
+
}
|
|
38
|
+
function redactFailureText(value, maxChars = MAX_FAILURE_TEXT_CHARS) {
|
|
39
|
+
const home = _optionalChain([process, 'access', _ => _.env, 'access', _2 => _2.HOME, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]);
|
|
40
|
+
let text = String(_nullishCoalesce(value, () => ( "")));
|
|
41
|
+
if (!text) return "";
|
|
42
|
+
if (home && home !== "/") {
|
|
43
|
+
text = text.split(home).join("~");
|
|
44
|
+
}
|
|
45
|
+
return text.replace(EMAIL_RE, "[redacted-email]").replace(UNIX_PATH_RE, "[redacted-path]").replace(WINDOWS_PATH_RE, "[redacted-path]").replace(BEARER_SECRET_RE, "$1 [redacted-secret]").replace(ASSIGNMENT_SECRET_RE, "$1$2[redacted-secret]").replace(GENERIC_TOKEN_RE, "[redacted-secret]").slice(0, maxChars);
|
|
46
|
+
}
|
|
47
|
+
function sanitizeCommand(argv, prefix = "deepline") {
|
|
48
|
+
const tokens = [];
|
|
49
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
50
|
+
const arg = argv[index];
|
|
51
|
+
const value = String(_nullishCoalesce(arg, () => ( ""))).trim();
|
|
52
|
+
if (!value) continue;
|
|
53
|
+
if (value.startsWith("-")) {
|
|
54
|
+
if (!value.includes("=") && SECRET_OPTION_RE.test(value)) {
|
|
55
|
+
index += 1;
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
tokens.push(redactFailureText(value, 200));
|
|
60
|
+
if (tokens.length >= MAX_COMMAND_TOKENS) break;
|
|
61
|
+
}
|
|
62
|
+
return tokens.length > 0 ? [prefix, ...tokens].join(" ") : prefix;
|
|
63
|
+
}
|
|
64
|
+
function errorMessage(error) {
|
|
65
|
+
if (error instanceof Error) return `${error.name}: ${error.message}`;
|
|
66
|
+
return String(_nullishCoalesce(error, () => ( "")));
|
|
67
|
+
}
|
|
68
|
+
function errorStack(error) {
|
|
69
|
+
if (error instanceof Error && error.stack) {
|
|
70
|
+
return redactFailureText(error.stack);
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
function classifyNetworkFailure(error) {
|
|
75
|
+
const seen = /* @__PURE__ */ new Set();
|
|
76
|
+
let current = error;
|
|
77
|
+
while (current && !seen.has(current)) {
|
|
78
|
+
seen.add(current);
|
|
79
|
+
const record = typeof current === "object" && current !== null ? current : {};
|
|
80
|
+
const code = String(_nullishCoalesce(record.code, () => ( ""))).toLowerCase();
|
|
81
|
+
const name = current instanceof Error ? current.name.toLowerCase() : "";
|
|
82
|
+
const text = String(
|
|
83
|
+
current instanceof Error ? current.message : current
|
|
84
|
+
).toLowerCase();
|
|
85
|
+
const combined = `${code} ${name} ${text}`;
|
|
86
|
+
if (combined.includes("aborterror") || combined.includes("timeout") || combined.includes("timed out") || combined.includes("etimedout")) {
|
|
87
|
+
return "network_timeout";
|
|
88
|
+
}
|
|
89
|
+
if (combined.includes("enotfound") || combined.includes("eai_again") || combined.includes("getaddrinfo") || combined.includes("name or service not known") || combined.includes("temporary failure in name resolution")) {
|
|
90
|
+
return "network_dns_resolution_failed";
|
|
91
|
+
}
|
|
92
|
+
if (combined.includes("econnrefused") || combined.includes("connection refused")) {
|
|
93
|
+
return "network_connection_refused";
|
|
94
|
+
}
|
|
95
|
+
if (combined.includes("econnreset") || combined.includes("connection reset")) {
|
|
96
|
+
return "network_connection_reset";
|
|
97
|
+
}
|
|
98
|
+
if (combined.includes("incompleteread") || combined.includes("incomplete read")) {
|
|
99
|
+
return "network_incomplete_read";
|
|
100
|
+
}
|
|
101
|
+
if (combined.includes("remotedisconnected") || combined.includes("remote end closed connection") || combined.includes("other side closed") || combined.includes("socket hang up")) {
|
|
102
|
+
return "network_remote_disconnected";
|
|
103
|
+
}
|
|
104
|
+
if (
|
|
105
|
+
// Local filenames and retry commands may contain "ssl" or "tls".
|
|
106
|
+
// Require a transport identifier or protocol failure text instead.
|
|
107
|
+
code.includes("ssl") || code.includes("tls") || name.includes("ssl") || name.includes("tls") || /(?:^|[\s[(:])(?:ssl|tls)[\s:_-]+(?:error|handshake|certificate|routines|connection|failed|failure)(?:$|[\s:_-])/.test(
|
|
108
|
+
text
|
|
109
|
+
) || combined.includes("unexpected_eof_while_reading")
|
|
110
|
+
) {
|
|
111
|
+
return "network_ssl_error";
|
|
112
|
+
}
|
|
113
|
+
current = _nullishCoalesce(record.cause, () => ( record.context));
|
|
114
|
+
}
|
|
115
|
+
return "network_error";
|
|
116
|
+
}
|
|
117
|
+
function classifyNetworkCauseCategory(error) {
|
|
118
|
+
const seen = /* @__PURE__ */ new Set();
|
|
119
|
+
let cause = error;
|
|
120
|
+
while (cause && typeof cause === "object" && !seen.has(cause)) {
|
|
121
|
+
seen.add(cause);
|
|
122
|
+
const record = cause;
|
|
123
|
+
if (record.code === "UND_ERR_CONNECT_TIMEOUT") return "connect_timeout";
|
|
124
|
+
cause = record.cause;
|
|
125
|
+
}
|
|
126
|
+
switch (classifyNetworkFailure(error)) {
|
|
127
|
+
case "network_dns_resolution_failed":
|
|
128
|
+
return "dns";
|
|
129
|
+
case "network_ssl_error":
|
|
130
|
+
return "tls";
|
|
131
|
+
case "network_connection_reset":
|
|
132
|
+
return "reset";
|
|
133
|
+
case "network_timeout":
|
|
134
|
+
return "timeout";
|
|
135
|
+
default:
|
|
136
|
+
return "unknown";
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function isNetworkFailure(error) {
|
|
140
|
+
if (!(error instanceof Error)) return false;
|
|
141
|
+
if (error instanceof _chunkDIAWYWT5js.DeeplineError && error.statusCode) return false;
|
|
142
|
+
const code = classifyNetworkFailure(error);
|
|
143
|
+
return code !== "network_error" || /unable to connect|unable to stream/i.test(error.message);
|
|
144
|
+
}
|
|
145
|
+
function buildEnvironmentContext() {
|
|
146
|
+
const context = {
|
|
147
|
+
os: _os.platform.call(void 0, ),
|
|
148
|
+
os_release: _os.release.call(void 0, ),
|
|
149
|
+
platform: `${_os.platform.call(void 0, )}-${_os.release.call(void 0, )}-${process.arch}`,
|
|
150
|
+
node_version: process.version,
|
|
151
|
+
runtime: "Node.js",
|
|
152
|
+
hostname: _os.hostname.call(void 0, ),
|
|
153
|
+
agent_runtime: _chunkSPN7U3MVjs.detectAgentRuntime.call(void 0, )
|
|
154
|
+
};
|
|
155
|
+
for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
|
|
156
|
+
const normalized = _optionalChain([process, 'access', _5 => _5.env, 'access', _6 => _6[key], 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()]);
|
|
157
|
+
if (normalized) context[key.toLowerCase()] = normalized;
|
|
158
|
+
}
|
|
159
|
+
if (_optionalChain([process, 'access', _9 => _9.env, 'access', _10 => _10.CLAUDE_PROJECT_DIR, 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()])) {
|
|
160
|
+
context.claude_project_dir_present = "true";
|
|
161
|
+
}
|
|
162
|
+
if (_optionalChain([process, 'access', _13 => _13.env, 'access', _14 => _14.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _15 => _15.trim, 'call', _16 => _16()])) {
|
|
163
|
+
context.deepline_plugin_root_present = "true";
|
|
164
|
+
}
|
|
165
|
+
if (_optionalChain([process, 'access', _17 => _17.env, 'access', _18 => _18.DEEPLINE_PLUGIN_SKILLS_DIR, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()])) {
|
|
166
|
+
context.deepline_plugin_skills_dir_present = "true";
|
|
167
|
+
}
|
|
168
|
+
if (_optionalChain([process, 'access', _21 => _21.env, 'access', _22 => _22.HOME, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24(), 'access', _25 => _25.startsWith, 'call', _26 => _26("/sessions/")])) {
|
|
169
|
+
context.home_scope = "sessions";
|
|
170
|
+
}
|
|
171
|
+
return context;
|
|
172
|
+
}
|
|
173
|
+
function failureReportHeaders(apiKey) {
|
|
174
|
+
const agentSessionId = _chunkSPN7U3MVjs.agentSessionIdFromEnvironment.call(void 0, );
|
|
175
|
+
return {
|
|
176
|
+
..._chunkSPN7U3MVjs.deploymentProtectionHeaders.call(void 0, ),
|
|
177
|
+
...agentSessionId ? { "X-Deepline-Agent-Session-Id": agentSessionId } : {},
|
|
178
|
+
Authorization: `Bearer ${apiKey}`,
|
|
179
|
+
"Content-Type": "application/json",
|
|
180
|
+
"User-Agent": `deepline-ts-sdk/${_chunkSPN7U3MVjs.SDK_VERSION}`,
|
|
181
|
+
"X-Deepline-Client-Family": "sdk",
|
|
182
|
+
"X-Deepline-CLI-Family": "sdk",
|
|
183
|
+
"X-Deepline-Agent-Runtime": _chunkSPN7U3MVjs.detectAgentRuntime.call(void 0, ),
|
|
184
|
+
"X-Deepline-CLI-Version": _chunkSPN7U3MVjs.SDK_VERSION,
|
|
185
|
+
"X-Deepline-SDK-Version": _chunkSPN7U3MVjs.SDK_VERSION
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
async function postFailureReport(input) {
|
|
189
|
+
const controller = new AbortController();
|
|
190
|
+
const timeout = setTimeout(() => controller.abort(), input.timeoutMs);
|
|
191
|
+
if (input.background) timeout.unref();
|
|
192
|
+
try {
|
|
193
|
+
await fetch(new URL("/api/v2/cli/report-failure", input.baseUrl), {
|
|
194
|
+
method: "POST",
|
|
195
|
+
headers: failureReportHeaders(input.apiKey),
|
|
196
|
+
body: JSON.stringify(input.body),
|
|
197
|
+
signal: controller.signal
|
|
198
|
+
});
|
|
199
|
+
return true;
|
|
200
|
+
} catch (e) {
|
|
201
|
+
return false;
|
|
202
|
+
} finally {
|
|
203
|
+
clearTimeout(timeout);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function boundedTelemetryString(value, maxChars) {
|
|
207
|
+
return redactFailureText(value.trim(), maxChars);
|
|
208
|
+
}
|
|
209
|
+
async function maybeReportAutomaticSkillsSyncFailure(input) {
|
|
210
|
+
if (isFailureReportingDisabled()) return false;
|
|
211
|
+
let apiKey = "";
|
|
212
|
+
try {
|
|
213
|
+
apiKey = _chunkZLN2B5YAjs.resolveApiKeyForBaseUrl.call(void 0, input.baseUrl);
|
|
214
|
+
} catch (e2) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
if (!apiKey) return false;
|
|
218
|
+
const attempts = input.attempts.slice(0, 2).map((attempt) => ({
|
|
219
|
+
installer: attempt.installer,
|
|
220
|
+
outcome: attempt.outcome,
|
|
221
|
+
exit_code: typeof attempt.exitCode === "number" && Number.isFinite(attempt.exitCode) ? Math.trunc(attempt.exitCode) : null
|
|
222
|
+
}));
|
|
223
|
+
const agents = input.agents.slice(0, 8).map((agent) => boundedTelemetryString(agent, 100)).filter(Boolean);
|
|
224
|
+
const baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
225
|
+
const failureKind = "background_warning";
|
|
226
|
+
const failureCode2 = "SKILLS_AUTO_SYNC_FAILED";
|
|
227
|
+
const failureStage = "skills_install";
|
|
228
|
+
return postFailureReport({
|
|
229
|
+
baseUrl,
|
|
230
|
+
apiKey,
|
|
231
|
+
timeoutMs: BACKGROUND_REPORT_FAILURE_TIMEOUT_MS,
|
|
232
|
+
background: true,
|
|
233
|
+
body: {
|
|
234
|
+
command: "deepline skills",
|
|
235
|
+
subcommand: "skills",
|
|
236
|
+
failure_kind: failureKind,
|
|
237
|
+
failure_code: failureCode2,
|
|
238
|
+
failure_stage: failureStage,
|
|
239
|
+
error_body: "Automatic Deepline skills installation failed.",
|
|
240
|
+
cli_version: _chunkSPN7U3MVjs.SDK_VERSION,
|
|
241
|
+
context: {
|
|
242
|
+
environment: buildEnvironmentContext(),
|
|
243
|
+
skills_sync: {
|
|
244
|
+
skills_package: boundedTelemetryString(input.skillsPackage, 100),
|
|
245
|
+
remote_skills_version: boundedTelemetryString(
|
|
246
|
+
input.remoteSkillsVersion,
|
|
247
|
+
200
|
|
248
|
+
),
|
|
249
|
+
agents,
|
|
250
|
+
target_skill_count: Math.max(
|
|
251
|
+
0,
|
|
252
|
+
Math.trunc(
|
|
253
|
+
Number.isFinite(input.targetSkillCount) ? input.targetSkillCount : 0
|
|
254
|
+
)
|
|
255
|
+
),
|
|
256
|
+
marker_written: input.markerWritten,
|
|
257
|
+
attempts
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function subcommandFromArgv(argv) {
|
|
264
|
+
return _nullishCoalesce(argv.find((arg) => arg && !arg.startsWith("-")), () => ( null));
|
|
265
|
+
}
|
|
266
|
+
function commandTokens(argv) {
|
|
267
|
+
return argv.map((arg) => String(_nullishCoalesce(arg, () => ( ""))).trim()).filter((arg) => arg && !arg.startsWith("-"));
|
|
268
|
+
}
|
|
269
|
+
function isServerLoggedPlayRunStartFailure(input) {
|
|
270
|
+
const [subcommand, command] = commandTokens(input.argv);
|
|
271
|
+
return subcommand === "plays" && command === "run" && input.error instanceof _chunkDIAWYWT5js.DeeplineError && typeof input.error.statusCode === "number";
|
|
272
|
+
}
|
|
273
|
+
function shouldReport(input) {
|
|
274
|
+
if (input.error !== void 0) return true;
|
|
275
|
+
return input.exitCode !== null && REPORTABLE_EXIT_CODES.has(input.exitCode);
|
|
276
|
+
}
|
|
277
|
+
function failureCode(input) {
|
|
278
|
+
if (input.error !== void 0) {
|
|
279
|
+
if (isNetworkFailure(input.error))
|
|
280
|
+
return classifyNetworkFailure(input.error);
|
|
281
|
+
if (input.error instanceof _chunkDIAWYWT5js.DeeplineError && input.error.code) {
|
|
282
|
+
return input.error.code;
|
|
283
|
+
}
|
|
284
|
+
if (input.error instanceof Error && input.error.name)
|
|
285
|
+
return input.error.name;
|
|
286
|
+
return "CLI_FAILURE";
|
|
287
|
+
}
|
|
288
|
+
return input.exitCode === 4 ? "network_error" : "command_exit";
|
|
289
|
+
}
|
|
290
|
+
function resolvedExitCode(input) {
|
|
291
|
+
if (typeof input.exitCode === "number" && Number.isFinite(input.exitCode)) {
|
|
292
|
+
return Math.trunc(input.exitCode);
|
|
293
|
+
}
|
|
294
|
+
if (input.error === void 0) return null;
|
|
295
|
+
return isNetworkFailure(input.error) ? 4 : 5;
|
|
296
|
+
}
|
|
297
|
+
function resolveSdkCliFailureExitCode(error) {
|
|
298
|
+
return isNetworkFailure(error) ? 4 : 1;
|
|
299
|
+
}
|
|
300
|
+
function resolvedFailureKind(input) {
|
|
301
|
+
return input.error === void 0 ? "command_exit" : "uncaught_exception";
|
|
302
|
+
}
|
|
303
|
+
function safeRequestDiagnostics(error) {
|
|
304
|
+
if (!(error instanceof _chunkDIAWYWT5js.DeeplineError)) return null;
|
|
305
|
+
const request = _optionalChain([error, 'access', _27 => _27.details, 'optionalAccess', _28 => _28.request]);
|
|
306
|
+
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
307
|
+
return null;
|
|
308
|
+
const value = request;
|
|
309
|
+
const result = {};
|
|
310
|
+
if (typeof value.phase === "string" && [
|
|
311
|
+
"before_request",
|
|
312
|
+
"retry_wait",
|
|
313
|
+
"awaiting_headers",
|
|
314
|
+
"reading_body"
|
|
315
|
+
].includes(value.phase))
|
|
316
|
+
result.phase = value.phase;
|
|
317
|
+
if (typeof value.method === "string" && /^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS)$/.test(value.method))
|
|
318
|
+
result.method = value.method;
|
|
319
|
+
if (typeof value.url === "string") {
|
|
320
|
+
try {
|
|
321
|
+
const url = new URL(value.url);
|
|
322
|
+
if (url.protocol === "https:" || url.protocol === "http:") {
|
|
323
|
+
result.url = redactFailureText(`${url.origin}${url.pathname}`, 1e3);
|
|
324
|
+
}
|
|
325
|
+
} catch (e3) {
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (typeof value.failedAtUtc === "string" && Number.isFinite(Date.parse(value.failedAtUtc))) {
|
|
329
|
+
result.failedAtUtc = new Date(value.failedAtUtc).toISOString();
|
|
330
|
+
}
|
|
331
|
+
for (const key of ["elapsedMs", "attempts"]) {
|
|
332
|
+
const number = value[key];
|
|
333
|
+
if (typeof number === "number" && Number.isSafeInteger(number) && number >= 0)
|
|
334
|
+
result[key] = number;
|
|
335
|
+
}
|
|
336
|
+
return Object.keys(result).length > 0 ? result : null;
|
|
337
|
+
}
|
|
338
|
+
function buildFailureReport(input) {
|
|
339
|
+
const durationMs = Math.max(0, Date.now() - input.startedAtMs);
|
|
340
|
+
const request = safeRequestDiagnostics(input.error);
|
|
341
|
+
const failureKind = resolvedFailureKind({
|
|
342
|
+
exitCode: input.exitCode,
|
|
343
|
+
error: input.error
|
|
344
|
+
});
|
|
345
|
+
const code = failureCode({ exitCode: input.exitCode, error: input.error });
|
|
346
|
+
const errorBody = input.error === void 0 ? `SDK CLI command exited ${_nullishCoalesce(input.exitCode, () => ( "unknown"))}` : errorMessage(input.error);
|
|
347
|
+
const networkCauseCategory = input.error !== void 0 && isNetworkFailure(input.error) ? classifyNetworkCauseCategory(input.error) : null;
|
|
348
|
+
return {
|
|
349
|
+
command: sanitizeCommand(input.argv),
|
|
350
|
+
subcommand: subcommandFromArgv(input.argv),
|
|
351
|
+
error_status: input.exitCode,
|
|
352
|
+
error_body: redactFailureText(errorBody),
|
|
353
|
+
exit_code: input.exitCode,
|
|
354
|
+
duration_ms: durationMs,
|
|
355
|
+
error_class: input.error instanceof Error ? input.error.name : null,
|
|
356
|
+
stack_trace: errorStack(input.error),
|
|
357
|
+
failure_kind: failureKind,
|
|
358
|
+
failure_code: code,
|
|
359
|
+
failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
|
|
360
|
+
cli_version: _chunkSPN7U3MVjs.SDK_VERSION,
|
|
361
|
+
context: {
|
|
362
|
+
base_url: redactFailureText(input.baseUrl, 400),
|
|
363
|
+
command_summary: sanitizeCommand(input.argv),
|
|
364
|
+
environment: buildEnvironmentContext(),
|
|
365
|
+
...request ? { request } : {},
|
|
366
|
+
failure_kind: failureKind,
|
|
367
|
+
failure_code: code,
|
|
368
|
+
failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
|
|
369
|
+
duration_ms: durationMs,
|
|
370
|
+
...input.exitCode !== null ? { exit_code: input.exitCode } : {},
|
|
371
|
+
...networkCauseCategory ? { network_cause_category: networkCauseCategory } : {}
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
async function maybeReportSdkCliFailure(input) {
|
|
376
|
+
if (isFailureReportingDisabled()) return false;
|
|
377
|
+
if (isServerLoggedPlayRunStartFailure(input)) return false;
|
|
378
|
+
const exitCode = resolvedExitCode(input);
|
|
379
|
+
if (!shouldReport({ exitCode, error: input.error })) return false;
|
|
380
|
+
const baseUrl = _chunkZLN2B5YAjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
|
|
381
|
+
const apiKey = _chunkZLN2B5YAjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
|
|
382
|
+
if (!apiKey) return false;
|
|
383
|
+
return postFailureReport({
|
|
384
|
+
baseUrl,
|
|
385
|
+
apiKey,
|
|
386
|
+
timeoutMs: REPORT_FAILURE_TIMEOUT_MS,
|
|
387
|
+
body: buildFailureReport({
|
|
388
|
+
argv: input.argv,
|
|
389
|
+
startedAtMs: input.startedAtMs,
|
|
390
|
+
error: input.error,
|
|
391
|
+
exitCode,
|
|
392
|
+
baseUrl
|
|
393
|
+
})
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
exports.isFailureReportingDisabled = isFailureReportingDisabled; exports.redactFailureText = redactFailureText; exports.sanitizeCommand = sanitizeCommand; exports.failureReportHeaders = failureReportHeaders; exports.maybeReportAutomaticSkillsSyncFailure = maybeReportAutomaticSkillsSyncFailure; exports.resolveSdkCliFailureExitCode = resolveSdkCliFailureExitCode; exports.maybeReportSdkCliFailure = maybeReportSdkCliFailure;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkYGCKMI5Pjs = require('./chunk-YGCKMI5P.js');
|
|
8
|
+
|
|
9
|
+
// ../play-runtime/worker-api-types.ts
|
|
10
|
+
var DAYTONA_COMPUTE_PRICING_USD = {
|
|
11
|
+
vcpuSecond: 14e-6,
|
|
12
|
+
memoryGiBSecond: 45e-7,
|
|
13
|
+
storageGiBSecond: 3e-8,
|
|
14
|
+
includedStorageGiB: 5
|
|
15
|
+
};
|
|
16
|
+
var MODAL_SANDBOX_COMPUTE_PRICING_USD = {
|
|
17
|
+
physicalCoreSecond: 3942e-8,
|
|
18
|
+
memoryGiBSecond: 667e-8
|
|
19
|
+
};
|
|
20
|
+
var MODAL_SANDBOX_CPU_CORES = 0.5;
|
|
21
|
+
function modalSandboxResourcesForPlay(input) {
|
|
22
|
+
return {
|
|
23
|
+
physicalCpuCores: MODAL_SANDBOX_CPU_CORES * input.cpu,
|
|
24
|
+
memoryMiB: input.memoryGiB * 1024
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function roundUsd(amount) {
|
|
28
|
+
return Number(Math.max(0, amount).toFixed(12));
|
|
29
|
+
}
|
|
30
|
+
function sandboxSizeMetadata(cpu, memoryGiB) {
|
|
31
|
+
const entry = Object.entries(_chunkYGCKMI5Pjs.PLAY_SANDBOX_SIZE_LIMITS).find(
|
|
32
|
+
([, limits]) => limits.cpu === cpu && limits.memoryGiB === memoryGiB
|
|
33
|
+
);
|
|
34
|
+
return entry ? { sandboxSize: entry[0] } : {};
|
|
35
|
+
}
|
|
36
|
+
function runtimeLimitMetadata(maxBillingDurationSeconds, observedWallTimeSeconds) {
|
|
37
|
+
if (typeof maxBillingDurationSeconds !== "number" || !Number.isFinite(maxBillingDurationSeconds) || maxBillingDurationSeconds <= 0) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
maxBillingDurationSeconds,
|
|
42
|
+
...typeof observedWallTimeSeconds === "number" && Number.isFinite(observedWallTimeSeconds) ? { observedWallTimeSeconds: Math.max(0, observedWallTimeSeconds) } : {}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function resolveDaytonaSandboxComputeItem(input) {
|
|
46
|
+
const billableSeconds = Math.max(1, Math.ceil(input.wallTimeSeconds));
|
|
47
|
+
const cpu = Math.max(0, input.cpu);
|
|
48
|
+
const memoryGiB = Math.max(0, input.memoryGiB);
|
|
49
|
+
const billableDiskGiB = Math.max(
|
|
50
|
+
0,
|
|
51
|
+
input.diskGiB - DAYTONA_COMPUTE_PRICING_USD.includedStorageGiB
|
|
52
|
+
);
|
|
53
|
+
const providerCostUsd = roundUsd(
|
|
54
|
+
billableSeconds * (cpu * DAYTONA_COMPUTE_PRICING_USD.vcpuSecond + memoryGiB * DAYTONA_COMPUTE_PRICING_USD.memoryGiBSecond + billableDiskGiB * DAYTONA_COMPUTE_PRICING_USD.storageGiBSecond)
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
itemId: input.itemId,
|
|
58
|
+
source: _nullishCoalesce(input.source, () => ( "daytona")),
|
|
59
|
+
unit: "sandbox_second",
|
|
60
|
+
units: billableSeconds,
|
|
61
|
+
providerCostUsd,
|
|
62
|
+
metadata: {
|
|
63
|
+
...sandboxSizeMetadata(cpu, memoryGiB),
|
|
64
|
+
sandboxId: _nullishCoalesce(input.sandboxId, () => ( null)),
|
|
65
|
+
cpu,
|
|
66
|
+
memoryGiB,
|
|
67
|
+
diskGiB: Math.max(0, input.diskGiB),
|
|
68
|
+
billableDiskGiB,
|
|
69
|
+
startedAt: input.startedAt,
|
|
70
|
+
endedAt: input.endedAt,
|
|
71
|
+
...runtimeLimitMetadata(
|
|
72
|
+
input.maxBillingDurationSeconds,
|
|
73
|
+
input.observedWallTimeSeconds
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function resolveModalSandboxComputeItem(input) {
|
|
79
|
+
const billableSeconds = Math.max(1, Math.ceil(input.wallTimeSeconds));
|
|
80
|
+
const physicalCpuCores = Math.max(0, input.physicalCpuCores);
|
|
81
|
+
const memoryGiB = Math.max(0, input.memoryGiB);
|
|
82
|
+
const providerCostUsd = roundUsd(
|
|
83
|
+
billableSeconds * (physicalCpuCores * MODAL_SANDBOX_COMPUTE_PRICING_USD.physicalCoreSecond + memoryGiB * MODAL_SANDBOX_COMPUTE_PRICING_USD.memoryGiBSecond)
|
|
84
|
+
);
|
|
85
|
+
return {
|
|
86
|
+
itemId: input.itemId,
|
|
87
|
+
source: "modal",
|
|
88
|
+
unit: "sandbox_second",
|
|
89
|
+
units: billableSeconds,
|
|
90
|
+
providerCostUsd,
|
|
91
|
+
metadata: {
|
|
92
|
+
...sandboxSizeMetadata(
|
|
93
|
+
physicalCpuCores / MODAL_SANDBOX_CPU_CORES,
|
|
94
|
+
memoryGiB
|
|
95
|
+
),
|
|
96
|
+
sandboxId: _nullishCoalesce(input.sandboxId, () => ( null)),
|
|
97
|
+
physicalCpuCores,
|
|
98
|
+
memoryGiB,
|
|
99
|
+
...input.memoryLimitGiB === void 0 ? {} : {
|
|
100
|
+
memoryLimitGiB: input.memoryLimitGiB,
|
|
101
|
+
// The Preview evaluation preserves the existing compute price.
|
|
102
|
+
// Sampled burst cost is diagnostic until provider billing can be
|
|
103
|
+
// reconciled; a hard ceiling is never presented as actual usage.
|
|
104
|
+
costBasis: "reserved_resources"
|
|
105
|
+
},
|
|
106
|
+
startedAt: input.startedAt,
|
|
107
|
+
endedAt: input.endedAt,
|
|
108
|
+
...runtimeLimitMetadata(
|
|
109
|
+
input.maxBillingDurationSeconds,
|
|
110
|
+
input.observedWallTimeSeconds
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ../play-runtime/runtime-constants.ts
|
|
117
|
+
var STANDARD_PLAY_RUNTIME_LIMIT_SECONDS = 30 * 60;
|
|
118
|
+
var PLAY_RUNNER_TERMINAL_GRACE_SECONDS = 90;
|
|
119
|
+
var PLAY_RUNNER_STARTUP_GRACE_SECONDS = 4 * 60;
|
|
120
|
+
var SANDBOX_NETWORK_CUT_MAX_MS = 11 * 6e4;
|
|
121
|
+
var RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS = SANDBOX_NETWORK_CUT_MAX_MS + 6e4;
|
|
122
|
+
var PLAY_RUNNER_TIMEOUT_SECONDS = 40 * 60;
|
|
123
|
+
var WORKFLOW_EXECUTOR_TOKEN_TTL_SECONDS = _chunkYGCKMI5Pjs.MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds + (PLAY_RUNNER_TIMEOUT_SECONDS - STANDARD_PLAY_RUNTIME_LIMIT_SECONDS);
|
|
124
|
+
|
|
125
|
+
// ../billing/compute-pricing-contract.ts
|
|
126
|
+
var COMPUTE_BILLING_MARKUP_MULTIPLIER = 5;
|
|
127
|
+
var DEFAULT_USD_PER_CUSTOMER_CREDIT = 0.1;
|
|
128
|
+
var DEFAULT_PROVIDER_MARKUP_MULTIPLIER = 1.4;
|
|
129
|
+
var MAX_SANDBOX_COMPUTE_BILLING_SECONDS = 60 * 60;
|
|
130
|
+
var PLAY_SANDBOX_COMPUTE_RATE_MULTIPLIERS = {
|
|
131
|
+
standard: 1,
|
|
132
|
+
large: 2.5,
|
|
133
|
+
xlarge: 5
|
|
134
|
+
};
|
|
135
|
+
var MAX_SANDBOX_COMPUTE_PROVIDER_COST_USD = Math.max(
|
|
136
|
+
...Object.values(_chunkYGCKMI5Pjs.PLAY_SANDBOX_SIZE_LIMITS).flatMap((profile) => {
|
|
137
|
+
const modalResources = modalSandboxResourcesForPlay(profile);
|
|
138
|
+
return [
|
|
139
|
+
resolveDaytonaSandboxComputeItem({
|
|
140
|
+
itemId: "billing-cap",
|
|
141
|
+
wallTimeSeconds: MAX_SANDBOX_COMPUTE_BILLING_SECONDS,
|
|
142
|
+
cpu: profile.cpu,
|
|
143
|
+
memoryGiB: profile.memoryGiB,
|
|
144
|
+
diskGiB: profile.diskGiB
|
|
145
|
+
}).providerCostUsd,
|
|
146
|
+
resolveModalSandboxComputeItem({
|
|
147
|
+
itemId: "billing-cap",
|
|
148
|
+
wallTimeSeconds: MAX_SANDBOX_COMPUTE_BILLING_SECONDS,
|
|
149
|
+
physicalCpuCores: modalResources.physicalCpuCores,
|
|
150
|
+
memoryGiB: profile.memoryGiB
|
|
151
|
+
}).providerCostUsd
|
|
152
|
+
];
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
function roundUpCredits(value) {
|
|
156
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
157
|
+
return Math.ceil(value * 100) / 100;
|
|
158
|
+
}
|
|
159
|
+
function maximumPlaySandboxBillingSeconds(limits) {
|
|
160
|
+
return Math.min(
|
|
161
|
+
limits.timeoutSeconds + PLAY_RUNNER_TERMINAL_GRACE_SECONDS,
|
|
162
|
+
MAX_SANDBOX_COMPUTE_BILLING_SECONDS
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function estimateDaytonaMaximumComputeCredits(limits) {
|
|
166
|
+
const item = resolveDaytonaSandboxComputeItem({
|
|
167
|
+
itemId: "estimate",
|
|
168
|
+
wallTimeSeconds: maximumPlaySandboxBillingSeconds(limits),
|
|
169
|
+
cpu: limits.cpu,
|
|
170
|
+
memoryGiB: limits.memoryGiB,
|
|
171
|
+
diskGiB: limits.diskGiB
|
|
172
|
+
});
|
|
173
|
+
return roundUpCredits(
|
|
174
|
+
item.providerCostUsd * COMPUTE_BILLING_MARKUP_MULTIPLIER * DEFAULT_PROVIDER_MARKUP_MULTIPLIER / DEFAULT_USD_PER_CUSTOMER_CREDIT
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
function estimateModalMaximumComputeCredits(limits, elasticMemory = false) {
|
|
178
|
+
const resources = modalSandboxResourcesForPlay(limits);
|
|
179
|
+
const item = resolveModalSandboxComputeItem({
|
|
180
|
+
itemId: "estimate",
|
|
181
|
+
wallTimeSeconds: maximumPlaySandboxBillingSeconds(limits),
|
|
182
|
+
physicalCpuCores: resources.physicalCpuCores,
|
|
183
|
+
memoryGiB: elasticMemory ? _chunkYGCKMI5Pjs.modalSandboxMemoryLimitGiBForPlay.call(void 0, limits) : limits.memoryGiB
|
|
184
|
+
});
|
|
185
|
+
return roundUpCredits(
|
|
186
|
+
item.providerCostUsd * COMPUTE_BILLING_MARKUP_MULTIPLIER * DEFAULT_PROVIDER_MARKUP_MULTIPLIER / DEFAULT_USD_PER_CUSTOMER_CREDIT
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function estimateMaximumSandboxComputeCredits(limits, elasticMemory = false) {
|
|
190
|
+
return Math.max(
|
|
191
|
+
estimateDaytonaMaximumComputeCredits(limits),
|
|
192
|
+
estimateModalMaximumComputeCredits(limits, elasticMemory)
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
function formatNonStandardSandboxRuntimeWarning(limits) {
|
|
196
|
+
const size = _chunkYGCKMI5Pjs.playSandboxSizeForLimits.call(void 0, limits);
|
|
197
|
+
if (!size) return null;
|
|
198
|
+
if (size === "standard" && limits.timeoutSeconds <= _chunkYGCKMI5Pjs.STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
const maximumComputeCredits = estimateMaximumSandboxComputeCredits(limits);
|
|
202
|
+
const quotedTimeout = `${Math.ceil(limits.timeoutSeconds / 60)}m`;
|
|
203
|
+
return `This Play requests the ${size} sandbox for up to ${limits.timeoutSeconds}s (${limits.memoryGiB}GiB memory, ${limits.cpu} CPU, ${limits.diskGiB}GiB disk). Resource-based pricing estimate: ${maximumComputeCredits.toFixed(2)} Deepline credits. Workspace plan pricing can differ. Run deepline billing quote --sandbox-timeout ${quotedTimeout} --sandbox-size ${size} for your workspace's session ceiling.`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
exports.PLAY_SANDBOX_COMPUTE_RATE_MULTIPLIERS = PLAY_SANDBOX_COMPUTE_RATE_MULTIPLIERS; exports.formatNonStandardSandboxRuntimeWarning = formatNonStandardSandboxRuntimeWarning;
|