deepline 0.2.14 → 0.2.16

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.
@@ -160,7 +160,7 @@ export const SDK_RELEASE = {
160
160
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
161
161
  // exposed storage-dependent synchronous access. This deliberate minor
162
162
  // release keeps lazy paging semantics independent of row residency.
163
- version: '0.2.14',
163
+ version: '0.2.16',
164
164
  contracts: {
165
165
  api: {
166
166
  name: 'sdk-http-api',
@@ -5844,17 +5844,21 @@ export async function heartbeatRuntimeWorkReceipts(
5844
5844
  JOIN unnest($3::text[]) WITH ORDINALITY AS lease_values(lease_id, ord)
5845
5845
  ON lease_values.ord = key_values.ord
5846
5846
  ),
5847
+ unique_inputs AS (
5848
+ SELECT DISTINCT key_hex, lease_id
5849
+ FROM input_keys
5850
+ ),
5847
5851
  renewed AS (
5848
5852
  UPDATE ${workReceiptTable(session)} AS target
5849
5853
  SET lease_expires_at = now() + ($4::double precision * interval '1 millisecond'),
5850
5854
  updated_at = now()
5851
- FROM input_keys
5852
- WHERE target.k = decode(input_keys.key_hex, 'hex')
5855
+ FROM unique_inputs
5856
+ WHERE target.k = decode(unique_inputs.key_hex, 'hex')
5853
5857
  AND ${workReceiptHeartbeatPredicateSql({
5854
5858
  receiptTable: 'target',
5855
5859
  ownerRunIdSql: '$2::text',
5856
5860
  ownerRunAttemptSql: '$5',
5857
- leaseIdSql: 'input_keys.lease_id',
5861
+ leaseIdSql: 'unique_inputs.lease_id',
5858
5862
  })}
5859
5863
  RETURNING target.k,
5860
5864
  target.status,
@@ -5867,8 +5871,7 @@ export async function heartbeatRuntimeWorkReceipts(
5867
5871
  target.lease_owner_run_id,
5868
5872
  target.lease_owner_attempt,
5869
5873
  target.lease_expires_at,
5870
- target.updated_at,
5871
- input_keys.ord
5874
+ target.updated_at
5872
5875
  ),
5873
5876
  returned AS (
5874
5877
  SELECT renewed.k,
@@ -5885,7 +5888,9 @@ export async function heartbeatRuntimeWorkReceipts(
5885
5888
  renewed.updated_at,
5886
5889
  input_keys.ord
5887
5890
  FROM input_keys
5888
- LEFT JOIN renewed ON renewed.ord = input_keys.ord
5891
+ LEFT JOIN renewed
5892
+ ON renewed.k = decode(input_keys.key_hex, 'hex')
5893
+ AND renewed.lease_id = input_keys.lease_id
5889
5894
  )
5890
5895
  SELECT convert_from(returned.k, 'UTF8') AS k,
5891
5896
  returned.status,
@@ -25,7 +25,10 @@ import {
25
25
  skipRuntimeStepReceiptViaAppRuntime,
26
26
  type WorkerRuntimeApiContext,
27
27
  } from './app-runtime-api';
28
- import { RuntimeReceiptWriter } from './runtime-receipt-writer';
28
+ import {
29
+ RuntimeReceiptWriter,
30
+ RuntimeReceiptWriterResultCountError,
31
+ } from './runtime-receipt-writer';
29
32
 
30
33
  type ReceiptOutput =
31
34
  | RuntimeStepReceipt
@@ -490,17 +493,43 @@ async function sendReceiptCommands(input: {
490
493
  ReceiptCommand,
491
494
  { kind: 'heartbeat' }
492
495
  >[];
493
- const leaseIds = commands.map((command) => command.input.leaseId);
496
+ const uniqueCommands: (typeof commands)[number][] = [];
497
+ const uniqueIndexByIdentity = new Map<string, number>();
498
+ const originalToUniqueIndex = commands.map((command) => {
499
+ const identity = JSON.stringify([
500
+ command.input.key,
501
+ command.input.leaseId,
502
+ ]);
503
+ const existingIndex = uniqueIndexByIdentity.get(identity);
504
+ if (existingIndex !== undefined) return existingIndex;
505
+ const uniqueIndex = uniqueCommands.length;
506
+ uniqueCommands.push(command);
507
+ uniqueIndexByIdentity.set(identity, uniqueIndex);
508
+ return uniqueIndex;
509
+ });
510
+ const leaseIds = uniqueCommands.map((command) => command.input.leaseId);
494
511
  const sharedLeaseId = leaseIds.every((leaseId) => leaseId === leaseIds[0])
495
512
  ? leaseIds[0]
496
513
  : undefined;
497
- return await heartbeatRuntimeStepReceiptsViaAppRuntime(input.context, {
498
- playName: input.playName,
499
- runId: first.input.runId,
500
- runAttempt: first.input.runAttempt,
501
- ...(sharedLeaseId ? { leaseId: sharedLeaseId } : { leaseIds }),
502
- keys: commands.map((command) => command.input.key),
503
- });
514
+ const uniqueResults = await heartbeatRuntimeStepReceiptsViaAppRuntime(
515
+ input.context,
516
+ {
517
+ playName: input.playName,
518
+ runId: first.input.runId,
519
+ runAttempt: first.input.runAttempt,
520
+ ...(sharedLeaseId ? { leaseId: sharedLeaseId } : { leaseIds }),
521
+ keys: uniqueCommands.map((command) => command.input.key),
522
+ },
523
+ );
524
+ if (uniqueResults.length !== uniqueCommands.length) {
525
+ throw new RuntimeReceiptWriterResultCountError(
526
+ uniqueCommands.length,
527
+ uniqueResults.length,
528
+ );
529
+ }
530
+ return originalToUniqueIndex.map(
531
+ (uniqueIndex) => uniqueResults[uniqueIndex]!,
532
+ );
504
533
  }
505
534
  case 'acquire_execution_lock':
506
535
  return [
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,7 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.14",
1047
+ version: "0.2.16",
1048
1048
  contracts: {
1049
1049
  api: {
1050
1050
  name: "sdk-http-api",
@@ -7787,6 +7787,7 @@ async function handleUsage(options) {
7787
7787
  const params = new URLSearchParams();
7788
7788
  if (options.limit) params.set("recent_limit", options.limit);
7789
7789
  if (options.offset) params.set("recent_offset", options.offset);
7790
+ if (options.cursor) params.set("recent_cursor", options.cursor);
7790
7791
  if (options.runId) params.set("run_id", options.runId);
7791
7792
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
7792
7793
  const payload = await http.get(
@@ -7804,7 +7805,10 @@ async function handleUsage(options) {
7804
7805
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
7805
7806
  ...recentUsageLines(
7806
7807
  Array.isArray(recent.entries) ? recent.entries : []
7807
- )
7808
+ ),
7809
+ ...typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? [
7810
+ `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}`
7811
+ ] : []
7808
7812
  ];
7809
7813
  printCommandEnvelope(
7810
7814
  {
@@ -8527,14 +8531,17 @@ Examples:
8527
8531
  `
8528
8532
  Notes:
8529
8533
  Read-only. Shows last-30-day Deepline credit usage plus a bounded recent-call
8530
- page. Use --limit/--offset to paginate the recent-call section.
8534
+ page. Use --limit/--cursor to paginate the recent-call section.
8531
8535
 
8532
8536
  Examples:
8533
8537
  deepline billing usage
8534
- deepline billing usage --limit 50 --offset 50 --json
8538
+ deepline billing usage --limit 50 --cursor <next_cursor> --json
8535
8539
  deepline billing usage --run-id play/example/run/20260630t120000-000-abcdef --json
8536
8540
  `
8537
- ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8541
+ ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option(
8542
+ "--cursor <cursor>",
8543
+ "Recent-call cursor from the previous response"
8544
+ ).option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8538
8545
  billing.command("limit").description("Show configured monthly limit state.").addHelpText(
8539
8546
  "after",
8540
8547
  `
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
1030
1030
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1031
1031
  // exposed storage-dependent synchronous access. This deliberate minor
1032
1032
  // release keeps lazy paging semantics independent of row residency.
1033
- version: "0.2.14",
1033
+ version: "0.2.16",
1034
1034
  contracts: {
1035
1035
  api: {
1036
1036
  name: "sdk-http-api",
@@ -7785,6 +7785,7 @@ async function handleUsage(options) {
7785
7785
  const params = new URLSearchParams();
7786
7786
  if (options.limit) params.set("recent_limit", options.limit);
7787
7787
  if (options.offset) params.set("recent_offset", options.offset);
7788
+ if (options.cursor) params.set("recent_cursor", options.cursor);
7788
7789
  if (options.runId) params.set("run_id", options.runId);
7789
7790
  const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
7790
7791
  const payload = await http.get(
@@ -7802,7 +7803,10 @@ async function handleUsage(options) {
7802
7803
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
7803
7804
  ...recentUsageLines(
7804
7805
  Array.isArray(recent.entries) ? recent.entries : []
7805
- )
7806
+ ),
7807
+ ...typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? [
7808
+ `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}`
7809
+ ] : []
7806
7810
  ];
7807
7811
  printCommandEnvelope(
7808
7812
  {
@@ -8525,14 +8529,17 @@ Examples:
8525
8529
  `
8526
8530
  Notes:
8527
8531
  Read-only. Shows last-30-day Deepline credit usage plus a bounded recent-call
8528
- page. Use --limit/--offset to paginate the recent-call section.
8532
+ page. Use --limit/--cursor to paginate the recent-call section.
8529
8533
 
8530
8534
  Examples:
8531
8535
  deepline billing usage
8532
- deepline billing usage --limit 50 --offset 50 --json
8536
+ deepline billing usage --limit 50 --cursor <next_cursor> --json
8533
8537
  deepline billing usage --run-id play/example/run/20260630t120000-000-abcdef --json
8534
8538
  `
8535
- ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8539
+ ).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option(
8540
+ "--cursor <cursor>",
8541
+ "Recent-call cursor from the previous response"
8542
+ ).option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
8536
8543
  billing.command("limit").description("Show configured monthly limit state.").addHelpText(
8537
8544
  "after",
8538
8545
  `
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.14",
766
+ version: "0.2.16",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.14",
692
+ version: "0.2.16",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {