humanish 0.79.0 → 0.81.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/README.md +11 -2
- package/dist/actor-contract.d.ts +16 -0
- package/dist/actor-contract.js.map +1 -1
- package/dist/chrome-cdp-probe.js +13 -0
- package/dist/chrome-cdp-probe.js.map +1 -1
- package/dist/computer-use.d.ts +7 -1
- package/dist/computer-use.js +156 -13
- package/dist/computer-use.js.map +1 -1
- package/dist/concurrent-shared-world-lab.js +1 -0
- package/dist/concurrent-shared-world-lab.js.map +1 -1
- package/dist/cua-actor-lab.d.ts +7 -6
- package/dist/cua-actor-lab.js +95 -21
- package/dist/cua-actor-lab.js.map +1 -1
- package/dist/e2b-desktop-launch.d.ts +28 -1
- package/dist/e2b-desktop-launch.js +88 -1
- package/dist/e2b-desktop-launch.js.map +1 -1
- package/dist/e2b-desktop-screenshot-cleanup.d.ts +15 -0
- package/dist/e2b-desktop-screenshot-cleanup.js +67 -0
- package/dist/e2b-desktop-screenshot-cleanup.js.map +1 -0
- package/dist/e2b-terminal-lab.d.ts +3 -2
- package/dist/e2b-terminal-lab.js +176 -85
- package/dist/e2b-terminal-lab.js.map +1 -1
- package/dist/first-run-path.js +2 -2
- package/dist/first-run-path.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lab-config.d.ts +11 -14
- package/dist/lab-config.js +2 -2
- package/dist/lab-config.js.map +1 -1
- package/dist/openai-responses-cu.js +76 -49
- package/dist/openai-responses-cu.js.map +1 -1
- package/dist/program.js +16 -7
- package/dist/program.js.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/shared-world-lab.d.ts +3 -1
- package/dist/shared-world-lab.js +16 -1
- package/dist/shared-world-lab.js.map +1 -1
- package/dist/terminal-node-bootstrap.d.ts +4 -0
- package/dist/terminal-node-bootstrap.js +58 -0
- package/dist/terminal-node-bootstrap.js.map +1 -0
- package/dist/terminal-runtime-auth.d.ts +13 -0
- package/dist/terminal-runtime-auth.js +24 -0
- package/dist/terminal-runtime-auth.js.map +1 -0
- package/docs/architecture/actor-contract.md +22 -0
- package/docs/architecture/terminal-product-lane.md +108 -7
- package/docs/contracts/feedback.md +14 -0
- package/docs/contracts/schemas.md +1 -1
- package/docs/goals/current.md +57 -13
- package/docs/ramp/README.md +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -54,13 +54,20 @@ npx humanish run try-live # a REAL study on a hosted desktop, capped at $2
|
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
**What it finds, measured (2026-09-01 to 09-04, receipts in `bench/` and `docs/goals/`):** 58 of
|
|
57
|
-
60 planted defects over four benchmark runs on an app we wrote, none invented in 15 clean runs
|
|
57
|
+
60 planted defects over four benchmark runs on an app we wrote, none invented in 15 clean runs, and
|
|
58
|
+
14 of 15 with a second brain (the operator's own Claude Code as the participant, 0 invented in 3 more); on
|
|
58
59
|
two apps we did not write, 16 of 18 distinct findings confirmed against the source and 0 invented,
|
|
59
60
|
across 14 participants; a drawDB modal reported by 5 of 5 keyboard-first participants (3 stopped
|
|
60
61
|
there) and never mentioned by 5 mouse-driving newcomers; a TodoMVC rename that blocked 6 of 6
|
|
61
62
|
keyboard-first participants and none of the others; and, on a phone-sized desktop, a drawDB
|
|
62
63
|
relationship drag intercepted by a popover that both phone participants hit (one stopped) and no
|
|
63
|
-
desktop participant reported
|
|
64
|
+
desktop participant reported; in the then-shipped mobile-emulation input path, 4 of 4 TodoMVC
|
|
65
|
+
phone participants could not rename while 4 of 4 desktop newcomers finished, and Excalidraw read
|
|
66
|
+
12 of 12. **Correction, 2026-09-05:** two conformance probes found the SDK double click reset click
|
|
67
|
+
counts while direct touch opened the original TodoMVC editor in both. The historical mobile
|
|
68
|
+
failures describe Humanish's input path, not established touch-device app behavior
|
|
69
|
+
([input-fidelity receipt](docs/goals/computer-use-actor/receipts/mobile-input-conformance-2026-09-05.md)).
|
|
70
|
+
Each file states its own caveats.
|
|
64
71
|
|
|
65
72
|
`try-live` studies a real public app so that your first live run works without
|
|
66
73
|
configuring anything; point its `subject` at your own app once you have seen it
|
|
@@ -734,6 +741,8 @@ pnpm humanish:lab:list
|
|
|
734
741
|
|
|
735
742
|
## Docs
|
|
736
743
|
|
|
744
|
+
[Humanish docs](https://humanish.dev/docs) — runnable quickstart, your own app, results, budgets, and the generated [CLI reference](https://humanish.dev/docs/cli).
|
|
745
|
+
|
|
737
746
|
Start with the current safety and capability state. Dated design documents may
|
|
738
747
|
preserve historical mechanisms and carry explicit amendments near the top.
|
|
739
748
|
|
package/dist/actor-contract.d.ts
CHANGED
|
@@ -121,6 +121,11 @@ export interface ActorTokenUsage {
|
|
|
121
121
|
total?: number;
|
|
122
122
|
costUsd?: number;
|
|
123
123
|
}
|
|
124
|
+
/** The participant's account, not an independently confirmed product diagnosis. */
|
|
125
|
+
export interface ParticipantClosingReport {
|
|
126
|
+
summary: string;
|
|
127
|
+
frictionReports: string[];
|
|
128
|
+
}
|
|
124
129
|
export interface ActorTrace {
|
|
125
130
|
schema: typeof ACTOR_TRACE_SCHEMA;
|
|
126
131
|
provider: string;
|
|
@@ -186,6 +191,17 @@ export interface ActorTrace {
|
|
|
186
191
|
* (#453, #549, #565) each fixed a false refusal and each left the next shape unhandled.
|
|
187
192
|
*/
|
|
188
193
|
declaredOutcome?: ParticipantDeclaredOutcome;
|
|
194
|
+
/** Closing report after a harness-owned stop. Does not change task outcomes or permit actions. */
|
|
195
|
+
debrief?: {
|
|
196
|
+
trigger: "stop_when" | "dwell";
|
|
197
|
+
status: "completed" | "skipped" | "failed";
|
|
198
|
+
reason: string;
|
|
199
|
+
/** Absent if no request was made; false means that request's cost is unreported. */
|
|
200
|
+
usageReported?: boolean;
|
|
201
|
+
report?: ParticipantClosingReport;
|
|
202
|
+
/** Links the readable projection so it is not heuristically classified a second time. */
|
|
203
|
+
messageId?: string;
|
|
204
|
+
};
|
|
189
205
|
items: ActorTraceItem[];
|
|
190
206
|
tokenUsage?: ActorTokenUsage;
|
|
191
207
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor-contract.js","sourceRoot":"","sources":["../src/actor-contract.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,oEAAoE;AACpE,0EAA0E;AAC1E,oFAAoF;AACpF,EAAE;AACF,iFAAiF;AACjF,8EAA8E;AAC9E,gFAAgF;AAChF,uBAAuB;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AA6B5D;;iCAEiC;AACjC,MAAM,CAAC,MAAM,4BAA4B,GAA2B,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"actor-contract.js","sourceRoot":"","sources":["../src/actor-contract.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,oEAAoE;AACpE,0EAA0E;AAC1E,oFAAoF;AACpF,EAAE;AACF,iFAAiF;AACjF,8EAA8E;AAC9E,gFAAgF;AAChF,uBAAuB;AAEvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AA6B5D;;iCAEiC;AACjC,MAAM,CAAC,MAAM,4BAA4B,GAA2B,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AAiNhG,MAAM,CAAC,MAAM,6BAA6B,GAAsB;IAC9D,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE,IAAI;IACrB,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,mBAAmB,EAAE,KAAK;IAC1B,QAAQ,EAAE,KAAK;IACf,qBAAqB,EAAE,IAAI;IAC3B,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,MAAM;CAChB,CAAC;AAEF,kFAAkF;AAClF,gFAAgF;AAChF,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE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AE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;QACjC,GAAG,EAAE;YACH,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;YAC1E,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;YACvE,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;YACjE,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;SAC/D;QACD,MAAM,EAAE,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"}
|
package/dist/chrome-cdp-probe.js
CHANGED
|
@@ -383,6 +383,19 @@ def main():
|
|
|
383
383
|
print(json.dumps({"unavailable": "CDP endpoint 127.0.0.1:%d/json unreachable (%s)" % (port, type(error).__name__)}))
|
|
384
384
|
return
|
|
385
385
|
page = select_page(pages, args)
|
|
386
|
+
# A listing with targets but no http page is usually an instant: a reload in flight, a tab
|
|
387
|
+
# between about:blank and its navigation. Ask again for up to a second before calling it
|
|
388
|
+
# unavailable (#653): the lane's observer would otherwise lose one turn of url/text evidence,
|
|
389
|
+
# and a test on a loaded runner saw exactly this twice in one evening.
|
|
390
|
+
for _ in range(4):
|
|
391
|
+
if page is not None or not pages:
|
|
392
|
+
break
|
|
393
|
+
time.sleep(0.25)
|
|
394
|
+
try:
|
|
395
|
+
pages = list_pages(port)
|
|
396
|
+
except Exception:
|
|
397
|
+
break
|
|
398
|
+
page = select_page(pages, args)
|
|
386
399
|
if page is None:
|
|
387
400
|
print(json.dumps({"unavailable": "no http page among %d CDP targets on 127.0.0.1:%d" % (len(pages), port)}))
|
|
388
401
|
return
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome-cdp-probe.js","sourceRoot":"","sources":["../src/chrome-cdp-probe.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,EAAE;AACF,iGAAiG;AACjG,8FAA8F;AAC9F,8FAA8F;AAC9F,kGAAkG;AAClG,0FAA0F;AAC1F,kGAAkG;AAClG,gGAAgG;AAChG,mGAAmG;AACnG,oDAAoD;AACpD,EAAE;AACF,kGAAkG;AAClG,4FAA4F;AAC5F,EAAE;AACF,8EAA8E;AAC9E,kGAAkG;AAClG,gGAAgG;AAChG,iEAAiE;AA0EjE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"chrome-cdp-probe.js","sourceRoot":"","sources":["../src/chrome-cdp-probe.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,EAAE;AACF,iGAAiG;AACjG,8FAA8F;AAC9F,8FAA8F;AAC9F,kGAAkG;AAClG,0FAA0F;AAC1F,kGAAkG;AAClG,gGAAgG;AAChG,mGAAmG;AACnG,oDAAoD;AACpD,EAAE;AACF,kGAAkG;AAClG,4FAA4F;AAC5F,EAAE;AACF,8EAA8E;AAC9E,kGAAkG;AAClG,gGAAgG;AAChG,iEAAiE;AA0EjE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;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K,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/F,GAAG,CAAC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,GAAG,CAAC,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3G,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;QACzD,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC"}
|
package/dist/computer-use.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActorCapabilities, type ActorCompletionReason, type ActorPersonaRef, type ActorStatus, type ActorTokenUsage, type ActorTrace, type ActorTraceItem, type ParticipantDeclaredOutcome } from "./actor-contract.js";
|
|
1
|
+
import { type ActorCapabilities, type ActorCompletionReason, type ActorPersonaRef, type ActorStatus, type ActorTokenUsage, type ActorTrace, type ActorTraceItem, type ParticipantDeclaredOutcome, type ParticipantClosingReport } from "./actor-contract.js";
|
|
2
2
|
import type { RedactionHooks } from "./redaction.js";
|
|
3
3
|
import { type DwellWindow, type StopWhen } from "./stop-conditions.js";
|
|
4
4
|
import { type LabTask } from "./tasks.js";
|
|
@@ -140,6 +140,8 @@ export interface CuaTurn {
|
|
|
140
140
|
done: boolean;
|
|
141
141
|
/** The participant's own word for how it ended, when its reply format carries one (#570). */
|
|
142
142
|
outcome?: ParticipantDeclaredOutcome;
|
|
143
|
+
/** Present only for an accepted structured closing account. */
|
|
144
|
+
closingReport?: ParticipantClosingReport;
|
|
143
145
|
}
|
|
144
146
|
/** The model side of the loop. Self-describes its identity and capabilities. */
|
|
145
147
|
export interface CuaProvider {
|
|
@@ -168,6 +170,8 @@ export interface CuaProvider {
|
|
|
168
170
|
*/
|
|
169
171
|
readonly requiresFrame?: boolean;
|
|
170
172
|
nextTurn(req: CuaTurnRequest, signal: AbortSignal): Promise<CuaTurn>;
|
|
173
|
+
/** Optional read-only closing report. Implementations must disable tools and make no retries. */
|
|
174
|
+
debrief?: ((req: CuaTurnRequest, signal: AbortSignal) => Promise<CuaTurn>) | undefined;
|
|
171
175
|
}
|
|
172
176
|
/** The desktop side of the loop. */
|
|
173
177
|
export interface CuaExecutor {
|
|
@@ -326,6 +330,8 @@ export interface CuaLoopResult {
|
|
|
326
330
|
reason: string;
|
|
327
331
|
trace: ActorTrace;
|
|
328
332
|
}
|
|
333
|
+
/** Runtime validation is also required for third-party provider ports. */
|
|
334
|
+
export declare function validClosingReport(value: unknown): value is ParticipantClosingReport;
|
|
329
335
|
/**
|
|
330
336
|
* A public-safe fingerprint of ONE turn's actions, used only in memory to tell "trying the same
|
|
331
337
|
* thing again" from "trying something new" (#383).
|
package/dist/computer-use.js
CHANGED
|
@@ -3,6 +3,25 @@ import { classifyCuaAction, summarizeAffordanceUse } from "./affordance.js";
|
|
|
3
3
|
import { commandFailureInfo, isCommandExitError } from "./command-failure.js";
|
|
4
4
|
import { evaluateStopWhen } from "./stop-conditions.js";
|
|
5
5
|
import { TaskTracker } from "./tasks.js";
|
|
6
|
+
/** Runtime validation is also required for third-party provider ports. */
|
|
7
|
+
export function validClosingReport(value) {
|
|
8
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
9
|
+
return false;
|
|
10
|
+
const report = value;
|
|
11
|
+
return Object.keys(report).length === 2
|
|
12
|
+
&& typeof report.summary === "string" && report.summary.trim().length > 0 && report.summary.length <= 4_000
|
|
13
|
+
&& Array.isArray(report.frictionReports) && report.frictionReports.length <= 8
|
|
14
|
+
&& report.frictionReports.every((item) => typeof item === "string" && item.trim().length > 0 && item.length <= 2_000);
|
|
15
|
+
}
|
|
16
|
+
function validTokenCount(value) {
|
|
17
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
18
|
+
}
|
|
19
|
+
function completeTurnUsage(usage) {
|
|
20
|
+
return usage !== undefined && validTokenCount(usage.input) && validTokenCount(usage.output)
|
|
21
|
+
&& (usage.cachedInput === undefined || validTokenCount(usage.cachedInput))
|
|
22
|
+
&& (usage.cacheWriteInput === undefined || validTokenCount(usage.cacheWriteInput))
|
|
23
|
+
&& (usage.cachedInput ?? 0) + (usage.cacheWriteInput ?? 0) <= usage.input;
|
|
24
|
+
}
|
|
6
25
|
// Waiting is a legitimate strategy, not idleness. A persona told to sign up and verify by email
|
|
7
26
|
// polls its inbox — screenshot, wait, screenshot, wait — and at 6 steps that ended the session as
|
|
8
27
|
// `gave_up`/`failed` in well under a minute, before the mail could plausibly arrive. The concurrent
|
|
@@ -371,6 +390,7 @@ export async function runComputerUseLoop(options) {
|
|
|
371
390
|
});
|
|
372
391
|
let usageOutput = 0;
|
|
373
392
|
let sawUsage = false;
|
|
393
|
+
let incompleteInteractionUsage = false;
|
|
374
394
|
let lastResponseId;
|
|
375
395
|
let currentPhase = "initializing computer-use loop";
|
|
376
396
|
let lastActionTitle;
|
|
@@ -381,6 +401,27 @@ export async function runComputerUseLoop(options) {
|
|
|
381
401
|
const bump = (key) => {
|
|
382
402
|
counts[key] = (counts[key] ?? 0) + 1;
|
|
383
403
|
};
|
|
404
|
+
const recordUsage = (turn, interaction = true) => {
|
|
405
|
+
if (interaction && !completeTurnUsage(turn.usage))
|
|
406
|
+
incompleteInteractionUsage = true;
|
|
407
|
+
const raw = turn.usage;
|
|
408
|
+
if (raw === undefined)
|
|
409
|
+
return;
|
|
410
|
+
const usage = {
|
|
411
|
+
...(validTokenCount(raw.input) ? { input: raw.input } : {}),
|
|
412
|
+
...(validTokenCount(raw.output) ? { output: raw.output } : {}),
|
|
413
|
+
...(validTokenCount(raw.cachedInput) ? { cachedInput: raw.cachedInput } : {}),
|
|
414
|
+
...(validTokenCount(raw.cacheWriteInput) ? { cacheWriteInput: raw.cacheWriteInput } : {})
|
|
415
|
+
};
|
|
416
|
+
if (Object.keys(usage).length === 0)
|
|
417
|
+
return;
|
|
418
|
+
sawUsage = true;
|
|
419
|
+
usageInput += usage.input ?? 0;
|
|
420
|
+
usageCachedInput += usage.cachedInput ?? 0;
|
|
421
|
+
usageCacheWriteInput += usage.cacheWriteInput ?? 0;
|
|
422
|
+
usageOutput += usage.output ?? 0;
|
|
423
|
+
usageTurns.push(usage);
|
|
424
|
+
};
|
|
384
425
|
// Whether any observation this run surfaced structured appState (a non-vision/state executor).
|
|
385
426
|
// RUNTIME-ONLY signal: used solely to self-describe in redaction.notes that app state drove
|
|
386
427
|
// progress detection and was NOT written to the trace — the appState itself never persists.
|
|
@@ -456,6 +497,9 @@ export async function runComputerUseLoop(options) {
|
|
|
456
497
|
// Loop-local state. Declared here (before the try) so the initial observe + the per-turn
|
|
457
498
|
// frame guard can fail closed cleanly while these still scope across the loop.
|
|
458
499
|
let previousResponseId;
|
|
500
|
+
let closingObservation;
|
|
501
|
+
let closingTrigger;
|
|
502
|
+
let debrief;
|
|
459
503
|
let consecutiveIdle = 0;
|
|
460
504
|
// One canonical "no progress" signal: turns that did not change the UI state
|
|
461
505
|
// signature (idle or not). The nudge, the stop threshold, and the reason all
|
|
@@ -577,6 +621,8 @@ export async function runComputerUseLoop(options) {
|
|
|
577
621
|
if (initialDwell === "stop") {
|
|
578
622
|
completionReason = "goal_satisfied";
|
|
579
623
|
reason = `dwell window complete (${dwellHeldMs}ms held at the start)`;
|
|
624
|
+
closingObservation = observation;
|
|
625
|
+
closingTrigger = "dwell";
|
|
580
626
|
throw new CuaStopWhenStop();
|
|
581
627
|
}
|
|
582
628
|
}
|
|
@@ -584,6 +630,8 @@ export async function runComputerUseLoop(options) {
|
|
|
584
630
|
if (stopConditionMatch) {
|
|
585
631
|
completionReason = "goal_satisfied";
|
|
586
632
|
reason = stopWhenReason(stopConditionMatch);
|
|
633
|
+
closingObservation = observation;
|
|
634
|
+
closingTrigger = "stop_when";
|
|
587
635
|
record(stopWhenTraceItem(nextId("notice"), stopConditionMatch, redactNarration));
|
|
588
636
|
throw new CuaStopWhenStop();
|
|
589
637
|
}
|
|
@@ -660,19 +708,7 @@ export async function runComputerUseLoop(options) {
|
|
|
660
708
|
bump("turns");
|
|
661
709
|
previousResponseId = turn.responseId ?? previousResponseId;
|
|
662
710
|
lastResponseId = turn.responseId ?? lastResponseId;
|
|
663
|
-
|
|
664
|
-
sawUsage = true;
|
|
665
|
-
usageInput += turn.usage.input ?? 0;
|
|
666
|
-
usageCachedInput += turn.usage.cachedInput ?? 0;
|
|
667
|
-
usageCacheWriteInput += turn.usage.cacheWriteInput ?? 0;
|
|
668
|
-
usageOutput += turn.usage.output ?? 0;
|
|
669
|
-
usageTurns.push({
|
|
670
|
-
...(turn.usage.input === undefined ? {} : { input: turn.usage.input }),
|
|
671
|
-
...(turn.usage.cachedInput === undefined ? {} : { cachedInput: turn.usage.cachedInput }),
|
|
672
|
-
...(turn.usage.cacheWriteInput === undefined ? {} : { cacheWriteInput: turn.usage.cacheWriteInput }),
|
|
673
|
-
...(turn.usage.output === undefined ? {} : { output: turn.usage.output })
|
|
674
|
-
});
|
|
675
|
-
}
|
|
711
|
+
recordUsage(turn);
|
|
676
712
|
// RUNTIME-ONLY: hand the model's narration back so the concurrent host-first barrier can read
|
|
677
713
|
// the lobby code the host states after creating the lobby (CDP url-read is unreliable). Raw
|
|
678
714
|
// text stays in memory; only an extracted code is used (and only as a digest).
|
|
@@ -932,6 +968,8 @@ export async function runComputerUseLoop(options) {
|
|
|
932
968
|
if (dwellOutcome === "stop") {
|
|
933
969
|
completionReason = "goal_satisfied";
|
|
934
970
|
reason = `dwell window complete (${dwellHeldMs}ms held after turn ${turnNumber})`;
|
|
971
|
+
closingObservation = observation;
|
|
972
|
+
closingTrigger = "dwell";
|
|
935
973
|
break;
|
|
936
974
|
}
|
|
937
975
|
}
|
|
@@ -939,6 +977,8 @@ export async function runComputerUseLoop(options) {
|
|
|
939
977
|
if (stopConditionMatch) {
|
|
940
978
|
completionReason = "goal_satisfied";
|
|
941
979
|
reason = stopWhenReason(stopConditionMatch);
|
|
980
|
+
closingObservation = observation;
|
|
981
|
+
closingTrigger = "stop_when";
|
|
942
982
|
record(stopWhenTraceItem(nextId("notice"), stopConditionMatch, redactNarration));
|
|
943
983
|
break;
|
|
944
984
|
}
|
|
@@ -1069,6 +1109,108 @@ export async function runComputerUseLoop(options) {
|
|
|
1069
1109
|
});
|
|
1070
1110
|
}
|
|
1071
1111
|
}
|
|
1112
|
+
// Structured completion must stop interaction immediately, but the participant may not yet
|
|
1113
|
+
// have spoken. Request one read-only account using the already captured final observation.
|
|
1114
|
+
// No callbacks that coordinate live participants and no executor calls occur after this point.
|
|
1115
|
+
if (closingTrigger !== undefined && closingObservation !== undefined) {
|
|
1116
|
+
const note = (status, detail, usageReported) => {
|
|
1117
|
+
debrief = { trigger: closingTrigger, status, reason: redactNarration(detail),
|
|
1118
|
+
...(usageReported === undefined ? {} : { usageReported }) };
|
|
1119
|
+
record({ id: nextId("notice"), kind: "notice", lifecycle: "completed",
|
|
1120
|
+
status: status === "completed" ? "ok" : "warn", title: `participant debrief ${status}`,
|
|
1121
|
+
text: redactNarration(detail) });
|
|
1122
|
+
};
|
|
1123
|
+
let skip;
|
|
1124
|
+
if ((counts.turns ?? 0) === 0)
|
|
1125
|
+
skip = "the study stopped before any participant turn";
|
|
1126
|
+
else if (provider.debrief === undefined)
|
|
1127
|
+
skip = "this provider does not support read-only closing reports";
|
|
1128
|
+
else if (signal?.aborted)
|
|
1129
|
+
skip = "the study was cancelled";
|
|
1130
|
+
else if (remaining() <= 0)
|
|
1131
|
+
skip = "the session deadline was reached";
|
|
1132
|
+
else if (provider.requiresFrame && closingObservation.screenshot === undefined)
|
|
1133
|
+
skip = "the final observation has no required frame";
|
|
1134
|
+
if (skip === undefined && (maxUsd !== undefined || overRunBudget !== undefined) && incompleteInteractionUsage) {
|
|
1135
|
+
skip = "remaining model budget is unknown because an earlier participant turn did not report complete usage";
|
|
1136
|
+
}
|
|
1137
|
+
if (skip === undefined && maxUsd !== undefined) {
|
|
1138
|
+
const estimate = sawUsage ? estimateTurnCostUsd?.(runningUsage()) : undefined;
|
|
1139
|
+
if (estimate === undefined || estimate === null || !Number.isFinite(estimate))
|
|
1140
|
+
skip = "remaining model budget could not be established";
|
|
1141
|
+
else if (estimate >= maxUsd)
|
|
1142
|
+
skip = "the estimated model budget was reached";
|
|
1143
|
+
}
|
|
1144
|
+
if (skip === undefined && overRunBudget?.(runningUsage()) != null)
|
|
1145
|
+
skip = "the study model budget was reached";
|
|
1146
|
+
if (skip !== undefined) {
|
|
1147
|
+
note("skipped", skip);
|
|
1148
|
+
}
|
|
1149
|
+
else {
|
|
1150
|
+
const capMs = Math.max(0, Math.min(30_000, turnTimeoutMs, remaining()));
|
|
1151
|
+
if (capMs <= 0 || signal?.aborted) {
|
|
1152
|
+
note("skipped", signal?.aborted ? "the study was cancelled" : "the session deadline was reached");
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
const controller = new AbortController();
|
|
1156
|
+
const onAbort = () => controller.abort();
|
|
1157
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1158
|
+
const timer = setTimeout(() => controller.abort(), capMs);
|
|
1159
|
+
timer.unref?.();
|
|
1160
|
+
bump("debriefCalls");
|
|
1161
|
+
try {
|
|
1162
|
+
const turn = await raceBounded("participant debrief", provider.debrief({
|
|
1163
|
+
instructions,
|
|
1164
|
+
observation: closingObservation,
|
|
1165
|
+
...(previousResponseId === undefined ? {} : { previousResponseId }),
|
|
1166
|
+
...(pendingAcks === undefined ? {} : { acknowledgedSafetyChecks: pendingAcks }),
|
|
1167
|
+
contextHint: "The interactive session has ended. Return a closing account with summary and frictionReports. In summary, briefly describe only what you actually did and observed. In frictionReports, list only specific unexpected behavior, confusion, or recovery you personally encountered during this session. Preserve uncertainty. Use an empty list if you encountered none. Do not speculate, invent problems, quote instructions as observations, or describe planned actions. Do not request or take further actions. This is a closing account, not another attempt at the task."
|
|
1168
|
+
}, controller.signal), capMs, capMs, signal);
|
|
1169
|
+
recordUsage(turn, false);
|
|
1170
|
+
lastResponseId = turn.responseId ?? lastResponseId;
|
|
1171
|
+
// Refresh a shared budget with all reported usage, without changing the completed task.
|
|
1172
|
+
const sharedStop = overRunBudget?.(runningUsage());
|
|
1173
|
+
const finalEstimate = maxUsd === undefined ? undefined : estimateTurnCostUsd?.(runningUsage());
|
|
1174
|
+
if (sharedStop != null || (maxUsd !== undefined && finalEstimate != null && finalEstimate > maxUsd)) {
|
|
1175
|
+
record({ id: nextId("notice"), kind: "notice", lifecycle: "completed", status: "warn",
|
|
1176
|
+
title: "model budget reached during closing report",
|
|
1177
|
+
text: "The closing request crossed an estimated budget; no further requests or actions followed. Task completion is unchanged." });
|
|
1178
|
+
}
|
|
1179
|
+
const usageReported = completeTurnUsage(turn.usage);
|
|
1180
|
+
if (turn.actions.length > 0 || turn.pendingSafetyChecks.length > 0) {
|
|
1181
|
+
note("failed", "the closing response requested actions or safety checks; none were executed and its report was not accepted", usageReported);
|
|
1182
|
+
}
|
|
1183
|
+
else if (!validClosingReport(turn.closingReport)) {
|
|
1184
|
+
note("failed", "the closing response did not contain a valid structured participant report", usageReported);
|
|
1185
|
+
}
|
|
1186
|
+
else {
|
|
1187
|
+
const report = {
|
|
1188
|
+
summary: redactNarration(turn.closingReport.summary.trim()),
|
|
1189
|
+
frictionReports: [...new Set(turn.closingReport.frictionReports.map((text) => redactNarration(text.trim())))]
|
|
1190
|
+
};
|
|
1191
|
+
const messageId = nextId("message");
|
|
1192
|
+
record({ id: messageId, kind: "message", lifecycle: "completed",
|
|
1193
|
+
title: "participant closing report", text: [report.summary, ...report.frictionReports].join("\n\n") });
|
|
1194
|
+
bump("messages");
|
|
1195
|
+
note("completed", "one read-only report; no additional desktop actions; original stop and task outcomes preserved", usageReported);
|
|
1196
|
+
debrief = { ...debrief, report, messageId };
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
catch (error) {
|
|
1200
|
+
// A failed optional report cannot rewrite the already observed structured completion.
|
|
1201
|
+
const detail = signal?.aborted ? "cancelled" : controller.signal.aborted || error instanceof CuaDeadlineError || error instanceof CuaStallError
|
|
1202
|
+
? "closing report deadline reached" : error instanceof Error ? error.message : String(error);
|
|
1203
|
+
note("failed", `${detail}; closing request usage is unreported`, false);
|
|
1204
|
+
}
|
|
1205
|
+
finally {
|
|
1206
|
+
clearTimeout(timer);
|
|
1207
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1208
|
+
controller.abort();
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
onTrace?.(items.slice(), runningUsage());
|
|
1213
|
+
}
|
|
1072
1214
|
const completedAtMs = now();
|
|
1073
1215
|
const status = statusForCompletionReason(completionReason);
|
|
1074
1216
|
const ids = {};
|
|
@@ -1119,6 +1261,7 @@ export async function runComputerUseLoop(options) {
|
|
|
1119
1261
|
items,
|
|
1120
1262
|
...(affordanceObservations.length > 0 ? { affordanceUse: summarizeAffordanceUse(affordanceObservations) } : {}),
|
|
1121
1263
|
...(declaredOutcome === undefined ? {} : { declaredOutcome }),
|
|
1264
|
+
...(debrief === undefined ? {} : { debrief }),
|
|
1122
1265
|
// The funnel is present exactly when a protocol was declared — including a session that ended
|
|
1123
1266
|
// on turn 0, whose funnel honestly reads 0/N. No tasks declared means no funnel, not an empty one.
|
|
1124
1267
|
...(taskTracker === undefined ? {} : { taskFunnel: taskTracker.funnel() }),
|