@artooi/ag-ui-web-component 0.26.1 → 0.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 (43) hide show
  1. package/CHANGELOG.md +291 -1
  2. package/README.md +191 -8
  3. package/dist/ag-ui-web-component.bundle.js +50 -50
  4. package/dist/ag-ui-web-component.bundle.js.map +4 -4
  5. package/dist/core/ag_ui_chat.d.ts +61 -3
  6. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  7. package/dist/core/agui_client.d.ts +8 -1
  8. package/dist/core/agui_client.d.ts.map +1 -1
  9. package/dist/core/conversation_store.d.ts +58 -3
  10. package/dist/core/conversation_store.d.ts.map +1 -1
  11. package/dist/core/create_http_agent.d.ts +13 -0
  12. package/dist/core/create_http_agent.d.ts.map +1 -1
  13. package/dist/core/remote_conversation_store.d.ts +29 -1
  14. package/dist/core/remote_conversation_store.d.ts.map +1 -1
  15. package/dist/core/utils.d.ts +42 -0
  16. package/dist/core/utils.d.ts.map +1 -1
  17. package/dist/index.js +602 -104
  18. package/dist/index.js.map +4 -4
  19. package/dist/tools/is_destructive.d.ts +8 -2
  20. package/dist/tools/is_destructive.d.ts.map +1 -1
  21. package/dist/tools/parse_tool_catalog.d.ts +11 -4
  22. package/dist/tools/parse_tool_catalog.d.ts.map +1 -1
  23. package/dist/ui/render_markdown.d.ts +23 -5
  24. package/dist/ui/render_markdown.d.ts.map +1 -1
  25. package/dist/ui/resize_handle.d.ts +5 -1
  26. package/dist/ui/resize_handle.d.ts.map +1 -1
  27. package/dist/ui/ui_strings.d.ts +13 -7
  28. package/dist/ui/ui_strings.d.ts.map +1 -1
  29. package/dist/ui/voice_input.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/core/ag_ui_chat.ts +444 -45
  32. package/src/core/agui_client.ts +43 -2
  33. package/src/core/conversation_store.ts +146 -49
  34. package/src/core/create_http_agent.ts +24 -2
  35. package/src/core/remote_conversation_store.ts +45 -3
  36. package/src/core/utils.ts +83 -1
  37. package/src/tools/is_destructive.ts +8 -2
  38. package/src/tools/parse_tool_catalog.ts +18 -6
  39. package/src/ui/render_markdown.ts +111 -21
  40. package/src/ui/resize_handle.ts +32 -2
  41. package/src/ui/ui_strings.ts +19 -8
  42. package/src/ui/voice_input.ts +43 -0
  43. package/src/version.ts +1 -1
@@ -92,6 +92,22 @@ export declare class AgUiChat extends HTMLElement {
92
92
  * `Authorization` are configured independently and neither drops the other.
93
93
  */
94
94
  getHeaders: (() => Record<string, string>) | null;
95
+ /**
96
+ * Origins, besides the page's own, that this element may send {@link headers}
97
+ * and {@link getHeaders} credentials to without saying so on the console.
98
+ *
99
+ * Seven attributes name a URL, and every one of them carries these headers.
100
+ * They are plain HTML, so a page that builds one from a query parameter or
101
+ * from tenant-authored configuration has handed an attacker the destination,
102
+ * and the token leaves on the element's first request. Naming the origins you
103
+ * expect turns that from silent into either confirmed or reported.
104
+ *
105
+ * A notice rather than a refusal: a cross-origin agent is a documented
106
+ * deployment, so refusing would break working installations to defend against
107
+ * a page that is already interpolating untrusted data into its own markup.
108
+ * Leaving this empty costs nothing but one console line per foreign origin.
109
+ */
110
+ trustedOrigins: readonly string[];
95
111
  /**
96
112
  * Permit `<img>` in rendered assistant markdown. **Off by default**: a
97
113
  * model-controlled image URL is fetched with no user interaction, which
@@ -218,7 +234,18 @@ export declare class AgUiChat extends HTMLElement {
218
234
  /** Attributes the element reacts to after it has been connected. */
219
235
  static get observedAttributes(): string[];
220
236
  attributeChangedCallback(name: string, previous: string | null, value: string | null): void;
221
- /** Declare a frontend tool the agent may call. */
237
+ /**
238
+ * Declare a frontend tool the agent may call.
239
+ *
240
+ * **A handler's thrown message leaves the browser.** When a handler rejects,
241
+ * its `Error.message` is posted back as that call's tool result — into the
242
+ * conversation, on to the AG-UI endpoint, persisted server-side, and
243
+ * forwarded to the model provider on every later round. That is deliberate,
244
+ * since it is what lets the agent recover from a failure it caused; but it
245
+ * means an internal hostname, a signed URL or a stack-derived path in a
246
+ * rethrown error is disclosed to parties the host never chose. Throw the
247
+ * message you would be content for the model to read, and log the detail.
248
+ */
222
249
  registerTool(tool: ClientTool): void;
223
250
  /**
224
251
  * AG-UI **shared state** for this conversation — the protocol's own state
@@ -242,6 +269,33 @@ export declare class AgUiChat extends HTMLElement {
242
269
  /** The AG-UI endpoint URL, read from the `endpoint` attribute. */
243
270
  get endpoint(): string;
244
271
  set endpoint(value: string);
272
+ /**
273
+ * Who the stored conversation belongs to, from the `user-key` attribute.
274
+ *
275
+ * Set it to whatever identifies the signed-in principal — a user id, an
276
+ * account id, a hash of one. The value joins the storage namespace, so two
277
+ * principals in the same tab cannot read each other's transcript, and
278
+ * **changing it purges what the previous one left behind**.
279
+ *
280
+ * That purge is the reason this is a live attribute rather than a
281
+ * connect-time one. `sessionStorage` survives same-tab navigation, so it
282
+ * survives a logout; and a single-page app signs out through its own router
283
+ * without remounting anything, so there is no other moment at which the
284
+ * element could find out. The host naming the new principal — or dropping the
285
+ * attribute — is the signal.
286
+ *
287
+ * Absent means exactly today's behaviour, which is why nothing breaks by
288
+ * leaving it off: the conversation is scoped to the element and to nobody in
289
+ * particular, and on a shared workstation it carries into whoever signs in
290
+ * next in the same tab.
291
+ *
292
+ * The first value to arrive is treated as a host naming the user who was
293
+ * already there, not as a handover: the conversation in progress moves into
294
+ * the principal's namespace rather than being destroyed, so an element
295
+ * configured by an async auth handshake keeps what is on screen.
296
+ */
297
+ get userKey(): string;
298
+ set userKey(value: string);
245
299
  /**
246
300
  * Cookie policy for **every** request this element makes, as `fetch`'s own
247
301
  * `credentials` mode (`"omit"` / `"same-origin"` / `"include"`). Mirrored to
@@ -352,8 +406,12 @@ export declare class AgUiChat extends HTMLElement {
352
406
  */
353
407
  toggleCheckpoints(): void;
354
408
  /**
355
- * Start a fresh conversation: forget the persisted history, drop the
356
- * in-memory run state, clear the transcript, and mint a new thread id.
409
+ * Start a fresh conversation: drop the in-memory run state, clear the
410
+ * transcript, and mint a new thread id.
411
+ *
412
+ * The conversation being left is kept, and stays in the history drawer to
413
+ * return to. Deleting one is the drawer row's own action; a button that
414
+ * starts something new must not be the button that destroys what was there.
357
415
  */
358
416
  newChat(): void;
359
417
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAUL,YAAY,EAWb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAUhC,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AASzF,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,wBAAwB,CAAC;AAG5E,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,aAAa,EAAoB,M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G,IAAI,CAgBlF;CA0FF"}
@@ -87,7 +87,14 @@ export interface AgUiClientHandlers {
87
87
  onActivityChanged(messageId: string, activityType: string, content: unknown): void;
88
88
  /** Fired when a reasoning model starts emitting its chain-of-thought. */
89
89
  onReasoningStart(): void;
90
- /** Fired on every reasoning token; ``buffer`` is the full reasoning text so far. */
90
+ /**
91
+ * Fired on every reasoning token, and once more when the block ends.
92
+ *
93
+ * ``buffer`` is the text accumulated *before* the token that triggered the
94
+ * call, which is what the protocol client passes -- so the stream trails by
95
+ * one delta and the final call, at the end of the block, is what completes
96
+ * it. Render the buffer wholesale rather than appending it.
97
+ */
91
98
  onReasoningDelta(buffer: string): void;
92
99
  /** Fired when the reasoning block ends (before the answer text streams). */
93
100
  onReasoningEnd(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,IAAI,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,YAAY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a,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;IAED;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAED,0EAA0E;IAC1E,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGvD;IAED;;;;;;OAMG;IACH,MAAM,IAAI,IAAI,CAGb;CA2PF"}
@@ -32,12 +32,24 @@ export interface ThreadMeta {
32
32
  * is a small local hint a server store can derive from history and no-op.
33
33
  *
34
34
  * Thread enumeration backs the chat-history drawer; deleting a thread reuses
35
- * {@link clear} and "new chat" reuses {@link threadId} after clearing the
36
- * active thread.
35
+ * {@link clear}, and "new chat" is {@link newThread} which leaves the
36
+ * conversation it moves off of intact, for the drawer to offer back.
37
37
  */
38
38
  export interface ClientConversationStore {
39
39
  /** The active conversation id, generated and persisted on first read. */
40
40
  threadId(): string;
41
+ /**
42
+ * Start a fresh conversation, make it active, and return its id.
43
+ *
44
+ * Existing threads are left where they are: "new chat" adds one, and
45
+ * {@link clear} is the only method that takes one away.
46
+ *
47
+ * Optional, so a store written before this method existed still works. The
48
+ * caller then mints the id itself and hands it to {@link setActiveThread},
49
+ * which loses only the store's own record that the thread is new (see
50
+ * {@link isUnsent}).
51
+ */
52
+ newThread?(): string;
41
53
  /** Load the persisted message history, or `null` when none exists. */
42
54
  loadMessages(threadId: string): Promise<readonly Message[] | null>;
43
55
  /** Persist the message history (and refresh the thread's drawer metadata). */
@@ -72,6 +84,23 @@ export interface ClientConversationStore {
72
84
  */
73
85
  isUnsent?(threadId: string): boolean;
74
86
  }
87
+ /**
88
+ * `sessionStorage.setItem` that survives a store which refuses to write.
89
+ *
90
+ * `setItem` throws on an exhausted quota (a long conversation, or one turn
91
+ * carrying a large tool result) and in privacy modes that deny storage
92
+ * altogether. Every write here is a *durability* concern — surviving a reload —
93
+ * and none of them is worth an exception, because of where they are called
94
+ * from: the element persists the transcript from inside the run loop, so an
95
+ * unguarded throw escapes as a run error and tells the user the agent failed
96
+ * when nothing but the browser's storage did. On the cancel path it escapes as
97
+ * an unhandled rejection instead.
98
+ *
99
+ * So a failed write loses the reload, never the conversation on screen, and
100
+ * says so once. Recovery is in the user's hands already: deleting the oversized
101
+ * thread from the history drawer is a `removeItem`, which frees the quota.
102
+ */
103
+ export declare function writeStoredItem(key: string, value: string): void;
75
104
  /**
76
105
  * Default {@link ClientConversationStore}: per-tab `sessionStorage`.
77
106
  *
@@ -83,12 +112,38 @@ export interface ClientConversationStore {
83
112
  * An optional `namespace` scopes every key to one element, so two
84
113
  * `<ag-ui-chat>` instances on the same origin keep separate active-thread
85
114
  * pointers and drawer indexes instead of clobbering each other. The default
86
- * empty namespace keeps the origin-global keys; see {@link #migrateLegacyKeys}.
115
+ * empty namespace keeps the origin-global keys, which a namespaced store adopts
116
+ * on construction; see {@link SessionStorageStore.adopt}.
87
117
  */
88
118
  export declare class SessionStorageStore implements ClientConversationStore {
89
119
  #private;
90
120
  constructor(namespace?: string);
121
+ /**
122
+ * Move every key a store owns out of `from`'s namespace and into `to`'s.
123
+ *
124
+ * Two callers, one move. The constructor adopts the pre-namespacing global
125
+ * keys (`from` = `""`); `<ag-ui-chat>` adopts an element-scoped conversation
126
+ * into a principal-scoped one the first time a `user-key` arrives, which is a
127
+ * host naming the user who was already there rather than a handover.
128
+ *
129
+ * Only this store's own suffixes move — the element's `collapsed` / `size` /
130
+ * `theme` keys share the global root and are deliberately left where they
131
+ * are. A value already present at the destination wins: the destination is
132
+ * the durable record and the source is the stray this move exists to clear.
133
+ */
134
+ static adopt(from: string, to: string): void;
135
+ /**
136
+ * Forget everything a store holds for `namespace`.
137
+ *
138
+ * The logout primitive: `<ag-ui-chat>` calls it when its `user-key` changes,
139
+ * and a host driving its own store can call it from its own sign-out path.
140
+ * Deliberately narrow — it removes only keys under this exact namespace whose
141
+ * suffix parses as one this store writes, so it can never reach another
142
+ * element's conversation or the host's own `sessionStorage` entries.
143
+ */
144
+ static purge(namespace: string): void;
91
145
  threadId(): string;
146
+ newThread(): string;
92
147
  isUnsent(threadId: string): boolean;
93
148
  loadMessages(threadId: string): Promise<readonly Message[] | null>;
94
149
  saveMessages(threadId: string, messages: readonly Message[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_store.d.ts","sourceRoot":"","sources":["../../src/core/conversation_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,QAAQ,IAAI,MAAM,CAAC;IACnB,sEAAsE;IACtE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACnE,8EAA8E;IAC9E,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;IACnE,0EAA0E;IAC1E,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAAC;IAC9D,4EAA4E;IAC5E,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAAC;IAChF,+EAA+E;IAC/E,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,+EAA+E;IAC/E,WAAW,IA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 +30,19 @@ export interface HttpAgentOptions {
30
30
  * server streams `STATE_SNAPSHOT` / `STATE_DELTA`.
31
31
  */
32
32
  initialState?: Readonly<Record<string, unknown>>;
33
+ /**
34
+ * Origins, besides the document's own, this agent may carry the host's
35
+ * credentials to.
36
+ *
37
+ * Running the agent on another subdomain is a normal deployment and stays
38
+ * supported, so a cross-origin endpoint is not refused — it is *announced*,
39
+ * once per origin, on the console. Listing an origin here says the
40
+ * destination was chosen deliberately and silences the notice for it.
41
+ *
42
+ * Entries are compared as serialized origins (`https://agent.example.com`,
43
+ * scheme and port included), which is what `URL.origin` produces.
44
+ */
45
+ trustedOrigins?: readonly string[];
33
46
  }
34
47
  /**
35
48
  * Build an AG-UI {@link HttpAgent} pointed at `endpoint`.
@@ -1 +1 @@
1
- {"version":3,"file":"create_http_agent.d.ts","sourceRoot":"","sources":["../../src/core/create_http_agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,eAAe,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CA4BxE;AAED,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,aAAa,CAAC"}
1
+ {"version":3,"file":"create_http_agent.d.ts","sourceRoot":"","sources":["../../src/core/create_http_agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,eAAe,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAqCxE;AAED,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,aAAa,CAAC"}
@@ -23,12 +23,40 @@ type CredentialsProvider = () => RequestCredentials | undefined;
23
23
  * the fallback when a request fails. Rename and delete apply optimistically via
24
24
  * a local overlay, so the drawer reflects them before the fire-and-forget
25
25
  * round-trip lands.
26
+ *
27
+ * Pass `cacheMessages: false` to keep message bodies out of the browser
28
+ * entirely; see the constructor.
26
29
  */
27
30
  export declare class RemoteConversationStore implements ClientConversationStore {
28
31
  #private;
29
- constructor(url: string, headers?: HeadersProvider, local?: ClientConversationStore, credentials?: CredentialsProvider);
32
+ /**
33
+ * @param cacheMessages Whether to mirror message bodies into the local store.
34
+ *
35
+ * `true` (the default, and the behaviour this class has always had) keeps a
36
+ * local copy of every turn, so the transcript still replays when the thread
37
+ * endpoint is unreachable. `false` is for the deployment that chose a
38
+ * server-backed store precisely so transcripts do not sit in the browser:
39
+ * regulated content, a shared workstation, an operator who has to be able to
40
+ * say where the conversation lives. It is not the same as passing a local
41
+ * store that does nothing — the local store also owns the active thread id,
42
+ * the navigation checkpoint and the "nothing sent here yet" marker, all of
43
+ * which must keep working — so the opt-out is scoped to the bodies alone.
44
+ *
45
+ * The cost is deliberate and worth stating: with no local copy there is
46
+ * nothing to fall back to, so a failed request shows an empty transcript
47
+ * rather than a stale one, and the drawer's offline list loses its previews
48
+ * (a preview is an excerpt of a message, which is the very thing being kept
49
+ * off the client).
50
+ */
51
+ constructor(url: string, headers?: HeadersProvider, local?: ClientConversationStore, credentials?: CredentialsProvider, cacheMessages?: boolean);
30
52
  threadId(): string;
31
53
  setActiveThread(threadId: string): void;
54
+ /**
55
+ * Delegated to the local store, which owns the active id — and deliberately
56
+ * silent on the wire: the server learns of a thread when its first message is
57
+ * persisted, so an abandoned new chat costs no round-trip and leaves no row.
58
+ */
59
+ newThread(): string;
32
60
  /** Delegated, so wrapping a store does not lose what it knows about its own ids. */
33
61
  isUnsent(threadId: string): boolean;
34
62
  saveMessages(threadId: string, messages: readonly Message[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"remote_conversation_store.d.ts","sourceRoot":"","sources":["../../src/core/remote_conversation_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,E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EAAE,GAAG,IAAI,CAAC,CAsBvE;CAoEF"}
@@ -1,3 +1,4 @@
1
+ import type { ClientConversationStore } from "./conversation_store.js";
1
2
  /**
2
3
  * Overlay a `credentials` mode onto a fetch `init`, or hand the `init` back
3
4
  * untouched when none is configured.
@@ -7,4 +8,45 @@
7
8
  * where the point is to leave the browser's own default in place.
8
9
  */
9
10
  export declare function withCredentials(init: RequestInit | undefined, credentials: RequestCredentials | undefined): RequestInit | undefined;
11
+ /**
12
+ * Start a new conversation in `store` and return its id.
13
+ *
14
+ * `newThread` is optional on the interface, so a store that predates it is
15
+ * driven the only other way the interface allows: mint an id here and make it
16
+ * active. That path loses the store's own note that the thread is new, so a
17
+ * remote store would go on to ask the server for a conversation that cannot
18
+ * exist yet — which is why every store in this package implements the method.
19
+ *
20
+ * What neither path does is clear the thread being left behind. Starting a
21
+ * conversation is not a reason to destroy the previous one.
22
+ */
23
+ export declare function mintThread(store: ClientConversationStore): string;
24
+ /**
25
+ * Announce host credentials about to leave the document's origin.
26
+ *
27
+ * `endpoint` and its six sibling URL attributes are plain HTML, and a page that
28
+ * interpolates one from a query parameter or from tenant-authored
29
+ * configuration has handed an attacker the destination. The browser preflights
30
+ * the custom header, any server willing to answer `Access-Control-Allow-Headers`
31
+ * receives it, and the token leaves on the element's very first request —
32
+ * before the user has done anything. Nothing else in this package compares a
33
+ * configured URL against an expected origin, so without this the delivery is
34
+ * silent, which is the only part of that sequence worth changing.
35
+ *
36
+ * A warning rather than a refusal because a cross-origin agent is a documented
37
+ * deployment: refusing would break working installations to defend against a
38
+ * page that is already interpolating untrusted data into its own markup. What
39
+ * it removes is the silence.
40
+ *
41
+ * `warned` is supplied by the caller rather than held here, per this package's
42
+ * rule against shared mutable state: two elements on one page must each get
43
+ * their own notice, and the set lives exactly as long as its owner.
44
+ *
45
+ * Every configured URL goes through this, not the agent endpoint alone. The
46
+ * tool catalog, the skills list, the thread and attachment endpoints and the
47
+ * upload target are all named by the same kind of host attribute and all carry
48
+ * the same headers, so covering one of them and not the rest would report the
49
+ * least interesting of the seven.
50
+ */
51
+ export declare function warnOnCrossOriginCredentials(url: string | URL, credentialNames: readonly string[], trustedOrigins: readonly string[], warned: Set<string>): void;
10
52
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/core/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,WAAW,EAAE,kBAAkB,GAAG,SAAS,GAC1C,WAAW,GAAG,SAAS,CAEzB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/core/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,WAAW,EAAE,kBAAkB,GAAG,SAAS,GAC1C,WAAW,GAAG,SAAS,CAEzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAOjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAClB,IAAI,CAwBN"}