deepline 0.3.271 → 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.
Files changed (38) hide show
  1. package/README.md +9 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +49 -17
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/runs/receipts.ts +18 -2
  5. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +3 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +11 -9
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +5 -4
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +2 -1
  9. package/dist/bundling-sources/shared_libs/play-runtime/run-event-catalog.ts +610 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +3 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-diagnostics.ts +3 -2
  12. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +80 -67
  13. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +5 -4
  14. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +3 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +19 -9
  16. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +103 -78
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +125 -81
  18. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +3 -2
  19. package/dist/cli/index.js +662 -39
  20. package/dist/cli/index.mjs +662 -39
  21. package/dist/{client-BbKtvT9Q.d.ts → client-5xpuGpRn.d.ts} +64 -19
  22. package/dist/{client-C1Xm7eBH.d.mts → client-D9annc6K.d.mts} +64 -19
  23. package/dist/{compiler-manifest-CUuh8C3b.d.mts → compiler-manifest-C1bKB9bY.d.mts} +3 -2
  24. package/dist/{compiler-manifest-CUuh8C3b.d.ts → compiler-manifest-C1bKB9bY.d.ts} +3 -2
  25. package/dist/index.d.mts +4 -4
  26. package/dist/index.d.ts +4 -4
  27. package/dist/index.js +423 -4
  28. package/dist/index.mjs +423 -4
  29. package/dist/install-integrity.json +5 -4
  30. package/dist/plays/bundle-play-file.d.mts +2 -2
  31. package/dist/plays/bundle-play-file.d.ts +2 -2
  32. package/dist/plays/run-request.d.mts +2 -2
  33. package/dist/plays/run-request.d.ts +2 -2
  34. package/dist/release.d.mts +1 -1
  35. package/dist/release.d.ts +1 -1
  36. package/dist/release.js +1 -1
  37. package/dist/release.mjs +1 -1
  38. package/package.json +1 -1
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.271",
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
@@ -5226,6 +5226,425 @@ var ledgerIngressRedactor = createSecretRedactionContext();
5226
5226
  var utf8Encoder = new TextEncoder();
5227
5227
  var PLAY_DATASET_BRAND = Symbol.for("deepline.play.dataset");
5228
5228
 
5229
+ // ../play-runtime/run-event-catalog.ts
5230
+ var RUN_EVENT_KIND = {
5231
+ runCreated: "run.created",
5232
+ runStarted: "run.started",
5233
+ runWaiting: "run.waiting",
5234
+ runResumed: "run.resumed",
5235
+ runCompleted: "run.completed",
5236
+ runFailed: "run.failed",
5237
+ runCancelled: "run.cancelled",
5238
+ stepStarted: "step.started",
5239
+ stepProgress: "step.progress",
5240
+ stepCompleted: "step.completed",
5241
+ stepFailed: "step.failed",
5242
+ stepSkipped: "step.skipped",
5243
+ logAppended: "log.appended",
5244
+ datasetLifecycle: "dataset.lifecycle",
5245
+ activityObserved: "activity.observed",
5246
+ workCounters: "work.counters"
5247
+ };
5248
+ var SEARCHABLE_EVENT_FIELDS = [
5249
+ "kind",
5250
+ "runId",
5251
+ "playName",
5252
+ "source",
5253
+ "occurredAt"
5254
+ ];
5255
+ var RUN_SNAPSHOT_DESTINATION = {
5256
+ searchIndex: "planet_scale_runtime_event_index",
5257
+ markedRunStore: "planet_scale",
5258
+ planetScaleContent: "event_payload",
5259
+ convexProjection: "run_snapshot",
5260
+ convexRetainedFacts: ["saved_play_rollup_if_eligible"],
5261
+ legacyConvexDestination: "run_ledger_history",
5262
+ explanation: "PlanetScale retains the complete event. Convex reduces it into bounded current run state and keeps only selected saved-Play rollup facts when eligible; unmarked legacy runs retain Convex event history."
5263
+ };
5264
+ var RUN_CREATED_DESTINATION = {
5265
+ ...RUN_SNAPSHOT_DESTINATION,
5266
+ convexRetainedFacts: ["admission_fence", "saved_play_rollup_if_eligible"],
5267
+ explanation: "PlanetScale retains the complete event. Convex uses it for the live run snapshot, retains the admission fence, and may retain a saved-Play rollup fact; unmarked legacy runs retain Convex event history."
5268
+ };
5269
+ var RUN_LOG_DESTINATION = {
5270
+ searchIndex: "planet_scale_runtime_event_index",
5271
+ markedRunStore: "planet_scale",
5272
+ planetScaleContent: "log_body",
5273
+ convexProjection: null,
5274
+ convexRetainedFacts: [],
5275
+ legacyConvexDestination: "run_log_stream",
5276
+ explanation: "PlanetScale retains the canonical log line and its search metadata. Marked-run log bodies are not copied into Convex; unmarked legacy runs continue to use the Convex Run Log Stream."
5277
+ };
5278
+ var RUN_EVENT_KIND_CATALOG = {
5279
+ [RUN_EVENT_KIND.runCreated]: {
5280
+ description: "The run was admitted and received its run ID.",
5281
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5282
+ outboxCarriers: ["run.created"],
5283
+ destination: RUN_CREATED_DESTINATION,
5284
+ example: {
5285
+ runId: "play/enrich/run/abc123",
5286
+ type: RUN_EVENT_KIND.runCreated,
5287
+ seq: 1
5288
+ }
5289
+ },
5290
+ [RUN_EVENT_KIND.runStarted]: {
5291
+ description: "The run began execution.",
5292
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5293
+ outboxCarriers: ["run.started"],
5294
+ destination: RUN_SNAPSHOT_DESTINATION,
5295
+ example: {
5296
+ runId: "play/enrich/run/abc123",
5297
+ type: RUN_EVENT_KIND.runStarted,
5298
+ seq: 2
5299
+ }
5300
+ },
5301
+ [RUN_EVENT_KIND.runWaiting]: {
5302
+ description: "The run entered a durable wait.",
5303
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5304
+ outboxCarriers: ["run.waiting"],
5305
+ destination: RUN_SNAPSHOT_DESTINATION,
5306
+ example: {
5307
+ runId: "play/enrich/run/abc123",
5308
+ type: RUN_EVENT_KIND.runWaiting,
5309
+ waitKind: "sleep"
5310
+ }
5311
+ },
5312
+ [RUN_EVENT_KIND.runResumed]: {
5313
+ description: "The run resumed after a durable wait.",
5314
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5315
+ outboxCarriers: ["run.resumed"],
5316
+ destination: RUN_SNAPSHOT_DESTINATION,
5317
+ example: {
5318
+ runId: "play/enrich/run/abc123",
5319
+ type: RUN_EVENT_KIND.runResumed
5320
+ }
5321
+ },
5322
+ [RUN_EVENT_KIND.runCompleted]: {
5323
+ description: "The run completed successfully.",
5324
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5325
+ outboxCarriers: ["run.completed", "runner.logs"],
5326
+ destination: RUN_SNAPSHOT_DESTINATION,
5327
+ example: {
5328
+ runId: "play/enrich/run/abc123",
5329
+ type: RUN_EVENT_KIND.runCompleted
5330
+ }
5331
+ },
5332
+ [RUN_EVENT_KIND.runFailed]: {
5333
+ description: "The run ended with a failure.",
5334
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5335
+ outboxCarriers: ["run.failed", "runner.logs"],
5336
+ destination: RUN_SNAPSHOT_DESTINATION,
5337
+ example: {
5338
+ runId: "play/enrich/run/abc123",
5339
+ type: RUN_EVENT_KIND.runFailed,
5340
+ error: "Request timed out"
5341
+ }
5342
+ },
5343
+ [RUN_EVENT_KIND.runCancelled]: {
5344
+ description: "The run was cancelled.",
5345
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5346
+ outboxCarriers: ["run.cancelled"],
5347
+ destination: RUN_SNAPSHOT_DESTINATION,
5348
+ example: {
5349
+ runId: "play/enrich/run/abc123",
5350
+ type: RUN_EVENT_KIND.runCancelled
5351
+ }
5352
+ },
5353
+ [RUN_EVENT_KIND.stepStarted]: {
5354
+ description: "A named step began execution.",
5355
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5356
+ outboxCarriers: [
5357
+ "run.events",
5358
+ "run.completed",
5359
+ "run.failed",
5360
+ "runner.logs"
5361
+ ],
5362
+ destination: RUN_SNAPSHOT_DESTINATION,
5363
+ example: {
5364
+ runId: "play/enrich/run/abc123",
5365
+ type: RUN_EVENT_KIND.stepStarted,
5366
+ stepId: "lookup"
5367
+ }
5368
+ },
5369
+ [RUN_EVENT_KIND.stepProgress]: {
5370
+ description: "A named step reported progress.",
5371
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5372
+ outboxCarriers: [
5373
+ "run.events",
5374
+ "run.completed",
5375
+ "run.failed",
5376
+ "runner.logs"
5377
+ ],
5378
+ destination: RUN_SNAPSHOT_DESTINATION,
5379
+ example: {
5380
+ runId: "play/enrich/run/abc123",
5381
+ type: RUN_EVENT_KIND.stepProgress,
5382
+ stepId: "lookup"
5383
+ }
5384
+ },
5385
+ [RUN_EVENT_KIND.stepCompleted]: {
5386
+ description: "A named step completed.",
5387
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5388
+ outboxCarriers: [
5389
+ "run.events",
5390
+ "run.completed",
5391
+ "run.failed",
5392
+ "runner.logs"
5393
+ ],
5394
+ destination: RUN_SNAPSHOT_DESTINATION,
5395
+ example: {
5396
+ runId: "play/enrich/run/abc123",
5397
+ type: RUN_EVENT_KIND.stepCompleted,
5398
+ stepId: "lookup"
5399
+ }
5400
+ },
5401
+ [RUN_EVENT_KIND.stepFailed]: {
5402
+ description: "A named step failed.",
5403
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5404
+ outboxCarriers: [
5405
+ "run.events",
5406
+ "run.completed",
5407
+ "run.failed",
5408
+ "runner.logs"
5409
+ ],
5410
+ destination: RUN_SNAPSHOT_DESTINATION,
5411
+ example: {
5412
+ runId: "play/enrich/run/abc123",
5413
+ type: RUN_EVENT_KIND.stepFailed,
5414
+ stepId: "lookup"
5415
+ }
5416
+ },
5417
+ [RUN_EVENT_KIND.stepSkipped]: {
5418
+ description: "A named step was skipped.",
5419
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5420
+ outboxCarriers: [
5421
+ "run.events",
5422
+ "run.completed",
5423
+ "run.failed",
5424
+ "runner.logs"
5425
+ ],
5426
+ destination: RUN_SNAPSHOT_DESTINATION,
5427
+ example: {
5428
+ runId: "play/enrich/run/abc123",
5429
+ type: RUN_EVENT_KIND.stepSkipped,
5430
+ stepId: "lookup"
5431
+ }
5432
+ },
5433
+ [RUN_EVENT_KIND.logAppended]: {
5434
+ description: "A text log line was appended to the unified run history and log view.",
5435
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5436
+ outboxCarriers: [
5437
+ "run.events",
5438
+ "run.waiting",
5439
+ "run.resumed",
5440
+ "run.completed",
5441
+ "run.failed",
5442
+ "runner.logs",
5443
+ "run.wait_timeout"
5444
+ ],
5445
+ destination: RUN_LOG_DESTINATION,
5446
+ example: {
5447
+ runId: "play/enrich/run/abc123",
5448
+ type: RUN_EVENT_KIND.logAppended,
5449
+ lines: ["Waiting for integration_event:contact.updated."]
5450
+ }
5451
+ },
5452
+ [RUN_EVENT_KIND.datasetLifecycle]: {
5453
+ description: "A run dataset was registered, made available, or failed.",
5454
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5455
+ outboxCarriers: [
5456
+ "run.events",
5457
+ "run.completed",
5458
+ "run.failed",
5459
+ "runner.logs"
5460
+ ],
5461
+ destination: RUN_SNAPSHOT_DESTINATION,
5462
+ example: {
5463
+ runId: "play/enrich/run/abc123",
5464
+ type: RUN_EVENT_KIND.datasetLifecycle,
5465
+ phase: "available"
5466
+ }
5467
+ },
5468
+ [RUN_EVENT_KIND.activityObserved]: {
5469
+ description: "The runtime recorded an activity observation.",
5470
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5471
+ outboxCarriers: [
5472
+ "run.events",
5473
+ "run.completed",
5474
+ "run.failed",
5475
+ "runner.logs"
5476
+ ],
5477
+ destination: RUN_SNAPSHOT_DESTINATION,
5478
+ example: {
5479
+ runId: "play/enrich/run/abc123",
5480
+ type: RUN_EVENT_KIND.activityObserved
5481
+ }
5482
+ },
5483
+ [RUN_EVENT_KIND.workCounters]: {
5484
+ description: "A work segment reported logical call, provider request, and rate-limit counters.",
5485
+ searchableFields: SEARCHABLE_EVENT_FIELDS,
5486
+ outboxCarriers: [
5487
+ "run.events",
5488
+ "run.completed",
5489
+ "run.failed",
5490
+ "runner.logs"
5491
+ ],
5492
+ destination: RUN_SNAPSHOT_DESTINATION,
5493
+ example: {
5494
+ runId: "play/enrich/run/abc123",
5495
+ type: RUN_EVENT_KIND.workCounters,
5496
+ attempt: 1,
5497
+ logicalCalls: 4,
5498
+ providerRequests: 4,
5499
+ provider429s: 0,
5500
+ final: true
5501
+ }
5502
+ }
5503
+ };
5504
+ var RUN_EVENT_KINDS = Object.freeze(
5505
+ Object.keys(RUN_EVENT_KIND_CATALOG)
5506
+ );
5507
+ var RUN_SCHEDULER_OUTBOX_EVENT_TYPE = {
5508
+ runCreated: RUN_EVENT_KIND.runCreated,
5509
+ runStarted: RUN_EVENT_KIND.runStarted,
5510
+ runWaiting: RUN_EVENT_KIND.runWaiting,
5511
+ runResumed: RUN_EVENT_KIND.runResumed,
5512
+ runCompleted: RUN_EVENT_KIND.runCompleted,
5513
+ runFailed: RUN_EVENT_KIND.runFailed,
5514
+ runCancelled: RUN_EVENT_KIND.runCancelled,
5515
+ runEvents: "run.events",
5516
+ runnerLogs: "runner.logs",
5517
+ runWaitTimeout: "run.wait_timeout"
5518
+ };
5519
+ var RUN_SCHEDULER_OUTBOX_EVENT_TYPES = Object.freeze(
5520
+ Object.values(RUN_SCHEDULER_OUTBOX_EVENT_TYPE)
5521
+ );
5522
+ var RUN_SCHEDULER_OUTBOX_START_EVENT_TYPES = [
5523
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCreated,
5524
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runStarted
5525
+ ];
5526
+ var RUN_SCHEDULER_OUTBOX_PREFIX_STOP_EVENT_TYPES = [
5527
+ ...RUN_SCHEDULER_OUTBOX_START_EVENT_TYPES,
5528
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runEvents
5529
+ ];
5530
+ var RUN_SCHEDULER_OUTBOX_TERMINAL_EVENT_TYPES = [
5531
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCompleted,
5532
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runFailed,
5533
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCancelled
5534
+ ];
5535
+ var RUN_EVENT_CONVEX_INTERNAL_KIND = {
5536
+ rollupMembershipAdded: "rollup.membership.added",
5537
+ rollupMembershipRemoved: "rollup.membership.removed"
5538
+ };
5539
+ var RUN_RECEIPT_SEARCH_KIND = {
5540
+ completed: "receipt.completed",
5541
+ failed: "receipt.failed",
5542
+ skipped: "receipt.skipped"
5543
+ };
5544
+ var RUN_RECEIPT_SEARCH_KIND_CATALOG = {
5545
+ [RUN_RECEIPT_SEARCH_KIND.completed]: {
5546
+ description: "A durable work receipt completed.",
5547
+ searchIndex: "planet_scale_runtime_event_index",
5548
+ payloadStore: "authoritative_work_receipt"
5549
+ },
5550
+ [RUN_RECEIPT_SEARCH_KIND.failed]: {
5551
+ description: "A durable work receipt failed.",
5552
+ searchIndex: "planet_scale_runtime_event_index",
5553
+ payloadStore: "authoritative_work_receipt"
5554
+ },
5555
+ [RUN_RECEIPT_SEARCH_KIND.skipped]: {
5556
+ description: "A durable work receipt was skipped.",
5557
+ searchIndex: "planet_scale_runtime_event_index",
5558
+ payloadStore: "authoritative_work_receipt"
5559
+ }
5560
+ };
5561
+ var RUN_EVENT_SEARCH_FALLBACK_KIND = "runtime.event";
5562
+ var RUN_EVENT_SEARCH_KIND_VALUES = Object.freeze([
5563
+ ...RUN_EVENT_KINDS,
5564
+ ...Object.keys(RUN_RECEIPT_SEARCH_KIND_CATALOG),
5565
+ RUN_EVENT_SEARCH_FALLBACK_KIND
5566
+ ]);
5567
+ var RUN_EVENT_TERMINAL_KIND_VALUES = [
5568
+ RUN_EVENT_KIND.runCompleted,
5569
+ RUN_EVENT_KIND.runFailed,
5570
+ RUN_EVENT_KIND.runCancelled
5571
+ ];
5572
+ var RUN_LOG_RETENTION_MAX_BYTES = 5 * 1024 * 1024;
5573
+ function sqlStringLiteral(value) {
5574
+ return "'" + value.replaceAll("'", "''") + "'";
5575
+ }
5576
+ var RUN_EVENT_KNOWN_KIND_SQL_LIST = RUN_EVENT_KINDS.map(sqlStringLiteral).join(", ");
5577
+ var RUN_EVENT_LIFECYCLE_KIND_SQL_LIST = [
5578
+ RUN_EVENT_KIND.runCreated,
5579
+ RUN_EVENT_KIND.runStarted,
5580
+ RUN_EVENT_KIND.runWaiting,
5581
+ RUN_EVENT_KIND.runResumed,
5582
+ RUN_EVENT_KIND.runCompleted,
5583
+ RUN_EVENT_KIND.runFailed,
5584
+ RUN_EVENT_KIND.runCancelled
5585
+ ].map(sqlStringLiteral).join(", ");
5586
+ var RUN_EVENT_SNAPSHOT_KIND_SQL_LIST = RUN_EVENT_KINDS.filter(
5587
+ (kind) => kind !== RUN_EVENT_KIND.logAppended
5588
+ ).map(sqlStringLiteral).join(", ");
5589
+ var RUN_EVENT_KIND_SQL_LITERAL = {
5590
+ runCreated: sqlStringLiteral(RUN_EVENT_KIND.runCreated),
5591
+ runStarted: sqlStringLiteral(RUN_EVENT_KIND.runStarted),
5592
+ runWaiting: sqlStringLiteral(RUN_EVENT_KIND.runWaiting),
5593
+ runResumed: sqlStringLiteral(RUN_EVENT_KIND.runResumed),
5594
+ runCompleted: sqlStringLiteral(RUN_EVENT_KIND.runCompleted),
5595
+ runFailed: sqlStringLiteral(RUN_EVENT_KIND.runFailed),
5596
+ runCancelled: sqlStringLiteral(RUN_EVENT_KIND.runCancelled),
5597
+ stepStarted: sqlStringLiteral(RUN_EVENT_KIND.stepStarted),
5598
+ stepProgress: sqlStringLiteral(RUN_EVENT_KIND.stepProgress),
5599
+ stepCompleted: sqlStringLiteral(RUN_EVENT_KIND.stepCompleted),
5600
+ stepFailed: sqlStringLiteral(RUN_EVENT_KIND.stepFailed),
5601
+ stepSkipped: sqlStringLiteral(RUN_EVENT_KIND.stepSkipped),
5602
+ logAppended: sqlStringLiteral(RUN_EVENT_KIND.logAppended),
5603
+ datasetLifecycle: sqlStringLiteral(RUN_EVENT_KIND.datasetLifecycle),
5604
+ activityObserved: sqlStringLiteral(RUN_EVENT_KIND.activityObserved),
5605
+ workCounters: sqlStringLiteral(RUN_EVENT_KIND.workCounters)
5606
+ };
5607
+ var RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL = {
5608
+ runCreated: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCreated),
5609
+ runStarted: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runStarted),
5610
+ runWaiting: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runWaiting),
5611
+ runResumed: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runResumed),
5612
+ runCompleted: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCompleted),
5613
+ runFailed: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runFailed),
5614
+ runCancelled: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCancelled),
5615
+ runEvents: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runEvents),
5616
+ runnerLogs: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runnerLogs),
5617
+ runWaitTimeout: sqlStringLiteral(
5618
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runWaitTimeout
5619
+ )
5620
+ };
5621
+ var RUN_EVENT_CONVEX_INTERNAL_KIND_SQL_LITERAL = {
5622
+ rollupMembershipAdded: sqlStringLiteral(
5623
+ RUN_EVENT_CONVEX_INTERNAL_KIND.rollupMembershipAdded
5624
+ ),
5625
+ rollupMembershipRemoved: sqlStringLiteral(
5626
+ RUN_EVENT_CONVEX_INTERNAL_KIND.rollupMembershipRemoved
5627
+ )
5628
+ };
5629
+ var RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST = [
5630
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCompleted,
5631
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runFailed,
5632
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runnerLogs
5633
+ ].map(sqlStringLiteral).join(", ");
5634
+ var RUN_SCHEDULER_OUTBOX_TERMINAL_EVENT_TYPE_SQL_LIST = [
5635
+ ...RUN_SCHEDULER_OUTBOX_TERMINAL_EVENT_TYPES
5636
+ ].map(sqlStringLiteral).join(", ");
5637
+ var RUN_EVENT_SEARCH_FALLBACK_KIND_SQL_LITERAL = sqlStringLiteral(
5638
+ RUN_EVENT_SEARCH_FALLBACK_KIND
5639
+ );
5640
+
5641
+ // ../play-runtime/run-ledger.ts
5642
+ var TERMINAL_STATUS_BY_EVENT_TYPE = {
5643
+ [RUN_EVENT_KIND.runCompleted]: "completed",
5644
+ [RUN_EVENT_KIND.runFailed]: "failed",
5645
+ [RUN_EVENT_KIND.runCancelled]: "cancelled"
5646
+ };
5647
+
5229
5648
  // ../play-runtime/run-lifecycle-policy.ts
5230
5649
  var TERMINAL_PLAY_RUN_STATUSES = /* @__PURE__ */ new Set([
5231
5650
  "completed",
@@ -7949,7 +8368,7 @@ var DeeplineClient = class _DeeplineClient {
7949
8368
  );
7950
8369
  return { ...response, runs: response.runs ?? [] };
7951
8370
  }
7952
- /** 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. */
7953
8372
  async getRunReceipts(runId, options) {
7954
8373
  if (!options.keys.length || options.keys.some(
7955
8374
  (key) => typeof key !== "string" || !key.trim() || key.length > 2048 || /[\r\n\0]/.test(key)
@@ -8005,7 +8424,7 @@ var DeeplineClient = class _DeeplineClient {
8005
8424
  );
8006
8425
  }
8007
8426
  /**
8008
- * 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.
8009
8428
  *
8010
8429
  * This is the SDK equivalent of:
8011
8430
  *
@@ -8084,7 +8503,7 @@ var DeeplineClient = class _DeeplineClient {
8084
8503
  ...probe.logsTruncated ? { logsTruncated: true } : {}
8085
8504
  };
8086
8505
  }
8087
- /** 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. */
8088
8507
  async searchRunEvents(options = {}) {
8089
8508
  const now = Date.now();
8090
8509
  const params = new URLSearchParams({
@@ -15244,6 +15663,233 @@ function registerPlayTriggerConfigCommands(plays) {
15244
15663
  // src/cli/commands/play.ts
15245
15664
  var import_node_crypto7 = require("crypto");
15246
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
+
15247
15893
  // ../play-runtime/run-execution-state.ts
15248
15894
  function assertNeverState(value, what) {
15249
15895
  throw new Error(`Unhandled ${what}: ${JSON.stringify(value)}`);
@@ -36375,44 +37021,21 @@ Examples:
36375
37021
  });
36376
37022
  runs.command("logs [runId]").description(
36377
37023
  "Fetch one run\u2019s logs or search recent runtime events across runs."
36378
- ).addHelpText(
36379
- "after",
36380
- `
36381
- Notes:
36382
- Prints a bounded recent log preview by default. Use --out to write the full
36383
- retained stream to a local file. Use --log-level to filter by severity;
36384
- default debug preserves the complete historical stream.
36385
-
36386
- Search flags read the org-scoped event index (last hour by default, at most
36387
- seven days). Org, run, Play, runtime scope and known attempt identity are
36388
- attached automatically. --where accepts equality joined with && for orgId,
36389
- runId, playName, runtimeScope, producerAttempt, kind, status, source, stepId,
36390
- stepKind, datasetId, phase, provider, operation, and scalar context.<key>.
36391
- Filters only narrow the authenticated org/runtime scope. Provider and
36392
- operation come from typed provider activity observations; this does not
36393
- index request/response bodies or promise one event per provider call. --payloads
36394
- includes full result data in this command, capped at ten events and 16 MiB.
36395
-
36396
- Examples:
36397
- deepline runs logs play/my-play/run/20260501t000000-000
36398
- deepline runs logs play/my-play/run/20260501t000000-000 --limit 500
36399
- deepline runs logs play/my-play/run/20260501t000000-000 --failed --json
36400
- deepline runs logs play/my-play/run/20260501t000000-000 --log-level error
36401
- deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --log-level debug --json
36402
- deepline runs logs --since 2026-09-29T00:00:00Z --kind step.failed --json
36403
- deepline runs logs --kind activity.observed --where '$.provider == "apollo" && $.operation == "company_lookup"' --json
36404
- deepline runs logs --play my-play --where '$.context.companyId == "acme_123"' --json
36405
- deepline runs logs --where '$.status == "failed"' --payloads --play my-play --json
36406
- `
36407
- ).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(
36408
37028
  "--log-level <level>",
36409
37029
  "Minimum severity: debug (default), info, warn, or error"
36410
- ).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(
36411
37034
  "--where <jsonpath>",
36412
- 'Bound JSONPath equality over event fields (for example $.provider == "apollo" && $.operation == "company_lookup")'
37035
+ "Search indexed fields with == and &&; field types and availability below"
36413
37036
  ).option(
36414
37037
  "--payloads",
36415
- "Include full stored payloads (up to 10 events and 16 MiB)"
37038
+ "Search with canonical eventPayload or receipt payload; max 10 events, 16 MiB"
36416
37039
  ).option("--cursor <token>", "Continue a bounded event search").option(
36417
37040
  "--runtime-namespace <name>",
36418
37041
  "Search an explicitly authorized Preview namespace"
@@ -39442,7 +40065,7 @@ function enrichReportJson(report) {
39442
40065
  } : {}
39443
40066
  };
39444
40067
  }
39445
- function sqlStringLiteral(value) {
40068
+ function sqlStringLiteral2(value) {
39446
40069
  return `'${value.replace(/'/g, "''")}'`;
39447
40070
  }
39448
40071
  function failureAliasFromCellMeta(cellMeta) {
@@ -39537,7 +40160,7 @@ async function collectCustomerDbFailureJobs(input2) {
39537
40160
  const aliasIndexByName = new Map(
39538
40161
  fallbackAliases.map((spec, index) => [normalizeAlias2(spec.alias), index])
39539
40162
  );
39540
- const sql = `select _input_index, _status, _error, _cell_meta from ${customerDb.sqlQualifiedTableName} where _run_id = ${sqlStringLiteral(customerDb.runId)} and (_error is not null or lower(coalesce(_status, '')) in ('failed', 'error')) order by _input_index limit 1000`;
40163
+ const sql = `select _input_index, _status, _error, _cell_meta from ${customerDb.sqlQualifiedTableName} where _run_id = ${sqlStringLiteral2(customerDb.runId)} and (_error is not null or lower(coalesce(_status, '')) in ('failed', 'error')) order by _input_index limit 1000`;
39541
40164
  const retryDelays = enrichCustomerDbFailureLookupRetryDelaysMs();
39542
40165
  let lastError = null;
39543
40166
  let attempts = 0;