@0perator/operator 0.1.360-next.0 → 0.1.360-next.2
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/autonomy/session-factory.js +6 -2
- package/dist/browser/session.js +61 -13
- package/dist/cli.js +87 -58
- package/dist/config/settings.js +27 -6
- package/dist/config/skills-index.js +4 -0
- package/dist/config/toolchain.js +14 -1
- package/dist/engine/aurora.js +19 -10
- package/dist/engine/speed-compaction.js +37 -0
- package/dist/gateway-cli.js +14 -5
- package/dist/router/models.js +46 -12
- package/dist/services/preflight.js +31 -8
- package/dist/session.js +48 -7
- package/dist/toolchain/toolchain.py +20 -3
- package/dist/tools/registry.js +230 -45
- package/dist/tools/vision-media.js +162 -0
- package/dist/ui/modelPicker.js +26 -8
- package/dist/update.js +37 -8
- package/package.json +1 -1
package/dist/update.js
CHANGED
|
@@ -16,15 +16,35 @@ const PKG = "@0perator/operator"; // published (private) scope/name — keep in
|
|
|
16
16
|
const DIST_BASE = "https://0perator.co/dl"; // latest.txt, next.txt, SHA256SUMS, operator-<version>.tgz (docs/INSTALL-CURL.md)
|
|
17
17
|
// An install made by install.sh: <root>/releases/<version>/node_modules/@0perator/operator, linked into a bin folder.
|
|
18
18
|
const RELEASE_PKG = /^(.*)\/releases\/[^/]+\/node_modules\/@0perator\/operator\/package\.json$/;
|
|
19
|
-
/** `--next` or `--latest
|
|
20
|
-
|
|
19
|
+
/** `--next` or `--latest`; `explicit` says a flag picked it. Both flags is a usage error. With no flag an install stays
|
|
20
|
+
* on the channel its own version came from: a bare `operator update` on a next build must not install an older
|
|
21
|
+
* release (11/25: it replaced 0.1.360 with 0.1.359). Unknown version → latest. */
|
|
22
|
+
export function updateChannel(args, current) {
|
|
21
23
|
const next = args.includes("--next"), latest = args.includes("--latest");
|
|
22
24
|
if (next && latest)
|
|
23
25
|
return { error: "operator update: --next and --latest are two channels — pass one.\n" };
|
|
24
|
-
|
|
26
|
+
if (next || latest)
|
|
27
|
+
return { channel: next ? "next" : "latest", explicit: true };
|
|
28
|
+
return { channel: current ? channelOf(current) : "latest", explicit: false };
|
|
25
29
|
}
|
|
26
30
|
// A next build is a 0.1.N-next.K prerelease; a release is a plain 0.1.N.
|
|
27
31
|
const channelOf = (version) => (/-next\.\d+$/.test(version) ? "next" : "latest");
|
|
32
|
+
/** Whether `target` is older than `current`. 0.1.N-next.K precedes 0.1.N. An unparsable version is never older. */
|
|
33
|
+
export function isOlder(target, current) {
|
|
34
|
+
const parse = (v) => {
|
|
35
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:-next\.(\d+))?$/.exec(v);
|
|
36
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3]), m[4] === undefined ? Infinity : Number(m[4])] : undefined;
|
|
37
|
+
};
|
|
38
|
+
const t = parse(target), c = parse(current);
|
|
39
|
+
if (!t || !c)
|
|
40
|
+
return false;
|
|
41
|
+
const i = t.findIndex((n, k) => n !== c[k]);
|
|
42
|
+
return i >= 0 && t[i] < c[i];
|
|
43
|
+
}
|
|
44
|
+
// A plain `operator update` never goes back: a build older than the running one installs only when a flag names its
|
|
45
|
+
// channel.
|
|
46
|
+
const refusedAsOlder = (channel, target, current) => `operator update: the ${channel} channel is v${target}, older than this v${current} — nothing installed. ` +
|
|
47
|
+
`To go back on purpose: operator update --${channel}\n`;
|
|
28
48
|
// Walk up from the running file looking for a .git dir (source checkout) before we hit a
|
|
29
49
|
// node_modules boundary (global install). Returns the repo root, or null for a packaged install.
|
|
30
50
|
function findRepoRoot() {
|
|
@@ -76,7 +96,7 @@ function versionAt(pkgJson) {
|
|
|
76
96
|
* the other channel: a tag the registry doesn't have, or a registry it can't read, installs nothing and exits 1.
|
|
77
97
|
* Before and after are read from THIS install's package.json (npm replaces it in place), not from `npm root -g`: npm
|
|
78
98
|
* redacts UUID-shaped path segments in its output as `***`. */
|
|
79
|
-
export function installChannel(channel, pkgJson = fileURLToPath(new URL("../package.json", import.meta.url))) {
|
|
99
|
+
export function installChannel(channel, pkgJson = fileURLToPath(new URL("../package.json", import.meta.url)), refuseOlder = false) {
|
|
80
100
|
const current = versionAt(pkgJson) ?? "?";
|
|
81
101
|
const read = distTags();
|
|
82
102
|
if ("error" in read) {
|
|
@@ -90,6 +110,10 @@ export function installChannel(channel, pkgJson = fileURLToPath(new URL("../pack
|
|
|
90
110
|
process.stderr.write(`operator update: ${PKG} has no ${channel} channel on the registry yet (it has ${has}) — nothing installed.\n`);
|
|
91
111
|
return 1;
|
|
92
112
|
}
|
|
113
|
+
if (refuseOlder && isOlder(target, current)) {
|
|
114
|
+
process.stderr.write(refusedAsOlder(channel, target, current));
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
93
117
|
process.stderr.write(`operator update: v${current} (${channelOf(current)}) → ${PKG}@${channel} (v${target})\n`);
|
|
94
118
|
const code = run("npm", ["install", "-g", `${PKG}@${channel}`]);
|
|
95
119
|
if (code !== 0) {
|
|
@@ -116,7 +140,7 @@ async function download(url, ms) {
|
|
|
116
140
|
* old ones (kept for rollback) and its bin link moved; any other install is replaced in place by `npm install -g`.
|
|
117
141
|
* Returns null, having installed nothing, when the URL can't be reached and the registry can stand in (not for an
|
|
118
142
|
* install.sh install, which exits 1 instead). */
|
|
119
|
-
export async function installFromDist(channel, pkgJson = fileURLToPath(new URL("../package.json", import.meta.url)), base = process.env.OPERATOR_DIST_BASE || DIST_BASE) {
|
|
143
|
+
export async function installFromDist(channel, pkgJson = fileURLToPath(new URL("../package.json", import.meta.url)), base = process.env.OPERATOR_DIST_BASE || DIST_BASE, refuseOlder = false) {
|
|
120
144
|
const current = versionAt(pkgJson) ?? "?";
|
|
121
145
|
const release = RELEASE_PKG.exec(pkgJson);
|
|
122
146
|
let target, tarball, sums;
|
|
@@ -128,6 +152,10 @@ export async function installFromDist(channel, pkgJson = fileURLToPath(new URL("
|
|
|
128
152
|
process.stderr.write(`operator update: already on v${current} (${channel}).\n`);
|
|
129
153
|
return 0;
|
|
130
154
|
}
|
|
155
|
+
if (refuseOlder && isOlder(target, current)) {
|
|
156
|
+
process.stderr.write(refusedAsOlder(channel, target, current));
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
131
159
|
[tarball, sums] = await Promise.all([
|
|
132
160
|
download(`${base}/operator-${target}.tgz`, 300_000),
|
|
133
161
|
download(`${base}/SHA256SUMS`, 15_000).then((b) => b.toString("utf8")),
|
|
@@ -172,8 +200,8 @@ export async function installFromDist(channel, pkgJson = fileURLToPath(new URL("
|
|
|
172
200
|
process.stderr.write(`operator update: done — now v${now} (${channel}).\n`);
|
|
173
201
|
return 0;
|
|
174
202
|
}
|
|
175
|
-
export async function runUpdate(args = []) {
|
|
176
|
-
const pick = updateChannel(args);
|
|
203
|
+
export async function runUpdate(args = [], pkgJson = fileURLToPath(new URL("../package.json", import.meta.url))) {
|
|
204
|
+
const pick = updateChannel(args, versionAt(pkgJson));
|
|
177
205
|
if ("error" in pick) {
|
|
178
206
|
process.stderr.write(pick.error);
|
|
179
207
|
return 2;
|
|
@@ -231,5 +259,6 @@ export async function runUpdate(args = []) {
|
|
|
231
259
|
}
|
|
232
260
|
return code;
|
|
233
261
|
}
|
|
234
|
-
|
|
262
|
+
const refuseOlder = !pick.explicit;
|
|
263
|
+
return (await installFromDist(pick.channel, undefined, undefined, refuseOlder)) ?? installChannel(pick.channel, undefined, refuseOlder);
|
|
235
264
|
}
|