@dashclaw/cli 0.1.1 → 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 (2) hide show
  1. package/bin/dashclaw.js +20 -0
  2. package/package.json +2 -2
package/bin/dashclaw.js CHANGED
@@ -158,6 +158,25 @@ async function cmdApprovals() {
158
158
 
159
159
  await fetchPending();
160
160
 
161
+ // Open SSE stream for live push of new approval requests
162
+ let stream = null;
163
+ try {
164
+ stream = claw.events()
165
+ .on('guard.decision.created', (data) => {
166
+ if (data.decision !== 'require_approval') return;
167
+ const exists = items.some((it) => (it.action_id || it.id) === data.action_id);
168
+ if (exists) return;
169
+ items.push(data);
170
+ render();
171
+ })
172
+ .on('error', () => {
173
+ moveCursor(items.length + 6, 1);
174
+ process.stdout.write(dim(' SSE stream error — live push unavailable, use R to refresh') + '\n');
175
+ });
176
+ } catch (_) {
177
+ // SSE unavailable — inbox still works via manual refresh
178
+ }
179
+
161
180
  // Set up raw mode for interactive input
162
181
  if (!process.stdin.isTTY) {
163
182
  console.error('Error: Interactive mode requires a TTY. Use dashclaw approve/deny for non-interactive use.');
@@ -171,6 +190,7 @@ async function cmdApprovals() {
171
190
 
172
191
  // Ensure cleanup on exit
173
192
  function cleanup() {
193
+ if (stream) stream.close();
174
194
  showCursor();
175
195
  if (process.stdin.isTTY) process.stdin.setRawMode(false);
176
196
  process.stdout.write('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashclaw/cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "DashClaw terminal approval client",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "files": ["bin/", "lib/"],
10
10
  "engines": { "node": ">=18.0.0" },
11
11
  "dependencies": {
12
- "dashclaw": "^2.2.0"
12
+ "dashclaw": "^2.2.1"
13
13
  },
14
14
  "license": "MIT",
15
15
  "publishConfig": {