bingocode 1.1.200 → 1.1.202-beta.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/bin/bingo-win.cjs +218 -215
- package/package.json +1 -1
- package/src/server/config/providers.yaml +229 -229
- package/src/server/proxy/transform/anthropicToOpenaiChat.ts +220 -220
- package/src/server/services/providerService.ts +29 -6
- package/src/tools/AgentTool/UI.tsx +73 -8
- package/src/utils/context.ts +1 -1
|
@@ -5,7 +5,7 @@ import { ConfigurableShortcutHint } from 'src/components/ConfigurableShortcutHin
|
|
|
5
5
|
import { CtrlOToExpand, SubAgentProvider } from 'src/components/CtrlOToExpand.js';
|
|
6
6
|
import { Byline } from 'src/components/design-system/Byline.js';
|
|
7
7
|
import { KeyboardShortcutHint } from 'src/components/design-system/KeyboardShortcutHint.js';
|
|
8
|
-
import
|
|
8
|
+
import { z } from 'zod/v4';
|
|
9
9
|
import { AgentProgressLine } from '../../components/AgentProgressLine.js';
|
|
10
10
|
import { FallbackToolUseErrorMessage } from '../../components/FallbackToolUseErrorMessage.js';
|
|
11
11
|
import { FallbackToolUseRejectedMessage } from '../../components/FallbackToolUseRejectedMessage.js';
|
|
@@ -15,14 +15,14 @@ import { MessageResponse } from '../../components/MessageResponse.js';
|
|
|
15
15
|
import { ToolUseLoader } from '../../components/ToolUseLoader.js';
|
|
16
16
|
import { Box, Text } from '../../ink.js';
|
|
17
17
|
import { getDumpPromptsPath } from '../../services/api/dumpPrompts.js';
|
|
18
|
-
import { findToolByName, type Tools } from '../../Tool.js';
|
|
18
|
+
import { buildTool, findToolByName, toolMatchesName, type Tool, type Tools } from '../../Tool.js';
|
|
19
19
|
import type { Message, ProgressMessage } from '../../types/message.js';
|
|
20
20
|
import type { AgentToolProgress } from '../../types/tools.js';
|
|
21
21
|
import { count } from '../../utils/array.js';
|
|
22
22
|
import { getSearchOrReadFromContent, getSearchReadSummaryText } from '../../utils/collapseReadSearch.js';
|
|
23
23
|
import { getDisplayPath } from '../../utils/file.js';
|
|
24
24
|
import { formatDuration, formatNumber } from '../../utils/format.js';
|
|
25
|
-
import { buildSubagentLookups, createAssistantMessage, EMPTY_LOOKUPS } from '../../utils/messages.js';
|
|
25
|
+
import { buildSubagentLookups, createAssistantMessage, EMPTY_LOOKUPS, type MessageLookups } from '../../utils/messages.js';
|
|
26
26
|
import type { ModelAlias } from '../../utils/model/aliases.js';
|
|
27
27
|
import { getMainLoopModel, parseUserSpecifiedModel, renderModelName } from '../../utils/model/model.js';
|
|
28
28
|
import type { Theme, ThemeName } from '../../utils/theme.js';
|
|
@@ -32,6 +32,58 @@ import { getAgentColor } from './agentColorManager.js';
|
|
|
32
32
|
import { GENERAL_PURPOSE_AGENT } from './built-in/generalPurposeAgent.js';
|
|
33
33
|
const MAX_PROGRESS_MESSAGES_TO_SHOW = 3;
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Create a minimal fallback Tool object for a sub-agent tool name not present
|
|
37
|
+
* in the coordinator's tool set. Used in brain mode where the coordinator only
|
|
38
|
+
* has [Agent, AskUserQuestion] but sub-agents use Read/Grep/Bash/Edit/etc.
|
|
39
|
+
* Without fallbacks, findToolByName returns null and renders blank lines.
|
|
40
|
+
*/
|
|
41
|
+
function createFallbackTool(name: string): Tool {
|
|
42
|
+
return buildTool({
|
|
43
|
+
name,
|
|
44
|
+
inputSchema: z.object({}).passthrough(),
|
|
45
|
+
description: async () => `Sub-agent tool: ${name}`,
|
|
46
|
+
call: async () => ({ data: {} as unknown }) as any,
|
|
47
|
+
maxResultSizeChars: 100_000,
|
|
48
|
+
prompt: async () => '',
|
|
49
|
+
mapToolResultToToolResultBlockParam: (_content: unknown, toolUseID: string) => ({
|
|
50
|
+
tool_use_id: toolUseID,
|
|
51
|
+
content: [{ type: 'text' as const, text: '' }],
|
|
52
|
+
type: 'tool_result' as const,
|
|
53
|
+
}),
|
|
54
|
+
renderToolUseMessage: (input: Record<string, unknown>) => {
|
|
55
|
+
const keys = Object.keys(input);
|
|
56
|
+
if (keys.length === 0) return '';
|
|
57
|
+
return keys.map(k => {
|
|
58
|
+
const v = input[k];
|
|
59
|
+
let s = typeof v === 'string' ? v : JSON.stringify(v);
|
|
60
|
+
if (s.length > 80) s = s.slice(0, 80) + '\u2026';
|
|
61
|
+
return `${k}: ${s}`;
|
|
62
|
+
}).join(', ');
|
|
63
|
+
},
|
|
64
|
+
renderToolResultMessage: () => null,
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Given the result of buildSubagentLookups, create fallback Tool entries
|
|
70
|
+
* for any tool name not already in `tools`. Returns the original `tools`
|
|
71
|
+
* array if no new names are found. Avoids re-scanning progress data.
|
|
72
|
+
*/
|
|
73
|
+
function augmentToolsFromLookups(
|
|
74
|
+
tools: Tools,
|
|
75
|
+
lookups: MessageLookups,
|
|
76
|
+
): Tools {
|
|
77
|
+
const toolNames = new Set<string>()
|
|
78
|
+
for (const block of lookups.toolUseByToolUseID.values()) {
|
|
79
|
+
toolNames.add(block.name)
|
|
80
|
+
}
|
|
81
|
+
if (toolNames.size === 0) return tools
|
|
82
|
+
const missing = [...toolNames].filter(n => !tools.some(t => toolMatchesName(t, n)))
|
|
83
|
+
if (missing.length === 0) return tools
|
|
84
|
+
return [...tools, ...missing.map(createFallbackTool)]
|
|
85
|
+
}
|
|
86
|
+
|
|
35
87
|
/**
|
|
36
88
|
* Guard: checks if progress data has a `message` field (agent_progress or
|
|
37
89
|
* skill_progress). Other progress types (e.g. bash_progress forwarded from
|
|
@@ -262,12 +314,12 @@ function VerboseAgentTranscript(t0) {
|
|
|
262
314
|
lookups: agentLookups,
|
|
263
315
|
inProgressToolUseIDs
|
|
264
316
|
} = t1;
|
|
265
|
-
let t2;
|
|
317
|
+
const augmentedTools = augmentToolsFromLookups(tools, agentLookups); let t2;
|
|
266
318
|
if ($[2] !== agentLookups || $[3] !== inProgressToolUseIDs || $[4] !== progressMessages || $[5] !== tools || $[6] !== verbose) {
|
|
267
319
|
const filteredMessages = progressMessages.filter(_temp4);
|
|
268
320
|
let t3;
|
|
269
321
|
if ($[8] !== agentLookups || $[9] !== inProgressToolUseIDs || $[10] !== tools || $[11] !== verbose) {
|
|
270
|
-
t3 = progressMessage => <MessageResponse key={progressMessage.uuid} height={1}><MessageComponent message={progressMessage.data.message} lookups={agentLookups} addMargin={false} tools={
|
|
322
|
+
t3 = progressMessage => <MessageResponse key={progressMessage.uuid} height={1}><MessageComponent message={progressMessage.data.message} lookups={agentLookups} addMargin={false} tools={augmentedTools} commands={[]} verbose={verbose} inProgressToolUseIDs={inProgressToolUseIDs} progressMessagesForMessage={[]} shouldAnimate={false} shouldShowDot={false} isTranscriptMode={false} isStatic={true} /></MessageResponse>;
|
|
271
323
|
$[8] = agentLookups;
|
|
272
324
|
$[9] = inProgressToolUseIDs;
|
|
273
325
|
$[10] = tools;
|
|
@@ -384,6 +436,12 @@ export function renderToolResultMessage(data: Output, progressMessagesForMessage
|
|
|
384
436
|
speed: null
|
|
385
437
|
}
|
|
386
438
|
});
|
|
439
|
+
const agentProgressData = progressMessagesForMessage
|
|
440
|
+
.filter((pm): pm is ProgressMessage<AgentToolProgress> => hasProgressMessage(pm.data))
|
|
441
|
+
.map(pm => pm.data)
|
|
442
|
+
const { lookups: resultLookups } = buildSubagentLookups(agentProgressData)
|
|
443
|
+
const augmentedTools = augmentToolsFromLookups(tools, resultLookups)
|
|
444
|
+
|
|
387
445
|
return <Box flexDirection="column">
|
|
388
446
|
{"external" === 'ant' && <MessageResponse>
|
|
389
447
|
<Text color="warning">
|
|
@@ -394,13 +452,13 @@ export function renderToolResultMessage(data: Output, progressMessagesForMessage
|
|
|
394
452
|
<AgentPromptDisplay prompt={prompt} theme={theme} />
|
|
395
453
|
</MessageResponse>}
|
|
396
454
|
{isTranscriptMode ? <SubAgentProvider>
|
|
397
|
-
<VerboseAgentTranscript progressMessages={progressMessagesForMessage} tools={
|
|
455
|
+
<VerboseAgentTranscript progressMessages={progressMessagesForMessage} tools={augmentedTools} verbose={verbose} />
|
|
398
456
|
</SubAgentProvider> : null}
|
|
399
457
|
{isTranscriptMode && content && content.length > 0 && <MessageResponse>
|
|
400
458
|
<AgentResponseDisplay content={content} theme={theme} />
|
|
401
459
|
</MessageResponse>}
|
|
402
460
|
<MessageResponse height={1}>
|
|
403
|
-
<MessageComponent message={finalAssistantMessage} lookups={EMPTY_LOOKUPS} addMargin={false} tools={
|
|
461
|
+
<MessageComponent message={finalAssistantMessage} lookups={EMPTY_LOOKUPS} addMargin={false} tools={augmentedTools} commands={[]} verbose={verbose} inProgressToolUseIDs={new Set()} progressMessagesForMessage={[]} shouldAnimate={false} shouldShowDot={false} isTranscriptMode={false} isStatic={true} />
|
|
404
462
|
</MessageResponse>
|
|
405
463
|
{!isTranscriptMode && <Text dimColor>
|
|
406
464
|
{' '}
|
|
@@ -540,6 +598,13 @@ export function renderToolUseProgressMessage(progressMessages: ProgressMessage<P
|
|
|
540
598
|
lookups: subagentLookups,
|
|
541
599
|
inProgressToolUseIDs: collapsedInProgressIDs
|
|
542
600
|
} = buildSubagentLookups(progressMessages.filter((pm): pm is ProgressMessage<AgentToolProgress> => hasProgressMessage(pm.data)).map(pm => pm.data));
|
|
601
|
+
|
|
602
|
+
// Augment tools with fallback entries for sub-agent tools not in the
|
|
603
|
+
// coordinator's tool set. In brain mode the coordinator only has
|
|
604
|
+
// [Agent, AskUserQuestion], but sub-agents call Read/Grep/Bash/Edit/etc.
|
|
605
|
+
// Without fallbacks, findToolByName returns null and renders blank lines.
|
|
606
|
+
const augmentedTools = augmentToolsFromLookups(tools, subagentLookups);
|
|
607
|
+
|
|
543
608
|
return <MessageResponse>
|
|
544
609
|
<Box flexDirection="column">
|
|
545
610
|
<SubAgentProvider>
|
|
@@ -558,7 +623,7 @@ export function renderToolUseProgressMessage(progressMessages: ProgressMessage<P
|
|
|
558
623
|
// content (tool not found, renderToolUseMessage returns null)
|
|
559
624
|
// doesn't leave a blank line. Tool call headers are single-line
|
|
560
625
|
// anyway so truncation isn't needed.
|
|
561
|
-
return <MessageComponent key={processed.message.uuid} message={processed.message.data.message} lookups={subagentLookups} addMargin={false} tools={
|
|
626
|
+
return <MessageComponent key={processed.message.uuid} message={processed.message.data.message} lookups={subagentLookups} addMargin={false} tools={augmentedTools} commands={[]} verbose={verbose} inProgressToolUseIDs={collapsedInProgressIDs} progressMessagesForMessage={[]} shouldAnimate={false} shouldShowDot={false} style="condensed" isTranscriptMode={false} isStatic={true} />;
|
|
562
627
|
})}
|
|
563
628
|
</SubAgentProvider>
|
|
564
629
|
{hiddenToolUseCount > 0 && <Text dimColor>
|
package/src/utils/context.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { getCanonicalName } from './model/model.js'
|
|
|
6
6
|
import { getModelCapability } from './model/modelCapabilities.js'
|
|
7
7
|
|
|
8
8
|
// Model context window size (200k tokens for all models right now)
|
|
9
|
-
export const MODEL_CONTEXT_WINDOW_DEFAULT =
|
|
9
|
+
export const MODEL_CONTEXT_WINDOW_DEFAULT = 1_000_000
|
|
10
10
|
|
|
11
11
|
// Maximum output tokens for compact operations
|
|
12
12
|
export const COMPACT_MAX_OUTPUT_TOKENS = 20_000
|