@parallelworks/tandem-web 0.178.1 → 0.179.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/_virtual/_virtual_i18n/en/common.js +3 -15
- package/_virtual/_virtual_i18n/es/common.js +3 -15
- package/_virtual/_virtual_i18n/ja/common.js +3 -15
- package/_virtual/_virtual_i18n/ko/common.js +3 -15
- package/_virtual/_virtual_i18n/zh/common.js +3 -15
- package/components/AgentWork.js +313 -308
- package/components/AreaWork.js +38 -43
- package/components/Graph.js +1 -1
- package/components/HoverCards.js +88 -111
- package/lib/knowledge.js +0 -6
- package/lib/permissionModes.js +7 -1
- package/package.json +1 -1
- package/routes/_workspace/agents/_slug2.js +202 -194
- package/routes/_workspace/graph.js +1 -5
- package/routes/_workspace/graph2.js +16 -17
- package/routes/_workspace/graph3.js +70 -82
- package/routes/_workspace/knowledge/_term2.js +126 -130
- package/routes/_workspace/knowledge/index2.js +125 -130
|
@@ -1,236 +1,231 @@
|
|
|
1
1
|
import { areasQuery as e, knowledgeQuery as t } from "../../../api/queries.js";
|
|
2
2
|
import { FavoriteStar as n } from "../../../components/FavoriteStar.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { useQuery as M, useSuspenseQuery as N } from "@tanstack/react-query";
|
|
3
|
+
import { AddIcon as r, LibraryIcon as i } from "../../../components/icons.js";
|
|
4
|
+
import { EntryDialog as a, useKnowledgeMenu as o } from "../../../lib/knowledge.js";
|
|
5
|
+
import { kinds as s, termRef as c } from "../../../lib/knowledgeKinds.js";
|
|
6
|
+
import { usePageTitle as l } from "../../../lib/pageTitle.js";
|
|
7
|
+
import { Link as u, useNavigate as d } from "../../../lib/router.js";
|
|
8
|
+
import { useTime as f } from "../../../lib/time.js";
|
|
9
|
+
import { Route as p } from "./index.js";
|
|
10
|
+
import { Button as m, EmptyState as h, SearchInput as g, SegmentedControl as _, Tooltip as v, buttonClasses as y, useOpenMenu as b } from "@parallelworks/ui";
|
|
11
|
+
import { Suspense as x, useCallback as S, useEffect as C, useMemo as w, useState as T } from "react";
|
|
12
|
+
import { useLocale as E, useTranslations as D } from "use-intl";
|
|
13
|
+
import { Fragment as ee, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
14
|
+
import { useQuery as A, useSuspenseQuery as j } from "@tanstack/react-query";
|
|
16
15
|
// src/routes/$workspace/knowledge/index.tsx?tsr-split=component
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
let { workspace:
|
|
20
|
-
|
|
21
|
-
let I =
|
|
22
|
-
|
|
23
|
-
let e = setTimeout(() =>
|
|
16
|
+
var M = 5, N = 8;
|
|
17
|
+
function P() {
|
|
18
|
+
let { workspace: o } = p.useParams(), { archived: f, kind: v = "all" } = p.useSearch(), b = D("knowledge"), P = E();
|
|
19
|
+
l(b("title"));
|
|
20
|
+
let I = d(), [L, R] = T(""), [z, B] = T(""), [V, H] = T(null);
|
|
21
|
+
C(() => {
|
|
22
|
+
let e = setTimeout(() => B(L.trim()), 200);
|
|
24
23
|
return () => clearTimeout(e);
|
|
25
|
-
}, [
|
|
26
|
-
let { data:
|
|
27
|
-
...
|
|
28
|
-
...
|
|
29
|
-
}, { data:
|
|
30
|
-
...t(
|
|
31
|
-
enabled: !!
|
|
32
|
-
}),
|
|
24
|
+
}, [L]);
|
|
25
|
+
let { data: U } = j(t(o)), { data: W = [] } = A(e(o)), G = {
|
|
26
|
+
...z && { q: z },
|
|
27
|
+
...f && { archived: !0 }
|
|
28
|
+
}, { data: K } = A({
|
|
29
|
+
...t(o, G),
|
|
30
|
+
enabled: !!z || !!f
|
|
31
|
+
}), q = !!z || !!f, J = q ? K ?? [] : U, Y = v === "all" ? J : J.filter((e) => e.kind === v), X = S((e) => H(e), []), Z = w(() => {
|
|
33
32
|
let e = /* @__PURE__ */ new Map();
|
|
34
|
-
for (let t of
|
|
33
|
+
for (let t of J) e.set(t.kind, (e.get(t.kind) ?? 0) + 1);
|
|
35
34
|
return e;
|
|
36
|
-
}, [
|
|
37
|
-
let e = new Intl.Collator(
|
|
38
|
-
for (let e of
|
|
39
|
-
let n =
|
|
35
|
+
}, [J]), Q = w(() => [...Y].sort((e, t) => t.updatedAt.localeCompare(e.updatedAt)).slice(0, M), [Y]), te = w(() => {
|
|
36
|
+
let e = new Intl.Collator(P, { sensitivity: "base" }), t = /* @__PURE__ */ new Map();
|
|
37
|
+
for (let e of Y) {
|
|
38
|
+
let n = W.some((t) => t.id === e.areaId) ? e.areaId : "";
|
|
40
39
|
t.set(n, [...t.get(n) ?? [], e]);
|
|
41
40
|
}
|
|
42
41
|
return [...t].map(([t, n]) => ({
|
|
43
42
|
id: t,
|
|
44
|
-
title:
|
|
43
|
+
title: W.find((e) => e.id === t)?.title ?? b("general"),
|
|
45
44
|
entries: n.sort((t, n) => e.compare(t.name, n.name))
|
|
46
45
|
})).sort((t, n) => t.id ? n.id ? e.compare(t.title, n.title) : -1 : 1);
|
|
47
46
|
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
Y,
|
|
48
|
+
W,
|
|
49
|
+
P,
|
|
50
|
+
b
|
|
52
51
|
]), ne = (e) => I({
|
|
53
52
|
to: "/$workspace/knowledge",
|
|
54
|
-
params: { workspace:
|
|
53
|
+
params: { workspace: o },
|
|
55
54
|
search: {
|
|
56
|
-
...
|
|
55
|
+
...f && { archived: f },
|
|
57
56
|
...e !== "all" && { kind: e }
|
|
58
57
|
},
|
|
59
58
|
replace: !0
|
|
60
|
-
}), $ =
|
|
61
|
-
return /* @__PURE__ */
|
|
59
|
+
}), $ = s.filter((e) => Z.has(e) || e === v);
|
|
60
|
+
return /* @__PURE__ */ k("div", {
|
|
62
61
|
className: "flex h-full flex-col",
|
|
63
62
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ k("header", {
|
|
65
64
|
className: "flex h-12 shrink-0 items-center gap-3 border-b border-border px-4 md:px-5",
|
|
66
65
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ O("h1", {
|
|
68
67
|
className: "min-w-0 truncate text-sm font-semibold",
|
|
69
|
-
children:
|
|
68
|
+
children: b("title")
|
|
70
69
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
workspace:
|
|
70
|
+
/* @__PURE__ */ O(n, {
|
|
71
|
+
workspace: o,
|
|
73
72
|
kind: "page",
|
|
74
73
|
target: "knowledge"
|
|
75
74
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ O("span", {
|
|
77
76
|
className: "whitespace-nowrap text-xs text-muted-foreground tabular-nums",
|
|
78
|
-
children:
|
|
77
|
+
children: b("count", { count: U.length })
|
|
79
78
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ O(u, {
|
|
81
80
|
to: "/$workspace/graph",
|
|
82
|
-
params: { workspace:
|
|
83
|
-
className: `${
|
|
84
|
-
children:
|
|
81
|
+
params: { workspace: o },
|
|
82
|
+
className: `${y({ size: "sm" })} ml-auto`,
|
|
83
|
+
children: b("graph")
|
|
85
84
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ k(m, {
|
|
87
86
|
type: "button",
|
|
88
87
|
variant: "primary",
|
|
89
88
|
size: "sm",
|
|
90
|
-
onClick: () =>
|
|
91
|
-
children: [/* @__PURE__ */
|
|
89
|
+
onClick: () => X({ kind: "create" }),
|
|
90
|
+
children: [/* @__PURE__ */ O(r, { className: "size-3.5" }), /* @__PURE__ */ O("span", {
|
|
92
91
|
className: "max-md:sr-only",
|
|
93
|
-
children:
|
|
92
|
+
children: b("new")
|
|
94
93
|
})]
|
|
95
94
|
})
|
|
96
95
|
]
|
|
97
96
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ O("div", {
|
|
99
98
|
className: "min-h-0 flex-1 overflow-y-auto",
|
|
100
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ k("div", {
|
|
101
100
|
className: "mx-auto w-full max-w-3xl px-4 pt-8 pb-16 md:px-8",
|
|
102
101
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
value:
|
|
105
|
-
onValueChange:
|
|
106
|
-
label:
|
|
102
|
+
/* @__PURE__ */ O(g, {
|
|
103
|
+
value: L,
|
|
104
|
+
onValueChange: R,
|
|
105
|
+
label: b("search"),
|
|
107
106
|
size: "lg",
|
|
108
107
|
className: "w-full"
|
|
109
108
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ k("div", {
|
|
111
110
|
className: "mt-4 flex flex-wrap items-center gap-2",
|
|
112
|
-
children: [$.length > 1 && /* @__PURE__ */
|
|
113
|
-
label:
|
|
111
|
+
children: [$.length > 1 && /* @__PURE__ */ O(_, {
|
|
112
|
+
label: b("kindLabel"),
|
|
114
113
|
size: "sm",
|
|
115
|
-
value:
|
|
114
|
+
value: v,
|
|
116
115
|
onValueChange: ne,
|
|
117
116
|
options: [{
|
|
118
117
|
value: "all",
|
|
119
|
-
label:
|
|
120
|
-
count:
|
|
118
|
+
label: b("allKinds"),
|
|
119
|
+
count: J.length
|
|
121
120
|
}, ...$.map((e) => ({
|
|
122
121
|
value: e,
|
|
123
|
-
label:
|
|
124
|
-
count:
|
|
122
|
+
label: b(`kinds.${e}`),
|
|
123
|
+
count: Z.get(e) ?? 0
|
|
125
124
|
}))]
|
|
126
|
-
}), /* @__PURE__ */
|
|
125
|
+
}), /* @__PURE__ */ O(u, {
|
|
127
126
|
to: "/$workspace/knowledge",
|
|
128
|
-
params: { workspace:
|
|
127
|
+
params: { workspace: o },
|
|
129
128
|
search: {
|
|
130
|
-
...!
|
|
131
|
-
...
|
|
129
|
+
...!f && { archived: !0 },
|
|
130
|
+
...v !== "all" && { kind: v }
|
|
132
131
|
},
|
|
133
|
-
"aria-current":
|
|
134
|
-
className: `${
|
|
132
|
+
"aria-current": f || void 0,
|
|
133
|
+
className: `${y({
|
|
135
134
|
size: "sm",
|
|
136
|
-
variant:
|
|
135
|
+
variant: f ? "secondary" : "ghost"
|
|
137
136
|
})} ml-auto`,
|
|
138
|
-
children:
|
|
137
|
+
children: b("archived")
|
|
139
138
|
})]
|
|
140
139
|
}),
|
|
141
|
-
|
|
142
|
-
icon: /* @__PURE__ */
|
|
143
|
-
title:
|
|
144
|
-
description:
|
|
145
|
-
action: !
|
|
140
|
+
Y.length === 0 ? /* @__PURE__ */ O(h, {
|
|
141
|
+
icon: /* @__PURE__ */ O(i, {}),
|
|
142
|
+
title: b(q || v !== "all" ? "noMatches" : "emptyTitle"),
|
|
143
|
+
description: q || v !== "all" ? void 0 : b("empty"),
|
|
144
|
+
action: !q && v === "all" ? /* @__PURE__ */ O(m, {
|
|
146
145
|
type: "button",
|
|
147
146
|
variant: "primary",
|
|
148
|
-
onClick: () =>
|
|
149
|
-
children:
|
|
147
|
+
onClick: () => X({ kind: "create" }),
|
|
148
|
+
children: b("new")
|
|
150
149
|
}) : void 0,
|
|
151
150
|
className: "mt-16"
|
|
152
|
-
}) :
|
|
153
|
-
workspace:
|
|
154
|
-
title:
|
|
155
|
-
entries:
|
|
156
|
-
onOpen:
|
|
157
|
-
}) : /* @__PURE__ */
|
|
158
|
-
workspace:
|
|
159
|
-
title:
|
|
160
|
-
entries:
|
|
161
|
-
onOpen:
|
|
151
|
+
}) : q ? /* @__PURE__ */ O(F, {
|
|
152
|
+
workspace: o,
|
|
153
|
+
title: b("results"),
|
|
154
|
+
entries: Y,
|
|
155
|
+
onOpen: X
|
|
156
|
+
}) : /* @__PURE__ */ k(ee, { children: [Y.length >= N && /* @__PURE__ */ O(F, {
|
|
157
|
+
workspace: o,
|
|
158
|
+
title: b("recent"),
|
|
159
|
+
entries: Q,
|
|
160
|
+
onOpen: X,
|
|
162
161
|
showTime: !0
|
|
163
|
-
}), te.map((e) => /* @__PURE__ */
|
|
164
|
-
workspace:
|
|
162
|
+
}), te.map((e) => /* @__PURE__ */ O(F, {
|
|
163
|
+
workspace: o,
|
|
165
164
|
title: e.title,
|
|
166
165
|
entries: e.entries,
|
|
167
|
-
onOpen:
|
|
166
|
+
onOpen: X
|
|
168
167
|
}, e.id || "general"))] })
|
|
169
168
|
]
|
|
170
169
|
})
|
|
171
170
|
}),
|
|
172
|
-
|
|
173
|
-
workspace:
|
|
174
|
-
mode:
|
|
175
|
-
onClose: () =>
|
|
171
|
+
V && /* @__PURE__ */ O(x, { children: /* @__PURE__ */ O(a, {
|
|
172
|
+
workspace: o,
|
|
173
|
+
mode: V,
|
|
174
|
+
onClose: () => H(null),
|
|
176
175
|
onSaved: (e) => I({
|
|
177
176
|
to: "/$workspace/knowledge/$term",
|
|
178
177
|
params: {
|
|
179
|
-
workspace:
|
|
180
|
-
term:
|
|
178
|
+
workspace: o,
|
|
179
|
+
term: c(e)
|
|
181
180
|
}
|
|
182
181
|
})
|
|
183
182
|
}) })
|
|
184
183
|
]
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
|
-
function
|
|
188
|
-
let
|
|
189
|
-
return /* @__PURE__ */
|
|
186
|
+
function F({ workspace: e, title: t, entries: n, onOpen: r, showTime: i = !1 }) {
|
|
187
|
+
let a = D("knowledge"), s = b(), l = o(e, r), d = f();
|
|
188
|
+
return /* @__PURE__ */ k("section", {
|
|
190
189
|
"aria-label": t,
|
|
191
190
|
className: "mt-10",
|
|
192
|
-
children: [/* @__PURE__ */
|
|
191
|
+
children: [/* @__PURE__ */ k("h2", {
|
|
193
192
|
className: "flex items-baseline gap-2 text-base font-semibold",
|
|
194
|
-
children: [t, /* @__PURE__ */
|
|
193
|
+
children: [t, /* @__PURE__ */ O("span", {
|
|
195
194
|
className: "text-xs font-normal text-muted-foreground tabular-nums",
|
|
196
195
|
children: n.length
|
|
197
196
|
})]
|
|
198
|
-
}), /* @__PURE__ */
|
|
197
|
+
}), /* @__PURE__ */ O("ul", {
|
|
199
198
|
className: "mt-3 divide-y divide-border overflow-hidden rounded-xl border border-border bg-card",
|
|
200
|
-
children: n.map((t) => /* @__PURE__ */
|
|
199
|
+
children: n.map((t) => /* @__PURE__ */ O("li", { children: /* @__PURE__ */ k(u, {
|
|
201
200
|
to: "/$workspace/knowledge/$term",
|
|
202
201
|
params: {
|
|
203
202
|
workspace: e,
|
|
204
|
-
term:
|
|
203
|
+
term: c(t)
|
|
205
204
|
},
|
|
206
|
-
onContextMenu: (e) =>
|
|
205
|
+
onContextMenu: (e) => s(e, l(t)),
|
|
207
206
|
className: "group flex flex-col gap-1 px-4 py-3 sm:flex-row sm:items-start sm:gap-3 transition-colors duration-150 hover:bg-muted focus-visible:outline-offset-[-2px]",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ k("span", {
|
|
209
208
|
className: "min-w-0 flex-1",
|
|
210
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ O("span", {
|
|
211
210
|
className: `block truncate text-sm font-medium ${t.status === "superseded" ? "text-muted-foreground line-through" : ""}`,
|
|
212
211
|
children: t.name
|
|
213
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ O("span", {
|
|
214
213
|
className: "mt-0.5 line-clamp-2 text-xs leading-5 text-muted-foreground",
|
|
215
214
|
children: t.definition
|
|
216
215
|
})]
|
|
217
|
-
}), (t.kind !== "term" ||
|
|
216
|
+
}), (t.kind !== "term" || i) && /* @__PURE__ */ k("span", {
|
|
218
217
|
className: "flex items-center gap-2 text-xs text-muted-foreground sm:shrink-0 sm:pt-0.5",
|
|
219
|
-
children: [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
children:
|
|
225
|
-
dateTime: t.updatedAt,
|
|
226
|
-
className: "tabular-nums",
|
|
227
|
-
children: f.relative(t.updatedAt)
|
|
228
|
-
})
|
|
218
|
+
children: [t.kind !== "term" && /* @__PURE__ */ O("span", { children: a(`kind.${t.kind}`) }), i && /* @__PURE__ */ O(v, {
|
|
219
|
+
content: d.full(t.updatedAt),
|
|
220
|
+
children: /* @__PURE__ */ O("time", {
|
|
221
|
+
dateTime: t.updatedAt,
|
|
222
|
+
className: "tabular-nums",
|
|
223
|
+
children: d.relative(t.updatedAt)
|
|
229
224
|
})
|
|
230
|
-
]
|
|
225
|
+
})]
|
|
231
226
|
})]
|
|
232
227
|
}) }, t.id))
|
|
233
228
|
})]
|
|
234
229
|
});
|
|
235
230
|
}
|
|
236
|
-
export {
|
|
231
|
+
export { P as component };
|