@jmfederico/pi-web 1.202608.0 → 1.202608.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +4 -4
  2. package/dist/cli.js +287 -113
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/assets/CodeViewer-BMWwxG7q.js +4 -0
  5. package/dist/client/assets/{TerminalPanel-fYrKc3jh.js → TerminalPanel-CacQDIYn.js} +6 -6
  6. package/dist/client/assets/index-DUW2xnoV.js +4279 -0
  7. package/dist/client/assets/vendor-editor-core-CXO8gGab.js +12 -0
  8. package/dist/client/assets/vendor-editor-languages-CpW4sJsX.js +46 -0
  9. package/dist/client/index.html +3 -3
  10. package/dist/config.js +110 -73
  11. package/dist/config.js.map +1 -1
  12. package/dist/docker/piWebDockerCommandPlan.js +4 -3
  13. package/dist/docker/piWebDockerCommandPlan.js.map +1 -1
  14. package/dist/environment.js +4 -0
  15. package/dist/environment.js.map +1 -0
  16. package/dist/nativeServices/installedServiceDefinitions.js +602 -0
  17. package/dist/nativeServices/installedServiceDefinitions.js.map +1 -0
  18. package/dist/nativeServices/serviceAction.js +174 -0
  19. package/dist/nativeServices/serviceAction.js.map +1 -0
  20. package/dist/nativeServices/serviceDoctor.js +374 -71
  21. package/dist/nativeServices/serviceDoctor.js.map +1 -1
  22. package/dist/nativeServices/servicePlan.js +1 -1
  23. package/dist/nativeServices/servicePlan.js.map +1 -1
  24. package/dist/{pi-web-plugins → pi-packages}/relays/markdownDocument.js +1 -1
  25. package/dist/pi-packages/relays/package.json +11 -0
  26. package/dist/{pi-web-plugins → pi-packages}/relays/pi-web-plugin.js +4 -4
  27. package/dist/pi-packages/relays/prompts/relay-worktree.md +157 -0
  28. package/dist/pi-packages/relays/prompts/relay.md +152 -0
  29. package/dist/{pi-web-plugins → pi-packages}/relays/relayDiscovery.js +1 -1
  30. package/dist/{pi-web-plugins → pi-packages}/relays/relaysPanelElement.js +1 -1
  31. package/dist/pi-packages/relays/skills/relay/SKILL.md +123 -0
  32. package/dist/pi-web-plugins/git/browser/git-contract.js +108 -0
  33. package/dist/pi-web-plugins/git/browser/git-panel.js +609 -0
  34. package/dist/pi-web-plugins/git/browser/gitFileList.js +43 -0
  35. package/dist/pi-web-plugins/git/browser/gitFileShared.js +16 -0
  36. package/dist/pi-web-plugins/git/browser/gitFileTree.js +81 -0
  37. package/dist/pi-web-plugins/git/browser/gitFileViewPreference.js +35 -0
  38. package/dist/pi-web-plugins/git/browser/gitRoute.js +42 -0
  39. package/dist/pi-web-plugins/git/browser/pi-web-plugin.js +10 -0
  40. package/dist/pi-web-plugins/git/browser/unifiedDiff.js +301 -0
  41. package/dist/{server/git/gitService.js → pi-web-plugins/git/git-backend.js} +209 -60
  42. package/dist/pi-web-plugins/git/package.json +16 -0
  43. package/dist/pi-web-plugins/git/server-plugin.js +176 -0
  44. package/dist/pi-web-plugins/info/infoInternals.js +16 -2
  45. package/dist/pi-web-plugins/info/package.json +1 -1
  46. package/dist/pi-web-plugins/info/pi-web-plugin.js +2 -2
  47. package/dist/pi-web-plugins/updates/package.json +1 -1
  48. package/dist/pi-web-plugins/updates/pi-web-plugin.js +1 -1
  49. package/dist/pi-web-plugins/workspace-tasks/package.json +1 -1
  50. package/dist/pi-web-plugins/workspace-tasks/pi-web-plugin.js +3 -3
  51. package/dist/piWebVersionReport.js +63 -10
  52. package/dist/piWebVersionReport.js.map +1 -1
  53. package/dist/plugin-api.d.ts +33 -16
  54. package/dist/pluginRecoveryCli.js +172 -0
  55. package/dist/pluginRecoveryCli.js.map +1 -0
  56. package/dist/server/activity/workspaceActivityService.js +27 -19
  57. package/dist/server/activity/workspaceActivityService.js.map +1 -1
  58. package/dist/server/app.js +41 -15
  59. package/dist/server/app.js.map +1 -1
  60. package/dist/server/configRoutes.js +3 -21
  61. package/dist/server/configRoutes.js.map +1 -1
  62. package/dist/server/knownAutoInstallPiPackages.js +30 -0
  63. package/dist/server/knownAutoInstallPiPackages.js.map +1 -0
  64. package/dist/server/machines/machineClient.js +23 -4
  65. package/dist/server/machines/machineClient.js.map +1 -1
  66. package/dist/server/machines/machinePluginProxyRoutes.js +74 -17
  67. package/dist/server/machines/machinePluginProxyRoutes.js.map +1 -1
  68. package/dist/server/machines/machineProxyRoutes.js +165 -8
  69. package/dist/server/machines/machineProxyRoutes.js.map +1 -1
  70. package/dist/server/machines/machineService.js +23 -0
  71. package/dist/server/machines/machineService.js.map +1 -1
  72. package/dist/server/piPackageIdentity.js +25 -0
  73. package/dist/server/piPackageIdentity.js.map +1 -0
  74. package/dist/server/piPackageService.js +69 -8
  75. package/dist/server/piPackageService.js.map +1 -1
  76. package/dist/server/piWebPluginCatalog.js +584 -0
  77. package/dist/server/piWebPluginCatalog.js.map +1 -0
  78. package/dist/server/piWebPluginLifecycle.js +162 -0
  79. package/dist/server/piWebPluginLifecycle.js.map +1 -0
  80. package/dist/server/piWebPluginService.js +159 -261
  81. package/dist/server/piWebPluginService.js.map +1 -1
  82. package/dist/server/piWebStatus.js +41 -9
  83. package/dist/server/piWebStatus.js.map +1 -1
  84. package/dist/server/plugins/pluginBackendProxyRoutes.js +69 -0
  85. package/dist/server/plugins/pluginBackendProxyRoutes.js.map +1 -0
  86. package/dist/server/plugins/serverPluginExec.js +184 -0
  87. package/dist/server/plugins/serverPluginExec.js.map +1 -0
  88. package/dist/server/plugins/serverPluginRuntime.js +480 -0
  89. package/dist/server/plugins/serverPluginRuntime.js.map +1 -0
  90. package/dist/server/projectTrustRoutes.js +80 -0
  91. package/dist/server/projectTrustRoutes.js.map +1 -0
  92. package/dist/server/projects/projectService.js +3 -1
  93. package/dist/server/projects/projectService.js.map +1 -1
  94. package/dist/server/realtime/sessionEventHub.js +26 -11
  95. package/dist/server/realtime/sessionEventHub.js.map +1 -1
  96. package/dist/server/requestCancellation.js +32 -0
  97. package/dist/server/requestCancellation.js.map +1 -0
  98. package/dist/server/sessiond/agentProcessEnvironment.js +29 -30
  99. package/dist/server/sessiond/agentProcessEnvironment.js.map +1 -1
  100. package/dist/server/sessiond/autoInstallPiPackages.js +63 -0
  101. package/dist/server/sessiond/autoInstallPiPackages.js.map +1 -0
  102. package/dist/server/sessiond/pluginBackendRoutes.js +64 -0
  103. package/dist/server/sessiond/pluginBackendRoutes.js.map +1 -0
  104. package/dist/server/sessiond/sessionDaemonShutdown.js +24 -0
  105. package/dist/server/sessiond/sessionDaemonShutdown.js.map +1 -0
  106. package/dist/server/sessiond/sessionProxyRoutes.js +2 -2
  107. package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
  108. package/dist/server/sessiond/sessionServiceDependencies.js +2 -1
  109. package/dist/server/sessiond/sessionServiceDependencies.js.map +1 -1
  110. package/dist/server/sessiond/sessiondStateOwnership.js +235 -0
  111. package/dist/server/sessiond/sessiondStateOwnership.js.map +1 -0
  112. package/dist/server/sessiond/workspaceCatalogRoutes.js +31 -0
  113. package/dist/server/sessiond/workspaceCatalogRoutes.js.map +1 -0
  114. package/dist/server/sessiond/workspaceRemovalRoutes.js +41 -0
  115. package/dist/server/sessiond/workspaceRemovalRoutes.js.map +1 -0
  116. package/dist/server/sessiond.js +284 -98
  117. package/dist/server/sessiond.js.map +1 -1
  118. package/dist/server/sessions/authService.js +15 -54
  119. package/dist/server/sessions/authService.js.map +1 -1
  120. package/dist/server/sessions/dockerEnvironmentFacts.js +254 -0
  121. package/dist/server/sessions/dockerEnvironmentFacts.js.map +1 -0
  122. package/dist/server/sessions/modelCatalogRefresher.js +4 -3
  123. package/dist/server/sessions/modelCatalogRefresher.js.map +1 -1
  124. package/dist/server/sessions/piSessionManagerGateway.js +18 -67
  125. package/dist/server/sessions/piSessionManagerGateway.js.map +1 -1
  126. package/dist/server/sessions/piSessionService.js +495 -142
  127. package/dist/server/sessions/piSessionService.js.map +1 -1
  128. package/dist/server/sessions/sessionCommandService.js +24 -1
  129. package/dist/server/sessions/sessionCommandService.js.map +1 -1
  130. package/dist/server/sessions/sessionEnvironmentFacts.js +48 -0
  131. package/dist/server/sessions/sessionEnvironmentFacts.js.map +1 -0
  132. package/dist/server/sessions/sessionFileFormat.js +27 -0
  133. package/dist/server/sessions/sessionFileFormat.js.map +1 -0
  134. package/dist/server/sessions/sessionFileHeader.js +1 -14
  135. package/dist/server/sessions/sessionFileHeader.js.map +1 -1
  136. package/dist/server/sessions/sessionModelScope.js +160 -0
  137. package/dist/server/sessions/sessionModelScope.js.map +1 -0
  138. package/dist/server/sessions/sessionNameGenerator.js +6 -6
  139. package/dist/server/sessions/sessionNameGenerator.js.map +1 -1
  140. package/dist/server/sessions/sessionRoutes.js +55 -0
  141. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  142. package/dist/server/sessions/sessionSummaryScanner.js +96 -224
  143. package/dist/server/sessions/sessionSummaryScanner.js.map +1 -1
  144. package/dist/server/sessions/spawnSubsessionTool.js +5 -9
  145. package/dist/server/sessions/spawnSubsessionTool.js.map +1 -1
  146. package/dist/server/sessions/spawnTargetResolver.js +1 -1
  147. package/dist/server/status/machineStatusRoutes.js +8 -0
  148. package/dist/server/status/machineStatusRoutes.js.map +1 -0
  149. package/dist/server/status/machineStatusService.js +181 -0
  150. package/dist/server/status/machineStatusService.js.map +1 -0
  151. package/dist/server/status/workspaceAttribution.js +87 -0
  152. package/dist/server/status/workspaceAttribution.js.map +1 -0
  153. package/dist/server/storage/piPackageDismissalStore.js +78 -0
  154. package/dist/server/storage/piPackageDismissalStore.js.map +1 -0
  155. package/dist/server/terminalProxyRoutes.js +2 -1
  156. package/dist/server/terminalProxyRoutes.js.map +1 -1
  157. package/dist/server/workspaceExplorerRoutes.js +20 -13
  158. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  159. package/dist/server/workspaces/fileContentService.js +18 -9
  160. package/dist/server/workspaces/fileContentService.js.map +1 -1
  161. package/dist/server/workspaces/filePreviewResponseHeaders.js +18 -0
  162. package/dist/server/workspaces/filePreviewResponseHeaders.js.map +1 -0
  163. package/dist/server/workspaces/filePreviewResponsePolicy.js +55 -0
  164. package/dist/server/workspaces/filePreviewResponsePolicy.js.map +1 -0
  165. package/dist/server/workspaces/filePreviewService.js +81 -0
  166. package/dist/server/workspaces/filePreviewService.js.map +1 -0
  167. package/dist/server/workspaces/projectWorkspaceCwds.js +0 -5
  168. package/dist/server/workspaces/projectWorkspaceCwds.js.map +1 -1
  169. package/dist/server/workspaces/sessionDaemonWorkspaceCatalog.js +402 -0
  170. package/dist/server/workspaces/sessionDaemonWorkspaceCatalog.js.map +1 -0
  171. package/dist/server/workspaces/workspaceCatalog.js +47 -0
  172. package/dist/server/workspaces/workspaceCatalog.js.map +1 -0
  173. package/dist/server/workspaces/workspaceContext.js +1 -3
  174. package/dist/server/workspaces/workspaceContext.js.map +1 -1
  175. package/dist/server/workspaces/workspaceDeletionRoutes.js +35 -125
  176. package/dist/server/workspaces/workspaceDeletionRoutes.js.map +1 -1
  177. package/dist/server/workspaces/workspaceProviderRegistry.js +651 -0
  178. package/dist/server/workspaces/workspaceProviderRegistry.js.map +1 -0
  179. package/dist/server/workspaces/workspaceRemovalService.js +256 -0
  180. package/dist/server/workspaces/workspaceRemovalService.js.map +1 -0
  181. package/dist/server/workspaces/workspaceRouteErrors.js +7 -0
  182. package/dist/server/workspaces/workspaceRouteErrors.js.map +1 -0
  183. package/dist/server/workspaces/worktreePreRemoveHook.js +39 -0
  184. package/dist/server/workspaces/worktreePreRemoveHook.js.map +1 -0
  185. package/dist/server-plugin-api.d.ts +140 -0
  186. package/dist/server-plugin-api.js +2 -0
  187. package/dist/server-plugin-api.js.map +1 -0
  188. package/dist/serverPluginRecovery.js +138 -0
  189. package/dist/serverPluginRecovery.js.map +1 -0
  190. package/dist/sessiond/activeAgentProfile.js +3 -22
  191. package/dist/sessiond/activeAgentProfile.js.map +1 -1
  192. package/dist/sessiond/config.js +11 -0
  193. package/dist/sessiond/config.js.map +1 -1
  194. package/dist/sessiond/sessionDaemonClient.js +11 -9
  195. package/dist/sessiond/sessionDaemonClient.js.map +1 -1
  196. package/dist/shared/activeAgentProfile.js +2 -41
  197. package/dist/shared/activeAgentProfile.js.map +1 -1
  198. package/dist/shared/activity.js +0 -3
  199. package/dist/shared/activity.js.map +1 -1
  200. package/dist/shared/apiTypes.js +7 -5
  201. package/dist/shared/apiTypes.js.map +1 -1
  202. package/dist/shared/capabilities.js +8 -6
  203. package/dist/shared/capabilities.js.map +1 -1
  204. package/dist/shared/federatedRoutes.js +36 -5
  205. package/dist/shared/federatedRoutes.js.map +1 -1
  206. package/dist/shared/machinePluginIds.js +4 -2
  207. package/dist/shared/machinePluginIds.js.map +1 -1
  208. package/dist/shared/machineStatus.js +94 -0
  209. package/dist/shared/machineStatus.js.map +1 -0
  210. package/dist/shared/piWebStatusParsing.js +33 -0
  211. package/dist/shared/piWebStatusParsing.js.map +1 -1
  212. package/dist/shared/pluginApiTypes.d.ts +150 -0
  213. package/dist/shared/pluginApiTypes.js +3 -0
  214. package/dist/shared/pluginApiTypes.js.map +1 -0
  215. package/dist/shared/pluginBackendProtocol.js +110 -0
  216. package/dist/shared/pluginBackendProtocol.js.map +1 -0
  217. package/dist/shared/pluginIds.js +5 -0
  218. package/dist/shared/pluginIds.js.map +1 -1
  219. package/dist/shared/pluginRecoveryCommands.js +14 -0
  220. package/dist/shared/pluginRecoveryCommands.js.map +1 -0
  221. package/dist/shared/workspaceFiles.js +41 -2
  222. package/dist/shared/workspaceFiles.js.map +1 -1
  223. package/dist/shared/workspaceRemovalProtocol.js +24 -0
  224. package/dist/shared/workspaceRemovalProtocol.js.map +1 -0
  225. package/docs/config.md +105 -52
  226. package/docs/plugins.md +403 -146
  227. package/examples/workspace-provider-plugin/README.md +52 -0
  228. package/examples/workspace-provider-plugin/package.json +25 -0
  229. package/examples/workspace-provider-plugin/src/browser/index.ts +69 -0
  230. package/examples/workspace-provider-plugin/src/server.ts +64 -0
  231. package/examples/workspace-provider-plugin/tsconfig.json +21 -0
  232. package/package.json +30 -11
  233. package/server-plugin-api.d.ts +1 -0
  234. package/dist/client/assets/CodeViewer-D91Sp61M.js +0 -4
  235. package/dist/client/assets/UnifiedDiffViewer-BafLWGtF.js +0 -39
  236. package/dist/client/assets/index-CA8q9_o7.js +0 -4025
  237. package/dist/client/assets/vendor-editor-core-vUi74DnD.js +0 -12
  238. package/dist/client/assets/vendor-editor-languages-DoaXUodB.js +0 -46
  239. package/dist/pi-web-plugins/relays/package.json +0 -9
  240. package/dist/plugin-api/unstable.d.ts +0 -22
  241. package/dist/server/activity/workspaceActivityRoutes.js +0 -4
  242. package/dist/server/activity/workspaceActivityRoutes.js.map +0 -1
  243. package/dist/server/git/gitService.js.map +0 -1
  244. package/dist/server/gitRoutes.js +0 -23
  245. package/dist/server/gitRoutes.js.map +0 -1
  246. package/dist/server/sessions/parentSessionLocator.js +0 -75
  247. package/dist/server/sessions/parentSessionLocator.js.map +0 -1
  248. package/dist/server/workspaces/gitWorktreeDiscovery.js +0 -43
  249. package/dist/server/workspaces/gitWorktreeDiscovery.js.map +0 -1
  250. package/dist/server/workspaces/imagePreviewService.js +0 -40
  251. package/dist/server/workspaces/imagePreviewService.js.map +0 -1
  252. package/dist/server/workspaces/workspaceService.js +0 -52
  253. package/dist/server/workspaces/workspaceService.js.map +0 -1
  254. package/dist/shared/apiTypes.d.ts +0 -1217
  255. package/dist/shared/thinkingLevels.d.ts +0 -27
  256. package/plugin-api/unstable.d.ts +0 -1
  257. /package/dist/{pi-web-plugins → pi-packages}/relays/vendor/README.md +0 -0
  258. /package/dist/{pi-web-plugins → pi-packages}/relays/vendor/marked.esm.js +0 -0
@@ -1,1217 +0,0 @@
1
- export type MachineKind = "local" | "remote";
2
- export type MachineStatus = "unknown" | "online" | "offline" | "error";
3
- /**
4
- * Registry of feature-gating capabilities. Currently empty: every component is
5
- * expected to run the current version, so no capability is advertised. Add an
6
- * entry here (plus the runtime/requirements entries in `capabilities.ts`) when
7
- * a future feature needs rolling-version gating again.
8
- */
9
- export declare const PI_WEB_CAPABILITIES: {};
10
- export type PiWebCapability = typeof PI_WEB_CAPABILITIES[keyof typeof PI_WEB_CAPABILITIES];
11
- export interface Machine {
12
- id: string;
13
- name: string;
14
- kind: MachineKind;
15
- baseUrl?: string;
16
- createdAt: string;
17
- updatedAt: string;
18
- status?: MachineStatus;
19
- statusMessage?: string;
20
- }
21
- export interface MachineHealth {
22
- machineId: string;
23
- ok: boolean;
24
- checkedAt: string;
25
- status?: MachineStatus;
26
- web?: PiWebComponentStatus;
27
- sessiond?: PiWebComponentStatus;
28
- error?: string;
29
- }
30
- export interface MachineRuntime {
31
- machineId: string;
32
- ok: boolean;
33
- checkedAt: string;
34
- packageName?: string;
35
- generatedAt?: string;
36
- components?: PiWebRuntimeResponse["components"];
37
- capabilities?: PiWebCapability[];
38
- error?: string;
39
- }
40
- export type PiWebShortcutConfig = Record<string, string | null>;
41
- export type PiWebPluginSettings = Record<string, unknown>;
42
- export type PiWebPluginConfigMap = Record<string, PiWebPluginConfig>;
43
- export interface PiWebPluginConfig {
44
- enabled?: boolean;
45
- settings?: PiWebPluginSettings;
46
- [key: string]: unknown;
47
- }
48
- export interface PiWebPathAccessConfig {
49
- allowedPaths?: string[];
50
- }
51
- export interface PiWebUploadsConfig {
52
- defaultFolder?: string;
53
- }
54
- export interface PiWebAgentConfig {
55
- /** Pi-compatible companion CLI used for diagnostics and safe package-managed updates. */
56
- command?: string;
57
- /** Pi-compatible profile directory containing auth.json, models.json, settings.json, and sessions/. */
58
- dir?: string;
59
- }
60
- export interface PiWebConfigValues {
61
- host?: string;
62
- port?: number;
63
- allowedHosts?: string[] | true;
64
- shortcuts?: PiWebShortcutConfig;
65
- plugins?: PiWebPluginConfigMap;
66
- /** External filesystem roots PI WEB may expose outside a workspace. */
67
- pathAccess?: PiWebPathAccessConfig;
68
- /** Workspace-relative defaults for manual file uploads. */
69
- uploads?: PiWebUploadsConfig;
70
- /** Maximum accepted HTTP request body size in bytes (uploads/attachments). */
71
- maxUploadBytes?: number;
72
- /** When true, LLMs can start new sessions via the spawn_session tool. */
73
- spawnSessions?: boolean;
74
- /**
75
- * Beta: when true, LLMs can start tracked child sessions via the
76
- * spawn_subsession / list_subsessions / check_subsession / read_subsession
77
- * tools. Off by default
78
- * while the capability stabilizes. Requires spawnSessions to be enabled.
79
- */
80
- subsessions?: boolean;
81
- /**
82
- * When true, LLMs can post a question set to the browser via the ask_user
83
- * tool. On by default; set to `false` to remove the tool from the runtime.
84
- */
85
- askUser?: boolean;
86
- /**
87
- * How long an extension dialog may wait for an answer before the daemon
88
- * auto-cancels it, in milliseconds. Applies only when the extension set no
89
- * `timeout` of its own (the sooner of the two wins); `0` waits forever.
90
- * Tuning knob only — extension dialogs are always enabled.
91
- */
92
- extensionDialogsTimeoutMs?: number;
93
- /** Desired Pi-compatible agent profile and companion CLI (Pi by default). */
94
- agent?: PiWebAgentConfig;
95
- }
96
- export type PiWebPluginScope = "bundled" | "local" | "user" | "project";
97
- export interface PiWebPluginInfo {
98
- id: string;
99
- module: string;
100
- source: string;
101
- scope: PiWebPluginScope;
102
- machineSpecific: boolean;
103
- enabled: boolean;
104
- }
105
- export interface PiWebPluginsResponse {
106
- plugins: PiWebPluginInfo[];
107
- }
108
- export type PiPackageScope = "user" | "project";
109
- export interface PiPackageInfo {
110
- source: string;
111
- scope: PiPackageScope;
112
- filtered: boolean;
113
- installedPath?: string;
114
- }
115
- export interface PiPackagesResponse {
116
- packages: PiPackageInfo[];
117
- }
118
- export interface PiPackageInstallRequest {
119
- source: string;
120
- }
121
- export interface PiPackageRemoveRequest {
122
- source: string;
123
- /** Optional known scope from a listed package; not an install-location picker. */
124
- scope?: PiPackageScope;
125
- }
126
- export interface PiPackageUpdateRequest {
127
- /** Omit to update all configured Pi packages. */
128
- source?: string;
129
- }
130
- export type PiPackageMutationAction = "install" | "remove" | "update";
131
- export interface PiPackageMutationResponse extends PiPackagesResponse {
132
- action: PiPackageMutationAction;
133
- source?: string;
134
- scope?: PiPackageScope;
135
- removed?: boolean;
136
- }
137
- export type PiWebAgentDirEnvSource = "pi-web" | "pi-compatibility";
138
- export interface PiWebConfigEnvOverrides {
139
- host: boolean;
140
- port: boolean;
141
- allowedHosts: boolean;
142
- spawnSessions: boolean;
143
- subsessions: boolean;
144
- askUser: boolean;
145
- agentCommand: boolean;
146
- agentDir: boolean;
147
- /** The configured directory environment source, even when Pi compatibility is inactive for the desired command. */
148
- agentDirSource?: PiWebAgentDirEnvSource;
149
- agentSessionDir: boolean;
150
- }
151
- export interface PiWebConfigResponse {
152
- path: string;
153
- exists: boolean;
154
- config: PiWebConfigValues;
155
- effectiveConfig: PiWebConfigValues;
156
- envOverrides: PiWebConfigEnvOverrides;
157
- }
158
- export interface Project {
159
- id: string;
160
- name: string;
161
- path: string;
162
- createdAt: string;
163
- }
164
- export interface WorkspaceEffectiveConfig {
165
- uploads?: PiWebUploadsConfig;
166
- }
167
- export interface Workspace {
168
- id: string;
169
- projectId: string;
170
- path: string;
171
- label: string;
172
- branch?: string;
173
- isMain: boolean;
174
- isGitRepo: boolean;
175
- isGitWorktree: boolean;
176
- /** Workspace-effective project/global settings needed by workspace UI features. Always present on current server workspace responses. */
177
- effectiveConfig: WorkspaceEffectiveConfig;
178
- }
179
- export interface SessionRef {
180
- id: string;
181
- cwd: string;
182
- }
183
- export declare const SESSION_UNREAD_LIMIT = 1000;
184
- export declare const SESSION_UNREAD_SESSION_ID_MAX_LENGTH = 512;
185
- export declare const SESSION_UNREAD_CWD_MAX_LENGTH: number;
186
- export declare const SESSION_UNREAD_CATALOG_ID_MAX_LENGTH = 512;
187
- export declare const SESSION_UNREAD_COMPLETED_AT_MAX_LENGTH = 64;
188
- export interface SessionUnreadSummary {
189
- sessionId: string;
190
- cwd: string;
191
- /** Monotonic within a catalog and never greater than its containing revision. */
192
- completionOrder: number;
193
- completedAt: string;
194
- }
195
- export interface SessionUnreadCatalogSnapshot {
196
- /** Stable for one persisted catalog epoch; changes when unread state is reset. */
197
- catalogId: string;
198
- /** Monotonic catalog mutation revision; at least every contained completion order. */
199
- catalogRevision: number;
200
- /** Bounded by `SESSION_UNREAD_LIMIT` and ordered newest completion first. */
201
- sessions: SessionUnreadSummary[];
202
- }
203
- export interface SessionUnreadAcknowledgeRequest {
204
- cwd: string;
205
- /** The catalog epoch in which `throughCompletionOrder` was observed. */
206
- catalogId: string;
207
- throughCompletionOrder: number;
208
- }
209
- /** Authoritative delta for one session in the daemon-owned unread catalog. */
210
- export interface SessionUnreadEvent {
211
- type: "sessions.unread";
212
- catalogId: string;
213
- /** At least `unread.completionOrder` when carrying an unread summary. */
214
- catalogRevision: number;
215
- sessionId: string;
216
- cwd: string;
217
- unread: SessionUnreadSummary | null;
218
- }
219
- export declare const SESSION_NOTIFICATION_LIMIT = 100;
220
- export declare const SESSION_NOTIFICATION_MESSAGE_BYTES: number;
221
- export type SessionNotificationSeverity = "info" | "warning" | "error";
222
- export interface SessionNotification {
223
- id: string;
224
- message: string;
225
- truncated: boolean;
226
- severity: SessionNotificationSeverity;
227
- receivedAt: string;
228
- order: number;
229
- }
230
- export interface SessionNotificationSummary {
231
- sessionId: string;
232
- cwd: string;
233
- inboxRevision: number;
234
- retainedCount: number;
235
- discardedCount: number;
236
- highestSeverity?: SessionNotificationSeverity;
237
- }
238
- export interface SessionNotificationDismissThrough {
239
- order: number;
240
- overflowWatermark: number;
241
- }
242
- export interface SessionNotificationInboxSnapshot {
243
- daemonInstanceId: string;
244
- catalogRevision: number;
245
- summary: SessionNotificationSummary;
246
- notifications: SessionNotification[];
247
- dismissThrough: SessionNotificationDismissThrough;
248
- }
249
- export interface SessionNotificationCatalogSnapshot {
250
- daemonInstanceId: string;
251
- catalogRevision: number;
252
- sessions: SessionNotificationSummary[];
253
- }
254
- export interface SessionNotificationDismissRequest {
255
- cwd: string;
256
- daemonInstanceId: string;
257
- notificationId: string;
258
- }
259
- export interface SessionNotificationDismissAllRequest {
260
- cwd: string;
261
- daemonInstanceId: string;
262
- throughOrder: number;
263
- throughOverflowWatermark: number;
264
- }
265
- export type SessionNotificationClearReason = "runtime-close" | "archive" | "delete" | "restore" | "archive-reconcile" | "replacement" | "initialization-failed" | "service-dispose";
266
- export type SessionNotificationInboxDelta = {
267
- kind: "added";
268
- notification: SessionNotification;
269
- evictedNotificationId?: string;
270
- } | {
271
- kind: "dismissed";
272
- notificationIds: string[];
273
- } | {
274
- kind: "cleared";
275
- reason: SessionNotificationClearReason;
276
- } | {
277
- kind: "resync";
278
- };
279
- export interface SessionNotificationInboxEvent {
280
- type: "notifications.inbox";
281
- daemonInstanceId: string;
282
- catalogRevision: number;
283
- summary: SessionNotificationSummary;
284
- dismissThrough: SessionNotificationDismissThrough;
285
- delta: SessionNotificationInboxDelta;
286
- }
287
- export interface SessionNotificationSummaryEvent {
288
- type: "notifications.summary";
289
- daemonInstanceId: string;
290
- catalogRevision: number;
291
- summary: SessionNotificationSummary;
292
- }
293
- export interface SessionInfo extends SessionRef {
294
- path: string;
295
- /** True when the server has verified a backing session file exists; false when known transient. */
296
- persisted?: boolean;
297
- name?: string;
298
- created: string;
299
- modified: string;
300
- messageCount: number;
301
- firstMessage: string;
302
- parentSessionPath?: string;
303
- /**
304
- * Working directory of the parent session, read from the parent session file
305
- * header. Only populated when the parent is outside this listing's cwd, so a
306
- * child whose parent lives in another worktree can point at it instead of
307
- * only reporting that the parent is unavailable here.
308
- */
309
- parentSessionCwd?: string;
310
- /** Session id of an out-of-cwd parent, so the browser can select it after switching workspace. */
311
- parentSessionId?: string;
312
- /**
313
- * Number of sessions in other workspaces of the same project that record this
314
- * session as their parent. Only set when non-zero, so a parent can show that
315
- * it has children which are not nested beneath it in this workspace.
316
- */
317
- childSessionsElsewhere?: number;
318
- archived?: boolean;
319
- archivedAt?: string;
320
- }
321
- export interface ArchiveSessionsResponse {
322
- archived: true;
323
- sessionIds?: string[];
324
- archivedCount?: number;
325
- skippedAlreadyArchivedCount?: number;
326
- }
327
- export interface SessionBulkMutationRef {
328
- id: string;
329
- cwd: string;
330
- }
331
- export interface SessionBulkMutationRequest {
332
- sessions: SessionBulkMutationRef[];
333
- }
334
- export interface SessionBulkFailure {
335
- sessionId: string;
336
- error: string;
337
- }
338
- export interface SessionBulkArchiveResponse {
339
- archived: true;
340
- archivedSessionIds: string[];
341
- failures: SessionBulkFailure[];
342
- generatedAt: string;
343
- }
344
- export interface SessionBulkDeleteArchivedResponse {
345
- deleted: true;
346
- deletedSessionIds: string[];
347
- failures: SessionBulkFailure[];
348
- generatedAt: string;
349
- }
350
- export interface SessionCleanupRequest {
351
- /** Archive non-archived sessions whose modified time is older than this many days. Omit/null to disable. */
352
- archiveIdleDays?: number | null;
353
- /** Permanently delete archived sessions whose archivedAt time is older than this many days. Omit/null to disable. */
354
- deleteArchivedDays?: number | null;
355
- /** Stored cwd paths selected from a preview. Omit/null to include all discovered project/workspace paths. */
356
- projectCwds?: string[] | null;
357
- }
358
- export interface SessionCleanupThresholds {
359
- archiveIdleDays?: number;
360
- deleteArchivedDays?: number;
361
- }
362
- export interface SessionCleanupProjectSummary {
363
- cwd: string;
364
- archiveCount: number;
365
- deleteCount: number;
366
- }
367
- export interface SessionCleanupTotals {
368
- archiveCount: number;
369
- deleteCount: number;
370
- }
371
- export interface SessionCleanupPreviewResponse {
372
- generatedAt: string;
373
- thresholds: SessionCleanupThresholds;
374
- projects: SessionCleanupProjectSummary[];
375
- totals: SessionCleanupTotals;
376
- skippedBusySessionIds?: string[];
377
- }
378
- export interface SessionCleanupExecuteResponse extends SessionCleanupPreviewResponse {
379
- archivedSessionIds: string[];
380
- deletedSessionIds: string[];
381
- }
382
- export interface SessionActivity {
383
- sessionId: string;
384
- phase: "active" | "idle" | "error";
385
- label: string;
386
- detail?: string;
387
- at: string;
388
- /**
389
- * Set only on the startup window's own reports. A startup phase is genuinely
390
- * in progress, so it is published as `active` and rendered like any other
391
- * activity, but *starting* a session is not *working* in it: there is nothing
392
- * to stop, nothing that blocks reloading from disk, and no workspace-level
393
- * work to report. `isSessionActive()` reads this to keep the two apart.
394
- */
395
- startup?: boolean;
396
- }
397
- export interface QueuedSessionMessage {
398
- kind: "steer" | "followUp";
399
- text: string;
400
- }
401
- /**
402
- * `customType` of the follow-up custom message that carries a closed ask back to
403
- * the model and into the transcript. Its `details` are an {@link AskUserOutcome}.
404
- */
405
- export declare const ASK_USER_ANSWERS_CUSTOM_TYPE = "pi-web.ask.answers";
406
- /** Largest question set one `ask_user` call may post. */
407
- export declare const ASK_USER_QUESTION_LIMIT = 20;
408
- /** Largest option list one question may offer. */
409
- export declare const ASK_USER_OPTION_LIMIT = 12;
410
- /** Length bound for ids: the ask id, question ids, and option values. */
411
- export declare const ASK_USER_ID_MAX_LENGTH = 128;
412
- /** Length bound for model-authored prose: questions, details, and option labels. */
413
- export declare const ASK_USER_TEXT_MAX_LENGTH = 1000;
414
- /** Length bound for the free text a user types as a custom answer. */
415
- export declare const ASK_USER_OTHER_TEXT_MAX_LENGTH = 4000;
416
- /** One selectable option of an {@link AskUserQuestion}. */
417
- export interface AskUserQuestionOption {
418
- /** Stable machine value reported back to the model. */
419
- value: string;
420
- /** Short human label rendered in the browser. */
421
- label: string;
422
- /** Optional clarifying line rendered under the label. */
423
- detail?: string;
424
- }
425
- /**
426
- * One question of an `ask_user` set. Questions are never required: the user may
427
- * submit while leaving any of them untouched, and unanswered questions are
428
- * reported to the model as such.
429
- */
430
- export interface AskUserQuestion {
431
- /** Unique within the ask; used as the answer key. */
432
- id: string;
433
- /** The question itself, as one plain-text line. */
434
- question: string;
435
- /** Optional supporting context rendered under the question. */
436
- detail?: string;
437
- /** Offered options; may be empty when only free text makes sense. */
438
- options: AskUserQuestionOption[];
439
- /** When true, several options may be selected at once. */
440
- multiple?: boolean;
441
- }
442
- /**
443
- * The open, unanswered question set of a session. Daemon-owned and reported in
444
- * {@link SessionStatus}, so a reconnecting or reloading browser rehydrates it
445
- * without depending on having seen the `ask.opened` event.
446
- */
447
- export interface PendingAskUser {
448
- askId: string;
449
- askedAt: string;
450
- questions: AskUserQuestion[];
451
- }
452
- /** Why an ask stopped being the session's open ask. */
453
- export type AskUserCloseReason = "submitted" | "superseded" | "cancelled";
454
- /**
455
- * What the user replied to one question. Absent from a submission means the
456
- * question was left untouched; an empty `values` with no `otherText` means the
457
- * same thing.
458
- */
459
- export interface AskUserAnswer {
460
- /** Matches an {@link AskUserQuestion.id} of the open ask. */
461
- id: string;
462
- /** Selected {@link AskUserQuestionOption.value} entries; several only when the question allows it. */
463
- values: string[];
464
- /** Free text typed as the question's custom answer. */
465
- otherText?: string;
466
- }
467
- /** One submit of the open ask: answers for some or all of its questions. */
468
- export interface AskUserSubmission {
469
- answers: AskUserAnswer[];
470
- }
471
- /**
472
- * One question of a closed ask paired with what came back for it. Carries the
473
- * question itself so the record renders without the original ask still existing.
474
- */
475
- export interface AskUserQuestionRecord {
476
- question: AskUserQuestion;
477
- /** True when at least one option was selected or custom text was given. */
478
- answered: boolean;
479
- values: string[];
480
- otherText?: string;
481
- }
482
- /**
483
- * The complete result of an ask, computed when it closes. Shared by the
484
- * model-facing follow-up message and the browser's read-only record, so both
485
- * report the same answered and unanswered questions.
486
- */
487
- export interface AskUserOutcome {
488
- askId: string;
489
- reason: AskUserCloseReason;
490
- askedAt: string;
491
- closedAt: string;
492
- questions: AskUserQuestionRecord[];
493
- answeredCount: number;
494
- /** Ids of the questions left unanswered, in the order they were asked. */
495
- unansweredIds: string[];
496
- /** One line, for example `Answered 3 of 5; unanswered: q2, q5`. */
497
- summary: string;
498
- }
499
- /**
500
- * Result of the browser closing an ask by submitting or cancelling it.
501
- *
502
- * `"stale"` is an ordinary race rather than an error: the named ask was already
503
- * submitted, superseded by a newer one, or gone with its session runtime. The
504
- * browser drops its card and trusts `sessionStatus`, which is returned in both
505
- * cases so closing an ask needs no follow-up status request.
506
- */
507
- export interface AskUserCloseResponse {
508
- result: "closed" | "stale";
509
- /** Present only when this call is the one that closed the ask. */
510
- outcome?: AskUserOutcome;
511
- sessionStatus: SessionStatus;
512
- }
513
- /** Length bound for extension-dialog ids. */
514
- export declare const EXTENSION_DIALOG_ID_MAX_LENGTH = 128;
515
- /** Length bound for extension-authored dialog prose: titles, messages, options, placeholders. */
516
- export declare const EXTENSION_DIALOG_TEXT_MAX_LENGTH = 1000;
517
- /** Largest option list one `select` dialog may offer. */
518
- export declare const EXTENSION_DIALOG_OPTION_LIMIT = 24;
519
- /** Length bound for the text a user types into an `input` dialog. */
520
- export declare const EXTENSION_DIALOG_INPUT_MAX_LENGTH = 4000;
521
- /** Which extension UI dialog primitive a pending dialog belongs to. */
522
- export type ExtensionDialogKind = "confirm" | "select" | "input";
523
- /**
524
- * The value a user gave in an extension dialog: a boolean for `confirm`, the
525
- * chosen option for `select`, the typed text for `input`. Absent when the
526
- * dialog closed without an answer.
527
- */
528
- export type ExtensionDialogAnswer = boolean | string;
529
- /**
530
- * Why a dialog stopped being open. `"answered"` carries an
531
- * {@link ExtensionDialogAnswer}; every other reason is a close without one.
532
- */
533
- export type ExtensionDialogCloseReason = "answered" | "cancelled" | "timeout" | "aborted" | "session-ended";
534
- /**
535
- * One open extension dialog of a session, opened by `ctx.ui.confirm()`,
536
- * `ctx.ui.select()`, or `ctx.ui.input()`. Daemon-owned and reported in
537
- * {@link SessionStatus.pendingDialogs}, so a reconnecting or reloading browser
538
- * rehydrates it without depending on having seen the `dialog.opened` event.
539
- *
540
- * Unlike asks, several dialogs may be open per session at once: each dialog is
541
- * an independent blocking wait inside extension code, so opening never
542
- * supersedes an existing one.
543
- */
544
- export interface PendingExtensionDialog {
545
- dialogId: string;
546
- kind: ExtensionDialogKind;
547
- title: string;
548
- /** Supporting line of a `confirm` dialog. */
549
- message?: string;
550
- /** Offered choices of a `select` dialog. */
551
- options?: string[];
552
- /** Placeholder text of an `input` dialog. */
553
- placeholder?: string;
554
- askedAt: string;
555
- /**
556
- * When the dialog auto-cancels, as ISO: the sooner of the extension's own
557
- * `timeout` and the daemon's `extensionDialogsTimeoutMs` default. Absent
558
- * when the dialog waits forever.
559
- */
560
- timeoutAt?: string;
561
- /** Opened while a run was in flight, so `agent_end` settles it as `"aborted"`. */
562
- runScoped: boolean;
563
- }
564
- /**
565
- * The complete result of a closed extension dialog. Unlike an ask outcome it
566
- * stays small — the dialog itself is not embedded, because a settled card is a
567
- * browser-local record that stays until the user dismisses it; reloads
568
- * rehydrate open dialogs from {@link SessionStatus.pendingDialogs} alone.
569
- */
570
- export interface ExtensionDialogOutcome {
571
- dialogId: string;
572
- reason: ExtensionDialogCloseReason;
573
- /** Present only when `reason` is `"answered"`. */
574
- answer?: ExtensionDialogAnswer;
575
- askedAt: string;
576
- closedAt: string;
577
- }
578
- /**
579
- * Browser request to answer an open extension dialog with the user's value.
580
- * `cwd` rides along as the standard session-lookup field, as on every other
581
- * session route; whether the value fits the dialog's kind is the store's call,
582
- * so an ill-fitting answer is a 400 that leaves the dialog open.
583
- */
584
- export interface ExtensionDialogAnswerRequest {
585
- cwd?: string;
586
- dialogId: string;
587
- value: ExtensionDialogAnswer;
588
- }
589
- /** Browser request to dismiss an open extension dialog without an answer. */
590
- export interface ExtensionDialogCancelRequest {
591
- cwd?: string;
592
- dialogId: string;
593
- }
594
- /**
595
- * Result of the browser answering or cancelling an extension dialog. Mirrors
596
- * {@link AskUserCloseResponse}: `"stale"` is an ordinary lost race — another
597
- * browser, a timeout, or a teardown closed the dialog first — not an error.
598
- * The browser drops its card and trusts `sessionStatus`, which is returned in
599
- * both cases so closing a dialog needs no follow-up status request.
600
- */
601
- export interface ExtensionDialogCloseResponse {
602
- result: "closed" | "stale";
603
- /** Present only when this call is the one that closed the dialog. */
604
- outcome?: ExtensionDialogOutcome;
605
- sessionStatus: SessionStatus;
606
- }
607
- /**
608
- * Progress of the session startup window, where the daemon is still
609
- * constructing the agent session and no `PiAgentSession` exists yet, so
610
- * `activity.update` cannot be published for it.
611
- *
612
- * `startupToken` is the opaque label a create request supplied, echoed back so a
613
- * browser row still waiting for a session id recognises its own construction.
614
- * The daemon never interprets it and it never becomes the session id:
615
- * `activity.sessionId` always carries the real id, which is how an *open* of a
616
- * session the browser already knows is routed instead.
617
- *
618
- * `activity.phase === "idle"` means the startup window ended with nothing left
619
- * to report, so a browser that substituted its own text should restore it.
620
- */
621
- export interface SessionStartupProgressEvent {
622
- type: "session.startup";
623
- startupToken?: string;
624
- activity: SessionActivity;
625
- }
626
- /**
627
- * A pi-native image attachment carried with a prompt. The wire format mirrors
628
- * pi's own `ImageContent` shape (`{ type: "image", data, mimeType }`) so these
629
- * attachments are compatible with native multimodal delivery after validation.
630
- */
631
- export interface PromptImageAttachment {
632
- kind: "image";
633
- /** Supported image MIME type (image/png, image/jpeg, image/gif, or image/webp). */
634
- mimeType: string;
635
- /** Base64-encoded binary payload (no data: URL prefix). */
636
- data: string;
637
- /** Optional original filename, used for previews and folder-mode filenames. */
638
- name?: string;
639
- }
640
- /** A general file attachment that must be saved into the workspace before use. */
641
- export interface PromptFileAttachment {
642
- kind: "file";
643
- /** Non-empty IANA MIME type (for example "application/pdf"). */
644
- mimeType: string;
645
- /** Base64-encoded binary payload (no data: URL prefix). Empty for zero-byte files. */
646
- data: string;
647
- /** Optional original filename, used for previews and folder-mode filenames. */
648
- name?: string;
649
- }
650
- export type PromptAttachment = PromptImageAttachment | PromptFileAttachment;
651
- /**
652
- * How prompt attachments should be delivered to the session.
653
- * - "inline": send the binary to pi as native image content (multimodal input).
654
- * - "folder": save the file into the workspace and reference it from the prompt
655
- * text so the agent reads it with its own tools.
656
- */
657
- export type PromptAttachmentDelivery = "inline" | "folder";
658
- export interface SavedPromptAttachment {
659
- /** Workspace-relative path the attachment was written to. */
660
- path: string;
661
- mimeType: string;
662
- size: number;
663
- }
664
- export interface SessionModel {
665
- provider?: string;
666
- id?: string;
667
- name?: string;
668
- contextWindow?: number;
669
- reasoning?: unknown;
670
- }
671
- export type { ThinkingLevel } from "./thinkingLevels.js";
672
- export type AuthType = "oauth" | "api_key";
673
- export type AuthStatusSource = "stored" | "runtime" | "environment" | "fallback" | "models_json_key" | "models_json_command";
674
- export interface AuthProviderStatus {
675
- configured: boolean;
676
- source?: AuthStatusSource;
677
- label?: string;
678
- }
679
- export interface AuthProviderOption {
680
- id: string;
681
- name: string;
682
- authType: AuthType;
683
- status: AuthProviderStatus;
684
- /** Present when the provider logs in through the generic AuthInteraction flow. */
685
- loginFlow?: "interactive";
686
- }
687
- export interface AuthProvidersResponse {
688
- providers: AuthProviderOption[];
689
- }
690
- export interface OAuthFlowState {
691
- flowId: string;
692
- providerId: string;
693
- providerName: string;
694
- status: "running" | "complete" | "error" | "cancelled";
695
- auth?: {
696
- url: string;
697
- instructions?: string;
698
- deviceCode?: {
699
- userCode: string;
700
- intervalSeconds?: number;
701
- expiresInSeconds?: number;
702
- };
703
- };
704
- prompt?: {
705
- requestId: string;
706
- message: string;
707
- placeholder?: string;
708
- allowEmpty?: boolean;
709
- promptType: "text" | "secret" | "manual_code";
710
- };
711
- select?: {
712
- requestId: string;
713
- message: string;
714
- options: CommandOption[];
715
- };
716
- progress: string[];
717
- info?: {
718
- message: string;
719
- links?: {
720
- url: string;
721
- label?: string;
722
- }[];
723
- }[];
724
- error?: string;
725
- }
726
- export interface ModelSelectionResponse {
727
- models: SessionModel[];
728
- }
729
- export interface ThinkingLevelsResponse {
730
- levels: string[];
731
- }
732
- export type SessionWarningSeverity = "info" | "warning" | "error";
733
- /**
734
- * A live, runtime-scoped warning surfaced to the browser (skill/resource
735
- * diagnostics, extension load errors, subscription-auth billing notice, etc.).
736
- *
737
- * Warnings are recomputed whenever the runtime is (re)built inside sessiond and
738
- * are not persisted chat messages. `source` is an optional short origin label
739
- * (e.g. `"skill"`, `"extension"`, `"anthropic"`); `path` carries a related file
740
- * path when the warning came from a resource diagnostic.
741
- *
742
- * `dismiss` is present only when the warning has a durable, first-class
743
- * off-switch in the underlying `pi` agent (not a UI-only hide). Its `id` is the
744
- * opaque token the server maps back to that suppression; the client renders a
745
- * dismiss control for any warning carrying it, without knowing what it means.
746
- */
747
- export interface SessionWarning {
748
- severity: SessionWarningSeverity;
749
- message: string;
750
- source?: string;
751
- path?: string;
752
- dismiss?: {
753
- id: string;
754
- };
755
- }
756
- export interface SessionStatus {
757
- sessionId: string;
758
- /** True when the server has verified a backing session file exists; false when known transient. */
759
- persisted?: boolean;
760
- model?: SessionModel;
761
- thinkingLevel?: string;
762
- isStreaming: boolean;
763
- isCompacting: boolean;
764
- isBashRunning: boolean;
765
- pendingMessageCount: number;
766
- queuedMessages: QueuedSessionMessage[];
767
- messageCount?: number;
768
- tokens: {
769
- input: number;
770
- output: number;
771
- cacheRead: number;
772
- cacheWrite: number;
773
- total: number;
774
- };
775
- cost: number;
776
- contextUsage?: {
777
- tokens: number | null;
778
- contextWindow: number;
779
- percent: number | null;
780
- };
781
- /**
782
- * Live, runtime-scoped warnings for this session (skill/resource diagnostics,
783
- * extension load errors, Anthropic subscription-auth billing notice, etc.).
784
- * Recomputed on each status read from the current runtime; absent/empty when
785
- * there are none. See {@link SessionWarning}.
786
- */
787
- warnings?: SessionWarning[];
788
- /**
789
- * The session's open `ask_user` question set, when one is waiting for the
790
- * user. Daemon-owned, so it survives browser reload and web/API restarts.
791
- */
792
- pendingAsk?: PendingAskUser;
793
- /**
794
- * The session's open extension dialogs, oldest first, when any are waiting
795
- * for the user. Daemon-owned, so they survive browser reload and web/API
796
- * restarts. Several may be open at once; the UI presents them as a queue.
797
- */
798
- pendingDialogs?: PendingExtensionDialog[];
799
- }
800
- export interface WorkspaceActivity {
801
- cwd: string;
802
- hasSessionActivity: boolean;
803
- hasTerminalActivity: boolean;
804
- updatedAt: string;
805
- }
806
- export interface WorkspaceActivityResponse {
807
- workspaces: WorkspaceActivity[];
808
- generatedAt: string;
809
- }
810
- export interface SlashCommand {
811
- name: string;
812
- description?: string;
813
- source: "extension" | "prompt" | "skill" | "builtin";
814
- }
815
- export interface FileSuggestion {
816
- path: string;
817
- kind: "tracked" | "untracked" | "other";
818
- }
819
- export interface FileTreeEntry {
820
- name: string;
821
- path: string;
822
- type: "file" | "directory" | "symlink";
823
- size?: number;
824
- modifiedAt?: string;
825
- }
826
- export interface FileTreeResponse {
827
- path: string;
828
- entries: FileTreeEntry[];
829
- scannedAt: string;
830
- truncated: boolean;
831
- }
832
- export type FileContentMediaType = "image";
833
- export interface FileContentResponse {
834
- path: string;
835
- language?: string;
836
- mediaType?: FileContentMediaType;
837
- mimeType?: string;
838
- encoding: "utf8";
839
- size: number;
840
- modifiedAt: string;
841
- content: string;
842
- truncated: boolean;
843
- binary: boolean;
844
- }
845
- export interface WriteWorkspaceFileOptions {
846
- createDirs?: boolean;
847
- overwrite?: boolean;
848
- }
849
- export interface WriteWorkspaceFileResponse {
850
- path: string;
851
- size: number;
852
- modifiedAt: string;
853
- created: boolean;
854
- }
855
- export interface DeleteWorkspaceFileResponse {
856
- path: string;
857
- existed: boolean;
858
- }
859
- export interface MoveWorkspaceFileOptions {
860
- createDirs?: boolean;
861
- overwrite?: boolean;
862
- }
863
- export interface MoveWorkspaceFileResponse {
864
- fromPath: string;
865
- toPath: string;
866
- size: number;
867
- modifiedAt: string;
868
- }
869
- export type GitFileState = "unmodified" | "modified" | "added" | "deleted" | "renamed" | "copied" | "untracked" | "ignored" | "conflicted";
870
- export interface GitStatusFile {
871
- path: string;
872
- oldPath?: string;
873
- index: GitFileState;
874
- workingTree: GitFileState;
875
- submoduleFromCommit?: string;
876
- submoduleToCommit?: string;
877
- }
878
- export interface GitStatusResponse {
879
- isGitRepo: boolean;
880
- hash: string;
881
- branch?: string;
882
- upstream?: string;
883
- ahead?: number;
884
- behind?: number;
885
- files: GitStatusFile[];
886
- submodules: string[];
887
- }
888
- export interface GitDiffResponse {
889
- path?: string;
890
- staged: boolean;
891
- hash: string;
892
- diff: string;
893
- truncated: boolean;
894
- }
895
- export interface TerminalInfo {
896
- id: string;
897
- cwd: string;
898
- name: string;
899
- createdAt: string;
900
- exited: boolean;
901
- exitCode?: number;
902
- commandRunId?: string;
903
- }
904
- export type TerminalCommandRunStatus = "queued" | "running" | "succeeded" | "failed";
905
- export interface TerminalCommandRun {
906
- id: string;
907
- origin: string;
908
- projectId: string;
909
- workspaceId: string;
910
- terminalId: string;
911
- title: string;
912
- command: string;
913
- status: TerminalCommandRunStatus;
914
- exitCode?: number;
915
- createdAt: string;
916
- startedAt?: string;
917
- completedAt?: string;
918
- metadata: Record<string, string>;
919
- }
920
- export interface RunTerminalCommandInput {
921
- workspace: Workspace;
922
- title: string;
923
- command: string;
924
- metadata?: Record<string, string>;
925
- open?: boolean;
926
- }
927
- export interface TerminalCommandRunHandle {
928
- run: TerminalCommandRun;
929
- completed: Promise<TerminalCommandRun>;
930
- }
931
- export interface TerminalCommandRunFilter {
932
- projectId?: string;
933
- workspaceId?: string;
934
- terminalId?: string;
935
- statuses?: TerminalCommandRunStatus[];
936
- metadata?: Record<string, string>;
937
- }
938
- export type PiWebServiceComponent = "web" | "sessiond";
939
- export type PiWebStatusSeverity = "info" | "warning" | "error";
940
- export type PiWebInstallationKind = "pi-package" | "npm-global" | "local" | "docker" | "unknown";
941
- export type PiWebDockerMode = "runtime" | "dev";
942
- export interface PiWebInstallationInfo {
943
- kind: PiWebInstallationKind;
944
- path?: string;
945
- source?: string;
946
- scope?: "user" | "project";
947
- npmRoot?: string;
948
- dockerMode?: PiWebDockerMode;
949
- }
950
- export interface PiWebComponentStatus {
951
- component: PiWebServiceComponent;
952
- label: string;
953
- runtimeVersion?: string;
954
- installedVersion?: string;
955
- stale: boolean;
956
- available: boolean;
957
- installation?: PiWebInstallationInfo;
958
- error?: string;
959
- }
960
- /** Secret-free identity of the Pi-compatible CLI/state profile fixed for one sessiond lifetime. */
961
- export interface ActiveAgentProfileDescriptor {
962
- readonly schemaVersion: 1;
963
- readonly revision: string;
964
- readonly command: string;
965
- readonly dir: string;
966
- readonly sessionDirEnvKeys: readonly string[];
967
- }
968
- export interface PiWebRuntimeComponent {
969
- component: PiWebServiceComponent;
970
- label: string;
971
- runtimeVersion?: string;
972
- available: boolean;
973
- capabilities: PiWebCapability[];
974
- /** Present only for a session daemon that supports active-profile reporting. */
975
- activeAgentProfile?: ActiveAgentProfileDescriptor;
976
- error?: string;
977
- }
978
- export interface PiWebReleaseStatus {
979
- packageName: string;
980
- latestVersion?: string;
981
- updateAvailable: boolean;
982
- checkedAt?: string;
983
- skipped?: boolean;
984
- error?: string;
985
- }
986
- export interface PiWebStatusMessage {
987
- id: string;
988
- severity: PiWebStatusSeverity;
989
- title: string;
990
- body: string;
991
- command?: string;
992
- }
993
- export interface PiWebVersionResponse {
994
- packageName: string;
995
- generatedAt: string;
996
- components: {
997
- web: PiWebComponentStatus;
998
- sessiond: PiWebComponentStatus;
999
- };
1000
- }
1001
- export interface PiWebRuntimeResponse {
1002
- packageName: string;
1003
- generatedAt: string;
1004
- components: {
1005
- web: PiWebRuntimeComponent;
1006
- sessiond: PiWebRuntimeComponent;
1007
- };
1008
- capabilities: PiWebCapability[];
1009
- }
1010
- export interface PiWebStatusResponse extends PiWebVersionResponse {
1011
- release: PiWebReleaseStatus;
1012
- commands: {
1013
- update?: string;
1014
- restart?: string;
1015
- restartWeb?: string;
1016
- restartSessiond?: string;
1017
- status?: string;
1018
- };
1019
- messages: PiWebStatusMessage[];
1020
- }
1021
- export type TerminalUiEvent = {
1022
- type: "terminal.created";
1023
- terminal: TerminalInfo;
1024
- } | {
1025
- type: "terminal.exited";
1026
- terminal: TerminalInfo;
1027
- } | {
1028
- type: "terminal.closed";
1029
- terminalId: string;
1030
- cwd: string;
1031
- };
1032
- export interface WorkspaceActivityUiEvent {
1033
- type: "workspace.activity";
1034
- activity: WorkspaceActivity;
1035
- }
1036
- export interface CommandOption {
1037
- value: string;
1038
- label: string;
1039
- description?: string;
1040
- }
1041
- export type SessionTreeNodeKind = "user" | "assistant" | "tool-result" | "bash" | "custom-message" | "compaction" | "branch-summary" | "model-change" | "thinking-level-change" | "session-info" | "label" | "custom" | "other";
1042
- export interface SessionTreeNode {
1043
- id: string;
1044
- parentId: string | null;
1045
- kind: SessionTreeNodeKind;
1046
- summary: string;
1047
- timestamp?: string;
1048
- label?: string;
1049
- }
1050
- export interface SessionTreeSnapshot {
1051
- /** Pre-order, parent-linked projection of all retained roots and descendants. */
1052
- nodes: SessionTreeNode[];
1053
- activeLeafId: string | null;
1054
- /** Root-to-leaf IDs for explicit, non-color-only active-path rendering. */
1055
- activePathIds: string[];
1056
- }
1057
- export declare const SESSION_TREE_CUSTOM_INSTRUCTIONS_MAX_LENGTH = 10000;
1058
- export type SessionTreeSummaryChoice = {
1059
- mode: "none";
1060
- } | {
1061
- mode: "default";
1062
- } | {
1063
- mode: "custom";
1064
- instructions: string;
1065
- };
1066
- export interface SessionTreeNavigateRequest {
1067
- targetId: string;
1068
- /** Leaf shown when the navigator opened; null is valid for an empty/root position. */
1069
- expectedLeafId: string | null;
1070
- summary: SessionTreeSummaryChoice;
1071
- }
1072
- export type SessionTreeNavigateResult = {
1073
- cancelled: false;
1074
- editorText?: string;
1075
- } | {
1076
- cancelled: true;
1077
- aborted?: boolean;
1078
- };
1079
- export interface MessagePage {
1080
- messages: unknown[];
1081
- start: number;
1082
- total: number;
1083
- }
1084
- /**
1085
- * Join-time snapshot of a session's in-flight assistant stream. `seq` is the
1086
- * `SessionEventHub` watermark captured together with `partial` in a single tick,
1087
- * so a joining client can seed `partial` and then apply only buffered live events
1088
- * with `seq > snapshot.seq` (exactly-once). `partial` is a browser-projected
1089
- * in-flight `AssistantMessage` (thinking signatures stripped), or `null` when the
1090
- * session is not mid assistant-message stream.
1091
- */
1092
- export interface SessionStreamSnapshot {
1093
- seq: number;
1094
- /** Browser-projected in-flight `AssistantMessage`, or `null` when idle. */
1095
- partial: unknown;
1096
- }
1097
- export type CommandResult = {
1098
- type: "done";
1099
- message?: string;
1100
- session?: SessionInfo;
1101
- promptDraft?: string;
1102
- } | {
1103
- type: "select";
1104
- requestId: string;
1105
- title: string;
1106
- options: CommandOption[];
1107
- } | {
1108
- type: "tree";
1109
- tree: SessionTreeSnapshot;
1110
- } | {
1111
- type: "unsupported";
1112
- message: string;
1113
- };
1114
- /**
1115
- * Transport-level per-session sequence stamp. `SessionEventHub.publish` assigns a
1116
- * monotonic `seq` to every per-session event as it is serialized to the socket.
1117
- * Clients use it as a watermark against the join-time stream snapshot so buffered
1118
- * live events are applied exactly once. Existing consumers may ignore it.
1119
- */
1120
- export type SessionUiEvent = SessionUiEventBody & {
1121
- seq?: number;
1122
- };
1123
- type SessionUiEventBody = {
1124
- type: "message.append";
1125
- message: unknown;
1126
- } | {
1127
- type: "assistant.delta";
1128
- text: string;
1129
- } | {
1130
- type: "assistant.thinking.delta";
1131
- text: string;
1132
- } | {
1133
- type: "tool.start";
1134
- toolName: string;
1135
- toolCallId: string;
1136
- summary: string;
1137
- args?: unknown;
1138
- } | {
1139
- type: "tool.update";
1140
- toolName: string;
1141
- toolCallId: string;
1142
- text: string;
1143
- content?: unknown;
1144
- details?: unknown;
1145
- } | {
1146
- type: "tool.end";
1147
- toolName: string;
1148
- toolCallId: string;
1149
- text: string;
1150
- isError: boolean;
1151
- content?: unknown;
1152
- details?: unknown;
1153
- } | {
1154
- type: "shell.start";
1155
- command: string;
1156
- excludeFromContext?: boolean;
1157
- } | {
1158
- type: "shell.chunk";
1159
- chunk: string;
1160
- } | {
1161
- type: "shell.end";
1162
- output?: string;
1163
- exitCode?: number | null;
1164
- cancelled?: boolean;
1165
- truncated?: boolean;
1166
- fullOutputPath?: string;
1167
- isError?: boolean;
1168
- } | {
1169
- type: "agent.start";
1170
- } | {
1171
- type: "agent.end";
1172
- } | {
1173
- type: "message.end";
1174
- message?: unknown;
1175
- } | {
1176
- type: "status.update";
1177
- status: SessionStatus;
1178
- } | {
1179
- type: "activity.update";
1180
- activity: SessionActivity;
1181
- } | {
1182
- type: "command.output";
1183
- level: "info" | "success" | "error";
1184
- message: string;
1185
- } | SessionNotificationInboxEvent | {
1186
- type: "session.error";
1187
- message: string;
1188
- } | {
1189
- type: "ask.opened";
1190
- ask: PendingAskUser;
1191
- } | {
1192
- type: "ask.closed";
1193
- askId: string;
1194
- reason: AskUserCloseReason;
1195
- } | {
1196
- type: "dialog.opened";
1197
- dialog: PendingExtensionDialog;
1198
- } | {
1199
- type: "dialog.closed";
1200
- dialogId: string;
1201
- reason: ExtensionDialogCloseReason;
1202
- answer?: ExtensionDialogAnswer;
1203
- } | {
1204
- type: "session.name";
1205
- sessionId: string;
1206
- name?: string;
1207
- } | {
1208
- type: "session.created";
1209
- session: SessionInfo;
1210
- } | {
1211
- type: "pi.event";
1212
- eventType: string;
1213
- };
1214
- export type GlobalSessionEvent = Extract<SessionUiEventBody, {
1215
- type: "status.update" | "activity.update" | "session.name" | "session.created";
1216
- }> | SessionNotificationSummaryEvent | SessionUnreadEvent | SessionStartupProgressEvent;
1217
- export type RealtimeEvent = GlobalSessionEvent | TerminalUiEvent | WorkspaceActivityUiEvent;