@isomorph.ai/app-sdk 1.34.0 → 1.34.1
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 +1 -0
- package/dist/computer-use.d.ts +2 -0
- package/dist/computer-use.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -386,6 +386,7 @@ const computerUse = createComputerUseTool({ runKey: ctx.runId ?? `my-job/${ctx.s
|
|
|
386
386
|
- It calls `progress(step count, note)` on every new step and at least once a minute, so the job's lease does not run out.
|
|
387
387
|
- When `cancelled()` turns true it sends `POST /tasks/cancel` once and keeps checking until the task has `failed`.
|
|
388
388
|
- One task record per `runKey`: a retried job run sends the same key and gets the queued, running or finished task back. Only a failed task starts a new attempt.
|
|
389
|
+
- For a website account the owner has connected in the app, pass its opaque `connectionId` in the options. The SDK sends it only when starting the task, outside the model's tool arguments. The computer-use service verifies that the signed app role owns that connection; omit it for ordinary browser tasks.
|
|
389
390
|
|
|
390
391
|
(1.25.0; data plane ADR 0078)
|
|
391
392
|
|
package/dist/computer-use.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface ComputerUseFile {
|
|
|
6
6
|
export interface ComputerUseOptions {
|
|
7
7
|
/** App-authorized PDFs, at most five files and 2 MiB total. Never supplied by the model. */
|
|
8
8
|
files?: readonly ComputerUseFile[];
|
|
9
|
+
/** Owner-authorized browser session reference. Never supplied by the model. */
|
|
10
|
+
connectionId?: string;
|
|
9
11
|
/** The job's runId, or `<job name>/<scheduledAt>` for a scheduled job: one task record per job run. */
|
|
10
12
|
runKey: string;
|
|
11
13
|
/** The job's progress: called on each new step and at least once a minute, which renews the job's lease. */
|
package/dist/computer-use.js
CHANGED
|
@@ -8,6 +8,10 @@ const HEARTBEAT_MS = 60_000;
|
|
|
8
8
|
// Checks the API did not answer (a throttle, a 5xx, no connection) before the tool gives up: about a minute.
|
|
9
9
|
const MAX_MISSED_CHECKS = 12;
|
|
10
10
|
export function createComputerUseTool(options) {
|
|
11
|
+
const connectionId = options.connectionId;
|
|
12
|
+
if (connectionId !== undefined && (typeof connectionId !== 'string' || !/^[a-f0-9]{32}$/.test(connectionId))) {
|
|
13
|
+
throw new Error('Computer use needs a valid browser connection ID.');
|
|
14
|
+
}
|
|
11
15
|
const files = options.files?.map(file => ({ ...file }));
|
|
12
16
|
if (files) {
|
|
13
17
|
const names = new Set();
|
|
@@ -44,7 +48,7 @@ export function createComputerUseTool(options) {
|
|
|
44
48
|
description: 'Do one task in a web browser, such as filling in and submitting a form on a website. Describe the whole task in plain words, with the website address and any details it needs. Waits until the task ends and returns its status and a summary.',
|
|
45
49
|
inputSchema: jsonSchema({ type: 'object', properties: { task: { type: 'string', minLength: 1 } }, required: ['task'], additionalProperties: false }),
|
|
46
50
|
execute: async ({ task }) => {
|
|
47
|
-
const started = await call('/tasks', { run_key: options.runKey, task, ...(files?.length ? { files } : {}) });
|
|
51
|
+
const started = await call('/tasks', { run_key: options.runKey, task, ...(files?.length ? { files } : {}), ...(connectionId ? { connectionId } : {}) });
|
|
48
52
|
if (started.status !== 200)
|
|
49
53
|
throw refused('/tasks', started.status, started.body);
|
|
50
54
|
await options.progress(0, 'Computer use task started.');
|