@botconnector/bccli 0.4.16 → 0.5.0-rc.4

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 (185) hide show
  1. package/LICENSE +203 -21
  2. package/THIRD_PARTY_NOTICES.md +9 -0
  3. package/branding.mjs +347 -0
  4. package/cli.mjs +120 -0
  5. package/core.mjs +260 -0
  6. package/credentials.mjs +52 -0
  7. package/gateway.mjs +2 -0
  8. package/model-command.mjs +61 -0
  9. package/package.json +35 -59
  10. package/provider-cli.mjs +77 -0
  11. package/providers.mjs +166 -0
  12. package/proxy.mjs +242 -0
  13. package/startup-menu.mjs +120 -0
  14. package/README.en.md +0 -253
  15. package/README.md +0 -250
  16. package/dist/abort.d.ts +0 -5
  17. package/dist/acp-JZW3XHE5.js +0 -221
  18. package/dist/acp.d.ts +0 -44
  19. package/dist/agent.d.ts +0 -147
  20. package/dist/agents.d.ts +0 -4
  21. package/dist/args-XVO7TB4C.js +0 -13
  22. package/dist/args.d.ts +0 -59
  23. package/dist/budget.d.ts +0 -26
  24. package/dist/checkpoints.d.ts +0 -35
  25. package/dist/chunk-3CYQYHPK.js +0 -202
  26. package/dist/chunk-6JK4IBGK.js +0 -1075
  27. package/dist/chunk-6SDRWEPN.js +0 -50
  28. package/dist/chunk-7GM6NN5E.js +0 -341
  29. package/dist/chunk-7XD47KN5.js +0 -71
  30. package/dist/chunk-INMSTUB2.js +0 -56
  31. package/dist/chunk-ISOKH5WB.js +0 -256
  32. package/dist/chunk-JUC3ZOCV.js +0 -50
  33. package/dist/chunk-KDVL2NP6.js +0 -861
  34. package/dist/chunk-KEKDRROL.js +0 -216
  35. package/dist/chunk-KJIXA6MP.js +0 -159
  36. package/dist/chunk-OK2USAXX.js +0 -88
  37. package/dist/chunk-PSO7R5AD.js +0 -10
  38. package/dist/chunk-Q42ZGVAQ.js +0 -91
  39. package/dist/chunk-R754XIBJ.js +0 -523
  40. package/dist/chunk-S3QEZDKB.js +0 -270
  41. package/dist/chunk-SWNRA3EW.js +0 -78
  42. package/dist/chunk-TLCL6DC7.js +0 -378
  43. package/dist/chunk-V5D6PJQN.js +0 -8
  44. package/dist/chunk-YYTFJUO2.js +0 -148
  45. package/dist/chunk-ZJRZTMJF.js +0 -2669
  46. package/dist/cli.d.ts +0 -1
  47. package/dist/cli.js +0 -233
  48. package/dist/clipboardImage.d.ts +0 -17
  49. package/dist/commands.d.ts +0 -16
  50. package/dist/completion-Q7VHOPPV.js +0 -125
  51. package/dist/completion.d.ts +0 -14
  52. package/dist/config-T7MKGJVG.js +0 -34
  53. package/dist/config-YYEAEN2C.js +0 -25
  54. package/dist/config.d.ts +0 -99
  55. package/dist/context.d.ts +0 -13
  56. package/dist/contextWindow.d.ts +0 -3
  57. package/dist/diff.d.ts +0 -7
  58. package/dist/exit.d.ts +0 -9
  59. package/dist/extensions.d.ts +0 -34
  60. package/dist/ghBotCli-7VUGI63S.js +0 -680
  61. package/dist/ghBotCli.d.ts +0 -9
  62. package/dist/ghBotDispatch.d.ts +0 -68
  63. package/dist/ghBotRunner.d.ts +0 -82
  64. package/dist/ghBotServe.d.ts +0 -21
  65. package/dist/ghBotWebhook.d.ts +0 -45
  66. package/dist/hooks.d.ts +0 -27
  67. package/dist/i18n/id.d.ts +0 -1
  68. package/dist/i18n.d.ts +0 -16
  69. package/dist/integrationCli-FBRSTF5F.js +0 -876
  70. package/dist/integrationCli.d.ts +0 -9
  71. package/dist/keybinds.d.ts +0 -22
  72. package/dist/login-BSMUGW7L.js +0 -18
  73. package/dist/login.d.ts +0 -21
  74. package/dist/lsp.d.ts +0 -73
  75. package/dist/mcp/catalog.d.ts +0 -14
  76. package/dist/mcp/config.d.ts +0 -36
  77. package/dist/mcp/manager.d.ts +0 -52
  78. package/dist/mcp/oauth.d.ts +0 -82
  79. package/dist/mcpCli-ZT7CRYMP.js +0 -113
  80. package/dist/mcpCli.d.ts +0 -3
  81. package/dist/mcpServer/serve.d.ts +0 -8
  82. package/dist/mcpServer/server.d.ts +0 -19
  83. package/dist/models.d.ts +0 -13
  84. package/dist/modelsCli-2ZRW4CC4.js +0 -36
  85. package/dist/modelsCli.d.ts +0 -15
  86. package/dist/npmRunner-LU43GM3W.js +0 -46
  87. package/dist/npmRunner.d.ts +0 -21
  88. package/dist/oauthLogin-THSM6FE7.js +0 -210
  89. package/dist/oauthLogin.d.ts +0 -47
  90. package/dist/permissions.d.ts +0 -30
  91. package/dist/pluginSpec.d.ts +0 -25
  92. package/dist/plugins.d.ts +0 -45
  93. package/dist/pluginsCli-EKQI4CJW.js +0 -288
  94. package/dist/pluginsCli.d.ts +0 -16
  95. package/dist/prCli-FMQTOBIV.js +0 -94
  96. package/dist/prCli.d.ts +0 -46
  97. package/dist/presets.d.ts +0 -8
  98. package/dist/print.d.ts +0 -17
  99. package/dist/provider.d.ts +0 -145
  100. package/dist/providerCli-3TFEKV4C.js +0 -15
  101. package/dist/providerCli.d.ts +0 -17
  102. package/dist/providers.d.ts +0 -6
  103. package/dist/reasoning.d.ts +0 -12
  104. package/dist/repomap.d.ts +0 -10
  105. package/dist/sdk.d.ts +0 -61
  106. package/dist/sdk.js +0 -6494
  107. package/dist/serve-3BODPEPR.js +0 -532
  108. package/dist/serve-V6YVZTNR.js +0 -178
  109. package/dist/serve.d.ts +0 -37
  110. package/dist/serveHeartbeat.d.ts +0 -14
  111. package/dist/serveProtocol.d.ts +0 -47
  112. package/dist/session-LX4UNPCD.js +0 -12
  113. package/dist/session.d.ts +0 -33
  114. package/dist/setup-MFG3BWEU.js +0 -24
  115. package/dist/setup.d.ts +0 -79
  116. package/dist/slash/copy.d.ts +0 -1
  117. package/dist/slash/diff.d.ts +0 -1
  118. package/dist/slash/doctor.d.ts +0 -18
  119. package/dist/slash/export.d.ts +0 -2
  120. package/dist/slash/info.d.ts +0 -46
  121. package/dist/slash/memory.d.ts +0 -10
  122. package/dist/statsCli-7MIQHLVW.js +0 -353
  123. package/dist/statsCli.d.ts +0 -62
  124. package/dist/textToolCalls.d.ts +0 -6
  125. package/dist/thinking.d.ts +0 -17
  126. package/dist/tokenBudget.d.ts +0 -22
  127. package/dist/tools/bash.d.ts +0 -54
  128. package/dist/tools/diagnostics.d.ts +0 -13
  129. package/dist/tools/edit.d.ts +0 -12
  130. package/dist/tools/fetch.d.ts +0 -41
  131. package/dist/tools/glob.d.ts +0 -5
  132. package/dist/tools/globSafety.d.ts +0 -7
  133. package/dist/tools/grep.d.ts +0 -25
  134. package/dist/tools/ignore.d.ts +0 -2
  135. package/dist/tools/index.d.ts +0 -12
  136. package/dist/tools/memory.d.ts +0 -13
  137. package/dist/tools/paths.d.ts +0 -4
  138. package/dist/tools/plan.d.ts +0 -10
  139. package/dist/tools/read.d.ts +0 -16
  140. package/dist/tools/repomap.d.ts +0 -2
  141. package/dist/tools/sandbox.d.ts +0 -15
  142. package/dist/tools/shell.d.ts +0 -18
  143. package/dist/tools/skill.d.ts +0 -3
  144. package/dist/tools/task.d.ts +0 -28
  145. package/dist/tools/todo.d.ts +0 -13
  146. package/dist/tools/types.d.ts +0 -52
  147. package/dist/tools/websearch.d.ts +0 -9
  148. package/dist/tools/write.d.ts +0 -5
  149. package/dist/transferCli-SRSYQLSJ.js +0 -73
  150. package/dist/transferCli.d.ts +0 -23
  151. package/dist/ui/App.d.ts +0 -7
  152. package/dist/ui/DiffView.d.ts +0 -3
  153. package/dist/ui/EditableText.d.ts +0 -7
  154. package/dist/ui/LinePrompt.d.ts +0 -6
  155. package/dist/ui/ListPicker.d.ts +0 -11
  156. package/dist/ui/Markdown.d.ts +0 -8
  157. package/dist/ui/McpMenu.d.ts +0 -11
  158. package/dist/ui/ModelPicker.d.ts +0 -6
  159. package/dist/ui/PermissionPrompt.d.ts +0 -5
  160. package/dist/ui/PlanApproval.d.ts +0 -5
  161. package/dist/ui/PromptInput.d.ts +0 -20
  162. package/dist/ui/ProviderMenu.d.ts +0 -10
  163. package/dist/ui/Spinner.d.ts +0 -4
  164. package/dist/ui/StatusBar.d.ts +0 -9
  165. package/dist/ui/TodoList.d.ts +0 -4
  166. package/dist/ui/ToolBlock.d.ts +0 -14
  167. package/dist/ui/complete.d.ts +0 -8
  168. package/dist/ui/index.d.ts +0 -7
  169. package/dist/ui/lineEdit.d.ts +0 -42
  170. package/dist/ui/liveCap.d.ts +0 -9
  171. package/dist/ui/replay.d.ts +0 -4
  172. package/dist/ui/stdinFilter.d.ts +0 -18
  173. package/dist/ui/table.d.ts +0 -20
  174. package/dist/ui/theme.d.ts +0 -5
  175. package/dist/ui/thinkingMouse.d.ts +0 -38
  176. package/dist/ui/transcript.d.ts +0 -55
  177. package/dist/ui/tty.d.ts +0 -11
  178. package/dist/ui/vim.d.ts +0 -26
  179. package/dist/ui-LZ4JGF2V.js +0 -2913
  180. package/dist/update-P7MU4ZM7.js +0 -145
  181. package/dist/update.d.ts +0 -30
  182. package/dist/verify.d.ts +0 -16
  183. package/dist/version.d.ts +0 -1
  184. package/dist/webBudget.d.ts +0 -25
  185. package/dist/worktree.d.ts +0 -12
@@ -1,178 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- createFetchTool,
4
- createWebSearchTool,
5
- isPrivateHost
6
- } from "./chunk-7GM6NN5E.js";
7
- import "./chunk-PSO7R5AD.js";
8
- import {
9
- loadConfig,
10
- readCredentials
11
- } from "./chunk-TLCL6DC7.js";
12
- import {
13
- t
14
- } from "./chunk-R754XIBJ.js";
15
-
16
- // src/mcpServer/serve.ts
17
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
-
19
- // src/mcpServer/server.ts
20
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
21
- import { z } from "zod";
22
- var CATALOG_URL = "https://botconnector.id/data/cloud-models.json";
23
- var PRICING_URL = "https://botconnector.id/data/payg-pricing.json";
24
- var CACHE_TTL_MS = 60 * 6e4;
25
- var ctxLabel = (context) => {
26
- if (!context || !Number.isFinite(context)) return "?";
27
- return context >= 1e3 ? `${Math.round(context / 1e3)}k` : String(context);
28
- };
29
- var usd = (v) => typeof v === "number" ? `$${v}` : "?";
30
- function createMcpServer(deps) {
31
- const server = new McpServer({ name: "botconnector", version: "0.1.0" });
32
- const fetchFn = deps.fetchFn ?? fetch;
33
- const now = deps.now ?? Date.now;
34
- let cache;
35
- const searchTool = createWebSearchTool({
36
- botconnector: () => deps.apiKey ? { baseURL: deps.baseUrl, apiKey: deps.apiKey } : void 0,
37
- keenableURL: deps.keenableURL
38
- });
39
- const pageTool = createFetchTool(deps.fetchTool);
40
- const toolCtx = () => ({
41
- cwd: ".",
42
- signal: AbortSignal.timeout(3e4),
43
- readFiles: /* @__PURE__ */ new Set()
44
- });
45
- server.registerTool(
46
- "bc_models",
47
- {
48
- description: "List BotConnector cloud models with context window and pay-as-you-go price (USD per 1M tokens).",
49
- inputSchema: {},
50
- annotations: { readOnlyHint: true }
51
- },
52
- async () => {
53
- if (cache && now() - cache.at < CACHE_TTL_MS) {
54
- return { content: [{ type: "text", text: cache.text }] };
55
- }
56
- const [catalogRes, pricingRes] = await Promise.all([fetchFn(CATALOG_URL), fetchFn(PRICING_URL)]);
57
- if (!catalogRes.ok) throw new Error(`catalog HTTP ${catalogRes.status}`);
58
- const catalog = await catalogRes.json();
59
- const pricing = pricingRes.ok ? await pricingRes.json() : { tokenRates: [] };
60
- const rates = new Map((pricing.tokenRates ?? []).map((r) => [r.id, r]));
61
- const lines = (catalog.models ?? []).map((m) => {
62
- const tier = rates.get(m.id)?.tiers?.[0];
63
- const price = tier ? `in ${usd(tier.inputPerMTokensUsd)}/M out ${usd(tier.outputPerMTokensUsd)}/M` : "price n/a";
64
- const access = m.access ? ` \xB7 ${m.access}` : "";
65
- return `${m.id} \xB7 ctx ${ctxLabel(m.context)} \xB7 ${price}${access}`;
66
- });
67
- const text = lines.length ? lines.join("\n") : "No models in the catalog.";
68
- cache = { at: now(), text };
69
- return { content: [{ type: "text", text }] };
70
- }
71
- );
72
- server.registerTool(
73
- "bc_search",
74
- {
75
- description: "Search the web and return ranked results (title, url, snippet). Use it to discover pages, then bc_fetch to read one.",
76
- inputSchema: {
77
- query: z.string().min(1).max(500).describe("Search query"),
78
- max_results: z.number().int().min(1).max(8).optional().describe("Number of results (default 6)")
79
- },
80
- annotations: { readOnlyHint: true }
81
- },
82
- async ({ query, max_results }) => {
83
- const r = await searchTool.run({ query, max_results }, toolCtx());
84
- return { content: [{ type: "text", text: r.output }], ...r.isError ? { isError: true } : {} };
85
- }
86
- );
87
- server.registerTool(
88
- "bc_fetch",
89
- {
90
- description: "Fetch a URL and return its text content (HTML tags stripped).",
91
- inputSchema: { url: z.string().min(1).describe("Absolute http(s) URL") },
92
- annotations: { readOnlyHint: true }
93
- },
94
- async ({ url }) => {
95
- if (!/^https?:\/\//i.test(url)) {
96
- return { content: [{ type: "text", text: "URL must start with http:// or https://" }], isError: true };
97
- }
98
- let host;
99
- try {
100
- host = new URL(url).hostname;
101
- } catch {
102
- return { content: [{ type: "text", text: "Invalid URL." }], isError: true };
103
- }
104
- if (isPrivateHost(host)) {
105
- return {
106
- content: [{ type: "text", text: `Blocked: ${host} is a private host. bc_fetch only fetches public URLs.` }],
107
- isError: true
108
- };
109
- }
110
- const r = await pageTool.run({ url }, toolCtx());
111
- return { content: [{ type: "text", text: r.output }], ...r.isError ? { isError: true } : {} };
112
- }
113
- );
114
- server.registerTool(
115
- "bc_chat",
116
- {
117
- description: "Send a prompt to a BotConnector model and get the reply. Returns the answer plus token usage. The model pays from the same API key.",
118
- inputSchema: {
119
- prompt: z.string().min(1).max(1e5).describe("The user message"),
120
- model: z.string().optional().describe("Model id (default: the configured model)"),
121
- max_tokens: z.number().int().min(1).max(4096).optional().describe("Reply budget (default 1024, max 4096)")
122
- },
123
- annotations: { readOnlyHint: false, destructiveHint: false }
124
- },
125
- async ({ prompt, model, max_tokens }) => {
126
- const res = await fetchFn(`${deps.baseUrl}/chat/completions`, {
127
- method: "POST",
128
- headers: { "content-type": "application/json", authorization: `Bearer ${deps.apiKey}` },
129
- body: JSON.stringify({
130
- model: model ?? deps.defaultModel,
131
- messages: [{ role: "user", content: prompt }],
132
- max_tokens: max_tokens ?? 1024,
133
- stream: false
134
- }),
135
- signal: AbortSignal.timeout(3e4)
136
- });
137
- const body = await res.json().catch(() => ({}));
138
- if (!res.ok) {
139
- const message = body.error?.message ?? `HTTP ${res.status}`;
140
- return { content: [{ type: "text", text: `bc_chat failed: ${message}` }], isError: true };
141
- }
142
- const reply = body.choices?.[0]?.message?.content ?? "";
143
- const usage = body.usage ? `
144
-
145
- [usage: ${body.usage.prompt_tokens ?? 0} in / ${body.usage.completion_tokens ?? 0} out]` : "";
146
- return { content: [{ type: "text", text: reply + usage }] };
147
- }
148
- );
149
- return server;
150
- }
151
-
152
- // src/mcpServer/serve.ts
153
- var DEFAULT_BASE = "https://api.botconnector.id/v1";
154
- var FALLBACK_MODEL = "glm-5.3-flash";
155
- async function runMcpServe(args, deps) {
156
- const apiKey = readCredentials(deps.env)["bc-cloud"] || deps.env.BOTCONNECTOR_API_KEY;
157
- if (!apiKey) {
158
- deps.err(t("No BotConnector API key yet. Run bccli login bc-cloud first."));
159
- return 1;
160
- }
161
- const config = loadConfig(deps.cwd, deps.env);
162
- const providerBase = config.providers["bc-cloud"]?.baseURL ?? DEFAULT_BASE;
163
- const baseUrl = (args.baseUrl ?? providerBase).replace(/\/+$/, "");
164
- const defaultModel = config.model.startsWith("bc-cloud/") ? config.model.slice("bc-cloud/".length) : FALLBACK_MODEL;
165
- const server = createMcpServer({ baseUrl, apiKey, defaultModel, fetchFn: deps.fetch });
166
- await server.connect(deps.transport ?? new StdioServerTransport());
167
- deps.err(`mcp serve: 4 tools, base=${baseUrl}`);
168
- if (deps.transport) return 0;
169
- await new Promise((resolve) => {
170
- const stdin = process.stdin;
171
- stdin.on("end", () => resolve());
172
- stdin.on("close", () => resolve());
173
- });
174
- return 0;
175
- }
176
- export {
177
- runMcpServe
178
- };
package/dist/serve.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import type { Provider } from './provider';
2
- export interface ServeOptions {
3
- port?: number;
4
- host?: string;
5
- token?: string;
6
- cwd?: string;
7
- env?: NodeJS.ProcessEnv;
8
- provider?: Provider;
9
- fetch?: typeof fetch;
10
- heartbeatMs?: number;
11
- err?: (s: string) => void;
12
- }
13
- export interface ServeHandle {
14
- port: number;
15
- token: string;
16
- url: string;
17
- close(): Promise<void>;
18
- }
19
- export type PermissionMode = 'ask' | 'bypassPermissions';
20
- /**
21
- * One-line terminal banner for `bccli serve`. A token the user supplied (`--token` or
22
- * `BCCLI_SERVE_TOKEN`) is left out so it cannot leak into logs; a token BCCLI generated
23
- * itself must be printed or nobody could connect.
24
- */
25
- export declare function serveBanner(handle: {
26
- url: string;
27
- token: string;
28
- }, opts?: {
29
- token?: string;
30
- env?: NodeJS.ProcessEnv;
31
- }): string;
32
- /**
33
- * Starts the loopback session server (HTTP unary + WS mux at /v1/mux). Refuses
34
- * non-loopback bind addresses; every request passes the DSH-style trust fence
35
- * (403) and, except /health, the bearer-token check (401).
36
- */
37
- export declare function startServe(opts?: ServeOptions): Promise<ServeHandle>;
@@ -1,14 +0,0 @@
1
- export interface Heartbeat {
2
- /** Sends the first ping and schedules the check loop. Idempotent until stop(). */
3
- start(): void;
4
- /** Marks the last ping as answered (ws 'pong' event). */
5
- pong(): void;
6
- /** Clears the timer; no further pings or terminations. */
7
- stop(): void;
8
- }
9
- /**
10
- * ws heartbeat with deadline: every interval a ping goes out; a ping left
11
- * unanswered by the next tick terminates the socket (connection, not stream).
12
- * Modeled on the DSH gateway's `websocketHeartbeatIntervalMs` behavior.
13
- */
14
- export declare function createHeartbeat(intervalMs: number, ping: () => void, terminate: () => void): Heartbeat;
@@ -1,47 +0,0 @@
1
- /** Wire frames of the /v1/mux WebSocket (subset of the DSH stream protocol). */
2
- export type ClientFrame = {
3
- type: 'open';
4
- streamId: string;
5
- target: string;
6
- } | {
7
- type: 'cancel';
8
- streamId: string;
9
- };
10
- export type ServerFrame = {
11
- type: 'item';
12
- streamId: string;
13
- value: unknown;
14
- } | {
15
- type: 'end';
16
- streamId: string;
17
- } | {
18
- type: 'error';
19
- streamId: string;
20
- message: string;
21
- };
22
- /** Uplink frame size limit; oversized frames error their stream without closing the socket. */
23
- export declare const MAX_FRAME_BYTES = 262144;
24
- /**
25
- * Parses one uplink mux frame. Malformed JSON, unknown types, an empty streamId,
26
- * or an `open` without a target produce `{ error }` instead of throwing.
27
- */
28
- export declare function parseClientFrame(raw: string): ClientFrame | {
29
- error: string;
30
- };
31
- /** Addresses `bccli serve` is allowed to bind (loopback only; 0.0.0.0 is refused). */
32
- export declare const LOOPBACK_BIND: Set<string>;
33
- /**
34
- * DSH-style trust fence: loopback Host with a port matching the listener, a
35
- * same-machine Origin when attached, and no cross-site sec-fetch-site. Returns
36
- * null when trusted, else the 403 reason. Never establishes identity — the
37
- * bearer token does.
38
- */
39
- export declare function trustFence(headers: {
40
- host?: string;
41
- origin?: string;
42
- 'sec-fetch-site'?: string;
43
- }, port: number): string | null;
44
- /** Timing-safe `Authorization: Bearer <token>` check. */
45
- export declare function bearerOk(header: string | undefined, token: string): boolean;
46
- /** Fresh 32-byte hex serve token. */
47
- export declare function randomToken(): string;
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- Session,
4
- pruneSessions
5
- } from "./chunk-KEKDRROL.js";
6
- import "./chunk-6JK4IBGK.js";
7
- import "./chunk-7XD47KN5.js";
8
- import "./chunk-R754XIBJ.js";
9
- export {
10
- Session,
11
- pruneSessions
12
- };
package/dist/session.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import { type ChatMessage, type Usage } from './provider';
2
- export declare class Session {
3
- readonly file: string;
4
- constructor(file: string);
5
- get id(): string;
6
- static create(home: string, cwd: string, now?: Date): Session;
7
- static list(home: string, cwd: string): {
8
- session: Session;
9
- mtime: Date;
10
- preview: string;
11
- }[];
12
- static latest(home: string, cwd: string): Session | undefined;
13
- private write;
14
- append(message: ChatMessage): void;
15
- appendUsage(usage: Usage & {
16
- model?: string;
17
- }): void;
18
- reset(): void;
19
- private records;
20
- /** What the model continues from: everything after the last reset (after a compaction that is the summary and the recent turns). */
21
- load(): ChatMessage[];
22
- /** Model of the most recent turn that recorded usage — serve attach continues a session with its own model. */
23
- lastModel(): string | undefined;
24
- /** Accumulated token usage since the last non-compaction reset. */
25
- totalUsage(): Usage;
26
- /**
27
- * What the user sees on resume: the whole conversation. Compaction only shrinks what the model is sent, so
28
- * its reset does not hide the older turns here. A real reset (/clear, rewind) still starts over, the
29
- * synthetic summary pair is never shown, and the recent turns a compaction re-writes are not shown twice.
30
- */
31
- loadHistory(): ChatMessage[];
32
- }
33
- export declare function pruneSessions(home: string, now?: number, maxAgeDays?: number): number;
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- createRuntime,
4
- lunaPtcAutoEnabled
5
- } from "./chunk-ZJRZTMJF.js";
6
- import "./chunk-OK2USAXX.js";
7
- import "./chunk-KDVL2NP6.js";
8
- import "./chunk-7GM6NN5E.js";
9
- import "./chunk-PSO7R5AD.js";
10
- import "./chunk-YYTFJUO2.js";
11
- import "./chunk-SWNRA3EW.js";
12
- import "./chunk-INMSTUB2.js";
13
- import "./chunk-6SDRWEPN.js";
14
- import "./chunk-3CYQYHPK.js";
15
- import "./chunk-KEKDRROL.js";
16
- import "./chunk-6JK4IBGK.js";
17
- import "./chunk-7XD47KN5.js";
18
- import "./chunk-Q42ZGVAQ.js";
19
- import "./chunk-TLCL6DC7.js";
20
- import "./chunk-R754XIBJ.js";
21
- export {
22
- createRuntime,
23
- lunaPtcAutoEnabled
24
- };
package/dist/setup.d.ts DELETED
@@ -1,79 +0,0 @@
1
- import { Agent } from './agent';
2
- import { CheckpointStore } from './checkpoints';
3
- import type { McpServerSpec } from './mcp/config';
4
- import { McpManager } from './mcp/manager';
5
- import type { CliArgs } from './args';
6
- import { type Config } from './config';
7
- import { type AgentDef, type CommandDef, type SkillDef } from './extensions';
8
- import { type ModelGroup } from './models';
9
- import { type ChatMessage, type Provider } from './provider';
10
- import type { ReasoningLevel } from './reasoning';
11
- import { addProviderKey } from './providerCli';
12
- import { Session } from './session';
13
- import { type Interaction } from './tools/plan';
14
- import { TodoStore } from './tools/todo';
15
- import { type PluginPayload } from './plugins';
16
- import type { HookEvent } from './hooks';
17
- export interface Runtime {
18
- cwd: string;
19
- home: string;
20
- config: Config;
21
- modelRef: string;
22
- reasoning: ReasoningLevel;
23
- agent: Agent;
24
- session: Session;
25
- setModel(ref: string): void;
26
- setReasoning(level: ReasoningLevel): void;
27
- env: NodeJS.ProcessEnv;
28
- skills: SkillDef[];
29
- commands: CommandDef[];
30
- agentDefs: AgentDef[];
31
- todos: TodoStore;
32
- interaction: Interaction;
33
- mcp: McpManager;
34
- startMcp(specs: McpServerSpec[]): Promise<void>;
35
- reloadConfig(): void;
36
- providerLabel(): string;
37
- listModels: (only?: string) => Promise<ModelGroup[]>;
38
- addProviderKey(id: string, key: string): ReturnType<typeof addProviderKey>;
39
- /** Continue an earlier session: load its history and append new messages to its file. */
40
- resume(session: Session): void;
41
- /** Starts a fresh session file; the previous one stays on disk for /resume. */
42
- newSession(): void;
43
- /** Re-reads AGENTS.md/BCCLI.md into the system prompt (after /memory). */
44
- rebuildSystemPrompt(): void;
45
- /** Fires a plugin observer event (SessionStart/Stop are emitted here; tool events come from the agent). */
46
- emitPlugins(event: HookEvent, payload?: PluginPayload): Promise<void>;
47
- checkpoints: CheckpointStore;
48
- /**
49
- * Steps back n conversation turns: truncates the history (and the session log) to before
50
- * them and restores the file snapshots they took. Returns undefined when nothing is left.
51
- */
52
- rewindTurns(n: number): Promise<RewindResult | undefined>;
53
- startedAt: Date;
54
- }
55
- export interface RewindResult {
56
- turns: number;
57
- restored: string[];
58
- deleted: string[];
59
- skipped: string[];
60
- failed: string[];
61
- }
62
- /** PTC is automatic for Luna. This env var is only an emergency/internal kill switch. */
63
- export declare function lunaPtcAutoEnabled(env: NodeJS.ProcessEnv): boolean;
64
- export declare function createRuntime(opts: {
65
- cwd: string;
66
- args: CliArgs;
67
- env?: NodeJS.ProcessEnv;
68
- provider?: Provider;
69
- history?: ChatMessage[];
70
- fetch?: typeof fetch;
71
- userHome?: string;
72
- /** Override langkah agent (mis. githubBot.stepLimit) — menang atas config.maxSteps. */
73
- maxSteps?: number | null;
74
- /**
75
- * Write the conversation to ~/.bccli/sessions (default true). One-shot hosts such as
76
- * `gh-bot` turn it off: a session log per webhook comment is never resumed.
77
- */
78
- persistSession?: boolean;
79
- }): Runtime;
@@ -1 +0,0 @@
1
- export declare function osc52(text: string, inTmux: boolean): string;
@@ -1 +0,0 @@
1
- export declare function gitDiff(cwd: string, maxLines?: number, bin?: string): Promise<string>;
@@ -1,18 +0,0 @@
1
- export interface DoctorDeps {
2
- which: (cmd: string) => boolean | Promise<boolean>;
3
- nodeVersion: string;
4
- listModels: () => Promise<unknown[]>;
5
- }
6
- export declare function doctorText(input: {
7
- providers: {
8
- id: string;
9
- name: string;
10
- ready: boolean;
11
- }[];
12
- mcp: {
13
- name: string;
14
- status: string;
15
- error?: string;
16
- }[];
17
- activeProvider: string;
18
- }, deps: DoctorDeps): Promise<string>;
@@ -1,2 +0,0 @@
1
- import { type ChatMessage } from '../provider';
2
- export declare function exportMarkdown(messages: ChatMessage[], title: string): string;
@@ -1,46 +0,0 @@
1
- export interface StatusInput {
2
- version: string;
3
- modelRef: string;
4
- providerLabel: string;
5
- mode: string;
6
- cwd: string;
7
- mcp: {
8
- name: string;
9
- status: string;
10
- error?: string;
11
- tools: number;
12
- }[];
13
- usage: {
14
- inputTokens: number;
15
- outputTokens: number;
16
- cachedInputTokens?: number;
17
- cacheWriteTokens?: number;
18
- };
19
- lastInputTokens: number;
20
- contextWindow?: number;
21
- }
22
- export declare function statusText(s: StatusInput): string;
23
- export declare function agentsText(defs: {
24
- name: string;
25
- description: string;
26
- tools?: string[];
27
- model?: string;
28
- }[]): string;
29
- export declare function skillsText(skills: {
30
- name: string;
31
- description: string;
32
- dir: string;
33
- }[], commands: {
34
- name: string;
35
- description?: string;
36
- }[]): string;
37
- export declare function sessionText(s: {
38
- file: string;
39
- started: Date;
40
- messages: number;
41
- usage: {
42
- inputTokens: number;
43
- outputTokens: number;
44
- };
45
- modelRef: string;
46
- }): string;
@@ -1,10 +0,0 @@
1
- export declare function instructionFiles(cwd: string, home: string): {
2
- path: string;
3
- lines: number;
4
- }[];
5
- export declare function appendMemory(file: string, text: string): void;
6
- /** `/memory [global] <teks>` → target file and text; text is empty when nothing follows. */
7
- export declare function parseMemoryArgs(args: string): {
8
- global: boolean;
9
- text: string;
10
- };