@burdenoff/microfe-theculturepost 2026.1201.1 → 2026.1202.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.
- package/dist/theculturepost/components/AiContextPanel.d.ts +11 -5
- package/dist/theculturepost/components/AiContextPanel.js +184 -162
- package/dist/theculturepost/components/AiContextPanel.js.map +1 -1
- package/dist/theculturepost/components/index.d.ts +1 -1
- package/dist/theculturepost/pages/archive/ArchivePage.js +128 -119
- package/dist/theculturepost/pages/archive/ArchivePage.js.map +1 -1
- package/dist/theculturepost/utils/aiContextPermissions.d.ts +32 -0
- package/dist/theculturepost/utils/aiContextPermissions.js +21 -0
- package/dist/theculturepost/utils/aiContextPermissions.js.map +1 -0
- package/package.json +1 -1
|
@@ -9,12 +9,18 @@ export interface GenerateAiContextDialogProps {
|
|
|
9
9
|
storyId?: string;
|
|
10
10
|
collectionId?: string;
|
|
11
11
|
oralHistoryId?: string;
|
|
12
|
+
/** Whether the caller holds `theculturepost-ai-context:update` to review inline. */
|
|
13
|
+
canReview?: boolean;
|
|
12
14
|
onGenerated?: (run: TcpAgentRun) => void;
|
|
13
15
|
}
|
|
14
|
-
export declare function GenerateAiContextDialog({ open, onOpenChange, useCase, storyId, collectionId, oralHistoryId, onGenerated, }: GenerateAiContextDialogProps): import('react').JSX.Element;
|
|
15
|
-
export
|
|
16
|
+
export declare function GenerateAiContextDialog({ open, onOpenChange, useCase, storyId, collectionId, oralHistoryId, canReview, onGenerated, }: GenerateAiContextDialogProps): import('react').JSX.Element;
|
|
17
|
+
export interface AiRunCardProps {
|
|
16
18
|
run: TcpAgentRun;
|
|
17
|
-
|
|
19
|
+
canReview?: boolean;
|
|
20
|
+
defaultExpanded?: boolean;
|
|
21
|
+
onReviewed?: (updated: TcpAgentRun) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function AiRunCard({ run, canReview, defaultExpanded, onReviewed, }: AiRunCardProps): import('react').JSX.Element;
|
|
18
24
|
export interface AiContextSectionProps {
|
|
19
25
|
/** Story-scoped use cases (SUMMARIZE_EVIDENCE, DRAFT_FRAMING_PROMPT). */
|
|
20
26
|
storyId?: string;
|
|
@@ -28,7 +34,7 @@ export interface AiContextSectionProps {
|
|
|
28
34
|
description?: string;
|
|
29
35
|
className?: string;
|
|
30
36
|
}
|
|
31
|
-
export declare function AiContextSection({ storyId, collectionId, oralHistoryId, useCases, title, description, className, }: AiContextSectionProps): import('react').JSX.Element;
|
|
37
|
+
export declare function AiContextSection({ storyId, collectionId, oralHistoryId, useCases, title, description, className, }: AiContextSectionProps): import('react').JSX.Element | null;
|
|
32
38
|
export declare function AiReviewQueue({ className }: {
|
|
33
39
|
className?: string;
|
|
34
|
-
}): import('react').JSX.Element;
|
|
40
|
+
}): import('react').JSX.Element | null;
|
|
@@ -1,213 +1,222 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useTheCulturePost as e } from "../context/TheCulturePostContext.js";
|
|
2
|
+
import { StatusBadge as t } from "./StatusBadge.js";
|
|
3
|
+
import { EmptyState as n } from "./EmptyState.js";
|
|
4
|
+
import { ErrorView as r, LoadingView as i } from "./StateViews.js";
|
|
5
|
+
import "../context/index.js";
|
|
6
|
+
import { useTcpAiContextRuns as a, useTcpGenerateAiContext as o, useTcpReviewAiContext as s } from "../hooks/useTcpApi.js";
|
|
5
7
|
import "../hooks/index.js";
|
|
6
|
-
import { describeError as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { describeError as c, notify as l } from "../lib/toast.js";
|
|
9
|
+
import { isReviewableAiRun as u, resolveAiContextPermissions as d } from "../utils/aiContextPermissions.js";
|
|
10
|
+
import { formatEnumLabel as f, formatRelativeTime as p } from "../utils/formatters.js";
|
|
11
|
+
import { useState as m } from "react";
|
|
12
|
+
import { FeatureGate as h } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
13
|
+
import { Check as g, Sparkles as _, X as v } from "lucide-react";
|
|
14
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
15
|
+
import { Button as S, GlassCard as C, Label as w, ResponsiveDialog as T, ResponsiveDialogContent as E, ResponsiveDialogDescription as D, ResponsiveDialogFooter as O, ResponsiveDialogHeader as k, ResponsiveDialogTitle as A, Textarea as j } from "@burdenoff/fe-libs/ui";
|
|
16
|
+
import { useSafePermissions as M } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
13
17
|
// src/theculturepost/components/AiContextPanel.tsx
|
|
14
|
-
var
|
|
18
|
+
var N = {
|
|
15
19
|
SUMMARIZE_EVIDENCE: "Summarise evidence",
|
|
16
20
|
DRAFT_FRAMING_PROMPT: "Draft framing",
|
|
17
21
|
SUGGEST_RELATED_TRADITIONS: "Find related traditions",
|
|
18
22
|
TRANSCRIBE_ORAL_HISTORY: "Clean up transcript"
|
|
19
|
-
},
|
|
23
|
+
}, P = {
|
|
20
24
|
SUMMARIZE_EVIDENCE: "What do the cited sources say about this story’s central claims?",
|
|
21
25
|
DRAFT_FRAMING_PROMPT: "Draft a short framing question that an editor could put to the cited sources.",
|
|
22
26
|
SUGGEST_RELATED_TRADITIONS: "Which traditions or practices in this collection relate to each other, and why?",
|
|
23
27
|
TRANSCRIBE_ORAL_HISTORY: "Clean up and format this transcript: fix punctuation and paragraph breaks, and mark speaker turns — do not add any content that is not in the original."
|
|
24
|
-
},
|
|
28
|
+
}, F = {
|
|
25
29
|
CITATION: "Citation",
|
|
26
30
|
ARCHIVE_ITEM: "Artifact",
|
|
27
31
|
ORAL_HISTORY: "Oral history"
|
|
28
|
-
}
|
|
29
|
-
function
|
|
30
|
-
let
|
|
31
|
-
e || (p(
|
|
32
|
-
}
|
|
33
|
-
|
|
32
|
+
};
|
|
33
|
+
function I({ open: e, onOpenChange: t, useCase: n, storyId: r, collectionId: i, oralHistoryId: a, canReview: s = !0, onGenerated: u }) {
|
|
34
|
+
let d = o(), [f, p] = m(() => P[n]), [h, g] = m(null), v = (e) => {
|
|
35
|
+
e || (p(P[n]), g(null), d.reset()), t(e);
|
|
36
|
+
}, C = async () => {
|
|
37
|
+
let e = {
|
|
38
|
+
useCase: n,
|
|
39
|
+
prompt: f.trim(),
|
|
40
|
+
storyId: r ?? null,
|
|
41
|
+
collectionId: i ?? null,
|
|
42
|
+
oralHistoryId: a ?? null
|
|
43
|
+
};
|
|
44
|
+
try {
|
|
45
|
+
let t = await d.mutateAsync(e);
|
|
46
|
+
g(t), u?.(t);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
l.error("Generation failed", c(e));
|
|
49
|
+
}
|
|
50
|
+
}, M = h?.reviewStatus === "APPROVED" ? "Run approved — recorded in the editorial log." : h?.reviewStatus === "REJECTED" ? "Run rejected — kept on record." : "Run created — it is awaiting editorial review.";
|
|
51
|
+
return /* @__PURE__ */ b(T, {
|
|
34
52
|
open: e,
|
|
35
|
-
onOpenChange:
|
|
36
|
-
children: /* @__PURE__ */
|
|
53
|
+
onOpenChange: v,
|
|
54
|
+
children: /* @__PURE__ */ x(E, {
|
|
37
55
|
className: "sm:max-w-xl",
|
|
38
56
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
h ? /* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ x(k, { children: [/* @__PURE__ */ b(A, { children: N[n] }), /* @__PURE__ */ b(D, { children: "Runs on this product’s AI answer only from sources you can read (PUBLIC/COMMUNITY). Every run starts as pending editorial review — nothing is adopted automatically." })] }),
|
|
58
|
+
h ? /* @__PURE__ */ x("div", {
|
|
41
59
|
className: "flex flex-col gap-4",
|
|
42
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ b("p", {
|
|
43
61
|
className: "text-sm text-text-secondary",
|
|
44
|
-
children:
|
|
45
|
-
}), /* @__PURE__ */
|
|
46
|
-
|
|
62
|
+
children: M
|
|
63
|
+
}), /* @__PURE__ */ b(R, {
|
|
64
|
+
run: h,
|
|
65
|
+
canReview: s,
|
|
66
|
+
defaultExpanded: !0,
|
|
67
|
+
onReviewed: g
|
|
68
|
+
})]
|
|
69
|
+
}) : /* @__PURE__ */ x("div", {
|
|
47
70
|
className: "flex flex-col gap-2",
|
|
48
71
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ b(w, {
|
|
50
73
|
htmlFor: "ai-context-prompt",
|
|
51
74
|
children: "Your question or instruction"
|
|
52
75
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ b(j, {
|
|
54
77
|
id: "ai-context-prompt",
|
|
55
78
|
value: f,
|
|
56
79
|
onChange: (e) => p(e.target.value),
|
|
57
80
|
rows: 4,
|
|
58
|
-
disabled:
|
|
81
|
+
disabled: d.isPending
|
|
59
82
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ b("p", {
|
|
61
84
|
className: "text-xs text-text-tertiary",
|
|
62
85
|
children: "Combined server-side with the grounded sources — never sent to the model alone."
|
|
63
86
|
})
|
|
64
87
|
]
|
|
65
88
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
onClick: () =>
|
|
89
|
+
/* @__PURE__ */ b(O, { children: h ? /* @__PURE__ */ b(S, {
|
|
90
|
+
onClick: () => v(!1),
|
|
68
91
|
children: "Done"
|
|
69
|
-
}) : /* @__PURE__ */
|
|
92
|
+
}) : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(S, {
|
|
70
93
|
variant: "outline",
|
|
71
|
-
onClick: () =>
|
|
72
|
-
disabled:
|
|
94
|
+
onClick: () => v(!1),
|
|
95
|
+
disabled: d.isPending,
|
|
73
96
|
children: "Cancel"
|
|
74
|
-
}), /* @__PURE__ */
|
|
75
|
-
onClick:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
prompt: f.trim(),
|
|
79
|
-
storyId: r ?? null,
|
|
80
|
-
collectionId: i ?? null,
|
|
81
|
-
oralHistoryId: o ?? null
|
|
82
|
-
};
|
|
83
|
-
try {
|
|
84
|
-
let t = await u.mutateAsync(e);
|
|
85
|
-
b(t), l?.(t);
|
|
86
|
-
} catch (e) {
|
|
87
|
-
c.error("Generation failed", s(e));
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
disabled: u.isPending || !f.trim(),
|
|
91
|
-
children: [/* @__PURE__ */ _(m, {
|
|
97
|
+
}), /* @__PURE__ */ x(S, {
|
|
98
|
+
onClick: C,
|
|
99
|
+
disabled: d.isPending || !f.trim(),
|
|
100
|
+
children: [/* @__PURE__ */ b(_, {
|
|
92
101
|
className: "mr-1.5 h-4 w-4",
|
|
93
102
|
"aria-hidden": "true"
|
|
94
|
-
}),
|
|
103
|
+
}), d.isPending ? "Generating…" : "Generate"]
|
|
95
104
|
})] }) })
|
|
96
105
|
]
|
|
97
106
|
})
|
|
98
107
|
});
|
|
99
108
|
}
|
|
100
|
-
var
|
|
109
|
+
var L = {
|
|
101
110
|
LOW: "success",
|
|
102
111
|
MEDIUM: "warning",
|
|
103
112
|
HIGH: "destructive"
|
|
104
113
|
};
|
|
105
|
-
function
|
|
106
|
-
let
|
|
114
|
+
function R({ run: e, canReview: n = !0, defaultExpanded: r = !1, onReviewed: i }) {
|
|
115
|
+
let a = s(), [o, d] = m(""), [h, _] = m(r), y = async (t) => {
|
|
107
116
|
try {
|
|
108
|
-
await
|
|
109
|
-
id:
|
|
110
|
-
approved:
|
|
111
|
-
reviewNotes:
|
|
112
|
-
})
|
|
117
|
+
let n = await a.mutateAsync({
|
|
118
|
+
id: e.id,
|
|
119
|
+
approved: t,
|
|
120
|
+
reviewNotes: o.trim() || void 0
|
|
121
|
+
});
|
|
122
|
+
i?.(n), l.success(t ? "AI answer approved" : "AI answer rejected", t ? "It is now marked as reviewed." : "The run stays on record as rejected.");
|
|
113
123
|
} catch (e) {
|
|
114
|
-
|
|
124
|
+
l.error("Review failed", c(e));
|
|
115
125
|
}
|
|
116
126
|
};
|
|
117
|
-
return /* @__PURE__ */
|
|
127
|
+
return /* @__PURE__ */ x(C, {
|
|
118
128
|
treatment: "plain",
|
|
119
129
|
className: "flex flex-col gap-3 p-4",
|
|
120
130
|
children: [
|
|
121
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ x("div", {
|
|
122
132
|
className: "flex flex-wrap items-center gap-1.5",
|
|
123
133
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
children: ["Uncertainty: ", l(t.uncertainty)]
|
|
134
|
+
/* @__PURE__ */ b(t, { status: e.useCase }),
|
|
135
|
+
e.status === "FAILED" ? /* @__PURE__ */ b(t, { status: "FAILED" }) : /* @__PURE__ */ b(t, { status: e.reviewStatus }),
|
|
136
|
+
e.uncertainty && /* @__PURE__ */ x("span", {
|
|
137
|
+
className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${L[e.uncertainty] === "success" ? "bg-status-success-bg-subtle text-status-success-text" : L[e.uncertainty] === "destructive" ? "bg-status-error-bg-subtle text-status-error-text" : "bg-status-warning-bg-subtle text-status-warning-text"}`,
|
|
138
|
+
children: ["Uncertainty: ", f(e.uncertainty)]
|
|
130
139
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ b("span", {
|
|
132
141
|
className: "ml-auto text-xs text-text-tertiary",
|
|
133
|
-
children:
|
|
142
|
+
children: p(e.createdAt)
|
|
134
143
|
})
|
|
135
144
|
]
|
|
136
145
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ x("p", {
|
|
138
147
|
className: "text-sm text-text-secondary",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ b("span", {
|
|
140
149
|
className: "font-medium text-text-primary",
|
|
141
150
|
children: "Prompt: "
|
|
142
|
-
}),
|
|
151
|
+
}), e.promptSummary]
|
|
143
152
|
}),
|
|
144
|
-
|
|
153
|
+
e.error && /* @__PURE__ */ b("p", {
|
|
145
154
|
className: "rounded-lg bg-status-error-bg-subtle p-2 text-xs text-status-error-text",
|
|
146
|
-
children:
|
|
155
|
+
children: e.error
|
|
147
156
|
}),
|
|
148
|
-
|
|
157
|
+
e.content && /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("button", {
|
|
149
158
|
type: "button",
|
|
150
|
-
onClick: () =>
|
|
159
|
+
onClick: () => _((e) => !e),
|
|
151
160
|
className: "text-xs font-medium text-text-secondary underline-offset-2 hover:underline",
|
|
152
|
-
children:
|
|
153
|
-
}),
|
|
161
|
+
children: h ? "Hide answer" : "Show answer"
|
|
162
|
+
}), h && /* @__PURE__ */ b("p", {
|
|
154
163
|
className: "mt-2 whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm text-text-primary",
|
|
155
|
-
children:
|
|
164
|
+
children: e.content
|
|
156
165
|
})] }),
|
|
157
|
-
|
|
166
|
+
e.groundingRefs.length > 0 && /* @__PURE__ */ x("div", {
|
|
158
167
|
className: "flex flex-col gap-1.5",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
168
|
+
children: [/* @__PURE__ */ x("p", {
|
|
160
169
|
className: "text-xs font-medium text-text-tertiary",
|
|
161
170
|
children: [
|
|
162
171
|
"Grounded in (",
|
|
163
|
-
|
|
172
|
+
e.groundingRefs.length,
|
|
164
173
|
" sources)"
|
|
165
174
|
]
|
|
166
|
-
}), /* @__PURE__ */
|
|
175
|
+
}), /* @__PURE__ */ b("ul", {
|
|
167
176
|
className: "flex flex-wrap gap-1.5",
|
|
168
|
-
children:
|
|
177
|
+
children: e.groundingRefs.map((e) => /* @__PURE__ */ x("li", {
|
|
169
178
|
className: "inline-flex max-w-full items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
|
|
170
179
|
title: e.title,
|
|
171
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ b("span", {
|
|
172
181
|
className: "shrink-0 font-medium",
|
|
173
|
-
children:
|
|
174
|
-
}), /* @__PURE__ */
|
|
182
|
+
children: F[e.kind] ?? f(e.kind)
|
|
183
|
+
}), /* @__PURE__ */ b("span", {
|
|
175
184
|
className: "truncate",
|
|
176
185
|
children: e.title
|
|
177
186
|
})]
|
|
178
187
|
}, `${e.kind}-${e.refId}`))
|
|
179
188
|
})]
|
|
180
189
|
}),
|
|
181
|
-
|
|
190
|
+
e.reviewStatus !== "PENDING" && (e.reviewNotes || e.reviewedAt) && /* @__PURE__ */ x("p", {
|
|
182
191
|
className: "text-xs text-text-tertiary",
|
|
183
|
-
children: [
|
|
192
|
+
children: [e.reviewStatus === "APPROVED" ? "Approved" : "Rejected", e.reviewNotes ? ` — ${e.reviewNotes}` : ""]
|
|
184
193
|
}),
|
|
185
|
-
|
|
194
|
+
n && u(e) && /* @__PURE__ */ x("div", {
|
|
186
195
|
className: "flex flex-col gap-2 border-t border-border-seam pt-3",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
188
|
-
value:
|
|
189
|
-
onChange: (e) =>
|
|
196
|
+
children: [/* @__PURE__ */ b(j, {
|
|
197
|
+
value: o,
|
|
198
|
+
onChange: (e) => d(e.target.value),
|
|
190
199
|
rows: 2,
|
|
191
200
|
placeholder: "Review notes (optional)",
|
|
192
|
-
disabled:
|
|
193
|
-
}), /* @__PURE__ */
|
|
201
|
+
disabled: a.isPending
|
|
202
|
+
}), /* @__PURE__ */ x("div", {
|
|
194
203
|
className: "flex gap-2",
|
|
195
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ x(S, {
|
|
196
205
|
size: "sm",
|
|
197
|
-
onClick: () =>
|
|
198
|
-
disabled:
|
|
206
|
+
onClick: () => y(!0),
|
|
207
|
+
disabled: a.isPending,
|
|
199
208
|
"aria-label": "Approve AI answer",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ b(g, {
|
|
201
210
|
className: "mr-1.5 h-4 w-4",
|
|
202
211
|
"aria-hidden": "true"
|
|
203
212
|
}), " Approve"]
|
|
204
|
-
}), /* @__PURE__ */
|
|
213
|
+
}), /* @__PURE__ */ x(S, {
|
|
205
214
|
size: "sm",
|
|
206
215
|
variant: "outline",
|
|
207
|
-
onClick: () =>
|
|
208
|
-
disabled:
|
|
216
|
+
onClick: () => y(!1),
|
|
217
|
+
disabled: a.isPending,
|
|
209
218
|
"aria-label": "Reject AI answer",
|
|
210
|
-
children: [/* @__PURE__ */
|
|
219
|
+
children: [/* @__PURE__ */ b(v, {
|
|
211
220
|
className: "mr-1.5 h-4 w-4",
|
|
212
221
|
"aria-hidden": "true"
|
|
213
222
|
}), " Reject"]
|
|
@@ -217,122 +226,135 @@ function F({ run: t }) {
|
|
|
217
226
|
]
|
|
218
227
|
});
|
|
219
228
|
}
|
|
220
|
-
function
|
|
221
|
-
let [
|
|
222
|
-
storyId:
|
|
223
|
-
collectionId:
|
|
229
|
+
function z({ storyId: t, collectionId: o, oralHistoryId: s, useCases: c, title: l = "AI assistant", description: f = "Citation-grounded answers from sources you can read. Every answer waits for editorial review before adoption.", className: p }) {
|
|
230
|
+
let { workspaceId: g } = e(), v = M(), { canRead: y, canCreate: w, canReview: T } = d(v, g), [E, D] = m(null), O = !!(t || o) && y, k = a({
|
|
231
|
+
storyId: t,
|
|
232
|
+
collectionId: o,
|
|
224
233
|
pagination: { limit: 10 },
|
|
225
|
-
enabled:
|
|
226
|
-
})
|
|
227
|
-
|
|
234
|
+
enabled: O
|
|
235
|
+
});
|
|
236
|
+
if (!y && !w) return null;
|
|
237
|
+
let A = O ? k.data?.items ?? [] : [], j = A.filter(u).length;
|
|
238
|
+
return /* @__PURE__ */ b(h, {
|
|
228
239
|
flag: "theculturepost.ai-context",
|
|
229
240
|
defaultValue: !0,
|
|
230
241
|
fallback: null,
|
|
231
|
-
children: /* @__PURE__ */
|
|
242
|
+
children: /* @__PURE__ */ x(C, {
|
|
232
243
|
treatment: "plain",
|
|
233
|
-
className: `flex flex-col gap-4 p-5 sm:p-6 ${
|
|
244
|
+
className: `flex flex-col gap-4 p-5 sm:p-6 ${p ?? ""}`,
|
|
234
245
|
children: [
|
|
235
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ x("div", {
|
|
236
247
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
237
|
-
children: [/* @__PURE__ */
|
|
248
|
+
children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ x("h2", {
|
|
238
249
|
className: "flex items-center gap-2 font-display text-xl font-semibold text-text-primary",
|
|
239
250
|
children: [
|
|
240
|
-
/* @__PURE__ */ _
|
|
251
|
+
/* @__PURE__ */ b(_, {
|
|
241
252
|
className: "h-5 w-5 text-accent",
|
|
242
253
|
"aria-hidden": "true"
|
|
243
254
|
}),
|
|
244
255
|
" ",
|
|
245
|
-
|
|
246
|
-
|
|
256
|
+
l,
|
|
257
|
+
j > 0 && /* @__PURE__ */ x("span", {
|
|
247
258
|
className: "rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text",
|
|
248
|
-
children: [
|
|
259
|
+
children: [j, " pending"]
|
|
249
260
|
})
|
|
250
261
|
]
|
|
251
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ b("p", {
|
|
252
263
|
className: "mt-1 text-sm text-text-secondary",
|
|
253
|
-
children:
|
|
254
|
-
})] }), /* @__PURE__ */
|
|
264
|
+
children: f
|
|
265
|
+
})] }), w && /* @__PURE__ */ b("div", {
|
|
255
266
|
className: "flex flex-wrap gap-2",
|
|
256
|
-
children:
|
|
267
|
+
children: c.map((e) => /* @__PURE__ */ x(S, {
|
|
257
268
|
variant: "outline",
|
|
258
|
-
onClick: () =>
|
|
259
|
-
children: [/* @__PURE__ */ _
|
|
269
|
+
onClick: () => D(e),
|
|
270
|
+
children: [/* @__PURE__ */ b(_, {
|
|
260
271
|
className: "mr-1.5 h-4 w-4",
|
|
261
272
|
"aria-hidden": "true"
|
|
262
|
-
}),
|
|
273
|
+
}), N[e]]
|
|
263
274
|
}, e))
|
|
264
275
|
})]
|
|
265
276
|
}),
|
|
266
|
-
|
|
277
|
+
O && (k.isLoading ? /* @__PURE__ */ b(i, { label: "Loading AI runs…" }) : k.isError ? /* @__PURE__ */ b(r, {
|
|
267
278
|
title: "Could not load AI runs",
|
|
268
|
-
onRetry: () =>
|
|
269
|
-
}) :
|
|
270
|
-
icon: /* @__PURE__ */ _
|
|
279
|
+
onRetry: () => k.refetch()
|
|
280
|
+
}) : A.length === 0 ? /* @__PURE__ */ b(n, {
|
|
281
|
+
icon: /* @__PURE__ */ b(_, { className: "h-9 w-9" }),
|
|
271
282
|
title: "No AI runs yet",
|
|
272
|
-
description: "Run one of the actions above to draft a citation-grounded answer."
|
|
273
|
-
}) : /* @__PURE__ */
|
|
283
|
+
description: w ? "Run one of the actions above to draft a citation-grounded answer." : "No citation-grounded AI runs have been created for this scope yet."
|
|
284
|
+
}) : /* @__PURE__ */ b("div", {
|
|
274
285
|
className: "flex flex-col gap-3",
|
|
275
|
-
children:
|
|
286
|
+
children: A.map((e) => /* @__PURE__ */ b(R, {
|
|
287
|
+
run: e,
|
|
288
|
+
canReview: T
|
|
289
|
+
}, e.id))
|
|
276
290
|
})),
|
|
277
|
-
|
|
291
|
+
E && /* @__PURE__ */ b(I, {
|
|
278
292
|
open: !0,
|
|
279
293
|
onOpenChange: (e) => {
|
|
280
|
-
e ||
|
|
294
|
+
e || D(null);
|
|
281
295
|
},
|
|
282
|
-
useCase:
|
|
283
|
-
storyId:
|
|
284
|
-
collectionId:
|
|
285
|
-
oralHistoryId:
|
|
296
|
+
useCase: E,
|
|
297
|
+
storyId: t,
|
|
298
|
+
collectionId: o,
|
|
299
|
+
oralHistoryId: s,
|
|
300
|
+
canReview: T
|
|
286
301
|
})
|
|
287
302
|
]
|
|
288
303
|
})
|
|
289
304
|
});
|
|
290
305
|
}
|
|
291
|
-
function
|
|
292
|
-
|
|
306
|
+
function B({ className: t }) {
|
|
307
|
+
let { workspaceId: n } = e(), r = M(), { canRead: i, canReview: a } = d(r, n);
|
|
308
|
+
return i ? /* @__PURE__ */ b(h, {
|
|
293
309
|
flag: "theculturepost.ai-context",
|
|
294
310
|
defaultValue: !0,
|
|
295
311
|
fallback: null,
|
|
296
|
-
children: /* @__PURE__ */
|
|
297
|
-
|
|
312
|
+
children: /* @__PURE__ */ b(V, {
|
|
313
|
+
className: t,
|
|
314
|
+
canReview: a
|
|
315
|
+
})
|
|
316
|
+
}) : null;
|
|
298
317
|
}
|
|
299
|
-
function
|
|
300
|
-
let
|
|
301
|
-
return
|
|
318
|
+
function V({ className: e, canReview: t }) {
|
|
319
|
+
let n = a({ pagination: { limit: 50 } }), o = (n.data?.items ?? []).filter(u);
|
|
320
|
+
return n.isLoading ? /* @__PURE__ */ b(i, { label: "Loading AI review queue…" }) : n.isError ? /* @__PURE__ */ b(r, {
|
|
302
321
|
title: "Could not load the AI review queue",
|
|
303
|
-
onRetry: () =>
|
|
304
|
-
}) :
|
|
322
|
+
onRetry: () => n.refetch()
|
|
323
|
+
}) : o.length === 0 ? null : /* @__PURE__ */ x(C, {
|
|
305
324
|
treatment: "plain",
|
|
306
325
|
className: `flex flex-col gap-3 p-5 sm:p-6 ${e ?? ""}`,
|
|
307
326
|
children: [
|
|
308
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ x("h2", {
|
|
309
328
|
className: "flex items-center gap-2 font-display text-xl font-semibold text-text-primary",
|
|
310
329
|
children: [
|
|
311
|
-
/* @__PURE__ */ _
|
|
330
|
+
/* @__PURE__ */ b(_, {
|
|
312
331
|
className: "h-5 w-5 text-accent",
|
|
313
332
|
"aria-hidden": "true"
|
|
314
333
|
}),
|
|
315
334
|
" AI review queue",
|
|
316
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ x("span", {
|
|
317
336
|
className: "rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text",
|
|
318
|
-
children: [
|
|
337
|
+
children: [o.length, " pending"]
|
|
319
338
|
})
|
|
320
339
|
]
|
|
321
340
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ b("p", {
|
|
323
342
|
className: "text-sm text-text-secondary",
|
|
324
343
|
children: "Generated answers awaiting an editorial decision, newest first. Approve or reject them here, or in place on the story or collection they belong to."
|
|
325
344
|
}),
|
|
326
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ x("div", {
|
|
327
346
|
className: "flex flex-col gap-3",
|
|
328
|
-
children: [
|
|
347
|
+
children: [o.slice(0, 5).map((e) => /* @__PURE__ */ b(R, {
|
|
348
|
+
run: e,
|
|
349
|
+
canReview: t
|
|
350
|
+
}, e.id)), o.length > 5 && /* @__PURE__ */ x("p", {
|
|
329
351
|
className: "text-xs text-text-tertiary",
|
|
330
|
-
children: [
|
|
352
|
+
children: [o.length - 5, " more pending — open the story or collection they belong to review them in place."]
|
|
331
353
|
})]
|
|
332
354
|
})
|
|
333
355
|
]
|
|
334
356
|
});
|
|
335
357
|
}
|
|
336
|
-
export {
|
|
358
|
+
export { N as AI_USE_CASE_LABELS, z as AiContextSection, B as AiReviewQueue, R as AiRunCard, I as GenerateAiContextDialog };
|
|
337
359
|
|
|
338
360
|
//# sourceMappingURL=AiContextPanel.js.map
|