@hachej/boring-agent 0.1.111 → 0.2.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/LICENSE +1 -1
- package/README.md +262 -51
- package/dist/agents.d.ts +75 -0
- package/dist/agents.js +91 -0
- package/dist/approval.d.ts +71 -0
- package/dist/approval.js +126 -0
- package/dist/artifacts.d.ts +53 -0
- package/dist/artifacts.js +129 -0
- package/dist/ask-user.d.ts +40 -0
- package/dist/ask-user.js +134 -0
- package/dist/attachment.d.ts +5 -0
- package/dist/attachment.js +4 -0
- package/dist/browser-task.d.ts +32 -0
- package/dist/browser-task.js +119 -0
- package/dist/chat-transport.d.ts +80 -0
- package/dist/chat-transport.js +306 -0
- package/dist/contracts.d.ts +40 -0
- package/dist/contracts.js +1 -0
- package/dist/conversations.d.ts +136 -0
- package/dist/conversations.js +366 -0
- package/dist/definitions.d.ts +37 -0
- package/dist/definitions.js +99 -0
- package/dist/delivery-input.d.ts +35 -0
- package/dist/delivery-input.js +56 -0
- package/dist/delivery.d.ts +33 -0
- package/dist/delivery.js +154 -0
- package/dist/durable-wait.d.ts +23 -0
- package/dist/durable-wait.js +79 -0
- package/dist/file-convert.d.ts +46 -0
- package/dist/file-convert.js +159 -0
- package/dist/file-guard.d.ts +50 -0
- package/dist/file-guard.js +177 -0
- package/dist/file-types.d.ts +17 -0
- package/dist/file-types.js +95 -0
- package/dist/gateway-provider.d.ts +24 -0
- package/dist/gateway-provider.js +42 -0
- package/dist/git.d.ts +34 -0
- package/dist/git.js +79 -0
- package/dist/harness-pool.d.ts +38 -0
- package/dist/harness-pool.js +134 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/json-schema-tool.d.ts +25 -0
- package/dist/json-schema-tool.js +19 -0
- package/dist/memory/optchat-core.d.ts +118 -0
- package/dist/memory/optchat-core.js +317 -0
- package/dist/memory/optchat.d.ts +156 -0
- package/dist/memory/optchat.js +432 -0
- package/dist/mentions.d.ts +56 -0
- package/dist/mentions.js +140 -0
- package/dist/metering.d.ts +183 -0
- package/dist/metering.js +443 -0
- package/dist/model-gateway.d.ts +86 -0
- package/dist/model-gateway.js +241 -0
- package/dist/native-version.d.ts +9 -0
- package/dist/native-version.js +7 -0
- package/dist/native.d.ts +4 -0
- package/dist/native.js +1 -0
- package/dist/presentation.d.ts +17 -0
- package/dist/presentation.js +39 -0
- package/dist/projection-format.d.ts +68 -0
- package/dist/projection-format.js +118 -0
- package/dist/projection-window.d.ts +9 -0
- package/dist/projection-window.js +93 -0
- package/dist/projection.d.ts +22 -0
- package/dist/projection.js +153 -0
- package/dist/question-response.d.ts +20 -0
- package/dist/question-response.js +75 -0
- package/dist/questions.d.ts +74 -0
- package/dist/questions.js +199 -0
- package/dist/self-evolving.d.ts +55 -0
- package/dist/self-evolving.js +239 -0
- package/dist/skills.d.ts +15 -0
- package/dist/skills.js +51 -0
- package/dist/tool-evidence.d.ts +14 -0
- package/dist/tool-evidence.js +54 -0
- package/dist/validation.d.ts +38 -0
- package/dist/validation.js +68 -0
- package/dist/workspaces.d.ts +107 -0
- package/dist/workspaces.js +212 -0
- package/package.json +145 -150
- package/dist/DebugDrawer-JNA43SVR.js +0 -8
- package/dist/admin-DORVQfLn.d.ts +0 -340
- package/dist/chunk-2BGLZZ7T.js +0 -10
- package/dist/chunk-42D6KAQV.js +0 -2882
- package/dist/chunk-4XOW57KJ.js +0 -343
- package/dist/chunk-72KT6VWV.js +0 -1338
- package/dist/chunk-7XAOVFSN.js +0 -28
- package/dist/chunk-KJIEMSQP.js +0 -198
- package/dist/chunk-KN72XWP7.js +0 -394
- package/dist/chunk-N6THTH7P.js +0 -110
- package/dist/chunk-V3H5A3BR.js +0 -22501
- package/dist/chunk-YGRQ4Q5P.js +0 -20
- package/dist/chunk-YTUZFKB3.js +0 -78
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -617
- package/dist/createHarness-DOLOHA62.js +0 -18
- package/dist/eval/index.d.ts +0 -247
- package/dist/eval/index.js +0 -541
- package/dist/file-search-BUgMSKZE.d.ts +0 -289
- package/dist/front/artifacts.d.ts +0 -34
- package/dist/front/artifacts.js +0 -21
- package/dist/front/index.d.ts +0 -1082
- package/dist/front/index.js +0 -12912
- package/dist/front/styles.css +0 -5380
- package/dist/harness-qHlMJhZo.d.ts +0 -276
- package/dist/middleware-CaAEXpi5.d.ts +0 -115
- package/dist/piChatEvent-DpE0lIb9.d.ts +0 -450
- package/dist/piChatSessionService-CBct-hmz.d.ts +0 -86
- package/dist/sandbox-BMhut3kh.d.ts +0 -317
- package/dist/server/agent-host/testing/compositionRouteProof.d.ts +0 -8
- package/dist/server/agent-host/testing/compositionRouteProof.js +0 -78
- package/dist/server/agent-host/testing/gatewayConformance.d.ts +0 -43
- package/dist/server/agent-host/testing/gatewayConformance.js +0 -605
- package/dist/server/index.d.ts +0 -2278
- package/dist/server/index.js +0 -274
- package/dist/server/pi-session-readability.d.ts +0 -12
- package/dist/server/pi-session-readability.js +0 -23
- package/dist/server/worker/index.d.ts +0 -68
- package/dist/server/worker/index.js +0 -377
- package/dist/share-entry-CxS6UJ_L.d.ts +0 -330
- package/dist/shared/index.d.ts +0 -2111
- package/dist/shared/index.js +0 -262
- package/dist/types-DcWoQMn8.d.ts +0 -1377
- package/docs/ACCESSIBILITY.md +0 -52
- package/docs/AGENT_GATEWAY_V0.md +0 -212
- package/docs/AGENT_PACKAGES.md +0 -90
- package/docs/API.md +0 -123
- package/docs/AUTHORING.md +0 -68
- package/docs/CSP.md +0 -41
- package/docs/ERROR_CODES.md +0 -229
- package/docs/KNOWN_LIMITATIONS.md +0 -100
- package/docs/MIGRATION.md +0 -50
- package/docs/PERFORMANCE.md +0 -68
- package/docs/PLUGINS.md +0 -138
- package/docs/README.md +0 -98
- package/docs/RISKS-MULTI-TAB.md +0 -46
- package/docs/SESSION_IDENTITY.md +0 -91
- package/docs/STYLING.md +0 -73
- package/docs/UI-SHADCN.md +0 -56
- package/docs/VERCEL_COSTS.md +0 -103
- package/docs/plans/archive/AGENT_EVAL_FRAMEWORK.md +0 -466
- package/docs/plans/archive/agent-package-spec.md +0 -1777
- package/docs/plans/archive/harness-followup-capabilities.md +0 -440
- package/docs/plans/archive/harness-tool-ui-capabilities.md +0 -144
- package/docs/plans/archive/pi-followup-history-projection.md +0 -229
- package/docs/plans/archive/pi-tools-migration.md +0 -1061
- package/docs/plans/archive/reviews/pi-followup-history-codex-review.md +0 -11
- package/docs/plans/archive/reviews/pi-followup-history-gpt-review.md +0 -64
- package/docs/plans/archive/reviews/pi-followup-history-opus-review.md +0 -43
- package/docs/plans/archive/reviews/pi-followup-history-xai-review.md +0 -43
- package/docs/plans/archive/vercel-base-snapshot-template-plan.md +0 -527
- package/docs/plans/archive/vercel-persistent-sandbox-adapter.md +0 -553
- package/docs/runtime-provisioning.md +0 -157
- package/docs/runtime.md +0 -296
- package/docs/tools.md +0 -102
package/dist/chunk-4XOW57KJ.js
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-2BGLZZ7T.js";
|
|
4
|
-
import {
|
|
5
|
-
safeRandomUUID
|
|
6
|
-
} from "./chunk-YGRQ4Q5P.js";
|
|
7
|
-
|
|
8
|
-
// src/front/DebugDrawer.tsx
|
|
9
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
10
|
-
|
|
11
|
-
// src/front/agentHttp.ts
|
|
12
|
-
function agentResourceUrl(apiBaseUrl, path) {
|
|
13
|
-
const base = apiBaseUrl?.replace(/\/$/, "") ?? "";
|
|
14
|
-
return `${base}${path}`;
|
|
15
|
-
}
|
|
16
|
-
function withStorageScope(requestHeaders, storageScope) {
|
|
17
|
-
const headers = {};
|
|
18
|
-
for (const [key, value] of Object.entries(requestHeaders ?? {})) {
|
|
19
|
-
if (value !== void 0) headers[key] = value;
|
|
20
|
-
}
|
|
21
|
-
const hasStorageScope = Object.keys(headers).some((key) => key.toLowerCase() === "x-boring-storage-scope");
|
|
22
|
-
if (storageScope && !hasStorageScope) headers["x-boring-storage-scope"] = storageScope;
|
|
23
|
-
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
24
|
-
}
|
|
25
|
-
function createRequestId(operation) {
|
|
26
|
-
return `${operation}:${safeRandomUUID()}`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/front/clipboard.ts
|
|
30
|
-
async function copyTextToClipboard(text) {
|
|
31
|
-
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
|
|
32
|
-
try {
|
|
33
|
-
await navigator.clipboard.writeText(text);
|
|
34
|
-
return true;
|
|
35
|
-
} catch {
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (typeof document === "undefined") return false;
|
|
39
|
-
const textarea = document.createElement("textarea");
|
|
40
|
-
textarea.value = text;
|
|
41
|
-
textarea.setAttribute("readonly", "");
|
|
42
|
-
textarea.style.position = "fixed";
|
|
43
|
-
textarea.style.top = "-9999px";
|
|
44
|
-
textarea.style.left = "-9999px";
|
|
45
|
-
textarea.style.opacity = "0";
|
|
46
|
-
textarea.style.pointerEvents = "none";
|
|
47
|
-
document.body.appendChild(textarea);
|
|
48
|
-
try {
|
|
49
|
-
textarea.focus();
|
|
50
|
-
textarea.select();
|
|
51
|
-
return document.execCommand?.("copy") ?? false;
|
|
52
|
-
} catch {
|
|
53
|
-
return false;
|
|
54
|
-
} finally {
|
|
55
|
-
document.body.removeChild(textarea);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// src/front/DebugDrawer.tsx
|
|
60
|
-
import { Button, IconButton, Tabs, TabsContent, TabsList, TabsTrigger } from "@hachej/boring-ui-kit";
|
|
61
|
-
import {
|
|
62
|
-
CheckIcon,
|
|
63
|
-
ChevronDownIcon,
|
|
64
|
-
ChevronRightIcon,
|
|
65
|
-
CopyIcon,
|
|
66
|
-
RefreshCwIcon
|
|
67
|
-
} from "lucide-react";
|
|
68
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
69
|
-
function CopyButton({ value, label }) {
|
|
70
|
-
const [copied, setCopied] = useState(false);
|
|
71
|
-
const onCopy = useCallback(() => {
|
|
72
|
-
void copyTextToClipboard(value).then((ok) => {
|
|
73
|
-
if (!ok) return;
|
|
74
|
-
setCopied(true);
|
|
75
|
-
window.setTimeout(() => setCopied(false), 1200);
|
|
76
|
-
});
|
|
77
|
-
}, [value]);
|
|
78
|
-
return /* @__PURE__ */ jsx(
|
|
79
|
-
IconButton,
|
|
80
|
-
{
|
|
81
|
-
type: "button",
|
|
82
|
-
variant: "ghost",
|
|
83
|
-
size: "icon-xs",
|
|
84
|
-
onClick: onCopy,
|
|
85
|
-
className: "text-muted-foreground/60",
|
|
86
|
-
"aria-label": label,
|
|
87
|
-
title: label,
|
|
88
|
-
children: copied ? /* @__PURE__ */ jsx(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(CopyIcon, { className: "h-3 w-3" })
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
function DebugValue({ label, value }) {
|
|
93
|
-
return /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border/40 bg-muted/20 p-2", children: [
|
|
94
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
|
|
95
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-[0.16em] text-muted-foreground", children: label }),
|
|
96
|
-
/* @__PURE__ */ jsx(CopyButton, { value, label: `Copy ${label}` })
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ jsx("code", { className: "block break-all font-mono text-[11px] leading-relaxed text-foreground dark:text-zinc-100", children: value })
|
|
99
|
-
] });
|
|
100
|
-
}
|
|
101
|
-
function SessionTab({ sessionId }) {
|
|
102
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 overflow-auto p-3 text-[11px] text-muted-foreground dark:text-zinc-300", children: [
|
|
103
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground dark:text-zinc-300", children: "This web chat is backed by a runtime session. Use the id below for support or debugging." }),
|
|
104
|
-
/* @__PURE__ */ jsx(DebugValue, { label: "Runtime session id", value: sessionId })
|
|
105
|
-
] });
|
|
106
|
-
}
|
|
107
|
-
var RETRY_DELAY_MS = 2500;
|
|
108
|
-
var MAX_RETRIES = 20;
|
|
109
|
-
function SystemPromptTab({
|
|
110
|
-
agentTypeId,
|
|
111
|
-
apiBaseUrl,
|
|
112
|
-
fetch: fetchImpl,
|
|
113
|
-
sessionId,
|
|
114
|
-
requestHeaders,
|
|
115
|
-
storageScope
|
|
116
|
-
}) {
|
|
117
|
-
const [state, setState] = useState({ kind: "loading" });
|
|
118
|
-
const [retryKey, setRetryKey] = useState(0);
|
|
119
|
-
const retryCount = useRef(0);
|
|
120
|
-
const refresh = useCallback(() => {
|
|
121
|
-
retryCount.current = 0;
|
|
122
|
-
setRetryKey((k) => k + 1);
|
|
123
|
-
}, []);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
let aborted = false;
|
|
126
|
-
let retryTimer = null;
|
|
127
|
-
setState({ kind: "loading" });
|
|
128
|
-
const nextFetch = fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
129
|
-
nextFetch(agentResourceUrl(apiBaseUrl, `/api/v1/agents/${encodeURIComponent(agentTypeId)}/sessions/${encodeURIComponent(sessionId)}/system-prompt`), {
|
|
130
|
-
headers: withStorageScope(requestHeaders, storageScope)
|
|
131
|
-
}).then(async (res) => {
|
|
132
|
-
if (aborted) return;
|
|
133
|
-
if (res.ok) {
|
|
134
|
-
const payload2 = await res.json();
|
|
135
|
-
if (typeof payload2.systemPrompt === "string") {
|
|
136
|
-
retryCount.current = 0;
|
|
137
|
-
setState({ kind: "ok", text: payload2.systemPrompt });
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const payload = await res.json().catch(() => null);
|
|
142
|
-
const reason = payload?.error?.message ?? `HTTP ${res.status}`;
|
|
143
|
-
if (res.status === 404 && retryCount.current < MAX_RETRIES) {
|
|
144
|
-
setState({ kind: "empty", reason });
|
|
145
|
-
retryTimer = setTimeout(() => {
|
|
146
|
-
if (!aborted) {
|
|
147
|
-
retryCount.current++;
|
|
148
|
-
setRetryKey((k) => k + 1);
|
|
149
|
-
}
|
|
150
|
-
}, RETRY_DELAY_MS);
|
|
151
|
-
} else {
|
|
152
|
-
setState(res.status === 404 ? { kind: "empty", reason } : { kind: "error", reason });
|
|
153
|
-
}
|
|
154
|
-
}).catch((err) => {
|
|
155
|
-
if (!aborted) setState({ kind: "error", reason: err instanceof Error ? err.message : String(err) });
|
|
156
|
-
});
|
|
157
|
-
return () => {
|
|
158
|
-
aborted = true;
|
|
159
|
-
if (retryTimer) clearTimeout(retryTimer);
|
|
160
|
-
};
|
|
161
|
-
}, [agentTypeId, apiBaseUrl, fetchImpl, sessionId, requestHeaders, retryKey, storageScope]);
|
|
162
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
163
|
-
/* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center justify-between px-3 pt-2 pb-1 border-b border-border/40", children: [
|
|
164
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/80 font-mono", children: state.kind === "ok" ? `${state.text.length.toLocaleString()} chars` : state.kind === "loading" ? "loading\u2026" : state.kind === "empty" ? `waiting for session \xB7 retry ${retryCount.current}/${MAX_RETRIES}` : "error" }),
|
|
165
|
-
state.kind !== "loading" && /* @__PURE__ */ jsx(
|
|
166
|
-
IconButton,
|
|
167
|
-
{
|
|
168
|
-
type: "button",
|
|
169
|
-
variant: "ghost",
|
|
170
|
-
size: "icon-xs",
|
|
171
|
-
onClick: refresh,
|
|
172
|
-
className: "text-muted-foreground/60",
|
|
173
|
-
"aria-label": "Refresh system prompt",
|
|
174
|
-
children: /* @__PURE__ */ jsx(RefreshCwIcon, { className: "h-3 w-3" })
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
] }),
|
|
178
|
-
(state.kind === "loading" || state.kind === "empty") && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground p-3", children: state.kind === "loading" ? "Loading\u2026" : state.reason }),
|
|
179
|
-
state.kind === "error" && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-destructive p-3", children: state.reason }),
|
|
180
|
-
state.kind === "ok" && /* @__PURE__ */ jsx("pre", { className: "flex-1 overflow-auto px-3 py-2 font-mono text-[11px] leading-relaxed text-foreground whitespace-pre-wrap break-words", children: state.text })
|
|
181
|
-
] });
|
|
182
|
-
}
|
|
183
|
-
function partSummary(part) {
|
|
184
|
-
const p = part;
|
|
185
|
-
const type = p?.type ?? "?";
|
|
186
|
-
if (type === "text") {
|
|
187
|
-
const text = String(p.text ?? "");
|
|
188
|
-
return text.slice(0, 80) + (text.length > 80 ? "\u2026" : "");
|
|
189
|
-
}
|
|
190
|
-
if (type === "tool-invocation") {
|
|
191
|
-
const inv = p.toolInvocation;
|
|
192
|
-
const state = String(inv?.state ?? "");
|
|
193
|
-
return `${inv?.toolName ?? "?"}() \xB7 ${state}`;
|
|
194
|
-
}
|
|
195
|
-
if (type === "reasoning") {
|
|
196
|
-
const text = String(p.text ?? p.reasoning ?? "");
|
|
197
|
-
return text.slice(0, 80) + (text.length > 80 ? "\u2026" : "");
|
|
198
|
-
}
|
|
199
|
-
return type;
|
|
200
|
-
}
|
|
201
|
-
function flattenMessages(messages) {
|
|
202
|
-
const out = [];
|
|
203
|
-
for (let mi = 0; mi < messages.length; mi++) {
|
|
204
|
-
const msg = messages[mi];
|
|
205
|
-
const msgAny = msg;
|
|
206
|
-
const time = msgAny.createdAt ? new Date(msgAny.createdAt).toISOString().slice(11, 23) : null;
|
|
207
|
-
for (let pi = 0; pi < msg.parts.length; pi++) {
|
|
208
|
-
const part = msg.parts[pi];
|
|
209
|
-
out.push({
|
|
210
|
-
msgId: msg.id,
|
|
211
|
-
msgIndex: mi,
|
|
212
|
-
role: msg.role,
|
|
213
|
-
time,
|
|
214
|
-
partIndex: pi,
|
|
215
|
-
partType: part?.type ?? "unknown",
|
|
216
|
-
part
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return out;
|
|
221
|
-
}
|
|
222
|
-
function MessagesTab({ messages }) {
|
|
223
|
-
const parts = flattenMessages(messages);
|
|
224
|
-
const [expanded, setExpanded] = useState(null);
|
|
225
|
-
const bottomRef = useRef(null);
|
|
226
|
-
const prevCount = useRef(parts.length);
|
|
227
|
-
useEffect(() => {
|
|
228
|
-
if (parts.length !== prevCount.current) {
|
|
229
|
-
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
230
|
-
prevCount.current = parts.length;
|
|
231
|
-
}
|
|
232
|
-
}, [parts.length]);
|
|
233
|
-
if (parts.length === 0) {
|
|
234
|
-
return /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground p-3", children: "No messages yet." });
|
|
235
|
-
}
|
|
236
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
237
|
-
/* @__PURE__ */ jsxs("div", { className: "shrink-0 px-3 pt-2 pb-1 text-[10px] text-muted-foreground/80 font-mono border-b border-border/40", children: [
|
|
238
|
-
messages.length,
|
|
239
|
-
" msg \xB7 ",
|
|
240
|
-
parts.length,
|
|
241
|
-
" parts"
|
|
242
|
-
] }),
|
|
243
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto", children: [
|
|
244
|
-
parts.map((fp) => {
|
|
245
|
-
const key = `${fp.msgId}:${fp.partIndex}`;
|
|
246
|
-
const open = expanded === key;
|
|
247
|
-
return /* @__PURE__ */ jsxs("div", { className: "border-b border-border/30 last:border-0", children: [
|
|
248
|
-
/* @__PURE__ */ jsxs(
|
|
249
|
-
Button,
|
|
250
|
-
{
|
|
251
|
-
type: "button",
|
|
252
|
-
variant: "ghost",
|
|
253
|
-
onClick: () => setExpanded(open ? null : key),
|
|
254
|
-
className: "h-auto w-full justify-start gap-1.5 rounded-none px-2 py-1.5 text-left",
|
|
255
|
-
children: [
|
|
256
|
-
/* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0 text-muted-foreground/40", children: open ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) }),
|
|
257
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono text-[10px] shrink-0 w-20", children: fp.time ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: fp.time }) : /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/30", children: [
|
|
258
|
-
"m",
|
|
259
|
-
fp.msgIndex
|
|
260
|
-
] }) }),
|
|
261
|
-
/* @__PURE__ */ jsx("span", { className: cn(
|
|
262
|
-
"shrink-0 font-mono text-[10px] w-14",
|
|
263
|
-
fp.role === "user" ? "text-accent" : "text-muted-foreground"
|
|
264
|
-
), children: fp.role }),
|
|
265
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-[10px] text-muted-foreground/60 w-24", children: fp.partType }),
|
|
266
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 font-mono text-[11px] text-foreground truncate", children: partSummary(fp.part) })
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
open && /* @__PURE__ */ jsx("pre", { className: "px-3 pb-2 font-mono text-[10px] leading-relaxed text-foreground/80 whitespace-pre-wrap break-words bg-muted/20", children: JSON.stringify(fp.part, null, 2) })
|
|
271
|
-
] }, key);
|
|
272
|
-
}),
|
|
273
|
-
/* @__PURE__ */ jsx("div", { ref: bottomRef })
|
|
274
|
-
] })
|
|
275
|
-
] });
|
|
276
|
-
}
|
|
277
|
-
var TABS = [
|
|
278
|
-
{ id: "session", label: "Session" },
|
|
279
|
-
{ id: "prompt", label: "System prompt" },
|
|
280
|
-
{ id: "messages", label: "Messages" }
|
|
281
|
-
];
|
|
282
|
-
var MIN_WIDTH = 280;
|
|
283
|
-
var MAX_WIDTH = 800;
|
|
284
|
-
function DebugDrawer({ agentTypeId, apiBaseUrl, fetch, sessionId, messages, requestHeaders, storageScope, width, onWidthChange }) {
|
|
285
|
-
const [tab, setTab] = useState("session");
|
|
286
|
-
const onDragStart = useCallback((e) => {
|
|
287
|
-
e.preventDefault();
|
|
288
|
-
const startX = e.clientX;
|
|
289
|
-
const startW = width;
|
|
290
|
-
const onMove = (ev) => {
|
|
291
|
-
const delta = startX - ev.clientX;
|
|
292
|
-
onWidthChange(Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, startW + delta)));
|
|
293
|
-
};
|
|
294
|
-
const onUp = () => {
|
|
295
|
-
window.removeEventListener("mousemove", onMove);
|
|
296
|
-
window.removeEventListener("mouseup", onUp);
|
|
297
|
-
};
|
|
298
|
-
window.addEventListener("mousemove", onMove);
|
|
299
|
-
window.addEventListener("mouseup", onUp);
|
|
300
|
-
}, [width, onWidthChange]);
|
|
301
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
302
|
-
/* @__PURE__ */ jsx(
|
|
303
|
-
"div",
|
|
304
|
-
{
|
|
305
|
-
onMouseDown: onDragStart,
|
|
306
|
-
className: "w-1 shrink-0 cursor-col-resize hover:bg-accent/40 active:bg-accent/60 transition-colors",
|
|
307
|
-
"aria-hidden": true
|
|
308
|
-
}
|
|
309
|
-
),
|
|
310
|
-
/* @__PURE__ */ jsx(
|
|
311
|
-
"aside",
|
|
312
|
-
{
|
|
313
|
-
style: { width },
|
|
314
|
-
className: cn(
|
|
315
|
-
"flex h-full shrink-0 flex-col border-l border-border/60",
|
|
316
|
-
"bg-[oklch(from_var(--background)_calc(l-0.01)_c_h)]"
|
|
317
|
-
),
|
|
318
|
-
children: /* @__PURE__ */ jsxs(Tabs, { value: tab, onValueChange: (next) => setTab(next), className: "flex flex-col flex-1 min-h-0 overflow-hidden", children: [
|
|
319
|
-
/* @__PURE__ */ jsx("header", { className: "flex shrink-0 items-center gap-0 border-b border-border/60 px-1", children: /* @__PURE__ */ jsx(TabsList, { variant: "line", className: "h-auto gap-0 p-0 w-full", children: TABS.map(({ id, label }) => /* @__PURE__ */ jsx(
|
|
320
|
-
TabsTrigger,
|
|
321
|
-
{
|
|
322
|
-
value: id,
|
|
323
|
-
className: "h-8 flex-none px-3 py-2 text-[11px] font-medium data-[state=active]:after:bg-[color:var(--accent)]",
|
|
324
|
-
children: label
|
|
325
|
-
},
|
|
326
|
-
id
|
|
327
|
-
)) }) }),
|
|
328
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "session", forceMount: true, className: "flex flex-col flex-1 min-h-0 overflow-hidden data-[state=inactive]:hidden", children: /* @__PURE__ */ jsx(SessionTab, { sessionId }) }),
|
|
329
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "prompt", forceMount: true, className: "flex flex-col flex-1 min-h-0 overflow-hidden data-[state=inactive]:hidden", children: /* @__PURE__ */ jsx(SystemPromptTab, { agentTypeId, apiBaseUrl, fetch, sessionId, requestHeaders, storageScope }) }),
|
|
330
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "messages", forceMount: true, className: "flex flex-col flex-1 min-h-0 overflow-hidden data-[state=inactive]:hidden", children: /* @__PURE__ */ jsx(MessagesTab, { messages }) })
|
|
331
|
-
] })
|
|
332
|
-
}
|
|
333
|
-
)
|
|
334
|
-
] });
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export {
|
|
338
|
-
copyTextToClipboard,
|
|
339
|
-
agentResourceUrl,
|
|
340
|
-
withStorageScope,
|
|
341
|
-
createRequestId,
|
|
342
|
-
DebugDrawer
|
|
343
|
-
};
|