claude-code-session-manager 0.111.0 → 0.113.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 (290) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/dist/assets/{AgentLibrary-rBO1daqM.js → AgentLibrary-wvrcLGGS.js} +2 -2
  3. package/dist/assets/{Button-DsEYRZg0.js → Button-B6h0F0XT.js} +1 -1
  4. package/dist/assets/{DataModel-D8sbvvBC.js → DataModel-C5pW9E3u.js} +1 -1
  5. package/dist/assets/{History-BEHLtxia.js → History-BV4e8YOM.js} +2 -2
  6. package/dist/assets/{Hooks-CKpvlXrg.js → Hooks-CrFSv4x1.js} +3 -3
  7. package/dist/assets/{Library-CeF4qh9d.js → Library-D-GIt3EY.js} +5 -5
  8. package/dist/assets/{ListDetail-DcfmxPFk.js → ListDetail-Bco_wfs6.js} +1 -1
  9. package/dist/assets/{MarkdownEditor-CvK1pyto.js → MarkdownEditor-C-yHSXNV.js} +1 -1
  10. package/dist/assets/{McpServers-D-h2ihzJ.js → McpServers-CfDekadG.js} +2 -2
  11. package/dist/assets/{Memory-BnF89x8v.js → Memory-CGGLexkR.js} +4 -4
  12. package/dist/assets/{Panel-CQY5zano.js → Panel-DGMEuYYG.js} +1 -1
  13. package/dist/assets/{Permissions-DLukmmsz.js → Permissions-Cx2zjtYZ.js} +3 -3
  14. package/dist/assets/{Plugins-0Pf0OZ4l.js → Plugins-Bc_W3IyR.js} +2 -2
  15. package/dist/assets/ProvenanceBadge-DiKAUR1u.js +1 -0
  16. package/dist/assets/RemoteMachines-8_77-WPD.js +3 -0
  17. package/dist/assets/{SaveBar-DjijiUb0.js → SaveBar-Blpzdq1R.js} +1 -1
  18. package/dist/assets/{Scheduler-Cm3EXZvE.js → Scheduler-Bd70AM4X.js} +9 -9
  19. package/dist/assets/{ScopeSwitcher-B-P-kSfq.js → ScopeSwitcher-wxN0h4YW.js} +1 -1
  20. package/dist/assets/Settings-CQ7DA3zW.js +4 -0
  21. package/dist/assets/{SkillReferenceGraph-Epv2GJmj.js → SkillReferenceGraph-DH1NLOiS.js} +1 -1
  22. package/dist/assets/Skills-CmyRyu4_.js +2 -0
  23. package/dist/assets/SystemPrompt-KAc3UMCd.js +1 -0
  24. package/dist/assets/TagLibrary-C8EvHnpg.js +1 -0
  25. package/dist/assets/{TiptapBody-DAMO3DhO.js → TiptapBody-d423mH6D.js} +1 -1
  26. package/dist/assets/{Toggle-Ba_f7q_m.js → Toggle-D1wsGE9S.js} +1 -1
  27. package/dist/assets/{ViewTabs-CGX6MAhc.js → ViewTabs-CjHw3kGY.js} +1 -1
  28. package/dist/assets/{historyTotals-vgfk8EOL.js → historyTotals-DFHzqLt7.js} +1 -1
  29. package/dist/assets/{index-CPieAFsl.js → index-Ci1u018F.js} +266 -266
  30. package/dist/assets/{settingsSchema-D0FxNrTy.js → settingsSchema-Ctf3pZVI.js} +1 -1
  31. package/dist/assets/{useAgentsDirWatch-DCu6BNYN.js → useAgentsDirWatch-B1NBmOAe.js} +1 -1
  32. package/dist/assets/{useRemotePeers-D4cdJDyh.js → useRemotePeers-BHjSJs9D.js} +1 -1
  33. package/dist/index.html +1 -1
  34. package/package.json +3 -2
  35. package/plugins/CLAUDE.md +5 -8
  36. package/plugins/session-manager-dev/.claude-plugin/plugin.json +3 -6
  37. package/plugins/session-manager-dev/skills/builder/1-classify-and-bump/SKILL.md +2 -2
  38. package/plugins/session-manager-dev/skills/builder/SKILL.md +2 -3
  39. package/plugins/session-manager-dev/skills/develop/SKILL.md +1 -1
  40. package/plugins/session-manager-dev/skills/develop/standards.md +3 -3
  41. package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +13 -0
  42. package/scripts/README.md +3 -3
  43. package/scripts/audit-ops-hygiene.cjs +4 -4
  44. package/scripts/hooks/guard-destructive-git.cjs +4 -4
  45. package/scripts/hooks/guard-inline-implementation.cjs +1 -1
  46. package/scripts/hooks/guard-prd-writes.cjs +2 -2
  47. package/scripts/hooks/lib/guard-destructive-git-policy.cjs +1 -1
  48. package/scripts/mint-epic.cjs +2 -2
  49. package/scripts/scheduler-mcp-server.cjs +27 -9
  50. package/src/main/agentLibrary.cjs +5 -5
  51. package/src/main/agentsIpc.cjs +76 -0
  52. package/src/main/build-info.json +4 -4
  53. package/src/main/chatRunner.cjs +30 -13
  54. package/src/main/config.cjs +20 -3
  55. package/src/main/crashDiagnostics.cjs +2 -2
  56. package/src/main/docEdit.cjs +5 -5
  57. package/src/main/files.cjs +2 -2
  58. package/src/main/git.cjs +1 -1
  59. package/src/main/health.cjs +20 -18
  60. package/src/main/heapSnapshot.cjs +1 -1
  61. package/src/main/historyAggregator.cjs +2 -2
  62. package/src/main/index.cjs +50 -132
  63. package/src/main/ipcSchemas.cjs +13 -10
  64. package/src/main/lib/CLAUDE.md +48 -0
  65. package/src/main/lib/activeSessions.cjs +14 -1
  66. package/src/main/lib/classifyPromptTicket.cjs +2 -2
  67. package/src/main/lib/{agentModelResolve.cjs → claude/agentModelResolve.cjs} +7 -7
  68. package/src/main/lib/{claudeBin.cjs → claude/claudeBin.cjs} +4 -4
  69. package/src/main/lib/{effectiveModelInfo.cjs → claude/effectiveModelInfo.cjs} +9 -9
  70. package/src/main/lib/{modelCatalog.cjs → claude/modelCatalog.cjs} +3 -3
  71. package/src/main/lib/claude/rateLimitDetect.cjs +54 -0
  72. package/src/main/lib/{rateLimitWindow.cjs → claude/rateLimitWindow.cjs} +24 -12
  73. package/src/main/lib/{runClaudeP.cjs → claude/runClaudeP.cjs} +1 -1
  74. package/src/main/lib/credentials.cjs +18 -92
  75. package/src/main/lib/cwdClassify.cjs +1 -1
  76. package/src/main/lib/{activeIndexMerge.cjs → epic/activeIndexMerge.cjs} +3 -3
  77. package/src/main/lib/{activeIndexRebuild.cjs → epic/activeIndexRebuild.cjs} +1 -1
  78. package/src/main/lib/{delegationReadiness.cjs → epic/delegationReadiness.cjs} +21 -29
  79. package/src/main/lib/{epicContextDigest.cjs → epic/epicContextDigest.cjs} +1 -1
  80. package/src/main/lib/{epicDelegationStats.cjs → epic/epicDelegationStats.cjs} +2 -2
  81. package/src/main/lib/{epicMint.cjs → epic/epicMint.cjs} +11 -11
  82. package/src/main/lib/{epicSpawnPlan.cjs → epic/epicSpawnPlan.cjs} +3 -3
  83. package/src/main/lib/{epicStatusMirror.cjs → epic/epicStatusMirror.cjs} +2 -2
  84. package/src/main/lib/{epicTranscriptDiagnostic.cjs → epic/epicTranscriptDiagnostic.cjs} +2 -2
  85. package/src/main/lib/{epicTranscriptPath.cjs → epic/epicTranscriptPath.cjs} +2 -2
  86. package/src/main/lib/{epicValidationHook.cjs → epic/epicValidationHook.cjs} +3 -3
  87. package/src/main/lib/{epicWorktreeBoot.cjs → epic/epicWorktreeBoot.cjs} +1 -1
  88. package/src/main/lib/{epicWorktreeMerge.cjs → epic/epicWorktreeMerge.cjs} +3 -3
  89. package/src/main/lib/{epicWorktreeMint.cjs → epic/epicWorktreeMint.cjs} +3 -3
  90. package/src/main/lib/{epicWorktreeProjectConfig.cjs → epic/epicWorktreeProjectConfig.cjs} +4 -4
  91. package/src/main/lib/{promptSessionsCreateEpic.cjs → epic/promptSessionsCreateEpic.cjs} +4 -4
  92. package/src/main/lib/{crossProjectFeedback.cjs → feedback-remote/crossProjectFeedback.cjs} +114 -16
  93. package/src/main/lib/{customerFeedbackClient.cjs → feedback-remote/customerFeedbackClient.cjs} +3 -3
  94. package/src/main/lib/{customerFeedbackInbox.cjs → feedback-remote/customerFeedbackInbox.cjs} +2 -2
  95. package/src/main/lib/{customerFeedbackIpc.cjs → feedback-remote/customerFeedbackIpc.cjs} +1 -1
  96. package/src/main/lib/feedback-remote/humanPromptLedger.cjs +93 -0
  97. package/src/main/lib/{localAdminHttp.cjs → feedback-remote/localAdminHttp.cjs} +2 -2
  98. package/src/main/lib/{macroAdminRoutes.cjs → feedback-remote/macroAdminRoutes.cjs} +1 -1
  99. package/src/main/lib/{projectHomeAdminRoutes.cjs → feedback-remote/projectHomeAdminRoutes.cjs} +4 -4
  100. package/src/main/lib/{relayClientAuth.cjs → feedback-remote/relayClientAuth.cjs} +2 -2
  101. package/src/main/lib/{remoteClientSessions.cjs → feedback-remote/remoteClientSessions.cjs} +1 -1
  102. package/src/main/lib/{gitWorktree.cjs → git/gitWorktree.cjs} +7 -7
  103. package/src/main/lib/historyRollup.cjs +1 -1
  104. package/src/main/lib/importReferences.cjs +1 -1
  105. package/src/main/lib/machineProfile.cjs +1 -1
  106. package/src/main/lib/mcpToolCatalog.cjs +9 -3
  107. package/src/main/lib/openExternalApp.cjs +1 -1
  108. package/src/main/lib/opsOwnership.cjs +3 -3
  109. package/src/main/lib/{agentPersonaSchema.cjs → persona-macro/agentPersonaSchema.cjs} +2 -2
  110. package/src/main/lib/{macroLibrary.cjs → persona-macro/macroLibrary.cjs} +5 -5
  111. package/src/main/lib/{personaMerge.cjs → persona-macro/personaMerge.cjs} +4 -4
  112. package/src/main/lib/{depSlugResolve.cjs → prd/depSlugResolve.cjs} +16 -1
  113. package/src/main/lib/{prdAdminRoutes.cjs → prd/prdAdminRoutes.cjs} +7 -7
  114. package/src/main/lib/{prdAgentType.cjs → prd/prdAgentType.cjs} +3 -3
  115. package/src/main/lib/{prdCreate.cjs → prd/prdCreate.cjs} +12 -12
  116. package/src/main/lib/{prdDeclaredPaths.cjs → prd/prdDeclaredPaths.cjs} +1 -1
  117. package/src/main/lib/{prdGateFiles.cjs → prd/prdGateFiles.cjs} +1 -1
  118. package/src/main/lib/{prdLocations.cjs → prd/prdLocations.cjs} +2 -2
  119. package/src/main/lib/{prdMigration.cjs → prd/prdMigration.cjs} +3 -3
  120. package/src/main/lib/prereqs.cjs +2 -2
  121. package/src/main/lib/{instanceLock.cjs → process/instanceLock.cjs} +4 -11
  122. package/src/main/lib/{pidAlive.cjs → process/pidAlive.cjs} +1 -1
  123. package/src/main/lib/{procName.cjs → process/procName.cjs} +2 -2
  124. package/src/main/lib/{timeoutShim.cjs → process/timeoutShim.cjs} +1 -1
  125. package/src/main/lib/projectRootResolve.cjs +1 -1
  126. package/src/main/lib/promptSessionSchema.cjs +1 -1
  127. package/src/main/lib/{definitionOfDone.cjs → scheduler/definitionOfDone.cjs} +6 -12
  128. package/src/main/lib/scheduler/finalizeReason.cjs +30 -0
  129. package/src/main/lib/{fixChainDepth.cjs → scheduler/fixChainDepth.cjs} +1 -1
  130. package/src/main/lib/scheduler/flatSweepThrottle.cjs +17 -0
  131. package/src/main/lib/{jobDirtFilter.cjs → scheduler/jobDirtFilter.cjs} +1 -1
  132. package/src/main/lib/{jobSupervisorRecord.cjs → scheduler/jobSupervisorRecord.cjs} +1 -1
  133. package/src/main/lib/{launchFailure.cjs → scheduler/launchFailure.cjs} +2 -2
  134. package/src/main/lib/{queueStore.cjs → scheduler/queueStore.cjs} +6 -6
  135. package/src/main/lib/{quietMachineLease.cjs → scheduler/quietMachineLease.cjs} +1 -1
  136. package/src/main/lib/{rcaReport.cjs → scheduler/rcaReport.cjs} +4 -4
  137. package/src/main/lib/{reaperHelpers.cjs → scheduler/reaperHelpers.cjs} +3 -3
  138. package/src/main/lib/{reservationExpiry.cjs → scheduler/reservationExpiry.cjs} +4 -11
  139. package/src/main/lib/{reviewNotice.cjs → scheduler/reviewNotice.cjs} +1 -1
  140. package/src/main/lib/{runLogRetention.cjs → scheduler/runLogRetention.cjs} +34 -13
  141. package/src/main/lib/{scheduleJobTransitions.cjs → scheduler/scheduleJobTransitions.cjs} +3 -3
  142. package/src/main/lib/{schedulerBatch.cjs → scheduler/schedulerBatch.cjs} +9 -13
  143. package/src/main/lib/{schedulerConfig.cjs → scheduler/schedulerConfig.cjs} +1 -1
  144. package/src/main/lib/{schedulerRuntimeState.cjs → scheduler/schedulerRuntimeState.cjs} +1 -1
  145. package/src/main/lib/{sessionSlots.cjs → scheduler/sessionSlots.cjs} +2 -2
  146. package/src/main/lib/{upgradeDrain.cjs → scheduler/upgradeDrain.cjs} +8 -11
  147. package/src/main/lib/{watchdogHelpers.cjs → scheduler/watchdogHelpers.cjs} +5 -19
  148. package/src/main/lib/{auditLog.cjs → telemetry/auditLog.cjs} +1 -1
  149. package/src/main/lib/{opsErrorLog.cjs → telemetry/opsErrorLog.cjs} +4 -4
  150. package/src/main/lib/{telemetryBacklog.cjs → telemetry/telemetryBacklog.cjs} +4 -4
  151. package/src/main/lib/{telemetryBoot.cjs → telemetry/telemetryBoot.cjs} +1 -1
  152. package/src/main/lib/{telemetryClient.cjs → telemetry/telemetryClient.cjs} +12 -8
  153. package/src/main/lib/{telemetrySettings.cjs → telemetry/telemetrySettings.cjs} +1 -1
  154. package/src/main/lib/{atomicFs.cjs → util/atomicFs.cjs} +42 -0
  155. package/src/main/lib/{loopDelay.cjs → util/loopDelay.cjs} +1 -1
  156. package/src/main/logs.cjs +1 -1
  157. package/src/main/mcpStatus.cjs +2 -2
  158. package/src/main/memoryAggregate.cjs +3 -3
  159. package/src/main/memoryTool.cjs +1 -1
  160. package/src/main/otel.cjs +2 -2
  161. package/src/main/pluginInstall.cjs +29 -3
  162. package/src/main/projectBrief.cjs +6 -6
  163. package/src/main/projectPages.cjs +1 -1
  164. package/src/main/promptSessionEvents.cjs +2 -2
  165. package/src/main/pty.cjs +7 -7
  166. package/src/main/queueOps.cjs +6 -6
  167. package/src/main/remoteClient.cjs +4 -4
  168. package/src/main/remoteClientIpc.cjs +1 -1
  169. package/src/main/runVerify.cjs +6 -3
  170. package/src/main/scheduler/CLAUDE.md +26 -0
  171. package/src/main/scheduler/budget.cjs +576 -0
  172. package/src/main/scheduler/gitTreeGuard.cjs +672 -0
  173. package/src/main/scheduler/prdParser.cjs +4 -4
  174. package/src/main/scheduler/prdPaths.cjs +487 -0
  175. package/src/main/scheduler/reviewLadder.cjs +1011 -0
  176. package/src/main/scheduler/starvation.cjs +390 -0
  177. package/src/main/scheduler.cjs +331 -3320
  178. package/src/main/seedAgentPersonas.cjs +5 -5
  179. package/src/main/seedDevPlugin.cjs +70 -3
  180. package/src/main/seedSchedulerMcp.cjs +2 -2
  181. package/src/main/supervisor.cjs +50 -27
  182. package/src/main/telemetryIpc.cjs +51 -0
  183. package/src/main/transcripts.cjs +3 -3
  184. package/src/main/updaterIpc.cjs +1 -1
  185. package/src/main/usage.cjs +1 -1
  186. package/src/main/watchers.cjs +1 -1
  187. package/src/main/webRemote.cjs +22 -7
  188. package/src/preload/api.d.ts +14 -8
  189. package/src/preload/index.cjs +9 -3
  190. package/dist/assets/ProvenanceBadge-vC7Tj-JP.js +0 -1
  191. package/dist/assets/RemoteMachines-CWnKbFHc.js +0 -3
  192. package/dist/assets/Settings-DYDlp2m_.js +0 -4
  193. package/dist/assets/Skills-DHO0N0C2.js +0 -2
  194. package/dist/assets/SystemPrompt-DxeNofL9.js +0 -1
  195. package/dist/assets/TagLibrary-QOAs7ISO.js +0 -1
  196. package/plugins/session-manager-dev/skills/blog-for-project-feature/0-select/SKILL.md +0 -39
  197. package/plugins/session-manager-dev/skills/blog-for-project-feature/1-research/SKILL.md +0 -37
  198. package/plugins/session-manager-dev/skills/blog-for-project-feature/2-storyboard/SKILL.md +0 -64
  199. package/plugins/session-manager-dev/skills/blog-for-project-feature/3-capture/SKILL.md +0 -52
  200. package/plugins/session-manager-dev/skills/blog-for-project-feature/4-draft-copy/SKILL.md +0 -37
  201. package/plugins/session-manager-dev/skills/blog-for-project-feature/5-illustrate/SKILL.md +0 -50
  202. package/plugins/session-manager-dev/skills/blog-for-project-feature/6-compose/SKILL.md +0 -51
  203. package/plugins/session-manager-dev/skills/blog-for-project-feature/7-review/SKILL.md +0 -54
  204. package/plugins/session-manager-dev/skills/blog-for-project-feature/SKILL.md +0 -144
  205. package/plugins/session-manager-dev/skills/blog-for-project-feature/feature.config.yaml +0 -90
  206. package/plugins/session-manager-dev/skills/discover-features/SKILL.md +0 -95
  207. package/plugins/session-manager-dev/skills/explain-to-me/SKILL.md +0 -205
  208. package/plugins/session-manager-dev/skills/explain-to-me/assets/style-reference.html +0 -163
  209. package/plugins/session-manager-dev/skills/find-opportunity/SKILL.md +0 -83
  210. package/plugins/session-manager-dev/skills/issue-address/0-select/0-fetch-pool/SKILL.md +0 -38
  211. package/plugins/session-manager-dev/skills/issue-address/0-select/1-reject-fixed/SKILL.md +0 -64
  212. package/plugins/session-manager-dev/skills/issue-address/0-select/2-reject-claimed/SKILL.md +0 -71
  213. package/plugins/session-manager-dev/skills/issue-address/0-select/3-rank-impact/SKILL.md +0 -39
  214. package/plugins/session-manager-dev/skills/issue-address/0-select/SKILL.md +0 -75
  215. package/plugins/session-manager-dev/skills/issue-address/1-confirm-open/SKILL.md +0 -39
  216. package/plugins/session-manager-dev/skills/issue-address/2-claim/SKILL.md +0 -57
  217. package/plugins/session-manager-dev/skills/issue-address/3-reproduce/SKILL.md +0 -40
  218. package/plugins/session-manager-dev/skills/issue-address/4-fix/SKILL.md +0 -33
  219. package/plugins/session-manager-dev/skills/issue-address/5-verify/SKILL.md +0 -40
  220. package/plugins/session-manager-dev/skills/issue-address/SKILL.md +0 -120
  221. package/plugins/session-manager-dev/skills/local-project-health/SKILL.md +0 -58
  222. package/plugins/session-manager-dev/skills/memory-sanitation/SKILL.md +0 -147
  223. package/plugins/session-manager-dev/skills/ops-sweep/SKILL.md +0 -137
  224. package/plugins/session-manager-dev/skills/pr-review-sweep/0-fetch/SKILL.md +0 -41
  225. package/plugins/session-manager-dev/skills/pr-review-sweep/1-classify/SKILL.md +0 -56
  226. package/plugins/session-manager-dev/skills/pr-review-sweep/2-check-fixed/SKILL.md +0 -49
  227. package/plugins/session-manager-dev/skills/pr-review-sweep/3-queue/SKILL.md +0 -57
  228. package/plugins/session-manager-dev/skills/pr-review-sweep/4-land-and-resolve/SKILL.md +0 -60
  229. package/plugins/session-manager-dev/skills/pr-review-sweep/SKILL.md +0 -124
  230. package/plugins/session-manager-dev/skills/pr-signal/SKILL.md +0 -67
  231. package/plugins/session-manager-dev/skills/project-status/SKILL.md +0 -243
  232. package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +0 -98
  233. package/plugins/session-manager-dev/skills/requesting-code-review/code-reviewer.md +0 -146
  234. package/src/main/lib/rateLimitDetect.cjs +0 -35
  235. /package/src/main/lib/{agentEffortResolve.cjs → claude/agentEffortResolve.cjs} +0 -0
  236. /package/src/main/lib/{claudeCliCaps.cjs → claude/claudeCliCaps.cjs} +0 -0
  237. /package/src/main/lib/{usageCircuit.cjs → claude/usageCircuit.cjs} +0 -0
  238. /package/src/main/lib/{epicSpawnCwd.cjs → epic/epicSpawnCwd.cjs} +0 -0
  239. /package/src/main/lib/{customerFeedbackAdminRoutes.cjs → feedback-remote/customerFeedbackAdminRoutes.cjs} +0 -0
  240. /package/src/main/lib/{remoteE2eCrypto.cjs → feedback-remote/remoteE2eCrypto.cjs} +0 -0
  241. /package/src/main/lib/{branchSweep.cjs → git/branchSweep.cjs} +0 -0
  242. /package/src/main/lib/{gitExec.cjs → git/gitExec.cjs} +0 -0
  243. /package/src/main/lib/{jobWorktree.cjs → git/jobWorktree.cjs} +0 -0
  244. /package/src/main/lib/{jobWorktreeBootLive.cjs → git/jobWorktreeBootLive.cjs} +0 -0
  245. /package/src/main/lib/{jobWorktreeTerminalOrphanLive.cjs → git/jobWorktreeTerminalOrphanLive.cjs} +0 -0
  246. /package/src/main/lib/{builtinMacros.cjs → persona-macro/builtinMacros.cjs} +0 -0
  247. /package/src/main/lib/{personaImportHealth.cjs → persona-macro/personaImportHealth.cjs} +0 -0
  248. /package/src/main/lib/{shippedPersonaSeeds.cjs → persona-macro/shippedPersonaSeeds.cjs} +0 -0
  249. /package/src/main/lib/{planValidator.cjs → prd/planValidator.cjs} +0 -0
  250. /package/src/main/lib/{prdAuthoringSeed.cjs → prd/prdAuthoringSeed.cjs} +0 -0
  251. /package/src/main/lib/{prdDisposition.cjs → prd/prdDisposition.cjs} +0 -0
  252. /package/src/main/lib/{prdFrontmatter.cjs → prd/prdFrontmatter.cjs} +0 -0
  253. /package/src/main/lib/{prdSizing.cjs → prd/prdSizing.cjs} +0 -0
  254. /package/src/main/lib/{workTypeLibrary.cjs → prd/workTypeLibrary.cjs} +0 -0
  255. /package/src/main/lib/{childWithLog.cjs → process/childWithLog.cjs} +0 -0
  256. /package/src/main/lib/{cleanEnv.cjs → process/cleanEnv.cjs} +0 -0
  257. /package/src/main/lib/{defaultShell.cjs → process/defaultShell.cjs} +0 -0
  258. /package/src/main/lib/{killTree.cjs → process/killTree.cjs} +0 -0
  259. /package/src/main/lib/{loginShellPath.cjs → process/loginShellPath.cjs} +0 -0
  260. /package/src/main/lib/{procIdentity.cjs → process/procIdentity.cjs} +0 -0
  261. /package/src/main/lib/{singleInstanceGuard.cjs → process/singleInstanceGuard.cjs} +0 -0
  262. /package/src/main/lib/{smProcNames.cjs → process/smProcNames.cjs} +0 -0
  263. /package/src/main/lib/{timeoutShimScript.cjs → process/timeoutShimScript.cjs} +0 -0
  264. /package/src/main/lib/{winSpawn.cjs → process/winSpawn.cjs} +0 -0
  265. /package/src/main/lib/{adoptedRunSupervisor.cjs → scheduler/adoptedRunSupervisor.cjs} +0 -0
  266. /package/src/main/lib/{dispatchLoop.cjs → scheduler/dispatchLoop.cjs} +0 -0
  267. /package/src/main/lib/{dodDrainHook.cjs → scheduler/dodDrainHook.cjs} +0 -0
  268. /package/src/main/lib/{fixPlanSlug.cjs → scheduler/fixPlanSlug.cjs} +0 -0
  269. /package/src/main/lib/{gateAuthority.cjs → scheduler/gateAuthority.cjs} +0 -0
  270. /package/src/main/lib/{landedSinceRun.cjs → scheduler/landedSinceRun.cjs} +0 -0
  271. /package/src/main/lib/{loadGate.cjs → scheduler/loadGate.cjs} +0 -0
  272. /package/src/main/lib/{needsReviewLedger.cjs → scheduler/needsReviewLedger.cjs} +0 -0
  273. /package/src/main/lib/{queueHealth.cjs → scheduler/queueHealth.cjs} +0 -0
  274. /package/src/main/lib/{queueHistory.cjs → scheduler/queueHistory.cjs} +0 -0
  275. /package/src/main/lib/{scheduleJobSchema.cjs → scheduler/scheduleJobSchema.cjs} +0 -0
  276. /package/src/main/lib/{schedulerPaths.cjs → scheduler/schedulerPaths.cjs} +0 -0
  277. /package/src/main/lib/{terminalRunOutcome.cjs → scheduler/terminalRunOutcome.cjs} +0 -0
  278. /package/src/main/lib/{validationSentinels.cjs → scheduler/validationSentinels.cjs} +0 -0
  279. /package/src/main/lib/{crashTelemetry.cjs → telemetry/crashTelemetry.cjs} +0 -0
  280. /package/src/main/lib/{otlpTraceExporter.cjs → telemetry/otlpTraceExporter.cjs} +0 -0
  281. /package/src/main/lib/{telemetryConsent.cjs → telemetry/telemetryConsent.cjs} +0 -0
  282. /package/src/main/lib/{telemetryCounters.cjs → telemetry/telemetryCounters.cjs} +0 -0
  283. /package/src/main/lib/{encodeCwd.cjs → util/encodeCwd.cjs} +0 -0
  284. /package/src/main/lib/{expandHome.cjs → util/expandHome.cjs} +0 -0
  285. /package/src/main/lib/{extractJson.cjs → util/extractJson.cjs} +0 -0
  286. /package/src/main/lib/{fileTail.cjs → util/fileTail.cjs} +0 -0
  287. /package/src/main/lib/{headTailBuffer.cjs → util/headTailBuffer.cjs} +0 -0
  288. /package/src/main/lib/{kebabCase.cjs → util/kebabCase.cjs} +0 -0
  289. /package/src/main/lib/{lruCache.cjs → util/lruCache.cjs} +0 -0
  290. /package/src/main/lib/{withTimeout.cjs → util/withTimeout.cjs} +0 -0
@@ -1,3 +0,0 @@
1
- import{bc as M,aD as d,an as e,a as N,bk as D,W as O,D as P,_ as H,a0 as U}from"./index-CPieAFsl.js";import{b as L,P as k,E as $,R as z,u as W,S as G}from"./useRemotePeers-D4cdJDyh.js";import"./monaco-editor-BsIlgG7c.js";function A(o){return o instanceof Error?o.message:String(o)}function _(o){const i=o.replace(/\/+$/,"").split("/");return i[i.length-1]||o}function V({peerId:o,machineName:i,onOpenTerminal:y}){const c=M(a=>a.show),[x,m]=d.useState([]),[p,w]=d.useState("loading"),[h,E]=d.useState(null),[t,j]=d.useState(""),[C,I]=d.useState(!1),f=d.useRef(0),v=d.useCallback(async()=>{const a=++f.current;w("loading");try{let u;try{const s=await window.api.remoteClient.send(o,"cmd:sessions:list",{});u=Array.isArray(s==null?void 0:s.sessions)?s.sessions:[]}catch{if(a!==f.current)return;const s=await window.api.remoteClient.send(o,"cmd:sessions:load",{});u=(Array.isArray(s==null?void 0:s.tabs)?s.tabs:[]).map(b=>({kind:"project",tabId:b.sessionId,cwd:b.cwd,title:b.label||b.cwd,project:b.label||_(b.cwd)}))}if(a!==f.current)return;m(u),w("ready")}catch(u){if(a!==f.current)return;w("error"),c("error",`Could not load sessions from ${i}: ${A(u)}`)}},[o,i,c]);d.useEffect(()=>(v(),()=>{f.current++}),[v]);const S=d.useMemo(()=>{const a=new Map;for(const s of x){const g=s.project||_(s.cwd);(a.get(g)??a.set(g,[]).get(g)).push(s)}const u=s=>s.kind==="project"?0:1;for(const s of a.values())s.sort((g,b)=>u(g)-u(b));return[...a.entries()].sort((s,g)=>s[0].localeCompare(g[0]))},[x]),n=t.trim(),T=h!==null&&n.length>0&&!C,R=d.useCallback(async()=>{if(!(h===null||t.trim().length===0)){I(!0);try{await window.api.remoteClient.send(o,"cmd:chat:send",{tabId:h,prompt:t}),j("")}catch(a){c("error",`Could not send prompt to ${i}: ${A(a)}`)}finally{I(!1)}}},[o,i,h,t,c]);return e.jsxs("div",{"data-testid":"remote-sessions-panel",className:"flex flex-col gap-3",children:[e.jsx(L,{right:e.jsx(N,{tone:"accent",className:"",title:`Sessions on ${i}`,children:e.jsxs("span",{"data-testid":"remote-sessions-badge",children:["Remote: ",i]})}),children:"Remote sessions"}),e.jsx("div",{className:"flex justify-end",children:e.jsx(k,{icon:"history",testId:"remote-sessions-refresh",onClick:()=>{v()},disabled:p==="loading",children:"Refresh"})}),p==="loading"&&e.jsx($,{testId:"remote-sessions-loading",children:"Loading sessions…"}),p==="error"&&e.jsxs($,{testId:"remote-sessions-error",children:["Could not load sessions from ",i,"."]}),p==="ready"&&x.length===0&&e.jsxs($,{testId:"remote-sessions-empty",children:["No sessions open on ",i,"."]}),p==="ready"&&S.map(([a,u])=>e.jsx("div",{"data-testid":"remote-sessions-group",className:"flex flex-col gap-2",children:u.map(s=>e.jsx(z,{testId:`remote-session-${s.tabId}`,icon:"terminal",title:s.title||s.cwd,subtitle:s.cwd,badge:s.kind==="epic"&&s.tag?e.jsx(N,{tone:"accent",children:s.tag}):void 0,action:e.jsxs("div",{className:"flex items-center gap-2",children:[s.kind==="project"&&y&&e.jsx(k,{icon:"terminal",kind:"ghost",testId:`remote-session-terminal-${s.tabId}`,onClick:()=>y(s.cwd),children:"Terminal here"}),e.jsx(k,{kind:h===s.tabId?"soft":"ghost",testId:`remote-session-select-${s.tabId}`,onClick:()=>E(s.tabId),children:h===s.tabId?"Selected":"Select"})]})},s.tabId))},a)),p==="ready"&&x.length>0&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("textarea",{"data-testid":"remote-sessions-prompt",value:t,onChange:a=>j(a.target.value),rows:3,placeholder:h?`Prompt for the selected session on ${i}`:"Select a session first",className:"w-full rounded-lg bg-bg-hi border border-line px-3 py-2 text-[13px] text-fg placeholder:text-fg-faint"}),e.jsx("div",{className:"flex justify-end",children:e.jsx(k,{icon:"play",testId:"remote-sessions-send",onClick:()=>{R()},disabled:!T,children:"Send"})})]})]})}const q=260;function J({peerId:o,machineName:i,cwd:y,onClose:c}){const x=d.useRef(null),m=d.useRef(null),p=M(t=>t.show),[w,h]=d.useState(!1);d.useEffect(()=>{const t=x.current;if(!t)return;const j=crypto.randomUUID();let C=!0,I=!1,f=!1;const v=(r,l)=>{C&&p("error",`Remote terminal ${r} failed: ${l instanceof Error?l.message:String(l)}`)},S=(r,l)=>window.api.remoteClient.send(o,r,l),n=new D.Terminal({fontFamily:'"IBM Plex Mono", JetBrains Mono, ui-monospace, Menlo, monospace',fontSize:P.fontSize,lineHeight:1.2,cursorBlink:!0,allowProposedApi:!0,theme:O[P.theme]}),T=new H.FitAddon;n.loadAddon(T);const R=()=>{if(U(t.clientWidth,t.clientHeight))try{T.fit()}catch{}};n.open(t),R(),n.focus();const a=window.api.remoteClient.onEvent(r=>{if(r.peerId!==o)return;const l=r.payload??{};l.tabId===j&&(r.type==="event:pty:data"?typeof l.data=="string"&&n.write(l.data):r.type==="event:pty:exit"&&(I=!0,n.options.disableStdin=!0,n.write(`\r
2
- \x1B[38;5;240m[remote session exited code=${l.exitCode??"?"}]\x1B[0m\r
3
- `),h(!0)))}),u=n.onData(r=>{I||S("cmd:pty:write",{tabId:j,data:r}).catch(l=>v("write",l))}),s=n.onResize(({cols:r,rows:l})=>{I||S("cmd:pty:resize",{tabId:j,cols:r,rows:l}).catch(F=>v("resize",F))});S("cmd:pty:spawn",{tabId:j,cwd:y,cols:n.cols,rows:n.rows}).catch(r=>v("spawn",r)),m.current=()=>{f||(f=!0,S("cmd:pty:kill",{tabId:j}).catch(r=>v("kill",r)))};const g=()=>R();window.addEventListener("resize",g);const b=new ResizeObserver(()=>R());return b.observe(t),()=>{var r;window.removeEventListener("resize",g),b.disconnect(),a(),u.dispose(),s.dispose(),(r=m.current)==null||r.call(m),m.current=null,C=!1,n.dispose()}},[o,y,p]);const E=()=>{var t;(t=m.current)==null||t.call(m),c()};return e.jsxs("div",{"data-testid":"remote-terminal-panel",className:"bg-bg-hi border border-line rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-[18px] pt-3.5 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx(L,{children:"Remote terminal"}),e.jsx(N,{tone:"accent",children:e.jsxs("span",{"data-testid":"remote-terminal-badge",children:["Remote: ",i]})}),w&&e.jsx(N,{tone:"dim",children:"exited"})]}),e.jsx(k,{kind:"ghost",onClick:E,testId:"remote-terminal-close",children:"Close"})]}),e.jsx("div",{ref:x,"data-testid":"remote-terminal-host",className:"w-full bg-bg",style:{height:q}})]})}const X="relay_client_auth_unavailable",K="device_offline",Q={win32:"Windows",darwin:"macOS",linux:"Linux"},B=o=>o?Q[o]??o:"OS unknown";function Y({peers:o,selectedId:i,onSelect:y}){return e.jsxs("div",{className:"w-[240px] shrink-0 border-r border-line p-3 space-y-2 overflow-y-auto","data-testid":"remote-view-switcher",children:[e.jsx(L,{children:"Machines"}),o.map(c=>{const x=c.status==="authenticated";return e.jsxs("button",{type:"button","data-testid":"remote-view-machine","aria-pressed":c.peerId===i,onClick:()=>y(c.peerId),className:`w-full text-left rounded-lg border px-3 py-2 transition-colors ${c.peerId===i?"bg-bg-hi border-accent/40":"bg-bg border-line hover:bg-bg-hi"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-fg truncate",children:c.machineName}),x?e.jsx(N,{tone:"good",children:"online"}):e.jsx(N,{tone:"dim",children:"offline"})]}),e.jsx("div",{className:"text-[11.5px] text-fg-faint",children:B(c.os)})]},c.peerId)})]})}function se({onOpenSettings:o}){const{peers:i,connect:y,confirmSas:c}=W(),[x,m]=d.useState(null),[p,w]=d.useState("sessions"),[h,E]=d.useState("");if(i.length===0)return e.jsxs("div",{className:"p-6 space-y-3","data-testid":"remote-view",children:[e.jsx($,{testId:"remote-view-empty",children:"No machines paired yet. Pair a machine in Settings → Phone remote."}),e.jsx(k,{testId:"remote-view-open-settings",onClick:o,children:"Open Settings"})]});const t=i.find(n=>n.peerId===x)??i[0],j=t.status==="authenticated",C=t.status==="failed"&&t.reason===X,I=t.status==="connecting",f=`Remote: ${t.machineName}`,v=n=>{m(n),w("sessions"),E("")},S=n=>{E(n),w("terminal")};return e.jsxs("div",{className:"flex h-full min-h-0","data-testid":"remote-view",children:[e.jsx(Y,{peers:i,selectedId:t.peerId,onSelect:v}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col p-4 gap-3 overflow-y-auto",children:[e.jsxs("div",{"data-testid":"remote-view-header",className:"flex items-center gap-2.5",children:[e.jsx(N,{tone:"accent",className:"",title:t.peerId,children:e.jsx("span",{"data-testid":"remote-view-header-badge",children:f})}),e.jsx("span",{className:"text-[12.5px] text-fg-faint",children:B(t.os)})]}),t.status==="pending_sas"&&t.sas&&e.jsx(G,{peer:"other machine",testId:"remote-view-sas",code:t.sas,onConfirm:()=>{c(t.peerId)}}),j?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex gap-2 border-b border-line pb-2",children:["sessions","terminal"].map(n=>e.jsxs("button",{type:"button","data-testid":`remote-view-tab-${n}`,onClick:()=>w(n),className:`inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-[13px] font-semibold ${p===n?"bg-bg-hi text-fg border border-line":"text-fg-dim hover:text-fg"}`,children:[n==="sessions"?"Sessions":"Terminal",e.jsx(N,{tone:"accent",children:f})]},n))}),p==="sessions"?e.jsx(V,{peerId:t.peerId,machineName:t.machineName,onOpenTerminal:S},t.peerId):e.jsx(J,{peerId:t.peerId,machineName:t.machineName,cwd:h,onClose:()=>w("sessions")},t.peerId)]}):e.jsxs("div",{className:"space-y-2","data-testid":"remote-view-offline",children:[e.jsx($,{children:C?"The bilko.run relay does not support desktop clients yet":t.reason===K?`${t.machineName} is offline.`:`Not connected to ${t.machineName}.`}),!C&&t.status!=="pending_sas"&&e.jsx(z,{icon:"terminal",title:t.machineName,subtitle:t.peerId,action:e.jsx(k,{testId:"remote-view-connect",disabled:I,onClick:()=>{y(t.peerId)},children:I?"Connecting…":"Connect"})})]})]})]})}export{se as RemoteMachines};
@@ -1,4 +0,0 @@
1
- import{aD as c,an as e,S as I,A as Q,n as V,a2 as Oe,aU as ge,bc as Y,b3 as be,a as U,bd as De,aW as Me,b7 as $e,b4 as Le,aZ as _e,c as ie,aB as Ue,b1 as Fe,bb as le,aX as q,ap as Be,au as Ge,J as He,H as oe,aL as Je}from"./index-CPieAFsl.js";import{P as Ke}from"./Panel-CQY5zano.js";import{S as Ve}from"./ScopeSwitcher-B-P-kSfq.js";import{S as ve}from"./SaveBar-DjijiUb0.js";import{u as We,s as ce,E as Xe}from"./settingsSchema-D0FxNrTy.js";import{V as qe}from"./ViewTabs-CGX6MAhc.js";import{T as W}from"./Toggle-Ba_f7q_m.js";import{u as ze,b as J,P as M,E as se,R as ye,a as je,S as ee}from"./useRemotePeers-D4cdJDyh.js";import"./monaco-editor-BsIlgG7c.js";import"./claude-settings-schema-COigsajx.js";const Ye=[{id:"essentials",title:"Essentials",summary:"The knobs you reach for first.",keys:["model","language","outputStyle","permissions"]},{id:"git",title:"Git & Commits",summary:"How Claude writes commits and pull requests on your behalf.",keys:["attribution","includeGitInstructions","includeCoAuthoredBy"]},{id:"memory",title:"Memory & Plans",summary:"Context Claude keeps between sessions and where it files plans.",keys:["autoMemoryEnabled","plansDirectory","claudeMdExcludes","respectGitignore"]},{id:"model",title:"Model & Reasoning",summary:"Model allow/override lists, reasoning depth, and fast-mode toggles — machine-wide, with no per-Epic override yet. An Epic's Agent persona model (Agent Library) still wins over Essentials' plain model default.",advanced:!0,keys:["availableModels","modelOverrides","effortLevel","fastMode","fastModePerSessionOptIn","alwaysThinkingEnabled","fallbackModel","enforceAvailableModels","teammateDefaultModel","advisorModel"]},{id:"interface",title:"Interface",summary:"Visual polish — spinners, progress bars, motion.",keys:["spinnerTipsEnabled","spinnerTipsOverride","spinnerVerbs","terminalProgressBarEnabled","showTurnDuration","prefersReducedMotion","companyAnnouncements","statusLine","teammateMode"]},{id:"updates",title:"Updates & Cleanup",summary:"Release channel and how long transcripts stick around.",keys:["autoUpdatesChannel","cleanupPeriodDays"]},{id:"env",title:"Environment & Auth",summary:"Environment variables and auth-helper scripts.",keys:["env","apiKeyHelper","awsCredentialExport","awsAuthRefresh"]},{id:"hooks",title:"Hooks",summary:"Scripts Claude runs before/after tool use.",keys:["hooks","disableAllHooks","allowedHttpHookUrls","httpHookAllowedEnvVars"]},{id:"mcp",title:"MCP Servers",summary:"External tool providers Claude can talk to.",keys:["enableAllProjectMcpServers","enabledMcpjsonServers","disabledMcpjsonServers"]},{id:"plugins",title:"Plugins",summary:"Installed plugins, marketplaces, and per-plugin configuration.",keys:["enabledPlugins","extraKnownMarketplaces","skippedPlugins","skippedMarketplaces","pluginConfigs"]},{id:"filesystem",title:"File Picker & Sandbox",summary:"How Claude browses files and the sandbox it runs in.",keys:["fileSuggestion","sandbox","worktree"]},{id:"login",title:"Login",summary:"Which login method to force on startup.",keys:["forceLoginMethod","forceLoginOrgUUID"]},{id:"feedback",title:"Feedback",summary:"Session-quality surveys.",keys:["feedbackSurveyRate"]},{id:"advanced",title:"Advanced / Enterprise",summary:"Managed-settings-only keys and enterprise allow/denylists.",advanced:!0,keys:["allowedMcpServers","deniedMcpServers","allowManagedHooksOnly","allowManagedPermissionRulesOnly","allowManagedMcpServersOnly","strictKnownMarketplaces","blockedMarketplaces","pluginTrustMessage","otelHeadersHelper","skipWebFetchPreflight"]}],Ze={mcp:"MCP",url:"URL",urls:"URLs",http:"HTTP",ui:"UI",id:"ID",uuid:"UUID",api:"API",aws:"AWS",otel:"OTel",json:"JSON"};function we(t){return t.replace(/^\$/,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().split(/\s+/).filter(Boolean).map((i,a)=>{const r=Ze[i];return r||(a===0?i.charAt(0).toUpperCase()+i.slice(1):i)}).join(" ")}function Ne(t){const s=new Set,n=[];for(const a of Ye){const r=a.keys.filter(l=>t.has(l));r.forEach(l=>s.add(l)),r.length!==0&&n.push({id:a.id,title:a.title,summary:a.summary,advanced:!!a.advanced,keys:r})}const i=Array.from(t).filter(a=>!s.has(a)&&a!=="$schema").sort();return i.length>0&&n.push({id:"other",title:"Other",summary:"Keys not yet grouped.",advanced:!1,keys:i}),n}function Qe(t,s){return Ne(t).map(n=>({id:n.id,title:n.title,advanced:n.advanced,total:n.keys.length,setCount:n.keys.filter(i=>s.has(i)).length}))}const et={};function ke(t,s){if(s)return{text:s,authored:!1};const n=et[t];return n?{text:n,authored:!0}:null}const tt={essentials:"star",git:"link",memory:"memory",model:"sparkle",interface:"eye",updates:"reload",env:"keys",hooks:"hooks",mcp:"mcp",plugins:"plugins",filesystem:"folder",login:"lock",feedback:"send",advanced:"shield",other:"dot"},st=["user","project","local","default"],nt={user:"user",project:"project",local:"local",default:"default"};function at({node:t,targetScope:s,onOverride:n,schema:i}){const[a,r]=c.useState(""),[l,p]=c.useState(!1),[u,g]=c.useState(!0),m=t.kind==="object"?t:null,S=m?Object.keys(m.children):[],b=i.rootKeys(),j=new Set([...S,...b]),o=c.useMemo(()=>Ne(j),[Array.from(j).sort().join(",")]),k=c.useMemo(()=>Qe(j,new Set(S)),[Array.from(j).sort().join(","),S.join(",")]),[R,A]=c.useState(null),y=c.useRef(null),C=f=>{const w=o.find(x=>x.id===f);w!=null&&w.advanced&&!l&&p(!0),A(f)};c.useEffect(()=>{if(!R)return;A(null);const f=y.current,w=document.getElementById(`settings-group-${R}`);if(!f||!w)return;const x=w.getBoundingClientRect().top-f.getBoundingClientRect().top;f.scrollBy({top:x,behavior:"smooth"})},[R]);const E=c.useMemo(()=>o.filter(f=>l||!f.advanced).map(f=>({...f,keys:f.keys.filter(w=>{const x=(m==null?void 0:m.children[w])!==void 0;if(!u&&!x)return!1;if(!a.trim())return!0;const v=i.at([w]);return[w,we(w),(v==null?void 0:v.description)??""].join(" ").toLowerCase().includes(a.toLowerCase())})})).filter(f=>f.keys.length>0),[o,a,l,u,m,i]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"text-fg-faint",children:["writing overrides to"," ",e.jsx("span",{className:"text-fg-dim font-medium",children:I[s].label})]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:f=>g(f.target.checked),className:"accent-accent"}),"show not-yet-configured"]}),e.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:f=>p(f.target.checked),className:"accent-accent"}),"show advanced"]}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{value:a,onChange:f=>r(f.target.value),placeholder:"search settings…",className:"bg-bg border border-line rounded px-2 py-1 text-xs text-fg w-64"})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(rt,{groups:k,onJump:C}),e.jsxs("div",{ref:y,className:"flex-1 overflow-auto py-3",children:[E.map(f=>e.jsx(it,{id:f.id,title:f.title,summary:f.summary,advanced:f.advanced,children:f.keys.map(w=>{const x=m==null?void 0:m.children[w],v=i.at([w]);return e.jsx(lt,{keyName:w,node:x,info:v,targetScope:s,onOverride:(h,T)=>n([w],h,T)},w)})},f.id)),E.length===0&&e.jsxs("div",{className:"px-6 py-12 text-center text-fg-faint text-sm",children:['no settings match "',a,'"']})]})]})]})}function rt({groups:t,onJump:s}){return e.jsx("nav",{className:"shrink-0 w-48 border-r border-line bg-bg-elev/30 overflow-y-auto py-3",children:t.map(n=>e.jsxs("button",{onClick:()=>s(n.id),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bg-hi transition-colors",title:`jump to ${n.title}`,children:[e.jsx(Q,{name:tt[n.id]??"dot",size:15,className:"text-fg-faint shrink-0"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-fg-dim",children:n.title}),e.jsxs("span",{className:"text-[10px] text-fg-faint font-mono shrink-0",children:[n.setCount,"/",n.total]})]},n.id))})}function it({id:t,title:s,summary:n,advanced:i,children:a}){const[r,l]=c.useState(!0);return e.jsxs("section",{id:`settings-group-${t}`,className:"mx-4 mb-4 rounded-lg border border-line shadow-sm bg-bg-elev/50 overflow-hidden",children:[e.jsxs("header",{className:"px-4 py-3 bg-bg-elev cursor-pointer hover:bg-bg-hi flex items-center gap-3 border-b border-line",onClick:()=>l(!r),children:[e.jsx("span",{className:"text-fg-faint w-3",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-fg text-base font-semibold",children:s}),i&&e.jsx("span",{className:"text-[9px] px-1.5 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"advanced"})]}),e.jsx("p",{className:"text-fg-dim text-sm mt-0.5",children:n})]})]}),r&&e.jsx("div",{className:"divide-y divide-line/60",children:a})]})}function lt({keyName:t,node:s,info:n,targetScope:i,onOverride:a}){const[r,l]=c.useState(!1),[p,u]=c.useState(!1),g=we(t),m=s!==void 0,b=(s==null?void 0:s.kind)==="leaf"?s:null,j=(s==null?void 0:s.kind)==="object"||(s==null?void 0:s.kind)==="array",o=n==null?void 0:n.default,k=b&&o!==void 0&&Ce(b.value,o),R=ft({isSet:m,leafNode:b,defaultVal:o,isDefault:!!k,node:s}),A=ot(b,o),y=A.length>=2,C=!!b&&!k,E=ke(t,n==null?void 0:n.description);return e.jsx("div",{className:"px-4 py-3 hover:bg-bg-elev/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>l(!r),className:"text-fg-faint hover:text-fg w-3 mt-0.5",title:r?"collapse":"expand",children:r?"▾":"▸"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-fg text-sm",children:g}),e.jsx(ht,{kind:R.kind,label:R.label}),y&&e.jsxs("button",{onClick:f=>{f.stopPropagation(),r||l(!0),u(w=>!w)},className:"text-[9px] px-1.5 py-0 rounded border border-blue-900/40 bg-blue-950/30 text-blue-300/90 uppercase tracking-wide hover:bg-blue-900/40",title:"this key is defined in multiple scopes — click to expand",children:["drift · ",A.map(f=>nt[f]).join(" · ")]}),C&&b&&e.jsx("button",{onClick:f=>{f.stopPropagation(),a(void 0,b.winner)},className:"text-[9px] px-1.5 py-0 rounded border border-line bg-bg-elev text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`reset · delete from ${I[b.winner].label}`,children:"↺ reset"}),(n==null?void 0:n.deprecated)&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-yellow-900/40 bg-yellow-950/30 text-yellow-500/80 uppercase tracking-wide",children:"deprecated"}),(n==null?void 0:n.required)&&!m&&e.jsx("span",{className:"text-[9px] px-1 py-0 rounded border border-red-900/40 bg-red-950/30 text-red-400/80 uppercase tracking-wide",children:"required"})]}),E&&e.jsx("p",{className:`text-fg-dim text-xs mt-0.5 leading-relaxed ${E.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:E.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:gt(E.text)}),r&&p&&b&&e.jsx(ct,{leaf:b,defaultVal:o,onReset:f=>a(void 0,f)}),r&&e.jsx(dt,{keyName:t,node:s,info:n,targetScope:i,onOverride:f=>a(f)})]}),e.jsx("div",{className:"shrink-0",children:!r&&e.jsx(mt,{node:s,info:n,onSet:f=>{a(f)},disabled:j&&m})})]})})}function ot(t,s){if(!t)return[];const n=new Set;n.add(t.winner);for(const i of t.shadowed)n.add(i.scope);return s!==void 0&&n.add("default"),st.filter(i=>n.has(i))}function ct({leaf:t,defaultVal:s,onReset:n}){const i={};i[t.winner]={value:t.value,winner:!0};for(const a of t.shadowed)i[a.scope]={value:a.value,winner:!1};return e.jsxs("div",{className:"mt-2 border border-line rounded bg-bg-elev/40 text-xs",children:[e.jsx("div",{className:"px-2 py-1 text-fg-faint border-b border-line/60",children:"Values across all scopes (winner highlighted · reset removes that scope's value):"}),e.jsxs("div",{className:"divide-y divide-line/60",children:[["user","project","local"].map(a=>{const r=i[a],l=r!==void 0;return e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:I[a].label}),e.jsx("span",{className:`font-mono truncate ${r!=null&&r.winner?"text-accent":"text-fg-dim"}`,children:l?F(r.value):e.jsx("span",{className:"text-fg-faint",children:"—"})}),l?e.jsx("button",{onClick:()=>n(a),className:"text-[9px] px-1.5 py-0 rounded border border-line text-fg-faint uppercase tracking-wide hover:text-fg hover:bg-bg-hi",title:`delete this key from ${I[a].label}`,children:"↺"}):e.jsx("span",{})]},a)}),e.jsxs("div",{className:"grid grid-cols-[5rem_1fr_auto] gap-2 px-2 py-1 items-center",children:[e.jsx("span",{className:"text-fg-faint",children:"Default"}),e.jsx("span",{className:"font-mono text-fg-dim truncate",children:s!==void 0?F(s):e.jsx("span",{className:"text-fg-faint",children:"—"})}),e.jsx("span",{})]})]})]})}function dt({keyName:t,node:s,info:n,targetScope:i,onOverride:a}){const l=(s==null?void 0:s.kind)==="leaf"?s:null,p=ke(t,n==null?void 0:n.description);return e.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[p&&e.jsx("p",{className:`text-fg-dim leading-relaxed whitespace-pre-wrap ${p.authored?"inline-block border-b border-dotted border-fg-faint/70 cursor-help":""}`,title:p.authored?"In-app-authored description — not from the official Claude Code schema":void 0,children:p.text}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-fg-faint",children:[(n==null?void 0:n.type)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Type"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:Array.isArray(n.type)?n.type.join(" | "):n.type})]}),(n==null?void 0:n.default)!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Default"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:F(n.default)})]}),(n==null?void 0:n.enum)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Options"}),e.jsx("dd",{className:"text-fg-dim font-mono",children:n.enum.map(u=>String(u)).join(" | ")})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Current"}),e.jsxs("dd",{className:"font-mono",children:[e.jsx("span",{className:"text-fg-dim",children:F(l.value)}),e.jsxs("span",{className:"ml-2 text-fg-faint",children:["from ",I[l.winner].label]})]})]}),l&&l.shadowed.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Shadowed"}),e.jsx("dd",{className:"space-y-0.5",children:l.shadowed.map((u,g)=>e.jsxs("div",{className:"font-mono text-fg-faint line-through",children:[F(u.value)," —"," ",e.jsx("span",{className:"no-underline",children:I[u.scope].label})]},g))})]}),(s==null?void 0:s.kind)==="array"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Accumulated"}),e.jsxs("dd",{className:"text-fg-dim",children:[s.items.length," items across all scopes"]})]})]}),e.jsx("div",{className:"pt-2 flex items-center gap-2 flex-wrap border-t border-line/60",children:e.jsx(xt,{keyName:t,node:s,info:n,onChange:a,targetScope:i})})]})}function xt({node:t,info:s,onChange:n,targetScope:i}){const r=(t==null?void 0:t.kind)==="leaf"?t.value:s==null?void 0:s.default,l=Se(s==null?void 0:s.type);if(l==="boolean"){const p=r===!0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("div",{className:"inline-flex rounded border border-line overflow-hidden",children:[{v:!0,label:"on"},{v:!1,label:"off"}].map(({v:u,label:g})=>e.jsx("button",{onClick:()=>n(u),className:`px-3 py-0.5 text-xs transition-colors ${p===u?"bg-accent text-bg":"bg-bg-elev text-fg-dim hover:bg-bg-hi hover:text-fg"}`,children:g},g))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",I[i].label]})]})}return s!=null&&s.enum?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-fg-faint",children:"Choose:"}),s.enum.map(p=>{const u=Ce(r,p);return e.jsx("button",{onClick:()=>n(p),className:`px-2 py-0.5 text-xs rounded border ${u?"bg-accent text-bg border-accent":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,children:String(p)},String(p))}),e.jsxs("span",{className:"text-fg-faint",children:["→ ",I[i].label]})]}):l==="integer"||l==="number"?e.jsx(pt,{value:typeof r=="number"?r:void 0,integer:l==="integer",onCommit:n,target:I[i].label}):l==="string"?e.jsx(ut,{value:typeof r=="string"?r:"",onCommit:n,target:I[i].label}):e.jsxs("div",{className:"text-fg-faint",children:["Complex value (",l??"object/array",") — use the"," ",e.jsx("span",{className:"text-fg-dim",children:"Raw"})," tab to edit."]})}function pt({value:t,integer:s,onCommit:n,target:i}){const[a,r]=c.useState(t!==void 0?String(t):""),l=()=>{const p=s?parseInt(a,10):parseFloat(a);Number.isNaN(p)||n(p)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-fg-faint",children:"Set to:"}),e.jsx("input",{type:"number",value:a,onChange:p=>r(p.target.value),onBlur:l,onKeyDown:p=>{p.key==="Enter"&&p.target.blur()},className:"w-24 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:l,className:"px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",i]})]})}function ut({value:t,onCommit:s,target:n}){const[i,a]=c.useState(t);return e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"text-fg-faint shrink-0",children:"Set to:"}),e.jsx("input",{type:"text",value:i,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&s(i)},className:"flex-1 min-w-0 bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"}),e.jsxs("button",{onClick:()=>s(i),className:"shrink-0 px-2 py-0.5 text-xs border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg",children:["save → ",n]})]})}function mt({node:t,info:s,onSet:n,disabled:i}){const a=(t==null?void 0:t.kind)==="leaf",r=Se(s==null?void 0:s.type);if(i)return null;if(r==="boolean"){const l=a&&t.value===!0;return e.jsx("button",{onClick:()=>n(!l),className:`px-2.5 py-0.5 text-xs rounded border transition-colors ${l?"bg-accent/15 text-accent border-accent/40 hover:bg-accent hover:text-bg":"bg-bg-elev text-fg-dim border-line hover:text-fg hover:bg-bg-hi"}`,title:"toggle",children:l?"on":"off"})}return null}function ft({isSet:t,leafNode:s,defaultVal:n,isDefault:i,node:a}){return t?(a==null?void 0:a.kind)==="array"?{kind:"accumulated",label:`${a.items.length} items`}:(a==null?void 0:a.kind)==="object"?{kind:"set",label:"configured"}:s?i?{kind:"default",label:`= default · ${I[s.winner].label}`}:s.shadowed.length>0?{kind:"override",label:`overriding ${s.shadowed.length} scope(s)`}:{kind:"set",label:`set in ${I[s.winner].label}`}:{kind:"set",label:"configured"}:n!==void 0?{kind:"default",label:`using default: ${F(n)}`}:{kind:"unset",label:"not configured"}}function ht({kind:t,label:s}){const n={set:"bg-accent/15 text-accent border-accent/30",default:"bg-bg-hi text-fg-dim border-line",unset:"bg-bg-elev text-fg-faint border-line",override:"bg-purple-950/30 text-purple-400/80 border-purple-900/40",accumulated:"bg-blue-950/30 text-blue-400/80 border-blue-900/40"}[t];return e.jsx("span",{className:`text-[9px] px-1.5 py-0 rounded border uppercase tracking-wide ${n}`,children:s})}function Se(t){if(t)return Array.isArray(t)?t.find(n=>n!=="null")??t[0]:t}function Ce(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"?JSON.stringify(t)===JSON.stringify(s):!1}function gt(t){const s=t.trim().split(`
2
- `)[0],n=s.match(/^([^.!?]+[.!?])/);return n?n[1]:s.length>120?s.slice(0,120)+"…":s}function F(t){if(typeof t=="string")return t===""?'""':JSON.stringify(t);if(t===null)return"null";if(t===void 0)return"—";if(typeof t=="object"){const s=JSON.stringify(t);return s.length>60?s.slice(0,60)+"…":s}return String(t)}const bt=1440*60*1e3;function de(t){if(!t)return"never";const s=new Date(t).getTime();return Number.isNaN(s)?"never":new Date(s).toLocaleString()}function xe(t){return t?new Date(t).toLocaleString():"never"}function vt(){return e.jsxs("div",{className:"p-4 max-w-3xl space-y-8 text-sm",children:[e.jsx(yt,{}),e.jsx("hr",{className:"border-line"}),e.jsx(jt,{})]})}function yt(){const[t,s]=c.useState(null),[n,i]=c.useState(null),[a,r]=c.useState(null),[l,p]=c.useState(null),[u,g]=c.useState(!1),[m,S]=c.useState(null),[b,j]=c.useState(null);if(c.useEffect(()=>{let y=!1;return Promise.all([window.api.otel.getConfig(),window.api.otel.status(),window.api.otel.configPath()]).then(([C,E,f])=>{y||(s(C),r(C),i(E),p(f))}).catch(C=>{console.warn("[telemetry] load failed:",C==null?void 0:C.message)}),()=>{y=!0}},[]),!a||!t)return e.jsx(V,{title:"loading…"});const o=JSON.stringify(a)!==JSON.stringify(t),k=(y,C)=>{S(null),r({...a,[y]:C})},R=async()=>{g(!0),S(null);try{const y=await window.api.otel.setConfig(a);!y.ok&&y.error&&S(y.error),s(y.config),r(y.config),i(y.status),j(Date.now())}catch(y){S(y instanceof Error?y.message:String(y))}finally{g(!1)}},A=()=>{S(null),r(t)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"OpenTelemetry export"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"When enabled, every classified transcript event (tool_use, todo_write, plan, usage, agent_spawn) is mirrored as a 0-duration OTLP/HTTP span. Point this at a local collector (Jaeger, Grafana Tempo, SigNoz, Honeycomb) for cross-session analysis."}),l&&e.jsxs("p",{className:"text-fg-faint text-[11px]",children:["stored at ",e.jsx("span",{className:"font-mono",children:l})]})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Export transcripts to OTEL"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Toggle off to disable all span emission immediately."})]}),e.jsx(W,{checked:a.enabled,onChange:y=>k("enabled",y),label:a.enabled?"on":"off"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"OTLP/HTTP traces endpoint"}),e.jsx("input",{type:"text",value:a.endpoint,onChange:y=>k("endpoint",y.target.value),placeholder:"http://localhost:4318/v1/traces",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsxs("span",{className:"text-fg-dim text-xs",children:["Headers (newline-separated ",e.jsx("span",{className:"font-mono",children:"Key: Value"}),")"]}),e.jsx("textarea",{value:a.headers,onChange:y=>k("headers",y.target.value),placeholder:"x-honeycomb-team: YOUR_API_KEY",rows:3,className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Service name"}),e.jsx("input",{type:"text",value:a.serviceName,onChange:y=>k("serviceName",y.target.value),placeholder:"session-manager",className:"w-full bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Include content (PII)"}),e.jsxs("div",{className:"text-fg-faint text-xs leading-relaxed",children:["Adds tool inputs, plan text, and agent prompts to span attributes. Off by default — matches upstream Claude Code's ",e.jsx("span",{className:"font-mono",children:"OTEL_LOG_USER_PROMPTS"})," opt-in."]})]}),e.jsx(W,{checked:a.includeContent,onChange:y=>k("includeContent",y),label:a.includeContent?"on":"off"})]})]}),n&&e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"enabled:"})," ",e.jsx("span",{className:n.enabled?"text-accent":"text-fg-dim",children:String(n.enabled)})]}),n.error&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"error:"})," ",n.error]}),!n.error&&n.enabled&&e.jsx("div",{className:"text-fg-faint",children:"spans batched and exported in the background. Verify by enabling and pointing at a local Jaeger."})]}),e.jsxs("footer",{className:"flex items-center gap-3 pt-2 border-t border-line",children:[e.jsx("button",{onClick:R,disabled:!o||u,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:u?"saving…":"Save"}),e.jsx("button",{onClick:A,disabled:!o||u,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg disabled:opacity-50 disabled:cursor-not-allowed",children:"Revert"}),m&&e.jsx("span",{className:"text-red-400 text-xs",children:m}),!m&&b&&!o&&e.jsx("span",{className:"text-fg-faint text-xs",children:"saved"})]})]})}function jt(){const[t,s]=c.useState(null),[n,i]=c.useState(null),[a,r]=c.useState("Copy"),[l,p]=c.useState(!1),[u,g]=c.useState(null),[m,S]=c.useState(null),[b,j]=c.useState(null),[o,k]=c.useState(!1),R=()=>{window.api.telemetry.status().then(i).catch(v=>{console.warn("[product-telemetry] status reload failed:",v==null?void 0:v.message)})};if(c.useEffect(()=>{let v=!1;return Promise.all([window.api.telemetry.getConfig(),window.api.telemetry.status()]).then(([h,T])=>{v||(s(h),i(T))}).catch(h=>{console.warn("[product-telemetry] load failed:",h==null?void 0:h.message)}),()=>{v=!0}},[]),!t||!n)return e.jsx(V,{title:"loading…"});const A=async v=>{S(null);try{const h=await window.api.telemetry.setConfig(v);s(h.config),i(h.status)}catch(h){S(h instanceof Error?h.message:String(h))}},y=v=>{A({...t,enabled:v})},C=v=>{A({...t,enabled:v.turnOff?!1:t.enabled,noticeAckedAt:new Date().toISOString()})},E=async()=>{await Oe(t.installId)?(r("Copied"),setTimeout(()=>r("Copy"),1500)):ge.error("Could not copy install id to the clipboard")},f=async()=>{p(!0),g(null);try{const v=await window.api.telemetry.flushNow();g(`sent ${v.sent.length}, failed ${v.failed.length}`),R()}catch(v){g(v instanceof Error?v.message:String(v))}finally{p(!1)}},w=async()=>{if(o){k(!1);return}try{const v=await window.api.telemetry.recentRecords();j(v),k(!0)}catch(v){console.warn("[product-telemetry] recentRecords failed:",v instanceof Error?v.message:v)}},x=t.lastDailyFlushAt?new Date(t.lastDailyFlushAt).getTime()+bt:null;return e.jsxs("div",{className:"space-y-5","data-testid":"product-telemetry-section",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Product telemetry (bilko.run)"}),e.jsxs("p",{className:"text-fg-dim text-xs leading-relaxed",children:["Anonymous, strictly non-identifying usage/error reporting that helps improve this app. On by default; switchable off in one click. See"," ",e.jsx("span",{className:"font-mono",children:"session-manager-operations/architecture/telemetry.md"})," for the full data model."]})]}),!t.noticeAckedAt&&e.jsxs("section",{"data-testid":"telemetry-first-run-notice",className:"border border-accent rounded p-3 space-y-2 text-xs",children:[e.jsx("div",{className:"text-fg font-medium",children:"This app sends anonymous product telemetry"}),e.jsx("p",{className:"text-fg-dim leading-relaxed",children:"Collected: a coarse machine profile (OS/arch/app version, no hardware id), error and warning counts, and session counts — sent on start-up, after an update, and once a day."}),e.jsx("p",{className:"text-fg-dim leading-relaxed",children:"Never collected: prompts, transcripts, file paths, project names, email, or username."}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("button",{onClick:()=>C({turnOff:!1}),className:"px-3 py-1 rounded bg-accent text-bg",children:"OK"}),e.jsx("button",{onClick:()=>C({turnOff:!0}),className:"px-3 py-1 rounded border border-line text-fg-dim hover:text-fg",children:"Turn off"})]})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg",children:"Send anonymous product telemetry"}),e.jsx("div",{className:"text-fg-faint text-xs",children:"Sent on start-up, after an update, and once a day. Strictly anonymous — an install id only, never an email, name, or other identifier."})]}),e.jsx(W,{checked:t.enabled,onChange:y,label:t.enabled?"on":"off"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-fg-dim text-xs",children:"Anonymous install id"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",readOnly:!0,value:t.installId,"aria-label":"Anonymous install identifier",className:"flex-1 bg-bg border border-line rounded px-2 py-1 text-fg font-mono text-xs"}),e.jsx("button",{onClick:E,className:"px-2 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg",children:a})]})]}),e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("div",{className:"text-fg-faint",children:"Endpoint"}),e.jsx("div",{className:"font-mono text-fg-dim break-all",children:t.endpoint})]}),e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("div",{className:"text-fg-faint",children:"Send cadence"}),e.jsx("div",{className:"text-fg-dim",children:"on start-up, after an update, and once a day"})]}),m&&e.jsx("div",{className:"text-red-400 text-xs",children:m})]}),n.pendingCount>0&&n.sentCount===0&&e.jsxs("section",{"data-testid":"telemetry-never-delivered-warning",className:"border border-red-400 rounded p-3 text-xs space-y-1 text-red-400",children:[e.jsx("div",{className:"font-medium",children:"Never delivered"}),e.jsxs("div",{className:"leading-relaxed",children:[n.pendingCount," record",n.pendingCount===1?"":"s",' queued but none have ever been sent to bilko.run on this install. Check the endpoint/network, or click "Send now" below.']})]}),e.jsxs("section",{className:"border border-line rounded p-3 text-xs space-y-1.5",children:[e.jsx("div",{className:"text-fg-dim",children:"Runtime status"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"last send:"})," ",xe(n.lastFlushAt)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"next daily send due:"})," ",de(x?new Date(x).toISOString():null)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"queued records:"})," ",n.pendingCount]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"delivered so far:"})," ",n.sentCount]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"de-duplicated:"})," ",n.dedupedAppends]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-faint",children:"evicted:"})," ",n.evictedCount]}),n.backlog&&e.jsxs("div",{className:"text-fg-faint",children:["last backlog drain (",n.backlog.reason,", ",de(n.backlog.ranAt),"):"," ",n.backlog.linesEnqueued," enqueued, ",n.backlog.linesConfirmed," confirmed,"," ",n.backlog.watermarksRewound," watermarks rewound"]}),n.lastError&&e.jsxs("div",{className:"text-red-400 break-words",children:[e.jsx("span",{className:"text-fg-faint",children:"last error:"})," ",n.lastError.message," ","(",xe(n.lastError.at),")"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:f,disabled:l,className:"px-3 py-1 text-xs rounded bg-accent text-bg disabled:opacity-50 disabled:cursor-not-allowed",children:l?"sending…":"Send now"}),u&&e.jsx("span",{className:"text-fg-faint text-xs",children:u})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("button",{onClick:w,className:"px-3 py-1 text-xs rounded border border-line text-fg-dim hover:text-fg",children:o?"Hide last records":"Inspect last records sent"}),o&&e.jsx("pre",{"data-testid":"telemetry-inspector-json",className:"bg-bg border border-line rounded p-2 text-[11px] font-mono overflow-auto max-h-96 whitespace-pre-wrap",children:JSON.stringify(b??[],null,2)})]})]})}const te="relay_client_auth_unavailable",K=t=>(t==null?void 0:t.message)||String(t),wt=["relay_client_unpaired","token_revoked"],pe={invalid_code:"That code didn't match. Check it and try again.",code_expired:"That code expired. Mint a new one on bilko.run → Desktop clients.",invalid_code_format:"Codes are 8 letters or numbers. Check it and try again.",rate_limited:"Too many tries. Wait a minute and try again.",relay_client_unpaired:"This computer is no longer connected to your account. Enter a new code to reconnect."};function ue(t){return Object.prototype.hasOwnProperty.call(pe,t)?pe[t]:`Pairing failed (${t})`}const me=t=>{const s=/^v?(\d+)\.(\d+)\.(\d+)/.exec(t.trim());return s?[Number(s[1]),Number(s[2]),Number(s[3])]:null};function Nt(t,s){const n=me(t),i=me(s);if(!n||!i)return!1;for(let a=0;a<3;a++)if(n[a]!==i[a])return n[a]>i[a];return!1}function kt({peer:t,onConnect:s,onRevoke:n,onConfirmSas:i}){var b;const a=t.status==="authenticated",[r,l]=c.useState(null),p=((b=De())==null?void 0:b.latest)??null;c.useEffect(()=>{if(!a){l(null);return}let j=!1;return window.api.remoteClient.send(t.peerId,"cmd:app:version").then(o=>{j||l(typeof o=="string"?o:null)}).catch(()=>{j||l(null)}),()=>{j=!0}},[t.peerId,a]);const u=r!=null&&p!=null&&Nt(p,r),g=t.status==="failed"&&t.reason===te,m=t.status==="connecting",S=new Date(t.pairedAt).toLocaleString();return e.jsxs("div",{className:"space-y-2","data-testid":"remote-machine-row",children:[e.jsx(ye,{testId:"remote-machine",icon:"terminal",title:t.machineName,badge:a?e.jsx(U,{tone:"default",className:"!text-sage !border-sage/40",children:"online"}):void 0,subtitle:`${t.peerId} · last seen ${S}`,action:e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!a&&!g&&t.status!=="pending_sas"&&e.jsx(M,{testId:"remote-machine-connect",disabled:m,onClick:()=>s(t.peerId),children:m?"Connecting…":"Connect"}),e.jsx(je,{testId:"remote-machine-revoke",onClick:()=>n(t.peerId),children:"Revoke"})]})}),r&&e.jsxs("p",{"data-testid":"remote-machine-version",className:"text-[12.5px] leading-snug text-fg-faint",children:["v",r]}),u&&e.jsx("p",{"data-testid":"remote-machine-update-available",className:"text-[12.5px] leading-snug text-fg-faint",children:`Update available on ${t.machineName} (v${r} → v${p}) — update it on that machine`}),g&&e.jsx("p",{"data-testid":"remote-machine-unavailable",className:"text-[12.5px] leading-snug text-fg-faint",children:"The bilko.run relay does not support desktop clients yet"}),t.status==="pending_sas"&&t.sas&&e.jsx(ee,{peer:"other machine",testId:"remote-machine-sas",codeTestId:"remote-machine-sas-code",confirmTestId:"remote-machine-sas-confirm",code:t.sas,onConfirm:()=>i(t.peerId)})]})}function St({paired:t,revoked:s,peers:n,onAuthChanged:i,onAdded:a}){const r=Y(x=>x.show),[l,p]=c.useState(""),[u,g]=c.useState(!1),[m,S]=c.useState(!1),[b,j]=c.useState(null),[o,k]=c.useState({}),R=async()=>{g(!0);try{const x=await window.api.remoteClient.pair(l.trim());x.ok?(S(!1),p(""),i()):x.error===te?S(!0):r("error",ue(x.error??"unknown"))}catch(x){r("error",K(x))}finally{g(!1)}},A=async()=>{g(!0);try{const x=await window.api.remoteClient.devices();x.ok?j(x.devices??[]):x.error===te?S(!0):r("error",ue(x.error??"unknown"))}catch(x){r("error",K(x))}finally{g(!1)}},y=async x=>{try{await window.api.remoteClient.add(x,o[x]??`Machine ${x.slice(0,8)}`),a()}catch(v){r("error",K(v))}},C=async()=>{try{await window.api.remoteClient.unpair(),j(null),i()}catch(x){r("error",K(x))}},E=m&&e.jsx("p",{"data-testid":"remote-machine-unavailable",className:"text-[12.5px] leading-snug text-fg-faint",children:"The bilko.run relay does not support desktop clients yet"});if(!t)return e.jsxs("div",{className:"space-y-2 mb-3","data-testid":"remote-client-pairing",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{"data-testid":"remote-client-code",value:l,maxLength:8,onChange:x=>p(x.target.value),placeholder:"8-character code",className:"px-2 py-1 text-[13px] rounded border border-line bg-transparent"}),e.jsx(M,{testId:"remote-client-pair",disabled:u||l.trim().length===0,onClick:()=>{R()},children:"Pair"})]}),e.jsx("p",{className:"text-[12.5px] leading-snug text-fg-faint",children:"Mint a desktop code on your phone: Session Manager remote → Desktop clients."}),s&&e.jsx("p",{"data-testid":"remote-client-revoked",className:"text-[12.5px] leading-snug text-fg-faint",children:"This computer was disconnected from your account on bilko.run. Enter a new code to reconnect."}),E]});const f=new Set(n.map(x=>x.deviceId)),w=(b??[]).filter(x=>!f.has(x.deviceId));return e.jsxs("div",{className:"space-y-2 mb-3","data-testid":"remote-client-pairing",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{testId:"remote-client-find",disabled:u,onClick:()=>{A()},children:"Find my devices"}),e.jsx(M,{testId:"remote-client-unpair",kind:"ghost",onClick:()=>{C()},children:"Unpair"})]}),E,b&&w.length===0&&e.jsx(se,{testId:"remote-client-devices-empty",children:"No other devices to add."}),w.map(x=>e.jsxs("div",{"data-testid":"remote-client-device",className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[12.5px] text-fg-faint shrink-0",children:x.email}),e.jsx(U,{tone:"default",className:x.isOnline?"!text-sage !border-sage/40":void 0,children:x.isOnline?"online":"offline"}),e.jsx("input",{"data-testid":"remote-client-name",value:o[x.deviceId]??`Machine ${x.deviceId.slice(0,8)}`,onChange:v=>k(h=>({...h,[x.deviceId]:v.target.value})),className:"px-2 py-1 text-[13px] rounded border border-line bg-transparent min-w-0"}),e.jsx(M,{testId:"remote-client-add",onClick:()=>{y(x.deviceId)},children:"Add"})]},x.deviceId))]})}function Ct(){const t=Y(o=>o.show),s=be(o=>o.openPanel),[n,i]=c.useState(!1),[a,r]=c.useState(!1),l=c.useCallback(async()=>{try{const o=(await window.api.remoteClient.authStatus()).paired;i(o),o&&r(!1)}catch(o){t("error",K(o))}},[t]),p=c.useCallback(o=>{o.reason&&wt.includes(o.reason)&&(o.reason==="token_revoked"&&r(!0),l())},[l]),{peers:u,refresh:g,connect:m,confirmSas:S,revoke:b}=ze(p);c.useEffect(()=>{l()},[l]);const j=c.useCallback(o=>b(o),[b]);return e.jsxs("div",{"data-testid":"remote-machines",children:[e.jsx(J,{right:u.length>0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[11.5px] text-fg-faint",children:[u.length," paired"]}),e.jsx(M,{testId:"remote-machines-open-view",onClick:()=>s("remote"),children:"Open Remote view"})]}):void 0,children:"Remote machines"}),e.jsx(St,{paired:n,revoked:a,peers:u,onAuthChanged:()=>{l()},onAdded:()=>{g()}}),u.length===0?e.jsx(se,{testId:"remote-machines-empty",children:"No machines paired yet."}):e.jsx("div",{className:"space-y-2",children:u.map(o=>e.jsx(kt,{peer:o,onConnect:m,onRevoke:j,onConfirmSas:S},o.peerId))})]})}function fe({label:t,hint:s,on:n,onChange:i,warn:a,disabled:r,first:l,testId:p}){return e.jsxs("div",{className:`flex items-center justify-between gap-4 px-[18px] py-[15px] ${l?"":"border-t border-rule"} ${r?"opacity-50":""}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-fg mb-0.5",children:t}),e.jsxs("div",{className:`text-[12.5px] leading-snug flex items-center gap-1.5 ${a?"text-honey-dark":"text-fg-faint"}`,children:[a&&e.jsx("span",{"aria-hidden":!0,children:"⚠"}),s]})]}),e.jsx("span",{"data-testid":p,className:"inline-flex",children:e.jsx(W,{checked:n,onChange:r?()=>{}:i,disabled:r})})]})}function Et({device:t,online:s,onRevoke:n,revoking:i}){const a=t.lastConnectedAt?new Date(t.lastConnectedAt).toLocaleString():`paired ${new Date(t.issuedAt).toLocaleDateString()}`;return e.jsx(ye,{testId:"settings-remote-device",icon:"wifi",title:t.deviceName,badge:s?e.jsx(U,{tone:"default",className:"!text-sage !border-sage/40",children:"online"}):void 0,subtitle:`${t.deviceId} · last seen ${a}`,action:e.jsx(je,{testId:"settings-remote-revoke",onClick:()=>n(t.deviceId),disabled:i})})}const $=t=>(t==null?void 0:t.message)||String(t);function Rt(){var re;const t=Y(d=>d.show),[s,n]=c.useState(null),[i,a]=c.useState(!0),[r,l]=c.useState(!1),[p,u]=c.useState(!1),[g,m]=c.useState("idle"),[S,b]=c.useState(""),[j,o]=c.useState(null),[k,R]=c.useState(!1),[A,y]=c.useState([]),[C,E]=c.useState(!1),f=c.useRef(null);c.useEffect(()=>{let d=!1;const N=()=>window.api.webRemote.getStatus().then(D=>{d||n(D)}).catch(()=>{});window.api.webRemote.getStatus().then(D=>{d||(n(D),a(!1))}).catch(D=>{d||(t("error",`Remote status: ${$(D)}`),a(!1))});const Ie=window.api.webRemote.onStatus(D=>n(D)),Te=window.api.webRemote.onTokenRevoked(()=>{t("warn","Remote device token was revoked. Re-pair to reconnect."),N()}),Pe=window.api.webRemote.onRevokedAll(({revokedCount:D})=>{t("info",`Panic: all ${D} device(s) revoked and sessions torn down.`),N()});return()=>{d=!0,Ie(),Te(),Pe()}},[t]),c.useEffect(()=>{if(g!=="enter-otp")return;const d=setTimeout(()=>{var N;return(N=f.current)==null?void 0:N.focus()},50);return()=>clearTimeout(d)},[g]);const w=async()=>n(await window.api.webRemote.getStatus()),x=async()=>{if(s){l(!0);try{const d=s.enabled?await window.api.webRemote.disable():await window.api.webRemote.enable();d&&d.ok===!1&&t("error",d.error||"Failed to change remote state."),await w()}catch(d){t("error",`Failed: ${$(d)}`)}finally{l(!1)}}},v=async()=>{if(s){u(!0);try{const d=s.remoteControlEnabled?await window.api.webRemote.disableControl():await window.api.webRemote.enableControl();d&&d.ok===!1&&t("error",d.error||"Failed to change command writes."),await w()}catch(d){t("error",`Failed: ${$(d)}`)}finally{u(!1)}}},h=async()=>{const d=S.trim().toUpperCase();if(!/^[A-Z0-9]{8}$/.test(d)){t("warn","Pairing code must be 8 alphanumeric characters.");return}m("pairing");try{const N=await window.api.webRemote.pair(d);if(!N.ok){t("error",N.error||"Pairing failed."),m("enter-otp");return}t("info","Device paired successfully."),b(""),m("idle"),await w()}catch(N){t("error",`Pairing error: ${$(N)}`),m("enter-otp")}},T=async d=>{o(d);try{const N=await window.api.webRemote.revokeDevice(d);if(!N.ok){t("error",N.error||"Revoke failed.");return}await w()}catch(N){t("error",`Revoke error: ${$(N)}`)}finally{o(null)}},P=async()=>{R(!0);try{const d=await window.api.webRemote.revokeAll();d.ok||t("error",d.error||"Panic revoke failed.")}catch(d){t("error",`Panic revoke error: ${$(d)}`)}finally{R(!1)}},ne=async()=>{if(C){E(!1);return}try{const d=await window.api.webRemote.auditTail(100);if(!d.ok){t("error",`Audit log: ${d.error||"unavailable"}`);return}y(d.lines??[]),E(!0)}catch(d){t("error",`Audit log: ${$(d)}`)}},_=async d=>{try{const N=await window.api.webRemote.confirmSas(d);N!=null&&N.ok||t("error",`SAS confirm failed: ${(N==null?void 0:N.error)??"unexpected state — reconnect the mobile app"}`)}catch(N){t("error",`SAS confirm failed: ${$(N)}`)}};if(i)return e.jsx("div",{className:"p-6 text-fg-faint text-sm",children:"Loading…"});const O=(s==null?void 0:s.enabled)??!1,L=(s==null?void 0:s.remoteControlEnabled)??!1,X=(s==null?void 0:s.connected)??!1,B=(s==null?void 0:s.e2eActive)??!1,Ee=(s==null?void 0:s.e2eAuthenticated)??!1,Re=(s==null?void 0:s.e2eState)??"idle",ae=(s==null?void 0:s.pendingSas)??null,Z=((s==null?void 0:s.clients)??[]).filter(d=>d.state==="pending_sas"&&d.pendingSas),G=(s==null?void 0:s.devices)??[],H=O&&X,Ae=X?((re=G.reduce((d,N)=>N.lastConnectedAt&&(!d||(d.lastConnectedAt??"")<N.lastConnectedAt)?N:d,null))==null?void 0:re.deviceId)??null:null;return e.jsxs("div",{"data-testid":"settings-remote",className:"p-4 max-w-[760px] space-y-[22px]",children:[Z.length>0?Z.map((d,N)=>e.jsxs("div",{"data-testid":"settings-remote-sas-row",children:[Z.length>1&&e.jsx("div",{className:"text-[12px] font-semibold text-fg-dim mb-1",children:d.clientId??"Phone"}),e.jsx(ee,{testId:N===0?"settings-remote-sas":void 0,codeTestId:N===0?"settings-remote-sas-code":void 0,confirmTestId:N===0?"settings-remote-sas-confirm":void 0,code:d.pendingSas,onConfirm:()=>_(d.key)})]},d.key)):ae&&e.jsx(ee,{testId:"settings-remote-sas",codeTestId:"settings-remote-sas-code",confirmTestId:"settings-remote-sas-confirm",code:ae,onConfirm:()=>_()}),Re==="failed"&&e.jsxs("div",{className:"flex items-center gap-3.5 px-5 py-4 rounded-2xl border border-[#eccdbe] bg-[#f8e8e0]",children:[e.jsx("span",{className:"w-4 h-4 rounded-full bg-accent text-white grid place-items-center text-[11px] font-bold shrink-0",children:"!"}),e.jsxs("div",{className:"text-[13px] text-[#9a3f1f]",children:[e.jsx("strong",{className:"font-semibold",children:"E2E key exchange failed."})," ",e.jsx("span",{className:"text-fg-dim",children:"The session key could not be established. Reconnect the mobile app to retry."})]})]}),e.jsxs("div",{className:`flex items-center gap-3.5 px-5 py-4 rounded-2xl border ${H?"border-[#e8cdb9] bg-[#f5e9df]":"border-line bg-bg-hi"}`,children:[e.jsx("span",{className:`w-[38px] h-[38px] rounded-[11px] shrink-0 grid place-items-center ${H?"bg-[#f0d9c8] text-accent":"bg-[#e4ebd6] text-sage"}`,children:e.jsx(Q,{name:H?"wifi":"shield",size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[14.5px] font-semibold text-fg mb-0.5",children:H?"Remote control is active":O?"Remote control is idle":"Remote control is off"}),e.jsx("div",{className:"text-[13px] text-fg-dim leading-snug",children:H?"A web session can send commands to this machine. Revoke below if unexpected.":O?"The relay is on but no device is connected. Pair a device to begin.":"The relay connection is closed — no remote commands are accepted. Enable it below only when you need it."})]}),B&&Ee?e.jsx(U,{tone:"default",className:"!text-sage !border-sage/40",children:"E2E authenticated"}):B?e.jsx(U,{tone:"warn",children:"E2E · awaiting SAS"}):e.jsx(U,{tone:"dim",children:"relay only · not E2E yet"})]}),e.jsxs("div",{children:[e.jsx(J,{children:"Remote control"}),e.jsxs("div",{className:"bg-bg-hi border border-line rounded-2xl overflow-hidden",children:[e.jsx(fe,{first:!0,testId:"settings-remote-enable",label:"Allow remote control from the web",hint:"Master switch. When off, the relay refuses every connection.",on:O,disabled:r,onChange:()=>{r||x()}}),e.jsx(fe,{testId:"settings-remote-control",label:"Allow command writes (pty + scheduler)",hint:L?"A paired device can run shell commands and queue jobs on this machine.":"Paired devices can watch session output but cannot send commands.",warn:L,disabled:!O||p,on:L&&O,onChange:()=>{O&&!p&&v()}})]})]}),e.jsxs("div",{children:[e.jsx(J,{children:"Pair a device"}),g==="idle"?e.jsxs("div",{className:"flex items-center justify-between gap-4 bg-bg-hi border border-line rounded-2xl px-5 py-[18px]",children:[e.jsxs("div",{"data-testid":"settings-remote-pair-hint",className:"text-[13.5px] text-fg-dim leading-relaxed max-w-[420px]",children:["On your phone open ",e.jsx("strong",{className:"text-fg font-semibold",children:"bilko.run/projects/session-manager"}),", sign in, and tap"," ",e.jsx("strong",{className:"text-fg font-semibold",children:"Generate pairing code"}),". Enter the 8-character code here."]}),e.jsx(M,{testId:"settings-remote-pair-start",kind:"soft",icon:"link",onClick:()=>m("enter-otp"),children:"Pair Device…"})]}):e.jsxs("div",{className:"flex items-center gap-5 bg-bg-hi border border-accent/40 rounded-2xl px-6 py-[22px]",children:[e.jsx("span",{className:"w-[52px] h-[52px] rounded-xl bg-bg border border-line grid place-items-center text-accent shrink-0",children:e.jsx(Q,{name:"link",size:24})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11.5px] font-bold uppercase tracking-[0.8px] text-fg-faint mb-2",children:"Enter the code from your phone"}),e.jsx("input",{ref:f,"data-testid":"settings-remote-otp",value:S,onChange:d=>b(d.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),onKeyDown:d=>{d.key==="Enter"&&h()},maxLength:8,placeholder:"XXXXXXXX",disabled:g==="pairing",className:"w-full bg-transparent border-0 outline-none font-mono text-[30px] font-semibold tracking-[6px] text-fg placeholder:text-fg-faint/40 disabled:opacity-50"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(M,{testId:"settings-remote-pair-confirm",kind:"soft",onClick:h,disabled:g==="pairing"||S.length<8,children:g==="pairing"?"Pairing…":"Confirm"}),e.jsx(M,{kind:"ghost",onClick:()=>{m("idle"),b("")},disabled:g==="pairing",children:"cancel"})]})]})]}),e.jsxs("div",{children:[e.jsx(J,{right:G.length>0?e.jsxs("span",{className:"text-[11.5px] text-fg-faint",children:[G.length," paired"]}):void 0,children:"Paired devices"}),G.length===0?e.jsx(se,{children:"No devices paired yet."}):e.jsx("div",{className:"space-y-2",children:G.map(d=>e.jsx(Et,{device:d,online:d.deviceId===Ae,onRevoke:T,revoking:j===d.deviceId},d.deviceId))})]}),e.jsx(Ct,{}),e.jsxs("div",{children:[e.jsx(J,{right:e.jsx("button",{"data-testid":"settings-remote-audit-toggle",onClick:ne,className:"text-[12px] text-fg-faint hover:text-fg-dim transition-colors",children:C?"Hide":"Show last 100 · 0600, stays on this machine"}),children:"Audit log"}),C&&e.jsx("div",{className:"bg-bg-hi border border-line rounded-xl overflow-auto max-h-64 mb-2",children:A.length===0?e.jsx("p",{className:"p-4 text-[12.5px] text-fg-faint",children:"No entries today."}):e.jsx("pre",{"data-testid":"settings-remote-audit",className:"p-4 text-[12px] text-fg-dim font-mono whitespace-pre-wrap leading-relaxed",children:A.join(`
3
- `)})}),e.jsxs("p",{className:"text-[12px] text-fg-faint",children:["Full log at"," ",e.jsx("code",{className:"font-mono text-fg-faint",children:"~/.claude/session-manager/logs/remote-audit-YYYY-MM-DD.log"})," ","(0600, never leaves this machine)"]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 bg-[#f8e8e0] border border-[#eccdbe] rounded-2xl px-5 py-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"w-4 h-4 rounded-full bg-accent text-white grid place-items-center text-[11px] font-bold shrink-0",children:"!"}),e.jsx("span",{className:"text-sm font-semibold text-[#9a3f1f]",children:"Panic — disconnect & revoke everything"})]}),e.jsx("div",{className:"text-[12.5px] text-fg-dim leading-snug max-w-[440px]",children:"Tears down every active session and invalidates all paired-device tokens. Devices must re-pair. Use if you suspect compromise."})]}),e.jsx("button",{"data-testid":"settings-remote-revoke-all",onClick:P,disabled:k,className:"shrink-0 rounded-lg bg-accent text-white px-[18px] py-2 text-[13px] font-semibold hover:opacity-90 disabled:opacity-50 transition-opacity",children:k?"Revoking…":"Revoke all"})]})]})}const z="px-2 py-1 rounded border border-line text-xs text-fg hover:bg-bg-hi disabled:opacity-50";function At(){const t=Me(),s=Y(p=>p.show),n=async p=>{try{const g=await p();g&&g.ok===!1&&s("error",g.error??"Update action failed")}catch(u){s("error",u instanceof Error?u.message:String(u))}};if(!t)return null;const{state:i}=t,a=i==="unsupported",r=t.latest?`v${t.latest}`:"—",l=()=>{window.confirm("Installing now will stop all running jobs and terminals. Continue?")&&n(()=>window.api.updater.install(!0))};return e.jsxs("section",{"data-testid":"settings-updates",className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-fg text-xs font-medium",children:"Updates"}),e.jsxs("div",{className:"text-fg-dim text-xs flex gap-4",children:[e.jsxs("span",{children:["Current v",t.current]}),e.jsxs("span",{children:["Latest ",r]})]})]}),a?e.jsx("p",{className:"text-fg-faint text-[11px]",children:"Auto-update runs only in the installed Windows app or the Linux AppImage. npx builds update via npx."}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{checked:t.enabled,onChange:p=>void n(()=>window.api.updater.setEnabled(p)),label:"Update automatically"}),e.jsx("button",{type:"button","data-testid":"updates-check",className:z,disabled:i==="checking"||i==="downloading",onClick:()=>void n(()=>window.api.updater.check()),children:"Check for updates"})]}),i==="checking"&&e.jsx("p",{className:"text-fg-dim text-xs",children:"Checking…"}),i==="downloading"&&e.jsxs("p",{className:"text-fg-dim text-xs",children:["Downloading… ",t.progress!=null?`${Math.round(t.progress)}%`:""]}),i==="ready"&&e.jsxs("button",{type:"button","data-testid":"updates-install",className:z,onClick:()=>void n(()=>window.api.updater.install(!1)),children:["Restart to install v",t.latest]}),i==="deferred"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-fg-dim text-xs",children:["Waiting for ",t.busyReason??"work"," to finish"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",className:z,onClick:l,children:"Install now"}),e.jsx("button",{type:"button",className:z,onClick:()=>void n(()=>window.api.updater.cancelDeferred()),children:"Cancel"})]})]}),i==="error"&&e.jsx("p",{className:"text-red-400 text-xs",children:t.error})]})}const It={compact:"Compact",roomy:"Roomy"};function Tt(){const{model:t,setModel:s}=$e(),{catalog:n}=Le(null),{density:i,setDensity:a}=_e();return e.jsxs("div",{className:"p-4 max-w-3xl space-y-5 text-sm",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h2",{className:"text-fg text-base font-medium",children:"Session Manager preferences"}),e.jsx("p",{className:"text-fg-dim text-xs leading-relaxed",children:"Native app preferences, stored locally — not part of Claude Code's own settings."})]}),e.jsxs("section",{className:"border border-line rounded p-3 space-y-3",children:[e.jsxs("div",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Default model for raw sessions"}),e.jsx(ie,{options:Ue(n),value:t,onChange:s,mono:!0}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Used when opening a raw interactive session without an explicit per-launch override."})]}),e.jsxs("div",{className:"block space-y-1",children:[e.jsx("span",{className:"text-fg-dim text-xs",children:"Density"}),e.jsx(ie,{options:["compact","roomy"],value:i,onChange:r=>a(r),labels:It}),e.jsx("span",{className:"text-fg-faint text-[11px]",children:"Compact tightens spacing across the app's chrome; Roomy is the default."})]})]}),e.jsx(At,{})]})}function Pt({cwd:t}){const[s,n]=c.useState(!1),[i,a]=c.useState(!1),[r,l]=c.useState(!1),[p,u]=c.useState(!1);c.useEffect(()=>{var j,o;let b=!1;return n(!1),Promise.resolve((o=(j=window.api.promptSessions)==null?void 0:j.getWorktreeDisabled)==null?void 0:o.call(j,{cwd:t})).then(k=>{b||(a((k==null?void 0:k.disabled)??!1),l((k==null?void 0:k.disabled)??!1),n(!0))},()=>{b||n(!0)}),()=>{b=!0}},[t]);const g=s&&r!==i,m=()=>{var b,j;u(!0),Promise.resolve((j=(b=window.api.promptSessions)==null?void 0:b.setWorktreeDisabled)==null?void 0:j.call(b,{cwd:t,disabled:r})).then(o=>{a((o==null?void 0:o.disabled)??r),l((o==null?void 0:o.disabled)??r)}).catch(o=>ge.error(o instanceof Error?o.message:String(o))).finally(()=>u(!1))},S=()=>l(i);return e.jsxs("div",{"data-testid":"settings-epic-isolation",className:"border-b border-line bg-bg-elev px-3 py-2.5 text-[11.5px] leading-snug",children:[e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:r,disabled:!s||p,onChange:b=>l(b.target.checked),"data-testid":"settings-epic-isolation-checkbox",className:"mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-fg",children:"Disable Epic worktree isolation for this project"}),e.jsxs("span",{className:"block text-fg-dim",children:["Off by default — each active Epic runs in its own isolated ",e.jsx("code",{children:"git worktree"})," (branch"," ",e.jsx("code",{children:"sm-epic/<id>"}),"), merged back to main at an explicit checkpoint. Turning this on makes every new Epic in this project run directly in the shared working tree instead, same as before this feature existed."]})]})]}),g&&e.jsx(ve,{dirty:g,busy:p,onSave:m,onRevert:S})]})}const he={user:{title:"Global settings",body:"This is the real ~/.claude/settings.json on disk — the same file the claude CLI reads on every session it starts. Edits apply machine-wide, to every project and every session."},project:{title:"Project settings",body:"This is the real <project>/.claude/settings.json on disk, checked into git. Edits apply to every current and future session in this project, for anyone who clones it."},local:{title:"Local settings",body:"This is the real <project>/.claude/settings.local.json on disk, gitignored. Edits apply to every current and future session in this project, on this machine only."}};function Ot(){const t=Fe(),s=le(h=>h.tabs),n=le(h=>h.activeTabId),i=s.find(h=>h.id===n)??null,a=(i==null?void 0:i.cwd)??null,r=be(h=>h.navFace),l=c.useRef(!1),p=c.useRef(r),[u,g]=c.useState(()=>r==="project"&&a?"project":"user"),[m,S]=c.useState("effective");c.useEffect(()=>{if(p.current!==r){if(p.current=r,l.current){l.current=!1;return}g(r==="project"&&a?"project":"user")}},[r,a]),c.useEffect(()=>{r==="project"&&(m==="telemetry"||m==="remote"||m==="app")&&S("effective")},[r,m]);const b=h=>{l.current=!0,g(h)},j=We(oe,t,a),o=j[u]??null,k=q(h=>h.files),R=q(h=>h.setDraft),A=q(h=>h.saveJson),y=q(h=>h.revert),[C,E]=c.useState(null),f=c.useMemo(()=>Be(Ge(k,j)),[k,j]),w=(h,T,P)=>{var B;const _=j[P??u];if(!_)return;E(null);const O=((B=k[_])==null?void 0:B.draftRaw)??"";let L={};if(O.trim())try{L=JSON.parse(O)}catch{L={}}const X=Je(L,h,T);R(_,JSON.stringify(X,null,2)+`
4
- `)};if(!t)return e.jsx(V,{title:"loading…"});const x=o?k[o]:null,v=h=>h!=="user"&&!a;return e.jsx(Ke,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(qe,{options:[{key:"effective",label:"Guided"},{key:"tree",label:"Tree"},{key:"raw",label:"Raw"},...r==="home"?[{key:"telemetry",label:"Telemetry"},{key:"remote",label:"Phone remote"},{key:"app",label:"Session Manager"}]:[]],active:m,onChange:S}),m!=="telemetry"&&m!=="remote"&&m!=="app"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx(Ve,{scopes:oe.scopes,active:u,onChange:b,annotate:h=>{if(v(h))return{exists:!1};const T=j[h];if(!T)return null;const P=k[T];return{exists:(P==null?void 0:P.exists)??!1,dirty:(P==null?void 0:P.dirty)??!1}}}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:m==="effective"?`overrides → ${o??"—"}`:o??"—"})]}),e.jsx("div",{className:"flex-1"}),e.jsx("a",{href:"https://code.claude.com/docs/en/settings",target:"_blank",rel:"noreferrer",className:"text-fg-faint hover:text-fg-dim underline-offset-2 hover:underline",children:"schema reference ↗"})]}),footer:m!=="telemetry"&&m!=="remote"&&m!=="app"&&o&&x?e.jsx(ve,{dirty:x.dirty,busy:x.busy,parseError:C||x.parseError,lastSavedAt:x.lastSavedAt,leading:x.exists?null:e.jsx("span",{children:"file will be created on save"}),onSave:async()=>{E(null);const h=await A(o);h.ok||E(h.error??"save failed")},onRevert:()=>{E(null),y(o)}}):null,children:m==="telemetry"?e.jsx(vt,{}):m==="remote"?e.jsx(Rt,{}):m==="app"?e.jsx(Tt,{}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"settings-scope-note",className:"sticky top-0 z-10 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:he[u].title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:he[u].body}),o&&e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:o})]}),u==="project"&&a&&e.jsx(Pt,{cwd:a}),v(u)?e.jsx(V,{title:"no active project",hint:"open a tab in a project directory to edit project or local settings"}):m==="effective"?e.jsx(at,{node:f,targetScope:u,onOverride:w,schema:ce()}):m==="tree"?e.jsx(Xe,{node:f,targetScope:u,onOverride:w,schema:ce()}):o&&x?e.jsx(He,{path:o,value:x.draftRaw,onChange:h=>{E(null),R(o,h)}}):e.jsx(V,{title:"resolving…"})]})})}const Jt=c.memo(Ot);export{he as SETTINGS_SCOPE_NOTES,Jt as Settings};
@@ -1,2 +0,0 @@
1
- import{aD as a,b1 as ce,aV as de,b3 as ue,aU as E,aX as d,aY as fe,an as s,n as T}from"./index-CPieAFsl.js";import{P as _}from"./Panel-CQY5zano.js";import{L as me}from"./ListDetail-DcfmxPFk.js";import{M as pe}from"./MarkdownEditor-CvK1pyto.js";import{S as he}from"./SaveBar-DjijiUb0.js";import{S as K}from"./ScopeSwitcher-B-P-kSfq.js";import{T as xe}from"./Toggle-Ba_f7q_m.js";import{P as Q}from"./ProvenanceBadge-vC7Tj-JP.js";import{l as ve}from"./listSkills-C1aWKf0T.js";import{S as ge,V as I}from"./Library-CeF4qh9d.js";import{p as ke,r as je,s as be}from"./skillFrontmatter-Dif5JIg7.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-DsEYRZg0.js";const Se=250,we=2e3;function ye(m,p){return{user:{skills:`${m}/.claude/skills`,commands:`${m}/.claude/commands`},project:p?{skills:`${p}/.claude/skills`,commands:`${p}/.claude/commands`}:null}}function Ce(){const m=ce(),p=de(),x=(p==null?void 0:p.cwd)??null,v=ue(t=>t.navFace),S=a.useRef(!1),B=a.useRef(v),[u,D]=a.useState(()=>v==="project"&&x?"project":"user"),[f,w]=a.useState([]),[o,$]=a.useState(null),[y,L]=a.useState("installed"),[O,Z]=a.useState(""),[q,H]=a.useState([]),[U,F]=a.useState(null),C=a.useMemo(()=>m?ye(m,x):null,[m,x]);a.useEffect(()=>{if(B.current!==v){if(B.current=v,S.current){S.current=!1;return}D(v==="project"&&x?"project":"user")}},[v,x]);const c=a.useMemo(()=>C?u==="user"?C.user:C.project:null,[u,C]),P=a.useRef(0),N=a.useCallback(async()=>{const t=++P.current;if(!c){w([]),H([]);return}const l=[],n=[];try{const e=await ve(c.skills);n.push(...e.errors);for(const r of e.entries)l.push({kind:"skills",scope:u,name:r.name,path:r.path,dir:r.dir,disabled:je(r.text),description:ke(r.text).description??void 0})}catch(e){n.push({path:c.skills,error:e instanceof Error?e.message:String(e)})}try{const e=await window.api.config.listDir(c.commands,{filesOnly:!0});e.ok||n.push({path:c.commands,error:e.error??"failed to list directory"});for(const r of e.entries)r.name.endsWith(".md")&&l.push({kind:"commands",scope:u,name:r.name.replace(/\.md$/,""),path:r.path,dir:null,disabled:!1})}catch(e){n.push({path:c.commands,error:e instanceof Error?e.message:String(e)})}if(P.current===t){for(const e of n)E.error(`Could not read ${e.path}: ${e.error}`);H(n),l.sort((e,r)=>e.kind===r.kind?e.name.localeCompare(r.name):e.kind==="skills"?-1:1),w(l),$(e=>{var r;return l.find(i=>i.path===e)?e:((r=l[0])==null?void 0:r.path)??null})}},[c,u]);a.useEffect(()=>{N()},[N]),a.useEffect(()=>()=>{P.current+=1},[]);const X=a.useRef(N);X.current=N;const Y=a.useRef(f);Y.current=f;const z=a.useRef(o);z.current=o;const g=a.useRef(null),A=a.useRef(!1),M=a.useRef(!1),W=a.useCallback(async()=>{if(A.current){M.current=!0;return}A.current=!0;try{await X.current()}finally{A.current=!1}M.current&&(M.current=!1,W())},[]);a.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const ee=a.useCallback(t=>{var r;const l=z.current,n=l?Y.current.find(i=>i.path===l):null,e=l?(r=d.getState().files[l])==null?void 0:r.lastSavedAt:null;n!=null&&n.dir&&e&&Date.now()-e<we&&(t===n.dir||n.dir.startsWith(`${t}/`))||(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,W()},Se))},[W]);fe(c?[c.skills,c.commands]:[],ee);const b=d(t=>t.files),te=d(t=>t.loadText),se=d(t=>t.setDraft),re=d(t=>t.saveText),ae=d(t=>t.revert),ne=d(t=>t.watchFile),G=d(t=>t.unwatchFile);async function le(t,l){const n=await window.api.config.readText(t.path);if(!n.exists)return;const e=be(n.text,l);if(e===n.text)return;const r=await window.api.config.writeText(t.path,e);if(!r.ok){E.error(r.error??"failed to update skill");return}w(i=>i.map(j=>j.path===t.path?{...j,disabled:l}:j)),d.getState().files[t.path]&&d.getState().loadText(t.path,!0)}async function oe(t){if(!t.dir)return;F(null);const l=await window.api.files.delete(t.dir);if(!l.ok){E.error(l.error??"failed to remove skill");return}E.info(`Removed "${t.name}" — moved to trash`),G(t.path),w(n=>{const e=n.filter(r=>r.path!==t.path);return $(r=>{var i;return r!==t.path?r:((i=e[0])==null?void 0:i.path)??null}),e})}a.useEffect(()=>{if(o)return b[o]||te(o),ne(o),()=>G(o)},[o]);const[ie,R]=a.useState(null);if(!m)return s.jsx(T,{title:"loading…"});if(y==="library")return s.jsx(_,{toolbar:s.jsx(I,{active:y,onChange:L,installedLabel:"Installed",libraryLabel:"Library"}),children:s.jsx(ge,{})});if(u==="project"&&!x)return s.jsx(_,{toolbar:s.jsxs(s.Fragment,{children:[s.jsx(I,{active:y,onChange:L}),s.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),s.jsx(K,{scopes:["user","project"],active:u,onChange:t=>{S.current=!0,D(t)}})]}),children:s.jsx(T,{title:"no active project",hint:"open a tab in a project directory to view project skills & commands"})});const h=f.find(t=>t.path===o)??null,k=o?b[o]:null;return s.jsx(_,{toolbar:s.jsxs(s.Fragment,{children:[s.jsx(I,{active:y,onChange:L}),s.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),s.jsx(K,{scopes:["user","project"],active:u,onChange:t=>{S.current=!0,D(t)}}),s.jsxs("span",{className:"ml-3 text-fg-faint",children:[f.length," ",f.length===1?"item":"items"]}),s.jsx("div",{className:"flex-1"}),h&&s.jsx(Q,{scope:h.scope,input:{type:h.kind==="commands"?"command":"skill",name:h.name}}),s.jsx("span",{className:"ml-2 text-fg-faint truncate",children:(h==null?void 0:h.path)??""})]}),footer:o&&k?s.jsx(he,{dirty:k.dirty,busy:k.busy,parseError:ie,lastSavedAt:k.lastSavedAt,onSave:async()=>{R(null);const t=await re(o);t.ok||R(t.error??"save failed")},onRevert:()=>{R(null),ae(o)}}):null,children:s.jsx(me,{sidebar:s.jsxs("div",{className:"py-1",children:[s.jsx("div",{className:"px-2 pb-1",children:s.jsx("input",{value:O,onChange:t=>Z(t.target.value),placeholder:"filter…",className:"w-full bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg"})}),["skills","commands"].map(t=>{const l=O.toLowerCase(),n=f.filter(e=>e.kind===t&&(!l||e.name.toLowerCase().includes(l)));return s.jsxs("div",{className:"mb-3",children:[s.jsx("div",{className:"px-3 py-1 text-xs uppercase tracking-wider text-fg-faint",children:t==="skills"?"Skills":"Slash Commands"}),n.length===0?s.jsx("div",{className:"px-3 py-1 text-xs text-fg-faint italic",children:"none"}):n.map(e=>{var i,j,J;const r=e.kind==="skills";return s.jsxs("div",{className:`w-full px-3 py-1 text-xs flex items-center justify-between gap-2 ${o===e.path?"bg-bg-hi text-fg":"text-fg-dim hover:text-fg hover:bg-bg-hi"}`,children:[s.jsxs("button",{onClick:()=>$(e.path),className:"flex-1 min-w-0 text-left",children:[s.jsxs("div",{className:`truncate ${e.disabled?"line-through opacity-50":""}`,title:e.disabled?"Disabled — Claude will not auto-invoke this skill":void 0,children:[e.kind==="commands"?"/":"",e.name]}),e.description&&s.jsx("div",{className:"truncate text-fg-faint",children:e.description})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(Q,{interactive:!1,scope:e.scope,input:{type:e.kind==="commands"?"command":"skill",name:e.name}}),((i=b[e.path])==null?void 0:i.dirty)&&s.jsx("span",{className:"w-1 h-1 rounded-full bg-accent"}),r&&s.jsx("span",{title:(j=b[e.path])!=null&&j.dirty?"This skill has unsaved edits — save or revert before toggling":void 0,children:s.jsx(xe,{checked:!e.disabled,disabled:!!((J=b[e.path])!=null&&J.dirty),onChange:V=>void le(e,!V)})}),e.kind==="skills"&&U===e.path&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>void oe(e),title:`Remove ${e.name} — moves the folder to trash; reinstall from the Library`,className:"text-[10px] font-semibold text-red-400 hover:text-red-300",children:"confirm"}),s.jsx("button",{onClick:()=>F(null),title:"Cancel",className:"text-[10px] text-fg-faint hover:text-fg",children:"cancel"})]}),e.kind==="skills"&&U!==e.path&&s.jsx("button",{onClick:V=>{V.stopPropagation(),F(e.path)},title:"Remove skill — moves the folder to trash; reinstall from the Library","aria-label":`Remove ${e.name}`,className:"text-fg-faint hover:text-red-400 leading-none px-0.5",children:"✕"})]})]},e.path)})]},t)})]}),detail:o&&k?s.jsx("div",{className:"h-full",children:s.jsx(pe,{path:o,value:k.draftRaw,onChange:t=>{R(null),se(o,t)}})}):f.length===0&&q.length>0?s.jsx("div",{"data-testid":"skills-list-error",children:s.jsx(T,{title:"could not list skills or commands",hint:q.map(t=>`${t.path}: ${t.error}`).join(`
2
- `)})}):s.jsx(T,{title:f.length===0?"no skills or commands":"select an item"})})})}const _e=a.memo(Ce);export{_e as Skills};
@@ -1 +0,0 @@
1
- import{aD as i,aX as g,an as e,aU as _,b0 as B,al as $,am as I,aQ as V,a4 as z,e as H,h as L,t as D,s as M,l as Q,a9 as X,b1 as q,C as G,n as T,a8 as J}from"./index-CPieAFsl.js";import{P as U}from"./Panel-CQY5zano.js";import{S as K}from"./SaveBar-DjijiUb0.js";import{f as W,V as A}from"./Library-CeF4qh9d.js";import"./monaco-editor-BsIlgG7c.js";import"./Button-DsEYRZg0.js";import"./listSkills-C1aWKf0T.js";const Y=300;function P(t){return t.split("/").pop()||t}function Z({activePath:t,selectedPath:o,onSelect:u}){const[l,a]=i.useState([]),h=i.useRef(0),r=i.useRef(u);r.current=u;const y=g(n=>{var d;return t?(d=n.files[t])==null?void 0:d.diskRaw:void 0}),f=i.useRef(null);if(i.useEffect(()=>{r.current(null)},[t]),i.useEffect(()=>{if(h.current+=1,!t){f.current=null,a([]);return}const n=f.current!==t;f.current=t;let d=!1;const m=()=>{h.current+=1;const b=h.current;window.api.config.parseImports(t).then(v=>{d||h.current!==b||(v.ok?a(v.imports):(a([]),_.error(v.error||"failed to parse @-imports")))})},j=n?null:setTimeout(m,Y);return n&&m(),()=>{d=!0,j&&clearTimeout(j)}},[t,y]),l.length===0||!t)return null;const x=o===t||o===null;return e.jsxs("div",{className:"w-64 shrink-0 border-r border-line bg-bg-elev overflow-auto","data-testid":"referenced-files-rail",children:[e.jsxs("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wide text-fg-faint border-b border-line",children:["Documents · ",l.length+1]}),e.jsxs("button",{type:"button",onClick:()=>u(null),"aria-current":x,"data-testid":"referenced-file-root",className:`w-full text-left px-3 py-2 border-b border-line ${x?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg"}`,children:[e.jsx("div",{className:"text-[11.5px] font-medium truncate",children:P(t)}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:t,children:"this system prompt"})]}),l.map(n=>{const d=!n.ok||!n.exists,m=o===n.path;return e.jsxs("button",{type:"button",onClick:()=>u(n),"aria-current":m,"data-testid":"referenced-file-row",className:`w-full text-left px-3 py-2 border-b border-line last:border-b-0 ${m?"bg-bg-hi text-fg":"text-fg-dim hover:bg-bg"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11.5px] font-medium truncate flex-1",children:P(n.path)}),d&&e.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-amber-400/90 border border-amber-400/30","data-testid":"referenced-file-missing",children:"missing"})]}),e.jsx("div",{className:"text-[10px] text-fg-faint truncate",title:n.path,children:n.path}),e.jsxs("div",{className:"text-[10px] text-fg-faint",children:[n.sizeBytes.toLocaleString()," bytes · ~",n.tokenEstimate.toLocaleString()," tokens"]})]},n.path)})]})}function F(t){return t.split("/").filter(Boolean).pop()||t}function ee({path:t,value:o,onChange:u,onSave:l,readOnly:a,defaultMode:h,headerRight:r,hideStatusBar:y}){const f=B(),x=$(t),n=I(t),d=V(t),[m,j]=i.useState(()=>a&&n?"preview":h??z(t)),[b,v]=i.useState(!0),[w,R]=i.useState(null),E=i.useRef(null),c=i.useRef(null),k=i.useCallback(s=>{E.current=s},[]),S=i.useCallback(()=>E.current,[]),C=a?n?["preview","edit"]:[]:d?["edit","preview","split"]:n?["edit","preview"]:[],p=n?m:"edit",N=e.jsx(H,{path:t,name:F(t),value:o,onChange:u,onSave:()=>l==null?void 0:l(),onReady:k,onCursor:R,readOnly:a});return e.jsxs("div",{className:"flex flex-col h-full min-h-0","data-testid":"document-editor-pane",children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 h-7 shrink-0 border-b border-line bg-bg-elev",children:[e.jsx("span",{className:"text-[11px] font-medium text-fg truncate",children:F(t)}),a&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wide text-fg-faint border border-line",children:"read-only"}),e.jsx("div",{className:"flex-1"}),r,x&&(p==="preview"||p==="split")&&e.jsx("button",{onClick:()=>v(s=>!s),"data-testid":"document-outline-toggle",className:`px-2 py-0.5 text-[10px] border border-line rounded ${b?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,title:"Toggle document outline",children:"Outline"}),C.length>0&&e.jsx("div",{className:"flex items-center ml-1 rounded border border-line overflow-hidden","data-testid":"document-mode-toggle",children:C.map(s=>e.jsx("button",{onClick:()=>j(s),className:`px-2 py-0.5 text-[10px] capitalize transition-colors ${p===s?"bg-bg-hi text-fg":"text-fg-faint hover:text-fg"}`,children:s},s))})]}),e.jsx("div",{className:"flex-1 min-h-0",children:p==="split"&&x?e.jsxs("div",{className:"flex h-full",children:[b&&e.jsx(L,{text:o,scrollRef:c}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col border-r border-line",children:[!a&&e.jsx(D,{getEditor:S}),e.jsx("div",{className:"flex-1 min-h-0",children:N})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(M,{ref:c,text:o,flush:!0,wideMeasure:f.wideMeasure})})]}):p==="preview"&&x?e.jsxs("div",{className:"flex h-full",children:[b&&e.jsx(L,{text:o,scrollRef:c}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(M,{ref:c,text:o,wideMeasure:f.wideMeasure})})]}):x?e.jsxs("div",{className:"flex flex-col h-full",children:[!a&&e.jsx(D,{getEditor:S}),e.jsx("div",{className:"flex-1 min-h-0",children:N})]}):N}),!y&&e.jsx(Q,{text:o,cursor:w,language:X(t)||void 0})]})}const O={title:"User system prompt",body:"This is the real ~/.claude/CLAUDE.md on disk — the instructions the claude CLI loads into every session it starts on this machine, in every project. A project's own CLAUDE.md / CLAUDE.local.md are read from that project's directory when a session launches there; they are not edited here."};function te(){const t=q(),[o,u]=i.useState("installed"),l=i.useMemo(()=>t?G.resolve("user",t,null):null,[t]),[a,h]=i.useState(null),r=(a==null?void 0:a.path)??l,y=!!a&&(!a.ok||!a.exists),f=g(s=>s.files),x=g(s=>s.loadText),n=g(s=>s.setDraft),d=g(s=>s.saveText),m=g(s=>s.revert),j=g(s=>s.watchFile),b=g(s=>s.unwatchFile);i.useEffect(()=>{if(l)return x(l,!0),j(l),()=>{b(l)}},[l]),i.useEffect(()=>{if(!(!r||r===l))return x(r,!0),j(r),()=>{b(r)}},[r,l]);const[v,w]=i.useState(null),R=i.useCallback(s=>{w(null),h(s)},[]);if(!t)return e.jsx(T,{title:"loading…"});if(o==="library")return e.jsx(U,{toolbar:e.jsx(A,{active:o,onChange:u,installedLabel:"Editor",libraryLabel:"Presets"}),children:e.jsx(W,{})});const E=l?f[l]:null,c=r?f[r]:null,k=(c==null?void 0:c.draftRaw)??"",S=J(k),C=k.length,p=y,N=async()=>{if(!r)return;w(null);const s=await d(r);s.ok||w(s.error??"save failed")};return e.jsx(U,{toolbar:e.jsxs(e.Fragment,{children:[e.jsx(A,{active:o,onChange:u,installedLabel:"Editor",libraryLabel:"Presets"}),e.jsx("span",{className:"mx-2 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:"User scope"}),e.jsx("span",{className:"ml-3 text-fg-faint truncate",children:r??"—"}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-fg-faint",children:[C.toLocaleString()," chars · ~",S.toLocaleString()," tokens"]})]}),footer:r&&c&&!p?e.jsx(K,{dirty:c.dirty,busy:c.busy,parseError:v,lastSavedAt:c.lastSavedAt,leading:c.exists?a?e.jsx("span",{children:"editing an imported file"}):null:e.jsx("span",{children:"file will be created on save"}),onSave:N,onRevert:()=>{w(null),m(r)}}):null,children:l&&E?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{"data-testid":"system-prompt-scope-note",className:"shrink-0 border-b border-line bg-bg-elev px-3 py-2 text-[11.5px] leading-snug",children:[e.jsx("span",{className:"font-semibold text-fg",children:O.title}),e.jsx("span",{className:"mx-1.5 text-fg-faint",children:"·"}),e.jsx("span",{className:"text-fg-dim",children:O.body}),e.jsx("span",{className:"ml-1.5 font-mono text-fg-faint",children:l})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[e.jsx(Z,{activePath:l,selectedPath:r,onSelect:R}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[p&&e.jsx("div",{"data-testid":"system-prompt-missing-note",className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 text-[11px] text-amber-400/90",children:"This import does not resolve to a readable file — the CLI will skip it."}),r&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(ee,{path:r,value:k,readOnly:p,defaultMode:"split",onChange:s=>{w(null),n(r,s)},onSave:()=>{N()}},r)})]})]})]}):e.jsx(T,{title:"resolving…"})})}const ce=i.memo(te);export{ce as SystemPrompt};
@@ -1 +0,0 @@
1
- import{aD as r,V as p,an as e,n as k,aT as w,aU as b,$ as y}from"./index-CPieAFsl.js";import{P}from"./Panel-CQY5zano.js";import{L as $}from"./ListDetail-DcfmxPFk.js";import{u as E,a as v,t as N}from"./useAgentsDirWatch-DCu6BNYN.js";import"./monaco-editor-BsIlgG7c.js";function S(){const[s,i]=r.useState(p[0].tag),[l,g]=r.useState(null),[h,x]=r.useState(!1),c=r.useRef(!0);r.useEffect(()=>()=>{c.current=!1},[]);const f=r.useRef(0),o=async()=>{const t=++f.current;try{const n=await window.api.agents.listPersonas();c.current&&f.current===t&&g(n)}catch(n){if(!c.current||f.current!==t)return;g([]),b.error(n.message||"failed to load agent personas")}};r.useEffect(()=>{o()},[]),r.useEffect(()=>window.api.agents.onChanged(()=>o()),[]),E(null,()=>o());const m=p.find(t=>t.tag===s)??null,a=async(t,n)=>{try{await window.api.agents.savePersona(v(t,{tags:N([...t.tags,n])})),x(!1),await o()}catch(d){b.error(d.message||"failed to assign tag")}},u=async(t,n)=>{try{await window.api.agents.savePersona(v(t,{tags:N(t.tags.filter(d=>d!==n))})),await o()}catch(d){b.error(d.message||"failed to remove tag")}};return e.jsx(P,{toolbar:e.jsxs("span",{className:"text-fg-faint",children:[p.length," tag",p.length===1?"":"s"]}),children:e.jsx($,{sidebar:e.jsx("div",{className:"py-1",children:p.map(t=>{const n=w(t.tag),d=s===t.tag,j=(l==null?void 0:l.filter(T=>T.tags.includes(t.tag)).length)??0;return e.jsxs("button",{onClick:()=>{i(t.tag),x(!1)},className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 ${d?"bg-bg-hi text-fg border-accent":"text-fg-dim hover:text-fg hover:bg-bg-hi border-transparent"}`,children:[e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold ${n.bg} ${n.text} ${n.border?"border border-current/30":""}`,children:["#",t.tag]}),e.jsx("span",{className:"truncate",children:t.label}),j>0&&e.jsx("span",{className:"ml-auto text-[10.5px] text-fg-faint font-mono shrink-0",children:j})]},t.tag)})}),detail:m?e.jsx(C,{entry:m,personas:l,adding:h,setAdding:x,onAssign:a,onUnassign:u}):e.jsx(k,{title:"select a tag"})})})}const q=r.memo(S);function C({entry:s,personas:i,adding:l,setAdding:g,onAssign:h,onUnassign:x}){const c=w(s.tag),f=y(s.tag),o=(i==null?void 0:i.filter(a=>a.tags.includes(s.tag)))??[],m=(i==null?void 0:i.filter(a=>!a.tags.includes(s.tag)))??[];return e.jsxs("div",{className:"p-4 space-y-4 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("span",{className:`px-2 py-1 rounded text-xs font-mono font-semibold ${c.bg} ${c.text} ${c.border?"border border-current/30":""}`,children:["#",s.tag]}),e.jsx("span",{className:"text-sm font-semibold text-fg",children:s.label})]}),e.jsx("div",{className:"text-xs text-fg-dim leading-relaxed",children:s.description}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"/develop eagerness"}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded border border-line text-fg-dim font-mono",children:s.developEagerness})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"develops via"}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded border border-line text-fg-dim font-mono",children:s.developsVia})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"agents carrying this tag"}),i===null?e.jsx("div",{className:"text-xs text-fg-faint italic",children:"loading…"}):e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-bg-elev border border-line rounded px-2 py-0.5 text-[11px] font-mono text-fg-dim",children:[a.name,e.jsx("button",{onClick:()=>x(a,s.tag),title:"Remove this tag from the agent",className:"text-fg-faint hover:text-fg",children:"×"})]},a.name)),o.length===0&&!l&&e.jsx("span",{className:"text-xs text-fg-faint italic mr-1",children:"no agent carries this tag yet."}),l?m.length>0?e.jsxs("select",{autoFocus:!0,defaultValue:"",onChange:a=>{const u=i.find(t=>t.name===a.target.value);u&&h(u,s.tag)},onBlur:()=>g(!1),className:"bg-bg border border-line rounded px-2 py-0.5 text-[11px] text-fg font-mono",children:[e.jsx("option",{value:"",disabled:!0,children:"pick an agent…"}),m.map(a=>e.jsx("option",{value:a.name,children:a.name},a.name))]}):e.jsx("span",{className:"text-xs text-fg-faint italic",children:"every agent already carries this tag."}):e.jsx("button",{onClick:()=>g(!0),className:"px-2 py-0.5 rounded-full text-[11px] font-mono border border-line text-fg-faint hover:text-fg hover:bg-bg-hi",children:"+ assign agent"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10.5px] uppercase tracking-wide text-fg-faint mb-1.5 font-mono",children:"opening framing — sent before the human's goal"}),e.jsx("pre",{className:"text-xs text-fg-dim whitespace-pre-wrap bg-bg-elev border border-line rounded p-3 leading-relaxed font-sans",children:f.initialPromptTemplate})]})]})}export{q as TagLibrary};
@@ -1,39 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:select
3
- description: Step 0 of blog-for-project-feature — confirm exactly ONE project and ONE feature to showcase. Only asks the user when the feature genuinely can't be inferred; otherwise picks the most demo-worthy recently-shipped feature and states why.
4
- ---
5
-
6
- # blog-for-project-feature:select
7
-
8
- ## Input
9
- - The project: current working directory's repo, or a project name/path explicitly given by
10
- the caller.
11
- - Optional: a feature name or hint from the caller ("showcase the click-run screen", "the new
12
- ticker-tracker queue").
13
-
14
- ## Steps
15
-
16
- 1. **Confirm the project.** Read its root `CLAUDE.md`/`README.md`/`AGENTS.md` (whichever
17
- exists) to confirm you're pointed at a real, buildable/runnable project — not an empty or
18
- scaffold-only repo.
19
-
20
- 2. **If a feature was named**, confirm it exists: grep for it in code, routes, or docs. If it
21
- doesn't resolve to anything real, say so and stop rather than guessing at a nearby feature.
22
-
23
- 3. **If no feature was named**, pick one:
24
- - Prefer something with a real UI surface (a screen, a flow, a page) — this skill's whole
25
- value is a click-through demo, so a pure-backend/CLI-only feature is a weak fit unless the
26
- project exposes it through a dashboard.
27
- - Prefer recently shipped (`git log --oneline -20` on the relevant paths) over long-stable —
28
- showcases are most useful for things a reader hasn't seen yet.
29
- - Prefer one coherent flow over a grab-bag of unrelated changes — this produces ONE feature
30
- page, not a changelog.
31
-
32
- 4. **State the justification** in one or two sentences: what the feature is, why it's the right
33
- one to demo right now.
34
-
35
- ## Output
36
-
37
- Hand off to `:research`: confirmed project (path/repo), confirmed feature name, one-line
38
- justification. If no confirmable feature exists, **STOP** and report why instead of forcing a
39
- pick.
@@ -1,37 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:research
3
- description: Step 1 of blog-for-project-feature — ground the project's mission/description and the confirmed feature's description in real docs and code, before any HTML gets written. Flags gaps explicitly instead of inventing claims.
4
- ---
5
-
6
- # blog-for-project-feature:research
7
-
8
- ## Input
9
- Confirmed project + confirmed feature name + justification, from `:select`.
10
-
11
- ## Steps
12
-
13
- 1. **Project mission & description.** Pull from the project's own root docs (`README.md`,
14
- `CLAUDE.md`'s "What this project is" section if it has one, `package.json`/`pyproject.toml`
15
- description field as a fallback). 2-4 sentences, in the project's own words where possible —
16
- don't invent a mission statement it doesn't already have.
17
-
18
- 2. **Feature description.** Locate the actual entry point(s) — route, component, CLI command,
19
- pipeline — and read enough of the real implementation to describe, in plain language:
20
- - what it does (user-facing behavior, not implementation detail)
21
- - why it matters (what it replaces, what it makes possible)
22
- - any real constraint worth knowing (auth required, feature-flagged, still in beta) — surface
23
- these rather than smoothing them over
24
-
25
- 3. **Identify the demo surface.** Note exact URLs/routes, the commands needed to run the app
26
- locally, any seed data / login required to reach the feature — `:storyboard` and `:capture`
27
- need this to actually drive the app.
28
-
29
- 4. **Flag gaps.** If the mission statement doesn't exist, or the feature's purpose isn't
30
- evident from code/docs, say so explicitly in the output rather than filling it in with
31
- plausible-sounding marketing language.
32
-
33
- ## Output
34
-
35
- Hand off to `:storyboard`: mission/description (2-4 sentences), feature description (what/why/
36
- constraints), demo surface (routes, run command, any setup needed to reach the feature), and any
37
- flagged gaps.
@@ -1,64 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:storyboard
3
- description: Step 2 of blog-for-project-feature — turn the feature notes into an ordered, one-aspect-at-a-time sequence of demo steps, each with a planned action, expected screen, and caption. A draft for :capture to execute and correct against reality.
4
- ---
5
-
6
- # blog-for-project-feature:storyboard
7
-
8
- ## Input
9
- Mission/description + feature description + demo surface (routes, run command, setup), from
10
- `:research`.
11
-
12
- ## Steps
13
-
14
- 1. **Break the feature into aspects**, not just clicks. Each storyboard step should reveal ONE
15
- idea — a screen, a state change, a result — not an arbitrary UI action. **5-10 steps** ("swipes")
16
- is the target range; fewer feels thin, more starts diluting the "one aspect at a time" promise.
17
-
18
- 2. **For each step, define:**
19
- - `step`: index + short name (e.g. `2-queue-populated`)
20
- - `action`: the exact interaction to perform to reach this state (navigate to X, click Y,
21
- submit form with Z) — precise enough that `:capture` can execute it without re-deciding
22
- - `expected_screen`: what should be visible when the action completes — this is the
23
- hypothesis `:capture` verifies against the real app
24
- - `capture_scope`: `full_page` or `component` (see the composition recipe below) — plus, when
25
- `component`, which element/region to frame (a CSS selector, ARIA role+name, or plain
26
- description precise enough for `:capture` to target a single element screenshot instead of
27
- the whole viewport)
28
- - `caption`: one sentence, written for the reader of the final page, naming what changed on
29
- screen (not internal mechanics)
30
-
31
- 3. **Compose the sequence with this recipe — authoritative, not a suggestion.** A full-page shot
32
- every step is disorienting (the reader has to re-find the relevant thing each time); an
33
- all-component sequence loses context (the reader forgets where they are in the app). Mix them
34
- deliberately in this arc:
35
- - **Orientation (1 step, `full_page`).** Where the feature lives in the real product — the
36
- screen the reader would actually land on. Establishes context before zooming in.
37
- - **Mechanism (2-5 steps, `component`).** The actual control, interaction, or state change,
38
- cropped/framed to just that component so the reader's eye isn't hunting across a full
39
- screen for what changed. This is the bulk of the demo — most features are *shown* here.
40
- - **Variation or depth (0-2 steps, mixed).** Secondary states, options, or edge cases worth
41
- surfacing. Default to `component`; use `full_page` only if the variation reshapes the whole
42
- screen (a new page, a full dashboard swap) rather than one region of it.
43
- - **Outcome (1-2 steps, `full_page`).** The result landing back in the real product, in
44
- context — proof the feature actually changed something the user will encounter, not just a
45
- component in isolation.
46
-
47
- Decision rule when a step doesn't obviously fit: default to `component` — it isolates the
48
- thing being demonstrated and reads more clearly at small size. Only use `full_page` for
49
- orientation/outcome steps, or when the change genuinely spans the whole viewport (new page,
50
- layout shift, multi-panel result) and a cropped shot would lose the point.
51
-
52
- 4. **Order for narrative sense**: entry point → mechanism → variation → outcome, per the recipe
53
- above. Match `content.demo_interaction` in `feature.config.yaml` (one-step reveal, not a
54
- scroll dump) — so the order IS the reveal sequence.
55
-
56
- 5. **Note any setup steps** needed before step 1 is reachable (login, seed data, feature flag)
57
- — hand these to `:capture` explicitly so it isn't guessing at prerequisites.
58
-
59
- ## Output
60
-
61
- Hand off to `:capture`: the ordered step list (`step`, `action`, `expected_screen`,
62
- `capture_scope`, `caption`) plus any setup/prerequisite steps. This is a draft — `:capture` is
63
- expected to correct captions, adjust `capture_scope` if the planned framing doesn't hold up
64
- against the real screen, or drop steps that don't match what the real app actually shows.
@@ -1,52 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:capture
3
- description: Step 3 of blog-for-project-feature — drive the REAL running app and take a real screenshot per storyboard step. Never fabricates or mocks an image; drops and reports any step it can't actually reach.
4
- ---
5
-
6
- # blog-for-project-feature:capture
7
-
8
- ## Input
9
- Ordered storyboard steps (`step`, `action`, `expected_screen`, `capture_scope`, `caption`) +
10
- setup steps, from `:storyboard`.
11
-
12
- ## Steps
13
-
14
- 1. **Get the app running for real.** Check for an existing project skill that already knows how
15
- to launch it (e.g. a `run` skill) before improvising. If none exists, use the project's own
16
- documented run command from `:research`'s demo surface notes.
17
-
18
- 2. **Execute setup steps first** (login, seed data, navigation to the feature's entry point) —
19
- exactly as specified by `:storyboard`, adjusting only if the real app's actual flow differs
20
- (e.g. a login form field is named differently than assumed).
21
-
22
- 3. **For each storyboard step, in order:**
23
- - Perform the `action` using `mcp__playwright__browser_navigate` /
24
- `browser_click` / `browser_type` / etc.
25
- - Take the screenshot per the step's `capture_scope`:
26
- - `full_page`: `mcp__playwright__browser_take_screenshot` for the full viewport/page.
27
- - `component`: use a `ref`/element target (via `browser_snapshot` to locate the element,
28
- then an element-scoped `browser_take_screenshot`) framed to the specific control or
29
- region the step calls out — not the whole viewport. If the described element can't be
30
- resolved to a single clean region, fall back to `full_page` for that step rather than
31
- guessing at a crop.
32
- - Compare what actually rendered against `expected_screen`. If it matches: keep the step,
33
- correct the caption only if something material differs (a number, a label). If the planned
34
- `capture_scope` doesn't hold up (the "component" is actually two disconnected regions, or a
35
- "full_page" shot is so busy the point gets lost), correct `capture_scope` for that step
36
- before saving. If the step doesn't match `expected_screen` at all (error state, feature not
37
- reachable, requires access you don't have): **drop this step and record why** — do not
38
- screenshot an error page and caption around it, and never substitute a mockup, wireframe, or
39
- hand-drawn image for a missing real one.
40
-
41
- 4. **Save images** per `feature.config.yaml`'s `images` block (format, max width, compression) —
42
- downscale before handing to `:compose`, don't pass raw multi-MB captures through.
43
-
44
- 5. **If a majority of steps drop**, stop and report — the feature isn't in a demoable state
45
- right now; that's a valid outcome to surface to the user, not something to force through with
46
- a thin 1-2 step demo.
47
-
48
- ## Output
49
-
50
- Hand off to `:compose`: for each surviving step, the real image file + final caption; plus an
51
- explicit list of any dropped steps and why. `:compose` must never receive more steps than were
52
- actually captured.
@@ -1,37 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:draft-copy
3
- description: Step 4 of blog-for-project-feature — write the FINAL prose for the Mission and Feature Description sections from research notes + captured steps. This finalized text is what :illustrate reads to generate the companion image, and what :compose drops into the page verbatim.
4
- ---
5
-
6
- # blog-for-project-feature:draft-copy
7
-
8
- ## Input
9
- Mission/description + feature description + any flagged gaps (from `:research`), captured
10
- steps with real captions (from `:capture`).
11
-
12
- ## Steps
13
-
14
- 1. **Write the final Mission & Description** (2-4 sentences) from `:research`'s notes — tighten
15
- for the reader of a feature page, but do not add any claim not already in the notes.
16
-
17
- 2. **Write the final Feature Description** (1-2 short paragraphs) — what it does, why it
18
- matters, any real constraint — grounded the same way.
19
-
20
- 3. **Write one "essence" line** (1 sentence, separate from the two sections above): the single
21
- idea this feature page should leave someone with if they read nothing else. This is not
22
- rendered directly on the page — it's the brief `:illustrate` uses to generate a companion
23
- image, so it should be concrete and visual (name the object/action, not an abstract benefit).
24
- Example: not "streamlines developer workflow" but "a terminal tab holding a live Claude Code
25
- session, sitting next to its sibling tabs."
26
-
27
- 4. **Respect `content.tone`** in `feature.config.yaml` (plain, non-salesy, show-don't-tell) —
28
- same bot-tell blocklist bar as `blog-from-git`.
29
-
30
- 5. **If `:research` flagged a gap** (no documented mission, etc.), keep that gap explicit here
31
- rather than papering over it with invented copy — `:compose` renders the gap-note verbatim.
32
-
33
- ## Output
34
-
35
- Hand off to `:illustrate` and `:compose`: final Mission & Description text, final Feature
36
- Description text, the one-sentence essence line, and captured step captions unchanged from
37
- `:capture`.
@@ -1,50 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:illustrate
3
- description: Step 5 of blog-for-project-feature — generate ONE companion illustration that captures the feature's essence, from the finalized copy (not before it exists). Runs after :draft-copy, before :compose. Skips cleanly (never blocks the pipeline) when no image-generation capability is configured.
4
- ---
5
-
6
- # blog-for-project-feature:illustrate
7
-
8
- Runs strictly **after** `:draft-copy` — the companion image is generated from the finalized
9
- essence line, not from raw research notes, so it actually reflects what the page ends up saying
10
- rather than an earlier draft of it.
11
-
12
- ## Input
13
- The one-sentence "essence" line + final Feature Description, from `:draft-copy`.
14
-
15
- ## Steps
16
-
17
- 1. **Check for an available image-generation capability** before doing anything else, in this
18
- order:
19
- - a project-local generator the target project already has wired up (e.g. Burrow's own
20
- `app/shared/image_gen.py`) — reuse it as-is rather than reimplementing
21
- - otherwise, **default to the Gemini API** (same provider/pattern as Burrow's
22
- `image_gen.py`: `gemini-2.5-flash-image` via `google-genai`) using whatever Gemini API key
23
- is available in the environment (`GEMINI_API_KEY` / `GOOGLE_API_KEY`) — this is the
24
- standard path for projects with no generator of their own yet
25
- - **if no Gemini key or other generator is available, skip this step cleanly** — report "no image-generation capability
26
- available, companion image omitted" and hand `:compose` nothing. This is a valid, expected
27
- outcome on environments without a configured image provider — never block the pipeline on
28
- it, and never substitute a stock photo, icon pack graphic, or hand-placed screenshot as a
29
- stand-in for a generated illustration (that would violate the same no-fabrication rule
30
- `:capture` follows, just for a different image class).
31
-
32
- 2. **If available, generate exactly ONE image** from a prompt built as: the essence line +
33
- `feature.config.yaml`'s `illustration` style tokens (mood/palette/composition) + an explicit
34
- instruction that this is a conceptual/editorial illustration, NOT a UI mockup or screenshot
35
- — it must be visually distinguishable at a glance from the real click-through screenshots
36
- (no fake window chrome, no invented UI text). This distinction matters: `:review` gate 2
37
- checks that nothing generated here could be mistaken for a real captured screen.
38
-
39
- 3. **Save and size** per `feature.config.yaml`'s `illustration` block (format, max dimensions,
40
- compression) — same discipline as `:capture`'s screenshot handling.
41
-
42
- 4. **One regeneration attempt max** if the first result is off-brief (wrong subject, contains
43
- text/UI chrome it shouldn't). If still off after one retry, drop it and report rather than
44
- shipping a confusing image.
45
-
46
- ## Output
47
-
48
- Hand off to `:compose`: either one companion image file (clearly tagged as `kind: illustration`,
49
- distinct from `kind: screenshot` steps from `:capture`), or an explicit "omitted — no generator
50
- available" / "omitted — two attempts off-brief" note.
@@ -1,51 +0,0 @@
1
- ---
2
- name: blog-for-project-feature:compose
3
- description: Step 6 of blog-for-project-feature — assemble the finalized copy, the optional companion illustration, and the captured screenshots into one self-contained, portable, click-through HTML page per feature.config.yaml's theme and output conventions.
4
- ---
5
-
6
- # blog-for-project-feature:compose
7
-
8
- ## Input
9
- Final Mission & Description text + final Feature Description text (from `:draft-copy`),
10
- captured steps with real images and captions (from `:capture`), the companion illustration or
11
- its omission-reason (from `:illustrate`).
12
-
13
- ## Steps
14
-
15
- 1. **Pick output mode** per `feature.config.yaml`: default `single_file` with base64-embedded
16
- images. Estimate total size first (sum of image bytes after downscale/compression, including
17
- the companion illustration if present); if it would exceed `single_file_size_ceiling_mb`, use
18
- the `folder_fallback_layout` instead (html + `screenshots/` dir, relative paths).
19
-
20
- 2. **Build the page**, self-contained (inline `<style>`/`<script>`, no external CDN/font/JS
21
- requests — must work fully offline via `file://`), with exactly the three required sections,
22
- **Click-Through Demo first** — the real screenshots are the most persuasive thing on the page,
23
- so they lead, above the fold, before any prose:
24
- - **Click-Through Demo** — the captured steps rendered as a one-step-at-a-time viewer
25
- (numbered tabs or next/prev buttons — vanilla JS, no framework). Each step's real image
26
- renders on top, full width within the viewer, with its caption directly below it — image
27
- first, caption second, never the reverse. Screenshots only — the illustration never appears
28
- in this section. This section opens the page, immediately above the fold.
29
- - **Project Mission & Description** — the finalized text from `:draft-copy`, verbatim
30
- - **Feature Description** — the finalized text from `:draft-copy`, verbatim. If a companion
31
- illustration exists, place it here as a header/hero image for the section — never inside
32
- the Click-Through Demo viewer, so it's never confusable with a real screenshot
33
- - If `:illustrate` reported an omission, skip the hero image silently (it's an optional
34
- companion, not a required section) — do not note the omission on the page itself
35
-
36
- 3. **Apply theme tokens** from `feature.config.yaml`'s `theme` block (font stack, colors,
37
- radius, max width) — keep it minimal and consistent, this is not a place to freelance a new
38
- visual style per run.
39
-
40
- 4. **Write the file** to `output.path_template` (or the folder fallback), resolving
41
- `{feature-slug}` from the confirmed feature name (kebab-case).
42
-
43
- 5. **If a required section would be empty** (e.g. `:research` flagged a real gap and nothing
44
- was found), do not silently omit it — render it with an explicit note ("mission statement not
45
- documented in this project") so `:review` and the reader both see the gap rather than a
46
- silently thinner page.
47
-
48
- ## Output
49
-
50
- Hand off to `:review`: the path to the composed HTML (or html+folder), the output mode used,
51
- final size, and whether a companion illustration was included.