github-issue-tower-defence-management 1.122.3 → 1.122.5

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 (84) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +8 -4
  3. package/bin/adapter/entry-points/console/consoleDoneStore.js +19 -5
  4. package/bin/adapter/entry-points/console/consoleDoneStore.js.map +1 -1
  5. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +14 -2
  6. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
  7. package/bin/adapter/entry-points/handlers/consoleListsWriter.js +2 -0
  8. package/bin/adapter/entry-points/handlers/consoleListsWriter.js.map +1 -1
  9. package/bin/adapter/entry-points/handlers/notifySilentTmuxSessions.js +4 -2
  10. package/bin/adapter/entry-points/handlers/notifySilentTmuxSessions.js.map +1 -1
  11. package/bin/adapter/repositories/ConfigurableSilentSessionMessageComposer.js +12 -7
  12. package/bin/adapter/repositories/ConfigurableSilentSessionMessageComposer.js.map +1 -1
  13. package/bin/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.js +60 -11
  14. package/bin/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.js.map +1 -1
  15. package/bin/adapter/repositories/NoUnansweredOwnerCallStatusProvider.js +2 -2
  16. package/bin/adapter/repositories/NoUnansweredOwnerCallStatusProvider.js.map +1 -1
  17. package/bin/adapter/repositories/ProcessListSessionSubAgentActivityRepository.js +1 -0
  18. package/bin/adapter/repositories/ProcessListSessionSubAgentActivityRepository.js.map +1 -1
  19. package/bin/adapter/repositories/TranscriptOwnerCallStatusProvider.js +14 -11
  20. package/bin/adapter/repositories/TranscriptOwnerCallStatusProvider.js.map +1 -1
  21. package/bin/adapter/repositories/TranscriptSessionSubAgentActivityRepository.js +64 -7
  22. package/bin/adapter/repositories/TranscriptSessionSubAgentActivityRepository.js.map +1 -1
  23. package/bin/domain/usecases/DefaultSilentSessionMessageComposer.js +18 -7
  24. package/bin/domain/usecases/DefaultSilentSessionMessageComposer.js.map +1 -1
  25. package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js +64 -19
  26. package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/adapter/entry-points/console/consoleDoneStore.test.ts +38 -0
  29. package/src/adapter/entry-points/console/consoleDoneStore.ts +29 -4
  30. package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +11 -0
  31. package/src/adapter/entry-points/handlers/consoleListsWriter.test.ts +72 -0
  32. package/src/adapter/entry-points/handlers/consoleListsWriter.ts +3 -0
  33. package/src/adapter/entry-points/handlers/notifySilentTmuxSessions.test.ts +46 -7
  34. package/src/adapter/entry-points/handlers/notifySilentTmuxSessions.ts +6 -0
  35. package/src/adapter/repositories/ConfigurableSilentSessionMessageComposer.test.ts +102 -37
  36. package/src/adapter/repositories/ConfigurableSilentSessionMessageComposer.ts +22 -17
  37. package/src/adapter/repositories/FileSystemInteractiveLiveSessionTranscriptResolver.test.ts +1 -1
  38. package/src/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.test.ts +223 -0
  39. package/src/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.ts +94 -10
  40. package/src/adapter/repositories/NoUnansweredOwnerCallStatusProvider.test.ts +7 -6
  41. package/src/adapter/repositories/NoUnansweredOwnerCallStatusProvider.ts +3 -3
  42. package/src/adapter/repositories/ProcessListSessionSubAgentActivityRepository.test.ts +12 -2
  43. package/src/adapter/repositories/ProcessListSessionSubAgentActivityRepository.ts +1 -0
  44. package/src/adapter/repositories/TranscriptOwnerCallStatusProvider.test.ts +99 -49
  45. package/src/adapter/repositories/TranscriptOwnerCallStatusProvider.ts +24 -14
  46. package/src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.test.ts +196 -4
  47. package/src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts +91 -7
  48. package/src/domain/entities/LiveSessionActivitySnapshot.ts +2 -1
  49. package/src/domain/usecases/DefaultSilentSessionMessageComposer.test.ts +187 -51
  50. package/src/domain/usecases/DefaultSilentSessionMessageComposer.ts +32 -15
  51. package/src/domain/usecases/NotifySilentLiveSessionsUseCase.test.ts +356 -28
  52. package/src/domain/usecases/NotifySilentLiveSessionsUseCase.ts +94 -26
  53. package/src/domain/usecases/adapter-interfaces/OwnerCallStatusProvider.ts +2 -2
  54. package/src/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.ts +8 -0
  55. package/src/domain/usecases/adapter-interfaces/SilentSessionMessageComposer.ts +7 -6
  56. package/types/adapter/entry-points/console/consoleDoneStore.d.ts +2 -0
  57. package/types/adapter/entry-points/console/consoleDoneStore.d.ts.map +1 -1
  58. package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
  59. package/types/adapter/entry-points/handlers/consoleListsWriter.d.ts.map +1 -1
  60. package/types/adapter/entry-points/handlers/notifySilentTmuxSessions.d.ts +2 -0
  61. package/types/adapter/entry-points/handlers/notifySilentTmuxSessions.d.ts.map +1 -1
  62. package/types/adapter/repositories/ConfigurableSilentSessionMessageComposer.d.ts +4 -3
  63. package/types/adapter/repositories/ConfigurableSilentSessionMessageComposer.d.ts.map +1 -1
  64. package/types/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.d.ts +13 -2
  65. package/types/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.d.ts.map +1 -1
  66. package/types/adapter/repositories/NoUnansweredOwnerCallStatusProvider.d.ts +1 -1
  67. package/types/adapter/repositories/NoUnansweredOwnerCallStatusProvider.d.ts.map +1 -1
  68. package/types/adapter/repositories/ProcessListSessionSubAgentActivityRepository.d.ts.map +1 -1
  69. package/types/adapter/repositories/TranscriptOwnerCallStatusProvider.d.ts +2 -2
  70. package/types/adapter/repositories/TranscriptOwnerCallStatusProvider.d.ts.map +1 -1
  71. package/types/adapter/repositories/TranscriptSessionSubAgentActivityRepository.d.ts +5 -1
  72. package/types/adapter/repositories/TranscriptSessionSubAgentActivityRepository.d.ts.map +1 -1
  73. package/types/domain/entities/LiveSessionActivitySnapshot.d.ts +2 -1
  74. package/types/domain/entities/LiveSessionActivitySnapshot.d.ts.map +1 -1
  75. package/types/domain/usecases/DefaultSilentSessionMessageComposer.d.ts +3 -3
  76. package/types/domain/usecases/DefaultSilentSessionMessageComposer.d.ts.map +1 -1
  77. package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts +4 -1
  78. package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts.map +1 -1
  79. package/types/domain/usecases/adapter-interfaces/OwnerCallStatusProvider.d.ts +1 -1
  80. package/types/domain/usecases/adapter-interfaces/OwnerCallStatusProvider.d.ts.map +1 -1
  81. package/types/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.d.ts +8 -0
  82. package/types/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.d.ts.map +1 -1
  83. package/types/domain/usecases/adapter-interfaces/SilentSessionMessageComposer.d.ts +5 -4
  84. package/types/domain/usecases/adapter-interfaces/SilentSessionMessageComposer.d.ts.map +1 -1
@@ -3,12 +3,13 @@ import { NoUnansweredOwnerCallStatusProvider } from './NoUnansweredOwnerCallStat
3
3
  describe('NoUnansweredOwnerCallStatusProvider', () => {
4
4
  it('always reports no session as having an unanswered owner call', async () => {
5
5
  const provider = new NoUnansweredOwnerCallStatusProvider();
6
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
7
- new Map([
8
- ['session-a', '/transcripts/a.jsonl'],
9
- ['session-b', '/transcripts/b.jsonl'],
10
- ]),
11
- );
6
+ const result =
7
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
8
+ new Map([
9
+ ['session-a', '/transcripts/a.jsonl'],
10
+ ['session-b', '/transcripts/b.jsonl'],
11
+ ]),
12
+ );
12
13
  expect(result.size).toBe(0);
13
14
  });
14
15
  });
@@ -1,9 +1,9 @@
1
1
  import { OwnerCallStatusProvider } from '../../domain/usecases/adapter-interfaces/OwnerCallStatusProvider';
2
2
 
3
3
  export class NoUnansweredOwnerCallStatusProvider implements OwnerCallStatusProvider {
4
- listSessionNamesWithUnansweredOwnerCall = (
4
+ listUnansweredOwnerCallEpochSecondsBySessionName = (
5
5
  _transcriptPathBySessionName: Map<string, string>,
6
- ): Promise<Set<string>> => {
7
- return Promise.resolve(new Set<string>());
6
+ ): Promise<Map<string, number>> => {
7
+ return Promise.resolve(new Map<string, number>());
8
8
  };
9
9
  }
@@ -54,7 +54,12 @@ describe('ProcessListSessionSubAgentActivityRepository', () => {
54
54
  );
55
55
  const result = await repository.listSubAgentActivitiesBySessionName(['s1']);
56
56
  expect(result.get('s1')).toEqual([
57
- { label: 'task-a', silentSeconds: 180, runningSeconds: 1200 },
57
+ {
58
+ label: 'task-a',
59
+ silentSeconds: 180,
60
+ runningSeconds: 1200,
61
+ waitingOnExternalProcess: false,
62
+ },
58
63
  ]);
59
64
  });
60
65
 
@@ -78,7 +83,12 @@ describe('ProcessListSessionSubAgentActivityRepository', () => {
78
83
  );
79
84
  const result = await repository.listSubAgentActivitiesBySessionName(['s1']);
80
85
  expect(result.get('s1')).toEqual([
81
- { label: 's1', silentSeconds: 0, runningSeconds: 30 },
86
+ {
87
+ label: 's1',
88
+ silentSeconds: 0,
89
+ runningSeconds: 30,
90
+ waitingOnExternalProcess: false,
91
+ },
82
92
  ]);
83
93
  });
84
94
 
@@ -43,6 +43,7 @@ export class ProcessListSessionSubAgentActivityRepository implements SessionSubA
43
43
  label,
44
44
  silentSeconds: this.silentSecondsResolver.resolveSilentSeconds(label),
45
45
  runningSeconds: process.elapsedSeconds,
46
+ waitingOnExternalProcess: false,
46
47
  };
47
48
  const existing = result.get(sessionName);
48
49
  if (existing === undefined) {
@@ -129,13 +129,48 @@ describe('TranscriptOwnerCallStatusProvider', () => {
129
129
  ]);
130
130
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
131
131
 
132
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
133
- new Map([[sessionName, transcriptPath]]),
134
- );
132
+ const result =
133
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
134
+ new Map([[sessionName, transcriptPath]]),
135
+ );
135
136
 
136
137
  expect(result.has(sessionName)).toBe(true);
137
138
  });
138
139
 
140
+ it('exposes the epoch seconds of the unanswered owner call so its age can be computed', async () => {
141
+ const transcriptPath = writeTranscript('workbench.jsonl', [
142
+ ownerReply('2026-06-27T10:00:00.000Z'),
143
+ assistantWithMarker('2026-06-27T10:05:00.000Z'),
144
+ ]);
145
+ const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
146
+
147
+ const result =
148
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
149
+ new Map([[sessionName, transcriptPath]]),
150
+ );
151
+
152
+ expect(result.get(sessionName)).toBe(
153
+ Math.floor(Date.parse('2026-06-27T10:05:00.000Z') / 1000),
154
+ );
155
+ });
156
+
157
+ it('exposes the epoch seconds of the latest owner call when several calls are unanswered', async () => {
158
+ const transcriptPath = writeTranscript('workbench.jsonl', [
159
+ assistantWithMarker('2026-06-27T09:00:00.000Z'),
160
+ assistantWithMarker('2026-06-27T10:05:00.000Z'),
161
+ ]);
162
+ const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
163
+
164
+ const result =
165
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
166
+ new Map([[sessionName, transcriptPath]]),
167
+ );
168
+
169
+ expect(result.get(sessionName)).toBe(
170
+ Math.floor(Date.parse('2026-06-27T10:05:00.000Z') / 1000),
171
+ );
172
+ });
173
+
139
174
  it('does not report a session as waiting when a later owner reply followed the call', async () => {
140
175
  const transcriptPath = writeTranscript('workbench.jsonl', [
141
176
  assistantWithMarker('2026-06-27T10:00:00.000Z'),
@@ -143,9 +178,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
143
178
  ]);
144
179
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
145
180
 
146
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
147
- new Map([[sessionName, transcriptPath]]),
148
- );
181
+ const result =
182
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
183
+ new Map([[sessionName, transcriptPath]]),
184
+ );
149
185
 
150
186
  expect(result.has(sessionName)).toBe(false);
151
187
  });
@@ -157,9 +193,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
157
193
  ]);
158
194
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
159
195
 
160
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
161
- new Map([[sessionName, transcriptPath]]),
162
- );
196
+ const result =
197
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
198
+ new Map([[sessionName, transcriptPath]]),
199
+ );
163
200
 
164
201
  expect(result.has(sessionName)).toBe(false);
165
202
  });
@@ -171,9 +208,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
171
208
  ]);
172
209
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
173
210
 
174
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
175
- new Map([[sessionName, transcriptPath]]),
176
- );
211
+ const result =
212
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
213
+ new Map([[sessionName, transcriptPath]]),
214
+ );
177
215
 
178
216
  expect(result.has(sessionName)).toBe(true);
179
217
  });
@@ -185,9 +223,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
185
223
  ]);
186
224
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
187
225
 
188
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
189
- new Map([[sessionName, transcriptPath]]),
190
- );
226
+ const result =
227
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
228
+ new Map([[sessionName, transcriptPath]]),
229
+ );
191
230
 
192
231
  expect(result.has(sessionName)).toBe(true);
193
232
  });
@@ -199,9 +238,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
199
238
  ]);
200
239
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
201
240
 
202
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
203
- new Map([[sessionName, transcriptPath]]),
204
- );
241
+ const result =
242
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
243
+ new Map([[sessionName, transcriptPath]]),
244
+ );
205
245
 
206
246
  expect(result.has(sessionName)).toBe(true);
207
247
  });
@@ -214,9 +254,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
214
254
  ]);
215
255
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
216
256
 
217
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
218
- new Map([[sessionName, transcriptPath]]),
219
- );
257
+ const result =
258
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
259
+ new Map([[sessionName, transcriptPath]]),
260
+ );
220
261
 
221
262
  expect(result.has(sessionName)).toBe(false);
222
263
  });
@@ -228,9 +269,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
228
269
  ]);
229
270
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
230
271
 
231
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
232
- new Map([[sessionName, transcriptPath]]),
233
- );
272
+ const result =
273
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
274
+ new Map([[sessionName, transcriptPath]]),
275
+ );
234
276
 
235
277
  expect(result.has(sessionName)).toBe(true);
236
278
  });
@@ -242,9 +284,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
242
284
  ]);
243
285
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
244
286
 
245
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
246
- new Map([[sessionName, transcriptPath]]),
247
- );
287
+ const result =
288
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
289
+ new Map([[sessionName, transcriptPath]]),
290
+ );
248
291
 
249
292
  expect(result.has(sessionName)).toBe(true);
250
293
  });
@@ -256,9 +299,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
256
299
  ]);
257
300
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
258
301
 
259
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
260
- new Map([[sessionName, transcriptPath]]),
261
- );
302
+ const result =
303
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
304
+ new Map([[sessionName, transcriptPath]]),
305
+ );
262
306
 
263
307
  expect(result.has(sessionName)).toBe(false);
264
308
  });
@@ -271,9 +315,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
271
315
  ]);
272
316
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
273
317
 
274
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
275
- new Map([[sessionName, transcriptPath]]),
276
- );
318
+ const result =
319
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
320
+ new Map([[sessionName, transcriptPath]]),
321
+ );
277
322
 
278
323
  expect(result.has(sessionName)).toBe(false);
279
324
  });
@@ -285,23 +330,25 @@ describe('TranscriptOwnerCallStatusProvider', () => {
285
330
  ]);
286
331
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
287
332
 
288
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
289
- new Map([[sessionName, transcriptPath]]),
290
- );
333
+ const result =
334
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
335
+ new Map([[sessionName, transcriptPath]]),
336
+ );
291
337
 
292
338
  expect(result.has(sessionName)).toBe(false);
293
339
  });
294
340
 
295
- it('returns an empty set when the marker is null', async () => {
341
+ it('returns an empty map when the marker is null', async () => {
296
342
  const transcriptPath = writeTranscript('workbench.jsonl', [
297
343
  ownerReply('2026-06-27T10:00:00.000Z'),
298
344
  assistantWithMarker('2026-06-27T10:05:00.000Z'),
299
345
  ]);
300
346
  const provider = new TranscriptOwnerCallStatusProvider(null);
301
347
 
302
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
303
- new Map([[sessionName, transcriptPath]]),
304
- );
348
+ const result =
349
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
350
+ new Map([[sessionName, transcriptPath]]),
351
+ );
305
352
 
306
353
  expect(result.size).toBe(0);
307
354
  });
@@ -309,9 +356,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
309
356
  it('ignores a session whose transcript file is missing', async () => {
310
357
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
311
358
 
312
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
313
- new Map([[sessionName, path.join(rootDirectory, 'missing.jsonl')]]),
314
- );
359
+ const result =
360
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
361
+ new Map([[sessionName, path.join(rootDirectory, 'missing.jsonl')]]),
362
+ );
315
363
 
316
364
  expect(result.size).toBe(0);
317
365
  });
@@ -328,9 +376,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
328
376
  );
329
377
  const provider = new TranscriptOwnerCallStatusProvider('<<OWNER_CALL>>');
330
378
 
331
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
332
- new Map([[sessionName, filePath]]),
333
- );
379
+ const result =
380
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
381
+ new Map([[sessionName, filePath]]),
382
+ );
334
383
 
335
384
  expect(result.has(sessionName)).toBe(true);
336
385
  });
@@ -348,9 +397,10 @@ describe('TranscriptOwnerCallStatusProvider', () => {
348
397
  ]);
349
398
  const provider = new TranscriptOwnerCallStatusProvider('<call-to-user>');
350
399
 
351
- const result = await provider.listSessionNamesWithUnansweredOwnerCall(
352
- new Map([[sessionName, transcriptPath]]),
353
- );
400
+ const result =
401
+ await provider.listUnansweredOwnerCallEpochSecondsBySessionName(
402
+ new Map([[sessionName, transcriptPath]]),
403
+ );
354
404
 
355
405
  expect(result.has(sessionName)).toBe(true);
356
406
  });
@@ -91,31 +91,41 @@ const hasOwnerTextReply = (content: unknown): boolean => {
91
91
  export class TranscriptOwnerCallStatusProvider implements OwnerCallStatusProvider {
92
92
  constructor(private readonly ownerCallMarker: string | null) {}
93
93
 
94
- listSessionNamesWithUnansweredOwnerCall = async (
94
+ listUnansweredOwnerCallEpochSecondsBySessionName = async (
95
95
  transcriptPathBySessionName: Map<string, string>,
96
- ): Promise<Set<string>> => {
97
- const waiting = new Set<string>();
96
+ ): Promise<Map<string, number>> => {
97
+ const unansweredOwnerCallEpochSecondsBySessionName = new Map<
98
+ string,
99
+ number
100
+ >();
98
101
  if (this.ownerCallMarker === null || this.ownerCallMarker.length === 0) {
99
- return waiting;
102
+ return unansweredOwnerCallEpochSecondsBySessionName;
100
103
  }
101
104
  const marker = this.ownerCallMarker;
102
105
  for (const [sessionName, transcriptPath] of transcriptPathBySessionName) {
103
- if (this.isWaitingForOwnerReply(transcriptPath, marker)) {
104
- waiting.add(sessionName);
106
+ const unansweredOwnerCallEpochMs = this.findUnansweredOwnerCallEpochMs(
107
+ transcriptPath,
108
+ marker,
109
+ );
110
+ if (unansweredOwnerCallEpochMs !== null) {
111
+ unansweredOwnerCallEpochSecondsBySessionName.set(
112
+ sessionName,
113
+ Math.floor(unansweredOwnerCallEpochMs / 1000),
114
+ );
105
115
  }
106
116
  }
107
- return waiting;
117
+ return unansweredOwnerCallEpochSecondsBySessionName;
108
118
  };
109
119
 
110
- private isWaitingForOwnerReply = (
120
+ private findUnansweredOwnerCallEpochMs = (
111
121
  transcriptPath: string,
112
122
  marker: string,
113
- ): boolean => {
123
+ ): number | null => {
114
124
  let content: string;
115
125
  try {
116
126
  content = fs.readFileSync(transcriptPath, 'utf8');
117
127
  } catch {
118
- return false;
128
+ return null;
119
129
  }
120
130
  let lastOwnerCallEpochMs: number | null = null;
121
131
  let lastOwnerReplyEpochMs: number | null = null;
@@ -155,11 +165,11 @@ export class TranscriptOwnerCallStatusProvider implements OwnerCallStatusProvide
155
165
  }
156
166
  }
157
167
  if (lastOwnerCallEpochMs === null) {
158
- return false;
168
+ return null;
159
169
  }
160
- return (
161
- lastOwnerReplyEpochMs === null ||
170
+ return lastOwnerReplyEpochMs === null ||
162
171
  lastOwnerCallEpochMs > lastOwnerReplyEpochMs
163
- );
172
+ ? lastOwnerCallEpochMs
173
+ : null;
164
174
  };
165
175
  }