agents-relay 2.0.35 → 2.0.37
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/adapters.js
CHANGED
|
@@ -165,9 +165,12 @@ function parseDriverJson(output) {
|
|
|
165
165
|
}
|
|
166
166
|
throw new Error('browser-worker driver returned no submitted receipt');
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function browserWorkspaceCli(override = process.env.AGENTS_RELAY_BROWSER_WORKSPACE_COMMAND) {
|
|
169
|
+
return override ? { command: override, prefix: [] } : { command: 'npx', prefix: ['browser-workspace'] };
|
|
170
|
+
}
|
|
171
|
+
function browserWorkspaceCommand(cli, args, stdin) {
|
|
169
172
|
return new Promise((resolve, reject) => {
|
|
170
|
-
const child = spawn(command, [...args], { shell: false, stdio: [stdin === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'] });
|
|
173
|
+
const child = spawn(cli.command, [...cli.prefix, ...args], { shell: false, stdio: [stdin === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'] });
|
|
171
174
|
let stdout = '';
|
|
172
175
|
let stderr = '';
|
|
173
176
|
child.stdout?.on('data', (chunk) => { stdout += chunk.toString(); });
|
|
@@ -194,11 +197,11 @@ function parseWorkspaceJson(output) {
|
|
|
194
197
|
}
|
|
195
198
|
throw new Error('browser-workspace returned no JSON result');
|
|
196
199
|
}
|
|
197
|
-
export async function ensureChatGptBrowserWorkspace(command = process.env.AGENTS_RELAY_BROWSER_WORKSPACE_COMMAND
|
|
198
|
-
await browserWorkspaceCommand(command, ['create', CHATGPT_BROWSER_WORKSPACE, String(CHATGPT_BROWSER_WORKSPACE_POOL_SIZE)]);
|
|
200
|
+
export async function ensureChatGptBrowserWorkspace(command = process.env.AGENTS_RELAY_BROWSER_WORKSPACE_COMMAND) {
|
|
201
|
+
await browserWorkspaceCommand(browserWorkspaceCli(command), ['create', CHATGPT_BROWSER_WORKSPACE, String(CHATGPT_BROWSER_WORKSPACE_POOL_SIZE)]);
|
|
199
202
|
}
|
|
200
203
|
function sessionBrowserWorkerRunner(root) {
|
|
201
|
-
const
|
|
204
|
+
const cli = browserWorkspaceCli();
|
|
202
205
|
return (_definition, request, _route, signal) => {
|
|
203
206
|
const policy = request.tabClosePolicy ?? 'after-start';
|
|
204
207
|
let activeSessionId;
|
|
@@ -231,7 +234,7 @@ function sessionBrowserWorkerRunner(root) {
|
|
|
231
234
|
close_policy: policy,
|
|
232
235
|
release_file: '',
|
|
233
236
|
}));
|
|
234
|
-
const startOutput = await browserWorkspaceCommand(
|
|
237
|
+
const startOutput = await browserWorkspaceCommand(cli, ['session', 'start', '--workspace', CHATGPT_BROWSER_WORKSPACE]);
|
|
235
238
|
const started = parseWorkspaceJson(startOutput);
|
|
236
239
|
if (typeof started.session_id !== 'string') {
|
|
237
240
|
throw new Error('browser-workspace session start returned no session_id');
|
|
@@ -245,7 +248,7 @@ function sessionBrowserWorkerRunner(root) {
|
|
|
245
248
|
submitSource.replace(/^from browser_harness import \*\s*$/m, ''),
|
|
246
249
|
temporarySource.replace(/^_wait_for_release\(\)\s*$/m, ''),
|
|
247
250
|
].join('\n\n').replaceAll('__CFG_PATH__', escapedConfig);
|
|
248
|
-
const execOutput = await browserWorkspaceCommand(
|
|
251
|
+
const execOutput = await browserWorkspaceCommand(cli, ['session', 'exec', activeSessionId], source);
|
|
249
252
|
const wrapper = parseWorkspaceJson(execOutput);
|
|
250
253
|
if (wrapper.ok !== true) {
|
|
251
254
|
throw new Error(typeof wrapper.error === 'string' ? wrapper.error : 'browser-workspace session exec failed');
|
|
@@ -260,14 +263,14 @@ function sessionBrowserWorkerRunner(root) {
|
|
|
260
263
|
}
|
|
261
264
|
await releaseBarrier;
|
|
262
265
|
if (activeSessionId) {
|
|
263
|
-
await browserWorkspaceCommand(
|
|
266
|
+
await browserWorkspaceCommand(cli, ['session', 'stop', activeSessionId]);
|
|
264
267
|
activeSessionId = undefined;
|
|
265
268
|
}
|
|
266
269
|
return result;
|
|
267
270
|
}
|
|
268
271
|
catch (failure) {
|
|
269
272
|
if (activeSessionId) {
|
|
270
|
-
await browserWorkspaceCommand(
|
|
273
|
+
await browserWorkspaceCommand(cli, ['session', 'stop', activeSessionId]).catch(() => { });
|
|
271
274
|
activeSessionId = undefined;
|
|
272
275
|
}
|
|
273
276
|
await unlink(configFile).catch(() => { });
|
|
@@ -279,7 +282,7 @@ function sessionBrowserWorkerRunner(root) {
|
|
|
279
282
|
const cancel = () => {
|
|
280
283
|
release();
|
|
281
284
|
if (activeSessionId) {
|
|
282
|
-
void browserWorkspaceCommand(
|
|
285
|
+
void browserWorkspaceCommand(cli, ['session', 'stop', activeSessionId]);
|
|
283
286
|
activeSessionId = undefined;
|
|
284
287
|
}
|
|
285
288
|
};
|
package/package.json
CHANGED
|
@@ -44,15 +44,18 @@ Task input should include, as applicable:
|
|
|
44
44
|
|
|
45
45
|
Do not require a producer to invent a root cause or solution that is not known yet.
|
|
46
46
|
|
|
47
|
-
Task
|
|
47
|
+
Every executing Task worker must make both of these explicit in its durable Task result:
|
|
48
|
+
|
|
49
|
+
- **root cause** — for bug, incident, failure, diagnostic, or recovery work, state the confirmed cause; if it cannot be determined, say so and preserve the remaining uncertainty. For feature, refactor, research, review, or other work with no failure cause to diagnose, explicitly state that root cause is not applicable and why rather than omitting it.
|
|
50
|
+
- **implemented solution** — describe what was actually changed or done. For read-only research or review work, state the concrete findings, recommendation, or resolution produced by the Task rather than omitting the solution.
|
|
51
|
+
|
|
52
|
+
Task results should also include, as applicable:
|
|
48
53
|
|
|
49
|
-
- **root cause** for bug, incident, failure, diagnostic, or recovery work; if an investigation cannot determine it, state that explicitly with the remaining uncertainty;
|
|
50
|
-
- **implemented solution**, describing what was actually changed or done;
|
|
51
54
|
- **deviations** from any proposed or required solution, with the reason;
|
|
52
55
|
- **validation** showing how the result was verified;
|
|
53
56
|
- relevant changed files, commits, PR comments, artifacts, or remaining issues.
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
This is a worker result-content contract, not a requirement for dedicated `rootCause` / `solution` schema fields. Workers may satisfy it in normal durable result prose unless a Job defines a stricter structured output contract.
|
|
56
59
|
|
|
57
60
|
Keep these concepts distinct: observation is not root cause; hypothesis is not root cause; requested approach is not implemented solution; implementation is not validation.
|
|
58
61
|
|