humanish 0.41.0 → 0.42.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 (53) hide show
  1. package/README.md +36 -8
  2. package/dist/actor-contract.d.ts +9 -0
  3. package/dist/actor-contract.js.map +1 -1
  4. package/dist/adapter-extension.js +1 -0
  5. package/dist/adapter-extension.js.map +1 -1
  6. package/dist/computer-use-actor.d.ts +11 -0
  7. package/dist/computer-use-actor.js +2 -0
  8. package/dist/computer-use-actor.js.map +1 -1
  9. package/dist/computer-use.d.ts +30 -0
  10. package/dist/computer-use.js +65 -3
  11. package/dist/computer-use.js.map +1 -1
  12. package/dist/concurrent-shared-world-lab.js +71 -41
  13. package/dist/concurrent-shared-world-lab.js.map +1 -1
  14. package/dist/cua-actor-lab.d.ts +64 -2
  15. package/dist/cua-actor-lab.js +302 -26
  16. package/dist/cua-actor-lab.js.map +1 -1
  17. package/dist/e2b-desktop-executor.d.ts +1 -1
  18. package/dist/e2b-desktop-executor.js +2 -1
  19. package/dist/e2b-desktop-executor.js.map +1 -1
  20. package/dist/e2b-terminal-lab.js +1 -0
  21. package/dist/e2b-terminal-lab.js.map +1 -1
  22. package/dist/feedback.js +55 -1
  23. package/dist/feedback.js.map +1 -1
  24. package/dist/image-evidence.js +36 -22
  25. package/dist/image-evidence.js.map +1 -1
  26. package/dist/init-templates.js +3 -1
  27. package/dist/init-templates.js.map +1 -1
  28. package/dist/lab-config.d.ts +14 -1
  29. package/dist/lab-config.js +6 -2
  30. package/dist/lab-config.js.map +1 -1
  31. package/dist/observer-assets.js +3 -0
  32. package/dist/observer-assets.js.map +1 -1
  33. package/dist/observer-data.d.ts +4 -0
  34. package/dist/observer-data.js +7 -1
  35. package/dist/observer-data.js.map +1 -1
  36. package/dist/program.js +5 -5
  37. package/dist/program.js.map +1 -1
  38. package/dist/redaction.js +4 -9
  39. package/dist/redaction.js.map +1 -1
  40. package/dist/run.d.ts +34 -1
  41. package/dist/run.js +45 -3
  42. package/dist/run.js.map +1 -1
  43. package/dist/screenshot-image.d.ts +11 -0
  44. package/dist/screenshot-image.js +26 -0
  45. package/dist/screenshot-image.js.map +1 -0
  46. package/dist/scripted-browser-lab.js +3 -1
  47. package/dist/scripted-browser-lab.js.map +1 -1
  48. package/dist/shared-world-lab.js +16 -2
  49. package/dist/shared-world-lab.js.map +1 -1
  50. package/docs/contracts/schemas.md +1 -1
  51. package/docs/goals/current.md +16 -3
  52. package/docs/ramp/README.md +1 -1
  53. package/package.json +1 -1
@@ -8,11 +8,12 @@ import { type DetachedTimers } from "./e2b-detached.js";
8
8
  import { type DevicePreset } from "./device-presets.js";
9
9
  import { type LabActorLane, type LabCommsEmail, type LabCommsRecipient, type LabConfig, type LabDesktopBrowser, type LabSubjectServe, type LabSubjectState } from "./lab-config.js";
10
10
  import { type ResolvedPersona } from "./persona.js";
11
+ import { type LabTask } from "./tasks.js";
11
12
  import { renderObserver, type ObserverResult } from "./observer.js";
12
13
  import { type PreparedOutputDirectory } from "./selected-output-paths.js";
13
14
  import { type LocalTreeArchive } from "./source-archive.js";
14
15
  import type { StopWhen } from "./stop-conditions.js";
15
- import { type RunBundle, type RunDesktopGeometry, type RunRerunLineage, type RunProviderResource, type RunCostSummary, type RunScorerProvenance, type RunSubjectProvenance, type RunSubjectStateStepRecord } from "./run.js";
16
+ import { type RunBundle, type RunDesktopGeometry, type RunFeedbackCandidate, type RunRerunLineage, type RunProviderResource, type RunCostSummary, type RunScorerProvenance, type RunSubjectProvenance, type RunSubjectStateStepRecord } from "./run.js";
16
17
  export declare const CUA_ACTOR_LAB_SCHEMA = "humanish.cua-lab-result.v2";
17
18
  export declare const CUA_FANOUT_STRATEGY: "per-lane-worlds";
18
19
  export declare const CUA_ACTOR_LAB_PROVIDER_METADATA: {
@@ -266,7 +267,7 @@ export interface CuaLaneSummary {
266
267
  concurrency: number;
267
268
  waves: number;
268
269
  }
269
- export type CuaActorLabErrorCode = "HUMANISH_CUA_LAB_FAILED" | "HUMANISH_CUA_LAB_KEYS_MISSING" | "HUMANISH_CUA_LAB_SUBJECT_ENV_MISSING" | "HUMANISH_CUA_LAB_ACTOR_UNSUPPORTED" | "HUMANISH_CUA_LAB_SUBJECT_INVALID" | "HUMANISH_CUA_LAB_SUBJECT_UNSAFE" | "HUMANISH_CUA_LAB_EXECUTOR_NO_PROVIDER" | "HUMANISH_CUA_LAB_LOCAL_APP_NO_EXECUTOR" | "HUMANISH_CUA_LAB_FANOUT_INVALID" | "HUMANISH_CUA_LAB_RERUN_INVALID" | "HUMANISH_CUA_LAB_DEVICE_GEOMETRY" | "HUMANISH_CUA_LAB_UNPRICED_CAP" | "HUMANISH_WATCH_ALLOW_REQUIRES_OAUTH" | "HUMANISH_WATCH_OAUTH_REQUIRES_TUNNEL" | "HUMANISH_WATCH_OPTION_CONFLICT" | "HUMANISH_WATCH_TUNNEL_REQUIRES_EXPOSE" | "HUMANISH_WATCH_EXPOSE_REQUIRES_EDGE_AUTH" | "HUMANISH_WATCH_EXPOSE_REQUIRES_LIVE_FOLLOW" | "HUMANISH_WATCH_SAFE_NOT_APPLICABLE" | "HUMANISH_SERVE_TUNNEL_NOT_FOUND" | "HUMANISH_SERVE_TUNNEL_START_FAILED";
270
+ export type CuaActorLabErrorCode = "HUMANISH_CUA_LAB_FAILED" | "HUMANISH_CUA_LAB_KEYS_MISSING" | "HUMANISH_CUA_LAB_SUBJECT_ENV_MISSING" | "HUMANISH_CUA_LAB_ACTOR_UNSUPPORTED" | "HUMANISH_CUA_LAB_SUBJECT_INVALID" | "HUMANISH_CUA_LAB_SUBJECT_UNSAFE" | "HUMANISH_CUA_LAB_EXECUTOR_NO_PROVIDER" | "HUMANISH_CUA_LAB_LOCAL_APP_NO_EXECUTOR" | "HUMANISH_CUA_LAB_FANOUT_INVALID" | "HUMANISH_CUA_LAB_RERUN_INVALID" | "HUMANISH_CUA_LAB_DEVICE_GEOMETRY" | "HUMANISH_CUA_LAB_UNPRICED_CAP" | "HUMANISH_CUA_LAB_COMMS_CATCH_UNREACHABLE" | "HUMANISH_WATCH_ALLOW_REQUIRES_OAUTH" | "HUMANISH_WATCH_OAUTH_REQUIRES_TUNNEL" | "HUMANISH_WATCH_OPTION_CONFLICT" | "HUMANISH_WATCH_TUNNEL_REQUIRES_EXPOSE" | "HUMANISH_WATCH_EXPOSE_REQUIRES_EDGE_AUTH" | "HUMANISH_WATCH_EXPOSE_REQUIRES_LIVE_FOLLOW" | "HUMANISH_WATCH_SAFE_NOT_APPLICABLE" | "HUMANISH_SERVE_TUNNEL_NOT_FOUND" | "HUMANISH_SERVE_TUNNEL_START_FAILED";
270
271
  /** Subject provenance projection (invariant 5): what the actor actually drove. */
271
272
  export interface CuaSubjectProjection {
272
273
  source: "app-url" | "clone" | "local-tree";
@@ -364,6 +365,11 @@ export interface CuaLaneSpec {
364
365
  targetUrl?: string;
365
366
  /** Deterministic harness-owned completion guard. Lane-level override, else actor default. */
366
367
  stopWhen?: StopWhen;
368
+ /** The lab's declared protocol (#414). Every lane runs the SAME protocol — that is what makes the
369
+ * per-task rates comparable across participants. Goals are already composed into `instructions`;
370
+ * this carries the full tasks so the loop can corroborate completion, and the criteria never
371
+ * reach the prompt. */
372
+ tasks?: readonly LabTask[];
367
373
  /** Per-lane override of the CUA idle backstop (consecutive screenshot/wait turns before gave_up).
368
374
  * Absent falls back to the loop default. Raised for a lane whose job includes a long LEGITIMATE
369
375
  * wait (e.g. a shared-world HOST idling in the waiting room while followers provision + join). */
@@ -384,6 +390,9 @@ export declare function composeLaneInstructions(args: {
384
390
  mission: string;
385
391
  persona?: string;
386
392
  instruction?: string;
393
+ /** The lab's declared protocol (#414). Only the participant-facing `goal` halves are rendered
394
+ * into the prompt; the `success` criteria never appear here. */
395
+ tasks?: readonly LabTask[];
387
396
  device: {
388
397
  name: string;
389
398
  preset: DevicePreset;
@@ -465,6 +474,19 @@ export declare function resolveCuaLanePlan(config: LabConfig, opts?: {
465
474
  personas?: Map<string, ResolvedPersona>;
466
475
  }): CuaLanePlan;
467
476
  /** Shared deps every lane runner needs (resolved once in the engine). */
477
+ /**
478
+ * The STUDY's shared spend ledger (#299): one counter across every lane. Each lane notes its own
479
+ * latest running MODEL-spend estimate (monotone per lane — an estimate can only grow) and reads
480
+ * back the run total; the loop stops the lane the moment the total crosses the study budget.
481
+ * Estimated model spend only: desktop-minutes ride the cost summary, not this ledger.
482
+ */
483
+ export interface CuaRunBudget {
484
+ maxTotalUsd: number;
485
+ /** Record this lane's latest running estimate (null = unpriceable, ignored) and return the
486
+ * run's current total across all lanes. */
487
+ note(laneId: string, estimateUsd: number | null): number;
488
+ }
489
+ export declare function makeCuaRunBudget(maxTotalUsd: number): CuaRunBudget;
468
490
  export interface CuaLaneDeps {
469
491
  config: LabConfig;
470
492
  descriptor: CuaActorDescriptor;
@@ -491,6 +513,16 @@ export interface CuaLaneDeps {
491
513
  redactScreenshots: boolean;
492
514
  scrubKnownValues: (text: string) => string;
493
515
  runSession: (options: CuaActorSessionOptions) => Promise<CuaLoopResult>;
516
+ /** The study's shared spend ledger, present exactly when execution.caps.maxTotalUsd is set on a
517
+ * live run (#299). Preflight already refused the cap on an unpriced model. */
518
+ runBudget?: CuaRunBudget;
519
+ /** Adopter-hosted comms plane (#380): present on the app-url route when comms.email.external is
520
+ * declared. Carries the parsed comms block (recipients drive the per-lane inbox instruction)
521
+ * and the inbox URL the persona opens. The drain runs once at run level, not per lane. */
522
+ externalComms?: {
523
+ email: LabCommsEmail;
524
+ inboxUrl: string;
525
+ };
494
526
  /** Injected clock (ms). Used to measure the host-side E2B desktop create->teardown span so the
495
527
  * desktop-minute cost estimate is deterministic in tests. Defaults to Date.now. */
496
528
  now: () => number;
@@ -610,6 +642,7 @@ export declare function makeChromeBrowserStateObserver(desktop: E2BDesktopSandbo
610
642
  url?: string;
611
643
  title?: string;
612
644
  text?: string;
645
+ scrollY?: number;
613
646
  }>;
614
647
  /**
615
648
  * Read the running browser's actual outer-window bounds and CSS layout viewport through the
@@ -771,6 +804,35 @@ export declare function buildCuaCostSummary(args: {
771
804
  }>;
772
805
  desktopMinutes: number | undefined;
773
806
  }): RunCostSummary | undefined;
807
+ /**
808
+ * Feedback candidates derived from what LIVE participants actually reported (#392).
809
+ *
810
+ * A live run's feedback draft used to fall through to a dry-run template, because no browser route
811
+ * ever built a candidate. The candidate worth filing is the one the study produced: a participant
812
+ * who reported friction on the way (the most valuable thing a run captures), or one who stopped
813
+ * trying. A clean pass files nothing here — feedback exists to carry findings, and a run without
814
+ * any falls back to an honest live summary in the draft layer instead of a template.
815
+ *
816
+ * Everything quoted is already scrub+redacted — `session.reason` passes through redactNarration in
817
+ * the loop before it ever lands on a trace — and passes redactText again here as defense-in-depth.
818
+ */
819
+ export declare function participantFeedbackCandidates(args: {
820
+ runId: string;
821
+ scenarioId: string;
822
+ adapterId: string;
823
+ /** The already-redacted study goal (what bundle.scenario.goal carries). */
824
+ goal: string;
825
+ substrate: RunFeedbackCandidate["substrate"];
826
+ lanes: Array<{
827
+ laneId: string;
828
+ streamId: string;
829
+ personaId: string;
830
+ session?: CuaLoopResult;
831
+ traceArtifactPath?: string;
832
+ screenshots: string[];
833
+ commsArtifactPath?: string;
834
+ }>;
835
+ }): RunFeedbackCandidate[];
774
836
  export declare function buildCuaBundle(args: {
775
837
  actorId: string;
776
838
  appUrl: string;