@reticlehq/server 3.1.0 → 3.2.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/SKILL.md +17 -18
- package/dist/command/cli/auth/device-flow.d.ts +2 -2
- package/dist/command/cli/cli-doctor.js +13 -1
- package/dist/command/cli/cli-flow-commands.d.ts +2 -1
- package/dist/command/cli/cli-kill.js +1 -1
- package/dist/command/cli/cli-parse.d.ts +2 -1
- package/dist/command/cli/cli-parse.js +5 -2
- package/dist/command/cli/cli-verify.js +2 -2
- package/dist/command/cli/cloud-cli.js +7 -6
- package/dist/command/cli/cloud-kit.js +2 -6
- package/dist/command/cli/config/config-discovery.d.ts +12 -0
- package/dist/command/cli/config/config-discovery.js +19 -0
- package/dist/command/cli/doctor/doctor-rows.d.ts +12 -0
- package/dist/command/cli/doctor/doctor-rows.js +12 -0
- package/dist/command/cli/drive/drive-command.js +1 -1
- package/dist/command/cli/launch/cli-launch.d.ts +10 -2
- package/dist/command/cli/launch/cli-launch.js +32 -39
- package/dist/command/cli/lifecycle/daemon-lifecycle.d.ts +33 -0
- package/dist/command/cli/lifecycle/daemon-lifecycle.js +198 -0
- package/dist/command/cli/mcp-command.js +5 -3
- package/dist/command/cli/ports/resolve/cli-port.d.ts +2 -1
- package/dist/command/cli/ports/resolve/cli-port.js +5 -1
- package/dist/command/cli/status/status-lines.d.ts +28 -0
- package/dist/command/cli/status/status-lines.js +117 -0
- package/dist/command/cli.d.ts +1 -1
- package/dist/command/cli.js +24 -177
- package/dist/command/daemon/binding/daemon-status-probe.d.ts +2 -0
- package/dist/command/daemon/binding/daemon-status-probe.js +48 -0
- package/dist/command/daemon/binding/loopback-reach.d.ts +42 -0
- package/dist/command/daemon/binding/loopback-reach.js +63 -0
- package/dist/command/daemon/daemon-resilience.d.ts +13 -1
- package/dist/command/daemon/daemon-resilience.js +12 -1
- package/dist/command/daemon/daemon.d.ts +2 -11
- package/dist/command/daemon/daemon.js +8 -11
- package/dist/command/daemon/lifetime/heartbeat.d.ts +8 -0
- package/dist/command/daemon/lifetime/heartbeat.js +10 -0
- package/dist/command/daemon/lifetime/log-cap.d.ts +68 -0
- package/dist/command/daemon/lifetime/log-cap.js +115 -0
- package/dist/command/setup/agent-notice-memory.d.ts +16 -0
- package/dist/command/setup/agent-notice-memory.js +65 -0
- package/dist/command/setup/bringup/dev-server-wait.d.ts +1 -0
- package/dist/command/setup/bringup/dev-server-wait.js +16 -0
- package/dist/command/setup/bringup/ensure-daemon.js +1 -1
- package/dist/command/setup/init/init-runtime.js +13 -1
- package/dist/command/setup/node-effects.js +1 -1
- package/dist/command/setup/probe/page-probe.js +9 -2
- package/dist/command/setup/run-setup.d.ts +25 -7
- package/dist/command/setup/run-setup.js +51 -9
- package/dist/command/setup/setup-command.js +31 -3
- package/dist/command/setup/terminal/confirm.js +2 -1
- package/dist/command/update/updater.d.ts +27 -0
- package/dist/command/update/updater.js +35 -2
- package/dist/features/crawl/crawl-tools.js +3 -1
- package/dist/features/crawl/crawl.js +2 -1
- package/dist/features/harness/drive-report.d.ts +73 -0
- package/dist/features/harness/drive-report.js +196 -0
- package/dist/features/harness/driver.js +29 -8
- package/dist/features/harness/drivers.d.ts +19 -0
- package/dist/features/harness/drivers.js +19 -0
- package/dist/features/harness/fill-values.d.ts +67 -0
- package/dist/features/harness/fill-values.js +153 -0
- package/dist/features/harness/jev-driver.d.ts +188 -0
- package/dist/features/harness/jev-driver.js +664 -0
- package/dist/features/harness/openai-driver.d.ts +46 -0
- package/dist/features/harness/openai-driver.js +197 -0
- package/dist/features/harness/platform-config.d.ts +52 -0
- package/dist/features/harness/platform-config.js +89 -0
- package/dist/features/visual/visual-tools.js +26 -2
- package/dist/index.js +60 -55
- package/dist/judgement/domain/domain-tools.js +4 -2
- package/dist/judgement/runs/verification-sync.d.ts +2 -2
- package/dist/judgement/runs/verification-sync.js +9 -2
- package/dist/language/flows/affected-tools.js +6 -3
- package/dist/language/flows/flow-replay-run.d.ts +25 -2
- package/dist/language/flows/flow-replay-run.js +73 -27
- package/dist/language/flows/flow-replay.d.ts +17 -0
- package/dist/language/flows/flow-replay.js +148 -100
- package/dist/language/flows/flow-result.d.ts +18 -1
- package/dist/language/flows/flow-result.js +18 -2
- package/dist/language/flows/flow-store-for-session.d.ts +2 -1
- package/dist/language/flows/flow-tools.js +8 -4
- package/dist/language/flows/flows.d.ts +8 -7
- package/dist/language/flows/flows.js +7 -3
- package/dist/language/flows/narrow-write.d.ts +4 -4
- package/dist/language/flows/replay.js +1 -1
- package/dist/language/flows/suite-selection.d.ts +15 -1
- package/dist/language/flows/suite-selection.js +1 -1
- package/dist/language/flows/verify-change-tools.js +7 -4
- package/dist/memory/cloud/account-state.d.ts +1 -1
- package/dist/memory/cloud/account-state.js +5 -4
- package/dist/memory/cloud/cloud-config.d.ts +9 -0
- package/dist/memory/cloud/cloud-config.js +9 -0
- package/dist/memory/cloud/cloud-sync.d.ts +7 -2
- package/dist/memory/cloud/cloud-sync.js +10 -5
- package/dist/memory/cloud/harness-config.d.ts +10 -0
- package/dist/memory/cloud/harness-config.js +58 -0
- package/dist/memory/cloud/harness-offer.d.ts +44 -0
- package/dist/memory/cloud/harness-offer.js +146 -0
- package/dist/memory/cloud/harness-switch.d.ts +11 -0
- package/dist/memory/cloud/harness-switch.js +53 -0
- package/dist/memory/cloud/sync-daemon.d.ts +22 -2
- package/dist/memory/cloud/sync-daemon.js +24 -0
- package/dist/memory/impact/impact-recorder.d.ts +8 -0
- package/dist/memory/impact/impact-recorder.js +2 -1
- package/dist/memory/impact/impact-store.d.ts +5 -0
- package/dist/memory/impact/impact-store.js +19 -0
- package/dist/memory/intent/intent-shard-store.js +2 -2
- package/dist/memory/intent/intent-shard.d.ts +12 -12
- package/dist/memory/journal/attach-journal.d.ts +11 -0
- package/dist/memory/journal/attach-journal.js +1 -1
- package/dist/memory/journal/journal-query.d.ts +35 -1
- package/dist/memory/journal/journal-query.js +46 -0
- package/dist/memory/journal/journal-recorder.d.ts +50 -2
- package/dist/memory/journal/journal-recorder.js +45 -7
- package/dist/memory/journal/on-disk/retention.d.ts +87 -2
- package/dist/memory/journal/on-disk/retention.js +177 -8
- package/dist/memory/journal/on-disk/workspace-gitignore.d.ts +9 -0
- package/dist/memory/journal/on-disk/workspace-gitignore.js +9 -2
- package/dist/memory/journal/self-observation.d.ts +3 -0
- package/dist/memory/journal/self-observation.js +67 -0
- package/dist/memory/journal/session-end.d.ts +13 -3
- package/dist/memory/journal/session-end.js +24 -4
- package/dist/memory/journal/session-journal.d.ts +115 -5
- package/dist/memory/journal/session-journal.js +479 -32
- package/dist/memory/project/artifact-root-resolver.d.ts +3 -0
- package/dist/memory/project/artifact-root-resolver.js +89 -0
- package/dist/memory/project/artifact-root.d.ts +39 -2
- package/dist/memory/project/artifact-root.js +58 -1
- package/dist/memory/project/dir/fill-value-store.d.ts +32 -0
- package/dist/memory/project/dir/fill-value-store.js +88 -0
- package/dist/memory/project/dir/reticle-dir.d.ts +14 -4
- package/dist/memory/project/dir/reticle-dir.js +11 -0
- package/dist/memory/project/fs/fs-port.d.ts +22 -1
- package/dist/memory/project/fs/fs-port.js +33 -5
- package/dist/memory/project/learned-routes.d.ts +16 -2
- package/dist/memory/project/learned-routes.js +26 -10
- package/dist/memory/project/project-for-root.d.ts +30 -0
- package/dist/memory/project/project-for-root.js +43 -0
- package/dist/memory/project/project-tools.js +10 -5
- package/dist/memory/project/session-root.d.ts +35 -6
- package/dist/memory/project/session-root.js +70 -8
- package/dist/portal/bridge/auth-failure-reason.d.ts +9 -0
- package/dist/portal/bridge/auth-failure-reason.js +15 -1
- package/dist/portal/bridge/bridge.d.ts +6 -1
- package/dist/portal/bridge/bridge.js +36 -2
- package/dist/portal/session/facts/session-replaced.d.ts +19 -0
- package/dist/portal/session/facts/session-replaced.js +22 -0
- package/dist/portal/session/no-session-diagnosis.d.ts +1 -0
- package/dist/portal/session/no-session-diagnosis.js +67 -60
- package/dist/portal/session/no-session-next-action.js +3 -2
- package/dist/portal/session/no-session-watch.js +14 -10
- package/dist/portal/session/rebind.d.ts +18 -0
- package/dist/portal/session/rebind.js +38 -0
- package/dist/portal/session/session-manager.d.ts +4 -0
- package/dist/portal/session/session-manager.js +19 -1
- package/dist/portal/session/session.d.ts +21 -10
- package/dist/portal/session/session.js +29 -42
- package/dist/status-payload.d.ts +12 -1
- package/dist/status-payload.js +4 -1
- package/dist/surface/http-server.js +3 -5
- package/dist/surface/mcp/faults/mcp-outage.d.ts +2 -1
- package/dist/surface/mcp/faults/mcp-outage.js +20 -4
- package/dist/surface/mcp/mcp-proxy.d.ts +10 -1
- package/dist/surface/mcp/mcp-proxy.js +20 -9
- package/dist/surface/mcp/mcp.d.ts +10 -1
- package/dist/surface/mcp/mcp.js +59 -29
- package/dist/surface/mcp/proxy/proxy-daemon-probe.d.ts +15 -2
- package/dist/surface/mcp/proxy/proxy-daemon-probe.js +22 -5
- package/dist/surface/mcp/proxy/proxy-log.d.ts +5 -11
- package/dist/surface/mcp/proxy/proxy-log.js +7 -22
- package/dist/surface/tools/act/act-preflight.js +6 -1
- package/dist/surface/tools/act/sequence-grade.js +13 -0
- package/dist/surface/tools/act-capsule.js +27 -1
- package/dist/surface/tools/assert/assert-verdict.js +44 -17
- package/dist/surface/tools/coverage-tools.js +5 -2
- package/dist/surface/tools/dynamic-tools.js +37 -46
- package/dist/surface/tools/error-recovery.d.ts +6 -0
- package/dist/surface/tools/error-recovery.js +15 -0
- package/dist/surface/tools/explore-tools.js +80 -7
- package/dist/surface/tools/feedback-tools.js +49 -2
- package/dist/surface/tools/first-sentence.d.ts +24 -0
- package/dist/surface/tools/first-sentence.js +0 -0
- package/dist/surface/tools/harness-explore.d.ts +125 -1
- package/dist/surface/tools/harness-explore.js +401 -15
- package/dist/surface/tools/harness-plan.d.ts +76 -0
- package/dist/surface/tools/harness-plan.js +156 -0
- package/dist/surface/tools/harness-toolset.js +12 -1
- package/dist/surface/tools/invoke-tool.js +65 -5
- package/dist/surface/tools/live-call-text.d.ts +6 -0
- package/dist/surface/tools/live-call-text.js +36 -2
- package/dist/surface/tools/observe-tools.js +55 -9
- package/dist/surface/tools/read/query-windowed.d.ts +1 -1
- package/dist/surface/tools/read/query-windowed.js +1 -1
- package/dist/surface/tools/read-tools.js +1 -2
- package/dist/surface/tools/tool-kit.d.ts +18 -3
- package/dist/surface/tools/tools-helpers.d.ts +8 -7
- package/dist/surface/tools/tools-helpers.js +11 -13
- package/dist/surface/tools/tools.js +6 -1
- package/dist/telemetry/bug-found.js +32 -2
- package/dist/telemetry/feedback-context.js +3 -3
- package/dist/telemetry/harness-drive.d.ts +6 -0
- package/dist/telemetry/harness-drive.js +39 -0
- package/dist/telemetry/mcp-connection.d.ts +14 -1
- package/dist/telemetry/mcp-connection.js +17 -2
- package/dist/telemetry/onboarding-firsts.d.ts +30 -1
- package/dist/telemetry/onboarding-firsts.js +54 -12
- package/dist/telemetry/verification-of.js +31 -3
- package/docs/agent-cheatsheet.md +7 -3
- package/docs/autodrive.md +42 -2
- package/docs/benchmarks.md +1 -1
- package/docs/capabilities.mdx +1 -1
- package/docs/cli/cloud.mdx +3 -3
- package/docs/cli/doctor.mdx +1 -0
- package/docs/cli/status.mdx +35 -20
- package/docs/cli.mdx +8 -18
- package/docs/desktop.mdx +1 -1
- package/docs/faq.mdx +1 -1
- package/docs/install-manual.mdx +1 -1
- package/docs/packages/tauri.mdx +1 -1
- package/docs/packages.mdx +1 -1
- package/docs/predicates.mdx +16 -0
- package/docs/system-map.md +6 -4
- package/docs/telemetry.md +2 -1
- package/docs/token-efficiency.md +2 -2
- package/docs/tools/overview.mdx +1 -1
- package/docs/troubleshooting.mdx +8 -2
- package/docs/usage.md +1 -1
- package/package.json +6 -6
|
@@ -22,7 +22,10 @@ export function makeSessionEnd(deps) {
|
|
|
22
22
|
// a failed flush must not block ambient persistence, and must never throw at teardown
|
|
23
23
|
}
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
// The session's own root, like the run artifact below: a churn map learned from one app is
|
|
26
|
+
// not about another, and writing it to the daemon's cwd both mixed two apps' maps together and
|
|
27
|
+
// left an `ambient.json` in a tree the user never instrumented.
|
|
28
|
+
const store = new AmbientStore(deps.fs, session.artifactRoot ?? deps.reticleRoot);
|
|
26
29
|
const persisted = await store.load();
|
|
27
30
|
// Accumulate history + what is NEW. `ownAmbientCounts` excludes the map this session was
|
|
28
31
|
// seeded from at startup; `ambientCounts` includes it, and adding that onto `persisted` wrote
|
|
@@ -81,9 +84,26 @@ export function makeSessionEnd(deps) {
|
|
|
81
84
|
// because it is precisely when a new directory has just been created, which makes this amortized
|
|
82
85
|
// rather than periodic (no timer to leak) and mirrors what RunStore already does.
|
|
83
86
|
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
+
// What makes this safe is the `live` set, NOT the order.
|
|
88
|
+
//
|
|
89
|
+
// This used to read "safe against deleting the session that just ended: pruning selects the
|
|
90
|
+
// OLDEST by mtime, and the directory written moments ago is the newest". That is true of the
|
|
91
|
+
// session that ENDED and says nothing about the ones still open — and it is not even true of
|
|
92
|
+
// the byte budget, which has no count floor and will evict the single oldest entry the moment
|
|
93
|
+
// the tier is over, however few there are.
|
|
94
|
+
//
|
|
95
|
+
// A session directory's mtime is stamped at creation and never moves again (appending to a
|
|
96
|
+
// file inside it advances the FILE's mtime), so the longest-running open session is the
|
|
97
|
+
// oldest-looking thing on disk and was the first candidate for both bounds. Passing the open
|
|
98
|
+
// ids is what actually holds. The ended session is already out of the registry by the time
|
|
99
|
+
// this runs — the bridge removes it before firing teardown — so it is eligible again, which
|
|
100
|
+
// is correct: it is finished, and its journal was flushed above.
|
|
101
|
+
// The root this session actually journalled into. Pruning the daemon's tree instead meant a
|
|
102
|
+
// per-project workspace was never swept at all, so the one place journals really accumulate
|
|
103
|
+
// was the one place retention never ran.
|
|
104
|
+
await pruneSessions(deps.fs, session.artifactRoot ?? deps.reticleRoot, {
|
|
105
|
+
live: deps.liveSessionIds?.(),
|
|
106
|
+
});
|
|
87
107
|
}
|
|
88
108
|
catch {
|
|
89
109
|
// retention is best-effort maintenance; never surface at teardown
|
|
@@ -1,5 +1,61 @@
|
|
|
1
|
-
import { type JournalAction, type ReticleEvent } from '@reticlehq/core';
|
|
1
|
+
import { type JournalAction, type JournalWriteLoss, type ReticleEvent } from '@reticlehq/core';
|
|
2
2
|
import type { FileSystemPort } from '../project/fs/fs-port.js';
|
|
3
|
+
import type { JournalReadLoss } from './journal-recorder.js';
|
|
4
|
+
/**
|
|
5
|
+
* The two ceilings a durable read is held to.
|
|
6
|
+
*
|
|
7
|
+
* Neither is a tuning number. `events.jsonl` is append-only and nothing prunes a single session's
|
|
8
|
+
* file (`pruneSessions` caps how many session DIRECTORIES survive, never how large one grows), and
|
|
9
|
+
* the session id lives in the page's sessionStorage, so a reload reconnects under the same id and
|
|
10
|
+
* builds a fresh journal over the same file with its byte cursor back at zero. That first read
|
|
11
|
+
* asked for the whole accumulated file, and V8 cannot build a string longer than 0x1fffffe8
|
|
12
|
+
* characters: `Buffer.prototype.toString` throws rather than returning a shorter one. The throw came
|
|
13
|
+
* out of the daemon as a raw exception on `reticle_assert` and `reticle_act_and_wait` — the only
|
|
14
|
+
* tools that reach this fall-through, and the only two that produce a verdict at all.
|
|
15
|
+
*
|
|
16
|
+
* `MAX_READ_BYTES` bounds ONE read. That alone bounds nothing over the life of a session: reads are
|
|
17
|
+
* incremental, so a thousand reads each well under the ceiling still accumulate every record they
|
|
18
|
+
* parsed. `MAX_RETAINED_*` bound what the parse-cache keeps, which is the quantity that actually
|
|
19
|
+
* grows with session age.
|
|
20
|
+
*
|
|
21
|
+
* The numbers, and what they are measured against:
|
|
22
|
+
*
|
|
23
|
+
* - 32 MiB is four times the ring buffer's own byte budget (`RING_BUFFER_DEFAULTS.MAX_BYTES`), so
|
|
24
|
+
* the durable half still reaches meaningfully further back than the hot cache it backs, and
|
|
25
|
+
* roughly a sixteenth of the string ceiling above (0x1fffffe8 characters, about 512 MB of
|
|
26
|
+
* ASCII) — a margin, not an order of magnitude, and enough of one.
|
|
27
|
+
* - Retention is bounded in journal BYTES and in RECORDS, because neither alone bounds memory:
|
|
28
|
+
* bytes track the file, records track the parsed objects, and an object costs several times the
|
|
29
|
+
* JSONL it came from (see the parse-cache note below). 100k records is fifty times the ring
|
|
30
|
+
* buffer's event budget, so the fall-through is still the long-memory half by a wide margin.
|
|
31
|
+
*/
|
|
32
|
+
export declare const JOURNAL_READ_LIMITS: {
|
|
33
|
+
/** What ONE read materialises as a single string. */
|
|
34
|
+
readonly MAX_READ_BYTES: number;
|
|
35
|
+
/** What the parse-cache keeps, in the journal bytes those records were parsed from. */
|
|
36
|
+
readonly MAX_RETAINED_BYTES: number;
|
|
37
|
+
/** What the parse-cache keeps, in records. Whichever bound binds first wins. */
|
|
38
|
+
readonly MAX_RETAINED_EVENTS: 100000;
|
|
39
|
+
};
|
|
40
|
+
/** Ceiling overrides. Injected so a test can drive a cut without writing 32 MiB of fixture. */
|
|
41
|
+
export interface SessionJournalOptions {
|
|
42
|
+
maxReadBytes?: number;
|
|
43
|
+
maxRetainedBytes?: number;
|
|
44
|
+
maxRetainedEvents?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Default byte budget for one serialized writer's event ledger (#986).
|
|
48
|
+
*
|
|
49
|
+
* A ledger may exceed this by one bounded truncation marker. Existing oversized files are not
|
|
50
|
+
* deleted or rewritten; they stop accepting event batches. This is a per-event-file limit, not a
|
|
51
|
+
* workspace-wide quota, and does not bound action journals or concurrent independent writers.
|
|
52
|
+
*/
|
|
53
|
+
export declare const JOURNAL_EVENT_BYTES_CAP: number;
|
|
54
|
+
/** Construction-time knobs. The cap is injected so a test can prove the bound at a few kilobytes. */
|
|
55
|
+
export interface SessionJournalOptions {
|
|
56
|
+
/** Byte ceiling for this session's event ledger. Defaults to {@link JOURNAL_EVENT_BYTES_CAP}. */
|
|
57
|
+
eventBytesCap?: number;
|
|
58
|
+
}
|
|
3
59
|
/**
|
|
4
60
|
* The durable per-session journal: append-only JSONL for events and actions, the ledger the ring
|
|
5
61
|
* buffer becomes a hot cache over. Writes are batched (the caller flushes ring-buffer windows), so a
|
|
@@ -10,15 +66,69 @@ import type { FileSystemPort } from '../project/fs/fs-port.js';
|
|
|
10
66
|
* journal stores redacted payloads; the ledger is local-only. A server-side second-pass event redactor
|
|
11
67
|
* is defense-in-depth for a later commit, not a correctness gate here.
|
|
12
68
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
69
|
+
* Event READS are BOUNDED at both ends — one read, and what the parse-cache keeps across reads.
|
|
70
|
+
* Both keep the NEWEST records and declare what they removed through `readLoss()`. Without the read
|
|
71
|
+
* ceiling a long session's file outgrew what a JavaScript string can hold and the read threw
|
|
72
|
+
* instead of answering; without the retention ceiling the cache grew for the life of the session.
|
|
73
|
+
* See `JOURNAL_READ_LIMITS` and `session-journal.lossy-conformance.test.ts`.
|
|
74
|
+
*
|
|
75
|
+
* The event ledger is also bounded on the WRITE side — see {@link JOURNAL_EVENT_BYTES_CAP} and
|
|
76
|
+
* `#closeAtCap`. Session directories are pruned by recency in `on-disk/retention.ts`; this is the
|
|
77
|
+
* per-file half of the same question, and the half a single runaway session needs. The two ceilings
|
|
78
|
+
* answer different questions and neither substitutes for the other: one stops a read from throwing,
|
|
79
|
+
* the other stops the file from growing without end.
|
|
80
|
+
*
|
|
81
|
+
* `readActions` is NOT bounded: it reads the whole action ledger as one string and would throw the
|
|
82
|
+
* same V8 string-length error on a large enough one. Left that way deliberately, and the reason is
|
|
83
|
+
* the loss channel rather than the read — the action ledger is one record per tool call, so it is
|
|
84
|
+
* orders of magnitude smaller than the event stream, and it is read by the run fold rather than by
|
|
85
|
+
* a verdict. Bounding it needs a loss report of its own: folding an action-ledger cut into
|
|
86
|
+
* `readLoss` would impeach page verdicts (through `Session.lostSince`) over a ledger that is not
|
|
87
|
+
* page evidence. Do that when an action ledger is measured large, not before.
|
|
88
|
+
*
|
|
89
|
+
* ponytail: append-per-batch. Perf ceiling: if main-thread overhead becomes visible at high event
|
|
90
|
+
* rates, coalesce batches behind a flush timer.
|
|
16
91
|
*/
|
|
17
92
|
export declare class SessionJournal {
|
|
18
93
|
#private;
|
|
19
|
-
constructor(fs: FileSystemPort, root: string, sessionId: string);
|
|
94
|
+
constructor(fs: FileSystemPort, root: string, sessionId: string, options?: SessionJournalOptions);
|
|
95
|
+
/**
|
|
96
|
+
* Append a batch, or refuse it at the byte cap and say so.
|
|
97
|
+
*
|
|
98
|
+
* A batch is accepted whole or not at all. This preserves the batch's ordering and avoids
|
|
99
|
+
* representing only part of a refused batch as successfully persisted evidence.
|
|
100
|
+
*
|
|
101
|
+
* REFUSAL, not rotation. Rotation keeps the newest evidence, which is the better policy in the
|
|
102
|
+
* abstract, but it shrinks the file — and `readEvents` tracks a byte offset into it, so a rotation
|
|
103
|
+
* resets that cursor and the reader silently returns FEWER events than it did a call earlier, with
|
|
104
|
+
* nothing to say why. Refusal keeps the file monotonic, so every cursor stays valid, no evidence
|
|
105
|
+
* already on disk is deleted, and the loss is at the end where it can be declared.
|
|
106
|
+
*/
|
|
20
107
|
appendEvents(events: readonly ReticleEvent[]): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* What this session's durable ledger lost on the WRITE side, or `undefined` if it lost nothing.
|
|
110
|
+
*
|
|
111
|
+
* The half the in-band marker cannot cover. That record carries the `t` of the last refused event
|
|
112
|
+
* and every journal-backed query filters on `t`, so a window opened after the ceiling was reached
|
|
113
|
+
* holds no marker and no events — which is indistinguishable from a complete window in which
|
|
114
|
+
* nothing happened. Named `readWriteLoss` because it is the WRITER's loss: what never reached the
|
|
115
|
+
* file, as opposed to what a bounded read declined to hand back.
|
|
116
|
+
*/
|
|
117
|
+
readWriteLoss(): Promise<JournalWriteLoss | undefined>;
|
|
21
118
|
appendAction(action: JournalAction): Promise<void>;
|
|
22
119
|
readEvents(): Promise<ReticleEvent[]>;
|
|
120
|
+
/**
|
|
121
|
+
* What these reads could not produce, or `undefined` when nothing was lost.
|
|
122
|
+
*
|
|
123
|
+
* A report beside the value, not inside it: the events keep the exact shape their consumers parse,
|
|
124
|
+
* and a caller holding a short list can still tell it apart from a complete one. `Session.lostSince`
|
|
125
|
+
* is what carries this to a verdict.
|
|
126
|
+
*/
|
|
127
|
+
readLoss(): JournalReadLoss | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The action ledger, whole — the one read here that is still UNBOUNDED, on purpose. See the class
|
|
130
|
+
* note: it holds one record per tool call rather than one per observed event, and bounding it
|
|
131
|
+
* needs a loss channel that does not impeach page verdicts.
|
|
132
|
+
*/
|
|
23
133
|
readActions(): Promise<JournalAction[]>;
|
|
24
134
|
}
|