osagent 0.1.40 → 0.1.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osagent",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "OSAgent - AI Coding Assistant powered by Ollama",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,4 +4,4 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  export declare const GIT_COMMIT_INFO = "d8c8718";
7
- export declare const CLI_VERSION = "0.1.40";
7
+ export declare const CLI_VERSION = "0.1.41";
@@ -6,5 +6,5 @@
6
6
  // This file is auto-generated by the build script (scripts/generate-git-commit-info.js)
7
7
  // Do not edit this file manually.
8
8
  export const GIT_COMMIT_INFO = 'd8c8718';
9
- export const CLI_VERSION = '0.1.40';
9
+ export const CLI_VERSION = '0.1.41';
10
10
  //# sourceMappingURL=git-commit.js.map
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 OSAgent OC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import React from 'react';
7
+ export interface AgentExecutionSummary {
8
+ id: string;
9
+ name: string;
10
+ description: string;
11
+ status: 'running' | 'completed' | 'failed' | 'cancelled';
12
+ toolUses: number;
13
+ tokenCount: number;
14
+ durationMs?: number;
15
+ error?: string;
16
+ }
17
+ export interface MultiAgentSummaryProps {
18
+ agents: AgentExecutionSummary[];
19
+ groupLabel?: string;
20
+ expandable?: boolean;
21
+ defaultExpanded?: boolean;
22
+ }
23
+ /**
24
+ * Displays a summary of multiple parallel agent executions.
25
+ * Shows a collapsed view with count and expand hint, or expanded view with details.
26
+ *
27
+ * Example collapsed:
28
+ * ● 3 Explore agents finished (ctrl+o to expand)
29
+ *
30
+ * Example expanded:
31
+ * ● 3 Explore agents finished (ctrl+o to expand)
32
+ * ├─ Audit core backend services · 38 tool uses · 94.0k tokens
33
+ * │ └ Done
34
+ * ├─ Explore orchestration system · 14 tool uses · 50.0k tokens
35
+ * │ └ Done
36
+ * └─ Explore CLI frontend architecture · 44 tool uses · 74.0k tokens
37
+ * └ Done
38
+ */
39
+ export declare const MultiAgentSummary: React.FC<MultiAgentSummaryProps>;
40
+ /**
41
+ * Hook to track multiple parallel agent executions
42
+ */
43
+ export declare function useMultiAgentTracking(): {
44
+ agents: AgentExecutionSummary[];
45
+ addAgent: (agent: AgentExecutionSummary) => void;
46
+ updateAgent: (id: string, updates: Partial<AgentExecutionSummary>) => void;
47
+ removeAgent: (id: string) => void;
48
+ clearAgents: () => void;
49
+ };
50
+ export default MultiAgentSummary;
@@ -0,0 +1,131 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @license
4
+ * Copyright 2025 OSAgent OC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ import React, { useState, useMemo, useCallback } from 'react';
8
+ import { Box, Text } from 'ink';
9
+ import { theme } from '../../../semantic-colors.js';
10
+ import { Colors } from '../../../colors.js';
11
+ import { useKeypress } from '../../../hooks/useKeypress.js';
12
+ /**
13
+ * Displays a summary of multiple parallel agent executions.
14
+ * Shows a collapsed view with count and expand hint, or expanded view with details.
15
+ *
16
+ * Example collapsed:
17
+ * ● 3 Explore agents finished (ctrl+o to expand)
18
+ *
19
+ * Example expanded:
20
+ * ● 3 Explore agents finished (ctrl+o to expand)
21
+ * ├─ Audit core backend services · 38 tool uses · 94.0k tokens
22
+ * │ └ Done
23
+ * ├─ Explore orchestration system · 14 tool uses · 50.0k tokens
24
+ * │ └ Done
25
+ * └─ Explore CLI frontend architecture · 44 tool uses · 74.0k tokens
26
+ * └ Done
27
+ */
28
+ export const MultiAgentSummary = ({ agents, groupLabel = 'agents', expandable = true, defaultExpanded = false, }) => {
29
+ const [expanded, setExpanded] = useState(defaultExpanded);
30
+ const completedCount = useMemo(() => agents.filter(a => a.status === 'completed').length, [agents]);
31
+ const runningCount = useMemo(() => agents.filter(a => a.status === 'running').length, [agents]);
32
+ const failedCount = useMemo(() => agents.filter(a => a.status === 'failed').length, [agents]);
33
+ const allDone = runningCount === 0;
34
+ const hasFailures = failedCount > 0;
35
+ // Determine status color
36
+ const statusColor = useMemo(() => {
37
+ if (runningCount > 0)
38
+ return Colors.AccentYellow;
39
+ if (hasFailures)
40
+ return Colors.AccentRed;
41
+ return Colors.AccentBlue;
42
+ }, [runningCount, hasFailures]);
43
+ // Format token count (e.g., 94000 -> "94.0k")
44
+ const formatTokens = (count) => {
45
+ if (count >= 1000) {
46
+ return `${(count / 1000).toFixed(1)}k`;
47
+ }
48
+ return String(count);
49
+ };
50
+ // Generate summary text
51
+ const summaryText = useMemo(() => {
52
+ if (runningCount > 0) {
53
+ return `${agents.length} ${groupLabel} running`;
54
+ }
55
+ if (allDone && !hasFailures) {
56
+ return `${completedCount} ${groupLabel} finished`;
57
+ }
58
+ if (hasFailures) {
59
+ return `${completedCount} finished, ${failedCount} failed`;
60
+ }
61
+ return `${agents.length} ${groupLabel}`;
62
+ }, [agents.length, groupLabel, runningCount, allDone, hasFailures, completedCount, failedCount]);
63
+ // Handle keyboard shortcut for expand/collapse
64
+ const handleKeypress = useCallback((key) => {
65
+ if (expandable && key.ctrl && key.name === 'o') {
66
+ setExpanded(prev => !prev);
67
+ }
68
+ }, [expandable]);
69
+ useKeypress(handleKeypress, { isActive: expandable });
70
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: statusColor, children: "\u25CF " }), _jsx(Text, { bold: true, color: statusColor, children: summaryText }), expandable && (_jsxs(Text, { color: theme.text.secondary, children: [' ', "(ctrl+o to ", expanded ? 'collapse' : 'expand', ")"] }))] }), expanded && (_jsx(Box, { flexDirection: "column", marginLeft: 2, children: agents.map((agent, index) => {
71
+ const isLast = index === agents.length - 1;
72
+ const prefix = isLast ? '└─' : '├─';
73
+ const statusPrefix = isLast ? ' ' : '│ ';
74
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: theme.text.secondary, children: [prefix, " "] }), _jsx(Text, { bold: true, children: agent.description || agent.name }), _jsxs(Text, { color: theme.text.secondary, children: [' ', "\u00B7 ", agent.toolUses, " tool uses \u00B7 ", formatTokens(agent.tokenCount), " tokens"] })] }), _jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: theme.text.secondary, children: [statusPrefix, "\u2514 "] }), _jsx(AgentStatusText, { status: agent.status, error: agent.error })] })] }, agent.id));
75
+ }) })), !expanded && allDone && (_jsx(Box, { flexDirection: "row", marginLeft: 2, children: _jsxs(Text, { color: theme.text.secondary, children: ["Total: ", agents.reduce((sum, a) => sum + a.toolUses, 0), " tool uses \u00B7 ", ' ', formatTokens(agents.reduce((sum, a) => sum + a.tokenCount, 0)), " tokens"] }) }))] }));
76
+ };
77
+ /**
78
+ * Status text component for individual agents
79
+ */
80
+ const AgentStatusText = ({ status, error }) => {
81
+ switch (status) {
82
+ case 'running':
83
+ return _jsx(Text, { color: Colors.AccentYellow, children: "Running..." });
84
+ case 'completed':
85
+ return _jsx(Text, { color: Colors.AccentGreen, children: "Done" });
86
+ case 'failed':
87
+ return (_jsxs(Text, { color: Colors.AccentRed, children: ["Failed", error ? `: ${error}` : ''] }));
88
+ case 'cancelled':
89
+ return _jsx(Text, { color: Colors.AccentYellow, children: "Cancelled" });
90
+ default:
91
+ return _jsx(Text, { color: theme.text.secondary, children: "Unknown" });
92
+ }
93
+ };
94
+ /**
95
+ * Hook to track multiple parallel agent executions
96
+ */
97
+ export function useMultiAgentTracking() {
98
+ const [agents, setAgents] = useState(new Map());
99
+ const addAgent = (agent) => {
100
+ setAgents(prev => new Map(prev).set(agent.id, agent));
101
+ };
102
+ const updateAgent = (id, updates) => {
103
+ setAgents(prev => {
104
+ const updated = new Map(prev);
105
+ const existing = updated.get(id);
106
+ if (existing) {
107
+ updated.set(id, { ...existing, ...updates });
108
+ }
109
+ return updated;
110
+ });
111
+ };
112
+ const removeAgent = (id) => {
113
+ setAgents(prev => {
114
+ const updated = new Map(prev);
115
+ updated.delete(id);
116
+ return updated;
117
+ });
118
+ };
119
+ const clearAgents = () => {
120
+ setAgents(new Map());
121
+ };
122
+ return {
123
+ agents: Array.from(agents.values()),
124
+ addAgent,
125
+ updateAgent,
126
+ removeAgent,
127
+ clearAgents,
128
+ };
129
+ }
130
+ export default MultiAgentSummary;
131
+ //# sourceMappingURL=MultiAgentSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiAgentSummary.js","sourceRoot":"","sources":["../../../../../../src/ui/components/subagents/runtime/MultiAgentSummary.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAoB5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,MAAM,EACN,UAAU,GAAG,QAAQ,EACrB,UAAU,GAAG,IAAI,EACjB,eAAe,GAAG,KAAK,GACxB,EAAE,EAAE;IACH,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;IAE1D,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,MAAM,EACzD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,YAAY,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