deepline 0.3.289 → 0.3.291

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 (64) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +8 -6
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/runs/overview.ts +16 -6
  4. package/dist/bundling-sources/sdk/src/types.ts +21 -2
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +41 -11
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +317 -63
  7. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -2
  8. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +3 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/log-context.ts +36 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +19 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +6 -5
  14. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +12 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/run-event-catalog.ts +2 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +74 -33
  18. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +73 -3
  19. package/dist/bundling-sources/shared_libs/play-runtime/run-log-buffer.ts +39 -2
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +72 -9
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +2 -3
  22. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +77 -10
  23. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +1 -1
  24. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +2 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool-options.ts +145 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +17 -9
  27. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +8 -139
  28. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +19 -5
  29. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +176 -18
  30. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +7 -5
  31. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1404 -478
  32. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +55 -25
  33. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +97 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +34 -15
  35. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +558 -57
  36. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +10 -1
  37. package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +6 -1
  38. package/dist/bundling-sources/shared_libs/play-runtime/test-admission-batching.ts +103 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +22 -5
  40. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +35 -0
  41. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +68 -8
  42. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +2 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +75 -28
  44. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +2 -0
  45. package/dist/cli/index.js +195 -582
  46. package/dist/cli/index.mjs +195 -582
  47. package/dist/{client-FR_u0dxT.d.ts → client-Ct4jmvAg.d.ts} +29 -8
  48. package/dist/{client-phK1Ixcl.d.mts → client-Ct9GKrwu.d.mts} +29 -8
  49. package/dist/{compiler-manifest-9SQtUuKb.d.mts → compiler-manifest-qtTNYvBl.d.mts} +2 -0
  50. package/dist/{compiler-manifest-9SQtUuKb.d.ts → compiler-manifest-qtTNYvBl.d.ts} +2 -0
  51. package/dist/index.d.mts +4 -4
  52. package/dist/index.d.ts +4 -4
  53. package/dist/index.js +14 -5
  54. package/dist/index.mjs +14 -5
  55. package/dist/install-integrity.json +7 -4
  56. package/dist/plays/bundle-play-file.d.mts +2 -2
  57. package/dist/plays/bundle-play-file.d.ts +2 -2
  58. package/dist/plays/run-request.d.mts +2 -2
  59. package/dist/plays/run-request.d.ts +2 -2
  60. package/dist/release.d.mts +1 -1
  61. package/dist/release.d.ts +1 -1
  62. package/dist/release.js +1 -1
  63. package/dist/release.mjs +1 -1
  64. package/package.json +1 -1
@@ -879,7 +879,7 @@ export type RunsEventSearchOptions = {
879
879
  playName?: string;
880
880
  /** Exact dotted event kind, such as `step.failed`. The catalog is discoverable with `runs logs --help`; future stored kinds are accepted too. */
881
881
  kind?: string;
882
- /** JSONPath equality joined with `&&`, at most eight predicates and 512 bytes. See `runs logs --help` for fields and examples. Missing fields do not match; status is not inferred from kind. HTTP `jsonpath`, CLI `--where`. */
882
+ /** JSONPath equality joined with `&&`, at most eight predicates and 512 bytes. `eventId` selects an exact returned event; add `payloads` to retrieve its saved details. See `runs logs --help` for fields and examples. Missing fields do not match; status is not inferred from kind. HTTP `jsonpath`, CLI `--where`. */
883
883
  jsonpath?: string;
884
884
  /** Include available `eventPayload` details and receipt `payload` results; maximum ten events and 16 MiB. HTTP `payloads=true`, CLI `--payloads`. */
885
885
  includePayloads?: boolean;
@@ -905,7 +905,7 @@ export type RunsEventSearchEntry = {
905
905
  playName: string;
906
906
  /** Exact dotted event kind, such as `step.failed`. */
907
907
  kind: string;
908
- /** Recorded log severity, or null; not a JSONPath filter field. */
908
+ /** Recorded log severity, or null on older events. Filter with `$.level == "error"`. */
909
909
  level: string | null;
910
910
  /** Log message preview of at most 2,048 characters, or null. Use text logs/export for the full retained line. */
911
911
  message: string | null;
@@ -933,7 +933,7 @@ export type RunsEventSearchResult = {
933
933
  export type RunsEventPayload = {
934
934
  /** Recorded terminal work outcome. */
935
935
  status: 'completed' | 'failed' | 'skipped';
936
- /** Stored result data, or null when no output was retained. */
936
+ /** Saved result, including available sanitized call input/output details; failed-call records use kind: tool_call_evidence. Null when no output was retained. */
937
937
  output: unknown | null;
938
938
  /** Stored failure message, or null when absent. */
939
939
  error: string | null;
@@ -3320,8 +3320,10 @@ export class DeeplineClient {
3320
3320
  /**
3321
3321
  * Execute a tool and return the standard execution envelope.
3322
3322
  *
3323
- * The `toolResponse.rawV2` field contains the complete parsed and scrubbed tool response.
3324
- * `toolResponse.meta` contains tool/provider metadata.
3323
+ * The `toolResponse.rawV2` field contains the complete tool response,
3324
+ * preserving its original nesting. Inspect `getTool().examples` for a full
3325
+ * Deepline response example. Optional `toolResponse.responseMeta` contains
3326
+ * response metadata.
3325
3327
  * Top-level fields such as `status`, `job_id`, and `billing` describe the
3326
3328
  * Deepline execution envelope.
3327
3329
  */
@@ -4346,7 +4348,7 @@ export class DeeplineClient {
4346
4348
  });
4347
4349
  } catch (error) {
4348
4350
  failedLogsLoaded = false;
4349
- const retryCommand = `deepline runs get ${runId} --log-failed --json`;
4351
+ const retryCommand = `deepline runs logs ${runId} --failed --json`;
4350
4352
  const reason =
4351
4353
  error instanceof Error && error.message.trim()
4352
4354
  ? ` (${error.message.trim().slice(0, 500)})`
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.289',
203
+ version: '0.3.291',
204
204
  updateSummary:
205
205
  'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
206
206
  packageCapabilities: {
@@ -35,7 +35,7 @@ function lifecycleActions(status: PlayStatus, id: string, state?: string) {
35
35
  : {}),
36
36
  ...(state === 'failed'
37
37
  ? {
38
- getFailedLogsCmd: `deepline runs get ${id} --log-failed --json`,
38
+ getFailedLogsCmd: `deepline runs logs ${id} --failed --json`,
39
39
  ...(status.rerunCommand ? { rerunCmd: status.rerunCommand } : {}),
40
40
  }
41
41
  : {}),
@@ -149,7 +149,10 @@ function datasetSummary(value: unknown, conflictingPopulation: boolean) {
149
149
  }
150
150
 
151
151
  /** Action descriptions are affordances, never evidence that an action ran. */
152
- function actions(value: unknown, names: Record<string, string>) {
152
+ function actions<const Names extends Record<string, string>>(
153
+ value: unknown,
154
+ names: Names,
155
+ ): Partial<Record<Names[keyof Names], string>> {
153
156
  return Object.fromEntries(
154
157
  Object.entries(record(value) ?? {}).flatMap(([name, value]) => {
155
158
  const action = record(value);
@@ -167,7 +170,7 @@ function actions(value: unknown, names: Record<string, string>) {
167
170
  ],
168
171
  ];
169
172
  }),
170
- );
173
+ ) as Partial<Record<Names[keyof Names], string>>;
171
174
  }
172
175
 
173
176
  /**
@@ -175,7 +178,10 @@ function actions(value: unknown, names: Record<string, string>) {
175
178
  * from a server that predates it, the same derivation over the step's
176
179
  * reported status and map progress.
177
180
  */
178
- function stepExecution(step: RecordValue, runStatus: string): NodeExecutionState {
181
+ function stepExecution(
182
+ step: RecordValue,
183
+ runStatus: string,
184
+ ): NodeExecutionState {
179
185
  const decoded = decodeNodeExecutionState(step.execution);
180
186
  if (decoded) return decoded;
181
187
  const progress = record(step.progress);
@@ -323,7 +329,11 @@ export function buildRunOverview(status: PlayStatus, fullStatus?: PlayStatus) {
323
329
  );
324
330
  return {
325
331
  datasetId: dataset.datasetId,
326
- name: dataset.tableNamespace,
332
+ name:
333
+ dataset.tableNamespace ??
334
+ (typeof stepOutput?.tableNamespace === 'string'
335
+ ? stepOutput.tableNamespace
336
+ : dataset.path),
327
337
  stepId: step?.id ?? named[0]?.[1].stepId,
328
338
  rowCount: dataset.rowCount ?? null,
329
339
  ...(dataset.lifecycle ? { lifecycle: dataset.lifecycle } : {}),
@@ -456,7 +466,7 @@ export function buildRunOverview(status: PlayStatus, fullStatus?: PlayStatus) {
456
466
  function receiptAction(id: string) {
457
467
  const quotedId = `'${id.replace(/'/g, "'\\''")}'`;
458
468
  return {
459
- getReceiptCmd: `deepline runs receipt ${quotedId} --key '<receipt-key>' --json`,
469
+ getReceiptCmd: `deepline runs logs ${quotedId} --kind receipt.completed --payloads --json`,
460
470
  };
461
471
  }
462
472
 
@@ -226,6 +226,24 @@ export interface ToolDefinition extends ToolExecutionMetadataFields {
226
226
  inputSchema?: Record<string, unknown>;
227
227
  /** JSON Schema describing the tool's output shape. */
228
228
  outputSchema?: Record<string, unknown>;
229
+ /** JSON Schema for the Deepline API execution response, including toolResponse.rawV2. */
230
+ responseSchema?: Record<string, unknown>;
231
+ /** Illustrative input and full API response examples, separate from schemas. */
232
+ examples?: Array<{
233
+ input: Record<string, unknown>;
234
+ inputSource: 'sample' | 'schema';
235
+ responseSource: 'sample' | 'schema' | 'no_result';
236
+ description: string;
237
+ response: {
238
+ job_id: string;
239
+ status: string;
240
+ toolResponse: {
241
+ rawV2: unknown;
242
+ view: 'data' | 'rawV2';
243
+ responseMeta?: Record<string, unknown>;
244
+ };
245
+ };
246
+ }>;
229
247
  /** User-facing pricing summary. Internal provider/settlement costs are intentionally omitted. */
230
248
  pricing?: ToolPricingSummary | null;
231
249
  /** How to use the tool well: the provider's summary and the tool's own notes. */
@@ -600,7 +618,8 @@ export interface ToolSearchResult {
600
618
  * const meta = await client.getTool('dropleads_search_people');
601
619
  * console.log(meta.displayName); // "DropLeads People Search"
602
620
  * console.log(meta.estimatedCreditsRange); // "1-5"
603
- * console.log(meta.samples); // { input: {...}, output: {...} }
621
+ * console.log(meta.examples?.[0].input); // example input payload
622
+ * console.log(meta.examples?.[0].response); // full Deepline execution response
604
623
  * ```
605
624
  */
606
625
  export interface ToolMetadata extends ToolDefinition {
@@ -632,7 +651,7 @@ export interface ToolMetadata extends ToolDefinition {
632
651
  estimateBasedOnTools?: string[];
633
652
  /** Individual step cost contributions (for composite tools). */
634
653
  stepContributions?: unknown[];
635
- /** Example input/output pairs for documentation and testing. */
654
+ /** Tool body samples. Full execution response examples are available in examples. */
636
655
  samples?: Record<string, unknown>;
637
656
  }
638
657
 
@@ -13,7 +13,10 @@ import type { AsyncPlayRunRef } from '../plays/authoring-contract';
13
13
  import type { PlayRowUpdate } from './/ctx-types';
14
14
  import type { PlayRunTimelineEntry } from './/live-events';
15
15
  import type { PlayDatasetBornFrom } from './/cell-provenance';
16
- import type { PlayLogContext } from './/log-context';
16
+ import type {
17
+ PlayLogContext,
18
+ PlayLogMetadata,
19
+ } from './/log-context';
17
20
  import {
18
21
  routePlayActivityObservation,
19
22
  type PlayActivityObservation,
@@ -111,12 +114,17 @@ export type RuntimeStatusUpdate = {
111
114
  liveLogs?: string[];
112
115
  /** Search-only context aligned to `liveLogs`; stripped before Convex. */
113
116
  liveLogContexts?: Array<PlayLogContext | null>;
117
+ liveLogMetadata?: Array<PlayLogMetadata | null>;
118
+ liveLogIds?: Array<string | null>;
114
119
  /**
115
120
  * Monotonic count of log lines the producer ever emitted on this run's
116
121
  * channel. `liveLogs` is a rotating tail of those lines; the total lets the
117
122
  * positional cursor stay correct once the buffer has rotated.
118
123
  */
119
124
  liveLogTotalCount?: number;
125
+ /** Absolute start of a stateless gateway batch. Its durable positions must
126
+ * reach ingestion even if another request already forwarded a newer batch. */
127
+ liveLogBatchOffset?: number;
120
128
  /**
121
129
  * Monotonic scheduler attempt that owns the positional log channel. A new
122
130
  * attempt starts at offset zero without colliding with earlier attempts.
@@ -156,6 +164,8 @@ export type RuntimeStatusUpdate = {
156
164
  terminalLogReplay?: {
157
165
  lines: string[];
158
166
  lineContexts?: Array<PlayLogContext | null>;
167
+ lineMetadata?: Array<PlayLogMetadata | null>;
168
+ lineIds?: Array<string | null>;
159
169
  totalCount?: number;
160
170
  dedupeMode?: 'semantic' | 'exact';
161
171
  producerAttempt?: number;
@@ -355,6 +365,8 @@ type RuntimeApiRequest =
355
365
  export type WorkerRuntimeApiContext = {
356
366
  baseUrl: string;
357
367
  executorToken: string;
368
+ /** Exact ingress-prefix verifier advertised by the immutable launch receiver. */
369
+ runLedgerIngressPrefixBatching?: true;
358
370
  boundary?: 'app_runtime' | 'receipt_gateway';
359
371
  integrationMode?: 'live' | 'eval_stub' | 'fixture' | null;
360
372
  vercelProtectionBypassToken?: string | null;
@@ -2197,18 +2209,23 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2197
2209
  runId: update.playId,
2198
2210
  status: 'queued',
2199
2211
  });
2200
- // Positional cursor over this producer's log buffer. Running updates forward
2201
- // only the unsent suffix; terminal updates resend the retained buffer so the
2202
- // durable stream can recover any progress flush that was lost in transit.
2203
- const sentCount = isTerminalRuntimeStatus(update.status)
2204
- ? 0
2205
- : (runLogChannelSentCounts.get(
2206
- runLogChannelKey(update.playId, update.liveLogProducerAttempt),
2207
- ) ?? 0);
2212
+ // Stateful producers forward their unsent suffix. A stateless gateway batch
2213
+ // owns an absolute start: a newer request's process-local cursor is no proof
2214
+ // that this batch reached ingestion. Durable positional identities reconcile
2215
+ // overlap and terminal recovery.
2216
+ const sentCount =
2217
+ update.liveLogBatchOffset ??
2218
+ (isTerminalRuntimeStatus(update.status)
2219
+ ? 0
2220
+ : (runLogChannelSentCounts.get(
2221
+ runLogChannelKey(update.playId, update.liveLogProducerAttempt),
2222
+ ) ?? 0));
2208
2223
  const logSlice = Array.isArray(update.liveLogs)
2209
2224
  ? slicePositionalLogLines({
2210
2225
  bufferLines: update.liveLogs,
2211
2226
  bufferContexts: update.liveLogContexts,
2227
+ bufferMetadata: update.liveLogMetadata,
2228
+ bufferIds: update.liveLogIds,
2212
2229
  bufferTotalCount: update.liveLogTotalCount ?? update.liveLogs.length,
2213
2230
  sentCount,
2214
2231
  })
@@ -2220,6 +2237,8 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2220
2237
  ? {
2221
2238
  lines: update.liveLogs,
2222
2239
  lineContexts: update.liveLogContexts,
2240
+ lineMetadata: update.liveLogMetadata,
2241
+ lineIds: update.liveLogIds,
2223
2242
  totalCount: update.liveLogTotalCount,
2224
2243
  producerAttempt: update.liveLogProducerAttempt,
2225
2244
  }
@@ -2239,7 +2258,14 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2239
2258
  0,
2240
2259
  Math.max(0, replayOffset - logSlice.channelOffset),
2241
2260
  );
2242
- if (prefix.length) statusPatchLogSlice = { ...logSlice, lines: prefix };
2261
+ if (prefix.length)
2262
+ statusPatchLogSlice = {
2263
+ ...logSlice,
2264
+ lines: prefix,
2265
+ lineContexts: logSlice.lineContexts?.slice(0, prefix.length),
2266
+ lineMetadata: logSlice.lineMetadata?.slice(0, prefix.length),
2267
+ lineIds: logSlice.lineIds?.slice(0, prefix.length),
2268
+ };
2243
2269
  }
2244
2270
  const events = buildPlayRunLedgerEventsFromStatusPatch({
2245
2271
  patch: {
@@ -2250,6 +2276,8 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2250
2276
  lastCheckpointAt: update.lastCheckpointAt ?? null,
2251
2277
  liveLogs: statusPatchLogSlice?.lines ?? null,
2252
2278
  liveLogContexts: statusPatchLogSlice?.lineContexts ?? null,
2279
+ liveLogMetadata: statusPatchLogSlice?.lineMetadata ?? null,
2280
+ liveLogIds: statusPatchLogSlice?.lineIds ?? null,
2253
2281
  liveLogsChannelOffset: statusPatchLogSlice?.channelOffset ?? null,
2254
2282
  liveLogsProducerAttempt: update.liveLogProducerAttempt ?? null,
2255
2283
  liveNodeProgress: update.liveNodeProgress ?? null,
@@ -2335,6 +2363,8 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2335
2363
  occurredAt: update.lastCheckpointAt ?? Date.now(),
2336
2364
  lines: terminalLogReplay.lines,
2337
2365
  lineContexts: terminalLogReplay.lineContexts,
2366
+ lineMetadata: terminalLogReplay.lineMetadata,
2367
+ lineIds: terminalLogReplay.lineIds,
2338
2368
  liveLogTotalCount: terminalLogReplay.totalCount,
2339
2369
  dedupeMode: terminalLogReplay.dedupeMode,
2340
2370
  producerAttempt: terminalLogReplay.producerAttempt,
@@ -2364,7 +2394,7 @@ async function updateRunStatusViaAppRuntimeUnlocked(
2364
2394
  events: terminalLogEvents,
2365
2395
  });
2366
2396
  }
2367
- if (statusPatchLogSlice) {
2397
+ if (statusPatchLogSlice && update.liveLogBatchOffset === undefined) {
2368
2398
  runLogChannelSentCounts.set(
2369
2399
  runLogChannelKey(update.playId, update.liveLogProducerAttempt),
2370
2400
  statusPatchLogSlice.channelOffset + statusPatchLogSlice.lines.length,