very-happy-cli 0.2.124 → 0.2.126

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 (49) hide show
  1. package/dist/{AcpBackend-CT9TOBEM.mjs → AcpBackend-BzGpBAZ0.mjs} +2 -1
  2. package/dist/{AcpBackend-au0veuIF.cjs → AcpBackend-C9eu6CDu.cjs} +30 -29
  3. package/dist/{AcpSessionManager-p1tj7FxF.mjs → AcpSessionManager-B223yT78.mjs} +1 -1
  4. package/dist/{AcpSessionManager-BCWeBKDd.cjs → AcpSessionManager-DQ1e_0gc.cjs} +9 -9
  5. package/dist/agentGuidance-BR0OFumQ.mjs +224 -0
  6. package/dist/agentGuidance-Tm8Z5HYp.cjs +237 -0
  7. package/dist/codex/happyMcpStdioBridge.cjs +29 -6
  8. package/dist/codex/happyMcpStdioBridge.mjs +25 -2
  9. package/dist/{config-DwMic6AC.mjs → config-Bjd1nG0P.mjs} +11 -11
  10. package/dist/{config-GzzqE5Ev.cjs → config-C0mofvCH.cjs} +11 -11
  11. package/dist/{index-B3-daYaX.mjs → index-BP56asuS.mjs} +8 -8
  12. package/dist/{index-DgN9P02i.cjs → index-CMbKpntk.cjs} +53 -19
  13. package/dist/{index-Ba6Fu6MJ.mjs → index-CV6sAa4a.mjs} +49 -15
  14. package/dist/{index-DI_VC3vJ.cjs → index-Cw9Zj1Zr.cjs} +2191 -1864
  15. package/dist/{index-SQKnWyz-.mjs → index-D4eCRu9x.mjs} +2046 -1719
  16. package/dist/{index-C69uF6Up.cjs → index-HW-KdG6W.cjs} +8 -8
  17. package/dist/index.cjs +5 -5
  18. package/dist/index.mjs +5 -5
  19. package/dist/{installTerminalHooks-CvMt8cBI.cjs → installTerminalHooks-CNp1LExn.cjs} +9 -9
  20. package/dist/{installTerminalHooks-Df4hzzdM.mjs → installTerminalHooks-D-CNSalI.mjs} +8 -8
  21. package/dist/lib.cjs +12 -12
  22. package/dist/lib.d.cts +3 -0
  23. package/dist/lib.d.mts +3 -0
  24. package/dist/lib.mjs +9 -9
  25. package/dist/limits-DG1OQnCb.cjs +1198 -0
  26. package/dist/limits-DlbYYtOw.mjs +1129 -0
  27. package/dist/{mcp-DnyLwSPq.cjs → mcp-BtZoIIIM.cjs} +11 -10
  28. package/dist/{mcp-C0oW5u-b.mjs → mcp-D3oV_dH-.mjs} +7 -6
  29. package/dist/resources-CVl7NdOB.cjs +83 -0
  30. package/dist/resources-D-mn7ptO.mjs +80 -0
  31. package/dist/{runGemini-mqLjz-M7.mjs → runGemini-BJ8bU1pP.mjs} +13 -13
  32. package/dist/{runGemini-_FHrxuHN.cjs → runGemini-BfCSOPL1.cjs} +30 -30
  33. package/dist/{runOpenClaw-C5VZQ6Na.cjs → runOpenClaw-CBlHXEAT.cjs} +24 -24
  34. package/dist/{runOpenClaw-Bs03yQHe.mjs → runOpenClaw-DTgOpJnO.mjs} +9 -9
  35. package/dist/{send-BaLjQPZQ.mjs → send-9duZlpGX.mjs} +10 -10
  36. package/dist/{send-BD2gTVoP.cjs → send-CDK1bZFj.cjs} +10 -10
  37. package/dist/{sessions-B108j_Xj.cjs → sessions-CNkLCorF.cjs} +11 -11
  38. package/dist/{sessions-ggBePfSY.mjs → sessions-jAFOkKvW.mjs} +10 -10
  39. package/dist/{spawn-CORFRb9D.mjs → spawn-BG5oHi_f.mjs} +21 -21
  40. package/dist/{spawn-iI8w8sD7.cjs → spawn-J-A5WGZ7.cjs} +21 -21
  41. package/dist/teams-Cuqsk7Ty.mjs +189 -0
  42. package/dist/teams-MgWeyutG.cjs +191 -0
  43. package/dist/{types-CZIwVSN2.cjs → types-P5deH8Ls.cjs} +464 -1571
  44. package/dist/{types-gDOmwOKw.mjs → types-n_VWu9qe.mjs} +78 -1148
  45. package/package.json +7 -7
  46. package/dist/agentGuidance-BifkGXdE.cjs +0 -46
  47. package/dist/agentGuidance-C2_pkgRI.mjs +0 -37
  48. package/dist/limits-CwFb5S2b.mjs +0 -22
  49. package/dist/limits-KdWKmwtH.cjs +0 -28
@@ -1,24 +1,25 @@
1
- import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-CT9TOBEM.mjs';
2
- export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-CT9TOBEM.mjs';
3
- import { d as connectionState, A as ApiClient, e as readSettings, f as encodeBase64, l as logger, p as projectPath } from './types-gDOmwOKw.mjs';
4
- import { A as AcpSessionManager } from './AcpSessionManager-p1tj7FxF.mjs';
1
+ import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-BzGpBAZ0.mjs';
2
+ export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-BzGpBAZ0.mjs';
3
+ import { c as configuration, f as readSettings, g as encodeBase64, l as logger } from './limits-DlbYYtOw.mjs';
4
+ import { A as AcpSessionManager } from './AcpSessionManager-B223yT78.mjs';
5
+ import { mkdir, chmod, writeFile, rename } from 'node:fs/promises';
5
6
  import { randomUUID } from 'node:crypto';
6
7
  import { join } from 'node:path';
7
- import { n as initialMachineMetadata, o as createSessionMetadata, u as setupOfflineReconnection, v as notifyDaemonSessionStarted, x as StreamRelay, y as MessageQueue2, z as hashObject, B as startHappyServer, T as TitleGenerator, C as registerKillSessionHandler, E as BasePermissionHandler, F as writeSessionModeFile, H as normalizeAcpPermissionMode, I as removeSessionModeFile } from './index-SQKnWyz-.mjs';
8
+ import { P as PI_TEAMS_EXTENSION } from './resources-D-mn7ptO.mjs';
9
+ import { f as connectionState, A as ApiClient, p as projectPath } from './types-n_VWu9qe.mjs';
10
+ import { n as initialMachineMetadata, o as createSessionMetadata, u as setupOfflineReconnection, v as notifyDaemonSessionStarted, z as StreamRelay, x as MessageQueue2, B as hashObject, C as startHappyServer, T as TitleGenerator, y as registerKillSessionHandler, E as BasePermissionHandler, F as writeSessionModeFile, H as normalizeAcpPermissionMode, I as removeSessionModeFile } from './index-D4eCRu9x.mjs';
8
11
  import 'node:child_process';
9
12
  import '@agentclientprotocol/sdk';
10
- import 'axios';
11
- import 'chalk';
12
- import 'node:util';
13
13
  import 'node:fs';
14
14
  import 'node:os';
15
- import 'node:fs/promises';
16
- import 'node:events';
17
- import 'socket.io-client';
18
15
  import 'zod';
19
- import '@paralleldrive/cuid2';
20
16
  import 'tweetnacl';
21
- import './limits-CwFb5S2b.mjs';
17
+ import 'chalk';
18
+ import 'node:util';
19
+ import '@paralleldrive/cuid2';
20
+ import 'axios';
21
+ import 'node:events';
22
+ import 'socket.io-client';
22
23
  import 'child_process';
23
24
  import 'util';
24
25
  import 'fs/promises';
@@ -32,7 +33,7 @@ import 'fs';
32
33
  import 'node:readline';
33
34
  import '@anthropic-ai/sandbox-runtime';
34
35
  import 'expo-server-sdk';
35
- import './agentGuidance-C2_pkgRI.mjs';
36
+ import './agentGuidance-BR0OFumQ.mjs';
36
37
  import 'ink';
37
38
  import 'react';
38
39
  import '@anthropic-ai/claude-agent-sdk';
@@ -64,6 +65,36 @@ function createAcpBackend(options) {
64
65
  return new AcpBackend(backendOptions);
65
66
  }
66
67
 
68
+ async function publish(path, content, mode) {
69
+ const temporary = `${path}.${randomUUID()}.new`;
70
+ await writeFile(temporary, content, { mode, flag: "wx" });
71
+ await rename(temporary, path);
72
+ }
73
+ async function preparePiTeamsRuntime() {
74
+ const directory = join(configuration.happyHomeDir, "teams", "pi-runtime");
75
+ await mkdir(directory, { recursive: true, mode: 448 });
76
+ const extension = join(directory, "very-happy-teams.mjs");
77
+ await publish(extension, PI_TEAMS_EXTENSION, 384);
78
+ const launcher = join(directory, "pi-teams.mjs");
79
+ const script = `#!${process.execPath}
80
+ import { spawn } from 'node:child_process';
81
+ const child = spawn(process.env.VH_TEAM_PI_COMMAND || 'pi', ['--extension', ${JSON.stringify(extension)}, ...process.argv.slice(2)], {stdio:'inherit',env:process.env,shell:process.platform==='win32'});
82
+ child.on('error',()=>{process.stderr.write('Very Happy could not launch pi\\n');process.exitCode=1});
83
+ child.on('exit',(code)=>{process.exitCode=code ?? 1});
84
+ for(const signal of ['SIGINT','SIGTERM'])process.on(signal,()=>child.kill(signal));
85
+ `;
86
+ await publish(launcher, script, 448);
87
+ await chmod(launcher, 448);
88
+ let command = launcher;
89
+ if (process.platform === "win32") {
90
+ command = join(directory, "pi-teams.cmd");
91
+ await publish(command, `@echo off\r
92
+ "${process.execPath}" "${launcher}" %*\r
93
+ `, 448);
94
+ }
95
+ return { PI_ACP_PI_COMMAND: command, VH_TEAM_PI_COMMAND: (process.env.PI_ACP_PI_COMMAND === command ? process.env.VH_TEAM_PI_COMMAND : process.env.PI_ACP_PI_COMMAND) || "pi" };
96
+ }
97
+
67
98
  const SUPPORTED_CATEGORIES = /* @__PURE__ */ new Set(["mode", "model", "thought_level"]);
68
99
  function isRecord$1(value) {
69
100
  return !!value && typeof value === "object";
@@ -597,6 +628,7 @@ async function runAcp(opts) {
597
628
  });
598
629
  const { state, metadata } = createSessionMetadata({
599
630
  flavor: resolveSessionFlavor(opts.agentName),
631
+ ...process.env.VH_TEAM_OPERATION_ID ? { teamOperationId: process.env.VH_TEAM_OPERATION_ID } : {},
600
632
  machineId: settings.machineId,
601
633
  startedBy: opts.startedBy,
602
634
  sandbox: settings.sandboxConfig
@@ -674,16 +706,18 @@ async function runAcp(opts) {
674
706
  const happyServer = await startHappyServer(session, { assistant: isAssistantVariant });
675
707
  const mcpServers = {
676
708
  happy: {
677
- command: join(projectPath(), "bin", "happy-mcp.mjs"),
709
+ command: join(projectPath(), "bin", "very-happy-mcp.mjs"),
678
710
  args: ["--url", happyServer.url]
679
711
  }
680
712
  };
713
+ const teamsPiEnv = opts.agentName === "pi" ? await preparePiTeamsRuntime() : {};
681
714
  const backend = new AcpBackend({
682
715
  agentName: opts.agentName,
683
716
  cwd: process.cwd(),
684
717
  command: opts.command,
685
718
  args: opts.args,
686
719
  env: {
720
+ ...teamsPiEnv,
687
721
  HAPPY_MCP_URL: happyServer.url,
688
722
  HAPPY_SESSION_ID: session.sessionId,
689
723
  HAPPY_PERMISSION_MODE: initialPermissionMode