@blockrun/runcode 2.2.2 → 2.2.3
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/agent/commands.js +21 -1
- package/package.json +1 -1
package/dist/agent/commands.js
CHANGED
|
@@ -71,6 +71,17 @@ const DIRECT_COMMANDS = {
|
|
|
71
71
|
ctx.onEvent({ kind: 'text_delta', text: 'Last commit undone. Changes preserved in staging.\n' });
|
|
72
72
|
emitDone(ctx);
|
|
73
73
|
},
|
|
74
|
+
'/help': (ctx) => {
|
|
75
|
+
ctx.onEvent({ kind: 'text_delta', text: `**RunCode Commands**\n\n` +
|
|
76
|
+
` **Coding:** /commit /review /test /fix /debug /explain /search /find /refactor /scaffold\n` +
|
|
77
|
+
` **Git:** /push /pr /undo /status /diff /log /branch /stash /unstash\n` +
|
|
78
|
+
` **Analysis:** /security /lint /optimize /todo /deps /clean /migrate /doc\n` +
|
|
79
|
+
` **Session:** /plan /execute /compact /retry /sessions /resume /context /tasks\n` +
|
|
80
|
+
` **Info:** /model /wallet /cost /mcp /doctor /version /bug /help\n` +
|
|
81
|
+
` **UI:** /clear /exit\n`
|
|
82
|
+
});
|
|
83
|
+
emitDone(ctx);
|
|
84
|
+
},
|
|
74
85
|
'/bug': (ctx) => {
|
|
75
86
|
ctx.onEvent({ kind: 'text_delta', text: 'Report issues at: https://github.com/BlockRunAI/runcode/issues\n' });
|
|
76
87
|
emitDone(ctx);
|
|
@@ -99,12 +110,15 @@ const DIRECT_COMMANDS = {
|
|
|
99
110
|
'/context': async (ctx) => {
|
|
100
111
|
const { estimated, apiAnchored } = getAnchoredTokenCount(ctx.history);
|
|
101
112
|
const contextWindow = getContextWindow(ctx.config.model);
|
|
102
|
-
const
|
|
113
|
+
const pct = (estimated / contextWindow) * 100;
|
|
114
|
+
const usagePct = pct.toFixed(1);
|
|
115
|
+
const warning = pct > 80 ? ' ⚠ Near limit — consider /compact\n' : '';
|
|
103
116
|
ctx.onEvent({ kind: 'text_delta', text: `**Session Context**\n` +
|
|
104
117
|
` Model: ${ctx.config.model}\n` +
|
|
105
118
|
` Mode: ${ctx.config.permissionMode || 'default'}\n` +
|
|
106
119
|
` Messages: ${ctx.history.length}\n` +
|
|
107
120
|
` Tokens: ~${estimated.toLocaleString()} / ${(contextWindow / 1000).toFixed(0)}k (${usagePct}%)${apiAnchored ? ' ✓' : ' ~'}\n` +
|
|
121
|
+
warning +
|
|
108
122
|
` Session: ${ctx.sessionId}\n` +
|
|
109
123
|
` Directory: ${ctx.config.workingDir || process.cwd()}\n`
|
|
110
124
|
});
|
|
@@ -128,6 +142,12 @@ const DIRECT_COMMANDS = {
|
|
|
128
142
|
}
|
|
129
143
|
checks.push(fs.existsSync(path.join(BLOCKRUN_DIR, 'wallet.json')) ? '✓ wallet configured' : '⚠ no wallet — run: runcode setup');
|
|
130
144
|
checks.push(fs.existsSync(path.join(BLOCKRUN_DIR, 'runcode-config.json')) ? '✓ config file exists' : '⚠ no config — using defaults');
|
|
145
|
+
// Check MCP
|
|
146
|
+
const { listMcpServers } = await import('../mcp/client.js');
|
|
147
|
+
const mcpServers = listMcpServers();
|
|
148
|
+
checks.push(mcpServers.length > 0
|
|
149
|
+
? `✓ MCP: ${mcpServers.length} server(s), ${mcpServers.reduce((a, s) => a + s.toolCount, 0)} tools`
|
|
150
|
+
: '⚠ no MCP servers connected');
|
|
131
151
|
checks.push(`✓ model: ${ctx.config.model}`);
|
|
132
152
|
checks.push(`✓ history: ${ctx.history.length} messages, ~${estimateHistoryTokens(ctx.history).toLocaleString()} tokens`);
|
|
133
153
|
checks.push(`✓ session: ${ctx.sessionId}`);
|