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.
- package/CHANGELOG.md +15 -0
- package/README.md +8 -4
- package/bin/adapter/entry-points/console/consoleDoneStore.js +19 -5
- package/bin/adapter/entry-points/console/consoleDoneStore.js.map +1 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +14 -2
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
- package/bin/adapter/entry-points/handlers/consoleListsWriter.js +2 -0
- package/bin/adapter/entry-points/handlers/consoleListsWriter.js.map +1 -1
- package/bin/adapter/entry-points/handlers/notifySilentTmuxSessions.js +4 -2
- package/bin/adapter/entry-points/handlers/notifySilentTmuxSessions.js.map +1 -1
- package/bin/adapter/repositories/ConfigurableSilentSessionMessageComposer.js +12 -7
- package/bin/adapter/repositories/ConfigurableSilentSessionMessageComposer.js.map +1 -1
- package/bin/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.js +60 -11
- package/bin/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.js.map +1 -1
- package/bin/adapter/repositories/NoUnansweredOwnerCallStatusProvider.js +2 -2
- package/bin/adapter/repositories/NoUnansweredOwnerCallStatusProvider.js.map +1 -1
- package/bin/adapter/repositories/ProcessListSessionSubAgentActivityRepository.js +1 -0
- package/bin/adapter/repositories/ProcessListSessionSubAgentActivityRepository.js.map +1 -1
- package/bin/adapter/repositories/TranscriptOwnerCallStatusProvider.js +14 -11
- package/bin/adapter/repositories/TranscriptOwnerCallStatusProvider.js.map +1 -1
- package/bin/adapter/repositories/TranscriptSessionSubAgentActivityRepository.js +64 -7
- package/bin/adapter/repositories/TranscriptSessionSubAgentActivityRepository.js.map +1 -1
- package/bin/domain/usecases/DefaultSilentSessionMessageComposer.js +18 -7
- package/bin/domain/usecases/DefaultSilentSessionMessageComposer.js.map +1 -1
- package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js +64 -19
- package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/console/consoleDoneStore.test.ts +38 -0
- package/src/adapter/entry-points/console/consoleDoneStore.ts +29 -4
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +11 -0
- package/src/adapter/entry-points/handlers/consoleListsWriter.test.ts +72 -0
- package/src/adapter/entry-points/handlers/consoleListsWriter.ts +3 -0
- package/src/adapter/entry-points/handlers/notifySilentTmuxSessions.test.ts +46 -7
- package/src/adapter/entry-points/handlers/notifySilentTmuxSessions.ts +6 -0
- package/src/adapter/repositories/ConfigurableSilentSessionMessageComposer.test.ts +102 -37
- package/src/adapter/repositories/ConfigurableSilentSessionMessageComposer.ts +22 -17
- package/src/adapter/repositories/FileSystemInteractiveLiveSessionTranscriptResolver.test.ts +1 -1
- package/src/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.test.ts +223 -0
- package/src/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.ts +94 -10
- package/src/adapter/repositories/NoUnansweredOwnerCallStatusProvider.test.ts +7 -6
- package/src/adapter/repositories/NoUnansweredOwnerCallStatusProvider.ts +3 -3
- package/src/adapter/repositories/ProcessListSessionSubAgentActivityRepository.test.ts +12 -2
- package/src/adapter/repositories/ProcessListSessionSubAgentActivityRepository.ts +1 -0
- package/src/adapter/repositories/TranscriptOwnerCallStatusProvider.test.ts +99 -49
- package/src/adapter/repositories/TranscriptOwnerCallStatusProvider.ts +24 -14
- package/src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.test.ts +196 -4
- package/src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts +91 -7
- package/src/domain/entities/LiveSessionActivitySnapshot.ts +2 -1
- package/src/domain/usecases/DefaultSilentSessionMessageComposer.test.ts +187 -51
- package/src/domain/usecases/DefaultSilentSessionMessageComposer.ts +32 -15
- package/src/domain/usecases/NotifySilentLiveSessionsUseCase.test.ts +356 -28
- package/src/domain/usecases/NotifySilentLiveSessionsUseCase.ts +94 -26
- package/src/domain/usecases/adapter-interfaces/OwnerCallStatusProvider.ts +2 -2
- package/src/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.ts +8 -0
- package/src/domain/usecases/adapter-interfaces/SilentSessionMessageComposer.ts +7 -6
- package/types/adapter/entry-points/console/consoleDoneStore.d.ts +2 -0
- package/types/adapter/entry-points/console/consoleDoneStore.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/consoleListsWriter.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/notifySilentTmuxSessions.d.ts +2 -0
- package/types/adapter/entry-points/handlers/notifySilentTmuxSessions.d.ts.map +1 -1
- package/types/adapter/repositories/ConfigurableSilentSessionMessageComposer.d.ts +4 -3
- package/types/adapter/repositories/ConfigurableSilentSessionMessageComposer.d.ts.map +1 -1
- package/types/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.d.ts +13 -2
- package/types/adapter/repositories/FileSystemSilentSessionCandidateStateRepository.d.ts.map +1 -1
- package/types/adapter/repositories/NoUnansweredOwnerCallStatusProvider.d.ts +1 -1
- package/types/adapter/repositories/NoUnansweredOwnerCallStatusProvider.d.ts.map +1 -1
- package/types/adapter/repositories/ProcessListSessionSubAgentActivityRepository.d.ts.map +1 -1
- package/types/adapter/repositories/TranscriptOwnerCallStatusProvider.d.ts +2 -2
- package/types/adapter/repositories/TranscriptOwnerCallStatusProvider.d.ts.map +1 -1
- package/types/adapter/repositories/TranscriptSessionSubAgentActivityRepository.d.ts +5 -1
- package/types/adapter/repositories/TranscriptSessionSubAgentActivityRepository.d.ts.map +1 -1
- package/types/domain/entities/LiveSessionActivitySnapshot.d.ts +2 -1
- package/types/domain/entities/LiveSessionActivitySnapshot.d.ts.map +1 -1
- package/types/domain/usecases/DefaultSilentSessionMessageComposer.d.ts +3 -3
- package/types/domain/usecases/DefaultSilentSessionMessageComposer.d.ts.map +1 -1
- package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts +4 -1
- package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/OwnerCallStatusProvider.d.ts +1 -1
- package/types/domain/usecases/adapter-interfaces/OwnerCallStatusProvider.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.d.ts +8 -0
- package/types/domain/usecases/adapter-interfaces/SilentSessionCandidateStateRepository.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/SilentSessionMessageComposer.d.ts +5 -4
- 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 =
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
|
|
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
|
-
|
|
4
|
+
listUnansweredOwnerCallEpochSecondsBySessionName = (
|
|
5
5
|
_transcriptPathBySessionName: Map<string, string>,
|
|
6
|
-
): Promise<
|
|
7
|
-
return Promise.resolve(new
|
|
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
|
-
{
|
|
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
|
-
{
|
|
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 =
|
|
133
|
-
|
|
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 =
|
|
147
|
-
|
|
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 =
|
|
161
|
-
|
|
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 =
|
|
175
|
-
|
|
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 =
|
|
189
|
-
|
|
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 =
|
|
203
|
-
|
|
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 =
|
|
218
|
-
|
|
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 =
|
|
232
|
-
|
|
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 =
|
|
246
|
-
|
|
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 =
|
|
260
|
-
|
|
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 =
|
|
275
|
-
|
|
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 =
|
|
289
|
-
|
|
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
|
|
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 =
|
|
303
|
-
|
|
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 =
|
|
313
|
-
|
|
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 =
|
|
332
|
-
|
|
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 =
|
|
352
|
-
|
|
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
|
-
|
|
94
|
+
listUnansweredOwnerCallEpochSecondsBySessionName = async (
|
|
95
95
|
transcriptPathBySessionName: Map<string, string>,
|
|
96
|
-
): Promise<
|
|
97
|
-
const
|
|
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
|
|
102
|
+
return unansweredOwnerCallEpochSecondsBySessionName;
|
|
100
103
|
}
|
|
101
104
|
const marker = this.ownerCallMarker;
|
|
102
105
|
for (const [sessionName, transcriptPath] of transcriptPathBySessionName) {
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
117
|
+
return unansweredOwnerCallEpochSecondsBySessionName;
|
|
108
118
|
};
|
|
109
119
|
|
|
110
|
-
private
|
|
120
|
+
private findUnansweredOwnerCallEpochMs = (
|
|
111
121
|
transcriptPath: string,
|
|
112
122
|
marker: string,
|
|
113
|
-
):
|
|
123
|
+
): number | null => {
|
|
114
124
|
let content: string;
|
|
115
125
|
try {
|
|
116
126
|
content = fs.readFileSync(transcriptPath, 'utf8');
|
|
117
127
|
} catch {
|
|
118
|
-
return
|
|
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
|
|
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
|
}
|