aicodeman 1.47.0 → 1.48.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/README.md +3 -0
- package/dist/cli-notify.d.ts +34 -0
- package/dist/cli-notify.d.ts.map +1 -0
- package/dist/cli-notify.js +100 -0
- package/dist/cli-notify.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -1
- package/dist/config/cli-registry/patterns.d.ts +1 -1
- package/dist/config/cli-registry/patterns.d.ts.map +1 -1
- package/dist/config/cli-registry/patterns.js +4 -0
- package/dist/config/cli-registry/patterns.js.map +1 -1
- package/dist/config/cli-registry/schema.d.ts +6 -0
- package/dist/config/cli-registry/schema.d.ts.map +1 -1
- package/dist/config/cli-registry/schema.js +62 -2
- package/dist/config/cli-registry/schema.js.map +1 -1
- package/dist/config/cli-registry/stock.d.ts.map +1 -1
- package/dist/config/cli-registry/stock.js +43 -26
- package/dist/config/cli-registry/stock.js.map +1 -1
- package/dist/config/cli-registry/types.d.ts +47 -17
- package/dist/config/cli-registry/types.d.ts.map +1 -1
- package/dist/config/path-probe.d.ts +6 -0
- package/dist/config/path-probe.d.ts.map +1 -1
- package/dist/config/path-probe.js +6 -0
- package/dist/config/path-probe.js.map +1 -1
- package/dist/config-backup.d.ts +1 -1
- package/dist/config-backup.d.ts.map +1 -1
- package/dist/config-backup.js +2 -0
- package/dist/config-backup.js.map +1 -1
- package/dist/custom-model-hosts.d.ts +32 -8
- package/dist/custom-model-hosts.d.ts.map +1 -1
- package/dist/custom-model-hosts.js +10 -0
- package/dist/custom-model-hosts.js.map +1 -1
- package/dist/custom-model-injection-apply.d.ts +19 -5
- package/dist/custom-model-injection-apply.d.ts.map +1 -1
- package/dist/custom-model-injection-apply.js +88 -8
- package/dist/custom-model-injection-apply.js.map +1 -1
- package/dist/custom-model-injection.d.ts +6 -0
- package/dist/custom-model-injection.d.ts.map +1 -1
- package/dist/custom-model-injection.js +92 -10
- package/dist/custom-model-injection.js.map +1 -1
- package/dist/discord-bridge.d.ts +338 -0
- package/dist/discord-bridge.d.ts.map +1 -0
- package/dist/discord-bridge.js +1256 -0
- package/dist/discord-bridge.js.map +1 -0
- package/dist/edit-history-local-source.d.ts +83 -0
- package/dist/edit-history-local-source.d.ts.map +1 -0
- package/dist/edit-history-local-source.js +198 -0
- package/dist/edit-history-local-source.js.map +1 -0
- package/dist/edit-history-parse.d.ts +114 -0
- package/dist/edit-history-parse.d.ts.map +1 -0
- package/dist/edit-history-parse.js +312 -0
- package/dist/edit-history-parse.js.map +1 -0
- package/dist/edit-history-store.d.ts +209 -0
- package/dist/edit-history-store.d.ts.map +1 -0
- package/dist/edit-history-store.js +599 -0
- package/dist/edit-history-store.js.map +1 -0
- package/dist/git-clone.d.ts +6 -1
- package/dist/git-clone.d.ts.map +1 -1
- package/dist/git-clone.js +79 -14
- package/dist/git-clone.js.map +1 -1
- package/dist/image-watcher.js +4 -4
- package/dist/image-watcher.js.map +1 -1
- package/dist/mux-interface.d.ts +10 -1
- package/dist/mux-interface.d.ts.map +1 -1
- package/dist/session-cli-registry-bridge.d.ts.map +1 -1
- package/dist/session-cli-registry-bridge.js +4 -0
- package/dist/session-cli-registry-bridge.js.map +1 -1
- package/dist/session.d.ts +70 -3
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +147 -4
- package/dist/session.js.map +1 -1
- package/dist/tmux-manager.d.ts +40 -0
- package/dist/tmux-manager.d.ts.map +1 -1
- package/dist/tmux-manager.js +62 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/types/discord.d.ts +55 -0
- package/dist/types/discord.d.ts.map +1 -0
- package/dist/types/discord.js +18 -0
- package/dist/types/discord.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/session.d.ts +13 -0
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js.map +1 -1
- package/dist/web/case-path.d.ts +2 -0
- package/dist/web/case-path.d.ts.map +1 -1
- package/dist/web/case-path.js +3 -3
- package/dist/web/case-path.js.map +1 -1
- package/dist/web/edit-history-sync.d.ts +158 -0
- package/dist/web/edit-history-sync.d.ts.map +1 -0
- package/dist/web/edit-history-sync.js +445 -0
- package/dist/web/edit-history-sync.js.map +1 -0
- package/dist/web/paste-image-gc.d.ts +6 -0
- package/dist/web/paste-image-gc.d.ts.map +1 -1
- package/dist/web/paste-image-gc.js +6 -0
- package/dist/web/paste-image-gc.js.map +1 -1
- package/dist/web/ports/session-port.d.ts +13 -0
- package/dist/web/ports/session-port.d.ts.map +1 -1
- package/dist/web/public/admin-ui.js.gz +0 -0
- package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
- package/dist/web/public/{app.fe8a6b4c.js → app.963b5ba8.js} +6 -6
- package/dist/web/public/app.963b5ba8.js.br +0 -0
- package/dist/web/public/app.963b5ba8.js.gz +0 -0
- package/dist/web/public/approvals-ui.js.gz +0 -0
- package/dist/web/public/{constants.affcdde6.js → constants.782170e1.js} +114 -25
- package/dist/web/public/constants.782170e1.js.br +0 -0
- package/dist/web/public/constants.782170e1.js.gz +0 -0
- package/dist/web/public/cron-ui.js.gz +0 -0
- package/dist/web/public/edit-history-ui.js +630 -0
- package/dist/web/public/edit-history-ui.js.br +0 -0
- package/dist/web/public/edit-history-ui.js.gz +0 -0
- package/dist/web/public/entrance-animations.js.gz +0 -0
- package/dist/web/public/git-status-ui.js.gz +0 -0
- package/dist/web/public/header-divider.eb2d2463.js.gz +0 -0
- package/dist/web/public/home-sessions.js.gz +0 -0
- package/dist/web/public/host-wake-ui.js.gz +0 -0
- package/dist/web/public/i18n.33f930d7.js +2 -0
- package/dist/web/public/i18n.33f930d7.js.br +0 -0
- package/dist/web/public/i18n.33f930d7.js.gz +0 -0
- package/dist/web/public/image-input.a5d0f8f3.js.gz +0 -0
- package/dist/web/public/index.html +160 -14
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.8bc46081.js.gz +0 -0
- package/dist/web/public/{keyboard-accessory.ff64fafc.js → keyboard-accessory.d4ec5957.js} +72 -1
- package/dist/web/public/keyboard-accessory.d4ec5957.js.br +0 -0
- package/dist/web/public/keyboard-accessory.d4ec5957.js.gz +0 -0
- package/dist/web/public/mobile-handlers.f7c3f692.js.gz +0 -0
- package/dist/web/public/mobile-ime-preview.2dbaf262.js.gz +0 -0
- package/dist/web/public/mobile-overview.js.gz +0 -0
- package/dist/web/public/mobile.5ef2ce85.css +1 -0
- package/dist/web/public/mobile.5ef2ce85.css.br +0 -0
- package/dist/web/public/mobile.5ef2ce85.css.gz +0 -0
- package/dist/web/public/notification-manager.feb82c04.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/{panels-ui.4a56ee63.js → panels-ui.b100727d.js} +2 -2
- package/dist/web/public/panels-ui.b100727d.js.br +0 -0
- package/dist/web/public/{panels-ui.4a56ee63.js.gz → panels-ui.b100727d.js.gz} +0 -0
- package/dist/web/public/ralph-panel.b350e2ef.js.gz +0 -0
- package/dist/web/public/ralph-wizard.b6c0dd19.js.gz +0 -0
- package/dist/web/public/readmymind-ui.js.gz +0 -0
- package/dist/web/public/reboot-restore-ui.js.gz +0 -0
- package/dist/web/public/{respawn-ui.d7adcf6a.js → respawn-ui.304ba0d4.js} +1 -1
- package/dist/web/public/respawn-ui.304ba0d4.js.br +0 -0
- package/dist/web/public/respawn-ui.304ba0d4.js.gz +0 -0
- package/dist/web/public/sanitize-html.e7147e76.js.gz +0 -0
- package/dist/web/public/security-notices.json +1 -21
- package/dist/web/public/session-lineage.js.gz +0 -0
- package/dist/web/public/{session-ui.426fb671.js → session-ui.5ac82f2c.js} +30 -30
- package/dist/web/public/session-ui.5ac82f2c.js.br +0 -0
- package/dist/web/public/session-ui.5ac82f2c.js.gz +0 -0
- package/dist/web/public/settings-ui.d1d4fb99.js +106 -0
- package/dist/web/public/settings-ui.d1d4fb99.js.br +0 -0
- package/dist/web/public/settings-ui.d1d4fb99.js.gz +0 -0
- package/dist/web/public/spreadsheet-preview-worker.js.gz +0 -0
- package/dist/web/public/spreadsheet-preview.75c751de.js.gz +0 -0
- package/dist/web/public/spreadsheet-xlsx-core.js.gz +0 -0
- package/dist/web/public/styles.77dc538f.css +1 -0
- package/dist/web/public/styles.77dc538f.css.br +0 -0
- package/dist/web/public/styles.77dc538f.css.gz +0 -0
- package/dist/web/public/subagent-windows.07277a58.js.gz +0 -0
- package/dist/web/public/sw.js +2 -2
- package/dist/web/public/sw.js.br +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/tab-layout-browser.2d6189f7.js.gz +0 -0
- package/dist/web/public/tab-rail-resize.b5cdceaf.js.gz +0 -0
- package/dist/web/public/terminal-keycode229-recovery.98843069.js.gz +0 -0
- package/dist/web/public/terminal-split.js.gz +0 -0
- package/dist/web/public/terminal-tile.js.gz +0 -0
- package/dist/web/public/{terminal-ui.7e787829.js → terminal-ui.d7c75ce8.js} +3 -3
- package/dist/web/public/terminal-ui.d7c75ce8.js.br +0 -0
- package/dist/web/public/terminal-ui.d7c75ce8.js.gz +0 -0
- package/dist/web/public/tile-grid.js.gz +0 -0
- package/dist/web/public/ultracode-panel.js.gz +0 -0
- package/dist/web/public/ultracode-windows.js.gz +0 -0
- package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
- package/dist/web/public/vendor/exceljs.min.js.gz +0 -0
- package/dist/web/public/vendor/fflate.min.js.gz +0 -0
- package/dist/web/public/vendor/marked.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-predictive-echo.276b11d9.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.1be42307.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.2342c37b.js.gz +0 -0
- package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
- package/dist/web/public/webview-tabs.js.gz +0 -0
- package/dist/web/public/whats-new.json +9 -8
- package/dist/web/routes/case-routes.d.ts.map +1 -1
- package/dist/web/routes/case-routes.js +104 -8
- package/dist/web/routes/case-routes.js.map +1 -1
- package/dist/web/routes/config-backup-routes.d.ts +5 -1
- package/dist/web/routes/config-backup-routes.d.ts.map +1 -1
- package/dist/web/routes/config-backup-routes.js +4 -1
- package/dist/web/routes/config-backup-routes.js.map +1 -1
- package/dist/web/routes/custom-model-routes.d.ts +7 -2
- package/dist/web/routes/custom-model-routes.d.ts.map +1 -1
- package/dist/web/routes/custom-model-routes.js +51 -6
- package/dist/web/routes/custom-model-routes.js.map +1 -1
- package/dist/web/routes/discord-routes.d.ts +25 -0
- package/dist/web/routes/discord-routes.d.ts.map +1 -0
- package/dist/web/routes/discord-routes.js +206 -0
- package/dist/web/routes/discord-routes.js.map +1 -0
- package/dist/web/routes/edit-history-routes.d.ts +43 -0
- package/dist/web/routes/edit-history-routes.d.ts.map +1 -0
- package/dist/web/routes/edit-history-routes.js +106 -0
- package/dist/web/routes/edit-history-routes.js.map +1 -0
- package/dist/web/routes/file-routes.d.ts.map +1 -1
- package/dist/web/routes/file-routes.js +62 -2
- package/dist/web/routes/file-routes.js.map +1 -1
- package/dist/web/routes/index.d.ts +2 -0
- package/dist/web/routes/index.d.ts.map +1 -1
- package/dist/web/routes/index.js +2 -0
- package/dist/web/routes/index.js.map +1 -1
- package/dist/web/routes/session-routes.d.ts +17 -0
- package/dist/web/routes/session-routes.d.ts.map +1 -1
- package/dist/web/routes/session-routes.js +87 -37
- package/dist/web/routes/session-routes.js.map +1 -1
- package/dist/web/routes/system-routes.d.ts.map +1 -1
- package/dist/web/routes/system-routes.js +1 -0
- package/dist/web/routes/system-routes.js.map +1 -1
- package/dist/web/schemas.d.ts +68 -1
- package/dist/web/schemas.d.ts.map +1 -1
- package/dist/web/schemas.js +77 -1
- package/dist/web/schemas.js.map +1 -1
- package/dist/web/sensitive-path.d.ts.map +1 -1
- package/dist/web/sensitive-path.js +15 -0
- package/dist/web/sensitive-path.js.map +1 -1
- package/dist/web/server.d.ts +43 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +219 -11
- package/dist/web/server.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/public/app.fe8a6b4c.js.br +0 -0
- package/dist/web/public/app.fe8a6b4c.js.gz +0 -0
- package/dist/web/public/constants.affcdde6.js.br +0 -0
- package/dist/web/public/constants.affcdde6.js.gz +0 -0
- package/dist/web/public/i18n.a618ef4e.js +0 -2
- package/dist/web/public/i18n.a618ef4e.js.br +0 -0
- package/dist/web/public/i18n.a618ef4e.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.ff64fafc.js.br +0 -0
- package/dist/web/public/keyboard-accessory.ff64fafc.js.gz +0 -0
- package/dist/web/public/mobile.1bbd2d67.css +0 -1
- package/dist/web/public/mobile.1bbd2d67.css.br +0 -0
- package/dist/web/public/mobile.1bbd2d67.css.gz +0 -0
- package/dist/web/public/panels-ui.4a56ee63.js.br +0 -0
- package/dist/web/public/respawn-ui.d7adcf6a.js.br +0 -0
- package/dist/web/public/respawn-ui.d7adcf6a.js.gz +0 -0
- package/dist/web/public/session-ui.426fb671.js.br +0 -0
- package/dist/web/public/session-ui.426fb671.js.gz +0 -0
- package/dist/web/public/settings-ui.a191154e.js +0 -106
- package/dist/web/public/settings-ui.a191154e.js.br +0 -0
- package/dist/web/public/settings-ui.a191154e.js.gz +0 -0
- package/dist/web/public/styles.4f0c67a0.css +0 -1
- package/dist/web/public/styles.4f0c67a0.css.br +0 -0
- package/dist/web/public/styles.4f0c67a0.css.gz +0 -0
- package/dist/web/public/terminal-ui.7e787829.js.br +0 -0
- package/dist/web/public/terminal-ui.7e787829.js.gz +0 -0
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-session edit history: the parsed edits and Bash images of one claude
|
|
3
|
+
* session, plus where in each transcript file reading stopped.
|
|
4
|
+
*
|
|
5
|
+
* Sources are the main transcript (`main`) and each subagent transcript
|
|
6
|
+
* (`subagents/agent-<id>.jsonl`). Each has a cursor:
|
|
7
|
+
* - `offset`: the next byte to read forward; always a line boundary.
|
|
8
|
+
* - `floor`: the lowest byte already parsed; > 0 while older lines are unread
|
|
9
|
+
* ("ältere laden" reads `[floor − budget, floor)`, see `olderRange`).
|
|
10
|
+
* The reader (`edit-history-local-source.ts`) reads forward from each `offset` of the
|
|
11
|
+
* current conversation, a file without one from `budget` bytes before its end, and hands the
|
|
12
|
+
* bytes to `apply`. Cuts happen only at `\n`, which never occurs inside a UTF-8 sequence, so
|
|
13
|
+
* multibyte characters split by a chunk boundary are never decoded half.
|
|
14
|
+
*
|
|
15
|
+
* A first read of a file starts `budget` bytes before its end (transcripts reach 100 MB+),
|
|
16
|
+
* drops the cut first line and leaves `floor` there. A line longer than the budget is
|
|
17
|
+
* skipped instead of blocking the cursor, reading forward (`midLine`) and backward
|
|
18
|
+
* (`floorMidLine`); the line after it (forward) or before it (backward) is read whole.
|
|
19
|
+
* That needs every chunk to be a full budget unless it reaches the file's end (forward) or
|
|
20
|
+
* start (older): a chunk with no line end then means one line longer than the budget. The
|
|
21
|
+
* caller does not hand over a chunk that a budget shared by several files cut short.
|
|
22
|
+
*
|
|
23
|
+
* A new conversation (`/clear`, resume) arrives as a new `transcriptId`: cursors and
|
|
24
|
+
* pending Bash calls start over, entries stay. Entries are capped at {@link MAX_ENTRIES}
|
|
25
|
+
* and {@link MAX_STORE_BYTES} of diff text; the oldest by time are dropped. Besides them
|
|
26
|
+
* the file holds one cursor per transcript file of the current conversation, at most
|
|
27
|
+
* {@link MAX_PENDING_BASH} unanswered Bash calls and at most {@link MAX_AGENTS} subagent labels.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ The file holds secrets: a diff carries whatever the agent wrote, keys and `.env`
|
|
30
|
+
* contents included. So, like `intents.json`, it is written 0600 via tmp+rename, bounded,
|
|
31
|
+
* deleted with the session (`remove()`; `sweep()` at startup removes files no session owns),
|
|
32
|
+
* never fed to `/api/search`, and refused by the attachment, folder and download routes through
|
|
33
|
+
* `isSensitivePath` (`web/sensitive-path.ts`). `load()` takes the file as untrusted: past
|
|
34
|
+
* {@link MAX_FILE_BYTES} it is not parsed, and every part is rebuilt under the same bounds.
|
|
35
|
+
*
|
|
36
|
+
* Persisted as JSON under `dataPath('edit-history', '<sessionId>.json')`, written debounced.
|
|
37
|
+
*
|
|
38
|
+
* Tests: `test/edit-history-store.test.ts`.
|
|
39
|
+
*
|
|
40
|
+
* @module edit-history-store
|
|
41
|
+
*/
|
|
42
|
+
import { randomBytes } from 'node:crypto';
|
|
43
|
+
import { mkdir, readdir, readFile, rename, stat, unlink, writeFile } from 'node:fs/promises';
|
|
44
|
+
import { join } from 'node:path';
|
|
45
|
+
import { dataPath } from './config/instance.js';
|
|
46
|
+
import { capHunks, MAX_HUNK_BYTES, MAX_PENDING_BASH, MAX_PENDING_COMMAND_CHARS, MAX_PENDING_FIELD_CHARS, parseClaudeEditLines, } from './edit-history-parse.js';
|
|
47
|
+
export const MAX_ENTRIES = 500;
|
|
48
|
+
/** Diff text (and paths) kept per session; see {@link entryBytes}. */
|
|
49
|
+
export const MAX_STORE_BYTES = 4 * 1024 * 1024;
|
|
50
|
+
/** Longest string kept from a subagent's `meta.json` field. */
|
|
51
|
+
export const MAX_AGENT_META_CHARS = 1024;
|
|
52
|
+
/**
|
|
53
|
+
* Subagent labels kept; past it the oldest one no entry uses is dropped. One more than
|
|
54
|
+
* {@link MAX_ENTRIES}, so besides the newest label there always is one.
|
|
55
|
+
*/
|
|
56
|
+
export const MAX_AGENTS = MAX_ENTRIES + 1;
|
|
57
|
+
/** Bytes read per file and pass (first read, forward step, "older" step). */
|
|
58
|
+
export const READ_BUDGET_BYTES = 8 * 1024 * 1024;
|
|
59
|
+
/**
|
|
60
|
+
* A store file larger than this is not parsed (starts empty). One written within the caps
|
|
61
|
+
* above stays far below it; JSON escaping at most doubles ordinary text.
|
|
62
|
+
*/
|
|
63
|
+
export const MAX_FILE_BYTES = 32 * 1024 * 1024;
|
|
64
|
+
export const MAIN_SOURCE = 'main';
|
|
65
|
+
const SAVE_DEBOUNCE_MS = 1000;
|
|
66
|
+
const FILE_VERSION = 1;
|
|
67
|
+
const NL = 0x0a;
|
|
68
|
+
/** A transcript id as the reader takes it (`<id>.jsonl`): no path separators. */
|
|
69
|
+
const TRANSCRIPT_ID = /^[A-Za-z0-9._-]+$/;
|
|
70
|
+
/**
|
|
71
|
+
* Names this process's tmp files (`<id>.json.<tag>.tmp`); any other tmp file is left over from
|
|
72
|
+
* an earlier run (`sweep`), even one whose pid this process has again (a container's pid 1).
|
|
73
|
+
*/
|
|
74
|
+
export const TMP_TAG = `${process.pid}-${randomBytes(4).toString('hex')}`;
|
|
75
|
+
function isObj(v) {
|
|
76
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
77
|
+
}
|
|
78
|
+
/** What an entry costs against {@link MAX_STORE_BYTES}: its strings and diff lines, plus a fixed overhead. */
|
|
79
|
+
export function entryBytes(e) {
|
|
80
|
+
let n = 128 + Buffer.byteLength(e.id) + Buffer.byteLength(e.path) + Buffer.byteLength(e.agentId ?? '');
|
|
81
|
+
for (const h of e.hunks)
|
|
82
|
+
for (const l of h.lines)
|
|
83
|
+
n += Buffer.byteLength(l) + 3;
|
|
84
|
+
return n;
|
|
85
|
+
}
|
|
86
|
+
function metaString(v) {
|
|
87
|
+
return typeof v === 'string' && v ? v.slice(0, MAX_AGENT_META_CHARS) : undefined;
|
|
88
|
+
}
|
|
89
|
+
/** Parse an `agent-<id>.meta.json` text; null when it is not an object. */
|
|
90
|
+
export function parseAgentMeta(text) {
|
|
91
|
+
try {
|
|
92
|
+
return agentMetaFrom(JSON.parse(text));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function isOffset(v) {
|
|
99
|
+
return Number.isSafeInteger(v) && v >= 0;
|
|
100
|
+
}
|
|
101
|
+
// The loaders below take the persisted file as untrusted: a hand-edited or damaged store
|
|
102
|
+
// loses the broken parts instead of failing every request or stalling a cursor.
|
|
103
|
+
function agentMetaFrom(raw) {
|
|
104
|
+
if (!isObj(raw))
|
|
105
|
+
return null;
|
|
106
|
+
const meta = {
|
|
107
|
+
description: metaString(raw.description) ?? '',
|
|
108
|
+
agentType: metaString(raw.agentType) ?? '',
|
|
109
|
+
};
|
|
110
|
+
const worktreePath = metaString(raw.worktreePath);
|
|
111
|
+
const worktreeBranch = metaString(raw.worktreeBranch);
|
|
112
|
+
if (worktreePath)
|
|
113
|
+
meta.worktreePath = worktreePath;
|
|
114
|
+
if (worktreeBranch)
|
|
115
|
+
meta.worktreeBranch = worktreeBranch;
|
|
116
|
+
return meta;
|
|
117
|
+
}
|
|
118
|
+
function cursorFrom(raw) {
|
|
119
|
+
if (!isObj(raw) || !isOffset(raw.offset) || !isOffset(raw.floor) || raw.floor > raw.offset)
|
|
120
|
+
return null;
|
|
121
|
+
const cursor = { offset: raw.offset, floor: raw.floor };
|
|
122
|
+
if (raw.midLine === true)
|
|
123
|
+
cursor.midLine = true;
|
|
124
|
+
if (raw.floorMidLine === true)
|
|
125
|
+
cursor.floorMidLine = true;
|
|
126
|
+
return cursor;
|
|
127
|
+
}
|
|
128
|
+
const loadedField = (v) => typeof v === 'string' && v.length <= MAX_PENDING_FIELD_CHARS;
|
|
129
|
+
function pendingBashFrom(raw) {
|
|
130
|
+
if (!isObj(raw))
|
|
131
|
+
return null;
|
|
132
|
+
const { id, ts, command, cwd, agentId } = raw;
|
|
133
|
+
if (!loadedField(id) || !Number.isFinite(ts) || typeof command !== 'string' || !loadedField(cwd))
|
|
134
|
+
return null;
|
|
135
|
+
if (agentId !== undefined && !loadedField(agentId))
|
|
136
|
+
return null;
|
|
137
|
+
const pending = { id, ts: ts, command: command.slice(0, MAX_PENDING_COMMAND_CHARS), cwd };
|
|
138
|
+
if (agentId)
|
|
139
|
+
pending.agentId = agentId;
|
|
140
|
+
return pending;
|
|
141
|
+
}
|
|
142
|
+
const ENTRY_KINDS = new Set(['code', 'image']);
|
|
143
|
+
const ENTRY_TOOLS = new Set(['Edit', 'Write', 'edit', 'bash', 'sent']);
|
|
144
|
+
const countFrom = (v) => (Number.isSafeInteger(v) && v >= 0 ? v : 0);
|
|
145
|
+
/**
|
|
146
|
+
* A loaded entry rebuilt from its known fields: unknown fields and non-string diff lines are
|
|
147
|
+
* dropped and the per-edit {@link MAX_HUNK_BYTES} is applied again; null when it is unusable.
|
|
148
|
+
*/
|
|
149
|
+
function entryFrom(raw) {
|
|
150
|
+
if (!isObj(raw) || typeof raw.id !== 'string' || !raw.id || typeof raw.path !== 'string' || !raw.path)
|
|
151
|
+
return null;
|
|
152
|
+
if (!Number.isFinite(raw.ts) || !ENTRY_KINDS.has(raw.kind) || !ENTRY_TOOLS.has(raw.tool)) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
if (!Array.isArray(raw.hunks))
|
|
156
|
+
return null;
|
|
157
|
+
const { hunks, truncated } = capHunks(raw.hunks);
|
|
158
|
+
const entry = {
|
|
159
|
+
id: raw.id,
|
|
160
|
+
ts: raw.ts,
|
|
161
|
+
path: raw.path,
|
|
162
|
+
kind: raw.kind,
|
|
163
|
+
tool: raw.tool,
|
|
164
|
+
created: raw.created === true,
|
|
165
|
+
added: countFrom(raw.added),
|
|
166
|
+
removed: countFrom(raw.removed),
|
|
167
|
+
hunks,
|
|
168
|
+
truncated: truncated || raw.truncated === true,
|
|
169
|
+
};
|
|
170
|
+
if (typeof raw.agentId === 'string' && raw.agentId)
|
|
171
|
+
entry.agentId = raw.agentId;
|
|
172
|
+
return entry;
|
|
173
|
+
}
|
|
174
|
+
export class EditHistoryStore {
|
|
175
|
+
sessionId;
|
|
176
|
+
file;
|
|
177
|
+
debounceMs;
|
|
178
|
+
transcriptId = null;
|
|
179
|
+
cursors = new Map();
|
|
180
|
+
pendingBash = [];
|
|
181
|
+
agents = new Map();
|
|
182
|
+
entries = new Map();
|
|
183
|
+
/** Sum of {@link entryBytes} over `entries`. */
|
|
184
|
+
bytes = 0;
|
|
185
|
+
saveTimer = null;
|
|
186
|
+
/** The last queued write; `remove()` waits for it. */
|
|
187
|
+
writing = null;
|
|
188
|
+
removed = false;
|
|
189
|
+
constructor(sessionId, opts = {}) {
|
|
190
|
+
this.sessionId = sessionId;
|
|
191
|
+
this.file = join(opts.dir ?? dataPath('edit-history'), `${sessionId}.json`);
|
|
192
|
+
this.debounceMs = opts.debounceMs ?? SAVE_DEBOUNCE_MS;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A store with the persisted state of `sessionId`; empty when the file is missing,
|
|
196
|
+
* unreadable or larger than {@link MAX_FILE_BYTES}.
|
|
197
|
+
*/
|
|
198
|
+
static async load(sessionId, opts = {}) {
|
|
199
|
+
const store = new EditHistoryStore(sessionId, opts);
|
|
200
|
+
let data;
|
|
201
|
+
try {
|
|
202
|
+
if ((await stat(store.file)).size > MAX_FILE_BYTES)
|
|
203
|
+
return store;
|
|
204
|
+
data = JSON.parse(await readFile(store.file, 'utf-8'));
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return store;
|
|
208
|
+
}
|
|
209
|
+
if (!isObj(data))
|
|
210
|
+
return store;
|
|
211
|
+
if (data.version !== FILE_VERSION)
|
|
212
|
+
return store;
|
|
213
|
+
const f = data;
|
|
214
|
+
// The sync builds the previous transcript's path from it (`/clear`), so only a plain id counts.
|
|
215
|
+
store.transcriptId =
|
|
216
|
+
typeof f.transcriptId === 'string' && TRANSCRIPT_ID.test(f.transcriptId) ? f.transcriptId : null;
|
|
217
|
+
// Cursors are offsets into that conversation's files; without it they mean nothing.
|
|
218
|
+
const cursors = store.transcriptId !== null && isObj(f.cursors) ? f.cursors : {};
|
|
219
|
+
for (const [k, raw] of Object.entries(cursors)) {
|
|
220
|
+
const cursor = cursorFrom(raw);
|
|
221
|
+
if (cursor)
|
|
222
|
+
store.cursors.set(k, cursor);
|
|
223
|
+
}
|
|
224
|
+
if (Array.isArray(f.pendingBash)) {
|
|
225
|
+
store.pendingBash = f.pendingBash
|
|
226
|
+
.map(pendingBashFrom)
|
|
227
|
+
.filter((p) => p !== null)
|
|
228
|
+
.slice(-MAX_PENDING_BASH);
|
|
229
|
+
}
|
|
230
|
+
if (Array.isArray(f.entries)) {
|
|
231
|
+
store.addRecords(f.entries.map(entryFrom).filter((e) => e !== null));
|
|
232
|
+
}
|
|
233
|
+
for (const [k, raw] of Object.entries(isObj(f.agents) ? f.agents : {})) {
|
|
234
|
+
const meta = k.length <= MAX_AGENT_META_CHARS ? agentMetaFrom(raw) : null;
|
|
235
|
+
if (meta)
|
|
236
|
+
store.putAgent(k, meta);
|
|
237
|
+
}
|
|
238
|
+
return store;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Delete the stored history of every session `keep` rejects, and tmp files other processes
|
|
242
|
+
* left behind (startup: a crash between removing a session's record and deleting its file,
|
|
243
|
+
* or mid-write; an older build).
|
|
244
|
+
* Returns how many sessions' files were deleted.
|
|
245
|
+
*/
|
|
246
|
+
static async sweep(keep, opts = {}) {
|
|
247
|
+
const dir = opts.dir ?? dataPath('edit-history');
|
|
248
|
+
let names;
|
|
249
|
+
try {
|
|
250
|
+
names = await readdir(dir);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
let removed = 0;
|
|
256
|
+
for (const name of names) {
|
|
257
|
+
const tmp = /\.json\.[\w-]+\.tmp$/.test(name);
|
|
258
|
+
const stale = tmp
|
|
259
|
+
? !name.endsWith(`.json.${TMP_TAG}.tmp`)
|
|
260
|
+
: name.endsWith('.json') && !keep(name.slice(0, -'.json'.length));
|
|
261
|
+
if (!stale)
|
|
262
|
+
continue;
|
|
263
|
+
await unlink(join(dir, name)).catch(() => undefined);
|
|
264
|
+
if (!tmp)
|
|
265
|
+
removed++;
|
|
266
|
+
}
|
|
267
|
+
return removed;
|
|
268
|
+
}
|
|
269
|
+
/** Delete the stored history of `sessionId` without loading it. */
|
|
270
|
+
static async delete(sessionId, opts = {}) {
|
|
271
|
+
await new EditHistoryStore(sessionId, opts).remove();
|
|
272
|
+
}
|
|
273
|
+
getTranscriptId() {
|
|
274
|
+
return this.transcriptId;
|
|
275
|
+
}
|
|
276
|
+
getCursor(source) {
|
|
277
|
+
const c = this.cursors.get(source);
|
|
278
|
+
return c ? { ...c } : undefined;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* True while any source has unread older lines that could still be shown. At a cap (no
|
|
282
|
+
* room left for another entry) an older edit would be dropped the moment it is read, so
|
|
283
|
+
* there is nothing more to load.
|
|
284
|
+
*/
|
|
285
|
+
get backfillTruncated() {
|
|
286
|
+
if (this.entries.size >= MAX_ENTRIES || this.bytes > MAX_STORE_BYTES - MAX_HUNK_BYTES)
|
|
287
|
+
return false;
|
|
288
|
+
for (const c of this.cursors.values())
|
|
289
|
+
if (c.floor > 0)
|
|
290
|
+
return true;
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
/** Entries newest first. */
|
|
294
|
+
list() {
|
|
295
|
+
return [...this.entries.values()].sort((a, b) => b.ts - a.ts);
|
|
296
|
+
}
|
|
297
|
+
get(id) {
|
|
298
|
+
return this.entries.get(id);
|
|
299
|
+
}
|
|
300
|
+
getAgents() {
|
|
301
|
+
return Object.fromEntries(this.agents);
|
|
302
|
+
}
|
|
303
|
+
hasAgentMeta(agentId) {
|
|
304
|
+
return this.agents.has(agentId);
|
|
305
|
+
}
|
|
306
|
+
/** Record a subagent's `meta.json`; ignored when it does not parse. */
|
|
307
|
+
setAgentMeta(agentId, metaText) {
|
|
308
|
+
const meta = this.removed ? null : parseAgentMeta(metaText);
|
|
309
|
+
if (!meta)
|
|
310
|
+
return;
|
|
311
|
+
this.putAgent(agentId, meta);
|
|
312
|
+
this.scheduleSave();
|
|
313
|
+
}
|
|
314
|
+
/** The next older range of `source` ("ältere laden"), or null when it is read to its start. */
|
|
315
|
+
olderRange(source, budget = READ_BUDGET_BYTES) {
|
|
316
|
+
const cursor = this.cursors.get(source);
|
|
317
|
+
if (!cursor || cursor.floor <= 0)
|
|
318
|
+
return null;
|
|
319
|
+
const offset = Math.max(0, cursor.floor - budget);
|
|
320
|
+
return { offset, len: cursor.floor - offset };
|
|
321
|
+
}
|
|
322
|
+
/** Every source with a cursor in the current conversation. */
|
|
323
|
+
knownSources() {
|
|
324
|
+
return [...this.cursors.keys()];
|
|
325
|
+
}
|
|
326
|
+
/** Sources with older lines left. */
|
|
327
|
+
sourcesWithOlder() {
|
|
328
|
+
return [...this.cursors.entries()].filter(([, c]) => c.floor > 0).map(([s]) => s);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* A source whose file is gone (a deleted subagent transcript): its cursor goes, so it no
|
|
332
|
+
* longer offers older lines. Its entries stay.
|
|
333
|
+
*/
|
|
334
|
+
dropSource(source) {
|
|
335
|
+
if (this.removed || !this.cursors.delete(source))
|
|
336
|
+
return;
|
|
337
|
+
this.scheduleSave();
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Apply a forward chunk: read from the source's cursor, or, without one, its last `budget`
|
|
341
|
+
* bytes; a full budget unless it reaches the file's end. A file that shrank below its cursor
|
|
342
|
+
* (replaced) loses the cursor and is read from its end next time. Returns new entries and
|
|
343
|
+
* Bash image candidates.
|
|
344
|
+
*/
|
|
345
|
+
apply(input) {
|
|
346
|
+
if (this.removed)
|
|
347
|
+
return { added: 0, candidates: [] };
|
|
348
|
+
const { transcriptId, source, startOffset, chunk, size } = input;
|
|
349
|
+
if (transcriptId !== this.transcriptId) {
|
|
350
|
+
this.transcriptId = transcriptId;
|
|
351
|
+
this.cursors.clear();
|
|
352
|
+
this.pendingBash = [];
|
|
353
|
+
}
|
|
354
|
+
let cursor = this.cursors.get(source);
|
|
355
|
+
if (cursor && size < cursor.offset) {
|
|
356
|
+
this.cursors.delete(source);
|
|
357
|
+
cursor = undefined;
|
|
358
|
+
}
|
|
359
|
+
if (cursor && startOffset !== cursor.offset)
|
|
360
|
+
return { added: 0, candidates: [] };
|
|
361
|
+
const atEof = startOffset + chunk.length >= size;
|
|
362
|
+
// Bytes before `from` belong to a line that started before this chunk.
|
|
363
|
+
let from = 0;
|
|
364
|
+
if (cursor ? cursor.midLine : startOffset > 0) {
|
|
365
|
+
const nl = chunk.indexOf(NL);
|
|
366
|
+
if (nl === -1) {
|
|
367
|
+
// Still inside that line: move past it unless it is the line being written. A first
|
|
368
|
+
// read began inside it, so the floor does too.
|
|
369
|
+
if (!atEof)
|
|
370
|
+
this.setCursor(source, cursor, startOffset + chunk.length, startOffset, true, true);
|
|
371
|
+
return { added: 0, candidates: [] };
|
|
372
|
+
}
|
|
373
|
+
from = nl + 1;
|
|
374
|
+
}
|
|
375
|
+
const lastNl = chunk.lastIndexOf(NL);
|
|
376
|
+
if (lastNl < from) {
|
|
377
|
+
if (from > 0) {
|
|
378
|
+
// The skipped (or cut first) line ended here; the next one is read from its start.
|
|
379
|
+
this.setCursor(source, cursor, startOffset + from, startOffset + from, false);
|
|
380
|
+
}
|
|
381
|
+
else if (!atEof && chunk.length > 0) {
|
|
382
|
+
// One line longer than the budget: skip it instead of re-reading it forever.
|
|
383
|
+
this.setCursor(source, cursor, startOffset + chunk.length, startOffset, true);
|
|
384
|
+
}
|
|
385
|
+
else if (!cursor) {
|
|
386
|
+
this.setCursor(source, undefined, startOffset, startOffset, false);
|
|
387
|
+
}
|
|
388
|
+
return { added: 0, candidates: [] };
|
|
389
|
+
}
|
|
390
|
+
const end = lastNl + 1;
|
|
391
|
+
this.setCursor(source, cursor, startOffset + end, startOffset + from, false);
|
|
392
|
+
const parsed = parseClaudeEditLines(chunk.subarray(from, end).toString('utf8'), this.pendingBash);
|
|
393
|
+
this.pendingBash = parsed.pending;
|
|
394
|
+
const added = this.addRecords(parsed.records);
|
|
395
|
+
this.scheduleSave();
|
|
396
|
+
return { added, candidates: parsed.candidates };
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Apply a chunk read at `olderRange`: a full budget unless it reaches the file's start. It
|
|
400
|
+
* ends at the floor, which is a line start, or with `floorMidLine` lies inside a line longer
|
|
401
|
+
* than the budget (its part in this chunk is dropped).
|
|
402
|
+
*/
|
|
403
|
+
applyOlder(input) {
|
|
404
|
+
const { transcriptId, source, startOffset, chunk } = input;
|
|
405
|
+
const cursor = this.removed ? undefined : this.cursors.get(source);
|
|
406
|
+
if (transcriptId !== this.transcriptId || !cursor || startOffset + chunk.length !== cursor.floor) {
|
|
407
|
+
return { added: 0, candidates: [] };
|
|
408
|
+
}
|
|
409
|
+
const none = { added: 0, candidates: [] };
|
|
410
|
+
let end = chunk.length;
|
|
411
|
+
if (cursor.floorMidLine) {
|
|
412
|
+
const lastNl = chunk.lastIndexOf(NL);
|
|
413
|
+
if (lastNl === -1 && startOffset > 0) {
|
|
414
|
+
// Still inside the long line.
|
|
415
|
+
cursor.floor = startOffset;
|
|
416
|
+
this.scheduleSave();
|
|
417
|
+
return none;
|
|
418
|
+
}
|
|
419
|
+
// The long line starts at `end`: drop its part.
|
|
420
|
+
end = lastNl + 1;
|
|
421
|
+
delete cursor.floorMidLine;
|
|
422
|
+
}
|
|
423
|
+
let from = 0;
|
|
424
|
+
if (startOffset > 0) {
|
|
425
|
+
// The newline at `end - 1` closes a line that may have started before this chunk.
|
|
426
|
+
const nl = chunk.subarray(0, end).indexOf(NL);
|
|
427
|
+
if (nl === -1 || nl === end - 1) {
|
|
428
|
+
if (end < chunk.length) {
|
|
429
|
+
// It ends where the long line starts: the next block, ending there, holds it whole.
|
|
430
|
+
cursor.floor = startOffset + end;
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
// No line starts in this chunk: it lies inside one line longer than the budget. Skip it.
|
|
434
|
+
cursor.floor = startOffset;
|
|
435
|
+
cursor.floorMidLine = true;
|
|
436
|
+
}
|
|
437
|
+
this.scheduleSave();
|
|
438
|
+
return none;
|
|
439
|
+
}
|
|
440
|
+
from = nl + 1;
|
|
441
|
+
}
|
|
442
|
+
cursor.floor = startOffset + from;
|
|
443
|
+
// Calls whose results lie in already-read newer lines cannot be paired here.
|
|
444
|
+
const parsed = parseClaudeEditLines(chunk.subarray(from, end).toString('utf8'));
|
|
445
|
+
const added = this.addRecords(parsed.records);
|
|
446
|
+
this.scheduleSave();
|
|
447
|
+
return { added, candidates: parsed.candidates };
|
|
448
|
+
}
|
|
449
|
+
/** Add Bash images whose mtime was confirmed inside their call's window. */
|
|
450
|
+
addImageEntries(images) {
|
|
451
|
+
if (this.removed)
|
|
452
|
+
return 0;
|
|
453
|
+
const records = images.map((img) => {
|
|
454
|
+
const entry = {
|
|
455
|
+
id: `${img.toolUseId}:${img.path}`,
|
|
456
|
+
ts: img.ts,
|
|
457
|
+
path: img.path,
|
|
458
|
+
kind: 'image',
|
|
459
|
+
tool: img.tool ?? 'bash',
|
|
460
|
+
created: false,
|
|
461
|
+
added: 0,
|
|
462
|
+
removed: 0,
|
|
463
|
+
hunks: [],
|
|
464
|
+
truncated: false,
|
|
465
|
+
};
|
|
466
|
+
if (img.agentId)
|
|
467
|
+
entry.agentId = img.agentId;
|
|
468
|
+
return entry;
|
|
469
|
+
});
|
|
470
|
+
const added = this.addRecords(records);
|
|
471
|
+
if (added)
|
|
472
|
+
this.scheduleSave();
|
|
473
|
+
return added;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Write pending changes, if any, and wait for a write under way (the store is dropped from
|
|
477
|
+
* memory and loaded again later). Unlike `flush()`, a store without changes writes nothing.
|
|
478
|
+
*/
|
|
479
|
+
async settle() {
|
|
480
|
+
if (this.saveTimer)
|
|
481
|
+
return this.flush();
|
|
482
|
+
await this.writing;
|
|
483
|
+
}
|
|
484
|
+
/** Write now (cancels a pending debounced write). Writes run one after another. */
|
|
485
|
+
async flush() {
|
|
486
|
+
if (this.saveTimer) {
|
|
487
|
+
clearTimeout(this.saveTimer);
|
|
488
|
+
this.saveTimer = null;
|
|
489
|
+
}
|
|
490
|
+
const run = (this.writing ?? Promise.resolve()).then(() => this.write());
|
|
491
|
+
this.writing = run.catch(() => undefined);
|
|
492
|
+
await run;
|
|
493
|
+
}
|
|
494
|
+
/** True once {@link remove} ran: the store ignores every later write. */
|
|
495
|
+
isRemoved() {
|
|
496
|
+
return this.removed;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Delete the persisted file (session deleted) and forget the content. The store takes no
|
|
500
|
+
* changes afterwards, so a read still in flight neither writes nor refills it.
|
|
501
|
+
*/
|
|
502
|
+
async remove() {
|
|
503
|
+
this.removed = true;
|
|
504
|
+
if (this.saveTimer) {
|
|
505
|
+
clearTimeout(this.saveTimer);
|
|
506
|
+
this.saveTimer = null;
|
|
507
|
+
}
|
|
508
|
+
this.entries.clear();
|
|
509
|
+
this.bytes = 0;
|
|
510
|
+
this.cursors.clear();
|
|
511
|
+
this.pendingBash = [];
|
|
512
|
+
this.agents.clear();
|
|
513
|
+
// A write already under way ends first (or sees `removed`), so it cannot rename its
|
|
514
|
+
// tmp file over the deleted store afterwards.
|
|
515
|
+
await this.writing;
|
|
516
|
+
await unlink(this.file).catch(() => undefined);
|
|
517
|
+
}
|
|
518
|
+
async write() {
|
|
519
|
+
if (this.removed)
|
|
520
|
+
return;
|
|
521
|
+
const data = {
|
|
522
|
+
version: FILE_VERSION,
|
|
523
|
+
sessionId: this.sessionId,
|
|
524
|
+
transcriptId: this.transcriptId,
|
|
525
|
+
cursors: Object.fromEntries(this.cursors),
|
|
526
|
+
pendingBash: this.pendingBash,
|
|
527
|
+
agents: Object.fromEntries(this.agents),
|
|
528
|
+
entries: this.list(),
|
|
529
|
+
};
|
|
530
|
+
const dir = join(this.file, '..');
|
|
531
|
+
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
532
|
+
// `mode` applies only to a file being created: the fresh tmp file is 0600, and the rename
|
|
533
|
+
// makes it the store, so an existing store never keeps wider bits.
|
|
534
|
+
const tmp = `${this.file}.${TMP_TAG}.tmp`;
|
|
535
|
+
await writeFile(tmp, JSON.stringify(data), { mode: 0o600 });
|
|
536
|
+
if (this.removed) {
|
|
537
|
+
await unlink(tmp).catch(() => undefined);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
await rename(tmp, this.file);
|
|
541
|
+
}
|
|
542
|
+
putAgent(agentId, meta) {
|
|
543
|
+
this.agents.delete(agentId);
|
|
544
|
+
this.agents.set(agentId, meta);
|
|
545
|
+
if (this.agents.size <= MAX_AGENTS)
|
|
546
|
+
return;
|
|
547
|
+
const used = new Set();
|
|
548
|
+
for (const e of this.entries.values())
|
|
549
|
+
if (e.agentId)
|
|
550
|
+
used.add(e.agentId);
|
|
551
|
+
for (const id of this.agents.keys()) {
|
|
552
|
+
if (this.agents.size <= MAX_AGENTS)
|
|
553
|
+
break;
|
|
554
|
+
// The newest label has no entries yet: they come with its transcript.
|
|
555
|
+
if (id !== agentId && !used.has(id))
|
|
556
|
+
this.agents.delete(id);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
setCursor(source, cursor, offset, firstFloor, midLine, firstFloorMidLine = false) {
|
|
560
|
+
const next = { offset, floor: cursor ? cursor.floor : firstFloor };
|
|
561
|
+
if (midLine)
|
|
562
|
+
next.midLine = true;
|
|
563
|
+
if (cursor ? cursor.floorMidLine : firstFloorMidLine)
|
|
564
|
+
next.floorMidLine = true;
|
|
565
|
+
this.cursors.set(source, next);
|
|
566
|
+
}
|
|
567
|
+
addRecords(records) {
|
|
568
|
+
const fresh = [];
|
|
569
|
+
for (const r of records) {
|
|
570
|
+
if (this.entries.has(r.id))
|
|
571
|
+
continue;
|
|
572
|
+
this.entries.set(r.id, r);
|
|
573
|
+
this.bytes += entryBytes(r);
|
|
574
|
+
fresh.push(r.id);
|
|
575
|
+
}
|
|
576
|
+
if (this.entries.size > MAX_ENTRIES || this.bytes > MAX_STORE_BYTES) {
|
|
577
|
+
for (const e of [...this.entries.values()].sort((a, b) => a.ts - b.ts)) {
|
|
578
|
+
if (this.entries.size <= MAX_ENTRIES && this.bytes <= MAX_STORE_BYTES)
|
|
579
|
+
break;
|
|
580
|
+
this.entries.delete(e.id);
|
|
581
|
+
this.bytes -= entryBytes(e);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
// Only what is still there counts: an "older" block past the cap adds nothing.
|
|
585
|
+
return fresh.filter((id) => this.entries.has(id)).length;
|
|
586
|
+
}
|
|
587
|
+
scheduleSave() {
|
|
588
|
+
if (this.removed || this.saveTimer)
|
|
589
|
+
return;
|
|
590
|
+
this.saveTimer = setTimeout(() => {
|
|
591
|
+
this.saveTimer = null;
|
|
592
|
+
void this.flush().catch((err) => {
|
|
593
|
+
console.warn(`[EditHistory] Save failed for session ${this.sessionId}:`, err);
|
|
594
|
+
});
|
|
595
|
+
}, this.debounceMs);
|
|
596
|
+
this.saveTimer.unref?.();
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
//# sourceMappingURL=edit-history-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-history-store.js","sourceRoot":"","sources":["../src/edit-history-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,WA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AAE,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/git-clone.d.ts
CHANGED
|
@@ -112,8 +112,13 @@ export interface GitFailure {
|
|
|
112
112
|
export interface CloneOptions {
|
|
113
113
|
/** Pre-validated operand from `parseGitRepositoryUrl`. */
|
|
114
114
|
repository: string;
|
|
115
|
-
/** Absolute destination directory. Must NOT exist
|
|
115
|
+
/** Absolute destination directory. Must NOT exist (created by git), unless `intoEmptyDir` is set. */
|
|
116
116
|
destination: string;
|
|
117
|
+
/**
|
|
118
|
+
* Clone straight into `destination` when it already exists as an EMPTY directory (the folder a user
|
|
119
|
+
* picked), instead of refusing it. A folder with anything in it, or a symlink, is still refused.
|
|
120
|
+
*/
|
|
121
|
+
intoEmptyDir?: boolean;
|
|
117
122
|
/** Optional branch or tag (`--branch <ref> --single-branch`). */
|
|
118
123
|
ref?: string;
|
|
119
124
|
/** `--depth 1`: history-less but much faster on large repos. */
|
package/dist/git-clone.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-clone.d.ts","sourceRoot":"","sources":["../src/git-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;
|
|
1
|
+
{"version":3,"file":"git-clone.d.ts","sourceRoot":"","sources":["../src/git-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAmBH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAoE,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAoE,CAAC;AAiC1G,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAC3B,OAAO,GACP,UAAU,GACV,eAAe,GACf,aAAa,GACb,kBAAkB,GAClB,uBA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