@pugi/cli 0.1.0-alpha.9 → 0.1.0-beta.2
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/README.md +33 -0
- package/assets/pugi-mascot.ansi +41 -0
- package/dist/commands/deploy.js +439 -0
- package/dist/core/agents/loader.js +104 -0
- package/dist/core/agents/registry.js +1 -1
- package/dist/core/consensus/anvil-fanout.js +276 -0
- package/dist/core/consensus/diff-capture.js +382 -0
- package/dist/core/consensus/rubric.js +233 -0
- package/dist/core/context/index.js +21 -0
- package/dist/core/context/pugiignore.js +316 -0
- package/dist/core/context/repo-skeleton.js +533 -0
- package/dist/core/context/watcher.js +342 -0
- package/dist/core/context/working-set.js +165 -0
- package/dist/core/edits/dispatch.js +185 -0
- package/dist/core/edits/index.js +15 -0
- package/dist/core/edits/layer-a-apply.js +217 -0
- package/dist/core/edits/layer-b-apply.js +211 -0
- package/dist/core/edits/layer-c-apply.js +160 -0
- package/dist/core/edits/layer-d-ast.js +29 -0
- package/dist/core/edits/marker-parser.js +401 -0
- package/dist/core/edits/security-gate.js +223 -0
- package/dist/core/edits/worktree.js +229 -0
- package/dist/core/engine/native-pugi.js +6 -1
- package/dist/core/engine/prompts.js +4 -1
- package/dist/core/engine/tool-bridge.js +33 -1
- package/dist/core/lsp/client.js +631 -0
- package/dist/core/repl/ask.js +512 -0
- package/dist/core/repl/cancellation.js +98 -0
- package/dist/core/repl/dispatch-fsm.js +220 -0
- package/dist/core/repl/privacy-banner.js +71 -0
- package/dist/core/repl/session.js +1896 -13
- package/dist/core/repl/slash-commands.js +59 -32
- package/dist/core/repl/store/index.js +12 -0
- package/dist/core/repl/store/jsonl-log.js +321 -0
- package/dist/core/repl/store/lockfile.js +155 -0
- package/dist/core/repl/store/session-store.js +792 -0
- package/dist/core/repl/store/types.js +44 -0
- package/dist/core/repl/store/uuid-v7.js +68 -0
- package/dist/core/repl/workspace-context.js +72 -1
- package/dist/core/skills/loader.js +454 -0
- package/dist/core/skills/sources.js +480 -0
- package/dist/core/skills/trust.js +172 -0
- package/dist/runtime/cli.js +767 -10
- package/dist/runtime/commands/agents.js +385 -0
- package/dist/runtime/commands/config.js +338 -8
- package/dist/runtime/commands/lsp.js +184 -0
- package/dist/runtime/commands/patch.js +111 -0
- package/dist/runtime/commands/review-consensus.js +399 -0
- package/dist/runtime/commands/skills.js +401 -0
- package/dist/runtime/commands/worktree.js +133 -0
- package/dist/tools/apply-patch.js +314 -0
- package/dist/tools/file-tools.js +90 -0
- package/dist/tools/lsp-tools.js +189 -0
- package/dist/tools/registry.js +18 -0
- package/dist/tools/web-fetch.js +1 -1
- package/dist/tui/agent-tree-pane.js +9 -0
- package/dist/tui/ask-cli.js +52 -0
- package/dist/tui/ask-modal.js +211 -0
- package/dist/tui/conversation-pane.js +48 -3
- package/dist/tui/input-box.js +48 -5
- package/dist/tui/markdown-render.js +266 -0
- package/dist/tui/repl-render.js +185 -0
- package/dist/tui/repl-splash-mascot.js +130 -0
- package/dist/tui/repl-splash.js +7 -1
- package/dist/tui/repl.js +82 -11
- package/dist/tui/status-bar.js +63 -3
- package/dist/tui/tool-stream-pane.js +91 -0
- package/package.json +11 -5
package/dist/tui/repl.js
CHANGED
|
@@ -20,22 +20,32 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
20
20
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
21
21
|
import { Box, Text, useApp, useInput } from 'ink';
|
|
22
22
|
import { PUGI_TAGLINE, THE_TEN } from '@pugi/personas';
|
|
23
|
-
import {
|
|
23
|
+
import { AgentTreePane } from './agent-tree-pane.js';
|
|
24
|
+
import { AskModal, PlanReviewModal } from './ask-modal.js';
|
|
24
25
|
import { ConversationPane } from './conversation-pane.js';
|
|
25
26
|
import { InputBox } from './input-box.js';
|
|
26
27
|
import { ReplSplash } from './repl-splash.js';
|
|
27
28
|
import { StatusBar } from './status-bar.js';
|
|
29
|
+
import { ToolStreamPane } from './tool-stream-pane.js';
|
|
28
30
|
import { UpdateBanner } from './update-banner.js';
|
|
29
31
|
import { collectWorkspaceContext } from './workspace-context.js';
|
|
30
32
|
import { slugForCwd } from '../core/repl/history.js';
|
|
31
33
|
import { SLASH_COMMAND_HELP, SLASH_COMMAND_GROUPS } from '../core/repl/slash-commands.js';
|
|
32
34
|
const TICK_INTERVAL_MS = 200;
|
|
33
35
|
const PULSE_INTERVAL_MS = 700;
|
|
36
|
+
// α6.12: maximum transcript rows the conversation pane renders at once.
|
|
37
|
+
// Older rows scroll off the top; full history stays in session state.
|
|
38
|
+
const CONVERSATION_WINDOW = 12;
|
|
34
39
|
export function Repl(props) {
|
|
35
40
|
const [state, setState] = useState(props.session.getState());
|
|
36
41
|
const [overlay, setOverlay] = useState('none');
|
|
37
42
|
const [pulsePhase, setPulsePhase] = useState(0);
|
|
38
43
|
const [tickNow, setTickNow] = useState((props.now ?? Date.now)());
|
|
44
|
+
// α6.12: operator-driven collapse for the tool stream pane. The CLI
|
|
45
|
+
// host can hide the pane entirely via `--no-tool-stream`; this state
|
|
46
|
+
// is the runtime toggle (Ctrl+T) for operators who want the pane on
|
|
47
|
+
// screen but folded to a single row while they read a long reply.
|
|
48
|
+
const [toolStreamCollapsed, setToolStreamCollapsed] = useState(false);
|
|
39
49
|
// α6.14 wave 3: boot splash visible until first input, first
|
|
40
50
|
// `agent.spawned` event, or 10s idle. The host gates the initial
|
|
41
51
|
// visibility on `--no-splash` / PUGI_SKIP_SPLASH via `skipSplash`.
|
|
@@ -122,22 +132,78 @@ export function Repl(props) {
|
|
|
122
132
|
setOverlay('none');
|
|
123
133
|
}
|
|
124
134
|
}, { isActive: overlay === 'help' || overlay === 'roster' });
|
|
125
|
-
|
|
135
|
+
// α6.12: Ctrl+T toggles the tool stream pane between expanded and
|
|
136
|
+
// collapsed states. Active only while no overlay is open, so the
|
|
137
|
+
// toggle never fights the help/roster dismiss handler. The input box
|
|
138
|
+
// owns its own raw-input mode, so this listener only fires on the
|
|
139
|
+
// global Ctrl+T binding rather than every printable keystroke.
|
|
140
|
+
useInput((input, key) => {
|
|
141
|
+
if (key.ctrl && input === 't') {
|
|
142
|
+
setToolStreamCollapsed((prev) => !prev);
|
|
143
|
+
}
|
|
144
|
+
}, { isActive: overlay === 'none' && props.hideToolStream !== true });
|
|
145
|
+
// α6.3 office-hours: a pending ask or plan-review modal pauses input
|
|
146
|
+
// until the operator resolves it. The modal owns its own useInput
|
|
147
|
+
// hook, so the InputBox unmounts while a modal is open to avoid two
|
|
148
|
+
// raw-input listeners competing for the same keystroke. Resolution
|
|
149
|
+
// forwards through ReplSession.resolveAsk / resolvePlanReview.
|
|
150
|
+
const askPending = state.pendingAsk !== null;
|
|
151
|
+
const planPending = state.pendingPlanReview !== null;
|
|
152
|
+
const modalActive = askPending || planPending;
|
|
153
|
+
const handleAskResolve = useCallback((verdict) => {
|
|
154
|
+
void props.session.resolveAsk(verdict);
|
|
155
|
+
}, [props.session]);
|
|
156
|
+
const handlePlanReviewResolve = useCallback((result) => {
|
|
157
|
+
void props.session.resolvePlanReview(result);
|
|
158
|
+
}, [props.session]);
|
|
159
|
+
// α6.9: Ctrl+C abort handler. Forwards to ReplSession.cancel() which
|
|
160
|
+
// aborts the in-flight dispatch, closes the SSE stream, and surfaces
|
|
161
|
+
// "Aborted." in the transcript.
|
|
162
|
+
//
|
|
163
|
+
// Return contract (consumed by InputBox):
|
|
164
|
+
// - true - dispatch was cancelled (keep the buffer + DO arm
|
|
165
|
+
// the press-again-to-exit timer; second Ctrl+C in
|
|
166
|
+
// the window exits).
|
|
167
|
+
// - false - idle / nothing to cancel (legacy: clear buffer +
|
|
168
|
+
// arm the exit timer so the operator sees the hint
|
|
169
|
+
// and can confirm exit on the next press).
|
|
170
|
+
// - undefined - bypassed entirely (e.g. a modal owns the input).
|
|
171
|
+
// InputBox MUST NOT arm the exit timer and MUST
|
|
172
|
+
// NOT clear the buffer. P2 fix: previously this
|
|
173
|
+
// returned `false` and the buffer-clear path wiped
|
|
174
|
+
// the operator's mid-typed modal text on the first
|
|
175
|
+
// Ctrl+C, costing a press of work.
|
|
176
|
+
const handleCancel = useCallback(() => {
|
|
177
|
+
if (modalActive)
|
|
178
|
+
return undefined;
|
|
179
|
+
return props.session.cancel();
|
|
180
|
+
}, [props.session, modalActive]);
|
|
181
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [props.updateBanner ? _jsx(UpdateBanner, { result: props.updateBanner }) : null, splashVisible ? (_jsx(ReplSplash, { cliVersion: state.cliVersion, workspaceLabel: state.workspaceLabel, plan: props.splashPlan, model: props.splashModel, tenant: props.splashTenant, onDismiss: dismissSplash, mascotPrePrinted: props.mascotPrePrinted === true })) : null, _jsx(Header, { state: state }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: overlay === 'help' ? (_jsx(HelpOverlay, {})) : overlay === 'roster' ? (_jsx(RosterOverlay, {})) : overlay === 'farewell' ? (_jsx(FarewellOverlay, {})) : (_jsx(MainArea, { state: state, personaNames: personaNames, nowEpochMs: tickNow, hideToolStream: props.hideToolStream === true, toolStreamCollapsed: toolStreamCollapsed })) }), state.pendingAsk ? (_jsx(Box, { marginTop: 1, children: _jsx(AskModal, { tag: state.pendingAsk, onResolve: handleAskResolve }) })) : null, state.pendingPlanReview ? (_jsx(Box, { marginTop: 1, children: _jsx(PlanReviewModal, { tag: state.pendingPlanReview, onResolve: handlePlanReviewResolve }) })) : null, _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [overlay === 'farewell' || modalActive ? null : (_jsx(InputBox, { onSubmit: handleSubmit, onExit: handleExit, onCancel: handleCancel, now: props.now,
|
|
126
182
|
// Slug from process.cwd() (full path) so two workspaces with
|
|
127
183
|
// the same basename do not share history. state.workspaceLabel
|
|
128
184
|
// is the basename only. Codex review P2.
|
|
129
|
-
workspaceSlug: slugForCwd(process.cwd()) })), _jsx(StatusBar, { connection: state.connection, activeAgentCount: countActive(state), tokensDownstreamTotal: state.tokensDownstreamTotal, briefStartedAtEpochMs: state.briefStartedAtEpochMs, nowEpochMs: tickNow, pulsePhase: pulsePhase, pugiMdCount: workspaceContext.pugiMdCount, mcpServerCount: workspaceContext.mcpServerCount, skillCount: workspaceContext.skillCount, quotaPct: props.quotaPct })] })] }));
|
|
185
|
+
workspaceSlug: slugForCwd(process.cwd()) })), _jsx(StatusBar, { connection: state.connection, activeAgentCount: countActive(state), tokensDownstreamTotal: state.tokensDownstreamTotal, briefStartedAtEpochMs: state.briefStartedAtEpochMs, nowEpochMs: tickNow, pulsePhase: pulsePhase, pugiMdCount: workspaceContext.pugiMdCount, mcpServerCount: workspaceContext.mcpServerCount, skillCount: workspaceContext.skillCount, quotaPct: props.quotaPct, dispatchState: state.dispatchState, dispatchToolLabel: state.dispatchToolLabel })] })] }));
|
|
130
186
|
}
|
|
131
187
|
function Header({ state }) {
|
|
132
188
|
return (_jsxs(Box, { children: [_jsx(Text, { bold: true, children: "Pugi" }), _jsx(Text, { bold: true, color: "cyan", children: ".io" }), _jsx(Text, { dimColor: true, children: ` · workspace: ${state.workspaceLabel} · v${state.cliVersion} · ` }), _jsx(Text, { color: "cyan", children: state.connection === 'on_watch' ? 'on watch' : state.connection.replace('_', ' ') })] }));
|
|
133
189
|
}
|
|
134
|
-
function MainArea({ state, personaNames, nowEpochMs, }) {
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
190
|
+
function MainArea({ state, personaNames, nowEpochMs, hideToolStream, toolStreamCollapsed, }) {
|
|
191
|
+
// α6.12: three vertical panes stacked above the input box.
|
|
192
|
+
//
|
|
193
|
+
// 1. Conversation pane (top) - transcript with Markdown render.
|
|
194
|
+
// 2. Tool stream pane (mid) - live Read/Edit/Bash/Grep lines.
|
|
195
|
+
// Hidden when `--no-tool-stream` is
|
|
196
|
+
// set; collapsed via Ctrl+T while
|
|
197
|
+
// the pane is visible.
|
|
198
|
+
// 3. Agent tree pane (bottom) - Cyber-Zoo roster with persona /
|
|
199
|
+
// status / duration / token counts.
|
|
200
|
+
//
|
|
201
|
+
// The window over the transcript is small (last 12 rows) so the
|
|
202
|
+
// bottom of the frame stays anchored to the input box. New agents
|
|
203
|
+
// push the operator line up the screen, mirroring Claude Code /
|
|
204
|
+
// Codex CLI / Gemini CLI rendering.
|
|
205
|
+
const conversationSlice = state.transcript.slice(-CONVERSATION_WINDOW);
|
|
206
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(ConversationPane, { rows: conversationSlice, personaNames: personaNames }), hideToolStream ? null : (_jsx(Box, { marginTop: 1, children: _jsx(ToolStreamPane, { calls: state.toolCalls, collapsed: toolStreamCollapsed }) })), _jsx(Box, { marginTop: 1, children: _jsx(AgentTreePane, { agents: state.agents, nowEpochMs: nowEpochMs }) })] }));
|
|
141
207
|
}
|
|
142
208
|
function HelpOverlay() {
|
|
143
209
|
// Group commands by their `group` field so the operator scans the
|
|
@@ -187,12 +253,17 @@ function applyVerdictSideEffects(verdict, handlers) {
|
|
|
187
253
|
case 'clear':
|
|
188
254
|
case 'version':
|
|
189
255
|
case 'jobs':
|
|
256
|
+
case 'ask':
|
|
257
|
+
case 'consensus':
|
|
190
258
|
case 'diff':
|
|
191
259
|
case 'cost':
|
|
192
260
|
case 'status':
|
|
261
|
+
case 'resume':
|
|
193
262
|
case 'stub':
|
|
194
263
|
// All non-overlay verdicts: the session module already appended
|
|
195
|
-
// any operator-visible system lines
|
|
264
|
+
// any operator-visible system lines (and, for `ask`, set
|
|
265
|
+
// pendingAsk so the modal renders on the next frame). No further
|
|
266
|
+
// UI side effect needed here.
|
|
196
267
|
return;
|
|
197
268
|
}
|
|
198
269
|
}
|
package/dist/tui/status-bar.js
CHANGED
|
@@ -12,7 +12,12 @@ export function StatusBar(props) {
|
|
|
12
12
|
const tokenLabel = formatTokens(props.tokensDownstreamTotal);
|
|
13
13
|
const phase = clampPhase(props.pulsePhase);
|
|
14
14
|
const glyph = PULSE_DOTS[Math.min(phase, PULSE_DOTS.length - 1)] ?? PULSE_DOTS[0];
|
|
15
|
-
|
|
15
|
+
// α6.9: composite status label — connection problems trump dispatch
|
|
16
|
+
// state because the operator needs to know about a dropped admin-api
|
|
17
|
+
// first. When the connection is healthy (`on_watch` / `connecting`),
|
|
18
|
+
// the FSM dispatch state takes over to show the dispatch lifecycle
|
|
19
|
+
// (`dispatching` / `tool: read` / `aborting` / etc.).
|
|
20
|
+
const status = composeStatusLabel(props.connection, props.dispatchState, props.dispatchToolLabel);
|
|
16
21
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: status.color, children: `${glyph ?? '●'} ${status.label}` }), _jsx(Text, { dimColor: true, children: ` · ${props.activeAgentCount} agents · ` }), _jsx(Text, { children: `↓ ${tokenLabel} tokens` }), _jsx(Text, { dimColor: true, children: ` · ${elapsedLabel}` })] }), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: `${formatCount(props.pugiMdCount)} PUGI.md · ${formatCount(props.mcpServerCount)} MCP · ${formatCount(props.skillCount)} skills · ${formatQuota(props.quotaPct)} quota` }) })] }));
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
@@ -28,10 +33,17 @@ function formatQuota(pct) {
|
|
|
28
33
|
return '—';
|
|
29
34
|
return `${Math.round(pct)}%`;
|
|
30
35
|
}
|
|
31
|
-
|
|
36
|
+
// Exported for test introspection (status-bar-fsm.spec.tsx asserts
|
|
37
|
+
// connecting vs on_watch render in distinct colors; ink-testing-library
|
|
38
|
+
// strips ANSI from lastFrame() so we read the resolved color directly).
|
|
39
|
+
export function connectionLabel(connection) {
|
|
32
40
|
switch (connection) {
|
|
33
41
|
case 'connecting':
|
|
34
|
-
|
|
42
|
+
// P2 fix: was 'cyan', same as 'on_watch' - operator could not
|
|
43
|
+
// tell boot from stable. Magenta is distinct from every other
|
|
44
|
+
// state in this palette (cyan steady, yellow reconnect, gray
|
|
45
|
+
// offline) so a brief flicker through this state stands out.
|
|
46
|
+
return { label: 'connecting', color: 'magenta' };
|
|
35
47
|
case 'on_watch':
|
|
36
48
|
return { label: 'on watch', color: 'cyan' };
|
|
37
49
|
case 'reconnecting':
|
|
@@ -40,6 +52,54 @@ function connectionLabel(connection) {
|
|
|
40
52
|
return { label: 'offline', color: 'gray' };
|
|
41
53
|
}
|
|
42
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* α6.9: compose the visible status label from connection + FSM state.
|
|
57
|
+
*
|
|
58
|
+
* Priority order:
|
|
59
|
+
*
|
|
60
|
+
* 1. `offline` / `reconnecting` — transport health wins; the
|
|
61
|
+
* operator needs to know about a dropped stream before anything
|
|
62
|
+
* about the dispatch.
|
|
63
|
+
* 2. `aborting` / `aborted` / `failed` — operator-visible terminal
|
|
64
|
+
* states the FSM reached; the colour shifts to amber/red so the
|
|
65
|
+
* anomaly stands out vs the calm cyan baseline.
|
|
66
|
+
* 3. `tool_running` — surfaces the tool label when available
|
|
67
|
+
* (`tool: read`), falls back to `tool` when not.
|
|
68
|
+
* 4. `awaiting_response` — `dispatching` (matches Codex CLI's verb
|
|
69
|
+
* for the same state).
|
|
70
|
+
* 5. `completed` — `shipped` (matches the agent tree status glyph
|
|
71
|
+
* so the operator's eye links the two surfaces).
|
|
72
|
+
* 6. `idle` / unknown — connection label (`on watch` / `connecting`).
|
|
73
|
+
*
|
|
74
|
+
* The dispatch label `dispatchToolLabel` is already shaped as
|
|
75
|
+
* `tool: <kind>` upstream so we just concatenate; null falls through
|
|
76
|
+
* to the bare `tool` placeholder.
|
|
77
|
+
*/
|
|
78
|
+
function composeStatusLabel(connection, dispatchState, toolLabel) {
|
|
79
|
+
// Transport health wins.
|
|
80
|
+
if (connection === 'offline' || connection === 'reconnecting') {
|
|
81
|
+
return connectionLabel(connection);
|
|
82
|
+
}
|
|
83
|
+
// FSM dispatch state overlay (only when the FSM was wired).
|
|
84
|
+
switch (dispatchState) {
|
|
85
|
+
case 'aborting':
|
|
86
|
+
return { label: 'aborting', color: 'yellow' };
|
|
87
|
+
case 'aborted':
|
|
88
|
+
return { label: 'aborted', color: 'gray' };
|
|
89
|
+
case 'failed':
|
|
90
|
+
return { label: 'failed', color: 'red' };
|
|
91
|
+
case 'tool_running':
|
|
92
|
+
return { label: toolLabel ?? 'tool', color: 'cyan' };
|
|
93
|
+
case 'awaiting_response':
|
|
94
|
+
return { label: 'dispatching', color: 'cyan' };
|
|
95
|
+
case 'completed':
|
|
96
|
+
return { label: 'shipped', color: 'green' };
|
|
97
|
+
case 'idle':
|
|
98
|
+
case undefined:
|
|
99
|
+
default:
|
|
100
|
+
return connectionLabel(connection);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
43
103
|
function formatElapsed(startedAt, now) {
|
|
44
104
|
if (typeof startedAt !== 'number')
|
|
45
105
|
return 'idle';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
const DEFAULT_COLLAPSE_THRESHOLD = 5;
|
|
4
|
+
const DEFAULT_MAX_ROWS = 8;
|
|
5
|
+
export function ToolStreamPane(props) {
|
|
6
|
+
const calls = props.calls;
|
|
7
|
+
const collapseThreshold = props.collapseThreshold ?? DEFAULT_COLLAPSE_THRESHOLD;
|
|
8
|
+
const maxRows = props.maxRows ?? DEFAULT_MAX_ROWS;
|
|
9
|
+
if (calls.length === 0) {
|
|
10
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(PaneHeader, { count: 0, collapsed: props.collapsed }), _jsx(Text, { dimColor: true, children: "No tool calls yet. Dispatch a brief and watch tools land here." })] }));
|
|
11
|
+
}
|
|
12
|
+
if (props.collapsed === true) {
|
|
13
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsx(PaneHeader, { count: calls.length, collapsed: true }) }));
|
|
14
|
+
}
|
|
15
|
+
// Tail-window the rows so a long-running session does not overflow
|
|
16
|
+
// the bottom half of the frame. Older rows stay in the session state
|
|
17
|
+
// for /jobs and /diff inspection.
|
|
18
|
+
const visible = calls.slice(-maxRows);
|
|
19
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(PaneHeader, { count: calls.length, collapsed: false }), visible.map((call) => (_jsx(ToolCallRow, { call: call, collapseThreshold: collapseThreshold }, call.id)))] }));
|
|
20
|
+
}
|
|
21
|
+
function PaneHeader({ count, collapsed }) {
|
|
22
|
+
const verb = collapsed ? 'Ctrl+T to expand' : 'Ctrl+T to collapse';
|
|
23
|
+
return (_jsxs(Box, { children: [_jsx(Text, { bold: true, dimColor: true, children: '─ tools ' }), _jsx(Text, { dimColor: true, children: `(${count}) ` }), _jsx(Text, { dimColor: true, children: verb })] }));
|
|
24
|
+
}
|
|
25
|
+
function ToolCallRow({ call, collapseThreshold, }) {
|
|
26
|
+
const glyph = statusGlyph(call.status);
|
|
27
|
+
const color = statusColor(call.status);
|
|
28
|
+
const label = formatToolLabel(call.tool, call.args);
|
|
29
|
+
const summary = formatSummary(call);
|
|
30
|
+
const showHint = (call.resultLines ?? 0) > collapseThreshold;
|
|
31
|
+
return (_jsxs(Box, { children: [_jsx(Text, { color: color, children: glyph }), _jsx(Text, { children: ' ' }), _jsx(Text, { bold: true, children: label }), _jsx(Text, { dimColor: true, children: ` ${summary}` }), showHint ? (_jsx(Text, { dimColor: true, children: ` · ${call.resultLines} lines, Ctrl+O to expand` })) : null] }));
|
|
32
|
+
}
|
|
33
|
+
function statusGlyph(status) {
|
|
34
|
+
switch (status) {
|
|
35
|
+
case 'running':
|
|
36
|
+
return '→';
|
|
37
|
+
case 'ok':
|
|
38
|
+
return '✓';
|
|
39
|
+
case 'error':
|
|
40
|
+
return '✗';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function statusColor(status) {
|
|
44
|
+
switch (status) {
|
|
45
|
+
case 'running':
|
|
46
|
+
return 'cyan';
|
|
47
|
+
case 'ok':
|
|
48
|
+
return 'green';
|
|
49
|
+
case 'error':
|
|
50
|
+
return 'red';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Render the canonical `Tool(args)` form. Tool names are capitalised
|
|
55
|
+
* the way Claude Code shows them; args are truncated to 60 chars so
|
|
56
|
+
* the row stays single-line even on 80-col terminals.
|
|
57
|
+
*/
|
|
58
|
+
function formatToolLabel(tool, args) {
|
|
59
|
+
const name = toolDisplayName(tool);
|
|
60
|
+
const trimmedArgs = args.length > 60 ? `${args.slice(0, 57)}…` : args;
|
|
61
|
+
return `${name}(${trimmedArgs})`;
|
|
62
|
+
}
|
|
63
|
+
function toolDisplayName(tool) {
|
|
64
|
+
switch (tool) {
|
|
65
|
+
case 'read':
|
|
66
|
+
return 'Read';
|
|
67
|
+
case 'edit':
|
|
68
|
+
return 'Edit';
|
|
69
|
+
case 'bash':
|
|
70
|
+
return 'Bash';
|
|
71
|
+
case 'grep':
|
|
72
|
+
return 'Grep';
|
|
73
|
+
case 'glob':
|
|
74
|
+
return 'Glob';
|
|
75
|
+
case 'web_fetch':
|
|
76
|
+
return 'WebFetch';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function formatSummary(call) {
|
|
80
|
+
if (call.status === 'running') {
|
|
81
|
+
return call.detail ?? 'running...';
|
|
82
|
+
}
|
|
83
|
+
if (call.status === 'error') {
|
|
84
|
+
return call.detail ?? 'error';
|
|
85
|
+
}
|
|
86
|
+
// ok
|
|
87
|
+
const duration = typeof call.durationMs === 'number' ? `${call.durationMs}ms` : '';
|
|
88
|
+
const detail = call.detail ?? 'OK';
|
|
89
|
+
return duration.length > 0 ? `${detail} ${duration}` : detail;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=tool-stream-pane.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pugi/cli",
|
|
3
|
-
"version": "0.1.0-
|
|
4
|
-
"description": "Pugi CLI
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
|
+
"description": "Pugi CLI - terminal-native software execution system",
|
|
5
5
|
"homepage": "https://pugi.io",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -28,30 +28,36 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"bin/run.js",
|
|
30
30
|
"dist/**/*.js",
|
|
31
|
+
"assets/**/*.ansi",
|
|
31
32
|
"README.md",
|
|
32
33
|
"LICENSE"
|
|
33
34
|
],
|
|
34
35
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
36
|
+
"node": ">=22.5.0"
|
|
36
37
|
},
|
|
38
|
+
"//publishConfig": "CEO sign-off 2026-05-23 alpha launch: @pugi/cli is the customer-facing CLI and ships PUBLIC so `npm i -g @pugi/cli` resolves anonymously. The HARD default-restricted memory rule (2026-05-25) applies to INTERNAL @pugi/* packages (db-client, telegram bot helpers, etc.) - those must ship access:restricted unless an additional CEO sign-off granted. @pugi/sdk + @pugi/personas were published public alongside the CLI under the same alpha-launch sign-off because the CLI's customer install pulls them as transitive deps; review before α7 GA.",
|
|
37
39
|
"publishConfig": {
|
|
38
40
|
"access": "public"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
43
|
"@mozilla/readability": "^0.6.0",
|
|
44
|
+
"chokidar": "^3.6.0",
|
|
45
|
+
"ignore": "^5.3.2",
|
|
42
46
|
"ink": "^5.0.1",
|
|
43
47
|
"linkedom": "^0.18.12",
|
|
44
48
|
"react": "^18.3.1",
|
|
49
|
+
"tar": "^6.2.1",
|
|
45
50
|
"tinyglobby": "^0.2.16",
|
|
46
51
|
"turndown": "^7.2.4",
|
|
47
52
|
"undici": "^8.3.0",
|
|
48
53
|
"zod": "^3.23.0",
|
|
49
|
-
"@pugi/personas": "0.1.
|
|
50
|
-
"@pugi/sdk": "0.1.0-
|
|
54
|
+
"@pugi/personas": "0.1.2",
|
|
55
|
+
"@pugi/sdk": "0.1.0-beta.2"
|
|
51
56
|
},
|
|
52
57
|
"devDependencies": {
|
|
53
58
|
"@types/node": "^22.0.0",
|
|
54
59
|
"@types/react": "^18.3.3",
|
|
60
|
+
"@types/tar": "^6.1.13",
|
|
55
61
|
"@types/turndown": "^5.0.6",
|
|
56
62
|
"ink-testing-library": "^4.0.0",
|
|
57
63
|
"tsx": "^4.19.0",
|