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.
- package/README.md +2 -2
- package/dist/adapters/hosting/agentcore.js +124 -23
- package/dist/adapters/hosting/agentcore.js.map +1 -1
- package/dist/esm/adapters/hosting/agentcore.d.ts +14 -5
- package/dist/esm/adapters/hosting/agentcore.js +124 -23
- package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +9 -0
- package/dist/esm/hosting/index.js +8 -0
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/memorySessions.d.ts +3 -0
- package/dist/esm/hosting/memorySessions.js +3 -0
- package/dist/esm/hosting/memorySessions.js.map +1 -1
- package/dist/esm/hosting/sqliteSessions.d.ts +211 -0
- package/dist/esm/hosting/sqliteSessions.js +370 -0
- package/dist/esm/hosting/sqliteSessions.js.map +1 -0
- package/dist/esm/memory/define.js.map +1 -1
- package/dist/esm/memory/define.types.d.ts +15 -3
- package/dist/esm/memory/define.types.js.map +1 -1
- package/dist/esm/memory/index.d.ts +11 -1
- package/dist/esm/memory/index.js.map +1 -1
- package/dist/hosting/index.js +12 -1
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/memorySessions.js +3 -0
- package/dist/hosting/memorySessions.js.map +1 -1
- package/dist/hosting/sqliteSessions.js +376 -0
- package/dist/hosting/sqliteSessions.js.map +1 -0
- package/dist/memory/define.js.map +1 -1
- package/dist/memory/define.types.js.map +1 -1
- package/dist/memory/index.js.map +1 -1
- package/dist/types/adapters/hosting/agentcore.d.ts +14 -5
- package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +9 -0
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/memorySessions.d.ts +3 -0
- package/dist/types/hosting/memorySessions.d.ts.map +1 -1
- package/dist/types/hosting/sqliteSessions.d.ts +212 -0
- package/dist/types/hosting/sqliteSessions.d.ts.map +1 -0
- package/dist/types/memory/define.types.d.ts +15 -3
- package/dist/types/memory/define.types.d.ts.map +1 -1
- package/dist/types/memory/index.d.ts +11 -1
- package/dist/types/memory/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -50,6 +50,13 @@
|
|
|
50
50
|
* purpose: hiding a cap inside auto-chunking decides a protocol question
|
|
51
51
|
* for every consumer at once.
|
|
52
52
|
* • `memorySessions()` — conversations in a Map, for tests and local dev.
|
|
53
|
+
* • `sqliteSessions({ file })` — the same port, in a file, so a restart is not
|
|
54
|
+
* an amnesia event. Conversations AND runs paused waiting on a person, in
|
|
55
|
+
* one table, on Node's built-in `node:sqlite` — nothing to install and no
|
|
56
|
+
* peer dependency. One machine, one file, one writer at a time is the
|
|
57
|
+
* stated ceiling; it is not a distributed store. Refuses BY NAME on a Node
|
|
58
|
+
* without `node:sqlite` rather than falling back to memory, because a store
|
|
59
|
+
* that silently forgot everything looks exactly like a new user.
|
|
53
60
|
* • `standingAgent({ agent, sessions, host, durability? })` — the composer.
|
|
54
61
|
* • `toEnvelope` / `readEnvelope` — pack a conversation, and refuse by name to
|
|
55
62
|
* unpack a format this runtime does not know.
|
|
@@ -78,6 +85,8 @@ export type { NodeHost, NodeHostHandle, NodeHostOptions } from './nodeHost.js';
|
|
|
78
85
|
export { httpHost, headerValue } from './httpHost.js';
|
|
79
86
|
export type { ConversationHandshake, HandshakeFacts, HttpHost, HttpHostHandle, HttpHostOptions, HttpRequestFacts, HttpWire, } from './httpHost.js';
|
|
80
87
|
export { memorySessions } from './memorySessions.js';
|
|
88
|
+
export { sqliteSessions, SqliteUnavailableError, UnreadableSessionFileError, } from './sqliteSessions.js';
|
|
89
|
+
export type { SqliteSessions, SqliteSessionsOptions } from './sqliteSessions.js';
|
|
81
90
|
export { toEnvelope, toPausedEnvelope, readEnvelope, readPausedRun, checkEnvelope, } from './envelope.js';
|
|
82
91
|
export { standingAgent } from './standingAgent.js';
|
|
83
92
|
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, ConversationClosedError, FrameTooLargeError, } from './errors.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAI7B,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,UAAU,GACX,MAAM,YAAY,CAAC"}
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* — which is also how the "a crashed process resumes the conversation" test is
|
|
11
11
|
* written: keep the store, throw away everything else, and watch the
|
|
12
12
|
* conversation come back through the envelope alone.
|
|
13
|
+
*
|
|
14
|
+
* The next step up ships beside this one: `sqliteSessions({ file })` is the same
|
|
15
|
+
* port in a file, with nothing to install.
|
|
13
16
|
*/
|
|
14
17
|
import type { SessionLifecycle } from './types.js';
|
|
15
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memorySessions.d.ts","sourceRoot":"","sources":["../../../src/hosting/memorySessions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"memorySessions.d.ts","sourceRoot":"","sources":["../../../src/hosting/memorySessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,gBAAgB,CASjD"}
|
|
@@ -0,0 +1,212 @@
|
|
|
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;
|
|
212
|
+
//# sourceMappingURL=sqliteSessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqliteSessions.d.ts","sourceRoot":"","sources":["../../../src/hosting/sqliteSessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAKH,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAIvE,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5C,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5C,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;CAC/C;AAED,mDAAmD;AACnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;IAC1C,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACxC;AAID,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAID;;;;;;;;;;GAUG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,2BAAqC;IAClD,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAehD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,gCAA0C;IACvD,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,gBAAgB,GAAG,cAAc,CAAC;gBAExD,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,0BAA0B,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM;CAkBzF;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAyG7E"}
|
|
@@ -105,8 +105,20 @@ export declare const SNAPSHOT_PROJECTIONS: {
|
|
|
105
105
|
readonly FULL: "full";
|
|
106
106
|
};
|
|
107
107
|
export type SnapshotProjection = (typeof SNAPSHOT_PROJECTIONS)[keyof typeof SNAPSHOT_PROJECTIONS];
|
|
108
|
-
/**
|
|
109
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Window — keep the last `size` entries. Pure rule, no LLM, no embedder.
|
|
110
|
+
*
|
|
111
|
+
* NAMING (7.27.1): its siblings below are `BudgetStrategy`, `TopKStrategy`
|
|
112
|
+
* and so on, unprefixed. This one carries the `Memory` prefix because
|
|
113
|
+
* `WindowStrategy` is already taken, at the package root, by something else
|
|
114
|
+
* entirely: the conversation-window seam (`{ name, plan(input) }`,
|
|
115
|
+
* core/agent/window/strategy.ts, public since 7.17.0). Two exported types of
|
|
116
|
+
* the same name and incompatible shapes, reachable from two entry points, is
|
|
117
|
+
* a trap for anyone importing from the wrong one — so the memory config
|
|
118
|
+
* record took the prefix. `agentfootprint/memory` still exports the old name
|
|
119
|
+
* as a deprecated alias, so no import breaks.
|
|
120
|
+
*/
|
|
121
|
+
export interface MemoryWindowStrategy {
|
|
110
122
|
readonly kind: typeof MEMORY_STRATEGIES.WINDOW;
|
|
111
123
|
readonly size: number;
|
|
112
124
|
}
|
|
@@ -183,7 +195,7 @@ export interface HybridStrategy {
|
|
|
183
195
|
readonly strategies: ReadonlyArray<Exclude<Strategy, HybridStrategy>>;
|
|
184
196
|
}
|
|
185
197
|
/** The full strategy union — discriminated by `kind`. */
|
|
186
|
-
export type Strategy =
|
|
198
|
+
export type Strategy = MemoryWindowStrategy | BudgetStrategy | SummarizeStrategy | TopKStrategy | ExtractStrategy | DecayStrategy | HybridStrategy;
|
|
187
199
|
/**
|
|
188
200
|
* Reserved API surface for content redaction before memory writes.
|
|
189
201
|
* Impl is deferred; the field exists now so adding redaction later
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.types.d.ts","sourceRoot":"","sources":["../../../src/memory/define.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,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AAC,QAAQ,CAAC;CAC7C;AAED,MAAM,WAAW,qBAAsB,SAAQ,uBAAuB;IACpE,QAAQ,CAAC,IAAI,EAAE,OAAO,YAAY,CAAC,QAAQ,CAAC;CAC7C;AAED,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,QAAQ,CAAC,IAAI,EAAE,OAAO,YAAY,CAAC,SAAS,CAAC;CAC9C;AAED,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE,QAAQ,CAAC,IAAI,EAAE,OAAO,YAAY,CAAC,MAAM,CAAC;IAC1C,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAC1C;AAED,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAC3B,qBAAqB,GACrB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,CAAC;AAIxB,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE/E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE/E;AAID;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,oBAA8B,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
@@ -15,6 +15,16 @@ export * from './pipeline/index.js';
|
|
|
15
15
|
export * from './stages/index.js';
|
|
16
16
|
export * from './store/index.js';
|
|
17
17
|
export * from './wire/index.js';
|
|
18
|
-
export { MEMORY_TYPES, MEMORY_STRATEGIES, MEMORY_TIMING, SNAPSHOT_PROJECTIONS, MEMORY_INJECTION_KEY_PREFIX, isMemoryType, isMemoryStrategyKind, isMemoryTiming, isSnapshotProjection, memoryInjectionKey, isMemoryInjectionKey, type MemoryType, type MemoryStrategyKind, type MemoryTiming, type SnapshotProjection, type Strategy, type
|
|
18
|
+
export { MEMORY_TYPES, MEMORY_STRATEGIES, MEMORY_TIMING, SNAPSHOT_PROJECTIONS, MEMORY_INJECTION_KEY_PREFIX, isMemoryType, isMemoryStrategyKind, isMemoryTiming, isSnapshotProjection, memoryInjectionKey, isMemoryInjectionKey, type MemoryType, type MemoryStrategyKind, type MemoryTiming, type SnapshotProjection, type Strategy, type MemoryWindowStrategy, type BudgetStrategy, type SummarizeStrategy, type TopKStrategy, type ExtractStrategy, type DecayStrategy, type HybridStrategy, type MemoryDefinition, type DefineMemoryOptions, type DefineEpisodicOptions, type DefineSemanticOptions, type DefineNarrativeOptions, type DefineCausalOptions, type MemoryRedactionPolicy, } from './define.types.js';
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Since 7.27.1 — use `MemoryWindowStrategy`.
|
|
21
|
+
*
|
|
22
|
+
* `WindowStrategy` is the name of the CONVERSATION-window seam exported from
|
|
23
|
+
* the package root (`{ name, plan(input) }`). This one is the memory
|
|
24
|
+
* subsystem's window CONFIG (`{ kind: 'window', size }`). Same name, two
|
|
25
|
+
* entry points, incompatible shapes — so the memory one was renamed and this
|
|
26
|
+
* alias kept so that nothing importing it breaks.
|
|
27
|
+
*/
|
|
28
|
+
export type { MemoryWindowStrategy as WindowStrategy } from './define.types.js';
|
|
19
29
|
export { defineMemory } from './define.js';
|
|
20
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAC3B;;;;;;;;GAQG;AACH,YAAY,EAAE,oBAAoB,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0",
|
|
4
4
|
"description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sanjay Krishna Anbalagan",
|