opencode-claw 0.1.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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +316 -0
  3. package/dist/channels/router.d.ts +18 -0
  4. package/dist/channels/router.js +188 -0
  5. package/dist/channels/slack.d.ts +4 -0
  6. package/dist/channels/slack.js +87 -0
  7. package/dist/channels/telegram.d.ts +4 -0
  8. package/dist/channels/telegram.js +79 -0
  9. package/dist/channels/types.d.ts +27 -0
  10. package/dist/channels/types.js +1 -0
  11. package/dist/channels/whatsapp.d.ts +4 -0
  12. package/dist/channels/whatsapp.js +136 -0
  13. package/dist/cli.d.ts +2 -0
  14. package/dist/cli.js +6 -0
  15. package/dist/compat.d.ts +12 -0
  16. package/dist/compat.js +63 -0
  17. package/dist/config/loader.d.ts +2 -0
  18. package/dist/config/loader.js +57 -0
  19. package/dist/config/schema.d.ts +482 -0
  20. package/dist/config/schema.js +108 -0
  21. package/dist/config/types.d.ts +14 -0
  22. package/dist/config/types.js +1 -0
  23. package/dist/cron/scheduler.d.ts +16 -0
  24. package/dist/cron/scheduler.js +113 -0
  25. package/dist/exports.d.ts +9 -0
  26. package/dist/exports.js +4 -0
  27. package/dist/health/server.d.ts +17 -0
  28. package/dist/health/server.js +68 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +127 -0
  31. package/dist/memory/factory.d.ts +3 -0
  32. package/dist/memory/factory.js +14 -0
  33. package/dist/memory/openviking.d.ts +5 -0
  34. package/dist/memory/openviking.js +138 -0
  35. package/dist/memory/plugin-entry.d.ts +3 -0
  36. package/dist/memory/plugin-entry.js +11 -0
  37. package/dist/memory/plugin.d.ts +5 -0
  38. package/dist/memory/plugin.js +63 -0
  39. package/dist/memory/txt.d.ts +2 -0
  40. package/dist/memory/txt.js +137 -0
  41. package/dist/memory/types.d.ts +36 -0
  42. package/dist/memory/types.js +1 -0
  43. package/dist/outbox/drainer.d.ts +8 -0
  44. package/dist/outbox/drainer.js +140 -0
  45. package/dist/outbox/writer.d.ts +15 -0
  46. package/dist/outbox/writer.js +29 -0
  47. package/dist/sessions/manager.d.ts +20 -0
  48. package/dist/sessions/manager.js +68 -0
  49. package/dist/sessions/persistence.d.ts +4 -0
  50. package/dist/sessions/persistence.js +24 -0
  51. package/dist/utils/logger.d.ts +8 -0
  52. package/dist/utils/logger.js +33 -0
  53. package/dist/utils/reconnect.d.ts +16 -0
  54. package/dist/utils/reconnect.js +54 -0
  55. package/dist/utils/shutdown.d.ts +5 -0
  56. package/dist/utils/shutdown.js +27 -0
  57. package/opencode-claw.example.json +71 -0
  58. package/package.json +77 -0
@@ -0,0 +1,71 @@
1
+ {
2
+ "opencode": {
3
+ "port": 0
4
+ },
5
+ "memory": {
6
+ "backend": "txt",
7
+ "txt": {
8
+ "directory": "./data/memory"
9
+ }
10
+ },
11
+ "channels": {
12
+ "telegram": {
13
+ "enabled": true,
14
+ "botToken": "${TELEGRAM_BOT_TOKEN}",
15
+ "allowlist": ["your_telegram_username"],
16
+ "mode": "polling",
17
+ "rejectionBehavior": "ignore"
18
+ },
19
+ "slack": {
20
+ "enabled": false,
21
+ "botToken": "${SLACK_BOT_TOKEN}",
22
+ "appToken": "${SLACK_APP_TOKEN}",
23
+ "mode": "socket",
24
+ "rejectionBehavior": "ignore"
25
+ },
26
+ "whatsapp": {
27
+ "enabled": false,
28
+ "allowlist": ["5511999887766"],
29
+ "authDir": "./data/whatsapp/auth",
30
+ "debounceMs": 1000,
31
+ "rejectionBehavior": "ignore"
32
+ }
33
+ },
34
+ "cron": {
35
+ "enabled": false,
36
+ "defaultTimeoutMs": 300000,
37
+ "jobs": [
38
+ {
39
+ "id": "daily-standup",
40
+ "schedule": "0 9 * * 1-5",
41
+ "description": "Morning standup briefing",
42
+ "prompt": "Check my Linear board for P1 and P2 issues assigned to me. Summarize what needs attention today.",
43
+ "reportTo": {
44
+ "channel": "telegram",
45
+ "peerId": "your_telegram_username"
46
+ },
47
+ "enabled": true,
48
+ "timeoutMs": 300000
49
+ }
50
+ ]
51
+ },
52
+ "sessions": {
53
+ "titleTemplate": "{{channel}}:{{peerId}}",
54
+ "persistPath": "./data/sessions.json"
55
+ },
56
+ "outbox": {
57
+ "directory": "./data/outbox",
58
+ "pollIntervalMs": 500,
59
+ "maxAttempts": 3
60
+ },
61
+ "router": {
62
+ "timeoutMs": 300000
63
+ },
64
+ "health": {
65
+ "enabled": false,
66
+ "port": 9090
67
+ },
68
+ "log": {
69
+ "level": "info"
70
+ }
71
+ }
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "opencode-claw",
3
+ "version": "0.1.0",
4
+ "description": "Wrap OpenCode with persistent memory, messaging channels, and cron jobs",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/exports.js",
8
+ "types": "./dist/exports.d.ts",
9
+ "bin": {
10
+ "opencode-claw": "./dist/cli.js"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/exports.js",
15
+ "types": "./dist/exports.d.ts"
16
+ },
17
+ "./plugin": {
18
+ "import": "./dist/memory/plugin-entry.js",
19
+ "types": "./dist/memory/plugin-entry.d.ts"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE",
26
+ "opencode-claw.example.json"
27
+ ],
28
+ "keywords": [
29
+ "opencode",
30
+ "ai",
31
+ "assistant",
32
+ "telegram",
33
+ "slack",
34
+ "whatsapp",
35
+ "memory",
36
+ "cron"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/jinkoso/opencode-claw.git"
41
+ },
42
+ "homepage": "https://github.com/jinkoso/opencode-claw#readme",
43
+ "bugs": {
44
+ "url": "https://github.com/jinkoso/opencode-claw/issues"
45
+ },
46
+ "engines": {
47
+ "node": ">=20"
48
+ },
49
+ "scripts": {
50
+ "start": "bun run src/index.ts",
51
+ "build": "tsc --build",
52
+ "prepublishOnly": "npm run build",
53
+ "typecheck": "bun x tsc --noEmit",
54
+ "typecheck:test": "bun x tsc --noEmit -p tsconfig.test.json",
55
+ "lint": "bun x biome check src/ test/",
56
+ "format": "bun x biome format --write src/",
57
+ "test": "bun test",
58
+ "test:e2e": "bun test test/"
59
+ },
60
+ "dependencies": {
61
+ "@opencode-ai/sdk": "^1.2.10",
62
+ "@opencode-ai/plugin": "^1.2.10",
63
+ "grammy": "^1.35.0",
64
+ "@grammyjs/runner": "^2.0.3",
65
+ "@slack/bolt": "^4.3.0",
66
+ "@whiskeysockets/baileys": "^6.7.16",
67
+ "node-cron": "^3.0.3",
68
+ "zod": "^3.24.0"
69
+ },
70
+ "devDependencies": {
71
+ "typescript": "^5.7.0",
72
+ "@types/bun": "^1.2.0",
73
+ "@types/node": "^20.0.0",
74
+ "@types/node-cron": "^3.0.11",
75
+ "@biomejs/biome": "^1.9.0"
76
+ }
77
+ }