very-happy-cli 0.2.156 → 0.2.158

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 (55) hide show
  1. package/dist/{AcpBackend-BHe1_F1h.cjs → AcpBackend-DIDRig5G.cjs} +2 -2
  2. package/dist/{AcpBackend-C3nc1u-s.mjs → AcpBackend-vDVLHuYJ.mjs} +2 -2
  3. package/dist/{AcpSessionManager-BVxkQnNf.cjs → AcpSessionManager-C44U99CC.cjs} +1 -1
  4. package/dist/{AcpSessionManager-dN3k1LbI.mjs → AcpSessionManager-CmRjfhn3.mjs} +1 -1
  5. package/dist/{agentGuidance-C604n0Zq.mjs → agentGuidance-CrR9l62U.mjs} +562 -30
  6. package/dist/{agentGuidance-C-CmV03f.cjs → agentGuidance-DwOWbX55.cjs} +581 -29
  7. package/dist/{agentHome-D2XGsoqs.mjs → agentHome-CyLmGH5L.mjs} +2 -2
  8. package/dist/{agentHome-CmIJNV7f.cjs → agentHome-Dw8Jx_CJ.cjs} +2 -2
  9. package/dist/{auto-B1I6G_Nf.mjs → auto-BlMZPwOk.mjs} +19 -10
  10. package/dist/{auto-CMDq4oIu.cjs → auto-DZbNcTXx.cjs} +19 -10
  11. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  12. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  13. package/dist/{config-BkTu25bH.mjs → config-BtPArqRH.mjs} +4 -4
  14. package/dist/{config-BYHSRY2E.cjs → config-DG84bjwF.cjs} +4 -4
  15. package/dist/{index-BbtR-Qto.cjs → index-BG932eCh.cjs} +292 -47
  16. package/dist/{index-DAAreiRF.mjs → index-CVCt3kSt.mjs} +289 -44
  17. package/dist/{index-CB8QnjvS.cjs → index-D5ScEErM.cjs} +4 -4
  18. package/dist/{index-B_-7NpGZ.cjs → index-DPCsWlWK.cjs} +7 -7
  19. package/dist/{index-PYO8Mdz4.mjs → index-DgO0FHOx.mjs} +4 -4
  20. package/dist/{index-B5QbzEga.mjs → index-ZChGsuB7.mjs} +8 -8
  21. package/dist/index.cjs +4 -4
  22. package/dist/index.mjs +4 -4
  23. package/dist/{install-CNtXzwT_.mjs → install-DarS_Wco.mjs} +1 -1
  24. package/dist/{install-CO1ps6Wt.cjs → install-wKQGgXvN.cjs} +1 -1
  25. package/dist/{installTerminalHooks-CMpOV3RU.mjs → installTerminalHooks-CpNbRFPz.mjs} +4 -4
  26. package/dist/{installTerminalHooks-BOAnQ1Qe.cjs → installTerminalHooks-DcQfee_O.cjs} +4 -4
  27. package/dist/lib.cjs +2 -2
  28. package/dist/lib.d.cts +77 -1
  29. package/dist/lib.d.mts +77 -1
  30. package/dist/lib.mjs +2 -2
  31. package/dist/{limits-DmMdchTz.mjs → limits-D2uN090G.mjs} +163 -11
  32. package/dist/{limits-o29KXBgj.cjs → limits-kqFqhfsh.cjs} +170 -10
  33. package/dist/{mcp-C_uejotl.mjs → mcp-BN6bKIGb.mjs} +4 -4
  34. package/dist/{mcp-CwK1nI7Y.cjs → mcp-DGdeUUDJ.cjs} +4 -4
  35. package/dist/{piRuntime-Dj5WnqzJ.cjs → piRuntime-3qtbKujX.cjs} +2 -2
  36. package/dist/{piRuntime-Cu2-8nOT.mjs → piRuntime-bkw2NAZU.mjs} +2 -2
  37. package/dist/{piTerminal-D-BIbov9.cjs → piTerminal-BYxp3LMr.cjs} +6 -6
  38. package/dist/{piTerminal-DanZeBrO.mjs → piTerminal-DilKwM7B.mjs} +6 -6
  39. package/dist/{runGemini--QqK-Ap5.cjs → runGemini-28O2sqyI.cjs} +6 -6
  40. package/dist/{runGemini-CZ_lhMWY.mjs → runGemini-Cjii069p.mjs} +6 -6
  41. package/dist/{runOpenClaw-C0xLhTvk.cjs → runOpenClaw-CiMZad-H.cjs} +5 -5
  42. package/dist/{runOpenClaw-CxgLpm38.mjs → runOpenClaw-jaLr7KF1.mjs} +5 -5
  43. package/dist/{send-BaOkDgH0.mjs → send-C9mOtChi.mjs} +43 -31
  44. package/dist/{send-CTcGMVuG.cjs → send-D5ejHPXG.cjs} +43 -31
  45. package/dist/{sessions-OmvyJb0n.cjs → sessions-BNMPQoLE.cjs} +133 -49
  46. package/dist/{sessions-Bn304xF1.mjs → sessions-W6771g3X.mjs} +133 -49
  47. package/dist/{spawn-BKNabutV.mjs → spawn-D0QVhzRb.mjs} +4 -4
  48. package/dist/{spawn-CC6V2KiA.cjs → spawn-Ddtom1cb.cjs} +4 -4
  49. package/dist/{teams-XtrH3_h3.cjs → teams-BZ1tayg_.cjs} +5 -5
  50. package/dist/{teams-CLbS2_4Q.mjs → teams-CqSwtw2O.mjs} +5 -5
  51. package/dist/{todo-CEDvKNXK.cjs → todo-BYMg0fR0.cjs} +2 -2
  52. package/dist/{todo-BcPbNKt2.mjs → todo-BbusB1zM.mjs} +2 -2
  53. package/dist/{types-BEVzYSoV.mjs → types-DIBF4U0Y.mjs} +78 -5
  54. package/dist/{types-CphWjqHc.cjs → types-DnrPeN80.cjs} +78 -5
  55. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var axios = require('axios');
4
- var persistence = require('./limits-o29KXBgj.cjs');
4
+ var persistence = require('./limits-kqFqhfsh.cjs');
5
5
  var node_events = require('node:events');
6
6
  var socket_ioClient = require('socket.io-client');
7
7
  var z = require('zod');
@@ -438,6 +438,15 @@ async function deriveKey$1(master, usage, path) {
438
438
 
439
439
  class RpcHandlerManager {
440
440
  handlers = /* @__PURE__ */ new Map();
441
+ /**
442
+ * B-506: methods whose params/result are PLAINTEXT JSON strings instead of
443
+ * machine-key ciphertext. The caller is a CLI on another machine of the
444
+ * same account, which holds neither this machine's key nor the account
445
+ * content key; the trusted relay sees the payload either way (this fork
446
+ * is server-trusted, not e2e). Only `registerPlainHandler` puts a method
447
+ * here; everything else keeps decrypting.
448
+ */
449
+ plainMethods = /* @__PURE__ */ new Set();
441
450
  scopePrefix;
442
451
  encryptionKey;
443
452
  encryptionVariant;
@@ -462,14 +471,31 @@ class RpcHandlerManager {
462
471
  unregisterHandler(method) {
463
472
  const prefixedMethod = this.getPrefixedMethod(method);
464
473
  this.handlers.delete(prefixedMethod);
474
+ this.plainMethods.delete(prefixedMethod);
465
475
  for (const socket of this.sockets) socket.emit("rpc-unregister", { method: prefixedMethod });
466
476
  }
477
+ /**
478
+ * B-506: register a method whose request is a plaintext JSON string and
479
+ * whose response is returned as a plaintext JSON string (see
480
+ * `plainMethods`). The handler receives the parsed params; a throw is
481
+ * answered with `{ error }` like the encrypted path.
482
+ */
483
+ registerPlainHandler(method, handler) {
484
+ this.plainMethods.add(this.getPrefixedMethod(method));
485
+ this.registerHandler(method, handler);
486
+ }
487
+ isPlainMethod(prefixedMethod) {
488
+ return this.plainMethods.has(prefixedMethod);
489
+ }
467
490
  /**
468
491
  * Handle an incoming RPC request
469
492
  * @param request - The RPC request data
470
493
  * @param callback - The response callback
471
494
  */
472
495
  async handleRequest(request) {
496
+ if (this.plainMethods.has(request.method)) {
497
+ return this.handlePlainRequest(request);
498
+ }
473
499
  try {
474
500
  const handler = this.handlers.get(request.method);
475
501
  if (!handler) {
@@ -493,6 +519,25 @@ class RpcHandlerManager {
493
519
  return persistence.encodeBase64(persistence.encrypt(this.encryptionKey, this.encryptionVariant, errorResponse));
494
520
  }
495
521
  }
522
+ /** Plaintext variant of handleRequest (B-506). Never throws; never encrypts. */
523
+ async handlePlainRequest(request) {
524
+ const handler = this.handlers.get(request.method);
525
+ if (!handler) return JSON.stringify({ error: "Method not found" });
526
+ let params;
527
+ try {
528
+ params = typeof request.params === "string" && request.params.length > 0 ? JSON.parse(request.params) : {};
529
+ } catch {
530
+ return JSON.stringify({ error: "Invalid JSON params" });
531
+ }
532
+ try {
533
+ this.logger("[RPC] Calling plain handler", { method: request.method });
534
+ const result = await handler(params);
535
+ return JSON.stringify(result === void 0 ? null : result);
536
+ } catch (error) {
537
+ this.logger("[RPC] [ERROR] Error handling plain request", { error });
538
+ return JSON.stringify({ error: error instanceof Error ? error.message : "Unknown error" });
539
+ }
540
+ }
496
541
  onSocketConnect(socket) {
497
542
  this.sockets.add(socket);
498
543
  for (const [prefixedMethod] of this.handlers) {
@@ -2772,7 +2817,7 @@ class ApiSessionClient extends node_events.EventEmitter {
2772
2817
  const persisted = await axios.post(
2773
2818
  `${persistence.configuration.serverUrl}/v3/sessions/${encodeURIComponent(this.sessionId)}/messages`,
2774
2819
  { messages: batch },
2775
- { headers: this.authHeaders(), timeout: 6e4 }
2820
+ { headers: { ...this.authHeaders(), "X-Happy-Message-Origin": "relay-client" }, timeout: 6e4 }
2776
2821
  );
2777
2822
  const stored = Array.isArray(persisted.data.messages) ? persisted.data.messages : [];
2778
2823
  const storedLocalIds = new Set(stored.map((message) => message.localId));
@@ -3000,16 +3045,29 @@ class ApiSessionClient extends node_events.EventEmitter {
3000
3045
  /** B-466: turn edges (and a periodic lease) reported to the local daemon so
3001
3046
  * auto-update waits for "no turn in flight" instead of "no sessions". */
3002
3047
  turnReporter = new TurnReporter((event) => void persistence.notifyDaemonTurnEvent(this.sessionId, event).catch((error) => persistence.logger.debug("[API] Failed to report turn event to daemon:", error)));
3003
- keepAlive(thinking, mode) {
3048
+ /** B-507: background tasks in flight, published on change and renewed every
3049
+ * 60s to the daemon (`/session-event background_tasks`) and into agentState
3050
+ * (`backgroundTasks: { updatedAt, tasks }`) — the two readers that outlive a
3051
+ * single heartbeat. The heartbeat itself carries only the count. */
3052
+ backgroundTaskReporter = new persistence.BackgroundTaskReporter((tasks, now) => {
3053
+ void persistence.notifyDaemonBackgroundTasks(this.sessionId, tasks).catch((error) => persistence.logger.debug("[API] Failed to report background tasks to daemon:", error));
3054
+ this.updateAgentState((state) => ({
3055
+ ...state,
3056
+ backgroundTasks: tasks.length > 0 ? { updatedAt: now, tasks } : void 0
3057
+ }));
3058
+ });
3059
+ keepAlive(thinking, mode, backgroundTasks) {
3004
3060
  if (process.env.DEBUG) {
3005
3061
  persistence.logger.debug(`[API] Sending keep alive message: ${thinking}`);
3006
3062
  }
3007
3063
  this.turnReporter.observe(thinking);
3064
+ if (backgroundTasks) this.backgroundTaskReporter.observe(backgroundTasks);
3008
3065
  this.socket.volatile.emit("session-alive", {
3009
3066
  sid: this.sessionId,
3010
3067
  time: Date.now(),
3011
3068
  thinking,
3012
- mode
3069
+ mode,
3070
+ ...backgroundTasks ? { backgroundTasks: backgroundTasks.length } : {}
3013
3071
  });
3014
3072
  }
3015
3073
  /**
@@ -14356,6 +14414,17 @@ class ApiMachineClient {
14356
14414
  return { claudeAuth };
14357
14415
  });
14358
14416
  }
14417
+ /**
14418
+ * B-506: the five `sessions.*` methods a CLI on ANOTHER machine of this
14419
+ * account calls to read / message sessions this daemon spawned. Plaintext
14420
+ * on purpose (no shared key with the caller); see
14421
+ * `api/rpc/RpcHandlerManager.ts` `registerPlainHandler`.
14422
+ */
14423
+ setRemoteSessionOpsHandlers(handlers) {
14424
+ for (const [method, handler] of Object.entries(handlers)) {
14425
+ this.rpcHandlerManager.registerPlainHandler(method, handler);
14426
+ }
14427
+ }
14359
14428
  setRPCHandlers({
14360
14429
  spawnSession,
14361
14430
  resumeSession,
@@ -15184,7 +15253,11 @@ class ApiMachineClient {
15184
15253
  }
15185
15254
  bindRpcRequestHandler(socket, transport) {
15186
15255
  socket.on("rpc-request", async (data, callback) => {
15187
- persistence.logger.debugLargeJson(`[API MACHINE] Received RPC request via ${transport}:`, data);
15256
+ if (typeof data?.method === "string" && this.rpcHandlerManager.isPlainMethod(data.method)) {
15257
+ persistence.logger.debug(`[API MACHINE] Received plain RPC request via ${transport}: ${data.method}`);
15258
+ } else {
15259
+ persistence.logger.debugLargeJson(`[API MACHINE] Received RPC request via ${transport}:`, data);
15260
+ }
15188
15261
  await answerSocketRequest(
15189
15262
  callback,
15190
15263
  () => this.rpcHandlerManager.handleRequest(data),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "very-happy-cli",
3
- "version": "0.2.156",
3
+ "version": "0.2.158",
4
4
  "description": "Remote multi-agent workspace CLI with deep Claude integration, native terminal streaming, and self-hosting.",
5
5
  "author": "Kirill Dubovitskiy",
6
6
  "contributors": [
@@ -117,12 +117,12 @@
117
117
  "zod": "^4.0.0"
118
118
  },
119
119
  "optionalDependencies": {
120
- "very-happy-tools-arm64-darwin": "0.2.156",
121
- "very-happy-tools-x64-darwin": "0.2.156",
122
- "very-happy-tools-arm64-linux": "0.2.156",
123
- "very-happy-tools-x64-linux": "0.2.156",
124
- "very-happy-tools-arm64-win32": "0.2.156",
125
- "very-happy-tools-x64-win32": "0.2.156"
120
+ "very-happy-tools-arm64-darwin": "0.2.158",
121
+ "very-happy-tools-x64-darwin": "0.2.158",
122
+ "very-happy-tools-arm64-linux": "0.2.158",
123
+ "very-happy-tools-x64-linux": "0.2.158",
124
+ "very-happy-tools-arm64-win32": "0.2.158",
125
+ "very-happy-tools-x64-win32": "0.2.158"
126
126
  },
127
127
  "devDependencies": {
128
128
  "@slopus/happy-wire": "workspace:*",