@botconnector/bccli 0.4.0 → 0.4.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.en.md +13 -2
- package/README.md +13 -2
- package/dist/abort.d.ts +5 -0
- package/dist/{acp-ATIL4JOZ.js → acp-UYC6APR5.js} +30 -6
- package/dist/acp.d.ts +28 -0
- package/dist/agent.d.ts +147 -0
- package/dist/agents.d.ts +4 -0
- package/dist/args-NRTZWWEV.js +13 -0
- package/dist/args.d.ts +53 -0
- package/dist/budget.d.ts +23 -0
- package/dist/checkpoints.d.ts +35 -0
- package/dist/{chunk-6M5X2KZE.js → chunk-266SY3MC.js} +1 -1
- package/dist/{chunk-7F3IWBPQ.js → chunk-3I5BW3ZT.js} +20 -9
- package/dist/{chunk-UZWJQF67.js → chunk-3WHI4LN3.js} +2 -1
- package/dist/{chunk-PUN4HMAG.js → chunk-5YJ3ZQVR.js} +73 -10
- package/dist/{chunk-L7QI6JN2.js → chunk-6M55UPES.js} +7 -7
- package/dist/{chunk-KEMYIGCP.js → chunk-6UO5GX55.js} +26 -12
- package/dist/{chunk-TLPFQIS2.js → chunk-C64KM37J.js} +36 -6
- package/dist/{chunk-JL5ZCSP2.js → chunk-H7XJDKJY.js} +4 -4
- package/dist/{chunk-SPRNLS7K.js → chunk-HQW4BROS.js} +4 -5
- package/dist/{chunk-XBO5GACQ.js → chunk-IYR5PYA3.js} +4 -4
- package/dist/{chunk-45SDLMTV.js → chunk-JXM6REER.js} +1 -1
- package/dist/{chunk-BLOYFIAD.js → chunk-KPTML72Q.js} +1 -1
- package/dist/{chunk-BQ2IGPBR.js → chunk-NQOGVP3I.js} +2 -2
- package/dist/{chunk-QZKLZELZ.js → chunk-OK2USAXX.js} +28 -4
- package/dist/{chunk-TVALKHFB.js → chunk-R72OV7RF.js} +421 -108
- package/dist/{chunk-LACUWBWS.js → chunk-RX4UQX43.js} +25 -10
- package/dist/{chunk-QDQU6VY2.js → chunk-SVD4LHJC.js} +73 -3
- package/dist/{chunk-BNA74HPN.js → chunk-TIMSYZIR.js} +7 -7
- package/dist/{chunk-O7M3TGIW.js → chunk-WFZKJY3R.js} +43 -4
- package/dist/{chunk-M7CALSP3.js → chunk-ZEPTUKNW.js} +120 -32
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +61 -45
- package/dist/clipboardImage.d.ts +17 -0
- package/dist/commands.d.ts +16 -0
- package/dist/{completion-HPPFDAPB.js → completion-D2BSBTQO.js} +1 -1
- package/dist/completion.d.ts +14 -0
- package/dist/{config-COPNMMV6.js → config-ENDRMOTP.js} +3 -3
- package/dist/{config-RZ5JONMX.js → config-LAINORU5.js} +8 -4
- package/dist/config.d.ts +99 -0
- package/dist/context.d.ts +13 -0
- package/dist/contextWindow.d.ts +3 -0
- package/dist/diff.d.ts +7 -0
- package/dist/exit.d.ts +9 -0
- package/dist/extensions.d.ts +34 -0
- package/dist/{ghBotCli-IBCZIWT5.js → ghBotCli-TSLRORJJ.js} +21 -20
- package/dist/ghBotCli.d.ts +9 -0
- package/dist/ghBotDispatch.d.ts +68 -0
- package/dist/ghBotRunner.d.ts +82 -0
- package/dist/ghBotServe.d.ts +21 -0
- package/dist/ghBotWebhook.d.ts +45 -0
- package/dist/hooks.d.ts +27 -0
- package/dist/i18n/id.d.ts +1 -0
- package/dist/i18n.d.ts +16 -0
- package/dist/{integrationCli-P75R2VSC.js → integrationCli-HXCSEWH2.js} +2 -2
- package/dist/integrationCli.d.ts +9 -0
- package/dist/keybinds.d.ts +22 -0
- package/dist/{login-SYIQP46J.js → login-RYESFZG6.js} +4 -4
- package/dist/login.d.ts +19 -0
- package/dist/lsp.d.ts +50 -0
- package/dist/mcp/catalog.d.ts +14 -0
- package/dist/mcp/config.d.ts +36 -0
- package/dist/mcp/manager.d.ts +52 -0
- package/dist/mcp/oauth.d.ts +82 -0
- package/dist/{mcpCli-QUV5SD64.js → mcpCli-SETTCL3K.js} +6 -6
- package/dist/mcpCli.d.ts +3 -0
- package/dist/mcpServer/serve.d.ts +8 -0
- package/dist/mcpServer/server.d.ts +19 -0
- package/dist/models.d.ts +13 -0
- package/dist/{modelsCli-TRRB5LX4.js → modelsCli-OP7CDZC7.js} +6 -6
- package/dist/modelsCli.d.ts +15 -0
- package/dist/npmRunner.d.ts +21 -0
- package/dist/{oauthLogin-6FWQABJ7.js → oauthLogin-XWY7OHCG.js} +1 -1
- package/dist/oauthLogin.d.ts +47 -0
- package/dist/permissions.d.ts +30 -0
- package/dist/pluginSpec.d.ts +25 -0
- package/dist/plugins.d.ts +45 -0
- package/dist/{pluginsCli-GNW4TPVV.js → pluginsCli-ZQNKWZHJ.js} +2 -2
- package/dist/pluginsCli.d.ts +16 -0
- package/dist/{prCli-5IMV3VNQ.js → prCli-6PUWTMTP.js} +20 -4
- package/dist/prCli.d.ts +46 -0
- package/dist/presets.d.ts +8 -0
- package/dist/print.d.ts +16 -0
- package/dist/provider.d.ts +145 -0
- package/dist/providerCli-5OZI2GQQ.js +15 -0
- package/dist/providerCli.d.ts +17 -0
- package/dist/providers.d.ts +6 -0
- package/dist/reasoning.d.ts +12 -0
- package/dist/repomap.d.ts +10 -0
- package/dist/sdk.d.ts +61 -0
- package/dist/sdk.js +829 -191
- package/dist/{serve-JG7RLIUD.js → serve-4J7HA4JO.js} +24 -18
- package/dist/{serve-6QLBJUYW.js → serve-K5AH4MGO.js} +3 -3
- package/dist/serve.d.ts +37 -0
- package/dist/serveHeartbeat.d.ts +14 -0
- package/dist/serveProtocol.d.ts +47 -0
- package/dist/session-YQXCCKXI.js +12 -0
- package/dist/session.d.ts +33 -0
- package/dist/setup-S4AJT6XE.js +24 -0
- package/dist/setup.d.ts +74 -0
- package/dist/slash/copy.d.ts +1 -0
- package/dist/slash/diff.d.ts +1 -0
- package/dist/slash/doctor.d.ts +18 -0
- package/dist/slash/export.d.ts +2 -0
- package/dist/slash/info.d.ts +46 -0
- package/dist/slash/memory.d.ts +10 -0
- package/dist/{statsCli-CF3R7ATL.js → statsCli-XR6BEZQQ.js} +2 -2
- package/dist/statsCli.d.ts +62 -0
- package/dist/textToolCalls.d.ts +6 -0
- package/dist/thinking.d.ts +17 -0
- package/dist/tokenBudget.d.ts +22 -0
- package/dist/tools/bash.d.ts +52 -0
- package/dist/tools/diagnostics.d.ts +5 -0
- package/dist/tools/edit.d.ts +12 -0
- package/dist/tools/fetch.d.ts +41 -0
- package/dist/tools/glob.d.ts +5 -0
- package/dist/tools/globSafety.d.ts +7 -0
- package/dist/tools/grep.d.ts +25 -0
- package/dist/tools/ignore.d.ts +2 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/memory.d.ts +13 -0
- package/dist/tools/paths.d.ts +4 -0
- package/dist/tools/plan.d.ts +10 -0
- package/dist/tools/read.d.ts +16 -0
- package/dist/tools/repomap.d.ts +2 -0
- package/dist/tools/sandbox.d.ts +12 -0
- package/dist/tools/shell.d.ts +18 -0
- package/dist/tools/skill.d.ts +3 -0
- package/dist/tools/task.d.ts +28 -0
- package/dist/tools/todo.d.ts +13 -0
- package/dist/tools/types.d.ts +52 -0
- package/dist/tools/websearch.d.ts +9 -0
- package/dist/tools/write.d.ts +5 -0
- package/dist/{transferCli-TK2GSVRK.js → transferCli-R2KEIWQR.js} +8 -6
- package/dist/transferCli.d.ts +23 -0
- package/dist/ui/App.d.ts +7 -0
- package/dist/ui/DiffView.d.ts +3 -0
- package/dist/ui/EditableText.d.ts +7 -0
- package/dist/ui/LinePrompt.d.ts +6 -0
- package/dist/ui/ListPicker.d.ts +11 -0
- package/dist/ui/Markdown.d.ts +8 -0
- package/dist/ui/McpMenu.d.ts +11 -0
- package/dist/ui/ModelPicker.d.ts +6 -0
- package/dist/ui/PermissionPrompt.d.ts +5 -0
- package/dist/ui/PlanApproval.d.ts +5 -0
- package/dist/ui/PromptInput.d.ts +18 -0
- package/dist/ui/ProviderMenu.d.ts +10 -0
- package/dist/ui/Spinner.d.ts +4 -0
- package/dist/ui/StatusBar.d.ts +9 -0
- package/dist/ui/TodoList.d.ts +4 -0
- package/dist/ui/ToolBlock.d.ts +14 -0
- package/dist/ui/complete.d.ts +6 -0
- package/dist/ui/focusReport.d.ts +1 -0
- package/dist/ui/index.d.ts +7 -0
- package/dist/ui/lineEdit.d.ts +42 -0
- package/dist/ui/replay.d.ts +4 -0
- package/dist/ui/table.d.ts +20 -0
- package/dist/ui/theme.d.ts +5 -0
- package/dist/ui/thinkingMouse.d.ts +33 -0
- package/dist/ui/transcript.d.ts +55 -0
- package/dist/ui/vim.d.ts +26 -0
- package/dist/{ui-B3CJ6TGE.js → ui-36ZEK65V.js} +179 -54
- package/dist/{update-K5IQ2MYR.js → update-FSS7X5WV.js} +2 -2
- package/dist/update.d.ts +30 -0
- package/dist/verify.d.ts +16 -0
- package/dist/version.d.ts +1 -0
- package/dist/webBudget.d.ts +25 -0
- package/dist/worktree.d.ts +12 -0
- package/package.json +26 -13
- package/dist/args-J5ONVGIF.js +0 -13
- package/dist/providerCli-FAOZHOKW.js +0 -15
- package/dist/session-KBAQ4BZ5.js +0 -12
- package/dist/setup-FJAWDWV4.js +0 -24
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare function htmlToText(html: string): string;
|
|
3
|
+
export declare function isPrivateHost(host: string): boolean;
|
|
4
|
+
export interface PinnedAddress {
|
|
5
|
+
address: string;
|
|
6
|
+
family: number;
|
|
7
|
+
}
|
|
8
|
+
type LookupCallback = (err: NodeJS.ErrnoException | null, address: string | PinnedAddress[], family?: number) => void;
|
|
9
|
+
/**
|
|
10
|
+
* A DNS lookup that answers with the address the rebinding guard already validated,
|
|
11
|
+
* so the socket connects to exactly the IP that was checked (closes the
|
|
12
|
+
* resolve-then-fetch gap). An empty pin falls back to the real resolver; a family
|
|
13
|
+
* mismatch refuses instead of re-resolving, and unknown hostnames use real DNS.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pinLookup(pinned: PinnedAddress[]): (hostname: string, options: unknown, callback: LookupCallback) => void;
|
|
16
|
+
/** Best BM25 chunks for `query`, in page order; null when no chunk shares a word with it. */
|
|
17
|
+
export declare function pickRelevant(text: string, query: string, count?: number, size?: number): string | null;
|
|
18
|
+
export declare const clearFetchCache: () => void;
|
|
19
|
+
export interface FetchToolOptions {
|
|
20
|
+
/** Keenable fetch endpoint used when `prompt` is given; null disables it. */
|
|
21
|
+
keenableURL?: string | null;
|
|
22
|
+
isPrivate?: (host: string) => boolean;
|
|
23
|
+
/** DNS resolver for the rebinding guard; injectable for tests. */
|
|
24
|
+
lookup?: (hostname: string) => Promise<Array<{
|
|
25
|
+
address: string;
|
|
26
|
+
family: number;
|
|
27
|
+
}>>;
|
|
28
|
+
/** Page fetch override for tests; receives the same init (including `dispatcher`). */
|
|
29
|
+
fetchPage?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
30
|
+
}
|
|
31
|
+
export declare function createFetchTool(opts?: FetchToolOptions): import("./types").Tool<z.ZodObject<{
|
|
32
|
+
url: z.ZodString;
|
|
33
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
34
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
export declare const fetchTool: import("./types").Tool<z.ZodObject<{
|
|
37
|
+
url: z.ZodString;
|
|
38
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
39
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reject glob inputs that can trigger pathological brace expansion before they
|
|
3
|
+
* reach the glob engine. Backslash-escaped braces are literals.
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateGlobPattern(pattern: string): string | undefined;
|
|
6
|
+
/** Keep tool/UI path output stable across Windows and POSIX. */
|
|
7
|
+
export declare function normalizeGlobPath(path: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export interface GrepOptions {
|
|
3
|
+
root: string;
|
|
4
|
+
projectRoot?: string;
|
|
5
|
+
glob?: string;
|
|
6
|
+
ignoreCase?: boolean;
|
|
7
|
+
literal?: boolean;
|
|
8
|
+
context?: number;
|
|
9
|
+
outputMode?: 'content' | 'files_with_matches' | 'count';
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export declare function grepJs(pattern: string, opts: GrepOptions): Promise<string[]>;
|
|
13
|
+
export declare const grepTool: import("./types").Tool<z.ZodObject<{
|
|
14
|
+
pattern: z.ZodString;
|
|
15
|
+
path: z.ZodOptional<z.ZodString>;
|
|
16
|
+
glob: z.ZodOptional<z.ZodString>;
|
|
17
|
+
ignore_case: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
literal: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
output_mode: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
content: "content";
|
|
22
|
+
count: "count";
|
|
23
|
+
files_with_matches: "files_with_matches";
|
|
24
|
+
}>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Tool } from './types';
|
|
2
|
+
export interface ToolDefinition {
|
|
3
|
+
type: 'function';
|
|
4
|
+
function: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
parameters: Record<string, unknown>;
|
|
8
|
+
output_schema?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const ALL_TOOLS: Tool[];
|
|
12
|
+
export declare function toolDefinitions(tools: Tool[]): ToolDefinition[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineTool } from './types';
|
|
2
|
+
export interface SaveMemoryOptions {
|
|
3
|
+
/** Global store lives at <home>/BCCLI.md; project store at <cwd>/AGENTS.md. */
|
|
4
|
+
home: string;
|
|
5
|
+
/** Called after the instruction files changed so the system prompt can be rebuilt. */
|
|
6
|
+
onSaved?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Lets the model persist durable facts itself (same store as /memory): project rules
|
|
10
|
+
* go to AGENTS.md, cross-project preferences to the global BCCLI.md. Duplicate lines
|
|
11
|
+
* are not written again.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createSaveMemoryTool(opts: SaveMemoryOptions): ReturnType<typeof defineTool>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function resolvePath(cwd: string, path: string): string;
|
|
2
|
+
export declare function errorCode(error: unknown): string;
|
|
3
|
+
export declare function recordFileMtime(readFiles: Set<string>, abs: string): void;
|
|
4
|
+
export declare function isFileModifiedSinceRead(readFiles: Set<string>, abs: string): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Permissions } from '../permissions';
|
|
2
|
+
import { type Tool } from './types';
|
|
3
|
+
export type PlanDecision = 'acceptEdits' | 'default' | 'allowAll' | 'no';
|
|
4
|
+
export interface Interaction {
|
|
5
|
+
approvePlan(plan: string): Promise<PlanDecision>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createExitPlanTool(opts: {
|
|
8
|
+
permissions: Permissions;
|
|
9
|
+
interaction: Interaction;
|
|
10
|
+
}): Tool;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MAX_IMAGE_BYTES: number;
|
|
3
|
+
export interface ReadToolOptions {
|
|
4
|
+
/** Attach images to the conversation as vision parts instead of refusing binary files. Default true. */
|
|
5
|
+
vision?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function createReadTool(options?: ReadToolOptions): import("./types").Tool<z.ZodObject<{
|
|
8
|
+
path: z.ZodString;
|
|
9
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
export declare const readTool: import("./types").Tool<z.ZodObject<{
|
|
13
|
+
path: z.ZodString;
|
|
14
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function sandboxSupported(platform: NodeJS.Platform): boolean;
|
|
2
|
+
/** Seatbelt profile: read everything, write only under cwd + temp areas, network only when allowed. */
|
|
3
|
+
export declare function darwinProfile(cwd: string, network: boolean): string;
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a shell command in the platform sandbox, or undefined when the platform has none
|
|
6
|
+
* (the caller then refuses to run it sandboxed rather than silently running it raw).
|
|
7
|
+
*/
|
|
8
|
+
export declare function sandboxArgv(command: string, opts: {
|
|
9
|
+
platform: NodeJS.Platform;
|
|
10
|
+
cwd: string;
|
|
11
|
+
network: boolean;
|
|
12
|
+
}): string[] | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a command string is run. `undefined` (posix) keeps the default `sh -c` behaviour.
|
|
3
|
+
* On Windows we never use cmd.exe: Git Bash gives the usual Unix tools (tail, grep, ls,
|
|
4
|
+
* sed); without it we fall back to Windows PowerShell with UTF-8 output.
|
|
5
|
+
*/
|
|
6
|
+
export interface ShellSpec {
|
|
7
|
+
name: 'bash' | 'powershell';
|
|
8
|
+
file: string;
|
|
9
|
+
args: (command: string) => string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ShellDeps {
|
|
12
|
+
platform: NodeJS.Platform;
|
|
13
|
+
env: NodeJS.ProcessEnv;
|
|
14
|
+
exists: (path: string) => boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveShell(deps: ShellDeps): ShellSpec | undefined;
|
|
17
|
+
/** Shell for the current machine, resolved once. */
|
|
18
|
+
export declare function defaultShell(): ShellSpec | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentDef } from '../extensions';
|
|
2
|
+
import type { Permissions } from '../permissions';
|
|
3
|
+
import type { Provider } from '../provider';
|
|
4
|
+
import type { ReasoningLevel } from '../reasoning';
|
|
5
|
+
import { type Tool } from './types';
|
|
6
|
+
import type { HooksConfig } from '../hooks';
|
|
7
|
+
type TaskToolOptionsPluginEmit = (event: 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'Stop', payload?: {
|
|
8
|
+
tool?: string;
|
|
9
|
+
input?: unknown;
|
|
10
|
+
output?: string;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
export interface TaskToolOptions {
|
|
13
|
+
agents: AgentDef[];
|
|
14
|
+
baseTools: () => Tool[];
|
|
15
|
+
permissions: Permissions;
|
|
16
|
+
provider: () => Provider;
|
|
17
|
+
providerFor: (modelRef: string) => Provider;
|
|
18
|
+
systemPrompt: string | ((modelRef?: string) => string);
|
|
19
|
+
cwd: string;
|
|
20
|
+
reasoning?: () => ReasoningLevel;
|
|
21
|
+
/** Inherited by subagents so their tool calls fire the same hooks as the main agent. */
|
|
22
|
+
hooks?: HooksConfig;
|
|
23
|
+
/** Inherited by subagents so their tool calls fire the same plugin observers as the main agent. */
|
|
24
|
+
pluginEmit?: TaskToolOptionsPluginEmit;
|
|
25
|
+
env?: NodeJS.ProcessEnv;
|
|
26
|
+
}
|
|
27
|
+
export declare function createTaskTool(opts: TaskToolOptions): Tool;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Tool } from './types';
|
|
2
|
+
export type TodoStatus = 'pending' | 'in_progress' | 'completed';
|
|
3
|
+
export interface TodoItem {
|
|
4
|
+
content: string;
|
|
5
|
+
status: TodoStatus;
|
|
6
|
+
}
|
|
7
|
+
export declare class TodoStore {
|
|
8
|
+
items: TodoItem[];
|
|
9
|
+
private readonly listeners;
|
|
10
|
+
set(items: TodoItem[]): void;
|
|
11
|
+
subscribe(fn: (items: TodoItem[]) => void): () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createTodoTool(store: TodoStore): Tool;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AgentEvent, AskPermission } from '../agent';
|
|
3
|
+
import type { Usage } from '../provider';
|
|
4
|
+
export type PermissionKind = 'read' | 'edit' | 'bash' | 'fetch' | 'mcp';
|
|
5
|
+
export interface ToolContext {
|
|
6
|
+
cwd: string;
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
/** Absolute paths read in this session; edit/write of existing files require membership. */
|
|
9
|
+
readFiles: Set<string>;
|
|
10
|
+
callId?: string;
|
|
11
|
+
emit?: (event: AgentEvent) => void;
|
|
12
|
+
ask?: AskPermission;
|
|
13
|
+
addUsage?: (usage: Usage) => void;
|
|
14
|
+
/** A fetch that was answered from cache calls this so it does not count against the per-turn fetch limit. */
|
|
15
|
+
refundFetch?: () => void;
|
|
16
|
+
/** Called with the absolute path before a file is written, so the change can be undone. */
|
|
17
|
+
checkpoint?: (absPath: string) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export interface ImageAttachment {
|
|
20
|
+
mediaType: string;
|
|
21
|
+
/** Base64 (no data: prefix). */
|
|
22
|
+
data: string;
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ToolResult {
|
|
26
|
+
/** Sent back to the model. */
|
|
27
|
+
output: string;
|
|
28
|
+
isError?: boolean;
|
|
29
|
+
/** Optional richer text for the UI (e.g. a diff). */
|
|
30
|
+
display?: string;
|
|
31
|
+
/** Image files read this call; the agent injects them as a user message with image parts. */
|
|
32
|
+
images?: ImageAttachment[];
|
|
33
|
+
}
|
|
34
|
+
export interface Tool<S extends z.ZodType = z.ZodType> {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
schema: S;
|
|
38
|
+
kind: PermissionKind;
|
|
39
|
+
/** Raw JSON schema sent to the model instead of converting `schema` (used for MCP tools). */
|
|
40
|
+
jsonSchema?: Record<string, unknown>;
|
|
41
|
+
outputJsonSchema?: Record<string, unknown>;
|
|
42
|
+
target(input: z.infer<S>): string;
|
|
43
|
+
preview?(input: z.infer<S>, ctx: ToolContext): Promise<string | undefined>;
|
|
44
|
+
/** Cheap pre-check run before asking permission; returns an error message when the call cannot succeed. */
|
|
45
|
+
validate?(input: z.infer<S>, ctx: ToolContext): Promise<string | undefined>;
|
|
46
|
+
/** Consecutive calls whose tool returns true here run concurrently. */
|
|
47
|
+
parallelSafe?(input: z.infer<S>): boolean;
|
|
48
|
+
/** Internal safety metadata: safe to call from a bounded read-only PTC program. */
|
|
49
|
+
programmaticSafe?: boolean;
|
|
50
|
+
run(input: z.infer<S>, ctx: ToolContext): Promise<ToolResult>;
|
|
51
|
+
}
|
|
52
|
+
export declare function defineTool<S extends z.ZodType>(tool: Tool<S>): Tool<S>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Tool } from './types';
|
|
2
|
+
export declare function createWebSearchTool(opts: {
|
|
3
|
+
/** BotConnector Cloud endpoint + key, when the user has one; searches then go through our server. */
|
|
4
|
+
botconnector: () => {
|
|
5
|
+
baseURL: string;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
keenableURL?: string;
|
|
9
|
+
}): Tool;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
Session
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-SVD4LHJC.js";
|
|
5
|
+
import "./chunk-5YJ3ZQVR.js";
|
|
6
|
+
import "./chunk-KPTML72Q.js";
|
|
7
7
|
import {
|
|
8
8
|
t
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3WHI4LN3.js";
|
|
10
10
|
|
|
11
11
|
// src/transferCli.ts
|
|
12
12
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
13
|
-
import { dirname, join } from "path";
|
|
13
|
+
import { dirname, join, resolve } from "path";
|
|
14
14
|
function runExportCommand(args, deps) {
|
|
15
15
|
const first = (args.subArgs[0] ?? "").trim();
|
|
16
16
|
let source;
|
|
17
17
|
let dest;
|
|
18
|
-
|
|
18
|
+
const sessionsRoot = resolve(args.home, "sessions");
|
|
19
|
+
const isSourceSession = first.endsWith(".jsonl") && existsSync(first) && statSync(first).isFile() && (args.subArgs.length >= 2 || resolve(first).startsWith(sessionsRoot));
|
|
20
|
+
if (isSourceSession) {
|
|
19
21
|
source = first;
|
|
20
22
|
dest = args.subArgs[1];
|
|
21
23
|
} else {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
export interface TransferCliArgs {
|
|
3
|
+
subArgs: string[];
|
|
4
|
+
home: string;
|
|
5
|
+
cwd: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TransferDeps {
|
|
8
|
+
out(line: string): void;
|
|
9
|
+
err?(line: string): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `bccli export [file]` — copy the latest session in this folder to `file`
|
|
13
|
+
* (or stdout when no file is given). Older sessions can be exported by
|
|
14
|
+
* passing their absolute JSONL path as the first argument.
|
|
15
|
+
*/
|
|
16
|
+
export declare function runExportCommand(args: TransferCliArgs, deps: TransferDeps): number;
|
|
17
|
+
/**
|
|
18
|
+
* `bccli import <file>` — copy a session JSONL into the current project.
|
|
19
|
+
* Every line must parse as JSON before anything is written (atomic).
|
|
20
|
+
*/
|
|
21
|
+
export declare function runImportCommand(args: TransferCliArgs, deps: TransferDeps): number;
|
|
22
|
+
/** Re-exported for tests that need the latest-session helper. */
|
|
23
|
+
export { readdirSync };
|
package/dist/ui/App.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type LineState } from './lineEdit';
|
|
2
|
+
/** A line of text with the cursor drawn where it is (the character under it, or a space at the end, in reverse video). */
|
|
3
|
+
export declare function EditableText({ state, mask, showCursor }: {
|
|
4
|
+
state: LineState;
|
|
5
|
+
mask?: boolean;
|
|
6
|
+
showCursor?: boolean;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ListItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
hint?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function ListPicker({ title, items, onPick }: {
|
|
8
|
+
title: string;
|
|
9
|
+
items: ListItem[];
|
|
10
|
+
onPick(id?: string): void;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `indent` is how many columns the surrounding UI already uses (a bullet, a border), so tables and rules are
|
|
3
|
+
* sized to what is really left of the terminal width.
|
|
4
|
+
*/
|
|
5
|
+
export declare function Markdown({ text, indent }: {
|
|
6
|
+
text: string;
|
|
7
|
+
indent?: number;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface McpMenuItem {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
status: 'ready' | 'error' | 'starting' | 'off';
|
|
5
|
+
error?: string;
|
|
6
|
+
installed: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function McpMenu({ items, onPick }: {
|
|
9
|
+
items: McpMenuItem[];
|
|
10
|
+
onPick(name: string | undefined): void;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PromptInputProps {
|
|
2
|
+
disabled?: boolean;
|
|
3
|
+
history: string[];
|
|
4
|
+
cwd: string;
|
|
5
|
+
onSubmit(text: string): void;
|
|
6
|
+
extraCommands?: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
10
|
+
/** Text inserted at the cursor from outside (e.g. a pasted clipboard image path); `n` triggers each insert. */
|
|
11
|
+
injected?: {
|
|
12
|
+
text: string;
|
|
13
|
+
n: number;
|
|
14
|
+
};
|
|
15
|
+
/** Vim editing: Esc enters normal mode (hjkl/w/b/0/$/x/dd/dw/i/a/A/o/O). */
|
|
16
|
+
vim?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function PromptInput({ disabled, history, cwd, onSubmit, extraCommands, injected, vim }: PromptInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ProviderEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
ready: boolean;
|
|
5
|
+
baseURL: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ProviderMenu({ entries, onPick }: {
|
|
8
|
+
entries: ProviderEntry[];
|
|
9
|
+
onPick(id: string | 'custom' | undefined): void;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PermissionMode } from '../config';
|
|
2
|
+
import type { ReasoningLevel } from '../reasoning';
|
|
3
|
+
export declare function StatusBar({ mode, tokens, busy, model, reasoning }: {
|
|
4
|
+
mode: PermissionMode;
|
|
5
|
+
tokens: number;
|
|
6
|
+
busy: boolean;
|
|
7
|
+
model?: string;
|
|
8
|
+
reasoning?: ReasoningLevel;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SubLine } from './transcript';
|
|
2
|
+
export interface ToolBlockProps {
|
|
3
|
+
tool: string;
|
|
4
|
+
target: string;
|
|
5
|
+
output?: string;
|
|
6
|
+
display?: string;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
done: boolean;
|
|
9
|
+
expanded?: boolean;
|
|
10
|
+
sub?: SubLine[];
|
|
11
|
+
/** Display spec of the "show full output" keybind, so the hint follows a rebound key. */
|
|
12
|
+
moreBind?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function ToolBlock({ tool, target, output, display, isError, done, expanded, sub, moreBind }: ToolBlockProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function completeFile(value: string, cwd: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Pre-attaches small non-secret project files referenced via `@path/to/file` in a user prompt,
|
|
4
|
+
* and records them in `readFiles` so the model can inspect or edit them without an extra tool turn.
|
|
5
|
+
*/
|
|
6
|
+
export declare function expandAtFileMentions(prompt: string, cwd: string, readFiles?: Set<string>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFocusReport: (input: string) => boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface LineState {
|
|
2
|
+
value: string;
|
|
3
|
+
cursor: number;
|
|
4
|
+
}
|
|
5
|
+
export interface EditKey {
|
|
6
|
+
leftArrow?: boolean;
|
|
7
|
+
rightArrow?: boolean;
|
|
8
|
+
home?: boolean;
|
|
9
|
+
end?: boolean;
|
|
10
|
+
backspace?: boolean;
|
|
11
|
+
delete?: boolean;
|
|
12
|
+
ctrl?: boolean;
|
|
13
|
+
meta?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function prevBoundary(text: string, pos: number): number;
|
|
16
|
+
export declare function nextBoundary(text: string, pos: number): number;
|
|
17
|
+
/** Start of the word before the cursor: skips spaces, then the word itself. */
|
|
18
|
+
export declare function wordLeft(text: string, pos: number): number;
|
|
19
|
+
/** End of the word after the cursor: skips spaces, then the word itself. */
|
|
20
|
+
export declare function wordRight(text: string, pos: number): number;
|
|
21
|
+
export declare const lineStart: (text: string, pos: number) => number;
|
|
22
|
+
export declare function lineEnd(text: string, pos: number): number;
|
|
23
|
+
export declare const lineCount: (text: string) => number;
|
|
24
|
+
/** Moves to the same column one line up or down; undefined when there is no such line. */
|
|
25
|
+
export declare function moveLine(text: string, pos: number, direction: -1 | 1): number | undefined;
|
|
26
|
+
export declare const atEnd: (s: LineState) => boolean;
|
|
27
|
+
export declare function insert(s: LineState, text: string): LineState;
|
|
28
|
+
/**
|
|
29
|
+
* The result of an editing key, or undefined when the key is not one of them (Enter, Esc, Tab and the arrows that
|
|
30
|
+
* walk through history belong to the caller). Printable text goes through `insert`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function applyEditKey(s: LineState, input: string, key: EditKey): LineState | undefined;
|
|
33
|
+
/** What to draw: the text before the cursor, the character under it (a space at the end or on a line break), the rest. */
|
|
34
|
+
export declare function splitAtCursor(s: LineState): {
|
|
35
|
+
before: string;
|
|
36
|
+
at: string;
|
|
37
|
+
after: string;
|
|
38
|
+
};
|
|
39
|
+
/** The characters of a text as the user sees them. */
|
|
40
|
+
export declare const graphemes: (text: string) => string[];
|
|
41
|
+
/** The same cursor over a hidden text (an API key): one dot per character. */
|
|
42
|
+
export declare function masked(s: LineState): LineState;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ChatMessage } from '../provider';
|
|
2
|
+
import { type Entry } from './transcript';
|
|
3
|
+
/** The screen rows for a resumed conversation: a notice, then every user and assistant text message in order. */
|
|
4
|
+
export declare function replayEntries(history: ChatMessage[]): Entry[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Style = 'plain' | 'bold' | 'italic' | 'strike' | 'link' | 'code' | 'dim';
|
|
2
|
+
export interface Seg {
|
|
3
|
+
text: string;
|
|
4
|
+
style: Style;
|
|
5
|
+
}
|
|
6
|
+
export type Align = 'left' | 'center' | 'right';
|
|
7
|
+
export interface TableData {
|
|
8
|
+
header: Seg[][];
|
|
9
|
+
align: Align[];
|
|
10
|
+
rows: Seg[][][];
|
|
11
|
+
}
|
|
12
|
+
export declare function charWidth(cp: number): number;
|
|
13
|
+
export declare function displayWidth(text: string): number;
|
|
14
|
+
export declare function parseInline(text: string): Seg[];
|
|
15
|
+
/** A table starting at lines[start] (header row, separator row, body rows), or undefined. `end` is the next line to read. */
|
|
16
|
+
export declare function parseTable(lines: string[], start: number): {
|
|
17
|
+
table: TableData;
|
|
18
|
+
end: number;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function layoutTable(table: TableData, width: number): Seg[][];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const THEMES: readonly ['default', 'blue', 'amber', 'magenta', 'mono'];
|
|
2
|
+
export declare function setTheme(name: string): void;
|
|
3
|
+
export declare function currentTheme(): string;
|
|
4
|
+
export declare function color(name: string): string | undefined;
|
|
5
|
+
export declare const ACCENT = "green";
|