scenescout 2.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # scenescout
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f99062d: The close-up's feed shows one pastel tint per task again, so a change of task is a change of colour and the block of actions a task covers is legible at a glance; hovering a block names the task in the brief, under the session's objective. The tints are lifted on a light card so they read the same either way. A close-up with no frame now says "No frame available" like a card does, instead of showing a broken-image icon.
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - c7c4811: **A session now says two things, and the second is required.** Its **objective** is the whole remit it was given, set once at `scout_attach {objective}` — "Admin lane: §2 registers, §7 plan gating". Its **task** is what it is doing right now, and every tool that acts on the app — `scout_navigate`, `scout_back`, `scout_click`, `scout_type`, `scout_select`, `scout_press`, `scout_upload`, `scout_run_plan` — takes one: a few words for the batch in front of it ("Filtering the documents register by status"). It stays set until a different one is passed, `scout_journey` sets it while a journey runs, and reading the page needs none. A call that acts with no task standing is refused, with what to pass and why.
14
+
15
+ This exists because both were optional and therefore usually absent: someone watching a run saw sessions working through their app with nothing to say why, which is the one thing the live view is for. Stating a task also marks the action log, so the close-up's feed groups and tints the actions that follow it, as it already did for a journey's.
16
+
17
+ Breaking, in two ways. An agent that never states a task now gets a refusal instead of a click. And the two names swapped to match what they mean: `scout_attach {task}` is now `scout_attach {objective}`, and the per-call `objective` of 2.0 is now `task`. Both old names are still accepted, so a caller written against 2.0 keeps working.
18
+
3
19
  ## 2.0.0
4
20
 
5
21
  ### Major Changes
@@ -2,8 +2,8 @@ import { chromium, firefox, webkit } from "playwright";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { elementKey, fingerprintState, isNonPageRoute, normalizePath } from "./fingerprint.js";
5
- import { AUTH_LOSS_PREFIX, JOURNEY_END, JOURNEY_START, MemoryStore } from "./memory.js";
6
- import { normalizeObjective } from "./objective.js";
5
+ import { AUTH_LOSS_PREFIX, JOURNEY_END, JOURNEY_START, MemoryStore, TASK_SET } from "./memory.js";
6
+ import { normalizeTask } from "./task.js";
7
7
  import { describeInjection, newInjections, probeQueries, probeScript, probeShape, rememberProbe } from "./injection.js";
8
8
  import { AuthLossTracker } from "./authloss.js";
9
9
  import { COLLECT_INTERACTABLES_SCRIPT, VISIBLE_SRC, geometryIssues, BROKEN_IMAGES_SCRIPT, brokenImageIssues, } from "./collector.js";
@@ -204,28 +204,32 @@ export class BrowserEngine {
204
204
  designAuditCount = 0;
205
205
  /** Active task-efficiency measurement (scout_journey), if any. */
206
206
  journey = null;
207
- /** The session's task, from scout_attach. Empty when the agent gave none. */
208
- task = "";
207
+ /** The session's objective: the whole remit the agent was given at scout_attach. Empty when none was given. */
208
+ sessionObjective = "";
209
209
  /**
210
- * What the batch of actions running right now is for. Required before a
211
- * tool may act (objective.ts), stated by the agent on the call or by a
212
- * journey, and kept until it is replaced — a batch costs one sentence.
210
+ * The batch of actions running right now. Required before a tool may act
211
+ * (task.ts), stated by the agent on the call or by a journey, and kept
212
+ * until it is replaced — a batch costs a few words, not one per click.
213
213
  */
214
- objective = null;
214
+ currentTask = null;
215
215
  /** Set what this session is doing now. An empty value clears it. */
216
- setObjective(text) {
217
- const clean = normalizeObjective(text);
216
+ setTask(text) {
217
+ const clean = normalizeTask(text);
218
218
  if (!clean) {
219
- this.objective = null;
219
+ this.currentTask = null;
220
220
  return;
221
221
  }
222
- if (this.objective?.text === clean)
222
+ if (this.currentTask?.text === clean)
223
223
  return;
224
- this.objective = { text: clean, since: Date.now() };
224
+ this.currentTask = { text: clean, since: Date.now() };
225
+ // Logged so the feed can group the actions that follow under it, the way
226
+ // it groups a journey's — the trail is where a watcher reads what
227
+ // happened, and an ungrouped one says nothing about why.
228
+ this.logAction({ action: TASK_SET, target: clean, url: this.page?.url() ?? "" });
225
229
  }
226
- /** Whether anything is standing that the live view could show as the objective. */
227
- get hasObjective() {
228
- return this.journey !== null || this.objective !== null;
230
+ /** Whether anything is standing that the live view could show as the task. */
231
+ get hasTask() {
232
+ return this.journey !== null || this.currentTask !== null;
229
233
  }
230
234
  /**
231
235
  * Begin measuring a user JOURNEY — the interaction cost of completing one
@@ -347,7 +351,7 @@ export class BrowserEngine {
347
351
  throw new Error(`storageStatePath does not exist: ${opts.storageStatePath}`);
348
352
  }
349
353
  this.mode = opts.mode ?? "read-only";
350
- this.task = (opts.task ?? "").trim().replace(/\s+/g, " ").slice(0, 300);
354
+ this.sessionObjective = (opts.objective ?? "").trim().replace(/\s+/g, " ").slice(0, 300);
351
355
  this.headed = opts.headed ?? false;
352
356
  this.blockedRequests = [];
353
357
  this.pendingCreations = new Set();
@@ -2021,13 +2025,13 @@ export class BrowserEngine {
2021
2025
  mode: this.mode,
2022
2026
  browser: this.engineName,
2023
2027
  headed: this.headed,
2024
- ...(this.task ? { task: this.task } : {}),
2025
- // A journey is a whole user task being measured, so its goal outranks
2026
- // the batch objective while it runs.
2028
+ ...(this.sessionObjective ? { objective: this.sessionObjective } : {}),
2029
+ // A journey is a whole user task being measured, so its goal is what the
2030
+ // session is doing while it runs.
2027
2031
  ...(this.journey
2028
- ? { objective: this.journey.goal, objectiveSince: new Date(this.journey.startedAt).toISOString() }
2029
- : this.objective
2030
- ? { objective: this.objective.text, objectiveSince: new Date(this.objective.since).toISOString() }
2032
+ ? { task: this.journey.goal, taskSince: new Date(this.journey.startedAt).toISOString() }
2033
+ : this.currentTask
2034
+ ? { task: this.currentTask.text, taskSince: new Date(this.currentTask.since).toISOString() }
2031
2035
  : {}),
2032
2036
  };
2033
2037
  }
@@ -82,12 +82,23 @@ export const LIVE_PAGE = `<!doctype html>
82
82
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: 108px; overflow-y: auto; overscroll-behavior: contain; }
83
83
  .feed .row { display: flex; gap: 6px; white-space: nowrap; }
84
84
  /* Consecutive actions of one journey share a tint, so where one goal ends and the next begins is visible in the log. */
85
- .feed .group { border-left: 1px solid transparent; padding-left: 5px; margin-left: -6px; border-radius: 3px; }
86
- .feed .g0 { background: rgba(96, 165, 250, .13); border-color: rgba(96, 165, 250, .7); }
87
- .feed .g1 { background: rgba(52, 211, 153, .13); border-color: rgba(52, 211, 153, .7); }
88
- .feed .g2 { background: rgba(251, 191, 36, .13); border-color: rgba(251, 191, 36, .7); }
89
- .feed .g3 { background: rgba(244, 114, 182, .13); border-color: rgba(244, 114, 182, .7); }
90
- #focus .feed .group:hover { outline: 1px solid rgba(230, 233, 238, .35); }
85
+ /* One tint per task, so a change of task is a change of colour: the block of
86
+ actions a task covers is legible at a glance, and hovering it names the task. */
87
+ .feed .group { border-left: 2px solid transparent; padding-left: 6px; margin-left: -8px; border-radius: 4px; margin-bottom: 2px; }
88
+ .feed .g0 { background: rgba(96, 165, 250, .22); border-color: rgba(96, 165, 250, .85); }
89
+ .feed .g1 { background: rgba(52, 211, 153, .22); border-color: rgba(52, 211, 153, .85); }
90
+ .feed .g2 { background: rgba(251, 191, 36, .24); border-color: rgba(251, 191, 36, .9); }
91
+ .feed .g3 { background: rgba(244, 114, 182, .22); border-color: rgba(244, 114, 182, .85); }
92
+ .feed .group:hover { cursor: default; }
93
+ #focus .feed .group:hover { outline: 1px solid rgba(230, 233, 238, .45); }
94
+ /* The tints sit on a dark panel in the close-up and on a light one in a card;
95
+ lift them there so they read as the same pastel either way. */
96
+ @media (prefers-color-scheme: light) {
97
+ :root:not([data-theme="dark"]) .feed .g0 { background: rgba(37, 99, 235, .14); }
98
+ :root:not([data-theme="dark"]) .feed .g1 { background: rgba(5, 150, 105, .14); }
99
+ :root:not([data-theme="dark"]) .feed .g2 { background: rgba(217, 119, 6, .16); }
100
+ :root:not([data-theme="dark"]) .feed .g3 { background: rgba(219, 39, 119, .13); }
101
+ }
91
102
  .feed .t { color: var(--muted); flex: 0 0 auto; }
92
103
  .feed .a { color: var(--text); font-weight: 600; flex: 0 0 auto; }
93
104
  .feed .d { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
@@ -116,7 +127,12 @@ export const LIVE_PAGE = `<!doctype html>
116
127
  #focus .bar { display: flex; align-items: center; gap: 12px; color: #fff; }
117
128
  #focus .bar .line { color: #cbd5e1; padding: 0; flex: 1 1 auto; }
118
129
  #focus .bar .line b { color: #fff; }
119
- #focus img { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: contain; background: #000; border-radius: 6px; }
130
+ #focus .stage { flex: 1 1 auto; min-height: 0; position: relative; }
131
+ #focus img { width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 6px; display: block; }
132
+ #focus .none { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px;
133
+ color: #98a2b3; font-size: 13px; text-align: center; }
134
+ #focus .stage.empty .none { display: flex; }
135
+ #focus .stage.empty img { visibility: hidden; }
120
136
  #report { display: none; position: fixed; inset: 0; z-index: 6; background: var(--bg); overflow-y: auto; padding: 0 16px 32px; }
121
137
  #report.open { display: block; }
122
138
  #report .bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
@@ -176,15 +192,18 @@ export const LIVE_PAGE = `<!doctype html>
176
192
  <span class="line" id="focus-line"></span>
177
193
  <button type="button" id="focus-close" data-testid="live-focus-close">Close</button>
178
194
  </div>
179
- <img id="focus-img" alt="">
195
+ <div class="stage" id="focus-stage">
196
+ <img id="focus-img" alt="">
197
+ <span class="none">No frame available. The session's page may be closed, or not answering.</span>
198
+ </div>
180
199
  <div class="lower">
181
200
  <div class="feed" id="focus-feed" data-testid="live-focus-feed"></div>
182
201
  <aside class="brief" aria-label="What this session is doing" data-testid="live-focus-brief">
183
- <h3>Task</h3>
184
- <p id="focus-task" data-testid="live-focus-task"></p>
185
- <h3 id="focus-objective-head">Current objective</h3>
202
+ <h3>Objective</h3>
186
203
  <p id="focus-objective" data-testid="live-focus-objective"></p>
187
- <p class="since" id="focus-objective-since"></p>
204
+ <h3 id="focus-task-head">Doing now</h3>
205
+ <p id="focus-task" data-testid="live-focus-task"></p>
206
+ <p class="since" id="focus-task-since"></p>
188
207
  </aside>
189
208
  </div>
190
209
  </div>
@@ -200,7 +219,7 @@ export const LIVE_PAGE = `<!doctype html>
200
219
  var events = null;
201
220
  var eventsKey = '';
202
221
  var frames = {};
203
- var hoverObjective = null;
222
+ var hoverTask = null;
204
223
  var reportOpen = false;
205
224
  var reportTimer = null;
206
225
  var reportProblem = null;
@@ -306,9 +325,9 @@ export const LIVE_PAGE = `<!doctype html>
306
325
  var badge = el('span', 'badge idle');
307
326
  top.appendChild(nameEl); top.appendChild(role); top.appendChild(badge);
308
327
  var task = el('div', 'task');
309
- task.setAttribute('data-testid', 'live-card-task-' + name);
328
+ task.setAttribute('data-testid', 'live-card-objective-' + name);
310
329
  var doing = el('div', 'doing');
311
- doing.setAttribute('data-testid', 'live-card-objective-' + name);
330
+ doing.setAttribute('data-testid', 'live-card-task-' + name);
312
331
  var tool = el('div', 'line');
313
332
  var url = el('div', 'line');
314
333
  var shot = el('button', 'shot');
@@ -519,18 +538,18 @@ export const LIVE_PAGE = `<!doctype html>
519
538
  node.textContent = '';
520
539
  if (!lines || !lines.length) { node.appendChild(el('div', 'none', 'nothing recorded yet')); return; }
521
540
  var group = null;
522
- var groupObjective = null;
541
+ var groupTask = null;
523
542
  var groups = 0;
524
543
  lines.forEach(function (line) {
525
- var objective = line.objective || '';
526
- if (!group || objective !== groupObjective) {
527
- group = el('div', 'group' + (objective ? ' g' + (groups % 4) : ''));
528
- if (objective) { groups += 1; group.title = objective; }
544
+ var task = line.task || '';
545
+ if (!group || task !== groupTask) {
546
+ group = el('div', 'group' + (task ? ' g' + (groups % 4) : ''));
547
+ if (task) { groups += 1; group.title = task; }
529
548
  if (onGroup) {
530
- group.addEventListener('mouseenter', function () { onGroup(objective); });
549
+ group.addEventListener('mouseenter', function () { onGroup(task); });
531
550
  group.addEventListener('mouseleave', function () { onGroup(null); });
532
551
  }
533
- groupObjective = objective;
552
+ groupTask = task;
534
553
  node.appendChild(group);
535
554
  }
536
555
  var row = el('div', 'row');
@@ -550,15 +569,15 @@ export const LIVE_PAGE = `<!doctype html>
550
569
  var d = describe(s);
551
570
  card.root.className = 'card' + (s.state === 'stuck' ? ' stuck' : '');
552
571
  card.role.textContent = s.role === 'anonymous' ? '' : s.role;
553
- card.task.textContent = s.task || '';
554
- card.task.title = s.task || '';
555
- card.task.hidden = !s.task;
572
+ card.task.textContent = s.objective || '';
573
+ card.task.title = s.objective || '';
574
+ card.task.hidden = !s.objective;
556
575
  // What it is doing right now, in the agent's words. A session that acts
557
576
  // without saying is refused by the engine, so a blank one here is a
558
577
  // session that has not acted yet — say that rather than showing nothing.
559
- card.doing.textContent = s.objective || 'not said yet';
560
- card.doing.title = s.objective || '';
561
- card.doing.className = 'doing' + (s.objective ? '' : ' unset');
578
+ card.doing.textContent = s.task || 'not said yet';
579
+ card.doing.title = s.task || '';
580
+ card.doing.className = 'doing' + (s.task ? '' : ' unset');
562
581
  card.badge.className = 'badge ' + s.state;
563
582
  card.badge.textContent = d.badge;
564
583
  card.tool.textContent = d.tool;
@@ -570,12 +589,13 @@ export const LIVE_PAGE = `<!doctype html>
570
589
 
571
590
  function openFocus(name) {
572
591
  focused = name;
592
+ document.getElementById('focus-stage').classList.remove('empty');
573
593
  document.getElementById('focus-name').textContent = name;
574
594
  document.getElementById('focus-img').alt = 'Live view of ' + name;
575
595
  document.getElementById('focus-img').src = frames[name] || shotUrl(name);
576
596
  document.getElementById('focus').classList.add('open');
577
- hoverObjective = null;
578
- renderFeed(document.getElementById('focus-feed'), (latest[name] || {}).feed, showObjective);
597
+ hoverTask = null;
598
+ renderFeed(document.getElementById('focus-feed'), (latest[name] || {}).feed, showTask);
579
599
  syncEvents();
580
600
  loadFullFeed(name);
581
601
  paintFocus();
@@ -592,7 +612,7 @@ export const LIVE_PAGE = `<!doctype html>
592
612
  function loadFullFeed(name) {
593
613
  fetch('api/activity?session=' + encodeURIComponent(name), { cache: 'no-store' })
594
614
  .then(function (r) { return r.ok ? r.json() : null; })
595
- .then(function (d) { if (d && focused === d.session) renderFeed(document.getElementById('focus-feed'), d.feed, showObjective); })
615
+ .then(function (d) { if (d && focused === d.session) renderFeed(document.getElementById('focus-feed'), d.feed, showTask); })
596
616
  .catch(function () { /* the short feed from the last poll stays on screen */ });
597
617
  }
598
618
 
@@ -604,24 +624,24 @@ export const LIVE_PAGE = `<!doctype html>
604
624
 
605
625
  // The pointer is over a group of the close-up's feed: the brief shows the
606
626
  // objective those actions served. It goes back to the current one on leaving.
607
- function showObjective(objective) {
608
- hoverObjective = objective;
627
+ function showTask(task) {
628
+ hoverTask = task;
609
629
  paintBrief();
610
630
  }
611
631
  function paintBrief() {
612
632
  var s = focused && latest[focused];
613
633
  // The engine sees tool calls, not reasoning: both of these are the agent's own words, or nothing.
614
- setBrief('focus-task', s && s.task, 'Not given. An agent sets it when it attaches the session.');
615
- var head = document.getElementById('focus-objective-head');
616
- if (hoverObjective !== null) {
617
- head.textContent = 'Objective for these actions';
618
- setBrief('focus-objective', hoverObjective, 'No journey was running.');
619
- document.getElementById('focus-objective-since').textContent = '';
634
+ setBrief('focus-objective', s && s.objective, 'Not given. An agent sets it when it attaches the session.');
635
+ var head = document.getElementById('focus-task-head');
636
+ if (hoverTask !== null) {
637
+ head.textContent = 'Doing, for these actions';
638
+ setBrief('focus-task', hoverTask, 'Nothing was stated for these.');
639
+ document.getElementById('focus-task-since').textContent = '';
620
640
  } else {
621
- head.textContent = 'Current objective';
622
- setBrief('focus-objective', s && s.objective, 'No journey running. An agent starts one with scout_journey.');
623
- document.getElementById('focus-objective-since').textContent =
624
- s && s.objective && s.objectiveSince ? 'for ' + held(Date.now() + skew - Date.parse(s.objectiveSince)) : '';
641
+ head.textContent = 'Doing now';
642
+ setBrief('focus-task', s && s.task, 'Nothing stated yet.');
643
+ document.getElementById('focus-task-since').textContent =
644
+ s && s.task && s.taskSince ? 'for ' + held(Date.now() + skew - Date.parse(s.taskSince)) : '';
625
645
  }
626
646
  }
627
647
  // Once a second, from the status poll: the bar, the brief, and every third time the long feed.
@@ -698,9 +718,12 @@ export const LIVE_PAGE = `<!doctype html>
698
718
  this.textContent = streamAll ? 'Streaming all' : 'Stream all';
699
719
  Object.keys(cards).forEach(function (name) { setLive(cards[name], streamAll); });
700
720
  });
721
+ // A session with nothing to show answers 503; say so rather than leaving a broken-image icon.
722
+ document.getElementById('focus-img').addEventListener('error', function () { document.getElementById('focus-stage').classList.add('empty'); });
723
+ document.getElementById('focus-img').addEventListener('load', function () { document.getElementById('focus-stage').classList.remove('empty'); });
701
724
  document.getElementById('focus-close').addEventListener('click', closeFocus);
702
725
  // A re-rendered feed replaces the group under the pointer without a mouseleave; leaving the feed itself still resets.
703
- document.getElementById('focus-feed').addEventListener('mouseleave', function () { showObjective(null); });
726
+ document.getElementById('focus-feed').addEventListener('mouseleave', function () { showTask(null); });
704
727
  document.getElementById('focus').addEventListener('click', function (e) { if (e.target === this) closeFocus(); });
705
728
  document.getElementById('report-open').addEventListener('click', openReport);
706
729
  document.getElementById('finished-report').addEventListener('click', openReport);
@@ -27,7 +27,7 @@ import fs from "node:fs";
27
27
  import http from "node:http";
28
28
  import path from "node:path";
29
29
  import { LIVE_PAGE } from "./live-page.js";
30
- import { JOURNEY_END, JOURNEY_START } from "./memory.js";
30
+ import { JOURNEY_END, JOURNEY_START, TASK_SET } from "./memory.js";
31
31
  /** Holds the live view's token, next to status.json. Written owner-only; removed when the engine shuts down. */
32
32
  export const LIVE_TOKEN_FILE = "live-token";
33
33
  /** `SCENESCOUT_LIVE=off` keeps the engine from opening the live view's port at all. */
@@ -47,32 +47,44 @@ export function feedForSession(log, session, limit, redact = (s) => s) {
47
47
  if (e && (e.session ?? session) === session)
48
48
  mine.push(e);
49
49
  }
50
- let objective;
51
- for (; i >= 0; i -= 1) {
50
+ // Two things can be standing when the window opens: a journey, and the
51
+ // stated task. Walk back until both are known — a journey is what the
52
+ // session is doing while it runs, exactly as the live view shows it.
53
+ let goal;
54
+ let batch;
55
+ let knowJourney = false;
56
+ let knowBatch = false;
57
+ for (; i >= 0 && !(knowJourney && knowBatch); i -= 1) {
52
58
  const e = log[i];
53
59
  if (!e || (e.session ?? session) !== session)
54
60
  continue;
55
- if (e.action === JOURNEY_END)
56
- break;
57
- if (e.action === JOURNEY_START) {
58
- objective = e.target;
59
- break;
61
+ if (!knowJourney && (e.action === JOURNEY_END || e.action === JOURNEY_START)) {
62
+ if (e.action === JOURNEY_START)
63
+ goal = e.target;
64
+ knowJourney = true;
65
+ }
66
+ if (!knowBatch && e.action === TASK_SET) {
67
+ batch = e.target;
68
+ knowBatch = true;
60
69
  }
61
70
  }
62
71
  const lines = [];
63
72
  for (const e of mine.reverse()) {
64
73
  if (e.action === JOURNEY_START)
65
- objective = e.target;
74
+ goal = e.target;
75
+ if (e.action === TASK_SET)
76
+ batch = e.target;
77
+ const task = goal ?? batch;
66
78
  const line = { at: e.at, action: e.action, url: redact(e.url) };
67
79
  if (e.target !== undefined)
68
80
  line.target = e.target;
69
81
  if (e.result !== undefined)
70
82
  line.result = e.result;
71
- if (objective !== undefined)
72
- line.objective = objective;
83
+ if (task !== undefined)
84
+ line.task = task;
73
85
  lines.push(line);
74
86
  if (e.action === JOURNEY_END)
75
- objective = undefined;
87
+ goal = undefined;
76
88
  }
77
89
  return lines;
78
90
  }
@@ -92,6 +92,8 @@ export function redactSecrets(text) {
92
92
  /** The action-log lines that open and close a journey (scout_journey). The feed reads them to tell which goal an action served. */
93
93
  export const JOURNEY_START = "journey:start";
94
94
  export const JOURNEY_END = "journey:end";
95
+ /** Logged when a session states the task it is starting, so the feed can group the actions that follow under it. */
96
+ export const TASK_SET = "task";
95
97
  const EMPTY = { version: 1, states: {}, findings: [] };
96
98
  /**
97
99
  * Fold another process's memory into ours, losing nothing from either side.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The task: a few words saying what a session is DOING right now — the batch
3
+ * of actions it is performing on the page in front of it.
4
+ *
5
+ * It sits under the session's objective, which is the whole remit the agent
6
+ * was given at attach ("Admin lane: §2 registers, §7 plan gating"). The
7
+ * objective barely changes; the task changes every time the session moves on
8
+ * to something else, and it is what tells a person watching what is happening
9
+ * now.
10
+ *
11
+ * The engine sees tool calls, never the reasoning behind them, so it can only
12
+ * show a task the agent states. Left optional it was usually absent, so a tool
13
+ * that acts on the app requires one: passed on the call, or already standing
14
+ * from an earlier call or a journey. It stays set until it is replaced, so a
15
+ * batch costs a few words, not one per click.
16
+ *
17
+ * Reading the page (snapshot, hover, scroll, coverage, the audits) needs none:
18
+ * orienting is what an agent does before it can say what it is about to do.
19
+ */
20
+ /** Longer than this is a paragraph, not a task; the live view shows one line. */
21
+ export const TASK_MAX = 120;
22
+ /**
23
+ * The tools that act on the app under test. Each changes what the person
24
+ * watching is looking at, so each has to be able to say why.
25
+ */
26
+ export const NEEDS_TASK = new Set([
27
+ "scout_navigate",
28
+ "scout_back",
29
+ "scout_click",
30
+ "scout_type",
31
+ "scout_select",
32
+ "scout_press",
33
+ "scout_upload",
34
+ "scout_run_plan",
35
+ ]);
36
+ export function needsTask(tool) {
37
+ return NEEDS_TASK.has(tool);
38
+ }
39
+ /**
40
+ * One line, whitespace collapsed, bounded. Empty input clears the task. A
41
+ * longer one is cut at a word where it can be and ends in an ellipsis, so a
42
+ * truncated task reads as truncated rather than as a sentence that stops
43
+ * mid-word.
44
+ */
45
+ export function normalizeTask(text) {
46
+ const line = (text ?? "").replace(/\s+/g, " ").trim();
47
+ if (line.length <= TASK_MAX)
48
+ return line;
49
+ const cut = line.slice(0, TASK_MAX - 1);
50
+ const lastSpace = cut.lastIndexOf(" ");
51
+ return `${(lastSpace > TASK_MAX - 24 ? cut.slice(0, lastSpace) : cut).trimEnd()}…`;
52
+ }
53
+ /**
54
+ * What a session is told when it acts with no task standing. It names the
55
+ * parameter, gives the shape of a good task and says the rule it satisfies —
56
+ * an agent that reads this once should not need it again.
57
+ */
58
+ export function taskRefusal(tool) {
59
+ return (`${tool} needs a task: this session has none, so the live view cannot say what it is doing.\n` +
60
+ `Pass task:"…" on this call — a few words saying what you are DOING, not what you are checking. ` +
61
+ `"Filtering the documents register by status", "Filling the deviation form with invalid dates", "Signing in as QA_Team". ` +
62
+ `Not the acceptance criteria ("…narrows the set and is reflected in the URL"): that is the result you will judge, not the batch you are running. ` +
63
+ `It stays set until you pass a different one, so a batch costs a few words, not one per call. ` +
64
+ `scout_journey {action:"start", goal:"…"} sets it too, and is what to use when you are measuring a whole user task.`);
65
+ }
@@ -39,7 +39,7 @@ import { SessionQueue, withWatchdog } from "./engine/dispatch.js";
39
39
  import { FIXTURE_KINDS } from "./engine/fixtures.js";
40
40
  import { feedForSession, LIVE_ENV, writeStatusFile, LIVE_TOKEN_FILE, LiveServer, StatusBoard, } from "./engine/live.js";
41
41
  import { computeGaps, formatRouteCoverage, generateReport } from "./engine/report.js";
42
- import { needsObjective, objectiveRefusal, OBJECTIVE_MAX } from "./engine/objective.js";
42
+ import { needsTask, taskRefusal, TASK_MAX } from "./engine/task.js";
43
43
  import { EXPLORE_PROMPT_ARGUMENTS, explorePrompt, loadPlaybook, PLAYBOOK_PROMPT, PLAYBOOK_TOOL, SERVER_INSTRUCTIONS } from "./playbook.js";
44
44
  import { formatScan, scanProject } from "./scan.js";
45
45
  /** Live sessions: each name owns an independent BrowserEngine (browser + auth). */
@@ -278,7 +278,7 @@ function writeStatus(session, phase, tool, budgetMs) {
278
278
  if (!eng || !dir)
279
279
  return;
280
280
  // status.json is a poll target that gets pasted into bug reports.
281
- const { task, objective, ...described } = eng.liveDescription;
281
+ const { objective, task, ...described } = eng.liveDescription;
282
282
  lastWriter = board.update(session, {
283
283
  role: eng.role,
284
284
  phase,
@@ -286,8 +286,8 @@ function writeStatus(session, phase, tool, budgetMs) {
286
286
  url: redactSecrets(eng.currentUrl),
287
287
  ...(budgetMs ? { budgetMs } : {}),
288
288
  ...described,
289
- ...(task ? { task: redactSecrets(task) } : {}),
290
289
  ...(objective ? { objective: redactSecrets(objective) } : {}),
290
+ ...(task ? { task: redactSecrets(task) } : {}),
291
291
  });
292
292
  void ensureLive(dir);
293
293
  flushStatus(dir);
@@ -310,15 +310,17 @@ const sessionQueue = new SessionQueue();
310
310
  function serializedPerSession(label, fn, timeoutMs = 60_000) {
311
311
  return (args) => {
312
312
  const session = args.session ?? activeName;
313
- // Every acting tool passes through here, so the objective is required in
314
- // one place rather than eight. A call that states one sets it for the
315
- // batch; a call that acts with none standing is told what to pass.
313
+ // Every acting tool passes through here, so the task is required in one
314
+ // place rather than eight. A call that states one sets it for the batch;
315
+ // a call that acts with none standing is told what to pass. `objective`
316
+ // is the name this parameter had in 2.0 and still works.
316
317
  const eng = engines.get(session);
317
318
  if (eng) {
318
- if (args.objective !== undefined)
319
- eng.setObjective(args.objective);
320
- if (needsObjective(label) && !eng.hasObjective)
321
- return Promise.resolve(text(objectiveRefusal(label), session));
319
+ const stated = args.task ?? args.objective;
320
+ if (stated !== undefined)
321
+ eng.setTask(stated);
322
+ if (needsTask(label) && !eng.hasTask)
323
+ return Promise.resolve(text(taskRefusal(label), session));
322
324
  }
323
325
  const exec = async () => {
324
326
  writeStatus(session, "running", label, timeoutMs);
@@ -360,17 +362,22 @@ const sessionParam = z
360
362
  .optional()
361
363
  .describe("Target this session directly instead of the active one — pass it explicitly when dispatching to MULTIPLE sessions in one turn (e.g. two scout_click calls with different `session`), which then run CONCURRENTLY rather than queueing. Omit for single-session sequential use.");
362
364
  /**
363
- * What the batch of actions this call belongs to is for. Required by the tools
364
- * that act (objective.ts) unless one is already standing; shown to whoever is
365
- * watching the run, beside the session's task.
365
+ * What the session is DOING right now. Required by the tools that act
366
+ * (task.ts) unless one is already standing; shown to whoever is watching the
367
+ * run, under the session's objective.
366
368
  */
367
- const objectiveParam = z
369
+ const taskParam = z
368
370
  .string()
369
- .max(OBJECTIVE_MAX)
371
+ .max(TASK_MAX)
370
372
  .optional()
371
- .describe("One short sentence naming what this batch of actions is for, in the words you would use to tell a colleague " +
372
- '("Sign in as QA_Team and check where it lands"). It stays set until you pass a different one, and is shown live to the person watching. ' +
373
+ .describe("What you are DOING right now, in a few words: the action, not the acceptance criteria. " +
374
+ '"Filtering the documents register by status", "Filling the deviation form with invalid dates", "Signing in as QA_Team" ' +
375
+ 'NOT "§2.4 filtering narrows the set and the filter is reflected in the URL", which is what you are CHECKING, not what you are doing. ' +
376
+ 'Naming the item you are on is fine ("§2.4: filtering the documents register"); keep the rest to what a colleague would see over your shoulder. ' +
377
+ "It stays set until you pass a different one, so a batch costs a few words, not one per call. " +
373
378
  "Required on the tools that act unless a journey or an earlier call already set one.");
379
+ /** The name `task` had in 2.0. Still accepted, so a caller written against that release keeps working. */
380
+ const legacyObjectiveParam = z.string().max(TASK_MAX).optional().describe("Old name for `task` (2.0). Prefer `task`.");
374
381
  // The method, for every client that has no skill loader. It is read per call,
375
382
  // not cached: a source checkout's skill file can change under a running server.
376
383
  server.registerTool(PLAYBOOK_TOOL, {
@@ -441,18 +448,21 @@ server.registerTool("scout_attach", {
441
448
  .describe("Browser to drive. Default: the SCENESCOUT_BROWSER environment variable, else chromium. firefox and webkit must be downloaded first (scenescout install --browser-only --browsers firefox). Use them for a cross-browser pass; stay on chromium otherwise."),
442
449
  viewportWidth: z.number().int().min(320).max(3840).optional().describe("Viewport width (default 1280); use e.g. 390 for a mobile pass"),
443
450
  viewportHeight: z.number().int().min(480).max(2400).optional().describe("Viewport height (default 900)"),
444
- task: z
451
+ objective: z
445
452
  .string()
446
453
  .max(300)
447
454
  .optional()
448
- .describe("What this session is for, in one sentence (e.g. 'Approve and reject orders as a manager'). Shown to the person watching the live view, next to the goal of whatever scout_journey is active. Worth setting whenever more than one session is running."),
455
+ .describe('This session\'s objective: the whole remit you were given, in one sentence ("Admin lane: §2 registers, §7 plan gating", ' +
456
+ '"Approve and reject orders as a manager"). It sits above the task, which is what the session is doing at any moment. ' +
457
+ "Shown to whoever is watching the run; worth setting whenever more than one session is live."),
458
+ task: z.string().max(300).optional().describe("Old name for `objective` (2.0). Prefer `objective`."),
449
459
  session: z
450
460
  .string()
451
461
  .max(40)
452
462
  .optional()
453
463
  .describe("Session name for multi-role runs (e.g. 'admin', 'qa'). Creates/replaces that session's browser and makes it the default. Default: 'default'."),
454
464
  },
455
- }, serializedControl(async ({ url, projectPath, storageStatePath, mode, headed, browser, viewportWidth, viewportHeight, task, session, }) => {
465
+ }, serializedControl(async ({ url, projectPath, storageStatePath, mode, headed, browser, viewportWidth, viewportHeight, objective, task, session, }) => {
456
466
  try {
457
467
  const target = session ?? activeName;
458
468
  if (session) {
@@ -513,7 +523,18 @@ server.registerTool("scout_attach", {
513
523
  /* conflict detection is best-effort */
514
524
  }
515
525
  const viewport = viewportWidth && viewportHeight ? { width: viewportWidth, height: viewportHeight } : undefined;
516
- const out = await eng.attach({ url, projectDir: projectPath, storageStatePath, mode, headed, browser, viewport, task, memoryStore: store });
526
+ const out = await eng.attach({
527
+ url,
528
+ projectDir: projectPath,
529
+ storageStatePath,
530
+ mode,
531
+ headed,
532
+ browser,
533
+ viewport,
534
+ // `task` is what this was called in 2.0; it named the session's whole remit, which is the objective.
535
+ objective: objective ?? task,
536
+ memoryStore: store,
537
+ });
517
538
  eng.role = storageStatePath ? path.basename(storageStatePath).replace(/\.json$/i, "") : "anonymous";
518
539
  // Put the session on the board now, so the live view shows it before its
519
540
  // first tool call. liveLine() needs the port, so the server is awaited
@@ -608,7 +629,8 @@ server.registerTool("scout_run_plan", {
608
629
  }))
609
630
  .min(1)
610
631
  .max(20),
611
- objective: objectiveParam,
632
+ task: taskParam,
633
+ objective: legacyObjectiveParam,
612
634
  session: sessionParam,
613
635
  },
614
636
  }, serializedPerSession("scout_run_plan", async ({ steps }, session) => {
@@ -624,7 +646,8 @@ server.registerTool("scout_click", {
624
646
  inputSchema: {
625
647
  ref: z.string().describe("Element ref, e.g. e12"),
626
648
  clicks: z.number().int().min(1).max(3).default(1).describe("1 = normal; 2-3 = rapid repeated clicks (double-submit probe)"),
627
- objective: objectiveParam,
649
+ task: taskParam,
650
+ objective: legacyObjectiveParam,
628
651
  session: sessionParam,
629
652
  },
630
653
  }, serializedPerSession("scout_click", async ({ ref, clicks }, session) => {
@@ -645,7 +668,8 @@ server.registerTool("scout_type", {
645
668
  value: z.string().optional().describe("Alias for `textValue`."),
646
669
  pressEnter: z.boolean().default(false).describe("Press Enter after typing"),
647
670
  replace: z.boolean().default(false).describe("Clear the field before typing instead of appending to existing content"),
648
- objective: objectiveParam,
671
+ task: taskParam,
672
+ objective: legacyObjectiveParam,
649
673
  session: sessionParam,
650
674
  },
651
675
  }, serializedPerSession("scout_type", async ({ ref, textValue, value, pressEnter, replace }, session) => {
@@ -680,7 +704,8 @@ server.registerTool("scout_upload", {
680
704
  .optional()
681
705
  .describe("Generated fixture kind; default: inferred from the input's accept attribute (pdf when there is none, or none we can generate)"),
682
706
  name: z.string().min(1).max(512).optional().describe("Filename override (default scenescout-fixture.<kind>, or the disk file's own name)"),
683
- objective: objectiveParam,
707
+ task: taskParam,
708
+ objective: legacyObjectiveParam,
684
709
  session: sessionParam,
685
710
  },
686
711
  }, serializedPerSession("scout_upload", async ({ ref, filePath, fixture, name }, session) => {
@@ -704,7 +729,13 @@ server.registerTool("scout_hover", {
704
729
  }));
705
730
  server.registerTool("scout_select", {
706
731
  description: "Select an option in a <select> by ref.",
707
- inputSchema: { ref: z.string(), value: z.string().describe("Option value or label"), objective: objectiveParam, session: sessionParam },
732
+ inputSchema: {
733
+ ref: z.string(),
734
+ value: z.string().describe("Option value or label"),
735
+ task: taskParam,
736
+ objective: legacyObjectiveParam,
737
+ session: sessionParam,
738
+ },
708
739
  }, serializedPerSession("scout_select", async ({ ref, value }, session) => {
709
740
  try {
710
741
  return text(await engineFor(session).select(ref, value), session);
@@ -715,7 +746,12 @@ server.registerTool("scout_select", {
715
746
  }));
716
747
  server.registerTool("scout_navigate", {
717
748
  description: "Navigate to a URL or a path relative to the attached base URL (e.g. '/orders'). Also supports 'back' via scout_back.",
718
- inputSchema: { target: z.string().describe("Absolute URL or path like /settings"), objective: objectiveParam, session: sessionParam },
749
+ inputSchema: {
750
+ target: z.string().describe("Absolute URL or path like /settings"),
751
+ task: taskParam,
752
+ objective: legacyObjectiveParam,
753
+ session: sessionParam,
754
+ },
719
755
  }, serializedPerSession("scout_navigate", async ({ target }, session) => {
720
756
  try {
721
757
  return text(await engineFor(session).navigate(target), session);
@@ -726,7 +762,7 @@ server.registerTool("scout_navigate", {
726
762
  }));
727
763
  server.registerTool("scout_back", {
728
764
  description: "Go back in browser history (tests back-button resilience).",
729
- inputSchema: { objective: objectiveParam, session: sessionParam },
765
+ inputSchema: { task: taskParam, objective: legacyObjectiveParam, session: sessionParam },
730
766
  }, serializedPerSession("scout_back", async (_args, session) => {
731
767
  try {
732
768
  return text(await engineFor(session).goBack(), session);
@@ -756,7 +792,7 @@ server.registerTool("scout_scroll", {
756
792
  }));
757
793
  server.registerTool("scout_press", {
758
794
  description: "Press a keyboard key (e.g. Escape, Tab, Enter) — useful for closing modals and testing keyboard navigation.",
759
- inputSchema: { key: z.string(), objective: objectiveParam, session: sessionParam },
795
+ inputSchema: { key: z.string(), task: taskParam, objective: legacyObjectiveParam, session: sessionParam },
760
796
  }, serializedPerSession("scout_press", async ({ key }, session) => {
761
797
  try {
762
798
  return text(await engineFor(session).press(key), session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scenescout",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "SceneScout — exploratory UI testing for AI coding agents. An MCP server that gives any agent (Claude Code, Cursor, VS Code Copilot, Codex, Gemini CLI and others) a structured view of a running web app, always-on oracles, a network-level write policy, memory across runs and a gap-checked report.",
5
5
  "license": "MIT",
6
6
  "author": "brunoboto96",
@@ -20,7 +20,7 @@ You are the brain of an exploratory UI tester. The SceneScout MCP server gives y
20
20
  - **Source available?** Use it beyond the scan: when you file a finding, read the component or handler behind it and name the file and the likely fix — that is the difference between "the save button does nothing" and a finding a developer can act on in one step.
21
21
  3. **Ensure the app is running.** Full-stack markers in the scan → do NOT launch the stack yourself; confirm the URL responds (you may curl it) or ask the user. Auto-launch only simple single-package frontends.
22
22
  4. **Pick auth.** `--role X` → pass that storage-state file. Unspecified → least-privileged role; say so.
23
- 5. **`scout_attach`** with url, projectPath, storageStatePath, and the write **mode** — the DB behind the app may be live, so the engine enforces this at the network layer:
23
+ 5. **`scout_attach`** with url, projectPath, storageStatePath, an `objective` (this session's whole remit, shown live), and the write **mode** — the DB behind the app may be live, so the engine enforces this at the network layer:
24
24
  - `observe` (`--observe`): NOTHING but GET requests leaves the page (login and token refresh excepted) — no form submission reaches the server. **This is your default for a remote URL with no source** (see step 2): such a target is far more likely to hold real data, and in `read-only` every form you submit creates a record somebody has to clean up. Forms you fill cannot be submitted; the gap ledger says so and that is the honest result. Move to `read-only` only when the user says form submissions are acceptable there.
25
25
  - `read-only` (default when the source is here, i.e. a local or dev app): destructive labels blocked in the UI AND all PUT/PATCH/DELETE + destructive POSTs blocked on the wire. Ordinary form POSTs still go through. Use unless told otherwise.
26
26
  - `safe-write` (`--safe-write`, or the user asks to test creating/editing things): create freely — **prioritize testing CREATE flows** — then edit/delete ONLY the records you created (the engine tracks your creations and blocks mutations on anything else). Never attempt to clean up or modify pre-existing data.
@@ -37,7 +37,7 @@ You are the brain of an exploratory UI tester. The SceneScout MCP server gives y
37
37
  4. **Snapshot economics:** `scout_snapshot` after landing somewhere new; re-snapshots of the same route return *diffs* with stable refs — "No element changes" costs you almost nothing. `scout_screenshot` ONLY for suspected pixel-native issues (a canvas, a rendering glitch); geometry problems (overlap, off-screen, a covered control) are already in the snapshot as GEOMETRY issues, and images that failed to load are listed under BROKEN IMAGES — file those, quoting the line.
38
38
  5. **Native-user behaviours.** `scout_type {ref, textValue}` (or its alias `value`, matching `scout_select` and a plan step) APPENDS when a field already has content (menu clicks often insert @-mention chips or commands into composers — appending preserves them; the result reports what was already there); pass `replace=true` only to deliberately clear, and `pressEnter=true` to submit from the field the way a user would. Before concluding a badge, icon, or "N errors" indicator *does nothing*, `scout_hover` it — tooltips and hover cards are invisible to snapshots and clicks, and hover output includes what appeared. In HEADED mode (`scout_attach {headed:true}`, which the user asks for when they want to watch) the user's physical mouse competes with the synthetic pointer: if a hover reveals nothing and the finding matters, ask the user to move their mouse off the browser window and retry before filing. **Scroll long pages with `scout_scroll`** — the design audit and snapshot measure at the current scroll position, so judge deep sections by scrolling then re-auditing; it refuses to scroll where a real user couldn't and reports SCROLL LOCKED (the leaked modal scroll-lock that silently amputates everything below the fold — snapshots also flag it passively as an OVERLAY line), and scrolling triggers lazy-loaded content whose failures surface as fresh oracle violations. Elements fully clipped inside an overflow-hidden container are flagged UNREACHABLE in GEOMETRY issues — no amount of scrolling reveals them; that's a high-value layout bug, distinct from merely below-the-fold content. **A page can hold SEVERAL independent scroll regions** and plain `scout_scroll` moves the largest one, so a sidebar nav beside a taller main pane never budges: pass `scout_scroll {target:"testid=…"}` to scroll one region. Never report a nav item, tab or list row as missing/truncated until you have scrolled ITS container — content scrolled out of a secondary pane looks exactly like content that was cut off.
39
39
  6. **The rest of the input vocabulary.** `scout_select` sets a `<select>` option by value or visible label — use it rather than clicking a native dropdown open, which does not render as page DOM. `scout_press` sends a real key to the focused element (`Escape` to dismiss a modal, `Tab` to walk focus order, `Enter` to submit from a field); it is also how the keyboard-only pass at `extensive` is performed, and it vets the focused control first so a destructive action cannot be triggered blind in read-only mode. **`scout_upload {ref}` attaches a file the way a user does** — `ref` is a visible `<input type=file>` (snapshots list these with role `file`; `scout_type` on one redirects here) OR the button/label/dropzone that opens the file chooser (the chooser is intercepted and answered — that is how the hidden input behind a styled "Choose file" control is reached); omit `ref` when the page has exactly one file input, hidden or not (snapshots disclose hidden ones on a FILE INPUTS line). Nothing needs to exist on disk: a small VALID fixture is generated in memory, its kind inferred from the input's `accept` attribute or chosen with `fixture` (`pdf`, `png`, `txt`, `csv`, `json`); `filePath` uploads a real file but must live inside the attached project (fenced, like navigation is fenced to the origin); `name` overrides the filename. The result flags a file that violates `accept` (a mismatch the app then ACCEPTS is a validation finding), warns when the app cleared the input after selection, and says whether a state-changing request fired on selection — if none did, either click the form's submit or read the next snapshot for a client-side rejection. Plans take `{action:"upload", target, value:"pdf"}` steps (`target` required). When the input or its trigger was addressed by `ref`, the gap ledger counts an attached-but-unsent file as filled-never-submitted; the ref-less path has no listed element to mark.
40
- 7. **Say what you are doing: `objective` is required before a tool acts.** Every tool that changes the app or the page — `scout_navigate`, `scout_back`, `scout_click`, `scout_type`, `scout_select`, `scout_press`, `scout_upload`, `scout_run_plan` — takes an `objective`: one short sentence naming what this batch of actions is FOR, in the words you would use to tell a colleague ("Sign in as QA_Team and check where it lands", "Fill the deviation form with invalid dates", "Walk the approval queue as a manager"). It STAYS SET until you pass a different one, so a batch costs one sentence, not one per call — pass a fresh one whenever you move on to something else, and keep it true rather than letting it describe what you finished ten calls ago. Acting with none standing is refused: the person watching the live view would otherwise see a session clicking through their app with nothing to say why. `scout_journey {action:"start", goal:…}` sets it too and outranks it while it runs — use a journey when you are MEASURING a whole user task, the parameter for everything else.
40
+ 7. **Say what you are doing: `task` is required before a tool acts.** A session shows two lines to whoever is watching. Its **objective** is the whole remit you were given, set once at `scout_attach {objective}` ("Admin lane: §2 registers, §7 plan gating", "Approve and reject orders as a manager"). Its **task** is what you are doing *right now*, and every tool that changes the app or the page — `scout_navigate`, `scout_back`, `scout_click`, `scout_type`, `scout_select`, `scout_press`, `scout_upload`, `scout_run_plan` — takes it: a few words for the batch in front of you ("Filtering the documents register by status", "Filling the deviation form with invalid dates", "Signing in as QA_Team"). Say what you are DOING, not what you are checking — "§2.4 filtering narrows the set and is reflected in the URL" is the acceptance criteria, which is the result you will judge, not the batch you are running; naming the item is fine ("§2.4: filtering the documents register"). The task STAYS SET until you pass a different one, so a batch costs a few words, not one per call — pass a fresh one whenever you move on. Acting with none standing is refused: the person watching would otherwise see a session clicking through their app with nothing to say why. `scout_journey {action:"start", goal:…}` sets the task too while it runs — use a journey when you are MEASURING a whole user task, the parameter for everything else.
41
41
 
42
42
  8. **Design-connoisseur pass without pixels: `scout_design_audit`.** Run it once per representative page (dashboard, a form, a detail view, a data table). Its output has two tiers: **⚠ measurable defects** (WCAG contrast, tiny targets, clipped text, aspect-distorted images, horizontal overflow, keyboard tab stops with no visible focus indicator — sampled with real Tab presses) and **→ craft suggestions** (line measure and line-height rhythm, spacing-grid adherence, typography entropy, gray census and accent-hue count, pure-#000 body text, elevation/control consistency, heading structure, indistinguishable links, AI-slop tells like gradient text/glassmorphism/side-stripe borders/identical card grids), closing with a SYSTEM SUMMARY of design-system coherence. Judge every line with product context (dense tables legitimately have small targets; a chart page legitimately uses many hues). File ⚠ defects as `visual`/`a11y`, and genuine → opportunities as `ux-polish` findings **quoting the concrete numbers** — "~142 characters per line (65–75 ideal)" beats "text feels wide". Every audit ends with a **PAGE SCORE** (0–100 overall + a11y/craft/consistency/task-clarity subscores) persisted per route — the report ranks pages worst-first, so re-runs show whether pages got better or worse. Separately, every `scout_snapshot` runs an **overlay/modal probe** automatically: an empty dialog over a grayed page, a backdrop with no dialog, a far-off-centre dialog leaving a blank band, or a dialog extending unreachably below the viewport appear as OVERLAY lines in GEOMETRY issues — treat these as high-value findings (the user is visually stuck). This is where "how could this page be better" gets answered, not just "is it broken".
43
43
  9. **Measure task EASE with `scout_journey`, not just correctness.** Wrap each module's primary task (`{action:"start", goal:"Create an order"}` → do it → `{action:"end", completed:…}`). Navigate by CLICKING like a first-time user — typing a known deep URL shortcuts the very thing being measured (a route you can only reach by editing the address bar is itself a finding). The result gives interaction count, distinct screens, the path taken, and BACKTRACKS — returning to a screen already left is the clearest evidence the next step wasn't discoverable. An abandoned journey (`completed:false`) is a high-severity finding: the task is blocked or undiscoverable, which no passing e2e suite would ever reveal.
@@ -70,7 +70,7 @@ Some flows need a TEAM — a document one role submits and another approves, a r
70
70
  - While roles are NOT collaborating, use each one productively where its permissions matter (admin in /admin surfaces, low-privilege probing for permission leaks) — same coverage contract, different vantage points.
71
71
  - **Infer the PERSONA behind each role, and write it down.** From what a role can see and do (its nav, its dashboard, the capability matrix in the report), state what this person is FOR: "qa = reviewer — approves orders, assigns reviewers, no admin" / "user = front-line user — reads documents, completes reviews, raises orders". Record it with `scout_note {section:'roles'}`. Then test the persona's WORLD, not just the permissions: does the operator's landing page serve an operator? Is anything they need N clicks deep? The capability matrix's divergent rows are questions, not verdicts — each is either a correct boundary or a gap ("should this role be able to do this?"); say which you believe it is and why.
72
72
  - `scout_close {all: true}` at the end of a multi-role run; `scout_close {session}` to drop one role early.
73
- - **Several agents in parallel** (subagents or a workflow, each driving its own session): each agent attaches its session when it STARTS and closes it by name when it FINISHES. Never open sessions ahead for agents that have not started, and never hand an open session from one agent to the next: an agent waiting for its turn should hold no browser. Give each session a `task` when you attach it (`scout_attach {session, task:"Approve and reject orders as a manager"}`) and wrap each goal in `scout_journey`: the live view shows the task and the active journey's goal beside the session's feed, which is how the person watching knows what every agent is for. Keep that goal TRUE: one journey per goal, one goal per thing you are checking ("Save a settings change as the auditor", not "Check every page"), ended the moment it is decided and the next one started before you move on. A journey that outlives its goal shows the viewer an objective the session left behind minutes ago. Run roughly as many agents at once as the machine has cores, less two, since each drives a real browser; beyond that they only queue. Exploring one area is well within a mid-tier model, so run these agents on one (Sonnet or its equivalent in your client) unless the user names a model; keep the larger model for the agent that plans the split and writes the report. No agent may call `scout_close {all: true}` while others run — only the last step, once every agent has finished.
73
+ - **Several agents in parallel** (subagents or a workflow, each driving its own session): each agent attaches its session when it STARTS and closes it by name when it FINISHES. Never open sessions ahead for agents that have not started, and never hand an open session from one agent to the next: an agent waiting for its turn should hold no browser. Give each session an `objective` when you attach it (`scout_attach {session, objective:"Approve and reject orders as a manager"}`) and wrap each goal in `scout_journey`: the live view shows that objective and the task it is on beside the session's feed, which is how the person watching knows what every agent is for. Keep that goal TRUE: one journey per goal, one goal per thing you are checking ("Save a settings change as the auditor", not "Check every page"), ended the moment it is decided and the next one started before you move on. A journey that outlives its goal shows the viewer an objective the session left behind minutes ago. Run roughly as many agents at once as the machine has cores, less two, since each drives a real browser; beyond that they only queue. Exploring one area is well within a mid-tier model, so run these agents on one (Sonnet or its equivalent in your client) unless the user names a model; keep the larger model for the agent that plans the split and writes the report. No agent may call `scout_close {all: true}` while others run — only the last step, once every agent has finished.
74
74
 
75
75
  ## The impatient-user pass (extensive)
76
76
 
@@ -1,49 +0,0 @@
1
- /**
2
- * The objective: one short sentence saying what the batch of actions a session
3
- * is performing right now is FOR.
4
- *
5
- * The engine sees tool calls, never the reasoning behind them, so the live
6
- * view can only show an objective the agent states. Left optional it was
7
- * usually blank — a person watching saw a session click through an app with
8
- * nothing to say why. So a tool that acts on the app requires one: passed on
9
- * the call, or already standing from an earlier call or a journey. It stays
10
- * set until it is replaced, so a batch costs one sentence, not one per click.
11
- *
12
- * Reading the page (snapshot, hover, scroll, coverage, the audits) needs none:
13
- * orienting is what an agent does before it can say what it is about to do.
14
- */
15
- /** Longer than this is a paragraph, not an objective; the live view shows one line. */
16
- export const OBJECTIVE_MAX = 120;
17
- /**
18
- * The tools that act on the app under test. Each changes what the person
19
- * watching is looking at, so each has to be able to say why.
20
- */
21
- export const NEEDS_OBJECTIVE = new Set([
22
- "scout_navigate",
23
- "scout_back",
24
- "scout_click",
25
- "scout_type",
26
- "scout_select",
27
- "scout_press",
28
- "scout_upload",
29
- "scout_run_plan",
30
- ]);
31
- export function needsObjective(tool) {
32
- return NEEDS_OBJECTIVE.has(tool);
33
- }
34
- /** One line, whitespace collapsed, bounded. Empty input clears the objective. */
35
- export function normalizeObjective(text) {
36
- return (text ?? "").replace(/\s+/g, " ").trim().slice(0, OBJECTIVE_MAX);
37
- }
38
- /**
39
- * What a session is told when it acts with no objective standing. It names the
40
- * parameter, gives the shape of a good one, and says the rule it satisfies —
41
- * an agent that reads this once should not need it again.
42
- */
43
- export function objectiveRefusal(tool) {
44
- return (`${tool} needs an objective: this session has none, so the live view cannot say what it is doing.\n` +
45
- `Pass objective:"…" on this call — one short sentence about the batch of actions you are performing, ` +
46
- `in the words you would use to tell a colleague ("Sign in as QA_Team and check where it lands", "Fill the deviation form with invalid dates"). ` +
47
- `It stays set until you pass a different one, so a batch costs one sentence, not one per call. ` +
48
- `scout_journey {action:"start", goal:"…"} sets it too, and is what to use when you are measuring a whole user task.`);
49
- }