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.
package/dist/cli/index.js CHANGED
@@ -192,10 +192,11 @@ function resolveConfig(options) {
192
192
  }
193
193
 
194
194
  // src/version.ts
195
- var SDK_VERSION = "0.1.7";
195
+ var SDK_VERSION = "0.1.9";
196
196
  var SDK_API_CONTRACT = "2026-04-plays-v1";
197
197
 
198
198
  // ../shared_libs/play-runtime/coordinator-headers.ts
199
+ var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
199
200
  var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
200
201
  var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
201
202
 
@@ -224,6 +225,10 @@ var HttpClient = class {
224
225
  const coordinatorUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_COORDINATOR_URL : void 0;
225
226
  if (coordinatorUrl?.trim()) {
226
227
  headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
228
+ const coordinatorInternalToken = typeof process !== "undefined" ? process.env?.DEEPLINE_INTERNAL_TOKEN : void 0;
229
+ if (coordinatorInternalToken?.trim()) {
230
+ headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
231
+ }
227
232
  }
228
233
  const workerCallbackUrl = typeof process !== "undefined" ? process.env?.DEEPLINE_WORKER_CALLBACK_URL : void 0;
229
234
  if (workerCallbackUrl?.trim()) {
@@ -3838,6 +3843,21 @@ var CliProgress = class {
3838
3843
  this.worker?.terminate().catch(() => void 0);
3839
3844
  this.worker = null;
3840
3845
  process.stderr.write(`\r\x1B[2K${message}
3846
+ `);
3847
+ if (activeMessage) {
3848
+ this.startWorker().postMessage({ type: "phase", message: activeMessage });
3849
+ }
3850
+ }
3851
+ writeLine(line, stream = process.stderr) {
3852
+ if (!this.enabled || !this.interactive) {
3853
+ stream.write(`${line}
3854
+ `);
3855
+ return;
3856
+ }
3857
+ const activeMessage = this.lastMessage;
3858
+ this.worker?.terminate().catch(() => void 0);
3859
+ this.worker = null;
3860
+ stream.write(`\r\x1B[2K${line}
3841
3861
  `);
3842
3862
  if (activeMessage) {
3843
3863
  this.startWorker().postMessage({ type: "phase", message: activeMessage });
@@ -4587,9 +4607,16 @@ async function startAndWaitForPlayCompletionByStream(input) {
4587
4607
  const workflowId = lastKnownWorkflowId || "pending";
4588
4608
  if (workflowId !== "pending" && !emittedDashboardUrl) {
4589
4609
  const dashboardUrl = getDashboardUrlFromLiveEvent(event) ?? buildPlayDashboardUrl(input.client.baseUrl, input.playName);
4590
- input.progress.phase(
4591
- `loading play on ${dashboardUrl}`
4592
- );
4610
+ if (!input.jsonOutput) {
4611
+ writeStartedPlayRun({
4612
+ runId: workflowId,
4613
+ playName: input.playName,
4614
+ dashboardUrl,
4615
+ jsonOutput: false,
4616
+ progress: input.progress
4617
+ });
4618
+ }
4619
+ input.progress.phase(`loading play on ${dashboardUrl}`);
4593
4620
  emittedDashboardUrl = true;
4594
4621
  }
4595
4622
  assertPlayWaitNotTimedOut({
@@ -4700,9 +4727,8 @@ async function waitForPlayCompletionByPolling(input) {
4700
4727
  const now = Date.now();
4701
4728
  if (now - lastTransientPollWarningAt >= 3e4) {
4702
4729
  const message = error instanceof Error ? error.message : String(error);
4703
- process.stderr.write(
4704
- `[play tail] transient status poll failed; retrying: ${message}
4705
- `
4730
+ input.progress.writeLine(
4731
+ `[play tail] transient status poll failed; retrying: ${message}`
4706
4732
  );
4707
4733
  lastTransientPollWarningAt = now;
4708
4734
  }
@@ -5092,7 +5118,12 @@ function writeStartedPlayRun(input) {
5092
5118
  if (input.dashboardUrl) {
5093
5119
  lines.push(` play page: ${input.dashboardUrl}`);
5094
5120
  }
5095
- console.log(lines.join("\n"));
5121
+ const output = lines.join("\n");
5122
+ if (input.progress) {
5123
+ input.progress.writeLine(output, process.stdout);
5124
+ return;
5125
+ }
5126
+ console.log(output);
5096
5127
  }
5097
5128
  function parsePlayRunOptions(args) {
5098
5129
  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]";
@@ -5411,7 +5442,8 @@ async function handleFileBackedRun(options) {
5411
5442
  status: started.status,
5412
5443
  statusUrl: started.statusUrl,
5413
5444
  dashboardUrl,
5414
- jsonOutput: options.jsonOutput
5445
+ jsonOutput: options.jsonOutput,
5446
+ progress
5415
5447
  });
5416
5448
  return 0;
5417
5449
  }
@@ -5511,7 +5543,8 @@ async function handleNamedRun(options) {
5511
5543
  status: started.status,
5512
5544
  statusUrl: started.statusUrl,
5513
5545
  dashboardUrl,
5514
- jsonOutput: options.jsonOutput
5546
+ jsonOutput: options.jsonOutput,
5547
+ progress
5515
5548
  });
5516
5549
  return 0;
5517
5550
  }
@@ -7097,11 +7130,12 @@ async function syncSdkSkillsIfNeeded(baseUrl) {
7097
7130
  const localVersion = readLocalSkillsVersion(baseUrl);
7098
7131
  const update = await fetchSkillsUpdate(baseUrl, localVersion);
7099
7132
  if (!update?.needsUpdate || !update.remoteVersion) return;
7100
- process.stderr.write("SDK skills changed; syncing deepline-sdk skill...\n");
7133
+ const progress = getActiveCliProgress();
7134
+ progress?.writeLine("SDK skills changed; syncing deepline-sdk skill...") ?? process.stderr.write("SDK skills changed; syncing deepline-sdk skill...\n");
7101
7135
  const installed = await runSkillsInstall(baseUrl);
7102
7136
  if (!installed) return;
7103
7137
  writeLocalSkillsVersion(baseUrl, update.remoteVersion);
7104
- process.stderr.write("SDK skills are up to date.\n");
7138
+ progress?.writeLine("SDK skills are up to date.") ?? process.stderr.write("SDK skills are up to date.\n");
7105
7139
  }
7106
7140
 
7107
7141
  // src/cli/index.ts