@botconnector/bccli 0.4.0-beta.9 → 0.4.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.
Files changed (183) hide show
  1. package/README.en.md +253 -0
  2. package/README.md +93 -6
  3. package/dist/abort.d.ts +5 -0
  4. package/dist/acp-3PHBAI64.js +182 -0
  5. package/dist/acp.d.ts +27 -0
  6. package/dist/agent.d.ts +143 -0
  7. package/dist/agents.d.ts +4 -0
  8. package/dist/args-W6BNKY7K.js +13 -0
  9. package/dist/args.d.ts +51 -0
  10. package/dist/budget.d.ts +23 -0
  11. package/dist/checkpoints.d.ts +34 -0
  12. package/dist/{chunk-BFZXRKW5.js → chunk-24JN75FZ.js} +29 -7
  13. package/dist/chunk-45SDLMTV.js +341 -0
  14. package/dist/chunk-75BECX4F.js +56 -0
  15. package/dist/{chunk-SJH3YLW4.js → chunk-BC7UXFE4.js} +69 -6
  16. package/dist/chunk-BGXNR74O.js +733 -0
  17. package/dist/chunk-BKGFA2PT.js +8 -0
  18. package/dist/{chunk-CLN4Z5E3.js → chunk-BLOYFIAD.js} +6 -3
  19. package/dist/chunk-BXQQCUAC.js +145 -0
  20. package/dist/chunk-FLQPE4S5.js +373 -0
  21. package/dist/chunk-GN4W3T6E.js +76 -0
  22. package/dist/{chunk-7S6JXQCH.js → chunk-JHPGOAXU.js} +2 -1
  23. package/dist/chunk-MFHCQQEN.js +201 -0
  24. package/dist/chunk-MHIYLXJC.js +143 -0
  25. package/dist/chunk-PSO7R5AD.js +10 -0
  26. package/dist/chunk-PZRKU4UM.js +2143 -0
  27. package/dist/chunk-QZKLZELZ.js +64 -0
  28. package/dist/chunk-R5RE46CW.js +231 -0
  29. package/dist/chunk-UZWJQF67.js +500 -0
  30. package/dist/{chunk-DX7CZTBB.js → chunk-WI22M2ID.js} +14 -9
  31. package/dist/chunk-WNACAUDK.js +946 -0
  32. package/dist/chunk-XV7ZVL4J.js +235 -0
  33. package/dist/cli.d.ts +1 -0
  34. package/dist/cli.js +150 -1382
  35. package/dist/clipboardImage.d.ts +17 -0
  36. package/dist/commands.d.ts +16 -0
  37. package/dist/completion-HPPFDAPB.js +125 -0
  38. package/dist/completion.d.ts +14 -0
  39. package/dist/{config-YUNKPCNB.js → config-DIDLDONU.js} +5 -2
  40. package/dist/config-IU76CPK2.js +34 -0
  41. package/dist/config.d.ts +97 -0
  42. package/dist/context.d.ts +13 -0
  43. package/dist/contextWindow.d.ts +3 -0
  44. package/dist/diff.d.ts +7 -0
  45. package/dist/exit.d.ts +9 -0
  46. package/dist/extensions.d.ts +34 -0
  47. package/dist/ghBotCli-E3VPHNZY.js +677 -0
  48. package/dist/ghBotCli.d.ts +9 -0
  49. package/dist/ghBotDispatch.d.ts +68 -0
  50. package/dist/ghBotRunner.d.ts +82 -0
  51. package/dist/ghBotServe.d.ts +21 -0
  52. package/dist/ghBotWebhook.d.ts +45 -0
  53. package/dist/hooks.d.ts +27 -0
  54. package/dist/i18n/id.d.ts +1 -0
  55. package/dist/i18n.d.ts +16 -0
  56. package/dist/integrationCli-Q2YPDTPG.js +685 -0
  57. package/dist/integrationCli.d.ts +9 -0
  58. package/dist/keybinds.d.ts +22 -0
  59. package/dist/login-FP3BB44A.js +16 -0
  60. package/dist/login.d.ts +19 -0
  61. package/dist/lsp.d.ts +47 -0
  62. package/dist/mcp/catalog.d.ts +14 -0
  63. package/dist/mcp/config.d.ts +36 -0
  64. package/dist/mcp/manager.d.ts +34 -0
  65. package/dist/mcp/oauth.d.ts +82 -0
  66. package/dist/{mcpCli-DZWQPTOS.js → mcpCli-SNBDUWJN.js} +42 -9
  67. package/dist/mcpCli.d.ts +3 -0
  68. package/dist/mcpServer/serve.d.ts +8 -0
  69. package/dist/mcpServer/server.d.ts +19 -0
  70. package/dist/models.d.ts +13 -0
  71. package/dist/modelsCli-CZ2HNGKR.js +36 -0
  72. package/dist/modelsCli.d.ts +15 -0
  73. package/dist/npmRunner-LU43GM3W.js +46 -0
  74. package/dist/npmRunner.d.ts +21 -0
  75. package/dist/oauthLogin-6FWQABJ7.js +210 -0
  76. package/dist/oauthLogin.d.ts +47 -0
  77. package/dist/permissions.d.ts +30 -0
  78. package/dist/pluginSpec.d.ts +25 -0
  79. package/dist/plugins.d.ts +45 -0
  80. package/dist/pluginsCli-LPIUUDWB.js +284 -0
  81. package/dist/pluginsCli.d.ts +16 -0
  82. package/dist/prCli-5IMV3VNQ.js +78 -0
  83. package/dist/prCli.d.ts +33 -0
  84. package/dist/presets.d.ts +8 -0
  85. package/dist/print.d.ts +14 -0
  86. package/dist/provider.d.ts +140 -0
  87. package/dist/providerCli-NMUFXAAS.js +15 -0
  88. package/dist/providerCli.d.ts +17 -0
  89. package/dist/providers.d.ts +6 -0
  90. package/dist/reasoning.d.ts +12 -0
  91. package/dist/repomap.d.ts +10 -0
  92. package/dist/sdk.d.ts +57 -0
  93. package/dist/sdk.js +5571 -0
  94. package/dist/serve-KWOECK5W.js +178 -0
  95. package/dist/serve-X2ZV4S5U.js +521 -0
  96. package/dist/serve.d.ts +37 -0
  97. package/dist/serveHeartbeat.d.ts +14 -0
  98. package/dist/serveProtocol.d.ts +47 -0
  99. package/dist/session-GKEXDJKZ.js +12 -0
  100. package/dist/session.d.ts +30 -0
  101. package/dist/setup-OV3NWQN5.js +24 -0
  102. package/dist/setup.d.ts +74 -0
  103. package/dist/slash/copy.d.ts +1 -0
  104. package/dist/slash/diff.d.ts +1 -0
  105. package/dist/slash/doctor.d.ts +18 -0
  106. package/dist/slash/export.d.ts +2 -0
  107. package/dist/slash/info.d.ts +45 -0
  108. package/dist/slash/memory.d.ts +10 -0
  109. package/dist/statsCli-CF3R7ATL.js +353 -0
  110. package/dist/statsCli.d.ts +62 -0
  111. package/dist/textToolCalls.d.ts +6 -0
  112. package/dist/thinking.d.ts +17 -0
  113. package/dist/tokenBudget.d.ts +22 -0
  114. package/dist/tools/bash.d.ts +52 -0
  115. package/dist/tools/diagnostics.d.ts +5 -0
  116. package/dist/tools/edit.d.ts +7 -0
  117. package/dist/tools/fetch.d.ts +41 -0
  118. package/dist/tools/glob.d.ts +5 -0
  119. package/dist/tools/globSafety.d.ts +7 -0
  120. package/dist/tools/grep.d.ts +13 -0
  121. package/dist/tools/ignore.d.ts +2 -0
  122. package/dist/tools/index.d.ts +12 -0
  123. package/dist/tools/memory.d.ts +13 -0
  124. package/dist/tools/paths.d.ts +2 -0
  125. package/dist/tools/plan.d.ts +10 -0
  126. package/dist/tools/read.d.ts +16 -0
  127. package/dist/tools/repomap.d.ts +2 -0
  128. package/dist/tools/sandbox.d.ts +12 -0
  129. package/dist/tools/shell.d.ts +18 -0
  130. package/dist/tools/skill.d.ts +3 -0
  131. package/dist/tools/task.d.ts +28 -0
  132. package/dist/tools/todo.d.ts +13 -0
  133. package/dist/tools/types.d.ts +52 -0
  134. package/dist/tools/websearch.d.ts +9 -0
  135. package/dist/tools/write.d.ts +5 -0
  136. package/dist/transferCli-YUFPI6AH.js +71 -0
  137. package/dist/transferCli.d.ts +23 -0
  138. package/dist/ui/App.d.ts +7 -0
  139. package/dist/ui/DiffView.d.ts +3 -0
  140. package/dist/ui/EditableText.d.ts +7 -0
  141. package/dist/ui/LinePrompt.d.ts +6 -0
  142. package/dist/ui/ListPicker.d.ts +11 -0
  143. package/dist/ui/Markdown.d.ts +8 -0
  144. package/dist/ui/McpMenu.d.ts +11 -0
  145. package/dist/ui/ModelPicker.d.ts +6 -0
  146. package/dist/ui/PermissionPrompt.d.ts +5 -0
  147. package/dist/ui/PlanApproval.d.ts +5 -0
  148. package/dist/ui/PromptInput.d.ts +18 -0
  149. package/dist/ui/ProviderMenu.d.ts +10 -0
  150. package/dist/ui/Spinner.d.ts +4 -0
  151. package/dist/ui/StatusBar.d.ts +9 -0
  152. package/dist/ui/TodoList.d.ts +4 -0
  153. package/dist/ui/ToolBlock.d.ts +14 -0
  154. package/dist/ui/complete.d.ts +1 -0
  155. package/dist/ui/focusReport.d.ts +1 -0
  156. package/dist/ui/index.d.ts +7 -0
  157. package/dist/ui/lineEdit.d.ts +42 -0
  158. package/dist/ui/replay.d.ts +4 -0
  159. package/dist/ui/table.d.ts +20 -0
  160. package/dist/ui/theme.d.ts +5 -0
  161. package/dist/ui/thinkingMouse.d.ts +33 -0
  162. package/dist/ui/transcript.d.ts +55 -0
  163. package/dist/ui/vim.d.ts +26 -0
  164. package/dist/ui-IVIFNUCC.js +2367 -0
  165. package/dist/update-TZ2G6KQ3.js +145 -0
  166. package/dist/update.d.ts +30 -0
  167. package/dist/verify.d.ts +16 -0
  168. package/dist/version.d.ts +1 -0
  169. package/dist/webBudget.d.ts +25 -0
  170. package/dist/worktree.d.ts +12 -0
  171. package/package.json +42 -8
  172. package/dist/args-JPVSGCGY.js +0 -12
  173. package/dist/chunk-2MGINW4O.js +0 -114
  174. package/dist/chunk-ELML4KVQ.js +0 -76
  175. package/dist/chunk-ISGBGFSU.js +0 -52
  176. package/dist/chunk-KV27KTOX.js +0 -254
  177. package/dist/chunk-U7GK73CK.js +0 -341
  178. package/dist/chunk-ZYCYTEKD.js +0 -96
  179. package/dist/integrationCli-BGT5UZU4.js +0 -223
  180. package/dist/login-6K32PIXV.js +0 -9
  181. package/dist/providerCli-Q7LRM2NP.js +0 -12
  182. package/dist/session-7UB77CEG.js +0 -9
  183. package/dist/ui-6GTQUJOE.js +0 -1415
@@ -0,0 +1,62 @@
1
+ export interface StatsRow {
2
+ project: string;
3
+ sessions: number;
4
+ messages: number;
5
+ /** Estimated tokens (messages without recorded usage only). */
6
+ inputTokens: number;
7
+ outputTokens: number;
8
+ /** Tokens from persisted `t:usage` records. */
9
+ usageInputTokens: number;
10
+ usageOutputTokens: number;
11
+ cachedInputTokens: number;
12
+ cacheWriteTokens: number;
13
+ toolCalls: Record<string, number>;
14
+ /** Total tokens per session (recorded basis when present, estimate otherwise). */
15
+ sessionTotals: number[];
16
+ /** Per-model token totals from `t:usage` records that carry a model ref. */
17
+ modelUsage: Record<string, ModelTotals>;
18
+ }
19
+ export interface ModelTotals {
20
+ turns: number;
21
+ inputTokens: number;
22
+ outputTokens: number;
23
+ cachedInputTokens: number;
24
+ cacheWriteTokens: number;
25
+ }
26
+ export interface AggregateOptions {
27
+ days: number;
28
+ now?: number;
29
+ }
30
+ /**
31
+ * Walk home/sessions/<project>/*.jsonl, keep files with mtime within `days`,
32
+ * and aggregate per project. Token basis switches per session: sessions with
33
+ * recorded usage records use them (incl. cache counters); older sessions fall
34
+ * back to ~4 chars/token estimates from message content.
35
+ */
36
+ export declare function aggregateSessions(home: string, opts: AggregateOptions): StatsRow[];
37
+ /** Compact token formatting like the opencode stats boxes: 291.6K / 41.0M / 627.4M. */
38
+ export declare function fmtCompact(n: number): string;
39
+ export interface StatsCliArgs {
40
+ subArgs: string[];
41
+ home: string;
42
+ cwd?: string;
43
+ now?: number;
44
+ /** Already-parsed `--days` from parseCliArgs (subArgs never contains it). */
45
+ days?: number;
46
+ /** Already-parsed `--tools` top-N cap. */
47
+ tools?: number;
48
+ /** Already-parsed `--models` ("all" or a number as string). */
49
+ models?: string;
50
+ /** Already-parsed `--project` filter (empty string = current project). */
51
+ project?: string;
52
+ }
53
+ export interface StatsDeps {
54
+ out(line: string): void;
55
+ err?(line: string): void;
56
+ }
57
+ /**
58
+ * `bccli stats [--days N] [--tools N] [--models [N|all]] [--project slug]` —
59
+ * token usage and tool-call stats from local session files, rendered as
60
+ * opencode-style overview/tokens/model/tool boxes.
61
+ */
62
+ export declare function runStatsCommand(args: StatsCliArgs, deps: StatsDeps): number;
@@ -0,0 +1,6 @@
1
+ import type { ToolCall } from './provider';
2
+ import type { ToolDefinition } from './tools/index';
3
+ export declare function recoverTextToolCalls(text: string, tools: ToolDefinition[]): {
4
+ text: string;
5
+ toolCalls: ToolCall[];
6
+ } | null;
@@ -0,0 +1,17 @@
1
+ export declare class ThinkSplitter {
2
+ private inside;
3
+ private held;
4
+ push(delta: string): {
5
+ text: string;
6
+ thinking: string;
7
+ };
8
+ /** Whatever was held back as a possible tag start is plain text after all. */
9
+ flush(): {
10
+ text: string;
11
+ thinking: string;
12
+ };
13
+ }
14
+ export declare function splitThinking(text: string): {
15
+ text: string;
16
+ thinking: string;
17
+ };
@@ -0,0 +1,22 @@
1
+ import type { ChatMessage } from './provider';
2
+ /** ~4 chars per token, the same conservative estimate the usage fallback uses. */
3
+ export declare const estimateTokens: (text: string) => number;
4
+ export declare const estimateMessages: (messages: ChatMessage[]) => number;
5
+ /**
6
+ * Drops whole oldest turns (everything up to the next user message) until the history fits the
7
+ * budget. Cutting only at turn boundaries keeps assistant tool_calls paired with their tool
8
+ * replies, so the trimmed history is always valid for a provider request.
9
+ */
10
+ export declare function trimToFit(messages: ChatMessage[], maxTokens: number): ChatMessage[];
11
+ /**
12
+ * Splits history into [old, keep]: the newest whole turns that fit `keepTokens` (at least the
13
+ * last user turn) stay verbatim; everything older goes to `old` for summarization. Cutting at
14
+ * user boundaries keeps tool_calls paired with their replies.
15
+ */
16
+ export declare function splitKeepRecent(messages: ChatMessage[], keepTokens: number): [ChatMessage[], ChatMessage[]];
17
+ export declare const isToolStub: (content: string) => boolean;
18
+ /**
19
+ * Replaces old tool results with a one-line stub once they add up past PRUNE_MIN_TOKENS, so the
20
+ * prompt prefix (and its cache) changes rarely. The newest KEEP_TOKENS worth stay intact.
21
+ */
22
+ export declare function pruneOldToolOutputs(messages: ChatMessage[]): boolean;
@@ -0,0 +1,52 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { z } from 'zod';
3
+ import { type ShellDeps, type ShellSpec } from './shell';
4
+ type Spawn = typeof spawn;
5
+ /** Kill a command and everything it started. Never throws (e.g. taskkill missing on Windows). */
6
+ export declare function killProcessTree(pid: number, platform?: NodeJS.Platform, spawnFn?: Spawn): void;
7
+ export declare function killAllCommands(): void;
8
+ /** Human-readable list for the /tasks slash command. */
9
+ export declare function renderBackgroundTasks(): string;
10
+ /** Test/exit helper: stop every background task and forget them. */
11
+ export declare function resetBackgroundTasks(): void;
12
+ export interface CommandResult {
13
+ output: string;
14
+ exitCode: number | null;
15
+ timedOut: boolean;
16
+ aborted: boolean;
17
+ }
18
+ export declare function needsNetwork(command: string): boolean;
19
+ /** Proxy env pointing at a dead local port: tools that honour proxy vars fail fast offline. */
20
+ export declare function offlineEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
21
+ export declare function runCommand(command: string | string[], opts: {
22
+ cwd: string;
23
+ timeoutMs: number;
24
+ signal: AbortSignal;
25
+ env?: NodeJS.ProcessEnv;
26
+ shell?: ShellSpec;
27
+ }): Promise<CommandResult>;
28
+ export interface BashToolOptions {
29
+ /** "offline" blocks known network commands and points proxy env at a dead local port. */
30
+ networkPolicy?: 'allow' | 'offline';
31
+ /** Run every command inside the OS sandbox (sandbox-exec on macOS, bwrap on Linux). */
32
+ sandbox?: boolean;
33
+ /** Test hook: pretend to be another platform. */
34
+ platform?: NodeJS.Platform;
35
+ /** Test hook: fake environment / file lookup used to pick the Windows shell. */
36
+ shellDeps?: Partial<ShellDeps>;
37
+ }
38
+ export declare function createBashTool(options?: BashToolOptions): import("./types").Tool<z.ZodObject<{
39
+ command: z.ZodOptional<z.ZodString>;
40
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
41
+ background: z.ZodOptional<z.ZodBoolean>;
42
+ task_id: z.ZodOptional<z.ZodNumber>;
43
+ kill: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$strip>>;
45
+ export declare const bashTool: import("./types").Tool<z.ZodObject<{
46
+ command: z.ZodOptional<z.ZodString>;
47
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
48
+ background: z.ZodOptional<z.ZodBoolean>;
49
+ task_id: z.ZodOptional<z.ZodNumber>;
50
+ kill: z.ZodOptional<z.ZodBoolean>;
51
+ }, z.core.$strip>>;
52
+ export {};
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ import { type LspServer } from '../lsp';
3
+ export declare function createDiagnosticsTool(servers: LspServer[]): import("./types").Tool<z.ZodObject<{
4
+ path: z.ZodString;
5
+ }, z.core.$strip>>;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export declare const editTool: import("./types").Tool<z.ZodObject<{
3
+ path: z.ZodString;
4
+ old_string: z.ZodString;
5
+ new_string: z.ZodString;
6
+ replace_all: z.ZodOptional<z.ZodBoolean>;
7
+ }, z.core.$strip>>;
@@ -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,5 @@
1
+ import { z } from 'zod';
2
+ export declare const globTool: import("./types").Tool<z.ZodObject<{
3
+ pattern: z.ZodString;
4
+ path: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>>;
@@ -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,13 @@
1
+ import { z } from 'zod';
2
+ export declare function grepJs(pattern: string, opts: {
3
+ root: string;
4
+ glob?: string;
5
+ ignoreCase?: boolean;
6
+ signal?: AbortSignal;
7
+ }): Promise<string[]>;
8
+ export declare const grepTool: import("./types").Tool<z.ZodObject<{
9
+ pattern: z.ZodString;
10
+ path: z.ZodOptional<z.ZodString>;
11
+ glob: z.ZodOptional<z.ZodString>;
12
+ ignore_case: z.ZodOptional<z.ZodBoolean>;
13
+ }, z.core.$strip>>;
@@ -0,0 +1,2 @@
1
+ /** Native glob exclude patterns: node_modules, .git, and simple root .gitignore entries. */
2
+ export declare function ignorePatterns(root: string): string[];
@@ -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,2 @@
1
+ export declare function resolvePath(cwd: string, path: string): string;
2
+ export declare function errorCode(error: unknown): string;
@@ -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,2 @@
1
+ import { z } from 'zod';
2
+ export declare function createRepoMapTool(): import("./types").Tool<z.ZodObject<{}, 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,3 @@
1
+ import { type SkillDef } from '../extensions';
2
+ import { type Tool } from './types';
3
+ export declare function createSkillTool(skills: SkillDef[]): Tool;
@@ -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;
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ export declare const writeTool: import("./types").Tool<z.ZodObject<{
3
+ path: z.ZodString;
4
+ content: z.ZodString;
5
+ }, z.core.$strip>>;
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ Session
4
+ } from "./chunk-BC7UXFE4.js";
5
+ import "./chunk-WNACAUDK.js";
6
+ import "./chunk-BLOYFIAD.js";
7
+ import {
8
+ t
9
+ } from "./chunk-UZWJQF67.js";
10
+
11
+ // src/transferCli.ts
12
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
13
+ import { dirname, join } from "path";
14
+ function runExportCommand(args, deps) {
15
+ const first = (args.subArgs[0] ?? "").trim();
16
+ let source;
17
+ let dest;
18
+ if (first.endsWith(".jsonl") && existsSync(first) && statSync(first).isFile()) {
19
+ source = first;
20
+ dest = args.subArgs[1];
21
+ } else {
22
+ const latest = Session.latest(args.home, args.cwd);
23
+ if (!latest) {
24
+ deps.err?.(t("no session to export in this folder"));
25
+ return 1;
26
+ }
27
+ source = latest.file;
28
+ dest = first || void 0;
29
+ }
30
+ if (!dest) {
31
+ for (const line of readFileSync(source, "utf8").split("\n")) {
32
+ if (line.trim()) deps.out(line);
33
+ }
34
+ return 0;
35
+ }
36
+ mkdirSync(dirname(dest), { recursive: true });
37
+ copyFileSync(source, dest);
38
+ deps.out(t("exported {file}", { file: dest }));
39
+ return 0;
40
+ }
41
+ function runImportCommand(args, deps) {
42
+ const src = (args.subArgs[0] ?? "").trim();
43
+ if (!src || !existsSync(src)) {
44
+ deps.err?.(t("file not found: {file}", { file: src || "(none)" }));
45
+ return 1;
46
+ }
47
+ const raw = readFileSync(src, "utf8");
48
+ const lines = raw.split("\n").filter((l) => l.trim());
49
+ for (const line of lines) {
50
+ try {
51
+ JSON.parse(line);
52
+ } catch {
53
+ deps.err?.(t("invalid session file (non-JSON line): {file}", { file: src }));
54
+ return 1;
55
+ }
56
+ }
57
+ const slug = args.cwd.replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(-100) || "root";
58
+ const dir = join(args.home, "sessions", slug);
59
+ mkdirSync(dir, { recursive: true });
60
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
61
+ const dest = join(dir, `${stamp}-imported.jsonl`);
62
+ writeFileSync(dest, lines.length ? `${lines.join("\n")}
63
+ ` : "");
64
+ deps.out(t("imported {n} record(s) into {file}", { n: String(lines.length), file: dest }));
65
+ return 0;
66
+ }
67
+ export {
68
+ readdirSync,
69
+ runExportCommand,
70
+ runImportCommand
71
+ };
@@ -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 };
@@ -0,0 +1,7 @@
1
+ import type { Runtime } from '../setup';
2
+ export declare function App({ runtime, initialPrompt, version, updateMessage }: {
3
+ runtime: Runtime;
4
+ initialPrompt?: string;
5
+ version: string;
6
+ updateMessage?: string;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function DiffView({ diff }: {
2
+ diff: string;
3
+ }): import("react").JSX.Element;
@@ -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,6 @@
1
+ export declare function LinePrompt({ label, mask, onSubmit, onCancel }: {
2
+ label: string;
3
+ mask?: boolean;
4
+ onSubmit(value: string): void;
5
+ onCancel(): void;
6
+ }): 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,6 @@
1
+ import type { ModelGroup } from '../models';
2
+ export declare function ModelPicker({ groups, current, onPick }: {
3
+ groups: ModelGroup[];
4
+ current: string;
5
+ onPick(ref?: string): void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { PermissionAnswer, PermissionAsk } from '../agent';
2
+ export declare function PermissionPrompt({ request, onAnswer, }: {
3
+ request: PermissionAsk;
4
+ onAnswer: (answer: PermissionAnswer) => void;
5
+ }): import("react").JSX.Element;