@nuanu-ai/agentbrowse 0.2.49 → 0.2.50
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 +22 -7
- package/dist/agentpay-gateway.d.ts +1 -0
- package/dist/agentpay-gateway.d.ts.map +1 -1
- package/dist/agentpay-gateway.js +4 -1
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +46 -61
- package/dist/commands/action-acceptance.d.ts +3 -7
- package/dist/commands/action-acceptance.d.ts.map +1 -1
- package/dist/commands/action-acceptance.js +8 -25
- package/dist/commands/browser-status.d.ts +6 -0
- package/dist/commands/browser-status.d.ts.map +1 -0
- package/dist/commands/browser-status.js +228 -0
- package/dist/commands/close.d.ts.map +1 -1
- package/dist/commands/close.js +35 -30
- package/dist/commands/end-session.d.ts +1 -1
- package/dist/commands/end-session.d.ts.map +1 -1
- package/dist/commands/end-session.js +3 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +32 -25
- package/dist/commands/observe-projection.d.ts +2 -1
- package/dist/commands/observe-projection.d.ts.map +1 -1
- package/dist/commands/observe-projection.js +12 -1
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +62 -92
- package/dist/commands/start-session.d.ts.map +1 -1
- package/dist/commands/start-session.js +15 -11
- package/dist/commands/status.d.ts +22 -2
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +36 -215
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -9
- package/dist/otel-exporter.d.ts.map +1 -1
- package/dist/otel-exporter.js +5 -11
- package/dist/run-store.d.ts +1 -1
- package/dist/run-store.d.ts.map +1 -1
- package/dist/run-store.js +3 -7
- package/dist/secrets/backend.d.ts +0 -1
- package/dist/secrets/backend.d.ts.map +1 -1
- package/dist/secrets/backend.js +0 -1
- package/dist/session-event-exporter.d.ts +1 -3
- package/dist/session-event-exporter.d.ts.map +1 -1
- package/dist/session-event-exporter.js +1 -14
- package/dist/sessions-backend.d.ts +20 -26
- package/dist/sessions-backend.d.ts.map +1 -1
- package/dist/sessions-backend.js +5 -5
- package/dist/solver/captcha-solver.d.ts.map +1 -1
- package/dist/solver/captcha-solver.js +12 -8
- package/dist/workflow-session-completion.d.ts +1 -1
- package/dist/workflow-session-completion.d.ts.map +1 -1
- package/dist/workflow-session-completion.js +23 -3
- package/package.json +1 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* browse browser-status — Check live browser/page/runtime state.
|
|
3
|
+
*/
|
|
4
|
+
import { getSessionPort, loadSession, supportsCaptchaSolve } from '../session.js';
|
|
5
|
+
import { connectPlaywright, disconnectPlaywright, resolveCurrentPageContext, } from '../playwright-runtime.js';
|
|
6
|
+
import { finishRunStep, startRunStep } from '../run-store.js';
|
|
7
|
+
import { appendCommandLifecycleEventBestEffort, captureStepSnapshotBestEffort, } from '../run-observability.js';
|
|
8
|
+
function tryResolveHost(url) {
|
|
9
|
+
if (!url) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
return new URL(url).hostname || undefined;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function buildRuntimeSummary(session) {
|
|
20
|
+
return session?.runtime
|
|
21
|
+
? {
|
|
22
|
+
currentPageRef: session.runtime.currentPageRef,
|
|
23
|
+
pageCount: Object.keys(session.runtime.pages).length,
|
|
24
|
+
surfaceCount: Object.keys(session.runtime.surfaces ?? {}).length,
|
|
25
|
+
targetCount: Object.keys(session.runtime.targets).length,
|
|
26
|
+
metrics: session.runtime.metrics,
|
|
27
|
+
}
|
|
28
|
+
: undefined;
|
|
29
|
+
}
|
|
30
|
+
function buildProtectedStatusPayload(params) {
|
|
31
|
+
return {
|
|
32
|
+
success: true,
|
|
33
|
+
alive: true,
|
|
34
|
+
outcomeType: 'protected_exposure_active',
|
|
35
|
+
...(params.captchaSolveCapable !== undefined
|
|
36
|
+
? { captchaSolveCapable: params.captchaSolveCapable }
|
|
37
|
+
: {}),
|
|
38
|
+
runtime: params.runtimeSummary,
|
|
39
|
+
...(params.currentPageMismatch ? { currentPageMismatch: params.currentPageMismatch } : {}),
|
|
40
|
+
protectedExposureActive: true,
|
|
41
|
+
pageRef: params.pageRef,
|
|
42
|
+
url: params.pageUrl ?? 'unknown',
|
|
43
|
+
title: params.pageTitle ?? 'unknown',
|
|
44
|
+
...(tryResolveHost(params.pageUrl) ? { host: tryResolveHost(params.pageUrl) } : {}),
|
|
45
|
+
fillRef: params.protectedExposure.fillRef,
|
|
46
|
+
requestId: params.protectedExposure.requestId,
|
|
47
|
+
activatedAt: params.protectedExposure.activatedAt,
|
|
48
|
+
exposureReason: params.protectedExposure.reason,
|
|
49
|
+
message: 'Protected values may still be visible on the current page.',
|
|
50
|
+
reason: 'AgentBrowse is treating the current page as sensitive because a protected fill was executed and values may still be visible.',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function readCanonicalStatus(session) {
|
|
54
|
+
let browser = null;
|
|
55
|
+
try {
|
|
56
|
+
browser = await connectPlaywright(session.cdpUrl);
|
|
57
|
+
const resolved = await resolveCurrentPageContext(browser, session);
|
|
58
|
+
const persisted = session.runtime?.currentPageRef;
|
|
59
|
+
const title = (await resolved.page
|
|
60
|
+
.title()
|
|
61
|
+
.catch(() => session.runtime?.pages[resolved.pageRef]?.title ?? '')) ||
|
|
62
|
+
session.runtime?.pages[resolved.pageRef]?.title ||
|
|
63
|
+
'unknown';
|
|
64
|
+
const url = resolved.page.url() || session.runtime?.pages[resolved.pageRef]?.url || 'unknown';
|
|
65
|
+
return {
|
|
66
|
+
pageRef: resolved.pageRef,
|
|
67
|
+
url,
|
|
68
|
+
title,
|
|
69
|
+
...(persisted && (persisted !== resolved.pageRef || resolved.recoveredVia)
|
|
70
|
+
? {
|
|
71
|
+
currentPageMismatch: {
|
|
72
|
+
persistedPageRef: persisted,
|
|
73
|
+
...(persisted !== resolved.pageRef ? { livePageRef: resolved.pageRef } : {}),
|
|
74
|
+
...(resolved.recoveredVia ? { recoveredVia: resolved.recoveredVia } : {}),
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
: {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
if (browser) {
|
|
85
|
+
await disconnectPlaywright(browser);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function readFallbackLiveStatus(port) {
|
|
90
|
+
const res = await fetch(`http://localhost:${port}/json/version`);
|
|
91
|
+
if (!res.ok) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
const listRes = await fetch(`http://localhost:${port}/json/list`);
|
|
95
|
+
const targets = (await listRes.json());
|
|
96
|
+
return targets.find((target) => target.type === 'page' && !target.url.startsWith('devtools://'));
|
|
97
|
+
}
|
|
98
|
+
async function finishBrowserStatusStepBestEffort(session, runId, stepId, result) {
|
|
99
|
+
if (!runId || !stepId) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const step = {
|
|
103
|
+
runId,
|
|
104
|
+
stepId,
|
|
105
|
+
command: 'browser-status',
|
|
106
|
+
};
|
|
107
|
+
captureStepSnapshotBestEffort({
|
|
108
|
+
session: session ?? {
|
|
109
|
+
cdpUrl: '',
|
|
110
|
+
pid: 0,
|
|
111
|
+
launchedAt: new Date(0).toISOString(),
|
|
112
|
+
},
|
|
113
|
+
step,
|
|
114
|
+
phase: 'point-in-time',
|
|
115
|
+
pageRef: typeof result.pageRef === 'string' ? result.pageRef : session?.runtime?.currentPageRef,
|
|
116
|
+
url: typeof result.url === 'string' ? result.url : undefined,
|
|
117
|
+
title: typeof result.title === 'string' ? result.title : undefined,
|
|
118
|
+
});
|
|
119
|
+
appendCommandLifecycleEventBestEffort({
|
|
120
|
+
step,
|
|
121
|
+
phase: result.success ? 'completed' : 'failed',
|
|
122
|
+
attributes: {
|
|
123
|
+
alive: result.alive === true,
|
|
124
|
+
...(typeof result.outcomeType === 'string' ? { outcomeType: result.outcomeType } : {}),
|
|
125
|
+
...(typeof result.pageRef === 'string' ? { pageRef: result.pageRef } : {}),
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
finishRunStep({
|
|
130
|
+
runId,
|
|
131
|
+
stepId,
|
|
132
|
+
success: result.success,
|
|
133
|
+
...(typeof result.outcomeType === 'string'
|
|
134
|
+
? { outcomeType: result.outcomeType }
|
|
135
|
+
: { outcomeType: result.alive === true ? 'browser_alive' : 'browser_not_running' }),
|
|
136
|
+
...(typeof result.message === 'string' ? { message: result.message } : {}),
|
|
137
|
+
...(typeof result.reason === 'string' ? { reason: result.reason } : {}),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Best effort only.
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export async function browserStatus() {
|
|
145
|
+
const session = loadSession();
|
|
146
|
+
const port = getSessionPort(session);
|
|
147
|
+
const runtimeSummary = buildRuntimeSummary(session);
|
|
148
|
+
const statusStep = session?.activeRunId
|
|
149
|
+
? startRunStep({
|
|
150
|
+
runId: session.activeRunId,
|
|
151
|
+
command: 'browser-status',
|
|
152
|
+
input: {
|
|
153
|
+
hasSession: session !== null,
|
|
154
|
+
hasRuntime: Boolean(session?.runtime),
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
: null;
|
|
158
|
+
appendCommandLifecycleEventBestEffort({
|
|
159
|
+
step: statusStep,
|
|
160
|
+
phase: 'started',
|
|
161
|
+
attributes: {
|
|
162
|
+
hasSession: session !== null,
|
|
163
|
+
hasRuntime: Boolean(session?.runtime),
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
if (session) {
|
|
167
|
+
const canonical = await readCanonicalStatus(session);
|
|
168
|
+
if (canonical) {
|
|
169
|
+
const protectedExposure = session.runtime?.protectedExposureByPage?.[canonical.pageRef];
|
|
170
|
+
if (protectedExposure) {
|
|
171
|
+
const result = buildProtectedStatusPayload({
|
|
172
|
+
runtimeSummary,
|
|
173
|
+
pageRef: canonical.pageRef,
|
|
174
|
+
pageUrl: canonical.url,
|
|
175
|
+
pageTitle: canonical.title,
|
|
176
|
+
captchaSolveCapable: supportsCaptchaSolve(session),
|
|
177
|
+
currentPageMismatch: canonical.currentPageMismatch,
|
|
178
|
+
protectedExposure,
|
|
179
|
+
});
|
|
180
|
+
await finishBrowserStatusStepBestEffort(session, session.activeRunId, statusStep?.stepId, result);
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
const result = {
|
|
184
|
+
success: true,
|
|
185
|
+
alive: true,
|
|
186
|
+
captchaSolveCapable: supportsCaptchaSolve(session),
|
|
187
|
+
pageRef: canonical.pageRef,
|
|
188
|
+
url: canonical.url,
|
|
189
|
+
title: canonical.title,
|
|
190
|
+
runtime: runtimeSummary,
|
|
191
|
+
...(canonical.currentPageMismatch
|
|
192
|
+
? { currentPageMismatch: canonical.currentPageMismatch }
|
|
193
|
+
: {}),
|
|
194
|
+
};
|
|
195
|
+
await finishBrowserStatusStepBestEffort(session, session.activeRunId, statusStep?.stepId, result);
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
const page = await readFallbackLiveStatus(port);
|
|
201
|
+
if (!page) {
|
|
202
|
+
const result = { success: true, alive: false, runtime: runtimeSummary };
|
|
203
|
+
await finishBrowserStatusStepBestEffort(session, session?.activeRunId, statusStep?.stepId, result);
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
const result = {
|
|
207
|
+
success: true,
|
|
208
|
+
alive: true,
|
|
209
|
+
...(session ? { captchaSolveCapable: supportsCaptchaSolve(session) } : {}),
|
|
210
|
+
url: page.url ?? 'unknown',
|
|
211
|
+
title: page.title ?? 'unknown',
|
|
212
|
+
...(session?.runtime ? { currentPageUnresolved: true } : {}),
|
|
213
|
+
runtime: runtimeSummary,
|
|
214
|
+
};
|
|
215
|
+
await finishBrowserStatusStepBestEffort(session, session?.activeRunId, statusStep?.stepId, result);
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
const result = {
|
|
220
|
+
success: true,
|
|
221
|
+
alive: false,
|
|
222
|
+
...(session?.runtime ? { currentPageUnresolved: true } : {}),
|
|
223
|
+
runtime: runtimeSummary,
|
|
224
|
+
};
|
|
225
|
+
await finishBrowserStatusStepBestEffort(session, session?.activeRunId, statusStep?.stepId, result);
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../src/commands/close.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EACD,sBAAsB,GACtB,8BAA8B,GAC9B,0BAA0B,GAC1B,2BAA2B,GAC3B,kCAAkC,CAAC;IACvC,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,OAAO,EAAE,uBAAuB,GAAG,wDAAwD,CAAC;IAC5F,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../src/commands/close.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EACD,sBAAsB,GACtB,8BAA8B,GAC9B,0BAA0B,GAC1B,2BAA2B,GAC3B,kCAAkC,CAAC;IACvC,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,OAAO,EAAE,uBAAuB,GAAG,wDAAwD,CAAC;IAC5F,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AA8FlE,wBAAsB,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC,CAyIlD"}
|
package/dist/commands/close.js
CHANGED
|
@@ -9,6 +9,12 @@ import { info } from '../output.js';
|
|
|
9
9
|
import { closeOwnedBrowser } from '../owned-browser.js';
|
|
10
10
|
import { isManagedBrowserPid } from '../owned-process.js';
|
|
11
11
|
import { completeWorkflowSessionRemote } from '../workflow-session-completion.js';
|
|
12
|
+
function isNonBlockingWorkflowCompletionFailure(error) {
|
|
13
|
+
return (error === 'workflow_session_unavailable' ||
|
|
14
|
+
error === 'workflow_session_already_closed' ||
|
|
15
|
+
error === 'workflow_run_unavailable' ||
|
|
16
|
+
error === 'workflow_step_unavailable');
|
|
17
|
+
}
|
|
12
18
|
function isCloseableManagedSession(session) {
|
|
13
19
|
if (!session) {
|
|
14
20
|
return false;
|
|
@@ -136,37 +142,36 @@ export async function close() {
|
|
|
136
142
|
reason: 'The active browser session was closed by the close command.',
|
|
137
143
|
});
|
|
138
144
|
if (!remoteCompletion.success) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
:
|
|
145
|
+
if (isNonBlockingWorkflowCompletionFailure(remoteCompletion.error)) {
|
|
146
|
+
info(`[close] clearing stale workflow state after browser close: ${remoteCompletion.reason}`);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const reason = remoteCompletion.reason;
|
|
150
|
+
const failureError = 'workflow_session_complete_failed';
|
|
151
|
+
const failureMessage = 'Browser closed but workflow session completion failed.';
|
|
152
|
+
appendCommandLifecycleEventBestEffort({
|
|
153
|
+
step: closeStep,
|
|
154
|
+
phase: 'failed',
|
|
155
|
+
attributes: {
|
|
156
|
+
outcomeType: failureError,
|
|
157
|
+
reason,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
await finalizeStepBestEffort(session?.activeRunId, closeStep?.stepId, {
|
|
161
|
+
success: false,
|
|
162
|
+
outcomeType: failureError,
|
|
163
|
+
message: failureMessage,
|
|
151
164
|
reason,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
return {
|
|
164
|
-
success: false,
|
|
165
|
-
error: failureError,
|
|
166
|
-
outcomeType: remoteCompletion.error === 'backend_session_complete_failed' ? 'failed' : 'blocked',
|
|
167
|
-
message: failureMessage,
|
|
168
|
-
reason,
|
|
169
|
-
};
|
|
165
|
+
skipExport: true,
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
success: false,
|
|
169
|
+
error: failureError,
|
|
170
|
+
outcomeType: 'failed',
|
|
171
|
+
message: failureMessage,
|
|
172
|
+
reason,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
appendCommandLifecycleEventBestEffort({
|
|
@@ -15,7 +15,7 @@ export type EndSessionSuccessResult = {
|
|
|
15
15
|
};
|
|
16
16
|
export type EndSessionFailureResult = {
|
|
17
17
|
success: false;
|
|
18
|
-
error: 'workflow_session_unavailable' | 'workflow_run_unavailable' | 'workflow_step_unavailable' | 'backend_session_complete_failed';
|
|
18
|
+
error: 'workflow_session_unavailable' | 'workflow_session_already_closed' | 'workflow_run_unavailable' | 'workflow_step_unavailable' | 'backend_session_complete_failed';
|
|
19
19
|
outcomeType: 'blocked' | 'failed';
|
|
20
20
|
message: 'Workflow session end failed.';
|
|
21
21
|
reason: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-session.d.ts","sourceRoot":"","sources":["../../src/commands/end-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAOhE,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,4BAA4B,CAAC;IAC1C,OAAO,EAAE,6BAA6B,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EACD,8BAA8B,GAC9B,0BAA0B,GAC1B,2BAA2B,GAC3B,iCAAiC,CAAC;IACtC,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,OAAO,EAAE,8BAA8B,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"end-session.d.ts","sourceRoot":"","sources":["../../src/commands/end-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAOhE,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,4BAA4B,CAAC;IAC1C,OAAO,EAAE,6BAA6B,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EACD,8BAA8B,GAC9B,iCAAiC,GACjC,0BAA0B,GAC1B,2BAA2B,GAC3B,iCAAiC,CAAC;IACtC,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,OAAO,EAAE,8BAA8B,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AA4DjF,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4IlF"}
|
|
@@ -91,7 +91,9 @@ export async function endSession(session) {
|
|
|
91
91
|
message: 'Workflow session completed.',
|
|
92
92
|
});
|
|
93
93
|
if (!remoteCompletion.success) {
|
|
94
|
-
const outcomeType = remoteCompletion.error === 'backend_session_complete_failed'
|
|
94
|
+
const outcomeType = remoteCompletion.error === 'backend_session_complete_failed'
|
|
95
|
+
? 'backend_session_complete_failed'
|
|
96
|
+
: 'blocked';
|
|
95
97
|
appendCommandLifecycleEventBestEffort({
|
|
96
98
|
step: endSessionStepHandle,
|
|
97
99
|
phase: 'failed',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/commands/launch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgCH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,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EF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,uBAAuB,CAAC;IAC/B,WAAW,EAAE,SAAS,CAAC;IACvB,OAAO,EAAE,wBAAwB,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAErE,wBAAsB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAazF"}
|
package/dist/commands/launch.js
CHANGED
|
@@ -20,10 +20,7 @@ const COMPACT_WINDOW = {
|
|
|
20
20
|
export async function launch(url, opts) {
|
|
21
21
|
const existingSession = loadSession();
|
|
22
22
|
pruneLocalRunsBestEffort('launch', existingSession?.activeRunId);
|
|
23
|
-
|
|
24
|
-
if (cleanupFailure) {
|
|
25
|
-
return cleanupFailure;
|
|
26
|
-
}
|
|
23
|
+
await cleanupOwnedSession(existingSession);
|
|
27
24
|
const compact = opts?.compact ?? true;
|
|
28
25
|
const profileName = opts?.profile ?? DEFAULT_PROFILE;
|
|
29
26
|
const headless = opts?.headless ?? false;
|
|
@@ -33,36 +30,42 @@ export async function launch(url, opts) {
|
|
|
33
30
|
}
|
|
34
31
|
async function cleanupOwnedSession(existingSession) {
|
|
35
32
|
const excludePids = new Set();
|
|
36
|
-
|
|
37
|
-
if (workflowCleanupFailure) {
|
|
38
|
-
return workflowCleanupFailure;
|
|
39
|
-
}
|
|
33
|
+
await cleanupPreviousWorkflowState(existingSession);
|
|
40
34
|
if (isOwnedSession(existingSession)) {
|
|
41
35
|
excludePids.add(existingSession.pid);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
try {
|
|
37
|
+
if (await isSessionAlive(existingSession)) {
|
|
38
|
+
const closeResult = await closeOwnedBrowser(existingSession);
|
|
39
|
+
if (!closeResult.success) {
|
|
40
|
+
info(`[launch] previous managed browser close failed before relaunch: ${closeResult.reason}; continuing with fresh launch attempt`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
info(`[launch] previous managed browser pid ${existingSession.pid} was already gone; closing active workflow context before relaunch`);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
info(`[launch] previous managed browser
|
|
47
|
+
catch (error) {
|
|
48
|
+
info(`[launch] previous managed browser cleanup failed before relaunch: ${formatUnknownError(error)}; continuing with fresh launch attempt`);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
// Phase-1 ownership removed port-global prekill, so launch needs a second guardrail
|
|
53
52
|
// for crashes that happen before a session record is persisted or cleaned up.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
try {
|
|
54
|
+
const orphanCleanup = await cleanupManagedBrowserPids({ excludePids });
|
|
55
|
+
if (orphanCleanup.blocked.length > 0) {
|
|
56
|
+
info(`[launch] orphaned managed browser pid${orphanCleanup.blocked.length === 1 ? '' : 's'} ${orphanCleanup.blocked.join(', ')} remained alive before relaunch; continuing with fresh launch attempt`);
|
|
57
|
+
}
|
|
58
|
+
if (orphanCleanup.terminated.length > 0) {
|
|
59
|
+
info(`[launch] cleaned up orphaned managed browser pid${orphanCleanup.terminated.length === 1 ? '' : 's'} ${orphanCleanup.terminated.join(', ')}`);
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
|
-
|
|
59
|
-
info(`[launch]
|
|
62
|
+
catch (error) {
|
|
63
|
+
info(`[launch] orphaned managed browser cleanup failed before relaunch: ${formatUnknownError(error)}; continuing with fresh launch attempt`);
|
|
60
64
|
}
|
|
61
|
-
return null;
|
|
62
65
|
}
|
|
63
66
|
async function cleanupPreviousWorkflowState(existingSession) {
|
|
64
67
|
if (!existingSession) {
|
|
65
|
-
return
|
|
68
|
+
return;
|
|
66
69
|
}
|
|
67
70
|
if (existingSession.intentSessionId) {
|
|
68
71
|
const remoteCompletion = await completeWorkflowSessionRemote({
|
|
@@ -80,10 +83,12 @@ async function cleanupPreviousWorkflowState(existingSession) {
|
|
|
80
83
|
if (!remoteCompletion.success) {
|
|
81
84
|
if (isStaleWorkflowBindingFailure(remoteCompletion.error)) {
|
|
82
85
|
info(`[launch] clearing stale workflow binding before relaunch: ${remoteCompletion.reason}`);
|
|
83
|
-
|
|
86
|
+
if (remoteCompletion.error === 'workflow_run_unavailable') {
|
|
87
|
+
deleteStaleRunBestEffort('launch', existingSession.activeRunId);
|
|
88
|
+
}
|
|
84
89
|
}
|
|
85
90
|
else {
|
|
86
|
-
|
|
91
|
+
info(`[launch] active workflow session cleanup failed before relaunch: ${remoteCompletion.reason}; continuing with forced local reset`);
|
|
87
92
|
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
@@ -97,10 +102,12 @@ async function cleanupPreviousWorkflowState(existingSession) {
|
|
|
97
102
|
},
|
|
98
103
|
});
|
|
99
104
|
persistClearedWorkflowStateBestEffort('launch', existingSession);
|
|
100
|
-
return null;
|
|
101
105
|
}
|
|
102
106
|
function isStaleWorkflowBindingFailure(error) {
|
|
103
|
-
return error === '
|
|
107
|
+
return (error === 'workflow_session_unavailable' ||
|
|
108
|
+
error === 'workflow_session_already_closed' ||
|
|
109
|
+
error === 'workflow_run_unavailable' ||
|
|
110
|
+
error === 'workflow_step_unavailable');
|
|
104
111
|
}
|
|
105
112
|
function pruneLocalRunsBestEffort(command, activeRunId) {
|
|
106
113
|
try {
|
|
@@ -21,6 +21,7 @@ export type GoalObserveTargetCandidate = DomObservedTarget & {
|
|
|
21
21
|
goalTargetKey: string;
|
|
22
22
|
};
|
|
23
23
|
export type GoalObserveInventoryCandidate = GoalObserveTargetCandidate | GoalObserveScopeCandidate;
|
|
24
|
+
type AgentFacingTargetValidationEvidence = Omit<TargetValidationEvidence, 'required'>;
|
|
24
25
|
type ExpandWorkflowGraphTargetOptions = {
|
|
25
26
|
selectedSurfaceIds?: ReadonlySet<string>;
|
|
26
27
|
};
|
|
@@ -34,7 +35,7 @@ export declare function compactTargets(targets: ReadonlyArray<Pick<TargetDescrip
|
|
|
34
35
|
inputName?: string;
|
|
35
36
|
inputType?: string;
|
|
36
37
|
autocomplete?: string;
|
|
37
|
-
validation?:
|
|
38
|
+
validation?: AgentFacingTargetValidationEvidence;
|
|
38
39
|
context?: string;
|
|
39
40
|
state?: Record<string, string | boolean | number>;
|
|
40
41
|
structure?: TargetDescriptor['structure'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe-projection.d.ts","sourceRoot":"","sources":["../../src/commands/observe-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAY/D,MAAM,MAAM,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,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|
@@ -67,6 +67,17 @@ function selectedSurfaceSelectorsOf(selectedTargets) {
|
|
|
67
67
|
}
|
|
68
68
|
return selectors;
|
|
69
69
|
}
|
|
70
|
+
function compactValidationEvidence(validation) {
|
|
71
|
+
if (!validation) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const compacted = {
|
|
75
|
+
invalid: validation.invalid,
|
|
76
|
+
message: validation.message,
|
|
77
|
+
errorStyling: validation.errorStyling,
|
|
78
|
+
};
|
|
79
|
+
return Object.values(compacted).some((value) => value !== undefined) ? compacted : undefined;
|
|
80
|
+
}
|
|
70
81
|
function selectedSurfaceRefsOf(selectedTargets) {
|
|
71
82
|
return new Set(selectedTargets
|
|
72
83
|
.map((target) => target.surfaceRef?.trim())
|
|
@@ -325,7 +336,7 @@ export function compactTargets(targets) {
|
|
|
325
336
|
inputName: target.inputName,
|
|
326
337
|
inputType: target.inputType,
|
|
327
338
|
autocomplete: target.autocomplete,
|
|
328
|
-
validation: target.validation,
|
|
339
|
+
validation: compactValidationEvidence(target.validation),
|
|
329
340
|
context: summarizeContext(target.context),
|
|
330
341
|
state: target.semantics?.states,
|
|
331
342
|
structure: target.structure,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../src/commands/observe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AA+DnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../src/commands/observe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AA+DnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAwJ/D,eAAO,MAAM,yBAAyB;;;;iBAkXrB,CAAC;gBAAwB,CAAC;;;;;CAlX0B,CAAC;AACtE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGrC,CAAC;AAEF,wBAAsB,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8XzF"}
|