humanish 0.80.0 → 0.82.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 +121 -615
- package/dist/actor-contract.d.ts +30 -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 +13 -3
- package/dist/computer-use.js +179 -15
- package/dist/computer-use.js.map +1 -1
- package/dist/cua-actor-lab.d.ts +20 -8
- package/dist/cua-actor-lab.js +154 -49
- package/dist/cua-actor-lab.js.map +1 -1
- package/dist/e2b-desktop-executor.d.ts +9 -1
- package/dist/e2b-desktop-executor.js +67 -4
- package/dist/e2b-desktop-executor.js.map +1 -1
- package/dist/e2b-desktop-launch.d.ts +36 -1
- package/dist/e2b-desktop-launch.js +88 -1
- package/dist/e2b-desktop-launch.js.map +1 -1
- package/dist/e2b-desktop-resources.d.ts +11 -0
- package/dist/e2b-desktop-resources.js +33 -0
- package/dist/e2b-desktop-resources.js.map +1 -0
- 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 +5 -2
- package/dist/e2b-terminal-lab.js +238 -86
- 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 +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lab-config.d.ts +15 -14
- package/dist/lab-config.js +11 -2
- package/dist/lab-config.js.map +1 -1
- package/dist/observer-data.d.ts +2 -0
- package/dist/observer-data.js +10 -1
- package/dist/observer-data.js.map +1 -1
- package/dist/openai-responses-cu.js +76 -49
- package/dist/openai-responses-cu.js.map +1 -1
- package/dist/pricing.d.ts +19 -1
- package/dist/pricing.js +43 -10
- package/dist/pricing.js.map +1 -1
- package/dist/program.js +17 -8
- package/dist/program.js.map +1 -1
- package/dist/redaction.js +9 -2
- package/dist/redaction.js.map +1 -1
- package/dist/run.d.ts +14 -2
- package/dist/run.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/dist/terminal-runtime.d.ts +16 -0
- package/dist/terminal-runtime.js +42 -0
- package/dist/terminal-runtime.js.map +1 -0
- package/dist/terminal-token-usage.d.ts +2 -1
- package/dist/terminal-token-usage.js +3 -2
- package/dist/terminal-token-usage.js.map +1 -1
- package/docs/architecture/actor-contract.md +22 -0
- package/docs/architecture/state-driven-executor.md +10 -1
- package/docs/architecture/terminal-product-lane.md +142 -6
- package/docs/contracts/feedback.md +14 -0
- package/docs/contracts/run-bundle.md +5 -1
- package/docs/contracts/schemas.md +17 -8
- package/docs/goals/current.md +61 -13
- package/docs/ramp/README.md +1 -1
- package/package.json +4 -2
package/dist/actor-contract.d.ts
CHANGED
|
@@ -121,10 +121,29 @@ 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
|
+
}
|
|
129
|
+
/** Runtime declarations and executable-version observations; not provider request attestation. */
|
|
130
|
+
export interface ActorRuntimeProvenance {
|
|
131
|
+
schema: "humanish.actor-runtime.v1";
|
|
132
|
+
package: string;
|
|
133
|
+
requestedVersion: string;
|
|
134
|
+
observedVersion?: string;
|
|
135
|
+
versionStatus: "unobserved" | "verified" | "failed";
|
|
136
|
+
requestedModel?: string;
|
|
137
|
+
modelStatus: "declared" | "runtime_default_unobserved";
|
|
138
|
+
requestedReasoningEffort?: string;
|
|
139
|
+
/** Codex turn.completed aggregates requests; it cannot establish per-request pricing tiers. */
|
|
140
|
+
usageGranularity: "runtime_turn";
|
|
141
|
+
}
|
|
124
142
|
export interface ActorTrace {
|
|
125
143
|
schema: typeof ACTOR_TRACE_SCHEMA;
|
|
126
144
|
provider: string;
|
|
127
145
|
providerVersion?: string;
|
|
146
|
+
runtime?: ActorRuntimeProvenance;
|
|
128
147
|
protocol: ActorProtocol;
|
|
129
148
|
lane: ActorLane;
|
|
130
149
|
persona: ActorPersonaRef;
|
|
@@ -186,6 +205,17 @@ export interface ActorTrace {
|
|
|
186
205
|
* (#453, #549, #565) each fixed a false refusal and each left the next shape unhandled.
|
|
187
206
|
*/
|
|
188
207
|
declaredOutcome?: ParticipantDeclaredOutcome;
|
|
208
|
+
/** Closing report after a harness-owned stop. Does not change task outcomes or permit actions. */
|
|
209
|
+
debrief?: {
|
|
210
|
+
trigger: "stop_when" | "dwell";
|
|
211
|
+
status: "completed" | "skipped" | "failed";
|
|
212
|
+
reason: string;
|
|
213
|
+
/** Absent if no request was made; false means that request's cost is unreported. */
|
|
214
|
+
usageReported?: boolean;
|
|
215
|
+
report?: ParticipantClosingReport;
|
|
216
|
+
/** Links the readable projection so it is not heuristically classified a second time. */
|
|
217
|
+
messageId?: string;
|
|
218
|
+
};
|
|
189
219
|
items: ActorTraceItem[];
|
|
190
220
|
tokenUsage?: ActorTokenUsage;
|
|
191
221
|
/**
|
|
@@ -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,MA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AQ,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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AC,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,13 +170,19 @@ 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 {
|
|
174
178
|
/** Capture the current desktop frame and its state signature. */
|
|
175
179
|
observe(): Promise<CuaObservation>;
|
|
176
|
-
/**
|
|
177
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Perform one action. The optional signal ends with this action's loop wait; honor it
|
|
182
|
+
* before dispatching after async preparation. Wrappers must forward it. Cancellation
|
|
183
|
+
* does not imply an already-dispatched desktop operation can be stopped.
|
|
184
|
+
*/
|
|
185
|
+
execute(action: CuaAction, signal?: AbortSignal): Promise<void>;
|
|
178
186
|
}
|
|
179
187
|
export interface CuaLoopOptions {
|
|
180
188
|
instructions: string;
|
|
@@ -326,6 +334,8 @@ export interface CuaLoopResult {
|
|
|
326
334
|
reason: string;
|
|
327
335
|
trace: ActorTrace;
|
|
328
336
|
}
|
|
337
|
+
/** Runtime validation is also required for third-party provider ports. */
|
|
338
|
+
export declare function validClosingReport(value: unknown): value is ParticipantClosingReport;
|
|
329
339
|
/**
|
|
330
340
|
* A public-safe fingerprint of ONE turn's actions, used only in memory to tell "trying the same
|
|
331
341
|
* 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).
|
|
@@ -823,13 +859,34 @@ export async function runComputerUseLoop(options) {
|
|
|
823
859
|
// Record the action as completed only AFTER execute() resolves: a failed
|
|
824
860
|
// action must not appear as a plainly-completed ui_action (#248). On
|
|
825
861
|
// failure the error notice below captures the failing action + phase.
|
|
862
|
+
const executeAction = async (idleBound) => {
|
|
863
|
+
const actionController = new AbortController();
|
|
864
|
+
const onAbort = () => actionController.abort();
|
|
865
|
+
if (signal?.aborted)
|
|
866
|
+
actionController.abort();
|
|
867
|
+
else
|
|
868
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
869
|
+
try {
|
|
870
|
+
const pending = executor.execute(action, actionController.signal);
|
|
871
|
+
if (idleBound === undefined)
|
|
872
|
+
await raceSettle(pending, remaining(), signal);
|
|
873
|
+
else
|
|
874
|
+
await raceBounded(`idle action ${actionTitle}`, pending, remaining(), idleBound, signal);
|
|
875
|
+
}
|
|
876
|
+
finally {
|
|
877
|
+
signal?.removeEventListener("abort", onAbort);
|
|
878
|
+
// A deadline also closes async executor preparation, so a late pointer read
|
|
879
|
+
// cannot actuate after the loop stopped waiting for this action.
|
|
880
|
+
actionController.abort();
|
|
881
|
+
}
|
|
882
|
+
};
|
|
826
883
|
try {
|
|
827
884
|
if (isIdleAction(action)) {
|
|
828
885
|
// Observation actions only look (#480). A `wait` that hangs inside the SDK has, by
|
|
829
886
|
// definition, waited; skipping it with a notice loses nothing the participant chose.
|
|
830
887
|
const idleBound = observationTimeoutMs + (action.kind === "wait" ? (action.ms ?? 0) : 0);
|
|
831
888
|
try {
|
|
832
|
-
await
|
|
889
|
+
await executeAction(idleBound);
|
|
833
890
|
}
|
|
834
891
|
catch (error) {
|
|
835
892
|
if (!(error instanceof CuaStallError))
|
|
@@ -845,7 +902,7 @@ export async function runComputerUseLoop(options) {
|
|
|
845
902
|
}
|
|
846
903
|
}
|
|
847
904
|
else {
|
|
848
|
-
await
|
|
905
|
+
await executeAction();
|
|
849
906
|
}
|
|
850
907
|
}
|
|
851
908
|
catch (error) {
|
|
@@ -932,6 +989,8 @@ export async function runComputerUseLoop(options) {
|
|
|
932
989
|
if (dwellOutcome === "stop") {
|
|
933
990
|
completionReason = "goal_satisfied";
|
|
934
991
|
reason = `dwell window complete (${dwellHeldMs}ms held after turn ${turnNumber})`;
|
|
992
|
+
closingObservation = observation;
|
|
993
|
+
closingTrigger = "dwell";
|
|
935
994
|
break;
|
|
936
995
|
}
|
|
937
996
|
}
|
|
@@ -939,6 +998,8 @@ export async function runComputerUseLoop(options) {
|
|
|
939
998
|
if (stopConditionMatch) {
|
|
940
999
|
completionReason = "goal_satisfied";
|
|
941
1000
|
reason = stopWhenReason(stopConditionMatch);
|
|
1001
|
+
closingObservation = observation;
|
|
1002
|
+
closingTrigger = "stop_when";
|
|
942
1003
|
record(stopWhenTraceItem(nextId("notice"), stopConditionMatch, redactNarration));
|
|
943
1004
|
break;
|
|
944
1005
|
}
|
|
@@ -1069,6 +1130,108 @@ export async function runComputerUseLoop(options) {
|
|
|
1069
1130
|
});
|
|
1070
1131
|
}
|
|
1071
1132
|
}
|
|
1133
|
+
// Structured completion must stop interaction immediately, but the participant may not yet
|
|
1134
|
+
// have spoken. Request one read-only account using the already captured final observation.
|
|
1135
|
+
// No callbacks that coordinate live participants and no executor calls occur after this point.
|
|
1136
|
+
if (closingTrigger !== undefined && closingObservation !== undefined) {
|
|
1137
|
+
const note = (status, detail, usageReported) => {
|
|
1138
|
+
debrief = { trigger: closingTrigger, status, reason: redactNarration(detail),
|
|
1139
|
+
...(usageReported === undefined ? {} : { usageReported }) };
|
|
1140
|
+
record({ id: nextId("notice"), kind: "notice", lifecycle: "completed",
|
|
1141
|
+
status: status === "completed" ? "ok" : "warn", title: `participant debrief ${status}`,
|
|
1142
|
+
text: redactNarration(detail) });
|
|
1143
|
+
};
|
|
1144
|
+
let skip;
|
|
1145
|
+
if ((counts.turns ?? 0) === 0)
|
|
1146
|
+
skip = "the study stopped before any participant turn";
|
|
1147
|
+
else if (provider.debrief === undefined)
|
|
1148
|
+
skip = "this provider does not support read-only closing reports";
|
|
1149
|
+
else if (signal?.aborted)
|
|
1150
|
+
skip = "the study was cancelled";
|
|
1151
|
+
else if (remaining() <= 0)
|
|
1152
|
+
skip = "the session deadline was reached";
|
|
1153
|
+
else if (provider.requiresFrame && closingObservation.screenshot === undefined)
|
|
1154
|
+
skip = "the final observation has no required frame";
|
|
1155
|
+
if (skip === undefined && (maxUsd !== undefined || overRunBudget !== undefined) && incompleteInteractionUsage) {
|
|
1156
|
+
skip = "remaining model budget is unknown because an earlier participant turn did not report complete usage";
|
|
1157
|
+
}
|
|
1158
|
+
if (skip === undefined && maxUsd !== undefined) {
|
|
1159
|
+
const estimate = sawUsage ? estimateTurnCostUsd?.(runningUsage()) : undefined;
|
|
1160
|
+
if (estimate === undefined || estimate === null || !Number.isFinite(estimate))
|
|
1161
|
+
skip = "remaining model budget could not be established";
|
|
1162
|
+
else if (estimate >= maxUsd)
|
|
1163
|
+
skip = "the estimated model budget was reached";
|
|
1164
|
+
}
|
|
1165
|
+
if (skip === undefined && overRunBudget?.(runningUsage()) != null)
|
|
1166
|
+
skip = "the study model budget was reached";
|
|
1167
|
+
if (skip !== undefined) {
|
|
1168
|
+
note("skipped", skip);
|
|
1169
|
+
}
|
|
1170
|
+
else {
|
|
1171
|
+
const capMs = Math.max(0, Math.min(30_000, turnTimeoutMs, remaining()));
|
|
1172
|
+
if (capMs <= 0 || signal?.aborted) {
|
|
1173
|
+
note("skipped", signal?.aborted ? "the study was cancelled" : "the session deadline was reached");
|
|
1174
|
+
}
|
|
1175
|
+
else {
|
|
1176
|
+
const controller = new AbortController();
|
|
1177
|
+
const onAbort = () => controller.abort();
|
|
1178
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1179
|
+
const timer = setTimeout(() => controller.abort(), capMs);
|
|
1180
|
+
timer.unref?.();
|
|
1181
|
+
bump("debriefCalls");
|
|
1182
|
+
try {
|
|
1183
|
+
const turn = await raceBounded("participant debrief", provider.debrief({
|
|
1184
|
+
instructions,
|
|
1185
|
+
observation: closingObservation,
|
|
1186
|
+
...(previousResponseId === undefined ? {} : { previousResponseId }),
|
|
1187
|
+
...(pendingAcks === undefined ? {} : { acknowledgedSafetyChecks: pendingAcks }),
|
|
1188
|
+
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."
|
|
1189
|
+
}, controller.signal), capMs, capMs, signal);
|
|
1190
|
+
recordUsage(turn, false);
|
|
1191
|
+
lastResponseId = turn.responseId ?? lastResponseId;
|
|
1192
|
+
// Refresh a shared budget with all reported usage, without changing the completed task.
|
|
1193
|
+
const sharedStop = overRunBudget?.(runningUsage());
|
|
1194
|
+
const finalEstimate = maxUsd === undefined ? undefined : estimateTurnCostUsd?.(runningUsage());
|
|
1195
|
+
if (sharedStop != null || (maxUsd !== undefined && finalEstimate != null && finalEstimate > maxUsd)) {
|
|
1196
|
+
record({ id: nextId("notice"), kind: "notice", lifecycle: "completed", status: "warn",
|
|
1197
|
+
title: "model budget reached during closing report",
|
|
1198
|
+
text: "The closing request crossed an estimated budget; no further requests or actions followed. Task completion is unchanged." });
|
|
1199
|
+
}
|
|
1200
|
+
const usageReported = completeTurnUsage(turn.usage);
|
|
1201
|
+
if (turn.actions.length > 0 || turn.pendingSafetyChecks.length > 0) {
|
|
1202
|
+
note("failed", "the closing response requested actions or safety checks; none were executed and its report was not accepted", usageReported);
|
|
1203
|
+
}
|
|
1204
|
+
else if (!validClosingReport(turn.closingReport)) {
|
|
1205
|
+
note("failed", "the closing response did not contain a valid structured participant report", usageReported);
|
|
1206
|
+
}
|
|
1207
|
+
else {
|
|
1208
|
+
const report = {
|
|
1209
|
+
summary: redactNarration(turn.closingReport.summary.trim()),
|
|
1210
|
+
frictionReports: [...new Set(turn.closingReport.frictionReports.map((text) => redactNarration(text.trim())))]
|
|
1211
|
+
};
|
|
1212
|
+
const messageId = nextId("message");
|
|
1213
|
+
record({ id: messageId, kind: "message", lifecycle: "completed",
|
|
1214
|
+
title: "participant closing report", text: [report.summary, ...report.frictionReports].join("\n\n") });
|
|
1215
|
+
bump("messages");
|
|
1216
|
+
note("completed", "one read-only report; no additional desktop actions; original stop and task outcomes preserved", usageReported);
|
|
1217
|
+
debrief = { ...debrief, report, messageId };
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
catch (error) {
|
|
1221
|
+
// A failed optional report cannot rewrite the already observed structured completion.
|
|
1222
|
+
const detail = signal?.aborted ? "cancelled" : controller.signal.aborted || error instanceof CuaDeadlineError || error instanceof CuaStallError
|
|
1223
|
+
? "closing report deadline reached" : error instanceof Error ? error.message : String(error);
|
|
1224
|
+
note("failed", `${detail}; closing request usage is unreported`, false);
|
|
1225
|
+
}
|
|
1226
|
+
finally {
|
|
1227
|
+
clearTimeout(timer);
|
|
1228
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1229
|
+
controller.abort();
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
onTrace?.(items.slice(), runningUsage());
|
|
1234
|
+
}
|
|
1072
1235
|
const completedAtMs = now();
|
|
1073
1236
|
const status = statusForCompletionReason(completionReason);
|
|
1074
1237
|
const ids = {};
|
|
@@ -1119,6 +1282,7 @@ export async function runComputerUseLoop(options) {
|
|
|
1119
1282
|
items,
|
|
1120
1283
|
...(affordanceObservations.length > 0 ? { affordanceUse: summarizeAffordanceUse(affordanceObservations) } : {}),
|
|
1121
1284
|
...(declaredOutcome === undefined ? {} : { declaredOutcome }),
|
|
1285
|
+
...(debrief === undefined ? {} : { debrief }),
|
|
1122
1286
|
// The funnel is present exactly when a protocol was declared — including a session that ended
|
|
1123
1287
|
// on turn 0, whose funnel honestly reads 0/N. No tasks declared means no funnel, not an empty one.
|
|
1124
1288
|
...(taskTracker === undefined ? {} : { taskFunnel: taskTracker.funnel() }),
|