github-issue-tower-defence-management 1.146.6 → 1.146.7

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.146.7](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.146.6...v1.146.7) (2026-08-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **silent-monitor:** treat a missing running-subagents record under an existing runtime root as no live sub-agents ([#1421](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/issues/1421)) ([759ef91](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/759ef91e4afe5cdbdb4e5c6e125c84b35f5489a0))
7
+
1
8
  ## [1.146.6](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.146.5...v1.146.6) (2026-08-07)
2
9
 
3
10
 
@@ -37,6 +37,10 @@ exports.FileSystemSubAgentLivenessResolver = void 0;
37
37
  const fs = __importStar(require("fs"));
38
38
  const path = __importStar(require("path"));
39
39
  const RUNNING_SUBAGENTS_FILE_NAME = 'running-subagents.txt';
40
+ const isMissingFileError = (error) => typeof error === 'object' &&
41
+ error !== null &&
42
+ 'code' in error &&
43
+ error.code === 'ENOENT';
40
44
  class FileSystemSubAgentLivenessResolver {
41
45
  constructor(runtimeRootDirectory) {
42
46
  this.runtimeRootDirectory = runtimeRootDirectory;
@@ -49,7 +53,10 @@ class FileSystemSubAgentLivenessResolver {
49
53
  try {
50
54
  content = fs.readFileSync(runningFilePath, 'utf8');
51
55
  }
52
- catch {
56
+ catch (error) {
57
+ if (isMissingFileError(error) && this.hasReadableRuntimeRootDirectory()) {
58
+ return new Set();
59
+ }
53
60
  return null;
54
61
  }
55
62
  const liveIds = new Set();
@@ -61,6 +68,17 @@ class FileSystemSubAgentLivenessResolver {
61
68
  }
62
69
  return liveIds;
63
70
  };
71
+ this.hasReadableRuntimeRootDirectory = () => {
72
+ if (this.runtimeRootDirectory === null) {
73
+ return false;
74
+ }
75
+ try {
76
+ return fs.statSync(this.runtimeRootDirectory).isDirectory();
77
+ }
78
+ catch {
79
+ return false;
80
+ }
81
+ };
64
82
  this.resolveRunningSubAgentsFilePath = (mainTranscriptPath) => {
65
83
  if (this.runtimeRootDirectory === null || mainTranscriptPath === null) {
66
84
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystemSubAgentLivenessResolver.js","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentLivenessResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAG7B,MAAM,2BAA2B,GAAG,uBAAuB,CAAC;AAE5D,MAAa,kCAAkC;IAC7C,YAA6B,oBAAmC;QAAnC,yBAAoB,GAApB,oBAAoB,CAAe;QAEhE,2BAAsB,GAAG,KAAK,EAAE,MAG/B,EAA+B,EAAE;YAChC,MAAM,eAAe,GAAG,IAAI,CAAC,+BAA+B,CAC1D,MAAM,CAAC,kBAAkB,CAC1B,CAAC;YACF,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,OAAe,CAAC;YACpB,IAAI,CAAC;gBACH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YACrD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;YAClC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5C,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QAEM,oCAA+B,GAAG,CACxC,kBAAiC,EAClB,EAAE;YACjB,IAAI,IAAI,CAAC,oBAAoB,KAAK,IAAI,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;gBACtE,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;YAChE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAChE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CACd,IAAI,CAAC,oBAAoB,EACzB,OAAO,EACP,WAAW,EACX,2BAA2B,CAC5B,CAAC;QACJ,CAAC,CAAC;IAhDiE,CAAC;CAiDrE;AAlDD,gFAkDC"}
1
+ {"version":3,"file":"FileSystemSubAgentLivenessResolver.js","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentLivenessResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAG7B,MAAM,2BAA2B,GAAG,uBAAuB,CAAC;AAE5D,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAW,EAAE,CACrD,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,MAAM,IAAI,KAAK;IACf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,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,WAAW,EAAE,CAAC;YAC9D,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC;QAEM,oCAA+B,GAAG,CACxC,kBAAiC,EAClB,EAAE;YACjB,IAAI,IAAI,CAAC,oBAAoB,KAAK,IAAI,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;gBACtE,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;YAChE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAChE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CACd,IAAI,CAAC,oBAAoB,EACzB,OAAO,EACP,WAAW,EACX,2BAA2B,CAC5B,CAAC;QACJ,CAAC,CAAC;IA9DiE,CAAC;CA+DrE;AAhED,gFAgEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-issue-tower-defence-management",
3
- "version": "1.146.6",
3
+ "version": "1.146.7",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -69,7 +69,7 @@ describe('FileSystemSubAgentLivenessResolver', () => {
69
69
  expect(result).toEqual(new Set());
70
70
  });
71
71
 
72
- it('returns null when the running file does not exist', async () => {
72
+ it('returns an empty set when the runtime root exists and the session has no running file', async () => {
73
73
  const resolver = new FileSystemSubAgentLivenessResolver(runtimeRoot);
74
74
 
75
75
  const result = await resolver.resolveLiveSubAgentIds({
@@ -77,6 +77,19 @@ describe('FileSystemSubAgentLivenessResolver', () => {
77
77
  mainTranscriptPath,
78
78
  });
79
79
 
80
+ expect(result).toEqual(new Set());
81
+ });
82
+
83
+ it('returns null when the configured runtime root directory does not exist', async () => {
84
+ const resolver = new FileSystemSubAgentLivenessResolver(
85
+ path.join(runtimeRoot, 'absent-runtime-root'),
86
+ );
87
+
88
+ const result = await resolver.resolveLiveSubAgentIds({
89
+ sessionName,
90
+ mainTranscriptPath,
91
+ });
92
+
80
93
  expect(result).toBeNull();
81
94
  });
82
95
 
@@ -178,4 +191,39 @@ describe('running-subagents record agent id contract with TranscriptSessionSubAg
178
191
  `agent-${liveAgentId}`,
179
192
  ]);
180
193
  });
194
+
195
+ it('reports no sub-agent when the runtime root exists and the session has no running-subagents record', async () => {
196
+ const subAgentsDirectory = path.join(
197
+ transcriptRoot,
198
+ cwdSlug,
199
+ sessionUuid,
200
+ 'subagents',
201
+ );
202
+ fs.mkdirSync(subAgentsDirectory, { recursive: true });
203
+ fs.writeFileSync(
204
+ path.join(subAgentsDirectory, `agent-${liveAgentId}.jsonl`),
205
+ JSON.stringify({
206
+ type: 'assistant',
207
+ timestamp: '2026-07-20T11:00:00.000Z',
208
+ message: {
209
+ stop_reason: 'tool_use',
210
+ content: [{ type: 'tool_use', name: 'Read', input: {} }],
211
+ },
212
+ }),
213
+ 'utf8',
214
+ );
215
+ const repository = new TranscriptSessionSubAgentActivityRepository(
216
+ new FileSystemSubAgentTranscriptDirectoryResolver(transcriptRoot),
217
+ emptyProcessLister,
218
+ now,
219
+ new FileSystemSubAgentLivenessResolver(runtimeRoot),
220
+ );
221
+
222
+ const result = await repository.listSubAgentActivitiesBySessionName(
223
+ [sessionName],
224
+ new Map([[sessionName, mainTranscriptPath]]),
225
+ );
226
+
227
+ expect(result.get(sessionName)).toBeUndefined();
228
+ });
181
229
  });
@@ -4,6 +4,12 @@ import { SubAgentLivenessResolver } from '../../domain/usecases/adapter-interfac
4
4
 
5
5
  const RUNNING_SUBAGENTS_FILE_NAME = 'running-subagents.txt';
6
6
 
7
+ const isMissingFileError = (error: unknown): boolean =>
8
+ typeof error === 'object' &&
9
+ error !== null &&
10
+ 'code' in error &&
11
+ error.code === 'ENOENT';
12
+
7
13
  export class FileSystemSubAgentLivenessResolver implements SubAgentLivenessResolver {
8
14
  constructor(private readonly runtimeRootDirectory: string | null) {}
9
15
 
@@ -20,7 +26,10 @@ export class FileSystemSubAgentLivenessResolver implements SubAgentLivenessResol
20
26
  let content: string;
21
27
  try {
22
28
  content = fs.readFileSync(runningFilePath, 'utf8');
23
- } catch {
29
+ } catch (error) {
30
+ if (isMissingFileError(error) && this.hasReadableRuntimeRootDirectory()) {
31
+ return new Set();
32
+ }
24
33
  return null;
25
34
  }
26
35
  const liveIds = new Set<string>();
@@ -33,6 +42,17 @@ export class FileSystemSubAgentLivenessResolver implements SubAgentLivenessResol
33
42
  return liveIds;
34
43
  };
35
44
 
45
+ private hasReadableRuntimeRootDirectory = (): boolean => {
46
+ if (this.runtimeRootDirectory === null) {
47
+ return false;
48
+ }
49
+ try {
50
+ return fs.statSync(this.runtimeRootDirectory).isDirectory();
51
+ } catch {
52
+ return false;
53
+ }
54
+ };
55
+
36
56
  private resolveRunningSubAgentsFilePath = (
37
57
  mainTranscriptPath: string | null,
38
58
  ): string | null => {
@@ -6,6 +6,7 @@ export declare class FileSystemSubAgentLivenessResolver implements SubAgentLiven
6
6
  sessionName: string;
7
7
  mainTranscriptPath: string | null;
8
8
  }) => Promise<Set<string> | null>;
9
+ private hasReadableRuntimeRootDirectory;
9
10
  private resolveRunningSubAgentsFilePath;
10
11
  }
11
12
  //# sourceMappingURL=FileSystemSubAgentLivenessResolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystemSubAgentLivenessResolver.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentLivenessResolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mEAAmE,CAAC;AAI7G,qBAAa,kCAAmC,YAAW,wBAAwB;IACrE,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,MAAM,GAAG,IAAI;IAEhE,sBAAsB,GAAU,QAAQ;QACtC,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;KACnC,KAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAqB7B;IAEF,OAAO,CAAC,+BAA+B,CAoBrC;CACH"}
1
+ {"version":3,"file":"FileSystemSubAgentLivenessResolver.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentLivenessResolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mEAAmE,CAAC;AAU7G,qBAAa,kCAAmC,YAAW,wBAAwB;IACrE,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,MAAM,GAAG,IAAI;IAEhE,sBAAsB,GAAU,QAAQ;QACtC,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;KACnC,KAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAwB7B;IAEF,OAAO,CAAC,+BAA+B,CASrC;IAEF,OAAO,CAAC,+BAA+B,CAoBrC;CACH"}