deepline 0.2.68 → 0.2.70

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.
@@ -69,6 +69,7 @@ import type {
69
69
  PublishPlayVersionResult,
70
70
  StartPlayRunRequest,
71
71
  DeletePlayResult,
72
+ RestorePlayResult,
72
73
  SharePageStatus,
73
74
  PublishSharePageRequest,
74
75
  UpdateSharePageRequest,
@@ -4066,14 +4067,24 @@ export class DeeplineClient {
4066
4067
  }
4067
4068
 
4068
4069
  /**
4069
- * Delete an org-owned play definition, including its revisions, trigger
4070
- * bindings, and local run records. Deepline prebuilt plays are read-only.
4070
+ * Move an org-owned play to Trash. This disables its active triggers while
4071
+ * retaining its revisions and run history so it can be restored. Deepline
4072
+ * prebuilt plays are read-only.
4071
4073
  */
4072
4074
  async deletePlay(name: string): Promise<DeletePlayResult> {
4073
4075
  const encodedName = encodeURIComponent(name);
4074
4076
  return this.http.delete<DeletePlayResult>(`/api/v2/plays/${encodedName}`);
4075
4077
  }
4076
4078
 
4079
+ /** Restore an org-owned play that was previously moved to Trash. */
4080
+ async restorePlay(name: string): Promise<RestorePlayResult> {
4081
+ const encodedName = encodeURIComponent(name);
4082
+ return this.http.post<RestorePlayResult>(
4083
+ `/api/v2/plays/${encodedName}/restore`,
4084
+ {},
4085
+ );
4086
+ }
4087
+
4077
4088
  // ——————————————————————————————————————————————————————————
4078
4089
  // Plays — public share pages
4079
4090
  // ——————————————————————————————————————————————————————————
@@ -183,7 +183,7 @@ export const SDK_RELEASE = {
183
183
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
184
184
  // exposed storage-dependent synchronous access. This deliberate minor
185
185
  // release keeps lazy paging semantics independent of row residency.
186
- version: '0.2.68',
186
+ version: '0.2.70',
187
187
  contracts: {
188
188
  api: {
189
189
  name: 'sdk-http-api',
@@ -1547,14 +1547,24 @@ export interface PublishPlayVersionResult {
1547
1547
  }
1548
1548
 
1549
1549
  /**
1550
- * Result returned after deleting an org-owned play.
1550
+ * Result returned after moving an org-owned play to Trash.
1551
+ *
1552
+ * `deletePlay` is retained as the SDK method name for compatibility, but play
1553
+ * deletion is soft: revisions and run history remain available if the play is
1554
+ * restored.
1551
1555
  */
1552
1556
  export interface DeletePlayResult {
1553
- deleted: boolean;
1557
+ archived: boolean;
1558
+ alreadyArchived: boolean;
1559
+ name: string;
1560
+ archivedBindingCount: number;
1561
+ }
1562
+
1563
+ /** Result returned after restoring an org-owned play from Trash. */
1564
+ export interface RestorePlayResult {
1565
+ restored: boolean;
1566
+ alreadyActive?: boolean;
1554
1567
  name: string;
1555
- deletedRevisionCount: number;
1556
- deletedBindingCount: number;
1557
- deletedRunCount: number;
1558
1568
  }
1559
1569
 
1560
1570
  // ——————————————————————————————————————————————————————————
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,7 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.68",
1047
+ version: "0.2.70",
1048
1048
  contracts: {
1049
1049
  api: {
1050
1050
  name: "sdk-http-api",
@@ -6050,13 +6050,22 @@ var DeeplineClient = class {
6050
6050
  );
6051
6051
  }
6052
6052
  /**
6053
- * Delete an org-owned play definition, including its revisions, trigger
6054
- * bindings, and local run records. Deepline prebuilt plays are read-only.
6053
+ * Move an org-owned play to Trash. This disables its active triggers while
6054
+ * retaining its revisions and run history so it can be restored. Deepline
6055
+ * prebuilt plays are read-only.
6055
6056
  */
6056
6057
  async deletePlay(name) {
6057
6058
  const encodedName = encodeURIComponent(name);
6058
6059
  return this.http.delete(`/api/v2/plays/${encodedName}`);
6059
6060
  }
6061
+ /** Restore an org-owned play that was previously moved to Trash. */
6062
+ async restorePlay(name) {
6063
+ const encodedName = encodeURIComponent(name);
6064
+ return this.http.post(
6065
+ `/api/v2/plays/${encodedName}/restore`,
6066
+ {}
6067
+ );
6068
+ }
6060
6069
  // ——————————————————————————————————————————————————————————
6061
6070
  // Plays — public share pages
6062
6071
  // ——————————————————————————————————————————————————————————
@@ -7533,6 +7542,23 @@ async function httpJson(method, url, apiKey, body) {
7533
7542
  }
7534
7543
  return { status: response.status, data };
7535
7544
  }
7545
+ async function reportSetupCompleted(input2) {
7546
+ const apiKey = input2.authScope === "folder" ? resolveProjectApiKeyForBaseUrl(input2.baseUrl) : resolveGlobalApiKeyForBaseUrl(input2.baseUrl);
7547
+ if (!apiKey) return;
7548
+ try {
7549
+ await httpJson(
7550
+ "POST",
7551
+ `${input2.baseUrl}/api/v2/telemetry/setup-completed`,
7552
+ apiKey,
7553
+ {
7554
+ scope: input2.scope,
7555
+ resumed: input2.resumed,
7556
+ installed_agent_count: input2.installedAgentCount
7557
+ }
7558
+ );
7559
+ } catch {
7560
+ }
7561
+ }
7536
7562
  function buildCandidateUrls2(url) {
7537
7563
  try {
7538
7564
  const parsed = new URL(url);
@@ -24656,15 +24682,32 @@ async function handlePlayPublish(args) {
24656
24682
  async function handlePlayDelete(args) {
24657
24683
  const playName = args[0];
24658
24684
  if (!playName) {
24659
- console.error("Usage: deepline plays delete <play-name> --yes [--json]");
24660
- return 1;
24685
+ console.error(
24686
+ "Usage: deepline plays delete <play-name> --yes [--dry-run] [--json]"
24687
+ );
24688
+ return 2;
24689
+ }
24690
+ if (looksLikeRunId(playName)) {
24691
+ console.error(
24692
+ formatPlayCommandReceivedRunIdError({
24693
+ command: "delete",
24694
+ runId: playName
24695
+ })
24696
+ );
24697
+ return 2;
24661
24698
  }
24662
- const confirmed = args.includes("--yes") || args.includes("-y") || args.includes("--force");
24699
+ if (isFileTarget(playName) || looksLikeFilePath(playName)) {
24700
+ console.error(
24701
+ "Refusing to delete a local file. This command only moves a saved org-owned play to Trash."
24702
+ );
24703
+ return 2;
24704
+ }
24705
+ const confirmed = args.includes("--yes") || args.includes("-y");
24663
24706
  if (!confirmed) {
24664
24707
  console.error(
24665
- "Refusing to delete without --yes. This deletes the org-owned play, its revisions, trigger bindings, and local run records."
24708
+ "Refusing to move the play to Trash without --yes. This stops active triggers; the play can be restored later."
24666
24709
  );
24667
- return 1;
24710
+ return 2;
24668
24711
  }
24669
24712
  const client2 = new DeeplineClient();
24670
24713
  let detail;
@@ -24672,27 +24715,103 @@ async function handlePlayDelete(args) {
24672
24715
  detail = await client2.getPlay(parseReferencedPlayTarget2(playName).playName);
24673
24716
  } catch (error) {
24674
24717
  console.error(error instanceof Error ? error.message : String(error));
24675
- return 1;
24718
+ return 5;
24676
24719
  }
24677
24720
  if (detail.play.ownerType === "deepline" || detail.play.origin === "prebuilt") {
24678
24721
  console.error(
24679
- `Cannot delete prebuilt play: ${formatPlayReference(detail.play)}`
24722
+ `Cannot move prebuilt play to Trash: ${formatPlayReference(detail.play)}`
24680
24723
  );
24681
- return 1;
24724
+ return 2;
24682
24725
  }
24683
- const result = await client2.deletePlay(
24684
- parseReferencedPlayTarget2(formatPlayReference(detail.play)).playName
24685
- );
24726
+ const resolvedName = parseReferencedPlayTarget2(
24727
+ formatPlayReference(detail.play)
24728
+ ).playName;
24729
+ if (args.includes("--dry-run")) {
24730
+ const result2 = {
24731
+ ok: true,
24732
+ dryRun: true,
24733
+ name: resolvedName,
24734
+ plannedMutation: "move saved org-owned play to Trash and stop triggers"
24735
+ };
24736
+ if (argsWantJson(args)) {
24737
+ process.stdout.write(`${JSON.stringify(result2)}
24738
+ `);
24739
+ } else {
24740
+ process.stdout.write(
24741
+ `Dry run: would move ${result2.name} to Trash and stop its active triggers.
24742
+ `
24743
+ );
24744
+ }
24745
+ return 0;
24746
+ }
24747
+ const result = await client2.deletePlay(resolvedName);
24686
24748
  if (argsWantJson(args)) {
24687
24749
  process.stdout.write(`${JSON.stringify(result)}
24688
24750
  `);
24689
- return result.deleted ? 0 : 1;
24751
+ return result.archived || result.alreadyArchived ? 0 : 4;
24752
+ }
24753
+ if (result.alreadyArchived) {
24754
+ process.stdout.write(`Play ${result.name} is already in Trash.
24755
+ `);
24756
+ return 0;
24757
+ }
24758
+ if (!result.archived) {
24759
+ console.error(`Play not found: ${result.name}`);
24760
+ return 4;
24690
24761
  }
24691
24762
  process.stdout.write(
24692
- `Deleted ${result.name}: revisions=${result.deletedRevisionCount}, bindings=${result.deletedBindingCount}, runs=${result.deletedRunCount}
24763
+ `Moved ${result.name} to Trash: stopped bindings=${result.archivedBindingCount}
24693
24764
  `
24694
24765
  );
24695
- return result.deleted ? 0 : 1;
24766
+ return 0;
24767
+ }
24768
+ async function handlePlayRestore(args) {
24769
+ const playName = args[0];
24770
+ if (!playName) {
24771
+ console.error("Usage: deepline plays restore <play-name> [--json]");
24772
+ return 2;
24773
+ }
24774
+ if (looksLikeRunId(playName)) {
24775
+ console.error(
24776
+ formatPlayCommandReceivedRunIdError({
24777
+ command: "restore",
24778
+ runId: playName
24779
+ })
24780
+ );
24781
+ return 2;
24782
+ }
24783
+ if (isFileTarget(playName) || looksLikeFilePath(playName)) {
24784
+ console.error(
24785
+ "Refusing to restore a local file. This command only restores a saved org-owned play from Trash."
24786
+ );
24787
+ return 2;
24788
+ }
24789
+ const client2 = new DeeplineClient();
24790
+ try {
24791
+ const result = await client2.restorePlay(
24792
+ parseReferencedPlayTarget2(playName).playName
24793
+ );
24794
+ if (argsWantJson(args)) {
24795
+ process.stdout.write(`${JSON.stringify(result)}
24796
+ `);
24797
+ return result.restored || result.alreadyActive ? 0 : 4;
24798
+ }
24799
+ if (result.alreadyActive) {
24800
+ process.stdout.write(`Play ${result.name} is already active.
24801
+ `);
24802
+ return 0;
24803
+ }
24804
+ if (!result.restored) {
24805
+ console.error(`Play not found: ${result.name}`);
24806
+ return 4;
24807
+ }
24808
+ process.stdout.write(`Restored ${result.name} from Trash.
24809
+ `);
24810
+ return 0;
24811
+ } catch (error) {
24812
+ console.error(error instanceof Error ? error.message : String(error));
24813
+ return 5;
24814
+ }
24696
24815
  }
24697
24816
  function registerPlayCommands(program) {
24698
24817
  const play = program.command("plays").description("Search, validate, run, and manage cloud plays.").addHelpText(
@@ -25077,21 +25196,40 @@ Examples:
25077
25196
  ...options.json ? ["--json"] : []
25078
25197
  ]);
25079
25198
  });
25080
- play.command("delete <target>").description("Delete an org-owned play and its saved revisions/runs.").addHelpText(
25199
+ play.command("delete <target>").description("Move an org-owned play to Trash and stop its triggers.").addHelpText(
25081
25200
  "after",
25082
25201
  `
25083
25202
  Notes:
25084
- Destructive mutation. Deletes an org-owned play plus saved revisions and run
25085
- records. Prebuilt/read-only plays are refused. Use --yes for noninteractive runs.
25203
+ Soft delete. Moves an org-owned play to Trash and stops active triggers while
25204
+ retaining revisions and run history. Prebuilt/read-only plays are refused.
25205
+ Use --yes for noninteractive runs. Restore later with \`plays restore\`.
25086
25206
 
25087
25207
  Examples:
25088
- deepline plays delete my-play
25208
+ deepline plays delete my-play --yes
25089
25209
  deepline plays delete my-play --yes --json
25210
+ deepline plays delete my-play --yes --dry-run --json
25090
25211
  `
25091
- ).option("-y, --yes", "Confirm deletion").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (target, options) => {
25212
+ ).option("-y, --yes", "Confirm deletion").option("--dry-run", "Show the planned archive without mutating the play").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (target, options) => {
25092
25213
  process.exitCode = await handlePlayDelete([
25093
25214
  target,
25094
25215
  ...options.yes ? ["--yes"] : [],
25216
+ ...options.dryRun ? ["--dry-run"] : [],
25217
+ ...options.json ? ["--json"] : []
25218
+ ]);
25219
+ });
25220
+ play.command("restore <target>").description("Restore an org-owned play from Trash.").addHelpText(
25221
+ "after",
25222
+ `
25223
+ Notes:
25224
+ Restoring re-enables the saved play and recreates its trigger bindings.
25225
+
25226
+ Examples:
25227
+ deepline plays restore my-play
25228
+ deepline plays restore my-play --json
25229
+ `
25230
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (target, options) => {
25231
+ process.exitCode = await handlePlayRestore([
25232
+ target,
25095
25233
  ...options.json ? ["--json"] : []
25096
25234
  ]);
25097
25235
  });
@@ -35195,6 +35333,16 @@ async function runSetupCommand(options) {
35195
35333
  status: "complete",
35196
35334
  phases
35197
35335
  });
35336
+ const installedAgents = Array.isArray(skillsPayload?.agents) ? skillsPayload.agents.filter(
35337
+ (agent) => typeof agent === "string"
35338
+ ) : [];
35339
+ await reportSetupCompleted({
35340
+ baseUrl,
35341
+ authScope,
35342
+ scope,
35343
+ resumed,
35344
+ installedAgentCount: installedAgents.length
35345
+ });
35198
35346
  const doctorChecks = asRecord3(doctorPayload?.checks);
35199
35347
  const apiCheck = asRecord3(doctorChecks?.api);
35200
35348
  printCommandEnvelope(
@@ -35204,7 +35352,7 @@ async function runSetupCommand(options) {
35204
35352
  complete: true,
35205
35353
  scope,
35206
35354
  cliVersion: SDK_VERSION,
35207
- agents: skillsPayload?.agents ?? [],
35355
+ agents: installedAgents,
35208
35356
  workspace: apiCheck?.workspace ?? null,
35209
35357
  rollbackCommand: rollbackCommand(scope, root),
35210
35358
  statePath,
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
1030
1030
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1031
1031
  // exposed storage-dependent synchronous access. This deliberate minor
1032
1032
  // release keeps lazy paging semantics independent of row residency.
1033
- version: "0.2.68",
1033
+ version: "0.2.70",
1034
1034
  contracts: {
1035
1035
  api: {
1036
1036
  name: "sdk-http-api",
@@ -6036,13 +6036,22 @@ var DeeplineClient = class {
6036
6036
  );
6037
6037
  }
6038
6038
  /**
6039
- * Delete an org-owned play definition, including its revisions, trigger
6040
- * bindings, and local run records. Deepline prebuilt plays are read-only.
6039
+ * Move an org-owned play to Trash. This disables its active triggers while
6040
+ * retaining its revisions and run history so it can be restored. Deepline
6041
+ * prebuilt plays are read-only.
6041
6042
  */
6042
6043
  async deletePlay(name) {
6043
6044
  const encodedName = encodeURIComponent(name);
6044
6045
  return this.http.delete(`/api/v2/plays/${encodedName}`);
6045
6046
  }
6047
+ /** Restore an org-owned play that was previously moved to Trash. */
6048
+ async restorePlay(name) {
6049
+ const encodedName = encodeURIComponent(name);
6050
+ return this.http.post(
6051
+ `/api/v2/plays/${encodedName}/restore`,
6052
+ {}
6053
+ );
6054
+ }
6046
6055
  // ——————————————————————————————————————————————————————————
6047
6056
  // Plays — public share pages
6048
6057
  // ——————————————————————————————————————————————————————————
@@ -7531,6 +7540,23 @@ async function httpJson(method, url, apiKey, body) {
7531
7540
  }
7532
7541
  return { status: response.status, data };
7533
7542
  }
7543
+ async function reportSetupCompleted(input2) {
7544
+ const apiKey = input2.authScope === "folder" ? resolveProjectApiKeyForBaseUrl(input2.baseUrl) : resolveGlobalApiKeyForBaseUrl(input2.baseUrl);
7545
+ if (!apiKey) return;
7546
+ try {
7547
+ await httpJson(
7548
+ "POST",
7549
+ `${input2.baseUrl}/api/v2/telemetry/setup-completed`,
7550
+ apiKey,
7551
+ {
7552
+ scope: input2.scope,
7553
+ resumed: input2.resumed,
7554
+ installed_agent_count: input2.installedAgentCount
7555
+ }
7556
+ );
7557
+ } catch {
7558
+ }
7559
+ }
7534
7560
  function buildCandidateUrls2(url) {
7535
7561
  try {
7536
7562
  const parsed = new URL(url);
@@ -24708,15 +24734,32 @@ async function handlePlayPublish(args) {
24708
24734
  async function handlePlayDelete(args) {
24709
24735
  const playName = args[0];
24710
24736
  if (!playName) {
24711
- console.error("Usage: deepline plays delete <play-name> --yes [--json]");
24712
- return 1;
24737
+ console.error(
24738
+ "Usage: deepline plays delete <play-name> --yes [--dry-run] [--json]"
24739
+ );
24740
+ return 2;
24741
+ }
24742
+ if (looksLikeRunId(playName)) {
24743
+ console.error(
24744
+ formatPlayCommandReceivedRunIdError({
24745
+ command: "delete",
24746
+ runId: playName
24747
+ })
24748
+ );
24749
+ return 2;
24713
24750
  }
24714
- const confirmed = args.includes("--yes") || args.includes("-y") || args.includes("--force");
24751
+ if (isFileTarget(playName) || looksLikeFilePath(playName)) {
24752
+ console.error(
24753
+ "Refusing to delete a local file. This command only moves a saved org-owned play to Trash."
24754
+ );
24755
+ return 2;
24756
+ }
24757
+ const confirmed = args.includes("--yes") || args.includes("-y");
24715
24758
  if (!confirmed) {
24716
24759
  console.error(
24717
- "Refusing to delete without --yes. This deletes the org-owned play, its revisions, trigger bindings, and local run records."
24760
+ "Refusing to move the play to Trash without --yes. This stops active triggers; the play can be restored later."
24718
24761
  );
24719
- return 1;
24762
+ return 2;
24720
24763
  }
24721
24764
  const client2 = new DeeplineClient();
24722
24765
  let detail;
@@ -24724,27 +24767,103 @@ async function handlePlayDelete(args) {
24724
24767
  detail = await client2.getPlay(parseReferencedPlayTarget2(playName).playName);
24725
24768
  } catch (error) {
24726
24769
  console.error(error instanceof Error ? error.message : String(error));
24727
- return 1;
24770
+ return 5;
24728
24771
  }
24729
24772
  if (detail.play.ownerType === "deepline" || detail.play.origin === "prebuilt") {
24730
24773
  console.error(
24731
- `Cannot delete prebuilt play: ${formatPlayReference(detail.play)}`
24774
+ `Cannot move prebuilt play to Trash: ${formatPlayReference(detail.play)}`
24732
24775
  );
24733
- return 1;
24776
+ return 2;
24734
24777
  }
24735
- const result = await client2.deletePlay(
24736
- parseReferencedPlayTarget2(formatPlayReference(detail.play)).playName
24737
- );
24778
+ const resolvedName = parseReferencedPlayTarget2(
24779
+ formatPlayReference(detail.play)
24780
+ ).playName;
24781
+ if (args.includes("--dry-run")) {
24782
+ const result2 = {
24783
+ ok: true,
24784
+ dryRun: true,
24785
+ name: resolvedName,
24786
+ plannedMutation: "move saved org-owned play to Trash and stop triggers"
24787
+ };
24788
+ if (argsWantJson(args)) {
24789
+ process.stdout.write(`${JSON.stringify(result2)}
24790
+ `);
24791
+ } else {
24792
+ process.stdout.write(
24793
+ `Dry run: would move ${result2.name} to Trash and stop its active triggers.
24794
+ `
24795
+ );
24796
+ }
24797
+ return 0;
24798
+ }
24799
+ const result = await client2.deletePlay(resolvedName);
24738
24800
  if (argsWantJson(args)) {
24739
24801
  process.stdout.write(`${JSON.stringify(result)}
24740
24802
  `);
24741
- return result.deleted ? 0 : 1;
24803
+ return result.archived || result.alreadyArchived ? 0 : 4;
24804
+ }
24805
+ if (result.alreadyArchived) {
24806
+ process.stdout.write(`Play ${result.name} is already in Trash.
24807
+ `);
24808
+ return 0;
24809
+ }
24810
+ if (!result.archived) {
24811
+ console.error(`Play not found: ${result.name}`);
24812
+ return 4;
24742
24813
  }
24743
24814
  process.stdout.write(
24744
- `Deleted ${result.name}: revisions=${result.deletedRevisionCount}, bindings=${result.deletedBindingCount}, runs=${result.deletedRunCount}
24815
+ `Moved ${result.name} to Trash: stopped bindings=${result.archivedBindingCount}
24745
24816
  `
24746
24817
  );
24747
- return result.deleted ? 0 : 1;
24818
+ return 0;
24819
+ }
24820
+ async function handlePlayRestore(args) {
24821
+ const playName = args[0];
24822
+ if (!playName) {
24823
+ console.error("Usage: deepline plays restore <play-name> [--json]");
24824
+ return 2;
24825
+ }
24826
+ if (looksLikeRunId(playName)) {
24827
+ console.error(
24828
+ formatPlayCommandReceivedRunIdError({
24829
+ command: "restore",
24830
+ runId: playName
24831
+ })
24832
+ );
24833
+ return 2;
24834
+ }
24835
+ if (isFileTarget(playName) || looksLikeFilePath(playName)) {
24836
+ console.error(
24837
+ "Refusing to restore a local file. This command only restores a saved org-owned play from Trash."
24838
+ );
24839
+ return 2;
24840
+ }
24841
+ const client2 = new DeeplineClient();
24842
+ try {
24843
+ const result = await client2.restorePlay(
24844
+ parseReferencedPlayTarget2(playName).playName
24845
+ );
24846
+ if (argsWantJson(args)) {
24847
+ process.stdout.write(`${JSON.stringify(result)}
24848
+ `);
24849
+ return result.restored || result.alreadyActive ? 0 : 4;
24850
+ }
24851
+ if (result.alreadyActive) {
24852
+ process.stdout.write(`Play ${result.name} is already active.
24853
+ `);
24854
+ return 0;
24855
+ }
24856
+ if (!result.restored) {
24857
+ console.error(`Play not found: ${result.name}`);
24858
+ return 4;
24859
+ }
24860
+ process.stdout.write(`Restored ${result.name} from Trash.
24861
+ `);
24862
+ return 0;
24863
+ } catch (error) {
24864
+ console.error(error instanceof Error ? error.message : String(error));
24865
+ return 5;
24866
+ }
24748
24867
  }
24749
24868
  function registerPlayCommands(program) {
24750
24869
  const play = program.command("plays").description("Search, validate, run, and manage cloud plays.").addHelpText(
@@ -25129,21 +25248,40 @@ Examples:
25129
25248
  ...options.json ? ["--json"] : []
25130
25249
  ]);
25131
25250
  });
25132
- play.command("delete <target>").description("Delete an org-owned play and its saved revisions/runs.").addHelpText(
25251
+ play.command("delete <target>").description("Move an org-owned play to Trash and stop its triggers.").addHelpText(
25133
25252
  "after",
25134
25253
  `
25135
25254
  Notes:
25136
- Destructive mutation. Deletes an org-owned play plus saved revisions and run
25137
- records. Prebuilt/read-only plays are refused. Use --yes for noninteractive runs.
25255
+ Soft delete. Moves an org-owned play to Trash and stops active triggers while
25256
+ retaining revisions and run history. Prebuilt/read-only plays are refused.
25257
+ Use --yes for noninteractive runs. Restore later with \`plays restore\`.
25138
25258
 
25139
25259
  Examples:
25140
- deepline plays delete my-play
25260
+ deepline plays delete my-play --yes
25141
25261
  deepline plays delete my-play --yes --json
25262
+ deepline plays delete my-play --yes --dry-run --json
25142
25263
  `
25143
- ).option("-y, --yes", "Confirm deletion").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (target, options) => {
25264
+ ).option("-y, --yes", "Confirm deletion").option("--dry-run", "Show the planned archive without mutating the play").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (target, options) => {
25144
25265
  process.exitCode = await handlePlayDelete([
25145
25266
  target,
25146
25267
  ...options.yes ? ["--yes"] : [],
25268
+ ...options.dryRun ? ["--dry-run"] : [],
25269
+ ...options.json ? ["--json"] : []
25270
+ ]);
25271
+ });
25272
+ play.command("restore <target>").description("Restore an org-owned play from Trash.").addHelpText(
25273
+ "after",
25274
+ `
25275
+ Notes:
25276
+ Restoring re-enables the saved play and recreates its trigger bindings.
25277
+
25278
+ Examples:
25279
+ deepline plays restore my-play
25280
+ deepline plays restore my-play --json
25281
+ `
25282
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (target, options) => {
25283
+ process.exitCode = await handlePlayRestore([
25284
+ target,
25147
25285
  ...options.json ? ["--json"] : []
25148
25286
  ]);
25149
25287
  });
@@ -35262,6 +35400,16 @@ async function runSetupCommand(options) {
35262
35400
  status: "complete",
35263
35401
  phases
35264
35402
  });
35403
+ const installedAgents = Array.isArray(skillsPayload?.agents) ? skillsPayload.agents.filter(
35404
+ (agent) => typeof agent === "string"
35405
+ ) : [];
35406
+ await reportSetupCompleted({
35407
+ baseUrl,
35408
+ authScope,
35409
+ scope,
35410
+ resumed,
35411
+ installedAgentCount: installedAgents.length
35412
+ });
35265
35413
  const doctorChecks = asRecord3(doctorPayload?.checks);
35266
35414
  const apiCheck = asRecord3(doctorChecks?.api);
35267
35415
  printCommandEnvelope(
@@ -35271,7 +35419,7 @@ async function runSetupCommand(options) {
35271
35419
  complete: true,
35272
35420
  scope,
35273
35421
  cliVersion: SDK_VERSION,
35274
- agents: skillsPayload?.agents ?? [],
35422
+ agents: installedAgents,
35275
35423
  workspace: apiCheck?.workspace ?? null,
35276
35424
  rollbackCommand: rollbackCommand(scope, root),
35277
35425
  statePath,
package/dist/index.d.mts CHANGED
@@ -1634,14 +1634,23 @@ interface PublishPlayVersionResult {
1634
1634
  triggerBindings?: unknown;
1635
1635
  }
1636
1636
  /**
1637
- * Result returned after deleting an org-owned play.
1637
+ * Result returned after moving an org-owned play to Trash.
1638
+ *
1639
+ * `deletePlay` is retained as the SDK method name for compatibility, but play
1640
+ * deletion is soft: revisions and run history remain available if the play is
1641
+ * restored.
1638
1642
  */
1639
1643
  interface DeletePlayResult {
1640
- deleted: boolean;
1644
+ archived: boolean;
1645
+ alreadyArchived: boolean;
1646
+ name: string;
1647
+ archivedBindingCount: number;
1648
+ }
1649
+ /** Result returned after restoring an org-owned play from Trash. */
1650
+ interface RestorePlayResult {
1651
+ restored: boolean;
1652
+ alreadyActive?: boolean;
1641
1653
  name: string;
1642
- deletedRevisionCount: number;
1643
- deletedBindingCount: number;
1644
- deletedRunCount: number;
1645
1654
  }
1646
1655
  /** Owner-facing view of a play's public share page. */
1647
1656
  interface SharePageOwnerView {
@@ -3428,10 +3437,13 @@ declare class DeeplineClient {
3428
3437
  */
3429
3438
  publishPlayVersion(name: string, request?: PublishPlayVersionRequest): Promise<PublishPlayVersionResult>;
3430
3439
  /**
3431
- * Delete an org-owned play definition, including its revisions, trigger
3432
- * bindings, and local run records. Deepline prebuilt plays are read-only.
3440
+ * Move an org-owned play to Trash. This disables its active triggers while
3441
+ * retaining its revisions and run history so it can be restored. Deepline
3442
+ * prebuilt plays are read-only.
3433
3443
  */
3434
3444
  deletePlay(name: string): Promise<DeletePlayResult>;
3445
+ /** Restore an org-owned play that was previously moved to Trash. */
3446
+ restorePlay(name: string): Promise<RestorePlayResult>;
3435
3447
  /**
3436
3448
  * Current share status for a play: the public page (if any), the published
3437
3449
  * copy, and the revision picker. Read-only.
package/dist/index.d.ts CHANGED
@@ -1634,14 +1634,23 @@ interface PublishPlayVersionResult {
1634
1634
  triggerBindings?: unknown;
1635
1635
  }
1636
1636
  /**
1637
- * Result returned after deleting an org-owned play.
1637
+ * Result returned after moving an org-owned play to Trash.
1638
+ *
1639
+ * `deletePlay` is retained as the SDK method name for compatibility, but play
1640
+ * deletion is soft: revisions and run history remain available if the play is
1641
+ * restored.
1638
1642
  */
1639
1643
  interface DeletePlayResult {
1640
- deleted: boolean;
1644
+ archived: boolean;
1645
+ alreadyArchived: boolean;
1646
+ name: string;
1647
+ archivedBindingCount: number;
1648
+ }
1649
+ /** Result returned after restoring an org-owned play from Trash. */
1650
+ interface RestorePlayResult {
1651
+ restored: boolean;
1652
+ alreadyActive?: boolean;
1641
1653
  name: string;
1642
- deletedRevisionCount: number;
1643
- deletedBindingCount: number;
1644
- deletedRunCount: number;
1645
1654
  }
1646
1655
  /** Owner-facing view of a play's public share page. */
1647
1656
  interface SharePageOwnerView {
@@ -3428,10 +3437,13 @@ declare class DeeplineClient {
3428
3437
  */
3429
3438
  publishPlayVersion(name: string, request?: PublishPlayVersionRequest): Promise<PublishPlayVersionResult>;
3430
3439
  /**
3431
- * Delete an org-owned play definition, including its revisions, trigger
3432
- * bindings, and local run records. Deepline prebuilt plays are read-only.
3440
+ * Move an org-owned play to Trash. This disables its active triggers while
3441
+ * retaining its revisions and run history so it can be restored. Deepline
3442
+ * prebuilt plays are read-only.
3433
3443
  */
3434
3444
  deletePlay(name: string): Promise<DeletePlayResult>;
3445
+ /** Restore an org-owned play that was previously moved to Trash. */
3446
+ restorePlay(name: string): Promise<RestorePlayResult>;
3435
3447
  /**
3436
3448
  * Current share status for a play: the public page (if any), the published
3437
3449
  * copy, and the revision picker. Read-only.
package/dist/index.js CHANGED
@@ -780,7 +780,7 @@ var SDK_RELEASE = {
780
780
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
781
781
  // exposed storage-dependent synchronous access. This deliberate minor
782
782
  // release keeps lazy paging semantics independent of row residency.
783
- version: "0.2.68",
783
+ version: "0.2.70",
784
784
  contracts: {
785
785
  api: {
786
786
  name: "sdk-http-api",
@@ -5786,13 +5786,22 @@ var DeeplineClient = class {
5786
5786
  );
5787
5787
  }
5788
5788
  /**
5789
- * Delete an org-owned play definition, including its revisions, trigger
5790
- * bindings, and local run records. Deepline prebuilt plays are read-only.
5789
+ * Move an org-owned play to Trash. This disables its active triggers while
5790
+ * retaining its revisions and run history so it can be restored. Deepline
5791
+ * prebuilt plays are read-only.
5791
5792
  */
5792
5793
  async deletePlay(name) {
5793
5794
  const encodedName = encodeURIComponent(name);
5794
5795
  return this.http.delete(`/api/v2/plays/${encodedName}`);
5795
5796
  }
5797
+ /** Restore an org-owned play that was previously moved to Trash. */
5798
+ async restorePlay(name) {
5799
+ const encodedName = encodeURIComponent(name);
5800
+ return this.http.post(
5801
+ `/api/v2/plays/${encodedName}/restore`,
5802
+ {}
5803
+ );
5804
+ }
5796
5805
  // ——————————————————————————————————————————————————————————
5797
5806
  // Plays — public share pages
5798
5807
  // ——————————————————————————————————————————————————————————
package/dist/index.mjs CHANGED
@@ -703,7 +703,7 @@ var SDK_RELEASE = {
703
703
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
704
704
  // exposed storage-dependent synchronous access. This deliberate minor
705
705
  // release keeps lazy paging semantics independent of row residency.
706
- version: "0.2.68",
706
+ version: "0.2.70",
707
707
  contracts: {
708
708
  api: {
709
709
  name: "sdk-http-api",
@@ -5709,13 +5709,22 @@ var DeeplineClient = class {
5709
5709
  );
5710
5710
  }
5711
5711
  /**
5712
- * Delete an org-owned play definition, including its revisions, trigger
5713
- * bindings, and local run records. Deepline prebuilt plays are read-only.
5712
+ * Move an org-owned play to Trash. This disables its active triggers while
5713
+ * retaining its revisions and run history so it can be restored. Deepline
5714
+ * prebuilt plays are read-only.
5714
5715
  */
5715
5716
  async deletePlay(name) {
5716
5717
  const encodedName = encodeURIComponent(name);
5717
5718
  return this.http.delete(`/api/v2/plays/${encodedName}`);
5718
5719
  }
5720
+ /** Restore an org-owned play that was previously moved to Trash. */
5721
+ async restorePlay(name) {
5722
+ const encodedName = encodeURIComponent(name);
5723
+ return this.http.post(
5724
+ `/api/v2/plays/${encodedName}/restore`,
5725
+ {}
5726
+ );
5727
+ }
5719
5728
  // ——————————————————————————————————————————————————————————
5720
5729
  // Plays — public share pages
5721
5730
  // ——————————————————————————————————————————————————————————
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.68",
3
+ "version": "0.2.70",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",