very-happy-cli 0.2.156 → 0.2.157

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-BymWX-LI.cjs} +2 -2
  2. package/dist/{AcpBackend-C3nc1u-s.mjs → AcpBackend-Cy18U7yw.mjs} +2 -2
  3. package/dist/{AcpSessionManager-BVxkQnNf.cjs → AcpSessionManager-BF7zBGAi.cjs} +1 -1
  4. package/dist/{AcpSessionManager-dN3k1LbI.mjs → AcpSessionManager-Ds8rcp95.mjs} +1 -1
  5. package/dist/{agentGuidance-C604n0Zq.mjs → agentGuidance-CU6YD_Ms.mjs} +560 -29
  6. package/dist/{agentGuidance-C-CmV03f.cjs → agentGuidance-Db76O1kw.cjs} +579 -28
  7. package/dist/{agentHome-CmIJNV7f.cjs → agentHome-B0CLy0Qx.cjs} +2 -2
  8. package/dist/{agentHome-D2XGsoqs.mjs → agentHome-BaJ9xtxB.mjs} +2 -2
  9. package/dist/{auto-B1I6G_Nf.mjs → auto-B1YAwaeU.mjs} +6 -6
  10. package/dist/{auto-CMDq4oIu.cjs → auto-DqKGFq8U.cjs} +6 -6
  11. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  12. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  13. package/dist/{config-BYHSRY2E.cjs → config-CzkBjZnV.cjs} +4 -4
  14. package/dist/{config-BkTu25bH.mjs → config-aAbhJllb.mjs} +4 -4
  15. package/dist/{index-B5QbzEga.mjs → index-BVu8Cufk.mjs} +8 -8
  16. package/dist/{index-DAAreiRF.mjs → index-BYU1e81k.mjs} +288 -44
  17. package/dist/{index-BbtR-Qto.cjs → index-C9QzZsUQ.cjs} +291 -47
  18. package/dist/{index-B_-7NpGZ.cjs → index-CTbGqVFY.cjs} +7 -7
  19. package/dist/{index-CB8QnjvS.cjs → index-Cz-uqnJk.cjs} +4 -4
  20. package/dist/{index-PYO8Mdz4.mjs → index-DQcRkI9r.mjs} +4 -4
  21. package/dist/index.cjs +4 -4
  22. package/dist/index.mjs +4 -4
  23. package/dist/{install-CO1ps6Wt.cjs → install-BMlV0Tnr.cjs} +1 -1
  24. package/dist/{install-CNtXzwT_.mjs → install-BuYnqtVa.mjs} +1 -1
  25. package/dist/{installTerminalHooks-BOAnQ1Qe.cjs → installTerminalHooks-BVVOEGhG.cjs} +4 -4
  26. package/dist/{installTerminalHooks-CMpOV3RU.mjs → installTerminalHooks-ELDoqh0A.mjs} +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-A2c-3M-_.mjs} +162 -11
  32. package/dist/{limits-o29KXBgj.cjs → limits-CyuIt-Vl.cjs} +169 -10
  33. package/dist/{mcp-C_uejotl.mjs → mcp-Bo934Kpy.mjs} +4 -4
  34. package/dist/{mcp-CwK1nI7Y.cjs → mcp-CXkvnztT.cjs} +4 -4
  35. package/dist/{piRuntime-Dj5WnqzJ.cjs → piRuntime-CJjA26oD.cjs} +2 -2
  36. package/dist/{piRuntime-Cu2-8nOT.mjs → piRuntime-DdEY2mE9.mjs} +2 -2
  37. package/dist/{piTerminal-D-BIbov9.cjs → piTerminal-CpU3hzrX.cjs} +6 -6
  38. package/dist/{piTerminal-DanZeBrO.mjs → piTerminal-DwWmgumi.mjs} +6 -6
  39. package/dist/{runGemini-CZ_lhMWY.mjs → runGemini-Cj6oJQ-I.mjs} +6 -6
  40. package/dist/{runGemini--QqK-Ap5.cjs → runGemini-DS-0qm0L.cjs} +6 -6
  41. package/dist/{runOpenClaw-C0xLhTvk.cjs → runOpenClaw-CvSm8oTc.cjs} +5 -5
  42. package/dist/{runOpenClaw-CxgLpm38.mjs → runOpenClaw-DUCQxkI-.mjs} +5 -5
  43. package/dist/{send-CTcGMVuG.cjs → send-CHxobaoI.cjs} +43 -31
  44. package/dist/{send-BaOkDgH0.mjs → send-D5CyRyZ_.mjs} +43 -31
  45. package/dist/{sessions-OmvyJb0n.cjs → sessions-BFlIrKCY.cjs} +133 -49
  46. package/dist/{sessions-Bn304xF1.mjs → sessions-DsE01xKc.mjs} +133 -49
  47. package/dist/{spawn-BKNabutV.mjs → spawn-CdihhwHs.mjs} +4 -4
  48. package/dist/{spawn-CC6V2KiA.cjs → spawn-HV345RN-.cjs} +4 -4
  49. package/dist/{teams-CLbS2_4Q.mjs → teams-BE8nMB6O.mjs} +5 -5
  50. package/dist/{teams-XtrH3_h3.cjs → teams-BahinMnH.cjs} +5 -5
  51. package/dist/{todo-CEDvKNXK.cjs → todo-CMMQ6yhU.cjs} +2 -2
  52. package/dist/{todo-BcPbNKt2.mjs → todo-CuQAkSp2.mjs} +2 -2
  53. package/dist/{types-CphWjqHc.cjs → types-B0sSi6eM.cjs} +77 -4
  54. package/dist/{types-BEVzYSoV.mjs → types-BrGJ7PJz.mjs} +77 -4
  55. package/package.json +7 -7
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var AcpBackend = require('./AcpBackend-BHe1_F1h.cjs');
4
- var persistence = require('./limits-o29KXBgj.cjs');
5
- var AcpSessionManager = require('./AcpSessionManager-BVxkQnNf.cjs');
6
- var index$1 = require('./index-BbtR-Qto.cjs');
7
- var piRuntime = require('./piRuntime-Dj5WnqzJ.cjs');
3
+ var AcpBackend = require('./AcpBackend-BymWX-LI.cjs');
4
+ var persistence = require('./limits-CyuIt-Vl.cjs');
5
+ var AcpSessionManager = require('./AcpSessionManager-BF7zBGAi.cjs');
6
+ var index$1 = require('./index-C9QzZsUQ.cjs');
7
+ var piRuntime = require('./piRuntime-CJjA26oD.cjs');
8
8
  var node_crypto = require('node:crypto');
9
9
  var path = require('node:path');
10
- var index = require('./types-CphWjqHc.cjs');
10
+ var index = require('./types-B0sSi6eM.cjs');
11
11
  var terminalTitleSuggest = require('./terminalTitleSuggest-Dji8I0Jy.cjs');
12
12
  require('node:child_process');
13
13
  require('@agentclientprotocol/sdk');
@@ -21,7 +21,7 @@ require('node:util');
21
21
  require('node:os');
22
22
  require('cross-spawn');
23
23
  require('node:readline');
24
- require('./agentGuidance-C-CmV03f.cjs');
24
+ require('./agentGuidance-Db76O1kw.cjs');
25
25
  require('axios');
26
26
  require('socket.io-client');
27
27
  require('fs/promises');
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BbtR-Qto.cjs');
3
+ var index = require('./index-C9QzZsUQ.cjs');
4
4
  var claudeAgentSdk = require('@anthropic-ai/claude-agent-sdk');
5
5
  require('chalk');
6
6
  require('node:os');
7
7
  require('node:crypto');
8
- require('./types-CphWjqHc.cjs');
8
+ require('./types-B0sSi6eM.cjs');
9
9
  require('axios');
10
- require('./limits-o29KXBgj.cjs');
10
+ require('./limits-CyuIt-Vl.cjs');
11
11
  require('zod');
12
12
  require('@paralleldrive/cuid2');
13
13
  require('node:fs/promises');
@@ -32,7 +32,7 @@ require('fs');
32
32
  require('node:readline');
33
33
  require('@anthropic-ai/sandbox-runtime');
34
34
  require('expo-server-sdk');
35
- require('./agentGuidance-C-CmV03f.cjs');
35
+ require('./agentGuidance-Db76O1kw.cjs');
36
36
  require('ink');
37
37
  require('react');
38
38
  require('ps-list');
@@ -1,11 +1,11 @@
1
- import { q as query } from './index-DAAreiRF.mjs';
1
+ import { q as query } from './index-BYU1e81k.mjs';
2
2
  export { AbortError } from '@anthropic-ai/claude-agent-sdk';
3
3
  import 'chalk';
4
4
  import 'node:os';
5
5
  import 'node:crypto';
6
- import './types-BEVzYSoV.mjs';
6
+ import './types-BrGJ7PJz.mjs';
7
7
  import 'axios';
8
- import './limits-DmMdchTz.mjs';
8
+ import './limits-A2c-3M-_.mjs';
9
9
  import 'zod';
10
10
  import '@paralleldrive/cuid2';
11
11
  import 'node:fs/promises';
@@ -30,7 +30,7 @@ import 'fs';
30
30
  import 'node:readline';
31
31
  import '@anthropic-ai/sandbox-runtime';
32
32
  import 'expo-server-sdk';
33
- import './agentGuidance-C604n0Zq.mjs';
33
+ import './agentGuidance-CU6YD_Ms.mjs';
34
34
  import 'ink';
35
35
  import 'react';
36
36
  import 'ps-list';
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-BbtR-Qto.cjs');
5
- require('./limits-o29KXBgj.cjs');
4
+ require('./index-C9QzZsUQ.cjs');
5
+ require('./limits-CyuIt-Vl.cjs');
6
6
  require('zod');
7
- require('./types-CphWjqHc.cjs');
7
+ require('./types-B0sSi6eM.cjs');
8
8
  require('node:child_process');
9
9
  require('node:os');
10
10
  require('node:crypto');
@@ -15,7 +15,7 @@ require('node:fs');
15
15
  require('./terminalTitleSuggest-Dji8I0Jy.cjs');
16
16
  require('path');
17
17
  require('url');
18
- require('./agentGuidance-C-CmV03f.cjs');
18
+ require('./agentGuidance-Db76O1kw.cjs');
19
19
  require('node:fs/promises');
20
20
  require('axios');
21
21
  require('socket.io-client');
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'chalk';
2
- import './index-DAAreiRF.mjs';
3
- import './limits-DmMdchTz.mjs';
2
+ import './index-BYU1e81k.mjs';
3
+ import './limits-A2c-3M-_.mjs';
4
4
  import 'zod';
5
- import './types-BEVzYSoV.mjs';
5
+ import './types-BrGJ7PJz.mjs';
6
6
  import 'node:child_process';
7
7
  import 'node:os';
8
8
  import 'node:crypto';
@@ -13,7 +13,7 @@ import 'node:fs';
13
13
  import './terminalTitleSuggest-DKgX3osW.mjs';
14
14
  import 'path';
15
15
  import 'url';
16
- import './agentGuidance-C604n0Zq.mjs';
16
+ import './agentGuidance-CU6YD_Ms.mjs';
17
17
  import 'node:fs/promises';
18
18
  import 'axios';
19
19
  import 'socket.io-client';
@@ -3,7 +3,7 @@
3
3
  var node_crypto = require('node:crypto');
4
4
  var promises = require('node:fs/promises');
5
5
  var path = require('node:path');
6
- var index = require('./index-BbtR-Qto.cjs');
6
+ var index = require('./index-C9QzZsUQ.cjs');
7
7
 
8
8
  async function assertPrivateDestination(directory) {
9
9
  for (let path$1 = directory; ; path$1 = path.dirname(path$1)) {
@@ -1,7 +1,7 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
2
  import { unlink, rmdir, mkdir, lstat, readFile, writeFile, rename } from 'node:fs/promises';
3
3
  import { join, resolve, dirname } from 'node:path';
4
- import { T as TEAM_SKILL } from './index-DAAreiRF.mjs';
4
+ import { T as TEAM_SKILL } from './index-BYU1e81k.mjs';
5
5
 
6
6
  async function assertPrivateDestination(directory) {
7
7
  for (let path = directory; ; path = dirname(path)) {
@@ -6,14 +6,14 @@ var os = require('node:os');
6
6
  var node_child_process = require('node:child_process');
7
7
  var chalk = require('chalk');
8
8
  var terminalTitleSuggest = require('./terminalTitleSuggest-Dji8I0Jy.cjs');
9
- var index = require('./index-BbtR-Qto.cjs');
9
+ var index = require('./index-C9QzZsUQ.cjs');
10
10
  require('path');
11
11
  require('url');
12
12
  require('zod');
13
13
  require('node:crypto');
14
- require('./types-CphWjqHc.cjs');
14
+ require('./types-B0sSi6eM.cjs');
15
15
  require('axios');
16
- require('./limits-o29KXBgj.cjs');
16
+ require('./limits-CyuIt-Vl.cjs');
17
17
  require('@paralleldrive/cuid2');
18
18
  require('node:fs/promises');
19
19
  require('tweetnacl');
@@ -31,7 +31,7 @@ require('fs');
31
31
  require('node:readline');
32
32
  require('@anthropic-ai/sandbox-runtime');
33
33
  require('expo-server-sdk');
34
- require('./agentGuidance-C-CmV03f.cjs');
34
+ require('./agentGuidance-Db76O1kw.cjs');
35
35
  require('ink');
36
36
  require('react');
37
37
  require('@anthropic-ai/claude-agent-sdk');
@@ -4,14 +4,14 @@ import { homedir } from 'node:os';
4
4
  import { spawnSync } from 'node:child_process';
5
5
  import chalk from 'chalk';
6
6
  import { p as projectPath } from './terminalTitleSuggest-DKgX3osW.mjs';
7
- import { b as tmuxSupportsSessionEnv } from './index-DAAreiRF.mjs';
7
+ import { b as tmuxSupportsSessionEnv } from './index-BYU1e81k.mjs';
8
8
  import 'path';
9
9
  import 'url';
10
10
  import 'zod';
11
11
  import 'node:crypto';
12
- import './types-BEVzYSoV.mjs';
12
+ import './types-BrGJ7PJz.mjs';
13
13
  import 'axios';
14
- import './limits-DmMdchTz.mjs';
14
+ import './limits-A2c-3M-_.mjs';
15
15
  import '@paralleldrive/cuid2';
16
16
  import 'node:fs/promises';
17
17
  import 'tweetnacl';
@@ -29,7 +29,7 @@ import 'fs';
29
29
  import 'node:readline';
30
30
  import '@anthropic-ai/sandbox-runtime';
31
31
  import 'expo-server-sdk';
32
- import './agentGuidance-C604n0Zq.mjs';
32
+ import './agentGuidance-CU6YD_Ms.mjs';
33
33
  import 'ink';
34
34
  import 'react';
35
35
  import '@anthropic-ai/claude-agent-sdk';
package/dist/lib.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./types-CphWjqHc.cjs');
4
- var persistence = require('./limits-o29KXBgj.cjs');
3
+ var index = require('./types-B0sSi6eM.cjs');
4
+ var persistence = require('./limits-CyuIt-Vl.cjs');
5
5
  require('axios');
6
6
  require('node:events');
7
7
  require('socket.io-client');
package/dist/lib.d.cts CHANGED
@@ -5,6 +5,45 @@ import { EventEmitter } from 'node:events';
5
5
  import { Socket } from 'socket.io-client';
6
6
  import { ExpoPushMessage } from 'expo-server-sdk';
7
7
 
8
+ /**
9
+ * B-507 — which background tasks does this Claude session still have in
10
+ * flight? Pure bookkeeping over SDK messages; no I/O.
11
+ *
12
+ * A turn ending is not the session going quiet: an async-launched sub-agent,
13
+ * a `run_in_background` Bash command, a Monitor or a workflow keeps running
14
+ * and will wake the session with a task_notification later. Nothing used to
15
+ * say so explicitly — auto-archive had to guess from event recency and got it
16
+ * wrong (Owner's PR#631 session). This tracker is the explicit answer; the
17
+ * wrapper publishes its `list()` on the heartbeat, to the daemon and into
18
+ * agentState (`update/backgroundTaskActivity.ts`).
19
+ *
20
+ * Signals (SDK 0.3.281, sdk.d.ts):
21
+ * - `system/background_tasks_changed` is the LEVEL: the full live set after
22
+ * every membership change, REPLACE semantics — "consumers that only need
23
+ * 'is background work running' should replace their set with each payload
24
+ * rather than pairing edges". It is per process: nothing at startup, so
25
+ * `reset()` on every query (re)start.
26
+ * - the EDGES `task_started{is_backgrounded}` / `task_updated.patch` /
27
+ * `task_notification` still apply, for Claude Code runtimes that predate
28
+ * the level signal. Both are applied; for one transition they agree (a
29
+ * level first makes the edge an idempotent replay, an edge first is
30
+ * overwritten by the same set), so they cannot fight.
31
+ * - a foreground Agent whose tool_result carries `tool_use_result.status ===
32
+ * 'async_launched'` moved to the background (B-260-P2's marker) — the
33
+ * fallback when neither task_started.is_backgrounded nor the level exists.
34
+ * - `ambient` tasks are "not activity; hosts should exclude them from
35
+ * activity indicators" — excluded here too.
36
+ */
37
+
38
+ interface BackgroundTaskInfo {
39
+ id: string;
40
+ /** SDK task_type as reported (local_bash / local_agent / monitor / …); 'unknown' when absent. */
41
+ type: string;
42
+ description: string;
43
+ /** Wrapper-local ms epoch of when this task was first seen in the background. */
44
+ startedAt: number;
45
+ }
46
+
8
47
  declare const sessionTurnEndStatusSchema: z.ZodEnum<{
9
48
  completed: "completed";
10
49
  failed: "failed";
@@ -721,6 +760,12 @@ type Metadata = {
721
760
  type AgentState$1 = {
722
761
  contextUsage?: ContextUsage | null;
723
762
  controlledByUser?: boolean | null | undefined;
763
+ /** B-507: background tasks still in flight, renewed every 60s while non-empty
764
+ * (`update/backgroundTaskActivity.ts`). Readers expire it by `updatedAt`. */
765
+ backgroundTasks?: {
766
+ updatedAt: number;
767
+ tasks: BackgroundTaskInfo[];
768
+ } | null;
724
769
  requests?: {
725
770
  [id: string]: {
726
771
  tool: string;
@@ -778,6 +823,15 @@ interface RpcHandlerConfig {
778
823
 
779
824
  declare class RpcHandlerManager {
780
825
  private handlers;
826
+ /**
827
+ * B-506: methods whose params/result are PLAINTEXT JSON strings instead of
828
+ * machine-key ciphertext. The caller is a CLI on another machine of the
829
+ * same account, which holds neither this machine's key nor the account
830
+ * content key; the trusted relay sees the payload either way (this fork
831
+ * is server-trusted, not e2e). Only `registerPlainHandler` puts a method
832
+ * here; everything else keeps decrypting.
833
+ */
834
+ private plainMethods;
781
835
  private readonly scopePrefix;
782
836
  private readonly encryptionKey;
783
837
  private readonly encryptionVariant;
@@ -791,12 +845,22 @@ declare class RpcHandlerManager {
791
845
  */
792
846
  registerHandler<TRequest = any, TResponse = any>(method: string, handler: RpcHandler<TRequest, TResponse>): void;
793
847
  unregisterHandler(method: string): void;
848
+ /**
849
+ * B-506: register a method whose request is a plaintext JSON string and
850
+ * whose response is returned as a plaintext JSON string (see
851
+ * `plainMethods`). The handler receives the parsed params; a throw is
852
+ * answered with `{ error }` like the encrypted path.
853
+ */
854
+ registerPlainHandler<TRequest = any, TResponse = any>(method: string, handler: RpcHandler<TRequest, TResponse>): void;
855
+ isPlainMethod(prefixedMethod: string): boolean;
794
856
  /**
795
857
  * Handle an incoming RPC request
796
858
  * @param request - The RPC request data
797
859
  * @param callback - The response callback
798
860
  */
799
861
  handleRequest(request: RpcRequest): Promise<any>;
862
+ /** Plaintext variant of handleRequest (B-506). Never throws; never encrypts. */
863
+ private handlePlainRequest;
800
864
  onSocketConnect(socket: Socket): void;
801
865
  /**
802
866
  * Attach a candidate transport and wait until the server confirms every
@@ -1042,7 +1106,12 @@ declare class ApiSessionClient extends EventEmitter {
1042
1106
  /** B-466: turn edges (and a periodic lease) reported to the local daemon so
1043
1107
  * auto-update waits for "no turn in flight" instead of "no sessions". */
1044
1108
  private readonly turnReporter;
1045
- keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
1109
+ /** B-507: background tasks in flight, published on change and renewed every
1110
+ * 60s to the daemon (`/session-event background_tasks`) and into agentState
1111
+ * (`backgroundTasks: { updatedAt, tasks }`) — the two readers that outlive a
1112
+ * single heartbeat. The heartbeat itself carries only the count. */
1113
+ private readonly backgroundTaskReporter;
1114
+ keepAlive(thinking: boolean, mode: 'local' | 'remote', backgroundTasks?: readonly BackgroundTaskInfo[]): void;
1046
1115
  /**
1047
1116
  * B-309: push one live stream frame (thinking/text delta or progress) to
1048
1117
  * this account's web clients.
@@ -1419,6 +1488,13 @@ declare class ApiMachineClient {
1419
1488
  }>;
1420
1489
  setStore: (store: 'auto' | 'file') => Promise<ClaudeAuthState>;
1421
1490
  }): void;
1491
+ /**
1492
+ * B-506: the five `sessions.*` methods a CLI on ANOTHER machine of this
1493
+ * account calls to read / message sessions this daemon spawned. Plaintext
1494
+ * on purpose (no shared key with the caller); see
1495
+ * `api/rpc/RpcHandlerManager.ts` `registerPlainHandler`.
1496
+ */
1497
+ setRemoteSessionOpsHandlers(handlers: Record<string, (params: unknown) => Promise<unknown>>): void;
1422
1498
  setRPCHandlers({ spawnSession, resumeSession, restartSession, stopSession, listTrackedSessionIds, requestShutdown }: MachineRpcHandlers): void;
1423
1499
  private syncRestartSessionRpcRegistration;
1424
1500
  private syncResumeSessionRpcRegistration;
package/dist/lib.d.mts CHANGED
@@ -5,6 +5,45 @@ import { EventEmitter } from 'node:events';
5
5
  import { Socket } from 'socket.io-client';
6
6
  import { ExpoPushMessage } from 'expo-server-sdk';
7
7
 
8
+ /**
9
+ * B-507 — which background tasks does this Claude session still have in
10
+ * flight? Pure bookkeeping over SDK messages; no I/O.
11
+ *
12
+ * A turn ending is not the session going quiet: an async-launched sub-agent,
13
+ * a `run_in_background` Bash command, a Monitor or a workflow keeps running
14
+ * and will wake the session with a task_notification later. Nothing used to
15
+ * say so explicitly — auto-archive had to guess from event recency and got it
16
+ * wrong (Owner's PR#631 session). This tracker is the explicit answer; the
17
+ * wrapper publishes its `list()` on the heartbeat, to the daemon and into
18
+ * agentState (`update/backgroundTaskActivity.ts`).
19
+ *
20
+ * Signals (SDK 0.3.281, sdk.d.ts):
21
+ * - `system/background_tasks_changed` is the LEVEL: the full live set after
22
+ * every membership change, REPLACE semantics — "consumers that only need
23
+ * 'is background work running' should replace their set with each payload
24
+ * rather than pairing edges". It is per process: nothing at startup, so
25
+ * `reset()` on every query (re)start.
26
+ * - the EDGES `task_started{is_backgrounded}` / `task_updated.patch` /
27
+ * `task_notification` still apply, for Claude Code runtimes that predate
28
+ * the level signal. Both are applied; for one transition they agree (a
29
+ * level first makes the edge an idempotent replay, an edge first is
30
+ * overwritten by the same set), so they cannot fight.
31
+ * - a foreground Agent whose tool_result carries `tool_use_result.status ===
32
+ * 'async_launched'` moved to the background (B-260-P2's marker) — the
33
+ * fallback when neither task_started.is_backgrounded nor the level exists.
34
+ * - `ambient` tasks are "not activity; hosts should exclude them from
35
+ * activity indicators" — excluded here too.
36
+ */
37
+
38
+ interface BackgroundTaskInfo {
39
+ id: string;
40
+ /** SDK task_type as reported (local_bash / local_agent / monitor / …); 'unknown' when absent. */
41
+ type: string;
42
+ description: string;
43
+ /** Wrapper-local ms epoch of when this task was first seen in the background. */
44
+ startedAt: number;
45
+ }
46
+
8
47
  declare const sessionTurnEndStatusSchema: z.ZodEnum<{
9
48
  completed: "completed";
10
49
  failed: "failed";
@@ -721,6 +760,12 @@ type Metadata = {
721
760
  type AgentState$1 = {
722
761
  contextUsage?: ContextUsage | null;
723
762
  controlledByUser?: boolean | null | undefined;
763
+ /** B-507: background tasks still in flight, renewed every 60s while non-empty
764
+ * (`update/backgroundTaskActivity.ts`). Readers expire it by `updatedAt`. */
765
+ backgroundTasks?: {
766
+ updatedAt: number;
767
+ tasks: BackgroundTaskInfo[];
768
+ } | null;
724
769
  requests?: {
725
770
  [id: string]: {
726
771
  tool: string;
@@ -778,6 +823,15 @@ interface RpcHandlerConfig {
778
823
 
779
824
  declare class RpcHandlerManager {
780
825
  private handlers;
826
+ /**
827
+ * B-506: methods whose params/result are PLAINTEXT JSON strings instead of
828
+ * machine-key ciphertext. The caller is a CLI on another machine of the
829
+ * same account, which holds neither this machine's key nor the account
830
+ * content key; the trusted relay sees the payload either way (this fork
831
+ * is server-trusted, not e2e). Only `registerPlainHandler` puts a method
832
+ * here; everything else keeps decrypting.
833
+ */
834
+ private plainMethods;
781
835
  private readonly scopePrefix;
782
836
  private readonly encryptionKey;
783
837
  private readonly encryptionVariant;
@@ -791,12 +845,22 @@ declare class RpcHandlerManager {
791
845
  */
792
846
  registerHandler<TRequest = any, TResponse = any>(method: string, handler: RpcHandler<TRequest, TResponse>): void;
793
847
  unregisterHandler(method: string): void;
848
+ /**
849
+ * B-506: register a method whose request is a plaintext JSON string and
850
+ * whose response is returned as a plaintext JSON string (see
851
+ * `plainMethods`). The handler receives the parsed params; a throw is
852
+ * answered with `{ error }` like the encrypted path.
853
+ */
854
+ registerPlainHandler<TRequest = any, TResponse = any>(method: string, handler: RpcHandler<TRequest, TResponse>): void;
855
+ isPlainMethod(prefixedMethod: string): boolean;
794
856
  /**
795
857
  * Handle an incoming RPC request
796
858
  * @param request - The RPC request data
797
859
  * @param callback - The response callback
798
860
  */
799
861
  handleRequest(request: RpcRequest): Promise<any>;
862
+ /** Plaintext variant of handleRequest (B-506). Never throws; never encrypts. */
863
+ private handlePlainRequest;
800
864
  onSocketConnect(socket: Socket): void;
801
865
  /**
802
866
  * Attach a candidate transport and wait until the server confirms every
@@ -1042,7 +1106,12 @@ declare class ApiSessionClient extends EventEmitter {
1042
1106
  /** B-466: turn edges (and a periodic lease) reported to the local daemon so
1043
1107
  * auto-update waits for "no turn in flight" instead of "no sessions". */
1044
1108
  private readonly turnReporter;
1045
- keepAlive(thinking: boolean, mode: 'local' | 'remote'): void;
1109
+ /** B-507: background tasks in flight, published on change and renewed every
1110
+ * 60s to the daemon (`/session-event background_tasks`) and into agentState
1111
+ * (`backgroundTasks: { updatedAt, tasks }`) — the two readers that outlive a
1112
+ * single heartbeat. The heartbeat itself carries only the count. */
1113
+ private readonly backgroundTaskReporter;
1114
+ keepAlive(thinking: boolean, mode: 'local' | 'remote', backgroundTasks?: readonly BackgroundTaskInfo[]): void;
1046
1115
  /**
1047
1116
  * B-309: push one live stream frame (thinking/text delta or progress) to
1048
1117
  * this account's web clients.
@@ -1419,6 +1488,13 @@ declare class ApiMachineClient {
1419
1488
  }>;
1420
1489
  setStore: (store: 'auto' | 'file') => Promise<ClaudeAuthState>;
1421
1490
  }): void;
1491
+ /**
1492
+ * B-506: the five `sessions.*` methods a CLI on ANOTHER machine of this
1493
+ * account calls to read / message sessions this daemon spawned. Plaintext
1494
+ * on purpose (no shared key with the caller); see
1495
+ * `api/rpc/RpcHandlerManager.ts` `registerPlainHandler`.
1496
+ */
1497
+ setRemoteSessionOpsHandlers(handlers: Record<string, (params: unknown) => Promise<unknown>>): void;
1422
1498
  setRPCHandlers({ spawnSession, resumeSession, restartSession, stopSession, listTrackedSessionIds, requestShutdown }: MachineRpcHandlers): void;
1423
1499
  private syncRestartSessionRpcRegistration;
1424
1500
  private syncResumeSessionRpcRegistration;
package/dist/lib.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema } from './types-BEVzYSoV.mjs';
2
- export { c as configuration, l as logger } from './limits-DmMdchTz.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema } from './types-BrGJ7PJz.mjs';
2
+ export { c as configuration, l as logger } from './limits-A2c-3M-_.mjs';
3
3
  import 'axios';
4
4
  import 'node:events';
5
5
  import 'socket.io-client';