ptbk 0.119.0-16 → 0.119.0-21

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 (330) hide show
  1. package/README.md +27 -9
  2. package/dist/book/commitments.d.ts +38 -10
  3. package/dist/book/commitments.js +61 -17
  4. package/dist/book/commitments.js.map +1 -1
  5. package/dist/book/convert.d.ts +36 -0
  6. package/dist/book/convert.js +156 -0
  7. package/dist/book/convert.js.map +1 -0
  8. package/dist/book/parse.d.ts +50 -13
  9. package/dist/book/parse.js +132 -45
  10. package/dist/book/parse.js.map +1 -1
  11. package/dist/book/references.d.ts +12 -4
  12. package/dist/book/references.js +34 -9
  13. package/dist/book/references.js.map +1 -1
  14. package/dist/book/write.d.ts +42 -0
  15. package/dist/book/write.js +74 -0
  16. package/dist/book/write.js.map +1 -0
  17. package/dist/browser/browser.d.ts +122 -12
  18. package/dist/browser/browser.js +372 -21
  19. package/dist/browser/browser.js.map +1 -1
  20. package/dist/browser/recording.d.ts +3 -3
  21. package/dist/browser/recording.js +5 -5
  22. package/dist/browser/recording.js.map +1 -1
  23. package/dist/chats/chat-book.d.ts +105 -0
  24. package/dist/chats/chat-book.js +180 -0
  25. package/dist/chats/chat-book.js.map +1 -0
  26. package/dist/chats/conversation.d.ts +54 -0
  27. package/dist/chats/conversation.js +188 -0
  28. package/dist/chats/conversation.js.map +1 -0
  29. package/dist/chats/local.d.ts +46 -0
  30. package/dist/chats/local.js +184 -0
  31. package/dist/chats/local.js.map +1 -0
  32. package/dist/chats/migration.d.ts +12 -0
  33. package/dist/chats/migration.js +62 -0
  34. package/dist/chats/migration.js.map +1 -0
  35. package/dist/chats/service.d.ts +81 -0
  36. package/dist/chats/service.js +122 -0
  37. package/dist/chats/service.js.map +1 -0
  38. package/dist/chats/store.d.ts +132 -0
  39. package/dist/chats/store.js +181 -0
  40. package/dist/chats/store.js.map +1 -0
  41. package/dist/chats/task-chats.d.ts +52 -0
  42. package/dist/chats/task-chats.js +96 -0
  43. package/dist/chats/task-chats.js.map +1 -0
  44. package/dist/cli/chats.d.ts +45 -0
  45. package/dist/cli/chats.js +108 -0
  46. package/dist/cli/chats.js.map +1 -0
  47. package/dist/cli/commands/add.js +32 -22
  48. package/dist/cli/commands/add.js.map +1 -1
  49. package/dist/cli/commands/answer.d.ts +2 -1
  50. package/dist/cli/commands/answer.js +35 -41
  51. package/dist/cli/commands/answer.js.map +1 -1
  52. package/dist/cli/commands/ask.d.ts +7 -0
  53. package/dist/cli/commands/ask.js +37 -0
  54. package/dist/cli/commands/ask.js.map +1 -0
  55. package/dist/cli/commands/boilerplates.js +14 -3
  56. package/dist/cli/commands/boilerplates.js.map +1 -1
  57. package/dist/cli/commands/chat.d.ts +9 -0
  58. package/dist/cli/commands/chat.js +89 -0
  59. package/dist/cli/commands/chat.js.map +1 -0
  60. package/dist/cli/commands/dashboard.d.ts +3 -1
  61. package/dist/cli/commands/dashboard.js +41 -3
  62. package/dist/cli/commands/dashboard.js.map +1 -1
  63. package/dist/cli/commands/find.js +6 -8
  64. package/dist/cli/commands/find.js.map +1 -1
  65. package/dist/cli/commands/fix.js +4 -6
  66. package/dist/cli/commands/fix.js.map +1 -1
  67. package/dist/cli/commands/init.d.ts +0 -1
  68. package/dist/cli/commands/init.js +38 -38
  69. package/dist/cli/commands/init.js.map +1 -1
  70. package/dist/cli/commands/lint.js +16 -2
  71. package/dist/cli/commands/lint.js.map +1 -1
  72. package/dist/cli/commands/list.js +21 -13
  73. package/dist/cli/commands/list.js.map +1 -1
  74. package/dist/cli/commands/migrate.d.ts +2 -1
  75. package/dist/cli/commands/migrate.js +70 -24
  76. package/dist/cli/commands/migrate.js.map +1 -1
  77. package/dist/cli/commands/pause.d.ts +8 -0
  78. package/dist/cli/commands/pause.js +40 -0
  79. package/dist/cli/commands/pause.js.map +1 -0
  80. package/dist/cli/commands/plan.js +6 -9
  81. package/dist/cli/commands/plan.js.map +1 -1
  82. package/dist/cli/commands/recover.js +7 -3
  83. package/dist/cli/commands/recover.js.map +1 -1
  84. package/dist/cli/commands/restart.d.ts +3 -1
  85. package/dist/cli/commands/restart.js +74 -18
  86. package/dist/cli/commands/restart.js.map +1 -1
  87. package/dist/cli/commands/resume.d.ts +8 -0
  88. package/dist/cli/commands/resume.js +15 -0
  89. package/dist/cli/commands/resume.js.map +1 -0
  90. package/dist/cli/commands/run.js +6 -9
  91. package/dist/cli/commands/run.js.map +1 -1
  92. package/dist/cli/commands/start.js +40 -36
  93. package/dist/cli/commands/start.js.map +1 -1
  94. package/dist/cli/commands/status.d.ts +2 -1
  95. package/dist/cli/commands/status.js +5 -1
  96. package/dist/cli/commands/status.js.map +1 -1
  97. package/dist/cli/commands/stop.d.ts +3 -1
  98. package/dist/cli/commands/stop.js +18 -8
  99. package/dist/cli/commands/stop.js.map +1 -1
  100. package/dist/cli/commands/verify.js +7 -7
  101. package/dist/cli/commands/verify.js.map +1 -1
  102. package/dist/cli/common.d.ts +13 -0
  103. package/dist/cli/common.js +22 -0
  104. package/dist/cli/common.js.map +1 -1
  105. package/dist/cli/engine-delegation.d.ts +14 -0
  106. package/dist/cli/engine-delegation.js +46 -0
  107. package/dist/cli/engine-delegation.js.map +1 -0
  108. package/dist/cli/lifecycle.d.ts +40 -0
  109. package/dist/cli/lifecycle.js +71 -0
  110. package/dist/cli/lifecycle.js.map +1 -0
  111. package/dist/cli/registry.js +113 -31
  112. package/dist/cli/registry.js.map +1 -1
  113. package/dist/cli/service-view.d.ts +14 -2
  114. package/dist/cli/service-view.js +46 -5
  115. package/dist/cli/service-view.js.map +1 -1
  116. package/dist/cli/sources.js +5 -8
  117. package/dist/cli/sources.js.map +1 -1
  118. package/dist/cli/spec.js +1 -1
  119. package/dist/cli/spec.js.map +1 -1
  120. package/dist/common/app-data.d.ts +9 -0
  121. package/dist/common/app-data.js +20 -0
  122. package/dist/common/app-data.js.map +1 -0
  123. package/dist/common/errors.d.ts +2 -0
  124. package/dist/common/errors.js.map +1 -1
  125. package/dist/common/time.d.ts +6 -0
  126. package/dist/common/time.js +9 -0
  127. package/dist/common/time.js.map +1 -1
  128. package/dist/engine/agenda.d.ts +213 -43
  129. package/dist/engine/agenda.js +846 -260
  130. package/dist/engine/agenda.js.map +1 -1
  131. package/dist/engine/executor.d.ts +23 -7
  132. package/dist/engine/executor.js +131 -84
  133. package/dist/engine/executor.js.map +1 -1
  134. package/dist/engine/generated.d.ts +21 -1
  135. package/dist/engine/generated.js +36 -21
  136. package/dist/engine/generated.js.map +1 -1
  137. package/dist/engine/preview.js +10 -10
  138. package/dist/engine/preview.js.map +1 -1
  139. package/dist/engine/prompt.d.ts +16 -4
  140. package/dist/engine/prompt.js +22 -4
  141. package/dist/engine/prompt.js.map +1 -1
  142. package/dist/engine/routing.js +28 -4
  143. package/dist/engine/routing.js.map +1 -1
  144. package/dist/engine/snapshot.d.ts +178 -29
  145. package/dist/engine/state.d.ts +40 -13
  146. package/dist/engine/state.js +20 -5
  147. package/dist/engine/state.js.map +1 -1
  148. package/dist/engine/task-trace.d.ts +35 -7
  149. package/dist/engine/task-trace.js +74 -15
  150. package/dist/engine/task-trace.js.map +1 -1
  151. package/dist/engine/team.d.ts +20 -7
  152. package/dist/engine/team.js +30 -24
  153. package/dist/engine/team.js.map +1 -1
  154. package/dist/engine/traces.d.ts +1 -1
  155. package/dist/engine/traces.js +1 -1
  156. package/dist/expert/_main.md +67 -52
  157. package/dist/expert/agents/_index.md +11 -13
  158. package/dist/expert/agents/chatter.md +31 -0
  159. package/dist/expert/agents/consistency.md +6 -11
  160. package/dist/expert/agents/core-agents.md +9 -7
  161. package/dist/expert/agents/expert.md +2 -2
  162. package/dist/expert/agents/fixer.md +24 -0
  163. package/dist/expert/agents/learning.md +1 -1
  164. package/dist/expert/agents/non-agents.md +6 -4
  165. package/dist/expert/agents/teacher.md +1 -1
  166. package/dist/expert/agents/visual-identity.md +4 -4
  167. package/dist/expert/book-language/_index.md +9 -8
  168. package/dist/expert/book-language/commitments/_index.md +23 -3
  169. package/dist/expert/book-language/commitments/agent.md +11 -0
  170. package/dist/expert/book-language/commitments/chat-member.md +7 -0
  171. package/dist/expert/book-language/commitments/chat-message.md +11 -0
  172. package/dist/expert/book-language/commitments/chat-status.md +7 -0
  173. package/dist/expert/book-language/commitments/chat.md +11 -0
  174. package/dist/expert/book-language/commitments/entity.md +9 -0
  175. package/dist/expert/book-language/commitments/from.md +1 -1
  176. package/dist/expert/book-language/commitments/goal.md +6 -2
  177. package/dist/expert/book-language/commitments/link.md +9 -0
  178. package/dist/expert/book-language/commitments/task-depends-on.md +1 -1
  179. package/dist/expert/book-language/commitments/task-parent.md +1 -1
  180. package/dist/expert/book-language/commitments/task.md +7 -3
  181. package/dist/expert/book-language/commitments/team.md +1 -1
  182. package/dist/expert/book-language/inheritance.md +2 -2
  183. package/dist/expert/book-language/references.md +20 -24
  184. package/dist/expert/book-language/syntax.md +54 -11
  185. package/dist/expert/cli/acceptance.md +59 -24
  186. package/dist/expert/cli/api.md +23 -9
  187. package/dist/expert/cli/authoring.md +6 -4
  188. package/dist/expert/cli/autonomous-operation.md +3 -3
  189. package/dist/expert/cli/browser.md +29 -18
  190. package/dist/expert/cli/channels.md +5 -7
  191. package/dist/expert/cli/chat-ui.md +32 -0
  192. package/dist/expert/cli/chats.md +59 -0
  193. package/dist/expert/cli/cli.md +44 -26
  194. package/dist/expert/cli/configuration.md +3 -3
  195. package/dist/expert/cli/controls.md +13 -7
  196. package/dist/expert/cli/dashboard-details.md +23 -0
  197. package/dist/expert/cli/dashboard-layout.md +19 -12
  198. package/dist/expert/cli/dashboard.md +12 -8
  199. package/dist/expert/cli/execution.md +8 -6
  200. package/dist/expert/cli/first-task.md +4 -4
  201. package/dist/expert/cli/generated-names.md +44 -0
  202. package/dist/expert/cli/git-persistence.md +19 -17
  203. package/dist/expert/cli/global-dashboard.md +33 -0
  204. package/dist/expert/cli/goal-discovery.md +1 -1
  205. package/dist/expert/cli/help.md +1 -1
  206. package/dist/expert/cli/initialization-ui.md +2 -0
  207. package/dist/expert/cli/initialization.md +9 -7
  208. package/dist/expert/cli/interactive-ui.md +9 -5
  209. package/dist/expert/cli/locking.md +21 -0
  210. package/dist/expert/cli/migration.md +22 -6
  211. package/dist/expert/cli/process-modes.md +21 -13
  212. package/dist/expert/cli/recovery.md +8 -6
  213. package/dist/expert/cli/recurrence.md +1 -1
  214. package/dist/expert/cli/rich-input.md +2 -2
  215. package/dist/expert/cli/service-lifecycle.md +57 -0
  216. package/dist/expert/cli/start.md +2 -2
  217. package/dist/expert/cli/status-view.md +16 -12
  218. package/dist/expert/cli/task-books.md +11 -15
  219. package/dist/expert/cli/task-identity.md +8 -10
  220. package/dist/expert/cli/task-markdown.md +6 -10
  221. package/dist/expert/cli/task-origins.md +3 -1
  222. package/dist/expert/cli/task-relationships.md +5 -9
  223. package/dist/expert/cli/team.md +17 -7
  224. package/dist/expert/cli/terminal.md +20 -12
  225. package/dist/expert/cli/trace-configuration.md +1 -1
  226. package/dist/expert/cli/traces.md +19 -23
  227. package/dist/expert/cli/user-interactions.md +14 -26
  228. package/dist/expert/cli/workspace.md +15 -9
  229. package/dist/expert/concepts/engine-and-project.md +11 -0
  230. package/dist/expert/concepts/project-model.md +39 -0
  231. package/dist/expert/dictionary.md +21 -15
  232. package/dist/harness/plugins/claude-code/index.js +1 -0
  233. package/dist/harness/plugins/claude-code/index.js.map +1 -1
  234. package/dist/harness/plugins/cline/index.js +1 -0
  235. package/dist/harness/plugins/cline/index.js.map +1 -1
  236. package/dist/harness/plugins/openai-codex/index.js +1 -0
  237. package/dist/harness/plugins/openai-codex/index.js.map +1 -1
  238. package/dist/harness/plugins/opencode/index.js +1 -0
  239. package/dist/harness/plugins/opencode/index.js.map +1 -1
  240. package/dist/harness/types.d.ts +3 -1
  241. package/dist/project/agents.d.ts +29 -81
  242. package/dist/project/agents.js +48 -267
  243. package/dist/project/agents.js.map +1 -1
  244. package/dist/project/books.d.ts +150 -0
  245. package/dist/project/books.js +253 -0
  246. package/dist/project/books.js.map +1 -0
  247. package/dist/project/config.js +2 -2
  248. package/dist/project/config.js.map +1 -1
  249. package/dist/project/defaults.d.ts +35 -6
  250. package/dist/project/defaults.js +73 -40
  251. package/dist/project/defaults.js.map +1 -1
  252. package/dist/project/expert.js +18 -10
  253. package/dist/project/expert.js.map +1 -1
  254. package/dist/project/git.d.ts +4 -3
  255. package/dist/project/git.js +16 -5
  256. package/dist/project/git.js.map +1 -1
  257. package/dist/project/setup.d.ts +4 -1
  258. package/dist/project/setup.js +26 -6
  259. package/dist/project/setup.js.map +1 -1
  260. package/dist/service/actions.d.ts +34 -10
  261. package/dist/service/actions.js +51 -19
  262. package/dist/service/actions.js.map +1 -1
  263. package/dist/service/control.d.ts +53 -1
  264. package/dist/service/control.js +64 -4
  265. package/dist/service/control.js.map +1 -1
  266. package/dist/service/discovery.d.ts +133 -0
  267. package/dist/service/discovery.js +138 -0
  268. package/dist/service/discovery.js.map +1 -0
  269. package/dist/service/host.d.ts +8 -1
  270. package/dist/service/host.js +65 -18
  271. package/dist/service/host.js.map +1 -1
  272. package/dist/service/http.d.ts +3 -0
  273. package/dist/service/http.js +26 -6
  274. package/dist/service/http.js.map +1 -1
  275. package/dist/service/launcher.d.ts +66 -13
  276. package/dist/service/launcher.js +78 -18
  277. package/dist/service/launcher.js.map +1 -1
  278. package/dist/service/records.d.ts +12 -2
  279. package/dist/service/records.js +19 -5
  280. package/dist/service/records.js.map +1 -1
  281. package/dist/service/spa/app.css +83 -2
  282. package/dist/service/spa/app.js +393 -72
  283. package/dist/service/supervisor.js +7 -1
  284. package/dist/service/supervisor.js.map +1 -1
  285. package/dist/service/worker.js +14 -5
  286. package/dist/service/worker.js.map +1 -1
  287. package/dist/tasks/authoring.d.ts +3 -5
  288. package/dist/tasks/authoring.js +6 -7
  289. package/dist/tasks/authoring.js.map +1 -1
  290. package/dist/tasks/book-task.d.ts +18 -10
  291. package/dist/tasks/book-task.js +27 -23
  292. package/dist/tasks/book-task.js.map +1 -1
  293. package/dist/tasks/eligibility.d.ts +15 -7
  294. package/dist/tasks/eligibility.js +41 -14
  295. package/dist/tasks/eligibility.js.map +1 -1
  296. package/dist/tasks/identity.d.ts +41 -15
  297. package/dist/tasks/identity.js +100 -31
  298. package/dist/tasks/identity.js.map +1 -1
  299. package/dist/tasks/markdown.d.ts +7 -14
  300. package/dist/tasks/markdown.js +15 -29
  301. package/dist/tasks/markdown.js.map +1 -1
  302. package/dist/tasks/model.d.ts +20 -4
  303. package/dist/tasks/model.js +17 -0
  304. package/dist/tasks/model.js.map +1 -1
  305. package/dist/tasks/sources.d.ts +7 -2
  306. package/dist/tasks/sources.js +46 -35
  307. package/dist/tasks/sources.js.map +1 -1
  308. package/dist/ui/chat-client.d.ts +70 -0
  309. package/dist/ui/chat-client.js +209 -0
  310. package/dist/ui/chat-client.js.map +1 -0
  311. package/dist/ui/dashboard.d.ts +8 -5
  312. package/dist/ui/dashboard.js +227 -86
  313. package/dist/ui/dashboard.js.map +1 -1
  314. package/dist/ui/details.d.ts +64 -0
  315. package/dist/ui/details.js +175 -0
  316. package/dist/ui/details.js.map +1 -0
  317. package/dist/ui/global-dashboard.d.ts +59 -0
  318. package/dist/ui/global-dashboard.js +307 -0
  319. package/dist/ui/global-dashboard.js.map +1 -0
  320. package/dist/ui/status-view.d.ts +7 -0
  321. package/dist/ui/status-view.js +94 -36
  322. package/dist/ui/status-view.js.map +1 -1
  323. package/package.json +1 -1
  324. package/dist/engine/requests.d.ts +0 -111
  325. package/dist/engine/requests.js +0 -173
  326. package/dist/engine/requests.js.map +0 -1
  327. package/dist/expert/book-language/commitments/task-id.md +0 -9
  328. package/dist/tasks/prepare.d.ts +0 -33
  329. package/dist/tasks/prepare.js +0 -90
  330. package/dist/tasks/prepare.js.map +0 -1
@@ -1,8 +1,11 @@
1
1
  import { type EffectiveSettings } from '../project/config.js';
2
2
  import type { Project } from '../project/workspace.js';
3
3
  import type { BridgeTool } from '../engine/bridge.js';
4
- import type { RequestStore, UserRequest } from '../engine/requests.js';
4
+ import type { TaskChats } from '../chats/task-chats.js';
5
5
  import type { TaskTrace } from '../engine/task-trace.js';
6
+ import type { BrowserDetailView } from '../engine/snapshot.js';
7
+ import type { ControlOutcome } from '../service/actions.js';
8
+ import { promptbookAppData } from '../common/app-data.js';
6
9
  import { BrowserRecorder } from './recording.js';
7
10
  /**
8
11
  * Locates a Chrome-compatible browser (configuration, `CHROME_PATH`, standard locations, PATH).
@@ -11,17 +14,67 @@ import { BrowserRecorder } from './recording.js';
11
14
  */
12
15
  export declare function findBrowserExecutable(settings: EffectiveSettings, env?: NodeJS.ProcessEnv): Promise<string | undefined>;
13
16
  /**
14
- * Resolves the profile directory: the isolated project profile in `.ptbk/` or an explicitly selected path.
17
+ * Where the project's browser profile comes from (saved in ptbk.json as a portable kind, never a machine path for
18
+ * the managed global profile).
15
19
  *
16
20
  * @private project browser
17
21
  */
18
- export declare function browserProfileDirectory(project: Project, settings: EffectiveSettings): string;
22
+ export type BrowserProfileSource = 'global' | 'isolated' | 'user' | 'custom';
23
+ /**
24
+ * Classifies a `browser.profile` value: `global`, `isolated`, `user`, or a custom profile path.
25
+ *
26
+ * @private project browser
27
+ */
28
+ export declare function browserProfileSource(value: string): BrowserProfileSource;
29
+ export { promptbookAppData };
30
+ /**
31
+ * The dedicated Promptbook-managed browser profile shared by this user's projects (not the user's own Chrome profile).
32
+ *
33
+ * @private project browser
34
+ */
35
+ export declare function globalBrowserProfile(env?: NodeJS.ProcessEnv): string;
36
+ /**
37
+ * The user's ordinary Chrome user-data directory on this platform.
38
+ *
39
+ * @private project browser
40
+ */
41
+ export declare function userChromeProfile(env?: NodeJS.ProcessEnv): string;
42
+ /**
43
+ * Resolves the profile directory of the selected source: the managed global profile, the isolated project profile in
44
+ * `.ptbk/`, the user's Chrome profile, or a custom path (relative paths resolve against the project).
45
+ *
46
+ * @private project browser
47
+ */
48
+ export declare function browserProfileDirectory(project: Project, settings: EffectiveSettings, env?: NodeJS.ProcessEnv): string;
49
+ /**
50
+ * Human description of a `browser.profile` value.
51
+ *
52
+ * @private project browser
53
+ */
54
+ export declare function describeBrowserProfile(value: string): string;
19
55
  /**
20
56
  * Checks whether another browser process currently owns a profile (Chrome's singleton lock).
21
57
  *
22
58
  * @private project browser
23
59
  */
24
60
  export declare function profileOwner(profileDirectory: string): Promise<number | undefined>;
61
+ /**
62
+ * Observed health of the project browser (engine-owned diagnosis and recovery; never inferred from configuration).
63
+ *
64
+ * @private project browser
65
+ */
66
+ export type BrowserHealth = {
67
+ state: BrowserDetailView['state'];
68
+ checkedAt?: string;
69
+ pid?: number;
70
+ profilePath?: string;
71
+ actualMode?: 'headless' | 'headful';
72
+ executable?: string;
73
+ ownership: BrowserDetailView['ownership'];
74
+ lastFailure?: BrowserDetailView['lastFailure'];
75
+ recovery: NonNullable<BrowserDetailView['recovery']>;
76
+ lastAction?: BrowserDetailView['lastAction'];
77
+ };
25
78
  /**
26
79
  * The project's single shared browser instance (one profile, one automation owner at a time).
27
80
  *
@@ -31,21 +84,73 @@ export declare class ProjectBrowser {
31
84
  private readonly project;
32
85
  private readonly settings;
33
86
  private readonly env;
87
+ /** Publishes health changes to every view. */
88
+ private readonly onChange;
34
89
  private child?;
90
+ /** Release of the cross-project claim of a shared profile. */
91
+ private releaseClaim?;
35
92
  private connection?;
36
93
  private sessionId?;
37
94
  private note?;
38
- /** Task-linked recording of browser activity (`traces/<task-id>/video/`). */
95
+ /** A launch in progress (concurrent automatic/manual starts share it: never two owners). */
96
+ private launching?;
97
+ /** The current task used the browser (a restart waits for the task boundary). */
98
+ private usedByTask;
99
+ /** A manual restart waits for the current task to release the browser. */
100
+ private pendingRestart;
101
+ /** Observed health, diagnostics and recovery. */
102
+ private health;
103
+ /** Task-linked recording of browser activity (`traces/<task-file-basename>/video/`). */
39
104
  readonly recorder: BrowserRecorder;
40
- constructor(project: Project, settings: () => EffectiveSettings, env: NodeJS.ProcessEnv);
105
+ constructor(project: Project, settings: () => EffectiveSettings, env: NodeJS.ProcessEnv,
106
+ /** Publishes health changes to every view. */
107
+ onChange?: () => void);
108
+ /** Updates the observed health and notifies the views. */
109
+ private setHealth;
110
+ /** Records a real launch/connection failure with redacted evidence. */
111
+ private recordFailure;
112
+ /**
113
+ * The browser as the engine sees it: effective profile source and resolved path, requested/actual mode, health,
114
+ * ownership, last failure and recovery. A profile path is diagnostic data, never permission to read its contents.
115
+ */
116
+ inspect(): BrowserDetailView;
117
+ /** Records the outcome of a manual browser action. */
118
+ private acted;
119
+ /**
120
+ * Diagnostic recheck (no launch, no change): browser executable, profile existence and ownership, and the live
121
+ * connection when the browser runs.
122
+ */
123
+ recheck(): Promise<ControlOutcome>;
124
+ /** Retries browser startup now (sharing any launch already in progress); a shared profile is released again when idle. */
125
+ retry(): Promise<ControlOutcome>;
126
+ /**
127
+ * Restarts only this project's own browser process, preserving the selected profile and its sessions. While a task
128
+ * uses the browser the restart waits for that task's boundary instead of breaking its work.
129
+ */
130
+ restart(): Promise<ControlOutcome>;
131
+ /** Performs a restart at a safe boundary. */
132
+ private restartNow;
133
+ /** After a task: performs a deferred restart and releases a shared profile. */
134
+ taskFinished(): Promise<void>;
135
+ /** Handles a lost connection: stops only this project's browser process; the next use relaunches it. */
136
+ private connectionLost;
41
137
  /** Associates subsequent browser use with a task attempt for recording. */
42
138
  useFor(trace: TaskTrace, attempt: string): Promise<void>;
43
139
  /** Unsubscribes the page-transition listener of the current connection. */
44
140
  private navigationListener?;
45
141
  /** Ensures the browser runs and recording of the attached task has begun. */
46
142
  private active;
47
- /** Launches (or reuses) the browser and attaches to one page. */
143
+ /**
144
+ * Launches (or reuses) the browser and attaches to one page. A technical launch failure is retried automatically
145
+ * within a bound; concurrent callers share one launch, so automatic and manual recovery never start two owners.
146
+ */
48
147
  private ensure;
148
+ /** Bounded automatic launch recovery with recorded attempts, causes and next retry. */
149
+ private launchWithRecovery;
150
+ /** One launch attempt of the configured browser and profile. */
151
+ private launchOnce;
152
+ /** Starts the browser process and attaches to one page. */
153
+ private launch;
49
154
  /** Evaluates JavaScript in the page and returns its value. */
50
155
  private evaluate;
51
156
  /** Text and interactive elements of the current page (elements get stable `ref` numbers). */
@@ -64,15 +169,20 @@ export declare class ProjectBrowser {
64
169
  bringToFront(): Promise<string | undefined>;
65
170
  /** Stops only the browser process this service launched (never the user's browsers or the profile). */
66
171
  close(): void;
172
+ /** Releases this project's claim of a shared profile. */
173
+ private releaseProfile;
174
+ /**
175
+ * After a task: a browser on a shared profile (global, user or custom) is closed so other projects can use the
176
+ * profile; the isolated project profile stays open for the next task.
177
+ */
178
+ releaseShared(): void;
67
179
  }
68
180
  /**
69
181
  * Browser tools exposed to agents through the ptbk MCP bridge.
70
182
  *
71
183
  * @private project browser
72
184
  */
73
- export declare function browserTools(browser: ProjectBrowser, requests: RequestStore, task: {
74
- ref: string;
75
- id?: string;
76
- title: string;
77
- agent?: string;
78
- }, onUserRequest: (request: UserRequest) => void): BridgeTool[];
185
+ export declare function browserTools(browser: ProjectBrowser, chats: TaskChats | undefined, agent: string, onUserChat: (chat: {
186
+ chat: string;
187
+ awaited: number;
188
+ }) => void): BridgeTool[];