@tanstack/ai-devtools-core 0.5.17 → 0.5.18
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/{production/Shell/EBEFU2GI.js → Shell/7YKZZJIO.js} +623 -173
- package/dist/Shell/{Y4V4YNYM.js → LR2PUWRS.js} +623 -173
- package/dist/Shell/{3BTXBRTQ.js → TTHBDBPP.js} +530 -141
- package/dist/dev.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{Shell/EBEFU2GI.js → production/Shell/7YKZZJIO.js} +623 -173
- package/dist/production/Shell/{Y4V4YNYM.js → LR2PUWRS.js} +623 -173
- package/dist/production/Shell/{3BTXBRTQ.js → TTHBDBPP.js} +530 -141
- package/dist/production/dev.js +1 -1
- package/dist/production/index.js +1 -1
- package/dist/production/server.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/src/components/conversation/IterationTimeline.tsx +137 -45
- package/src/components/hooks/HookDetails.tsx +248 -86
- package/src/store/ai-context.tsx +3 -0
- package/src/store/subagent-steps.ts +387 -0
|
@@ -6529,6 +6529,9 @@ var AIProvider = (props) => {
|
|
|
6529
6529
|
}
|
|
6530
6530
|
const newIteration = {
|
|
6531
6531
|
requestId,
|
|
6532
|
+
...e.payload.runId ? {
|
|
6533
|
+
runId: e.payload.runId
|
|
6534
|
+
} : {},
|
|
6532
6535
|
index: iteration,
|
|
6533
6536
|
messageId,
|
|
6534
6537
|
startedAt: e.payload.timestamp,
|
|
@@ -7588,6 +7591,241 @@ var formatDuration = (ms) => {
|
|
|
7588
7591
|
if (ms < 1e3) return `${ms}ms`;
|
|
7589
7592
|
return `${(ms / 1e3).toFixed(2)}s`;
|
|
7590
7593
|
};
|
|
7594
|
+
|
|
7595
|
+
// src/store/subagent-steps.ts
|
|
7596
|
+
function isRecord(value) {
|
|
7597
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
7598
|
+
}
|
|
7599
|
+
function text(value) {
|
|
7600
|
+
return typeof value === "string" ? value : "";
|
|
7601
|
+
}
|
|
7602
|
+
function collectSubagents(messages) {
|
|
7603
|
+
const out = [];
|
|
7604
|
+
let turn = -1;
|
|
7605
|
+
const visit = (list, parentPath, parentTurn) => {
|
|
7606
|
+
for (const message of list) {
|
|
7607
|
+
if (!isRecord(message)) continue;
|
|
7608
|
+
if (parentTurn === void 0 && message.role === "user") turn += 1;
|
|
7609
|
+
if (!Array.isArray(message.parts)) continue;
|
|
7610
|
+
for (const part of message.parts) {
|
|
7611
|
+
if (!isRecord(part) || part.type !== "subagent") continue;
|
|
7612
|
+
const subagent = part.subagent;
|
|
7613
|
+
if (!isRecord(subagent) || typeof subagent.id !== "string") continue;
|
|
7614
|
+
const name = text(subagent.name) || "subagent";
|
|
7615
|
+
const path = parentPath ? `${parentPath} > ${name}` : name;
|
|
7616
|
+
const error = isRecord(subagent.error) ? text(subagent.error.message) : "";
|
|
7617
|
+
const childMessages = Array.isArray(subagent.messages) ? subagent.messages : [];
|
|
7618
|
+
const info = {
|
|
7619
|
+
id: subagent.id,
|
|
7620
|
+
name,
|
|
7621
|
+
path,
|
|
7622
|
+
...typeof subagent.status === "string" ? { status: subagent.status } : {},
|
|
7623
|
+
...error ? { error } : {},
|
|
7624
|
+
turn: parentTurn ?? Math.max(turn, 0),
|
|
7625
|
+
messages: childMessages
|
|
7626
|
+
};
|
|
7627
|
+
out.push(info);
|
|
7628
|
+
visit(childMessages, path, info.turn);
|
|
7629
|
+
}
|
|
7630
|
+
}
|
|
7631
|
+
};
|
|
7632
|
+
visit(messages, void 0, void 0);
|
|
7633
|
+
return out;
|
|
7634
|
+
}
|
|
7635
|
+
function subagentIdForRunId(runId, ids) {
|
|
7636
|
+
if (!runId) return void 0;
|
|
7637
|
+
if (ids.has(runId)) return runId;
|
|
7638
|
+
const last = runId.slice(runId.lastIndexOf(":") + 1);
|
|
7639
|
+
return last !== runId && ids.has(last) ? last : void 0;
|
|
7640
|
+
}
|
|
7641
|
+
function childRequestAgents(iterations, subagents) {
|
|
7642
|
+
const ids = new Set(subagents.map((agent) => agent.id));
|
|
7643
|
+
const pathById = new Map(subagents.map((agent) => [agent.id, agent.path]));
|
|
7644
|
+
const out = /* @__PURE__ */ new Map();
|
|
7645
|
+
for (const iteration of iterations) {
|
|
7646
|
+
const id = subagentIdForRunId(iteration.runId, ids);
|
|
7647
|
+
const path = id ? pathById.get(id) : void 0;
|
|
7648
|
+
if (path && iteration.requestId) out.set(iteration.requestId, path);
|
|
7649
|
+
}
|
|
7650
|
+
return out;
|
|
7651
|
+
}
|
|
7652
|
+
function collectServerSteps(root, conversations, subagents) {
|
|
7653
|
+
const ids = new Set(subagents.map((agent) => agent.id));
|
|
7654
|
+
const iterations = [...root?.iterations ?? []];
|
|
7655
|
+
const messages = [...root?.messages ?? []];
|
|
7656
|
+
const seenSteps = new Set(
|
|
7657
|
+
iterations.map((iteration) => `${iteration.requestId}:${iteration.index}`)
|
|
7658
|
+
);
|
|
7659
|
+
const seenMessages = new Set(messages.map((message) => message.id));
|
|
7660
|
+
for (const conversation of conversations) {
|
|
7661
|
+
if (conversation === root) continue;
|
|
7662
|
+
const child = conversation.iterations.filter(
|
|
7663
|
+
(iteration) => subagentIdForRunId(iteration.runId, ids)
|
|
7664
|
+
);
|
|
7665
|
+
if (child.length === 0) continue;
|
|
7666
|
+
for (const iteration of child) {
|
|
7667
|
+
const key = `${iteration.requestId}:${iteration.index}`;
|
|
7668
|
+
if (seenSteps.has(key)) continue;
|
|
7669
|
+
seenSteps.add(key);
|
|
7670
|
+
iterations.push(iteration);
|
|
7671
|
+
}
|
|
7672
|
+
for (const message of conversation.messages) {
|
|
7673
|
+
if (seenMessages.has(message.id)) continue;
|
|
7674
|
+
seenMessages.add(message.id);
|
|
7675
|
+
messages.push(message);
|
|
7676
|
+
}
|
|
7677
|
+
}
|
|
7678
|
+
return { iterations, messages };
|
|
7679
|
+
}
|
|
7680
|
+
function timestampOf(value) {
|
|
7681
|
+
if (value instanceof Date) return value.getTime();
|
|
7682
|
+
if (typeof value !== "string" && typeof value !== "number") return void 0;
|
|
7683
|
+
const time = new Date(value).getTime();
|
|
7684
|
+
return Number.isNaN(time) ? void 0 : time;
|
|
7685
|
+
}
|
|
7686
|
+
function snapshotTurns(messages) {
|
|
7687
|
+
const turns = [];
|
|
7688
|
+
for (const message of messages) {
|
|
7689
|
+
if (!isRecord(message) || message.role !== "user") continue;
|
|
7690
|
+
const timestamp = timestampOf(message.createdAt);
|
|
7691
|
+
if (timestamp === void 0 || typeof message.id !== "string") return [];
|
|
7692
|
+
const content = Array.isArray(message.parts) ? message.parts.map(
|
|
7693
|
+
(part) => isRecord(part) && part.type === "text" ? text(part.content) : ""
|
|
7694
|
+
).join("") : text(message.content);
|
|
7695
|
+
turns.push({ id: message.id, role: "user", content, timestamp });
|
|
7696
|
+
}
|
|
7697
|
+
return turns;
|
|
7698
|
+
}
|
|
7699
|
+
function groupTimeline(iterations, messages, subagents, turns = []) {
|
|
7700
|
+
const ids = new Set(subagents.map((agent) => agent.id));
|
|
7701
|
+
const childRequests = childRequestAgents(iterations, subagents);
|
|
7702
|
+
const rootIterations = iterations.filter(
|
|
7703
|
+
(iteration) => !subagentIdForRunId(iteration.runId, ids)
|
|
7704
|
+
);
|
|
7705
|
+
const agents = subagents.map((agent) => {
|
|
7706
|
+
const server = iterations.filter(
|
|
7707
|
+
(iteration) => subagentIdForRunId(iteration.runId, ids) === agent.id
|
|
7708
|
+
);
|
|
7709
|
+
return server.length > 0 ? { agent, iterations: server, messages, source: "server" } : { agent, ...buildSubagentSteps(agent), source: "snapshot" };
|
|
7710
|
+
});
|
|
7711
|
+
const users = (turns.length > 0 ? [...turns] : messages.filter(
|
|
7712
|
+
(message) => message.role === "user" && !(message.requestId && childRequests.has(message.requestId))
|
|
7713
|
+
)).sort((a, b) => a.timestamp - b.timestamp);
|
|
7714
|
+
if (users.length === 0) {
|
|
7715
|
+
return rootIterations.length > 0 || agents.length > 0 ? [{ userMessage: null, iterations: rootIterations, agents }] : [];
|
|
7716
|
+
}
|
|
7717
|
+
const groups = [];
|
|
7718
|
+
const first = users[0];
|
|
7719
|
+
const early = first ? rootIterations.filter(
|
|
7720
|
+
(iteration) => iteration.startedAt < first.timestamp
|
|
7721
|
+
) : [];
|
|
7722
|
+
if (early.length > 0) {
|
|
7723
|
+
groups.push({ userMessage: null, iterations: early, agents: [] });
|
|
7724
|
+
}
|
|
7725
|
+
users.forEach((user, turn) => {
|
|
7726
|
+
const next = users[turn + 1];
|
|
7727
|
+
const own = rootIterations.filter(
|
|
7728
|
+
(iteration) => iteration.startedAt >= user.timestamp && (!next || iteration.startedAt < next.timestamp)
|
|
7729
|
+
);
|
|
7730
|
+
const isLast = turn === users.length - 1;
|
|
7731
|
+
const ownAgents = agents.filter(
|
|
7732
|
+
(group) => isLast ? group.agent.turn >= turn : group.agent.turn === turn
|
|
7733
|
+
);
|
|
7734
|
+
if (own.length > 0 || ownAgents.length > 0) {
|
|
7735
|
+
groups.push({ userMessage: user, iterations: own, agents: ownAgents });
|
|
7736
|
+
}
|
|
7737
|
+
});
|
|
7738
|
+
return groups;
|
|
7739
|
+
}
|
|
7740
|
+
function resultText(value) {
|
|
7741
|
+
if (typeof value === "string") return value;
|
|
7742
|
+
if (value === void 0) return "";
|
|
7743
|
+
try {
|
|
7744
|
+
return JSON.stringify(value);
|
|
7745
|
+
} catch {
|
|
7746
|
+
return String(value);
|
|
7747
|
+
}
|
|
7748
|
+
}
|
|
7749
|
+
function buildSubagentSteps(agent) {
|
|
7750
|
+
const iterations = [];
|
|
7751
|
+
const messages = [];
|
|
7752
|
+
let current;
|
|
7753
|
+
const close = () => {
|
|
7754
|
+
if (!current) return;
|
|
7755
|
+
const index = iterations.length;
|
|
7756
|
+
const { message, results } = current;
|
|
7757
|
+
const hasContent = message.content || message.thinkingContent || (message.toolCalls?.length ?? 0) > 0 || results.length > 0;
|
|
7758
|
+
if (hasContent) {
|
|
7759
|
+
messages.push(message, ...results);
|
|
7760
|
+
iterations.push({
|
|
7761
|
+
requestId: `subagent:${agent.id}`,
|
|
7762
|
+
index,
|
|
7763
|
+
messageId: message.id,
|
|
7764
|
+
// ponytail: the snapshot has no timestamps, so steps have no duration.
|
|
7765
|
+
startedAt: 1,
|
|
7766
|
+
completedAt: 1,
|
|
7767
|
+
finishReason: (message.toolCalls?.length ?? 0) > 0 ? "tool_calls" : "stop",
|
|
7768
|
+
middlewareEvents: [],
|
|
7769
|
+
messageIds: [message.id, ...results.map((result) => result.id)]
|
|
7770
|
+
});
|
|
7771
|
+
}
|
|
7772
|
+
current = void 0;
|
|
7773
|
+
};
|
|
7774
|
+
const open = () => {
|
|
7775
|
+
const index = iterations.length;
|
|
7776
|
+
current = {
|
|
7777
|
+
message: {
|
|
7778
|
+
id: `${agent.id}:step-${index}`,
|
|
7779
|
+
role: "assistant",
|
|
7780
|
+
content: "",
|
|
7781
|
+
timestamp: 1,
|
|
7782
|
+
toolCalls: []
|
|
7783
|
+
},
|
|
7784
|
+
results: [],
|
|
7785
|
+
hasResult: false
|
|
7786
|
+
};
|
|
7787
|
+
return current;
|
|
7788
|
+
};
|
|
7789
|
+
for (const message of agent.messages) {
|
|
7790
|
+
if (!isRecord(message) || message.role !== "assistant") continue;
|
|
7791
|
+
if (!Array.isArray(message.parts)) continue;
|
|
7792
|
+
for (const part of message.parts) {
|
|
7793
|
+
if (!isRecord(part)) continue;
|
|
7794
|
+
const step = part.type === "tool-result" ? current ?? open() : current && !current.hasResult ? current : (close(), open());
|
|
7795
|
+
if (part.type === "thinking") {
|
|
7796
|
+
step.message.thinkingContent = (step.message.thinkingContent ?? "") + text(part.content);
|
|
7797
|
+
} else if (part.type === "text") {
|
|
7798
|
+
step.message.content += text(part.content);
|
|
7799
|
+
} else if (part.type === "tool-call") {
|
|
7800
|
+
const toolCall = {
|
|
7801
|
+
id: text(part.id),
|
|
7802
|
+
name: text(part.name) || "tool",
|
|
7803
|
+
arguments: text(part.arguments),
|
|
7804
|
+
state: text(part.state),
|
|
7805
|
+
...part.output !== void 0 ? { result: part.output } : {}
|
|
7806
|
+
};
|
|
7807
|
+
step.message.toolCalls?.push(toolCall);
|
|
7808
|
+
} else if (part.type === "tool-result") {
|
|
7809
|
+
const toolCallId = text(part.toolCallId);
|
|
7810
|
+
const content = resultText(part.content ?? part.error);
|
|
7811
|
+
const call = step.message.toolCalls?.find((tc) => tc.id === toolCallId);
|
|
7812
|
+
if (call && call.result === void 0) call.result = content;
|
|
7813
|
+
step.results.push({
|
|
7814
|
+
id: `${agent.id}:result-${toolCallId || step.results.length}`,
|
|
7815
|
+
role: "tool",
|
|
7816
|
+
content,
|
|
7817
|
+
timestamp: 1
|
|
7818
|
+
});
|
|
7819
|
+
step.hasResult = true;
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
}
|
|
7823
|
+
close();
|
|
7824
|
+
const last = iterations.at(-1);
|
|
7825
|
+
if (last && agent.status === "running") delete last.completedAt;
|
|
7826
|
+
if (last && agent.status === "error") last.finishReason = "error";
|
|
7827
|
+
return { iterations, messages };
|
|
7828
|
+
}
|
|
7591
7829
|
var _tmpl$10 = /* @__PURE__ */ template(`<span>ms`);
|
|
7592
7830
|
var _tmpl$22 = /* @__PURE__ */ template(`<span>`);
|
|
7593
7831
|
var _tmpl$32 = /* @__PURE__ */ template(`<div><span>Middleware</span><span></span><span>`);
|
|
@@ -7952,9 +8190,9 @@ var AssistantStep = (props) => {
|
|
|
7952
8190
|
const contentLength = () => (msg().content || "").length;
|
|
7953
8191
|
const isLong = () => contentLength() > 200;
|
|
7954
8192
|
const preview = () => {
|
|
7955
|
-
const
|
|
7956
|
-
if (
|
|
7957
|
-
return truncate(
|
|
8193
|
+
const text2 = msg().content || "";
|
|
8194
|
+
if (text2.length <= 200) return text2;
|
|
8195
|
+
return truncate(text2, 200);
|
|
7958
8196
|
};
|
|
7959
8197
|
return [(() => {
|
|
7960
8198
|
var _el$22 = _tmpl$92(), _el$23 = _el$22.firstChild, _el$24 = _el$23.nextSibling;
|
|
@@ -8189,8 +8427,8 @@ var ToolResultStep = (props) => {
|
|
|
8189
8427
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
8190
8428
|
const msg = () => props.step.message;
|
|
8191
8429
|
const parsedContent = () => {
|
|
8192
|
-
const
|
|
8193
|
-
return tryParseJson(
|
|
8430
|
+
const text2 = msg().content || "";
|
|
8431
|
+
return tryParseJson(text2) || text2;
|
|
8194
8432
|
};
|
|
8195
8433
|
return [(() => {
|
|
8196
8434
|
var _el$46 = _tmpl$11(), _el$47 = _el$46.firstChild, _el$48 = _el$47.nextSibling;
|
|
@@ -8870,46 +9108,11 @@ var _tmpl$142 = /* @__PURE__ */ template(`<div><span>Model Options</span><div>`)
|
|
|
8870
9108
|
var _tmpl$152 = /* @__PURE__ */ template(`<div><div><div>U</div><div><span></span><div></div></div><div></div><span>\u25B6</span></div><div><div><div></div></div></div><div><div><div>`);
|
|
8871
9109
|
var _tmpl$162 = /* @__PURE__ */ template(`<span>\u{1F3AF} `);
|
|
8872
9110
|
var _tmpl$172 = /* @__PURE__ */ template(`<span><span>`);
|
|
9111
|
+
var _tmpl$182 = /* @__PURE__ */ template(`<div data-testid=ai-devtools-subagent-steps style=margin-top:8px><div role=button tabindex=0><div></div><div><span></span><div><span>subagent</span></div></div><div><span>\u{1F504} </span></div><span>\u25B6</span></div><div><div><div>`);
|
|
8873
9112
|
var IterationTimeline = (props) => {
|
|
8874
9113
|
const styles = useStyles();
|
|
8875
9114
|
const s = () => styles().iterationTimeline;
|
|
8876
|
-
const groups = createMemo(() =>
|
|
8877
|
-
const userMessages = props.messages.filter((m) => m.role === "user");
|
|
8878
|
-
const iters = props.iterations;
|
|
8879
|
-
if (userMessages.length === 0) {
|
|
8880
|
-
return iters.length > 0 ? [{
|
|
8881
|
-
userMessage: null,
|
|
8882
|
-
iterations: iters
|
|
8883
|
-
}] : [];
|
|
8884
|
-
}
|
|
8885
|
-
const result = [];
|
|
8886
|
-
const sortedUsers = [...userMessages].sort((a, b) => a.timestamp - b.timestamp);
|
|
8887
|
-
for (const [u, currentUser] of sortedUsers.entries()) {
|
|
8888
|
-
const nextUser = sortedUsers[u + 1];
|
|
8889
|
-
const groupIters = iters.filter((it) => {
|
|
8890
|
-
if (it.startedAt < currentUser.timestamp) return false;
|
|
8891
|
-
if (nextUser && it.startedAt >= nextUser.timestamp) return false;
|
|
8892
|
-
return true;
|
|
8893
|
-
});
|
|
8894
|
-
if (groupIters.length > 0) {
|
|
8895
|
-
result.push({
|
|
8896
|
-
userMessage: currentUser,
|
|
8897
|
-
iterations: groupIters
|
|
8898
|
-
});
|
|
8899
|
-
}
|
|
8900
|
-
}
|
|
8901
|
-
const firstUser = sortedUsers[0];
|
|
8902
|
-
if (firstUser) {
|
|
8903
|
-
const earlyIters = iters.filter((it) => it.startedAt < firstUser.timestamp);
|
|
8904
|
-
if (earlyIters.length > 0) {
|
|
8905
|
-
result.unshift({
|
|
8906
|
-
userMessage: null,
|
|
8907
|
-
iterations: earlyIters
|
|
8908
|
-
});
|
|
8909
|
-
}
|
|
8910
|
-
}
|
|
8911
|
-
return result;
|
|
8912
|
-
});
|
|
9115
|
+
const groups = createMemo(() => groupTimeline(props.iterations, props.messages, props.subagents ?? [], props.turns ?? []));
|
|
8913
9116
|
return (() => {
|
|
8914
9117
|
var _el$ = _tmpl$30();
|
|
8915
9118
|
insert(_el$, createComponent(Show, {
|
|
@@ -9083,8 +9286,8 @@ var UserMessageGroupCard = (props) => {
|
|
|
9083
9286
|
const userContent = () => {
|
|
9084
9287
|
const msg = userMsg();
|
|
9085
9288
|
if (!msg) return "(no user message)";
|
|
9086
|
-
const
|
|
9087
|
-
return
|
|
9289
|
+
const text2 = msg.content || "";
|
|
9290
|
+
return text2.length > 120 ? text2.slice(0, 120) + "..." : text2;
|
|
9088
9291
|
};
|
|
9089
9292
|
const handleUserMouseEnter = () => {
|
|
9090
9293
|
const messageId = userMessageId();
|
|
@@ -9421,7 +9624,21 @@ var UserMessageGroupCard = (props) => {
|
|
|
9421
9624
|
return props.onHoverTarget;
|
|
9422
9625
|
}
|
|
9423
9626
|
})
|
|
9424
|
-
}));
|
|
9627
|
+
}), null);
|
|
9628
|
+
insert(_el$49, createComponent(For, {
|
|
9629
|
+
get each() {
|
|
9630
|
+
return group().agents;
|
|
9631
|
+
},
|
|
9632
|
+
children: (agentGroup) => createComponent(SubagentStepsCard, {
|
|
9633
|
+
group: agentGroup,
|
|
9634
|
+
get hoverTarget() {
|
|
9635
|
+
return props.hoverTarget;
|
|
9636
|
+
},
|
|
9637
|
+
get onHoverTarget() {
|
|
9638
|
+
return props.onHoverTarget;
|
|
9639
|
+
}
|
|
9640
|
+
})
|
|
9641
|
+
}), null);
|
|
9425
9642
|
effect((_p$) => {
|
|
9426
9643
|
var _v$17 = s().cardHeader, _v$18 = s().userBubble, _v$19 = s().cardHeaderContent, _v$20 = s().cardHeaderLabel, _v$21 = s().cardSubtitle, _v$22 = s().cardHeaderBadges, _v$23 = `${s().chevron} ${isOpen() ? s().chevronOpen : ""}`, _v$24 = `${s().configPanelWrapper} ${configExpanded() ? s().configPanelWrapperOpen : ""}`, _v$25 = s().configPanel, _v$26 = `${s().cardBody} ${isOpen() ? s().cardBodyOpen : ""}`, _v$27 = s().cardBodyInner, _v$28 = s().iterList;
|
|
9427
9644
|
_v$17 !== _p$.e && className(_el$10, _p$.e = _v$17);
|
|
@@ -9454,7 +9671,135 @@ var UserMessageGroupCard = (props) => {
|
|
|
9454
9671
|
return _el$1;
|
|
9455
9672
|
})();
|
|
9456
9673
|
};
|
|
9457
|
-
|
|
9674
|
+
var SubagentStepsCard = (props) => {
|
|
9675
|
+
const styles = useStyles();
|
|
9676
|
+
const s = () => styles().iterationTimeline;
|
|
9677
|
+
const [isOpen, setIsOpen] = createSignal(true);
|
|
9678
|
+
const group = createMemo(() => {
|
|
9679
|
+
if (props.group) return props.group;
|
|
9680
|
+
if (!props.agent) return void 0;
|
|
9681
|
+
return {
|
|
9682
|
+
agent: props.agent,
|
|
9683
|
+
...buildSubagentSteps(props.agent),
|
|
9684
|
+
source: "snapshot"
|
|
9685
|
+
};
|
|
9686
|
+
});
|
|
9687
|
+
const agent = () => group()?.agent;
|
|
9688
|
+
const iterations = () => group()?.iterations ?? [];
|
|
9689
|
+
const accentClass = () => {
|
|
9690
|
+
const status = agent()?.status;
|
|
9691
|
+
if (status === "running") return s().cardActive;
|
|
9692
|
+
if (status === "error") return s().cardError;
|
|
9693
|
+
if (status === "finished") return s().cardCompleted;
|
|
9694
|
+
return "";
|
|
9695
|
+
};
|
|
9696
|
+
return createComponent(Show, {
|
|
9697
|
+
get when() {
|
|
9698
|
+
return agent();
|
|
9699
|
+
},
|
|
9700
|
+
children: (current) => (() => {
|
|
9701
|
+
var _el$54 = _tmpl$182(), _el$55 = _el$54.firstChild, _el$56 = _el$55.firstChild, _el$57 = _el$56.nextSibling, _el$58 = _el$57.firstChild, _el$59 = _el$58.nextSibling, _el$60 = _el$59.firstChild, _el$63 = _el$57.nextSibling, _el$64 = _el$63.firstChild; _el$64.firstChild; var _el$66 = _el$63.nextSibling, _el$67 = _el$55.nextSibling, _el$68 = _el$67.firstChild, _el$69 = _el$68.firstChild;
|
|
9702
|
+
_el$55.$$keydown = (event) => {
|
|
9703
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
9704
|
+
event.preventDefault();
|
|
9705
|
+
setIsOpen(!isOpen());
|
|
9706
|
+
};
|
|
9707
|
+
_el$55.$$click = () => setIsOpen(!isOpen());
|
|
9708
|
+
insert(_el$56, () => current().name.charAt(0).toUpperCase());
|
|
9709
|
+
insert(_el$58, () => current().path);
|
|
9710
|
+
insert(_el$59, createComponent(Show, {
|
|
9711
|
+
get when() {
|
|
9712
|
+
return current().status;
|
|
9713
|
+
},
|
|
9714
|
+
get children() {
|
|
9715
|
+
var _el$61 = _tmpl$33();
|
|
9716
|
+
insert(_el$61, () => current().status);
|
|
9717
|
+
effect(() => className(_el$61, s().subtitleBadge));
|
|
9718
|
+
return _el$61;
|
|
9719
|
+
}
|
|
9720
|
+
}), null);
|
|
9721
|
+
insert(_el$59, createComponent(Show, {
|
|
9722
|
+
get when() {
|
|
9723
|
+
return current().error;
|
|
9724
|
+
},
|
|
9725
|
+
get children() {
|
|
9726
|
+
var _el$62 = _tmpl$33();
|
|
9727
|
+
insert(_el$62, () => current().error);
|
|
9728
|
+
effect(() => className(_el$62, s().subtitleBadgeWarn));
|
|
9729
|
+
return _el$62;
|
|
9730
|
+
}
|
|
9731
|
+
}), null);
|
|
9732
|
+
insert(_el$64, () => iterations().length, null);
|
|
9733
|
+
insert(_el$69, createComponent(For, {
|
|
9734
|
+
get each() {
|
|
9735
|
+
return iterations();
|
|
9736
|
+
},
|
|
9737
|
+
children: (iteration, index) => createComponent(IterationCard, {
|
|
9738
|
+
iteration,
|
|
9739
|
+
get previousIteration() {
|
|
9740
|
+
return memo(() => index() > 0)() ? iterations()[index() - 1] : void 0;
|
|
9741
|
+
},
|
|
9742
|
+
get messages() {
|
|
9743
|
+
return group()?.messages ?? [];
|
|
9744
|
+
},
|
|
9745
|
+
get index() {
|
|
9746
|
+
return index();
|
|
9747
|
+
},
|
|
9748
|
+
get isLast() {
|
|
9749
|
+
return index() === iterations().length - 1;
|
|
9750
|
+
},
|
|
9751
|
+
get hoverTarget() {
|
|
9752
|
+
return props.hoverTarget;
|
|
9753
|
+
},
|
|
9754
|
+
get onHoverTarget() {
|
|
9755
|
+
return props.onHoverTarget;
|
|
9756
|
+
}
|
|
9757
|
+
})
|
|
9758
|
+
}));
|
|
9759
|
+
effect((_p$) => {
|
|
9760
|
+
var _v$33 = `${s().card} ${accentClass()}`, _v$34 = current().path, _v$35 = group()?.source, _v$36 = s().cardHeader, _v$37 = isOpen(), _v$38 = s().userBubble, _v$39 = s().cardHeaderContent, _v$40 = s().cardHeaderLabel, _v$41 = s().cardSubtitle, _v$42 = s().subtitleText, _v$43 = s().cardHeaderBadges, _v$44 = `${s().badge} ${s().badgeDuration}`, _v$45 = `${iterations().length} ${iterations().length === 1 ? "iteration" : "iterations"}`, _v$46 = `${s().chevron} ${isOpen() ? s().chevronOpen : ""}`, _v$47 = `${s().cardBody} ${isOpen() ? s().cardBodyOpen : ""}`, _v$48 = s().cardBodyInner, _v$49 = s().iterList;
|
|
9761
|
+
_v$33 !== _p$.e && className(_el$54, _p$.e = _v$33);
|
|
9762
|
+
_v$34 !== _p$.t && setAttribute(_el$54, "data-agent", _p$.t = _v$34);
|
|
9763
|
+
_v$35 !== _p$.a && setAttribute(_el$54, "data-source", _p$.a = _v$35);
|
|
9764
|
+
_v$36 !== _p$.o && className(_el$55, _p$.o = _v$36);
|
|
9765
|
+
_v$37 !== _p$.i && setAttribute(_el$55, "aria-expanded", _p$.i = _v$37);
|
|
9766
|
+
_v$38 !== _p$.n && className(_el$56, _p$.n = _v$38);
|
|
9767
|
+
_v$39 !== _p$.s && className(_el$57, _p$.s = _v$39);
|
|
9768
|
+
_v$40 !== _p$.h && className(_el$58, _p$.h = _v$40);
|
|
9769
|
+
_v$41 !== _p$.r && className(_el$59, _p$.r = _v$41);
|
|
9770
|
+
_v$42 !== _p$.d && className(_el$60, _p$.d = _v$42);
|
|
9771
|
+
_v$43 !== _p$.l && className(_el$63, _p$.l = _v$43);
|
|
9772
|
+
_v$44 !== _p$.u && className(_el$64, _p$.u = _v$44);
|
|
9773
|
+
_v$45 !== _p$.c && setAttribute(_el$64, "title", _p$.c = _v$45);
|
|
9774
|
+
_v$46 !== _p$.w && className(_el$66, _p$.w = _v$46);
|
|
9775
|
+
_v$47 !== _p$.m && className(_el$67, _p$.m = _v$47);
|
|
9776
|
+
_v$48 !== _p$.f && className(_el$68, _p$.f = _v$48);
|
|
9777
|
+
_v$49 !== _p$.y && className(_el$69, _p$.y = _v$49);
|
|
9778
|
+
return _p$;
|
|
9779
|
+
}, {
|
|
9780
|
+
e: void 0,
|
|
9781
|
+
t: void 0,
|
|
9782
|
+
a: void 0,
|
|
9783
|
+
o: void 0,
|
|
9784
|
+
i: void 0,
|
|
9785
|
+
n: void 0,
|
|
9786
|
+
s: void 0,
|
|
9787
|
+
h: void 0,
|
|
9788
|
+
r: void 0,
|
|
9789
|
+
d: void 0,
|
|
9790
|
+
l: void 0,
|
|
9791
|
+
u: void 0,
|
|
9792
|
+
c: void 0,
|
|
9793
|
+
w: void 0,
|
|
9794
|
+
m: void 0,
|
|
9795
|
+
f: void 0,
|
|
9796
|
+
y: void 0
|
|
9797
|
+
});
|
|
9798
|
+
return _el$54;
|
|
9799
|
+
})()
|
|
9800
|
+
});
|
|
9801
|
+
};
|
|
9802
|
+
delegateEvents(["click", "keydown"]);
|
|
9458
9803
|
var _tmpl$31 = /* @__PURE__ */ template(`<form data-testid=ai-devtools-fixture-save-popover><label><span>Fixture name</span><input data-testid=ai-devtools-fixture-name-input></label><div><button data-testid=ai-devtools-fixture-save-confirm type=submit>Save</button><button data-testid=ai-devtools-fixture-save-cancel type=button>Cancel`);
|
|
9459
9804
|
var FixtureNamePopover = (props) => {
|
|
9460
9805
|
const styles = useStyles();
|
|
@@ -9751,7 +10096,7 @@ var FieldInput = (props) => {
|
|
|
9751
10096
|
function fieldsFromSchema(schema) {
|
|
9752
10097
|
if (!isJsonSchemaObject(schema)) return [];
|
|
9753
10098
|
const properties = schema.properties;
|
|
9754
|
-
if (!
|
|
10099
|
+
if (!isRecord2(properties)) return [];
|
|
9755
10100
|
const required = Array.isArray(schema.required) ? new Set(schema.required.filter((item) => typeof item === "string")) : /* @__PURE__ */ new Set();
|
|
9756
10101
|
return Object.entries(properties).map(([name, property]) => {
|
|
9757
10102
|
const propertySchema = isJsonSchemaObject(property) ? property : void 0;
|
|
@@ -9831,9 +10176,9 @@ function normalizeType(value) {
|
|
|
9831
10176
|
return "string";
|
|
9832
10177
|
}
|
|
9833
10178
|
function isJsonSchemaObject(value) {
|
|
9834
|
-
return
|
|
10179
|
+
return isRecord2(value);
|
|
9835
10180
|
}
|
|
9836
|
-
function
|
|
10181
|
+
function isRecord2(value) {
|
|
9837
10182
|
return typeof value === "object" && value !== null;
|
|
9838
10183
|
}
|
|
9839
10184
|
delegateEvents(["input", "click"]);
|
|
@@ -9865,7 +10210,7 @@ function mergePreviewMessagesForUserView(conversationMessages, snapshotMessages)
|
|
|
9865
10210
|
}
|
|
9866
10211
|
function partsToMessageText(parts) {
|
|
9867
10212
|
return parts.map((part) => {
|
|
9868
|
-
if (!
|
|
10213
|
+
if (!isRecord3(part)) return "";
|
|
9869
10214
|
if (part.type !== "text") return "";
|
|
9870
10215
|
if (typeof part.text === "string") return part.text;
|
|
9871
10216
|
if (typeof part.content === "string") return part.content;
|
|
@@ -9904,7 +10249,7 @@ function isRenderablePreviewMessage(message) {
|
|
|
9904
10249
|
function isNonUserPreviewMessage(message) {
|
|
9905
10250
|
return message.role !== void 0 && message.role !== "user";
|
|
9906
10251
|
}
|
|
9907
|
-
function
|
|
10252
|
+
function isRecord3(value) {
|
|
9908
10253
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
9909
10254
|
}
|
|
9910
10255
|
function normalizeText(value) {
|
|
@@ -10496,7 +10841,7 @@ function runSortTime(run) {
|
|
|
10496
10841
|
return run.startedAt ?? run.updatedAt ?? run.completedAt ?? 0;
|
|
10497
10842
|
}
|
|
10498
10843
|
function runFromUnknown(value) {
|
|
10499
|
-
if (!
|
|
10844
|
+
if (!isRecord4(value) || typeof value.id !== "string") {
|
|
10500
10845
|
return void 0;
|
|
10501
10846
|
}
|
|
10502
10847
|
const progress = progressFromUnknown(value.progress);
|
|
@@ -10629,7 +10974,7 @@ function isGenerationRunView(value) {
|
|
|
10629
10974
|
return value !== void 0;
|
|
10630
10975
|
}
|
|
10631
10976
|
function previewFromUnknown(value, fallbackResult) {
|
|
10632
|
-
if (
|
|
10977
|
+
if (isRecord4(value) && typeof value.kind === "string") {
|
|
10633
10978
|
if (value.kind === "image") {
|
|
10634
10979
|
return {
|
|
10635
10980
|
kind: "image",
|
|
@@ -10680,7 +11025,7 @@ function previewFromUnknown(value, fallbackResult) {
|
|
|
10680
11025
|
};
|
|
10681
11026
|
}
|
|
10682
11027
|
function progressFromUnknown(value) {
|
|
10683
|
-
if (!
|
|
11028
|
+
if (!isRecord4(value) || typeof value.value !== "number") {
|
|
10684
11029
|
return void 0;
|
|
10685
11030
|
}
|
|
10686
11031
|
return {
|
|
@@ -10695,17 +11040,17 @@ function mediaItemsFromUnknown(value) {
|
|
|
10695
11040
|
return value.filter(isMediaItem);
|
|
10696
11041
|
}
|
|
10697
11042
|
function isMediaItem(value) {
|
|
10698
|
-
if (!
|
|
11043
|
+
if (!isRecord4(value) || typeof value.src !== "string") {
|
|
10699
11044
|
return false;
|
|
10700
11045
|
}
|
|
10701
11046
|
return true;
|
|
10702
11047
|
}
|
|
10703
11048
|
function isVideoJob(value) {
|
|
10704
|
-
return
|
|
11049
|
+
return isRecord4(value) && typeof value.jobId === "string";
|
|
10705
11050
|
}
|
|
10706
11051
|
function errorTextFromUnknown(value) {
|
|
10707
11052
|
if (typeof value === "string") return value;
|
|
10708
|
-
if (
|
|
11053
|
+
if (isRecord4(value) && typeof value.message === "string") {
|
|
10709
11054
|
return value.message;
|
|
10710
11055
|
}
|
|
10711
11056
|
return void 0;
|
|
@@ -10717,7 +11062,7 @@ function numberFromUnknown(value) {
|
|
|
10717
11062
|
return typeof value === "number" ? value : void 0;
|
|
10718
11063
|
}
|
|
10719
11064
|
function videoStatusLabel(value) {
|
|
10720
|
-
if (!
|
|
11065
|
+
if (!isRecord4(value)) return void 0;
|
|
10721
11066
|
const status = stringFromUnknown(value.status);
|
|
10722
11067
|
const progress = numberFromUnknown(value.progress);
|
|
10723
11068
|
if (!status && progress === void 0) return void 0;
|
|
@@ -10739,7 +11084,7 @@ function formatTime(timestamp) {
|
|
|
10739
11084
|
if (timestamp === void 0) return "unknown";
|
|
10740
11085
|
return new Date(timestamp).toLocaleTimeString();
|
|
10741
11086
|
}
|
|
10742
|
-
function
|
|
11087
|
+
function isRecord4(value) {
|
|
10743
11088
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10744
11089
|
}
|
|
10745
11090
|
delegateEvents(["click"]);
|
|
@@ -11559,7 +11904,7 @@ var _tmpl$144 = /* @__PURE__ */ template(`<div>`);
|
|
|
11559
11904
|
var _tmpl$154 = /* @__PURE__ */ template(`<div>No messages.`);
|
|
11560
11905
|
var _tmpl$164 = /* @__PURE__ */ template(`<div><div>`);
|
|
11561
11906
|
var _tmpl$173 = /* @__PURE__ */ template(`<div><button type=button data-testid=ai-devtools-preview-save-tool-call>Save</button><button type=button data-testid=ai-devtools-preview-replay-tool-call>Replay`);
|
|
11562
|
-
var _tmpl$
|
|
11907
|
+
var _tmpl$183 = /* @__PURE__ */ template(`<div><span>`);
|
|
11563
11908
|
var _tmpl$192 = /* @__PURE__ */ template(`<div><span></span><div>`);
|
|
11564
11909
|
var _tmpl$202 = /* @__PURE__ */ template(`<div>No messages yet. Start a conversation to see messages here.`);
|
|
11565
11910
|
var _tmpl$217 = /* @__PURE__ */ template(`<div data-testid=ai-devtools-tools><div></div><div>`);
|
|
@@ -11606,13 +11951,34 @@ var HookDetails = () => {
|
|
|
11606
11951
|
setActiveTab("conversation");
|
|
11607
11952
|
}
|
|
11608
11953
|
});
|
|
11954
|
+
const subagents = createMemo(() => {
|
|
11955
|
+
const messages = hook()?.state.messages;
|
|
11956
|
+
return Array.isArray(messages) ? collectSubagents(messages) : [];
|
|
11957
|
+
});
|
|
11958
|
+
const serverSteps = createMemo(() => collectServerSteps(conversation(), Object.values(state.conversations), subagents()));
|
|
11959
|
+
const turns = createMemo(() => {
|
|
11960
|
+
const messages = hook()?.state.messages;
|
|
11961
|
+
return Array.isArray(messages) ? snapshotTurns(messages) : [];
|
|
11962
|
+
});
|
|
11609
11963
|
const previewMessages = createMemo(() => {
|
|
11610
11964
|
const activeHook = hook();
|
|
11611
11965
|
if (!activeHook) return [];
|
|
11612
11966
|
const snapshotMessages = messagesFromSnapshot(activeHook.state);
|
|
11967
|
+
if (snapshotMessages.length > 0 && subagents().length > 0) {
|
|
11968
|
+
return snapshotMessages;
|
|
11969
|
+
}
|
|
11613
11970
|
const conversationMessages = conversation()?.messages ?? [];
|
|
11614
11971
|
if (conversationMessages.length > 0) {
|
|
11615
|
-
|
|
11972
|
+
const childAgents = childRequestAgents(conversation()?.iterations ?? [], subagents());
|
|
11973
|
+
const agentOf = (message) => message.requestId ? childAgents.get(message.requestId) : void 0;
|
|
11974
|
+
return mergePreviewMessagesForUserView(conversationMessages.filter((message) => !(message.role === "user" && agentOf(message))).map((message) => {
|
|
11975
|
+
const preview = messageFromConversation(message);
|
|
11976
|
+
const agent = agentOf(message);
|
|
11977
|
+
return agent ? {
|
|
11978
|
+
...preview,
|
|
11979
|
+
agent
|
|
11980
|
+
} : preview;
|
|
11981
|
+
}), snapshotMessages);
|
|
11616
11982
|
}
|
|
11617
11983
|
if (snapshotMessages.length > 0) return snapshotMessages;
|
|
11618
11984
|
return [];
|
|
@@ -11753,6 +12119,15 @@ var HookDetails = () => {
|
|
|
11753
12119
|
get messages() {
|
|
11754
12120
|
return previewMessages();
|
|
11755
12121
|
},
|
|
12122
|
+
get subagents() {
|
|
12123
|
+
return subagents();
|
|
12124
|
+
},
|
|
12125
|
+
get steps() {
|
|
12126
|
+
return serverSteps();
|
|
12127
|
+
},
|
|
12128
|
+
get turns() {
|
|
12129
|
+
return turns();
|
|
12130
|
+
},
|
|
11756
12131
|
get hoverTarget() {
|
|
11757
12132
|
return hoverTarget();
|
|
11758
12133
|
},
|
|
@@ -12250,7 +12625,7 @@ var ConversationPanel = (props) => {
|
|
|
12250
12625
|
const styles = useStyles();
|
|
12251
12626
|
return createComponent(Show, {
|
|
12252
12627
|
get when() {
|
|
12253
|
-
return props.conversation;
|
|
12628
|
+
return props.conversation || props.steps.iterations.length > 0;
|
|
12254
12629
|
},
|
|
12255
12630
|
get fallback() {
|
|
12256
12631
|
return createComponent(Show, {
|
|
@@ -12285,6 +12660,9 @@ var ConversationPanel = (props) => {
|
|
|
12285
12660
|
get messages() {
|
|
12286
12661
|
return props.messages;
|
|
12287
12662
|
},
|
|
12663
|
+
get subagents() {
|
|
12664
|
+
return props.subagents;
|
|
12665
|
+
},
|
|
12288
12666
|
get hoverTarget() {
|
|
12289
12667
|
return props.hoverTarget;
|
|
12290
12668
|
},
|
|
@@ -12295,40 +12673,51 @@ var ConversationPanel = (props) => {
|
|
|
12295
12673
|
}
|
|
12296
12674
|
});
|
|
12297
12675
|
},
|
|
12298
|
-
children
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12676
|
+
get children() {
|
|
12677
|
+
return createComponent(Show, {
|
|
12678
|
+
get when() {
|
|
12679
|
+
return props.steps.iterations.length > 0;
|
|
12680
|
+
},
|
|
12681
|
+
get fallback() {
|
|
12682
|
+
return createComponent(HookMessageTimeline, {
|
|
12683
|
+
get messages() {
|
|
12684
|
+
return props.messages;
|
|
12685
|
+
},
|
|
12686
|
+
get subagents() {
|
|
12687
|
+
return props.subagents;
|
|
12688
|
+
},
|
|
12689
|
+
get hoverTarget() {
|
|
12690
|
+
return props.hoverTarget;
|
|
12691
|
+
},
|
|
12692
|
+
get onHoverTarget() {
|
|
12693
|
+
return props.onHoverTarget;
|
|
12694
|
+
}
|
|
12695
|
+
});
|
|
12696
|
+
},
|
|
12697
|
+
get children() {
|
|
12698
|
+
return createComponent(IterationTimeline, {
|
|
12699
|
+
get iterations() {
|
|
12700
|
+
return props.steps.iterations;
|
|
12701
|
+
},
|
|
12702
|
+
get messages() {
|
|
12703
|
+
return props.steps.messages;
|
|
12704
|
+
},
|
|
12705
|
+
get subagents() {
|
|
12706
|
+
return props.subagents;
|
|
12707
|
+
},
|
|
12708
|
+
get turns() {
|
|
12709
|
+
return props.turns;
|
|
12710
|
+
},
|
|
12711
|
+
get hoverTarget() {
|
|
12712
|
+
return props.hoverTarget;
|
|
12713
|
+
},
|
|
12714
|
+
get onHoverTarget() {
|
|
12715
|
+
return props.onHoverTarget;
|
|
12716
|
+
}
|
|
12717
|
+
});
|
|
12718
|
+
}
|
|
12719
|
+
});
|
|
12720
|
+
}
|
|
12332
12721
|
});
|
|
12333
12722
|
};
|
|
12334
12723
|
var MessagesPreview = (props) => {
|
|
@@ -12396,7 +12785,7 @@ var MessagesPreview = (props) => {
|
|
|
12396
12785
|
return props.messages;
|
|
12397
12786
|
},
|
|
12398
12787
|
children: (message) => {
|
|
12399
|
-
const visibleParts = () => visiblePreviewPartsForMessage(message);
|
|
12788
|
+
const visibleParts = () => visiblePreviewPartsForMessage(message).filter((part) => !hiddenInUserView(message, part));
|
|
12400
12789
|
return (() => {
|
|
12401
12790
|
var _el$51 = _tmpl$164(), _el$52 = _el$51.firstChild;
|
|
12402
12791
|
spread(_el$51, mergeProps(() => getHoverDataAttributes({
|
|
@@ -12419,7 +12808,7 @@ var MessagesPreview = (props) => {
|
|
|
12419
12808
|
})),
|
|
12420
12809
|
"onMouseLeave": () => props.onHoverTarget(null)
|
|
12421
12810
|
}), false, true);
|
|
12422
|
-
insert(_el$52, () => message
|
|
12811
|
+
insert(_el$52, () => roleLabel(message));
|
|
12423
12812
|
insert(_el$51, createComponent(Show, {
|
|
12424
12813
|
get when() {
|
|
12425
12814
|
return message.content;
|
|
@@ -12436,7 +12825,7 @@ var MessagesPreview = (props) => {
|
|
|
12436
12825
|
return visibleParts();
|
|
12437
12826
|
},
|
|
12438
12827
|
children: (part) => (() => {
|
|
12439
|
-
var _el$54 = _tmpl$
|
|
12828
|
+
var _el$54 = _tmpl$183(), _el$55 = _el$54.firstChild;
|
|
12440
12829
|
spread(_el$54, mergeProps(() => getHoverDataAttributes({
|
|
12441
12830
|
messageIds: [message.id],
|
|
12442
12831
|
partIds: [part.id]
|
|
@@ -12590,7 +12979,7 @@ var HookMessageTimeline = (props) => {
|
|
|
12590
12979
|
})),
|
|
12591
12980
|
"onMouseLeave": () => props.onHoverTarget(null)
|
|
12592
12981
|
}), false, true);
|
|
12593
|
-
insert(_el$67, () => message
|
|
12982
|
+
insert(_el$67, () => roleLabel(message));
|
|
12594
12983
|
insert(_el$66, createComponent(Show, {
|
|
12595
12984
|
get when() {
|
|
12596
12985
|
return message.content;
|
|
@@ -12604,75 +12993,93 @@ var HookMessageTimeline = (props) => {
|
|
|
12604
12993
|
}), null);
|
|
12605
12994
|
insert(_el$66, createComponent(For, {
|
|
12606
12995
|
get each() {
|
|
12607
|
-
return visiblePreviewPartsForMessage(message);
|
|
12996
|
+
return visiblePreviewPartsForMessage(message).filter((part) => part.subagentId || !part.subagentPath);
|
|
12608
12997
|
},
|
|
12609
|
-
children: (part) => (
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
insert(_el$70, () => part.label);
|
|
12627
|
-
insert(_el$69, createComponent(Show, {
|
|
12628
|
-
get when() {
|
|
12629
|
-
return part.jsonItems?.length;
|
|
12630
|
-
},
|
|
12631
|
-
get fallback() {
|
|
12632
|
-
return (() => {
|
|
12633
|
-
var _el$72 = _tmpl$07();
|
|
12634
|
-
insert(_el$72, () => part.content);
|
|
12635
|
-
effect(() => className(_el$72, styles().hookDetails.previewPartContent));
|
|
12636
|
-
return _el$72;
|
|
12637
|
-
})();
|
|
12638
|
-
},
|
|
12639
|
-
get children() {
|
|
12640
|
-
var _el$71 = _tmpl$144();
|
|
12641
|
-
insert(_el$71, createComponent(For, {
|
|
12642
|
-
get each() {
|
|
12643
|
-
return part.jsonItems;
|
|
12998
|
+
children: (part) => createComponent(Show, {
|
|
12999
|
+
get when() {
|
|
13000
|
+
return props.subagents.find((agent) => agent.id === part.subagentId);
|
|
13001
|
+
},
|
|
13002
|
+
get fallback() {
|
|
13003
|
+
return (() => {
|
|
13004
|
+
var _el$69 = _tmpl$183(), _el$70 = _el$69.firstChild;
|
|
13005
|
+
spread(_el$69, mergeProps(() => getHoverDataAttributes({
|
|
13006
|
+
messageIds: [message.id],
|
|
13007
|
+
partIds: [part.id]
|
|
13008
|
+
}), {
|
|
13009
|
+
get ["class"]() {
|
|
13010
|
+
return styles().hookDetails.previewPart;
|
|
13011
|
+
},
|
|
13012
|
+
"data-testid": "ai-devtools-timeline-part",
|
|
13013
|
+
get ["data-part-id"]() {
|
|
13014
|
+
return part.id;
|
|
12644
13015
|
},
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
|
|
12648
|
-
|
|
12649
|
-
|
|
12650
|
-
|
|
13016
|
+
get ["data-part-kind"]() {
|
|
13017
|
+
return part.kind;
|
|
13018
|
+
}
|
|
13019
|
+
}), false, true);
|
|
13020
|
+
insert(_el$70, () => part.label);
|
|
13021
|
+
insert(_el$69, createComponent(Show, {
|
|
13022
|
+
get when() {
|
|
13023
|
+
return part.jsonItems?.length;
|
|
13024
|
+
},
|
|
13025
|
+
get fallback() {
|
|
13026
|
+
return (() => {
|
|
13027
|
+
var _el$72 = _tmpl$07();
|
|
13028
|
+
insert(_el$72, () => part.content);
|
|
13029
|
+
effect(() => className(_el$72, styles().hookDetails.previewPartContent));
|
|
13030
|
+
return _el$72;
|
|
13031
|
+
})();
|
|
13032
|
+
},
|
|
13033
|
+
get children() {
|
|
13034
|
+
var _el$71 = _tmpl$144();
|
|
13035
|
+
insert(_el$71, createComponent(For, {
|
|
13036
|
+
get each() {
|
|
13037
|
+
return part.jsonItems;
|
|
12651
13038
|
},
|
|
12652
|
-
|
|
12653
|
-
|
|
13039
|
+
children: (item) => (() => {
|
|
13040
|
+
var _el$73 = _tmpl$192(), _el$74 = _el$73.firstChild, _el$75 = _el$74.nextSibling;
|
|
13041
|
+
insert(_el$74, () => item.label);
|
|
13042
|
+
insert(_el$75, createComponent(JsonTree, {
|
|
13043
|
+
get value() {
|
|
13044
|
+
return item.value;
|
|
13045
|
+
},
|
|
13046
|
+
defaultExpansionDepth: 1,
|
|
13047
|
+
copyable: true
|
|
13048
|
+
}));
|
|
13049
|
+
effect((_p$) => {
|
|
13050
|
+
var _v$51 = styles().hookDetails.previewJsonItem, _v$52 = styles().hookDetails.previewJsonItemLabel, _v$53 = styles().hookDetails.previewJsonPanel;
|
|
13051
|
+
_v$51 !== _p$.e && className(_el$73, _p$.e = _v$51);
|
|
13052
|
+
_v$52 !== _p$.t && className(_el$74, _p$.t = _v$52);
|
|
13053
|
+
_v$53 !== _p$.a && className(_el$75, _p$.a = _v$53);
|
|
13054
|
+
return _p$;
|
|
13055
|
+
}, {
|
|
13056
|
+
e: void 0,
|
|
13057
|
+
t: void 0,
|
|
13058
|
+
a: void 0
|
|
13059
|
+
});
|
|
13060
|
+
return _el$73;
|
|
13061
|
+
})()
|
|
12654
13062
|
}));
|
|
12655
|
-
effect((
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
13063
|
+
effect(() => className(_el$71, `${styles().hookDetails.previewJsonItems} ${part.kind === "structured-output" ? styles().hookDetails.previewJsonItemsCompare : ""}`));
|
|
13064
|
+
return _el$71;
|
|
13065
|
+
}
|
|
13066
|
+
}), null);
|
|
13067
|
+
effect(() => className(_el$70, styles().hookDetails.previewPartLabel));
|
|
13068
|
+
return _el$69;
|
|
13069
|
+
})();
|
|
13070
|
+
},
|
|
13071
|
+
children: (agent) => createComponent(SubagentStepsCard, {
|
|
13072
|
+
get agent() {
|
|
13073
|
+
return agent();
|
|
13074
|
+
},
|
|
13075
|
+
get hoverTarget() {
|
|
13076
|
+
return props.hoverTarget;
|
|
13077
|
+
},
|
|
13078
|
+
get onHoverTarget() {
|
|
13079
|
+
return props.onHoverTarget;
|
|
12671
13080
|
}
|
|
12672
|
-
})
|
|
12673
|
-
|
|
12674
|
-
return _el$69;
|
|
12675
|
-
})()
|
|
13081
|
+
})
|
|
13082
|
+
})
|
|
12676
13083
|
}), null);
|
|
12677
13084
|
effect(() => className(_el$67, styles().hookDetails.messageRole));
|
|
12678
13085
|
return _el$66;
|
|
@@ -12683,6 +13090,13 @@ var HookMessageTimeline = (props) => {
|
|
|
12683
13090
|
}
|
|
12684
13091
|
});
|
|
12685
13092
|
};
|
|
13093
|
+
function roleLabel(message) {
|
|
13094
|
+
return message.agent ? `${message.role} (${message.agent})` : message.role;
|
|
13095
|
+
}
|
|
13096
|
+
function hiddenInUserView(message, part) {
|
|
13097
|
+
if (!message.agent && !part.subagentPath) return false;
|
|
13098
|
+
return part.kind === "thinking" || part.kind === "tool-call";
|
|
13099
|
+
}
|
|
12686
13100
|
var ToolsView = (props) => {
|
|
12687
13101
|
const {
|
|
12688
13102
|
state,
|
|
@@ -12954,7 +13368,7 @@ function findConversationForHook(hook, conversations) {
|
|
|
12954
13368
|
}
|
|
12955
13369
|
const snapshotMessages = hook.state.messages;
|
|
12956
13370
|
if (Array.isArray(snapshotMessages)) {
|
|
12957
|
-
const messageIds = new Set(snapshotMessages.map((message) =>
|
|
13371
|
+
const messageIds = new Set(snapshotMessages.map((message) => isRecord5(message) && typeof message.id === "string" ? message.id : void 0).filter((id) => typeof id === "string"));
|
|
12958
13372
|
if (messageIds.size > 0) {
|
|
12959
13373
|
addCandidate(Object.values(conversations).find((conversation) => conversation.messages.some((message) => messageIds.has(message.id))));
|
|
12960
13374
|
}
|
|
@@ -12982,7 +13396,7 @@ function messageFromConversation(message) {
|
|
|
12982
13396
|
};
|
|
12983
13397
|
}
|
|
12984
13398
|
function messageFromUnknown(value) {
|
|
12985
|
-
if (!
|
|
13399
|
+
if (!isRecord5(value)) return void 0;
|
|
12986
13400
|
const id = typeof value.id === "string" ? value.id : void 0;
|
|
12987
13401
|
const role = typeof value.role === "string" ? value.role : void 0;
|
|
12988
13402
|
if (!id || !role) return void 0;
|
|
@@ -12999,10 +13413,49 @@ function messageFromUnknown(value) {
|
|
|
12999
13413
|
};
|
|
13000
13414
|
}
|
|
13001
13415
|
function partsFromMessageParts(parts, messageId) {
|
|
13002
|
-
return parts.
|
|
13416
|
+
return parts.flatMap((part, index) => previewPartsFromRecord(part, index, messageId));
|
|
13003
13417
|
}
|
|
13004
13418
|
function partsFromUnknown(parts, messageId) {
|
|
13005
|
-
return parts.
|
|
13419
|
+
return parts.flatMap((part, index) => isRecord5(part) ? previewPartsFromRecord(part, index, messageId) : []);
|
|
13420
|
+
}
|
|
13421
|
+
function previewPartsFromRecord(part, index, messageId, path) {
|
|
13422
|
+
if (part.type === "subagent" && isRecord5(part.subagent)) {
|
|
13423
|
+
return subagentPreviewParts(part.subagent, index, path);
|
|
13424
|
+
}
|
|
13425
|
+
const preview = previewPartFromRecord(part, index, messageId);
|
|
13426
|
+
if (!path) return [preview];
|
|
13427
|
+
const {
|
|
13428
|
+
fixture: _fixture,
|
|
13429
|
+
...childPart
|
|
13430
|
+
} = preview;
|
|
13431
|
+
return [{
|
|
13432
|
+
...childPart,
|
|
13433
|
+
id: `${path}:${messageId ?? index}:${preview.id}`,
|
|
13434
|
+
label: `${path} > ${preview.label}`,
|
|
13435
|
+
subagentPath: path
|
|
13436
|
+
}];
|
|
13437
|
+
}
|
|
13438
|
+
function subagentPreviewParts(subagent, index, parentPath) {
|
|
13439
|
+
const name = typeof subagent.name === "string" ? subagent.name : "subagent";
|
|
13440
|
+
const status = typeof subagent.status === "string" ? subagent.status : void 0;
|
|
13441
|
+
const id = typeof subagent.id === "string" ? subagent.id : `${index}`;
|
|
13442
|
+
const error = isRecord5(subagent.error) ? subagent.error.message : void 0;
|
|
13443
|
+
const path = parentPath ? `${parentPath} > ${name}` : name;
|
|
13444
|
+
const header = {
|
|
13445
|
+
id: `subagent:${id}`,
|
|
13446
|
+
label: status ? `subagent ${path} - ${status}` : `subagent ${path}`,
|
|
13447
|
+
...typeof error === "string" ? {
|
|
13448
|
+
content: error
|
|
13449
|
+
} : {},
|
|
13450
|
+
kind: "subagent",
|
|
13451
|
+
subagentId: id
|
|
13452
|
+
};
|
|
13453
|
+
const messages = Array.isArray(subagent.messages) ? subagent.messages : [];
|
|
13454
|
+
return [header, ...messages.flatMap((message, messageIndex) => {
|
|
13455
|
+
if (!isRecord5(message) || !Array.isArray(message.parts)) return [];
|
|
13456
|
+
const childMessageId = typeof message.id === "string" ? message.id : `${id}:${messageIndex}`;
|
|
13457
|
+
return message.parts.flatMap((child, childIndex) => isRecord5(child) ? previewPartsFromRecord(child, childIndex, childMessageId, path) : []);
|
|
13458
|
+
})];
|
|
13006
13459
|
}
|
|
13007
13460
|
function previewPartFromRecord(part, index, messageId) {
|
|
13008
13461
|
const type = typeof part.type === "string" ? part.type : "part";
|
|
@@ -13189,7 +13642,7 @@ function approvalStatusFromToolCall(tool) {
|
|
|
13189
13642
|
return void 0;
|
|
13190
13643
|
}
|
|
13191
13644
|
function approvalStatusFromRecord(approval, state) {
|
|
13192
|
-
if (
|
|
13645
|
+
if (isRecord5(approval)) {
|
|
13193
13646
|
if (approval.approved === true) return "approved";
|
|
13194
13647
|
if (approval.approved === false) return "denied";
|
|
13195
13648
|
if (approval.needsApproval === true) return "approval requested";
|
|
@@ -13266,10 +13719,7 @@ function formatUnknown(value) {
|
|
|
13266
13719
|
function isPreviewMessage(value) {
|
|
13267
13720
|
return Boolean(value);
|
|
13268
13721
|
}
|
|
13269
|
-
function
|
|
13270
|
-
return Boolean(value);
|
|
13271
|
-
}
|
|
13272
|
-
function isRecord4(value) {
|
|
13722
|
+
function isRecord5(value) {
|
|
13273
13723
|
return typeof value === "object" && value !== null;
|
|
13274
13724
|
}
|
|
13275
13725
|
function isToolFixtureMessageRole(role) {
|