agentfootprint 9.1.0 → 9.3.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 +15 -0
- package/dist/adapters/memory/pgVector.js +731 -0
- package/dist/adapters/memory/pgVector.js.map +1 -0
- package/dist/adapters/memory/s3Vectors.js +628 -0
- package/dist/adapters/memory/s3Vectors.js.map +1 -0
- package/dist/adapters/memory/sqliteVector.js +16 -79
- package/dist/adapters/memory/sqliteVector.js.map +1 -1
- package/dist/core/Agent.js +344 -18
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/LLMCall.js +17 -0
- package/dist/core/LLMCall.js.map +1 -1
- package/dist/core/RunnerBase.js +22 -6
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +20 -0
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/conversation.js +139 -0
- package/dist/core/conversation.js.map +1 -0
- package/dist/core/runCheckpoint.js +60 -2
- package/dist/core/runCheckpoint.js.map +1 -1
- package/dist/embedders/index.js +240 -76
- package/dist/embedders/index.js.map +1 -1
- package/dist/esm/adapters/memory/pgVector.d.ts +243 -0
- package/dist/esm/adapters/memory/pgVector.js +726 -0
- package/dist/esm/adapters/memory/pgVector.js.map +1 -0
- package/dist/esm/adapters/memory/s3Vectors.d.ts +208 -0
- package/dist/esm/adapters/memory/s3Vectors.js +624 -0
- package/dist/esm/adapters/memory/s3Vectors.js.map +1 -0
- package/dist/esm/adapters/memory/sqliteVector.d.ts +5 -27
- package/dist/esm/adapters/memory/sqliteVector.js +10 -73
- package/dist/esm/adapters/memory/sqliteVector.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +218 -3
- package/dist/esm/core/Agent.js +345 -19
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/LLMCall.d.ts +9 -0
- package/dist/esm/core/LLMCall.js +17 -0
- package/dist/esm/core/LLMCall.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +22 -6
- package/dist/esm/core/RunnerBase.js +22 -6
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +5 -0
- package/dist/esm/core/agent/AgentBuilder.js +20 -0
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +45 -3
- package/dist/esm/core/conversation.d.ts +96 -0
- package/dist/esm/core/conversation.js +133 -0
- package/dist/esm/core/conversation.js.map +1 -0
- package/dist/esm/core/runCheckpoint.d.ts +85 -1
- package/dist/esm/core/runCheckpoint.js +57 -1
- package/dist/esm/core/runCheckpoint.js.map +1 -1
- package/dist/esm/embedders/index.d.ts +99 -19
- package/dist/esm/embedders/index.js +240 -76
- package/dist/esm/embedders/index.js.map +1 -1
- package/dist/esm/hosting/standingAgent.d.ts +6 -2
- package/dist/esm/hosting/standingAgent.js +36 -27
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/embedderMismatch.d.ts +67 -0
- package/dist/esm/lib/embedderMismatch.js +96 -0
- package/dist/esm/lib/embedderMismatch.js.map +1 -0
- package/dist/esm/lib/rag/defineRAG.d.ts +28 -6
- package/dist/esm/lib/rag/defineRAG.js +39 -5
- package/dist/esm/lib/rag/defineRAG.js.map +1 -1
- package/dist/esm/memory/define.js +31 -1
- package/dist/esm/memory/define.js.map +1 -1
- package/dist/esm/memory/define.types.d.ts +13 -2
- package/dist/esm/memory/define.types.js.map +1 -1
- package/dist/esm/memory/embedding/loadRelevant.d.ts +10 -2
- package/dist/esm/memory/embedding/loadRelevant.js +36 -18
- package/dist/esm/memory/embedding/loadRelevant.js.map +1 -1
- package/dist/esm/memory/pipeline/semantic.d.ts +13 -2
- package/dist/esm/memory/pipeline/semantic.js +11 -5
- package/dist/esm/memory/pipeline/semantic.js.map +1 -1
- package/dist/esm/memory/store/capability.d.ts +25 -6
- package/dist/esm/memory/store/capability.js +68 -3
- package/dist/esm/memory/store/capability.js.map +1 -1
- package/dist/esm/memory/store/index.d.ts +1 -0
- package/dist/esm/memory/store/index.js +4 -0
- package/dist/esm/memory/store/index.js.map +1 -1
- package/dist/esm/memory/store/types.d.ts +40 -0
- package/dist/esm/memory-providers.d.ts +7 -4
- package/dist/esm/memory-providers.js +18 -4
- package/dist/esm/memory-providers.js.map +1 -1
- package/dist/hosting/standingAgent.js +36 -27
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/embedderMismatch.js +103 -0
- package/dist/lib/embedderMismatch.js.map +1 -0
- package/dist/lib/rag/defineRAG.js +39 -5
- package/dist/lib/rag/defineRAG.js.map +1 -1
- package/dist/memory/define.js +31 -1
- package/dist/memory/define.js.map +1 -1
- package/dist/memory/define.types.js.map +1 -1
- package/dist/memory/embedding/loadRelevant.js +36 -18
- package/dist/memory/embedding/loadRelevant.js.map +1 -1
- package/dist/memory/pipeline/semantic.js +11 -5
- package/dist/memory/pipeline/semantic.js.map +1 -1
- package/dist/memory/store/capability.js +70 -4
- package/dist/memory/store/capability.js.map +1 -1
- package/dist/memory/store/index.js +7 -1
- package/dist/memory/store/index.js.map +1 -1
- package/dist/memory-providers.js +22 -5
- package/dist/memory-providers.js.map +1 -1
- package/dist/types/adapters/memory/pgVector.d.ts +244 -0
- package/dist/types/adapters/memory/pgVector.d.ts.map +1 -0
- package/dist/types/adapters/memory/s3Vectors.d.ts +209 -0
- package/dist/types/adapters/memory/s3Vectors.d.ts.map +1 -0
- package/dist/types/adapters/memory/sqliteVector.d.ts +5 -27
- package/dist/types/adapters/memory/sqliteVector.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +218 -3
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/LLMCall.d.ts +9 -0
- package/dist/types/core/LLMCall.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +22 -6
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +5 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +45 -3
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/conversation.d.ts +97 -0
- package/dist/types/core/conversation.d.ts.map +1 -0
- package/dist/types/core/runCheckpoint.d.ts +85 -1
- package/dist/types/core/runCheckpoint.d.ts.map +1 -1
- package/dist/types/embedders/index.d.ts +99 -19
- package/dist/types/embedders/index.d.ts.map +1 -1
- package/dist/types/hosting/standingAgent.d.ts +6 -2
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/embedderMismatch.d.ts +68 -0
- package/dist/types/lib/embedderMismatch.d.ts.map +1 -0
- package/dist/types/lib/rag/defineRAG.d.ts +28 -6
- package/dist/types/lib/rag/defineRAG.d.ts.map +1 -1
- package/dist/types/memory/define.d.ts.map +1 -1
- package/dist/types/memory/define.types.d.ts +13 -2
- package/dist/types/memory/define.types.d.ts.map +1 -1
- package/dist/types/memory/embedding/loadRelevant.d.ts +10 -2
- package/dist/types/memory/embedding/loadRelevant.d.ts.map +1 -1
- package/dist/types/memory/pipeline/semantic.d.ts +13 -2
- package/dist/types/memory/pipeline/semantic.d.ts.map +1 -1
- package/dist/types/memory/store/capability.d.ts +25 -6
- package/dist/types/memory/store/capability.d.ts.map +1 -1
- package/dist/types/memory/store/index.d.ts +1 -0
- package/dist/types/memory/store/index.d.ts.map +1 -1
- package/dist/types/memory/store/types.d.ts +40 -0
- package/dist/types/memory/store/types.d.ts.map +1 -1
- package/dist/types/memory-providers.d.ts +7 -4
- package/dist/types/memory-providers.d.ts.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/memory/s3Vectors — the corpus outlives the runtime, and can still
|
|
3
|
+
* be updated without one.
|
|
4
|
+
*
|
|
5
|
+
* `sqliteVectorStore` (8.9.0) made a corpus survive a restart by putting it in
|
|
6
|
+
* a file, and `staticVectorStore` (8.20.0) made it survive a runtime with no
|
|
7
|
+
* disk at all by shipping it as a build artifact. Both leave the same gap, and
|
|
8
|
+
* a production field report named it: **a bundle can only change when you
|
|
9
|
+
* redeploy.** Add three documents on a Tuesday and the answer arrives with the
|
|
10
|
+
* next release train. That is a fine trade for product documentation and a bad
|
|
11
|
+
* one for anything a human edits during the day.
|
|
12
|
+
*
|
|
13
|
+
* Amazon S3 Vectors closes it. It is object storage with a native vector index
|
|
14
|
+
* and a query API: durable, serverless, nothing to run, priced like storage
|
|
15
|
+
* rather than like a database cluster. This adapter is the `MemoryStore` port
|
|
16
|
+
* over it, and the two halves that matter are:
|
|
17
|
+
*
|
|
18
|
+
* - `search()` maps 1:1 onto **QueryVectors** — the vector goes as
|
|
19
|
+
* `queryVector.float32`, `k` becomes `topK`, tiers become a metadata
|
|
20
|
+
* `filter`, and the returned `distance` becomes the port's score.
|
|
21
|
+
* - `put()` / `putMany()` map onto **PutVectors** — so `indexCorpus`,
|
|
22
|
+
* `indexFolder` and `indexDocuments` run against it unchanged. **That is
|
|
23
|
+
* the point of writing it rather than only reading it:** a corpus you can
|
|
24
|
+
* add to from a cron job at 14:00 is a different product from one you can
|
|
25
|
+
* add to at the next deploy.
|
|
26
|
+
*
|
|
27
|
+
* ── What it is NOT ──────────────────────────────────────────────────────────
|
|
28
|
+
* A vector index is not a key-value store, and this adapter refuses the
|
|
29
|
+
* operations that would need one rather than faking them:
|
|
30
|
+
*
|
|
31
|
+
* - `putIfVersion` — PutVectors is last-write-wins; there is no
|
|
32
|
+
* compare-and-set. A read-then-write here would be a compare-and-set that
|
|
33
|
+
* another writer can walk through the middle of, which is worse than none.
|
|
34
|
+
* - `recordSignature` / `feedback` — a set of strings and a running average
|
|
35
|
+
* are not vectors. `seen()` answers `false` and `getFeedback()` `null`,
|
|
36
|
+
* which are both TRUE (nothing can be recorded, so nothing has been); the
|
|
37
|
+
* WRITE halves refuse by name.
|
|
38
|
+
*
|
|
39
|
+
* Pair it with a second store for conversation memory — `defineRAG` for the
|
|
40
|
+
* corpus, `defineMemory` for the chat, each with the backend it suits. That is
|
|
41
|
+
* the same shape `staticVectorStore` documents.
|
|
42
|
+
*
|
|
43
|
+
* ── The index you must create first, and why this does not create it ────────
|
|
44
|
+
* A vector index has a DIMENSION and a DISTANCE METRIC fixed at creation, and
|
|
45
|
+
* both are decisions about your embedder that this library must not make on
|
|
46
|
+
* your behalf — creating one silently would pick a size and a metric your
|
|
47
|
+
* corpus then lives with. Create it once, with your infrastructure:
|
|
48
|
+
*
|
|
49
|
+
* ```bash
|
|
50
|
+
* aws s3vectors create-vector-bucket --vector-bucket-name my-corpus
|
|
51
|
+
* aws s3vectors create-index \
|
|
52
|
+
* --vector-bucket-name my-corpus \
|
|
53
|
+
* --index-name docs \
|
|
54
|
+
* --data-type float32 \
|
|
55
|
+
* --dimension 1024 \
|
|
56
|
+
* --distance-metric cosine \
|
|
57
|
+
* --metadata-configuration '{"nonFilterableMetadataKeys":["af"]}'
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* `nonFilterableMetadataKeys: ["af"]` is load-bearing, not decoration. This
|
|
61
|
+
* adapter stores the whole entry — the passage the model will read, its
|
|
62
|
+
* provenance, its timestamps — as JSON under the metadata key `af`. Filterable
|
|
63
|
+
* metadata has a small per-vector budget; non-filterable metadata has the large
|
|
64
|
+
* one. Declare `af` non-filterable and a full passage fits; leave it filterable
|
|
65
|
+
* and PutVectors starts refusing your longer chunks partway through an
|
|
66
|
+
* indexing run.
|
|
67
|
+
*
|
|
68
|
+
* Only `ns` (the identity namespace) and `tier` are ever filtered on, and both
|
|
69
|
+
* are short strings.
|
|
70
|
+
*
|
|
71
|
+
* ── Cosine only, said out loud ──────────────────────────────────────────────
|
|
72
|
+
* The port's score is a cosine similarity, and every threshold in this library
|
|
73
|
+
* — starting with `defineRAG`'s 0.7 default — is calibrated on that range. A
|
|
74
|
+
* cosine distance converts exactly (`score = 1 - distance`). A EUCLIDEAN
|
|
75
|
+
* distance does not: any mapping into [-1, 1] produces a number that READS like
|
|
76
|
+
* a cosine and is not one, which is the same class of confident-and-meaningless
|
|
77
|
+
* value the embedder-mismatch refusal exists to stop. So a euclidean index is
|
|
78
|
+
* refused at construction, by name.
|
|
79
|
+
*
|
|
80
|
+
* ── The fingerprint guarantee, stated exactly ───────────────────────────────
|
|
81
|
+
* `sqliteVectorStore` owns its file and can keep a fingerprint row in it. This
|
|
82
|
+
* store owns nothing but vectors, so the guarantee is assembled from what the
|
|
83
|
+
* service actually provides, and it is smaller — so it is spelled out rather
|
|
84
|
+
* than implied:
|
|
85
|
+
*
|
|
86
|
+
* - **Dimensions** are enforced by S3 Vectors itself. The index declares one;
|
|
87
|
+
* a vector of another length is rejected by the service, loudly, at the
|
|
88
|
+
* call. Nothing here can be sloppier than that.
|
|
89
|
+
* - **The model id** is stamped into every vector's metadata (`fp`) and
|
|
90
|
+
* checked in two places: against the fingerprint this process has already
|
|
91
|
+
* seen for the namespace (at write and at search), and against the
|
|
92
|
+
* fingerprint carried by the HITS that come back (at search). The second
|
|
93
|
+
* one is what survives a restart: the first query after an embedder swap
|
|
94
|
+
* sees documents stamped by the old embedder and refuses by name, instead
|
|
95
|
+
* of returning a confident ranking of two incompatible spaces.
|
|
96
|
+
* - What is NOT caught: the first WRITE of a fresh process into a namespace
|
|
97
|
+
* another embedder built. There is no cheap read that would catch it, and a
|
|
98
|
+
* full index scan on every boot is not one either. It is caught at the next
|
|
99
|
+
* search, before a single wrong answer is returned.
|
|
100
|
+
*
|
|
101
|
+
* ── Lazy peer dependency ────────────────────────────────────────────────────
|
|
102
|
+
* `@aws-sdk/client-s3vectors` is an OPTIONAL peer dependency, required at
|
|
103
|
+
* construction time. Importing `agentfootprint/memory` costs nothing for
|
|
104
|
+
* consumers who never build one of these. Pass `client` to share the SDK
|
|
105
|
+
* configuration your app already has.
|
|
106
|
+
*/
|
|
107
|
+
import type { MemoryIdentity } from '../../memory/identity/index.js';
|
|
108
|
+
import type { MemoryStore } from '../../memory/store/types.js';
|
|
109
|
+
/**
|
|
110
|
+
* The slice of an S3 Vectors client this adapter calls.
|
|
111
|
+
*
|
|
112
|
+
* Structural, so the real SDK client, a pre-built one shared with the rest of
|
|
113
|
+
* your app, or a test double all satisfy it without this package taking a hard
|
|
114
|
+
* type dependency on the optional peer.
|
|
115
|
+
*/
|
|
116
|
+
export interface S3VectorsLikeClient {
|
|
117
|
+
/** `send(command, options?)` — the second argument carries `abortSignal`. */
|
|
118
|
+
send(command: unknown, options?: {
|
|
119
|
+
abortSignal?: AbortSignal;
|
|
120
|
+
}): Promise<unknown>;
|
|
121
|
+
/** Optional — released by {@link S3VectorsStore.close} when this store built the client. */
|
|
122
|
+
destroy?(): void;
|
|
123
|
+
}
|
|
124
|
+
/** The constructors this adapter needs out of `@aws-sdk/client-s3vectors`. */
|
|
125
|
+
export interface S3VectorsSdkModule {
|
|
126
|
+
readonly S3VectorsClient?: new (config: {
|
|
127
|
+
region?: string;
|
|
128
|
+
}) => S3VectorsLikeClient;
|
|
129
|
+
readonly PutVectorsCommand?: new (input: unknown) => unknown;
|
|
130
|
+
readonly QueryVectorsCommand?: new (input: unknown) => unknown;
|
|
131
|
+
readonly GetVectorsCommand?: new (input: unknown) => unknown;
|
|
132
|
+
readonly ListVectorsCommand?: new (input: unknown) => unknown;
|
|
133
|
+
readonly DeleteVectorsCommand?: new (input: unknown) => unknown;
|
|
134
|
+
}
|
|
135
|
+
export interface S3VectorsStoreOptions {
|
|
136
|
+
/** The vector bucket (`vectorBucketName`). Created by you, not by this. */
|
|
137
|
+
readonly bucket: string;
|
|
138
|
+
/** The vector index inside it (`indexName`). Created by you, not by this. */
|
|
139
|
+
readonly index: string;
|
|
140
|
+
/** AWS region. Passed to the SDK client when this factory builds one. */
|
|
141
|
+
readonly region?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The metric the index was created with. Only `'cosine'` is supported, and
|
|
144
|
+
* anything else is refused at construction — see the header. This is a
|
|
145
|
+
* DECLARATION about an index this store did not create; state the metric you
|
|
146
|
+
* actually used.
|
|
147
|
+
*/
|
|
148
|
+
readonly distanceMetric?: 'cosine';
|
|
149
|
+
/**
|
|
150
|
+
* How many vectors go in one PutVectors call. Default 100 — deliberately
|
|
151
|
+
* well under the service limit, because the failure mode of guessing that
|
|
152
|
+
* limit high is a corpus that indexes 90% of the way and stops.
|
|
153
|
+
*/
|
|
154
|
+
readonly batchSize?: number;
|
|
155
|
+
/** A pre-built S3 Vectors client, so one SDK config serves the whole app. */
|
|
156
|
+
readonly client?: S3VectorsLikeClient;
|
|
157
|
+
/** @internal Test injection — skips the SDK require entirely. */
|
|
158
|
+
readonly _client?: S3VectorsLikeClient;
|
|
159
|
+
/** @internal Test injection — the AWS SDK module (exercises the real shim with a mock SDK). */
|
|
160
|
+
readonly _sdk?: S3VectorsSdkModule;
|
|
161
|
+
}
|
|
162
|
+
/** A durable vector index in S3, plus the two things this store owns beyond the port. */
|
|
163
|
+
export interface S3VectorsStore extends MemoryStore {
|
|
164
|
+
/** The vector bucket this store reads and writes. */
|
|
165
|
+
readonly bucket: string;
|
|
166
|
+
/** The vector index inside it. */
|
|
167
|
+
readonly index: string;
|
|
168
|
+
/**
|
|
169
|
+
* The embedder fingerprint (`'<id>@<dims>'`) this PROCESS has seen for a
|
|
170
|
+
* namespace, or `undefined` when it has seen none yet.
|
|
171
|
+
*
|
|
172
|
+
* Deliberately not "the fingerprint the index was built with" — see the
|
|
173
|
+
* header for exactly what this store can and cannot know. It is populated by
|
|
174
|
+
* the first write or the first search of the namespace in this process.
|
|
175
|
+
*/
|
|
176
|
+
fingerprintOf(identity: MemoryIdentity): string | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Release the SDK client, if this store built one. Idempotent. A client you
|
|
179
|
+
* passed in is yours and is left alone.
|
|
180
|
+
*/
|
|
181
|
+
close(): void;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Open a `MemoryStore` over an existing S3 Vectors index.
|
|
185
|
+
*
|
|
186
|
+
* @throws when `@aws-sdk/client-s3vectors` is absent and no `client` was passed.
|
|
187
|
+
* @throws when `distanceMetric` is anything but `'cosine'`.
|
|
188
|
+
* @throws EmbedderMismatchError from `put`/`putMany`/`search` when a vector
|
|
189
|
+
* meets a namespace built by a different embedder.
|
|
190
|
+
*
|
|
191
|
+
* @example A corpus you can add to without a redeploy
|
|
192
|
+
* ```ts
|
|
193
|
+
* import { defineRAG, indexDocuments } from 'agentfootprint';
|
|
194
|
+
* import { s3VectorsStore } from 'agentfootprint/memory';
|
|
195
|
+
* import { bedrockEmbedder } from 'agentfootprint/providers';
|
|
196
|
+
*
|
|
197
|
+
* const store = s3VectorsStore({ bucket: 'my-corpus', index: 'docs', region: 'us-east-1' });
|
|
198
|
+
* const embedder = bedrockEmbedder({ region: 'us-east-1' });
|
|
199
|
+
*
|
|
200
|
+
* // Run this from a cron job. No deploy, no restart — the agent sees it next turn.
|
|
201
|
+
* await indexDocuments(store, embedder, newDocs, { embedderId: embedder.id });
|
|
202
|
+
*
|
|
203
|
+
* const agent = Agent.create({ provider })
|
|
204
|
+
* .rag(defineRAG({ id: 'docs', store, embedder, embedderId: embedder.id }))
|
|
205
|
+
* .build();
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export declare function s3VectorsStore(options: S3VectorsStoreOptions): S3VectorsStore;
|
|
209
|
+
//# sourceMappingURL=s3Vectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3Vectors.d.ts","sourceRoot":"","sources":["../../../../src/adapters/memory/s3Vectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IACnC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IACtC,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED,yFAAyF;AACzF,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5D;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAiBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CA2c7E"}
|
|
@@ -141,34 +141,12 @@ export declare class UnreadableIndexFileError extends Error {
|
|
|
141
141
|
/**
|
|
142
142
|
* Raised when a vector meets an index built by a different embedder.
|
|
143
143
|
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* can tell them apart. So the mismatch is refused where it happens, on both
|
|
149
|
-
* sides:
|
|
150
|
-
*
|
|
151
|
-
* - at **write**, so a second embedder's vectors never enter a namespace;
|
|
152
|
-
* - at **query**, so a swapped embedder never scores against the old ones.
|
|
153
|
-
*
|
|
154
|
-
* The named fix is an explicit re-index — delete the namespace and build it
|
|
155
|
-
* again with one embedder, or point the retriever at a different file. It is
|
|
156
|
-
* never a fallback: silently ignoring the mismatch is the failure, and silently
|
|
157
|
-
* re-embedding somebody's corpus is a bill they did not agree to.
|
|
158
|
-
*
|
|
159
|
-
* `problem` says which half is wrong. `'dimensions'` is arithmetically
|
|
160
|
-
* impossible to score at all; `'model'` would score, and lie.
|
|
144
|
+
* Since 9.3.0 this is ONE class shared by every store that can make the check
|
|
145
|
+
* (`lib/embedderMismatch.ts`), re-exported here so the import path that has
|
|
146
|
+
* worked since 8.9.0 keeps working. A second class of the same name would make
|
|
147
|
+
* `instanceof` depend on which store threw.
|
|
161
148
|
*/
|
|
162
|
-
export
|
|
163
|
-
readonly code: "ERR_EMBEDDER_MISMATCH";
|
|
164
|
-
/** The fingerprint the namespace was built with, `'<id>@<dims>'`. */
|
|
165
|
-
readonly indexed: string;
|
|
166
|
-
/** The fingerprint that just arrived. */
|
|
167
|
-
readonly incoming: string;
|
|
168
|
-
/** Which half disagrees. */
|
|
169
|
-
readonly problem: 'dimensions' | 'model';
|
|
170
|
-
constructor(namespace: string, indexed: string, incoming: string, problem: EmbedderMismatchError['problem'], operation: 'write to' | 'search');
|
|
171
|
-
}
|
|
149
|
+
export { EmbedderMismatchError } from '../../lib/embedderMismatch.js';
|
|
172
150
|
/** A durable vector store, plus the three things a file owns beyond the port. */
|
|
173
151
|
export interface SqliteVectorStore extends MemoryStore {
|
|
174
152
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteVector.d.ts","sourceRoot":"","sources":["../../../../src/adapters/memory/sqliteVector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;
|
|
1
|
+
{"version":3,"file":"sqliteVector.d.ts","sourceRoot":"","sources":["../../../../src/adapters/memory/sqliteVector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAYH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,KAAK,EAGV,WA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FAAiF;AACjF,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5D;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/E;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CAqetF"}
|
|
@@ -20,6 +20,8 @@ import { type RunnerPauseOutcome } from './pause.js';
|
|
|
20
20
|
import type { WindowStrategy } from './agent/window/strategy.js';
|
|
21
21
|
import { type CheckInBuilderOptions } from './checkin.js';
|
|
22
22
|
import type { MemoryDefinition } from '../memory/define.types.js';
|
|
23
|
+
import type { MemoryIdentity } from '../memory/identity/types.js';
|
|
24
|
+
import type { SelfExplainBinding } from '../lib/trace-toolpack/selfExplain.js';
|
|
23
25
|
import type { Injection, InjectionContext } from '../lib/injection-engine/types.js';
|
|
24
26
|
import type { CursorMove, EntryScoring } from '../lib/injection-engine/skillGraph.js';
|
|
25
27
|
import { type ResolvedOutputFallback } from './outputFallback.js';
|
|
@@ -55,6 +57,19 @@ export interface AgentRunOptions extends RunOptions {
|
|
|
55
57
|
correlationId?: string;
|
|
56
58
|
/** OTEL-style trace id — forwarded onto every emitted event's `EventMeta.traceId`. Falls back to `options.env?.traceId` when unset. */
|
|
57
59
|
traceId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Who this run is for — the same tuple as `run({ identity })`, reachable
|
|
62
|
+
* from the doors whose input is a stored conversation rather than a
|
|
63
|
+
* message bag: `resumeOnError(checkpoint, { identity })` and
|
|
64
|
+
* `followUp(message, { identity })` (9.2.0).
|
|
65
|
+
*
|
|
66
|
+
* Before this existed, `resumeOnError` could not carry an identity at all,
|
|
67
|
+
* so every continued turn silently re-namespaced its memory under a fresh
|
|
68
|
+
* runId. Omitted, the conversation's own stored `identity` is used; given,
|
|
69
|
+
* it wins. On `run()` this is a second spelling of `run({ identity })` and
|
|
70
|
+
* the one on the input wins, since that is where the caller looked first.
|
|
71
|
+
*/
|
|
72
|
+
identity?: MemoryIdentity;
|
|
58
73
|
}
|
|
59
74
|
export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
60
75
|
readonly name: string;
|
|
@@ -245,6 +260,28 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
245
260
|
* kept here rather than read back from the recording. Undefined after a run
|
|
246
261
|
* that failed or paused. */
|
|
247
262
|
private lastRunAnswer?;
|
|
263
|
+
/** The id the CONSUMER chose, or undefined when they took the default.
|
|
264
|
+
* `this.id` cannot answer that question — it is `'agent'` either way — and
|
|
265
|
+
* the stored-conversation fingerprint refuses only on ids somebody picked
|
|
266
|
+
* (see `AgentRunCheckpoint.agent`). */
|
|
267
|
+
private readonly explicitId?;
|
|
268
|
+
/** The identity the caller gave the last run, or undefined when they gave
|
|
269
|
+
* none. Only an EXPLICIT identity is carried onto `checkpoint()`: the
|
|
270
|
+
* default is derived from a runId, and storing that would pin a whole
|
|
271
|
+
* conversation to the id of the one run that started it. */
|
|
272
|
+
private lastRunIdentity?;
|
|
273
|
+
/** The run in flight, by id — the whole of the one-turn-at-a-time guard.
|
|
274
|
+
* Set before the executor is built and cleared in `finally`, so a run that
|
|
275
|
+
* throws does not leave the agent permanently refusing. */
|
|
276
|
+
private inFlightRunId?;
|
|
277
|
+
/** The question a person still owes this agent an answer to. Set when a run
|
|
278
|
+
* ends paused, cleared by `resume()`, `abandonPause()`, or a run that
|
|
279
|
+
* completes. Read by the `run()` guard — see `PendingQuestionError`. */
|
|
280
|
+
private pendingQuestion?;
|
|
281
|
+
/** The `.selfExplain()` binding, when the builder mounted one. Held so
|
|
282
|
+
* `canExplain()` can answer the same question the trace tools answer, from
|
|
283
|
+
* the same fact. Undefined on every agent that never called `.selfExplain()`. */
|
|
284
|
+
private selfExplainBinding?;
|
|
248
285
|
/**
|
|
249
286
|
* Optional `ToolProvider` set via the builder's `.toolProvider()`.
|
|
250
287
|
* When present, the Tools slot subflow consults it per iteration
|
|
@@ -309,9 +346,17 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
309
346
|
* prop) so consumers can scrub the execution timeline post-run without
|
|
310
347
|
* threading a recorder through the call site.
|
|
311
348
|
*
|
|
312
|
-
*
|
|
313
|
-
* snapshot
|
|
314
|
-
*
|
|
349
|
+
* `undefined` until a run has STARTED. After that it is the most recent
|
|
350
|
+
* run's snapshot — including across multiple turns of the same instance.
|
|
351
|
+
*
|
|
352
|
+
* **It is LIVE during a run, not a completed-runs-only view.** The executor
|
|
353
|
+
* is assigned at run start, so calling this from an event listener, a tool,
|
|
354
|
+
* or any other mid-run vantage point returns the IN-FLIGHT run, partially
|
|
355
|
+
* filled. That is deliberate (Lens scrubs a running agent through it), and
|
|
356
|
+
* it is why `.selfExplain()` captures at the terminal flush instead of
|
|
357
|
+
* resolving through this: evidence that is supposed to describe a FINISHED
|
|
358
|
+
* turn cannot be read from a getter that also answers about an unfinished
|
|
359
|
+
* one.
|
|
315
360
|
*/
|
|
316
361
|
getLastSnapshot(): RuntimeSnapshot | undefined;
|
|
317
362
|
/**
|
|
@@ -383,7 +428,112 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
383
428
|
* pauses (use `run()` directly when pauses are expected).
|
|
384
429
|
*/
|
|
385
430
|
runTyped<T = unknown>(input: AgentInput | string, options?: AgentRunOptions): Promise<T>;
|
|
431
|
+
/**
|
|
432
|
+
* Answer one turn.
|
|
433
|
+
*
|
|
434
|
+
* **`run()` is ONE turn, and it starts a new conversation every time.** The
|
|
435
|
+
* chart seeds its history from this call's `message` alone, so a second
|
|
436
|
+
* `run()` on the same agent does not continue the first: the model is shown
|
|
437
|
+
* one user message and will honestly tell your user it has not spoken to
|
|
438
|
+
* them before. That is deliberate — a primitive that quietly accumulated
|
|
439
|
+
* state across calls could never be used for one-shot work, and a hidden
|
|
440
|
+
* transcript is the most expensive thing an agent can carry.
|
|
441
|
+
*
|
|
442
|
+
* To continue a conversation, name it:
|
|
443
|
+
*
|
|
444
|
+
* - `agent.followUp(message)` — continue THIS agent's own last completed
|
|
445
|
+
* run. The one-liner, and what most callers want.
|
|
446
|
+
* - `run({ message, continueFrom })` — continue a conversation you are
|
|
447
|
+
* holding: `agent.checkpoint()` from an earlier turn, persisted anywhere
|
|
448
|
+
* and handed back. Works across a restart, a deploy, or a different
|
|
449
|
+
* machine, and is what `standingAgent` uses per session.
|
|
450
|
+
*
|
|
451
|
+
* Passing the same `identity.conversationId` to two `run()` calls does NOT
|
|
452
|
+
* continue anything — see {@link AgentInput.identity}. What a registered
|
|
453
|
+
* memory adds is *recall* of prior turns into the system-prompt slot, which
|
|
454
|
+
* is a different thing from the conversation itself.
|
|
455
|
+
*
|
|
456
|
+
* Two refusals guard the per-instance state this agent keeps; both replace
|
|
457
|
+
* behavior that used to succeed while quietly being wrong (9.2.0):
|
|
458
|
+
* {@link RunInFlightError} when a run is already in flight, and
|
|
459
|
+
* {@link PendingQuestionError} when the last run paused to ask a person
|
|
460
|
+
* something that nobody has answered.
|
|
461
|
+
*
|
|
462
|
+
* @example One turn, then a follow-up
|
|
463
|
+
* ```ts
|
|
464
|
+
* await agent.run({ message: 'Book me a table for two.' });
|
|
465
|
+
* await agent.followUp('Make it three.'); // remembers the table
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
386
468
|
run(input: AgentInput | string, options?: AgentRunOptions): Promise<AgentOutput | RunnerPauseOutcome>;
|
|
469
|
+
/**
|
|
470
|
+
* Continue this agent's own last completed conversation.
|
|
471
|
+
*
|
|
472
|
+
* The one-liner for turn two and after. `run()` is one turn and starts a new
|
|
473
|
+
* conversation each time (see {@link Agent.run}); this reads the
|
|
474
|
+
* conversation off the last completed run, appends `message` as the next
|
|
475
|
+
* user turn, and runs from there — so the model sees what was actually said.
|
|
476
|
+
*
|
|
477
|
+
* Sugar over `run({ message, continueFrom: this.checkpoint() })` and nothing
|
|
478
|
+
* more: one restoration path, so the convenience cannot drift from the
|
|
479
|
+
* mechanism. Reach for `run({ continueFrom })` directly when the
|
|
480
|
+
* conversation comes from somewhere other than this instance's last run — a
|
|
481
|
+
* store, another process, a different machine.
|
|
482
|
+
*
|
|
483
|
+
* Refuses rather than guessing: {@link NoConversationError} when this agent
|
|
484
|
+
* has no completed run to continue (a "follow-up" that quietly became a
|
|
485
|
+
* first turn would be exactly the confusion this door exists to remove),
|
|
486
|
+
* and — through `run()` — {@link PendingQuestionError} when the last run
|
|
487
|
+
* paused to ask a person something, because a pause has its own door:
|
|
488
|
+
* `resume(checkpoint, decision)`.
|
|
489
|
+
*
|
|
490
|
+
* The conversation grows every turn and nothing here trims it; bounding what
|
|
491
|
+
* the model is shown is `.window()` / `.compaction()` / `.memory()`, not a
|
|
492
|
+
* silent cap on the way through.
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* ```ts
|
|
496
|
+
* await agent.run({ message: 'Book me a table for two.' });
|
|
497
|
+
* await agent.followUp('Make it three.');
|
|
498
|
+
* await agent.followUp('And move it to 8pm.');
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
followUp(message: string, options?: AgentRunOptions): Promise<AgentOutput | RunnerPauseOutcome>;
|
|
502
|
+
/**
|
|
503
|
+
* Drop the question this agent's last run paused to ask, on the record.
|
|
504
|
+
*
|
|
505
|
+
* A paused run is waiting on a person. Sending a different message while one
|
|
506
|
+
* is outstanding is refused ({@link PendingQuestionError}) because silently
|
|
507
|
+
* discarding a pending question makes a consent gate something any later
|
|
508
|
+
* message can walk around. When the question really is being dropped —
|
|
509
|
+
* the user changed the subject, the session timed out, the approval is no
|
|
510
|
+
* longer wanted — say so with this, and the next `run()` proceeds.
|
|
511
|
+
*
|
|
512
|
+
* Returns what was dropped (`undefined` when nothing was pending), so a
|
|
513
|
+
* caller can log or audit the abandonment rather than perform it blind. It
|
|
514
|
+
* does not touch the paused run's checkpoint: if you still hold that, it
|
|
515
|
+
* remains resumable.
|
|
516
|
+
*/
|
|
517
|
+
abandonPause(): {
|
|
518
|
+
readonly toolName?: string;
|
|
519
|
+
readonly toolCallId?: string;
|
|
520
|
+
readonly question?: string;
|
|
521
|
+
} | undefined;
|
|
522
|
+
/**
|
|
523
|
+
* Whether {@link Agent.selfExplain}'s why-questions have a run to answer
|
|
524
|
+
* from right now.
|
|
525
|
+
*
|
|
526
|
+
* `false` for two different reasons, both honest: this agent was not built
|
|
527
|
+
* with `.selfExplain()`, or it was and no turn has completed yet (evidence
|
|
528
|
+
* binds at the END of a run, never to the one in flight). Either way there
|
|
529
|
+
* is nothing to explain, which is what a caller routing a why-question needs
|
|
530
|
+
* to know before it routes.
|
|
531
|
+
*
|
|
532
|
+
* The model is told the same thing by the same fact — the trace tools answer
|
|
533
|
+
* "No completed run is available yet" and the skill body says to say so
|
|
534
|
+
* plainly. This is that answer, for the program.
|
|
535
|
+
*/
|
|
536
|
+
canExplain(): boolean;
|
|
387
537
|
/**
|
|
388
538
|
* Resume an agent run from a checkpoint produced by a prior
|
|
389
539
|
* `RunCheckpointError`. Unlike `agent.resume()` (which takes a
|
|
@@ -429,6 +579,13 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
429
579
|
* ```
|
|
430
580
|
*/
|
|
431
581
|
resumeOnError(checkpoint: AgentRunCheckpoint | unknown, options?: AgentRunOptions): Promise<AgentOutput | RunnerPauseOutcome>;
|
|
582
|
+
/**
|
|
583
|
+
* Which identity a continued turn runs under: the caller's if they named
|
|
584
|
+
* one, otherwise the conversation's own.
|
|
585
|
+
*
|
|
586
|
+
* @internal
|
|
587
|
+
*/
|
|
588
|
+
private identityFor;
|
|
432
589
|
/**
|
|
433
590
|
* Install a per-run checkpoint tracker. Listens for the agent's
|
|
434
591
|
* own iteration_end events on `this.dispatcher` and snapshots the
|
|
@@ -493,6 +650,64 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
493
650
|
* @internal
|
|
494
651
|
*/
|
|
495
652
|
private foldedSpansOf;
|
|
653
|
+
/**
|
|
654
|
+
* The two owner facts every conversation carrier stamps — who the run was
|
|
655
|
+
* for, and which agent ran it (9.2.0).
|
|
656
|
+
*
|
|
657
|
+
* One reader for `checkpoint()` and the crash checkpoint, the same rule
|
|
658
|
+
* `foldedSpansOf` follows: a fact kept on one carrier and lost on the other
|
|
659
|
+
* is worse than a fact kept on neither. Both are absent unless the caller
|
|
660
|
+
* chose them, which is what keeps the fingerprint refusal narrow and the
|
|
661
|
+
* default `conversationId` out of storage.
|
|
662
|
+
*
|
|
663
|
+
* @internal
|
|
664
|
+
*/
|
|
665
|
+
private conversationOwner;
|
|
666
|
+
/**
|
|
667
|
+
* Restore a stored conversation onto the side channel `seed` reads.
|
|
668
|
+
*
|
|
669
|
+
* THE one restoration path — `run({ continueFrom })` and `resumeOnError()`
|
|
670
|
+
* both come through here, so the conversation door and the error door cannot
|
|
671
|
+
* disagree about what continuing means. It checks the agent fingerprint,
|
|
672
|
+
* restores history + folded spans, and adopts the conversation's identity so
|
|
673
|
+
* the continued turn writes its memory where the earlier turns are.
|
|
674
|
+
*
|
|
675
|
+
* `appendMessage` is the difference between the two callers, and it is the
|
|
676
|
+
* whole difference. Continuing a conversation ADDS this turn's user message
|
|
677
|
+
* to the stored history; resuming after an error does NOT, because there the
|
|
678
|
+
* message is already the last user turn in that history and appending it
|
|
679
|
+
* would ask the same question twice.
|
|
680
|
+
*
|
|
681
|
+
* @internal
|
|
682
|
+
*/
|
|
683
|
+
private applyContinuation;
|
|
684
|
+
/** One turn at a time — see `RunInFlightError`. @internal */
|
|
685
|
+
private assertNotRunning;
|
|
686
|
+
/** A person's unanswered question outranks a new message — see
|
|
687
|
+
* `PendingQuestionError`. @internal */
|
|
688
|
+
private assertNoPendingQuestion;
|
|
689
|
+
/**
|
|
690
|
+
* Remember (or forget) the question this run ended on.
|
|
691
|
+
*
|
|
692
|
+
* A paused outcome sets it; anything else clears it, because a run that
|
|
693
|
+
* reached an answer has no outstanding question by definition. Reads the
|
|
694
|
+
* same `pauseData` fields `standingAgent.describePause` reads — the tool
|
|
695
|
+
* name and question the dispatch loop stamped — and invents nothing.
|
|
696
|
+
*
|
|
697
|
+
* @internal
|
|
698
|
+
*/
|
|
699
|
+
private recordPendingQuestion;
|
|
700
|
+
/**
|
|
701
|
+
* Hand the `.selfExplain()` binding to the agent that owns it.
|
|
702
|
+
*
|
|
703
|
+
* Called once by `AgentBuilder.build()`, immediately after `bindTo`. The
|
|
704
|
+
* binding stays the tool provider's to read; the Agent holds it only so
|
|
705
|
+
* `canExplain()` answers from the same fact the trace tools answer from,
|
|
706
|
+
* rather than from a second guess about whether a run has completed.
|
|
707
|
+
*
|
|
708
|
+
* @internal
|
|
709
|
+
*/
|
|
710
|
+
bindSelfExplain(binding: SelfExplainBinding): void;
|
|
496
711
|
/**
|
|
497
712
|
* Refuse, at run start, any declared messages-slot role this provider
|
|
498
713
|
* cannot carry inside its message list (7.21, D2).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../src/core/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,sBAAsB,EAI3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAExB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,m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;;;;;;OASG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;;;;;;;OASG;IACH,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIlD;;;;;;;;;;;;;;OAcG;IACH;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,YAAY;IAWpB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,iBAAiB;IA2BzB,OAAO,CAAC,sBAAsB;IAqC9B;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,+BAA+B;IAcvC,OAAO,CAAC,cAAc;IA6JtB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,CAAC,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAK3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,YAAY,IAAI,UAAU,CAAC,cAAc,CAAC;IAO1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,mBAAmB,IAAI,UAAU,CAAC,qBAAqB,CAAC;IAOxD,OAAO,CAAC,cAAc;IAqItB,OAAO,CAAC,UAAU;CAoTnB"}
|
|
@@ -158,7 +158,16 @@ export declare class LLMCall extends RunnerBase<LLMCallInput, LLMCallOutput> {
|
|
|
158
158
|
export declare class LLMCallBuilder {
|
|
159
159
|
private readonly opts;
|
|
160
160
|
private systemPromptValue;
|
|
161
|
+
/** Whether `.system()` has been called — see the refusal below for why the
|
|
162
|
+
* flag exists separately from the value. */
|
|
163
|
+
private systemPromptSet;
|
|
161
164
|
constructor(opts: LLMCallOptions);
|
|
165
|
+
/**
|
|
166
|
+
* Set the system prompt. Once per call — a second `.system()` used to
|
|
167
|
+
* REPLACE the first in silence, so the instructions written first were
|
|
168
|
+
* never sent and nothing said so. Join the parts yourself and pass one
|
|
169
|
+
* string.
|
|
170
|
+
*/
|
|
162
171
|
system(prompt: string):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