@0xmaxma/claude-gateway 2.1.8 → 2.1.10
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/dist/agent/runner.d.ts +25 -4
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +4 -0
- package/dist/agent/runner.js.map +1 -1
- package/dist/api/connectors-router.d.ts.map +1 -1
- package/dist/api/connectors-router.js +27 -3
- package/dist/api/connectors-router.js.map +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +14 -0
- package/dist/api/router.js.map +1 -1
- package/dist/automation/browser-outcome.d.ts +3 -1
- package/dist/automation/browser-outcome.d.ts.map +1 -1
- package/dist/automation/browser-outcome.js +2 -2
- package/dist/automation/browser-outcome.js.map +1 -1
- package/dist/automation/browser-trace.d.ts +1 -1
- package/dist/automation/command-speech.d.ts +9 -1
- package/dist/automation/command-speech.d.ts.map +1 -1
- package/dist/automation/command-speech.js +18 -0
- package/dist/automation/command-speech.js.map +1 -1
- package/dist/automation/command-steps.d.ts +2 -0
- package/dist/automation/command-steps.d.ts.map +1 -1
- package/dist/automation/command-steps.js +34 -2
- package/dist/automation/command-steps.js.map +1 -1
- package/dist/automation/computer-command.d.ts +1 -0
- package/dist/automation/computer-command.d.ts.map +1 -1
- package/dist/automation/computer-command.js +31 -5
- package/dist/automation/computer-command.js.map +1 -1
- package/dist/automation/computer-outcome.d.ts +26 -3
- package/dist/automation/computer-outcome.d.ts.map +1 -1
- package/dist/automation/computer-outcome.js +183 -13
- package/dist/automation/computer-outcome.js.map +1 -1
- package/dist/automation/computer-policy.d.ts +10 -1
- package/dist/automation/computer-policy.d.ts.map +1 -1
- package/dist/automation/computer-policy.js +20 -6
- package/dist/automation/computer-policy.js.map +1 -1
- package/dist/automation/computer-use.d.ts +34 -0
- package/dist/automation/computer-use.d.ts.map +1 -1
- package/dist/automation/computer-use.js +211 -17
- package/dist/automation/computer-use.js.map +1 -1
- package/dist/automation/direct-command.d.ts +8 -0
- package/dist/automation/direct-command.d.ts.map +1 -1
- package/dist/automation/direct-command.js +12 -0
- package/dist/automation/direct-command.js.map +1 -1
- package/dist/automation/model-choice-evaluator.d.ts +3 -0
- package/dist/automation/model-choice-evaluator.d.ts.map +1 -1
- package/dist/automation/model-choice-evaluator.js +3 -1
- package/dist/automation/model-choice-evaluator.js.map +1 -1
- package/dist/automation/vision-decider.d.ts +4 -2
- package/dist/automation/vision-decider.d.ts.map +1 -1
- package/dist/automation/vision-decider.js +69 -15
- package/dist/automation/vision-decider.js.map +1 -1
- package/dist/build-provenance.json +4 -4
- package/dist/connectors/custom-connectors-store.d.ts.map +1 -1
- package/dist/connectors/custom-connectors-store.js +6 -1
- package/dist/connectors/custom-connectors-store.js.map +1 -1
- package/dist/connectors/custom.d.ts +14 -0
- package/dist/connectors/custom.d.ts.map +1 -1
- package/dist/connectors/custom.js +43 -2
- package/dist/connectors/custom.js.map +1 -1
- package/dist/connectors/proxy.d.ts +8 -0
- package/dist/connectors/proxy.d.ts.map +1 -1
- package/dist/connectors/proxy.js +53 -5
- package/dist/connectors/proxy.js.map +1 -1
- package/dist/connectors/resolve.d.ts.map +1 -1
- package/dist/connectors/resolve.js +16 -2
- package/dist/connectors/resolve.js.map +1 -1
- package/dist/connectors/sidecar.d.ts +131 -0
- package/dist/connectors/sidecar.d.ts.map +1 -0
- package/dist/connectors/sidecar.js +768 -0
- package/dist/connectors/sidecar.js.map +1 -0
- package/dist/connectors/token-env.d.ts +2 -0
- package/dist/connectors/token-env.d.ts.map +1 -1
- package/dist/connectors/token-env.js +16 -0
- package/dist/connectors/token-env.js.map +1 -1
- package/dist/connectors/types.d.ts +4 -0
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/connectors/uv-runtime.d.ts +37 -0
- package/dist/connectors/uv-runtime.d.ts.map +1 -0
- package/dist/connectors/uv-runtime.js +236 -0
- package/dist/connectors/uv-runtime.js.map +1 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/jev/browser-contract.d.ts +3 -0
- package/dist/jev/browser-contract.d.ts.map +1 -1
- package/dist/jev/browser-contract.js +6 -0
- package/dist/jev/browser-contract.js.map +1 -1
- package/dist/jev/browser-evidence-summary.d.ts +1 -1
- package/dist/orchestration/agent-tool-schemas.d.ts +18 -0
- package/dist/orchestration/agent-tool-schemas.d.ts.map +1 -1
- package/dist/orchestration/agent-tool-schemas.js +11 -3
- package/dist/orchestration/agent-tool-schemas.js.map +1 -1
- package/dist/orchestration/bridge.d.ts.map +1 -1
- package/dist/orchestration/bridge.js +25 -5
- package/dist/orchestration/bridge.js.map +1 -1
- package/dist/orchestration/browser-routing.d.ts.map +1 -1
- package/dist/orchestration/browser-routing.js +2 -1
- package/dist/orchestration/browser-routing.js.map +1 -1
- package/dist/orchestration/computer-decisions.d.ts +1 -1
- package/dist/orchestration/computer-decisions.d.ts.map +1 -1
- package/dist/orchestration/computer-decisions.js +21 -7
- package/dist/orchestration/computer-decisions.js.map +1 -1
- package/dist/orchestration/computer-live.d.ts +62 -0
- package/dist/orchestration/computer-live.d.ts.map +1 -0
- package/dist/orchestration/computer-live.js +126 -0
- package/dist/orchestration/computer-live.js.map +1 -0
- package/dist/orchestration/connector-context.d.ts +17 -0
- package/dist/orchestration/connector-context.d.ts.map +1 -0
- package/dist/orchestration/connector-context.js +56 -0
- package/dist/orchestration/connector-context.js.map +1 -0
- package/dist/orchestration/container-tool-schemas.d.ts.map +1 -1
- package/dist/orchestration/container-tool-schemas.js +3 -0
- package/dist/orchestration/container-tool-schemas.js.map +1 -1
- package/dist/orchestration/decisions.d.ts +3 -1
- package/dist/orchestration/decisions.d.ts.map +1 -1
- package/dist/orchestration/decisions.js +4 -2
- package/dist/orchestration/decisions.js.map +1 -1
- package/dist/orchestration/gateway-tasks/browser.d.ts +1 -1
- package/dist/orchestration/gateway-tasks/browser.d.ts.map +1 -1
- package/dist/orchestration/gateway-tasks/browser.js +4 -3
- package/dist/orchestration/gateway-tasks/browser.js.map +1 -1
- package/dist/orchestration/gateway-tasks/computer-context.d.ts +4 -1
- package/dist/orchestration/gateway-tasks/computer-context.d.ts.map +1 -1
- package/dist/orchestration/gateway-tasks/computer-context.js +3 -1
- package/dist/orchestration/gateway-tasks/computer-context.js.map +1 -1
- package/dist/orchestration/gateway-tasks/computer.d.ts +78 -15
- package/dist/orchestration/gateway-tasks/computer.d.ts.map +1 -1
- package/dist/orchestration/gateway-tasks/computer.js +298 -31
- package/dist/orchestration/gateway-tasks/computer.js.map +1 -1
- package/dist/orchestration/gateway-tasks/controller.d.ts +14 -2
- package/dist/orchestration/gateway-tasks/controller.d.ts.map +1 -1
- package/dist/orchestration/gateway-tasks/controller.js +63 -2
- package/dist/orchestration/gateway-tasks/controller.js.map +1 -1
- package/dist/orchestration/notification-mailbox.js +3 -3
- package/dist/orchestration/notification-mailbox.js.map +1 -1
- package/dist/orchestration/process-turn.d.ts.map +1 -1
- package/dist/orchestration/process-turn.js +4 -1
- package/dist/orchestration/process-turn.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +22 -1
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +87 -7
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/task-controls.d.ts +8 -0
- package/dist/orchestration/task-controls.d.ts.map +1 -1
- package/dist/orchestration/task-controls.js +3 -2
- package/dist/orchestration/task-controls.js.map +1 -1
- package/dist/orchestration/tasks/automation-session.d.ts +42 -11
- package/dist/orchestration/tasks/automation-session.d.ts.map +1 -1
- package/dist/orchestration/tasks/automation-session.js +101 -21
- package/dist/orchestration/tasks/automation-session.js.map +1 -1
- package/dist/orchestration/tasks/driver.d.ts.map +1 -1
- package/dist/orchestration/tasks/driver.js +4 -0
- package/dist/orchestration/tasks/driver.js.map +1 -1
- package/dist/orchestration/tasks/service.d.ts +23 -0
- package/dist/orchestration/tasks/service.d.ts.map +1 -1
- package/dist/orchestration/tasks/service.js +120 -12
- package/dist/orchestration/tasks/service.js.map +1 -1
- package/dist/orchestration/telegram-tool-status.d.ts.map +1 -1
- package/dist/orchestration/telegram-tool-status.js +2 -0
- package/dist/orchestration/telegram-tool-status.js.map +1 -1
- package/dist/orchestration/types.d.ts +19 -0
- package/dist/orchestration/types.d.ts.map +1 -1
- package/dist/orchestration/types.js.map +1 -1
- package/dist/session/managed-connectors.d.ts +2 -0
- package/dist/session/managed-connectors.d.ts.map +1 -1
- package/dist/session/managed-connectors.js +9 -4
- package/dist/session/managed-connectors.js.map +1 -1
- package/dist/session/process.d.ts +3 -0
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +21 -3
- package/dist/session/process.js.map +1 -1
- package/dist/session/runtime-profile.d.ts +2 -0
- package/dist/session/runtime-profile.d.ts.map +1 -1
- package/dist/session/runtime-profile.js.map +1 -1
- package/dist/ui/voice-call-client.d.ts +3 -0
- package/dist/ui/voice-call-client.d.ts.map +1 -1
- package/dist/ui/voice-call-client.js +10 -1
- package/dist/ui/voice-call-client.js.map +1 -1
- package/dist/voice/errors.d.ts +1 -1
- package/dist/voice/errors.js +1 -1
- package/dist/voice/errors.js.map +1 -1
- package/dist/voice/providers/elevenlabs-tts.d.ts.map +1 -1
- package/dist/voice/providers/elevenlabs-tts.js +17 -1
- package/dist/voice/providers/elevenlabs-tts.js.map +1 -1
- package/dist/voice/providers/socket.js +25 -6
- package/dist/voice/providers/socket.js.map +1 -1
- package/dist/voice/session.js +3 -2
- package/dist/voice/session.js.map +1 -1
- package/mcp/fixtures/workspace-mcp-tools.json +260 -0
- package/mcp/lazy-tools.test.ts +137 -1
- package/mcp/lazy-tools.ts +40 -7
- package/mcp/server.ts +1 -1
- package/mcp/tools/tasks/module.ts +2 -1
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ export declare function assertAgentContextRefs(supplied: unknown): unknown[];
|
|
|
17
17
|
export declare function mergeContextRefs(supplied: unknown, inputRefs: string[]): unknown[];
|
|
18
18
|
export interface SpawnTask {
|
|
19
19
|
browserFields?: unknown;
|
|
20
|
+
runAsGoal?: boolean;
|
|
20
21
|
computerInputs?: TaskRevision["computerInputs"];
|
|
21
22
|
gatewayTarget?: import("../types").GatewayTaskTarget;
|
|
22
23
|
workingDirectory?: string;
|
|
@@ -201,6 +202,15 @@ export declare class TaskService {
|
|
|
201
202
|
* inputs or navigation, and never twice for the same utterance.
|
|
202
203
|
*/
|
|
203
204
|
private agentHandoff;
|
|
205
|
+
/**
|
|
206
|
+
* The agent turn for the notification that its own goal run parked
|
|
207
|
+
* (agentGoalRunParked: this task, this state_version) may send one next
|
|
208
|
+
* command, like a hand-off: nothing else continues that run. The turn itself
|
|
209
|
+
* cannot execute, so the task's own execute capability and owner authorize it.
|
|
210
|
+
* Pod-jinawong, task c449e48d: the notified agent's task_update to press Enter
|
|
211
|
+
* was refused with USER_CONTROLS_AUTOMATION and the run dead-ended.
|
|
212
|
+
*/
|
|
213
|
+
private parkedGoalRunCommand;
|
|
204
214
|
/** The latest live-control receipt of an input (live-execution-input.ts liveControlReceipt). */
|
|
205
215
|
private liveReceipt;
|
|
206
216
|
/** The owner's pause/revise/resume, or (agentHandoffInputId) the agent's single command for a handed-off utterance. Runs inside the caller's transaction. */
|
|
@@ -215,6 +225,13 @@ export declare class TaskService {
|
|
|
215
225
|
cancelByUser(conversationId: string, principalId: string, taskId: string): TaskSnapshot;
|
|
216
226
|
private cancelOwned;
|
|
217
227
|
/** A settled computer round still owns device access until explicit revocation. */
|
|
228
|
+
/** Records a settled computer session's idle expiry; the save revokes its device access (syncAutomationSession). */
|
|
229
|
+
expireIdleComputerSession(taskId: string, expectedVersion: number): void;
|
|
230
|
+
/** A waiting round whose session expired ends with its last outcome (expiredWaitingRound): completed when that
|
|
231
|
+
* round was done, else failed COMPUTER_SESSION_EXPIRED. Its device access is revoked separately (computerRevocation). */
|
|
232
|
+
endExpiredComputerRound(taskId: string, expectedVersion: number): void;
|
|
233
|
+
/** The controller ended an idle round's device session; recorded so it ends once. */
|
|
234
|
+
recordIdleComputerRelease(taskId: string, requestId: string): void;
|
|
218
235
|
finishIdleComputerCleanup(taskId: string, requestId: string): void;
|
|
219
236
|
/** Scheduler-only cleanup acknowledgment; never authorizes new worker writes. */
|
|
220
237
|
finishCleanup(attemptId: string, generation: number, stopped: boolean): void;
|
|
@@ -301,6 +318,12 @@ export declare class TaskService {
|
|
|
301
318
|
task_id: string;
|
|
302
319
|
state: import("../types").TaskState;
|
|
303
320
|
}[];
|
|
321
|
+
/** The notification of this parked goal run assigned to this agent turn. Connection and idle-release
|
|
322
|
+
* saves advance state_version after the round settles; the notice still describes this round. */
|
|
323
|
+
private parkedRoundNotice;
|
|
324
|
+
/** A verified parked goal run is done: its automation session closes, and a computer session's
|
|
325
|
+
* device access is revoked now rather than after the idle release (the controller ends it). */
|
|
326
|
+
private closeVerifiedGoalRun;
|
|
304
327
|
/** Parent independently checks a fresh, scoped browser observation. Never clears an uncertain mutation. */
|
|
305
328
|
verifyBrowser(context: CommandContext, taskId: string, revision: number, requestId: string, evidenceId: string, evidence: string, check: () => void): TaskSnapshot;
|
|
306
329
|
verifyComputer(context: CommandContext, taskId: string, revision: number, requestId: string, evidenceId: string, evidence: string, check: () => void): TaskSnapshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAA6C,MAAM,UAAU,CAAC;AACzF,OAAO,EAA8B,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAsB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAc,aAAa,EAAwB,UAAU,EAAE,kBAAkB,EAAc,MAAM,UAAU,CAAC;AACpM,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIzD,gGAAgG;AAChG,eAAO,MAAM,cAAc,EAAE,SAAS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,EAAC,MAAI,IAAI,GAAE,YAAY;IAwBlJ,cAAc,CAAC,OAAO,EAAC,cAAc,EAAC,MAAM,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,UAAU,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,KAAK,EAAC,MAAI,IAAI,GAAE,YAAY;IAwBnJ,sFAAsF;IACtF,gBAAgB,CAAC,OAAO,EAAC,cAAc,EAAC,MAAM,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,UAAU,EAAC,MAAM,EAAC,YAAY,EAAC,MAAM,EAAC,KAAK,EAAC,MAAI,MAAM,GAAE,YAAY;IAoB3J,oGAAoG;IACpG,OAAO,CAAC,kBAAkB;IAK1B,yFAAyF;IACzF,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IA0BrF;+EAC2E;IAC3E,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY;IAsBrH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,WAAW,GAAG,UAAwB,GAAG,IAAI;CAU5G"}
|
|
@@ -126,7 +126,7 @@ function recordAction(task, revision, command, outcome) {
|
|
|
126
126
|
return;
|
|
127
127
|
const last = outcome.computerReport?.lastAction;
|
|
128
128
|
// A step-run line counts steps; name the last completed action as well.
|
|
129
|
-
if (last && !last.blocked && !result.startsWith('Done
|
|
129
|
+
if (last && !last.blocked && !result.startsWith('Done'))
|
|
130
130
|
result += ` Last completed action: ${(0, computer_outcome_1.computerActionText)(last)}.`;
|
|
131
131
|
if (outcome.type === 'unknown')
|
|
132
132
|
result = 'Outcome unknown; not replayed. ' + result;
|
|
@@ -312,6 +312,8 @@ class TaskService {
|
|
|
312
312
|
const prepared = (0, browser_fields_1.preparedBrowserAnswers)(command.browserFields, context.inputId);
|
|
313
313
|
if (command.browserFields !== undefined && command.gatewayTarget?.adapter !== 'browser')
|
|
314
314
|
throw new types_1.OrchestrationError('INVALID_BROWSER_FIELDS');
|
|
315
|
+
if (command.runAsGoal !== undefined && (typeof command.runAsGoal !== 'boolean' || !['browser', 'computer'].includes(command.gatewayTarget?.adapter ?? '')))
|
|
316
|
+
throw new types_1.OrchestrationError('INVALID_INPUT', 'run_as_goal is a boolean for browser or computer gateway-managed tasks only.');
|
|
315
317
|
(0, store_1.boundedText)(command.title, 512);
|
|
316
318
|
(0, store_1.boundedText)(command.instructions);
|
|
317
319
|
(0, store_1.boundedText)(command.targetProfile, 128);
|
|
@@ -402,6 +404,8 @@ class TaskService {
|
|
|
402
404
|
const projectRoot = command.workingDirectory || (this.config.tasks.workspaceMode === 'host' && prior?.resourceProfile?.mode === 'host' ? prior.resourceProfile.projectRoot : undefined) || this.config.tasks.projectRoot || this.defaultProjectRoot;
|
|
403
405
|
if (projectRoot && !command.gatewayTarget)
|
|
404
406
|
task.resourceProfile = { projectRoot, mode: this.config.tasks.workspaceMode };
|
|
407
|
+
if (command.runAsGoal)
|
|
408
|
+
task.runAsGoal = { revision: 1 };
|
|
405
409
|
this.store.run('INSERT INTO tasks VALUES(?,?,?,?,?,?,?,?,?)', task.taskId, task.conversationId, task.state, 1, 1, null, JSON.stringify(task), now, now);
|
|
406
410
|
const revision = { requestBrowserConsent: command.gatewayTarget?.adapter === 'browser', taskId: task.taskId, revision: 1, instructions: command.instructions, computerInputs: command.computerInputs,
|
|
407
411
|
answers: prepared, contextRefs: command.contextRefs ?? [], mode: 'when_ready', originatingInputId: context.inputId };
|
|
@@ -454,7 +458,8 @@ class TaskService {
|
|
|
454
458
|
// Jev gave up on this utterance and handed it to the agent: exactly one
|
|
455
459
|
// command, as the user's own next direct command (user keeps control).
|
|
456
460
|
const handoff = this.agentHandoff(context, task, expectedRevision, mode, browserFields, computerInputs, startUrl);
|
|
457
|
-
|
|
461
|
+
// Likewise the agent's own goal run that parked and woke the agent (agentGoalRunParked).
|
|
462
|
+
if (handoff || this.parkedGoalRunCommand(context, task, expectedRevision, mode, browserFields, computerInputs, startUrl))
|
|
458
463
|
return this.applyDirectControl(context.conversationId, taskId, task, { id: handoffCommandId(context.inputId), action: 'revise', text: instruction }, undefined, context.inputId);
|
|
459
464
|
throw new types_1.OrchestrationError('USER_CONTROLS_AUTOMATION');
|
|
460
465
|
}
|
|
@@ -618,6 +623,32 @@ class TaskService {
|
|
|
618
623
|
throw new types_1.OrchestrationError('STATE_CONFLICT');
|
|
619
624
|
return true;
|
|
620
625
|
}
|
|
626
|
+
/**
|
|
627
|
+
* The agent turn for the notification that its own goal run parked
|
|
628
|
+
* (agentGoalRunParked: this task, this state_version) may send one next
|
|
629
|
+
* command, like a hand-off: nothing else continues that run. The turn itself
|
|
630
|
+
* cannot execute, so the task's own execute capability and owner authorize it.
|
|
631
|
+
* Pod-jinawong, task c449e48d: the notified agent's task_update to press Enter
|
|
632
|
+
* was refused with USER_CONTROLS_AUTOMATION and the run dead-ended.
|
|
633
|
+
*/
|
|
634
|
+
parkedGoalRunCommand(context, task, expectedRevision, mode, browserFields, computerInputs, startUrl) {
|
|
635
|
+
const notice = this.store.get(`SELECT n.id FROM conversation_inputs i JOIN notifications n ON n.conversation_id=i.conversation_id AND n.task_id=?
|
|
636
|
+
AND (json_extract(i.ingress_json,'$.ingressKey')='notification:'||n.id OR json_extract(i.ingress_json,'$.ingressKey') LIKE 'notification:'||n.id||':retry:%')
|
|
637
|
+
WHERE i.id=? AND i.conversation_id=? LIMIT 1`, task.taskId, context.inputId, context.conversationId);
|
|
638
|
+
if (!notice)
|
|
639
|
+
return false;
|
|
640
|
+
if (!task.capabilities.execute || task.ownerPrincipalId !== context.principalId)
|
|
641
|
+
throw new types_1.OrchestrationError('EXECUTION_DENIED');
|
|
642
|
+
if (this.store.get("SELECT 1 FROM task_revisions WHERE task_id=? AND json_extract(payload_json,'$.agentHandoffInputId')=?", task.taskId, context.inputId))
|
|
643
|
+
throw new types_1.OrchestrationError('AGENT_HANDOFF_USED', 'The one command for this parked run was already sent. Report its outcome; do not send another.');
|
|
644
|
+
if (!(0, automation_session_1.agentGoalRunParked)(task) || !this.parkedRoundNotice(context, task, String(notice.id)))
|
|
645
|
+
throw new types_1.OrchestrationError('STATE_CONFLICT', 'The run changed since this notice (a newer command, question or pause). Read task_status; do not act on this notice.');
|
|
646
|
+
if (mode !== 'when_ready' || browserFields !== undefined || computerInputs !== undefined || startUrl !== undefined)
|
|
647
|
+
throw new types_1.OrchestrationError('INVALID_INPUT', 'The command for a parked run is one plain next command: mode=when_ready, no fields, inputs or start_url.');
|
|
648
|
+
if (expectedRevision !== task.revision)
|
|
649
|
+
throw new types_1.OrchestrationError('REVISION_CONFLICT');
|
|
650
|
+
return true;
|
|
651
|
+
}
|
|
621
652
|
/** The latest live-control receipt of an input (live-execution-input.ts liveControlReceipt). */
|
|
622
653
|
liveReceipt(inputId) {
|
|
623
654
|
const row = this.store.get("SELECT payload_json FROM conversation_events WHERE type='input.execution_control' AND json_extract(payload_json,'$.payload.inputId')=? ORDER BY seq DESC LIMIT 1", inputId);
|
|
@@ -768,13 +799,57 @@ class TaskService {
|
|
|
768
799
|
return task;
|
|
769
800
|
}
|
|
770
801
|
/** A settled computer round still owns device access until explicit revocation. */
|
|
802
|
+
/** Records a settled computer session's idle expiry; the save revokes its device access (syncAutomationSession). */
|
|
803
|
+
expireIdleComputerSession(taskId, expectedVersion) {
|
|
804
|
+
this.store.transaction(() => {
|
|
805
|
+
const task = this.store.task(taskId);
|
|
806
|
+
if (!task || task.stateVersion !== expectedVersion || task.automationSession?.status === 'closed' || (0, automation_session_1.automationSession)(task)?.closedReason !== 'idle_timeout')
|
|
807
|
+
return;
|
|
808
|
+
this.store.saveTask(task, task.stateVersion);
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
/** A waiting round whose session expired ends with its last outcome (expiredWaitingRound): completed when that
|
|
812
|
+
* round was done, else failed COMPUTER_SESSION_EXPIRED. Its device access is revoked separately (computerRevocation). */
|
|
813
|
+
endExpiredComputerRound(taskId, expectedVersion) {
|
|
814
|
+
this.store.transaction(() => {
|
|
815
|
+
const task = this.store.task(taskId);
|
|
816
|
+
if (!task || task.stateVersion !== expectedVersion || !(0, automation_session_1.expiredWaitingRound)(task))
|
|
817
|
+
return;
|
|
818
|
+
const report = task.computerReport, last = report ? (0, computer_outcome_1.computerOutcomeText)(report) : task.latestProgress?.text;
|
|
819
|
+
const minutes = Math.round((task.automationSession.idleTimeoutMs) / 60000);
|
|
820
|
+
const ended = `The Computer Use session ended after ${minutes} minutes without a new command.`;
|
|
821
|
+
delete task.queuedCommands;
|
|
822
|
+
if (report && (0, computer_outcome_1.computerRoundDone)(report)) {
|
|
823
|
+
task.state = 'completed';
|
|
824
|
+
delete task.failure;
|
|
825
|
+
task.result = { summary: `${ended} Last round: ${last}`.slice(0, 4096), artifactIds: [] };
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
task.state = 'failed';
|
|
829
|
+
task.failure = { code: 'COMPUTER_SESSION_EXPIRED', message: `${ended} The task no longer takes commands; a new request starts a new task.${last ? ` Last round: ${last}` : ''}`.slice(0, 4096), observedAt: Date.now() };
|
|
830
|
+
}
|
|
831
|
+
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: [ended, last].filter(Boolean).join(' ').slice(0, 4096) };
|
|
832
|
+
this.store.saveTask(task, task.stateVersion);
|
|
833
|
+
this.notify(task);
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
/** The controller ended an idle round's device session; recorded so it ends once. */
|
|
837
|
+
recordIdleComputerRelease(taskId, requestId) {
|
|
838
|
+
this.store.transaction(() => {
|
|
839
|
+
const task = this.store.task(taskId);
|
|
840
|
+
if (!task || task.activeAttemptId || task.gatewayDispatch?.requestId !== requestId)
|
|
841
|
+
return;
|
|
842
|
+
task.computerAccessReleased = { requestId, releasedAt: Date.now() };
|
|
843
|
+
this.store.saveTask(task, task.stateVersion);
|
|
844
|
+
});
|
|
845
|
+
}
|
|
771
846
|
finishIdleComputerCleanup(taskId, requestId) {
|
|
772
847
|
this.store.transaction(() => {
|
|
773
848
|
const task = this.store.task(taskId);
|
|
774
849
|
if (!task || task.activeAttemptId || task.gatewayTarget?.adapter !== 'computer' || task.gatewayDispatch?.requestId !== requestId)
|
|
775
850
|
throw new types_1.OrchestrationError('STALE_ATTEMPT');
|
|
776
851
|
// A terminal round keeps its reported outcome; only the pending revocation is settled.
|
|
777
|
-
if (types_1.TERMINAL_TASK_STATES.has(task.state) && task.computerRevocation?.requestId === requestId) {
|
|
852
|
+
if ((types_1.TERMINAL_TASK_STATES.has(task.state) || task.state === 'waiting_input') && task.computerRevocation?.requestId === requestId) {
|
|
778
853
|
delete task.computerRevocation;
|
|
779
854
|
this.store.saveTask(task, task.stateVersion);
|
|
780
855
|
return;
|
|
@@ -1286,7 +1361,7 @@ class TaskService {
|
|
|
1286
1361
|
if (outcome.computerReport || outcome.browserReport)
|
|
1287
1362
|
recordAction(task, attempt.revision, this.revision(task.taskId, attempt.revision).instructions, outcome);
|
|
1288
1363
|
// A structured unresolved blocker is not successful task completion.
|
|
1289
|
-
const waitingForCommand = outcome.type === 'paused' && ['browser', 'computer'].includes(task.gatewayTarget?.adapter ?? '') && ['THINKING_WAITING_INPUT', 'COMMAND_WAITING_INPUT', 'COMPLETION_CANDIDATE', 'VERIFICATION_FAILED'].includes(outcome.computerReport?.reason ?? outcome.browserReport?.reason ?? '');
|
|
1364
|
+
const waitingForCommand = outcome.type === 'paused' && ['browser', 'computer'].includes(task.gatewayTarget?.adapter ?? '') && ['THINKING_WAITING_INPUT', 'COMMAND_WAITING_INPUT', 'COMPLETION_CANDIDATE', 'VERIFICATION_FAILED', ...automation_session_1.ROUND_PAUSES].includes(outcome.computerReport?.reason ?? outcome.browserReport?.reason ?? '');
|
|
1290
1365
|
if (outcome.type === 'paused' && !waitingForCommand && !(task.state === 'waiting_input' && task.pendingQuestion) &&
|
|
1291
1366
|
task.state !== 'interrupting' && task.state !== 'cancel_requested' && !(task.gatewayTarget && task.revision > attempt.revision))
|
|
1292
1367
|
throw new types_1.OrchestrationError('STATE_CONFLICT');
|
|
@@ -1334,7 +1409,8 @@ class TaskService {
|
|
|
1334
1409
|
task.state = 'queued';
|
|
1335
1410
|
else if (waitingForCommand) {
|
|
1336
1411
|
task.state = 'waiting_input';
|
|
1337
|
-
|
|
1412
|
+
const handedOff = (0, automation_session_1.agentGoalRunParked)(task);
|
|
1413
|
+
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: task.gatewayTarget?.adapter === 'computer' && outcome.computerReport ? (0, computer_outcome_1.computerOutcomeText)(outcome.computerReport, { handedOff }) : task.gatewayTarget?.adapter === 'browser' && outcome.browserReport ? (0, browser_outcome_1.browserOutcomeText)(outcome.browserReport, { handedOff }) : 'Waiting for your next command.' };
|
|
1338
1414
|
}
|
|
1339
1415
|
else if (restartInterrupted)
|
|
1340
1416
|
this.resumeAfterRestart(task, attempt);
|
|
@@ -1354,6 +1430,9 @@ class TaskService {
|
|
|
1354
1430
|
task.failure = stalled;
|
|
1355
1431
|
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: stalled.message };
|
|
1356
1432
|
}
|
|
1433
|
+
// An ended computer round leaves its own last line on the card, not the running progress it stopped at.
|
|
1434
|
+
else if (task.gatewayTarget?.adapter === 'computer' && outcome.computerReport && (task.state === 'failed' || task.state === 'completed'))
|
|
1435
|
+
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: task.state === 'completed' ? (0, computer_outcome_1.computerOutcomeText)(outcome.computerReport) : (0, computer_outcome_1.computerProgressText)({ ...outcome.computerReport, phase: 'terminal' }) };
|
|
1357
1436
|
// After every failure reassignment above, so a stop or stall reason cannot drop them.
|
|
1358
1437
|
if (refusals?.length && attempt.failure && !attempt.failure.providerRefusals) {
|
|
1359
1438
|
attempt.failure = { ...attempt.failure, providerRefusals: refusals };
|
|
@@ -1380,7 +1459,7 @@ class TaskService {
|
|
|
1380
1459
|
this.store.saveTask(task, task.stateVersion);
|
|
1381
1460
|
if (task.state === 'queued')
|
|
1382
1461
|
this.store.enqueue('schedule', `schedule:${task.taskId}:${task.stateVersion}`, { taskId: task.taskId });
|
|
1383
|
-
else if (types_1.TERMINAL_TASK_STATES.has(task.state) || (task.state === 'needs_reconciliation' && !task.restartRecovery) || (waitingForCommand && task.state === 'waiting_input' && task.automationController !== 'user' && task.executionControl?.phase !== 'paused') || (waitingForCommand && (0, automation_session_1.
|
|
1462
|
+
else if (types_1.TERMINAL_TASK_STATES.has(task.state) || (task.state === 'needs_reconciliation' && !task.restartRecovery) || (waitingForCommand && task.state === 'waiting_input' && task.automationController !== 'user' && task.executionControl?.phase !== 'paused') || (waitingForCommand && (0, automation_session_1.agentGoalRunParked)(task)))
|
|
1384
1463
|
this.notify(task);
|
|
1385
1464
|
return task;
|
|
1386
1465
|
});
|
|
@@ -1532,16 +1611,38 @@ class TaskService {
|
|
|
1532
1611
|
return { task_id: task.taskId, state: task.state };
|
|
1533
1612
|
}));
|
|
1534
1613
|
}
|
|
1614
|
+
/** The notification of this parked goal run assigned to this agent turn. Connection and idle-release
|
|
1615
|
+
* saves advance state_version after the round settles; the notice still describes this round. */
|
|
1616
|
+
parkedRoundNotice(context, task, noticeId) {
|
|
1617
|
+
return Boolean(this.store.get(`SELECT n.id FROM notifications n WHERE n.task_id=? AND n.decision_id=? AND n.status='assigned'
|
|
1618
|
+
AND (? IS NULL OR n.id=?)
|
|
1619
|
+
AND EXISTS (SELECT 1 FROM conversation_events e WHERE e.conversation_id=n.conversation_id AND e.type='task.state_changed'
|
|
1620
|
+
AND json_extract(e.payload_json,'$.payload.taskId')=n.task_id AND json_extract(e.payload_json,'$.payload.stateVersion')=n.task_state_version
|
|
1621
|
+
AND json_extract(e.payload_json,'$.payload.state')='waiting_input' AND json_extract(e.payload_json,'$.payload.revision')=?
|
|
1622
|
+
AND COALESCE(json_extract(e.payload_json,'$.payload.gatewayDispatch.requestId'),'')=?) LIMIT 1`, task.taskId, context.decisionId, noticeId ?? null, noticeId ?? null, task.revision, task.gatewayDispatch?.requestId ?? ''));
|
|
1623
|
+
}
|
|
1624
|
+
/** A verified parked goal run is done: its automation session closes, and a computer session's
|
|
1625
|
+
* device access is revoked now rather than after the idle release (the controller ends it). */
|
|
1626
|
+
closeVerifiedGoalRun(task) {
|
|
1627
|
+
const session = (0, automation_session_1.automationSession)(task);
|
|
1628
|
+
if (session && session.status !== 'closed')
|
|
1629
|
+
task.automationSession = { ...session, status: 'closed', closedAt: Date.now(), closedReason: 'agent' };
|
|
1630
|
+
if (task.gatewayTarget?.adapter === 'computer' && task.gatewayDispatch)
|
|
1631
|
+
task.computerRevocation = { requestId: task.gatewayDispatch.requestId, requestedAt: Date.now() };
|
|
1632
|
+
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: computer_outcome_1.ANSWERED_FROM_SCREEN };
|
|
1633
|
+
}
|
|
1535
1634
|
/** Parent independently checks a fresh, scoped browser observation. Never clears an uncertain mutation. */
|
|
1536
1635
|
verifyBrowser(context, taskId, revision, requestId, evidenceId, evidence, check) {
|
|
1537
1636
|
(0, store_1.boundedText)(evidence, 4096);
|
|
1538
1637
|
(0, store_1.boundedText)(requestId, 256);
|
|
1539
1638
|
(0, store_1.boundedText)(evidenceId, 128);
|
|
1540
1639
|
return this.command(context, 'verify_browser', { taskId, revision, requestId, evidenceId, evidence }, context.execute, () => {
|
|
1541
|
-
const task = this.owned(taskId, context.conversationId);
|
|
1542
|
-
|
|
1640
|
+
const task = this.owned(taskId, context.conversationId), parked = (0, automation_session_1.agentGoalRunParked)(task);
|
|
1641
|
+
// The agent's own goal run that parked (agentGoalRunParked) is closed the same way once fresh evidence shows its goal met.
|
|
1642
|
+
if (task.ownerPrincipalId !== context.principalId || task.gatewayTarget?.adapter !== 'browser' || task.revision !== revision || task.gatewayDispatch?.requestId !== requestId || !task.browserReport
|
|
1643
|
+
|| !(parked ? (0, browser_contract_1.parkedVerifiableBrowserResult)(task.browserReport) : ['needs_reconciliation', 'failed'].includes(task.state) && (0, browser_contract_1.parentVerifiableBrowserResult)(task.browserReport)))
|
|
1543
1644
|
throw new types_1.OrchestrationError('BROWSER_VERIFICATION_UNAVAILABLE');
|
|
1544
|
-
if (!task.capabilities.execute || (!context.execute && !this.store.get("SELECT id FROM notifications WHERE task_id=? AND decision_id=? AND status='assigned' AND task_state_version=?", taskId, context.decisionId, task.stateVersion)))
|
|
1645
|
+
if (!task.capabilities.execute || (!context.execute && !(parked ? this.parkedRoundNotice(context, task) : this.store.get("SELECT id FROM notifications WHERE task_id=? AND decision_id=? AND status='assigned' AND task_state_version=?", taskId, context.decisionId, task.stateVersion))))
|
|
1545
1646
|
throw new types_1.OrchestrationError('EXECUTION_DENIED');
|
|
1546
1647
|
check();
|
|
1547
1648
|
const attemptId = task.activeAttemptId ?? this.store.get("SELECT id FROM task_attempts WHERE task_id=? AND revision=? AND state='ended' ORDER BY generation DESC LIMIT 1", taskId, revision)?.id;
|
|
@@ -1558,6 +1659,8 @@ class TaskService {
|
|
|
1558
1659
|
task.browserReport.verification = { source: 'parent', evidence, at: Date.now() };
|
|
1559
1660
|
task.result = { summary: 'Parent verified browser result: ' + evidence, artifactIds: [] };
|
|
1560
1661
|
attempt.result = task.result;
|
|
1662
|
+
if (parked)
|
|
1663
|
+
this.closeVerifiedGoalRun(task);
|
|
1561
1664
|
this.pool.release(task.taskId, true);
|
|
1562
1665
|
this.store.saveAttempt(attempt);
|
|
1563
1666
|
this.store.saveTask(task, task.stateVersion);
|
|
@@ -1574,10 +1677,13 @@ class TaskService {
|
|
|
1574
1677
|
(0, store_1.boundedText)(requestId, 256);
|
|
1575
1678
|
(0, store_1.boundedText)(evidenceId, 128);
|
|
1576
1679
|
return this.command(context, 'verify_computer', { taskId, revision, requestId, evidenceId, evidence }, context.execute, () => {
|
|
1577
|
-
const task = this.owned(taskId, context.conversationId);
|
|
1578
|
-
|
|
1680
|
+
const task = this.owned(taskId, context.conversationId), parked = (0, automation_session_1.agentGoalRunParked)(task);
|
|
1681
|
+
// Also the agent's own goal run that parked (agentGoalRunParked), whatever its last outcome: the
|
|
1682
|
+
// agent woken for it answers from fresh evidence and closes it here (pod-jinawong, task 59e5ce4f).
|
|
1683
|
+
// The adapter's check still demands fresh evidence of this settled round, with no operation in flight.
|
|
1684
|
+
if (task.ownerPrincipalId !== context.principalId || task.gatewayTarget?.adapter !== 'computer' || !['failed', 'waiting_input'].includes(task.state) || task.revision !== revision || task.gatewayDispatch?.requestId !== requestId || !task.computerReport || (task.computerReport.status !== 'needs_verification' && !parked))
|
|
1579
1685
|
throw new types_1.OrchestrationError('COMPUTER_VERIFICATION_UNAVAILABLE');
|
|
1580
|
-
if (!task.capabilities.execute || (!context.execute && !this.store.get("SELECT id FROM notifications WHERE task_id=? AND decision_id=? AND status='assigned' AND task_state_version=?", taskId, context.decisionId, task.stateVersion)))
|
|
1686
|
+
if (!task.capabilities.execute || (!context.execute && !(parked ? this.parkedRoundNotice(context, task) : this.store.get("SELECT id FROM notifications WHERE task_id=? AND decision_id=? AND status='assigned' AND task_state_version=?", taskId, context.decisionId, task.stateVersion))))
|
|
1581
1687
|
throw new types_1.OrchestrationError('EXECUTION_DENIED');
|
|
1582
1688
|
check();
|
|
1583
1689
|
const attemptId = task.activeAttemptId ?? this.store.get("SELECT id FROM task_attempts WHERE task_id=? AND revision=? AND state='ended' ORDER BY generation DESC LIMIT 1", taskId, revision)?.id;
|
|
@@ -1593,6 +1699,8 @@ class TaskService {
|
|
|
1593
1699
|
task.computerReport.reason = 'PARENT_VERIFIED';
|
|
1594
1700
|
task.result = { summary: 'Parent verified computer result: ' + evidence, artifactIds: [] };
|
|
1595
1701
|
attempt.result = task.result;
|
|
1702
|
+
if (parked)
|
|
1703
|
+
this.closeVerifiedGoalRun(task);
|
|
1596
1704
|
this.pool.release(task.taskId, true);
|
|
1597
1705
|
this.store.saveAttempt(attempt);
|
|
1598
1706
|
this.store.saveTask(task, task.stateVersion);
|