deepline 0.3.392 → 0.3.393
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client.ts +156 -24
- package/dist/bundling-sources/sdk/src/compat.ts +9 -0
- package/dist/bundling-sources/sdk/src/http.ts +5 -1
- package/dist/bundling-sources/sdk/src/index.ts +5 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +182 -6
- package/dist/bundling-sources/sdk/src/release.ts +4 -1
- package/dist/bundling-sources/sdk/src/types.ts +13 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/request-warnings.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +315 -0
- package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +41 -8
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +418 -44
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +36 -3
- package/dist/bundling-sources/shared_libs/play-runtime/durable-invocation-fence.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +11 -3
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +19 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +158 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +235 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +92 -58
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +30 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1161 -316
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +28 -15
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +24 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +31 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -4
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +172 -79
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +173 -1
- package/dist/cli/{auth-6JSA2ZCW.mjs → auth-5PXHA232.mjs} +4 -4
- package/dist/cli/auth-P3MVDTXM.js +39 -0
- package/dist/cli/{billing-Q5BLQHIU.js → billing-JFB2XLSO.js} +101 -74
- package/dist/cli/{billing-MRRO643H.mjs → billing-Z2N7ZAGM.mjs} +32 -5
- package/dist/cli/{chunk-CVLM3WMJ.js → chunk-2HAD745V.js} +242 -183
- package/dist/cli/{chunk-HGYBEAQP.mjs → chunk-2LGC4EFT.mjs} +3 -3
- package/dist/cli/{chunk-A3APGZFP.mjs → chunk-4PT2VA3A.mjs} +2 -2
- package/dist/cli/{chunk-6DBOU7UH.js → chunk-4XX6443T.js} +176 -87
- package/dist/cli/{chunk-2QLML6G4.mjs → chunk-5KWKZIQR.mjs} +4 -4
- package/dist/cli/{chunk-2G7DXFHI.mjs → chunk-5PRVMXKB.mjs} +27 -2
- package/dist/cli/{chunk-DSWSEHRX.mjs → chunk-6I73X254.mjs} +1 -1
- package/dist/cli/{chunk-ZTACINO5.mjs → chunk-7HR7BGZL.mjs} +13 -3
- package/dist/cli/{chunk-BB3FNYFY.js → chunk-AARX5L4B.js} +2 -2
- package/dist/cli/{chunk-WMS5U6YB.js → chunk-CDFH2DYL.js} +20 -19
- package/dist/cli/{chunk-R3O2CZ4H.mjs → chunk-FQ6VHPW4.mjs} +2 -2
- package/dist/cli/{chunk-MU6M3URX.mjs → chunk-HLEESTCH.mjs} +1 -1
- package/dist/cli/{chunk-Q6EOHNRH.mjs → chunk-JI2B4RZP.mjs} +119 -6
- package/dist/cli/{chunk-2Q3GEFL4.mjs → chunk-KIYU2TGL.mjs} +2 -2
- package/dist/cli/{chunk-Y6VOGHF2.mjs → chunk-KZZC33PY.mjs} +0 -181
- package/dist/cli/{chunk-UCKJQG25.js → chunk-L2SYLGRP.js} +8 -8
- package/dist/cli/{chunk-2GAHHSLB.mjs → chunk-LMMEAMA7.mjs} +3 -2
- package/dist/cli/{chunk-YAZCDBXX.mjs → chunk-LZPCDB7U.mjs} +3 -2
- package/dist/cli/{chunk-RV6ALZIX.js → chunk-M7Y7JYZX.js} +32 -7
- package/dist/cli/{chunk-QGKPTBRR.js → chunk-MS6GUPBB.js} +3 -3
- package/dist/cli/{chunk-4SFPVW7A.js → chunk-OXNOAD6Y.js} +26 -26
- package/dist/cli/{chunk-JOFPQGXW.js → chunk-PTDECJGP.js} +50 -50
- package/dist/cli/{chunk-5O4B6AUN.js → chunk-PWSWAN7Q.js} +25 -2
- package/dist/cli/{chunk-YN6YA7ZZ.mjs → chunk-Q26LUSQ2.mjs} +79 -20
- package/dist/cli/{chunk-3VN4FTE3.js → chunk-RDXFGPJU.js} +1 -182
- package/dist/cli/{chunk-7E66A24V.mjs → chunk-RKMB3N7K.mjs} +25 -2
- package/dist/cli/{chunk-JSLPHFP7.js → chunk-RWHWF5ZJ.js} +3 -2
- package/dist/cli/{chunk-3FV4GBRK.mjs → chunk-STNYIMIV.mjs} +97 -8
- package/dist/cli/chunk-UBKA33KY.mjs +310 -0
- package/dist/cli/{chunk-PAIMOGCM.js → chunk-UHNDVD3P.js} +125 -12
- package/dist/cli/{chunk-24VEN5PQ.mjs → chunk-UOGZUA24.mjs} +179 -17
- package/dist/cli/{chunk-T7OKJ2T6.js → chunk-VIQJIX2P.js} +73 -63
- package/dist/cli/{chunk-RIV2GS5E.js → chunk-VIWE6WRK.js} +627 -465
- package/dist/cli/{chunk-EY7RFC6A.js → chunk-W4WOMXR3.js} +15 -15
- package/dist/cli/chunk-XDVT3GOM.js +310 -0
- package/dist/cli/{chunk-2FQG2HU4.js → chunk-Z3OOZM5L.js} +8 -8
- package/dist/cli/{csv-E4QGUIGI.mjs → csv-KJWZHKCH.mjs} +3 -3
- package/dist/cli/{csv-26U5T24Z.js → csv-P3Z3YE7H.js} +12 -12
- package/dist/cli/{db-JTRJIAQW.mjs → db-NCM4CQIS.mjs} +6 -5
- package/dist/cli/{db-QHBFLMVL.js → db-NUZGJNQC.js} +31 -30
- package/dist/cli/{describe-E3DE3ZK3.mjs → describe-WT6MM2GO.mjs} +17 -16
- package/dist/cli/{describe-FDV2V74F.js → describe-YGSEN5WC.js} +24 -23
- package/dist/cli/{executions-VZYOGVQY.js → executions-PCOLHN7Q.js} +8 -7
- package/dist/cli/{executions-B3GTNPRE.mjs → executions-XS2IPJ4W.mjs} +6 -5
- package/dist/cli/{feedback-CR55FJA2.js → feedback-4MSH7TFU.js} +7 -7
- package/dist/cli/{feedback-4CEBR3OV.mjs → feedback-CCLTS5SV.mjs} +3 -3
- package/dist/cli/{git-NM2PHHZ4.mjs → git-K2DHPMPC.mjs} +4 -4
- package/dist/cli/git-RNM45FX4.js +23 -0
- package/dist/cli/index.js +96 -92
- package/dist/cli/index.mjs +46 -42
- package/dist/cli/{legacy-noops-A7MSW5ND.mjs → legacy-noops-B5S4AR3P.mjs} +4 -4
- package/dist/cli/{legacy-noops-ZUA4YFIH.js → legacy-noops-GPNOPFXV.js} +7 -7
- package/dist/cli/{monitors-NVPRQYP3.mjs → monitors-JLMAIPRG.mjs} +6 -5
- package/dist/cli/{monitors-ZE3TLZ4H.js → monitors-ZAWD7NSN.js} +87 -86
- package/dist/cli/{org-U7A6DV5D.js → org-P2KN4CES.js} +66 -65
- package/dist/cli/{org-KUBILNQV.mjs → org-T3JTHP4G.mjs} +6 -5
- package/dist/cli/{play-HRDXQ4QE.mjs → play-NK6BLRGL.mjs} +11 -10
- package/dist/cli/play-PDXR6JFB.js +158 -0
- package/dist/cli/{providers-OHIWI453.mjs → providers-3NQRA7IT.mjs} +6 -5
- package/dist/cli/{providers-VD6YTVQZ.js → providers-5QRZN3DT.js} +9 -8
- package/dist/cli/{quickstart-UBV2FONF.mjs → quickstart-PIA2JGPV.mjs} +3 -3
- package/dist/cli/{quickstart-ETTCWPA4.js → quickstart-R7NUZGNW.js} +5 -5
- package/dist/cli/run-identity-G257GQED.js +25 -0
- package/dist/cli/run-identity-MRNCEGV2.mjs +25 -0
- package/dist/cli/{search-F44IZRT7.mjs → search-AIDIIGLY.mjs} +7 -6
- package/dist/cli/search-QRWL7MFM.js +27 -0
- package/dist/cli/{secrets-CAEMRORF.js → secrets-BT3PGMWN.js} +15 -14
- package/dist/cli/{secrets-R6XOJZKU.mjs → secrets-OQNHL45O.mjs} +6 -5
- package/dist/cli/{sessions-6GC7OFTT.js → sessions-EYXWOSWK.js} +5 -5
- package/dist/cli/{sessions-RLN6UQS3.mjs → sessions-SF7WJPJP.mjs} +4 -4
- package/dist/cli/{settings-DPNVUAV2.js → settings-BA3GHBOD.js} +76 -75
- package/dist/cli/{settings-KIPAMRPP.mjs → settings-Y57JTFDD.mjs} +9 -8
- package/dist/cli/{setup-TU2F7PU5.mjs → setup-7GR5GBHA.mjs} +6 -6
- package/dist/cli/{setup-DTL3L5SG.js → setup-RERXYC66.js} +41 -41
- package/dist/cli/{skills-UV5MYJ46.mjs → skills-SJWIQAV5.mjs} +4 -4
- package/dist/cli/skills-V7EY75HB.js +28 -0
- package/dist/cli/tools-H5HLBCHH.js +41 -0
- package/dist/cli/{tools-QRRNDCQ7.mjs → tools-ZF3JXPNL.mjs} +10 -9
- package/dist/cli/update-472HA3LT.js +28 -0
- package/dist/cli/{update-4426TF35.mjs → update-FFFYQAOJ.mjs} +6 -6
- package/dist/cli/{workflow-HNLOVISB.js → workflow-SZJVQH4T.js} +17 -16
- package/dist/cli/{workflow-N4U5VLZ3.mjs → workflow-XVFEEGAS.mjs} +7 -6
- package/dist/{client-e6Qh5ZIg.d.mts → client-DU5dtHDy.d.mts} +153 -4
- package/dist/{client-Uxuy-xQ2.d.ts → client-mCE88hC4.d.ts} +153 -4
- package/dist/{compiler-manifest-CY2v8ab0.d.ts → compiler-manifest-DE4RdAiY.d.mts} +61 -1
- package/dist/{compiler-manifest-CY2v8ab0.d.mts → compiler-manifest-DE4RdAiY.d.ts} +61 -1
- package/dist/{index-B9fBZH1g.d.mts → index-BI6nWgaV.d.mts} +1 -1
- package/dist/{index-BZ6uzZJl.d.ts → index-Bi-f7HFT.d.ts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +120 -29
- package/dist/index.mjs +111 -20
- package/dist/install-integrity.json +91 -86
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +5 -2
- package/dist/plays/run-request.mjs +4 -1
- package/dist/release.d.mts +4 -1
- package/dist/release.d.ts +4 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
- package/dist/cli/auth-67TAELQL.js +0 -39
- package/dist/cli/git-I5JTK6YU.js +0 -23
- package/dist/cli/play-A2V7YDU7.js +0 -157
- package/dist/cli/search-WWXMBVPH.js +0 -26
- package/dist/cli/skills-SWOSEZLB.js +0 -28
- package/dist/cli/tools-IL2YCDQ6.js +0 -40
- package/dist/cli/update-BERDPEYR.js +0 -28
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
npmSupportsAllowScripts,
|
|
3
3
|
readNpmVersion
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HLEESTCH.mjs";
|
|
5
5
|
import {
|
|
6
6
|
resolveShellSpawn,
|
|
7
7
|
runSkillsCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7HR7BGZL.mjs";
|
|
9
9
|
import {
|
|
10
10
|
printCommandEnvelope
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5PRVMXKB.mjs";
|
|
12
12
|
import {
|
|
13
13
|
autoDetectBaseUrl
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LMMEAMA7.mjs";
|
|
15
15
|
|
|
16
16
|
// src/cli/commands/update.ts
|
|
17
17
|
import { spawn, spawnSync } from "child_process";
|
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
detectAgentRuntime,
|
|
4
4
|
resolveCliCommandContext,
|
|
5
5
|
resolveConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LMMEAMA7.mjs";
|
|
7
7
|
import {
|
|
8
|
-
DeeplineError
|
|
8
|
+
DeeplineError,
|
|
9
|
+
serializeToolExecutionFailure
|
|
9
10
|
} from "./chunk-NXGCO4JB.mjs";
|
|
10
11
|
|
|
11
12
|
// src/cli/json-fields.ts
|
|
@@ -828,8 +829,30 @@ function printCompactJson(value) {
|
|
|
828
829
|
process.stdout.write(`${JSON.stringify(withAgentCommandContext(value))}
|
|
829
830
|
`);
|
|
830
831
|
}
|
|
832
|
+
function cliToolExecutionFailure(error) {
|
|
833
|
+
const failure = serializeToolExecutionFailure(error);
|
|
834
|
+
if (!failure) return null;
|
|
835
|
+
const { publicDetails: _publicDetails, ...facts } = failure;
|
|
836
|
+
return facts;
|
|
837
|
+
}
|
|
838
|
+
function formatToolExecutionErrorDiagnostic(error) {
|
|
839
|
+
const failure = cliToolExecutionFailure(error);
|
|
840
|
+
if (!failure) return null;
|
|
841
|
+
const lines = [
|
|
842
|
+
`Tool: ${failure.toolId}${failure.provider ? `; provider: ${failure.provider}` : ""}${failure.operation ? `; operation: ${failure.operation}` : ""}.`,
|
|
843
|
+
`Failure: ${failure.origin} / ${failure.category}. Same-call retry: ${failure.retryable ? `safe${failure.retryAfterMs === null ? "" : ` after ${failure.retryAfterMs}ms`}` : "unsafe"}.`
|
|
844
|
+
];
|
|
845
|
+
if (failure.networkKind || failure.networkScope) {
|
|
846
|
+
lines.push(
|
|
847
|
+
`Network: ${failure.networkKind ?? "unknown"}${failure.networkScope ? ` (${failure.networkScope})` : ""}.`
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
if (failure.requestId) lines.push(`Request: ${failure.requestId}.`);
|
|
851
|
+
return lines.join("\n");
|
|
852
|
+
}
|
|
831
853
|
function errorToJsonPayload(error) {
|
|
832
854
|
const message = error instanceof Error ? error.message : String(error);
|
|
855
|
+
const toolFailure = cliToolExecutionFailure(error);
|
|
833
856
|
const maybeRecord = error && typeof error === "object" ? error : null;
|
|
834
857
|
const code = typeof maybeRecord?.code === "string" ? maybeRecord.code : error instanceof SyntaxError ? "INVALID_JSON" : "CLI_ERROR";
|
|
835
858
|
const details = {};
|
|
@@ -868,6 +891,7 @@ function errorToJsonPayload(error) {
|
|
|
868
891
|
error: {
|
|
869
892
|
message,
|
|
870
893
|
code,
|
|
894
|
+
...toolFailure ? { tool_error: toolFailure } : {},
|
|
871
895
|
...Object.keys(details).length > 0 ? { details } : {}
|
|
872
896
|
}
|
|
873
897
|
};
|
|
@@ -966,6 +990,7 @@ export {
|
|
|
966
990
|
markdownTableFromRows,
|
|
967
991
|
printJson,
|
|
968
992
|
printCompactJson,
|
|
993
|
+
formatToolExecutionErrorDiagnostic,
|
|
969
994
|
errorToJsonPayload,
|
|
970
995
|
formatProviderConcurrencyDiagnostic,
|
|
971
996
|
printJsonError,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-GAMFK2ZP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
printCommandEnvelope
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5PRVMXKB.mjs";
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_SKILL_AGENTS,
|
|
9
9
|
KNOWN_SKILL_AGENTS,
|
|
@@ -22,10 +22,13 @@ import {
|
|
|
22
22
|
sdkCliStateDirPath,
|
|
23
23
|
skillsAgentPathSegment,
|
|
24
24
|
writeSdkSkillsLocalVersion
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LMMEAMA7.mjs";
|
|
26
26
|
import {
|
|
27
27
|
DeeplineError
|
|
28
28
|
} from "./chunk-NXGCO4JB.mjs";
|
|
29
|
+
import {
|
|
30
|
+
SDK_RELEASE
|
|
31
|
+
} from "./chunk-LZPCDB7U.mjs";
|
|
29
32
|
|
|
30
33
|
// src/cli/commands/skills.ts
|
|
31
34
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -317,6 +320,10 @@ async function checkSdkCompatibility(baseUrl, options = {}) {
|
|
|
317
320
|
}
|
|
318
321
|
if (options.skillsVersion !== void 0) {
|
|
319
322
|
url.searchParams.set("skills_version", options.skillsVersion ?? "");
|
|
323
|
+
url.searchParams.set(
|
|
324
|
+
"skills_cli_capability",
|
|
325
|
+
String(SDK_RELEASE.packageCapabilities.skillsGuidance)
|
|
326
|
+
);
|
|
320
327
|
}
|
|
321
328
|
if (options.catalog) {
|
|
322
329
|
url.searchParams.set("catalog_tool_id", options.catalog.toolId);
|
|
@@ -1417,8 +1424,10 @@ async function fetchSkillsUpdate(baseUrl, localVersion) {
|
|
|
1417
1424
|
method: "POST",
|
|
1418
1425
|
headers: { "Content-Type": "application/json" },
|
|
1419
1426
|
body: JSON.stringify({
|
|
1427
|
+
sdk_cli: { version: SDK_VERSION },
|
|
1420
1428
|
skills: {
|
|
1421
|
-
version: localVersion
|
|
1429
|
+
version: localVersion,
|
|
1430
|
+
capability: SDK_RELEASE.packageCapabilities.skillsGuidance
|
|
1422
1431
|
}
|
|
1423
1432
|
}),
|
|
1424
1433
|
signal: controller.signal
|
|
@@ -2368,6 +2377,7 @@ export {
|
|
|
2368
2377
|
enforceSdkCompatibilityResponse,
|
|
2369
2378
|
resolveShellSpawn,
|
|
2370
2379
|
isFailureReportingDisabled,
|
|
2380
|
+
redactFailureText,
|
|
2371
2381
|
sanitizeCommand,
|
|
2372
2382
|
failureReportHeaders,
|
|
2373
2383
|
resolveSdkCliFailureExitCode,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVIQJIX2Pjs = require('./chunk-VIQJIX2P.js');
|
|
4
4
|
|
|
5
5
|
// src/cli/npm-script-policy.ts
|
|
6
6
|
var _child_process = require('child_process');
|
|
@@ -13,7 +13,7 @@ function npmSupportsAllowScripts(version) {
|
|
|
13
13
|
}
|
|
14
14
|
function readNpmVersion(env) {
|
|
15
15
|
try {
|
|
16
|
-
const plan =
|
|
16
|
+
const plan = _chunkVIQJIX2Pjs.resolveShellSpawn.call(void 0, "npm", ["--version"], process.platform, env);
|
|
17
17
|
const result = _child_process.spawnSync.call(void 0, plan.command, plan.args, {
|
|
18
18
|
encoding: "utf8",
|
|
19
19
|
env,
|
|
@@ -14,7 +14,7 @@ var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
|
|
|
14
14
|
var _chunk7P5AA3SNjs = require('./chunk-7P5AA3SN.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkRWHWF5ZJjs = require('./chunk-RWHWF5ZJ.js');
|
|
18
18
|
|
|
19
19
|
// src/errors.ts
|
|
20
20
|
var CustomerDbQueryOutcomeUnknownError = (_class = class extends _chunk7P5AA3SNjs.DeeplineError {
|
|
@@ -744,9 +744,9 @@ function resolveCliCommandContext(inputConfig, requestedScope) {
|
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
// src/version.ts
|
|
747
|
-
var SDK_VERSION =
|
|
748
|
-
var SDK_API_MAJOR =
|
|
749
|
-
var SDK_API_CONTRACT = _nullishCoalesce(
|
|
747
|
+
var SDK_VERSION = _chunkRWHWF5ZJjs.SDK_RELEASE.version;
|
|
748
|
+
var SDK_API_MAJOR = _chunkRWHWF5ZJjs.SDK_RELEASE.contracts.api.currentMajor;
|
|
749
|
+
var SDK_API_CONTRACT = _nullishCoalesce(_chunkRWHWF5ZJjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
|
|
750
750
|
|
|
751
751
|
// src/agent-runtime.ts
|
|
752
752
|
|
|
@@ -1739,13 +1739,14 @@ var HttpClient = class {
|
|
|
1739
1739
|
applyExplicitHeaders(headers, { "Content-Type": "application/json" });
|
|
1740
1740
|
}
|
|
1741
1741
|
let lastError = null;
|
|
1742
|
-
|
|
1742
|
+
const candidateUrls = _optionalChain([options, 'optionalAccess', _209 => _209.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
|
|
1743
|
+
for (const candidateUrl of candidateUrls) {
|
|
1743
1744
|
try {
|
|
1744
1745
|
const response = await fetch(candidateUrl, {
|
|
1745
1746
|
method,
|
|
1746
1747
|
headers,
|
|
1747
|
-
body: _optionalChain([options, 'optionalAccess',
|
|
1748
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
1748
|
+
body: _optionalChain([options, 'optionalAccess', _210 => _210.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
1749
|
+
signal: _optionalChain([options, 'optionalAccess', _211 => _211.signal])
|
|
1749
1750
|
});
|
|
1750
1751
|
if (!response.ok) {
|
|
1751
1752
|
const body = await response.text();
|
|
@@ -1786,7 +1787,7 @@ var HttpClient = class {
|
|
|
1786
1787
|
throw error;
|
|
1787
1788
|
}
|
|
1788
1789
|
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
1789
|
-
if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess',
|
|
1790
|
+
if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess', _212 => _212.signal, 'optionalAccess', _213 => _213.aborted])) {
|
|
1790
1791
|
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
1791
1792
|
`Stream from ${this.config.baseUrl} was aborted by the caller.`,
|
|
1792
1793
|
void 0,
|
|
@@ -1807,7 +1808,7 @@ var HttpClient = class {
|
|
|
1807
1808
|
}
|
|
1808
1809
|
throw new (0, _chunk7P5AA3SNjs.DeeplineError)(
|
|
1809
1810
|
withCoworkNetworkHint(
|
|
1810
|
-
_optionalChain([lastError, 'optionalAccess',
|
|
1811
|
+
_optionalChain([lastError, 'optionalAccess', _214 => _214.message]) ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
|
|
1811
1812
|
)
|
|
1812
1813
|
);
|
|
1813
1814
|
}
|
|
@@ -1869,15 +1870,15 @@ function parseResponseBody(body) {
|
|
|
1869
1870
|
}
|
|
1870
1871
|
function isProviderOriginatedHttpError(parsed) {
|
|
1871
1872
|
const response = asRecord(parsed);
|
|
1872
|
-
const error = asRecord(_optionalChain([response, 'optionalAccess',
|
|
1873
|
-
const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess',
|
|
1874
|
-
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess',
|
|
1873
|
+
const error = asRecord(_optionalChain([response, 'optionalAccess', _215 => _215.error]));
|
|
1874
|
+
const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _216 => _216.failure_origin]), () => ( _optionalChain([response, 'optionalAccess', _217 => _217.failure_origin])));
|
|
1875
|
+
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _218 => _218.code]), () => ( _optionalChain([response, 'optionalAccess', _219 => _219.code])));
|
|
1875
1876
|
return failureOrigin === "provider" || code === "UPSTREAM_BLOCKED";
|
|
1876
1877
|
}
|
|
1877
1878
|
function isMonitorRateLimitEnvelope(parsed) {
|
|
1878
1879
|
const response = asRecord(parsed);
|
|
1879
|
-
const error = asRecord(_optionalChain([response, 'optionalAccess',
|
|
1880
|
-
return _optionalChain([error, 'optionalAccess',
|
|
1880
|
+
const error = asRecord(_optionalChain([response, 'optionalAccess', _220 => _220.error]));
|
|
1881
|
+
return _optionalChain([error, 'optionalAccess', _221 => _221.code]) === "monitor_upstream_rate_limited" && typeof error.message === "string";
|
|
1881
1882
|
}
|
|
1882
1883
|
function asRecord(value) {
|
|
1883
1884
|
return typeof value === "object" && value !== null ? value : null;
|
|
@@ -1893,7 +1894,7 @@ function detectHtmlErrorBody(body, contentType) {
|
|
|
1893
1894
|
return null;
|
|
1894
1895
|
}
|
|
1895
1896
|
const titleMatch = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
1896
|
-
const title = _optionalChain([titleMatch, 'optionalAccess',
|
|
1897
|
+
const title = _optionalChain([titleMatch, 'optionalAccess', _222 => _222[1], 'optionalAccess', _223 => _223.replace, 'call', _224 => _224(/\s+/g, " "), 'access', _225 => _225.trim, 'call', _226 => _226()]) || void 0;
|
|
1897
1898
|
const workerThrewException = /worker threw exception/i.test(trimmed);
|
|
1898
1899
|
return {
|
|
1899
1900
|
title,
|
|
@@ -1977,20 +1978,20 @@ function decodeSseFrame(frame) {
|
|
|
1977
1978
|
}
|
|
1978
1979
|
function sleep(ms, signal) {
|
|
1979
1980
|
return new Promise((resolve2, reject) => {
|
|
1980
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
1981
|
+
if (_optionalChain([signal, 'optionalAccess', _227 => _227.aborted])) {
|
|
1981
1982
|
reject(requestCancelledError(signal));
|
|
1982
1983
|
return;
|
|
1983
1984
|
}
|
|
1984
1985
|
const timeoutId = setTimeout(() => {
|
|
1985
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1986
|
+
_optionalChain([signal, 'optionalAccess', _228 => _228.removeEventListener, 'call', _229 => _229("abort", abort)]);
|
|
1986
1987
|
resolve2();
|
|
1987
1988
|
}, ms);
|
|
1988
1989
|
const abort = () => {
|
|
1989
1990
|
clearTimeout(timeoutId);
|
|
1990
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1991
|
+
_optionalChain([signal, 'optionalAccess', _230 => _230.removeEventListener, 'call', _231 => _231("abort", abort)]);
|
|
1991
1992
|
reject(requestCancelledError(signal));
|
|
1992
1993
|
};
|
|
1993
|
-
_optionalChain([signal, 'optionalAccess',
|
|
1994
|
+
_optionalChain([signal, 'optionalAccess', _232 => _232.addEventListener, 'call', _233 => _233("abort", abort, { once: true })]);
|
|
1994
1995
|
});
|
|
1995
1996
|
}
|
|
1996
1997
|
function withCoworkNetworkHint(message) {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
argsWantJson,
|
|
3
3
|
openInBrowser,
|
|
4
4
|
printCommandEnvelope
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5PRVMXKB.mjs";
|
|
6
6
|
import {
|
|
7
7
|
ACTIVE_ORG_ID_ENV,
|
|
8
8
|
ACTIVE_ORG_NAME_ENV,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
saveHostEnvValues,
|
|
26
26
|
saveProjectDeeplineEnvValues,
|
|
27
27
|
storedHostApiKey
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-LMMEAMA7.mjs";
|
|
29
29
|
|
|
30
30
|
// src/cli/commands/auth.ts
|
|
31
31
|
import {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildCallerPlayWorkflowId,
|
|
3
|
+
callerPlayWorkflowIdMatchesRequest
|
|
4
|
+
} from "./chunk-UBKA33KY.mjs";
|
|
1
5
|
import {
|
|
2
6
|
apiErrorCodeFromResponse,
|
|
3
7
|
apiErrorMessage
|
|
@@ -74,6 +78,9 @@ var PLAY_FILES_STAGE_PATH = "/api/v2/plays/files/stage";
|
|
|
74
78
|
var PLAY_FILES_STAGE_MINT_PATH = `${PLAY_FILES_STAGE_PATH}/mint`;
|
|
75
79
|
function buildPlayRunStartBody(request) {
|
|
76
80
|
return {
|
|
81
|
+
...request.admissionOrgId ? { admissionOrgId: request.admissionOrgId } : {},
|
|
82
|
+
...request.workflowId ? { workflowId: request.workflowId } : {},
|
|
83
|
+
...request.maxTotalCredits !== void 0 ? { maxTotalCredits: request.maxTotalCredits } : {},
|
|
77
84
|
...request.name ? { name: request.name } : {},
|
|
78
85
|
...request.revisionId ? { revisionId: request.revisionId } : {},
|
|
79
86
|
...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
|
|
@@ -105,13 +112,117 @@ function buildPlayRunStartBody(request) {
|
|
|
105
112
|
...request.testPolicyOverrides ? { testPolicyOverrides: request.testPolicyOverrides } : {}
|
|
106
113
|
};
|
|
107
114
|
}
|
|
108
|
-
async function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
async function preparePlayRunAdmission(http, request, onSubmission) {
|
|
116
|
+
let capability = null;
|
|
117
|
+
if (http.get) {
|
|
118
|
+
try {
|
|
119
|
+
capability = await http.get(PLAY_RUN_START_PATH);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (!(error instanceof DeeplineError) || ![404, 405].includes(error.statusCode ?? 0))
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
if (capability && !["caller-intent-v1", "unsupported"].includes(
|
|
125
|
+
capability.admissionContract ?? ""
|
|
126
|
+
)) {
|
|
127
|
+
throw new DeeplineError(
|
|
128
|
+
"The server admission capability response is unknown; execution was not submitted.",
|
|
129
|
+
503,
|
|
130
|
+
"PLAY_RUN_ADMISSION_CAPABILITY_UNKNOWN"
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const supportsCallerIntent = capability?.admissionContract === "caller-intent-v1";
|
|
135
|
+
if (supportsCallerIntent && (!capability?.orgId || request.admissionOrgId && request.admissionOrgId !== capability.orgId)) {
|
|
136
|
+
throw new DeeplineError(
|
|
137
|
+
"The admission workspace could not be pinned to this request; execution was not submitted.",
|
|
138
|
+
409,
|
|
139
|
+
"PLAY_RUN_ADMISSION_TENANT_CONFLICT"
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (request.workflowId && !supportsCallerIntent) {
|
|
143
|
+
throw new DeeplineError(
|
|
144
|
+
"This server has not enabled caller-owned admission recovery. Do not retry an ambiguous start.",
|
|
145
|
+
409,
|
|
146
|
+
"PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
if (request.maxTotalCredits !== void 0 && capability?.strictTotalBudget !== "fail-closed-v1") {
|
|
150
|
+
throw new DeeplineError(
|
|
151
|
+
"This server cannot honor a strict total Play budget. Execution was not submitted.",
|
|
152
|
+
409,
|
|
153
|
+
"PLAY_TOTAL_BUDGET_UNSUPPORTED"
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
const wireBody = JSON.parse(
|
|
157
|
+
JSON.stringify(
|
|
158
|
+
buildPlayRunStartBody({
|
|
159
|
+
...request,
|
|
160
|
+
...supportsCallerIntent ? { admissionOrgId: capability.orgId } : {}
|
|
161
|
+
})
|
|
162
|
+
)
|
|
114
163
|
);
|
|
164
|
+
const workflowId = supportsCallerIntent ? request.workflowId ?? buildCallerPlayWorkflowId(request.name ?? "play", wireBody) : void 0;
|
|
165
|
+
const submittedBody = workflowId ? { workflowId, ...wireBody } : wireBody;
|
|
166
|
+
if (workflowId && !callerPlayWorkflowIdMatchesRequest(workflowId, submittedBody)) {
|
|
167
|
+
throw new DeeplineError(
|
|
168
|
+
"workflowId must be the caller run ID of this same immutable request.",
|
|
169
|
+
400,
|
|
170
|
+
"PLAY_RUN_START_INTENT_CONFLICT"
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
if (onSubmission) {
|
|
174
|
+
if (!workflowId || !capability?.orgId) {
|
|
175
|
+
throw new DeeplineError(
|
|
176
|
+
"This server cannot persist a recoverable submission intent. Execution was not submitted.",
|
|
177
|
+
409,
|
|
178
|
+
"PLAY_RUN_ADMISSION_RECOVERY_UNSUPPORTED"
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
await onSubmission({
|
|
182
|
+
workflowId,
|
|
183
|
+
orgId: capability.orgId,
|
|
184
|
+
request: submittedBody
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return { body: submittedBody, workflowId, supportsCallerIntent };
|
|
188
|
+
}
|
|
189
|
+
async function startPlayRun(http, request, headers, onSubmission) {
|
|
190
|
+
const {
|
|
191
|
+
body: submittedBody,
|
|
192
|
+
workflowId,
|
|
193
|
+
supportsCallerIntent
|
|
194
|
+
} = await preparePlayRunAdmission(http, request, onSubmission);
|
|
195
|
+
let response;
|
|
196
|
+
try {
|
|
197
|
+
response = await http.post(
|
|
198
|
+
PLAY_RUN_START_PATH,
|
|
199
|
+
submittedBody,
|
|
200
|
+
headers,
|
|
201
|
+
{ maxRetries: 0, exactUrlOnly: true }
|
|
202
|
+
);
|
|
203
|
+
} catch (error) {
|
|
204
|
+
if (error instanceof DeeplineError && ["NETWORK_TIMEOUT", "NETWORK_ERROR", "FETCH_FAILED"].includes(
|
|
205
|
+
error.code ?? ""
|
|
206
|
+
) || error instanceof TypeError || error instanceof Error && ["AbortError", "TimeoutError"].includes(error.name)) {
|
|
207
|
+
const originalMessage = error instanceof Error ? error.message : "Transport failed";
|
|
208
|
+
const failure = new DeeplineError(
|
|
209
|
+
workflowId ? `${originalMessage} Admission outcome is unknown for ${workflowId}. Inspect this run before retrying; reuse this workflowId for the same immutable request.` : `${originalMessage} Admission outcome is unknown. This server did not prove caller-owned recovery support; inspect existing runs before starting again.`,
|
|
210
|
+
error instanceof DeeplineError ? error.statusCode : void 0,
|
|
211
|
+
error instanceof DeeplineError ? error.code : "NETWORK_ERROR",
|
|
212
|
+
{
|
|
213
|
+
...workflowId ? { runId: workflowId, workflowId } : {},
|
|
214
|
+
admissionState: "unknown",
|
|
215
|
+
recoverySupported: supportsCallerIntent,
|
|
216
|
+
next: {
|
|
217
|
+
inspect: workflowId ? `deepline runs get ${workflowId} --json` : "deepline runs list --json"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
Object.assign(failure, { cause: error });
|
|
222
|
+
throw failure;
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
115
226
|
return normalizePlayRunStart(response);
|
|
116
227
|
}
|
|
117
228
|
function isPlayRunPackage(value) {
|
|
@@ -520,6 +631,7 @@ function createSessionPlayRunHttp(fetchImpl = (...args) => fetch(...args)) {
|
|
|
520
631
|
return parsed;
|
|
521
632
|
};
|
|
522
633
|
return {
|
|
634
|
+
get: (path) => send(path, { method: "GET" }),
|
|
523
635
|
post: (path, body, headers) => send(path, {
|
|
524
636
|
method: "POST",
|
|
525
637
|
headers: { "content-type": "application/json", ...headers },
|
|
@@ -540,6 +652,7 @@ export {
|
|
|
540
652
|
PLAY_FILES_STAGE_PATH,
|
|
541
653
|
PLAY_FILES_STAGE_MINT_PATH,
|
|
542
654
|
buildPlayRunStartBody,
|
|
655
|
+
preparePlayRunAdmission,
|
|
543
656
|
startPlayRun,
|
|
544
657
|
isPlayRunPackage,
|
|
545
658
|
normalizePlayRunStart,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAuthedHttpClient,
|
|
3
3
|
printCommandEnvelope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5PRVMXKB.mjs";
|
|
5
5
|
import {
|
|
6
6
|
agentSessionIdFromEnvironment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LMMEAMA7.mjs";
|
|
8
8
|
|
|
9
9
|
// src/cli/commands/sessions.ts
|
|
10
10
|
import {
|
|
@@ -477,184 +477,6 @@ function extractSummaryFields(payload) {
|
|
|
477
477
|
return {};
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
// ../plays/row-identity.ts
|
|
481
|
-
var POSTGRES_IDENTIFIER_MAX_LENGTH = 63;
|
|
482
|
-
var MAP_KEY_NAMESPACE_MAX_LENGTH = POSTGRES_IDENTIFIER_MAX_LENGTH;
|
|
483
|
-
var SHA256_INITIAL_HASH = [
|
|
484
|
-
1779033703,
|
|
485
|
-
3144134277,
|
|
486
|
-
1013904242,
|
|
487
|
-
2773480762,
|
|
488
|
-
1359893119,
|
|
489
|
-
2600822924,
|
|
490
|
-
528734635,
|
|
491
|
-
1541459225
|
|
492
|
-
];
|
|
493
|
-
var SHA256_ROUND_CONSTANTS = [
|
|
494
|
-
1116352408,
|
|
495
|
-
1899447441,
|
|
496
|
-
3049323471,
|
|
497
|
-
3921009573,
|
|
498
|
-
961987163,
|
|
499
|
-
1508970993,
|
|
500
|
-
2453635748,
|
|
501
|
-
2870763221,
|
|
502
|
-
3624381080,
|
|
503
|
-
310598401,
|
|
504
|
-
607225278,
|
|
505
|
-
1426881987,
|
|
506
|
-
1925078388,
|
|
507
|
-
2162078206,
|
|
508
|
-
2614888103,
|
|
509
|
-
3248222580,
|
|
510
|
-
3835390401,
|
|
511
|
-
4022224774,
|
|
512
|
-
264347078,
|
|
513
|
-
604807628,
|
|
514
|
-
770255983,
|
|
515
|
-
1249150122,
|
|
516
|
-
1555081692,
|
|
517
|
-
1996064986,
|
|
518
|
-
2554220882,
|
|
519
|
-
2821834349,
|
|
520
|
-
2952996808,
|
|
521
|
-
3210313671,
|
|
522
|
-
3336571891,
|
|
523
|
-
3584528711,
|
|
524
|
-
113926993,
|
|
525
|
-
338241895,
|
|
526
|
-
666307205,
|
|
527
|
-
773529912,
|
|
528
|
-
1294757372,
|
|
529
|
-
1396182291,
|
|
530
|
-
1695183700,
|
|
531
|
-
1986661051,
|
|
532
|
-
2177026350,
|
|
533
|
-
2456956037,
|
|
534
|
-
2730485921,
|
|
535
|
-
2820302411,
|
|
536
|
-
3259730800,
|
|
537
|
-
3345764771,
|
|
538
|
-
3516065817,
|
|
539
|
-
3600352804,
|
|
540
|
-
4094571909,
|
|
541
|
-
275423344,
|
|
542
|
-
430227734,
|
|
543
|
-
506948616,
|
|
544
|
-
659060556,
|
|
545
|
-
883997877,
|
|
546
|
-
958139571,
|
|
547
|
-
1322822218,
|
|
548
|
-
1537002063,
|
|
549
|
-
1747873779,
|
|
550
|
-
1955562222,
|
|
551
|
-
2024104815,
|
|
552
|
-
2227730452,
|
|
553
|
-
2361852424,
|
|
554
|
-
2428436474,
|
|
555
|
-
2756734187,
|
|
556
|
-
3204031479,
|
|
557
|
-
3329325298
|
|
558
|
-
];
|
|
559
|
-
function stableValue(value) {
|
|
560
|
-
if (Array.isArray(value)) {
|
|
561
|
-
return value.map((entry) => stableValue(entry));
|
|
562
|
-
}
|
|
563
|
-
if (value && typeof value === "object") {
|
|
564
|
-
return Object.fromEntries(
|
|
565
|
-
Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, stableValue(entry)])
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
return value;
|
|
569
|
-
}
|
|
570
|
-
function stableStringify(value) {
|
|
571
|
-
return JSON.stringify(stableValue(value));
|
|
572
|
-
}
|
|
573
|
-
function rightRotate32(value, bits) {
|
|
574
|
-
return value >>> bits | value << 32 - bits;
|
|
575
|
-
}
|
|
576
|
-
function sha256Hex(input) {
|
|
577
|
-
const bytes = Array.from(new TextEncoder().encode(input));
|
|
578
|
-
const bitLength = bytes.length * 8;
|
|
579
|
-
bytes.push(128);
|
|
580
|
-
while (bytes.length % 64 !== 56) {
|
|
581
|
-
bytes.push(0);
|
|
582
|
-
}
|
|
583
|
-
const highBits = Math.floor(bitLength / 4294967296);
|
|
584
|
-
const lowBits = bitLength >>> 0;
|
|
585
|
-
bytes.push(
|
|
586
|
-
highBits >>> 24 & 255,
|
|
587
|
-
highBits >>> 16 & 255,
|
|
588
|
-
highBits >>> 8 & 255,
|
|
589
|
-
highBits & 255,
|
|
590
|
-
lowBits >>> 24 & 255,
|
|
591
|
-
lowBits >>> 16 & 255,
|
|
592
|
-
lowBits >>> 8 & 255,
|
|
593
|
-
lowBits & 255
|
|
594
|
-
);
|
|
595
|
-
const hash = [...SHA256_INITIAL_HASH];
|
|
596
|
-
const words = new Array(64).fill(0);
|
|
597
|
-
for (let offset = 0; offset < bytes.length; offset += 64) {
|
|
598
|
-
for (let index = 0; index < 16; index += 1) {
|
|
599
|
-
const wordOffset = offset + index * 4;
|
|
600
|
-
words[index] = (bytes[wordOffset] ?? 0) << 24 | (bytes[wordOffset + 1] ?? 0) << 16 | (bytes[wordOffset + 2] ?? 0) << 8 | (bytes[wordOffset + 3] ?? 0);
|
|
601
|
-
}
|
|
602
|
-
for (let index = 16; index < 64; index += 1) {
|
|
603
|
-
const s0 = rightRotate32(words[index - 15], 7) ^ rightRotate32(words[index - 15], 18) ^ words[index - 15] >>> 3;
|
|
604
|
-
const s1 = rightRotate32(words[index - 2], 17) ^ rightRotate32(words[index - 2], 19) ^ words[index - 2] >>> 10;
|
|
605
|
-
words[index] = words[index - 16] + s0 + words[index - 7] + s1 >>> 0;
|
|
606
|
-
}
|
|
607
|
-
let [a, b, c, d, e, f, g, h] = hash;
|
|
608
|
-
for (let index = 0; index < 64; index += 1) {
|
|
609
|
-
const s1 = rightRotate32(e, 6) ^ rightRotate32(e, 11) ^ rightRotate32(e, 25);
|
|
610
|
-
const ch = e & f ^ ~e & g;
|
|
611
|
-
const temp1 = h + s1 + ch + SHA256_ROUND_CONSTANTS[index] + words[index] >>> 0;
|
|
612
|
-
const s0 = rightRotate32(a, 2) ^ rightRotate32(a, 13) ^ rightRotate32(a, 22);
|
|
613
|
-
const maj = a & b ^ a & c ^ b & c;
|
|
614
|
-
const temp2 = s0 + maj >>> 0;
|
|
615
|
-
h = g;
|
|
616
|
-
g = f;
|
|
617
|
-
f = e;
|
|
618
|
-
e = d + temp1 >>> 0;
|
|
619
|
-
d = c;
|
|
620
|
-
c = b;
|
|
621
|
-
b = a;
|
|
622
|
-
a = temp1 + temp2 >>> 0;
|
|
623
|
-
}
|
|
624
|
-
hash[0] = hash[0] + a >>> 0;
|
|
625
|
-
hash[1] = hash[1] + b >>> 0;
|
|
626
|
-
hash[2] = hash[2] + c >>> 0;
|
|
627
|
-
hash[3] = hash[3] + d >>> 0;
|
|
628
|
-
hash[4] = hash[4] + e >>> 0;
|
|
629
|
-
hash[5] = hash[5] + f >>> 0;
|
|
630
|
-
hash[6] = hash[6] + g >>> 0;
|
|
631
|
-
hash[7] = hash[7] + h >>> 0;
|
|
632
|
-
}
|
|
633
|
-
return hash.map((word) => word.toString(16).padStart(8, "0")).join("");
|
|
634
|
-
}
|
|
635
|
-
function sanitizeIdentifierPart(value) {
|
|
636
|
-
return value.trim().replace(/[^a-z0-9]+/gi, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
637
|
-
}
|
|
638
|
-
function validateIdentifierPart(rawValue, label, maxLength) {
|
|
639
|
-
const sanitized = sanitizeIdentifierPart(rawValue);
|
|
640
|
-
if (!sanitized) {
|
|
641
|
-
throw new Error(`${label} must contain a letter or number.`);
|
|
642
|
-
}
|
|
643
|
-
if (sanitized.length > maxLength) {
|
|
644
|
-
throw new Error(
|
|
645
|
-
`${label} is too long after normalization (${sanitized.length}/${maxLength}): "${sanitized}".`
|
|
646
|
-
);
|
|
647
|
-
}
|
|
648
|
-
return sanitized;
|
|
649
|
-
}
|
|
650
|
-
function normalizeTableNamespace(value) {
|
|
651
|
-
return validateIdentifierPart(
|
|
652
|
-
value,
|
|
653
|
-
"ctx.dataset() key",
|
|
654
|
-
MAP_KEY_NAMESPACE_MAX_LENGTH
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
480
|
export {
|
|
659
481
|
EMAIL_STATUS_JSON_SCHEMA,
|
|
660
482
|
buildEmailStatus,
|
|
@@ -664,9 +486,6 @@ export {
|
|
|
664
486
|
DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS,
|
|
665
487
|
DEEPLINE_EXTRACTOR_TARGETS,
|
|
666
488
|
isDeeplineExtractorTarget,
|
|
667
|
-
stableStringify,
|
|
668
|
-
sha256Hex,
|
|
669
|
-
normalizeTableNamespace,
|
|
670
489
|
tryConvertToList,
|
|
671
490
|
projectRowOutput,
|
|
672
491
|
writeJsonOutputFile,
|