clankie 0.2.1 → 0.2.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.
package/README.md CHANGED
@@ -15,31 +15,40 @@ A minimal AI assistant that lives in Slack. Built on [pi](https://github.com/bad
15
15
 
16
16
  ### 1. Install Dependencies
17
17
 
18
- Requires [Bun](https://bun.sh):
18
+ **Runtime:** [Node.js](https://nodejs.org) v22.6.0+ (for native TypeScript support)
19
+ **Build:** [Bun](https://bun.sh) (for faster package installation and web-ui builds)
19
20
 
20
21
  ```bash
21
- # macOS/Linux
22
- curl -fsSL https://bun.sh/install | bash
22
+ # Check Node version
23
+ node --version # Should be >= v22.6.0
23
24
 
24
- # Verify
25
+ # Install Bun (if not already installed)
26
+ curl -fsSL https://bun.sh/install | bash
25
27
  bun --version
26
28
  ```
27
29
 
28
- ### 2. Clone and Install
30
+ **Don't have Node.js?** Install via [mise](https://mise.jdx.dev) (recommended) or [nvm](https://github.com/nvm-sh/nvm).
31
+
32
+ ### 2. Quick Install via npm
29
33
 
30
34
  ```bash
31
- git clone https://github.com/thiagovarela/clankie
32
- cd clankie
33
- bun install
35
+ npm install -g clankie
34
36
  ```
35
37
 
36
- ### 3. Link Globally (Optional)
38
+ This installs clankie globally. Now `clankie` is available from anywhere.
39
+
40
+ ### 3. Or: Install from Source
37
41
 
38
42
  ```bash
39
- bun link
43
+ git clone https://github.com/thiagovarela/clankie
44
+ cd clankie
45
+ npm install
46
+ npm link
40
47
  ```
41
48
 
42
- Now `clankie` is available from anywhere. If you skip this, use `bun run src/cli.ts` instead of `clankie`.
49
+ Now `clankie` is available from anywhere. If you skip `npm link`, use `node --experimental-strip-types src/cli.ts` instead of `clankie`.
50
+
51
+ **Note:** Bun is used for faster package installation and building the web-ui. The runtime requires Node.js v22.6.0+.
43
52
 
44
53
  ## Slack Setup
45
54
 
@@ -287,16 +296,22 @@ Logs are stored in `~/.clankie/logs/daemon.log`.
287
296
  ## Development
288
297
 
289
298
  ```bash
290
- # Run directly with Bun (no build step)
291
- bun run src/cli.ts chat
292
- bun run src/cli.ts send "hello"
299
+ # Run directly with Node.js (no build step, native TypeScript support)
300
+ node --experimental-strip-types src/cli.ts chat
301
+ node --experimental-strip-types src/cli.ts send "hello"
302
+
303
+ # Or use npm scripts
304
+ npm run dev -- chat
305
+ npm run dev -- send "hello"
293
306
 
294
307
  # Code quality checks
295
- bun run check # Run linter
296
- bun run check:fix # Auto-fix issues
297
- bun run format # Format code
308
+ npm run check # Run linter
309
+ npm run check:fix # Auto-fix issues
310
+ npm run format # Format code
298
311
  ```
299
312
 
313
+ **Note:** Bun is used for package installation and building the web-ui. The runtime requires Node.js v22.6.0+ with native TypeScript support.
314
+
300
315
  ## Troubleshooting
301
316
 
302
317
  ### Bot doesn't respond in threads
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clankie",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A minimal personal AI assistant built on pi's SDK",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,21 +13,30 @@
13
13
  "README.md"
14
14
  ],
15
15
  "scripts": {
16
- "dev": "bun run src/cli.ts",
17
- "build:web-ui": "cd web-ui && bun install --frozen-lockfile && bun run build && cd .. && rm -rf web-ui-dist && cp -r web-ui/.output/public web-ui-dist",
16
+ "dev": "node --experimental-strip-types src/cli.ts",
17
+ "build:web-ui": "cd web-ui && bun install && bun run build && cd .. && rm -rf web-ui-dist && cp -r web-ui/.output/public web-ui-dist",
18
18
  "check": "biome check .",
19
19
  "check:fix": "biome check --fix .",
20
20
  "format": "biome format --write ."
21
21
  },
22
+ "engines": {
23
+ "node": ">=22.6.0"
24
+ },
22
25
  "dependencies": {
26
+ "@hono/node-server": "^1.19.9",
27
+ "@hono/node-ws": "^1.3.0",
23
28
  "@mariozechner/pi-ai": "^0.54.0",
24
29
  "@mariozechner/pi-coding-agent": "^0.54.0",
25
30
  "@slack/socket-mode": "^2.0.0",
26
31
  "@slack/web-api": "^7.0.0",
27
- "json5": "^2.2.3"
32
+ "hono": "^4.12.3",
33
+ "json5": "^2.2.3",
34
+ "ws": "^8.18.0"
28
35
  },
29
36
  "devDependencies": {
30
37
  "@biomejs/biome": "^2.4.4",
31
- "@types/bun": "latest"
38
+ "@types/node": "^22.10.2",
39
+ "@types/ws": "^8.5.13",
40
+ "tsx": "^4.21.0"
32
41
  }
33
42
  }
package/src/agent.ts CHANGED
@@ -14,10 +14,12 @@ import {
14
14
  type CreateAgentSessionResult,
15
15
  createAgentSession,
16
16
  DefaultResourceLoader,
17
+ type ExtensionFactory,
17
18
  ModelRegistry,
18
19
  SessionManager,
19
20
  } from "@mariozechner/pi-coding-agent";
20
21
  import { getAgentDir, getAuthPath, getWorkspace, loadConfig } from "./config.ts";
22
+ import { createWorkspaceJailExtension } from "./extensions/workspace-jail.ts";
21
23
 
22
24
  export interface SessionOptions {
23
25
  /**
@@ -59,10 +61,19 @@ export async function createSession(options: SessionOptions = {}): Promise<Creat
59
61
  const authStorage = AuthStorage.create(getAuthPath());
60
62
  const modelRegistry = new ModelRegistry(authStorage);
61
63
 
64
+ // Build extension factories (workspace jail if enabled)
65
+ const extensionFactories: ExtensionFactory[] = [];
66
+ const restrictToWorkspace = config.agent?.restrictToWorkspace ?? true; // default: enabled
67
+ if (restrictToWorkspace) {
68
+ const allowedPaths = config.agent?.allowedPaths ?? [];
69
+ extensionFactories.push(createWorkspaceJailExtension(cwd, allowedPaths));
70
+ }
71
+
62
72
  // DefaultResourceLoader with standard pi discovery
63
73
  const loader = new DefaultResourceLoader({
64
74
  cwd,
65
75
  agentDir,
76
+ extensionFactories,
66
77
  });
67
78
  await loader.reload();
68
79
 
@@ -46,6 +46,7 @@ export interface SlackChannelOptions {
46
46
 
47
47
  export class SlackChannel implements Channel {
48
48
  readonly name = "slack";
49
+ private options: SlackChannelOptions;
49
50
  private socketClient: SocketModeClient;
50
51
  private webClient: WebClient;
51
52
  private allowedUsers: Set<string>;
@@ -55,7 +56,8 @@ export class SlackChannel implements Channel {
55
56
  /** Threads where bot has been @mentioned - Map<threadId, timestamp> for TTL cleanup */
56
57
  private activeThreads: Map<string, number> = new Map();
57
58
 
58
- constructor(private options: SlackChannelOptions) {
59
+ constructor(options: SlackChannelOptions) {
60
+ this.options = options;
59
61
  this.socketClient = new SocketModeClient({
60
62
  appToken: options.appToken,
61
63
  // biome-ignore lint/suspicious/noExplicitAny: Slack SDK logLevel type is not exported