@cerebriline/ui 0.0.0-stage → 4.100.313
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/ADOPTION.md +833 -0
- package/LICENSE +201 -0
- package/RADIX-COLORS-LICENSE +21 -0
- package/README.md +427 -2
- package/components/agent-approval-card.css +70 -0
- package/components/agent-approval-card.tsx +109 -0
- package/components/agent-ask-question.css +103 -0
- package/components/agent-ask-question.tsx +276 -0
- package/components/agent-aurora.css +228 -0
- package/components/agent-aurora.tsx +96 -0
- package/components/agent-changes.css +13 -0
- package/components/agent-changes.tsx +167 -0
- package/components/agent-chat/agent-chat.css +556 -0
- package/components/agent-chat/index.tsx +1037 -0
- package/components/agent-chat/tool-diff.tsx +165 -0
- package/components/agent-chat/tool-summary/agents.ts +114 -0
- package/components/agent-chat/tool-summary/diff.ts +152 -0
- package/components/agent-chat/tool-summary/index.ts +928 -0
- package/components/agent-chat/tool-summary/parsers.ts +611 -0
- package/components/agent-chat/tool-summary/paths.ts +84 -0
- package/components/agent-chat/tool-summary/team.ts +401 -0
- package/components/agent-command-output.tsx +63 -0
- package/components/agent-composer.tsx +263 -0
- package/components/agent-context-usage.tsx +181 -0
- package/components/agent-conversation-layout.tsx +139 -0
- package/components/agent-hero-heading.css +53 -0
- package/components/agent-hero-heading.tsx +45 -0
- package/components/agent-image-lightbox.tsx +48 -0
- package/components/agent-prompt-queue.css +20 -0
- package/components/agent-prompt-queue.tsx +350 -0
- package/components/agent-pull-request-bar.css +13 -0
- package/components/agent-pull-request-bar.tsx +346 -0
- package/components/agent-quick-actions.css +19 -0
- package/components/agent-quick-actions.tsx +70 -0
- package/components/agent-session-row.tsx +183 -0
- package/components/agent-welcome-hero-pointer.ts +199 -0
- package/components/agent-welcome-hero.css +205 -0
- package/components/agent-welcome-hero.tsx +68 -0
- package/components/attachment-drop-zone.tsx +154 -0
- package/components/badge.tsx +21 -0
- package/components/button.tsx +324 -0
- package/components/generated-media.tsx +173 -0
- package/components/github-icon.tsx +19 -0
- package/components/index.ts +133 -0
- package/components/markdown.css +490 -0
- package/components/markdown.ts +365 -0
- package/components/mermaid-block.tsx +722 -0
- package/components/mermaid-diagram.ts +1260 -0
- package/components/mermaid-dom.ts +301 -0
- package/components/message-scroller.css +118 -0
- package/components/message-scroller.tsx +114 -0
- package/components/search-combobox.css +67 -0
- package/components/search-combobox.tsx +433 -0
- package/components/session-status.css +19 -0
- package/components/session-status.tsx +39 -0
- package/components/switch.css +221 -0
- package/components/switch.tsx +48 -0
- package/components.css +16 -0
- package/dist/components/agent-approval-card.d.ts +14 -0
- package/dist/components/agent-approval-card.d.ts.map +1 -0
- package/dist/components/agent-approval-card.js +12 -0
- package/dist/components/agent-approval-card.js.map +1 -0
- package/dist/components/agent-ask-question.d.ts +18 -0
- package/dist/components/agent-ask-question.d.ts.map +1 -0
- package/dist/components/agent-ask-question.js +101 -0
- package/dist/components/agent-ask-question.js.map +1 -0
- package/dist/components/agent-aurora.d.ts +3 -0
- package/dist/components/agent-aurora.d.ts.map +1 -0
- package/dist/components/agent-aurora.js +60 -0
- package/dist/components/agent-aurora.js.map +1 -0
- package/dist/components/agent-changes.d.ts +26 -0
- package/dist/components/agent-changes.d.ts.map +1 -0
- package/dist/components/agent-changes.js +19 -0
- package/dist/components/agent-changes.js.map +1 -0
- package/dist/components/agent-chat/disclosure.d.ts +25 -0
- package/dist/components/agent-chat/disclosure.d.ts.map +1 -0
- package/dist/components/agent-chat/disclosure.js +39 -0
- package/dist/components/agent-chat/disclosure.js.map +1 -0
- package/dist/components/agent-chat/index.d.ts +140 -0
- package/dist/components/agent-chat/index.d.ts.map +1 -0
- package/dist/components/agent-chat/index.js +379 -0
- package/dist/components/agent-chat/index.js.map +1 -0
- package/dist/components/agent-chat/tool-diff.d.ts +32 -0
- package/dist/components/agent-chat/tool-diff.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-diff.js +97 -0
- package/dist/components/agent-chat/tool-diff.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/agents.d.ts +10 -0
- package/dist/components/agent-chat/tool-summary/agents.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/agents.js +100 -0
- package/dist/components/agent-chat/tool-summary/agents.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/diff.d.ts +22 -0
- package/dist/components/agent-chat/tool-summary/diff.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/diff.js +127 -0
- package/dist/components/agent-chat/tool-summary/diff.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/index.d.ts +145 -0
- package/dist/components/agent-chat/tool-summary/index.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/index.js +663 -0
- package/dist/components/agent-chat/tool-summary/index.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/parsers.d.ts +114 -0
- package/dist/components/agent-chat/tool-summary/parsers.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/parsers.js +502 -0
- package/dist/components/agent-chat/tool-summary/parsers.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/paths.d.ts +10 -0
- package/dist/components/agent-chat/tool-summary/paths.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/paths.js +88 -0
- package/dist/components/agent-chat/tool-summary/paths.js.map +1 -0
- package/dist/components/agent-chat/tool-summary/team.d.ts +16 -0
- package/dist/components/agent-chat/tool-summary/team.d.ts.map +1 -0
- package/dist/components/agent-chat/tool-summary/team.js +283 -0
- package/dist/components/agent-chat/tool-summary/team.js.map +1 -0
- package/dist/components/agent-command-output.d.ts +14 -0
- package/dist/components/agent-command-output.d.ts.map +1 -0
- package/dist/components/agent-command-output.js +22 -0
- package/dist/components/agent-command-output.js.map +1 -0
- package/dist/components/agent-composer.d.ts +34 -0
- package/dist/components/agent-composer.d.ts.map +1 -0
- package/dist/components/agent-composer.js +65 -0
- package/dist/components/agent-composer.js.map +1 -0
- package/dist/components/agent-context-usage.d.ts +28 -0
- package/dist/components/agent-context-usage.d.ts.map +1 -0
- package/dist/components/agent-context-usage.js +51 -0
- package/dist/components/agent-context-usage.js.map +1 -0
- package/dist/components/agent-conversation-layout.d.ts +30 -0
- package/dist/components/agent-conversation-layout.d.ts.map +1 -0
- package/dist/components/agent-conversation-layout.js +24 -0
- package/dist/components/agent-conversation-layout.js.map +1 -0
- package/dist/components/agent-hero-heading.d.ts +2 -0
- package/dist/components/agent-hero-heading.d.ts.map +1 -0
- package/dist/components/agent-hero-heading.js +20 -0
- package/dist/components/agent-hero-heading.js.map +1 -0
- package/dist/components/agent-image-lightbox.d.ts +11 -0
- package/dist/components/agent-image-lightbox.d.ts.map +1 -0
- package/dist/components/agent-image-lightbox.js +8 -0
- package/dist/components/agent-image-lightbox.js.map +1 -0
- package/dist/components/agent-prompt-queue.d.ts +14 -0
- package/dist/components/agent-prompt-queue.d.ts.map +1 -0
- package/dist/components/agent-prompt-queue.js +114 -0
- package/dist/components/agent-prompt-queue.js.map +1 -0
- package/dist/components/agent-pull-request-bar.d.ts +72 -0
- package/dist/components/agent-pull-request-bar.d.ts.map +1 -0
- package/dist/components/agent-pull-request-bar.js +90 -0
- package/dist/components/agent-pull-request-bar.js.map +1 -0
- package/dist/components/agent-quick-actions.d.ts +14 -0
- package/dist/components/agent-quick-actions.d.ts.map +1 -0
- package/dist/components/agent-quick-actions.js +12 -0
- package/dist/components/agent-quick-actions.js.map +1 -0
- package/dist/components/agent-session-row.d.ts +45 -0
- package/dist/components/agent-session-row.d.ts.map +1 -0
- package/dist/components/agent-session-row.js +34 -0
- package/dist/components/agent-session-row.js.map +1 -0
- package/dist/components/agent-welcome-hero-pointer.d.ts +3 -0
- package/dist/components/agent-welcome-hero-pointer.d.ts.map +1 -0
- package/dist/components/agent-welcome-hero-pointer.js +169 -0
- package/dist/components/agent-welcome-hero-pointer.js.map +1 -0
- package/dist/components/agent-welcome-hero.d.ts +9 -0
- package/dist/components/agent-welcome-hero.d.ts.map +1 -0
- package/dist/components/agent-welcome-hero.js +14 -0
- package/dist/components/agent-welcome-hero.js.map +1 -0
- package/dist/components/attachment-drop-zone.d.ts +15 -0
- package/dist/components/attachment-drop-zone.d.ts.map +1 -0
- package/dist/components/attachment-drop-zone.js +64 -0
- package/dist/components/attachment-drop-zone.js.map +1 -0
- package/dist/components/badge.d.ts +5 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +7 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.d.ts +27 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +209 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/generated-media.d.ts +12 -0
- package/dist/components/generated-media.d.ts.map +1 -0
- package/dist/components/generated-media.js +105 -0
- package/dist/components/generated-media.js.map +1 -0
- package/dist/components/github-icon.d.ts +3 -0
- package/dist/components/github-icon.d.ts.map +1 -0
- package/dist/components/github-icon.js +6 -0
- package/dist/components/github-icon.js.map +1 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +25 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/markdown.d.ts +48 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +264 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/mermaid-block.d.ts +14 -0
- package/dist/components/mermaid-block.d.ts.map +1 -0
- package/dist/components/mermaid-block.js +339 -0
- package/dist/components/mermaid-block.js.map +1 -0
- package/dist/components/mermaid-diagram.d.ts +264 -0
- package/dist/components/mermaid-diagram.d.ts.map +1 -0
- package/dist/components/mermaid-diagram.js +999 -0
- package/dist/components/mermaid-diagram.js.map +1 -0
- package/dist/components/mermaid-dom.d.ts +51 -0
- package/dist/components/mermaid-dom.d.ts.map +1 -0
- package/dist/components/mermaid-dom.js +246 -0
- package/dist/components/mermaid-dom.js.map +1 -0
- package/dist/components/message-scroller.d.ts +23 -0
- package/dist/components/message-scroller.d.ts.map +1 -0
- package/dist/components/message-scroller.js +31 -0
- package/dist/components/message-scroller.js.map +1 -0
- package/dist/components/search-combobox.d.ts +44 -0
- package/dist/components/search-combobox.d.ts.map +1 -0
- package/dist/components/search-combobox.js +191 -0
- package/dist/components/search-combobox.js.map +1 -0
- package/dist/components/session-status.d.ts +9 -0
- package/dist/components/session-status.d.ts.map +1 -0
- package/dist/components/session-status.js +11 -0
- package/dist/components/session-status.js.map +1 -0
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +14 -0
- package/dist/components/switch.js.map +1 -0
- package/package.json +177 -5
- package/theme/base.css +83 -0
- package/theme/component-theme.css +126 -0
- package/theme/index.css +3 -0
- package/theme/palette.css +347 -0
- package/theme/scoped-tokens.css +503 -0
- package/theme/theme.css +90 -0
- package/theme/tokens.css +165 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { isRecord, normalizeValue } from "./parsers.js";
|
|
2
|
+
|
|
3
|
+
export type ToolAggregate = {
|
|
4
|
+
key: string;
|
|
5
|
+
count: number;
|
|
6
|
+
noun: string;
|
|
7
|
+
pluralNoun?: string;
|
|
8
|
+
completedVerb: string;
|
|
9
|
+
progressVerb: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type TeamSummaryResult = {
|
|
13
|
+
label: string;
|
|
14
|
+
details: string[];
|
|
15
|
+
aggregate?: ToolAggregate;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function pluralize(
|
|
19
|
+
count: number,
|
|
20
|
+
singular: string,
|
|
21
|
+
plural = `${singular}s`,
|
|
22
|
+
): string {
|
|
23
|
+
return `${count} ${count === 1 ? singular : plural}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
27
|
+
return isRecord(value) ? value : null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function resultRecords(result: unknown): Record<string, unknown>[] {
|
|
31
|
+
const normalized = normalizeValue(result);
|
|
32
|
+
if (Array.isArray(normalized)) {
|
|
33
|
+
return normalized
|
|
34
|
+
.map(asRecord)
|
|
35
|
+
.filter((item): item is Record<string, unknown> => item !== null);
|
|
36
|
+
}
|
|
37
|
+
const record = asRecord(normalized);
|
|
38
|
+
return record ? [record] : [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function recordString(
|
|
42
|
+
record: Record<string, unknown> | null | undefined,
|
|
43
|
+
key: string,
|
|
44
|
+
fallback = "",
|
|
45
|
+
): string {
|
|
46
|
+
const value = record?.[key];
|
|
47
|
+
return typeof value === "string" && value.length > 0 ? value : fallback;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function teamSummary(
|
|
51
|
+
toolName: string,
|
|
52
|
+
input: unknown,
|
|
53
|
+
result: unknown,
|
|
54
|
+
inProgress: boolean,
|
|
55
|
+
isError: boolean,
|
|
56
|
+
): TeamSummaryResult | null {
|
|
57
|
+
if (!toolName.startsWith("team_")) return null;
|
|
58
|
+
if (isError) {
|
|
59
|
+
const failureLabels: Record<string, string> = {
|
|
60
|
+
team_attach_outcome_fragment: "Failed to attach outcome fragment",
|
|
61
|
+
team_await_runs: "Failed while waiting for teammates",
|
|
62
|
+
team_broadcast: "Failed to broadcast message to teammates",
|
|
63
|
+
team_cancel_run: "Failed to cancel teammate run",
|
|
64
|
+
team_cleanup: "Failed to clean up team",
|
|
65
|
+
team_create_outcome: "Failed to create team outcome",
|
|
66
|
+
team_finalize_outcome: "Failed to finalize team outcome",
|
|
67
|
+
team_list_outcomes: "Failed to list team outcomes",
|
|
68
|
+
team_list_runs: "Failed to list teammate runs",
|
|
69
|
+
team_mission_log: "Failed to update mission log",
|
|
70
|
+
team_read_mailbox: "Failed to read team mailbox",
|
|
71
|
+
team_review_outcome_fragment: "Failed to review outcome fragment",
|
|
72
|
+
team_run_task: "Failed to assign team task",
|
|
73
|
+
team_send_message: "Failed to send message",
|
|
74
|
+
team_shutdown_teammate: "Failed to stop teammate",
|
|
75
|
+
team_spawn_teammate: "Failed to spawn teammate",
|
|
76
|
+
team_status: "Failed to check team status",
|
|
77
|
+
team_task: "Failed to update team task",
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
label: failureLabels[toolName] ?? `Failed ${toolName}`,
|
|
81
|
+
details: [],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const inputRecord = asRecord(normalizeValue(input));
|
|
85
|
+
const records = resultRecords(result);
|
|
86
|
+
const resultRecord = records[0];
|
|
87
|
+
const aggregate = (
|
|
88
|
+
key: string,
|
|
89
|
+
noun: string,
|
|
90
|
+
completedVerb: string,
|
|
91
|
+
progressVerb: string,
|
|
92
|
+
details: string[],
|
|
93
|
+
pluralNoun?: string,
|
|
94
|
+
count = 1,
|
|
95
|
+
): TeamSummaryResult => ({
|
|
96
|
+
label: `${inProgress ? progressVerb : completedVerb} ${pluralize(
|
|
97
|
+
count,
|
|
98
|
+
noun,
|
|
99
|
+
pluralNoun,
|
|
100
|
+
)}`,
|
|
101
|
+
aggregate: {
|
|
102
|
+
key,
|
|
103
|
+
count,
|
|
104
|
+
noun,
|
|
105
|
+
pluralNoun,
|
|
106
|
+
completedVerb,
|
|
107
|
+
progressVerb,
|
|
108
|
+
},
|
|
109
|
+
details,
|
|
110
|
+
});
|
|
111
|
+
const agentId = recordString(
|
|
112
|
+
resultRecord,
|
|
113
|
+
"agentId",
|
|
114
|
+
recordString(inputRecord, "agentId"),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
switch (toolName) {
|
|
118
|
+
case "team_spawn_teammate":
|
|
119
|
+
return aggregate(
|
|
120
|
+
"team-spawn",
|
|
121
|
+
"teammate",
|
|
122
|
+
"Spawned",
|
|
123
|
+
"Spawning",
|
|
124
|
+
agentId ? [agentId] : [],
|
|
125
|
+
);
|
|
126
|
+
case "team_run_task": {
|
|
127
|
+
const mode = recordString(
|
|
128
|
+
resultRecord,
|
|
129
|
+
"mode",
|
|
130
|
+
recordString(inputRecord, "runMode", "sync"),
|
|
131
|
+
);
|
|
132
|
+
const status = inProgress
|
|
133
|
+
? "assigning"
|
|
134
|
+
: recordString(resultRecord, "status", "assigned");
|
|
135
|
+
return aggregate(
|
|
136
|
+
"team-run-task",
|
|
137
|
+
"team task",
|
|
138
|
+
"Assigned",
|
|
139
|
+
"Assigning",
|
|
140
|
+
[mode, agentId, status].filter(Boolean).join(" ")
|
|
141
|
+
? [[mode, agentId, status].filter(Boolean).join(" ")]
|
|
142
|
+
: [],
|
|
143
|
+
"team tasks",
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
case "team_await_runs": {
|
|
147
|
+
const details = records.map((run) =>
|
|
148
|
+
[
|
|
149
|
+
recordString(run, "agentId", recordString(run, "id")),
|
|
150
|
+
recordString(run, "status"),
|
|
151
|
+
]
|
|
152
|
+
.filter(Boolean)
|
|
153
|
+
.join(" "),
|
|
154
|
+
);
|
|
155
|
+
return {
|
|
156
|
+
label: inProgress ? "Waiting for teammates" : "Waited for teammates",
|
|
157
|
+
details,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
case "team_shutdown_teammate":
|
|
161
|
+
return aggregate(
|
|
162
|
+
"team-shutdown",
|
|
163
|
+
"teammate",
|
|
164
|
+
"Stopped",
|
|
165
|
+
"Stopping",
|
|
166
|
+
agentId ? [agentId] : [],
|
|
167
|
+
);
|
|
168
|
+
case "team_status": {
|
|
169
|
+
const members = Array.isArray(resultRecord?.members)
|
|
170
|
+
? resultRecord.members
|
|
171
|
+
.map(asRecord)
|
|
172
|
+
.filter((item): item is Record<string, unknown> => item !== null)
|
|
173
|
+
: [];
|
|
174
|
+
return {
|
|
175
|
+
label: inProgress ? "Checking team status" : "Checked team status",
|
|
176
|
+
details: members.map((member) =>
|
|
177
|
+
[recordString(member, "agentId"), recordString(member, "status")]
|
|
178
|
+
.filter(Boolean)
|
|
179
|
+
.join(" "),
|
|
180
|
+
),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
case "team_task": {
|
|
184
|
+
const action = recordString(
|
|
185
|
+
inputRecord,
|
|
186
|
+
"action",
|
|
187
|
+
recordString(resultRecord, "action", "update"),
|
|
188
|
+
);
|
|
189
|
+
const verbs: Record<string, [string, string]> = {
|
|
190
|
+
create: ["Created", "Creating"],
|
|
191
|
+
list: ["Listed", "Listing"],
|
|
192
|
+
claim: ["Claimed", "Claiming"],
|
|
193
|
+
complete: ["Completed", "Completing"],
|
|
194
|
+
block: ["Blocked", "Blocking"],
|
|
195
|
+
};
|
|
196
|
+
const [completedVerb, progressVerb] = verbs[action] ?? [
|
|
197
|
+
"Updated",
|
|
198
|
+
"Updating",
|
|
199
|
+
];
|
|
200
|
+
const tasks = Array.isArray(resultRecord?.tasks)
|
|
201
|
+
? resultRecord.tasks
|
|
202
|
+
.map(asRecord)
|
|
203
|
+
.filter((item): item is Record<string, unknown> => item !== null)
|
|
204
|
+
: records;
|
|
205
|
+
const details = tasks.map((task) =>
|
|
206
|
+
[
|
|
207
|
+
recordString(
|
|
208
|
+
task,
|
|
209
|
+
"taskId",
|
|
210
|
+
recordString(task, "id", recordString(inputRecord, "taskId")),
|
|
211
|
+
),
|
|
212
|
+
recordString(task, "title", recordString(inputRecord, "title")),
|
|
213
|
+
recordString(task, "status"),
|
|
214
|
+
]
|
|
215
|
+
.filter(Boolean)
|
|
216
|
+
.join(" "),
|
|
217
|
+
);
|
|
218
|
+
return aggregate(
|
|
219
|
+
`team-task-${action}`,
|
|
220
|
+
"team task",
|
|
221
|
+
completedVerb,
|
|
222
|
+
progressVerb,
|
|
223
|
+
details,
|
|
224
|
+
undefined,
|
|
225
|
+
action === "list" ? tasks.length : 1,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
case "team_list_runs":
|
|
229
|
+
return {
|
|
230
|
+
label: inProgress
|
|
231
|
+
? "Listing teammate runs"
|
|
232
|
+
: `Listed ${pluralize(records.length, "teammate run")}`,
|
|
233
|
+
details: records.map((run) =>
|
|
234
|
+
[recordString(run, "agentId"), recordString(run, "status")]
|
|
235
|
+
.filter(Boolean)
|
|
236
|
+
.join(" "),
|
|
237
|
+
),
|
|
238
|
+
};
|
|
239
|
+
case "team_cancel_run":
|
|
240
|
+
return {
|
|
241
|
+
label: inProgress
|
|
242
|
+
? "Cancelling teammate run"
|
|
243
|
+
: "Cancelled teammate run",
|
|
244
|
+
details: [
|
|
245
|
+
[
|
|
246
|
+
recordString(
|
|
247
|
+
resultRecord,
|
|
248
|
+
"runId",
|
|
249
|
+
recordString(inputRecord, "runId"),
|
|
250
|
+
),
|
|
251
|
+
recordString(resultRecord, "status"),
|
|
252
|
+
]
|
|
253
|
+
.filter(Boolean)
|
|
254
|
+
.join(" "),
|
|
255
|
+
].filter(Boolean),
|
|
256
|
+
};
|
|
257
|
+
case "team_send_message": {
|
|
258
|
+
const recipient = recordString(
|
|
259
|
+
resultRecord,
|
|
260
|
+
"toAgentId",
|
|
261
|
+
recordString(inputRecord, "toAgentId"),
|
|
262
|
+
);
|
|
263
|
+
return aggregate(
|
|
264
|
+
"team-send-message",
|
|
265
|
+
"message",
|
|
266
|
+
"Sent",
|
|
267
|
+
"Sending",
|
|
268
|
+
[recipient, recordString(inputRecord, "subject")].filter(Boolean).length
|
|
269
|
+
? [
|
|
270
|
+
[recipient, recordString(inputRecord, "subject")]
|
|
271
|
+
.filter(Boolean)
|
|
272
|
+
.join(" "),
|
|
273
|
+
]
|
|
274
|
+
: [],
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
case "team_broadcast": {
|
|
278
|
+
const delivered = resultRecord?.delivered;
|
|
279
|
+
return {
|
|
280
|
+
label: inProgress
|
|
281
|
+
? "Broadcasting message to teammates"
|
|
282
|
+
: `Broadcast message to ${pluralize(typeof delivered === "number" ? delivered : 0, "teammate")}`,
|
|
283
|
+
details: recordString(inputRecord, "subject")
|
|
284
|
+
? [recordString(inputRecord, "subject")]
|
|
285
|
+
: [],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
case "team_read_mailbox":
|
|
289
|
+
return {
|
|
290
|
+
label: inProgress
|
|
291
|
+
? "Reading team mailbox"
|
|
292
|
+
: `Read ${pluralize(records.length, "team message")}`,
|
|
293
|
+
details: records.map((message) =>
|
|
294
|
+
[
|
|
295
|
+
recordString(message, "fromAgentId"),
|
|
296
|
+
recordString(message, "subject"),
|
|
297
|
+
]
|
|
298
|
+
.filter(Boolean)
|
|
299
|
+
.join(" "),
|
|
300
|
+
),
|
|
301
|
+
};
|
|
302
|
+
case "team_mission_log":
|
|
303
|
+
return {
|
|
304
|
+
label: inProgress ? "Updating mission log" : "Updated mission log",
|
|
305
|
+
details: [
|
|
306
|
+
[
|
|
307
|
+
recordString(inputRecord, "kind"),
|
|
308
|
+
recordString(inputRecord, "summary"),
|
|
309
|
+
]
|
|
310
|
+
.filter(Boolean)
|
|
311
|
+
.join(" "),
|
|
312
|
+
].filter(Boolean),
|
|
313
|
+
};
|
|
314
|
+
case "team_cleanup":
|
|
315
|
+
return {
|
|
316
|
+
label: inProgress ? "Cleaning up team" : "Cleaned up team",
|
|
317
|
+
details: recordString(resultRecord, "status")
|
|
318
|
+
? [recordString(resultRecord, "status")]
|
|
319
|
+
: [],
|
|
320
|
+
};
|
|
321
|
+
case "team_create_outcome":
|
|
322
|
+
return {
|
|
323
|
+
label: inProgress ? "Creating team outcome" : "Created team outcome",
|
|
324
|
+
details: [
|
|
325
|
+
[
|
|
326
|
+
recordString(resultRecord, "outcomeId"),
|
|
327
|
+
recordString(inputRecord, "title"),
|
|
328
|
+
recordString(resultRecord, "status"),
|
|
329
|
+
]
|
|
330
|
+
.filter(Boolean)
|
|
331
|
+
.join(" "),
|
|
332
|
+
].filter(Boolean),
|
|
333
|
+
};
|
|
334
|
+
case "team_attach_outcome_fragment":
|
|
335
|
+
return {
|
|
336
|
+
label: inProgress
|
|
337
|
+
? "Attaching outcome fragment"
|
|
338
|
+
: "Attached outcome fragment",
|
|
339
|
+
details: [
|
|
340
|
+
[
|
|
341
|
+
recordString(inputRecord, "section"),
|
|
342
|
+
recordString(resultRecord, "status"),
|
|
343
|
+
]
|
|
344
|
+
.filter(Boolean)
|
|
345
|
+
.join(" "),
|
|
346
|
+
].filter(Boolean),
|
|
347
|
+
};
|
|
348
|
+
case "team_review_outcome_fragment":
|
|
349
|
+
return {
|
|
350
|
+
label: inProgress
|
|
351
|
+
? "Reviewing outcome fragment"
|
|
352
|
+
: "Reviewed outcome fragment",
|
|
353
|
+
details: [
|
|
354
|
+
[
|
|
355
|
+
recordString(inputRecord, "fragmentId"),
|
|
356
|
+
typeof inputRecord?.approved === "boolean"
|
|
357
|
+
? inputRecord.approved
|
|
358
|
+
? "approved"
|
|
359
|
+
: "rejected"
|
|
360
|
+
: recordString(resultRecord, "status"),
|
|
361
|
+
]
|
|
362
|
+
.filter(Boolean)
|
|
363
|
+
.join(" "),
|
|
364
|
+
].filter(Boolean),
|
|
365
|
+
};
|
|
366
|
+
case "team_finalize_outcome":
|
|
367
|
+
return {
|
|
368
|
+
label: inProgress
|
|
369
|
+
? "Finalizing team outcome"
|
|
370
|
+
: "Finalized team outcome",
|
|
371
|
+
details: [
|
|
372
|
+
[
|
|
373
|
+
recordString(
|
|
374
|
+
resultRecord,
|
|
375
|
+
"outcomeId",
|
|
376
|
+
recordString(inputRecord, "outcomeId"),
|
|
377
|
+
),
|
|
378
|
+
recordString(resultRecord, "status"),
|
|
379
|
+
]
|
|
380
|
+
.filter(Boolean)
|
|
381
|
+
.join(" "),
|
|
382
|
+
].filter(Boolean),
|
|
383
|
+
};
|
|
384
|
+
case "team_list_outcomes":
|
|
385
|
+
return {
|
|
386
|
+
label: inProgress
|
|
387
|
+
? "Listing team outcomes"
|
|
388
|
+
: `Listed ${pluralize(records.length, "team outcome")}`,
|
|
389
|
+
details: records.map((outcome) =>
|
|
390
|
+
[
|
|
391
|
+
recordString(outcome, "title", recordString(outcome, "id")),
|
|
392
|
+
recordString(outcome, "status"),
|
|
393
|
+
]
|
|
394
|
+
.filter(Boolean)
|
|
395
|
+
.join(" "),
|
|
396
|
+
),
|
|
397
|
+
};
|
|
398
|
+
default:
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { type ReactNode, useEffect, useRef } from "react";
|
|
4
|
+
|
|
5
|
+
export interface AgentCommandOutputProps {
|
|
6
|
+
output: string;
|
|
7
|
+
isRunning: boolean;
|
|
8
|
+
/** Hosts retain ANSI rendering or control-character normalization. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
tabIndex?: number;
|
|
11
|
+
classNames?: { viewport?: string; cursor?: string };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function AgentCommandOutput({
|
|
15
|
+
output,
|
|
16
|
+
isRunning,
|
|
17
|
+
children = output,
|
|
18
|
+
tabIndex,
|
|
19
|
+
classNames,
|
|
20
|
+
}: AgentCommandOutputProps) {
|
|
21
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
const shouldAutoScrollRef = useRef(true);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const container = containerRef.current;
|
|
25
|
+
if (container && shouldAutoScrollRef.current) {
|
|
26
|
+
container.scrollTop = output ? container.scrollHeight : 0;
|
|
27
|
+
}
|
|
28
|
+
}, [output]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="mt-2 space-y-1">
|
|
32
|
+
<div className="text-[11px] uppercase tracking-wide text-cline-ui-muted-foreground/80">
|
|
33
|
+
Output
|
|
34
|
+
</div>
|
|
35
|
+
<div
|
|
36
|
+
aria-label="Command output"
|
|
37
|
+
aria-live="off"
|
|
38
|
+
className={`max-h-64 overflow-auto rounded-md border border-cline-ui-border/70 bg-black/90 p-3 font-cline-ui-mono text-cline-ui-xs leading-relaxed text-zinc-100${classNames?.viewport ? ` ${classNames.viewport}` : ""}`}
|
|
39
|
+
onScroll={(event) => {
|
|
40
|
+
const container = event.currentTarget;
|
|
41
|
+
shouldAutoScrollRef.current =
|
|
42
|
+
container.scrollHeight -
|
|
43
|
+
container.scrollTop -
|
|
44
|
+
container.clientHeight <
|
|
45
|
+
24;
|
|
46
|
+
}}
|
|
47
|
+
ref={containerRef}
|
|
48
|
+
role="log"
|
|
49
|
+
tabIndex={tabIndex}
|
|
50
|
+
>
|
|
51
|
+
<pre className="whitespace-pre-wrap break-words">
|
|
52
|
+
{children}
|
|
53
|
+
{isRunning ? (
|
|
54
|
+
<span
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
className={`ml-0.5 inline-block h-3 w-1.5 animate-pulse bg-zinc-100${classNames?.cursor ? ` ${classNames.cursor}` : ""}`}
|
|
57
|
+
/>
|
|
58
|
+
) : null}
|
|
59
|
+
</pre>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|