@parlor/client 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/action-client.d.ts +40 -0
- package/dist/action-client.d.ts.map +1 -0
- package/dist/action-client.js +83 -0
- package/dist/action-client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-client.d.ts +11 -0
- package/dist/plugin-client.d.ts.map +1 -0
- package/dist/plugin-client.js +14 -0
- package/dist/plugin-client.js.map +1 -0
- package/dist/query-keys.d.ts +3 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +5 -0
- package/dist/query-keys.js.map +1 -0
- package/dist/react/agent-ui/activity-state.d.ts +20 -0
- package/dist/react/agent-ui/activity-state.d.ts.map +1 -0
- package/dist/react/agent-ui/activity-state.js +14 -0
- package/dist/react/agent-ui/activity-state.js.map +1 -0
- package/dist/react/agent-ui/chat-activity.d.ts +13 -0
- package/dist/react/agent-ui/chat-activity.d.ts.map +1 -0
- package/dist/react/agent-ui/chat-activity.js +26 -0
- package/dist/react/agent-ui/chat-activity.js.map +1 -0
- package/dist/react/agent-ui/chat-confirm.d.ts +28 -0
- package/dist/react/agent-ui/chat-confirm.d.ts.map +1 -0
- package/dist/react/agent-ui/chat-confirm.js +140 -0
- package/dist/react/agent-ui/chat-confirm.js.map +1 -0
- package/dist/react/agent-ui/chat.d.ts +7 -0
- package/dist/react/agent-ui/chat.d.ts.map +1 -0
- package/dist/react/agent-ui/chat.js +7 -0
- package/dist/react/agent-ui/chat.js.map +1 -0
- package/dist/react/agent-ui/dev.d.ts +12 -0
- package/dist/react/agent-ui/dev.d.ts.map +1 -0
- package/dist/react/agent-ui/dev.js +80 -0
- package/dist/react/agent-ui/dev.js.map +1 -0
- package/dist/react/agent-ui/runtime.d.ts +12 -0
- package/dist/react/agent-ui/runtime.d.ts.map +1 -0
- package/dist/react/agent-ui/runtime.js +50 -0
- package/dist/react/agent-ui/runtime.js.map +1 -0
- package/dist/react/agent-ui/use-agent-activity.d.ts +3 -0
- package/dist/react/agent-ui/use-agent-activity.d.ts.map +1 -0
- package/dist/react/agent-ui/use-agent-activity.js +7 -0
- package/dist/react/agent-ui/use-agent-activity.js.map +1 -0
- package/dist/react/agent-ui/use-agent-confirmations.d.ts +8 -0
- package/dist/react/agent-ui/use-agent-confirmations.d.ts.map +1 -0
- package/dist/react/agent-ui/use-agent-confirmations.js +12 -0
- package/dist/react/agent-ui/use-agent-confirmations.js.map +1 -0
- package/dist/react/agent-ui/use-agent-view.d.ts +11 -0
- package/dist/react/agent-ui/use-agent-view.d.ts.map +1 -0
- package/dist/react/agent-ui/use-agent-view.js +25 -0
- package/dist/react/agent-ui/use-agent-view.js.map +1 -0
- package/dist/react/chat/ask-fields.d.ts +13 -0
- package/dist/react/chat/ask-fields.d.ts.map +1 -0
- package/dist/react/chat/ask-fields.js +46 -0
- package/dist/react/chat/ask-fields.js.map +1 -0
- package/dist/react/chat/chat-ask.d.ts +32 -0
- package/dist/react/chat/chat-ask.d.ts.map +1 -0
- package/dist/react/chat/chat-ask.js +69 -0
- package/dist/react/chat/chat-ask.js.map +1 -0
- package/dist/react/chat/chat-composer.d.ts +18 -0
- package/dist/react/chat/chat-composer.d.ts.map +1 -0
- package/dist/react/chat/chat-composer.js +81 -0
- package/dist/react/chat/chat-composer.js.map +1 -0
- package/dist/react/chat/chat-root.d.ts +14 -0
- package/dist/react/chat/chat-root.d.ts.map +1 -0
- package/dist/react/chat/chat-root.js +21 -0
- package/dist/react/chat/chat-root.js.map +1 -0
- package/dist/react/chat/chat-thread.d.ts +18 -0
- package/dist/react/chat/chat-thread.d.ts.map +1 -0
- package/dist/react/chat/chat-thread.js +69 -0
- package/dist/react/chat/chat-thread.js.map +1 -0
- package/dist/react/chat/context.d.ts +6 -0
- package/dist/react/chat/context.d.ts.map +1 -0
- package/dist/react/chat/context.js +24 -0
- package/dist/react/chat/context.js.map +1 -0
- package/dist/react/chat/create.d.ts +15 -0
- package/dist/react/chat/create.d.ts.map +1 -0
- package/dist/react/chat/create.js +23 -0
- package/dist/react/chat/create.js.map +1 -0
- package/dist/react/chat/open-turns.d.ts +10 -0
- package/dist/react/chat/open-turns.d.ts.map +1 -0
- package/dist/react/chat/open-turns.js +60 -0
- package/dist/react/chat/open-turns.js.map +1 -0
- package/dist/react/chat/runtime.d.ts +156 -0
- package/dist/react/chat/runtime.d.ts.map +1 -0
- package/dist/react/chat/runtime.js +928 -0
- package/dist/react/chat/runtime.js.map +1 -0
- package/dist/react/chat/use-chat.d.ts +4 -0
- package/dist/react/chat/use-chat.d.ts.map +1 -0
- package/dist/react/chat/use-chat.js +22 -0
- package/dist/react/chat/use-chat.js.map +1 -0
- package/dist/react/chat/use-device-setup.d.ts +9 -0
- package/dist/react/chat/use-device-setup.d.ts.map +1 -0
- package/dist/react/chat/use-device-setup.js +17 -0
- package/dist/react/chat/use-device-setup.js.map +1 -0
- package/dist/react/hooks.d.ts +11 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +32 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +20 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +13 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/provider.d.ts +38 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js +126 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/react/retry.d.ts +5 -0
- package/dist/react/retry.d.ts.map +1 -0
- package/dist/react/retry.js +22 -0
- package/dist/react/retry.js.map +1 -0
- package/dist/react/sync-bridge.d.ts +25 -0
- package/dist/react/sync-bridge.d.ts.map +1 -0
- package/dist/react/sync-bridge.js +65 -0
- package/dist/react/sync-bridge.js.map +1 -0
- package/dist/react/sync.d.ts +12 -0
- package/dist/react/sync.d.ts.map +1 -0
- package/dist/react/sync.js +36 -0
- package/dist/react/sync.js.map +1 -0
- package/dist/react/use-capability.d.ts +6 -0
- package/dist/react/use-capability.d.ts.map +1 -0
- package/dist/react/use-capability.js +21 -0
- package/dist/react/use-capability.js.map +1 -0
- package/dist/react/use-devices.d.ts +34 -0
- package/dist/react/use-devices.d.ts.map +1 -0
- package/dist/react/use-devices.js +93 -0
- package/dist/react/use-devices.js.map +1 -0
- package/dist/react/use-link-device.d.ts +42 -0
- package/dist/react/use-link-device.d.ts.map +1 -0
- package/dist/react/use-link-device.js +58 -0
- package/dist/react/use-link-device.js.map +1 -0
- package/dist/register.d.ts +7 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +2 -0
- package/dist/register.js.map +1 -0
- package/dist/session.d.ts +121 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +5 -0
- package/dist/session.js.map +1 -0
- package/package.json +62 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cychien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @parlor/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The browser side of a Parlor app: the action client, and React hooks that read and write through actions and refresh when anyone, including an agent, changes the data.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @parlor/client @tanstack/react-query @tanstack/react-router react react-dom
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { createActionClient } from "@parlor/client";
|
|
11
|
+
import { useActionQuery } from "@parlor/client/react";
|
|
12
|
+
|
|
13
|
+
export const client = createActionClient();
|
|
14
|
+
|
|
15
|
+
export function Health() {
|
|
16
|
+
const status = useActionQuery("health" as never, {} as never);
|
|
17
|
+
return <p>{status.isSuccess ? "up" : "..."}</p>;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
In an app, register the actions once in `src/parlor.d.ts` so names and inputs are typed. Docs: https://cychien.github.io/parlor/guides/pages-and-hooks/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ActionError, type ActionInput, type ActionMap, type ActionOutput, type Tag } from "@parlor/core";
|
|
2
|
+
export declare function generateClientId(): string;
|
|
3
|
+
export type HeadersProvider = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
4
|
+
export interface ActionClientOptions {
|
|
5
|
+
readonly baseUrl?: string | undefined;
|
|
6
|
+
readonly basePath?: string | undefined;
|
|
7
|
+
readonly fetch?: typeof fetch | undefined;
|
|
8
|
+
readonly headers?: HeadersProvider | undefined;
|
|
9
|
+
readonly clientId?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface CallOptions {
|
|
12
|
+
readonly signal?: AbortSignal | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface ActionEnvelope<T> {
|
|
15
|
+
readonly data: T;
|
|
16
|
+
readonly tags: readonly Tag[];
|
|
17
|
+
}
|
|
18
|
+
export interface ActionClient<T extends ActionMap> {
|
|
19
|
+
readonly clientId: string;
|
|
20
|
+
readonly basePath: string;
|
|
21
|
+
call<K extends keyof T & string>(name: K, input: ActionInput<T[K]>, options?: CallOptions): Promise<ActionOutput<T[K]>>;
|
|
22
|
+
invoke<K extends keyof T & string>(name: K, input: ActionInput<T[K]>, options?: CallOptions): Promise<ActionEnvelope<ActionOutput<T[K]>>>;
|
|
23
|
+
request(path: string, init?: RequestInit): Promise<Response>;
|
|
24
|
+
}
|
|
25
|
+
export declare function toActionError(response: Response, options?: {
|
|
26
|
+
readonly missingIsNotFound?: boolean;
|
|
27
|
+
}): Promise<ActionError>;
|
|
28
|
+
export declare function invokeAt<T extends ActionMap, K extends keyof T & string>(request: ActionClient<ActionMap>["request"], path: string, input: ActionInput<T[K]>, options?: CallOptions & {
|
|
29
|
+
readonly missingIsNotFound?: boolean;
|
|
30
|
+
}): Promise<ActionEnvelope<ActionOutput<T[K]>>>;
|
|
31
|
+
export declare function resolveServerOrigin(): string;
|
|
32
|
+
/**
|
|
33
|
+
* The one name of this app's backend on every surface: the page's own origin when it is
|
|
34
|
+
* served over http(s) and is not a shell's webview origin, else the shell's `server.url`.
|
|
35
|
+
* `parlor dev` running several targets names the web target's origin for all of them.
|
|
36
|
+
* Statements are signed for it and the host is paired with it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function appOrigin(serverUrl?: string, injected?: string): string;
|
|
39
|
+
export declare function createActionClient<T extends ActionMap>(options?: ActionClientOptions): ActionClient<T>;
|
|
40
|
+
//# sourceMappingURL=action-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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Y,CAAC,CAAC,CAAC,CA+BjB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ActionError, SHELL_ORIGINS, } from "@parlor/core";
|
|
2
|
+
const DEFAULT_BASE_PATH = "/_parlor";
|
|
3
|
+
const SOURCE_HEADER = "x-parlor-source";
|
|
4
|
+
const CLIENT_HEADER = "x-parlor-client";
|
|
5
|
+
function injectedServerUrl() {
|
|
6
|
+
const env = import.meta.env;
|
|
7
|
+
return env?.PARLOR_SERVER_URL ?? "";
|
|
8
|
+
}
|
|
9
|
+
export function generateClientId() {
|
|
10
|
+
return globalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2);
|
|
11
|
+
}
|
|
12
|
+
async function resolveHeaders(provider, clientId, extra) {
|
|
13
|
+
const headers = new Headers(typeof provider === "function" ? await provider() : provider);
|
|
14
|
+
new Headers(extra).forEach((value, key) => headers.set(key, value));
|
|
15
|
+
headers.set(SOURCE_HEADER, "ui");
|
|
16
|
+
headers.set(CLIENT_HEADER, clientId);
|
|
17
|
+
return headers;
|
|
18
|
+
}
|
|
19
|
+
export async function toActionError(response, options = {}) {
|
|
20
|
+
const body = await response.json().catch(() => undefined);
|
|
21
|
+
if (ActionError.isBody(body))
|
|
22
|
+
return ActionError.fromBody(body);
|
|
23
|
+
const code = options.missingIsNotFound && response.status === 404 ? "not_found" : "internal";
|
|
24
|
+
return new ActionError(code, `Action request failed with HTTP ${response.status}`);
|
|
25
|
+
}
|
|
26
|
+
export async function invokeAt(request, path, input, options = {}) {
|
|
27
|
+
const response = await request(path, {
|
|
28
|
+
method: "POST",
|
|
29
|
+
headers: { "content-type": "application/json" },
|
|
30
|
+
body: JSON.stringify(input ?? {}),
|
|
31
|
+
signal: options.signal ?? null,
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw await toActionError(response, options.missingIsNotFound ? { missingIsNotFound: true } : {});
|
|
35
|
+
}
|
|
36
|
+
const body = (await response.json());
|
|
37
|
+
return { data: body.data, tags: body.tags ?? [] };
|
|
38
|
+
}
|
|
39
|
+
export function resolveServerOrigin() {
|
|
40
|
+
return injectedServerUrl() || globalThis.location?.origin || "";
|
|
41
|
+
}
|
|
42
|
+
function injectedAppOrigin() {
|
|
43
|
+
const env = import.meta.env;
|
|
44
|
+
return env?.PARLOR_APP_ORIGIN ?? "";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The one name of this app's backend on every surface: the page's own origin when it is
|
|
48
|
+
* served over http(s) and is not a shell's webview origin, else the shell's `server.url`.
|
|
49
|
+
* `parlor dev` running several targets names the web target's origin for all of them.
|
|
50
|
+
* Statements are signed for it and the host is paired with it.
|
|
51
|
+
*/
|
|
52
|
+
export function appOrigin(serverUrl = resolveServerOrigin(), injected = injectedAppOrigin()) {
|
|
53
|
+
if (injected)
|
|
54
|
+
return new URL(injected).origin;
|
|
55
|
+
const page = globalThis.location?.origin ?? "";
|
|
56
|
+
if (/^https?:\/\//.test(page) && !SHELL_ORIGINS.includes(page))
|
|
57
|
+
return page;
|
|
58
|
+
try {
|
|
59
|
+
return new URL(serverUrl).origin;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return serverUrl;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function createActionClient(options = {}) {
|
|
66
|
+
const { baseUrl = injectedServerUrl(), basePath = DEFAULT_BASE_PATH, headers, clientId = generateClientId(), } = options;
|
|
67
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
68
|
+
const request = async (path, init = {}) => fetchImpl(`${baseUrl}${path}`, {
|
|
69
|
+
...init,
|
|
70
|
+
headers: await resolveHeaders(headers, clientId, init.headers),
|
|
71
|
+
});
|
|
72
|
+
const invoke = async (name, input, callOptions = {}) => {
|
|
73
|
+
return invokeAt(request, `${basePath}/actions/${name}`, input, callOptions);
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
clientId,
|
|
77
|
+
basePath,
|
|
78
|
+
request,
|
|
79
|
+
invoke,
|
|
80
|
+
call: async (name, input, callOptions) => (await invoke(name, input, callOptions)).data,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=action-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-client.js","sourceRoot":"","sources":["../src/action-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAIX,aAAa,GAEd,MAAM,cAAc,CAAC;AAEtB,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AACxC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAExC,SAAS,iBAAiB;IACxB,MAAM,GAAG,GAAI,OAAO,IAAiD,CAAC,GAAG,CAAC;IAC1E,OAAO,GAAG,EAAE,iBAAiB,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAqCD,KAAK,UAAU,cAAc,CAC3B,QAAqC,EACrC,QAAgB,EAChB,KAAmB;IAEnB,MAAM,OAAO,GAAG,IAAI,OAAO,CACzB,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAC7D,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACrC,OAAO,OAAO,CA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S,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,EAAE;QAC7B,GAAG,IAAI;QACP,OAAO,EAAE,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC;KAC/D,CAAC,CAAC;IAEL,MAAM,MAAM,GAAG,KAAK,EAClB,IAAO,EACP,KAAwB,EACxB,WAAW,GAAgB,EAAE,EACgB,EAAE;QAC/C,OAAO,QAAQ,CAAO,OAAO,EAAE,GAAG,QAAQ,YAAY,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,MAAM;QACN,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CACvC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI;KAChD,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { type ActionClient, appOrigin, type ActionClientOptions, type ActionEnvelope, type CallOptions, createActionClient, generateClientId, type HeadersProvider, } from "./action-client.js";
|
|
2
|
+
export { type AgentViewBinding, type AgentViewDefinition, type AnyAgentView, defineAgentView, type WritableField, } from "@parlor/agent-ui";
|
|
3
|
+
export { ACTION_QUERY_PREFIX, actionQueryKey } from "./query-keys.js";
|
|
4
|
+
export { createPluginClient, type PluginClient } from "./plugin-client.js";
|
|
5
|
+
export type { AccountDevice, DeviceLinker, DeviceSource, FrameworkAuth, HostAuthorizer, PendingLink, SessionDevice, SessionSnapshot, SessionSource, SessionUser, } from "./session.js";
|
|
6
|
+
export { LinkOnComputer } from "./session.js";
|
|
7
|
+
export type { Register, RegisteredActions } from "./register.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,SAAS,EACT,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,eAAe,EACf,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3E,YAAY,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { appOrigin, createActionClient, generateClientId, } from "./action-client.js";
|
|
2
|
+
export { defineAgentView, } from "@parlor/agent-ui";
|
|
3
|
+
export { ACTION_QUERY_PREFIX, actionQueryKey } from "./query-keys.js";
|
|
4
|
+
export { createPluginClient } from "./plugin-client.js";
|
|
5
|
+
export { LinkOnComputer } from "./session.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAIT,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,eAAe,GAEhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAqB,MAAM,oBAAoB,CAAC;AAa3E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ActionMap } from "@parlor/core";
|
|
2
|
+
import { type ActionClient } from "./action-client.js";
|
|
3
|
+
/** A plugin's actions at `/_parlor/<plugin>/actions/<name>`, typed by its registry. */
|
|
4
|
+
export type PluginClient<T extends ActionMap> = Pick<ActionClient<T>, "call" | "invoke">;
|
|
5
|
+
/**
|
|
6
|
+
* Reuses the app client's base URL, headers provider (the session) and client id, so a
|
|
7
|
+
* plugin's actions travel exactly like the app's. A server without the plugin answers
|
|
8
|
+
* `not_found`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createPluginClient<T extends ActionMap>(client: Pick<ActionClient<ActionMap>, "basePath" | "clientId" | "request">, plugin: string): PluginClient<T>;
|
|
11
|
+
//# sourceMappingURL=plugin-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-client.d.ts","sourceRoot":"","sources":["../src/plugin-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,oBAAoB,CAAC;AAEjE,uFAAuF;AACvF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,SAAS,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;AAEzF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EACpD,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC,EAC1E,MAAM,EAAE,MAAM,GACb,YAAY,CAAC,CAAC,CAAC,CAYjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { invokeAt } from "./action-client.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reuses the app client's base URL, headers provider (the session) and client id, so a
|
|
4
|
+
* plugin's actions travel exactly like the app's. A server without the plugin answers
|
|
5
|
+
* `not_found`.
|
|
6
|
+
*/
|
|
7
|
+
export function createPluginClient(client, plugin) {
|
|
8
|
+
const invoke = (name, input, options) => invokeAt(client.request, `${client.basePath}/${plugin}/actions/${name}`, input, { ...options, missingIsNotFound: true });
|
|
9
|
+
return {
|
|
10
|
+
invoke,
|
|
11
|
+
call: async (name, input, options) => (await invoke(name, input, options)).data,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=plugin-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-client.js","sourceRoot":"","sources":["../src/plugin-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAKjE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA0E,EAC1E,MAAc;IAEd,MAAM,MAAM,GAA8B,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CACjE,QAAQ,CACN,MAAM,CAAC,OAAO,EACd,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,YAAY,IAAI,EAAE,EAC9C,KAAK,EACL,EAAE,GAAG,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,CACxC,CAAC;IACJ,OAAO;QACL,MAAM;QACN,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI;KAChF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,YAAI,SAAS,EAAE,QAAQ,CAAU,CAAC;AAElE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,8CAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-keys.js","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC;AAElE,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAc;IACzD,OAAO,CAAC,GAAG,mBAAmB,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAU,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentOrigin, UiErrorCode } from "@parlor/agent-ui";
|
|
2
|
+
import type { AgentActivity, AgentActivityKind } from "@parlor/agent-ui/client";
|
|
3
|
+
export type AgentActivityState = {
|
|
4
|
+
readonly status: "idle";
|
|
5
|
+
} | {
|
|
6
|
+
readonly status: "busy";
|
|
7
|
+
readonly op: AgentActivityKind;
|
|
8
|
+
readonly origin: AgentOrigin;
|
|
9
|
+
} | {
|
|
10
|
+
readonly status: "done";
|
|
11
|
+
readonly op: AgentActivityKind;
|
|
12
|
+
readonly origin: AgentOrigin;
|
|
13
|
+
} | {
|
|
14
|
+
readonly status: "refused";
|
|
15
|
+
readonly op: AgentActivityKind;
|
|
16
|
+
readonly origin: AgentOrigin;
|
|
17
|
+
readonly code: UiErrorCode;
|
|
18
|
+
};
|
|
19
|
+
export declare function deriveActivityState({ busy, last }: AgentActivity, faded: AgentActivity["last"]): AgentActivityState;
|
|
20
|
+
//# sourceMappingURL=activity-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-state.d.ts","sourceRoot":"","sources":["../../../src/react/agent-ui/activity-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3B;IACE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;AAEN,wBAAgB,mBAAmB,CACjC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,aAAa,EAC7B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,GAC3B,kBAAkB,CASpB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function deriveActivityState({ busy, last }, faded) {
|
|
2
|
+
if (!last)
|
|
3
|
+
return { status: "idle" };
|
|
4
|
+
const { op, origin, outcome } = last;
|
|
5
|
+
if (busy)
|
|
6
|
+
return { status: "busy", op, origin };
|
|
7
|
+
if (last === faded)
|
|
8
|
+
return { status: "idle" };
|
|
9
|
+
if (outcome?.status === "refused") {
|
|
10
|
+
return { status: "refused", op, origin, code: outcome.code };
|
|
11
|
+
}
|
|
12
|
+
return { status: "done", op, origin };
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=activity-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-state.js","sourceRoot":"","sources":["../../../src/react/agent-ui/activity-state.ts"],"names":[],"mappings":"AAsBA,MAAM,UAAU,mBAAmB,CACjC,EAAE,IAAI,EAAE,IAAI,EAAiB,EAC7B,KAA4B;IAE5B,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACrC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACrC,IAAI,IAAI;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAChD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9C,IAAI,OAAO,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/D,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { type AgentActivityState } from "./activity-state.js";
|
|
3
|
+
export interface ChatActivityProps extends Omit<ComponentProps<"span">, "children"> {
|
|
4
|
+
/** Milliseconds a finished event stays `done` or `refused` before it reads `idle`. */
|
|
5
|
+
readonly linger?: number;
|
|
6
|
+
readonly children: (state: AgentActivityState) => ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A polite live region that says what an agent is doing on this screen. The app writes the
|
|
10
|
+
* words; style it through `[data-state]` and `[data-op]`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Activity({ linger, children, ...props }: ChatActivityProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=chat-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-activity.d.ts","sourceRoot":"","sources":["../../../src/react/agent-ui/chat-activity.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,KAAK,kBAAkB,EAAuB,MAAM,qBAAqB,CAAC;AAiBnF,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IACjF,sFAAsF;IACtF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC;CAC7D;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAA0B,EAC1B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAanB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { deriveActivityState } from "./activity-state.js";
|
|
4
|
+
import { useAgentActivity } from "./use-agent-activity.js";
|
|
5
|
+
const DEFAULT_LINGER_MS = 2000;
|
|
6
|
+
function useActivityState(lingerMs) {
|
|
7
|
+
const activity = useAgentActivity();
|
|
8
|
+
const [faded, setFaded] = useState();
|
|
9
|
+
const { busy, last } = activity;
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (busy || !last)
|
|
12
|
+
return;
|
|
13
|
+
const timer = setTimeout(() => setFaded(last), lingerMs);
|
|
14
|
+
return () => clearTimeout(timer);
|
|
15
|
+
}, [busy, last, lingerMs]);
|
|
16
|
+
return deriveActivityState(activity, faded);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A polite live region that says what an agent is doing on this screen. The app writes the
|
|
20
|
+
* words; style it through `[data-state]` and `[data-op]`.
|
|
21
|
+
*/
|
|
22
|
+
export function Activity({ linger = DEFAULT_LINGER_MS, children, ...props }) {
|
|
23
|
+
const state = useActivityState(linger);
|
|
24
|
+
return (_jsx("span", { role: "status", "aria-live": "polite", ...props, "data-state": state.status, "data-op": state.status === "idle" ? undefined : state.op, children: children(state) }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=chat-activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-activity.js","sourceRoot":"","sources":["../../../src/react/agent-ui/chat-activity.tsx"],"names":[],"mappings":";AACA,OAAO,EAAuC,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAA2B,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,SAAS,gBAAgB,CAAC,QAAgB;IACxC,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAyB,CAAC;IAC5D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAChC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO;QAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QACzD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3B,OAAO,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC;AAQD;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,MAAM,GAAG,iBAAiB,EAC1B,QAAQ,EACR,GAAG,KAAK,EACU;IAClB,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,CACL,eACE,IAAI,EAAC,QAAQ,eACH,QAAQ,KACd,KAAK,gBACG,KAAK,CAAC,MAAM,aACf,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,YAEtD,QAAQ,CAAC,KAAK,CAAC,GACX,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentConfirmation } from "@parlor/agent-ui/client";
|
|
2
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
3
|
+
export interface ChatConfirmationsProps extends Omit<ComponentProps<"div">, "children"> {
|
|
4
|
+
/** Shown while no agent request waits. */
|
|
5
|
+
readonly empty?: ReactNode;
|
|
6
|
+
readonly children: (confirmation: AgentConfirmation) => ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Lists the agent requests waiting for this user, newest last. Rendering it is what tells
|
|
10
|
+
* the server this client can show a confirmation, so keep it mounted wherever the user can
|
|
11
|
+
* answer. `data-pending` carries the count while any wait. When the card holding focus goes
|
|
12
|
+
* away, focus moves to the next card, or to the list when none is left, so it never falls
|
|
13
|
+
* out of an enclosing dialog.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Confirmations({ empty, children, ref, ...props }: ChatConfirmationsProps): import("react").JSX.Element;
|
|
16
|
+
export interface ChatConfirmProps extends ComponentProps<"div"> {
|
|
17
|
+
readonly confirmation: AgentConfirmation;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One request as a labelled group. Escape inside it declines, and stops there so an
|
|
21
|
+
* enclosing dialog stays open. It never takes focus by itself, but it can hold it
|
|
22
|
+
* (`tabIndex` -1) so `Chat.Confirmations` can keep focus in the list.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Confirm({ confirmation, onKeyDown, ref, ...props }: ChatConfirmProps): import("react").JSX.Element;
|
|
25
|
+
export declare function ConfirmLabel(props: Omit<ComponentProps<"p">, "id">): import("react").JSX.Element;
|
|
26
|
+
export declare function Approve({ onClick, ...props }: ComponentProps<"button">): import("react").JSX.Element;
|
|
27
|
+
export declare function Decline({ onClick, ...props }: ComponentProps<"button">): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=chat-confirm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-confirm.d.ts","sourceRoot":"","sources":["../../../src/react/agent-ui/chat-confirm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAkCf,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACrF,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAE,iBAAiB,KAAK,SAAS,CAAC;CACnE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,sBAAsB,+BAoExB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC7D,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BA6CnF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,+BAGlE;AAED,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,+BAYtE;AAED,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,+BAYtE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, Fragment, use, useCallback, useId, useLayoutEffect, useMemo, useRef, } from "react";
|
|
3
|
+
import { useAgentConfirmations } from "./use-agent-confirmations.js";
|
|
4
|
+
const ConfirmScope = createContext(undefined);
|
|
5
|
+
const ListScope = createContext(undefined);
|
|
6
|
+
function assignRef(ref, value) {
|
|
7
|
+
if (typeof ref === "function")
|
|
8
|
+
return ref(value);
|
|
9
|
+
if (ref) {
|
|
10
|
+
ref.current = value;
|
|
11
|
+
return () => {
|
|
12
|
+
ref.current = null;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function useConfirm(part) {
|
|
17
|
+
const scope = use(ConfirmScope);
|
|
18
|
+
if (!scope)
|
|
19
|
+
throw new Error(`${part} must be rendered inside Chat.Confirm.`);
|
|
20
|
+
return scope;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Lists the agent requests waiting for this user, newest last. Rendering it is what tells
|
|
24
|
+
* the server this client can show a confirmation, so keep it mounted wherever the user can
|
|
25
|
+
* answer. `data-pending` carries the count while any wait. When the card holding focus goes
|
|
26
|
+
* away, focus moves to the next card, or to the list when none is left, so it never falls
|
|
27
|
+
* out of an enclosing dialog.
|
|
28
|
+
*/
|
|
29
|
+
export function Confirmations({ empty, children, ref, ...props }) {
|
|
30
|
+
const confirmations = useAgentConfirmations();
|
|
31
|
+
const list = useRef(null);
|
|
32
|
+
const cards = useRef(new Map());
|
|
33
|
+
const shownIds = useRef([]);
|
|
34
|
+
const releasedId = useRef(undefined);
|
|
35
|
+
const attach = useCallback((element) => {
|
|
36
|
+
list.current = element;
|
|
37
|
+
const detach = assignRef(ref, element);
|
|
38
|
+
return () => {
|
|
39
|
+
list.current = null;
|
|
40
|
+
if (detach)
|
|
41
|
+
detach();
|
|
42
|
+
else
|
|
43
|
+
assignRef(ref, null);
|
|
44
|
+
};
|
|
45
|
+
}, [ref]);
|
|
46
|
+
const scope = useMemo(() => ({
|
|
47
|
+
register: (id, element) => {
|
|
48
|
+
cards.current.set(id, element);
|
|
49
|
+
return () => {
|
|
50
|
+
cards.current.delete(id);
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
releasingFocus: (id) => {
|
|
54
|
+
releasedId.current = id;
|
|
55
|
+
},
|
|
56
|
+
}), []);
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
const released = releasedId.current;
|
|
59
|
+
releasedId.current = undefined;
|
|
60
|
+
const ids = confirmations.map((confirmation) => confirmation.id);
|
|
61
|
+
const previousIds = shownIds.current;
|
|
62
|
+
shownIds.current = ids;
|
|
63
|
+
const listElement = list.current;
|
|
64
|
+
if (released === undefined || !listElement)
|
|
65
|
+
return;
|
|
66
|
+
const active = document.activeElement;
|
|
67
|
+
if (active && active !== document.body && listElement.contains(active))
|
|
68
|
+
return;
|
|
69
|
+
const index = previousIds.indexOf(released);
|
|
70
|
+
const nextId = ids[Math.min(index, ids.length - 1)];
|
|
71
|
+
(nextId === undefined
|
|
72
|
+
? listElement
|
|
73
|
+
: (cards.current.get(nextId) ?? listElement)).focus();
|
|
74
|
+
});
|
|
75
|
+
return (_jsx(ListScope, { value: scope, children: _jsx("div", { "aria-live": "polite", tabIndex: -1, ...props, ref: attach, "data-pending": confirmations.length > 0 ? confirmations.length : undefined, children: confirmations.length === 0
|
|
76
|
+
? empty
|
|
77
|
+
: confirmations.map((confirmation) => (_jsx(Fragment, { children: children(confirmation) }, confirmation.id))) }) }));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* One request as a labelled group. Escape inside it declines, and stops there so an
|
|
81
|
+
* enclosing dialog stays open. It never takes focus by itself, but it can hold it
|
|
82
|
+
* (`tabIndex` -1) so `Chat.Confirmations` can keep focus in the list.
|
|
83
|
+
*/
|
|
84
|
+
export function Confirm({ confirmation, onKeyDown, ref, ...props }) {
|
|
85
|
+
const labelId = useId();
|
|
86
|
+
const list = use(ListScope);
|
|
87
|
+
const group = useRef(null);
|
|
88
|
+
const { id } = confirmation;
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
const element = group.current;
|
|
91
|
+
if (!list || !element)
|
|
92
|
+
return;
|
|
93
|
+
const unregister = list.register(id, element);
|
|
94
|
+
return () => {
|
|
95
|
+
if (element.contains(document.activeElement))
|
|
96
|
+
list.releasingFocus(id);
|
|
97
|
+
unregister();
|
|
98
|
+
};
|
|
99
|
+
}, [list, id]);
|
|
100
|
+
const attach = useCallback((element) => {
|
|
101
|
+
group.current = element;
|
|
102
|
+
const detach = assignRef(ref, element);
|
|
103
|
+
return () => {
|
|
104
|
+
if (detach)
|
|
105
|
+
detach();
|
|
106
|
+
else
|
|
107
|
+
assignRef(ref, null);
|
|
108
|
+
};
|
|
109
|
+
}, [ref]);
|
|
110
|
+
const decline = (event) => {
|
|
111
|
+
onKeyDown?.(event);
|
|
112
|
+
if (event.defaultPrevented || event.key !== "Escape")
|
|
113
|
+
return;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
confirmation.decline();
|
|
117
|
+
};
|
|
118
|
+
return (_jsx(ConfirmScope, { value: { confirmation, labelId }, children: _jsx("div", { role: "group", "aria-labelledby": labelId, "data-action": confirmation.action, tabIndex: -1, ...props, ref: attach, onKeyDown: decline }) }));
|
|
119
|
+
}
|
|
120
|
+
export function ConfirmLabel(props) {
|
|
121
|
+
const { labelId } = useConfirm("Chat.ConfirmLabel");
|
|
122
|
+
return _jsx("p", { ...props, id: labelId });
|
|
123
|
+
}
|
|
124
|
+
export function Approve({ onClick, ...props }) {
|
|
125
|
+
const { confirmation } = useConfirm("Chat.Approve");
|
|
126
|
+
return (_jsx("button", { type: "button", ...props, onClick: (event) => {
|
|
127
|
+
onClick?.(event);
|
|
128
|
+
if (!event.defaultPrevented)
|
|
129
|
+
confirmation.approve();
|
|
130
|
+
} }));
|
|
131
|
+
}
|
|
132
|
+
export function Decline({ onClick, ...props }) {
|
|
133
|
+
const { confirmation } = useConfirm("Chat.Decline");
|
|
134
|
+
return (_jsx("button", { type: "button", ...props, onClick: (event) => {
|
|
135
|
+
onClick?.(event);
|
|
136
|
+
if (!event.defaultPrevented)
|
|
137
|
+
confirmation.decline();
|
|
138
|
+
} }));
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=chat-confirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-confirm.js","sourceRoot":"","sources":["../../../src/react/agent-ui/chat-confirm.tsx"],"names":[],"mappings":";AACA,OAAO,EAEL,aAAa,EACb,QAAQ,EAIR,GAAG,EACH,WAAW,EACX,KAAK,EACL,eAAe,EACf,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,MAAM,YAAY,GAAG,aAAa,CAA6B,SAAS,CAAC,CAAC;AAO1E,MAAM,SAAS,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAEpE,SAAS,SAAS,CAAI,GAAuB,EAAE,KAAe;IAC5D,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,GAAG,EAAE,CAAC;QACR,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;QACpB,OAAO,GAAG,EAAE;YACV,GAAG,CAAC,OAAO,GA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CAAC;IACpD,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,KACT,KAAK,EACT,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,CAAC,KAAK,CAAC,gBAAgB;gBAAE,YAAY,CAAC,OAAO,EAAE,CAAC;QACtD,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAA4B;IACrE,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACpD,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,KACT,KAAK,EACT,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,CAAC,KAAK,CAAC,gBAAgB;gBAAE,YAAY,CAAC,OAAO,EAAE,CAAC;QACtD,CAAC,GACD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Activity } from "./chat-activity.js";
|
|
2
|
+
export { Approve, Confirm, ConfirmLabel, Confirmations, Decline, } from "./chat-confirm.js";
|
|
3
|
+
export { Ask, AskChoice, AskForm } from "../chat/chat-ask.js";
|
|
4
|
+
export { Composer, Input, Send, Status, Stop } from "../chat/chat-composer.js";
|
|
5
|
+
export { Root } from "../chat/chat-root.js";
|
|
6
|
+
export { LoadOlder, Thread } from "../chat/chat-thread.js";
|
|
7
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/react/agent-ui/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,aAAa,EACb,OAAO,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Activity } from "./chat-activity.js";
|
|
2
|
+
export { Approve, Confirm, ConfirmLabel, Confirmations, Decline, } from "./chat-confirm.js";
|
|
3
|
+
export { Ask, AskChoice, AskForm } from "../chat/chat-ask.js";
|
|
4
|
+
export { Composer, Input, Send, Status, Stop } from "../chat/chat-composer.js";
|
|
5
|
+
export { Root } from "../chat/chat-root.js";
|
|
6
|
+
export { LoadOlder, Thread } from "../chat/chat-thread.js";
|
|
7
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/react/agent-ui/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,aAAa,EACb,OAAO,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ScreenSnapshot } from "@parlor/agent-ui";
|
|
2
|
+
import type { AgentUiClient } from "@parlor/agent-ui/client";
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__parlor?: {
|
|
6
|
+
readonly clientId: string;
|
|
7
|
+
screen(): Promise<ScreenSnapshot>;
|
|
8
|
+
} | undefined;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare function installAgentUiDevtools(agentUi: AgentUiClient, clientId: string): () => void;
|
|
12
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/react/agent-ui/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,QAAQ,CAAC,EACL;YAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC,CAAA;SAAE,GAChE,SAAS,CAAC;KACf;CACF;AA4ED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,MAAM,GACf,MAAM,IAAI,CAOZ"}
|