@phuetz/code-buddy 1.3.1 → 1.4.0

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 (71) hide show
  1. package/README.md +23 -4
  2. package/dist/agent/autonomous/agentic-coding-runner.d.ts +2 -2
  3. package/dist/agent/autonomous/agentic-coding-runner.js +24 -24
  4. package/dist/agent/autonomous/checkpoint-manager.d.ts +2 -2
  5. package/dist/agent/base-agent.d.ts +1 -1
  6. package/dist/agent/base-agent.js +1 -1
  7. package/dist/agent/execution/tool-selection-strategy.js +4 -1
  8. package/dist/agent/hermes-tool-parity-local.js +2 -2
  9. package/dist/agent/tool-handler.js +2 -2
  10. package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +4 -0
  11. package/dist/codebuddy/providers/provider-chatgpt-responses.js +34 -13
  12. package/dist/codebuddy/providers/provider-openai-compat.js +8 -0
  13. package/dist/codebuddy/tool-definitions/code-explorer-tools.d.ts +8 -0
  14. package/dist/codebuddy/tool-definitions/code-explorer-tools.js +24 -0
  15. package/dist/codebuddy/tool-definitions/graph-tools.d.ts +1 -1
  16. package/dist/codebuddy/tool-definitions/graph-tools.js +1 -1
  17. package/dist/codebuddy/tool-definitions/index.d.ts +1 -1
  18. package/dist/codebuddy/tool-definitions/index.js +2 -2
  19. package/dist/codebuddy/tools.d.ts +2 -2
  20. package/dist/codebuddy/tools.js +28 -13
  21. package/dist/collaboration/ai-colab-manager.js +9 -4
  22. package/dist/commands/cli/code-explorer-commands.d.ts +7 -0
  23. package/dist/commands/cli/code-explorer-commands.js +40 -0
  24. package/dist/commands/cli/native-engine-commands.js +64 -0
  25. package/dist/commands/handlers/channel-handlers.js +39 -22
  26. package/dist/commands/handlers/graph-handlers.d.ts +1 -1
  27. package/dist/commands/handlers/graph-handlers.js +1 -1
  28. package/dist/config/model-tools.js +1 -1
  29. package/dist/daemon/autonomous-loop.d.ts +0 -7
  30. package/dist/daemon/autonomous-loop.js +24 -14
  31. package/dist/fleet/capability-registry.js +9 -1
  32. package/dist/fleet/colab-store.d.ts +109 -3
  33. package/dist/fleet/colab-store.js +181 -6
  34. package/dist/index.js +28 -11
  35. package/dist/input/text-to-speech.js +16 -1
  36. package/dist/kanban/colab-kanban-adapter.d.ts +31 -0
  37. package/dist/kanban/colab-kanban-adapter.js +232 -0
  38. package/dist/knowledge/community-detector.d.ts +1 -1
  39. package/dist/knowledge/community-detector.js +1 -1
  40. package/dist/knowledge/process-detector.d.ts +1 -1
  41. package/dist/knowledge/process-detector.js +1 -1
  42. package/dist/plugins/{gitnexus/GitNexusMCPClient.d.ts → code-explorer/CodeExplorerMCPClient.d.ts} +9 -9
  43. package/dist/plugins/{gitnexus/GitNexusMCPClient.js → code-explorer/CodeExplorerMCPClient.js} +17 -17
  44. package/dist/plugins/{gitnexus/GitNexusManager.d.ts → code-explorer/CodeExplorerManager.d.ts} +16 -16
  45. package/dist/plugins/{gitnexus/GitNexusManager.js → code-explorer/CodeExplorerManager.js} +35 -35
  46. package/dist/plugins/code-explorer/index.d.ts +9 -0
  47. package/dist/plugins/code-explorer/index.js +8 -0
  48. package/dist/providers/provider-catalog.js +23 -1
  49. package/dist/services/prompt-builder.js +9 -9
  50. package/dist/skills/parser.js +1 -1
  51. package/dist/tools/{gitnexus-tool.d.ts → code-explorer-tool.d.ts} +9 -9
  52. package/dist/tools/{gitnexus-tool.js → code-explorer-tool.js} +16 -16
  53. package/dist/tools/metadata.js +3 -3
  54. package/dist/tools/registry/code-explorer-tools.d.ts +18 -0
  55. package/dist/tools/registry/{gitnexus-tools.js → code-explorer-tools.js} +14 -14
  56. package/dist/tools/registry/graph-tools.d.ts +1 -1
  57. package/dist/tools/registry/graph-tools.js +1 -1
  58. package/dist/tools/registry/index.d.ts +1 -1
  59. package/dist/tools/registry/index.js +6 -6
  60. package/dist/tools/registry/kanban-tools.d.ts +1 -1
  61. package/dist/tools/registry/kanban-tools.js +2 -2
  62. package/dist/voice/local-whisper.d.ts +9 -0
  63. package/dist/voice/local-whisper.js +93 -0
  64. package/package.json +1 -1
  65. package/dist/codebuddy/tool-definitions/gitnexus-tools.d.ts +0 -8
  66. package/dist/codebuddy/tool-definitions/gitnexus-tools.js +0 -24
  67. package/dist/commands/cli/gitnexus-commands.d.ts +0 -7
  68. package/dist/commands/cli/gitnexus-commands.js +0 -42
  69. package/dist/plugins/gitnexus/index.d.ts +0 -9
  70. package/dist/plugins/gitnexus/index.js +0 -8
  71. package/dist/tools/registry/gitnexus-tools.d.ts +0 -18
@@ -1,26 +1,26 @@
1
1
  /**
2
- * GitNexus Tool Client
2
+ * CodeExplorer Tool Client
3
3
  *
4
- * Consultative, read-only interface to GitNexus endpoints (/ask, /push-session, /world-model).
4
+ * Consultative, read-only interface to CodeExplorer endpoints (/ask, /push-session, /world-model).
5
5
  * Degrades gracefully by returning empty contexts/invariants and detailed notes on timeout/offline.
6
6
  */
7
7
  import { logger } from '../utils/logger.js';
8
8
  import { redactSecrets } from '../security/data-redaction.js';
9
- export class GitNexusTool {
9
+ export class CodeExplorerTool {
10
10
  endpoint;
11
11
  apiKey;
12
12
  timeoutMs;
13
13
  constructor(config) {
14
- this.endpoint = config?.endpoint || process.env.GITNEXUS_ENDPOINT || '';
15
- this.apiKey = config?.apiKey || process.env.GITNEXUS_API_KEY || '';
16
- this.timeoutMs = config?.timeoutMs ?? Number(process.env.GITNEXUS_TIMEOUT_MS || 5000);
14
+ this.endpoint = config?.endpoint || process.env.CODE_EXPLORER_ENDPOINT || '';
15
+ this.apiKey = config?.apiKey || process.env.CODE_EXPLORER_API_KEY || '';
16
+ this.timeoutMs = config?.timeoutMs ?? Number(process.env.CODE_EXPLORER_TIMEOUT_MS || 5000);
17
17
  }
18
18
  /**
19
19
  * Helper to perform HTTP request with timeout and headers.
20
20
  */
21
21
  async request(path, options) {
22
22
  if (!this.endpoint) {
23
- logger.debug(`GitNexus: No endpoint configured, skipping request to ${path}`);
23
+ logger.debug(`CodeExplorer: No endpoint configured, skipping request to ${path}`);
24
24
  return null;
25
25
  }
26
26
  const url = `${this.endpoint.replace(/\/$/, '')}${path}`;
@@ -52,7 +52,7 @@ export class GitNexusTool {
52
52
  catch (error) {
53
53
  const rawMsg = error instanceof Error ? error.message : String(error);
54
54
  const msg = redactSecrets(rawMsg);
55
- logger.warn(`GitNexus request to ${path} failed: ${msg}`);
55
+ logger.warn(`CodeExplorer request to ${path} failed: ${msg}`);
56
56
  return null;
57
57
  }
58
58
  finally {
@@ -60,17 +60,17 @@ export class GitNexusTool {
60
60
  }
61
61
  }
62
62
  /**
63
- * Lecture seule : interroge GitNexus pour une tâche/texte. Dégrade proprement si indisponible.
63
+ * Lecture seule : interroge CodeExplorer pour une tâche/texte. Dégrade proprement si indisponible.
64
64
  */
65
65
  async ask(query) {
66
66
  const redactedQuery = redactSecrets(query);
67
- logger.debug(`GitNexus.ask called with query: ${redactedQuery}`);
67
+ logger.debug(`CodeExplorer.ask called with query: ${redactedQuery}`);
68
68
  if (!this.endpoint) {
69
69
  return {
70
70
  likelyFiles: [],
71
71
  dependentSymbols: [],
72
72
  testsToWatch: [],
73
- notes: 'GitNexus is not configured (missing endpoint).',
73
+ notes: 'CodeExplorer is not configured (missing endpoint).',
74
74
  };
75
75
  }
76
76
  const response = await this.request('/ask', {
@@ -82,7 +82,7 @@ export class GitNexusTool {
82
82
  likelyFiles: [],
83
83
  dependentSymbols: [],
84
84
  testsToWatch: [],
85
- notes: 'GitNexus is offline or returned an error.',
85
+ notes: 'CodeExplorer is offline or returned an error.',
86
86
  };
87
87
  }
88
88
  return {
@@ -93,11 +93,11 @@ export class GitNexusTool {
93
93
  };
94
94
  }
95
95
  /**
96
- * Pousse le résumé de session vers GitNexus (mémoire technique).
96
+ * Pousse le résumé de session vers CodeExplorer (mémoire technique).
97
97
  */
98
98
  async pushSession(summary) {
99
99
  const redactedSummary = redactSecrets(summary);
100
- logger.debug(`GitNexus.pushSession called: ${redactedSummary}`);
100
+ logger.debug(`CodeExplorer.pushSession called: ${redactedSummary}`);
101
101
  if (!this.endpoint) {
102
102
  return { ok: false };
103
103
  }
@@ -111,7 +111,7 @@ export class GitNexusTool {
111
111
  * Lecture des invariants du world model.
112
112
  */
113
113
  async readWorldModel() {
114
- logger.debug('GitNexus.readWorldModel called');
114
+ logger.debug('CodeExplorer.readWorldModel called');
115
115
  if (!this.endpoint) {
116
116
  return null;
117
117
  }
@@ -121,4 +121,4 @@ export class GitNexusTool {
121
121
  return response;
122
122
  }
123
123
  }
124
- //# sourceMappingURL=gitnexus-tool.js.map
124
+ //# sourceMappingURL=code-explorer-tool.js.map
@@ -1232,11 +1232,11 @@ export const TOOL_METADATA = [
1232
1232
  description: 'Spawn an isolated sandboxed sub-agent session for a delegated task (depth-3 + 10/workflow caps)',
1233
1233
  },
1234
1234
  {
1235
- name: 'gitnexus_ask',
1235
+ name: 'code_explorer_ask',
1236
1236
  category: 'utility',
1237
- keywords: ['gitnexus', 'ask', 'query', 'understand', 'explain', 'search', 'related files', 'dependents', 'tests'],
1237
+ keywords: ['code-explorer', 'ask', 'query', 'understand', 'explain', 'search', 'related files', 'dependents', 'tests'],
1238
1238
  priority: 6,
1239
- description: 'Consult GitNexus for a query or code understanding request (read-only)',
1239
+ description: 'Consult CodeExplorer for a query or code understanding request (read-only)',
1240
1240
  fleetSafe: true,
1241
1241
  },
1242
1242
  {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * CodeExplorer Tool Adapter
3
+ *
4
+ * ITool-compliant adapter for the CodeExplorer tool.
5
+ */
6
+ import type { ToolResult } from '../../types/index.js';
7
+ import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
8
+ export declare class CodeExplorerAskTool implements ITool {
9
+ readonly name = "code_explorer_ask";
10
+ readonly description = "Consult CodeExplorer for a query or code understanding request. Returns related files, dependent symbols, tests to watch, and technical recommendations. This is a read-only tool.";
11
+ execute(input: Record<string, unknown>): Promise<ToolResult>;
12
+ getSchema(): ToolSchema;
13
+ validate(input: unknown): IValidationResult;
14
+ getMetadata(): IToolMetadata;
15
+ isAvailable(): boolean;
16
+ }
17
+ export declare function createCodeExplorerTools(): ITool[];
18
+ export declare function resetCodeExplorerInstances(): void;
@@ -1,12 +1,12 @@
1
1
  /**
2
- * GitNexus Tool Adapter
2
+ * CodeExplorer Tool Adapter
3
3
  *
4
- * ITool-compliant adapter for the GitNexus tool.
4
+ * ITool-compliant adapter for the CodeExplorer tool.
5
5
  */
6
- import { GitNexusTool } from '../gitnexus-tool.js';
7
- export class GitNexusAskTool {
8
- name = 'gitnexus_ask';
9
- description = 'Consult GitNexus for a query or code understanding request. Returns related files, dependent symbols, tests to watch, and technical recommendations. This is a read-only tool.';
6
+ import { CodeExplorerTool } from '../code-explorer-tool.js';
7
+ export class CodeExplorerAskTool {
8
+ name = 'code_explorer_ask';
9
+ description = 'Consult CodeExplorer for a query or code understanding request. Returns related files, dependent symbols, tests to watch, and technical recommendations. This is a read-only tool.';
10
10
  async execute(input) {
11
11
  const query = typeof input.query === 'string' ? input.query : '';
12
12
  if (!query) {
@@ -16,8 +16,8 @@ export class GitNexusAskTool {
16
16
  };
17
17
  }
18
18
  try {
19
- const gitNexus = new GitNexusTool();
20
- const result = await gitNexus.ask(query);
19
+ const codeExplorer = new CodeExplorerTool();
20
+ const result = await codeExplorer.ask(query);
21
21
  return {
22
22
  success: true,
23
23
  output: JSON.stringify(result, null, 2),
@@ -39,7 +39,7 @@ export class GitNexusAskTool {
39
39
  properties: {
40
40
  query: {
41
41
  type: 'string',
42
- description: 'The query or task description to ask GitNexus about.',
42
+ description: 'The query or task description to ask CodeExplorer about.',
43
43
  },
44
44
  },
45
45
  required: ['query'],
@@ -61,7 +61,7 @@ export class GitNexusAskTool {
61
61
  name: this.name,
62
62
  description: this.description,
63
63
  category: 'utility',
64
- keywords: ['gitnexus', 'ask', 'query', 'understand', 'explain', 'search', 'related files', 'dependents', 'tests'],
64
+ keywords: ['code-explorer', 'ask', 'query', 'understand', 'explain', 'search', 'related files', 'dependents', 'tests'],
65
65
  priority: 6,
66
66
  modifiesFiles: false,
67
67
  makesNetworkRequests: true,
@@ -71,10 +71,10 @@ export class GitNexusAskTool {
71
71
  return true;
72
72
  }
73
73
  }
74
- export function createGitNexusTools() {
75
- return [new GitNexusAskTool()];
74
+ export function createCodeExplorerTools() {
75
+ return [new CodeExplorerAskTool()];
76
76
  }
77
- export function resetGitNexusInstances() {
77
+ export function resetCodeExplorerInstances() {
78
78
  // Stateless tool — nothing to reset
79
79
  }
80
- //# sourceMappingURL=gitnexus-tools.js.map
80
+ //# sourceMappingURL=code-explorer-tools.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Graph Tool Adapters — GitNexus Knowledge Graph
2
+ * Graph Tool Adapters — CodeExplorer Knowledge Graph
3
3
  *
4
4
  * ITool-compliant adapters for the FormalToolRegistry:
5
5
  * - AnalyzeImpactTool: blast radius analysis
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Graph Tool Adapters — GitNexus Knowledge Graph
2
+ * Graph Tool Adapters — CodeExplorer Knowledge Graph
3
3
  *
4
4
  * ITool-compliant adapters for the FormalToolRegistry:
5
5
  * - AnalyzeImpactTool: blast radius analysis
@@ -57,7 +57,7 @@ export { ResolveConflictsExecuteTool, createMergeConflictTools, resetMergeConfli
57
57
  export { VulnScannerExecuteTool, createVulnScannerTools, resetVulnScannerInstances, } from './vuln-scanner-tools.js';
58
58
  export { AdvisorExecuteTool, createAdvisorTools, resetAdvisorInstances, setAdvisorConfigProvider, resetAdvisorConfigProvider, } from './advisor-tools.js';
59
59
  export { PeerDelegateTool, PeerChainTool, ListPeersTool, RoutePeerTool, createFleetTools, resetFleetToolInstances, } from './fleet-tools.js';
60
- export { GitNexusAskTool, createGitNexusTools, resetGitNexusInstances, } from './gitnexus-tools.js';
60
+ export { CodeExplorerAskTool, createCodeExplorerTools, resetCodeExplorerInstances, } from './code-explorer-tools.js';
61
61
  export { ScreenMemoryTool, createScreenpipeTools, resetScreenpipeInstances, } from './screenpipe-tools.js';
62
62
  export { AskUserQuestionExecuteTool, createAskUserQuestionTools, resetAskUserQuestionInstances, } from './ask-user-question-tools.js';
63
63
  export { ExitPlanModeExecuteTool, createExitPlanModeTools, resetExitPlanModeInstances, } from './exit-plan-mode-tools.js';
@@ -99,8 +99,8 @@ export { VulnScannerExecuteTool, createVulnScannerTools, resetVulnScannerInstanc
99
99
  export { AdvisorExecuteTool, createAdvisorTools, resetAdvisorInstances, setAdvisorConfigProvider, resetAdvisorConfigProvider, } from './advisor-tools.js';
100
100
  // Tool Adapters - Fleet (peer_delegate, list_peers, route_peer)
101
101
  export { PeerDelegateTool, PeerChainTool, ListPeersTool, RoutePeerTool, createFleetTools, resetFleetToolInstances, } from './fleet-tools.js';
102
- // Tool Adapters - GitNexus
103
- export { GitNexusAskTool, createGitNexusTools, resetGitNexusInstances, } from './gitnexus-tools.js';
102
+ // Tool Adapters - CodeExplorer
103
+ export { CodeExplorerAskTool, createCodeExplorerTools, resetCodeExplorerInstances, } from './code-explorer-tools.js';
104
104
  // Tool Adapters - Screenpipe (screen_memory)
105
105
  export { ScreenMemoryTool, createScreenpipeTools, resetScreenpipeInstances, } from './screenpipe-tools.js';
106
106
  // Tool Adapters - AskUserQuestion (ask_user_question)
@@ -172,7 +172,7 @@ export async function createAllToolsAsync() {
172
172
  const { createFleetTools } = await import('./fleet-tools.js');
173
173
  const { createAskUserQuestionTools } = await import('./ask-user-question-tools.js');
174
174
  const { createExitPlanModeTools } = await import('./exit-plan-mode-tools.js');
175
- const { createGitNexusTools } = await import('./gitnexus-tools.js');
175
+ const { createCodeExplorerTools } = await import('./code-explorer-tools.js');
176
176
  // Await MCP Manager initialization before registering its tools
177
177
  const { getMcpManager } = await import('../mcp/mcp-manager.js');
178
178
  await getMcpManager().initialize();
@@ -226,7 +226,7 @@ export async function createAllToolsAsync() {
226
226
  ...createFleetTools(),
227
227
  ...createAskUserQuestionTools(),
228
228
  ...createExitPlanModeTools(),
229
- ...createGitNexusTools(),
229
+ ...createCodeExplorerTools(),
230
230
  ...createMcpTools(),
231
231
  ];
232
232
  // Register backward-compat canonical-prefix aliases (shell_exec, file_read, etc.)
@@ -302,7 +302,7 @@ export function registerBuiltinTools(registry) {
302
302
  ...createExitPlanModeTools(),
303
303
  ...createGuiTools(),
304
304
  ...createSessionTools(),
305
- ...createGitNexusTools(),
305
+ ...createCodeExplorerTools(),
306
306
  ];
307
307
  // Append canonical-prefix aliases (shell_exec → bash_run, etc.).
308
308
  allTools.push(...createAliasTools(allTools));
@@ -368,6 +368,6 @@ import { createExitPlanModeTools } from './exit-plan-mode-tools.js';
368
368
  import { createGuiTools } from './gui-tools.js';
369
369
  import { createSessionTools } from './session-tools.js';
370
370
  import { createAliasTools } from './tool-aliases.js';
371
- import { createGitNexusTools } from './gitnexus-tools.js';
371
+ import { createCodeExplorerTools } from './code-explorer-tools.js';
372
372
  export * from "./windows-tools.js";
373
373
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { type KanbanStoreOptions } from '../../kanban/kanban-store.js';
1
+ import type { KanbanStoreOptions } from '../../kanban/kanban-store.js';
2
2
  import type { ITool } from './types.js';
3
3
  export type KanbanToolOptions = KanbanStoreOptions;
4
4
  export declare function createKanbanTools(options?: KanbanToolOptions): ITool[];
@@ -1,5 +1,5 @@
1
1
  import { KANBAN_BLOCK_TOOL, KANBAN_COMMENT_TOOL, KANBAN_COMPLETE_TOOL, KANBAN_CREATE_TOOL, KANBAN_HEARTBEAT_TOOL, KANBAN_LINK_TOOL, KANBAN_LIST_TOOL, KANBAN_SHOW_TOOL, KANBAN_UNBLOCK_TOOL, } from '../../codebuddy/tool-definitions/kanban-tools.js';
2
- import { KanbanStore, } from '../../kanban/kanban-store.js';
2
+ import { ColabKanbanAdapter } from '../../kanban/colab-kanban-adapter.js';
3
3
  class KanbanTool {
4
4
  definition;
5
5
  executor;
@@ -54,7 +54,7 @@ class KanbanTool {
54
54
  return true;
55
55
  }
56
56
  createStore(context) {
57
- return new KanbanStore({
57
+ return new ColabKanbanAdapter({
58
58
  ...this.options,
59
59
  rootDir: this.options.rootDir ?? context?.cwd,
60
60
  });
@@ -0,0 +1,9 @@
1
+ export interface LocalWhisperOptions {
2
+ language?: string;
3
+ model?: string;
4
+ timeoutMs?: number;
5
+ }
6
+ /** Transcribe an audio file (wav/ogg/mp3/webm…) to text via local faster-whisper. */
7
+ export declare function transcribeFile(audioPath: string, options?: LocalWhisperOptions): Promise<string>;
8
+ /** True if a local faster-whisper interpreter looks available. */
9
+ export declare function localWhisperAvailable(): boolean;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Local speech-to-text via faster-whisper ($0, offline).
3
+ *
4
+ * Wraps a self-hosted faster-whisper venv (the same local voice stack Cowork
5
+ * uses — e.g. ~/DEV/ai-stack/voice/.venv) as a reusable `audioFile -> text`
6
+ * helper. One-shot per call (model loads in ~1-2s on int8 CPU), which is fine
7
+ * for occasional clips (Telegram voice notes, a CLI turn). No cloud, no key.
8
+ *
9
+ * Engine selection (first existing wins):
10
+ * CODEBUDDY_VOICE_PYTHON | COWORK_VOICE_PYTHON (explicit interpreter)
11
+ * ~/.codebuddy/voice/.venv/bin/python
12
+ * ~/DEV/ai-stack/voice/.venv/bin/python
13
+ * ~/ai-stack/voice/.venv/bin/python
14
+ * python3 (PATH fallback)
15
+ * Model: CODEBUDDY_WHISPER_MODEL | COWORK_WHISPER_MODEL | "base".
16
+ */
17
+ import { spawn } from 'node:child_process';
18
+ import { existsSync } from 'node:fs';
19
+ import { homedir } from 'node:os';
20
+ import { join } from 'node:path';
21
+ function resolvePython() {
22
+ const candidates = [
23
+ process.env.CODEBUDDY_VOICE_PYTHON,
24
+ process.env.COWORK_VOICE_PYTHON,
25
+ join(homedir(), '.codebuddy/voice/.venv/bin/python'),
26
+ join(homedir(), 'DEV/ai-stack/voice/.venv/bin/python'),
27
+ join(homedir(), 'ai-stack/voice/.venv/bin/python'),
28
+ ].filter((c) => Boolean(c));
29
+ for (const c of candidates) {
30
+ if (existsSync(c))
31
+ return c;
32
+ }
33
+ return 'python3';
34
+ }
35
+ const WHISPER_SCRIPT = `
36
+ import sys, json
37
+ from faster_whisper import WhisperModel
38
+ audio, model, lang = sys.argv[1], sys.argv[2], (sys.argv[3] or None)
39
+ m = WhisperModel(model, device="cpu", compute_type="int8")
40
+ segs, _info = m.transcribe(audio, language=lang, vad_filter=True, beam_size=1)
41
+ print(json.dumps({"text": " ".join(s.text.strip() for s in segs).strip()}))
42
+ `;
43
+ /** Transcribe an audio file (wav/ogg/mp3/webm…) to text via local faster-whisper. */
44
+ export async function transcribeFile(audioPath, options = {}) {
45
+ const language = options.language ?? 'fr';
46
+ const model = options.model ||
47
+ process.env.CODEBUDDY_WHISPER_MODEL ||
48
+ process.env.COWORK_WHISPER_MODEL ||
49
+ 'base';
50
+ const timeoutMs = options.timeoutMs ?? 120_000;
51
+ if (!existsSync(audioPath)) {
52
+ throw new Error(`local-whisper: audio file not found: ${audioPath}`);
53
+ }
54
+ return new Promise((resolve, reject) => {
55
+ const py = resolvePython();
56
+ const proc = spawn(py, ['-c', WHISPER_SCRIPT, audioPath, model, language], {
57
+ stdio: ['ignore', 'pipe', 'pipe'],
58
+ });
59
+ let stdout = '';
60
+ let stderr = '';
61
+ const timer = setTimeout(() => {
62
+ proc.kill('SIGKILL');
63
+ reject(new Error(`local-whisper: timed out after ${timeoutMs}ms`));
64
+ }, timeoutMs);
65
+ proc.stdout.on('data', (d) => (stdout += d.toString()));
66
+ proc.stderr.on('data', (d) => (stderr += d.toString()));
67
+ proc.on('error', (e) => {
68
+ clearTimeout(timer);
69
+ reject(new Error(`local-whisper: failed to spawn ${py}: ${e.message}`));
70
+ });
71
+ proc.on('close', (code) => {
72
+ clearTimeout(timer);
73
+ if (code !== 0) {
74
+ reject(new Error(`local-whisper: exited ${code}: ${stderr.trim().slice(-300)}`));
75
+ return;
76
+ }
77
+ try {
78
+ const line = stdout.trim().split('\n').filter(Boolean).pop() || '{}';
79
+ const parsed = JSON.parse(line);
80
+ resolve((parsed.text || '').trim());
81
+ }
82
+ catch (e) {
83
+ reject(new Error(`local-whisper: bad output: ${String(e)} :: ${stdout.slice(-200)}`));
84
+ }
85
+ });
86
+ });
87
+ }
88
+ /** True if a local faster-whisper interpreter looks available. */
89
+ export function localWhisperAvailable() {
90
+ const py = resolvePython();
91
+ return py !== 'python3' || Boolean(process.env.CODEBUDDY_VOICE_PYTHON);
92
+ }
93
+ //# sourceMappingURL=local-whisper.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phuetz/code-buddy",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Open-source multi-provider AI coding agent for the terminal, desktop, and HTTP. 15 LLM providers (Grok, Claude, ChatGPT, Gemini, Ollama, LM Studio, …) with ~110 tools, a peer-to-peer fleet, opt-in self-improvement, multi-channel messaging, and a skills system.",
5
5
  "author": "Patrice Huetz <patrice.huetz@gmail.com>",
6
6
  "repository": {
@@ -1,8 +0,0 @@
1
- /**
2
- * GitNexus Tool Definitions
3
- *
4
- * OpenAI function calling schema for the GitNexus tool.
5
- */
6
- import type { CodeBuddyTool } from './types.js';
7
- export declare const GITNEXUS_ASK_TOOL: CodeBuddyTool;
8
- export declare const GITNEXUS_TOOLS: CodeBuddyTool[];
@@ -1,24 +0,0 @@
1
- /**
2
- * GitNexus Tool Definitions
3
- *
4
- * OpenAI function calling schema for the GitNexus tool.
5
- */
6
- export const GITNEXUS_ASK_TOOL = {
7
- type: 'function',
8
- function: {
9
- name: 'gitnexus_ask',
10
- description: 'Consult GitNexus for a query or code understanding request. Returns related files, dependent symbols, tests to watch, and technical recommendations. This is a read-only tool.',
11
- parameters: {
12
- type: 'object',
13
- properties: {
14
- query: {
15
- type: 'string',
16
- description: 'The query or task description to ask GitNexus about.',
17
- },
18
- },
19
- required: ['query'],
20
- },
21
- },
22
- };
23
- export const GITNEXUS_TOOLS = [GITNEXUS_ASK_TOOL];
24
- //# sourceMappingURL=gitnexus-tools.js.map
@@ -1,7 +0,0 @@
1
- /**
2
- * GitNexus CLI commands
3
- *
4
- * Exposes commands to consult GitNexus and push session summaries.
5
- */
6
- import type { Command } from 'commander';
7
- export declare function registerGitNexusCommands(program: Command): void;
@@ -1,42 +0,0 @@
1
- /**
2
- * GitNexus CLI commands
3
- *
4
- * Exposes commands to consult GitNexus and push session summaries.
5
- */
6
- import { GitNexusTool } from '../../tools/gitnexus-tool.js';
7
- export function registerGitNexusCommands(program) {
8
- const gitnexus = program
9
- .command('gitnexus')
10
- .description('Interact with GitNexus for code understanding and session syncing');
11
- gitnexus
12
- .command('ask')
13
- .description('Consult GitNexus for a query or code understanding request')
14
- .argument('<query>', 'The query or task description to ask GitNexus about')
15
- .action(async (query) => {
16
- try {
17
- const gitNexus = new GitNexusTool();
18
- const result = await gitNexus.ask(query);
19
- console.log(JSON.stringify(result, null, 2));
20
- }
21
- catch (error) {
22
- console.error('Error querying GitNexus:', error);
23
- process.exit(1);
24
- }
25
- });
26
- gitnexus
27
- .command('push-session')
28
- .description('Push the session summary to GitNexus as technical memory')
29
- .argument('<summary>', 'The session summary to push')
30
- .action(async (summary) => {
31
- try {
32
- const gitNexus = new GitNexusTool();
33
- const result = await gitNexus.pushSession(summary);
34
- console.log(JSON.stringify(result, null, 2));
35
- }
36
- catch (error) {
37
- console.error('Error pushing session to GitNexus:', error);
38
- process.exit(1);
39
- }
40
- });
41
- }
42
- //# sourceMappingURL=gitnexus-commands.js.map
@@ -1,9 +0,0 @@
1
- /**
2
- * GitNexus Plugin — Barrel Export
3
- *
4
- * Code graph analysis via GitNexus MCP server integration.
5
- */
6
- export { GitNexusManager, getGitNexusManager, clearGitNexusManagerCache, } from './GitNexusManager.js';
7
- export { GitNexusMCPClient } from './GitNexusMCPClient.js';
8
- export type { GNQueryResult, GNContextResult, GNImpactResult, GNCluster, GNProcess, } from './GitNexusMCPClient.js';
9
- export type { GitNexusStats } from './GitNexusManager.js';
@@ -1,8 +0,0 @@
1
- /**
2
- * GitNexus Plugin — Barrel Export
3
- *
4
- * Code graph analysis via GitNexus MCP server integration.
5
- */
6
- export { GitNexusManager, getGitNexusManager, clearGitNexusManagerCache, } from './GitNexusManager.js';
7
- export { GitNexusMCPClient } from './GitNexusMCPClient.js';
8
- //# sourceMappingURL=index.js.map
@@ -1,18 +0,0 @@
1
- /**
2
- * GitNexus Tool Adapter
3
- *
4
- * ITool-compliant adapter for the GitNexus tool.
5
- */
6
- import type { ToolResult } from '../../types/index.js';
7
- import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
8
- export declare class GitNexusAskTool implements ITool {
9
- readonly name = "gitnexus_ask";
10
- readonly description = "Consult GitNexus for a query or code understanding request. Returns related files, dependent symbols, tests to watch, and technical recommendations. This is a read-only tool.";
11
- execute(input: Record<string, unknown>): Promise<ToolResult>;
12
- getSchema(): ToolSchema;
13
- validate(input: unknown): IValidationResult;
14
- getMetadata(): IToolMetadata;
15
- isAvailable(): boolean;
16
- }
17
- export declare function createGitNexusTools(): ITool[];
18
- export declare function resetGitNexusInstances(): void;