deepline 0.1.263 → 0.1.265

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
@@ -716,8 +716,10 @@ var SDK_RELEASE = {
716
716
  // Deepline-native radars. Older clients must update before discovering,
717
717
  // checking, or deploying an unlaunched monitor integration.
718
718
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
719
- version: "0.1.263",
720
- apiContract: "2026-07-native-monitor-launch-hard-cutover",
719
+ // 0.1.254 removes the internal operations tree from the published SDK CLI.
720
+ // Operators use the checkout-local deepline-admin binary instead.
721
+ version: "0.1.265",
722
+ apiContract: "2026-07-admin-cli-local-cutover",
721
723
  supportPolicy: {
722
724
  minimumSupported: "0.1.53",
723
725
  deprecatedBelow: "0.1.219",
@@ -2183,10 +2185,10 @@ var OBSERVER_LOG_PAGE_QUERY = "runObservers:getRunLogPageForObserver";
2183
2185
  function errorText(error) {
2184
2186
  return error instanceof Error ? error.message : String(error);
2185
2187
  }
2186
- async function mintRunObserveGrant(http2, runId) {
2188
+ async function mintRunObserveGrant(http, runId) {
2187
2189
  let response;
2188
2190
  try {
2189
- response = await http2.post(
2191
+ response = await http.post(
2190
2192
  `/api/v2/runs/${encodeURIComponent(runId)}/observe-grant`,
2191
2193
  {}
2192
2194
  );
@@ -2250,8 +2252,8 @@ async function backfillLogGap(input2) {
2250
2252
  return lines;
2251
2253
  }
2252
2254
  async function* observeRunEvents(options) {
2253
- const { http: http2, runId } = options;
2254
- let grant = await mintRunObserveGrant(http2, runId);
2255
+ const { http, runId } = options;
2256
+ let grant = await mintRunObserveGrant(http, runId);
2255
2257
  let convexBrowser;
2256
2258
  let convexServer;
2257
2259
  try {
@@ -2314,7 +2316,7 @@ async function* observeRunEvents(options) {
2314
2316
  lastForcedRefreshAt = now;
2315
2317
  }
2316
2318
  try {
2317
- grant = await mintRunObserveGrant(http2, runId);
2319
+ grant = await mintRunObserveGrant(http, runId);
2318
2320
  return grant.token;
2319
2321
  } catch (error) {
2320
2322
  push({ kind: "error", error });
@@ -3066,6 +3068,9 @@ var DeeplineClient = class {
3066
3068
  if (options?.categories?.trim()) {
3067
3069
  params.set("categories", options.categories.trim());
3068
3070
  }
3071
+ if (options?.tags?.trim()) {
3072
+ params.set("tags", options.tags.trim());
3073
+ }
3069
3074
  if (options?.grep?.trim()) {
3070
3075
  params.set("grep", options.grep.trim());
3071
3076
  params.set("grep_mode", options.grepMode ?? "all");
@@ -4945,6 +4950,11 @@ function enforceSdkCompatibilityResponse(response) {
4945
4950
  }
4946
4951
  }
4947
4952
 
4953
+ // src/cli/commands/auth.ts
4954
+ var import_node_fs5 = require("fs");
4955
+ var import_node_os6 = require("os");
4956
+ var import_node_path5 = require("path");
4957
+
4948
4958
  // src/cli/utils.ts
4949
4959
  var import_node_crypto = require("crypto");
4950
4960
  var import_node_fs4 = require("fs");
@@ -5543,6 +5553,7 @@ function errorToJsonPayload(error) {
5543
5553
  const maybeRecord = error && typeof error === "object" ? error : null;
5544
5554
  const code = typeof maybeRecord?.code === "string" ? maybeRecord.code : error instanceof SyntaxError ? "INVALID_JSON" : "CLI_ERROR";
5545
5555
  const details = {};
5556
+ const exitCode = typeof maybeRecord?.exitCode === "number" ? maybeRecord.exitCode : void 0;
5546
5557
  if (typeof maybeRecord?.statusCode === "number") {
5547
5558
  details.statusCode = maybeRecord.statusCode;
5548
5559
  }
@@ -5557,6 +5568,7 @@ function errorToJsonPayload(error) {
5557
5568
  }
5558
5569
  return {
5559
5570
  ok: false,
5571
+ ...exitCode !== void 0 ? { exitCode } : {},
5560
5572
  error: {
5561
5573
  message,
5562
5574
  code,
@@ -5620,139 +5632,7 @@ function printCommandEnvelope(envelope, options = {}) {
5620
5632
  process.stdout.write(options.text ?? renderCommandEnvelopeText(envelope));
5621
5633
  }
5622
5634
 
5623
- // src/cli/commands/admin.ts
5624
- function laneStatusLine(input2) {
5625
- if (input2.lane) {
5626
- return `status: ${input2.lane.status}${input2.lane.active ? " (active)" : ""}`;
5627
- }
5628
- return input2.registration ? `status: ${input2.registration.status}` : "status: (not in registry)";
5629
- }
5630
- function normalizeEnvironment(value) {
5631
- const trimmed = value?.trim().toLowerCase();
5632
- if (!trimmed || trimmed === "production" || trimmed === "prod") {
5633
- return "production";
5634
- }
5635
- if (trimmed === "preview") return "preview";
5636
- throw new Error(
5637
- `Invalid --environment "${value}". Expected production or preview.`
5638
- );
5639
- }
5640
- function http() {
5641
- return new HttpClient(resolveConfig());
5642
- }
5643
- function laneLine(lane) {
5644
- const flag = lane.active ? "* " : " ";
5645
- const depth = lane.queueDepth.empty ? "empty" : `${lane.queueDepth.queuedTasks} tasks / ${lane.queueDepth.nonTerminalRuns} runs`;
5646
- return `${flag}${lane.releaseId} [${lane.status}] queue=${lane.queue} depth=${depth}`;
5647
- }
5648
- async function handleLanesList(options) {
5649
- const environment = normalizeEnvironment(options.environment);
5650
- const payload = await http().get(
5651
- `/api/v2/admin/runtime/lanes?environment=${environment}`
5652
- );
5653
- printCommandEnvelope(
5654
- {
5655
- ...payload,
5656
- render: {
5657
- sections: [
5658
- {
5659
- title: `Absurd lanes (${environment}):`,
5660
- lines: payload.lanes.length > 0 ? payload.lanes.map(laneLine) : ["(no registered lanes)"]
5661
- }
5662
- ]
5663
- }
5664
- },
5665
- { json: options.json }
5666
- );
5667
- }
5668
- async function handleLanesShow(releaseId, options) {
5669
- const environment = normalizeEnvironment(options.environment);
5670
- const payload = await http().get(
5671
- `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5672
- );
5673
- printCommandEnvelope(
5674
- {
5675
- ...payload,
5676
- render: {
5677
- sections: [
5678
- {
5679
- title: `Lane ${releaseId} (${environment}):`,
5680
- lines: [
5681
- `registered: ${payload.registered}`,
5682
- laneStatusLine(payload),
5683
- `queue: ${payload.retireCheck.queue}`,
5684
- `queued tasks: ${payload.retireCheck.queuedTasks}`,
5685
- `non-terminal runs: ${payload.retireCheck.nonTerminalRuns}`,
5686
- `retirable: ${payload.retireCheck.retirable}`
5687
- ]
5688
- }
5689
- ]
5690
- }
5691
- },
5692
- { json: options.json }
5693
- );
5694
- }
5695
- async function handleLanesRetireCheck(releaseId, options) {
5696
- const environment = normalizeEnvironment(options.environment);
5697
- const payload = await http().get(
5698
- `/api/v2/admin/runtime/lanes?environment=${environment}&release=${encodeURIComponent(releaseId)}`
5699
- );
5700
- printCommandEnvelope(
5701
- {
5702
- ...payload,
5703
- render: {
5704
- sections: [
5705
- {
5706
- title: `Retire check ${releaseId} (${environment}):`,
5707
- lines: [
5708
- payload.retireCheck.retirable ? "retirable: yes (lane queue empty)" : `retirable: no (${payload.retireCheck.queuedTasks} tasks, ${payload.retireCheck.nonTerminalRuns} runs pending)`
5709
- ]
5710
- }
5711
- ]
5712
- }
5713
- },
5714
- { json: options.json }
5715
- );
5716
- }
5717
- async function handleReleasesActivate(releaseId, options) {
5718
- const environment = normalizeEnvironment(options.environment);
5719
- const payload = await http().post(
5720
- "/api/v2/admin/runtime/releases",
5721
- {
5722
- releaseId,
5723
- environment,
5724
- schedulerBackend: options.schedulerBackend ?? "absurd"
5725
- }
5726
- );
5727
- printCommandEnvelope(
5728
- {
5729
- ...payload,
5730
- render: {
5731
- sections: [
5732
- {
5733
- title: `Activated release ${releaseId} (${environment}).`,
5734
- lines: ["Runtime release pointer flipped to this lane."]
5735
- }
5736
- ]
5737
- }
5738
- },
5739
- { json: options.json }
5740
- );
5741
- }
5742
- function registerAdminCommands(program) {
5743
- const admin = program.command("admin").description("Platform-admin operations (runtime lanes, releases).");
5744
- const lanes = admin.command("lanes").description("Inspect Absurd runtime release lanes.");
5745
- lanes.command("list").description("List all registered Absurd lanes with queue depth.").option("--environment <env>", "production (default) or preview").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLanesList);
5746
- lanes.command("show <releaseId>").description("Show one lane and its retire-gate depth.").option("--environment <env>", "production (default) or preview").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLanesShow);
5747
- lanes.command("retire-check <releaseId>").description("Check whether a lane is safe to retire (queue empty).").option("--environment <env>", "production (default) or preview").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleLanesRetireCheck);
5748
- const releases = admin.command("releases").description("Manage the active runtime release pointer.");
5749
- releases.command("activate <releaseId>").description("Activate a prior registered Absurd release lane.").option("--environment <env>", "production (default) or preview").option("--scheduler-backend <backend>", "runtime scheduler (absurd only)").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleReleasesActivate);
5750
- }
5751
-
5752
5635
  // src/cli/commands/auth.ts
5753
- var import_node_fs5 = require("fs");
5754
- var import_node_os6 = require("os");
5755
- var import_node_path5 = require("path");
5756
5636
  var EXIT_OK = 0;
5757
5637
  var EXIT_AUTH = 3;
5758
5638
  var EXIT_SERVER = 5;
@@ -6731,8 +6611,8 @@ function defaultLedgerExportPath() {
6731
6611
  );
6732
6612
  }
6733
6613
  async function handleBalance(options) {
6734
- const { http: http2 } = getAuthedHttpClient();
6735
- const payload = await http2.get(
6614
+ const { http } = getAuthedHttpClient();
6615
+ const payload = await http.get(
6736
6616
  "/api/v2/billing/balance"
6737
6617
  );
6738
6618
  const status = String(payload.balance_status || "");
@@ -6766,13 +6646,13 @@ async function handleBalance(options) {
6766
6646
  return;
6767
6647
  }
6768
6648
  async function handleUsage(options) {
6769
- const { http: http2 } = getAuthedHttpClient();
6649
+ const { http } = getAuthedHttpClient();
6770
6650
  const params = new URLSearchParams();
6771
6651
  if (options.limit) params.set("recent_limit", options.limit);
6772
6652
  if (options.offset) params.set("recent_offset", options.offset);
6773
6653
  if (options.runId) params.set("run_id", options.runId);
6774
6654
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
6775
- const payload = await http2.get(
6655
+ const payload = await http.get(
6776
6656
  `/api/v2/billing/usage${suffix}`
6777
6657
  );
6778
6658
  const usage = payload.usage ?? {};
@@ -6798,8 +6678,8 @@ async function handleUsage(options) {
6798
6678
  );
6799
6679
  }
6800
6680
  async function handleLimit(options) {
6801
- const { http: http2 } = getAuthedHttpClient();
6802
- const payload = await http2.get(
6681
+ const { http } = getAuthedHttpClient();
6682
+ const payload = await http.get(
6803
6683
  "/api/v2/billing/limit"
6804
6684
  );
6805
6685
  const lines = payload.enabled ? [
@@ -6815,8 +6695,8 @@ async function handleLimit(options) {
6815
6695
  );
6816
6696
  }
6817
6697
  async function handleSetLimit(credits, options) {
6818
- const { http: http2 } = getAuthedHttpClient();
6819
- const payload = await http2.request("/api/v2/billing/limit", {
6698
+ const { http } = getAuthedHttpClient();
6699
+ const payload = await http.request("/api/v2/billing/limit", {
6820
6700
  method: "PUT",
6821
6701
  body: { monthly_credits_limit: Number.parseInt(credits, 10) }
6822
6702
  });
@@ -6836,8 +6716,8 @@ async function handleSetLimit(credits, options) {
6836
6716
  );
6837
6717
  }
6838
6718
  async function handleLimitOff(options) {
6839
- const { http: http2 } = getAuthedHttpClient();
6840
- const payload = await http2.request("/api/v2/billing/limit", {
6719
+ const { http } = getAuthedHttpClient();
6720
+ const payload = await http.request("/api/v2/billing/limit", {
6841
6721
  method: "DELETE"
6842
6722
  });
6843
6723
  printCommandEnvelope(
@@ -6856,7 +6736,7 @@ async function handleLimitOff(options) {
6856
6736
  );
6857
6737
  }
6858
6738
  async function handleHistory(options) {
6859
- const { http: http2 } = getAuthedHttpClient();
6739
+ const { http } = getAuthedHttpClient();
6860
6740
  const windows = {
6861
6741
  "1d": 86400,
6862
6742
  "1w": 604800,
@@ -6872,7 +6752,7 @@ async function handleHistory(options) {
6872
6752
  limit: String(BILLING_HISTORY_EXPORT_LIMIT - entries.length)
6873
6753
  });
6874
6754
  if (cursor !== null) params.set("cursor", cursor);
6875
- const payload = await http2.get(
6755
+ const payload = await http.get(
6876
6756
  `/api/v2/billing/ledger?${params.toString()}`
6877
6757
  );
6878
6758
  if (Array.isArray(payload.entries)) {
@@ -6917,7 +6797,7 @@ async function handleHistory(options) {
6917
6797
  );
6918
6798
  }
6919
6799
  async function handleLedgerExportAll(options) {
6920
- const { http: http2 } = getAuthedHttpClient();
6800
+ const { http } = getAuthedHttpClient();
6921
6801
  const outputPath = options.output ? (0, import_node_path6.resolve)(String(options.output)) : defaultLedgerExportPath();
6922
6802
  let summary = { row_count: 0, net_delta_credits: 0 };
6923
6803
  let cursor = null;
@@ -6926,7 +6806,7 @@ async function handleLedgerExportAll(options) {
6926
6806
  const params = new URLSearchParams({ limit: "5000" });
6927
6807
  if (cursor !== null) params.set("cursor", cursor);
6928
6808
  if (options.runId) params.set("run_id", options.runId);
6929
- const payload = await http2.get(
6809
+ const payload = await http.get(
6930
6810
  `/api/v2/billing/ledger?${params.toString()}`
6931
6811
  );
6932
6812
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
@@ -6986,8 +6866,8 @@ function planRolloverText(rollover) {
6986
6866
  return `rollover ${mode}`;
6987
6867
  }
6988
6868
  async function handlePlans(options) {
6989
- const { http: http2 } = getAuthedHttpClient();
6990
- const payload = await http2.get(
6869
+ const { http } = getAuthedHttpClient();
6870
+ const payload = await http.get(
6991
6871
  "/api/v2/billing/catalog/current"
6992
6872
  );
6993
6873
  const activePlan = payload.active_plan ?? {};
@@ -7019,8 +6899,8 @@ async function handlePlans(options) {
7019
6899
  );
7020
6900
  }
7021
6901
  async function handleSubscribe(planVersionId, options) {
7022
- const { http: http2 } = getAuthedHttpClient();
7023
- const payload = await http2.request(
6902
+ const { http } = getAuthedHttpClient();
6903
+ const payload = await http.request(
7024
6904
  "/api/v2/billing/subscription/checkout",
7025
6905
  {
7026
6906
  method: "POST",
@@ -7239,8 +7119,8 @@ async function handleInvoices(options) {
7239
7119
  );
7240
7120
  }
7241
7121
  async function handleCheckout(options) {
7242
- const { http: http2 } = getAuthedHttpClient();
7243
- const payload = await http2.post(
7122
+ const { http } = getAuthedHttpClient();
7123
+ const payload = await http.post(
7244
7124
  "/api/v2/billing/checkout",
7245
7125
  {
7246
7126
  ...options.tier ? { tierId: options.tier } : {},
@@ -7359,8 +7239,8 @@ async function handleTopUp(creditsRaw, options) {
7359
7239
  });
7360
7240
  }
7361
7241
  async function handleRedeemCode(code, options) {
7362
- const { http: http2 } = getAuthedHttpClient();
7363
- const payload = await http2.post(
7242
+ const { http } = getAuthedHttpClient();
7243
+ const payload = await http.post(
7364
7244
  "/api/v2/billing/checkout",
7365
7245
  {
7366
7246
  discountCode: code
@@ -23477,8 +23357,8 @@ function registerEnrichCommand(program) {
23477
23357
 
23478
23358
  // src/cli/commands/feedback.ts
23479
23359
  async function handleFeedback(text, options) {
23480
- const { http: http2 } = getAuthedHttpClient();
23481
- const response = await http2.post("/api/v2/cli/feedback", {
23360
+ const { http } = getAuthedHttpClient();
23361
+ const response = await http.post("/api/v2/cli/feedback", {
23482
23362
  text,
23483
23363
  environment: collectLocalEnvInfo(),
23484
23364
  ...options.command ? { command: options.command } : {},
@@ -23882,8 +23762,8 @@ function buildSessionUploadContent(raw) {
23882
23762
  return { encodedContent: encoded, needsChunking: true };
23883
23763
  }
23884
23764
  async function uploadPayload(path, payload) {
23885
- const { http: http2 } = getAuthedHttpClient();
23886
- return await http2.post(path, payload);
23765
+ const { http } = getAuthedHttpClient();
23766
+ return await http.post(path, payload);
23887
23767
  }
23888
23768
  async function uploadChunkedSessions(sessions, options) {
23889
23769
  const uploadId = (0, import_node_crypto5.randomUUID)();
@@ -24669,8 +24549,8 @@ Preview the plan first with:
24669
24549
  );
24670
24550
  }
24671
24551
  async function handleMonitorsStatus(options) {
24672
- const http2 = buildHttpClient();
24673
- const payload = await http2.request(
24552
+ const http = buildHttpClient();
24553
+ const payload = await http.request(
24674
24554
  "/api/v2/monitors/access",
24675
24555
  { method: "GET" }
24676
24556
  );
@@ -24743,7 +24623,7 @@ async function handleMonitorsAvailable(toolId, options) {
24743
24623
  }
24744
24624
  }
24745
24625
  const tool = toolId ?? options.tool;
24746
- const http2 = buildHttpClient();
24626
+ const http = buildHttpClient();
24747
24627
  const params = new URLSearchParams();
24748
24628
  if (options.provider) params.set("provider", options.provider);
24749
24629
  if (tool) params.set("tool", tool);
@@ -24752,7 +24632,7 @@ async function handleMonitorsAvailable(toolId, options) {
24752
24632
  const compactList = !tool && !options.full;
24753
24633
  if (compactList || options.compact) params.set("compact", "true");
24754
24634
  const query = params.toString();
24755
- const payload = await http2.request(
24635
+ const payload = await http.request(
24756
24636
  `/api/v2/monitors/tools${query ? `?${query}` : ""}`,
24757
24637
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24758
24638
  );
@@ -24792,13 +24672,13 @@ function renderDeployedListText(payload, requestedStatus) {
24792
24672
  `;
24793
24673
  }
24794
24674
  async function handleMonitorsList(options) {
24795
- const http2 = buildHttpClient();
24675
+ const http = buildHttpClient();
24796
24676
  const params = new URLSearchParams();
24797
24677
  if (options.status) params.set("status", options.status);
24798
24678
  if (options.limit) params.set("limit", options.limit);
24799
24679
  if (options.compact) params.set("compact", "true");
24800
24680
  const query = params.toString();
24801
- const payload = await http2.request(
24681
+ const payload = await http.request(
24802
24682
  `/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
24803
24683
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24804
24684
  );
@@ -24808,21 +24688,21 @@ async function handleMonitorsList(options) {
24808
24688
  });
24809
24689
  }
24810
24690
  async function handleMonitorsCheck(definition, options) {
24811
- const http2 = buildHttpClient();
24691
+ const http = buildHttpClient();
24812
24692
  const body = resolveMonitorJsonBody({
24813
24693
  positional: definition,
24814
24694
  file: options.file,
24815
24695
  argLabel: "<definition>",
24816
24696
  command: "deepline monitors check"
24817
24697
  });
24818
- const payload = await http2.request(
24698
+ const payload = await http.request(
24819
24699
  "/api/v2/monitors/check",
24820
24700
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24821
24701
  );
24822
24702
  printCommandEnvelope(payload, { json: options.json });
24823
24703
  }
24824
24704
  async function handleMonitorsDeploy(definition, options) {
24825
- const http2 = buildHttpClient();
24705
+ const http = buildHttpClient();
24826
24706
  const body = resolveMonitorJsonBody({
24827
24707
  positional: definition,
24828
24708
  file: options.file,
@@ -24830,7 +24710,7 @@ async function handleMonitorsDeploy(definition, options) {
24830
24710
  command: "deepline monitors deploy"
24831
24711
  });
24832
24712
  if (options.dryRun) {
24833
- const payload2 = await http2.request(
24713
+ const payload2 = await http.request(
24834
24714
  "/api/v2/monitors/check",
24835
24715
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24836
24716
  );
@@ -24844,7 +24724,7 @@ async function handleMonitorsDeploy(definition, options) {
24844
24724
  }
24845
24725
  return;
24846
24726
  }
24847
- const payload = await http2.request(
24727
+ const payload = await http.request(
24848
24728
  "/api/v2/monitors/deploy",
24849
24729
  { method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
24850
24730
  );
@@ -24896,12 +24776,12 @@ function renderMonitorGet(payload) {
24896
24776
  `;
24897
24777
  }
24898
24778
  async function handleMonitorsGet(key, options) {
24899
- const http2 = buildHttpClient();
24900
- const payload = await http2.request(
24779
+ const http = buildHttpClient();
24780
+ const payload = await http.request(
24901
24781
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
24902
24782
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24903
24783
  );
24904
- const dependents = await http2.request(
24784
+ const dependents = await http.request(
24905
24785
  `/api/v2/monitors/deployed/${encodeKey(key)}/dependents`,
24906
24786
  { method: "GET", ...FORBIDDEN_AS_API_ERROR }
24907
24787
  );
@@ -24927,12 +24807,12 @@ async function confirmMonitorDelete(key, options) {
24927
24807
  }
24928
24808
  }
24929
24809
  async function handleMonitorsDelete(key, options) {
24930
- const http2 = buildHttpClient();
24810
+ const http = buildHttpClient();
24931
24811
  const params = new URLSearchParams();
24932
24812
  if (options.localOnly) params.set("local_only", "true");
24933
24813
  if (options.dryRun) {
24934
24814
  params.set("dry_run", "true");
24935
- const payload2 = await http2.request(
24815
+ const payload2 = await http.request(
24936
24816
  `/api/v2/monitors/deployed/${encodeKey(key)}?${params.toString()}`,
24937
24817
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
24938
24818
  );
@@ -24964,30 +24844,30 @@ async function handleMonitorsDelete(key, options) {
24964
24844
  }
24965
24845
  }
24966
24846
  const query = params.toString();
24967
- const payload = await http2.request(
24847
+ const payload = await http.request(
24968
24848
  `/api/v2/monitors/deployed/${encodeKey(key)}${query ? `?${query}` : ""}`,
24969
24849
  { method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
24970
24850
  );
24971
24851
  printCommandEnvelope(payload, { json: options.json });
24972
24852
  }
24973
24853
  async function handleMonitorsUpdate(key, patch, options) {
24974
- const http2 = buildHttpClient();
24854
+ const http = buildHttpClient();
24975
24855
  const body = resolveMonitorJsonBody({
24976
24856
  positional: patch,
24977
24857
  file: options.file,
24978
24858
  argLabel: "<patch>",
24979
24859
  command: `deepline monitors update ${key}`
24980
24860
  });
24981
- const payload = await http2.request(
24861
+ const payload = await http.request(
24982
24862
  `/api/v2/monitors/deployed/${encodeKey(key)}`,
24983
24863
  { method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
24984
24864
  );
24985
24865
  printCommandEnvelope(payload, { json: options.json });
24986
24866
  }
24987
24867
  async function handleMonitorsReactivate(key, options) {
24988
- const http2 = buildHttpClient();
24868
+ const http = buildHttpClient();
24989
24869
  if (options.dryRun) {
24990
- const payload2 = await http2.request(
24870
+ const payload2 = await http.request(
24991
24871
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
24992
24872
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
24993
24873
  );
@@ -25001,7 +24881,7 @@ async function handleMonitorsReactivate(key, options) {
25001
24881
  });
25002
24882
  return;
25003
24883
  }
25004
- const payload = await http2.request(
24884
+ const payload = await http.request(
25005
24885
  `/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
25006
24886
  { method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
25007
24887
  );
@@ -25247,8 +25127,8 @@ Examples:
25247
25127
  }
25248
25128
 
25249
25129
  // src/cli/commands/org.ts
25250
- async function fetchOrganizations(http2, apiKey) {
25251
- return http2.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
25130
+ async function fetchOrganizations(http, apiKey) {
25131
+ return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
25252
25132
  }
25253
25133
  function normalizeAuthScope2(value) {
25254
25134
  if (!value) return "auto";
@@ -25352,8 +25232,8 @@ function resolveOrgSwitchAuthTarget(scope, config) {
25352
25232
  }
25353
25233
  async function handleOrgList(options) {
25354
25234
  const config = resolveConfig();
25355
- const http2 = new HttpClient(config);
25356
- const payload = await fetchOrganizations(http2, config.apiKey);
25235
+ const http = new HttpClient(config);
25236
+ const payload = await fetchOrganizations(http, config.apiKey);
25357
25237
  printCommandEnvelope(
25358
25238
  {
25359
25239
  ...payload,
@@ -25371,8 +25251,8 @@ async function handleOrgList(options) {
25371
25251
  }
25372
25252
  async function handleOrgStatus(options) {
25373
25253
  const config = resolveConfig();
25374
- const http2 = new HttpClient(config);
25375
- const payload = await fetchOrganizations(http2, config.apiKey);
25254
+ const http = new HttpClient(config);
25255
+ const payload = await fetchOrganizations(http, config.apiKey);
25376
25256
  const current = payload.organizations.find((org) => org.is_current) ?? payload.organizations.find(
25377
25257
  (org) => org.org_id === payload.current_org_id
25378
25258
  ) ?? null;
@@ -25455,8 +25335,8 @@ async function handleOrgStatus(options) {
25455
25335
  async function handleOrgSwitch(selection, options) {
25456
25336
  const authScope = normalizeAuthScope2(options.authScope);
25457
25337
  const config = resolveConfig();
25458
- const http2 = new HttpClient(config);
25459
- const payload = await fetchOrganizations(http2, config.apiKey);
25338
+ const http = new HttpClient(config);
25339
+ const payload = await fetchOrganizations(http, config.apiKey);
25460
25340
  if (!selection && !options.orgId) {
25461
25341
  printCommandEnvelope(
25462
25342
  {
@@ -25551,7 +25431,7 @@ async function handleOrgSwitch(selection, options) {
25551
25431
  );
25552
25432
  return;
25553
25433
  }
25554
- const switched = await http2.post("/api/v2/auth/cli/switch", {
25434
+ const switched = await http.post("/api/v2/auth/cli/switch", {
25555
25435
  api_key: config.apiKey,
25556
25436
  org_id: target.org_id
25557
25437
  });
@@ -25619,8 +25499,8 @@ async function handleOrgSwitch(selection, options) {
25619
25499
  }
25620
25500
  async function handleOrgCreate(name, options) {
25621
25501
  const config = resolveConfig();
25622
- const http2 = new HttpClient(config);
25623
- const created = await http2.post("/api/v2/auth/cli/org-create", {
25502
+ const http = new HttpClient(config);
25503
+ const created = await http.post("/api/v2/auth/cli/org-create", {
25624
25504
  api_key: config.apiKey,
25625
25505
  name
25626
25506
  });
@@ -25806,243 +25686,82 @@ Examples:
25806
25686
  );
25807
25687
  }
25808
25688
 
25809
- // src/cli/commands/quickstart.ts
25810
- var import_node_child_process2 = require("child_process");
25811
- var import_node_crypto6 = require("crypto");
25812
- var import_node_http = require("http");
25813
- var EXIT_OK2 = 0;
25814
- var EXIT_AUTH2 = 1;
25815
- var EXIT_SERVER3 = 2;
25816
- var MAX_PROMPT_LENGTH = 8e3;
25817
- var MAX_BODY_BYTES = 64 * 1024;
25818
- function shellQuote3(arg) {
25819
- return `'${arg.replace(/'/g, `'\\''`)}'`;
25820
- }
25821
- function hasClaudeBinary() {
25822
- try {
25823
- const result = (0, import_node_child_process2.spawnSync)("claude", ["--version"], {
25824
- stdio: "ignore",
25825
- shell: process.platform === "win32"
25826
- });
25827
- return result.status === 0;
25828
- } catch {
25829
- return false;
25689
+ // src/cli/getting-started.ts
25690
+ var DEEPLINE_GTM_SKILL = "/deepline-gtm";
25691
+ var DEEPLINE_GTM_STARTER_PROMPTS = [
25692
+ {
25693
+ id: "waterfall-email-lookup",
25694
+ title: "Waterfall email lookup",
25695
+ prompt: "/deepline-gtm Find 5 CTOs in NYC and get their verified work emails."
25696
+ },
25697
+ {
25698
+ id: "signal-based-outbound",
25699
+ title: "Signal-based outbound",
25700
+ prompt: "/deepline-gtm Find 5 leads engaging with Gong's competitors on LinkedIn. Score against CMO or VP of Marketing. Waterfall enrich their emails. Build a sequence-ready list with personalized first lines."
25701
+ },
25702
+ {
25703
+ id: "vc-portfolio-scrape",
25704
+ title: "VC portfolio scrape",
25705
+ prompt: "/deepline-gtm Pull 5 companies from Y Combinator W26. Find the Head of Marketing or VP Sales at each one. Waterfall their emails and write a personalized first line."
25830
25706
  }
25707
+ ];
25708
+ var DEEPLINE_GTM_HANDOFF_QUESTION = "Would you like to try one of these examples, or tell me your own business problem?";
25709
+ function deeplineGtmGettingStartedPayload() {
25710
+ return {
25711
+ skill: DEEPLINE_GTM_SKILL,
25712
+ examples: DEEPLINE_GTM_STARTER_PROMPTS,
25713
+ question: DEEPLINE_GTM_HANDOFF_QUESTION,
25714
+ customProblemBehavior: "Turn the business problem into one exact /deepline-gtm prompt, show that reusable prompt, then execute it without asking the user to paste it again."
25715
+ };
25831
25716
  }
25832
- function launchClaude(prompt) {
25833
- return new Promise((resolve15) => {
25834
- const child = (0, import_node_child_process2.spawn)("claude", [prompt], {
25835
- stdio: "inherit",
25836
- shell: process.platform === "win32"
25837
- });
25838
- child.on("error", () => resolve15(EXIT_SERVER3));
25839
- child.on("close", (status) => resolve15(status ?? EXIT_OK2));
25840
- });
25841
- }
25842
- function readBody(req) {
25843
- return new Promise((resolve15, reject) => {
25844
- let raw = "";
25845
- req.setEncoding("utf8");
25846
- req.on("data", (chunk) => {
25847
- raw += chunk;
25848
- if (raw.length > MAX_BODY_BYTES) {
25849
- reject(new Error("Request body too large."));
25850
- req.destroy();
25851
- }
25852
- });
25853
- req.on("end", () => resolve15(raw));
25854
- req.on("error", reject);
25855
- });
25856
- }
25857
- function writeJson(res, status, payload) {
25858
- res.writeHead(status, { "content-type": "application/json" });
25859
- res.end(JSON.stringify(payload));
25860
- }
25861
- function startCallbackServer(input2) {
25862
- const server = (0, import_node_http.createServer)((req, res) => {
25863
- res.setHeader("Access-Control-Allow-Origin", req.headers.origin ?? "*");
25864
- res.setHeader("Vary", "Origin");
25865
- res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
25866
- res.setHeader("Access-Control-Allow-Headers", "content-type");
25867
- res.setHeader("Access-Control-Allow-Private-Network", "true");
25868
- res.setHeader("Access-Control-Max-Age", "600");
25869
- if (req.method === "OPTIONS") {
25870
- res.writeHead(204);
25871
- res.end();
25872
- return;
25873
- }
25874
- if (req.method !== "POST" || req.url !== "/submit") {
25875
- writeJson(res, 404, { error: "Not found." });
25876
- return;
25877
- }
25878
- void readBody(req).then((raw) => {
25879
- let body = null;
25880
- try {
25881
- body = JSON.parse(raw);
25882
- } catch {
25883
- body = null;
25884
- }
25885
- const state = typeof body?.state === "string" ? body.state : "";
25886
- const prompt = typeof body?.prompt === "string" ? body.prompt.trim() : "";
25887
- const workflowId = typeof body?.workflow_id === "string" && body.workflow_id.trim() ? body.workflow_id.trim() : null;
25888
- if (!state || state !== input2.state) {
25889
- writeJson(res, 403, { error: "Invalid quickstart state token." });
25890
- return;
25891
- }
25892
- if (!prompt) {
25893
- writeJson(res, 400, { error: "prompt is required." });
25894
- return;
25895
- }
25896
- if (prompt.length > MAX_PROMPT_LENGTH) {
25897
- writeJson(res, 400, {
25898
- error: `prompt exceeds ${MAX_PROMPT_LENGTH} characters.`
25899
- });
25900
- return;
25901
- }
25902
- writeJson(res, 200, { ok: true });
25903
- setImmediate(() => input2.onSelection({ prompt, workflowId }));
25904
- }).catch(() => {
25905
- writeJson(res, 400, { error: "Invalid request body." });
25906
- });
25907
- });
25908
- return new Promise((resolve15, reject) => {
25909
- server.once("error", reject);
25910
- server.listen(0, "127.0.0.1", () => {
25911
- const address = server.address();
25912
- if (!address || typeof address === "string") {
25913
- reject(new Error("Failed to bind quickstart callback server."));
25914
- return;
25915
- }
25916
- resolve15({ server, port: address.port });
25917
- });
25918
- });
25919
- }
25717
+
25718
+ // src/cli/commands/quickstart.ts
25920
25719
  async function handleQuickstart(options) {
25921
25720
  const jsonOutput = shouldEmitJson(options.json === true);
25922
- const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
25923
- const installerMode = String(process.env.DEEPLINE_INSTALLER_MODE ?? "").trim().toLowerCase() === "true";
25924
- const interactive = Boolean(
25925
- !installerMode && process.stdin.isTTY && process.stdout.isTTY
25926
- );
25927
- let apiKey = resolveApiKeyForBaseUrl(baseUrl);
25928
- if (!apiKey) {
25929
- if (interactive) {
25930
- console.error("Not connected yet \u2014 registering this device first.");
25931
- const registerExit = await handleRegister([]);
25932
- if (registerExit !== EXIT_OK2) return registerExit;
25933
- apiKey = resolveApiKeyForBaseUrl(baseUrl);
25934
- }
25935
- if (!apiKey) {
25936
- console.error("Not connected. Run: deepline auth register");
25937
- return EXIT_AUTH2;
25938
- }
25939
- }
25940
- const state = (0, import_node_crypto6.randomBytes)(32).toString("hex");
25941
- let resolveSelection;
25942
- const selectionPromise = new Promise((resolve15) => {
25943
- resolveSelection = resolve15;
25944
- });
25945
- let callback;
25946
- try {
25947
- callback = await startCallbackServer({
25948
- state,
25949
- onSelection: (selection) => resolveSelection(selection)
25950
- });
25951
- } catch (error) {
25952
- console.error(
25953
- `Could not start the local quickstart listener: ${error instanceof Error ? error.message : String(error)}`
25954
- );
25955
- return EXIT_SERVER3;
25956
- }
25957
- const quickstartUrl = `${baseUrl}/cli/quickstart?cb=${callback.port}&state=${state}`;
25958
- console.error(" Opening the recipe picker in your browser.");
25959
- console.error(` If it didn't open, cmd+click: ${quickstartUrl}`);
25960
- if (options.open !== false) {
25961
- openInBrowser(quickstartUrl);
25962
- }
25963
- const timeoutSeconds = Number.parseInt(options.timeout ?? "300", 10);
25964
- const timeoutMs = (Number.isFinite(timeoutSeconds) && timeoutSeconds > 0 ? timeoutSeconds : 300) * 1e3;
25965
- const timeoutHandle = setTimeout(
25966
- () => resolveSelection("timeout"),
25967
- timeoutMs
25968
- );
25969
- const progress = createCliProgress(!jsonOutput);
25970
- progress.phase("waiting for your pick in the browser (Ctrl+C to skip)");
25971
- const onSigint = () => resolveSelection("sigint");
25972
- process.once("SIGINT", onSigint);
25973
- const outcome = await selectionPromise;
25974
- clearTimeout(timeoutHandle);
25975
- process.removeListener("SIGINT", onSigint);
25976
- callback.server.close();
25977
- if (outcome === "sigint") {
25978
- progress.fail();
25979
- console.error("\nSkipped \u2014 run `deepline quickstart` anytime.");
25980
- return EXIT_OK2;
25981
- }
25982
- if (outcome === "timeout") {
25983
- progress.fail();
25984
- console.error(
25985
- "Timed out waiting for a selection. Run: deepline quickstart"
25986
- );
25987
- return EXIT_AUTH2;
25988
- }
25989
- progress.complete();
25990
- const { prompt, workflowId } = outcome;
25991
- const claudeCommand = `claude ${shellQuote3(prompt)}`;
25992
- const claudeAvailable = hasClaudeBinary();
25993
- const willLaunch = options.launch !== false && !jsonOutput && interactive && claudeAvailable;
25721
+ const gettingStarted = {
25722
+ skill: DEEPLINE_GTM_SKILL,
25723
+ examples: DEEPLINE_GTM_STARTER_PROMPTS
25724
+ };
25994
25725
  printCommandEnvelope(
25995
25726
  {
25996
- status: "submitted",
25997
- workflowId,
25998
- prompt,
25999
- claudeCommand,
26000
- url: quickstartUrl,
26001
- launched: willLaunch,
25727
+ ok: true,
25728
+ status: "deprecated",
25729
+ code: "QUICKSTART_DEPRECATED",
25730
+ exitCode: 0,
25731
+ message: "`deepline quickstart` is deprecated. Start with the installed /deepline-gtm skill in your agent.",
25732
+ deprecatedCommand: "deepline quickstart",
25733
+ replacement: DEEPLINE_GTM_SKILL,
25734
+ gettingStarted,
25735
+ next: DEEPLINE_GTM_SKILL,
26002
25736
  render: {
26003
25737
  sections: [
26004
25738
  {
26005
- title: "quickstart",
25739
+ title: "quickstart deprecated",
26006
25740
  lines: [
26007
- ...workflowId ? [`Recipe: ${workflowId}`] : [],
26008
- willLaunch ? "Launching Claude Code with your recipe..." : claudeAvailable ? "Run the command below to start your recipe." : "Claude Code not found. Install it (https://code.claude.com/docs/en/overview), then run the command below."
25741
+ `Use ${DEEPLINE_GTM_SKILL} in your agent instead.`,
25742
+ ...DEEPLINE_GTM_STARTER_PROMPTS.map(
25743
+ (example, index) => `${index + 1}. ${example.title}: ${example.prompt}`
25744
+ )
26009
25745
  ]
26010
25746
  }
26011
- ],
26012
- actions: [{ label: "Run", command: claudeCommand }]
25747
+ ]
26013
25748
  }
26014
25749
  },
26015
25750
  { json: jsonOutput }
26016
25751
  );
26017
- if (willLaunch) {
26018
- return launchClaude(prompt);
26019
- }
26020
- return EXIT_OK2;
25752
+ return 0;
26021
25753
  }
26022
25754
  function registerQuickstartCommands(program) {
26023
25755
  program.command("quickstart").description(
26024
- "Pick a starter recipe in the browser and launch it with Claude Code."
25756
+ "Deprecated compatibility command. Use /deepline-gtm in your agent."
26025
25757
  ).addHelpText(
26026
25758
  "after",
26027
25759
  `
26028
- Notes:
26029
- Opens the hosted recipe picker in your browser. The picker sends your
26030
- selection back to a temporary listener on 127.0.0.1, so the browser must run
26031
- on the same machine as the CLI. Once a recipe arrives, the CLI prints the
26032
- matching claude command and, when Claude Code is installed and the shell is
26033
- interactive, launches it directly. Press Ctrl+C while waiting to skip.
26034
-
26035
- Examples:
26036
- deepline quickstart
26037
- deepline quickstart --no-open
26038
- deepline quickstart --no-launch --json
26039
- deepline quickstart --timeout 120
25760
+ Deprecated:
25761
+ Use the installed /deepline-gtm skill in your agent. This compatibility
25762
+ command prints three starter prompts and no longer opens a browser.
26040
25763
  `
26041
- ).option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--no-open", "Do not open the browser; print the URL only").option("--no-launch", "Print the claude command instead of launching it").option(
26042
- "--timeout <seconds>",
26043
- "Maximum seconds to wait for a selection",
26044
- "300"
26045
- ).action(async (options) => {
25764
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--no-open", "Deprecated compatibility option").option("--no-launch", "Deprecated compatibility option").option("--timeout <seconds>", "Deprecated compatibility option").action(async (options) => {
26046
25765
  process.exitCode = await handleQuickstart(options);
26047
25766
  });
26048
25767
  }
@@ -26212,8 +25931,8 @@ async function handleSet(nameInput, forbidden, options) {
26212
25931
  throw new Error("--play <name> is required when --scope play is used.");
26213
25932
  }
26214
25933
  const value = await readSecretValue();
26215
- const { http: http2 } = getAuthedHttpClient();
26216
- const response = await http2.post(
25934
+ const { http } = getAuthedHttpClient();
25935
+ const response = await http.post(
26217
25936
  "/api/v2/secrets",
26218
25937
  {
26219
25938
  name,
@@ -28003,9 +27722,9 @@ function apifySyncRecoveryNext(rawResponse) {
28003
27722
  const getDatasetItemsTool = stringField2(getDatasetItems, "tool");
28004
27723
  const getDatasetItemsPayload = recordField2(getDatasetItems, "payload");
28005
27724
  return {
28006
- getActorRun: `deepline tools execute ${getActorRunTool} --input ${shellQuote4(JSON.stringify(getActorRunPayload))} --json`,
27725
+ getActorRun: `deepline tools execute ${getActorRunTool} --input ${shellQuote3(JSON.stringify(getActorRunPayload))} --json`,
28007
27726
  ...getDatasetItemsTool && Object.keys(getDatasetItemsPayload).length > 0 ? {
28008
- getDatasetItems: `deepline tools execute ${getDatasetItemsTool} --input ${shellQuote4(JSON.stringify(getDatasetItemsPayload))} --json`
27727
+ getDatasetItems: `deepline tools execute ${getDatasetItemsTool} --input ${shellQuote3(JSON.stringify(getDatasetItemsPayload))} --json`
28009
27728
  } : {}
28010
27729
  };
28011
27730
  }
@@ -28178,7 +27897,7 @@ function parseExecuteOptions(args) {
28178
27897
  function safeFileStem(value) {
28179
27898
  return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
28180
27899
  }
28181
- function shellQuote4(value) {
27900
+ function shellQuote3(value) {
28182
27901
  return `'${value.replace(/'/g, `'\\''`)}'`;
28183
27902
  }
28184
27903
  function powerShellQuote(value) {
@@ -28248,7 +27967,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
28248
27967
  path: scriptPath,
28249
27968
  sourceCode: script,
28250
27969
  projectDir,
28251
- macCopyCommand: `mkdir -p ${shellQuote4(projectDir)} && cp ${shellQuote4(scriptPath)} ${shellQuote4(`${projectDir}/${fileName}`)}`,
27970
+ macCopyCommand: `mkdir -p ${shellQuote3(projectDir)} && cp ${shellQuote3(scriptPath)} ${shellQuote3(`${projectDir}/${fileName}`)}`,
28252
27971
  windowsCopyCommand: `New-Item -ItemType Directory -Force -Path ${powerShellQuote(projectDir.replace(/\//g, "\\"))} | Out-Null; Copy-Item -LiteralPath ${powerShellQuote(scriptPath)} -Destination ${powerShellQuote(`${projectDir.replace(/\//g, "\\")}\\${fileName}`)}`
28253
27972
  };
28254
27973
  }
@@ -28272,7 +27991,7 @@ function buildToolExecuteBaseEnvelope(input2) {
28272
27991
  envelope,
28273
27992
  "output"
28274
27993
  );
28275
- const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote4(JSON.stringify(input2.params))} --json`;
27994
+ const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote3(JSON.stringify(input2.params))} --json`;
28276
27995
  const actions = input2.listConversion ? [
28277
27996
  {
28278
27997
  label: "next",
@@ -28589,7 +28308,7 @@ var import_promises5 = require("fs/promises");
28589
28308
  var import_node_path17 = require("path");
28590
28309
 
28591
28310
  // src/cli/workflow-to-play.ts
28592
- var import_node_crypto7 = require("crypto");
28311
+ var import_node_crypto6 = require("crypto");
28593
28312
 
28594
28313
  // ../shared_libs/plays/secret-guardrails.ts
28595
28314
  var SECRET_ENV_PATTERN = /\bprocess(?:\.env|\[['"]env['"]\])(?:\.|\[['"])([A-Z0-9_]*(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD|PRIVATE[_-]?KEY|ACCESS[_-]?KEY)[A-Z0-9_]*)(?:['"]\])?/g;
@@ -28741,7 +28460,7 @@ function sanitizePlayNameSegment(value) {
28741
28460
  }
28742
28461
  function deriveWorkflowPlayName(workflowName) {
28743
28462
  const base = sanitizePlayNameSegment(workflowName) || "workflow";
28744
- const suffix = (0, import_node_crypto7.createHash)("sha256").update(workflowName).digest("hex").slice(0, 8);
28463
+ const suffix = (0, import_node_crypto6.createHash)("sha256").update(workflowName).digest("hex").slice(0, 8);
28745
28464
  const reserved = suffix.length + 1;
28746
28465
  const allowedBase = Math.max(1, MAX_PLAY_NAME_LENGTH - reserved);
28747
28466
  let name = `${base.slice(0, allowedBase)}_${suffix}`;
@@ -29126,13 +28845,13 @@ Notes:
29126
28845
  }
29127
28846
 
29128
28847
  // src/cli/commands/update.ts
29129
- var import_node_child_process4 = require("child_process");
28848
+ var import_node_child_process3 = require("child_process");
29130
28849
  var import_node_fs17 = require("fs");
29131
28850
  var import_node_os14 = require("os");
29132
28851
  var import_node_path19 = require("path");
29133
28852
 
29134
28853
  // src/cli/commands/skills.ts
29135
- var import_node_child_process3 = require("child_process");
28854
+ var import_node_child_process2 = require("child_process");
29136
28855
  var import_node_fs16 = require("fs");
29137
28856
  var import_node_os13 = require("os");
29138
28857
  var import_node_path18 = require("path");
@@ -29406,7 +29125,7 @@ function readSkillsInstallState(path) {
29406
29125
  }
29407
29126
  function runProcess(command, args, cwd) {
29408
29127
  return new Promise((resolve15, reject) => {
29409
- const child = (0, import_node_child_process3.spawn)(command, args, {
29128
+ const child = (0, import_node_child_process2.spawn)(command, args, {
29410
29129
  cwd,
29411
29130
  env: process.env,
29412
29131
  stdio: ["ignore", "ignore", "pipe"],
@@ -29646,14 +29365,14 @@ function posixShellQuote(value) {
29646
29365
  function windowsCmdQuote(value) {
29647
29366
  return `"${value.replace(/"/g, '""')}"`;
29648
29367
  }
29649
- function shellQuote5(value) {
29368
+ function shellQuote4(value) {
29650
29369
  if (process.platform === "win32") {
29651
29370
  return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : windowsCmdQuote(value);
29652
29371
  }
29653
29372
  return posixShellQuote(value);
29654
29373
  }
29655
29374
  function buildSourceUpdateCommand(sourceRoot) {
29656
- const quotedRoot = shellQuote5(sourceRoot);
29375
+ const quotedRoot = shellQuote4(sourceRoot);
29657
29376
  const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
29658
29377
  return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
29659
29378
  }
@@ -29665,7 +29384,7 @@ function buildSidecarProjectConfigCommand(versionDir, nodeBin) {
29665
29384
  "fs.mkdirSync(dir,{recursive:true});",
29666
29385
  `fs.writeFileSync(path.join(dir,'package.json'),${JSON.stringify(NPM_SDK_SIDECAR_PACKAGE_JSON)});`
29667
29386
  ].join("");
29668
- return `${shellQuote5(nodeBin)} -e ${shellQuote5(script)} ${shellQuote5(versionDir)}`;
29387
+ return `${shellQuote4(nodeBin)} -e ${shellQuote4(script)} ${shellQuote4(versionDir)}`;
29669
29388
  }
29670
29389
  function sidecarStateDir(input2) {
29671
29390
  const scope = input2.env.DEEPLINE_CONFIG_SCOPE?.trim();
@@ -29728,7 +29447,7 @@ function resolvePythonSidecarUpdatePlan(options) {
29728
29447
  const npmCommand = "npm";
29729
29448
  const registryUrl = sidecarRegistryUrl(hostUrl);
29730
29449
  const versionDir = (0, import_node_path19.join)(stateDir, "versions", "<version>");
29731
- const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote5(versionDir)} --registry ${shellQuote5(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote5).join(" ")} ${shellQuote5(packageSpec)}`;
29450
+ const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote4(versionDir)} --registry ${shellQuote4(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote4).join(" ")} ${shellQuote4(packageSpec)}`;
29732
29451
  return {
29733
29452
  kind: "python-sidecar",
29734
29453
  stateDir,
@@ -29812,7 +29531,7 @@ function resolveUpdatePlan(options = {}) {
29812
29531
  fallbackRegistryUrl: publicNpmFallbackRegistryUrl(
29813
29532
  env.DEEPLINE_HOST_URL?.trim() || autoDetectBaseUrl()
29814
29533
  ),
29815
- manualCommand: `${command} ${args.map(shellQuote5).join(" ")}`
29534
+ manualCommand: `${command} ${args.map(shellQuote4).join(" ")}`
29816
29535
  };
29817
29536
  }
29818
29537
  var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
@@ -29932,7 +29651,7 @@ function installedPackageVersion(versionDir) {
29932
29651
  function runCommand(command, args, env = process.env) {
29933
29652
  return new Promise((resolveResult) => {
29934
29653
  let output2 = "";
29935
- const child = (0, import_node_child_process4.spawn)(command, args, {
29654
+ const child = (0, import_node_child_process3.spawn)(command, args, {
29936
29655
  stdio: ["inherit", "pipe", "pipe"],
29937
29656
  shell: process.platform === "win32",
29938
29657
  env
@@ -30017,9 +29736,9 @@ function writeSidecarLauncher(input2) {
30017
29736
  input2.path,
30018
29737
  [
30019
29738
  "#!/usr/bin/env sh",
30020
- `export DEEPLINE_HOST_URL=${shellQuote5(input2.hostUrl)}`,
30021
- `export DEEPLINE_CONFIG_SCOPE=${shellQuote5(input2.scope)}`,
30022
- `exec ${shellQuote5(input2.nodeBin)} ${shellQuote5(input2.entryPath)} "$@"`,
29739
+ `export DEEPLINE_HOST_URL=${shellQuote4(input2.hostUrl)}`,
29740
+ `export DEEPLINE_CONFIG_SCOPE=${shellQuote4(input2.scope)}`,
29741
+ `exec ${shellQuote4(input2.nodeBin)} ${shellQuote4(input2.entryPath)} "$@"`,
30023
29742
  ""
30024
29743
  ].join("\n"),
30025
29744
  { encoding: "utf8", mode: 493 }
@@ -30231,7 +29950,7 @@ Examples:
30231
29950
  }
30232
29951
 
30233
29952
  // src/cli/commands/setup.ts
30234
- var import_node_child_process5 = require("child_process");
29953
+ var import_node_child_process4 = require("child_process");
30235
29954
  var import_node_fs18 = require("fs");
30236
29955
  var import_node_os15 = require("os");
30237
29956
  var import_node_path20 = require("path");
@@ -30334,6 +30053,15 @@ function resolveScopeRoot(scope) {
30334
30053
  function authScopeForSetup(scope) {
30335
30054
  return scope === "local" ? "folder" : "global";
30336
30055
  }
30056
+ function shouldOpenSetupAuthorization(runtime = detectAgentRuntime()) {
30057
+ return runtime !== "claude_cowork";
30058
+ }
30059
+ function openSetupAuthorization(authorizationUrl, options = {}) {
30060
+ const url = authorizationUrl.trim();
30061
+ if (!url || !shouldOpenSetupAuthorization(options.runtime)) return false;
30062
+ (options.open ?? openInBrowser)(url);
30063
+ return true;
30064
+ }
30337
30065
  function setupStatePath(baseUrl, scope, root) {
30338
30066
  return scope === "local" && root ? (0, import_node_path20.join)(root, ".deepline", "setup", "state.json") : (0, import_node_path20.join)(sdkCliStateDirPath(baseUrl), "setup.json");
30339
30067
  }
@@ -30416,7 +30144,7 @@ function removeKnownLegacyPaths(baseUrl) {
30416
30144
  return removed;
30417
30145
  }
30418
30146
  function resolvePathCommands(command) {
30419
- const lookup = (0, import_node_child_process5.spawnSync)(
30147
+ const lookup = (0, import_node_child_process4.spawnSync)(
30420
30148
  process.platform === "win32" ? "where" : "which",
30421
30149
  process.platform === "win32" ? [command] : ["-a", command],
30422
30150
  { encoding: "utf8", shell: process.platform === "win32" }
@@ -30431,7 +30159,7 @@ function resolvePathCommand(command) {
30431
30159
  return resolvePathCommands(command)[0] ?? null;
30432
30160
  }
30433
30161
  function resolvePersistentGlobalCommand() {
30434
- const prefix = (0, import_node_child_process5.spawnSync)("npm", ["prefix", "-g"], { encoding: "utf8" });
30162
+ const prefix = (0, import_node_child_process4.spawnSync)("npm", ["prefix", "-g"], { encoding: "utf8" });
30435
30163
  if (prefix.status !== 0) return null;
30436
30164
  const root = String(prefix.stdout ?? "").trim();
30437
30165
  if (!root) return null;
@@ -30523,9 +30251,6 @@ function rollbackCommand(scope, root) {
30523
30251
  const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify((0, import_node_path20.join)(root, ".deepline", "runtime"))}` : "";
30524
30252
  return `npm install -g${prefix} --no-audit --no-fund --include=optional --allow-scripts=esbuild deepline@${SDK_VERSION}`;
30525
30253
  }
30526
- function setupQuickstartCommand(baseUrl) {
30527
- return baseUrl === "https://code.deepline.com" ? "deepline quickstart" : `DEEPLINE_HOST_URL=${JSON.stringify(baseUrl)} deepline quickstart`;
30528
- }
30529
30254
  function setupResumeCommand(baseUrl, scope) {
30530
30255
  const hostPrefix = baseUrl === "https://code.deepline.com" ? "" : `DEEPLINE_HOST_URL=${JSON.stringify(baseUrl)} `;
30531
30256
  return `${hostPrefix}deepline setup --scope ${scope} --json`;
@@ -30675,7 +30400,7 @@ async function runDoctorCommand(options) {
30675
30400
  root,
30676
30401
  authStatus
30677
30402
  });
30678
- const quickstart = setupQuickstartCommand(baseUrl);
30403
+ const gettingStarted = deeplineGtmGettingStartedPayload();
30679
30404
  printCommandEnvelope(
30680
30405
  {
30681
30406
  ok,
@@ -30683,7 +30408,8 @@ async function runDoctorCommand(options) {
30683
30408
  code: ok ? "DOCTOR_OK" : "DOCTOR_FAILED",
30684
30409
  exitCode: ok ? 0 : 7,
30685
30410
  checks,
30686
- next: ok ? quickstart : "Review failed checks, then rerun: deepline doctor --json",
30411
+ next: ok ? DEEPLINE_GTM_SKILL : "Review failed checks, then rerun: deepline doctor --json",
30412
+ ...ok ? { gettingStarted } : {},
30687
30413
  render: {
30688
30414
  sections: [
30689
30415
  {
@@ -30712,6 +30438,7 @@ function pendingResult(input2) {
30712
30438
  phases: input2.phases
30713
30439
  });
30714
30440
  if (input2.authorizationUrl) {
30441
+ openSetupAuthorization(input2.authorizationUrl);
30715
30442
  process.stderr.write(`Authorize Deepline: ${input2.authorizationUrl}
30716
30443
  `);
30717
30444
  }
@@ -30795,7 +30522,7 @@ async function runSetupCommand(options) {
30795
30522
  json: options.json,
30796
30523
  extra: {
30797
30524
  persistentPath: globalCli.persistentPath,
30798
- fallback: "https://code.deepline.com/INSTALL.md"
30525
+ fallback: "https://code.deepline.com/SKILL.md"
30799
30526
  }
30800
30527
  });
30801
30528
  }
@@ -30998,14 +30725,15 @@ async function runSetupCommand(options) {
30998
30725
  root,
30999
30726
  authStatus: auth
31000
30727
  });
31001
- const quickstart = setupQuickstartCommand(baseUrl);
30728
+ const gettingStarted = deeplineGtmGettingStartedPayload();
31002
30729
  const doctorPayload = {
31003
30730
  ok: assessment.ok,
31004
30731
  status: assessment.ok ? "complete" : "failed",
31005
30732
  code: assessment.ok ? "DOCTOR_OK" : "DOCTOR_FAILED",
31006
30733
  exitCode: assessment.ok ? 0 : 7,
31007
30734
  checks: assessment.checks,
31008
- next: assessment.ok ? quickstart : `deepline doctor --scope ${scope} --json`
30735
+ next: assessment.ok ? DEEPLINE_GTM_SKILL : `deepline doctor --scope ${scope} --json`,
30736
+ ...assessment.ok ? { gettingStarted } : {}
31009
30737
  };
31010
30738
  if (!assessment.ok) {
31011
30739
  return reportSetupPhaseFailure({
@@ -31052,14 +30780,19 @@ async function runSetupCommand(options) {
31052
30780
  currentPhase: null,
31053
30781
  failedPhase: null,
31054
30782
  resumed,
31055
- next: quickstart,
30783
+ next: DEEPLINE_GTM_SKILL,
30784
+ gettingStarted,
31056
30785
  render: {
31057
30786
  sections: [
31058
30787
  {
31059
30788
  title: "setup",
31060
30789
  lines: [
31061
30790
  "Deepline is installed and connected.",
31062
- `Next: ${quickstart}`
30791
+ `Use ${DEEPLINE_GTM_SKILL} in your agent.`,
30792
+ ...DEEPLINE_GTM_STARTER_PROMPTS.map(
30793
+ (example, index) => `${index + 1}. ${example.title}: ${example.prompt}`
30794
+ ),
30795
+ gettingStarted.question
31063
30796
  ]
31064
30797
  }
31065
30798
  ]
@@ -31075,7 +30808,7 @@ function registerSetupCommands(program) {
31075
30808
  `
31076
30809
  Notes:
31077
30810
  Setup is idempotent. Bare setup resumes the first incomplete or failed phase.
31078
- It installs skills before auth and does not run quickstart.
30811
+ It installs skills before auth and does not run a starter workflow.
31079
30812
  JSON output includes phase status and an exact retry command.
31080
30813
 
31081
30814
  Examples:
@@ -31198,7 +30931,7 @@ function unknownCommandNameFromMessage(message) {
31198
30931
  }
31199
30932
 
31200
30933
  // src/cli/self-update.ts
31201
- var import_node_child_process6 = require("child_process");
30934
+ var import_node_child_process5 = require("child_process");
31202
30935
  function envTruthy(name) {
31203
30936
  const value = process.env[name]?.trim().toLowerCase();
31204
30937
  return value === "1" || value === "true" || value === "yes";
@@ -31247,7 +30980,7 @@ function relaunchCurrentCommand(plan) {
31247
30980
  return new Promise((resolve15) => {
31248
30981
  const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
31249
30982
  const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
31250
- const child = (0, import_node_child_process6.spawn)(command, args, {
30983
+ const child = (0, import_node_child_process5.spawn)(command, args, {
31251
30984
  stdio: "inherit",
31252
30985
  shell: process.platform === "win32",
31253
30986
  env: {
@@ -31312,7 +31045,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
31312
31045
  }
31313
31046
 
31314
31047
  // src/cli/skills-sync.ts
31315
- var import_node_child_process7 = require("child_process");
31048
+ var import_node_child_process6 = require("child_process");
31316
31049
  var import_node_fs19 = require("fs");
31317
31050
  var import_node_path21 = require("path");
31318
31051
  var CHECK_TIMEOUT_MS2 = 3e3;
@@ -31455,13 +31188,13 @@ function buildBunxSkillsInstallArgs(baseUrl, skillNames) {
31455
31188
  });
31456
31189
  }
31457
31190
  function hasCommand(command) {
31458
- const result = (0, import_node_child_process7.spawnSync)(command, ["--version"], {
31191
+ const result = (0, import_node_child_process6.spawnSync)(command, ["--version"], {
31459
31192
  stdio: "ignore",
31460
31193
  shell: process.platform === "win32"
31461
31194
  });
31462
31195
  return result.status === 0;
31463
31196
  }
31464
- function shellQuote6(arg) {
31197
+ function shellQuote5(arg) {
31465
31198
  return `'${arg.replace(/'/g, `'\\''`)}'`;
31466
31199
  }
31467
31200
  function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES) {
@@ -31471,7 +31204,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
31471
31204
  commands.push({
31472
31205
  command: "bunx",
31473
31206
  args: bunxArgs,
31474
- manualCommand: `bunx ${bunxArgs.map(shellQuote6).join(" ")}`
31207
+ manualCommand: `bunx ${bunxArgs.map(shellQuote5).join(" ")}`
31475
31208
  });
31476
31209
  }
31477
31210
  if (hasCommand("npx")) {
@@ -31479,14 +31212,14 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
31479
31212
  commands.push({
31480
31213
  command: "npx",
31481
31214
  args: npxArgs,
31482
- manualCommand: `npx ${npxArgs.map(shellQuote6).join(" ")}`
31215
+ manualCommand: `npx ${npxArgs.map(shellQuote5).join(" ")}`
31483
31216
  });
31484
31217
  }
31485
31218
  return commands;
31486
31219
  }
31487
31220
  function runOneSkillsInstall(install) {
31488
31221
  return new Promise((resolve15) => {
31489
- const child = (0, import_node_child_process7.spawn)(install.command, install.args, {
31222
+ const child = (0, import_node_child_process6.spawn)(install.command, install.args, {
31490
31223
  stdio: ["ignore", "ignore", "pipe"],
31491
31224
  env: process.env
31492
31225
  });
@@ -31570,7 +31303,7 @@ function runLegacySkillsCleanup() {
31570
31303
  }
31571
31304
  ];
31572
31305
  for (const candidate of candidates) {
31573
- const result = (0, import_node_child_process7.spawnSync)(candidate.command, candidate.args, {
31306
+ const result = (0, import_node_child_process6.spawnSync)(candidate.command, candidate.args, {
31574
31307
  stdio: "ignore",
31575
31308
  env: process.env,
31576
31309
  shell: process.platform === "win32"
@@ -32006,7 +31739,7 @@ async function runPreflightCheck() {
32006
31739
  };
32007
31740
  }).catch(() => ({ status: "unreachable", version: null })).finally(() => clearTimeout(healthTimeout));
32008
31741
  const apiKey = resolveApiKeyForBaseUrl(baseUrl);
32009
- const http2 = apiKey ? new HttpClient(
31742
+ const http = apiKey ? new HttpClient(
32010
31743
  resolveConfig({
32011
31744
  baseUrl,
32012
31745
  apiKey,
@@ -32014,8 +31747,8 @@ async function runPreflightCheck() {
32014
31747
  maxRetries: 0
32015
31748
  })
32016
31749
  ) : null;
32017
- const [auth, billing] = http2 ? await Promise.all([
32018
- http2.post("/api/v2/auth/cli/status", {
31750
+ const [auth, billing] = http ? await Promise.all([
31751
+ http.post("/api/v2/auth/cli/status", {
32019
31752
  api_key: apiKey,
32020
31753
  reveal: false
32021
31754
  }).catch((error) => ({
@@ -32023,7 +31756,7 @@ async function runPreflightCheck() {
32023
31756
  connected: false,
32024
31757
  error: preflightErrorMessage(error)
32025
31758
  })),
32026
- http2.get("/api/v2/billing/balance").catch((error) => ({
31759
+ http.get("/api/v2/billing/balance").catch((error) => ({
32027
31760
  balance: null,
32028
31761
  balance_display: "unavailable",
32029
31762
  balance_status: "unknown",
@@ -32206,7 +31939,6 @@ Exit codes:
32206
31939
  registerBillingCommands(program);
32207
31940
  registerMonitorsCommands(program);
32208
31941
  registerOrgCommands(program);
32209
- registerAdminCommands(program);
32210
31942
  registerEnrichCommand(program);
32211
31943
  registerCsvCommands(program);
32212
31944
  registerDbCommands(program);
@@ -32376,7 +32108,8 @@ Examples:
32376
32108
  } else {
32377
32109
  console.error(`Error: ${String(error)}`);
32378
32110
  }
32379
- const failureExitCode = resolveSdkCliFailureExitCode(error);
32111
+ const explicitExitCode = error && typeof error === "object" && typeof error.exitCode === "number" ? error.exitCode : void 0;
32112
+ const failureExitCode = explicitExitCode ?? resolveSdkCliFailureExitCode(error);
32380
32113
  process.exitCode = failureExitCode;
32381
32114
  await maybeReportSdkCliFailure({
32382
32115
  argv: process.argv.slice(2),