very-happy-cli 0.2.151 → 0.2.153

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 (65) hide show
  1. package/dist/{AcpBackend-blE9IEod.cjs → AcpBackend-DSt8nTYm.cjs} +2 -2
  2. package/dist/{AcpBackend-BjTA5gUB.mjs → AcpBackend-YDGv4E-g.mjs} +2 -2
  3. package/dist/{AcpSessionManager-D-9mrp40.mjs → AcpSessionManager-Cxf5HQX1.mjs} +1 -1
  4. package/dist/{AcpSessionManager-bF8PYu_B.cjs → AcpSessionManager-uov6I9C8.cjs} +9 -9
  5. package/dist/agentGuidance-BM4kMNyr.cjs +553 -0
  6. package/dist/agentGuidance-C8unGWp7.mjs +529 -0
  7. package/dist/{agentHome-D6MSfwnp.cjs → agentHome-BJ7bde35.cjs} +4 -4
  8. package/dist/{agentHome-CeFDNzvq.mjs → agentHome-D68Xh2ae.mjs} +4 -4
  9. package/dist/auto-C-90ojIH.cjs +472 -0
  10. package/dist/auto-CcXxfqkC.mjs +466 -0
  11. package/dist/codex/happyMcpStdioBridge.cjs +4 -2
  12. package/dist/codex/happyMcpStdioBridge.mjs +4 -2
  13. package/dist/{config-C-A1XF62.mjs → config-CHJ189UJ.mjs} +6 -6
  14. package/dist/{config-Cadw1sAk.cjs → config-D23kF0_u.cjs} +6 -6
  15. package/dist/{index-DYQgcgL2.mjs → index-BXA9fxbK.mjs} +6 -6
  16. package/dist/{index-CIyjJy8D.mjs → index-BacwoXzs.mjs} +748 -55
  17. package/dist/{index-DEp6CmmS.mjs → index-BgYZGODP.mjs} +20 -20
  18. package/dist/{index-vyRqLjDv.cjs → index-D49WvbDT.cjs} +6 -6
  19. package/dist/{index-BKGspSWk.cjs → index-DEOVn46R.cjs} +21 -21
  20. package/dist/{index-CqtfRzug.cjs → index-DHrwHxHf.cjs} +805 -105
  21. package/dist/index.cjs +5 -5
  22. package/dist/index.mjs +5 -5
  23. package/dist/install-BiOXBnnS.cjs +118 -0
  24. package/dist/install-Ca7_Z3bV.mjs +114 -0
  25. package/dist/{installPiTools-C-Lxv4Bt.mjs → installPiTools-Cj7yU9Fc.mjs} +2 -1
  26. package/dist/{installPiTools-BKnXjrVu.cjs → installPiTools-DuZ6jZvX.cjs} +3 -2
  27. package/dist/{installTerminalHooks-Bf_adbl3.cjs → installTerminalHooks-BF0kL0ae.cjs} +8 -8
  28. package/dist/{installTerminalHooks-Ch_yTtEA.mjs → installTerminalHooks-Bpl32K75.mjs} +7 -7
  29. package/dist/lib.cjs +4 -4
  30. package/dist/lib.mjs +4 -4
  31. package/dist/limits-BtAuKRl2.mjs +2080 -0
  32. package/dist/limits-DY_sFA3J.cjs +2175 -0
  33. package/dist/{mcp-zu8n8TkR.mjs → mcp-DQkmk4VV.mjs} +15 -8
  34. package/dist/{mcp-CMxEZ6-0.cjs → mcp-JpqI2POW.cjs} +15 -7
  35. package/dist/piExtension.d.mts +4 -1
  36. package/dist/piExtension.mjs +24 -1
  37. package/dist/{piRuntime-Cu6cXZ6N.mjs → piRuntime-DBpe12NN.mjs} +2 -2
  38. package/dist/{piRuntime-D3ny0mVg.cjs → piRuntime-DRbbeQ72.cjs} +2 -2
  39. package/dist/{piTerminal-M677UP7y.mjs → piTerminal-BoHvPEZ_.mjs} +8 -7
  40. package/dist/{piTerminal-kDSd_r9X.cjs → piTerminal-qdJ9KZVL.cjs} +8 -7
  41. package/dist/{runGemini-DuwdVV1O.cjs → runGemini-CtOEFvhf.cjs} +9 -9
  42. package/dist/{runGemini-DvJwQVGp.mjs → runGemini-YqH7a-7O.mjs} +8 -8
  43. package/dist/{runOpenClaw-BG82bF18.mjs → runOpenClaw-DSSyFQBb.mjs} +7 -7
  44. package/dist/{runOpenClaw-BsvtCE_H.cjs → runOpenClaw-DoqZXBvL.cjs} +7 -7
  45. package/dist/{send-aUkjhey7.cjs → send-9075kHZP.cjs} +6 -6
  46. package/dist/{send-o6WM-1G8.mjs → send-Cs-RwqNf.mjs} +6 -6
  47. package/dist/{sessions-DlU3foY_.mjs → sessions-iBnYzVUK.mjs} +6 -6
  48. package/dist/{sessions-B3vP18kz.cjs → sessions-qULzUzlI.cjs} +6 -6
  49. package/dist/{spawn-DxHIIqhi.mjs → spawn-C6fRkedx.mjs} +7 -32
  50. package/dist/{spawn-DH6_p4-f.cjs → spawn-od9V23cc.cjs} +8 -33
  51. package/dist/{teams-DoAA_CcN.mjs → teams-CkrWQ4uM.mjs} +16 -73
  52. package/dist/{teams-BW8D1n3o.cjs → teams-CrCzU-AV.cjs} +14 -71
  53. package/dist/terminalTitleSuggest-DKgX3osW.mjs +38 -0
  54. package/dist/terminalTitleSuggest-Dji8I0Jy.cjs +45 -0
  55. package/dist/{todo-Bcc2XxGh.cjs → todo-BCT_ZPuV.cjs} +4 -23
  56. package/dist/{todo-BhJbG5eq.mjs → todo-aCZmSt27.mjs} +2 -21
  57. package/dist/{types-BN3eiipi.mjs → types-BvqOVUOW.mjs} +214 -1022
  58. package/dist/{types-CPubg05Z.cjs → types-CUCU7Vw8.cjs} +43 -863
  59. package/package.json +7 -7
  60. package/dist/agentGuidance-BXa9ikrZ.cjs +0 -267
  61. package/dist/agentGuidance-Dvo3cZMW.mjs +0 -251
  62. package/dist/limits-DS-bnYYp.mjs +0 -1165
  63. package/dist/limits-DwcY3kyi.cjs +0 -1236
  64. package/dist/projectPath-CSpqWdxp.mjs +0 -10
  65. package/dist/projectPath-ChLhdOyt.cjs +0 -13
@@ -1,23 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var index = require('./index-CqtfRzug.cjs');
5
- var index$1 = require('./types-CPubg05Z.cjs');
4
+ var index = require('./index-DHrwHxHf.cjs');
5
+ var index$1 = require('./types-CUCU7Vw8.cjs');
6
6
  require('node:os');
7
7
  require('node:crypto');
8
- require('./limits-DwcY3kyi.cjs');
8
+ require('./limits-DY_sFA3J.cjs');
9
9
  require('node:fs/promises');
10
10
  require('node:fs');
11
11
  require('node:path');
12
12
  require('zod');
13
13
  require('tweetnacl');
14
14
  require('node:util');
15
+ require('@paralleldrive/cuid2');
15
16
  require('cross-spawn');
16
17
  require('node:readline');
17
- require('./projectPath-ChLhdOyt.cjs');
18
+ require('./terminalTitleSuggest-Dji8I0Jy.cjs');
18
19
  require('path');
19
20
  require('url');
20
- require('./agentGuidance-BXa9ikrZ.cjs');
21
+ require('./agentGuidance-BM4kMNyr.cjs');
21
22
  require('fs/promises');
22
23
  require('ink');
23
24
  require('react');
@@ -27,7 +28,6 @@ require('node:events');
27
28
  require('socket.io-client');
28
29
  require('os');
29
30
  require('child_process');
30
- require('@paralleldrive/cuid2');
31
31
  require('node:child_process');
32
32
  require('fs');
33
33
  require('@anthropic-ai/sandbox-runtime');
@@ -1,14 +1,13 @@
1
1
  import chalk from 'chalk';
2
2
  import { readFileSync, statSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
- import { k as getAgentCodeDefaults, n as normalizeAgentKey, l as isClaudeOpus55Model, m as supportsClaudeOpus55, o as forkSession, q as getProjectPath, F as ForkSourceMissingError, C as CodexAppServerClient, t as forkCodexThread, u as checkIfDaemonRunningAndCleanupStaleState, v as spawnDaemonSession, w as stopDaemonSession } from './types-BN3eiipi.mjs';
5
- import { d as readPersistedSessions, l as logger } from './limits-DS-bnYYp.mjs';
6
- import { i as readSessionMetadata, e as sessionWebUrl, j as isValidSpawnOrigin, k as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS, m as waitForSessionKey, d as sendUserMessage } from './index-CIyjJy8D.mjs';
4
+ import { f as forkSession, g as getProjectPath, F as ForkSourceMissingError, C as CodexAppServerClient, h as forkCodexThread, j as checkIfDaemonRunningAndCleanupStaleState, s as spawnDaemonSession, k as stopDaemonSession } from './types-BvqOVUOW.mjs';
5
+ import { d as readPersistedSessions, l as logger } from './limits-BtAuKRl2.mjs';
6
+ import { k as readSessionMetadata, m as resolveSpawnPermissionMode, e as sessionWebUrl, n as resolveFirstMessageMeta, o as isValidSpawnOrigin, i as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS, u as waitForSessionKey, d as sendUserMessage } from './index-BacwoXzs.mjs';
7
7
  import 'axios';
8
8
  import 'node:events';
9
9
  import 'socket.io-client';
10
10
  import 'zod';
11
- import '@paralleldrive/cuid2';
12
11
  import 'node:crypto';
13
12
  import 'child_process';
14
13
  import 'util';
@@ -16,9 +15,10 @@ import 'fs/promises';
16
15
  import 'crypto';
17
16
  import 'path';
18
17
  import 'cross-spawn';
19
- import './projectPath-CSpqWdxp.mjs';
18
+ import './terminalTitleSuggest-DKgX3osW.mjs';
20
19
  import 'url';
21
20
  import 'os';
21
+ import '@paralleldrive/cuid2';
22
22
  import 'node:fs/promises';
23
23
  import 'node:os';
24
24
  import 'node:child_process';
@@ -29,7 +29,7 @@ import 'node:readline';
29
29
  import '@anthropic-ai/sandbox-runtime';
30
30
  import 'expo-server-sdk';
31
31
  import 'node:util';
32
- import './agentGuidance-Dvo3cZMW.mjs';
32
+ import './agentGuidance-C8unGWp7.mjs';
33
33
  import 'ink';
34
34
  import 'react';
35
35
  import '@anthropic-ai/claude-agent-sdk';
@@ -47,31 +47,6 @@ import 'inquirer';
47
47
  import 'node:url';
48
48
  import 'node:readline/promises';
49
49
 
50
- function resolveSpawnPermissionMode(agent, explicit) {
51
- return getAgentCodeDefaults(agent ?? "claude").permissionMode;
52
- }
53
- function outboundPermissionMode(agent, mode) {
54
- const key = normalizeAgentKey(agent ?? "claude");
55
- if ((key === "claude" || key === "pi") && mode === "yolo") return "bypassPermissions";
56
- return mode;
57
- }
58
- function resolveFirstMessageMeta(input) {
59
- const meta = {
60
- permissionMode: outboundPermissionMode(input.agent, input.permissionMode)
61
- };
62
- if (input.explicitModel !== void 0) {
63
- meta.model = input.explicitModel === "default" ? null : input.explicitModel;
64
- }
65
- if (normalizeAgentKey(input.agent ?? "claude") !== "claude") return meta;
66
- if (meta.model === void 0) {
67
- const model = getAgentCodeDefaults("claude").modelMode;
68
- const runnable = !isClaudeOpus55Model(model) || supportsClaudeOpus55({ capabilities: input.capabilities ?? null });
69
- meta.model = runnable && model !== "default" ? model : null;
70
- }
71
- meta.effort = null;
72
- return meta;
73
- }
74
-
75
50
  function nonEmpty(value) {
76
51
  return typeof value === "string" && value.trim().length > 0;
77
52
  }
@@ -282,7 +257,7 @@ async function handleSpawnCommand(args) {
282
257
  }
283
258
  const directory = forkSource ? forkSource.directory : resolve(options.dir);
284
259
  const agent = forkSource ? forkSource.agent : options.agent;
285
- const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? resolveSpawnPermissionMode(agent);
260
+ const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? resolveSpawnPermissionMode(agent, void 0);
286
261
  let prompt = options.prompt;
287
262
  if (options.promptFile !== void 0) {
288
263
  try {
@@ -3,14 +3,13 @@
3
3
  var chalk = require('chalk');
4
4
  var node_fs = require('node:fs');
5
5
  var path = require('node:path');
6
- var index$1 = require('./types-CPubg05Z.cjs');
7
- var persistence = require('./limits-DwcY3kyi.cjs');
8
- var index = require('./index-CqtfRzug.cjs');
6
+ var index$1 = require('./types-CUCU7Vw8.cjs');
7
+ var persistence = require('./limits-DY_sFA3J.cjs');
8
+ var index = require('./index-DHrwHxHf.cjs');
9
9
  require('axios');
10
10
  require('node:events');
11
11
  require('socket.io-client');
12
12
  require('zod');
13
- require('@paralleldrive/cuid2');
14
13
  require('node:crypto');
15
14
  require('child_process');
16
15
  require('util');
@@ -18,9 +17,10 @@ require('fs/promises');
18
17
  require('crypto');
19
18
  require('path');
20
19
  require('cross-spawn');
21
- require('./projectPath-ChLhdOyt.cjs');
20
+ require('./terminalTitleSuggest-Dji8I0Jy.cjs');
22
21
  require('url');
23
22
  require('os');
23
+ require('@paralleldrive/cuid2');
24
24
  require('node:fs/promises');
25
25
  require('node:os');
26
26
  require('node:child_process');
@@ -31,7 +31,7 @@ require('node:readline');
31
31
  require('@anthropic-ai/sandbox-runtime');
32
32
  require('expo-server-sdk');
33
33
  require('node:util');
34
- require('./agentGuidance-BXa9ikrZ.cjs');
34
+ require('./agentGuidance-BM4kMNyr.cjs');
35
35
  require('ink');
36
36
  require('react');
37
37
  require('@anthropic-ai/claude-agent-sdk');
@@ -49,31 +49,6 @@ require('inquirer');
49
49
  require('node:url');
50
50
  require('node:readline/promises');
51
51
 
52
- function resolveSpawnPermissionMode(agent, explicit) {
53
- return index$1.getAgentCodeDefaults(agent ?? "claude").permissionMode;
54
- }
55
- function outboundPermissionMode(agent, mode) {
56
- const key = index$1.normalizeAgentKey(agent ?? "claude");
57
- if ((key === "claude" || key === "pi") && mode === "yolo") return "bypassPermissions";
58
- return mode;
59
- }
60
- function resolveFirstMessageMeta(input) {
61
- const meta = {
62
- permissionMode: outboundPermissionMode(input.agent, input.permissionMode)
63
- };
64
- if (input.explicitModel !== void 0) {
65
- meta.model = input.explicitModel === "default" ? null : input.explicitModel;
66
- }
67
- if (index$1.normalizeAgentKey(input.agent ?? "claude") !== "claude") return meta;
68
- if (meta.model === void 0) {
69
- const model = index$1.getAgentCodeDefaults("claude").modelMode;
70
- const runnable = !index$1.isClaudeOpus55Model(model) || index$1.supportsClaudeOpus55({ capabilities: input.capabilities ?? null });
71
- meta.model = runnable && model !== "default" ? model : null;
72
- }
73
- meta.effort = null;
74
- return meta;
75
- }
76
-
77
52
  function nonEmpty(value) {
78
53
  return typeof value === "string" && value.trim().length > 0;
79
54
  }
@@ -284,7 +259,7 @@ async function handleSpawnCommand(args) {
284
259
  }
285
260
  const directory = forkSource ? forkSource.directory : path.resolve(options.dir);
286
261
  const agent = forkSource ? forkSource.agent : options.agent;
287
- const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? resolveSpawnPermissionMode(agent);
262
+ const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? index.resolveSpawnPermissionMode(agent, void 0);
288
263
  let prompt = options.prompt;
289
264
  if (options.promptFile !== void 0) {
290
265
  try {
@@ -350,7 +325,7 @@ async function handleSpawnCommand(args) {
350
325
  let sentMeta = null;
351
326
  if (prompt !== void 0) {
352
327
  try {
353
- sentMeta = await sendFirstMessage(sessionId, prompt, (capabilities) => resolveFirstMessageMeta({
328
+ sentMeta = await sendFirstMessage(sessionId, prompt, (capabilities) => index.resolveFirstMessageMeta({
354
329
  agent,
355
330
  permissionMode,
356
331
  explicitModel: options.model,
@@ -1,27 +1,28 @@
1
1
  import { homedir } from 'node:os';
2
- import { unlink, rmdir, mkdir, lstat, readFile, writeFile, rename } from 'node:fs/promises';
2
+ import { readFile } from 'node:fs/promises';
3
3
  import { z } from 'zod';
4
- import { createHash, randomUUID } from 'node:crypto';
5
- import { d as teamRequest, e as createTeamsClient } from './agentGuidance-Dvo3cZMW.mjs';
6
- import { e as readCredentialsForConfiguredRelay } from './limits-DS-bnYYp.mjs';
7
- import { join, resolve, dirname } from 'node:path';
8
- import { N as TEAM_SKILL } from './index-CIyjJy8D.mjs';
4
+ import { randomUUID } from 'node:crypto';
5
+ import { g as teamRequest, h as createTeamsClient } from './agentGuidance-C8unGWp7.mjs';
6
+ import { f as readCredentialsForConfiguredRelay } from './limits-BtAuKRl2.mjs';
7
+ import { a as installTeamSkill, i as installAutomationSkill } from './install-Ca7_Z3bV.mjs';
9
8
  import 'node:fs';
9
+ import 'node:path';
10
10
  import 'tweetnacl';
11
11
  import 'chalk';
12
12
  import 'node:util';
13
- import './types-BN3eiipi.mjs';
13
+ import '@paralleldrive/cuid2';
14
+ import './index-BacwoXzs.mjs';
15
+ import './types-BvqOVUOW.mjs';
14
16
  import 'axios';
15
17
  import 'node:events';
16
18
  import 'socket.io-client';
17
- import '@paralleldrive/cuid2';
18
19
  import 'child_process';
19
20
  import 'util';
20
21
  import 'fs/promises';
21
22
  import 'crypto';
22
23
  import 'path';
23
24
  import 'cross-spawn';
24
- import './projectPath-CSpqWdxp.mjs';
25
+ import './terminalTitleSuggest-DKgX3osW.mjs';
25
26
  import 'url';
26
27
  import 'os';
27
28
  import 'node:child_process';
@@ -98,69 +99,6 @@ async function setTeamPermissionMode(teamId, mode, requestId) {
98
99
  return safe;
99
100
  }
100
101
 
101
- async function assertPrivateDestination(directory) {
102
- for (let path = directory; ; path = dirname(path)) {
103
- try {
104
- const stat = await lstat(path);
105
- if (stat.isSymbolicLink() || !stat.isDirectory()) throw new Error("Refusing symlink or non-directory in managed skill destination: " + path);
106
- } catch (error) {
107
- if (error.code !== "ENOENT") throw error;
108
- }
109
- if (dirname(path) === path) break;
110
- }
111
- }
112
- const digest = (text) => createHash("sha256").update(text).digest("hex");
113
- async function read(path) {
114
- try {
115
- const stat = await lstat(path);
116
- if (!stat.isFile() || stat.isSymbolicLink()) throw new Error("Refusing non-regular managed file");
117
- return await readFile(path, "utf8");
118
- } catch (error) {
119
- if (error.code === "ENOENT") return null;
120
- throw error;
121
- }
122
- }
123
- async function publish(path, content) {
124
- const temporary = `${path}.${randomUUID()}.new`;
125
- try {
126
- await writeFile(temporary, content, { flag: "wx", mode: 384 });
127
- await rename(temporary, path);
128
- } finally {
129
- await unlink(temporary).catch(() => {
130
- });
131
- }
132
- }
133
- async function installTeamSkill(options) {
134
- const directory = join(resolve(options.home), ".local", "share", "very-happy", "skills", "very-happy-teams");
135
- await assertPrivateDestination(directory);
136
- const file = join(directory, "SKILL.md");
137
- const manifest = join(directory, ".very-happy-managed.json");
138
- const current = await read(file);
139
- const managed = await read(manifest);
140
- const previous = managed ? JSON.parse(managed) : null;
141
- if (previous && previous.owner !== "very-happy") throw new Error("Existing manifest is not owned by Very Happy");
142
- if (current !== null && (!previous || previous.owner !== "very-happy" || previous.sha256 !== digest(current) && previous.pendingSha256 !== digest(current))) {
143
- throw new Error("Existing skill is not owned by Very Happy or was edited; preserve it and resolve manually");
144
- }
145
- const action = options.uninstall ? current === null && managed === null ? "unchanged" : "remove" : current === TEAM_SKILL && !previous?.pendingSha256 ? "unchanged" : "write";
146
- if (options.apply && action !== "unchanged") {
147
- await assertPrivateDestination(directory);
148
- if (options.uninstall) {
149
- if (current !== null) await unlink(file);
150
- if (managed !== null) await unlink(manifest);
151
- await rmdir(directory).catch(() => {
152
- });
153
- } else {
154
- await mkdir(directory, { recursive: true });
155
- const nextHash = digest(TEAM_SKILL);
156
- await publish(manifest, JSON.stringify({ owner: "very-happy", sha256: current === null ? null : digest(current), pendingSha256: nextHash, version: 1 }));
157
- await publish(file, TEAM_SKILL);
158
- await publish(manifest, JSON.stringify({ owner: "very-happy", sha256: nextHash, version: 1 }));
159
- }
160
- }
161
- return { host: options.host, path: file, action, applied: !!options.apply, discovery: "No host skill directories are modified. Read this absolute skill path in a managed session.", managedSessions: "Team tools are injected by Very Happy. Standalone agents require a managed session connection." };
162
- }
163
-
164
102
  async function handleTeamsCommand(args) {
165
103
  const command = args[0];
166
104
  const value = (flag) => {
@@ -174,7 +112,12 @@ async function handleTeamsCommand(args) {
174
112
  if (command === "install" || command === "uninstall") {
175
113
  const host = value("--host");
176
114
  if (!host || !["claude", "codex", "pi"].includes(host)) throw new Error("--host must be claude, codex, or pi");
177
- console.log(JSON.stringify(await installTeamSkill({ host, home: value("--home") ?? homedir(), apply: args.includes("--apply"), uninstall: command === "uninstall" })));
115
+ const options = { host, home: value("--home") ?? homedir(), apply: args.includes("--apply"), uninstall: command === "uninstall" };
116
+ await installTeamSkill({ ...options, apply: false });
117
+ await installAutomationSkill({ ...options, apply: false });
118
+ const teams = await installTeamSkill(options);
119
+ const automations = await installAutomationSkill(options);
120
+ console.log(JSON.stringify({ ...teams, also: [automations] }));
178
121
  return;
179
122
  }
180
123
  if (command === "doctor") {
@@ -4,26 +4,27 @@ var os = require('node:os');
4
4
  var promises = require('node:fs/promises');
5
5
  var z = require('zod');
6
6
  var node_crypto = require('node:crypto');
7
- var agentGuidance = require('./agentGuidance-BXa9ikrZ.cjs');
8
- var persistence = require('./limits-DwcY3kyi.cjs');
9
- var path = require('node:path');
10
- var index = require('./index-CqtfRzug.cjs');
7
+ var agentGuidance = require('./agentGuidance-BM4kMNyr.cjs');
8
+ var persistence = require('./limits-DY_sFA3J.cjs');
9
+ var install = require('./install-BiOXBnnS.cjs');
11
10
  require('node:fs');
11
+ require('node:path');
12
12
  require('tweetnacl');
13
13
  require('chalk');
14
14
  require('node:util');
15
- require('./types-CPubg05Z.cjs');
15
+ require('@paralleldrive/cuid2');
16
+ require('./index-DHrwHxHf.cjs');
17
+ require('./types-CUCU7Vw8.cjs');
16
18
  require('axios');
17
19
  require('node:events');
18
20
  require('socket.io-client');
19
- require('@paralleldrive/cuid2');
20
21
  require('child_process');
21
22
  require('util');
22
23
  require('fs/promises');
23
24
  require('crypto');
24
25
  require('path');
25
26
  require('cross-spawn');
26
- require('./projectPath-ChLhdOyt.cjs');
27
+ require('./terminalTitleSuggest-Dji8I0Jy.cjs');
27
28
  require('url');
28
29
  require('os');
29
30
  require('node:child_process');
@@ -100,69 +101,6 @@ async function setTeamPermissionMode(teamId, mode, requestId) {
100
101
  return safe;
101
102
  }
102
103
 
103
- async function assertPrivateDestination(directory) {
104
- for (let path$1 = directory; ; path$1 = path.dirname(path$1)) {
105
- try {
106
- const stat = await promises.lstat(path$1);
107
- if (stat.isSymbolicLink() || !stat.isDirectory()) throw new Error("Refusing symlink or non-directory in managed skill destination: " + path$1);
108
- } catch (error) {
109
- if (error.code !== "ENOENT") throw error;
110
- }
111
- if (path.dirname(path$1) === path$1) break;
112
- }
113
- }
114
- const digest = (text) => node_crypto.createHash("sha256").update(text).digest("hex");
115
- async function read(path) {
116
- try {
117
- const stat = await promises.lstat(path);
118
- if (!stat.isFile() || stat.isSymbolicLink()) throw new Error("Refusing non-regular managed file");
119
- return await promises.readFile(path, "utf8");
120
- } catch (error) {
121
- if (error.code === "ENOENT") return null;
122
- throw error;
123
- }
124
- }
125
- async function publish(path, content) {
126
- const temporary = `${path}.${node_crypto.randomUUID()}.new`;
127
- try {
128
- await promises.writeFile(temporary, content, { flag: "wx", mode: 384 });
129
- await promises.rename(temporary, path);
130
- } finally {
131
- await promises.unlink(temporary).catch(() => {
132
- });
133
- }
134
- }
135
- async function installTeamSkill(options) {
136
- const directory = path.join(path.resolve(options.home), ".local", "share", "very-happy", "skills", "very-happy-teams");
137
- await assertPrivateDestination(directory);
138
- const file = path.join(directory, "SKILL.md");
139
- const manifest = path.join(directory, ".very-happy-managed.json");
140
- const current = await read(file);
141
- const managed = await read(manifest);
142
- const previous = managed ? JSON.parse(managed) : null;
143
- if (previous && previous.owner !== "very-happy") throw new Error("Existing manifest is not owned by Very Happy");
144
- if (current !== null && (!previous || previous.owner !== "very-happy" || previous.sha256 !== digest(current) && previous.pendingSha256 !== digest(current))) {
145
- throw new Error("Existing skill is not owned by Very Happy or was edited; preserve it and resolve manually");
146
- }
147
- const action = options.uninstall ? current === null && managed === null ? "unchanged" : "remove" : current === index.TEAM_SKILL && !previous?.pendingSha256 ? "unchanged" : "write";
148
- if (options.apply && action !== "unchanged") {
149
- await assertPrivateDestination(directory);
150
- if (options.uninstall) {
151
- if (current !== null) await promises.unlink(file);
152
- if (managed !== null) await promises.unlink(manifest);
153
- await promises.rmdir(directory).catch(() => {
154
- });
155
- } else {
156
- await promises.mkdir(directory, { recursive: true });
157
- const nextHash = digest(index.TEAM_SKILL);
158
- await publish(manifest, JSON.stringify({ owner: "very-happy", sha256: current === null ? null : digest(current), pendingSha256: nextHash, version: 1 }));
159
- await publish(file, index.TEAM_SKILL);
160
- await publish(manifest, JSON.stringify({ owner: "very-happy", sha256: nextHash, version: 1 }));
161
- }
162
- }
163
- return { host: options.host, path: file, action, applied: !!options.apply, discovery: "No host skill directories are modified. Read this absolute skill path in a managed session.", managedSessions: "Team tools are injected by Very Happy. Standalone agents require a managed session connection." };
164
- }
165
-
166
104
  async function handleTeamsCommand(args) {
167
105
  const command = args[0];
168
106
  const value = (flag) => {
@@ -176,7 +114,12 @@ async function handleTeamsCommand(args) {
176
114
  if (command === "install" || command === "uninstall") {
177
115
  const host = value("--host");
178
116
  if (!host || !["claude", "codex", "pi"].includes(host)) throw new Error("--host must be claude, codex, or pi");
179
- console.log(JSON.stringify(await installTeamSkill({ host, home: value("--home") ?? os.homedir(), apply: args.includes("--apply"), uninstall: command === "uninstall" })));
117
+ const options = { host, home: value("--home") ?? os.homedir(), apply: args.includes("--apply"), uninstall: command === "uninstall" };
118
+ await install.installTeamSkill({ ...options, apply: false });
119
+ await install.installAutomationSkill({ ...options, apply: false });
120
+ const teams = await install.installTeamSkill(options);
121
+ const automations = await install.installAutomationSkill(options);
122
+ console.log(JSON.stringify({ ...teams, also: [automations] }));
180
123
  return;
181
124
  }
182
125
  if (command === "doctor") {
@@ -0,0 +1,38 @@
1
+ import { dirname, resolve } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import { z } from 'zod';
4
+
5
+ const __dirname$1 = dirname(fileURLToPath(import.meta.url));
6
+ function projectPath() {
7
+ const path = resolve(__dirname$1, "..");
8
+ return path;
9
+ }
10
+
11
+ const TERMINAL_TITLE_SUGGEST_METHOD = "very-happy/terminal-title-suggest";
12
+ const TerminalTitleSuggestRequestSchema = z.object({
13
+ method: z.literal(TERMINAL_TITLE_SUGGEST_METHOD),
14
+ params: z.object({
15
+ /** The user's first prompt; the bridge samples its head (buildPrompt). */
16
+ prompt: z.string().min(1).max(2e4)
17
+ })
18
+ });
19
+ const TerminalTitleSuggestResultSchema = z.object({
20
+ /** Sanitized title, or null when nothing usable came back (keep the old title). */
21
+ title: z.string().nullable()
22
+ });
23
+ function baseName(cwd) {
24
+ const trimmed = cwd.replace(/[\\/]+$/, "");
25
+ const idx = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
26
+ return idx >= 0 ? trimmed.slice(idx + 1) : trimmed;
27
+ }
28
+ function piSessionNameFromTitle(title, cwd) {
29
+ const m = /^(?:π|pi) - (.+)$/u.exec(title);
30
+ if (!m || !cwd) return void 0;
31
+ const suffix = ` - ${baseName(cwd)}`;
32
+ const rest = m[1];
33
+ if (!rest.endsWith(suffix)) return void 0;
34
+ const name = rest.slice(0, -suffix.length).trim();
35
+ return name || void 0;
36
+ }
37
+
38
+ export { TERMINAL_TITLE_SUGGEST_METHOD as T, TerminalTitleSuggestResultSchema as a, TerminalTitleSuggestRequestSchema as b, piSessionNameFromTitle as c, projectPath as p };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var url = require('url');
5
+ var z = require('zod');
6
+
7
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
+ const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('terminalTitleSuggest-Dji8I0Jy.cjs', document.baseURI).href))));
9
+ function projectPath() {
10
+ const path$1 = path.resolve(__dirname$1, "..");
11
+ return path$1;
12
+ }
13
+
14
+ const TERMINAL_TITLE_SUGGEST_METHOD = "very-happy/terminal-title-suggest";
15
+ const TerminalTitleSuggestRequestSchema = z.z.object({
16
+ method: z.z.literal(TERMINAL_TITLE_SUGGEST_METHOD),
17
+ params: z.z.object({
18
+ /** The user's first prompt; the bridge samples its head (buildPrompt). */
19
+ prompt: z.z.string().min(1).max(2e4)
20
+ })
21
+ });
22
+ const TerminalTitleSuggestResultSchema = z.z.object({
23
+ /** Sanitized title, or null when nothing usable came back (keep the old title). */
24
+ title: z.z.string().nullable()
25
+ });
26
+ function baseName(cwd) {
27
+ const trimmed = cwd.replace(/[\\/]+$/, "");
28
+ const idx = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
29
+ return idx >= 0 ? trimmed.slice(idx + 1) : trimmed;
30
+ }
31
+ function piSessionNameFromTitle(title, cwd) {
32
+ const m = /^(?:π|pi) - (.+)$/u.exec(title);
33
+ if (!m || !cwd) return void 0;
34
+ const suffix = ` - ${baseName(cwd)}`;
35
+ const rest = m[1];
36
+ if (!rest.endsWith(suffix)) return void 0;
37
+ const name = rest.slice(0, -suffix.length).trim();
38
+ return name || void 0;
39
+ }
40
+
41
+ exports.TERMINAL_TITLE_SUGGEST_METHOD = TERMINAL_TITLE_SUGGEST_METHOD;
42
+ exports.TerminalTitleSuggestRequestSchema = TerminalTitleSuggestRequestSchema;
43
+ exports.TerminalTitleSuggestResultSchema = TerminalTitleSuggestResultSchema;
44
+ exports.piSessionNameFromTitle = piSessionNameFromTitle;
45
+ exports.projectPath = projectPath;
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./limits-DwcY3kyi.cjs');
4
- var index = require('./types-CPubg05Z.cjs');
5
- var agentGuidance = require('./agentGuidance-BXa9ikrZ.cjs');
3
+ var persistence = require('./limits-DY_sFA3J.cjs');
4
+ var agentGuidance = require('./agentGuidance-BM4kMNyr.cjs');
6
5
  require('node:fs/promises');
7
6
  require('node:fs');
8
7
  require('node:os');
@@ -12,25 +11,7 @@ require('node:crypto');
12
11
  require('tweetnacl');
13
12
  require('chalk');
14
13
  require('node:util');
15
- require('axios');
16
- require('node:events');
17
- require('socket.io-client');
18
14
  require('@paralleldrive/cuid2');
19
- require('child_process');
20
- require('util');
21
- require('fs/promises');
22
- require('crypto');
23
- require('path');
24
- require('cross-spawn');
25
- require('./projectPath-ChLhdOyt.cjs');
26
- require('url');
27
- require('os');
28
- require('node:child_process');
29
- require('node-pty');
30
- require('fs');
31
- require('node:readline');
32
- require('@anthropic-ai/sandbox-runtime');
33
- require('expo-server-sdk');
34
15
 
35
16
  async function authenticatedBuiltinTodoClient() {
36
17
  if (process.env.VH_TEAM_SCOPE_FILE !== void 0) {
@@ -42,7 +23,7 @@ async function authenticatedBuiltinTodoClient() {
42
23
  }
43
24
  const credentials = await persistence.readCredentialsForConfiguredRelay();
44
25
  if (!credentials) throw new Error("Sign in to Very Happy with `very-happy auth login` before accessing Todos.");
45
- return index.createBuiltinTodoClient(credentials, { serverUrl: persistence.configuration.serverUrl, clientId: "very-happy-cli-todo" });
26
+ return persistence.createBuiltinTodoClient(credentials, { serverUrl: persistence.configuration.serverUrl, clientId: "very-happy-cli-todo" });
46
27
  }
47
28
 
48
29
  const TODO_HELP = `very-happy todo \u2014 account-owned built-in Todos (JSON output)
@@ -106,7 +87,7 @@ async function handleTodoCommand(args) {
106
87
  return;
107
88
  }
108
89
  if (command.action === "skill") {
109
- console.log(index.BUILTIN_TODO_SKILL);
90
+ console.log(persistence.BUILTIN_TODO_SKILL);
110
91
  return;
111
92
  }
112
93
  const client = await authenticatedBuiltinTodoClient();
@@ -1,6 +1,5 @@
1
- import { e as readCredentialsForConfiguredRelay, c as configuration } from './limits-DS-bnYYp.mjs';
2
- import { f as createBuiltinTodoClient, B as BUILTIN_TODO_SKILL } from './types-BN3eiipi.mjs';
3
- import { c as readTeamScope, t as teamScopePath } from './agentGuidance-Dvo3cZMW.mjs';
1
+ import { f as readCredentialsForConfiguredRelay, g as createBuiltinTodoClient, c as configuration, B as BUILTIN_TODO_SKILL } from './limits-BtAuKRl2.mjs';
2
+ import { f as readTeamScope, t as teamScopePath } from './agentGuidance-C8unGWp7.mjs';
4
3
  import 'node:fs/promises';
5
4
  import 'node:fs';
6
5
  import 'node:os';
@@ -10,25 +9,7 @@ import 'node:crypto';
10
9
  import 'tweetnacl';
11
10
  import 'chalk';
12
11
  import 'node:util';
13
- import 'axios';
14
- import 'node:events';
15
- import 'socket.io-client';
16
12
  import '@paralleldrive/cuid2';
17
- import 'child_process';
18
- import 'util';
19
- import 'fs/promises';
20
- import 'crypto';
21
- import 'path';
22
- import 'cross-spawn';
23
- import './projectPath-CSpqWdxp.mjs';
24
- import 'url';
25
- import 'os';
26
- import 'node:child_process';
27
- import 'node-pty';
28
- import 'fs';
29
- import 'node:readline';
30
- import '@anthropic-ai/sandbox-runtime';
31
- import 'expo-server-sdk';
32
13
 
33
14
  async function authenticatedBuiltinTodoClient() {
34
15
  if (process.env.VH_TEAM_SCOPE_FILE !== void 0) {