@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnel.d.ts","sourceRoot":"","sources":["../../src/sync/tunnel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AA6BjD,eAAO,MAAM,WAAW,cAAe,MAAM,KAAG,MAM/C,CAAC;AAGF,eAAO,MAAM,YAAY,eAAgB,MAAM,KAAG,MAAmF,CAAC;AAiCtI,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAMD,eAAO,MAAM,aAAa,aACZ,SAAS;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAC9G,SAAS,YAAY,EAGsE,CAAC;AAI/F,eAAO,MAAM,gBAAgB,WAAY,MAAM,UAAU,YAAY,WAAW,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAAG,IA6E3G,CAAC;AAeF,eAAO,MAAM,cAAc,WAAkB,YAAY,OAAO,GAAG,KAAG,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CA4B9G,CAAC;AASF,eAAO,MAAM,gBAAgB,QAAS,GAAG;IAGjC,SAAS,YAAkB,SAAS,YAAY,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;IAsBlE,OAAO,QAAY,OAAO,CAAC,IAAI,CAAC;CAMvC,CAAC;AAQF,eAAO,MAAM,WAAW,SAAgB,MAAM,aAAa,MAAM,KAAG,OAAO,CAAC,OAAO,CAmBlF,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { connect, createServer } from "node:net";
|
|
2
|
+
const SSH_PORT_BASE = 24000;
|
|
3
|
+
const SSH_PORT_SPAN = 4000;
|
|
4
|
+
export const syncSshPort = (sandboxId) => {
|
|
5
|
+
const hex = (/[0-9a-f]{6}/i.exec(sandboxId)?.[0] ?? "000000").toLowerCase();
|
|
6
|
+
return SSH_PORT_BASE + (Number.parseInt(hex, 16) % SSH_PORT_SPAN);
|
|
7
|
+
};
|
|
8
|
+
export const sshSocketUrl = (sandboxUrl) => `${sandboxUrl.replace(/\/$/, "").replace(/^http/, "ws")}/system/sync/ssh`;
|
|
9
|
+
const BUFFER_HIGH = 1_048_576;
|
|
10
|
+
const BUFFER_LOW = 262_144;
|
|
11
|
+
const DRAIN_POLL_MS = 50;
|
|
12
|
+
const OPEN_TIMEOUT_MS = 10_000;
|
|
13
|
+
const frameOf = (chunk) => {
|
|
14
|
+
const frame = new Uint8Array(chunk.byteLength);
|
|
15
|
+
frame.set(chunk);
|
|
16
|
+
return frame;
|
|
17
|
+
};
|
|
18
|
+
export const tunnelTargets = (pairings) => pairings
|
|
19
|
+
.filter((pairing) => pairing.syncToken !== undefined)
|
|
20
|
+
.map(({ sandboxId, sandboxUrl, syncToken }) => ({ sandboxId, sandboxUrl, syncToken }));
|
|
21
|
+
export const bridgeConnection = (socket, target, onError) => {
|
|
22
|
+
const ws = new WebSocket(sshSocketUrl(target.sandboxUrl), { headers: { "x-intentic-sync": target.syncToken } });
|
|
23
|
+
ws.binaryType = "arraybuffer";
|
|
24
|
+
const queued = [];
|
|
25
|
+
let open = false;
|
|
26
|
+
let drain;
|
|
27
|
+
socket.pause();
|
|
28
|
+
const close = () => {
|
|
29
|
+
clearInterval(drain);
|
|
30
|
+
drain = undefined;
|
|
31
|
+
clearTimeout(handshake);
|
|
32
|
+
socket.destroy();
|
|
33
|
+
if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) {
|
|
34
|
+
ws.close();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const handshake = setTimeout(() => {
|
|
38
|
+
onError(`the sync transport to ${target.sandboxId} did not open within ${OPEN_TIMEOUT_MS / 1000}s: the sandbox is not answering`);
|
|
39
|
+
close();
|
|
40
|
+
}, OPEN_TIMEOUT_MS);
|
|
41
|
+
socket.on("data", (chunk) => {
|
|
42
|
+
if (!open) {
|
|
43
|
+
queued.push(chunk);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
ws.send(frameOf(chunk));
|
|
47
|
+
if (drain === undefined && ws.bufferedAmount > BUFFER_HIGH) {
|
|
48
|
+
socket.pause();
|
|
49
|
+
drain = setInterval(() => {
|
|
50
|
+
if (ws.bufferedAmount < BUFFER_LOW) {
|
|
51
|
+
clearInterval(drain);
|
|
52
|
+
drain = undefined;
|
|
53
|
+
socket.resume();
|
|
54
|
+
}
|
|
55
|
+
}, DRAIN_POLL_MS);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
socket.on("close", close);
|
|
59
|
+
socket.on("error", close);
|
|
60
|
+
ws.addEventListener("open", () => {
|
|
61
|
+
open = true;
|
|
62
|
+
clearTimeout(handshake);
|
|
63
|
+
for (const chunk of queued) {
|
|
64
|
+
ws.send(frameOf(chunk));
|
|
65
|
+
}
|
|
66
|
+
queued.length = 0;
|
|
67
|
+
socket.resume();
|
|
68
|
+
});
|
|
69
|
+
ws.addEventListener("message", (event) => {
|
|
70
|
+
const data = event.data;
|
|
71
|
+
if (data instanceof ArrayBuffer) {
|
|
72
|
+
socket.write(Buffer.from(data));
|
|
73
|
+
}
|
|
74
|
+
else if (typeof data === "string") {
|
|
75
|
+
socket.write(Buffer.from(data, "binary"));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
ws.addEventListener("error", () => {
|
|
79
|
+
onError(`the sync transport to ${target.sandboxId} could not be opened`);
|
|
80
|
+
close();
|
|
81
|
+
});
|
|
82
|
+
ws.addEventListener("close", close);
|
|
83
|
+
};
|
|
84
|
+
export const startSshTunnel = async (target, log) => {
|
|
85
|
+
const port = syncSshPort(target.sandboxId);
|
|
86
|
+
const sockets = new Set();
|
|
87
|
+
const server = createServer((socket) => {
|
|
88
|
+
sockets.add(socket);
|
|
89
|
+
socket.on("close", () => sockets.delete(socket));
|
|
90
|
+
bridgeConnection(socket, target, (message) => log(message));
|
|
91
|
+
});
|
|
92
|
+
const bound = await new Promise((resolve) => {
|
|
93
|
+
server.once("error", (error) => {
|
|
94
|
+
log(error.code === "EADDRINUSE"
|
|
95
|
+
? `port ${port} is already taken, so ${target.sandboxId} has no sync transport on this machine. Free it and restart the mirror watcher.`
|
|
96
|
+
: `the sync transport for ${target.sandboxId} could not listen on ${port}: ${error.message}`);
|
|
97
|
+
resolve(false);
|
|
98
|
+
});
|
|
99
|
+
server.listen(port, "127.0.0.1", () => resolve(true));
|
|
100
|
+
});
|
|
101
|
+
if (!bound) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
return async () => {
|
|
105
|
+
for (const socket of sockets) {
|
|
106
|
+
socket.destroy();
|
|
107
|
+
}
|
|
108
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export const createTunnelPool = (log) => {
|
|
112
|
+
const running = new Map();
|
|
113
|
+
return {
|
|
114
|
+
reconcile: async (targets) => {
|
|
115
|
+
const wanted = new Set(targets.map((target) => target.sandboxId));
|
|
116
|
+
for (const [sandboxId, stop] of running) {
|
|
117
|
+
if (!wanted.has(sandboxId)) {
|
|
118
|
+
running.delete(sandboxId);
|
|
119
|
+
await stop();
|
|
120
|
+
log(` sync transport for ${sandboxId} stopped: it is no longer paired`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
for (const target of targets) {
|
|
124
|
+
if (running.has(target.sandboxId)) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const stop = await startSshTunnel(target, log);
|
|
128
|
+
if (stop !== undefined) {
|
|
129
|
+
running.set(target.sandboxId, stop);
|
|
130
|
+
log(` sync transport for ${target.sandboxId} listening on 127.0.0.1:${syncSshPort(target.sandboxId)}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
stopAll: async () => {
|
|
135
|
+
const stops = [...running.values()];
|
|
136
|
+
running.clear();
|
|
137
|
+
await Promise.all(stops.map(async (stop) => await stop()));
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const READY_POLL_MS = 100;
|
|
142
|
+
export const tunnelReady = async (port, timeoutMs) => {
|
|
143
|
+
const deadline = Date.now() + timeoutMs;
|
|
144
|
+
for (;;) {
|
|
145
|
+
const open = await new Promise((resolve) => {
|
|
146
|
+
const probe = connect(port, "127.0.0.1");
|
|
147
|
+
const settle = (value) => {
|
|
148
|
+
probe.destroy();
|
|
149
|
+
resolve(value);
|
|
150
|
+
};
|
|
151
|
+
probe.once("connect", () => settle(true));
|
|
152
|
+
probe.once("error", () => settle(false));
|
|
153
|
+
});
|
|
154
|
+
if (open || Date.now() >= deadline) {
|
|
155
|
+
return open;
|
|
156
|
+
}
|
|
157
|
+
await new Promise((resolve) => setTimeout(resolve, READY_POLL_MS));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=tunnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnel.js","sourceRoot":"","sources":["../../src/sync/tunnel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAA4B,MAAM,UAAU,CAAC;AA2B3E,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAU,EAAE;IAIrD,MAAM,GAAG,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5E,OAAO,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC;AACtE,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,GAAG,UAAU,C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
|
1
|
+
import type { Log } from "@intentic/local-agent";
|
|
2
|
+
export declare const agentPath: string;
|
|
3
|
+
export declare const assetUrl: () => string;
|
|
4
|
+
export type Probe = {
|
|
5
|
+
readonly kind: "version";
|
|
6
|
+
readonly version: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "no-version-command";
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "unusable";
|
|
11
|
+
};
|
|
12
|
+
export type UpgradeOutcome = {
|
|
13
|
+
readonly kind: "current";
|
|
14
|
+
readonly version: string;
|
|
15
|
+
readonly note?: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "upgraded";
|
|
18
|
+
readonly from: string;
|
|
19
|
+
readonly to: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: "failed";
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
};
|
|
24
|
+
export interface UpgradeExec {
|
|
25
|
+
readonly fetchTo: (url: string, dest: string) => Promise<void>;
|
|
26
|
+
readonly probe: (binary: string) => Probe;
|
|
27
|
+
readonly swap: (from: string, to: string) => Promise<void>;
|
|
28
|
+
readonly stopWatcher: () => Promise<number | undefined>;
|
|
29
|
+
readonly startWatcher: () => Promise<void>;
|
|
30
|
+
readonly watcherAlive: () => Promise<boolean>;
|
|
31
|
+
readonly discard: (path: string) => Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare const runUpgrade: (exec: UpgradeExec, url: string, installed: string, force: boolean, log: Log) => Promise<UpgradeOutcome>;
|
|
34
|
+
export declare const realUpgradeExec: (stopWatcher: () => Promise<number | undefined>, startWatcher: () => Promise<void>, alive: () => Promise<boolean>) => UpgradeExec;
|
|
35
|
+
export declare const upgradeMessage: (outcome: UpgradeOutcome) => string;
|
|
36
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,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AE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAMD,eAAO,MAAM,UAAU,SAAgB,WAAW,OAAO,MAAM,aAAa,MAAM,SAAS,OAAO,OAAO,GAAG,KAAG,OAAO,CAAC,cAAc,CAyEpI,CAAC;AAIF,eAAO,MAAM,eAAe,gBACX,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,gBAChC,MAAM,OAAO,CAAC,IAAI,CAAC,SAC1B,MAAM,OAAO,CAAC,OAAO,CAAC,KAC9B,WAWD,CAAC;AAGH,eAAO,MAAM,cAAc,YAAa,cAAc,KAAG,MAQxD,CAAC"}
|
package/dist/upgrade.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { chmod, rename, rm } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { DEV_VERSION, isNewer } from "@intentic/sandbox-contract";
|
|
5
|
+
import { binDir } from "./sync/config.js";
|
|
6
|
+
import { archToken, download, exe, osToken } from "./sync/mutagen.js";
|
|
7
|
+
export const agentPath = join(binDir, `intentic-machine${exe}`);
|
|
8
|
+
export const assetUrl = () => `https://github.com/intentic/intentic/releases/latest/download/intentic-machine-${osToken()}-${archToken()}${exe}`;
|
|
9
|
+
const probeVersion = (binary) => {
|
|
10
|
+
const result = spawnSync(binary, ["version"], { encoding: "utf8", timeout: 30_000, windowsHide: true });
|
|
11
|
+
if (result.error !== undefined) {
|
|
12
|
+
return { kind: "unusable" };
|
|
13
|
+
}
|
|
14
|
+
const version = result.status === 0 ? /^\d+\.\d+\.\d+$/.exec(result.stdout.trim())?.[0] : undefined;
|
|
15
|
+
if (version !== undefined) {
|
|
16
|
+
return { kind: "version", version };
|
|
17
|
+
}
|
|
18
|
+
return { kind: result.status === 0 ? "unusable" : "no-version-command" };
|
|
19
|
+
};
|
|
20
|
+
export const runUpgrade = async (exec, url, installed, force, log) => {
|
|
21
|
+
const staged = `${agentPath}.new`;
|
|
22
|
+
const previous = `${agentPath}.previous`;
|
|
23
|
+
log(`Downloading the current agent…`);
|
|
24
|
+
try {
|
|
25
|
+
await exec.fetchTo(url, staged);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
await exec.discard(staged);
|
|
29
|
+
return { kind: "failed", reason: `the download failed (${error instanceof Error ? error.message : String(error)}), nothing was changed.` };
|
|
30
|
+
}
|
|
31
|
+
const probed = exec.probe(staged);
|
|
32
|
+
if (probed.kind === "unusable") {
|
|
33
|
+
await exec.discard(staged);
|
|
34
|
+
return { kind: "failed", reason: `what downloaded doesn't run as an agent, keeping the one you have.` };
|
|
35
|
+
}
|
|
36
|
+
if (probed.kind === "no-version-command") {
|
|
37
|
+
await exec.discard(staged);
|
|
38
|
+
return {
|
|
39
|
+
kind: "current",
|
|
40
|
+
version: installed,
|
|
41
|
+
note: `the published agent predates \`intentic-machine version\`, so it is older than the one on this machine, yours is kept.`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const candidate = probed.version;
|
|
45
|
+
if (installed !== DEV_VERSION && !isNewer(candidate, installed)) {
|
|
46
|
+
await exec.discard(staged);
|
|
47
|
+
return { kind: "current", version: installed };
|
|
48
|
+
}
|
|
49
|
+
if (installed === DEV_VERSION && !force) {
|
|
50
|
+
await exec.discard(staged);
|
|
51
|
+
return {
|
|
52
|
+
kind: "current",
|
|
53
|
+
version: installed,
|
|
54
|
+
note: `this agent was built from source, not installed from a release. \`intentic-machine upgrade --force\` replaces it with the published ${candidate}.`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const wasRunning = (await exec.stopWatcher()) !== undefined;
|
|
58
|
+
await exec.swap(agentPath, previous);
|
|
59
|
+
await exec.swap(staged, agentPath);
|
|
60
|
+
if (!wasRunning) {
|
|
61
|
+
await exec.discard(previous);
|
|
62
|
+
return { kind: "upgraded", from: installed, to: candidate };
|
|
63
|
+
}
|
|
64
|
+
await exec.startWatcher();
|
|
65
|
+
if (await exec.watcherAlive()) {
|
|
66
|
+
await exec.discard(previous);
|
|
67
|
+
return { kind: "upgraded", from: installed, to: candidate };
|
|
68
|
+
}
|
|
69
|
+
log(`The new agent didn't stay running: putting the previous one back.`);
|
|
70
|
+
await exec.swap(previous, agentPath);
|
|
71
|
+
await exec.startWatcher();
|
|
72
|
+
return { kind: "failed", reason: `the new agent (${candidate}) wouldn't start, so ${installed} was restored and is running again.` };
|
|
73
|
+
};
|
|
74
|
+
export const realUpgradeExec = (stopWatcher, startWatcher, alive) => ({
|
|
75
|
+
fetchTo: async (url, dest) => {
|
|
76
|
+
await download(url, dest);
|
|
77
|
+
await chmod(dest, 0o755);
|
|
78
|
+
},
|
|
79
|
+
probe: probeVersion,
|
|
80
|
+
swap: async (from, to) => await rename(from, to),
|
|
81
|
+
stopWatcher,
|
|
82
|
+
startWatcher,
|
|
83
|
+
watcherAlive: alive,
|
|
84
|
+
discard: async (path) => await rm(path, { force: true }).catch(() => undefined),
|
|
85
|
+
});
|
|
86
|
+
export const upgradeMessage = (outcome) => {
|
|
87
|
+
if (outcome.kind === "current") {
|
|
88
|
+
return outcome.note === undefined ? `Already on the current agent (${outcome.version}). Nothing to do.` : `Left as it is: ${outcome.note}`;
|
|
89
|
+
}
|
|
90
|
+
if (outcome.kind === "upgraded") {
|
|
91
|
+
return `Upgraded the agent: ${outcome.from} → ${outcome.to}.`;
|
|
92
|
+
}
|
|
93
|
+
return `Upgrade didn't happen: ${outcome.reason}`;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA,O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AC9B,OAAO,uBAAuB,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,EAAE,GAAG,CAAC;IAClE,CAAC;IACD,OAAO,0BAA0B,OAAO,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,eAAe,EAAE,MAAsF,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,eAAe,GAAW,OAAO,sBAAsB,KAAK,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intentic/machine",
|
|
3
|
+
"version": "1.233.0",
|
|
4
|
+
"description": "The one agent that lives on a user's own computer: lets an intentic sandbox work on it (outbound WebSocket, MCP tools, scopes enforced here) and keeps folders and ports mirrored with it (Mutagen over tunnel SSH)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/intentic/intentic.git",
|
|
10
|
+
"directory": "_computers/machine"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"intentic-machine": "./dist/cli.js"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@orpc/server": "1.14.13",
|
|
24
|
+
"@stricli/core": "1.3.0",
|
|
25
|
+
"tslib": "2.8.1",
|
|
26
|
+
"zod": "4.4.3",
|
|
27
|
+
"@intentic/constants": "1.233.0",
|
|
28
|
+
"@intentic/sandbox-contract": "1.233.0",
|
|
29
|
+
"@intentic/browser": "1.233.0",
|
|
30
|
+
"@intentic/local-agent": "1.233.0",
|
|
31
|
+
"@intentic/desktop": "1.233.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@orpc/client": "1.14.13",
|
|
35
|
+
"@orpc/contract": "1.14.13",
|
|
36
|
+
"@types/node": "24.13.2",
|
|
37
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
38
|
+
"vitest": "4.1.10",
|
|
39
|
+
"@intentic/testing": "0.0.0",
|
|
40
|
+
"@intentic/tsconfig": "0.0.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsgo",
|
|
44
|
+
"typecheck": "tsgo --noEmit -p tsconfig.test.json",
|
|
45
|
+
"watch": "tsgo --build --watch",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:watch": "vitest"
|
|
48
|
+
}
|
|
49
|
+
}
|