@exaudeus/workrail 3.60.0 → 3.61.0

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.
@@ -398,8 +398,8 @@
398
398
  "bytes": 1357
399
399
  },
400
400
  "cli/commands/worktrain-trigger-test.js": {
401
- "sha256": "d2153a2110e70cc169596c2357410dd947c4bb69bf6167b64f4bf5b16bd5b8ca",
402
- "bytes": 6413
401
+ "sha256": "5c3cf63b69d38add1f2540e65457a191b94c52200380d961c4b67906b0075010",
402
+ "bytes": 6051
403
403
  },
404
404
  "cli/commands/worktrain-trigger-validate.d.ts": {
405
405
  "sha256": "554458ee418cb8aa36c7296134d814f8b5bdf927b209ebbf2741b7b6c24c6bec",
@@ -473,16 +473,16 @@
473
473
  "sha256": "5fe866e54f796975dec5d8ba9983aefd86074db212d3fccd64eed04bc9f0b3da",
474
474
  "bytes": 8011
475
475
  },
476
- "console-ui/assets/index-CTuJ3ops.js": {
477
- "sha256": "817f2780ceaaf70d69e7bfcec88b584f6b1b12686c53ab359549a1e07c1c22e9",
478
- "bytes": 760529
479
- },
480
476
  "console-ui/assets/index-DGj8EsFR.css": {
481
477
  "sha256": "3bdb55ec0957928e0ebbb86a7d6b36d28f7ba7d5c0f3e236fd8f2e2aacee2fa4",
482
478
  "bytes": 60631
483
479
  },
480
+ "console-ui/assets/index-DZpicVbF.js": {
481
+ "sha256": "63e1eb6134d4bf95c279e646796f6fac09d3d206f72c5e07bcc944fcaf3a108c",
482
+ "bytes": 760528
483
+ },
484
484
  "console-ui/index.html": {
485
- "sha256": "ea4c4b3842acd923a45b3cd7aae08a4be1709a9d9da07808c34c9b849e2017dc",
485
+ "sha256": "ebdc97ab0d0b277f907b8e840e3e4036949de791bd202d5032788d38177c0c8e",
486
486
  "bytes": 417
487
487
  },
488
488
  "console/standalone-console.d.ts": {
@@ -1038,8 +1038,8 @@
1038
1038
  "bytes": 10270
1039
1039
  },
1040
1040
  "mcp/handlers/v2-advance-core/event-builders.d.ts": {
1041
- "sha256": "64502bdfc33901fdb9f9d0d676c9762497bc03f17f0f9a68959a460b270b13b2",
1042
- "bytes": 2641
1041
+ "sha256": "0544f528024d18de52fcd69151b88e7c6c39895d46278ed71723c40deb848293",
1042
+ "bytes": 2657
1043
1043
  },
1044
1044
  "mcp/handlers/v2-advance-core/event-builders.js": {
1045
1045
  "sha256": "82d1c47597c116c209638e62bb74713b4cf2d03be5199effa67bacba1963a3ee",
@@ -1078,8 +1078,8 @@
1078
1078
  "bytes": 7752
1079
1079
  },
1080
1080
  "mcp/handlers/v2-advance-events.d.ts": {
1081
- "sha256": "02cdb52a2c16dd619645b5496caf0880e57937bf21ea9efe44e6cd195cd43b94",
1082
- "bytes": 2769
1081
+ "sha256": "cb85286671ef70c888ff0784280542ea009a13f8ebe5e01e84603d6b8b8587ce",
1082
+ "bytes": 2785
1083
1083
  },
1084
1084
  "mcp/handlers/v2-advance-events.js": {
1085
1085
  "sha256": "c23df725685ee2062f44e05512ee4463c9b29ed4d67a4e72846496d59920733c",
@@ -1090,8 +1090,8 @@
1090
1090
  "bytes": 1480
1091
1091
  },
1092
1092
  "mcp/handlers/v2-checkpoint.js": {
1093
- "sha256": "90e800d30e0e0ec47f33485aff12a39bd831a5fe61afa551e3a662e097dd1642",
1094
- "bytes": 10726
1093
+ "sha256": "d5c80dc14627c706247b1e63c2307c68e1ed55f7b98c98875dfe7b81b5f8cf53",
1094
+ "bytes": 10800
1095
1095
  },
1096
1096
  "mcp/handlers/v2-context-budget.d.ts": {
1097
1097
  "sha256": "cbad1741a183d52c9cbe558be2e09f776843d1f3ec8cd28d6d0d230668e4298c",
@@ -1170,8 +1170,8 @@
1170
1170
  "bytes": 3558
1171
1171
  },
1172
1172
  "mcp/handlers/v2-execution/start.js": {
1173
- "sha256": "d2ffbf775d5ea6ce68174d428129fad1377033e09fcdeb69c24c9d8fb04885b4",
1174
- "bytes": 21354
1173
+ "sha256": "be45c65e839a4dc6ab41fe3562fa16059e3719d82ea38007edeb570b642987d0",
1174
+ "bytes": 21576
1175
1175
  },
1176
1176
  "mcp/handlers/v2-execution/workflow-object-cache.d.ts": {
1177
1177
  "sha256": "7e58a2a020fd8443821dbe4e6a2702a9882c517f032a340c1b393cdebf4af907",
@@ -1666,8 +1666,8 @@
1666
1666
  "bytes": 1759
1667
1667
  },
1668
1668
  "trigger/delivery-action.js": {
1669
- "sha256": "533ce91bfc12cd170dcda7840d369a37f50298c23eaccd515ee4ef11f5aad58e",
1670
- "bytes": 15291
1669
+ "sha256": "44790087b051ed8a4f3e5cdd3bed5d3026260a12d99b57b5740d99fe68efb2ec",
1670
+ "bytes": 14646
1671
1671
  },
1672
1672
  "trigger/delivery-client.d.ts": {
1673
1673
  "sha256": "0cb2be24b854cb31e3d2fe7eeaba6032de7a9b2a5290c8bc886df94faf5306f7",
@@ -1710,12 +1710,12 @@
1710
1710
  "bytes": 6968
1711
1711
  },
1712
1712
  "trigger/polling-scheduler.d.ts": {
1713
- "sha256": "3c0865f9d21819c364575062745741405bc80006f4a0754d26ed4302253371c6",
1714
- "bytes": 1126
1713
+ "sha256": "60df456a31fa87ce71de76f5e31a6c460bfab588a24c8a2f06bf926fdcea550a",
1714
+ "bytes": 1096
1715
1715
  },
1716
1716
  "trigger/polling-scheduler.js": {
1717
- "sha256": "a6982510749763ff344c09560a58ab413ee05f9c10069c28372b9fb100011807",
1718
- "bytes": 24224
1717
+ "sha256": "a546506d1586b0020a64f1321c07d929f7b24920a0fbd18d6566ff73fb6d9185",
1718
+ "bytes": 22409
1719
1719
  },
1720
1720
  "trigger/trigger-listener.d.ts": {
1721
1721
  "sha256": "1eebb3d4829030b264c3798b0b0d55d7357d313ab83e3f344ad455eaafcedb44",
@@ -1894,12 +1894,12 @@
1894
1894
  "bytes": 3841
1895
1895
  },
1896
1896
  "v2/durable-core/domain/ack-advance-append-plan.d.ts": {
1897
- "sha256": "2e802606656a0c1938192e5533aa46c74bc42789b5c315c79f6de4850017b30e",
1898
- "bytes": 1533
1897
+ "sha256": "2b4a8ad0e1d9e9066f100f958e572f19af590ab70946c2396d2d5568875bdf00",
1898
+ "bytes": 1549
1899
1899
  },
1900
1900
  "v2/durable-core/domain/ack-advance-append-plan.js": {
1901
- "sha256": "ae08bded7edd323b817711946dd27a9ba51047ef41248ad10e098d69d5c3015d",
1902
- "bytes": 6839
1901
+ "sha256": "437e811d81076599ae4fa76ff38ad457ccb0a04db6e4b762e175b783c2c928f6",
1902
+ "bytes": 7303
1903
1903
  },
1904
1904
  "v2/durable-core/domain/artifact-contract-validator.d.ts": {
1905
1905
  "sha256": "262d667fb49fc68a5a6db9f60d4a50c15b9e45ba9ef5980d5b2036a29582eac8",
@@ -1910,8 +1910,8 @@
1910
1910
  "bytes": 6500
1911
1911
  },
1912
1912
  "v2/durable-core/domain/assessment-consequence-event-builder.d.ts": {
1913
- "sha256": "9f35e91667653fe2228ccf199d1620c233a3291e7e7705931b116b250e94cef3",
1914
- "bytes": 826
1913
+ "sha256": "be91245e615888ae4675c093a9f323500099dbe6d1250ced4726764e1029e9ad",
1914
+ "bytes": 842
1915
1915
  },
1916
1916
  "v2/durable-core/domain/assessment-consequence-event-builder.js": {
1917
1917
  "sha256": "8a635f6c75777e58b0092e9e5394637cc15f64e97d987941f9de28b349c0bafb",
@@ -1926,8 +1926,8 @@
1926
1926
  "bytes": 77
1927
1927
  },
1928
1928
  "v2/durable-core/domain/assessment-recorded-event-builder.d.ts": {
1929
- "sha256": "50371f5c496028c835d2f5b3508914ba1643f14fe2b4d2d78eb29347719a6bc7",
1930
- "bytes": 824
1929
+ "sha256": "c4279c2e7af1b6a9b82d1accb0c5336fd3993eb950d2d6ded4e66ae3bffc57c7",
1930
+ "bytes": 840
1931
1931
  },
1932
1932
  "v2/durable-core/domain/assessment-recorded-event-builder.js": {
1933
1933
  "sha256": "070adad6e9bbb7abb3650c84f8e66535e7e9076783a67b18088bfaf970920072",
@@ -2010,8 +2010,8 @@
2010
2010
  "bytes": 620
2011
2011
  },
2012
2012
  "v2/durable-core/domain/gap-builder.js": {
2013
- "sha256": "2e01a0c1842cd30d02726a4ab46d0a9fcc5b4c5fd30d98334eb6b68bef56b2ef",
2014
- "bytes": 908
2013
+ "sha256": "673bdc1103a5438e55b49df1e2ca4603c87c6fd63e0187142c8b06472b7d1208",
2014
+ "bytes": 941
2015
2015
  },
2016
2016
  "v2/durable-core/domain/loop-control-evaluator.d.ts": {
2017
2017
  "sha256": "fbda4d2cb49d71e066f1b9bc967d5b89f4e2d1c692b865b026cf9e0bad80ad99",
@@ -2118,8 +2118,8 @@
2118
2118
  "bytes": 2550
2119
2119
  },
2120
2120
  "v2/durable-core/domain/validation-event-builder.d.ts": {
2121
- "sha256": "58cf3487f53e3a5e255871d94096133f1baf7f12ab3825cdc1e9789493677134",
2122
- "bytes": 923
2121
+ "sha256": "c18461e0153c8d0bced88322a555f4a12faa54136506caa29733eddecc746b68",
2122
+ "bytes": 939
2123
2123
  },
2124
2124
  "v2/durable-core/domain/validation-event-builder.js": {
2125
2125
  "sha256": "e786f1f1991012032b9e45071679bc47bad21d422027e65701fb93e4035e6c01",
@@ -2334,8 +2334,8 @@
2334
2334
  "bytes": 3397
2335
2335
  },
2336
2336
  "v2/durable-core/schemas/export-bundle/index.d.ts": {
2337
- "sha256": "f1a2f7a927e05c2acda22cb93d494b5e3278bdd8b79eb8102897a005fcc80798",
2338
- "bytes": 535324
2337
+ "sha256": "9432b699d0cdc1db78d37181d8a6f72c669a5c2be7db7a915a44c783b0cb70c5",
2338
+ "bytes": 544060
2339
2339
  },
2340
2340
  "v2/durable-core/schemas/export-bundle/index.js": {
2341
2341
  "sha256": "6e3566b2d05ea6302bbf4d311b8ec3e94725a8523834efe7670a79e7bd7dc40d",
@@ -2390,12 +2390,12 @@
2390
2390
  "bytes": 2138
2391
2391
  },
2392
2392
  "v2/durable-core/schemas/session/events.d.ts": {
2393
- "sha256": "b1465390a6937cea6bf624f9487d8a6c8cdcd39d09c0df3485e445e635edf1f5",
2394
- "bytes": 80635
2393
+ "sha256": "452cb4e020188c0699e5a3bc083a0c66ebdfe5f8506d41fb9f556cd6e3631bb9",
2394
+ "bytes": 82692
2395
2395
  },
2396
2396
  "v2/durable-core/schemas/session/events.js": {
2397
- "sha256": "8af751c61d8c30802ce13174020893c8dfd59fcb4d15a34efc1abe05a2116e0d",
2398
- "bytes": 12950
2397
+ "sha256": "92246ae89fd3af24571c3909cf56a9e27ff1dcc15d7ea774e60fef75d1a03841",
2398
+ "bytes": 13013
2399
2399
  },
2400
2400
  "v2/durable-core/schemas/session/gaps.d.ts": {
2401
2401
  "sha256": "85d17b865a1ebe9deaa0c99d69039c514b217362715c6697b0bc5908cbf9fff0",
@@ -19,7 +19,7 @@ type BuildAppendPlanArgs = {
19
19
  readonly currentNodeId: NodeId;
20
20
  readonly attemptId: AttemptId;
21
21
  readonly workflowHash: WorkflowHash;
22
- readonly extraEventsToAppend: readonly Omit<DomainEventV1, 'eventIndex' | 'sessionId'>[];
22
+ readonly extraEventsToAppend: readonly Omit<DomainEventV1, 'eventIndex' | 'sessionId' | 'timestampMs'>[];
23
23
  readonly sessionStore: import('../../../v2/ports/session-event-log-store.port.js').SessionEventLogAppendStorePortV2;
24
24
  readonly idFactory: AdvanceCorePorts['idFactory'];
25
25
  readonly lock: WithHealthySessionLock;
@@ -9,7 +9,7 @@ import type { ReasonV1 } from '../../v2/durable-core/domain/reason-model.js';
9
9
  import type { DecisionTraceEntry } from '../../v2/durable-core/domain/decision-trace-builder.js';
10
10
  import type { InternalError } from './v2-error-mapping.js';
11
11
  import type { AdvanceCorePorts } from './v2-advance-core.js';
12
- type PartialEvent = Omit<DomainEventV1, 'eventIndex' | 'sessionId'>;
12
+ type PartialEvent = Omit<DomainEventV1, 'eventIndex' | 'sessionId' | 'timestampMs'>;
13
13
  import type { OutputRequirementStatus } from '../../v2/durable-core/domain/blocking-decision.js';
14
14
  export type AdvanceMode = {
15
15
  readonly kind: 'fresh';
@@ -122,6 +122,7 @@ function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeI
122
122
  eventId: nodeCreatedEventId,
123
123
  eventIndex: truth.events.length,
124
124
  sessionId: String(sessionId),
125
+ timestampMs: Date.now(),
125
126
  kind: constants_js_1.EVENT_KIND.NODE_CREATED,
126
127
  dedupeKey: `checkpoint_node:${dedupeKey}`,
127
128
  scope: { runId: String(runId), nodeId: String(checkpointNodeId) },
@@ -137,6 +138,7 @@ function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeI
137
138
  eventId: edgeCreatedEventId,
138
139
  eventIndex: truth.events.length + 1,
139
140
  sessionId: String(sessionId),
141
+ timestampMs: Date.now(),
140
142
  kind: constants_js_1.EVENT_KIND.EDGE_CREATED,
141
143
  dedupeKey,
142
144
  scope: { runId: String(runId) },
@@ -121,6 +121,7 @@ function buildInitialEvents(args) {
121
121
  eventId: evtSessionCreated,
122
122
  eventIndex: 0,
123
123
  sessionId,
124
+ timestampMs: Date.now(),
124
125
  kind: constants_js_1.EVENT_KIND.SESSION_CREATED,
125
126
  dedupeKey: `session_created:${sessionId}`,
126
127
  data: parentSessionId !== undefined ? { parentSessionId } : {},
@@ -130,6 +131,7 @@ function buildInitialEvents(args) {
130
131
  eventId: evtRunStarted,
131
132
  eventIndex: 1,
132
133
  sessionId,
134
+ timestampMs: Date.now(),
133
135
  kind: constants_js_1.EVENT_KIND.RUN_STARTED,
134
136
  dedupeKey: `run_started:${sessionId}:${runId}`,
135
137
  scope: { runId },
@@ -145,6 +147,7 @@ function buildInitialEvents(args) {
145
147
  eventId: evtNodeCreated,
146
148
  eventIndex: 2,
147
149
  sessionId,
150
+ timestampMs: Date.now(),
148
151
  kind: constants_js_1.EVENT_KIND.NODE_CREATED,
149
152
  dedupeKey: `node_created:${sessionId}:${runId}:${nodeId}`,
150
153
  scope: { runId, nodeId },
@@ -160,6 +163,7 @@ function buildInitialEvents(args) {
160
163
  eventId: evtPreferencesChanged,
161
164
  eventIndex: 3,
162
165
  sessionId,
166
+ timestampMs: Date.now(),
163
167
  kind: constants_js_1.EVENT_KIND.PREFERENCES_CHANGED,
164
168
  dedupeKey: `preferences_changed:${sessionId}:${runId}:${nodeId}:${changeId}`,
165
169
  scope: { runId, nodeId },
@@ -186,6 +190,7 @@ function buildInitialEvents(args) {
186
190
  eventId: contextEventId,
187
191
  eventIndex: mutableEvents.length,
188
192
  sessionId,
193
+ timestampMs: Date.now(),
189
194
  kind: constants_js_1.EVENT_KIND.CONTEXT_SET,
190
195
  dedupeKey: `context_set:${sessionId}:${String(runId)}:initial`,
191
196
  scope: { runId: String(runId) },
@@ -203,6 +208,7 @@ function buildInitialEvents(args) {
203
208
  eventId: obsEventId,
204
209
  eventIndex: mutableEvents.length,
205
210
  sessionId,
211
+ timestampMs: Date.now(),
206
212
  kind: constants_js_1.EVENT_KIND.OBSERVATION_RECORDED,
207
213
  dedupeKey: `observation_recorded:${sessionId}:${obs.key}`,
208
214
  data: {
@@ -342,20 +342,6 @@ async function runDelivery(artifact, workspacePath, flags, execFn) {
342
342
  });
343
343
  }
344
344
  const prUrl = prStdout.trim().split('\n').at(-1)?.trim() ?? '';
345
- if (prUrl) {
346
- try {
347
- await execFn('gh', ['label', 'create', 'worktrain:generated', '--description', 'PR authored by WorkTrain', '--color', '0075ca'], { cwd: workspacePath, timeout: DELIVERY_TIMEOUT_MS });
348
- }
349
- catch {
350
- }
351
- try {
352
- await execFn('gh', ['pr', 'edit', prUrl, '--add-label', 'worktrain:generated'], { cwd: workspacePath, timeout: DELIVERY_TIMEOUT_MS });
353
- }
354
- catch (e) {
355
- console.warn(`[runDelivery] WARNING: Failed to add worktrain:generated label to PR ${prUrl}: ` +
356
- `${e instanceof Error ? e.message : String(e)}`);
357
- }
358
- }
359
345
  return { _tag: 'pr_opened', url: prUrl };
360
346
  }
361
347
  function formatExecError(e) {
@@ -29,5 +29,4 @@ export declare class PollingScheduler {
29
29
  private doPollGitHub;
30
30
  private dispatchAndRecord;
31
31
  private doPollGitHubQueue;
32
- private applyGitHubLabel;
33
32
  }
@@ -245,14 +245,6 @@ class PollingScheduler {
245
245
  skipped.push({ issue, reason: `excluded_label: ${excludedLabel}` });
246
246
  continue;
247
247
  }
248
- if (issueLabels.includes('worktrain:in-progress')) {
249
- skipped.push({ issue, reason: 'active_session_or_in_progress' });
250
- continue;
251
- }
252
- if (/sess_[a-z0-9]+/.test(issue.body)) {
253
- skipped.push({ issue, reason: 'active_session_or_in_progress' });
254
- continue;
255
- }
256
248
  if (this.dispatchingIssues.has(issue.number)) {
257
249
  skipped.push({ issue, reason: 'active_session_in_process' });
258
250
  continue;
@@ -326,12 +318,9 @@ class PollingScheduler {
326
318
  const dispatchP = this.router.dispatchAdaptivePipeline(workflowTrigger.goal, workflowTrigger.workspacePath, workflowTrigger.context);
327
319
  const issueNumber = top.issue.number;
328
320
  void dispatchP
329
- .then((outcome) => {
321
+ .then(() => {
330
322
  this.dispatchingIssues.delete(issueNumber);
331
323
  console.log(`[QueuePoll] in-flight-clear #${issueNumber} reason=completed`);
332
- if (outcome.kind === 'escalated' || outcome.kind === 'dry_run') {
333
- void this.applyGitHubLabel(issueNumber, 'worktrain:in-progress', queueConfig.token, source.repo);
334
- }
335
324
  void fs.unlink(sidecarPath).catch(() => { });
336
325
  })
337
326
  .catch(() => {
@@ -349,32 +338,6 @@ class PollingScheduler {
349
338
  console.log(`[QueuePoll] cycle complete selected=1 skipped=${skipped.length + candidates.length - 1} elapsed=${elapsed}ms`);
350
339
  await appendQueuePollLog({ event: 'poll_cycle_complete', selected: 1, skipped: skipped.length + candidates.length - 1, elapsed, ts: new Date().toISOString() });
351
340
  }
352
- async applyGitHubLabel(issueNumber, label, token, repo) {
353
- const fetchFn = this.fetchFn ?? globalThis.fetch;
354
- const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}/labels`;
355
- try {
356
- const response = await fetchFn(url, {
357
- method: 'POST',
358
- headers: {
359
- 'Authorization': `Bearer ${token}`,
360
- 'Accept': 'application/vnd.github+json',
361
- 'Content-Type': 'application/json',
362
- 'X-GitHub-Api-Version': '2022-11-28',
363
- },
364
- body: JSON.stringify({ labels: [label] }),
365
- });
366
- if (!response.ok) {
367
- const text = await response.text().catch(() => '');
368
- console.warn(`[QueuePoll] Failed to apply label '${label}' to issue #${issueNumber}: HTTP ${response.status} ${text.slice(0, 200)}`);
369
- }
370
- else {
371
- console.log(`[QueuePoll] Applied label '${label}' to issue #${issueNumber}`);
372
- }
373
- }
374
- catch (e) {
375
- console.warn(`[QueuePoll] Failed to apply label '${label}' to issue #${issueNumber}: ${e instanceof Error ? e.message : String(e)}`);
376
- }
377
- }
378
341
  }
379
342
  exports.PollingScheduler = PollingScheduler;
380
343
  function buildGitLabWorkflowTrigger(trigger, mr) {
@@ -2,7 +2,7 @@ import type { DomainEventV1 } from '../schemas/session/index.js';
2
2
  import { type OutputToAppend } from './outputs.js';
3
3
  import { type Result } from 'neverthrow';
4
4
  import type { SnapshotRef, WorkflowHash } from '../ids/index.js';
5
- type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId'>;
5
+ type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId' | 'timestampMs'>;
6
6
  export type AckAdvanceAppendPlanArgs = {
7
7
  readonly sessionId: string;
8
8
  readonly runId: string;
@@ -11,6 +11,7 @@ function buildAdvanceRecordedEvent(args) {
11
11
  eventId: args.eventId,
12
12
  eventIndex: args.eventIndex,
13
13
  sessionId: args.sessionId,
14
+ timestampMs: Date.now(),
14
15
  kind: constants_js_1.EVENT_KIND.ADVANCE_RECORDED,
15
16
  dedupeKey: advanceDedupeKey,
16
17
  scope: { runId: args.runId, nodeId: args.fromNodeId },
@@ -27,6 +28,7 @@ function buildNodeCreatedEvent(args) {
27
28
  eventId: args.eventId,
28
29
  eventIndex: args.eventIndex,
29
30
  sessionId: args.sessionId,
31
+ timestampMs: Date.now(),
30
32
  kind: constants_js_1.EVENT_KIND.NODE_CREATED,
31
33
  dedupeKey: `node_created:${args.sessionId}:${args.runId}:${args.toNodeId}`,
32
34
  scope: { runId: args.runId, nodeId: args.toNodeId },
@@ -44,6 +46,7 @@ function buildEdgeCreatedEvent(args) {
44
46
  eventId: args.eventId,
45
47
  eventIndex: args.eventIndex,
46
48
  sessionId: args.sessionId,
49
+ timestampMs: Date.now(),
47
50
  kind: constants_js_1.EVENT_KIND.EDGE_CREATED,
48
51
  dedupeKey: `edge_created:${args.sessionId}:${args.runId}:${args.fromNodeId}->${args.toNodeId}:acked_step`,
49
52
  scope: { runId: args.runId },
@@ -69,6 +72,7 @@ function buildOutputEvents(args) {
69
72
  eventId: args.outputEventIds[idx],
70
73
  eventIndex: args.startEventIndex + idx,
71
74
  sessionId: args.sessionId,
75
+ timestampMs: Date.now(),
72
76
  kind: constants_js_1.EVENT_KIND.NODE_OUTPUT_APPENDED,
73
77
  dedupeKey: `node_output_appended:${args.sessionId}:${o.outputId}`,
74
78
  scope: { runId: args.runId, nodeId: args.fromNodeId },
@@ -95,19 +99,26 @@ function processExtraEvents(extraEventsToAppend, sessionId, startEventIndex) {
95
99
  if ('eventIndex' in raw) {
96
100
  return (0, neverthrow_1.err)({
97
101
  code: 'INVARIANT_VIOLATION',
98
- message: 'extraEventsToAppend must not include eventIndex (assigned by append plan builder)'
102
+ message: 'extraEventsToAppend must not include eventIndex (assigned by append plan builder)',
99
103
  });
100
104
  }
101
105
  if ('sessionId' in raw) {
102
106
  return (0, neverthrow_1.err)({
103
107
  code: 'INVARIANT_VIOLATION',
104
- message: 'extraEventsToAppend must not include sessionId (assigned by append plan builder)'
108
+ message: 'extraEventsToAppend must not include sessionId (assigned by append plan builder)',
109
+ });
110
+ }
111
+ if ('timestampMs' in raw) {
112
+ return (0, neverthrow_1.err)({
113
+ code: 'INVARIANT_VIOLATION',
114
+ message: 'extraEventsToAppend must not include timestampMs (assigned by append plan builder)',
105
115
  });
106
116
  }
107
117
  extra.push({
108
118
  ...extraEventsToAppend[i],
109
119
  sessionId,
110
120
  eventIndex: startEventIndex + i,
121
+ timestampMs: Date.now(),
111
122
  });
112
123
  }
113
124
  }
@@ -1,6 +1,6 @@
1
1
  import { type Result } from 'neverthrow';
2
2
  import type { DomainEventV1 } from '../schemas/session/index.js';
3
- type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId'>;
3
+ type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId' | 'timestampMs'>;
4
4
  export type AssessmentConsequenceEventError = {
5
5
  readonly code: 'ASSESSMENT_CONSEQUENCE_EVENT_INVARIANT_VIOLATION';
6
6
  readonly message: string;
@@ -1,7 +1,7 @@
1
1
  import { type Result } from 'neverthrow';
2
2
  import type { DomainEventV1 } from '../schemas/session/index.js';
3
3
  import type { RecordedAssessmentV1 } from './assessment-record.js';
4
- type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId'>;
4
+ type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId' | 'timestampMs'>;
5
5
  export type AssessmentRecordedEventError = {
6
6
  readonly code: 'ASSESSMENT_EVENT_INVARIANT_VIOLATION';
7
7
  readonly message: string;
@@ -10,6 +10,7 @@ function buildGapRecordedEventV1(args) {
10
10
  eventId: args.eventId,
11
11
  eventIndex: args.eventIndex,
12
12
  sessionId: args.sessionId,
13
+ timestampMs: Date.now(),
13
14
  kind: constants_js_1.EVENT_KIND.GAP_RECORDED,
14
15
  dedupeKey: `gap_recorded:${args.sessionId}:${args.gapId}`,
15
16
  scope: { runId: args.runId, nodeId: args.nodeId },
@@ -1,7 +1,7 @@
1
1
  import { type Result } from 'neverthrow';
2
2
  import type { ValidationResult } from '../../../types/validation.js';
3
3
  import type { DomainEventV1 } from '../schemas/session/index.js';
4
- type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId'>;
4
+ type EventToAppendV1 = Omit<DomainEventV1, 'eventIndex' | 'sessionId' | 'timestampMs'>;
5
5
  export type ValidationEventError = {
6
6
  readonly code: 'VALIDATION_EVENT_INVARIANT_VIOLATION';
7
7
  readonly message: string;