@kingsoftcloud/agentkit-harness-ui 0.0.0-stage → 0.0.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 +201 -0
- package/NOTICE +116 -0
- package/README.md +292 -2
- package/markdown/build/build-markdown.cjs +66 -0
- package/markdown/dist/THIRD_PARTY_LICENSES.txt +2993 -0
- package/markdown/dist/markdown.css +1 -0
- package/markdown/dist/markdown.mjs +325 -0
- package/markdown/source/markdown-factory.mjs +613 -0
- package/markdown/source/markdown.css +288 -0
- package/markdown/source/table-factory.mjs +1588 -0
- package/markdown/source/table.css +487 -0
- package/package.json +96 -4
- package/src/activity-groups.mjs +74 -0
- package/src/browser-response-groups.mjs +57 -0
- package/src/command-output.mjs +57 -0
- package/src/components.mjs +9 -0
- package/src/context-markers.mjs +19 -0
- package/src/context-status.mjs +34 -0
- package/src/diff.mjs +240 -0
- package/src/explore-tool-call.mjs +139 -0
- package/src/file-preview.mjs +50 -0
- package/src/host/native-a2a.mjs +90 -0
- package/src/host/native-child-file-pane.mjs +49 -0
- package/src/host/native-child-pane.mjs +94 -0
- package/src/host/native-command-pane.mjs +64 -0
- package/src/host/native-run-panel.mjs +202 -0
- package/src/host/session-task-events.mjs +247 -0
- package/src/host/state/native-a2a.mjs +122 -0
- package/src/host/state/native-child-observation.mjs +35 -0
- package/src/host/state/native-children.mjs +93 -0
- package/src/host/state/native-outcome.mjs +35 -0
- package/src/host/state/native-recovery.mjs +187 -0
- package/src/host/state/native-runtime-route.mjs +26 -0
- package/src/host/state/native-session-stop.mjs +40 -0
- package/src/host/state/native-status-panel.mjs +23 -0
- package/src/host/state/native-task-read-model.mjs +89 -0
- package/src/host/state/task-links.mjs +40 -0
- package/src/host/task-timeline.mjs +185 -0
- package/src/index.mjs +52 -0
- package/src/input-preview.mjs +44 -0
- package/src/inspector.mjs +40 -0
- package/src/project.mjs +132 -0
- package/src/protocol.mjs +362 -0
- package/src/react-binding.mjs +486 -0
- package/src/reducer.mjs +355 -0
- package/src/renderers.mjs +644 -0
- package/src/status-panel.mjs +1156 -0
- package/src/styles.mjs +278 -0
- package/src/summary-playback.mjs +39 -0
- package/src/summary.mjs +160 -0
- package/src/terminal.mjs +157 -0
- package/src/tool-detail.mjs +208 -0
- package/src/tool-error.mjs +33 -0
- package/src/tool-identity.mjs +40 -0
- package/src/view.mjs +364 -0
- package/src/work-segments.mjs +41 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Completion is declared by the Host; a text row alone never closes a task.
|
|
2
|
+
* This is a view over immutable transcript rows, not a second task lifecycle. */
|
|
3
|
+
export function conversationWorkSegments(state, items) {
|
|
4
|
+
const segments = [];
|
|
5
|
+
let segment = { id: `work:${state.taskId ?? 'task'}:start`, inputs: [], work: [] };
|
|
6
|
+
for (const item of items) {
|
|
7
|
+
if (item.kind === 'text' && item.role === 'user') {
|
|
8
|
+
if (segment.work.length) { segments.push(segment); segment = { id: `work:${state.taskId ?? 'task'}:${item.id}`, inputs: [], work: [] }; }
|
|
9
|
+
segment.inputs.push(item);
|
|
10
|
+
} else segment.work.push(item);
|
|
11
|
+
}
|
|
12
|
+
if (segment.inputs.length || segment.work.length) segments.push(segment);
|
|
13
|
+
const closed = ['completed', 'unverified'].includes(state.taskState) && !state.taskError;
|
|
14
|
+
return segments.map((segment, index) => {
|
|
15
|
+
const rows = segment.work;
|
|
16
|
+
const candidate = rows.find(item => item.id === state.finalAnswerId)
|
|
17
|
+
?? (state.taskState === 'completed' && index === segments.length - 1 ? rows.at(-1) : null);
|
|
18
|
+
const final = closed && candidate?.kind === 'text' && candidate.role !== 'user' && !candidate.streaming ? candidate : null;
|
|
19
|
+
const answerIndex = final ? rows.findIndex(item => item.kind === 'text' && (item.id === final.id
|
|
20
|
+
|| final.sourceMessageId && item.sourceMessageId === final.sourceMessageId)) : -1;
|
|
21
|
+
const process = answerIndex >= 0 ? rows.slice(0, answerIndex) : rows;
|
|
22
|
+
const unresolved = rows.some(item => item.kind === 'tool' && ['scheduled', 'running', 'waiting', 'uncertain', 'interrupted'].includes(item.status));
|
|
23
|
+
return { ...segment, process, following: answerIndex >= 0 ? rows.slice(answerIndex) : [],
|
|
24
|
+
collapsible: closed && answerIndex >= 0 && process.length > 0 && !unresolved };
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Use only committed Host times. History without timing has a plain label. */
|
|
29
|
+
export function completedWorkLabel(state, locale) {
|
|
30
|
+
const zh = String(locale ?? '').startsWith('zh');
|
|
31
|
+
const start = state.taskStartedAt, end = state.taskEndedAt;
|
|
32
|
+
if (![start, end].every(value => typeof value === 'number' && Number.isFinite(value) && value >= 0) || end < start)
|
|
33
|
+
return zh ? '已工作' : 'Worked';
|
|
34
|
+
let seconds = Math.max(1, Math.round((end - start) / 1000));
|
|
35
|
+
const parts = [];
|
|
36
|
+
for (const [size, cn, en] of [[86400, '天', 'd'], [3600, '时', 'h'], [60, '分', 'm'], [1, '秒', 's']]) {
|
|
37
|
+
const value = Math.floor(seconds / size); seconds %= size;
|
|
38
|
+
if (value) parts.push(zh ? `${value} ${cn}` : `${value}${en}`);
|
|
39
|
+
}
|
|
40
|
+
return `${zh ? '已工作' : 'Worked'} ${parts.slice(0, 2).join(' ')}`;
|
|
41
|
+
}
|