humanish 0.15.2 → 0.16.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 (59) hide show
  1. package/README.md +15 -7
  2. package/dist/actor-contract.d.ts +2 -3
  3. package/dist/actor-contract.js +6 -7
  4. package/dist/actor-contract.js.map +1 -1
  5. package/dist/actor-registry.d.ts +4 -4
  6. package/dist/actor-registry.js +8 -7
  7. package/dist/actor-registry.js.map +1 -1
  8. package/dist/artifact-reference.js +1 -1
  9. package/dist/artifact-reference.js.map +1 -1
  10. package/dist/concurrent-shared-world-lab.js +24 -11
  11. package/dist/concurrent-shared-world-lab.js.map +1 -1
  12. package/dist/cua-actor-lab.d.ts +101 -4
  13. package/dist/cua-actor-lab.js +456 -77
  14. package/dist/cua-actor-lab.js.map +1 -1
  15. package/dist/device-presets.d.ts +4 -4
  16. package/dist/device-presets.js +5 -5
  17. package/dist/device-presets.js.map +1 -1
  18. package/dist/e2b-terminal-lab.d.ts +18 -20
  19. package/dist/e2b-terminal-lab.js +28 -28
  20. package/dist/e2b-terminal-lab.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/lab-config.d.ts +27 -28
  24. package/dist/lab-config.js +6 -6
  25. package/dist/lab-config.js.map +1 -1
  26. package/dist/lab-engine.d.ts +1 -1
  27. package/dist/lab-engine.js +8 -10
  28. package/dist/lab-engine.js.map +1 -1
  29. package/dist/observer-assets.js +92 -15
  30. package/dist/observer-assets.js.map +1 -1
  31. package/dist/oss-meta-lab.js +2 -4
  32. package/dist/oss-meta-lab.js.map +1 -1
  33. package/dist/program.js +1 -1
  34. package/dist/program.js.map +1 -1
  35. package/dist/run.d.ts +38 -0
  36. package/dist/run.js +71 -1
  37. package/dist/run.js.map +1 -1
  38. package/dist/shared-world-lab.d.ts +20 -1
  39. package/dist/shared-world-lab.js +197 -23
  40. package/dist/shared-world-lab.js.map +1 -1
  41. package/dist/terminal-agent-actor.d.ts +12 -7
  42. package/dist/terminal-agent-actor.js +18 -16
  43. package/dist/terminal-agent-actor.js.map +1 -1
  44. package/docs/architecture/actor-contract.md +32 -21
  45. package/docs/architecture/observer.md +15 -9
  46. package/docs/architecture/state-driven-executor.md +3 -3
  47. package/docs/architecture/terminal-product-lane.md +29 -25
  48. package/docs/assets/humanish-drawdb-hero.png +0 -0
  49. package/docs/contracts/adapter-fixtures.md +4 -2
  50. package/docs/contracts/core.md +9 -4
  51. package/docs/contracts/feedback.md +4 -2
  52. package/docs/contracts/policy.md +5 -3
  53. package/docs/contracts/run-bundle.md +24 -3
  54. package/docs/contracts/schemas.md +34 -23
  55. package/docs/goals/current.md +69 -20
  56. package/docs/ramp/README.md +32 -13
  57. package/docs/release/open-source-readiness.md +5 -4
  58. package/docs/release/public-readiness-standard.md +6 -1
  59. package/package.json +1 -1
@@ -11,7 +11,7 @@ import { renderObserver, type ObserverResult } from "./observer.js";
11
11
  import { type PreparedOutputDirectory } from "./selected-output-paths.js";
12
12
  import { type LocalTreeArchive } from "./source-archive.js";
13
13
  import type { StopWhen } from "./stop-conditions.js";
14
- import { type RunBundle, type RunRerunLineage, type RunProviderResource, type RunSubjectProvenance, type RunSubjectStateStepRecord } from "./run.js";
14
+ import { type RunBundle, type RunDesktopGeometry, type RunRerunLineage, type RunProviderResource, type RunSubjectProvenance, type RunSubjectStateStepRecord } from "./run.js";
15
15
  export declare const CUA_ACTOR_LAB_SCHEMA = "humanish.cua-lab-result.v2";
16
16
  export declare const CUA_FANOUT_STRATEGY: "per-lane-worlds";
17
17
  export declare const CUA_ACTOR_LAB_PROVIDER_METADATA: {
@@ -22,6 +22,20 @@ export interface DesktopBrowserEvidence {
22
22
  requested: LabDesktopBrowser;
23
23
  resolved?: string;
24
24
  }
25
+ export type DesktopBrowserFamily = "chromium" | "firefox" | "unknown";
26
+ /** Runtime-only identity for the exact browser process started by this lane. */
27
+ export interface DesktopBrowserLaunchIdentity {
28
+ processId: string;
29
+ profileDir: string;
30
+ targetUrl: string;
31
+ cdpPort?: number;
32
+ }
33
+ /** Runtime-only launch result. `evidence` preserves the existing public persistence policy. */
34
+ export interface DesktopBrowserLaunchResult {
35
+ family: DesktopBrowserFamily;
36
+ identity?: DesktopBrowserLaunchIdentity;
37
+ evidence?: DesktopBrowserEvidence;
38
+ }
25
39
  export declare const SUBJECT_DIR = "/home/user/subject";
26
40
  /**
27
41
  * One phase-boundary event from the shared subject provisioning pipeline (clone or local-tree
@@ -160,6 +174,7 @@ export interface CuaLanePlanEntry {
160
174
  index: number;
161
175
  persona: string;
162
176
  device: string;
177
+ /** Requested E2B/X screen resolution. This is not the measured browser CSS viewport. */
163
178
  resolution: [number, number];
164
179
  instructionDigest: string;
165
180
  /** Present only when a lane overrides subject.appUrl; digest avoids leaking preview hosts in plan logs. */
@@ -192,6 +207,7 @@ export interface CuaLaneResult {
192
207
  index: number;
193
208
  persona: string;
194
209
  device: string;
210
+ /** Requested E2B/X screen resolution. See the run stream's desktopGeometry for measurements. */
195
211
  resolution: [number, number];
196
212
  /** Terminal lane status; "blocked" = skipped (gate/fail-fast); "contract_proof_only" = dry-run. */
197
213
  status: ActorStatus | "blocked" | "contract_proof_only";
@@ -403,6 +419,14 @@ export interface CuaLaneDeps {
403
419
  hooks: CuaActorLabHooks;
404
420
  /** Lane-0 only: signal the pipeline gate after provisioning succeeds (true) or fails (false). */
405
421
  signalProvisioned?: (ok: boolean) => void;
422
+ /**
423
+ * How a PARSEABLE requested-vs-verified screen mismatch is treated. Default ("fail-closed"):
424
+ * the lane's device claim is falsified, so the lane fails with DEVICE_GEOMETRY (the
425
+ * single-lane/fan-out contract). "record-evidence" (the concurrent shared-world route):
426
+ * requested and verified stay recorded as separate facts plus an explicit warning, and the
427
+ * lane keeps running, so one seat's screen drift cannot abort a live multi-actor world.
428
+ */
429
+ screenMismatchPolicy?: "fail-closed" | "record-evidence";
406
430
  }
407
431
  /** One lane's end-to-end run outcome (internal; projected into CuaLaneResult + the bundle). */
408
432
  export interface LaneRunOutcome {
@@ -415,6 +439,8 @@ export interface LaneRunOutcome {
415
439
  screenshots: string[];
416
440
  subjectCommit?: string;
417
441
  desktopBrowser?: DesktopBrowserEvidence;
442
+ /** Requested + measured desktop/browser geometry. Viewport is absent when measurement failed. */
443
+ desktopGeometry?: RunDesktopGeometry;
418
444
  stateStepRecords: RunSubjectStateStepRecord[];
419
445
  /** Completed subject-phase records (clone/upload/extract/install/build/ready/state groups),
420
446
  * folded into bundle.events at build time. Empty on the in-process route (no provisioning). */
@@ -434,6 +460,22 @@ export interface LaneRunOutcome {
434
460
  export declare function makeLaneWriteScreenshot(artifactRoot: PreparedOutputDirectory, spec: {
435
461
  screenshotDir: string;
436
462
  }, screenshots: string[]): (name: string, bytes: Buffer) => Promise<string>;
463
+ /**
464
+ * Verify the desktop screen geometry IN-SANDBOX (the per-lane device claim is checked, never
465
+ * assumed). A parseable mismatch fails closed. Unavailable/unparseable evidence is returned as
466
+ * an explicit warning: the lane may still run, but its bundle records only the requested screen
467
+ * and never upgrades that request into a verified measurement.
468
+ */
469
+ export declare function inspectDesktopScreenGeometry(args: {
470
+ desktop: E2BDesktopSandbox;
471
+ laneId: string;
472
+ requestedScreen: readonly [number, number];
473
+ requestTimeoutMs: number;
474
+ }): Promise<{
475
+ verified?: RunDesktopGeometry["screen"]["verified"];
476
+ error?: string;
477
+ warning?: string;
478
+ }>;
437
479
  /**
438
480
  * Build the xdotool command that makes a browser window fill the desktop.
439
481
  * Exported (pure) for contract tests. A window manager can ignore Chrome's
@@ -442,11 +484,62 @@ export declare function makeLaneWriteScreenshot(artifactRoot: PreparedOutputDire
442
484
  * dead margin around the browser.
443
485
  */
444
486
  export declare function buildFillDesktopWindowCommand(windowId: string, width: number, height: number): string;
445
- export declare function makeChromeBrowserStateObserver(desktop: E2BDesktopSandbox, requestTimeoutMs: number): () => Promise<{
487
+ export declare function desktopBrowserFamily(value: string | undefined): DesktopBrowserFamily;
488
+ /**
489
+ * Runtime-only CDP endpoint attribution for the exact chromium this lane launched. Port
490
+ * resolution at OBSERVE time: the cached launch-time `cdpPort` wins; absent that, the observer
491
+ * script re-reads `profileDir`'s DevToolsActivePort marker (a slow cold start can publish it
492
+ * AFTER the launch-time poll gave up); absent both it falls back to the legacy fixed 9222,
493
+ * where a dead endpoint degrades into an honest warning.
494
+ */
495
+ export interface ChromeCdpEndpoint {
496
+ cdpPort?: number;
497
+ /** The launched profile dir; lets observers re-read DevToolsActivePort at observe time. */
498
+ profileDir?: string;
499
+ /** The URL this lane opened; attributes the CDP page when no target id is pinned yet. */
500
+ targetUrl: string;
501
+ }
502
+ /**
503
+ * Observe-time CDP port resolution lines (pure; exported for contract tests): cached
504
+ * launch-time port first, then a re-read of the profile's DevToolsActivePort marker, then the
505
+ * legacy fixed 9222. The re-read is a local best-effort file read inside the already
506
+ * time-bounded observer command, so a missing/garbled marker degrades to the fallback,
507
+ * never a hang.
508
+ */
509
+ export declare function chromeCdpPortResolutionScript(endpoint: ChromeCdpEndpoint): string[];
510
+ export declare function makeChromeBrowserStateObserver(desktop: E2BDesktopSandbox, requestTimeoutMs: number, endpoint: ChromeCdpEndpoint, targetId?: string): () => Promise<{
446
511
  url?: string;
447
512
  title?: string;
448
513
  text?: string;
449
514
  }>;
515
+ /**
516
+ * Read the running browser's actual outer-window bounds and CSS layout viewport through the
517
+ * already-enabled local Chrome DevTools endpoint. The returned values come from `window.*` in
518
+ * the target page; requested E2B resolution is deliberately not an input to this function.
519
+ */
520
+ export declare function makeChromeDesktopGeometryObserver(desktop: E2BDesktopSandbox, requestTimeoutMs: number, endpoint: ChromeCdpEndpoint, targetId?: string): () => Promise<(Pick<RunDesktopGeometry, "browserWindow" | "viewport"> & {
521
+ targetId?: string;
522
+ }) | undefined>;
523
+ /** Shared hosted-browser geometry capture used by per-lane and sequential shared-world routes. */
524
+ export declare function captureDesktopBrowserGeometry(args: {
525
+ desktop: E2BDesktopSandbox;
526
+ browserFamily: DesktopBrowserFamily;
527
+ launchIdentity?: DesktopBrowserLaunchIdentity;
528
+ browserTargetId?: string;
529
+ browserWindowId?: string;
530
+ laneId: string;
531
+ /** Runtime-only lane target URL (attributes the CDP page); never persisted by this capture. */
532
+ targetUrl: string;
533
+ requestedScreen: readonly [number, number];
534
+ requestTimeoutMs: number;
535
+ resize?: boolean;
536
+ }): Promise<{
537
+ browserWindowId?: string;
538
+ browserTargetId?: string;
539
+ browserWindow?: RunDesktopGeometry["browserWindow"];
540
+ viewport?: RunDesktopGeometry["viewport"];
541
+ warnings: string[];
542
+ }>;
450
543
  /**
451
544
  * Run ONE E2B desktop lane end-to-end: create the sandbox (per-lane metadata + the lane's device
452
545
  * resolution), prepareDesktop, verify geometry, (clone+serve+seed the subject per lane), open the
@@ -556,8 +649,12 @@ export declare function buildCuaBundle(args: {
556
649
  mission: string;
557
650
  persona: ActorPersonaRef;
558
651
  resolution: [number, number];
559
- /** Device metadata for the stream viewport (honest; isMobile/DSF are not rendered on this route). */
560
- deviceScaleFactor?: number;
652
+ /** False only for the custom in-process route, which has no hosted screen/window to claim. */
653
+ desktopRoute?: boolean;
654
+ /** Runtime screen/window/viewport evidence. `viewport` inside this object must be measured. */
655
+ desktopGeometry?: RunDesktopGeometry;
656
+ /** Device-preset touch metadata echoed on the measured stream viewport (a prompt signal on
657
+ * this route, never a rendered claim); the measured width/height/DPR stay authoritative. */
561
658
  isMobile?: boolean;
562
659
  runId: string;
563
660
  screenshots: string[];