deepline 0.3.272 → 0.3.273

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.
package/README.md CHANGED
@@ -38,6 +38,15 @@ with project-local skills automatically.
38
38
 
39
39
  ## Use it with an agent
40
40
 
41
+ For an existing run, start with `deepline runs logs --help`. It includes every
42
+ known event kind, what records it, available fields, filters, payload reads,
43
+ pagination and retention. `runs logs` reads text or structured events;
44
+ `runs get`, `runs watch`, `runs export` and `runs receipt` cover status, live
45
+ observation, dataset rows and retained tool results. These inspection commands
46
+ read existing evidence without starting provider work. TypeScript callers use
47
+ `client.runs.logs`, `client.runs.searchEvents` and `client.runs.getReceipts`;
48
+ their source JSDoc and the generated SDK/API references describe the same reads.
49
+
41
50
  Paste this into Claude Code, Codex, or another coding agent:
42
51
 
43
52
  ```text
@@ -740,25 +740,33 @@ export type RunsWatchOptions = {
740
740
  /** @deprecated Use `RunsWatchOptions`. */
741
741
  export type RunsTailOptions = RunsWatchOptions;
742
742
 
743
- /** Log fetch options for `client.runs.logs(...)`. */
743
+ /** Read retained text with `client.runs.logs(...)`; use `runs.searchEvents` for structured filters and payloads. */
744
744
  export type RunsLogsOptions = {
745
- /** Return the LAST `limit` stored log lines (default 200). */
745
+ /** Return the last `limit` retained lines in sequence order; default 200. Ignored when `all` is true. */
746
746
  limit?: number;
747
- /** Fetch every stored log line, paginating to the full totalCount. */
747
+ /** Page through every retained line. Cannot combine with `failed`; sampling or retention loss cannot be recovered. */
748
748
  all?: boolean;
749
- /** Select the bounded failure view; truncated runs degrade explicitly. */
749
+ /** Read a terminal-failed run's last 20 retained lines, or fewer with `limit`. Retention loss returns an explicit association and warning. */
750
750
  failed?: boolean;
751
751
  };
752
752
 
753
- /** Persisted log response for one play run. */
753
+ /** Retained text for one run. Counts and retention flags describe the stored stream, not every original console call. */
754
754
  export type RunsLogsResult = {
755
+ /** Public run identity. */
755
756
  runId: string;
757
+ /** Count tracked by the log stream; may exceed available bodies after retention truncation. */
756
758
  totalCount: number;
759
+ /** Number of line bodies returned in `entries`. */
757
760
  returnedCount: number;
761
+ /** First returned stored sequence, or null for an empty view. */
758
762
  firstSequence: number | null;
763
+ /** Last returned stored sequence, or null for an empty view. */
759
764
  lastSequence: number | null;
765
+ /** Tail/all: returned count is below total count. Failed: the stream lost bodies to retention. Check `logsTruncated` to distinguish retention loss from a selected tail. */
760
766
  truncated: boolean;
767
+ /** More retained lines exist after `lastSequence`; always false for the designed failure window. */
761
768
  hasMore: boolean;
769
+ /** Formatted text lines in stored sequence order; structured context is available through event search. */
762
770
  entries: string[];
763
771
  /** Selected public log view. */
764
772
  view?: 'tail' | 'failed' | 'all';
@@ -775,53 +783,77 @@ export type RunsLogsResult = {
775
783
  logsTruncated?: boolean;
776
784
  };
777
785
 
778
- /** Bounded org-scoped search over durable Play runtime observations. */
786
+ /** Read existing events in the authenticated organization/runtime scope, newest first by occurrence time and event ID. See the complete catalog and field contract in `deepline runs logs --help`. */
779
787
  export type RunsEventSearchOptions = {
780
788
  /** Inclusive UTC timestamp; defaults to one hour before the request. */
781
789
  since?: string;
782
- /** Exclusive UTC timestamp; defaults to the request time. */
790
+ /** Exclusive UTC timestamp; defaults to the request time. A window spans at most seven days; event retention is seven days. */
783
791
  until?: string;
784
792
  /** Optional run filter. Omit to search across the active organization. */
785
793
  runId?: string;
794
+ /** Exact Play name; HTTP query parameter `playName`, CLI `--play`. */
786
795
  playName?: string;
796
+ /** Exact dotted event kind, such as `step.failed`. The catalog is discoverable with `runs logs --help`; future stored kinds are accepted too. */
787
797
  kind?: string;
788
- /** Flat equality predicate in the supported PostgreSQL JSONPath subset. */
798
+ /** Equality joined with `&&`, at most eight predicates and 512 bytes. Fields: orgId, runId, playName, runtimeScope, producerAttempt, kind, status, source, stepId, stepKind, datasetId, phase, provider, operation and scalar `context.<key>`. Missing fields do not match; status is not inferred from kind. No body, message, level, nested payload, range or OR search. HTTP `jsonpath`, CLI `--where`. */
789
799
  jsonpath?: string;
790
- /** Include canonical event details and receipt-backed outputs, capped to ten events and 16 MiB total. */
800
+ /** Add stored canonical `eventPayload` and, for receipt matches, retained `payload`. At most ten events and 16 MiB; unavailable receipts return null. HTTP `payloads=true`, CLI `--payloads`. Does not execute tools. */
791
801
  includePayloads?: boolean;
802
+ /** Page size: default 100, maximum 200; with payloads, default and maximum ten. */
792
803
  limit?: number;
804
+ /** Opaque `nextCursor` from the preceding page. Reuse that page's returned since/until and the same filters and runtime scope. */
793
805
  cursor?: string;
794
806
  /** Explicit Preview selection requires the existing runtime credential. */
795
807
  runtime?: PlayRuntimeSelection;
796
808
  };
797
809
 
810
+ /** One indexed observation; optional indexed fields and payloads depend on what its producer recorded. */
798
811
  export type RunsEventSearchEntry = {
812
+ /** Stable event identity; also breaks ties in newest-first pagination. */
799
813
  eventId: string;
814
+ /** Producer occurrence time as a UTC timestamp string. */
800
815
  occurredAt: string;
816
+ /** Index ingestion time as a UTC timestamp string; may be later than occurrence. */
801
817
  ingestedAt: string;
818
+ /** Public run identity associated with this observation. */
802
819
  runId: string;
820
+ /** Recorded Play name. */
803
821
  playName: string;
822
+ /** Exact indexed kind; canonical payloads use `type` for this dotted name. */
804
823
  kind: string;
824
+ /** Recorded log severity, or null; not a JSONPath filter field. */
805
825
  level: string | null;
826
+ /** Log message preview of at most 2,048 characters, or null. Use text logs/export for the full retained line. */
806
827
  message: string | null;
828
+ /** Indexed identity and recorded scalar fields. SDK/API keep this nested; CLI search flattens it onto each event. Provider/operation describe typed activity observations, not every provider call. */
807
829
  searchDoc: Record<string, unknown>;
808
- /** Accepted Play event from PScale when this run uses the unified journal. */
830
+ /** Stored canonical event details, only when payloads are requested and available. Lifecycle/activity/dataset payloads are observations, not complete tool responses or dataset rows. */
809
831
  eventPayload?: Record<string, unknown>;
810
- /** Optional full result, included only when explicitly requested. */
832
+ /** Retained work result for a receipt match when payloads are requested; null if unavailable. Other events need not carry this field. */
811
833
  payload?: RunsEventPayload | null;
812
834
  };
813
835
 
836
+ /** One bounded search page. Continue using `nextCursor` and these exact time bounds; CLI-only counts and follow-up commands are not SDK/API fields. */
814
837
  export type RunsEventSearchResult = {
838
+ /** Matching observations in descending occurredAt/eventId order. */
815
839
  events: RunsEventSearchEntry[];
840
+ /** Opaque continuation token, or null when no further page exists. */
816
841
  nextCursor: string | null;
842
+ /** Resolved inclusive UTC bound, including a defaulted bound. */
817
843
  since: string;
844
+ /** Resolved exclusive UTC bound, including a defaulted bound. */
818
845
  until: string;
819
846
  };
820
847
 
848
+ /** Retained work outcome hydrated for a receipt event; not a new execution, billing receipt or guarantee of a raw HTTP response. */
821
849
  export type RunsEventPayload = {
850
+ /** Recorded terminal work outcome. */
822
851
  status: 'completed' | 'failed' | 'skipped';
852
+ /** Stored result data, or null when no output was retained. */
823
853
  output: unknown | null;
854
+ /** Stored failure message, or null when absent. */
824
855
  error: string | null;
856
+ /** Stored structured failure details, or null when absent. */
825
857
  errorPayload: unknown | null;
826
858
  };
827
859
 
@@ -902,7 +934,7 @@ export type PlaySecretCheck = {
902
934
  * @sdkReference client 020 client.runs
903
935
  */
904
936
  export type RunsNamespace = {
905
- /** Read retained tool results associated with a run, in supplied key order. Never executes tools. */
937
+ /** Read retained tool results in supplied key order. Use keys returned in exported evidence or execution metadata; search does not expose receipt keys. Never executes tools. */
906
938
  getReceipts: (
907
939
  runId: string,
908
940
  options: { keys: string[] },
@@ -937,9 +969,9 @@ export type RunsNamespace = {
937
969
  watch: (runId: string, options?: RunsWatchOptions) => Promise<PlayStatus>;
938
970
  /** @deprecated Use `watch`; retained as a source-compatible alias. */
939
971
  tail: (runId: string, options?: RunsTailOptions) => Promise<PlayStatus>;
940
- /** Fetch persisted log lines for a run. */
972
+ /** Read a run's retained text tail, full stream (`all`) or terminal failure window (`failed`). For structured filters and payloads, see [run logs and events](run-events.md). */
941
973
  logs: (runId: string, options?: RunsLogsOptions) => Promise<RunsLogsResult>;
942
- /** Search recent durable runtime events across runs in the active organization. */
974
+ /** Search existing events across the active organization; default last hour, up to 200 events per page (ten with payloads). See [run logs and events](run-events.md) for the catalog, query fields and response types. */
943
975
  searchEvents: (
944
976
  options?: RunsEventSearchOptions,
945
977
  ) => Promise<RunsEventSearchResult>;
@@ -4342,7 +4374,7 @@ export class DeeplineClient {
4342
4374
  return { ...response, runs: response.runs ?? [] };
4343
4375
  }
4344
4376
 
4345
- /** Read batches rather than silently truncating a long key list. */
4377
+ /** Read retained tool results without executing tools, preserving supplied key order and batching 100 keys per request. Obtain keys from exported evidence or execution metadata; each key must be nonempty, at most 2,048 characters and contain no CR, LF or NUL. Missing/expired results have an explicit per-key error. */
4346
4378
  async getRunReceipts(
4347
4379
  runId: string,
4348
4380
  options: { keys: string[] },
@@ -4426,7 +4458,7 @@ export class DeeplineClient {
4426
4458
  }
4427
4459
 
4428
4460
  /**
4429
- * Fetch persisted logs for a run using the public runs resource model.
4461
+ * Read a run's retained text tail (default 200), full retained stream (`all`), or terminal failure window (`failed`, at most 20). These are existing reads; sampling and retention loss cannot be recovered. See [run logs and events](run-events.md) for structured search and payload retrieval.
4430
4462
  *
4431
4463
  * This is the SDK equivalent of:
4432
4464
  *
@@ -4525,7 +4557,7 @@ export class DeeplineClient {
4525
4557
  };
4526
4558
  }
4527
4559
 
4528
- /** Search bounded, structured runtime history without requiring a run id. */
4560
+ /** Read structured history across the active organization without requiring a run ID. Defaults to the last hour, newest first; use the returned cursor and exact time bounds to continue. See [run logs and events](run-events.md) for all kinds, indexed fields, payloads and SDK/API response types. */
4529
4561
  async searchRunEvents(
4530
4562
  options: RunsEventSearchOptions = {},
4531
4563
  ): Promise<RunsEventSearchResult> {
@@ -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.272',
203
+ version: '0.3.273',
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: {
@@ -1,23 +1,39 @@
1
- /** A retained result, not a new tool execution or a billing receipt. */
1
+ /** Read-only retained tool evidence associated with a run. Each requested key returns either its stored result or an explicit error; this never executes tools or returns a billing receipt. */
2
2
  export type RunToolReceiptResult = {
3
+ /** Exact key supplied to the read, obtained from exported evidence or execution metadata. */
3
4
  receiptKey: string;
5
+ /** Recorded work status when available; an error does not imply a fresh provider failure. */
4
6
  status?: string;
5
7
  } & (
6
8
  | {
9
+ /** Retained result envelope; provider fields reflect stored evidence, not a guaranteed raw HTTP response. */
7
10
  result: {
11
+ /** Status recorded in the tool result. */
8
12
  status: string;
13
+ /** Provider job identity when recorded. */
9
14
  job_id?: string;
15
+ /** Stored tool response. */
10
16
  toolResponse: Record<string, unknown>;
17
+ /** Stored target values when the tool supplied them. */
11
18
  targetValues?: Record<string, unknown>;
19
+ /** Stored list dataset metadata when supplied. */
12
20
  listDatasets?: Record<string, unknown>;
21
+ /** Stored list row evidence when supplied. */
13
22
  listRows?: Record<string, unknown>;
14
23
  };
15
24
  error?: never;
16
25
  }
17
- | { result?: never; error: { code: string; message: string } }
26
+ | {
27
+ result?: never;
28
+ /** Explicit lookup/access/retention failure for this key. */
29
+ error: { code: string; message: string };
30
+ }
18
31
  );
19
32
 
33
+ /** Results in the exact requested key order, including errors for unavailable keys. */
20
34
  export type RunToolReceiptsResponse = {
35
+ /** Public run identity used to scope the read. */
21
36
  runId: string;
37
+ /** One result or error per requested key. */
22
38
  receipts: RunToolReceiptResult[];
23
39
  };
@@ -1607,13 +1607,14 @@ export interface PlayAuthoringRuntimeContext {
1607
1607
  ): Promise<AsyncPlayRunRef>;
1608
1608
 
1609
1609
  /**
1610
- * Write a customer-safe line to the durable Run Log Stream. Omitting level
1611
- * preserves the historical info-level behavior.
1610
+ * Write a customer-safe retained log line, searchable as `log.appended` in the unified event journal. Default severity is info; runtime sampling and retention limits apply. Use `runs.logs` for retained text and `runs.searchEvents` for indexed context; see `deepline runs logs --help` for the complete read contract.
1612
1611
  */
1613
1612
  log(
1614
1613
  message: string,
1615
1614
  options?: {
1615
+ /** Defaults to info. Warn/error lines are not subject to info/debug sampling. */
1616
1616
  level?: 'debug' | 'info' | 'warn' | 'error';
1617
+ /** At most eight flat scalar fields and 2,048 UTF-8 bytes total. Keys match [A-Za-z_][A-Za-z0-9_]{0,63}; __proto__, constructor and prototype are forbidden. String values are at most 256 UTF-8 bytes. Search with `$.context.<key> == literal`; context cannot override run/event identity. */
1617
1618
  context?: Readonly<Record<string, string | number | boolean>>;
1618
1619
  },
1619
1620
  ): void;
package/dist/cli/index.js CHANGED
@@ -3512,7 +3512,7 @@ var SDK_RELEASE = {
3512
3512
  // getters keep their established compatibility behavior.
3513
3513
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3514
3514
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3515
- version: "0.3.272",
3515
+ version: "0.3.273",
3516
3516
  updateSummary: "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.",
3517
3517
  packageCapabilities: {
3518
3518
  updatePreferences: 1
@@ -8368,7 +8368,7 @@ var DeeplineClient = class _DeeplineClient {
8368
8368
  );
8369
8369
  return { ...response, runs: response.runs ?? [] };
8370
8370
  }
8371
- /** Read batches rather than silently truncating a long key list. */
8371
+ /** Read retained tool results without executing tools, preserving supplied key order and batching 100 keys per request. Obtain keys from exported evidence or execution metadata; each key must be nonempty, at most 2,048 characters and contain no CR, LF or NUL. Missing/expired results have an explicit per-key error. */
8372
8372
  async getRunReceipts(runId, options) {
8373
8373
  if (!options.keys.length || options.keys.some(
8374
8374
  (key) => typeof key !== "string" || !key.trim() || key.length > 2048 || /[\r\n\0]/.test(key)
@@ -8424,7 +8424,7 @@ var DeeplineClient = class _DeeplineClient {
8424
8424
  );
8425
8425
  }
8426
8426
  /**
8427
- * Fetch persisted logs for a run using the public runs resource model.
8427
+ * Read a run's retained text tail (default 200), full retained stream (`all`), or terminal failure window (`failed`, at most 20). These are existing reads; sampling and retention loss cannot be recovered. See [run logs and events](run-events.md) for structured search and payload retrieval.
8428
8428
  *
8429
8429
  * This is the SDK equivalent of:
8430
8430
  *
@@ -8503,7 +8503,7 @@ var DeeplineClient = class _DeeplineClient {
8503
8503
  ...probe.logsTruncated ? { logsTruncated: true } : {}
8504
8504
  };
8505
8505
  }
8506
- /** Search bounded, structured runtime history without requiring a run id. */
8506
+ /** Read structured history across the active organization without requiring a run ID. Defaults to the last hour, newest first; use the returned cursor and exact time bounds to continue. See [run logs and events](run-events.md) for all kinds, indexed fields, payloads and SDK/API response types. */
8507
8507
  async searchRunEvents(options = {}) {
8508
8508
  const now = Date.now();
8509
8509
  const params = new URLSearchParams({
@@ -15663,6 +15663,233 @@ function registerPlayTriggerConfigCommands(plays) {
15663
15663
  // src/cli/commands/play.ts
15664
15664
  var import_node_crypto7 = require("crypto");
15665
15665
 
15666
+ // src/cli/run-logs-help.ts
15667
+ var EVENT_DETAILS = {
15668
+ "run.created": {
15669
+ emittedBy: "Run admission",
15670
+ payloadFields: ["status", "playName", "runtimeBackend"]
15671
+ },
15672
+ "run.started": {
15673
+ emittedBy: "Execution coordinator",
15674
+ payloadFields: ["playName", "runtimeBackend"]
15675
+ },
15676
+ "run.waiting": {
15677
+ emittedBy: "Durable wait handling",
15678
+ payloadFields: ["waitKind", "waitUntil"]
15679
+ },
15680
+ "run.resumed": { emittedBy: "Durable wait handling", payloadFields: [] },
15681
+ "run.completed": {
15682
+ emittedBy: "Run finalization",
15683
+ payloadFields: ["result", "resultSummary", "terminalWorkCounterSegment"]
15684
+ },
15685
+ "run.failed": {
15686
+ emittedBy: "Run finalization",
15687
+ payloadFields: [
15688
+ "error",
15689
+ "result",
15690
+ "resultSummary",
15691
+ "terminalWorkCounterSegment"
15692
+ ]
15693
+ },
15694
+ "run.cancelled": {
15695
+ emittedBy: "Run cancellation",
15696
+ payloadFields: ["error", "result"]
15697
+ },
15698
+ "step.started": {
15699
+ emittedBy: "Managed step execution",
15700
+ payloadFields: ["stepId", "label", "kind", "artifactTableNamespace"]
15701
+ },
15702
+ "step.progress": {
15703
+ emittedBy: "Managed step execution",
15704
+ payloadFields: ["stepId", "label", "kind", "status", "progress"]
15705
+ },
15706
+ "step.completed": {
15707
+ emittedBy: "Managed step execution",
15708
+ payloadFields: ["stepId", "label", "kind", "artifactTableNamespace"]
15709
+ },
15710
+ "step.failed": {
15711
+ emittedBy: "Managed step execution",
15712
+ payloadFields: [
15713
+ "stepId",
15714
+ "label",
15715
+ "kind",
15716
+ "error",
15717
+ "artifactTableNamespace"
15718
+ ]
15719
+ },
15720
+ "step.skipped": {
15721
+ emittedBy: "Managed step execution",
15722
+ payloadFields: ["stepId", "label", "kind", "artifactTableNamespace"]
15723
+ },
15724
+ "log.appended": {
15725
+ emittedBy: "ctx.log and runtime/coordinator messages",
15726
+ payloadFields: [
15727
+ "lines",
15728
+ "lineContexts",
15729
+ "producerAttempt",
15730
+ "channelOffset",
15731
+ "logsTruncated"
15732
+ ]
15733
+ },
15734
+ "dataset.lifecycle": {
15735
+ emittedBy: "Managed dataset storage",
15736
+ payloadFields: [
15737
+ "datasetId",
15738
+ "path",
15739
+ "tableNamespace",
15740
+ "phase",
15741
+ "persistedRows",
15742
+ "succeededRows",
15743
+ "failedRows",
15744
+ "complete",
15745
+ "bornFrom"
15746
+ ]
15747
+ },
15748
+ "activity.observed": {
15749
+ emittedBy: "Managed provider/dataset/runner activity",
15750
+ payloadFields: ["observation"]
15751
+ },
15752
+ "work.counters": {
15753
+ emittedBy: "Runtime work accounting",
15754
+ payloadFields: [
15755
+ "attempt",
15756
+ "invocationSeq",
15757
+ "segmentId",
15758
+ "logicalCalls",
15759
+ "providerRequests",
15760
+ "provider429s",
15761
+ "final"
15762
+ ]
15763
+ }
15764
+ };
15765
+ var RUN_LOGS_KIND_HELP = [
15766
+ ...Object.entries(RUN_EVENT_KIND_CATALOG).map(([kind, descriptor]) => ({
15767
+ kind,
15768
+ description: descriptor.description,
15769
+ ...EVENT_DETAILS[kind]
15770
+ })),
15771
+ ...Object.entries(RUN_RECEIPT_SEARCH_KIND_CATALOG).map(
15772
+ ([kind, descriptor]) => ({
15773
+ kind,
15774
+ description: descriptor.description,
15775
+ emittedBy: "Durable work receipt settlement",
15776
+ payloadFields: ["status", "output", "error", "errorPayload"]
15777
+ })
15778
+ ),
15779
+ {
15780
+ kind: RUN_EVENT_SEARCH_FALLBACK_KIND,
15781
+ description: "Fallback for an observation without a recognized event type.",
15782
+ emittedBy: "Event indexing",
15783
+ payloadFields: []
15784
+ }
15785
+ ];
15786
+ var SECTIONS = [
15787
+ {
15788
+ title: "Choose the read",
15789
+ paragraphs: [
15790
+ "These commands read existing evidence; they do not start a run or execute a provider. Replace <run-id>, <play-name> and other angle-bracket values with identifiers returned by the CLI.",
15791
+ "Text logs: runs logs <run-id> returns the last 200 retained lines by default. --out writes the full retained stream to a local file. --log-level filters text severity; debug includes all retained levels. --failed reads only a terminal-failed run\u2019s last 20 retained lines and reports retention limitations.",
15792
+ "Event search: omit the run ID, or add any of --since, --until, --play, --kind, --where, --payloads, --cursor, --runtime-namespace or --runtime-backend. A supplied run ID then narrows the search. --limit and --json alone do not switch a run\u2019s text logs to event search. Text-only flags --out, --failed, --log-level, --logs and --debug cannot be combined with event search.",
15793
+ "Current status and returned output selectors: runs get <run-id> --json. Live observation: runs watch <run-id>. Dataset rows: runs export <run-id> --dataset <returned-selector> --out rows.csv. A referenced tool response: runs receipt <run-id> --key <returned-receipt-key> --json. Read each command\u2019s --help for its options."
15794
+ ],
15795
+ commands: [
15796
+ "deepline runs logs <run-id> --json",
15797
+ "deepline runs logs <run-id> --out run.log --json",
15798
+ "deepline runs logs --kind run.failed --json",
15799
+ "deepline runs logs --kind step.failed --payloads --json",
15800
+ "deepline runs logs --kind receipt.failed --payloads --json"
15801
+ ]
15802
+ },
15803
+ {
15804
+ title: "Search window and pagination",
15805
+ paragraphs: [
15806
+ "Search defaults to the last hour, newest first. Use explicit ISO UTC --since and --until values for reproducible queries; the maximum lookback is seven days. Default page size is 100 events; --limit accepts 1\u2013200. With --payloads, default and maximum are 10 events, with 16 MiB total payload data.",
15807
+ "JSON returns events[], returnedCount, since, until, nextCursor and next.logs. Run the returned next.logs command to continue with the same filters and UTC window; nextCursor is opaque. A bounded page or an empty result does not establish whole-run coverage or application health."
15808
+ ],
15809
+ commands: [
15810
+ "deepline runs logs <run-id> --kind log.appended --json",
15811
+ "deepline runs logs --play <play-name> --since <UTC-start> --until <UTC-end> --json"
15812
+ ]
15813
+ },
15814
+ {
15815
+ title: "Fields you can filter with --where",
15816
+ paragraphs: [
15817
+ "Identity strings: orgId, runId, playName, runtimeScope. These come from authenticated execution state; filters only narrow your authorized organization/runtime. Preview reads require the existing runtime credential and an authorized --runtime-namespace; --runtime-backend selects daytona or modal.",
15818
+ "Event string: kind. Optional strings: source, stepId, stepKind, status, datasetId, phase, provider, operation. Optional positive integer: producerAttempt. These fields exist only when recorded; inspect a returned event before filtering on an optional field.",
15819
+ 'stepId/stepKind describe recorded step work; datasetId/phase describe dataset lifecycle (registered, available, failed). provider/operation appear on typed provider activity.observed events, not every receipt or provider call. status is the recorded status or activity state when present: run.completed and step.completed do not imply status == "completed". Select lifecycle outcomes with --kind.',
15820
+ "context.<key> matches an authored flat scalar log field: string, number or boolean. Context cannot override event identity. Missing fields do not match. --where supports only $.field == literal predicates joined with &&, at most eight predicates and 512 bytes. No OR, ranges, wildcards, nested payload paths or text search. Time uses --since/--until; level and message are not --where fields."
15821
+ ],
15822
+ commands: [
15823
+ `deepline runs logs --kind receipt.failed --where '$.status == "failed"' --payloads --json`,
15824
+ `deepline runs logs <run-id> --where '$.source == "worker" && $.producerAttempt == 1' --json`,
15825
+ `deepline runs logs --kind activity.observed --where '$.provider == "<returned-provider>" && $.operation == "<returned-operation>"' --json`,
15826
+ `deepline runs logs --kind log.appended --where '$.context.<authored-key> == "<recorded-value>"' --json`
15827
+ ]
15828
+ },
15829
+ {
15830
+ title: "What you get back",
15831
+ paragraphs: [
15832
+ "Search events include eventId, occurredAt, ingestedAt, kind, runId, playName, level and message. The CLI puts indexed fields directly on each events[] entry; SDK/API responses keep them under searchDoc. Log search message is a preview (up to 2,048 characters); use text logs or --out for full retained lines.",
15833
+ "--payloads adds eventPayload for stored canonical events: lifecycle, step details/errors, activity observations, dataset transitions and work counters. Receipt matches instead hydrate payload with status, output, error and errorPayload. An event without a receipt does not promise a tool response; retained payloads may be unavailable. Neither --where nor event search indexes request/response bodies.",
15834
+ "Search does not expose a receipt key or storage reference. To retrieve a specific retained tool response with runs receipt, use the receipt key returned in the run\u2019s exported evidence or tool execution metadata. For full row data, follow runs get output/export actions; dataset.lifecycle contains metadata, not all dataset rows.",
15835
+ "The catalog lists known searchable kinds, including receipt outcomes and the runtime.event fallback. Use the exact dotted name with --kind. Future stored kinds can also be queried; this list is not a CLI validation allowlist. Events are observations, not a count of billed provider calls.",
15836
+ "Catalog payload fields are possible producer fields, not required fields or --where paths. Canonical eventPayload uses type for the dotted event kind; its kind field, when present on a step, becomes indexed stepKind. Indexed log entries describe individual lines rather than reproducing the original lines batch.",
15837
+ "Canonical event envelopes carry runId, type, occurredAt (producer milliseconds), source, optional seq and optional producer-owned payload. Search occurredAt/ingestedAt are UTC timestamp strings. source identifies the recorded producer; producerAttempt is present only when known.",
15838
+ "activity.observed stores observation with activityId, stepId, target, state and observedAt. Targets describe provider, dataset, lease, runner, step or capacity work. State kinds are active, queued, waiting, retrying, scheduled, completed or failed; retry/wait detail stays in the payload. work.counters contains aggregate logicalCalls, providerRequests and provider429s, not per-call responses."
15839
+ ],
15840
+ commands: []
15841
+ }
15842
+ ];
15843
+ var RETENTION = [
15844
+ "Event/log/receipt search shares the PlanetScale index. New runs marked runEventStore=planet_scale retain accepted event/log history in PlanetScale; Convex keeps current run/control state and eligible saved-Play rollup facts. Older unmarked runs retain their existing readers. No backfill is implied.",
15845
+ "Search retention is seven days; receipt payload retention is independent. Logs reflect accepted, retained lines: runtime sampling and truncation can omit original console output. Read returned retention/sampling warnings; an export contains the full retained stream, not suppressed lines."
15846
+ ];
15847
+ function wrapParagraph(text, indent2 = 2) {
15848
+ const lines = [];
15849
+ const padding = " ".repeat(indent2);
15850
+ let line = padding;
15851
+ for (const word of text.split(" ")) {
15852
+ if (line.length + word.length > 80 && line.trim()) {
15853
+ lines.push(line.trimEnd());
15854
+ line = padding;
15855
+ }
15856
+ line += `${word} `;
15857
+ }
15858
+ lines.push(line.trimEnd());
15859
+ return lines.join("\n");
15860
+ }
15861
+ function renderRunLogsHelp() {
15862
+ const section = ({
15863
+ title,
15864
+ paragraphs,
15865
+ commands
15866
+ }) => [
15867
+ `${title}:`,
15868
+ ...paragraphs.flatMap((paragraph) => [wrapParagraph(paragraph), ""]),
15869
+ ...commands.length ? [" Common commands:", ...commands.map((command) => ` ${command}`)] : [],
15870
+ ""
15871
+ ];
15872
+ return [
15873
+ "",
15874
+ ...section(SECTIONS[0]),
15875
+ "Known --kind values (complete catalog):",
15876
+ ...RUN_LOGS_KIND_HELP.flatMap(
15877
+ ({ kind, description, emittedBy, payloadFields }) => [
15878
+ ` ${kind}`,
15879
+ wrapParagraph(description, 4),
15880
+ wrapParagraph(
15881
+ `Recorded by: ${emittedBy}. Payload fields: ${kind === RUN_EVENT_SEARCH_FALLBACK_KIND ? "producer-specific fields; inspect the returned payload" : payloadFields.join(", ") || "event envelope only"}.`,
15882
+ 4
15883
+ )
15884
+ ]
15885
+ ),
15886
+ "",
15887
+ ...SECTIONS.slice(1).flatMap(section),
15888
+ "Storage and retention:",
15889
+ ...RETENTION.flatMap((paragraph) => [wrapParagraph(paragraph), ""])
15890
+ ].join("\n");
15891
+ }
15892
+
15666
15893
  // ../play-runtime/run-execution-state.ts
15667
15894
  function assertNeverState(value, what) {
15668
15895
  throw new Error(`Unhandled ${what}: ${JSON.stringify(value)}`);
@@ -36794,51 +37021,21 @@ Examples:
36794
37021
  });
36795
37022
  runs.command("logs [runId]").description(
36796
37023
  "Fetch one run\u2019s logs or search recent runtime events across runs."
36797
- ).addHelpText(
36798
- "after",
36799
- `
36800
- Notes:
36801
- Prints a bounded recent log preview by default. Use --out to write the full
36802
- retained stream to a local file. Use --log-level to filter by severity;
36803
- default debug preserves the complete historical stream.
36804
-
36805
- Search flags read the org-scoped event index (last hour by default, at most
36806
- seven days). Org, run, Play, runtime scope and known attempt identity are
36807
- attached automatically. --where accepts equality joined with && for orgId,
36808
- runId, playName, runtimeScope, producerAttempt, kind, status, source, stepId,
36809
- stepKind, datasetId, phase, provider, operation, and scalar context.<key>.
36810
- Filters only narrow the authenticated org/runtime scope. Provider and
36811
- operation come from typed provider activity observations; this does not
36812
- index request/response bodies or promise one event per provider call. --payloads
36813
- includes full result data in this command, capped at ten events and 16 MiB.
36814
-
36815
- Event, log, and receipt search share one PlanetScale index. For runs marked
36816
- runEventStore=planet_scale, PlanetScale owns full event/log history; Convex
36817
- keeps the live run snapshot, admission fence, and eligible saved-Play rollup
36818
- facts. Marked-run log bodies are not copied into Convex. Unmarked legacy runs
36819
- keep their existing Convex event history and Run Log Stream.
36820
- Known --kind values: ${RUN_EVENT_SEARCH_KIND_VALUES.join(", ")}.
36821
-
36822
- Examples:
36823
- deepline runs logs play/my-play/run/20260501t000000-000
36824
- deepline runs logs play/my-play/run/20260501t000000-000 --limit 500
36825
- deepline runs logs play/my-play/run/20260501t000000-000 --failed --json
36826
- deepline runs logs play/my-play/run/20260501t000000-000 --log-level error
36827
- deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --log-level debug --json
36828
- deepline runs logs --since 2026-09-29T00:00:00Z --kind step.failed --json
36829
- deepline runs logs --kind activity.observed --where '$.provider == "apollo" && $.operation == "company_lookup"' --json
36830
- deepline runs logs --play my-play --where '$.context.companyId == "acme_123"' --json
36831
- deepline runs logs --where '$.status == "failed"' --payloads --play my-play --json
36832
- `
36833
- ).option("--limit <count>", "Maximum log lines or search events to print").option("--out <path>", "Write the full retained log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option(
37024
+ ).addHelpText("after", renderRunLogsHelp()).option(
37025
+ "--limit <count>",
37026
+ "Text tail: default 200; search: default 100, max 200 (10 with --payloads)"
37027
+ ).option("--out <path>", "Write the full retained log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option(
36834
37028
  "--log-level <level>",
36835
37029
  "Minimum severity: debug (default), info, warn, or error"
36836
- ).option("--logs", "Compatibility alias for --log-level debug").option("--debug", "Compatibility alias for --log-level debug").option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--since <timestamp>", "Search events since this UTC timestamp").option("--until <timestamp>", "Search events before this UTC timestamp").option("--play <name>", "Filter events by Play name").option("--kind <kind>", "Filter events by kind").option(
37030
+ ).option("--logs", "Compatibility alias for --log-level debug").option("--debug", "Compatibility alias for --log-level debug").option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--since <timestamp>", "Search events since this UTC timestamp").option("--until <timestamp>", "Search events before this UTC timestamp").option("--play <name>", "Filter events by Play name").option(
37031
+ "--kind <kind>",
37032
+ "Search one exact event kind; complete catalog below"
37033
+ ).option(
36837
37034
  "--where <jsonpath>",
36838
- 'Bound JSONPath equality over event fields (for example $.provider == "apollo" && $.operation == "company_lookup")'
37035
+ "Search indexed fields with == and &&; field types and availability below"
36839
37036
  ).option(
36840
37037
  "--payloads",
36841
- "Include full stored payloads (up to 10 events and 16 MiB)"
37038
+ "Search with canonical eventPayload or receipt payload; max 10 events, 16 MiB"
36842
37039
  ).option("--cursor <token>", "Continue a bounded event search").option(
36843
37040
  "--runtime-namespace <name>",
36844
37041
  "Search an explicitly authorized Preview namespace"