@rnsk/bot 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +52 -0
  2. package/dist/components/bot-gooey-input.d.ts +12 -0
  3. package/dist/components/bot-gooey-input.d.ts.map +1 -0
  4. package/dist/components/bot-gooey-input.js +25 -0
  5. package/dist/components/bot-gooey-input.js.map +1 -0
  6. package/dist/components/bot-gooey-stack.d.ts +6 -0
  7. package/dist/components/bot-gooey-stack.d.ts.map +1 -0
  8. package/dist/components/bot-gooey-stack.js +13 -0
  9. package/dist/components/bot-gooey-stack.js.map +1 -0
  10. package/dist/components/bot-message-thread.d.ts +6 -0
  11. package/dist/components/bot-message-thread.d.ts.map +1 -0
  12. package/dist/components/bot-message-thread.js +38 -0
  13. package/dist/components/bot-message-thread.js.map +1 -0
  14. package/dist/components/bot-shell.d.ts +9 -0
  15. package/dist/components/bot-shell.d.ts.map +1 -0
  16. package/dist/components/bot-shell.js +6 -0
  17. package/dist/components/bot-shell.js.map +1 -0
  18. package/dist/components/chat/initiate-connection.d.ts +9 -0
  19. package/dist/components/chat/initiate-connection.d.ts.map +1 -0
  20. package/dist/components/chat/initiate-connection.js +6 -0
  21. package/dist/components/chat/initiate-connection.js.map +1 -0
  22. package/dist/components/chat/loading-state.d.ts +4 -0
  23. package/dist/components/chat/loading-state.d.ts.map +1 -0
  24. package/dist/components/chat/loading-state.js +5 -0
  25. package/dist/components/chat/loading-state.js.map +1 -0
  26. package/dist/components/chat/reasoning-state.d.ts +7 -0
  27. package/dist/components/chat/reasoning-state.d.ts.map +1 -0
  28. package/dist/components/chat/reasoning-state.js +7 -0
  29. package/dist/components/chat/reasoning-state.js.map +1 -0
  30. package/dist/components/chat/streaming-text.d.ts +5 -0
  31. package/dist/components/chat/streaming-text.d.ts.map +1 -0
  32. package/dist/components/chat/streaming-text.js +9 -0
  33. package/dist/components/chat/streaming-text.js.map +1 -0
  34. package/dist/components/chat/tool-call-ui.d.ts +5 -0
  35. package/dist/components/chat/tool-call-ui.d.ts.map +1 -0
  36. package/dist/components/chat/tool-call-ui.js +7 -0
  37. package/dist/components/chat/tool-call-ui.js.map +1 -0
  38. package/dist/components/runstack-bot.d.ts +3 -0
  39. package/dist/components/runstack-bot.d.ts.map +1 -0
  40. package/dist/components/runstack-bot.js +49 -0
  41. package/dist/components/runstack-bot.js.map +1 -0
  42. package/dist/hooks/use-bot-config.d.ts +7 -0
  43. package/dist/hooks/use-bot-config.d.ts.map +1 -0
  44. package/dist/hooks/use-bot-config.js +32 -0
  45. package/dist/hooks/use-bot-config.js.map +1 -0
  46. package/dist/hooks/use-bot-theme.d.ts +3 -0
  47. package/dist/hooks/use-bot-theme.d.ts.map +1 -0
  48. package/dist/hooks/use-bot-theme.js +22 -0
  49. package/dist/hooks/use-bot-theme.js.map +1 -0
  50. package/dist/index.d.ts +3 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +2 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/lib/bot-config.d.ts +4 -0
  55. package/dist/lib/bot-config.d.ts.map +1 -0
  56. package/dist/lib/bot-config.js +19 -0
  57. package/dist/lib/bot-config.js.map +1 -0
  58. package/dist/lib/bot-transport.d.ts +10 -0
  59. package/dist/lib/bot-transport.d.ts.map +1 -0
  60. package/dist/lib/bot-transport.js +28 -0
  61. package/dist/lib/bot-transport.js.map +1 -0
  62. package/dist/lib/branding.d.ts +7 -0
  63. package/dist/lib/branding.d.ts.map +1 -0
  64. package/dist/lib/branding.js +14 -0
  65. package/dist/lib/branding.js.map +1 -0
  66. package/dist/lib/chat-tool-parts.d.ts +16 -0
  67. package/dist/lib/chat-tool-parts.d.ts.map +1 -0
  68. package/dist/lib/chat-tool-parts.js +67 -0
  69. package/dist/lib/chat-tool-parts.js.map +1 -0
  70. package/dist/lib/cn.d.ts +3 -0
  71. package/dist/lib/cn.d.ts.map +1 -0
  72. package/dist/lib/cn.js +6 -0
  73. package/dist/lib/cn.js.map +1 -0
  74. package/dist/types.d.ts +30 -0
  75. package/dist/types.d.ts.map +1 -0
  76. package/dist/types.js +2 -0
  77. package/dist/types.js.map +1 -0
  78. package/package.json +55 -0
  79. package/styles/bot.css +123 -0
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @rnsk/bot
2
+
3
+ Embeddable Runstack chat widget with gooey expand/collapse UI, API-key authentication, and optional Studio agent / toolkit scoping.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @rnsk/bot
9
+ ```
10
+
11
+ Peer dependencies: `react`, `react-dom`, `ai`, `@ai-sdk/react`.
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import { RunstackBot } from '@rnsk/bot';
17
+ import '@rnsk/bot/styles/bot.css';
18
+
19
+ export function SupportBot() {
20
+ return (
21
+ <RunstackBot
22
+ apiKey={process.env.NEXT_PUBLIC_RUNSTACK_API_KEY!}
23
+ position="right"
24
+ placeholder="Ask anything…"
25
+ agentIds={['agent_xxx']}
26
+ toolkits={['github']}
27
+ systemPrompt="You are a helpful support assistant."
28
+ />
29
+ );
30
+ }
31
+ ```
32
+
33
+ ## Props
34
+
35
+ | Prop | Type | Default | Description |
36
+ | --- | --- | --- | --- |
37
+ | `apiKey` | `string` | required | Runstack API key (`rnsk_…`) |
38
+ | `position` | `'left' \| 'right'` | `'right'` | Corner anchor |
39
+ | `placeholder` | `string` | `'Ask anything…'` | Input placeholder |
40
+ | `agentIds` | `string[]` | — | Scope tools to Studio agents |
41
+ | `toolkits` | `string[]` | — | Scope tools to toolkit ids |
42
+ | `systemPrompt` | `string` | — | Extra system instructions |
43
+ | `apiBase` | `string` | `https://app.runstack.engineer` | API base URL |
44
+ | `theme` | `'light' \| 'dark' \| 'system'` | `'system'` | Widget theme |
45
+
46
+ ## Model selection
47
+
48
+ The bot uses the workspace **Bot model** configured in Runstack settings (LLM Providers). It falls back to the workspace default model, then Runstack auto-default providers.
49
+
50
+ ## Security
51
+
52
+ API keys in browser bundles are visible to users. For production, proxy requests through your backend.
@@ -0,0 +1,12 @@
1
+ export declare function BotGooeyInput({ open, value, placeholder, disabled, logoUrl, brandName, onValueChange, onSubmit, onToggle, }: {
2
+ open: boolean;
3
+ value: string;
4
+ placeholder: string;
5
+ disabled?: boolean;
6
+ logoUrl: string;
7
+ brandName: string;
8
+ onValueChange: (value: string) => void;
9
+ onSubmit: () => void;
10
+ onToggle: () => void;
11
+ }): import("react").JSX.Element;
12
+ //# sourceMappingURL=bot-gooey-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-gooey-input.d.ts","sourceRoot":"","sources":["../../src/components/bot-gooey-input.tsx"],"names":[],"mappings":"AAOA,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,aAAa,EACb,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,+BAqFA"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { motion } from 'motion/react';
3
+ import { useEffect, useRef } from 'react';
4
+ import { cn } from '../lib/cn.js';
5
+ const GOOEY_FILTER_ID = 'rnsk-bot-gooey-input';
6
+ export function BotGooeyInput({ open, value, placeholder, disabled, logoUrl, brandName, onValueChange, onSubmit, onToggle, }) {
7
+ const inputRef = useRef(null);
8
+ useEffect(() => {
9
+ if (open) {
10
+ inputRef.current?.focus();
11
+ }
12
+ }, [open]);
13
+ const handleSubmit = (event) => {
14
+ event.preventDefault();
15
+ if (!value.trim() || disabled)
16
+ return;
17
+ onSubmit();
18
+ };
19
+ return (_jsxs("div", { className: "rnsk-bot-gooey-input relative", children: [_jsx("svg", { className: "pointer-events-none absolute h-0 w-0", "aria-hidden": true, children: _jsx("defs", { children: _jsxs("filter", { id: GOOEY_FILTER_ID, children: [_jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "5", result: "blur" }), _jsx("feColorMatrix", { in: "blur", mode: "matrix", values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10", result: "goo" }), _jsx("feBlend", { in: "SourceGraphic", in2: "goo" })] }) }) }), _jsxs(motion.form, { onSubmit: handleSubmit, className: "relative flex items-center gap-0", style: { filter: open ? `url(#${GOOEY_FILTER_ID})` : undefined }, initial: false, animate: { width: open ? 320 : 52 }, transition: { type: 'spring', stiffness: 380, damping: 32 }, children: [_jsx("button", { type: "button", onClick: onToggle, className: cn('rnsk-bot-trigger relative z-10 flex size-[52px] shrink-0 items-center justify-center overflow-hidden rounded-2xl border border-[var(--rnsk-border)] bg-[var(--rnsk-card)] shadow-lg'), "aria-label": open ? 'Collapse chat' : 'Open chat', children: _jsx("img", { src: logoUrl, alt: brandName, className: "size-7 rounded-lg object-cover" }) }), _jsxs(motion.div, { className: "relative z-0 flex min-w-0 flex-1 items-center overflow-hidden rounded-2xl border border-[var(--rnsk-border)] bg-[var(--rnsk-card)] shadow-lg", initial: false, animate: {
20
+ opacity: open ? 1 : 0,
21
+ width: open ? 268 : 0,
22
+ marginLeft: open ? -8 : 0,
23
+ }, transition: { type: 'spring', stiffness: 380, damping: 32 }, children: [_jsx("input", { ref: inputRef, type: "text", value: value, onChange: (event) => onValueChange(event.target.value), placeholder: placeholder, disabled: disabled, className: "h-[52px] w-full bg-transparent px-4 pr-12 text-sm text-[var(--rnsk-foreground)] outline-none placeholder:text-[var(--rnsk-muted-foreground)]" }), _jsx("button", { type: "submit", disabled: disabled || !value.trim(), className: "absolute right-2 inline-flex size-8 items-center justify-center rounded-full bg-[var(--rnsk-primary)] text-[var(--rnsk-primary-foreground)] disabled:opacity-40", "aria-label": "Send message", children: _jsxs("svg", { viewBox: "0 0 24 24", className: "size-4", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M12 19V5" }), _jsx("path", { d: "m7 10 5-5 5 5" })] }) })] })] })] }));
24
+ }
25
+ //# sourceMappingURL=bot-gooey-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-gooey-input.js","sourceRoot":"","sources":["../../src/components/bot-gooey-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,MAAM,UAAU,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,aAAa,EACb,QAAQ,EACR,QAAQ,GAWT;IACC,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,EAAE,CAAC;YACT,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,MAAM,YAAY,GAAG,CAAC,KAAsB,EAAE,EAAE;QAC9C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,QAAQ;YAAE,OAAO;QACtC,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,+BAA+B,aAC5C,cAAK,SAAS,E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ACrB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;yBAC1B,EACD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,aAE3D,gBACE,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAC,8IAA8I,GACxJ,EACF,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EACnC,SAAS,EAAC,iKAAiK,gBAChK,cAAc,YAEzB,eAAK,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,aAC3F,eAAM,CAAC,EAAC,UAAU,GAAG,EACrB,eAAM,CAAC,EAAC,eAAe,GAAG,IACtB,GACC,IACE,IACD,IACV,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function BotGooeyStack({ open, children, }: {
3
+ open: boolean;
4
+ children: ReactNode;
5
+ }): import("react").JSX.Element;
6
+ //# sourceMappingURL=bot-gooey-stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-gooey-stack.d.ts","sourceRoot":"","sources":["../../src/components/bot-gooey-stack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAoCA"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { motion } from 'motion/react';
3
+ import { cn } from '../lib/cn.js';
4
+ const GOOEY_FILTER_ID = 'rnsk-bot-gooey-stack';
5
+ export function BotGooeyStack({ open, children, }) {
6
+ return (_jsxs("div", { className: cn('rnsk-bot-gooey-stack relative', open ? 'mb-2' : 'mb-0'), children: [_jsx("svg", { className: "pointer-events-none absolute h-0 w-0", "aria-hidden": true, children: _jsx("defs", { children: _jsxs("filter", { id: GOOEY_FILTER_ID, children: [_jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "10", result: "blur" }), _jsx("feColorMatrix", { in: "blur", mode: "matrix", values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10", result: "goo" }), _jsx("feBlend", { in: "SourceGraphic", in2: "goo" })] }) }) }), _jsx(motion.div, { initial: false, animate: {
7
+ opacity: open ? 1 : 0,
8
+ y: open ? 0 : 24,
9
+ scale: open ? 1 : 0.96,
10
+ height: open ? 'auto' : 0,
11
+ }, transition: { type: 'spring', stiffness: 320, damping: 30 }, className: "overflow-hidden", style: { filter: open ? `url(#${GOOEY_FILTER_ID})` : undefined }, children: _jsx("div", { className: "w-[min(360px,calc(100vw-3rem))] overflow-hidden rounded-[22px] border border-[var(--rnsk-border)] bg-[var(--rnsk-card)] shadow-2xl", children: children }) })] }));
12
+ }
13
+ //# sourceMappingURL=bot-gooey-stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-gooey-stack.js","sourceRoot":"","sources":["../../src/components/bot-gooey-stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,MAAM,UAAU,a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Message } from 'ai';
2
+ export declare function BotMessageThread({ messages, isStreaming, }: {
3
+ messages: UIMessage[];
4
+ isStreaming?: boolean;
5
+ }): import("react").JSX.Element;
6
+ //# sourceMappingURL=bot-message-thread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-message-thread.d.ts","sourceRoot":"","sources":["../../src/components/bot-message-thread.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAepC,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAmB,GACpB,EAAE;IACD,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,+BAiFA"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ import { getMessageText, getReasoningRows, isReasoningActive, parseToolParts, } from '../lib/chat-tool-parts.js';
4
+ import { InitiateConnection } from './chat/initiate-connection.js';
5
+ import { LoadingState } from './chat/loading-state.js';
6
+ import { ReasoningState } from './chat/reasoning-state.js';
7
+ import { StreamingText } from './chat/streaming-text.js';
8
+ import { ToolCallUi } from './chat/tool-call-ui.js';
9
+ export function BotMessageThread({ messages, isStreaming = false, }) {
10
+ const endRef = useRef(null);
11
+ useEffect(() => {
12
+ endRef.current?.scrollIntoView({ behavior: 'smooth', block: 'end' });
13
+ }, [messages, isStreaming]);
14
+ return (_jsxs("div", { className: "rnsk-bot-thread flex max-h-[min(420px,50vh)] flex-col gap-4 overflow-y-auto px-4 py-4", children: [messages.map((message, index) => {
15
+ const isAssistant = message.role === 'assistant';
16
+ const isLastMessage = index === messages.length - 1;
17
+ const messageContent = getMessageText(message);
18
+ const toolParts = parseToolParts(message);
19
+ const reasoningRows = getReasoningRows(message);
20
+ if (!isAssistant) {
21
+ return (_jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "max-w-[85%] rounded-2xl rounded-br-md bg-[var(--rnsk-primary)] px-3.5 py-2.5 text-sm text-[var(--rnsk-primary-foreground)]", children: messageContent }) }, message.id));
22
+ }
23
+ return (_jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [isLastMessage && isStreaming && !messageContent && reasoningRows.length === 0 && toolParts.length === 0 ? (_jsx(LoadingState, {})) : null, reasoningRows.length > 0 ? (_jsx(ReasoningState, { rows: reasoningRows, isActive: isReasoningActive(message, isLastMessage, isStreaming) })) : null, toolParts.length > 0 ? _jsx(ToolCallUi, { parts: toolParts }) : null, toolParts.map((toolPart, toolIndex) => {
24
+ const initOutput = toolPart.output;
25
+ if (toolPart.type === 'initiateConnection' &&
26
+ toolPart.state === 'output-available' &&
27
+ initOutput?.provider &&
28
+ !initOutput.error) {
29
+ return (_jsx(InitiateConnection, { data: { ...initOutput, provider: initOutput.provider } }, toolPart.toolCallId ?? `tool-${index}-${toolIndex}`));
30
+ }
31
+ if (toolPart.state === 'output-error') {
32
+ return (_jsx("div", { className: "rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2 text-sm text-red-600", children: toolPart.errorText ?? 'Tool error' }, toolPart.toolCallId ?? `tool-${index}-${toolIndex}`));
33
+ }
34
+ return null;
35
+ }), _jsx(StreamingText, { text: messageContent, isStreaming: isLastMessage && isStreaming })] }, message.id));
36
+ }), _jsx("div", { ref: endRef })] }));
37
+ }
38
+ //# sourceMappingURL=bot-message-thread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-message-thread.js","sourceRoot":"","sources":["../../src/components/bot-message-thread.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,C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E,aAAa,IAAI,WAAW,GACzC,KA/CM,OAAO,CAAC,EAAE,CAgDd,CACP,CAAC;YACJ,CAAC,CAAC,EACF,cAAK,GAAG,EAAE,MAAM,GAAI,IAChB,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { RunstackBotPosition } from '../types.js';
3
+ export declare function BotShell({ position, theme, className, children, }: {
4
+ position: RunstackBotPosition;
5
+ theme: 'light' | 'dark';
6
+ className?: string;
7
+ children: ReactNode;
8
+ }): import("react").JSX.Element;
9
+ //# sourceMappingURL=bot-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-shell.d.ts","sourceRoot":"","sources":["../../src/components/bot-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAaA"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ export function BotShell({ position, theme, className, children, }) {
4
+ return (_jsx("div", { className: cn('rnsk-bot fixed bottom-6 z-[9999] font-sans', position === 'left' ? 'left-6' : 'right-6', theme === 'dark' ? 'rnsk-bot-dark' : 'rnsk-bot-light', className), children: _jsx("div", { className: "flex flex-col items-end", children: children }) }));
5
+ }
6
+ //# sourceMappingURL=bot-shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-shell.js","sourceRoot":"","sources":["../../src/components/bot-shell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGlC,MAAM,UAAU,QAAQ,CAAC,EACvB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,GAMT;IACC,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CACX,4CAA4C,EAC5C,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,EACrD,SAAS,CACV,YAED,cAAK,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAO,GACrD,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type InitiateConnectionData = {
2
+ provider: string;
3
+ link?: string;
4
+ error?: string;
5
+ };
6
+ export declare function InitiateConnection({ data }: {
7
+ data: InitiateConnectionData;
8
+ }): import("react").JSX.Element;
9
+ //# sourceMappingURL=initiate-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initiate-connection.d.ts","sourceRoot":"","sources":["../../../src/components/chat/initiate-connection.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,sBAAsB,CAAA;CAAE,+BAsB5E"}
@@ -0,0 +1,6 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ export function InitiateConnection({ data }) {
3
+ const hasLink = Boolean(data.link) && !data.error;
4
+ return (_jsxs("div", { className: "rnsk-bot-connect flex items-center justify-between gap-3 rounded-xl border border-[var(--rnsk-border)] bg-[var(--rnsk-card)] px-4 py-3 text-sm shadow-sm", children: [_jsxs("span", { className: "font-medium text-[var(--rnsk-foreground)]", children: ["Connect ", data.provider] }), hasLink ? (_jsx("a", { href: data.link, target: "_blank", rel: "noopener noreferrer", className: "rnsk-bot-connect-btn inline-flex shrink-0 items-center rounded-full bg-[var(--rnsk-primary)] px-3 py-1.5 text-xs font-medium text-[var(--rnsk-primary-foreground)]", children: "Connect" })) : (_jsx("span", { className: "text-[var(--rnsk-muted-foreground)]", children: "Unavailable" }))] }));
5
+ }
6
+ //# sourceMappingURL=initiate-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initiate-connection.js","sourceRoot":"","sources":["../../../src/components/chat/initiate-connection.tsx"],"names":[],"mappings":";AAMA,MAAM,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAoC;IAC3E,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAElD,OAAO,CACL,eAAK,SAAS,EAAC,0JAA0J,aACvK,gBAAM,SAAS,EAAC,2CAA2C,yBAChD,IAAI,CAAC,QAAQ,IACjB,EACN,OAAO,CAAC,CAAC,CAAC,CACT,YACE,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,oKAAoK,wBAG5K,CACL,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,qCAAqC,4BAAmB,CACzE,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function LoadingState({ label }: {
2
+ label?: string;
3
+ }): import("react").JSX.Element;
4
+ //# sourceMappingURL=loading-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-state.d.ts","sourceRoot":"","sources":["../../../src/components/chat/loading-state.tsx"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,EAAE,KAAkB,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,+BAWtE"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function LoadingState({ label = 'Thinking' }) {
3
+ return (_jsxs("div", { className: "rnsk-bot-loading flex items-center gap-2 text-sm text-[var(--rnsk-muted-foreground)]", children: [_jsxs("span", { className: "rnsk-bot-loading-dots", "aria-hidden": true, children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsx("span", { children: label })] }));
4
+ }
5
+ //# sourceMappingURL=loading-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-state.js","sourceRoot":"","sources":["../../../src/components/chat/loading-state.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,GAAG,UAAU,EAAsB;IACrE,OAAO,CACL,eAAK,SAAS,EAAC,sFAAsF,aACnG,gBAAM,SAAS,EAAC,uBAAuB,kCACrC,gBAAQ,EACR,gBAAQ,EACR,gBAAQ,IACH,EACP,yBAAO,KAAK,GAAQ,IAChB,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function ReasoningState({ rows, isActive, }: {
2
+ rows: {
3
+ primary: string;
4
+ }[];
5
+ isActive: boolean;
6
+ }): import("react").JSX.Element | null;
7
+ //# sourceMappingURL=reasoning-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reasoning-state.d.ts","sourceRoot":"","sources":["../../../src/components/chat/reasoning-state.tsx"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB,sCAeA"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function ReasoningState({ rows, isActive, }) {
3
+ if (rows.length === 0)
4
+ return null;
5
+ return (_jsxs("details", { className: "rnsk-bot-reasoning rounded-lg border border-[var(--rnsk-border)] bg-[var(--rnsk-muted)]/40 px-3 py-2 text-xs text-[var(--rnsk-muted-foreground)]", open: isActive, children: [_jsx("summary", { className: "cursor-pointer font-medium text-[var(--rnsk-foreground)]", children: "Reasoning" }), _jsx("div", { className: "mt-2 space-y-2 whitespace-pre-wrap", children: rows.map((row, index) => (_jsx("p", { children: row.primary }, index))) })] }));
6
+ }
7
+ //# sourceMappingURL=reasoning-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reasoning-state.js","sourceRoot":"","sources":["../../../src/components/chat/reasoning-state.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,EACJ,QAAQ,GAIT;IACC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEnC,OAAO,CACL,mBAAS,SAAS,EAAC,kJAAkJ,EAAC,IAAI,EAAE,QAAQ,aAClL,kBAAS,SAAS,EAAC,0DAA0D,0BAEnE,EACV,cAAK,SAAS,EAAC,oCAAoC,YAChD,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACxB,sBAAgB,GAAG,CAAC,OAAO,IAAnB,KAAK,CAAmB,CACjC,CAAC,GACE,IACE,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function StreamingText({ text, isStreaming, }: {
2
+ text?: string;
3
+ isStreaming?: boolean;
4
+ }): import("react").JSX.Element | null;
5
+ //# sourceMappingURL=streaming-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-text.d.ts","sourceRoot":"","sources":["../../../src/components/chat/streaming-text.tsx"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAAC,EAC5B,IAAS,EACT,WAAmB,GACpB,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,sCASA"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Streamdown } from 'streamdown';
3
+ import { cn } from '../../lib/cn.js';
4
+ export function StreamingText({ text = '', isStreaming = false, }) {
5
+ if (!text && !isStreaming)
6
+ return null;
7
+ return (_jsxs("div", { className: cn('rnsk-bot-markdown w-full text-sm leading-relaxed text-[var(--rnsk-foreground)]'), children: [_jsx(Streamdown, { children: text }), isStreaming ? _jsx("span", { className: "rnsk-bot-cursor", "aria-hidden": true }) : null] }));
8
+ }
9
+ //# sourceMappingURL=streaming-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-text.js","sourceRoot":"","sources":["../../../src/components/chat/streaming-text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,UAAU,aAAa,CAAC,EAC5B,IAAI,GAAG,EAAE,EACT,WAAW,GAAG,KAAK,GAIpB;IACC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAEvC,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,gFAAgF,CAAC,aAClG,KAAC,UAAU,cAAE,IAAI,GAAc,EAC9B,WAAW,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,iBAAiB,wBAAe,CAAC,CAAC,CAAC,IAAI,IAClE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ParsedToolPart } from '../../lib/chat-tool-parts.js';
2
+ export declare function ToolCallUi({ parts }: {
3
+ parts: ParsedToolPart[];
4
+ }): import("react").JSX.Element | null;
5
+ //# sourceMappingURL=tool-call-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-ui.d.ts","sourceRoot":"","sources":["../../../src/components/chat/tool-call-ui.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,sCAgBhE"}
@@ -0,0 +1,7 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ export function ToolCallUi({ parts }) {
3
+ if (parts.length === 0)
4
+ return null;
5
+ return (_jsx("div", { className: "rnsk-bot-tools flex flex-wrap gap-2", children: parts.map((part, index) => (_jsxs("span", { className: "inline-flex items-center rounded-full border border-[var(--rnsk-border)] bg-[var(--rnsk-muted)] px-2.5 py-1 text-xs text-[var(--rnsk-muted-foreground)]", children: [part.type, part.state === 'output-error' ? ' · error' : part.state === 'output-available' ? ' · done' : ' · running'] }, part.toolCallId ?? `${part.type}-${index}`))) }));
6
+ }
7
+ //# sourceMappingURL=tool-call-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-ui.js","sourceRoot":"","sources":["../../../src/components/chat/tool-call-ui.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAA+B;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEpC,OAAO,CACL,cAAK,SAAS,EAAC,qCAAqC,YACjD,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,gBAEE,SAAS,EAAC,yJAAyJ,aAElK,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,KAJrG,IAAI,CAAC,UAAU,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,CAK1C,CACR,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RunstackBotProps } from '../types.js';
2
+ export declare function RunstackBot({ apiKey, position, placeholder, agentIds, toolkits, systemPrompt, apiBase, theme, className, }: RunstackBotProps): import("react").JSX.Element;
3
+ //# sourceMappingURL=runstack-bot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runstack-bot.d.ts","sourceRoot":"","sources":["../../src/components/runstack-bot.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQhE,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,QAAkB,EAClB,WAAiC,EACjC,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,KAAgB,EAChB,SAAS,GACV,EAAE,gBAAgB,+BAkElB"}
@@ -0,0 +1,49 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useChat } from '@ai-sdk/react';
4
+ import { useMemo, useState } from 'react';
5
+ import { useBotConfig } from '../hooks/use-bot-config.js';
6
+ import { useBotTheme } from '../hooks/use-bot-theme.js';
7
+ import { resolveBrandLogo, resolveBrandName } from '../lib/branding.js';
8
+ import { createBotTransport } from '../lib/bot-transport.js';
9
+ import { BotGooeyInput } from './bot-gooey-input.js';
10
+ import { BotGooeyStack } from './bot-gooey-stack.js';
11
+ import { BotMessageThread } from './bot-message-thread.js';
12
+ import { BotShell } from './bot-shell.js';
13
+ const DEFAULT_PLACEHOLDER = 'Ask anything…';
14
+ export function RunstackBot({ apiKey, position = 'right', placeholder = DEFAULT_PLACEHOLDER, agentIds, toolkits, systemPrompt, apiBase, theme = 'system', className, }) {
15
+ const resolvedTheme = useBotTheme(theme);
16
+ const { config } = useBotConfig(apiKey, apiBase);
17
+ const [uiState, setUiState] = useState('collapsed');
18
+ const [input, setInput] = useState('');
19
+ const transport = useMemo(() => createBotTransport({
20
+ apiKey,
21
+ apiBase,
22
+ agentIds,
23
+ toolkits,
24
+ systemPrompt,
25
+ }), [apiKey, apiBase, agentIds, toolkits, systemPrompt]);
26
+ const { messages, sendMessage, status, error } = useChat({ transport });
27
+ const brandName = resolveBrandName(config?.branding);
28
+ const brandLogo = resolveBrandLogo(config?.branding);
29
+ const isStreaming = status === 'streaming' || status === 'submitted';
30
+ const chatOpen = uiState === 'chat';
31
+ const inputOpen = uiState !== 'collapsed';
32
+ const handleToggle = () => {
33
+ if (uiState === 'collapsed') {
34
+ setUiState('input');
35
+ return;
36
+ }
37
+ setUiState('collapsed');
38
+ };
39
+ const handleSubmit = async () => {
40
+ const text = input.trim();
41
+ if (!text || isStreaming)
42
+ return;
43
+ setInput('');
44
+ setUiState('chat');
45
+ await sendMessage({ text });
46
+ };
47
+ return (_jsxs(BotShell, { position: position, theme: resolvedTheme, className: className, children: [_jsxs(BotGooeyStack, { open: chatOpen, children: [_jsx(BotMessageThread, { messages: messages, isStreaming: isStreaming }), error ? (_jsx("div", { className: "border-t border-[var(--rnsk-border)] px-4 py-2 text-xs text-red-600", children: error.message })) : null] }), _jsx(BotGooeyInput, { open: inputOpen, value: input, placeholder: placeholder, disabled: isStreaming, logoUrl: brandLogo, brandName: brandName, onValueChange: setInput, onSubmit: () => void handleSubmit(), onToggle: handleToggle })] }));
48
+ }
49
+ //# sourceMappingURL=runstack-bot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runstack-bot.js","sourceRoot":"","sources":["../../src/components/runstack-bot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAA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AQ,EACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,YAAY,EAAE,EACnC,QAAQ,EAAE,YAAY,GACtB,IACO,CACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { BotConfigResponse } from '../types.js';
2
+ export declare function useBotConfig(apiKey: string, apiBase?: string): {
3
+ config: BotConfigResponse | null;
4
+ loading: boolean;
5
+ error: string | null;
6
+ };
7
+ //# sourceMappingURL=use-bot-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-bot-config.d.ts","sourceRoot":"","sources":["../../src/hooks/use-bot-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;;;;EA8B5D"}
@@ -0,0 +1,32 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { fetchBotConfig } from '../lib/bot-config.js';
3
+ export function useBotConfig(apiKey, apiBase) {
4
+ const [config, setConfig] = useState(null);
5
+ const [loading, setLoading] = useState(true);
6
+ const [error, setError] = useState(null);
7
+ useEffect(() => {
8
+ let cancelled = false;
9
+ setLoading(true);
10
+ setError(null);
11
+ void fetchBotConfig(apiKey, apiBase)
12
+ .then((result) => {
13
+ if (!cancelled)
14
+ setConfig(result);
15
+ })
16
+ .catch((err) => {
17
+ if (!cancelled) {
18
+ setError(err instanceof Error ? err.message : 'Failed to load config');
19
+ setConfig(null);
20
+ }
21
+ })
22
+ .finally(() => {
23
+ if (!cancelled)
24
+ setLoading(false);
25
+ });
26
+ return () => {
27
+ cancelled = true;
28
+ };
29
+ }, [apiKey, apiBase]);
30
+ return { config, loading, error };
31
+ }
32
+ //# sourceMappingURL=use-bot-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-bot-config.js","sourceRoot":"","sources":["../../src/hooks/use-bot-config.ts"],"names":[],"mappings":"AAAA,OAAO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E,OAAO,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RunstackBotTheme } from '../types.js';
2
+ export declare function useBotTheme(theme?: RunstackBotTheme): "light" | "dark";
3
+ //# sourceMappingURL=use-bot-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-bot-theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use-bot-theme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQpD,wBAAgB,WAAW,CAAC,KAAK,GAAE,gBAA2B,oBAc7D"}
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from 'react';
2
+ function resolveTheme(theme) {
3
+ if (theme === 'light' || theme === 'dark')
4
+ return theme;
5
+ if (typeof window === 'undefined')
6
+ return 'light';
7
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
8
+ }
9
+ export function useBotTheme(theme = 'system') {
10
+ const [resolved, setResolved] = useState(() => resolveTheme(theme));
11
+ useEffect(() => {
12
+ setResolved(resolveTheme(theme));
13
+ if (theme !== 'system')
14
+ return;
15
+ const media = window.matchMedia('(prefers-color-scheme: dark)');
16
+ const onChange = () => setResolved(media.matches ? 'dark' : 'light');
17
+ media.addEventListener('change', onChange);
18
+ return () => media.removeEventListener('change', onChange);
19
+ }, [theme]);
20
+ return resolved;
21
+ }
22
+ //# sourceMappingURL=use-bot-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-bot-theme.js","sourceRoot":"","sources":["../../src/hooks/use-bot-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C,SAAS,YAAY,CAAC,KAAuB;IAC3C,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAA0B,QAAQ;IAC5D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAmB,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,QAAQ;YAAE,OAAO;QAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACrE,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC3C,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { RunstackBot } from './components/runstack-bot.js';
2
+ export type { BotConfigResponse, BotUiState, RunstackBotPosition, RunstackBotProps, RunstackBotTheme, WorkspaceBranding, } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { RunstackBot } from './components/runstack-bot.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BotConfigResponse } from '../types.js';
2
+ export declare function resolveApiBase(apiBase?: string): string;
3
+ export declare function fetchBotConfig(apiKey: string, apiBase?: string): Promise<BotConfigResponse>;
4
+ //# sourceMappingURL=bot-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-config.d.ts","sourceRoot":"","sources":["../../src/lib/bot-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrD,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,CAAC,CAc5B"}
@@ -0,0 +1,19 @@
1
+ const DEFAULT_API_BASE = 'https://app.runstack.engineer';
2
+ export function resolveApiBase(apiBase) {
3
+ const base = apiBase?.trim() || DEFAULT_API_BASE;
4
+ return base.replace(/\/$/, '');
5
+ }
6
+ export async function fetchBotConfig(apiKey, apiBase) {
7
+ const base = resolveApiBase(apiBase);
8
+ const res = await fetch(`${base}/api/bot/config`, {
9
+ headers: {
10
+ Authorization: `Bearer ${apiKey}`,
11
+ },
12
+ });
13
+ if (!res.ok) {
14
+ const text = await res.text().catch(() => '');
15
+ throw new Error(`Failed to load bot config (${res.status}): ${text}`);
16
+ }
17
+ return (await res.json());
18
+ }
19
+ //# sourceMappingURL=bot-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-config.js","sourceRoot":"","sources":["../../src/lib/bot-config.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AAEzD,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,gBAAgB,CAAC;IACjD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,OAAgB;IAEhB,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,iBAAiB,EAAE;QAChD,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,MAAM,EAAE;SAClC;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAsB,CAAC;AACjD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DefaultChatTransport } from 'ai';
2
+ export type BotTransportOptions = {
3
+ apiKey: string;
4
+ apiBase?: string;
5
+ agentIds?: string[];
6
+ toolkits?: string[];
7
+ systemPrompt?: string;
8
+ };
9
+ export declare function createBotTransport(options: BotTransportOptions): DefaultChatTransport<import("ai").UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>;
10
+ //# sourceMappingURL=bot-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-transport.d.ts","sourceRoot":"","sources":["../../src/lib/bot-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAI1C,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,yGAyB9D"}
@@ -0,0 +1,28 @@
1
+ import { DefaultChatTransport } from 'ai';
2
+ import { resolveApiBase } from './bot-config.js';
3
+ export function createBotTransport(options) {
4
+ const { apiKey, apiBase, agentIds, toolkits, systemPrompt } = options;
5
+ const base = resolveApiBase(apiBase);
6
+ return new DefaultChatTransport({
7
+ api: `${base}/api/bot/chat`,
8
+ fetch: async (input, init) => {
9
+ const headers = new Headers(init?.headers);
10
+ headers.set('Authorization', `Bearer ${apiKey}`);
11
+ if (!headers.has('Content-Type') && init?.body) {
12
+ headers.set('Content-Type', 'application/json');
13
+ }
14
+ return fetch(input, { ...init, headers });
15
+ },
16
+ prepareSendMessagesRequest({ messages }) {
17
+ return {
18
+ body: {
19
+ messages,
20
+ ...(agentIds && agentIds.length > 0 ? { agentIds } : {}),
21
+ ...(toolkits && toolkits.length > 0 ? { toolkitIds: toolkits } : {}),
22
+ ...(systemPrompt?.trim() ? { systemPrompt: systemPrompt.trim() } : {}),
23
+ },
24
+ };
25
+ },
26
+ });
27
+ }
28
+ //# sourceMappingURL=bot-transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-transport.js","sourceRoot":"","sources":["../../src/lib/bot-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAA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AAC,EAAE,CAAC;iBACvE;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { WorkspaceBranding } from '../types.js';
2
+ export declare const DEFAULT_BRAND_NAME = "Runstack";
3
+ export declare const DEFAULT_BRAND_LOGO = "https://app.runstack.engineer/favicon.ico";
4
+ export declare function resolveBrandName(branding: WorkspaceBranding | null | undefined): string;
5
+ export declare function resolveBrandLogo(branding: WorkspaceBranding | null | undefined): string;
6
+ export declare function resolveBrandTextColor(branding: WorkspaceBranding | null | undefined): string;
7
+ //# sourceMappingURL=branding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/lib/branding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,eAAO,MAAM,kBAAkB,8CACc,CAAC;AAE9C,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGvF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGvF;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE5F"}
@@ -0,0 +1,14 @@
1
+ export const DEFAULT_BRAND_NAME = 'Runstack';
2
+ export const DEFAULT_BRAND_LOGO = 'https://app.runstack.engineer/favicon.ico';
3
+ export function resolveBrandName(branding) {
4
+ const name = branding?.companyName?.trim();
5
+ return name || DEFAULT_BRAND_NAME;
6
+ }
7
+ export function resolveBrandLogo(branding) {
8
+ const logo = branding?.logoUrl?.trim();
9
+ return logo || DEFAULT_BRAND_LOGO;
10
+ }
11
+ export function resolveBrandTextColor(branding) {
12
+ return branding?.textColor ?? '#6b7280';
13
+ }
14
+ //# sourceMappingURL=branding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branding.js","sourceRoot":"","sources":["../../src/lib/branding.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAC7C,MAAM,CAAC,MAAM,kBAAkB,GAC7B,2CAA2C,CAAC;AAE9C,MAAM,UAAU,gBAAgB,CAAC,QAA8C;IAC7E,MAAM,IAAI,GAAG,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC3C,OAAO,IAAI,IAAI,kBAAkB,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAA8C;IAC7E,MAAM,IAAI,GAAG,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACvC,OAAO,IAAI,IAAI,kBAAkB,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAA8C;IAClF,OAAO,QAAQ,EAAE,SAAS,IAAI,SAAS,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { UIMessage } from 'ai';
2
+ export type ParsedToolPart = {
3
+ type: string;
4
+ state: string;
5
+ input?: Record<string, unknown>;
6
+ output?: Record<string, unknown>;
7
+ toolCallId?: string;
8
+ errorText?: string;
9
+ };
10
+ export declare function parseToolParts(message: UIMessage): ParsedToolPart[];
11
+ export declare function getMessageText(message: UIMessage): string;
12
+ export declare function getReasoningRows(message: UIMessage): {
13
+ primary: string;
14
+ }[];
15
+ export declare function isReasoningActive(message: UIMessage, isLastMessage: boolean, isStreaming: boolean): boolean;
16
+ //# sourceMappingURL=chat-tool-parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-tool-parts.d.ts","sourceRoot":"","sources":["../../src/lib/chat-tool-parts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsDF,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,cAAc,EAAE,CAYnE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAOzD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAS1E;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,OAAO,GACnB,OAAO,CAMT"}
@@ -0,0 +1,67 @@
1
+ function toRecordOrUndefined(value) {
2
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
3
+ return value;
4
+ }
5
+ return undefined;
6
+ }
7
+ function mapRawToolPart(part) {
8
+ const rawPart = part;
9
+ const toolName = typeof rawPart.type === 'string' && rawPart.type.startsWith('tool-')
10
+ ? rawPart.type.replace('tool-', '')
11
+ : rawPart.toolName || rawPart.type || 'unknown';
12
+ let state = rawPart.state || 'input-available';
13
+ if (!rawPart.state) {
14
+ if (rawPart.errorText || rawPart.error) {
15
+ state = 'output-error';
16
+ }
17
+ else if (rawPart.output !== undefined || rawPart.result !== undefined) {
18
+ state = 'output-available';
19
+ }
20
+ }
21
+ return {
22
+ type: toolName,
23
+ state,
24
+ input: toRecordOrUndefined(rawPart.input ?? rawPart.args),
25
+ output: toRecordOrUndefined(rawPart.output ?? rawPart.result),
26
+ toolCallId: rawPart.toolCallId,
27
+ errorText: rawPart.errorText ||
28
+ (rawPart.error
29
+ ? typeof rawPart.error === 'string'
30
+ ? rawPart.error
31
+ : JSON.stringify(rawPart.error)
32
+ : undefined),
33
+ };
34
+ }
35
+ export function parseToolParts(message) {
36
+ const rawParts = message.parts?.filter((part) => {
37
+ if (typeof part.type !== 'string')
38
+ return false;
39
+ return (part.type.startsWith('tool-') ||
40
+ part.type === 'tool-call' ||
41
+ part.type === 'tool-result');
42
+ }) ?? [];
43
+ return rawParts.map(mapRawToolPart);
44
+ }
45
+ export function getMessageText(message) {
46
+ return (message.parts
47
+ ?.filter((part) => part.type === 'text')
48
+ .map((part) => part.text)
49
+ .join('') ?? '');
50
+ }
51
+ export function getReasoningRows(message) {
52
+ return (message.parts
53
+ ?.filter((part) => part.type === 'reasoning')
54
+ .map((part) => ({
55
+ primary: 'text' in part ? String(part.text) : '',
56
+ }))
57
+ .filter((row) => row.primary.length > 0) ?? []);
58
+ }
59
+ export function isReasoningActive(message, isLastMessage, isStreaming) {
60
+ if (!isLastMessage || !isStreaming)
61
+ return false;
62
+ const rows = getReasoningRows(message);
63
+ const text = getMessageText(message);
64
+ const tools = parseToolParts(message);
65
+ return rows.length > 0 && !text && tools.length === 0;
66
+ }
67
+ //# sourceMappingURL=chat-tool-parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-tool-parts.js","sourceRoot":"","sources":["../../src/lib/chat-tool-parts.ts"],"names":[],"mappings":"AAwBA,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,KAAgC,CAAC;IAC1C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CAAC,IAAgC;IACtD,MAAM,OAAO,GAAG,IAA8B,CAAC;IAC/C,MAAM,QAAQ,GACZ,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAA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G,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ //# sourceMappingURL=cn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
package/dist/lib/cn.js ADDED
@@ -0,0 +1,6 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
6
+ //# sourceMappingURL=cn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,30 @@
1
+ export type RunstackBotPosition = 'left' | 'right';
2
+ export type RunstackBotTheme = 'light' | 'dark' | 'system';
3
+ export type WorkspaceBranding = {
4
+ companyName: string | null;
5
+ websiteUrl: string | null;
6
+ fontStyle: string;
7
+ textColor: string;
8
+ logoUrl: string | null;
9
+ updatedAt: string | null;
10
+ };
11
+ export type BotConfigResponse = {
12
+ branding: WorkspaceBranding;
13
+ botModel: {
14
+ provider: string;
15
+ modelId: string;
16
+ } | null;
17
+ };
18
+ export type RunstackBotProps = {
19
+ apiKey: string;
20
+ position?: RunstackBotPosition;
21
+ placeholder?: string;
22
+ agentIds?: string[];
23
+ toolkits?: string[];
24
+ systemPrompt?: string;
25
+ apiBase?: string;
26
+ theme?: RunstackBotTheme;
27
+ className?: string;
28
+ };
29
+ export type BotUiState = 'collapsed' | 'input' | 'chat';
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@rnsk/bot",
3
+ "version": "0.0.1",
4
+ "description": "Embeddable Runstack chat widget with gooey UI, API-key auth, and toolkit/agent scoping.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./styles/bot.css": "./styles/bot.css"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "styles",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "keywords": [
26
+ "runstack",
27
+ "chatbot",
28
+ "widget",
29
+ "ai",
30
+ "react"
31
+ ],
32
+ "author": "Deepraj Bera",
33
+ "homepage": "https://runstack.engineer/docs/rnsk-bot",
34
+ "peerDependencies": {
35
+ "@ai-sdk/react": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0",
36
+ "ai": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
37
+ "react": "^18.0.0 || ^19.0.0",
38
+ "react-dom": "^18.0.0 || ^19.0.0"
39
+ },
40
+ "dependencies": {
41
+ "clsx": "^2.1.1",
42
+ "motion": "^12.42.2",
43
+ "streamdown": "^2.5.0",
44
+ "tailwind-merge": "^3.6.0"
45
+ },
46
+ "devDependencies": {
47
+ "@ai-sdk/react": "^4.0.69",
48
+ "@types/react": "^19.2.6",
49
+ "@types/react-dom": "^19.2.3",
50
+ "ai": "^7.0.66",
51
+ "react": "^19.2.6",
52
+ "react-dom": "^19.2.6",
53
+ "typescript": "^5.6.0"
54
+ }
55
+ }
package/styles/bot.css ADDED
@@ -0,0 +1,123 @@
1
+ .rnsk-bot {
2
+ --rnsk-background: #ffffff;
3
+ --rnsk-foreground: #111827;
4
+ --rnsk-card: #ffffff;
5
+ --rnsk-border: #e5e7eb;
6
+ --rnsk-muted: #f3f4f6;
7
+ --rnsk-muted-foreground: #6b7280;
8
+ --rnsk-primary: #111827;
9
+ --rnsk-primary-foreground: #ffffff;
10
+ color: var(--rnsk-foreground);
11
+ }
12
+
13
+ .rnsk-bot-dark {
14
+ --rnsk-background: #0b0f17;
15
+ --rnsk-foreground: #f9fafb;
16
+ --rnsk-card: #111827;
17
+ --rnsk-border: #1f2937;
18
+ --rnsk-muted: #1f2937;
19
+ --rnsk-muted-foreground: #9ca3af;
20
+ --rnsk-primary: #f9fafb;
21
+ --rnsk-primary-foreground: #111827;
22
+ }
23
+
24
+ .rnsk-bot-light {
25
+ --rnsk-background: #ffffff;
26
+ --rnsk-foreground: #111827;
27
+ --rnsk-card: #ffffff;
28
+ --rnsk-border: #e5e7eb;
29
+ --rnsk-muted: #f3f4f6;
30
+ --rnsk-muted-foreground: #6b7280;
31
+ --rnsk-primary: #111827;
32
+ --rnsk-primary-foreground: #ffffff;
33
+ }
34
+
35
+ .rnsk-bot * {
36
+ box-sizing: border-box;
37
+ }
38
+
39
+ .rnsk-bot-loading-dots {
40
+ display: inline-flex;
41
+ gap: 4px;
42
+ }
43
+
44
+ .rnsk-bot-loading-dots span {
45
+ width: 4px;
46
+ height: 4px;
47
+ border-radius: 9999px;
48
+ background: var(--rnsk-muted-foreground);
49
+ animation: rnsk-bot-dot 1.2s infinite ease-in-out;
50
+ }
51
+
52
+ .rnsk-bot-loading-dots span:nth-child(2) {
53
+ animation-delay: 0.15s;
54
+ }
55
+
56
+ .rnsk-bot-loading-dots span:nth-child(3) {
57
+ animation-delay: 0.3s;
58
+ }
59
+
60
+ @keyframes rnsk-bot-dot {
61
+ 0%,
62
+ 80%,
63
+ 100% {
64
+ opacity: 0.3;
65
+ transform: scale(0.8);
66
+ }
67
+ 40% {
68
+ opacity: 1;
69
+ transform: scale(1);
70
+ }
71
+ }
72
+
73
+ .rnsk-bot-cursor {
74
+ display: inline-block;
75
+ width: 0.45rem;
76
+ height: 1rem;
77
+ margin-left: 2px;
78
+ vertical-align: text-bottom;
79
+ background: var(--rnsk-foreground);
80
+ animation: rnsk-bot-blink 1s step-end infinite;
81
+ }
82
+
83
+ @keyframes rnsk-bot-blink {
84
+ 50% {
85
+ opacity: 0;
86
+ }
87
+ }
88
+
89
+ .rnsk-bot-markdown p {
90
+ margin: 0 0 0.75rem;
91
+ }
92
+
93
+ .rnsk-bot-markdown p:last-child {
94
+ margin-bottom: 0;
95
+ }
96
+
97
+ .rnsk-bot-markdown pre {
98
+ overflow-x: auto;
99
+ border-radius: 0.75rem;
100
+ background: var(--rnsk-muted);
101
+ padding: 0.75rem;
102
+ }
103
+
104
+ .rnsk-bot-markdown code {
105
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
106
+ font-size: 0.85em;
107
+ }
108
+
109
+ .rnsk-bot-thread {
110
+ scrollbar-width: thin;
111
+ scrollbar-color: var(--rnsk-border) transparent;
112
+ }
113
+
114
+ .rnsk-bot-connect-btn:hover {
115
+ opacity: 0.92;
116
+ }
117
+
118
+ @media (prefers-reduced-motion: reduce) {
119
+ .rnsk-bot-loading-dots span,
120
+ .rnsk-bot-cursor {
121
+ animation: none;
122
+ }
123
+ }