pinomad 0.5.0 → 0.6.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/dist/{chunk-ebfaf3k2.js → chunk-0xh6cy9v.js} +1 -1
- package/dist/{chunk-gqr7ahv4.js → chunk-367n9je8.js} +2 -2
- package/dist/{chunk-f0v3sht0.js → chunk-3dnnaz4j.js} +10 -8
- package/dist/{chunk-d4wdt5qs.js → chunk-4btj08we.js} +92 -175
- package/dist/{chunk-kmbh44dt.js → chunk-7qb9tq54.js} +42 -6
- package/dist/{chunk-zttf1hvh.js → chunk-7s1f4z4g.js} +4 -3
- package/dist/chunk-b1h374jr.js +159 -0
- package/dist/{chunk-1d9sppj0.js → chunk-c8nxym2z.js} +1 -1
- package/dist/{chunk-aqj4wg33.js → chunk-d5ypmmr7.js} +29 -12
- package/dist/{chunk-m4q9wafw.js → chunk-d93kvxvc.js} +5 -2
- package/dist/chunk-ggb1taqy.js +16 -0
- package/dist/chunk-jn7y815x.js +79 -0
- package/dist/{chunk-9d59jjmt.js → chunk-k2s1hfq5.js} +36 -10
- package/dist/chunk-kzbzacz9.js +12 -0
- package/dist/{chunk-hsp12cjt.js → chunk-n4tjhcb7.js} +17 -17
- package/dist/{chunk-cjfmfyjb.js → chunk-ngf1zatm.js} +7 -6
- package/dist/{chunk-4by4x5c4.js → chunk-wqvp1fwh.js} +17 -4
- package/dist/{chunk-26d04z02.js → chunk-ywmm63ks.js} +7 -3
- package/dist/chunk-znhn8af7.js +33 -0
- package/dist/pinomad.js +36 -12
- package/package.json +1 -1
- package/web/assets/index-C_aU_ZiV.js +383 -0
- package/web/assets/index-DaPcXZPM.css +1 -0
- package/web/index.html +2 -2
- package/dist/chunk-5ng86fmy.js +0 -14
- package/dist/chunk-crv3dqzp.js +0 -63
- package/web/assets/index-BkF0-im5.css +0 -1
- package/web/assets/index-D4lgm3Y4.js +0 -383
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
signRelayChallenge,
|
|
8
8
|
signRelayChallengeV2,
|
|
9
9
|
toBase64Url
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7qb9tq54.js";
|
|
11
11
|
|
|
12
12
|
// apps/host/src/cli/server-ops.ts
|
|
13
13
|
import { WebSocket } from "ws";
|
|
@@ -18,7 +18,10 @@ async function probeAccounts(origin, fetchImpl = fallbackFetch) {
|
|
|
18
18
|
const timeout = new AbortController;
|
|
19
19
|
const timer = setTimeout(() => timeout.abort(), 5000);
|
|
20
20
|
try {
|
|
21
|
-
const response = await fetchImpl(`${origin.replace(/\/+$/, "")}/api/me`, {
|
|
21
|
+
const response = await fetchImpl(`${origin.replace(/\/+$/, "")}/api/me`, {
|
|
22
|
+
signal: timeout.signal,
|
|
23
|
+
redirect: "manual"
|
|
24
|
+
});
|
|
22
25
|
if (response.status === 401)
|
|
23
26
|
return "enabled";
|
|
24
27
|
if (response.status === 200) {
|
|
@@ -46,7 +49,8 @@ function isSecureServerOrigin(origin) {
|
|
|
46
49
|
return false;
|
|
47
50
|
}
|
|
48
51
|
const host = url.hostname;
|
|
49
|
-
const
|
|
52
|
+
const ipv4Loopback = /^127(?:\.\d{1,3}){3}$/.test(host);
|
|
53
|
+
const loopback = host === "localhost" || host.endsWith(".localhost") || ipv4Loopback || host === "::1" || host === "[::1]";
|
|
50
54
|
return url.protocol === "https:" || url.protocol === "http:" && loopback;
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// packages/protocol/src/settings.ts
|
|
2
|
+
var HOST_SETTING_KEY_SET = {
|
|
3
|
+
defaultModel: true,
|
|
4
|
+
defaultThinkingLevel: true,
|
|
5
|
+
steeringMode: true,
|
|
6
|
+
followUpMode: true,
|
|
7
|
+
acceptAccountDevices: true,
|
|
8
|
+
hostName: true
|
|
9
|
+
};
|
|
10
|
+
var HOST_SETTING_KEYS = Object.keys(HOST_SETTING_KEY_SET);
|
|
11
|
+
var THINKING_LEVEL_KEYS = { off: true, minimal: true, low: true, medium: true, high: true, xhigh: true, max: true };
|
|
12
|
+
var THINKING_LEVELS = Object.keys(THINKING_LEVEL_KEYS);
|
|
13
|
+
var isThinkingLevel = (value) => typeof value === "string" && Object.prototype.hasOwnProperty.call(THINKING_LEVEL_KEYS, value);
|
|
14
|
+
var isQueueMode = (value) => value === "all" || value === "one-at-a-time";
|
|
15
|
+
var HOST_NAME_FALLBACK = "pinomad";
|
|
16
|
+
var HOST_NAME_MAX_UNITS = 64;
|
|
17
|
+
var isHostNameControl = (code) => code < 32 || code >= 127 && code <= 159;
|
|
18
|
+
function cleanHostName(name) {
|
|
19
|
+
let cleaned = name;
|
|
20
|
+
for (;; ) {
|
|
21
|
+
const local = cleaned.endsWith(".local") ? cleaned.slice(0, -".local".length) : cleaned;
|
|
22
|
+
const next = [...local.trim()].filter((c) => !isHostNameControl(c.codePointAt(0))).join("").slice(0, HOST_NAME_MAX_UNITS);
|
|
23
|
+
if (next === cleaned)
|
|
24
|
+
return next;
|
|
25
|
+
cleaned = next;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function normalizeHostName(name) {
|
|
29
|
+
const cleaned = cleanHostName(name);
|
|
30
|
+
return cleaned === "" ? HOST_NAME_FALLBACK : cleaned;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { HOST_SETTING_KEYS, THINKING_LEVELS, isThinkingLevel, isQueueMode, HOST_NAME_MAX_UNITS, cleanHostName, normalizeHostName };
|
package/dist/pinomad.js
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
isParseArgsError,
|
|
4
|
+
reportParseArgsError
|
|
5
|
+
} from "./chunk-kzbzacz9.js";
|
|
2
6
|
import {
|
|
3
7
|
packagedVersion
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-c8nxym2z.js";
|
|
5
9
|
import {
|
|
6
10
|
__require
|
|
7
11
|
} from "./chunk-df32avw6.js";
|
|
8
12
|
|
|
9
13
|
// apps/cli/src/pinomad.ts
|
|
10
14
|
var COMMANDS = {
|
|
11
|
-
host: () => import("./chunk-
|
|
12
|
-
server: () => import("./chunk-
|
|
13
|
-
relay: () => import("./chunk-
|
|
14
|
-
service: () => import("./chunk-
|
|
15
|
-
upgrade: () => import("./chunk-
|
|
16
|
-
link: () => import("./chunk-
|
|
17
|
-
pair: () => import("./chunk-
|
|
18
|
-
join: () => import("./chunk-
|
|
19
|
-
leave: () => import("./chunk-
|
|
15
|
+
host: () => import("./chunk-4btj08we.js"),
|
|
16
|
+
server: () => import("./chunk-wqvp1fwh.js"),
|
|
17
|
+
relay: () => import("./chunk-wqvp1fwh.js"),
|
|
18
|
+
service: () => import("./chunk-ggb1taqy.js"),
|
|
19
|
+
upgrade: () => import("./chunk-jn7y815x.js"),
|
|
20
|
+
link: () => import("./chunk-367n9je8.js"),
|
|
21
|
+
pair: () => import("./chunk-7s1f4z4g.js"),
|
|
22
|
+
join: () => import("./chunk-k2s1hfq5.js"),
|
|
23
|
+
leave: () => import("./chunk-3dnnaz4j.js")
|
|
20
24
|
};
|
|
21
25
|
var USAGE = `pinomad — PiNomad host, server, and utilities
|
|
22
26
|
|
|
23
27
|
usage: pinomad <command> [args…]
|
|
24
28
|
|
|
25
|
-
host [
|
|
29
|
+
host [--data-dir DIR] [--port 7420] [--project DIR]… run the host in the foreground
|
|
30
|
+
host --remote-port PORT [--public-url URL] remote access, LAN (ADR-0008)
|
|
31
|
+
host --relay URL remote access via relay (ADR-0015)
|
|
32
|
+
host --faux "answer" [--faux-tps 40] no real model, for tests
|
|
26
33
|
server --public-origin O [--data-dir D] [--trust-proxy] run the server
|
|
27
34
|
server passwd [--data-dir D] [--user U] change the account password (stdin)
|
|
28
35
|
relay … old name of server
|
|
@@ -34,6 +41,13 @@ usage: pinomad <command> [args…]
|
|
|
34
41
|
leave [--data-dir D] leave the server account
|
|
35
42
|
--version, -v print the version
|
|
36
43
|
`;
|
|
44
|
+
function usageFor(command) {
|
|
45
|
+
const rows = USAGE.split(`
|
|
46
|
+
`).filter((line) => line.startsWith(` ${command} `));
|
|
47
|
+
return `usage: pinomad ${command} [args…]
|
|
48
|
+
${rows.join(`
|
|
49
|
+
`)}`;
|
|
50
|
+
}
|
|
37
51
|
async function main(argv) {
|
|
38
52
|
const [command, ...rest] = argv;
|
|
39
53
|
if (command === "--version" || command === "-v") {
|
|
@@ -51,7 +65,17 @@ async function main(argv) {
|
|
|
51
65
|
process.exitCode = 1;
|
|
52
66
|
return;
|
|
53
67
|
}
|
|
54
|
-
|
|
68
|
+
if (rest.includes("--help") || rest.includes("-h")) {
|
|
69
|
+
console.log(usageFor(command));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
await (await load()).main(rest);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (!isParseArgsError(error))
|
|
76
|
+
throw error;
|
|
77
|
+
reportParseArgsError(`pinomad ${command}`, error);
|
|
78
|
+
}
|
|
55
79
|
}
|
|
56
80
|
if (__require.main == __require.module)
|
|
57
81
|
await main(process.argv.slice(2));
|