deepline 0.1.11 → 0.1.19

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 (85) hide show
  1. package/README.md +18 -10
  2. package/dist/cli/index.js +1795 -1052
  3. package/dist/cli/index.mjs +1795 -1053
  4. package/dist/index.d.mts +427 -308
  5. package/dist/index.d.ts +427 -308
  6. package/dist/index.js +391 -326
  7. package/dist/index.mjs +391 -325
  8. package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +88 -22
  9. package/dist/repo/apps/play-runner-workers/src/entry.ts +804 -1253
  10. package/dist/repo/sdk/src/client.ts +287 -47
  11. package/dist/repo/sdk/src/config.ts +125 -8
  12. package/dist/repo/sdk/src/http.ts +10 -2
  13. package/dist/repo/sdk/src/index.ts +7 -16
  14. package/dist/repo/sdk/src/play.ts +105 -140
  15. package/dist/repo/sdk/src/plays/bundle-play-file.ts +23 -6
  16. package/dist/repo/sdk/src/plays/local-file-discovery.ts +207 -160
  17. package/dist/repo/sdk/src/tool-output.ts +0 -146
  18. package/dist/repo/sdk/src/types.ts +27 -0
  19. package/dist/repo/sdk/src/version.ts +2 -2
  20. package/dist/repo/sdk/src/worker-play-entry.ts +3 -0
  21. package/dist/repo/shared_libs/play-runtime/csv-rename.ts +180 -0
  22. package/dist/repo/shared_libs/play-runtime/tool-result.ts +250 -133
  23. package/dist/repo/shared_libs/plays/bundling/index.ts +274 -234
  24. package/dist/repo/shared_libs/plays/dataset.ts +29 -1
  25. package/package.json +5 -4
  26. package/dist/cli/index.js.map +0 -1
  27. package/dist/cli/index.mjs.map +0 -1
  28. package/dist/index.js.map +0 -1
  29. package/dist/index.mjs.map +0 -1
  30. package/dist/repo/apps/play-runner-workers/src/runtime/README.md +0 -21
  31. package/dist/repo/apps/play-runner-workers/src/runtime/batching.ts +0 -177
  32. package/dist/repo/apps/play-runner-workers/src/runtime/execution-plan.ts +0 -52
  33. package/dist/repo/apps/play-runner-workers/src/runtime/tool-batch.ts +0 -100
  34. package/dist/repo/apps/play-runner-workers/src/runtime/tool-result.ts +0 -184
  35. package/dist/repo/sdk/src/cli/commands/auth.ts +0 -500
  36. package/dist/repo/sdk/src/cli/commands/billing.ts +0 -188
  37. package/dist/repo/sdk/src/cli/commands/csv.ts +0 -123
  38. package/dist/repo/sdk/src/cli/commands/db.ts +0 -119
  39. package/dist/repo/sdk/src/cli/commands/feedback.ts +0 -40
  40. package/dist/repo/sdk/src/cli/commands/org.ts +0 -117
  41. package/dist/repo/sdk/src/cli/commands/play.ts +0 -3307
  42. package/dist/repo/sdk/src/cli/commands/tools.ts +0 -687
  43. package/dist/repo/sdk/src/cli/dataset-stats.ts +0 -341
  44. package/dist/repo/sdk/src/cli/index.ts +0 -148
  45. package/dist/repo/sdk/src/cli/progress.ts +0 -149
  46. package/dist/repo/sdk/src/cli/skills-sync.ts +0 -141
  47. package/dist/repo/sdk/src/cli/trace.ts +0 -61
  48. package/dist/repo/sdk/src/cli/utils.ts +0 -145
  49. package/dist/repo/sdk/src/compat.ts +0 -77
  50. package/dist/repo/shared_libs/observability/node-tracing.ts +0 -129
  51. package/dist/repo/shared_libs/observability/tracing.ts +0 -98
  52. package/dist/repo/shared_libs/play-runtime/context.ts +0 -3999
  53. package/dist/repo/shared_libs/play-runtime/ctx-contract.ts +0 -250
  54. package/dist/repo/shared_libs/play-runtime/ctx-types.ts +0 -713
  55. package/dist/repo/shared_libs/play-runtime/dataset-id.ts +0 -10
  56. package/dist/repo/shared_libs/play-runtime/db-session-crypto.ts +0 -304
  57. package/dist/repo/shared_libs/play-runtime/db-session.ts +0 -462
  58. package/dist/repo/shared_libs/play-runtime/live-events.ts +0 -214
  59. package/dist/repo/shared_libs/play-runtime/live-state-contract.ts +0 -50
  60. package/dist/repo/shared_libs/play-runtime/map-execution-frame.ts +0 -114
  61. package/dist/repo/shared_libs/play-runtime/map-row-identity.ts +0 -158
  62. package/dist/repo/shared_libs/play-runtime/progress-emitter.ts +0 -172
  63. package/dist/repo/shared_libs/play-runtime/protocol.ts +0 -121
  64. package/dist/repo/shared_libs/play-runtime/public-play-contract.ts +0 -42
  65. package/dist/repo/shared_libs/play-runtime/result-normalization.ts +0 -33
  66. package/dist/repo/shared_libs/play-runtime/runtime-api.ts +0 -1873
  67. package/dist/repo/shared_libs/play-runtime/runtime-constraints.ts +0 -2
  68. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +0 -201
  69. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver-pg.ts +0 -48
  70. package/dist/repo/shared_libs/play-runtime/runtime-pg-driver.ts +0 -84
  71. package/dist/repo/shared_libs/play-runtime/static-pipeline-types.ts +0 -147
  72. package/dist/repo/shared_libs/play-runtime/suspension.ts +0 -68
  73. package/dist/repo/shared_libs/play-runtime/tracing.ts +0 -31
  74. package/dist/repo/shared_libs/play-runtime/waterfall-replay.ts +0 -75
  75. package/dist/repo/shared_libs/play-runtime/worker-api-types.ts +0 -140
  76. package/dist/repo/shared_libs/plays/artifact-transport.ts +0 -14
  77. package/dist/repo/shared_libs/plays/artifact-types.ts +0 -49
  78. package/dist/repo/shared_libs/plays/compiler-manifest.ts +0 -186
  79. package/dist/repo/shared_libs/plays/definition.ts +0 -264
  80. package/dist/repo/shared_libs/plays/file-refs.ts +0 -11
  81. package/dist/repo/shared_libs/plays/rate-limit-scheduler.ts +0 -206
  82. package/dist/repo/shared_libs/plays/resolve-static-pipeline.ts +0 -164
  83. package/dist/repo/shared_libs/plays/runtime-validation.ts +0 -415
  84. package/dist/repo/shared_libs/temporal/constants.ts +0 -39
  85. package/dist/repo/shared_libs/temporal/preview-config.ts +0 -153
package/dist/index.js CHANGED
@@ -30,7 +30,6 @@ __export(src_exports, {
30
30
  RateLimitError: () => RateLimitError,
31
31
  SDK_API_CONTRACT: () => SDK_API_CONTRACT,
32
32
  SDK_VERSION: () => SDK_VERSION,
33
- createToolCallResult: () => createToolCallResult,
34
33
  defineInput: () => defineInput,
35
34
  definePlay: () => definePlay,
36
35
  defineWorkflow: () => defineWorkflow,
@@ -89,6 +88,10 @@ var ConfigError = class extends DeeplineError {
89
88
  var PROD_URL = "https://code.deepline.com";
90
89
  var DEFAULT_TIMEOUT = 6e4;
91
90
  var DEFAULT_MAX_RETRIES = 3;
91
+ var ACTIVE_DEEPLINE_ENV_FILE = ".env.deepline";
92
+ function projectEnvStartDir() {
93
+ return process.env.DEEPLINE_PROJECT_ENV_DIR?.trim() || process.cwd();
94
+ }
92
95
  function baseUrlSlug(baseUrl) {
93
96
  let url;
94
97
  try {
@@ -124,16 +127,52 @@ function parseEnvFile(filePath) {
124
127
  }
125
128
  return env;
126
129
  }
127
- function findNearestWorktreeEnv(startDir = process.cwd()) {
130
+ function findNearestEnvFile(names, startDir = process.cwd()) {
128
131
  let current = (0, import_node_path.resolve)(startDir);
129
132
  while (true) {
130
- const values = parseEnvFile((0, import_node_path.join)(current, ".env.worktree"));
131
- if (Object.keys(values).length > 0) return values;
133
+ for (const name of names) {
134
+ const filePath = (0, import_node_path.join)(current, name);
135
+ if ((0, import_node_fs.existsSync)(filePath)) return filePath;
136
+ }
132
137
  const parent = (0, import_node_path.dirname)(current);
133
- if (parent === current) return {};
138
+ if (parent === current) return null;
134
139
  current = parent;
135
140
  }
136
141
  }
142
+ function findNearestEnv(names, startDir = process.cwd()) {
143
+ const filePath = findNearestEnvFile(names, startDir);
144
+ return filePath ? parseEnvFile(filePath) : {};
145
+ }
146
+ function findNearestWorktreeEnv(startDir = process.cwd()) {
147
+ return findNearestEnv([".env.worktree"], startDir);
148
+ }
149
+ function resolveProfileEnvFileNames() {
150
+ const explicitProfile = process.env.DEEPLINE_ENV_PROFILE?.trim() || process.env.DEEPLINE_PROFILE?.trim() || "";
151
+ const names = [];
152
+ if (explicitProfile) names.push(`.env.deepline.${explicitProfile}`);
153
+ const nodeEnv = process.env.NODE_ENV?.trim();
154
+ if (nodeEnv === "production") names.push(".env.deepline.prod");
155
+ else if (nodeEnv === "staging") names.push(".env.deepline.staging");
156
+ names.push(ACTIVE_DEEPLINE_ENV_FILE);
157
+ return names;
158
+ }
159
+ function resolveProjectAppEnvFileNames() {
160
+ const nodeEnv = process.env.NODE_ENV?.trim();
161
+ const names = [];
162
+ if (nodeEnv === "production") names.push(".env.prod");
163
+ if (nodeEnv === "staging") names.push(".env.staging");
164
+ names.push(".env.local", ".env");
165
+ return names;
166
+ }
167
+ function resolveBaseUrlFromEnvValues(env) {
168
+ return env.DEEPLINE_ORIGIN_URL?.trim() || env.DEEPLINE_API_BASE_URL?.trim() || "";
169
+ }
170
+ function loadProjectDeeplineEnv() {
171
+ return findNearestEnv(resolveProfileEnvFileNames(), projectEnvStartDir());
172
+ }
173
+ function loadProjectAppEnv() {
174
+ return findNearestEnv(resolveProjectAppEnvFileNames(), projectEnvStartDir());
175
+ }
137
176
  function normalizeWorktreeBaseUrl(baseUrl, worktreeEnv = findNearestWorktreeEnv()) {
138
177
  const trimmed = baseUrl.trim().replace(/\/$/, "");
139
178
  if (!trimmed) return trimmed;
@@ -170,6 +209,10 @@ function autoDetectBaseUrl() {
170
209
  if (envOrigin) return normalizeWorktreeBaseUrl(envOrigin);
171
210
  const envBase = process.env.DEEPLINE_API_BASE_URL?.trim();
172
211
  if (envBase) return normalizeWorktreeBaseUrl(envBase);
212
+ const projectDeeplineBaseUrl = resolveBaseUrlFromEnvValues(loadProjectDeeplineEnv());
213
+ if (projectDeeplineBaseUrl) return normalizeWorktreeBaseUrl(projectDeeplineBaseUrl);
214
+ const projectAppBaseUrl = resolveBaseUrlFromEnvValues(loadProjectAppEnv());
215
+ if (projectAppBaseUrl) return normalizeWorktreeBaseUrl(projectAppBaseUrl);
173
216
  const worktreeBaseUrl = resolveWorktreeBaseUrl();
174
217
  if (worktreeBaseUrl) return worktreeBaseUrl;
175
218
  const globalEnv = loadGlobalCliEnv();
@@ -181,7 +224,9 @@ function resolveConfig(options) {
181
224
  const requestedBaseUrl = options?.baseUrl?.trim() || autoDetectBaseUrl();
182
225
  const baseUrl = normalizeWorktreeBaseUrl(requestedBaseUrl);
183
226
  const cliEnv = loadCliEnv(baseUrl);
184
- const apiKey = options?.apiKey?.trim() || process.env.DEEPLINE_API_KEY?.trim() || cliEnv.DEEPLINE_API_KEY || "";
227
+ const projectDeeplineEnv = loadProjectDeeplineEnv();
228
+ const projectAppEnv = loadProjectAppEnv();
229
+ const apiKey = options?.apiKey?.trim() || process.env.DEEPLINE_API_KEY?.trim() || projectDeeplineEnv.DEEPLINE_API_KEY || projectAppEnv.DEEPLINE_API_KEY || cliEnv.DEEPLINE_API_KEY || "";
185
230
  if (!apiKey) {
186
231
  throw new ConfigError(
187
232
  `No API key found. Set DEEPLINE_API_KEY env var, pass apiKey option, or run: deepline auth register`
@@ -196,8 +241,8 @@ function resolveConfig(options) {
196
241
  }
197
242
 
198
243
  // src/version.ts
199
- var SDK_VERSION = "0.1.11";
200
- var SDK_API_CONTRACT = "2026-04-plays-v1";
244
+ var SDK_VERSION = "0.1.19";
245
+ var SDK_API_CONTRACT = "2026-05-runs-v2";
201
246
 
202
247
  // ../shared_libs/play-runtime/coordinator-headers.ts
203
248
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -390,8 +435,12 @@ var HttpClient = class {
390
435
  * @param path - API path
391
436
  * @param body - Request body (will be JSON-serialized)
392
437
  */
393
- async post(path, body) {
394
- return this.request(path, { method: "POST", body });
438
+ async post(path, body, headers) {
439
+ return this.request(path, {
440
+ method: "POST",
441
+ body,
442
+ headers
443
+ });
395
444
  }
396
445
  /**
397
446
  * Send a DELETE request.
@@ -471,6 +520,10 @@ function sleep(ms) {
471
520
 
472
521
  // src/client.ts
473
522
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
523
+ var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
524
+ function isRecord(value) {
525
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
526
+ }
474
527
  function normalizePlayStatus(raw) {
475
528
  const status = typeof raw.status === "string" ? raw.status : typeof raw.temporalStatus === "string" ? mapLegacyTemporalStatus(raw.temporalStatus) : "running";
476
529
  const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : "";
@@ -500,6 +553,7 @@ function mapLegacyTemporalStatus(status) {
500
553
  var DeeplineClient = class {
501
554
  http;
502
555
  config;
556
+ runs;
503
557
  /**
504
558
  * @param options - Optional overrides for API key, base URL, timeout, and retries.
505
559
  * @throws {@link ConfigError} if no API key can be resolved from any source.
@@ -507,6 +561,13 @@ var DeeplineClient = class {
507
561
  constructor(options) {
508
562
  this.config = resolveConfig(options);
509
563
  this.http = new HttpClient(this.config);
564
+ this.runs = {
565
+ get: (runId) => this.getRunStatus(runId),
566
+ list: (options2) => this.listRuns(options2),
567
+ tail: (runId, options2) => this.tailRun(runId, options2),
568
+ logs: (runId, options2) => this.getRunLogs(runId, options2),
569
+ stop: (runId, options2) => this.stopRun(runId, options2)
570
+ };
510
571
  }
511
572
  /** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
512
573
  get baseUrl() {
@@ -523,12 +584,27 @@ var DeeplineClient = class {
523
584
  ).filter((field) => Boolean(field?.name)) : [];
524
585
  return fields.length > 0 ? { fields } : schema;
525
586
  }
526
- playRunCommand(name) {
527
- return `deepline plays run ${name} --input '{...}' --watch`;
587
+ schemaMetadata(schema, key) {
588
+ if (!isRecord(schema)) return null;
589
+ const value = schema[key];
590
+ return isRecord(value) ? value : null;
591
+ }
592
+ playRunCommand(play, options) {
593
+ const target = play.reference || play.name;
594
+ if (options?.csvInput) {
595
+ const inputField = typeof options.csvInput.inputField === "string" && options.csvInput.inputField.trim() ? options.csvInput.inputField.trim() : "csv";
596
+ return `deepline plays run ${target} --${inputField} leads.csv --watch`;
597
+ }
598
+ return `deepline plays run ${target} --input '{...}' --watch`;
528
599
  }
529
600
  summarizePlayListItem(play, options) {
530
601
  const aliases = play.aliases?.length ? play.aliases : [play.name];
531
- const runCommand = this.playRunCommand(play.name);
602
+ const csvInput = this.schemaMetadata(play.inputSchema, "csvInput");
603
+ const rowOutputSchema = this.schemaMetadata(
604
+ play.outputSchema,
605
+ "rowOutputSchema"
606
+ );
607
+ const runCommand = this.playRunCommand(play, { csvInput });
532
608
  return {
533
609
  name: play.name,
534
610
  ...play.reference ? { reference: play.reference } : {},
@@ -540,6 +616,8 @@ var DeeplineClient = class {
540
616
  aliases,
541
617
  inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
542
618
  outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
619
+ ...csvInput ? { csvInput } : {},
620
+ ...rowOutputSchema ? { rowOutputSchema } : {},
543
621
  runCommand,
544
622
  examples: [runCommand],
545
623
  currentPublishedVersion: play.currentPublishedVersion ?? null,
@@ -578,6 +656,31 @@ var DeeplineClient = class {
578
656
  );
579
657
  return res.tools;
580
658
  }
659
+ /**
660
+ * Search available tools using Deepline's ranked backend search.
661
+ *
662
+ * This is the same discovery surface used by the legacy CLI: it ranks across
663
+ * tool metadata, categories, agent guidance, and input schema fields.
664
+ */
665
+ async searchTools(options = {}) {
666
+ const params = new URLSearchParams();
667
+ const query = options.query?.trim() ?? "";
668
+ params.set("q", query);
669
+ params.set(
670
+ "include_search_debug",
671
+ options.includeSearchDebug ? "true" : "false"
672
+ );
673
+ params.set("search_mode", options.searchMode ?? "v2");
674
+ if (options.categories?.trim()) {
675
+ params.set("categories", options.categories.trim());
676
+ }
677
+ if (options.searchTerms?.trim()) {
678
+ params.set("search_terms", options.searchTerms.trim());
679
+ }
680
+ return this.http.get(
681
+ `/api/v2/integrations/list?${params.toString()}`
682
+ );
683
+ }
581
684
  /**
582
685
  * Get detailed metadata for a single tool.
583
686
  *
@@ -606,55 +709,24 @@ var DeeplineClient = class {
606
709
  );
607
710
  }
608
711
  /**
609
- * Execute a tool and return the extracted result.
610
- *
611
- * Sends the input payload to the tool and returns the `.result` field from the
612
- * response. For the full response envelope (including job_id, credits, etc.),
613
- * use {@link executeToolRaw}.
712
+ * Execute a tool and return the standard execution envelope.
614
713
  *
615
- * @param toolId - Tool identifier (e.g. `"test_company_search"`)
616
- * @param input - Tool-specific input parameters
617
- * @returns The tool's output (shape varies by tool)
618
- * @throws {@link DeeplineError} if the tool execution fails
619
- *
620
- * @example
621
- * ```typescript
622
- * const company = await client.executeTool('test_company_search', {
623
- * domain: 'stripe.com',
624
- * });
625
- * console.log(company); // { name: "Stripe", industry: "Financial Services", ... }
626
- * ```
627
- */
628
- async executeTool(toolId, input) {
629
- const res = await this.http.post(
630
- `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
631
- { payload: input }
632
- );
633
- return res.result ?? res;
634
- }
635
- /**
636
- * Execute a tool and return the full response envelope.
637
- *
638
- * Unlike {@link executeTool}, this returns the complete API response including
639
- * `job_id`, `status`, `credits`, and the raw `result` object.
640
- *
641
- * @param toolId - Tool identifier
642
- * @param input - Tool-specific input parameters
643
- * @returns Full response with job metadata and result
644
- *
645
- * @example
646
- * ```typescript
647
- * const raw = await client.executeToolRaw('test_company_search', { domain: 'stripe.com' });
648
- * console.log(`Job: ${raw.job_id}, Credits: ${raw.credits}`);
649
- * console.log(`Result:`, raw.result);
650
- * ```
714
+ * The `result.data` field contains the provider payload. `result.meta`
715
+ * contains provider/upstream metadata such as HTTP status or paging details.
716
+ * Top-level fields such as `status`, `job_id`, and `billing` describe the
717
+ * Deepline execution.
651
718
  */
652
- async executeToolRaw(toolId, input) {
719
+ async executeTool(toolId, input, options) {
720
+ const headers = options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : void 0;
653
721
  return this.http.post(
654
722
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
655
- { payload: input }
723
+ { payload: input },
724
+ headers
656
725
  );
657
726
  }
727
+ async executeToolRaw(toolId, input, options) {
728
+ return this.executeTool(toolId, input, options);
729
+ }
658
730
  async queryCustomerDb(input) {
659
731
  return this.http.post("/api/v2/db/query", {
660
732
  sql: input.sql,
@@ -703,6 +775,7 @@ var DeeplineClient = class {
703
775
  ...request.revisionId ? { revisionId: request.revisionId } : {},
704
776
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
705
777
  ...request.sourceCode ? { sourceCode: request.sourceCode } : {},
778
+ ...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
706
779
  ..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
707
780
  ...request.artifactHash ? { artifactHash: request.artifactHash } : {},
708
781
  ...request.graphHash ? { graphHash: request.graphHash } : {},
@@ -727,6 +800,7 @@ var DeeplineClient = class {
727
800
  ...request.revisionId ? { revisionId: request.revisionId } : {},
728
801
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
729
802
  ...request.sourceCode ? { sourceCode: request.sourceCode } : {},
803
+ ...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
730
804
  ..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
731
805
  ...request.artifactHash ? { artifactHash: request.artifactHash } : {},
732
806
  ...request.graphHash ? { graphHash: request.graphHash } : {},
@@ -763,6 +837,7 @@ var DeeplineClient = class {
763
837
  const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
764
838
  name: input.name,
765
839
  sourceCode: input.sourceCode,
840
+ sourceFiles: input.sourceFiles,
766
841
  artifact: input.artifact
767
842
  });
768
843
  return this.http.post("/api/v2/plays/artifacts", {
@@ -777,6 +852,7 @@ var DeeplineClient = class {
777
852
  compilerManifest: artifact.compilerManifest ?? await this.compilePlayManifest({
778
853
  name: artifact.name,
779
854
  sourceCode: artifact.sourceCode,
855
+ sourceFiles: artifact.sourceFiles,
780
856
  artifact: artifact.artifact
781
857
  })
782
858
  }))
@@ -803,11 +879,13 @@ var DeeplineClient = class {
803
879
  const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
804
880
  name: input.name,
805
881
  sourceCode: input.sourceCode,
882
+ sourceFiles: input.sourceFiles,
806
883
  artifact: input.artifact
807
884
  });
808
885
  const registeredArtifact = await this.registerPlayArtifact({
809
886
  name: input.name,
810
887
  sourceCode: input.sourceCode,
888
+ sourceFiles: input.sourceFiles,
811
889
  artifact: input.artifact,
812
890
  compilerManifest,
813
891
  publish: false
@@ -867,11 +945,13 @@ var DeeplineClient = class {
867
945
  const compilerManifest = options?.compilerManifest ?? await this.compilePlayManifest({
868
946
  name,
869
947
  sourceCode,
948
+ sourceFiles: options?.sourceFiles,
870
949
  artifact
871
950
  });
872
951
  const registeredArtifact = await this.registerPlayArtifact({
873
952
  name,
874
953
  sourceCode,
954
+ sourceFiles: options?.sourceFiles,
875
955
  artifact,
876
956
  compilerManifest,
877
957
  publish: false
@@ -1055,6 +1135,112 @@ var DeeplineClient = class {
1055
1135
  );
1056
1136
  return response.runs ?? [];
1057
1137
  }
1138
+ /**
1139
+ * Get a run by id using the public runs resource model.
1140
+ *
1141
+ * This is the SDK equivalent of:
1142
+ *
1143
+ * ```bash
1144
+ * deepline runs get <run-id> --json
1145
+ * ```
1146
+ */
1147
+ async getRunStatus(runId) {
1148
+ const response = await this.http.get(
1149
+ `/api/v2/runs/${encodeURIComponent(runId)}`
1150
+ );
1151
+ return normalizePlayStatus(response);
1152
+ }
1153
+ /**
1154
+ * List play runs using the public runs resource model.
1155
+ *
1156
+ * This is the SDK equivalent of:
1157
+ *
1158
+ * ```bash
1159
+ * deepline runs list --play <play-name> --status failed --json
1160
+ * ```
1161
+ */
1162
+ async listRuns(options) {
1163
+ const playName = options.play.trim();
1164
+ if (!playName) {
1165
+ throw new Error("runs.list requires options.play.");
1166
+ }
1167
+ const params = new URLSearchParams({ play: playName });
1168
+ const status = options.status?.trim();
1169
+ if (status) {
1170
+ params.set("status", status);
1171
+ }
1172
+ const response = await this.http.get(
1173
+ `/api/v2/runs?${params.toString()}`
1174
+ );
1175
+ return response.runs ?? [];
1176
+ }
1177
+ /**
1178
+ * Fetch the lightweight tail status for a run using the public runs resource model.
1179
+ *
1180
+ * This is the SDK equivalent of:
1181
+ *
1182
+ * ```bash
1183
+ * deepline runs tail <run-id> --json
1184
+ * ```
1185
+ */
1186
+ async tailRun(runId, options) {
1187
+ 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;
1188
+ const params = new URLSearchParams();
1189
+ if (Number.isFinite(afterLogIndex)) {
1190
+ params.set("afterLogIndex", String(Number(afterLogIndex)));
1191
+ }
1192
+ if (typeof options?.waitMs === "number") {
1193
+ params.set("waitMs", String(options.waitMs));
1194
+ }
1195
+ if (options?.terminalOnly) {
1196
+ params.set("terminalOnly", "true");
1197
+ }
1198
+ const suffix = params.toString() ? `?${params.toString()}` : "";
1199
+ const response = await this.http.get(
1200
+ `/api/v2/runs/${encodeURIComponent(runId)}/tail${suffix}`
1201
+ );
1202
+ return normalizePlayStatus(response);
1203
+ }
1204
+ /**
1205
+ * Fetch persisted logs for a run using the public runs resource model.
1206
+ *
1207
+ * This is the SDK equivalent of:
1208
+ *
1209
+ * ```bash
1210
+ * deepline runs logs <run-id> --limit 200 --json
1211
+ * ```
1212
+ */
1213
+ async getRunLogs(runId, options) {
1214
+ const status = await this.getRunStatus(runId);
1215
+ const logs = status.progress?.logs ?? [];
1216
+ const limit = typeof options?.limit === "number" && Number.isFinite(options.limit) ? Math.max(0, Math.trunc(options.limit)) : 200;
1217
+ const entries = logs.slice(Math.max(0, logs.length - limit));
1218
+ return {
1219
+ runId: status.runId,
1220
+ totalCount: logs.length,
1221
+ returnedCount: entries.length,
1222
+ firstSequence: logs.length === 0 ? null : logs.length - entries.length + 1,
1223
+ lastSequence: logs.length === 0 ? null : logs.length,
1224
+ truncated: logs.length > entries.length,
1225
+ hasMore: logs.length > entries.length,
1226
+ entries
1227
+ };
1228
+ }
1229
+ /**
1230
+ * Stop a run by id using the public runs resource model.
1231
+ *
1232
+ * This is the SDK equivalent of:
1233
+ *
1234
+ * ```bash
1235
+ * deepline runs stop <run-id> --reason "stale lock" --json
1236
+ * ```
1237
+ */
1238
+ async stopRun(runId, options) {
1239
+ return this.http.post(
1240
+ `/api/v2/runs/${encodeURIComponent(runId)}/stop`,
1241
+ options?.reason ? { reason: options.reason } : {}
1242
+ );
1243
+ }
1058
1244
  async listPlays() {
1059
1245
  const response = await this.http.get(
1060
1246
  "/api/v2/plays"
@@ -1271,258 +1457,6 @@ var DeeplineClient = class {
1271
1457
  }
1272
1458
  };
1273
1459
 
1274
- // src/tool-output.ts
1275
- var import_node_fs2 = require("fs");
1276
- var import_node_os2 = require("os");
1277
- var import_node_path2 = require("path");
1278
- function isPlainObject(value) {
1279
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1280
- }
1281
- var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1282
- var PHONE_KEY_PATTERN = /(^|[_-])(phone|mobile|cell|telephone|tel)([_-]|$)|phone|mobile|telephone/i;
1283
- function normalizeScalarString(value) {
1284
- if (typeof value === "string") {
1285
- const trimmed = value.trim();
1286
- return trimmed.length > 0 ? trimmed : null;
1287
- }
1288
- if (typeof value === "number" && Number.isFinite(value)) {
1289
- return String(value);
1290
- }
1291
- return null;
1292
- }
1293
- function looksLikeEmail(value) {
1294
- const candidate = normalizeScalarString(value);
1295
- if (!candidate || !EMAIL_PATTERN.test(candidate)) return null;
1296
- return candidate;
1297
- }
1298
- function looksLikePhone(value) {
1299
- const candidate = normalizeScalarString(value);
1300
- if (!candidate) return null;
1301
- const digits = candidate.replace(/\D/g, "");
1302
- if (digits.length < 7 || digits.length > 16) return null;
1303
- return candidate;
1304
- }
1305
- function findEmail(value, depth = 0) {
1306
- if (depth > 6) return null;
1307
- const direct = looksLikeEmail(value);
1308
- if (direct) return direct;
1309
- if (Array.isArray(value)) {
1310
- for (const entry of value) {
1311
- const nested = findEmail(entry, depth + 1);
1312
- if (nested) return nested;
1313
- }
1314
- return null;
1315
- }
1316
- if (!isPlainObject(value)) return null;
1317
- for (const [key, child] of Object.entries(value)) {
1318
- if (/email/i.test(key)) {
1319
- const keyed = looksLikeEmail(child);
1320
- if (keyed) return keyed;
1321
- }
1322
- }
1323
- for (const child of Object.values(value)) {
1324
- const nested = findEmail(child, depth + 1);
1325
- if (nested) return nested;
1326
- }
1327
- return null;
1328
- }
1329
- function findPhone(value, depth = 0) {
1330
- if (depth > 6) return null;
1331
- if (Array.isArray(value)) {
1332
- for (const entry of value) {
1333
- const nested = findPhone(entry, depth + 1);
1334
- if (nested) return nested;
1335
- }
1336
- return null;
1337
- }
1338
- if (!isPlainObject(value)) return null;
1339
- for (const [key, child] of Object.entries(value)) {
1340
- if (PHONE_KEY_PATTERN.test(key)) {
1341
- const keyed = looksLikePhone(child);
1342
- if (keyed) return keyed;
1343
- }
1344
- }
1345
- for (const child of Object.values(value)) {
1346
- const nested = findPhone(child, depth + 1);
1347
- if (nested) return nested;
1348
- }
1349
- return null;
1350
- }
1351
- function normalizeListExtractorPaths(paths) {
1352
- if (!Array.isArray(paths)) return [];
1353
- const seen = /* @__PURE__ */ new Set();
1354
- const normalized = [];
1355
- for (const rawPath of paths) {
1356
- if (typeof rawPath !== "string") continue;
1357
- const path = rawPath.trim();
1358
- if (!path) continue;
1359
- for (const candidate of [path, path.replace(/^result\./, "")]) {
1360
- if (!candidate || seen.has(candidate)) continue;
1361
- seen.add(candidate);
1362
- normalized.push(candidate);
1363
- }
1364
- }
1365
- return normalized;
1366
- }
1367
- var DeeplineToolCallResult = class {
1368
- constructor(value, options) {
1369
- this.value = value;
1370
- this.listExtractorPaths = normalizeListExtractorPaths(
1371
- options?.listExtractorPaths
1372
- );
1373
- }
1374
- value;
1375
- listExtractorPaths;
1376
- getEmail() {
1377
- return findEmail(this.value);
1378
- }
1379
- getPhone() {
1380
- return findPhone(this.value);
1381
- }
1382
- tryList(options) {
1383
- const explicitPaths = normalizeListExtractorPaths(options?.listExtractorPaths);
1384
- return tryConvertToList(this.value, {
1385
- listExtractorPaths: explicitPaths.length > 0 ? explicitPaths : this.listExtractorPaths
1386
- })?.rows ?? null;
1387
- }
1388
- };
1389
- function createToolCallResult(value, options) {
1390
- return new DeeplineToolCallResult(value, options);
1391
- }
1392
- function getByDottedPath(root, dottedPath) {
1393
- let current = root;
1394
- for (const segment of String(dottedPath || "").split(".").filter(Boolean)) {
1395
- if (!isPlainObject(current) || !(segment in current)) {
1396
- return null;
1397
- }
1398
- current = current[segment];
1399
- }
1400
- return current;
1401
- }
1402
- function normalizeRows(value) {
1403
- if (!Array.isArray(value)) return null;
1404
- return value.map((entry) => {
1405
- if (isPlainObject(entry)) return entry;
1406
- return { value: entry };
1407
- });
1408
- }
1409
- function candidateRoots(payload) {
1410
- const roots = [{ path: null, value: payload }];
1411
- if (isPlainObject(payload) && isPlainObject(payload.result)) {
1412
- roots.push({ path: "result", value: payload.result });
1413
- if (isPlainObject(payload.result.data)) {
1414
- roots.push({ path: "result.data", value: payload.result.data });
1415
- }
1416
- }
1417
- return roots;
1418
- }
1419
- function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
1420
- if (depth > 5) return null;
1421
- const directRows = normalizeRows(value);
1422
- const hasObjectRow = directRows?.some((row) => Object.keys(row).some((key) => key !== "value")) ?? false;
1423
- let best = directRows && directRows.length > 0 && hasObjectRow ? { path: pathPrefix, rows: directRows } : null;
1424
- if (!isPlainObject(value)) {
1425
- return best;
1426
- }
1427
- for (const [key, child] of Object.entries(value)) {
1428
- const childPath = pathPrefix ? `${pathPrefix}.${key}` : key;
1429
- const candidate = findBestArrayCandidate(child, childPath, depth + 1);
1430
- if (!candidate) continue;
1431
- if (!best || candidate.rows.length > best.rows.length) {
1432
- best = candidate;
1433
- }
1434
- }
1435
- return best;
1436
- }
1437
- function tryConvertToList(payload, options) {
1438
- const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
1439
- if (listExtractorPaths.length > 0) {
1440
- for (const root of candidateRoots(payload)) {
1441
- for (const extractorPath of listExtractorPaths) {
1442
- const resolved = getByDottedPath(root.value, extractorPath);
1443
- const rows = normalizeRows(resolved);
1444
- if (rows && rows.length > 0) {
1445
- const sourcePath = root.path ? `${root.path}.${extractorPath}` : extractorPath;
1446
- return { rows, strategy: "configured_paths", sourcePath };
1447
- }
1448
- }
1449
- }
1450
- }
1451
- for (const root of candidateRoots(payload)) {
1452
- const candidate = findBestArrayCandidate(root.value, root.path ?? "");
1453
- if (!candidate || candidate.rows.length === 0) continue;
1454
- return {
1455
- rows: candidate.rows,
1456
- strategy: "auto_detected",
1457
- sourcePath: candidate.path || root.path
1458
- };
1459
- }
1460
- return null;
1461
- }
1462
- function ensureOutputDir() {
1463
- const outputDir = (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".local", "share", "deepline", "data");
1464
- (0, import_node_fs2.mkdirSync)(outputDir, { recursive: true });
1465
- return outputDir;
1466
- }
1467
- function writeJsonOutputFile(payload, stem) {
1468
- const outputDir = ensureOutputDir();
1469
- const outputPath = (0, import_node_path2.join)(outputDir, `${stem}_${Date.now()}.json`);
1470
- (0, import_node_fs2.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
1471
- return outputPath;
1472
- }
1473
- function writeCsvOutputFile(rows, stem) {
1474
- const outputDir = ensureOutputDir();
1475
- const outputPath = (0, import_node_path2.join)(outputDir, `${stem}_${Date.now()}.csv`);
1476
- const seen = /* @__PURE__ */ new Set();
1477
- const columns = [];
1478
- for (const row of rows) {
1479
- for (const key of Object.keys(row)) {
1480
- if (!seen.has(key)) {
1481
- seen.add(key);
1482
- columns.push(key);
1483
- }
1484
- }
1485
- }
1486
- const escapeCell = (value) => {
1487
- const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
1488
- if (/[",\n]/.test(normalized)) {
1489
- return `"${normalized.replace(/"/g, '""')}"`;
1490
- }
1491
- return normalized;
1492
- };
1493
- const lines = [];
1494
- lines.push(columns.map(escapeCell).join(","));
1495
- for (const row of rows) {
1496
- lines.push(columns.map((column) => escapeCell(row[column])).join(","));
1497
- }
1498
- (0, import_node_fs2.writeFileSync)(outputPath, `${lines.join("\n")}
1499
- `, "utf-8");
1500
- const previewRows = rows.slice(0, 5);
1501
- const previewColumns = columns.slice(0, 5);
1502
- const preview = [
1503
- previewColumns.join(","),
1504
- ...previewRows.map((row) => previewColumns.map((column) => escapeCell(row[column])).join(","))
1505
- ].join("\n");
1506
- return {
1507
- path: outputPath,
1508
- rowCount: rows.length,
1509
- columns,
1510
- preview
1511
- };
1512
- }
1513
- function extractSummaryFields(payload) {
1514
- const candidates = candidateRoots(payload);
1515
- for (const candidate of candidates) {
1516
- if (!isPlainObject(candidate.value)) continue;
1517
- const summaryEntries = Object.entries(candidate.value).filter(([, value]) => {
1518
- return value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
1519
- });
1520
- if (summaryEntries.length === 0) continue;
1521
- return Object.fromEntries(summaryEntries);
1522
- }
1523
- return {};
1524
- }
1525
-
1526
1460
  // src/play.ts
1527
1461
  var DeeplineConditionalStepResolver = class _DeeplineConditionalStepResolver {
1528
1462
  constructor(when2, run, elseValue) {
@@ -1661,12 +1595,8 @@ var DeeplineContext = class {
1661
1595
  * ```typescript
1662
1596
  * const tools = await ctx.tools.list();
1663
1597
  * const meta = await ctx.tools.get('apollo_people_search');
1664
- * const result = await ctx.tools.execute({
1665
- * tool: 'test_company_search',
1666
- * input: { domain: 'stripe.com' },
1667
- * });
1668
- * const rows = result.tryList({ listExtractorPaths: ['people'] });
1669
- * const email = result.getEmail();
1598
+ * const companyLookup = await ctx.tools.execute('test_company_search', { domain: 'stripe.com' });
1599
+ * const company = companyLookup.result.data;
1670
1600
  * ```
1671
1601
  */
1672
1602
  get tools() {
@@ -1675,16 +1605,12 @@ var DeeplineContext = class {
1675
1605
  list: () => this.client.listTools(),
1676
1606
  /** Get detailed metadata for a tool. */
1677
1607
  get: (toolId) => this.client.getTool(toolId),
1678
- /** Execute a tool and return an ergonomic result wrapper. */
1679
- execute: async (request) => {
1680
- const [metadata, value] = await Promise.all([
1681
- this.client.getTool(request.tool),
1682
- this.client.executeTool(request.tool, request.input)
1683
- ]);
1684
- return createToolCallResult(value, {
1685
- listExtractorPaths: metadata.listExtractorPaths ?? []
1686
- });
1687
- }
1608
+ /** Execute a tool and return the standard execution envelope. */
1609
+ execute: async (toolId, input) => this.client.executeTool(
1610
+ toolId,
1611
+ input,
1612
+ { includeToolMetadata: true }
1613
+ )
1688
1614
  };
1689
1615
  }
1690
1616
  get plays() {
@@ -1887,6 +1813,147 @@ function getDefinedPlayMetadata(value) {
1887
1813
  }
1888
1814
  return candidate;
1889
1815
  }
1816
+
1817
+ // src/tool-output.ts
1818
+ var import_node_fs2 = require("fs");
1819
+ var import_node_os2 = require("os");
1820
+ var import_node_path2 = require("path");
1821
+ function isPlainObject(value) {
1822
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1823
+ }
1824
+ function getByDottedPath(root, dottedPath) {
1825
+ let current = root;
1826
+ for (const segment of String(dottedPath || "").split(".").filter(Boolean)) {
1827
+ if (!isPlainObject(current) || !(segment in current)) {
1828
+ return null;
1829
+ }
1830
+ current = current[segment];
1831
+ }
1832
+ return current;
1833
+ }
1834
+ function normalizeRows(value) {
1835
+ if (!Array.isArray(value)) return null;
1836
+ return value.map((entry) => {
1837
+ if (isPlainObject(entry)) return entry;
1838
+ return { value: entry };
1839
+ });
1840
+ }
1841
+ function candidateRoots(payload) {
1842
+ const roots = [{ path: null, value: payload }];
1843
+ if (isPlainObject(payload) && isPlainObject(payload.result)) {
1844
+ roots.push({ path: "result", value: payload.result });
1845
+ if (isPlainObject(payload.result.data)) {
1846
+ roots.push({ path: "result.data", value: payload.result.data });
1847
+ }
1848
+ }
1849
+ return roots;
1850
+ }
1851
+ function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
1852
+ if (depth > 5) return null;
1853
+ const directRows = normalizeRows(value);
1854
+ const hasObjectRow = directRows?.some((row) => Object.keys(row).some((key) => key !== "value")) ?? false;
1855
+ let best = directRows && directRows.length > 0 && hasObjectRow ? { path: pathPrefix, rows: directRows } : null;
1856
+ if (!isPlainObject(value)) {
1857
+ return best;
1858
+ }
1859
+ for (const [key, child] of Object.entries(value)) {
1860
+ const childPath = pathPrefix ? `${pathPrefix}.${key}` : key;
1861
+ const candidate = findBestArrayCandidate(child, childPath, depth + 1);
1862
+ if (!candidate) continue;
1863
+ if (!best || candidate.rows.length > best.rows.length) {
1864
+ best = candidate;
1865
+ }
1866
+ }
1867
+ return best;
1868
+ }
1869
+ function tryConvertToList(payload, options) {
1870
+ const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
1871
+ if (listExtractorPaths.length > 0) {
1872
+ for (const root of candidateRoots(payload)) {
1873
+ for (const extractorPath of listExtractorPaths) {
1874
+ const resolved = getByDottedPath(root.value, extractorPath);
1875
+ const rows = normalizeRows(resolved);
1876
+ if (rows && rows.length > 0) {
1877
+ const sourcePath = root.path ? `${root.path}.${extractorPath}` : extractorPath;
1878
+ return { rows, strategy: "configured_paths", sourcePath };
1879
+ }
1880
+ }
1881
+ }
1882
+ }
1883
+ for (const root of candidateRoots(payload)) {
1884
+ const candidate = findBestArrayCandidate(root.value, root.path ?? "");
1885
+ if (!candidate || candidate.rows.length === 0) continue;
1886
+ return {
1887
+ rows: candidate.rows,
1888
+ strategy: "auto_detected",
1889
+ sourcePath: candidate.path || root.path
1890
+ };
1891
+ }
1892
+ return null;
1893
+ }
1894
+ function ensureOutputDir() {
1895
+ const outputDir = (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".local", "share", "deepline", "data");
1896
+ (0, import_node_fs2.mkdirSync)(outputDir, { recursive: true });
1897
+ return outputDir;
1898
+ }
1899
+ function writeJsonOutputFile(payload, stem) {
1900
+ const outputDir = ensureOutputDir();
1901
+ const outputPath = (0, import_node_path2.join)(outputDir, `${stem}_${Date.now()}.json`);
1902
+ (0, import_node_fs2.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
1903
+ return outputPath;
1904
+ }
1905
+ function writeCsvOutputFile(rows, stem) {
1906
+ const outputDir = ensureOutputDir();
1907
+ const outputPath = (0, import_node_path2.join)(outputDir, `${stem}_${Date.now()}.csv`);
1908
+ const seen = /* @__PURE__ */ new Set();
1909
+ const columns = [];
1910
+ for (const row of rows) {
1911
+ for (const key of Object.keys(row)) {
1912
+ if (!seen.has(key)) {
1913
+ seen.add(key);
1914
+ columns.push(key);
1915
+ }
1916
+ }
1917
+ }
1918
+ const escapeCell = (value) => {
1919
+ const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
1920
+ if (/[",\n]/.test(normalized)) {
1921
+ return `"${normalized.replace(/"/g, '""')}"`;
1922
+ }
1923
+ return normalized;
1924
+ };
1925
+ const lines = [];
1926
+ lines.push(columns.map(escapeCell).join(","));
1927
+ for (const row of rows) {
1928
+ lines.push(columns.map((column) => escapeCell(row[column])).join(","));
1929
+ }
1930
+ (0, import_node_fs2.writeFileSync)(outputPath, `${lines.join("\n")}
1931
+ `, "utf-8");
1932
+ const previewRows = rows.slice(0, 5);
1933
+ const previewColumns = columns.slice(0, 5);
1934
+ const preview = [
1935
+ previewColumns.join(","),
1936
+ ...previewRows.map((row) => previewColumns.map((column) => escapeCell(row[column])).join(","))
1937
+ ].join("\n");
1938
+ return {
1939
+ path: outputPath,
1940
+ rowCount: rows.length,
1941
+ columns,
1942
+ preview
1943
+ };
1944
+ }
1945
+ function extractSummaryFields(payload) {
1946
+ const candidates = candidateRoots(payload);
1947
+ for (const candidate of candidates) {
1948
+ if (!isPlainObject(candidate.value)) continue;
1949
+ const summaryEntries = Object.entries(candidate.value).filter(([, value]) => {
1950
+ return value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
1951
+ });
1952
+ if (summaryEntries.length === 0) continue;
1953
+ return Object.fromEntries(summaryEntries);
1954
+ }
1955
+ return {};
1956
+ }
1890
1957
  // Annotate the CommonJS export names for ESM import in node:
1891
1958
  0 && (module.exports = {
1892
1959
  AuthError,
@@ -1899,7 +1966,6 @@ function getDefinedPlayMetadata(value) {
1899
1966
  RateLimitError,
1900
1967
  SDK_API_CONTRACT,
1901
1968
  SDK_VERSION,
1902
- createToolCallResult,
1903
1969
  defineInput,
1904
1970
  definePlay,
1905
1971
  defineWorkflow,
@@ -1912,4 +1978,3 @@ function getDefinedPlayMetadata(value) {
1912
1978
  writeCsvOutputFile,
1913
1979
  writeJsonOutputFile
1914
1980
  });
1915
- //# sourceMappingURL=index.js.map