@botconnector/bccli 0.5.0-rc.4 → 0.5.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 (187) hide show
  1. package/LICENSE +21 -203
  2. package/README.en.md +253 -0
  3. package/README.md +250 -0
  4. package/dist/abort.d.ts +5 -0
  5. package/dist/acp-HWHF25KU.js +221 -0
  6. package/dist/acp.d.ts +44 -0
  7. package/dist/agent.d.ts +158 -0
  8. package/dist/agents.d.ts +4 -0
  9. package/dist/args-XA77XUMD.js +13 -0
  10. package/dist/args.d.ts +59 -0
  11. package/dist/budget.d.ts +26 -0
  12. package/dist/checkpoints.d.ts +35 -0
  13. package/dist/chunk-2IP5F3EK.js +56 -0
  14. package/dist/chunk-5CVHTYBQ.js +270 -0
  15. package/dist/chunk-6LO6YRDY.js +216 -0
  16. package/dist/chunk-6PJRWKVI.js +50 -0
  17. package/dist/chunk-6YRTPXGY.js +8 -0
  18. package/dist/chunk-7OTFZK4B.js +159 -0
  19. package/dist/chunk-7U7CMKKI.js +861 -0
  20. package/dist/chunk-A3NBWIEQ.js +2706 -0
  21. package/dist/chunk-FY543EQW.js +50 -0
  22. package/dist/chunk-IDZLHEVL.js +524 -0
  23. package/dist/chunk-IF5RNXBI.js +341 -0
  24. package/dist/chunk-M5T4AM4I.js +256 -0
  25. package/dist/chunk-NGFWBVHD.js +71 -0
  26. package/dist/chunk-OCEQ2TRJ.js +1075 -0
  27. package/dist/chunk-OK2USAXX.js +88 -0
  28. package/dist/chunk-PSO7R5AD.js +10 -0
  29. package/dist/chunk-RLSQAZBT.js +78 -0
  30. package/dist/chunk-VPFCIUC6.js +91 -0
  31. package/dist/chunk-YGBTNDPK.js +202 -0
  32. package/dist/chunk-YYTFJUO2.js +148 -0
  33. package/dist/chunk-ZXWRLN7E.js +378 -0
  34. package/dist/cli.d.ts +1 -0
  35. package/dist/cli.js +251 -0
  36. package/dist/clipboardImage.d.ts +17 -0
  37. package/dist/commands.d.ts +16 -0
  38. package/dist/completion-IRVEVW6H.js +125 -0
  39. package/dist/completion.d.ts +14 -0
  40. package/dist/config-OVWCUVY7.js +25 -0
  41. package/dist/config-S3CZUIBB.js +34 -0
  42. package/dist/config.d.ts +99 -0
  43. package/dist/context.d.ts +13 -0
  44. package/dist/contextWindow.d.ts +3 -0
  45. package/dist/diff.d.ts +7 -0
  46. package/dist/exit.d.ts +9 -0
  47. package/dist/extensions.d.ts +34 -0
  48. package/dist/ghBotCli-FYKJDJOD.js +680 -0
  49. package/dist/ghBotCli.d.ts +9 -0
  50. package/dist/ghBotDispatch.d.ts +68 -0
  51. package/dist/ghBotRunner.d.ts +82 -0
  52. package/dist/ghBotServe.d.ts +21 -0
  53. package/dist/ghBotWebhook.d.ts +45 -0
  54. package/dist/hooks.d.ts +27 -0
  55. package/dist/i18n/id.d.ts +1 -0
  56. package/dist/i18n.d.ts +16 -0
  57. package/dist/integrationCli-GY73S2K7.js +876 -0
  58. package/dist/integrationCli.d.ts +9 -0
  59. package/dist/keybinds.d.ts +22 -0
  60. package/dist/login-KSN63EM4.js +18 -0
  61. package/dist/login.d.ts +21 -0
  62. package/dist/lsp.d.ts +73 -0
  63. package/dist/mcp/catalog.d.ts +14 -0
  64. package/dist/mcp/config.d.ts +36 -0
  65. package/dist/mcp/manager.d.ts +52 -0
  66. package/dist/mcp/oauth.d.ts +82 -0
  67. package/dist/mcpCli-VWSCCDWT.js +113 -0
  68. package/dist/mcpCli.d.ts +3 -0
  69. package/dist/mcpServer/serve.d.ts +8 -0
  70. package/dist/mcpServer/server.d.ts +19 -0
  71. package/dist/models.d.ts +13 -0
  72. package/dist/modelsCli-4Q6KFWV2.js +36 -0
  73. package/dist/modelsCli.d.ts +15 -0
  74. package/dist/npmRunner-LU43GM3W.js +46 -0
  75. package/dist/npmRunner.d.ts +21 -0
  76. package/dist/oauthLogin-JWXQZTMZ.js +210 -0
  77. package/dist/oauthLogin.d.ts +47 -0
  78. package/dist/onboarding.d.ts +6 -0
  79. package/dist/permissions.d.ts +30 -0
  80. package/dist/pluginSpec.d.ts +25 -0
  81. package/dist/plugins.d.ts +45 -0
  82. package/dist/pluginsCli-7XWDLJEL.js +288 -0
  83. package/dist/pluginsCli.d.ts +16 -0
  84. package/dist/prCli-FH7N26D4.js +94 -0
  85. package/dist/prCli.d.ts +46 -0
  86. package/dist/presets.d.ts +8 -0
  87. package/dist/print.d.ts +17 -0
  88. package/dist/provider.d.ts +145 -0
  89. package/dist/providerCli-YMG4G56R.js +15 -0
  90. package/dist/providerCli.d.ts +17 -0
  91. package/dist/providers.d.ts +6 -0
  92. package/dist/reasoning.d.ts +12 -0
  93. package/dist/repomap.d.ts +10 -0
  94. package/dist/sdk.d.ts +61 -0
  95. package/dist/sdk.js +6532 -0
  96. package/dist/serve-HSFF6MGB.js +178 -0
  97. package/dist/serve-R2IHP26A.js +532 -0
  98. package/dist/serve.d.ts +37 -0
  99. package/dist/serveHeartbeat.d.ts +14 -0
  100. package/dist/serveProtocol.d.ts +47 -0
  101. package/dist/session-YM36TGU7.js +12 -0
  102. package/dist/session.d.ts +33 -0
  103. package/dist/setup-3YB6EKYX.js +24 -0
  104. package/dist/setup.d.ts +79 -0
  105. package/dist/slash/copy.d.ts +1 -0
  106. package/dist/slash/diff.d.ts +1 -0
  107. package/dist/slash/doctor.d.ts +18 -0
  108. package/dist/slash/export.d.ts +2 -0
  109. package/dist/slash/info.d.ts +46 -0
  110. package/dist/slash/memory.d.ts +10 -0
  111. package/dist/statsCli-I4TSDU3X.js +353 -0
  112. package/dist/statsCli.d.ts +62 -0
  113. package/dist/textToolCalls.d.ts +6 -0
  114. package/dist/thinking.d.ts +17 -0
  115. package/dist/tokenBudget.d.ts +22 -0
  116. package/dist/tools/bash.d.ts +54 -0
  117. package/dist/tools/diagnostics.d.ts +13 -0
  118. package/dist/tools/edit.d.ts +12 -0
  119. package/dist/tools/fetch.d.ts +41 -0
  120. package/dist/tools/glob.d.ts +5 -0
  121. package/dist/tools/globSafety.d.ts +7 -0
  122. package/dist/tools/grep.d.ts +25 -0
  123. package/dist/tools/ignore.d.ts +2 -0
  124. package/dist/tools/index.d.ts +12 -0
  125. package/dist/tools/memory.d.ts +13 -0
  126. package/dist/tools/paths.d.ts +4 -0
  127. package/dist/tools/plan.d.ts +10 -0
  128. package/dist/tools/read.d.ts +16 -0
  129. package/dist/tools/repomap.d.ts +2 -0
  130. package/dist/tools/sandbox.d.ts +15 -0
  131. package/dist/tools/shell.d.ts +18 -0
  132. package/dist/tools/skill.d.ts +3 -0
  133. package/dist/tools/task.d.ts +28 -0
  134. package/dist/tools/todo.d.ts +13 -0
  135. package/dist/tools/types.d.ts +52 -0
  136. package/dist/tools/websearch.d.ts +9 -0
  137. package/dist/tools/write.d.ts +5 -0
  138. package/dist/transferCli-3B4LMOYI.js +73 -0
  139. package/dist/transferCli.d.ts +23 -0
  140. package/dist/ui/App.d.ts +7 -0
  141. package/dist/ui/DiffView.d.ts +3 -0
  142. package/dist/ui/EditableText.d.ts +7 -0
  143. package/dist/ui/LinePrompt.d.ts +6 -0
  144. package/dist/ui/ListPicker.d.ts +11 -0
  145. package/dist/ui/Markdown.d.ts +8 -0
  146. package/dist/ui/McpMenu.d.ts +11 -0
  147. package/dist/ui/ModelPicker.d.ts +6 -0
  148. package/dist/ui/PermissionPrompt.d.ts +5 -0
  149. package/dist/ui/PlanApproval.d.ts +5 -0
  150. package/dist/ui/PromptInput.d.ts +20 -0
  151. package/dist/ui/ProviderMenu.d.ts +10 -0
  152. package/dist/ui/Spinner.d.ts +4 -0
  153. package/dist/ui/StatusBar.d.ts +14 -0
  154. package/dist/ui/TodoList.d.ts +4 -0
  155. package/dist/ui/ToolBlock.d.ts +14 -0
  156. package/dist/ui/complete.d.ts +8 -0
  157. package/dist/ui/index.d.ts +7 -0
  158. package/dist/ui/lineEdit.d.ts +42 -0
  159. package/dist/ui/liveCap.d.ts +29 -0
  160. package/dist/ui/markdownLayout.d.ts +23 -0
  161. package/dist/ui/replay.d.ts +4 -0
  162. package/dist/ui/stdinFilter.d.ts +18 -0
  163. package/dist/ui/table.d.ts +20 -0
  164. package/dist/ui/theme.d.ts +5 -0
  165. package/dist/ui/thinkingMouse.d.ts +38 -0
  166. package/dist/ui/transcript.d.ts +55 -0
  167. package/dist/ui/tty.d.ts +11 -0
  168. package/dist/ui/vim.d.ts +26 -0
  169. package/dist/ui-TAZMRXRI.js +3044 -0
  170. package/dist/update-XC3B6SJC.js +145 -0
  171. package/dist/update.d.ts +30 -0
  172. package/dist/verify.d.ts +16 -0
  173. package/dist/version.d.ts +1 -0
  174. package/dist/webBudget.d.ts +25 -0
  175. package/dist/worktree.d.ts +12 -0
  176. package/package.json +59 -35
  177. package/THIRD_PARTY_NOTICES.md +0 -9
  178. package/branding.mjs +0 -347
  179. package/cli.mjs +0 -120
  180. package/core.mjs +0 -260
  181. package/credentials.mjs +0 -52
  182. package/gateway.mjs +0 -2
  183. package/model-command.mjs +0 -61
  184. package/provider-cli.mjs +0 -77
  185. package/providers.mjs +0 -166
  186. package/proxy.mjs +0 -242
  187. package/startup-menu.mjs +0 -120
@@ -0,0 +1,54 @@
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
+ /** How many finished background tasks are kept for polling (default 50). */
38
+ maxRetainedTasks?: number;
39
+ }
40
+ export declare function createBashTool(options?: BashToolOptions): import("./types").Tool<z.ZodObject<{
41
+ command: z.ZodOptional<z.ZodString>;
42
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
43
+ background: z.ZodOptional<z.ZodBoolean>;
44
+ task_id: z.ZodOptional<z.ZodNumber>;
45
+ kill: z.ZodOptional<z.ZodBoolean>;
46
+ }, z.core.$strip>>;
47
+ export declare const bashTool: import("./types").Tool<z.ZodObject<{
48
+ command: z.ZodOptional<z.ZodString>;
49
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
50
+ background: z.ZodOptional<z.ZodBoolean>;
51
+ task_id: z.ZodOptional<z.ZodNumber>;
52
+ kill: z.ZodOptional<z.ZodBoolean>;
53
+ }, z.core.$strip>>;
54
+ export {};
@@ -0,0 +1,13 @@
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
+ action: z.ZodOptional<z.ZodEnum<{
6
+ definition: "definition";
7
+ diagnostics: "diagnostics";
8
+ hover: "hover";
9
+ references: "references";
10
+ }>>;
11
+ line: z.ZodOptional<z.ZodNumber>;
12
+ character: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strip>>;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export declare const editTool: import("./types").Tool<z.ZodObject<{
3
+ path: z.ZodString;
4
+ old_string: z.ZodOptional<z.ZodString>;
5
+ new_string: z.ZodOptional<z.ZodString>;
6
+ replace_all: z.ZodOptional<z.ZodBoolean>;
7
+ edits: z.ZodOptional<z.ZodArray<z.ZodObject<{
8
+ old_string: z.ZodString;
9
+ new_string: z.ZodString;
10
+ replace_all: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strip>>>;
12
+ }, 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,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,2 @@
1
+ /** Native glob exclude patterns: node_modules, .git, and .gitignore entries up to projectRoot. */
2
+ export declare function ignorePatterns(root: string, projectRoot?: 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,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,2 @@
1
+ import { z } from 'zod';
2
+ export declare function createRepoMapTool(): import("./types").Tool<z.ZodObject<{}, z.core.$strip>>;
@@ -0,0 +1,15 @@
1
+ export declare function sandboxSupported(platform: NodeJS.Platform): boolean;
2
+ /** Converts a Windows drive path (`C:\Users\foo`) into its WSL `/mnt/c/Users/foo` mount path. */
3
+ export declare function winPathToWsl(winPath: string): string;
4
+ /** Seatbelt profile: read everything, write only under cwd + temp areas, network only when allowed. */
5
+ export declare function darwinProfile(cwd: string, network: boolean): string;
6
+ /**
7
+ * Wrap a shell command in the platform sandbox, or undefined when the platform has none
8
+ * (the caller then refuses to run it sandboxed rather than silently running it raw).
9
+ */
10
+ export declare function sandboxArgv(command: string, opts: {
11
+ platform: NodeJS.Platform;
12
+ cwd: string;
13
+ network: boolean;
14
+ wslBwrap?: boolean;
15
+ }): 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,73 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ Session
4
+ } from "./chunk-6LO6YRDY.js";
5
+ import "./chunk-OCEQ2TRJ.js";
6
+ import "./chunk-NGFWBVHD.js";
7
+ import {
8
+ t
9
+ } from "./chunk-IDZLHEVL.js";
10
+
11
+ // src/transferCli.ts
12
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
13
+ import { dirname, join, resolve } from "path";
14
+ function runExportCommand(args, deps) {
15
+ const first = (args.subArgs[0] ?? "").trim();
16
+ let source;
17
+ let dest;
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) {
21
+ source = first;
22
+ dest = args.subArgs[1];
23
+ } else {
24
+ const latest = Session.latest(args.home, args.cwd);
25
+ if (!latest) {
26
+ deps.err?.(t("no session to export in this folder"));
27
+ return 1;
28
+ }
29
+ source = latest.file;
30
+ dest = first || void 0;
31
+ }
32
+ if (!dest) {
33
+ for (const line of readFileSync(source, "utf8").split("\n")) {
34
+ if (line.trim()) deps.out(line);
35
+ }
36
+ return 0;
37
+ }
38
+ mkdirSync(dirname(dest), { recursive: true });
39
+ copyFileSync(source, dest);
40
+ deps.out(t("exported {file}", { file: dest }));
41
+ return 0;
42
+ }
43
+ function runImportCommand(args, deps) {
44
+ const src = (args.subArgs[0] ?? "").trim();
45
+ if (!src || !existsSync(src)) {
46
+ deps.err?.(t("file not found: {file}", { file: src || "(none)" }));
47
+ return 1;
48
+ }
49
+ const raw = readFileSync(src, "utf8");
50
+ const lines = raw.split("\n").filter((l) => l.trim());
51
+ for (const line of lines) {
52
+ try {
53
+ JSON.parse(line);
54
+ } catch {
55
+ deps.err?.(t("invalid session file (non-JSON line): {file}", { file: src }));
56
+ return 1;
57
+ }
58
+ }
59
+ const slug = args.cwd.replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(-100) || "root";
60
+ const dir = join(args.home, "sessions", slug);
61
+ mkdirSync(dir, { recursive: true });
62
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
63
+ const dest = join(dir, `${stamp}-imported.jsonl`);
64
+ writeFileSync(dest, lines.length ? `${lines.join("\n")}
65
+ ` : "");
66
+ deps.out(t("imported {n} record(s) into {file}", { n: String(lines.length), file: dest }));
67
+ return 0;
68
+ }
69
+ export {
70
+ readdirSync,
71
+ runExportCommand,
72
+ runImportCommand
73
+ };
@@ -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;
@@ -0,0 +1,5 @@
1
+ import type { PlanDecision } from '../tools/plan';
2
+ export declare function PlanApproval({ plan, onAnswer }: {
3
+ plan: string;
4
+ onAnswer(d: PlanDecision): void;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
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
+ /** Called when Tab is pressed on an empty prompt (e.g. to toggle Thinking without Ctrl+T). */
18
+ onEmptyTab?: () => void;
19
+ }
20
+ export declare function PromptInput({ disabled, history, cwd, onSubmit, extraCommands, injected, vim, onEmptyTab }: 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,4 @@
1
+ export declare function Spinner({ label, startedAt }: {
2
+ label: string;
3
+ startedAt: number;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { PermissionMode } from '../config';
2
+ import type { ReasoningLevel } from '../reasoning';
3
+ export declare function StatusBar({ mode, tokens, cached, estimated, busy, model, reasoning, }: {
4
+ mode: PermissionMode;
5
+ /** Prompt tokens of the last model call: the size of the context, not the session total. */
6
+ tokens: number;
7
+ /** Cache reads for the latest provider-reported model call. */
8
+ cached?: number;
9
+ /** Local chars/4 fallback rather than provider-reported usage. */
10
+ estimated?: boolean;
11
+ busy: boolean;
12
+ model?: string;
13
+ reasoning?: ReasoningLevel;
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { TodoItem } from '../tools/todo';
2
+ export declare function TodoList({ items }: {
3
+ items: TodoItem[];
4
+ }): import("react").JSX.Element | null;