pinomad 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/{chunk-v414b5pp.js → chunk-44pnts98.js} +2 -2
- package/dist/{chunk-nj5gz6qh.js → chunk-4dcs8sbj.js} +11 -9
- package/dist/{chunk-n8cz7skh.js → chunk-67gq282t.js} +53 -32
- package/dist/{chunk-azarj0f4.js → chunk-6d16c2fv.js} +21 -11
- package/dist/{chunk-cx8jgpdt.js → chunk-9h5vawnm.js} +1040 -79
- package/dist/{chunk-029mmh7d.js → chunk-as6pyf00.js} +3 -3
- package/dist/chunk-b457q0tm.js +70 -0
- package/dist/chunk-etf7ef97.js +55 -0
- package/dist/chunk-greb3dp6.js +22 -0
- package/dist/chunk-gtdpjqa3.js +317 -0
- package/dist/chunk-h5q2y57m.js +20 -0
- package/dist/{chunk-4sepcfpy.js → chunk-jt34g8st.js} +2 -2
- package/dist/chunk-n1m1tjrk.js +214 -0
- package/dist/{chunk-3p1eysm9.js → chunk-ncbqa8jk.js} +5 -4
- package/dist/{chunk-sygeb9qb.js → chunk-pqe7q1s7.js} +1 -1
- package/dist/{chunk-fqgvf8v0.js → chunk-sd5fkxjj.js} +1 -1
- package/dist/{chunk-5gp9svzs.js → chunk-t91zt5f0.js} +4 -53
- package/dist/{chunk-vax4zspw.js → chunk-tj57aqav.js} +3 -3
- package/dist/{chunk-32g3m2h0.js → chunk-vvj9b1gc.js} +29 -24
- package/dist/{chunk-jgd38rna.js → chunk-xqycs43g.js} +171 -171
- package/dist/{chunk-khcpv54k.js → chunk-y127fe1a.js} +59 -4
- package/dist/pinomad.js +18 -12
- package/package.json +1 -1
- package/web/assets/index-BhHrKpoo.js +395 -0
- package/web/index.html +1 -1
- package/dist/chunk-3gcpzpjq.js +0 -16
- package/dist/chunk-n58m5hgh.js +0 -170
- package/web/assets/index-1g60bhv2.js +0 -395
package/web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
8
8
|
<title>PiNomad</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-BhHrKpoo.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DoyHMPwf.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/dist/chunk-3gcpzpjq.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
main,
|
|
4
|
-
restartService
|
|
5
|
-
} from "./chunk-32g3m2h0.js";
|
|
6
|
-
import"./chunk-kzbzacz9.js";
|
|
7
|
-
import"./chunk-fqgvf8v0.js";
|
|
8
|
-
import"./chunk-4sepcfpy.js";
|
|
9
|
-
import"./chunk-jgd38rna.js";
|
|
10
|
-
import"./chunk-sygeb9qb.js";
|
|
11
|
-
import"./chunk-ngf1zatm.js";
|
|
12
|
-
import"./chunk-df32avw6.js";
|
|
13
|
-
export {
|
|
14
|
-
restartService,
|
|
15
|
-
main
|
|
16
|
-
};
|
package/dist/chunk-n58m5hgh.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
assertSecureServerOrigin,
|
|
4
|
-
probeServerAccounts,
|
|
5
|
-
runServerOperation
|
|
6
|
-
} from "./chunk-3p1eysm9.js";
|
|
7
|
-
import {
|
|
8
|
-
constantValue,
|
|
9
|
-
openHostSettings
|
|
10
|
-
} from "./chunk-v414b5pp.js";
|
|
11
|
-
import {
|
|
12
|
-
loadHostKey,
|
|
13
|
-
loadRelayKey,
|
|
14
|
-
writeServerConfig
|
|
15
|
-
} from "./chunk-5gp9svzs.js";
|
|
16
|
-
import {
|
|
17
|
-
relayHostId
|
|
18
|
-
} from "./chunk-khcpv54k.js";
|
|
19
|
-
import {
|
|
20
|
-
argValue,
|
|
21
|
-
installSpec,
|
|
22
|
-
restartService,
|
|
23
|
-
serviceManager,
|
|
24
|
-
withoutRelayArgs
|
|
25
|
-
} from "./chunk-32g3m2h0.js";
|
|
26
|
-
import"./chunk-kzbzacz9.js";
|
|
27
|
-
import {
|
|
28
|
-
commandHint,
|
|
29
|
-
hostEntry
|
|
30
|
-
} from "./chunk-fqgvf8v0.js";
|
|
31
|
-
import"./chunk-4sepcfpy.js";
|
|
32
|
-
import"./chunk-jgd38rna.js";
|
|
33
|
-
import {
|
|
34
|
-
cleanHostName,
|
|
35
|
-
normalizeHostName
|
|
36
|
-
} from "./chunk-sygeb9qb.js";
|
|
37
|
-
import {
|
|
38
|
-
DEFAULT_DATA_DIR
|
|
39
|
-
} from "./chunk-ngf1zatm.js";
|
|
40
|
-
import"./chunk-df32avw6.js";
|
|
41
|
-
|
|
42
|
-
// apps/host/src/cli/join.ts
|
|
43
|
-
import { mkdir } from "node:fs/promises";
|
|
44
|
-
import { homedir, hostname } from "node:os";
|
|
45
|
-
import { join, resolve } from "node:path";
|
|
46
|
-
import { parseArgs } from "node:util";
|
|
47
|
-
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
48
|
-
async function joinServer(args, deps) {
|
|
49
|
-
const origin = args.origin.replace(/\/+$/, "");
|
|
50
|
-
const dataDir = resolve(args.dataDir);
|
|
51
|
-
assertSecureServerOrigin(origin);
|
|
52
|
-
if (args.name !== undefined && cleanHostName(args.name) === "") {
|
|
53
|
-
throw new Error(`Invalid host name: ${JSON.stringify(args.name)}`);
|
|
54
|
-
}
|
|
55
|
-
await mkdir(dataDir, { recursive: true });
|
|
56
|
-
const signingKey = await loadRelayKey(dataDir);
|
|
57
|
-
const hostKey = await loadHostKey(dataDir);
|
|
58
|
-
const hostId = relayHostId(signingKey.publicKey);
|
|
59
|
-
const manager = deps?.manager ?? serviceManager();
|
|
60
|
-
const installed = await manager.state().then((state) => state.installed, () => false);
|
|
61
|
-
const previous = installed ? await manager.read() : undefined;
|
|
62
|
-
if (previous !== undefined && resolve(previous.dataDir) !== dataDir) {
|
|
63
|
-
throw new Error(`the installed service uses a different data dir (${previous.dataDir}); ` + `join it with --data-dir ${previous.dataDir} or uninstall the service first`);
|
|
64
|
-
}
|
|
65
|
-
const probe = await probeServerAccounts(origin, deps?.fetch);
|
|
66
|
-
if (probe === "unreachable")
|
|
67
|
-
throw new Error(`cannot reach ${origin} — check the address and that the server is up`);
|
|
68
|
-
if (probe === "disabled") {
|
|
69
|
-
throw new Error(`${origin} does not run server accounts — the server is too old or was started without a data dir`);
|
|
70
|
-
}
|
|
71
|
-
const settings = await openHostSettings({
|
|
72
|
-
path: join(dataDir, "settings.json"),
|
|
73
|
-
fallback: {
|
|
74
|
-
defaultModel: () => null,
|
|
75
|
-
defaultThinkingLevel: () => null,
|
|
76
|
-
steeringMode: () => "one-at-a-time",
|
|
77
|
-
followUpMode: () => "one-at-a-time"
|
|
78
|
-
},
|
|
79
|
-
models: constantValue([])
|
|
80
|
-
});
|
|
81
|
-
const current = settings.value;
|
|
82
|
-
const storedName = current.custom.includes("hostName") ? current.hostName : undefined;
|
|
83
|
-
const reply = await runServerOperation({
|
|
84
|
-
origin,
|
|
85
|
-
signingKey,
|
|
86
|
-
noisePublicKey: hostKey.publicKey,
|
|
87
|
-
op: "join",
|
|
88
|
-
joinToken: args.token,
|
|
89
|
-
name: normalizeHostName(args.name ?? storedName ?? deps?.hostname ?? hostname())
|
|
90
|
-
});
|
|
91
|
-
if (reply.t === "refused") {
|
|
92
|
-
throw new Error(reply.reason === "expired_token" ? "the join token expired — generate a fresh one" : reply.reason === "invalid_token" ? "the join token is invalid or already spent — generate a fresh one" : `the server refused the join: ${reply.reason}`);
|
|
93
|
-
}
|
|
94
|
-
if (reply.t !== "joined")
|
|
95
|
-
throw new Error(`unexpected answer to join: ${reply.t}`);
|
|
96
|
-
const username = reply.username;
|
|
97
|
-
let service;
|
|
98
|
-
try {
|
|
99
|
-
await writeServerConfig(dataDir, { origin });
|
|
100
|
-
if (args.name !== undefined)
|
|
101
|
-
await settings.update({ hostName: args.name });
|
|
102
|
-
const freshSpec = installSpec(["--data-dir", dataDir], {
|
|
103
|
-
execPath: process.execPath,
|
|
104
|
-
env: process.env,
|
|
105
|
-
home: homedir(),
|
|
106
|
-
cwd: process.cwd(),
|
|
107
|
-
mainPath: hostEntry.script,
|
|
108
|
-
entryArgs: hostEntry.args
|
|
109
|
-
});
|
|
110
|
-
if (!installed) {
|
|
111
|
-
await manager.install(freshSpec);
|
|
112
|
-
service = "installed";
|
|
113
|
-
} else {
|
|
114
|
-
const spec = previous === undefined ? freshSpec : { ...previous, hostArgs: withoutRelayArgs(previous.hostArgs) };
|
|
115
|
-
const port = argValue(spec.hostArgs, "--port");
|
|
116
|
-
const code = await restartService({
|
|
117
|
-
force: false,
|
|
118
|
-
argv: ["--data-dir", dataDir, ...port === undefined ? [] : ["--url", `ws://127.0.0.1:${port}`]],
|
|
119
|
-
manager,
|
|
120
|
-
restart: async () => {
|
|
121
|
-
await manager.install(spec);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
service = code === 0 ? "updated" : "failed";
|
|
125
|
-
}
|
|
126
|
-
} catch (error) {
|
|
127
|
-
throw new Error(`joined ${username} at ${origin}, but local setup failed: ${message(error)}
|
|
128
|
-
` + `generate a fresh join token and run the command again (re-joining the same host is safe)`);
|
|
129
|
-
}
|
|
130
|
-
return { hostId, username, origin, service };
|
|
131
|
-
}
|
|
132
|
-
async function main(argv) {
|
|
133
|
-
const { values, positionals } = parseArgs({
|
|
134
|
-
args: [...argv],
|
|
135
|
-
allowPositionals: true,
|
|
136
|
-
options: { "data-dir": { type: "string" }, name: { type: "string" } }
|
|
137
|
-
});
|
|
138
|
-
const [origin, token] = positionals;
|
|
139
|
-
if (origin === undefined || token === undefined) {
|
|
140
|
-
console.error(`usage: ${commandHint("join")} <server-origin> <join-token> [--data-dir DIR] [--name NAME]`);
|
|
141
|
-
process.exit(1);
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
const outcome = await joinServer({
|
|
145
|
-
origin,
|
|
146
|
-
token,
|
|
147
|
-
dataDir: values["data-dir"] ?? DEFAULT_DATA_DIR,
|
|
148
|
-
...values.name === undefined ? {} : { name: values.name }
|
|
149
|
-
});
|
|
150
|
-
console.log(`host id: ${outcome.hostId}`);
|
|
151
|
-
console.log(`joined ${outcome.username} at ${outcome.origin}`);
|
|
152
|
-
if (outcome.service === "installed")
|
|
153
|
-
console.log("service installed and started");
|
|
154
|
-
else if (outcome.service === "updated")
|
|
155
|
-
console.log("service definition updated; host restarted when idle");
|
|
156
|
-
else {
|
|
157
|
-
console.error("joined, but the service restart did not finish — check `service status`");
|
|
158
|
-
process.exitCode = 1;
|
|
159
|
-
}
|
|
160
|
-
} catch (error) {
|
|
161
|
-
console.error(message(error));
|
|
162
|
-
process.exitCode = 1;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (false)
|
|
166
|
-
;
|
|
167
|
-
export {
|
|
168
|
-
main,
|
|
169
|
-
joinServer
|
|
170
|
-
};
|