@bunshin-cc/bunshin 0.4.6 → 0.4.8

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 (2) hide show
  1. package/dist/bin.js +13 -7
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -183,12 +183,13 @@ function renderIndex(lessons) {
183
183
  }
184
184
  return lines.join("\n") + "\n";
185
185
  }
186
- var DEFAULT_CONFIG, EMPTY_SESSION, Store;
186
+ var RETIRED_DEFAULT_MODELS, DEFAULT_CONFIG, EMPTY_SESSION, Store;
187
187
  var init_store = __esm({
188
188
  "src/store.ts"() {
189
189
  "use strict";
190
190
  init_frontmatter();
191
191
  init_util();
192
+ RETIRED_DEFAULT_MODELS = /* @__PURE__ */ new Set(["claude-fable-5-1", "claude-opus-5-5"]);
192
193
  DEFAULT_CONFIG = {
193
194
  orgId: "local",
194
195
  userId: process.env.USER || "me",
@@ -199,7 +200,8 @@ var init_store = __esm({
199
200
  apiUrl: "",
200
201
  scope: "repo",
201
202
  harness: "claude-code",
202
- model: "claude-fable-5-1",
203
+ /** `[1m]` asks Claude Code for the 1M-token context window; API calls strip it (apiModelId). */
204
+ model: "claude-opus-5-5[1m]",
203
205
  gateModel: "claude-haiku-4-5-20251001",
204
206
  backend: "auto",
205
207
  recall: { enabled: true, maxLessons: 4, hookBudgetMs: 3500, useMothership: true },
@@ -267,6 +269,8 @@ var init_store = __esm({
267
269
  recall: { ...DEFAULT_CONFIG.recall, ...raw.recall ?? {} },
268
270
  reflect: { ...DEFAULT_CONFIG.reflect, ...raw.reflect ?? {} }
269
271
  };
272
+ if (RETIRED_DEFAULT_MODELS.has(merged.model)) merged.model = DEFAULT_CONFIG.model;
273
+ if (process.env.BUNSHIN_MODEL) merged.model = process.env.BUNSHIN_MODEL;
270
274
  const harness = process.env.BUNSHIN_HARNESS;
271
275
  if (harness === "claude-code" || harness === "codex" || harness === "pi" || harness === "other") merged.harness = harness;
272
276
  if (!merged.apiKey && merged.credentialFile) {
@@ -3374,7 +3378,7 @@ async function askSdk(opts) {
3374
3378
  const client = new Anthropic({ maxRetries: 1 });
3375
3379
  const isHaiku = /haiku/.test(opts.model);
3376
3380
  const base = {
3377
- model: opts.model,
3381
+ model: apiModelId(opts.model),
3378
3382
  max_tokens: opts.maxTokens ?? 16e3,
3379
3383
  system: opts.system,
3380
3384
  messages: [{ role: "user", content: opts.user }]
@@ -3516,10 +3520,11 @@ function parseJsonLoose(text2) {
3516
3520
  }
3517
3521
  return void 0;
3518
3522
  }
3519
- var CLAUDE_SESSION_ENV;
3523
+ var apiModelId, CLAUDE_SESSION_ENV;
3520
3524
  var init_llm = __esm({
3521
3525
  "src/llm.ts"() {
3522
3526
  "use strict";
3527
+ apiModelId = (model) => model.replace(/\[[^\]]*\]$/, "");
3523
3528
  CLAUDE_SESSION_ENV = [
3524
3529
  "CLAUDE_CODE_SESSION_ID",
3525
3530
  "CLAUDE_CODE_REMOTE_SESSION_ID",
@@ -4439,9 +4444,9 @@ function episodeIdFor(contextId, sessionId) {
4439
4444
  return `e_${createHash2("sha256").update(`${contextId}
4440
4445
  ${sessionId}`).digest("hex").slice(0, 16)}`;
4441
4446
  }
4442
- function runClaudeFork(sessionId, prompt, { cwd, timeoutMs = FORK_TIMEOUT_MS } = {}) {
4447
+ function runClaudeFork(sessionId, prompt, { cwd, model, timeoutMs = FORK_TIMEOUT_MS } = {}) {
4443
4448
  const bin = process.env.BUNSHIN_CLAUDE_BIN || "claude";
4444
- const args = ["-p", "--resume", sessionId, "--fork-session", "--output-format", "json", prompt];
4449
+ const args = ["-p", "--resume", sessionId, "--fork-session", "--output-format", "json", ...model ? ["--model", model] : [], prompt];
4445
4450
  return new Promise((resolve) => {
4446
4451
  let out = "";
4447
4452
  let err = "";
@@ -4553,10 +4558,11 @@ async function runReflectionV2(store, opts) {
4553
4558
  const promptBase = { contextKind: view.ctx.kind, layers: view.layers, index, captured, ...opts.focus ? { focus: opts.focus } : {}, ...earlier ? { earlier } : {}, ...profile ? { profileId: profile.id } : {} };
4554
4559
  let raw = null;
4555
4560
  if (harness === "claude-code") {
4556
- const fork = await runClaudeFork(opts.sessionId, buildReflectPrompt(promptBase), { cwd: session.cwd });
4561
+ const fork = await runClaudeFork(opts.sessionId, buildReflectPrompt(promptBase), { cwd: session.cwd, model: config.model });
4557
4562
  v2.log("v2-reflect-fork", {
4558
4563
  session: opts.sessionId,
4559
4564
  ok: fork.ok,
4565
+ model: config.model,
4560
4566
  cache: true,
4561
4567
  cache_read_input_tokens: fork.usage?.cache_read_input_tokens ?? null,
4562
4568
  cache_creation_input_tokens: fork.usage?.cache_creation_input_tokens ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunshin-cc/bunshin",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Shared memory for company AI agents. Connect Codex, Claude Code, or Pi to Bunshin.",
5
5
  "type": "module",
6
6
  "bin": {