unity-open-mcp 1.5.0 → 1.6.0

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 (90) hide show
  1. package/dist/capabilities/cost-hints.js +73 -0
  2. package/dist/capabilities/cost-hints.js.map +1 -1
  3. package/dist/capabilities/intent-groups.js +76 -4
  4. package/dist/capabilities/intent-groups.js.map +1 -1
  5. package/dist/capabilities/lifecycle.js +9 -0
  6. package/dist/capabilities/lifecycle.js.map +1 -1
  7. package/dist/capabilities/tool-groups.js +75 -17
  8. package/dist/capabilities/tool-groups.js.map +1 -1
  9. package/dist/constants.d.ts +2 -2
  10. package/dist/constants.js +2 -2
  11. package/dist/event-stream.d.ts +10 -0
  12. package/dist/event-stream.js +29 -0
  13. package/dist/event-stream.js.map +1 -1
  14. package/dist/game-view-settle.d.ts +18 -0
  15. package/dist/game-view-settle.js +81 -0
  16. package/dist/game-view-settle.js.map +1 -0
  17. package/dist/jobs/adapters.d.ts +59 -0
  18. package/dist/jobs/adapters.js +226 -0
  19. package/dist/jobs/adapters.js.map +1 -1
  20. package/dist/live-client.d.ts +10 -0
  21. package/dist/live-client.js +26 -3
  22. package/dist/live-client.js.map +1 -1
  23. package/dist/local-tools.js +3 -0
  24. package/dist/local-tools.js.map +1 -1
  25. package/dist/playmode-routes.d.ts +17 -0
  26. package/dist/playmode-routes.js +50 -0
  27. package/dist/playmode-routes.js.map +1 -0
  28. package/dist/playtest/png.d.ts +27 -0
  29. package/dist/playtest/png.js +248 -0
  30. package/dist/playtest/png.js.map +1 -0
  31. package/dist/playtest/recorder.d.ts +203 -0
  32. package/dist/playtest/recorder.js +945 -0
  33. package/dist/playtest/recorder.js.map +1 -0
  34. package/dist/playtest/redact.d.ts +16 -0
  35. package/dist/playtest/redact.js +124 -0
  36. package/dist/playtest/redact.js.map +1 -0
  37. package/dist/playtest/report.d.ts +73 -0
  38. package/dist/playtest/report.js +477 -0
  39. package/dist/playtest/report.js.map +1 -0
  40. package/dist/playtest/session-store.d.ts +78 -0
  41. package/dist/playtest/session-store.js +224 -0
  42. package/dist/playtest/session-store.js.map +1 -0
  43. package/dist/skill/SKILL.md +20 -3
  44. package/dist/skill/references/senses-and-tests.md +3 -0
  45. package/dist/tool-router.d.ts +44 -0
  46. package/dist/tool-router.js +235 -2
  47. package/dist/tool-router.js.map +1 -1
  48. package/dist/tools/batch-execute.js +5 -1
  49. package/dist/tools/batch-execute.js.map +1 -1
  50. package/dist/tools/capture-inline.js +30 -12
  51. package/dist/tools/capture-inline.js.map +1 -1
  52. package/dist/tools/capture-series.d.ts +46 -0
  53. package/dist/tools/capture-series.js +116 -0
  54. package/dist/tools/capture-series.js.map +1 -0
  55. package/dist/tools/game-view.d.ts +44 -0
  56. package/dist/tools/game-view.js +103 -0
  57. package/dist/tools/game-view.js.map +1 -0
  58. package/dist/tools/index.d.ts +1 -0
  59. package/dist/tools/index.js +34 -7
  60. package/dist/tools/index.js.map +1 -1
  61. package/dist/tools/inputsim-gesture.d.ts +46 -0
  62. package/dist/tools/inputsim-gesture.js +123 -0
  63. package/dist/tools/inputsim-gesture.js.map +1 -0
  64. package/dist/tools/inputsim-pointer.js +35 -2
  65. package/dist/tools/inputsim-pointer.js.map +1 -1
  66. package/dist/tools/inputsim-touch.js +42 -22
  67. package/dist/tools/inputsim-touch.js.map +1 -1
  68. package/dist/tools/jobs.js +1 -1
  69. package/dist/tools/jobs.js.map +1 -1
  70. package/dist/tools/player-state.d.ts +42 -0
  71. package/dist/tools/player-state.js +142 -0
  72. package/dist/tools/player-state.js.map +1 -0
  73. package/dist/tools/playtest-conditions.d.ts +334 -0
  74. package/dist/tools/playtest-conditions.js +99 -0
  75. package/dist/tools/playtest-conditions.js.map +1 -0
  76. package/dist/tools/playtest-session.d.ts +45 -0
  77. package/dist/tools/playtest-session.js +105 -0
  78. package/dist/tools/playtest-session.js.map +1 -0
  79. package/dist/tools/playtest-wait.d.ts +46 -0
  80. package/dist/tools/playtest-wait.js +86 -0
  81. package/dist/tools/playtest-wait.js.map +1 -0
  82. package/dist/tools/screenshot.js +31 -8
  83. package/dist/tools/screenshot.js.map +1 -1
  84. package/dist/tools/text-target.d.ts +22 -0
  85. package/dist/tools/text-target.js +39 -0
  86. package/dist/tools/text-target.js.map +1 -0
  87. package/dist/tools/ui-snapshot.d.ts +41 -0
  88. package/dist/tools/ui-snapshot.js +87 -0
  89. package/dist/tools/ui-snapshot.js.map +1 -0
  90. package/package.json +1 -1
@@ -0,0 +1,248 @@
1
+ // Playtest session report — PNG thumbnails without an image dependency.
2
+ //
3
+ // The bridge writes full-size frames to disk; the session report needs small
4
+ // previews of them. Decoding happens here, in the server, so a report can be
5
+ // written after the Editor is gone (an MCP server restart, a crashed Editor)
6
+ // and the bridge contract does not change. Only `node:zlib` is used: PNG is
7
+ // zlib-compressed scanlines with a per-row filter, so a reader for the
8
+ // non-interlaced 8/16-bit formats Unity's EncodeToPNG produces is short.
9
+ // Anything else (interlaced, < 8-bit gray) returns null and the report links
10
+ // the full frame without a thumbnail.
11
+ import { deflateSync, inflateSync } from "node:zlib";
12
+ const SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
13
+ /** Refuse images whose raw RGBA would exceed this (a corrupt header, a 16K frame). */
14
+ const MAX_PIXELS = 64 * 1024 * 1024;
15
+ let crcTable = null;
16
+ function crc32(bytes) {
17
+ if (!crcTable) {
18
+ crcTable = new Uint32Array(256);
19
+ for (let n = 0; n < 256; n++) {
20
+ let c = n;
21
+ for (let k = 0; k < 8; k++)
22
+ c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
23
+ crcTable[n] = c >>> 0;
24
+ }
25
+ }
26
+ let crc = 0xffffffff;
27
+ for (let i = 0; i < bytes.length; i++)
28
+ crc = crcTable[(crc ^ bytes[i]) & 0xff] ^ (crc >>> 8);
29
+ return (crc ^ 0xffffffff) >>> 0;
30
+ }
31
+ /** Read the width / height from a PNG header without decoding it. */
32
+ export function pngSize(bytes) {
33
+ if (bytes.length < 24 || !Buffer.from(bytes.subarray(0, 8)).equals(SIGNATURE))
34
+ return null;
35
+ const view = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
36
+ if (view.toString("latin1", 12, 16) !== "IHDR")
37
+ return null;
38
+ return { width: view.readUInt32BE(16), height: view.readUInt32BE(20) };
39
+ }
40
+ /** Decode a PNG into 8-bit RGBA, or null for a format this reader does not cover. */
41
+ export function decodePng(bytes) {
42
+ const buf = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
43
+ if (buf.length < 8 || !buf.subarray(0, 8).equals(SIGNATURE))
44
+ return null;
45
+ let offset = 8;
46
+ let width = 0, height = 0, depth = 0, colorType = -1, interlace = 0;
47
+ let palette = null;
48
+ let transparency = null;
49
+ const idat = [];
50
+ while (offset + 12 <= buf.length) {
51
+ const length = buf.readUInt32BE(offset);
52
+ const type = buf.toString("latin1", offset + 4, offset + 8);
53
+ const start = offset + 8;
54
+ if (start + length + 4 > buf.length)
55
+ return null;
56
+ const chunk = buf.subarray(start, start + length);
57
+ if (type === "IHDR") {
58
+ width = chunk.readUInt32BE(0);
59
+ height = chunk.readUInt32BE(4);
60
+ depth = chunk[8];
61
+ colorType = chunk[9];
62
+ interlace = chunk[12];
63
+ }
64
+ else if (type === "PLTE")
65
+ palette = chunk;
66
+ else if (type === "tRNS")
67
+ transparency = chunk;
68
+ else if (type === "IDAT")
69
+ idat.push(chunk);
70
+ else if (type === "IEND")
71
+ break;
72
+ offset = start + length + 4;
73
+ }
74
+ if (!width || !height || width * height > MAX_PIXELS || interlace !== 0)
75
+ return null;
76
+ const channels = colorType === 0 ? 1 : colorType === 2 ? 3 : colorType === 3 ? 1 : colorType === 4 ? 2 : colorType === 6 ? 4 : 0;
77
+ if (!channels)
78
+ return null;
79
+ if (colorType === 3 ? depth !== 8 || !palette : depth !== 8 && depth !== 16)
80
+ return null;
81
+ const bytesPerSample = depth / 8;
82
+ const bpp = channels * bytesPerSample;
83
+ const stride = width * bpp;
84
+ let raw;
85
+ try {
86
+ raw = inflateSync(Buffer.concat(idat));
87
+ }
88
+ catch {
89
+ return null;
90
+ }
91
+ if (raw.length < (stride + 1) * height)
92
+ return null;
93
+ const out = new Uint8Array(width * height * 4);
94
+ let prev = new Uint8Array(stride);
95
+ let row = new Uint8Array(stride);
96
+ for (let y = 0; y < height; y++) {
97
+ const base = y * (stride + 1);
98
+ const filter = raw[base];
99
+ for (let x = 0; x < stride; x++) {
100
+ const value = raw[base + 1 + x];
101
+ const left = x >= bpp ? row[x - bpp] : 0;
102
+ const up = prev[x];
103
+ const upLeft = x >= bpp ? prev[x - bpp] : 0;
104
+ let predictor;
105
+ switch (filter) {
106
+ case 0:
107
+ predictor = 0;
108
+ break;
109
+ case 1:
110
+ predictor = left;
111
+ break;
112
+ case 2:
113
+ predictor = up;
114
+ break;
115
+ case 3:
116
+ predictor = (left + up) >> 1;
117
+ break;
118
+ case 4: {
119
+ const p = left + up - upLeft;
120
+ const pa = Math.abs(p - left), pb = Math.abs(p - up), pc = Math.abs(p - upLeft);
121
+ predictor = pa <= pb && pa <= pc ? left : pb <= pc ? up : upLeft;
122
+ break;
123
+ }
124
+ default: return null;
125
+ }
126
+ row[x] = (value + predictor) & 0xff;
127
+ }
128
+ for (let x = 0; x < width; x++) {
129
+ const s = x * bpp, d = (y * width + x) * 4;
130
+ // 16-bit samples keep their high byte.
131
+ const sample = (i) => row[s + i * bytesPerSample];
132
+ switch (colorType) {
133
+ case 0:
134
+ out[d] = out[d + 1] = out[d + 2] = sample(0);
135
+ out[d + 3] = 255;
136
+ break;
137
+ case 2:
138
+ out[d] = sample(0);
139
+ out[d + 1] = sample(1);
140
+ out[d + 2] = sample(2);
141
+ out[d + 3] = 255;
142
+ break;
143
+ case 3: {
144
+ const index = row[s];
145
+ out[d] = palette[index * 3] ?? 0;
146
+ out[d + 1] = palette[index * 3 + 1] ?? 0;
147
+ out[d + 2] = palette[index * 3 + 2] ?? 0;
148
+ out[d + 3] = transparency && index < transparency.length ? transparency[index] : 255;
149
+ break;
150
+ }
151
+ case 4:
152
+ out[d] = out[d + 1] = out[d + 2] = sample(0);
153
+ out[d + 3] = sample(1);
154
+ break;
155
+ default:
156
+ out[d] = sample(0);
157
+ out[d + 1] = sample(1);
158
+ out[d + 2] = sample(2);
159
+ out[d + 3] = sample(3);
160
+ }
161
+ }
162
+ const swap = prev;
163
+ prev = row;
164
+ row = swap;
165
+ }
166
+ return { width, height, data: out };
167
+ }
168
+ /** Box-filter downscale so the image fits maxWidth × maxHeight (never upscales). */
169
+ export function downscale(image, maxWidth, maxHeight) {
170
+ const ratio = Math.min(1, maxWidth / image.width, maxHeight / image.height);
171
+ const width = Math.max(1, Math.round(image.width * ratio));
172
+ const height = Math.max(1, Math.round(image.height * ratio));
173
+ if (width === image.width && height === image.height)
174
+ return image;
175
+ const out = new Uint8Array(width * height * 4);
176
+ for (let ty = 0; ty < height; ty++) {
177
+ const y0 = Math.floor((ty * image.height) / height);
178
+ const y1 = Math.max(y0 + 1, Math.floor(((ty + 1) * image.height) / height));
179
+ for (let tx = 0; tx < width; tx++) {
180
+ const x0 = Math.floor((tx * image.width) / width);
181
+ const x1 = Math.max(x0 + 1, Math.floor(((tx + 1) * image.width) / width));
182
+ let r = 0, g = 0, b = 0, a = 0;
183
+ for (let y = y0; y < y1; y++) {
184
+ let i = (y * image.width + x0) * 4;
185
+ for (let x = x0; x < x1; x++, i += 4) {
186
+ r += image.data[i];
187
+ g += image.data[i + 1];
188
+ b += image.data[i + 2];
189
+ a += image.data[i + 3];
190
+ }
191
+ }
192
+ const n = (y1 - y0) * (x1 - x0);
193
+ const d = (ty * width + tx) * 4;
194
+ out[d] = Math.round(r / n);
195
+ out[d + 1] = Math.round(g / n);
196
+ out[d + 2] = Math.round(b / n);
197
+ out[d + 3] = Math.round(a / n);
198
+ }
199
+ }
200
+ return { width, height, data: out };
201
+ }
202
+ function chunk(type, data) {
203
+ const head = Buffer.alloc(8);
204
+ head.writeUInt32BE(data.length, 0);
205
+ head.write(type, 4, "latin1");
206
+ const crc = Buffer.alloc(4);
207
+ crc.writeUInt32BE(crc32(Buffer.concat([head.subarray(4), data])), 0);
208
+ return Buffer.concat([head, data, crc]);
209
+ }
210
+ /** Encode RGBA as a PNG (RGB when every pixel is opaque). */
211
+ export function encodePng(image) {
212
+ let opaque = true;
213
+ for (let i = 3; i < image.data.length; i += 4)
214
+ if (image.data[i] !== 255) {
215
+ opaque = false;
216
+ break;
217
+ }
218
+ const channels = opaque ? 3 : 4;
219
+ const stride = image.width * channels;
220
+ const raw = Buffer.alloc((stride + 1) * image.height);
221
+ for (let y = 0; y < image.height; y++) {
222
+ const base = y * (stride + 1);
223
+ raw[base] = 1; // Sub filter: cheap and compresses UI frames well.
224
+ for (let x = 0; x < image.width; x++) {
225
+ const s = (y * image.width + x) * 4;
226
+ for (let c = 0; c < channels; c++) {
227
+ const value = image.data[s + c];
228
+ const left = x > 0 ? image.data[s - 4 + c] : 0;
229
+ raw[base + 1 + x * channels + c] = (value - left) & 0xff;
230
+ }
231
+ }
232
+ }
233
+ const header = Buffer.alloc(13);
234
+ header.writeUInt32BE(image.width, 0);
235
+ header.writeUInt32BE(image.height, 4);
236
+ header[8] = 8;
237
+ header[9] = opaque ? 2 : 6;
238
+ return Buffer.concat([SIGNATURE, chunk("IHDR", header), chunk("IDAT", deflateSync(raw, { level: 9 })), chunk("IEND", new Uint8Array(0))]);
239
+ }
240
+ /** Decode, fit into the box and re-encode; null when the source cannot be decoded. */
241
+ export function thumbnail(bytes, maxWidth, maxHeight) {
242
+ const image = decodePng(bytes);
243
+ if (!image)
244
+ return null;
245
+ const small = downscale(image, maxWidth, maxHeight);
246
+ return { png: encodePng(small), width: small.width, height: small.height, source: { width: image.width, height: image.height } };
247
+ }
248
+ //# sourceMappingURL=png.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/playtest/png.ts"],"names":[],"mappings":"A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AC9E,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACpD,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;AACnI,CAAC"}
@@ -0,0 +1,203 @@
1
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ import type { BridgeEvent } from "../event-stream.js";
3
+ import { Redactor } from "./redact.js";
4
+ import { SessionStore, type SessionMeta, type SessionOwner } from "./session-store.js";
5
+ export declare const PLAYTEST_SESSION_TOOL = "unity_open_mcp_playtest_session";
6
+ export declare const RECORDING_LIMITS: {
7
+ /** Recorded calls per session; later calls are counted, not logged. */
8
+ readonly maxCalls: 500;
9
+ readonly maxMarks: 200;
10
+ /** Frames linked / copied into the report folder per session. */
11
+ readonly maxFrames: 300;
12
+ readonly maxFrameBytes: number;
13
+ /** Thumbnails written by `end` (downscaled; the full frames stay files). */
14
+ readonly maxThumbnails: 60;
15
+ readonly maxErrorsPerCall: 20;
16
+ /** Occurrences of one console message logged per session; later ones are counted, not logged. */
17
+ readonly maxErrorRepeats: 20;
18
+ /** Console errors logged per session; later ones are counted, not logged. */
19
+ readonly maxErrors: 2000;
20
+ readonly maxEditorEvents: 200;
21
+ readonly maxArgsChars: 2000;
22
+ readonly maxPendingErrors: 500;
23
+ };
24
+ export type CallKind = "input" | "wait" | "capture" | "command" | "control";
25
+ /** Which recorded category a call falls in (null = not recorded). */
26
+ export declare function classifyCall(tool: string, args: Record<string, unknown>): {
27
+ kind: CallKind;
28
+ label: string;
29
+ args: unknown;
30
+ } | null;
31
+ export declare function ownerKey(owner: SessionOwner): string;
32
+ interface PendingError {
33
+ ts: number;
34
+ type: string;
35
+ message: string;
36
+ stack?: string;
37
+ source: "stream" | "response";
38
+ }
39
+ /** A finished call's time window and its response-only errors, each waiting for the stream's copy (with the stack). */
40
+ interface CallWindow {
41
+ seq: number;
42
+ start: number;
43
+ end: number;
44
+ messages: Set<string>;
45
+ }
46
+ interface OpenSession {
47
+ meta: SessionMeta;
48
+ dir: string;
49
+ nextSeq: number;
50
+ nextStep: number;
51
+ calls: number;
52
+ droppedCalls: number;
53
+ marks: number;
54
+ frames: number;
55
+ frameBytes: number;
56
+ framesSkipped: number;
57
+ editorEvents: number;
58
+ lastEditorState: string | null;
59
+ streamReady: number;
60
+ windows: CallWindow[];
61
+ inflight: Map<number, number>;
62
+ pending: PendingError[];
63
+ /** Stream errors dropped because the pending backlog was full. */
64
+ pendingDropped: number;
65
+ streamGaps: number;
66
+ /** Logged occurrences per error message, and how many errors were logged. */
67
+ errorSeen: Map<string, number>;
68
+ errorsLogged: number;
69
+ /** Counted, not logged: repeats of one message past maxErrorRepeats, and errors past maxErrors / maxErrorsPerCall. */
70
+ errorRepeats: Map<string, {
71
+ type: string;
72
+ message: string;
73
+ count: number;
74
+ }>;
75
+ errorsOverLimit: number;
76
+ /** Stream errors already written (ts + message), so a job result's own copy is not a second error. */
77
+ recentErrors: Array<{
78
+ ts: number;
79
+ key: string;
80
+ }>;
81
+ jobs: Map<string, {
82
+ seq: number;
83
+ kind: CallKind;
84
+ tool: string;
85
+ }>;
86
+ limitNoted: Set<string>;
87
+ sinceMark: {
88
+ calls: number;
89
+ errors: number;
90
+ captures: number;
91
+ failed: number;
92
+ };
93
+ }
94
+ export interface CallHandle {
95
+ session: OpenSession;
96
+ seq: number;
97
+ tool: string;
98
+ kind: CallKind;
99
+ start: number;
100
+ }
101
+ /** Calls a tool through the normal route on behalf of the session owner. */
102
+ export type ToolCaller = (tool: string, args: Record<string, unknown>) => Promise<CallToolResult>;
103
+ export declare class PlaytestError extends Error {
104
+ readonly code: string;
105
+ readonly detail: Record<string, unknown>;
106
+ constructor(code: string, message: string, detail?: Record<string, unknown>);
107
+ }
108
+ export interface RecorderOptions {
109
+ root: string;
110
+ projectPath: string;
111
+ knownSecrets?: Iterable<string | undefined | null>;
112
+ now?: () => number;
113
+ pid?: number;
114
+ /** Process-liveness probe for adoption (tests inject). */
115
+ isAlive?: (pid: number) => boolean;
116
+ /** Whether the bridge event stream is connected (errors without it come from responses only). */
117
+ streamConnected?: () => boolean;
118
+ }
119
+ export declare class PlaytestRecorder {
120
+ readonly store: SessionStore;
121
+ readonly redactor: Redactor;
122
+ private readonly projectPath;
123
+ private readonly now;
124
+ private readonly pid;
125
+ private readonly isAlive;
126
+ private readonly streamConnected;
127
+ private readonly open;
128
+ /** Owners whose `start` is between its check and its session (awaiting the bridge). */
129
+ private readonly starting;
130
+ private identity;
131
+ constructor(options: RecorderOptions);
132
+ /** Cheap hot-path check: is any session open in this process? */
133
+ get openCount(): number;
134
+ isRecording(owner: SessionOwner): boolean;
135
+ begin(owner: SessionOwner, tool: string, args: Record<string, unknown>): CallHandle | null;
136
+ finish(handle: CallHandle, _args: Record<string, unknown>, result: CallToolResult | null, thrown?: unknown): void;
137
+ /** `jobs wait` / `jobs status` reached a terminal state for a job a recorded call started. */
138
+ observeJob(owner: SessionOwner, args: Record<string, unknown>, result: CallToolResult): void;
139
+ /** Bridge event stream listener (every event, every open session). */
140
+ onEvent(event: BridgeEvent): void;
141
+ start(owner: SessionOwner, args: Record<string, unknown>, call: ToolCaller): Promise<Record<string, unknown>>;
142
+ private startClaimed;
143
+ mark(owner: SessionOwner, args: Record<string, unknown>, sessionArg?: string): Record<string, unknown>;
144
+ status(owner: SessionOwner): Record<string, unknown>;
145
+ resume(owner: SessionOwner, sessionArg: string | undefined): Record<string, unknown>;
146
+ end(owner: SessionOwner, args: Record<string, unknown>, call: ToolCaller): Promise<Record<string, unknown>>;
147
+ list(owner: SessionOwner, limit: number): Record<string, unknown>;
148
+ private openSession;
149
+ private isOpen;
150
+ private append;
151
+ private noteLimit;
152
+ /** A call over maxCalls: counted (the count is logged, so an adopting process keeps it), not recorded. */
153
+ private dropCall;
154
+ /**
155
+ * Whether this console error is written to the log. Each message is logged
156
+ * maxErrorRepeats times and the session maxErrors times; the rest are counted
157
+ * (per message, written at end), so an error thrown every frame cannot grow
158
+ * the log without bound. `occurrence: false` is a second copy of an error
159
+ * already counted (the stream's copy of a response error): written while the
160
+ * message is under its cap, never counted.
161
+ */
162
+ private keepError;
163
+ private rememberStreamError;
164
+ private requireOpen;
165
+ /** Take over an open session whose owner is this caller or whose server process is gone. */
166
+ private adopt;
167
+ private lostInFlight;
168
+ private findSession;
169
+ /** An open on-disk session owned by exactly this owner (a stable explicit agent id after a restart). */
170
+ private diskSessionOf;
171
+ private stateOf;
172
+ private orphanedSessions;
173
+ private describe;
174
+ /** Resolve company / product once per process (live Player Settings, else ProjectSettings.asset). */
175
+ prepare(call: ToolCaller): Promise<void>;
176
+ private resolveIdentity;
177
+ private describeDevice;
178
+ private pushWindow;
179
+ /**
180
+ * Which recorded call an error at `ts` belongs to: the call whose window
181
+ * contains it; else one within 50 ms of it (clock rounding, the stream's
182
+ * latency); else the last call that ended before it ("after" — a tap's
183
+ * consequence logged frames later). A call whose response already reported
184
+ * this message wins over another call sharing the same millisecond.
185
+ */
186
+ private attribute;
187
+ /**
188
+ * Attribute pending stream errors that can no longer belong to an in-flight
189
+ * call (see attribute). An error the call's own response already reported
190
+ * is still logged (it carries the stack) but not counted twice.
191
+ */
192
+ private settle;
193
+ /**
194
+ * Errors logged inside the call's window: stream events first, then the
195
+ * response's own evidence. `total` counts every occurrence; `errors` holds
196
+ * the ones written (per-call, per-message and per-session caps).
197
+ */
198
+ private collectErrors;
199
+ /** Frames a call wrote (file paths anywhere in its output, inline images) → linked into the report folder. */
200
+ private collectCaptures;
201
+ private summarize;
202
+ }
203
+ export {};