deepline 0.3.504 → 0.3.506
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +121 -5
- package/dist/bundling-sources/sdk/src/index.ts +3 -0
- 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/integration-contracts/billing-entitlements.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +176 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +17 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/overview.ts +118 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +29 -1
- package/dist/bundling-sources/shared_libs/monitors/legacy-radar-retirement.ts +29 -10
- package/dist/bundling-sources/shared_libs/monitors/package.json +4 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +9 -9
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +52 -5
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +48 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +157 -47
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +36 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-egress.ts +55 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +66 -0
- 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-MMHG2OFE.js +43 -0
- package/dist/cli/{auth-3L5AA5AX.mjs → auth-ZHFONT2D.mjs} +5 -5
- package/dist/cli/{billing-HOGXVE2V.js → billing-3Z7N4WTL.js} +101 -91
- package/dist/cli/{billing-E7EASVPO.mjs → billing-B2YEMNHE.mjs} +27 -17
- package/dist/cli/{chunk-UXQQPMYO.js → chunk-26DJ4BDY.js} +2 -2
- package/dist/cli/{chunk-3MLFFWDM.mjs → chunk-2CFTDVEP.mjs} +2 -2
- package/dist/cli/{chunk-QOLX2O2S.mjs → chunk-2IXXB7OA.mjs} +93 -34
- package/dist/cli/{chunk-6JNBMTCZ.js → chunk-2OY5DXTC.js} +1 -1
- package/dist/cli/{chunk-SVFTZTCI.mjs → chunk-3BFZEHBH.mjs} +1 -1
- package/dist/cli/{chunk-67OI26OE.js → chunk-3F676QXJ.js} +96 -37
- package/dist/cli/{chunk-KCKAFTPY.js → chunk-5ARG7J7A.js} +6 -6
- package/dist/cli/{chunk-5CHBIJIM.mjs → chunk-6RYVIZRP.mjs} +2 -2
- package/dist/cli/{chunk-QKKU2FH4.js → chunk-75NAFY36.js} +7 -7
- package/dist/cli/{chunk-7P2QVMBP.js → chunk-AD2WJUZA.js} +91 -48
- package/dist/cli/{chunk-UFYJTRSF.mjs → chunk-AFSYNOG4.mjs} +42 -7
- package/dist/cli/{chunk-VJVJWZ6I.mjs → chunk-BJ5OX62J.mjs} +5 -5
- package/dist/cli/{chunk-HUX5DZO6.mjs → chunk-BQBPVUFJ.mjs} +3 -3
- package/dist/cli/{chunk-MLMWM5DV.mjs → chunk-CHGRURBN.mjs} +5 -5
- package/dist/cli/{chunk-22OCKCYS.mjs → chunk-D7OCORZ7.mjs} +1 -1
- package/dist/cli/{chunk-SMSQVRHE.js → chunk-DB54ROPH.js} +5 -5
- package/dist/cli/{chunk-KGUGNEKL.js → chunk-E554XCJI.js} +96 -96
- package/dist/cli/{chunk-GGBXNQCR.mjs → chunk-EN7GXLFX.mjs} +4 -4
- package/dist/cli/{chunk-2W77YCKH.js → chunk-F53SGS3C.js} +5 -5
- package/dist/cli/{chunk-6SMR7LU7.js → chunk-F7IQQYKV.js} +2 -2
- package/dist/cli/chunk-FFGQR5J3.mjs +405 -0
- package/dist/cli/{chunk-UJMBG5JU.js → chunk-FWSEGIT6.js} +4 -4
- package/dist/cli/{chunk-GJ2DA35C.js → chunk-GDHLL5EQ.js} +42 -7
- package/dist/cli/{chunk-XHZSPMNC.mjs → chunk-GJNIC2CO.mjs} +84 -441
- package/dist/cli/chunk-GRESJ3H3.js +405 -0
- package/dist/cli/{chunk-WZSFIJMG.js → chunk-HINTYT5H.js} +113 -470
- package/dist/cli/{chunk-A6LA42JY.js → chunk-LRSRJJPD.js} +16 -16
- package/dist/cli/{chunk-WBIDPDKJ.js → chunk-MHRR47VQ.js} +3 -3
- package/dist/cli/{chunk-FTRVCIGC.js → chunk-N7G36GXB.js} +26 -26
- package/dist/cli/{chunk-BTWUNKKX.mjs → chunk-ND4WPLTE.mjs} +2 -2
- package/dist/cli/{chunk-NZ7Z7WNM.mjs → chunk-O4DZG4VA.mjs} +2 -2
- package/dist/cli/{chunk-LHXYCZYO.js → chunk-OD6TASBP.js} +8 -8
- package/dist/cli/{chunk-GRAGUYIE.js → chunk-OHNMJ5XQ.js} +41 -41
- package/dist/cli/{chunk-OX2D6BG4.mjs → chunk-ONBXTEFQ.mjs} +46 -3
- package/dist/cli/{chunk-7F4OEHQK.mjs → chunk-OPBXKB57.mjs} +1 -1
- package/dist/cli/{chunk-Y7VEHKID.mjs → chunk-OUGJUM5X.mjs} +6 -6
- package/dist/cli/{chunk-USTJEEND.js → chunk-PRIHD5XS.js} +9 -9
- package/dist/cli/{chunk-IGNQKOWT.mjs → chunk-QAY5AS2H.mjs} +12 -12
- package/dist/cli/{chunk-5Z6EULD5.js → chunk-QP333GFE.js} +7 -7
- package/dist/cli/{chunk-JPR2546F.js → chunk-SUJIVF6L.js} +16 -16
- package/dist/cli/{chunk-DEAJVQEG.mjs → chunk-TEMORCEE.mjs} +1 -1
- package/dist/cli/{chunk-YOQ2NNDO.mjs → chunk-TS4KFQKS.mjs} +1 -1
- package/dist/cli/{chunk-4CC67XH5.mjs → chunk-XUY7WQ2R.mjs} +3 -3
- package/dist/cli/{chunk-Z6FXUDIL.mjs → chunk-YEX6RPUO.mjs} +1 -1
- package/dist/cli/{chunk-MJTK6Q3G.js → chunk-YJKKOSXS.js} +3 -3
- package/dist/cli/{chunk-Y6XKCEPK.mjs → chunk-YVOS5KSG.mjs} +1 -1
- package/dist/cli/{chunk-2ABRDH3B.mjs → chunk-YWZEBPXK.mjs} +2 -2
- package/dist/cli/{chunk-BX45XMXZ.mjs → chunk-Z7EHY2MF.mjs} +2 -2
- package/dist/cli/{chunk-FISP4LCK.js → chunk-ZM5BJ5MP.js} +53 -53
- package/dist/cli/{chunk-IPAMOMGP.js → chunk-ZZDTWVCQ.js} +21 -21
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-2XWGPITO.js → csv-7K7LK63Y.js} +13 -13
- package/dist/cli/{csv-433JEHLQ.mjs → csv-ARHQ54HA.mjs} +4 -4
- package/dist/cli/{db-K747DH43.mjs → db-JBX24NJY.mjs} +6 -6
- package/dist/cli/{db-PJJMD4VH.js → db-V4Z2I6DY.js} +27 -27
- package/dist/cli/describe-AYXVS6DZ.js +50 -0
- package/dist/cli/{describe-VEDDYW4P.mjs → describe-RBDSGSZ7.mjs} +18 -17
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/{executions-JWRX3XCT.mjs → executions-BAZEU63W.mjs} +6 -6
- package/dist/cli/{executions-HM5T72H6.js → executions-XEZKV5QU.js} +8 -8
- package/dist/cli/{feedback-34UG4BO3.js → feedback-LOERESRU.js} +8 -8
- package/dist/cli/{feedback-MNSIA63Y.mjs → feedback-YDSWBHCO.mjs} +4 -4
- package/dist/cli/{git-ZKEOXV3A.mjs → git-4Z3W2CQU.mjs} +5 -5
- package/dist/cli/git-T6WKO7EA.js +25 -0
- package/dist/cli/index.js +146 -148
- package/dist/cli/index.mjs +53 -55
- package/dist/cli/{legacy-noops-YXSI4FVU.js → legacy-noops-4QIQPVE5.js} +8 -8
- package/dist/cli/{legacy-noops-5M4T4ZVT.mjs → legacy-noops-E4HH7S5O.mjs} +5 -5
- package/dist/cli/{monitors-C65OC4AW.mjs → monitors-FPDW5DDM.mjs} +305 -8
- package/dist/cli/{monitors-O25GDOYE.js → monitors-QBHDSDA7.js} +423 -126
- package/dist/cli/{org-2GSPLY2A.js → org-JO4GGSAH.js} +72 -72
- package/dist/cli/{org-ZRMG5NS2.mjs → org-UCDHIHAD.mjs} +6 -6
- package/dist/cli/{pages-TZZUFBRO.mjs → pages-6V52IZXY.mjs} +6 -6
- package/dist/cli/{pages-45DPADK6.js → pages-FJAAXAWO.js} +18 -18
- package/dist/cli/{play-RCGMND6X.js → play-F3AENS6W.js} +317 -316
- package/dist/cli/{play-3D7HH273.mjs → play-MF4DWROJ.mjs} +18 -17
- package/dist/cli/{providers-PSAKV6CJ.mjs → providers-NJJLTECA.mjs} +6 -6
- package/dist/cli/{providers-3N3ECMTY.js → providers-XXOQLPX7.js} +9 -9
- package/dist/cli/{quickstart-6R6AIXM6.js → quickstart-JCE3XGQG.js} +6 -6
- package/dist/cli/{quickstart-2A35SMGC.mjs → quickstart-Z5MSMI7S.mjs} +4 -4
- package/dist/cli/{run-F3TLDGUO.mjs → run-56UGPIRL.mjs} +23 -22
- package/dist/cli/{run-F6ZXTASZ.js → run-X2DNIW3F.js} +41 -40
- package/dist/cli/search-B753RTKC.js +33 -0
- package/dist/cli/{search-CZLCY3D2.mjs → search-SZYI4NBB.mjs} +8 -7
- package/dist/cli/{search-output-R5XDNILW.js → search-output-7UNT6EMP.js} +6 -6
- package/dist/cli/{search-output-MQTSTLN5.mjs → search-output-T35QNZUF.mjs} +4 -4
- package/dist/cli/{secrets-DCJYHDSY.js → secrets-JMUAVIVC.js} +15 -15
- package/dist/cli/{secrets-D3GF4B2Z.mjs → secrets-Q36VC35L.mjs} +6 -6
- package/dist/cli/{sessions-QGEQ2UYZ.mjs → sessions-HG6I3HMY.mjs} +5 -5
- package/dist/cli/{sessions-Z4JYJSDP.js → sessions-SUXU7OM7.js} +6 -6
- package/dist/cli/{settings-UVXXAT4A.js → settings-UIELQ5CV.js} +106 -78
- package/dist/cli/{settings-G7QEXA4N.mjs → settings-Z76XW4KF.mjs} +39 -11
- package/dist/cli/{setup-5I42W7D4.js → setup-2L7H5P2O.js} +50 -49
- package/dist/cli/{setup-QHJU3DUI.mjs → setup-OXNYAOQ4.mjs} +10 -9
- package/dist/cli/skills-DEVXYGYH.js +37 -0
- package/dist/cli/{skills-5LRF4UKX.mjs → skills-XSNLXJGI.mjs} +8 -7
- package/dist/cli/tools-SCGHABDL.js +57 -0
- package/dist/cli/{tools-PUT6STVG.mjs → tools-SUSFAYFH.mjs} +17 -16
- package/dist/cli/update-BSIILGO3.js +35 -0
- package/dist/cli/{update-CJ2GA64X.mjs → update-ENSTG3QO.mjs} +10 -9
- package/dist/cli/{workflow-O67MEBCP.js → workflow-FMBZNY4F.js} +17 -17
- package/dist/cli/{workflow-HVEWRTXD.mjs → workflow-Z33QE6VT.mjs} +7 -7
- package/dist/{client-DYAfJpaN.d.mts → client-BDbouy3Y.d.mts} +1 -1
- package/dist/{client-CIwenMFS.d.ts → client-Cx0420fs.d.ts} +1 -1
- package/dist/{client-core-CRjtyMAI.d.ts → client-core-B4hq0-m2.d.ts} +56 -4
- package/dist/{client-core-DlzP8vEs.d.mts → client-core-CwiVaMZ5.d.mts} +56 -4
- package/dist/{compiler-manifest-DaJrA2KV.d.mts → compiler-manifest-BeURaD5Y.d.mts} +2 -0
- package/dist/{compiler-manifest-DaJrA2KV.d.ts → compiler-manifest-BeURaD5Y.d.ts} +2 -0
- package/dist/{errors-KLga4bLr.d.ts → errors-BoPXPrSy.d.ts} +1 -1
- package/dist/{errors-BKnSYueU.d.mts → errors-kBuT4kGK.d.mts} +1 -1
- package/dist/{index-C5nAZ-VS.d.ts → index-D0crdGM1.d.ts} +1 -1
- package/dist/{index-C-8AFpWy.d.mts → index-DC7oRAAC.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +116 -110
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-UPK4IIIN.js +0 -43
- package/dist/cli/describe-OYS7LZJD.js +0 -49
- package/dist/cli/git-5YQJSJFR.js +0 -25
- package/dist/cli/search-R5VEWJO2.js +0 -32
- package/dist/cli/skills-FB6TV52O.js +0 -36
- package/dist/cli/tools-L2364RPA.js +0 -56
- package/dist/cli/update-ESYJGYVZ.js +0 -34
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveCliProgress
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TEMORCEE.mjs";
|
|
4
|
+
import {
|
|
5
|
+
maybeReportAutomaticSkillsSyncFailure
|
|
6
|
+
} from "./chunk-FFGQR5J3.mjs";
|
|
4
7
|
import {
|
|
5
8
|
DEFAULT_SKILL_AGENTS,
|
|
6
9
|
KNOWN_SKILL_AGENTS,
|
|
7
|
-
autoDetectBaseUrl,
|
|
8
10
|
hasActivePluginSkills,
|
|
9
11
|
readSdkSkillsLocalVersion,
|
|
10
12
|
resolveApiKeyForBaseUrl,
|
|
@@ -12,21 +14,17 @@ import {
|
|
|
12
14
|
sdkCliStateDirPath,
|
|
13
15
|
skillsAgentPathSegment,
|
|
14
16
|
writeSdkSkillsLocalVersion
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YVOS5KSG.mjs";
|
|
16
18
|
import {
|
|
17
19
|
SDK_API_CONTRACT,
|
|
18
20
|
SDK_API_MAJOR,
|
|
19
21
|
SDK_VERSION,
|
|
20
|
-
agentSessionIdFromEnvironment,
|
|
21
22
|
deploymentProtectionHeaders,
|
|
22
23
|
detectAgentRuntime
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import {
|
|
25
|
-
DeeplineError
|
|
26
|
-
} from "./chunk-HBL4PM5Q.mjs";
|
|
24
|
+
} from "./chunk-TS4KFQKS.mjs";
|
|
27
25
|
import {
|
|
28
26
|
SDK_RELEASE
|
|
29
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-OPBXKB57.mjs";
|
|
30
28
|
|
|
31
29
|
// src/compat.ts
|
|
32
30
|
import { randomUUID } from "crypto";
|
|
@@ -294,388 +292,6 @@ function enforceSdkCompatibilityResponse(response, options = {}) {
|
|
|
294
292
|
}
|
|
295
293
|
}
|
|
296
294
|
|
|
297
|
-
// src/cli/failure-reporting.ts
|
|
298
|
-
import { hostname, platform, release } from "os";
|
|
299
|
-
var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
|
|
300
|
-
var REPORT_FAILURE_TIMEOUT_MS = 1e4;
|
|
301
|
-
var BACKGROUND_REPORT_FAILURE_TIMEOUT_MS = 2e3;
|
|
302
|
-
var MAX_FAILURE_TEXT_CHARS = 4e3;
|
|
303
|
-
var MAX_COMMAND_TOKENS = 3;
|
|
304
|
-
var REPORTABLE_EXIT_CODES = /* @__PURE__ */ new Set([4, 5]);
|
|
305
|
-
var EMAIL_RE = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
|
|
306
|
-
var UNIX_PATH_RE = /(?:\/Users\/|\/home\/|\/var\/folders\/|\/tmp\/|\/sessions\/)[^"'\n\r`]+/g;
|
|
307
|
-
var WINDOWS_PATH_RE = /[A-Za-z]:(?:\\{1,2})(?:Users|Temp|tmp)(?:\\{1,2})[^"'\n\r`]+/g;
|
|
308
|
-
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;
|
|
309
|
-
var BEARER_SECRET_RE = /\b(bearer)\s+([A-Za-z0-9._-]+)/gi;
|
|
310
|
-
var GENERIC_TOKEN_RE = /\b(?:dlp|sk|ghp|xox[baprs])[-_A-Za-z0-9]{8,}\b/g;
|
|
311
|
-
var SECRET_OPTION_RE = /^--?(?:access[-_]?token|api[-_]?key|apikey|auth(?:orization)?|bearer|password|secret|session|token)$/i;
|
|
312
|
-
function truthyEnv(name) {
|
|
313
|
-
return ["1", "true", "yes", "on"].includes(
|
|
314
|
-
String(process.env[name] ?? "").trim().toLowerCase()
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
function isFailureReportingDisabled() {
|
|
318
|
-
return truthyEnv(FAILURE_REPORT_DISABLE_ENV);
|
|
319
|
-
}
|
|
320
|
-
function redactFailureText(value, maxChars = MAX_FAILURE_TEXT_CHARS) {
|
|
321
|
-
const home = process.env.HOME?.trim();
|
|
322
|
-
let text = String(value ?? "");
|
|
323
|
-
if (!text) return "";
|
|
324
|
-
if (home && home !== "/") {
|
|
325
|
-
text = text.split(home).join("~");
|
|
326
|
-
}
|
|
327
|
-
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);
|
|
328
|
-
}
|
|
329
|
-
function sanitizeCommand(argv, prefix = "deepline") {
|
|
330
|
-
const tokens = [];
|
|
331
|
-
for (let index = 0; index < argv.length; index += 1) {
|
|
332
|
-
const arg = argv[index];
|
|
333
|
-
const value = String(arg ?? "").trim();
|
|
334
|
-
if (!value) continue;
|
|
335
|
-
if (value.startsWith("-")) {
|
|
336
|
-
if (!value.includes("=") && SECRET_OPTION_RE.test(value)) {
|
|
337
|
-
index += 1;
|
|
338
|
-
}
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
tokens.push(redactFailureText(value, 200));
|
|
342
|
-
if (tokens.length >= MAX_COMMAND_TOKENS) break;
|
|
343
|
-
}
|
|
344
|
-
return tokens.length > 0 ? [prefix, ...tokens].join(" ") : prefix;
|
|
345
|
-
}
|
|
346
|
-
function errorMessage(error) {
|
|
347
|
-
if (error instanceof Error) return `${error.name}: ${error.message}`;
|
|
348
|
-
return String(error ?? "");
|
|
349
|
-
}
|
|
350
|
-
function errorStack(error) {
|
|
351
|
-
if (error instanceof Error && error.stack) {
|
|
352
|
-
return redactFailureText(error.stack);
|
|
353
|
-
}
|
|
354
|
-
return null;
|
|
355
|
-
}
|
|
356
|
-
function classifyNetworkFailure(error) {
|
|
357
|
-
const seen = /* @__PURE__ */ new Set();
|
|
358
|
-
let current = error;
|
|
359
|
-
while (current && !seen.has(current)) {
|
|
360
|
-
seen.add(current);
|
|
361
|
-
const record = typeof current === "object" && current !== null ? current : {};
|
|
362
|
-
const code = String(record.code ?? "").toLowerCase();
|
|
363
|
-
const name = current instanceof Error ? current.name.toLowerCase() : "";
|
|
364
|
-
const text = String(
|
|
365
|
-
current instanceof Error ? current.message : current
|
|
366
|
-
).toLowerCase();
|
|
367
|
-
const combined = `${code} ${name} ${text}`;
|
|
368
|
-
if (combined.includes("aborterror") || combined.includes("timeout") || combined.includes("timed out") || combined.includes("etimedout")) {
|
|
369
|
-
return "network_timeout";
|
|
370
|
-
}
|
|
371
|
-
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")) {
|
|
372
|
-
return "network_dns_resolution_failed";
|
|
373
|
-
}
|
|
374
|
-
if (combined.includes("econnrefused") || combined.includes("connection refused")) {
|
|
375
|
-
return "network_connection_refused";
|
|
376
|
-
}
|
|
377
|
-
if (combined.includes("econnreset") || combined.includes("connection reset")) {
|
|
378
|
-
return "network_connection_reset";
|
|
379
|
-
}
|
|
380
|
-
if (combined.includes("incompleteread") || combined.includes("incomplete read")) {
|
|
381
|
-
return "network_incomplete_read";
|
|
382
|
-
}
|
|
383
|
-
if (combined.includes("remotedisconnected") || combined.includes("remote end closed connection") || combined.includes("other side closed") || combined.includes("socket hang up")) {
|
|
384
|
-
return "network_remote_disconnected";
|
|
385
|
-
}
|
|
386
|
-
if (
|
|
387
|
-
// Local filenames and retry commands may contain "ssl" or "tls".
|
|
388
|
-
// Require a transport identifier or protocol failure text instead.
|
|
389
|
-
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(
|
|
390
|
-
text
|
|
391
|
-
) || combined.includes("unexpected_eof_while_reading")
|
|
392
|
-
) {
|
|
393
|
-
return "network_ssl_error";
|
|
394
|
-
}
|
|
395
|
-
current = record.cause ?? record.context;
|
|
396
|
-
}
|
|
397
|
-
return "network_error";
|
|
398
|
-
}
|
|
399
|
-
function classifyNetworkCauseCategory(error) {
|
|
400
|
-
const seen = /* @__PURE__ */ new Set();
|
|
401
|
-
let cause = error;
|
|
402
|
-
while (cause && typeof cause === "object" && !seen.has(cause)) {
|
|
403
|
-
seen.add(cause);
|
|
404
|
-
const record = cause;
|
|
405
|
-
if (record.code === "UND_ERR_CONNECT_TIMEOUT") return "connect_timeout";
|
|
406
|
-
cause = record.cause;
|
|
407
|
-
}
|
|
408
|
-
switch (classifyNetworkFailure(error)) {
|
|
409
|
-
case "network_dns_resolution_failed":
|
|
410
|
-
return "dns";
|
|
411
|
-
case "network_ssl_error":
|
|
412
|
-
return "tls";
|
|
413
|
-
case "network_connection_reset":
|
|
414
|
-
return "reset";
|
|
415
|
-
case "network_timeout":
|
|
416
|
-
return "timeout";
|
|
417
|
-
default:
|
|
418
|
-
return "unknown";
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function isNetworkFailure(error) {
|
|
422
|
-
if (!(error instanceof Error)) return false;
|
|
423
|
-
if (error instanceof DeeplineError && error.statusCode) return false;
|
|
424
|
-
const code = classifyNetworkFailure(error);
|
|
425
|
-
return code !== "network_error" || /unable to connect|unable to stream/i.test(error.message);
|
|
426
|
-
}
|
|
427
|
-
function buildEnvironmentContext() {
|
|
428
|
-
const context = {
|
|
429
|
-
os: platform(),
|
|
430
|
-
os_release: release(),
|
|
431
|
-
platform: `${platform()}-${release()}-${process.arch}`,
|
|
432
|
-
node_version: process.version,
|
|
433
|
-
runtime: "Node.js",
|
|
434
|
-
hostname: hostname(),
|
|
435
|
-
agent_runtime: detectAgentRuntime()
|
|
436
|
-
};
|
|
437
|
-
for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
|
|
438
|
-
const normalized = process.env[key]?.trim();
|
|
439
|
-
if (normalized) context[key.toLowerCase()] = normalized;
|
|
440
|
-
}
|
|
441
|
-
if (process.env.CLAUDE_PROJECT_DIR?.trim()) {
|
|
442
|
-
context.claude_project_dir_present = "true";
|
|
443
|
-
}
|
|
444
|
-
if (process.env.DEEPLINE_PLUGIN_ROOT?.trim()) {
|
|
445
|
-
context.deepline_plugin_root_present = "true";
|
|
446
|
-
}
|
|
447
|
-
if (process.env.DEEPLINE_PLUGIN_SKILLS_DIR?.trim()) {
|
|
448
|
-
context.deepline_plugin_skills_dir_present = "true";
|
|
449
|
-
}
|
|
450
|
-
if (process.env.HOME?.trim().startsWith("/sessions/")) {
|
|
451
|
-
context.home_scope = "sessions";
|
|
452
|
-
}
|
|
453
|
-
return context;
|
|
454
|
-
}
|
|
455
|
-
function failureReportHeaders(apiKey) {
|
|
456
|
-
const agentSessionId = agentSessionIdFromEnvironment();
|
|
457
|
-
return {
|
|
458
|
-
...deploymentProtectionHeaders(),
|
|
459
|
-
...agentSessionId ? { "X-Deepline-Agent-Session-Id": agentSessionId } : {},
|
|
460
|
-
Authorization: `Bearer ${apiKey}`,
|
|
461
|
-
"Content-Type": "application/json",
|
|
462
|
-
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
463
|
-
"X-Deepline-Client-Family": "sdk",
|
|
464
|
-
"X-Deepline-CLI-Family": "sdk",
|
|
465
|
-
"X-Deepline-Agent-Runtime": detectAgentRuntime(),
|
|
466
|
-
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
467
|
-
"X-Deepline-SDK-Version": SDK_VERSION
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
async function postFailureReport(input) {
|
|
471
|
-
const controller = new AbortController();
|
|
472
|
-
const timeout = setTimeout(() => controller.abort(), input.timeoutMs);
|
|
473
|
-
if (input.background) timeout.unref();
|
|
474
|
-
try {
|
|
475
|
-
await fetch(new URL("/api/v2/cli/report-failure", input.baseUrl), {
|
|
476
|
-
method: "POST",
|
|
477
|
-
headers: failureReportHeaders(input.apiKey),
|
|
478
|
-
body: JSON.stringify(input.body),
|
|
479
|
-
signal: controller.signal
|
|
480
|
-
});
|
|
481
|
-
return true;
|
|
482
|
-
} catch {
|
|
483
|
-
return false;
|
|
484
|
-
} finally {
|
|
485
|
-
clearTimeout(timeout);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function boundedTelemetryString(value, maxChars) {
|
|
489
|
-
return redactFailureText(value.trim(), maxChars);
|
|
490
|
-
}
|
|
491
|
-
async function maybeReportAutomaticSkillsSyncFailure(input) {
|
|
492
|
-
if (isFailureReportingDisabled()) return false;
|
|
493
|
-
let apiKey = "";
|
|
494
|
-
try {
|
|
495
|
-
apiKey = resolveApiKeyForBaseUrl(input.baseUrl);
|
|
496
|
-
} catch {
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
if (!apiKey) return false;
|
|
500
|
-
const attempts = input.attempts.slice(0, 2).map((attempt) => ({
|
|
501
|
-
installer: attempt.installer,
|
|
502
|
-
outcome: attempt.outcome,
|
|
503
|
-
exit_code: typeof attempt.exitCode === "number" && Number.isFinite(attempt.exitCode) ? Math.trunc(attempt.exitCode) : null
|
|
504
|
-
}));
|
|
505
|
-
const agents = input.agents.slice(0, 8).map((agent) => boundedTelemetryString(agent, 100)).filter(Boolean);
|
|
506
|
-
const baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
507
|
-
const failureKind = "background_warning";
|
|
508
|
-
const failureCode2 = "SKILLS_AUTO_SYNC_FAILED";
|
|
509
|
-
const failureStage = "skills_install";
|
|
510
|
-
return postFailureReport({
|
|
511
|
-
baseUrl,
|
|
512
|
-
apiKey,
|
|
513
|
-
timeoutMs: BACKGROUND_REPORT_FAILURE_TIMEOUT_MS,
|
|
514
|
-
background: true,
|
|
515
|
-
body: {
|
|
516
|
-
command: "deepline skills",
|
|
517
|
-
subcommand: "skills",
|
|
518
|
-
failure_kind: failureKind,
|
|
519
|
-
failure_code: failureCode2,
|
|
520
|
-
failure_stage: failureStage,
|
|
521
|
-
error_body: "Automatic Deepline skills installation failed.",
|
|
522
|
-
cli_version: SDK_VERSION,
|
|
523
|
-
context: {
|
|
524
|
-
environment: buildEnvironmentContext(),
|
|
525
|
-
skills_sync: {
|
|
526
|
-
skills_package: boundedTelemetryString(input.skillsPackage, 100),
|
|
527
|
-
remote_skills_version: boundedTelemetryString(
|
|
528
|
-
input.remoteSkillsVersion,
|
|
529
|
-
200
|
|
530
|
-
),
|
|
531
|
-
agents,
|
|
532
|
-
target_skill_count: Math.max(
|
|
533
|
-
0,
|
|
534
|
-
Math.trunc(
|
|
535
|
-
Number.isFinite(input.targetSkillCount) ? input.targetSkillCount : 0
|
|
536
|
-
)
|
|
537
|
-
),
|
|
538
|
-
marker_written: input.markerWritten,
|
|
539
|
-
attempts
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
function subcommandFromArgv(argv) {
|
|
546
|
-
return argv.find((arg) => arg && !arg.startsWith("-")) ?? null;
|
|
547
|
-
}
|
|
548
|
-
function commandTokens(argv) {
|
|
549
|
-
return argv.map((arg) => String(arg ?? "").trim()).filter((arg) => arg && !arg.startsWith("-"));
|
|
550
|
-
}
|
|
551
|
-
function isServerLoggedPlayRunStartFailure(input) {
|
|
552
|
-
const [subcommand, command] = commandTokens(input.argv);
|
|
553
|
-
return subcommand === "plays" && command === "run" && input.error instanceof DeeplineError && typeof input.error.statusCode === "number";
|
|
554
|
-
}
|
|
555
|
-
function shouldReport(input) {
|
|
556
|
-
if (input.error !== void 0) return true;
|
|
557
|
-
return input.exitCode !== null && REPORTABLE_EXIT_CODES.has(input.exitCode);
|
|
558
|
-
}
|
|
559
|
-
function failureCode(input) {
|
|
560
|
-
if (input.error !== void 0) {
|
|
561
|
-
if (isNetworkFailure(input.error))
|
|
562
|
-
return classifyNetworkFailure(input.error);
|
|
563
|
-
if (input.error instanceof DeeplineError && input.error.code) {
|
|
564
|
-
return input.error.code;
|
|
565
|
-
}
|
|
566
|
-
if (input.error instanceof Error && input.error.name)
|
|
567
|
-
return input.error.name;
|
|
568
|
-
return "CLI_FAILURE";
|
|
569
|
-
}
|
|
570
|
-
return input.exitCode === 4 ? "network_error" : "command_exit";
|
|
571
|
-
}
|
|
572
|
-
function resolvedExitCode(input) {
|
|
573
|
-
if (typeof input.exitCode === "number" && Number.isFinite(input.exitCode)) {
|
|
574
|
-
return Math.trunc(input.exitCode);
|
|
575
|
-
}
|
|
576
|
-
if (input.error === void 0) return null;
|
|
577
|
-
return isNetworkFailure(input.error) ? 4 : 5;
|
|
578
|
-
}
|
|
579
|
-
function resolveSdkCliFailureExitCode(error) {
|
|
580
|
-
return isNetworkFailure(error) ? 4 : 1;
|
|
581
|
-
}
|
|
582
|
-
function resolvedFailureKind(input) {
|
|
583
|
-
return input.error === void 0 ? "command_exit" : "uncaught_exception";
|
|
584
|
-
}
|
|
585
|
-
function safeRequestDiagnostics(error) {
|
|
586
|
-
if (!(error instanceof DeeplineError)) return null;
|
|
587
|
-
const request = error.details?.request;
|
|
588
|
-
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
589
|
-
return null;
|
|
590
|
-
const value = request;
|
|
591
|
-
const result = {};
|
|
592
|
-
if (typeof value.phase === "string" && [
|
|
593
|
-
"before_request",
|
|
594
|
-
"retry_wait",
|
|
595
|
-
"awaiting_headers",
|
|
596
|
-
"reading_body"
|
|
597
|
-
].includes(value.phase))
|
|
598
|
-
result.phase = value.phase;
|
|
599
|
-
if (typeof value.method === "string" && /^(GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS)$/.test(value.method))
|
|
600
|
-
result.method = value.method;
|
|
601
|
-
if (typeof value.url === "string") {
|
|
602
|
-
try {
|
|
603
|
-
const url = new URL(value.url);
|
|
604
|
-
if (url.protocol === "https:" || url.protocol === "http:") {
|
|
605
|
-
result.url = redactFailureText(`${url.origin}${url.pathname}`, 1e3);
|
|
606
|
-
}
|
|
607
|
-
} catch {
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
if (typeof value.failedAtUtc === "string" && Number.isFinite(Date.parse(value.failedAtUtc))) {
|
|
611
|
-
result.failedAtUtc = new Date(value.failedAtUtc).toISOString();
|
|
612
|
-
}
|
|
613
|
-
for (const key of ["elapsedMs", "attempts"]) {
|
|
614
|
-
const number = value[key];
|
|
615
|
-
if (typeof number === "number" && Number.isSafeInteger(number) && number >= 0)
|
|
616
|
-
result[key] = number;
|
|
617
|
-
}
|
|
618
|
-
return Object.keys(result).length > 0 ? result : null;
|
|
619
|
-
}
|
|
620
|
-
function buildFailureReport(input) {
|
|
621
|
-
const durationMs = Math.max(0, Date.now() - input.startedAtMs);
|
|
622
|
-
const request = safeRequestDiagnostics(input.error);
|
|
623
|
-
const failureKind = resolvedFailureKind({
|
|
624
|
-
exitCode: input.exitCode,
|
|
625
|
-
error: input.error
|
|
626
|
-
});
|
|
627
|
-
const code = failureCode({ exitCode: input.exitCode, error: input.error });
|
|
628
|
-
const errorBody = input.error === void 0 ? `SDK CLI command exited ${input.exitCode ?? "unknown"}` : errorMessage(input.error);
|
|
629
|
-
const networkCauseCategory = input.error !== void 0 && isNetworkFailure(input.error) ? classifyNetworkCauseCategory(input.error) : null;
|
|
630
|
-
return {
|
|
631
|
-
command: sanitizeCommand(input.argv),
|
|
632
|
-
subcommand: subcommandFromArgv(input.argv),
|
|
633
|
-
error_status: input.exitCode,
|
|
634
|
-
error_body: redactFailureText(errorBody),
|
|
635
|
-
exit_code: input.exitCode,
|
|
636
|
-
duration_ms: durationMs,
|
|
637
|
-
error_class: input.error instanceof Error ? input.error.name : null,
|
|
638
|
-
stack_trace: errorStack(input.error),
|
|
639
|
-
failure_kind: failureKind,
|
|
640
|
-
failure_code: code,
|
|
641
|
-
failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
|
|
642
|
-
cli_version: SDK_VERSION,
|
|
643
|
-
context: {
|
|
644
|
-
base_url: redactFailureText(input.baseUrl, 400),
|
|
645
|
-
command_summary: sanitizeCommand(input.argv),
|
|
646
|
-
environment: buildEnvironmentContext(),
|
|
647
|
-
...request ? { request } : {},
|
|
648
|
-
failure_kind: failureKind,
|
|
649
|
-
failure_code: code,
|
|
650
|
-
failure_stage: input.error === void 0 ? "command_exit" : "cli_main",
|
|
651
|
-
duration_ms: durationMs,
|
|
652
|
-
...input.exitCode !== null ? { exit_code: input.exitCode } : {},
|
|
653
|
-
...networkCauseCategory ? { network_cause_category: networkCauseCategory } : {}
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
async function maybeReportSdkCliFailure(input) {
|
|
658
|
-
if (isFailureReportingDisabled()) return false;
|
|
659
|
-
if (isServerLoggedPlayRunStartFailure(input)) return false;
|
|
660
|
-
const exitCode = resolvedExitCode(input);
|
|
661
|
-
if (!shouldReport({ exitCode, error: input.error })) return false;
|
|
662
|
-
const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
|
|
663
|
-
const apiKey = resolveApiKeyForBaseUrl(baseUrl);
|
|
664
|
-
if (!apiKey) return false;
|
|
665
|
-
return postFailureReport({
|
|
666
|
-
baseUrl,
|
|
667
|
-
apiKey,
|
|
668
|
-
timeoutMs: REPORT_FAILURE_TIMEOUT_MS,
|
|
669
|
-
body: buildFailureReport({
|
|
670
|
-
argv: input.argv,
|
|
671
|
-
startedAtMs: input.startedAtMs,
|
|
672
|
-
error: input.error,
|
|
673
|
-
exitCode,
|
|
674
|
-
baseUrl
|
|
675
|
-
})
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
|
|
679
295
|
// contracts/install-commands.json
|
|
680
296
|
var install_commands_default = {
|
|
681
297
|
skills: {
|
|
@@ -810,8 +426,8 @@ function escapeCmdArgument(arg, forBatchFile = true) {
|
|
|
810
426
|
function escapeCmdCommand(command) {
|
|
811
427
|
return command.replace(CMD_META_CHARS, "^$1");
|
|
812
428
|
}
|
|
813
|
-
function resolveShellSpawn(command, args,
|
|
814
|
-
if (
|
|
429
|
+
function resolveShellSpawn(command, args, platform = process.platform, env = process.env, cwd = process.cwd()) {
|
|
430
|
+
if (platform !== "win32") {
|
|
815
431
|
return { command, args: [...args], shell: false };
|
|
816
432
|
}
|
|
817
433
|
const resolved = resolveWindowsExecutable(command, env, cwd);
|
|
@@ -851,23 +467,49 @@ function resolveWindowsExecutable(command, env, cwd) {
|
|
|
851
467
|
return void 0;
|
|
852
468
|
}
|
|
853
469
|
|
|
470
|
+
// src/cli/skills-sync-preferences.ts
|
|
471
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
472
|
+
import { homedir as homedir2 } from "os";
|
|
473
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
474
|
+
function skillsSyncDisabledPath() {
|
|
475
|
+
return join2(
|
|
476
|
+
process.env.HOME?.trim() || homedir2(),
|
|
477
|
+
".local",
|
|
478
|
+
"deepline",
|
|
479
|
+
"sdk-cli",
|
|
480
|
+
"skills-sync-disabled"
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
function isCliSkillsSyncEnabled() {
|
|
484
|
+
return !existsSync2(skillsSyncDisabledPath());
|
|
485
|
+
}
|
|
486
|
+
function setCliSkillsSyncEnabled(enabled) {
|
|
487
|
+
const path = skillsSyncDisabledPath();
|
|
488
|
+
if (enabled) {
|
|
489
|
+
rmSync2(path, { force: true });
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
mkdirSync2(dirname2(path), { recursive: true });
|
|
493
|
+
writeFileSync2(path, "", { flag: "a", mode: 384 });
|
|
494
|
+
}
|
|
495
|
+
|
|
854
496
|
// src/cli/skills-sync.ts
|
|
855
497
|
import { spawn, spawnSync } from "child_process";
|
|
856
498
|
import { createHash, randomUUID as randomUUID2 } from "crypto";
|
|
857
|
-
import { homedir as
|
|
499
|
+
import { homedir as homedir3 } from "os";
|
|
858
500
|
import { gunzipSync } from "zlib";
|
|
859
501
|
import {
|
|
860
502
|
appendFileSync,
|
|
861
|
-
existsSync as
|
|
862
|
-
mkdirSync as
|
|
503
|
+
existsSync as existsSync3,
|
|
504
|
+
mkdirSync as mkdirSync3,
|
|
863
505
|
readdirSync,
|
|
864
506
|
readFileSync as readFileSync2,
|
|
865
507
|
renameSync as renameSync2,
|
|
866
|
-
rmSync as
|
|
508
|
+
rmSync as rmSync3,
|
|
867
509
|
unlinkSync,
|
|
868
|
-
writeFileSync as
|
|
510
|
+
writeFileSync as writeFileSync3
|
|
869
511
|
} from "fs";
|
|
870
|
-
import { dirname as
|
|
512
|
+
import { dirname as dirname3, join as join3 } from "path";
|
|
871
513
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
872
514
|
var INSTALLER_PROBE_TIMEOUT_MS = 1e3;
|
|
873
515
|
var PUBLISHED_VERIFICATION_RETRY_MS = 5 * 6e4;
|
|
@@ -876,10 +518,10 @@ function shouldSkipSkillsSync() {
|
|
|
876
518
|
return true;
|
|
877
519
|
}
|
|
878
520
|
const value = process.env.DEEPLINE_SKIP_SKILLS_SYNC?.trim().toLowerCase();
|
|
879
|
-
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
521
|
+
return value === "1" || value === "true" || value === "yes" || value === "on" || !isCliSkillsSyncEnabled();
|
|
880
522
|
}
|
|
881
523
|
function unavailableSkillsNoticePath(baseUrl) {
|
|
882
|
-
return
|
|
524
|
+
return join3(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
|
|
883
525
|
}
|
|
884
526
|
var SKILLS_SYNC_IN_PROGRESS_TTL_MS = 10 * 60 * 1e3;
|
|
885
527
|
var SKILLS_SYNC_IN_PROGRESS_PID_CAP_MS = 6 * 60 * 60 * 1e3;
|
|
@@ -889,21 +531,21 @@ function sortedLeaseAgents(agents) {
|
|
|
889
531
|
return [...new Set(expanded)].sort((a, b) => a.localeCompare(b));
|
|
890
532
|
}
|
|
891
533
|
function inProgressSkillsSyncPath(baseUrl, agent) {
|
|
892
|
-
return
|
|
534
|
+
return join3(
|
|
893
535
|
sdkCliStateDirPath(baseUrl),
|
|
894
536
|
`skills-sync-in-progress-${agentLeaseSegment(agent)}`
|
|
895
537
|
);
|
|
896
538
|
}
|
|
897
539
|
function readInProgressSkillsSyncLeaseFromDir(dir) {
|
|
898
|
-
const claim = readMarkedSkillsSyncVersion(
|
|
540
|
+
const claim = readMarkedSkillsSyncVersion(join3(dir, "claim"));
|
|
899
541
|
const [version = "", startedAt = ""] = claim.split(" ");
|
|
900
|
-
const pidRaw = readMarkedSkillsSyncVersion(
|
|
542
|
+
const pidRaw = readMarkedSkillsSyncVersion(join3(dir, "pid"));
|
|
901
543
|
return {
|
|
902
544
|
claimToken: version && startedAt ? `${version} ${startedAt}` : "",
|
|
903
545
|
version,
|
|
904
546
|
startedAt: Number(startedAt),
|
|
905
547
|
pid: /^\d+$/.test(pidRaw) ? Number(pidRaw) : null,
|
|
906
|
-
owner: readMarkedSkillsSyncVersion(
|
|
548
|
+
owner: readMarkedSkillsSyncVersion(join3(dir, "owner"))
|
|
907
549
|
};
|
|
908
550
|
}
|
|
909
551
|
function readInProgressSkillsSyncLease(baseUrl, agent) {
|
|
@@ -960,15 +602,15 @@ function claimOneInProgressSkillsSync(baseUrl, remoteVersion, agent, owner) {
|
|
|
960
602
|
const create = () => {
|
|
961
603
|
const claimToken = `${remoteVersion} ${Date.now()}`;
|
|
962
604
|
const staging = `${dir}.staging-${process.pid}-${Date.now()}`;
|
|
963
|
-
|
|
964
|
-
|
|
605
|
+
mkdirSync3(staging);
|
|
606
|
+
writeFileSync3(join3(staging, "claim"), `${claimToken}
|
|
965
607
|
`, "utf-8");
|
|
966
|
-
|
|
608
|
+
writeFileSync3(join3(staging, "owner"), `${owner}
|
|
967
609
|
`, "utf-8");
|
|
968
610
|
try {
|
|
969
611
|
renameSync2(staging, dir);
|
|
970
612
|
} catch (error) {
|
|
971
|
-
|
|
613
|
+
rmSync3(staging, { recursive: true, force: true });
|
|
972
614
|
const code = errorCode(error);
|
|
973
615
|
const err = new Error("lease directory already exists");
|
|
974
616
|
err.code = code === "EEXIST" || code === "ENOTEMPTY" ? "EEXIST" : String(code ?? "");
|
|
@@ -977,7 +619,7 @@ function claimOneInProgressSkillsSync(baseUrl, remoteVersion, agent, owner) {
|
|
|
977
619
|
return { state: "claimed", claimToken };
|
|
978
620
|
};
|
|
979
621
|
try {
|
|
980
|
-
|
|
622
|
+
mkdirSync3(dirname3(dir), { recursive: true });
|
|
981
623
|
} catch (error) {
|
|
982
624
|
return { state: "unavailable", error };
|
|
983
625
|
}
|
|
@@ -993,7 +635,7 @@ function claimOneInProgressSkillsSync(baseUrl, remoteVersion, agent, owner) {
|
|
|
993
635
|
if (!tombstone) {
|
|
994
636
|
return { state: "held" };
|
|
995
637
|
}
|
|
996
|
-
|
|
638
|
+
rmSync3(tombstone, { recursive: true, force: true });
|
|
997
639
|
try {
|
|
998
640
|
return create();
|
|
999
641
|
} catch (error) {
|
|
@@ -1064,8 +706,8 @@ function recordOwnPidOnInProgressSkillsSync(baseUrl, leases) {
|
|
|
1064
706
|
for (const [agent, lease] of leases) {
|
|
1065
707
|
if (!lease.claimToken) continue;
|
|
1066
708
|
try {
|
|
1067
|
-
|
|
1068
|
-
|
|
709
|
+
writeFileSync3(
|
|
710
|
+
join3(inProgressSkillsSyncPath(baseUrl, agent), "pid"),
|
|
1069
711
|
`${process.pid}
|
|
1070
712
|
`,
|
|
1071
713
|
"utf-8"
|
|
@@ -1079,7 +721,7 @@ function releaseInProgressSkillsSync(baseUrl, claimTokens) {
|
|
|
1079
721
|
const dir = inProgressSkillsSyncPath(baseUrl, agent);
|
|
1080
722
|
if (!claimToken) {
|
|
1081
723
|
try {
|
|
1082
|
-
|
|
724
|
+
rmSync3(dir, { recursive: true, force: true });
|
|
1083
725
|
} catch {
|
|
1084
726
|
}
|
|
1085
727
|
continue;
|
|
@@ -1093,7 +735,7 @@ function releaseInProgressSkillsSync(baseUrl, claimTokens) {
|
|
|
1093
735
|
}
|
|
1094
736
|
} catch {
|
|
1095
737
|
}
|
|
1096
|
-
|
|
738
|
+
rmSync3(tombstone, { recursive: true, force: true });
|
|
1097
739
|
}
|
|
1098
740
|
}
|
|
1099
741
|
function claimTokensOf(leases) {
|
|
@@ -1133,7 +775,7 @@ function skillsInstallLeasePath(baseUrl, agents) {
|
|
|
1133
775
|
return sortedLeaseAgents(agents).map((agent) => inProgressSkillsSyncPath(baseUrl, agent)).join(", ");
|
|
1134
776
|
}
|
|
1135
777
|
function deferredSkillsNoticePath(baseUrl, agents) {
|
|
1136
|
-
return
|
|
778
|
+
return join3(
|
|
1137
779
|
sdkCliStateDirPath(baseUrl),
|
|
1138
780
|
`skills-sync-notice-${sortedLeaseAgents(agents).map(agentLeaseSegment).join("-")}`
|
|
1139
781
|
);
|
|
@@ -1142,7 +784,7 @@ function deferSkillsNotice(baseUrl, agents) {
|
|
|
1142
784
|
const path = deferredSkillsNoticePath(baseUrl, agents);
|
|
1143
785
|
return (text) => {
|
|
1144
786
|
try {
|
|
1145
|
-
|
|
787
|
+
mkdirSync3(dirname3(path), { recursive: true });
|
|
1146
788
|
appendFileSync(path, `${text.trimEnd()}
|
|
1147
789
|
`, "utf-8");
|
|
1148
790
|
} catch {
|
|
@@ -1151,7 +793,7 @@ function deferSkillsNotice(baseUrl, agents) {
|
|
|
1151
793
|
}
|
|
1152
794
|
function flushDeferredSkillsNotices(baseUrl, agents) {
|
|
1153
795
|
const path = deferredSkillsNoticePath(baseUrl, agents);
|
|
1154
|
-
if (!
|
|
796
|
+
if (!existsSync3(path)) return;
|
|
1155
797
|
const tombstone = quarantine(path, "consuming");
|
|
1156
798
|
if (!tombstone) return;
|
|
1157
799
|
let text = "";
|
|
@@ -1184,7 +826,7 @@ function spawnDetachedSkillsSyncChild(argv, onSpawnError) {
|
|
|
1184
826
|
child.unref();
|
|
1185
827
|
}
|
|
1186
828
|
function failedSkillsSyncPath(baseUrl, agents) {
|
|
1187
|
-
return
|
|
829
|
+
return join3(
|
|
1188
830
|
sdkCliStateDirPath(baseUrl),
|
|
1189
831
|
`skills-sync-failed-${sortedLeaseAgents(agents).map(agentLeaseSegment).join("-")}-version`
|
|
1190
832
|
);
|
|
@@ -1194,15 +836,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
|
|
|
1194
836
|
}
|
|
1195
837
|
function readMarkedSkillsSyncVersion(path) {
|
|
1196
838
|
try {
|
|
1197
|
-
return
|
|
839
|
+
return existsSync3(path) ? readFileSync2(path, "utf-8").trim() : "";
|
|
1198
840
|
} catch {
|
|
1199
841
|
return "";
|
|
1200
842
|
}
|
|
1201
843
|
}
|
|
1202
844
|
function writeMarkedSkillsSyncVersion(path, version) {
|
|
1203
845
|
try {
|
|
1204
|
-
|
|
1205
|
-
|
|
846
|
+
mkdirSync3(dirname3(path), { recursive: true });
|
|
847
|
+
writeFileSync3(path, `${version}
|
|
1206
848
|
`, "utf-8");
|
|
1207
849
|
return true;
|
|
1208
850
|
} catch {
|
|
@@ -1241,7 +883,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
1241
883
|
}
|
|
1242
884
|
}
|
|
1243
885
|
function hasFailedAutomaticSkillsSync(baseUrl, agents) {
|
|
1244
|
-
return
|
|
886
|
+
return existsSync3(failedSkillsSyncPath(baseUrl, agents));
|
|
1245
887
|
}
|
|
1246
888
|
function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
1247
889
|
return writeMarkedSkillsSyncVersion(
|
|
@@ -1312,7 +954,7 @@ function safeSkillFilePath(value) {
|
|
|
1312
954
|
}
|
|
1313
955
|
function installedSkillFiles(root, prefix = "") {
|
|
1314
956
|
const files = [];
|
|
1315
|
-
for (const entry of readdirSync(
|
|
957
|
+
for (const entry of readdirSync(join3(root, prefix), {
|
|
1316
958
|
withFileTypes: true
|
|
1317
959
|
})) {
|
|
1318
960
|
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
@@ -1431,12 +1073,12 @@ async function verifyDefaultAgentSkillsInstall(baseUrl, remoteVersion, skillName
|
|
|
1431
1073
|
clearTimeout(timeout);
|
|
1432
1074
|
controller.abort();
|
|
1433
1075
|
}
|
|
1434
|
-
const home =
|
|
1435
|
-
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() ||
|
|
1076
|
+
const home = homedir3();
|
|
1077
|
+
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() || join3(home, ".claude");
|
|
1436
1078
|
for (const [name, { files }] of published) {
|
|
1437
1079
|
for (const root of [
|
|
1438
|
-
|
|
1439
|
-
|
|
1080
|
+
join3(home, ".agents", "skills", name),
|
|
1081
|
+
join3(claudeConfigDir, "skills", name)
|
|
1440
1082
|
]) {
|
|
1441
1083
|
const installed = installedSkillFiles(root);
|
|
1442
1084
|
if (installed.length !== files.length || installed.some((file, index2) => file !== files[index2])) {
|
|
@@ -1444,7 +1086,7 @@ async function verifyDefaultAgentSkillsInstall(baseUrl, remoteVersion, skillName
|
|
|
1444
1086
|
}
|
|
1445
1087
|
for (const file of files) {
|
|
1446
1088
|
const publishedContent = expected.get(`${name}/${file}`);
|
|
1447
|
-
if (!publishedContent || !readFileSync2(
|
|
1089
|
+
if (!publishedContent || !readFileSync2(join3(root, file)).equals(publishedContent)) {
|
|
1448
1090
|
throw new Error(`installed content differs for ${name}/${file}`);
|
|
1449
1091
|
}
|
|
1450
1092
|
}
|
|
@@ -1500,7 +1142,7 @@ function probeInstallers(timeoutMs) {
|
|
|
1500
1142
|
};
|
|
1501
1143
|
}
|
|
1502
1144
|
function noInstallerProbePath(baseUrl) {
|
|
1503
|
-
return
|
|
1145
|
+
return join3(
|
|
1504
1146
|
sdkCliStateDirPath(baseUrl),
|
|
1505
1147
|
"skills-sync-no-installer-unknown.json"
|
|
1506
1148
|
);
|
|
@@ -1522,8 +1164,8 @@ function rememberUnavailableInstallerProbes(baseUrl, remoteVersion, probes, prob
|
|
|
1522
1164
|
if (probes.bunx !== "available" && probes.npx !== "available") {
|
|
1523
1165
|
const path = noInstallerProbePath(baseUrl);
|
|
1524
1166
|
try {
|
|
1525
|
-
|
|
1526
|
-
|
|
1167
|
+
mkdirSync3(dirname3(path), { recursive: true });
|
|
1168
|
+
writeFileSync3(
|
|
1527
1169
|
path,
|
|
1528
1170
|
JSON.stringify({
|
|
1529
1171
|
version: remoteVersion,
|
|
@@ -1577,8 +1219,8 @@ function temporarySkillsSyncSkipCommand() {
|
|
|
1577
1219
|
}
|
|
1578
1220
|
return "DEEPLINE_SKIP_SKILLS_SYNC=1 deepline <command>";
|
|
1579
1221
|
}
|
|
1580
|
-
function resolveSkillsInstallSpawn(install,
|
|
1581
|
-
return resolveShellSpawn(install.command, install.args,
|
|
1222
|
+
function resolveSkillsInstallSpawn(install, platform = process.platform) {
|
|
1223
|
+
return resolveShellSpawn(install.command, install.args, platform);
|
|
1582
1224
|
}
|
|
1583
1225
|
function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES, agents = DEFAULT_SKILL_AGENTS, knownProbes) {
|
|
1584
1226
|
const commands = [];
|
|
@@ -1731,7 +1373,8 @@ function writeSdkSkillsStatusLine(line) {
|
|
|
1731
1373
|
`);
|
|
1732
1374
|
}
|
|
1733
1375
|
async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
1734
|
-
|
|
1376
|
+
const skip = shouldSkipSkillsSync();
|
|
1377
|
+
if (skip && !options.claim) return;
|
|
1735
1378
|
const usingPluginSkills = hasActivePluginSkills();
|
|
1736
1379
|
if (usingPluginSkills) {
|
|
1737
1380
|
return;
|
|
@@ -1748,6 +1391,10 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
|
1748
1391
|
if (leases && [...leases.values()].some((lease) => lease.owner !== options.claim)) {
|
|
1749
1392
|
return;
|
|
1750
1393
|
}
|
|
1394
|
+
if (skip) {
|
|
1395
|
+
if (leases) releaseInProgressSkillsSync(baseUrl, claimTokensOf(leases));
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1751
1398
|
if (leases) recordOwnPidOnInProgressSkillsSync(baseUrl, leases);
|
|
1752
1399
|
const claimedVersion = leases ? claimedSkillsVersion(leases) : "";
|
|
1753
1400
|
if (options.mode === "detached" && agents.length > 0 && options.update === void 0 && !claimedVersion) {
|
|
@@ -1950,17 +1597,13 @@ export {
|
|
|
1950
1597
|
checkSdkCompatibility,
|
|
1951
1598
|
isCiEnvironment,
|
|
1952
1599
|
enforceSdkCompatibilityResponse,
|
|
1953
|
-
isFailureReportingDisabled,
|
|
1954
|
-
redactFailureText,
|
|
1955
|
-
sanitizeCommand,
|
|
1956
|
-
failureReportHeaders,
|
|
1957
|
-
resolveSdkCliFailureExitCode,
|
|
1958
|
-
maybeReportSdkCliFailure,
|
|
1959
1600
|
SKILLS_NPX_PACKAGE,
|
|
1960
1601
|
DEFAULT_SDK_SKILL_NAMES,
|
|
1961
1602
|
LEGACY_SKILL_NAMES_TO_REMOVE,
|
|
1962
1603
|
skillsSourceUrl,
|
|
1963
1604
|
resolveShellSpawn,
|
|
1605
|
+
isCliSkillsSyncEnabled,
|
|
1606
|
+
setCliSkillsSyncEnabled,
|
|
1964
1607
|
SkillsStateUnavailableError,
|
|
1965
1608
|
acquireSkillsInstallLease,
|
|
1966
1609
|
skillsInstallLeasePath,
|