deepline 0.1.316 → 0.1.317

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.
@@ -157,7 +157,7 @@ export const SDK_RELEASE = {
157
157
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
158
158
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
159
159
  // Operators use the checkout-local deepline-admin binary instead.
160
- version: '0.1.316',
160
+ version: '0.1.317',
161
161
  contracts: {
162
162
  api: {
163
163
  name: 'sdk-http-api',
@@ -1371,6 +1371,12 @@ export class PlayContextImpl {
1371
1371
  }> = [];
1372
1372
  private processedRowCount = 0;
1373
1373
  private sleepBoundaryIndex = 0;
1374
+ /**
1375
+ * `ctx.customerDb.query` is syntactic sugar over the query_customer_db tool.
1376
+ * Keep generated tool ids distinct so separate imperative queries retain
1377
+ * their normal mutation semantics.
1378
+ */
1379
+ private customerDbQueryIndex = 0;
1374
1380
  private readonly secretRedactor: SecretRedactionContext =
1375
1381
  createSecretRedactionContext();
1376
1382
  private mapInvocationIndex = 0;
@@ -1475,17 +1481,39 @@ export class PlayContextImpl {
1475
1481
  }
1476
1482
  readonly customerDb = {
1477
1483
  query: async <TRow extends object = Record<string, unknown>>(
1478
- statement:
1479
- | string
1480
- | { kind: 'sql.query'; text: string; values: readonly unknown[] },
1484
+ statement: string,
1481
1485
  options?: { maxRows?: number; timeoutMs?: number },
1482
1486
  ): Promise<TRow[]> => {
1483
- if (!this.#options.queryCustomerDb) {
1487
+ const result = (await this.tools.execute({
1488
+ id: `customer_db_query_${this.customerDbQueryIndex++}`,
1489
+ tool: 'query_customer_db',
1490
+ input: {
1491
+ sql: statement,
1492
+ ...(options?.maxRows !== undefined
1493
+ ? { max_rows: options.maxRows }
1494
+ : {}),
1495
+ },
1496
+ description: 'Customer DB query',
1497
+ // The direct executor never reused a prior SQL result. Preserve that
1498
+ // imperative behavior for reads and mutations alike.
1499
+ force: true,
1500
+ ...(options?.timeoutMs !== undefined
1501
+ ? { timeoutMs: options.timeoutMs }
1502
+ : {}),
1503
+ })) as { toolOutput?: { raw?: unknown } };
1504
+ const raw = result.toolOutput?.raw;
1505
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
1506
+ throw new Error(
1507
+ 'query_customer_db returned an invalid Customer DB result.',
1508
+ );
1509
+ }
1510
+ const rows = (raw as { rows?: unknown }).rows;
1511
+ if (rows === undefined) return [];
1512
+ if (!Array.isArray(rows)) {
1484
1513
  throw new Error(
1485
- 'ctx.customerDb.query(...) is unavailable because no Customer DB query executor was configured.',
1514
+ 'query_customer_db returned an invalid Customer DB rows result.',
1486
1515
  );
1487
1516
  }
1488
- const rows = await this.#options.queryCustomerDb(statement, options);
1489
1517
  return [...rows] as TRow[];
1490
1518
  },
1491
1519
  };
@@ -298,22 +298,6 @@ export interface ToolExecutionRequest {
298
298
  receiptWaitMs?: number;
299
299
  }
300
300
 
301
- export type SqlQuery = {
302
- readonly kind: 'sql.query';
303
- readonly text: string;
304
- readonly values: readonly unknown[];
305
- };
306
-
307
- export type CustomerDbQueryOptions = {
308
- maxRows?: number;
309
- timeoutMs?: number;
310
- };
311
-
312
- export type CustomerDbQueryHandler = (
313
- statement: SqlQuery | string,
314
- options?: CustomerDbQueryOptions,
315
- ) => Promise<readonly Record<string, unknown>[]>;
316
-
317
301
  export interface PlayCallOptions {
318
302
  description?: string;
319
303
  /**
@@ -732,7 +716,6 @@ export interface ContextOptions {
732
716
  toolDispatcherMaxInFlightGroups?: number;
733
717
  /** Deterministic test override for the active-group cap per scheduling lane. */
734
718
  toolDispatcherMaxInFlightGroupsPerLane?: number;
735
- queryCustomerDb?: CustomerDbQueryHandler;
736
719
  executeStructuredPlayDefinition?: (input: {
737
720
  definition: PlayStructuredDefinition;
738
721
  ctx: unknown;
package/dist/cli/index.js CHANGED
@@ -1037,7 +1037,7 @@ var SDK_RELEASE = {
1037
1037
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
1038
1038
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
1039
1039
  // Operators use the checkout-local deepline-admin binary instead.
1040
- version: "0.1.316",
1040
+ version: "0.1.317",
1041
1041
  contracts: {
1042
1042
  api: {
1043
1043
  name: "sdk-http-api",
@@ -1022,7 +1022,7 @@ var SDK_RELEASE = {
1022
1022
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
1023
1023
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
1024
1024
  // Operators use the checkout-local deepline-admin binary instead.
1025
- version: "0.1.316",
1025
+ version: "0.1.317",
1026
1026
  contracts: {
1027
1027
  api: {
1028
1028
  name: "sdk-http-api",
package/dist/index.js CHANGED
@@ -760,7 +760,7 @@ var SDK_RELEASE = {
760
760
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
761
761
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
762
762
  // Operators use the checkout-local deepline-admin binary instead.
763
- version: "0.1.316",
763
+ version: "0.1.317",
764
764
  contracts: {
765
765
  api: {
766
766
  name: "sdk-http-api",
package/dist/index.mjs CHANGED
@@ -686,7 +686,7 @@ var SDK_RELEASE = {
686
686
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
687
687
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
688
688
  // Operators use the checkout-local deepline-admin binary instead.
689
- version: "0.1.316",
689
+ version: "0.1.317",
690
690
  contracts: {
691
691
  api: {
692
692
  name: "sdk-http-api",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.316",
3
+ "version": "0.1.317",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {