claudish 7.1.0 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +90 -11
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -23065,6 +23065,7 @@ class SessionManager {
23065
23065
  model: entry2.info.model,
23066
23066
  content: data.content ?? "",
23067
23067
  elapsedSeconds: entry2.info.elapsedSeconds,
23068
+ createdAt: entry2.info.startedAt,
23068
23069
  extraMeta: {
23069
23070
  ...data.toolName ? { tool: data.toolName } : {},
23070
23071
  ...data.toolCount ? { tool_count: String(data.toolCount) } : {}
@@ -23287,6 +23288,66 @@ var init_channel = __esm(() => {
23287
23288
  init_session_manager();
23288
23289
  });
23289
23290
 
23291
+ // src/channel/diagnostics.ts
23292
+ import { appendFileSync } from "fs";
23293
+ function traceEnabled() {
23294
+ return process.env[TRACE_ENV] === "1";
23295
+ }
23296
+ function emit(line) {
23297
+ const formatted = `[channel-trace] ${line}
23298
+ `;
23299
+ process.stderr.write(formatted);
23300
+ const filePath = process.env[TRACE_FILE_ENV];
23301
+ if (filePath) {
23302
+ try {
23303
+ appendFileSync(filePath, formatted);
23304
+ } catch {}
23305
+ }
23306
+ }
23307
+ function wrapStateChange(fn) {
23308
+ if (!traceEnabled())
23309
+ return fn;
23310
+ return (sessionId, event) => {
23311
+ emit(`fired sid=${sessionId} type=${event.type} model=${event.model} elapsed=${event.elapsedSeconds}s`);
23312
+ try {
23313
+ fn(sessionId, event);
23314
+ emit(`callback returned sid=${sessionId} type=${event.type}`);
23315
+ } catch (err) {
23316
+ emit(`callback THREW sid=${sessionId} type=${event.type} err=${err?.message ?? err}`);
23317
+ throw err;
23318
+ }
23319
+ };
23320
+ }
23321
+ function watchNotificationResult(result, context) {
23322
+ if (!traceEnabled())
23323
+ return;
23324
+ if (result && typeof result.then === "function") {
23325
+ result.catch((err) => {
23326
+ emit(`notification REJECTED sid=${context.sessionId} type=${context.eventType} err=${err?.message ?? err}`);
23327
+ });
23328
+ }
23329
+ }
23330
+ function installWireTap() {
23331
+ if (!traceEnabled())
23332
+ return;
23333
+ if (wireTapInstalled)
23334
+ return;
23335
+ wireTapInstalled = true;
23336
+ const originalWrite = process.stdout.write.bind(process.stdout);
23337
+ process.stdout.write = (chunk, ...rest) => {
23338
+ try {
23339
+ const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf-8");
23340
+ if (text.includes('"notifications/claude/channel"')) {
23341
+ emit(`WIRE-OUT ${text.trim()}`);
23342
+ }
23343
+ } catch {}
23344
+ return originalWrite(chunk, ...rest);
23345
+ };
23346
+ emit("wire tap installed");
23347
+ }
23348
+ var TRACE_ENV = "CLAUDISH_CHANNEL_TRACE", TRACE_FILE_ENV = "CLAUDISH_CHANNEL_TRACE_FILE", wireTapInstalled = false;
23349
+ var init_diagnostics = () => {};
23350
+
23290
23351
  // ../../node_modules/.bun/hono@4.10.6/node_modules/hono/dist/compose.js
23291
23352
  var compose = (middleware, onError, onNotFound) => {
23292
23353
  return (context, next) => {
@@ -26885,7 +26946,7 @@ var init_catalog_query = __esm(() => {
26885
26946
  });
26886
26947
 
26887
26948
  // src/handlers/native-handler-advisor.ts
26888
- import { appendFileSync } from "fs";
26949
+ import { appendFileSync as appendFileSync2 } from "fs";
26889
26950
  function loadAdvisorSwapConfig(cliModels, cliCollector) {
26890
26951
  return {
26891
26952
  enabled: process.env.CLAUDISH_SWAP_ADVISOR === "1" || (cliModels?.length ?? 0) > 0,
@@ -26940,7 +27001,7 @@ function logAdvisorEvent(cfg, event) {
26940
27001
  const line = JSON.stringify({ ts: new Date().toISOString(), ...event }) + `
26941
27002
  `;
26942
27003
  try {
26943
- appendFileSync(cfg.logPath, line);
27004
+ appendFileSync2(cfg.logPath, line);
26944
27005
  } catch {}
26945
27006
  }
26946
27007
  function recordAdvisorEventsFromChunk(cfg, chunkText) {
@@ -32653,7 +32714,7 @@ var init_profile_config = __esm(() => {
32653
32714
  });
32654
32715
 
32655
32716
  // src/version.ts
32656
- var VERSION = "7.1.0";
32717
+ var VERSION = "7.1.2";
32657
32718
 
32658
32719
  // src/telemetry.ts
32659
32720
  var exports_telemetry = {};
@@ -34963,7 +35024,7 @@ function getRecommendedModelsSync() {
34963
35024
  if (existsSync9(RECOMMENDED_MODELS_CACHE_PATH)) {
34964
35025
  try {
34965
35026
  const cacheData = JSON.parse(readFileSync6(RECOMMENDED_MODELS_CACHE_PATH, "utf-8"));
34966
- if (cacheData.models && cacheData.models.length > 0) {
35027
+ if (cacheData.models && cacheData.models.length > 0 && isFreshEnough(cacheData)) {
34967
35028
  _cachedRecommendedModels = cacheData;
34968
35029
  return cacheData;
34969
35030
  }
@@ -39810,6 +39871,9 @@ function resolveToolGroups(mode) {
39810
39871
  return new Set(["low-level", "agentic", "channel"]);
39811
39872
  }
39812
39873
  }
39874
+ function mapEventToTaskStatus(event) {
39875
+ return EVENT_TO_TASK_STATUS.get(event) ?? "working";
39876
+ }
39813
39877
  async function main() {
39814
39878
  const toolMode = (process.env.CLAUDISH_MCP_TOOLS || "all").toLowerCase();
39815
39879
  const enabledGroups = resolveToolGroups(toolMode);
@@ -39821,11 +39885,11 @@ async function main() {
39821
39885
  instructions: INSTRUCTIONS
39822
39886
  });
39823
39887
  const sessionManager = new SessionManager({
39824
- onStateChange: (sessionId2, event) => {
39888
+ onStateChange: wrapStateChange((sessionId2, event) => {
39825
39889
  const notificationContent = event.type === "failed" ? `${event.content}
39826
39890
 
39827
39891
  To report this error, use the report_error tool with error_type: "provider_failure" and model: "${event.model}".` : event.content;
39828
- server.notification({
39892
+ const result = server.notification({
39829
39893
  method: "notifications/claude/channel",
39830
39894
  params: {
39831
39895
  content: notificationContent,
@@ -39834,11 +39898,16 @@ To report this error, use the report_error tool with error_type: "provider_failu
39834
39898
  event: event.type,
39835
39899
  model: event.model,
39836
39900
  elapsed_seconds: String(event.elapsedSeconds),
39901
+ task_id: sessionId2,
39902
+ status: mapEventToTaskStatus(event.type),
39903
+ created_at: event.createdAt,
39904
+ last_updated_at: new Date().toISOString(),
39837
39905
  ...event.extraMeta
39838
39906
  }
39839
39907
  }
39840
39908
  });
39841
- }
39909
+ watchNotificationResult(result, { sessionId: sessionId2, eventType: event.type });
39910
+ })
39842
39911
  });
39843
39912
  const allTools = defineTools(sessionManager);
39844
39913
  const enabledTools = allTools.filter((t) => enabledGroups.has(t.group));
@@ -39875,6 +39944,7 @@ To report this error, use the report_error tool with error_type: "provider_failu
39875
39944
  }
39876
39945
  });
39877
39946
  const transport = new StdioServerTransport;
39947
+ installWireTap();
39878
39948
  await server.connect(transport);
39879
39949
  process.on("SIGTERM", () => {
39880
39950
  sessionManager.shutdownAll().catch(() => {});
@@ -39910,13 +39980,14 @@ When channel mode is active, you receive <channel source="claudish" ...> notific
39910
39980
  5. Use list_sessions to see all active/completed sessions.
39911
39981
  6. Use cancel_session to stop a running session.
39912
39982
 
39913
- The session_id in the channel tag's meta attributes is the key for all tool calls.`, proxyInstance = null, proxyStarting = null;
39983
+ The session_id in the channel tag's meta attributes is the key for all tool calls.`, proxyInstance = null, proxyStarting = null, EVENT_TO_TASK_STATUS;
39914
39984
  var init_mcp_server = __esm(() => {
39915
39985
  init_server2();
39916
39986
  init_stdio2();
39917
39987
  init_types();
39918
39988
  init_team_orchestrator();
39919
39989
  init_channel();
39990
+ init_diagnostics();
39920
39991
  init_proxy_server();
39921
39992
  init_port_manager();
39922
39993
  init_model_loader();
@@ -39927,6 +39998,15 @@ var init_mcp_server = __esm(() => {
39927
39998
  __dirname2 = dirname2(__filename2);
39928
39999
  CLAUDISH_CACHE_DIR = join20(homedir19(), ".claudish");
39929
40000
  ALL_MODELS_CACHE_PATH2 = join20(CLAUDISH_CACHE_DIR, "all-models.json");
40001
+ EVENT_TO_TASK_STATUS = new Map([
40002
+ ["starting", "working"],
40003
+ ["running", "working"],
40004
+ ["tool_executing", "working"],
40005
+ ["waiting_for_input", "input_required"],
40006
+ ["completed", "completed"],
40007
+ ["failed", "failed"],
40008
+ ["cancelled", "cancelled"]
40009
+ ]);
39930
40010
  });
39931
40011
 
39932
40012
  // ../../node_modules/.bun/@inquirer+core@11.0.1+04f2146be16c61ef/node_modules/@inquirer/core/dist/lib/key.js
@@ -52482,17 +52562,16 @@ async function geminiQuotaHandler() {
52482
52562
  console.log(` ${marker}${WHT}${model}${R} ${color}${pct}${R}${arrow}`);
52483
52563
  }
52484
52564
  console.log("");
52485
- const geminiFallback = process.env.CLAUDISH_GEMINI_HELP_FALLBACK ?? "gemini-2.5-flash";
52486
52565
  let geminiExamples;
52487
52566
  try {
52488
52567
  const recs = await getRecommendedModels();
52489
52568
  const seen = new Set;
52490
52569
  geminiExamples = recs.models.filter((e) => (e.provider ?? "").toLowerCase() === "google").filter((e) => seen.has(e.id) ? false : (seen.add(e.id), true)).slice(0, 2).map((e) => e.id);
52491
52570
  if (geminiExamples.length === 0) {
52492
- geminiExamples = [geminiFallback];
52571
+ geminiExamples = ["gemini-3.1-pro-preview"];
52493
52572
  }
52494
52573
  } catch {
52495
- geminiExamples = [geminiFallback];
52574
+ geminiExamples = ["gemini-3.1-pro-preview"];
52496
52575
  }
52497
52576
  console.log(` ${B}${CYN}Usage${R}`);
52498
52577
  for (const ex of geminiExamples) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "7.1.0",
3
+ "version": "7.1.2",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -59,10 +59,10 @@
59
59
  "ai"
60
60
  ],
61
61
  "optionalDependencies": {
62
- "@claudish/magmux-darwin-arm64": "7.1.0",
63
- "@claudish/magmux-darwin-x64": "7.1.0",
64
- "@claudish/magmux-linux-arm64": "7.1.0",
65
- "@claudish/magmux-linux-x64": "7.1.0"
62
+ "@claudish/magmux-darwin-arm64": "7.1.2",
63
+ "@claudish/magmux-darwin-x64": "7.1.2",
64
+ "@claudish/magmux-linux-arm64": "7.1.2",
65
+ "@claudish/magmux-linux-x64": "7.1.2"
66
66
  },
67
67
  "author": "Jack Rudenko <i@madappgang.com>",
68
68
  "license": "MIT",