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
@@ -7,6 +7,16 @@
7
7
  */
8
8
  import { normalizeRuntimeSchedulerSchema } from '../runtime-scheduler-topology';
9
9
  import type { PostgresSchedulerQueryClient } from './postgres';
10
+ import {
11
+ RUN_EVENT_CONVEX_INTERNAL_KIND_SQL_LITERAL,
12
+ RUN_EVENT_KIND_SQL_LITERAL,
13
+ RUN_EVENT_KNOWN_KIND_SQL_LIST,
14
+ RUN_EVENT_LIFECYCLE_KIND_SQL_LIST,
15
+ RUN_EVENT_SNAPSHOT_KIND_SQL_LIST,
16
+ RUN_EVENT_SEARCH_FALLBACK_KIND_SQL_LITERAL,
17
+ RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST,
18
+ RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL,
19
+ } from '../run-event-catalog';
10
20
 
11
21
  const EVENTS_TABLE = 'runtime_observability.events';
12
22
  const RUNTIME_EVENT_LOG_DEDUPE_INDEX = 'runtime_events_log_attempt_digest_idx';
@@ -15,18 +25,18 @@ const RUNTIME_EVENT_LOG_POSITION_INDEX =
15
25
  const RUNTIME_EVENT_LOG_LEGACY_INDEX =
16
26
  'runtime_events_legacy_log_normalize_idx';
17
27
  const RUNTIME_EVENT_LOG_BODY_PAGE_INDEX = 'runtime_events_run_log_body_seq_idx';
18
- const RUNTIME_EVENT_LOG_LEGACY_PREDICATE = `kind = 'log.appended'
28
+ const RUNTIME_EVENT_LOG_LEGACY_PREDICATE = `kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
19
29
  AND source_digest IS NOT NULL
20
30
  AND NOT (search_doc ? 'logContentDigest')
21
31
  AND (search_doc->>'producerAttempt') ~ '^[1-9][0-9]{0,5}$'`;
22
- const RUNTIME_EVENT_LOG_BODY_PAGE_PREDICATE = `kind = 'log.appended'
32
+ const RUNTIME_EVENT_LOG_BODY_PAGE_PREDICATE = `kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
23
33
  AND log_seq IS NOT NULL
24
34
  AND (log_body IS NOT NULL OR message IS NOT NULL)`;
25
- const RUNTIME_EVENT_LOG_DEDUPE_PREDICATE = `kind = 'log.appended'
35
+ const RUNTIME_EVENT_LOG_DEDUPE_PREDICATE = `kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
26
36
  AND source_digest IS NOT NULL
27
37
  AND search_doc ? 'producerAttempt'
28
38
  AND search_doc ? 'logContentDigest'`;
29
- const RUNTIME_EVENT_LOG_POSITION_PREDICATE = `kind = 'log.appended'
39
+ const RUNTIME_EVENT_LOG_POSITION_PREDICATE = `kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
30
40
  AND search_doc ? 'producerAttempt'
31
41
  AND search_doc ? 'logPositions'`;
32
42
  const RUNTIME_EVENT_LOG_POSITION_EXPRESSION = `jsonb_set(
@@ -41,7 +51,7 @@ const RUNTIME_EVENT_LOG_POSITION_EXPRESSION = `jsonb_set(
41
51
  // Migration readiness tracks this projection body independently of scheduler
42
52
  // wire and schema versions. Bump when a changed trigger must be reinstalled.
43
53
  export const RUNTIME_EVENT_SEARCH_OUTBOX_PROJECTION_MARKER =
44
- 'runtime-event-search-log-context-v11-unified-event-journal';
54
+ 'runtime-event-search-log-context-v12-scheduler-wait-logs';
45
55
  export const RUNTIME_EVENT_CANONICAL_RETENTION_INDEX_READY_MARKER =
46
56
  'runtime-event-canonical-retention-v1';
47
57
  export const RUNTIME_EVENTS_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
@@ -369,7 +379,7 @@ export async function searchRuntimeEvents(
369
379
  params.push(input.includePayloads === true);
370
380
  const result = await client.query<EventRow>(
371
381
  `SELECT event_id, occurred_at, ingested_at, run_id, play_name, kind, level,
372
- coalesce(message, CASE WHEN kind = 'log.appended' THEN
382
+ coalesce(message, CASE WHEN kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} THEN
373
383
  left(CASE WHEN search_doc->>'source' = 'terminal' THEN
374
384
  regexp_replace(log_body,
375
385
  '^' || chr(1) || 'prov:[^' || chr(1) || ']*' || chr(1), '')
@@ -515,14 +525,14 @@ export async function getRuntimeRunLogPage(
515
525
  (SELECT log_seq
516
526
  FROM runtime_observability.events
517
527
  WHERE runtime_scope = $1 AND org_id = $2 AND run_id = $3
518
- AND kind = 'log.appended' AND log_seq IS NOT NULL
528
+ AND kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND log_seq IS NOT NULL
519
529
  AND (log_body IS NOT NULL OR message IS NOT NULL)
520
530
  AND ingested_at >= clock_timestamp() - interval '7 days'
521
531
  ORDER BY log_seq ASC LIMIT 1) AS first_seq,
522
532
  (SELECT log_seq
523
533
  FROM runtime_observability.events
524
534
  WHERE runtime_scope = $1 AND org_id = $2 AND run_id = $3
525
- AND kind = 'log.appended' AND log_seq IS NOT NULL
535
+ AND kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND log_seq IS NOT NULL
526
536
  AND (log_body IS NOT NULL OR message IS NOT NULL)
527
537
  AND ingested_at >= clock_timestamp() - interval '7 days'
528
538
  ORDER BY log_seq DESC LIMIT 1) AS last_seq
@@ -534,7 +544,7 @@ export async function getRuntimeRunLogPage(
534
544
  SELECT log_seq AS seq, coalesce(log_body, message) AS line
535
545
  FROM runtime_observability.events
536
546
  WHERE runtime_scope = $1 AND org_id = $2 AND run_id = $3
537
- AND kind = 'log.appended' AND log_seq IS NOT NULL
547
+ AND kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND log_seq IS NOT NULL
538
548
  AND (log_body IS NOT NULL OR message IS NOT NULL)
539
549
  AND ingested_at >= clock_timestamp() - interval '7 days'
540
550
  ${pageWhere}
@@ -806,7 +816,7 @@ export async function ensureRuntimeEventSearchSchema(
806
816
  );
807
817
  await client.query(`CREATE INDEX IF NOT EXISTS runtime_events_run_log_seq_idx
808
818
  ON runtime_observability.events (runtime_scope, org_id, run_id, log_seq)
809
- WHERE kind = 'log.appended' AND log_seq IS NOT NULL`);
819
+ WHERE kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND log_seq IS NOT NULL`);
810
820
  await client.query(
811
821
  `DROP INDEX IF EXISTS runtime_observability.runtime_run_log_cursors_retention_idx`,
812
822
  );
@@ -1027,7 +1037,7 @@ export async function attachRuntimeEventSearchTriggers(
1027
1037
  IF run_org IS NULL OR play IS NULL THEN
1028
1038
  RAISE EXCEPTION 'Outbox search projection has no matching run';
1029
1039
  END IF;
1030
- IF observation.event_type = 'run.events' THEN
1040
+ IF observation.event_type = ${RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL.runEvents} THEN
1031
1041
  event_batch := observation.payload_json->'events';
1032
1042
  IF jsonb_typeof(event_batch) IS DISTINCT FROM 'array' THEN
1033
1043
  RAISE EXCEPTION 'Search projection requires run.events array';
@@ -1036,7 +1046,7 @@ export async function attachRuntimeEventSearchTriggers(
1036
1046
  AND observation.payload_json->>'logBodyStore' IS DISTINCT FROM 'planet_scale' THEN
1037
1047
  RAISE EXCEPTION 'Search projection requires nonempty run.events array';
1038
1048
  END IF;
1039
- ELSIF observation.event_type IN ('run.completed', 'run.failed', 'runner.logs')
1049
+ ELSIF observation.event_type IN (${RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST})
1040
1050
  AND observation.payload_json ? 'terminalProgressEvents' THEN
1041
1051
  event_batch := observation.payload_json->'terminalProgressEvents';
1042
1052
  IF jsonb_typeof(event_batch) IS DISTINCT FROM 'array' THEN
@@ -1049,24 +1059,65 @@ export async function attachRuntimeEventSearchTriggers(
1049
1059
  observation.payload_json->'terminalWorkCounterSegment'->'attempt');
1050
1060
  -- The retained envelope has its own position space: it can contain
1051
1061
  -- diagnostics absent from both live delivery and ctx-only replay.
1052
- IF observation.event_type IN ('run.completed', 'run.failed', 'runner.logs')
1062
+ IF observation.event_type IN (${RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST})
1053
1063
  AND observation.payload_json ? 'terminalLogLines'
1054
1064
  AND (envelope_attempt #>> '{}') ~ '^[1-9][0-9]{0,5}$' THEN
1055
1065
  event_batch := coalesce(event_batch, '[]'::jsonb) || jsonb_build_array(
1056
1066
  jsonb_strip_nulls(jsonb_build_object(
1057
- 'type', 'log.appended', 'runId', observation.run_id, 'source', 'terminal',
1067
+ 'type', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, 'runId', observation.run_id, 'source', 'terminal',
1058
1068
  'producerAttempt', envelope_attempt, 'channelOffset', 0,
1059
1069
  'lines', observation.payload_json->'terminalLogLines',
1060
1070
  'lineContexts', observation.payload_json->'terminalLogContexts'
1061
1071
  ))
1062
1072
  );
1063
1073
  END IF;
1074
+ IF observation.event_type = ${RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL.runWaitTimeout} THEN
1075
+ event_batch := jsonb_build_array(jsonb_build_object(
1076
+ 'type', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended},
1077
+ 'runId', observation.run_id,
1078
+ 'occurredAt', floor(extract(epoch FROM observation.created_at) * 1000)::bigint,
1079
+ 'source', 'system',
1080
+ 'lines', jsonb_build_array(
1081
+ 'Timed out waiting for integration_event:' ||
1082
+ CASE WHEN jsonb_typeof(observation.payload_json->'eventKey') = 'string'
1083
+ THEN observation.payload_json->>'eventKey' ELSE 'event' END || '.'
1084
+ )
1085
+ ));
1086
+ ELSIF observation.event_type IN (
1087
+ ${RUN_EVENT_KIND_SQL_LITERAL.runWaiting},
1088
+ ${RUN_EVENT_KIND_SQL_LITERAL.runResumed}
1089
+ )
1090
+ AND (
1091
+ jsonb_typeof(observation.payload_json->'kind') IS DISTINCT FROM 'string'
1092
+ OR observation.payload_json->>'kind' IN ('integration_event', 'integration_event_batch')
1093
+ )
1094
+ AND (
1095
+ jsonb_typeof(observation.payload_json->'kind') IS DISTINCT FROM 'string'
1096
+ OR (
1097
+ jsonb_typeof(observation.payload_json->'eventKey') = 'string'
1098
+ AND observation.payload_json->>'eventKey' <> ''
1099
+ )
1100
+ ) THEN
1101
+ event_batch := jsonb_build_array(jsonb_build_object(
1102
+ 'type', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended},
1103
+ 'runId', observation.run_id,
1104
+ 'occurredAt', floor(extract(epoch FROM observation.created_at) * 1000)::bigint,
1105
+ 'source', 'system',
1106
+ 'lines', jsonb_build_array(
1107
+ CASE WHEN observation.event_type = ${RUN_EVENT_KIND_SQL_LITERAL.runWaiting}
1108
+ THEN 'Waiting for integration_event:'
1109
+ ELSE 'Resumed integration_event:' END ||
1110
+ CASE WHEN jsonb_typeof(observation.payload_json->'eventKey') = 'string'
1111
+ THEN observation.payload_json->>'eventKey' ELSE 'event' END || '.'
1112
+ )
1113
+ ));
1114
+ END IF;
1064
1115
  IF event_batch IS NOT NULL THEN
1065
1116
  -- Normalize old positional writers once per batch under the run mutex.
1066
1117
  -- Per-line lookups must remain digest-selective: an OR fallback for
1067
1118
  -- unmarked rows otherwise scans the whole attempt for every new line.
1068
1119
  IF EXISTS (SELECT 1 FROM jsonb_array_elements(event_batch) AS entry
1069
- WHERE entry->>'type' = 'log.appended') THEN
1120
+ WHERE entry->>'type' = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}) THEN
1070
1121
  UPDATE runtime_observability.events AS event SET search_doc = event.search_doc ||
1071
1122
  jsonb_build_object('logContentDigest', event.source_digest) ||
1072
1123
  CASE WHEN NOT (event.search_doc ? 'logPositions')
@@ -1078,7 +1129,7 @@ export async function attachRuntimeEventSearchTriggers(
1078
1129
  substring(event.event_id FROM length('log:' || observation.run_id || ':' || (event.search_doc->>'producerAttempt') || ':') + 1)::bigint))
1079
1130
  ELSE '{}'::jsonb END
1080
1131
  WHERE event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1081
- AND event.run_id = observation.run_id AND event.kind = 'log.appended'
1132
+ AND event.run_id = observation.run_id AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1082
1133
  AND event.source_digest IS NOT NULL AND NOT (event.search_doc ? 'logContentDigest')
1083
1134
  AND (event.search_doc->>'producerAttempt') ~ '^[1-9][0-9]{0,5}$';
1084
1135
  END IF;
@@ -1088,14 +1139,8 @@ export async function attachRuntimeEventSearchTriggers(
1088
1139
  RAISE EXCEPTION 'Search projection event has invalid run identity';
1089
1140
  END IF;
1090
1141
  kind := coalesce(item->>'type', item->>'key');
1091
- IF kind NOT IN (
1092
- 'run.created', 'run.started', 'run.waiting', 'run.resumed',
1093
- 'run.completed', 'run.failed', 'run.cancelled',
1094
- 'step.started', 'step.progress', 'step.completed',
1095
- 'step.failed', 'step.skipped', 'log.appended',
1096
- 'dataset.lifecycle', 'activity.observed', 'work.counters'
1097
- ) THEN
1098
- kind := 'runtime.event';
1142
+ IF kind NOT IN (${RUN_EVENT_KNOWN_KIND_SQL_LIST}) THEN
1143
+ kind := ${RUN_EVENT_SEARCH_FALLBACK_KIND_SQL_LITERAL};
1099
1144
  END IF;
1100
1145
  at_time := CASE WHEN (item->>'occurredAt') ~ '^[0-9]{12,14}$'
1101
1146
  THEN to_timestamp((item->>'occurredAt')::double precision / 1000)
@@ -1115,15 +1160,15 @@ export async function attachRuntimeEventSearchTriggers(
1115
1160
  'operation', CASE WHEN item->'observation'->'target'->>'kind' = 'provider'
1116
1161
  THEN left(item->'observation'->'target'->>'operation', 256) END
1117
1162
  ));
1118
- IF kind = 'log.appended' AND jsonb_typeof(item->'lines') IS DISTINCT FROM 'array' THEN
1163
+ IF kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND jsonb_typeof(item->'lines') IS DISTINCT FROM 'array' THEN
1119
1164
  RAISE EXCEPTION 'Search projection requires log.appended lines';
1120
1165
  END IF;
1121
- IF kind = 'log.appended' AND item ? 'lineContexts'
1166
+ IF kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND item ? 'lineContexts'
1122
1167
  AND (jsonb_typeof(item->'lineContexts') IS DISTINCT FROM 'array'
1123
1168
  OR jsonb_array_length(item->'lineContexts') <> jsonb_array_length(item->'lines')) THEN
1124
1169
  RAISE EXCEPTION 'Search projection requires lineContexts aligned to log lines';
1125
1170
  END IF;
1126
- IF kind = 'log.appended' THEN
1171
+ IF kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} THEN
1127
1172
  FOR line, line_ordinal IN SELECT value, ordinality FROM jsonb_array_elements(item->'lines') WITH ORDINALITY LOOP
1128
1173
  IF jsonb_typeof(line) IS DISTINCT FROM 'string' THEN
1129
1174
  RAISE EXCEPTION 'Search projection requires log line strings';
@@ -1137,7 +1182,7 @@ export async function attachRuntimeEventSearchTriggers(
1137
1182
  SELECT coalesce(event.log_text_digest, encode(sha256(convert_to(btrim(event.log_body), 'UTF8')), 'hex')) AS dedupe_key
1138
1183
  FROM runtime_observability.events AS event
1139
1184
  WHERE event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1140
- AND event.run_id = observation.run_id AND event.kind = 'log.appended'
1185
+ AND event.run_id = observation.run_id AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1141
1186
  AND event.log_seq IS NOT NULL AND (event.log_text_digest IS NOT NULL OR event.log_body IS NOT NULL)
1142
1187
  AND (item->>'producerAttempt' IS NULL
1143
1188
  OR event.search_doc->>'producerAttempt' = item->>'producerAttempt')
@@ -1237,7 +1282,7 @@ export async function attachRuntimeEventSearchTriggers(
1237
1282
  INTO matched_event_id, existing_digest, matched_doc
1238
1283
  FROM runtime_observability.events AS event
1239
1284
  WHERE event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1240
- AND event.run_id = observation.run_id AND event.kind = 'log.appended'
1285
+ AND event.run_id = observation.run_id AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1241
1286
  AND event.event_id = ANY(position_event_ids)
1242
1287
  AND (
1243
1288
  event.search_doc->'logPositions'->>log_channel = log_position::text
@@ -1262,7 +1307,7 @@ export async function attachRuntimeEventSearchTriggers(
1262
1307
  INTO matched_event_id, existing_digest, matched_doc
1263
1308
  FROM runtime_observability.events AS event
1264
1309
  WHERE event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1265
- AND event.run_id = observation.run_id AND event.kind = 'log.appended'
1310
+ AND event.run_id = observation.run_id AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1266
1311
  AND event.search_doc ? 'producerAttempt'
1267
1312
  AND event.search_doc ? 'logPositions'
1268
1313
  AND (${RUNTIME_EVENT_LOG_POSITION_EXPRESSION.replaceAll('search_doc', 'event.search_doc')}) @> position_alias
@@ -1283,7 +1328,7 @@ export async function attachRuntimeEventSearchTriggers(
1283
1328
  INTO matched_event_id, matched_doc
1284
1329
  FROM runtime_observability.events AS event
1285
1330
  WHERE event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1286
- AND event.run_id = observation.run_id AND event.kind = 'log.appended'
1331
+ AND event.run_id = observation.run_id AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1287
1332
  AND event.source_digest IS NOT NULL
1288
1333
  AND event.search_doc ? 'producerAttempt'
1289
1334
  AND event.search_doc ? 'logContentDigest'
@@ -1306,7 +1351,7 @@ export async function attachRuntimeEventSearchTriggers(
1306
1351
  -- Serialize with terminal acceptance on the log mutex. A late
1307
1352
  -- retry of an accepted position is harmless; a new position
1308
1353
  -- after terminal closure must never recreate expired history.
1309
- IF compact_logs AND observation.event_type = 'run.events'
1354
+ IF compact_logs AND observation.event_type = ${RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL.runEvents}
1310
1355
  AND run_status IN ('completed', 'failed', 'cancelled')
1311
1356
  AND NOT EXISTS (SELECT 1 FROM runtime_observability.events
1312
1357
  WHERE runtime_scope = ${quoteLiteral(scope)} AND org_id = run_org
@@ -1322,13 +1367,13 @@ export async function attachRuntimeEventSearchTriggers(
1322
1367
  CASE WHEN canonical_events THEN nextval('runtime_observability.runtime_event_order_seq') END,
1323
1368
  CASE WHEN canonical_events THEN jsonb_strip_nulls(
1324
1369
  (item - 'lines' - 'lineContexts') || jsonb_build_object(
1325
- 'type', 'log.appended', 'runId', observation.run_id,
1370
+ 'type', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, 'runId', observation.run_id,
1326
1371
  'occurredAt', floor(extract(epoch FROM at_time) * 1000)::bigint,
1327
1372
  'lineOrdinal', line_ordinal,
1328
1373
  'context', line_context
1329
1374
  )) END,
1330
1375
  at_time, observation.run_id, play,
1331
- 'log.appended', NULL, CASE WHEN compact_logs THEN NULL ELSE left(line #>> '{}', 2048) END,
1376
+ ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, NULL, CASE WHEN compact_logs THEN NULL ELSE left(line #>> '{}', 2048) END,
1332
1377
  line #>> '{}', digest,
1333
1378
  encode(sha256(convert_to(btrim(line #>> '{}'), 'UTF8')), 'hex'), line_doc
1334
1379
  ) ON CONFLICT DO NOTHING;
@@ -1346,7 +1391,7 @@ export async function attachRuntimeEventSearchTriggers(
1346
1391
  ELSE
1347
1392
  -- Final progress may arrive in the first terminal receipt and
1348
1393
  -- again in completion. One attempt/ordinal owns one immutable fact.
1349
- terminal_progress_identity := observation.event_type IN ('runner.logs', 'run.completed', 'run.failed')
1394
+ terminal_progress_identity := observation.event_type IN (${RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST})
1350
1395
  AND coalesce((observation.payload_json->>'producerAttempt') ~ '^[1-9][0-9]{0,5}$', false);
1351
1396
  eid := CASE WHEN terminal_progress_identity
1352
1397
  THEN 'terminal-progress:' || observation.run_id || ':' ||
@@ -1374,10 +1419,11 @@ export async function attachRuntimeEventSearchTriggers(
1374
1419
  END IF;
1375
1420
  END LOOP;
1376
1421
  END IF;
1377
- IF observation.event_type IN (
1378
- 'run.created', 'run.started', 'run.waiting', 'run.resumed',
1379
- 'run.completed', 'run.failed', 'run.cancelled'
1380
- ) AND NOT (observation.event_type IN ('run.waiting', 'run.resumed')
1422
+ IF observation.event_type IN (${RUN_EVENT_LIFECYCLE_KIND_SQL_LIST})
1423
+ AND NOT (observation.event_type IN (
1424
+ ${RUN_EVENT_KIND_SQL_LITERAL.runWaiting},
1425
+ ${RUN_EVENT_KIND_SQL_LITERAL.runResumed}
1426
+ )
1381
1427
  AND observation.payload_json->>'kind' = 'detached_runner') THEN
1382
1428
  INSERT INTO runtime_observability.events (
1383
1429
  runtime_scope, org_id, event_id, event_seq, event_payload,
@@ -1399,7 +1445,7 @@ export async function attachRuntimeEventSearchTriggers(
1399
1445
  observation.run_id, play, observation.event_type, jsonb_build_object('kind', observation.event_type, 'source', 'system')
1400
1446
  ) ON CONFLICT DO NOTHING;
1401
1447
  END IF;
1402
- IF observation.event_type IN ('run.completed', 'run.failed', 'runner.logs') THEN
1448
+ IF observation.event_type IN (${RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST}) THEN
1403
1449
  -- Detached runners deliver their retained ctx.log tail in the terminal
1404
1450
  -- outbox fact rather than a run.events batch. Project it from that
1405
1451
  -- authoritative write so search and the existing log stream agree.
@@ -1407,7 +1453,7 @@ export async function attachRuntimeEventSearchTriggers(
1407
1453
  AND NOT (observation.payload_json ? 'terminalLogLines') THEN
1408
1454
  RAISE EXCEPTION 'Search projection requires terminalLogLines for terminalLogContexts';
1409
1455
  END IF;
1410
- IF observation.event_type IN ('run.completed', 'run.failed', 'runner.logs')
1456
+ IF observation.event_type IN (${RUN_EVENT_TERMINAL_LOG_CARRIER_SQL_LIST})
1411
1457
  AND observation.payload_json ? 'terminalLogLines'
1412
1458
  AND NOT coalesce((envelope_attempt #>> '{}') ~ '^[1-9][0-9]{0,5}$', false) THEN
1413
1459
  IF jsonb_typeof(observation.payload_json->'terminalLogLines') IS DISTINCT FROM 'array' THEN
@@ -1436,7 +1482,7 @@ export async function attachRuntimeEventSearchTriggers(
1436
1482
  FROM runtime_observability.events AS event
1437
1483
  WHERE event.runtime_scope = ${quoteLiteral(scope)}
1438
1484
  AND event.org_id = run_org AND event.run_id = observation.run_id
1439
- AND event.kind = 'log.appended'
1485
+ AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1440
1486
  AND (observation.payload_json->>'producerAttempt' IS NULL
1441
1487
  OR event.search_doc->>'producerAttempt' = observation.payload_json->>'producerAttempt')
1442
1488
  AND event.log_seq IS NOT NULL AND (event.log_text_digest IS NOT NULL OR event.log_body IS NOT NULL)
@@ -1448,7 +1494,7 @@ export async function attachRuntimeEventSearchTriggers(
1448
1494
  FROM runtime_observability.events AS event
1449
1495
  WHERE event.runtime_scope = ${quoteLiteral(scope)}
1450
1496
  AND event.org_id = run_org AND event.run_id = observation.run_id
1451
- AND event.kind = 'log.appended' AND (event.log_text_digest IS NOT NULL OR event.log_body IS NOT NULL)
1497
+ AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND (event.log_text_digest IS NOT NULL OR event.log_body IS NOT NULL)
1452
1498
  AND event.event_id = ANY(fresh_event_ids)
1453
1499
  AND (observation.payload_json->>'producerAttempt' IS NULL
1454
1500
  OR event.search_doc->>'producerAttempt' = observation.payload_json->>'producerAttempt')
@@ -1499,7 +1545,7 @@ export async function attachRuntimeEventSearchTriggers(
1499
1545
  END IF;
1500
1546
  END IF;
1501
1547
  line_doc := jsonb_strip_nulls(jsonb_build_object(
1502
- 'kind', 'log.appended', 'source', 'terminal',
1548
+ 'kind', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, 'source', 'terminal',
1503
1549
  'producerAttempt', observation.payload_json->'producerAttempt'
1504
1550
  ));
1505
1551
  IF line_context IS NOT NULL THEN
@@ -1513,12 +1559,12 @@ export async function attachRuntimeEventSearchTriggers(
1513
1559
  ${quoteLiteral(scope)}, run_org, observation.event_id || ':log:' || line_ordinal,
1514
1560
  CASE WHEN canonical_events THEN nextval('runtime_observability.runtime_event_order_seq') END,
1515
1561
  CASE WHEN canonical_events THEN jsonb_strip_nulls(jsonb_build_object(
1516
- 'type', 'log.appended', 'runId', observation.run_id,
1562
+ 'type', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, 'runId', observation.run_id,
1517
1563
  'occurredAt', floor(extract(epoch FROM observation.created_at) * 1000)::bigint,
1518
1564
  'source', 'terminal', 'producerAttempt', observation.payload_json->'producerAttempt',
1519
1565
  'lineOrdinal', line_ordinal, 'context', line_context
1520
1566
  )) END,
1521
- observation.created_at, observation.run_id, play, 'log.appended', NULL,
1567
+ observation.created_at, observation.run_id, play, ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, NULL,
1522
1568
  CASE WHEN compact_logs THEN NULL ELSE left(regexp_replace(line #>> '{}',
1523
1569
  '^' || chr(1) || 'prov:[^' || chr(1) || ']*' || chr(1), ''), 2048) END,
1524
1570
  line #>> '{}',
@@ -1562,7 +1608,7 @@ export async function attachRuntimeEventSearchTriggers(
1562
1608
  LANGUAGE sql IMMUTABLE SET search_path = pg_catalog AS $function$
1563
1609
  SELECT coalesce(jsonb_agg(item.value ORDER BY item.ordinality), '[]'::jsonb)
1564
1610
  FROM jsonb_array_elements(batch) WITH ORDINALITY AS item(value, ordinality)
1565
- WHERE coalesce(item.value->>'type', item.value->>'key') IS DISTINCT FROM 'log.appended'
1611
+ WHERE coalesce(item.value->>'type', item.value->>'key') IS DISTINCT FROM ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1566
1612
  $function$
1567
1613
  `);
1568
1614
  await client.query(`
@@ -1572,61 +1618,59 @@ export async function attachRuntimeEventSearchTriggers(
1572
1618
  SELECT coalesce(value->>'type', value->>'key') AS kind
1573
1619
  )
1574
1620
  SELECT CASE
1575
- WHEN event.kind IN ('rollup.membership.added', 'rollup.membership.removed')
1621
+ WHEN event.kind IN (
1622
+ ${RUN_EVENT_CONVEX_INTERNAL_KIND_SQL_LITERAL.rollupMembershipAdded},
1623
+ ${RUN_EVENT_CONVEX_INTERNAL_KIND_SQL_LITERAL.rollupMembershipRemoved}
1624
+ )
1576
1625
  AND value->>'opaque' = 'true' THEN jsonb_strip_nulls(jsonb_build_object(
1577
1626
  'type', event.kind, 'runId', value->'runId',
1578
1627
  'occurredAt', value->'occurredAt', 'source', value->'source',
1579
1628
  'opaque', true, 'payload', value->'payload'))
1580
- WHEN event.kind IN (
1581
- 'run.created', 'run.started', 'run.waiting', 'run.resumed',
1582
- 'run.completed', 'run.failed', 'run.cancelled',
1583
- 'step.started', 'step.progress', 'step.completed',
1584
- 'step.failed', 'step.skipped', 'dataset.lifecycle',
1585
- 'activity.observed', 'work.counters'
1586
- ) THEN jsonb_strip_nulls(jsonb_build_object(
1629
+ WHEN event.kind IN (${RUN_EVENT_SNAPSHOT_KIND_SQL_LIST})
1630
+ THEN jsonb_strip_nulls(jsonb_build_object(
1587
1631
  'type', event.kind, 'runId', value->'runId',
1588
1632
  'occurredAt', value->'occurredAt', 'source', value->'source'
1589
1633
  ) || CASE event.kind
1590
- WHEN 'run.created' THEN jsonb_build_object(
1634
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runCreated} THEN jsonb_build_object(
1591
1635
  'playName', value->'playName', 'status', value->'status',
1592
1636
  'runtimeBackend', value->'runtimeBackend')
1593
- WHEN 'run.started' THEN jsonb_build_object(
1637
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runStarted} THEN jsonb_build_object(
1594
1638
  'playName', value->'playName', 'runtimeBackend', value->'runtimeBackend')
1595
- WHEN 'run.waiting' THEN jsonb_build_object(
1639
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runWaiting} THEN jsonb_build_object(
1596
1640
  'waitKind', value->'waitKind', 'waitUntil', value->'waitUntil')
1597
- WHEN 'run.completed' THEN jsonb_build_object(
1641
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runCompleted} THEN jsonb_build_object(
1598
1642
  'result', value->'result', 'resultSummary', value->'resultSummary',
1599
1643
  'terminalWorkCounterSegment', value->'terminalWorkCounterSegment')
1600
- WHEN 'run.failed' THEN jsonb_build_object(
1644
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runFailed} THEN jsonb_build_object(
1601
1645
  'error', value->'error', 'result', value->'result',
1602
1646
  'resultSummary', value->'resultSummary',
1603
1647
  'terminalWorkCounterSegment', value->'terminalWorkCounterSegment')
1604
- WHEN 'run.cancelled' THEN jsonb_build_object(
1648
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runCancelled} THEN jsonb_build_object(
1605
1649
  'error', value->'error', 'result', value->'result')
1606
- WHEN 'step.started' THEN jsonb_build_object(
1650
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.stepStarted} THEN jsonb_build_object(
1607
1651
  'stepId', value->'stepId', 'label', value->'label',
1608
1652
  'kind', value->'kind', 'artifactTableNamespace', value->'artifactTableNamespace')
1609
- WHEN 'step.progress' THEN jsonb_build_object(
1653
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.stepProgress} THEN jsonb_build_object(
1610
1654
  'stepId', value->'stepId', 'label', value->'label',
1611
1655
  'kind', value->'kind', 'status', value->'status', 'progress', value->'progress')
1612
- WHEN 'step.completed' THEN jsonb_build_object(
1656
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.stepCompleted} THEN jsonb_build_object(
1613
1657
  'stepId', value->'stepId', 'label', value->'label',
1614
1658
  'kind', value->'kind', 'artifactTableNamespace', value->'artifactTableNamespace')
1615
- WHEN 'step.failed' THEN jsonb_build_object(
1659
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.stepFailed} THEN jsonb_build_object(
1616
1660
  'stepId', value->'stepId', 'label', value->'label', 'kind', value->'kind',
1617
1661
  'error', value->'error', 'artifactTableNamespace', value->'artifactTableNamespace')
1618
- WHEN 'step.skipped' THEN jsonb_build_object(
1662
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.stepSkipped} THEN jsonb_build_object(
1619
1663
  'stepId', value->'stepId', 'label', value->'label',
1620
1664
  'kind', value->'kind', 'artifactTableNamespace', value->'artifactTableNamespace')
1621
- WHEN 'dataset.lifecycle' THEN jsonb_build_object(
1665
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.datasetLifecycle} THEN jsonb_build_object(
1622
1666
  'datasetId', value->'datasetId', 'path', value->'path',
1623
1667
  'tableNamespace', value->'tableNamespace', 'phase', value->'phase',
1624
1668
  'persistedRows', value->'persistedRows', 'succeededRows', value->'succeededRows',
1625
1669
  'failedRows', value->'failedRows', 'complete', value->'complete',
1626
1670
  'bornFrom', value->'bornFrom')
1627
- WHEN 'activity.observed' THEN jsonb_build_object(
1671
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.activityObserved} THEN jsonb_build_object(
1628
1672
  'observation', value->'observation')
1629
- WHEN 'work.counters' THEN jsonb_build_object(
1673
+ WHEN ${RUN_EVENT_KIND_SQL_LITERAL.workCounters} THEN jsonb_build_object(
1630
1674
  'attempt', value->'attempt', 'invocationSeq', value->'invocationSeq',
1631
1675
  'segmentId', value->'segmentId', 'logicalCalls', value->'logicalCalls',
1632
1676
  'providerRequests', value->'providerRequests', 'provider429s', value->'provider429s',
@@ -1689,7 +1733,7 @@ export async function attachRuntimeEventSearchTriggers(
1689
1733
  FROM ${schema}.runs WHERE run_id = NEW.run_id;
1690
1734
  IF compact_logs OR canonical_events THEN
1691
1735
  NEW.payload_json := NEW.payload_json - 'terminalLogLines' - 'terminalLogContexts';
1692
- IF NEW.event_type = 'run.events' THEN
1736
+ IF NEW.event_type = ${RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL.runEvents} THEN
1693
1737
  NEW.payload_json := jsonb_set(NEW.payload_json, '{events}',
1694
1738
  ${schema}.without_log_events(NEW.payload_json->'events'))
1695
1739
  || jsonb_build_object('logBodyStore', 'planet_scale');
@@ -1698,17 +1742,17 @@ export async function attachRuntimeEventSearchTriggers(
1698
1742
  NEW.payload_json := jsonb_set(NEW.payload_json, '{terminalProgressEvents}',
1699
1743
  ${schema}.without_log_events(NEW.payload_json->'terminalProgressEvents'));
1700
1744
  END IF;
1701
- IF NEW.event_type = 'run.failed' AND NEW.payload_json ? 'result' THEN
1745
+ IF NEW.event_type = ${RUN_EVENT_KIND_SQL_LITERAL.runFailed} AND NEW.payload_json ? 'result' THEN
1702
1746
  NEW.payload_json := jsonb_set(NEW.payload_json, '{result}',
1703
1747
  ${schema}.compact_runner_log_envelope(NEW.payload_json->'result'));
1704
1748
  END IF;
1705
- IF NEW.event_type = 'run.completed' AND NEW.payload_json ? 'output' THEN
1749
+ IF NEW.event_type = ${RUN_EVENT_KIND_SQL_LITERAL.runCompleted} AND NEW.payload_json ? 'output' THEN
1706
1750
  NEW.payload_json := jsonb_set(NEW.payload_json, '{output}',
1707
1751
  ${schema}.without_runtime_log_tail(NEW.payload_json->'output'));
1708
1752
  END IF;
1709
1753
  END IF;
1710
1754
  IF canonical_events THEN
1711
- IF NEW.event_type = 'run.events' THEN
1755
+ IF NEW.event_type = ${RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL.runEvents} THEN
1712
1756
  NEW.payload_json := jsonb_set(NEW.payload_json, '{events}',
1713
1757
  ${schema}.convex_projection_events(NEW.payload_json->'events'));
1714
1758
  END IF;
@@ -1737,12 +1781,12 @@ export async function attachRuntimeEventSearchTriggers(
1737
1781
  sha256(convert_to(NEW.runner_result_json::text, 'UTF8')), 'hex');
1738
1782
  observation.event_id := 'runner-terminal-logs:' || NEW.run_id || ':' || NEW.attempt;
1739
1783
  observation.run_id := NEW.run_id;
1740
- observation.event_type := 'runner.logs';
1784
+ observation.event_type := ${RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL.runnerLogs};
1741
1785
  observation.created_at := coalesce(NEW.runner_terminal_received_at, clock_timestamp());
1742
1786
  observation.payload_json := jsonb_set(NEW.runner_log_payload_json,
1743
1787
  '{terminalProgressEvents}', (
1744
1788
  SELECT coalesce(jsonb_agg(
1745
- CASE WHEN event->>'type' = 'log.appended' THEN event
1789
+ CASE WHEN event->>'type' = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} THEN event
1746
1790
  ELSE event || jsonb_build_object('_runtimeProgressOrdinal', position) END
1747
1791
  ORDER BY position), '[]'::jsonb)
1748
1792
  FROM jsonb_array_elements(CASE
@@ -1894,12 +1938,12 @@ export async function hasRuntimeEventSearchShape(
1894
1938
  return result.rows[0]?.ready === true;
1895
1939
  }
1896
1940
 
1897
- const RUNTIME_EVENT_BODY_RETENTION_PREDICATE = `kind <> 'log.appended' OR log_body IS NOT NULL
1941
+ const RUNTIME_EVENT_BODY_RETENTION_PREDICATE = `kind <> ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} OR log_body IS NOT NULL
1898
1942
  OR message IS NOT NULL OR search_doc ? 'context'`;
1899
- const RUNTIME_EVENT_CANONICAL_RETENTION_PREDICATE = `(kind <> 'log.appended' AND event_payload IS NULL)
1943
+ const RUNTIME_EVENT_CANONICAL_RETENTION_PREDICATE = `(kind <> ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND event_payload IS NULL)
1900
1944
  OR (substr(kind, 1, 8) = 'receipt.' AND event_payload IS NOT NULL
1901
1945
  AND (receipt_ref IS NOT NULL OR receipt_key IS NOT NULL))
1902
- OR (kind = 'log.appended' AND (log_body IS NOT NULL OR message IS NOT NULL OR search_doc ? 'context'))`;
1946
+ OR (kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended} AND (log_body IS NOT NULL OR message IS NOT NULL OR search_doc ? 'context'))`;
1903
1947
 
1904
1948
  // pg_get_expr adds grouping and text casts. Preserve quoted literals exactly;
1905
1949
  // this known OR-only predicate rejects other operators, keys and literal values.
@@ -2230,11 +2274,11 @@ export async function pruneRuntimeEvents(
2230
2274
  event_payload = CASE WHEN event.event_payload IS NULL THEN NULL
2231
2275
  ELSE event.event_payload - 'context' END,
2232
2276
  search_doc = jsonb_strip_nulls(jsonb_build_object(
2233
- 'kind', 'log.appended', 'source', event.search_doc->'source',
2277
+ 'kind', ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}, 'source', event.search_doc->'source',
2234
2278
  'producerAttempt', event.search_doc->'producerAttempt',
2235
2279
  'logPositions', event.search_doc->'logPositions',
2236
2280
  'logContentDigest', event.search_doc->'logContentDigest'))
2237
- FROM candidates WHERE event.ctid = candidates.ctid AND event.kind = 'log.appended'
2281
+ FROM candidates WHERE event.ctid = candidates.ctid AND event.kind = ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
2238
2282
  RETURNING event.event_id
2239
2283
  ), scrubbed_receipts AS (
2240
2284
  UPDATE runtime_observability.events AS event
@@ -2247,7 +2291,7 @@ export async function pruneRuntimeEvents(
2247
2291
  RETURNING event.event_id
2248
2292
  ), deleted AS (
2249
2293
  DELETE FROM runtime_observability.events AS event USING candidates
2250
- WHERE event.ctid = candidates.ctid AND event.kind <> 'log.appended'
2294
+ WHERE event.ctid = candidates.ctid AND event.kind <> ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
2251
2295
  AND event.event_payload IS NULL
2252
2296
  RETURNING event.event_id
2253
2297
  )
@@ -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;