@adatechnology/game-test-room 0.1.0 → 0.1.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/README.md CHANGED
@@ -79,7 +79,7 @@ The items join the catalogue under the module's group and its scenarios become b
79
79
  | E | grab / drop |
80
80
  | R | rotate the held item |
81
81
  | Right button or G | throw |
82
- | F | use a fluid item (drink); Z tilt; C fill from the tap; V pour |
82
+ | F | use a fluid item (drink); Z tilt; C fill from the tap; V pour (holding a fluid item) or kick (otherwise, with the `kick` tool whatever is selected) |
83
83
  | Tab | show / hide the panels |
84
84
 
85
85
  Panels: catalogue tabs (spawn, Clear, Reset all), slow motion 0.25x, time x10, quality select, inspector (material, state, hp, temperature, char, marks, joints, load and stress) and the behaviour log with filters.
@@ -100,6 +100,10 @@ One JSON object per line (`log.toNDJSON()`, "Baixar NDJSON"):
100
100
  `{ passed, failed, results: [{ id, name, ok, checks: [{ label, ok }] }] }`. 21 ship with the package (bullets vs steel, concrete and glass, hammer, shotgun, kick, screwdriver,
101
101
  fire and torch, gas bottle, bottle drop, thrown chair, coffee sips and spills, jerrycan leak, fuel fire, columns and a roof, extinguisher). Open the example with `?scenario=all` to run them.
102
102
 
103
+ ### Inside a claude.ai Artifact
104
+
105
+ An Artifact page cannot use `<a download>` or blob links. When `globalThis.claude.use('downloads')` resolves, `log.download(format)` offers the file through that capability (the NDJSON goes out as `test-room-log.ndjson.txt`, since `.ndjson` is not on the allowlist) and a declined save writes an `export_cancelled` line to the log; otherwise it falls back to the blob link. **The artifact page must declare the `downloads` capability.** "Copy JSON" falls back to selecting the text in a textarea when `navigator.clipboard` is missing.
106
+
103
107
  ## Português
104
108
 
105
109
  Uma sala de testes em primeira pessoa para three.js. Você passa o seu catálogo de objetos, anda, atira, bate, queima, corta, arremessa, bebe café e
package/dist/index.d.ts CHANGED
@@ -15,7 +15,11 @@ interface WritableLog extends TestRoomLog {
15
15
  setBeforeRead(fn: (() => void) | null): void;
16
16
  setClock(fn: () => number): void;
17
17
  }
18
- declare function createLog(): WritableLog;
18
+ interface LogOptions {
19
+ /** Text of the `action` line written when the viewer declines (or fails) an export from an Artifact page. */
20
+ exportCancelled?: () => string;
21
+ }
22
+ declare function createLog(options?: LogOptions): WritableLog;
19
23
 
20
24
  /** Locales shipped with the package. Unknown locales fall back to `en`. */
21
25
  type TestRoomLocale = 'en' | 'pt-BR';
@@ -229,6 +233,12 @@ interface TestRoom {
229
233
  tilt(rad: number): void;
230
234
  /** Open or close the tap over the table (default: toggle). Returns whether it is open. */
231
235
  toggleTap(on?: boolean): boolean;
236
+ /** Stop the simulation (time, physics, animations, tools, walks): the UI, the camera and the log stay live. `step` and `update` do nothing until `resume`. Scenarios run unpaused. */
237
+ pause(): void;
238
+ resume(): void;
239
+ readonly paused: boolean;
240
+ /** Walk the player in a straight line to the floor position `to` (x and z; y is ignored) over `seconds` of simulated time, during the next `step()` / frames. Colliders still block. 0 seconds moves at once. */
241
+ walk(to: Vec3, seconds: number): void;
232
242
  /** 0.25x simulation speed. */
233
243
  setSlowMotion(on: boolean): void;
234
244
  /** Run the simulation 10x per frame (fire, melting and drying take a tenth of the time). */
@@ -318,8 +328,12 @@ interface TestRoomLog {
318
328
  toNDJSON(): string;
319
329
  /** Plain text lines (the on-screen panel). */
320
330
  toText(): string;
321
- /** Download the log as a file in the browser (`.ndjson` by default). */
322
- download(format?: 'json' | 'ndjson' | 'txt'): void;
331
+ /**
332
+ * Download the log as a file (`.ndjson` by default). In a claude.ai Artifact page (a `globalThis.claude.use('downloads')` that resolves) it asks the
333
+ * viewer through the `downloads` capability (`ndjson` is saved as `.ndjson.txt`, the allowlist has no `.ndjson`); if the viewer declines, an
334
+ * `export_cancelled` action line is logged. Elsewhere it uses a blob link.
335
+ */
336
+ download(format?: 'json' | 'ndjson' | 'txt'): Promise<void>;
323
337
  /** Counts per event type and per material (quick summary for checks). */
324
338
  summary(): {
325
339
  byType: Record<string, number>;