claude-simple 0.1.0 → 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 (44) hide show
  1. package/client.js +25 -1
  2. package/dist/app.0.2.0.min.js +868 -0
  3. package/dist/highlight.min.js +448 -430
  4. package/dist/index.html +2 -2
  5. package/dist/style.0.2.0.min.css +1182 -0
  6. package/package.json +1 -1
  7. package/public/agent-panel.js +44 -0
  8. package/public/api.js +61 -10
  9. package/public/app.js +4 -0
  10. package/public/chat.js +338 -31
  11. package/public/files.js +22 -30
  12. package/public/git.js +21 -17
  13. package/public/icons/icon-180.png +0 -0
  14. package/public/icons/icon-192.png +0 -0
  15. package/public/icons/icon-512.png +0 -0
  16. package/public/icons/icon-maskable-512.png +0 -0
  17. package/public/index.html +16 -3
  18. package/public/lib.js +7 -2
  19. package/public/manifest.webmanifest +36 -0
  20. package/public/offline.html +33 -0
  21. package/public/pwa.js +78 -0
  22. package/public/shell/boot.js +3 -0
  23. package/public/shell/hub.js +4 -2
  24. package/public/shell/notes.js +93 -31
  25. package/public/shell/session-list.js +29 -10
  26. package/public/shell/session-nav.js +7 -2
  27. package/public/shell/templates.js +11 -3
  28. package/public/shell.js +101 -8
  29. package/public/state.js +13 -2
  30. package/public/style.css +135 -3
  31. package/public/sw.js +104 -0
  32. package/public/terminal.js +22 -0
  33. package/public/wake-lock.js +45 -0
  34. package/src/agents/claude.js +108 -10
  35. package/src/agents/codex.js +1 -1
  36. package/src/agents/grok.js +40 -32
  37. package/src/agents/meta-agent.js +40 -1
  38. package/src/agents/stream-batch.js +62 -0
  39. package/src/app.js +304 -41
  40. package/src/runtime/approvals.js +67 -0
  41. package/src/runtime/outbox.js +143 -0
  42. package/src/runtime/protocol.js +224 -0
  43. package/dist/app.0.1.0.min.js +0 -825
  44. package/dist/style.0.1.0.min.css +0 -1050
package/client.js CHANGED
@@ -35,6 +35,7 @@ function connect() {
35
35
  console.log(`[client] Connecting to gateway ${GATEWAY_URL} ...`);
36
36
  controlWs = new WebSocket(GATEWAY_URL, {
37
37
  headers: { 'x-machine-token': MACHINE_TOKEN },
38
+ perMessageDeflate: true,
38
39
  });
39
40
 
40
41
  controlWs.on('open', () => {
@@ -60,12 +61,35 @@ function connect() {
60
61
  headers: { ...msg.headers, host: `127.0.0.1:${LOCAL_PORT}` },
61
62
  body: msg.body || undefined,
62
63
  });
64
+ const headers = Object.fromEntries(res.headers.entries());
65
+ const contentType = res.headers.get('content-type') || '';
66
+
67
+ // SSE (and any other body-less-until-done response) is forwarded as
68
+ // it arrives instead of buffered in full, so remote/hub viewers get
69
+ // real-time streaming instead of one lump delivered at the end.
70
+ if (contentType.includes('text/event-stream') && res.body) {
71
+ sendControl({ type: 'http-res-start', reqId: msg.reqId, status: res.status, headers });
72
+ const reader = res.body.getReader();
73
+ const decoder = new TextDecoder();
74
+ for (;;) {
75
+ const { done, value } = await reader.read();
76
+ if (done) break;
77
+ sendControl({ type: 'http-chunk', reqId: msg.reqId, data: decoder.decode(value, { stream: true }) });
78
+ }
79
+ // Flush a possibly incomplete UTF-8 code point held by TextDecoder
80
+ // before terminating the stream (SSE payloads often contain Chinese).
81
+ const tail = decoder.decode();
82
+ if (tail) sendControl({ type: 'http-chunk', reqId: msg.reqId, data: tail });
83
+ sendControl({ type: 'http-end', reqId: msg.reqId });
84
+ return;
85
+ }
86
+
63
87
  const body = await res.text();
64
88
  sendControl({
65
89
  type: 'http-res',
66
90
  reqId: msg.reqId,
67
91
  status: res.status,
68
- headers: Object.fromEntries(res.headers.entries()),
92
+ headers,
69
93
  body,
70
94
  });
71
95
  } catch (e) {