claude-code-session-manager 0.140.0 → 0.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +80 -70
  2. package/bin/cli.cjs +11 -0
  3. package/dist/assets/AppSettings-BcZgIvvY.js +2 -0
  4. package/dist/assets/{History--JwsFnbn.js → History-DpZuJXi1.js} +1 -1
  5. package/dist/assets/HomeClaudeConfig-D32ZJtU-.js +3 -0
  6. package/dist/assets/{Panel-CALyU0pe.js → Panel-BjdJjhqt.js} +1 -1
  7. package/dist/assets/{ProjectClaudeConfig-sdlA-fUb.js → ProjectClaudeConfig-BTClYV6i.js} +7 -7
  8. package/dist/assets/Scheduler-DPobKx1Z.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-CxAuwhNN.js → SkillReferenceGraph-Cqyu4mef.js} +1 -1
  10. package/dist/assets/{Skills-DtRzghn5.js → Skills-vv0noNVI.js} +5 -5
  11. package/dist/assets/{TiptapBody-DApeu7x8.js → TiptapBody-CXi8Pvut.js} +1 -1
  12. package/dist/assets/Toggle-CiYCWLjh.js +1 -0
  13. package/dist/assets/{VoiceButton-DtStfv1H.js → VoiceButton-4NKKd1sC.js} +1 -1
  14. package/dist/assets/{historyTotals-ydfnwepc.js → historyTotals-DDunb8Ch.js} +1 -1
  15. package/dist/assets/index-Cn5E9958.js +3133 -0
  16. package/dist/assets/{index-DKXdXfka.css → index-DVHIHoJf.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +496 -484
  20. package/package.json +4 -2
  21. package/plugins/AGENTS.md +4 -3
  22. package/plugins/session-manager-dev/hooks/hooks.json +15 -0
  23. package/plugins/session-manager-dev/hooks/residue-check.cjs +241 -0
  24. package/plugins/session-manager-dev/skills/builder/SKILL.md +4 -2
  25. package/plugins/session-manager-dev/skills/develop/SKILL.md +55 -18
  26. package/plugins/session-manager-dev/skills/develop/standards.md +3 -2
  27. package/scripts/README.md +1 -0
  28. package/scripts/hooks/guard-tool-risk.cjs +5 -1
  29. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +158 -1
  30. package/scripts/scheduler-mcp-server.cjs +737 -110
  31. package/src/main/adminRouteRegistry.cjs +59 -0
  32. package/src/main/agentLibrary.cjs +72 -4
  33. package/src/main/agentsIpc.cjs +3 -2
  34. package/src/main/build-info.json +4 -4
  35. package/src/main/chatRunner.cjs +231 -16
  36. package/src/main/config.cjs +30 -0
  37. package/src/main/docEdit.cjs +4 -2
  38. package/src/main/health.cjs +91 -0
  39. package/src/main/index.cjs +98 -48
  40. package/src/main/ipcSchemas.cjs +171 -8
  41. package/src/main/lib/AGENTS.md +1 -1
  42. package/src/main/lib/chatBootRecovery.cjs +2 -0
  43. package/src/main/lib/claude/agentModelResolve.cjs +51 -25
  44. package/src/main/lib/claude/agentSnapshot.cjs +186 -0
  45. package/src/main/lib/claude/environmentProfiles.cjs +242 -0
  46. package/src/main/lib/claude/jobSandboxPolicy.cjs +241 -33
  47. package/src/main/lib/claude/personaToolScope.cjs +82 -31
  48. package/src/main/lib/claude/runClaudeP.cjs +4 -2
  49. package/src/main/lib/claude/toolRiskMarks.cjs +41 -1
  50. package/src/main/lib/claude/usageCircuit.cjs +49 -21
  51. package/src/main/lib/claude/vaultRefs.cjs +277 -0
  52. package/src/main/lib/demo-video-kit/capture.cjs +282 -12
  53. package/src/main/lib/demo-video-kit/cast.md +43 -0
  54. package/src/main/lib/demo-video-kit/character.cjs +722 -30
  55. package/src/main/lib/demo-video-kit/checks.cjs +120 -1
  56. package/src/main/lib/demo-video-kit/export.cjs +218 -0
  57. package/src/main/lib/demo-video-kit/frames.cjs +104 -9
  58. package/src/main/lib/demo-video-kit/kind-marketing.md +121 -0
  59. package/src/main/lib/demo-video-kit/kind-tiktok.md +99 -0
  60. package/src/main/lib/demo-video-kit/kokoroSay.cjs +205 -0
  61. package/src/main/lib/demo-video-kit/project-home-html.md +43 -0
  62. package/src/main/lib/demo-video-kit/resumableRun.cjs +298 -0
  63. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  64. package/src/main/lib/demo-video-kit/voiceLane.cjs +233 -0
  65. package/src/main/lib/demo-video-kit/voiceLibrary.cjs +312 -0
  66. package/src/main/lib/epic/artifactAdminRoutes.cjs +211 -0
  67. package/src/main/lib/epic/artifactIpc.cjs +153 -0
  68. package/src/main/lib/epic/artifactNotice.cjs +72 -0
  69. package/src/main/lib/epic/artifactRetention.cjs +310 -0
  70. package/src/main/lib/epic/artifactStore.cjs +392 -0
  71. package/src/main/lib/epic/delegationReadiness.cjs +76 -2
  72. package/src/main/lib/epic/epicAgentRefresh.cjs +97 -0
  73. package/src/main/lib/epic/epicEventLog.cjs +214 -0
  74. package/src/main/lib/epic/epicMint.cjs +43 -1
  75. package/src/main/lib/epic/epicOutsideRead.cjs +1 -0
  76. package/src/main/lib/epic/epicOutsideState.cjs +18 -4
  77. package/src/main/lib/epic/epicPurge.cjs +347 -0
  78. package/src/main/lib/epic/epicReopen.cjs +5 -2
  79. package/src/main/lib/epic/epicSettle.cjs +4 -13
  80. package/src/main/lib/epic/epicSpawnPlan.cjs +57 -4
  81. package/src/main/lib/epic/epicStatusMirror.cjs +34 -1
  82. package/src/main/lib/epic/epicTransitions.cjs +139 -0
  83. package/src/main/lib/epic/epicValidationHook.cjs +81 -2
  84. package/src/main/lib/epic/guardSpawnSettings.cjs +3 -2
  85. package/src/main/lib/externalContract.cjs +37 -4
  86. package/src/main/lib/feedback-remote/crossProjectReply.cjs +389 -126
  87. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -3
  88. package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +11 -6
  89. package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +26 -1
  90. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +5 -2
  91. package/src/main/lib/feedback-remote/feedbackBoxDrain.cjs +409 -0
  92. package/src/main/lib/feedback-remote/feedbackBoxKeys.cjs +218 -0
  93. package/src/main/lib/feedback-remote/feedbackEnvelope.cjs +163 -0
  94. package/src/main/lib/feedback-remote/feedbackRelayClient.cjs +164 -0
  95. package/src/main/lib/feedback-remote/feedbackReport.cjs +234 -0
  96. package/src/main/lib/feedback-remote/feedbackSeal.cjs +217 -0
  97. package/src/main/lib/feedback-remote/localAdminHttp.cjs +108 -2
  98. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +2 -1
  99. package/src/main/lib/feedback-remote/needsYouIpc.cjs +17 -0
  100. package/src/main/lib/feedback-remote/needsYouStore.cjs +177 -6
  101. package/src/main/lib/feedback-remote/pendingReplies.cjs +189 -0
  102. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +188 -10
  103. package/src/main/lib/feedback-remote/serviceClient.cjs +429 -0
  104. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +252 -0
  105. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +284 -0
  106. package/src/main/lib/feedback-remote/servicePairings.cjs +313 -0
  107. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +290 -0
  108. package/src/main/lib/feedback-remote/siteFeedbackAdminRoutes.cjs +295 -0
  109. package/src/main/lib/feedback-remote/siteFeedbackInbox.cjs +598 -0
  110. package/src/main/lib/feedback-remote/siteFeedbackIpc.cjs +86 -0
  111. package/src/main/lib/feedback-remote/siteFeedbackService.cjs +477 -0
  112. package/src/main/lib/git/worktreeDeps.cjs +77 -2
  113. package/src/main/lib/mcpToolCatalog.cjs +315 -30
  114. package/src/main/lib/opsOwnership.cjs +29 -1
  115. package/src/main/lib/opsRetentionSettings.cjs +27 -5
  116. package/src/main/lib/persona-macro/builtinMacros.cjs +7 -2
  117. package/src/main/lib/persona-macro/macroJobDispatch.cjs +52 -8
  118. package/src/main/lib/persona-macro/macroJobIpc.cjs +16 -6
  119. package/src/main/lib/persona-macro/macroLibrary.cjs +49 -7
  120. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +83 -0
  121. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +3 -0
  122. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +263 -0
  123. package/src/main/lib/phaseProjection.cjs +103 -0
  124. package/src/main/lib/prd/depSlugResolve.cjs +4 -13
  125. package/src/main/lib/prd/prdBodyPatch.cjs +12 -17
  126. package/src/main/lib/prd/prdCreate.cjs +67 -5
  127. package/src/main/lib/prd/prdCriteria.cjs +225 -0
  128. package/src/main/lib/prd/prdFrontmatter.cjs +68 -3
  129. package/src/main/lib/prd/prdGateFiles.cjs +125 -49
  130. package/src/main/lib/prd/prdSizing.cjs +3 -1
  131. package/src/main/lib/process/cleanEnv.cjs +52 -1
  132. package/src/main/lib/process/leftoverRenice.cjs +178 -0
  133. package/src/main/lib/process/memoryScope.cjs +31 -3
  134. package/src/main/lib/project-pages/pagesLibrary.cjs +72 -6
  135. package/src/main/lib/project-pages/videoReviewIpc.cjs +3 -2
  136. package/src/main/lib/project-pages/voiceAdminRoutes.cjs +175 -0
  137. package/src/main/lib/project-pages/voicePreview.cjs +196 -0
  138. package/src/main/lib/project-pages/voicesIpc.cjs +186 -0
  139. package/src/main/lib/promptSessionSchema.cjs +6 -0
  140. package/src/main/lib/scheduler/cancelledRow.cjs +57 -0
  141. package/src/main/lib/scheduler/cpuSample.cjs +133 -42
  142. package/src/main/lib/scheduler/criteriaChecks.cjs +169 -0
  143. package/src/main/lib/scheduler/definitionOfDone.cjs +44 -5
  144. package/src/main/lib/scheduler/jobMemoryStats.cjs +313 -0
  145. package/src/main/lib/scheduler/loadGate.cjs +82 -4
  146. package/src/main/lib/scheduler/planRecordHarvest.cjs +32 -2
  147. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +133 -0
  148. package/src/main/lib/scheduler/preflightCheck.cjs +97 -0
  149. package/src/main/lib/scheduler/reviewNotice.cjs +39 -0
  150. package/src/main/lib/scheduler/runLogRetention.cjs +42 -1
  151. package/src/main/lib/scheduler/scheduleJobSchema.cjs +5 -0
  152. package/src/main/lib/scheduler/scheduleJobTransitions.cjs +47 -0
  153. package/src/main/lib/scheduler/schedulerConfig.cjs +47 -0
  154. package/src/main/lib/scheduler/schedulerPaths.cjs +0 -3
  155. package/src/main/lib/scheduler/schedulerRuntimeState.cjs +50 -1
  156. package/src/main/lib/scheduler/sessionSlots.cjs +5 -1
  157. package/src/main/lib/scheduler/slotsRoute.cjs +237 -0
  158. package/src/main/lib/scheduler/toolClearance.cjs +258 -0
  159. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +140 -10
  160. package/src/main/lib/tasks/memoryConsolidation.cjs +300 -0
  161. package/src/main/lib/tasks/mitigationReview.cjs +294 -0
  162. package/src/main/lib/tasks/taskAdminRoutes.cjs +312 -22
  163. package/src/main/lib/tasks/taskIpc.cjs +22 -18
  164. package/src/main/lib/tasks/taskLedger.cjs +147 -25
  165. package/src/main/lib/tasks/taskRun.cjs +186 -17
  166. package/src/main/lib/tasks/taskSwitch.cjs +85 -12
  167. package/src/main/lib/tasks/taskSwitchRoute.cjs +172 -0
  168. package/src/main/lib/telemetry/auditEvents.cjs +207 -6
  169. package/src/main/lib/telemetry/eventsAdminRoutes.cjs +198 -6
  170. package/src/main/lib/telemetry/webhookDelivery.cjs +205 -0
  171. package/src/main/lib/telemetry/webhookRegistry.cjs +281 -0
  172. package/src/main/lib/toolUseClassify.cjs +181 -0
  173. package/src/main/lib/util/smfileRange.cjs +77 -0
  174. package/src/main/projectPages.cjs +3 -1
  175. package/src/main/promptSessionEvents.cjs +5 -0
  176. package/src/main/pty.cjs +68 -0
  177. package/src/main/queueOps.cjs +32 -13
  178. package/src/main/runVerify.cjs +74 -9
  179. package/src/main/scheduler/AGENTS.md +1 -0
  180. package/src/main/scheduler/budget.cjs +6 -5
  181. package/src/main/scheduler/prdParser.cjs +62 -14
  182. package/src/main/scheduler/reviewLadder.cjs +45 -28
  183. package/src/main/scheduler/starvation.cjs +69 -0
  184. package/src/main/scheduler/utilizationHold.cjs +101 -0
  185. package/src/main/scheduler.cjs +1745 -210
  186. package/src/main/templates/PRD_AUTHORING.md +13 -2
  187. package/src/main/webRemote.cjs +463 -6
  188. package/src/preload/api.d.ts +529 -38
  189. package/src/preload/apiSurface.json +209 -7
  190. package/src/preload/index.cjs +46 -1
  191. package/src/seed/agents/architect.md +6 -1
  192. package/src/seed/agents/blender-artist.md +2 -1
  193. package/src/seed/agents/competitive-analyst.md +3 -1
  194. package/src/seed/agents/competitive-researcher.md +2 -1
  195. package/src/seed/agents/demo-video-builder.md +87 -83
  196. package/src/seed/agents/dev-lead.md +3 -3
  197. package/src/seed/agents/project-home-builder.md +9 -31
  198. package/src/seed/agents/validator.md +9 -10
  199. package/dist/assets/AppSettings-CMFEM68R.js +0 -2
  200. package/dist/assets/HomeClaudeConfig-ijEXs--3.js +0 -3
  201. package/dist/assets/Scheduler-YT3j8SUa.js +0 -16
  202. package/dist/assets/ViewTabs-B7qLXRAH.js +0 -1
  203. package/dist/assets/index-CtxruO1L.js +0 -3121
  204. package/src/main/lib/epic/epicStateWatcher.cjs +0 -157
@@ -0,0 +1,598 @@
1
+ // @ts-check
2
+ /**
3
+ * siteFeedbackInbox — the ONLY writer of <project>/session-manager-operations/feedback-inbox/.
4
+ * One folder per decrypted website-widget report:
5
+ *
6
+ * feedback-inbox/items/<hostId>/report.json the validated Report v1 (feedbackReport.cjs)
7
+ * feedback-inbox/items/<hostId>/meta.json { hostId, boxId, receivedAt, origin, status,
8
+ * statusNote, epicId, statusChangedAt,
9
+ * reporterVerified }
10
+ * feedback-inbox/items/<hostId>/screenshot.png
11
+ * feedback-inbox/items/<hostId>/annotated.png
12
+ * feedback-inbox/index.json { version: 1, byClientReportId: { [clientReportId]: hostId } }
13
+ * — the dedupe index; rebuilt from items/ when
14
+ * missing or corrupt, so it is a cache, not truth
15
+ * feedback-inbox/rejected.jsonl one { at, boxId, hostId, code, bytes } line per
16
+ * envelope the drain could not open (no content)
17
+ *
18
+ * The inbox UI, Open as Epic and the Feedback MCP all read through this module. Every write goes
19
+ * through config.cjs writers as writer 'feedback-inbox' (single-writer law, opsOwnership.cjs);
20
+ * deletes pass assertOpsWrite first. The namespace is runtime (personal data), so its self-ignore
21
+ * `.gitignore` is ensured after every write. hostId must match ^FB-[0-9A-Z]{5}$ and every resolved
22
+ * path is checked to stay inside the namespace. Writes are serialized in-process so dedupe on
23
+ * report.clientReportId cannot race. Dedupe is one index lookup: the index entry is written BEFORE
24
+ * the item files (meta.json last), so a crash mid-write leaves an entry whose item has no meta.json;
25
+ * the next write of that clientReportId under the same hostId resumes it, and a lookup whose item
26
+ * is gone drops the entry. A hostId already stored for a different clientReportId is refused with
27
+ * an error whose `code` is 'host_id_clash' (the drain records and acks such an envelope).
28
+ *
29
+ * Every write path first registers cwd with config.addAllowedRoot, so a project root nothing
30
+ * else registered this session is still writable — but only a known widget project (a box's
31
+ * projectCwd, or a cwd already holding feedback-inbox/); any other cwd throws code
32
+ * 'unknown_project' and the boundary is not widened (see registerRoot).
33
+ *
34
+ * `reporterVerified` is the drain's signed-reporter check (feedbackBoxDrain.cjs): true, false or
35
+ * null (no signature); anything else given to writeItem is stored as null.
36
+ *
37
+ * `statusChangedAt` (receivedAt at write, then the time of each setStatus) is what prune() ages.
38
+ */
39
+ 'use strict';
40
+
41
+ const fs = require('node:fs');
42
+ const fsp = require('node:fs/promises');
43
+ const os = require('node:os');
44
+ const path = require('node:path');
45
+ const config = require('../../config.cjs');
46
+ const feedbackBoxKeys = require('./feedbackBoxKeys.cjs');
47
+ const { readJsonOr } = require('../util/atomicFs.cjs');
48
+ const { opsPath, assertOpsWrite, ensureRuntimeIgnores, resolveProjectRoot } = require('../opsOwnership.cjs');
49
+
50
+ const NAMESPACE = 'feedback-inbox';
51
+ const WRITER = 'feedback-inbox';
52
+ const HOST_ID_RE = /^FB-[0-9A-Z]{5}$/;
53
+ const STATUSES = /** @type {const} */ (['open', 'in_progress', 'resolved', 'wontfix']);
54
+ const PRUNABLE = new Set(['resolved', 'wontfix']);
55
+ const MAX_STATUS_NOTE = 500;
56
+ const DAY_MS = 24 * 60 * 60 * 1000;
57
+
58
+ /**
59
+ * @typedef {(typeof STATUSES)[number]} InboxStatus
60
+ * @typedef {{ hostId: string, boxId: string, receivedAt: string, origin: string,
61
+ * status: InboxStatus, statusNote: string | null, epicId: string | null,
62
+ * statusChangedAt: string, reporterVerified?: boolean | null }} InboxMeta
63
+ * @typedef {InboxMeta & { title: string, type: string, reporter: { id: string, name: string | null, email: string | null } | null }} InboxSummary
64
+ */
65
+
66
+ /** @type {Promise<unknown>} */
67
+ let queue = Promise.resolve();
68
+ /**
69
+ * Run fn after every earlier queued write; errors propagate to the caller only.
70
+ * @template T
71
+ * @param {() => Promise<T>} fn
72
+ * @returns {Promise<T>}
73
+ */
74
+ function serialize(fn) {
75
+ const run = queue.then(fn, fn);
76
+ queue = run.catch(() => {});
77
+ return run;
78
+ }
79
+
80
+ /** @param {unknown} hostId */
81
+ function assertHostId(hostId) {
82
+ if (typeof hostId !== 'string' || !HOST_ID_RE.test(hostId)) {
83
+ throw new Error('siteFeedbackInbox: hostId must match ^FB-[0-9A-Z]{5}$');
84
+ }
85
+ }
86
+
87
+ /** @param {string} cwd */
88
+ function nsRoot(cwd) {
89
+ return opsPath(cwd, NAMESPACE);
90
+ }
91
+
92
+ /** @param {string} cwd */
93
+ function indexPath(cwd) {
94
+ return path.join(nsRoot(cwd), 'index.json');
95
+ }
96
+
97
+ /** @param {string} cwd */
98
+ function itemsRoot(cwd) {
99
+ return path.join(nsRoot(cwd), 'items');
100
+ }
101
+
102
+ /**
103
+ * Absolute path of an item folder (or a file in it), refusing anything outside the namespace.
104
+ * @param {string} cwd
105
+ * @param {string} hostId
106
+ * @param {string} [file]
107
+ */
108
+ function itemPath(cwd, hostId, file) {
109
+ assertHostId(hostId);
110
+ const root = nsRoot(cwd);
111
+ const p = file ? path.join(itemsRoot(cwd), hostId, file) : path.join(itemsRoot(cwd), hostId);
112
+ const rel = path.relative(root, p);
113
+ if (!rel || rel.startsWith('..') || path.isAbsolute(rel)) {
114
+ throw new Error('siteFeedbackInbox: path escapes the feedback-inbox namespace');
115
+ }
116
+ return p;
117
+ }
118
+
119
+ /** @param {string} abs @returns {Promise<any>} */
120
+ function readJsonFile(abs) {
121
+ return readJsonOr(abs, null);
122
+ }
123
+
124
+ /** @param {string} cwd @returns {Promise<string[]>} */
125
+ async function listHostIds(cwd) {
126
+ let names;
127
+ try {
128
+ names = await fsp.readdir(itemsRoot(cwd));
129
+ } catch {
130
+ return [];
131
+ }
132
+ return names.filter((n) => HOST_ID_RE.test(n));
133
+ }
134
+
135
+ /** @param {string} abs @param {unknown} data */
136
+ async function writeJson(abs, data) {
137
+ await config.writeJson(abs, data, { writer: WRITER });
138
+ }
139
+
140
+ /** @param {string} cwd */
141
+ function ensureIgnore(cwd) {
142
+ ensureRuntimeIgnores(resolveProjectRoot(cwd));
143
+ }
144
+
145
+ /**
146
+ * Error for a cwd that is not a known widget project; `code` is 'unknown_project'.
147
+ * @param {string} message
148
+ */
149
+ function unknownProject(message) {
150
+ const err = new Error(`siteFeedbackInbox: ${message}`);
151
+ /** @type {any} */ (err).code = 'unknown_project';
152
+ return err;
153
+ }
154
+
155
+ /** @param {string} p */
156
+ function isDirSync(p) {
157
+ try { return fs.statSync(p).isDirectory(); } catch { return false; }
158
+ }
159
+
160
+ /** @param {string} parent @param {string} child true when child is strictly inside parent */
161
+ function isStrictAncestor(parent, child) {
162
+ const rel = path.relative(parent, child);
163
+ return !!rel && !rel.startsWith('..') && !path.isAbsolute(rel);
164
+ }
165
+
166
+ /** @param {string} p @returns {string | null} canonical real path, or null when it does not resolve */
167
+ function realOrNull(p) {
168
+ try { return fs.realpathSync(p); } catch { return null; }
169
+ }
170
+
171
+ /**
172
+ * The one candidate check: cwd's fs.realpathSync canonical path, or null when it does not
173
+ * resolve or is the home directory or the filesystem root (never a feedback project).
174
+ * @param {unknown} cwd
175
+ * @returns {string | null}
176
+ */
177
+ function canonicalCandidate(cwd) {
178
+ if (typeof cwd !== 'string' || !cwd) return null;
179
+ const abs = realOrNull(cwd);
180
+ if (!abs) return null;
181
+ const home = realOrNull(os.homedir()) || path.resolve(os.homedir());
182
+ if (abs === home || abs === path.resolve(os.homedir()) || abs === path.parse(abs).root) return null;
183
+ return abs;
184
+ }
185
+
186
+ /**
187
+ * The shared known-project check (this module's registerRoot and siteFeedbackAdminRoutes.cjs):
188
+ * cwd's canonical path when it resolves, is not the home directory or the filesystem root, and
189
+ * equals the canonical projectCwd of one of `boxes` (a box projectCwd that does not resolve
190
+ * matches nothing); otherwise null.
191
+ * @param {unknown} cwd
192
+ * @param {ReadonlyArray<unknown>} boxes feedbackBoxKeys.listBoxes() entries
193
+ * @returns {string | null}
194
+ */
195
+ function resolveKnownProject(cwd, boxes) {
196
+ const abs = canonicalCandidate(cwd);
197
+ if (!abs || !Array.isArray(boxes)) return null;
198
+ const known = boxes.some((b) => {
199
+ const pc = b && typeof b === 'object' ? /** @type {any} */ (b).projectCwd : undefined;
200
+ return typeof pc === 'string' && realOrNull(pc) === abs;
201
+ });
202
+ return known ? abs : null;
203
+ }
204
+
205
+ /**
206
+ * One operation's keystore view: the box list is read at most once per scope and never cached
207
+ * across calls (a fresh scope per writeItem/updateMeta/... call).
208
+ * @typedef {{ boxes: () => Promise<Array<{ projectCwd?: unknown }>> }} RootScope
209
+ * @returns {RootScope}
210
+ */
211
+ function rootScope() {
212
+ /** @type {Promise<Array<{ projectCwd?: unknown }>> | null} */
213
+ let pending = null;
214
+ return { boxes: () => (pending ||= feedbackBoxKeys.listBoxes()) };
215
+ }
216
+
217
+ /**
218
+ * Widen config.cjs's write boundary to this project root right before a write, as
219
+ * projectHomeAdminRoutes.cjs does: the drain reaches projects no pty/route registered this
220
+ * session. Only a known widget project is registered: cwd must be absolute, an existing
221
+ * directory, and either the projectCwd of a box in feedbackBoxKeys or already hold a
222
+ * session-manager-operations/feedback-inbox/ namespace. Paths compare as fs.realpathSync
223
+ * canonical paths, so a symlink to a known project is known; a box projectCwd that does not
224
+ * resolve matches nothing. The home directory, the filesystem root and (for the namespace case)
225
+ * any ancestor of a box's project are never registered. Anything else throws `unknown_project`
226
+ * before the boundary is touched.
227
+ * @param {unknown} cwd
228
+ * @param {RootScope} [scope] reuse one keystore read across a single operation's re-registrations
229
+ * @returns {Promise<string>} the canonical root registered
230
+ */
231
+ async function registerRoot(cwd, scope = rootScope()) {
232
+ if (typeof cwd !== 'string' || !cwd || !path.isAbsolute(cwd)) {
233
+ throw new Error('siteFeedbackInbox: cwd must be an absolute path');
234
+ }
235
+ if (!isDirSync(cwd)) throw new Error('siteFeedbackInbox: cwd does not exist or is not a directory');
236
+ const abs = canonicalCandidate(cwd);
237
+ if (!abs) throw unknownProject('cwd does not resolve, or is the home directory or filesystem root');
238
+ const boxes = await scope.boxes();
239
+ let known = resolveKnownProject(abs, boxes) !== null;
240
+ if (!known) {
241
+ /** @type {string[]} */
242
+ const projects = [];
243
+ for (const b of boxes) {
244
+ const real = b && typeof b.projectCwd === 'string' ? realOrNull(b.projectCwd) : null;
245
+ if (real) projects.push(real);
246
+ }
247
+ if (projects.some((p) => isStrictAncestor(abs, p))) throw unknownProject('cwd is not a project with a feedback widget');
248
+ let ns = '';
249
+ try { ns = nsRoot(abs); } catch { /* not a resolvable project root */ }
250
+ known = !!ns && isDirSync(ns);
251
+ }
252
+ if (!known) throw unknownProject('cwd is not a project with a feedback widget');
253
+ config.addAllowedRoot(abs);
254
+ return abs;
255
+ }
256
+
257
+ /** @typedef {Record<string, string>} ClientIdIndex clientReportId -> hostId */
258
+
259
+ /** @param {unknown} raw @returns {ClientIdIndex | null} */
260
+ function parseIndex(raw) {
261
+ const r = /** @type {any} */ (raw);
262
+ if (!r || typeof r !== 'object' || r.version !== 1) return null;
263
+ const by = r.byClientReportId;
264
+ if (!by || typeof by !== 'object' || Array.isArray(by)) return null;
265
+ /** @type {ClientIdIndex} */
266
+ const out = Object.create(null);
267
+ for (const [k, v] of Object.entries(by)) {
268
+ if (typeof v !== 'string' || !HOST_ID_RE.test(v)) return null;
269
+ out[k] = v;
270
+ }
271
+ return out;
272
+ }
273
+
274
+ /**
275
+ * The dedupe index, rebuilt from items/<hostId>/report.json when missing or corrupt.
276
+ * Call only inside serialize().
277
+ * @param {string} cwd
278
+ * @returns {Promise<ClientIdIndex>}
279
+ */
280
+ async function loadIndex(cwd) {
281
+ const parsed = parseIndex(await readJsonFile(indexPath(cwd)));
282
+ if (parsed) return parsed;
283
+ /** @type {ClientIdIndex} */
284
+ const rebuilt = Object.create(null);
285
+ for (const id of await listHostIds(cwd)) {
286
+ const report = await readJsonFile(itemPath(cwd, id, 'report.json'));
287
+ const crid = report && typeof report === 'object' ? report.clientReportId : undefined;
288
+ if (typeof crid === 'string' && crid && !(crid in rebuilt)) rebuilt[crid] = id;
289
+ }
290
+ return rebuilt;
291
+ }
292
+
293
+ /** @param {string} cwd @param {ClientIdIndex} index @param {RootScope} [scope] */
294
+ async function saveIndex(cwd, index, scope) {
295
+ await registerRoot(cwd, scope);
296
+ await writeJson(indexPath(cwd), { version: 1, byClientReportId: { ...index } });
297
+ }
298
+
299
+ /** @param {string} abs */
300
+ async function exists(abs) {
301
+ try { await fsp.access(abs); return true; } catch { return false; }
302
+ }
303
+
304
+ /** @param {unknown} v @param {string} name */
305
+ function requireString(v, name) {
306
+ if (typeof v !== 'string' || !v) throw new Error(`siteFeedbackInbox: ${name} must be a non-empty string`);
307
+ return v;
308
+ }
309
+
310
+ /** @param {unknown} v @param {string} name */
311
+ function requireBuffer(v, name) {
312
+ if (!Buffer.isBuffer(v) && !(v instanceof Uint8Array)) throw new Error(`siteFeedbackInbox: ${name} must be a Buffer`);
313
+ return v;
314
+ }
315
+
316
+ /**
317
+ * Store one decrypted report. No-op `{ duplicate: true }` when report.clientReportId is already stored.
318
+ * @param {{ cwd: string, hostId: string, boxId: string, receivedAt: string, origin: string,
319
+ * report: { clientReportId: string } & Record<string, unknown>, screenshot: Uint8Array, annotated: Uint8Array,
320
+ * reporterVerified?: boolean | null }} args
321
+ * @returns {Promise<{ duplicate: true, hostId: string } | { duplicate: false, hostId: string }>}
322
+ */
323
+ async function writeItem(args) {
324
+ const { cwd, hostId, boxId, receivedAt, origin, report, screenshot, annotated, reporterVerified } = args || /** @type {any} */ ({});
325
+ assertHostId(hostId);
326
+ requireString(boxId, 'boxId');
327
+ requireString(receivedAt, 'receivedAt');
328
+ requireString(origin, 'origin');
329
+ if (!report || typeof report !== 'object') throw new Error('siteFeedbackInbox: report must be an object');
330
+ const clientReportId = requireString(report.clientReportId, 'report.clientReportId');
331
+ requireBuffer(screenshot, 'screenshot');
332
+ requireBuffer(annotated, 'annotated');
333
+ const scope = rootScope();
334
+ await registerRoot(cwd, scope);
335
+ return serialize(async () => {
336
+ const index = await loadIndex(cwd);
337
+ const known = index[clientReportId];
338
+ let resume = false;
339
+ if (known) {
340
+ if (await exists(itemPath(cwd, known, 'meta.json'))) return { duplicate: true, hostId: known };
341
+ // Entry without a complete item: a crashed write (resume it if same hostId) or a stale entry.
342
+ if (known === hostId) resume = true;
343
+ else delete index[clientReportId];
344
+ }
345
+ if (!resume && await exists(itemPath(cwd, hostId))) {
346
+ const err = new Error(`siteFeedbackInbox: hostId ${hostId} is already stored for another report`);
347
+ /** @type {any} */ (err).code = 'host_id_clash';
348
+ throw err;
349
+ }
350
+ index[clientReportId] = hostId;
351
+ await saveIndex(cwd, index, scope);
352
+ await registerRoot(cwd, scope);
353
+ await config.writeBinaryAtomic(itemPath(cwd, hostId, 'screenshot.png'), screenshot, { writer: WRITER });
354
+ await config.writeBinaryAtomic(itemPath(cwd, hostId, 'annotated.png'), annotated, { writer: WRITER });
355
+ await writeJson(itemPath(cwd, hostId, 'report.json'), report);
356
+ /** @type {InboxMeta} */
357
+ const meta = {
358
+ hostId, boxId, receivedAt, origin,
359
+ status: 'open', statusNote: null, epicId: null,
360
+ statusChangedAt: receivedAt,
361
+ reporterVerified: typeof reporterVerified === 'boolean' ? reporterVerified : null,
362
+ };
363
+ // meta.json last: an item with meta.json is complete.
364
+ await writeJson(itemPath(cwd, hostId, 'meta.json'), meta);
365
+ ensureIgnore(cwd);
366
+ return { duplicate: false, hostId };
367
+ });
368
+ }
369
+
370
+ const REJECT_CODE_RE = /^[a-z0-9_]{1,64}$/;
371
+
372
+ /**
373
+ * Append one line to feedback-inbox/rejected.jsonl for an envelope the drain could not open.
374
+ * Only the fixed fields are written — never report text, image bytes or key material.
375
+ * @param {{ cwd: string, at: string, boxId: string, hostId: string, code: string, bytes: number }} args
376
+ * @returns {Promise<void>}
377
+ */
378
+ async function appendRejected(args) {
379
+ const { cwd, at, boxId, hostId, code, bytes } = args || /** @type {any} */ ({});
380
+ requireString(at, 'at');
381
+ requireString(boxId, 'boxId');
382
+ if (typeof hostId !== 'string') throw new Error('siteFeedbackInbox: hostId must be a string');
383
+ if (typeof code !== 'string' || !REJECT_CODE_RE.test(code)) throw new Error('siteFeedbackInbox: code must be a short snake_case code');
384
+ if (typeof bytes !== 'number' || !Number.isFinite(bytes) || bytes < 0) throw new Error('siteFeedbackInbox: bytes must be a non-negative number');
385
+ const scope = rootScope();
386
+ await registerRoot(cwd, scope);
387
+ const line = JSON.stringify({ at, boxId, hostId: hostId.slice(0, 64), code, bytes }) + '\n';
388
+ const file = path.join(nsRoot(cwd), 'rejected.jsonl');
389
+ return serialize(async () => {
390
+ /** @type {string} */
391
+ let prev = '';
392
+ try { prev = await fsp.readFile(file, 'utf8'); } catch { /* first line */ }
393
+ if (prev && !prev.endsWith('\n')) prev += '\n';
394
+ await registerRoot(cwd, scope);
395
+ await config.writeTextAtomic(file, prev + line, { writer: WRITER });
396
+ ensureIgnore(cwd);
397
+ });
398
+ }
399
+
400
+ /** @param {unknown} report */
401
+ function summarize(report) {
402
+ const r = /** @type {any} */ (report) || {};
403
+ const u = r.user && typeof r.user === 'object' ? r.user : null;
404
+ return {
405
+ title: typeof r.title === 'string' ? r.title : '',
406
+ type: typeof r.type === 'string' ? r.type : 'other',
407
+ reporter: u ? {
408
+ id: typeof u.id === 'string' ? u.id : '',
409
+ name: typeof u.name === 'string' ? u.name : null,
410
+ email: typeof u.email === 'string' ? u.email : null,
411
+ } : null,
412
+ };
413
+ }
414
+
415
+ /** @param {string} cwd @param {string} hostId @returns {Promise<InboxMeta | null>} */
416
+ async function readMeta(cwd, hostId) {
417
+ const meta = await readJsonFile(itemPath(cwd, hostId, 'meta.json'));
418
+ return meta && typeof meta === 'object' && meta.hostId === hostId ? meta : null;
419
+ }
420
+
421
+ /**
422
+ * All stored items (meta + title/type/reporter), newest receivedAt first.
423
+ * @param {string} cwd
424
+ * @param {{ status?: InboxStatus }} [opts]
425
+ * @returns {Promise<InboxSummary[]>}
426
+ */
427
+ async function list(cwd, opts = {}) {
428
+ const want = opts && opts.status;
429
+ if (want !== undefined && !STATUSES.includes(want)) throw new Error('siteFeedbackInbox: unknown status filter');
430
+ /** @type {InboxSummary[]} */
431
+ const out = [];
432
+ for (const id of await listHostIds(cwd)) {
433
+ const meta = await readMeta(cwd, id);
434
+ if (!meta) continue;
435
+ if (want && meta.status !== want) continue;
436
+ const report = await readJsonFile(itemPath(cwd, id, 'report.json'));
437
+ out.push({ ...meta, ...summarize(report) });
438
+ }
439
+ out.sort((a, b) => (Date.parse(b.receivedAt) || 0) - (Date.parse(a.receivedAt) || 0)
440
+ || b.hostId.localeCompare(a.hostId));
441
+ return out;
442
+ }
443
+
444
+ /**
445
+ * One item, or null when absent.
446
+ * @param {string} cwd
447
+ * @param {string} hostId
448
+ */
449
+ async function get(cwd, hostId) {
450
+ const meta = await readMeta(cwd, hostId);
451
+ if (!meta) return null;
452
+ const report = await readJsonFile(itemPath(cwd, hostId, 'report.json'));
453
+ /** @type {{ screenshot: string | null, annotated: string | null }} */
454
+ const imagePaths = { screenshot: null, annotated: null };
455
+ for (const k of /** @type {const} */ (['screenshot', 'annotated'])) {
456
+ const p = itemPath(cwd, hostId, `${k}.png`);
457
+ try { await fsp.access(p); imagePaths[k] = p; } catch { /* absent */ }
458
+ }
459
+ return { meta, report, imagePaths };
460
+ }
461
+
462
+ /**
463
+ * Read-modify-write meta.json under the write queue.
464
+ * @param {string} cwd
465
+ * @param {string} hostId
466
+ * @param {(meta: InboxMeta) => InboxMeta} patch
467
+ */
468
+ async function updateMeta(cwd, hostId, patch) {
469
+ assertHostId(hostId);
470
+ const scope = rootScope();
471
+ await registerRoot(cwd, scope);
472
+ return serialize(async () => {
473
+ const meta = await readMeta(cwd, hostId);
474
+ if (!meta) throw new Error(`siteFeedbackInbox: no item ${hostId}`);
475
+ const next = patch(meta);
476
+ await registerRoot(cwd, scope);
477
+ await writeJson(itemPath(cwd, hostId, 'meta.json'), next);
478
+ ensureIgnore(cwd);
479
+ return next;
480
+ });
481
+ }
482
+
483
+ /**
484
+ * Set the owner's status (+ optional note, at most 500 chars).
485
+ * @param {string} cwd
486
+ * @param {string} hostId
487
+ * @param {InboxStatus} status
488
+ * @param {string | null} [note]
489
+ * @param {{ now?: number }} [opts]
490
+ */
491
+ async function setStatus(cwd, hostId, status, note = null, opts = {}) {
492
+ if (!STATUSES.includes(status)) throw new Error('siteFeedbackInbox: status must be open, in_progress, resolved or wontfix');
493
+ if (note != null && (typeof note !== 'string' || note.length > MAX_STATUS_NOTE)) {
494
+ throw new Error(`siteFeedbackInbox: note must be a string of at most ${MAX_STATUS_NOTE} chars`);
495
+ }
496
+ const at = new Date(opts.now ?? Date.now()).toISOString();
497
+ return updateMeta(cwd, hostId, (m) => ({ ...m, status, statusNote: note || null, statusChangedAt: at }));
498
+ }
499
+
500
+ /**
501
+ * Record the Epic opened from this item.
502
+ * @param {string} cwd
503
+ * @param {string} hostId
504
+ * @param {string} epicId
505
+ */
506
+ async function linkEpic(cwd, hostId, epicId) {
507
+ if (typeof epicId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/.test(epicId)) {
508
+ throw new Error('siteFeedbackInbox: epicId must be a safe Epic id');
509
+ }
510
+ return updateMeta(cwd, hostId, (m) => ({ ...m, epicId }));
511
+ }
512
+
513
+ /** @param {string} cwd @param {string} hostId @param {RootScope} [scope] */
514
+ async function removeNow(cwd, hostId, scope) {
515
+ const dir = itemPath(cwd, hostId);
516
+ await registerRoot(cwd, scope);
517
+ assertOpsWrite(dir, WRITER);
518
+ await fsp.rm(dir, { recursive: true, force: true });
519
+ }
520
+
521
+ /**
522
+ * Remove index entries pointing at removed hostIds. Call only inside serialize().
523
+ * @param {string} cwd
524
+ * @param {Set<string>} hostIds
525
+ * @param {RootScope} [scope]
526
+ */
527
+ async function dropFromIndex(cwd, hostIds, scope) {
528
+ const index = await loadIndex(cwd);
529
+ let changed = false;
530
+ for (const [crid, id] of Object.entries(index)) {
531
+ if (hostIds.has(id)) { delete index[crid]; changed = true; }
532
+ }
533
+ if (changed) await saveIndex(cwd, index, scope);
534
+ }
535
+
536
+ /**
537
+ * Delete one item. Returns whether it existed.
538
+ * @param {string} cwd
539
+ * @param {string} hostId
540
+ */
541
+ async function remove(cwd, hostId) {
542
+ assertHostId(hostId);
543
+ const scope = rootScope();
544
+ await registerRoot(cwd, scope);
545
+ return serialize(async () => {
546
+ let existed = true;
547
+ try { await fsp.access(itemPath(cwd, hostId)); } catch { existed = false; }
548
+ await removeNow(cwd, hostId, scope);
549
+ await dropFromIndex(cwd, new Set([hostId]), scope);
550
+ return { removed: existed };
551
+ });
552
+ }
553
+
554
+ /**
555
+ * Delete resolved/wontfix items whose status changed more than `days` ago.
556
+ * @param {string} cwd
557
+ * @param {number} days
558
+ * @param {{ now?: number }} [opts]
559
+ * @returns {Promise<string[]>} pruned hostIds
560
+ */
561
+ async function prune(cwd, days, opts = {}) {
562
+ if (typeof days !== 'number' || !Number.isFinite(days) || days < 0) {
563
+ throw new Error('siteFeedbackInbox: days must be a non-negative number');
564
+ }
565
+ const scope = rootScope();
566
+ await registerRoot(cwd, scope);
567
+ const cutoff = (opts.now ?? Date.now()) - days * DAY_MS;
568
+ return serialize(async () => {
569
+ /** @type {string[]} */
570
+ const pruned = [];
571
+ for (const id of await listHostIds(cwd)) {
572
+ const meta = await readMeta(cwd, id);
573
+ if (!meta || !PRUNABLE.has(meta.status)) continue;
574
+ const changed = Date.parse(meta.statusChangedAt || meta.receivedAt);
575
+ if (!Number.isFinite(changed) || changed >= cutoff) continue;
576
+ await removeNow(cwd, id, scope);
577
+ pruned.push(id);
578
+ }
579
+ if (pruned.length) await dropFromIndex(cwd, new Set(pruned), scope);
580
+ return pruned;
581
+ });
582
+ }
583
+
584
+ module.exports = {
585
+ resolveKnownProject,
586
+ writeItem,
587
+ appendRejected,
588
+ list,
589
+ get,
590
+ setStatus,
591
+ linkEpic,
592
+ remove,
593
+ prune,
594
+ STATUSES,
595
+ HOST_ID_RE,
596
+ MAX_STATUS_NOTE,
597
+ HOST_ID_CLASH: 'host_id_clash',
598
+ };
@@ -0,0 +1,86 @@
1
+ // @ts-check
2
+ 'use strict';
3
+
4
+ /**
5
+ * Renderer-facing IPC for website-feedback widgets and their decrypted inbox. Every channel
6
+ * validates its payload with a strict schema from ipcSchemas.cjs (a malformed payload throws,
7
+ * so Electron rejects the invoke) and delegates to siteFeedbackService — the one
8
+ * implementation shared with the Feedback MCP admin routes. Results come back unchanged
9
+ * except that secret-named fields are stripped, so no channel can ever hand the renderer a
10
+ * box private key or the paired device token even if a lower layer starts returning one.
11
+ * The box identity secret is redacted too, everywhere except the two identity-secret channels,
12
+ * which hand it to the renderer only when the user explicitly asks to see or rotate it.
13
+ */
14
+
15
+ /** Field names that must never cross the bridge. Matched case-insensitively. */
16
+ const SECRET_KEYS = new Set(['privatekeyjwk', 'privatekey', 'devicetoken', 'token', 'secret', 'identitysecret']);
17
+
18
+ /**
19
+ * Deep copy of `value` without any secret-named field.
20
+ * @param {unknown} value
21
+ * @returns {any}
22
+ */
23
+ function redactSecrets(value) {
24
+ if (Array.isArray(value)) return value.map(redactSecrets);
25
+ if (value && typeof value === 'object') {
26
+ /** @type {Record<string, unknown>} */
27
+ const out = {};
28
+ for (const [k, v] of Object.entries(value)) {
29
+ if (SECRET_KEYS.has(k.toLowerCase())) continue;
30
+ out[k] = redactSecrets(v);
31
+ }
32
+ return out;
33
+ }
34
+ return value;
35
+ }
36
+
37
+ /**
38
+ * @param {{ ipcMain?: any, service?: any }} [deps]
39
+ */
40
+ function registerSiteFeedbackHandlers(deps = {}) {
41
+ const ipcMain = deps.ipcMain || require('electron').ipcMain;
42
+ const { schemas: s, validated: v } = require('../../ipcSchemas.cjs');
43
+ const service = deps.service || require('./siteFeedbackService.cjs');
44
+
45
+ /**
46
+ * @param {string} channel
47
+ * @param {import('zod').ZodTypeAny} schema
48
+ * @param {(p: any) => Promise<unknown>} call
49
+ */
50
+ const handle = (channel, schema, call) => {
51
+ ipcMain.handle(channel, v(schema, async (/** @type {any} */ p) => redactSecrets(await call(p))));
52
+ };
53
+
54
+ handle('siteFeedback:widget-create', s.siteFeedbackWidgetCreate, (p) => service.createWidget(p));
55
+ handle('siteFeedback:widget-list', s.siteFeedbackWidgetList, (p) => service.listWidgets(p));
56
+ handle('siteFeedback:widget-update', s.siteFeedbackWidgetUpdate, (p) => service.updateWidget(p));
57
+ handle('siteFeedback:widget-delete', s.siteFeedbackWidgetBox, (p) => service.deleteWidget(p));
58
+ handle('siteFeedback:widget-snippet', s.siteFeedbackWidgetBox, (p) => service.getSnippet(p));
59
+ /**
60
+ * Explicit-request only: the one place the identity secret crosses the bridge. Everything else
61
+ * in the result is still redacted; only a string `identitySecret` is passed back.
62
+ * @param {string} channel
63
+ * @param {(p: any) => Promise<any>} call
64
+ */
65
+ const handleIdentitySecret = (channel, call) => {
66
+ ipcMain.handle(channel, v(s.siteFeedbackWidgetBox, async (/** @type {any} */ p) => {
67
+ const r = await call(p);
68
+ const out = redactSecrets(r);
69
+ if (r && r.ok === true && typeof r.identitySecret === 'string') out.identitySecret = r.identitySecret;
70
+ return out;
71
+ }));
72
+ };
73
+ // Never log these results: they carry the site owner's HMAC signing secret.
74
+ handleIdentitySecret('siteFeedback:widget-identity-secret', (p) => service.getIdentitySecret(p));
75
+ handleIdentitySecret('siteFeedback:widget-identity-secret-rotate', (p) => service.rotateIdentitySecret(p));
76
+ handle('siteFeedback:inbox-list', s.siteFeedbackInboxList, (p) => service.listItems(p));
77
+ handle('siteFeedback:inbox-get', s.siteFeedbackInboxGet, (p) => service.getItem(p));
78
+ // Returns a PNG data URL to the renderer only — never log it.
79
+ handle('siteFeedback:inbox-image', s.siteFeedbackInboxImage, (p) => service.getImage(p));
80
+ handle('siteFeedback:inbox-set-status', s.siteFeedbackInboxSetStatus, (p) => service.setStatus(p));
81
+ handle('siteFeedback:inbox-link-epic', s.siteFeedbackInboxLinkEpic, (p) => service.linkEpic(p));
82
+ handle('siteFeedback:inbox-remove', s.siteFeedbackInboxGet, (p) => service.removeItem(p));
83
+ handle('siteFeedback:drain-now', s.siteFeedbackDrainNow, () => service.drainNow());
84
+ }
85
+
86
+ module.exports = { registerSiteFeedbackHandlers, redactSecrets, SECRET_KEYS };