humanish 0.0.1 → 0.15.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/AGENTS.md +77 -0
- package/CONTRIBUTING.md +39 -0
- package/LICENSE +21 -0
- package/README.md +437 -8
- package/SECURITY.md +34 -0
- package/dist/actor-contract.d.ts +107 -0
- package/dist/actor-contract.js +286 -0
- package/dist/actor-contract.js.map +1 -0
- package/dist/actor-registry.d.ts +73 -0
- package/dist/actor-registry.js +93 -0
- package/dist/actor-registry.js.map +1 -0
- package/dist/adapter-extension.d.ts +54 -0
- package/dist/adapter-extension.js +214 -0
- package/dist/adapter-extension.js.map +1 -0
- package/dist/argv.d.ts +1 -0
- package/dist/argv.js +8 -0
- package/dist/argv.js.map +1 -0
- package/dist/artifact-reference.d.ts +22 -0
- package/dist/artifact-reference.js +47 -0
- package/dist/artifact-reference.js.map +1 -0
- package/dist/browser-evidence-hygiene.d.ts +7 -0
- package/dist/browser-evidence-hygiene.js +40 -0
- package/dist/browser-evidence-hygiene.js.map +1 -0
- package/dist/claude-agent-sdk.d.ts +94 -0
- package/dist/claude-agent-sdk.js +363 -0
- package/dist/claude-agent-sdk.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex-app-server-ui.d.ts +39 -0
- package/dist/codex-app-server-ui.js +357 -0
- package/dist/codex-app-server-ui.js.map +1 -0
- package/dist/codex-app-server.d.ts +144 -0
- package/dist/codex-app-server.js +754 -0
- package/dist/codex-app-server.js.map +1 -0
- package/dist/command-failure.d.ts +29 -0
- package/dist/command-failure.js +54 -0
- package/dist/command-failure.js.map +1 -0
- package/dist/computer-use-actor.d.ts +52 -0
- package/dist/computer-use-actor.js +48 -0
- package/dist/computer-use-actor.js.map +1 -0
- package/dist/computer-use.d.ts +232 -0
- package/dist/computer-use.js +615 -0
- package/dist/computer-use.js.map +1 -0
- package/dist/concurrency.d.ts +1 -0
- package/dist/concurrency.js +27 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/concurrent-shared-world-lab.d.ts +115 -0
- package/dist/concurrent-shared-world-lab.js +1094 -0
- package/dist/concurrent-shared-world-lab.js.map +1 -0
- package/dist/core/git-state.d.ts +33 -0
- package/dist/core/git-state.js +277 -0
- package/dist/core/git-state.js.map +1 -0
- package/dist/core/git-workspace.d.ts +31 -0
- package/dist/core/git-workspace.js +447 -0
- package/dist/core/git-workspace.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/run-primitives.d.ts +66 -0
- package/dist/core/run-primitives.js +120 -0
- package/dist/core/run-primitives.js.map +1 -0
- package/dist/cua-actor-lab.d.ts +621 -0
- package/dist/cua-actor-lab.js +2845 -0
- package/dist/cua-actor-lab.js.map +1 -0
- package/dist/device-presets.d.ts +67 -0
- package/dist/device-presets.js +50 -0
- package/dist/device-presets.js.map +1 -0
- package/dist/e2b-desktop-executor.d.ts +101 -0
- package/dist/e2b-desktop-executor.js +309 -0
- package/dist/e2b-desktop-executor.js.map +1 -0
- package/dist/e2b-desktop-launch.d.ts +144 -0
- package/dist/e2b-desktop-launch.js +59 -0
- package/dist/e2b-desktop-launch.js.map +1 -0
- package/dist/e2b-detached.d.ts +53 -0
- package/dist/e2b-detached.js +130 -0
- package/dist/e2b-detached.js.map +1 -0
- package/dist/e2b-terminal-lab.d.ts +345 -0
- package/dist/e2b-terminal-lab.js +1532 -0
- package/dist/e2b-terminal-lab.js.map +1 -0
- package/dist/env-file.d.ts +14 -0
- package/dist/env-file.js +108 -0
- package/dist/env-file.js.map +1 -0
- package/dist/feedback.d.ts +51 -0
- package/dist/feedback.js +351 -0
- package/dist/feedback.js.map +1 -0
- package/dist/image-evidence.d.ts +2 -0
- package/dist/image-evidence.js +33 -0
- package/dist/image-evidence.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/init-templates.d.ts +12 -0
- package/dist/init-templates.js +369 -0
- package/dist/init-templates.js.map +1 -0
- package/dist/init.d.ts +26 -0
- package/dist/init.js +429 -0
- package/dist/init.js.map +1 -0
- package/dist/lab-app-runner.d.ts +78 -0
- package/dist/lab-app-runner.js +403 -0
- package/dist/lab-app-runner.js.map +1 -0
- package/dist/lab-config.d.ts +583 -0
- package/dist/lab-config.js +1789 -0
- package/dist/lab-config.js.map +1 -0
- package/dist/lab-engine.d.ts +77 -0
- package/dist/lab-engine.js +216 -0
- package/dist/lab-engine.js.map +1 -0
- package/dist/lab-preflight.d.ts +67 -0
- package/dist/lab-preflight.js +385 -0
- package/dist/lab-preflight.js.map +1 -0
- package/dist/labs.d.ts +53 -0
- package/dist/labs.js +382 -0
- package/dist/labs.js.map +1 -0
- package/dist/observer-assets.d.ts +2 -0
- package/dist/observer-assets.js +2630 -0
- package/dist/observer-assets.js.map +1 -0
- package/dist/observer-data.d.ts +63 -0
- package/dist/observer-data.js +145 -0
- package/dist/observer-data.js.map +1 -0
- package/dist/observer-static.d.ts +39 -0
- package/dist/observer-static.js +306 -0
- package/dist/observer-static.js.map +1 -0
- package/dist/observer.d.ts +46 -0
- package/dist/observer.js +550 -0
- package/dist/observer.js.map +1 -0
- package/dist/openai-responses-cu.d.ts +113 -0
- package/dist/openai-responses-cu.js +545 -0
- package/dist/openai-responses-cu.js.map +1 -0
- package/dist/oss-lab.d.ts +52 -0
- package/dist/oss-lab.js +344 -0
- package/dist/oss-lab.js.map +1 -0
- package/dist/oss-meta-lab-scoring.d.ts +15 -0
- package/dist/oss-meta-lab-scoring.js +145 -0
- package/dist/oss-meta-lab-scoring.js.map +1 -0
- package/dist/oss-meta-lab.d.ts +277 -0
- package/dist/oss-meta-lab.js +4529 -0
- package/dist/oss-meta-lab.js.map +1 -0
- package/dist/oss-remote-telemetry.d.ts +77 -0
- package/dist/oss-remote-telemetry.js +403 -0
- package/dist/oss-remote-telemetry.js.map +1 -0
- package/dist/persona.d.ts +35 -0
- package/dist/persona.js +133 -0
- package/dist/persona.js.map +1 -0
- package/dist/pi-agent-core.d.ts +77 -0
- package/dist/pi-agent-core.js +203 -0
- package/dist/pi-agent-core.js.map +1 -0
- package/dist/program.d.ts +54 -0
- package/dist/program.js +2349 -0
- package/dist/program.js.map +1 -0
- package/dist/redaction.d.ts +90 -0
- package/dist/redaction.js +292 -0
- package/dist/redaction.js.map +1 -0
- package/dist/run-paths.d.ts +56 -0
- package/dist/run-paths.js +340 -0
- package/dist/run-paths.js.map +1 -0
- package/dist/run.d.ts +794 -0
- package/dist/run.js +4844 -0
- package/dist/run.js.map +1 -0
- package/dist/scripted-browser-actor.d.ts +297 -0
- package/dist/scripted-browser-actor.js +1399 -0
- package/dist/scripted-browser-actor.js.map +1 -0
- package/dist/scripted-browser-lab.d.ts +107 -0
- package/dist/scripted-browser-lab.js +788 -0
- package/dist/scripted-browser-lab.js.map +1 -0
- package/dist/selected-output-paths.d.ts +49 -0
- package/dist/selected-output-paths.js +354 -0
- package/dist/selected-output-paths.js.map +1 -0
- package/dist/shared-world-lab.d.ts +208 -0
- package/dist/shared-world-lab.js +1049 -0
- package/dist/shared-world-lab.js.map +1 -0
- package/dist/source-archive.d.ts +82 -0
- package/dist/source-archive.js +408 -0
- package/dist/source-archive.js.map +1 -0
- package/dist/stop-conditions.d.ts +26 -0
- package/dist/stop-conditions.js +66 -0
- package/dist/stop-conditions.js.map +1 -0
- package/dist/terminal-agent-actor.d.ts +36 -0
- package/dist/terminal-agent-actor.js +23 -0
- package/dist/terminal-agent-actor.js.map +1 -0
- package/docs/architecture/actor-contract.md +431 -0
- package/docs/architecture/github-feedback-loop.md +189 -0
- package/docs/architecture/local-codex-tui-actor.md +213 -0
- package/docs/architecture/observer.md +118 -0
- package/docs/architecture/oss-lab-poc.md +250 -0
- package/docs/architecture/project-layout.md +166 -0
- package/docs/architecture/state-driven-executor.md +203 -0
- package/docs/architecture/terminal-product-lane.md +148 -0
- package/docs/contracts/adapter-fixtures.md +80 -0
- package/docs/contracts/core.md +71 -0
- package/docs/contracts/feedback.md +145 -0
- package/docs/contracts/policy.md +311 -0
- package/docs/contracts/run-bundle.md +358 -0
- package/docs/contracts/schemas.md +984 -0
- package/docs/goals/current.md +428 -0
- package/docs/principles/invariants-and-defaults.md +135 -0
- package/docs/principles/self-driving-harness.md +129 -0
- package/docs/product/open-source-install-experience.md +237 -0
- package/docs/ramp/README.md +207 -0
- package/docs/release/open-source-readiness.md +208 -0
- package/docs/release/public-readiness-standard.md +205 -0
- package/docs/roadmap/world-class-open-source-v0.md +311 -0
- package/package.json +102 -8
- package/skills/humanish/SKILL.md +244 -0
- package/skills/humanish/agents/openai.yaml +7 -0
- package/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-primitives.js","sourceRoot":"","sources":["../../src/core/run-primitives.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAgDpE,MAAM,UAAU,UAAU,CAAC,OAA0B;IACnD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,GAAG,MAAM,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;IAElD,WAAW,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,C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,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEtE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC9E,MAAM,IAAI,KAAK,CAAC,6CAA6C,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import type { ActorCompletionReason, ActorPersonaRef, ActorStatus } from "./actor-contract.js";
|
|
2
|
+
import { type BrowserLabAdapterHooks } from "./adapter-extension.js";
|
|
3
|
+
import { type CuaActorDescriptor } from "./actor-registry.js";
|
|
4
|
+
import type { CuaActorSessionOptions } from "./computer-use-actor.js";
|
|
5
|
+
import type { CuaExecutor, CuaLoopResult, CuaProvider } from "./computer-use.js";
|
|
6
|
+
import { type E2BDesktopModule, type E2BDesktopSandbox } from "./e2b-desktop-launch.js";
|
|
7
|
+
import { type DetachedTimers } from "./e2b-detached.js";
|
|
8
|
+
import { type DevicePreset } from "./device-presets.js";
|
|
9
|
+
import { type LabActorLane, type LabConfig, type LabDesktopBrowser, type LabSubjectServe, type LabSubjectState } from "./lab-config.js";
|
|
10
|
+
import { renderObserver, type ObserverResult } from "./observer.js";
|
|
11
|
+
import { type PreparedOutputDirectory } from "./selected-output-paths.js";
|
|
12
|
+
import { type LocalTreeArchive } from "./source-archive.js";
|
|
13
|
+
import type { StopWhen } from "./stop-conditions.js";
|
|
14
|
+
import { type RunBundle, type RunRerunLineage, type RunProviderResource, type RunSubjectProvenance, type RunSubjectStateStepRecord } from "./run.js";
|
|
15
|
+
export declare const CUA_ACTOR_LAB_SCHEMA = "humanish.cua-lab-result.v2";
|
|
16
|
+
export declare const CUA_FANOUT_STRATEGY: "per-lane-worlds";
|
|
17
|
+
export declare const CUA_ACTOR_LAB_PROVIDER_METADATA: {
|
|
18
|
+
readonly mode: "cua-actor-lab";
|
|
19
|
+
readonly tool: "humanish";
|
|
20
|
+
};
|
|
21
|
+
export interface DesktopBrowserEvidence {
|
|
22
|
+
requested: LabDesktopBrowser;
|
|
23
|
+
resolved?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const SUBJECT_DIR = "/home/user/subject";
|
|
26
|
+
/**
|
|
27
|
+
* One phase-boundary event from the shared subject provisioning pipeline (clone or local-tree
|
|
28
|
+
* route): started/completed pairs at each named boundary, never per poll tick (the detached
|
|
29
|
+
* primitive in e2b-detached.ts already polls every 1.5-3s internally; only the boundary itself
|
|
30
|
+
* is surfaced here). Message text is public-safe by construction: no URLs beyond the existing
|
|
31
|
+
* publicAppUrl convention, no paths, no command text. Completed events carry `ok` and
|
|
32
|
+
* `durationMs`; started events (and the fire-and-forget `subject.serve.started`) carry neither.
|
|
33
|
+
*/
|
|
34
|
+
export interface SubjectPhaseEvent {
|
|
35
|
+
at: string;
|
|
36
|
+
type: string;
|
|
37
|
+
ok?: boolean;
|
|
38
|
+
durationMs?: number;
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Library-level hooks. `prepareDesktop` runs after sandbox creation and before subject
|
|
43
|
+
* provisioning / browser launch — library callers use it for extra in-sandbox setup beyond
|
|
44
|
+
* what `subject.serve` declares (or to provision an app-url subject entirely). The rest are
|
|
45
|
+
* DI seams so CI drives the full path with fakes at zero network/zero spend.
|
|
46
|
+
*/
|
|
47
|
+
export interface CuaActorLabHooks extends BrowserLabAdapterHooks {
|
|
48
|
+
/**
|
|
49
|
+
* Runs after sandbox creation and before subject provisioning / browser launch. Widened
|
|
50
|
+
* back-compatibly with per-lane context so a library caller can provision the right app-url
|
|
51
|
+
* subject per lane (a one-arg `(desktop) => …` still satisfies the type). Called once per lane.
|
|
52
|
+
*/
|
|
53
|
+
prepareDesktop?: (desktop: E2BDesktopSandbox, lane: {
|
|
54
|
+
laneId: string;
|
|
55
|
+
laneIndex: number;
|
|
56
|
+
laneCount: number;
|
|
57
|
+
}) => Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Pre-flight hook: receives the resolved lane plan BEFORE any sandbox or provider call (dry-run
|
|
60
|
+
* AND live). The engine also prints the plan to stderr; this seam lets tests assert it without
|
|
61
|
+
* scraping stderr. Identical plan in dry-run, marked $0.
|
|
62
|
+
*/
|
|
63
|
+
onPreflight?: (plan: CuaLanePlan) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Live subject-provisioning phase sink: one call per started/completed boundary (clone,
|
|
66
|
+
* upload/extract, install, build, serve start, ready, and each subject.state seed-step
|
|
67
|
+
* group). Defaults to one stderr line per event, prefixed with the lane id when laneCount > 1
|
|
68
|
+
* (single-lane emission is unconditional: single-lane silence for the whole boot is the bug
|
|
69
|
+
* this event stream closes). Override in tests to capture instead of writing to real stderr.
|
|
70
|
+
*/
|
|
71
|
+
onPhase?: (event: SubjectPhaseEvent, ctx: {
|
|
72
|
+
laneId: string;
|
|
73
|
+
laneCount: number;
|
|
74
|
+
}) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Runtime-only live desktop stream callback. The URL carries an auth key and must never be
|
|
77
|
+
* persisted into run artifacts; callers use it to hydrate an attached Observer server.
|
|
78
|
+
*/
|
|
79
|
+
onRuntimeStreamReady?: (stream: {
|
|
80
|
+
laneId: string;
|
|
81
|
+
sandboxId: string;
|
|
82
|
+
simId: string;
|
|
83
|
+
streamId: string;
|
|
84
|
+
url: string;
|
|
85
|
+
}) => Promise<void> | void;
|
|
86
|
+
loadDesktopModule?: () => Promise<E2BDesktopModule>;
|
|
87
|
+
runSession?: (options: CuaActorSessionOptions) => Promise<CuaLoopResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Supply a custom executor (e.g. a window.* JS-contract bridge over an already-running local
|
|
90
|
+
* dev server). When present (with `buildProvider`), `runCuaActorLab` takes the IN-PROCESS
|
|
91
|
+
* branch: it NEVER loads the E2B module, creates a sandbox, runs prepareDesktop, provisions a
|
|
92
|
+
* clone, opens a browser, or starts a stream — so `result.sandbox` is omitted, the verifiable
|
|
93
|
+
* "no E2B SDK call" proof. The whole bundle/Observer/redaction composition below the session
|
|
94
|
+
* call is desktop-agnostic and runs unchanged. Receives the resolved config, the
|
|
95
|
+
* registry-resolved descriptor, and the entry appUrl.
|
|
96
|
+
*/
|
|
97
|
+
buildExecutor?: (ctx: {
|
|
98
|
+
config: LabConfig;
|
|
99
|
+
actor: CuaActorDescriptor;
|
|
100
|
+
appUrl: string;
|
|
101
|
+
}) => Promise<CuaExecutor>;
|
|
102
|
+
/**
|
|
103
|
+
* Supply a custom provider (a "brain" reasoning over app STATE). REQUIRED alongside
|
|
104
|
+
* `buildExecutor` — the default OpenAI provider is vision-based (requiresFrame) and would fail
|
|
105
|
+
* closed against a state-only executor that returns no screenshot. (`buildProvider` ALONE is
|
|
106
|
+
* allowed — that is just a model swap on the normal E2B route.)
|
|
107
|
+
*/
|
|
108
|
+
buildProvider?: (ctx: {
|
|
109
|
+
config: LabConfig;
|
|
110
|
+
actor: CuaActorDescriptor;
|
|
111
|
+
}) => Promise<CuaProvider>;
|
|
112
|
+
env?: Record<string, string | undefined>;
|
|
113
|
+
renderObserverFn?: typeof renderObserver;
|
|
114
|
+
/** Injected clock/sleep for the detached-step polling (tests only). */
|
|
115
|
+
detachedTimers?: DetachedTimers;
|
|
116
|
+
/**
|
|
117
|
+
* Local-tree packing DI seam (tests only, no npm dependency needed to exercise the route):
|
|
118
|
+
* defaults to createLocalTreeArchive(root, opts) plus a host-side read of the produced
|
|
119
|
+
* archive file into an ArrayBuffer. Called ONCE per run, before lane fan-out, on the live
|
|
120
|
+
* local-tree route; the result (archive metadata + bytes) is shared byte-identically across
|
|
121
|
+
* every fan-out lane, so one archiveSha256 describes every lane's packed content.
|
|
122
|
+
*/
|
|
123
|
+
packLocalTree?: (args: {
|
|
124
|
+
root: string;
|
|
125
|
+
extraExclude?: string[];
|
|
126
|
+
maxArchiveBytes?: number;
|
|
127
|
+
}) => Promise<{
|
|
128
|
+
archive: LocalTreeArchive;
|
|
129
|
+
buffer: ArrayBuffer;
|
|
130
|
+
}>;
|
|
131
|
+
}
|
|
132
|
+
export interface RunCuaActorLabOptions {
|
|
133
|
+
cwd: string;
|
|
134
|
+
config: LabConfig;
|
|
135
|
+
/** Resolved upstream (scenario.mode + CLI override); defaults safe (dry-run). */
|
|
136
|
+
dryRun: boolean;
|
|
137
|
+
open?: boolean;
|
|
138
|
+
runId?: string;
|
|
139
|
+
/** CLI `--count` override for the homogeneous fan-out lane count (ignored when a `lanes`
|
|
140
|
+
* roster is declared — a roster's length is authoritative). */
|
|
141
|
+
countOverride?: number;
|
|
142
|
+
/** Explicitly create a new run containing failed or selected lanes from a prior fan-out run. */
|
|
143
|
+
rerun?: {
|
|
144
|
+
sourceRunId: string;
|
|
145
|
+
laneIds?: string[];
|
|
146
|
+
};
|
|
147
|
+
hooks?: CuaActorLabHooks;
|
|
148
|
+
onObserverReady?: (observer: ObserverResult & {
|
|
149
|
+
ok: true;
|
|
150
|
+
}) => Promise<void> | void;
|
|
151
|
+
}
|
|
152
|
+
/** A lane's row in the pre-flight plan: identity + the device/persona it will drive. The prompt
|
|
153
|
+
* text never leaks — only a sha256-16 digest of the composed instructions. */
|
|
154
|
+
export interface CuaLanePlanEntry {
|
|
155
|
+
id: string;
|
|
156
|
+
actorType?: string;
|
|
157
|
+
surface?: string;
|
|
158
|
+
caseGroup?: string;
|
|
159
|
+
/** 1-based display index. */
|
|
160
|
+
index: number;
|
|
161
|
+
persona: string;
|
|
162
|
+
device: string;
|
|
163
|
+
resolution: [number, number];
|
|
164
|
+
instructionDigest: string;
|
|
165
|
+
/** Present only when a lane overrides subject.appUrl; digest avoids leaking preview hosts in plan logs. */
|
|
166
|
+
targetDigest?: string;
|
|
167
|
+
}
|
|
168
|
+
/** The pre-flight spend/lane plan (pure; printed to stderr + recorded as a bundle event before
|
|
169
|
+
* any sandbox or provider call; identical in dry-run, marked $0). */
|
|
170
|
+
export interface CuaLanePlan {
|
|
171
|
+
strategy: typeof CUA_FANOUT_STRATEGY;
|
|
172
|
+
laneCount: number;
|
|
173
|
+
/** Effective in-flight bound (config default min(N,3), only LOWERED by the env override). */
|
|
174
|
+
concurrency: number;
|
|
175
|
+
/** ceil(laneCount / concurrency). */
|
|
176
|
+
waves: number;
|
|
177
|
+
/** Per-lane session wall-clock budget (execution.timeoutMs); there is no run-level wall clock. */
|
|
178
|
+
perLaneSessionBudgetMs: number;
|
|
179
|
+
/** Worst-case TOTAL sandbox-minutes across all lanes (each lane's full sandbox deadline). */
|
|
180
|
+
worstCaseSandboxMinutes: number;
|
|
181
|
+
/** True for a dry-run plan (no spend); the same table appears live. */
|
|
182
|
+
dryRun: boolean;
|
|
183
|
+
lanes: CuaLanePlanEntry[];
|
|
184
|
+
}
|
|
185
|
+
/** One lane's outcome in the result projection. ALWAYS present in `result.lanes` (length 1 at
|
|
186
|
+
* N=1). A `blocked` lane is one the pipeline-gate / fail-fast skipped before it ran. */
|
|
187
|
+
export interface CuaLaneResult {
|
|
188
|
+
id: string;
|
|
189
|
+
actorType?: string;
|
|
190
|
+
surface?: string;
|
|
191
|
+
caseGroup?: string;
|
|
192
|
+
index: number;
|
|
193
|
+
persona: string;
|
|
194
|
+
device: string;
|
|
195
|
+
resolution: [number, number];
|
|
196
|
+
/** Terminal lane status; "blocked" = skipped (gate/fail-fast); "contract_proof_only" = dry-run. */
|
|
197
|
+
status: ActorStatus | "blocked" | "contract_proof_only";
|
|
198
|
+
ok: boolean;
|
|
199
|
+
session?: {
|
|
200
|
+
status: ActorStatus;
|
|
201
|
+
completionReason: ActorCompletionReason;
|
|
202
|
+
reason: string;
|
|
203
|
+
screenshots: number;
|
|
204
|
+
};
|
|
205
|
+
sandbox?: {
|
|
206
|
+
sandboxId: string;
|
|
207
|
+
killed: boolean;
|
|
208
|
+
streamUrlPresent: boolean;
|
|
209
|
+
};
|
|
210
|
+
subject: CuaSubjectProjection;
|
|
211
|
+
/** Set when the lane was skipped (pinned reason string). */
|
|
212
|
+
skippedReason?: string;
|
|
213
|
+
error?: {
|
|
214
|
+
code: CuaActorLabErrorCode;
|
|
215
|
+
message: string;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** Aggregate counts across lanes. */
|
|
219
|
+
export interface CuaLaneSummary {
|
|
220
|
+
strategy: typeof CUA_FANOUT_STRATEGY;
|
|
221
|
+
total: number;
|
|
222
|
+
/** Lanes whose own verdict is ok (terminal, engaged, no harness error). */
|
|
223
|
+
passed: number;
|
|
224
|
+
/** Lanes skipped by the pipeline gate / fail-fast. */
|
|
225
|
+
skipped: number;
|
|
226
|
+
/** Lanes that ended in a harness error. */
|
|
227
|
+
harnessErrors: number;
|
|
228
|
+
/** Lanes that returned goal_satisfied with zero engagement (hollow). */
|
|
229
|
+
hollow: number;
|
|
230
|
+
concurrency: number;
|
|
231
|
+
waves: number;
|
|
232
|
+
}
|
|
233
|
+
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";
|
|
234
|
+
/** Subject provenance projection (invariant 5): what the actor actually drove. */
|
|
235
|
+
export interface CuaSubjectProjection {
|
|
236
|
+
source: "app-url" | "clone" | "local-tree";
|
|
237
|
+
/** Clone-route only: the (possibly redacted) owner/repo slug. */
|
|
238
|
+
repo?: string;
|
|
239
|
+
/** Cloned commit SHA (clone route) or host-side HEAD at pack time (local-tree route, when
|
|
240
|
+
* the packed root was a git work tree). */
|
|
241
|
+
commit?: string;
|
|
242
|
+
/** Local-tree-route only: 64-hex sha256 over the sorted packed-entries list: the content
|
|
243
|
+
* pin for a tree that cannot be commit-pinned. Absent on dry-run (nothing was packed). */
|
|
244
|
+
archiveSha256?: string;
|
|
245
|
+
/** Local-tree-route only: host-side porcelain status at pack time (true when the working
|
|
246
|
+
* tree had uncommitted changes). Absent when the packed root was not a git work tree. */
|
|
247
|
+
dirty?: boolean;
|
|
248
|
+
/** Declared env NAMES provisioned for the subject (values never surface anywhere). */
|
|
249
|
+
envNames?: string[];
|
|
250
|
+
/** The subject's state story (seeded digests / UNPINNED external / declared-not-run /
|
|
251
|
+
* undeclared): the same block the run bundle records. */
|
|
252
|
+
state: RunSubjectProvenance["state"];
|
|
253
|
+
}
|
|
254
|
+
/** The provisioned-route-only shape threaded through as buildCuaBundle's subjectProvenance arg
|
|
255
|
+
* (clone or local-tree; an app-url subject stays undeclared, which buildCuaBundle's own
|
|
256
|
+
* default branch already handles without this type). */
|
|
257
|
+
export type CuaSubjectProvenanceArg = {
|
|
258
|
+
source: "clone";
|
|
259
|
+
repo: string;
|
|
260
|
+
commit?: string;
|
|
261
|
+
envNames: string[];
|
|
262
|
+
state: RunSubjectProvenance["state"];
|
|
263
|
+
} | {
|
|
264
|
+
source: "local-tree";
|
|
265
|
+
archiveSha256?: string;
|
|
266
|
+
commit?: string;
|
|
267
|
+
dirty?: boolean;
|
|
268
|
+
envNames: string[];
|
|
269
|
+
state: RunSubjectProvenance["state"];
|
|
270
|
+
};
|
|
271
|
+
export interface CuaActorLabResult {
|
|
272
|
+
schema: typeof CUA_ACTOR_LAB_SCHEMA;
|
|
273
|
+
/** True when the bundle verified AND (dry-run, or the session reached a terminal verdict
|
|
274
|
+
* without a harness error). The actor's pass/fail is evidence, not the lab's exit code. */
|
|
275
|
+
ok: boolean;
|
|
276
|
+
cwd: string;
|
|
277
|
+
labId: string;
|
|
278
|
+
/** The registry-resolved actor id that ran (or would run) the session. */
|
|
279
|
+
actor: string;
|
|
280
|
+
appUrl: string;
|
|
281
|
+
dryRun: boolean;
|
|
282
|
+
runId: string;
|
|
283
|
+
session?: {
|
|
284
|
+
status: ActorStatus;
|
|
285
|
+
completionReason: ActorCompletionReason;
|
|
286
|
+
reason: string;
|
|
287
|
+
screenshots: number;
|
|
288
|
+
};
|
|
289
|
+
sandbox?: {
|
|
290
|
+
sandboxId: string;
|
|
291
|
+
killed: boolean;
|
|
292
|
+
/** The stream URL itself (carries an auth key) is runtime-only and is deliberately NOT
|
|
293
|
+
* surfaced on the result — the sandbox is already dead by the time the result exists. */
|
|
294
|
+
streamUrlPresent: boolean;
|
|
295
|
+
};
|
|
296
|
+
/** Subject provenance (invariant 5): what the actor actually drove. At N>1 this is the
|
|
297
|
+
* unanimity-gated aggregate (top-level `commit` only when every lane resolved the same one). */
|
|
298
|
+
subject?: CuaSubjectProjection;
|
|
299
|
+
/** The pre-flight lane plan (present once lanes resolve; absent on early validation errors). */
|
|
300
|
+
plan?: CuaLanePlan;
|
|
301
|
+
/** Per-lane results — ALWAYS present once lanes resolve (length 1 at N=1). */
|
|
302
|
+
lanes?: CuaLaneResult[];
|
|
303
|
+
/** Aggregate lane counts. */
|
|
304
|
+
laneSummary?: CuaLaneSummary;
|
|
305
|
+
/** Present when this run explicitly re-executes selected lanes from a prior CUA fan-out run. */
|
|
306
|
+
rerun?: RunRerunLineage;
|
|
307
|
+
observer?: ObserverResult;
|
|
308
|
+
warnings: string[];
|
|
309
|
+
error?: {
|
|
310
|
+
code: CuaActorLabErrorCode;
|
|
311
|
+
message: string;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
/** A fully-resolved fan-out lane: identity, the composed prompt, and the device geometry it
|
|
315
|
+
* renders at. Internal — the public projection is CuaLanePlanEntry / CuaLaneResult. */
|
|
316
|
+
export interface CuaLaneSpec {
|
|
317
|
+
laneId: string;
|
|
318
|
+
actorType?: string;
|
|
319
|
+
surface?: string;
|
|
320
|
+
caseGroup?: string;
|
|
321
|
+
/** 0-based. */
|
|
322
|
+
laneIndex: number;
|
|
323
|
+
simId: string;
|
|
324
|
+
streamId: string;
|
|
325
|
+
persona: ActorPersonaRef;
|
|
326
|
+
instructions: string;
|
|
327
|
+
/** App-url fan-out only: this lane's explicit browser target; absent falls back to deps.appUrl. */
|
|
328
|
+
targetUrl?: string;
|
|
329
|
+
/** Deterministic harness-owned completion guard. Lane-level override, else actor default. */
|
|
330
|
+
stopWhen?: StopWhen;
|
|
331
|
+
deviceName: string;
|
|
332
|
+
devicePreset: DevicePreset;
|
|
333
|
+
resolution: [number, number];
|
|
334
|
+
/** "" for N=1 (screenshots/<name>); the laneId for N>1 (screenshots/<laneId>/<name>). */
|
|
335
|
+
screenshotDir: string;
|
|
336
|
+
/** "actor.json" for N=1; "actors/<streamId>.json" for N>1. */
|
|
337
|
+
traceArtifactPath: string;
|
|
338
|
+
}
|
|
339
|
+
/** Compose one lane's actor prompt: persona line + device line + mission + per-lane steer.
|
|
340
|
+
* At N=1 (homogeneous, no roster) this reproduces the prior composeInstructions byte-for-byte. */
|
|
341
|
+
export declare function composeLaneInstructions(args: {
|
|
342
|
+
mission: string;
|
|
343
|
+
persona?: string;
|
|
344
|
+
instruction?: string;
|
|
345
|
+
device: {
|
|
346
|
+
name: string;
|
|
347
|
+
preset: DevicePreset;
|
|
348
|
+
};
|
|
349
|
+
}): {
|
|
350
|
+
instructions: string;
|
|
351
|
+
persona: ActorPersonaRef;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Resolve a lane's device + rendered resolution (most-specific wins, exactly as the single-lane
|
|
355
|
+
* path always has): a raw execution.desktop.resolution escape hatch (only legal when no lane
|
|
356
|
+
* sets a device — XOR enforced at parse) → the lane's named device → the run-wide
|
|
357
|
+
* execution.desktop.device → the default preset. A raw resolution is an unnamed custom desktop
|
|
358
|
+
* (non-mobile, DSF 1): we never claim a named preset's mobile/DPR for hand-set geometry.
|
|
359
|
+
*/
|
|
360
|
+
export declare function resolveLaneDevice(config: LabConfig, lane: LabActorLane | undefined): {
|
|
361
|
+
name: string;
|
|
362
|
+
preset: DevicePreset;
|
|
363
|
+
resolution: [number, number];
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Pure pre-flight plan resolver (runs in dry-run AND live). Returns the lane table, the
|
|
367
|
+
* effective concurrency, the wave count, the per-lane session budget, and the worst-case total
|
|
368
|
+
* sandbox-minutes — BEFORE any sandbox or provider call. The same plan appears in dry-run,
|
|
369
|
+
* marked $0 (dryRun: true).
|
|
370
|
+
*/
|
|
371
|
+
export declare function resolveCuaLanePlan(config: LabConfig, opts?: {
|
|
372
|
+
countOverride?: number;
|
|
373
|
+
env?: Record<string, string | undefined>;
|
|
374
|
+
dryRun?: boolean;
|
|
375
|
+
}): CuaLanePlan;
|
|
376
|
+
/** Shared deps every lane runner needs (resolved once in the engine). */
|
|
377
|
+
export interface CuaLaneDeps {
|
|
378
|
+
config: LabConfig;
|
|
379
|
+
descriptor: CuaActorDescriptor;
|
|
380
|
+
appUrl: string;
|
|
381
|
+
cloneRoute: boolean;
|
|
382
|
+
/** Optional so out-of-scope callers building CuaLaneDeps directly (other engines reusing
|
|
383
|
+
* runCuaLane) do not need to know about the local-tree route; undefined behaves as false. */
|
|
384
|
+
localTreeRoute?: boolean;
|
|
385
|
+
serve?: LabSubjectServe;
|
|
386
|
+
subjectRepo?: string;
|
|
387
|
+
subjectEnvNames: string[];
|
|
388
|
+
hasGithubToken: boolean;
|
|
389
|
+
/** Local-tree route only: the once-per-run packed archive bytes, shared byte-identically
|
|
390
|
+
* across every fan-out lane's upload step. Absent on dry-run and every other route. */
|
|
391
|
+
localTreeArchiveBuffer?: ArrayBuffer;
|
|
392
|
+
env: Record<string, string | undefined>;
|
|
393
|
+
openaiApiKey: string;
|
|
394
|
+
e2bApiKey: string;
|
|
395
|
+
requestTimeoutMs: number;
|
|
396
|
+
perLaneSandboxMs: number;
|
|
397
|
+
timeoutMs: number;
|
|
398
|
+
laneCount: number;
|
|
399
|
+
artifactRoot: PreparedOutputDirectory;
|
|
400
|
+
redactScreenshots: boolean;
|
|
401
|
+
scrubKnownValues: (text: string) => string;
|
|
402
|
+
runSession: (options: CuaActorSessionOptions) => Promise<CuaLoopResult>;
|
|
403
|
+
hooks: CuaActorLabHooks;
|
|
404
|
+
/** Lane-0 only: signal the pipeline gate after provisioning succeeds (true) or fails (false). */
|
|
405
|
+
signalProvisioned?: (ok: boolean) => void;
|
|
406
|
+
}
|
|
407
|
+
/** One lane's end-to-end run outcome (internal; projected into CuaLaneResult + the bundle). */
|
|
408
|
+
export interface LaneRunOutcome {
|
|
409
|
+
spec: CuaLaneSpec;
|
|
410
|
+
session?: CuaLoopResult;
|
|
411
|
+
sessionError?: string;
|
|
412
|
+
sandboxId?: string;
|
|
413
|
+
killed: boolean;
|
|
414
|
+
streamUrlPresent: boolean;
|
|
415
|
+
screenshots: string[];
|
|
416
|
+
subjectCommit?: string;
|
|
417
|
+
desktopBrowser?: DesktopBrowserEvidence;
|
|
418
|
+
stateStepRecords: RunSubjectStateStepRecord[];
|
|
419
|
+
/** Completed subject-phase records (clone/upload/extract/install/build/ready/state groups),
|
|
420
|
+
* folded into bundle.events at build time. Empty on the in-process route (no provisioning). */
|
|
421
|
+
phaseRecords: SubjectPhaseEvent[];
|
|
422
|
+
warnings: string[];
|
|
423
|
+
/** Set when the lane was skipped by the pipeline gate / fail-fast (a pinned reason). */
|
|
424
|
+
skippedReason?: string;
|
|
425
|
+
noEngagement: boolean;
|
|
426
|
+
selfReportedBlocker: boolean;
|
|
427
|
+
harnessError: boolean;
|
|
428
|
+
failureCode?: CuaActorLabErrorCode;
|
|
429
|
+
entryKind?: "local-app";
|
|
430
|
+
}
|
|
431
|
+
/** Build a lane's writeScreenshot closure: writes under screenshots/<screenshotDir>/ and records
|
|
432
|
+
* the relative path the trace references (screenshots/<name> at N=1; screenshots/<laneId>/<name>
|
|
433
|
+
* at N>1). */
|
|
434
|
+
export declare function makeLaneWriteScreenshot(artifactRoot: PreparedOutputDirectory, spec: {
|
|
435
|
+
screenshotDir: string;
|
|
436
|
+
}, screenshots: string[]): (name: string, bytes: Buffer) => Promise<string>;
|
|
437
|
+
/**
|
|
438
|
+
* Build the xdotool command that makes a browser window fill the desktop.
|
|
439
|
+
* Exported (pure) for contract tests. A window manager can ignore Chrome's
|
|
440
|
+
* --window-size, so xdotool is the robust path: move the window to the origin,
|
|
441
|
+
* then size it to the exact desktop resolution so Observer screenshots carry no
|
|
442
|
+
* dead margin around the browser.
|
|
443
|
+
*/
|
|
444
|
+
export declare function buildFillDesktopWindowCommand(windowId: string, width: number, height: number): string;
|
|
445
|
+
export declare function makeChromeBrowserStateObserver(desktop: E2BDesktopSandbox, requestTimeoutMs: number): () => Promise<{
|
|
446
|
+
url?: string;
|
|
447
|
+
title?: string;
|
|
448
|
+
text?: string;
|
|
449
|
+
}>;
|
|
450
|
+
/**
|
|
451
|
+
* Run ONE E2B desktop lane end-to-end: create the sandbox (per-lane metadata + the lane's device
|
|
452
|
+
* resolution), prepareDesktop, verify geometry, (clone+serve+seed the subject per lane), open the
|
|
453
|
+
* browser, run the session, and ALWAYS tear down THIS lane's sandbox BY ID in a finally. Never
|
|
454
|
+
* enumerates sandboxes. Extracted from the former single-lane block; at N=1 it writes the exact
|
|
455
|
+
* same artifacts (actor.json, screenshots/<name>) the bundle has always referenced.
|
|
456
|
+
*/
|
|
457
|
+
export declare function runCuaLane(spec: CuaLaneSpec, deps: CuaLaneDeps): Promise<LaneRunOutcome>;
|
|
458
|
+
export declare function runCuaActorLab(options: RunCuaActorLabOptions): Promise<CuaActorLabResult>;
|
|
459
|
+
/**
|
|
460
|
+
* Provision a clone subject inside the sandbox: clone → the shared serve pipeline
|
|
461
|
+
* (install → state(before-build) → build → state(before-start) → start → readiness
|
|
462
|
+
* probe → state(after-ready)). Returns the latest subject HEAD after successful
|
|
463
|
+
* provisioning. Throws (with a capped log tail for the caller to redact) on any failing step:
|
|
464
|
+
* the lab persists that as a failed-evidence bundle.
|
|
465
|
+
*
|
|
466
|
+
* Auth: when GITHUB_TOKEN is among the declared subject env names, the clone authenticates
|
|
467
|
+
* via an Authorization header computed IN-SANDBOX from the provisioned env: the token never
|
|
468
|
+
* appears in the script text, the process argv beyond the transient git call, the clone URL,
|
|
469
|
+
* or .git/config.
|
|
470
|
+
*/
|
|
471
|
+
export declare function provisionCloneSubject(desktop: E2BDesktopSandbox, args: {
|
|
472
|
+
repo: string;
|
|
473
|
+
depth: number;
|
|
474
|
+
serve: LabSubjectServe;
|
|
475
|
+
/** Declared subject state (seed steps; external declaration is provenance-only). */
|
|
476
|
+
state?: LabSubjectState;
|
|
477
|
+
hasGithubToken: boolean;
|
|
478
|
+
requestTimeoutMs: number;
|
|
479
|
+
/** Literal scrubber for known provisioned values, applied to log tails PRE-truncation. */
|
|
480
|
+
scrub: (text: string) => string;
|
|
481
|
+
/** Called the moment the cloned commit resolves, so provenance survives later failures. */
|
|
482
|
+
onCommit?: (commit: string) => void;
|
|
483
|
+
/** Called the moment each state step finishes (mirrors onCommit), success or failure. */
|
|
484
|
+
onStateStep?: (record: RunSubjectStateStepRecord) => void;
|
|
485
|
+
/** Called at each phase boundary (started/completed): clone, install, build, serve start,
|
|
486
|
+
* ready, and each subject.state seed-step group. */
|
|
487
|
+
onPhase?: (event: SubjectPhaseEvent) => void;
|
|
488
|
+
} & DetachedTimers): Promise<string | undefined>;
|
|
489
|
+
/**
|
|
490
|
+
* Provision a local-tree subject inside the sandbox: upload the once-per-run packed archive
|
|
491
|
+
* (identical bytes across every fan-out lane) → extract it into SUBJECT_DIR → the
|
|
492
|
+
* same shared serve pipeline provisionCloneSubject uses. Unlike the clone route there is no
|
|
493
|
+
* in-sandbox git refresh: the archive excludes .git entirely (see source-archive.ts), so
|
|
494
|
+
* subject identity is the host-side LocalTreeArchive captured at pack time, never anything
|
|
495
|
+
* resolved in-sandbox.
|
|
496
|
+
*/
|
|
497
|
+
export declare function provisionLocalTreeSubject(desktop: E2BDesktopSandbox, args: {
|
|
498
|
+
/** The once-per-run packed archive bytes (shared byte-identically across every lane). */
|
|
499
|
+
archiveBuffer: ArrayBuffer;
|
|
500
|
+
serve: LabSubjectServe;
|
|
501
|
+
/** Declared subject state (seed steps; external declaration is provenance-only). */
|
|
502
|
+
state?: LabSubjectState;
|
|
503
|
+
requestTimeoutMs: number;
|
|
504
|
+
/** Literal scrubber for known provisioned values, applied to log tails PRE-truncation. */
|
|
505
|
+
scrub: (text: string) => string;
|
|
506
|
+
/** Called the moment each state step finishes, success or failure. */
|
|
507
|
+
onStateStep?: (record: RunSubjectStateStepRecord) => void;
|
|
508
|
+
/** Called at each phase boundary (started/completed): upload, extract, install, build,
|
|
509
|
+
* serve start, ready, and each subject.state seed-step group. */
|
|
510
|
+
onPhase?: (event: SubjectPhaseEvent) => void;
|
|
511
|
+
} & DetachedTimers): Promise<void>;
|
|
512
|
+
/**
|
|
513
|
+
* Default local-tree packing implementation: createLocalTreeArchive(root, opts) on the host,
|
|
514
|
+
* then a single read of the produced archive file into an ArrayBuffer for upload. The DI seam
|
|
515
|
+
* (CuaActorLabHooks.packLocalTree) overrides this in deterministic tests so they never require
|
|
516
|
+
* tar/git.
|
|
517
|
+
*/
|
|
518
|
+
export declare function defaultPackLocalTree(args: {
|
|
519
|
+
root: string;
|
|
520
|
+
extraExclude?: string[];
|
|
521
|
+
maxArchiveBytes?: number;
|
|
522
|
+
}): Promise<{
|
|
523
|
+
archive: LocalTreeArchive;
|
|
524
|
+
buffer: ArrayBuffer;
|
|
525
|
+
}>;
|
|
526
|
+
/** sha256 hex of the exact command string, first 16 chars (the promptDigest convention). */
|
|
527
|
+
export declare function commandDigestOf(command: string): string;
|
|
528
|
+
/**
|
|
529
|
+
* Resolve the bundle's state marker from the declaration and what actually ran.
|
|
530
|
+
* Precedence: external declared → "unpinned" (seed records, if any, stay attached — a
|
|
531
|
+
* migrated external DB is still unpinned overall); else seed declared → "seeded" only when
|
|
532
|
+
* every declared step executed ok on a live run, otherwise "declared-not-run" (dry-run
|
|
533
|
+
* contract bundles and failed live provisioning); no declaration → "undeclared".
|
|
534
|
+
*/
|
|
535
|
+
export declare function resolveSubjectState(args: {
|
|
536
|
+
declared: LabSubjectState | undefined;
|
|
537
|
+
dryRun: boolean;
|
|
538
|
+
executed: RunSubjectStateStepRecord[];
|
|
539
|
+
}): RunSubjectProvenance["state"];
|
|
540
|
+
/**
|
|
541
|
+
* Project a computer-use session into a humanish.run-bundle.v1. The load-bearing line is
|
|
542
|
+
* `stream.actor = session.trace` — the provider-neutral ActorTrace seam the Observer renders.
|
|
543
|
+
* Exported for the bundle-builder tests.
|
|
544
|
+
*/
|
|
545
|
+
export declare function buildCuaBundle(args: {
|
|
546
|
+
actorId: string;
|
|
547
|
+
appUrl: string;
|
|
548
|
+
laneId?: string;
|
|
549
|
+
actorType?: string;
|
|
550
|
+
surface?: string;
|
|
551
|
+
caseGroup?: string;
|
|
552
|
+
createdAt: string;
|
|
553
|
+
dryRun: boolean;
|
|
554
|
+
labId: string;
|
|
555
|
+
labTitle?: string;
|
|
556
|
+
mission: string;
|
|
557
|
+
persona: ActorPersonaRef;
|
|
558
|
+
resolution: [number, number];
|
|
559
|
+
/** Device metadata for the stream viewport (honest; isMobile/DSF are not rendered on this route). */
|
|
560
|
+
deviceScaleFactor?: number;
|
|
561
|
+
isMobile?: boolean;
|
|
562
|
+
runId: string;
|
|
563
|
+
screenshots: string[];
|
|
564
|
+
/**
|
|
565
|
+
* Capture-time screenshot policy ("blurred" when policies.redactScreenshots, else "raw").
|
|
566
|
+
* When a session ran, its trace's `redaction.screenshots` is the evidence-of-record and
|
|
567
|
+
* wins; this fallback keeps labels honest for frames written before a mid-session failure
|
|
568
|
+
* (no trace exists to testify then). Defaults to "raw" — the engine default.
|
|
569
|
+
*/
|
|
570
|
+
captureRedaction?: "raw" | "blurred";
|
|
571
|
+
session?: CuaLoopResult;
|
|
572
|
+
sessionError?: string;
|
|
573
|
+
source: RunBundle["source"];
|
|
574
|
+
/** Provisioned-route provenance (clone or local-tree): what the actor actually drove (names
|
|
575
|
+
* + digests only, never values or command text), including the subject's state story. */
|
|
576
|
+
subjectProvenance?: CuaSubjectProvenanceArg;
|
|
577
|
+
/**
|
|
578
|
+
* Entry kind for the non-clone subject.declared event (invariant 5 — declare what the subject
|
|
579
|
+
* WAS). "local-app": an already-running LOCAL dev server driven in-process, un-pinnable —
|
|
580
|
+
* declared honestly as caller-provisioned/unpinned with no E2B. Absent: a plain app-url entry.
|
|
581
|
+
*/
|
|
582
|
+
entryKind?: "local-app";
|
|
583
|
+
/** The custom E2B desktop template (image) this lane launched on, when configured (provenance). */
|
|
584
|
+
desktopTemplate?: string;
|
|
585
|
+
/** The configured browser choice and the command that opened, when explicitly configured. */
|
|
586
|
+
desktopBrowser?: DesktopBrowserEvidence;
|
|
587
|
+
traceArtifactPath?: string;
|
|
588
|
+
providerResources?: RunProviderResource[];
|
|
589
|
+
inProgress?: boolean;
|
|
590
|
+
/** Completed subject-phase records (clone/upload/extract/install/build/ready/state groups)
|
|
591
|
+
* to fold into bundle.events, so run.json carries real phase timing after the fact. */
|
|
592
|
+
phaseEvents?: SubjectPhaseEvent[];
|
|
593
|
+
}): RunBundle;
|
|
594
|
+
/**
|
|
595
|
+
* Project N>1 fan-out lanes into a humanish.run-bundle.v1 (the evidence schema is unchanged; this
|
|
596
|
+
* is a new producer for the multi-stream shape). One sim + one stream per lane; per-lane
|
|
597
|
+
* provenance/session events; a recorded `cua-lab.fanout.plan` event (and a `cua-lab.fanout.fail-fast`
|
|
598
|
+
* event when a harness error skipped queued lanes). N-ary verify/Observer already handle multiple
|
|
599
|
+
* streams. The N=1 path NEVER reaches here (buildCuaBundle owns it, byte-stable).
|
|
600
|
+
*/
|
|
601
|
+
export declare function buildCuaFanoutBundle(args: {
|
|
602
|
+
specs: CuaLaneSpec[];
|
|
603
|
+
outcomes?: LaneRunOutcome[];
|
|
604
|
+
laneSubjects: CuaSubjectProjection[];
|
|
605
|
+
aggregateSubject: CuaSubjectProjection;
|
|
606
|
+
descriptor: CuaActorDescriptor;
|
|
607
|
+
appUrl: string;
|
|
608
|
+
createdAt: string;
|
|
609
|
+
dryRun: boolean;
|
|
610
|
+
config: LabConfig;
|
|
611
|
+
runId: string;
|
|
612
|
+
source: RunBundle["source"];
|
|
613
|
+
plan: CuaLanePlan;
|
|
614
|
+
rerun?: RunRerunLineage;
|
|
615
|
+
failFastReason?: string;
|
|
616
|
+
cloneRoute: boolean;
|
|
617
|
+
localTreeRoute?: boolean;
|
|
618
|
+
publicRepo?: string;
|
|
619
|
+
subjectEnvNames: string[];
|
|
620
|
+
inProgress?: boolean;
|
|
621
|
+
}): RunBundle;
|