humanish 0.0.1 → 0.15.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.
- package/AGENTS.md +77 -0
- package/CONTRIBUTING.md +39 -0
- package/LICENSE +21 -0
- package/README.md +435 -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 +356 -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 +327 -0
- package/dist/codex-app-server-ui.js.map +1 -0
- package/dist/codex-app-server.d.ts +141 -0
- package/dist/codex-app-server.js +747 -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 +1092 -0
- package/dist/concurrent-shared-world-lab.js.map +1 -0
- package/dist/core/git-state.d.ts +31 -0
- package/dist/core/git-state.js +142 -0
- package/dist/core/git-state.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 +620 -0
- package/dist/cua-actor-lab.js +2834 -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 +1467 -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 +313 -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 +343 -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 +578 -0
- package/dist/lab-config.js +1751 -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 +176 -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 +192 -0
- package/dist/observer-static.js.map +1 -0
- package/dist/observer.d.ts +46 -0
- package/dist/observer.js +353 -0
- package/dist/observer.js.map +1 -0
- package/dist/openai-responses-cu.d.ts +113 -0
- package/dist/openai-responses-cu.js +531 -0
- package/dist/openai-responses-cu.js.map +1 -0
- package/dist/oss-lab.d.ts +52 -0
- package/dist/oss-lab.js +299 -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 +279 -0
- package/dist/oss-meta-lab.js +4889 -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 +2347 -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.d.ts +784 -0
- package/dist/run.js +4555 -0
- package/dist/run.js.map +1 -0
- package/dist/scripted-browser-actor.d.ts +294 -0
- package/dist/scripted-browser-actor.js +1286 -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 +738 -0
- package/dist/scripted-browser-lab.js.map +1 -0
- package/dist/shared-world-lab.d.ts +208 -0
- package/dist/shared-world-lab.js +1048 -0
- package/dist/shared-world-lab.js.map +1 -0
- package/dist/source-archive.d.ts +82 -0
- package/dist/source-archive.js +365 -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 +242 -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 +305 -0
- package/docs/contracts/run-bundle.md +358 -0
- package/docs/contracts/schemas.md +984 -0
- package/docs/goals/current.md +409 -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 +229 -0
- package/docs/ramp/README.md +200 -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,107 @@
|
|
|
1
|
+
import type { CodexAppServerRunResult, CodexAppServerStatus } from "./codex-app-server.js";
|
|
2
|
+
export declare const ACTOR_TRACE_SCHEMA = "humanish.actor-trace.v1";
|
|
3
|
+
export type ActorStatus = "passed" | "failed" | "blocked" | "timed_out";
|
|
4
|
+
export type ActorCompletionReason = "goal_satisfied" | "turn_completed" | "gave_up" | "blocked_approval" | "timed_out" | "actor_error" | "step_failed" | "harness_error";
|
|
5
|
+
export type ActorLane = "code" | "app" | "computer-use" | "scripted-browser" | "terminal";
|
|
6
|
+
export type ActorProtocol = "json-rpc" | "json-stream" | "in-process-sdk" | "cua-loop" | "scripted-steps" | "terminal-exec";
|
|
7
|
+
export type ActorTraceItemKind = "message" | "reasoning" | "tool_call" | "command" | "file_change" | "approval" | "screenshot" | "ui_action" | "plan" | "notice";
|
|
8
|
+
export interface ActorTraceItem {
|
|
9
|
+
id: string;
|
|
10
|
+
kind: ActorTraceItemKind;
|
|
11
|
+
lifecycle: "started" | "completed";
|
|
12
|
+
status?: string;
|
|
13
|
+
title: string;
|
|
14
|
+
tool?: {
|
|
15
|
+
server?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
};
|
|
18
|
+
command?: {
|
|
19
|
+
text?: string;
|
|
20
|
+
cwd?: string;
|
|
21
|
+
exitCode?: number;
|
|
22
|
+
outputTail?: string;
|
|
23
|
+
};
|
|
24
|
+
screenshotRef?: {
|
|
25
|
+
path: string;
|
|
26
|
+
redaction: "blurred" | "ocr_scrubbed" | "none";
|
|
27
|
+
};
|
|
28
|
+
text?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ActorCapabilities {
|
|
31
|
+
headless: boolean;
|
|
32
|
+
structuredTrace: boolean;
|
|
33
|
+
lanes: ActorLane[];
|
|
34
|
+
producesScreenshots: boolean;
|
|
35
|
+
byoModel: boolean;
|
|
36
|
+
preGrantableApprovals: boolean;
|
|
37
|
+
inProcessTools: boolean;
|
|
38
|
+
license: "open" | "source-available" | "proprietary";
|
|
39
|
+
/**
|
|
40
|
+
* WHERE this actor's runtime key lives, per the placement rule (invariants-and-defaults.md):
|
|
41
|
+
* "keys live where the keyed process runs — and nowhere else." Registry metadata the engine
|
|
42
|
+
* enforces, NOT a code convention.
|
|
43
|
+
* - "external" (the implicit default for every existing actor): the keyed process (e.g. a
|
|
44
|
+
* computer-use provider loop) runs OUTSIDE any sandbox, so its key never enters one.
|
|
45
|
+
* - "in-sandbox-command-scoped": the keyed process is an agent-harness-under-test that runs
|
|
46
|
+
* INSIDE the sandbox; its runtime key is injected ONLY into the per-command `envs` of that
|
|
47
|
+
* invocation (never `Sandbox.create({envs})`, which is sandbox-global), the key is presumed
|
|
48
|
+
* exfiltratable, and the blast radius is bounded by key scoping + a spend budget.
|
|
49
|
+
* Absent === "external". This field is DECLARED metadata in SLICE 1 (the contract is honest
|
|
50
|
+
* about where the key would go); the ENGINE enforcement of command-scoped injection lands with
|
|
51
|
+
* the live backend in SLICE 2.
|
|
52
|
+
*/
|
|
53
|
+
keyPlacement?: "external" | "in-sandbox-command-scoped";
|
|
54
|
+
}
|
|
55
|
+
export interface ActorPersonaRef {
|
|
56
|
+
id: string;
|
|
57
|
+
traitsApplied: string[];
|
|
58
|
+
promptDigest: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ActorTokenUsage {
|
|
61
|
+
input?: number;
|
|
62
|
+
output?: number;
|
|
63
|
+
total?: number;
|
|
64
|
+
costUsd?: number;
|
|
65
|
+
}
|
|
66
|
+
export interface ActorTrace {
|
|
67
|
+
schema: typeof ACTOR_TRACE_SCHEMA;
|
|
68
|
+
provider: string;
|
|
69
|
+
providerVersion?: string;
|
|
70
|
+
protocol: ActorProtocol;
|
|
71
|
+
lane: ActorLane;
|
|
72
|
+
persona: ActorPersonaRef;
|
|
73
|
+
redaction: {
|
|
74
|
+
status: "passed";
|
|
75
|
+
screenshots: "n/a" | "raw" | "blurred" | "ocr_scrubbed";
|
|
76
|
+
notes: string;
|
|
77
|
+
};
|
|
78
|
+
startedAt: string;
|
|
79
|
+
completedAt: string;
|
|
80
|
+
durationMs: number;
|
|
81
|
+
status: ActorStatus;
|
|
82
|
+
completionReason: ActorCompletionReason;
|
|
83
|
+
reason: string;
|
|
84
|
+
ids: {
|
|
85
|
+
sessionId?: string;
|
|
86
|
+
threadId?: string;
|
|
87
|
+
turnId?: string;
|
|
88
|
+
model?: string;
|
|
89
|
+
};
|
|
90
|
+
counts: Record<string, number>;
|
|
91
|
+
items: ActorTraceItem[];
|
|
92
|
+
tokenUsage?: ActorTokenUsage;
|
|
93
|
+
capabilities: ActorCapabilities;
|
|
94
|
+
}
|
|
95
|
+
export declare const CODEX_APP_SERVER_CAPABILITIES: ActorCapabilities;
|
|
96
|
+
export declare const PI_AGENT_CORE_CAPABILITIES: ActorCapabilities;
|
|
97
|
+
export declare const CLAUDE_AGENT_SDK_CAPABILITIES: ActorCapabilities;
|
|
98
|
+
export declare const SCRIPTED_BROWSER_CAPABILITIES: ActorCapabilities;
|
|
99
|
+
export declare const TERMINAL_AGENT_CAPABILITIES: ActorCapabilities;
|
|
100
|
+
export declare function codexStatusToCompletionReason(status: CodexAppServerStatus): ActorCompletionReason;
|
|
101
|
+
/**
|
|
102
|
+
* Map a Codex app-server run result into the provider-neutral ActorTrace. Pure
|
|
103
|
+
* and side-effect-free. The persona reference is supplied by the harness; until
|
|
104
|
+
* personas are load-bearing it is a minimal stub ({ id, traitsApplied: [],
|
|
105
|
+
* promptDigest }).
|
|
106
|
+
*/
|
|
107
|
+
export declare function codexResultToActorTrace(result: CodexAppServerRunResult, persona: ActorPersonaRef): ActorTrace;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { redactText } from "./redaction.js";
|
|
2
|
+
// The provider-neutral evidence schema. Codex item/* events, Claude
|
|
3
|
+
// ToolUse/ToolResult blocks, pi tool_execution_* events, and computer-use
|
|
4
|
+
// cycles all map onto this one ActorTrace. See docs/architecture/actor-contract.md.
|
|
5
|
+
//
|
|
6
|
+
// This PR ships the evidence schema + the first provider mapping (Codex) + the
|
|
7
|
+
// registry. The full Actor.run(input: ActorRunInput) interface, RedactionHooks
|
|
8
|
+
// injection, ApprovalPolicy, and ResolvedPersona are specified in the design doc
|
|
9
|
+
// and land with the load-bearing-personas and adapter PRs; they are intentionally
|
|
10
|
+
// not declared here yet to avoid unimplemented placeholder types.
|
|
11
|
+
export const ACTOR_TRACE_SCHEMA = "humanish.actor-trace.v1";
|
|
12
|
+
export const CODEX_APP_SERVER_CAPABILITIES = {
|
|
13
|
+
headless: true,
|
|
14
|
+
structuredTrace: true,
|
|
15
|
+
lanes: ["code"],
|
|
16
|
+
producesScreenshots: false,
|
|
17
|
+
byoModel: false,
|
|
18
|
+
preGrantableApprovals: true,
|
|
19
|
+
inProcessTools: false,
|
|
20
|
+
license: "open"
|
|
21
|
+
};
|
|
22
|
+
// pi-agent-core (@earendil-works/pi-agent-core): an embeddable, provider-agnostic
|
|
23
|
+
// agent loop (MIT). byoModel: 15+ providers incl. local. No confirmed pre-grant
|
|
24
|
+
// approval hook today, so preGrantableApprovals is false until verified.
|
|
25
|
+
export const PI_AGENT_CORE_CAPABILITIES = {
|
|
26
|
+
headless: true,
|
|
27
|
+
structuredTrace: true,
|
|
28
|
+
lanes: ["code", "app"],
|
|
29
|
+
producesScreenshots: false,
|
|
30
|
+
byoModel: true,
|
|
31
|
+
preGrantableApprovals: false,
|
|
32
|
+
inProcessTools: true,
|
|
33
|
+
license: "open"
|
|
34
|
+
};
|
|
35
|
+
// Claude Agent SDK (@anthropic-ai/claude-agent-sdk): in-process query() stream
|
|
36
|
+
// with typed SDK messages. Pre-grant approvals via permissionMode/allowedTools.
|
|
37
|
+
// Anthropic-centric models (others via a proxy), so byoModel is false.
|
|
38
|
+
export const CLAUDE_AGENT_SDK_CAPABILITIES = {
|
|
39
|
+
headless: true,
|
|
40
|
+
structuredTrace: true,
|
|
41
|
+
lanes: ["code", "app"],
|
|
42
|
+
producesScreenshots: false,
|
|
43
|
+
byoModel: false,
|
|
44
|
+
preGrantableApprovals: true,
|
|
45
|
+
inProcessTools: true,
|
|
46
|
+
license: "open"
|
|
47
|
+
};
|
|
48
|
+
// Scripted browser driver (src/scripted-browser-actor.ts): deterministic Playwright step
|
|
49
|
+
// replay against a loopback app. byoModel is false because there is NO model — the committed
|
|
50
|
+
// scenario steps are the whole behavior; tokenUsage on its traces records zeros by mechanism.
|
|
51
|
+
export const SCRIPTED_BROWSER_CAPABILITIES = {
|
|
52
|
+
headless: true,
|
|
53
|
+
structuredTrace: true,
|
|
54
|
+
lanes: ["scripted-browser"],
|
|
55
|
+
producesScreenshots: true,
|
|
56
|
+
byoModel: false,
|
|
57
|
+
preGrantableApprovals: false,
|
|
58
|
+
inProcessTools: false,
|
|
59
|
+
license: "open" // playwright-core (Apache-2.0), already a lazy-imported production dependency
|
|
60
|
+
};
|
|
61
|
+
// Terminal agent (src/e2b-terminal-lab.ts): a real autonomous coding agent (Codex) discovering
|
|
62
|
+
// and using a CLI/product from inside an E2B shell, capturing its non-interactive exec output as
|
|
63
|
+
// a redacted event stream + normalized transcript. The "terminal" lane is the autonomous-agent
|
|
64
|
+
// study lane (distinct from "code", the operator-machine Codex lanes). byoModel is false: the
|
|
65
|
+
// agent runs its own model via the command-scoped runtime auth, not a humanish-supplied provider.
|
|
66
|
+
// keyPlacement is "in-sandbox-command-scoped" — the load-bearing inversion of every existing
|
|
67
|
+
// E2B route's external-key default (the agent is the keyed process and it runs INSIDE). DECLARED
|
|
68
|
+
// here this slice; the engine enforcement of the command-scoped boundary lands in SLICE 2.
|
|
69
|
+
export const TERMINAL_AGENT_CAPABILITIES = {
|
|
70
|
+
headless: true,
|
|
71
|
+
structuredTrace: true,
|
|
72
|
+
lanes: ["terminal"],
|
|
73
|
+
producesScreenshots: false,
|
|
74
|
+
byoModel: false,
|
|
75
|
+
preGrantableApprovals: false,
|
|
76
|
+
inProcessTools: false,
|
|
77
|
+
license: "open", // the Codex CLI is invoked as a subprocess inside the sandbox; no peer dep here
|
|
78
|
+
keyPlacement: "in-sandbox-command-scoped"
|
|
79
|
+
};
|
|
80
|
+
// Codex app-server reports four terminal statuses but no explicit completion
|
|
81
|
+
// reason enum, so map status -> reason. App-server "blocked" is approval-driven
|
|
82
|
+
// (an action was declined and the turn could not proceed). "goal_satisfied" and
|
|
83
|
+
// "gave_up" are not reachable from Codex today; they arrive with persona-driven
|
|
84
|
+
// scenario predicates and harness-enforced turn budgets in a later PR.
|
|
85
|
+
export function codexStatusToCompletionReason(status) {
|
|
86
|
+
switch (status) {
|
|
87
|
+
case "passed":
|
|
88
|
+
return "turn_completed";
|
|
89
|
+
case "timed_out":
|
|
90
|
+
return "timed_out";
|
|
91
|
+
case "blocked":
|
|
92
|
+
return "blocked_approval";
|
|
93
|
+
case "failed":
|
|
94
|
+
return "actor_error";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function codexItemKind(type) {
|
|
98
|
+
switch (type) {
|
|
99
|
+
case "commandExecution":
|
|
100
|
+
return "command";
|
|
101
|
+
case "fileChange":
|
|
102
|
+
return "file_change";
|
|
103
|
+
case "mcpToolCall":
|
|
104
|
+
case "dynamicToolCall":
|
|
105
|
+
return "tool_call";
|
|
106
|
+
case "agentMessage":
|
|
107
|
+
return "message";
|
|
108
|
+
case "reasoning":
|
|
109
|
+
return "reasoning";
|
|
110
|
+
default: {
|
|
111
|
+
const lowered = type.toLowerCase();
|
|
112
|
+
if (lowered.includes("message"))
|
|
113
|
+
return "message";
|
|
114
|
+
if (lowered.includes("reason"))
|
|
115
|
+
return "reasoning";
|
|
116
|
+
if (lowered.includes("command"))
|
|
117
|
+
return "command";
|
|
118
|
+
if (lowered.includes("file"))
|
|
119
|
+
return "file_change";
|
|
120
|
+
if (lowered.includes("tool"))
|
|
121
|
+
return "tool_call";
|
|
122
|
+
if (lowered.includes("plan"))
|
|
123
|
+
return "plan";
|
|
124
|
+
return "notice";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function pickTokenUsage(raw) {
|
|
129
|
+
if (raw === undefined || raw === null || typeof raw !== "object") {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const record = raw;
|
|
133
|
+
const numberFrom = (keys) => {
|
|
134
|
+
for (const key of keys) {
|
|
135
|
+
const value = record[key];
|
|
136
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
};
|
|
142
|
+
const input = numberFrom(["input", "input_tokens", "inputTokens", "prompt_tokens"]);
|
|
143
|
+
const output = numberFrom(["output", "output_tokens", "outputTokens", "completion_tokens"]);
|
|
144
|
+
const total = numberFrom(["total", "total_tokens", "totalTokens"]);
|
|
145
|
+
const costUsd = numberFrom(["costUsd", "cost_usd", "cost"]);
|
|
146
|
+
const usage = {
|
|
147
|
+
...(input === undefined ? {} : { input }),
|
|
148
|
+
...(output === undefined ? {} : { output }),
|
|
149
|
+
...(total === undefined ? {} : { total }),
|
|
150
|
+
...(costUsd === undefined ? {} : { costUsd })
|
|
151
|
+
};
|
|
152
|
+
return Object.keys(usage).length > 0 ? usage : undefined;
|
|
153
|
+
}
|
|
154
|
+
// Flatten the Codex trace into provider-neutral items. The lifecycle rows in
|
|
155
|
+
// trace.items only cover message/reasoning/command/file/tool; approvals, plans,
|
|
156
|
+
// warnings, and errors live only in sibling arrays and are synthesized here so
|
|
157
|
+
// no evidence is silently dropped.
|
|
158
|
+
function codexTraceToActorItems(trace) {
|
|
159
|
+
const commandByItem = new Map(trace.commands.map((command) => [command.itemId, command]));
|
|
160
|
+
const toolByItem = new Map(trace.tools.map((tool) => [tool.itemId, tool]));
|
|
161
|
+
const messageByItem = new Map(trace.messages.map((message) => [message.itemId, message]));
|
|
162
|
+
const reasoningByItem = new Map(trace.reasoning.map((entry) => [entry.itemId, entry]));
|
|
163
|
+
const fileChangeByItem = new Map(trace.fileChanges.map((change) => [change.itemId, change]));
|
|
164
|
+
const items = trace.items.map((item) => {
|
|
165
|
+
const kind = codexItemKind(item.type);
|
|
166
|
+
const base = {
|
|
167
|
+
id: item.id,
|
|
168
|
+
kind,
|
|
169
|
+
lifecycle: item.lifecycle,
|
|
170
|
+
title: item.title,
|
|
171
|
+
...(item.status === undefined ? {} : { status: item.status })
|
|
172
|
+
};
|
|
173
|
+
if (kind === "command") {
|
|
174
|
+
const command = commandByItem.get(item.id);
|
|
175
|
+
if (command) {
|
|
176
|
+
return {
|
|
177
|
+
...base,
|
|
178
|
+
command: {
|
|
179
|
+
...(command.command === undefined ? {} : { text: command.command }),
|
|
180
|
+
...(command.cwd === undefined ? {} : { cwd: command.cwd }),
|
|
181
|
+
...(command.exitCode === undefined ? {} : { exitCode: command.exitCode }),
|
|
182
|
+
...(command.outputTail === undefined ? {} : { outputTail: command.outputTail })
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (kind === "tool_call") {
|
|
188
|
+
const tool = toolByItem.get(item.id);
|
|
189
|
+
if (tool) {
|
|
190
|
+
return {
|
|
191
|
+
...base,
|
|
192
|
+
tool: {
|
|
193
|
+
...(tool.server === undefined ? {} : { server: tool.server }),
|
|
194
|
+
...(tool.tool === undefined ? {} : { name: tool.tool })
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (kind === "message") {
|
|
200
|
+
const message = messageByItem.get(item.id);
|
|
201
|
+
if (message) {
|
|
202
|
+
return { ...base, text: message.text };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (kind === "reasoning") {
|
|
206
|
+
const reasoning = reasoningByItem.get(item.id);
|
|
207
|
+
if (reasoning) {
|
|
208
|
+
return { ...base, text: reasoning.text };
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (kind === "file_change") {
|
|
212
|
+
const change = fileChangeByItem.get(item.id);
|
|
213
|
+
if (change?.outputTail !== undefined) {
|
|
214
|
+
return { ...base, text: change.outputTail };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return base;
|
|
218
|
+
});
|
|
219
|
+
for (const approval of trace.approvals) {
|
|
220
|
+
items.push({
|
|
221
|
+
id: `approval-${String(approval.id)}`,
|
|
222
|
+
kind: "approval",
|
|
223
|
+
lifecycle: "completed",
|
|
224
|
+
status: approval.decision,
|
|
225
|
+
title: `${approval.method} (${approval.decision})`,
|
|
226
|
+
...(approval.reason ? { text: approval.reason } : {})
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
trace.plans.forEach((plan, index) => {
|
|
230
|
+
items.push({
|
|
231
|
+
id: `plan-${index + 1}`,
|
|
232
|
+
kind: "plan",
|
|
233
|
+
lifecycle: "completed",
|
|
234
|
+
title: plan.explanation ?? "Plan update",
|
|
235
|
+
...(plan.steps.length > 0 ? { text: plan.steps.join("\n") } : {})
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
[...trace.warnings, ...trace.errors].forEach((notice, index) => {
|
|
239
|
+
items.push({
|
|
240
|
+
id: `notice-${index + 1}`,
|
|
241
|
+
kind: "notice",
|
|
242
|
+
lifecycle: "completed",
|
|
243
|
+
title: notice.method,
|
|
244
|
+
...(notice.message ? { text: notice.message } : {})
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
return items;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Map a Codex app-server run result into the provider-neutral ActorTrace. Pure
|
|
251
|
+
* and side-effect-free. The persona reference is supplied by the harness; until
|
|
252
|
+
* personas are load-bearing it is a minimal stub ({ id, traitsApplied: [],
|
|
253
|
+
* promptDigest }).
|
|
254
|
+
*/
|
|
255
|
+
export function codexResultToActorTrace(result, persona) {
|
|
256
|
+
const trace = result.trace;
|
|
257
|
+
const tokenUsage = pickTokenUsage(trace.tokenUsage);
|
|
258
|
+
return {
|
|
259
|
+
schema: ACTOR_TRACE_SCHEMA,
|
|
260
|
+
provider: "codex-app-server",
|
|
261
|
+
...(trace.server.codexCliVersion === undefined ? {} : { providerVersion: trace.server.codexCliVersion }),
|
|
262
|
+
protocol: "json-rpc",
|
|
263
|
+
lane: "code",
|
|
264
|
+
persona,
|
|
265
|
+
redaction: { status: "passed", screenshots: "n/a", notes: trace.redaction.notes },
|
|
266
|
+
startedAt: trace.startedAt,
|
|
267
|
+
completedAt: trace.completedAt,
|
|
268
|
+
durationMs: trace.durationMs,
|
|
269
|
+
status: trace.status,
|
|
270
|
+
completionReason: codexStatusToCompletionReason(trace.status),
|
|
271
|
+
// result.reason is the raw reason; the codex trace redacts its own reason, so
|
|
272
|
+
// redact here too to keep the actor projection consistent (defense in depth).
|
|
273
|
+
reason: redactText(result.reason),
|
|
274
|
+
ids: {
|
|
275
|
+
...(result.sessionId === undefined ? {} : { sessionId: result.sessionId }),
|
|
276
|
+
...(result.threadId === undefined ? {} : { threadId: result.threadId }),
|
|
277
|
+
...(result.turnId === undefined ? {} : { turnId: result.turnId }),
|
|
278
|
+
...(result.model === undefined ? {} : { model: result.model })
|
|
279
|
+
},
|
|
280
|
+
counts: { ...trace.counts },
|
|
281
|
+
items: codexTraceToActorItems(trace),
|
|
282
|
+
...(tokenUsage === undefined ? {} : { tokenUsage }),
|
|
283
|
+
capabilities: CODEX_APP_SERVER_CAPABILITIES
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=actor-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor-contract.js","sourceRoot":"","sources":["../src/actor-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,M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EAAE,GAAG,KAAK,CAAC,MAAM,EAAE;QAC3B,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC;QACpC,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;QACnD,YAAY,EAAE,6BAA6B;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type CodexAppServerRunOptions, type CodexAppServerRunResult } from "./codex-app-server.js";
|
|
2
|
+
import { type ActorCapabilities, type ActorPersonaRef, type ActorTrace } from "./actor-contract.js";
|
|
3
|
+
import { type TerminalAgentSessionOptions, type TerminalAgentSessionResult } from "./terminal-agent-actor.js";
|
|
4
|
+
import { type PiSessionResult } from "./pi-agent-core.js";
|
|
5
|
+
import { type ClaudeAgentSessionOptions, type ClaudeAgentSessionResult, type ClaudeSessionResult } from "./claude-agent-sdk.js";
|
|
6
|
+
import { type CuaActorSessionOptions } from "./computer-use-actor.js";
|
|
7
|
+
import type { CuaLoopResult } from "./computer-use.js";
|
|
8
|
+
import { type ScriptedBrowserSessionOptions, type ScriptedBrowserSessionResult } from "./scripted-browser-actor.js";
|
|
9
|
+
export type ActorId = "codex-app-server" | "pi-agent-core" | "claude-agent-sdk" | "openai-computer-use" | "scripted-browser" | "codex-exec";
|
|
10
|
+
interface ActorDescriptorBase {
|
|
11
|
+
id: ActorId;
|
|
12
|
+
label: string;
|
|
13
|
+
capabilities: ActorCapabilities;
|
|
14
|
+
}
|
|
15
|
+
export interface CodexActorDescriptor extends ActorDescriptorBase {
|
|
16
|
+
id: "codex-app-server";
|
|
17
|
+
runSession(options: CodexAppServerRunOptions): Promise<CodexAppServerRunResult>;
|
|
18
|
+
toActorTrace(result: CodexAppServerRunResult, persona: ActorPersonaRef): ActorTrace;
|
|
19
|
+
}
|
|
20
|
+
export interface PiActorDescriptor extends ActorDescriptorBase {
|
|
21
|
+
id: "pi-agent-core";
|
|
22
|
+
toActorTrace(session: PiSessionResult, persona: ActorPersonaRef): ActorTrace;
|
|
23
|
+
}
|
|
24
|
+
export interface ClaudeActorDescriptor extends ActorDescriptorBase {
|
|
25
|
+
id: "claude-agent-sdk";
|
|
26
|
+
runSession(options: ClaudeAgentSessionOptions): Promise<ClaudeAgentSessionResult>;
|
|
27
|
+
toActorTrace(session: ClaudeSessionResult, persona: ActorPersonaRef): ActorTrace;
|
|
28
|
+
}
|
|
29
|
+
export interface CuaActorDescriptor extends ActorDescriptorBase {
|
|
30
|
+
id: "openai-computer-use";
|
|
31
|
+
runSession(options: CuaActorSessionOptions): Promise<CuaLoopResult>;
|
|
32
|
+
}
|
|
33
|
+
export interface ScriptedBrowserActorDescriptor extends ActorDescriptorBase {
|
|
34
|
+
id: "scripted-browser";
|
|
35
|
+
runSession(options: ScriptedBrowserSessionOptions): Promise<ScriptedBrowserSessionResult>;
|
|
36
|
+
}
|
|
37
|
+
export interface TerminalActorDescriptor extends ActorDescriptorBase {
|
|
38
|
+
id: "codex-exec";
|
|
39
|
+
runSession(options: TerminalAgentSessionOptions): Promise<TerminalAgentSessionResult>;
|
|
40
|
+
}
|
|
41
|
+
export type ActorDescriptor = CodexActorDescriptor | PiActorDescriptor | ClaudeActorDescriptor | CuaActorDescriptor | ScriptedBrowserActorDescriptor | TerminalActorDescriptor;
|
|
42
|
+
/**
|
|
43
|
+
* REGISTRY CONTRACT: an actor whose capabilities include the "computer-use" lane is a
|
|
44
|
+
* CuaActorDescriptor — its runSession takes CuaActorSessionOptions and returns a CuaLoopResult.
|
|
45
|
+
* Any future computer-use provider (e.g. stagehand-cua) must keep that session signature; this
|
|
46
|
+
* guard is what lets the lab dispatch on capabilities rather than on hardcoded actor ids.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isCuaActorDescriptor(descriptor: ActorDescriptor): descriptor is CuaActorDescriptor;
|
|
49
|
+
/**
|
|
50
|
+
* REGISTRY CONTRACT (mirror of isCuaActorDescriptor): an actor whose capabilities include the
|
|
51
|
+
* "scripted-browser" lane IS a ScriptedBrowserActorDescriptor — runSession takes
|
|
52
|
+
* ScriptedBrowserSessionOptions and returns ScriptedBrowserSessionResult (trace fully formed,
|
|
53
|
+
* like the CUA shape — no separate toActorTrace). Any future scripted driver (e.g. a HAR
|
|
54
|
+
* replayer) must keep this signature; it is what lets the lab dispatch on capabilities, not ids.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isScriptedBrowserActorDescriptor(descriptor: ActorDescriptor): descriptor is ScriptedBrowserActorDescriptor;
|
|
57
|
+
/**
|
|
58
|
+
* REGISTRY CONTRACT (mirror of isCuaActorDescriptor / isScriptedBrowserActorDescriptor): an actor
|
|
59
|
+
* whose capabilities include the "terminal" lane IS a TerminalActorDescriptor — runSession takes
|
|
60
|
+
* TerminalAgentSessionOptions and returns TerminalAgentSessionResult (trace fully formed). This is
|
|
61
|
+
* the guard the terminal-product lab dispatches on (capabilities, not ids). Any future terminal
|
|
62
|
+
* agent (a non-Codex coding agent) must keep this signature AND declare keyPlacement honestly.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isTerminalActorDescriptor(descriptor: ActorDescriptor): descriptor is TerminalActorDescriptor;
|
|
65
|
+
export declare const actorRegistry: Record<ActorId, ActorDescriptor>;
|
|
66
|
+
export declare function getActor(id: "codex-app-server"): CodexActorDescriptor;
|
|
67
|
+
export declare function getActor(id: "pi-agent-core"): PiActorDescriptor;
|
|
68
|
+
export declare function getActor(id: "claude-agent-sdk"): ClaudeActorDescriptor;
|
|
69
|
+
export declare function getActor(id: "openai-computer-use"): CuaActorDescriptor;
|
|
70
|
+
export declare function getActor(id: "scripted-browser"): ScriptedBrowserActorDescriptor;
|
|
71
|
+
export declare function getActor(id: "codex-exec"): TerminalActorDescriptor;
|
|
72
|
+
export declare function getActor(id: ActorId): ActorDescriptor;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { runCodexAppServerSession } from "./codex-app-server.js";
|
|
2
|
+
import { CLAUDE_AGENT_SDK_CAPABILITIES, CODEX_APP_SERVER_CAPABILITIES, PI_AGENT_CORE_CAPABILITIES, SCRIPTED_BROWSER_CAPABILITIES, TERMINAL_AGENT_CAPABILITIES, codexResultToActorTrace } from "./actor-contract.js";
|
|
3
|
+
import { runTerminalAgentSession } from "./terminal-agent-actor.js";
|
|
4
|
+
import { piSessionToActorTrace } from "./pi-agent-core.js";
|
|
5
|
+
import { claudeSessionToActorTrace, runClaudeAgentSession } from "./claude-agent-sdk.js";
|
|
6
|
+
import { runCuaActorSession } from "./computer-use-actor.js";
|
|
7
|
+
import { OPENAI_RESPONSES_CU_CAPABILITIES } from "./openai-responses-cu.js";
|
|
8
|
+
import { runScriptedBrowserSession } from "./scripted-browser-actor.js";
|
|
9
|
+
/**
|
|
10
|
+
* REGISTRY CONTRACT: an actor whose capabilities include the "computer-use" lane is a
|
|
11
|
+
* CuaActorDescriptor — its runSession takes CuaActorSessionOptions and returns a CuaLoopResult.
|
|
12
|
+
* Any future computer-use provider (e.g. stagehand-cua) must keep that session signature; this
|
|
13
|
+
* guard is what lets the lab dispatch on capabilities rather than on hardcoded actor ids.
|
|
14
|
+
*/
|
|
15
|
+
export function isCuaActorDescriptor(descriptor) {
|
|
16
|
+
return descriptor.capabilities.lanes.includes("computer-use");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* REGISTRY CONTRACT (mirror of isCuaActorDescriptor): an actor whose capabilities include the
|
|
20
|
+
* "scripted-browser" lane IS a ScriptedBrowserActorDescriptor — runSession takes
|
|
21
|
+
* ScriptedBrowserSessionOptions and returns ScriptedBrowserSessionResult (trace fully formed,
|
|
22
|
+
* like the CUA shape — no separate toActorTrace). Any future scripted driver (e.g. a HAR
|
|
23
|
+
* replayer) must keep this signature; it is what lets the lab dispatch on capabilities, not ids.
|
|
24
|
+
*/
|
|
25
|
+
export function isScriptedBrowserActorDescriptor(descriptor) {
|
|
26
|
+
return descriptor.capabilities.lanes.includes("scripted-browser");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* REGISTRY CONTRACT (mirror of isCuaActorDescriptor / isScriptedBrowserActorDescriptor): an actor
|
|
30
|
+
* whose capabilities include the "terminal" lane IS a TerminalActorDescriptor — runSession takes
|
|
31
|
+
* TerminalAgentSessionOptions and returns TerminalAgentSessionResult (trace fully formed). This is
|
|
32
|
+
* the guard the terminal-product lab dispatches on (capabilities, not ids). Any future terminal
|
|
33
|
+
* agent (a non-Codex coding agent) must keep this signature AND declare keyPlacement honestly.
|
|
34
|
+
*/
|
|
35
|
+
export function isTerminalActorDescriptor(descriptor) {
|
|
36
|
+
return descriptor.capabilities.lanes.includes("terminal");
|
|
37
|
+
}
|
|
38
|
+
export const actorRegistry = {
|
|
39
|
+
"codex-app-server": {
|
|
40
|
+
id: "codex-app-server",
|
|
41
|
+
label: "Codex App-Server",
|
|
42
|
+
capabilities: CODEX_APP_SERVER_CAPABILITIES,
|
|
43
|
+
runSession: runCodexAppServerSession,
|
|
44
|
+
toActorTrace: codexResultToActorTrace
|
|
45
|
+
},
|
|
46
|
+
"pi-agent-core": {
|
|
47
|
+
id: "pi-agent-core",
|
|
48
|
+
label: "pi Agent Core",
|
|
49
|
+
capabilities: PI_AGENT_CORE_CAPABILITIES,
|
|
50
|
+
toActorTrace: piSessionToActorTrace
|
|
51
|
+
},
|
|
52
|
+
"claude-agent-sdk": {
|
|
53
|
+
id: "claude-agent-sdk",
|
|
54
|
+
label: "Claude Agent SDK",
|
|
55
|
+
capabilities: CLAUDE_AGENT_SDK_CAPABILITIES,
|
|
56
|
+
runSession: runClaudeAgentSession,
|
|
57
|
+
toActorTrace: claudeSessionToActorTrace
|
|
58
|
+
},
|
|
59
|
+
// The ActorId names the actor slot (keeps the lane open for a future stagehand-cua provider);
|
|
60
|
+
// the trace's `provider` string stays "openai-responses-cu" (the concrete model adapter).
|
|
61
|
+
"openai-computer-use": {
|
|
62
|
+
id: "openai-computer-use",
|
|
63
|
+
label: "OpenAI Computer Use",
|
|
64
|
+
capabilities: OPENAI_RESPONSES_CU_CAPABILITIES,
|
|
65
|
+
runSession: runCuaActorSession
|
|
66
|
+
},
|
|
67
|
+
// Same naming convention: the ActorId names the slot; the trace's `provider` stays the
|
|
68
|
+
// concrete driver name "browser-persona" (matching the native
|
|
69
|
+
// humanish.browser-persona-trace.v1 evidence it already emits).
|
|
70
|
+
"scripted-browser": {
|
|
71
|
+
id: "scripted-browser",
|
|
72
|
+
label: "Scripted Browser (deterministic Playwright steps)",
|
|
73
|
+
capabilities: SCRIPTED_BROWSER_CAPABILITIES,
|
|
74
|
+
runSession: runScriptedBrowserSession
|
|
75
|
+
},
|
|
76
|
+
// The ActorId names the dispatch slot #154 asks for; the trace's `provider` stays the concrete
|
|
77
|
+
// agent name ("codex") in SLICE 2. keyPlacement "in-sandbox-command-scoped" rides on the
|
|
78
|
+
// capabilities const — the registry-declared placement the engine enforces in SLICE 2.
|
|
79
|
+
"codex-exec": {
|
|
80
|
+
id: "codex-exec",
|
|
81
|
+
label: "Codex Exec (autonomous terminal agent, in-sandbox)",
|
|
82
|
+
capabilities: TERMINAL_AGENT_CAPABILITIES,
|
|
83
|
+
runSession: runTerminalAgentSession
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export function getActor(id) {
|
|
87
|
+
const actor = actorRegistry[id];
|
|
88
|
+
if (!actor) {
|
|
89
|
+
throw new Error(`Unknown actor: ${String(id)}`);
|
|
90
|
+
}
|
|
91
|
+
return actor;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=actor-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor-registry.js","sourceRoot":"","sources":["../src/actor-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAGzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EAIxB,MAAM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,EAAE,qBAAqB;QACjC,YAAY,EAAE,yBAAyB;KACxC;IACD,8FAA8F;IAC9F,0FAA0F;IAC1F,qBAAqB,EAAE;QACrB,EAAE,EAAE,qBAAqB;QACzB,KAAK,EAAE,qBAAqB;QAC5B,YAAY,EAAE,gCAAgC;QAC9C,UAAU,EAAE,kBAAkB;KAC/B;IACD,uFAAuF;IACvF,8DAA8D;IAC9D,gEAAgE;IAChE,kBAAkB,EAAE;QAClB,EAAE,EAAE,kBAAkB;QACtB,KAAK,EAAE,mDAAmD;QAC1D,YAAY,EAAE,6BAA6B;QAC3C,UAAU,EAAE,yBAAyB;KACtC;IACD,+FAA+F;IAC/F,yFAAyF;IACzF,uFAAuF;IACvF,YAAY,EAAE;QACZ,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,oDAAoD;QAC3D,YAAY,EAAE,2BAA2B;QACzC,UAAU,EAAE,uBAAuB;KACpC;CACF,CAAC;AAWF,MAAM,UAAU,QAAQ,CAAC,EAAW;IAClC,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RunAdapterArtifact, RunAdapterScore, RunBundle, RunFeedbackCandidate } from "./run.js";
|
|
2
|
+
export type BrowserAdapterBackend = "cua" | "shared-world" | "concurrent-shared-world";
|
|
3
|
+
/**
|
|
4
|
+
* Product-agnostic scoring context for browser/computer-use lanes. Product-specific
|
|
5
|
+
* evidence/rubrics stay in the adopter's repo; core provides the assembled bundle
|
|
6
|
+
* plus stable run identifiers and never learns product nouns.
|
|
7
|
+
*/
|
|
8
|
+
export interface BrowserLabScoringContext {
|
|
9
|
+
bundle: RunBundle;
|
|
10
|
+
/**
|
|
11
|
+
* Absolute path to the ignored run directory. Adapter hooks may write their
|
|
12
|
+
* own product/state proof files here, then return relative references through
|
|
13
|
+
* `deriveArtifacts`. This path is runtime-only and must never be persisted.
|
|
14
|
+
*/
|
|
15
|
+
runDir: string;
|
|
16
|
+
labId: string;
|
|
17
|
+
runId: string;
|
|
18
|
+
actor: string;
|
|
19
|
+
backend: BrowserAdapterBackend;
|
|
20
|
+
dryRun: boolean;
|
|
21
|
+
laneCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface BrowserLabAdapterHooks {
|
|
24
|
+
/**
|
|
25
|
+
* Browser-route extension seam (#165): a thin adapter may score the assembled
|
|
26
|
+
* browser/shared-world evidence without forking core. The score is stored as
|
|
27
|
+
* namespaced `bundle.adapterScore`; product-specific component detail belongs
|
|
28
|
+
* in `data`, not in core enums or review text.
|
|
29
|
+
*/
|
|
30
|
+
score?: (ctx: BrowserLabScoringContext) => RunAdapterScore | Promise<RunAdapterScore>;
|
|
31
|
+
/**
|
|
32
|
+
* Companion seam for public-safe, adapter-namespaced feedback candidates.
|
|
33
|
+
* Malformed candidates are dropped before bundle persistence so core remains
|
|
34
|
+
* verifiable even when an adapter misbehaves.
|
|
35
|
+
*/
|
|
36
|
+
deriveFeedback?: (ctx: BrowserLabScoringContext) => RunFeedbackCandidate[] | Promise<RunFeedbackCandidate[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Optional product/state proof artifact references. The adapter writes files
|
|
39
|
+
* under `ctx.runDir` and returns local relative paths. Core stores only the
|
|
40
|
+
* namespaced references and `verify` fails closed if referenced files are
|
|
41
|
+
* missing or nonlocal.
|
|
42
|
+
*/
|
|
43
|
+
deriveArtifacts?: (ctx: BrowserLabScoringContext) => RunAdapterArtifact[] | Promise<RunAdapterArtifact[]>;
|
|
44
|
+
}
|
|
45
|
+
export declare function applyBrowserAdapterHooks(args: {
|
|
46
|
+
hooks: BrowserLabAdapterHooks | undefined;
|
|
47
|
+
context: BrowserLabScoringContext;
|
|
48
|
+
bundle: RunBundle;
|
|
49
|
+
sanitize: (text: string) => string;
|
|
50
|
+
warnings: string[];
|
|
51
|
+
hookLabel: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
export declare function adapterScoreFailureMessage(bundle: RunBundle): string | undefined;
|
|
54
|
+
export declare function applyAdapterScoreFailureToReview(bundle: RunBundle): string | undefined;
|