@guuey/agent-client 0.6.1 → 0.7.1
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/dist/web-adapters.d.ts +12 -1
- package/dist/web-adapters.d.ts.map +1 -1
- package/dist/web-adapters.js +14 -0
- package/package.json +2 -2
- package/src/web-adapters.ts +27 -1
package/dist/web-adapters.d.ts
CHANGED
|
@@ -104,7 +104,16 @@ export interface CreateUiResourceReaderOptions {
|
|
|
104
104
|
* door 404s mid-turn by construction. Completed turns 404 on the pod
|
|
105
105
|
* (past its grace window) and resolve on the platform door instead: one
|
|
106
106
|
* authority per lifecycle phase, and this reader tries both in that
|
|
107
|
-
* order. Absent → platform door only (pre-#209 behavior)
|
|
107
|
+
* order. Absent → platform door only (pre-#209 behavior) — which means
|
|
108
|
+
* **a card produced mid-turn cannot resolve until its turn completes**:
|
|
109
|
+
* under a producer that inlines no mount material (any plain-locator MCP
|
|
110
|
+
* server, ggui's read-plane-only posture) every fresh card renders
|
|
111
|
+
* "expired" until reload. A live surface that holds an invoke endpoint
|
|
112
|
+
* MUST pass it here; omitting it is only correct for a pure history
|
|
113
|
+
* viewer with no pod (SelfHostedThreadViewer). The reader warns once at
|
|
114
|
+
* construction when a platform door is configured without a pod door,
|
|
115
|
+
* because the failure it prevents is silent by nature (guuey#209 /
|
|
116
|
+
* ggui cac966a2d — both first external embeds shipped without it).
|
|
108
117
|
*/
|
|
109
118
|
endpointUrl?: string | null;
|
|
110
119
|
/** Signed-in bearer — wins over the guest secret (same rule as the transport). */
|
|
@@ -116,6 +125,8 @@ export interface CreateUiResourceReaderOptions {
|
|
|
116
125
|
/** Injectable for tests. */
|
|
117
126
|
fetchImpl?: typeof fetch;
|
|
118
127
|
}
|
|
128
|
+
/** @internal test seam — the once-flag is module state; suites reset it between cases. */
|
|
129
|
+
export declare function __resetReaderEndpointWarning(): void;
|
|
119
130
|
/**
|
|
120
131
|
* Build a `UiResourceReader` over guuey's authenticated resources/read
|
|
121
132
|
* doors — the pod door for LIVE turns (guuey#209 C1:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-adapters.d.ts","sourceRoot":"","sources":["../src/web-adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAmB,aAAa,EAAE,MAAM,YAAY,CAAC;AAKtF,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,EAAE,aAiBrC,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,GAAE,wBAA6B,GAClC,mBAAmB,CA8ErB;AAED,mGAAmG;AACnG,MAAM,WAAW,6BAA6B;IAC5C,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"web-adapters.d.ts","sourceRoot":"","sources":["../src/web-adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,sBA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;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,6BAA6B,GACrC,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAsFjE;AAED,uFAAuF;AACvF,MAAM,WAAW,0BAA0B;IACzC,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,cAAc,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/E,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC,CA+C1D"}
|
package/dist/web-adapters.js
CHANGED
|
@@ -125,6 +125,12 @@ export function createWebAdapters(opts = {}) {
|
|
|
125
125
|
}
|
|
126
126
|
return adapters;
|
|
127
127
|
}
|
|
128
|
+
/** Warn once per module load — the misconfiguration is per-surface, not per-read. */
|
|
129
|
+
let readerEndpointWarned = false;
|
|
130
|
+
/** @internal test seam — the once-flag is module state; suites reset it between cases. */
|
|
131
|
+
export function __resetReaderEndpointWarning() {
|
|
132
|
+
readerEndpointWarned = false;
|
|
133
|
+
}
|
|
128
134
|
/** `<pod base>/agent/ui-resource` from whatever endpoint shape the surface holds. */
|
|
129
135
|
function toUiResourceUrl(endpointUrl) {
|
|
130
136
|
return toInvokeUrl(endpointUrl).replace(/\/agent\/invoke$/, "/agent/ui-resource");
|
|
@@ -153,6 +159,14 @@ function toUiResourceUrl(endpointUrl) {
|
|
|
153
159
|
*/
|
|
154
160
|
export function createUiResourceReader(options) {
|
|
155
161
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
162
|
+
// A platform door without a pod door is almost always a live surface
|
|
163
|
+
// that forgot `endpointUrl` — its cards would die silently for the whole
|
|
164
|
+
// mid-turn window. `null` is the explicit "I am a history-only viewer,
|
|
165
|
+
// there is no pod" opt-out; `undefined` is the forgotten case.
|
|
166
|
+
if (options.endpointUrl === undefined && !readerEndpointWarned) {
|
|
167
|
+
readerEndpointWarned = true;
|
|
168
|
+
console.warn("createUiResourceReader: no `endpointUrl` — cards produced mid-turn cannot resolve until the turn completes (the pod door is the only authority while a turn streams). Pass the surface's invoke endpoint, or `endpointUrl: null` to declare a history-only viewer.");
|
|
169
|
+
}
|
|
156
170
|
/** One door: fetch + the history adapter's 401-forceRefresh recovery + parse. */
|
|
157
171
|
const readDoor = async (requestUrl) => {
|
|
158
172
|
// Exactly ONE identity carrier per read, the invoke transport's rule
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guuey/agent-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Client SDK for Guuey's agent runtime: the `useAgentInvoke` React hook + pure SSE helpers that speak the /agent/invoke streaming contract, plus the paginated thread-history read plane. Host adapters (storage / id / transport) are injected, so it runs on web (Next) and React Native alike.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@silverprotocol/core": "0.5.0",
|
|
38
|
-
"@guuey/mcp-apps-host": "0.
|
|
38
|
+
"@guuey/mcp-apps-host": "0.7.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=18"
|
package/src/web-adapters.ts
CHANGED
|
@@ -220,7 +220,16 @@ export interface CreateUiResourceReaderOptions {
|
|
|
220
220
|
* door 404s mid-turn by construction. Completed turns 404 on the pod
|
|
221
221
|
* (past its grace window) and resolve on the platform door instead: one
|
|
222
222
|
* authority per lifecycle phase, and this reader tries both in that
|
|
223
|
-
* order. Absent → platform door only (pre-#209 behavior)
|
|
223
|
+
* order. Absent → platform door only (pre-#209 behavior) — which means
|
|
224
|
+
* **a card produced mid-turn cannot resolve until its turn completes**:
|
|
225
|
+
* under a producer that inlines no mount material (any plain-locator MCP
|
|
226
|
+
* server, ggui's read-plane-only posture) every fresh card renders
|
|
227
|
+
* "expired" until reload. A live surface that holds an invoke endpoint
|
|
228
|
+
* MUST pass it here; omitting it is only correct for a pure history
|
|
229
|
+
* viewer with no pod (SelfHostedThreadViewer). The reader warns once at
|
|
230
|
+
* construction when a platform door is configured without a pod door,
|
|
231
|
+
* because the failure it prevents is silent by nature (guuey#209 /
|
|
232
|
+
* ggui cac966a2d — both first external embeds shipped without it).
|
|
224
233
|
*/
|
|
225
234
|
endpointUrl?: string | null;
|
|
226
235
|
/** Signed-in bearer — wins over the guest secret (same rule as the transport). */
|
|
@@ -231,6 +240,13 @@ export interface CreateUiResourceReaderOptions {
|
|
|
231
240
|
fetchImpl?: typeof fetch;
|
|
232
241
|
}
|
|
233
242
|
|
|
243
|
+
/** Warn once per module load — the misconfiguration is per-surface, not per-read. */
|
|
244
|
+
let readerEndpointWarned = false;
|
|
245
|
+
/** @internal test seam — the once-flag is module state; suites reset it between cases. */
|
|
246
|
+
export function __resetReaderEndpointWarning(): void {
|
|
247
|
+
readerEndpointWarned = false;
|
|
248
|
+
}
|
|
249
|
+
|
|
234
250
|
/** `<pod base>/agent/ui-resource` from whatever endpoint shape the surface holds. */
|
|
235
251
|
function toUiResourceUrl(endpointUrl: string): string {
|
|
236
252
|
return toInvokeUrl(endpointUrl).replace(/\/agent\/invoke$/, "/agent/ui-resource");
|
|
@@ -262,6 +278,16 @@ export function createUiResourceReader(
|
|
|
262
278
|
options: CreateUiResourceReaderOptions,
|
|
263
279
|
): (resourceUri: string) => Promise<ResolvedViewMount | undefined> {
|
|
264
280
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
281
|
+
// A platform door without a pod door is almost always a live surface
|
|
282
|
+
// that forgot `endpointUrl` — its cards would die silently for the whole
|
|
283
|
+
// mid-turn window. `null` is the explicit "I am a history-only viewer,
|
|
284
|
+
// there is no pod" opt-out; `undefined` is the forgotten case.
|
|
285
|
+
if (options.endpointUrl === undefined && !readerEndpointWarned) {
|
|
286
|
+
readerEndpointWarned = true;
|
|
287
|
+
console.warn(
|
|
288
|
+
"createUiResourceReader: no `endpointUrl` — cards produced mid-turn cannot resolve until the turn completes (the pod door is the only authority while a turn streams). Pass the surface's invoke endpoint, or `endpointUrl: null` to declare a history-only viewer.",
|
|
289
|
+
);
|
|
290
|
+
}
|
|
265
291
|
|
|
266
292
|
/** One door: fetch + the history adapter's 401-forceRefresh recovery + parse. */
|
|
267
293
|
const readDoor = async (requestUrl: string): Promise<McpResourceReadResult | undefined> => {
|