bazilion 0.5.0 → 0.6.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.
Files changed (118) hide show
  1. package/README.md +14 -9
  2. package/dist/cli.js +365 -140
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +4452 -16989
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/web/client/assets/AgentAvatar-Cq7PVBE_.js +1 -0
  7. package/dist/web/client/assets/AgentTabs-M5K8emJ8.js +1 -0
  8. package/dist/web/client/assets/Button-BefUtjMZ.js +1 -0
  9. package/dist/web/client/assets/ChatPane-C8zQfpzH.js +74 -0
  10. package/dist/web/client/assets/ConfigTabs-DRqAymcN.js +1 -0
  11. package/dist/web/client/assets/FieldRow-BqWnxZiX.js +1 -0
  12. package/dist/web/client/assets/MembersEditor-B-47GLUb.js +1 -0
  13. package/dist/web/client/assets/SpawnTeamModal-DiiC7Nc0.js +1 -0
  14. package/dist/web/client/assets/TemplatesTabs-DB4KERTQ.js +1 -0
  15. package/dist/web/client/assets/_id-B7gv1aPQ.js +1 -0
  16. package/dist/web/client/assets/_id-C7d1AqS0.js +1 -0
  17. package/dist/web/client/assets/_id-DhiwjC8u.js +1 -0
  18. package/dist/web/client/assets/_id-p8lUuNFm.js +1 -0
  19. package/dist/web/client/assets/agents-v8G-wt0M.js +1 -0
  20. package/dist/web/client/assets/config-BdmYpS_y.js +3 -0
  21. package/dist/web/client/assets/groups-DiY_ExGM.js +1 -0
  22. package/dist/web/client/assets/inbox-DtfVx246.js +1 -0
  23. package/dist/web/client/assets/index-BQUL6oyH.js +12 -0
  24. package/dist/web/client/assets/login-CVS70W9g.js +1 -0
  25. package/dist/web/client/assets/mcp-BDLQq8OZ.js +1 -0
  26. package/dist/web/client/assets/memory-6GGuAXwx.js +1 -0
  27. package/dist/web/client/assets/profile-groups-BA8rwZMA.js +1 -0
  28. package/dist/web/client/assets/profiles-C0aAcPZg.js +1 -0
  29. package/dist/web/client/assets/routes-DgAhnKFw.js +1 -0
  30. package/dist/web/client/assets/services-BZ86QEah.js +1 -0
  31. package/dist/web/client/assets/skills-mv_NNNwo.js +1 -0
  32. package/dist/web/client/assets/styles-CmqUskDu.css +2 -0
  33. package/dist/web/client/assets/telegram-5f9WXs3x.js +1 -0
  34. package/dist/web/client/assets/tokens-DHiYsFUh.js +1 -0
  35. package/dist/web/client/assets/triggers-CjC8Ljrz.js +1 -0
  36. package/dist/web/client/assets/welcome-C-Cu-ziL.js +1 -0
  37. package/dist/web/client/assets/wire-constants-BkT5-597.js +1 -0
  38. package/dist/web/client/baziu.svg +8 -0
  39. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +37 -0
  40. package/dist/web/server/assets/AgentTabs-BOjTN7QF.js +34 -0
  41. package/dist/web/server/assets/Button-Dsnw22OF.js +17 -0
  42. package/dist/web/server/assets/ChatPane-BvpswYvF.js +1084 -0
  43. package/dist/web/server/assets/ConfigTabs-CyuxzesF.js +41 -0
  44. package/dist/web/server/assets/FieldRow-DwyqycWI.js +94 -0
  45. package/dist/web/server/assets/MembersEditor-BWQztvrX.js +131 -0
  46. package/dist/web/server/assets/Sidebar-DmEiewRN.js +529 -0
  47. package/dist/web/server/assets/SpawnTeamModal-dSN421k_.js +107 -0
  48. package/dist/web/server/assets/TemplatesTabs---7h5GYa.js +30 -0
  49. package/dist/web/server/assets/_id-BZ-YCWSw.js +16 -0
  50. package/dist/web/server/assets/_id-Bm4-_AP-.js +367 -0
  51. package/dist/web/server/assets/_id-C78M9_j9.js +12 -0
  52. package/dist/web/server/assets/_id-CGZbudCl.js +28 -0
  53. package/dist/web/server/assets/_id-CHNm7EAd.js +161 -0
  54. package/dist/web/server/assets/_id-CrQbC5L8.js +16 -0
  55. package/dist/web/server/assets/_id-Crcw2HhT.js +38 -0
  56. package/dist/web/server/assets/_id-CvIGhq4U.js +16 -0
  57. package/dist/web/server/assets/_id-DF3pfi9M.js +27 -0
  58. package/dist/web/server/assets/_id-Dc8P9sy2.js +24 -0
  59. package/dist/web/server/assets/_id-GJk3EYTT.js +662 -0
  60. package/dist/web/server/assets/_id-pd4S7LTi.js +467 -0
  61. package/dist/web/server/assets/_tanstack-start-manifest_v-CPyKYMJg.js +174 -0
  62. package/dist/web/server/assets/agents-70EwQJR6.js +210 -0
  63. package/dist/web/server/assets/agents-Ds4lcREv.js +26 -0
  64. package/dist/web/server/assets/agents-K4Smhnq3.js +14 -0
  65. package/dist/web/server/assets/auth-DpAGLHpA.js +26 -0
  66. package/dist/web/server/assets/config-CMXUx_IF.js +19 -0
  67. package/dist/web/server/assets/config-DQbCsY_l.js +382 -0
  68. package/dist/web/server/assets/config-DxCGYgR9.js +12 -0
  69. package/dist/web/server/assets/createServerRpc-CBTntoKx.js +12 -0
  70. package/dist/web/server/assets/createSsrRpc-DHBVUN8O.js +16 -0
  71. package/dist/web/server/assets/daemon-client-2NRMzlTr.js +96 -0
  72. package/dist/web/server/assets/empty-plugin-adapters-Bos_V2s-.js +5 -0
  73. package/dist/web/server/assets/groups-CXVew7BP.js +150 -0
  74. package/dist/web/server/assets/groups-Cms8cvH5.js +12 -0
  75. package/dist/web/server/assets/groups-Dmcvw5ya.js +21 -0
  76. package/dist/web/server/assets/inbox-0QfwsrGo.js +27 -0
  77. package/dist/web/server/assets/inbox-8HybA2Ws.js +133 -0
  78. package/dist/web/server/assets/inbox-B7UWoICA.js +42 -0
  79. package/dist/web/server/assets/login-CNznncgA.js +58 -0
  80. package/dist/web/server/assets/login-CQybKk7Y.js +74 -0
  81. package/dist/web/server/assets/mcp-42BrkI1I.js +12 -0
  82. package/dist/web/server/assets/mcp-DIa0kIOf.js +268 -0
  83. package/dist/web/server/assets/mcp-DsTjY3uz.js +12 -0
  84. package/dist/web/server/assets/memory-BfrMp8iY.js +284 -0
  85. package/dist/web/server/assets/memory-Dr0lOM2y.js +28 -0
  86. package/dist/web/server/assets/memory-EEgLDfCj.js +16 -0
  87. package/dist/web/server/assets/profile-groups-BW5gU-fG.js +12 -0
  88. package/dist/web/server/assets/profile-groups-B_kIT6BU.js +208 -0
  89. package/dist/web/server/assets/profile-groups-C5isDI2t.js +28 -0
  90. package/dist/web/server/assets/profiles-BP1v-jna.js +453 -0
  91. package/dist/web/server/assets/profiles-BbPTpmyq.js +26 -0
  92. package/dist/web/server/assets/profiles-Cy5auEj8.js +12 -0
  93. package/dist/web/server/assets/router-CL100-Ly.js +460 -0
  94. package/dist/web/server/assets/routes-CzJLQxcS.js +14 -0
  95. package/dist/web/server/assets/routes-D2H1Hnoh.js +57 -0
  96. package/dist/web/server/assets/routes-Dzk8jvIo.js +33 -0
  97. package/dist/web/server/assets/services-Bgj6M2gC.js +12 -0
  98. package/dist/web/server/assets/services-DEgYsWJ4.js +17 -0
  99. package/dist/web/server/assets/services-DFenjiw0.js +94 -0
  100. package/dist/web/server/assets/skills-BASIP_rT.js +12 -0
  101. package/dist/web/server/assets/skills-C-JPRCHh.js +12 -0
  102. package/dist/web/server/assets/skills-DZXN680t.js +261 -0
  103. package/dist/web/server/assets/start-cOXH7eTI.js +4 -0
  104. package/dist/web/server/assets/telegram-BbvqVWxa.js +583 -0
  105. package/dist/web/server/assets/telegram-Bq49AtnP.js +12 -0
  106. package/dist/web/server/assets/telegram-sUckI94O.js +12 -0
  107. package/dist/web/server/assets/tokens-BERRE0wB.js +14 -0
  108. package/dist/web/server/assets/tokens-CImgxhDI.js +193 -0
  109. package/dist/web/server/assets/tokens-Dwn00iV7.js +12 -0
  110. package/dist/web/server/assets/triggers-DtexqbNH.js +16 -0
  111. package/dist/web/server/assets/triggers-TyIjwSYn.js +26 -0
  112. package/dist/web/server/assets/triggers-_iSeahif.js +191 -0
  113. package/dist/web/server/assets/welcome-BkQ9NC5K.js +81 -0
  114. package/dist/web/server/assets/wire-constants-Deb4NxBb.js +16 -0
  115. package/dist/web/server/server.js +5899 -0
  116. package/dist/web-server.js +42 -0
  117. package/dist/web-server.js.map +1 -0
  118. package/package.json +10 -4
@@ -0,0 +1,12 @@
1
+ import { t as createServerFn } from "../server.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-DHBVUN8O.js";
3
+ import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
+ //#region src/routes/config/index.tsx
5
+ var $$splitComponentImporter = () => import("./config-DQbCsY_l.js");
6
+ var fetchProvidersData = createServerFn({ method: "GET" }).handler(createSsrRpc("b18a227687dba45b99ea5a2ac7a5bf8efcd9bc54387bc279cd87510fd2f83f7e"));
7
+ var Route = createFileRoute("/config/")({
8
+ loader: () => fetchProvidersData(),
9
+ component: lazyRouteComponent($$splitComponentImporter, "component")
10
+ });
11
+ //#endregion
12
+ export { Route as t };
@@ -0,0 +1,12 @@
1
+ import { n as TSS_SERVER_FUNCTION } from "../server.js";
2
+ //#region ../../node_modules/.pnpm/@tanstack+start-server-core@1.169.6/node_modules/@tanstack/start-server-core/dist/esm/createServerRpc.js
3
+ var createServerRpc = (serverFnMeta, splitImportFn) => {
4
+ const url = "/_serverFn/" + serverFnMeta.id;
5
+ return Object.assign(splitImportFn, {
6
+ url,
7
+ serverFnMeta,
8
+ [TSS_SERVER_FUNCTION]: true
9
+ });
10
+ };
11
+ //#endregion
12
+ export { createServerRpc as t };
@@ -0,0 +1,16 @@
1
+ import { n as TSS_SERVER_FUNCTION, r as getServerFnById } from "../server.js";
2
+ //#region ../../node_modules/.pnpm/@tanstack+start-server-core@1.169.6/node_modules/@tanstack/start-server-core/dist/esm/createSsrRpc.js
3
+ var createSsrRpc = (functionId) => {
4
+ const url = "/_serverFn/" + functionId;
5
+ const serverFnMeta = { id: functionId };
6
+ const fn = async (...args) => {
7
+ return (await getServerFnById(functionId, { origin: "server" }))(...args);
8
+ };
9
+ return Object.assign(fn, {
10
+ url,
11
+ serverFnMeta,
12
+ [TSS_SERVER_FUNCTION]: true
13
+ });
14
+ };
15
+ //#endregion
16
+ export { createSsrRpc as t };
@@ -0,0 +1,96 @@
1
+ import { i as getCookie } from "../server.js";
2
+ //#region ../../packages/client/src/index.ts
3
+ var ApiClientError = class extends Error {
4
+ status;
5
+ body;
6
+ constructor(status, body) {
7
+ super(`${status}: ${body.error}`);
8
+ this.status = status;
9
+ this.body = body;
10
+ }
11
+ };
12
+ async function resolveToken(src) {
13
+ return typeof src === "function" ? await src() : src;
14
+ }
15
+ function createClient(cfg) {
16
+ async function authHeaders() {
17
+ return {
18
+ authorization: `Bearer ${await resolveToken(cfg.token)}`,
19
+ origin: cfg.serverUrl
20
+ };
21
+ }
22
+ async function request(method, path, body) {
23
+ const headers = { ...await authHeaders() };
24
+ if (body !== void 0) headers["content-type"] = "application/json";
25
+ const res = await fetch(`${cfg.serverUrl}${path}`, {
26
+ method,
27
+ headers,
28
+ body: body !== void 0 ? JSON.stringify(body) : void 0
29
+ });
30
+ if (!res.ok) {
31
+ const err = await res.json().catch(() => ({ error: res.statusText }));
32
+ throw new ApiClientError(res.status, err);
33
+ }
34
+ if (res.status === 204) return void 0;
35
+ return await res.json();
36
+ }
37
+ async function postMultipart(path, form) {
38
+ const res = await fetch(`${cfg.serverUrl}${path}`, {
39
+ method: "POST",
40
+ headers: { ...await authHeaders() },
41
+ body: form
42
+ });
43
+ if (!res.ok) {
44
+ const err = await res.json().catch(() => ({ error: res.statusText }));
45
+ throw new ApiClientError(res.status, err);
46
+ }
47
+ if (res.status === 204) return void 0;
48
+ return await res.json();
49
+ }
50
+ async function* stream(method, path, body) {
51
+ const headers = { ...await authHeaders() };
52
+ if (body !== void 0) headers["content-type"] = "application/json";
53
+ const res = await fetch(`${cfg.serverUrl}${path}`, {
54
+ method,
55
+ headers,
56
+ body: body !== void 0 ? JSON.stringify(body) : void 0
57
+ });
58
+ if (!res.ok || !res.body) {
59
+ const err = await res.json().catch(() => ({ error: res.statusText }));
60
+ throw new ApiClientError(res.status, err);
61
+ }
62
+ const reader = res.body.getReader();
63
+ const decoder = new TextDecoder();
64
+ let buffer = "";
65
+ while (true) {
66
+ const { done, value } = await reader.read();
67
+ if (done) break;
68
+ buffer += decoder.decode(value, { stream: true });
69
+ const lines = buffer.split("\n");
70
+ buffer = lines.pop() ?? "";
71
+ for (const line of lines) if (line.trim()) yield JSON.parse(line);
72
+ }
73
+ if (buffer.trim()) yield JSON.parse(buffer);
74
+ }
75
+ return {
76
+ get: (p) => request("GET", p),
77
+ post: (p, b) => request("POST", p, b),
78
+ postMultipart,
79
+ put: (p, b) => request("PUT", p, b),
80
+ patch: (p, b) => request("PATCH", p, b),
81
+ del: (p) => request("DELETE", p),
82
+ stream
83
+ };
84
+ }
85
+ //#endregion
86
+ //#region src/lib/daemon-client.ts
87
+ var DAEMON_URL = process.env.BAZILION_DAEMON ?? "http://127.0.0.1:4321";
88
+ function daemonClient() {
89
+ return createClient({
90
+ serverUrl: DAEMON_URL,
91
+ token: getCookie("bz_token") ?? ""
92
+ });
93
+ }
94
+ var DAEMON_BASE_URL = DAEMON_URL;
95
+ //#endregion
96
+ export { daemonClient as n, ApiClientError as r, DAEMON_BASE_URL as t };
@@ -0,0 +1,5 @@
1
+ //#region ../../node_modules/.pnpm/@tanstack+start-server-core@1.169.6/node_modules/@tanstack/start-server-core/dist/esm/empty-plugin-adapters.js
2
+ var pluginSerializationAdapters = [];
3
+ var hasPluginAdapters = false;
4
+ //#endregion
5
+ export { hasPluginAdapters, pluginSerializationAdapters };
@@ -0,0 +1,150 @@
1
+ import { t as Route } from "./groups-Cms8cvH5.js";
2
+ import { useState } from "react";
3
+ import { useRouter } from "@tanstack/react-router";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/routes/groups/index.tsx?tsr-split=component
6
+ function GroupsPage() {
7
+ const { groups, memberCounts } = Route.useLoaderData();
8
+ const router = useRouter();
9
+ async function remove(id) {
10
+ if (!confirm("remove this group registration?")) return;
11
+ const res = await fetch(`/api/groups/${id}`, { method: "DELETE" });
12
+ if (!res.ok && res.status !== 204) {
13
+ alert(res.statusText);
14
+ return;
15
+ }
16
+ await router.invalidate();
17
+ }
18
+ return /* @__PURE__ */ jsxs("div", { children: [
19
+ /* @__PURE__ */ jsx("h1", { children: "groups" }),
20
+ /* @__PURE__ */ jsx("p", {
21
+ className: "muted",
22
+ children: "A group is a collaboration context: one filesystem root, one USER.md, one roster. Every agent belongs to exactly one group."
23
+ }),
24
+ /* @__PURE__ */ jsx(RegisterGroupForm, { onRegistered: () => router.invalidate() }),
25
+ /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
26
+ /* @__PURE__ */ jsx("th", { children: "id" }),
27
+ /* @__PURE__ */ jsx("th", { children: "name" }),
28
+ /* @__PURE__ */ jsx("th", { children: "path" }),
29
+ /* @__PURE__ */ jsx("th", { children: "members" }),
30
+ /* @__PURE__ */ jsx("th", { children: "USER.md" }),
31
+ /* @__PURE__ */ jsx("th", {})
32
+ ] }) }), /* @__PURE__ */ jsxs("tbody", { children: [groups.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
33
+ colSpan: 6,
34
+ className: "muted",
35
+ children: "no groups registered"
36
+ }) }), groups.map((g) => {
37
+ const count = memberCounts[g.id] ?? 0;
38
+ const userMdBytes = g.userMd.length;
39
+ return /* @__PURE__ */ jsxs("tr", { children: [
40
+ /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("code", { children: g.id }) }),
41
+ /* @__PURE__ */ jsx("td", { children: g.name }),
42
+ /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("code", { children: g.path }) }),
43
+ /* @__PURE__ */ jsx("td", { children: count }),
44
+ /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("a", {
45
+ href: `/groups/${g.id}`,
46
+ children: userMdBytes > 0 ? `${userMdBytes} chars` : "empty"
47
+ }) }),
48
+ /* @__PURE__ */ jsx("td", { children: count === 0 ? /* @__PURE__ */ jsx("button", {
49
+ type: "button",
50
+ className: "ghost-btn",
51
+ onClick: () => remove(g.id),
52
+ children: "remove"
53
+ }) : /* @__PURE__ */ jsx("span", {
54
+ className: "muted",
55
+ title: `${count} agent(s) belong to this group`,
56
+ children: "in use"
57
+ }) })
58
+ ] }, g.id);
59
+ })] })] })
60
+ ] });
61
+ }
62
+ function RegisterGroupForm({ onRegistered }) {
63
+ const [id, setId] = useState("");
64
+ const [name, setName] = useState("");
65
+ const [link, setLink] = useState("");
66
+ const [err, setErr] = useState(null);
67
+ const [submitting, setSubmitting] = useState(false);
68
+ async function submit(e) {
69
+ e.preventDefault();
70
+ setErr(null);
71
+ if (!id.trim()) {
72
+ setErr("id is required");
73
+ return;
74
+ }
75
+ setSubmitting(true);
76
+ try {
77
+ const res = await fetch("/api/groups", {
78
+ method: "POST",
79
+ headers: { "content-type": "application/json" },
80
+ body: JSON.stringify({
81
+ id: id.trim(),
82
+ name: name.trim() || void 0,
83
+ link: link.trim() || void 0
84
+ })
85
+ });
86
+ if (!res.ok) {
87
+ const e2 = await res.json().catch(() => null);
88
+ throw new Error(e2?.error ?? res.statusText);
89
+ }
90
+ setId("");
91
+ setName("");
92
+ setLink("");
93
+ onRegistered();
94
+ } catch (e2) {
95
+ setErr(e2.message);
96
+ } finally {
97
+ setSubmitting(false);
98
+ }
99
+ }
100
+ return /* @__PURE__ */ jsxs("form", {
101
+ className: "card",
102
+ onSubmit: submit,
103
+ children: [
104
+ /* @__PURE__ */ jsx("h3", { children: "register group" }),
105
+ err && /* @__PURE__ */ jsx("div", {
106
+ className: "err",
107
+ children: err
108
+ }),
109
+ /* @__PURE__ */ jsxs("p", {
110
+ className: "muted",
111
+ children: [
112
+ "Groups always live under ",
113
+ /* @__PURE__ */ jsx("code", { children: "~/.bazilion/groups/<slug>/" }),
114
+ ". Leave the link target blank to create a fresh directory; supply an absolute path to materialize the slot as a symlink to your existing project tree instead."
115
+ ]
116
+ }),
117
+ /* @__PURE__ */ jsxs("div", {
118
+ className: "flex gap-4",
119
+ children: [/* @__PURE__ */ jsxs("label", {
120
+ className: "flex-1",
121
+ children: ["id (slug)", /* @__PURE__ */ jsx("input", {
122
+ value: id,
123
+ onChange: (e) => setId(e.target.value),
124
+ required: true,
125
+ placeholder: "myproject"
126
+ })]
127
+ }), /* @__PURE__ */ jsxs("label", {
128
+ className: "flex-1",
129
+ children: ["name", /* @__PURE__ */ jsx("input", {
130
+ value: name,
131
+ onChange: (e) => setName(e.target.value),
132
+ placeholder: "My Project"
133
+ })]
134
+ })]
135
+ }),
136
+ /* @__PURE__ */ jsxs("label", { children: ["link target (optional, absolute path)", /* @__PURE__ */ jsx("input", {
137
+ value: link,
138
+ onChange: (e) => setLink(e.target.value),
139
+ placeholder: "/home/user/projects/myproject"
140
+ })] }),
141
+ /* @__PURE__ */ jsx("button", {
142
+ type: "submit",
143
+ disabled: submitting,
144
+ children: submitting ? "registering…" : "register"
145
+ })
146
+ ]
147
+ });
148
+ }
149
+ //#endregion
150
+ export { GroupsPage as component };
@@ -0,0 +1,12 @@
1
+ import { t as createServerFn } from "../server.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-DHBVUN8O.js";
3
+ import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
+ //#region src/routes/groups/index.tsx
5
+ var $$splitComponentImporter = () => import("./groups-CXVew7BP.js");
6
+ var fetchGroupsData = createServerFn({ method: "GET" }).handler(createSsrRpc("3456e4a7ccfe06623459976ccede09e048e75baf27fcc22c5877059c175eb6f8"));
7
+ var Route = createFileRoute("/groups/")({
8
+ loader: () => fetchGroupsData(),
9
+ component: lazyRouteComponent($$splitComponentImporter, "component")
10
+ });
11
+ //#endregion
12
+ export { Route as t };
@@ -0,0 +1,21 @@
1
+ import { t as createServerFn } from "../server.js";
2
+ import { t as createServerRpc } from "./createServerRpc-CBTntoKx.js";
3
+ import { n as daemonClient } from "./daemon-client-2NRMzlTr.js";
4
+ //#region src/routes/groups/index.tsx?tss-serverfn-split
5
+ var fetchGroupsData_createServerFn_handler = createServerRpc({
6
+ id: "3456e4a7ccfe06623459976ccede09e048e75baf27fcc22c5877059c175eb6f8",
7
+ name: "fetchGroupsData",
8
+ filename: "src/routes/groups/index.tsx"
9
+ }, (opts) => fetchGroupsData.__executeServer(opts));
10
+ var fetchGroupsData = createServerFn({ method: "GET" }).handler(fetchGroupsData_createServerFn_handler, async () => {
11
+ const c = daemonClient();
12
+ const [groups, agents] = await Promise.all([c.get("/api/groups"), c.get("/api/agents?includeArchived=true")]);
13
+ const memberCounts = {};
14
+ for (const a of agents) memberCounts[a.groupId] = (memberCounts[a.groupId] ?? 0) + 1;
15
+ return {
16
+ groups,
17
+ memberCounts
18
+ };
19
+ });
20
+ //#endregion
21
+ export { fetchGroupsData_createServerFn_handler };
@@ -0,0 +1,27 @@
1
+ import { t as createServerFn } from "../server.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-DHBVUN8O.js";
3
+ import { createFileRoute, lazyRouteComponent, redirect } from "@tanstack/react-router";
4
+ //#region src/routes/agents/$id/inbox.tsx
5
+ var $$splitComponentImporter = () => import("./inbox-8HybA2Ws.js");
6
+ var fetchInbox = createServerFn({ method: "POST" }).inputValidator((d) => d).handler(createSsrRpc("2cd8c6ec40e2e2d9518b5f127a518ecd83a2222d85665cc61d5144bcf59ed4fb"));
7
+ var Route = createFileRoute("/agents/$id/inbox")({
8
+ validateSearch: (s) => ({
9
+ unread: s.unread === "1" ? "1" : void 0,
10
+ id: typeof s.id === "string" ? s.id : void 0
11
+ }),
12
+ loaderDeps: ({ search }) => ({
13
+ unreadOnly: search.unread === "1",
14
+ selectedId: search.id ?? ""
15
+ }),
16
+ loader: async ({ params, deps }) => {
17
+ const data = await fetchInbox({ data: {
18
+ id: params.id,
19
+ ...deps
20
+ } });
21
+ if (!data) throw redirect({ to: "/agents" });
22
+ return data;
23
+ },
24
+ component: lazyRouteComponent($$splitComponentImporter, "component")
25
+ });
26
+ //#endregion
27
+ export { Route as t };
@@ -0,0 +1,133 @@
1
+ import { t as Route } from "./inbox-0QfwsrGo.js";
2
+ import { t as AgentTabs } from "./AgentTabs-BOjTN7QF.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/routes/agents/$id/inbox.tsx?tsr-split=component
5
+ function decodeText(payload) {
6
+ try {
7
+ const obj = JSON.parse(payload);
8
+ if (typeof obj.text === "string") return obj.text;
9
+ } catch {}
10
+ return payload;
11
+ }
12
+ function InboxPage() {
13
+ const { resolved, messages, unreadCount, selected, agentNames } = Route.useLoaderData();
14
+ const unreadOnly = Route.useSearch().unread === "1";
15
+ const misaddressed = Boolean(selected && selected.toAgentId !== resolved.agent.id);
16
+ function agentLabel(aid) {
17
+ const name = agentNames[aid];
18
+ return name ? `${name} (${aid.slice(0, 8)})` : aid.slice(0, 8);
19
+ }
20
+ return /* @__PURE__ */ jsxs("main", {
21
+ className: "mx-auto max-w-5xl px-6 py-8",
22
+ children: [
23
+ /* @__PURE__ */ jsx("h1", {
24
+ className: "font-serif text-3xl text-foreground mb-1",
25
+ children: resolved.agent.name
26
+ }),
27
+ /* @__PURE__ */ jsxs("p", {
28
+ className: "text-xs text-muted-foreground mb-6",
29
+ children: [
30
+ /* @__PURE__ */ jsxs("code", {
31
+ className: "font-mono",
32
+ children: [resolved.agent.id.slice(0, 8), "…"]
33
+ }),
34
+ " · unread: ",
35
+ unreadCount
36
+ ]
37
+ }),
38
+ /* @__PURE__ */ jsx(AgentTabs, {
39
+ agentId: resolved.agent.id,
40
+ active: "inbox",
41
+ archived: resolved.agent.status === "archived"
42
+ }),
43
+ /* @__PURE__ */ jsxs("div", {
44
+ className: "grid grid-cols-1 md:grid-cols-[360px_1fr] gap-6",
45
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
46
+ className: "flex gap-1 border-b mb-3",
47
+ children: [/* @__PURE__ */ jsx("a", {
48
+ href: `/agents/${resolved.agent.id}/inbox`,
49
+ className: `px-3 py-1.5 text-sm border-b-2 -mb-px ${!unreadOnly ? "border-primary text-primary font-semibold" : "border-transparent text-muted-foreground"}`,
50
+ children: "all"
51
+ }), /* @__PURE__ */ jsx("a", {
52
+ href: `/agents/${resolved.agent.id}/inbox?unread=1`,
53
+ className: `px-3 py-1.5 text-sm border-b-2 -mb-px ${unreadOnly ? "border-primary text-primary font-semibold" : "border-transparent text-muted-foreground"}`,
54
+ children: "unread"
55
+ })]
56
+ }), /* @__PURE__ */ jsx("div", {
57
+ className: "rounded-lg border bg-card max-h-[640px] overflow-y-auto",
58
+ children: messages.length === 0 ? /* @__PURE__ */ jsx("div", {
59
+ className: "p-6 text-center text-muted-foreground italic",
60
+ children: unreadOnly ? "no unread messages" : "inbox empty"
61
+ }) : messages.map((m) => {
62
+ const text = decodeText(m.payload);
63
+ const preview = text.length > 80 ? `${text.slice(0, 80)}…` : text;
64
+ const when = new Date(m.createdAt).toLocaleString();
65
+ const isActive = selected?.id === m.id;
66
+ const isUnread = m.readAt === null;
67
+ const qs = unreadOnly ? `?unread=1&id=${m.id}` : `?id=${m.id}`;
68
+ return /* @__PURE__ */ jsxs("a", {
69
+ href: `/agents/${resolved.agent.id}/inbox${qs}`,
70
+ className: `block border-b last:border-0 px-3 py-2 text-sm hover:bg-accent/30 ${isActive ? "bg-accent/40" : ""} ${isUnread ? "font-medium" : ""}`,
71
+ children: [/* @__PURE__ */ jsxs("div", {
72
+ className: "flex justify-between text-xs text-muted-foreground",
73
+ children: [/* @__PURE__ */ jsxs("span", {
74
+ className: "font-mono",
75
+ children: [
76
+ isUnread && /* @__PURE__ */ jsx("span", { className: "inline-block w-1.5 h-1.5 rounded-full bg-primary mr-1.5 align-middle" }),
77
+ "from ",
78
+ agentLabel(m.fromAgentId)
79
+ ]
80
+ }), /* @__PURE__ */ jsx("span", {
81
+ className: "font-mono",
82
+ children: when
83
+ })]
84
+ }), /* @__PURE__ */ jsx("div", {
85
+ className: "text-foreground mt-0.5 truncate",
86
+ children: preview
87
+ })]
88
+ }, m.id);
89
+ })
90
+ })] }), /* @__PURE__ */ jsxs("div", { children: [
91
+ selected && !misaddressed && /* @__PURE__ */ jsxs("div", {
92
+ className: "rounded-lg border bg-card p-5 mb-4",
93
+ children: [/* @__PURE__ */ jsxs("div", {
94
+ className: "font-mono text-xs text-muted-foreground mb-2 space-y-0.5",
95
+ children: [
96
+ /* @__PURE__ */ jsxs("div", { children: ["id: ", /* @__PURE__ */ jsx("code", { children: selected.id })] }),
97
+ /* @__PURE__ */ jsxs("div", { children: ["from: ", /* @__PURE__ */ jsx("code", { children: agentLabel(selected.fromAgentId) })] }),
98
+ /* @__PURE__ */ jsxs("div", { children: ["received: ", new Date(selected.createdAt).toLocaleString()] }),
99
+ /* @__PURE__ */ jsxs("div", { children: [
100
+ "read:",
101
+ " ",
102
+ selected.readAt ? new Date(selected.readAt).toLocaleString() : "(unread)"
103
+ ] }),
104
+ selected.replyTo && /* @__PURE__ */ jsxs("div", { children: ["reply to: ", /* @__PURE__ */ jsx("code", { children: selected.replyTo })] })
105
+ ]
106
+ }), /* @__PURE__ */ jsx("div", {
107
+ className: "border-t pt-3 font-mono text-sm whitespace-pre-wrap break-words",
108
+ children: decodeText(selected.payload)
109
+ })]
110
+ }),
111
+ misaddressed && /* @__PURE__ */ jsx("div", {
112
+ className: "rounded-lg border bg-card p-5 mb-4 text-muted-foreground",
113
+ children: "message is not addressed to this agent"
114
+ }),
115
+ /* @__PURE__ */ jsxs("p", {
116
+ className: "text-xs text-muted-foreground",
117
+ children: [
118
+ "Agents exchange messages automatically via their",
119
+ " ",
120
+ /* @__PURE__ */ jsx("code", {
121
+ className: "font-mono",
122
+ children: "send_message"
123
+ }),
124
+ " tool. An idle recipient's scheduler tick drains unread mail."
125
+ ]
126
+ })
127
+ ] })]
128
+ })
129
+ ]
130
+ });
131
+ }
132
+ //#endregion
133
+ export { InboxPage as component };
@@ -0,0 +1,42 @@
1
+ import { t as createServerFn } from "../server.js";
2
+ import { t as createServerRpc } from "./createServerRpc-CBTntoKx.js";
3
+ import { n as daemonClient, r as ApiClientError } from "./daemon-client-2NRMzlTr.js";
4
+ //#region src/routes/agents/$id/inbox.tsx?tss-serverfn-split
5
+ var fetchInbox_createServerFn_handler = createServerRpc({
6
+ id: "2cd8c6ec40e2e2d9518b5f127a518ecd83a2222d85665cc61d5144bcf59ed4fb",
7
+ name: "fetchInbox",
8
+ filename: "src/routes/agents/$id/inbox.tsx"
9
+ }, (opts) => fetchInbox.__executeServer(opts));
10
+ var fetchInbox = createServerFn({ method: "POST" }).inputValidator((d) => d).handler(fetchInbox_createServerFn_handler, async ({ data }) => {
11
+ const c = daemonClient();
12
+ let resolved;
13
+ try {
14
+ resolved = await c.get(`/api/agents/${encodeURIComponent(data.id)}`);
15
+ } catch (err) {
16
+ if (err instanceof ApiClientError && err.status === 404) return null;
17
+ throw err;
18
+ }
19
+ const inboxQs = data.unreadOnly ? "?unread=1" : "";
20
+ const [list, unread, allAgents] = await Promise.all([
21
+ c.get(`/api/agents/${encodeURIComponent(resolved.agent.id)}/messages${inboxQs}`),
22
+ c.get(`/api/agents/${encodeURIComponent(resolved.agent.id)}/messages?unread=1`),
23
+ c.get("/api/agents?includeArchived=true")
24
+ ]);
25
+ let selected = null;
26
+ if (data.selectedId) try {
27
+ selected = await c.get(`/api/messages/${encodeURIComponent(data.selectedId)}`);
28
+ } catch (err) {
29
+ if (!(err instanceof ApiClientError) || err.status !== 404) throw err;
30
+ }
31
+ const agentNames = {};
32
+ for (const a of allAgents) agentNames[a.id] = a.name;
33
+ return {
34
+ resolved,
35
+ messages: [...list.messages].reverse(),
36
+ unreadCount: unread.messages.length,
37
+ selected,
38
+ agentNames
39
+ };
40
+ });
41
+ //#endregion
42
+ export { fetchInbox_createServerFn_handler };
@@ -0,0 +1,58 @@
1
+ import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/components/PawIcon.tsx
4
+ function PawIcon({ className }) {
5
+ return /* @__PURE__ */ jsxs("svg", {
6
+ viewBox: "0 0 24 24",
7
+ fill: "currentColor",
8
+ className,
9
+ "aria-hidden": "true",
10
+ children: [
11
+ /* @__PURE__ */ jsx("ellipse", {
12
+ cx: "7",
13
+ cy: "5",
14
+ rx: "2.2",
15
+ ry: "2.8"
16
+ }),
17
+ /* @__PURE__ */ jsx("ellipse", {
18
+ cx: "17",
19
+ cy: "5",
20
+ rx: "2.2",
21
+ ry: "2.8"
22
+ }),
23
+ /* @__PURE__ */ jsx("ellipse", {
24
+ cx: "3.5",
25
+ cy: "11",
26
+ rx: "2",
27
+ ry: "2.5"
28
+ }),
29
+ /* @__PURE__ */ jsx("ellipse", {
30
+ cx: "20.5",
31
+ cy: "11",
32
+ rx: "2",
33
+ ry: "2.5"
34
+ }),
35
+ /* @__PURE__ */ jsx("path", { d: "M12 22c-4.5 0-7.5-3-7.5-6 0-3 2.5-5.5 4.5-7a4 4 0 0 1 6 0c2 1.5 4.5 4 4.5 7 0 3-3 6-7.5 6z" })
36
+ ]
37
+ });
38
+ }
39
+ //#endregion
40
+ //#region src/components/BaziuLogo.tsx
41
+ function BaziuLogo({ className }) {
42
+ return /* @__PURE__ */ jsx("img", {
43
+ src: "/baziu.svg",
44
+ alt: "",
45
+ "aria-hidden": "true",
46
+ draggable: false,
47
+ className
48
+ });
49
+ }
50
+ //#endregion
51
+ //#region src/routes/login.tsx
52
+ var $$splitComponentImporter = () => import("./login-CQybKk7Y.js");
53
+ var Route = createFileRoute("/login")({
54
+ validateSearch: (search) => ({ error: search.error === "1" ? "1" : void 0 }),
55
+ component: lazyRouteComponent($$splitComponentImporter, "component")
56
+ });
57
+ //#endregion
58
+ export { BaziuLogo as n, PawIcon as r, Route as t };
@@ -0,0 +1,74 @@
1
+ import { n as BaziuLogo, r as PawIcon, t as Route } from "./login-CNznncgA.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/routes/login.tsx?tsr-split=component
4
+ function LoginPage() {
5
+ const { error } = Route.useSearch();
6
+ return /* @__PURE__ */ jsxs("main", {
7
+ className: "relative flex min-h-dvh items-center justify-center bg-cream",
8
+ children: [
9
+ /* @__PURE__ */ jsx("div", {
10
+ "aria-hidden": "true",
11
+ className: "pointer-events-none absolute inset-0",
12
+ style: { background: "radial-gradient(circle at 20% 15%, rgba(74,124,155,0.12), transparent 55%), radial-gradient(circle at 80% 85%, rgba(196,135,138,0.10), transparent 55%)" }
13
+ }),
14
+ /* @__PURE__ */ jsxs("div", {
15
+ className: "relative w-full max-w-sm rounded-[16px] border border-frost bg-snow p-8 text-center shadow-baziu-md",
16
+ children: [
17
+ /* @__PURE__ */ jsx(BaziuLogo, { className: "mx-auto mb-3 h-16 w-16" }),
18
+ /* @__PURE__ */ jsx("h1", {
19
+ className: "font-display text-[2rem] tracking-tight text-charcoal",
20
+ children: "bazilion"
21
+ }),
22
+ error && /* @__PURE__ */ jsx("div", {
23
+ className: "err mt-4",
24
+ children: "invalid token"
25
+ }),
26
+ /* @__PURE__ */ jsxs("form", {
27
+ method: "POST",
28
+ action: "/api/login",
29
+ className: "mt-6 text-left",
30
+ children: [
31
+ /* @__PURE__ */ jsx("label", {
32
+ htmlFor: "token",
33
+ className: "block text-[0.85em] font-medium text-mocha",
34
+ children: "Token"
35
+ }),
36
+ /* @__PURE__ */ jsx("input", {
37
+ type: "password",
38
+ id: "token",
39
+ name: "token",
40
+ autoFocus: true,
41
+ required: true,
42
+ placeholder: "paste from auth.json",
43
+ className: "mb-5"
44
+ }),
45
+ /* @__PURE__ */ jsx("button", {
46
+ type: "submit",
47
+ className: "w-full",
48
+ children: "log in"
49
+ })
50
+ ]
51
+ }),
52
+ /* @__PURE__ */ jsxs("p", {
53
+ className: "mt-5 text-[0.78em] leading-relaxed text-mocha-light",
54
+ children: [
55
+ "Your token is in ",
56
+ /* @__PURE__ */ jsx("code", { children: "~/.bazilion/auth.json" }),
57
+ /* @__PURE__ */ jsx("br", {}),
58
+ "created on first ",
59
+ /* @__PURE__ */ jsx("code", { children: "bazilion dashboard" }),
60
+ " or ",
61
+ /* @__PURE__ */ jsx("code", { children: "bazilion serve" })
62
+ ]
63
+ })
64
+ ]
65
+ }),
66
+ /* @__PURE__ */ jsxs("footer", {
67
+ className: "absolute bottom-4 left-0 right-0 text-center text-[0.78em] text-fawn",
68
+ children: ["dedicated to Baziu", /* @__PURE__ */ jsx(PawIcon, { className: "ml-1 inline-block h-3 w-3 align-[-1px] opacity-40" })]
69
+ })
70
+ ]
71
+ });
72
+ }
73
+ //#endregion
74
+ export { LoginPage as component };