agentfootprint 9.28.0 → 9.30.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 +3 -2
- package/dist/adapters/google/aiPlatform.js +23 -1
- package/dist/adapters/google/aiPlatform.js.map +1 -1
- package/dist/adapters/hosting/googleAgentEngine.js +180 -61
- package/dist/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/adapters/identity/google.js +18 -4
- package/dist/adapters/identity/google.js.map +1 -1
- package/dist/adapters/llm/GeminiProvider.js +198 -36
- package/dist/adapters/llm/GeminiProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +66 -2
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/googleGenAI.js +155 -8
- package/dist/adapters/llm/googleGenAI.js.map +1 -1
- package/dist/adapters/memory/memoryBank.js +250 -6
- package/dist/adapters/memory/memoryBank.js.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/artifacts/gcsArtifacts.js +21 -5
- package/dist/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/embedders/index.js +8 -6
- package/dist/embedders/index.js.map +1 -1
- package/dist/esm/adapters/google/aiPlatform.d.ts +44 -0
- package/dist/esm/adapters/google/aiPlatform.js +23 -1
- package/dist/esm/adapters/google/aiPlatform.js.map +1 -1
- package/dist/esm/adapters/hosting/googleAgentEngine.d.ts +104 -18
- package/dist/esm/adapters/hosting/googleAgentEngine.js +179 -60
- package/dist/esm/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/esm/adapters/identity/google.d.ts +18 -4
- package/dist/esm/adapters/identity/google.js +18 -4
- package/dist/esm/adapters/identity/google.js.map +1 -1
- package/dist/esm/adapters/llm/GeminiProvider.d.ts +96 -15
- package/dist/esm/adapters/llm/GeminiProvider.js +199 -37
- package/dist/esm/adapters/llm/GeminiProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +34 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js +66 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/googleGenAI.d.ts +105 -4
- package/dist/esm/adapters/llm/googleGenAI.js +152 -7
- package/dist/esm/adapters/llm/googleGenAI.js.map +1 -1
- package/dist/esm/adapters/memory/memoryBank.d.ts +42 -3
- package/dist/esm/adapters/memory/memoryBank.js +249 -5
- package/dist/esm/adapters/memory/memoryBank.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +27 -0
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/artifacts/gcsArtifacts.d.ts +21 -5
- package/dist/esm/artifacts/gcsArtifacts.js +21 -5
- package/dist/esm/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +1 -0
- package/dist/esm/embedders/index.js +9 -7
- package/dist/esm/embedders/index.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +22 -0
- package/dist/esm/hosting-providers.d.ts +4 -2
- package/dist/esm/hosting-providers.js +4 -2
- package/dist/esm/hosting-providers.js.map +1 -1
- package/dist/esm/memory-providers.d.ts +1 -1
- package/dist/esm/memory-providers.js +4 -2
- package/dist/esm/memory-providers.js.map +1 -1
- package/dist/esm/providers.js.map +1 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +5 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +44 -3
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/hosting-providers.js +5 -2
- package/dist/hosting-providers.js.map +1 -1
- package/dist/memory-providers.js +5 -2
- package/dist/memory-providers.js.map +1 -1
- package/dist/providers.js.map +1 -1
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js +5 -1
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/recorders/observability/commentary/commentaryTemplates.js +44 -3
- package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/types/adapters/google/aiPlatform.d.ts +44 -0
- package/dist/types/adapters/google/aiPlatform.d.ts.map +1 -1
- package/dist/types/adapters/hosting/googleAgentEngine.d.ts +104 -18
- package/dist/types/adapters/hosting/googleAgentEngine.d.ts.map +1 -1
- package/dist/types/adapters/identity/google.d.ts +18 -4
- package/dist/types/adapters/identity/google.d.ts.map +1 -1
- package/dist/types/adapters/llm/GeminiProvider.d.ts +96 -15
- package/dist/types/adapters/llm/GeminiProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +34 -2
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/googleGenAI.d.ts +105 -4
- package/dist/types/adapters/llm/googleGenAI.d.ts.map +1 -1
- package/dist/types/adapters/memory/memoryBank.d.ts +42 -3
- package/dist/types/adapters/memory/memoryBank.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +27 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/artifacts/gcsArtifacts.d.ts +21 -5
- package/dist/types/artifacts/gcsArtifacts.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +1 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/embedders/index.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +22 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/hosting-providers.d.ts +4 -2
- package/dist/types/hosting-providers.d.ts.map +1 -1
- package/dist/types/memory-providers.d.ts +1 -1
- package/dist/types/memory-providers.d.ts.map +1 -1
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -14,32 +14,83 @@
|
|
|
14
14
|
* was designed under; where the product name and the API disagree, the API is
|
|
15
15
|
* the one that has not moved.
|
|
16
16
|
*
|
|
17
|
-
* ── The fit, and
|
|
17
|
+
* ── The fit, and the one thing it cost ──────────────────────────────────────
|
|
18
18
|
* `Session.sessionState` is an arbitrary JSON `Struct`. A `CheckpointEnvelope`
|
|
19
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
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* event blob comes back as somebody else's `toString()`.
|
|
20
|
+
* back whole — no event log to fold, no blob encoding to get wrong. What it
|
|
21
|
+
* cost is the WRITE VERB, and that took a field trial to learn: state goes in
|
|
22
|
+
* through an appended EVENT, never through a patch. See fact 2b below.
|
|
24
23
|
*
|
|
25
|
-
* ── The
|
|
24
|
+
* ── The five facts that shaped the code ─────────────────────────────────────
|
|
26
25
|
* 1. **`sessions.create` takes a caller-supplied `sessionId`.** So our session
|
|
27
26
|
* id IS the resource id and `hydrate` is one `get` by name. No mapping
|
|
28
27
|
* table, no listing to find a conversation.
|
|
29
28
|
* 2. **`create` and `delete` answer a long-running Operation; `get` and
|
|
30
|
-
* `
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* `appendEvent` answer directly.** Every operation-shaped write here waits
|
|
30
|
+
* for `done` before it returns — a `persist` that returned early would make
|
|
31
|
+
* the very next `hydrate` a race whose failure mode is "no conversation",
|
|
32
|
+
* which nobody can tell from a new user.
|
|
33
|
+
*
|
|
34
|
+
* 2b. **`sessionState` CANNOT be patched. This one is field truth, and it cost
|
|
35
|
+
* a release.** 9.29.0 wrote the steady state as
|
|
36
|
+
* `sessions.patch({ updateMask: 'sessionState,ttl' })`, which every
|
|
37
|
+
* injected-client test accepted because a double will patch anything. An
|
|
38
|
+
* independent field trial ran it against the live service (2026-08-14) and
|
|
39
|
+
* found that turn one stored and **every later turn failed**:
|
|
40
|
+
*
|
|
41
|
+
* HTTP 400 — "Can't update the session state for session …, you can only
|
|
42
|
+
* update it by appending an event."
|
|
43
|
+
*
|
|
44
|
+
* A store that keeps the first turn of a conversation and refuses the
|
|
45
|
+
* second is not a session store, so the verb changed rather than the
|
|
46
|
+
* documentation: `persist` now appends a `SessionEvent` whose
|
|
47
|
+
* `actions.stateDelta` carries the envelope, which the same trial verified
|
|
48
|
+
* end to end (append accepted, `GET` returned the new state).
|
|
49
|
+
*
|
|
50
|
+
* Two consequences worth saying out loud, because they are the difference
|
|
51
|
+
* between this fix and a plausible-looking one:
|
|
52
|
+
*
|
|
53
|
+
* • **A state delta MERGES by top-level key.** This store writes exactly
|
|
54
|
+
* one key — {@link SESSION_STATE_KEY} — so "merge the delta" and
|
|
55
|
+
* "replace our key" are the same outcome for us, and another guest's
|
|
56
|
+
* keys under the same session are left alone either way.
|
|
57
|
+
* • **A conversation now has an event log behind it**, one event per
|
|
58
|
+
* persisted turn, because that is the only writing surface the service
|
|
59
|
+
* offers. Nothing here READS that log — `hydrate` still reads the one
|
|
60
|
+
* envelope out of `sessionState` — so the log is the service's audit
|
|
61
|
+
* trail of our writes and never a second copy of the truth. Sessions
|
|
62
|
+
* are per-conversation and events are small; if that growth matters to
|
|
63
|
+
* you, `forget()` deletes the session and its events together.
|
|
34
64
|
* 3. **`Session.userId` is required and immutable.** Our port's
|
|
35
65
|
* `persist(sessionId, envelope)` carries no user, so one has to be
|
|
36
66
|
* resolved — see {@link AgentEngineSessionsOptions.userId}. Immutable
|
|
37
|
-
* means the first write decides forever, which is
|
|
38
|
-
*
|
|
39
|
-
*
|
|
67
|
+
* means the first write decides forever, which is the same ownership rule
|
|
68
|
+
* this library enforces in its own stores.
|
|
69
|
+
*
|
|
70
|
+
* **It is metadata, not authorization, and a field trial proved it.** Two
|
|
71
|
+
* sessions were created under `alice` and `bob`; the project's ordinary ADC
|
|
72
|
+
* principal then read BOTH by name, presenting neither end-user identity
|
|
73
|
+
* (FINDINGS "Native Agent Runtime Sessions"). `userId` is what a listing
|
|
74
|
+
* filters on and what a first write pins — it is not a check the service
|
|
75
|
+
* performs on a read. So the sentence "here the service enforces it for us"
|
|
76
|
+
* would be false: anyone who can call the API with your project's
|
|
77
|
+
* credentials and can guess a session id can read that conversation.
|
|
78
|
+
*
|
|
79
|
+
* Where the check belongs is above this port, and this library already has
|
|
80
|
+
* it: `envelopeOwner` records who a conversation belongs to, and the
|
|
81
|
+
* host/gateway is what must compare that to the authenticated caller
|
|
82
|
+
* before handing a session id down here. This adapter is a STORE. Nothing
|
|
83
|
+
* that only stores can tell an impostor from an owner.
|
|
40
84
|
* 4. **`ttl` is input-only with a 24-hour floor**, and `expireTime` always
|
|
41
|
-
* comes back.
|
|
42
|
-
*
|
|
85
|
+
* comes back. An hour-long TTL is not available at any price.
|
|
86
|
+
*
|
|
87
|
+
* **Sliding expiry is NOT claimed here**, and that changed with fact 2b. A
|
|
88
|
+
* `ttl` is sent on `create`, where the service takes it; later turns append
|
|
89
|
+
* an event, and whether an appended event renews the expiry is a service
|
|
90
|
+
* behaviour nothing in this repository has measured. Rather than send an
|
|
91
|
+
* unverified second call per turn to "refresh" it — a write whose only
|
|
92
|
+
* evidence would be that it did not error — the adapter sends the ttl once
|
|
93
|
+
* and says so. See {@link AgentEngineSessionsOptions.ttl}.
|
|
43
94
|
*
|
|
44
95
|
* ── The laws it inherits rather than re-implements ──────────────────────────
|
|
45
96
|
* `checkEnvelope` runs on the way OUT and on the way IN, so an envelope whose
|
|
@@ -65,13 +116,33 @@ const ADAPTER = 'agentEngineSessions';
|
|
|
65
116
|
export const SESSION_STATE_KEY = 'agentfootprint.envelope';
|
|
66
117
|
/** What a conversation that named nobody is stored under. */
|
|
67
118
|
export const DEFAULT_USER_ID = 'agentfootprint-anonymous';
|
|
119
|
+
/**
|
|
120
|
+
* The `author` on every event this store appends, unless
|
|
121
|
+
* {@link AgentEngineSessionsOptions.eventAuthor} names another.
|
|
122
|
+
*
|
|
123
|
+
* The service requires the field and treats it as free text. This name says
|
|
124
|
+
* which library wrote the turn, which is the useful thing to see in the console
|
|
125
|
+
* beside somebody else's agent writing to the same engine.
|
|
126
|
+
*/
|
|
127
|
+
export const SESSION_EVENT_AUTHOR = 'agentfootprint';
|
|
68
128
|
/**
|
|
69
129
|
* Conversations in Vertex AI's session service — the store that survives a
|
|
70
130
|
* fleet, not just a restart.
|
|
71
131
|
*
|
|
72
|
-
* **Status:
|
|
73
|
-
*
|
|
74
|
-
*
|
|
132
|
+
* **Status: field-validated except the write verb, which is field-CORRECTED.**
|
|
133
|
+
* An independent trial ran this adapter against a live Agent Runtime engine
|
|
134
|
+
* (2026-08-14) and everything below answered a real request from Google:
|
|
135
|
+
* creating first-turn sessions from real envelopes, hydrating them through a
|
|
136
|
+
* fresh instance, owners preserved, paged `listByUser` filtering, `ownerOf`,
|
|
137
|
+
* an unknown envelope format refused before storage, and idempotent `forget`.
|
|
138
|
+
*
|
|
139
|
+
* The one thing that FAILED was the second write to an existing session — the
|
|
140
|
+
* core job — because 9.29.0 patched `sessionState` and the service refuses
|
|
141
|
+
* that. The trial recovered the service's own words and verified the repair
|
|
142
|
+
* path (`appendEvent` with `actions.stateDelta`, then a `GET` showing the new
|
|
143
|
+
* state) with a raw diagnostic. This adapter now uses that verb; the repair is
|
|
144
|
+
* built on measured service behaviour and tested here, but the corrected write
|
|
145
|
+
* has not itself been re-run through this adapter in a live project.
|
|
75
146
|
*
|
|
76
147
|
* @example A standing agent whose conversations are shared across instances
|
|
77
148
|
* import { standingAgent, nodeHost } from 'agentfootprint/hosting';
|
|
@@ -102,6 +173,60 @@ export function agentEngineSessions(options) {
|
|
|
102
173
|
`bug rather than surface it. Build a new store if you need one after closing this.`);
|
|
103
174
|
};
|
|
104
175
|
const nameOf = (sessionId) => `${scope.parent}/sessions/${safeResourceId(sessionId)}`;
|
|
176
|
+
/**
|
|
177
|
+
* Does a session by this name exist? Asked ONLY to tell "there is nothing to
|
|
178
|
+
* append to" apart from "the append itself was refused".
|
|
179
|
+
*
|
|
180
|
+
* The live trial proved the two ends of the write path — `create` stores a
|
|
181
|
+
* new conversation, `appendEvent` updates an existing one — and left the
|
|
182
|
+
* middle unmeasured: what the service answers when you append to a session
|
|
183
|
+
* that is not there. Branching on an assumed 404 would put the FIRST turn of
|
|
184
|
+
* every conversation on a guess. So a failed append asks the resource itself,
|
|
185
|
+
* which is a fact rather than a convention, and costs one call on the one
|
|
186
|
+
* turn where the append was never going to work anyway.
|
|
187
|
+
*/
|
|
188
|
+
const missing = async (name) => {
|
|
189
|
+
try {
|
|
190
|
+
await sessions.get({ name });
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
// Anything that is not a clean "no such session" leaves the append's own
|
|
195
|
+
// failure standing — it is the one that says what went wrong.
|
|
196
|
+
return isNotFound(err);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Write the envelope onto an EXISTING session, as one appended event.
|
|
201
|
+
*
|
|
202
|
+
* Answers `false` — rather than raising — for the one case the caller has a
|
|
203
|
+
* repair for: there is no session here yet, so it has to be created.
|
|
204
|
+
*/
|
|
205
|
+
const append = async (name, stateDelta) => {
|
|
206
|
+
try {
|
|
207
|
+
await sessions.appendEvent({
|
|
208
|
+
name,
|
|
209
|
+
requestBody: {
|
|
210
|
+
author: options.eventAuthor ?? SESSION_EVENT_AUTHOR,
|
|
211
|
+
// Required, and one per persisted turn. It groups the events of one
|
|
212
|
+
// invocation on the service's side; this store writes exactly one
|
|
213
|
+
// event per turn, so a fresh id per call is the honest grouping.
|
|
214
|
+
invocationId: newInvocationId(),
|
|
215
|
+
timestamp: new Date().toISOString(),
|
|
216
|
+
// ONE top-level key — see the module header. A state delta merges by
|
|
217
|
+
// top-level key, so this replaces our envelope and touches nothing
|
|
218
|
+
// else in the struct.
|
|
219
|
+
actions: { stateDelta },
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
if (isNotFound(err) || (await missing(name)))
|
|
226
|
+
return false;
|
|
227
|
+
throw googleSdkFailure(ADAPTER, 'sessions.appendEvent', err);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
105
230
|
return {
|
|
106
231
|
parent: scope.parent,
|
|
107
232
|
async hydrate(sessionId) {
|
|
@@ -144,54 +269,42 @@ export function agentEngineSessions(options) {
|
|
|
144
269
|
// read back is one it has no business writing.
|
|
145
270
|
const checked = checkEnvelope(envelope, sessionId);
|
|
146
271
|
const name = nameOf(sessionId);
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
...(options.ttl !== undefined && { ttl: options.ttl }),
|
|
150
|
-
};
|
|
151
|
-
// PATCH first, CREATE on 404 — rather than the other way round.
|
|
272
|
+
const state = { [SESSION_STATE_KEY]: checked };
|
|
273
|
+
// APPEND first, CREATE when there is no session to append to.
|
|
152
274
|
//
|
|
153
|
-
// The steady state of a conversation is "it already exists":
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
// Only the fields we own. Without a mask a patch is a REPLACE, and a
|
|
162
|
-
// replace would drop `userId` — which is immutable, so the service
|
|
163
|
-
// would refuse the write and a conversation would stop persisting.
|
|
164
|
-
updateMask: maskFor(body),
|
|
165
|
-
requestBody: body,
|
|
166
|
-
});
|
|
275
|
+
// The steady state of a conversation is "it already exists": created
|
|
276
|
+
// once, written on every turn after that. So the ordinary turn costs one
|
|
277
|
+
// call, and the extra call is paid on turn one only.
|
|
278
|
+
//
|
|
279
|
+
// Appending — not patching. `sessions.patch` with a `sessionState` mask is
|
|
280
|
+
// refused by the live service (module header, fact 2b); it is the verb
|
|
281
|
+
// 9.29.0 used and the reason a second turn could not be stored.
|
|
282
|
+
if (await append(name, state))
|
|
167
283
|
return;
|
|
168
|
-
}
|
|
169
|
-
catch (err) {
|
|
170
|
-
if (!isNotFound(err))
|
|
171
|
-
throw googleSdkFailure(ADAPTER, 'sessions.patch', err);
|
|
172
|
-
}
|
|
173
284
|
const userId = resolveUserId(sessionId, checked);
|
|
174
285
|
let created;
|
|
175
286
|
try {
|
|
176
287
|
created = await sessions.create({
|
|
177
288
|
parent: scope.parent,
|
|
178
289
|
sessionId: safeResourceId(sessionId),
|
|
179
|
-
requestBody: {
|
|
290
|
+
requestBody: {
|
|
291
|
+
sessionState: state,
|
|
292
|
+
...(options.ttl !== undefined && { ttl: options.ttl }),
|
|
293
|
+
userId,
|
|
294
|
+
},
|
|
180
295
|
});
|
|
181
296
|
}
|
|
182
297
|
catch (err) {
|
|
183
298
|
// Two writers opened the same conversation at once and the other one
|
|
184
299
|
// won. That is not a failure: the session exists now, which is all
|
|
185
|
-
// this call wanted, so
|
|
300
|
+
// this call wanted, so our state goes on with the same appended event.
|
|
186
301
|
if (!isAlreadyExists(err))
|
|
187
302
|
throw googleSdkFailure(ADAPTER, 'sessions.create', err);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
return;
|
|
303
|
+
if (await append(name, state))
|
|
304
|
+
return;
|
|
305
|
+
// Created by somebody and gone again before we could write to it.
|
|
306
|
+
// Nothing here can say this turn landed, so it does not say it.
|
|
307
|
+
throw googleSdkFailure(ADAPTER, 'sessions.create', err);
|
|
195
308
|
}
|
|
196
309
|
// OUTSIDE the try on purpose: this refusal is already sanitized and
|
|
197
310
|
// already says what to do, and re-wrapping it would replace a precise
|
|
@@ -334,17 +447,23 @@ function userIdResolver(option) {
|
|
|
334
447
|
return (_sessionId, envelope) => envelopeOwner(envelope) ?? DEFAULT_USER_ID;
|
|
335
448
|
}
|
|
336
449
|
/**
|
|
337
|
-
*
|
|
450
|
+
* A fresh `invocationId` for one appended event.
|
|
451
|
+
*
|
|
452
|
+
* The field is required and groups the events of one invocation on the
|
|
453
|
+
* service's side. This store writes exactly one event per persisted turn, so a
|
|
454
|
+
* new id per call is what that grouping honestly is — reusing one across turns
|
|
455
|
+
* would tell the console that a whole conversation was a single invocation.
|
|
338
456
|
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
457
|
+
* `randomUUID` where the runtime has it, and a time-plus-random id where it
|
|
458
|
+
* does not: this is a correlation label, not a security value, and an adapter
|
|
459
|
+
* that threw on an old runtime because a label could not be minted would be
|
|
460
|
+
* failing a conversation over nothing.
|
|
342
461
|
*/
|
|
343
|
-
function
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
return
|
|
462
|
+
function newInvocationId() {
|
|
463
|
+
const uuid = globalThis.crypto?.randomUUID;
|
|
464
|
+
if (typeof uuid === 'function')
|
|
465
|
+
return `af-${uuid.call(globalThis.crypto)}`;
|
|
466
|
+
return `af-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
348
467
|
}
|
|
349
468
|
/** The id out of a resource name, which is everything after the last `/`. */
|
|
350
469
|
function lastSegment(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"googleAgentEngine.js","sourceRoot":"","sources":["../../../../src/adapters/hosting/googleAgentEngine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"googleAgentEngine.js","sourceRoot":"","sources":["../../../../src/adapters/hosting/googleAgentEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAOlE,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,4BAA4B,EAC5B,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,GAMf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,OAAO,GAAG,qBAAqB,CA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2E;AAC3E,SAAS,QAAQ,CAAC,KAAgC;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,6EAA6E;AAC7E,SAAS,QAAQ,CAAC,MAAe;IAC/B,MAAM,MAAM,GAAI,MAA2C,EAAE,MAAM,CAAC;IACpE,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC"}
|
|
@@ -151,10 +151,24 @@ export interface GoogleIdentityOptions {
|
|
|
151
151
|
/**
|
|
152
152
|
* Vend Google access tokens from whatever credential this environment has.
|
|
153
153
|
*
|
|
154
|
-
* **Status:
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
154
|
+
* **Status: field-validated for machine identity; refresh bounded.** An
|
|
155
|
+
* independent trial ran this adapter on live Google Cloud (2026-08-14):
|
|
156
|
+
* `googleIdentity({ services: ['aiplatform'] })` vended a real bearer
|
|
157
|
+
* credential from Application Default Credentials, and that credential
|
|
158
|
+
* authorized a Vertex AI request with HTTP 200. The same run proved the
|
|
159
|
+
* `bearer` kind, an expiry about 3,599 seconds out, a second vend without
|
|
160
|
+
* reconstruction, `mode: 'user'` failing CLOSED rather than quietly handing
|
|
161
|
+
* back machine access, a disallowed service failing closed, and
|
|
162
|
+
* `JSON.stringify(credential)` yielding `{"kind":"bearer"}` — no token, no
|
|
163
|
+
* Authorization header.
|
|
164
|
+
*
|
|
165
|
+
* **What is NOT proven:** an expiry-triggered refresh. The trial called the
|
|
166
|
+
* provider twice minutes apart and checked a future expiry; it did not wait an
|
|
167
|
+
* hour. Google's own auth client is what refreshes (this adapter caches the
|
|
168
|
+
* CLIENT, never a token — see {@link CachedGoogleClient}), and that refresh was
|
|
169
|
+
* field-proved on a different door (`gemini({ googleAuthOptions })`). A soak or
|
|
170
|
+
* a controlled expiring-credential double is still owed before anyone claims
|
|
171
|
+
* long-duration production proof for THIS provider.
|
|
158
172
|
*
|
|
159
173
|
* @throws when `mode: 'user'` is requested — Google's per-user token vault has
|
|
160
174
|
* no Node surface, and a machine token returned in its place would be a
|
|
@@ -62,10 +62,24 @@ export const CLOUD_PLATFORM_SCOPE = 'https://www.googleapis.com/auth/cloud-platf
|
|
|
62
62
|
/**
|
|
63
63
|
* Vend Google access tokens from whatever credential this environment has.
|
|
64
64
|
*
|
|
65
|
-
* **Status:
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
65
|
+
* **Status: field-validated for machine identity; refresh bounded.** An
|
|
66
|
+
* independent trial ran this adapter on live Google Cloud (2026-08-14):
|
|
67
|
+
* `googleIdentity({ services: ['aiplatform'] })` vended a real bearer
|
|
68
|
+
* credential from Application Default Credentials, and that credential
|
|
69
|
+
* authorized a Vertex AI request with HTTP 200. The same run proved the
|
|
70
|
+
* `bearer` kind, an expiry about 3,599 seconds out, a second vend without
|
|
71
|
+
* reconstruction, `mode: 'user'` failing CLOSED rather than quietly handing
|
|
72
|
+
* back machine access, a disallowed service failing closed, and
|
|
73
|
+
* `JSON.stringify(credential)` yielding `{"kind":"bearer"}` — no token, no
|
|
74
|
+
* Authorization header.
|
|
75
|
+
*
|
|
76
|
+
* **What is NOT proven:** an expiry-triggered refresh. The trial called the
|
|
77
|
+
* provider twice minutes apart and checked a future expiry; it did not wait an
|
|
78
|
+
* hour. Google's own auth client is what refreshes (this adapter caches the
|
|
79
|
+
* CLIENT, never a token — see {@link CachedGoogleClient}), and that refresh was
|
|
80
|
+
* field-proved on a different door (`gemini({ googleAuthOptions })`). A soak or
|
|
81
|
+
* a controlled expiring-credential double is still owed before anyone claims
|
|
82
|
+
* long-duration production proof for THIS provider.
|
|
69
83
|
*
|
|
70
84
|
* @throws when `mode: 'user'` is requested — Google's per-user token vault has
|
|
71
85
|
* no Node surface, and a machine token returned in its place would be a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../../src/adapters/identity/google.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOjD,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAEjC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,gDAAgD,CAAC;AAwGrF
|
|
1
|
+
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../../src/adapters/identity/google.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOjD,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAEjC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,gDAAgD,CAAC;AAwGrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,cAAc,CAAC,UAAiC,EAAE;IAChE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvF,MAAM,KAAK,GAAuB,EAAE,CAAC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GAAY;IACjC,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,KAAK,CACvB,GAAG,OAAO,iEAAiE,IAAI,KAAK;QAClF,mFAAmF;QACnF,kFAAkF;QAClF,gFAAgF;QAChF,qEAAqE;QACrE,iFAAiF;QACjF,cAAc,CACjB,CAAC;IACF,OAAO,CAAC,IAAI,GAAG,mCAAmC,CAAC;IACnD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,0EAA0E;AAC1E,SAAS,UAAU,CAAC,SAAiB,EAAE,GAAY;IACjD,MAAM,OAAO,GAAG,IAAI,KAAK,CACvB,GAAG,OAAO,KAAK,SAAS,aAAa,SAAS,CAAC,GAAG,CAAC,KAAK;QACtD,oFAAoF;QACpF,0FAA0F,CAC7F,CAAC;IACF,OAAO,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACvC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,GAAY;IAC7B,MAAM,IAAI,GAAI,GAAiC,EAAE,IAAI,CAAC;IACtD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC;AACnF,CAAC"}
|
|
@@ -26,18 +26,77 @@
|
|
|
26
26
|
* the first call, which reads like a network problem rather than a missing
|
|
27
27
|
* setting.
|
|
28
28
|
*
|
|
29
|
+
* ─── Status, per door, because the doors differ ─────────────────────
|
|
30
|
+
*
|
|
31
|
+
* • **Vertex: field-validated.** An independent trial ran this adapter,
|
|
32
|
+
* unchanged since 9.13.0, against a live project through Application Default
|
|
33
|
+
* Credentials: a two-call tool loop on `gemini-2.5-flash` returning the
|
|
34
|
+
* expected answer with real token counts, and a stream delivering 10 content
|
|
35
|
+
* chunks that reconstructed exactly (FINDINGS "Part 1 — native Gemini on
|
|
36
|
+
* Vertex through ADC", "Part 2C"). `geminiEmbedder` passed on the same door.
|
|
37
|
+
* • **Gemini API (AI Studio): NOT field-validated, and not for want of
|
|
38
|
+
* trying.** The trial's key-door calls never reached a model: the old
|
|
39
|
+
* default model answered 404 for a new account, and a current model answered
|
|
40
|
+
* 429 for AI Studio prepayment, which is billing SEPARATE from the Google
|
|
41
|
+
* Cloud account's credit. What that door does with a funded key is
|
|
42
|
+
* untested here, which is why it has no default model.
|
|
43
|
+
* • **Tool calling on a 3.x model: field-validated.** The signature round trip
|
|
44
|
+
* below was built from the trial's captured 400, and the same independent
|
|
45
|
+
* trial then re-ran it on live Vertex against the published fix
|
|
46
|
+
* (2026-08-14): `gemini-3.1-flash-lite` called a tool, the tool answered,
|
|
47
|
+
* the signature went back byte for byte, and the second model call
|
|
48
|
+
* completed with the right answer — two LLM calls, one tool execution, real
|
|
49
|
+
* token counts. What it does NOT cover is a signature attached to a TEXT
|
|
50
|
+
* part with no function call beside it; see below.
|
|
51
|
+
*
|
|
29
52
|
* ─── Why native, and not `openai({ baseURL })` ──────────────────────
|
|
30
53
|
*
|
|
31
54
|
* Google publishes an OpenAI-compatible endpoint, and it does work — for about
|
|
32
|
-
* an hour. It authenticates with an OAuth access token that expires
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
55
|
+
* an hour. It authenticates with an OAuth access token that expires (9.29.0
|
|
56
|
+
* gives `openai({ apiKey })` a callback form so a long-running process can
|
|
57
|
+
* refresh one, which is a mitigation and not a fix); its
|
|
58
|
+
* `tools.function.parameters` is **OpenAPI**, not JSON Schema, so `$ref` /
|
|
59
|
+
* `oneOf` / `additionalProperties` diverge silently; unsupported parameters are
|
|
60
|
+
* ignored rather than refused; and its documented response carries no cached-
|
|
61
|
+
* or reasoning-token counts. This adapter exists because every one of those is
|
|
62
|
+
* answerable on the native SDK: ADC refreshes itself, tools go over as JSON
|
|
63
|
+
* Schema untranslated (`parametersJsonSchema`), a forced single tool is
|
|
64
|
+
* expressible, and `usageMetadata` reports cached and thinking tokens as
|
|
65
|
+
* separate numbers.
|
|
66
|
+
*
|
|
67
|
+
* A field trial measured both halves of that: the native path completed a call
|
|
68
|
+
* after a forced credential expiry, while the compatible path returned HTTP 401
|
|
69
|
+
* on an expired token (FINDINGS "Part 2B").
|
|
70
|
+
*
|
|
71
|
+
* ─── Thought signatures: the round trip a tool loop cannot skip ─────
|
|
72
|
+
*
|
|
73
|
+
* A current Gemini model does not merely PREFER its thought signature back —
|
|
74
|
+
* it refuses the turn without it. An independent field trial on live GCP ran
|
|
75
|
+
* `gemini-3.1-flash-lite` on Vertex through one ordinary tool loop: the first
|
|
76
|
+
* call asked for the function, the tool ran, and the second call came back
|
|
77
|
+
*
|
|
78
|
+
* 400 INVALID_ARGUMENT — "Function call is missing a thought_signature in
|
|
79
|
+
* functionCall parts. This is required for tools to work correctly …"
|
|
80
|
+
*
|
|
81
|
+
* (FINDINGS "Failure 4"). The cost of that shape is what makes it worth this
|
|
82
|
+
* paragraph: the failure lands AFTER the tool has already executed, so a
|
|
83
|
+
* side-effecting tool has run and the answer is unreachable.
|
|
84
|
+
*
|
|
85
|
+
* So the signature is CARRIED, not dropped. `Part.thoughtSignature` (a base64
|
|
86
|
+
* string on the installed @google/genai 2.16.0 `Part`) is read off the same
|
|
87
|
+
* part as the `functionCall` it belongs to, parked on the port's neutral
|
|
88
|
+
* `toolCalls[].providerMeta`, and written back onto the reconstructed
|
|
89
|
+
* `functionCall` part on the next request — byte for byte, because a signature
|
|
90
|
+
* is checked and not read. This is the same round trip the Anthropic adapter
|
|
91
|
+
* does with signed thinking blocks, one field along: there the carrier is
|
|
92
|
+
* `LLMMessage.thinkingBlocks[].signature`, here it is the tool call itself,
|
|
93
|
+
* because that is where Google puts it.
|
|
94
|
+
*
|
|
95
|
+
* What that does NOT cover, said plainly: a signature attached to a TEXT part
|
|
96
|
+
* of an answer with no function call. The port's assistant turn is a string,
|
|
97
|
+
* and a string has nowhere to keep one. The trial's failure was the functionCall
|
|
98
|
+
* shape; that shape is fixed here, and the other one is named rather than
|
|
99
|
+
* quietly half-handled.
|
|
41
100
|
*
|
|
42
101
|
* ─── Limitations (stated, not discovered) ───────────────────────────
|
|
43
102
|
*
|
|
@@ -47,12 +106,12 @@
|
|
|
47
106
|
* • **Thought summaries are not requested.** `usage.thinking` is reported
|
|
48
107
|
* honestly from `thoughtsTokenCount`, and `req.thinking.budget` is threaded
|
|
49
108
|
* to `thinkingConfig.thinkingBudget` — but `includeThoughts` is deliberately
|
|
50
|
-
* left unset, so no `rawThinking` is produced
|
|
51
|
-
* `
|
|
52
|
-
*
|
|
53
|
-
* round-
|
|
54
|
-
*
|
|
55
|
-
*
|
|
109
|
+
* left unset, so no `rawThinking` is produced and there is no Gemini
|
|
110
|
+
* `ThinkingHandler` in this release to normalize thought TEXT. Asking for
|
|
111
|
+
* content nothing can carry would be a leak, not a feature. Signature
|
|
112
|
+
* round-tripping (above) is a separate thing and does not need one.
|
|
113
|
+
* `thinkingConfig.thinkingLevel` has no field on `LLMRequest` and is
|
|
114
|
+
* likewise not sent.
|
|
56
115
|
* • `responseJsonSchema` (native structured output) is NOT exposed; use
|
|
57
116
|
* `.outputSchema(...)`, which goes over as a forced tool — a shape this
|
|
58
117
|
* adapter DOES carry.
|
|
@@ -66,6 +125,15 @@ export interface GeminiPart {
|
|
|
66
125
|
readonly text?: string;
|
|
67
126
|
/** `true` on a thought-summary part. Never joined into visible content. */
|
|
68
127
|
readonly thought?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* The model's opaque signature for the thinking behind THIS part — base64,
|
|
130
|
+
* per `Part.thoughtSignature` on the installed @google/genai 2.16.0 surface.
|
|
131
|
+
*
|
|
132
|
+
* Read off a `functionCall` part and written back onto the same part on the
|
|
133
|
+
* next request. Never parsed, never trimmed, never regenerated: the service
|
|
134
|
+
* verifies it, so the only correct handling is byte-for-byte.
|
|
135
|
+
*/
|
|
136
|
+
readonly thoughtSignature?: string;
|
|
69
137
|
readonly functionCall?: {
|
|
70
138
|
readonly id?: string;
|
|
71
139
|
readonly name?: string;
|
|
@@ -157,6 +225,19 @@ export interface GeminiProviderOptions extends GoogleGenAIConnectionOptions {
|
|
|
157
225
|
/**
|
|
158
226
|
* Default model used when `LLMRequest.model` is `'gemini'` (the shorthand).
|
|
159
227
|
* A request naming a full model id wins.
|
|
228
|
+
*
|
|
229
|
+
* **Unset behaves differently per door, because the doors behave
|
|
230
|
+
* differently.** On **Vertex** the shorthand resolves to
|
|
231
|
+
* `'gemini-2.5-flash'`, which a live field trial ran end to end through ADC.
|
|
232
|
+
* On the **Gemini API (AI Studio)** door the shorthand is REFUSED by name:
|
|
233
|
+
* the same trial's key-door call to that exact model returned HTTP 404 —
|
|
234
|
+
* *"no longer available to new users"* (FINDINGS "Failure 1") — and no model
|
|
235
|
+
* could be proven working on that door at all, because the account's separate
|
|
236
|
+
* AI Studio prepayment was empty (FINDINGS "Failure 2", a 429 on
|
|
237
|
+
* `gemini-3.1-flash-lite`, which at least proves that id resolves there).
|
|
238
|
+
*
|
|
239
|
+
* Shipping a second silent default nobody has run would be this library
|
|
240
|
+
* guessing on a service's behalf; the refusal names the door and the fix.
|
|
160
241
|
*/
|
|
161
242
|
readonly defaultModel?: string;
|
|
162
243
|
/** Default `maxOutputTokens` when the request doesn't set it. Optional. */
|