deepline 0.1.7 → 0.1.9

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.
@@ -169,10 +169,11 @@ function resolveConfig(options) {
169
169
  }
170
170
 
171
171
  // src/version.ts
172
- var SDK_VERSION = "0.1.7";
172
+ var SDK_VERSION = "0.1.9";
173
173
  var SDK_API_CONTRACT = "2026-04-plays-v1";
174
174
 
175
175
  // ../shared_libs/play-runtime/coordinator-headers.ts
176
+ var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
176
177
  var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
177
178
  var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
178
179
 
@@ -201,6 +202,10 @@ var HttpClient = class {
201
202
  const coordinatorUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_COORDINATOR_URL : void 0;
202
203
  if (coordinatorUrl?.trim()) {
203
204
  headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
205
+ const coordinatorInternalToken = typeof process !== "undefined" ? process.env?.DEEPLINE_INTERNAL_TOKEN : void 0;
206
+ if (coordinatorInternalToken?.trim()) {
207
+ headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
208
+ }
204
209
  }
205
210
  const workerCallbackUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_WORKER_CALLBACK_URL : void 0;
206
211
  if (workerCallbackUrl?.trim()) {
@@ -3820,6 +3825,21 @@ var CliProgress = class {
3820
3825
  this.worker?.terminate().catch(() => void 0);
3821
3826
  this.worker = null;
3822
3827
  process.stderr.write(`\r\x1B[2K${message}
3828
+ `);
3829
+ if (activeMessage) {
3830
+ this.startWorker().postMessage({ type: "phase", message: activeMessage });
3831
+ }
3832
+ }
3833
+ writeLine(line, stream = process.stderr) {
3834
+ if (!this.enabled || !this.interactive) {
3835
+ stream.write(`${line}
3836
+ `);
3837
+ return;
3838
+ }
3839
+ const activeMessage = this.lastMessage;
3840
+ this.worker?.terminate().catch(() => void 0);
3841
+ this.worker = null;
3842
+ stream.write(`\r\x1B[2K${line}
3823
3843
  `);
3824
3844
  if (activeMessage) {
3825
3845
  this.startWorker().postMessage({ type: "phase", message: activeMessage });
@@ -4569,9 +4589,16 @@ async function startAndWaitForPlayCompletionByStream(input) {
4569
4589
  const workflowId = lastKnownWorkflowId || "pending";
4570
4590
  if (workflowId !== "pending" && !emittedDashboardUrl) {
4571
4591
  const dashboardUrl = getDashboardUrlFromLiveEvent(event) ?? buildPlayDashboardUrl(input.client.baseUrl, input.playName);
4572
- input.progress.phase(
4573
- `loading play on ${dashboardUrl}`
4574
- );
4592
+ if (!input.jsonOutput) {
4593
+ writeStartedPlayRun({
4594
+ runId: workflowId,
4595
+ playName: input.playName,
4596
+ dashboardUrl,
4597
+ jsonOutput: false,
4598
+ progress: input.progress
4599
+ });
4600
+ }
4601
+ input.progress.phase(`loading play on ${dashboardUrl}`);
4575
4602
  emittedDashboardUrl = true;
4576
4603
  }
4577
4604
  assertPlayWaitNotTimedOut({
@@ -4682,9 +4709,8 @@ async function waitForPlayCompletionByPolling(input) {
4682
4709
  const now = Date.now();
4683
4710
  if (now - lastTransientPollWarningAt >= 3e4) {
4684
4711
  const message = error instanceof Error ? error.message : String(error);
4685
- process.stderr.write(
4686
- `[play tail] transient status poll failed; retrying: ${message}
4687
- `
4712
+ input.progress.writeLine(
4713
+ `[play tail] transient status poll failed; retrying: ${message}`
4688
4714
  );
4689
4715
  lastTransientPollWarningAt = now;
4690
4716
  }
@@ -5074,7 +5100,12 @@ function writeStartedPlayRun(input) {
5074
5100
  if (input.dashboardUrl) {
5075
5101
  lines.push(` play page: ${input.dashboardUrl}`);
5076
5102
  }
5077
- console.log(lines.join("\n"));
5103
+ const output = lines.join("\n");
5104
+ if (input.progress) {
5105
+ input.progress.writeLine(output, process.stdout);
5106
+ return;
5107
+ }
5108
+ console.log(output);
5078
5109
  }
5079
5110
  function parsePlayRunOptions(args) {
5080
5111
  const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--csv file.csv] [--live|--latest|--revision-id <id>] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force]\n deepline plays run <play-file.ts> [--input '{...}'] [--csv file.csv] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--csv file.csv] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force]\n deepline plays run --name <name> [--input '{...}'] [--csv file.csv] [--live|--latest|--revision-id <id>] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--json]";
@@ -5393,7 +5424,8 @@ async function handleFileBackedRun(options) {
5393
5424
  status: started.status,
5394
5425
  statusUrl: started.statusUrl,
5395
5426
  dashboardUrl,
5396
- jsonOutput: options.jsonOutput
5427
+ jsonOutput: options.jsonOutput,
5428
+ progress
5397
5429
  });
5398
5430
  return 0;
5399
5431
  }
@@ -5493,7 +5525,8 @@ async function handleNamedRun(options) {
5493
5525
  status: started.status,
5494
5526
  statusUrl: started.statusUrl,
5495
5527
  dashboardUrl,
5496
- jsonOutput: options.jsonOutput
5528
+ jsonOutput: options.jsonOutput,
5529
+ progress
5497
5530
  });
5498
5531
  return 0;
5499
5532
  }
@@ -7079,11 +7112,12 @@ async function syncSdkSkillsIfNeeded(baseUrl) {
7079
7112
  const localVersion = readLocalSkillsVersion(baseUrl);
7080
7113
  const update = await fetchSkillsUpdate(baseUrl, localVersion);
7081
7114
  if (!update?.needsUpdate || !update.remoteVersion) return;
7082
- process.stderr.write("SDK skills changed; syncing deepline-sdk skill...\n");
7115
+ const progress = getActiveCliProgress();
7116
+ progress?.writeLine("SDK skills changed; syncing deepline-sdk skill...") ?? process.stderr.write("SDK skills changed; syncing deepline-sdk skill...\n");
7083
7117
  const installed = await runSkillsInstall(baseUrl);
7084
7118
  if (!installed) return;
7085
7119
  writeLocalSkillsVersion(baseUrl, update.remoteVersion);
7086
- process.stderr.write("SDK skills are up to date.\n");
7120
+ progress?.writeLine("SDK skills are up to date.") ?? process.stderr.write("SDK skills are up to date.\n");
7087
7121
  }
7088
7122
 
7089
7123
  // src/cli/index.ts