narrarium-engine 0.1.12 → 0.1.14

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 (73) hide show
  1. package/README.md +69 -5
  2. package/dist/ai/deadlines.d.ts.map +1 -1
  3. package/dist/ai/deadlines.js +25 -8
  4. package/dist/ai/deadlines.js.map +1 -1
  5. package/dist/ai/fetch-client.d.ts +19 -1
  6. package/dist/ai/fetch-client.d.ts.map +1 -1
  7. package/dist/ai/fetch-client.js +289 -74
  8. package/dist/ai/fetch-client.js.map +1 -1
  9. package/dist/ai/types.d.ts +71 -0
  10. package/dist/ai/types.d.ts.map +1 -1
  11. package/dist/ai/types.js +19 -0
  12. package/dist/ai/types.js.map +1 -1
  13. package/dist/autopilot/calls/index.d.ts +8 -0
  14. package/dist/autopilot/calls/index.d.ts.map +1 -0
  15. package/dist/autopilot/calls/index.js +8 -0
  16. package/dist/autopilot/calls/index.js.map +1 -0
  17. package/dist/autopilot/calls/memory-store.d.ts +38 -0
  18. package/dist/autopilot/calls/memory-store.d.ts.map +1 -0
  19. package/dist/autopilot/calls/memory-store.js +279 -0
  20. package/dist/autopilot/calls/memory-store.js.map +1 -0
  21. package/dist/autopilot/calls/port.d.ts +76 -0
  22. package/dist/autopilot/calls/port.d.ts.map +1 -0
  23. package/dist/autopilot/calls/port.js +28 -0
  24. package/dist/autopilot/calls/port.js.map +1 -0
  25. package/dist/autopilot/calls/recorder.d.ts +120 -0
  26. package/dist/autopilot/calls/recorder.d.ts.map +1 -0
  27. package/dist/autopilot/calls/recorder.js +400 -0
  28. package/dist/autopilot/calls/recorder.js.map +1 -0
  29. package/dist/autopilot/calls/retention.d.ts +27 -0
  30. package/dist/autopilot/calls/retention.d.ts.map +1 -0
  31. package/dist/autopilot/calls/retention.js +33 -0
  32. package/dist/autopilot/calls/retention.js.map +1 -0
  33. package/dist/autopilot/calls/run-calls.d.ts +106 -0
  34. package/dist/autopilot/calls/run-calls.d.ts.map +1 -0
  35. package/dist/autopilot/calls/run-calls.js +251 -0
  36. package/dist/autopilot/calls/run-calls.js.map +1 -0
  37. package/dist/autopilot/calls/types.d.ts +232 -0
  38. package/dist/autopilot/calls/types.d.ts.map +1 -0
  39. package/dist/autopilot/calls/types.js +53 -0
  40. package/dist/autopilot/calls/types.js.map +1 -0
  41. package/dist/autopilot/calls/utf8.d.ts +19 -0
  42. package/dist/autopilot/calls/utf8.d.ts.map +1 -0
  43. package/dist/autopilot/calls/utf8.js +91 -0
  44. package/dist/autopilot/calls/utf8.js.map +1 -0
  45. package/dist/autopilot/errors.d.ts.map +1 -1
  46. package/dist/autopilot/errors.js +60 -1
  47. package/dist/autopilot/errors.js.map +1 -1
  48. package/dist/autopilot/runner.d.ts +10 -0
  49. package/dist/autopilot/runner.d.ts.map +1 -1
  50. package/dist/autopilot/runner.js +109 -7
  51. package/dist/autopilot/runner.js.map +1 -1
  52. package/dist/autopilot/session.d.ts +12 -0
  53. package/dist/autopilot/session.d.ts.map +1 -1
  54. package/dist/autopilot/session.js +4 -0
  55. package/dist/autopilot/session.js.map +1 -1
  56. package/dist/autopilot/types.d.ts +60 -3
  57. package/dist/autopilot/types.d.ts.map +1 -1
  58. package/dist/autopilot/types.js.map +1 -1
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +1 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/server/client.d.ts +42 -1
  64. package/dist/server/client.d.ts.map +1 -1
  65. package/dist/server/client.js +69 -1
  66. package/dist/server/client.js.map +1 -1
  67. package/dist/server/protocol.d.ts +44 -0
  68. package/dist/server/protocol.d.ts.map +1 -1
  69. package/dist/server/protocol.js +19 -0
  70. package/dist/server/protocol.js.map +1 -1
  71. package/dist/version.d.ts +1 -1
  72. package/dist/version.js +1 -1
  73. package/package.json +1 -1
@@ -0,0 +1,279 @@
1
+ import { planRetention } from "./retention.js";
2
+ import { AI_CALL_LIMITS, } from "./types.js";
3
+ const encoder = new TextEncoder();
4
+ const decoder = new TextDecoder("utf-8");
5
+ function emptyBytes() {
6
+ return { bytes: new Uint8Array(0), length: 0 };
7
+ }
8
+ function writeBytes(target, offset, data) {
9
+ const end = offset + data.length;
10
+ if (end > target.bytes.length) {
11
+ const grown = new Uint8Array(Math.max(end, target.bytes.length * 2, 64));
12
+ grown.set(target.bytes.subarray(0, target.length));
13
+ target.bytes = grown;
14
+ }
15
+ target.bytes.set(data, offset);
16
+ target.length = Math.max(target.length, end);
17
+ }
18
+ function copy(value) {
19
+ return structuredClone(value);
20
+ }
21
+ function callBytes(entry) {
22
+ let total = entry.system.length + entry.user.length;
23
+ for (const response of entry.responses.values())
24
+ total += response.length;
25
+ return total;
26
+ }
27
+ /** The order of the task list: newest first, by start and then by id. */
28
+ function taskKey(task) {
29
+ return `${task.startedAt}|${task.activityId}`;
30
+ }
31
+ /**
32
+ * The reference `AiCallStore`: every method behaves as `AiCallStore` documents it, in memory. Hosts' tests compare their store with it, and the
33
+ * recorder and the runner use it in tests. Writes out of order are kept (an `append` before its `begin` waits for it, an `end` is kept as the final
34
+ * state), and a repeated write leaves the same state. The running totals are kept per book, so `totals` and `prune` do not read the texts.
35
+ */
36
+ export class MemoryAiCallStore {
37
+ books = new Map();
38
+ calls = new Map();
39
+ refused = new Set();
40
+ orphans = new Map();
41
+ orphanEnds = new Map();
42
+ async begin({ record, system, user }) {
43
+ if (this.calls.has(record.callId) || this.refused.has(record.callId))
44
+ return;
45
+ const book = this.book(record.bookId);
46
+ const task = this.task(book, record.bookId, record.activityId);
47
+ if (task.callIds.size >= AI_CALL_LIMITS.maxCallsPerTask) {
48
+ this.refused.add(record.callId);
49
+ return;
50
+ }
51
+ const systemBytes = encoder.encode(system);
52
+ const userBytes = encoder.encode(user);
53
+ const entry = {
54
+ bookId: record.bookId,
55
+ activityId: record.activityId,
56
+ record: copy({ ...record, attempts: [], response: { text: null, partial: false } }),
57
+ system: { bytes: systemBytes, length: systemBytes.length },
58
+ user: { bytes: userBytes, length: userBytes.length },
59
+ responses: new Map(),
60
+ bytes: 0,
61
+ ended: false,
62
+ };
63
+ this.calls.set(record.callId, entry);
64
+ task.callIds.add(record.callId);
65
+ task.first ??= { task: record.task, chapter: record.chapter, scene: record.scene };
66
+ if (record.timing.startedAt < task.startedAt || task.startedAt === "")
67
+ task.startedAt = record.timing.startedAt;
68
+ book.calls += 1;
69
+ this.resize(entry);
70
+ for (const orphan of this.orphans.get(record.callId) ?? [])
71
+ this.write(entry, orphan.attempt, orphan.offset, orphan.data);
72
+ this.orphans.delete(record.callId);
73
+ const end = this.orphanEnds.get(record.callId);
74
+ if (end)
75
+ this.finalize(entry, end);
76
+ this.orphanEnds.delete(record.callId);
77
+ }
78
+ async append(callId, attempt, offset, text) {
79
+ if (!Number.isInteger(attempt) || attempt < 1)
80
+ throw new RangeError("The attempt of a response starts at 1.");
81
+ if (!Number.isInteger(offset) || offset < 0)
82
+ throw new RangeError("The offset of a text is a whole number of bytes, from 0.");
83
+ if (!text)
84
+ return;
85
+ const data = encoder.encode(text);
86
+ const entry = this.calls.get(callId);
87
+ if (entry) {
88
+ this.write(entry, attempt, offset, data);
89
+ return;
90
+ }
91
+ if (this.refused.has(callId))
92
+ return;
93
+ const waiting = this.orphans.get(callId) ?? [];
94
+ waiting.push({ attempt, offset, data });
95
+ this.orphans.set(callId, waiting);
96
+ }
97
+ async end(callId, final) {
98
+ const entry = this.calls.get(callId);
99
+ if (entry) {
100
+ this.finalize(entry, final);
101
+ return;
102
+ }
103
+ if (!this.refused.has(callId))
104
+ this.orphanEnds.set(callId, copy(final));
105
+ }
106
+ async saveTask(draft) {
107
+ const book = this.book(draft.bookId);
108
+ const task = this.task(book, draft.bookId, draft.activityId);
109
+ task.draft = copy(draft);
110
+ task.startedAt = draft.startedAt;
111
+ }
112
+ async listTasks(bookId, page) {
113
+ const book = this.books.get(bookId);
114
+ const limit = Math.min(200, Math.max(1, Math.floor(page.limit)));
115
+ if (!book)
116
+ return { tasks: [], next: null };
117
+ let listed = [...book.tasks.values()].filter((task) => task.draft !== null || task.callIds.size > 0);
118
+ listed.sort((left, right) => (taskKey(left) < taskKey(right) ? 1 : taskKey(left) > taskKey(right) ? -1 : 0));
119
+ if (page.before !== undefined)
120
+ listed = listed.filter((task) => taskKey(task) < page.before);
121
+ const shown = listed.slice(0, limit);
122
+ return {
123
+ tasks: shown.map((task) => this.header(task)),
124
+ next: shown.length < listed.length && shown.length > 0 ? taskKey(shown[shown.length - 1]) : null,
125
+ };
126
+ }
127
+ async readTask(bookId, activityId) {
128
+ const task = this.books.get(bookId)?.tasks.get(activityId);
129
+ if (!task || (task.draft === null && task.callIds.size === 0))
130
+ return null;
131
+ const calls = [...task.callIds]
132
+ .map((callId) => this.calls.get(callId)?.record)
133
+ .filter((record) => record !== undefined)
134
+ .sort((left, right) => left.seq - right.seq)
135
+ .map((record) => copy(record));
136
+ return { header: this.header(task), calls };
137
+ }
138
+ async readText(bookId, callId, field, from, attempt) {
139
+ const entry = this.calls.get(callId);
140
+ if (!entry || entry.bookId !== bookId)
141
+ return null;
142
+ const buffer = this.bufferOf(entry, field, attempt);
143
+ const size = buffer.length;
144
+ let start = Math.min(Math.max(0, Math.floor(from)), size);
145
+ while (start > 0 && start < size && (buffer.bytes[start] & 0xc0) === 0x80)
146
+ start -= 1;
147
+ const text = decoder.decode(buffer.bytes.subarray(start, size));
148
+ return { text, from: start, next: size, size, complete: entry.ended };
149
+ }
150
+ async keep(bookId, activityId, pinned) {
151
+ const task = this.task(this.book(bookId), bookId, activityId);
152
+ task.pinned = pinned;
153
+ }
154
+ async deleteBook(bookId) {
155
+ const book = this.books.get(bookId);
156
+ if (!book)
157
+ return;
158
+ for (const task of book.tasks.values())
159
+ for (const callId of task.callIds)
160
+ this.calls.delete(callId);
161
+ this.books.delete(bookId);
162
+ }
163
+ async prune(bookId, budget) {
164
+ const book = this.book(bookId);
165
+ const tasks = [...book.tasks.values()];
166
+ const plan = planRetention(tasks.map((task) => ({ activityId: task.activityId, bytes: task.bytes, pinned: task.pinned, running: (task.draft?.status ?? "running") === "running", startedAt: task.startedAt })), budget);
167
+ for (const activityId of plan.drop)
168
+ this.drop(book, activityId);
169
+ return { dropped: plan.drop, bytes: book.bytes, pinnedTasks: plan.pinnedTasks, pinnedBytes: plan.pinnedBytes, overBudget: plan.overBudget };
170
+ }
171
+ async totals(bookId) {
172
+ const book = this.books.get(bookId);
173
+ if (!book)
174
+ return { bytes: 0, tasks: 0, calls: 0, pinnedTasks: 0, pinnedBytes: 0 };
175
+ let pinnedTasks = 0;
176
+ let pinnedBytes = 0;
177
+ let tasks = 0;
178
+ for (const task of book.tasks.values()) {
179
+ if (task.draft === null && task.callIds.size === 0)
180
+ continue;
181
+ tasks += 1;
182
+ if (!task.pinned)
183
+ continue;
184
+ pinnedTasks += 1;
185
+ pinnedBytes += task.bytes;
186
+ }
187
+ return { bytes: book.bytes, tasks, calls: book.calls, pinnedTasks, pinnedBytes };
188
+ }
189
+ book(bookId) {
190
+ let book = this.books.get(bookId);
191
+ if (!book) {
192
+ book = { tasks: new Map(), bytes: 0, calls: 0 };
193
+ this.books.set(bookId, book);
194
+ }
195
+ return book;
196
+ }
197
+ task(book, bookId, activityId) {
198
+ let task = book.tasks.get(activityId);
199
+ if (!task) {
200
+ task = { bookId, activityId, draft: null, pinned: false, callIds: new Set(), bytes: 0, startedAt: "", first: null };
201
+ book.tasks.set(activityId, task);
202
+ }
203
+ return task;
204
+ }
205
+ header(task) {
206
+ if (task.draft)
207
+ return { ...task.draft, calls: task.callIds.size, bytes: task.bytes, pinned: task.pinned };
208
+ return {
209
+ bookId: task.bookId,
210
+ activityId: task.activityId,
211
+ title: "",
212
+ kind: task.first?.task ?? "plan",
213
+ chapter: task.first?.chapter ?? null,
214
+ scene: task.first?.scene ?? null,
215
+ status: "running",
216
+ startedAt: task.startedAt,
217
+ endedAt: null,
218
+ calls: task.callIds.size,
219
+ bytes: task.bytes,
220
+ pinned: task.pinned,
221
+ };
222
+ }
223
+ bufferOf(entry, field, attempt) {
224
+ if (field === "system")
225
+ return entry.system;
226
+ if (field === "user")
227
+ return entry.user;
228
+ if (attempt !== undefined)
229
+ return entry.responses.get(attempt) ?? emptyBytes();
230
+ let chosen = emptyBytes();
231
+ let chosenNumber = 0;
232
+ for (const [number, buffer] of entry.responses) {
233
+ if (buffer.length > 0 && number > chosenNumber) {
234
+ chosen = buffer;
235
+ chosenNumber = number;
236
+ }
237
+ }
238
+ return chosen;
239
+ }
240
+ write(entry, attempt, offset, data) {
241
+ let buffer = entry.responses.get(attempt);
242
+ if (!buffer) {
243
+ buffer = emptyBytes();
244
+ entry.responses.set(attempt, buffer);
245
+ }
246
+ writeBytes(buffer, offset, data);
247
+ this.resize(entry);
248
+ }
249
+ finalize(entry, final) {
250
+ entry.record = copy({ ...entry.record, status: final.status, response: final.response, attempts: final.attempts, timing: final.timing, storedBytes: final.storedBytes, dropped: final.dropped });
251
+ entry.ended = true;
252
+ }
253
+ /** Brings the totals of the call, its task and its book up to the bytes the call keeps now. */
254
+ resize(entry) {
255
+ const book = this.books.get(entry.bookId);
256
+ const task = book?.tasks.get(entry.activityId);
257
+ if (!book || !task)
258
+ return;
259
+ const bytes = callBytes(entry);
260
+ const delta = bytes - entry.bytes;
261
+ entry.bytes = bytes;
262
+ task.bytes += delta;
263
+ book.bytes += delta;
264
+ }
265
+ drop(book, activityId) {
266
+ const task = book.tasks.get(activityId);
267
+ if (!task)
268
+ return;
269
+ for (const callId of task.callIds) {
270
+ const entry = this.calls.get(callId);
271
+ if (entry)
272
+ book.calls -= 1;
273
+ this.calls.delete(callId);
274
+ }
275
+ book.bytes -= task.bytes;
276
+ book.tasks.delete(activityId);
277
+ }
278
+ }
279
+ //# sourceMappingURL=memory-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../../src/autopilot/calls/memory-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,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CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO;QAC3B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAClC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC;IACtB,CAAC;IAEO,IAAI,CAAC,IAAe,EAAE,UAAkB;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrC,IAAI,KAAK;gBAAE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,76 @@
1
+ import type { AiCallBegin, AiCallEnd, AiCallField, AiCallPruneResult, AiCallTask, AiCallTaskDraft, AiCallTaskPage, AiCallTextChunk, AiCallTotals } from "./types.js";
2
+ /**
3
+ * The store of the AI call records, implemented by each host: the browser (IndexedDB, fenced by the account) and a personal server (its files,
4
+ * outside git, trashed with its book). The engine's recorder writes through it; the pages read through it. The memory store
5
+ * (`MemoryAiCallStore`) is the reference: a host's tests compare it with the host.
6
+ *
7
+ * Rules every host follows:
8
+ * - Calls are identified by `callId` (`aiCallIdOf`), unique on the device or the server. A task is identified by `bookId` and `activityId`.
9
+ * - Offsets and sizes are in bytes of UTF-8. A text is always written as whole characters; `readText` answers from a character boundary.
10
+ * - Idempotent: a call that repeats a write (the same `begin`, `append` of the same bytes at the same offset, the same `end`, `keep`) leaves the
11
+ * store as one call left it. Out of order: the calls may arrive in any order. An `append` that arrives before its `begin` is kept until the
12
+ * call begins; an `end` before the appends is kept as the final state; an `append` after the `end` is still kept (its bytes are the text).
13
+ * A `saveTask` or `keep` for a task that holds no call yet creates it. A `begin` for a call already begun keeps the first one.
14
+ * - Atomic: each method changes the store as a whole or not at all. A method that fails leaves the store as it was, and the caller may repeat it.
15
+ * - Best effort: the recorder never waits for a write before it goes on, and reports the first failure of a run once. A host reports a failure
16
+ * by throwing it; a run is never stopped by it.
17
+ * - A host short of disk (under `AI_CALL_BUDGETS.minFreeDiskBytes`, or a quota error from the browser) throws `AiCallDiskFullError` (or the
18
+ * browser's `QuotaExceededError`) and keeps what it has. It never deletes a pinned task to make room.
19
+ * - Redaction: the strings the recorder gives are already redacted. A host may redact again, but it never stores a key, a header or a URL it was not given.
20
+ * - A `begin` past the `maxCallsPerTask` call of its task is ignored: that call is not kept.
21
+ */
22
+ /** A host that is short of disk refuses a write with this error: the store keeps what it has and the recorder reports it once per run. */
23
+ export declare class AiCallDiskFullError extends Error {
24
+ constructor(message?: string);
25
+ }
26
+ export interface AiCallStore {
27
+ /**
28
+ * Starts a call: its record, its system and user texts. Creates the call's task when it has none yet (with the header the writer saves later).
29
+ * Idempotent by `callId`: a second `begin` of a call is ignored.
30
+ */
31
+ begin(begin: AiCallBegin): Promise<void>;
32
+ /**
33
+ * Writes `text` into the response of the call's provider attempt `attempt` (from 1), at byte `offset` of that response. The bytes at
34
+ * `[offset, offset + length)` become `text`; bytes that are already there with the same content are left as they are. Writes may come in any
35
+ * order: the response is the bytes at each offset. Empty text is a no-op.
36
+ */
37
+ append(callId: string, attempt: number, offset: number, text: string): Promise<void>;
38
+ /**
39
+ * Ends a call with its final state: status, times, attempts, the response's size, `dropped`. It replaces the call's state (the texts stay).
40
+ * Idempotent: the last `end` of a call is the state it keeps.
41
+ */
42
+ end(callId: string, final: AiCallEnd): Promise<void>;
43
+ /**
44
+ * Writes the header of a task (its title, kind, status, times). Creates the task when it has no calls yet. The header's `pinned`, `calls`
45
+ * and `bytes` are kept by the store: a draft does not carry them.
46
+ */
47
+ saveTask(draft: AiCallTaskDraft): Promise<void>;
48
+ /**
49
+ * The task headers of a book, newest first, `limit` at a time (at most 200). `before` is the `next` of the previous page; omit it for the first.
50
+ * A task with no header (only calls) is listed with the title, kind and times of its first call, and status `running` until its header lands.
51
+ */
52
+ listTasks(bookId: string, page: {
53
+ before?: string;
54
+ limit: number;
55
+ }): Promise<AiCallTaskPage>;
56
+ /** A task with its calls in order of `seq`, or null when the book holds no such task. */
57
+ readTask(bookId: string, activityId: string): Promise<AiCallTask | null>;
58
+ /**
59
+ * The kept text of a call's field from byte `from`, to its end. `attempt` is the response's attempt (from 1; for a response, the last one
60
+ * with text when it is omitted; ignored for the system and the user). `from` rounds down to a character boundary: the answer's `from` says where
61
+ * the text starts. Null when the call is not kept.
62
+ */
63
+ readText(bookId: string, callId: string, field: AiCallField, from: number, attempt?: number): Promise<AiCallTextChunk | null>;
64
+ /** Pins (`true`) or unpins a task: a pinned task is never dropped by `prune`, but it counts against the budget. */
65
+ keep(bookId: string, activityId: string, pinned: boolean): Promise<void>;
66
+ /** Removes every call and task of the book. A pinned task goes too: this is the author's choice. */
67
+ deleteBook(bookId: string): Promise<void>;
68
+ /**
69
+ * Drops whole tasks, oldest first, until the book keeps at most `budget` bytes. Pinned tasks and the running task are never dropped. It is the
70
+ * retention policy of `planRetention`; a host calls it after each task.
71
+ */
72
+ prune(bookId: string, budget: number): Promise<AiCallPruneResult>;
73
+ /** What the book keeps: its bytes, tasks and calls, and what its pinned tasks keep. Answered from running totals, not by reading the texts. */
74
+ totals(bookId: string): Promise<AiCallTotals>;
75
+ }
76
+ //# sourceMappingURL=port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../../src/autopilot/calls/port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAErK;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0IAA0I;AAC1I,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,SAA2E;CAI/F;AAED,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErF;;;OAGG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE7F,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAEzE;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IAE9H,mHAAmH;IACnH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzE,oGAAoG;IACpG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAElE,+IAA+I;IAC/I,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC/C"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The store of the AI call records, implemented by each host: the browser (IndexedDB, fenced by the account) and a personal server (its files,
3
+ * outside git, trashed with its book). The engine's recorder writes through it; the pages read through it. The memory store
4
+ * (`MemoryAiCallStore`) is the reference: a host's tests compare it with the host.
5
+ *
6
+ * Rules every host follows:
7
+ * - Calls are identified by `callId` (`aiCallIdOf`), unique on the device or the server. A task is identified by `bookId` and `activityId`.
8
+ * - Offsets and sizes are in bytes of UTF-8. A text is always written as whole characters; `readText` answers from a character boundary.
9
+ * - Idempotent: a call that repeats a write (the same `begin`, `append` of the same bytes at the same offset, the same `end`, `keep`) leaves the
10
+ * store as one call left it. Out of order: the calls may arrive in any order. An `append` that arrives before its `begin` is kept until the
11
+ * call begins; an `end` before the appends is kept as the final state; an `append` after the `end` is still kept (its bytes are the text).
12
+ * A `saveTask` or `keep` for a task that holds no call yet creates it. A `begin` for a call already begun keeps the first one.
13
+ * - Atomic: each method changes the store as a whole or not at all. A method that fails leaves the store as it was, and the caller may repeat it.
14
+ * - Best effort: the recorder never waits for a write before it goes on, and reports the first failure of a run once. A host reports a failure
15
+ * by throwing it; a run is never stopped by it.
16
+ * - A host short of disk (under `AI_CALL_BUDGETS.minFreeDiskBytes`, or a quota error from the browser) throws `AiCallDiskFullError` (or the
17
+ * browser's `QuotaExceededError`) and keeps what it has. It never deletes a pinned task to make room.
18
+ * - Redaction: the strings the recorder gives are already redacted. A host may redact again, but it never stores a key, a header or a URL it was not given.
19
+ * - A `begin` past the `maxCallsPerTask` call of its task is ignored: that call is not kept.
20
+ */
21
+ /** A host that is short of disk refuses a write with this error: the store keeps what it has and the recorder reports it once per run. */
22
+ export class AiCallDiskFullError extends Error {
23
+ constructor(message = "There is not enough free disk space to keep the AI calls of this book.") {
24
+ super(message);
25
+ this.name = "AiCallDiskFullError";
26
+ }
27
+ }
28
+ //# sourceMappingURL=port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.js","sourceRoot":"","sources":["../../../src/autopilot/calls/port.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0IAA0I;AAC1I,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,wEAAwE;QAC5F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,120 @@
1
+ import type { AutopilotTaskKind } from "../types.js";
2
+ import type { AiCallStore } from "./port.js";
3
+ import { type AiCallAttempt, type AiCallHost, type AiCallRequestInfo, type AiCallStatus } from "./types.js";
4
+ /** The live text stops this many characters short of the newest one until the next checkpoint, so a key split across two checkpoints is never kept. */
5
+ export declare const AI_CALL_HOLDBACK_CHARACTERS = 256;
6
+ /** The most writes waiting for the store. A live checkpoint is dropped (its text goes with the next one) when the queue is that long; the final write is always queued. */
7
+ export declare const AI_CALL_QUEUE_LIMIT = 8;
8
+ /** The clock and the timer of a recorder: injected in tests, the system's in a run. */
9
+ export interface AiCallClock {
10
+ now(): number;
11
+ setTimer(callback: () => void, ms: number): unknown;
12
+ clearTimer(handle: unknown): void;
13
+ }
14
+ export declare const SYSTEM_AI_CALL_CLOCK: AiCallClock;
15
+ /** A provider attempt as the runner reports it at the end of the call: everything but the response's size, which the recorder measures. */
16
+ export type AiCallAttemptReport = Omit<AiCallAttempt, "text">;
17
+ /** What a recorder needs to start a call: its identity, its request as sent, and the secrets to keep out of it. */
18
+ export interface CallRecorderOptions {
19
+ store: AiCallStore;
20
+ bookId: string;
21
+ accountScope: string | null;
22
+ runId: string;
23
+ activityId: string;
24
+ seq: number;
25
+ stepAttempt: number;
26
+ task: AutopilotTaskKind;
27
+ chapter: number | null;
28
+ scene: number | null;
29
+ label: string;
30
+ capability: string;
31
+ host: AiCallHost;
32
+ system: string;
33
+ user: string;
34
+ request?: Partial<Omit<AiCallRequestInfo, "system" | "user">>;
35
+ /** Known secret values (the keys of the integrations, the tokens): replaced in every string before it is written. */
36
+ secrets?: readonly string[];
37
+ clock?: AiCallClock;
38
+ /** Called once per recorder with the first failure of a write. A recorder never throws a write failure into its caller. */
39
+ onError?: (error: unknown) => void;
40
+ }
41
+ /**
42
+ * The records of one AI call of an autopilot task. The runner creates one per `ai()` call and passes its `onText` to the client: the text it reports
43
+ * is cumulative, and a shorter text starts a new provider attempt (after a fallback or a retry; `""` resets). The recorder turns it into writes:
44
+ * the text that arrives is appended to the store every 2 seconds or 16 KiB, whichever comes first, and the rest at the end (`finish`).
45
+ *
46
+ * It never waits for the store and never throws a store failure into its caller: writes are queued in order, a live checkpoint is dropped when the
47
+ * queue is full (the next one carries its text), the final writes always queue, and the first failure of the call is reported once through
48
+ * `onError`. Every string is redacted with `redactSecrets` and the secrets the caller gives, and URLs are cut to their origins before they are
49
+ * kept. A response longer than its limit keeps its head and its end (`AI_CALL_LIMITS`); the bytes between them are dropped and the record says so.
50
+ */
51
+ export declare class CallRecorder {
52
+ /** The id of the call, as the store knows it. */
53
+ readonly callId: string;
54
+ private readonly store;
55
+ private readonly clock;
56
+ private readonly secrets;
57
+ private readonly onError;
58
+ private readonly startedAt;
59
+ private readonly fixedBytes;
60
+ private readonly fixedTruncated;
61
+ private firstTextMs;
62
+ private lastCheckpointMs;
63
+ private timer;
64
+ private attempt;
65
+ private attemptCount;
66
+ private responseBytes;
67
+ private truncated;
68
+ private readonly infos;
69
+ private inFlight;
70
+ private chain;
71
+ private reported;
72
+ private closed;
73
+ constructor(options: CallRecorderOptions);
74
+ /**
75
+ * Receives the cumulative text the client reports (the `onText` of the request). Never throws, and never waits: the text is kept in the recorder
76
+ * until a checkpoint sends it.
77
+ */
78
+ onText(text: string): void;
79
+ /**
80
+ * Ends the call: the text not yet sent is written, and the call is ended with its status and its provider attempts. Never throws: the returned
81
+ * promise settles when the store has taken the final writes (it never rejects; a failure was reported through `onError`). Calling it again does nothing.
82
+ */
83
+ finish(status: Exclude<AiCallStatus, "running">, attempts: readonly AiCallAttemptReport[]): Promise<void>;
84
+ /** Resolves when every write queued so far has settled. Never rejects. */
85
+ idle(): Promise<void>;
86
+ /** The text attempts started so far: the number of the attempt the latest text belongs to (see `AiCallAttempt.textAttempt`). */
87
+ get textAttempts(): number;
88
+ /** The bytes kept so far by the call: its system and user, and the responses. Final after `finish`. */
89
+ get storedBytes(): number;
90
+ /** The characters of the last text attempt, after `finish`; 0 when no text came. */
91
+ get responseCharacters(): number;
92
+ /** Why the call kept less than it was given, after `finish`: `limit` when a text was longer than its limit. */
93
+ get dropped(): "limit" | null;
94
+ private startAttempt;
95
+ /** Counts the bytes of the text that is whole: a trailing high surrogate waits for the low one that completes it. */
96
+ private scan;
97
+ /**
98
+ * Sends the text of the attempt that is not yet sent, redacted, up to its head limit. A live send keeps its holdback and is refused (returns false)
99
+ * when the queue is full; the final send takes everything and always queues.
100
+ */
101
+ private send;
102
+ /** Writes text[from, to) of the attempt, redacted, at the next stored offset. */
103
+ private appendText;
104
+ private writeResponse;
105
+ /** Sends the rest of the attempt and settles its size: its head, then its end when the text was longer than its head. */
106
+ private finishAttempt;
107
+ private checkpoint;
108
+ private arm;
109
+ private disarm;
110
+ /** Queues a store operation behind the ones before it. Live writes are refused when the queue is full; the others always queue. */
111
+ private write;
112
+ private report;
113
+ private limitText;
114
+ /** Every string a record keeps goes through here: the known secrets and the keys that look like keys, then URLs cut to their origins. */
115
+ private redact;
116
+ private short;
117
+ private cleanAttempt;
118
+ private cleanTransport;
119
+ }
120
+ //# sourceMappingURL=recorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../src/autopilot/calls/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAOL,KAAK,aAAa,EAElB,KAAK,UAAU,EAEf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAGlB,MAAM,YAAY,CAAC;AAEpB,uJAAuJ;AACvJ,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,2KAA2K;AAC3K,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,GAAG,IAAI,MAAM,CAAC;IACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACpD,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,oBAAoB,EAAE,WAIlC,CAAC;AAEF,2IAA2I;AAC3I,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAE9D,mHAAmH;AACnH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,MAAM,C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