@picassohq/cli 1.0.6 → 1.0.9

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 (42) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +104 -0
  3. package/dist/build-info.json +1 -1
  4. package/dist/index.js +1955 -1530
  5. package/package.json +27 -5
  6. package/runtime/dsh/picasso-providers.patch.yml +49 -61
  7. package/runtime/dsh/picasso-runtime.cordis.yml +49 -61
  8. package/runtime/engine-manifest.json +18 -8
  9. package/runtime/packages/picasso-browser/cordis.patch.yml +4 -0
  10. package/runtime/packages/picasso-browser/index.js +915 -0
  11. package/runtime/packages/picasso-browser/package.json +29 -0
  12. package/runtime/packages/picasso-commands/index.js +51 -1
  13. package/runtime/packages/picasso-compaction/index.js +116 -1
  14. package/runtime/packages/picasso-computer/cordis.patch.yml +5 -0
  15. package/runtime/packages/picasso-computer/index.js +670 -0
  16. package/runtime/packages/picasso-computer/native-anthropic.js +212 -0
  17. package/runtime/packages/picasso-computer/package.json +30 -0
  18. package/runtime/packages/picasso-computer/support.js +95 -0
  19. package/runtime/packages/picasso-lean-context/index.js +751 -15
  20. package/runtime/packages/picasso-lean-context/timeline.js +3 -2
  21. package/runtime/packages/picasso-model-router/connections.js +1 -1
  22. package/runtime/packages/picasso-progress-reports/index.js +121 -3
  23. package/runtime/packages/picasso-sdk-server/browser-host.js +94 -0
  24. package/runtime/packages/picasso-sdk-server/index.js +23 -3
  25. package/runtime/plugins/picasso-browser/index.js +319 -22
  26. package/runtime/plugins/picasso-browser/package.json +1 -1
  27. package/runtime/plugins/picasso-commands/index.js +51 -1
  28. package/runtime/plugins/picasso-compaction/index.js +116 -1
  29. package/runtime/plugins/picasso-computer/index.js +670 -0
  30. package/runtime/plugins/picasso-computer/native-anthropic.js +212 -0
  31. package/runtime/plugins/picasso-computer/package.json +30 -0
  32. package/runtime/plugins/picasso-computer/support.js +95 -0
  33. package/runtime/plugins/picasso-lean-context/index.js +751 -15
  34. package/runtime/plugins/picasso-lean-context/timeline.js +3 -2
  35. package/runtime/plugins/picasso-model-router/connections.js +1 -1
  36. package/runtime/plugins/picasso-progress-reports/index.js +121 -3
  37. package/runtime/relay/main.mjs +5005 -2250
  38. package/runtime/relay/remote/index.html +10 -2
  39. package/runtime/relay/remote/remote.css +8 -1
  40. package/runtime/relay/remote/remote.js +78 -17
  41. package/runtime/relay/versions-routes.mjs +52 -37
  42. package/scripts/install-runtime.mjs +33 -7
@@ -79,8 +79,8 @@ function parseArguments(raw) {
79
79
  const FILE_READ_TOOLS = new Set(["read", "read_file", "view", "fs_read", "cat"]);
80
80
  const SPAWN_TOOLS = new Set(["subagent", "subagent_fork", "spawn_agent", "fork_agent", "spawn", "task", "agent_task"]);
81
81
  const SPAWN_RECEIPT = /^started subagent (\S+)\s*$/;
82
- /** Sourced reminder messages (Tier 2): lean-context's plan-mode / runtime-policy / stale-todos / plan-nudge and the CLI's append. */
83
- export const REMINDER_KINDS = new Set(["plan-mode", "runtime-policy", "stale-todos", "plan-nudge", "append-system-prompt"]);
82
+ /** Sourced reminder messages (Tier 2): lean-context's plan-mode / runtime-policy / stale-todos / plan-nudge / plan-state and the CLI's append. */
83
+ export const REMINDER_KINDS = new Set(["plan-mode", "runtime-policy", "stale-todos", "plan-nudge", "plan-state", "append-system-prompt"]);
84
84
 
85
85
  /** The timeline kind of one tool call: file / skill / memory / agent / tool. */
86
86
  function toolKind(name, args) {
@@ -135,6 +135,7 @@ function remindersOf(record) {
135
135
  injected.runtimePolicy === true ? "runtime-policy" : null,
136
136
  injected.staleTodos === true ? "stale-todos" : null,
137
137
  injected.planNudge === true ? "plan-nudge" : null,
138
+ injected.planState === true ? "plan-state" : null,
138
139
  ].filter(Boolean);
139
140
  }
140
141
 
@@ -91,7 +91,7 @@ export function managedRetryBudgetMs(env = process.env) {
91
91
  }
92
92
 
93
93
  /** Managed refusals that answer the same way however often they are retried (never waited out). */
94
- const DETERMINISTIC_MANAGED_REFUSAL = /secret_exposure_blocked|secret_read_denied|daily_limit|access_blocked|scope_forbidden|not_allowed|policy_required|allowance_required|budget_exceeded|account_suspended/u;
94
+ const DETERMINISTIC_MANAGED_REFUSAL = /request_rejected|secret_exposure_blocked|secret_read_denied|daily_limit|access_blocked|scope_forbidden|not_allowed|policy_required|allowance_required|budget_exceeded|account_suspended/u;
95
95
  /** Sessions whose wait counters are kept (a subagent is a session of its own); the oldest are dropped past this. */
96
96
  const MAX_TRACKED_SESSIONS = 256;
97
97
  /** Test/dev override of the wait (`PICASSO_RATE_LIMIT_WAIT_MS`). */
@@ -148,6 +148,16 @@ function freshState() {
148
148
  reportPercentSincePlan: undefined,
149
149
  /** A plan-drift nudge is in history since the last `todo/write`. */
150
150
  driftNudged: false,
151
+ /** When the last `todo/write` landed (the engine's clock), undefined before any. */
152
+ planWrittenAt: undefined,
153
+ /** Turns a person opened (not goal rounds, mail or schedules) since the last `todo/write`, the current one included. */
154
+ personTurnsSincePlan: 0,
155
+ /** A progress report was written after the last `todo/write`. */
156
+ reportSincePlan: false,
157
+ /** The current turn was opened by a person's prompt that is not a continuation ("continue", "go on", …). */
158
+ turnIsNewTask: false,
159
+ /** An earlier-task nudge is in history since the last `todo/write`. */
160
+ earlierTaskNudged: false,
151
161
  };
152
162
  }
153
163
 
@@ -156,6 +166,35 @@ function todosFrom(data) {
156
166
  return list.filter(isRecord).map((todo) => ({ status: typeof todo.status === 'string' ? todo.status : 'pending' }));
157
167
  }
158
168
 
169
+ /** A prompt a person typed (not a goal round, mail, a schedule or a harness reminder). */
170
+ export function isPersonPrompt(message) {
171
+ if (message?.role !== undefined && message.role !== 'user') return false;
172
+ const kind = message?.source?.kind;
173
+ return kind === undefined || kind === 'user';
174
+ }
175
+
176
+ /** Phrases that carry on the work in hand whatever follows them ("continue where you left off, why did you stop?"). */
177
+ const CONTINUATION_PROMPT = /^(?:continue|keep going|keep at it|go on|go ahead|carry on|proceed|resume|pick up where|finish (?:it|up)|retry|try again)\b/iu;
178
+ /** Words that carry on only as the whole prompt ("go", "ok do it"): "GO. Fix ONLY the digests" is a new instruction. */
179
+ const BARE_CONTINUATION = /^(?:go|next|ok(?:ay)?|yes|yep|sure|do it|finish)\b/iu;
180
+ const BARE_CONTINUATION_MAX_WORDS = 3;
181
+ /** Longest prompt still read as "carry on" rather than a new task. */
182
+ export const CONTINUATION_MAX_CHARS = 160;
183
+
184
+ /** Whether a person's prompt continues the work in hand ("continue where you left off", "go on") instead of starting a task. */
185
+ export function isContinuationPrompt(text) {
186
+ const flat = String(text ?? '').replace(/\s+/gu, ' ').trim();
187
+ if (flat.length === 0 || flat.length > CONTINUATION_MAX_CHARS) return false;
188
+ if (CONTINUATION_PROMPT.test(flat)) return true;
189
+ return BARE_CONTINUATION.test(flat) && flat.split(' ').length <= BARE_CONTINUATION_MAX_WORDS;
190
+ }
191
+
192
+ /** What a turn's opening message says about the task: whether a person opened it, and whether as a new task. */
193
+ function openerFacts(message) {
194
+ const person = isPersonPrompt(message);
195
+ return { person, newTask: person && !isContinuationPrompt(textOf(message)) };
196
+ }
197
+
159
198
  /** Fold one durable session event into the timing state. */
160
199
  export function foldEvent(state, event) {
161
200
  if (!isRecord(event)) return state;
@@ -164,6 +203,7 @@ export function foldEvent(state, event) {
164
203
  case 'turn/start':
165
204
  state.turnStart = time;
166
205
  state.openerSeen = false;
206
+ state.turnIsNewTask = false;
167
207
  // A new turn is a new prompt (or goal round): no follow-up carries over into it.
168
208
  state.awaitingAnswer = false;
169
209
  state.followUpDue = false;
@@ -174,6 +214,9 @@ export function foldEvent(state, event) {
174
214
  state.openerSeen = true;
175
215
  // A goal round continues the run it belongs to; anything else (a prompt, mail, a schedule) starts one.
176
216
  if (!isGoalRound(message) || state.runStart === undefined) state.runStart = state.turnStart ?? time;
217
+ const opener = openerFacts(message);
218
+ if (opener.person) state.personTurnsSincePlan += 1;
219
+ state.turnIsNewTask = opener.newTask;
177
220
  }
178
221
  if (message?.source?.kind === SOURCE_KIND && time !== undefined) {
179
222
  state.lastReminder = time;
@@ -183,16 +226,22 @@ export function foldEvent(state, event) {
183
226
  state.followUpDue = false;
184
227
  }
185
228
  if (message?.source?.kind === DRIFT_SOURCE_KIND) state.driftNudged = true;
229
+ if (message?.source?.kind === EARLIER_TASK_SOURCE_KIND) state.earlierTaskNudged = true;
186
230
  break;
187
231
  }
188
232
  case 'todo/write':
189
233
  state.todos = todosFrom(event.data);
190
234
  state.reportPercentSincePlan = undefined;
191
235
  state.driftNudged = false;
236
+ state.planWrittenAt = time;
237
+ state.personTurnsSincePlan = 0;
238
+ state.reportSincePlan = false;
239
+ state.earlierTaskNudged = false;
192
240
  break;
193
241
  case 'assistant/message': {
194
242
  const report = parseProgressReport(textOf(event.data?.message));
195
243
  if (report !== undefined && report.percent !== undefined) state.reportPercentSincePlan = report.percent;
244
+ if (report !== undefined) state.reportSincePlan = true;
196
245
  if (time !== undefined && report !== undefined) {
197
246
  state.lastReport = time;
198
247
  if (!state.reminderPending) state.selfReporting = true;
@@ -370,7 +419,7 @@ export function renderPlanDrift(reported, todos) {
370
419
  const list = Array.isArray(todos) ? todos : [];
371
420
  const done = list.filter((todo) => todo?.status === 'completed').length;
372
421
  const plan = Math.round(planCompletion(list));
373
- return `<system-reminder>\nYour latest progress report says ${reported}% done, but your todo list shows ${plan}% (${done} of ${list.length} step${list.length === 1 ? '' : 's'} completed). Update it with todo_write so the plan matches the work, then keep going.\n</system-reminder>`;
422
+ return `<system-reminder>\nYour latest progress report says ${reported}% done, but your todo list shows ${plan}% (${done} of ${list.length} step${list.length === 1 ? '' : 's'} completed). Update it with todo_write so the plan matches the work; if it no longer matches what you are working on now, replace it for the current work, or clear it with todo_write and an empty list (todos: []). Then keep going.\n</system-reminder>`;
374
423
  }
375
424
 
376
425
  /** A frozen sourced user-role reminder carrying the plan-drift nudge. */
@@ -383,6 +432,67 @@ export function planDriftMessage(reported, todos) {
383
432
  });
384
433
  }
385
434
 
435
+ // ── Plan from an earlier task (Tier 2) ────────────────────────────────────────────────────────────────────────
436
+ //
437
+ // Owner 2026-11-18 (session m0-d03430f0): a 6/10 plan for the Kimi deploy (last todo_write 05:01Z) stayed in every panel
438
+ // through the Mythos hierarchy deploy, which the progress reports took to 100%. The person had started new tasks; the
439
+ // models (Fable, Gemini, DeepSeek) never touched a checklist that no longer matched their work, and nothing told them it
440
+ // belonged to an earlier task. So when a person starts a new task (a turn whose prompt is not a continuation) and the
441
+ // plan, still open, has gone untouched for more than PLAN_EARLIER_TASK_TURNS of their turns while progress reports moved
442
+ // on past it, that turn gets ONE sourced `<system-reminder>` at the tail: rewrite the plan for this task or clear it.
443
+ // Once per `todo/write`; top-level agents only; the text depends only on history (the write's time, its counts and the
444
+ // turn count), so identical history yields identical bytes. Tier 1 is never touched.
445
+
446
+ export const EARLIER_TASK_SOURCE_KIND = 'picasso-plan-earlier-task';
447
+ /** A plan untouched for MORE than this many person turns (and older than the newest report) is from an earlier task. */
448
+ export const PLAN_EARLIER_TASK_TURNS = 3;
449
+
450
+ const TODO_DONE = new Set(['completed', 'cancelled', 'canceled', 'done', 'skipped']);
451
+ const hasOpenTodos = (todos) => Array.isArray(todos) && todos.some((todo) => !TODO_DONE.has(String(todo?.status ?? 'pending')));
452
+
453
+ /**
454
+ * `{ writtenAt, turns }` when the earlier-task nudge is due, else undefined: an open plan, a person's new-task prompt
455
+ * opening this turn (`proposed` holds it on the turn's first step), more than PLAN_EARLIER_TASK_TURNS person turns since
456
+ * the plan's last write, a progress report since it, and no nudge yet for this write.
457
+ */
458
+ export function planEarlierTaskDue(state, proposed = []) {
459
+ if (!isRecord(state) || state.earlierTaskNudged === true || !hasOpenTodos(state.todos)) return undefined;
460
+ let turns = state.personTurnsSincePlan;
461
+ let newTask = state.turnIsNewTask === true;
462
+ if (!state.openerSeen) {
463
+ const opener = (Array.isArray(proposed) ? proposed : []).find((message) => message?.role === 'user');
464
+ const facts = opener === undefined ? { person: false, newTask: false } : openerFacts(opener);
465
+ if (facts.person) turns += 1;
466
+ newTask = facts.newTask;
467
+ }
468
+ if (!newTask || turns <= PLAN_EARLIER_TASK_TURNS || state.reportSincePlan !== true) return undefined;
469
+ return { ...(state.planWrittenAt === undefined ? {} : { writtenAt: state.planWrittenAt }), turns };
470
+ }
471
+
472
+ /** `2026-11-18 05:01 UTC`: UTC, so the same history gives the same bytes on every machine. */
473
+ function utcMinute(time) {
474
+ const iso = new Date(time).toISOString();
475
+ return `${iso.slice(0, 10)} ${iso.slice(11, 16)} UTC`;
476
+ }
477
+
478
+ /** The nudge text: when the plan was last written, its counts and how many turns it sat untouched. */
479
+ export function renderPlanEarlierTask({ writtenAt, turns } = {}, todos = []) {
480
+ const list = Array.isArray(todos) ? todos : [];
481
+ const done = list.filter((todo) => todo?.status === 'completed').length;
482
+ const when = Number.isFinite(writtenAt) ? `last updated ${utcMinute(writtenAt)}` : 'last updated in an earlier turn';
483
+ return `<system-reminder>\nYour plan is from an earlier task (${when}, ${done} of ${list.length} done, untouched for ${turns} turns while your progress reports moved on): rewrite it for this task with todo_write, or clear it with todo_write and an empty list (todos: []) if this task needs no plan.\n</system-reminder>`;
484
+ }
485
+
486
+ /** A frozen sourced user-role reminder carrying the earlier-task nudge. */
487
+ export function planEarlierTaskMessage(due, todos) {
488
+ return Object.freeze({
489
+ role: 'user',
490
+ content: Object.freeze([Object.freeze({ type: 'text', text: renderPlanEarlierTask(due, todos) })]),
491
+ source: Object.freeze({ kind: EARLIER_TASK_SOURCE_KIND, form: 'reminder' }),
492
+ id: randomUUID(),
493
+ });
494
+ }
495
+
386
496
  export function apply(ctx, config = {}, deps = {}) {
387
497
  const readSettings = deps.settings ?? settingsReader(config, deps.env ?? process.env);
388
498
  const clock = deps.now ?? Date.now;
@@ -396,9 +506,17 @@ export function apply(ctx, config = {}, deps = {}) {
396
506
  const session = agent?.session;
397
507
  if (!session || typeof session.eventAt !== 'function' || isChildAgent(agent)) return decision;
398
508
  const state = scanSession(states, session);
399
- // The plan-drift nudge reads only history; it is not the timed report reminder, so that setting does not gate it.
400
- const drift = decision.messages.some((message) => message?.source?.kind === DRIFT_SOURCE_KIND) ? undefined : planDriftDue(state, decision.messages);
509
+ // The plan nudges read only history; they are not the timed report reminder, so that setting does not gate them.
401
510
  const extra = [];
511
+ const earlier = decision.messages.some((message) => message?.source?.kind === EARLIER_TASK_SOURCE_KIND) ? undefined : planEarlierTaskDue(state, decision.messages);
512
+ if (earlier !== undefined) {
513
+ // Recorded now so a step that is rejected downstream cannot send it twice before its event lands. It says more
514
+ // than the percent drift nudge would about this plan, so that one is spent for this write too.
515
+ state.earlierTaskNudged = true;
516
+ state.driftNudged = true;
517
+ extra.push(planEarlierTaskMessage(earlier, state.todos));
518
+ }
519
+ const drift = earlier !== undefined || decision.messages.some((message) => message?.source?.kind === DRIFT_SOURCE_KIND) ? undefined : planDriftDue(state, decision.messages);
402
520
  if (drift !== undefined) {
403
521
  // Recorded now so a step that is rejected downstream cannot send it twice before its event lands.
404
522
  state.driftNudged = true;
@@ -0,0 +1,94 @@
1
+ // The CLI's browser host: hands the agent's queued `browser_*` actions to the Picasso client process.
2
+ //
3
+ // packages/picasso-browser queues each browser tool call on its Host Remote service (`picassoBrowser`). On the Mac the
4
+ // relay long-polls it and the app runs actions on the thread's Preview. A CLI engine session has no relay: when the
5
+ // client says it runs a browser (`picasso/capabilities` `client.browser`), this pump long-polls the same service in the
6
+ // engine process and sends every action to the client as a `browser/action` server request (the client runs it on its
7
+ // headless Chromium, packages/core browser-host.ts). The answer `{ok, value?, error?}` completes the action through
8
+ // `picassoBrowser/complete`; ids the plugin cancelled (tool-call abort, per-action timeout) go out as
9
+ // `browser.cancelled {actionIds}` so the client drops them. No browser plugin mounted (switched off): the pump stops.
10
+
11
+ export const BROWSER_ACTION_REQUEST = 'browser/action';
12
+ export const BROWSER_CANCELLED_NOTIFICATION = 'browser.cancelled';
13
+ /** The long-poll window; well inside the plugin's 30 s no-poller window. */
14
+ export const BROWSER_TAKE_MS = 25_000;
15
+
16
+ /**
17
+ * @param {object} deps
18
+ * @param {() => any} deps.service - the mounted `picassoBrowser` service, or undefined.
19
+ * @param {(method: string, params: object, signal?: AbortSignal) => Promise<any>} deps.request - server -> client request.
20
+ * @param {(method: string, params: object) => void} deps.notify - server -> client notification.
21
+ * @param {(ms: number) => Promise<void>} [deps.sleep]
22
+ */
23
+ export function createBrowserHostPump(deps) {
24
+ const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms).unref?.()));
25
+ let running = false;
26
+ let abort = new AbortController();
27
+
28
+ const complete = (service, action, ok, value, error) => {
29
+ try {
30
+ service.complete(action.actionId, ok, value, error, action.sessionId);
31
+ } catch {
32
+ // Already settled (cancelled, timed out): the plugin dropped it.
33
+ }
34
+ };
35
+
36
+ const run = async (service, action) => {
37
+ try {
38
+ const answer = await deps.request(BROWSER_ACTION_REQUEST, { action }, abort.signal);
39
+ if (answer?.ok === true) complete(service, action, true, answer.value ?? { text: '' }, undefined);
40
+ else complete(service, action, false, undefined, typeof answer?.error === 'string' && answer.error ? answer.error : 'The browser action failed.');
41
+ } catch (error) {
42
+ complete(service, action, false, undefined, error instanceof Error && error.message ? error.message : 'The browser action failed.');
43
+ }
44
+ };
45
+
46
+ const loop = async () => {
47
+ let backoff = 1_000;
48
+ while (running) {
49
+ const service = deps.service();
50
+ if (service === undefined || service === null || typeof service.take !== 'function') {
51
+ running = false;
52
+ return;
53
+ }
54
+ let batch;
55
+ try {
56
+ batch = await service.take(BROWSER_TAKE_MS, abort.signal);
57
+ } catch {
58
+ if (!running) return;
59
+ await sleep(backoff);
60
+ backoff = Math.min(backoff * 2, 30_000);
61
+ continue;
62
+ }
63
+ backoff = 1_000;
64
+ if (!running) return;
65
+ const cancelled = (batch?.cancelled ?? []).filter((id) => typeof id === 'string');
66
+ if (cancelled.length > 0) {
67
+ try {
68
+ deps.notify(BROWSER_CANCELLED_NOTIFICATION, { actionIds: cancelled });
69
+ } catch {
70
+ // the client went away; its actions fail on their own timeout
71
+ }
72
+ }
73
+ for (const action of batch?.actions ?? []) {
74
+ if (action && typeof action.actionId === 'string' && typeof action.sessionId === 'string') void run(service, action);
75
+ }
76
+ }
77
+ };
78
+
79
+ return {
80
+ get running() {
81
+ return running;
82
+ },
83
+ start() {
84
+ if (running) return;
85
+ running = true;
86
+ abort = new AbortController();
87
+ void loop();
88
+ },
89
+ stop() {
90
+ running = false;
91
+ abort.abort();
92
+ },
93
+ };
94
+ }
@@ -67,6 +67,7 @@ import { createInstructions, INSTRUCTIONS_METHODS } from './instructions.js';
67
67
  import { createProviderReload, PROVIDER_RELOAD_METHODS } from './provider-reload.js';
68
68
  import { APPROVAL_NOTE_METHODS, createApprovalNotes } from './approval-notes.js';
69
69
  import { CONTINUE_METHODS, createCrashContinue } from './crash-continue.js';
70
+ import { BROWSER_ACTION_REQUEST, BROWSER_CANCELLED_NOTIFICATION, createBrowserHostPump } from './browser-host.js';
70
71
 
71
72
  /** An approval a hooks.json decision hook asked for (packages/picasso-hooks decisions.js HOOK_ASK_REASON). */
72
73
  const HOOK_ASK_REASON = /^Hook "[^"\n]+" asks: /u;
@@ -190,7 +191,22 @@ export function apply(ctx, config = {}) {
190
191
  });
191
192
 
192
193
  /** Client-announced capabilities (picasso/capabilities params.client). */
193
- const client = { approvals: false, questions: false, deltas: false };
194
+ const client = { approvals: false, questions: false, deltas: false, browser: false };
195
+ /**
196
+ * The CLI's browser host (browser-host.js): with `client.browser`, the agent's queued `browser_*` actions go to the
197
+ * client as `browser/action` requests and run on its headless Chromium instead of waiting for a Mac app.
198
+ */
199
+ const browserPump = createBrowserHostPump({
200
+ service: () => {
201
+ try {
202
+ return ctx.get?.('picassoBrowser');
203
+ } catch {
204
+ return undefined;
205
+ }
206
+ },
207
+ request: (method, params, signal) => transport.request(method, params, signal),
208
+ notify: (method, params) => transport.notify(method, params),
209
+ });
194
210
  /** Session-scoped "allow for session" grants (session-grants.js). */
195
211
  const grants = createSessionGrants();
196
212
  /** Pending server->client asks that `approval/respond` / `question/respond` may settle out of band. */
@@ -764,11 +780,14 @@ export function apply(ctx, config = {}) {
764
780
  client.approvals = params?.client?.approvals === true;
765
781
  client.questions = params?.client?.questions === true;
766
782
  client.deltas = params?.client?.deltas === true;
783
+ client.browser = params?.client?.browser === true;
784
+ if (client.browser) browserPump.start();
785
+ else browserPump.stop();
767
786
  return {
768
787
  server: name,
769
788
  methods: [...PICASSO_SDK_METHODS],
770
- notifications: [SESSION_DELTA_METHOD, QUEUE_NOTIFICATION],
771
- serverRequests: ['approval/request', 'question/request'],
789
+ notifications: [SESSION_DELTA_METHOD, QUEUE_NOTIFICATION, BROWSER_CANCELLED_NOTIFICATION],
790
+ serverRequests: ['approval/request', 'question/request', BROWSER_ACTION_REQUEST],
772
791
  client: { ...client },
773
792
  };
774
793
  },
@@ -920,6 +939,7 @@ export function apply(ctx, config = {}) {
920
939
  let exitTask;
921
940
  const disposeAndExit = () => {
922
941
  exitTask ??= (async () => {
942
+ browserPump.stop();
923
943
  await Promise.allSettled([Promise.resolve().then(() => transport.flush())]);
924
944
  await Promise.allSettled([Promise.resolve().then(() => rootFiber.dispose())]);
925
945
  exit(0);