deepline 0.1.269 → 0.1.271

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.
@@ -99,6 +99,59 @@ const REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
99
99
  const REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 2_500_000;
100
100
  const DEEPLINEAGENT_EXECUTE_TIMEOUT_MS = 15 * 60 * 1000;
101
101
 
102
+ export type IngestionStorageRepairResult = {
103
+ status?: 'repaired';
104
+ connection_grants: {
105
+ runtime_role: string;
106
+ customer_db_role: string;
107
+ };
108
+ repaired: unknown[];
109
+ count: number;
110
+ repair?: {
111
+ location: { changed: boolean };
112
+ storage_contract: { applied: boolean; current: boolean };
113
+ runtime_migration: { current: boolean };
114
+ runtime_capabilities: {
115
+ before: {
116
+ reachable: boolean;
117
+ status: string;
118
+ storage_contract_current: boolean;
119
+ runtime_migration_current: boolean;
120
+ runtime_capabilities_ready: boolean;
121
+ capability_failures: string[];
122
+ };
123
+ after: {
124
+ reachable: boolean;
125
+ status: string;
126
+ storage_contract_current: boolean;
127
+ runtime_migration_current: boolean;
128
+ runtime_capabilities_ready: boolean;
129
+ capability_failures: string[];
130
+ };
131
+ runtime_role: {
132
+ currentRole: string | null;
133
+ dlMetaSchemaUsage: boolean;
134
+ uuidFunctionExecute: boolean;
135
+ enrichmentsSchemaUsage: boolean;
136
+ enrichmentsWriteReady: boolean;
137
+ storageSchemaUsage: boolean;
138
+ storageSchemaCreate: boolean;
139
+ };
140
+ customer_db_role: {
141
+ currentRole: string | null;
142
+ dlMetaSchemaUsage: boolean;
143
+ uuidFunctionExecute: boolean;
144
+ enrichmentsSchemaUsage: boolean;
145
+ enrichmentsWriteReady: boolean;
146
+ storageSchemaUsage: boolean;
147
+ storageSchemaCreate: boolean;
148
+ };
149
+ };
150
+ internal_relations: { reconciled: boolean };
151
+ materialized_tables: { repaired_count: number };
152
+ };
153
+ };
154
+
102
155
  function normalizePlayRunIntegrationMode(
103
156
  value: unknown,
104
157
  ): 'live' | 'eval_stub' | 'fixture' | undefined {
@@ -1592,20 +1645,14 @@ export class DeeplineClient {
1592
1645
  * grants plus materialized table grants. Org-admin only. Use when a run fails
1593
1646
  * with WORKSPACE_STORAGE_NOT_READY.
1594
1647
  */
1595
- async repairIngestionStorage(input?: { provider?: string }): Promise<{
1596
- connection_grants: { runtime_role: string; customer_db_role: string };
1597
- repaired: unknown[];
1598
- count: number;
1599
- }> {
1648
+ async repairIngestionStorage(input?: {
1649
+ provider?: string;
1650
+ }): Promise<IngestionStorageRepairResult> {
1600
1651
  // forbiddenAsApiError: the repair route returns a meaningful 403 for
1601
1652
  // non-org-admin callers. Without it, http.ts collapses 403 into a generic
1602
1653
  // AuthError (statusCode 401) and the CLI's "requires org admin" branch
1603
1654
  // could never fire.
1604
- return this.http.post<{
1605
- connection_grants: { runtime_role: string; customer_db_role: string };
1606
- repaired: unknown[];
1607
- count: number;
1608
- }>(
1655
+ return this.http.post<IngestionStorageRepairResult>(
1609
1656
  '/api/v2/ingestion/repair',
1610
1657
  {
1611
1658
  ...(input?.provider ? { provider: input.provider } : {}),
@@ -67,6 +67,7 @@ export type {
67
67
  BillingSubscriptionCancelResult,
68
68
  BillingSubscriptionStatus,
69
69
  BillingTopUpResult,
70
+ IngestionStorageRepairResult,
70
71
  PlayStatus,
71
72
  PlaySheetRow,
72
73
  PlaySheetRowsResult,
@@ -155,7 +155,7 @@ export const SDK_RELEASE = {
155
155
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
156
156
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
157
157
  // Operators use the checkout-local deepline-admin binary instead.
158
- version: '0.1.269',
158
+ version: '0.1.271',
159
159
  contracts: {
160
160
  api: {
161
161
  name: 'sdk-http-api',
@@ -250,6 +250,22 @@ export interface ToolDefinition {
250
250
  value: string;
251
251
  term?: string;
252
252
  }>;
253
+ /**
254
+ * Whether this tool is callable in the current workspace. `false` for a
255
+ * bring-your-own-credential provider (e.g. Apollo) that has not been
256
+ * connected — the agent should offer to connect it rather than call it.
257
+ */
258
+ connected?: boolean;
259
+ /**
260
+ * Connection status for discovery: `managed` (Deepline-run credentials),
261
+ * `connected` (your own credential is connected), or `requires_connection`
262
+ * (BYO provider not yet connected in this workspace).
263
+ */
264
+ credentialStatus?: 'managed' | 'connected' | 'requires_connection';
265
+ /** True when the tool requires a customer-provided credential to run. */
266
+ requiresOwnCredential?: boolean;
267
+ /** Actionable message shown when a connection is required. */
268
+ connectionMessage?: string;
253
269
  }
254
270
 
255
271
  export interface ModelProviderOptionField {
@@ -35,8 +35,10 @@ export const WORKSPACE_STORAGE_NOT_READY_CODE = 'WORKSPACE_STORAGE_NOT_READY';
35
35
  // postgres-URI passwords). The raw pg error goes in the Error `cause` for server
36
36
  // logs only, never into this message or the normalized public failure.
37
37
  export const WORKSPACE_STORAGE_NOT_READY_MESSAGE =
38
- 'Workspace storage for this organization is not ready, so the run was stopped before any provider calls were made (nothing was billed). ' +
39
- 'Ask an organization admin to run `deepline db repair` (POST /api/v2/ingestion/repair), then re-run. ' +
38
+ 'Workspace storage for this organization is unavailable, so this operation could not start. ' +
39
+ 'This blocked operation did not use Deepline credits. ' +
40
+ 'Earlier completed operations in the same run may already have used credits. ' +
41
+ 'Re-run the command. If it fails again, ask an organization admin to run `deepline db repair` (POST /api/v2/ingestion/repair), then re-run. ' +
40
42
  'If this keeps happening, contact Deepline support with the run ID.';
41
43
 
42
44
  export class WorkspaceStorageNotReadyError extends Error {
@@ -569,7 +569,8 @@ async function postRuntimeApi<TResponse>(
569
569
  );
570
570
  const maxAttempts = runtimeApiMaxAttempts(body.action);
571
571
  for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
572
- let response: Response;
572
+ let response: Response | null = null;
573
+ let parsed: Record<string, unknown> | null = null;
573
574
  const abortController = new AbortController();
574
575
  const timeout = setTimeout(
575
576
  () => abortController.abort(),
@@ -582,25 +583,55 @@ async function postRuntimeApi<TResponse>(
582
583
  body: JSON.stringify(body),
583
584
  signal: abortController.signal,
584
585
  });
586
+ let parsedValue: unknown;
587
+ try {
588
+ parsedValue = await response.json();
589
+ } catch (error) {
590
+ if (abortController.signal.aborted) throw error;
591
+ parsedValue = null;
592
+ }
593
+ parsed =
594
+ parsedValue !== null &&
595
+ typeof parsedValue === 'object' &&
596
+ !Array.isArray(parsedValue)
597
+ ? (parsedValue as Record<string, unknown>)
598
+ : null;
585
599
  } catch (error) {
600
+ clearTimeout(timeout);
586
601
  if (attempt < maxAttempts) {
587
602
  await sleepRuntimeApiRetry(body.action, attempt);
588
603
  continue;
589
604
  }
590
605
  const message = error instanceof Error ? error.message : String(error);
591
606
  throw new Error(
592
- `Runtime API request to ${url} failed before receiving a response: ${message}`,
607
+ `Runtime API request to ${url} failed ${
608
+ response
609
+ ? 'while reading the response body'
610
+ : 'before receiving a response'
611
+ }: ${message}`,
593
612
  );
594
613
  } finally {
595
614
  clearTimeout(timeout);
596
615
  }
597
616
 
598
- const parsed = (await response.json().catch(() => null)) as Record<
599
- string,
600
- unknown
601
- > | null;
602
617
  if (response.ok) {
603
- return parsed as TResponse;
618
+ if (parsed !== null) {
619
+ return parsed as TResponse;
620
+ }
621
+ // A proxy can deliver the successful status line and then truncate the
622
+ // response body. Treat that as a transport failure, not a typed success:
623
+ // every runtime action returns a JSON object and runtime writes are
624
+ // already retry-safe across the equivalent fetch-failed boundary.
625
+ if (attempt < maxAttempts) {
626
+ await sleepRuntimeApiRetry(body.action, attempt);
627
+ continue;
628
+ }
629
+ const requestId = response.headers.get('x-deepline-request-id');
630
+ throw new Error(
631
+ `Runtime API request to ${url} returned status ${response.status} ` +
632
+ `without a valid JSON response body (action=${body.action}` +
633
+ `${requestId ? `, request_id=${requestId}` : ''}).`,
634
+ );
604
635
  }
605
636
 
606
637
  const retryAfterMs =
package/dist/cli/index.js CHANGED
@@ -718,7 +718,7 @@ var SDK_RELEASE = {
718
718
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
719
719
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
720
720
  // Operators use the checkout-local deepline-admin binary instead.
721
- version: "0.1.269",
721
+ version: "0.1.271",
722
722
  contracts: {
723
723
  api: {
724
724
  name: "sdk-http-api",
@@ -8834,6 +8834,28 @@ function formatDbQueryError(sql, error) {
8834
8834
  }
8835
8835
  return errorMessage(error);
8836
8836
  }
8837
+ function dbRepairHumanLines(result) {
8838
+ const repair = result.repair;
8839
+ return [
8840
+ "Workspace storage repair completed.",
8841
+ ...repair ? [
8842
+ `Location changed: ${repair.location.changed ? "yes" : "no"}`,
8843
+ `Storage contract: ${repair.storage_contract.current ? "current" : "not ready"}`,
8844
+ `Runtime migration: ${repair.runtime_migration.current ? "current" : "not ready"}`,
8845
+ `Runtime capability probe: ${repair.runtime_capabilities.after.runtime_capabilities_ready ? "passed" : "failed"}`,
8846
+ `Materialized table grants reconciled: ${repair.materialized_tables.repaired_count}`
8847
+ ] : [
8848
+ "Runtime capability probe: unavailable from this server version",
8849
+ `Materialized table grants reconciled: ${result.count}`
8850
+ ],
8851
+ `Runtime role: ${result.connection_grants.runtime_role}`,
8852
+ `Customer DB role: ${result.connection_grants.customer_db_role}`
8853
+ ];
8854
+ }
8855
+ function dbRepairPlainText(result) {
8856
+ return result.repair ? "Workspace storage repair completed. Runtime capability probe passed.\n" : `Workspace storage repair completed. ${result.count} materialized table grant(s) reconciled; runtime capability probe unavailable.
8857
+ `;
8858
+ }
8837
8859
  function writeCustomerDbCsv(result, outPath) {
8838
8860
  const resolved = (0, import_node_path9.resolve)(outPath);
8839
8861
  (0, import_node_fs8.writeFileSync)(
@@ -9015,26 +9037,23 @@ async function handleDbRepair(args) {
9015
9037
  printCommandEnvelope(
9016
9038
  {
9017
9039
  command: "db repair",
9040
+ status: result.status,
9018
9041
  repaired: result.repaired,
9019
9042
  count: result.count,
9020
9043
  connection_grants: result.connection_grants,
9044
+ repair: result.repair,
9021
9045
  render: {
9022
9046
  sections: [
9023
9047
  {
9024
9048
  title: "storage contract repair",
9025
- lines: [
9026
- `Repaired ${result.count} table(s).`,
9027
- `Runtime role: ${result.connection_grants.runtime_role}`,
9028
- `Customer DB role: ${result.connection_grants.customer_db_role}`
9029
- ]
9049
+ lines: dbRepairHumanLines(result)
9030
9050
  }
9031
9051
  ]
9032
9052
  }
9033
9053
  },
9034
9054
  {
9035
9055
  json: jsonOutput,
9036
- text: `Repaired ${result.count} table(s). Storage grants re-established.
9037
- `
9056
+ text: dbRepairPlainText(result)
9038
9057
  }
9039
9058
  );
9040
9059
  return 0;
@@ -26603,6 +26622,15 @@ function requiredInputIds(tool) {
26603
26622
  );
26604
26623
  return toolInputFieldsForDisplay(inputSchema).filter((field) => field.required === true).map((field) => String(field.name ?? "")).filter(Boolean);
26605
26624
  }
26625
+ function notConnectedSuffix(tool) {
26626
+ const record = tool;
26627
+ const status = stringField2(record, "credentialStatus", "credential_status");
26628
+ const connected = record.connected;
26629
+ if (status === "requires_connection" || connected === false) {
26630
+ return " - \u26A0 requires your credentials \u2014 not connected (connect to use)";
26631
+ }
26632
+ return "";
26633
+ }
26606
26634
  function shortPricingHint(tool) {
26607
26635
  const pricing = recordField2(
26608
26636
  tool,
@@ -26718,7 +26746,8 @@ async function listToolsInCategory(category, emitJson) {
26718
26746
  provider: tool.provider,
26719
26747
  required: requiredInputIds(tool),
26720
26748
  pricing: shortPricingHint(tool),
26721
- description: firstSentence(tool.description)
26749
+ description: firstSentence(tool.description),
26750
+ notConnected: notConnectedSuffix(tool)
26722
26751
  })).sort((a, b) => a.id.localeCompare(b.id));
26723
26752
  const idWidth = rows.reduce((max, row) => Math.max(max, row.id.length), 0);
26724
26753
  const render = {
@@ -26730,7 +26759,7 @@ async function listToolsInCategory(category, emitJson) {
26730
26759
  const required = row.required.length ? `(${row.required.join(", ")})` : "(no required inputs)";
26731
26760
  const pricing = row.pricing ? ` [${row.pricing}]` : "";
26732
26761
  const description = row.description ? ` - ${row.description}` : "";
26733
- return `${id} ${required}${pricing}${description}`;
26762
+ return `${id} ${required}${pricing}${description}${row.notConnected}`;
26734
26763
  })
26735
26764
  },
26736
26765
  {
@@ -26771,7 +26800,7 @@ async function listToolsForCategoryFilter(requestedCategories, emitJson, compact
26771
26800
  lines: items.map((item) => {
26772
26801
  const cats = item.categories.length ? ` [${item.categories.join(", ")}]` : "";
26773
26802
  const pricing = formatListedToolCost(item);
26774
- return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}`;
26803
+ return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}${notConnectedSuffix(item)}`;
26775
26804
  })
26776
26805
  },
26777
26806
  {
@@ -703,7 +703,7 @@ var SDK_RELEASE = {
703
703
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
704
704
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
705
705
  // Operators use the checkout-local deepline-admin binary instead.
706
- version: "0.1.269",
706
+ version: "0.1.271",
707
707
  contracts: {
708
708
  api: {
709
709
  name: "sdk-http-api",
@@ -8839,6 +8839,28 @@ function formatDbQueryError(sql, error) {
8839
8839
  }
8840
8840
  return errorMessage(error);
8841
8841
  }
8842
+ function dbRepairHumanLines(result) {
8843
+ const repair = result.repair;
8844
+ return [
8845
+ "Workspace storage repair completed.",
8846
+ ...repair ? [
8847
+ `Location changed: ${repair.location.changed ? "yes" : "no"}`,
8848
+ `Storage contract: ${repair.storage_contract.current ? "current" : "not ready"}`,
8849
+ `Runtime migration: ${repair.runtime_migration.current ? "current" : "not ready"}`,
8850
+ `Runtime capability probe: ${repair.runtime_capabilities.after.runtime_capabilities_ready ? "passed" : "failed"}`,
8851
+ `Materialized table grants reconciled: ${repair.materialized_tables.repaired_count}`
8852
+ ] : [
8853
+ "Runtime capability probe: unavailable from this server version",
8854
+ `Materialized table grants reconciled: ${result.count}`
8855
+ ],
8856
+ `Runtime role: ${result.connection_grants.runtime_role}`,
8857
+ `Customer DB role: ${result.connection_grants.customer_db_role}`
8858
+ ];
8859
+ }
8860
+ function dbRepairPlainText(result) {
8861
+ return result.repair ? "Workspace storage repair completed. Runtime capability probe passed.\n" : `Workspace storage repair completed. ${result.count} materialized table grant(s) reconciled; runtime capability probe unavailable.
8862
+ `;
8863
+ }
8842
8864
  function writeCustomerDbCsv(result, outPath) {
8843
8865
  const resolved = resolve6(outPath);
8844
8866
  writeFileSync7(
@@ -9020,26 +9042,23 @@ async function handleDbRepair(args) {
9020
9042
  printCommandEnvelope(
9021
9043
  {
9022
9044
  command: "db repair",
9045
+ status: result.status,
9023
9046
  repaired: result.repaired,
9024
9047
  count: result.count,
9025
9048
  connection_grants: result.connection_grants,
9049
+ repair: result.repair,
9026
9050
  render: {
9027
9051
  sections: [
9028
9052
  {
9029
9053
  title: "storage contract repair",
9030
- lines: [
9031
- `Repaired ${result.count} table(s).`,
9032
- `Runtime role: ${result.connection_grants.runtime_role}`,
9033
- `Customer DB role: ${result.connection_grants.customer_db_role}`
9034
- ]
9054
+ lines: dbRepairHumanLines(result)
9035
9055
  }
9036
9056
  ]
9037
9057
  }
9038
9058
  },
9039
9059
  {
9040
9060
  json: jsonOutput,
9041
- text: `Repaired ${result.count} table(s). Storage grants re-established.
9042
- `
9061
+ text: dbRepairPlainText(result)
9043
9062
  }
9044
9063
  );
9045
9064
  return 0;
@@ -26651,6 +26670,15 @@ function requiredInputIds(tool) {
26651
26670
  );
26652
26671
  return toolInputFieldsForDisplay(inputSchema).filter((field) => field.required === true).map((field) => String(field.name ?? "")).filter(Boolean);
26653
26672
  }
26673
+ function notConnectedSuffix(tool) {
26674
+ const record = tool;
26675
+ const status = stringField2(record, "credentialStatus", "credential_status");
26676
+ const connected = record.connected;
26677
+ if (status === "requires_connection" || connected === false) {
26678
+ return " - \u26A0 requires your credentials \u2014 not connected (connect to use)";
26679
+ }
26680
+ return "";
26681
+ }
26654
26682
  function shortPricingHint(tool) {
26655
26683
  const pricing = recordField2(
26656
26684
  tool,
@@ -26766,7 +26794,8 @@ async function listToolsInCategory(category, emitJson) {
26766
26794
  provider: tool.provider,
26767
26795
  required: requiredInputIds(tool),
26768
26796
  pricing: shortPricingHint(tool),
26769
- description: firstSentence(tool.description)
26797
+ description: firstSentence(tool.description),
26798
+ notConnected: notConnectedSuffix(tool)
26770
26799
  })).sort((a, b) => a.id.localeCompare(b.id));
26771
26800
  const idWidth = rows.reduce((max, row) => Math.max(max, row.id.length), 0);
26772
26801
  const render = {
@@ -26778,7 +26807,7 @@ async function listToolsInCategory(category, emitJson) {
26778
26807
  const required = row.required.length ? `(${row.required.join(", ")})` : "(no required inputs)";
26779
26808
  const pricing = row.pricing ? ` [${row.pricing}]` : "";
26780
26809
  const description = row.description ? ` - ${row.description}` : "";
26781
- return `${id} ${required}${pricing}${description}`;
26810
+ return `${id} ${required}${pricing}${description}${row.notConnected}`;
26782
26811
  })
26783
26812
  },
26784
26813
  {
@@ -26819,7 +26848,7 @@ async function listToolsForCategoryFilter(requestedCategories, emitJson, compact
26819
26848
  lines: items.map((item) => {
26820
26849
  const cats = item.categories.length ? ` [${item.categories.join(", ")}]` : "";
26821
26850
  const pricing = formatListedToolCost(item);
26822
- return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}`;
26851
+ return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}${notConnectedSuffix(item)}`;
26823
26852
  })
26824
26853
  },
26825
26854
  {
package/dist/index.d.mts CHANGED
@@ -239,6 +239,22 @@ interface ToolDefinition {
239
239
  value: string;
240
240
  term?: string;
241
241
  }>;
242
+ /**
243
+ * Whether this tool is callable in the current workspace. `false` for a
244
+ * bring-your-own-credential provider (e.g. Apollo) that has not been
245
+ * connected — the agent should offer to connect it rather than call it.
246
+ */
247
+ connected?: boolean;
248
+ /**
249
+ * Connection status for discovery: `managed` (Deepline-run credentials),
250
+ * `connected` (your own credential is connected), or `requires_connection`
251
+ * (BYO provider not yet connected in this workspace).
252
+ */
253
+ credentialStatus?: 'managed' | 'connected' | 'requires_connection';
254
+ /** True when the tool requires a customer-provided credential to run. */
255
+ requiresOwnCredential?: boolean;
256
+ /** Actionable message shown when a connection is required. */
257
+ connectionMessage?: string;
242
258
  }
243
259
  interface ModelProviderOptionField {
244
260
  name: string;
@@ -1405,6 +1421,69 @@ type EnrichCompiledConfig = {
1405
1421
  };
1406
1422
  };
1407
1423
 
1424
+ type IngestionStorageRepairResult = {
1425
+ status?: 'repaired';
1426
+ connection_grants: {
1427
+ runtime_role: string;
1428
+ customer_db_role: string;
1429
+ };
1430
+ repaired: unknown[];
1431
+ count: number;
1432
+ repair?: {
1433
+ location: {
1434
+ changed: boolean;
1435
+ };
1436
+ storage_contract: {
1437
+ applied: boolean;
1438
+ current: boolean;
1439
+ };
1440
+ runtime_migration: {
1441
+ current: boolean;
1442
+ };
1443
+ runtime_capabilities: {
1444
+ before: {
1445
+ reachable: boolean;
1446
+ status: string;
1447
+ storage_contract_current: boolean;
1448
+ runtime_migration_current: boolean;
1449
+ runtime_capabilities_ready: boolean;
1450
+ capability_failures: string[];
1451
+ };
1452
+ after: {
1453
+ reachable: boolean;
1454
+ status: string;
1455
+ storage_contract_current: boolean;
1456
+ runtime_migration_current: boolean;
1457
+ runtime_capabilities_ready: boolean;
1458
+ capability_failures: string[];
1459
+ };
1460
+ runtime_role: {
1461
+ currentRole: string | null;
1462
+ dlMetaSchemaUsage: boolean;
1463
+ uuidFunctionExecute: boolean;
1464
+ enrichmentsSchemaUsage: boolean;
1465
+ enrichmentsWriteReady: boolean;
1466
+ storageSchemaUsage: boolean;
1467
+ storageSchemaCreate: boolean;
1468
+ };
1469
+ customer_db_role: {
1470
+ currentRole: string | null;
1471
+ dlMetaSchemaUsage: boolean;
1472
+ uuidFunctionExecute: boolean;
1473
+ enrichmentsSchemaUsage: boolean;
1474
+ enrichmentsWriteReady: boolean;
1475
+ storageSchemaUsage: boolean;
1476
+ storageSchemaCreate: boolean;
1477
+ };
1478
+ };
1479
+ internal_relations: {
1480
+ reconciled: boolean;
1481
+ };
1482
+ materialized_tables: {
1483
+ repaired_count: number;
1484
+ };
1485
+ };
1486
+ };
1408
1487
  type ExecuteToolRawOptions = {
1409
1488
  includeToolMetadata?: boolean;
1410
1489
  responseIntent?: 'dataset' | 'raw' | 'row_artifact';
@@ -1933,14 +2012,7 @@ declare class DeeplineClient {
1933
2012
  */
1934
2013
  repairIngestionStorage(input?: {
1935
2014
  provider?: string;
1936
- }): Promise<{
1937
- connection_grants: {
1938
- runtime_role: string;
1939
- customer_db_role: string;
1940
- };
1941
- repaired: unknown[];
1942
- count: number;
1943
- }>;
2015
+ }): Promise<IngestionStorageRepairResult>;
1944
2016
  /**
1945
2017
  * Start a play run.
1946
2018
  *
@@ -4583,4 +4655,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
4583
4655
  */
4584
4656
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
4585
4657
 
4586
- export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
4658
+ export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, type IngestionStorageRepairResult, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.d.ts CHANGED
@@ -239,6 +239,22 @@ interface ToolDefinition {
239
239
  value: string;
240
240
  term?: string;
241
241
  }>;
242
+ /**
243
+ * Whether this tool is callable in the current workspace. `false` for a
244
+ * bring-your-own-credential provider (e.g. Apollo) that has not been
245
+ * connected — the agent should offer to connect it rather than call it.
246
+ */
247
+ connected?: boolean;
248
+ /**
249
+ * Connection status for discovery: `managed` (Deepline-run credentials),
250
+ * `connected` (your own credential is connected), or `requires_connection`
251
+ * (BYO provider not yet connected in this workspace).
252
+ */
253
+ credentialStatus?: 'managed' | 'connected' | 'requires_connection';
254
+ /** True when the tool requires a customer-provided credential to run. */
255
+ requiresOwnCredential?: boolean;
256
+ /** Actionable message shown when a connection is required. */
257
+ connectionMessage?: string;
242
258
  }
243
259
  interface ModelProviderOptionField {
244
260
  name: string;
@@ -1405,6 +1421,69 @@ type EnrichCompiledConfig = {
1405
1421
  };
1406
1422
  };
1407
1423
 
1424
+ type IngestionStorageRepairResult = {
1425
+ status?: 'repaired';
1426
+ connection_grants: {
1427
+ runtime_role: string;
1428
+ customer_db_role: string;
1429
+ };
1430
+ repaired: unknown[];
1431
+ count: number;
1432
+ repair?: {
1433
+ location: {
1434
+ changed: boolean;
1435
+ };
1436
+ storage_contract: {
1437
+ applied: boolean;
1438
+ current: boolean;
1439
+ };
1440
+ runtime_migration: {
1441
+ current: boolean;
1442
+ };
1443
+ runtime_capabilities: {
1444
+ before: {
1445
+ reachable: boolean;
1446
+ status: string;
1447
+ storage_contract_current: boolean;
1448
+ runtime_migration_current: boolean;
1449
+ runtime_capabilities_ready: boolean;
1450
+ capability_failures: string[];
1451
+ };
1452
+ after: {
1453
+ reachable: boolean;
1454
+ status: string;
1455
+ storage_contract_current: boolean;
1456
+ runtime_migration_current: boolean;
1457
+ runtime_capabilities_ready: boolean;
1458
+ capability_failures: string[];
1459
+ };
1460
+ runtime_role: {
1461
+ currentRole: string | null;
1462
+ dlMetaSchemaUsage: boolean;
1463
+ uuidFunctionExecute: boolean;
1464
+ enrichmentsSchemaUsage: boolean;
1465
+ enrichmentsWriteReady: boolean;
1466
+ storageSchemaUsage: boolean;
1467
+ storageSchemaCreate: boolean;
1468
+ };
1469
+ customer_db_role: {
1470
+ currentRole: string | null;
1471
+ dlMetaSchemaUsage: boolean;
1472
+ uuidFunctionExecute: boolean;
1473
+ enrichmentsSchemaUsage: boolean;
1474
+ enrichmentsWriteReady: boolean;
1475
+ storageSchemaUsage: boolean;
1476
+ storageSchemaCreate: boolean;
1477
+ };
1478
+ };
1479
+ internal_relations: {
1480
+ reconciled: boolean;
1481
+ };
1482
+ materialized_tables: {
1483
+ repaired_count: number;
1484
+ };
1485
+ };
1486
+ };
1408
1487
  type ExecuteToolRawOptions = {
1409
1488
  includeToolMetadata?: boolean;
1410
1489
  responseIntent?: 'dataset' | 'raw' | 'row_artifact';
@@ -1933,14 +2012,7 @@ declare class DeeplineClient {
1933
2012
  */
1934
2013
  repairIngestionStorage(input?: {
1935
2014
  provider?: string;
1936
- }): Promise<{
1937
- connection_grants: {
1938
- runtime_role: string;
1939
- customer_db_role: string;
1940
- };
1941
- repaired: unknown[];
1942
- count: number;
1943
- }>;
2015
+ }): Promise<IngestionStorageRepairResult>;
1944
2016
  /**
1945
2017
  * Start a play run.
1946
2018
  *
@@ -4583,4 +4655,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
4583
4655
  */
4584
4656
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
4585
4657
 
4586
- export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
4658
+ export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, type IngestionStorageRepairResult, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.js CHANGED
@@ -437,7 +437,7 @@ var SDK_RELEASE = {
437
437
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
438
438
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
439
439
  // Operators use the checkout-local deepline-admin binary instead.
440
- version: "0.1.269",
440
+ version: "0.1.271",
441
441
  contracts: {
442
442
  api: {
443
443
  name: "sdk-http-api",
package/dist/index.mjs CHANGED
@@ -367,7 +367,7 @@ var SDK_RELEASE = {
367
367
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
368
368
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
369
369
  // Operators use the checkout-local deepline-admin binary instead.
370
- version: "0.1.269",
370
+ version: "0.1.271",
371
371
  contracts: {
372
372
  api: {
373
373
  name: "sdk-http-api",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.269",
3
+ "version": "0.1.271",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {