@agentorg/cli 0.0.3 → 0.0.5
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/README.md +15 -11
- package/dist/bundled/index.json +4 -4
- package/dist/bundled/{sha256-87e121cbe58279f3a633e61c9773b61fc17fd53eac3d7c6f037925cbfd5d5384.agentorg → sha256-0e91cc3d0e9762b81abc2427b5496b20f383abcd6fb97d928a8d50e956b54d1f.agentorg} +0 -0
- package/dist/bundled/sha256-1f64ca62a0209d767d6aa6c4feb50b0653d60f10bebbc301f79bd3a37e0153c1.agentorg +0 -0
- package/dist/bundled/{sha256-51ecf151e590f5e57f28229d4cb36e4932a2f1670e50ddf1a3ccf335a1ee146d.agentorg → sha256-4055f8fddf6b90f3d356543f554b2a9e9a2c4a8827a8774f8f87952dc1692331.agentorg} +0 -0
- package/dist/bundled/{sha256-b76ec31282e5b863ee9569dfd9d50b283a21101cbe1b3fac23d1cbcf16b9a408.agentorg → sha256-e356ea3c1899138a8494baf521556831006f38534fa9e92ae873e7e6956c3a46.agentorg} +0 -0
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/build.d.ts +2 -2
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/build.js +14 -4
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/hub-actor.js +41 -0
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/index.d.ts +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/index.js +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/router.js +40 -16
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/state.d.ts +87 -2
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/state.js +312 -60
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/storage.d.ts +2 -1
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/storage.js +3 -2
- package/{node_modules → dist/node_modules}/@agentorg/hub/package.json +3 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/hub.d.ts +62 -3
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/hub.js +54 -3
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/index.d.ts +1 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/index.js +1 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/installer.d.ts +37 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/installer.js +34 -3
- package/dist/node_modules/@agentorg/interfaces/dist/src/rules.d.ts +35 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/rules.js +37 -0
- package/dist/node_modules/@agentorg/kit/dist/src/chat.d.ts +37 -0
- package/dist/node_modules/@agentorg/kit/dist/src/chat.js +131 -0
- package/dist/node_modules/@agentorg/kit/dist/src/components.d.ts +94 -0
- package/dist/node_modules/@agentorg/kit/dist/src/components.js +66 -0
- package/dist/node_modules/@agentorg/kit/dist/src/icons.d.ts +17 -0
- package/dist/node_modules/@agentorg/kit/dist/src/icons.js +30 -0
- package/dist/node_modules/@agentorg/kit/dist/src/index.d.ts +6 -0
- package/dist/node_modules/@agentorg/kit/dist/src/index.js +10 -0
- package/dist/node_modules/@agentorg/kit/dist/src/markdown.d.ts +9 -0
- package/dist/node_modules/@agentorg/kit/dist/src/markdown.js +14 -0
- package/dist/node_modules/@agentorg/kit/dist/src/resizable.d.ts +5 -0
- package/dist/node_modules/@agentorg/kit/dist/src/resizable.js +8 -0
- package/dist/node_modules/@agentorg/kit/dist/src/styles.d.ts +11 -0
- package/dist/node_modules/@agentorg/kit/dist/src/styles.js +166 -0
- package/dist/node_modules/@agentorg/kit/package.json +44 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/frame/runtime.js +172 -17
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/host/runner.js +168 -11
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client.d.ts +18 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client.js +24 -3
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.d.ts +8 -0
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.js +64 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-entry.js +4 -4
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-host.d.ts +1 -10
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-host.js +0 -23
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-protocol.d.ts +0 -8
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame.d.ts +0 -2
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame.js +0 -8
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host.js +5 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/index.d.ts +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module-host.d.ts +6 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module-host.js +24 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module.d.ts +30 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/package.js +111 -6
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/runtime.d.ts +22 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/runtime.js +114 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/testing.d.ts +14 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/testing.js +89 -0
- package/{node_modules → dist/node_modules}/@agentorg/shell/dist/app.css +27 -144
- package/dist/node_modules/@agentorg/shell/dist/app.js +219 -0
- package/{node_modules → dist/node_modules}/@agentorg/shell/package.json +1 -0
- package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/index.d.ts +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/ops.d.ts +14 -1
- package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/ops.js +22 -2
- package/dist/src/cli.js +23 -0
- package/dist/src/gateway.js +42 -1
- package/dist/src/model.d.ts +7 -4
- package/dist/src/model.js +83 -14
- package/dist/src/rules.d.ts +71 -0
- package/dist/src/rules.js +157 -0
- package/package.json +13 -16
- package/dist/bundled/sha256-e4c0e857cea3a721998effe2ca859c4011978b9bc36e63c058bfc17c27a1772e.agentorg +0 -0
- package/node_modules/@agentorg/sdk/dist/src/testing.js +0 -51
- package/node_modules/@agentorg/shell/dist/app.js +0 -9
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/hub-actor.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/logs.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/logs.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/net.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/net.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/processes.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/processes.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/router.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/server.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/server.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate-worker.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate-worker.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/account-login.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/account-login.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/chat.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/chat.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/http-egress.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/http-egress.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/kv.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/kv.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/layout.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/layout.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/llm-session.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/llm-session.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/storage-admin.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/storage-admin.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-shell.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-shell.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-view.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-view.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/build.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/build.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/canonical.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/canonical.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/cli.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/cli.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client-http.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client-http.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/describe.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/describe.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/errors.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/errors.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-entry.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-protocol.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host-main.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host-main.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/interface.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/interface.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest-api.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest-api.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/package.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/person-commands.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/person-commands.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/tar.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/tar.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/shell/dist/agent-bindings.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/shell/dist/index.html +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/shell/src/agent-bindings.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/bytes.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/bytes.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/frames.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/frames.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/transports.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/transports.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/yamux.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/yamux.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/package.json +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A conversation with an agent, on assistant-ui's primitives (Thread, Message, Composer,
|
|
3
|
+
// ActionBar) over an external store: the caller keeps the messages and runs the turns.
|
|
4
|
+
import { ActionBarPrimitive, AssistantRuntimeProvider, ComposerPrimitive, MessagePrimitive, ThreadPrimitive, useAui, useAuiState, useExternalStoreRuntime, } from "@assistant-ui/react";
|
|
5
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
6
|
+
import { IconButton } from "./components.js";
|
|
7
|
+
import { ChevronIcon, CopyIcon, RetryIcon, SendIcon, StopIcon, ToolIcon } from "./icons.js";
|
|
8
|
+
import { Markdown } from "./markdown.js";
|
|
9
|
+
/**
|
|
10
|
+
* The entries as assistant-ui's messages: a person's message each, and every run of replies and
|
|
11
|
+
* tool messages between two of theirs as one reply whose parts are in order. A tool message is a
|
|
12
|
+
* tool-call part that keeps its entry, so a card can be drawn from it.
|
|
13
|
+
*/
|
|
14
|
+
function threadOf(entries, running) {
|
|
15
|
+
const thread = [];
|
|
16
|
+
let reply;
|
|
17
|
+
const close = () => {
|
|
18
|
+
if (reply)
|
|
19
|
+
thread.push({ role: "assistant", id: reply.id, content: reply.content });
|
|
20
|
+
reply = undefined;
|
|
21
|
+
};
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
if (entry.role === "user") {
|
|
24
|
+
close();
|
|
25
|
+
thread.push({ role: "user", id: entry.id, content: [{ type: "text", text: entry.text }] });
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
reply ??= { id: entry.id, content: [] };
|
|
29
|
+
reply.content.push(entry.role === "assistant"
|
|
30
|
+
? { type: "text", text: entry.text }
|
|
31
|
+
: {
|
|
32
|
+
type: "tool-call",
|
|
33
|
+
toolCallId: entry.id,
|
|
34
|
+
toolName: entry.tool?.name ?? "",
|
|
35
|
+
argsText: entry.tool?.input ?? "",
|
|
36
|
+
artifact: entry,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
close();
|
|
40
|
+
const last = thread.at(-1);
|
|
41
|
+
if (running && last?.role === "assistant")
|
|
42
|
+
thread[thread.length - 1] = { ...last, status: { type: "running" } };
|
|
43
|
+
return thread;
|
|
44
|
+
}
|
|
45
|
+
const textOf = (message) => message.content.map((part) => (part.type === "text" ? part.text : "")).join("");
|
|
46
|
+
export function Chat(props) {
|
|
47
|
+
const { messages, running, onSend, onCancel, onRetry, hasEarlier, onEarlier } = props;
|
|
48
|
+
// A refused send puts its text back, into the composer the runtime keeps.
|
|
49
|
+
const [kept, setKept] = useState();
|
|
50
|
+
const runtime = useExternalStoreRuntime({
|
|
51
|
+
messages: threadOf(messages, running),
|
|
52
|
+
convertMessage: (message) => message,
|
|
53
|
+
isRunning: running,
|
|
54
|
+
onNew: async (message) => {
|
|
55
|
+
const text = textOf(message);
|
|
56
|
+
try {
|
|
57
|
+
await onSend(text);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
setKept((was) => ({ text, n: (was?.n ?? 0) + 1 }));
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
onCancel: async () => onCancel(),
|
|
64
|
+
// The options keep one shape whatever is given: the runtime doesn't take a change of shape.
|
|
65
|
+
onReload: async () => onRetry?.(),
|
|
66
|
+
hasEarlier: !!(hasEarlier && onEarlier),
|
|
67
|
+
onLoadEarlier: async () => onEarlier?.(),
|
|
68
|
+
});
|
|
69
|
+
return (_jsx(AssistantRuntimeProvider, { runtime: runtime, children: _jsx(Thread, { ...props, kept: kept }) }));
|
|
70
|
+
}
|
|
71
|
+
function Thread({ notice, footer, name, avatar, label = "Message", kept, running, onRetry, }) {
|
|
72
|
+
return (_jsx(Agent.Provider, { value: { name, avatar, retry: !!onRetry }, children: _jsxs(ThreadPrimitive.Root, { className: "kit-chat", children: [_jsx(ThreadPrimitive.Viewport, { className: "kit-chat-viewport", role: "log", "aria-label": "Conversation", children: _jsxs("div", { className: "kit-chat-thread", children: [_jsx(Earlier, {}), _jsx(ThreadPrimitive.Messages, { components: { UserMessage, AssistantMessage } }), running && _jsx(Thinking, {})] }) }), notice && (_jsx("div", { className: "kit-chat-notice", role: "alert", children: notice })), _jsx("div", { className: "kit-chat-composer-wrap", children: _jsxs(ComposerPrimitive.Root, { className: "kit-chat-composer", children: [_jsx(ComposerPrimitive.Input, { className: "kit-chat-input", "aria-label": label, placeholder: name ? `Message ${name}` : label, submitMode: "enter" }), _jsx(Restore, { kept: kept }), _jsxs("div", { className: "kit-chat-composer-row", children: [footer, running ? (_jsx(ComposerPrimitive.Cancel, { className: "kit-chat-send", "aria-label": "Stop", children: _jsx(StopIcon, {}) })) : (_jsx(ComposerPrimitive.Send, { className: "kit-chat-send", "aria-label": "Send", children: _jsx(SendIcon, {}) }))] })] }) })] }) }));
|
|
73
|
+
}
|
|
74
|
+
/** "Earlier messages", only while there are some. */
|
|
75
|
+
function Earlier() {
|
|
76
|
+
const some = useAuiState(({ thread }) => thread.hasEarlier);
|
|
77
|
+
if (!some)
|
|
78
|
+
return null;
|
|
79
|
+
return (_jsx(ThreadPrimitive.LoadEarlier, { className: "kit-chat-earlier", children: "Earlier messages" }));
|
|
80
|
+
}
|
|
81
|
+
/** Puts a refused send's text back in the composer, once per refusal. */
|
|
82
|
+
function Restore({ kept }) {
|
|
83
|
+
const aui = useAui();
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (kept)
|
|
86
|
+
aui.composer.setText(kept.text);
|
|
87
|
+
}, [aui, kept]);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
/** Who the replies are from, and whether they offer Retry: for every reply in the thread. */
|
|
91
|
+
const Agent = createContext({
|
|
92
|
+
name: undefined,
|
|
93
|
+
avatar: undefined,
|
|
94
|
+
retry: false,
|
|
95
|
+
});
|
|
96
|
+
const PlainText = ({ text }) => _jsx(_Fragment, { children: text });
|
|
97
|
+
const MarkdownText = ({ text }) => _jsx(Markdown, { text: text });
|
|
98
|
+
const USER_PARTS = { Text: PlainText };
|
|
99
|
+
const REPLY_PARTS = { Text: MarkdownText, tools: { Override: Tool } };
|
|
100
|
+
const UserMessage = () => (_jsx(MessagePrimitive.Root, { className: "kit-chat-user", children: _jsx(MessagePrimitive.Parts, { components: USER_PARTS }) }));
|
|
101
|
+
/** Dots while the turn has nothing to show yet: before the first text or tool of its reply. */
|
|
102
|
+
function Thinking() {
|
|
103
|
+
const shown = useAuiState(({ thread }) => {
|
|
104
|
+
const last = thread.messages.at(-1);
|
|
105
|
+
return last?.role === "assistant" && last.content.length > 0;
|
|
106
|
+
});
|
|
107
|
+
if (shown)
|
|
108
|
+
return null;
|
|
109
|
+
return (_jsxs("div", { className: "kit-chat-thinking", role: "status", "aria-label": "Thinking", children: [_jsx("i", {}), _jsx("i", {}), _jsx("i", {})] }));
|
|
110
|
+
}
|
|
111
|
+
function AssistantMessage() {
|
|
112
|
+
const { name, avatar, retry } = useContext(Agent);
|
|
113
|
+
const running = useAuiState(({ message }) => message.status?.type === "running");
|
|
114
|
+
// Retry runs the last turn again, so only the last reply offers it; earlier replies show their
|
|
115
|
+
// bar on hover.
|
|
116
|
+
const last = useAuiState(({ message }) => message.isLast);
|
|
117
|
+
return (_jsxs(MessagePrimitive.Root, { className: "kit-chat-assistant", ...(last ? { "data-last": "" } : {}), children: [name && (_jsxs("div", { className: "kit-chat-who", children: [avatar, name] })), _jsx(MessagePrimitive.Parts, { components: REPLY_PARTS }), _jsxs(ActionBarPrimitive.Root, { className: "kit-chat-bar", ...(running ? { "data-hidden": "" } : {}), children: [_jsx(ActionBarPrimitive.Copy, { asChild: true, children: _jsx(IconButton, { label: "Copy", children: _jsx(CopyIcon, {}) }) }), retry && last && (_jsx(ActionBarPrimitive.Reload, { asChild: true, children: _jsx(IconButton, { label: "Retry", children: _jsx(RetryIcon, {}) }) }))] })] }));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A tool message: a card with the tool's name and how it ended, opened for what went in and what
|
|
121
|
+
* came back, when the message says which tool ran; otherwise the one line it is.
|
|
122
|
+
*/
|
|
123
|
+
function Tool({ artifact }) {
|
|
124
|
+
const entry = artifact;
|
|
125
|
+
const [open, setOpen] = useState(false);
|
|
126
|
+
const tool = entry.tool;
|
|
127
|
+
if (!tool)
|
|
128
|
+
return _jsx("div", { className: "kit-chat-step", children: entry.text });
|
|
129
|
+
const body = [tool.input, tool.output && `→ ${tool.output}`].filter(Boolean).join("\n");
|
|
130
|
+
return (_jsxs("div", { className: "kit-tool", ...(open ? { "data-open": "" } : {}), children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), children: [_jsx(ToolIcon, {}), _jsx("span", { className: "kit-tool-title", children: entry.text }), _jsx("span", { className: "kit-tool-name", children: tool.name }), tool.state === "done" ? (_jsx("span", { className: "kit-tool-done", role: "img", "aria-label": "done", children: "\u2713" })) : tool.state === "refused" ? (_jsx("span", { className: "kit-tool-refused", children: "refused" })) : (_jsx("span", { className: "kit-chat-thinking", role: "status", "aria-label": "running", children: _jsx("i", {}) })), _jsx(ChevronIcon, { className: "kit-tool-chevron" })] }), open && body && _jsx("pre", { className: "kit-tool-body", children: body })] }));
|
|
131
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, CSSProperties, FormEvent, InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from "react";
|
|
2
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
|
+
/** `primary` is the accent; `quiet` reads as a link. */
|
|
4
|
+
variant?: "primary" | "quiet";
|
|
5
|
+
};
|
|
6
|
+
export declare function Button({ variant, className, type, ...props }: ButtonProps): import("react").JSX.Element;
|
|
7
|
+
/** A button with only an icon: its `label` is its accessible name, and its tooltip. */
|
|
8
|
+
export declare function IconButton({ label, className, type, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
label: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export declare function Switch({ checked, onChange, label, disabled, }: {
|
|
12
|
+
checked: boolean;
|
|
13
|
+
onChange(checked: boolean): void;
|
|
14
|
+
label: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function Field({ className, ...props }: InputHTMLAttributes<HTMLInputElement>): import("react").JSX.Element;
|
|
18
|
+
/** The browser's own select, drawn in the kit's look: accessible and native on every device. */
|
|
19
|
+
export declare function Select({ className, ...props }: SelectHTMLAttributes<HTMLSelectElement>): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* A modal dialog: focus held inside, Escape and a click outside close it, and focus goes back to
|
|
22
|
+
* what opened it. `title` names it. With `onSubmit` the dialog is a form, so Enter submits it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Dialog({ open, onClose, onSubmit, title, children, }: {
|
|
25
|
+
open?: boolean;
|
|
26
|
+
onClose(): void;
|
|
27
|
+
onSubmit?(event: FormEvent<HTMLFormElement>): void;
|
|
28
|
+
title: ReactNode;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/** A row of buttons at the end of a dialog or a form. */
|
|
32
|
+
export declare const Actions: ({ children }: {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}) => import("react").JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* A menu opened from `trigger` (a button: an `IconButton`, usually): arrow keys move through its
|
|
37
|
+
* items, Escape and a click outside close it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function Menu({ trigger, children, open, onOpenChange, align, }: {
|
|
40
|
+
trigger: ReactNode;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
open?: boolean;
|
|
43
|
+
onOpenChange?(open: boolean): void;
|
|
44
|
+
align?: "start" | "end";
|
|
45
|
+
}): import("react").JSX.Element;
|
|
46
|
+
/** An item: choosing it closes the menu, unless `onSelect` calls `event.preventDefault()`. */
|
|
47
|
+
export declare function MenuItem({ onSelect, disabled, children, }: {
|
|
48
|
+
onSelect(event: Event): void;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
}): import("react").JSX.Element;
|
|
52
|
+
/** Tabs, each a `[value, label]`; `children` is the selected one's panel. */
|
|
53
|
+
export declare function Tabs<T extends string>({ label, tabs, value, onChange, children, className, }: {
|
|
54
|
+
className?: string;
|
|
55
|
+
label: string;
|
|
56
|
+
tabs: readonly (readonly [NoInfer<T>, ReactNode])[];
|
|
57
|
+
value: T;
|
|
58
|
+
onChange(value: T): void;
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
}): import("react").JSX.Element;
|
|
61
|
+
export declare const Card: ({ children, className }: {
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
className?: string;
|
|
64
|
+
}) => import("react").JSX.Element;
|
|
65
|
+
/** Rows divided by lines: each child is an `<li>`. */
|
|
66
|
+
export declare const List: ({ children, label }: {
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
label?: string;
|
|
69
|
+
}) => import("react").JSX.Element;
|
|
70
|
+
export declare function Table({ head, rows }: {
|
|
71
|
+
head: ReactNode[];
|
|
72
|
+
rows: ReactNode[][];
|
|
73
|
+
}): import("react").JSX.Element;
|
|
74
|
+
/** `value` of `max` as segments, one per unit: a board's done cards, say. */
|
|
75
|
+
export declare function Meter({ value, max, label }: {
|
|
76
|
+
value: number;
|
|
77
|
+
max: number;
|
|
78
|
+
label: string;
|
|
79
|
+
}): import("react").JSX.Element;
|
|
80
|
+
type Layout = {
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
gap?: number;
|
|
83
|
+
className?: string;
|
|
84
|
+
style?: CSSProperties;
|
|
85
|
+
};
|
|
86
|
+
/** Children in a column. */
|
|
87
|
+
export declare const Stack: ({ children, gap, className, style }: Layout) => import("react").JSX.Element;
|
|
88
|
+
/** Children in a row, centered on the cross axis. */
|
|
89
|
+
export declare const Row: ({ children, gap, className, style }: Layout) => import("react").JSX.Element;
|
|
90
|
+
/** Takes the room its parent (a `Stack` or `Row`) has left. */
|
|
91
|
+
export declare const Fill: ({ children, className, style }: Layout) => import("react").JSX.Element;
|
|
92
|
+
/** Scrolls what doesn't fit, with no visible scrollbar. */
|
|
93
|
+
export declare const Scroll: ({ children, className, style }: Layout) => import("react").JSX.Element;
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The shell's own components: Radix primitives for what has behavior (dialogs, menus, switches,
|
|
3
|
+
// tabs), plain elements for the rest, all drawn by the kit's classes.
|
|
4
|
+
import { DropdownMenu, Dialog as RadixDialog, Switch as RadixSwitch, Tabs as RadixTabs, } from "radix-ui";
|
|
5
|
+
const cx = (...names) => names.filter(Boolean).join(" ");
|
|
6
|
+
export function Button({ variant, className, type = "button", ...props }) {
|
|
7
|
+
return (_jsx("button", { type: type, className: cx("kit-button", variant && `kit-${variant}`, className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
/** A button with only an icon: its `label` is its accessible name, and its tooltip. */
|
|
10
|
+
export function IconButton({ label, className, type = "button", ...props }) {
|
|
11
|
+
return (_jsx("button", { type: type, "aria-label": label, title: label, className: cx("kit-icon-button", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
export function Switch({ checked, onChange, label, disabled, }) {
|
|
14
|
+
return (_jsx(RadixSwitch.Root, { className: "kit-switch", checked: checked, onCheckedChange: onChange, "aria-label": label, disabled: disabled, children: _jsx(RadixSwitch.Thumb, { className: "kit-switch-thumb" }) }));
|
|
15
|
+
}
|
|
16
|
+
export function Field({ className, ...props }) {
|
|
17
|
+
return _jsx("input", { className: cx("kit-field", className), ...props });
|
|
18
|
+
}
|
|
19
|
+
/** The browser's own select, drawn in the kit's look: accessible and native on every device. */
|
|
20
|
+
export function Select({ className, ...props }) {
|
|
21
|
+
return _jsx("select", { className: cx("kit-select", className), ...props });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A modal dialog: focus held inside, Escape and a click outside close it, and focus goes back to
|
|
25
|
+
* what opened it. `title` names it. With `onSubmit` the dialog is a form, so Enter submits it.
|
|
26
|
+
*/
|
|
27
|
+
export function Dialog({ open = true, onClose, onSubmit, title, children, }) {
|
|
28
|
+
const inner = (_jsxs(_Fragment, { children: [_jsx(RadixDialog.Title, { className: "kit-dialog-title", children: title }), children] }));
|
|
29
|
+
return (_jsx(RadixDialog.Root, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(RadixDialog.Portal, { children: [_jsx(RadixDialog.Overlay, { className: "kit-scrim" }), _jsx(RadixDialog.Content, { className: "kit-dialog", "aria-describedby": undefined, asChild: !!onSubmit, children: onSubmit ? _jsx("form", { onSubmit: onSubmit, children: inner }) : inner })] }) }));
|
|
30
|
+
}
|
|
31
|
+
/** A row of buttons at the end of a dialog or a form. */
|
|
32
|
+
export const Actions = ({ children }) => (_jsx("div", { className: "kit-actions", children: children }));
|
|
33
|
+
/**
|
|
34
|
+
* A menu opened from `trigger` (a button: an `IconButton`, usually): arrow keys move through its
|
|
35
|
+
* items, Escape and a click outside close it.
|
|
36
|
+
*/
|
|
37
|
+
export function Menu({ trigger, children, open, onOpenChange, align = "end", }) {
|
|
38
|
+
return (_jsxs(DropdownMenu.Root, { ...(open !== undefined ? { open } : {}), ...(onOpenChange ? { onOpenChange } : {}), modal: false, children: [_jsx(DropdownMenu.Trigger, { asChild: true, children: trigger }), _jsx(DropdownMenu.Portal, { children: _jsx(DropdownMenu.Content, { className: "kit-menu", align: align, sideOffset: 4, children: children }) })] }));
|
|
39
|
+
}
|
|
40
|
+
/** An item: choosing it closes the menu, unless `onSelect` calls `event.preventDefault()`. */
|
|
41
|
+
export function MenuItem({ onSelect, disabled, children, }) {
|
|
42
|
+
return (_jsx(DropdownMenu.Item, { className: "kit-menu-item", onSelect: onSelect, disabled: disabled, children: children }));
|
|
43
|
+
}
|
|
44
|
+
/** Tabs, each a `[value, label]`; `children` is the selected one's panel. */
|
|
45
|
+
export function Tabs({ label, tabs, value, onChange, children, className, }) {
|
|
46
|
+
return (_jsxs(RadixTabs.Root, { value: value, onValueChange: (next) => onChange(next), className: cx("kit-stack", className), children: [_jsx(RadixTabs.List, { className: "kit-tabs-list", "aria-label": label, children: tabs.map(([key, name]) => (_jsx(RadixTabs.Trigger, { value: key, className: "kit-tab", children: name }, key))) }), _jsx(RadixTabs.Content, { value: value, className: "kit-fill kit-scroll", children: children })] }));
|
|
47
|
+
}
|
|
48
|
+
export const Card = ({ children, className }) => (_jsx("div", { className: cx("kit-card", className), children: children }));
|
|
49
|
+
/** Rows divided by lines: each child is an `<li>`. */
|
|
50
|
+
export const List = ({ children, label }) => (_jsx("ul", { className: "kit-list", "aria-label": label, children: children }));
|
|
51
|
+
export function Table({ head, rows }) {
|
|
52
|
+
return (_jsxs("table", { className: "kit-table", children: [_jsx("thead", { children: _jsx("tr", { children: head.map((cell, i) => (_jsx("th", { children: cell }, i))) }) }), _jsx("tbody", { children: rows.map((row, r) => (_jsx("tr", { children: row.map((cell, c) => (_jsx("td", { children: cell }, c))) }, r))) })] }));
|
|
53
|
+
}
|
|
54
|
+
/** `value` of `max` as segments, one per unit: a board's done cards, say. */
|
|
55
|
+
export function Meter({ value, max, label }) {
|
|
56
|
+
return (_jsx("div", { className: "kit-meter", role: "img", "aria-label": label, children: Array.from({ length: max }, (_, i) => (_jsx("i", { className: i < value ? "kit-on" : undefined }, i))) }));
|
|
57
|
+
}
|
|
58
|
+
const gapped = (gap, style) => gap === undefined ? style : { ...style, "--kit-gap": `${gap}px` };
|
|
59
|
+
/** Children in a column. */
|
|
60
|
+
export const Stack = ({ children, gap, className, style }) => (_jsx("div", { className: cx("kit-stack", className), style: gapped(gap, style), children: children }));
|
|
61
|
+
/** Children in a row, centered on the cross axis. */
|
|
62
|
+
export const Row = ({ children, gap, className, style }) => (_jsx("div", { className: cx("kit-row", className), style: gapped(gap, style), children: children }));
|
|
63
|
+
/** Takes the room its parent (a `Stack` or `Row`) has left. */
|
|
64
|
+
export const Fill = ({ children, className, style }) => (_jsx("div", { className: cx("kit-fill", className), style: style, children: children }));
|
|
65
|
+
/** Scrolls what doesn't fit, with no visible scrollbar. */
|
|
66
|
+
export const Scroll = ({ children, className, style }) => (_jsx("div", { className: cx("kit-scroll", className), style: style, children: children }));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const HomeIcon: () => import("react").JSX.Element;
|
|
2
|
+
export declare const PlusIcon: () => import("react").JSX.Element;
|
|
3
|
+
export declare const ChatGptIcon: () => import("react").JSX.Element;
|
|
4
|
+
export declare const MoonIcon: () => import("react").JSX.Element;
|
|
5
|
+
export declare const GearIcon: () => import("react").JSX.Element;
|
|
6
|
+
export declare const MoreIcon: () => import("react").JSX.Element;
|
|
7
|
+
export declare const UploadIcon: () => import("react").JSX.Element;
|
|
8
|
+
export declare const DownloadIcon: () => import("react").JSX.Element;
|
|
9
|
+
export declare const SendIcon: () => import("react").JSX.Element;
|
|
10
|
+
export declare const StopIcon: () => import("react").JSX.Element;
|
|
11
|
+
export declare const CopyIcon: () => import("react").JSX.Element;
|
|
12
|
+
export declare const RetryIcon: () => import("react").JSX.Element;
|
|
13
|
+
export declare const ToolIcon: () => import("react").JSX.Element;
|
|
14
|
+
export declare const ChevronIcon: ({ className }: {
|
|
15
|
+
className?: string;
|
|
16
|
+
}) => import("react").JSX.Element;
|
|
17
|
+
export declare const ArrowDownIcon: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** The shell's icons, drawn with the text's color and hidden from assistive technology: the control they sit on carries the name. */
|
|
3
|
+
const svg = {
|
|
4
|
+
fill: "none",
|
|
5
|
+
stroke: "currentColor",
|
|
6
|
+
strokeWidth: 2,
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
};
|
|
9
|
+
export const HomeIcon = () => (_jsx("svg", { width: "16", height: "16", "aria-hidden": "true", ...svg, children: _jsx("path", { d: "M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z" }) }));
|
|
10
|
+
export const PlusIcon = () => (_jsx("svg", { width: "16", height: "16", "aria-hidden": "true", ...svg, children: _jsx("path", { d: "M12 5v14M5 12h14" }) }));
|
|
11
|
+
export const ChatGptIcon = () => (_jsxs("svg", { width: "16", height: "16", "aria-hidden": "true", ...svg, children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("path", { d: "M8.5 12h7M12 8.5v7" })] }));
|
|
12
|
+
export const MoonIcon = () => (_jsx("svg", { width: "15", height: "15", "aria-hidden": "true", ...svg, children: _jsx("path", { d: "M21 13A9 9 0 1 1 11 3a7 7 0 0 0 10 10z" }) }));
|
|
13
|
+
export const GearIcon = () => (_jsxs("svg", { width: "15", height: "15", "aria-hidden": "true", ...svg, children: [_jsx("circle", { cx: "12", cy: "12", r: "3" }), _jsx("path", { d: "M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z" })] }));
|
|
14
|
+
export const MoreIcon = () => (_jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: [_jsx("circle", { cx: "5", cy: "12", r: "1.6" }), _jsx("circle", { cx: "12", cy: "12", r: "1.6" }), _jsx("circle", { cx: "19", cy: "12", r: "1.6" })] }));
|
|
15
|
+
const stroke = {
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeWidth: 2,
|
|
19
|
+
strokeLinecap: "round",
|
|
20
|
+
strokeLinejoin: "round",
|
|
21
|
+
};
|
|
22
|
+
export const UploadIcon = () => (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", ...stroke, "aria-hidden": "true", children: _jsx("path", { d: "M12 15V3M7 8l5-5 5 5M5 21h14" }) }));
|
|
23
|
+
export const DownloadIcon = () => (_jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", ...stroke, "aria-hidden": "true", children: _jsx("path", { d: "M12 3v12M7 10l5 5 5-5M5 21h14" }) }));
|
|
24
|
+
export const SendIcon = () => (_jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", ...stroke, strokeWidth: 2.4, "aria-hidden": "true", children: _jsx("path", { d: "M12 19V5M5 12l7-7 7 7" }) }));
|
|
25
|
+
export const StopIcon = () => (_jsx("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: _jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "3" }) }));
|
|
26
|
+
export const CopyIcon = () => (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", ...stroke, "aria-hidden": "true", children: [_jsx("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }), _jsx("path", { d: "M5 15V5a2 2 0 0 1 2-2h8" })] }));
|
|
27
|
+
export const RetryIcon = () => (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", ...stroke, "aria-hidden": "true", children: [_jsx("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }), _jsx("path", { d: "M3 3v5h5" })] }));
|
|
28
|
+
export const ToolIcon = () => (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", ...stroke, "aria-hidden": "true", children: _jsx("path", { d: "M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18v3h3l6.3-6.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.4-.6-.6-2.4z" }) }));
|
|
29
|
+
export const ChevronIcon = ({ className }) => (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", ...stroke, className: className, "aria-hidden": "true", children: _jsx("path", { d: "M9 6l6 6-6 6" }) }));
|
|
30
|
+
export const ArrowDownIcon = () => (_jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", ...stroke, strokeWidth: 2.2, "aria-hidden": "true", children: _jsx("path", { d: "M12 5v14M5 12l7 7 7-7" }) }));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Chat, type ChatEntry, type ChatProps } from "./chat.tsx";
|
|
2
|
+
export { Actions, Button, type ButtonProps, Card, Dialog, Field, Fill, IconButton, List, Menu, MenuItem, Meter, Row, Scroll, Select, Stack, Switch, Table, Tabs, } from "./components.tsx";
|
|
3
|
+
export * from "./icons.tsx";
|
|
4
|
+
export { Markdown } from "./markdown.tsx";
|
|
5
|
+
export { ResizableGroup, ResizablePanel, ResizeHandle } from "./resizable.tsx";
|
|
6
|
+
export { ensureKitStyles, KIT_CSS } from "./styles.ts";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @agentorg/kit: the shell's own components, for the shell and for every view. Importing it puts
|
|
2
|
+
// the kit's styles in the document it runs in (a view's frame, or the shell's page).
|
|
3
|
+
import { ensureKitStyles } from "./styles.js";
|
|
4
|
+
ensureKitStyles();
|
|
5
|
+
export { Chat } from "./chat.js";
|
|
6
|
+
export { Actions, Button, Card, Dialog, Field, Fill, IconButton, List, Menu, MenuItem, Meter, Row, Scroll, Select, Stack, Switch, Table, Tabs, } from "./components.js";
|
|
7
|
+
export * from "./icons.js";
|
|
8
|
+
export { Markdown } from "./markdown.js";
|
|
9
|
+
export { ResizableGroup, ResizablePanel, ResizeHandle } from "./resizable.js";
|
|
10
|
+
export { ensureKitStyles, KIT_CSS } from "./styles.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown as an agent writes it, GitHub-flavored (tables, lists, strikethrough), safe to render
|
|
3
|
+
* as it streams: remend first closes what is still open (a `**` without its pair, an unfinished
|
|
4
|
+
* fence or table row), so a reply doesn't flicker between markup and text. Raw HTML is shown as
|
|
5
|
+
* text, never rendered.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Markdown({ text }: {
|
|
8
|
+
text: string;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
|
+
import remarkGfm from "remark-gfm";
|
|
4
|
+
import remend from "remend";
|
|
5
|
+
const PLUGINS = [remarkGfm];
|
|
6
|
+
/**
|
|
7
|
+
* Markdown as an agent writes it, GitHub-flavored (tables, lists, strikethrough), safe to render
|
|
8
|
+
* as it streams: remend first closes what is still open (a `**` without its pair, an unfinished
|
|
9
|
+
* fence or table row), so a reply doesn't flicker between markup and text. Raw HTML is shown as
|
|
10
|
+
* text, never rendered.
|
|
11
|
+
*/
|
|
12
|
+
export function Markdown({ text }) {
|
|
13
|
+
return (_jsx("div", { className: "kit-md", children: _jsx(ReactMarkdown, { remarkPlugins: PLUGINS, children: remend(text) }) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Group as ResizableGroup, Panel as ResizablePanel } from "react-resizable-panels";
|
|
2
|
+
/** The handle between two panels: dragged, or moved with the arrow keys; only its line shows. */
|
|
3
|
+
export declare function ResizeHandle({ label }: {
|
|
4
|
+
label: string;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// The resizable layout pieces: react-resizable-panels, with the kit's handle.
|
|
3
|
+
import { Separator } from "react-resizable-panels";
|
|
4
|
+
export { Group as ResizableGroup, Panel as ResizablePanel } from "react-resizable-panels";
|
|
5
|
+
/** The handle between two panels: dragged, or moved with the arrow keys; only its line shows. */
|
|
6
|
+
export function ResizeHandle({ label }) {
|
|
7
|
+
return _jsx(Separator, { className: "kit-resize-handle", "aria-label": label });
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kit's styles: the shell's own look, drawn in the theme's tokens (`--fg`, `--surface`,
|
|
3
|
+
* `--accent`, …), which the shell defines and sends every view at mount. Every class is `kit-`.
|
|
4
|
+
* They work without React too: a plain-DOM view may use the class names.
|
|
5
|
+
*/
|
|
6
|
+
export declare const KIT_CSS = "\n.kit-button {\n display: inline-flex; align-items: center; justify-content: center; gap: 8px;\n height: 32px; padding: 0 12px; border: 0; border-radius: 9px; cursor: pointer;\n background: var(--hover); color: var(--fg); font: inherit; font-size: 13px; font-weight: 500;\n}\n.kit-button:hover { background: var(--selected); }\n.kit-button.kit-primary { background: var(--accent); color: var(--accent-fg); font-weight: 600; }\n.kit-button.kit-quiet { height: auto; padding: 0; background: none; color: inherit; text-decoration: underline; text-underline-offset: 2px; }\n.kit-button:disabled { opacity: 0.6; cursor: default; }\n.kit-icon-button {\n width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; cursor: pointer;\n display: grid; place-items: center; background: transparent; color: var(--muted);\n}\n.kit-icon-button:hover { background: var(--hover); color: var(--fg); }\n.kit-icon-button:disabled { opacity: 0.4; cursor: default; }\n.kit-switch {\n position: relative; flex: none; width: 30px; height: 18px; padding: 0; border: 0; border-radius: 9px;\n background: var(--raised); cursor: pointer;\n}\n.kit-switch[data-state=\"checked\"] { background: var(--ok); }\n.kit-switch:disabled { opacity: 0.5; cursor: default; }\n.kit-switch-thumb {\n position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;\n background: var(--faint); transition: left 0.12s;\n}\n.kit-switch[data-state=\"checked\"] .kit-switch-thumb { left: 14px; background: white; }\n.kit-field, .kit-select {\n width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; outline: 0;\n background: var(--raised); color: var(--fg); font: inherit;\n}\n.kit-select { height: 32px; padding: 0 8px; border-radius: 8px; }\n.kit-field:focus-visible, .kit-select:focus-visible, .kit-button:focus-visible, .kit-icon-button:focus-visible,\n.kit-switch:focus-visible { outline: 0; box-shadow: 0 0 0 1.5px var(--ring); }\n.kit-scrim { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / 0.5); }\n.kit-dialog {\n position: fixed; left: 50%; top: 50%; z-index: 21; transform: translate(-50%, -50%);\n width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; scrollbar-width: none;\n display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 18px;\n background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px rgb(0 0 0 / 0.45); outline: 0;\n}\n.kit-dialog-title { margin: 0; font-size: 16px; font-weight: 600; }\n.kit-actions { display: flex; justify-content: flex-end; gap: 8px; }\n.kit-menu {\n z-index: 30; min-width: 150px; padding: 4px; border-radius: 10px;\n background: var(--raised); color: var(--fg); box-shadow: 0 12px 28px rgb(0 0 0 / 0.35);\n}\n.kit-menu-item {\n display: block; width: 100%; padding: 7px 10px; border-radius: 7px; outline: 0; cursor: pointer;\n font-size: 13px; text-align: left; user-select: none;\n}\n.kit-menu-item[data-highlighted] { background: var(--hover); }\n.kit-menu-item[data-disabled] { opacity: 0.6; cursor: default; }\n.kit-tabs-list {\n display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: 10px;\n background: var(--hover);\n}\n.kit-tab {\n padding: 5px 12px; border: 0; border-radius: 8px; cursor: pointer;\n background: transparent; color: var(--muted); font: inherit; font-size: 13px;\n}\n.kit-tab[data-state=\"active\"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }\n.kit-card { padding: 14px; border-radius: 12px; background: var(--card); }\n.kit-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; font-size: 13px; }\n.kit-list > li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }\n.kit-list > li + li { border-top: 1px solid var(--line); }\n.kit-table { width: 100%; border-collapse: collapse; font-size: 13px; }\n.kit-table th { padding: 0 10px 8px; text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; }\n.kit-table td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }\n.kit-table tr:hover td { background: var(--hover); }\n.kit-meter { display: flex; gap: 3px; }\n.kit-meter > i { flex: 1; height: 4px; border-radius: 2px; background: var(--raised); }\n.kit-meter > i.kit-on { background: var(--ok); }\n.kit-stack { display: flex; flex-direction: column; gap: var(--kit-gap, 8px); min-height: 0; }\n.kit-row { display: flex; align-items: center; gap: var(--kit-gap, 8px); min-width: 0; }\n.kit-fill { flex: 1; min-width: 0; min-height: 0; }\n.kit-scroll { overflow: auto; scrollbar-width: none; }\n.kit-scroll::-webkit-scrollbar { display: none; }\n.kit-resize-handle { position: relative; flex: none; width: 8px; margin: 0 -4px; z-index: 2; outline: 0; cursor: col-resize; touch-action: none; }\n.kit-resize-handle::after {\n content: \"\"; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: transparent;\n}\n.kit-resize-handle:hover::after, .kit-resize-handle:focus-visible::after, .kit-resize-handle[data-separator=\"active\"]::after { background: var(--ring); }\n/* While a handle is dragged, frames under the pointer take no events, so the drag keeps them all. */\n:root:has(.kit-resize-handle[data-separator=\"active\"]) iframe { pointer-events: none; }\n.kit-md > :first-child { margin-top: 0; }\n.kit-md > :last-child { margin-bottom: 0; }\n.kit-md p { margin: 0 0 10px; }\n.kit-md strong { font-weight: 650; }\n.kit-md ul, .kit-md ol { display: block; margin: 0 0 10px; padding-left: 20px; list-style: revert; }\n.kit-md li { display: list-item; margin: 3px 0; padding: 0; border-radius: 0; background: none; }\n.kit-md code { padding: 1px 5px; border-radius: 5px; background: var(--raised); font: 12.5px ui-monospace, Menlo, monospace; }\n.kit-md pre { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--raised); overflow: auto; scrollbar-width: none; }\n.kit-md pre code { padding: 0; background: none; }\n.kit-md table { width: auto; min-width: 260px; margin: 2px 0 10px; border-collapse: collapse; font-size: 13px; }\n.kit-md th { padding: 0 14px 6px 0; text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; }\n.kit-md td { padding: 6px 14px 6px 0; border-top: 1px solid var(--line); }\n.kit-md a { color: inherit; text-underline-offset: 2px; }\n.kit-chat { container-type: inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--fg); }\n.kit-chat-viewport { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 8px 20px 0; }\n.kit-chat-viewport::-webkit-scrollbar { display: none; }\n.kit-chat-thread { display: flex; flex-direction: column; gap: 22px; max-width: 720px; margin: 0 auto; padding-bottom: 16px; }\n.kit-chat-earlier { align-self: center; height: 28px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }\n.kit-chat-user { align-self: flex-end; max-width: 75%; padding: 9px 13px; border-radius: 16px; background: var(--raised); white-space: pre-wrap; word-break: break-word; }\n.kit-chat-assistant { display: flex; flex-direction: column; gap: 10px; min-width: 0; }\n.kit-chat-who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }\n.kit-chat-bar { display: flex; gap: 2px; height: 26px; margin-top: -4px; }\n.kit-chat-bar .kit-icon-button { width: 26px; height: 26px; border-radius: 7px; color: var(--faint); }\n.kit-chat-bar[data-hidden], .kit-chat-assistant:not([data-last]):not(:hover) .kit-chat-bar { visibility: hidden; }\n.kit-chat-thinking { display: flex; align-items: center; gap: 6px; height: 22px; color: var(--muted); }\n.kit-chat-thinking > i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: kit-pulse 1.2s infinite; }\n.kit-chat-thinking > i:nth-child(2) { animation-delay: 0.2s; }\n.kit-chat-thinking > i:nth-child(3) { animation-delay: 0.4s; }\n@keyframes kit-pulse { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }\n.kit-chat-step { font-size: 12.5px; color: var(--muted); }\n.kit-tool { border-radius: 12px; background: var(--hover); font-size: 13px; }\n.kit-tool > button {\n display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px;\n border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;\n}\n.kit-tool-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.kit-tool-name { color: var(--muted); font: 12px ui-monospace, Menlo, monospace; }\n.kit-tool-done { color: var(--ok); font-weight: 700; }\n.kit-tool-refused { color: var(--bad); }\n.kit-tool-chevron { color: var(--faint); transition: transform 0.12s; }\n.kit-tool[data-open] .kit-tool-chevron { transform: rotate(90deg); }\n.kit-tool-body { margin: 0; padding: 0 12px 10px 36px; color: var(--muted); font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }\n.kit-chat-notice { display: flex; flex-direction: column; gap: 6px; max-width: 720px; margin: 0 auto 10px; padding: 10px 12px; border-radius: 12px; background: var(--raised); font-size: 13px; }\n.kit-chat-notice b { font-weight: 600; }\n.kit-chat-composer-wrap { flex: none; padding: 0 20px 16px; }\n.kit-chat-composer { display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; padding: 10px 10px 8px 14px; border-radius: 14px; background: var(--raised); }\n.kit-chat-input { display: block; width: 100%; min-height: 44px; max-height: 160px; padding: 0; border: 0; outline: 0; resize: none; background: transparent; color: inherit; font: inherit; scrollbar-width: none; }\n.kit-chat-composer-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }\n.kit-chat-send {\n width: 30px; height: 30px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; cursor: pointer;\n display: grid; place-items: center; background: var(--accent); color: var(--accent-fg);\n}\n.kit-chat-send:disabled { opacity: 0.35; cursor: default; }\n@container (max-width: 460px) {\n .kit-chat-viewport { padding: 6px 12px 0; }\n .kit-chat-thread { gap: 14px; }\n .kit-chat-user { max-width: 88%; padding: 7px 11px; }\n .kit-chat-who, .kit-tool-name { display: none; }\n .kit-chat-composer-wrap { padding: 0 10px 10px; }\n .kit-chat-composer { padding: 8px 8px 6px 12px; border-radius: 12px; }\n .kit-chat-input { min-height: 34px; }\n}\n";
|
|
7
|
+
/**
|
|
8
|
+
* Put the kit's styles in a document once, first in its head so a view's own come after and win.
|
|
9
|
+
* Importing the kit does it for the document it runs in; a document that has them is left alone.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ensureKitStyles(doc?: Document | undefined): void;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kit's styles: the shell's own look, drawn in the theme's tokens (`--fg`, `--surface`,
|
|
3
|
+
* `--accent`, …), which the shell defines and sends every view at mount. Every class is `kit-`.
|
|
4
|
+
* They work without React too: a plain-DOM view may use the class names.
|
|
5
|
+
*/
|
|
6
|
+
export const KIT_CSS = `
|
|
7
|
+
.kit-button {
|
|
8
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
|
9
|
+
height: 32px; padding: 0 12px; border: 0; border-radius: 9px; cursor: pointer;
|
|
10
|
+
background: var(--hover); color: var(--fg); font: inherit; font-size: 13px; font-weight: 500;
|
|
11
|
+
}
|
|
12
|
+
.kit-button:hover { background: var(--selected); }
|
|
13
|
+
.kit-button.kit-primary { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
|
|
14
|
+
.kit-button.kit-quiet { height: auto; padding: 0; background: none; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
|
|
15
|
+
.kit-button:disabled { opacity: 0.6; cursor: default; }
|
|
16
|
+
.kit-icon-button {
|
|
17
|
+
width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; cursor: pointer;
|
|
18
|
+
display: grid; place-items: center; background: transparent; color: var(--muted);
|
|
19
|
+
}
|
|
20
|
+
.kit-icon-button:hover { background: var(--hover); color: var(--fg); }
|
|
21
|
+
.kit-icon-button:disabled { opacity: 0.4; cursor: default; }
|
|
22
|
+
.kit-switch {
|
|
23
|
+
position: relative; flex: none; width: 30px; height: 18px; padding: 0; border: 0; border-radius: 9px;
|
|
24
|
+
background: var(--raised); cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
.kit-switch[data-state="checked"] { background: var(--ok); }
|
|
27
|
+
.kit-switch:disabled { opacity: 0.5; cursor: default; }
|
|
28
|
+
.kit-switch-thumb {
|
|
29
|
+
position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
|
|
30
|
+
background: var(--faint); transition: left 0.12s;
|
|
31
|
+
}
|
|
32
|
+
.kit-switch[data-state="checked"] .kit-switch-thumb { left: 14px; background: white; }
|
|
33
|
+
.kit-field, .kit-select {
|
|
34
|
+
width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; outline: 0;
|
|
35
|
+
background: var(--raised); color: var(--fg); font: inherit;
|
|
36
|
+
}
|
|
37
|
+
.kit-select { height: 32px; padding: 0 8px; border-radius: 8px; }
|
|
38
|
+
.kit-field:focus-visible, .kit-select:focus-visible, .kit-button:focus-visible, .kit-icon-button:focus-visible,
|
|
39
|
+
.kit-switch:focus-visible { outline: 0; box-shadow: 0 0 0 1.5px var(--ring); }
|
|
40
|
+
.kit-scrim { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / 0.5); }
|
|
41
|
+
.kit-dialog {
|
|
42
|
+
position: fixed; left: 50%; top: 50%; z-index: 21; transform: translate(-50%, -50%);
|
|
43
|
+
width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; scrollbar-width: none;
|
|
44
|
+
display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 18px;
|
|
45
|
+
background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px rgb(0 0 0 / 0.45); outline: 0;
|
|
46
|
+
}
|
|
47
|
+
.kit-dialog-title { margin: 0; font-size: 16px; font-weight: 600; }
|
|
48
|
+
.kit-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
49
|
+
.kit-menu {
|
|
50
|
+
z-index: 30; min-width: 150px; padding: 4px; border-radius: 10px;
|
|
51
|
+
background: var(--raised); color: var(--fg); box-shadow: 0 12px 28px rgb(0 0 0 / 0.35);
|
|
52
|
+
}
|
|
53
|
+
.kit-menu-item {
|
|
54
|
+
display: block; width: 100%; padding: 7px 10px; border-radius: 7px; outline: 0; cursor: pointer;
|
|
55
|
+
font-size: 13px; text-align: left; user-select: none;
|
|
56
|
+
}
|
|
57
|
+
.kit-menu-item[data-highlighted] { background: var(--hover); }
|
|
58
|
+
.kit-menu-item[data-disabled] { opacity: 0.6; cursor: default; }
|
|
59
|
+
.kit-tabs-list {
|
|
60
|
+
display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: 10px;
|
|
61
|
+
background: var(--hover);
|
|
62
|
+
}
|
|
63
|
+
.kit-tab {
|
|
64
|
+
padding: 5px 12px; border: 0; border-radius: 8px; cursor: pointer;
|
|
65
|
+
background: transparent; color: var(--muted); font: inherit; font-size: 13px;
|
|
66
|
+
}
|
|
67
|
+
.kit-tab[data-state="active"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }
|
|
68
|
+
.kit-card { padding: 14px; border-radius: 12px; background: var(--card); }
|
|
69
|
+
.kit-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; font-size: 13px; }
|
|
70
|
+
.kit-list > li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
|
|
71
|
+
.kit-list > li + li { border-top: 1px solid var(--line); }
|
|
72
|
+
.kit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
73
|
+
.kit-table th { padding: 0 10px 8px; text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; }
|
|
74
|
+
.kit-table td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
|
|
75
|
+
.kit-table tr:hover td { background: var(--hover); }
|
|
76
|
+
.kit-meter { display: flex; gap: 3px; }
|
|
77
|
+
.kit-meter > i { flex: 1; height: 4px; border-radius: 2px; background: var(--raised); }
|
|
78
|
+
.kit-meter > i.kit-on { background: var(--ok); }
|
|
79
|
+
.kit-stack { display: flex; flex-direction: column; gap: var(--kit-gap, 8px); min-height: 0; }
|
|
80
|
+
.kit-row { display: flex; align-items: center; gap: var(--kit-gap, 8px); min-width: 0; }
|
|
81
|
+
.kit-fill { flex: 1; min-width: 0; min-height: 0; }
|
|
82
|
+
.kit-scroll { overflow: auto; scrollbar-width: none; }
|
|
83
|
+
.kit-scroll::-webkit-scrollbar { display: none; }
|
|
84
|
+
.kit-resize-handle { position: relative; flex: none; width: 8px; margin: 0 -4px; z-index: 2; outline: 0; cursor: col-resize; touch-action: none; }
|
|
85
|
+
.kit-resize-handle::after {
|
|
86
|
+
content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: transparent;
|
|
87
|
+
}
|
|
88
|
+
.kit-resize-handle:hover::after, .kit-resize-handle:focus-visible::after, .kit-resize-handle[data-separator="active"]::after { background: var(--ring); }
|
|
89
|
+
/* While a handle is dragged, frames under the pointer take no events, so the drag keeps them all. */
|
|
90
|
+
:root:has(.kit-resize-handle[data-separator="active"]) iframe { pointer-events: none; }
|
|
91
|
+
.kit-md > :first-child { margin-top: 0; }
|
|
92
|
+
.kit-md > :last-child { margin-bottom: 0; }
|
|
93
|
+
.kit-md p { margin: 0 0 10px; }
|
|
94
|
+
.kit-md strong { font-weight: 650; }
|
|
95
|
+
.kit-md ul, .kit-md ol { display: block; margin: 0 0 10px; padding-left: 20px; list-style: revert; }
|
|
96
|
+
.kit-md li { display: list-item; margin: 3px 0; padding: 0; border-radius: 0; background: none; }
|
|
97
|
+
.kit-md code { padding: 1px 5px; border-radius: 5px; background: var(--raised); font: 12.5px ui-monospace, Menlo, monospace; }
|
|
98
|
+
.kit-md pre { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--raised); overflow: auto; scrollbar-width: none; }
|
|
99
|
+
.kit-md pre code { padding: 0; background: none; }
|
|
100
|
+
.kit-md table { width: auto; min-width: 260px; margin: 2px 0 10px; border-collapse: collapse; font-size: 13px; }
|
|
101
|
+
.kit-md th { padding: 0 14px 6px 0; text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; }
|
|
102
|
+
.kit-md td { padding: 6px 14px 6px 0; border-top: 1px solid var(--line); }
|
|
103
|
+
.kit-md a { color: inherit; text-underline-offset: 2px; }
|
|
104
|
+
.kit-chat { container-type: inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--fg); }
|
|
105
|
+
.kit-chat-viewport { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 8px 20px 0; }
|
|
106
|
+
.kit-chat-viewport::-webkit-scrollbar { display: none; }
|
|
107
|
+
.kit-chat-thread { display: flex; flex-direction: column; gap: 22px; max-width: 720px; margin: 0 auto; padding-bottom: 16px; }
|
|
108
|
+
.kit-chat-earlier { align-self: center; height: 28px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
109
|
+
.kit-chat-user { align-self: flex-end; max-width: 75%; padding: 9px 13px; border-radius: 16px; background: var(--raised); white-space: pre-wrap; word-break: break-word; }
|
|
110
|
+
.kit-chat-assistant { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
|
|
111
|
+
.kit-chat-who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
|
|
112
|
+
.kit-chat-bar { display: flex; gap: 2px; height: 26px; margin-top: -4px; }
|
|
113
|
+
.kit-chat-bar .kit-icon-button { width: 26px; height: 26px; border-radius: 7px; color: var(--faint); }
|
|
114
|
+
.kit-chat-bar[data-hidden], .kit-chat-assistant:not([data-last]):not(:hover) .kit-chat-bar { visibility: hidden; }
|
|
115
|
+
.kit-chat-thinking { display: flex; align-items: center; gap: 6px; height: 22px; color: var(--muted); }
|
|
116
|
+
.kit-chat-thinking > i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: kit-pulse 1.2s infinite; }
|
|
117
|
+
.kit-chat-thinking > i:nth-child(2) { animation-delay: 0.2s; }
|
|
118
|
+
.kit-chat-thinking > i:nth-child(3) { animation-delay: 0.4s; }
|
|
119
|
+
@keyframes kit-pulse { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
|
|
120
|
+
.kit-chat-step { font-size: 12.5px; color: var(--muted); }
|
|
121
|
+
.kit-tool { border-radius: 12px; background: var(--hover); font-size: 13px; }
|
|
122
|
+
.kit-tool > button {
|
|
123
|
+
display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px;
|
|
124
|
+
border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
.kit-tool-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
127
|
+
.kit-tool-name { color: var(--muted); font: 12px ui-monospace, Menlo, monospace; }
|
|
128
|
+
.kit-tool-done { color: var(--ok); font-weight: 700; }
|
|
129
|
+
.kit-tool-refused { color: var(--bad); }
|
|
130
|
+
.kit-tool-chevron { color: var(--faint); transition: transform 0.12s; }
|
|
131
|
+
.kit-tool[data-open] .kit-tool-chevron { transform: rotate(90deg); }
|
|
132
|
+
.kit-tool-body { margin: 0; padding: 0 12px 10px 36px; color: var(--muted); font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
|
|
133
|
+
.kit-chat-notice { display: flex; flex-direction: column; gap: 6px; max-width: 720px; margin: 0 auto 10px; padding: 10px 12px; border-radius: 12px; background: var(--raised); font-size: 13px; }
|
|
134
|
+
.kit-chat-notice b { font-weight: 600; }
|
|
135
|
+
.kit-chat-composer-wrap { flex: none; padding: 0 20px 16px; }
|
|
136
|
+
.kit-chat-composer { display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; padding: 10px 10px 8px 14px; border-radius: 14px; background: var(--raised); }
|
|
137
|
+
.kit-chat-input { display: block; width: 100%; min-height: 44px; max-height: 160px; padding: 0; border: 0; outline: 0; resize: none; background: transparent; color: inherit; font: inherit; scrollbar-width: none; }
|
|
138
|
+
.kit-chat-composer-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
|
|
139
|
+
.kit-chat-send {
|
|
140
|
+
width: 30px; height: 30px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
|
|
141
|
+
display: grid; place-items: center; background: var(--accent); color: var(--accent-fg);
|
|
142
|
+
}
|
|
143
|
+
.kit-chat-send:disabled { opacity: 0.35; cursor: default; }
|
|
144
|
+
@container (max-width: 460px) {
|
|
145
|
+
.kit-chat-viewport { padding: 6px 12px 0; }
|
|
146
|
+
.kit-chat-thread { gap: 14px; }
|
|
147
|
+
.kit-chat-user { max-width: 88%; padding: 7px 11px; }
|
|
148
|
+
.kit-chat-who, .kit-tool-name { display: none; }
|
|
149
|
+
.kit-chat-composer-wrap { padding: 0 10px 10px; }
|
|
150
|
+
.kit-chat-composer { padding: 8px 8px 6px 12px; border-radius: 12px; }
|
|
151
|
+
.kit-chat-input { min-height: 34px; }
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
const MARK = "data-agentorg-kit";
|
|
155
|
+
/**
|
|
156
|
+
* Put the kit's styles in a document once, first in its head so a view's own come after and win.
|
|
157
|
+
* Importing the kit does it for the document it runs in; a document that has them is left alone.
|
|
158
|
+
*/
|
|
159
|
+
export function ensureKitStyles(doc = globalThis.document) {
|
|
160
|
+
if (!doc?.head || doc.head.querySelector(`style[${MARK}]`))
|
|
161
|
+
return;
|
|
162
|
+
const style = doc.createElement("style");
|
|
163
|
+
style.setAttribute(MARK, "");
|
|
164
|
+
style.textContent = KIT_CSS;
|
|
165
|
+
doc.head.prepend(style);
|
|
166
|
+
}
|