pi-durable-bot 0.0.0-stage → 0.2.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +279 -2
  3. package/dist/agent/agent.js +244 -0
  4. package/dist/agent/agent.js.map +1 -0
  5. package/dist/agent/judge.js +78 -0
  6. package/dist/agent/judge.js.map +1 -0
  7. package/dist/agent/models.js +72 -0
  8. package/dist/agent/models.js.map +1 -0
  9. package/dist/bot/bot.js +351 -0
  10. package/dist/bot/bot.js.map +1 -0
  11. package/dist/bot/control.js +67 -0
  12. package/dist/bot/control.js.map +1 -0
  13. package/dist/bot/definition.js +123 -0
  14. package/dist/bot/definition.js.map +1 -0
  15. package/dist/bot/machine.js +26 -0
  16. package/dist/bot/machine.js.map +1 -0
  17. package/dist/bot/prompt.js +169 -0
  18. package/dist/bot/prompt.js.map +1 -0
  19. package/dist/bot/timers.js +2 -0
  20. package/dist/bot/timers.js.map +1 -0
  21. package/dist/channels/load.js +21 -0
  22. package/dist/channels/load.js.map +1 -0
  23. package/dist/channels/slack/index.js +518 -0
  24. package/dist/channels/slack/index.js.map +1 -0
  25. package/dist/channels/slack/sdk.js +55 -0
  26. package/dist/channels/slack/sdk.js.map +1 -0
  27. package/dist/channels/terminal/index.js +19 -0
  28. package/dist/channels/terminal/index.js.map +1 -0
  29. package/dist/channels/test/index.js +197 -0
  30. package/dist/channels/test/index.js.map +1 -0
  31. package/dist/cli/agent.js +78 -0
  32. package/dist/cli/agent.js.map +1 -0
  33. package/dist/cli/ai.js +126 -0
  34. package/dist/cli/ai.js.map +1 -0
  35. package/dist/cli/bots.js +57 -0
  36. package/dist/cli/bots.js.map +1 -0
  37. package/dist/cli/chat.js +157 -0
  38. package/dist/cli/chat.js.map +1 -0
  39. package/dist/cli/control.js +52 -0
  40. package/dist/cli/control.js.map +1 -0
  41. package/dist/cli/init.js +104 -0
  42. package/dist/cli/init.js.map +1 -0
  43. package/dist/cli/pots.js +75 -0
  44. package/dist/cli/pots.js.map +1 -0
  45. package/dist/cli/service.js +228 -0
  46. package/dist/cli/service.js.map +1 -0
  47. package/dist/cli/trace.js +172 -0
  48. package/dist/cli/trace.js.map +1 -0
  49. package/dist/core/channel.js +52 -0
  50. package/dist/core/channel.js.map +1 -0
  51. package/dist/core/env-file.js +22 -0
  52. package/dist/core/env-file.js.map +1 -0
  53. package/dist/core/home.js +16 -0
  54. package/dist/core/home.js.map +1 -0
  55. package/dist/core/judge.js +2 -0
  56. package/dist/core/judge.js.map +1 -0
  57. package/dist/core/sql.js +2 -0
  58. package/dist/core/sql.js.map +1 -0
  59. package/dist/core/wake.js +2 -0
  60. package/dist/core/wake.js.map +1 -0
  61. package/dist/gateway/channels.js +69 -0
  62. package/dist/gateway/channels.js.map +1 -0
  63. package/dist/gateway/config.js +4 -0
  64. package/dist/gateway/config.js.map +1 -0
  65. package/dist/gateway/errors.js +54 -0
  66. package/dist/gateway/errors.js.map +1 -0
  67. package/dist/gateway/gateway.js +239 -0
  68. package/dist/gateway/gateway.js.map +1 -0
  69. package/dist/gateway/inbox.js +80 -0
  70. package/dist/gateway/inbox.js.map +1 -0
  71. package/dist/gateway/log.js +251 -0
  72. package/dist/gateway/log.js.map +1 -0
  73. package/dist/gateway/outbox.js +77 -0
  74. package/dist/gateway/outbox.js.map +1 -0
  75. package/dist/gateway/telemetry.js +131 -0
  76. package/dist/gateway/telemetry.js.map +1 -0
  77. package/dist/gateway/timers.js +121 -0
  78. package/dist/gateway/timers.js.map +1 -0
  79. package/dist/gateway/tracing.js +187 -0
  80. package/dist/gateway/tracing.js.map +1 -0
  81. package/dist/gateway/waker.js +226 -0
  82. package/dist/gateway/waker.js.map +1 -0
  83. package/dist/main.js +148 -0
  84. package/dist/main.js.map +1 -0
  85. package/docs/channels/slack-app-manifest.yaml +54 -0
  86. package/docs/channels/slack.md +22 -0
  87. package/package.json +61 -4
@@ -0,0 +1,54 @@
1
+ # pi-durable-bot · Slack app manifest
2
+ # Use: api.slack.com/apps, Create New App, From an app manifest, pick the workspace, paste this file.
3
+ # Based on the manifest recommended in the Vercel Chat SDK Slack adapter README, changed to socket mode, with DM and file scopes added.
4
+ # Change the name to your coworker's name before you paste it.
5
+ # This file holds no tokens. Never put tokens in this repository.
6
+ display_information:
7
+ name: Pots
8
+ description: A coworker on your team
9
+ features:
10
+ app_home:
11
+ home_tab_enabled: false
12
+ messages_tab_enabled: true
13
+ messages_tab_read_only_enabled: false
14
+ bot_user:
15
+ display_name: pots
16
+ always_online: true
17
+ oauth_config:
18
+ scopes:
19
+ bot:
20
+ - app_mentions:read
21
+ - channels:history
22
+ - channels:read
23
+ - chat:write
24
+ - files:read
25
+ - files:write
26
+ - groups:history
27
+ - groups:read
28
+ - im:history
29
+ - im:read
30
+ - im:write
31
+ - mpim:history
32
+ - mpim:read
33
+ - reactions:read
34
+ - reactions:write
35
+ - users:read
36
+ user:
37
+ - chat:write
38
+ - im:write
39
+ settings:
40
+ event_subscriptions:
41
+ bot_events:
42
+ - app_mention
43
+ - message.channels
44
+ - message.groups
45
+ - message.im
46
+ - message.mpim
47
+ - member_joined_channel
48
+ - reaction_added
49
+ - reaction_removed
50
+ interactivity:
51
+ is_enabled: true
52
+ org_deploy_enabled: false
53
+ socket_mode_enabled: true
54
+ token_rotation_enabled: false
@@ -0,0 +1,22 @@
1
+ # Connect Slack
2
+
3
+ Written for a bot that connects itself; a person can follow it too. The app uses socket mode, so the computer needs no public address.
4
+
5
+ 1. Open https://api.slack.com/apps?new_app=1 in the browser on your screen. If Slack asks to sign in, ask the person to sign in there; they can take over the screen. If you have no screen, ask the person to do steps 1 to 4 on their own computer and to write the tokens to the file in step 5 themselves.
6
+ 2. Choose **From a manifest**, pick the workspace, and paste [slack-app-manifest.yaml](slack-app-manifest.yaml). Change `name` and `display_name` to your own name first. Create the app.
7
+ 3. **Basic Information → App-Level Tokens → Generate Token and Scopes**: add the scope `connections:write` and generate. This is the app token (`xapp-…`).
8
+ 4. **Install App → Install to workspace → Allow**. Some workspaces need an admin to approve; then ask the person. Copy the **Bot User OAuth Token** (`xoxb-…`).
9
+ 5. Write both tokens to `slack.env` in the secrets folder (`~/.pots/secrets/`), readable only by this user:
10
+ ```sh
11
+ SLACK_APP_TOKEN=xapp-...
12
+ SLACK_BOT_TOKEN=xoxb-...
13
+ ```
14
+ Do not put tokens in a chat message, a log or any other file.
15
+ 6. Add the channel to `channels` in your `bot.json`:
16
+ ```json
17
+ { "id": "slack", "type": "slack", "secrets": "~/.pots/secrets/slack.env" }
18
+ ```
19
+ It connects within a few seconds. `pots status` lists it; if it fails, the reason is in `bot.json.error`.
20
+ 7. You join only the places you are invited to. Ask the person to invite you to the right channels (`/invite @yourname`) or to send you a DM in Slack.
21
+
22
+ A second Slack workspace is a second channel entry with its own `id` (for example `slack-acme`) and its own env file.
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "pi-durable-bot",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Open-source AI coworkers that read every channel, decide what matters, and act on their own computer. Self-hosted, any model.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://github.com/Crokily/pi-durable-bot#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Crokily/pi-durable-bot.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Crokily/pi-durable-bot/issues"
14
+ },
15
+ "keywords": [
16
+ "ai-agent",
17
+ "ai-coworker",
18
+ "slack-bot",
19
+ "self-hosted",
20
+ "pi-durable",
21
+ "chat-sdk"
22
+ ],
23
+ "bin": {
24
+ "pots": "dist/cli/pots.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "docs/channels",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "engines": {
33
+ "node": ">=24"
34
+ },
35
+ "scripts": {
36
+ "start": "node src/cli/pots.ts start",
37
+ "pots": "node src/cli/pots.ts",
38
+ "check": "tsc --noEmit",
39
+ "test": "vitest run",
40
+ "tla": "node scripts/tlc.ts",
41
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
42
+ "prepare": "npm run build"
43
+ },
44
+ "dependencies": {
45
+ "@chat-adapter/slack": "4.43.0",
46
+ "@chat-adapter/state-memory": "4.43.0",
47
+ "@earendil-works/chord": "1.4.0",
48
+ "@earendil-works/pi-ai": "1.4.0",
49
+ "@earendil-works/pi-coding-agent": "1.4.0",
50
+ "@earendil-works/pi-durable": "1.4.0",
51
+ "@earendil-works/pi-telemetry": "1.4.0",
52
+ "@effect/platform-node": "4.0.7",
53
+ "chat": "4.43.0",
54
+ "effect": "4.0.7"
55
+ },
56
+ "devDependencies": {
57
+ "@effect/vitest": "4.0.7",
58
+ "@types/node": "26.6.5",
59
+ "fast-check": "4.10.2",
60
+ "typescript": "7.0.2",
61
+ "vitest": "5.0.5"
62
+ }
63
+ }