@rarog/server 1.0.1 → 1.1.0-beta.1
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 +4 -3
- package/node_modules/@rarog/shared/package.json +1 -1
- package/node_modules/@rarog/shared/src/decode.js +49 -3
- package/node_modules/@rarog/shared/src/protocol/files.js +33 -0
- package/node_modules/@rarog/shared/src/protocol/inbox.js +38 -0
- package/node_modules/@rarog/shared/src/protocol.js +16 -17
- package/node_modules/@rarog/shared/src/rest.js +106 -12
- package/node_modules/@rarog/shared/src/sentences/rest.js +13 -0
- package/package.json +3 -3
- package/server/src/bootstrap/consent.js +88 -2
- package/server/src/bootstrap/http.js +3 -2
- package/server/src/bootstrap/inbox.js +29 -4
- package/server/src/bootstrap/sse.js +2 -1
- package/server/src/cli/doctor-no-hook.js +162 -0
- package/server/src/cli/doctor.js +2 -0
- package/server/src/cli/update-channel.js +100 -0
- package/server/src/cli/update-registry.js +160 -62
- package/server/src/cli/update.js +13 -3
- package/server/src/companion/turns-settle.js +4 -1
- package/server/src/companion/turns.js +36 -5
- package/server/src/config/files.js +32 -0
- package/server/src/config/flags.js +10 -1
- package/server/src/config-env.js +24 -0
- package/server/src/config.js +6 -2
- package/server/src/demo/files.js +49 -0
- package/server/src/demo/inbox.js +73 -0
- package/server/src/demo/review-routes.js +6 -1
- package/server/src/device-effects.js +3 -1
- package/server/src/drivers/herdr/consent-no-hook-io.js +89 -0
- package/server/src/drivers/herdr/consent-no-hook.js +316 -0
- package/server/src/drivers/herdr/refusals.js +226 -0
- package/server/src/drivers/herdr/returned-prompt.js +172 -0
- package/server/src/drivers/herdr-driver.js +116 -287
- package/server/src/files/file-index.js +246 -0
- package/server/src/files/ignored.js +119 -0
- package/server/src/files/listing.js +76 -0
- package/server/src/files/path-rule.js +145 -0
- package/server/src/files/refusals.js +36 -0
- package/server/src/files/send-file.js +115 -0
- package/server/src/files/session-download.js +51 -0
- package/server/src/files/session-files.js +38 -0
- package/server/src/files/session-gate.js +48 -0
- package/server/src/git-status.js +3 -2
- package/server/src/herdr/audit.js +1 -1
- package/server/src/herdr/dialogs/hook/contract.js +16 -9
- package/server/src/herdr/dialogs/index.js +6 -1
- package/server/src/herdr/dialogs/layer1/hook-list/hook-list.js +132 -59
- package/server/src/herdr/dialogs/layer1/hook-list/session-facts.js +135 -0
- package/server/src/herdr/dialogs/layer1/version-gate.js +13 -5
- package/server/src/herdr/dialogs/no-hook.js +63 -0
- package/server/src/herdr/dialogs/screen/block.js +10 -0
- package/server/src/herdr/dialogs/screen/parse.js +10 -1
- package/server/src/herdr/jsonl-pending.js +25 -1
- package/server/src/inbox/card.js +18 -9
- package/server/src/inbox/dialogs.js +40 -12
- package/server/src/inbox/heads.js +55 -0
- package/server/src/inbox/inbox.js +24 -2
- package/server/src/inbox/index.js +3 -1
- package/server/src/index.js +22 -18
- package/server/src/install/repair.js +8 -0
- package/server/src/log-timestamps.js +9 -4
- package/server/src/router.js +7 -1
- package/server/src/routes/devices.js +2 -2
- package/server/src/routes/inbox.js +91 -0
- package/server/src/routes/sessions.js +135 -14
- package/server/src/routes/system.js +5 -4
- package/server/src/safe-read.js +86 -1
- package/server/src/sessions/companion-scope.js +6 -2
- package/server/src/sessions/demo-modules.js +16 -0
- package/server/src/sessions/diff-measure.js +30 -0
- package/server/src/sessions/manager.js +64 -152
- package/server/src/sessions/ring-buffer.js +18 -3
- package/server/src/sessions/seen-marks.js +9 -6
- package/server/src/sessions/session-scope.js +30 -0
- package/server/src/sessions/session.js +20 -1
- package/server/src/sessions/waiting-line.js +72 -0
- package/server/src/sse.js +40 -6
- package/server/src/version.js +30 -0
|
@@ -5,21 +5,24 @@
|
|
|
5
5
|
* installation's or when the new version needs a newer Node. Then npm downloads the tarball of the highest version
|
|
6
6
|
* above this one up to it into a temporary directory (npm's release age gate holds, also from the environment, and
|
|
7
7
|
* never gives an older version; a gate that holds every version back is a warning that names the day npm lets the next
|
|
8
|
-
* one in)
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* one in); a pre-release in that range is refused. With `--beta` the target is the higher of the dist-tags `beta` and
|
|
9
|
+
* `latest` (`update-channel.ts`), read with its `engines` and `deprecated` and downloaded as that exact version.
|
|
10
|
+
* `update-provenance.ts` checks that one file, and npm installs exactly that file with `--ignore-scripts`. It finishes
|
|
11
|
+
* nothing: `update.ts` hands a new version to that version's own `rarog update --finish`. After npm has replaced the
|
|
12
|
+
* package files this process only reads one file and starts a child, so it never loads a module from the new files
|
|
13
|
+
* (no dynamic import).
|
|
12
14
|
*/
|
|
13
15
|
import { spawn } from 'node:child_process';
|
|
14
16
|
import { mkdirSync, mkdtempSync, realpathSync, rmSync } from 'node:fs';
|
|
15
17
|
import os from 'node:os';
|
|
16
18
|
import path from 'node:path';
|
|
17
|
-
import { PACKAGE_INSTALL, RAROG_PACKAGE_NAME, isPackageName, npmBinDir, npmSelfUpdate, npmUpdateInstallArgs, npmUpdatePackArgs, otherPackageFix, packageCommands, packageManagerOf, } from '../install/repair.js';
|
|
19
|
+
import { PACKAGE_INSTALL, RAROG_PACKAGE_NAME, isPackageName, npmBinDir, npmSelfUpdate, npmUpdateExactPackArgs, npmUpdateInstallArgs, npmUpdatePackArgs, otherPackageFix, packageCommands, packageManagerOf, } from '../install/repair.js';
|
|
18
20
|
import { NPM_AGE_GATE_CONFIG, firstNpmError, npmCliOf, npmEnv } from '../install/sdk.js';
|
|
19
21
|
import { readRegularFileSync } from '../safe-read.js';
|
|
20
22
|
import { VERSION_RE } from '../version.js';
|
|
21
23
|
import { trackChild } from './child-output.js';
|
|
22
24
|
import { SetupInterrupted } from './setup.js';
|
|
25
|
+
import { channelTarget, gateExcludes, isPrerelease } from './update-channel.js';
|
|
23
26
|
import { packedTarball, verifyTarball } from './update-provenance.js';
|
|
24
27
|
/** `npm prefix -g`: where npm installs global packages. */
|
|
25
28
|
const PREFIX_ARGS = ['prefix', '-g'];
|
|
@@ -30,6 +33,12 @@ const VIEW_ARGS = ['view', `${RAROG_PACKAGE_NAME}@latest`, 'version', 'engines',
|
|
|
30
33
|
* prints `<key>=<value>` per key when it gets more than one, `null` for a key that is not set).
|
|
31
34
|
*/
|
|
32
35
|
const GATE_CONFIG_ARGS = ['config', 'get', 'min-release-age', 'before', '-g'];
|
|
36
|
+
/** {@link GATE_CONFIG_ARGS} of `--beta` with `min-release-age-exclude` (npm prints the list joined with commas). */
|
|
37
|
+
const BETA_GATE_CONFIG_ARGS = ['config', 'get', 'min-release-age', 'before', 'min-release-age-exclude', '-g'];
|
|
38
|
+
/** `npm view` of the dist-tags: one object, tag → version (`rarog update --beta`). */
|
|
39
|
+
const TAGS_ARGS = ['view', RAROG_PACKAGE_NAME, 'dist-tags', '--json'];
|
|
40
|
+
/** `npm view` of the exact target of `--beta`: its version, the Node it needs, and its deprecation when it has one. */
|
|
41
|
+
const targetViewArgs = (version) => ['view', `${RAROG_PACKAGE_NAME}@${version}`, 'version', 'engines', 'deprecated', '--json'];
|
|
33
42
|
/**
|
|
34
43
|
* `npm view` with two fields, so one JSON object `{ time, versions }`: the publication time of every version ever
|
|
35
44
|
* published (`{ "<version>": "<ISO>", created, modified }`) and the versions the registry still has.
|
|
@@ -172,7 +181,7 @@ function isRecord(value) {
|
|
|
172
181
|
* `npm unpublish` removes a version from `versions` and keeps its `time`. `null` for another shape (`time` not an
|
|
173
182
|
* object of strings, `versions` not an array of strings, a date that does not parse, a version of the range without a
|
|
174
183
|
* time), for no version in the range, and for a publication in the future or a day already past, which the gate would
|
|
175
|
-
* not have held back.
|
|
184
|
+
* not have held back. With `only` (the exact target of `--beta`) that version alone counts, not the range.
|
|
176
185
|
*/
|
|
177
186
|
export function ageGateWait(answer, gate) {
|
|
178
187
|
if (!isRecord(answer))
|
|
@@ -186,7 +195,7 @@ export function ageGateWait(answer, gate) {
|
|
|
186
195
|
for (const version of versions) {
|
|
187
196
|
if (typeof version !== 'string')
|
|
188
197
|
return null;
|
|
189
|
-
if (!inInstallRange(version, gate.above, gate.upTo))
|
|
198
|
+
if (gate.only === undefined ? !inInstallRange(version, gate.above, gate.upTo) : version !== gate.only)
|
|
190
199
|
continue;
|
|
191
200
|
const published = time[version];
|
|
192
201
|
const at = typeof published === 'string' ? Date.parse(published) : Number.NaN;
|
|
@@ -374,59 +383,133 @@ export async function downloadStep(input) {
|
|
|
374
383
|
return stop({ state: 'problem', summary: `npm installs into ${npmPrefix}, not into ${prefix} of this installation`,
|
|
375
384
|
fix: manual });
|
|
376
385
|
}
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
386
|
+
const beta = input.beta === true;
|
|
387
|
+
/** The command a fix runs again: the same channel. */
|
|
388
|
+
const again = beta ? 'rarog update --beta' : 'rarog update';
|
|
389
|
+
const network = `check the network, then ${again}`;
|
|
390
|
+
const noVersion = (run, summary) => {
|
|
391
|
+
view.detail(` npm view: ${run.stdout.trim().slice(0, 300)}`);
|
|
392
|
+
return stop({ state: 'problem', summary, fix: `${again} again later` });
|
|
393
|
+
};
|
|
394
|
+
/** Without a flag: the newest release from `@latest`, installed through npm's range above this version. */
|
|
395
|
+
const readLatest = async () => {
|
|
396
|
+
const viewRun = await runNpm(npm, VIEW_ARGS, () => { });
|
|
397
|
+
if (viewRun.code !== 0) {
|
|
398
|
+
header(`Rarog update ${current}`);
|
|
399
|
+
return failed('registry check', 'view', viewRun, network);
|
|
400
|
+
}
|
|
401
|
+
let latest = null;
|
|
402
|
+
let engines;
|
|
403
|
+
try {
|
|
404
|
+
const parsed = JSON.parse(viewRun.stdout);
|
|
405
|
+
latest = typeof parsed?.version === 'string' && VERSION_RE.test(parsed.version) ? parsed.version : null;
|
|
406
|
+
engines = parsed?.engines;
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
latest = null;
|
|
410
|
+
}
|
|
411
|
+
if (latest === null) {
|
|
412
|
+
header(`Rarog update ${current}`);
|
|
413
|
+
return noVersion(viewRun, `npm gave no version of ${RAROG_PACKAGE_NAME}`);
|
|
414
|
+
}
|
|
415
|
+
view.detail(` npm: ${RAROG_PACKAGE_NAME}@latest is ${latest}; this installation is ${current}`);
|
|
416
|
+
const order = compareVersions(latest, current);
|
|
417
|
+
if (latest === current || (order !== null && order <= 0)) {
|
|
418
|
+
header(`Rarog update ${current}`);
|
|
419
|
+
view.endStep({
|
|
420
|
+
title: TITLE, state: 'warn', skipped: true,
|
|
421
|
+
summary: latest === current ? `rarog ${current} is the latest` : `rarog ${current} is newer than ${latest} on npm`,
|
|
422
|
+
}, input.home);
|
|
423
|
+
return { kind: 'finish-here' };
|
|
424
|
+
}
|
|
425
|
+
header(`Rarog update ${current} → ${latest}`);
|
|
426
|
+
return { version: latest, engines, note: null };
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* `--beta`: the higher of the dist-tags `beta` and `latest`, then that exact version's `engines` and deprecation.
|
|
430
|
+
* A deprecated target is not installed: npm would install an exact version whatever its deprecation.
|
|
431
|
+
*/
|
|
432
|
+
const readChannel = async () => {
|
|
433
|
+
const tagsRun = await runNpm(npm, TAGS_ARGS, () => { });
|
|
434
|
+
if (tagsRun.code !== 0) {
|
|
435
|
+
header(`Rarog update ${current}`);
|
|
436
|
+
return failed('registry check', 'view', tagsRun, network);
|
|
437
|
+
}
|
|
438
|
+
let channel = null;
|
|
439
|
+
try {
|
|
440
|
+
channel = channelTarget(JSON.parse(tagsRun.stdout));
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
channel = null;
|
|
444
|
+
}
|
|
445
|
+
if (channel === null) {
|
|
446
|
+
header(`Rarog update ${current}`);
|
|
447
|
+
return noVersion(tagsRun, `npm gave no version of ${RAROG_PACKAGE_NAME}`);
|
|
448
|
+
}
|
|
449
|
+
const { target, note } = channel;
|
|
450
|
+
view.detail(` npm: ${RAROG_PACKAGE_NAME}@latest is ${channel.latest}, @beta is ${channel.beta ?? 'none'}; this`
|
|
451
|
+
+ ` installation is ${current}`);
|
|
452
|
+
const order = compareVersions(target, current);
|
|
453
|
+
if (order === null) {
|
|
454
|
+
header(`Rarog update ${current}`);
|
|
455
|
+
return stop({ state: 'problem', fix: manual,
|
|
456
|
+
summary: `rarog ${current} has no version order against ${target}` });
|
|
457
|
+
}
|
|
458
|
+
if (order <= 0) {
|
|
459
|
+
header(`Rarog update ${current}`);
|
|
460
|
+
const summary = order === 0 ? `rarog ${current} is the newest on npm`
|
|
461
|
+
: `rarog ${current} is newer than ${target} on npm`;
|
|
462
|
+
view.endStep({
|
|
463
|
+
title: TITLE, state: 'warn', skipped: note === null, summary: note === null ? summary : `${summary}; ${note}`,
|
|
464
|
+
}, input.home);
|
|
465
|
+
return { kind: 'finish-here' };
|
|
466
|
+
}
|
|
467
|
+
header(`Rarog update ${current} → ${target}`);
|
|
468
|
+
const targetRun = await runNpm(npm, targetViewArgs(target), () => { });
|
|
469
|
+
if (targetRun.code !== 0)
|
|
470
|
+
return failed('registry check', 'view', targetRun, network);
|
|
471
|
+
let manifest = null;
|
|
472
|
+
try {
|
|
473
|
+
const parsed = JSON.parse(targetRun.stdout);
|
|
474
|
+
manifest = isRecord(parsed) ? parsed : null;
|
|
475
|
+
}
|
|
476
|
+
catch {
|
|
477
|
+
manifest = null;
|
|
478
|
+
}
|
|
479
|
+
if (manifest?.version !== target) {
|
|
480
|
+
return noVersion(targetRun, `npm gave no version ${target} of ${RAROG_PACKAGE_NAME}`);
|
|
481
|
+
}
|
|
482
|
+
if (typeof manifest.deprecated === 'string' && manifest.deprecated !== '') {
|
|
483
|
+
// The deprecation message is the publisher's text: neither the screen nor the log repeats it.
|
|
484
|
+
view.detail(` npm: ${RAROG_PACKAGE_NAME}@${target} is deprecated`);
|
|
485
|
+
return stop({ state: 'warn', summary: `rarog ${target} is deprecated on npm, so ${current} stays` }, 0);
|
|
486
|
+
}
|
|
487
|
+
return { version: target, engines: manifest.engines, note };
|
|
488
|
+
};
|
|
489
|
+
const chosen = beta ? await readChannel() : await readLatest();
|
|
490
|
+
if ('kind' in chosen)
|
|
491
|
+
return chosen;
|
|
492
|
+
const { version: target, engines, note } = chosen;
|
|
409
493
|
const range = engines !== null && typeof engines === 'object' && 'node' in engines ? engines.node : undefined;
|
|
410
494
|
if (typeof range === 'string') {
|
|
411
495
|
const fits = nodeSatisfies(process.versions.node, range);
|
|
412
496
|
if (fits === false) {
|
|
413
497
|
return stop({
|
|
414
|
-
state: 'problem', summary: `rarog ${
|
|
498
|
+
state: 'problem', summary: `rarog ${target} needs Node ${range}; this is ${process.versions.node}`,
|
|
415
499
|
fix: `nvm install --lts, ${PACKAGE_INSTALL.npm}, then rarog setup`,
|
|
416
500
|
});
|
|
417
501
|
}
|
|
418
502
|
if (fits === null)
|
|
419
503
|
view.detail(` engines.node ${range}: a form this check does not read, so the install goes on`);
|
|
420
504
|
}
|
|
421
|
-
view.screen.progress(`downloading ${
|
|
422
|
-
const newest = latest;
|
|
505
|
+
view.screen.progress(`downloading ${target}…`);
|
|
423
506
|
/**
|
|
424
|
-
* When npm's age gate lets a version above `above` in: `min-release-age` from
|
|
425
|
-
* publication times from the registry; `null` = no date (`before` set,
|
|
426
|
-
* stays without one.
|
|
507
|
+
* When npm's age gate lets a version above `above` in (with `--beta`: the target alone): `min-release-age` from
|
|
508
|
+
* npm's own config, the publication times from the registry; `null` = no date (`before` set, with `--beta` this
|
|
509
|
+
* package in `min-release-age-exclude`, a failed call, another shape), and the text stays without one.
|
|
427
510
|
*/
|
|
428
511
|
const gateWait = async (above) => {
|
|
429
|
-
const config = await runNpm(npm, GATE_CONFIG_ARGS, log);
|
|
512
|
+
const config = await runNpm(npm, beta ? BETA_GATE_CONFIG_ARGS : GATE_CONFIG_ARGS, log);
|
|
430
513
|
if (config.interrupted)
|
|
431
514
|
throw new SetupInterrupted('npm config was interrupted (Ctrl-C)');
|
|
432
515
|
const days = config.code === 0 ? gateDaysOf(config.stdout) : null;
|
|
@@ -434,6 +517,11 @@ export async function downloadStep(input) {
|
|
|
434
517
|
view.detail(' npm age gate: no date (min-release-age not read, or before is set)');
|
|
435
518
|
return null;
|
|
436
519
|
}
|
|
520
|
+
if (beta && gateExcludes(config.stdout, RAROG_PACKAGE_NAME)) {
|
|
521
|
+
// npm lets an excluded package in however young: what it held back is a dependency.
|
|
522
|
+
view.detail(` npm age gate: no date (${RAROG_PACKAGE_NAME} is in min-release-age-exclude)`);
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
437
525
|
const timeRun = await runNpm(npm, TIME_ARGS, () => { });
|
|
438
526
|
if (timeRun.interrupted)
|
|
439
527
|
throw new SetupInterrupted('npm view was interrupted (Ctrl-C)');
|
|
@@ -444,7 +532,7 @@ export async function downloadStep(input) {
|
|
|
444
532
|
catch {
|
|
445
533
|
answer = null;
|
|
446
534
|
}
|
|
447
|
-
const wait = ageGateWait(answer, { days, above, upTo:
|
|
535
|
+
const wait = ageGateWait(answer, { days, above, upTo: target, now: Date.now(), ...(beta ? { only: target } : {}) });
|
|
448
536
|
const why = timeRun.code === 0 ? 'no version to date' : firstNpmError(timeRun.stderr);
|
|
449
537
|
view.detail(wait === null ? ` npm age gate: no date (npm view time: ${why})`
|
|
450
538
|
: ` npm age gate: ${String(days)} days; ${wait.version} is in from ${wait.from}`);
|
|
@@ -454,7 +542,7 @@ export async function downloadStep(input) {
|
|
|
454
542
|
const heldBack = async (detail) => {
|
|
455
543
|
view.detail(` ${detail}`);
|
|
456
544
|
const wait = await gateWait(current);
|
|
457
|
-
const summary = wait === null ? `rarog ${
|
|
545
|
+
const summary = wait === null ? `rarog ${target} not installed yet (npm age gate)` : ageGateText(wait);
|
|
458
546
|
return stop({ state: 'warn', summary }, 0);
|
|
459
547
|
};
|
|
460
548
|
/** stderr of a call whose stdout is JSON for this process, to the run log. */
|
|
@@ -463,7 +551,8 @@ export async function downloadStep(input) {
|
|
|
463
551
|
if (text.trim() !== '')
|
|
464
552
|
log(` npm: ${text.trimEnd()}`);
|
|
465
553
|
};
|
|
466
|
-
const tooYoung = `npm found
|
|
554
|
+
const tooYoung = beta ? `npm found ${target} not old enough for its release age gate; ${current} stays`
|
|
555
|
+
: `npm found no version above ${current} old enough for its release age gate; ${current} stays`;
|
|
467
556
|
// The tarball and the audit project live in a directory of this run only, removed on every way out.
|
|
468
557
|
const work = mkdtempSync(path.join(os.tmpdir(), 'rarog-update-'));
|
|
469
558
|
try {
|
|
@@ -471,30 +560,37 @@ export async function downloadStep(input) {
|
|
|
471
560
|
const auditDir = path.join(work, 'audit');
|
|
472
561
|
mkdirSync(tarballDir);
|
|
473
562
|
mkdirSync(auditDir);
|
|
474
|
-
const
|
|
563
|
+
const packArgs = beta ? npmUpdateExactPackArgs(target, tarballDir) : npmUpdatePackArgs(current, target, tarballDir);
|
|
564
|
+
const pack = await runNpm(npm, packArgs, () => { });
|
|
475
565
|
logStderr(pack);
|
|
476
566
|
if (pack.code !== 0 && !pack.interrupted && NO_VERSION_OLD_ENOUGH.test(pack.stderr))
|
|
477
567
|
return await heldBack(tooYoung);
|
|
478
568
|
if (pack.code !== 0)
|
|
479
|
-
return failed('download', 'pack', pack,
|
|
569
|
+
return failed('download', 'pack', pack, network);
|
|
480
570
|
const tarball = packedTarball(pack.stdout, tarballDir);
|
|
481
|
-
if (tarball === null || !inInstallRange(tarball.version, current,
|
|
571
|
+
if (tarball === null || (beta ? tarball.version !== target : !inInstallRange(tarball.version, current, target))) {
|
|
482
572
|
view.detail(` npm pack: ${pack.stdout.trim().slice(0, 300)}`);
|
|
483
|
-
return stop({ state: 'problem',
|
|
484
|
-
|
|
573
|
+
return stop({ state: 'problem', fix: `${again} again later`, summary: tarball === null || !beta
|
|
574
|
+
? `npm gave no tarball of ${RAROG_PACKAGE_NAME} ${beta ? target : `above ${current}`}`
|
|
575
|
+
: `npm gave ${tarball.version}, not ${target}` });
|
|
576
|
+
}
|
|
577
|
+
// Without --beta the range admits a pre-release of the latest's own version (npm's range rule), and the age gate
|
|
578
|
+
// can pick one; rarog update never installs a pre-release without the flag.
|
|
579
|
+
if (!beta && isPrerelease(tarball.version)) {
|
|
580
|
+
return stop({ state: 'problem', fix: 'rarog update --beta, or rarog update again later',
|
|
581
|
+
summary: `npm gave the pre-release ${tarball.version}; rarog update without --beta installs only releases` });
|
|
485
582
|
}
|
|
486
583
|
const check = await verifyTarball({
|
|
487
584
|
npm: (args, cwd) => runNpm({ ...npm, cwd }, args, () => { }), tarball, auditDir, cwd: input.home, log,
|
|
488
585
|
...(input.provenanceAuthority === undefined ? {} : { authority: input.provenanceAuthority }),
|
|
489
586
|
});
|
|
490
|
-
if (check.kind === 'npm-failed')
|
|
491
|
-
return failed(check.what, check.command, check.result,
|
|
492
|
-
}
|
|
587
|
+
if (check.kind === 'npm-failed')
|
|
588
|
+
return failed(check.what, check.command, check.result, network);
|
|
493
589
|
if (check.kind === 'old-npm') {
|
|
494
590
|
// The npm to update is the one this step runs, next to this node.
|
|
495
591
|
const selfUpdate = npmSelfUpdate(npmCli) ?? `update the npm next to ${input.execPath} to 11.12 or newer`;
|
|
496
592
|
return stop({ state: 'problem', summary: 'this npm does not list attestations (it needs npm 11.12 or newer)',
|
|
497
|
-
fix: `${selfUpdate}, then
|
|
593
|
+
fix: `${selfUpdate}, then ${again}` });
|
|
498
594
|
}
|
|
499
595
|
if (check.kind === 'refused')
|
|
500
596
|
return stop({ state: 'problem', summary: check.summary, fix: check.fix });
|
|
@@ -505,22 +601,24 @@ export async function downloadStep(input) {
|
|
|
505
601
|
return await heldBack(tooYoung);
|
|
506
602
|
}
|
|
507
603
|
if (install.code !== 0)
|
|
508
|
-
return failed('install', 'install', install,
|
|
604
|
+
return failed('install', 'install', install, network);
|
|
509
605
|
const after = readInstalledVersion(root);
|
|
510
606
|
if (after !== tarball.version) {
|
|
511
607
|
return stop({ state: 'problem', fix: manual, summary: after === null
|
|
512
608
|
? `after npm there is no readable package.json in ${root}`
|
|
513
609
|
: `after npm, ${root} has ${after}, not ${tarball.version}` });
|
|
514
610
|
}
|
|
515
|
-
if (after !==
|
|
611
|
+
if (after !== target) {
|
|
516
612
|
const wait = await gateWait(after);
|
|
517
|
-
const summary = wait === null ? `rarog ${after} installed, ${
|
|
613
|
+
const summary = wait === null ? `rarog ${after} installed, ${target} not yet (npm age gate)`
|
|
518
614
|
: ageGateText(wait, after);
|
|
519
615
|
view.endStep({ title: TITLE, state: 'warn', summary }, input.home);
|
|
520
616
|
}
|
|
521
617
|
else {
|
|
522
618
|
// The finish runs in a new process with its own screen: a line counted here would never be shown.
|
|
523
|
-
|
|
619
|
+
const summary = `rarog ${target} from npm`;
|
|
620
|
+
view.endStep(note === null ? { title: TITLE, state: 'ok', summary, changed: true }
|
|
621
|
+
: { title: TITLE, state: 'warn', summary: `${summary}; ${note}`, changed: true }, input.home);
|
|
524
622
|
}
|
|
525
623
|
return { kind: 'finish-new', installed: { version: after, root } };
|
|
526
624
|
}
|
package/server/src/cli/update.js
CHANGED
|
@@ -36,11 +36,13 @@ import { unitFilePath } from './systemd-unit.js';
|
|
|
36
36
|
import { downloadStep } from './update-registry.js';
|
|
37
37
|
import { UPDATE_LOCK_TOKEN, markInstalled, takeUpdateLock, updateLockOf } from './update-lock.js';
|
|
38
38
|
import { sentenceFor, usageFor } from './screen/prose.js';
|
|
39
|
-
export const UPDATE_USAGE = ` rarog update [--data-dir <dir>] [--verbose]
|
|
40
|
-
Updates the npm package on this machine, in a terminal: the newest
|
|
39
|
+
export const UPDATE_USAGE = ` rarog update [--beta] [--data-dir <dir>] [--verbose]
|
|
40
|
+
Updates the npm package on this machine, in a terminal: the newest release from the npm registry (npm next
|
|
41
41
|
to this installation's node, without install scripts), then the finish below by the new version itself. A
|
|
42
42
|
version npm holds back (release age gate) is reported and nothing else changes. One update runs at a time
|
|
43
43
|
(the update lock in ~/.config/rarog). Details go to the log <data directory>/logs/update-<time>.log.
|
|
44
|
+
--beta: the newer of the newest beta and the newest release (npm dist-tags beta and latest); without it a
|
|
45
|
+
beta is never installed.
|
|
44
46
|
rarog update --finish [--data-dir <dir>] [--verbose]
|
|
45
47
|
Finishes the version installed on this machine, without the registry: the Claude SDK it pins (downloaded
|
|
46
48
|
without a question), the hook copy (after its diff and a question, as in setup; without the question when the
|
|
@@ -60,6 +62,7 @@ const DEFAULT_DEPS = {
|
|
|
60
62
|
};
|
|
61
63
|
function parseFlags(argv) {
|
|
62
64
|
let finish = false;
|
|
65
|
+
let beta = false;
|
|
63
66
|
let dataDir = null;
|
|
64
67
|
let verbose = false;
|
|
65
68
|
for (let i = 1; i < argv.length; i += 1) {
|
|
@@ -67,6 +70,9 @@ function parseFlags(argv) {
|
|
|
67
70
|
if (arg === '--finish') {
|
|
68
71
|
finish = true;
|
|
69
72
|
}
|
|
73
|
+
else if (arg === '--beta') {
|
|
74
|
+
beta = true;
|
|
75
|
+
}
|
|
70
76
|
else if (arg === '--verbose') {
|
|
71
77
|
verbose = true;
|
|
72
78
|
}
|
|
@@ -85,7 +91,10 @@ function parseFlags(argv) {
|
|
|
85
91
|
throw new Usage(`rarog update: unknown argument "${arg}".`);
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
|
-
|
|
94
|
+
if (finish && beta) {
|
|
95
|
+
throw new Usage('rarog update: --beta chooses what rarog update downloads, and --finish downloads nothing.');
|
|
96
|
+
}
|
|
97
|
+
return { finish, beta, dataDir, verbose };
|
|
89
98
|
}
|
|
90
99
|
/** The environment of the steps and their child processes: without the lock token, which only this process checks. */
|
|
91
100
|
function withoutToken(env) {
|
|
@@ -261,6 +270,7 @@ async function run(io, update, deps) {
|
|
|
261
270
|
if (!update.flags.finish) {
|
|
262
271
|
const outcome = await downloadStep({
|
|
263
272
|
io: stepIo, view, home, root: update.root, execPath: process.execPath, refused: EXIT_REFUSED,
|
|
273
|
+
beta: update.flags.beta,
|
|
264
274
|
stepHeader: `[1/${String(STEPS + offset)}] Download`, ...(deps.npmCli === undefined ? {} : { npmCli: deps.npmCli }),
|
|
265
275
|
...(deps.provenanceAuthority === undefined ? {} : { provenanceAuthority: deps.provenanceAuthority }),
|
|
266
276
|
});
|
|
@@ -3,7 +3,10 @@ export const TURNS_MAX_READS = 3;
|
|
|
3
3
|
/**
|
|
4
4
|
* Takes the session, reads its turns and takes it again until the conversation holds still across a read. `finish`
|
|
5
5
|
* runs synchronously right after the last take, with no `await` in between, so the route answers for the session as
|
|
6
|
-
* it was taken. A body carries the token and `
|
|
6
|
+
* it was taken. A body carries the token, `stateSince` and `readMark` of the target it was read for, taken before
|
|
7
|
+
* that read, never of a take after it: a message that reaches the session during the read gives the body an older
|
|
8
|
+
* mark. A body with no messages or with a trimmed message carries the mark that names no read instead (`NO_READ_MARK`
|
|
9
|
+
* in `turns.ts`).
|
|
7
10
|
*/
|
|
8
11
|
export async function readSettledTurns(reader, take, count, finish) {
|
|
9
12
|
let taken = take();
|
|
@@ -4,10 +4,19 @@ import { historyWithoutEcho, readHistoryTail, readRange, sizeOf } from '../herdr
|
|
|
4
4
|
import { HISTORY_MAX_BYTES } from '../herdr/jsonl-follow.js';
|
|
5
5
|
import { locateTranscript } from '../herdr/transcript-path.js';
|
|
6
6
|
import { RING_MAX_BYTES, jsonBytes } from '../sessions/ring-buffer.js';
|
|
7
|
-
import { transcriptMessage } from '../sessions/session.js';
|
|
7
|
+
import { MESSAGE_TRIMMED_MARK, transcriptMessage } from '../sessions/session.js';
|
|
8
8
|
import { conversationToken } from './conversation.js';
|
|
9
9
|
/** First window of the tail read: enough for three turns of most sessions; it doubles up to the history ceiling. */
|
|
10
10
|
export const TURNS_FIRST_WINDOW = 256 * 1024;
|
|
11
|
+
/**
|
|
12
|
+
* `readMark` of an answer that did not read the session's result: an answer with no messages (a failed read, i.e. no
|
|
13
|
+
* file, a lookup that throws, a size or a first read that fails, and a conversation with nothing to read alike) and an
|
|
14
|
+
* answer with a message trimmed to the per-message ceiling ({@link hasTrimmedMessage}). The mark names no read: it has
|
|
15
|
+
* no dot, while `Session.readMark` always has three dot-separated parts, so the voice agent's pick-up built from it
|
|
16
|
+
* never meets the session's mark and gets the 409. Inside the 1–64 character bound of the turns answer and of the
|
|
17
|
+
* pick-up body.
|
|
18
|
+
*/
|
|
19
|
+
export const NO_READ_MARK = 'no-read';
|
|
11
20
|
/**
|
|
12
21
|
* Whether a message opens a turn, by the rule of the app's projection: a human message, not a harness notice and not
|
|
13
22
|
* a blocked prompt, with text outside the server's own sentences, an image block or an attachment. A command output,
|
|
@@ -49,6 +58,21 @@ function wireHistory(entries, now) {
|
|
|
49
58
|
seq: index + 1,
|
|
50
59
|
}));
|
|
51
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Whether a returned message lost its end: `transcriptMessage` keeps the start of a message over the per-message
|
|
63
|
+
* ceiling and closes it with {@link MESSAGE_TRIMMED_MARK}, a server sentence known by its `ref` (a text from the file
|
|
64
|
+
* never carries one). The history merges consecutive agent entries into one message, while the server's memory of a
|
|
65
|
+
* live session got them one by one, so the newest result can be in the memory and lost in the answer. Any trimmed
|
|
66
|
+
* message counts, also one of an older returned turn: the answer is what the agent relays as the session's last turns.
|
|
67
|
+
* The other cuts of the read (the window, the message limit, the cut to turns and the byte ceiling) drop from the old
|
|
68
|
+
* end and keep the newest message.
|
|
69
|
+
*/
|
|
70
|
+
function hasTrimmedMessage(messages) {
|
|
71
|
+
return messages.some((m) => {
|
|
72
|
+
const last = m.blocks.at(-1);
|
|
73
|
+
return last?.type === 'text' && last.ref?.code === MESSAGE_TRIMMED_MARK.ref.code;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
52
76
|
/** Byte ceiling of the session's transcript (`Session.appendMessage`): the oldest messages drop first. */
|
|
53
77
|
function capBytes(messages) {
|
|
54
78
|
let bytes = messages.reduce((sum, m) => sum + jsonBytes(m), 0);
|
|
@@ -66,13 +90,16 @@ export function createCompanionTurns(opts) {
|
|
|
66
90
|
const maxBytes = Math.max(firstWindow, opts.maxBytes ?? HISTORY_MAX_BYTES);
|
|
67
91
|
return {
|
|
68
92
|
async read(target, count) {
|
|
69
|
-
const
|
|
93
|
+
const conversation = token(target.agentSessionId);
|
|
94
|
+
const nothing = {
|
|
95
|
+
messages: [], conversation, stateSince: target.stateSince, readMark: NO_READ_MARK, complete: true,
|
|
96
|
+
};
|
|
70
97
|
const file = target.agentSessionId === undefined
|
|
71
98
|
? null
|
|
72
99
|
: await opts.locate(target.cwd, target.agentSessionId).catch(() => null);
|
|
73
100
|
const size = file === null ? null : await sizeOf(file);
|
|
74
101
|
if (file === null || size === null)
|
|
75
|
-
return
|
|
102
|
+
return nothing;
|
|
76
103
|
const at = now();
|
|
77
104
|
// One turn start more than asked: the oldest wanted turn then lies whole inside the window.
|
|
78
105
|
const tail = await readHistoryTail(readRange, file, size, {
|
|
@@ -80,13 +107,17 @@ export function createCompanionTurns(opts) {
|
|
|
80
107
|
enough: (entries) => wireHistory(entries, at).filter(isTurnStart).length > count,
|
|
81
108
|
});
|
|
82
109
|
if (tail === null)
|
|
83
|
-
return
|
|
110
|
+
return nothing;
|
|
84
111
|
const wholeFile = tail.start === 0 && tail.messages.length < HERDR_HISTORY_MESSAGES;
|
|
85
112
|
const turns = lastTurns(wireHistory(tail.messages, at), count, wholeFile);
|
|
86
113
|
const capped = capBytes(turns.messages);
|
|
114
|
+
if (capped.messages.length === 0)
|
|
115
|
+
return { ...nothing, complete: turns.complete };
|
|
87
116
|
return {
|
|
88
117
|
messages: capped.messages.map((m, index) => ({ ...m, seq: index + 1 })),
|
|
89
|
-
|
|
118
|
+
conversation,
|
|
119
|
+
stateSince: target.stateSince,
|
|
120
|
+
readMark: hasTrimmedMessage(capped.messages) ? NO_READ_MARK : target.readMark,
|
|
90
121
|
complete: turns.complete && !capped.dropped,
|
|
91
122
|
};
|
|
92
123
|
},
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The session files settings: the switch of the file routes (`RAROG_FILES`) and the largest file the server sends
|
|
3
|
+
* (`RAROG_FILES_MAX_MB`). A value out of range stops the start, so a typo never leaves a limit the owner did not set.
|
|
4
|
+
*/
|
|
5
|
+
import { ConfigError, FILES_ENV, FILES_MAX_MB_ENV } from '../config-env.js';
|
|
6
|
+
/** Limit of a sent file in megabytes without the variable. */
|
|
7
|
+
export const DEFAULT_FILES_MAX_MB = 50;
|
|
8
|
+
/** The highest value `RAROG_FILES_MAX_MB` takes. */
|
|
9
|
+
export const FILES_MAX_MB_CEILING = 1024;
|
|
10
|
+
const MIB = 1024 * 1024;
|
|
11
|
+
/** Session files switch; missing, empty or `1` = on, `0` = off, any other value stops the start. */
|
|
12
|
+
export function parseFilesEnabled(raw) {
|
|
13
|
+
const value = raw?.trim() ?? '';
|
|
14
|
+
if (value === '' || value === '1')
|
|
15
|
+
return true;
|
|
16
|
+
if (value === '0')
|
|
17
|
+
return false;
|
|
18
|
+
throw new ConfigError(`${FILES_ENV} takes 1 or 0 (got: ${value}).`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The largest sent file in bytes, from whole megabytes (`RAROG_FILES_MAX_MB`); missing or empty = 50 MB. Only digits
|
|
22
|
+
* from 1 to 1024: a fraction, an exponent, a hex number or a value out of range stops the start.
|
|
23
|
+
*/
|
|
24
|
+
export function parseFilesMaxBytes(raw) {
|
|
25
|
+
const value = raw?.trim() ?? '';
|
|
26
|
+
if (value === '')
|
|
27
|
+
return DEFAULT_FILES_MAX_MB * MIB;
|
|
28
|
+
const mb = /^\d{1,4}$/.test(value) ? Number(value) : Number.NaN;
|
|
29
|
+
if (mb >= 1 && mb <= FILES_MAX_MB_CEILING)
|
|
30
|
+
return mb * MIB;
|
|
31
|
+
throw new ConfigError(`${FILES_MAX_MB_ENV} takes whole megabytes from 1 to ${String(FILES_MAX_MB_CEILING)} (got: ${value}).`);
|
|
32
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* status and the consent channel's restart grace. The
|
|
5
5
|
* consent channel, dialog layer 2 and tall dialog guard flags stay in `server/src/config.ts`.
|
|
6
6
|
*/
|
|
7
|
-
import { COMPANION_ENV, COMPANION_MODEL_ENV, COMPANION_SESSIONS_ENV, CONSENT_RESTART_GRACE_ENV, ConfigError, PR_STATUS_ENV, SSE_GZIP_ENV, } from '../config-env.js';
|
|
7
|
+
import { COMPANION_ENV, COMPANION_MODEL_ENV, COMPANION_SESSIONS_ENV, CONSENT_RESTART_GRACE_ENV, ConfigError, INBOX_ENV, PR_STATUS_ENV, SSE_GZIP_ENV, } from '../config-env.js';
|
|
8
8
|
import { HOOK_RESTART_GRACE_DEFAULT_MS, HOOK_RESTART_GRACE_MAX_MS } from '../herdr/dialogs/hook/contract.js';
|
|
9
9
|
/**
|
|
10
10
|
* Restart grace of the consent channel in ms from whole seconds (`RAROG_CONSENT_RESTART_GRACE`); no value = 45 s,
|
|
@@ -107,6 +107,15 @@ export function parsePrStatusEnabled(raw) {
|
|
|
107
107
|
return false;
|
|
108
108
|
throw new ConfigError(`${PR_STATUS_ENV} takes 1 or 0 (got: ${value}).`);
|
|
109
109
|
}
|
|
110
|
+
/** Inbox flag; missing, empty or `1` = on, `0` = off, any other value stops the start. */
|
|
111
|
+
export function parseInboxEnabled(raw) {
|
|
112
|
+
const value = raw?.trim() ?? '';
|
|
113
|
+
if (value === '' || value === '1')
|
|
114
|
+
return true;
|
|
115
|
+
if (value === '0')
|
|
116
|
+
return false;
|
|
117
|
+
throw new ConfigError(`${INBOX_ENV} takes 1 or 0 (got: ${value}).`);
|
|
118
|
+
}
|
|
110
119
|
/** Voice agent flag; missing or `0` = off, `1` = on, any other value stops the start. */
|
|
111
120
|
export function parseCompanionEnabled(raw) {
|
|
112
121
|
const value = raw?.trim() ?? '';
|
package/server/src/config-env.js
CHANGED
|
@@ -232,6 +232,27 @@ export const WITHDRAWN_ENV_NAMES = ['RAROG_COMPANION_SPEECH'];
|
|
|
232
232
|
* killswitch; `docs/security-model.md` describes the channel. Demo mode reads states from a fixed map.
|
|
233
233
|
*/
|
|
234
234
|
export const PR_STATUS_ENV = 'RAROG_PR_STATUS';
|
|
235
|
+
/**
|
|
236
|
+
* Inbox flag (`docs/server-config.md`): missing, empty or `1` = the server keeps an Inbox card per session
|
|
237
|
+
* (`server/src/inbox/`), sends its heads to a stream opened with `inbox=1`, serves `/api/inbox` and announces the
|
|
238
|
+
* `inbox` capability; `0` = no card tracker, no Inbox event, no capability, and the Inbox routes answer 503;
|
|
239
|
+
* `inbox.json` stays on disk untouched. Any other value is a configuration error at start. It sends nothing to a pane,
|
|
240
|
+
* so NOT a killswitch.
|
|
241
|
+
*/
|
|
242
|
+
export const INBOX_ENV = 'RAROG_INBOX';
|
|
243
|
+
/**
|
|
244
|
+
* Session files switch (`docs/server-config.md`): missing, empty or `1` = the server lists a directory of a session
|
|
245
|
+
* (`GET /api/sessions/:id/files`) and announces the `files` capability; `0` = the file routes answer 404 as unknown
|
|
246
|
+
* routes and the capability is absent. Any other value is a configuration error at start. It sends nothing to a pane,
|
|
247
|
+
* so NOT a killswitch.
|
|
248
|
+
*/
|
|
249
|
+
export const FILES_ENV = 'RAROG_FILES';
|
|
250
|
+
/**
|
|
251
|
+
* The largest file of a session the server sends, in whole megabytes from 1 to 1024 (`docs/server-config.md`);
|
|
252
|
+
* missing or empty = 50. Every listing announces it in bytes (`maxBytes`), so the app keeps no limit of its own. Any
|
|
253
|
+
* other value is a configuration error at start.
|
|
254
|
+
*/
|
|
255
|
+
export const FILES_MAX_MB_ENV = 'RAROG_FILES_MAX_MB';
|
|
235
256
|
// ---------------------------------------------------------------------------
|
|
236
257
|
// Dyktowanie i powiadomienia
|
|
237
258
|
// ---------------------------------------------------------------------------
|
|
@@ -376,6 +397,9 @@ export const SERVER_ENV = {
|
|
|
376
397
|
[COMPANION_SESSIONS_ENV]: 'plain',
|
|
377
398
|
[COMPANION_MODEL_ENV]: 'plain',
|
|
378
399
|
[PR_STATUS_ENV]: 'plain',
|
|
400
|
+
[INBOX_ENV]: 'plain',
|
|
401
|
+
[FILES_ENV]: 'plain',
|
|
402
|
+
[FILES_MAX_MB_ENV]: 'plain',
|
|
379
403
|
[OPENAI_API_KEY_ENV]: 'secret',
|
|
380
404
|
// Dyktowanie i powiadomienia.
|
|
381
405
|
[SONIOX_API_KEY_ENV]: 'secret',
|
package/server/src/config.js
CHANGED
|
@@ -15,7 +15,7 @@ import path from 'node:path';
|
|
|
15
15
|
import { MAX_TRANSCRIPT_MESSAGES } from '@rarog/shared';
|
|
16
16
|
import { BUNDLE_ID_RE } from '@rarog/shared/rest';
|
|
17
17
|
import { dataDirConflictMessage, resolveDataDir } from '@rarog/shared/data-dir';
|
|
18
|
-
import { AGENT_FILES_ENV, APNS_ENV_NAMES, APNS_KEY_ID_ENV, APNS_KEY_PATH_ENV, APNS_TEAM_ID_ENV, APNS_TOPIC_ENV, CLAUDE_ENV_CLEAR_ENV, ConfigError, CLI_WAITING_ENV, CODEX_STATUS_ENV, COMPANION_ENV, COMPANION_MODEL_ENV, COMPANION_SESSIONS_ENV, COMPANION_ENV_PASSTHROUGH, CONSENT_CHANNEL_ENV, CONSENT_PROOF_ENV, CONSENT_ALWAYS_ENV, CONSENT_RESTART_GRACE_ENV, DEMO_CONTENT_ENV, DEMO_LANG_ENV, DEMO_REVIEW_CODE_ENV, DIALOG_LAYER2_ENV, GIT_ENV_PASSTHROUGH, GIT_ENV_PREFIX, GIT_FILE_DETAILS_ENV, HERDR_BIN_ENV, HERDR_LAUNCH_ENV, HERDR_ROOTS_ENV, HERDR_SEEN_FOCUS_ENV, HERDR_SEND_ENV, HERDR_SOCKET_ENV, HERDR_TAB_LABELS_ENV, IROH_ENV, IROH_KEY_ENV, IROH_PORT_ENV, IROH_RELAY_ENV, MAX_PANES_ENV, MIN_CLIENT_BUILD_ENV, NOTES_ENV, PROJECT_ROOTS_ENV, PROMPT_BLOCK_ENV, PUSH_E2E_ENV, PUSH_ENV, PR_STATUS_ENV, PR_STATUS_ENV_PASSTHROUGH, PUSH_RELAY_URL_ENV, QUEUE_ECHO_ENV, REFUSAL_DUMPS_ENV, SONIOX_API_HOST_ENV, SONIOX_API_KEY_ENV, OPENAI_API_KEY_ENV, SSE_GZIP_ENV, TALL_DIALOG_GUARD_ENV, TERM_ENV, TERM_ENV_PASSTHROUGH, TERM_IDLE_DAYS_ENV, TERM_MAX_ENV, VOICE_ENV, YOLO_ROOTS_ENV, readEnv, } from './config-env.js';
|
|
18
|
+
import { AGENT_FILES_ENV, APNS_ENV_NAMES, APNS_KEY_ID_ENV, APNS_KEY_PATH_ENV, APNS_TEAM_ID_ENV, APNS_TOPIC_ENV, CLAUDE_ENV_CLEAR_ENV, ConfigError, CLI_WAITING_ENV, CODEX_STATUS_ENV, COMPANION_ENV, COMPANION_MODEL_ENV, COMPANION_SESSIONS_ENV, COMPANION_ENV_PASSTHROUGH, CONSENT_CHANNEL_ENV, CONSENT_PROOF_ENV, CONSENT_ALWAYS_ENV, CONSENT_RESTART_GRACE_ENV, DEMO_CONTENT_ENV, DEMO_LANG_ENV, DEMO_REVIEW_CODE_ENV, DIALOG_LAYER2_ENV, GIT_ENV_PASSTHROUGH, GIT_ENV_PREFIX, GIT_FILE_DETAILS_ENV, HERDR_BIN_ENV, HERDR_LAUNCH_ENV, HERDR_ROOTS_ENV, HERDR_SEEN_FOCUS_ENV, HERDR_SEND_ENV, HERDR_SOCKET_ENV, HERDR_TAB_LABELS_ENV, INBOX_ENV, FILES_ENV, FILES_MAX_MB_ENV, IROH_ENV, IROH_KEY_ENV, IROH_PORT_ENV, IROH_RELAY_ENV, MAX_PANES_ENV, MIN_CLIENT_BUILD_ENV, NOTES_ENV, PROJECT_ROOTS_ENV, PROMPT_BLOCK_ENV, PUSH_E2E_ENV, PUSH_ENV, PR_STATUS_ENV, PR_STATUS_ENV_PASSTHROUGH, PUSH_RELAY_URL_ENV, QUEUE_ECHO_ENV, REFUSAL_DUMPS_ENV, SONIOX_API_HOST_ENV, SONIOX_API_KEY_ENV, OPENAI_API_KEY_ENV, SSE_GZIP_ENV, TALL_DIALOG_GUARD_ENV, TERM_ENV, TERM_ENV_PASSTHROUGH, TERM_IDLE_DAYS_ENV, TERM_MAX_ENV, VOICE_ENV, YOLO_ROOTS_ENV, readEnv, } from './config-env.js';
|
|
19
19
|
import { RAROG_VERSION } from './version.js';
|
|
20
20
|
import { INSTALL_MODE } from './install/mode.js';
|
|
21
21
|
import { DEVICES_FILENAME, activeDeviceEpochs } from './auth/devices-store.js';
|
|
@@ -24,7 +24,8 @@ import { CONSENT_PROOF_RULES } from './herdr/dialogs/layer1/contract.js';
|
|
|
24
24
|
import { readAccountDefaultEffort, readAccountDefaultModel } from './config/claude-account.js';
|
|
25
25
|
import { minClientBuildOf, parseMinClientBuild } from './config/clients.js';
|
|
26
26
|
import { DEMO_REVIEW_MAX_DEVICES, assertDemoReviewOrigins, demoEnabled, parseDemoContent, parseDemoLang, parseDemoReview, } from './config/demo.js';
|
|
27
|
-
import { COMPANION_MODEL_DEFAULT, COMPANION_MODEL_PATTERN, parseAgentFiles, parseCliWaiting, parseCodexStatusEnabled, parseCompanionEnabled, parseCompanionModel, parseCompanionSessionsEnabled, parseConsentRestartGrace, parseGitFileDetails, parseNotesEnabled, parsePrStatusEnabled, parsePromptBlock, parseQueueEcho, parseRefusalDumps, parseSseGzip, } from './config/flags.js';
|
|
27
|
+
import { COMPANION_MODEL_DEFAULT, COMPANION_MODEL_PATTERN, parseAgentFiles, parseCliWaiting, parseCodexStatusEnabled, parseCompanionEnabled, parseCompanionModel, parseCompanionSessionsEnabled, parseConsentRestartGrace, parseGitFileDetails, parseInboxEnabled, parseNotesEnabled, parsePrStatusEnabled, parsePromptBlock, parseQueueEcho, parseRefusalDumps, parseSseGzip, } from './config/flags.js';
|
|
28
|
+
import { parseFilesEnabled, parseFilesMaxBytes } from './config/files.js';
|
|
28
29
|
import { DEFAULT_MAX_PANES, defaultHerdrSocket, parseHerdrLaunch, parseHerdrSeenFocus, parseHerdrSend, parseHerdrSocket, parseHerdrTabLabels, parseMaxPanes, } from './config/herdr.js';
|
|
29
30
|
import { DEFAULT_PORT, MAX_BODY_BYTES, RAROG_HOST, assertLoopbackHost, demoOrigins, parseIroh, parseOrigins, parsePort, } from './config/listen.js';
|
|
30
31
|
import { APPLE_ID_RE, expandHome, parsePushE2e, parsePushEnabled, parsePushRelay, readApnsKeyFile, } from './config/push.js';
|
|
@@ -715,6 +716,9 @@ export function loadConfig(env = process.env, mode = INSTALL_MODE) {
|
|
|
715
716
|
companionModel: parseCompanionModel(readEnv(env, COMPANION_MODEL_ENV)),
|
|
716
717
|
// On in demo too: the demo has its own fixed source (`bootstrap/pr-status.ts`); a wrong value stops the start.
|
|
717
718
|
prStatusEnabled: parsePrStatusEnabled(readEnv(env, PR_STATUS_ENV)),
|
|
719
|
+
inboxEnabled: parseInboxEnabled(readEnv(env, INBOX_ENV)),
|
|
720
|
+
filesEnabled: parseFilesEnabled(readEnv(env, FILES_ENV)),
|
|
721
|
+
filesMaxBytes: parseFilesMaxBytes(readEnv(env, FILES_MAX_MB_ENV)),
|
|
718
722
|
prStatusEnvBase: parsePrStatusEnvBase(env),
|
|
719
723
|
/*
|
|
720
724
|
* Terminal jest wyłączony w demo BEZWARUNKOWO: demo nie dotyka dysku ani procesów
|