@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
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** The downloads in flight by device: the unpair effects stop them (`device-effects.ts`). */
|
|
2
|
+
export class FileDownloads {
|
|
3
|
+
#byOwner = new Map();
|
|
4
|
+
/** Registers `stop` under the device `owner`; the returned function removes it again. */
|
|
5
|
+
track(owner, stop) {
|
|
6
|
+
let stops = this.#byOwner.get(owner);
|
|
7
|
+
if (stops === undefined) {
|
|
8
|
+
stops = new Set();
|
|
9
|
+
this.#byOwner.set(owner, stops);
|
|
10
|
+
}
|
|
11
|
+
// An entry of its own, so the same function registered twice is two downloads.
|
|
12
|
+
const entry = () => { stop(); };
|
|
13
|
+
stops.add(entry);
|
|
14
|
+
return () => {
|
|
15
|
+
const current = this.#byOwner.get(owner);
|
|
16
|
+
if (current === undefined)
|
|
17
|
+
return;
|
|
18
|
+
current.delete(entry);
|
|
19
|
+
if (current.size === 0)
|
|
20
|
+
this.#byOwner.delete(owner);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Stops every download of the device `owner` (it was unpaired); returns how many. */
|
|
24
|
+
closeOwner(owner) {
|
|
25
|
+
const stops = this.#byOwner.get(owner);
|
|
26
|
+
if (stops === undefined)
|
|
27
|
+
return 0;
|
|
28
|
+
this.#byOwner.delete(owner);
|
|
29
|
+
for (const stop of stops)
|
|
30
|
+
stop();
|
|
31
|
+
return stops.size;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The headers of the 200: bytes the app keeps as they are, never sniffed and never cached on the way. */
|
|
35
|
+
export function downloadHeaders(size) {
|
|
36
|
+
return {
|
|
37
|
+
'Content-Type': 'application/octet-stream',
|
|
38
|
+
'Content-Length': String(size),
|
|
39
|
+
'Cache-Control': 'no-store',
|
|
40
|
+
'X-Content-Type-Options': 'nosniff',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const codeOf = (err) => {
|
|
44
|
+
const code = err?.code;
|
|
45
|
+
return typeof code === 'string' ? code : 'error';
|
|
46
|
+
};
|
|
47
|
+
/** Settles on the next `drain` or `close` of `res`, whichever comes first. */
|
|
48
|
+
function drainedOrClosed(res) {
|
|
49
|
+
return new Promise((resolve) => {
|
|
50
|
+
const done = () => {
|
|
51
|
+
res.off('drain', done);
|
|
52
|
+
res.off('close', done);
|
|
53
|
+
resolve();
|
|
54
|
+
};
|
|
55
|
+
res.on('drain', done);
|
|
56
|
+
res.on('close', done);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sends `download` on `res`, registered under `opts.owner` until it ends. Call it right after the last check of the
|
|
61
|
+
* device, with no `await` in between, so an unpair from then on reaches this download. Never throws.
|
|
62
|
+
*/
|
|
63
|
+
export async function sendDownload(res, download, opts) {
|
|
64
|
+
// The descriptor closes after the last read, but the download leaves the registry only when the response closes:
|
|
65
|
+
// the last bytes may still wait in the transport, and an unpair until then must still cut them.
|
|
66
|
+
let released = false;
|
|
67
|
+
const release = () => {
|
|
68
|
+
if (released)
|
|
69
|
+
return;
|
|
70
|
+
released = true;
|
|
71
|
+
download.close().catch((err) => { opts.log(`files: closing a downloaded file failed: ${codeOf(err)}`); });
|
|
72
|
+
};
|
|
73
|
+
const untrack = opts.owner === undefined ? () => { } : opts.downloads.track(opts.owner, () => { res.destroy(); });
|
|
74
|
+
res.once('close', () => {
|
|
75
|
+
untrack();
|
|
76
|
+
release();
|
|
77
|
+
});
|
|
78
|
+
if (res.destroyed) {
|
|
79
|
+
untrack();
|
|
80
|
+
release();
|
|
81
|
+
return 'closed';
|
|
82
|
+
}
|
|
83
|
+
res.writeHead(200, downloadHeaders(download.size));
|
|
84
|
+
for (;;) {
|
|
85
|
+
let piece;
|
|
86
|
+
try {
|
|
87
|
+
piece = await download.read();
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
const outcome = res.destroyed ? 'closed' : 'failed';
|
|
91
|
+
if (outcome === 'failed')
|
|
92
|
+
opts.log(`files: reading a downloaded file failed: ${codeOf(err)}`);
|
|
93
|
+
res.destroy();
|
|
94
|
+
release();
|
|
95
|
+
return outcome;
|
|
96
|
+
}
|
|
97
|
+
if (res.destroyed) {
|
|
98
|
+
release();
|
|
99
|
+
return 'closed';
|
|
100
|
+
}
|
|
101
|
+
if (piece.kind === 'done') {
|
|
102
|
+
release();
|
|
103
|
+
res.end();
|
|
104
|
+
return 'sent';
|
|
105
|
+
}
|
|
106
|
+
if (piece.kind === 'short') {
|
|
107
|
+
opts.log('files: a file got shorter while it was sent, the response was cut');
|
|
108
|
+
res.destroy();
|
|
109
|
+
release();
|
|
110
|
+
return 'short';
|
|
111
|
+
}
|
|
112
|
+
if (!res.write(piece.bytes))
|
|
113
|
+
await drainedOrClosed(res);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The download of one file of a session, as `GET /api/sessions/:id/files/raw?path=` sends it: the session gate of the
|
|
3
|
+
* file routes, then either the fixed demo bytes or the file opened by the path rule, and the size limit against the
|
|
4
|
+
* `fstat` of that open descriptor, before any byte. It sends nothing itself (`send-file.ts`), holds no state and does
|
|
5
|
+
* not import the manager.
|
|
6
|
+
*/
|
|
7
|
+
import { exactReader } from '../safe-read.js';
|
|
8
|
+
import { FILES_DISK, openSessionFile, shapeRefusal } from './path-rule.js';
|
|
9
|
+
import { NOT_FOUND, fileTooLarge } from './refusals.js';
|
|
10
|
+
import { filesSession } from './session-gate.js';
|
|
11
|
+
/**
|
|
12
|
+
* Opens the file `rel` of the session `id` for sending, or refuses it. An unknown session throws the manager's 404
|
|
13
|
+
* (`port.require`); the gate refuses a Codex entry, a pane out of scope and a session without a pane before any disk
|
|
14
|
+
* call. A file over `maxBytes` is refused with its descriptor closed; on success the caller owns the descriptor
|
|
15
|
+
* through `close`.
|
|
16
|
+
*/
|
|
17
|
+
export async function openSessionDownload(id, rel, maxBytes, port, disk = FILES_DISK) {
|
|
18
|
+
const gate = filesSession(id, port, disk.area);
|
|
19
|
+
if (gate.kind === 'refused')
|
|
20
|
+
return { ok: false, refusal: gate.refusal };
|
|
21
|
+
if (gate.kind === 'demo')
|
|
22
|
+
return demoDownload(rel, maxBytes, port.demoFile);
|
|
23
|
+
const opened = await openSessionFile(gate.area, rel, disk);
|
|
24
|
+
if (!opened.ok)
|
|
25
|
+
return opened;
|
|
26
|
+
const { handle, size } = opened.value;
|
|
27
|
+
if (size > maxBytes) {
|
|
28
|
+
await handle.close();
|
|
29
|
+
return { ok: false, refusal: fileTooLarge(size, maxBytes) };
|
|
30
|
+
}
|
|
31
|
+
return { ok: true, value: { size, read: exactReader(handle, size), close: () => handle.close() } };
|
|
32
|
+
}
|
|
33
|
+
/** The demo download: the shape check as on a server, then the demo bytes; a file it does not have is 404. */
|
|
34
|
+
function demoDownload(rel, maxBytes, bytesOf) {
|
|
35
|
+
const shape = shapeRefusal(rel, false);
|
|
36
|
+
if (shape !== null)
|
|
37
|
+
return { ok: false, refusal: shape };
|
|
38
|
+
const bytes = bytesOf(rel);
|
|
39
|
+
if (bytes === null)
|
|
40
|
+
return { ok: false, refusal: NOT_FOUND };
|
|
41
|
+
if (bytes.length > maxBytes)
|
|
42
|
+
return { ok: false, refusal: fileTooLarge(bytes.length, maxBytes) };
|
|
43
|
+
let sent = false;
|
|
44
|
+
const read = () => {
|
|
45
|
+
if (sent || bytes.length === 0)
|
|
46
|
+
return Promise.resolve({ kind: 'done' });
|
|
47
|
+
sent = true;
|
|
48
|
+
return Promise.resolve({ kind: 'piece', bytes });
|
|
49
|
+
};
|
|
50
|
+
return { ok: true, value: { size: bytes.length, read, close: () => Promise.resolve() } };
|
|
51
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The listing of one directory of a session, as `GET /api/sessions/:id/files?dir=` sends it: the session gate of the
|
|
3
|
+
* file routes, then either the fixed demo data or the directory on disk (`listing.ts`) with git's `ignored` labels
|
|
4
|
+
* (`ignored.ts`). Functions over a port the manager fills; the module holds no state and does not import the manager.
|
|
5
|
+
*/
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { labelIgnored } from './ignored.js';
|
|
8
|
+
import { listSessionDir } from './listing.js';
|
|
9
|
+
import { FILES_DISK, shapeRefusal } from './path-rule.js';
|
|
10
|
+
import { NOT_FOUND } from './refusals.js';
|
|
11
|
+
import { filesSession } from './session-gate.js';
|
|
12
|
+
/**
|
|
13
|
+
* Lists the directory `dir` of the session `id` (`''` = the session directory) and announces `maxBytes`. An unknown
|
|
14
|
+
* session throws the manager's 404 (`port.require`); the gate refuses a Codex entry, a pane out of scope and a
|
|
15
|
+
* session without a pane before any disk call.
|
|
16
|
+
*/
|
|
17
|
+
export async function listSessionFiles(id, dir, maxBytes, port, disk = FILES_DISK) {
|
|
18
|
+
const gate = filesSession(id, port, disk.area);
|
|
19
|
+
if (gate.kind === 'refused')
|
|
20
|
+
return { ok: false, refusal: gate.refusal };
|
|
21
|
+
if (gate.kind === 'demo')
|
|
22
|
+
return demoListing(dir, maxBytes, port.demoEntries);
|
|
23
|
+
const listing = await listSessionDir(gate.area, dir, { maxBytes }, disk);
|
|
24
|
+
if (!listing.ok)
|
|
25
|
+
return listing;
|
|
26
|
+
// The walk of the rule proved the listed directory on disk is exactly the session directory on disk plus `dir`.
|
|
27
|
+
return { ok: true, value: await labelIgnored(listing.value, path.join(gate.area.realCwd, dir), port.run) };
|
|
28
|
+
}
|
|
29
|
+
/** The demo listing: the shape check as on a server, then the demo data; a directory it does not have is 404. */
|
|
30
|
+
function demoListing(dir, maxBytes, entriesOf) {
|
|
31
|
+
const shape = shapeRefusal(dir, true);
|
|
32
|
+
if (shape !== null)
|
|
33
|
+
return { ok: false, refusal: shape };
|
|
34
|
+
const entries = entriesOf(dir);
|
|
35
|
+
if (entries === null)
|
|
36
|
+
return { ok: false, refusal: NOT_FOUND };
|
|
37
|
+
return { ok: true, value: { dir, entries, truncated: false, maxBytes } };
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The session gate of the file routes: which session's directory a listing or a file may come from, and the area the
|
|
3
|
+
* path rule works in. The variant of the diff gate (`sessions/session-scope.ts`) with its own refusal codes, and
|
|
4
|
+
* without its pass for a session that has no pane: such a session is refused. The checks on the session come first
|
|
5
|
+
* and touch no disk; the session directory is then checked in the work area on disk and resolved, together with the
|
|
6
|
+
* roots and home, never a path of the request.
|
|
7
|
+
*/
|
|
8
|
+
import { homedir } from 'node:os';
|
|
9
|
+
import { inWorkAreaOnDisk, onDiskForms } from '../config/work-area.js';
|
|
10
|
+
import { FILES_DISK } from './path-rule.js';
|
|
11
|
+
import { CODEX, NOT_FOUND, NO_PANE, OUT_OF_SCOPE } from './refusals.js';
|
|
12
|
+
/**
|
|
13
|
+
* The area of the session directory `cwd`: refused when `cwd` lies outside the work area as written or on disk
|
|
14
|
+
* (`out-of-scope`), and when it no longer resolves (`not-found`: the directory is gone).
|
|
15
|
+
*/
|
|
16
|
+
export function filesArea(cwd, config, disk = FILES_DISK.area) {
|
|
17
|
+
const roots = config.herdrRoots ?? [];
|
|
18
|
+
const home = config.home ?? homedir();
|
|
19
|
+
if (!inWorkAreaOnDisk(cwd, roots, home, disk))
|
|
20
|
+
return { ok: false, refusal: OUT_OF_SCOPE };
|
|
21
|
+
let realCwd;
|
|
22
|
+
try {
|
|
23
|
+
realCwd = disk.realpath(cwd);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return { ok: false, refusal: NOT_FOUND };
|
|
27
|
+
}
|
|
28
|
+
const real = onDiskForms(roots, home, disk.realpath);
|
|
29
|
+
return { ok: true, value: { cwd, realCwd, roots, realRoots: real.roots, home, realHome: real.home } };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The gate of both file routes. An unknown session throws the manager's 404 (`port.require`). A Codex entry and a
|
|
33
|
+
* pane out of scope are refused before the demo branch, as in the diff gate; the demo has no directories, so a demo
|
|
34
|
+
* session passes without a pane; any other session without a herdr pane is refused.
|
|
35
|
+
*/
|
|
36
|
+
export function filesSession(id, port, disk = FILES_DISK.area) {
|
|
37
|
+
const session = port.require(id);
|
|
38
|
+
if (session.engine === 'codex')
|
|
39
|
+
return { kind: 'refused', refusal: CODEX };
|
|
40
|
+
if (session.outOfScope === true)
|
|
41
|
+
return { kind: 'refused', refusal: OUT_OF_SCOPE };
|
|
42
|
+
if (port.config.demo)
|
|
43
|
+
return { kind: 'demo', session };
|
|
44
|
+
if (session.herdrKey === undefined)
|
|
45
|
+
return { kind: 'refused', refusal: NO_PANE };
|
|
46
|
+
const area = filesArea(session.cwd, port.config, disk);
|
|
47
|
+
return area.ok ? { kind: 'area', session, area: area.value } : { kind: 'refused', refusal: area.refusal };
|
|
48
|
+
}
|
package/server/src/git-status.js
CHANGED
|
@@ -201,7 +201,7 @@ const GIT_GLOBAL_OPTIONS = ['--literal-pathspecs'];
|
|
|
201
201
|
* git czyta jeszcze jako opcję globalną, więc „podkomenda” `-c` z `rest` = `['core.fsmonitor=…', …]` stałaby
|
|
202
202
|
* po osłonach i je nadpisała. Wbudowanych podkomend nie zasłoni też alias z konfiguracji repo.
|
|
203
203
|
*/
|
|
204
|
-
export const GIT_SUBCOMMANDS = ['status', 'log', 'diff', 'ls-files', 'rev-parse'];
|
|
204
|
+
export const GIT_SUBCOMMANDS = ['status', 'log', 'diff', 'ls-files', 'rev-parse', 'check-ignore'];
|
|
205
205
|
/**
|
|
206
206
|
* The two options that pin a git process to the repository of a read:
|
|
207
207
|
*
|
|
@@ -325,7 +325,8 @@ function guardedGitEnv(env) {
|
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
* Oldest git the runner starts `diff` with: `GIT_NO_LAZY_FETCH` works from git 2.44. With an older git `diff` is
|
|
328
|
-
* refused, because a lazy fetch was measured on `diff` only; `status`, `log`, `ls-files
|
|
328
|
+
* refused, because a lazy fetch was measured on `diff` only; `status`, `log`, `ls-files`, `rev-parse` and
|
|
329
|
+
* `check-ignore` still run.
|
|
329
330
|
*/
|
|
330
331
|
const MIN_GIT_VERSION = { major: 2, minor: 44 };
|
|
331
332
|
/** Read cap of `git version` and `git --exec-path` (one line each). */
|
|
@@ -92,7 +92,7 @@ export function redactAuditText(value, secrets = []) {
|
|
|
92
92
|
*/
|
|
93
93
|
export const HERDR_REFUSE_REASONS = REFUSE_REASONS;
|
|
94
94
|
/**
|
|
95
|
-
* Powody spoza drivera — do dziennika nie trafiają, bo
|
|
95
|
+
* Powody spoza drivera — do dziennika nie trafiają, bo `auditRefusal` woła wyłącznie driver.
|
|
96
96
|
*
|
|
97
97
|
* `in-flight` powstaje w blokadzie równoległych prób (`PendingInteractions`) i mówi „poczekaj,
|
|
98
98
|
* decyzja z drugiego urządzenia właśnie leci" — to nie jest awaria ścieżki cyfrowej, więc
|
|
@@ -47,15 +47,22 @@ export const HOOK_PAYLOAD_FIELDS = {
|
|
|
47
47
|
suggestions: { field: 'permission_suggestions', cli: '2.1.322' },
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* `
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
* The package base of the `channel` proof rule: the CLI release `cli` on which the precision of the channel approve
|
|
51
|
+
* button without the screen top was measured, and the releases under it the package does not cover (`excluded`).
|
|
52
|
+
* The measured contract: a late `allow` of the hook after a desk decision (after "Yes", after "No" and SIGTERM;
|
|
53
|
+
* `Bash`, `Write`) runs nothing, and a hidden subagent request runs only on its own `allow`, once (measured on the
|
|
54
|
+
* release `cli` by the consent canary, `pass` for both request kinds; `docs/dialogs.md`, "`PermissionRequest` hook
|
|
55
|
+
* behavior"). This is not a literal of the hook file but a fact about its behavior in the CLI, so the base holds
|
|
56
|
+
* without the canary file too. The version gate
|
|
57
|
+
* (`layer1/version-gate.ts`) gives `channel` to a release not above `cli` and not in `excluded`; any other release
|
|
58
|
+
* counts `screen` unless the canary file has `pass` for it and the request kind.
|
|
59
|
+
*
|
|
60
|
+
* `cli` goes up only after a canary run with `pass` for both request kinds (main thread and subagents) on the new
|
|
61
|
+
* release. In the same change every release between the old and the new `cli` without `pass` for both kinds (a
|
|
62
|
+
* `fail`, an `unmeasured` kind, no run) goes onto `excluded`, a closed list of exact releases (`docs/dialogs.md`,
|
|
63
|
+
* "Proof rule").
|
|
64
|
+
*/
|
|
65
|
+
export const CONSENT_CHANNEL_MEASURED_CLI = { cli: '2.1.330', excluded: ['2.1.327'] };
|
|
59
66
|
/**
|
|
60
67
|
* Programmatic Claude Code sessions: the environment variable the hook inherits from the CLI process, and the
|
|
61
68
|
* values at which the hook exits right after reading stdin, without a trace (no dump, `hook-seen.json`,
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* - `consent-gate.ts` — the digit gate of consent channel mode: effective mode, blocked digit, consent card without
|
|
20
20
|
* its allow button.
|
|
21
21
|
* - `screen-unavailable.ts` — the reason of a consent card without `channel` and without the approve button.
|
|
22
|
+
* - `no-hook.ts` — consent without a hook: its cause, the `no hook` and `no approve button` log lines, and
|
|
23
|
+
* whether the card of the `off` path has the approve button.
|
|
22
24
|
* - `policy/options.ts` — wybór opcji po treści etykiety: „ten jeden raz" i „zawsze" (`docs/dialogs.md`, „Rules: what must not be relaxed”).
|
|
23
25
|
* - `policy/escalation.ts` — słownik eskalacji (`docs/dialogs.md`, „Rules: what must not be relaxed”): treść, etykieta opcji, przełącznik trybu.
|
|
24
26
|
* - `policy/terminal.ts` — dialogi tylko z terminala: lista, dopasowanie, sufit treści.
|
|
@@ -93,6 +95,8 @@
|
|
|
93
95
|
* - `layer1/observe.ts` — obserwacja jednej sesji (zrzuty, pula, `ps`, sygnały z wierzchem ekranu, karty bez
|
|
94
96
|
* zrzutu) dla serwera i procesu pomiaru kanału.
|
|
95
97
|
* - `layer1/hook-list/hook-list.ts` — the session's `PermissionRequest` hooks, read-only, as evidence.
|
|
98
|
+
* - `layer1/hook-list/session-facts.ts` — the session facts without a hook dump: process, `cwd`, call `cwd`, the hook
|
|
99
|
+
* list verdict and the settings layers past `changed`, cached per process, `cwd` and episode.
|
|
96
100
|
* - `layer1/mode.ts` — tryb efektywny kanału zgód: `main` wyłącznie przy komplecie warunków (hook `ok`, oba
|
|
97
101
|
* gniazda, próg buildu apki), inaczej `shadow` z powodem; `off` do rozstrzygnięcia po starcie
|
|
98
102
|
* gniazd i po wyłączniku (do restartu); źródło trybu ze słuchaczem zmian.
|
|
@@ -175,6 +179,7 @@ export { ANSWERED_HOOK_SHIELD_MS, CLI_HOLD_MISSES, CLI_WAITING_PROBES, DECIDED_S
|
|
|
175
179
|
export { askFormOnScreen, cliDialogOnScreen } from './presence.js';
|
|
176
180
|
export { DIALOG_ROUTES, DIALOG_ROUTE_REASONS, routeAllowsDigit, routeDialog, routeHookOf, routeScreenOf, } from './router.js';
|
|
177
181
|
export { consentDigitRefused, consentModeNow, consentOnlyEvent } from './consent-gate.js';
|
|
182
|
+
export { noApproveButtonLine, noHookCause, noHookLine, offPathApprove } from './no-hook.js';
|
|
178
183
|
export { applyMultiSelectOverride, competingHook, hookMatchesPending, hookPendingFrom, olderBashHook, } from './cross-check.js';
|
|
179
184
|
export { affirmativeOption, alwaysOption } from './policy/options.js';
|
|
180
185
|
export { optionPolicy } from './policy/option-policy.js';
|
|
@@ -188,7 +193,7 @@ export { admittedHook, besideAtDecision, evaluationReqId, hookPendingFor, otherD
|
|
|
188
193
|
export { dialogShapeOf } from './decide/reasons.js';
|
|
189
194
|
export { FORM_SUBMIT_KEY, confirmFormSubmit } from './send/form-submit.js';
|
|
190
195
|
export { ASK_USER_QUESTION_TOOL, resolveOptions } from './screen/resolve.js';
|
|
191
|
-
export { parseOptions } from './screen/parse.js';
|
|
196
|
+
export { parseOptions, subagentDialogOnScreen } from './screen/parse.js';
|
|
192
197
|
export { blockVisible } from './screen/block-visible.js';
|
|
193
198
|
export { SANDBOX_NETWORK_TOOL } from './screen/kinds.js';
|
|
194
199
|
export { matchKnownDialog } from './screen/known.js';
|