deepline 0.1.270 → 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.
@@ -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.270',
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 {
@@ -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.270",
721
+ version: "0.1.271",
722
722
  contracts: {
723
723
  api: {
724
724
  name: "sdk-http-api",
@@ -26622,6 +26622,15 @@ function requiredInputIds(tool) {
26622
26622
  );
26623
26623
  return toolInputFieldsForDisplay(inputSchema).filter((field) => field.required === true).map((field) => String(field.name ?? "")).filter(Boolean);
26624
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
+ }
26625
26634
  function shortPricingHint(tool) {
26626
26635
  const pricing = recordField2(
26627
26636
  tool,
@@ -26737,7 +26746,8 @@ async function listToolsInCategory(category, emitJson) {
26737
26746
  provider: tool.provider,
26738
26747
  required: requiredInputIds(tool),
26739
26748
  pricing: shortPricingHint(tool),
26740
- description: firstSentence(tool.description)
26749
+ description: firstSentence(tool.description),
26750
+ notConnected: notConnectedSuffix(tool)
26741
26751
  })).sort((a, b) => a.id.localeCompare(b.id));
26742
26752
  const idWidth = rows.reduce((max, row) => Math.max(max, row.id.length), 0);
26743
26753
  const render = {
@@ -26749,7 +26759,7 @@ async function listToolsInCategory(category, emitJson) {
26749
26759
  const required = row.required.length ? `(${row.required.join(", ")})` : "(no required inputs)";
26750
26760
  const pricing = row.pricing ? ` [${row.pricing}]` : "";
26751
26761
  const description = row.description ? ` - ${row.description}` : "";
26752
- return `${id} ${required}${pricing}${description}`;
26762
+ return `${id} ${required}${pricing}${description}${row.notConnected}`;
26753
26763
  })
26754
26764
  },
26755
26765
  {
@@ -26790,7 +26800,7 @@ async function listToolsForCategoryFilter(requestedCategories, emitJson, compact
26790
26800
  lines: items.map((item) => {
26791
26801
  const cats = item.categories.length ? ` [${item.categories.join(", ")}]` : "";
26792
26802
  const pricing = formatListedToolCost(item);
26793
- return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}`;
26803
+ return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}${notConnectedSuffix(item)}`;
26794
26804
  })
26795
26805
  },
26796
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.270",
706
+ version: "0.1.271",
707
707
  contracts: {
708
708
  api: {
709
709
  name: "sdk-http-api",
@@ -26670,6 +26670,15 @@ function requiredInputIds(tool) {
26670
26670
  );
26671
26671
  return toolInputFieldsForDisplay(inputSchema).filter((field) => field.required === true).map((field) => String(field.name ?? "")).filter(Boolean);
26672
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
+ }
26673
26682
  function shortPricingHint(tool) {
26674
26683
  const pricing = recordField2(
26675
26684
  tool,
@@ -26785,7 +26794,8 @@ async function listToolsInCategory(category, emitJson) {
26785
26794
  provider: tool.provider,
26786
26795
  required: requiredInputIds(tool),
26787
26796
  pricing: shortPricingHint(tool),
26788
- description: firstSentence(tool.description)
26797
+ description: firstSentence(tool.description),
26798
+ notConnected: notConnectedSuffix(tool)
26789
26799
  })).sort((a, b) => a.id.localeCompare(b.id));
26790
26800
  const idWidth = rows.reduce((max, row) => Math.max(max, row.id.length), 0);
26791
26801
  const render = {
@@ -26797,7 +26807,7 @@ async function listToolsInCategory(category, emitJson) {
26797
26807
  const required = row.required.length ? `(${row.required.join(", ")})` : "(no required inputs)";
26798
26808
  const pricing = row.pricing ? ` [${row.pricing}]` : "";
26799
26809
  const description = row.description ? ` - ${row.description}` : "";
26800
- return `${id} ${required}${pricing}${description}`;
26810
+ return `${id} ${required}${pricing}${description}${row.notConnected}`;
26801
26811
  })
26802
26812
  },
26803
26813
  {
@@ -26838,7 +26848,7 @@ async function listToolsForCategoryFilter(requestedCategories, emitJson, compact
26838
26848
  lines: items.map((item) => {
26839
26849
  const cats = item.categories.length ? ` [${item.categories.join(", ")}]` : "";
26840
26850
  const pricing = formatListedToolCost(item);
26841
- return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}`;
26851
+ return `${item.toolId}${cats} - ${item.description}${pricing ? ` - ${pricing}` : ""}${notConnectedSuffix(item)}`;
26842
26852
  })
26843
26853
  },
26844
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;
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;
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.270",
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.270",
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.270",
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": {