@intentic/machine 1.244.0 → 1.246.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 +27 -18
- package/dist/app.js +1 -1
- package/dist/app.js.map +1 -1
- package/dist/autostart.js +1 -1
- package/dist/autostart.js.map +1 -1
- package/dist/commands.d.ts +1 -1
- package/dist/commands.js +5 -5
- package/dist/commands.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/device/audit.d.ts.map +1 -0
- package/dist/device/audit.js.map +1 -0
- package/dist/{computer → device}/auto-prepare.d.ts +3 -3
- package/dist/device/auto-prepare.d.ts.map +1 -0
- package/dist/device/auto-prepare.js.map +1 -0
- package/dist/{computer → device}/commands.d.ts +2 -2
- package/dist/device/commands.d.ts.map +1 -0
- package/dist/{computer → device}/commands.js +19 -19
- package/dist/device/commands.js.map +1 -0
- package/dist/device/config.d.ts.map +1 -0
- package/dist/{computer → device}/config.js +1 -1
- package/dist/device/config.js.map +1 -0
- package/dist/{computer → device}/connection.d.ts +2 -5
- package/dist/device/connection.d.ts.map +1 -0
- package/dist/device/connection.js +37 -0
- package/dist/device/connection.js.map +1 -0
- package/dist/device/mcp.d.ts +11 -0
- package/dist/device/mcp.d.ts.map +1 -0
- package/dist/{computer → device}/mcp.js +36 -84
- package/dist/device/mcp.js.map +1 -0
- package/dist/device/policy.d.ts.map +1 -0
- package/dist/{computer → device}/policy.js +5 -5
- package/dist/device/policy.js.map +1 -0
- package/dist/{computer → device}/router.d.ts +35 -0
- package/dist/device/router.d.ts.map +1 -0
- package/dist/{computer → device}/router.js +7 -3
- package/dist/device/router.js.map +1 -0
- package/dist/device/testing.d.ts +10 -0
- package/dist/device/testing.d.ts.map +1 -0
- package/dist/device/testing.js +51 -0
- package/dist/device/testing.js.map +1 -0
- package/dist/device/tools/agent.d.ts +4 -0
- package/dist/device/tools/agent.d.ts.map +1 -0
- package/dist/device/tools/agent.js +46 -0
- package/dist/device/tools/agent.js.map +1 -0
- package/dist/device/tools/apps.d.ts.map +1 -0
- package/dist/{computer → device}/tools/apps.js +3 -3
- package/dist/device/tools/apps.js.map +1 -0
- package/dist/device/tools/browser.d.ts.map +1 -0
- package/dist/device/tools/browser.js.map +1 -0
- package/dist/device/tools/describe.d.ts.map +1 -0
- package/dist/{computer → device}/tools/describe.js +22 -8
- package/dist/device/tools/describe.js.map +1 -0
- package/dist/{computer/tools/computer.d.ts → device/tools/device.d.ts} +6 -6
- package/dist/device/tools/device.d.ts.map +1 -0
- package/dist/{computer/tools/computer.js → device/tools/device.js} +2 -2
- package/dist/device/tools/device.js.map +1 -0
- package/dist/device/tools/files.d.ts.map +1 -0
- package/dist/device/tools/files.js.map +1 -0
- package/dist/{computer → device}/tools/sandboxes.d.ts +7 -3
- package/dist/device/tools/sandboxes.d.ts.map +1 -0
- package/dist/{computer → device}/tools/sandboxes.js +98 -8
- package/dist/device/tools/sandboxes.js.map +1 -0
- package/dist/device/tools/shell.d.ts.map +1 -0
- package/dist/{computer → device}/tools/shell.js +6 -4
- package/dist/device/tools/shell.js.map +1 -0
- package/dist/resident.js +6 -6
- package/dist/resident.js.map +1 -1
- package/dist/status.d.ts +9 -9
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +28 -23
- package/dist/status.js.map +1 -1
- package/dist/sync/commands.js +4 -4
- package/dist/sync/commands.js.map +1 -1
- package/dist/sync/mirror.js +4 -4
- package/dist/sync/mirror.js.map +1 -1
- package/dist/sync/report.d.ts +4 -4
- package/dist/sync/report.d.ts.map +1 -1
- package/dist/sync/report.js +5 -6
- package/dist/sync/report.js.map +1 -1
- package/package.json +10 -10
- package/dist/computer/audit.d.ts.map +0 -1
- package/dist/computer/audit.js.map +0 -1
- package/dist/computer/auto-prepare.d.ts.map +0 -1
- package/dist/computer/auto-prepare.js.map +0 -1
- package/dist/computer/commands.d.ts.map +0 -1
- package/dist/computer/commands.js.map +0 -1
- package/dist/computer/config.d.ts.map +0 -1
- package/dist/computer/config.js.map +0 -1
- package/dist/computer/connection.d.ts.map +0 -1
- package/dist/computer/connection.js +0 -72
- package/dist/computer/connection.js.map +0 -1
- package/dist/computer/mcp.d.ts +0 -3
- package/dist/computer/mcp.d.ts.map +0 -1
- package/dist/computer/mcp.js.map +0 -1
- package/dist/computer/policy.d.ts.map +0 -1
- package/dist/computer/policy.js.map +0 -1
- package/dist/computer/router.d.ts.map +0 -1
- package/dist/computer/router.js.map +0 -1
- package/dist/computer/tools/apps.d.ts.map +0 -1
- package/dist/computer/tools/apps.js.map +0 -1
- package/dist/computer/tools/browser.d.ts.map +0 -1
- package/dist/computer/tools/browser.js.map +0 -1
- package/dist/computer/tools/computer.d.ts.map +0 -1
- package/dist/computer/tools/computer.js.map +0 -1
- package/dist/computer/tools/describe.d.ts.map +0 -1
- package/dist/computer/tools/describe.js.map +0 -1
- package/dist/computer/tools/files.d.ts.map +0 -1
- package/dist/computer/tools/files.js.map +0 -1
- package/dist/computer/tools/sandboxes.d.ts.map +0 -1
- package/dist/computer/tools/sandboxes.js.map +0 -1
- package/dist/computer/tools/shell.d.ts.map +0 -1
- package/dist/computer/tools/shell.js.map +0 -1
- /package/dist/{computer → device}/audit.d.ts +0 -0
- /package/dist/{computer → device}/audit.js +0 -0
- /package/dist/{computer → device}/auto-prepare.js +0 -0
- /package/dist/{computer → device}/config.d.ts +0 -0
- /package/dist/{computer → device}/policy.d.ts +0 -0
- /package/dist/{computer → device}/tools/apps.d.ts +0 -0
- /package/dist/{computer → device}/tools/browser.d.ts +0 -0
- /package/dist/{computer → device}/tools/browser.js +0 -0
- /package/dist/{computer → device}/tools/describe.d.ts +0 -0
- /package/dist/{computer → device}/tools/files.d.ts +0 -0
- /package/dist/{computer → device}/tools/files.js +0 -0
- /package/dist/{computer → device}/tools/shell.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @intentic/machine
|
|
2
2
|
|
|
3
|
-
The one agent that lives on a user's own
|
|
3
|
+
The one agent that lives on a user's own device: it lets a sandbox's agent work on the machine, and keeps the
|
|
4
4
|
machine's folders and ports mirrored with the sandbox — one binary, one resident loop, one logon entry.
|
|
5
5
|
|
|
6
6
|
It replaces two agents (`@intentic/host` and `@intentic/sync`) that shared everything about *being installed* —
|
|
@@ -10,7 +10,7 @@ running" one answer instead of two halves of one.
|
|
|
10
10
|
|
|
11
11
|
## Responsibilities
|
|
12
12
|
|
|
13
|
-
The **
|
|
13
|
+
The **device half** (`src/device/`, the machine side of the `host` capability):
|
|
14
14
|
|
|
15
15
|
- Dial each linked sandbox — one outbound WebSocket, enrollment token in the first frame, oRPC after that; the
|
|
16
16
|
machine *serves* `hostContract`, so no port ever opens here. Where it dials is the shared resolver's answer
|
|
@@ -19,10 +19,18 @@ The **computer half** (`src/computer/`, the machine side of the `host` capabilit
|
|
|
19
19
|
recoverable) as MCP carried verbatim, so a machine can learn a tool without a daemon release.
|
|
20
20
|
- Enforce the owner's scopes **here**, never in the sandbox, and append every call to an audit log that
|
|
21
21
|
survives uninstall.
|
|
22
|
-
-
|
|
22
|
+
- Manage this machine's sandboxes for a browser button or a model, under the `sandboxes` switch: list them
|
|
23
|
+
with their **share of the machine** (one `docker inspect` per listing: memory and CPU caps, privileged, GPU,
|
|
24
|
+
and who asked for each directive, the approved environment or the owner), start/stop/restart, run the `ic`
|
|
25
|
+
flows (prepare, update, rebuild, rollback, reshape, remove) narrating their output line by line, and tail
|
|
26
|
+
their logs. `reshape` changes a sandbox's share or privileges through `ic sandbox reshape` on the same
|
|
27
|
+
switch as the swaps, because another reshape undoes it; its ask is a closed form (two caps, two switches)
|
|
28
|
+
spelled into `ic` flags here, so nothing a browser or a model sends reaches docker as text. `describe`
|
|
29
|
+
reports the docker engine's size beside the OS, which is the ceiling those caps are held to.
|
|
30
|
+
- Keep each local sandbox's **next update downloaded** (`src/device/auto-prepare.ts`): a background tick
|
|
23
31
|
runs `ic sandbox prepare <slug> --auto` every few hours, so the web app's update card offers a half-minute
|
|
24
|
-
restart instead of minutes of pulling. On by default; the switch is `intentic-machine
|
|
25
|
-
--off` (cached in `
|
|
32
|
+
restart instead of minutes of pulling. On by default; the switch is `intentic-machine device updates
|
|
33
|
+
--off` (cached in `device.json`). Nothing in any sandbox can start or steer the tick — a sandbox only
|
|
26
34
|
learns the outcome through the staged marker `ic` writes, the way it always has.
|
|
27
35
|
|
|
28
36
|
The **sync half** (`src/sync/`, the machine side of desktop sync):
|
|
@@ -32,9 +40,9 @@ The **sync half** (`src/sync/`, the machine side of desktop sync):
|
|
|
32
40
|
- Serve the SSH transport itself on loopback (the sandbox's sshd reached over its HTTPS surface), mirror every
|
|
33
41
|
workspace port onto this machine's localhost, and bridge git so commits appear in local clones.
|
|
34
42
|
- Own the **port-mirroring switch** (`sync mirror off|on`, optionally `--sandbox <id>`): mirroring is the one
|
|
35
|
-
thing here that writes to *this*
|
|
43
|
+
thing here that writes to *this* device's localhost, so the flag lives on this side, survives a restart, and
|
|
36
44
|
is read every tick. File sync, the state backup and the git bridge are untouched by it — the point is to stop
|
|
37
|
-
the ports without unpairing the sandbox. The sandbox's
|
|
45
|
+
the ports without unpairing the sandbox. The sandbox's Devices tab has a button for it, and that button runs
|
|
38
46
|
this very command over the `host` capability, so the two can never disagree. The same is true of the other
|
|
39
47
|
three verbs — `sync pause`, `sync resume` and `sync uninstall --sandbox <id>`.
|
|
40
48
|
|
|
@@ -53,12 +61,12 @@ The **sync half** (`src/sync/`, the machine side of desktop sync):
|
|
|
53
61
|
app's tray reads), self-`upgrade` with automatic rollback, the autostart spec, and **where a sandbox's daemon is
|
|
54
62
|
dialled** ([src/daemon-base.ts](src/daemon-base.ts)). A sandbox usually runs in a container on this very
|
|
55
63
|
machine, which publishes its daemon on `127.0.0.1:<port derived from the sandbox id>`, so every dial either half
|
|
56
|
-
makes — the
|
|
64
|
+
makes — the device socket, both enrollments, the sync transport, the ports poll, the machine report — tries
|
|
57
65
|
that address first and the public URL last. A candidate is adopted only if the daemon's unauthenticated
|
|
58
66
|
`/health` answers with the id we expected: a port is not a sandbox, and a token is what would be presented to
|
|
59
67
|
whoever holds it. For the sync half the shortcut saves a multi-gigabyte Mutagen sync a trip out to the
|
|
60
|
-
reachability edge and back to the same laptop. For the
|
|
61
|
-
to dial the public URL and nothing else, so a sandbox whose tunnel was down read "offline" on its own
|
|
68
|
+
reachability edge and back to the same laptop. For the device half it is reachability itself: the socket used
|
|
69
|
+
to dial the public URL and nothing else, so a sandbox whose tunnel was down read "offline" on its own Devices
|
|
62
70
|
tab, with every button there gone, while this same process was polling it over loopback. The watcher re-probes
|
|
63
71
|
a pairing sitting on the public URL each minute, so a container started later is promoted with no restart; the
|
|
64
72
|
socket re-resolves on every reconnect.
|
|
@@ -68,7 +76,7 @@ socket re-resolves on every reconnect.
|
|
|
68
76
|
`intentic-machine run --foreground` (what systemd, launchd and the Windows launcher stub run) serves both
|
|
69
77
|
halves in one process ([src/resident.ts](src/resident.ts)):
|
|
70
78
|
|
|
71
|
-
- The sync half re-reads its pairing list every tick; the
|
|
79
|
+
- The sync half re-reads its pairing list every tick; the device half's link list is fixed at startup, which
|
|
72
80
|
is why every `setup`/`uninstall` restarts the loop (`reconcileResidency`) instead of poking it.
|
|
73
81
|
- The process exits — and takes the login entry with it — only when **both** halves have nothing to serve.
|
|
74
82
|
- On a signal it exits `128+signal`, never 0: a supervisor must restart what it did not stop, and the incident
|
|
@@ -86,7 +94,7 @@ report stamped its own version into the one field, so the same machine answered
|
|
|
86
94
|
its loop posts to and its installed build to one reading over a `host` capability.
|
|
87
95
|
|
|
88
96
|
- `intentic-machine status` says which is which, and the summary the tray reads leads with `OLD BUILD RUNNING`.
|
|
89
|
-
- The
|
|
97
|
+
- The Devices row says it beside the pid, with the two commands that close it.
|
|
90
98
|
- `intentic-machine upgrade` restarts a loop that is behind the installed binary even when there is nothing to
|
|
91
99
|
download, and after a swap it verifies that the loop which came up **is** the new build rather than that some
|
|
92
100
|
process is alive — the check the old agent passed just as well as the new one.
|
|
@@ -95,21 +103,22 @@ its loop posts to and its installed build to one reading over a `host` capabilit
|
|
|
95
103
|
|
|
96
104
|
## Key files
|
|
97
105
|
|
|
98
|
-
- [src/commands.ts](src/commands.ts) — the CLI surface: `
|
|
106
|
+
- [src/commands.ts](src/commands.ts) — the CLI surface: `device setup|uninstall|updates`, `sync setup|pause|resume|mirror|uninstall`, shared `run|status|version|upgrade|uninstall`.
|
|
99
107
|
- [src/install.ts](src/install.ts) — what every `setup` runs first: self-update (then re-exec), PATH repair, the Windows launcher stub. Everything the install scripts used to decide, decided once here.
|
|
100
108
|
- [src/upgrade.ts](src/upgrade.ts) — `upgrade`: what is published, then download → probe → stop → swap → start, with a rollback behind every step, and a restart when the file is current but the loop is not.
|
|
101
109
|
- [src/installed.ts](src/installed.ts) — which build the *file* at `bin/intentic-machine` is, as opposed to the one running: free while the two agree, one probe per swap after they stop.
|
|
102
110
|
- [src/daemon-base.ts](src/daemon-base.ts) — where a sandbox's daemon is dialled, for both halves: loopback first when `/health` proves it is ours, the public URL as the floor.
|
|
103
111
|
- [src/resident.ts](src/resident.ts) — the one loop, its pidfile, and `reconcileResidency`.
|
|
104
|
-
- [src/
|
|
112
|
+
- [src/device/auto-prepare.ts](src/device/auto-prepare.ts) — the background update-download tick; the judgement about *what* to download stays in `ic sandbox prepare --auto`, on purpose.
|
|
105
113
|
- [src/status.ts](src/status.ts) — both halves as one answer; `--json` is what the desktop app and tray read.
|
|
106
|
-
- [src/
|
|
114
|
+
- [src/device/policy.ts](src/device/policy.ts) — what the sandbox is permitted to do here; the security surface.
|
|
115
|
+
- [src/device/tools/sandboxes.ts](src/device/tools/sandboxes.ts) — the fleet: the `docker ps`/`inspect` readers, the docker verbs, and the `ic` flows (swap, reshape, remove, runners) with the pure argv builders beside them.
|
|
107
116
|
- [src/sync/mirror.ts](src/sync/mirror.ts) — the sync tick: ports reconcile, git bridge, revocation handling.
|
|
108
117
|
- [src/sync/mutagen.ts](src/sync/mutagen.ts) — driving the Mutagen binary, sessions and its daemon's autostart.
|
|
109
118
|
|
|
110
119
|
## How it fits
|
|
111
120
|
|
|
112
|
-
Runs on the user's machine, not in the sandbox. Installed by `
|
|
121
|
+
Runs on the user's machine, not in the sandbox. Installed by `device.{sh,ps1}` / `sync.{sh,ps1}` (both cards
|
|
113
122
|
put the same binary in `~/.intentic/machine/bin`), shipped as a bun-compiled binary per platform, self-updated
|
|
114
123
|
by `upgrade`.
|
|
115
124
|
|
|
@@ -124,13 +133,13 @@ place. The shims' remaining bootstrap blocks are held identical per dialect by
|
|
|
124
133
|
|
|
125
134
|
The install-and-stay-alive plumbing is
|
|
126
135
|
[`@intentic/local-agent`](../local-agent)'s; the windowless Windows logon start is
|
|
127
|
-
[`
|
|
136
|
+
[`_devices/win-launcher`](../win-launcher)'s.
|
|
128
137
|
|
|
129
138
|
## Conventions & gotchas
|
|
130
139
|
|
|
131
140
|
- **Bidirectional sync has no undo.** The integration tests here run against real directories and a real
|
|
132
141
|
Mutagen for exactly that reason; a unit test that mocks the sync proves nothing about the case that loses work.
|
|
133
|
-
- **The two halves keep separate state files** (`
|
|
142
|
+
- **The two halves keep separate state files** (`device.json`, `sync.json`) in the one home: the loop rewrites
|
|
134
143
|
one half's state while a concurrent `setup` writes the other's, and separate files make cross-half torn
|
|
135
144
|
writes impossible rather than unlikely.
|
|
136
145
|
- **Scopes are a cache.** The sandbox pushes the real grant on every connect; what is stored only governs the
|
package/dist/app.js
CHANGED
|
@@ -3,7 +3,7 @@ import { buildApplication, buildRouteMap, text_en } from "@stricli/core";
|
|
|
3
3
|
import { commands } from "./commands.js";
|
|
4
4
|
export const app = buildApplication(buildRouteMap({
|
|
5
5
|
routes: commands,
|
|
6
|
-
docs: { brief: "intentic-machine, connect this
|
|
6
|
+
docs: { brief: "intentic-machine, connect this device to your intentic sandboxes" },
|
|
7
7
|
}), {
|
|
8
8
|
name: "intentic-machine",
|
|
9
9
|
scanner: { caseStyle: "allow-kebab-for-camel" },
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAC/B,aAAa,CAAC;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAC/B,aAAa,CAAC;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,EAAE,KAAK,EAAE,kEAAkE,EAAE;CACtF,CAAC,EACF;IACI,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE;IAE/C,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE;CAC1E,CACJ,CAAC"}
|
package/dist/autostart.js
CHANGED
|
@@ -3,7 +3,7 @@ export const MACHINE_AUTOSTART = {
|
|
|
3
3
|
id: "intentic-machine",
|
|
4
4
|
windowsRunValue: "IntenticMachine",
|
|
5
5
|
desktopName: "Intentic Machine Agent",
|
|
6
|
-
desktopComment: "Connect this
|
|
6
|
+
desktopComment: "Connect this device to your intentic sandboxes: agent access, file sync, port mirroring",
|
|
7
7
|
logPath: runLogPath,
|
|
8
8
|
launchAgent: { label: "dev.intentic.machine" },
|
|
9
9
|
detachedArgs: ["run"],
|
package/dist/autostart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autostart.js","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWzC,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC5C,EAAE,EAAE,kBAAkB;IACtB,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,wBAAwB;IACrC,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"autostart.js","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWzC,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC5C,EAAE,EAAE,kBAAkB;IACtB,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,wBAAwB;IACrC,cAAc,EAAE,yFAAyF;IAGzG,OAAO,EAAE,UAAU;IACnB,WAAW,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE;IAC9C,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,cAAc,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC;IACvC,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CACpB,mEAAmE,MAAM,uFAAuF,UAAU,EAAE;CACnL,CAAC"}
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CommandContext } from "@stricli/core";
|
|
2
2
|
export declare const commands: {
|
|
3
|
-
|
|
3
|
+
device: import("@stricli/core").RouteMap<CommandContext>;
|
|
4
4
|
sync: import("@stricli/core").RouteMap<CommandContext>;
|
|
5
5
|
run: import("@stricli/core").Command<CommandContext>;
|
|
6
6
|
status: import("@stricli/core").Command<CommandContext>;
|
package/dist/commands.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildCommand, buildRouteMap } from "@stricli/core";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceCommands, deviceUninstall } from "./device/commands.js";
|
|
3
3
|
import { ensureWindowsLauncher, machineUpgradeExec } from "./install.js";
|
|
4
4
|
import { reconcileResidency, runForeground, stopResident } from "./resident.js";
|
|
5
5
|
import { status } from "./status.js";
|
|
@@ -58,14 +58,14 @@ const uninstall = buildCommand({
|
|
|
58
58
|
async func() {
|
|
59
59
|
const out = (message) => void this.process.stdout.write(`${message}\n`);
|
|
60
60
|
await syncUninstall(out);
|
|
61
|
-
await
|
|
61
|
+
await deviceUninstall(out);
|
|
62
62
|
out("Nothing intentic stays resident on this machine.");
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
export const commands = {
|
|
66
|
-
|
|
67
|
-
routes:
|
|
68
|
-
docs: { brief: "Let a sandbox work on this
|
|
66
|
+
device: buildRouteMap({
|
|
67
|
+
routes: deviceCommands,
|
|
68
|
+
docs: { brief: "Let a sandbox work on this device (the Connect-this-device card)" },
|
|
69
69
|
}),
|
|
70
70
|
sync: buildRouteMap({
|
|
71
71
|
routes: syncCommands,
|
package/dist/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO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AAO,IAAI,CAAC,CAAC;QACtF,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;QAC3B,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAC5D,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,MAAM,EAAE,aAAa,CAAC;QAClB,MAAM,EAAE,cAAc;QACtB,IAAI,EAAE,EAAE,KAAK,EAAE,kEAAkE,EAAE;KACtF,CAAC;IACF,IAAI,EAAE,aAAa,CAAC;QAChB,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,EAAE,KAAK,EAAE,8EAA8E,EAAE;KAClG,CAAC;IACF,GAAG;IACH,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;CACZ,CAAC"}
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO,QAAW,CAAC;AAQhC,eAAO,MAAM,UAAU,QAA+B,CAAC;AACvD,eAAO,MAAM,UAAU,QAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO,QAAW,CAAC;AAQhC,eAAO,MAAM,UAAU,QAA+B,CAAC;AACvD,eAAO,MAAM,UAAU,QAA+B,CAAC;AASvD,eAAO,MAAM,YAAY,QAAsC,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -4,4 +4,5 @@ const home = agentHome("machine");
|
|
|
4
4
|
export const baseDir = home.dir;
|
|
5
5
|
export const runPidPath = join(baseDir, "machine.pid");
|
|
6
6
|
export const runLogPath = join(baseDir, "machine.log");
|
|
7
|
+
export const agentLogPath = join(baseDir, "machine-update.log");
|
|
7
8
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AASlD,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;AAQhC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AASlD,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;AAQhC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AASvD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/device/audit.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,KAAK,UAAiB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,KAAG,OAAO,CAAC,IAAI,CAO9F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/device/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAWxC,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,KAAoD,EAAiB,EAAE;IAC/F,IAAI,CAAC;QACD,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,MAAM,UAAU,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtI,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Log } from "@intentic/local-agent";
|
|
2
|
-
import type {
|
|
3
|
-
export declare const prepareTargets: (boxes: readonly
|
|
2
|
+
import type { DeviceSandbox } from "@intentic/sandbox-contract";
|
|
3
|
+
export declare const prepareTargets: (boxes: readonly DeviceSandbox[]) => string[];
|
|
4
4
|
export declare const ticksToSkip: (failures: number) => number;
|
|
5
5
|
export declare const autoPrepareArgs: (slug: string) => string[];
|
|
6
6
|
export interface AutoPrepareState {
|
|
@@ -8,7 +8,7 @@ export interface AutoPrepareState {
|
|
|
8
8
|
readonly waits: Map<string, number>;
|
|
9
9
|
}
|
|
10
10
|
export declare const newState: () => AutoPrepareState;
|
|
11
|
-
export declare const runTick: (state: AutoPrepareState, boxes: readonly
|
|
11
|
+
export declare const runTick: (state: AutoPrepareState, boxes: readonly DeviceSandbox[], prepare: (slug: string) => Promise<{
|
|
12
12
|
code: number;
|
|
13
13
|
output: string;
|
|
14
14
|
}>, log: Log, busy?: ReadonlySet<string>) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-prepare.d.ts","sourceRoot":"","sources":["../../src/device/auto-prepare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AA2ChE,eAAO,MAAM,cAAc,UAAW,SAAS,aAAa,EAAE,KAAG,MAAM,EACyB,CAAC;AAGjG,eAAO,MAAM,WAAW,aAAc,MAAM,KAAG,MAA6E,CAAC;AAI7H,eAAO,MAAM,eAAe,SAAU,MAAM,KAAG,MAAM,EAA4C,CAAC;AAIlG,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,QAAQ,QAAO,gBAA+D,CAAC;AAyC5F,eAAO,MAAM,OAAO,UACT,gBAAgB,SAChB,SAAS,aAAa,EAAE,WACtB,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,OAC/D,GAAG,SACF,WAAW,CAAC,MAAM,CAAC,KAC1B,OAAO,CAAC,IAAI,CAuBd,CAAC;AAMF,eAAO,MAAM,gBAAgB,QAAS,GAAG,KAAG;IAAE,IAAI,EAAE,MAAM,IAAI,CAAA;CA4B7D,CAAC"}
|
|
@@ -0,0 +1 @@
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
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const deviceUninstall: (out: Log, sandbox?: string) => Promise<void>;
|
|
4
|
+
export declare const deviceCommands: {
|
|
5
5
|
setup: import("@stricli/core").Command<CommandContext>;
|
|
6
6
|
uninstall: import("@stricli/core").Command<CommandContext>;
|
|
7
7
|
updates: import("@stricli/core").Command<CommandContext>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/device/commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,GAAG,EAA0B,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAwKlE,eAAO,MAAM,eAAe,QAAe,GAAG,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CA2B9E,CAAC;AA6CF,eAAO,MAAM,cAAc;;;;CAAgC,CAAC"}
|
|
@@ -23,7 +23,7 @@ const enroll = async (sandboxUrl, pairToken, { attempts = 10, delayMs = 3000 } =
|
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
25
|
if (response.status === 401) {
|
|
26
|
-
throw new Error("that pairing has expired: click Connect again on the
|
|
26
|
+
throw new Error("that pairing has expired: click Connect again on the device's card in your sandbox for a fresh command.");
|
|
27
27
|
}
|
|
28
28
|
if (response.status >= 500 && attempt < attempts) {
|
|
29
29
|
process.stderr.write(`connecting: the sandbox is warming up (HTTP ${response.status}), retrying (${attempt}/${attempts})…\n`);
|
|
@@ -31,24 +31,24 @@ const enroll = async (sandboxUrl, pairToken, { attempts = 10, delayMs = 3000 } =
|
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
33
|
if (!response.ok) {
|
|
34
|
-
throw new Error(`connecting this
|
|
34
|
+
throw new Error(`connecting this device failed (${response.status}): ${await response.text()}`);
|
|
35
35
|
}
|
|
36
36
|
return (await response.json());
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
const setup = buildCommand({
|
|
40
|
-
docs: { brief: "Connect this
|
|
40
|
+
docs: { brief: "Connect this device to an intentic sandbox using a one-time pairing token" },
|
|
41
41
|
parameters: {
|
|
42
42
|
flags: {
|
|
43
43
|
url: { kind: "parsed", parse: String, brief: "The sandbox's URL (e.g. https://sandbox-xxx.example.dev)" },
|
|
44
|
-
pair: { kind: "parsed", parse: String, brief: "The one-time pairing token from the
|
|
44
|
+
pair: { kind: "parsed", parse: String, brief: "The one-time pairing token from the device's capability card" },
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
async func(flags) {
|
|
48
48
|
await prepareSetup((message) => void this.process.stdout.write(`${message}\n`), process.argv.slice(2));
|
|
49
49
|
const ui = createUi(this.process);
|
|
50
50
|
const out = ui.note;
|
|
51
|
-
ui.begin("intentic · connect this
|
|
51
|
+
ui.begin("intentic · connect this device", SETUP_PLAN);
|
|
52
52
|
try {
|
|
53
53
|
await runSetup(ui, out, flags);
|
|
54
54
|
}
|
|
@@ -58,31 +58,31 @@ const setup = buildCommand({
|
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
60
|
const SETUP_PLAN = [
|
|
61
|
-
{ phase: "
|
|
62
|
-
{ phase: "
|
|
61
|
+
{ phase: "device-enrolling", label: "Enrol this device", weight: 10 },
|
|
62
|
+
{ phase: "device-starting", label: "Start the agent", weight: 15 },
|
|
63
63
|
];
|
|
64
64
|
const runSetup = async (ui, out, flags) => {
|
|
65
|
-
ui.step("
|
|
66
|
-
const { id,
|
|
65
|
+
ui.step("device-enrolling", "enrolling this device with your sandbox…");
|
|
66
|
+
const { id, token } = await enroll(flags.url, flags.pair);
|
|
67
67
|
const link = {
|
|
68
68
|
sandboxUrl: flags.url,
|
|
69
69
|
id,
|
|
70
|
-
token
|
|
70
|
+
token,
|
|
71
71
|
scopes: { shell: "off", write: "off", screen: "off", control: "off", sandboxes: "off", sandboxRemove: "off", destructive: "off" },
|
|
72
72
|
};
|
|
73
73
|
const links = await upsertLink(link);
|
|
74
|
-
ui.step("
|
|
74
|
+
ui.step("device-starting", "starting the agent on this device…");
|
|
75
75
|
await reconcileResidency(out);
|
|
76
76
|
const others = links.length - 1;
|
|
77
|
-
ui.finished("This
|
|
77
|
+
ui.finished("This device is connected.", id, others === 0
|
|
78
78
|
? "Its permissions are set in the sandbox, on the same card you got this command from."
|
|
79
79
|
: `Its permissions are set in the sandbox, on the same card you got this command from. Still connected to ${others} other sandbox${others === 1 ? "" : "es"}.`, [
|
|
80
80
|
["check it", "intentic-machine status"],
|
|
81
|
-
["disconnect", "intentic-machine
|
|
81
|
+
["disconnect", "intentic-machine device uninstall"],
|
|
82
82
|
]);
|
|
83
83
|
};
|
|
84
84
|
const uninstall = buildCommand({
|
|
85
|
-
docs: { brief: "Disconnect this
|
|
85
|
+
docs: { brief: "Disconnect this device from one sandbox, or from all of them" },
|
|
86
86
|
parameters: {
|
|
87
87
|
flags: {
|
|
88
88
|
sandbox: { kind: "parsed", parse: String, brief: "Disconnect only this sandbox URL (default: every one)", optional: true },
|
|
@@ -90,15 +90,15 @@ const uninstall = buildCommand({
|
|
|
90
90
|
},
|
|
91
91
|
async func(flags) {
|
|
92
92
|
const out = (message) => void this.process.stdout.write(`${message}\n`);
|
|
93
|
-
await
|
|
93
|
+
await deviceUninstall(out, flags.sandbox);
|
|
94
94
|
},
|
|
95
95
|
});
|
|
96
|
-
export const
|
|
96
|
+
export const deviceUninstall = async (out, sandbox) => {
|
|
97
97
|
const only = sandbox === undefined || sandbox === "" ? undefined : sandbox;
|
|
98
98
|
const dropped = await removeLinks(only);
|
|
99
99
|
const left = await readLinks();
|
|
100
100
|
if (only !== undefined && dropped.length === 0) {
|
|
101
|
-
out(`This
|
|
101
|
+
out(`This device is not connected to ${only}. Nothing changed.`);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
if (left.length === 0) {
|
|
@@ -111,7 +111,7 @@ export const computerUninstall = async (out, sandbox) => {
|
|
|
111
111
|
}
|
|
112
112
|
out(dropped.length === 0
|
|
113
113
|
? "Nothing was connected. Removed any leftovers."
|
|
114
|
-
: `Disconnected from ${dropped.map((link) => link.sandboxUrl).join(", ")}. Each sandbox still lists this
|
|
114
|
+
: `Disconnected from ${dropped.map((link) => link.sandboxUrl).join(", ")}. Each sandbox still lists this device until it is removed there, its access is already gone.`);
|
|
115
115
|
out(`Your record of what this agent did stays at ${auditPath}.`);
|
|
116
116
|
};
|
|
117
117
|
const updates = buildCommand({
|
|
@@ -140,5 +140,5 @@ const updates = buildCommand({
|
|
|
140
140
|
: "Background update downloads are off. The update card in your sandbox still downloads and applies on demand.");
|
|
141
141
|
},
|
|
142
142
|
});
|
|
143
|
-
export const
|
|
143
|
+
export const deviceCommands = { setup, uninstall, updates };
|
|
144
144
|
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/device/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAoC,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAuB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAiB,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAgBhJ,MAAM,MAAM,GAAG,KAAK,EAChB,UAAkB,EAClB,SAAiB,EACjB,EAAE,QAAQ,GAAG,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE,GAA4C,EAAE,EACzC,EAAE;IACxC,KAAK,IAAI,OA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AM,WAAW,gBAAuB,MAAM,KAAG,OAAO,CAAC,SAAS,QAAQ,EAAE,CAKlF,CAAC;AAIF,eAAO,MAAM,cAAc,eAAsB,MAAM,UAAU,UAAU,KAAG,OAAO,CAAC,IAAI,CAQzF,CAAC;AAIF,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,OAAO,CAA8E,CAAC;AAE1I,eAAO,MAAM,mBAAmB,OAAc,OAAO,KAAG,OAAO,CAAC,IAAI,CAEnE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { writeSecretFile } from "@intentic/local-agent";
|
|
4
4
|
import { baseDir } from "../config.js";
|
|
5
|
-
export const configPath = join(baseDir, "
|
|
5
|
+
export const configPath = join(baseDir, "device.json");
|
|
6
6
|
export const auditPath = join(baseDir, "audit.jsonl");
|
|
7
7
|
export const readHostConfig = async () => JSON.parse(await readFile(configPath, "utf8"));
|
|
8
8
|
export const writeHostConfig = async (config) => await writeSecretFile(configPath, baseDir, JSON.stringify(config, undefined, 2));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/device/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQvC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AA6CtD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAA6B,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ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C,MAAM,kBAAkB,GAAG,KAAK,IAAsB,EAAE,CAAC,CAAC,MAAM,cAAc,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,KAAK,KAAK,CAAC;AAE1I,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EAAW,EAAiB,EAAE;IACpE,MAAM,gBAAgB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { Log } from "@intentic/local-agent";
|
|
2
|
+
import { type PeerLink } from "@intentic/sandbox-contract/peer-dial";
|
|
2
3
|
import { type DaemonBase } from "../daemon-base.js";
|
|
3
4
|
import { type HostLink } from "./config.js";
|
|
4
|
-
export interface HostConnection {
|
|
5
|
-
readonly done: Promise<void>;
|
|
6
|
-
readonly stop: () => void;
|
|
7
|
-
}
|
|
8
5
|
export interface Dial {
|
|
9
6
|
readonly resolveBase: (sandboxUrl: string) => Promise<DaemonBase>;
|
|
10
7
|
readonly socket: (url: string) => WebSocket;
|
|
11
8
|
}
|
|
12
|
-
export declare const connect: (config: HostLink, version: string, log: Log, dial?: Dial) =>
|
|
9
|
+
export declare const connect: (config: HostLink, version: string, log: Log, dial?: Dial) => PeerLink;
|
|
13
10
|
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/device/connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAElG,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAuB5D,MAAM,WAAW,IAAI;IACjB,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;CAC/C;AAID,eAAO,MAAM,OAAO,WAAY,QAAQ,WAAW,MAAM,OAAO,GAAG,SAAQ,IAAI,KAAc,QAyC5F,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createBackoff } from "@intentic/base/async";
|
|
2
|
+
import { hostConnectUrl } from "@intentic/sandbox-contract";
|
|
3
|
+
import { dialPeer, PEER_LINK_BACKOFF } from "@intentic/sandbox-contract/peer-dial";
|
|
4
|
+
import { RPCHandler } from "@orpc/server/websocket";
|
|
5
|
+
import { resolveDaemonBase } from "../daemon-base.js";
|
|
6
|
+
import { rememberScopes } from "./config.js";
|
|
7
|
+
import { createHostRouter } from "./router.js";
|
|
8
|
+
const realDial = { resolveBase: resolveDaemonBase, socket: (url) => new WebSocket(url) };
|
|
9
|
+
export const connect = (config, version, log, dial = realDial) => {
|
|
10
|
+
let scopes = config.scopes;
|
|
11
|
+
const handler = new RPCHandler(createHostRouter({
|
|
12
|
+
scopes: () => scopes,
|
|
13
|
+
setScopes: (next) => {
|
|
14
|
+
scopes = next;
|
|
15
|
+
void rememberScopes(config.sandboxUrl, next);
|
|
16
|
+
},
|
|
17
|
+
log,
|
|
18
|
+
}));
|
|
19
|
+
return dialPeer({
|
|
20
|
+
open: async (signal) => {
|
|
21
|
+
const { base, local } = await dial.resolveBase(config.sandboxUrl);
|
|
22
|
+
if (signal.aborted) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
socket: dial.socket(hostConnectUrl(base)),
|
|
27
|
+
said: `connected to ${config.sandboxUrl}${local ? ` over loopback (${base})` : ""} as "${config.id}"`,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
hello: () => ({ type: "hello", token: config.token, version }),
|
|
31
|
+
attach: (ws) => handler.upgrade(ws),
|
|
32
|
+
backoff: createBackoff(PEER_LINK_BACKOFF),
|
|
33
|
+
log,
|
|
34
|
+
revoked: () => log("the sandbox refused this device's enrollment: it was revoked there. Run `intentic-machine device uninstall` to clean up, or connect again from the sandbox."),
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/device/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAmB,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAiB,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAmB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2B/C,MAAM,QAAQ,GAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;AAE/F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAgB,EAAE,OAAe,EAAE,GAAQ,EAAE,IAAI,GAAS,QAAQ,EAAY,EAAE;IAIpG,IAAI,MAAM,GAAe,MAAM,CAAC,MAAM,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,UAAU,CAC1B,gBAAgB,CAAC;QACb,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;QACpB,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,GAAG,IAAI,CAAC;YAMd,KAAK,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC;QACD,GAAG;KACN,CAAC,CACL,CAAC;IAEF,OAAO,QAAQ,CAAY;QACvB,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACnB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAClE,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO,SAAS,CAAC;YACrB,CAAC;YACD,OAAO;gBACH,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;gBAGzC,IAAI,EAAE,gBAAgB,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,MAAM,CAAC,EAAE,GAAG;aACxG,CAAC;QACN,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QAC9D,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC;QACzC,GAAG;QACH,OAAO,EAAE,GAAG,EAAE,CACV,GAAG,CAAC,6JAA6J,CAAC;KACzK,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const handleMcpMessage: (message: unknown, ctx: {
|
|
2
|
+
shell: "off" | "on";
|
|
3
|
+
write: "off" | "on";
|
|
4
|
+
screen: "off" | "on";
|
|
5
|
+
control: "off" | "on";
|
|
6
|
+
sandboxes: "off" | "on";
|
|
7
|
+
sandboxRemove: "off" | "on";
|
|
8
|
+
destructive: "off" | "on";
|
|
9
|
+
roots?: string | undefined;
|
|
10
|
+
}) => Promise<Record<string, unknown> | undefined>;
|
|
11
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/device/mcp.ts"],"names":[],"mappings":"AAuVA,eAAO,MAAM,gBAAgB;;;;;;;;;kDAQ3B,CAAC"}
|