@chainingintention/pi-web-cn 2.0.0 → 2.202610.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (584) hide show
  1. package/README.md +61 -106
  2. package/dist/.plugins-ready +1 -0
  3. package/dist/cli.js +331 -174
  4. package/dist/cli.js.map +1 -1
  5. package/dist/client/apple-touch-icon-dev.png +0 -0
  6. package/dist/client/assets/PiWebApp-vueV4eKR.js +4938 -0
  7. package/dist/client/assets/classic-CyM97Akm.css +54 -0
  8. package/dist/client/assets/external-B9K8duyP.js +2 -0
  9. package/dist/client/assets/graphite-DquaqFXU.css +54 -0
  10. package/dist/client/assets/index-C8f0d0CR.js +2 -0
  11. package/dist/client/assets/paper-CB1oLuRr.css +54 -0
  12. package/dist/client/assets/pi-web-dark-D_KtbM95.css +54 -0
  13. package/dist/client/assets/pi-web-light-DSNLMIBI.css +54 -0
  14. package/dist/client/assets/vendor-editor-core-BfnHL1Dg.js +10 -0
  15. package/dist/client/assets/vendor-editor-languages-bNquDJP0.js +28 -0
  16. package/dist/client/favicon-dev.svg +8 -0
  17. package/dist/client/index.html +7 -51
  18. package/dist/client/manifest.webmanifest +2 -1
  19. package/dist/client/pwa-icon-dev-192.png +0 -0
  20. package/dist/client/pwa-icon-dev-512.png +0 -0
  21. package/dist/config.js +55 -8
  22. package/dist/config.js.map +1 -1
  23. package/dist/docker/piWebDockerCommandPlan.js +13 -4
  24. package/dist/docker/piWebDockerCommandPlan.js.map +1 -1
  25. package/dist/environment.js +4 -0
  26. package/dist/environment.js.map +1 -0
  27. package/dist/localization.js +24 -0
  28. package/dist/localization.js.map +1 -0
  29. package/dist/nativeServices/installedServiceDefinitions.js +617 -0
  30. package/dist/nativeServices/installedServiceDefinitions.js.map +1 -0
  31. package/dist/nativeServices/serviceAction.js +78 -20
  32. package/dist/nativeServices/serviceAction.js.map +1 -1
  33. package/dist/nativeServices/serviceDoctor.js +418 -114
  34. package/dist/nativeServices/serviceDoctor.js.map +1 -1
  35. package/dist/nativeServices/servicePlan.js +2 -2
  36. package/dist/nativeServices/servicePlan.js.map +1 -1
  37. package/dist/pi-packages/captains-log/README.md +11 -0
  38. package/dist/pi-packages/captains-log/dist/browser/channelProtocol.js +29 -0
  39. package/dist/pi-packages/captains-log/dist/browser/index.js +143 -0
  40. package/dist/pi-packages/captains-log/dist/browser/markdown.js +68 -0
  41. package/dist/pi-packages/captains-log/dist/browser/panel.js +148 -0
  42. package/dist/pi-packages/captains-log/dist/browser/protocol.js +26 -0
  43. package/dist/pi-packages/captains-log/dist/companion.js +126 -0
  44. package/dist/pi-packages/captains-log/dist/roundtrip.js +62 -0
  45. package/dist/pi-packages/captains-log/dist/server.js +210 -0
  46. package/dist/pi-packages/captains-log/dist/store.js +75 -0
  47. package/dist/pi-packages/captains-log/docs/usage.md +29 -0
  48. package/dist/pi-packages/captains-log/i18n.js +7 -0
  49. package/dist/pi-packages/captains-log/package.json +35 -0
  50. package/dist/pi-packages/captains-log/tsconfig.json +21 -0
  51. package/dist/pi-packages/captains-log/vite.config.mjs +28 -0
  52. package/dist/pi-packages/relays/extensions/index.js +61 -0
  53. package/dist/pi-packages/relays/i18n.js +7 -0
  54. package/dist/{pi-web-plugins → pi-packages}/relays/markdownDocument.js +3 -2
  55. package/dist/pi-packages/relays/package.json +20 -0
  56. package/dist/pi-packages/relays/pi-web-plugin.js +96 -0
  57. package/dist/pi-packages/relays/prompts/relay-worktree.md +18 -0
  58. package/dist/pi-packages/relays/prompts/relay.md +18 -0
  59. package/dist/{pi-web-plugins → pi-packages}/relays/relayDiscovery.js +2 -2
  60. package/dist/pi-packages/relays/relayDispatch.js +67 -0
  61. package/dist/pi-packages/relays/relayIdentity.js +37 -0
  62. package/dist/{pi-web-plugins → pi-packages}/relays/relaysPanelElement.js +98 -59
  63. package/dist/pi-packages/relays/skills/relay/SKILL.md +50 -0
  64. package/dist/pi-packages/relays/skills/relay-runner/SKILL.md +74 -0
  65. package/dist/pi-packages/workflows/browser/pi-web-plugin.js +42 -0
  66. package/dist/pi-packages/workflows/browser/worktreeDialog.js +170 -0
  67. package/dist/pi-packages/workflows/package.json +23 -0
  68. package/dist/pi-packages/workflows/prompts/worktree.md +21 -0
  69. package/dist/pi-packages/workflows/server-plugin.js +586 -0
  70. package/dist/pi-packages/workflows/vite.config.mjs +17 -0
  71. package/dist/pi-web-plugins/code-highlight/browser/pi-web-plugin.js +22 -0
  72. package/dist/pi-web-plugins/code-highlight/package.json +13 -0
  73. package/dist/pi-web-plugins/files/browser/assets/files-icon-DZObYhxb.svg +3 -0
  74. package/dist/pi-web-plugins/files/browser/pi-web-plugin.js +466 -0
  75. package/dist/pi-web-plugins/files/package.json +15 -0
  76. package/dist/pi-web-plugins/git/browser/git-contract.js +22 -11
  77. package/dist/pi-web-plugins/git/browser/git-panel.js +228 -100
  78. package/dist/pi-web-plugins/git/browser/i18n.js +7 -0
  79. package/dist/pi-web-plugins/git/browser/pi-web-plugin.js +28 -4
  80. package/dist/pi-web-plugins/git/git-backend.js +61 -21
  81. package/dist/pi-web-plugins/git/gitStatusCache.js +48 -0
  82. package/dist/pi-web-plugins/git/i18n.js +7 -0
  83. package/dist/pi-web-plugins/git/package.json +1 -0
  84. package/dist/pi-web-plugins/git/server-plugin.js +45 -24
  85. package/dist/pi-web-plugins/git/workspace-discovery-notify.cjs +14 -0
  86. package/dist/pi-web-plugins/git/workspaceDiscoveryHooks.js +186 -0
  87. package/dist/pi-web-plugins/info/i18n.js +7 -0
  88. package/dist/pi-web-plugins/info/infoInternals.js +76 -65
  89. package/dist/pi-web-plugins/info/package.json +1 -1
  90. package/dist/pi-web-plugins/info/pi-web-plugin.js +40 -42
  91. package/dist/pi-web-plugins/mermaid/browser/mermaid-engine.js +4255 -0
  92. package/dist/pi-web-plugins/mermaid/browser/pi-web-plugin.js +11 -0
  93. package/dist/pi-web-plugins/mermaid/package.json +13 -0
  94. package/dist/pi-web-plugins/terminal/browser/pi-web-plugin.js +219 -0
  95. package/dist/pi-web-plugins/terminal/i18n.js +7 -0
  96. package/dist/pi-web-plugins/terminal/package.json +16 -0
  97. package/dist/pi-web-plugins/terminal/server-plugin.js +367 -0
  98. package/dist/pi-web-plugins/terminal/terminalService.js +436 -0
  99. package/dist/pi-web-plugins/updates/i18n.js +7 -0
  100. package/dist/pi-web-plugins/updates/package.json +1 -1
  101. package/dist/pi-web-plugins/updates/pi-web-plugin.js +143 -140
  102. package/dist/pi-web-plugins/updates/updatesLogic.js +24 -24
  103. package/dist/pi-web-plugins/workspace-tasks/config.js +12 -11
  104. package/dist/pi-web-plugins/workspace-tasks/i18n.js +7 -0
  105. package/dist/pi-web-plugins/workspace-tasks/package.json +1 -1
  106. package/dist/pi-web-plugins/workspace-tasks/pi-web-plugin.js +31 -9
  107. package/dist/pi-web-plugins/workspace-tasks/tasksPanelElement.js +54 -36
  108. package/dist/pi-web-plugins/workspace-tasks/workspaceTasksClient.js +12 -11
  109. package/dist/pi-web-plugins/zh-cn/auth.json +9 -0
  110. package/dist/pi-web-plugins/zh-cn/bundled.json +219 -0
  111. package/dist/pi-web-plugins/zh-cn/cli.json +230 -0
  112. package/dist/pi-web-plugins/zh-cn/client.json +225 -0
  113. package/dist/pi-web-plugins/zh-cn/components.json +1252 -0
  114. package/dist/pi-web-plugins/zh-cn/config-errors.json +188 -0
  115. package/dist/pi-web-plugins/zh-cn/files.json +50 -0
  116. package/dist/pi-web-plugins/zh-cn/machines.json +28 -0
  117. package/dist/pi-web-plugins/zh-cn/main.json +459 -0
  118. package/dist/pi-web-plugins/zh-cn/management-errors.json +23 -0
  119. package/dist/pi-web-plugins/zh-cn/manifest.webmanifest +25 -0
  120. package/dist/pi-web-plugins/zh-cn/metadata.json +3 -0
  121. package/dist/pi-web-plugins/zh-cn/package.json +10 -0
  122. package/dist/pi-web-plugins/zh-cn/pi-web-plugin.js +16 -0
  123. package/dist/pi-web-plugins/zh-cn/projects.json +6 -0
  124. package/dist/pi-web-plugins/zh-cn/provider-auth.json +18 -0
  125. package/dist/pi-web-plugins/zh-cn/routing.json +68 -0
  126. package/dist/pi-web-plugins/zh-cn/server-main.json +99 -0
  127. package/dist/pi-web-plugins/zh-cn/server.json +256 -0
  128. package/dist/piAi.js +4 -0
  129. package/dist/piAi.js.map +1 -0
  130. package/dist/piRuntime.js +150 -0
  131. package/dist/piRuntime.js.map +1 -0
  132. package/dist/piSdk.js +5 -0
  133. package/dist/piSdk.js.map +1 -0
  134. package/dist/piWebUpdate.js +508 -0
  135. package/dist/piWebUpdate.js.map +1 -0
  136. package/dist/piWebVersionReport.js +109 -41
  137. package/dist/piWebVersionReport.js.map +1 -1
  138. package/dist/plugin-api.d.ts +609 -29
  139. package/dist/plugin-api.js +1 -0
  140. package/dist/pluginRecoveryCli.js +27 -25
  141. package/dist/pluginRecoveryCli.js.map +1 -1
  142. package/dist/server/activity/workspaceActivityService.js +13 -6
  143. package/dist/server/activity/workspaceActivityService.js.map +1 -1
  144. package/dist/server/app.js +158 -89
  145. package/dist/server/app.js.map +1 -1
  146. package/dist/server/audit/managementAuditStore.js +6 -1
  147. package/dist/server/audit/managementAuditStore.js.map +1 -1
  148. package/dist/server/audit/normalToolAuditCli.js +45 -43
  149. package/dist/server/audit/normalToolAuditCli.js.map +1 -1
  150. package/dist/server/browserMessageProjection.js +39 -22
  151. package/dist/server/browserMessageProjection.js.map +1 -1
  152. package/dist/server/configRoutes.js +54 -33
  153. package/dist/server/configRoutes.js.map +1 -1
  154. package/dist/server/deploymentIdentity.js +67 -0
  155. package/dist/server/deploymentIdentity.js.map +1 -0
  156. package/dist/server/deploymentIdentityRoutes.js +22 -0
  157. package/dist/server/deploymentIdentityRoutes.js.map +1 -0
  158. package/dist/server/diagnostics/nodePtyNativeModule.js +7 -6
  159. package/dist/server/diagnostics/nodePtyNativeModule.js.map +1 -1
  160. package/dist/server/diagnostics/nodePtySpawnHelper.js +21 -20
  161. package/dist/server/diagnostics/nodePtySpawnHelper.js.map +1 -1
  162. package/dist/server/index.js +10 -1
  163. package/dist/server/index.js.map +1 -1
  164. package/dist/server/knownAutoInstallPiPackages.js +36 -0
  165. package/dist/server/knownAutoInstallPiPackages.js.map +1 -0
  166. package/dist/server/knownPiPackages.js +12 -0
  167. package/dist/server/knownPiPackages.js.map +1 -0
  168. package/dist/server/machines/machineClient.js +23 -19
  169. package/dist/server/machines/machineClient.js.map +1 -1
  170. package/dist/server/machines/machinePluginProxyRoutes.js +131 -31
  171. package/dist/server/machines/machinePluginProxyRoutes.js.map +1 -1
  172. package/dist/server/machines/machineProxyRoutes.js +138 -47
  173. package/dist/server/machines/machineProxyRoutes.js.map +1 -1
  174. package/dist/server/machines/machineRoutes.js +18 -13
  175. package/dist/server/machines/machineRoutes.js.map +1 -1
  176. package/dist/server/machines/machineService.js +40 -18
  177. package/dist/server/machines/machineService.js.map +1 -1
  178. package/dist/server/managementEmbed.js +149 -30
  179. package/dist/server/managementEmbed.js.map +1 -1
  180. package/dist/server/managementPrivileges.js +21 -0
  181. package/dist/server/managementPrivileges.js.map +1 -0
  182. package/dist/server/managementTerminalProxyRoutes.js +124 -0
  183. package/dist/server/managementTerminalProxyRoutes.js.map +1 -0
  184. package/dist/server/navigationPreferenceRoutes.js +59 -0
  185. package/dist/server/navigationPreferenceRoutes.js.map +1 -0
  186. package/dist/server/normalAuth.js +77 -53
  187. package/dist/server/normalAuth.js.map +1 -1
  188. package/dist/server/notices/serverNoticeRoutes.js +43 -0
  189. package/dist/server/notices/serverNoticeRoutes.js.map +1 -0
  190. package/dist/server/notices/serverNoticeService.js +26 -0
  191. package/dist/server/notices/serverNoticeService.js.map +1 -0
  192. package/dist/server/notices/serverNoticeStore.js +122 -0
  193. package/dist/server/notices/serverNoticeStore.js.map +1 -0
  194. package/dist/server/passwordVerifier.js +91 -0
  195. package/dist/server/passwordVerifier.js.map +1 -0
  196. package/dist/server/piPackageIdentity.js +25 -0
  197. package/dist/server/piPackageIdentity.js.map +1 -0
  198. package/dist/server/piPackageService.js +72 -9
  199. package/dist/server/piPackageService.js.map +1 -1
  200. package/dist/server/piWebPluginCatalog.js +212 -35
  201. package/dist/server/piWebPluginCatalog.js.map +1 -1
  202. package/dist/server/piWebPluginLifecycle.js +29 -3
  203. package/dist/server/piWebPluginLifecycle.js.map +1 -1
  204. package/dist/server/piWebPluginService.js +199 -292
  205. package/dist/server/piWebPluginService.js.map +1 -1
  206. package/dist/server/piWebStatus.js +57 -100
  207. package/dist/server/piWebStatus.js.map +1 -1
  208. package/dist/server/pluginCallbackDrain.js +35 -0
  209. package/dist/server/pluginCallbackDrain.js.map +1 -0
  210. package/dist/server/plugins/pluginBackendChannelProxyAdmission.js +84 -0
  211. package/dist/server/plugins/pluginBackendChannelProxyAdmission.js.map +1 -0
  212. package/dist/server/plugins/pluginBackendChannelProxyCoordinator.js +234 -0
  213. package/dist/server/plugins/pluginBackendChannelProxyCoordinator.js.map +1 -0
  214. package/dist/server/plugins/pluginBackendChannelProxyRoutes.js +61 -0
  215. package/dist/server/plugins/pluginBackendChannelProxyRoutes.js.map +1 -0
  216. package/dist/server/plugins/pluginBackendProxyRoutes.js +47 -57
  217. package/dist/server/plugins/pluginBackendProxyRoutes.js.map +1 -1
  218. package/dist/server/plugins/pluginBackendRegistry.js +804 -0
  219. package/dist/server/plugins/pluginBackendRegistry.js.map +1 -0
  220. package/dist/server/plugins/projectPluginSettings.js +95 -0
  221. package/dist/server/plugins/projectPluginSettings.js.map +1 -0
  222. package/dist/server/plugins/serverPluginCatalogCapability.js +106 -0
  223. package/dist/server/plugins/serverPluginCatalogCapability.js.map +1 -0
  224. package/dist/server/plugins/serverPluginPiSessionEventsCapability.js +34 -0
  225. package/dist/server/plugins/serverPluginPiSessionEventsCapability.js.map +1 -0
  226. package/dist/server/plugins/serverPluginPiSessionsCapability.js +185 -0
  227. package/dist/server/plugins/serverPluginPiSessionsCapability.js.map +1 -0
  228. package/dist/server/plugins/serverPluginRuntime.js +1088 -108
  229. package/dist/server/plugins/serverPluginRuntime.js.map +1 -1
  230. package/dist/server/plugins/serverPluginWorkspacesCapability.js +114 -0
  231. package/dist/server/plugins/serverPluginWorkspacesCapability.js.map +1 -0
  232. package/dist/server/projectTrustRoutes.js +86 -0
  233. package/dist/server/projectTrustRoutes.js.map +1 -0
  234. package/dist/server/projects/projectLifecycleService.js +94 -0
  235. package/dist/server/projects/projectLifecycleService.js.map +1 -0
  236. package/dist/server/projects/projectService.js +7 -4
  237. package/dist/server/projects/projectService.js.map +1 -1
  238. package/dist/server/realtime/sessionEventHub.js +58 -39
  239. package/dist/server/realtime/sessionEventHub.js.map +1 -1
  240. package/dist/server/realtime/sessionEventScope.js +4 -0
  241. package/dist/server/realtime/sessionEventScope.js.map +1 -1
  242. package/dist/server/requestCancellation.js +15 -1
  243. package/dist/server/requestCancellation.js.map +1 -1
  244. package/dist/server/sessiond/agentHttpDispatcher.js +108 -0
  245. package/dist/server/sessiond/agentHttpDispatcher.js.map +1 -0
  246. package/dist/server/sessiond/autoInstallPiPackages.js +63 -0
  247. package/dist/server/sessiond/autoInstallPiPackages.js.map +1 -0
  248. package/dist/server/sessiond/pluginBackendChannelRoutes.js +410 -0
  249. package/dist/server/sessiond/pluginBackendChannelRoutes.js.map +1 -0
  250. package/dist/server/sessiond/pluginBackendRoutes.js +64 -47
  251. package/dist/server/sessiond/pluginBackendRoutes.js.map +1 -1
  252. package/dist/server/sessiond/pluginCatalogRoutes.js +41 -0
  253. package/dist/server/sessiond/pluginCatalogRoutes.js.map +1 -0
  254. package/dist/server/sessiond/projectMutationRoutes.js +39 -0
  255. package/dist/server/sessiond/projectMutationRoutes.js.map +1 -0
  256. package/dist/server/sessiond/sessionDaemonShutdown.js +36 -0
  257. package/dist/server/sessiond/sessionDaemonShutdown.js.map +1 -0
  258. package/dist/server/sessiond/sessionDaemonStartup.js +30 -4
  259. package/dist/server/sessiond/sessionDaemonStartup.js.map +1 -1
  260. package/dist/server/sessiond/sessionProxyRoutes.js +263 -91
  261. package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
  262. package/dist/server/sessiond/sessionServiceDependencies.js +5 -0
  263. package/dist/server/sessiond/sessionServiceDependencies.js.map +1 -1
  264. package/dist/server/sessiond/sessiondStateOwnership.js +174 -39
  265. package/dist/server/sessiond/sessiondStateOwnership.js.map +1 -1
  266. package/dist/server/sessiond/workspaceCatalogRoutes.js +11 -5
  267. package/dist/server/sessiond/workspaceCatalogRoutes.js.map +1 -1
  268. package/dist/server/sessiond/workspaceNotificationRoutes.js +55 -0
  269. package/dist/server/sessiond/workspaceNotificationRoutes.js.map +1 -0
  270. package/dist/server/sessiond/workspaceRemovalRoutes.js +1 -1
  271. package/dist/server/sessiond/workspaceRemovalRoutes.js.map +1 -1
  272. package/dist/server/sessiond.js +313 -69
  273. package/dist/server/sessiond.js.map +1 -1
  274. package/dist/server/sessions/askUserDomain.js +232 -0
  275. package/dist/server/sessions/askUserDomain.js.map +1 -0
  276. package/dist/server/sessions/askUserTool.js +18 -21
  277. package/dist/server/sessions/askUserTool.js.map +1 -1
  278. package/dist/server/sessions/attachmentService.js +2 -6
  279. package/dist/server/sessions/attachmentService.js.map +1 -1
  280. package/dist/server/sessions/authRoutes.js +32 -19
  281. package/dist/server/sessions/authRoutes.js.map +1 -1
  282. package/dist/server/sessions/authService.js +31 -11
  283. package/dist/server/sessions/authService.js.map +1 -1
  284. package/dist/server/sessions/builtinCommands.js +28 -21
  285. package/dist/server/sessions/builtinCommands.js.map +1 -1
  286. package/dist/server/sessions/builtinExtensionFactories.js +36 -0
  287. package/dist/server/sessions/builtinExtensionFactories.js.map +1 -0
  288. package/dist/server/sessions/clientSessionPreview.js +14 -0
  289. package/dist/server/sessions/clientSessionPreview.js.map +1 -0
  290. package/dist/server/sessions/companionBackend.js +286 -0
  291. package/dist/server/sessions/companionBackend.js.map +1 -0
  292. package/dist/server/sessions/dockerEnvironmentFacts.js +98 -10
  293. package/dist/server/sessions/dockerEnvironmentFacts.js.map +1 -1
  294. package/dist/server/sessions/extensionSessionDispatch.js +76 -0
  295. package/dist/server/sessions/extensionSessionDispatch.js.map +1 -0
  296. package/dist/server/sessions/globalProviderPolicy.js +88 -19
  297. package/dist/server/sessions/globalProviderPolicy.js.map +1 -1
  298. package/dist/server/sessions/managementAgentTools.js +116 -6
  299. package/dist/server/sessions/managementAgentTools.js.map +1 -1
  300. package/dist/server/sessions/managementPermissionSystem.js +36 -14
  301. package/dist/server/sessions/managementPermissionSystem.js.map +1 -1
  302. package/dist/server/sessions/managementSandbox.js +7 -18
  303. package/dist/server/sessions/managementSandbox.js.map +1 -1
  304. package/dist/server/sessions/mcpAuthFlowService.js +289 -0
  305. package/dist/server/sessions/mcpAuthFlowService.js.map +1 -0
  306. package/dist/server/sessions/mcpAuthRoutes.js +104 -0
  307. package/dist/server/sessions/mcpAuthRoutes.js.map +1 -0
  308. package/dist/server/sessions/mcpOAuthCredentialAdapter.js +92 -0
  309. package/dist/server/sessions/mcpOAuthCredentialAdapter.js.map +1 -0
  310. package/dist/server/sessions/messageHistoryTarget.js +79 -0
  311. package/dist/server/sessions/messageHistoryTarget.js.map +1 -0
  312. package/dist/server/sessions/messagePaging.js +2 -2
  313. package/dist/server/sessions/messagePaging.js.map +1 -1
  314. package/dist/server/sessions/modelCatalogRefresher.js +4 -3
  315. package/dist/server/sessions/modelCatalogRefresher.js.map +1 -1
  316. package/dist/server/sessions/oauthLoginFlowService.js +19 -20
  317. package/dist/server/sessions/oauthLoginFlowService.js.map +1 -1
  318. package/dist/server/sessions/piSessionEventConnections.js +68 -0
  319. package/dist/server/sessions/piSessionEventConnections.js.map +1 -0
  320. package/dist/server/sessions/piSessionManagerGateway.js +206 -27
  321. package/dist/server/sessions/piSessionManagerGateway.js.map +1 -1
  322. package/dist/server/sessions/piSessionService.js +2508 -991
  323. package/dist/server/sessions/piSessionService.js.map +1 -1
  324. package/dist/server/sessions/plainTextTheme.js +1 -1
  325. package/dist/server/sessions/plainTextTheme.js.map +1 -1
  326. package/dist/server/sessions/projectAuthService.js +35 -6
  327. package/dist/server/sessions/projectAuthService.js.map +1 -1
  328. package/dist/server/sessions/projectSettingsScope.js +88 -33
  329. package/dist/server/sessions/projectSettingsScope.js.map +1 -1
  330. package/dist/server/sessions/projectTrust.js +119 -0
  331. package/dist/server/sessions/projectTrust.js.map +1 -0
  332. package/dist/server/sessions/queuedMessageMutation.js +170 -0
  333. package/dist/server/sessions/queuedMessageMutation.js.map +1 -0
  334. package/dist/server/sessions/relaySkill.js +169 -0
  335. package/dist/server/sessions/relaySkill.js.map +1 -0
  336. package/dist/server/sessions/sessionActivityMarker.js +105 -0
  337. package/dist/server/sessions/sessionActivityMarker.js.map +1 -0
  338. package/dist/server/sessions/sessionArchiveMapping.js +16 -15
  339. package/dist/server/sessions/sessionArchiveMapping.js.map +1 -1
  340. package/dist/server/sessions/sessionArchiveStore.js +5 -1
  341. package/dist/server/sessions/sessionArchiveStore.js.map +1 -1
  342. package/dist/server/sessions/sessionArchiveTree.js +2 -2
  343. package/dist/server/sessions/sessionArchiveTree.js.map +1 -1
  344. package/dist/server/sessions/sessionCleanup.js +4 -3
  345. package/dist/server/sessions/sessionCleanup.js.map +1 -1
  346. package/dist/server/sessions/sessionCommandService.js +79 -87
  347. package/dist/server/sessions/sessionCommandService.js.map +1 -1
  348. package/dist/server/sessions/sessionEnvironmentFacts.js +5 -4
  349. package/dist/server/sessions/sessionEnvironmentFacts.js.map +1 -1
  350. package/dist/server/sessions/sessionFileHeader.js +41 -0
  351. package/dist/server/sessions/sessionFileHeader.js.map +1 -1
  352. package/dist/server/sessions/sessionImageDimensions.js +31 -0
  353. package/dist/server/sessions/sessionImageDimensions.js.map +1 -0
  354. package/dist/server/sessions/sessionMediaIndex.js +191 -0
  355. package/dist/server/sessions/sessionMediaIndex.js.map +1 -0
  356. package/dist/server/sessions/sessionMetadata.js +51 -0
  357. package/dist/server/sessions/sessionMetadata.js.map +1 -0
  358. package/dist/server/sessions/sessionModelScope.js +160 -0
  359. package/dist/server/sessions/sessionModelScope.js.map +1 -0
  360. package/dist/server/sessions/sessionNameGenerator.js +16 -35
  361. package/dist/server/sessions/sessionNameGenerator.js.map +1 -1
  362. package/dist/server/sessions/sessionNotificationStore.js +14 -11
  363. package/dist/server/sessions/sessionNotificationStore.js.map +1 -1
  364. package/dist/server/sessions/sessionReadAccess.js +41 -0
  365. package/dist/server/sessions/sessionReadAccess.js.map +1 -0
  366. package/dist/server/sessions/sessionRoutes.js +221 -78
  367. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  368. package/dist/server/sessions/sessionSummaryScanner.js +62 -5
  369. package/dist/server/sessions/sessionSummaryScanner.js.map +1 -1
  370. package/dist/server/sessions/sessionTreeProjection.js +50 -49
  371. package/dist/server/sessions/sessionTreeProjection.js.map +1 -1
  372. package/dist/server/sessions/sessionUiEvents.js +22 -10
  373. package/dist/server/sessions/sessionUiEvents.js.map +1 -1
  374. package/dist/server/sessions/sessionUnreadStore.js +53 -3
  375. package/dist/server/sessions/sessionUnreadStore.js.map +1 -1
  376. package/dist/server/sessions/spawnSessionTool.js +14 -6
  377. package/dist/server/sessions/spawnSessionTool.js.map +1 -1
  378. package/dist/server/sessions/spawnSubsessionTool.js +40 -24
  379. package/dist/server/sessions/spawnSubsessionTool.js.map +1 -1
  380. package/dist/server/sessions/spawnTargetResolver.js +1 -1
  381. package/dist/server/sessions/subsessionCompletionDelivery.js +15 -0
  382. package/dist/server/sessions/subsessionCompletionDelivery.js.map +1 -0
  383. package/dist/server/sessions/subsessionCompletionInbox.js +134 -0
  384. package/dist/server/sessions/subsessionCompletionInbox.js.map +1 -0
  385. package/dist/server/sessions/subsessionProvenance.js +27 -0
  386. package/dist/server/sessions/subsessionProvenance.js.map +1 -0
  387. package/dist/server/sessions/transcriptBranchCache.js +81 -0
  388. package/dist/server/sessions/transcriptBranchCache.js.map +1 -0
  389. package/dist/server/sessions/transcriptMarkdown.js +48 -0
  390. package/dist/server/sessions/transcriptMarkdown.js.map +1 -0
  391. package/dist/server/sessions/transcriptMessages.js +57 -0
  392. package/dist/server/sessions/transcriptMessages.js.map +1 -0
  393. package/dist/server/startupLogger.js +13 -0
  394. package/dist/server/startupLogger.js.map +1 -0
  395. package/dist/server/startupUrls.js +27 -0
  396. package/dist/server/startupUrls.js.map +1 -0
  397. package/dist/server/status/machineStatusService.js +15 -7
  398. package/dist/server/status/machineStatusService.js.map +1 -1
  399. package/dist/server/storage/navigationPreferenceStore.js +138 -0
  400. package/dist/server/storage/navigationPreferenceStore.js.map +1 -0
  401. package/dist/server/storage/piPackageDismissalStore.js +78 -0
  402. package/dist/server/storage/piPackageDismissalStore.js.map +1 -0
  403. package/dist/server/terminals/{terminalService.js → managementCommandRunService.js} +98 -102
  404. package/dist/server/terminals/managementCommandRunService.js.map +1 -0
  405. package/dist/server/terminals/managementTerminalRoutes.js +91 -0
  406. package/dist/server/terminals/managementTerminalRoutes.js.map +1 -0
  407. package/dist/server/terminals/requiredTerminalService.js +103 -0
  408. package/dist/server/terminals/requiredTerminalService.js.map +1 -0
  409. package/dist/server/webSocketBridge.js +348 -0
  410. package/dist/server/webSocketBridge.js.map +1 -1
  411. package/dist/server/workbench/accessStateStore.js +33 -5
  412. package/dist/server/workbench/accessStateStore.js.map +1 -1
  413. package/dist/server/workbench/capabilitySearch.js +3 -2
  414. package/dist/server/workbench/capabilitySearch.js.map +1 -1
  415. package/dist/server/workbench/gatewayIntegration.js +40 -13
  416. package/dist/server/workbench/gatewayIntegration.js.map +1 -1
  417. package/dist/server/workbench/knowledgeSearch.js +100 -0
  418. package/dist/server/workbench/knowledgeSearch.js.map +1 -0
  419. package/dist/server/workbench/mcpClient.js +41 -8
  420. package/dist/server/workbench/mcpClient.js.map +1 -1
  421. package/dist/server/workbench/skillSync.js +11 -3
  422. package/dist/server/workbench/skillSync.js.map +1 -1
  423. package/dist/server/workbench/workbenchClient.js +130 -7
  424. package/dist/server/workbench/workbenchClient.js.map +1 -1
  425. package/dist/server/workbench/workbenchTools.js +196 -14
  426. package/dist/server/workbench/workbenchTools.js.map +1 -1
  427. package/dist/server/workingDirectory.js +3 -2
  428. package/dist/server/workingDirectory.js.map +1 -1
  429. package/dist/server/workspaceExplorerRoutes.js +53 -21
  430. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  431. package/dist/server/workspaces/fileContentService.js +31 -16
  432. package/dist/server/workspaces/fileContentService.js.map +1 -1
  433. package/dist/server/workspaces/fileOperationService.js +11 -9
  434. package/dist/server/workspaces/fileOperationService.js.map +1 -1
  435. package/dist/server/workspaces/filePreviewService.js +10 -6
  436. package/dist/server/workspaces/filePreviewService.js.map +1 -1
  437. package/dist/server/workspaces/fileSuggestions.js +77 -10
  438. package/dist/server/workspaces/fileSuggestions.js.map +1 -1
  439. package/dist/server/workspaces/fileTreeService.js +103 -15
  440. package/dist/server/workspaces/fileTreeService.js.map +1 -1
  441. package/dist/server/workspaces/normalProjectCwdResolver.js +35 -0
  442. package/dist/server/workspaces/normalProjectCwdResolver.js.map +1 -0
  443. package/dist/server/workspaces/pathAccessPolicy.js +24 -18
  444. package/dist/server/workspaces/pathAccessPolicy.js.map +1 -1
  445. package/dist/server/workspaces/pathSafety.js +6 -5
  446. package/dist/server/workspaces/pathSafety.js.map +1 -1
  447. package/dist/server/workspaces/projectPiWebConfig.js +95 -8
  448. package/dist/server/workspaces/projectPiWebConfig.js.map +1 -1
  449. package/dist/server/workspaces/projectWorkspaceCwds.js +0 -5
  450. package/dist/server/workspaces/projectWorkspaceCwds.js.map +1 -1
  451. package/dist/server/workspaces/sessionDaemonWorkspaceCatalog.js +37 -22
  452. package/dist/server/workspaces/sessionDaemonWorkspaceCatalog.js.map +1 -1
  453. package/dist/server/workspaces/workspaceCatalog.js +6 -4
  454. package/dist/server/workspaces/workspaceCatalog.js.map +1 -1
  455. package/dist/server/workspaces/workspaceChangeNotifier.js +12 -0
  456. package/dist/server/workspaces/workspaceChangeNotifier.js.map +1 -0
  457. package/dist/server/workspaces/workspaceDeletionRoutes.js +9 -70
  458. package/dist/server/workspaces/workspaceDeletionRoutes.js.map +1 -1
  459. package/dist/server/workspaces/workspaceNotificationCommand.js +64 -0
  460. package/dist/server/workspaces/workspaceNotificationCommand.js.map +1 -0
  461. package/dist/server/workspaces/workspaceProviderRegistry.js +128 -24
  462. package/dist/server/workspaces/workspaceProviderRegistry.js.map +1 -1
  463. package/dist/server/workspaces/workspaceRemovalService.js +41 -7
  464. package/dist/server/workspaces/workspaceRemovalService.js.map +1 -1
  465. package/dist/server/workspaces/workspaceRouteContext.js +1 -1
  466. package/dist/server/workspaces/workspaceRouteContext.js.map +1 -1
  467. package/dist/server/workspaces/workspaceRouteErrors.js +4 -2
  468. package/dist/server/workspaces/workspaceRouteErrors.js.map +1 -1
  469. package/dist/server/workspaces/workspaceUserError.js +18 -0
  470. package/dist/server/workspaces/workspaceUserError.js.map +1 -0
  471. package/dist/server-plugin-api.d.ts +349 -49
  472. package/dist/server-plugin-api.js +344 -2
  473. package/dist/server-plugin-api.js.map +1 -1
  474. package/dist/serverPluginRecovery.js +6 -1
  475. package/dist/serverPluginRecovery.js.map +1 -1
  476. package/dist/sessiond/activeAgentProfile.js +27 -2
  477. package/dist/sessiond/activeAgentProfile.js.map +1 -1
  478. package/dist/sessiond/config.js +4 -3
  479. package/dist/sessiond/config.js.map +1 -1
  480. package/dist/sessiond/sessionDaemonClient.js +75 -19
  481. package/dist/sessiond/sessionDaemonClient.js.map +1 -1
  482. package/dist/sessiond/sessionDaemonErrors.js +49 -0
  483. package/dist/sessiond/sessionDaemonErrors.js.map +1 -0
  484. package/dist/shared/activeAgentProfile.js +2 -34
  485. package/dist/shared/activeAgentProfile.js.map +1 -1
  486. package/dist/shared/activity.js +0 -3
  487. package/dist/shared/activity.js.map +1 -1
  488. package/dist/shared/apiTypes.js +10 -3
  489. package/dist/shared/apiTypes.js.map +1 -1
  490. package/dist/shared/capabilities.js +8 -0
  491. package/dist/shared/capabilities.js.map +1 -1
  492. package/dist/shared/federatedRoutes.js +77 -11
  493. package/dist/shared/federatedRoutes.js.map +1 -1
  494. package/dist/shared/i18n.js +41 -0
  495. package/dist/shared/i18n.js.map +1 -0
  496. package/dist/shared/machinePluginIds.js +30 -7
  497. package/dist/shared/machinePluginIds.js.map +1 -1
  498. package/dist/shared/machineStatus.js +46 -3
  499. package/dist/shared/machineStatus.js.map +1 -1
  500. package/dist/shared/navigationPreferences.js +6 -0
  501. package/dist/shared/navigationPreferences.js.map +1 -0
  502. package/dist/shared/piWebConfigParsing.js +118 -49
  503. package/dist/shared/piWebConfigParsing.js.map +1 -1
  504. package/dist/shared/piWebStatusParsing.js +33 -0
  505. package/dist/shared/piWebStatusParsing.js.map +1 -1
  506. package/dist/shared/pluginApiTypes.d.ts +87 -8
  507. package/dist/shared/pluginApiTypes.js +2 -0
  508. package/dist/shared/pluginApiTypes.js.map +1 -0
  509. package/dist/shared/pluginBackendProtocol.js +218 -2
  510. package/dist/shared/pluginBackendProtocol.js.map +1 -1
  511. package/dist/shared/pluginCatalogTypes.d.ts +49 -0
  512. package/dist/shared/pluginCatalogTypes.js +156 -0
  513. package/dist/shared/pluginCatalogTypes.js.map +1 -0
  514. package/dist/shared/pluginIds.js +10 -1
  515. package/dist/shared/pluginIds.js.map +1 -1
  516. package/dist/shared/requiredTerminalPlugin.js +6 -0
  517. package/dist/shared/requiredTerminalPlugin.js.map +1 -0
  518. package/dist/shared/serverNoticeContract.js +88 -0
  519. package/dist/shared/serverNoticeContract.js.map +1 -0
  520. package/dist/shared/sessionDefaults.js +42 -0
  521. package/dist/shared/sessionDefaults.js.map +1 -0
  522. package/dist/shared/sessionMedia.js +12 -0
  523. package/dist/shared/sessionMedia.js.map +1 -0
  524. package/dist/shared/streamingBehavior.js +8 -0
  525. package/dist/shared/streamingBehavior.js.map +1 -0
  526. package/dist/shared/themePreference.js +24 -0
  527. package/dist/shared/themePreference.js.map +1 -0
  528. package/dist/shared/thinkingLevels.js +17 -16
  529. package/dist/shared/thinkingLevels.js.map +1 -1
  530. package/dist/shared/workspaceFiles.js.map +1 -1
  531. package/dist/workspaceNotificationCli.js +95 -0
  532. package/dist/workspaceNotificationCli.js.map +1 -0
  533. package/docs/README.md +31 -0
  534. package/docs/config.md +344 -277
  535. package/docs/plugins.md +204 -930
  536. package/examples/session-bridge-plugin/README.md +20 -0
  537. package/examples/session-bridge-plugin/docs/usage.md +54 -0
  538. package/examples/session-bridge-plugin/package.json +26 -0
  539. package/examples/session-bridge-plugin/src/browser/index.ts +87 -0
  540. package/examples/session-bridge-plugin/src/browser/protocol.ts +24 -0
  541. package/examples/session-bridge-plugin/src/companion.ts +65 -0
  542. package/examples/session-bridge-plugin/src/reviewRun.ts +39 -0
  543. package/examples/session-bridge-plugin/src/server.ts +85 -0
  544. package/examples/session-bridge-plugin/src/store.ts +80 -0
  545. package/examples/session-bridge-plugin/tsconfig.json +21 -0
  546. package/examples/workspace-provider-plugin/README.md +39 -0
  547. package/examples/workspace-provider-plugin/package.json +25 -0
  548. package/examples/workspace-provider-plugin/src/browser/index.ts +69 -0
  549. package/examples/workspace-provider-plugin/src/server.ts +68 -0
  550. package/examples/workspace-provider-plugin/tsconfig.json +21 -0
  551. package/extensions/pi-web.ts +3 -1
  552. package/package.json +59 -36
  553. package/skills/README.md +28 -2
  554. package/skills/relay/SKILL.md +24 -89
  555. package/skills/relay-runner/SKILL.md +74 -0
  556. package/dist/client/assets/CodeViewer-DCl56K0Z.js +0 -4
  557. package/dist/client/assets/TerminalPanel-DCvoEjUF.js +0 -187
  558. package/dist/client/assets/index-CMvms5cF.js +0 -4325
  559. package/dist/client/assets/vendor-editor-core-vUi74DnD.js +0 -12
  560. package/dist/client/assets/vendor-editor-languages-DoaXUodB.js +0 -46
  561. package/dist/client/assets/vendor-editor-legacy-CYBnW6ZU.js +0 -1
  562. package/dist/client/assets/vendor-terminal-BrP-ENHg.css +0 -1
  563. package/dist/client/assets/vendor-terminal-D8k4UKM2.js +0 -35
  564. package/dist/pi-web-plugins/relays/package.json +0 -9
  565. package/dist/pi-web-plugins/relays/pi-web-plugin.js +0 -44
  566. package/dist/server/git/gitService.js +0 -290
  567. package/dist/server/git/gitService.js.map +0 -1
  568. package/dist/server/gitRoutes.js +0 -23
  569. package/dist/server/gitRoutes.js.map +0 -1
  570. package/dist/server/sessions/pendingAskStore.js +0 -278
  571. package/dist/server/sessions/pendingAskStore.js.map +0 -1
  572. package/dist/server/terminalProxyRoutes.js +0 -178
  573. package/dist/server/terminalProxyRoutes.js.map +0 -1
  574. package/dist/server/terminals/terminalRoutes.js +0 -164
  575. package/dist/server/terminals/terminalRoutes.js.map +0 -1
  576. package/dist/server/terminals/terminalService.js.map +0 -1
  577. package/dist/server/terminals/terminalSize.js +0 -17
  578. package/dist/server/terminals/terminalSize.js.map +0 -1
  579. package/dist/server/workspaces/gitWorktreeDiscovery.js +0 -43
  580. package/dist/server/workspaces/gitWorktreeDiscovery.js.map +0 -1
  581. package/dist/server/workspaces/workspaceService.js +0 -52
  582. package/dist/server/workspaces/workspaceService.js.map +0 -1
  583. /package/dist/{pi-web-plugins → pi-packages}/relays/vendor/README.md +0 -0
  584. /package/dist/{pi-web-plugins → pi-packages}/relays/vendor/marked.esm.js +0 -0
package/docs/config.md CHANGED
@@ -1,425 +1,492 @@
1
- # PI WEB configuration reference
1
+ # PI WEB 配置参考
2
2
 
3
- PI WEB configuration covers the machine-local and project-local settings you usually need: the web/API bind address, trusted development-host settings, UI preferences, plugin enablement, file-explorer path access, manual upload defaults, upload limits, Pi-compatible agent profiles and companion CLIs, and session-daemon tools.
3
+ 本页说明机器与项目配置、路径访问、上传和提示词附件、会话守护进程能力、插件期望状态与恢复、快捷键以及运行时环境。便于扫描的默认值、作用域和重启规则见[配置页面](https://pi-web.dev/config)。
4
4
 
5
- This file is the markdown reference for agents and package consumers. The website page is <https://pi-web.dev/config>.
5
+ <a id="config-files"></a>
6
+ ## 配置文件
6
7
 
7
- ## Config files
8
+ - **机器配置**:`$PI_WEB_CONFIG`;未设置时使用 `$XDG_CONFIG_HOME/pi-web/config.json` 或 `~/.config/pi-web/config.json`。
9
+ - **项目配置**:`<project>/.pi-web/config.json`,可提交到仓库。
10
+ - **托管数据**:`$PI_WEB_DATA_DIR`(默认 `~/.pi-web`),不是用户可编辑配置 API。
8
11
 
9
- PI WEB uses two config files:
12
+ 联邦模式下,会影响工作执行的设置针对所选机器:路径访问、上传/附件默认目录、上传限制、会话工具、插件启用与配置。网关 host/port/allowed-hosts、快捷键、机器注册和令牌仍保存在网关。远端不支持某项功能时明确报错,不静默使用网关配置。
10
13
 
11
- - **Global PI WEB config:** `$PI_WEB_CONFIG`, or `$XDG_CONFIG_HOME/pi-web/config.json`, or `~/.config/pi-web/config.json`.
12
- - **Project-local PI WEB config:** `<project>/.pi-web/config.json` for commit-able project settings.
14
+ Pi 包由目标机器的 `pi install`、`pi remove`、`pi update` 或 **设置 → Pi 包** 管理;PI WEB 的 `plugins` 只控制已发现的纯浏览器、纯服务端与双入口插件的期望状态,不安装、移除或更新包。
13
15
 
14
- Normal-mode provider credentials and custom models are stored separately for each registered project under the managed data directory (`$PI_WEB_DATA_DIR`, or `~/.pi-web`):
16
+ <a id="settings-target-and-drafts"></a>
17
+ ### 设置目标与草稿
15
18
 
16
- - Each project has its own managed `auth.json` and `models.json`.
17
- - All worktrees belonging to the same project share those two files.
18
- - On first use, PI WEB copies the existing global Pi files from the effective Pi agent directory (by default `~/.pi/agent/auth.json` and `~/.pi/agent/models.json`) into the project store. Later changes are independent; the global files are not a fallback.
19
- - Normal-mode auth requests and new session/list requests must resolve to a registered project. Existing active sessions keep the project registry they were opened with, even if the project is later closed. Management-embed mode keeps its separate managed credential store.
19
+ 普通模式的设置对话框独立持有“配置机器”选择,只改变机器级设置的目标,不切换正在使用的项目、工作区或会话。网关配置、默认主题和快捷键仍属网关,浏览器主题覆盖仍属设备。存在未保存的文件访问或上传草稿时,切换设置机器前需确认放弃或继续编辑;管理模式不开放这套普通跨机器选择器。
20
20
 
21
- Each PI WEB machine has its own config. When using Fleet/machine federation, Settings uses the selected machine for config that affects work running there: session daemon tools, PI WEB plugin enablement, external path access, and upload defaults. Gateway/browser-only settings stay local to the gateway: keyboard shortcuts, remote machine registry/tokens, and gateway host/port/allowed-hosts. Remote servers that do not advertise selected-machine settings support report those settings as unavailable instead of silently falling back to the gateway.
21
+ 通用设置分别持有网关与目标机器草稿:配置刷新只更新未编辑字段,不用其他机器的值重设当前草稿;保存返回的配置确认已提交值后,才结清对应提交,保存期间的新编辑仍保留。快捷键按操作行确认保存值,只清该行已提交且未再改动的草稿;回调结束本身不是保存确认,也不清其他行草稿。
22
22
 
23
- Pi package settings are separate from PI WEB config. They live in Pi's package-manager settings on the target machine and are managed by Pi (`pi install`, `pi remove`, `pi update`) or **Settings → Pi packages**. In a federated setup, **Settings → Pi packages** targets the currently selected machine. The PI WEB `plugins` config key only enables or disables discovered PI WEB browser plugins on the machine whose config you are editing; it does not install, remove, or update Pi packages.
23
+ <a id="chinese-language-plugin"></a>
24
+ ### 中文语言插件
24
25
 
25
- If you installed services with a custom config path, rerun `pi-web install --config /path/to/config.json` after changing that path or after upgrading from a version that only applied the custom path to the web service. This regenerates service files so the web/API and session daemon use the same `PI_WEB_CONFIG`.
26
+ 内置 `zh-cn` 默认启用,覆盖核心界面、内置插件、CLI 及 PI WEB 自有提示。要恢复英文,在有效机器配置中设置 `"plugins": { "zh-cn": { "enabled": false } }`。不新增语言选择器或语言配置文件,缺失词条回退英文。
26
27
 
27
- ## Reverse-proxy deployment paths
28
+ 浏览器语言由网关机器的开关决定,不随所选远端机器切换。每台机器的 CLI 和服务端读取自身配置;远端返回的提示保留远端语言。用户内容、模型回复、第三方输出、命令、错误码及协议字段不会被翻译。
28
29
 
29
- The deployment path is not a PI WEB config-file key or environment setting. The published client is portable: one build works at `/` and at canonical trailing-slash prefixes such as `/ai/` or `/test/ai/`.
30
+ 修改后刷新网页;CLI 下次启动生效;服务端需重启。拆分部署时重启 `pi-web-sessiond.service` 和 Web 服务(开发安装为 `pi-web-ui-dev.service`),确保两者使用相同有效 `PI_WEB_CONFIG`。不支持运行中热切换。
30
31
 
31
- For a nested deployment, redirect the slashless prefix to the trailing-slash URL, strip the prefix before forwarding to PI WEB, and proxy authenticated HTTP and WebSocket traffic through the same location. Relative browser and PWA URLs then stay within that prefix. See the [reverse proxy installation guide](https://pi-web.dev/install#reverse-proxy-prefix) for a complete Nginx example.
32
+ 普通模式模型凭据和自定义模型按注册项目存放在托管目录的 `auth.json`、`models.json`。同一项目所有工作区共享项目存储;首次使用从有效全局 Pi agent 文件复制一次,之后不回退或覆盖。认证、启动与列表请求必须解析到注册项目;运行中的会话保留创建时的项目 registry,即使项目之后关闭。管理嵌入使用独立的 `management-embed/auth.json` 与 `models.json`,不混用普通项目凭据。
32
33
 
33
- ## Precedence and reloads
34
+ ### 已安装服务的自定义配置路径
34
35
 
35
- Machine-global runtime values are resolved as:
36
+ `start`、`restart`、`doctor` 的就绪检查默认使用已安装服务保存的配置路径;命令的非空 `PI_WEB_CONFIG` 可覆盖。`doctor` 检查受管理安装,不代表所有自定义环境。
36
37
 
37
- ```text
38
- defaults → global config file → environment overrides
39
- ```
38
+ | 情况 | 行为或处理 |
39
+ | --- | --- |
40
+ | 使用已安装路径 | 正常执行 `pi-web start`、`restart`、`doctor` |
41
+ | 单次命令覆盖 | 设置非空 `PI_WEB_CONFIG`,不重写服务定义 |
42
+ | 更改服务路径 | `pi-web install --config /path/to/config.json` 重新生成 Web/API 和 daemon 定义 |
43
+ | 旧安装仅 Web 保存路径 | 重跑上述安装命令,对齐两个服务 |
44
+ | systemd 无法验证实际环境 | 管理器状态过期、实际 fragment 不同或管理值不可验证时失败,不猜测;受管理 `Environment=`(当前 `PI_WEB_CONFIG`)必须与定义一致;无关变量忽略,未改管理值的 drop-in 允许 |
45
+ | systemd 使用 `EnvironmentFile=` | 本地保留严格检查:无法验证文件内实际覆盖时失败,不采用上游仅警告的宽松策略 |
46
+ | launchd 使用旧路径或其他 plist 标签 | `start`/`doctor` 失败;`restart` 重新加载已安装 plist,可修复过期状态 |
47
+
48
+ <a id="startup-model-and-thinking-defaults"></a>
49
+ ## 新会话模型与思考默认值
50
+
51
+ 在模型或思考等级选择器中点击“新会话默认值”星标。实心星标表示已保存的默认值;点击选项本身只改变当前会话,星标不改变当前会话。
52
+
53
+ `defaultProvider`、`defaultModel`、`defaultThinkingLevel` 按机器上 **模式 × 项目** 保存至托管 `settings.preferences.json`,不写回共享 agent `settings.json`。普通模式与项目认证同目录;管理模式使用 `management-embed/projects/<hash>/`,不能唯一归属项目时使用 `management-embed/orphan/<cwdHash>/`。普通模式的 `enabledModels` 也按项目保存,管理模式不展示。
54
+
55
+ 默认值无需重启,适用于新会话。项目 Pi 设置、显式启动选择及每模型思考设置仍有既定优先级。默认模型必须启用,否则选择首个启用模型。恢复会话保留原模型与思考等级。其他共享 agent 设置(包、扩展、代理等)继续读真实 agent 目录的 `settings.json`。
56
+
57
+ <a id="default-theme-and-streaming"></a>
58
+ ## 应用主题与发送默认值
59
+
60
+ `defaultTheme` 是网关配置,形如 `{ "themeId": "plugin-id:theme-id", "auto": true }`:`themeId` 必须为限定贡献 ID,`auto` 必须为布尔值。`auto: true` 在该主题有明暗配对时跟随系统明暗,否则使用所选主题。浏览器设备已保存的主题覆盖优先;主题暂不可用时使用回退,不删除原选择。主题属于整个应用,不保存到当前远端机器;保存/刷新配置后生效,无需重启 daemon。
61
+
62
+ 在 **设置 → 通用 → 主题** 中,“在此设备使用”保存浏览器覆盖,“设为默认”保存网关默认且不覆盖已有设备选择,“使用默认值”清除此浏览器覆盖。Auto 只在主题有明暗配对时跟随设备。
63
+
64
+ 网关 `defaultStreamingBehavior` 为 `"steer"`(默认)或 `"followUp"`,决定流式工作期间编辑器的默认发送方式,不改变已在 daemon 中排队的消息。浏览器分区尺寸、编辑器偏好与普通导航顺序不是新的项目配置文件;导航顺序是按机器管理的托管状态,管理模式不共用普通存储。
65
+
66
+ <a id="session-naming-and-archives"></a>
67
+ ## 会话命名与归档
68
+
69
+ 机器配置 `sessionNaming` 仅接受以下可选字段,不提供项目覆盖。设置保存后用于后续命名请求,无需重启;每次请求固定自己的有效设置,不覆盖用户已命名会话,也不切换聊天模型。
70
+
71
+ | 设置 | 作用范围 | 默认值 | 改变什么 | 生效 / 重启 |
72
+ | --- | --- | --- | --- | --- |
73
+ | `sessionNaming.model` | 机器 | 当前会话模型 | 命名模型,精确 `provider/model-id`;使用原会话普通项目或管理 registry | 后续命名请求;无需重启 |
74
+ | `sessionNaming.maxTokens` | 机器 | `24` | 命名输出 token 上限,正安全整数 | 后续命名请求;无需重启 |
75
+ | `sessionNaming.thinkingLevel` | 机器 | `minimal` | 命名思考等级,须为已知等级;`off` 不发送 reasoning 参数 | 后续命名请求;无需重启 |
76
+ | `sessionNaming.timeoutMs` | 机器 | `10000` | 命名总耗时上限,整数 `1..2147483647` 毫秒 | 后续命名请求;无需重启 |
77
+
78
+ 模型不可用、超时或命名失败时使用首条消息的回退名称;标题语言跟随用户请求。命名设置不把项目凭据切换为全局凭据。
79
+
80
+ <a id="session-archive-directory"></a>
81
+
82
+ `sessionArchive.directory` 选择新归档内容目的地,非空环境变量 `PI_WEB_SESSION_ARCHIVE_DIR` 优先;默认 `$PI_WEB_DATA_DIR/archived-sessions`。配置路径或环境路径相对进程 cwd 解析为绝对路径,daemon 启动后固定,修改需重启 daemon。归档索引仍是 `$PI_WEB_DATA_DIR/archived-sessions.json`,已有记录继续指向原归档文件,不自动迁移。备份时覆盖索引、旧目录与新目的地,不只复制默认目录。
83
+
84
+ <a id="mcp-settings-and-authentication"></a>
85
+ ## MCP 设置与认证
86
+
87
+ **设置 → MCP** 管理所选机器当前非归档会话中已启用、支持 OAuth 的 MCP 服务器认证;先选择可写、空闲且可信的会话。服务器配置由 Pi 的全局/项目设置和信任规则决定,这里不新增 `pi-web` MCP 服务器配置键,也不替代管理模式的 Workbench 受控 MCP 集成。
88
+
89
+ 也可从操作面板选择 MCP 登录/注销,再选择服务器;设置页直接针对所选服务器。两者使用同一独立认证流程,不切到聊天;禁用、header 认证或 stdio 服务器不列为 OAuth 候选,同机器同时只能进行一项 MCP 认证操作。
90
+
91
+ 专用认证仅支持所选 **Pi 1.3.0** 同一 SDK 的内部凭据适配,未知版本不保证兼容。普通项目与管理使用独立私有 MCP 凭据,不回退共享 agent 的 MCP OAuth 存储;完整特权仍是管理身份,受限管理不提供该流程。认证固定原机器、会话、cwd、项目和 scope,切换选择不会转移流程。注销删除对应保存凭据,影响使用该凭据的其他会话,但不禁用服务器或撤销提供方授权。详见[认证与模型](https://github.com/nayuto-wakusei/pi-web-ChineseTranslation/blob/main/docs/modules/auth-models.md#mcp-认证)。
92
+
93
+ <a id="reverse-proxy-deployment-paths"></a>
94
+ ## 反向代理部署前缀
95
+
96
+ PI WEB 不需要专门的 URL 前缀配置。同一发布产物可用于 `/`、`/ai/`、`/test/ai/`。代理必须先把不带尾斜线的前缀重定向到带斜线地址,再剥离前缀转发同一认证范围的 HTTP 与 WebSocket。页面相对资源和 PWA 路径依赖这一契约,详见[反向代理安装指南](https://pi-web.dev/install#reverse-proxy-prefix)。
40
97
 
41
- Supported project-local settings are then applied for that project's workspaces. For upload defaults, `<project>/.pi-web/config.json` overrides the global value.
98
+ <a id="precedence"></a>
99
+ <a id="precedence-and-reloads"></a>
100
+ ## 优先级与生效条件
42
101
 
43
- Environment overrides include `PI_WEB_HOST`, `PI_WEB_PORT` / `PORT`, `PI_WEB_ALLOWED_HOSTS`, `PI_WEB_MAX_UPLOAD_BYTES`, `PI_WEB_AGENT_COMMAND`, `PI_WEB_AGENT_DIR`, `PI_WEB_AGENT_SESSION_DIR`, `PI_CODING_AGENT_DIR` / `PI_CODING_AGENT_SESSION_DIR`, `PI_WEB_ENVIRONMENT_FACTS`, `PI_WEB_SPAWN_SESSIONS`, `PI_WEB_SUBSESSIONS`, and `PI_WEB_ASK_USER`.
102
+ 机器运行配置顺序:内置默认值 → 全局配置 → 环境覆盖。支持的项目键之后应用,上传与附件目录以项目值覆盖,允许路径列表合并去重。
44
103
 
45
- Process restarts depend on the key:
104
+ 环境覆盖包含 `PI_WEB_HOST`、`PI_WEB_PORT`/`PORT`、`PI_WEB_ALLOWED_HOSTS`、`PI_WEB_MAX_UPLOAD_BYTES`、`PI_CODING_AGENT_DIR`、`PI_CODING_AGENT_SESSION_DIR`、`PI_WEB_SPAWN_SESSIONS`、`PI_WEB_SUBSESSIONS`、`PI_WEB_ASK_USER`、`PI_WEB_ENVIRONMENT_FACTS`。本地保留的旧 agent/companion 输入另见下文。
46
105
 
47
- - `host` / `port`: restart the gateway web/API service or process.
48
- - `maxUploadBytes`: restart both the web/API process and the session daemon on that machine.
49
- - `agent.command` / `agent.dir` / `spawnSessions` / `subsessions` / `askUser` / `extensionDialogsTimeoutMs`: restart the session daemon on that machine.
50
- - `workbenchIntegration`: restart both the web/API process and session daemon; both processes must use the same endpoints and limits.
51
- - `pathAccess`: applies on the next request; existing file views may need a browser refresh.
52
- - `uploads.defaultFolder`: applies to newly opened Files upload dialogs and new direct drag/drop batches after config/workspace refresh.
53
- - `plugins`: reload the browser tab after changing PI WEB plugin enablement.
54
- - Pi package install/remove/update: not a PI WEB config key; after a mutation, type `/reload` in each idle PI WEB session on the target machine to refresh ordinary Pi resources such as extensions, skills, prompt templates, themes, and context/system prompt files. Reload the browser page separately for PI WEB browser plugin changes. If a global Pi extension adds or removes a provider, or changes a provider's connection settings, manually restart `pi-web-sessiond.service`; `/reload` cannot change the startup provider baseline. A known provider refreshing only its own model list is applied without a restart. See [Pi extension provider baseline](#pi-extension-provider-baseline).
55
- - `shortcuts`: saved settings apply in the browser after config refresh/save.
106
+ - host/port:重启 Web/API。
107
+ - 上传大小:目标机器 Web/API 与 daemon 都重启。
108
+ - 会话工具、扩展对话框超时、环境事实:重启 daemon。
109
+ - 路径访问:下次请求生效;已有视图可需刷新。
110
+ - 上传/附件目录:配置或工作区刷新后的新批次生效。
111
+ - 纯浏览器插件:刷新浏览器。影响 `serverModule` 的启用、设置、包来源或版本:手动重启目标 daemon,再刷新。
112
+ - `serverPlugins.safeStart`:下次 daemon 启动前、发现/导入插件前生效,通过恢复 CLI 管理。
113
+ - Pi 普通资源变更:每个空闲会话执行 `/reload`。服务端插件或全局提供器定义/连接变更仍需手动重启 daemon;已知提供器仅模型列表刷新无需重启。
114
+ - 快捷键:保存或配置刷新后生效。
115
+ - `workbenchIntegration`、管理特权配置或跨进程审计配置:Web/API 与 daemon 保持一致并重启;签名授权仍必须显式允许对应权限。
56
116
 
57
- ## Global config example
117
+ <a id="global-config-example"></a>
118
+ ## 全局配置示例
58
119
 
59
120
  ```json
60
121
  {
61
122
  "host": "127.0.0.1",
62
123
  "port": 8504,
63
- "pathAccess": {
64
- "allowedPaths": ["~/SDKs", "/opt/reference"]
65
- },
66
- "uploads": {
67
- "defaultFolder": ".pi-web/uploads"
68
- },
124
+ "pathAccess": { "allowedPaths": ["~/SDKs", "/opt/reference"] },
125
+ "uploads": { "defaultFolder": ".pi-web/uploads" },
126
+ "attachments": { "defaultFolder": ".pi-web/attachments" },
69
127
  "maxUploadBytes": 67108864,
70
- "agent": {
71
- "command": "pi",
72
- "dir": "~/agent-profiles/research"
128
+ "sessionArchive": {
129
+ "directory": "/srv/pi-web/archives"
73
130
  },
74
131
  "spawnSessions": true,
75
132
  "subsessions": true,
76
133
  "askUser": true,
77
134
  "extensionDialogsTimeoutMs": 300000,
78
- "workbenchIntegration": {
79
- "baseUrl": "http://ai-platform-backend:8787",
80
- "mcpUrl": "http://mcp:8000/mcp",
81
- "requestTimeoutMs": 10000,
82
- "capabilityTimeoutMs": 30000,
83
- "skillBundleMaxBytes": 10485760,
84
- "skillFileMaxBytes": 2097152,
85
- "skillFileCountMax": 200
86
- },
87
- "auditLog": {
88
- "normalMode": {
89
- "enabled": true,
90
- "retentionDays": 90,
91
- "maxRows": 500000
92
- },
93
- "managementMode": {
94
- "enabled": true,
95
- "baseUrl": "https://elasticsearch.internal:9200",
96
- "indexPrefix": "pi-web-management-audit",
97
- "retentionDays": 365
98
- }
99
- },
100
- "plugins": {
101
- "workspace-tasks": { "enabled": true },
102
- "updates": { "enabled": true },
103
- "info": { "enabled": false }
104
- },
105
- "shortcuts": {
106
- "core:view.chat": "mod+1",
107
- "core:session.stop": null
108
- }
135
+ "environmentFacts": true,
136
+ "plugins": { "workspace-tasks": { "enabled": true }, "updates": { "enabled": false } }
109
137
  }
110
138
  ```
111
139
 
112
- ## Project-local config
140
+ 合并到已有文件,不覆盖无关设置或用户数据。
113
141
 
114
- Project-local config lives at `<project>/.pi-web/config.json`. Use it for settings that should follow a repository.
142
+ <a id="project-local-config-example"></a>
143
+ <a id="project-local-config"></a>
144
+ ## 项目配置示例
115
145
 
116
146
  ```json
117
147
  {
118
148
  "version": 1,
119
- "pathAccess": {
120
- "allowedPaths": ["~/SDKs", "/opt/reference"]
121
- },
122
- "uploads": {
123
- "defaultFolder": "manual/uploads"
124
- }
149
+ "pathAccess": { "allowedPaths": ["~/project-reference"] },
150
+ "uploads": { "defaultFolder": "manual/uploads" },
151
+ "attachments": { "defaultFolder": "prompt-attachments" }
125
152
  }
126
153
  ```
127
154
 
128
- Project-local `pathAccess.allowedPaths` entries are merged after the global list and deduplicated. Paths must still be host-absolute or `~`-prefixed; relative roots are not supported.
129
-
130
- Project-local `uploads.defaultFolder` overrides the global upload destination for workspaces in that project. Current PI WEB servers include this workspace-effective value on the existing workspace responses used locally and through machine federation. Older remote servers may omit the optional field; the browser falls back to the global/default upload folder.
131
-
132
- Plugins may own separate project files, such as `.pi-web/tasks.json` for the built-in Workspace Tasks plugin.
133
-
134
- ## Configuration matrix
135
-
136
- Rows with JSON key `—` are runtime-only environment variables, not config-file keys. `Global` means machine-global. In Settings, selected-machine-safe global keys (`pathAccess`, `uploads`, `maxUploadBytes`, `agent`, `spawnSessions`, `subsessions`, `askUser`, and `plugins`) are edited for the selected machine; gateway host/port/allowed-hosts, keyboard shortcuts, and machine registry/tokens stay local.
137
-
138
- | Config | JSON key | Env var | Scope | Project-local behavior | Applies / restart |
139
- | --- | --- | --- | --- | --- | --- |
140
- | **Config-file keys** | | | | | |
141
- | Web/API bind host | `host` | `PI_WEB_HOST` | Global | Not supported locally | Restart web/API |
142
- | Web/API port | `port` | `PI_WEB_PORT`, `PORT` | Global | Not supported locally | Restart web/API |
143
- | Dev-server allowed hosts | `allowedHosts` | `PI_WEB_ALLOWED_HOSTS` | Global | Not supported locally | Restart dev web/UI |
144
- | External filesystem roots | `pathAccess.allowedPaths` | — | Global + project | **Merges**: global roots first, then project roots; duplicates removed | Next file request; refresh existing views if needed |
145
- | Manual file upload default folder | `uploads.defaultFolder` | — | Global + project | **Overrides**: project value wins for workspaces in that project; otherwise global/default applies | New Upload dialogs and direct drag/drop batches after config/workspace refresh |
146
- | Upload/body limit | `maxUploadBytes` | `PI_WEB_MAX_UPLOAD_BYTES` | Global | Not supported locally | Restart web/API and session daemon on that machine |
147
- | Companion CLI command | `agent.command` | `PI_WEB_AGENT_COMMAND` | Global/session daemon | Not supported locally | Restart session daemon on that machine; affects doctor/status/update checks |
148
- | Agent profile state directory | `agent.dir` | `PI_WEB_AGENT_DIR` (`PI_CODING_AGENT_DIR` for Pi compatibility) | Global/session daemon | Not supported locally | Restart session daemon on that machine; affects auth, models, settings, sessions, Pi packages, and Pi-package-backed PI WEB plugins |
149
- | Agent can spawn sessions | `spawnSessions` | `PI_WEB_SPAWN_SESSIONS` | Global/session daemon | Not supported locally | Restart session daemon on that machine |
150
- | Tracked subsessions | `subsessions` | `PI_WEB_SUBSESSIONS` | Global/session daemon | Not supported locally; also requires `spawnSessions` | Restart session daemon on that machine |
151
- | Agent can post question forms | `askUser` | `PI_WEB_ASK_USER` | Global/session daemon | Not supported locally | Restart session daemon on that machine |
152
- | Ordinary-session environment facts | `environmentFacts` | `PI_WEB_ENVIRONMENT_FACTS` | Global/session daemon | Not supported locally | Restart session daemon on that machine; affects newly started sessions |
153
- | 扩展对话框自动取消超时 | `extensionDialogsTimeoutMs` | — | 全局/会话守护进程 | 不支持项目级配置 | 重启对应机器上的会话守护进程 |
154
- | Workbench/MCP integration | `workbenchIntegration.*` | `PI_WEB_WORKBENCH_URL`, `PI_WEB_MCP_URL`, `PI_WEB_WORKBENCH_TIMEOUT_MS`, `PI_WEB_MCP_TIMEOUT_MS`, `PI_WEB_SKILL_BUNDLE_MAX_BYTES`, `PI_WEB_SKILL_FILE_MAX_BYTES`, `PI_WEB_SKILL_FILE_COUNT_MAX` | Web/API + session daemon | Not supported locally | Restart web/API and session daemon; both must match |
155
- | Ordinary tool audit | `auditLog.normalMode.*` | — | Global/session daemon | Not supported locally | Restart session daemon |
156
- | Management tool audit | `auditLog.managementMode.*` | `PI_WEB_AUDIT_ES_URL`, `PI_WEB_AUDIT_ES_API_KEY`, `PI_WEB_AUDIT_ES_USERNAME`, `PI_WEB_AUDIT_ES_PASSWORD` | Global/session daemon | Not supported locally | Restart session daemon |
157
- | Plugin enablement/settings | `plugins.<id>.enabled`, `plugins.<id>.settings` | — | Global | Not core local config; plugins may read their own project files | Reload browser tab |
158
- | Keyboard shortcuts | `shortcuts.<actionId>` | — | Global | Not supported locally | Applies after settings save/config refresh |
159
- | Project config version | `version` | — | Project | Project-local only; must be `1` when present | Next project-config read |
160
- | **Runtime-only environment variables** | | | | | |
161
- | Global config file path | — | `PI_WEB_CONFIG` (`XDG_CONFIG_HOME` affects the default path) | Process/env | Selects the global config file; not a project config | Restart services/processes after changing env |
162
- | Managed data directory | — | `PI_WEB_DATA_DIR` | Process/env | Not supported locally | Restart web/API and session daemon |
163
- | Session daemon socket | — | `PI_WEB_SESSIOND_SOCKET` | Web/API + session daemon env | Not supported locally | Restart daemon and web/API; both must match |
164
- | Session daemon TCP port | — | `PI_WEB_SESSIOND_PORT` | Session daemon env | Not supported locally | Restart session daemon; set `PI_WEB_SESSIOND_URL` for web/API too |
165
- | Session daemon TCP host | — | `PI_WEB_SESSIOND_HOST` | Session daemon env | Not supported locally | Restart session daemon |
166
- | Web-to-daemon URL | — | `PI_WEB_SESSIOND_URL` | Web/API env | Not supported locally | Restart web/API |
167
- | Projects storage file | — | `PI_WEB_PROJECTS_FILE` | Web/API + session daemon env | Not supported locally | Restart services; advanced state override |
168
- | Remote machines storage file | — | `PI_WEB_MACHINES_FILE` | Web/API env | Not supported locally | Restart web/API; advanced state override |
169
- | Agent profile session storage directory | — | `PI_WEB_AGENT_SESSION_DIR` (`PI_CODING_AGENT_SESSION_DIR` for Pi compatibility) | Session daemon env | Not supported locally | Restart session daemon; env-only session storage override |
170
- | Agent profile state directory | — | `PI_WEB_AGENT_DIR` (`PI_CODING_AGENT_DIR` for Pi compatibility) | Web/API + session daemon env | Not supported locally | Restart services |
171
- | Skip update checks | — | `PI_WEB_SKIP_VERSION_CHECK`, `PI_WEB_OFFLINE`, `PI_SKIP_VERSION_CHECK`, `PI_OFFLINE` | Web/API env | Not supported locally | Restart web/API after env changes |
172
- | Offline mode | — | `PI_WEB_OFFLINE`, `PI_OFFLINE` | Web/API + session daemon env | Not supported locally | Restart session daemon and web/API after env changes; also disables the [background model catalog refresh](#background-model-catalog-refresh) |
173
-
174
- ## Key details
175
-
176
- ### Ordinary-mode tool audit
177
-
178
- PI WEB stores metadata-only ordinary-mode tool calls in `$PI_WEB_DATA_DIR/audit/normal-tool-calls.sqlite` while keeping the existing Pino/service logs. Management-embed calls are not written to this database. Each row contains the session and workspace, tool and call identifiers, start/end timestamps, duration, and `started`, `completed`, `failed`, or `interrupted` status. Arguments, results, prompts, model replies, and credentials are never stored.
179
-
180
- `auditLog.normalMode.enabled` defaults to `true`. `retentionDays` defaults to `90`, and `maxRows` defaults to `500000`. The session daemon prunes at startup and every 24 hours. Database failures are reported through the existing logger and do not stop tool execution.
181
-
182
- Use the CLI to inspect and maintain the database:
183
-
184
- ```bash
185
- pi-web audit list --since 24h
186
- pi-web audit list --status failed --since 7d
187
- pi-web audit stats --since 30d
188
- pi-web audit export --since 30d --format csv --output audit.csv
189
- pi-web audit prune --before 2026-05-01
190
- pi-web audit vacuum
191
- ```
192
-
193
- The database uses WAL mode so these read operations can run while sessiond is active. A graceful sessiond shutdown and the next startup mark unfinished calls as `interrupted`; changing audit configuration requires restarting sessiond.
194
-
195
- ### Management-mode Elasticsearch audit
196
-
197
- Management-embed audit records can be sent to Elasticsearch while the existing Pino/service logs remain enabled. Set `auditLog.managementMode.enabled` to `true` and provide `baseUrl`, or set `PI_WEB_AUDIT_ES_URL`. Authentication is read only from the session daemon environment: `PI_WEB_AUDIT_ES_API_KEY` takes precedence, while basic authentication requires both `PI_WEB_AUDIT_ES_USERNAME` and `PI_WEB_AUDIT_ES_PASSWORD`. Credentials must not be included in `baseUrl`.
198
-
199
- Records are written to Shanghai-calendar ISO-week indices such as `pi-web-management-audit-2026-w32`. `indexPrefix` defaults to `pi-web-management-audit`; `retentionDays` defaults to `365`. Sessiond installs a strict index template, batches writes through the Elasticsearch Bulk API, and runs retention at startup and daily. The first successful maintenance in each Shanghai calendar month deletes documents whose `@timestamp` is older than the retention cutoff.
200
-
201
- Each document identifies `user.id`, `user.root_user_id`, the authorized project owning the actual workspace, the Pi session, and, when applicable, the Workbench Agent Session. Tool calls include tool/call identifiers and status. Capability and Skill events add fixed resource versions, authorization revision, run/trace identifiers, status, duration, and retry metadata. Prompts, tool arguments, tool results, model replies, access tokens, API keys, cookies, and capability tickets are excluded.
202
-
203
- Elasticsearch failures are reported through Pino and do not stop management sessions. Failed batches remain in a bounded in-memory retry queue and are flushed during graceful sessiond shutdown; a process crash can lose records that have not yet reached Elasticsearch. Use Elasticsearch or Kibana index permissions to limit user-level audit access.
155
+ 路径根必须是宿主绝对路径或 `~` 前缀,不支持相对根。项目上传/附件目录通过工作区有效配置返回,联邦访问使用目标项目的值;不依赖旧远端可选字段回退。插件可拥有独立文件,如 `.pi-web/tasks.json`。
204
156
 
205
- ### Workbench and MCP integration
157
+ <a id="project-plugin-settings"></a>
158
+ ### 项目插件设置
206
159
 
207
- `workbenchIntegration` enables the controlled management-embed adapter for the network model workbench. These resource, tool, and Skill restrictions apply only to management-embed sessions; normal-mode sessions keep PI WEB's existing behavior. `baseUrl` is the server-reachable workbench backend origin, while `mcpUrl` is the MCP Streamable HTTP endpoint. Both are required; the environment variables override the corresponding JSON URLs.
160
+ 支持项目设置的服务端插件可读取注册项目根目录的 `.pi-web/config.json` 中 `plugins.<id>.settings`,不是各 worktree 独立配置。项目顶层设置键覆盖机器值,嵌套对象整体替换而非深合并;`enabled` 仍只属于机器配置,项目声明会被拒绝。修改服务端插件的全局或项目设置后,手动重启目标 daemon。
208
161
 
209
- The adapter exchanges the one-time management token for a private Agent Session, loads only the resulting fixed resource snapshot, and exposes `icnoc_search_capabilities` and `icnoc_call_capability` alongside the managed file tools and sandboxed `python` tool. When their global feature switches are enabled, management sessions also receive `spawn_session`, the tracked-subsessions tool set headed by `spawn_subsession`, and `ask_user`; spawned sessions inherit the same management context. Python runs without network access in an isolated Bubblewrap environment that binds only the managed workspace. Generic MCP, HTTP, web search, shell, and terminal tools remain denied in management mode. Skill bundles are downloaded only from the MCP origin, checked against the authorized fixed version and manifest, and stored under the managed project's `.pi/skills/` directory. Tokens and tickets remain server-side.
162
+ <a id="git-worktree-discovery-hooks"></a>
163
+ ### Git 工作树发现通知
210
164
 
211
- The session daemon emits metadata-only tool execution audit entries for both normal and management sessions. These entries include the mode, session, workspace, tool name, call id, and execution status; tool arguments and results are deliberately excluded. Workbench capability calls additionally emit their business and MCP trace identifiers.
165
+ Git 插件的 `plugins.git.settings.workspaceDiscoveryHooks` 为布尔值,默认 `true`,项目值覆盖机器值。支持命名 hooks 的 Git(2.54+)可安装自身命名通知,保留已有 hooks 且不修改 `core.hooksPath`;不支持时仍可按需刷新列表。通知仅提示宿主重新查询当前提供器,不直接注册工作区。修改后重启 daemon,浏览器刷新不能更新 hook 状态。
212
166
 
213
- Set the same effective config and environment on the web/API and session daemon services. Changing any integration endpoint or limit requires restarting both services.
167
+ <a id="git-instance-namespace"></a>
214
168
 
215
- ### Managed data directory
169
+ 多实例可用 daemon 环境变量 `PI_WEB_INSTANCE_NAMESPACE` 区分通知身份:1–32 个字母、数字、下划线或连字符,首字符为字母或数字;生产默认留空,开发实例使用 `dev`。名称应保持稳定;退役旧名称时先在旧名称下禁用发现 hooks 并重启完成清理,再切换名称。不自动接管或迁移其他实例/旧名称的 hook。
216
170
 
217
- `PI_WEB_DATA_DIR` sets the root for PI WEB-managed runtime state and defaults to `~/.pi-web`. Unless a more specific path override is configured, PI WEB stores its project and machine registries, locally discovered plugins, default session-daemon socket, and session archives beneath this root.
171
+ <a id="worktree-pre-remove-hook"></a>
172
+ ## 工作区删除前钩子
218
173
 
219
- Each data directory is independent: after pointing PI WEB at a new root, it starts there with empty registries and no session archives. To carry session archives over, stop PI WEB, then copy `archived-sessions.json` and the `archived-sessions/` directory from the old data directory into the new one before starting it again.
174
+ 在删除命令运行的工作区提供可执行 `.pi-web/hooks/worktree-pre-remove`,可清理绑定工作区的开发容器或其他资源。通常从项目主工作区运行,钩子可随仓库提交。
220
175
 
221
- This setting does not change the PI WEB config file selected by `PI_WEB_CONFIG` or Pi-owned state such as the active session files selected by `PI_CODING_AGENT_SESSION_DIR`.
176
+ 存在且可执行时,钩子与删除组成同一终端命令:
222
177
 
223
- ### External path access
224
-
225
- `pathAccess.allowedPaths` grants PI WEB's file explorer and absolute `@` path completions access to specific filesystem roots outside the current workspace.
226
-
227
- By default, workspace-relative file reads stay inside the workspace and absolute paths are denied. Add only roots you trust PI WEB to list and read through the browser UI.
178
+ ```sh
179
+ '<hook path>' '<workspace path>' && <workspace removal command>
180
+ ```
228
181
 
229
- Accepted root forms:
182
+ Git 删除命令为 `git worktree remove '<worktree path>'`。
183
+
184
+ | 契约 | 行为 |
185
+ | --- | --- |
186
+ | 参数 | 恰好一个参数:被删除工作区的绝对路径 |
187
+ | 工作目录 | 删除命令执行的工作区,不是被删除的工作区 |
188
+ | 返回 0 | 继续删除 |
189
+ | 非零退出 | `&&` 失败关闭,工作区保留在磁盘 |
190
+ | 不存在或不可执行 | 当作无钩子,单独执行删除 |
191
+ | 无法探测且不是普通缺失 | 在关闭工作区终端之前失败 |
192
+ | 输出 | 与“删除工作区”终端命令一起展示 |
193
+
194
+ ```sh
195
+ #!/bin/sh
196
+ # .pi-web/hooks/worktree-pre-remove
197
+ set -eu
198
+ worktree_path="$1"
199
+ # 停止绑定该工作区的开发容器,释放项目资源。
200
+ # 非零退出会阻止删除。
201
+ ```
230
202
 
231
- - Unix absolute paths: `/opt/reference`
232
- - Home-relative paths: `~/SDKs`
233
- - Windows absolute paths on Windows hosts: `C:\Users\dev\SDKs`
203
+ 这是不限制工具的项目扩展点,不假定特定容器或资源管理系统。
204
+
205
+ <a id="configuration-matrix"></a>
206
+ ## 配置矩阵
207
+
208
+ “机器”为所选机器;“网关”为当前浏览器连接的机器。`—` 为无配置文件键的纯环境变量。
209
+
210
+ | 配置 | JSON 键 | 环境变量 | 作用域 | 项目行为 / 生效 |
211
+ | --- | --- | --- | --- | --- |
212
+ | 监听地址 | `host` | `PI_WEB_HOST` | 网关 | 无项目键;重启 Web/API |
213
+ | 监听端口 | `port` | `PI_WEB_PORT`、`PORT` | 网关 | 无项目键;重启 Web/API |
214
+ | 开发允许主机 | `allowedHosts` | `PI_WEB_ALLOWED_HOSTS` | 网关开发服务 | 重启开发 Web/UI |
215
+ | 外部路径根 | `pathAccess.allowedPaths` | — | 机器 + 项目 | 全局后加项目,去重;下次文件请求 |
216
+ | 上传目录 | `uploads.defaultFolder` | — | 机器 + 项目 | 项目覆盖;新对话框/拖放批次 |
217
+ | 附件目录 | `attachments.defaultFolder` | — | 机器 + 项目 | 项目覆盖;新附件保存 |
218
+ | 请求大小 | `maxUploadBytes` | `PI_WEB_MAX_UPLOAD_BYTES` | 机器 | Web/API 与 daemon 重启 |
219
+ | 独立会话 | `spawnSessions` | `PI_WEB_SPAWN_SESSIONS` | daemon | 重启 daemon |
220
+ | 跟踪子会话 | `subsessions` | `PI_WEB_SUBSESSIONS` | daemon | 也需要 `spawnSessions`;重启 |
221
+ | 问题表单 | `askUser` | `PI_WEB_ASK_USER` | daemon | 重启 daemon |
222
+ | 扩展对话框超时 | `extensionDialogsTimeoutMs` | — | daemon | 重启 daemon |
223
+ | 环境事实 | `environmentFacts` | `PI_WEB_ENVIRONMENT_FACTS` | daemon | 重启 daemon |
224
+ | 插件期望状态 | `plugins.<id>.enabled/settings` | — | 机器 | 浏览器刷新;服务端重启后刷新 |
225
+ | 项目插件设置 | `plugins.<id>.settings` | — | 机器 + 项目 | 支持的服务端插件顶层覆盖;重启 daemon |
226
+ | Git 发现通知 | `plugins.git.settings.workspaceDiscoveryHooks` | — | 机器 + 项目 | 默认 `true`;重启 daemon |
227
+ | Git 通知 namespace | — | `PI_WEB_INSTANCE_NAMESPACE` | daemon | 默认空;开发为 `dev`;重启 daemon |
228
+ | 插件恢复 | `serverPlugins.safeStart` | — | 机器离线恢复 | 下次 daemon 启动前应用 |
229
+ | 快捷键 | `shortcuts.<actionId>` | — | 网关 | 保存/刷新配置 |
230
+ | 默认主题 | `defaultTheme.themeId/auto` | — | 网关 | 浏览器覆盖优先;保存/刷新配置 |
231
+ | 流式发送默认方式 | `defaultStreamingBehavior` | — | 网关 | `steer` 或 `followUp`;默认 `steer` |
232
+ | 会话命名 | `sessionNaming.model/maxTokens/thinkingLevel/timeoutMs` | — | 机器 | 后续命名请求生效;无项目覆盖 |
233
+ | 归档目的地 | `sessionArchive.directory` | `PI_WEB_SESSION_ARCHIVE_DIR` | daemon | 重启;不迁移既有归档或索引 |
234
+ | 项目版本 | `version` | — | 项目 | 存在时必须为 `1` |
235
+ | 配置文件 | — | `PI_WEB_CONFIG`、`XDG_CONFIG_HOME` | 进程 | 改环境后重启;不是项目配置 |
236
+ | 托管数据 | — | `PI_WEB_DATA_DIR` | Web/API + daemon | 两进程对齐重启;不自动迁移数据 |
237
+ | daemon socket | — | `PI_WEB_SESSIOND_SOCKET` | Web/API + daemon | 两端一致并重启;默认 `$PI_WEB_DATA_DIR/sessiond.sock` |
238
+ | daemon TCP 端口 | — | `PI_WEB_SESSIOND_PORT` | daemon | 重启并同步 Web 的 URL |
239
+ | daemon TCP 主机 | — | `PI_WEB_SESSIOND_HOST` | daemon | 重启 daemon |
240
+ | Web 到 daemon URL | — | `PI_WEB_SESSIOND_URL` | Web/API | 重启 Web/API |
241
+ | 项目注册表 | — | `PI_WEB_PROJECTS_FILE` | Web/API + daemon | 高级状态覆盖;两进程重启 |
242
+ | 远端注册表 | — | `PI_WEB_MACHINES_FILE` | Web/API | 高级状态覆盖;重启 Web |
243
+ | Pi 状态目录 | — | `PI_CODING_AGENT_DIR` | daemon | 重启;包/插件/共享 agent 设置使用该目录 |
244
+ | Pi 会话目录 | — | `PI_CODING_AGENT_SESSION_DIR` | daemon | 独立会话存储覆盖;重启 |
245
+ | 跳过版本检查 | — | `PI_WEB_SKIP_VERSION_CHECK`、`PI_SKIP_VERSION_CHECK` | Web/API | 重启 Web;不禁止模型目录刷新 |
246
+ | 离线 | — | `PI_WEB_OFFLINE`、`PI_OFFLINE` | Web/API + daemon | 两进程重启;也禁用模型目录网络刷新 |
247
+ | Docker 开发 socket | — | `PI_WEB_DEV_SESSIOND_SOCKET` | Docker 开发环境 | 默认 `/data/pi-web/sessiond-dev.sock`;生成配置和健康检查使用此值,不改变生产 socket |
248
+
249
+ <a id="key-details"></a>
250
+ ## 关键细节
251
+
252
+ <a id="ordinary-mode-tool-audit"></a>
253
+ ### 普通模式工具审计
254
+
255
+ 保留 Pino/服务日志,同时将普通模式工具调用元数据存入 `$PI_WEB_DATA_DIR/audit/normal-tool-calls.sqlite`;管理调用不进入该数据库。行包含会话、工作区、工具/call ID、起止时间、耗时及 `started`、`completed`、`failed`、`interrupted` 状态,不保存参数、结果、提示词、模型回复或凭据。
256
+
257
+ `auditLog.normalMode.enabled` 默认 `true`,`retentionDays` 默认 `90`,`maxRows` 默认 `500000`。daemon 启动和每 24 小时清理;数据库错误记日志,不停止工具。WAL 允许 daemon 活跃时读取;优雅关闭和下次启动将未完成调用标记为 interrupted。改变配置重启 daemon。
234
258
 
235
- When an absolute request is served, PI WEB expands `~`, canonicalizes the configured roots with `realpath`, requires roots to be existing directories, and rejects symlink escapes outside the allowed roots.
259
+ ```bash
260
+ pi-web audit list --since 24h
261
+ pi-web audit list --status failed --since 7d
262
+ pi-web audit stats --since 30d
263
+ pi-web audit export --since 30d --format csv --output audit.csv
264
+ pi-web audit prune --before 2026-05-01
265
+ pi-web audit vacuum
266
+ ```
236
267
 
237
- In **Settings → General**, external filesystem roots are saved on the selected machine. Gateway host, port, and allowed-hosts fields stay on the gateway config.
268
+ <a id="management-mode-elasticsearch-audit"></a>
269
+ ### 管理模式 Elasticsearch 审计
238
270
 
239
- This is not a sandbox for the underlying Pi Coding Agent or your OS user. It only controls PI WEB UI/API file exposure outside a workspace.
271
+ 保留服务日志,可通过 `auditLog.managementMode.enabled: true` 与 `baseUrl`(或 `PI_WEB_AUDIT_ES_URL`)开启 Elasticsearch。认证只读 daemon 环境:`PI_WEB_AUDIT_ES_API_KEY` 优先,基本认证须同时有 `PI_WEB_AUDIT_ES_USERNAME`/`PI_WEB_AUDIT_ES_PASSWORD`;URL 禁止携带凭据。
240
272
 
241
- ### Manual upload defaults
273
+ 按上海日历 ISO 周写入如 `pi-web-management-audit-2026-w32` 的索引,`indexPrefix` 默认 `pi-web-management-audit`,`retentionDays` 默认 `365`。daemon 安装严格模板,经 Bulk API 批写,启动/每日维护;上海日历每月首次成功维护删除早于截止的 `@timestamp` 文档。
242
274
 
243
- The Files panel can upload one or more files in two ways:
275
+ 记录 `user.id`、`user.root_user_id`、实际工作区所属授权项目、Pi 会话和适用的 Workbench Agent Session。受限和完整特权管理会话均在 `content` 中保留用户问题文本、模型可见回复(排除 `thinking` 块)、工具参数和结果;该字段只存储、不建立索引。服务日志仍仅记录元数据,管理调用不进入普通模式 SQLite。Workbench 专项能力、知识检索、Skill 事件仍只存固定资源版本、授权修订、run/trace ID、状态、耗时、重试或结果数量等元数据;同一调用作为工具执行时,其参数与结果按工具审计保存。不额外记录认证状态中的令牌、API key、cookie 或票据。
244
276
 
245
- - Drop files onto the Files panel to upload immediately to the workspace-effective default folder.
246
- - Use the toolbar **Upload** button to open the review dialog, edit the destination, and opt into upload options.
277
+ ES 错误记日志,不停止管理会话。有界内存队列重试,并在优雅关闭刷写;崩溃可能丢失尚未送达记录。正文及工具内容可能含敏感数据,须用 ES/Kibana 索引权限限制审计访问。共享跨进程配置保持 Web/API 与 daemon 一致;升级审计实现后需手动重启 `pi-web-sessiond.service`。
247
278
 
248
- `uploads.defaultFolder` sets the workspace-effective default destination. The built-in default is `.pi-web/uploads`; a global config value applies to every project unless `<project>/.pi-web/config.json` sets a project-local override.
279
+ <a id="workbench-and-mcp-integration"></a>
280
+ ### Workbench 与 MCP 集成
249
281
 
250
- ```json
251
- {
252
- "uploads": {
253
- "defaultFolder": "manual/uploads"
254
- }
255
- }
256
- ```
282
+ `workbenchIntegration` 是管理嵌入的受控适配器,不限制普通会话。`baseUrl` 为服务器可访问的 Workbench 后端 origin,`mcpUrl` 为 MCP Streamable HTTP endpoint,两者必需。环境覆盖:`PI_WEB_WORKBENCH_URL`、`PI_WEB_MCP_URL`、`PI_WEB_WORKBENCH_TIMEOUT_MS`、`PI_WEB_MCP_TIMEOUT_MS`、`PI_WEB_SKILL_BUNDLE_MAX_BYTES`、`PI_WEB_SKILL_FILE_MAX_BYTES`、`PI_WEB_SKILL_FILE_COUNT_MAX`。
257
283
 
258
- The value must be a non-empty workspace-relative folder. PI WEB normalizes repeated separators and backslashes to `/`, and rejects absolute paths or `..` traversal. In the upload dialog only, clearing the destination field uploads that batch to the workspace root.
284
+ 默认 request/capability 超时 10000/30000ms、Skill bundle/file 上限 10485760/2097152 字节、文件数 200。适配器把一次性管理 token 换成私有 Agent Session,仅加载授权固定资源快照;并发同 entry token 复用该 Agent Session。
259
285
 
260
- Manual uploads use the workspace file-write path: paths stay workspace-relative, parent folder creation is enabled by default, and overwrite is disabled by default. Direct drag/drop always keeps `overwrite` off; the review dialog lets you explicitly enable overwrite when needed. Browser-owned XHR progress is shown per batch/file, conflicts and errors stay visible in the upload progress UI, and the final file-write response is the source of truth.
286
+ 受控工具为 `icnoc_search_capabilities`、`icnoc_call_capability`、`workbench_search_knowledge`、`workbench_retrieve_knowledge`、`workbench_retrieve_bookstack`、管理文件工具与 Bubblewrap 隔离的 `python`。知识访问经后端短期一次性 token,PI WEB 不配置 RAGFlow/BookStack 服务凭据,工具不接受 tenant/dataset ID。来源链接不是连接配置。全局开关允许时再提供 spawn/跟踪子会话/ask_user,子会话继承管理上下文及显式拒绝。
261
287
 
262
- For machine federation, Settings saves the global upload default on the selected machine. Current remote PI WEB servers also return `workspace.effectiveConfig.uploads.defaultFolder` on the existing workspace-list response. Older remote servers can omit that optional field without breaking clients; the Files panel falls back to the global/default upload folder.
288
+ Python 与受限 bash 默认无网络,只绑定管理工作区及必要的只读运行库;bash 可在该工作区沙盒内执行命令,不默认暴露其他宿主目录。通用 MCP、HTTP、Web 搜索、宿主 shell 和交互终端默认拒绝。签名 token 的 `privileged.bash`/`privileged.network` 仅在机器 `managementEmbed.allowPrivileged: true`(默认 false)时生效;仅 tools.allow 不足以获得特权。单项授权仍采用受限模式,tools.allow/deny 继续有效:仅 bash 授权可提供工作区可写、其他宿主目录只读的沙盒;仅网络授权可启用 http/webfetch/websearch 并移除管理 Python/bash/terminal-command-runs 的 `--unshare-net`,但不增加宿主文件可见性。
263
289
 
264
- The per-request size limit is still controlled by `maxUploadBytes` / `PI_WEB_MAX_UPLOAD_BYTES` on the machine serving the upload.
290
+ **完整特权管理会话**要求机器 `managementEmbed.allowPrivileged: true`,且签名 token 的 `privileged.bash` 与 `privileged.network` 都为 true。此时代理使用与普通模式相同的 SDK 工具及资源加载机制,忽略管理 token 的 tools.allow/deny,不再应用管理工具的工作区沙盒和资源过滤。管理嵌入会话直接通过项目信任,无需普通页面预先批准,也不改写普通模式的信任决定。其宿主文件读写、网络和已配置 MCP 等能力受运行 daemon 的系统账号和普通权限配置约束,不代表自动获取操作系统 root 权限。
265
291
 
266
- ### Pi-compatible agent profile and companion CLI
292
+ 此模式不注册管理专属工作台工具及其“L0 只读能力”指令,不以工作台资源续期作为代理启动门槛,也不强制同步工作台 Skills 或覆盖项目 Relay 模板。工具定义和系统提示由普通会话相同的加载路径生成;已有项目文件不自动删除或改写,仍按普通模式加载。工作台外部服务自身的授权规则不会因此被改写。
267
293
 
268
- PI WEB embeds Pi Coding Agent `0.84.x` or newer compatible runtime packages. The session daemon owns one resolved Pi state directory and refuses to start a second daemon against the same `PI_WEB_DATA_DIR`; use distinct data and endpoint variables for another instance.
294
+ 平台标记的管理 AGENTS 指令,以及与签名上下文明确匹配的旧平台指令,不加入完整特权代理的系统提示;原文件不删除,用户自行编写的项目或全局指令保留。操作者的普通权限策略配置继续生效,不安装“全允许”策略,也不清空其环境配置。此切换仅影响代理运行时,不改变浏览器交互终端端点的独立授权。
269
295
 
270
- `agent.command` selects the Pi-compatible companion CLI used by `pi-web doctor` and, when it can be generated safely, package-managed update commands. It defaults to `pi`. This setting does **not** replace the embedded runtime: every session continues to use PI WEB's bundled Pi SDK.
296
+ 完整特权不改变管理身份、独立模型认证及偏好存储、审计或子会话管理上下文,也不允许普通会话连接读取管理会话。Web/API 与 daemon 的特权配置须一致。仅向受信任的签名入口发放双授权;旧管理 allow/deny 不能限制这种完整特权会话。
271
297
 
272
- `agent.dir` selects the Pi-compatible state profile used for auth providers, models, settings, sessions, Pi packages, and Pi-package-backed PI WEB plugin discovery. It defaults to `~/.pi/agent` only for a canonical Pi companion command. The directory must use the data layout supported by the bundled Pi SDK; PI WEB does not load or convert incompatible fork formats, migrate profile data, or repartition PI WEB-managed archives when the profile changes.
298
+ Skill bundle 只从 MCP origin 下载,校验授权固定版本与 manifest,写入管理项目 `.pi/skills/`;token/票据不离开服务端。受限管理会话只加载所属项目允许范围内的 Skills;SDK 按名称去重时,被全局同名技能遮蔽的授权项目副本仍会恢复加载。启动及 `/reload` 时同步所属工作区的 `relay`、`relay-runner`,使用当前安装包随 SDK 适配的模板。项目 `.pi/skills/relay/` 与 `.pi/skills/relay-runner/` 是平台保留目录,其中旧模板会更新;其他自定义 Skill 不覆盖。普通模式及完整特权管理模式保留普通 SDK 资源加载行为,不执行这项模板同步。
273
299
 
274
- ```json
275
- {
276
- "agent": {
277
- "command": "pi-lab",
278
- "dir": "/opt/pi-profiles/lab"
279
- }
280
- }
281
- ```
300
+ 完整特权管理会话在启动和 `/reload` 时仅清理确认是平台原样下发的项目 Relay 副本,改由已启用的内置 Relay 包提供技能。清理只匹配当前模板或已知历史模板,且目录中必须仅有普通文件 `SKILL.md`;用户改过的内容、额外文件、符号链接及其他自定义 Skill 均保留,真实同名冲突仍会提示。取消特权后,下次创建或重载受限管理会话会按上述受限模式规则重新下发当前模板;旧特权会话不会运行中自动降权,应停止使用并通过新的授权入口进入。普通模式不执行此清理。升级此行为需重启 `pi-web-sessiond.service`,不改变现有特权授权与沙箱规则。
282
301
 
283
- An alternate command always requires an explicit state directory. The command must be a safe bare executable name such as `pi-lab` or a host-absolute executable path such as `/opt/pi/bin/pi`; relative paths, shell expressions, and launcher strings are rejected. The state directory must be host-absolute or start with `~`. In a federated save, the gateway transports Unix and Windows absolute paths without reinterpreting them, and the target machine validates and returns the persisted profile.
302
+ `workbench_search_knowledge` 检索授权元数据,可用 provider=ragflow/bookstack;RAGFlow 内容用 retrieve_knowledge,BookStack 用 retrieve_bookstack,参数 resource_name、简洁 question、可选 resource_version=live、top_k 默认 8/最大 20。通过后端 `POST /api/knowledge-access/bookstack/retrieval` 读取独立授权的已发布书籍当前非草稿页,不编辑、不提供语义检索。返回纯文本、修订、更新时间、源 URL 与 knowledge:// 引用;truncated 表示搜索/文本限制,不保证包含所有匹配。上限五批各 100 候选、每页 8000 字符、总 40000。源链接仍需要读者自身浏览器权限,工具不授予 BookStack 登录。
284
303
 
285
- Environment variables take precedence over the config file. For the state directory, precedence is `PI_WEB_AGENT_DIR` > `PI_CODING_AGENT_DIR` > `agent.dir` > the Pi default. For session storage, `PI_WEB_AGENT_SESSION_DIR` remains first for compatibility, followed by `PI_CODING_AGENT_SESSION_DIR`. The resolved directory is exported as `PI_CODING_AGENT_DIR` to embedded Pi processes.
304
+ 先部署支持资源快照、knowledge token 和检索 endpoint 的 Workbench 后端,再更新 PI WEB;BookStack 凭据只在后端,不新增 PI WEB BookStack 配置。工具更新重启 daemon;共享 endpoint/limit 改变重启两进程。签名 `projects[].agentsInstructions` 仅在项目 AGENTS.md 不存在时独占创建,已有内容不覆盖,无此字段仍兼容,普通项目不受影响。
286
305
 
287
- `environmentFacts` controls factual system-prompt sections appended only to ordinary sessions. These describe PI WEB session nesting and, when the daemon runs in Docker, the observed container filesystem, persistent mounts, host access, and development mount shape. `PI_WEB_ENVIRONMENT_FACTS` takes precedence and accepts `0|1|true|false`; the default is enabled. Set it to `false` to disable all such sections, restart the session daemon, and start a new session. Existing sessions retain the prompt they started with. Management-embed sessions do not receive these ordinary-session facts.
306
+ <a id="managed-data-directory"></a>
307
+ ### 托管数据目录
288
308
 
289
- The session daemon resolves the persisted desired values plus its environment once at startup. That secret-free active profile stays fixed for the daemon lifetime. **Settings → Session daemon** saves command and directory together as desired configuration and shows whether the profile is active, needs a restart, or cannot be compared. Until the daemon restarts, sessions, Pi package operations, Pi-package-backed PI WEB plugin discovery, status/install detection, and update planning continue to use the daemon-owned active profile; a web/API restart recovers that same active profile instead of applying the newly saved values.
309
+ 默认 `~/.pi-web` 保存项目/机器注册表、本地插件、默认 daemon socket、归档索引及项目认证/偏好。新目录是独立实例,没有原注册表和归档,不自动迁移。需要迁移时先停服务,复制 `archived-sessions.json` 和每条记录指向的归档内容,包括自定义目的地;仅复制默认 `archived-sessions/` 不保证完整。
290
310
 
291
- If the session daemon cannot report a valid active profile, profile-dependent Pi package and PI WEB plugin operations report unavailable instead of falling back to independently resolved config. A package-managed update command is shown only when PI WEB can preserve the active profile with a recognized, safe Pi companion CLI; otherwise the command is omitted. Remote profile editing likewise requires advertised support, and the gateway rejects a remote save if the target does not return the requested profile. Restart the session daemon on the selected machine to establish the next active profile.
311
+ 一个目录只能有一个活跃 daemon。第二实例需要独立数据目录、daemon endpoint 和 Web 端口。过期所有权通常自动恢复;启动仍拒绝时,必须先确认所报进程已退出,再按错误提示处理 `sessiond-owner.json`。不要删除活跃所有权文件。
292
312
 
293
- ### Pi extension provider baseline
313
+ 所有权标记更新使用短时互斥目录 `sessiond-owner.json.lock`,不会按年龄自动抢占。若启动/停止进程在更新期间崩溃,后续操作会明确报锁冲突;必须确认没有 daemon 正在启动或停止,才可删除该残留空目录后重试。升级这一保护机制时,先完整停止旧 daemon,再启动新版本,避免旧版本绕过互斥保护。
294
314
 
295
- This policy applies to **Pi runtime extensions**, not PI WEB browser plugins. Pi extensions are runtime modules loaded by the session daemon and can call `pi.registerProvider(...)`; PI WEB plugins are browser-side UI modules and never run in the session daemon.
315
+ 该变量不改变 `PI_WEB_CONFIG` 或 Pi 自有会话存储。
296
316
 
297
- PI WEB shares one model runtime across all sessions. When the session daemon starts, before any project resources load, it initializes global Pi extensions from the active agent profile (`agent.dir`), including extensions supplied by globally configured Pi packages. Provider registrations made by synchronous or awaited asynchronous extension factories during this bootstrap join the shared baseline. PI WEB captures both config-form registrations (`pi.registerProvider("id", config)`) and native-provider registrations (`pi.registerProvider(provider)`), alongside Pi built-ins, environment credentials, and providers from the active agent directory's `models.json`.
317
+ <a id="agent-process-environment"></a>
318
+ ### 代理进程环境
298
319
 
299
- After startup capture, a provider's connection settings are fixed for the daemon lifetime. Later attempts to add a provider, replace an existing provider's configuration, register a native provider, or unregister a provider are no-ops, regardless of source or provider ID. This includes project extensions attempting to add or replace a provider, lifecycle callbacks such as `session_start`, and `/reload`. Non-provider Pi extension features continue to load and reload normally.
320
+ 普通代理 shell、终端和子会话继承 daemon 环境;移除 `NODE_ENV`、`PORT`,避免 daemon 生产设置影响开发命令。PATH、HOME、代理变量和 `PI_WEB_*` 保留。daemon 导出已解析的 `PI_CODING_AGENT_DIR`/`PI_CODING_AGENT_SESSION_DIR`;运行时读取共享 agent 设置与会话路径,但模型认证仍遵循 owning-project registry,不能由子进程环境说明推断普通项目共享凭据。
300
321
 
301
- #### Model list refresh for a known provider
322
+ 会话启动的进程继承 `PI_WEB_SESSION=1`,表示处于现有 PI WEB 中。继承变量指向当前实例;误启动第二实例会因活跃数据目录所有权失败。刻意运行独立实例必须另设目录、endpoint 和端口。
302
323
 
303
- One narrow update is applied after startup: a provider captured in the baseline may refresh **its own model list**. Extensions that fetch an updated catalog typically re-send their complete provider configuration, so PI WEB compares the incoming registration against the recorded baseline and applies it only when both hold:
324
+ 系统提示词默认包含嵌套及 Docker 布局事实,提醒不要从需要保留的会话内重启宿主 daemon,并在受支持的开发重启中先启动 Web/API。可用 `environmentFacts: false` 或 `PI_WEB_ENVIRONMENT_FACTS=false` 禁用。管理嵌入仍使用受控工具和既定 Bubblewrap/网络/宿主权限策略,不直接继承普通模式工具权限。
304
325
 
305
- - the provider ID is already in the startup baseline, and
306
- - every field except the model list is unchanged — `name`, `baseUrl`, `apiKey`, `api`, `streamSimple`, `headers`, `authHeader`, `oauth`, and `refreshModels`.
326
+ <a id="external-path-access"></a>
327
+ ### 外部路径访问
307
328
 
308
- Anything else stays a no-op, including a provider that was not in the baseline and a known provider whose credentials, base URL, or API surface differ from startup. Function-valued fields cannot be compared by value, so a registration that supplies a new `streamSimple`, `refreshModels`, or `oauth` implementation is treated as a change and ignored.
329
+ 默认相对读取只在工作区内,绝对路径拒绝。`pathAccess.allowedPaths` 允许浏览器文件面板和绝对 `@` 补全列出/读取指定外部根。
309
330
 
310
- An applied refresh becomes the new comparison point, so a provider can refresh repeatedly. Re-sending an unchanged model list is a replay rather than an update and is ignored. Refreshed models are visible to sessions immediately; no restart and no network request is involved, because the extension has already produced the catalog.
331
+ 允许 Unix 绝对路径 `/opt/reference`、家目录相对 `~/SDKs`、Windows 宿主上的 `C:\Users\dev\SDKs`。展开 `~`,通过 `realpath` 规范化根,要求存在目录,拒绝符号链接逃逸。不支持相对根。设置保存在所选机器,网关网络设置仍在网关。
311
332
 
312
- Model lists are shared daemon-wide state. If extensions in two workspaces register different model lists for the same provider ID, the last registration wins. A model entry may also carry its own `baseUrl` and `headers`, which take precedence over the provider-level values for that model, so an accepted refresh can change where requests for those models are sent. Both are accepted trade-offs: a catalog is treated as a property of the provider rather than of the project, and Pi extensions are trusted daemon code.
333
+ 这不是普通 Pi 代理或 OS 用户的沙箱,只约束浏览器/API 外部文件暴露。
313
334
 
314
- #### Provider decisions in the daemon log
335
+ <a id="manual-upload-defaults"></a>
336
+ ### 手动上传默认目录
315
337
 
316
- Ignored mutations are written to the session-daemon log once per operation and provider ID, so a replaying extension cannot flood the log. Applied model list refreshes are logged every time, with the resulting model count, because each one changes shared runtime state. Neither entry contains provider configuration or credentials, and PI WEB does not show a session warning or notification.
338
+ 文件面板支持多文件:直接拖放立即上传到工作区有效目录;“上传”按钮打开审核对话框,可修改目录和选项。默认 `.pi-web/uploads`,项目 `uploads.defaultFolder` 覆盖机器默认值。
317
339
 
318
- This prevents accidental provider, configuration, or credential contamination between projects; it is not a security boundary because Pi extensions remain trusted daemon code.
340
+ 目录非空且必须相对工作区;重复分隔符和反斜线规范化为 `/`,绝对路径与 `..` 逃逸拒绝。仅审核对话框允许清空目录,把该批次上传到工作区根。默认创建父目录,不覆盖已有文件;审核可显式覆盖,直接拖放从不覆盖。进度展示完成、冲突和错误。联邦使用目标机器/项目目录,大小限制由服务上传的机器控制。
319
341
 
320
- Configure providers before the daemon starts: use the active agent directory's `models.json`, or install the Pi extension globally in that agent profile. Project Pi extensions and project-level `models.json` files cannot add providers to PI WEB's shared baseline. After updating PI WEB—or after installing, removing, or updating a global Pi extension that registers providers—manually restart `pi-web-sessiond.service` (`systemctl --user restart pi-web-sessiond`). Restarting only the web/API service and running `/reload` do not rebuild the baseline.
342
+ <a id="prompt-attachment-defaults"></a>
343
+ <a id="prompt-attachments"></a>
344
+ ### 提示词附件默认目录
321
345
 
322
- ### Background model catalog refresh
346
+ 附件投递“保存到…”把文件写入工作区,并在提示词中引用路径,不以内联方式附加内容。默认 `.pi-web/attachments`,项目 `attachments.defaultFolder` 覆盖机器默认值;格式/逃逸规则与上传目录一致。显式附件 API 请求目录优先于配置。联邦设置保存在目标机器,编辑器使用有效项目目录。
323
347
 
324
- PI WEB shares one model runtime across all sessions, and provider model catalogs are refreshed over the network only on the session daemon's own background schedule. Requests never start a catalog fetch of their own, so a slow or unreachable provider cannot stall opening the model selector, starting a session, or the auth dialogs on its own account.
348
+ <a id="agent-state-directory"></a>
349
+ <a id="agent-runtime"></a>
350
+ <a id="pi-compatible-agent-profile-and-companion-cli"></a>
351
+ ### Pi 状态目录与本地兼容输入
325
352
 
326
- A refresh that is *already* in flight can still briefly delay starting or opening a session, because the shared runtime is read while that refresh is running. PI WEB says so while you wait: the session's activity line names the startup step it is on and adds `provider model lists are refreshing` when a background refresh is running at the same time. That note reports what is happening concurrently, not a proven cause.
353
+ 会话复用已安装的 Pi npm SDK。`PI_WEB_PI_PACKAGE_DIR` 显式选择 SDK 包根目录,优先于普通 npm 解析与 PATH 中第一个 `pi`;无 SDK 包的独立二进制不受支持。显式路径无效时直接失败,不回退另一份 Pi。`/pi-web` 将宿主安装传给 CLI,新安装的原生服务保留这个选择;更改后须重装服务定义并重启 Web 与 daemon。doctor 和状态仍分别核对有效安装与 companion CLI,不能把 PATH 上可执行命令当作 SDK 已对齐的证据。
327
354
 
328
- The session daemon runs the refresh:
355
+ 标准 `PI_CODING_AGENT_DIR`(默认 `~/.pi/agent`)选择共享 agent 设置、包与默认会话路径;`PI_CODING_AGENT_SESSION_DIR` 可独立指定会话路径。这些变量与 SDK 安装目录不同,不新增配置文件键。
329
356
 
330
- - **15 seconds after the daemon starts**, then **hourly**. Pi treats stored catalogs as fresh for four hours, so most hourly ticks make no network request at all; the shorter tick only makes sure a due refresh is not delayed to the next tick.
331
- - **Immediately after a provider login or logout**, bypassing that freshness window, because the cached catalog is known to be wrong.
357
+ ```sh
358
+ PI_CODING_AGENT_DIR=/opt/pi-profiles/lab
359
+ PI_CODING_AGENT_SESSION_DIR=/opt/pi-profiles/lab-sessions
360
+ ```
332
361
 
333
- Each run is bounded: it is aborted after **60 seconds**, and a run that times out or cannot reach a provider earns **one retry after five minutes**; a provider that answers with an error status is retried on the next scheduled refresh instead. Failures never clear the stored catalogs — the last successfully fetched models stay in use and the daemon log records what failed. A refresh in flight is also aborted when the daemon shuts down.
362
+ 目录必须符合所选 SDK 数据布局;不转换不兼容格式,不迁移 profile,也不移动 PI WEB 归档。
334
363
 
335
- Models fetched by a background refresh appear the next time a client asks for the model list, so a model selector left open across a refresh may need to be reopened.
364
+ daemon 启动时解析并固定目录,终端、bash、子会话使用相同值。运行期间改变环境不生效;包管理、插件发现、状态/安装识别和更新计划仍使用 daemon 的有效目录。Web 重启恢复同一有效目录,不独立解析新值。daemon 无法报告有效目录时,相关操作不可用,不自行回退。仅有效目录和可执行 companion CLI 都具备时提供包管理更新命令,并固定目录。
336
365
 
337
- To turn the background refresh off entirely, set `PI_WEB_OFFLINE` or `PI_OFFLINE` in the session daemon's environment and restart it. In offline mode PI WEB performs no provider catalog network requests, including after logins, and sessions use the catalogs already stored in the agent profile. The `PI_WEB_SKIP_VERSION_CHECK` and `PI_SKIP_VERSION_CHECK` keys do **not** affect this refresh; they only suppress PI WEB release checks.
366
+ 本地保留旧 `agent.command`/`agent.dir`、`PI_WEB_AGENT_COMMAND`/`PI_WEB_AGENT_DIR`/`PI_WEB_AGENT_SESSION_DIR` 和 Windows command/sessionDirEnvKeys 扩展,用于已有内部配置与 companion 行为;不扩展或拒绝上游两字段公开 v2 profile,不自动重写用户配置。弃用输入通过诊断提示,迁移请使用标准 Pi 环境变量;改变内部有效目录或命令仍需重启 daemon。
338
367
 
339
- ### Session daemon tools
368
+ <a id="pi-extension-provider-baseline"></a>
369
+ ### Pi 扩展提供器基线
340
370
 
341
- `spawnSessions` controls whether agents receive the `spawn_session` tool. It defaults to `true`; set it to `false` if you do not want an agent to start independent PI WEB sessions.
371
+ 普通模式提供器归属于注册项目的 `ProjectAuthService` 模型 registry,而不是全机共享;同项目工作区共享,其他项目和管理模式隔离。基线由 Pi 内置提供器、环境凭据、该项目托管 `models.json` 及全局 Pi 扩展/包建立;首次项目文件复制规则见[配置文件](#config-files)。PI WEB 工作区插件是另一概念。
342
372
 
343
- `subsessions` controls whether agents receive the tracked-subsession tools: `spawn_subsession`, `list_subsessions`, `check_subsession`, `read_subsession`, and `yield_to_subsessions`. It defaults to `true` and also requires `spawnSessions` to be enabled.
373
+ 连接设置在对应运行时基线建立后固定。项目扩展和 `/reload` 不能新增、替换或删除提供器;扩展其他功能正常加载与刷新。全局提供器定义、凭据/连接配置或实现变化需要手动重启 daemon,Web 重启和 `/reload` 不重建基线。
344
374
 
345
- Tracked subsessions are join-oriented. Calling `spawn_subsession` returns immediately, so the parent can continue independent work while the child runs. Work whose result the parent does not need to join belongs in the fire-and-forget `spawn_session` tool instead.
375
+ 虚拟模型的 router 捕获会话上下文,不能存入同项目工作区共享的 registry。PI WEB 在全局扩展 bootstrap 前即拒绝 `registerVirtualModel`/`unregisterVirtualModel`,后续会话中也不能重新注册;使用物理模型。诊断不包含模型定义或 ID。
346
376
 
347
- A tracked subsession always runs in the spawning session's working directory, so it stays in that workspace's session tree next to its parent. `spawn_subsession` takes no `cwd`. For work in another workspace, use `spawn_session` to create an independent session there.
377
+ 已知提供器仅模型列表变化、其他设置保持不变时可立即接受刷新,无需重启。更新按精确 registry 身份应用,只影响 owning project;同项目两个工作区注册不同列表时后注册者生效,不影响别的项目。模型条目可带 `baseUrl`/`headers`,覆盖该模型的提供器值;扩展仍是可信进程内代码,不是安全沙箱。
348
378
 
349
- At a join point, after finishing its independent work, the parent calls `yield_to_subsessions` alone as the final action in its tool batch. Pi ends a tool batch early only when every result in that batch is terminating. If any tracked child is still working, the action ends the current agent run so the parent becomes idle. If none are working, it does not end the run and clearly reports that there is nothing to wait for.
379
+ daemon 日志记录忽略的配置变更与模型列表应用,不输出提供器配置或凭据,不生成浏览器通知。管理 registry 独立;不能为对齐上游全局刷新而恢复跨项目共享。
350
380
 
351
- A completion notice wakes an idle parent or queues behind in-flight work. Each notice lists any other tracked children still working, so the parent can continue work or call `yield_to_subsessions` again at the next join point. Further notices arrive automatically; do not poll. The notice includes the child's final output when it fits. If that output is too long, PI WEB omits it entirely instead of adding a truncated duplicate to the parent's context and directs the parent to retrieve it with `check_subsession`.
381
+ <a id="background-model-catalog-refresh"></a>
382
+ <a id="catalog-refresh"></a>
383
+ ### 后台模型目录刷新
352
384
 
353
- `list_subsessions`, `check_subsession`, and `read_subsession` never yield or change control flow. They are for deliberate inspection or recovery, not completion polling. While a child works, agent-facing `check_subsession` and `read_subsession` withhold partial output and direct the parent to continue independent work or yield at the join point. Output becomes available when the child stops. Included output and transcripts follow a labeled marker and come last, after PI WEB guidance.
385
+ 目录网络刷新由 daemon 后台调度,请求自身不发起目录抓取,慢提供器不单独阻塞模型选择、启动或认证对话框。已在途刷新可能短暂影响对应 runtime 状态读取;会话活动行说明启动步骤及并发目录刷新,这是并发提示,不断言因果。
354
386
 
355
- `spawn_session` 和 `spawn_subsession` 都接受可选的 `model` 参数,其值必须是精确的 `provider/model-id`,例如 `anthropic/claude-sonnet-4-5`。设置后,新会话会使用该模型,而不是继承发起会话的模型。匹配是严格的:未知值或格式错误的值会被拒绝并返回错误。用户可以在提示词中通过 `#provider/model-id` 引用指定模型(见[提示词补全](#prompt-completions)),代理会将该引用作为此参数传递。新会话还会继承发起会话当前的思考级别,并根据所选模型的能力自动限制该级别。
387
+ - daemon 启动 **15 秒**后首次运行,随后**每小时**检查。Pi 已保存目录四小时内视为新鲜,多数检查不联网。
388
+ - 登录/注销后按精确项目 registry 立即刷新,绕过新鲜度;管理 registry 独立。
389
+ - 每次最多 **60 秒**,超时/不可达五分钟后**只重试一次**;HTTP 错误留到下次计划。
390
+ - 失败不清空目录,保留最后成功结果并记日志;daemon 关闭会中止在途刷新。
391
+ - 下次请求模型列表才见新目录,已打开选择器可需重新打开。
392
+ - 设置 daemon 环境 `PI_WEB_OFFLINE` 或 `PI_OFFLINE` 后重启,完全禁止目录联网,包括登录后刷新;读取对应存储已有目录。
393
+ - `PI_WEB_SKIP_VERSION_CHECK`/`PI_SKIP_VERSION_CHECK` 只抑制版本检查,不禁止目录刷新。以上离线/跳过标记任意非空值(包括字符串 `0`、`false`)都启用,清空或移除才关闭。
356
394
 
357
- In **Settings → Session daemon**, these keys are saved on the selected machine. Restart the session daemon on that machine after changing them.
395
+ <a id="project-trust-for-project-local-resources"></a>
396
+ ### 项目信任
358
397
 
359
- #### `askUser` and `ask_user`
398
+ 普通模式每次启动都先遵循 Pi 项目信任,再加载 `.pi/extensions/*`、`.pi/settings.json` 的包及其他项目资源,不能用配置关闭信任门槛。已有 `respectProjectTrust` 已移除,配置保存时移除该废弃键;读取不改写文件,也不会自动把已有项目设为可信。
360
399
 
361
- `askUser` controls whether agents receive the core `ask_user` tool. It defaults to `true`; set it to `false`, or set `PI_WEB_ASK_USER=false`, to remove the tool. The environment override accepts `0|1|true|false` and takes precedence over the config file.
400
+ 优先级与 Pi 无交互提示时一致:没有需要信任资源则正常加载;全局扩展 `project_trust` 决定优先,可请求 `remember` 写入 agent `trust.json`;否则已保存决定优先;最后 `defaultProjectTrust` 的 `always` 加载,`never`/`ask` 跳过(没有浏览器运行时信任弹窗)。
362
401
 
363
- Use **Settings → Session daemon → Allow agents to ask questions** to change `askUser` on the selected machine. An environment override makes the toggle read-only.
402
+ 添加项目可显式勾选“信任此项目”,不操作不写决定;工作区菜单可切换“已信任”。服务器解析授权工作区路径,远端保存于远端。下次运行时创建/打开读决定,既有运行时不立即重新加载,`/reload` 保留运行时信任状态。项目 auth/model/preferences 存储不迁入 trust;管理嵌入不读取/写入普通信任 API,继续独立授权资源与沙箱。
364
403
 
365
- The tool accepts one set of 1–20 questions. Each question has a unique `id`, its `question` text, optional supporting `detail`, up to 12 options with stable values and user-facing labels, and an optional `multiple` flag. The browser always adds a **Custom** free-text answer, including when the model supplies no options. No question is required: the user may leave any of them unanswered.
404
+ <a id="session-daemon-tools"></a>
405
+ <a id="session-tools"></a>
406
+ ### 会话守护进程工具
366
407
 
367
- Calling `ask_user` posts the whole set as one browser form and ends the current agent run instead of waiting for the user. The open form is owned by the session daemon, so it survives a browser disconnect, browser reload, or web/API restart while that daemon keeps running. When the user submits, the answers arrive as a follow-up that wakes the session; each question is reported with its selected option values or free text, or explicitly as unanswered.
408
+ `spawnSessions` 默认 `true`,提供 `spawn_session`,在同一项目其他工作区发起独立会话,发起后不向父会话回传结果。`subsessions` 默认 `true`,同时要求 `spawnSessions`,提供跟踪子会话工具。子会话始终使用父 cwd,`spawn_subsession` 没有 `cwd`;其他工作区使用独立 `spawn_session`。
368
409
 
369
- PI WEB confirms a partial submission before sending it and names the unanswered questions. Only one ask can be open per session: a later `ask_user` call supersedes the earlier one, reports that fact and its unanswered questions to the model, and turns the earlier card into a read-only transcript record. Submitted and cancelled asks likewise remain readable in the transcript.
410
+ 跟踪子会话完成会自动通知/唤醒空闲父会话,无需轮询。父会话可继续独立工作,或在 join 点单独调用 `yield_to_subsessions` 作为批次最后动作:仍有工作则结束当前代理运行,没有工作则明确报告且不结束。`list_subsessions`、`check_subsession`、`read_subsession` 用于有意检查,不更改控制流;工作期间隐藏部分输出,完成后输出可用。过长完成结果不重复截断进上下文,指引使用 `check_subsession`。
370
411
 
371
- Sending an ordinary chat message while a form is open voids the form: the card closes as cancelled and the model is told its questions went unanswered as part of the turn the message itself starts.
412
+ 两种 spawn 都支持精确 `provider/model-id` 的 `model`;未知/错误格式拒绝。省略时继承父模型,思考级别也继承并限制到模型能力。`#provider/model-id` 引用表达用户模型选择,不自动改变当前会话。
372
413
 
373
- Restart the session daemon after changing `askUser` or after upgrading PI WEB to a version that introduces this tool. For the systemd user service, run `systemctl --user restart pi-web-sessiond`.
414
+ `askUser` 默认 `true`,可在 **设置 → 会话守护进程** 切换。问题表单支持 1–20 问,每问最多 12 选项、可选多选、始终可自定义文本,可以不回答。普通消息取消开放表单,新表单替代旧表单;daemon 仍活跃时开放表单可跨浏览器/Web 重启保留。修改开关或升级工具实现需重启 daemon。管理生成子会话仍保留原管理上下文及显式工具拒绝。
374
415
 
416
+ <a id="extension-dialogs"></a>
375
417
  ### 扩展对话框
376
418
 
377
- Pi 扩展可以通过 `ctx.ui.confirm()`、`ctx.ui.select()` 和 `ctx.ui.input()` 向用户提问,包括从 `session_start` 钩子以及运行中的 `tool_call` 钩子发起。PI WEB 会在会话记录中以内联方式显示这些对话框,并通过独立的会话守护进程通道返回回答,不经过提示词队列,因此等待回答的 `tool_call` 钩子不会阻塞运行。对话框支持始终启用,没有单独的启用开关。行为细节和扩展开发说明见 [PI WEB 中的 Pi 扩展对话框](https://pi-web.dev/plugins#pi-extension-dialogs)。
378
-
379
- `extensionDialogsTimeoutMs` 是无人处理对话框时的安全超时:会话守护进程等待回答的最长时间,超时后将以对应类型的取消值结束对话框(确认框为 `false`,选择框和输入框为 `undefined`)。默认值为 `300000`(5 分钟);设为 `0` 时永久等待。扩展自身设置的 `timeout` 仍然生效,最终期限取两者中较早的时间。
419
+ 扩展 `ctx.ui.confirm()`/`select()`/`input()` 以内联卡片显示,包括会话启动和运行中工具钩子。支持始终启用,无单独开关;回答走 daemon 独立通道,不经过提示词队列。详见[插件说明](https://pi-web.dev/plugins#pi-extension-dialogs)。
380
420
 
381
- 该配置项直接在全局配置文件中编辑。修改后需要重启会话守护进程;使用 systemd 用户服务时运行 `systemctl --user restart pi-web-sessiond`。
421
+ `extensionDialogsTimeoutMs` 默认 `300000`(五分钟),`0` 无限等待,与扩展自己的 timeout 取较早期限。取消值为确认 `false`,选择/输入 `undefined`。全局配置编辑后重启 daemon。
382
422
 
383
- ### Plugin config
423
+ <a id="pi-web-plugin-config-and-recovery"></a>
424
+ <a id="plugin-config"></a>
425
+ ### 插件配置与恢复
384
426
 
385
- The `plugins` key is only for PI WEB browser plugin enablement/settings on the machine whose config you are editing. It does not install, remove, or update Pi packages; use **Settings → Pi packages** or Pi's package manager for package operations. In a federated setup, **Settings → PI WEB plugins** and **Settings → Pi packages** both target the currently selected machine, and each panel labels where changes will be saved or run.
386
-
387
- Plugins are enabled by default. Set `plugins.<id>.enabled` to `false` to remove a plugin from that machine's `/pi-web-plugins/manifest.json` before the browser imports it. Settings lists discovered plugins from the selected machine, including disabled entries exposed by that machine.
427
+ `plugins` 控制纯浏览器、纯服务端与双入口的期望启用状态和 JSON 设置,不管理 Pi 包安装。默认启用,包可声明 `defaultEnabled: false`,Captain's Log 如此;显式配置覆盖包默认。必需 `pi-web.terminal` 普通启动不能禁用,设置中不可编辑。服务端设置启动时生效,诊断不暴露设置值。
388
428
 
389
429
  ```json
390
430
  {
391
431
  "plugins": {
392
- "workspace-tasks": { "enabled": true, "settings": {} },
432
+ "git": { "enabled": true, "settings": {} },
433
+ "workspace-tasks": { "enabled": true },
393
434
  "updates": { "enabled": false }
394
435
  }
395
436
  }
396
437
  ```
397
438
 
398
- Reload the browser tab after changing plugin enablement. Already-loaded plugin JavaScript is not unloaded from the current page.
439
+ 保存或换包改变期望状态,不替换运行代码。禁用服务端插件及配套 UI 可在重启前仍运行;包/设置不匹配、健康或兼容异常时暂缓配套 UI。设置区分期望与实际状态,daemon 不可用时实际状态不可用。混合版本不支持,远端插件/Git 可不可用或 404;网关/目标一起升级,重启更新的 Web/API 与目标 daemon 后刷新。不能回退到网关。
399
440
 
400
- ### Shortcut config
441
+ 顺序:安装/更新目标包 → 保存期望配置 → 纯浏览器刷新;服务端则手动重启目标 daemon、等就绪、再刷新。重启可能中断活跃会话和所有权。仅浏览器刷新、Web/UI 自动重载、Web/API 重启、Pi `/reload` 都不激活服务端变化。
401
442
 
402
- Shortcut values are keyed by action id. Values are shortcut strings such as `mod+k` or `mod+g p`; `null` disables that action's shortcut.
443
+ 恢复 CLI 离线编辑全局配置,不连接 daemon、不发现/导入包、不带机器凭据;直接在目标机器运行,自定义配置加 `--config /path/to/config.json`:
444
+
445
+ ```bash
446
+ pi-web plugins disable <plugin-id> --restart
447
+ pi-web plugins safe-start show
448
+ pi-web plugins safe-start set bundled-only --restart
449
+ pi-web plugins safe-start set none --restart
450
+ pi-web plugins safe-start clear --restart
451
+ ```
452
+
453
+ `disable` 保存 `enabled: false`,但拒绝必需终端。`bundled-only` 在发现/导入之前过滤外部插件,仍要求终端;`none` 跳过全部服务端插件,保留内核项目目录与诊断/设置,无终端工作流。`clear` 下次恢复普通发现。不支持的 safeStart 形状/值按 `none` 失败关闭,通过 show/set/clear 修复。
454
+
455
+ `--restart` 只执行识别的安全安装计划,否则打印手动指引。先持久化再重启,服务管理器失败后手动重启。一般失败尽可能隔离,但插件共享 daemon event loop,不是真正崩溃隔离;bundled-only 绕过外部失败,none 连内置失败也绕过,改变后仍需重启。
456
+
457
+ <a id="keyboard-shortcuts"></a>
458
+ <a id="shortcut-config"></a>
459
+ ### 快捷键
460
+
461
+ `shortcuts.<actionId>` 值如 `mod+k`、`g p`、`shift+enter`,`null` 禁用该动作。
403
462
 
404
463
  ```json
405
464
  {
406
465
  "shortcuts": {
407
466
  "core:view.chat": "mod+1",
408
- "core:session.stop": null
467
+ "core:session.stop": null,
468
+ "app.navigation.focus-projects": "g p",
469
+ "composer.send.desktop": "mod+enter",
470
+ "composer.send.mobile": "shift+enter"
409
471
  }
410
472
  }
411
473
  ```
412
474
 
413
- Prefer Settings → Keyboard for editing shortcuts interactively.
475
+ 从 **设置 → 键盘** 编辑、录制、禁用或重置。`mod` 为 Ctrl/⌘,浏览器/系统可占用组合。应用支持单键和序列;无修饰键及仅 Shift 的绑定不在 input/textarea/select/contenteditable 内开始。序列 1.2 秒到期,Escape/焦点变化取消;自定义优先,同优先级按 action ID;短绑定遮蔽同前缀长序列。
414
476
 
415
- ## 提示词补全
477
+ 编辑器发送绑定只接受一个组合。宽度 >760px 默认 Enter;宽度 ≤760px 默认 Shift+Enter,键仍为 `composer.send.mobile`,不因宽屏触控或粗指针改用窄屏规则。未分配 Enter/Shift+Enter 插入换行;普通 Enter 优先接受选中补全。编辑器内发送绑定优先于应用快捷键,空草稿或不可发送时也如此。`null` 禁用键盘提交,不禁用按钮。
416
478
 
417
- 聊天输入框会在键入以下三个触发字符时打开补全菜单:
479
+ 对应绑定未配置前保留浏览器旧 Enter 偏好,重置回该回退;不把旧偏好自动复制到共享配置。触屏键盘自动首字母大写不视为 Shift。
480
+
481
+ <a id="prompt-completions"></a>
482
+ ## 提示词补全
418
483
 
419
- - 在草稿开头键入 `/` 可补全会话命令。
420
- - `@` 用于补全文件路径:`@` 显示已跟踪文件,`@ `(先键入 `@`,再键入空格)或 `!@` 显示所有文件。选中后会把 `@path` 引用插入草稿;路径包含空格时会自动加引号。
421
- - `#` 用于补全当前会话可用的模型;输入时不区分大小写地筛选,最多显示 12 项。选中后会把 `#provider/model-id` 引用插入草稿,提示代理应使用该模型执行请求,例如作为 `spawn_session` 的 `model` 参数。
484
+ - 草稿开头 `/` 补全会话命令。参数提示显示在名称旁,选择后一次性灰色提示在下次编辑/移动光标时消失。
485
+ - `@` 补全已跟踪文件;`@ `(at 后空格)或 `!@` 补全全部文件。选择插入路径引用,含空格自动加引号。
486
+ - `#` 补全当前会话可用模型,不区分大小写,最多 12 项。选择插入 `#provider/model-id`,指引代理使用模型,例如 spawn 的 model 参数。
422
487
 
423
- ## Optional completion tools
488
+ <a id="completion-tools"></a>
489
+ <a id="optional-completion-tools"></a>
490
+ ## 补全工具
424
491
 
425
- File and path `@` completions work without extra tools. If `fzf` is available on the PI WEB server's `PATH`, PI WEB uses it to improve completion filtering/ranking; otherwise it falls back to built-in ranking.
492
+ 可在服务器 PATH 安装 `fzf` 改善文件补全排序;不安装也能补全,`rg` 用于文件发现。