@artooi/ag-ui-web-component 0.22.0 → 0.23.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/CHANGELOG.md +134 -36
- package/README.md +7 -7
- package/dist/ag-ui-web-component.bundle.js +145 -118
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/constants.d.ts +65 -78
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts +93 -126
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +24 -30
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/attachment.d.ts +9 -14
- package/dist/core/attachment.d.ts.map +1 -1
- package/dist/core/conversation_store.d.ts +20 -27
- package/dist/core/conversation_store.d.ts.map +1 -1
- package/dist/core/create_http_agent.d.ts +13 -15
- package/dist/core/create_http_agent.d.ts.map +1 -1
- package/dist/core/remote_conversation_store.d.ts +8 -9
- package/dist/core/remote_conversation_store.d.ts.map +1 -1
- package/dist/core/run_index.d.ts +11 -20
- package/dist/core/run_index.d.ts.map +1 -1
- package/dist/core/transcribe_audio.d.ts +8 -8
- package/dist/core/transcribe_audio.d.ts.map +1 -1
- package/dist/core/upload_attachment.d.ts +15 -18
- package/dist/core/upload_attachment.d.ts.map +1 -1
- package/dist/core/utils.d.ts +4 -6
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/dom/animations.d.ts +22 -30
- package/dist/dom/animations.d.ts.map +1 -1
- package/dist/dom/dom_driver.d.ts +7 -7
- package/dist/dom/native_setter.d.ts +2 -2
- package/dist/dom/native_setter.d.ts.map +1 -1
- package/dist/index.js +347 -401
- package/dist/index.js.map +2 -2
- package/dist/skills/fill_template.d.ts +4 -5
- package/dist/skills/fill_template.d.ts.map +1 -1
- package/dist/skills/parse_skills.d.ts.map +1 -1
- package/dist/skills/skill.d.ts +7 -8
- package/dist/skills/skill.d.ts.map +1 -1
- package/dist/tools/client_tool_registry.d.ts +2 -2
- package/dist/tools/page_action_tools.d.ts +7 -10
- package/dist/tools/page_action_tools.d.ts.map +1 -1
- package/dist/tools/page_state.d.ts +5 -8
- package/dist/tools/page_state.d.ts.map +1 -1
- package/dist/tools/route_map.d.ts +7 -10
- package/dist/tools/route_map.d.ts.map +1 -1
- package/dist/ui/approval_card.d.ts +15 -20
- package/dist/ui/approval_card.d.ts.map +1 -1
- package/dist/ui/attach_copy_buttons.d.ts +4 -10
- package/dist/ui/attach_copy_buttons.d.ts.map +1 -1
- package/dist/ui/attachment_chips.d.ts +13 -5
- package/dist/ui/attachment_chips.d.ts.map +1 -1
- package/dist/ui/attachment_tray.d.ts +6 -6
- package/dist/ui/attachment_tray.d.ts.map +1 -1
- package/dist/ui/checkpoint_menu.d.ts +7 -8
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/confirmation_card.d.ts +10 -15
- package/dist/ui/confirmation_card.d.ts.map +1 -1
- package/dist/ui/question_card.d.ts +12 -15
- package/dist/ui/question_card.d.ts.map +1 -1
- package/dist/ui/relative_time.d.ts +5 -7
- package/dist/ui/relative_time.d.ts.map +1 -1
- package/dist/ui/render_markdown.d.ts +8 -8
- package/dist/ui/render_markdown.d.ts.map +1 -1
- package/dist/ui/resize_handle.d.ts +21 -34
- package/dist/ui/resize_handle.d.ts.map +1 -1
- package/dist/ui/run_notice.d.ts +5 -7
- package/dist/ui/run_notice.d.ts.map +1 -1
- package/dist/ui/skills_menu.d.ts +4 -5
- package/dist/ui/skills_menu.d.ts.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/thoughts_block.d.ts +9 -11
- package/dist/ui/thoughts_block.d.ts.map +1 -1
- package/dist/ui/thread_drawer.d.ts +6 -5
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts +17 -25
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +6 -12
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/dist/ui/voice_input.d.ts +10 -11
- package/dist/ui/voice_input.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +71 -80
- package/src/core/ag_ui_chat.ts +242 -292
- package/src/core/agui_client.ts +60 -71
- package/src/core/attachment.ts +9 -14
- package/src/core/conversation_store.ts +25 -33
- package/src/core/create_http_agent.ts +18 -22
- package/src/core/remote_conversation_store.ts +14 -15
- package/src/core/run_index.ts +14 -23
- package/src/core/transcribe_audio.ts +9 -10
- package/src/core/upload_attachment.ts +18 -21
- package/src/core/utils.ts +4 -6
- package/src/dom/animations.ts +33 -43
- package/src/dom/dom_driver.ts +7 -7
- package/src/dom/native_setter.ts +11 -12
- package/src/skills/fill_template.ts +4 -5
- package/src/skills/parse_skills.ts +3 -4
- package/src/skills/skill.ts +7 -8
- package/src/tools/client_tool_registry.ts +2 -2
- package/src/tools/page_action_tools.ts +12 -15
- package/src/tools/page_state.ts +5 -8
- package/src/tools/route_map.ts +15 -19
- package/src/ui/approval_card.ts +15 -20
- package/src/ui/attach_copy_buttons.ts +9 -18
- package/src/ui/attachment_chips.ts +19 -10
- package/src/ui/attachment_tray.ts +8 -7
- package/src/ui/checkpoint_menu.ts +7 -8
- package/src/ui/confirmation_card.ts +10 -15
- package/src/ui/question_card.ts +12 -15
- package/src/ui/relative_time.ts +5 -7
- package/src/ui/render_markdown.ts +25 -51
- package/src/ui/resize_handle.ts +25 -38
- package/src/ui/run_notice.ts +9 -12
- package/src/ui/skills_menu.ts +4 -5
- package/src/ui/styles.ts +122 -93
- package/src/ui/thoughts_block.ts +11 -13
- package/src/ui/thread_drawer.ts +6 -5
- package/src/ui/tool_call_card.ts +22 -32
- package/src/ui/ui_strings.ts +6 -12
- package/src/ui/voice_input.ts +10 -11
- package/src/version.ts +1 -1
|
@@ -23,9 +23,9 @@ export interface ToolExecution {
|
|
|
23
23
|
/**
|
|
24
24
|
* Executes a frontend tool call.
|
|
25
25
|
*
|
|
26
|
-
* Returns the {@link ToolExecution} to post back to the agent, or
|
|
27
|
-
* the call is not a frontend tool the host owns
|
|
28
|
-
* already executed
|
|
26
|
+
* Returns the {@link ToolExecution} to post back to the agent, or `null` when
|
|
27
|
+
* the call is not a frontend tool the host owns — a server-side tool the server
|
|
28
|
+
* already executed, which the client must not re-run.
|
|
29
29
|
*/
|
|
30
30
|
export type ExecuteTool = (call: AgUiToolCall) => Promise<ToolExecution | null>;
|
|
31
31
|
/**
|
|
@@ -43,11 +43,10 @@ export type InterruptResponse = {
|
|
|
43
43
|
/**
|
|
44
44
|
* Resolves the approval interrupts a run finished on, keyed by interrupt id.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* unresolved interrupt then simply ends the loop.
|
|
46
|
+
* A gated server-side tool defers instead of executing, so the run finishes on
|
|
47
|
+
* an interrupt outcome; the host collects one decision per interrupt and the
|
|
48
|
+
* loop resumes with the answers. Omit for agents that never gate server-side
|
|
49
|
+
* tools — an unresolved interrupt then ends the loop.
|
|
51
50
|
*/
|
|
52
51
|
export type ResolveInterrupts = (interrupts: readonly Interrupt[]) => Promise<Record<string, InterruptResponse>>;
|
|
53
52
|
/**
|
|
@@ -57,9 +56,9 @@ export type ResolveInterrupts = (interrupts: readonly Interrupt[]) => Promise<Re
|
|
|
57
56
|
*/
|
|
58
57
|
export interface AgUiClientHandlers {
|
|
59
58
|
onRunStart(): void;
|
|
60
|
-
/** Fired on every streamed token;
|
|
59
|
+
/** Fired on every streamed token; `buffer` is the full text so far. */
|
|
61
60
|
onTextDelta(buffer: string): void;
|
|
62
|
-
/** Fired when the assistant message completes;
|
|
61
|
+
/** Fired when the assistant message completes; `buffer` is the final text. */
|
|
63
62
|
onTextEnd(buffer: string): void;
|
|
64
63
|
/** Fired when the agent finishes calling a tool (server- or frontend-side). */
|
|
65
64
|
onToolCall(call: AgUiToolCall): void;
|
|
@@ -85,17 +84,15 @@ export interface AgUiClientHandlers {
|
|
|
85
84
|
onError(message: string): void;
|
|
86
85
|
/**
|
|
87
86
|
* Fired when the user cancelled the run ({@link AgUiClient.cancel}) — the
|
|
88
|
-
* deliberate-stop sibling of `onError`.
|
|
89
|
-
* streamed stays valid
|
|
90
|
-
*
|
|
87
|
+
* deliberate-stop sibling of `onError`. Partial assistant text already
|
|
88
|
+
* streamed stays valid, so the host keeps the bubble and shows a stopped
|
|
89
|
+
* affordance rather than an error. `onSettled` still follows.
|
|
91
90
|
*/
|
|
92
91
|
onCancelled(): void;
|
|
93
92
|
/**
|
|
94
|
-
* Fired exactly once when the
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* to rest (pending indicator cleared, input re-enabled) no matter how the
|
|
98
|
-
* run finished.
|
|
93
|
+
* Fired exactly once when the interaction settles, however the run loop ended
|
|
94
|
+
* — server-only round, rounds exhausted, cancellation, or error. The terminal
|
|
95
|
+
* guarantee that the UI returns to rest.
|
|
99
96
|
*/
|
|
100
97
|
onSettled(): void;
|
|
101
98
|
}
|
|
@@ -126,17 +123,15 @@ export interface AgUiClientConfig extends AgUiRunInputs {
|
|
|
126
123
|
*/
|
|
127
124
|
onPersist?: (messages: readonly Message[]) => void;
|
|
128
125
|
/**
|
|
129
|
-
* Called whenever AG-UI shared state changes —
|
|
130
|
-
* `
|
|
131
|
-
*
|
|
132
|
-
* the result so a host can react.
|
|
126
|
+
* Called whenever AG-UI shared state changes — a streamed `STATE_SNAPSHOT` /
|
|
127
|
+
* `STATE_DELTA`, or {@link AgUiClient.setState}. `@ag-ui/client` owns applying
|
|
128
|
+
* those events; this only forwards the result.
|
|
133
129
|
*/
|
|
134
130
|
onStateChanged?: (state: Readonly<Record<string, unknown>>) => void;
|
|
135
131
|
/**
|
|
136
|
-
* Error text
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* localized string.
|
|
132
|
+
* Error text for {@link AgUiClientHandlers.onError} when a run's stream closes
|
|
133
|
+
* without a terminal AG-UI event. Defaults to `"Connection lost"`; the host
|
|
134
|
+
* passes its localized string.
|
|
140
135
|
*/
|
|
141
136
|
connectionLostMessage?: string;
|
|
142
137
|
}
|
|
@@ -175,15 +170,14 @@ export declare class AgUiClient {
|
|
|
175
170
|
* tools (bounded by {@link MAX_TOOL_ROUNDS}).
|
|
176
171
|
*
|
|
177
172
|
* `attachments` ride on the user message as a non-standard field so the
|
|
178
|
-
* default
|
|
179
|
-
*
|
|
180
|
-
* unknown message field), then reads bytes via the `read_attachment` tool.
|
|
173
|
+
* default store round-trips them for history replay; see
|
|
174
|
+
* {@link messageAttachments}.
|
|
181
175
|
*/
|
|
182
176
|
send(content: string, attachments?: readonly AttachmentRef[]): Promise<void>;
|
|
183
177
|
/**
|
|
184
178
|
* Resume the run loop after a navigating tool's result was supplied
|
|
185
179
|
* post-reload (via {@link addToolResult}). Unlike {@link send}, adds no user
|
|
186
|
-
* message
|
|
180
|
+
* message; it continues the conversation already in history.
|
|
187
181
|
*/
|
|
188
182
|
resume(): Promise<void>;
|
|
189
183
|
/** Append a frontend tool result to history (used by the resume path). */
|
|
@@ -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,w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AAO,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;CAgMF"}
|
|
@@ -3,11 +3,9 @@ import type { Message } from "@ag-ui/core";
|
|
|
3
3
|
* A durable, lightweight reference to one uploaded file — what an upload
|
|
4
4
|
* returns and what rides on a sent message, never the bytes.
|
|
5
5
|
*
|
|
6
|
-
* Mirrors django-ag-ui's `AttachmentRef`:
|
|
6
|
+
* Mirrors django-ag-ui's `AttachmentRef`: the file uploads out-of-band to the
|
|
7
7
|
* attachments endpoint, the server hands back this ref, and the agent reads the
|
|
8
|
-
*
|
|
9
|
-
* message stream free of base64 mirrors how the tool catalog keeps schemas off
|
|
10
|
-
* the wire.
|
|
8
|
+
* content server-side via the `read_attachment` tool.
|
|
11
9
|
*/
|
|
12
10
|
export interface AttachmentRef {
|
|
13
11
|
/** Opaque, owner-scoped handle the server resolves back to bytes. */
|
|
@@ -24,17 +22,14 @@ export interface AttachmentRef {
|
|
|
24
22
|
/**
|
|
25
23
|
* The attachment refs a user message carries.
|
|
26
24
|
*
|
|
27
|
-
* Refs
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `RunAgentInput` validation ignores the unknown field — the model learns the
|
|
32
|
-
* ids from the run context manifest instead.
|
|
25
|
+
* Refs ride on the message as a non-standard `attachments` field, which the
|
|
26
|
+
* default store round-trips and `@ag-ui/client` preserves through `addMessage`
|
|
27
|
+
* / `structuredClone`, so a restored conversation re-renders its chips. The
|
|
28
|
+
* server's strict `RunAgentInput` validation ignores the unknown field.
|
|
33
29
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* abort the whole history replay.
|
|
30
|
+
* Storage is untrusted — hand-edited, truncated, or corrupted — so malformed
|
|
31
|
+
* entries are dropped here; a shapeless one would throw in `iconFor` and abort
|
|
32
|
+
* the whole history replay.
|
|
38
33
|
*/
|
|
39
34
|
export declare function messageAttachments(message: Message): readonly AttachmentRef[];
|
|
40
35
|
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/core/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/core/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,aAAa,EAAE,CAG7E"}
|
|
@@ -10,13 +10,11 @@ export interface NavigationCheckpoint {
|
|
|
10
10
|
readonly toolCallId: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Lightweight metadata for one conversation — the thread-drawer row shape
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* is a one-line excerpt of the latest message; `updatedAt` is epoch ms of the
|
|
19
|
-
* last change, used to order the list.
|
|
13
|
+
* Lightweight metadata for one conversation — the thread-drawer row shape, so
|
|
14
|
+
* the drawer renders without loading message bodies. `title` defaults to a
|
|
15
|
+
* truncation of the first user message until an explicit rename, `preview` is a
|
|
16
|
+
* one-line excerpt of the latest message, and `updatedAt` is epoch ms of the
|
|
17
|
+
* last change, which orders the list.
|
|
20
18
|
*/
|
|
21
19
|
export interface ThreadMeta {
|
|
22
20
|
readonly threadId: string;
|
|
@@ -28,16 +26,14 @@ export interface ThreadMeta {
|
|
|
28
26
|
* Client-side persistence seam for the conversation and a pending-navigation
|
|
29
27
|
* checkpoint, keyed by `thread_id`.
|
|
30
28
|
*
|
|
31
|
-
* The default {@link SessionStorageStore} keeps everything per-tab
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* are therefore async-friendly. The checkpoint methods stay synchronous — the
|
|
36
|
-
* marker is a tiny local hint a server store can derive from history and no-op.
|
|
29
|
+
* The default {@link SessionStorageStore} keeps everything per-tab. A host may
|
|
30
|
+
* inject a server-backed store instead, which is why `loadMessages` and
|
|
31
|
+
* `listThreads` are async. The checkpoint methods stay synchronous: the marker
|
|
32
|
+
* is a small local hint a server store can derive from history and no-op.
|
|
37
33
|
*
|
|
38
|
-
* Thread enumeration
|
|
39
|
-
*
|
|
40
|
-
*
|
|
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.
|
|
41
37
|
*/
|
|
42
38
|
export interface ClientConversationStore {
|
|
43
39
|
/** The active conversation id, generated and persisted on first read. */
|
|
@@ -62,18 +58,15 @@ export interface ClientConversationStore {
|
|
|
62
58
|
/**
|
|
63
59
|
* Default {@link ClientConversationStore}: per-tab `sessionStorage`.
|
|
64
60
|
*
|
|
65
|
-
* Survives full page reloads and same-tab navigation, clears on tab close
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* the drawer so it works with no server.
|
|
61
|
+
* Survives full page reloads and same-tab navigation, clears on tab close.
|
|
62
|
+
* Tracks multiple threads per tab: the active id under one key, message history
|
|
63
|
+
* and checkpoint namespaced by id, and a small index feeding the drawer with no
|
|
64
|
+
* server involved.
|
|
70
65
|
*
|
|
71
|
-
* An optional `namespace` scopes every key to one element
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* (`ag-ui-chat:*`) keys into it once, so an existing conversation survives the
|
|
76
|
-
* upgrade; the default empty namespace keeps the legacy origin-global keys.
|
|
66
|
+
* An optional `namespace` scopes every key to one element, so two
|
|
67
|
+
* `<ag-ui-chat>` instances on the same origin keep separate active-thread
|
|
68
|
+
* pointers and drawer indexes instead of clobbering each other. The default
|
|
69
|
+
* empty namespace keeps the origin-global keys; see {@link #migrateLegacyKeys}.
|
|
77
70
|
*/
|
|
78
71
|
export declare class SessionStorageStore implements ClientConversationStore {
|
|
79
72
|
#private;
|
|
@@ -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
|
|
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,Q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oBAAoB,GAAG,IAAI,CAE5D;IAED,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAO9E;IAED,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAU5B;IAED,WAAW,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAK5C;IAED,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEtC;IAED,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CASlD;CAuFF"}
|
|
@@ -6,20 +6,18 @@ export interface HttpAgentOptions {
|
|
|
6
6
|
headers?: Record<string, string>;
|
|
7
7
|
/**
|
|
8
8
|
* Cookie policy for the run request, as `fetch`'s own `credentials` mode.
|
|
9
|
-
* Unset leaves the browser default (`same-origin`)
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Unset leaves the browser default (`same-origin`), which sends no cookies
|
|
10
|
+
* to an agent endpoint on a different origin or subdomain. A
|
|
11
|
+
* cookie-authenticated cross-origin deployment needs `"include"` here plus a
|
|
12
|
+
* server answering with `Access-Control-Allow-Credentials: true` and a
|
|
13
|
+
* concrete origin.
|
|
14
14
|
*/
|
|
15
15
|
credentials?: RequestCredentials;
|
|
16
16
|
/**
|
|
17
|
-
* Live header source, re-read on
|
|
18
|
-
* static `headers`
|
|
19
|
-
* for the whole conversation
|
|
20
|
-
*
|
|
21
|
-
* mid-conversation. When set, the fetch wrapper overlays these values on
|
|
22
|
-
* each call; `headers` still seeds the initial/static configuration.
|
|
17
|
+
* Live header source, re-read on every request, overlaid on `headers`.
|
|
18
|
+
* `HttpAgent` bakes static `headers` in at construction and the element
|
|
19
|
+
* caches the agent for the whole conversation, so rotating credentials (CSRF,
|
|
20
|
+
* short-lived JWT) must come through here.
|
|
23
21
|
*/
|
|
24
22
|
getHeaders?: () => Record<string, string>;
|
|
25
23
|
/** Stable conversation id, so the agent's runs share a thread. */
|
|
@@ -34,11 +32,11 @@ export interface HttpAgentOptions {
|
|
|
34
32
|
initialState?: Readonly<Record<string, unknown>>;
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
37
|
-
* Build an AG-UI {@link HttpAgent} pointed at
|
|
35
|
+
* Build an AG-UI {@link HttpAgent} pointed at `endpoint`.
|
|
38
36
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
* The default agent factory for `<ag-ui-chat>`; tests and advanced hosts
|
|
38
|
+
* override the element's `agentFactory` to inject a different
|
|
39
|
+
* {@link AbstractAgent}.
|
|
42
40
|
*/
|
|
43
41
|
export declare function createHttpAgent(options: HttpAgentOptions): AbstractAgent;
|
|
44
42
|
/** Signature of the agent factory the element calls to build its agent. */
|
|
@@ -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
|
|
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"}
|
|
@@ -3,10 +3,9 @@ import { type ClientConversationStore, type NavigationCheckpoint, type ThreadMet
|
|
|
3
3
|
/** Live header source, read per request so rotated tokens / CSRF reach the server. */
|
|
4
4
|
type HeadersProvider = () => Record<string, string>;
|
|
5
5
|
/**
|
|
6
|
-
* Live cookie policy, read per request. A provider rather than a value
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* during that first frame.
|
|
6
|
+
* Live cookie policy, read per request. A provider rather than a value: the
|
|
7
|
+
* store is built once on connect, but a host may configure the element after
|
|
8
|
+
* inserting it, and a captured value would pin that first frame's setting.
|
|
10
9
|
*/
|
|
11
10
|
type CredentialsProvider = () => RequestCredentials | undefined;
|
|
12
11
|
/**
|
|
@@ -19,11 +18,11 @@ type CredentialsProvider = () => RequestCredentials | undefined;
|
|
|
19
18
|
* - `PATCH <url><id>/` → rename (`{ "title": … }`);
|
|
20
19
|
* - `DELETE <url><id>/` → delete.
|
|
21
20
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
21
|
+
* Wraps a local store (default {@link SessionStorageStore}) for the client-only
|
|
22
|
+
* concerns — active thread id, navigation checkpoint, message cache — and as
|
|
23
|
+
* the fallback when a request fails. Rename and delete apply optimistically via
|
|
24
|
+
* a local overlay, so the drawer reflects them before the fire-and-forget
|
|
25
|
+
* round-trip lands.
|
|
27
26
|
*/
|
|
28
27
|
export declare class RemoteConversationStore implements ClientConversationStore {
|
|
29
28
|
#private;
|
|
@@ -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,EAEzB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAWjC,sFAAsF;AACtF,KAAK,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD
|
|
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,EAEzB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAWjC,sFAAsF;AACtF,KAAK,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,uBAAwB,YAAW,uBAAuB;;IAQrE,YACE,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,eAA4B,EACrC,KAAK,GAAE,uBAAmD,EAC1D,WAAW,GAAE,mBAAqC,EAMnD;IAED,QAAQ,IAAI,MAAM,CAEjB;IAED,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEtC;IAED,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAGjE;IAED,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAE5D;IAED,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAE9E;IAED,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIlD;IAED,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI5B;IAEK,WAAW,IAAI,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAMlD;IAEK,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC,CAavE;CAoEF"}
|
package/dist/core/run_index.d.ts
CHANGED
|
@@ -9,12 +9,7 @@ export interface RunRow {
|
|
|
9
9
|
}
|
|
10
10
|
/** Live header source, read per request so rotated tokens / CSRF reach the server. */
|
|
11
11
|
type HeadersProvider = () => Record<string, string>;
|
|
12
|
-
/**
|
|
13
|
-
* Live cookie policy, read per request. A provider rather than a value because
|
|
14
|
-
* the index is built once (on connect) and kept, while a host may configure the
|
|
15
|
-
* element after inserting it — a captured value would pin whatever was set
|
|
16
|
-
* during that first frame.
|
|
17
|
-
*/
|
|
12
|
+
/** Live cookie policy, read per request; see `RemoteConversationStore`'s note. */
|
|
18
13
|
type CredentialsProvider = () => RequestCredentials | undefined;
|
|
19
14
|
/**
|
|
20
15
|
* Reads the server's run index and derives the resume / fork URLs beside it.
|
|
@@ -24,26 +19,22 @@ type CredentialsProvider = () => RequestCredentials | undefined;
|
|
|
24
19
|
*
|
|
25
20
|
* - `GET <url>` → the user's runs, newest first.
|
|
26
21
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* boundary has none
|
|
30
|
-
*
|
|
31
|
-
* crashed run worth showing, not worth continuing. {@link continuable} filters
|
|
32
|
-
* for exactly that.
|
|
22
|
+
* Only `continuable` rows can be resumed: the server reports whether a run has
|
|
23
|
+
* a saved snapshot to seed from, and a run that never reached a provider-valid
|
|
24
|
+
* boundary has none. Offer the action only for those rows ({@link continuable}
|
|
25
|
+
* filters them) and treat the rest as informational.
|
|
33
26
|
*
|
|
34
|
-
*
|
|
35
|
-
* django-ag-ui mounts
|
|
36
|
-
*
|
|
37
|
-
* all and there is no way to configure a half-working set.
|
|
27
|
+
* Resume and fork are siblings of the index rather than separate configuration
|
|
28
|
+
* — django-ag-ui mounts `runs/`, `resume/<id>/` and `fork/<id>/` under one
|
|
29
|
+
* prefix — so this one URL locates all three.
|
|
38
30
|
*/
|
|
39
31
|
export declare class RunIndex {
|
|
40
32
|
#private;
|
|
41
33
|
constructor(url: string, headers?: HeadersProvider, credentials?: CredentialsProvider);
|
|
42
34
|
/**
|
|
43
|
-
* The user's runs, or `[]` when the endpoint is unreachable or
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* the user can do nothing about.
|
|
35
|
+
* The user's runs, or `[]` when the endpoint is unreachable or errors — the
|
|
36
|
+
* caller renders its empty state rather than a transport fault the user can
|
|
37
|
+
* do nothing about.
|
|
47
38
|
*/
|
|
48
39
|
list(): Promise<readonly RunRow[]>;
|
|
49
40
|
/** The rows a client may actually continue. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_index.d.ts","sourceRoot":"","sources":["../../src/core/run_index.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ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AM,CAE7B;CAaF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The composer's voice-transcription contract: take a recorded audio `Blob` and
|
|
3
|
-
* resolve to the transcript text. The built-in handler is
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* resolve to the transcript text. The built-in handler is
|
|
4
|
+
* {@link transcribeAudio}; a host swaps in its own (a Web Speech adapter, a
|
|
5
|
+
* direct-to-provider call) via `AgUiChat.transcribeHandler` without touching
|
|
6
|
+
* the mic button.
|
|
7
7
|
*/
|
|
8
8
|
export type TranscribeHandler = (audio: Blob) => Promise<string>;
|
|
9
9
|
/** Options for {@link transcribeAudio}. */
|
|
@@ -23,10 +23,10 @@ export interface TranscribeOptions {
|
|
|
23
23
|
/**
|
|
24
24
|
* POST a recorded clip to the transcription endpoint and resolve to its text.
|
|
25
25
|
*
|
|
26
|
-
* The clip
|
|
27
|
-
* `headers`, mirroring {@link uploadAttachment}
|
|
28
|
-
* `{ "text": "<transcript>" }`. A non-2xx response or a network error rejects
|
|
29
|
-
* the mic button can surface the failure.
|
|
26
|
+
* The clip goes as multipart under the `audio` field with the element's
|
|
27
|
+
* `headers`, mirroring {@link uploadAttachment}, and the server replies
|
|
28
|
+
* `{ "text": "<transcript>" }`. A non-2xx response or a network error rejects
|
|
29
|
+
* so the mic button can surface the failure.
|
|
30
30
|
*/
|
|
31
31
|
export declare function transcribeAudio(audio: Blob, options: TranscribeOptions): Promise<string>;
|
|
32
32
|
//# sourceMappingURL=transcribe_audio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcribe_audio.d.ts","sourceRoot":"","sources":["../../src/core/transcribe_audio.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjE,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"transcribe_audio.d.ts","sourceRoot":"","sources":["../../src/core/transcribe_audio.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjE,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B9F"}
|
|
@@ -2,16 +2,13 @@ import type { AttachmentRef } from "./attachment.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* The composer's upload contract: take a `File`, report `0..1` progress, and
|
|
4
4
|
* resolve to a durable {@link AttachmentRef}. The built-in handler is
|
|
5
|
-
* {@link uploadAttachment}
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* transport-agnostic).
|
|
5
|
+
* {@link uploadAttachment}; a host swaps in its own (a `tus-js-client` or
|
|
6
|
+
* direct-to-S3 adapter) via `AgUiChat.uploadHandler` without touching the tray,
|
|
7
|
+
* the chips, or the AG-UI wire, refs being transport-agnostic.
|
|
9
8
|
*
|
|
10
|
-
* The optional
|
|
11
|
-
*
|
|
12
|
-
* doesn't orphan a server-side file.
|
|
13
|
-
* handlers keep working (the extra argument is simply ignored), and a custom
|
|
14
|
-
* handler that honours it should abort its own transport when the signal fires.
|
|
9
|
+
* The optional `signal` fires when the tray removes a chip or the element is
|
|
10
|
+
* torn down; a handler that honours it should abort its own transport, so a
|
|
11
|
+
* cancelled upload doesn't orphan a server-side file.
|
|
15
12
|
*/
|
|
16
13
|
export type UploadHandler = (file: File, onProgress: (fraction: number) => void, signal?: AbortSignal) => Promise<AttachmentRef>;
|
|
17
14
|
/** Options for {@link uploadAttachment}. */
|
|
@@ -22,11 +19,11 @@ export interface UploadOptions {
|
|
|
22
19
|
readonly headers?: Record<string, string>;
|
|
23
20
|
/**
|
|
24
21
|
* Cookie policy, spelled as `fetch`'s `credentials` mode for consistency with
|
|
25
|
-
* the
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
22
|
+
* the other endpoints, but carried by `XMLHttpRequest`'s two-state
|
|
23
|
+
* `withCredentials`: `"include"` sets it and every other value leaves it off,
|
|
24
|
+
* matching `"same-origin"`. `"omit"` therefore cannot be honoured for a
|
|
25
|
+
* same-origin upload, XHR always sending cookies there; use a custom
|
|
26
|
+
* {@link UploadHandler} if that matters.
|
|
30
27
|
*/
|
|
31
28
|
readonly credentials?: RequestCredentials;
|
|
32
29
|
/** Progress callback, `0..1`, fired as the body uploads. */
|
|
@@ -38,10 +35,10 @@ export interface UploadOptions {
|
|
|
38
35
|
* Upload one file to the attachments endpoint and resolve to its durable
|
|
39
36
|
* {@link AttachmentRef}.
|
|
40
37
|
*
|
|
41
|
-
* Uses `XMLHttpRequest`
|
|
42
|
-
*
|
|
43
|
-
* CSRF / auth ride along
|
|
44
|
-
*
|
|
38
|
+
* Uses `XMLHttpRequest` rather than `fetch` for real upload-progress events.
|
|
39
|
+
* The file goes as multipart under the `file` field with the element's
|
|
40
|
+
* `headers`, so CSRF / auth ride along; a non-2xx response or a network/abort
|
|
41
|
+
* error rejects, letting the tray show an error chip.
|
|
45
42
|
*/
|
|
46
43
|
export declare function uploadAttachment(file: File, options: UploadOptions): Promise<AttachmentRef>;
|
|
47
44
|
//# sourceMappingURL=upload_attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload_attachment.d.ts","sourceRoot":"","sources":["../../src/core/upload_attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"upload_attachment.d.ts","sourceRoot":"","sources":["../../src/core/upload_attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,EACtC,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,mDAAmD;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CA6C3F"}
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay a `credentials` mode onto a fetch `init`, or hand the `init` back
|
|
3
|
-
* untouched when
|
|
3
|
+
* untouched when none is configured.
|
|
4
4
|
*
|
|
5
|
-
* Absent and `undefined`
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Every fetch this component makes has to make that choice, so it is made in one
|
|
9
|
-
* place rather than repeated (and eventually forgotten) at each call site.
|
|
5
|
+
* Absent and `undefined` differ: `exactOptionalPropertyTypes` rejects an
|
|
6
|
+
* explicit `credentials: undefined`, and writing one anyway would state a mode
|
|
7
|
+
* where the point is to leave the browser's own default in place.
|
|
10
8
|
*/
|
|
11
9
|
export declare function withCredentials(init: RequestInit | undefined, credentials: RequestCredentials | undefined): RequestInit | undefined;
|
|
12
10
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/core/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/core/utils.ts"],"names":[],"mappings":"AAEA
|
|
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"}
|