@moberg_hr/work-tree 2.9.1 → 2.9.2
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/dist/{account-RTOXCLE6.js → account-3A7RQSUC.js} +9 -8
- package/dist/{account-RTOXCLE6.js.map → account-3A7RQSUC.js.map} +1 -1
- package/dist/{add-repo-AA3XTOZT.js → add-repo-YGDJZ6HG.js} +6 -6
- package/dist/{answer-NT62U5MY.js → answer-GHVFFKNF.js} +4 -4
- package/dist/{attach-HKVFNOOK.js → attach-LWOZKLTF.js} +7 -6
- package/dist/{attach-HKVFNOOK.js.map → attach-LWOZKLTF.js.map} +1 -1
- package/dist/bin.js +2 -2
- package/dist/{block-YZQGJMLI.js → block-WVUT63QY.js} +5 -5
- package/dist/{broadcast-2NOVIUZI.js → broadcast-WM423JGR.js} +2 -2
- package/dist/{catchup-LZ5FMXEO.js → catchup-KJZTLHN7.js} +7 -7
- package/dist/{chunk-7NZC7EAP.js → chunk-2YXY6S7G.js} +5 -5
- package/dist/{chunk-BGKHI4FC.js → chunk-4BZGUMP7.js} +2 -2
- package/dist/chunk-4MVT7QPZ.js +9 -0
- package/dist/{chunk-SXPC4FQM.js → chunk-4SZ7YW7N.js} +49 -49
- package/dist/{chunk-VNNAKJZA.js → chunk-5NKXGQX4.js} +8 -8
- package/dist/{chunk-N7EHLEYG.js → chunk-5WEBLABB.js} +2 -2
- package/dist/{chunk-4GVXOUVN.js → chunk-6IUFNTBQ.js} +2 -2
- package/dist/{chunk-AHA65ZCO.js → chunk-AGTVDF4O.js} +2 -2
- package/dist/{chunk-A633PJUP.js → chunk-BV2PPIKP.js} +2 -2
- package/dist/{chunk-RCZZAQFN.js → chunk-BWD24JIP.js} +3 -3
- package/dist/{chunk-FK2ZZUR5.js → chunk-F4EWBHTA.js} +4 -73
- package/dist/chunk-F4EWBHTA.js.map +1 -0
- package/dist/{chunk-T22E35FV.js → chunk-GBMY7IMP.js} +3 -3
- package/dist/{chunk-T22E35FV.js.map → chunk-GBMY7IMP.js.map} +1 -1
- package/dist/{chunk-JAU62YN5.js → chunk-GJ5V357G.js} +3 -3
- package/dist/{chunk-CYXMVMVO.js → chunk-H7GHJ3CR.js} +222 -8
- package/dist/chunk-H7GHJ3CR.js.map +1 -0
- package/dist/{chunk-7POCHRUP.js → chunk-HP2QVRSQ.js} +4 -4
- package/dist/{chunk-HJZSMSP4.js → chunk-JB6LU6JV.js} +4 -4
- package/dist/{chunk-T6BX6B5B.js → chunk-JWWG624P.js} +2 -2
- package/dist/chunk-K2MOQVTJ.js +78 -0
- package/dist/chunk-K2MOQVTJ.js.map +1 -0
- package/dist/{chunk-MVMLNEHM.js → chunk-KVQNJCXH.js} +3 -3
- package/dist/{chunk-IGC64EGV.js → chunk-LIE5GVDG.js} +5 -5
- package/dist/{chunk-IJSW2U6U.js → chunk-PKXHK5CJ.js} +2 -2
- package/dist/{chunk-FXWY22ZP.js → chunk-RG7NJEN7.js} +5 -5
- package/dist/{chunk-RVT4435Z.js → chunk-SBLK524A.js} +1 -1
- package/dist/chunk-SBLK524A.js.map +1 -0
- package/dist/{chunk-ODBA4PVE.js → chunk-SWKTDMLL.js} +3 -3
- package/dist/{chunk-HKK3WUPZ.js → chunk-TQOHPNDW.js} +2 -2
- package/dist/{chunk-ZJSEDIFT.js → chunk-TR7CTHJA.js} +3 -3
- package/dist/{chunk-BDFAIHTM.js → chunk-UB3DOOPB.js} +3 -3
- package/dist/{chunk-4OK2WJ2B.js → chunk-V4IHZJD4.js} +4 -4
- package/dist/{chunk-QNH6ZRFV.js → chunk-VGRZKBUK.js} +2 -2
- package/dist/{chunk-PGZMPB2Q.js → chunk-VUNJVF6C.js} +2 -2
- package/dist/{chunk-4WG66W6U.js → chunk-XEAFWIN6.js} +3 -3
- package/dist/{chunk-6KOJSRML.js → chunk-XMWVBLMJ.js} +2 -2
- package/dist/{chunk-UJWMBDFX.js → chunk-XTDTM6JI.js} +2 -2
- package/dist/{chunk-J4Y7DKQN.js → chunk-YHSB7IVZ.js} +2 -2
- package/dist/{chunk-GEGRI67Z.js → chunk-Z2XY3PLX.js} +3 -3
- package/dist/{chunk-7OTYC7T5.js → chunk-ZGT4ZDGG.js} +3 -3
- package/dist/{cleanup-6NOT6VTS.js → cleanup-7E3YWQUC.js} +15 -14
- package/dist/{cleanup-6NOT6VTS.js.map → cleanup-7E3YWQUC.js.map} +1 -1
- package/dist/{cli-PAICDKJT.js → cli-BHIBPUQG.js} +3 -3
- package/dist/{config-U4SGJ7RB.js → config-TUJNIUIO.js} +3 -3
- package/dist/{diff-CYXW5YWD.js → diff-PZKOXAU3.js} +4 -4
- package/dist/{digest-KRIBJHII.js → digest-XHDDBXA6.js} +4 -4
- package/dist/{fork-LQYEB4A4.js → fork-HYWZW72R.js} +13 -12
- package/dist/{fork-LQYEB4A4.js.map → fork-HYWZW72R.js.map} +1 -1
- package/dist/{history-DCALTZMM.js → history-MRRY2VTS.js} +2 -2
- package/dist/{hook-MDFVVCD2.js → hook-OWP4H2MT.js} +5 -4
- package/dist/{hook-MDFVVCD2.js.map → hook-OWP4H2MT.js.map} +1 -1
- package/dist/{hydrate-KBWZSSBL.js → hydrate-ZTGARW3U.js} +2 -2
- package/dist/{init-R47WGD62.js → init-7VISW3JJ.js} +3 -3
- package/dist/{list-X5YB4JRL.js → list-5XWYT37A.js} +2 -2
- package/dist/{move-WSK5UU5T.js → move-PSAODKRK.js} +4 -4
- package/dist/{note-VMO2PKYX.js → note-7WQ2YC2F.js} +4 -4
- package/dist/{overlaps-ZNZTQHU7.js → overlaps-R27DEX36.js} +4 -4
- package/dist/{pin-RGRNNJUL.js → pin-LS4WPLOE.js} +4 -4
- package/dist/{pr-B2V3N3SV.js → pr-SMEC5O7O.js} +5 -4
- package/dist/{pr-B2V3N3SV.js.map → pr-SMEC5O7O.js.map} +1 -1
- package/dist/{prune-M2MYPNI6.js → prune-VA3V5B2I.js} +13 -12
- package/dist/{prune-M2MYPNI6.js.map → prune-VA3V5B2I.js.map} +1 -1
- package/dist/{pty-host-I2I7SVOL.js → pty-host-PN4A3X2Y.js} +4 -3
- package/dist/{pty-host-I2I7SVOL.js.map → pty-host-PN4A3X2Y.js.map} +1 -1
- package/dist/{read-E22APCUR.js → read-75DP75TI.js} +4 -4
- package/dist/{recent-F3Z3JXFX.js → recent-YDSLMD6Y.js} +2 -2
- package/dist/{remove-YGVUESDY.js → remove-XPSU2VTR.js} +12 -11
- package/dist/{remove-YGVUESDY.js.map → remove-XPSU2VTR.js.map} +1 -1
- package/dist/{restart-BAGGJDD2.js → restart-7EPW5VDV.js} +4 -4
- package/dist/{resume-PIFCI727.js → resume-26Y6G4UT.js} +2 -2
- package/dist/{run-MW3QTOXU.js → run-IIURYUD2.js} +2 -2
- package/dist/{screen-UILBPWSR.js → screen-AORRCOZQ.js} +4 -4
- package/dist/{search-DLZEPI4I.js → search-Z3XD7ZNQ.js} +2 -2
- package/dist/{section-A5JKTX4J.js → section-6N7J4Y6J.js} +4 -4
- package/dist/{send-EPPQKYOK.js → send-SHHXHICL.js} +5 -5
- package/dist/{sessions-3HLVK6HG.js → sessions-AD5HPY2L.js} +10 -9
- package/dist/{sessions-3HLVK6HG.js.map → sessions-AD5HPY2L.js.map} +1 -1
- package/dist/{snooze-GA46Z56G.js → snooze-JZMIVMNS.js} +4 -4
- package/dist/{start-L6G3NC2J.js → start-6VNWRLPK.js} +4 -4
- package/dist/{status-H5S3DZBI.js → status-YRBJR4YB.js} +2 -2
- package/dist/{stop-HQLHTY5V.js → stop-A2Q4CO6Z.js} +4 -4
- package/dist/{sync-N2CDSJA4.js → sync-GXXBOQ4W.js} +13 -12
- package/dist/{sync-N2CDSJA4.js.map → sync-GXXBOQ4W.js.map} +1 -1
- package/dist/{time-H54NH62B.js → time-XKEMSDMN.js} +5 -5
- package/dist/{timesheet-PAS5SHPD.js → timesheet-ZAZXN6LK.js} +6 -6
- package/dist/{tree-7EBS7PVA.js → tree-HJGFWO6G.js} +8 -7
- package/dist/{tree-7EBS7PVA.js.map → tree-HJGFWO6G.js.map} +1 -1
- package/dist/{update-M7ECF7UE.js → update-6427PE7F.js} +6 -6
- package/dist/{usage-IFKUY6LC.js → usage-HIXH42ZH.js} +4 -4
- package/dist/{wait-K3NSSNFR.js → wait-VHPP2B7P.js} +5 -5
- package/dist/wd-bin.js +2 -2
- package/dist/web/assets/{PtyView-Cg5gjgaQ.js → PtyView-B7zFUh_M.js} +25 -25
- package/dist/web/assets/PtyView-B7zFUh_M.js.map +1 -0
- package/dist/web/assets/{index-BOyg0f4L.css → index-BAxeogV4.css} +1 -1
- package/dist/web/assets/index-C4cR3Hwy.js +120 -0
- package/dist/web/assets/index-C4cR3Hwy.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-U34XTVBA.js → web-QTXU66K5.js} +69 -205
- package/dist/web-QTXU66K5.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-CYXMVMVO.js.map +0 -1
- package/dist/chunk-FK2ZZUR5.js.map +0 -1
- package/dist/chunk-MYXLQMF7.js +0 -9
- package/dist/chunk-RVT4435Z.js.map +0 -1
- package/dist/web/assets/PtyView-Cg5gjgaQ.js.map +0 -1
- package/dist/web/assets/index-CBK3PI8Y.js +0 -119
- package/dist/web/assets/index-CBK3PI8Y.js.map +0 -1
- package/dist/web-U34XTVBA.js.map +0 -1
- /package/dist/{add-repo-AA3XTOZT.js.map → add-repo-YGDJZ6HG.js.map} +0 -0
- /package/dist/{answer-NT62U5MY.js.map → answer-GHVFFKNF.js.map} +0 -0
- /package/dist/{block-YZQGJMLI.js.map → block-WVUT63QY.js.map} +0 -0
- /package/dist/{broadcast-2NOVIUZI.js.map → broadcast-WM423JGR.js.map} +0 -0
- /package/dist/{catchup-LZ5FMXEO.js.map → catchup-KJZTLHN7.js.map} +0 -0
- /package/dist/{chunk-7NZC7EAP.js.map → chunk-2YXY6S7G.js.map} +0 -0
- /package/dist/{chunk-BGKHI4FC.js.map → chunk-4BZGUMP7.js.map} +0 -0
- /package/dist/{chunk-MYXLQMF7.js.map → chunk-4MVT7QPZ.js.map} +0 -0
- /package/dist/{chunk-SXPC4FQM.js.map → chunk-4SZ7YW7N.js.map} +0 -0
- /package/dist/{chunk-VNNAKJZA.js.map → chunk-5NKXGQX4.js.map} +0 -0
- /package/dist/{chunk-N7EHLEYG.js.map → chunk-5WEBLABB.js.map} +0 -0
- /package/dist/{chunk-4GVXOUVN.js.map → chunk-6IUFNTBQ.js.map} +0 -0
- /package/dist/{chunk-AHA65ZCO.js.map → chunk-AGTVDF4O.js.map} +0 -0
- /package/dist/{chunk-A633PJUP.js.map → chunk-BV2PPIKP.js.map} +0 -0
- /package/dist/{chunk-RCZZAQFN.js.map → chunk-BWD24JIP.js.map} +0 -0
- /package/dist/{chunk-JAU62YN5.js.map → chunk-GJ5V357G.js.map} +0 -0
- /package/dist/{chunk-7POCHRUP.js.map → chunk-HP2QVRSQ.js.map} +0 -0
- /package/dist/{chunk-HJZSMSP4.js.map → chunk-JB6LU6JV.js.map} +0 -0
- /package/dist/{chunk-T6BX6B5B.js.map → chunk-JWWG624P.js.map} +0 -0
- /package/dist/{chunk-MVMLNEHM.js.map → chunk-KVQNJCXH.js.map} +0 -0
- /package/dist/{chunk-IGC64EGV.js.map → chunk-LIE5GVDG.js.map} +0 -0
- /package/dist/{chunk-IJSW2U6U.js.map → chunk-PKXHK5CJ.js.map} +0 -0
- /package/dist/{chunk-FXWY22ZP.js.map → chunk-RG7NJEN7.js.map} +0 -0
- /package/dist/{chunk-ODBA4PVE.js.map → chunk-SWKTDMLL.js.map} +0 -0
- /package/dist/{chunk-HKK3WUPZ.js.map → chunk-TQOHPNDW.js.map} +0 -0
- /package/dist/{chunk-ZJSEDIFT.js.map → chunk-TR7CTHJA.js.map} +0 -0
- /package/dist/{chunk-BDFAIHTM.js.map → chunk-UB3DOOPB.js.map} +0 -0
- /package/dist/{chunk-4OK2WJ2B.js.map → chunk-V4IHZJD4.js.map} +0 -0
- /package/dist/{chunk-QNH6ZRFV.js.map → chunk-VGRZKBUK.js.map} +0 -0
- /package/dist/{chunk-PGZMPB2Q.js.map → chunk-VUNJVF6C.js.map} +0 -0
- /package/dist/{chunk-4WG66W6U.js.map → chunk-XEAFWIN6.js.map} +0 -0
- /package/dist/{chunk-6KOJSRML.js.map → chunk-XMWVBLMJ.js.map} +0 -0
- /package/dist/{chunk-UJWMBDFX.js.map → chunk-XTDTM6JI.js.map} +0 -0
- /package/dist/{chunk-J4Y7DKQN.js.map → chunk-YHSB7IVZ.js.map} +0 -0
- /package/dist/{chunk-GEGRI67Z.js.map → chunk-Z2XY3PLX.js.map} +0 -0
- /package/dist/{chunk-7OTYC7T5.js.map → chunk-ZGT4ZDGG.js.map} +0 -0
- /package/dist/{cli-PAICDKJT.js.map → cli-BHIBPUQG.js.map} +0 -0
- /package/dist/{config-U4SGJ7RB.js.map → config-TUJNIUIO.js.map} +0 -0
- /package/dist/{diff-CYXW5YWD.js.map → diff-PZKOXAU3.js.map} +0 -0
- /package/dist/{digest-KRIBJHII.js.map → digest-XHDDBXA6.js.map} +0 -0
- /package/dist/{history-DCALTZMM.js.map → history-MRRY2VTS.js.map} +0 -0
- /package/dist/{hydrate-KBWZSSBL.js.map → hydrate-ZTGARW3U.js.map} +0 -0
- /package/dist/{init-R47WGD62.js.map → init-7VISW3JJ.js.map} +0 -0
- /package/dist/{list-X5YB4JRL.js.map → list-5XWYT37A.js.map} +0 -0
- /package/dist/{move-WSK5UU5T.js.map → move-PSAODKRK.js.map} +0 -0
- /package/dist/{note-VMO2PKYX.js.map → note-7WQ2YC2F.js.map} +0 -0
- /package/dist/{overlaps-ZNZTQHU7.js.map → overlaps-R27DEX36.js.map} +0 -0
- /package/dist/{pin-RGRNNJUL.js.map → pin-LS4WPLOE.js.map} +0 -0
- /package/dist/{read-E22APCUR.js.map → read-75DP75TI.js.map} +0 -0
- /package/dist/{recent-F3Z3JXFX.js.map → recent-YDSLMD6Y.js.map} +0 -0
- /package/dist/{restart-BAGGJDD2.js.map → restart-7EPW5VDV.js.map} +0 -0
- /package/dist/{resume-PIFCI727.js.map → resume-26Y6G4UT.js.map} +0 -0
- /package/dist/{run-MW3QTOXU.js.map → run-IIURYUD2.js.map} +0 -0
- /package/dist/{screen-UILBPWSR.js.map → screen-AORRCOZQ.js.map} +0 -0
- /package/dist/{search-DLZEPI4I.js.map → search-Z3XD7ZNQ.js.map} +0 -0
- /package/dist/{section-A5JKTX4J.js.map → section-6N7J4Y6J.js.map} +0 -0
- /package/dist/{send-EPPQKYOK.js.map → send-SHHXHICL.js.map} +0 -0
- /package/dist/{snooze-GA46Z56G.js.map → snooze-JZMIVMNS.js.map} +0 -0
- /package/dist/{start-L6G3NC2J.js.map → start-6VNWRLPK.js.map} +0 -0
- /package/dist/{status-H5S3DZBI.js.map → status-YRBJR4YB.js.map} +0 -0
- /package/dist/{stop-HQLHTY5V.js.map → stop-A2Q4CO6Z.js.map} +0 -0
- /package/dist/{time-H54NH62B.js.map → time-XKEMSDMN.js.map} +0 -0
- /package/dist/{timesheet-PAS5SHPD.js.map → timesheet-ZAZXN6LK.js.map} +0 -0
- /package/dist/{update-M7ECF7UE.js.map → update-6427PE7F.js.map} +0 -0
- /package/dist/{usage-IFKUY6LC.js.map → usage-HIXH42ZH.js.map} +0 -0
- /package/dist/{wait-K3NSSNFR.js.map → wait-VHPP2B7P.js.map} +0 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moberg_hr/work-tree",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@moberg_hr/work-tree",
|
|
9
|
-
"version": "2.9.
|
|
9
|
+
"version": "2.9.2",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/pr/pr-watch-store.ts","../src/core/pr/pr-replies.ts"],"sourcesContent":["import { json, withDb } from '../platform/db.js';\nimport type { SessionCi } from '../api-types.js';\n\n/**\n * What the PR watch has already acted on, per session: state.db's\n * `pr_watch_seen` (session_id, key). Keys are review-comment ids, per-PR\n * baselines, and CI head commits already reported (see pr-watch.ts /\n * pr-review.ts). Removed with the session (db.ts purgeSessionRows); no cap.\n *\n * No in-memory cache: each check is one primary-key lookup, and a cache\n * outlived the session it belonged to — a session removed and re-created\n * with the same target:branch inherited the old keys and had its review\n * comments and CI failures suppressed.\n */\n\n/** A per-session seen-store. (Structurally the SeenStore of pr-review.ts —\n * not imported, to keep the ship/history types out of an import cycle.) */\nexport function createSeenStores(): (sessionId: string) => { has: (k: string) => boolean; add: (k: string) => void } {\n return (sessionId) => ({\n has: (k) => withDb((d) => d.prepare('SELECT 1 FROM pr_watch_seen WHERE session_id = ? AND key = ?').get(sessionId, k)) !== undefined,\n add: (k) => {\n try {\n withDb((d) => d.prepare('INSERT OR IGNORE INTO pr_watch_seen (session_id, key) VALUES (?, ?)').run(sessionId, k));\n } catch {\n /* best-effort: worst case something is reported twice */\n }\n },\n });\n}\n\n/**\n * The PR watch's last check of each session: state.db's `pr_watch_state`\n * (session_id, data), removed with the session. Kept so a restarted work web\n * shows each session's PRs at once rather than after its first sweep reaches\n * it (a minute or two with many sessions); that sweep then replaces it.\n */\nexport interface CiStore {\n load(): Array<[string, SessionCi]>;\n save(sessionId: string, ci: SessionCi): void;\n}\n\nconst isObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);\nconst PR_STATES = new Set(['OPEN', 'MERGED', 'CLOSED']);\n\n/** A stored open thread as the watch wrote it (`OpenReviewThread`). */\nfunction isOpenThread(t: unknown): boolean {\n return (\n isObject(t) &&\n ['threadId', 'repo', 'url', 'reviewer', 'excerpt'].every((k) => typeof t[k] === 'string') &&\n typeof t.prNumber === 'number' &&\n (t.where === null || typeof t.where === 'string') &&\n (t.trusted === undefined || typeof t.trusted === 'boolean')\n );\n}\n\n/** A stored check as the watch wrote it (the fields its readers rely on, its open threads' too); anything else is dropped. */\nexport function isSessionCi(v: unknown): v is SessionCi {\n if (!isObject(v) || typeof v.checkedAt !== 'string' || !Array.isArray(v.repos)) return false;\n return v.repos.every(\n (r) =>\n isObject(r) &&\n typeof r.name === 'string' &&\n typeof r.done === 'boolean' &&\n (r.pr === null ||\n (isObject(r.pr) &&\n typeof r.pr.number === 'number' &&\n typeof r.pr.url === 'string' &&\n typeof r.pr.state === 'string' &&\n PR_STATES.has(r.pr.state) &&\n typeof r.pr.headSha === 'string')) &&\n (r.openThreads === undefined || typeof r.openThreads === 'number') &&\n (r.threads === undefined || (Array.isArray(r.threads) && r.threads.every(isOpenThread))),\n );\n}\n\nexport function createCiStore(): CiStore {\n return {\n load() {\n let rows: Array<{ session_id: string; data: string }>;\n try {\n rows = withDb((d) => d.prepare('SELECT session_id, data FROM pr_watch_state').all() as Array<{ session_id: string; data: string }>);\n } catch {\n return []; // best-effort, as saving is: the sweep fills it in\n }\n const out: Array<[string, SessionCi]> = [];\n for (const r of rows) {\n const ci = json.parse(r.data);\n if (isSessionCi(ci)) out.push([r.session_id, ci]);\n }\n return out;\n },\n save(sessionId, ci) {\n try {\n withDb((d) =>\n d.prepare('INSERT OR REPLACE INTO pr_watch_state (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify(ci)),\n );\n } catch {\n /* best-effort: a restart then waits for the sweep, as before */\n }\n },\n };\n}\n","import { json, tx, withDb, type Db } from '../platform/db.js';\nimport type { PrReply, SessionCi } from '../api-types.js';\nimport type { CommandRunner } from './ship.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { isSessionCi } from './pr-watch-store.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\nimport { sessionRepos } from '../sessions/session-repos.js';\nimport { loadConfig } from '../platform/config.js';\nimport { readGitConfig } from '../worktree/repo-scan.js';\nimport { githubRepoOf } from './pr.js';\nimport { checkedOutBranch } from '../git/git-head.js';\n\n/**\n * Replies to PR review threads, drafted by the session's Claude and posted\n * with your yes. The PR watch records each thread it hands over\n * (`rememberSent`); Claude drafts an answer with `work pr reply <thread id>\n * \"<text>\"` (`saveDraft`) and shows you; the dashboard shows the drafts too,\n * editable. What appears on GitHub is in your name, so a draft goes out\n * only once you've said yes: your Post click, or Claude running `work pr\n * post` after you agreed in the conversation (`postDrafts`; never on the\n * assistant's allow list, so Claude Code asks you as well).\n *\n * Rows live in state.db `pr_replies`, keyed by session + thread, and go\n * with the session (purgeSessionRows). A thread the PR watch lists as open\n * for the session (its last check, `pr_watch_state`) can be drafted too:\n * \"Ask Claude to reply\" hands one over as a plain note, with no row here.\n */\n\n/** GitHub review-thread node ids. Checked before a thread id reaches gh or the database. */\nexport const THREAD_ID = /^PRRT_[A-Za-z0-9_-]{4,120}$/;\nexport const MAX_REPLY_CHARS = 20_000;\n\nfunction parseRow(data: string): PrReply | null {\n const v = json.parse(data);\n if (!v || typeof v !== 'object') return null;\n const r = v as Record<string, unknown>;\n const str = (k: string) => typeof r[k] === 'string';\n if (\n !str('threadId') ||\n !str('repo') ||\n typeof r.prNumber !== 'number' ||\n !str('url') ||\n !str('reviewer') ||\n !str('excerpt') ||\n !str('sentAt')\n )\n return null;\n if (r.status !== 'sent' && r.status !== 'draft' && r.status !== 'posted') return null;\n return v as PrReply;\n}\n\nfunction read(sessionId: string, threadId: string): PrReply | null {\n const row = withDb(\n (d) =>\n d.prepare('SELECT data FROM pr_replies WHERE session_id = ? AND thread_id = ?').get(sessionId, threadId) as\n { data: string } | undefined,\n );\n return row ? parseRow(row.data) : null;\n}\n\nexport function listReplies(sessionId: string): PrReply[] {\n const rows = withDb((d) => d.prepare('SELECT data FROM pr_replies WHERE session_id = ?').all(sessionId) as Array<{ data: string }>);\n return rows\n .map((r) => parseRow(r.data))\n .filter((r): r is PrReply => r !== null)\n .sort((a, b) => a.sentAt.localeCompare(b.sentAt));\n}\n\n/** Drafts waiting for you, per session (one query for the whole session list). */\nexport function draftCounts(): Map<string, number> {\n const rows = withDb((d) => d.prepare('SELECT session_id, data FROM pr_replies').all() as Array<{ session_id: string; data: string }>);\n const out = new Map<string, number>();\n for (const r of rows) if (parseRow(r.data)?.status === 'draft') out.set(r.session_id, (out.get(r.session_id) ?? 0) + 1);\n return out;\n}\n\n/**\n * The threads just handed to the session's Claude. A thread seen again —\n * a reviewer answered in it — starts over: the old draft answered\n * something else.\n */\nexport function rememberSent(\n sessionId: string,\n threads: Array<Pick<PrReply, 'threadId' | 'repo' | 'prNumber' | 'url' | 'where' | 'reviewer' | 'excerpt'>>,\n now = new Date(),\n): void {\n tx((d) => {\n const put = d.prepare('INSERT OR REPLACE INTO pr_replies (session_id, thread_id, data) VALUES (?, ?, ?)');\n for (const t of threads) {\n if (!THREAD_ID.test(t.threadId)) continue;\n const row: PrReply = { ...t, status: 'sent', draft: null, sentAt: now.toISOString() };\n put.run(sessionId, t.threadId, JSON.stringify(row));\n }\n });\n}\n\nexport type DraftResult = { ok: true; reply: PrReply } | { ok: false; error: string };\n\n/**\n * The thread as the PR watch's last check of the session lists it, open (as of `checkedAt`): a reply's row is\n * made from it, never from what the drafter typed.\n */\nfunction openThreadOf(d: Db, sessionId: string, threadId: string, now: Date): { reply: PrReply; checkedAt: string } | null {\n const row = d.prepare('SELECT data FROM pr_watch_state WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const ci = row ? json.parse(row.data) : null;\n if (!isSessionCi(ci)) return null;\n for (const r of ci.repos) {\n const t = r.threads?.find((x) => x.threadId === threadId);\n if (!t) continue;\n const { repo, prNumber, url, where, reviewer, excerpt } = t;\n const reply: PrReply = {\n threadId,\n repo,\n prNumber,\n url,\n where,\n reviewer,\n excerpt,\n status: 'sent',\n draft: null,\n sentAt: now.toISOString(),\n };\n return { reply, checkedAt: ci.checkedAt };\n }\n return null;\n}\n\n/**\n * Claude's (or your edited) answer to a thread it was handed, or one the PR watch lists as open for the session.\n * A thread answered before and listed open again since (the reviewer answered) starts over, as `rememberSent` does.\n * A session launched `--unsafe` (`opts.unsafe`) drafts only what the watch handed it: review text never reaches it.\n */\nexport function saveDraft(\n sessionId: string,\n threadId: string,\n body: string,\n now = new Date(),\n opts: { unsafe?: boolean; live?: PrReply } = {},\n): DraftResult {\n if (!THREAD_ID.test(threadId)) return { ok: false, error: `not a review thread id: ${threadId}` };\n const text = body.trim();\n if (!text) return { ok: false, error: 'the reply is empty' };\n if (text.length > MAX_REPLY_CHARS) return { ok: false, error: `the reply is over ${MAX_REPLY_CHARS} characters` };\n return tx((d) => {\n const row = d.prepare('SELECT data FROM pr_replies WHERE session_id = ? AND thread_id = ?').get(sessionId, threadId) as\n { data: string } | undefined;\n const handed = row ? parseRow(row.data) : null;\n const listed = opts.unsafe ? null : openThreadOf(d, sessionId, threadId, now);\n const raisedAgain =\n handed?.status === 'posted' && listed && Date.parse(listed.checkedAt) > Date.parse(handed.postedAt ?? '') ? listed.reply : null;\n // `live`: read from GitHub just now (draftReply), when work's last check hadn't it.\n const cur = raisedAgain ?? (handed?.status === 'posted' && opts.live ? opts.live : (handed ?? listed?.reply ?? opts.live ?? null));\n if (!cur)\n return {\n ok: false,\n error: `thread ${threadId} isn't an open review thread of this session's pull requests (as work last checked them)`,\n } as const;\n if (cur.status === 'posted') return { ok: false, error: 'a reply to this thread was already posted' } as const;\n const next: PrReply = { ...cur, status: 'draft', draft: text, draftedAt: now.toISOString() };\n d.prepare('INSERT OR REPLACE INTO pr_replies (session_id, thread_id, data) VALUES (?, ?, ?)').run(\n sessionId,\n threadId,\n JSON.stringify(next),\n );\n return { ok: true, reply: next } as const;\n });\n}\n\nexport function discardReply(sessionId: string, threadId: string): boolean {\n return withDb((d) => d.prepare('DELETE FROM pr_replies WHERE session_id = ? AND thread_id = ?').run(sessionId, threadId).changes > 0);\n}\n\nfunction markPosted(sessionId: string, threadId: string, body: string, postedUrl: string, resolved: boolean): void {\n tx((d) => {\n const row = d.prepare('SELECT data FROM pr_replies WHERE session_id = ? AND thread_id = ?').get(sessionId, threadId) as\n { data: string } | undefined;\n const cur = row ? parseRow(row.data) : null;\n if (!cur) return;\n const next: PrReply = { ...cur, status: 'posted', draft: body, postedAt: new Date().toISOString(), postedUrl, resolved };\n d.prepare('UPDATE pr_replies SET data = ? WHERE session_id = ? AND thread_id = ?').run(JSON.stringify(next), sessionId, threadId);\n });\n}\n\nconst ADD_REPLY = `mutation($threadId: ID!, $body: String!) {\n addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) { comment { url } }\n}`;\nconst RESOLVE = `mutation($threadId: ID!) { resolveReviewThread(input: { threadId: $threadId }) { thread { isResolved } } }`;\n/** The thread as it is now, and who you are: the last check before a reply goes out. */\nconst THREAD_NOW = `query($threadId: ID!) {\n viewer { login }\n node(id: $threadId) { ... on PullRequestReviewThread { isResolved comments(last: 1) { nodes { author { login } } } } }\n}`;\n\n/**\n * Why a reply mustn't go out now, from the thread as GitHub has it: the last\n * word in it is already yours (you'd be answering yourself — a PR author's\n * own comment, handed over as if a reviewer's), or it was resolved since.\n * Null to go ahead. When gh can't say, it isn't posted (it'd be in your name). Exported for tests.\n */\nexport async function threadRefusal(threadId: string, cwd: string, run: CommandRunner): Promise<string | null> {\n const r = await run('gh', ['api', 'graphql', '-f', `query=${THREAD_NOW}`, '-f', `threadId=${threadId}`], cwd);\n if (r.code !== 0) return `couldn't read the thread on GitHub first: ${r.stderr.trim() || 'gh failed'}`;\n const j = json.parse(r.stdout) as {\n data?: {\n viewer?: { login?: unknown };\n node?: { isResolved?: unknown; comments?: { nodes?: Array<{ author?: { login?: unknown } | null } | null> } } | null;\n };\n } | null;\n const me = j?.data?.viewer?.login;\n const node = j?.data?.node;\n if (typeof me !== 'string' || !me || !node) return \"couldn't read the thread on GitHub first\";\n if (node.isResolved === true) return 'the thread was resolved on GitHub since: nothing to answer';\n const last = node.comments?.nodes?.at(-1)?.author?.login;\n if (typeof last === 'string' && last.toLowerCase() === me.toLowerCase())\n return 'the last word in this thread is already yours (@' + me + '): a reply would answer yourself';\n return null;\n}\n\nexport type PostResult = { ok: true; url: string; resolved: boolean } | { ok: false; error: string };\n\n/**\n * Post the reply from your GitHub account (gh), then resolve the thread if\n * asked. Run on your yes: the Post route (a POST behind the local-origin\n * guard) or `work pr post`. It re-reads the row first.\n */\nexport async function postReply(\n sessionId: string,\n threadId: string,\n body: string,\n opts: { resolve: boolean; cwd: string; run: CommandRunner },\n): Promise<PostResult> {\n if (!THREAD_ID.test(threadId)) return { ok: false, error: 'not a review thread id' };\n const text = body.trim();\n if (!text || text.length > MAX_REPLY_CHARS) return { ok: false, error: 'the reply is empty or too long' };\n const cur = read(sessionId, threadId);\n if (!cur) return { ok: false, error: 'no such thread for this session' };\n if (cur.status === 'posted') return { ok: false, error: 'already posted' };\n // Whatever handed it over, a reply never answers your own last word (reported: a PR author's\n // Claude answered his own comment, as if a reviewer's), nor a thread resolved meanwhile.\n const refusal = await threadRefusal(threadId, opts.cwd, opts.run);\n if (refusal) return { ok: false, error: refusal };\n // -f: raw strings (never @file / number parsing), argv only (no shell).\n const add = await opts.run(\n 'gh',\n ['api', 'graphql', '-f', `query=${ADD_REPLY}`, '-f', `threadId=${threadId}`, '-f', `body=${text}`],\n opts.cwd,\n );\n if (add.code !== 0) return { ok: false, error: add.stderr.trim() || 'gh could not post the reply' };\n let url = cur.url;\n const parsed = json.parse(add.stdout) as { data?: { addPullRequestReviewThreadReply?: { comment?: { url?: unknown } } } } | null;\n const got = parsed?.data?.addPullRequestReviewThreadReply?.comment?.url;\n if (typeof got === 'string') url = got;\n let resolved = false;\n if (opts.resolve) {\n const r = await opts.run('gh', ['api', 'graphql', '-f', `query=${RESOLVE}`, '-f', `threadId=${threadId}`], opts.cwd);\n resolved = r.code === 0;\n }\n markPosted(sessionId, threadId, text, url, resolved);\n return { ok: true, url, resolved };\n}\n\n/**\n * Post saved drafts as they stand (your edits in the dashboard included):\n * `work pr post`, which a session's Claude runs once you've said yes to\n * them in the conversation. One at a time, each re-checked by postReply.\n */\nexport async function postDrafts(\n session: { target: string; branch: string; paths: string[] },\n drafts: PrReply[],\n resolve: boolean,\n run: CommandRunner,\n): Promise<{ posted: Array<PrReply & { url: string; resolved: boolean }>; failed: Array<{ threadId: string; error: string }> }> {\n const id = sessionIdFor(session);\n const cwd = session.paths.find((p) => p) ?? process.cwd();\n const posted: Array<PrReply & { url: string; resolved: boolean }> = [];\n const failed: Array<{ threadId: string; error: string }> = [];\n for (const d of drafts) {\n const r = await postReply(id, d.threadId, d.draft ?? '', { resolve, cwd, run });\n if (r.ok) posted.push({ ...d, url: r.url, resolved: r.resolved });\n else failed.push({ threadId: d.threadId, error: r.error });\n }\n return { posted, failed };\n}\n\n/**\n * The replies posted after the PR watch last read GitHub (`checkedAt`): the\n * threads they answer still look unanswered in its check. Pure.\n */\nexport function postedSince(replies: PrReply[], checkedAt: string | null | undefined): string[] {\n const since = checkedAt ? Date.parse(checkedAt) : 0;\n return replies.filter((r) => r.status === 'posted' && r.postedAt && Date.parse(r.postedAt) > since).map((r) => r.threadId);\n}\n\n/**\n * A reply went out (your Post, or `work pr post` from the session's\n * Claude): take the threads it answered out of the PR watch's last check,\n * so the session stops saying a thread waits on you before the watch reads\n * GitHub again. Read from what was posted, not from the request.\n */\nexport function markPostedAnswered(\n sessionId: string,\n watch: { state(id: string): SessionCi | null; answered(id: string, threadId: string): void },\n): string[] {\n const threads = postedSince(listReplies(sessionId), watch.state(sessionId)?.checkedAt);\n for (const t of threads) watch.answered(sessionId, t);\n return threads;\n}\n\n/** A thread as GitHub has it now, with its pull request: what a draft can be made from when work's last check hasn't it. */\nconst THREAD_LIVE = `query($threadId: ID!) {\n viewer { login }\n node(id: $threadId) { ... on PullRequestReviewThread {\n isResolved path line\n first: comments(first: 1) { nodes { author { login } body url } }\n last: comments(last: 1) { nodes { author { login } url } }\n pullRequest { number url headRefName repository { nameWithOwner } }\n } }\n}`;\n\n/** The session's repos with what the live lookup matches a thread against: their GitHub name and checked-out branch. */\nexport function sessionRepoRefs(s: WorktreeSession): SessionRepoRef[] {\n return sessionRepos(s, loadConfig()).map((r) => {\n const config = readGitConfig(r.path);\n return { name: r.alias, path: r.path, github: config ? githubRepoOf(config) : null, branch: checkedOutBranch(r.path) };\n });\n}\n\n/** One of the session's repos, as the live lookup matches a thread's pull request against it. */\nexport interface SessionRepoRef {\n /** Its alias (what the PR watch names the repo by). */\n name: string;\n path: string;\n /** owner/name on github.com, lower case (`githubRepoOf`); null when not on GitHub. */\n github: string | null;\n /** The branch checked out there now. */\n branch: string | null;\n}\n\n/**\n * The thread read from GitHub now, accepted as the PR watch would list it:\n * on an open pull request of this session (its repo, from the branch one of\n * the session's checkouts has), not resolved, and its last word not yours.\n * What `work pr reply` falls back to when work's last check hasn't the\n * thread — a new one since, or a watch that missed the session — so a\n * reply is never stuck on stale state, and never looser than the watch.\n */\nexport async function liveOpenThread(\n threadId: string,\n repos: SessionRepoRef[],\n run: CommandRunner,\n now = new Date(),\n): Promise<{ reply: PrReply } | { error: string }> {\n if (!THREAD_ID.test(threadId)) return { error: `not a review thread id: ${threadId}` };\n const cwd = repos[0]?.path;\n if (!cwd) return { error: 'the session has no repo to ask GitHub from' };\n const r = await run('gh', ['api', 'graphql', '-f', `query=${THREAD_LIVE}`, '-f', `threadId=${threadId}`], cwd);\n if (r.code !== 0) return { error: `couldn't read the thread on GitHub: ${r.stderr.trim() || 'gh failed'}` };\n type Who = { author?: { login?: unknown } | null; body?: unknown; url?: unknown } | null;\n const j = json.parse(r.stdout) as {\n data?: {\n viewer?: { login?: unknown };\n node?: {\n isResolved?: unknown;\n path?: unknown;\n line?: unknown;\n first?: { nodes?: Who[] };\n last?: { nodes?: Who[] };\n pullRequest?: { number?: unknown; url?: unknown; headRefName?: unknown; repository?: { nameWithOwner?: unknown } };\n } | null;\n };\n } | null;\n const me = j?.data?.viewer?.login;\n const t = j?.data?.node;\n const pr = t?.pullRequest;\n if (typeof me !== 'string' || !me || !t || !pr || typeof pr.number !== 'number')\n return { error: `${threadId} isn't a review thread GitHub knows` };\n const nameWithOwner = typeof pr.repository?.nameWithOwner === 'string' ? pr.repository.nameWithOwner.toLowerCase() : '';\n const repo = repos.find((x) => x.github === nameWithOwner && !!x.branch && x.branch === pr.headRefName);\n if (!repo) return { error: `${threadId} is on ${nameWithOwner || 'a repo'} #${pr.number}, not a pull request of this session` };\n if (t.isResolved === true) return { error: 'the thread is resolved on GitHub: nothing to answer' };\n const first = t.first?.nodes?.[0];\n const last = t.last?.nodes?.at(-1);\n const lastBy = typeof last?.author?.login === 'string' ? last.author.login : '';\n if (lastBy.toLowerCase() === me.toLowerCase()) return { error: `the last word in this thread is already yours (@${me})` };\n const str = (v: unknown) => (typeof v === 'string' ? v : '');\n const path = str(t.path);\n return {\n reply: {\n threadId,\n repo: repo.name,\n prNumber: pr.number,\n url: str(last?.url) || str(pr.url),\n where: path ? `${path}${typeof t.line === 'number' ? `:${t.line}` : ''}` : null,\n reviewer: str(first?.author?.login),\n excerpt: str(first?.body).slice(0, 400),\n status: 'sent',\n draft: null,\n sentAt: now.toISOString(),\n },\n };\n}\n\n/** What `saveDraft` refuses that GitHub may know better: a thread it can't find, or one answered before\n * that the reviewer may have answered since (work's last check not having seen it yet). */\nconst ASK_GITHUB = /isn't an open review thread of this session|already posted/;\n\n/**\n * Draft a reply — what `work pr reply` and the dashboard's PUT do: from\n * what work knows (`saveDraft`), else from the thread as GitHub has it now\n * (`liveOpenThread`), never for a session launched `--unsafe` (it drafts\n * only what the watch handed it).\n */\nexport async function draftReply(\n sessionId: string,\n threadId: string,\n body: string,\n io: { unsafe: boolean; repos: () => SessionRepoRef[]; run: CommandRunner },\n now = new Date(),\n): Promise<DraftResult> {\n const known = saveDraft(sessionId, threadId, body, now, { unsafe: io.unsafe });\n if (known.ok || io.unsafe || !ASK_GITHUB.test(known.error)) return known;\n const live = await liveOpenThread(threadId, io.repos(), io.run, now);\n if ('error' in live) return { ok: false, error: `${live.error} (work's last check didn't list it either)` };\n return saveDraft(sessionId, threadId, body, now, { live: live.reply });\n}\n\nconst THREAD_RESOLVED = `query($threadId: ID!) { node(id: $threadId) { ... on PullRequestReviewThread { isResolved } } }`;\n/** At most this many threads looked up per check: a session with many old rows catches up over a few. */\nconst RETIRE_PER_CHECK = 10;\n\n/**\n * Reply rows of the session — handed over, or drafted and not posted —\n * whose thread the PR watch's check doesn't list as open, asked about on\n * GitHub one by one: those it says are resolved are discarded (nothing to\n * answer; Post could only refuse, and \"1 reply to post\" stayed forever).\n * Never from absence alone: a failed lookup leaves a thread off the list\n * too, so only GitHub's own \"resolved\" retires one. Returns the thread ids\n * that went.\n */\nexport async function retireResolvedReplies(sessionId: string, ci: SessionCi, cwd: string | null, run: CommandRunner): Promise<string[]> {\n if (!cwd) return [];\n const open = new Set(ci.repos.flatMap((r) => (r.threads ?? []).map((t) => t.threadId)));\n const suspects = listReplies(sessionId)\n .filter((r) => r.status !== 'posted' && !open.has(r.threadId))\n .slice(0, RETIRE_PER_CHECK);\n const gone: string[] = [];\n for (const r of suspects) {\n const res = await run('gh', ['api', 'graphql', '-f', `query=${THREAD_RESOLVED}`, '-f', `threadId=${r.threadId}`], cwd);\n if (res.code !== 0) continue;\n const j = json.parse(res.stdout) as { data?: { node?: { isResolved?: unknown } | null } } | null;\n if (j?.data?.node?.isResolved !== true) continue;\n if (discardReply(sessionId, r.threadId)) gone.push(r.threadId);\n }\n return gone;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,mBAAqG;AACnH,SAAO,CAAC,eAAe;AAAA,IACrB,KAAK,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,QAAQ,8DAA8D,EAAE,IAAI,WAAW,CAAC,CAAC,MAAM;AAAA,IAC3H,KAAK,CAAC,MAAM;AACV,UAAI;AACF,eAAO,CAAC,MAAM,EAAE,QAAQ,qEAAqE,E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1G,SAAO,UAAU,WAAW,UAAU,MAAM,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AACvE;AAEA,IAAM,kBAAkB;AAExB,IAAM,mBAAmB;AAWzB,eAAsB,sBAAsB,WAAmB,IAAe,KAAoB,KAAuC;AACvI,MAAI,CAAC,IAAK,QAAO,CAAC;AAClB,QAAM,OAAO,IAAI,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACtF,QAAM,WAAW,YAAY,SAAS,EACnC,OAAO,CAAC,MAAM,EAAE,WAAW,YAAY,CAAC,KAAK,IAAI,EAAE,QAAQ,CAAC,EAC5D,MAAM,GAAG,gBAAgB;AAC5B,QAAM,OAAiB,CAAC;AACxB,aAAW,KAAK,UAAU;AACxB,UAAM,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,WAAW,MAAM,SAAS,eAAe,IAAI,MAAM,YAAY,EAAE,QAAQ,EAAE,GAAG,GAAG;AACrH,QAAI,IAAI,SAAS,EAAG;AACpB,UAAM,IAAI,KAAK,MAAM,IAAI,MAAM;AAC/B,QAAI,GAAG,MAAM,MAAM,eAAe,KAAM;AACxC,QAAI,aAAa,WAAW,EAAE,QAAQ,EAAG,MAAK,KAAK,EAAE,QAAQ;AAAA,EAC/D;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/sessions/session-view.ts","../src/core/agents/assistant.ts"],"sourcesContent":["import type { SessionAttention, ActivityState } from '../api-types.js';\nimport { stageWaiting, type PrStageKind } from '../pr/pr-stage.js';\nimport { owedToYou, type Owed } from '../status/attention.js';\n\n/** What the status vocabulary reads from a session: a dashboard row or\n * a `work sessions` row (both are SessionWire-shaped). */\nexport interface SessionLike {\n lastAccessedAt: string;\n lastActivity?: number | null;\n activityState?: ActivityState;\n attention?: SessionAttention | null;\n /** Unresolved review threads on its open PRs (SessionWire). */\n openReviewThreads?: number;\n /** Replies drafted to its review threads, waiting for your Post (SessionWire). */\n replyDrafts?: number;\n /** Where its pull request stands (SessionWire, pr-stage.ts). */\n prStage?: { kind: PrStageKind; text: string; seen?: boolean; prs?: ReadonlyArray<{ kind: PrStageKind; checks?: string }> } | null;\n /** Being archived right now (SessionWire.archiving). */\n archiving?: boolean;\n /** Being restored right now (SessionWire.restoring). */\n restoring?: boolean;\n /** Its Claude was stopped while idle and hasn't run since (SessionWire.asleep). */\n asleep?: boolean;\n}\n\n/**\n * ONE status vocabulary for every view — pure, so the dashboard (it imports\n * this) and `work sessions` say the same thing — (rail, Sessions table, inbox, header\n * strip). Hook-driven attention wins when a session has it; otherwise we fall\n * back to the older transcript-activity signal, so a session never shows two\n * contradicting states in two places.\n *\n * archiving — being archived right now (its Claude stopped, the rest\n * being saved); it leaves the list when done\n * restoring — being restored (its worktree made again, the conversation\n * put back); in the rail again from the click\n * needs_input — blocked on you (permission / question)\n * done — finished a turn you haven't looked at\n * working — mid-turn\n * background — its turn ended, a background agent that turn started is\n * still at it: still busy, but its prompt is free\n * asleep — its Claude was stopped while idle (idle sleep, `work stop`)\n * and hasn't run since: opening it starts it again\n * quiet — finished, and you've seen it\n * active/open/recent/stale — no hook status yet (its Claude has not\n * taken a turn since the dashboard's hooks went in, or runs a tool\n * without them): transcript activity only. Active ≤ 30 s, Open ≤ 5 min,\n * Idle (recent) within a day, Stale after that.\n */\nexport type DisplayKind =\n | 'archiving'\n | 'restoring'\n | 'needs_input'\n | 'done'\n | 'working'\n | 'background'\n | 'asleep'\n | 'quiet'\n | 'active'\n | 'open'\n | 'recent'\n | 'stale';\n\n/** Used today = not stale, whatever the hooks know. */\nexport const RECENT_MS = 24 * 3_600_000;\n\n/** When the session last did anything: the newest of its hook update,\n * Claude's last transcript write and the `work tree` entry. (Reading only\n * the entry time called a session Active and \"1d\" at once.) */\nexport function lastActiveAt(s: SessionLike): string {\n const candidates = [Date.parse(s.lastAccessedAt) || 0, s.lastActivity ?? 0, s.attention ? Date.parse(s.attention.updatedAt) || 0 : 0];\n return new Date(Math.max(...candidates)).toISOString();\n}\n\nexport function displayStatus(s: SessionLike, now: number = Date.now()): DisplayKind {\n if (s.archiving) return 'archiving';\n if (s.restoring) return 'restoring';\n const a = s.attention;\n if (a) {\n if (a.state === 'needs_input') return 'needs_input';\n if (a.state === 'working') return a.background ? 'background' : 'working';\n }\n // A finished turn you haven't looked at is yours to review, not Claude's state: the blue \"review\" badge says it\n // (owedToYou's 'turn'); the icon says what its Claude is — idle, or asleep.\n if (s.asleep) return 'asleep';\n if (a) return 'quiet';\n if (s.activityState === 'active') return 'active';\n if (s.activityState === 'open') return 'open';\n return now - Date.parse(lastActiveAt(s)) < RECENT_MS ? 'recent' : 'stale';\n}\n\nexport const DISPLAY_LABEL: Record<DisplayKind, string> = {\n archiving: 'Archiving',\n restoring: 'Restoring',\n needs_input: 'Needs your input',\n done: 'Done',\n working: 'Working',\n background: 'In background',\n asleep: 'Asleep',\n quiet: 'Idle',\n active: 'Active',\n open: 'Open',\n recent: 'Idle',\n stale: 'Stale',\n};\n\n/** What each status means, in words — the legend and the dots' tooltips. */\nexport const DISPLAY_MEANING: Record<DisplayKind, string> = {\n archiving:\n 'Being archived: its Claude is stopped, its conversation and uncommitted files are saved, and its worktree goes once nothing would be lost. It leaves the list when done; Restore brings it back.',\n restoring:\n 'Being restored: its worktree is made again from its branch, with its uncommitted files and conversation put back. Then it carries on where it was.',\n needs_input: 'Its Claude is waiting for you: a permission prompt or a question.',\n done: \"Its Claude finished a turn you haven't looked at yet: the Inbox's Done section. On a row it's the blue review badge, beside what its Claude is now.\",\n working: 'Its Claude is working on your last instruction right now.',\n background:\n 'Its Claude finished its turn, and a background agent that turn started is still at work. Its prompt is free: you can talk to it. The agent’s result comes back as a new turn.',\n asleep:\n 'Its Claude was stopped to free memory: idle for a while, nothing attached, nothing of it still running. Opening the session starts it again, where it left off.',\n quiet: \"Its Claude finished, and you've seen it. Nothing to do.\",\n active: \"Its Claude wrote in the last 30 seconds (it isn't reporting its status, so this is from its transcript).\",\n open: 'Its Claude wrote in the last 5 minutes, or is open and idle at its prompt.',\n recent: 'Used in the last day; nothing running now.',\n stale: 'Not used for over a day.',\n};\n\n/** The legend's rows, most urgent first. Idle covers `quiet` and `recent` (same colour, same word). */\nexport const LEGEND_KINDS: readonly DisplayKind[] = [\n 'needs_input',\n 'done',\n 'working',\n 'background',\n 'asleep',\n 'archiving',\n 'restoring',\n 'active',\n 'open',\n 'quiet',\n 'stale',\n];\n\n/**\n * How full a Claude conversation may get before it matters: past WARN the\n * header shows it amber and the PR watch's notes ask Claude to hand\n * mechanical work to a sub-agent; past FULL it's red (Claude compacts near\n * the window, and answers get vaguer before that).\n */\nexport const CONTEXT_WARN = 0.7;\nexport const CONTEXT_FULL = 0.9;\n\n/** How long ago a session was used, for the Sessions table's sections. */\nexport type AgeBucket = 'now' | 'week' | 'older';\n\nexport const AGE_LABEL: Record<AgeBucket, string> = {\n now: 'Now',\n week: 'This week',\n older: 'Older',\n};\n\nexport const WEEK_MS = 7 * 24 * 3_600_000;\n\n/** Now: wants you, is working, or was used in the last day. This week:\n * used within 7 days. Older: everything else — cleanup material. */\nexport function ageBucket(s: SessionLike, now: number = Date.now()): AgeBucket {\n const kind = displayStatus(s, now);\n if (owedToYou(s).length) return 'now';\n if (\n kind === 'needs_input' ||\n kind === 'done' ||\n kind === 'working' ||\n kind === 'background' ||\n kind === 'archiving' ||\n kind === 'restoring' ||\n kind === 'active' ||\n kind === 'open'\n )\n return 'now';\n const age = now - Date.parse(lastActiveAt(s));\n if (age < RECENT_MS) return 'now';\n return age < WEEK_MS ? 'week' : 'older';\n}\n\n/** Coarse buckets the Sessions header counts and filters by. */\nexport type StatusBucket = 'needs' | 'working' | 'idle' | 'stale';\n\nexport function statusBucket(kind: DisplayKind): StatusBucket {\n switch (kind) {\n case 'needs_input':\n case 'done':\n return 'needs';\n case 'working':\n case 'background':\n case 'archiving':\n case 'restoring':\n case 'active':\n return 'working';\n case 'quiet':\n case 'asleep':\n case 'open':\n case 'recent':\n return 'idle';\n case 'stale':\n return 'stale';\n default: {\n // Every kind is named above: a new one fails the type check here instead of landing in \"stale\" unasked.\n const unknown: never = kind;\n return unknown;\n }\n }\n}\n\n/** Why a session shows Active / Open / Idle(recent) / Stale instead of a\n * real status: its Claude isn't reporting through work web's hooks. */\nexport const NO_HOOKS_HINT =\n \"Its Claude isn't reporting its status (it was started before work web's hooks were installed, or it isn't Claude), so this is from its transcript activity: Active = wrote in the last 30 s, Open = last 5 min. Restart it with `work tree <target> <branch>` (the conversation continues) to get Working / Needs your input / Done.\";\n\n/** The hint for a status that comes from activity only; undefined otherwise. */\nexport function statusHint(kind: DisplayKind): string | undefined {\n return kind === 'active' || kind === 'open' || kind === 'recent' || kind === 'stale' ? NO_HOOKS_HINT : undefined;\n}\n\n/**\n * The second signal: what waits on you about a session, beside what its\n * Claude is doing (attention.ts `owedToYou`), in words. The rail's badge is\n * the first thing (\"1 reply\", \"merge\"; \"+1\" when there's more), its tooltip\n * all of them; the Sessions table and the Inbox say the same.\n */\nexport const OWED_SHORT: Record<Owed['kind'], (n: number) => string> = {\n turn: () => 'review',\n reply: (n) => `${n} ${n === 1 ? 'reply' : 'replies'}`,\n thread: (n) => `${n} ${n === 1 ? 'thread' : 'threads'}`,\n conflict: () => 'conflict',\n checks: () => 'CI',\n merge: () => 'merge',\n};\nexport const OWED_LONG: Record<Owed['kind'], (n: number) => string> = {\n turn: () => 'a finished turn to review',\n reply: (n) => `${n} ${n === 1 ? 'reply' : 'replies'} to post`,\n thread: (n) => `${n} review ${n === 1 ? 'thread' : 'threads'} with no answer`,\n conflict: (n) => (n === 1 ? 'a merge conflict' : `${n} PRs with merge conflicts`),\n checks: (n) => (n === 1 ? 'checks failing' : `${n} PRs with checks failing`),\n merge: () => 'ready to merge',\n};\n\nexport interface OwedBadge {\n /** \"1 reply\", \"merge +1\", \"review\". */\n text: string;\n /** What it leads with: a finished turn to review is blue (Done's colour), the rest pink. */\n kind: Owed['kind'];\n /** \"Needs you: 1 reply to post · ready to merge\". */\n title: string;\n}\n\n/** The badge for what waits on you, or null when nothing does. */\nexport function owedBadge(s: SessionLike): OwedBadge | null {\n const owed = owedToYou(s);\n if (!owed.length) return null;\n const [first, ...more] = owed;\n return {\n kind: first.kind,\n text: OWED_SHORT[first.kind](first.count) + (more.length ? ` +${more.length}` : ''),\n title: `Needs you: ${owed.map((o) => OWED_LONG[o.kind](o.count)).join(' · ')}`,\n };\n}\n\n/** Nothing waits on you, and its PR waits on others (reviewers, checks): \"in review\", said quietly. */\nexport function waitingOnOthers(s: SessionLike): boolean {\n return !owedToYou(s).length && stageWaiting(s.prStage);\n}\n\n/** The Sessions table's status filter: what waits on you counts as \"needs you\", whatever Claude is doing. */\nexport function sessionBucket(s: SessionLike, now: number = Date.now()): StatusBucket {\n return owedToYou(s).length ? 'needs' : statusBucket(displayStatus(s, now));\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from '../platform/config.js';\nimport { atomicWriteFile } from '../platform/fs-safe.js';\nimport type { AssistantView, SessionWire } from '../api-types.js';\nimport { DISPLAY_LABEL, displayStatus } from '../sessions/session-view.js';\nimport type { AgentAdapter, AllowRule, WorkHook } from './types.js';\n\n/**\n * The dashboard assistant (Ctrl+K): a persistent agent session in the PTY\n * host, like any worktree's, with its own folder under ~/.work/assistant. It\n * runs config `assistantAgent` (Claude Code by default; `assistantAgent()`).\n *\n * That folder is written by work: the agent's instructions file (CLAUDE.md\n * for Claude) saying what it is for and how to get the data (the\n * `work … --json` commands), and through its adapter's `workspace` its own\n * settings: the read-only commands pre-allowed, and a hook at the start of\n * each turn that adds what the user is looking at in the dashboard to the\n * prompt (`work hook assistant-context`), so \"clean these up\" or \"why is this\n * one blocked?\" need no explaining. An agent without a workspace gets the\n * instructions only (it asks before every command, and sees no view).\n *\n * It runs in the agent's normal permission mode, never --unsafe: anything\n * not pre-allowed — `work cleanup --apply`, `work remove`, git — asks first,\n * in the panel (and the Inbox).\n */\n\nexport const ASSISTANT_ID = 'assistant';\n\n/** What the dashboard reported, kept this long for the hook. */\nexport const CONTEXT_TTL_MS = 30 * 60_000;\n\nexport function assistantDir(): string {\n return path.join(getConfigDir(), 'assistant');\n}\nconst contextFile = () => path.join(assistantDir(), 'context.json');\n\n/**\n * Read-only commands it may run without asking (each agent's adapter writes\n * them in its own terms). Exact forms for cleanup: a `work cleanup --json`\n * prefix rule would also allow `--apply`.\n */\nexport const ASSISTANT_ALLOW: AllowRule[] = [\n { command: 'work sessions', prefix: true },\n { command: 'work digest', prefix: true },\n { command: 'work overlaps', prefix: true },\n { command: 'work search', prefix: true },\n { command: 'work cleanup --json' },\n { command: 'work cleanup --json --no-fetch' },\n { command: 'work cleanup --no-fetch --json' },\n { command: 'work list', prefix: true },\n { command: 'work recent', prefix: true },\n // The Time tab's day, read only (set / reset / off / gather / post ask first).\n { command: 'work timesheet show', prefix: true },\n { command: 'work timesheet month', prefix: true },\n];\n\n/** Its hook: what the dashboard shows, added at the start of each turn. */\nexport const ASSISTANT_HOOKS: WorkHook[] = [\n { owner: 'assistant', edge: 'turn-start', command: 'work hook assistant-context', timeoutSec: 5 },\n];\n\nexport const ASSISTANT_INSTRUCTIONS = `# You are the work dashboard's assistant\n\nThe user opens you with Ctrl+K in \\`work web\\`, the dashboard over all their git worktrees and the coding agent session in each. Help them make sense of it and act on it: what needs them, what each session did, what can be cleaned up, which sessions will conflict.\n\n## Getting the data\n\nUse the \\`work\\` CLI with \\`--json\\` (see the work-sessions skill) and parse it; don't guess from the filesystem:\n\n- \\`work sessions --json\\` — every session: status (\\`view.label\\`), age, last active, context usage, archive state. \\`--changes\\` adds +N −M and same-file overlaps; \\`--all\\` adds older and archived ones.\n- \\`work digest --json --since today|yesterday|week\\` — what each session did (prompts, turns, PRs).\n- \\`work overlaps --json\\` — live sessions changing the same files.\n- \\`work cleanup --json\\` — which worktrees can go, and why.\n- \\`work timesheet show [day] --json\\` — the Time tab's day: hours per ticket, and why (sessions' Claude minutes, commits, Jira, meetings, chats). On the Time tab, the day on screen is described to you with each message.\n- \\`work timesheet month [YYYY-MM] --json\\` — a month: every day's rows with how each got its hours, the month's tickets, and what posting it would do. On the Month view, the month on screen is described to you with each message.\n- \\`work search <words> --json\\` — sessions whose conversation (live or archived, also older than the agent keeps) mentions it, with the matching lines: \"what did we do about X?\".\n\nEach prompt comes with what the user is looking at in the dashboard (the tab, the selected session). When they say \"this\", \"these\" or \"here\", that is what they mean.\n\n## Changing things\n\nAsk before you change anything, and say exactly what will happen:\n- Removing, archiving or forgetting worktrees: \\`work cleanup --apply <id>… --action delete|archive|forget --json\\`. Each is checked again right before it runs; report what was refused and why. Never \\`--force\\` unless the user asked for exactly that.\n- A day's hours: \\`work timesheet set <day> KEY=HOURS …\\` (all its rows; quarter hours, the day's total as the user wants it), \\`reset <day>\\`, \\`off <day>\\`; several days: one command per day. Explain the change first. To look at a day again (its sessions, commits, Jira, meetings): \\`work timesheet gather <day>\\`, or \\`gather <YYYY-MM>\\` for a month's days not gathered yet. Posting to Tempo (\\`work timesheet post <day>\\`) only when the user asks for it.\n- Anything else (\\`work remove\\`, git, files in a worktree): only when asked, and show the command first.\n\nDon't post on GitHub, and don't send prompts to other sessions, unless the user asks. Keep answers short: the user is in the middle of something.\n`;\n\n/** What work wrote in the folder last time (relative paths), so files an earlier agent's setup left can go. */\nconst writtenFile = () => path.join(assistantDir(), '.work-written.json');\n/** What a work from before the list wrote: Claude's. */\nconst BEFORE_THE_LIST = ['CLAUDE.md', path.join('.claude', 'settings.json')];\n\nfunction readWritten(): string[] {\n try {\n const v = JSON.parse(fs.readFileSync(writtenFile(), 'utf-8')) as unknown;\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];\n } catch (err) {\n return (err as NodeJS.ErrnoException).code === 'ENOENT' ? BEFORE_THE_LIST : [];\n }\n}\n\n/**\n * Write (or refresh) the assistant's folder for the agent it runs; returns\n * it. Idempotent. Files work wrote there for another agent before (its\n * instructions, its settings with their allow rules and hooks) are removed:\n * after a switch they would be instructions and permissions nothing manages.\n * Only files work wrote and listed, inside the folder — never the user's own.\n */\nexport function prepareAssistantDir(agent: Pick<AgentAdapter, 'instructionsFile' | 'workspace'>): string {\n const dir = assistantDir();\n fs.mkdirSync(dir, { recursive: true });\n const before = readWritten();\n atomicWriteFile(path.join(dir, agent.instructionsFile), ASSISTANT_INSTRUCTIONS);\n const written = [agent.instructionsFile, ...(agent.workspace?.write(dir, { allow: ASSISTANT_ALLOW, hooks: ASSISTANT_HOOKS }) ?? [])].map(\n (f) => path.normalize(f),\n );\n const root = path.resolve(dir);\n for (const old of before.map((f) => path.normalize(f))) {\n const file = path.resolve(root, old);\n if (written.includes(old) || path.isAbsolute(old) || !file.startsWith(root + path.sep)) continue; // listed by us, inside the folder: nothing else\n fs.rmSync(file, { force: true });\n }\n atomicWriteFile(writtenFile(), JSON.stringify(written));\n return dir;\n}\n\ninterface StoredContext {\n at: string;\n text: string;\n /** The Time tab's day on screen: described afresh at each prompt (rows change by Save, Post, a rebuild). */\n day?: string;\n /** The Time tab's Month view on screen (`YYYY-MM`), described afresh the same way. */\n month?: string;\n}\n\n/**\n * The dashboard view in words, for the hook: which tab, and the selected\n * session's state. Pure.\n */\nexport function describeView(view: AssistantView, session: SessionWire | null, now = Date.now()): string {\n const lines = [`The user is looking at the dashboard's ${view.tab} tab${view.sub ? ` (${view.sub})` : ''}.`];\n if (session) {\n const status = DISPLAY_LABEL[displayStatus(session, now)];\n lines.push(\n `Selected session: ${session.target} · ${session.branch} (id ${session.id}) — ${status}.`,\n ...(session.attention?.summary ? [` Its last line: ${session.attention.summary}`] : []),\n ...(session.diffStat?.files\n ? [` Uncommitted: +${session.diffStat.added} −${session.diffStat.deleted} in ${session.diffStat.files} files.`]\n : []),\n ...(session.overlaps?.length\n ? [` Changes the same files as: ${session.overlaps.map((o) => `${o.target} · ${o.branch}`).join(', ')}.`]\n : []),\n ...(session.context ? [` Its conversation is ${Math.round((session.context.used / session.context.window) * 100)}% full.`] : []),\n ...(session.archivedAt ? [' It is archived.'] : []),\n ` Worktree: ${session.paths.join(', ')}`,\n );\n }\n if (view.note) lines.push(view.note);\n return lines.join('\\n');\n}\n\nexport function writeAssistantContext(text: string, now = Date.now(), day?: string, month?: string): void {\n fs.mkdirSync(assistantDir(), { recursive: true });\n const stored: StoredContext = { at: new Date(now).toISOString(), text, ...(day ? { day } : {}), ...(month ? { month } : {}) };\n atomicWriteFile(contextFile(), JSON.stringify(stored));\n}\n\n/** The day on screen, if the Time tab is: for the hook to describe as it is now. */\nexport function assistantContextDay(now = Date.now()): string | null {\n const s = readStored(now);\n return s && typeof s.day === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(s.day) ? s.day : null;\n}\n\n/** The month on screen, if the Time tab's Month view is: for the hook to describe as it is now. */\nexport function assistantContextMonth(now = Date.now()): string | null {\n const s = readStored(now);\n return s && typeof s.month === 'string' && /^\\d{4}-(0[1-9]|1[0-2])$/.test(s.month) ? s.month : null;\n}\n\nfunction readStored(now: number): Partial<StoredContext> | null {\n try {\n const s = JSON.parse(fs.readFileSync(contextFile(), 'utf-8')) as Partial<StoredContext> | null;\n if (!s || typeof s.text !== 'string' || typeof s.at !== 'string') return null;\n return now - Date.parse(s.at) > CONTEXT_TTL_MS ? null : s;\n } catch {\n return null;\n }\n}\n\n/**\n * What the hook adds to a prompt; null when the dashboard said nothing\n * lately. `dayNow` describes the Time tab's day as it is at this prompt\n * (the hook reads it from state.db), not as it was when the tab was opened.\n */\nexport function readAssistantContext(now = Date.now(), dayNow?: string | null): string | null {\n const s = readStored(now);\n if (!s) return null;\n return `[work dashboard] ${s.text}${dayNow ? `\\n${dayNow}` : ''}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAgEO,IAAM,YAAY,KAAK;AAKvB,SAAS,aAAa,GAAwB;AACnD,QAAM,aAAa,CAAC,KAAK,MAAM,EAAE,cAAc,KAAK,GAAG,EAAE,gBAAgB,G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