agentfootprint 7.27.0 → 7.28.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.
Files changed (42) hide show
  1. package/README.md +2 -2
  2. package/dist/adapters/hosting/agentcore.js +124 -23
  3. package/dist/adapters/hosting/agentcore.js.map +1 -1
  4. package/dist/esm/adapters/hosting/agentcore.d.ts +14 -5
  5. package/dist/esm/adapters/hosting/agentcore.js +124 -23
  6. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  7. package/dist/esm/hosting/index.d.ts +9 -0
  8. package/dist/esm/hosting/index.js +8 -0
  9. package/dist/esm/hosting/index.js.map +1 -1
  10. package/dist/esm/hosting/memorySessions.d.ts +3 -0
  11. package/dist/esm/hosting/memorySessions.js +3 -0
  12. package/dist/esm/hosting/memorySessions.js.map +1 -1
  13. package/dist/esm/hosting/sqliteSessions.d.ts +211 -0
  14. package/dist/esm/hosting/sqliteSessions.js +370 -0
  15. package/dist/esm/hosting/sqliteSessions.js.map +1 -0
  16. package/dist/esm/memory/define.js.map +1 -1
  17. package/dist/esm/memory/define.types.d.ts +15 -3
  18. package/dist/esm/memory/define.types.js.map +1 -1
  19. package/dist/esm/memory/index.d.ts +11 -1
  20. package/dist/esm/memory/index.js.map +1 -1
  21. package/dist/hosting/index.js +12 -1
  22. package/dist/hosting/index.js.map +1 -1
  23. package/dist/hosting/memorySessions.js +3 -0
  24. package/dist/hosting/memorySessions.js.map +1 -1
  25. package/dist/hosting/sqliteSessions.js +376 -0
  26. package/dist/hosting/sqliteSessions.js.map +1 -0
  27. package/dist/memory/define.js.map +1 -1
  28. package/dist/memory/define.types.js.map +1 -1
  29. package/dist/memory/index.js.map +1 -1
  30. package/dist/types/adapters/hosting/agentcore.d.ts +14 -5
  31. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  32. package/dist/types/hosting/index.d.ts +9 -0
  33. package/dist/types/hosting/index.d.ts.map +1 -1
  34. package/dist/types/hosting/memorySessions.d.ts +3 -0
  35. package/dist/types/hosting/memorySessions.d.ts.map +1 -1
  36. package/dist/types/hosting/sqliteSessions.d.ts +212 -0
  37. package/dist/types/hosting/sqliteSessions.d.ts.map +1 -0
  38. package/dist/types/memory/define.types.d.ts +15 -3
  39. package/dist/types/memory/define.types.d.ts.map +1 -1
  40. package/dist/types/memory/index.d.ts +11 -1
  41. package/dist/types/memory/index.d.ts.map +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,211 @@
1
+ /**
2
+ * hosting/sqliteSessions — conversations in a file, so a restart is not an
3
+ * amnesia event.
4
+ *
5
+ * `memorySessions()` keeps conversations in a `Map` and says what that costs in
6
+ * its own docstring: restart the process and every conversation is gone. Until
7
+ * now the next step up was "bring a Redis", and the step between those two —
8
+ * *one machine, one file, nothing to install* — was a store every consumer had
9
+ * to write for themselves. This is that store.
10
+ *
11
+ * A paused run was in the same position from the other direction. `agent.run()`
12
+ * hands back a checkpoint that is documented as JSON you can keep anywhere, and
13
+ * "anywhere" was the whole of the offer: the library named a shape and left the
14
+ * keeping to you. Both halves land in the same table here, because
15
+ * {@link CheckpointEnvelope} was already a union of the two and a session store
16
+ * has no business caring which one it is holding.
17
+ *
18
+ * ── What this is, said plainly ──────────────────────────────────────────────
19
+ * **One process on one machine, writing one file.** That is the whole claim,
20
+ * and it is worth stating as a ceiling rather than leaving it to be discovered:
21
+ *
22
+ * • It survives a restart, a crash, a deploy — anything that ends the process
23
+ * and leaves the disk alone.
24
+ * • It is NOT a distributed store. Two machines do not share a session by
25
+ * both opening this file over a network filesystem, and nothing here tries
26
+ * to make that work.
27
+ * • WAL lets readers and one writer run at once, and **one writer at a time
28
+ * is the ceiling** — a second writer waits for the lock up to
29
+ * `busyTimeoutMs` and then fails loudly rather than queueing forever.
30
+ * Several processes on one box is fine at that scale; a fleet is not what
31
+ * this is.
32
+ *
33
+ * When you outgrow it you swap the one argument to `standingAgent`, which is
34
+ * the entire point of the port.
35
+ *
36
+ * ── Zero dependencies, and the version floor that buys ──────────────────────
37
+ * SQLite is *inside Node* — `node:sqlite`, no install, no native build, no
38
+ * peer dependency. The price is a version floor this package does not otherwise
39
+ * have: the module ships with Node 22.5 and newer. Rather than raise `engines`
40
+ * for one optional adapter and break every consumer on Node 20, the module is
41
+ * loaded when you actually construct a store, and its absence is refused by
42
+ * name with the version you are on and what to do about it — see
43
+ * {@link SqliteUnavailableError}. There is deliberately **no fallback to
44
+ * memory**: a store that silently forgot everything on restart is
45
+ * indistinguishable, from the outside, from a brand-new user.
46
+ *
47
+ * ── The two laws it inherits rather than re-implements ──────────────────────
48
+ * `checkEnvelope` is called on the way out AND on the way in, so an envelope
49
+ * whose `format` this runtime does not know is refused by name, and a stored
50
+ * session that is PRESENT but unreadable is refused by name too. Only a session
51
+ * that was never written hydrates as `undefined`. Validating on the way in as
52
+ * well is the cheap half of that promise: a row this store could not read back
53
+ * never gets written in the first place.
54
+ */
55
+ import type { SessionLifecycle } from './types.js';
56
+ /** One prepared statement, as this adapter calls it. */
57
+ export interface SqliteStatementLike {
58
+ run(...params: readonly unknown[]): unknown;
59
+ get(...params: readonly unknown[]): unknown;
60
+ all(...params: readonly unknown[]): unknown[];
61
+ }
62
+ /** One open database, as this adapter calls it. */
63
+ export interface SqliteDatabaseLike {
64
+ exec(sql: string): void;
65
+ prepare(sql: string): SqliteStatementLike;
66
+ close(): void;
67
+ }
68
+ /**
69
+ * The shape of `node:sqlite` this adapter needs — declared locally, the same
70
+ * way every other adapter here declares the slice of its backend it uses, so
71
+ * nothing takes a hard import on a module that does not exist on every
72
+ * supported Node.
73
+ */
74
+ export interface SqliteModuleLike {
75
+ new (path: string): SqliteDatabaseLike;
76
+ }
77
+ /** Options for {@link sqliteSessions}. */
78
+ export interface SqliteSessionsOptions {
79
+ /**
80
+ * The database file. Created if it does not exist, along with its parent
81
+ * directory — "no infrastructure" would be a thin promise if you still had to
82
+ * `mkdir` first.
83
+ *
84
+ * `':memory:'` is refused: it looks like a file, keeps nothing across a
85
+ * restart, and a store that quietly forgets is the exact failure this adapter
86
+ * exists to remove. Use `memorySessions()` when that is what you want — it
87
+ * says so in its name.
88
+ */
89
+ readonly file: string;
90
+ /**
91
+ * How long a write waits for another writer's lock before failing, in
92
+ * milliseconds. Default 5000.
93
+ *
94
+ * It fails rather than waits forever on purpose: a request hung on a lock
95
+ * looks exactly like a slow model, and the two need different fixes.
96
+ */
97
+ readonly busyTimeoutMs?: number;
98
+ /**
99
+ * @internal Test seam only — the `node:sqlite` module, injected. Lets the
100
+ * suite exercise the refusal path on a Node that HAS the module, and the
101
+ * failure paths without corrupting a real file. Not public API, not
102
+ * supported, and not a place to plug in another SQLite driver.
103
+ */
104
+ readonly _sqlite?: SqliteModuleLike;
105
+ }
106
+ /**
107
+ * A session store in a file.
108
+ *
109
+ * It is a {@link SessionLifecycle} plus the three things a real store owns
110
+ * beyond the port — closing, forgetting, and telling you what the file actually
111
+ * got — because the port deliberately asks for only two methods and leaves the
112
+ * rest to whoever implements it.
113
+ */
114
+ export interface SqliteSessions extends SessionLifecycle {
115
+ /**
116
+ * The journalling mode the file **actually has**, read back from SQLite
117
+ * rather than assumed from what was asked for.
118
+ *
119
+ * It is normally `'wal'`. It is something else when the file lives somewhere
120
+ * WAL cannot work — a network filesystem is the usual reason — and that is a
121
+ * fact worth being able to read: the store still works, with one writer *or*
122
+ * one reader at a time instead of both. A silent downgrade is the kind of
123
+ * thing that is only ever discovered under load.
124
+ */
125
+ readonly journalMode: string;
126
+ /** Forget one session. No-op if there is nothing stored for it. */
127
+ forget(sessionId: string): Promise<void>;
128
+ /**
129
+ * Close the file. Idempotent — a shutdown hook and an explicit close can
130
+ * coexist. Reading or writing afterwards refuses by name rather than
131
+ * reopening behind your back.
132
+ */
133
+ close(): void;
134
+ }
135
+ /**
136
+ * Raised when `node:sqlite` is not available in the running Node.
137
+ *
138
+ * Node 20 does not have the module at all; Node 22.5 through 22.12 have it
139
+ * behind `--experimental-sqlite`; Node 22.13+ and 23.4+ have it as-is (still
140
+ * marked experimental by Node, which is why it prints a warning on first use).
141
+ *
142
+ * The refusal names the version you are on and the three ways out, because
143
+ * "cannot find module 'node:sqlite'" out of a library's guts tells you what
144
+ * broke and nothing about what to do.
145
+ */
146
+ export declare class SqliteUnavailableError extends Error {
147
+ readonly code: "ERR_SQLITE_UNAVAILABLE";
148
+ /** The Node version this process is running. */
149
+ readonly nodeVersion: string;
150
+ constructor(nodeVersion: string, reason: string);
151
+ }
152
+ /**
153
+ * Raised when the file exists but this runtime cannot use it as a session
154
+ * store.
155
+ *
156
+ * The same law {@link UnreadableEnvelopeError} states for one stored value,
157
+ * one level up: **an unreadable store and an empty one are different facts, and
158
+ * only one of them is safe to answer with a fresh start.** A store that opened
159
+ * a corrupt file as an empty database would hand every returning user a blank
160
+ * slate and log nothing.
161
+ *
162
+ * `problem` is the fact to branch on — the three cases need different actions:
163
+ *
164
+ * - `'cannot-open'` — not a SQLite database, or not readable (permissions, a
165
+ * directory, a truncated file).
166
+ * - `'not-our-schema'` — a database whose `agent_sessions` table is somebody
167
+ * else's table of that name. Point the store at its own file.
168
+ * - `'newer-schema'` — written by a newer agentfootprint than this one. Same
169
+ * answer the envelope `format` field gives: refuse, never half-read.
170
+ */
171
+ export declare class UnreadableSessionFileError extends Error {
172
+ readonly code: "ERR_UNREADABLE_SESSION_FILE";
173
+ /** The file that was refused. */
174
+ readonly file: string;
175
+ /** Which of the three cases this is. */
176
+ readonly problem: 'cannot-open' | 'not-our-schema' | 'newer-schema';
177
+ constructor(file: string, problem: UnreadableSessionFileError['problem'], detail: string);
178
+ }
179
+ /**
180
+ * A session store in one SQLite file — the battery-included place to keep a
181
+ * conversation, or a run that stopped to ask a person something, so that a
182
+ * restart does not lose it.
183
+ *
184
+ * @throws SqliteUnavailableError when the running Node has no `node:sqlite`.
185
+ * @throws UnreadableSessionFileError when the file exists but cannot be used —
186
+ * never answered with an empty store.
187
+ *
188
+ * @example A standing agent whose conversations survive a restart
189
+ * import { standingAgent, nodeHost, sqliteSessions } from 'agentfootprint/hosting';
190
+ *
191
+ * const handle = await standingAgent({
192
+ * agent,
193
+ * sessions: sqliteSessions({ file: './sessions.db' }),
194
+ * host: nodeHost({ port: 8080 }),
195
+ * });
196
+ *
197
+ * @example Keeping a paused run yourself, without the composer
198
+ * const sessions = sqliteSessions({ file: './sessions.db' });
199
+ * const out = await agent.run({ message });
200
+ * if (isPaused(out)) {
201
+ * await sessions.persist(sessionId, toPausedEnvelope({
202
+ * checkpoint: out.checkpoint,
203
+ * conversation: agent.checkpoint()!,
204
+ * pending: { pauseData: out.pauseData },
205
+ * }));
206
+ * }
207
+ * // …a deploy later, in a new process:
208
+ * const paused = readPausedRun(await sessions.hydrate(sessionId));
209
+ * const answer = await agent.resume(paused.checkpoint, decision);
210
+ */
211
+ export declare function sqliteSessions(options: SqliteSessionsOptions): SqliteSessions;
@@ -0,0 +1,370 @@
1
+ /**
2
+ * hosting/sqliteSessions — conversations in a file, so a restart is not an
3
+ * amnesia event.
4
+ *
5
+ * `memorySessions()` keeps conversations in a `Map` and says what that costs in
6
+ * its own docstring: restart the process and every conversation is gone. Until
7
+ * now the next step up was "bring a Redis", and the step between those two —
8
+ * *one machine, one file, nothing to install* — was a store every consumer had
9
+ * to write for themselves. This is that store.
10
+ *
11
+ * A paused run was in the same position from the other direction. `agent.run()`
12
+ * hands back a checkpoint that is documented as JSON you can keep anywhere, and
13
+ * "anywhere" was the whole of the offer: the library named a shape and left the
14
+ * keeping to you. Both halves land in the same table here, because
15
+ * {@link CheckpointEnvelope} was already a union of the two and a session store
16
+ * has no business caring which one it is holding.
17
+ *
18
+ * ── What this is, said plainly ──────────────────────────────────────────────
19
+ * **One process on one machine, writing one file.** That is the whole claim,
20
+ * and it is worth stating as a ceiling rather than leaving it to be discovered:
21
+ *
22
+ * • It survives a restart, a crash, a deploy — anything that ends the process
23
+ * and leaves the disk alone.
24
+ * • It is NOT a distributed store. Two machines do not share a session by
25
+ * both opening this file over a network filesystem, and nothing here tries
26
+ * to make that work.
27
+ * • WAL lets readers and one writer run at once, and **one writer at a time
28
+ * is the ceiling** — a second writer waits for the lock up to
29
+ * `busyTimeoutMs` and then fails loudly rather than queueing forever.
30
+ * Several processes on one box is fine at that scale; a fleet is not what
31
+ * this is.
32
+ *
33
+ * When you outgrow it you swap the one argument to `standingAgent`, which is
34
+ * the entire point of the port.
35
+ *
36
+ * ── Zero dependencies, and the version floor that buys ──────────────────────
37
+ * SQLite is *inside Node* — `node:sqlite`, no install, no native build, no
38
+ * peer dependency. The price is a version floor this package does not otherwise
39
+ * have: the module ships with Node 22.5 and newer. Rather than raise `engines`
40
+ * for one optional adapter and break every consumer on Node 20, the module is
41
+ * loaded when you actually construct a store, and its absence is refused by
42
+ * name with the version you are on and what to do about it — see
43
+ * {@link SqliteUnavailableError}. There is deliberately **no fallback to
44
+ * memory**: a store that silently forgot everything on restart is
45
+ * indistinguishable, from the outside, from a brand-new user.
46
+ *
47
+ * ── The two laws it inherits rather than re-implements ──────────────────────
48
+ * `checkEnvelope` is called on the way out AND on the way in, so an envelope
49
+ * whose `format` this runtime does not know is refused by name, and a stored
50
+ * session that is PRESENT but unreadable is refused by name too. Only a session
51
+ * that was never written hydrates as `undefined`. Validating on the way in as
52
+ * well is the cheap half of that promise: a row this store could not read back
53
+ * never gets written in the first place.
54
+ */
55
+ import { checkEnvelope } from './envelope.js';
56
+ import { UnreadableEnvelopeError } from './errors.js';
57
+ import { lazyRequire } from '../lib/lazyRequire.js';
58
+ // ─── The refusals ────────────────────────────────────────────────────
59
+ /**
60
+ * Raised when `node:sqlite` is not available in the running Node.
61
+ *
62
+ * Node 20 does not have the module at all; Node 22.5 through 22.12 have it
63
+ * behind `--experimental-sqlite`; Node 22.13+ and 23.4+ have it as-is (still
64
+ * marked experimental by Node, which is why it prints a warning on first use).
65
+ *
66
+ * The refusal names the version you are on and the three ways out, because
67
+ * "cannot find module 'node:sqlite'" out of a library's guts tells you what
68
+ * broke and nothing about what to do.
69
+ */
70
+ export class SqliteUnavailableError extends Error {
71
+ code = 'ERR_SQLITE_UNAVAILABLE';
72
+ /** The Node version this process is running. */
73
+ nodeVersion;
74
+ constructor(nodeVersion, reason) {
75
+ super(`[hosting] sqliteSessions() needs Node's built-in 'node:sqlite' module, and this ` +
76
+ `process (Node ${nodeVersion}) does not have it (${reason}). ` +
77
+ `That module ships with Node 22.5 and newer: on Node 22.13+ (and 23.4+) it is ` +
78
+ `available as-is, and on Node 22.5–22.12 it is behind --experimental-sqlite. ` +
79
+ `So: upgrade Node, add that flag, or use memorySessions() — which keeps ` +
80
+ `conversations in a Map and loses them on restart, and says so in its name. ` +
81
+ `This refuses rather than falling back to memory on your behalf: a store that ` +
82
+ `silently forgot every conversation on restart looks, from the outside, exactly ` +
83
+ `like a brand-new user.`);
84
+ this.name = 'SqliteUnavailableError';
85
+ this.nodeVersion = nodeVersion;
86
+ }
87
+ }
88
+ /**
89
+ * Raised when the file exists but this runtime cannot use it as a session
90
+ * store.
91
+ *
92
+ * The same law {@link UnreadableEnvelopeError} states for one stored value,
93
+ * one level up: **an unreadable store and an empty one are different facts, and
94
+ * only one of them is safe to answer with a fresh start.** A store that opened
95
+ * a corrupt file as an empty database would hand every returning user a blank
96
+ * slate and log nothing.
97
+ *
98
+ * `problem` is the fact to branch on — the three cases need different actions:
99
+ *
100
+ * - `'cannot-open'` — not a SQLite database, or not readable (permissions, a
101
+ * directory, a truncated file).
102
+ * - `'not-our-schema'` — a database whose `agent_sessions` table is somebody
103
+ * else's table of that name. Point the store at its own file.
104
+ * - `'newer-schema'` — written by a newer agentfootprint than this one. Same
105
+ * answer the envelope `format` field gives: refuse, never half-read.
106
+ */
107
+ export class UnreadableSessionFileError extends Error {
108
+ code = 'ERR_UNREADABLE_SESSION_FILE';
109
+ /** The file that was refused. */
110
+ file;
111
+ /** Which of the three cases this is. */
112
+ problem;
113
+ constructor(file, problem, detail) {
114
+ super(`[hosting] the session store at '${file}' cannot be used: ${detail} ` +
115
+ `An unreadable store and an empty one are different facts, and only one of them ` +
116
+ `is safe to answer with a fresh start — so this refuses rather than quietly ` +
117
+ `beginning every conversation again on top of a file that already exists. ` +
118
+ (problem === 'newer-schema'
119
+ ? `A store written by a newer agentfootprint needs a runtime that knows that ` +
120
+ `schema; roll forward, or point this one at its own file.`
121
+ : problem === 'not-our-schema'
122
+ ? `Give the store a file of its own rather than sharing one with tables of ` +
123
+ `the same name.`
124
+ : `Check the path and its permissions, or move the file aside to start a ` + `new one.`));
125
+ this.name = 'UnreadableSessionFileError';
126
+ this.file = file;
127
+ this.problem = problem;
128
+ }
129
+ }
130
+ // ─── The schema ──────────────────────────────────────────────────────
131
+ /**
132
+ * What this runtime writes. Bumped only for a change an older reader could not
133
+ * survive — and an older reader meeting a newer number refuses by name rather
134
+ * than reading what it half-understands, which is the same rule the envelope's
135
+ * `format` field follows.
136
+ */
137
+ const SCHEMA_VERSION = 1;
138
+ const SESSIONS_TABLE = 'agent_sessions';
139
+ const META_TABLE = 'agent_store_meta';
140
+ /**
141
+ * `format` and `saved_at` are COLUMNS as well as fields inside the JSON, and
142
+ * that redundancy is deliberate: it makes the file answer "which sessions are
143
+ * waiting on a person, and since when?" from the `sqlite3` command line during
144
+ * an incident, without a JSON parser and without this library. A store you
145
+ * cannot inspect with the tools already on the box is a store you debug by
146
+ * guessing.
147
+ */
148
+ const SESSIONS_COLUMNS = ['session_id', 'format', 'saved_at', 'envelope'];
149
+ // ─── The store ───────────────────────────────────────────────────────
150
+ /**
151
+ * A session store in one SQLite file — the battery-included place to keep a
152
+ * conversation, or a run that stopped to ask a person something, so that a
153
+ * restart does not lose it.
154
+ *
155
+ * @throws SqliteUnavailableError when the running Node has no `node:sqlite`.
156
+ * @throws UnreadableSessionFileError when the file exists but cannot be used —
157
+ * never answered with an empty store.
158
+ *
159
+ * @example A standing agent whose conversations survive a restart
160
+ * import { standingAgent, nodeHost, sqliteSessions } from 'agentfootprint/hosting';
161
+ *
162
+ * const handle = await standingAgent({
163
+ * agent,
164
+ * sessions: sqliteSessions({ file: './sessions.db' }),
165
+ * host: nodeHost({ port: 8080 }),
166
+ * });
167
+ *
168
+ * @example Keeping a paused run yourself, without the composer
169
+ * const sessions = sqliteSessions({ file: './sessions.db' });
170
+ * const out = await agent.run({ message });
171
+ * if (isPaused(out)) {
172
+ * await sessions.persist(sessionId, toPausedEnvelope({
173
+ * checkpoint: out.checkpoint,
174
+ * conversation: agent.checkpoint()!,
175
+ * pending: { pauseData: out.pauseData },
176
+ * }));
177
+ * }
178
+ * // …a deploy later, in a new process:
179
+ * const paused = readPausedRun(await sessions.hydrate(sessionId));
180
+ * const answer = await agent.resume(paused.checkpoint, decision);
181
+ */
182
+ export function sqliteSessions(options) {
183
+ const { file, busyTimeoutMs = 5000 } = options;
184
+ if (file === ':memory:' || file.trim() === '') {
185
+ throw new TypeError(`[hosting] sqliteSessions({ file: '${file}' }) is not a durable store. ` +
186
+ `':memory:' looks like a file and keeps nothing across a restart, which is the ` +
187
+ `one thing this adapter exists to do. Use memorySessions() when an in-process ` +
188
+ `store is what you want — it says so in its name — or give this one a real path.`);
189
+ }
190
+ const DatabaseSync = options._sqlite ?? loadSqlite();
191
+ ensureParentDirectory(file);
192
+ let db;
193
+ try {
194
+ db = new DatabaseSync(file);
195
+ }
196
+ catch (err) {
197
+ throw new UnreadableSessionFileError(file, 'cannot-open', `${describe(err)}.`);
198
+ }
199
+ let journalMode;
200
+ try {
201
+ journalMode = applyPragmas(db, busyTimeoutMs);
202
+ ensureSchema(db, file);
203
+ }
204
+ catch (err) {
205
+ db.close();
206
+ if (err instanceof UnreadableSessionFileError)
207
+ throw err;
208
+ throw new UnreadableSessionFileError(file, 'cannot-open', `${describe(err)}.`);
209
+ }
210
+ const insert = db.prepare(`INSERT INTO ${SESSIONS_TABLE} (session_id, format, saved_at, envelope) VALUES (?, ?, ?, ?) ` +
211
+ `ON CONFLICT(session_id) DO UPDATE SET format = excluded.format, ` +
212
+ `saved_at = excluded.saved_at, envelope = excluded.envelope`);
213
+ const select = db.prepare(`SELECT envelope FROM ${SESSIONS_TABLE} WHERE session_id = ?`);
214
+ const remove = db.prepare(`DELETE FROM ${SESSIONS_TABLE} WHERE session_id = ?`);
215
+ let closed = false;
216
+ const open = (verb) => {
217
+ if (closed) {
218
+ throw new Error(`[hosting] the sqliteSessions store at '${file}' is closed, so it cannot ${verb}. ` +
219
+ `close() is final by design — reopening the file behind you would hide a ` +
220
+ `shutdown-ordering bug rather than surface it. Build a new store if you need ` +
221
+ `one after closing this.`);
222
+ }
223
+ };
224
+ // The three port methods are `async` so that every refusal in them arrives
225
+ // as a REJECTION. A method that returns a promise on the happy path and
226
+ // throws synchronously on the sad one is a method whose callers need two
227
+ // error handlers, and the one they forget is the one that fires at 3am.
228
+ return {
229
+ journalMode,
230
+ // eslint-disable-next-line @typescript-eslint/require-await
231
+ async hydrate(sessionId) {
232
+ open('hydrate a session');
233
+ const row = select.get(sessionId);
234
+ if (row === undefined)
235
+ return undefined;
236
+ const stored = row.envelope;
237
+ if (typeof stored !== 'string') {
238
+ // A row exists and its payload is not even text. Present, unreadable —
239
+ // and specifically NOT `undefined`.
240
+ throw new UnreadableEnvelopeError(stored, sessionId);
241
+ }
242
+ let parsed;
243
+ try {
244
+ parsed = JSON.parse(stored);
245
+ }
246
+ catch {
247
+ // Bytes written by something that was not this store. Same fact, same
248
+ // refusal: a conversation EXISTS here and this runtime cannot see it.
249
+ throw new UnreadableEnvelopeError(stored, sessionId);
250
+ }
251
+ // Validate HERE as well as in the composer, so the refusal points at the
252
+ // store that produced the bytes rather than at whoever read them next.
253
+ return checkEnvelope(parsed, sessionId);
254
+ },
255
+ // eslint-disable-next-line @typescript-eslint/require-await
256
+ async persist(sessionId, envelope) {
257
+ open('persist a session');
258
+ // Checked on the way IN as well as out: a row this store could not read
259
+ // back is a row it has no business writing.
260
+ const checked = checkEnvelope(envelope, sessionId);
261
+ insert.run(sessionId, checked.format, checked.savedAt, JSON.stringify(checked));
262
+ },
263
+ // eslint-disable-next-line @typescript-eslint/require-await
264
+ async forget(sessionId) {
265
+ open('forget a session');
266
+ remove.run(sessionId);
267
+ },
268
+ close() {
269
+ if (closed)
270
+ return;
271
+ closed = true;
272
+ db.close();
273
+ },
274
+ };
275
+ }
276
+ // ─── Internals ───────────────────────────────────────────────────────
277
+ /**
278
+ * Load `node:sqlite`, or refuse by name.
279
+ *
280
+ * `lazyRequire` keeps the specifier away from bundler static analysis, so
281
+ * importing `agentfootprint/hosting` costs nothing for the consumers — the vast
282
+ * majority — who never construct one of these.
283
+ */
284
+ function loadSqlite() {
285
+ try {
286
+ const mod = lazyRequire('node:sqlite');
287
+ if (typeof mod?.DatabaseSync !== 'function') {
288
+ throw new Error('the module loaded but has no DatabaseSync');
289
+ }
290
+ return mod.DatabaseSync;
291
+ }
292
+ catch (err) {
293
+ throw new SqliteUnavailableError(nodeVersion(), describe(err));
294
+ }
295
+ }
296
+ /** The version string, without assuming `process` exists. */
297
+ function nodeVersion() {
298
+ return typeof process !== 'undefined' && typeof process.version === 'string'
299
+ ? process.version
300
+ : 'unknown';
301
+ }
302
+ /**
303
+ * Create the file's directory if it is missing — "no infrastructure" should not
304
+ * mean "except for one `mkdir`". A failure here is left to the open call, which
305
+ * reports it with the path in the same words as every other open failure.
306
+ */
307
+ function ensureParentDirectory(file) {
308
+ try {
309
+ const { mkdirSync } = lazyRequire('node:fs');
310
+ const { dirname } = lazyRequire('node:path');
311
+ mkdirSync(dirname(file), { recursive: true });
312
+ }
313
+ catch {
314
+ /* Reported by the open below, with the path and the real reason. */
315
+ }
316
+ }
317
+ /**
318
+ * Set the file up for concurrent use and report what it actually got.
319
+ *
320
+ * `journal_mode` is the first statement executed on purpose: it is the point at
321
+ * which SQLite reads the file header, so "this is not a database" surfaces here,
322
+ * at construction, where the caller can still do something about it — rather
323
+ * than on the first request of the night.
324
+ */
325
+ function applyPragmas(db, busyTimeoutMs) {
326
+ const row = db.prepare('PRAGMA journal_mode = WAL').get();
327
+ // A pragma takes a literal, not a bound parameter, so the number is coerced
328
+ // to one before it reaches the statement rather than trusted to be one.
329
+ const waitMs = Number.isFinite(busyTimeoutMs) ? Math.max(0, Math.floor(busyTimeoutMs)) : 5000;
330
+ db.exec(`PRAGMA busy_timeout = ${waitMs}`);
331
+ // NORMAL, not FULL: with WAL that is durable across a process crash — which
332
+ // is what this store promises — and it does not pay a disk sync per turn.
333
+ // A power cut can still cost the most recent commits; a fleet-grade store is
334
+ // the answer to that, not a pragma.
335
+ db.exec('PRAGMA synchronous = NORMAL');
336
+ return typeof row?.journal_mode === 'string' ? row.journal_mode : 'unknown';
337
+ }
338
+ /** Create the two tables if they are missing, and refuse a file that is not ours. */
339
+ function ensureSchema(db, file) {
340
+ db.exec(`CREATE TABLE IF NOT EXISTS ${SESSIONS_TABLE} (` +
341
+ `session_id TEXT PRIMARY KEY, format TEXT NOT NULL, ` +
342
+ `saved_at INTEGER NOT NULL, envelope TEXT NOT NULL) STRICT`);
343
+ db.exec(`CREATE TABLE IF NOT EXISTS ${META_TABLE} (key TEXT PRIMARY KEY, value TEXT NOT NULL) STRICT`);
344
+ // `CREATE TABLE IF NOT EXISTS` succeeds against somebody else's table of the
345
+ // same name, and the failure would otherwise arrive as a confusing constraint
346
+ // error on the first write.
347
+ const columns = db.prepare(`PRAGMA table_info('${SESSIONS_TABLE}')`).all().map((c) => String(c.name));
348
+ const missing = SESSIONS_COLUMNS.filter((name) => !columns.includes(name));
349
+ if (missing.length > 0) {
350
+ throw new UnreadableSessionFileError(file, 'not-our-schema', `it has a '${SESSIONS_TABLE}' table that is not this store's ` +
351
+ `(missing ${missing.join(', ')}; found ${columns.join(', ') || 'nothing'}).`);
352
+ }
353
+ const stored = db
354
+ .prepare(`SELECT value FROM ${META_TABLE} WHERE key = 'schema_version'`)
355
+ .get();
356
+ if (stored === undefined) {
357
+ db.prepare(`INSERT INTO ${META_TABLE} (key, value) VALUES ('schema_version', ?)`).run(String(SCHEMA_VERSION));
358
+ return;
359
+ }
360
+ const found = Number(stored.value);
361
+ if (!Number.isFinite(found) || found > SCHEMA_VERSION) {
362
+ throw new UnreadableSessionFileError(file, 'newer-schema', `it was written with schema version ${String(stored.value)} and this runtime ` +
363
+ `reads version ${SCHEMA_VERSION}.`);
364
+ }
365
+ }
366
+ /** One sentence about a thrown thing, for a message that has to stay readable. */
367
+ function describe(err) {
368
+ return err instanceof Error ? err.message : String(err);
369
+ }
370
+ //# sourceMappingURL=sqliteSessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqliteSessions.js","sourceRoot":"","sources":["../../../src/hosting/sqliteSessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AA2FpD,wEAAwE;AAExE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,IAAI,GAAG,wBAAiC,CAAC;IAClD,gDAAgD;IACvC,WAAW,CAAS;IAE7B,YAAY,WAAmB,EAAE,MAAc;QAC7C,KAAK,CACH,kFAAkF;YAChF,iBAAiB,WAAW,uBAAuB,MAAM,KAAK;YAC9D,+EAA+E;YAC/E,8EAA8E;YAC9E,yEAAyE;YACzE,6EAA6E;YAC7E,+EAA+E;YAC/E,iFAAiF;YACjF,wBAAwB,CAC3B,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,6BAAsC,CAAC;IACvD,iCAAiC;IACxB,IAAI,CAAS;IACtB,wCAAwC;IAC/B,OAAO,CAAoD;IAEpE,YAAY,IAAY,EAAE,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