github-issue-tower-defence-management 1.117.0 → 1.117.1
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 +7 -0
- package/README.md +3 -3
- package/bin/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.js +9 -2
- package/bin/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.js.map +1 -1
- package/bin/adapter/repositories/TranscriptSessionSubAgentActivityRepository.js +3 -2
- package/bin/adapter/repositories/TranscriptSessionSubAgentActivityRepository.js.map +1 -1
- package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js +13 -3
- package/bin/domain/usecases/NotifySilentLiveSessionsUseCase.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.test.ts +40 -4
- package/src/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.ts +12 -6
- package/src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.test.ts +107 -29
- package/src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts +7 -2
- package/src/domain/usecases/NotifySilentLiveSessionsUseCase.test.ts +84 -4
- package/src/domain/usecases/NotifySilentLiveSessionsUseCase.ts +16 -3
- package/src/domain/usecases/adapter-interfaces/SessionSubAgentActivityRepository.ts +1 -0
- package/src/domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver.ts +4 -1
- package/types/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.d.ts +1 -1
- package/types/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.d.ts.map +1 -1
- package/types/adapter/repositories/TranscriptSessionSubAgentActivityRepository.d.ts +1 -1
- package/types/adapter/repositories/TranscriptSessionSubAgentActivityRepository.d.ts.map +1 -1
- package/types/domain/usecases/NotifySilentLiveSessionsUseCase.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/SessionSubAgentActivityRepository.d.ts +1 -1
- package/types/domain/usecases/adapter-interfaces/SessionSubAgentActivityRepository.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver.d.ts +1 -1
- package/types/domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.117.1](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.117.0...v1.117.1) (2026-06-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **silent-notification:** match real session-name and on-disk sub-agent transcript forms ([#1096](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/issues/1096)) ([b705351](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/b705351f4991f525ba52507b64edacdaddd7d3e6)), closes [#1095](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/issues/1095)
|
|
7
|
+
|
|
1
8
|
# [1.117.0](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.116.9...v1.117.0) (2026-06-29)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -288,7 +288,7 @@ silentNotificationEnabled?: boolean # Optional: Master switch for the silent liv
|
|
|
288
288
|
subAgentOutputRootDirectory?: string # Optional: Root directory holding one output file per sub-process (file name derived from the sub-process label). The modification time of each file is read to compute how long the sub-process output has been idle. When unset, sub-process idle time is reported as 0 and only the running-time threshold can trigger a sub-process notification
|
|
289
289
|
subAgentProcessMatchPattern?: string # Optional: Regular expression matched against each process command line to discover the sub-processes that belong to a monitored session. The expression must define a named capture group `session` whose value equals the monitored session name, and may define a named capture group `label` used as the display name. When unset, the sub-process check is skipped
|
|
290
290
|
ownerCallMarker?: string # Optional: Marker substring that identifies an assistant message asking the owner for a decision or confirmation. When set, the main-session stalled section is suppressed while a session's latest marker-bearing assistant message is newer (by full timestamp) than its latest genuine owner reply. When unset, no session is treated as waiting on the owner
|
|
291
|
-
subAgentTranscriptRootDirectory?: string # Optional:
|
|
291
|
+
subAgentTranscriptRootDirectory?: string # Optional: Projects root directory (for example `~/.claude/projects`) under which each session's transcript is stored as `<cwd-slug>/<sessionId>.jsonl` and its sub-agent transcripts live in the sibling `<cwd-slug>/<sessionId>/subagents/` directory as one `agent-<id>.jsonl` file per sub-agent. Because the on-disk directory is keyed by the session's working-directory slug and session id rather than by the tmux session name, the sub-agent directory is derived from the already-resolved main-session transcript path (the `.jsonl` suffix is stripped and `subagents` is appended). A sub-agent whose latest transcript entry reports a `stop_reason` of `end_turn` or `stop_sequence` is treated as finished and skipped; for any other sub-agent the idle time is computed from the transcript file modification time (following symlinks) and the running time from its first entry timestamp. When set, this transcript-based discovery is used instead of `subAgentProcessMatchPattern`. When unset, the process-match discovery is used
|
|
292
292
|
mainSilentThresholdSeconds?: number # Optional: Seconds of main-session output silence after which the main-session self-check section is sent. Default 600
|
|
293
293
|
subAgentSilentThresholdSeconds?: number # Optional: Seconds of sub-process output silence after which the sub-process section is sent. Default 300
|
|
294
294
|
subAgentRunningThresholdSeconds?: number # Optional: Seconds a sub-process may run before the sub-process section is sent regardless of its output silence. Default 900
|
|
@@ -559,9 +559,9 @@ Candidate sessions are first selected from the live process tree: every live tmu
|
|
|
559
559
|
|
|
560
560
|
The main-session stalled section is sent when the session's main output has been idle for at least `mainSilentThresholdSeconds`, unless the session is currently waiting on the owner (in that case the silence is expected and the section is suppressed). Idle time is computed from the timestamp of the latest entry of any kind in the session's resolved transcript rather than from the transcript file modification time, so a session that keeps appending tool results, owner replies, or any other entry type while emitting no assistant text still counts as active and is not mistaken for a silent one. Whether a session is waiting on the owner is determined through an injectable port; the built-in default reports no session as waiting, so the suppression is only applied when a host provides an implementation. When `ownerCallMarker` is configured, a transcript-based implementation is used: it reads each session's resolved transcript and treats the session as waiting on the owner when the latest entry containing `ownerCallMarker` is newer (by full timestamp) than the latest genuine owner reply. A self-check reminder that the monitor injects into a session via `tmux send-keys` itself lands in that session's transcript as a `user` text entry; every injected reminder carries a fixed sentinel tag (`[TDPM_SILENT_SESSION_SELF_CHECK_REMINDER]`), and a `user` entry whose text contains that sentinel is not counted as a genuine owner reply. This prevents the monitor's own reminder from being mistaken for the owner answering, which would otherwise make a genuinely waiting session stop being suppressed. The stalled section's owner-call self-check point also instructs the agent on the required owner-call notification format: the owner-call must be emitted as the configured owner-call marker tag (interpolated from `ownerCallMarker` when set) as a complete matching pair — opening marker, content, then closing marker — on a single line with no newline inside the tag, and the content between the markers must begin with the 🔴 emoji immediately, because the owner's app only surfaces the notification together with its content when the exact, well-formed tag with the leading 🔴 is present and a malformed tag results in only a red indicator with no readable content. The same self-check point also tells the agent when to fire the owner-call: if the agent has completed or answered a request from the owner in this session, it must fire the owner-call to report the result to the owner, because completing or answering an owner's requested action is itself a reason to fire the owner-call. Completing or answering an owner request without firing the owner-call means the owner is never notified — the owner's app only surfaces the session when the owner-call fires — so the task silently stalls; the point states the causal link explicitly, noting that if the self-check reminder keeps arriving it is likely because an owner request was completed or answered without firing the owner-call, so the agent should fire the owner-call to report the result to the owner.
|
|
561
561
|
|
|
562
|
-
The sub-process section is sent, regardless of main output, when at least one sub-process of the session has been output-idle for `subAgentSilentThresholdSeconds` or has been running for `subAgentRunningThresholdSeconds`; the message lists each matched sub-process with its idle and running minutes. Sub-processes are discovered in one of two ways: when `subAgentTranscriptRootDirectory` is configured, each session's `subagents/agent-<id>.jsonl` transcripts are scanned,
|
|
562
|
+
The sub-process section is sent, regardless of main output, when at least one sub-process of the session has been output-idle for `subAgentSilentThresholdSeconds` or has been running for `subAgentRunningThresholdSeconds`; the message lists each matched sub-process with its idle and running minutes. Sub-processes are discovered in one of two ways: when `subAgentTranscriptRootDirectory` is configured, each session's `subagents/agent-<id>.jsonl` transcripts are scanned. The sub-agent directory is the `subagents/` directory that sits next to the session's already-resolved main-session transcript file under `projects/<cwd-slug>/<sessionId>/subagents/`, derived by stripping the `.jsonl` suffix from the main-session transcript path and appending `subagents`; this on-disk path is keyed by the session's working-directory slug and session id, not by the tmux session name. Finished sub-agents (latest transcript entry `stop_reason` equal to `end_turn` or `stop_sequence`) are skipped, and idle time is taken from the transcript file modification time (following symlinks) while running time is taken from its first entry timestamp; otherwise sub-processes are discovered by matching `subAgentProcessMatchPattern` against process command lines.
|
|
563
563
|
|
|
564
|
-
There is no per-session notification cooldown: every cycle, a session is notified whenever it still meets the silent-target condition (output silent at or beyond the threshold and not waiting on the owner). No suppression state is persisted. Because silence is measured from the latest transcript entry of any type — including the monitor's own injected reminder and the owner's reply — a notified session's measured silence resets as soon as it produces any activity, so a session that has resumed is not re-flagged; this already prevents redundant nudges without a cooldown. When more than one session is notified in the same cycle, the sends are spaced out sequentially with `silentNotificationStaggerSeconds` between consecutive sends (no wait before the first or after the last) so the targets are not all triggered at once. When `activeHubTaskStatus` is configured, each notification is gated on the latest GitHub Project Status of the session's hub task: a session whose name
|
|
564
|
+
There is no per-session notification cooldown: every cycle, a session is notified whenever it still meets the silent-target condition (output silent at or beyond the threshold and not waiting on the owner). No suppression state is persisted. Because silence is measured from the latest transcript entry of any type — including the monitor's own injected reminder and the owner's reply — a notified session's measured silence resets as soon as it produces any activity, so a session that has resumed is not re-flagged; this already prevents redundant nudges without a cooldown. When more than one session is notified in the same cycle, the sends are spaced out sequentially with `silentNotificationStaggerSeconds` between consecutive sends (no wait before the first or after the last) so the targets are not all triggered at once. When `activeHubTaskStatus` is configured, each notification is gated on the latest GitHub Project Status of the session's hub task: a session whose name identifies a github.com issue or pull request — accepted both as a clean `https://github.com/{owner}/{repo}/issues/{N}` URL and as the real tmux session-name form `https_//github_com/{owner}/{repo}/issues/{N}` produced by replacing `.` and `:` with `_` (the `pull` path is accepted in both forms too) — is notified only while that hub task is open and in the configured active Status, so a session whose hub task has been closed or moved to another Status is skipped; sessions whose name does not identify a github.com issue or pull request are never gated, and a hub task whose Status cannot be resolved fails open (the notification is sent and a warning is logged). When `activeHubTaskStatus` is unset, this hub-task check is a no-op. Process-snapshot collection, transcript resolution, owner-call detection, the wait between sends, and the message wording are all performed through injectable ports, so the logic is unit-testable without touching the host, and the host-specific process and environment access, sub-process pattern, and message wording are supplied through adapters or configuration. When `silentNotificationEnabled` is not true the step is a no-op, and any error during the step is logged and swallowed so the schedule cycle is never affected.
|
|
565
565
|
|
|
566
566
|
Each config key above has a matching environment variable read when the config key is unset: `TDPM_SILENT_NOTIFICATION_ENABLED` (the string `true` enables the step), `TDPM_SILENT_OWNER_CALL_MARKER`, `TDPM_SUBAGENT_OUTPUT_ROOT_DIRECTORY`, `TDPM_SUBAGENT_PROCESS_MATCH_PATTERN`, `TDPM_SUBAGENT_TRANSCRIPT_ROOT_DIRECTORY`, `TDPM_MAIN_SILENT_THRESHOLD_SECONDS`, `TDPM_SUBAGENT_SILENT_THRESHOLD_SECONDS`, `TDPM_SUBAGENT_RUNNING_THRESHOLD_SECONDS`, `TDPM_SILENT_NOTIFICATION_STAGGER_SECONDS`, `TDPM_ACTIVE_HUB_TASK_STATUS`, `TDPM_SILENT_MAIN_STALLED_MESSAGE`, `TDPM_SILENT_SUBAGENT_MESSAGE_HEADER`, and `TDPM_SILENT_SUBAGENT_MESSAGE_FOOTER`.
|
|
567
567
|
|
|
@@ -38,11 +38,18 @@ const path = __importStar(require("path"));
|
|
|
38
38
|
class FileSystemSubAgentTranscriptDirectoryResolver {
|
|
39
39
|
constructor(rootDirectory) {
|
|
40
40
|
this.rootDirectory = rootDirectory;
|
|
41
|
-
this.resolveSubAgentsDirectory = (
|
|
41
|
+
this.resolveSubAgentsDirectory = (_sessionName, mainTranscriptPath) => {
|
|
42
42
|
if (this.rootDirectory === null) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
if (mainTranscriptPath === null) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const sessionDirectory = mainTranscriptPath.replace(/\.jsonl$/, '');
|
|
49
|
+
if (sessionDirectory === mainTranscriptPath) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return path.join(sessionDirectory, 'subagents');
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystemSubAgentTranscriptDirectoryResolver.js","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAG7B,MAAa,6CAA6C;IACxD,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAEzD,8BAAyB,GAAG,
|
|
1
|
+
{"version":3,"file":"FileSystemSubAgentTranscriptDirectoryResolver.js","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAG7B,MAAa,6CAA6C;IACxD,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAEzD,8BAAyB,GAAG,CAC1B,YAAoB,EACpB,kBAAiC,EAClB,EAAE;YACjB,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACpE,IAAI,gBAAgB,KAAK,kBAAkB,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QAClD,CAAC,CAAC;IAjB0D,CAAC;CAkB9D;AAnBD,sGAmBC"}
|
|
@@ -85,11 +85,12 @@ class TranscriptSessionSubAgentActivityRepository {
|
|
|
85
85
|
constructor(directoryResolver, now) {
|
|
86
86
|
this.directoryResolver = directoryResolver;
|
|
87
87
|
this.now = now;
|
|
88
|
-
this.listSubAgentActivitiesBySessionName = async (sessionNames) => {
|
|
88
|
+
this.listSubAgentActivitiesBySessionName = async (sessionNames, transcriptPathBySessionName) => {
|
|
89
89
|
const result = new Map();
|
|
90
90
|
const nowEpochSeconds = Math.floor(this.now.getTime() / 1000);
|
|
91
91
|
for (const sessionName of sessionNames) {
|
|
92
|
-
const
|
|
92
|
+
const mainTranscriptPath = transcriptPathBySessionName.get(sessionName) ?? null;
|
|
93
|
+
const directory = this.directoryResolver.resolveSubAgentsDirectory(sessionName, mainTranscriptPath);
|
|
93
94
|
if (directory === null) {
|
|
94
95
|
continue;
|
|
95
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptSessionSubAgentActivityRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAK7B,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,UAAU,GAAG,CACjB,KAA8B,EAC9B,GAAW,EACI,EAAE;IACjB,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAwB,EAAiB,EAAE;IACpE,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,IAAI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,CAAC;IACD,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAa,2CAA2C;IACtD,YACmB,iBAAsD,EACtD,GAAS;QADT,sBAAiB,GAAjB,iBAAiB,CAAqC;QACtD,QAAG,GAAH,GAAG,CAAM;QAG5B,wCAAmC,GAAG,KAAK,EACzC,YAAsB,
|
|
1
|
+
{"version":3,"file":"TranscriptSessionSubAgentActivityRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAK7B,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,MAAM,UAAU,GAAG,CACjB,KAA8B,EAC9B,GAAW,EACI,EAAE;IACjB,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAwB,EAAiB,EAAE;IACpE,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG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AI,CAAC,CACnD,CAAC;YACF,MAAM,cAAc,GAClB,UAAU,CAAC,sBAAsB,KAAK,IAAI;gBACxC,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,WAAW,CAAC,eAAe,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;YACvE,OAAO;gBACL,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;gBACvC,aAAa;gBACb,cAAc;aACf,CAAC;QACJ,CAAC,CAAC;IAnFC,CAAC;CAoFL;AAxFD,kGAwFC"}
|
|
@@ -6,9 +6,19 @@ exports.DEFAULT_MAIN_SILENT_THRESHOLD_SECONDS = 10 * 60;
|
|
|
6
6
|
exports.DEFAULT_SUBAGENT_SILENT_THRESHOLD_SECONDS = 5 * 60;
|
|
7
7
|
exports.DEFAULT_SUBAGENT_RUNNING_THRESHOLD_SECONDS = 15 * 60;
|
|
8
8
|
exports.DEFAULT_NOTIFICATION_STAGGER_SECONDS = 25;
|
|
9
|
-
const
|
|
9
|
+
const GITHUB_ISSUE_OR_PULL_URL_PATTERN = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/(?:issues|pull)\/(\d+)$/;
|
|
10
|
+
const GITHUB_TMUX_SESSION_NAME_PATTERN = /^https_\/\/github_com\/([^/]+)\/([^/]+)\/(?:issues|pull)\/(\d+)$/;
|
|
10
11
|
const parseHubTaskIssueUrlFromSessionName = (sessionName) => {
|
|
11
|
-
|
|
12
|
+
if (GITHUB_ISSUE_OR_PULL_URL_PATTERN.test(sessionName)) {
|
|
13
|
+
return sessionName;
|
|
14
|
+
}
|
|
15
|
+
const tmuxMatch = GITHUB_TMUX_SESSION_NAME_PATTERN.exec(sessionName);
|
|
16
|
+
if (tmuxMatch === null) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const [, owner, repo, number] = tmuxMatch;
|
|
20
|
+
const target = sessionName.includes('/pull/') ? 'pull' : 'issues';
|
|
21
|
+
return `https://github.com/${owner}/${repo}/${target}/${number}`;
|
|
12
22
|
};
|
|
13
23
|
exports.parseHubTaskIssueUrlFromSessionName = parseHubTaskIssueUrlFromSessionName;
|
|
14
24
|
const GITHUB_ISSUE_OR_PULL_REQUEST_SESSION_NAME_PATTERN = /^https(:\/\/|_\/\/)github(\.com|_com)\/[^/]+\/[^/]+\/(issues|pull)\/\d+$/;
|
|
@@ -94,7 +104,7 @@ class NotifySilentLiveSessionsUseCase {
|
|
|
94
104
|
for (const activity of activities) {
|
|
95
105
|
lastOutputBySessionName.set(activity.sessionName, activity.lastOutputEpochSeconds);
|
|
96
106
|
}
|
|
97
|
-
const subAgentsBySessionName = await this.subAgentActivityRepository.listSubAgentActivitiesBySessionName(sessionNames);
|
|
107
|
+
const subAgentsBySessionName = await this.subAgentActivityRepository.listSubAgentActivitiesBySessionName(sessionNames, transcriptPathBySessionName);
|
|
98
108
|
const sessionNamesWithUnansweredOwnerCall = await this.ownerCallStatusProvider.listSessionNamesWithUnansweredOwnerCall(transcriptPathBySessionName);
|
|
99
109
|
const nowEpochSeconds = Math.floor(now.getTime() / 1000);
|
|
100
110
|
return sessionNames.map((sessionName) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotifySilentLiveSessionsUseCase.js","sourceRoot":"","sources":["../../../src/domain/usecases/NotifySilentLiveSessionsUseCase.ts"],"names":[],"mappings":";;;AAWA,mGAAgG;AAEnF,QAAA,qCAAqC,GAAG,EAAE,GAAG,EAAE,CAAC;AAChD,QAAA,yCAAyC,GAAG,CAAC,GAAG,EAAE,CAAC;AACnD,QAAA,0CAA0C,GAAG,EAAE,GAAG,EAAE,CAAC;AACrD,QAAA,oCAAoC,GAAG,EAAE,CAAC;AAEvD,MAAM,
|
|
1
|
+
{"version":3,"file":"NotifySilentLiveSessionsUseCase.js","sourceRoot":"","sources":["../../../src/domain/usecases/NotifySilentLiveSessionsUseCase.ts"],"names":[],"mappings":";;;AAWA,mGAAgG;AAEnF,QAAA,qCAAqC,GAA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QAAQ,GAAa,EAAE,CAAC;YAE9B,IACE,QAAQ,CAAC,iBAAiB,KAAK,IAAI;gBACnC,QAAQ,CAAC,iBAAiB,IAAI,UAAU,CAAC,0BAA0B;gBACnE,CAAC,QAAQ,CAAC,sBAAsB,EAChC,CAAC;gBACD,QAAQ,CAAC,IAAI,CACX,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAC5C,QAAQ,CAAC,iBAAiB,CAC3B,CACF,CAAC;YACJ,CAAC;YAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC,SAAS,CAAC,MAAM,CAChD,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,aAAa,IAAI,UAAU,CAAC,8BAA8B;gBACnE,QAAQ,CAAC,cAAc,IAAI,UAAU,CAAC,+BAA+B,CACxE,CAAC;YACF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChC,QAAQ,CAAC,IAAI,CACX,IAAI,CAAC,eAAe,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAC9D,CAAC;YACJ,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC,CAAC;IAvMC,CAAC;CAwML;AAtND,0EAsNC"}
|
package/package.json
CHANGED
|
@@ -2,19 +2,28 @@ import * as path from 'path';
|
|
|
2
2
|
import { FileSystemSubAgentTranscriptDirectoryResolver } from './FileSystemSubAgentTranscriptDirectoryResolver';
|
|
3
3
|
|
|
4
4
|
describe('FileSystemSubAgentTranscriptDirectoryResolver', () => {
|
|
5
|
-
|
|
5
|
+
const rootDirectory = '/home/user/.claude/projects';
|
|
6
|
+
const mainTranscriptPath = path.join(
|
|
7
|
+
rootDirectory,
|
|
8
|
+
'-home-user-0-workspaces-workspace1-oss-some-repo-worktrees-i123',
|
|
9
|
+
'ba0637e1-9ff1-41a8-b13c-f45e6a71efc5.jsonl',
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
it('derives the subagents directory next to the resolved main transcript path', () => {
|
|
6
13
|
const resolver = new FileSystemSubAgentTranscriptDirectoryResolver(
|
|
7
|
-
|
|
14
|
+
rootDirectory,
|
|
8
15
|
);
|
|
9
16
|
|
|
10
17
|
const result = resolver.resolveSubAgentsDirectory(
|
|
11
18
|
'https_//github_com/owner/repo/issues/9',
|
|
19
|
+
mainTranscriptPath,
|
|
12
20
|
);
|
|
13
21
|
|
|
14
22
|
expect(result).toBe(
|
|
15
23
|
path.join(
|
|
16
|
-
|
|
17
|
-
'
|
|
24
|
+
rootDirectory,
|
|
25
|
+
'-home-user-0-workspaces-workspace1-oss-some-repo-worktrees-i123',
|
|
26
|
+
'ba0637e1-9ff1-41a8-b13c-f45e6a71efc5',
|
|
18
27
|
'subagents',
|
|
19
28
|
),
|
|
20
29
|
);
|
|
@@ -25,6 +34,33 @@ describe('FileSystemSubAgentTranscriptDirectoryResolver', () => {
|
|
|
25
34
|
|
|
26
35
|
const result = resolver.resolveSubAgentsDirectory(
|
|
27
36
|
'https_//github_com/owner/repo/issues/9',
|
|
37
|
+
mainTranscriptPath,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(result).toBeNull();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('returns null when the main transcript path is unresolved', () => {
|
|
44
|
+
const resolver = new FileSystemSubAgentTranscriptDirectoryResolver(
|
|
45
|
+
rootDirectory,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const result = resolver.resolveSubAgentsDirectory(
|
|
49
|
+
'https_//github_com/owner/repo/issues/9',
|
|
50
|
+
null,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(result).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('returns null when the main transcript path is not a .jsonl file', () => {
|
|
57
|
+
const resolver = new FileSystemSubAgentTranscriptDirectoryResolver(
|
|
58
|
+
rootDirectory,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const result = resolver.resolveSubAgentsDirectory(
|
|
62
|
+
'https_//github_com/owner/repo/issues/9',
|
|
63
|
+
path.join(rootDirectory, 'slug', 'no-extension'),
|
|
28
64
|
);
|
|
29
65
|
|
|
30
66
|
expect(result).toBeNull();
|
|
@@ -4,14 +4,20 @@ import { SubAgentTranscriptDirectoryResolver } from '../../domain/usecases/adapt
|
|
|
4
4
|
export class FileSystemSubAgentTranscriptDirectoryResolver implements SubAgentTranscriptDirectoryResolver {
|
|
5
5
|
constructor(private readonly rootDirectory: string | null) {}
|
|
6
6
|
|
|
7
|
-
resolveSubAgentsDirectory = (
|
|
7
|
+
resolveSubAgentsDirectory = (
|
|
8
|
+
_sessionName: string,
|
|
9
|
+
mainTranscriptPath: string | null,
|
|
10
|
+
): string | null => {
|
|
8
11
|
if (this.rootDirectory === null) {
|
|
9
12
|
return null;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
14
|
+
if (mainTranscriptPath === null) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const sessionDirectory = mainTranscriptPath.replace(/\.jsonl$/, '');
|
|
18
|
+
if (sessionDirectory === mainTranscriptPath) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return path.join(sessionDirectory, 'subagents');
|
|
16
22
|
};
|
|
17
23
|
}
|
|
@@ -2,6 +2,7 @@ import * as fs from 'fs';
|
|
|
2
2
|
import * as os from 'os';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import { SubAgentTranscriptDirectoryResolver } from '../../domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver';
|
|
5
|
+
import { FileSystemSubAgentTranscriptDirectoryResolver } from './FileSystemSubAgentTranscriptDirectoryResolver';
|
|
5
6
|
import { TranscriptSessionSubAgentActivityRepository } from './TranscriptSessionSubAgentActivityRepository';
|
|
6
7
|
|
|
7
8
|
describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
@@ -17,10 +18,32 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
17
18
|
fs.rmSync(rootDirectory, { force: true, recursive: true });
|
|
18
19
|
});
|
|
19
20
|
|
|
21
|
+
const cwdSlugFor = (sessionName: string): string =>
|
|
22
|
+
`-home-user-worktrees-${sessionName.replace(/[^a-zA-Z0-9]/g, '-')}`;
|
|
23
|
+
|
|
24
|
+
const sessionUuidFor = (sessionName: string): string =>
|
|
25
|
+
`uuid-${sessionName.replace(/[^a-zA-Z0-9]/g, '-')}`;
|
|
26
|
+
|
|
27
|
+
const mainTranscriptPathFor = (sessionName: string): string =>
|
|
28
|
+
path.join(
|
|
29
|
+
rootDirectory,
|
|
30
|
+
cwdSlugFor(sessionName),
|
|
31
|
+
`${sessionUuidFor(sessionName)}.jsonl`,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const transcriptMapFor = (sessionNames: string[]): Map<string, string> =>
|
|
35
|
+
new Map(
|
|
36
|
+
sessionNames.map((sessionName) => [
|
|
37
|
+
sessionName,
|
|
38
|
+
mainTranscriptPathFor(sessionName),
|
|
39
|
+
]),
|
|
40
|
+
);
|
|
41
|
+
|
|
20
42
|
const subAgentsDirFor = (sessionName: string): string => {
|
|
21
43
|
const dir = path.join(
|
|
22
44
|
rootDirectory,
|
|
23
|
-
sessionName
|
|
45
|
+
cwdSlugFor(sessionName),
|
|
46
|
+
sessionUuidFor(sessionName),
|
|
24
47
|
'subagents',
|
|
25
48
|
);
|
|
26
49
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -44,10 +67,8 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
44
67
|
return filePath;
|
|
45
68
|
};
|
|
46
69
|
|
|
47
|
-
const createResolver = (): SubAgentTranscriptDirectoryResolver =>
|
|
48
|
-
|
|
49
|
-
path.join(rootDirectory, sessionName.replace(/\//g, '_'), 'subagents'),
|
|
50
|
-
});
|
|
70
|
+
const createResolver = (): SubAgentTranscriptDirectoryResolver =>
|
|
71
|
+
new FileSystemSubAgentTranscriptDirectoryResolver(rootDirectory);
|
|
51
72
|
|
|
52
73
|
const runningEntries = (startTimestamp: string): object[] => [
|
|
53
74
|
{ type: 'user', timestamp: startTimestamp, message: { role: 'user' } },
|
|
@@ -90,9 +111,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
90
111
|
now,
|
|
91
112
|
);
|
|
92
113
|
|
|
93
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
94
|
-
sessionName,
|
|
95
|
-
|
|
114
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
115
|
+
[sessionName],
|
|
116
|
+
transcriptMapFor([sessionName]),
|
|
117
|
+
);
|
|
96
118
|
|
|
97
119
|
expect(result.get(sessionName)).toEqual([
|
|
98
120
|
{ label: 'agent-aaa111', silentSeconds: 120, runningSeconds: 900 },
|
|
@@ -112,9 +134,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
112
134
|
now,
|
|
113
135
|
);
|
|
114
136
|
|
|
115
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
116
|
-
sessionName,
|
|
117
|
-
|
|
137
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
138
|
+
[sessionName],
|
|
139
|
+
transcriptMapFor([sessionName]),
|
|
140
|
+
);
|
|
118
141
|
|
|
119
142
|
expect(result.size).toBe(0);
|
|
120
143
|
});
|
|
@@ -132,9 +155,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
132
155
|
now,
|
|
133
156
|
);
|
|
134
157
|
|
|
135
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
136
|
-
sessionName,
|
|
137
|
-
|
|
158
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
159
|
+
[sessionName],
|
|
160
|
+
transcriptMapFor([sessionName]),
|
|
161
|
+
);
|
|
138
162
|
|
|
139
163
|
expect(result.size).toBe(0);
|
|
140
164
|
});
|
|
@@ -160,9 +184,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
160
184
|
now,
|
|
161
185
|
);
|
|
162
186
|
|
|
163
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
164
|
-
sessionName,
|
|
165
|
-
|
|
187
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
188
|
+
[sessionName],
|
|
189
|
+
transcriptMapFor([sessionName]),
|
|
190
|
+
);
|
|
166
191
|
|
|
167
192
|
expect(result.get(sessionName)).toEqual([
|
|
168
193
|
{ label: 'agent-link1', silentSeconds: 60, runningSeconds: 600 },
|
|
@@ -176,9 +201,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
176
201
|
now,
|
|
177
202
|
);
|
|
178
203
|
|
|
179
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
180
|
-
'https_//github_com/owner/repo/issues/9',
|
|
181
|
-
|
|
204
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
205
|
+
['https_//github_com/owner/repo/issues/9'],
|
|
206
|
+
transcriptMapFor(['https_//github_com/owner/repo/issues/9']),
|
|
207
|
+
);
|
|
182
208
|
|
|
183
209
|
expect(result.size).toBe(0);
|
|
184
210
|
});
|
|
@@ -189,9 +215,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
189
215
|
now,
|
|
190
216
|
);
|
|
191
217
|
|
|
192
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
193
|
-
'https_//github_com/owner/repo/issues/404',
|
|
194
|
-
|
|
218
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
219
|
+
['https_//github_com/owner/repo/issues/404'],
|
|
220
|
+
transcriptMapFor(['https_//github_com/owner/repo/issues/404']),
|
|
221
|
+
);
|
|
195
222
|
|
|
196
223
|
expect(result.size).toBe(0);
|
|
197
224
|
});
|
|
@@ -215,9 +242,10 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
215
242
|
now,
|
|
216
243
|
);
|
|
217
244
|
|
|
218
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
219
|
-
sessionName,
|
|
220
|
-
|
|
245
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
246
|
+
[sessionName],
|
|
247
|
+
transcriptMapFor([sessionName]),
|
|
248
|
+
);
|
|
221
249
|
|
|
222
250
|
expect(result.get(sessionName)).toHaveLength(2);
|
|
223
251
|
});
|
|
@@ -235,12 +263,62 @@ describe('TranscriptSessionSubAgentActivityRepository', () => {
|
|
|
235
263
|
now,
|
|
236
264
|
);
|
|
237
265
|
|
|
238
|
-
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
239
|
-
sessionName,
|
|
240
|
-
|
|
266
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
267
|
+
[sessionName],
|
|
268
|
+
transcriptMapFor([sessionName]),
|
|
269
|
+
);
|
|
241
270
|
|
|
242
271
|
expect(result.get(sessionName)).toEqual([
|
|
243
272
|
{ label: 'agent-future', silentSeconds: 0, runningSeconds: 0 },
|
|
244
273
|
]);
|
|
245
274
|
});
|
|
275
|
+
|
|
276
|
+
it('resolves sub-agent transcripts laid out exactly as Claude Code stores them on disk', async () => {
|
|
277
|
+
const sessionName = 'https_//github_com/HiromiShikata/repo/issues/2355';
|
|
278
|
+
const projectsRoot = path.join(rootDirectory, 'projects');
|
|
279
|
+
const cwdSlug =
|
|
280
|
+
'-home-user-0-workspaces-workspace1-oss-example-repo-worktrees-i2355';
|
|
281
|
+
const sessionUuid = 'ba0637e1-9ff1-41a8-b13c-f45e6a71efc5';
|
|
282
|
+
const mainTranscriptPath = path.join(
|
|
283
|
+
projectsRoot,
|
|
284
|
+
cwdSlug,
|
|
285
|
+
`${sessionUuid}.jsonl`,
|
|
286
|
+
);
|
|
287
|
+
const subagentsDir = path.join(
|
|
288
|
+
projectsRoot,
|
|
289
|
+
cwdSlug,
|
|
290
|
+
sessionUuid,
|
|
291
|
+
'subagents',
|
|
292
|
+
);
|
|
293
|
+
fs.mkdirSync(subagentsDir, { recursive: true });
|
|
294
|
+
fs.mkdirSync(path.dirname(mainTranscriptPath), { recursive: true });
|
|
295
|
+
fs.writeFileSync(mainTranscriptPath, '', 'utf8');
|
|
296
|
+
const agentFile = path.join(subagentsDir, 'agent-afcbe335fdbec0a28.jsonl');
|
|
297
|
+
fs.writeFileSync(
|
|
298
|
+
agentFile,
|
|
299
|
+
runningEntries('2026-06-27T11:45:00.000Z')
|
|
300
|
+
.map((entry) => JSON.stringify(entry))
|
|
301
|
+
.join('\n'),
|
|
302
|
+
'utf8',
|
|
303
|
+
);
|
|
304
|
+
fs.utimesSync(agentFile, nowEpochSeconds - 120, nowEpochSeconds - 120);
|
|
305
|
+
|
|
306
|
+
const repository = new TranscriptSessionSubAgentActivityRepository(
|
|
307
|
+
new FileSystemSubAgentTranscriptDirectoryResolver(projectsRoot),
|
|
308
|
+
now,
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
const result = await repository.listSubAgentActivitiesBySessionName(
|
|
312
|
+
[sessionName],
|
|
313
|
+
new Map([[sessionName, mainTranscriptPath]]),
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
expect(result.get(sessionName)).toEqual([
|
|
317
|
+
{
|
|
318
|
+
label: 'agent-afcbe335fdbec0a28',
|
|
319
|
+
silentSeconds: 120,
|
|
320
|
+
runningSeconds: 900,
|
|
321
|
+
},
|
|
322
|
+
]);
|
|
323
|
+
});
|
|
246
324
|
});
|
|
@@ -70,12 +70,17 @@ export class TranscriptSessionSubAgentActivityRepository implements SessionSubAg
|
|
|
70
70
|
|
|
71
71
|
listSubAgentActivitiesBySessionName = async (
|
|
72
72
|
sessionNames: string[],
|
|
73
|
+
transcriptPathBySessionName: Map<string, string>,
|
|
73
74
|
): Promise<Map<string, SubAgentActivity[]>> => {
|
|
74
75
|
const result = new Map<string, SubAgentActivity[]>();
|
|
75
76
|
const nowEpochSeconds = Math.floor(this.now.getTime() / 1000);
|
|
76
77
|
for (const sessionName of sessionNames) {
|
|
77
|
-
const
|
|
78
|
-
|
|
78
|
+
const mainTranscriptPath =
|
|
79
|
+
transcriptPathBySessionName.get(sessionName) ?? null;
|
|
80
|
+
const directory = this.directoryResolver.resolveSubAgentsDirectory(
|
|
81
|
+
sessionName,
|
|
82
|
+
mainTranscriptPath,
|
|
83
|
+
);
|
|
79
84
|
if (directory === null) {
|
|
80
85
|
continue;
|
|
81
86
|
}
|
|
@@ -277,7 +277,7 @@ describe('NotifySilentLiveSessionsUseCase', () => {
|
|
|
277
277
|
);
|
|
278
278
|
expect(
|
|
279
279
|
mockSubAgentActivityRepository.listSubAgentActivitiesBySessionName,
|
|
280
|
-
).toHaveBeenCalledWith([]);
|
|
280
|
+
).toHaveBeenCalledWith([], new Map());
|
|
281
281
|
expect(
|
|
282
282
|
mockMessageComposer.composeMainStalledSection,
|
|
283
283
|
).not.toHaveBeenCalled();
|
|
@@ -335,7 +335,7 @@ describe('NotifySilentLiveSessionsUseCase', () => {
|
|
|
335
335
|
).toHaveBeenCalledWith(expectedMap);
|
|
336
336
|
expect(
|
|
337
337
|
mockSubAgentActivityRepository.listSubAgentActivitiesBySessionName,
|
|
338
|
-
).toHaveBeenCalledWith([GITHUB_SESSION]);
|
|
338
|
+
).toHaveBeenCalledWith([GITHUB_SESSION], expectedMap);
|
|
339
339
|
});
|
|
340
340
|
|
|
341
341
|
it('suppresses the stalled section and sends nothing when an owner call is pending past the threshold', async () => {
|
|
@@ -693,19 +693,99 @@ describe('NotifySilentLiveSessionsUseCase', () => {
|
|
|
693
693
|
warnSpy.mockRestore();
|
|
694
694
|
});
|
|
695
695
|
|
|
696
|
-
it('
|
|
696
|
+
it('gates on the real tmux session-name form by resolving its canonical issue URL', async () => {
|
|
697
|
+
const REAL_TMUX_SESSION =
|
|
698
|
+
'https_//github_com/HiromiShikata/repo/issues/2355';
|
|
699
|
+
const CANONICAL_ISSUE_URL =
|
|
700
|
+
'https://github.com/HiromiShikata/repo/issues/2355';
|
|
701
|
+
setupSilentMainSession(REAL_TMUX_SESSION);
|
|
702
|
+
mockHubTaskStatusResolver.getIssueByUrl.mockResolvedValue(
|
|
703
|
+
issueFor({
|
|
704
|
+
url: CANONICAL_ISSUE_URL,
|
|
705
|
+
state: 'OPEN',
|
|
706
|
+
status: ACTIVE_STATUS,
|
|
707
|
+
}),
|
|
708
|
+
);
|
|
709
|
+
|
|
710
|
+
await useCase.run(runParams({ activeHubTaskStatus: ACTIVE_STATUS }));
|
|
711
|
+
|
|
712
|
+
expect(mockHubTaskStatusResolver.getIssueByUrl).toHaveBeenCalledWith(
|
|
713
|
+
CANONICAL_ISSUE_URL,
|
|
714
|
+
);
|
|
715
|
+
expect(
|
|
716
|
+
mockNotificationRepository.sendSelfCheckNotification,
|
|
717
|
+
).toHaveBeenCalledWith(REAL_TMUX_SESSION, MAIN_STALLED_SECTION);
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
it('skips the real tmux session-name form when its canonical hub task is no longer active', async () => {
|
|
721
|
+
const REAL_TMUX_SESSION =
|
|
722
|
+
'https_//github_com/HiromiShikata/repo/issues/2355';
|
|
723
|
+
const CANONICAL_ISSUE_URL =
|
|
724
|
+
'https://github.com/HiromiShikata/repo/issues/2355';
|
|
725
|
+
setupSilentMainSession(REAL_TMUX_SESSION);
|
|
726
|
+
mockHubTaskStatusResolver.getIssueByUrl.mockResolvedValue(
|
|
727
|
+
issueFor({
|
|
728
|
+
url: CANONICAL_ISSUE_URL,
|
|
729
|
+
state: 'OPEN',
|
|
730
|
+
status: 'Todo',
|
|
731
|
+
}),
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
await useCase.run(runParams({ activeHubTaskStatus: ACTIVE_STATUS }));
|
|
735
|
+
|
|
736
|
+
expect(mockHubTaskStatusResolver.getIssueByUrl).toHaveBeenCalledWith(
|
|
737
|
+
CANONICAL_ISSUE_URL,
|
|
738
|
+
);
|
|
739
|
+
expect(
|
|
740
|
+
mockNotificationRepository.sendSelfCheckNotification,
|
|
741
|
+
).not.toHaveBeenCalled();
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
it('parses a clean github.com issue URL session name and rejects non-github names', () => {
|
|
697
745
|
expect(parseHubTaskIssueUrlFromSessionName(HUB_TASK_SESSION)).toBe(
|
|
698
746
|
HUB_TASK_SESSION,
|
|
699
747
|
);
|
|
700
748
|
expect(parseHubTaskIssueUrlFromSessionName('workbench')).toBeNull();
|
|
749
|
+
expect(
|
|
750
|
+
parseHubTaskIssueUrlFromSessionName(
|
|
751
|
+
'https://example.com/HiromiShikata/repo/issues/42',
|
|
752
|
+
),
|
|
753
|
+
).toBeNull();
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
it('parses the real tmux session-name form produced by toTmuxSessionName for an issue', () => {
|
|
757
|
+
expect(
|
|
758
|
+
parseHubTaskIssueUrlFromSessionName(
|
|
759
|
+
'https_//github_com/HiromiShikata/repo/issues/2355',
|
|
760
|
+
),
|
|
761
|
+
).toBe('https://github.com/HiromiShikata/repo/issues/2355');
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
it('parses the real tmux session-name form for a pull request', () => {
|
|
765
|
+
expect(
|
|
766
|
+
parseHubTaskIssueUrlFromSessionName(
|
|
767
|
+
'https_//github_com/HiromiShikata/repo/pull/2474',
|
|
768
|
+
),
|
|
769
|
+
).toBe('https://github.com/HiromiShikata/repo/pull/2474');
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
it('accepts a clean github.com pull URL session name', () => {
|
|
701
773
|
expect(
|
|
702
774
|
parseHubTaskIssueUrlFromSessionName(
|
|
703
775
|
'https://github.com/HiromiShikata/repo/pull/42',
|
|
704
776
|
),
|
|
777
|
+
).toBe('https://github.com/HiromiShikata/repo/pull/42');
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
it('rejects an encoded non-github host or a non-issue/pull path', () => {
|
|
781
|
+
expect(
|
|
782
|
+
parseHubTaskIssueUrlFromSessionName(
|
|
783
|
+
'https_//example_com/HiromiShikata/repo/issues/42',
|
|
784
|
+
),
|
|
705
785
|
).toBeNull();
|
|
706
786
|
expect(
|
|
707
787
|
parseHubTaskIssueUrlFromSessionName(
|
|
708
|
-
'
|
|
788
|
+
'https_//github_com/HiromiShikata/repo/discussions/42',
|
|
709
789
|
),
|
|
710
790
|
).toBeNull();
|
|
711
791
|
});
|
|
@@ -16,13 +16,25 @@ export const DEFAULT_SUBAGENT_SILENT_THRESHOLD_SECONDS = 5 * 60;
|
|
|
16
16
|
export const DEFAULT_SUBAGENT_RUNNING_THRESHOLD_SECONDS = 15 * 60;
|
|
17
17
|
export const DEFAULT_NOTIFICATION_STAGGER_SECONDS = 25;
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
/^https:\/\/github\.com\/[^/]
|
|
19
|
+
const GITHUB_ISSUE_OR_PULL_URL_PATTERN =
|
|
20
|
+
/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/(?:issues|pull)\/(\d+)$/;
|
|
21
|
+
|
|
22
|
+
const GITHUB_TMUX_SESSION_NAME_PATTERN =
|
|
23
|
+
/^https_\/\/github_com\/([^/]+)\/([^/]+)\/(?:issues|pull)\/(\d+)$/;
|
|
21
24
|
|
|
22
25
|
export const parseHubTaskIssueUrlFromSessionName = (
|
|
23
26
|
sessionName: string,
|
|
24
27
|
): string | null => {
|
|
25
|
-
|
|
28
|
+
if (GITHUB_ISSUE_OR_PULL_URL_PATTERN.test(sessionName)) {
|
|
29
|
+
return sessionName;
|
|
30
|
+
}
|
|
31
|
+
const tmuxMatch = GITHUB_TMUX_SESSION_NAME_PATTERN.exec(sessionName);
|
|
32
|
+
if (tmuxMatch === null) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const [, owner, repo, number] = tmuxMatch;
|
|
36
|
+
const target = sessionName.includes('/pull/') ? 'pull' : 'issues';
|
|
37
|
+
return `https://github.com/${owner}/${repo}/${target}/${number}`;
|
|
26
38
|
};
|
|
27
39
|
|
|
28
40
|
const GITHUB_ISSUE_OR_PULL_REQUEST_SESSION_NAME_PATTERN =
|
|
@@ -191,6 +203,7 @@ export class NotifySilentLiveSessionsUseCase {
|
|
|
191
203
|
const subAgentsBySessionName =
|
|
192
204
|
await this.subAgentActivityRepository.listSubAgentActivitiesBySessionName(
|
|
193
205
|
sessionNames,
|
|
206
|
+
transcriptPathBySessionName,
|
|
194
207
|
);
|
|
195
208
|
|
|
196
209
|
const sessionNamesWithUnansweredOwnerCall =
|
|
@@ -3,5 +3,6 @@ import { SubAgentActivity } from '../../entities/LiveSessionActivitySnapshot';
|
|
|
3
3
|
export interface SessionSubAgentActivityRepository {
|
|
4
4
|
listSubAgentActivitiesBySessionName: (
|
|
5
5
|
sessionNames: string[],
|
|
6
|
+
transcriptPathBySessionName: Map<string, string>,
|
|
6
7
|
) => Promise<Map<string, SubAgentActivity[]>>;
|
|
7
8
|
}
|
|
@@ -2,6 +2,6 @@ import { SubAgentTranscriptDirectoryResolver } from '../../domain/usecases/adapt
|
|
|
2
2
|
export declare class FileSystemSubAgentTranscriptDirectoryResolver implements SubAgentTranscriptDirectoryResolver {
|
|
3
3
|
private readonly rootDirectory;
|
|
4
4
|
constructor(rootDirectory: string | null);
|
|
5
|
-
resolveSubAgentsDirectory: (
|
|
5
|
+
resolveSubAgentsDirectory: (_sessionName: string, mainTranscriptPath: string | null) => string | null;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=FileSystemSubAgentTranscriptDirectoryResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystemSubAgentTranscriptDirectoryResolver.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,8EAA8E,CAAC;AAEnI,qBAAa,6CAA8C,YAAW,mCAAmC;IAC3F,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,MAAM,GAAG,IAAI;IAEzD,yBAAyB,
|
|
1
|
+
{"version":3,"file":"FileSystemSubAgentTranscriptDirectoryResolver.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/FileSystemSubAgentTranscriptDirectoryResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,8EAA8E,CAAC;AAEnI,qBAAa,6CAA8C,YAAW,mCAAmC;IAC3F,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,MAAM,GAAG,IAAI;IAEzD,yBAAyB,GACvB,cAAc,MAAM,EACpB,oBAAoB,MAAM,GAAG,IAAI,KAChC,MAAM,GAAG,IAAI,CAYd;CACH"}
|
|
@@ -5,7 +5,7 @@ export declare class TranscriptSessionSubAgentActivityRepository implements Sess
|
|
|
5
5
|
private readonly directoryResolver;
|
|
6
6
|
private readonly now;
|
|
7
7
|
constructor(directoryResolver: SubAgentTranscriptDirectoryResolver, now: Date);
|
|
8
|
-
listSubAgentActivitiesBySessionName: (sessionNames: string[]) => Promise<Map<string, SubAgentActivity[]>>;
|
|
8
|
+
listSubAgentActivitiesBySessionName: (sessionNames: string[], transcriptPathBySessionName: Map<string, string>) => Promise<Map<string, SubAgentActivity[]>>;
|
|
9
9
|
private collectActivities;
|
|
10
10
|
private toActivity;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptSessionSubAgentActivityRepository.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4EAA4E,CAAC;AAC/H,OAAO,EAAE,mCAAmC,EAAE,MAAM,8EAA8E,CAAC;AA4DnI,qBAAa,2CAA4C,YAAW,iCAAiC;IAEjG,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,iBAAiB,EAAE,mCAAmC,EACtD,GAAG,EAAE,IAAI;IAG5B,mCAAmC,GACjC,cAAc,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"TranscriptSessionSubAgentActivityRepository.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/TranscriptSessionSubAgentActivityRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4EAA4E,CAAC;AAC/H,OAAO,EAAE,mCAAmC,EAAE,MAAM,8EAA8E,CAAC;AA4DnI,qBAAa,2CAA4C,YAAW,iCAAiC;IAEjG,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,iBAAiB,EAAE,mCAAmC,EACtD,GAAG,EAAE,IAAI;IAG5B,mCAAmC,GACjC,cAAc,MAAM,EAAE,EACtB,6BAA6B,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAC/C,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAmBzC;IAEF,OAAO,CAAC,iBAAiB,CAuBvB;IAEF,OAAO,CAAC,UAAU,CAgChB;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotifySilentLiveSessionsUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/NotifySilentLiveSessionsUseCase.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kCAAkC,EAAE,MAAM,yDAAyD,CAAC;AAC7G,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AACzH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sDAAsD,CAAC;AACvG,OAAO,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1,5 @@
|
|
|
1
1
|
import { SubAgentActivity } from '../../entities/LiveSessionActivitySnapshot';
|
|
2
2
|
export interface SessionSubAgentActivityRepository {
|
|
3
|
-
listSubAgentActivitiesBySessionName: (sessionNames: string[]) => Promise<Map<string, SubAgentActivity[]>>;
|
|
3
|
+
listSubAgentActivitiesBySessionName: (sessionNames: string[], transcriptPathBySessionName: Map<string, string>) => Promise<Map<string, SubAgentActivity[]>>;
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=SessionSubAgentActivityRepository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionSubAgentActivityRepository.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/SessionSubAgentActivityRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,MAAM,WAAW,iCAAiC;IAChD,mCAAmC,EAAE,CACnC,YAAY,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"SessionSubAgentActivityRepository.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/SessionSubAgentActivityRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,MAAM,WAAW,iCAAiC;IAChD,mCAAmC,EAAE,CACnC,YAAY,EAAE,MAAM,EAAE,EACtB,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;CAC/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export interface SubAgentTranscriptDirectoryResolver {
|
|
2
|
-
resolveSubAgentsDirectory: (sessionName: string) => string | null;
|
|
2
|
+
resolveSubAgentsDirectory: (sessionName: string, mainTranscriptPath: string | null) => string | null;
|
|
3
3
|
}
|
|
4
4
|
//# sourceMappingURL=SubAgentTranscriptDirectoryResolver.d.ts.map
|
package/types/domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubAgentTranscriptDirectoryResolver.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mCAAmC;IAClD,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"SubAgentTranscriptDirectoryResolver.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/SubAgentTranscriptDirectoryResolver.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mCAAmC;IAClD,yBAAyB,EAAE,CACzB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,GAAG,IAAI,KAC9B,MAAM,GAAG,IAAI,CAAC;CACpB"}
|