deepline 0.1.12 → 0.1.20

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.
Files changed (82) hide show
  1. package/README.md +14 -6
  2. package/dist/cli/index.js +1346 -717
  3. package/dist/cli/index.mjs +1342 -713
  4. package/dist/index.d.mts +199 -23
  5. package/dist/index.d.ts +199 -23
  6. package/dist/index.js +221 -14
  7. package/dist/index.mjs +221 -14
  8. package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +214 -77
  9. package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +85 -60
  10. package/dist/repo/apps/play-runner-workers/src/entry.ts +385 -66
  11. package/dist/repo/sdk/src/client.ts +237 -0
  12. package/dist/repo/sdk/src/config.ts +125 -8
  13. package/dist/repo/sdk/src/http.ts +29 -5
  14. package/dist/repo/sdk/src/play.ts +19 -36
  15. package/dist/repo/sdk/src/plays/bundle-play-file.ts +22 -8
  16. package/dist/repo/sdk/src/plays/local-file-discovery.ts +207 -160
  17. package/dist/repo/sdk/src/types.ts +25 -0
  18. package/dist/repo/sdk/src/version.ts +2 -2
  19. package/dist/repo/shared_libs/play-runtime/tool-result.ts +237 -145
  20. package/dist/repo/shared_libs/plays/bundling/index.ts +206 -229
  21. package/dist/repo/shared_libs/plays/dataset.ts +28 -0
  22. package/dist/repo/shared_libs/plays/row-identity.ts +59 -4
  23. package/package.json +5 -4
  24. package/dist/cli/index.js.map +0 -1
  25. package/dist/cli/index.mjs.map +0 -1
  26. package/dist/index.js.map +0 -1
  27. package/dist/index.mjs.map +0 -1
  28. package/dist/repo/apps/play-runner-workers/src/runtime/README.md +0 -21
  29. package/dist/repo/apps/play-runner-workers/src/runtime/batching.ts +0 -177
  30. package/dist/repo/apps/play-runner-workers/src/runtime/execution-plan.ts +0 -52
  31. package/dist/repo/apps/play-runner-workers/src/runtime/tool-batch.ts +0 -100
  32. package/dist/repo/sdk/src/cli/commands/auth.ts +0 -500
  33. package/dist/repo/sdk/src/cli/commands/billing.ts +0 -188
  34. package/dist/repo/sdk/src/cli/commands/csv.ts +0 -123
  35. package/dist/repo/sdk/src/cli/commands/db.ts +0 -119
  36. package/dist/repo/sdk/src/cli/commands/feedback.ts +0 -40
  37. package/dist/repo/sdk/src/cli/commands/org.ts +0 -117
  38. package/dist/repo/sdk/src/cli/commands/play.ts +0 -3441
  39. package/dist/repo/sdk/src/cli/commands/tools.ts +0 -687
  40. package/dist/repo/sdk/src/cli/dataset-stats.ts +0 -415
  41. package/dist/repo/sdk/src/cli/index.ts +0 -148
  42. package/dist/repo/sdk/src/cli/progress.ts +0 -149
  43. package/dist/repo/sdk/src/cli/skills-sync.ts +0 -141
  44. package/dist/repo/sdk/src/cli/trace.ts +0 -61
  45. package/dist/repo/sdk/src/cli/utils.ts +0 -145
  46. package/dist/repo/sdk/src/compat.ts +0 -77
  47. package/dist/repo/shared_libs/observability/node-tracing.ts +0 -129
  48. package/dist/repo/shared_libs/observability/tracing.ts +0 -98
  49. package/dist/repo/shared_libs/play-runtime/context.ts +0 -4242
  50. package/dist/repo/shared_libs/play-runtime/ctx-contract.ts +0 -250
  51. package/dist/repo/shared_libs/play-runtime/ctx-types.ts +0 -725
  52. package/dist/repo/shared_libs/play-runtime/dataset-id.ts +0 -10
  53. package/dist/repo/shared_libs/play-runtime/db-session-crypto.ts +0 -304
  54. package/dist/repo/shared_libs/play-runtime/db-session.ts +0 -462
  55. package/dist/repo/shared_libs/play-runtime/live-events.ts +0 -214
  56. package/dist/repo/shared_libs/play-runtime/live-state-contract.ts +0 -50
  57. package/dist/repo/shared_libs/play-runtime/map-execution-frame.ts +0 -114
  58. package/dist/repo/shared_libs/play-runtime/map-row-identity.ts +0 -158
  59. package/dist/repo/shared_libs/play-runtime/progress-emitter.ts +0 -172
  60. package/dist/repo/shared_libs/play-runtime/protocol.ts +0 -121
  61. package/dist/repo/shared_libs/play-runtime/public-play-contract.ts +0 -42
  62. package/dist/repo/shared_libs/play-runtime/result-normalization.ts +0 -33
  63. package/dist/repo/shared_libs/play-runtime/runtime-api.ts +0 -1873
  64. package/dist/repo/shared_libs/play-runtime/runtime-constraints.ts +0 -2
  65. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +0 -201
  66. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver-pg.ts +0 -48
  67. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver.ts +0 -84
  68. package/dist/repo/shared_libs/play-runtime/static-pipeline-types.ts +0 -147
  69. package/dist/repo/shared_libs/play-runtime/suspension.ts +0 -68
  70. package/dist/repo/shared_libs/play-runtime/tracing.ts +0 -31
  71. package/dist/repo/shared_libs/play-runtime/waterfall-replay.ts +0 -75
  72. package/dist/repo/shared_libs/play-runtime/worker-api-types.ts +0 -140
  73. package/dist/repo/shared_libs/plays/artifact-transport.ts +0 -14
  74. package/dist/repo/shared_libs/plays/artifact-types.ts +0 -49
  75. package/dist/repo/shared_libs/plays/compiler-manifest.ts +0 -186
  76. package/dist/repo/shared_libs/plays/definition.ts +0 -264
  77. package/dist/repo/shared_libs/plays/file-refs.ts +0 -11
  78. package/dist/repo/shared_libs/plays/rate-limit-scheduler.ts +0 -206
  79. package/dist/repo/shared_libs/plays/resolve-static-pipeline.ts +0 -164
  80. package/dist/repo/shared_libs/plays/runtime-validation.ts +0 -395
  81. package/dist/repo/shared_libs/temporal/constants.ts +0 -39
  82. package/dist/repo/shared_libs/temporal/preview-config.ts +0 -153
package/dist/index.mjs CHANGED
@@ -42,6 +42,10 @@ var ConfigError = class extends DeeplineError {
42
42
  var PROD_URL = "https://code.deepline.com";
43
43
  var DEFAULT_TIMEOUT = 6e4;
44
44
  var DEFAULT_MAX_RETRIES = 3;
45
+ var ACTIVE_DEEPLINE_ENV_FILE = ".env.deepline";
46
+ function projectEnvStartDir() {
47
+ return process.env.DEEPLINE_PROJECT_ENV_DIR?.trim() || process.cwd();
48
+ }
45
49
  function baseUrlSlug(baseUrl) {
46
50
  let url;
47
51
  try {
@@ -77,16 +81,52 @@ function parseEnvFile(filePath) {
77
81
  }
78
82
  return env;
79
83
  }
80
- function findNearestWorktreeEnv(startDir = process.cwd()) {
84
+ function findNearestEnvFile(names, startDir = process.cwd()) {
81
85
  let current = resolve(startDir);
82
86
  while (true) {
83
- const values = parseEnvFile(join(current, ".env.worktree"));
84
- if (Object.keys(values).length > 0) return values;
87
+ for (const name of names) {
88
+ const filePath = join(current, name);
89
+ if (existsSync(filePath)) return filePath;
90
+ }
85
91
  const parent = dirname(current);
86
- if (parent === current) return {};
92
+ if (parent === current) return null;
87
93
  current = parent;
88
94
  }
89
95
  }
96
+ function findNearestEnv(names, startDir = process.cwd()) {
97
+ const filePath = findNearestEnvFile(names, startDir);
98
+ return filePath ? parseEnvFile(filePath) : {};
99
+ }
100
+ function findNearestWorktreeEnv(startDir = process.cwd()) {
101
+ return findNearestEnv([".env.worktree"], startDir);
102
+ }
103
+ function resolveProfileEnvFileNames() {
104
+ const explicitProfile = process.env.DEEPLINE_ENV_PROFILE?.trim() || process.env.DEEPLINE_PROFILE?.trim() || "";
105
+ const names = [];
106
+ if (explicitProfile) names.push(`.env.deepline.${explicitProfile}`);
107
+ const nodeEnv = process.env.NODE_ENV?.trim();
108
+ if (nodeEnv === "production") names.push(".env.deepline.prod");
109
+ else if (nodeEnv === "staging") names.push(".env.deepline.staging");
110
+ names.push(ACTIVE_DEEPLINE_ENV_FILE);
111
+ return names;
112
+ }
113
+ function resolveProjectAppEnvFileNames() {
114
+ const nodeEnv = process.env.NODE_ENV?.trim();
115
+ const names = [];
116
+ if (nodeEnv === "production") names.push(".env.prod");
117
+ if (nodeEnv === "staging") names.push(".env.staging");
118
+ names.push(".env.local", ".env");
119
+ return names;
120
+ }
121
+ function resolveBaseUrlFromEnvValues(env) {
122
+ return env.DEEPLINE_ORIGIN_URL?.trim() || env.DEEPLINE_API_BASE_URL?.trim() || "";
123
+ }
124
+ function loadProjectDeeplineEnv() {
125
+ return findNearestEnv(resolveProfileEnvFileNames(), projectEnvStartDir());
126
+ }
127
+ function loadProjectAppEnv() {
128
+ return findNearestEnv(resolveProjectAppEnvFileNames(), projectEnvStartDir());
129
+ }
90
130
  function normalizeWorktreeBaseUrl(baseUrl, worktreeEnv = findNearestWorktreeEnv()) {
91
131
  const trimmed = baseUrl.trim().replace(/\/$/, "");
92
132
  if (!trimmed) return trimmed;
@@ -123,6 +163,10 @@ function autoDetectBaseUrl() {
123
163
  if (envOrigin) return normalizeWorktreeBaseUrl(envOrigin);
124
164
  const envBase = process.env.DEEPLINE_API_BASE_URL?.trim();
125
165
  if (envBase) return normalizeWorktreeBaseUrl(envBase);
166
+ const projectDeeplineBaseUrl = resolveBaseUrlFromEnvValues(loadProjectDeeplineEnv());
167
+ if (projectDeeplineBaseUrl) return normalizeWorktreeBaseUrl(projectDeeplineBaseUrl);
168
+ const projectAppBaseUrl = resolveBaseUrlFromEnvValues(loadProjectAppEnv());
169
+ if (projectAppBaseUrl) return normalizeWorktreeBaseUrl(projectAppBaseUrl);
126
170
  const worktreeBaseUrl = resolveWorktreeBaseUrl();
127
171
  if (worktreeBaseUrl) return worktreeBaseUrl;
128
172
  const globalEnv = loadGlobalCliEnv();
@@ -134,7 +178,9 @@ function resolveConfig(options) {
134
178
  const requestedBaseUrl = options?.baseUrl?.trim() || autoDetectBaseUrl();
135
179
  const baseUrl = normalizeWorktreeBaseUrl(requestedBaseUrl);
136
180
  const cliEnv = loadCliEnv(baseUrl);
137
- const apiKey = options?.apiKey?.trim() || process.env.DEEPLINE_API_KEY?.trim() || cliEnv.DEEPLINE_API_KEY || "";
181
+ const projectDeeplineEnv = loadProjectDeeplineEnv();
182
+ const projectAppEnv = loadProjectAppEnv();
183
+ const apiKey = options?.apiKey?.trim() || process.env.DEEPLINE_API_KEY?.trim() || projectDeeplineEnv.DEEPLINE_API_KEY || projectAppEnv.DEEPLINE_API_KEY || cliEnv.DEEPLINE_API_KEY || "";
138
184
  if (!apiKey) {
139
185
  throw new ConfigError(
140
186
  `No API key found. Set DEEPLINE_API_KEY env var, pass apiKey option, or run: deepline auth register`
@@ -149,8 +195,8 @@ function resolveConfig(options) {
149
195
  }
150
196
 
151
197
  // src/version.ts
152
- var SDK_VERSION = "0.1.12";
153
- var SDK_API_CONTRACT = "2026-04-plays-v1";
198
+ var SDK_VERSION = "0.1.20";
199
+ var SDK_API_CONTRACT = "2026-05-runs-v2";
154
200
 
155
201
  // ../shared_libs/play-runtime/coordinator-headers.ts
156
202
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -256,7 +302,8 @@ var HttpClient = class {
256
302
  parsed = body;
257
303
  }
258
304
  if (!response.ok) {
259
- const msg = typeof parsed === "object" && parsed && "error" in parsed ? String(parsed.error) : `HTTP ${response.status}`;
305
+ const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
306
+ const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
260
307
  throw new DeeplineError(msg, response.status, "API_ERROR", {
261
308
  response: parsed
262
309
  });
@@ -343,8 +390,12 @@ var HttpClient = class {
343
390
  * @param path - API path
344
391
  * @param body - Request body (will be JSON-serialized)
345
392
  */
346
- async post(path, body) {
347
- return this.request(path, { method: "POST", body });
393
+ async post(path, body, headers) {
394
+ return this.request(path, {
395
+ method: "POST",
396
+ body,
397
+ headers
398
+ });
348
399
  }
349
400
  /**
350
401
  * Send a DELETE request.
@@ -424,6 +475,7 @@ function sleep(ms) {
424
475
 
425
476
  // src/client.ts
426
477
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
478
+ var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
427
479
  function isRecord(value) {
428
480
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
429
481
  }
@@ -456,6 +508,7 @@ function mapLegacyTemporalStatus(status) {
456
508
  var DeeplineClient = class {
457
509
  http;
458
510
  config;
511
+ runs;
459
512
  /**
460
513
  * @param options - Optional overrides for API key, base URL, timeout, and retries.
461
514
  * @throws {@link ConfigError} if no API key can be resolved from any source.
@@ -463,6 +516,13 @@ var DeeplineClient = class {
463
516
  constructor(options) {
464
517
  this.config = resolveConfig(options);
465
518
  this.http = new HttpClient(this.config);
519
+ this.runs = {
520
+ get: (runId) => this.getRunStatus(runId),
521
+ list: (options2) => this.listRuns(options2),
522
+ tail: (runId, options2) => this.tailRun(runId, options2),
523
+ logs: (runId, options2) => this.getRunLogs(runId, options2),
524
+ stop: (runId, options2) => this.stopRun(runId, options2)
525
+ };
466
526
  }
467
527
  /** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
468
528
  get baseUrl() {
@@ -551,6 +611,31 @@ var DeeplineClient = class {
551
611
  );
552
612
  return res.tools;
553
613
  }
614
+ /**
615
+ * Search available tools using Deepline's ranked backend search.
616
+ *
617
+ * This is the same discovery surface used by the legacy CLI: it ranks across
618
+ * tool metadata, categories, agent guidance, and input schema fields.
619
+ */
620
+ async searchTools(options = {}) {
621
+ const params = new URLSearchParams();
622
+ const query = options.query?.trim() ?? "";
623
+ params.set("q", query);
624
+ params.set(
625
+ "include_search_debug",
626
+ options.includeSearchDebug ? "true" : "false"
627
+ );
628
+ params.set("search_mode", options.searchMode ?? "v2");
629
+ if (options.categories?.trim()) {
630
+ params.set("categories", options.categories.trim());
631
+ }
632
+ if (options.searchTerms?.trim()) {
633
+ params.set("search_terms", options.searchTerms.trim());
634
+ }
635
+ return this.http.get(
636
+ `/api/v2/integrations/list?${params.toString()}`
637
+ );
638
+ }
554
639
  /**
555
640
  * Get detailed metadata for a single tool.
556
641
  *
@@ -586,12 +671,17 @@ var DeeplineClient = class {
586
671
  * Top-level fields such as `status`, `job_id`, and `billing` describe the
587
672
  * Deepline execution.
588
673
  */
589
- async executeTool(toolId, input) {
674
+ async executeTool(toolId, input, options) {
675
+ const headers = options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : void 0;
590
676
  return this.http.post(
591
677
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
592
- { payload: input }
678
+ { payload: input },
679
+ headers
593
680
  );
594
681
  }
682
+ async executeToolRaw(toolId, input, options) {
683
+ return this.executeTool(toolId, input, options);
684
+ }
595
685
  async queryCustomerDb(input) {
596
686
  return this.http.post("/api/v2/db/query", {
597
687
  sql: input.sql,
@@ -640,6 +730,7 @@ var DeeplineClient = class {
640
730
  ...request.revisionId ? { revisionId: request.revisionId } : {},
641
731
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
642
732
  ...request.sourceCode ? { sourceCode: request.sourceCode } : {},
733
+ ...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
643
734
  ..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
644
735
  ...request.artifactHash ? { artifactHash: request.artifactHash } : {},
645
736
  ...request.graphHash ? { graphHash: request.graphHash } : {},
@@ -664,6 +755,7 @@ var DeeplineClient = class {
664
755
  ...request.revisionId ? { revisionId: request.revisionId } : {},
665
756
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
666
757
  ...request.sourceCode ? { sourceCode: request.sourceCode } : {},
758
+ ...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
667
759
  ..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
668
760
  ...request.artifactHash ? { artifactHash: request.artifactHash } : {},
669
761
  ...request.graphHash ? { graphHash: request.graphHash } : {},
@@ -700,6 +792,7 @@ var DeeplineClient = class {
700
792
  const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
701
793
  name: input.name,
702
794
  sourceCode: input.sourceCode,
795
+ sourceFiles: input.sourceFiles,
703
796
  artifact: input.artifact
704
797
  });
705
798
  return this.http.post("/api/v2/plays/artifacts", {
@@ -714,6 +807,7 @@ var DeeplineClient = class {
714
807
  compilerManifest: artifact.compilerManifest ?? await this.compilePlayManifest({
715
808
  name: artifact.name,
716
809
  sourceCode: artifact.sourceCode,
810
+ sourceFiles: artifact.sourceFiles,
717
811
  artifact: artifact.artifact
718
812
  })
719
813
  }))
@@ -740,11 +834,13 @@ var DeeplineClient = class {
740
834
  const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
741
835
  name: input.name,
742
836
  sourceCode: input.sourceCode,
837
+ sourceFiles: input.sourceFiles,
743
838
  artifact: input.artifact
744
839
  });
745
840
  const registeredArtifact = await this.registerPlayArtifact({
746
841
  name: input.name,
747
842
  sourceCode: input.sourceCode,
843
+ sourceFiles: input.sourceFiles,
748
844
  artifact: input.artifact,
749
845
  compilerManifest,
750
846
  publish: false
@@ -804,11 +900,13 @@ var DeeplineClient = class {
804
900
  const compilerManifest = options?.compilerManifest ?? await this.compilePlayManifest({
805
901
  name,
806
902
  sourceCode,
903
+ sourceFiles: options?.sourceFiles,
807
904
  artifact
808
905
  });
809
906
  const registeredArtifact = await this.registerPlayArtifact({
810
907
  name,
811
908
  sourceCode,
909
+ sourceFiles: options?.sourceFiles,
812
910
  artifact,
813
911
  compilerManifest,
814
912
  publish: false
@@ -992,6 +1090,112 @@ var DeeplineClient = class {
992
1090
  );
993
1091
  return response.runs ?? [];
994
1092
  }
1093
+ /**
1094
+ * Get a run by id using the public runs resource model.
1095
+ *
1096
+ * This is the SDK equivalent of:
1097
+ *
1098
+ * ```bash
1099
+ * deepline runs get <run-id> --json
1100
+ * ```
1101
+ */
1102
+ async getRunStatus(runId) {
1103
+ const response = await this.http.get(
1104
+ `/api/v2/runs/${encodeURIComponent(runId)}`
1105
+ );
1106
+ return normalizePlayStatus(response);
1107
+ }
1108
+ /**
1109
+ * List play runs using the public runs resource model.
1110
+ *
1111
+ * This is the SDK equivalent of:
1112
+ *
1113
+ * ```bash
1114
+ * deepline runs list --play <play-name> --status failed --json
1115
+ * ```
1116
+ */
1117
+ async listRuns(options) {
1118
+ const playName = options.play.trim();
1119
+ if (!playName) {
1120
+ throw new Error("runs.list requires options.play.");
1121
+ }
1122
+ const params = new URLSearchParams({ play: playName });
1123
+ const status = options.status?.trim();
1124
+ if (status) {
1125
+ params.set("status", status);
1126
+ }
1127
+ const response = await this.http.get(
1128
+ `/api/v2/runs?${params.toString()}`
1129
+ );
1130
+ return response.runs ?? [];
1131
+ }
1132
+ /**
1133
+ * Fetch the lightweight tail status for a run using the public runs resource model.
1134
+ *
1135
+ * This is the SDK equivalent of:
1136
+ *
1137
+ * ```bash
1138
+ * deepline runs tail <run-id> --json
1139
+ * ```
1140
+ */
1141
+ async tailRun(runId, options) {
1142
+ const afterLogIndex = typeof options?.afterLogIndex === "number" ? options.afterLogIndex : typeof options?.cursor === "number" ? options.cursor : typeof options?.cursor === "string" && options.cursor.trim() ? Number(options.cursor) : void 0;
1143
+ const params = new URLSearchParams();
1144
+ if (Number.isFinite(afterLogIndex)) {
1145
+ params.set("afterLogIndex", String(Number(afterLogIndex)));
1146
+ }
1147
+ if (typeof options?.waitMs === "number") {
1148
+ params.set("waitMs", String(options.waitMs));
1149
+ }
1150
+ if (options?.terminalOnly) {
1151
+ params.set("terminalOnly", "true");
1152
+ }
1153
+ const suffix = params.toString() ? `?${params.toString()}` : "";
1154
+ const response = await this.http.get(
1155
+ `/api/v2/runs/${encodeURIComponent(runId)}/tail${suffix}`
1156
+ );
1157
+ return normalizePlayStatus(response);
1158
+ }
1159
+ /**
1160
+ * Fetch persisted logs for a run using the public runs resource model.
1161
+ *
1162
+ * This is the SDK equivalent of:
1163
+ *
1164
+ * ```bash
1165
+ * deepline runs logs <run-id> --limit 200 --json
1166
+ * ```
1167
+ */
1168
+ async getRunLogs(runId, options) {
1169
+ const status = await this.getRunStatus(runId);
1170
+ const logs = status.progress?.logs ?? [];
1171
+ const limit = typeof options?.limit === "number" && Number.isFinite(options.limit) ? Math.max(0, Math.trunc(options.limit)) : 200;
1172
+ const entries = logs.slice(Math.max(0, logs.length - limit));
1173
+ return {
1174
+ runId: status.runId,
1175
+ totalCount: logs.length,
1176
+ returnedCount: entries.length,
1177
+ firstSequence: logs.length === 0 ? null : logs.length - entries.length + 1,
1178
+ lastSequence: logs.length === 0 ? null : logs.length,
1179
+ truncated: logs.length > entries.length,
1180
+ hasMore: logs.length > entries.length,
1181
+ entries
1182
+ };
1183
+ }
1184
+ /**
1185
+ * Stop a run by id using the public runs resource model.
1186
+ *
1187
+ * This is the SDK equivalent of:
1188
+ *
1189
+ * ```bash
1190
+ * deepline runs stop <run-id> --reason "stale lock" --json
1191
+ * ```
1192
+ */
1193
+ async stopRun(runId, options) {
1194
+ return this.http.post(
1195
+ `/api/v2/runs/${encodeURIComponent(runId)}/stop`,
1196
+ options?.reason ? { reason: options.reason } : {}
1197
+ );
1198
+ }
995
1199
  async listPlays() {
996
1200
  const response = await this.http.get(
997
1201
  "/api/v2/plays"
@@ -1357,7 +1561,11 @@ var DeeplineContext = class {
1357
1561
  /** Get detailed metadata for a tool. */
1358
1562
  get: (toolId) => this.client.getTool(toolId),
1359
1563
  /** Execute a tool and return the standard execution envelope. */
1360
- execute: async (toolId, input) => this.client.executeTool(toolId, input)
1564
+ execute: async (toolId, input) => this.client.executeTool(
1565
+ toolId,
1566
+ input,
1567
+ { includeToolMetadata: true }
1568
+ )
1361
1569
  };
1362
1570
  }
1363
1571
  get plays() {
@@ -1724,4 +1932,3 @@ export {
1724
1932
  writeCsvOutputFile,
1725
1933
  writeJsonOutputFile
1726
1934
  };
1727
- //# sourceMappingURL=index.mjs.map