deepline 0.3.70 → 0.3.72
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 +54 -4
- package/dist/bundling-sources/sdk/src/index.ts +2 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +162 -62
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +116 -4
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +4 -1
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +10 -5
- package/dist/cli/index.js +669 -331
- package/dist/cli/index.mjs +625 -281
- package/dist/{compiler-manifest-IkyvsUO-.d.mts → compiler-manifest-CMNgA_JQ.d.mts} +7 -1
- package/dist/{compiler-manifest-IkyvsUO-.d.ts → compiler-manifest-CMNgA_JQ.d.ts} +7 -1
- package/dist/index.d.mts +32 -7
- package/dist/index.d.ts +32 -7
- package/dist/index.js +54 -3
- package/dist/index.mjs +54 -3
- package/dist/install-integrity.json +2 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/bundle-play-file.mjs +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -159,7 +159,7 @@ configureProxyFromEnv();
|
|
|
159
159
|
|
|
160
160
|
// src/cli/index.ts
|
|
161
161
|
import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile6 } from "fs/promises";
|
|
162
|
-
import { join as
|
|
162
|
+
import { join as join24 } from "path";
|
|
163
163
|
import { tmpdir as tmpdir6 } from "os";
|
|
164
164
|
import { Command as Command4 } from "commander";
|
|
165
165
|
|
|
@@ -1199,7 +1199,7 @@ var SDK_RELEASE = {
|
|
|
1199
1199
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1200
1200
|
// getters keep their established compatibility behavior.
|
|
1201
1201
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
1202
|
-
version: "0.3.
|
|
1202
|
+
version: "0.3.72",
|
|
1203
1203
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
1204
1204
|
packageCapabilities: {
|
|
1205
1205
|
updatePreferences: 1
|
|
@@ -3539,6 +3539,133 @@ function decodePlayRunPublicStatus(value) {
|
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
3541
3541
|
|
|
3542
|
+
// ../play-runtime/log-provenance.ts
|
|
3543
|
+
var LOG_LEVELS = [
|
|
3544
|
+
"debug",
|
|
3545
|
+
"info",
|
|
3546
|
+
"warn",
|
|
3547
|
+
"error"
|
|
3548
|
+
];
|
|
3549
|
+
var LOG_LEVEL_RANK = {
|
|
3550
|
+
debug: 0,
|
|
3551
|
+
info: 1,
|
|
3552
|
+
warn: 2,
|
|
3553
|
+
error: 3
|
|
3554
|
+
};
|
|
3555
|
+
var LOG_PROVENANCE_CLASSES = [
|
|
3556
|
+
"user",
|
|
3557
|
+
"lifecycle",
|
|
3558
|
+
"replay",
|
|
3559
|
+
"infra",
|
|
3560
|
+
"diagnostic",
|
|
3561
|
+
"receipt"
|
|
3562
|
+
];
|
|
3563
|
+
var LOG_PROVENANCE_POLICY = {
|
|
3564
|
+
user: { watch: true, ui: true, debug: true },
|
|
3565
|
+
lifecycle: { watch: true, ui: true, debug: true },
|
|
3566
|
+
replay: { watch: false, ui: false, debug: true },
|
|
3567
|
+
infra: { watch: false, ui: false, debug: true },
|
|
3568
|
+
diagnostic: { watch: true, ui: true, debug: true },
|
|
3569
|
+
receipt: { watch: false, ui: false, debug: true }
|
|
3570
|
+
};
|
|
3571
|
+
function logProvenanceReaches(provenance, surface) {
|
|
3572
|
+
return LOG_PROVENANCE_POLICY[provenance][surface];
|
|
3573
|
+
}
|
|
3574
|
+
var PROVENANCE_SENTINEL = "";
|
|
3575
|
+
var PROVENANCE_PREFIX = `${PROVENANCE_SENTINEL}prov:`;
|
|
3576
|
+
function logLevelReaches(level, minimum) {
|
|
3577
|
+
return LOG_LEVEL_RANK[level] >= LOG_LEVEL_RANK[minimum];
|
|
3578
|
+
}
|
|
3579
|
+
function parseLogLevel(value) {
|
|
3580
|
+
const normalized = value.trim().toLowerCase();
|
|
3581
|
+
return LOG_LEVELS.includes(normalized) ? normalized : null;
|
|
3582
|
+
}
|
|
3583
|
+
function readProvenanceTag(line) {
|
|
3584
|
+
if (!line.startsWith(PROVENANCE_PREFIX)) {
|
|
3585
|
+
return { provenance: null, line };
|
|
3586
|
+
}
|
|
3587
|
+
const end = line.indexOf(PROVENANCE_SENTINEL, PROVENANCE_PREFIX.length);
|
|
3588
|
+
if (end === -1) {
|
|
3589
|
+
return { provenance: null, line };
|
|
3590
|
+
}
|
|
3591
|
+
const candidate = line.slice(PROVENANCE_PREFIX.length, end);
|
|
3592
|
+
const provenance = LOG_PROVENANCE_CLASSES.includes(candidate) ? candidate : null;
|
|
3593
|
+
return { provenance, line: line.slice(end + 1) };
|
|
3594
|
+
}
|
|
3595
|
+
function stripProvenanceTag(line) {
|
|
3596
|
+
return readProvenanceTag(line).line;
|
|
3597
|
+
}
|
|
3598
|
+
function classifyLegacyLogLine(line) {
|
|
3599
|
+
const message = stripLeadingTimestamp(line);
|
|
3600
|
+
if (/recovered (?:from checkpoint|response from checkpoint)/i.test(message)) {
|
|
3601
|
+
return "replay";
|
|
3602
|
+
}
|
|
3603
|
+
if (/^\[perf\] runtime receipt\b/i.test(message)) {
|
|
3604
|
+
return "receipt";
|
|
3605
|
+
}
|
|
3606
|
+
if (/^\[perf\] runtime (?:map|state)\b/i.test(message) || /\[worker\] picked up run\b/.test(message) || /\[worker\] heartbeat\b/.test(message) || /\[worker\] progress completedRows=\d+ totalRows=\d+ rowUpdates=\d+/.test(
|
|
3607
|
+
message
|
|
3608
|
+
) || /\[worker\] step started\b/.test(message) || /\[worker\] Preparing run files\b/.test(message) || /\[worker\] Run files ready\b/.test(message) || /\[worker\] Runtime ready\b/.test(message) || /\[worker\] Sandbox (?:starting|create start|create done|workspace ready|upload start|runner uploaded)\b/.test(
|
|
3609
|
+
message
|
|
3610
|
+
) || /^\[event\] play\.step\.progress\b/.test(message) || /^\[event\] play\.run\.snapshot\b/.test(message) || /^\[event\] play\.sheet\.summary\b/.test(message)) {
|
|
3611
|
+
return "infra";
|
|
3612
|
+
}
|
|
3613
|
+
if (/^\[warn\]/i.test(message) || /^\[error\]/i.test(message) || /^\[runtime\.[a-z_]*(?:failure|error)\]/i.test(message)) {
|
|
3614
|
+
return "diagnostic";
|
|
3615
|
+
}
|
|
3616
|
+
return "user";
|
|
3617
|
+
}
|
|
3618
|
+
function classifyLogLine(line) {
|
|
3619
|
+
const tagged = readProvenanceTag(line);
|
|
3620
|
+
const provenance = tagged.provenance ?? classifyLegacyLogLine(tagged.line);
|
|
3621
|
+
if (tagged.provenance !== null) {
|
|
3622
|
+
return {
|
|
3623
|
+
provenance,
|
|
3624
|
+
level: inferLogLevel(provenance, tagged.line),
|
|
3625
|
+
line: tagged.line
|
|
3626
|
+
};
|
|
3627
|
+
}
|
|
3628
|
+
return {
|
|
3629
|
+
provenance,
|
|
3630
|
+
level: inferLogLevel(provenance, tagged.line),
|
|
3631
|
+
line: tagged.line
|
|
3632
|
+
};
|
|
3633
|
+
}
|
|
3634
|
+
function inferLogLevel(provenance, line) {
|
|
3635
|
+
const message = stripLeadingTimestamp(line);
|
|
3636
|
+
if (/^\[info\]/i.test(message)) {
|
|
3637
|
+
return "info";
|
|
3638
|
+
}
|
|
3639
|
+
if (/^\[debug\]/i.test(message)) {
|
|
3640
|
+
return "debug";
|
|
3641
|
+
}
|
|
3642
|
+
if (/^\[console\.error\]/i.test(message) || /^\[error\]/i.test(message)) {
|
|
3643
|
+
return "error";
|
|
3644
|
+
}
|
|
3645
|
+
if (/^\[console\.warn\]/i.test(message) || /^\[warn\]/i.test(message)) {
|
|
3646
|
+
return "warn";
|
|
3647
|
+
}
|
|
3648
|
+
if (/^\[console\.debug\]/i.test(message)) {
|
|
3649
|
+
return "debug";
|
|
3650
|
+
}
|
|
3651
|
+
if (provenance === "replay" || provenance === "infra" || provenance === "receipt") {
|
|
3652
|
+
return "debug";
|
|
3653
|
+
}
|
|
3654
|
+
if (provenance === "diagnostic") {
|
|
3655
|
+
return "warn";
|
|
3656
|
+
}
|
|
3657
|
+
return "info";
|
|
3658
|
+
}
|
|
3659
|
+
function stripLeadingTimestamp(line) {
|
|
3660
|
+
const match = line.match(/^\[([^\]]+)\]\s*([\s\S]*)$/);
|
|
3661
|
+
if (!match) {
|
|
3662
|
+
return line;
|
|
3663
|
+
}
|
|
3664
|
+
const inner = match[1] ?? "";
|
|
3665
|
+
const isTimestamp = !Number.isNaN(new Date(inner).getTime());
|
|
3666
|
+
return isTimestamp ? match[2] ?? line : line;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3542
3669
|
// ../play-runtime/run-snapshot-stream.ts
|
|
3543
3670
|
function normalizePlayRunLiveStatus(value) {
|
|
3544
3671
|
return normalizePlayRunLifecycleStatus(value);
|
|
@@ -3611,7 +3738,9 @@ function buildSnapshotFromLedger(snapshot) {
|
|
|
3611
3738
|
finishedAt: snapshot.finishedAt ?? null,
|
|
3612
3739
|
durationMs: snapshot.durationMs ?? null,
|
|
3613
3740
|
updatedAt: snapshot.updatedAt ?? snapshot.finishedAt ?? snapshot.startedAt ?? null,
|
|
3614
|
-
|
|
3741
|
+
// This snapshot is public SDK/API transport. Keep the historical plain
|
|
3742
|
+
// timestamp-prefixed text while provenance remains runtime metadata.
|
|
3743
|
+
logs: snapshot.logTail.map(stripProvenanceTag),
|
|
3615
3744
|
totalLogCount: snapshot.totalLogCount,
|
|
3616
3745
|
...snapshot.logsTruncated ? { logsTruncated: true } : {},
|
|
3617
3746
|
activeArtifactTableNamespace: snapshot.activeArtifactTableNamespace ?? null,
|
|
@@ -4839,6 +4968,8 @@ var DeeplineClient = class {
|
|
|
4839
4968
|
db;
|
|
4840
4969
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
4841
4970
|
billing;
|
|
4971
|
+
/** Workspace lifecycle namespace. */
|
|
4972
|
+
workspaces;
|
|
4842
4973
|
/** Monitors namespace: access, catalog, deploy/check, and lifecycle. */
|
|
4843
4974
|
monitors;
|
|
4844
4975
|
/**
|
|
@@ -4887,6 +5018,9 @@ var DeeplineClient = class {
|
|
|
4887
5018
|
transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
|
|
4888
5019
|
portalSession: () => this.createTargetBillingPortalSession()
|
|
4889
5020
|
};
|
|
5021
|
+
this.workspaces = {
|
|
5022
|
+
create: (options2) => this.createWorkspace(options2)
|
|
5023
|
+
};
|
|
4890
5024
|
this.monitors = {
|
|
4891
5025
|
status: () => this.getMonitorsAccess(),
|
|
4892
5026
|
available: (toolIdOrOptions, options2) => this.getMonitorsAvailable(toolIdOrOptions, options2),
|
|
@@ -7038,6 +7172,23 @@ var DeeplineClient = class {
|
|
|
7038
7172
|
const response = await this.http.post("/api/v2/billing/portal-sessions", {});
|
|
7039
7173
|
return response.data;
|
|
7040
7174
|
}
|
|
7175
|
+
/** Create an additional workspace through the durable PAYG workflow. */
|
|
7176
|
+
async createWorkspace(options) {
|
|
7177
|
+
const idempotencyKey = requireTargetBillingIdempotencyKey(
|
|
7178
|
+
options.idempotencyKey
|
|
7179
|
+
);
|
|
7180
|
+
const response = await this.http.post(
|
|
7181
|
+
"/api/v2/workspaces",
|
|
7182
|
+
{ name: options.name },
|
|
7183
|
+
{ "Idempotency-Key": idempotencyKey },
|
|
7184
|
+
{ maxRetries: 0, exactUrlOnly: true }
|
|
7185
|
+
);
|
|
7186
|
+
return {
|
|
7187
|
+
...response.data,
|
|
7188
|
+
operation: response.operation,
|
|
7189
|
+
...response.request_id ? { request_id: response.request_id } : {}
|
|
7190
|
+
};
|
|
7191
|
+
}
|
|
7041
7192
|
// ——————————————————————————————————————————————————————————
|
|
7042
7193
|
// Monitors
|
|
7043
7194
|
// ——————————————————————————————————————————————————————————
|
|
@@ -15232,7 +15383,7 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
|
|
|
15232
15383
|
" fetch(key: string, url: string | URL, init?: RequestInit & { headers?: HeadersInit & { 'Idempotency-Key'?: string; 'X-Idempotency-Key'?: string }; auth?: SecretAuthInput }, options?: FetchOptions): Promise<PlayFetchResponse>;",
|
|
15233
15384
|
" secrets: { get(name: string): SecretPromise; bearer(secret: string | SecretPromise | SecretHandle): SecretAuth; header(header: string, secret: string | SecretPromise | SecretHandle): SecretAuth };",
|
|
15234
15385
|
` runPlay<TOutput = unknown>(key: string, playRef: ${cloudReferenceType("ctx.runPlay.playRef")}, input: ${cloudReferenceType("ctx.runPlay.input")}, options: PlayCallOptions): Promise<TOutput>;`,
|
|
15235
|
-
" log(message: string): void;",
|
|
15386
|
+
" log(message: string, options?: { level?: 'debug' | 'info' | 'warn' | 'error' }): void;",
|
|
15236
15387
|
` sleep(ms: ${cloudReferenceType("ctx.sleep.ms")}): Promise<void>;`,
|
|
15237
15388
|
"}",
|
|
15238
15389
|
"export type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = { id: string; description?: string; input: PlayInputContract<TInput>; run: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>; bindings?: PlayBindings<TInput>; billing?: PlayBindings<TInput>['billing']; runtime?: PlayBindings<TInput>['runtime']; compatibility?: PlayBindings<TInput>['compatibility'] };",
|
|
@@ -16789,77 +16940,6 @@ function isInternalGlueStepId(stepId) {
|
|
|
16789
16940
|
return typeof stepId === "string" && stepId.startsWith(INTERNAL_GLUE_NODE_ID_PREFIX);
|
|
16790
16941
|
}
|
|
16791
16942
|
|
|
16792
|
-
// ../play-runtime/log-provenance.ts
|
|
16793
|
-
var LOG_PROVENANCE_CLASSES = [
|
|
16794
|
-
"user",
|
|
16795
|
-
"lifecycle",
|
|
16796
|
-
"replay",
|
|
16797
|
-
"infra",
|
|
16798
|
-
"diagnostic",
|
|
16799
|
-
"receipt"
|
|
16800
|
-
];
|
|
16801
|
-
var LOG_PROVENANCE_POLICY = {
|
|
16802
|
-
user: { watch: true, ui: true, debug: true },
|
|
16803
|
-
lifecycle: { watch: true, ui: true, debug: true },
|
|
16804
|
-
replay: { watch: false, ui: false, debug: true },
|
|
16805
|
-
infra: { watch: false, ui: false, debug: true },
|
|
16806
|
-
diagnostic: { watch: true, ui: true, debug: true },
|
|
16807
|
-
receipt: { watch: false, ui: false, debug: true }
|
|
16808
|
-
};
|
|
16809
|
-
function logProvenanceReaches(provenance, surface) {
|
|
16810
|
-
return LOG_PROVENANCE_POLICY[provenance][surface];
|
|
16811
|
-
}
|
|
16812
|
-
var PROVENANCE_SENTINEL = "";
|
|
16813
|
-
var PROVENANCE_PREFIX = `${PROVENANCE_SENTINEL}prov:`;
|
|
16814
|
-
function readProvenanceTag(line) {
|
|
16815
|
-
if (!line.startsWith(PROVENANCE_PREFIX)) {
|
|
16816
|
-
return { provenance: null, line };
|
|
16817
|
-
}
|
|
16818
|
-
const end = line.indexOf(PROVENANCE_SENTINEL, PROVENANCE_PREFIX.length);
|
|
16819
|
-
if (end === -1) {
|
|
16820
|
-
return { provenance: null, line };
|
|
16821
|
-
}
|
|
16822
|
-
const candidate = line.slice(PROVENANCE_PREFIX.length, end);
|
|
16823
|
-
const provenance = LOG_PROVENANCE_CLASSES.includes(candidate) ? candidate : null;
|
|
16824
|
-
return { provenance, line: line.slice(end + 1) };
|
|
16825
|
-
}
|
|
16826
|
-
function classifyLegacyLogLine(line) {
|
|
16827
|
-
const message = stripLeadingTimestamp(line);
|
|
16828
|
-
if (/recovered (?:from checkpoint|response from checkpoint)/i.test(message)) {
|
|
16829
|
-
return "replay";
|
|
16830
|
-
}
|
|
16831
|
-
if (/^\[perf\] runtime receipt\b/i.test(message)) {
|
|
16832
|
-
return "receipt";
|
|
16833
|
-
}
|
|
16834
|
-
if (/^\[perf\] runtime (?:map|state)\b/i.test(message) || /\[worker\] picked up run\b/.test(message) || /\[worker\] heartbeat\b/.test(message) || /\[worker\] progress completedRows=\d+ totalRows=\d+ rowUpdates=\d+/.test(
|
|
16835
|
-
message
|
|
16836
|
-
) || /\[worker\] step started\b/.test(message) || /\[worker\] Preparing run files\b/.test(message) || /\[worker\] Run files ready\b/.test(message) || /\[worker\] Runtime ready\b/.test(message) || /\[worker\] Sandbox (?:starting|create start|create done|workspace ready|upload start|runner uploaded)\b/.test(
|
|
16837
|
-
message
|
|
16838
|
-
) || /^\[event\] play\.step\.progress\b/.test(message) || /^\[event\] play\.run\.snapshot\b/.test(message) || /^\[event\] play\.sheet\.summary\b/.test(message)) {
|
|
16839
|
-
return "infra";
|
|
16840
|
-
}
|
|
16841
|
-
if (/^\[warn\]/i.test(message) || /^\[error\]/i.test(message) || /^\[runtime\.[a-z_]*(?:failure|error)\]/i.test(message)) {
|
|
16842
|
-
return "diagnostic";
|
|
16843
|
-
}
|
|
16844
|
-
return "user";
|
|
16845
|
-
}
|
|
16846
|
-
function classifyLogLine(line) {
|
|
16847
|
-
const tagged = readProvenanceTag(line);
|
|
16848
|
-
if (tagged.provenance !== null) {
|
|
16849
|
-
return { provenance: tagged.provenance, line: tagged.line };
|
|
16850
|
-
}
|
|
16851
|
-
return { provenance: classifyLegacyLogLine(tagged.line), line: tagged.line };
|
|
16852
|
-
}
|
|
16853
|
-
function stripLeadingTimestamp(line) {
|
|
16854
|
-
const match = line.match(/^\[([^\]]+)\]\s*([\s\S]*)$/);
|
|
16855
|
-
if (!match) {
|
|
16856
|
-
return line;
|
|
16857
|
-
}
|
|
16858
|
-
const inner = match[1] ?? "";
|
|
16859
|
-
const isTimestamp = !Number.isNaN(new Date(inner).getTime());
|
|
16860
|
-
return isTimestamp ? match[2] ?? line : line;
|
|
16861
|
-
}
|
|
16862
|
-
|
|
16863
16943
|
// ../play-runtime/fixture-behavior.ts
|
|
16864
16944
|
var FIXTURE_BEHAVIOR_VERSION = 1;
|
|
16865
16945
|
var FIXTURE_BEHAVIOR_RESPONSE_VERSION = 2;
|
|
@@ -18287,7 +18367,11 @@ var TERMINAL_PLAY_STATUSES2 = /* @__PURE__ */ new Set([
|
|
|
18287
18367
|
var PLAY_START_TRANSIENT_RETRY_DELAYS_MS = [500, 1500];
|
|
18288
18368
|
var PLAY_PROGRESS_HEARTBEAT_INTERVAL_MS = 15e3;
|
|
18289
18369
|
var PLAY_STATUS_HEARTBEAT_INTERVAL_MS = 15e3;
|
|
18290
|
-
function watchSurfaceReaches(state, provenance) {
|
|
18370
|
+
function watchSurfaceReaches(state, provenance, level) {
|
|
18371
|
+
const minimumLevel = state.logLevel ?? (state.verbose ? "debug" : "info");
|
|
18372
|
+
if (!logLevelReaches(level, minimumLevel)) {
|
|
18373
|
+
return false;
|
|
18374
|
+
}
|
|
18291
18375
|
if (logProvenanceReaches(provenance, "watch")) {
|
|
18292
18376
|
return true;
|
|
18293
18377
|
}
|
|
@@ -18482,7 +18566,7 @@ function emitLiveDebugTableHints(input2) {
|
|
|
18482
18566
|
process.stdout
|
|
18483
18567
|
);
|
|
18484
18568
|
}
|
|
18485
|
-
if (!watchSurfaceReaches(input2.state, "infra")) {
|
|
18569
|
+
if (!watchSurfaceReaches(input2.state, "infra", "debug")) {
|
|
18486
18570
|
return;
|
|
18487
18571
|
}
|
|
18488
18572
|
const tableNamespace = extractTableNamespaceFromLiveEvent(input2.event);
|
|
@@ -18585,7 +18669,7 @@ function getStepTransitionLineFromLiveEvent(event, state) {
|
|
|
18585
18669
|
if (isTerminal) {
|
|
18586
18670
|
state.terminalStepIds.add(stepId);
|
|
18587
18671
|
}
|
|
18588
|
-
if (isReplayEcho && !watchSurfaceReaches(state, "replay")) {
|
|
18672
|
+
if (isReplayEcho && !watchSurfaceReaches(state, "replay", "debug")) {
|
|
18589
18673
|
return null;
|
|
18590
18674
|
}
|
|
18591
18675
|
return `step ${label}: ${status}`;
|
|
@@ -18989,6 +19073,7 @@ async function startAndWaitForPlayCompletionByStreamOnce(input2) {
|
|
|
18989
19073
|
lastLogIndex: 0,
|
|
18990
19074
|
emittedRunnerStarted: false,
|
|
18991
19075
|
verbose: input2.verboseLogs === true,
|
|
19076
|
+
logLevel: input2.logLevel ?? "info",
|
|
18992
19077
|
lastProgressSignature: null,
|
|
18993
19078
|
lastProgressHeartbeatAt: 0,
|
|
18994
19079
|
lastStatusHeartbeatAt: 0
|
|
@@ -19367,6 +19452,9 @@ function formatPlayLogLine(rawLine, status, state) {
|
|
|
19367
19452
|
const message = timestampMatch?.[2] ?? line;
|
|
19368
19453
|
const prefix = timestamp ? `${timestamp} ` : "";
|
|
19369
19454
|
if (/\[worker\] picked up run\b/.test(message)) {
|
|
19455
|
+
if (!logLevelReaches("info", state.logLevel ?? "info")) {
|
|
19456
|
+
return null;
|
|
19457
|
+
}
|
|
19370
19458
|
if (state.emittedRunnerStarted) {
|
|
19371
19459
|
return null;
|
|
19372
19460
|
}
|
|
@@ -19383,6 +19471,9 @@ function formatPlayLogLine(rawLine, status, state) {
|
|
|
19383
19471
|
/^Starting map over (\d+) items with (\d+) fields \(key: ([^;]+); (\d+) already satisfied; (\d+) pending\)$/
|
|
19384
19472
|
);
|
|
19385
19473
|
if (mapStart) {
|
|
19474
|
+
if (!logLevelReaches("info", state.logLevel ?? "info")) {
|
|
19475
|
+
return null;
|
|
19476
|
+
}
|
|
19386
19477
|
const [, rows, fields, namespace, cached, pending] = mapStart;
|
|
19387
19478
|
return `${prefix}map ${sourceLabelForNamespace(namespace)}: ${formatInteger(Number(rows))} rows, ${fields} fields, ${formatInteger(Number(cached))} cached, ${formatInteger(Number(pending))} pending`;
|
|
19388
19479
|
}
|
|
@@ -19390,10 +19481,13 @@ function formatPlayLogLine(rawLine, status, state) {
|
|
|
19390
19481
|
/^Map completed: (\d+) results \((\d+) executed, (\d+) already satisfied\)$/
|
|
19391
19482
|
);
|
|
19392
19483
|
if (mapDone) {
|
|
19484
|
+
if (!logLevelReaches("info", state.logLevel ?? "info")) {
|
|
19485
|
+
return null;
|
|
19486
|
+
}
|
|
19393
19487
|
const [, results, executed, cached] = mapDone;
|
|
19394
19488
|
return `${prefix}done: ${formatInteger(Number(results))} results, ${formatInteger(Number(executed))} executed, ${formatInteger(Number(cached))} cached`;
|
|
19395
19489
|
}
|
|
19396
|
-
if (!watchSurfaceReaches(state, classified.provenance)) {
|
|
19490
|
+
if (!watchSurfaceReaches(state, classified.provenance, classified.level)) {
|
|
19397
19491
|
return null;
|
|
19398
19492
|
}
|
|
19399
19493
|
return `${prefix}${message}`;
|
|
@@ -21129,13 +21223,12 @@ function parsePlayRunOptions(args) {
|
|
|
21129
21223
|
const watch = !args.includes("--no-wait");
|
|
21130
21224
|
let jsonOutput = watch ? args.includes("--json") : argsWantJson(args);
|
|
21131
21225
|
const fullJson = args.includes("--full");
|
|
21132
|
-
const explicitDebugLogs = args.includes("--logs") || args.some((_, index) => isBarePlayRunDebugFlag(args, index));
|
|
21133
|
-
const emitLogs = !jsonOutput || explicitDebugLogs;
|
|
21134
21226
|
const force = args.includes("--force");
|
|
21135
21227
|
const forceToolRefresh = args.includes("--force-tool-refresh");
|
|
21136
21228
|
const open2 = args.includes("--open");
|
|
21137
21229
|
const debugMapLatency = args.includes("--debug-map-latency");
|
|
21138
|
-
|
|
21230
|
+
let logLevel = "info";
|
|
21231
|
+
let hasExplicitLogLevel = false;
|
|
21139
21232
|
let waitTimeoutMs = null;
|
|
21140
21233
|
let maxConcurrentExternalCalls = null;
|
|
21141
21234
|
let maxConcurrentRows = null;
|
|
@@ -21156,6 +21249,23 @@ function parsePlayRunOptions(args) {
|
|
|
21156
21249
|
input2 = parseJsonInput(args[++index]);
|
|
21157
21250
|
continue;
|
|
21158
21251
|
}
|
|
21252
|
+
if (arg === "--log-level" || arg.startsWith("--log-level=")) {
|
|
21253
|
+
const value = arg === "--log-level" ? args[++index] : arg.slice("--log-level=".length);
|
|
21254
|
+
if (!value || value.startsWith("--")) {
|
|
21255
|
+
throw new Error(
|
|
21256
|
+
"--log-level requires one of: debug, info, warn, error."
|
|
21257
|
+
);
|
|
21258
|
+
}
|
|
21259
|
+
const parsed = parseLogLevel(value);
|
|
21260
|
+
if (!parsed) {
|
|
21261
|
+
throw new Error(
|
|
21262
|
+
`Unsupported --log-level ${JSON.stringify(value)}. Use debug, info, warn, or error.`
|
|
21263
|
+
);
|
|
21264
|
+
}
|
|
21265
|
+
logLevel = parsed;
|
|
21266
|
+
hasExplicitLogLevel = true;
|
|
21267
|
+
continue;
|
|
21268
|
+
}
|
|
21159
21269
|
if (arg === "--run-id-file") {
|
|
21160
21270
|
const value = args[index + 1];
|
|
21161
21271
|
if (!value || value.startsWith("--")) {
|
|
@@ -21334,6 +21444,17 @@ function parsePlayRunOptions(args) {
|
|
|
21334
21444
|
"--live, --latest, and --revision-id only apply to named plays."
|
|
21335
21445
|
);
|
|
21336
21446
|
}
|
|
21447
|
+
if (debugMapLatency && logLevel === "info") logLevel = "debug";
|
|
21448
|
+
const usesDebugAlias = args.includes("--logs") || args.some((_, index) => isBarePlayRunDebugFlag(args, index));
|
|
21449
|
+
if (usesDebugAlias && hasExplicitLogLevel && logLevel !== "debug") {
|
|
21450
|
+
throw new Error(
|
|
21451
|
+
"--debug/--logs conflicts with a non-debug --log-level. Use one level selector."
|
|
21452
|
+
);
|
|
21453
|
+
}
|
|
21454
|
+
if (usesDebugAlias) logLevel = "debug";
|
|
21455
|
+
const explicitDebugLogs = usesDebugAlias || logLevel === "debug";
|
|
21456
|
+
const emitLogs = !jsonOutput || explicitDebugLogs || hasExplicitLogLevel;
|
|
21457
|
+
const verboseLogs = explicitDebugLogs || debugMapLatency;
|
|
21337
21458
|
return {
|
|
21338
21459
|
target: filePath ? { kind: "file", path: filePath } : { kind: "name", name: playName },
|
|
21339
21460
|
input: input2,
|
|
@@ -21342,6 +21463,7 @@ function parsePlayRunOptions(args) {
|
|
|
21342
21463
|
watch,
|
|
21343
21464
|
emitLogs,
|
|
21344
21465
|
verboseLogs,
|
|
21466
|
+
logLevel,
|
|
21345
21467
|
jsonOutput,
|
|
21346
21468
|
fullJson,
|
|
21347
21469
|
waitTimeoutMs,
|
|
@@ -22239,6 +22361,7 @@ async function handleFileBackedRun(options, hooks) {
|
|
|
22239
22361
|
jsonOutput: options.jsonOutput,
|
|
22240
22362
|
emitLogs: options.emitLogs,
|
|
22241
22363
|
verboseLogs: options.verboseLogs,
|
|
22364
|
+
logLevel: options.logLevel,
|
|
22242
22365
|
waitTimeoutMs: options.waitTimeoutMs,
|
|
22243
22366
|
open: options.open,
|
|
22244
22367
|
progress,
|
|
@@ -22421,6 +22544,7 @@ async function handleNamedRun(options, hooks) {
|
|
|
22421
22544
|
jsonOutput: options.jsonOutput,
|
|
22422
22545
|
emitLogs: options.emitLogs,
|
|
22423
22546
|
verboseLogs: options.verboseLogs,
|
|
22547
|
+
logLevel: options.logLevel,
|
|
22424
22548
|
waitTimeoutMs: options.waitTimeoutMs,
|
|
22425
22549
|
open: options.open,
|
|
22426
22550
|
progress,
|
|
@@ -22538,12 +22662,13 @@ async function handlePlayRun(args, hooks) {
|
|
|
22538
22662
|
function parseRunIdPositional(args, usage) {
|
|
22539
22663
|
for (let index = 0; index < args.length; index += 1) {
|
|
22540
22664
|
const arg = args[index];
|
|
22541
|
-
if (arg === "--json" || arg === "--full" || arg === "--input" || arg === "--logs" || arg === "--debug" || arg === "--compact" || arg === "--log-failed" || arg === "--failed" || arg === "--limit") {
|
|
22542
|
-
if (arg === "--limit" && args[index + 1]) {
|
|
22665
|
+
if (arg === "--json" || arg === "--full" || arg === "--input" || arg === "--logs" || arg === "--debug" || arg === "--compact" || arg === "--log-failed" || arg === "--failed" || arg === "--limit" || arg === "--log-level") {
|
|
22666
|
+
if ((arg === "--limit" || arg === "--log-level") && args[index + 1]) {
|
|
22543
22667
|
index += 1;
|
|
22544
22668
|
}
|
|
22545
22669
|
continue;
|
|
22546
22670
|
}
|
|
22671
|
+
if (arg.startsWith("--log-level=")) continue;
|
|
22547
22672
|
if ((arg === "--out" || arg === "--reason" || arg === "--dataset") && args[index + 1]) {
|
|
22548
22673
|
index += 1;
|
|
22549
22674
|
continue;
|
|
@@ -22705,7 +22830,7 @@ async function handleRunsList(args) {
|
|
|
22705
22830
|
return 0;
|
|
22706
22831
|
}
|
|
22707
22832
|
async function handleRunTail(args) {
|
|
22708
|
-
const usage = "Usage: deepline runs tail <run-id> [--json | --jsonl] [--compact] [--debug]";
|
|
22833
|
+
const usage = "Usage: deepline runs tail <run-id> [--json | --jsonl] [--compact] [--log-level debug|info|warn|error]";
|
|
22709
22834
|
let runId;
|
|
22710
22835
|
try {
|
|
22711
22836
|
runId = parseRunIdPositional(args, usage);
|
|
@@ -22713,6 +22838,9 @@ async function handleRunTail(args) {
|
|
|
22713
22838
|
console.error(error instanceof Error ? error.message : usage);
|
|
22714
22839
|
return 1;
|
|
22715
22840
|
}
|
|
22841
|
+
let logLevel = "info";
|
|
22842
|
+
let hasExplicitLogLevel = false;
|
|
22843
|
+
let usesDebugAlias = false;
|
|
22716
22844
|
for (let index = 0; index < args.length; index += 1) {
|
|
22717
22845
|
const arg = args[index];
|
|
22718
22846
|
if (arg === "--cursor") {
|
|
@@ -22721,7 +22849,28 @@ async function handleRunTail(args) {
|
|
|
22721
22849
|
);
|
|
22722
22850
|
return 1;
|
|
22723
22851
|
}
|
|
22724
|
-
if (arg
|
|
22852
|
+
if (arg === "--log-level" || arg.startsWith("--log-level=")) {
|
|
22853
|
+
const value = arg === "--log-level" ? args[++index] : arg.slice("--log-level=".length);
|
|
22854
|
+
if (!value || value.startsWith("--")) {
|
|
22855
|
+
console.error("--log-level requires one of: debug, info, warn, error.");
|
|
22856
|
+
return 1;
|
|
22857
|
+
}
|
|
22858
|
+
const parsed = parseLogLevel(value);
|
|
22859
|
+
if (!parsed) {
|
|
22860
|
+
console.error(
|
|
22861
|
+
`Unsupported --log-level ${JSON.stringify(value)}. Use debug, info, warn, or error.`
|
|
22862
|
+
);
|
|
22863
|
+
return 1;
|
|
22864
|
+
}
|
|
22865
|
+
logLevel = parsed;
|
|
22866
|
+
hasExplicitLogLevel = true;
|
|
22867
|
+
continue;
|
|
22868
|
+
}
|
|
22869
|
+
if (arg === "--logs" || arg === "--debug") {
|
|
22870
|
+
usesDebugAlias = true;
|
|
22871
|
+
continue;
|
|
22872
|
+
}
|
|
22873
|
+
if (arg.startsWith("--") && arg !== "--json" && arg !== "--jsonl" && arg !== "--compact") {
|
|
22725
22874
|
console.error(`${arg} is not supported by deepline runs tail.`);
|
|
22726
22875
|
return 1;
|
|
22727
22876
|
}
|
|
@@ -22730,10 +22879,17 @@ async function handleRunTail(args) {
|
|
|
22730
22879
|
console.error("--json and --jsonl cannot be used together.");
|
|
22731
22880
|
return 1;
|
|
22732
22881
|
}
|
|
22733
|
-
|
|
22734
|
-
|
|
22882
|
+
if (usesDebugAlias && hasExplicitLogLevel && logLevel !== "debug") {
|
|
22883
|
+
console.error(
|
|
22884
|
+
"--debug conflicts with a non-debug --log-level. Use one level selector."
|
|
22885
|
+
);
|
|
22886
|
+
return 1;
|
|
22887
|
+
}
|
|
22888
|
+
if (usesDebugAlias) logLevel = "debug";
|
|
22889
|
+
const debug = logLevel === "debug";
|
|
22890
|
+
if (args.includes("--jsonl") && (debug || hasExplicitLogLevel)) {
|
|
22735
22891
|
console.error(
|
|
22736
|
-
"--
|
|
22892
|
+
"--log-level cannot be combined with --jsonl: JSON Lines already includes every canonical live event."
|
|
22737
22893
|
);
|
|
22738
22894
|
return 1;
|
|
22739
22895
|
}
|
|
@@ -22747,7 +22903,8 @@ async function handleRunTail(args) {
|
|
|
22747
22903
|
lastProgressSignature: null,
|
|
22748
22904
|
lastProgressHeartbeatAt: 0,
|
|
22749
22905
|
lastStatusHeartbeatAt: 0,
|
|
22750
|
-
verbose: debug
|
|
22906
|
+
verbose: debug,
|
|
22907
|
+
logLevel
|
|
22751
22908
|
};
|
|
22752
22909
|
const status = await client2.runs.tail(runId, {
|
|
22753
22910
|
onEvent: jsonLines ? (event) => {
|
|
@@ -22759,8 +22916,8 @@ async function handleRunTail(args) {
|
|
|
22759
22916
|
})}
|
|
22760
22917
|
`
|
|
22761
22918
|
);
|
|
22762
|
-
} : compact || debug ? (event) => {
|
|
22763
|
-
if (debug) {
|
|
22919
|
+
} : compact || debug || hasExplicitLogLevel ? (event) => {
|
|
22920
|
+
if (debug || hasExplicitLogLevel) {
|
|
22764
22921
|
for (const line of getLogLinesFromLiveEvent(event)) {
|
|
22765
22922
|
const formatted = formatPlayLogLine(
|
|
22766
22923
|
line,
|
|
@@ -22795,7 +22952,7 @@ async function handleRunTail(args) {
|
|
|
22795
22952
|
}
|
|
22796
22953
|
} : void 0,
|
|
22797
22954
|
// Human mode only: in --json mode emit nothing non-protocol.
|
|
22798
|
-
onReconnect: jsonOutput && !debug ? void 0 : ({ reason }) => {
|
|
22955
|
+
onReconnect: jsonOutput && !debug && !hasExplicitLogLevel ? void 0 : ({ reason }) => {
|
|
22799
22956
|
process.stderr.write(
|
|
22800
22957
|
`[runs tail] stream ended without a terminal status; reconnecting to run ${runId} (${reason})
|
|
22801
22958
|
`
|
|
@@ -22811,7 +22968,7 @@ async function handleRunTail(args) {
|
|
|
22811
22968
|
return status.status === "failed" ? 1 : 0;
|
|
22812
22969
|
}
|
|
22813
22970
|
async function handleRunLogs(args) {
|
|
22814
|
-
const usage = "Usage: deepline runs logs <run-id> [--limit 200] [--failed] [--out run.log] [--
|
|
22971
|
+
const usage = "Usage: deepline runs logs <run-id> [--limit 200] [--failed] [--out run.log] [--log-level debug|info|warn|error] [--json]";
|
|
22815
22972
|
let runId;
|
|
22816
22973
|
try {
|
|
22817
22974
|
runId = parseRunIdPositional(args, usage);
|
|
@@ -22821,10 +22978,34 @@ async function handleRunLogs(args) {
|
|
|
22821
22978
|
}
|
|
22822
22979
|
let limit = 200;
|
|
22823
22980
|
let outPath = null;
|
|
22981
|
+
let logLevel = "debug";
|
|
22982
|
+
let hasExplicitLogLevel = false;
|
|
22983
|
+
let usesDebugAlias = false;
|
|
22824
22984
|
const failed = args.includes("--failed");
|
|
22825
22985
|
for (let index = 0; index < args.length; index += 1) {
|
|
22826
22986
|
const arg = args[index];
|
|
22827
|
-
if (arg === "--debug" || arg === "--logs"
|
|
22987
|
+
if (arg === "--debug" || arg === "--logs") {
|
|
22988
|
+
usesDebugAlias = true;
|
|
22989
|
+
continue;
|
|
22990
|
+
}
|
|
22991
|
+
if (arg === "--json" || arg === "--failed") {
|
|
22992
|
+
continue;
|
|
22993
|
+
}
|
|
22994
|
+
if (arg === "--log-level" || arg.startsWith("--log-level=")) {
|
|
22995
|
+
const value = arg === "--log-level" ? args[++index] : arg.slice("--log-level=".length);
|
|
22996
|
+
if (!value || value.startsWith("--")) {
|
|
22997
|
+
console.error("--log-level requires one of: debug, info, warn, error.");
|
|
22998
|
+
return 1;
|
|
22999
|
+
}
|
|
23000
|
+
const parsed = parseLogLevel(value);
|
|
23001
|
+
if (!parsed) {
|
|
23002
|
+
console.error(
|
|
23003
|
+
`Unsupported --log-level ${JSON.stringify(value)}. Use debug, info, warn, or error.`
|
|
23004
|
+
);
|
|
23005
|
+
return 1;
|
|
23006
|
+
}
|
|
23007
|
+
logLevel = parsed;
|
|
23008
|
+
hasExplicitLogLevel = true;
|
|
22828
23009
|
continue;
|
|
22829
23010
|
}
|
|
22830
23011
|
if (arg === "--limit" && args[index + 1]) {
|
|
@@ -22840,6 +23021,13 @@ async function handleRunLogs(args) {
|
|
|
22840
23021
|
return 1;
|
|
22841
23022
|
}
|
|
22842
23023
|
}
|
|
23024
|
+
if (usesDebugAlias && hasExplicitLogLevel && logLevel !== "debug") {
|
|
23025
|
+
console.error(
|
|
23026
|
+
"--debug conflicts with a non-debug --log-level. Use one level selector."
|
|
23027
|
+
);
|
|
23028
|
+
return 1;
|
|
23029
|
+
}
|
|
23030
|
+
if (usesDebugAlias) logLevel = "debug";
|
|
22843
23031
|
if (failed && outPath) {
|
|
22844
23032
|
console.error(
|
|
22845
23033
|
"--failed cannot be combined with --out. Remove --failed to export the full persisted log stream."
|
|
@@ -22849,7 +23037,7 @@ async function handleRunLogs(args) {
|
|
|
22849
23037
|
const client2 = new DeeplineClient();
|
|
22850
23038
|
if (outPath) {
|
|
22851
23039
|
const result2 = await client2.runs.logs(runId, { all: true });
|
|
22852
|
-
const logs = result2.entries;
|
|
23040
|
+
const logs = result2.entries.filter((line) => logLevelReaches(classifyLogLine(line).level, logLevel)).map((line) => classifyLogLine(line).line);
|
|
22853
23041
|
writeFileSync10(outPath, `${logs.join("\n")}${logs.length > 0 ? "\n" : ""}`);
|
|
22854
23042
|
printCommandEnvelope(
|
|
22855
23043
|
{
|
|
@@ -22857,6 +23045,7 @@ async function handleRunLogs(args) {
|
|
|
22857
23045
|
log_path: outPath,
|
|
22858
23046
|
lineCount: logs.length,
|
|
22859
23047
|
totalCount: result2.totalCount,
|
|
23048
|
+
logLevel,
|
|
22860
23049
|
...result2.logsTruncated ? { logsTruncated: true } : {},
|
|
22861
23050
|
local: { log_path: outPath },
|
|
22862
23051
|
render: {
|
|
@@ -22877,27 +23066,47 @@ async function handleRunLogs(args) {
|
|
|
22877
23066
|
);
|
|
22878
23067
|
return 0;
|
|
22879
23068
|
}
|
|
22880
|
-
const result = await client2.runs.logs(runId, {
|
|
22881
|
-
|
|
23069
|
+
const result = await client2.runs.logs(runId, {
|
|
23070
|
+
...failed ? { limit, failed: true } : { all: logLevel !== "debug", limit }
|
|
23071
|
+
});
|
|
23072
|
+
const matchingEntries = result.entries.filter(
|
|
23073
|
+
(line) => logLevelReaches(classifyLogLine(line).level, logLevel)
|
|
23074
|
+
);
|
|
23075
|
+
const entries = failed ? matchingEntries : matchingEntries.slice(-limit);
|
|
23076
|
+
const matchingEntriesTruncated = !failed && matchingEntries.length > limit;
|
|
23077
|
+
const filteredResult = {
|
|
23078
|
+
...result,
|
|
23079
|
+
entries,
|
|
23080
|
+
returnedCount: entries.length,
|
|
23081
|
+
truncated: result.truncated || matchingEntriesTruncated,
|
|
23082
|
+
hasMore: result.hasMore || matchingEntriesTruncated,
|
|
23083
|
+
view: failed ? result.view : "tail",
|
|
23084
|
+
next: {
|
|
23085
|
+
...result.next ?? {},
|
|
23086
|
+
logs: `deepline runs logs ${result.runId} --out run.log --log-level ${logLevel} --json`
|
|
23087
|
+
}
|
|
23088
|
+
};
|
|
23089
|
+
const text = buildRunLogsText(filteredResult);
|
|
22882
23090
|
printCommandEnvelope(
|
|
22883
23091
|
{
|
|
22884
23092
|
runId: result.runId,
|
|
22885
23093
|
totalCount: result.totalCount,
|
|
22886
|
-
returnedCount:
|
|
23094
|
+
returnedCount: entries.length,
|
|
22887
23095
|
firstSequence: result.firstSequence,
|
|
22888
23096
|
lastSequence: result.lastSequence,
|
|
22889
|
-
truncated:
|
|
22890
|
-
hasMore:
|
|
23097
|
+
truncated: filteredResult.truncated,
|
|
23098
|
+
hasMore: filteredResult.hasMore,
|
|
23099
|
+
logLevel,
|
|
22891
23100
|
...result.logsTruncated ? { logsTruncated: true } : {},
|
|
22892
|
-
entries
|
|
22893
|
-
...
|
|
23101
|
+
entries,
|
|
23102
|
+
...filteredResult.view ? { view: filteredResult.view } : {},
|
|
22894
23103
|
...result.association ? { association: result.association } : {},
|
|
22895
23104
|
...result.warning ? { warning: result.warning } : {},
|
|
22896
23105
|
next: {
|
|
22897
23106
|
...result.next ?? {},
|
|
22898
|
-
export: `deepline runs logs ${result.runId} --out run.log --json`
|
|
23107
|
+
export: `deepline runs logs ${result.runId} --out run.log --log-level ${logLevel} --json`
|
|
22899
23108
|
},
|
|
22900
|
-
render: { sections: [{ title: "run logs", lines:
|
|
23109
|
+
render: { sections: [{ title: "run logs", lines: entries }] }
|
|
22901
23110
|
},
|
|
22902
23111
|
{
|
|
22903
23112
|
json: argsWantJson(args),
|
|
@@ -22907,7 +23116,7 @@ async function handleRunLogs(args) {
|
|
|
22907
23116
|
return 0;
|
|
22908
23117
|
}
|
|
22909
23118
|
function buildRunLogsText(result) {
|
|
22910
|
-
const lines =
|
|
23119
|
+
const lines = result.entries.map((line) => classifyLogLine(line).line);
|
|
22911
23120
|
if (result.warning) {
|
|
22912
23121
|
if (lines.length > 0) lines.push("");
|
|
22913
23122
|
lines.push(`warning: ${result.warning}`);
|
|
@@ -24291,6 +24500,7 @@ Examples:
|
|
|
24291
24500
|
deepline plays run long-background-play --no-wait
|
|
24292
24501
|
deepline plays run long-background-play --run-id-file ./run-id.json
|
|
24293
24502
|
deepline plays run my.play.ts --input '{"domain":"stripe.com"}'
|
|
24503
|
+
deepline plays run my.play.ts --input '{"domain":"stripe.com"}' --log-level debug
|
|
24294
24504
|
deepline plays run my.play.ts --profile absurd
|
|
24295
24505
|
deepline plays run my.play.ts --max-concurrent-external-calls 20
|
|
24296
24506
|
deepline plays run my.play.ts --input @input.json --json
|
|
@@ -24310,9 +24520,12 @@ Examples:
|
|
|
24310
24520
|
).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
|
|
24311
24521
|
"--run-id-file <path>",
|
|
24312
24522
|
"Atomically write the accepted run id to a new JSON file"
|
|
24313
|
-
).option("--logs", "Compatibility alias for --debug").option(
|
|
24523
|
+
).option("--logs", "Compatibility alias for --log-level debug").option(
|
|
24314
24524
|
"--debug [value]",
|
|
24315
|
-
"
|
|
24525
|
+
"Compatibility alias for --log-level debug when bare; --debug <value> remains legacy Play input.debug"
|
|
24526
|
+
).option(
|
|
24527
|
+
"--log-level <level>",
|
|
24528
|
+
"Minimum live log severity: debug, info (default), warn, or error"
|
|
24316
24529
|
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Start a fresh run graph").option(
|
|
24317
24530
|
"--force-tool-refresh",
|
|
24318
24531
|
"Refresh completed tool receipts; may repeat billed provider calls"
|
|
@@ -24362,6 +24575,7 @@ Pass-through input flags:
|
|
|
24362
24575
|
...options.watch || options.wait ? ["--watch"] : [],
|
|
24363
24576
|
...options.logs ? ["--logs"] : [],
|
|
24364
24577
|
...options.debug === true ? ["--debug"] : typeof options.debug === "string" ? ["--debug", options.debug] : [],
|
|
24578
|
+
...options.logLevel ? ["--log-level", options.logLevel] : [],
|
|
24365
24579
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
|
24366
24580
|
...options.force ? ["--force"] : [],
|
|
24367
24581
|
...options.forceToolRefresh ? ["--force-tool-refresh"] : [],
|
|
@@ -24670,10 +24884,15 @@ Concepts:
|
|
|
24670
24884
|
tail reads the live stream. logs fetches persisted logs after the fact.
|
|
24671
24885
|
stop mutates cloud state by requesting cancellation.
|
|
24672
24886
|
|
|
24887
|
+
Debug a run:
|
|
24888
|
+
Active: deepline runs tail <run-id> --log-level debug
|
|
24889
|
+
Historical: deepline runs logs <run-id> --out run.log --log-level debug --json
|
|
24890
|
+
Full state: deepline runs get <run-id> --full --json
|
|
24891
|
+
|
|
24673
24892
|
Examples:
|
|
24674
24893
|
deepline runs get play/my-play/run/20260501t000000-000 --json
|
|
24675
24894
|
deepline runs tail play/my-play/run/20260501t000000-000
|
|
24676
|
-
deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --json
|
|
24895
|
+
deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --log-level debug --json
|
|
24677
24896
|
deepline runs list --play my-play --status failed --json
|
|
24678
24897
|
deepline runs list --status running --json
|
|
24679
24898
|
deepline runs stop play/my-play/run/20260501t000000-000 --reason "stale lock" --json
|
|
@@ -24779,13 +24998,15 @@ Notes:
|
|
|
24779
24998
|
logs for persisted log history. In human output, --compact prints deduplicated
|
|
24780
24999
|
step transitions and progress instead of the full event stream. --json emits
|
|
24781
25000
|
one terminal package. --jsonl emits canonical live events as JSON Lines and
|
|
24782
|
-
ends with the same compact package shape as runs get --json.
|
|
24783
|
-
|
|
25001
|
+
ends with the same compact package shape as runs get --json. --log-level
|
|
25002
|
+
filters the rendered customer-safe runtime log lines; debug includes runtime
|
|
25003
|
+
and receipt diagnostics and writes them to stderr alongside JSON output.
|
|
24784
25004
|
|
|
24785
25005
|
Examples:
|
|
24786
25006
|
deepline runs tail play/my-play/run/20260501t000000-000
|
|
24787
25007
|
deepline runs tail play/my-play/run/20260501t000000-000 --compact
|
|
24788
|
-
deepline runs tail play/my-play/run/20260501t000000-000 --debug
|
|
25008
|
+
deepline runs tail play/my-play/run/20260501t000000-000 --log-level debug
|
|
25009
|
+
deepline runs tail play/my-play/run/20260501t000000-000 --log-level error
|
|
24789
25010
|
deepline runs tail play/my-play/run/20260501t000000-000 --jsonl
|
|
24790
25011
|
`
|
|
24791
25012
|
).option("--json", "Emit one terminal JSON package after the run completes").option(
|
|
@@ -24794,9 +25015,9 @@ Examples:
|
|
|
24794
25015
|
).option(
|
|
24795
25016
|
"--compact",
|
|
24796
25017
|
"Show deduplicated human step transitions and progress"
|
|
24797
|
-
).option("--logs", "Compatibility alias for --debug").option(
|
|
24798
|
-
"--
|
|
24799
|
-
"
|
|
25018
|
+
).option("--logs", "Compatibility alias for --log-level debug").option("--debug", "Compatibility alias for --log-level debug").option(
|
|
25019
|
+
"--log-level <level>",
|
|
25020
|
+
"Minimum severity: debug, info (default), warn, or error"
|
|
24800
25021
|
).action(async (runId, options) => {
|
|
24801
25022
|
process.exitCode = await handleRunTail([
|
|
24802
25023
|
runId,
|
|
@@ -24804,7 +25025,8 @@ Examples:
|
|
|
24804
25025
|
...options.jsonl ? ["--jsonl"] : [],
|
|
24805
25026
|
...options.compact ? ["--compact"] : [],
|
|
24806
25027
|
...options.logs ? ["--logs"] : [],
|
|
24807
|
-
...options.debug ? ["--debug"] : []
|
|
25028
|
+
...options.debug ? ["--debug"] : [],
|
|
25029
|
+
...options.logLevel ? ["--log-level", options.logLevel] : []
|
|
24808
25030
|
]);
|
|
24809
25031
|
});
|
|
24810
25032
|
runs.command("logs <runId>").description("Fetch persisted logs for a play run.").addHelpText(
|
|
@@ -24812,29 +25034,30 @@ Examples:
|
|
|
24812
25034
|
`
|
|
24813
25035
|
Notes:
|
|
24814
25036
|
Prints a bounded recent log preview by default. Use --out to write the full
|
|
24815
|
-
|
|
24816
|
-
|
|
25037
|
+
retained stream to a local file. Use --log-level to filter by severity;
|
|
25038
|
+
default debug preserves the complete historical stream.
|
|
24817
25039
|
|
|
24818
25040
|
Examples:
|
|
24819
25041
|
deepline runs logs play/my-play/run/20260501t000000-000
|
|
24820
25042
|
deepline runs logs play/my-play/run/20260501t000000-000 --limit 500
|
|
24821
25043
|
deepline runs logs play/my-play/run/20260501t000000-000 --failed --json
|
|
24822
|
-
deepline runs logs play/my-play/run/20260501t000000-000 --
|
|
24823
|
-
deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --json
|
|
25044
|
+
deepline runs logs play/my-play/run/20260501t000000-000 --log-level error
|
|
25045
|
+
deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --log-level debug --json
|
|
24824
25046
|
`
|
|
24825
25047
|
).option(
|
|
24826
25048
|
"--limit <count>",
|
|
24827
25049
|
"Maximum recent log lines to print without --out",
|
|
24828
25050
|
"200"
|
|
24829
|
-
).option("--out <path>", "Write the full
|
|
24830
|
-
"--
|
|
24831
|
-
"
|
|
24832
|
-
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (runId, options) => {
|
|
25051
|
+
).option("--out <path>", "Write the full retained log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option(
|
|
25052
|
+
"--log-level <level>",
|
|
25053
|
+
"Minimum severity: debug (default), info, warn, or error"
|
|
25054
|
+
).option("--logs", "Compatibility alias for --log-level debug").option("--debug", "Compatibility alias for --log-level debug").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (runId, options) => {
|
|
24833
25055
|
process.exitCode = await handleRunLogs([
|
|
24834
25056
|
runId,
|
|
24835
25057
|
...options.limit ? ["--limit", options.limit] : [],
|
|
24836
25058
|
...options.out ? ["--out", options.out] : [],
|
|
24837
25059
|
...options.failed ? ["--failed"] : [],
|
|
25060
|
+
...options.logLevel ? ["--log-level", options.logLevel] : [],
|
|
24838
25061
|
...options.logs ? ["--logs"] : [],
|
|
24839
25062
|
...options.debug ? ["--debug"] : [],
|
|
24840
25063
|
...options.json ? ["--json"] : []
|
|
@@ -33827,6 +34050,92 @@ Examples:
|
|
|
33827
34050
|
}
|
|
33828
34051
|
|
|
33829
34052
|
// src/cli/commands/org.ts
|
|
34053
|
+
import { createHash as createHash5, randomUUID as randomUUID6 } from "crypto";
|
|
34054
|
+
import {
|
|
34055
|
+
existsSync as existsSync11,
|
|
34056
|
+
mkdirSync as mkdirSync9,
|
|
34057
|
+
readFileSync as readFileSync12,
|
|
34058
|
+
unlinkSync,
|
|
34059
|
+
writeFileSync as writeFileSync13
|
|
34060
|
+
} from "fs";
|
|
34061
|
+
import { join as join13 } from "path";
|
|
34062
|
+
function pendingOrgCreatePath(baseUrl, accountId, sourceOrgId, name) {
|
|
34063
|
+
const intent = createHash5("sha256").update(accountId).update("\0").update(sourceOrgId).update("\0").update(name).digest("hex");
|
|
34064
|
+
return join13(sdkCliStateDirPath(baseUrl), `pending-org-create-${intent}.json`);
|
|
34065
|
+
}
|
|
34066
|
+
function readPendingOrgCreate(path, accountId, sourceOrgId, name) {
|
|
34067
|
+
let value;
|
|
34068
|
+
try {
|
|
34069
|
+
value = JSON.parse(readFileSync12(path, "utf8"));
|
|
34070
|
+
} catch (error) {
|
|
34071
|
+
throw new Error(
|
|
34072
|
+
`Cannot resume the pending workspace creation recorded at ${path}: ${error instanceof Error ? error.message : String(error)}`
|
|
34073
|
+
);
|
|
34074
|
+
}
|
|
34075
|
+
if (typeof value !== "object" || value === null || value.accountId !== accountId || value.sourceOrgId !== sourceOrgId || value.name !== name || typeof value.idempotencyKey !== "string" || !value.idempotencyKey.trim()) {
|
|
34076
|
+
throw new Error(
|
|
34077
|
+
`Cannot resume the pending workspace creation recorded at ${path}: the saved intent is invalid.`
|
|
34078
|
+
);
|
|
34079
|
+
}
|
|
34080
|
+
return value;
|
|
34081
|
+
}
|
|
34082
|
+
function loadOrCreatePendingOrgCreate(input2) {
|
|
34083
|
+
const stateDir = sdkCliStateDirPath(input2.baseUrl);
|
|
34084
|
+
const path = pendingOrgCreatePath(
|
|
34085
|
+
input2.baseUrl,
|
|
34086
|
+
input2.accountId,
|
|
34087
|
+
input2.sourceOrgId,
|
|
34088
|
+
input2.name
|
|
34089
|
+
);
|
|
34090
|
+
mkdirSync9(stateDir, { recursive: true });
|
|
34091
|
+
if (existsSync11(path)) {
|
|
34092
|
+
return {
|
|
34093
|
+
...readPendingOrgCreate(
|
|
34094
|
+
path,
|
|
34095
|
+
input2.accountId,
|
|
34096
|
+
input2.sourceOrgId,
|
|
34097
|
+
input2.name
|
|
34098
|
+
),
|
|
34099
|
+
path
|
|
34100
|
+
};
|
|
34101
|
+
}
|
|
34102
|
+
const pending = {
|
|
34103
|
+
accountId: input2.accountId,
|
|
34104
|
+
sourceOrgId: input2.sourceOrgId,
|
|
34105
|
+
name: input2.name,
|
|
34106
|
+
idempotencyKey: randomUUID6()
|
|
34107
|
+
};
|
|
34108
|
+
try {
|
|
34109
|
+
writeFileSync13(path, `${JSON.stringify(pending)}
|
|
34110
|
+
`, {
|
|
34111
|
+
encoding: "utf8",
|
|
34112
|
+
flag: "wx",
|
|
34113
|
+
mode: 384
|
|
34114
|
+
});
|
|
34115
|
+
return { ...pending, path };
|
|
34116
|
+
} catch (error) {
|
|
34117
|
+
if (error.code !== "EEXIST") throw error;
|
|
34118
|
+
return {
|
|
34119
|
+
...readPendingOrgCreate(
|
|
34120
|
+
path,
|
|
34121
|
+
input2.accountId,
|
|
34122
|
+
input2.sourceOrgId,
|
|
34123
|
+
input2.name
|
|
34124
|
+
),
|
|
34125
|
+
path
|
|
34126
|
+
};
|
|
34127
|
+
}
|
|
34128
|
+
}
|
|
34129
|
+
async function fetchWorkspaceCreationIdentity(http, apiKey) {
|
|
34130
|
+
const status = await http.post("/api/v2/auth/cli/status", { api_key: apiKey });
|
|
34131
|
+
const accountId = status.user_id?.trim();
|
|
34132
|
+
if (!accountId) {
|
|
34133
|
+
throw new Error(
|
|
34134
|
+
"Workspace creation requires an API key linked to a user account."
|
|
34135
|
+
);
|
|
34136
|
+
}
|
|
34137
|
+
return { accountId, orgId: status.org_id?.trim() || null };
|
|
34138
|
+
}
|
|
33830
34139
|
async function fetchOrganizations(http, apiKey) {
|
|
33831
34140
|
return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
|
|
33832
34141
|
}
|
|
@@ -34295,23 +34604,58 @@ async function handleOrgSwitch(selection, options) {
|
|
|
34295
34604
|
}
|
|
34296
34605
|
async function handleOrgCreate(name, options) {
|
|
34297
34606
|
const config = resolveConfig();
|
|
34607
|
+
const normalizedName = name.trim();
|
|
34608
|
+
if (!normalizedName) {
|
|
34609
|
+
throw new Error("Workspace name is required.");
|
|
34610
|
+
}
|
|
34298
34611
|
const http = new HttpClient(config);
|
|
34299
|
-
const
|
|
34300
|
-
|
|
34301
|
-
|
|
34302
|
-
|
|
34612
|
+
const identity = await fetchWorkspaceCreationIdentity(http, config.apiKey);
|
|
34613
|
+
let created;
|
|
34614
|
+
let workspaceApiKey;
|
|
34615
|
+
let pendingIntentPath = null;
|
|
34616
|
+
if (!identity.orgId) {
|
|
34617
|
+
const firstWorkspace = await http.post("/api/v2/auth/cli/org-create", {
|
|
34618
|
+
api_key: config.apiKey,
|
|
34619
|
+
name: normalizedName
|
|
34620
|
+
});
|
|
34621
|
+
const { api_key: apiKey, ...publicFirstWorkspace } = firstWorkspace;
|
|
34622
|
+
workspaceApiKey = apiKey;
|
|
34623
|
+
created = publicFirstWorkspace;
|
|
34624
|
+
} else {
|
|
34625
|
+
const pending = loadOrCreatePendingOrgCreate({
|
|
34626
|
+
baseUrl: config.baseUrl,
|
|
34627
|
+
accountId: identity.accountId,
|
|
34628
|
+
sourceOrgId: identity.orgId,
|
|
34629
|
+
name: normalizedName
|
|
34630
|
+
});
|
|
34631
|
+
const workspace = await new DeeplineClient({
|
|
34632
|
+
apiKey: config.apiKey,
|
|
34633
|
+
baseUrl: config.baseUrl
|
|
34634
|
+
}).workspaces.create({
|
|
34635
|
+
name: normalizedName,
|
|
34636
|
+
idempotencyKey: pending.idempotencyKey
|
|
34637
|
+
});
|
|
34638
|
+
const switched = await http.post("/api/v2/auth/cli/switch", {
|
|
34639
|
+
api_key: config.apiKey,
|
|
34640
|
+
org_id: workspace.org_id
|
|
34641
|
+
});
|
|
34642
|
+
workspaceApiKey = switched.api_key;
|
|
34643
|
+
created = { ...workspace };
|
|
34644
|
+
pendingIntentPath = pending.path;
|
|
34645
|
+
}
|
|
34303
34646
|
const authValues = organizationAuthValues({
|
|
34304
34647
|
baseUrl: config.baseUrl,
|
|
34305
|
-
apiKey:
|
|
34648
|
+
apiKey: workspaceApiKey,
|
|
34306
34649
|
orgId: created.org_id,
|
|
34307
34650
|
orgName: created.org_name
|
|
34308
34651
|
});
|
|
34309
34652
|
saveHostEnvValues(config.baseUrl, authValues);
|
|
34310
|
-
|
|
34653
|
+
if (pendingIntentPath) unlinkSync(pendingIntentPath);
|
|
34311
34654
|
printCommandEnvelope(
|
|
34312
34655
|
{
|
|
34313
34656
|
ok: true,
|
|
34314
|
-
...
|
|
34657
|
+
...created,
|
|
34658
|
+
initial_credits: typeof created.initial_credits === "number" ? created.initial_credits : 0,
|
|
34315
34659
|
api_key_saved: true,
|
|
34316
34660
|
switched: true,
|
|
34317
34661
|
host_env_path: hostEnvFilePath(config.baseUrl),
|
|
@@ -34394,9 +34738,9 @@ Examples:
|
|
|
34394
34738
|
"after",
|
|
34395
34739
|
`
|
|
34396
34740
|
Notes:
|
|
34397
|
-
Mutates workspace state. The new organization is created for the
|
|
34398
|
-
authenticated user
|
|
34399
|
-
CLI
|
|
34741
|
+
Mutates workspace and billing state. The new organization is created for the
|
|
34742
|
+
current authenticated user and provisioned on the active PAYG offer before
|
|
34743
|
+
this CLI switches to it. Interrupted requests resume automatically.
|
|
34400
34744
|
|
|
34401
34745
|
Examples:
|
|
34402
34746
|
deepline org create Acme
|
|
@@ -34854,27 +35198,27 @@ Examples:
|
|
|
34854
35198
|
// src/cli/commands/setup.ts
|
|
34855
35199
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
34856
35200
|
import {
|
|
34857
|
-
existsSync as
|
|
35201
|
+
existsSync as existsSync15,
|
|
34858
35202
|
lstatSync as lstatSync2,
|
|
34859
|
-
mkdirSync as
|
|
34860
|
-
readFileSync as
|
|
35203
|
+
mkdirSync as mkdirSync12,
|
|
35204
|
+
readFileSync as readFileSync16,
|
|
34861
35205
|
realpathSync as realpathSync4,
|
|
34862
|
-
writeFileSync as
|
|
35206
|
+
writeFileSync as writeFileSync16
|
|
34863
35207
|
} from "fs";
|
|
34864
35208
|
import { homedir as homedir9 } from "os";
|
|
34865
|
-
import { dirname as dirname16, join as
|
|
35209
|
+
import { dirname as dirname16, join as join17, resolve as resolve16 } from "path";
|
|
34866
35210
|
|
|
34867
35211
|
// src/cli/installation-lifecycle.ts
|
|
34868
35212
|
import {
|
|
34869
|
-
existsSync as
|
|
35213
|
+
existsSync as existsSync12,
|
|
34870
35214
|
lstatSync,
|
|
34871
|
-
readFileSync as
|
|
35215
|
+
readFileSync as readFileSync13,
|
|
34872
35216
|
realpathSync as realpathSync3,
|
|
34873
35217
|
rmSync as rmSync4
|
|
34874
35218
|
} from "fs";
|
|
34875
|
-
import { basename as basename6, dirname as dirname13, join as
|
|
35219
|
+
import { basename as basename6, dirname as dirname13, join as join14, relative as relative5, resolve as resolve15 } from "path";
|
|
34876
35220
|
var nodeFileSystem = {
|
|
34877
|
-
exists:
|
|
35221
|
+
exists: existsSync12,
|
|
34878
35222
|
isSymbolicLink(path) {
|
|
34879
35223
|
try {
|
|
34880
35224
|
return lstatSync(path).isSymbolicLink();
|
|
@@ -34884,7 +35228,7 @@ var nodeFileSystem = {
|
|
|
34884
35228
|
},
|
|
34885
35229
|
read(path) {
|
|
34886
35230
|
try {
|
|
34887
|
-
return
|
|
35231
|
+
return readFileSync13(path, "utf8");
|
|
34888
35232
|
} catch {
|
|
34889
35233
|
return "";
|
|
34890
35234
|
}
|
|
@@ -34928,25 +35272,25 @@ var CliInstallation = class _CliInstallation {
|
|
|
34928
35272
|
});
|
|
34929
35273
|
}
|
|
34930
35274
|
static isNpmPackagePath(path) {
|
|
34931
|
-
return path?.includes(`${
|
|
35275
|
+
return path?.includes(`${join14("node_modules", "deepline")}`) ?? false;
|
|
34932
35276
|
}
|
|
34933
35277
|
launcher(path) {
|
|
34934
35278
|
return inspectLauncher(path, this.input.fileSystem);
|
|
34935
35279
|
}
|
|
34936
35280
|
retiredArtifacts() {
|
|
34937
|
-
const hostDir =
|
|
35281
|
+
const hostDir = join14(
|
|
34938
35282
|
this.input.home,
|
|
34939
35283
|
".local",
|
|
34940
35284
|
"deepline",
|
|
34941
35285
|
this.input.baseUrlSlug
|
|
34942
35286
|
);
|
|
34943
|
-
const legacyLauncherPath =
|
|
35287
|
+
const legacyLauncherPath = join14(
|
|
34944
35288
|
this.input.home,
|
|
34945
35289
|
".local",
|
|
34946
35290
|
"bin",
|
|
34947
35291
|
"deepline"
|
|
34948
35292
|
);
|
|
34949
|
-
const installerCommandPath = this.input.fileSystem.read(
|
|
35293
|
+
const installerCommandPath = this.input.fileSystem.read(join14(hostDir, "sdk", ".command-path")).trim();
|
|
34950
35294
|
const ownedInstallerCommand = isOwnedInstallerCommandPath({
|
|
34951
35295
|
hostDir,
|
|
34952
35296
|
commandPath: installerCommandPath
|
|
@@ -34954,16 +35298,16 @@ var CliInstallation = class _CliInstallation {
|
|
|
34954
35298
|
const legacyLauncher = this.launcher(legacyLauncherPath);
|
|
34955
35299
|
const candidates = [
|
|
34956
35300
|
...legacyLauncher.ownership === "installer_legacy" ? [legacyLauncherPath] : [],
|
|
34957
|
-
|
|
34958
|
-
|
|
34959
|
-
|
|
34960
|
-
|
|
34961
|
-
|
|
34962
|
-
|
|
34963
|
-
|
|
35301
|
+
join14(this.input.home, ".local", "bin", "deepline-real"),
|
|
35302
|
+
join14(hostDir, "bin", "deepline"),
|
|
35303
|
+
join14(hostDir, "bin", "deepline-real"),
|
|
35304
|
+
join14(hostDir, "cli", ".install-method"),
|
|
35305
|
+
join14(hostDir, "cli", ".version"),
|
|
35306
|
+
join14(hostDir, "sdk", ".install-method"),
|
|
35307
|
+
join14(hostDir, "sdk", ".command-path"),
|
|
34964
35308
|
...ownedInstallerCommand ? [
|
|
34965
35309
|
installerCommandPath,
|
|
34966
|
-
|
|
35310
|
+
join14(dirname13(installerCommandPath), "deepline-sdk")
|
|
34967
35311
|
] : []
|
|
34968
35312
|
];
|
|
34969
35313
|
return {
|
|
@@ -34994,9 +35338,9 @@ function isOwnedInstallerCommandPath(input2) {
|
|
|
34994
35338
|
|
|
34995
35339
|
// src/cli/commands/skills.ts
|
|
34996
35340
|
import { spawn as spawn3 } from "child_process";
|
|
34997
|
-
import { existsSync as
|
|
35341
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync11, readFileSync as readFileSync15, writeFileSync as writeFileSync15 } from "fs";
|
|
34998
35342
|
import { homedir as homedir8 } from "os";
|
|
34999
|
-
import { dirname as dirname15, join as
|
|
35343
|
+
import { dirname as dirname15, join as join16 } from "path";
|
|
35000
35344
|
|
|
35001
35345
|
// ../../shared_libs/cli/install-commands.json
|
|
35002
35346
|
var install_commands_default = {
|
|
@@ -35107,13 +35451,13 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
|
35107
35451
|
// src/cli/skills-sync.ts
|
|
35108
35452
|
import { spawn as spawn2, spawnSync } from "child_process";
|
|
35109
35453
|
import {
|
|
35110
|
-
existsSync as
|
|
35111
|
-
mkdirSync as
|
|
35112
|
-
readFileSync as
|
|
35113
|
-
unlinkSync,
|
|
35114
|
-
writeFileSync as
|
|
35454
|
+
existsSync as existsSync13,
|
|
35455
|
+
mkdirSync as mkdirSync10,
|
|
35456
|
+
readFileSync as readFileSync14,
|
|
35457
|
+
unlinkSync as unlinkSync2,
|
|
35458
|
+
writeFileSync as writeFileSync14
|
|
35115
35459
|
} from "fs";
|
|
35116
|
-
import { dirname as dirname14, join as
|
|
35460
|
+
import { dirname as dirname14, join as join15 } from "path";
|
|
35117
35461
|
|
|
35118
35462
|
// src/cli/windows-arg-escape.ts
|
|
35119
35463
|
var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
|
|
@@ -35460,10 +35804,10 @@ function shouldSkipSkillsSync() {
|
|
|
35460
35804
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
35461
35805
|
}
|
|
35462
35806
|
function unavailableSkillsNoticePath(baseUrl) {
|
|
35463
|
-
return
|
|
35807
|
+
return join15(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
|
|
35464
35808
|
}
|
|
35465
35809
|
function failedSkillsSyncPath(baseUrl, agents) {
|
|
35466
|
-
return
|
|
35810
|
+
return join15(
|
|
35467
35811
|
sdkCliStateDirPath(baseUrl),
|
|
35468
35812
|
`skills-sync-failed-${agents.join("-")}-version`
|
|
35469
35813
|
);
|
|
@@ -35473,15 +35817,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
|
|
|
35473
35817
|
}
|
|
35474
35818
|
function readMarkedSkillsSyncVersion(path) {
|
|
35475
35819
|
try {
|
|
35476
|
-
return
|
|
35820
|
+
return existsSync13(path) ? readFileSync14(path, "utf-8").trim() : "";
|
|
35477
35821
|
} catch {
|
|
35478
35822
|
return "";
|
|
35479
35823
|
}
|
|
35480
35824
|
}
|
|
35481
35825
|
function writeMarkedSkillsSyncVersion(path, version) {
|
|
35482
35826
|
try {
|
|
35483
|
-
|
|
35484
|
-
|
|
35827
|
+
mkdirSync10(dirname14(path), { recursive: true });
|
|
35828
|
+
writeFileSync14(path, `${version}
|
|
35485
35829
|
`, "utf-8");
|
|
35486
35830
|
return true;
|
|
35487
35831
|
} catch {
|
|
@@ -35500,7 +35844,7 @@ ${manualCommand}`
|
|
|
35500
35844
|
}
|
|
35501
35845
|
function clearUnavailableSkillsNotice(baseUrl) {
|
|
35502
35846
|
try {
|
|
35503
|
-
|
|
35847
|
+
unlinkSync2(unavailableSkillsNoticePath(baseUrl));
|
|
35504
35848
|
} catch {
|
|
35505
35849
|
}
|
|
35506
35850
|
}
|
|
@@ -35511,7 +35855,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
35511
35855
|
);
|
|
35512
35856
|
}
|
|
35513
35857
|
function hasFailedAutomaticSkillsSync(baseUrl, agents) {
|
|
35514
|
-
return
|
|
35858
|
+
return existsSync13(failedSkillsSyncPath(baseUrl, agents));
|
|
35515
35859
|
}
|
|
35516
35860
|
function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
35517
35861
|
return writeMarkedSkillsSyncVersion(
|
|
@@ -35521,7 +35865,7 @@ function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
35521
35865
|
}
|
|
35522
35866
|
function clearFailedSkillsSync(baseUrl, agents) {
|
|
35523
35867
|
try {
|
|
35524
|
-
|
|
35868
|
+
unlinkSync2(failedSkillsSyncPath(baseUrl, agents));
|
|
35525
35869
|
} catch {
|
|
35526
35870
|
}
|
|
35527
35871
|
}
|
|
@@ -35888,13 +36232,13 @@ function detectSkillsAgents(input2) {
|
|
|
35888
36232
|
];
|
|
35889
36233
|
const detected = AGENT_MARKERS.filter(
|
|
35890
36234
|
(marker) => roots.some(
|
|
35891
|
-
(root) => marker.paths.some((path) =>
|
|
36235
|
+
(root) => marker.paths.some((path) => existsSync14(join16(root, path)))
|
|
35892
36236
|
)
|
|
35893
36237
|
).map((marker) => marker.agent);
|
|
35894
36238
|
return detected.length > 0 ? detected : ["*"];
|
|
35895
36239
|
}
|
|
35896
36240
|
function skillsStatePathForScope(baseUrl, scope, root) {
|
|
35897
|
-
return scope === "local" && root ?
|
|
36241
|
+
return scope === "local" && root ? join16(root, ".deepline", "setup", "skills.json") : join16(sdkCliStateDirPath(baseUrl), "skills-install.json");
|
|
35898
36242
|
}
|
|
35899
36243
|
function buildSkillsPlan(input2) {
|
|
35900
36244
|
const scopeArgs = input2.scope === "global" ? ["--global"] : [];
|
|
@@ -35961,7 +36305,7 @@ function isSkillsPlanCurrent(plan, state) {
|
|
|
35961
36305
|
}
|
|
35962
36306
|
function readSkillsInstallState(path) {
|
|
35963
36307
|
try {
|
|
35964
|
-
const parsed = JSON.parse(
|
|
36308
|
+
const parsed = JSON.parse(readFileSync15(path, "utf8"));
|
|
35965
36309
|
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
35966
36310
|
} catch {
|
|
35967
36311
|
return null;
|
|
@@ -36114,8 +36458,8 @@ async function runSkillsCommand(options, dependencies = {}) {
|
|
|
36114
36458
|
`
|
|
36115
36459
|
);
|
|
36116
36460
|
}
|
|
36117
|
-
|
|
36118
|
-
|
|
36461
|
+
mkdirSync11(dirname15(plan.statePath), { recursive: true });
|
|
36462
|
+
writeFileSync15(
|
|
36119
36463
|
plan.statePath,
|
|
36120
36464
|
`${JSON.stringify(
|
|
36121
36465
|
{
|
|
@@ -36253,7 +36597,7 @@ function phasesFromLegacyStatus(status) {
|
|
|
36253
36597
|
function readSetupState(input2) {
|
|
36254
36598
|
try {
|
|
36255
36599
|
const parsed = JSON.parse(
|
|
36256
|
-
|
|
36600
|
+
readFileSync16(
|
|
36257
36601
|
setupStatePath(input2.baseUrl, input2.scope, input2.root),
|
|
36258
36602
|
"utf8"
|
|
36259
36603
|
)
|
|
@@ -36329,7 +36673,7 @@ function buildPendingAuthorizationOutput(input2) {
|
|
|
36329
36673
|
};
|
|
36330
36674
|
}
|
|
36331
36675
|
function setupStatePath(baseUrl, scope, root) {
|
|
36332
|
-
return scope === "local" && root ?
|
|
36676
|
+
return scope === "local" && root ? join17(root, ".deepline", "setup", "state.json") : join17(sdkCliStateDirPath(baseUrl), "setup.json");
|
|
36333
36677
|
}
|
|
36334
36678
|
async function captureStdout2(run) {
|
|
36335
36679
|
let stdout = "";
|
|
@@ -36358,7 +36702,7 @@ function asRecord3(value) {
|
|
|
36358
36702
|
}
|
|
36359
36703
|
function safeRead(path) {
|
|
36360
36704
|
try {
|
|
36361
|
-
return
|
|
36705
|
+
return readFileSync16(path, "utf8");
|
|
36362
36706
|
} catch {
|
|
36363
36707
|
return "";
|
|
36364
36708
|
}
|
|
@@ -36398,7 +36742,7 @@ function isHomebrewFormulaCommand(path) {
|
|
|
36398
36742
|
function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
36399
36743
|
const platform3 = dependencies.platform ?? process.platform;
|
|
36400
36744
|
const run = dependencies.spawn ?? spawnSync2;
|
|
36401
|
-
const pathExists = dependencies.exists ??
|
|
36745
|
+
const pathExists = dependencies.exists ?? existsSync15;
|
|
36402
36746
|
const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
|
|
36403
36747
|
const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
|
|
36404
36748
|
if (homebrewCommand) return homebrewCommand;
|
|
@@ -36410,7 +36754,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
|
36410
36754
|
if (prefix.status !== 0) return null;
|
|
36411
36755
|
const root = String(prefix.stdout ?? "").trim();
|
|
36412
36756
|
if (!root) return null;
|
|
36413
|
-
const candidates = platform3 === "win32" ? [
|
|
36757
|
+
const candidates = platform3 === "win32" ? [join17(root, "deepline.cmd"), join17(root, "deepline")] : [join17(root, "bin", "deepline")];
|
|
36414
36758
|
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
36415
36759
|
}
|
|
36416
36760
|
function inspectGlobalCliAvailability(input2) {
|
|
@@ -36436,7 +36780,7 @@ function isKnownDeeplineCommand(path) {
|
|
|
36436
36780
|
} catch {
|
|
36437
36781
|
}
|
|
36438
36782
|
if (entrypoint && resolvedPath === entrypoint) return true;
|
|
36439
|
-
if (resolvedPath.includes(`${
|
|
36783
|
+
if (resolvedPath.includes(`${join17("node_modules", "deepline")}`)) return true;
|
|
36440
36784
|
const content = safeRead(path);
|
|
36441
36785
|
return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
|
|
36442
36786
|
}
|
|
@@ -36446,7 +36790,7 @@ function inspectPathConflict() {
|
|
|
36446
36790
|
try {
|
|
36447
36791
|
if (lstatSync2(commandPath).isSymbolicLink()) {
|
|
36448
36792
|
const target = realpathSync4(commandPath);
|
|
36449
|
-
if (target.includes(`${
|
|
36793
|
+
if (target.includes(`${join17("node_modules", "deepline")}`)) return null;
|
|
36450
36794
|
}
|
|
36451
36795
|
} catch {
|
|
36452
36796
|
}
|
|
@@ -36454,8 +36798,8 @@ function inspectPathConflict() {
|
|
|
36454
36798
|
}
|
|
36455
36799
|
function writeSetupState(input2) {
|
|
36456
36800
|
const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
|
|
36457
|
-
|
|
36458
|
-
|
|
36801
|
+
mkdirSync12(dirname16(path), { recursive: true });
|
|
36802
|
+
writeFileSync16(
|
|
36459
36803
|
path,
|
|
36460
36804
|
`${JSON.stringify(
|
|
36461
36805
|
{
|
|
@@ -36495,7 +36839,7 @@ function failSetupPhase(phases, phase, code) {
|
|
|
36495
36839
|
phases[phase] = { status: "failed", code };
|
|
36496
36840
|
}
|
|
36497
36841
|
function rollbackCommand(scope, root) {
|
|
36498
|
-
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(
|
|
36842
|
+
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(join17(root, ".deepline", "runtime"))}` : "";
|
|
36499
36843
|
return `npm install -g${prefix} --no-audit --no-fund --include=optional --allow-scripts=esbuild deepline@${SDK_VERSION}`;
|
|
36500
36844
|
}
|
|
36501
36845
|
function setupResumeCommand(baseUrl, scope) {
|
|
@@ -36587,7 +36931,7 @@ function buildDoctorAssessment(input2) {
|
|
|
36587
36931
|
const pathGlobalCli = globalCli?.path ?? null;
|
|
36588
36932
|
const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
|
|
36589
36933
|
const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
|
|
36590
|
-
input2.root && runningCliPath?.includes(
|
|
36934
|
+
input2.root && runningCliPath?.includes(join17(input2.root, ".deepline", "runtime"))
|
|
36591
36935
|
);
|
|
36592
36936
|
const checks = {
|
|
36593
36937
|
cli: {
|
|
@@ -37120,15 +37464,15 @@ Examples:
|
|
|
37120
37464
|
|
|
37121
37465
|
// src/cli/update-preferences.ts
|
|
37122
37466
|
import {
|
|
37123
|
-
existsSync as
|
|
37124
|
-
mkdirSync as
|
|
37125
|
-
readFileSync as
|
|
37467
|
+
existsSync as existsSync16,
|
|
37468
|
+
mkdirSync as mkdirSync13,
|
|
37469
|
+
readFileSync as readFileSync17,
|
|
37126
37470
|
renameSync,
|
|
37127
37471
|
rmSync as rmSync5,
|
|
37128
|
-
writeFileSync as
|
|
37472
|
+
writeFileSync as writeFileSync17
|
|
37129
37473
|
} from "fs";
|
|
37130
37474
|
import { homedir as homedir10 } from "os";
|
|
37131
|
-
import { dirname as dirname17, join as
|
|
37475
|
+
import { dirname as dirname17, join as join18 } from "path";
|
|
37132
37476
|
var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
|
|
37133
37477
|
var CLI_UPDATE_MESSAGES = [
|
|
37134
37478
|
{
|
|
@@ -37157,7 +37501,7 @@ function unreadablePreferences(path, error) {
|
|
|
37157
37501
|
};
|
|
37158
37502
|
}
|
|
37159
37503
|
function cliUpdatePreferencesPath(homeDir2 = homedir10()) {
|
|
37160
|
-
return
|
|
37504
|
+
return join18(
|
|
37161
37505
|
homeDir2,
|
|
37162
37506
|
".local",
|
|
37163
37507
|
"deepline",
|
|
@@ -37167,9 +37511,9 @@ function cliUpdatePreferencesPath(homeDir2 = homedir10()) {
|
|
|
37167
37511
|
}
|
|
37168
37512
|
function readCliUpdatePreferences(homeDir2 = homedir10()) {
|
|
37169
37513
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
37170
|
-
if (!
|
|
37514
|
+
if (!existsSync16(path)) return defaultPreferences();
|
|
37171
37515
|
try {
|
|
37172
|
-
const parsed = JSON.parse(
|
|
37516
|
+
const parsed = JSON.parse(readFileSync17(path, "utf8"));
|
|
37173
37517
|
return {
|
|
37174
37518
|
schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
|
|
37175
37519
|
autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
|
|
@@ -37185,9 +37529,9 @@ function readCliUpdatePreferences(homeDir2 = homedir10()) {
|
|
|
37185
37529
|
function writeCliUpdatePreferences(preferences, homeDir2 = homedir10()) {
|
|
37186
37530
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
37187
37531
|
const tempPath = `${path}.${process.pid}.tmp`;
|
|
37188
|
-
|
|
37532
|
+
mkdirSync13(dirname17(path), { recursive: true });
|
|
37189
37533
|
try {
|
|
37190
|
-
|
|
37534
|
+
writeFileSync17(tempPath, `${JSON.stringify(preferences, null, 2)}
|
|
37191
37535
|
`, {
|
|
37192
37536
|
encoding: "utf8",
|
|
37193
37537
|
mode: 384
|
|
@@ -37245,29 +37589,29 @@ function consumePendingCliUpdateMessages(homeDir2 = homedir10()) {
|
|
|
37245
37589
|
// src/cli/commands/update.ts
|
|
37246
37590
|
import { spawn as spawn4, spawnSync as spawnSync3 } from "child_process";
|
|
37247
37591
|
import {
|
|
37248
|
-
existsSync as
|
|
37249
|
-
mkdirSync as
|
|
37592
|
+
existsSync as existsSync18,
|
|
37593
|
+
mkdirSync as mkdirSync14,
|
|
37250
37594
|
realpathSync as realpathSync5,
|
|
37251
|
-
readFileSync as
|
|
37595
|
+
readFileSync as readFileSync19,
|
|
37252
37596
|
renameSync as renameSync2,
|
|
37253
37597
|
rmSync as rmSync6,
|
|
37254
|
-
unlinkSync as
|
|
37255
|
-
writeFileSync as
|
|
37598
|
+
unlinkSync as unlinkSync3,
|
|
37599
|
+
writeFileSync as writeFileSync18
|
|
37256
37600
|
} from "fs";
|
|
37257
37601
|
import { homedir as homedir11 } from "os";
|
|
37258
37602
|
import {
|
|
37259
37603
|
basename as basename7,
|
|
37260
37604
|
dirname as dirname18,
|
|
37261
37605
|
isAbsolute as isAbsolute7,
|
|
37262
|
-
join as
|
|
37606
|
+
join as join20,
|
|
37263
37607
|
relative as relative7,
|
|
37264
37608
|
resolve as resolve18
|
|
37265
37609
|
} from "path";
|
|
37266
37610
|
|
|
37267
37611
|
// src/cli/install-integrity.ts
|
|
37268
37612
|
import { createRequire } from "module";
|
|
37269
|
-
import { existsSync as
|
|
37270
|
-
import { isAbsolute as isAbsolute6, join as
|
|
37613
|
+
import { existsSync as existsSync17, readFileSync as readFileSync18, statSync as statSync5 } from "fs";
|
|
37614
|
+
import { isAbsolute as isAbsolute6, join as join19, relative as relative6, resolve as resolve17 } from "path";
|
|
37271
37615
|
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
37272
37616
|
"dist/cli/index.mjs",
|
|
37273
37617
|
"dist/index.mjs",
|
|
@@ -37300,7 +37644,7 @@ function resolveContainedPath(root, value) {
|
|
|
37300
37644
|
return target;
|
|
37301
37645
|
}
|
|
37302
37646
|
function parseJson(path) {
|
|
37303
|
-
return JSON.parse(
|
|
37647
|
+
return JSON.parse(readFileSync18(path, "utf8"));
|
|
37304
37648
|
}
|
|
37305
37649
|
function isFile(path) {
|
|
37306
37650
|
try {
|
|
@@ -37310,7 +37654,7 @@ function isFile(path) {
|
|
|
37310
37654
|
}
|
|
37311
37655
|
}
|
|
37312
37656
|
function readManifest(packageRoot) {
|
|
37313
|
-
const packageJsonPath =
|
|
37657
|
+
const packageJsonPath = join19(packageRoot, "package.json");
|
|
37314
37658
|
let packageJson;
|
|
37315
37659
|
try {
|
|
37316
37660
|
packageJson = parseJson(packageJsonPath);
|
|
@@ -37318,7 +37662,7 @@ function readManifest(packageRoot) {
|
|
|
37318
37662
|
return {
|
|
37319
37663
|
mode: "manifest",
|
|
37320
37664
|
invalidReason: `invalid Deepline package metadata: ${error.message}`,
|
|
37321
|
-
missing:
|
|
37665
|
+
missing: existsSync17(packageJsonPath) ? [] : ["deepline/package.json"]
|
|
37322
37666
|
};
|
|
37323
37667
|
}
|
|
37324
37668
|
if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
|
|
@@ -37384,8 +37728,8 @@ function readManifest(packageRoot) {
|
|
|
37384
37728
|
return { mode: "manifest", manifest };
|
|
37385
37729
|
}
|
|
37386
37730
|
function inspectSdkSidecarInstall(versionDir) {
|
|
37387
|
-
const nodeModulesRoot =
|
|
37388
|
-
const packageRoot =
|
|
37731
|
+
const nodeModulesRoot = join19(versionDir, "node_modules");
|
|
37732
|
+
const packageRoot = join19(nodeModulesRoot, "deepline");
|
|
37389
37733
|
const manifestResult = readManifest(packageRoot);
|
|
37390
37734
|
if ("invalidReason" in manifestResult) {
|
|
37391
37735
|
return {
|
|
@@ -37396,8 +37740,8 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
37396
37740
|
};
|
|
37397
37741
|
}
|
|
37398
37742
|
const missing = [
|
|
37399
|
-
...manifestResult.manifest.packageFiles.filter((path) => !isFile(
|
|
37400
|
-
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(
|
|
37743
|
+
...manifestResult.manifest.packageFiles.filter((path) => !isFile(join19(packageRoot, path))).map((path) => `deepline/${path}`),
|
|
37744
|
+
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(join19(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
|
|
37401
37745
|
];
|
|
37402
37746
|
return {
|
|
37403
37747
|
ok: missing.length === 0,
|
|
@@ -37408,7 +37752,7 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
37408
37752
|
}
|
|
37409
37753
|
function probeSdkSidecarEsbuild(versionDir) {
|
|
37410
37754
|
try {
|
|
37411
|
-
const requireFromInstall = createRequire(
|
|
37755
|
+
const requireFromInstall = createRequire(join19(versionDir, "package.json"));
|
|
37412
37756
|
const esbuild = requireFromInstall("esbuild");
|
|
37413
37757
|
if (typeof esbuild.transformSync !== "function") {
|
|
37414
37758
|
return "esbuild does not export transformSync";
|
|
@@ -37483,7 +37827,7 @@ function sidecarStateDir(input2) {
|
|
|
37483
37827
|
if (!scope || scope.includes("/") || scope.includes("\\")) {
|
|
37484
37828
|
return null;
|
|
37485
37829
|
}
|
|
37486
|
-
return
|
|
37830
|
+
return join20(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
|
|
37487
37831
|
}
|
|
37488
37832
|
function sidecarRegistryUrl(hostUrl) {
|
|
37489
37833
|
let url;
|
|
@@ -37510,7 +37854,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
|
|
|
37510
37854
|
}
|
|
37511
37855
|
function readOptionalText(path) {
|
|
37512
37856
|
try {
|
|
37513
|
-
return
|
|
37857
|
+
return readFileSync19(path, "utf8").trim();
|
|
37514
37858
|
} catch {
|
|
37515
37859
|
return "";
|
|
37516
37860
|
}
|
|
@@ -37525,12 +37869,12 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
37525
37869
|
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint)) {
|
|
37526
37870
|
return null;
|
|
37527
37871
|
}
|
|
37528
|
-
const installMethod = readOptionalText(
|
|
37872
|
+
const installMethod = readOptionalText(join20(stateDir, ".install-method"));
|
|
37529
37873
|
if (installMethod !== "python-sidecar") return null;
|
|
37530
37874
|
const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
|
|
37531
37875
|
const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
|
|
37532
|
-
const nodeBin = readOptionalText(
|
|
37533
|
-
const sidecarPath = readOptionalText(
|
|
37876
|
+
const nodeBin = readOptionalText(join20(stateDir, ".node-bin")) || process.execPath;
|
|
37877
|
+
const sidecarPath = readOptionalText(join20(stateDir, ".command-path")) || join20(
|
|
37534
37878
|
stateDir,
|
|
37535
37879
|
"bin",
|
|
37536
37880
|
process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
|
|
@@ -37538,7 +37882,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
37538
37882
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
37539
37883
|
const npmCommand = "npm";
|
|
37540
37884
|
const registryUrl = sidecarRegistryUrl(hostUrl);
|
|
37541
|
-
const versionDir =
|
|
37885
|
+
const versionDir = join20(stateDir, "versions", "<version>");
|
|
37542
37886
|
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote4(versionDir)} --registry ${shellQuote4(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote4).join(" ")} ${shellQuote4(packageSpec)}`;
|
|
37543
37887
|
return {
|
|
37544
37888
|
kind: "python-sidecar",
|
|
@@ -37556,11 +37900,11 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
37556
37900
|
function findRepoBackedSdkRoot(startPath) {
|
|
37557
37901
|
let current = resolve18(startPath);
|
|
37558
37902
|
while (true) {
|
|
37559
|
-
if (
|
|
37903
|
+
if (existsSync18(join20(current, "package.json")) && existsSync18(join20(current, "bin", "deepline-dev.ts"))) {
|
|
37560
37904
|
const parent2 = dirname18(current);
|
|
37561
37905
|
return basename7(parent2) === "packages" && basename7(current) === "sdk" ? dirname18(parent2) : parent2;
|
|
37562
37906
|
}
|
|
37563
|
-
if (
|
|
37907
|
+
if (existsSync18(join20(current, "sdk", "package.json")) && existsSync18(join20(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
37564
37908
|
return current;
|
|
37565
37909
|
}
|
|
37566
37910
|
const parent = dirname18(current);
|
|
@@ -37588,7 +37932,7 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
|
|
|
37588
37932
|
const directPrefix = prefixParts.join("/").toLowerCase();
|
|
37589
37933
|
const knownWindowsPrefixes = [
|
|
37590
37934
|
env.npm_config_prefix,
|
|
37591
|
-
env.APPDATA ?
|
|
37935
|
+
env.APPDATA ? join20(env.APPDATA, "npm") : void 0
|
|
37592
37936
|
].filter((value) => Boolean(value)).map((value) => resolve18(value).replace(/\\/g, "/").toLowerCase());
|
|
37593
37937
|
if (!knownWindowsPrefixes.includes(
|
|
37594
37938
|
resolve18(directPrefix).replace(/\\/g, "/").toLowerCase()
|
|
@@ -37693,9 +38037,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
|
37693
38037
|
function autoUpdateFailurePath(plan) {
|
|
37694
38038
|
if (plan.kind === "source" || plan.kind === "homebrew") return null;
|
|
37695
38039
|
if (plan.kind === "python-sidecar") {
|
|
37696
|
-
return
|
|
38040
|
+
return join20(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
|
|
37697
38041
|
}
|
|
37698
|
-
return
|
|
38042
|
+
return join20(
|
|
37699
38043
|
homedir11(),
|
|
37700
38044
|
".local",
|
|
37701
38045
|
"deepline",
|
|
@@ -37713,7 +38057,7 @@ function readAutoUpdateFailure(plan) {
|
|
|
37713
38057
|
if (!path) return null;
|
|
37714
38058
|
try {
|
|
37715
38059
|
const parsed = JSON.parse(
|
|
37716
|
-
|
|
38060
|
+
readFileSync19(path, "utf8")
|
|
37717
38061
|
);
|
|
37718
38062
|
if ((parsed.kind === "npm-global" || parsed.kind === "python-sidecar") && typeof parsed.packageSpec === "string" && typeof parsed.failedAt === "string" && typeof parsed.exitCode === "number" && typeof parsed.manualCommand === "string") {
|
|
37719
38063
|
return parsed;
|
|
@@ -37734,8 +38078,8 @@ function writeAutoUpdateFailure(plan, exitCode) {
|
|
|
37734
38078
|
manualCommand: plan.manualCommand
|
|
37735
38079
|
};
|
|
37736
38080
|
try {
|
|
37737
|
-
|
|
37738
|
-
|
|
38081
|
+
mkdirSync14(dirname18(path), { recursive: true });
|
|
38082
|
+
writeFileSync18(path, `${JSON.stringify(marker, null, 2)}
|
|
37739
38083
|
`, "utf8");
|
|
37740
38084
|
} catch {
|
|
37741
38085
|
}
|
|
@@ -37744,7 +38088,7 @@ function clearAutoUpdateFailure(plan) {
|
|
|
37744
38088
|
const path = autoUpdateFailurePath(plan);
|
|
37745
38089
|
if (!path) return;
|
|
37746
38090
|
try {
|
|
37747
|
-
|
|
38091
|
+
unlinkSync3(path);
|
|
37748
38092
|
} catch {
|
|
37749
38093
|
}
|
|
37750
38094
|
}
|
|
@@ -37782,7 +38126,7 @@ function safeVersionSegment(value) {
|
|
|
37782
38126
|
return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
|
|
37783
38127
|
}
|
|
37784
38128
|
function entryPathInVersionDir(versionDir) {
|
|
37785
|
-
return
|
|
38129
|
+
return join20(
|
|
37786
38130
|
versionDir,
|
|
37787
38131
|
"node_modules",
|
|
37788
38132
|
"deepline",
|
|
@@ -37792,14 +38136,14 @@ function entryPathInVersionDir(versionDir) {
|
|
|
37792
38136
|
);
|
|
37793
38137
|
}
|
|
37794
38138
|
function installedPackageVersion(versionDir) {
|
|
37795
|
-
const packageJsonPath =
|
|
38139
|
+
const packageJsonPath = join20(
|
|
37796
38140
|
versionDir,
|
|
37797
38141
|
"node_modules",
|
|
37798
38142
|
"deepline",
|
|
37799
38143
|
"package.json"
|
|
37800
38144
|
);
|
|
37801
38145
|
try {
|
|
37802
|
-
const parsed = JSON.parse(
|
|
38146
|
+
const parsed = JSON.parse(readFileSync19(packageJsonPath, "utf8"));
|
|
37803
38147
|
return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
|
|
37804
38148
|
} catch {
|
|
37805
38149
|
return "";
|
|
@@ -37914,20 +38258,20 @@ async function runNpmInstallWithRegistryFallback(input2) {
|
|
|
37914
38258
|
return first.exitCode;
|
|
37915
38259
|
}
|
|
37916
38260
|
function writeSidecarLauncher(input2) {
|
|
37917
|
-
|
|
38261
|
+
mkdirSync14(dirname18(input2.path), { recursive: true });
|
|
37918
38262
|
const packageRoot = dirname18(dirname18(dirname18(input2.entryPath)));
|
|
37919
38263
|
const versionDir = dirname18(dirname18(packageRoot));
|
|
37920
38264
|
const esbuildProbe = "const {createRequire}=require('node:module');const path=require('node:path');const req=createRequire(path.join(process.argv[1],'package.json'));const result=req('esbuild').transformSync('const value: number = 1;',{loader:'ts'});if(!result||typeof result.code!=='string')process.exit(3);";
|
|
37921
38265
|
const criticalPaths = [
|
|
37922
38266
|
...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
|
|
37923
|
-
(path) =>
|
|
38267
|
+
(path) => join20(packageRoot, path)
|
|
37924
38268
|
),
|
|
37925
38269
|
...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
|
|
37926
|
-
(path) =>
|
|
38270
|
+
(path) => join20(versionDir, "node_modules", path)
|
|
37927
38271
|
)
|
|
37928
38272
|
];
|
|
37929
38273
|
if (process.platform === "win32") {
|
|
37930
|
-
|
|
38274
|
+
writeFileSync18(
|
|
37931
38275
|
input2.path,
|
|
37932
38276
|
[
|
|
37933
38277
|
`@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
|
|
@@ -37950,7 +38294,7 @@ function writeSidecarLauncher(input2) {
|
|
|
37950
38294
|
);
|
|
37951
38295
|
return;
|
|
37952
38296
|
}
|
|
37953
|
-
|
|
38297
|
+
writeFileSync18(
|
|
37954
38298
|
input2.path,
|
|
37955
38299
|
[
|
|
37956
38300
|
"#!/usr/bin/env sh",
|
|
@@ -37977,14 +38321,14 @@ function writeSidecarLauncher(input2) {
|
|
|
37977
38321
|
);
|
|
37978
38322
|
}
|
|
37979
38323
|
async function runPythonSidecarUpdatePlan(plan) {
|
|
37980
|
-
const versionsDir =
|
|
37981
|
-
const tempDir =
|
|
38324
|
+
const versionsDir = join20(plan.stateDir, "versions");
|
|
38325
|
+
const tempDir = join20(
|
|
37982
38326
|
versionsDir,
|
|
37983
38327
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
37984
38328
|
);
|
|
37985
38329
|
rmSync6(tempDir, { recursive: true, force: true });
|
|
37986
|
-
|
|
37987
|
-
|
|
38330
|
+
mkdirSync14(tempDir, { recursive: true });
|
|
38331
|
+
writeFileSync18(join20(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
37988
38332
|
const env = {
|
|
37989
38333
|
...process.env,
|
|
37990
38334
|
PATH: `${dirname18(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
|
|
@@ -38024,7 +38368,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38024
38368
|
rmSync6(tempDir, { recursive: true, force: true });
|
|
38025
38369
|
return 1;
|
|
38026
38370
|
}
|
|
38027
|
-
const finalDir =
|
|
38371
|
+
const finalDir = join20(versionsDir, installedVersion);
|
|
38028
38372
|
const finalEntryPath = entryPathInVersionDir(finalDir);
|
|
38029
38373
|
const finalFailure = sidecarInstallFailure(finalDir);
|
|
38030
38374
|
let backupDir = null;
|
|
@@ -38032,8 +38376,8 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38032
38376
|
rmSync6(tempDir, { recursive: true, force: true });
|
|
38033
38377
|
} else {
|
|
38034
38378
|
let shouldPublishTemp = true;
|
|
38035
|
-
if (
|
|
38036
|
-
backupDir =
|
|
38379
|
+
if (existsSync18(finalDir)) {
|
|
38380
|
+
backupDir = join20(
|
|
38037
38381
|
versionsDir,
|
|
38038
38382
|
`.backup-${installedVersion}-${process.pid}-${Date.now()}`
|
|
38039
38383
|
);
|
|
@@ -38066,7 +38410,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38066
38410
|
backupDir = null;
|
|
38067
38411
|
} else {
|
|
38068
38412
|
let restoreFailure = "";
|
|
38069
|
-
if (backupDir &&
|
|
38413
|
+
if (backupDir && existsSync18(backupDir) && !existsSync18(finalDir)) {
|
|
38070
38414
|
try {
|
|
38071
38415
|
renameSync2(backupDir, finalDir);
|
|
38072
38416
|
backupDir = null;
|
|
@@ -38085,7 +38429,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38085
38429
|
}
|
|
38086
38430
|
const publishedFailure = sidecarStructureFailure(finalDir);
|
|
38087
38431
|
if (publishedFailure) {
|
|
38088
|
-
if (backupDir &&
|
|
38432
|
+
if (backupDir && existsSync18(backupDir)) {
|
|
38089
38433
|
rmSync6(finalDir, { recursive: true, force: true });
|
|
38090
38434
|
try {
|
|
38091
38435
|
renameSync2(backupDir, finalDir);
|
|
@@ -38107,28 +38451,28 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
38107
38451
|
nodeBin: plan.nodeBin,
|
|
38108
38452
|
entryPath: finalEntryPath
|
|
38109
38453
|
});
|
|
38110
|
-
|
|
38111
|
-
|
|
38454
|
+
writeFileSync18(
|
|
38455
|
+
join20(plan.stateDir, ".version"),
|
|
38112
38456
|
`${installedVersion}
|
|
38113
38457
|
`,
|
|
38114
38458
|
"utf8"
|
|
38115
38459
|
);
|
|
38116
|
-
|
|
38117
|
-
|
|
38460
|
+
writeFileSync18(
|
|
38461
|
+
join20(plan.stateDir, ".install-method"),
|
|
38118
38462
|
"python-sidecar\n",
|
|
38119
38463
|
"utf8"
|
|
38120
38464
|
);
|
|
38121
|
-
|
|
38122
|
-
|
|
38465
|
+
writeFileSync18(
|
|
38466
|
+
join20(plan.stateDir, ".command-path"),
|
|
38123
38467
|
`${plan.sidecarPath}
|
|
38124
38468
|
`,
|
|
38125
38469
|
"utf8"
|
|
38126
38470
|
);
|
|
38127
|
-
|
|
38128
|
-
|
|
38471
|
+
writeFileSync18(join20(plan.stateDir, ".runner"), "node\n", "utf8");
|
|
38472
|
+
writeFileSync18(join20(plan.stateDir, ".node-bin"), `${plan.nodeBin}
|
|
38129
38473
|
`, "utf8");
|
|
38130
|
-
|
|
38131
|
-
|
|
38474
|
+
writeFileSync18(
|
|
38475
|
+
join20(plan.stateDir, ".entry-path"),
|
|
38132
38476
|
`${finalEntryPath}
|
|
38133
38477
|
`,
|
|
38134
38478
|
"utf8"
|
|
@@ -39057,24 +39401,24 @@ chooses the connected Slack channel or member and the events it receives.
|
|
|
39057
39401
|
import { Option as Option2 } from "commander";
|
|
39058
39402
|
import {
|
|
39059
39403
|
chmodSync,
|
|
39060
|
-
existsSync as
|
|
39404
|
+
existsSync as existsSync19,
|
|
39061
39405
|
mkdtempSync,
|
|
39062
|
-
readFileSync as
|
|
39063
|
-
writeFileSync as
|
|
39406
|
+
readFileSync as readFileSync20,
|
|
39407
|
+
writeFileSync as writeFileSync20
|
|
39064
39408
|
} from "fs";
|
|
39065
39409
|
import { tmpdir as tmpdir5 } from "os";
|
|
39066
|
-
import { join as
|
|
39410
|
+
import { join as join22, resolve as resolve19 } from "path";
|
|
39067
39411
|
|
|
39068
39412
|
// src/tool-output.ts
|
|
39069
39413
|
import {
|
|
39070
39414
|
closeSync as closeSync3,
|
|
39071
|
-
mkdirSync as
|
|
39415
|
+
mkdirSync as mkdirSync15,
|
|
39072
39416
|
openSync as openSync3,
|
|
39073
|
-
writeFileSync as
|
|
39417
|
+
writeFileSync as writeFileSync19,
|
|
39074
39418
|
writeSync
|
|
39075
39419
|
} from "fs";
|
|
39076
39420
|
import { homedir as homedir12 } from "os";
|
|
39077
|
-
import { dirname as dirname19, join as
|
|
39421
|
+
import { dirname as dirname19, join as join21 } from "path";
|
|
39078
39422
|
function isPlainObject(value) {
|
|
39079
39423
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
39080
39424
|
}
|
|
@@ -39201,19 +39545,19 @@ function projectRowOutput(conversion) {
|
|
|
39201
39545
|
};
|
|
39202
39546
|
}
|
|
39203
39547
|
function ensureOutputDir() {
|
|
39204
|
-
const outputDir =
|
|
39205
|
-
|
|
39548
|
+
const outputDir = join21(homedir12(), ".local", "share", "deepline", "data");
|
|
39549
|
+
mkdirSync15(outputDir, { recursive: true });
|
|
39206
39550
|
return outputDir;
|
|
39207
39551
|
}
|
|
39208
39552
|
function writeJsonOutputFile(payload, stem) {
|
|
39209
39553
|
const outputDir = ensureOutputDir();
|
|
39210
|
-
const outputPath =
|
|
39211
|
-
|
|
39554
|
+
const outputPath = join21(outputDir, `${stem}_${Date.now()}.json`);
|
|
39555
|
+
writeFileSync19(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
39212
39556
|
return outputPath;
|
|
39213
39557
|
}
|
|
39214
39558
|
function writeCsvOutputFile(rows, stem, options) {
|
|
39215
|
-
const outputPath = options?.outPath ? options.outPath :
|
|
39216
|
-
|
|
39559
|
+
const outputPath = options?.outPath ? options.outPath : join21(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
|
|
39560
|
+
mkdirSync15(dirname19(outputPath), { recursive: true });
|
|
39217
39561
|
const columns = columnsForRows(rows);
|
|
39218
39562
|
const escapeCell = (value) => {
|
|
39219
39563
|
const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
|
|
@@ -41174,10 +41518,10 @@ function normalizeOutputFormat(raw) {
|
|
|
41174
41518
|
function resolveAtFilePath(rawPath) {
|
|
41175
41519
|
const trimmed = rawPath.trim();
|
|
41176
41520
|
const resolved = resolve19(trimmed);
|
|
41177
|
-
if (
|
|
41521
|
+
if (existsSync19(resolved)) return resolved;
|
|
41178
41522
|
if (process.platform !== "win32" && trimmed.includes("\\")) {
|
|
41179
41523
|
const normalized = resolve19(trimmed.replace(/\\/g, "/"));
|
|
41180
|
-
if (
|
|
41524
|
+
if (existsSync19(normalized)) return normalized;
|
|
41181
41525
|
}
|
|
41182
41526
|
return resolved;
|
|
41183
41527
|
}
|
|
@@ -41188,7 +41532,7 @@ function readJsonArgument(raw, flagName) {
|
|
|
41188
41532
|
throw new Error(`Invalid ${flagName} value: empty @file path.`);
|
|
41189
41533
|
}
|
|
41190
41534
|
try {
|
|
41191
|
-
return
|
|
41535
|
+
return readFileSync20(resolveAtFilePath(filePath), "utf8").replace(
|
|
41192
41536
|
/^\uFEFF/,
|
|
41193
41537
|
""
|
|
41194
41538
|
);
|
|
@@ -41295,9 +41639,9 @@ function starterScriptJson(script) {
|
|
|
41295
41639
|
function seedToolListScript(input2) {
|
|
41296
41640
|
const stem = safeFileStem(input2.toolId);
|
|
41297
41641
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
41298
|
-
const scriptDir = mkdtempSync(
|
|
41642
|
+
const scriptDir = mkdtempSync(join22(tmpdir5(), "deepline-workflow-seed-"));
|
|
41299
41643
|
chmodSync(scriptDir, 448);
|
|
41300
|
-
const scriptPath =
|
|
41644
|
+
const scriptPath = join22(scriptDir, fileName);
|
|
41301
41645
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
41302
41646
|
const playName = `${stem}-workflow`;
|
|
41303
41647
|
const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
|
|
@@ -41340,7 +41684,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
41340
41684
|
description: ${JSON.stringify(`Seed ${input2.toolId} rows into a Deepline workflow-ready dataset.`)},
|
|
41341
41685
|
});
|
|
41342
41686
|
`;
|
|
41343
|
-
|
|
41687
|
+
writeFileSync20(scriptPath, script, { encoding: "utf-8", mode: 384 });
|
|
41344
41688
|
return {
|
|
41345
41689
|
path: scriptPath,
|
|
41346
41690
|
sourceCode: script,
|
|
@@ -41766,10 +42110,10 @@ Examples:
|
|
|
41766
42110
|
|
|
41767
42111
|
// src/cli/commands/workflow.ts
|
|
41768
42112
|
import { mkdir as mkdir5, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
|
|
41769
|
-
import { dirname as dirname20, join as
|
|
42113
|
+
import { dirname as dirname20, join as join23, resolve as resolve20 } from "path";
|
|
41770
42114
|
|
|
41771
42115
|
// src/cli/workflow-to-play.ts
|
|
41772
|
-
import { createHash as
|
|
42116
|
+
import { createHash as createHash6 } from "crypto";
|
|
41773
42117
|
var HITL_WAIT_FOR_SIGNAL_TOOL = "deepline_workflow_wait_for_signal";
|
|
41774
42118
|
var HITL_SLACK_TOOL = "slack_message_with_hitl";
|
|
41775
42119
|
var SUB_WORKFLOW_TOOL_PREFIX = "deepline_workflow_";
|
|
@@ -41875,7 +42219,7 @@ function sanitizePlayNameSegment(value) {
|
|
|
41875
42219
|
}
|
|
41876
42220
|
function deriveWorkflowPlayName(workflowName) {
|
|
41877
42221
|
const base = sanitizePlayNameSegment(workflowName) || "workflow";
|
|
41878
|
-
const suffix =
|
|
42222
|
+
const suffix = createHash6("sha256").update(workflowName).digest("hex").slice(0, 8);
|
|
41879
42223
|
const reserved = suffix.length + 1;
|
|
41880
42224
|
const allowedBase = Math.max(1, MAX_PLAY_NAME_LENGTH - reserved);
|
|
41881
42225
|
let name = `${base.slice(0, allowedBase)}_${suffix}`;
|
|
@@ -42017,7 +42361,7 @@ async function transformOne(api, workflowId, outDir, publish) {
|
|
|
42017
42361
|
revision.config,
|
|
42018
42362
|
{ workflowName: workflow.name, version: revision.version }
|
|
42019
42363
|
);
|
|
42020
|
-
const file =
|
|
42364
|
+
const file = join23(resolve20(outDir), `${compiled.playName}.play.ts`);
|
|
42021
42365
|
await mkdir5(dirname20(file), { recursive: true });
|
|
42022
42366
|
await writeFile5(file, compiled.sourceCode, "utf8");
|
|
42023
42367
|
let published = false;
|
|
@@ -42650,8 +42994,8 @@ function topLevelCommandKnown(program, commandName) {
|
|
|
42650
42994
|
);
|
|
42651
42995
|
}
|
|
42652
42996
|
async function runPlayRunnerHealthCheck() {
|
|
42653
|
-
const dir = await mkdtemp2(
|
|
42654
|
-
const file =
|
|
42997
|
+
const dir = await mkdtemp2(join24(tmpdir6(), "deepline-health-play-"));
|
|
42998
|
+
const file = join24(dir, "health-check.play.ts");
|
|
42655
42999
|
try {
|
|
42656
43000
|
await writeFile6(
|
|
42657
43001
|
file,
|