@intentic/machine 1.308.2 → 1.310.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 +52 -2
- package/dist/daemon-base.d.ts +7 -0
- package/dist/daemon-base.d.ts.map +1 -1
- package/dist/daemon-base.js +22 -0
- package/dist/daemon-base.js.map +1 -1
- package/dist/device/commands.d.ts.map +1 -1
- package/dist/device/commands.js +12 -41
- package/dist/device/commands.js.map +1 -1
- package/dist/device/connection.d.ts +2 -1
- package/dist/device/connection.d.ts.map +1 -1
- package/dist/device/connection.js +13 -2
- package/dist/device/connection.js.map +1 -1
- package/dist/device/indicator.d.ts +28 -0
- package/dist/device/indicator.d.ts.map +1 -0
- package/dist/device/indicator.js +115 -0
- package/dist/device/indicator.js.map +1 -0
- package/dist/device/mcp.d.ts.map +1 -1
- package/dist/device/mcp.js +62 -8
- package/dist/device/mcp.js.map +1 -1
- package/dist/device/policy.d.ts +4 -1
- package/dist/device/policy.d.ts.map +1 -1
- package/dist/device/policy.js +23 -5
- package/dist/device/policy.js.map +1 -1
- package/dist/device/router.d.ts +2 -0
- package/dist/device/router.d.ts.map +1 -1
- package/dist/device/router.js +4 -3
- package/dist/device/router.js.map +1 -1
- package/dist/device/tools/agent.d.ts.map +1 -1
- package/dist/device/tools/agent.js +9 -12
- package/dist/device/tools/agent.js.map +1 -1
- package/dist/device/tools/apps.d.ts +3 -2
- package/dist/device/tools/apps.d.ts.map +1 -1
- package/dist/device/tools/apps.js +5 -2
- package/dist/device/tools/apps.js.map +1 -1
- package/dist/device/tools/describe.d.ts +0 -1
- package/dist/device/tools/describe.d.ts.map +1 -1
- package/dist/device/tools/describe.js +3 -12
- package/dist/device/tools/describe.js.map +1 -1
- package/dist/device/tools/device.d.ts +2 -1
- package/dist/device/tools/device.d.ts.map +1 -1
- package/dist/device/tools/device.js +30 -37
- package/dist/device/tools/device.js.map +1 -1
- package/dist/device/tools/files.d.ts +14 -2
- package/dist/device/tools/files.d.ts.map +1 -1
- package/dist/device/tools/files.js +164 -16
- package/dist/device/tools/files.js.map +1 -1
- package/dist/device/tools/sandboxes.d.ts +7 -4
- package/dist/device/tools/sandboxes.d.ts.map +1 -1
- package/dist/device/tools/sandboxes.js +22 -10
- package/dist/device/tools/sandboxes.js.map +1 -1
- package/dist/device/tools/shell.d.ts +7 -2
- package/dist/device/tools/shell.d.ts.map +1 -1
- package/dist/device/tools/shell.js +101 -43
- package/dist/device/tools/shell.js.map +1 -1
- package/dist/environments/auto-upgrade.d.ts +1 -1
- package/dist/environments/auto-upgrade.d.ts.map +1 -1
- package/dist/environments/auto-upgrade.js +4 -10
- package/dist/environments/auto-upgrade.js.map +1 -1
- package/dist/environments/commands.d.ts.map +1 -1
- package/dist/environments/commands.js +6 -6
- package/dist/environments/commands.js.map +1 -1
- package/dist/environments/crossing.d.ts +2 -5
- package/dist/environments/crossing.d.ts.map +1 -1
- package/dist/environments/crossing.js +6 -6
- package/dist/environments/crossing.js.map +1 -1
- package/dist/environments/machine-upgrade.d.ts +2 -1
- package/dist/environments/machine-upgrade.d.ts.map +1 -1
- package/dist/environments/machine-upgrade.js +24 -20
- package/dist/environments/machine-upgrade.js.map +1 -1
- package/dist/environments/machine.d.ts +1 -0
- package/dist/environments/machine.d.ts.map +1 -1
- package/dist/environments/machine.js +2 -1
- package/dist/environments/machine.js.map +1 -1
- package/dist/install.d.ts +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +5 -13
- package/dist/install.js.map +1 -1
- package/dist/release.d.ts +1 -10
- package/dist/release.d.ts.map +1 -1
- package/dist/release.js +4 -16
- package/dist/release.js.map +1 -1
- package/dist/resident.d.ts.map +1 -1
- package/dist/resident.js +6 -9
- package/dist/resident.js.map +1 -1
- package/dist/status.d.ts +1 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +16 -5
- package/dist/status.js.map +1 -1
- package/dist/supervision.d.ts.map +1 -1
- package/dist/supervision.js +12 -14
- package/dist/supervision.js.map +1 -1
- package/dist/sync/commands.d.ts.map +1 -1
- package/dist/sync/commands.js +91 -141
- package/dist/sync/commands.js.map +1 -1
- package/dist/sync/mutagen.d.ts.map +1 -1
- package/dist/sync/mutagen.js +6 -9
- package/dist/sync/mutagen.js.map +1 -1
- package/dist/sync/residue.d.ts +1 -1
- package/dist/sync/residue.d.ts.map +1 -1
- package/dist/sync/residue.js +17 -47
- package/dist/sync/residue.js.map +1 -1
- package/dist/upgrade.d.ts +1 -2
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +6 -13
- package/dist/upgrade.js.map +1 -1
- package/dist/wsl.d.ts +3 -0
- package/dist/wsl.d.ts.map +1 -1
- package/dist/wsl.js +5 -2
- package/dist/wsl.js.map +1 -1
- package/package.json +8 -8
package/dist/device/mcp.js
CHANGED
|
@@ -7,7 +7,7 @@ import { z } from "zod";
|
|
|
7
7
|
import { audit } from "./audit.js";
|
|
8
8
|
import { assertScope, ScopeError } from "./policy.js";
|
|
9
9
|
import { describeText } from "./tools/describe.js";
|
|
10
|
-
import { listDirectory, readTextFile, trashFile, writeTextFile } from "./tools/files.js";
|
|
10
|
+
import { editTextFile, listDirectory, readTextFile, trashFile, writeTextFile } from "./tools/files.js";
|
|
11
11
|
import { focusWindow, listWindows, openTarget, readClipboard, writeClipboard } from "./tools/apps.js";
|
|
12
12
|
import { clickElement, fillElement, listTabs, openPage, pressKey, readPage, selectTab, snapshotPage } from "./tools/browser.js";
|
|
13
13
|
import { act, describeAction, settle } from "./tools/device.js";
|
|
@@ -36,12 +36,14 @@ const TOOLS = [
|
|
|
36
36
|
tool({
|
|
37
37
|
name: "describe",
|
|
38
38
|
description: "What this device is: OS and version, CPU architecture, the exact shell run_command uses, the home directory, the folders you may touch, and which permissions are on. Call this once before your first command here, it is the difference between writing for this machine and guessing.",
|
|
39
|
+
effect: "read",
|
|
39
40
|
input: NO_ARGS,
|
|
40
41
|
run: async (_args, scopes) => textResult(await describeText(scopes)),
|
|
41
42
|
}),
|
|
42
43
|
tool({
|
|
43
44
|
name: "run_command",
|
|
44
|
-
description: "Run a command on this device and get back its exit code, stdout and stderr. The shell is PowerShell on Windows and the user's login shell elsewhere (see describe). On a Windows PC with WSL, `in: \"wsl:<distro>\"` runs the command inside that distro through sh -lc instead, and inside a WSL distro `in: \"windows\"` runs it in PowerShell on the Windows side: the same PC, the other environment, with no quoting through the first shell. There is no terminal for anyone to type into: a command that prompts will fail rather than wait. Commands that DELETE (a recursive delete, a formatted disk, a removed Docker volume) need this device's \"Run destructive commands\" switch, which is off unless its owner turned it on: they are refused with a message naming the switch, so ask the owner to turn it on rather than looking for a spelling that gets past it. Prefer one script that does the whole job over many small calls, every call is a network round trip to somebody's laptop.",
|
|
45
|
+
description: "Run a command on this device and get back its exit code, stdout and stderr. The shell is PowerShell on Windows and the user's login shell elsewhere (see describe). On a Windows PC with WSL, `in: \"wsl:<distro>\"` runs the command inside that distro through sh -lc instead, and inside a WSL distro `in: \"windows\"` runs it in PowerShell on the Windows side: the same PC, the other environment, with no quoting through the first shell. There is no terminal for anyone to type into: a command that prompts will fail rather than wait. At the deadline the command is stopped together with everything it started. The call returns once the command itself exits: a process it leaves running in the background keeps running, but nothing it prints after that is collected, so start one with its output redirected to a file (`> out.log 2>&1`). Very long output comes back as its start and its end, with the middle cut and counted. Commands that DELETE (a recursive delete, a formatted disk, a removed Docker volume) need this device's \"Run destructive commands\" switch, which is off unless its owner turned it on: they are refused with a message naming the switch, so ask the owner to turn it on rather than looking for a spelling that gets past it. Prefer one script that does the whole job over many small calls, every call is a network round trip to somebody's laptop.",
|
|
46
|
+
effect: "destructive",
|
|
45
47
|
input: z.object({
|
|
46
48
|
command: required.describe("The command line to run, in the shell of the environment it runs in."),
|
|
47
49
|
cwd: required
|
|
@@ -64,49 +66,86 @@ const TOOLS = [
|
|
|
64
66
|
}),
|
|
65
67
|
tool({
|
|
66
68
|
name: "read_file",
|
|
67
|
-
description: "Read a text file on this device
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
description: "Read a text file on this device, within the folders this machine allows. Answers with the text, then a note giving the file's revision, which write_file and edit_file need to change it, and, when you read part of it, how much remains and the offset to continue from. Without offset and limit it is the whole file; one too long for a single answer is refused with its line count, to be read in parts. Line endings come back as LF whatever the file uses. Binary files are refused.",
|
|
70
|
+
effect: "read",
|
|
71
|
+
input: z.object({
|
|
72
|
+
path: required,
|
|
73
|
+
offset: z.int().positive().optional().describe("The line to start from, counting from 1. Default 1."),
|
|
74
|
+
limit: z.int().positive().optional().describe("How many lines to read from there. Default: to the end of the file."),
|
|
75
|
+
}),
|
|
76
|
+
run: async ({ path, offset, limit }, scopes) => {
|
|
77
|
+
const read = await readTextFile(path, { offset, limit }, scopes);
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{ type: "text", text: read.text },
|
|
81
|
+
{ type: "text", text: read.note },
|
|
82
|
+
],
|
|
83
|
+
isError: false,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
70
86
|
}),
|
|
71
87
|
tool({
|
|
72
88
|
name: "write_file",
|
|
73
|
-
description: "Create a file or replace
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
description: "Create a file, or replace a file's whole contents. Replacing a file that exists needs the `revision` your last read_file, write_file or edit_file of it answered with, and is refused if the file has changed since; creating one needs none. A replaced file keeps its encoding (UTF-8, UTF-8 with BOM, UTF-16LE) and its line endings (CRLF or LF), whatever you send. To change part of a file, edit_file is cheaper and safer. Requires the 'Create and change files' permission, which is OFF unless the user turned it on.",
|
|
90
|
+
effect: "destructive",
|
|
91
|
+
input: z.object({
|
|
92
|
+
path: required,
|
|
93
|
+
content: z.string(),
|
|
94
|
+
revision: required.optional().describe("The file's revision from read_file. Required to replace a file that exists; omit it to create one."),
|
|
95
|
+
}),
|
|
96
|
+
run: async ({ path, content, revision }, scopes) => textResult(await writeTextFile(path, content, revision, scopes)),
|
|
97
|
+
}),
|
|
98
|
+
tool({
|
|
99
|
+
name: "edit_file",
|
|
100
|
+
description: "Replace one exact piece of a file's text with another. `old_string` has to appear in the file exactly once, whitespace and indentation included, as read_file shows it (LF line endings): include a line or two around it to make it unique. Needs the `revision` your last read_file, write_file or edit_file of the file answered with, and is refused if the file has changed since; it answers with the new revision, so a run of edits needs no re-read. The file keeps its encoding and line endings. Requires the 'Create and change files' permission, which is OFF unless the user turned it on.",
|
|
101
|
+
effect: "write",
|
|
102
|
+
input: z.object({
|
|
103
|
+
path: required,
|
|
104
|
+
old_string: required.describe("The text to replace, exactly as read_file shows it."),
|
|
105
|
+
new_string: z.string().describe("What replaces it."),
|
|
106
|
+
revision: required.describe("The file's revision from read_file, or from the write or edit that last changed it."),
|
|
107
|
+
}),
|
|
108
|
+
run: async ({ path, old_string: oldString, new_string: newString, revision }, scopes) => textResult(await editTextFile(path, { oldString, newString, revision }, scopes)),
|
|
76
109
|
}),
|
|
77
110
|
tool({
|
|
78
111
|
name: "list_dir",
|
|
79
112
|
description: "List a directory, with each entry's kind, size and modification time.",
|
|
113
|
+
effect: "read",
|
|
80
114
|
input: z.object({ path: required }),
|
|
81
115
|
run: async ({ path }, scopes) => textResult(JSON.stringify(await listDirectory(path, scopes), undefined, 2)),
|
|
82
116
|
}),
|
|
83
117
|
tool({
|
|
84
118
|
name: "trash_file",
|
|
85
119
|
description: "Move a file into this agent's trash folder, from which the user can restore it. There is deliberately no permanent-delete tool. Requires the 'Create and change files' permission.",
|
|
120
|
+
effect: "write",
|
|
86
121
|
input: z.object({ path: required }),
|
|
87
122
|
run: async ({ path }, scopes) => textResult(await trashFile(path, scopes)),
|
|
88
123
|
}),
|
|
89
124
|
tool({
|
|
90
125
|
name: "list_windows",
|
|
91
126
|
description: "Every window open on this device: its app, title, size, position, and which one has focus. Call this before any GUI work, it is how you find the application you were asked about, and how you know where your typing will land. Requires the 'See the screen' permission.",
|
|
127
|
+
effect: "read",
|
|
92
128
|
input: NO_ARGS,
|
|
93
129
|
run: async (_args, scopes) => textResult(await listWindows(desktop(), scopes)),
|
|
94
130
|
}),
|
|
95
131
|
tool({
|
|
96
132
|
name: "focus_window",
|
|
97
133
|
description: "Bring a window to the front and give it the keyboard, by the id from list_windows. ALWAYS do this before typing: text goes to whatever window has focus, not to where the pointer is. Requires the 'Use the mouse and keyboard' permission.",
|
|
134
|
+
effect: "write",
|
|
98
135
|
input: z.object({ id: required }),
|
|
99
136
|
run: async ({ id }, scopes) => textResult(await focusWindow(desktop(), id, scopes)),
|
|
100
137
|
}),
|
|
101
138
|
tool({
|
|
102
139
|
name: "open",
|
|
103
140
|
description: "Start an application, or open a URL or file with whatever this device has registered for it: the usual first step of a task ('open the browser at this page'). Use this rather than working out the platform's own incantation. Requires the 'Run commands' permission.",
|
|
141
|
+
effect: "destructive",
|
|
104
142
|
input: z.object({ target: required.describe("An application name, a file path, or a URL.") }),
|
|
105
143
|
run: async ({ target }, scopes) => textResult(await openTarget(desktop(), target, scopes)),
|
|
106
144
|
}),
|
|
107
145
|
tool({
|
|
108
146
|
name: "clipboard",
|
|
109
147
|
description: "Read or replace this device's clipboard: the reliable way to move text between applications, and often easier than reading it off a screenshot. Reading needs 'See the screen'; writing needs 'Use the mouse and keyboard'.",
|
|
148
|
+
effect: "destructive",
|
|
110
149
|
input: z
|
|
111
150
|
.object({
|
|
112
151
|
action: z.enum(["read", "write"]),
|
|
@@ -123,30 +162,35 @@ const TOOLS = [
|
|
|
123
162
|
tool({
|
|
124
163
|
name: "browser_open",
|
|
125
164
|
description: "Open a page in a browser on this device and answer with what is on it: the page's title, its URL, and every element you can click or type into, each with a reference like [e12]. THIS IS THE RIGHT WAY TO USE A WEBSITE, act on elements by reference, never by clicking pixels, because references survive scrolling, resizing and re-rendering. The browser is a separate instance with its own profile, so the user's own tabs and session are untouched; the first time it opens they may need to sign in. Requires the 'Run commands' permission.",
|
|
165
|
+
effect: "write",
|
|
126
166
|
input: z.object({ url: required.describe("The page to open. A bare host like example.com is fine.") }),
|
|
127
167
|
run: async ({ url }, scopes) => textResult(await openPage(web(), url, scopes)),
|
|
128
168
|
}),
|
|
129
169
|
tool({
|
|
130
170
|
name: "browser_snapshot",
|
|
131
171
|
description: "What the current page shows right now, with fresh [e…] references. Take one after anything that might have changed the page: references from an older snapshot are refused rather than clicking the wrong thing. Requires the 'See the screen' permission.",
|
|
172
|
+
effect: "read",
|
|
132
173
|
input: NO_ARGS,
|
|
133
174
|
run: async (_args, scopes) => textResult(await snapshotPage(web(), scopes)),
|
|
134
175
|
}),
|
|
135
176
|
tool({
|
|
136
177
|
name: "browser_read",
|
|
137
178
|
description: "The current page as readable text: what a person would get by selecting all of it. Use this to ANSWER QUESTIONS about a page; use browser_snapshot when you intend to act on it. Requires the 'See the screen' permission.",
|
|
179
|
+
effect: "read",
|
|
138
180
|
input: NO_ARGS,
|
|
139
181
|
run: async (_args, scopes) => textResult(await readPage(web(), scopes)),
|
|
140
182
|
}),
|
|
141
183
|
tool({
|
|
142
184
|
name: "browser_click",
|
|
143
185
|
description: "Click an element by its [e…] reference from the last snapshot. Answers with the page as it stands afterwards, so you see the result without asking. Requires the 'Use the mouse and keyboard' permission.",
|
|
186
|
+
effect: "destructive",
|
|
144
187
|
input: z.object({ ref: required }),
|
|
145
188
|
run: async ({ ref }, scopes) => textResult(await clickElement(web(), ref, scopes)),
|
|
146
189
|
}),
|
|
147
190
|
tool({
|
|
148
191
|
name: "browser_fill",
|
|
149
192
|
description: "Type into a field by its [e…] reference: replaces what is there, and fires the events a page's own JavaScript listens for (setting a value without them is how a filled form submits empty). Set submit to press Enter afterwards. Requires the 'Use the mouse and keyboard' permission.",
|
|
193
|
+
effect: "destructive",
|
|
150
194
|
input: z.object({
|
|
151
195
|
ref: required,
|
|
152
196
|
text: z.string(),
|
|
@@ -157,18 +201,21 @@ const TOOLS = [
|
|
|
157
201
|
tool({
|
|
158
202
|
name: "browser_key",
|
|
159
203
|
description: 'Press a key on the page as a whole: "Return", "Escape", "Tab". For typing into a field use browser_fill. Requires the \'Use the mouse and keyboard\' permission.',
|
|
204
|
+
effect: "destructive",
|
|
160
205
|
input: z.object({ key: required }),
|
|
161
206
|
run: async ({ key }, scopes) => textResult(await pressKey(web(), key, scopes)),
|
|
162
207
|
}),
|
|
163
208
|
tool({
|
|
164
209
|
name: "browser_tabs",
|
|
165
210
|
description: "Every tab open in that browser, and which one these tools are acting on. Pass an id to `select` to switch. Reading the list needs 'See the screen'; switching needs 'Use the mouse and keyboard'.",
|
|
211
|
+
effect: "write",
|
|
166
212
|
input: z.object({ select: required.optional().describe("The id of the tab to switch to. Omit to just list them.") }),
|
|
167
213
|
run: async ({ select }, scopes) => textResult(select === undefined ? await listTabs(web(), scopes) : await selectTab(web(), select, scopes)),
|
|
168
214
|
}),
|
|
169
215
|
tool({
|
|
170
216
|
name: "device",
|
|
171
217
|
description: "Use this device's mouse and keyboard: click what is on the screen, type into the focused window, press a key combination, scroll, drag. Coordinates are PIXELS IN THE LAST SCREENSHOT, take one first and read them off it. Every action answers with a fresh screenshot so you can see what happened. Requires the 'Use the mouse and keyboard' permission, which is OFF unless the user turned it on. Prefer a command over the GUI when both would work: a command is exact, and a click is a guess about where something is.",
|
|
218
|
+
effect: "destructive",
|
|
172
219
|
input: z.object({
|
|
173
220
|
action: z.enum([
|
|
174
221
|
"mouse_move",
|
|
@@ -202,24 +249,28 @@ const TOOLS = [
|
|
|
202
249
|
tool({
|
|
203
250
|
name: "screenshot",
|
|
204
251
|
description: "Capture what is on this device's screen right now, as an image. Use it to read a dialog, check on a window, or see what the user is describing. Requires the 'See the screen' permission.",
|
|
252
|
+
effect: "read",
|
|
205
253
|
input: NO_ARGS,
|
|
206
254
|
run: async (_args, scopes) => await screenshotResult(scopes),
|
|
207
255
|
}),
|
|
208
256
|
tool({
|
|
209
257
|
name: "list_sandboxes",
|
|
210
258
|
description: "The Intentic sandboxes on this device, as JSON: each one's slug, whether it is running, whether its tunnel is up, and its share of this machine under `resources` (memory cap in bytes, CPU cap, privileged, GPU, and which of those the approved environment demands versus the owner asked for). Only sandbox containers; nothing else on the machine is listed. Requires 'Run commands' or 'Manage sandboxes on this device'.",
|
|
259
|
+
effect: "read",
|
|
211
260
|
input: NO_ARGS,
|
|
212
261
|
run: async (_args, scopes) => textResult(await listSandboxes(scopes)),
|
|
213
262
|
}),
|
|
214
263
|
tool({
|
|
215
264
|
name: "manage_sandbox",
|
|
216
265
|
description: "Start, stop or restart one Intentic sandbox on this device, by its slug from list_sandboxes. Stopping one interrupts whoever is working in it, and stopping the sandbox you are calling from severs your own connection. Requires the 'Manage sandboxes on this device' permission, which is OFF unless the user turned it on.",
|
|
266
|
+
effect: "write",
|
|
217
267
|
input: z.object({ op: SandboxOpSchema, slug: required.describe("The sandbox's slug, from list_sandboxes.") }),
|
|
218
268
|
run: async ({ op, slug }, scopes) => textResult(await manageSandbox(op, slug, scopes)),
|
|
219
269
|
}),
|
|
220
270
|
tool({
|
|
221
271
|
name: "swap_sandbox",
|
|
222
272
|
description: "Move one Intentic sandbox on this device onto a different image: 'update' pulls the newest image of its release channel, 'rollback' returns it to the image it ran before its last update, and 'rebuild' rebuilds the owner-approved environment overlay. Files (/work) and history are kept in all three. Takes MINUTES, it pulls an image and recreates the container, and the sandbox is down while it happens. 'prepare' is the exception and the one to reach for first: it does the downloading and building of the next update WITHOUT touching the container, so the sandbox keeps running throughout and the 'update' that follows is a restart of seconds instead of a wait of minutes. Requires the 'Manage sandboxes on this device' permission.",
|
|
273
|
+
effect: "write",
|
|
223
274
|
input: z.object({
|
|
224
275
|
op: SandboxSwapSchema,
|
|
225
276
|
slug: required.describe("The sandbox's slug, from list_sandboxes."),
|
|
@@ -230,18 +281,21 @@ const TOOLS = [
|
|
|
230
281
|
tool({
|
|
231
282
|
name: "reshape_sandbox",
|
|
232
283
|
description: "Change how much of this device one Intentic sandbox may use, or its privileges: a memory cap in whole GiB, a CPU cap in whole cores, whether the container runs privileged, and whether this device's NVIDIA GPUs are passed through. Give only what should change; `null` for a cap means back to the default (the memory share derived from this machine; every core). The sandbox RESTARTS onto the same image — about a minute, whoever is working in it is interrupted, and reshaping the sandbox you are calling from severs your own connection until it is back — and the new values live on the container, surviving every later update. A privilege the sandbox's approved environment demands (the Docker capability's --privileged) cannot be withdrawn here, only the owner's own ask. Requires the 'Manage sandboxes on this device' permission.",
|
|
284
|
+
effect: "write",
|
|
233
285
|
input: SandboxResourcesAskFieldsSchema.extend({ slug: required.describe("The sandbox's slug, from list_sandboxes.") }),
|
|
234
286
|
run: async ({ slug, ...ask }, scopes) => textResult(await reshapeSandbox(slug, ask, scopes, () => { })),
|
|
235
287
|
}),
|
|
236
288
|
tool({
|
|
237
289
|
name: "remove_sandbox",
|
|
238
290
|
description: "Remove one Intentic sandbox from this device: its container stops and leaves the listing. Its files and its history are kept for a week, so `ic sandbox restore <slug>` on the device brings it back whole; after that week they are deleted for good. This is not what stopping it does, so confirm with the user before calling it. Requires the 'Manage sandboxes on this device' permission, which is OFF unless the user turned it on.",
|
|
291
|
+
effect: "destructive",
|
|
239
292
|
input: z.object({ slug: required.describe("The sandbox's slug, from list_sandboxes.") }),
|
|
240
293
|
run: async ({ slug }, scopes) => textResult(await removeSandbox(slug, scopes, () => { })),
|
|
241
294
|
}),
|
|
242
295
|
tool({
|
|
243
296
|
name: "sandbox_logs",
|
|
244
297
|
description: "The tail of one Intentic sandbox's container log on this device: how you find out why it will not start or what it did before it stopped. Requires 'Run commands' or 'Manage sandboxes on this device'.",
|
|
298
|
+
effect: "read",
|
|
245
299
|
input: z.object({
|
|
246
300
|
slug: required.describe("The sandbox's slug, from list_sandboxes."),
|
|
247
301
|
lines: z
|
package/dist/device/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/device/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAA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AE,CAAC,CAAC,CAAC,IAAI,CAAC;IACpG,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAe;IAC1D,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;IAC1E,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mCAAmC,IAAI,IAAI;IACjE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,UAAU;IAC/C,YAAY;IACZ,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CACzC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;CAC3J,CAAC,CAAC"}
|
package/dist/device/policy.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export declare class ScopeError extends Error {
|
|
|
3
3
|
}
|
|
4
4
|
export declare const rootsOf: (scopes: DeviceScopes) => string[];
|
|
5
5
|
export declare const withinRoots: (path: string, roots: readonly string[]) => boolean;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const realPathOf: (path: string) => Promise<string>;
|
|
7
|
+
export declare const assertPath: (path: string, scopes: DeviceScopes, intent: string, { link }?: {
|
|
8
|
+
readonly link?: "follow" | "itself";
|
|
9
|
+
}) => Promise<string>;
|
|
7
10
|
export declare const assertScope: (scopes: DeviceScopes, scope: "shell" | "write" | "screen" | "control" | "sandboxes" | "destructive") => void;
|
|
8
11
|
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/device/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/device/policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,qBAAa,UAAW,SAAQ,KAAK;CAAG;AAGxC,eAAO,MAAM,OAAO,WAAY,YAAY,KAAG,MAAM,EAUpD,CAAC;AAIF,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,SAAS,MAAM,EAAE,KAAG,OAGpE,CAAC;AAIF,eAAO,MAAM,UAAU,SAAgB,MAAM,KAAG,OAAO,CAAC,MAAM,CAY7D,CAAC;AAIF,eAAO,MAAM,UAAU,SACb,MAAM,UACJ,YAAY,UACZ,MAAM,aACO;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAAE,KAC7D,OAAO,CAAC,MAAM,CAchB,CAAC;AAGF,eAAO,MAAM,WAAW,WACZ,YAAY,SACb,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,KAC9E,IAaF,CAAC"}
|
package/dist/device/policy.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { realpath } from "node:fs/promises";
|
|
1
2
|
import { homedir } from "node:os";
|
|
2
|
-
import { isAbsolute, join, resolve, sep } from "node:path";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
3
4
|
export class ScopeError extends Error {
|
|
4
5
|
}
|
|
5
6
|
export const rootsOf = (scopes) => {
|
|
@@ -16,13 +17,30 @@ export const withinRoots = (path, roots) => {
|
|
|
16
17
|
const target = resolve(path);
|
|
17
18
|
return roots.some((root) => target === root || target.startsWith(root.endsWith(sep) ? root : `${root}${sep}`));
|
|
18
19
|
};
|
|
19
|
-
export const
|
|
20
|
+
export const realPathOf = async (path) => {
|
|
21
|
+
const absolute = resolve(path);
|
|
22
|
+
try {
|
|
23
|
+
return await realpath(absolute);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
const code = error.code;
|
|
27
|
+
const parent = dirname(absolute);
|
|
28
|
+
if ((code !== "ENOENT" && code !== "ENOTDIR") || parent === absolute) {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
return join(await realPathOf(parent), basename(absolute));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export const assertPath = async (path, scopes, intent, { link = "follow" } = {}) => {
|
|
20
35
|
const roots = rootsOf(scopes);
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
const absolute = resolve(path);
|
|
37
|
+
const real = link === "follow" ? await realPathOf(absolute) : join(await realPathOf(dirname(absolute)), basename(absolute));
|
|
38
|
+
if (!withinRoots(real, await Promise.all(roots.map(realPathOf)))) {
|
|
39
|
+
const leads = real === absolute ? "" : ` (it leads to ${real})`;
|
|
40
|
+
throw new ScopeError(`Refused to ${intent} "${path}"${leads}: it is outside the folders this device allows (${roots.join(", ")}). ` +
|
|
23
41
|
`Widen "Folders it may touch" on this device's capability card to change that.`);
|
|
24
42
|
}
|
|
25
|
-
return
|
|
43
|
+
return real;
|
|
26
44
|
};
|
|
27
45
|
export const assertScope = (scopes, scope) => {
|
|
28
46
|
if (scopes[scope] === "on") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/device/policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,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AK,QAAQ,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE5H,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,KAAK,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,IAAI,GAAG,CAAC;QAChE,MAAM,IAAI,UAAU,CAChB,cAAc,MAAM,KAAK,IAAI,IAAI,KAAK,mDAAmD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YAC1G,+EAA+E,CACtF,CAAC;IACN,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,WAAW,GAAG,CACvB,MAAoB,EACpB,KAA6E,EACzE,EAAE;IACN,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO;IACX,CAAC;IACD,MAAM,KAAK,GAAG;QACV,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE,yBAAyB;QAChC,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,4BAA4B;QACrC,SAAS,EAAE,iCAAiC;QAC5C,WAAW,EAAE,0BAA0B;KAC1C,CAAC,KAAK,CAAC,CAAC;IACT,MAAM,IAAI,UAAU,CAAC,aAAa,KAAK,qFAAqF,CAAC,CAAC;AAClI,CAAC,CAAC"}
|
package/dist/device/router.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type DeviceScopes } from "@intentic/sandbox-contract";
|
|
2
2
|
export interface HostRuntime {
|
|
3
|
+
readonly sandboxUrl: string;
|
|
3
4
|
readonly scopes: () => DeviceScopes;
|
|
4
5
|
readonly setScopes: (scopes: DeviceScopes) => void;
|
|
5
6
|
readonly log: (message: string) => void;
|
|
@@ -153,6 +154,7 @@ export declare const createHostRouter: (runtime: HostRuntime) => {
|
|
|
153
154
|
parentUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
155
|
pair: import("zod").ZodOptional<import("zod").ZodString>;
|
|
155
156
|
setupCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
157
|
+
platformUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
156
158
|
definition: import("zod").ZodOptional<import("zod").ZodString>;
|
|
157
159
|
overlay: import("zod").ZodOptional<import("zod").ZodString>;
|
|
158
160
|
overlayHash: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/device/router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAqF,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/device/router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAqF,MAAM,4BAA4B,CAAC;AAsBlJ,MAAM,WAAW,WAAW;IAExB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAkFD,eAAO,MAAM,gBAAgB,YAAa,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BpD,CAAC"}
|
package/dist/device/router.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { narrate } from "@intentic/base/async";
|
|
2
2
|
import { deviceContract } from "@intentic/sandbox-contract";
|
|
3
3
|
import { implement, ORPCError } from "@orpc/server";
|
|
4
|
+
import { calling } from "./indicator.js";
|
|
4
5
|
import { handleMcpMessage } from "./mcp.js";
|
|
5
6
|
import { hostFacts } from "./tools/describe.js";
|
|
6
7
|
import { machineReport } from "../sync/report.js";
|
|
@@ -24,8 +25,8 @@ const FLOWS = {
|
|
|
24
25
|
reshape: ({ slug, resources }, scopes) => (onLine) => reshapeSandbox(slug, resources, scopes, onLine),
|
|
25
26
|
remove: ({ slug }, scopes) => (onLine) => removeSandbox(slug, scopes, onLine),
|
|
26
27
|
logs: ({ slug }, scopes) => (onLine) => tailSandboxLogs(slug, scopes, onLine),
|
|
27
|
-
reconnect: ({ slug, setupCode }, scopes) => (onLine) => reconnectSandbox(slug, setupCode, scopes, onLine),
|
|
28
|
-
create: ({ slug, setupCode }, scopes) => (onLine) => createSandbox(slug, setupCode, scopes, onLine),
|
|
28
|
+
reconnect: ({ slug, setupCode, platformUrl }, scopes) => (onLine) => reconnectSandbox(slug, setupCode, platformUrl, scopes, onLine),
|
|
29
|
+
create: ({ slug, setupCode, platformUrl }, scopes) => (onLine) => createSandbox(slug, setupCode, platformUrl, scopes, onLine),
|
|
29
30
|
"runner-up": runnerFlowFor,
|
|
30
31
|
"runner-remove": runnerFlowFor,
|
|
31
32
|
};
|
|
@@ -45,7 +46,7 @@ export const createHostRouter = (runtime) => {
|
|
|
45
46
|
return { ok: true };
|
|
46
47
|
}),
|
|
47
48
|
ping: os.ping.handler(() => ({ ok: true })),
|
|
48
|
-
mcp: os.mcp.handler(async ({ input }) => await handleMcpMessage(input, runtime.scopes())),
|
|
49
|
+
mcp: os.mcp.handler(async ({ input }) => await calling.run(runtime, async () => await handleMcpMessage(input, runtime.scopes()))),
|
|
49
50
|
runSandboxFlow: os.runSandboxFlow.handler(({ input }) => streamFlow(FLOWS[input.op](input, runtime.scopes()))),
|
|
50
51
|
runAgentFlow: os.runAgentFlow.handler(({ input }) => streamFlow((onLine) => runAgentOp(input.op, runtime.scopes(), onLine))),
|
|
51
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/device/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAwF,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAClJ,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACH,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,EAEV,WAAW,EACX,eAAe,GAClB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/device/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAwF,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAClJ,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE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a,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAY9E,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAI/D,CAAC;AAsCF,eAAO,MAAM,UAAU,OAAc,aAAa,UAAU,YAAY,UAAU,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/device/tools/agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAY9E,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAI/D,CAAC;AAsCF,eAAO,MAAM,UAAU,OAAc,aAAa,UAAU,YAAY,UAAU,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KAAG,OAAO,CAAC,MAAM,CAuBxH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { pollUntil } from "@intentic/base/async";
|
|
3
3
|
import { isProcessAlive, spawnDetached } from "@intentic/local-agent";
|
|
4
4
|
import { agentLogPath } from "../../config.js";
|
|
5
5
|
import { installedBuild } from "../../installed.js";
|
|
@@ -34,27 +34,24 @@ const settled = {
|
|
|
34
34
|
export const runAgentOp = async (op, scopes, onLine) => {
|
|
35
35
|
assertScope(scopes, "shell");
|
|
36
36
|
onLine(started(op, installedBuild()));
|
|
37
|
-
|
|
37
|
+
let at = (await readFrom(agentLogPath, 0)).at;
|
|
38
38
|
const argv = AGENT_VERB[op];
|
|
39
39
|
const pid = await spawnDetached(agentLogPath, machineLauncher(), argv, { finishes: true });
|
|
40
40
|
onLine(`Started ${argv.join(" ")} (pid ${pid}), detached from this connection so it finishes either way. Log: ${agentLogPath}`);
|
|
41
|
-
let at = start;
|
|
42
|
-
const deadline = Date.now() + WATCH_TIMEOUT_MS;
|
|
43
41
|
let goneAt;
|
|
44
|
-
|
|
42
|
+
const drained = async () => {
|
|
45
43
|
const { text, at: next } = await readFrom(agentLogPath, at);
|
|
46
44
|
at = next;
|
|
47
45
|
for (const line of text.split(/\r?\n/).filter((one) => one.trim() !== "")) {
|
|
48
46
|
onLine(line);
|
|
49
47
|
}
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
if (Date.now() - goneAt > DRAIN_MS) {
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
48
|
+
if (isProcessAlive(pid)) {
|
|
49
|
+
return false;
|
|
55
50
|
}
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
goneAt ??= Date.now();
|
|
52
|
+
return Date.now() - goneAt > DRAIN_MS;
|
|
53
|
+
};
|
|
54
|
+
await pollUntil(drained, { intervalMs: POLL_MS, timeoutMs: WATCH_TIMEOUT_MS });
|
|
58
55
|
return settled[op];
|
|
59
56
|
};
|
|
60
57
|
//# sourceMappingURL=agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/device/tools/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/device/tools/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WA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,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC/E,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Desktop, type WindowInfo } from "@intentic/desktop-automation";
|
|
2
2
|
import type { DeviceScopes } from "@intentic/sandbox-contract";
|
|
3
|
+
import { type Indicator } from "../indicator.js";
|
|
3
4
|
export declare const describeWindows: (windows: readonly WindowInfo[]) => string;
|
|
4
5
|
export declare const listWindows: (screen: Desktop, scopes: DeviceScopes) => Promise<string>;
|
|
5
|
-
export declare const focusWindow: (screen: Desktop, id: string, scopes: DeviceScopes) => Promise<string>;
|
|
6
|
+
export declare const focusWindow: (screen: Desktop, id: string, scopes: DeviceScopes, indicator?: Indicator) => Promise<string>;
|
|
6
7
|
export declare const openTarget: (screen: Desktop, target: string, scopes: DeviceScopes) => Promise<string>;
|
|
7
8
|
export declare const readClipboard: (screen: Desktop, scopes: DeviceScopes) => Promise<string>;
|
|
8
|
-
export declare const writeClipboard: (screen: Desktop, text: string, scopes: DeviceScopes) => Promise<string>;
|
|
9
|
+
export declare const writeClipboard: (screen: Desktop, text: string, scopes: DeviceScopes, indicator?: Indicator) => Promise<string>;
|
|
9
10
|
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/device/tools/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/device/tools/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAW,KAAK,SAAS,EAAoB,MAAM,iBAAiB,CAAC;AAS5E,eAAO,MAAM,eAAe,YAAa,SAAS,UAAU,EAAE,KAAG,MAShE,CAAC;AAEF,eAAO,MAAM,WAAW,WAAkB,OAAO,UAAU,YAAY,KAAG,OAAO,CAAC,MAAM,CAGvF,CAAC;AAIF,eAAO,MAAM,WAAW,WAAkB,OAAO,MAAM,MAAM,UAAU,YAAY,cAAa,SAAS,KAAwB,OAAO,CAAC,MAAM,CAU9I,CAAC;AAEF,eAAO,MAAM,UAAU,WAAkB,OAAO,UAAU,MAAM,UAAU,YAAY,KAAG,OAAO,CAAC,MAAM,CAQtG,CAAC;AAIF,eAAO,MAAM,aAAa,WAAkB,OAAO,UAAU,YAAY,KAAG,OAAO,CAAC,MAAM,CAIzF,CAAC;AAEF,eAAO,MAAM,cAAc,WAAkB,OAAO,QAAQ,MAAM,UAAU,YAAY,cAAa,SAAS,KAAwB,OAAO,CAAC,MAAM,CAMnJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DesktopError } from "@intentic/desktop-automation";
|
|
2
|
+
import { calling, machineIndicator } from "../indicator.js";
|
|
2
3
|
import { assertScope } from "../policy.js";
|
|
3
4
|
export const describeWindows = (windows) => {
|
|
4
5
|
if (windows.length === 0) {
|
|
@@ -11,11 +12,12 @@ export const listWindows = async (screen, scopes) => {
|
|
|
11
12
|
assertScope(scopes, "screen");
|
|
12
13
|
return describeWindows(await screen.windows());
|
|
13
14
|
};
|
|
14
|
-
export const focusWindow = async (screen, id, scopes) => {
|
|
15
|
+
export const focusWindow = async (screen, id, scopes, indicator = machineIndicator()) => {
|
|
15
16
|
assertScope(scopes, "control");
|
|
16
17
|
if (id === "") {
|
|
17
18
|
throw new DesktopError(`"id" is required: take a window list first and pass the id in brackets.`);
|
|
18
19
|
}
|
|
20
|
+
await indicator.control(calling.getStore());
|
|
19
21
|
await screen.focusWindow(id);
|
|
20
22
|
const focused = (await screen.windows().catch(() => [])).find((window) => window.focused);
|
|
21
23
|
return focused === undefined ? `Asked this device to focus window ${id}.` : `Focused: ${focused.app}, ${focused.title}. Typing now goes here.`;
|
|
@@ -33,8 +35,9 @@ export const readClipboard = async (screen, scopes) => {
|
|
|
33
35
|
const text = await screen.readClipboard();
|
|
34
36
|
return text === "" ? "The clipboard is empty." : text;
|
|
35
37
|
};
|
|
36
|
-
export const writeClipboard = async (screen, text, scopes) => {
|
|
38
|
+
export const writeClipboard = async (screen, text, scopes, indicator = machineIndicator()) => {
|
|
37
39
|
assertScope(scopes, "control");
|
|
40
|
+
await indicator.control(calling.getStore());
|
|
38
41
|
await screen.writeClipboard(text);
|
|
39
42
|
return `Put ${text.length} characters on this device's clipboard.`;
|
|
40
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../src/device/tools/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAmB,MAAM,8BAA8B,CAAC;AAE3F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQ3C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAA8B,EAAU,EAAE;IACtE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,qCAAqC,CAAC;IACjD,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CACpB,CAAC,MAAM,EAAE,EAAE,CACP,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,GAA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(stdout: string) => string[];
|
|
4
3
|
export declare const linkFacts: (stamped: Readonly<Record<string, LinkReading>> | undefined) => DeviceFacts["links"];
|
|
5
4
|
export declare const hostFacts: (scopes: DeviceScopes) => Promise<DeviceFacts>;
|
|
6
5
|
export declare const describeText: (scopes: DeviceScopes) => Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/device/tools/describe.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAiC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/device/tools/describe.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAiC,MAAM,cAAc,CAAC;AAmD/E,eAAO,MAAM,SAAS,YAAa,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,GAAG,SAAS,KAAG,WAAW,CAAC,OAAO,CAWzG,CAAC;AAEF,eAAO,MAAM,SAAS,WAAkB,YAAY,KAAG,OAAO,CAAC,WAAW,CAezE,CAAC;AAoBF,eAAO,MAAM,YAAY,WAAkB,YAAY,KAAG,OAAO,CAAC,MAAM,CAqBvE,CAAC"}
|