@parallelworks/tandem-web 0.182.1 → 0.184.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 +23 -0
- package/_virtual/_virtual_i18n/es/common.js +23 -0
- package/_virtual/_virtual_i18n/ja/common.js +23 -0
- package/_virtual/_virtual_i18n/ko/common.js +23 -0
- package/_virtual/_virtual_i18n/zh/common.js +23 -0
- package/components/DocProperties.js +137 -114
- package/components/DocStart.js +116 -92
- package/components/DocTable.js +102 -100
- package/components/ProjectAccess.js +23 -20
- package/components/SubpageViews.js +477 -161
- package/components/icons.js +8 -8
- package/lib/cancelledLoads.js +7 -0
- package/lib/docProperties.js +6 -6
- package/lib/queryClient.js +7 -6
- package/lib/subpageViews.js +1 -0
- package/package.json +1 -1
- package/routes/_workspace/docs/space2._space.js +128 -128
- package/routes/_workspace/knowledge/_term2.js +83 -77
- package/routes/_workspace/teams/_key/settings2.js +94 -22
- package/routes/_workspace2.js +9 -9
- package/styles.css +1 -0
package/components/DocStart.js
CHANGED
|
@@ -5,19 +5,21 @@ import { isoDate as c } from "../lib/datePhrases.js";
|
|
|
5
5
|
import { docPath as l, useTemplateValues as u } from "../lib/docs.js";
|
|
6
6
|
import { modeBelow as d, runnerModeCommand as f, usePermissionModeName as p } from "../lib/permissionModes.js";
|
|
7
7
|
import { Link as m } from "../lib/router.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
8
|
+
import { subpageViewsQuery as h, useSubpageActions as g } from "../lib/subpageViews.js";
|
|
9
|
+
import { AgentIcon as _, CalendarIcon as v, FileTextIcon as y, FolderIcon as b, SpreadsheetIcon as x, UploadIcon as S } from "./icons.js";
|
|
10
|
+
import { useMarkdownTransfer as C } from "./MarkdownTransfer.js";
|
|
11
|
+
import { RunnerBadge as w } from "./RunnerBadge.js";
|
|
12
|
+
import { subpageLayouts as T } from "./SubpageViews.js";
|
|
13
|
+
import { ActionMenu as E, Button as D, ErrorText as O, Popover as k, RelativeTime as A, Select as j, Textarea as M, useClosePopover as N } from "@parallelworks/ui";
|
|
14
|
+
import { useEffect as P, useState as F } from "react";
|
|
15
|
+
import { useErrorMessage as I } from "@parallelworks/problem/react";
|
|
16
|
+
import { useFormatter as L, useTranslations as R } from "use-intl";
|
|
17
|
+
import { jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
18
|
+
import { useMutation as V, useQuery as H, useQueryClient as U } from "@tanstack/react-query";
|
|
17
19
|
// src/components/DocStart.tsx
|
|
18
|
-
function
|
|
19
|
-
let [n, r] =
|
|
20
|
-
return
|
|
20
|
+
function W(e, t) {
|
|
21
|
+
let [n, r] = F(e ? e.isEmpty : !t.trim());
|
|
22
|
+
return P(() => {
|
|
21
23
|
if (!e) return;
|
|
22
24
|
let t = () => r(e.isEmpty);
|
|
23
25
|
return t(), e.on("update", t), () => {
|
|
@@ -25,8 +27,8 @@ function B(e, t) {
|
|
|
25
27
|
};
|
|
26
28
|
}, [e]), n;
|
|
27
29
|
}
|
|
28
|
-
function
|
|
29
|
-
let s =
|
|
30
|
+
function G({ workspace: n, doc: i, team: a, editor: o }) {
|
|
31
|
+
let s = R("docStart"), l = R("docs"), d = L(), f = I(), p = U(), m = W(o, i.body ?? ""), { data: _ = [] } = H(r(n)), w = C(n), k = R("subpages"), A = g(n), { data: j = [] } = H(h(n, i.key)), M = u(), N = V({
|
|
30
32
|
mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
|
|
31
33
|
params: { path: {
|
|
32
34
|
workspace: n,
|
|
@@ -49,108 +51,130 @@ function V({ workspace: n, doc: i, team: a, editor: o }) {
|
|
|
49
51
|
"docs"
|
|
50
52
|
] })
|
|
51
53
|
});
|
|
52
|
-
if (!m) return null;
|
|
53
|
-
let
|
|
54
|
-
return /* @__PURE__ */
|
|
54
|
+
if (!m || j.length > 0) return null;
|
|
55
|
+
let P = !i.title.trim() || i.title === l("untitled"), F = /* @__PURE__ */ new Date(), G = _.filter((e) => e.starter || (e.teamId ?? "") === (i.teamId ?? "")).sort((e, t) => Number(e.starter) - Number(t.starter));
|
|
56
|
+
return /* @__PURE__ */ B("section", {
|
|
55
57
|
"aria-labelledby": "doc-start",
|
|
56
58
|
className: "mt-2",
|
|
57
59
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ z("h2", {
|
|
59
61
|
id: "doc-start",
|
|
60
62
|
className: "text-xs text-muted-foreground",
|
|
61
63
|
children: s("title")
|
|
62
64
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ B("div", {
|
|
64
66
|
className: "mt-2 flex flex-wrap items-center gap-2",
|
|
65
67
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ z(K, {
|
|
67
69
|
workspace: n,
|
|
68
70
|
doc: i,
|
|
69
71
|
team: a
|
|
70
72
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ B(D, {
|
|
72
74
|
size: "sm",
|
|
73
75
|
variant: "secondary",
|
|
74
|
-
disabled:
|
|
75
|
-
onClick: () =>
|
|
76
|
+
disabled: N.isPending,
|
|
77
|
+
onClick: () => N.mutate({
|
|
76
78
|
startFrom: "meeting-notes",
|
|
77
|
-
variables: { date: c(
|
|
78
|
-
...
|
|
79
|
+
variables: { date: c(F) },
|
|
80
|
+
...P && { title: s("meetingTitle", { date: d.dateTime(F, { dateStyle: "medium" }) }) }
|
|
79
81
|
}),
|
|
80
|
-
children: [/* @__PURE__ */
|
|
82
|
+
children: [/* @__PURE__ */ z(v, { className: "size-3.5" }), s("meetingNotes")]
|
|
81
83
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ z(E, {
|
|
85
|
+
label: s("database"),
|
|
86
|
+
items: T.filter((e) => e.database).map(({ layout: e, icon: t, message: n }) => ({
|
|
87
|
+
label: k(n),
|
|
88
|
+
icon: /* @__PURE__ */ z(t, {}),
|
|
89
|
+
onClick: () => A.addView.mutate({
|
|
90
|
+
doc: i.key,
|
|
91
|
+
name: k(n),
|
|
92
|
+
layout: e
|
|
93
|
+
})
|
|
94
|
+
})),
|
|
95
|
+
trigger: /* @__PURE__ */ B(D, {
|
|
96
|
+
size: "sm",
|
|
97
|
+
variant: "secondary",
|
|
98
|
+
disabled: A.addView.isPending,
|
|
99
|
+
children: [/* @__PURE__ */ z(x, { className: "size-3.5" }), s("database")]
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ z(E, {
|
|
83
103
|
label: s("templates"),
|
|
84
104
|
empty: s("noTemplates"),
|
|
85
|
-
items:
|
|
105
|
+
items: G.map((e) => ({
|
|
86
106
|
label: e.title,
|
|
87
|
-
onClick: () =>
|
|
107
|
+
onClick: () => N.mutate({
|
|
88
108
|
startFrom: e.id,
|
|
89
|
-
variables:
|
|
109
|
+
variables: M()
|
|
90
110
|
})
|
|
91
111
|
})),
|
|
92
|
-
trigger: /* @__PURE__ */
|
|
112
|
+
trigger: /* @__PURE__ */ B(D, {
|
|
93
113
|
size: "sm",
|
|
94
114
|
variant: "secondary",
|
|
95
|
-
disabled:
|
|
96
|
-
children: [/* @__PURE__ */
|
|
115
|
+
disabled: N.isPending,
|
|
116
|
+
children: [/* @__PURE__ */ z(y, { className: "size-3.5" }), s("templates")]
|
|
97
117
|
})
|
|
98
118
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ B(D, {
|
|
100
120
|
size: "sm",
|
|
101
121
|
variant: "secondary",
|
|
102
|
-
onClick: () =>
|
|
103
|
-
children: [/* @__PURE__ */
|
|
122
|
+
onClick: () => w.pick({ parent: i.key }),
|
|
123
|
+
children: [/* @__PURE__ */ z(S, { className: "size-3.5" }), s("importFiles")]
|
|
104
124
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ B(D, {
|
|
106
126
|
size: "sm",
|
|
107
127
|
variant: "secondary",
|
|
108
|
-
onClick: () =>
|
|
109
|
-
children: [/* @__PURE__ */
|
|
128
|
+
onClick: () => w.pick({ parent: i.key }, !0),
|
|
129
|
+
children: [/* @__PURE__ */ z(b, { className: "size-3.5" }), s("importFolder")]
|
|
110
130
|
})
|
|
111
131
|
]
|
|
112
132
|
}),
|
|
113
|
-
|
|
133
|
+
N.isError && /* @__PURE__ */ z(O, {
|
|
114
134
|
className: "mt-2",
|
|
115
|
-
children: f(
|
|
135
|
+
children: f(N.error)
|
|
116
136
|
}),
|
|
117
|
-
|
|
137
|
+
A.addView.isError && /* @__PURE__ */ z(O, {
|
|
138
|
+
className: "mt-2",
|
|
139
|
+
children: f(A.addView.error)
|
|
140
|
+
}),
|
|
141
|
+
w.dialog
|
|
118
142
|
]
|
|
119
143
|
});
|
|
120
144
|
}
|
|
121
|
-
function
|
|
122
|
-
let r =
|
|
123
|
-
return /* @__PURE__ */
|
|
145
|
+
function K({ workspace: e, doc: t, team: n }) {
|
|
146
|
+
let r = R("docStart");
|
|
147
|
+
return /* @__PURE__ */ z(k, {
|
|
124
148
|
title: r("askAgent"),
|
|
125
149
|
align: "start",
|
|
126
150
|
initialFocus: "first-control",
|
|
127
151
|
className: "w-96 max-w-[calc(100vw-2rem)]",
|
|
128
|
-
trigger: /* @__PURE__ */
|
|
152
|
+
trigger: /* @__PURE__ */ B(D, {
|
|
129
153
|
size: "sm",
|
|
130
154
|
variant: "secondary",
|
|
131
|
-
children: [/* @__PURE__ */
|
|
155
|
+
children: [/* @__PURE__ */ z(_, { className: "size-3.5" }), r("askAgent")]
|
|
132
156
|
}),
|
|
133
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ z(q, {
|
|
134
158
|
workspace: e,
|
|
135
159
|
doc: t,
|
|
136
160
|
team: n
|
|
137
161
|
})
|
|
138
162
|
});
|
|
139
163
|
}
|
|
140
|
-
function
|
|
141
|
-
let u =
|
|
164
|
+
function q({ workspace: r, doc: o, team: c }) {
|
|
165
|
+
let u = R("docStart"), m = I(), h = p(), g = N(), _ = U(), { data: v = [] } = H(n(r)), { data: y = [] } = H(i(r)), { data: b = [] } = H(a(r)), x = v.filter((e) => !e.archivedAt), [S, C] = F(x[0]?.slug ?? ""), [T, E] = F(c?.key ?? b.find((e) => !e.archivedAt)?.key ?? ""), [k, A] = F(""), P = x.find((e) => e.slug === S), L = P ? s(P, y).find((e) => e.online)?.runner : void 0, W = P && L?.permissionMode && d(L.permissionMode, P.permissionMode) ? L.permissionMode : void 0, G = V({
|
|
142
166
|
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/issues", {
|
|
143
167
|
params: { path: {
|
|
144
168
|
workspace: r,
|
|
145
|
-
key:
|
|
169
|
+
key: T
|
|
146
170
|
} },
|
|
147
171
|
body: {
|
|
148
172
|
title: u("issueTitle", { doc: o.title || u("thisDoc") }),
|
|
149
|
-
body: `${
|
|
173
|
+
body: `${k.trim()}\n\n${u("issueBody", { doc: `[${o.title || u("thisDoc")}](${l(r, o)})` })}`,
|
|
150
174
|
origin: { doc: o.key },
|
|
151
175
|
assignees: [{
|
|
152
176
|
kind: "agent",
|
|
153
|
-
handle:
|
|
177
|
+
handle: S
|
|
154
178
|
}]
|
|
155
179
|
}
|
|
156
180
|
})),
|
|
@@ -162,30 +186,30 @@ function U({ workspace: r, doc: o, team: c }) {
|
|
|
162
186
|
] }), g();
|
|
163
187
|
}
|
|
164
188
|
});
|
|
165
|
-
return
|
|
189
|
+
return x.length === 0 ? /* @__PURE__ */ z("p", {
|
|
166
190
|
className: "text-sm text-muted-foreground",
|
|
167
191
|
children: u("noAgents")
|
|
168
|
-
}) : /* @__PURE__ */
|
|
192
|
+
}) : /* @__PURE__ */ B("form", {
|
|
169
193
|
className: "space-y-3",
|
|
170
194
|
onSubmit: (e) => {
|
|
171
|
-
e.preventDefault(),
|
|
195
|
+
e.preventDefault(), k.trim() && S && T && G.mutate();
|
|
172
196
|
},
|
|
173
197
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ B("div", {
|
|
175
199
|
className: "flex gap-2",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
200
|
+
children: [/* @__PURE__ */ z(j, {
|
|
177
201
|
"aria-label": u("agent"),
|
|
178
|
-
value:
|
|
179
|
-
onValueChange: (e) => e &&
|
|
180
|
-
items:
|
|
202
|
+
value: S,
|
|
203
|
+
onValueChange: (e) => e && C(e),
|
|
204
|
+
items: x.map((e) => ({
|
|
181
205
|
value: e.slug,
|
|
182
206
|
label: e.name
|
|
183
207
|
})),
|
|
184
208
|
width: "fill"
|
|
185
|
-
}), !c && /* @__PURE__ */
|
|
209
|
+
}), !c && /* @__PURE__ */ z(j, {
|
|
186
210
|
"aria-label": u("team"),
|
|
187
|
-
value:
|
|
188
|
-
onValueChange: (e) => e &&
|
|
211
|
+
value: T,
|
|
212
|
+
onValueChange: (e) => e && E(e),
|
|
189
213
|
items: b.filter((e) => !e.archivedAt).map((e) => ({
|
|
190
214
|
value: e.key,
|
|
191
215
|
label: e.name
|
|
@@ -193,73 +217,73 @@ function U({ workspace: r, doc: o, team: c }) {
|
|
|
193
217
|
width: "fill"
|
|
194
218
|
})]
|
|
195
219
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ z(M, {
|
|
197
221
|
"aria-label": u("prompt"),
|
|
198
222
|
placeholder: u("promptPlaceholder"),
|
|
199
|
-
value:
|
|
200
|
-
onChange: (e) =>
|
|
223
|
+
value: k,
|
|
224
|
+
onChange: (e) => A(e.target.value),
|
|
201
225
|
onKeyDown: (e) => {
|
|
202
226
|
e.key === "Enter" && (e.metaKey || e.ctrlKey) && e.currentTarget.form?.requestSubmit();
|
|
203
227
|
},
|
|
204
228
|
rows: 4
|
|
205
229
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ B("div", {
|
|
207
231
|
className: "space-y-1 text-xs text-muted-foreground",
|
|
208
|
-
children: [
|
|
232
|
+
children: [L ? /* @__PURE__ */ z("p", {
|
|
209
233
|
className: "flex flex-wrap items-center gap-1",
|
|
210
|
-
children: u.rich("runsOn", { runner: () => /* @__PURE__ */
|
|
234
|
+
children: u.rich("runsOn", { runner: () => /* @__PURE__ */ z(w, {
|
|
211
235
|
workspace: r,
|
|
212
|
-
name:
|
|
213
|
-
kind:
|
|
236
|
+
name: L.name,
|
|
237
|
+
kind: L.kind
|
|
214
238
|
}) })
|
|
215
|
-
}) : /* @__PURE__ */
|
|
239
|
+
}) : /* @__PURE__ */ z("p", {
|
|
216
240
|
className: "text-warning",
|
|
217
241
|
children: u("noRunner")
|
|
218
|
-
}),
|
|
242
|
+
}), L && W && P && /* @__PURE__ */ z("p", {
|
|
219
243
|
className: "text-pretty",
|
|
220
244
|
children: u.rich("capped", {
|
|
221
|
-
runner:
|
|
245
|
+
runner: L.name,
|
|
222
246
|
got: h(W),
|
|
223
|
-
asked: h(
|
|
224
|
-
code: () => /* @__PURE__ */
|
|
247
|
+
asked: h(P.permissionMode),
|
|
248
|
+
code: () => /* @__PURE__ */ z("code", { children: f(P.permissionMode) })
|
|
225
249
|
})
|
|
226
250
|
})]
|
|
227
251
|
}),
|
|
228
|
-
G.isError && /* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
252
|
+
G.isError && /* @__PURE__ */ z(O, { children: m(G.error) }),
|
|
253
|
+
/* @__PURE__ */ z("div", {
|
|
230
254
|
className: "flex justify-end",
|
|
231
|
-
children: /* @__PURE__ */
|
|
255
|
+
children: /* @__PURE__ */ z(D, {
|
|
232
256
|
type: "submit",
|
|
233
257
|
size: "sm",
|
|
234
258
|
variant: "primary",
|
|
235
259
|
loading: G.isPending,
|
|
236
|
-
disabled: !
|
|
260
|
+
disabled: !k.trim() || !S || !T,
|
|
237
261
|
children: u("start")
|
|
238
262
|
})
|
|
239
263
|
})
|
|
240
264
|
]
|
|
241
265
|
});
|
|
242
266
|
}
|
|
243
|
-
function
|
|
244
|
-
let n =
|
|
267
|
+
function J({ workspace: e, doc: t }) {
|
|
268
|
+
let n = R("docStart"), r = R("agentWork.state"), { data: i = [] } = H(o(e, {
|
|
245
269
|
doc: t.key,
|
|
246
270
|
live: !0
|
|
247
271
|
}));
|
|
248
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
272
|
+
return i.length === 0 ? null : /* @__PURE__ */ z("ul", {
|
|
249
273
|
"aria-label": n("runs"),
|
|
250
274
|
className: "mt-3 space-y-1.5",
|
|
251
|
-
children: i.map((t) => /* @__PURE__ */
|
|
275
|
+
children: i.map((t) => /* @__PURE__ */ B("li", {
|
|
252
276
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg border border-agent/50 bg-card px-3 py-2 text-xs",
|
|
253
277
|
children: [
|
|
254
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ z("span", {
|
|
255
279
|
className: "font-medium",
|
|
256
280
|
children: t.agentName
|
|
257
281
|
}),
|
|
258
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ z("span", {
|
|
259
283
|
className: "text-muted-foreground",
|
|
260
284
|
children: r(t.state)
|
|
261
285
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ z(m, {
|
|
263
287
|
to: "/$workspace/issues/$identifier",
|
|
264
288
|
params: {
|
|
265
289
|
workspace: e,
|
|
@@ -268,15 +292,15 @@ function W({ workspace: e, doc: t }) {
|
|
|
268
292
|
className: "min-w-0 flex-1 truncate text-muted-foreground hover:text-foreground hover:underline",
|
|
269
293
|
children: t.identifier
|
|
270
294
|
}),
|
|
271
|
-
t.lastRunnerName ? /* @__PURE__ */
|
|
295
|
+
t.lastRunnerName ? /* @__PURE__ */ z(w, {
|
|
272
296
|
workspace: e,
|
|
273
297
|
name: t.lastRunnerName,
|
|
274
298
|
kind: t.runnerKind
|
|
275
|
-
}) : /* @__PURE__ */
|
|
299
|
+
}) : /* @__PURE__ */ z("span", {
|
|
276
300
|
className: "text-muted-foreground",
|
|
277
301
|
children: n("waitingForRunner")
|
|
278
302
|
}),
|
|
279
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ z(A, {
|
|
280
304
|
value: t.createdAt,
|
|
281
305
|
format: "compact",
|
|
282
306
|
className: "text-muted-foreground"
|
|
@@ -285,4 +309,4 @@ function W({ workspace: e, doc: t }) {
|
|
|
285
309
|
}, t.id))
|
|
286
310
|
});
|
|
287
311
|
}
|
|
288
|
-
export {
|
|
312
|
+
export { J as DocRuns, G as DocStart };
|