@intentic/machine 1.233.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/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +12 -0
- package/dist/app.js.map +1 -0
- package/dist/autostart.d.ts +3 -0
- package/dist/autostart.d.ts.map +1 -0
- package/dist/autostart.js +13 -0
- package/dist/autostart.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +11 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +91 -0
- package/dist/commands.js.map +1 -0
- package/dist/computer/audit.d.ts +6 -0
- package/dist/computer/audit.d.ts.map +1 -0
- package/dist/computer/audit.js +12 -0
- package/dist/computer/audit.js.map +1 -0
- package/dist/computer/commands.d.ts +8 -0
- package/dist/computer/commands.d.ts.map +1 -0
- package/dist/computer/commands.js +113 -0
- package/dist/computer/commands.js.map +1 -0
- package/dist/computer/config.d.ts +19 -0
- package/dist/computer/config.d.ts.map +1 -0
- package/dist/computer/config.js +31 -0
- package/dist/computer/config.js.map +1 -0
- package/dist/computer/connection.d.ts +8 -0
- package/dist/computer/connection.d.ts.map +1 -0
- package/dist/computer/connection.js +63 -0
- package/dist/computer/connection.js.map +1 -0
- package/dist/computer/mcp.d.ts +3 -0
- package/dist/computer/mcp.d.ts.map +1 -0
- package/dist/computer/mcp.js +312 -0
- package/dist/computer/mcp.js.map +1 -0
- package/dist/computer/policy.d.ts +8 -0
- package/dist/computer/policy.d.ts.map +1 -0
- package/dist/computer/policy.js +42 -0
- package/dist/computer/policy.js.map +1 -0
- package/dist/computer/router.d.ts +93 -0
- package/dist/computer/router.d.ts.map +1 -0
- package/dist/computer/router.js +79 -0
- package/dist/computer/router.js.map +1 -0
- package/dist/computer/tools/apps.d.ts +9 -0
- package/dist/computer/tools/apps.d.ts.map +1 -0
- package/dist/computer/tools/apps.js +41 -0
- package/dist/computer/tools/apps.js.map +1 -0
- package/dist/computer/tools/browser.d.ts +11 -0
- package/dist/computer/tools/browser.d.ts.map +1 -0
- package/dist/computer/tools/browser.js +63 -0
- package/dist/computer/tools/browser.js.map +1 -0
- package/dist/computer/tools/computer.d.ts +16 -0
- package/dist/computer/tools/computer.d.ts.map +1 -0
- package/dist/computer/tools/computer.js +80 -0
- package/dist/computer/tools/computer.js.map +1 -0
- package/dist/computer/tools/describe.d.ts +4 -0
- package/dist/computer/tools/describe.d.ts.map +1 -0
- package/dist/computer/tools/describe.js +37 -0
- package/dist/computer/tools/describe.js.map +1 -0
- package/dist/computer/tools/files.d.ts +12 -0
- package/dist/computer/tools/files.d.ts.map +1 -0
- package/dist/computer/tools/files.js +58 -0
- package/dist/computer/tools/files.js.map +1 -0
- package/dist/computer/tools/sandboxes.d.ts +45 -0
- package/dist/computer/tools/sandboxes.d.ts.map +1 -0
- package/dist/computer/tools/sandboxes.js +230 -0
- package/dist/computer/tools/sandboxes.js.map +1 -0
- package/dist/computer/tools/shell.d.ts +22 -0
- package/dist/computer/tools/shell.d.ts.map +1 -0
- package/dist/computer/tools/shell.js +78 -0
- package/dist/computer/tools/shell.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -0
- package/dist/resident.d.ts +8 -0
- package/dist/resident.d.ts.map +1 -0
- package/dist/resident.js +92 -0
- package/dist/resident.js.map +1 -0
- package/dist/status.d.ts +21 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +123 -0
- package/dist/status.js.map +1 -0
- package/dist/sync/commands.d.ts +20 -0
- package/dist/sync/commands.d.ts.map +1 -0
- package/dist/sync/commands.js +244 -0
- package/dist/sync/commands.js.map +1 -0
- package/dist/sync/config.d.ts +41 -0
- package/dist/sync/config.d.ts.map +1 -0
- package/dist/sync/config.js +35 -0
- package/dist/sync/config.js.map +1 -0
- package/dist/sync/exec.d.ts +10 -0
- package/dist/sync/exec.d.ts.map +1 -0
- package/dist/sync/exec.js +26 -0
- package/dist/sync/exec.js.map +1 -0
- package/dist/sync/git-bridge.d.ts +11 -0
- package/dist/sync/git-bridge.d.ts.map +1 -0
- package/dist/sync/git-bridge.js +122 -0
- package/dist/sync/git-bridge.js.map +1 -0
- package/dist/sync/mirror.d.ts +19 -0
- package/dist/sync/mirror.d.ts.map +1 -0
- package/dist/sync/mirror.js +310 -0
- package/dist/sync/mirror.js.map +1 -0
- package/dist/sync/mutagen.d.ts +68 -0
- package/dist/sync/mutagen.d.ts.map +1 -0
- package/dist/sync/mutagen.js +289 -0
- package/dist/sync/mutagen.js.map +1 -0
- package/dist/sync/report.d.ts +6 -0
- package/dist/sync/report.d.ts.map +1 -0
- package/dist/sync/report.js +66 -0
- package/dist/sync/report.js.map +1 -0
- package/dist/sync/ssh.d.ts +29 -0
- package/dist/sync/ssh.d.ts.map +1 -0
- package/dist/sync/ssh.js +165 -0
- package/dist/sync/ssh.js.map +1 -0
- package/dist/sync/tunnel.d.ts +22 -0
- package/dist/sync/tunnel.d.ts.map +1 -0
- package/dist/sync/tunnel.js +160 -0
- package/dist/sync/tunnel.js.map +1 -0
- package/dist/upgrade.d.ts +36 -0
- package/dist/upgrade.d.ts.map +1 -0
- package/dist/upgrade.js +95 -0
- package/dist/upgrade.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Artur Kurowski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @intentic/machine
|
|
2
|
+
|
|
3
|
+
The one agent that lives on a user's own computer: it lets a sandbox's agent work on the machine, and keeps the
|
|
4
|
+
machine's folders and ports mirrored with the sandbox — one binary, one resident loop, one logon entry.
|
|
5
|
+
|
|
6
|
+
It replaces two agents (`@intentic/host` and `@intentic/sync`) that shared everything about *being installed* —
|
|
7
|
+
a resident loop, a pidfile, a login entry, an updater, a ~90 MB compiled binary — and nothing about what they
|
|
8
|
+
did. Merging them halves what a machine downloads and keeps resident, and gives "is this machine's agent
|
|
9
|
+
running" one answer instead of two halves of one.
|
|
10
|
+
|
|
11
|
+
## Responsibilities
|
|
12
|
+
|
|
13
|
+
The **computer half** (`src/computer/`, the machine side of the `host` capability):
|
|
14
|
+
|
|
15
|
+
- Dial each linked sandbox — one outbound WebSocket, enrollment token in the first frame, oRPC after that; the
|
|
16
|
+
machine *serves* `hostContract`, so no port ever opens here.
|
|
17
|
+
- Expose the tool surface (`run_command`, files, screenshot, `describe`; deliberately no delete — trash is
|
|
18
|
+
recoverable) as MCP carried verbatim, so a machine can learn a tool without a daemon release.
|
|
19
|
+
- Enforce the owner's scopes **here**, never in the sandbox, and append every call to an audit log that
|
|
20
|
+
survives uninstall.
|
|
21
|
+
|
|
22
|
+
The **sync half** (`src/sync/`, the machine side of desktop sync):
|
|
23
|
+
|
|
24
|
+
- Enroll an SSH key, then drive Mutagen: bidirectional file sync of a local folder ↔ the sandbox's /work, plus
|
|
25
|
+
a one-way backup of the sandbox's own state.
|
|
26
|
+
- Serve the SSH transport itself on loopback (the sandbox's sshd reached over its HTTPS surface), mirror every
|
|
27
|
+
workspace port onto this machine's localhost, and bridge git so commits appear in local clones.
|
|
28
|
+
- Register Mutagen's daemon for login autostart — on Windows through the launcher stub, because Mutagen's own
|
|
29
|
+
registration flashes a console window at every boot.
|
|
30
|
+
|
|
31
|
+
**Shared** (`src/`): the one resident loop (`run`), the merged `status` (and its `--json` envelope the desktop
|
|
32
|
+
app's tray reads), self-`upgrade` with automatic rollback, and the autostart spec.
|
|
33
|
+
|
|
34
|
+
## The resident loop
|
|
35
|
+
|
|
36
|
+
`intentic-machine run --foreground` (what systemd, launchd and the Windows launcher stub run) serves both
|
|
37
|
+
halves in one process ([src/resident.ts](src/resident.ts)):
|
|
38
|
+
|
|
39
|
+
- The sync half re-reads its pairing list every tick; the computer half's link list is fixed at startup, which
|
|
40
|
+
is why every `setup`/`uninstall` restarts the loop (`reconcileResidency`) instead of poking it.
|
|
41
|
+
- The process exits — and takes the login entry with it — only when **both** halves have nothing to serve.
|
|
42
|
+
- On a signal it exits `128+signal`, never 0: a supervisor must restart what it did not stop, and the incident
|
|
43
|
+
that bought that rule is written out in [src/sync/mirror.ts](src/sync/mirror.ts).
|
|
44
|
+
|
|
45
|
+
## Key files
|
|
46
|
+
|
|
47
|
+
- [src/commands.ts](src/commands.ts) — the CLI surface: `computer setup|uninstall`, `sync setup|pause|resume|uninstall`, shared `run|status|version|upgrade|uninstall`.
|
|
48
|
+
- [src/resident.ts](src/resident.ts) — the one loop, its pidfile, and `reconcileResidency`.
|
|
49
|
+
- [src/status.ts](src/status.ts) — both halves as one answer; `--json` is what the desktop app and tray read.
|
|
50
|
+
- [src/computer/policy.ts](src/computer/policy.ts) — what the sandbox is permitted to do here; the security surface.
|
|
51
|
+
- [src/sync/mirror.ts](src/sync/mirror.ts) — the sync tick: ports reconcile, git bridge, revocation handling.
|
|
52
|
+
- [src/sync/mutagen.ts](src/sync/mutagen.ts) — driving the Mutagen binary, sessions and its daemon's autostart.
|
|
53
|
+
|
|
54
|
+
## How it fits
|
|
55
|
+
|
|
56
|
+
Runs on the user's machine, not in the sandbox. Installed by `computer.{sh,ps1}` / `sync.{sh,ps1}` (both cards
|
|
57
|
+
download the same binary into `~/.intentic/machine/bin`, plus `intentic-launch.exe` on Windows), shipped as a
|
|
58
|
+
bun-compiled binary per platform, self-updated by `upgrade`. The install-and-stay-alive plumbing is
|
|
59
|
+
[`@intentic/local-agent`](../local-agent)'s; the windowless Windows logon start is
|
|
60
|
+
[`_computers/win-launcher`](../win-launcher)'s.
|
|
61
|
+
|
|
62
|
+
## Conventions & gotchas
|
|
63
|
+
|
|
64
|
+
- **Bidirectional sync has no undo.** The integration tests here run against real directories and a real
|
|
65
|
+
Mutagen for exactly that reason; a unit test that mocks the sync proves nothing about the case that loses work.
|
|
66
|
+
- **The two halves keep separate state files** (`computer.json`, `sync.json`) in the one home: the loop rewrites
|
|
67
|
+
one half's state while a concurrent `setup` writes the other's, and separate files make cross-half torn
|
|
68
|
+
writes impossible rather than unlikely.
|
|
69
|
+
- **Scopes are a cache.** The sandbox pushes the real grant on every connect; what is stored only governs the
|
|
70
|
+
seconds before the first push, and it starts at everything-off.
|
|
71
|
+
- **The transport lives in the resident loop**, so `sync setup` starts the loop *before* it probes ssh or hands
|
|
72
|
+
anything to Mutagen: every step after that one needs the port to be open.
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,GAAG,6EAWf,CAAC"}
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { agentException } from "@intentic/local-agent";
|
|
2
|
+
import { buildApplication, buildRouteMap, text_en } from "@stricli/core";
|
|
3
|
+
import { commands } from "./commands.js";
|
|
4
|
+
export const app = buildApplication(buildRouteMap({
|
|
5
|
+
routes: commands,
|
|
6
|
+
docs: { brief: "intentic-machine, connect this computer to your intentic sandboxes" },
|
|
7
|
+
}), {
|
|
8
|
+
name: "intentic-machine",
|
|
9
|
+
scanner: { caseStyle: "allow-kebab-for-camel" },
|
|
10
|
+
localization: { text: { ...text_en, formatException: agentException } },
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +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,oEAAoE,EAAE;CACxF,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autostart.d.ts","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAY3D,eAAO,MAAM,iBAAiB,EAAE,aAa/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { runLogPath } from "./config.js";
|
|
2
|
+
export const MACHINE_AUTOSTART = {
|
|
3
|
+
id: "intentic-machine",
|
|
4
|
+
windowsRunValue: "IntenticMachine",
|
|
5
|
+
desktopName: "Intentic Machine Agent",
|
|
6
|
+
desktopComment: "Connect this computer to your intentic sandboxes: agent access, file sync, port mirroring",
|
|
7
|
+
logPath: runLogPath,
|
|
8
|
+
launchAgent: { label: "dev.intentic.machine" },
|
|
9
|
+
detachedArgs: ["run"],
|
|
10
|
+
foregroundArgs: ["run", "--foreground"],
|
|
11
|
+
failureNote: (reason) => `note: couldn't register this machine's agent to start at login (${reason}); it runs until this machine restarts, then re-run \`intentic-machine run\`. Logs: ${runLogPath}`,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=autostart.js.map
|
|
@@ -0,0 +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,2FAA2F;IAG3G,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/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,OAAyB,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CommandContext } from "@stricli/core";
|
|
2
|
+
export declare const commands: {
|
|
3
|
+
computer: import("@stricli/core").RouteMap<CommandContext>;
|
|
4
|
+
sync: import("@stricli/core").RouteMap<CommandContext>;
|
|
5
|
+
run: import("@stricli/core").Command<CommandContext>;
|
|
6
|
+
status: import("@stricli/core").Command<CommandContext>;
|
|
7
|
+
version: import("@stricli/core").Command<CommandContext>;
|
|
8
|
+
upgrade: import("@stricli/core").Command<CommandContext>;
|
|
9
|
+
uninstall: import("@stricli/core").Command<CommandContext>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AA2HjF,eAAO,MAAM,QAAQ;;;;;;;;CAcpB,CAAC"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
2
|
+
import { buildCommand, buildRouteMap } from "@stricli/core";
|
|
3
|
+
import { computerCommands, computerUninstall } from "./computer/commands.js";
|
|
4
|
+
import { readResidentPid, reconcileResidency, runForeground, stopResident } from "./resident.js";
|
|
5
|
+
import { status } from "./status.js";
|
|
6
|
+
import { syncCommands, syncUninstall } from "./sync/commands.js";
|
|
7
|
+
import { assetUrl, realUpgradeExec, runUpgrade, upgradeMessage } from "./upgrade.js";
|
|
8
|
+
import { MACHINE_VERSION } from "./version.js";
|
|
9
|
+
const run = buildCommand({
|
|
10
|
+
docs: { brief: "Run this machine's agent: sandbox connections, file sync, port mirroring (setup starts this for you)" },
|
|
11
|
+
parameters: {
|
|
12
|
+
flags: {
|
|
13
|
+
foreground: { kind: "boolean", brief: "Run the loop in this terminal instead of the background" },
|
|
14
|
+
stop: { kind: "boolean", brief: "Stop the background loop" },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
async func(flags) {
|
|
18
|
+
const out = (message) => void this.process.stdout.write(`${message}\n`);
|
|
19
|
+
if (flags.stop) {
|
|
20
|
+
const pid = await stopResident();
|
|
21
|
+
out(pid === undefined ? "not running." : `stopped (pid ${pid}).`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!flags.foreground) {
|
|
25
|
+
await reconcileResidency(out);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await runForeground((message) => void this.process.stdout.write(`[${new Date().toISOString()}] ${message}\n`));
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const version = buildCommand({
|
|
32
|
+
docs: { brief: "Print this agent's version" },
|
|
33
|
+
parameters: {},
|
|
34
|
+
func() {
|
|
35
|
+
this.process.stdout.write(`${MACHINE_VERSION}\n`);
|
|
36
|
+
return Promise.resolve();
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const RESIDENT_START_TIMEOUT_MS = 10_000;
|
|
40
|
+
const RESIDENT_START_POLL_MS = 200;
|
|
41
|
+
const residentCameUp = async () => {
|
|
42
|
+
for (let waited = 0; waited < RESIDENT_START_TIMEOUT_MS; waited += RESIDENT_START_POLL_MS) {
|
|
43
|
+
if ((await readResidentPid()) !== undefined) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
await sleep(RESIDENT_START_POLL_MS);
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
};
|
|
50
|
+
const upgrade = buildCommand({
|
|
51
|
+
docs: { brief: "Download and install the current agent, then restart the background loop" },
|
|
52
|
+
parameters: {
|
|
53
|
+
flags: {
|
|
54
|
+
force: {
|
|
55
|
+
kind: "boolean",
|
|
56
|
+
brief: "Install the published agent even over one built from source (which is otherwise left alone)",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
async func(flags) {
|
|
61
|
+
const out = (message) => void this.process.stdout.write(`${message}\n`);
|
|
62
|
+
const exec = realUpgradeExec(stopResident, async () => await reconcileResidency(() => undefined), residentCameUp);
|
|
63
|
+
out(upgradeMessage(await runUpgrade(exec, assetUrl(), MACHINE_VERSION, flags.force, out)));
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const uninstall = buildCommand({
|
|
67
|
+
docs: { brief: "Remove this machine's agent entirely: every sandbox link, every sync pairing, the login entry" },
|
|
68
|
+
parameters: {},
|
|
69
|
+
async func() {
|
|
70
|
+
const out = (message) => void this.process.stdout.write(`${message}\n`);
|
|
71
|
+
await syncUninstall(out);
|
|
72
|
+
await computerUninstall(out);
|
|
73
|
+
out("Nothing intentic stays resident on this machine.");
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export const commands = {
|
|
77
|
+
computer: buildRouteMap({
|
|
78
|
+
routes: computerCommands,
|
|
79
|
+
docs: { brief: "Let a sandbox work on this computer (the Connect-this-computer card)" },
|
|
80
|
+
}),
|
|
81
|
+
sync: buildRouteMap({
|
|
82
|
+
routes: syncCommands,
|
|
83
|
+
docs: { brief: "Mirror a sandbox's files and ports onto this machine (the Desktop sync card)" },
|
|
84
|
+
}),
|
|
85
|
+
run,
|
|
86
|
+
status,
|
|
87
|
+
version,
|
|
88
|
+
upgrade,
|
|
89
|
+
uninstall,
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiB/C,MAAM,GAAG,GAAG,YAAY,CAAW;IAC/B,IAAI,EAAE,EAAE,KAAK,EAAE,sGAAsG,EAAE;IACvH,UAAU,EAAE;QACR,KAAK,EAAE;YACH,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,yDAAyD,EAAE;YACjG,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,0BAA0B,EAAE;SAC/D;KACJ;IACD,KAAK,CAAC,IAAI,CAAuB,KAAe;QAC5C,MAAM,GAAG,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAA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MAAM,QAAQ,GAAG;IACpB,QAAQ,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,gBAAgB;QACxB,IAAI,EAAE,EAAE,KAAK,EAAE,sEAAsE,EAAE;KAC1F,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/computer/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,12 @@
|
|
|
1
|
+
import { appendFile, mkdir } from "node:fs/promises";
|
|
2
|
+
import { baseDir } from "../config.js";
|
|
3
|
+
import { auditPath } from "./config.js";
|
|
4
|
+
export const audit = async (entry) => {
|
|
5
|
+
try {
|
|
6
|
+
await mkdir(baseDir, { recursive: true, mode: 0o700 });
|
|
7
|
+
await appendFile(auditPath, `${JSON.stringify({ at: new Date().toISOString(), ...entry })}\n`, { encoding: "utf8", mode: 0o600 });
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/computer/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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Log } from "@intentic/local-agent";
|
|
2
|
+
import { type CommandContext } from "@stricli/core";
|
|
3
|
+
export declare const computerUninstall: (out: Log, sandbox?: string) => Promise<void>;
|
|
4
|
+
export declare const computerCommands: {
|
|
5
|
+
setup: import("@stricli/core").Command<CommandContext>;
|
|
6
|
+
uninstall: import("@stricli/core").Command<CommandContext>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/computer/commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,GAAG,EAA0B,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAyJlE,eAAO,MAAM,iBAAiB,QAAe,GAAG,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CA2BhF,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;CAAuB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { rm } from "node:fs/promises";
|
|
2
|
+
import { createUi } from "@intentic/local-agent";
|
|
3
|
+
import { buildCommand } from "@stricli/core";
|
|
4
|
+
import { reconcileResidency } from "../resident.js";
|
|
5
|
+
import { auditPath, configPath, readLinks, removeLinks, upsertLink } from "./config.js";
|
|
6
|
+
const enroll = async (sandboxUrl, pairToken, { attempts = 10, delayMs = 3000 } = {}) => {
|
|
7
|
+
const url = `${sandboxUrl.replace(/\/$/, "")}/system/hosts/enroll`;
|
|
8
|
+
for (let attempt = 1;; attempt++) {
|
|
9
|
+
let response;
|
|
10
|
+
try {
|
|
11
|
+
response = await fetch(url, { method: "POST", headers: { "x-intentic-pair": pairToken } });
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (attempt >= attempts) {
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
process.stderr.write(`connecting: the sandbox isn't reachable yet, retrying (${attempt}/${attempts})…\n`);
|
|
18
|
+
await new Promise((resolvePromise) => setTimeout(resolvePromise, delayMs));
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (response.status === 401) {
|
|
22
|
+
throw new Error("that pairing has expired: click Connect again on the computer's card in your sandbox for a fresh command.");
|
|
23
|
+
}
|
|
24
|
+
if (response.status >= 500 && attempt < attempts) {
|
|
25
|
+
process.stderr.write(`connecting: the sandbox is warming up (HTTP ${response.status}), retrying (${attempt}/${attempts})…\n`);
|
|
26
|
+
await new Promise((resolvePromise) => setTimeout(resolvePromise, delayMs));
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`connecting this computer failed (${response.status}): ${await response.text()}`);
|
|
31
|
+
}
|
|
32
|
+
return (await response.json());
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const setup = buildCommand({
|
|
36
|
+
docs: { brief: "Connect this computer to an intentic sandbox using a one-time pairing token" },
|
|
37
|
+
parameters: {
|
|
38
|
+
flags: {
|
|
39
|
+
url: { kind: "parsed", parse: String, brief: "The sandbox's URL (e.g. https://sandbox-xxx.example.dev)" },
|
|
40
|
+
pair: { kind: "parsed", parse: String, brief: "The one-time pairing token from the computer's capability card" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
async func(flags) {
|
|
44
|
+
const ui = createUi(this.process);
|
|
45
|
+
const out = ui.note;
|
|
46
|
+
ui.begin("intentic · connect this computer", SETUP_PLAN);
|
|
47
|
+
try {
|
|
48
|
+
await runSetup(ui, out, flags);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
ui.close();
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const SETUP_PLAN = [
|
|
56
|
+
{ phase: "computer-enrolling", label: "Enrol this computer", weight: 10 },
|
|
57
|
+
{ phase: "computer-starting", label: "Start the agent", weight: 15 },
|
|
58
|
+
];
|
|
59
|
+
const runSetup = async (ui, out, flags) => {
|
|
60
|
+
ui.step("computer-enrolling", "enrolling this computer with your sandbox…");
|
|
61
|
+
const { id, hostToken } = await enroll(flags.url, flags.pair);
|
|
62
|
+
const link = {
|
|
63
|
+
sandboxUrl: flags.url,
|
|
64
|
+
id,
|
|
65
|
+
token: hostToken,
|
|
66
|
+
scopes: { shell: "off", write: "off", screen: "off", control: "off", sandboxes: "off", sandboxRemove: "off", destructive: "off" },
|
|
67
|
+
};
|
|
68
|
+
const links = await upsertLink(link);
|
|
69
|
+
ui.step("computer-starting", "starting the agent on this computer…");
|
|
70
|
+
await reconcileResidency(out);
|
|
71
|
+
const others = links.length - 1;
|
|
72
|
+
ui.finished("This computer is connected.", id, others === 0
|
|
73
|
+
? "Its permissions are set in the sandbox, on the same card you got this command from."
|
|
74
|
+
: `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"}.`, [
|
|
75
|
+
["check it", "intentic-machine status"],
|
|
76
|
+
["disconnect", "intentic-machine computer uninstall"],
|
|
77
|
+
]);
|
|
78
|
+
};
|
|
79
|
+
const uninstall = buildCommand({
|
|
80
|
+
docs: { brief: "Disconnect this computer from one sandbox, or from all of them" },
|
|
81
|
+
parameters: {
|
|
82
|
+
flags: {
|
|
83
|
+
sandbox: { kind: "parsed", parse: String, brief: "Disconnect only this sandbox URL (default: every one)", optional: true },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
async func(flags) {
|
|
87
|
+
const out = (message) => void this.process.stdout.write(`${message}\n`);
|
|
88
|
+
await computerUninstall(out, flags.sandbox);
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
export const computerUninstall = async (out, sandbox) => {
|
|
92
|
+
const only = sandbox === undefined || sandbox === "" ? undefined : sandbox;
|
|
93
|
+
const dropped = await removeLinks(only);
|
|
94
|
+
const left = await readLinks();
|
|
95
|
+
if (only !== undefined && dropped.length === 0) {
|
|
96
|
+
out(`This computer is not connected to ${only}. Nothing changed.`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (left.length === 0) {
|
|
100
|
+
await rm(configPath, { force: true });
|
|
101
|
+
}
|
|
102
|
+
await reconcileResidency(out);
|
|
103
|
+
if (left.length > 0) {
|
|
104
|
+
out(`Disconnected from ${dropped.map((link) => link.sandboxUrl).join(", ")}. Still connected to ${left.length} sandbox${left.length === 1 ? "" : "es"}.`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
out(dropped.length === 0
|
|
108
|
+
? "Nothing was connected. Removed any leftovers."
|
|
109
|
+
: `Disconnected from ${dropped.map((link) => link.sandboxUrl).join(", ")}. Each sandbox still lists this computer until it is removed there, its access is already gone.`);
|
|
110
|
+
out(`Your record of what this agent did stays at ${auditPath}.`);
|
|
111
|
+
};
|
|
112
|
+
export const computerCommands = { setup, uninstall };
|
|
113
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/computer/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA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AC,MAAM,KAAK,CAAC,EAAE,CAAC;QAIpB,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClB,GAAG,CACC,qBAAqB,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,IAAI,CAAC,MAAM,WAAW,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CACvJ,CAAC;QACF,OAAO;IACX,CAAC;IACD,GAAG,CACC,OAAO,CAAC,MAAM,KAAK,CAAC;QAChB,CAAC,CAAC,+CAA+C;QACjD,CAAC,CAAC,qBAAqB,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,iGAAiG,CAChL,CAAC;IACF,GAAG,CAAC,+CAA+C,SAAS,GAAG,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HostScopes } from "@intentic/sandbox-contract";
|
|
2
|
+
export declare const configPath: string;
|
|
3
|
+
export declare const auditPath: string;
|
|
4
|
+
export interface HostLink {
|
|
5
|
+
readonly sandboxUrl: string;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly token: string;
|
|
8
|
+
readonly scopes: HostScopes;
|
|
9
|
+
}
|
|
10
|
+
export interface HostConfigFile {
|
|
11
|
+
readonly links: readonly HostLink[];
|
|
12
|
+
}
|
|
13
|
+
export declare const readHostConfig: () => Promise<HostConfigFile>;
|
|
14
|
+
export declare const writeHostConfig: (config: HostConfigFile) => Promise<void>;
|
|
15
|
+
export declare const readLinks: () => Promise<readonly HostLink[]>;
|
|
16
|
+
export declare const upsertLink: (link: HostLink) => Promise<readonly HostLink[]>;
|
|
17
|
+
export declare const removeLinks: (sandboxUrl?: string) => Promise<readonly HostLink[]>;
|
|
18
|
+
export declare const rememberScopes: (sandboxUrl: string, scopes: HostScopes) => Promise<void>;
|
|
19
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/computer/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAS7D,eAAO,MAAM,UAAU,QAAiC,CAAC;AACzD,eAAO,MAAM,SAAS,QAA+B,CAAC;AActD,MAAM,WAAW,QAAQ;IAErB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC/B;AAcD,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,cAAc,CAAqE,CAAC;AAEpI,eAAO,MAAM,eAAe,WAAkB,cAAc,KAAG,OAAO,CAAC,IAAI,CACS,CAAC;AAIrF,eAAO,MAAM,SAAS,QAAa,OAAO,CAAC,SAAS,QAAQ,EAAE,CAAiE,CAAC;AAMhI,eAAO,MAAM,UAAU,SAAgB,QAAQ,KAAG,OAAO,CAAC,SAAS,QAAQ,EAAE,CAK5E,CAAC;AAGF,eAAO,MAAM,WAAW,gBAAuB,MAAM,KAAG,OAAO,CAAC,SAAS,QAAQ,EAAE,CAKlF,CAAC;AAIF,eAAO,MAAM,cAAc,eAAsB,MAAM,UAAU,UAAU,KAAG,OAAO,CAAC,IAAI,CAUzF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { writeSecretFile } from "@intentic/local-agent";
|
|
4
|
+
import { baseDir } from "../config.js";
|
|
5
|
+
export const configPath = join(baseDir, "computer.json");
|
|
6
|
+
export const auditPath = join(baseDir, "audit.jsonl");
|
|
7
|
+
export const readHostConfig = async () => JSON.parse(await readFile(configPath, "utf8"));
|
|
8
|
+
export const writeHostConfig = async (config) => await writeSecretFile(configPath, baseDir, JSON.stringify(config, undefined, 2));
|
|
9
|
+
export const readLinks = async () => (await readHostConfig().catch(() => undefined))?.links ?? [];
|
|
10
|
+
export const upsertLink = async (link) => {
|
|
11
|
+
const kept = (await readLinks()).filter((existing) => existing.sandboxUrl !== link.sandboxUrl);
|
|
12
|
+
const links = [...kept, link];
|
|
13
|
+
await writeHostConfig({ links });
|
|
14
|
+
return links;
|
|
15
|
+
};
|
|
16
|
+
export const removeLinks = async (sandboxUrl) => {
|
|
17
|
+
const links = await readLinks();
|
|
18
|
+
const dropped = sandboxUrl === undefined ? links : links.filter((link) => link.sandboxUrl === sandboxUrl);
|
|
19
|
+
await writeHostConfig({ links: links.filter((link) => !dropped.includes(link)) });
|
|
20
|
+
return dropped;
|
|
21
|
+
};
|
|
22
|
+
export const rememberScopes = async (sandboxUrl, scopes) => {
|
|
23
|
+
const links = await readLinks();
|
|
24
|
+
const at = links.findIndex((link) => link.sandboxUrl === sandboxUrl);
|
|
25
|
+
const link = links[at];
|
|
26
|
+
if (link === undefined) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await writeHostConfig({ links: links.with(at, { ...link, scopes }) }).catch(() => undefined);
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
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intentic/local-agent";
|
|
2
|
+
import { type HostLink } from "./config.js";
|
|
3
|
+
export interface HostConnection {
|
|
4
|
+
readonly done: Promise<void>;
|
|
5
|
+
readonly stop: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const connect: (config: HostLink, version: string, log: Log) => HostConnection;
|
|
8
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/computer/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,aAAa,CAAC;AA4B5D,MAAM,WAAW,cAAc;IAE3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,OAAO,WAAY,QAAQ,WAAW,MAAM,OAAO,GAAG,KAAG,cA8ErE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { hostConnectUrl } from "@intentic/sandbox-contract";
|
|
2
|
+
import { RPCHandler } from "@orpc/server/websocket";
|
|
3
|
+
import { rememberScopes } from "./config.js";
|
|
4
|
+
import { createHostRouter } from "./router.js";
|
|
5
|
+
const RETRY_MIN_MS = 1_000;
|
|
6
|
+
const RETRY_MAX_MS = 30_000;
|
|
7
|
+
const UNAUTHORIZED = 1008;
|
|
8
|
+
export const connect = (config, version, log) => {
|
|
9
|
+
let scopes = config.scopes;
|
|
10
|
+
const handler = new RPCHandler(createHostRouter({
|
|
11
|
+
scopes: () => scopes,
|
|
12
|
+
setScopes: (next) => {
|
|
13
|
+
scopes = next;
|
|
14
|
+
void rememberScopes(config.sandboxUrl, next);
|
|
15
|
+
},
|
|
16
|
+
log,
|
|
17
|
+
}));
|
|
18
|
+
let stopped = false;
|
|
19
|
+
let socket;
|
|
20
|
+
let attempt = 0;
|
|
21
|
+
let resolveDone;
|
|
22
|
+
const done = new Promise((resolvePromise) => {
|
|
23
|
+
resolveDone = resolvePromise;
|
|
24
|
+
});
|
|
25
|
+
const open = () => {
|
|
26
|
+
const ws = new WebSocket(hostConnectUrl(config.sandboxUrl));
|
|
27
|
+
socket = ws;
|
|
28
|
+
ws.addEventListener("open", () => {
|
|
29
|
+
attempt = 0;
|
|
30
|
+
handler.upgrade(ws);
|
|
31
|
+
ws.send(JSON.stringify({ type: "hello", token: config.token, version }));
|
|
32
|
+
log(`connected to ${config.sandboxUrl} as "${config.id}"`);
|
|
33
|
+
});
|
|
34
|
+
ws.addEventListener("close", (event) => {
|
|
35
|
+
socket = undefined;
|
|
36
|
+
if (stopped) {
|
|
37
|
+
resolveDone();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (event.code === UNAUTHORIZED) {
|
|
41
|
+
log("the sandbox refused this computer's enrollment: it was revoked there. Run `intentic-machine computer uninstall` to clean up, or connect again from the sandbox.");
|
|
42
|
+
stopped = true;
|
|
43
|
+
resolveDone();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
attempt += 1;
|
|
47
|
+
const delay = Math.min(RETRY_MIN_MS * 2 ** (attempt - 1), RETRY_MAX_MS);
|
|
48
|
+
log(`disconnected (${event.code}); reconnecting in ${Math.round(delay / 1000)}s`);
|
|
49
|
+
setTimeout(open, delay);
|
|
50
|
+
});
|
|
51
|
+
ws.addEventListener("error", () => log("connection error"));
|
|
52
|
+
};
|
|
53
|
+
open();
|
|
54
|
+
return {
|
|
55
|
+
done,
|
|
56
|
+
stop: () => {
|
|
57
|
+
stopped = true;
|
|
58
|
+
socket?.close(1000, "stopping");
|
|
59
|
+
resolveDone();
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","source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