skimpyclaw 0.3.6 → 0.3.9

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 (73) hide show
  1. package/README.md +14 -6
  2. package/dist/__tests__/api.test.js +1 -0
  3. package/dist/__tests__/channels.test.js +1 -1
  4. package/dist/__tests__/code-agents-orchestrator.test.js +74 -7
  5. package/dist/__tests__/code-agents-preflight.test.d.ts +1 -0
  6. package/dist/__tests__/code-agents-preflight.test.js +88 -0
  7. package/dist/__tests__/code-agents-sandbox.test.d.ts +1 -0
  8. package/dist/__tests__/code-agents-sandbox.test.js +163 -0
  9. package/dist/__tests__/code-agents-utils.test.js +12 -1
  10. package/dist/__tests__/context-manager.test.d.ts +1 -0
  11. package/dist/__tests__/context-manager.test.js +236 -0
  12. package/dist/__tests__/package-manager-detection.test.js +5 -5
  13. package/dist/__tests__/setup.test.js +7 -5
  14. package/dist/__tests__/skills.test.js +2 -2
  15. package/dist/__tests__/structured-context.test.d.ts +1 -0
  16. package/dist/__tests__/structured-context.test.js +100 -0
  17. package/dist/__tests__/tools.test.js +65 -3
  18. package/dist/agent.js +4 -5
  19. package/dist/api.js +10 -58
  20. package/dist/audit.js +5 -51
  21. package/dist/channels/telegram/handlers.js +2 -60
  22. package/dist/channels/telegram/index.js +0 -7
  23. package/dist/channels.js +1 -1
  24. package/dist/cli.js +151 -16
  25. package/dist/code-agents/executor.d.ts +9 -4
  26. package/dist/code-agents/executor.js +187 -13
  27. package/dist/code-agents/index.d.ts +1 -1
  28. package/dist/code-agents/index.js +30 -22
  29. package/dist/code-agents/orchestrator.d.ts +8 -2
  30. package/dist/code-agents/orchestrator.js +318 -27
  31. package/dist/code-agents/structured-context.d.ts +7 -0
  32. package/dist/code-agents/structured-context.js +54 -0
  33. package/dist/code-agents/types.d.ts +2 -0
  34. package/dist/code-agents/utils.d.ts +4 -0
  35. package/dist/code-agents/utils.js +38 -2
  36. package/dist/code-agents/worktree.d.ts +40 -0
  37. package/dist/code-agents/worktree.js +215 -0
  38. package/dist/config.d.ts +1 -0
  39. package/dist/config.js +5 -3
  40. package/dist/cron.js +18 -4
  41. package/dist/dashboard/assets/{index-CkonC7Cd.js → index-BoTHPby4.js} +20 -20
  42. package/dist/dashboard/assets/{index-EAg6lqF5.css → index-D4mufvBg.css} +1 -1
  43. package/dist/dashboard/index.html +2 -2
  44. package/dist/discord.js +4 -40
  45. package/dist/exec-approval.js +1 -1
  46. package/dist/file-lock.js +1 -1
  47. package/dist/gateway.js +3 -10
  48. package/dist/providers/anthropic.js +9 -5
  49. package/dist/providers/codex.js +10 -6
  50. package/dist/providers/context-manager.d.ts +22 -0
  51. package/dist/providers/context-manager.js +100 -0
  52. package/dist/providers/openai.js +9 -5
  53. package/dist/providers/types.d.ts +1 -0
  54. package/dist/security.js +9 -0
  55. package/dist/setup.js +122 -27
  56. package/dist/skills.js +9 -2
  57. package/dist/subagent.js +33 -2
  58. package/dist/tools/bash-tool.js +8 -0
  59. package/dist/tools/browser-tool.js +2 -1
  60. package/dist/tools/definitions.d.ts +0 -27
  61. package/dist/tools/definitions.js +0 -18
  62. package/dist/tools/execute-context.d.ts +4 -4
  63. package/dist/tools/file-tools.d.ts +1 -1
  64. package/dist/tools/file-tools.js +1 -1
  65. package/dist/tools.d.ts +5 -5
  66. package/dist/tools.js +87 -98
  67. package/dist/types.d.ts +14 -22
  68. package/dist/usage.d.ts +1 -0
  69. package/dist/usage.js +30 -46
  70. package/dist/utils.d.ts +18 -0
  71. package/dist/utils.js +71 -0
  72. package/dist/voice.js +9 -7
  73. package/package.json +26 -21
package/dist/voice.js CHANGED
@@ -3,6 +3,7 @@ import { existsSync, readFileSync, unlinkSync, readdirSync } from 'fs';
3
3
  import { execSync } from 'child_process';
4
4
  import { basename, dirname, join } from 'path';
5
5
  import { tmpdir } from 'os';
6
+ import { toErrorMessage } from './utils.js';
6
7
  function detectLocalWhisper() {
7
8
  // Prefer whisper.cpp (much faster)
8
9
  try {
@@ -62,7 +63,7 @@ function convertToWav(audioPath) {
62
63
  execSync(`ffmpeg -i "${audioPath}" -ar 16000 -ac 1 -c:a pcm_s16le "${wavPath}" -y`, { encoding: 'utf-8', timeout: 30_000, stdio: ['ignore', 'pipe', 'pipe'] });
63
64
  }
64
65
  catch (err) {
65
- const msg = err instanceof Error ? err.message : String(err);
66
+ const msg = toErrorMessage(err);
66
67
  throw new Error(`ffmpeg conversion failed: ${msg}`);
67
68
  }
68
69
  if (!existsSync(wavPath)) {
@@ -98,7 +99,7 @@ async function transcribeWithWhisperCpp(audioPath, cliPath) {
98
99
  execSync(`"${cliPath}" -m "${WHISPER_CPP_MODEL}" -otxt -of "${outputBase}" -np -nt "${wavPath}"`, { encoding: 'utf-8', timeout: 60_000, stdio: ['ignore', 'pipe', 'pipe'] });
99
100
  }
100
101
  catch (err) {
101
- const msg = err instanceof Error ? err.message : String(err);
102
+ const msg = toErrorMessage(err);
102
103
  console.error(`[voice] whisper-cli failed: ${msg}`);
103
104
  throw new Error(`whisper-cli failed: ${msg}`);
104
105
  }
@@ -150,7 +151,7 @@ async function transcribeWithPythonWhisper(audioPath, cliPath) {
150
151
  execSync(`"${cliPath}" "${audioPath}" --model turbo --output_format txt --output_dir "${outputDir}"`, { encoding: 'utf-8', timeout: 120_000, stdio: ['ignore', 'pipe', 'pipe'] });
151
152
  }
152
153
  catch (err) {
153
- const msg = err instanceof Error ? err.message : String(err);
154
+ const msg = toErrorMessage(err);
154
155
  throw new Error(`Python whisper failed: ${msg}`);
155
156
  }
156
157
  const txtPath = join(outputDir, `${baseName}.txt`);
@@ -374,6 +375,7 @@ export async function synthesizeSpeech(text, config) {
374
375
  throw new Error('No TTS provider configured. Add a provider with a tts config to your voice config.');
375
376
  }
376
377
  const { name, provider } = ttsProvider;
378
+ const macosVoice = config.providers?.macos?.tts?.voice || 'Zoe';
377
379
  // macOS `say` command
378
380
  if (name === 'macos') {
379
381
  const voice = provider.tts?.voice || 'Zoe';
@@ -385,7 +387,7 @@ export async function synthesizeSpeech(text, config) {
385
387
  if (!apiKey) {
386
388
  if (canFallbackToMacOS(config)) {
387
389
  console.warn('[voice] No ElevenLabs API key — falling back to macOS TTS');
388
- return synthesizeWithMacOS(text, config.providers?.macos?.tts?.voice || 'Zoe');
390
+ return synthesizeWithMacOS(text, macosVoice);
389
391
  }
390
392
  throw new Error('No API key configured for ElevenLabs TTS provider.');
391
393
  }
@@ -411,7 +413,7 @@ export async function synthesizeSpeech(text, config) {
411
413
  catch (err) {
412
414
  if (canFallbackToMacOS(config)) {
413
415
  console.warn(`[voice] ElevenLabs failed, falling back to macOS TTS: ${err.message}`);
414
- return synthesizeWithMacOS(text, config.providers?.macos?.tts?.voice || 'Zoe');
416
+ return synthesizeWithMacOS(text, macosVoice);
415
417
  }
416
418
  throw err;
417
419
  }
@@ -421,7 +423,7 @@ export async function synthesizeSpeech(text, config) {
421
423
  if (!apiKey) {
422
424
  if (canFallbackToMacOS(config)) {
423
425
  console.warn(`[voice] No API key for "${name}" — falling back to macOS TTS`);
424
- return synthesizeWithMacOS(text, config.providers?.macos?.tts?.voice || 'Zoe');
426
+ return synthesizeWithMacOS(text, macosVoice);
425
427
  }
426
428
  throw new Error(`No API key configured for TTS provider "${name}".`);
427
429
  }
@@ -445,7 +447,7 @@ export async function synthesizeSpeech(text, config) {
445
447
  catch (err) {
446
448
  if (canFallbackToMacOS(config)) {
447
449
  console.warn(`[voice] ${name} TTS failed, falling back to macOS TTS: ${err.message}`);
448
- return synthesizeWithMacOS(text, config.providers?.macos?.tts?.voice || 'Zoe');
450
+ return synthesizeWithMacOS(text, macosVoice);
449
451
  }
450
452
  throw err;
451
453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skimpyclaw",
3
- "version": "0.3.6",
3
+ "version": "0.3.9",
4
4
  "description": "Lightweight personal AI assistant with Telegram and Discord integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,25 @@
16
16
  "README.md",
17
17
  "LICENSE"
18
18
  ],
19
+ "scripts": {
20
+ "cli": "tsx src/cli.ts",
21
+ "start": "tsx src/index.ts",
22
+ "dev": "tsx watch src/index.ts",
23
+ "dashboard:dev": "pnpm --dir web/dashboard dev",
24
+ "dashboard:build": "pnpm --dir web/dashboard install --frozen-lockfile && pnpm --dir web/dashboard build",
25
+ "docs:dev": "pnpm --dir docs dev",
26
+ "docs:build": "pnpm --dir docs install --frozen-lockfile && pnpm --dir docs build",
27
+ "docs:preview": "pnpm --dir docs preview",
28
+ "setup": "tsx src/setup.ts",
29
+ "onboard": "tsx src/cli.ts onboard",
30
+ "build": "tsc && pnpm dashboard:build",
31
+ "release:check": "pnpm build && pnpm test",
32
+ "release:local": "bash ./scripts/release.sh",
33
+ "lint": "eslint \"src/**/*.ts\"",
34
+ "typecheck": "tsc --noEmit",
35
+ "test": "vitest run",
36
+ "ci": "pnpm run lint && pnpm run typecheck && pnpm run test"
37
+ },
19
38
  "dependencies": {
20
39
  "@anthropic-ai/sdk": "^0.52.0",
21
40
  "@grammyjs/runner": "^2.0.3",
@@ -37,6 +56,11 @@
37
56
  "openai": "^4.47.0",
38
57
  "playwright": "^1.49.0"
39
58
  },
59
+ "pnpm": {
60
+ "onlyBuiltDependencies": [
61
+ "esbuild"
62
+ ]
63
+ },
40
64
  "devDependencies": {
41
65
  "@eslint/js": "^9.39.2",
42
66
  "@types/node": "^20.11.0",
@@ -46,24 +70,5 @@
46
70
  "typescript": "^5.4.0",
47
71
  "typescript-eslint": "^8.54.0",
48
72
  "vitest": "^4.0.18"
49
- },
50
- "scripts": {
51
- "cli": "tsx src/cli.ts",
52
- "start": "tsx src/index.ts",
53
- "dev": "tsx watch src/index.ts",
54
- "dashboard:dev": "pnpm --dir web/dashboard dev",
55
- "dashboard:build": "pnpm --dir web/dashboard install --frozen-lockfile && pnpm --dir web/dashboard build",
56
- "docs:dev": "pnpm --dir docs dev",
57
- "docs:build": "pnpm --dir docs install --frozen-lockfile && pnpm --dir docs build",
58
- "docs:preview": "pnpm --dir docs preview",
59
- "setup": "tsx src/setup.ts",
60
- "onboard": "tsx src/cli.ts onboard",
61
- "build": "tsc && pnpm dashboard:build",
62
- "release:check": "pnpm build && pnpm test",
63
- "release:local": "bash ./scripts/release.sh",
64
- "lint": "eslint \"src/**/*.ts\"",
65
- "typecheck": "tsc --noEmit",
66
- "test": "vitest run",
67
- "ci": "pnpm run lint && pnpm run typecheck && pnpm run test"
68
73
  }
69
- }
74
+ }