ravensight-playtest 0.13.1 → 0.13.3

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.
@@ -33,7 +33,10 @@ import { recordingMetadata, saveRecording } from './drivers/recording.js';
33
33
  import { createTranscript } from './transcript.js';
34
34
  import { createUsageLedger, writeUsageFile } from './usage.js';
35
35
  import { fillPlaceholders, fillReportPlaceholders } from './placeholders.js';
36
- import { sweepTurnedAway } from './claimGate.js';
36
+ import { repeatsTurnedAway, sweepTurnedAway } from './claimGate.js';
37
+ // The intent check (./intent.js): each input held against the screen after it, a repeated miss not sent again, what the run
38
+ // played, and the in-character section held to the record.
39
+ import { annotateActionLog, createIntentWatch, goalsOf, holdInCharacter, intentReportLines, movementInput, playedScope, withPlayedLine } from './intent.js';
37
40
  // The claim judge and the hosted runner's own claim words, check questions and event rules.
38
41
  import { claimShape, judgeIssue, legacyIssue, impressionOf } from './judge.js';
39
42
  import { EVENTS_RULE, eventsBlock, eventsReportLines, eventsUsage, withEventEvidence } from './events.js';
@@ -46,7 +49,7 @@ import { BUILT_IN_NOISE, expectedNoiseForPrompt, isExpectedNoise } from './noise
46
49
  import { cutFindingFrames, moodOf, replayCapabilityNote, replayFindings, replayWebFindings, screenOf, traceWebInputs, watchClaimsStill } from './reportChecks.js';
47
50
  import { pngFingerprint, screenDelta, significant } from './pixels.js';
48
51
  import { watchWebStill } from './stillWatch.js';
49
- import { refusedEventsBody, refusedReportInstruction, sessionRefusal } from './sdkSession.js';
52
+ import { TAG_RECORD_TAG, playtestTagBody, playtestTagRecord, playtestTagReportInstruction, playtestTagUsage, playtestTagging, refusedEventsBody, refusedReportInstruction, sessionRefusal } from './sdkSession.js';
50
53
  import { mkdtemp } from 'node:fs/promises';
51
54
  import os from 'node:os';
52
55
  import { MIN_PASSWORD_CHARS } from '../briefLocal.js';
@@ -214,6 +217,7 @@ export const PLAY_NOTES = [
214
217
  '- Every action answers with the screen that followed, so do not call snapshot after an action; call it only to look again after a wait.',
215
218
  '- Each turn spends the run\'s model budget, and the budget, not the action count, usually ends a run. Do not spend turns looking twice. When the next two or three inputs are plain (close a dialog, then press Start; end three turns in a row), send them as separate tool calls in ONE turn.',
216
219
  '- Say what you expect an action to do (expect). When the brief tells you to pick an option (a faction, a character, a class, a mode, a difficulty), read the options on the screen first, make exactly that choice, and check on the next screen that it is the one in effect. If it is not, say so in a note at once.',
220
+ '- On your next tool call after an input with expect, say whether the screen shows it: intent_check "met", or "missed" with instead (what the screen shows, copied as drawn). Trust the screen over what you believe: a key that brings up something else did not do what you meant, however often the screen changes. An input that missed the same result twice in a row is not sent a third time: reach the target another way first (walk to it with the arrow keys or W A S D, click it, or read what the screen says each key does).',
217
221
  '- Keep playing in scope beyond a first win or partial goal. When the brief gives explicit success criteria, complete all of them and their requested verification, then use the completion statement below to stop while preserving the requested end state. Without a completed brief, explore until your actions or budget run out or a persona stop condition fires.',
218
222
  '- When you do stop, use the brief completion statement if applicable, otherwise one short sentence, and no tool call. Never write the report here: a separate step writes it from your notes.',
219
223
  '- The screen text or the scene outline can be cut short, and a picture is only sent when the text is not enough. When you need to see the screen, call screenshot: its result shows you the picture. What this runner could not show you, could not click or does not offer is a limit of the runner: mention it in a note of kind reaction if you must, never as a bug, a confusing or a suggestion note.'
@@ -247,8 +251,11 @@ export function personaQuitDetail(text) {
247
251
  return `${space > 40 ? cut.slice(0, space) : cut}...`;
248
252
  }
249
253
 
250
- /** The stop detail when play ends to keep the report's budget. */
251
- export const RESERVE_STOP_DETAIL = 'stopped early so the rest of the model budget pays for the report';
254
+ /**
255
+ * The stop detail when play ends to keep the report's budget. A run that got here played to its budget: it is never said to
256
+ * have stopped early (the paid local run of 2026-11-20 played 39 of its 40 actions and its report said "stopped early").
257
+ */
258
+ export const RESERVE_STOP_DETAIL = 'played to its budget: play stopped so the rest of the model budget pays for the report';
252
259
 
253
260
  /**
254
261
  * @typedef {Object} PersonaRunOutcome
@@ -351,6 +358,8 @@ export async function runPersona(args) {
351
358
  videoPath: null,
352
359
  usage: null,
353
360
  runDirectory,
361
+ // The run's action limit: what "played to its budget" is said against (./intent.js).
362
+ maxActions,
354
363
  // The last state the SERVER accepted, which is not the same thing as the
355
364
  // outcome: the caller has to know whether this run ever reached
356
365
  // `reporting`, because the server's table only allows `uploading` from
@@ -398,6 +407,10 @@ export async function runPersona(args) {
398
407
  });
399
408
  imageBudget = play.imageBudget;
400
409
  outcome = { ...outcome, ...play };
410
+ // The intent check's record for usage.json (./intent.js); what the run played is added once the report has it.
411
+ outcome.intent = honesty.intent ? honesty.intent.summary() : null;
412
+ // Whether the game's own events were tagged as this playtest, for usage.json and the run summary (./sdkSession.js); null with no record.
413
+ outcome.playtestTag = honesty.playtestTag || null;
401
414
 
402
415
  const endedAt = new Date().toISOString();
403
416
  // When the recording began, read before the driver is stopped: a finding's
@@ -423,6 +436,7 @@ export async function runPersona(args) {
423
436
  // No positive remaining budget was established by the refusal.
424
437
  // Preserve the notes without authorizing another model call.
425
438
  await writeSomeReport({ outcome, runDirectory, persona, driverName, target, notes, screenshots, actionRecords, play, skill, ledger, runId, jobId, startedAt, endedAt, log, honesty, observations });
439
+ outcome.scope = scopeForUsage(honesty.scope);
426
440
  return finish(outcome, ledger, runDirectory, transcript, heartbeat);
427
441
  }
428
442
 
@@ -499,6 +513,8 @@ export async function runPersona(args) {
499
513
  }
500
514
 
501
515
  outcome.report = written.report;
516
+ // What the run played, as report.md says it, for usage.json (the hosted runner's `scope`; the server's evidence report reads its line).
517
+ outcome.scope = scopeForUsage(honesty.scope);
502
518
  // What the runner met and could not do, for the complete call (./thinRun.js capabilityNotesBody).
503
519
  outcome.capabilityNotes = honesty.capability.list();
504
520
  outcome.reportMarkdown = written.markdown;
@@ -576,6 +592,9 @@ export async function runPersona(args) {
576
592
  }
577
593
  // Sent to the server as the run's reason, so it is as safe as the report.
578
594
  outcome.quitDetail = safeErrorDetail(error, localBrief);
595
+ // The intent check's record and what the run played, kept in usage.json for a run that did not finish its report too.
596
+ if (honesty.intent) outcome.intent = honesty.intent.summary();
597
+ if (honesty.scope) outcome.scope = scopeForUsage(honesty.scope);
579
598
  transcript.write({ kind: 'error', message: outcome.quitDetail });
580
599
  await finish(outcome, ledger, runDirectory, transcript, heartbeat);
581
600
  throw Object.assign(error, { outcome });
@@ -898,6 +917,9 @@ async function playLoop({
898
917
  const briefFields = brief && brief.fields && typeof brief.fields === 'object' ? brief.fields : brief || {};
899
918
  const anyGame = honesty.anygame || (honesty.anygame = createLocalAnyGame({ briefText: briefForPrompt(brief), controls: briefFields.build_notes && typeof briefFields.build_notes.controls === 'string' ? briefFields.build_notes.controls : null, touch: Boolean(driver && driver.touch), continuousTime: driver?.inputProfile === 'native-mobile' && driver.frozenBetweenActions === false, driverName: typeof driver.soundSelfTest === 'function' ? '' : driverName }));
900
919
  system.push({ type: 'text', text: anyGame.systemText() });
920
+ // The intent check (./intent.js): one watch a run, on the honesty record so the report step reads the same one. Every answer,
921
+ // miss and refused repeat is a line of the step log.
922
+ const intentWatch = honesty.intent || (honesty.intent = createIntentWatch({ goals: goalsOf(brief), onEvent: line => transcript.write(line) }));
901
923
  // What earlier playtests of this game learned (./gameMemory.js): the same block every request carries, so it is cached.
902
924
  const earlier = earlierMemory && earlierMemory.save !== false ? memoryBlock(earlierMemory) : '';
903
925
  if (earlier) {
@@ -1114,9 +1136,9 @@ async function playLoop({
1114
1136
  reserveStopped = true;
1115
1137
  quitReason = 'budget_exhausted';
1116
1138
  quitDetail = reserve.figures.stop_reason === 'act_projection'
1117
- ? 'stopped early because the next action reservation exceeds the remaining model budget'
1139
+ ? 'played to its budget: the next action\'s reservation would not fit in the model budget left'
1118
1140
  : reserve.figures.stop_reason === 'act_projection_and_report_reserve'
1119
- ? 'stopped early because the next action reservation and the report reserve exceed the remaining model budget'
1141
+ ? 'played to its budget: the next action\'s reservation and the report reserve would not fit in the model budget left'
1120
1142
  : RESERVE_STOP_DETAIL;
1121
1143
  transcript.write({ kind: 'budget_reserve_stop', ...reserve.figures });
1122
1144
  log(`stopping play after ${actions} action(s): ${quitDetail} (spent about $${reserve.figures.usd_spent} of $${reserve.figures.usd_max}; next action projection $${reserve.figures.act_projected_usd}; report reserve $${reserve.figures.report_reserve_usd}; reason ${reserve.figures.stop_reason}).`);
@@ -1402,6 +1424,8 @@ async function playLoop({
1402
1424
  // Every ref in this turn was read off the screen before it. Once one of
1403
1425
  // its actions changes the screen, a later ref may name something else.
1404
1426
  let screenChangedThisTurn = false;
1427
+ // The playtester's answer about its last input is read from this turn's calls until one of them plays an input (./intent.js).
1428
+ let answerOpen = true;
1405
1429
  for (const toolUse of answer.toolUses) {
1406
1430
  if (argsSignal?.aborted || heartbeat?.canceled) { canceled = true; quitReason = 'error'; quitDetail = 'the job was cancelled'; break; }
1407
1431
  if (selection && toolUse.id !== selection.toolId) { results.push({ type: 'tool_result', tool_use_id: toolUse.id, content: 'Alternative not selected. No action executed.' }); continue; }
@@ -1422,6 +1446,19 @@ async function playLoop({
1422
1446
  transcript.write({ kind: 'action_not_played', tool: toolUse.name, reason: 'tool_not_allowed_by_server' });
1423
1447
  continue;
1424
1448
  }
1449
+ // The intent check (./intent.js): the playtester's own answer about its last input, then an input that has missed the
1450
+ // same result twice in a row is not sent again; it is told what the screen showed instead and asked for another way.
1451
+ const checkedInput = toolUse.malformed ? null : redactToolInput(toolUse, secrets);
1452
+ if (answerOpen && checkedInput) intentWatch.answer(checkedInput, { first: true });
1453
+ if (checkedInput && ACTION_TOOLS.includes(toolUse.name)) {
1454
+ const repeated = intentWatch.refusal(toolUse.name, checkedInput, { turn: turns });
1455
+ if (repeated) {
1456
+ results.push(toolResult(toolUse.id, repeated));
1457
+ recentActions.push(`${toolUse.name}: not sent, it repeated a miss`);
1458
+ if (recentActions.length > 10) recentActions.shift();
1459
+ continue;
1460
+ }
1461
+ }
1425
1462
  const notesBefore = notes.length;
1426
1463
  const screenBefore = latestObservation;
1427
1464
  // A note about something wrong is about the screen as it is now, before
@@ -1499,6 +1536,13 @@ async function playLoop({
1499
1536
  };
1500
1537
  transcript.write(actionLine);
1501
1538
  actionRecords.push(actionLine);
1539
+ // The intent check: an input that reached the game is held against the screen after it (./intent.js).
1540
+ if (checkedInput && ACTION_TOOLS.includes(toolUse.name)) {
1541
+ const reached = !executed.error && !executed.refused;
1542
+ if (reached) answerOpen = false;
1543
+ intentWatch.played({ tool: toolUse.name, input: checkedInput, action: actions, turn: turns, ok: reached, changed: Boolean(executed.changed),
1544
+ pageText: executed.observation && !executed.observation.unchanged ? String(executed.observation.text || '') : '', thought: actionLine.thought || '' });
1545
+ }
1502
1546
  if (honesty.traceSteps && Number.isInteger(actionLine.trace_steps)) honesty.traceSteps.set(actions, actionLine.trace_steps);
1503
1547
  if (honesty.tester) honesty.tester.acted(actionLine); // [tester hook]
1504
1548
  if (executed.unsupported && honesty.capability.add(executed.unsupported)) {
@@ -1671,6 +1715,9 @@ async function playLoop({
1671
1715
  asides.push(stuckHint(unchanged, failedInputsOn(failedInputs, latestObservation)));
1672
1716
  }
1673
1717
 
1718
+ // The intent check: a miss the runner or the record found, and a part of the game to leave, said once (./intent.js).
1719
+ for (const notice of intentWatch.notices()) asides.push(notice);
1720
+
1674
1721
  // any-game hook: the play style once, and the notebook when screens have dropped out of context.
1675
1722
  const anyAside = anyGame.aside({ actions, dropped: staleObservationCount(observations.length, keepObservations) });
1676
1723
  if (anyAside) { asides.push(anyAside); transcript.write({ kind: 'any_game_aside', chars: anyAside.length }); }
@@ -1862,13 +1909,21 @@ async function playLoop({
1862
1909
  const kept = driver.gameEvents.record();
1863
1910
  if (kept.total > 0) transcript.write({ kind: 'game_events', total: kept.total, kept: kept.kept, clock: kept.clock, names: kept.names });
1864
1911
  }
1865
- // The game's own SDK asked for its session and the server refused it, so none of its events reached the run (./sdkSession.js).
1866
- const refusal = driver && typeof driver.sdkSessions === 'function' ? sessionRefusal(await Promise.resolve().then(() => driver.sdkSessions()).catch(() => null)) : null;
1912
+ // The game's own SDK's session requests, as the driver read them (./sdkSession.js).
1913
+ const sessionRecord = driver && typeof driver.sdkSessions === 'function' ? await Promise.resolve().then(() => driver.sdkSessions()).catch(() => null) : null;
1914
+ // The game's own SDK asked for its session and the server refused it, so none of its events reached the run.
1915
+ const refusal = sessionRefusal(sessionRecord);
1867
1916
  if (refusal) {
1868
1917
  honesty.sdkSession = refusal;
1869
1918
  transcript.write({ kind: 'game_events_refused', status: refusal.status, error: refusal.error, key: refusal.key, tagged: refusal.tagged, times: refusal.times });
1870
1919
  log(refusedEventsBody(refusal));
1871
1920
  }
1921
+ // Whether the game's own events were tagged as this playtest: said only from the session requests the run saw.
1922
+ const tag = playtestTagging(sessionRecord, honesty.events ? honesty.events.record().total : 0);
1923
+ if (tag) {
1924
+ honesty.playtestTag = tag;
1925
+ if (tag.state !== 'none') transcript.write({ kind: 'game_events_tag', state: tag.state, sessions: tag.sessions, untagged: tag.untagged, events: tag.events, sdk: tag.sdk, given: tag.given });
1926
+ }
1872
1927
  if (completionRepairPending) transcript.write({ kind: 'brief_completion_repair_unavailable', reason: quitReason, detail: quitDetail, independently_verified: false });
1873
1928
  return {
1874
1929
  actionsTaken: actions,
@@ -1894,7 +1949,9 @@ async function playLoop({
1894
1949
  canceled,
1895
1950
  imageBudget,
1896
1951
  finalScreenshot: final ? final.relativePath : null,
1897
- actionLog: actionLogFrom(actionRecords)
1952
+ maxActions,
1953
+ // Each checked input's result rides on its entry of the action log (./intent.js).
1954
+ actionLog: annotateActionLog(actionLogFrom(actionRecords), intentWatch.checks())
1898
1955
  };
1899
1956
  }
1900
1957
 
@@ -2297,11 +2354,22 @@ async function reportPhase({
2297
2354
  // The playtester's impressions go into report.json beside the findings, never among them.
2298
2355
  if (impressions.length > 0) report = { ...report, impressions: impressions.map(({ finding, ...impression }) => impression) };
2299
2356
  // A finding the game's own events confirmed says so, and the report has a section on what they measured.
2357
+ // Beside them, whether those events were tagged as this playtest, said only from the session requests the run saw (./sdkSession.js).
2358
+ const tagBody = honesty ? playtestTagBody(honesty.playtestTag) : null;
2359
+ let eventsSection = false;
2300
2360
  if (eventRun) {
2301
2361
  withEventEvidence(report.findings || [], eventRun);
2302
2362
  const lines = eventsReportLines(eventRun, { findings: report.findings || [], turnedAway });
2303
- if (lines.length > 0) markdown = replaceSection(markdown, EVENTS_HEADING, lines.slice(2).join('\n').replace(/\s+$/, ''));
2363
+ if (lines.length > 0) {
2364
+ const body = lines.slice(2);
2365
+ if (tagBody) body.splice(1, 0, '', tagBody);
2366
+ markdown = replaceSection(markdown, EVENTS_HEADING, body.join('\n').replace(/\s+$/, ''));
2367
+ eventsSection = true;
2368
+ }
2304
2369
  }
2370
+ // An untagged session that sent no events still counts as a real player, and a record the run cannot read is said as
2371
+ // such, so both are said even with nothing measured.
2372
+ if (!eventsSection && tagBody && honesty.playtestTag.state !== 'tagged') markdown = replaceSection(markdown, EVENTS_HEADING, tagBody);
2305
2373
  // The game's own SDK was refused its session: said plainly where its events would be, never left to read as benign.
2306
2374
  if (honesty && honesty.sdkSession && !(eventRun && eventRun.gameEvents && eventRun.gameEvents.total > 0)) markdown = replaceSection(markdown, EVENTS_HEADING, refusedEventsBody(honesty.sdkSession));
2307
2375
  // What a screenshot shows comes from the picture: one taken while the picture lagged the game says so.
@@ -2320,6 +2388,23 @@ async function reportPhase({
2320
2388
  const generatedAt = new Date().toISOString();
2321
2389
  const facts = reportFacts({ persona, driverName, target, play });
2322
2390
  markdown = stampGeneratedAt(markdown, generatedAt, facts);
2391
+ // What the run played (./intent.js), in the hosted report's words, under the stamp: a run that played to its budget is said
2392
+ // so, with how far it got and the result it aimed at and never reached.
2393
+ const scope = playScopeOf(play, honesty);
2394
+ if (scope) {
2395
+ markdown = withPlayedLine(markdown, scope.line);
2396
+ honesty.scope = scope;
2397
+ transcript.write({ kind: 'played_scope', line: scope.line });
2398
+ log(`what was played: ${scope.line}`);
2399
+ }
2400
+ // The in-character section held to the record: a sentence the record or the frames show otherwise is left out, and the
2401
+ // record's own fact said instead.
2402
+ const heldBack = holdInCharacter(markdown, { families: honesty && honesty.intent ? honesty.intent.families() : [], movedAtAll: couldMove(play.records), turnedAway, repeats: repeatsTurnedAway });
2403
+ if (heldBack.held.length > 0) {
2404
+ markdown = heldBack.markdown;
2405
+ transcript.write({ kind: 'in_character_held', sentences: heldBack.held.map(entry => ({ sentence: String(entry.sentence).slice(0, 300), fact: entry.fact })) });
2406
+ log(`held the in-character section to the run's record: ${heldBack.held.length} sentence(s) it shows otherwise left out.`);
2407
+ }
2323
2408
  // The same slots in the prose the dashboard shows from report.json.
2324
2409
  report = fillReportPlaceholders(report, { generatedAt, ...facts });
2325
2410
  // A finding the server would drop for want of an uploaded file it can
@@ -2376,6 +2461,41 @@ export function watchedFor(report, watched) {
2376
2461
  /** The heading of the report's section on the game's own events, the hosted runner's own. */
2377
2462
  export const EVENTS_HEADING = '## Measured from the game\'s own events';
2378
2463
 
2464
+ /**
2465
+ * What the run played (./intent.js playedScope), from the play loop's result and the runner's record: the intent watch and the
2466
+ * game's own event names. Null with nothing to say.
2467
+ */
2468
+ export function playScopeOf(play, honesty) {
2469
+ if (!play || !honesty) return null;
2470
+ const run = gameEventsRun(honesty);
2471
+ const events = run && run.gameEvents && Array.isArray(run.gameEvents.events) ? run.gameEvents.events : [];
2472
+ // Event names are the build's own strings: only plain ones are repeated.
2473
+ const names = events.map(event => event && event.name).filter(name => typeof name === 'string' && /^[A-Za-z0-9_.:-]{1,40}$/.test(name));
2474
+ return playedScope({ watch: honesty.intent || null, actionsTaken: play.actionsTaken, maxActions: play.maxActions, quitReason: play.quitReason,
2475
+ reserveStopped: Boolean(play.reserveStopped), eventNames: names, eventTotal: run && run.gameEvents ? run.gameEvents.total : 0 });
2476
+ }
2477
+
2478
+ /** What the run played, in the shape usage.json carries it (`line` first: the server's evidence report reads it). */
2479
+ export function scopeForUsage(scope) {
2480
+ if (!scope || !scope.line) return null;
2481
+ return {
2482
+ line: scope.line,
2483
+ budget: Boolean(scope.budget),
2484
+ reached: scope.reached || null,
2485
+ not_reached: (scope.families || []).map(f => ({ expected: f.expected, input: f.input, misses: f.misses, refused: f.refused || 0, actions: f.actions, saw: f.saw })),
2486
+ parts: scope.parts || []
2487
+ };
2488
+ }
2489
+
2490
+ /**
2491
+ * Whether anything the run sent could have moved something across the game: a movement key, a held key, a drag, a stick, or
2492
+ * any pointer input (a click can walk a character in a point and click game). The in-character section is held to it.
2493
+ */
2494
+ export function couldMove(records) {
2495
+ return (Array.isArray(records) ? records : []).some(record => record && record.kind === 'action' && record.ok
2496
+ && (movementInput(record.tool, record.input || {}) || ['click', 'hover', 'drag', 'swipe', 'gamepad', 'pinch'].includes(record.tool)));
2497
+ }
2498
+
2379
2499
  /**
2380
2500
  * What the claim judge and the report read the game's own events from: one
2381
2501
  * object per run (the verdicts are kept against it), or null when the driver
@@ -2805,6 +2925,8 @@ export function buildReportRequest({ skill, schemas = [], persona, brief, localB
2805
2925
  'What the screens read after the actions you stated an expectation for, and at the end (their visible text, which the observation list above leaves out):',
2806
2926
  screenTextLines(play.records),
2807
2927
  '',
2928
+ // The intent check (./intent.js): what missed, what was not sent for repeating a miss, and what the run played.
2929
+ ...(honesty && honesty.intent ? (text => (text ? [text, ''] : []))(intentReportLines(honesty.intent, playScopeOf(play, honesty))) : []),
2808
2930
  CHOICE_CHECK_INSTRUCTION,
2809
2931
  ...(choiceCheck ? [choiceCheckLine(choiceCheck)] : []),
2810
2932
  ...(play.declined ? ['', declinedPrompt(play.declined, Boolean(play.declinedEnded))] : []),
@@ -2827,6 +2949,7 @@ export function buildReportRequest({ skill, schemas = [], persona, brief, localB
2827
2949
  'Network notes (failed requests the runner recorded, with the URL and the status; list them under a "Network notes" heading in report.md when there are any):',
2828
2950
  networkNoteLines(notes),
2829
2951
  ...(honesty && honesty.sdkSession ? [refusedReportInstruction(honesty.sdkSession)] : []),
2952
+ ...(honesty && playtestTagReportInstruction(honesty.playtestTag) ? [playtestTagReportInstruction(honesty.playtestTag)] : []),
2830
2953
  '',
2831
2954
  'Each note carries "after": the URL and title of the observation that followed it. A blocker or major finding must cite the observation index where the failure is visible, as evidence {"type": "transcript_step", "ref": "observation N"}, and must not be contradicted by its note\'s "after" state or by a later persona note: if the next screen or a later note shows the game working, it is not a blocker or a major. Cite a note as {"type": "transcript_step", "ref": "note N"}.',
2832
2955
  'Make each finding one independently supported claim, with a title and description that say the same thing. Describe directly visible content separately from a claim that something fails to change, finish or respond over time. Cite the observation that supports each claim. Do not infer that a game or value is stuck from one still picture. Preserve a temporal claim and its supporting observations when it is what you observed; do not silently replace it with a different static claim. Report only the behavior and content actually observed.',
@@ -2845,7 +2968,10 @@ export function buildReportRequest({ skill, schemas = [], persona, brief, localB
2845
2968
  ].join('\n');
2846
2969
  // The prompt is built from notes, observations and the action log; none
2847
2970
  // of them may carry the test account password into the report step.
2971
+ // The game's SDK sessions as data in their own element: the SDK name the page sent never enters the instructions (./sdkSession.js).
2972
+ const tagRecord = honesty ? playtestTagRecord(honesty.playtestTag) : null;
2848
2973
  return { system, messages: [{ role: 'user', content: [{ type: 'text', text: scrubSecrets(text, secrets) },
2974
+ ...(tagRecord ? [{ type: 'text', text: `<${TAG_RECORD_TAG}>\n${JSON.stringify(tagRecord)}\n</${TAG_RECORD_TAG}>` }] : []),
2849
2975
  // This is the public pack contract, not local-account or gameplay data.
2850
2976
  // Keep its exact keys/constraints identical to the validator's schema.
2851
2977
  ...(reportSchema ? [{ type: 'text', text: `<report_json_schema>\n${JSON.stringify(reportSchema)}\n</report_json_schema>` }] : [])] }] };
@@ -3303,7 +3429,10 @@ async function finish(outcome, ledger, runDirectory, transcript, heartbeat) {
3303
3429
  }
3304
3430
  outcome.usage = ledger.toReportUsage();
3305
3431
  outcome.duration = ledger.duration();
3306
- await writeUsageFile(runDirectory, ledger, { gameEvents: outcome.gameEvents || null, gameMemory: outcome.gameMemory || null });
3432
+ // Whether the game's own events were tagged as this playtest, beside them, on every path that played (./sdkSession.js).
3433
+ const tagUsage = playtestTagUsage(outcome.playtestTag);
3434
+ const gameEvents = tagUsage ? { ...(outcome.gameEvents || {}), playtestTag: tagUsage } : outcome.gameEvents || null;
3435
+ await writeUsageFile(runDirectory, ledger, { gameEvents, gameMemory: outcome.gameMemory || null, intent: outcome.intent || null, scope: outcome.scope || null });
3307
3436
  transcript.write({ kind: 'end', state: outcome.state, quit_reason: outcome.quitReason, actions: outcome.actionsTaken });
3308
3437
  await transcript.close();
3309
3438
  return outcome;
@@ -3591,7 +3720,9 @@ async function writePartialReport({ outcome, runDirectory, persona, driverName,
3591
3720
  // What the runner saw happen is kept even in a report nobody reviewed: a
3592
3721
  // crash it watched is true whatever became of the report step.
3593
3722
  const honest = writeHonesty({ report, markdown, honesty, driverName, notes, screenshots, observations });
3594
- const stamped = stampGeneratedAt(honest.markdown, new Date().toISOString(), reportFacts({ persona, driverName, target, play }));
3723
+ const scope = playScopeOf(play.maxActions ? play : { ...play, maxActions: outcome.maxActions }, honesty);
3724
+ const stamped = withPlayedLine(stampGeneratedAt(honest.markdown, new Date().toISOString(), reportFacts({ persona, driverName, target, play })), scope ? scope.line : null);
3725
+ if (scope && honesty) honesty.scope = scope;
3595
3726
  await writeReportFiles({ runDirectory, markdown: stamped, report: honest.report });
3596
3727
  outcome.report = honest.report;
3597
3728
  outcome.reportMarkdown = stamped;
@@ -4032,11 +4163,18 @@ export function introducesError(before, after) {
4032
4163
  export function actionLogLines(log) {
4033
4164
  if (!Array.isArray(log) || log.length === 0) return '(none)';
4034
4165
  const shown = log.slice(-MAX_ACTIONS_IN_REPORT);
4035
- const lines = shown.map(entry => `${entry.action}. ${entry.kind} ${entry.target}: ${entry.changed ? 'screen changed' : 'no change'}${entry.expect ? ` (you expected: ${entry.expect}${Number.isInteger(entry.observationAfter) ? `; observation ${entry.observationAfter} is what followed` : ''})` : ''}`);
4166
+ const lines = shown.map(entry => `${entry.action}. ${entry.kind} ${entry.target}: ${entry.changed ? 'screen changed' : 'no change'}${entry.expect ? ` (you expected: ${entry.expect}${Number.isInteger(entry.observationAfter) ? `; observation ${entry.observationAfter} is what followed` : ''}${intentWords(entry.intent)})` : ''}`);
4036
4167
  if (shown.length < log.length) lines.unshift(`(the first ${log.length - shown.length} are left out)`);
4037
4168
  return lines.join('\n');
4038
4169
  }
4039
4170
 
4171
+ /** What the intent check found of one action, as the action list says it (./intent.js annotateActionLog). */
4172
+ function intentWords(intent) {
4173
+ if (!intent || !intent.result) return '';
4174
+ if (intent.result === 'met') return '; you confirmed it';
4175
+ return `; it MISSED${intent.saw ? `: the screen showed ${JSON.stringify(intent.saw)} instead` : ''}`;
4176
+ }
4177
+
4040
4178
  /**
4041
4179
  * The failed requests the runner recorded, one line each, for the report
4042
4180
  * prompt's network notes.