@kinqs/brainrouter-cli 0.3.5 → 0.3.7
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 +29 -52
- package/agents/architect.json +18 -0
- package/agents/explorer.json +18 -0
- package/agents/reviewer.json +18 -0
- package/agents/verifier.json +18 -0
- package/agents/worker.json +18 -0
- package/bin/cli.cjs +71 -0
- package/dist/agent/agent.d.ts +224 -3
- package/dist/agent/agent.js +561 -55
- package/dist/cli/banner.d.ts +80 -0
- package/dist/cli/banner.js +232 -0
- package/dist/cli/cliPrompt.d.ts +106 -0
- package/dist/cli/cliPrompt.js +314 -0
- package/dist/cli/commands/_context.d.ts +3 -1
- package/dist/cli/commands/_helpers.d.ts +1 -1
- package/dist/cli/commands/_helpers.js +6 -6
- package/dist/cli/commands/config.d.ts +46 -0
- package/dist/cli/commands/config.js +1042 -0
- package/dist/cli/commands/guard.js +75 -10
- package/dist/cli/commands/init.d.ts +20 -0
- package/dist/cli/commands/init.js +64 -0
- package/dist/cli/commands/login.d.ts +13 -0
- package/dist/cli/commands/login.js +179 -0
- package/dist/cli/commands/mcp.d.ts +19 -0
- package/dist/cli/commands/mcp.js +286 -0
- package/dist/cli/commands/memory.js +2 -2
- package/dist/cli/commands/obs.js +22 -22
- package/dist/cli/commands/orchestration.js +18 -0
- package/dist/cli/commands/session.js +13 -5
- package/dist/cli/commands/ui.js +202 -91
- package/dist/cli/commands/workflow.d.ts +20 -0
- package/dist/cli/commands/workflow.js +368 -51
- package/dist/cli/ink/ChatApp.d.ts +206 -0
- package/dist/cli/ink/ChatApp.js +493 -0
- package/dist/cli/ink/Frame.d.ts +26 -0
- package/dist/cli/ink/Frame.js +5 -0
- package/dist/cli/ink/Picker.d.ts +65 -0
- package/dist/cli/ink/Picker.js +133 -0
- package/dist/cli/ink/SlashPalette.d.ts +51 -0
- package/dist/cli/ink/SlashPalette.js +136 -0
- package/dist/cli/ink/TextField.d.ts +34 -0
- package/dist/cli/ink/TextField.js +47 -0
- package/dist/cli/ink/WizardApp.d.ts +7 -0
- package/dist/cli/ink/WizardApp.js +422 -0
- package/dist/cli/ink/ambientChat.d.ts +34 -0
- package/dist/cli/ink/ambientChat.js +7 -0
- package/dist/cli/ink/consoleCapture.d.ts +11 -0
- package/dist/cli/ink/consoleCapture.js +33 -0
- package/dist/cli/ink/markdownRender.d.ts +41 -0
- package/dist/cli/ink/markdownRender.js +278 -0
- package/dist/cli/ink/renderWithResizeClear.d.ts +14 -0
- package/dist/cli/ink/renderWithResizeClear.js +33 -0
- package/dist/cli/ink/runChat.d.ts +34 -0
- package/dist/cli/ink/runChat.js +571 -0
- package/dist/cli/ink/runPicker.d.ts +31 -0
- package/dist/cli/ink/runPicker.js +139 -0
- package/dist/cli/ink/runSlashPalette.d.ts +23 -0
- package/dist/cli/ink/runSlashPalette.js +33 -0
- package/dist/cli/ink/runWizard.d.ts +22 -0
- package/dist/cli/ink/runWizard.js +133 -0
- package/dist/cli/ink/stdinHandoff.d.ts +51 -0
- package/dist/cli/ink/stdinHandoff.js +78 -0
- package/dist/cli/ink/toolFormat.d.ts +73 -0
- package/dist/cli/ink/toolFormat.js +180 -0
- package/dist/cli/ink/useTerminalSize.d.ts +35 -0
- package/dist/cli/ink/useTerminalSize.js +26 -0
- package/dist/cli/repl.d.ts +25 -3
- package/dist/cli/repl.js +64 -646
- package/dist/cli/slashSuggest.d.ts +32 -0
- package/dist/cli/slashSuggest.js +146 -0
- package/dist/cli/spinner.d.ts +34 -0
- package/dist/cli/spinner.js +36 -0
- package/dist/cli/statusline.d.ts +67 -0
- package/dist/cli/statusline.js +204 -0
- package/dist/cli/theme.d.ts +79 -0
- package/dist/cli/theme.js +106 -0
- package/dist/cli/whereView.d.ts +81 -0
- package/dist/cli/whereView.js +245 -0
- package/dist/cli/wizard/modelsApi.d.ts +72 -0
- package/dist/cli/wizard/modelsApi.js +166 -0
- package/dist/cli/wizard/picker.d.ts +202 -0
- package/dist/cli/wizard/picker.js +547 -0
- package/dist/cli/wizard/providers.d.ts +86 -0
- package/dist/cli/wizard/providers.js +190 -0
- package/dist/cli/wizard/runner.d.ts +13 -0
- package/dist/cli/wizard/runner.js +488 -0
- package/dist/cli/wizard/types.d.ts +122 -0
- package/dist/cli/wizard/types.js +109 -0
- package/dist/config/config.d.ts +52 -0
- package/dist/config/config.js +89 -75
- package/dist/index.js +215 -206
- package/dist/memory/briefing.d.ts +11 -1
- package/dist/memory/briefing.js +69 -1
- package/dist/memory/consolidation.d.ts +1 -1
- package/dist/orchestration/agentRegistry.d.ts +36 -0
- package/dist/orchestration/agentRegistry.js +64 -0
- package/dist/orchestration/orchestrator.d.ts +7 -0
- package/dist/orchestration/orchestrator.js +2 -0
- package/dist/orchestration/tools.d.ts +10 -1
- package/dist/orchestration/tools.js +48 -4
- package/dist/prompt/breadthHint.d.ts +5 -0
- package/dist/prompt/breadthHint.js +44 -0
- package/dist/prompt/skillCatalog.d.ts +11 -0
- package/dist/prompt/skillCatalog.js +134 -0
- package/dist/prompt/skillRunner.d.ts +2 -2
- package/dist/prompt/skillRunner.js +2 -31
- package/dist/prompt/systemPrompt.d.ts +34 -0
- package/dist/prompt/systemPrompt.js +128 -108
- package/dist/runtime/dangerousCommand.d.ts +53 -0
- package/dist/runtime/dangerousCommand.js +105 -0
- package/dist/runtime/mcpClient.d.ts +38 -1
- package/dist/runtime/mcpClient.js +104 -13
- package/dist/runtime/mcpPool.d.ts +162 -0
- package/dist/runtime/mcpPool.js +423 -0
- package/dist/runtime/mcpUtils.d.ts +3 -1
- package/dist/state/goalStore.d.ts +98 -17
- package/dist/state/goalStore.js +132 -42
- package/dist/state/preferencesStore.d.ts +67 -3
- package/dist/state/preferencesStore.js +84 -1
- package/dist/state/workflowArtifacts.d.ts +63 -2
- package/dist/state/workflowArtifacts.js +120 -8
- package/dist/tests/_helpers.d.ts +31 -0
- package/dist/tests/_helpers.js +91 -0
- package/package.json +12 -5
- package/.env.example +0 -109
package/dist/agent/agent.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { McpClientWrapper } from '../runtime/
|
|
1
|
+
import type { McpClientPool as McpClientWrapper } from '../runtime/mcpPool.js';
|
|
2
2
|
import type { LLMConfig } from '../config/config.js';
|
|
3
3
|
import type { AccessMode } from '../orchestration/roles.js';
|
|
4
|
+
import { type RecalledRecord } from '../memory/briefing.js';
|
|
5
|
+
import { type EffortLevel } from '../state/preferencesStore.js';
|
|
4
6
|
export interface RunTurnCallbacks {
|
|
5
7
|
onStatusUpdate: (status: string) => void;
|
|
6
8
|
onToolStart: (name: string, args: Record<string, any>) => void;
|
|
@@ -77,6 +79,12 @@ export interface ChatCompletionPayload {
|
|
|
77
79
|
};
|
|
78
80
|
}>;
|
|
79
81
|
tool_choice?: 'auto';
|
|
82
|
+
/**
|
|
83
|
+
* OpenAI Chat Completions reasoning slot — accepted by gpt-5 / o-series.
|
|
84
|
+
* Only set when the user has chosen a non-default `/effort` AND the
|
|
85
|
+
* endpoint+model combo accepts the field (see `supportsReasoningEffortField`).
|
|
86
|
+
*/
|
|
87
|
+
reasoning_effort?: EffortLevel;
|
|
80
88
|
}
|
|
81
89
|
export interface AgentOptions {
|
|
82
90
|
workspaceRoot: string;
|
|
@@ -96,6 +104,10 @@ export interface AgentOptions {
|
|
|
96
104
|
*/
|
|
97
105
|
parentTraceId?: string;
|
|
98
106
|
parentSpanId?: string;
|
|
107
|
+
/** Agent tier — propagated from the definition so hierarchy checks work in grandchildren. */
|
|
108
|
+
tier?: 'chat' | 'reasoning' | 'worker';
|
|
109
|
+
/** Nesting depth in the spawn chain; 0 = direct child of the chat root (default). */
|
|
110
|
+
agentDepth?: number;
|
|
99
111
|
}
|
|
100
112
|
export declare const LOCAL_TOOLS: ({
|
|
101
113
|
name: string;
|
|
@@ -131,6 +143,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
131
143
|
url?: undefined;
|
|
132
144
|
maxResults?: undefined;
|
|
133
145
|
patch?: undefined;
|
|
146
|
+
question?: undefined;
|
|
147
|
+
header?: undefined;
|
|
148
|
+
options?: undefined;
|
|
149
|
+
multiSelect?: undefined;
|
|
134
150
|
explanation?: undefined;
|
|
135
151
|
plan?: undefined;
|
|
136
152
|
proof?: undefined;
|
|
@@ -163,6 +179,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
163
179
|
url?: undefined;
|
|
164
180
|
maxResults?: undefined;
|
|
165
181
|
patch?: undefined;
|
|
182
|
+
question?: undefined;
|
|
183
|
+
header?: undefined;
|
|
184
|
+
options?: undefined;
|
|
185
|
+
multiSelect?: undefined;
|
|
166
186
|
explanation?: undefined;
|
|
167
187
|
plan?: undefined;
|
|
168
188
|
proof?: undefined;
|
|
@@ -198,6 +218,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
198
218
|
url?: undefined;
|
|
199
219
|
maxResults?: undefined;
|
|
200
220
|
patch?: undefined;
|
|
221
|
+
question?: undefined;
|
|
222
|
+
header?: undefined;
|
|
223
|
+
options?: undefined;
|
|
224
|
+
multiSelect?: undefined;
|
|
201
225
|
explanation?: undefined;
|
|
202
226
|
plan?: undefined;
|
|
203
227
|
proof?: undefined;
|
|
@@ -227,6 +251,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
227
251
|
url?: undefined;
|
|
228
252
|
maxResults?: undefined;
|
|
229
253
|
patch?: undefined;
|
|
254
|
+
question?: undefined;
|
|
255
|
+
header?: undefined;
|
|
256
|
+
options?: undefined;
|
|
257
|
+
multiSelect?: undefined;
|
|
230
258
|
explanation?: undefined;
|
|
231
259
|
plan?: undefined;
|
|
232
260
|
proof?: undefined;
|
|
@@ -259,6 +287,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
259
287
|
url?: undefined;
|
|
260
288
|
maxResults?: undefined;
|
|
261
289
|
patch?: undefined;
|
|
290
|
+
question?: undefined;
|
|
291
|
+
header?: undefined;
|
|
292
|
+
options?: undefined;
|
|
293
|
+
multiSelect?: undefined;
|
|
262
294
|
explanation?: undefined;
|
|
263
295
|
plan?: undefined;
|
|
264
296
|
proof?: undefined;
|
|
@@ -288,6 +320,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
288
320
|
url?: undefined;
|
|
289
321
|
maxResults?: undefined;
|
|
290
322
|
patch?: undefined;
|
|
323
|
+
question?: undefined;
|
|
324
|
+
header?: undefined;
|
|
325
|
+
options?: undefined;
|
|
326
|
+
multiSelect?: undefined;
|
|
291
327
|
explanation?: undefined;
|
|
292
328
|
plan?: undefined;
|
|
293
329
|
proof?: undefined;
|
|
@@ -317,6 +353,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
317
353
|
url?: undefined;
|
|
318
354
|
maxResults?: undefined;
|
|
319
355
|
patch?: undefined;
|
|
356
|
+
question?: undefined;
|
|
357
|
+
header?: undefined;
|
|
358
|
+
options?: undefined;
|
|
359
|
+
multiSelect?: undefined;
|
|
320
360
|
explanation?: undefined;
|
|
321
361
|
plan?: undefined;
|
|
322
362
|
proof?: undefined;
|
|
@@ -346,6 +386,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
346
386
|
command?: undefined;
|
|
347
387
|
maxResults?: undefined;
|
|
348
388
|
patch?: undefined;
|
|
389
|
+
question?: undefined;
|
|
390
|
+
header?: undefined;
|
|
391
|
+
options?: undefined;
|
|
392
|
+
multiSelect?: undefined;
|
|
349
393
|
explanation?: undefined;
|
|
350
394
|
plan?: undefined;
|
|
351
395
|
proof?: undefined;
|
|
@@ -378,6 +422,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
378
422
|
command?: undefined;
|
|
379
423
|
url?: undefined;
|
|
380
424
|
patch?: undefined;
|
|
425
|
+
question?: undefined;
|
|
426
|
+
header?: undefined;
|
|
427
|
+
options?: undefined;
|
|
428
|
+
multiSelect?: undefined;
|
|
381
429
|
explanation?: undefined;
|
|
382
430
|
plan?: undefined;
|
|
383
431
|
proof?: undefined;
|
|
@@ -407,6 +455,68 @@ export declare const LOCAL_TOOLS: ({
|
|
|
407
455
|
command?: undefined;
|
|
408
456
|
url?: undefined;
|
|
409
457
|
maxResults?: undefined;
|
|
458
|
+
question?: undefined;
|
|
459
|
+
header?: undefined;
|
|
460
|
+
options?: undefined;
|
|
461
|
+
multiSelect?: undefined;
|
|
462
|
+
explanation?: undefined;
|
|
463
|
+
plan?: undefined;
|
|
464
|
+
proof?: undefined;
|
|
465
|
+
reason?: undefined;
|
|
466
|
+
needed?: undefined;
|
|
467
|
+
};
|
|
468
|
+
required: string[];
|
|
469
|
+
};
|
|
470
|
+
} | {
|
|
471
|
+
name: string;
|
|
472
|
+
description: string;
|
|
473
|
+
inputSchema: {
|
|
474
|
+
type: string;
|
|
475
|
+
properties: {
|
|
476
|
+
question: {
|
|
477
|
+
type: string;
|
|
478
|
+
description: string;
|
|
479
|
+
};
|
|
480
|
+
header: {
|
|
481
|
+
type: string;
|
|
482
|
+
description: string;
|
|
483
|
+
};
|
|
484
|
+
options: {
|
|
485
|
+
type: string;
|
|
486
|
+
description: string;
|
|
487
|
+
minItems: number;
|
|
488
|
+
maxItems: number;
|
|
489
|
+
items: {
|
|
490
|
+
type: string;
|
|
491
|
+
properties: {
|
|
492
|
+
label: {
|
|
493
|
+
type: string;
|
|
494
|
+
description: string;
|
|
495
|
+
};
|
|
496
|
+
description: {
|
|
497
|
+
type: string;
|
|
498
|
+
description: string;
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
required: string[];
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
multiSelect: {
|
|
505
|
+
type: string;
|
|
506
|
+
description: string;
|
|
507
|
+
};
|
|
508
|
+
path?: undefined;
|
|
509
|
+
startLine?: undefined;
|
|
510
|
+
endLine?: undefined;
|
|
511
|
+
content?: undefined;
|
|
512
|
+
targetContent?: undefined;
|
|
513
|
+
replacementContent?: undefined;
|
|
514
|
+
query?: undefined;
|
|
515
|
+
pattern?: undefined;
|
|
516
|
+
command?: undefined;
|
|
517
|
+
url?: undefined;
|
|
518
|
+
maxResults?: undefined;
|
|
519
|
+
patch?: undefined;
|
|
410
520
|
explanation?: undefined;
|
|
411
521
|
plan?: undefined;
|
|
412
522
|
proof?: undefined;
|
|
@@ -454,6 +564,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
454
564
|
url?: undefined;
|
|
455
565
|
maxResults?: undefined;
|
|
456
566
|
patch?: undefined;
|
|
567
|
+
question?: undefined;
|
|
568
|
+
header?: undefined;
|
|
569
|
+
options?: undefined;
|
|
570
|
+
multiSelect?: undefined;
|
|
457
571
|
proof?: undefined;
|
|
458
572
|
reason?: undefined;
|
|
459
573
|
needed?: undefined;
|
|
@@ -482,6 +596,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
482
596
|
url?: undefined;
|
|
483
597
|
maxResults?: undefined;
|
|
484
598
|
patch?: undefined;
|
|
599
|
+
question?: undefined;
|
|
600
|
+
header?: undefined;
|
|
601
|
+
options?: undefined;
|
|
602
|
+
multiSelect?: undefined;
|
|
485
603
|
explanation?: undefined;
|
|
486
604
|
plan?: undefined;
|
|
487
605
|
reason?: undefined;
|
|
@@ -515,6 +633,10 @@ export declare const LOCAL_TOOLS: ({
|
|
|
515
633
|
url?: undefined;
|
|
516
634
|
maxResults?: undefined;
|
|
517
635
|
patch?: undefined;
|
|
636
|
+
question?: undefined;
|
|
637
|
+
header?: undefined;
|
|
638
|
+
options?: undefined;
|
|
639
|
+
multiSelect?: undefined;
|
|
518
640
|
explanation?: undefined;
|
|
519
641
|
plan?: undefined;
|
|
520
642
|
proof?: undefined;
|
|
@@ -575,6 +697,28 @@ export declare class Agent {
|
|
|
575
697
|
private recalledRecordIds;
|
|
576
698
|
private recalledRecords;
|
|
577
699
|
private lastBriefingSources;
|
|
700
|
+
/**
|
|
701
|
+
* 10b: latest MCP tool inventory captured by `listTools()` calls. Used by
|
|
702
|
+
* `createSystemMessage` to decide whether the BrainRouter memory section
|
|
703
|
+
* should render — when `memory_recall` is missing from this list (the
|
|
704
|
+
* cloud brain is offline), the prompt swaps to a brain-offline notice so
|
|
705
|
+
* the model doesn't try to call tools that aren't there. Undefined until
|
|
706
|
+
* the first successful list; treated as "assume online" by the prompt
|
|
707
|
+
* builder until then (back-compat for callers that don't list pre-turn).
|
|
708
|
+
*/
|
|
709
|
+
private lastKnownMcpTools?;
|
|
710
|
+
/**
|
|
711
|
+
* 9b: gated recall state. `recallHasFiredThisSession` flips to true on the
|
|
712
|
+
* first successful briefing injection so subsequent turns can skip the
|
|
713
|
+
* fresh recall pull unless a gated trigger fires. `recallNextTurnIsPost-
|
|
714
|
+
* Compaction` is set by `compactHistory()` to force the next turn through
|
|
715
|
+
* the full briefing path (compaction just dropped the prior briefing as
|
|
716
|
+
* collateral; replay it once so the model isn't blind). Both are
|
|
717
|
+
* cleared on `loadHistory` / `fork` / `bootstrapSession` so a fresh
|
|
718
|
+
* session re-pulls.
|
|
719
|
+
*/
|
|
720
|
+
private recallHasFiredThisSession;
|
|
721
|
+
private recallNextTurnIsPostCompaction;
|
|
578
722
|
private roleOverlay?;
|
|
579
723
|
private accessMode;
|
|
580
724
|
private silent;
|
|
@@ -604,11 +748,18 @@ export declare class Agent {
|
|
|
604
748
|
readonly agentId: string;
|
|
605
749
|
/** agent_id of the parent (set by spawn_agent for children). */
|
|
606
750
|
private parentAgentId?;
|
|
751
|
+
/** Agent tier — forwarded to OrchestrationContext so grandchildren can inherit hierarchy checks. */
|
|
752
|
+
readonly tier?: 'chat' | 'reasoning' | 'worker';
|
|
753
|
+
/** Spawn-chain depth (0 = direct chat-root child). Forwarded to hierarchy checks. */
|
|
754
|
+
readonly agentDepth: number;
|
|
607
755
|
constructor(mcpClient: McpClientWrapper, llmConfig: LLMConfig, options: AgentOptions);
|
|
608
756
|
/** Expose for orchestration so spawn_agent can record the parent linkage. */
|
|
609
757
|
getAgentId(): string;
|
|
610
758
|
/** Internal — used by spawn_agent to record which parent dispatched us. */
|
|
611
759
|
setParentAgentId(id: string | undefined): void;
|
|
760
|
+
private isModelVisibleMcpTool;
|
|
761
|
+
private rawMcpToolName;
|
|
762
|
+
private serverIdFromMcpToolName;
|
|
612
763
|
private allowedToolsForAccess;
|
|
613
764
|
runTurn(prompt: string, callbacks: RunTurnCallbacks): Promise<string>;
|
|
614
765
|
/** Rough token estimate (1 token ≈ 4 characters of English / code). */
|
|
@@ -708,9 +859,30 @@ export declare class Agent {
|
|
|
708
859
|
* Idempotent: calling this with a tag that isn't present is a no-op.
|
|
709
860
|
*/
|
|
710
861
|
removeTaggedSystemMessage(tag: string): void;
|
|
862
|
+
/**
|
|
863
|
+
* Zero the in-process counters that back `/tokens`. Call this on any
|
|
864
|
+
* conceptual session boundary (`/resume`, `fork`) — otherwise the parent
|
|
865
|
+
* row keeps accumulating across the switch and "this session" no longer
|
|
866
|
+
* matches the displayed sessionKey.
|
|
867
|
+
*/
|
|
868
|
+
resetSessionCounters(): void;
|
|
711
869
|
/** Fork the current chat history into a fresh sessionKey. Returns the new key. */
|
|
712
870
|
fork(newSessionKey: string): string;
|
|
713
871
|
private bootstrapSession;
|
|
872
|
+
/**
|
|
873
|
+
* Public, callback-free wrapper around bootstrapSession for slash commands
|
|
874
|
+
* that mutate per-session state (notably `/goal`) BEFORE any runTurn has
|
|
875
|
+
* fired. Without this, the FIRST `/goal` of a session writes goal.json
|
|
876
|
+
* under the deterministic fallback sessionKey ("brainrouter-cli:<path>")
|
|
877
|
+
* because bootstrap hasn't happened yet, but every subsequent runTurn
|
|
878
|
+
* reads from the MCP-resolved UUID sessionKey — split-brain that left
|
|
879
|
+
* the agent reading a stale goal from a different directory.
|
|
880
|
+
*
|
|
881
|
+
* Idempotent: returns immediately if already initialized. Tolerates
|
|
882
|
+
* missing MCP — falls back to the deterministic key the same way
|
|
883
|
+
* bootstrapSession does.
|
|
884
|
+
*/
|
|
885
|
+
ensureInitialized(): Promise<void>;
|
|
714
886
|
private createSystemMessage;
|
|
715
887
|
private injectRecallContext;
|
|
716
888
|
/** Inspectable summary of the most recent memory briefing. Used by the `/briefing` slash command. */
|
|
@@ -718,6 +890,13 @@ export declare class Agent {
|
|
|
718
890
|
sources: string[];
|
|
719
891
|
recordIds: string[];
|
|
720
892
|
};
|
|
893
|
+
/**
|
|
894
|
+
* Snapshot of the records produced by the most recent pre-turn briefing.
|
|
895
|
+
* `/where` surfaces a few of these to give the user a sense of what the
|
|
896
|
+
* agent is leaning on right now. Returns a shallow copy so callers can't
|
|
897
|
+
* mutate the agent's internal state.
|
|
898
|
+
*/
|
|
899
|
+
getRecalledRecords(): RecalledRecord[];
|
|
721
900
|
/** One-line summary of any new contradiction surfaced after the last capture, or undefined if none. */
|
|
722
901
|
private lastContradictionWarning?;
|
|
723
902
|
takeContradictionWarning(): string | undefined;
|
|
@@ -757,8 +936,50 @@ export declare function getToolSummary(name: string, args: Record<string, any>,
|
|
|
757
936
|
* the terminal. Returns undefined when no useful preview is available.
|
|
758
937
|
*/
|
|
759
938
|
export declare function getToolPreview(name: string, args: Record<string, any>, result: string): string | undefined;
|
|
760
|
-
|
|
761
|
-
|
|
939
|
+
/**
|
|
940
|
+
* Heuristic for "does this model accept the OpenAI Chat Completions
|
|
941
|
+
* `reasoning_effort` field?". The signal that actually matters is the
|
|
942
|
+
* **model name**, not the endpoint hostname — modern OpenAI-compatible
|
|
943
|
+
* servers (LM Studio 0.3.29+, Ollama, vLLM, OpenRouter, OpenAI itself)
|
|
944
|
+
* all accept the field on /v1/chat/completions for the reasoning-capable
|
|
945
|
+
* model classes below, and silently ignore it for everything else. So a
|
|
946
|
+
* `gpt-oss-20b` served from localhost via LM Studio gets the same
|
|
947
|
+
* treatment as `gpt-5` on `api.openai.com`.
|
|
948
|
+
*
|
|
949
|
+
* Borrowed shape from openai-node's `ReasoningEffort` enum
|
|
950
|
+
* (openSrc/openai-node/src/resources/shared.ts) — `low|medium|high` map
|
|
951
|
+
* straight through to the provider field across OpenAI, DeepSeek,
|
|
952
|
+
* LM Studio, Ollama, and OpenRouter's pass-through. Anthropic models
|
|
953
|
+
* (`claude-*`) use a different field shape (`thinking: { budget_tokens }`)
|
|
954
|
+
* and a different endpoint (`/v1/messages`), so they're intentionally
|
|
955
|
+
* skipped here — brainrouter would need a separate provider adapter to
|
|
956
|
+
* forward into Anthropic's native API.
|
|
957
|
+
*/
|
|
958
|
+
/**
|
|
959
|
+
* 9b: resolve the recall-gating mode for this process. `BRAINROUTER_RECALL_MODE`
|
|
960
|
+
* env var beats everything; unset defaults to `gated`. Anything outside the
|
|
961
|
+
* three valid values falls back to `gated` (defensive — better to be helpful
|
|
962
|
+
* than crash on a typo). Re-resolved each turn so users can flip with
|
|
963
|
+
* `export BRAINROUTER_RECALL_MODE=always` mid-session via a /run command.
|
|
964
|
+
*/
|
|
965
|
+
export declare function resolveRecallMode(): 'always' | 'gated' | 'off';
|
|
966
|
+
/**
|
|
967
|
+
* 9b: cheap local heuristic for "the user message names something specific
|
|
968
|
+
* memory might have history on." Counts entity-shaped tokens: proper nouns
|
|
969
|
+
* (capitalized words that aren't sentence-starting), file paths (anything
|
|
970
|
+
* with `/` or `\\` or a `.<ext>` suffix), and identifier-shaped tokens (`camelCase`
|
|
971
|
+
* / `snake_case` / `PascalCase` longer than 4 chars). Crude but the bar is
|
|
972
|
+
* "is recall plausibly worth it?" — false positives waste a recall call,
|
|
973
|
+
* false negatives waste an ask. Tunable threshold via the caller.
|
|
974
|
+
*/
|
|
975
|
+
export declare function countEntityTokens(text: string): number;
|
|
976
|
+
export declare function supportsReasoningEffortField(config: LLMConfig): boolean;
|
|
977
|
+
export interface BuildPayloadOptions {
|
|
978
|
+
/** Reasoning-depth preference, when provider supports it. `medium` is a no-op. */
|
|
979
|
+
effort?: EffortLevel;
|
|
980
|
+
}
|
|
981
|
+
export declare function buildChatCompletionPayload(config: LLMConfig, messages: any[], tools: any[], options?: BuildPayloadOptions): ChatCompletionPayload;
|
|
982
|
+
export declare function callOpenAI(config: LLMConfig, messages: any[], tools: any[], options?: BuildPayloadOptions): Promise<{
|
|
762
983
|
content: any;
|
|
763
984
|
toolCalls: any;
|
|
764
985
|
usage: any;
|