@guuey/agent-client 0.16.10 → 0.16.12

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/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export { ingestMessageFrame } from "./blocks.js";
11
11
  export { sortHistoryCards, toolNameFor } from "./history.js";
12
12
  export { Reducer } from "@silverprotocol/core";
13
13
  export type { AgEvent, AgReduceResult, AgMessage, AgBlock, AgClientCapabilities, AgHitlAnswer, } from "@silverprotocol/core";
14
- export type { AgentMessage, HistoryCard, ProfileLinkRequest, ThreadIdStore, GenerateId, InvokeRequest, InvokeTransport, AgentInvokeAdapters, AgentInvokeHistoryAdapter, AgentInvokeStatus, HistoryLoadResult, StallRecoveryOptions, UseAgentInvokeOptions, UseAgentInvokeReturn, } from "./types.js";
14
+ export type { AgentMessage, HistoryCard, ProfileLinkRequest, ThreadIdStore, GenerateId, InvokeRequest, InvokeTransport, AgentInvokeAdapters, AgentInvokeHistoryAdapter, AgentInvokeStatus, HistoryLoadResult, StallRecoveryOptions, UseAgentInvokeOptions, PageContext, UseAgentInvokeReturn, } from "./types.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,6BAA6B,EAClC,iBAAiB,EACjB,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,EACP,cAAc,EACd,SAAS,EACT,OAAO,EAIP,oBAAoB,EACpB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
package/dist/types.d.ts CHANGED
@@ -152,6 +152,16 @@ export interface StallRecoveryOptions {
152
152
  */
153
153
  probeAttempts?: number;
154
154
  }
155
+ /**
156
+ * Where the user is standing (guuey#524): the embedding page, as the host
157
+ * knows it. `path` + `title` only by design — nothing scraped; `context` is
158
+ * an optional short host-declared line (the pod caps it server-side).
159
+ */
160
+ export interface PageContext {
161
+ path: string;
162
+ title: string;
163
+ context?: string;
164
+ }
155
165
  export interface UseAgentInvokeOptions {
156
166
  /** Pod base URL (with or without a trailing `/agent/invoke`). Chat is disabled when null. */
157
167
  endpointUrl: string | null;
@@ -179,14 +189,28 @@ export interface UseAgentInvokeOptions {
179
189
  */
180
190
  capabilities?: AgClientCapabilities;
181
191
  /**
182
- * Where the user IS (guuey#398) — a short context line the embedding
183
- * surface owns ("The user is signed in to the guuey builder console…"),
184
- * sent on every invoke. The pod composes it into the MODEL's input only:
185
- * the persisted thread and this hook's optimistic user message never
186
- * contain it. ≤500 chars (the pod refuses longer). The surface is the
187
- * one place that knows this; the agent's static system prompt cannot.
192
+ /**
193
+ * The host PAGE the user is viewing (guuey#524 v1 the page-aware
194
+ * ephemeral turn): URL path + title, plus an optional short host-declared
195
+ * context string. Sent on the invoke body per turn; read at send time, so
196
+ * an SPA host updates it on route change and the next turn carries the
197
+ * new page. TRUST LIVES POD-SIDE, none here: the pod frames this as
198
+ * UNTRUSTED page content into the model input for that turn only, flags
199
+ * the turn `pageContextPresent` (never client-claimed), and switches the
200
+ * durable sinks off for it (memory/profile/fold/home — the pass-3
201
+ * ephemeral-turn contract). The client's only job is carriage.
202
+ */
203
+ pageContext?: PageContext;
204
+ /**
205
+ * The agent-mode PIN for this surface (guuey#527/#566 — the guest/auth
206
+ * axis). Selection is SERVER-DERIVED from the caller's REAL auth state;
207
+ * this param only pins WITHIN permission: an authed caller may pin
208
+ * `"guest"` (preview-as-visitor), a guest pinning `"auth"` is clamped
209
+ * server-side, and an unrecognized key is ignored — all fail-soft, an
210
+ * embed never breaks. Absent = pure derivation. Modes are subset-only
211
+ * voice overlays, never added privilege.
188
212
  */
189
- surfaceContext?: string;
213
+ mode?: string;
190
214
  /**
191
215
  * Stall recovery for a half-dead stream (guuey#192). A connection that dies
192
216
  * WITHOUT erroring (TCP alive, zero bytes, no `done`) would otherwise leave
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE5F,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,SAAS,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GA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,18 @@ export function useAgentInvoke(opts) {
322
322
  const clearProfileLinkRequest = useCallback(() => {
323
323
  setProfileLinkRequest(null);
324
324
  }, []);
325
+ // guuey#524: `send` is memoized on [endpointUrl, appId, status, signal] —
326
+ // options read inside it are otherwise frozen at memo time. pageContext's
327
+ // whole contract is read-at-SEND-time freshness (SPA route changes must
328
+ // ride the next turn), so it goes through a live ref, the same discipline
329
+ // as every live-read value in the kit layer.
330
+ const pageContextRef = useRef(opts.pageContext);
331
+ pageContextRef.current = opts.pageContext;
332
+ // guuey#566: same live-ref discipline — a surface's mode can change
333
+ // mid-session (a guest signs in and the host flips rep → agent); the
334
+ // NEXT turn carries the new mode.
335
+ const modeRef = useRef(opts.mode);
336
+ modeRef.current = opts.mode;
325
337
  const send = useCallback(async (input) => {
326
338
  // An already-aborted external signal refuses the send outright —
327
339
  // before the optimistic transcript push, so nothing is left to undo.
@@ -509,12 +521,16 @@ export function useAgentInvoke(opts) {
509
521
  ...(threadIdRef.current ? { threadId: threadIdRef.current } : {}),
510
522
  clientMessageId,
511
523
  ...(capabilities !== undefined ? { capabilities } : {}),
512
- // guuey#398: the embedding surface's context line the pod
513
- // composes it into the MODEL's input only; the persisted thread
514
- // and this hook's optimistic user message stay clean.
515
- ...(opts.surfaceContext !== undefined
516
- ? { surfaceContext: opts.surfaceContext }
524
+ // guuey#524: the page-aware turn's carriageread at send time
525
+ // (SPA route changes ride the NEXT turn). All trust semantics
526
+ // are pod-side; see the option's docblock.
527
+ ...(pageContextRef.current !== undefined
528
+ ? { pageContext: pageContextRef.current }
517
529
  : {}),
530
+ // guuey#566: the client-named agent mode — carriage only (live
531
+ // ref, read at send time); every semantic (validation, fallback,
532
+ // subset) is pod-side.
533
+ ...(modeRef.current !== undefined ? { mode: modeRef.current } : {}),
518
534
  };
519
535
  // The wire walk lives in `invokeTurn` (the pure per-turn generator —
520
536
  // its docblock owns the switch semantics); this hook only maps each
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guuey/agent-client",
3
- "version": "0.16.10",
3
+ "version": "0.16.12",
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.3",
38
- "@guuey/mcp-apps-host": "0.16.10"
38
+ "@guuey/mcp-apps-host": "0.16.12"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18"
package/src/index.ts CHANGED
@@ -104,5 +104,6 @@ export type {
104
104
  HistoryLoadResult,
105
105
  StallRecoveryOptions,
106
106
  UseAgentInvokeOptions,
107
+ PageContext,
107
108
  UseAgentInvokeReturn,
108
109
  } from "./types.js";
package/src/types.ts CHANGED
@@ -162,6 +162,17 @@ export interface StallRecoveryOptions {
162
162
  probeAttempts?: number;
163
163
  }
164
164
 
165
+
166
+ /**
167
+ * Where the user is standing (guuey#524): the embedding page, as the host
168
+ * knows it. `path` + `title` only by design — nothing scraped; `context` is
169
+ * an optional short host-declared line (the pod caps it server-side).
170
+ */
171
+ export interface PageContext {
172
+ path: string;
173
+ title: string;
174
+ context?: string;
175
+ }
165
176
  export interface UseAgentInvokeOptions {
166
177
  /** Pod base URL (with or without a trailing `/agent/invoke`). Chat is disabled when null. */
167
178
  endpointUrl: string | null;
@@ -189,14 +200,28 @@ export interface UseAgentInvokeOptions {
189
200
  */
190
201
  capabilities?: AgClientCapabilities;
191
202
  /**
192
- * Where the user IS (guuey#398) — a short context line the embedding
193
- * surface owns ("The user is signed in to the guuey builder console…"),
194
- * sent on every invoke. The pod composes it into the MODEL's input only:
195
- * the persisted thread and this hook's optimistic user message never
196
- * contain it. ≤500 chars (the pod refuses longer). The surface is the
197
- * one place that knows this; the agent's static system prompt cannot.
203
+ /**
204
+ * The host PAGE the user is viewing (guuey#524 v1 the page-aware
205
+ * ephemeral turn): URL path + title, plus an optional short host-declared
206
+ * context string. Sent on the invoke body per turn; read at send time, so
207
+ * an SPA host updates it on route change and the next turn carries the
208
+ * new page. TRUST LIVES POD-SIDE, none here: the pod frames this as
209
+ * UNTRUSTED page content into the model input for that turn only, flags
210
+ * the turn `pageContextPresent` (never client-claimed), and switches the
211
+ * durable sinks off for it (memory/profile/fold/home — the pass-3
212
+ * ephemeral-turn contract). The client's only job is carriage.
213
+ */
214
+ pageContext?: PageContext;
215
+ /**
216
+ * The agent-mode PIN for this surface (guuey#527/#566 — the guest/auth
217
+ * axis). Selection is SERVER-DERIVED from the caller's REAL auth state;
218
+ * this param only pins WITHIN permission: an authed caller may pin
219
+ * `"guest"` (preview-as-visitor), a guest pinning `"auth"` is clamped
220
+ * server-side, and an unrecognized key is ignored — all fail-soft, an
221
+ * embed never breaks. Absent = pure derivation. Modes are subset-only
222
+ * voice overlays, never added privilege.
198
223
  */
199
- surfaceContext?: string;
224
+ mode?: string;
200
225
  /**
201
226
  * Stall recovery for a half-dead stream (guuey#192). A connection that dies
202
227
  * WITHOUT erroring (TCP alive, zero bytes, no `done`) would otherwise leave
@@ -356,6 +356,19 @@ export function useAgentInvoke(opts: UseAgentInvokeOptions): UseAgentInvokeRetur
356
356
  setProfileLinkRequest(null);
357
357
  }, []);
358
358
 
359
+ // guuey#524: `send` is memoized on [endpointUrl, appId, status, signal] —
360
+ // options read inside it are otherwise frozen at memo time. pageContext's
361
+ // whole contract is read-at-SEND-time freshness (SPA route changes must
362
+ // ride the next turn), so it goes through a live ref, the same discipline
363
+ // as every live-read value in the kit layer.
364
+ const pageContextRef = useRef(opts.pageContext);
365
+ pageContextRef.current = opts.pageContext;
366
+ // guuey#566: same live-ref discipline — a surface's mode can change
367
+ // mid-session (a guest signs in and the host flips rep → agent); the
368
+ // NEXT turn carries the new mode.
369
+ const modeRef = useRef(opts.mode);
370
+ modeRef.current = opts.mode;
371
+
359
372
  const send = useCallback(
360
373
  async (input: string) => {
361
374
  // An already-aborted external signal refuses the send outright —
@@ -538,12 +551,16 @@ export function useAgentInvoke(opts: UseAgentInvokeOptions): UseAgentInvokeRetur
538
551
  ...(threadIdRef.current ? { threadId: threadIdRef.current } : {}),
539
552
  clientMessageId,
540
553
  ...(capabilities !== undefined ? { capabilities } : {}),
541
- // guuey#398: the embedding surface's context line the pod
542
- // composes it into the MODEL's input only; the persisted thread
543
- // and this hook's optimistic user message stay clean.
544
- ...(opts.surfaceContext !== undefined
545
- ? { surfaceContext: opts.surfaceContext }
554
+ // guuey#524: the page-aware turn's carriageread at send time
555
+ // (SPA route changes ride the NEXT turn). All trust semantics
556
+ // are pod-side; see the option's docblock.
557
+ ...(pageContextRef.current !== undefined
558
+ ? { pageContext: pageContextRef.current }
546
559
  : {}),
560
+ // guuey#566: the client-named agent mode — carriage only (live
561
+ // ref, read at send time); every semantic (validation, fallback,
562
+ // subset) is pod-side.
563
+ ...(modeRef.current !== undefined ? { mode: modeRef.current } : {}),
547
564
  };
548
565
 
549
566
  // The wire walk lives in `invokeTurn` (the pure per-turn generator —