agentfootprint 9.26.0 → 9.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/adapters/google/aiPlatform.js +438 -0
  2. package/dist/adapters/google/aiPlatform.js.map +1 -0
  3. package/dist/adapters/hosting/googleAgentEngine.js +372 -0
  4. package/dist/adapters/hosting/googleAgentEngine.js.map +1 -0
  5. package/dist/adapters/identity/google.js +275 -0
  6. package/dist/adapters/identity/google.js.map +1 -0
  7. package/dist/adapters/memory/agentcore.js +19 -0
  8. package/dist/adapters/memory/agentcore.js.map +1 -1
  9. package/dist/adapters/memory/memoryBank.js +823 -0
  10. package/dist/adapters/memory/memoryBank.js.map +1 -0
  11. package/dist/core/agent/stages/routeTurn.js +13 -1
  12. package/dist/core/agent/stages/routeTurn.js.map +1 -1
  13. package/dist/esm/adapters/google/aiPlatform.d.ts +453 -0
  14. package/dist/esm/adapters/google/aiPlatform.js +424 -0
  15. package/dist/esm/adapters/google/aiPlatform.js.map +1 -0
  16. package/dist/esm/adapters/hosting/googleAgentEngine.d.ts +156 -0
  17. package/dist/esm/adapters/hosting/googleAgentEngine.js +368 -0
  18. package/dist/esm/adapters/hosting/googleAgentEngine.js.map +1 -0
  19. package/dist/esm/adapters/identity/google.d.ts +179 -0
  20. package/dist/esm/adapters/identity/google.js +271 -0
  21. package/dist/esm/adapters/identity/google.js.map +1 -0
  22. package/dist/esm/adapters/memory/agentcore.d.ts +19 -0
  23. package/dist/esm/adapters/memory/agentcore.js +19 -0
  24. package/dist/esm/adapters/memory/agentcore.js.map +1 -1
  25. package/dist/esm/adapters/memory/memoryBank.d.ts +390 -0
  26. package/dist/esm/adapters/memory/memoryBank.js +817 -0
  27. package/dist/esm/adapters/memory/memoryBank.js.map +1 -0
  28. package/dist/esm/core/agent/stages/routeTurn.js +13 -1
  29. package/dist/esm/core/agent/stages/routeTurn.js.map +1 -1
  30. package/dist/esm/events/payloads.d.ts +23 -0
  31. package/dist/esm/hosting-providers.d.ts +7 -0
  32. package/dist/esm/hosting-providers.js +6 -0
  33. package/dist/esm/hosting-providers.js.map +1 -1
  34. package/dist/esm/identity.d.ts +1 -0
  35. package/dist/esm/identity.js +5 -0
  36. package/dist/esm/identity.js.map +1 -1
  37. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +9 -0
  38. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  39. package/dist/esm/lib/injection-engine/routingPolicy.d.ts +8 -0
  40. package/dist/esm/lib/injection-engine/routingPolicy.js.map +1 -1
  41. package/dist/esm/lib/injection-engine/skillGraph.d.ts +11 -2
  42. package/dist/esm/lib/injection-engine/skillGraph.js +25 -1
  43. package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
  44. package/dist/esm/lib/injection-engine/skillIntent.d.ts +13 -5
  45. package/dist/esm/lib/injection-engine/skillIntent.js +12 -2
  46. package/dist/esm/lib/injection-engine/skillIntent.js.map +1 -1
  47. package/dist/esm/lib/injection-engine/skillMatch.d.ts +40 -0
  48. package/dist/esm/lib/injection-engine/skillMatch.js +60 -0
  49. package/dist/esm/lib/injection-engine/skillMatch.js.map +1 -1
  50. package/dist/esm/memory-providers.d.ts +1 -0
  51. package/dist/esm/memory-providers.js +7 -0
  52. package/dist/esm/memory-providers.js.map +1 -1
  53. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +4 -0
  54. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +4 -1
  55. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
  56. package/dist/esm/recorders/observability/commentary/artifactPhrases.d.ts +50 -0
  57. package/dist/esm/recorders/observability/commentary/artifactPhrases.js +88 -0
  58. package/dist/esm/recorders/observability/commentary/artifactPhrases.js.map +1 -0
  59. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +233 -9
  60. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  61. package/dist/hosting-providers.js +10 -1
  62. package/dist/hosting-providers.js.map +1 -1
  63. package/dist/identity.js +8 -1
  64. package/dist/identity.js.map +1 -1
  65. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +9 -0
  66. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  67. package/dist/lib/injection-engine/routingPolicy.js.map +1 -1
  68. package/dist/lib/injection-engine/skillGraph.js +25 -1
  69. package/dist/lib/injection-engine/skillGraph.js.map +1 -1
  70. package/dist/lib/injection-engine/skillIntent.js +12 -2
  71. package/dist/lib/injection-engine/skillIntent.js.map +1 -1
  72. package/dist/lib/injection-engine/skillMatch.js +61 -1
  73. package/dist/lib/injection-engine/skillMatch.js.map +1 -1
  74. package/dist/memory-providers.js +12 -1
  75. package/dist/memory-providers.js.map +1 -1
  76. package/dist/recorders/observability/AgentThinkingTraceRecorder.js +4 -1
  77. package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
  78. package/dist/recorders/observability/commentary/artifactPhrases.js +94 -0
  79. package/dist/recorders/observability/commentary/artifactPhrases.js.map +1 -0
  80. package/dist/recorders/observability/commentary/commentaryTemplates.js +233 -9
  81. package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  82. package/dist/types/adapters/google/aiPlatform.d.ts +454 -0
  83. package/dist/types/adapters/google/aiPlatform.d.ts.map +1 -0
  84. package/dist/types/adapters/hosting/googleAgentEngine.d.ts +157 -0
  85. package/dist/types/adapters/hosting/googleAgentEngine.d.ts.map +1 -0
  86. package/dist/types/adapters/identity/google.d.ts +180 -0
  87. package/dist/types/adapters/identity/google.d.ts.map +1 -0
  88. package/dist/types/adapters/memory/agentcore.d.ts +19 -0
  89. package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
  90. package/dist/types/adapters/memory/memoryBank.d.ts +391 -0
  91. package/dist/types/adapters/memory/memoryBank.d.ts.map +1 -0
  92. package/dist/types/core/agent/stages/routeTurn.d.ts.map +1 -1
  93. package/dist/types/events/payloads.d.ts +23 -0
  94. package/dist/types/events/payloads.d.ts.map +1 -1
  95. package/dist/types/hosting-providers.d.ts +7 -0
  96. package/dist/types/hosting-providers.d.ts.map +1 -1
  97. package/dist/types/identity.d.ts +1 -0
  98. package/dist/types/identity.d.ts.map +1 -1
  99. package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
  100. package/dist/types/lib/injection-engine/routingPolicy.d.ts +8 -0
  101. package/dist/types/lib/injection-engine/routingPolicy.d.ts.map +1 -1
  102. package/dist/types/lib/injection-engine/skillGraph.d.ts +11 -2
  103. package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
  104. package/dist/types/lib/injection-engine/skillIntent.d.ts +13 -5
  105. package/dist/types/lib/injection-engine/skillIntent.d.ts.map +1 -1
  106. package/dist/types/lib/injection-engine/skillMatch.d.ts +40 -0
  107. package/dist/types/lib/injection-engine/skillMatch.d.ts.map +1 -1
  108. package/dist/types/memory-providers.d.ts +1 -0
  109. package/dist/types/memory-providers.d.ts.map +1 -1
  110. package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts +4 -0
  111. package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -1
  112. package/dist/types/recorders/observability/commentary/artifactPhrases.d.ts +51 -0
  113. package/dist/types/recorders/observability/commentary/artifactPhrases.d.ts.map +1 -0
  114. package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
  115. package/package.json +24 -15
@@ -0,0 +1,454 @@
1
+ /**
2
+ * adapters/google/aiPlatform — the one place this package builds a Vertex AI
3
+ * REST client, names a Vertex resource, waits on a Vertex operation, or
4
+ * describes a Vertex failure.
5
+ *
6
+ * Three adapters sit on top of it — `agentEngineSessions`, `memoryBankStore`
7
+ * and (for its auth half only) `googleIdentity` — and none of them repeats any
8
+ * of the four things above. That is the whole reason this file exists: the AWS
9
+ * column learned, expensively, that a shim duplicated across three adapters is
10
+ * three places for the same wire fact to go stale, and only one of them gets
11
+ * fixed.
12
+ *
13
+ * ── Which client, and why THIS one ──────────────────────────────────────────
14
+ * `@googleapis/aiplatform` — the **split, per-API** discovery package (31.0.0,
15
+ * 27 MB) rather than the `googleapis` mega-package (174.0.1, 209 MB) that
16
+ * carries every Google API at once for the same generated code. Both were
17
+ * installed and measured before this was written.
18
+ *
19
+ * The gax/proto client (`@google-cloud/aiplatform`, 78 MB) was rejected on a
20
+ * fact rather than on size: its Memory Bank surface is **v1beta1 only**, while
21
+ * the REST **v1** surface is complete — `memories.purge` and `memories.rollback`
22
+ * exist at v1 and do not exist at v1beta1. One client, at the version that has
23
+ * everything, beats two clients at two versions.
24
+ *
25
+ * `@google-cloud/vertexai` is past its own announced removal date and is not
26
+ * loaded anywhere in this package, ever.
27
+ *
28
+ * ── The endpoint fact that is not in anybody's design doc ───────────────────
29
+ * The generated client defaults to `https://aiplatform.googleapis.com/` — the
30
+ * GLOBAL host. Reasoning engines, their sessions and their memories are
31
+ * **regional** resources. An adapter that accepts the default calls the wrong
32
+ * host and gets a 404 that reads exactly like "your resource does not exist".
33
+ * So {@link buildAiPlatformClient} always sets a regional `rootUrl`, derived
34
+ * from the same `location` that composes the resource name, and the surface pin
35
+ * asserts the default really is the global one so this comment cannot go stale
36
+ * quietly.
37
+ *
38
+ * ── Secrets ─────────────────────────────────────────────────────────────────
39
+ * {@link googleSdkFailure} is the `sdkFailure` law from the AWS identity
40
+ * adapter, re-aimed at a Gaxios error: the SDK's own message never comes
41
+ * through. It is not that a Vertex error always contains a secret — it is that
42
+ * a REST client echoes the request into failure text, our requests carry
43
+ * conversation state and access tokens, and an error message here reaches the
44
+ * model as a tool result AND rides the event stream to every sink attached.
45
+ * One echo publishes it to both at once.
46
+ */
47
+ /**
48
+ * One REST call's answer. The discovery clients wrap every response as
49
+ * `{ data }`, and that wrapper is part of the contract an injected `_client`
50
+ * has to honour.
51
+ */
52
+ export interface RestResponse<T> {
53
+ readonly data: T;
54
+ }
55
+ /** A long-running operation, as these adapters read it. */
56
+ export interface LongRunningOperation {
57
+ readonly name?: string | null;
58
+ readonly done?: boolean | null;
59
+ readonly error?: {
60
+ readonly code?: number | null;
61
+ readonly message?: string | null;
62
+ } | null;
63
+ readonly response?: Record<string, unknown> | null;
64
+ }
65
+ /** The `operations` sub-resource, which both collections carry identically. */
66
+ export interface OperationsApi {
67
+ /**
68
+ * Block server-side until the operation finishes or `timeout` elapses, then
69
+ * answer whatever state it is in.
70
+ *
71
+ * `wait` rather than a `get` poll loop: it is the operation the service
72
+ * publishes for exactly this, and it turns "poll every 200 ms for ten
73
+ * seconds" into one or two round trips. It may still answer un-done, so
74
+ * {@link awaitOperation} loops it against a deadline — a server-side wait is
75
+ * not a promise that the work is finished, and treating it as one is how an
76
+ * adapter reads a resource that is not there yet.
77
+ */
78
+ wait(params: {
79
+ name: string;
80
+ timeout?: string;
81
+ }): Promise<RestResponse<LongRunningOperation> | undefined>;
82
+ }
83
+ /** A Vertex `Session`, in the fields these adapters read or write. */
84
+ export interface VertexSession {
85
+ readonly name?: string | null;
86
+ readonly userId?: string | null;
87
+ readonly sessionState?: Record<string, unknown> | null;
88
+ readonly createTime?: string | null;
89
+ readonly updateTime?: string | null;
90
+ readonly expireTime?: string | null;
91
+ readonly ttl?: string | null;
92
+ }
93
+ /** The `sessions` collection. Every method here is pinned. */
94
+ export interface SessionsApi {
95
+ create(params: {
96
+ parent: string;
97
+ sessionId?: string;
98
+ requestBody: VertexSession;
99
+ }): Promise<RestResponse<LongRunningOperation> | undefined>;
100
+ get(params: {
101
+ name: string;
102
+ }): Promise<RestResponse<VertexSession> | undefined>;
103
+ patch(params: {
104
+ name: string;
105
+ updateMask?: string;
106
+ requestBody: VertexSession;
107
+ }): Promise<RestResponse<VertexSession> | undefined>;
108
+ delete(params: {
109
+ name: string;
110
+ }): Promise<RestResponse<LongRunningOperation> | undefined>;
111
+ list(params: {
112
+ parent: string;
113
+ filter?: string;
114
+ orderBy?: string;
115
+ pageSize?: number;
116
+ pageToken?: string;
117
+ }): Promise<RestResponse<{
118
+ sessions?: VertexSession[];
119
+ nextPageToken?: string | null;
120
+ }> | undefined>;
121
+ readonly operations: OperationsApi;
122
+ }
123
+ /** One typed metadata scalar. Memory Bank's metadata map is NOT free JSON. */
124
+ export interface VertexMemoryMetadataValue {
125
+ readonly stringValue?: string | null;
126
+ readonly doubleValue?: number | null;
127
+ readonly boolValue?: boolean | null;
128
+ readonly timestampValue?: string | null;
129
+ }
130
+ /** A Vertex `Memory`, in the fields these adapters read or write. */
131
+ export interface VertexMemory {
132
+ readonly name?: string | null;
133
+ readonly fact?: string | null;
134
+ readonly scope?: Record<string, string> | null;
135
+ readonly metadata?: Record<string, VertexMemoryMetadataValue> | null;
136
+ readonly createTime?: string | null;
137
+ readonly updateTime?: string | null;
138
+ readonly expireTime?: string | null;
139
+ readonly ttl?: string | null;
140
+ }
141
+ /** One row of a retrieval answer — and the whole ranking trap in two fields. */
142
+ export interface VertexRetrievedMemory {
143
+ /**
144
+ * **A DISTANCE. Smaller is closer.** The SDK's own words for this field are
145
+ * "the distance between the query and the retrieved Memory. Smaller values
146
+ * indicate more similar memories."
147
+ *
148
+ * The port's `ScoredEntry.score` is a cosine similarity, where HIGHER is
149
+ * closer. These two facts are the silent-inversion trap this column was
150
+ * warned about, and the type says so here so that nothing downstream can
151
+ * copy it into a `score` field by looking only at its shape.
152
+ *
153
+ * Only set when similarity search was used; a simple retrieval has no
154
+ * ranking at all and reports none.
155
+ */
156
+ readonly distance?: number | null;
157
+ readonly memory?: VertexMemory;
158
+ }
159
+ /** The `memories` collection. Every method here is pinned. */
160
+ export interface MemoriesApi {
161
+ create(params: {
162
+ parent: string;
163
+ memoryId?: string;
164
+ requestBody: VertexMemory;
165
+ }): Promise<RestResponse<LongRunningOperation> | undefined>;
166
+ get(params: {
167
+ name: string;
168
+ }): Promise<RestResponse<VertexMemory> | undefined>;
169
+ patch(params: {
170
+ name: string;
171
+ updateMask?: string;
172
+ requestBody: VertexMemory;
173
+ }): Promise<RestResponse<LongRunningOperation> | undefined>;
174
+ delete(params: {
175
+ name: string;
176
+ }): Promise<RestResponse<LongRunningOperation> | undefined>;
177
+ list(params: {
178
+ parent: string;
179
+ filter?: string;
180
+ pageSize?: number;
181
+ pageToken?: string;
182
+ }): Promise<RestResponse<{
183
+ memories?: VertexMemory[];
184
+ nextPageToken?: string | null;
185
+ }> | undefined>;
186
+ retrieve(params: {
187
+ parent: string;
188
+ requestBody: {
189
+ scope: Record<string, string>;
190
+ similaritySearchParams?: {
191
+ searchQuery: string;
192
+ topK?: number;
193
+ };
194
+ simpleRetrievalParams?: {
195
+ pageSize?: number;
196
+ pageToken?: string;
197
+ };
198
+ };
199
+ }): Promise<RestResponse<{
200
+ retrievedMemories?: VertexRetrievedMemory[];
201
+ nextPageToken?: string | null;
202
+ }> | undefined>;
203
+ readonly operations: OperationsApi;
204
+ }
205
+ /**
206
+ * The shape both adapters call, and the shape an injected `_client` must have.
207
+ *
208
+ * It is the SDK's own nesting rather than a flattened convenience surface, on
209
+ * purpose: the surface pin walks these exact property paths against the really
210
+ * installed package, and a flattened shim would move the names being checked
211
+ * out of the file that does the calling.
212
+ */
213
+ export interface AiPlatformClientLike {
214
+ readonly projects: {
215
+ readonly locations: {
216
+ readonly reasoningEngines: {
217
+ readonly sessions: SessionsApi;
218
+ readonly memories: MemoriesApi;
219
+ };
220
+ };
221
+ };
222
+ }
223
+ /** The slice of `@googleapis/aiplatform` this module loads. */
224
+ export interface AiPlatformSdkModule {
225
+ readonly aiplatform?: (options: {
226
+ version: string;
227
+ rootUrl?: string;
228
+ auth?: unknown;
229
+ }) => AiPlatformClientLike;
230
+ readonly auth?: {
231
+ readonly GoogleAuth?: new (options: unknown) => unknown;
232
+ };
233
+ }
234
+ /**
235
+ * The API version every adapter in this column dials, **stated rather than
236
+ * defaulted**.
237
+ *
238
+ * v1, not v1beta1, and that is a decision with evidence behind it: at v1 the
239
+ * memories collection carries `purge` and `rollback`; at v1beta1 it does not.
240
+ * The Google column's pin asserts this against the installed package on every
241
+ * test run, because "which version does this really call" is the question that
242
+ * made the pin exist.
243
+ */
244
+ export declare const AI_PLATFORM_API_VERSION: "v1";
245
+ /** The OAuth scope every Vertex data-plane call needs. */
246
+ export declare const CLOUD_PLATFORM_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
247
+ /** What every adapter in this column needs to reach one reasoning engine. */
248
+ export interface AiPlatformConnection {
249
+ /**
250
+ * The Google Cloud project. Read from `GOOGLE_CLOUD_PROJECT` when omitted;
251
+ * refused by name when neither is available, because a project guessed wrong
252
+ * is a 404 that reads like a missing resource.
253
+ */
254
+ readonly project?: string;
255
+ /**
256
+ * The region, e.g. `'us-central1'`. **Load-bearing twice over:** it composes
257
+ * the resource name AND selects the regional host. There is no default — a
258
+ * guess here calls the wrong continent.
259
+ */
260
+ readonly location: string;
261
+ /**
262
+ * The reasoning engine these sessions or memories live under: either the
263
+ * bare id (`'1234567890'`) or a full resource name
264
+ * (`'projects/p/locations/l/reasoningEngines/1234567890'`), in which case
265
+ * the project and location are read from it and need not be repeated.
266
+ *
267
+ * A reasoning engine resource is REQUIRED even when you deploy no code to
268
+ * it: sessions and memories are children of it, and there is nowhere else to
269
+ * put them. Creating one is a control-plane job this library does not do.
270
+ */
271
+ readonly reasoningEngine: string;
272
+ /**
273
+ * Credentials. Anything the discovery client accepts — a `GoogleAuth`, an
274
+ * `OAuth2Client`, an `Impersonated`. Omit and Application Default
275
+ * Credentials are used with the cloud-platform scope, which is the ordinary
276
+ * path on Cloud Run, GKE, or a developer machine that has run
277
+ * `gcloud auth application-default login`.
278
+ */
279
+ readonly auth?: unknown;
280
+ /**
281
+ * @internal Test seam — a pre-built client. Skips the SDK load entirely, so
282
+ * a suite never needs the package installed or a credential configured.
283
+ */
284
+ readonly _client?: AiPlatformClientLike;
285
+ /** @internal Test seam — the SDK module, to exercise the real construction. */
286
+ readonly _sdk?: AiPlatformSdkModule;
287
+ }
288
+ /** A resolved engine: the parent resource name, plus the pieces it was built from. */
289
+ export interface EngineScope {
290
+ readonly project: string;
291
+ readonly location: string;
292
+ readonly engineId: string;
293
+ /** `projects/{project}/locations/{location}/reasoningEngines/{engine}` */
294
+ readonly parent: string;
295
+ }
296
+ /**
297
+ * Work out which reasoning engine this adapter talks to, from either spelling
298
+ * of `reasoningEngine`.
299
+ *
300
+ * A full resource name wins over `project` / `location` and is CHECKED against
301
+ * them rather than silently overriding: two spellings of one fact that could
302
+ * disagree is the same law the builder refuses `agent` beside `agentFactory`
303
+ * under, and a name that says `us-central1` under a config that says
304
+ * `europe-west4` is a bug somebody should be told about, not arbitrated.
305
+ */
306
+ export declare function resolveEngine(adapter: string, connection: AiPlatformConnection): EngineScope;
307
+ /**
308
+ * The regional host for a location.
309
+ *
310
+ * See the module header: the client's own default is the global host, and
311
+ * these resources are regional. This is the fix, in one line, applied at every
312
+ * construction.
313
+ */
314
+ export declare function regionalRootUrl(location: string): string;
315
+ /**
316
+ * Build the REST client, or refuse by name.
317
+ *
318
+ * An injected `_client` short-circuits everything below it, which is how every
319
+ * test in this column runs with no package installed and no credential.
320
+ */
321
+ export declare function buildAiPlatformClient(adapter: string, connection: AiPlatformConnection, scope: EngineScope): AiPlatformClientLike;
322
+ /** How long {@link awaitOperation} keeps waiting before it refuses, by default. */
323
+ export declare const DEFAULT_OPERATION_TIMEOUT_MS = 30000;
324
+ /**
325
+ * Wait for a long-running operation to finish, or refuse by name.
326
+ *
327
+ * ── Why any of this exists ──────────────────────────────────────────────────
328
+ * `sessions.create`, `sessions.delete`, `memories.create`, `memories.patch`
329
+ * and `memories.delete` **all answer with an Operation, not with the resource**
330
+ * — verified against the installed package's own return types before a line of
331
+ * either adapter was written. `get`, `list`, `patch`-on-a-session and
332
+ * `retrieve` are the synchronous ones.
333
+ *
334
+ * That asymmetry is the trap: a `put` that returns as soon as the service
335
+ * accepts the request, followed by a `get`, is a race that passes on a warm
336
+ * day and fails under load — and fails by answering "no data", which is
337
+ * indistinguishable from the truth. So every write in this column goes through
338
+ * here and does not return until the service says `done`.
339
+ *
340
+ * An operation that finished with an error is raised as one. The operation's
341
+ * own message is a Google-side description of OUR request, so it is subject to
342
+ * the same secrecy law as everything else here: the code comes through, the
343
+ * text does not.
344
+ */
345
+ export declare function awaitOperation(adapter: string, operations: OperationsApi, operation: LongRunningOperation | undefined, what: string, timeoutMs?: number): Promise<void>;
346
+ /**
347
+ * The name every refusal from this function carries.
348
+ *
349
+ * It exists so a caller's `catch` can tell "the operation went wrong" — which
350
+ * is already sanitized and already says what to do — apart from "the transport
351
+ * went wrong", which still needs {@link googleSdkFailure} run over it. Without
352
+ * the distinction an adapter re-wraps its own refusal and replaces a precise
353
+ * diagnosis ("did not finish within 30000ms") with a generic one.
354
+ */
355
+ export declare const OPERATION_ERROR_NAME = "GoogleOperationError";
356
+ /**
357
+ * Has this error already been sanitized by this module? Used by every adapter's
358
+ * `catch` so a refusal is reported once rather than wrapped twice.
359
+ */
360
+ export declare function isSanitizedGoogleError(err: unknown): boolean;
361
+ /**
362
+ * Re-raise a failed REST call **without its text** — the `sdkFailure` law from
363
+ * the AWS identity adapter, re-aimed at a Gaxios error.
364
+ *
365
+ * What comes through is the part that is both safe and actionable: which
366
+ * operation failed and the HTTP status. What does not is the message, because
367
+ * a REST client echoes the request into its failure text and these requests
368
+ * carry a whole conversation's state, a user id, and an access token in the
369
+ * headers. A thrown message here reaches the LLM as a tool result AND rides the
370
+ * event stream to every sink attached to the agent.
371
+ *
372
+ * **The original is deliberately not attached as `cause`** — a cause travels
373
+ * with the error into every serializer that walks own properties, which would
374
+ * undo all of this in one `JSON.stringify`.
375
+ */
376
+ export declare function googleSdkFailure(adapter: string, operation: string, err: unknown): Error;
377
+ /**
378
+ * The HTTP status of a failed call, wherever this client happened to put it.
379
+ *
380
+ * Three places rather than one because the client reports a transport failure,
381
+ * an API error and a thrown `GaxiosError` slightly differently, and a
382
+ * classification that only reads one of them silently stops classifying the
383
+ * day the client is upgraded.
384
+ */
385
+ export declare function httpStatusOf(err: unknown): number | undefined;
386
+ /** Is this the service's "no such resource"? */
387
+ export declare function isNotFound(err: unknown): boolean;
388
+ /** Is this "a resource by that name already exists"? */
389
+ export declare function isAlreadyExists(err: unknown): boolean;
390
+ /** The longest a resource id may be in both collections this column writes to. */
391
+ export declare const MAX_RESOURCE_ID_LENGTH = 63;
392
+ /**
393
+ * The id grammar this column really has to satisfy — the INTERSECTION of the
394
+ * two documented rules, so one function is right for both callers and neither
395
+ * has to remember which is stricter: `[a-z0-9-]`, first character a letter,
396
+ * last character a letter or a digit.
397
+ *
398
+ * Exported so the surface pin can hold it against the installed package's own
399
+ * words rather than against this file's memory of them.
400
+ */
401
+ export declare const LEGAL_RESOURCE_ID: RegExp;
402
+ /**
403
+ * Turn caller data into a resource id the service will accept — and never into
404
+ * a DIFFERENT caller's id.
405
+ *
406
+ * ── The grammar, quoted rather than guessed ─────────────────────────────────
407
+ * This function used to state that "Vertex resource ids accept `[A-Za-z0-9_-]`".
408
+ * That is a Google-wide habit and it is not what either collection this column
409
+ * writes to documents. From the installed package (`@googleapis/aiplatform`
410
+ * 31.0.0, `build/v1.d.ts`), verbatim:
411
+ *
412
+ * `memoryId` — "This value may be up to 63 characters, and valid characters
413
+ * are `[a-z0-9-]`. The first character must be a letter, and
414
+ * the last character must be a letter or number."
415
+ * `sessionId` — "This value may be up to 63 characters, and valid characters
416
+ * are `[a-z0-9-]`. The first and last characters must be a
417
+ * letter or number."
418
+ *
419
+ * So UPPERCASE and `_` are illegal in both, and a leading digit is illegal for
420
+ * a memory. Under the old grammar a UUID entry id (leading digit) and a ULID
421
+ * session id (uppercase Crockford base32) — two of the most ordinary id shapes
422
+ * there are — went to the wire unchanged, to be refused by Google with a 400
423
+ * whose text {@link googleSdkFailure} then withholds. A grammar error the
424
+ * adapter could have caught locally, delivered as a censored 400, is the one
425
+ * place the secrecy law and the teaching-refusal law collide; the fix is to not
426
+ * send it. The surface pin reads those two sentences out of the installed
427
+ * `.d.ts` and checks them against {@link LEGAL_RESOURCE_ID}, so this cannot
428
+ * drift back to a guess.
429
+ *
430
+ * ── Why a hash and not just a fold ──────────────────────────────────────────
431
+ * Lowercasing and substituting are LOSSY: `Alice` folds onto `alice`, `a_b`
432
+ * onto `a-b`. Two ids that folded together would be ONE row, which is the same
433
+ * silent overwrite this column's addressing law exists to prevent. So the
434
+ * readable fast path is taken only when the caller's id already is a legal id
435
+ * byte for byte; anything the fold touched — or that overruns 63 characters —
436
+ * is carried by a {@link fingerprint} of the ORIGINAL, which keeps distinct
437
+ * inputs distinct.
438
+ */
439
+ export declare function safeResourceId(raw: string, max?: number): string;
440
+ /**
441
+ * A stable fingerprint of a string, in `[0-9a-z-]`.
442
+ *
443
+ * TWO FNV-1a lanes rather than one, because of what this hash is now asked to
444
+ * carry: it is the only thing keeping two ids apart once the fold has run them
445
+ * together, and it is half of how `memoryBankStore` addresses one identity's
446
+ * memories apart from another's. A single 32-bit lane collides at around one
447
+ * chance in a hundred across ten thousand ids, which is too often for either
448
+ * job; two lanes cost one more multiply per character and make it negligible.
449
+ *
450
+ * It is a fingerprint, not a security boundary — a colliding address is still
451
+ * refused by the scope check that runs before every read and every overwrite.
452
+ */
453
+ export declare function fingerprint(value: string): string;
454
+ //# sourceMappingURL=aiPlatform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiPlatform.d.ts","sourceRoot":"","sources":["../../../../src/adapters/google/aiPlatform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAMH;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;CAClB;AAED,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAA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ClF,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,QAAsC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAyB,GAAG,MAAM,CAqBhF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASjD"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * agentEngineSessions — conversations in Vertex AI's own session service, so a
3
+ * fleet shares them.
4
+ *
5
+ * `memorySessions()` loses everything on restart and says so. `sqliteSessions()`
6
+ * survives a restart on ONE machine and says so. The row above both — *many
7
+ * containers, one conversation* — is where a managed session service belongs,
8
+ * and on this column that service is the `sessions` collection under a
9
+ * reasoning engine.
10
+ *
11
+ * ── The name, said once ─────────────────────────────────────────────────────
12
+ * The product was **Agent Engine**, is now **Agent Runtime**, and the API
13
+ * resource is still spelled `reasoningEngines`. This factory keeps the name it
14
+ * was designed under; where the product name and the API disagree, the API is
15
+ * the one that has not moved.
16
+ *
17
+ * ── The fit, and it is a good one ───────────────────────────────────────────
18
+ * `Session.sessionState` is an arbitrary JSON `Struct`. A `CheckpointEnvelope`
19
+ * is arbitrary JSON. So the envelope goes in whole, under one key, and comes
20
+ * back whole — no event log to fold, no blob encoding to get wrong, no
21
+ * per-turn append. That is a materially better fit than the other column's
22
+ * session store, which had to learn the hard way that an object handed to an
23
+ * event blob comes back as somebody else's `toString()`.
24
+ *
25
+ * ── The four facts that shaped the code, all read off the installed SDK ─────
26
+ * 1. **`sessions.create` takes a caller-supplied `sessionId`.** So our session
27
+ * id IS the resource id and `hydrate` is one `get` by name. No mapping
28
+ * table, no listing to find a conversation.
29
+ * 2. **`create` and `delete` answer a long-running Operation; `get` and
30
+ * `patch` answer the Session.** Every write here therefore waits for the
31
+ * operation to report `done` before it returns — a `persist` that returned
32
+ * early would make the very next `hydrate` a race whose failure mode is
33
+ * "no conversation", which nobody can tell from a new user.
34
+ * 3. **`Session.userId` is required and immutable.** Our port's
35
+ * `persist(sessionId, envelope)` carries no user, so one has to be
36
+ * resolved — see {@link AgentEngineSessionsOptions.userId}. Immutable
37
+ * means the first write decides forever, which is exactly the ownership
38
+ * rule this library already enforces in its own stores; here the service
39
+ * enforces it for us.
40
+ * 4. **`ttl` is input-only with a 24-hour floor**, and `expireTime` always
41
+ * comes back. Sliding expiry is free; an hour-long TTL is not available at
42
+ * any price.
43
+ *
44
+ * ── The laws it inherits rather than re-implements ──────────────────────────
45
+ * `checkEnvelope` runs on the way OUT and on the way IN, so an envelope whose
46
+ * `format` this runtime does not know is refused by name, and a session that
47
+ * is PRESENT but unreadable is refused by name too. Only a session that was
48
+ * never written hydrates as `undefined`. A conversation that exists and cannot
49
+ * be read must never be answered with a fresh start — that failure is
50
+ * indistinguishable, from the outside, from a brand-new user.
51
+ */
52
+ import type { CheckpointEnvelope, SessionLifecycle } from '../../hosting/types.js';
53
+ import { type AiPlatformConnection } from '../google/aiPlatform.js';
54
+ /**
55
+ * The `sessionState` key the envelope lives under.
56
+ *
57
+ * One key, namespaced, rather than spreading the envelope's own fields across
58
+ * `sessionState`: the struct belongs to whoever owns the reasoning engine, an
59
+ * agent framework is a guest in it, and a guest that scatters `format` and
60
+ * `data` at the top level collides with the next guest. Namespacing also makes
61
+ * the console readable — one entry that says whose it is.
62
+ */
63
+ export declare const SESSION_STATE_KEY = "agentfootprint.envelope";
64
+ /** Options for {@link agentEngineSessions}. */
65
+ export interface AgentEngineSessionsOptions extends AiPlatformConnection {
66
+ /**
67
+ * WHO a session belongs to — required by the service on create, and
68
+ * **immutable** once written.
69
+ *
70
+ * The port hands `persist` a session id and an envelope, never a user, so
71
+ * this is where the missing half comes from. Two spellings:
72
+ *
73
+ * - a **function**, called with the session id and the envelope about to be
74
+ * stored. The recommended shape: return `envelopeOwner(envelope)` — the
75
+ * principal the conversation itself was signed with — so the service's
76
+ * idea of the owner and this library's own ownership index agree by
77
+ * construction rather than by coincidence. That is what the default does.
78
+ * - a **string**, when every conversation in this engine belongs to one
79
+ * service identity. Honest for a single-tenant deployment and wrong the
80
+ * moment it is not, which is why it is not the default.
81
+ *
82
+ * The default resolver reads the envelope's own principal and falls back to
83
+ * {@link DEFAULT_USER_ID} for a conversation that ran anonymously. It never
84
+ * invents a per-session user id: the service treats `userId` as the thing
85
+ * you filter a listing by, and minting a unique one per session would make
86
+ * every listing return exactly one row and look like it worked.
87
+ */
88
+ readonly userId?: string | ((sessionId: string, envelope: CheckpointEnvelope) => string);
89
+ /**
90
+ * How long a session lives after its last write, as a duration string the
91
+ * API accepts (`'86400s'`). **The service's own floor is 24 hours** and it
92
+ * rejects anything shorter, so this is a knob for keeping conversations
93
+ * LONGER, never for expiring them sooner.
94
+ *
95
+ * Omit and no `ttl` is sent, which leaves the service's own default
96
+ * expiry in charge.
97
+ */
98
+ readonly ttl?: string;
99
+ /**
100
+ * How long a write waits for its long-running operation before refusing.
101
+ * Default {@link DEFAULT_OPERATION_TIMEOUT_MS} (30s).
102
+ *
103
+ * It refuses rather than returning: a `persist` that reported success on an
104
+ * operation it never saw finish is a conversation that may or may not be
105
+ * there next turn.
106
+ */
107
+ readonly operationTimeoutMs?: number;
108
+ }
109
+ /** What a conversation that named nobody is stored under. */
110
+ export declare const DEFAULT_USER_ID = "agentfootprint-anonymous";
111
+ /**
112
+ * A session store in Vertex AI's session service.
113
+ *
114
+ * It is a {@link SessionLifecycle} plus the two things a real store owns beyond
115
+ * the port — forgetting, and closing — because the port deliberately asks for
116
+ * two methods and leaves the rest to whoever implements it.
117
+ */
118
+ export interface AgentEngineSessions extends SessionLifecycle {
119
+ /** The resource these sessions live under. Useful in an incident. */
120
+ readonly parent: string;
121
+ /** Forget one session. A session that was never there is not an error. */
122
+ forget(sessionId: string): Promise<void>;
123
+ /**
124
+ * Stop using this store. Idempotent, and **final** — reading or writing
125
+ * afterwards refuses by name rather than quietly reconnecting, because a
126
+ * store that reopened behind you would hide a shutdown-ordering bug instead
127
+ * of surfacing it.
128
+ *
129
+ * Nothing is torn down on Google's side: the sessions outlive this process,
130
+ * which is the entire reason to use a managed store.
131
+ */
132
+ close(): void;
133
+ }
134
+ /**
135
+ * Conversations in Vertex AI's session service — the store that survives a
136
+ * fleet, not just a restart.
137
+ *
138
+ * **Status: contract-shaped and tested; awaiting field use.** Every call is
139
+ * exercised through an injected client and pinned against the really-installed
140
+ * SDK. None of it has yet answered a request from Google in a real project.
141
+ *
142
+ * @example A standing agent whose conversations are shared across instances
143
+ * import { standingAgent, nodeHost } from 'agentfootprint/hosting';
144
+ * import { agentEngineSessions } from 'agentfootprint/hosting';
145
+ *
146
+ * const handle = await standingAgent({
147
+ * agentFactory: () => buildAgent(),
148
+ * host: nodeHost({ port: 8080 }),
149
+ * sessions: agentEngineSessions({
150
+ * project: 'my-project',
151
+ * location: 'us-central1',
152
+ * reasoningEngine: '1234567890',
153
+ * }),
154
+ * });
155
+ */
156
+ export declare function agentEngineSessions(options: AgentEngineSessionsOptions): AgentEngineSessions;
157
+ //# sourceMappingURL=googleAgentEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"googleAgentEngine.d.ts","sourceRoot":"","sources":["../../../../src/adapters/hosting/googleAgentEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAUL,KAAK,oBAAoB,EAI1B,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAE3D,+CAA+C;AAC/C,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACtE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,KAAK,MAAM,CAAC,CAAC;IACzF;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,6DAA6D;AAC7D,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;;;;;OAQG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CA0M5F"}