@tellet/create 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -0
- package/dist/ai/generate.d.ts +33 -0
- package/dist/ai/generate.js +108 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +337 -0
- package/dist/scaffold/project.d.ts +44 -0
- package/dist/scaffold/project.js +318 -0
- package/package.json +48 -0
- package/template/Dockerfile +35 -0
- package/template/app/(dashboard)/agents/page.tsx +14 -0
- package/template/app/(dashboard)/conversations/[id]/page.tsx +103 -0
- package/template/app/(dashboard)/conversations/page.tsx +50 -0
- package/template/app/(dashboard)/dashboard/page.tsx +102 -0
- package/template/app/(dashboard)/layout.tsx +15 -0
- package/template/app/(dashboard)/settings/page.tsx +46 -0
- package/template/app/(site)/layout.tsx +3 -0
- package/template/app/(site)/page.tsx +25 -0
- package/template/app/api/chat/route.ts +129 -0
- package/template/app/api/cron/route.ts +29 -0
- package/template/app/api/orchestrator/route.ts +139 -0
- package/template/app/globals.css +30 -0
- package/template/app/layout.tsx +18 -0
- package/template/components/chat/ChatWidget.tsx +109 -0
- package/template/components/chat/Markdown.tsx +136 -0
- package/template/components/dashboard/AgentChat.tsx +192 -0
- package/template/components/dashboard/AgentsListClient.tsx +86 -0
- package/template/components/dashboard/DashboardAgentGrid.tsx +73 -0
- package/template/components/dashboard/OrchestratorChat.tsx +251 -0
- package/template/components/dashboard/Sidebar.tsx +44 -0
- package/template/components/dashboard/StatsCards.tsx +40 -0
- package/template/components/dashboard/Welcome.tsx +139 -0
- package/template/components/sections/Agents.tsx +67 -0
- package/template/components/sections/CTA.tsx +46 -0
- package/template/components/sections/FAQ.tsx +81 -0
- package/template/components/sections/Features.tsx +51 -0
- package/template/components/sections/Footer.tsx +22 -0
- package/template/components/sections/Hero.tsx +86 -0
- package/template/components/sections/Icons.tsx +29 -0
- package/template/components/ui/Button.tsx +26 -0
- package/template/docker-compose.yml +32 -0
- package/template/infra/bin/app.ts +16 -0
- package/template/infra/cdk.json +6 -0
- package/template/infra/lib/tellet-stack.ts +216 -0
- package/template/infra/package.json +20 -0
- package/template/infra/tsconfig.json +16 -0
- package/template/lib/db.ts +37 -0
- package/template/lib/engine/default.ts +227 -0
- package/template/lib/engine/index.ts +17 -0
- package/template/lib/mcp/client.ts +97 -0
- package/template/lib/mcp/knowledge.ts +84 -0
- package/template/lib/mcp/registry.ts +106 -0
- package/template/lib/orchestrator/executor.ts +202 -0
- package/template/lib/orchestrator/tools.ts +245 -0
- package/template/lib/providers/anthropic.ts +41 -0
- package/template/lib/providers/index.ts +36 -0
- package/template/lib/providers/openai.ts +46 -0
- package/template/lib/scheduler.ts +115 -0
- package/template/lib/supabase.ts +30 -0
- package/template/lib/tellet.ts +45 -0
- package/template/lib/utils.ts +6 -0
- package/template/next.config.ts +7 -0
- package/template/public/widget.js +172 -0
- package/template/railway.toml +9 -0
- package/template/tsconfig.json +21 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createBrowserClient } from "@supabase/ssr";
|
|
2
|
+
import { createServerClient } from "@supabase/ssr";
|
|
3
|
+
import { cookies } from "next/headers";
|
|
4
|
+
|
|
5
|
+
export function createClient() {
|
|
6
|
+
return createBrowserClient(
|
|
7
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
8
|
+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function createServerSupabase() {
|
|
13
|
+
const cookieStore = await cookies();
|
|
14
|
+
return createServerClient(
|
|
15
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
16
|
+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
|
|
17
|
+
{
|
|
18
|
+
cookies: {
|
|
19
|
+
getAll: () => cookieStore.getAll(),
|
|
20
|
+
setAll: (cookiesToSet) => {
|
|
21
|
+
try {
|
|
22
|
+
cookiesToSet.forEach(({ name, value, options }) =>
|
|
23
|
+
cookieStore.set(name, value, options)
|
|
24
|
+
);
|
|
25
|
+
} catch {}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
export interface TelletConfig {
|
|
5
|
+
version: string;
|
|
6
|
+
company: { name: string; description: string; industry: string };
|
|
7
|
+
engine: string;
|
|
8
|
+
llm: { provider: string; defaultModel: string; fallback: string | null };
|
|
9
|
+
agents: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
role: string;
|
|
13
|
+
model: string;
|
|
14
|
+
channels: string[];
|
|
15
|
+
tools?: string[];
|
|
16
|
+
}[];
|
|
17
|
+
tools?: Record<string, {
|
|
18
|
+
type: string;
|
|
19
|
+
package?: string;
|
|
20
|
+
env?: Record<string, string>;
|
|
21
|
+
description?: string;
|
|
22
|
+
}>;
|
|
23
|
+
channels: Record<string, { enabled: boolean }>;
|
|
24
|
+
storage: string;
|
|
25
|
+
integrations: string[];
|
|
26
|
+
site: {
|
|
27
|
+
tagline: string;
|
|
28
|
+
subtitle: string;
|
|
29
|
+
features: { title: string; description: string; icon: string }[];
|
|
30
|
+
faq: { question: string; answer: string }[];
|
|
31
|
+
cta: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let _config: TelletConfig | null = null;
|
|
36
|
+
|
|
37
|
+
export function getConfig(): TelletConfig {
|
|
38
|
+
if (_config) return _config;
|
|
39
|
+
const raw = fs.readFileSync(
|
|
40
|
+
path.join(process.cwd(), "tellet.json"),
|
|
41
|
+
"utf-8"
|
|
42
|
+
);
|
|
43
|
+
_config = JSON.parse(raw) as TelletConfig;
|
|
44
|
+
return _config;
|
|
45
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tellet Embeddable Chat Widget
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* <script src="https://your-tellet-app.com/widget.js"
|
|
6
|
+
* data-agent="support"
|
|
7
|
+
* data-api="https://your-tellet-app.com"></script>
|
|
8
|
+
*/
|
|
9
|
+
(function () {
|
|
10
|
+
var script = document.currentScript;
|
|
11
|
+
var agentId = script && script.getAttribute("data-agent") || "support";
|
|
12
|
+
var apiBase = script && script.getAttribute("data-api") || window.location.origin;
|
|
13
|
+
var accentColor = script && script.getAttribute("data-color") || "#8b5cf6";
|
|
14
|
+
|
|
15
|
+
// Inject styles
|
|
16
|
+
var style = document.createElement("style");
|
|
17
|
+
style.textContent = [
|
|
18
|
+
"#tellet-widget-btn{position:fixed;bottom:24px;right:24px;z-index:99999;width:56px;height:56px;border-radius:50%;background:" + accentColor + ";color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 0 30px " + accentColor + "33;transition:transform .2s}",
|
|
19
|
+
"#tellet-widget-btn:hover{transform:scale(1.05)}",
|
|
20
|
+
"#tellet-widget-panel{position:fixed;bottom:96px;right:24px;z-index:99999;width:380px;max-height:500px;border-radius:16px;background:#09090b;border:1px solid #27272a;box-shadow:0 25px 50px rgba(0,0,0,.5);display:none;flex-direction:column;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#fafafa}",
|
|
21
|
+
"#tellet-widget-panel.open{display:flex}",
|
|
22
|
+
".tw-hdr{padding:12px 16px;border-bottom:1px solid #27272a;background:#18181b;display:flex;align-items:center;gap:8px}",
|
|
23
|
+
".tw-av{width:28px;height:28px;border-radius:50%;background:" + accentColor + "22;color:" + accentColor + ";display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700}",
|
|
24
|
+
".tw-nm{font-size:13px;font-weight:600}.tw-st{font-size:11px;color:#52525b}",
|
|
25
|
+
".tw-msgs{flex:1;overflow-y:auto;padding:12px 16px;min-height:200px;max-height:340px}",
|
|
26
|
+
".tw-empty{text-align:center;padding:32px 0;color:#a1a1aa;font-size:13px}",
|
|
27
|
+
".tw-m{display:flex;margin-bottom:8px}.tw-m.u{justify-content:flex-end}",
|
|
28
|
+
".tw-b{max-width:85%;padding:8px 12px;border-radius:12px;font-size:13px;line-height:1.5}",
|
|
29
|
+
".tw-m.u .tw-b{background:" + accentColor + ";color:#fff}",
|
|
30
|
+
".tw-m.a .tw-b{background:#18181b;border:1px solid #27272a;color:#fafafa}",
|
|
31
|
+
".tw-inp{padding:12px;border-top:1px solid #27272a;display:flex;gap:8px}",
|
|
32
|
+
".tw-inp input{flex:1;padding:8px 12px;border-radius:8px;background:#18181b;border:1px solid #27272a;color:#fafafa;font-size:13px;outline:none}",
|
|
33
|
+
".tw-inp input:focus{border-color:" + accentColor + "}.tw-inp input::placeholder{color:#52525b}",
|
|
34
|
+
".tw-inp button{padding:8px 12px;border-radius:8px;background:" + accentColor + ";color:#fff;border:none;cursor:pointer;font-size:13px}.tw-inp button:disabled{opacity:.5;cursor:default}"
|
|
35
|
+
].join("");
|
|
36
|
+
document.head.appendChild(style);
|
|
37
|
+
|
|
38
|
+
// Build DOM safely
|
|
39
|
+
var btn = document.createElement("button");
|
|
40
|
+
btn.id = "tellet-widget-btn";
|
|
41
|
+
var icon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
42
|
+
icon.setAttribute("width", "24");
|
|
43
|
+
icon.setAttribute("height", "24");
|
|
44
|
+
icon.setAttribute("fill", "none");
|
|
45
|
+
icon.setAttribute("stroke", "currentColor");
|
|
46
|
+
icon.setAttribute("stroke-width", "1.5");
|
|
47
|
+
icon.setAttribute("viewBox", "0 0 24 24");
|
|
48
|
+
var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
49
|
+
path.setAttribute("stroke-linecap", "round");
|
|
50
|
+
path.setAttribute("stroke-linejoin", "round");
|
|
51
|
+
path.setAttribute("d", "M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25Z");
|
|
52
|
+
icon.appendChild(path);
|
|
53
|
+
btn.appendChild(icon);
|
|
54
|
+
document.body.appendChild(btn);
|
|
55
|
+
|
|
56
|
+
var panel = document.createElement("div");
|
|
57
|
+
panel.id = "tellet-widget-panel";
|
|
58
|
+
|
|
59
|
+
// Header
|
|
60
|
+
var hdr = document.createElement("div");
|
|
61
|
+
hdr.className = "tw-hdr";
|
|
62
|
+
var av = document.createElement("div");
|
|
63
|
+
av.className = "tw-av";
|
|
64
|
+
av.textContent = "AI";
|
|
65
|
+
hdr.appendChild(av);
|
|
66
|
+
var info = document.createElement("div");
|
|
67
|
+
var nm = document.createElement("div");
|
|
68
|
+
nm.className = "tw-nm";
|
|
69
|
+
nm.textContent = "AI Assistant";
|
|
70
|
+
var st = document.createElement("div");
|
|
71
|
+
st.className = "tw-st";
|
|
72
|
+
st.textContent = "Online";
|
|
73
|
+
info.appendChild(nm);
|
|
74
|
+
info.appendChild(st);
|
|
75
|
+
hdr.appendChild(info);
|
|
76
|
+
panel.appendChild(hdr);
|
|
77
|
+
|
|
78
|
+
// Messages
|
|
79
|
+
var msgs = document.createElement("div");
|
|
80
|
+
msgs.className = "tw-msgs";
|
|
81
|
+
var empty = document.createElement("div");
|
|
82
|
+
empty.className = "tw-empty";
|
|
83
|
+
empty.textContent = "Ask me anything!";
|
|
84
|
+
msgs.appendChild(empty);
|
|
85
|
+
panel.appendChild(msgs);
|
|
86
|
+
|
|
87
|
+
// Input
|
|
88
|
+
var inp = document.createElement("div");
|
|
89
|
+
inp.className = "tw-inp";
|
|
90
|
+
var inputEl = document.createElement("input");
|
|
91
|
+
inputEl.type = "text";
|
|
92
|
+
inputEl.placeholder = "Type a message...";
|
|
93
|
+
var sendBtn = document.createElement("button");
|
|
94
|
+
sendBtn.textContent = "Send";
|
|
95
|
+
inp.appendChild(inputEl);
|
|
96
|
+
inp.appendChild(sendBtn);
|
|
97
|
+
panel.appendChild(inp);
|
|
98
|
+
|
|
99
|
+
document.body.appendChild(panel);
|
|
100
|
+
|
|
101
|
+
var open = false;
|
|
102
|
+
var streaming = false;
|
|
103
|
+
var conversationId = null;
|
|
104
|
+
|
|
105
|
+
btn.onclick = function () {
|
|
106
|
+
open = !open;
|
|
107
|
+
panel.classList.toggle("open", open);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function addMessage(role, text) {
|
|
111
|
+
if (msgs.querySelector(".tw-empty")) {
|
|
112
|
+
msgs.removeChild(msgs.querySelector(".tw-empty"));
|
|
113
|
+
}
|
|
114
|
+
var row = document.createElement("div");
|
|
115
|
+
row.className = "tw-m " + (role === "user" ? "u" : "a");
|
|
116
|
+
var bubble = document.createElement("div");
|
|
117
|
+
bubble.className = "tw-b";
|
|
118
|
+
bubble.textContent = text;
|
|
119
|
+
row.appendChild(bubble);
|
|
120
|
+
msgs.appendChild(row);
|
|
121
|
+
msgs.scrollTop = msgs.scrollHeight;
|
|
122
|
+
return bubble;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function send() {
|
|
126
|
+
var text = inputEl.value.trim();
|
|
127
|
+
if (!text || streaming) return;
|
|
128
|
+
inputEl.value = "";
|
|
129
|
+
streaming = true;
|
|
130
|
+
sendBtn.disabled = true;
|
|
131
|
+
|
|
132
|
+
addMessage("user", text);
|
|
133
|
+
var bubble = addMessage("assistant", "...");
|
|
134
|
+
|
|
135
|
+
fetch(apiBase + "/api/chat", {
|
|
136
|
+
method: "POST",
|
|
137
|
+
headers: { "Content-Type": "application/json" },
|
|
138
|
+
body: JSON.stringify({ message: text, agent_id: agentId, conversation_id: conversationId }),
|
|
139
|
+
})
|
|
140
|
+
.then(function (res) { return res.body.getReader(); })
|
|
141
|
+
.then(function (reader) {
|
|
142
|
+
var decoder = new TextDecoder();
|
|
143
|
+
var content = "";
|
|
144
|
+
function read() {
|
|
145
|
+
reader.read().then(function (result) {
|
|
146
|
+
if (result.done) { streaming = false; sendBtn.disabled = false; return; }
|
|
147
|
+
var lines = decoder.decode(result.value).split("\n");
|
|
148
|
+
for (var i = 0; i < lines.length; i++) {
|
|
149
|
+
if (lines[i].indexOf("data: ") === 0) {
|
|
150
|
+
try {
|
|
151
|
+
var data = JSON.parse(lines[i].slice(6));
|
|
152
|
+
if (data.text) { content += data.text; bubble.textContent = content; }
|
|
153
|
+
if (data.conversation_id) conversationId = data.conversation_id;
|
|
154
|
+
} catch (e) {}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
msgs.scrollTop = msgs.scrollHeight;
|
|
158
|
+
read();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
read();
|
|
162
|
+
})
|
|
163
|
+
.catch(function () {
|
|
164
|
+
bubble.textContent = "Something went wrong.";
|
|
165
|
+
streaming = false;
|
|
166
|
+
sendBtn.disabled = false;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
sendBtn.onclick = send;
|
|
171
|
+
inputEl.onkeydown = function (e) { if (e.key === "Enter") send(); };
|
|
172
|
+
})();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [{ "name": "next" }],
|
|
17
|
+
"paths": { "@/*": ["./*"] }
|
|
18
|
+
},
|
|
19
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
20
|
+
"exclude": ["node_modules", "infra"]
|
|
21
|
+
}
|