@guuey/agent-client 0.2.0 → 0.2.2
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/block-ui.d.ts +6 -1
- package/dist/block-ui.d.ts.map +1 -1
- package/dist/block-ui.js +21 -3
- package/dist/web-adapters.d.ts.map +1 -1
- package/dist/web-adapters.js +3 -0
- package/package.json +1 -1
- package/src/block-ui.ts +19 -3
- package/src/web-adapters.ts +3 -0
package/dist/block-ui.d.ts
CHANGED
|
@@ -57,7 +57,12 @@ export declare function scanProviderRawForUiResource(raw: JsonValue | undefined)
|
|
|
57
57
|
* Extract a mountable UI resource from an opaque AgBlock-shaped `JsonValue`
|
|
58
58
|
* (used for persisted card snapshot parts, which arrive untyped). Dispatches
|
|
59
59
|
* by `block.type`:
|
|
60
|
-
* - `tool-result` → its `uiData` surface channel
|
|
60
|
+
* - `tool-result` → its `uiData` surface channel, then a `ui://` resource
|
|
61
|
+
* degraded into a `provider-raw` content part — the SAME two channels
|
|
62
|
+
* the live path ({@link toolResultUiResource}) mounts. The write side
|
|
63
|
+
* (`nocode-runtime`'s `uiCardArtifactsFromMessages`, guuey#86) persists
|
|
64
|
+
* card rows for both, so the snapshot arm must mount both or
|
|
65
|
+
* provider-raw-only cards rehydrate as placeholders.
|
|
61
66
|
* - `provider-raw` → a `ui://` resource hiding in `raw`
|
|
62
67
|
* - `resource` → a first-class embedded resource (gated on `ui://`)
|
|
63
68
|
* Everything else → `undefined`.
|
package/dist/block-ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-ui.d.ts","sourceRoot":"","sources":["../src/block-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C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CAExF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAU5F;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAK5F;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,SAAS,GAAG,SAAS,GACzB,oBAAoB,GAAG,SAAS,CAMlC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAyBlF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,GAC/C,oBAAoB,GAAG,SAAS,CAUlC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAUxF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAU/E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,EAAE,CAE7E"}
|
package/dist/block-ui.js
CHANGED
|
@@ -54,7 +54,12 @@ export function scanProviderRawForUiResource(raw) {
|
|
|
54
54
|
* Extract a mountable UI resource from an opaque AgBlock-shaped `JsonValue`
|
|
55
55
|
* (used for persisted card snapshot parts, which arrive untyped). Dispatches
|
|
56
56
|
* by `block.type`:
|
|
57
|
-
* - `tool-result` → its `uiData` surface channel
|
|
57
|
+
* - `tool-result` → its `uiData` surface channel, then a `ui://` resource
|
|
58
|
+
* degraded into a `provider-raw` content part — the SAME two channels
|
|
59
|
+
* the live path ({@link toolResultUiResource}) mounts. The write side
|
|
60
|
+
* (`nocode-runtime`'s `uiCardArtifactsFromMessages`, guuey#86) persists
|
|
61
|
+
* card rows for both, so the snapshot arm must mount both or
|
|
62
|
+
* provider-raw-only cards rehydrate as placeholders.
|
|
58
63
|
* - `provider-raw` → a `ui://` resource hiding in `raw`
|
|
59
64
|
* - `resource` → a first-class embedded resource (gated on `ui://`)
|
|
60
65
|
* Everything else → `undefined`.
|
|
@@ -63,8 +68,21 @@ export function blockUiResource(block) {
|
|
|
63
68
|
if (!isJsonObject(block))
|
|
64
69
|
return undefined;
|
|
65
70
|
switch (block.type) {
|
|
66
|
-
case "tool-result":
|
|
67
|
-
|
|
71
|
+
case "tool-result": {
|
|
72
|
+
const fromUiData = asUiResource(block.uiData);
|
|
73
|
+
if (fromUiData)
|
|
74
|
+
return fromUiData;
|
|
75
|
+
if (Array.isArray(block.content)) {
|
|
76
|
+
for (const part of block.content) {
|
|
77
|
+
if (isJsonObject(part) && part.type === "provider-raw") {
|
|
78
|
+
const found = scanProviderRawForUiResource(part.raw);
|
|
79
|
+
if (found)
|
|
80
|
+
return found;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
68
86
|
case "provider-raw":
|
|
69
87
|
return scanProviderRawForUiResource(block.raw);
|
|
70
88
|
case "resource": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-adapters.d.ts","sourceRoot":"","sources":["../src/web-adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EAEb,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,MAAM,EAAE,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,EAAE,MAAM,EACN,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,YAAA;CAKzB;AAED,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,EAAE,aAiBrC,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAwCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAuB,oBAAoB,CACzC,GAAG,EAAE,aAAa,EAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,cAAc,CAAC,MAAM,CAAC,CA4CxB;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,CAwErB"}
|
package/dist/web-adapters.js
CHANGED
|
@@ -184,6 +184,7 @@ export function createWebAdapters(opts = {}) {
|
|
|
184
184
|
return await fetchThreadHistory({
|
|
185
185
|
baseUrl: apiBaseUrl,
|
|
186
186
|
threadId,
|
|
187
|
+
includeCards: true,
|
|
187
188
|
requestInit: { headers: { Authorization: `Bearer ${token}` } },
|
|
188
189
|
});
|
|
189
190
|
}
|
|
@@ -203,6 +204,7 @@ export function createWebAdapters(opts = {}) {
|
|
|
203
204
|
return fetchThreadHistory({
|
|
204
205
|
baseUrl: apiBaseUrl,
|
|
205
206
|
threadId,
|
|
207
|
+
includeCards: true,
|
|
206
208
|
requestInit: { headers: { Authorization: `Bearer ${fresh}` } },
|
|
207
209
|
});
|
|
208
210
|
}
|
|
@@ -213,6 +215,7 @@ export function createWebAdapters(opts = {}) {
|
|
|
213
215
|
return fetchThreadHistory({
|
|
214
216
|
baseUrl: apiBaseUrl,
|
|
215
217
|
threadId,
|
|
218
|
+
includeCards: true,
|
|
216
219
|
requestInit: { headers: { [GUEST_HEADER]: guest } },
|
|
217
220
|
});
|
|
218
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guuey/agent-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|
package/src/block-ui.ts
CHANGED
|
@@ -86,7 +86,12 @@ export function scanProviderRawForUiResource(
|
|
|
86
86
|
* Extract a mountable UI resource from an opaque AgBlock-shaped `JsonValue`
|
|
87
87
|
* (used for persisted card snapshot parts, which arrive untyped). Dispatches
|
|
88
88
|
* by `block.type`:
|
|
89
|
-
* - `tool-result` → its `uiData` surface channel
|
|
89
|
+
* - `tool-result` → its `uiData` surface channel, then a `ui://` resource
|
|
90
|
+
* degraded into a `provider-raw` content part — the SAME two channels
|
|
91
|
+
* the live path ({@link toolResultUiResource}) mounts. The write side
|
|
92
|
+
* (`nocode-runtime`'s `uiCardArtifactsFromMessages`, guuey#86) persists
|
|
93
|
+
* card rows for both, so the snapshot arm must mount both or
|
|
94
|
+
* provider-raw-only cards rehydrate as placeholders.
|
|
90
95
|
* - `provider-raw` → a `ui://` resource hiding in `raw`
|
|
91
96
|
* - `resource` → a first-class embedded resource (gated on `ui://`)
|
|
92
97
|
* Everything else → `undefined`.
|
|
@@ -94,8 +99,19 @@ export function scanProviderRawForUiResource(
|
|
|
94
99
|
export function blockUiResource(block: JsonValue): McpUiResourcePayload | undefined {
|
|
95
100
|
if (!isJsonObject(block)) return undefined;
|
|
96
101
|
switch (block.type) {
|
|
97
|
-
case "tool-result":
|
|
98
|
-
|
|
102
|
+
case "tool-result": {
|
|
103
|
+
const fromUiData = asUiResource(block.uiData);
|
|
104
|
+
if (fromUiData) return fromUiData;
|
|
105
|
+
if (Array.isArray(block.content)) {
|
|
106
|
+
for (const part of block.content) {
|
|
107
|
+
if (isJsonObject(part) && part.type === "provider-raw") {
|
|
108
|
+
const found = scanProviderRawForUiResource(part.raw);
|
|
109
|
+
if (found) return found;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
99
115
|
case "provider-raw":
|
|
100
116
|
return scanProviderRawForUiResource(block.raw);
|
|
101
117
|
case "resource": {
|
package/src/web-adapters.ts
CHANGED
|
@@ -276,6 +276,7 @@ export function createWebAdapters(
|
|
|
276
276
|
return await fetchThreadHistory({
|
|
277
277
|
baseUrl: apiBaseUrl,
|
|
278
278
|
threadId,
|
|
279
|
+
includeCards: true,
|
|
279
280
|
requestInit: { headers: { Authorization: `Bearer ${token}` } },
|
|
280
281
|
});
|
|
281
282
|
} catch (err) {
|
|
@@ -292,6 +293,7 @@ export function createWebAdapters(
|
|
|
292
293
|
return fetchThreadHistory({
|
|
293
294
|
baseUrl: apiBaseUrl,
|
|
294
295
|
threadId,
|
|
296
|
+
includeCards: true,
|
|
295
297
|
requestInit: { headers: { Authorization: `Bearer ${fresh}` } },
|
|
296
298
|
});
|
|
297
299
|
}
|
|
@@ -302,6 +304,7 @@ export function createWebAdapters(
|
|
|
302
304
|
return fetchThreadHistory({
|
|
303
305
|
baseUrl: apiBaseUrl,
|
|
304
306
|
threadId,
|
|
307
|
+
includeCards: true,
|
|
305
308
|
requestInit: { headers: { [GUEST_HEADER]: guest } },
|
|
306
309
|
});
|
|
307
310
|
}
|