very-happy-cli 0.2.129 → 0.2.131

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 (45) hide show
  1. package/dist/{AcpBackend-MAU4POiE.mjs → AcpBackend-DSRZM4lo.mjs} +2 -2
  2. package/dist/{AcpBackend-kU2VqiYx.cjs → AcpBackend-Dv_EKDIQ.cjs} +2 -2
  3. package/dist/{AcpSessionManager-uSGDDRqF.mjs → AcpSessionManager-DtXOAeQ0.mjs} +1 -1
  4. package/dist/{AcpSessionManager-BWasT5jq.cjs → AcpSessionManager-r8SLweP4.cjs} +1 -1
  5. package/dist/{agentGuidance-B1PsijGg.cjs → agentGuidance-B4bH8Nuz.cjs} +1 -1
  6. package/dist/{agentGuidance-DlZ5s0Om.mjs → agentGuidance-CeuhVA2K.mjs} +1 -1
  7. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  8. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  9. package/dist/{config-_DKtp9qs.mjs → config-Ur8QEJ0U.mjs} +4 -4
  10. package/dist/{config-DswZvA8V.cjs → config-onxMcdX3.cjs} +4 -4
  11. package/dist/{index-dqKLs4dZ.cjs → index-B1hbB5R7.cjs} +14 -7
  12. package/dist/{index-BdZ7Dlg0.cjs → index-B5Vv72dN.cjs} +80 -24
  13. package/dist/{index-tr2Fqhby.mjs → index-BPYVCjjs.mjs} +76 -20
  14. package/dist/{index-1QwKRLYG.mjs → index-BXB-84P_.mjs} +4 -4
  15. package/dist/{index-lwOIU7K9.cjs → index-BjctcFpG.cjs} +4 -4
  16. package/dist/{index-FMMrmSa2.mjs → index-CsfUI8Bw.mjs} +15 -8
  17. package/dist/index.cjs +4 -4
  18. package/dist/index.mjs +4 -4
  19. package/dist/{installTerminalHooks-B3a0ugvz.mjs → installTerminalHooks-DLwx6m7I.mjs} +4 -4
  20. package/dist/{installTerminalHooks-CV2LAKXO.cjs → installTerminalHooks-IaEGKZDR.cjs} +4 -4
  21. package/dist/lib.cjs +2 -2
  22. package/dist/lib.d.cts +34 -22
  23. package/dist/lib.d.mts +34 -22
  24. package/dist/lib.mjs +2 -2
  25. package/dist/{limits-C41sn_OJ.mjs → limits-BusZ5sPV.mjs} +7 -7
  26. package/dist/{limits-B5wJ5Slz.cjs → limits-C9bJJEyR.cjs} +7 -7
  27. package/dist/{mcp-BHNVwrwS.mjs → mcp-CZJM3obK.mjs} +4 -4
  28. package/dist/{mcp-B7lwVQT8.cjs → mcp-D4_4kl0R.cjs} +4 -4
  29. package/dist/{runGemini-gbflWQ3_.cjs → runGemini-CRoqO5Mf.cjs} +6 -6
  30. package/dist/{runGemini-FNZrH8yX.mjs → runGemini-DGHhBbmk.mjs} +6 -6
  31. package/dist/{runOpenClaw-CmhYI7OB.cjs → runOpenClaw-BzY__v8T.cjs} +5 -5
  32. package/dist/{runOpenClaw-3EF_Rqv_.mjs → runOpenClaw-Ca9ygi8M.mjs} +5 -5
  33. package/dist/{send-DV7IeBAv.mjs → send-B1lln_bW.mjs} +4 -4
  34. package/dist/{send-DqedYZtc.cjs → send-CkfdImmJ.cjs} +4 -4
  35. package/dist/{sessions-ieB0bLb5.mjs → sessions-Cyzh822v.mjs} +4 -4
  36. package/dist/{sessions-Bz243hZ9.cjs → sessions-D4cvTe7G.cjs} +4 -4
  37. package/dist/{spawn-CcqzmjhT.mjs → spawn-CdOt7Cv_.mjs} +4 -4
  38. package/dist/{spawn-BXwwueEs.cjs → spawn-ID9-RfTN.cjs} +4 -4
  39. package/dist/{teams-Bx79Wr9-.mjs → teams-Bf2D8dwL.mjs} +4 -4
  40. package/dist/{teams-BtI6h4Dw.cjs → teams-CZ9xg-Rv.cjs} +4 -4
  41. package/dist/{todo-CGRuBaiH.mjs → todo-9iv7_n7i.mjs} +3 -3
  42. package/dist/{todo-B-Kj9lXl.cjs → todo-DK3L93BC.cjs} +3 -3
  43. package/dist/{types-Ba9u0uZL.cjs → types-B20MYc5R.cjs} +11 -2
  44. package/dist/{types-BvYEAHds.mjs → types-lFZhC_6M.mjs} +10 -2
  45. package/package.json +7 -7
@@ -1,8 +1,8 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { l as logger, p as packageJson } from './limits-C41sn_OJ.mjs';
5
- import { d as contentLogMetadata, e as errorLogMetadata, h as delay } from './types-BvYEAHds.mjs';
4
+ import { l as logger, p as packageJson } from './limits-BusZ5sPV.mjs';
5
+ import { d as contentLogMetadata, e as errorLogMetadata, h as delay } from './types-lFZhC_6M.mjs';
6
6
 
7
7
  function acpImageBlocks(attachments, supportsImages) {
8
8
  return attachments.filter((file) => ["image/jpeg", "image/png", "image/gif", "image/webp"].includes(file.mimeType)).map((file) => {
@@ -3,8 +3,8 @@
3
3
  var node_child_process = require('node:child_process');
4
4
  var sdk = require('@agentclientprotocol/sdk');
5
5
  var node_crypto = require('node:crypto');
6
- var persistence = require('./limits-B5wJ5Slz.cjs');
7
- var api = require('./types-Ba9u0uZL.cjs');
6
+ var persistence = require('./limits-C9bJJEyR.cjs');
7
+ var api = require('./types-B20MYc5R.cjs');
8
8
 
9
9
  function acpImageBlocks(attachments, supportsImages) {
10
10
  return attachments.filter((file) => ["image/jpeg", "image/png", "image/gif", "image/webp"].includes(file.mimeType)).map((file) => {
@@ -1,5 +1,5 @@
1
1
  import { createId } from '@paralleldrive/cuid2';
2
- import { s as streamKeyOf, c as createEnvelope } from './types-BvYEAHds.mjs';
2
+ import { s as streamKeyOf, c as createEnvelope } from './types-lFZhC_6M.mjs';
3
3
 
4
4
  function turnOptions(turnId, time) {
5
5
  return turnId ? { turn: turnId, time } : { time };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var cuid2 = require('@paralleldrive/cuid2');
4
- var api = require('./types-Ba9u0uZL.cjs');
4
+ var api = require('./types-B20MYc5R.cjs');
5
5
 
6
6
  function turnOptions(turnId, time) {
7
7
  return turnId ? { turn: turnId, time } : { time };
@@ -2,7 +2,7 @@
2
2
 
3
3
  var z = require('zod');
4
4
  var node_crypto = require('node:crypto');
5
- var persistence = require('./limits-B5wJ5Slz.cjs');
5
+ var persistence = require('./limits-C9bJJEyR.cjs');
6
6
  var promises = require('node:fs/promises');
7
7
  var node_fs = require('node:fs');
8
8
  var path = require('node:path');
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { n as normalizeHttpEndpoint, c as configuration, g as readSettings, r as readPersistedSessions, d as readCredentialsForConfiguredRelay } from './limits-C41sn_OJ.mjs';
3
+ import { n as normalizeHttpEndpoint, c as configuration, g as readSettings, r as readPersistedSessions, d as readCredentialsForConfiguredRelay } from './limits-BusZ5sPV.mjs';
4
4
  import { open, mkdir, rename, unlink } from 'node:fs/promises';
5
5
  import { constants } from 'node:fs';
6
6
  import { isAbsolute, join, dirname } from 'node:path';
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var agentGuidance = require('../agentGuidance-B1PsijGg.cjs');
3
+ var agentGuidance = require('../agentGuidance-B4bH8Nuz.cjs');
4
4
  var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
5
5
  var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
6
6
  var index_js = require('@modelcontextprotocol/sdk/client/index.js');
7
7
  var streamableHttp_js = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
8
8
  var z = require('zod');
9
- var persistence = require('../limits-B5wJ5Slz.cjs');
9
+ var persistence = require('../limits-C9bJJEyR.cjs');
10
10
  require('node:crypto');
11
11
  require('node:fs/promises');
12
12
  require('node:fs');
@@ -1,10 +1,10 @@
1
- import { P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, r as registerTeamsTools } from '../agentGuidance-DlZ5s0Om.mjs';
1
+ import { P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, r as registerTeamsTools } from '../agentGuidance-CeuhVA2K.mjs';
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
4
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
5
5
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
6
6
  import { z } from 'zod';
7
- import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION } from '../limits-C41sn_OJ.mjs';
7
+ import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION } from '../limits-BusZ5sPV.mjs';
8
8
  import 'node:crypto';
9
9
  import 'node:fs/promises';
10
10
  import 'node:fs';
@@ -2,8 +2,8 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { homedir } from 'os';
4
4
  import { execSync } from 'child_process';
5
- import { l as logger } from './limits-C41sn_OJ.mjs';
6
- import { j as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-tr2Fqhby.mjs';
5
+ import { l as logger } from './limits-BusZ5sPV.mjs';
6
+ import { j as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-BPYVCjjs.mjs';
7
7
  import 'node:fs/promises';
8
8
  import 'node:fs';
9
9
  import 'node:os';
@@ -13,7 +13,7 @@ import 'node:crypto';
13
13
  import 'tweetnacl';
14
14
  import 'chalk';
15
15
  import 'node:util';
16
- import './types-BvYEAHds.mjs';
16
+ import './types-lFZhC_6M.mjs';
17
17
  import 'axios';
18
18
  import 'node:events';
19
19
  import 'socket.io-client';
@@ -28,7 +28,7 @@ import 'node-pty';
28
28
  import 'node:readline';
29
29
  import '@anthropic-ai/sandbox-runtime';
30
30
  import 'expo-server-sdk';
31
- import './agentGuidance-DlZ5s0Om.mjs';
31
+ import './agentGuidance-CeuhVA2K.mjs';
32
32
  import 'ink';
33
33
  import 'react';
34
34
  import '@anthropic-ai/claude-agent-sdk';
@@ -4,8 +4,8 @@ var fs = require('fs');
4
4
  var path = require('path');
5
5
  var os = require('os');
6
6
  var child_process = require('child_process');
7
- var persistence = require('./limits-B5wJ5Slz.cjs');
8
- var index = require('./index-BdZ7Dlg0.cjs');
7
+ var persistence = require('./limits-C9bJJEyR.cjs');
8
+ var index = require('./index-B5Vv72dN.cjs');
9
9
  require('node:fs/promises');
10
10
  require('node:fs');
11
11
  require('node:os');
@@ -15,7 +15,7 @@ require('node:crypto');
15
15
  require('tweetnacl');
16
16
  require('chalk');
17
17
  require('node:util');
18
- require('./types-Ba9u0uZL.cjs');
18
+ require('./types-B20MYc5R.cjs');
19
19
  require('axios');
20
20
  require('node:events');
21
21
  require('socket.io-client');
@@ -30,7 +30,7 @@ require('node-pty');
30
30
  require('node:readline');
31
31
  require('@anthropic-ai/sandbox-runtime');
32
32
  require('expo-server-sdk');
33
- require('./agentGuidance-B1PsijGg.cjs');
33
+ require('./agentGuidance-B4bH8Nuz.cjs');
34
34
  require('ink');
35
35
  require('react');
36
36
  require('@anthropic-ai/claude-agent-sdk');
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var AcpBackend = require('./AcpBackend-kU2VqiYx.cjs');
4
- var persistence = require('./limits-B5wJ5Slz.cjs');
5
- var AcpSessionManager = require('./AcpSessionManager-BWasT5jq.cjs');
6
- var api = require('./types-Ba9u0uZL.cjs');
7
- var index = require('./index-BdZ7Dlg0.cjs');
3
+ var AcpBackend = require('./AcpBackend-Dv_EKDIQ.cjs');
4
+ var persistence = require('./limits-C9bJJEyR.cjs');
5
+ var AcpSessionManager = require('./AcpSessionManager-r8SLweP4.cjs');
6
+ var api = require('./types-B20MYc5R.cjs');
7
+ var index = require('./index-B5Vv72dN.cjs');
8
8
  var promises = require('node:fs/promises');
9
9
  var node_crypto = require('node:crypto');
10
10
  var path = require('node:path');
@@ -33,7 +33,7 @@ require('fs');
33
33
  require('node:readline');
34
34
  require('@anthropic-ai/sandbox-runtime');
35
35
  require('expo-server-sdk');
36
- require('./agentGuidance-B1PsijGg.cjs');
36
+ require('./agentGuidance-B4bH8Nuz.cjs');
37
37
  require('ink');
38
38
  require('react');
39
39
  require('@anthropic-ai/claude-agent-sdk');
@@ -707,7 +707,13 @@ async function runAcp(opts) {
707
707
  return true;
708
708
  };
709
709
  const isAssistantVariant = process.env.HAPPY_SESSION_VARIANT === "assistant";
710
- const happyServer = await index.startHappyServer(session, { assistant: isAssistantVariant });
710
+ const happyServer = await index.startHappyServer(session, {
711
+ assistant: isAssistantVariant,
712
+ ...opts.agentName === "pi" ? { onContextUsage: (contextUsage) => {
713
+ session.updateAgentState((state2) => ({ ...state2, contextUsage }));
714
+ } } : {}
715
+ });
716
+ if (opts.agentName === "pi") session.updateAgentState((state2) => ({ ...state2, contextUsage: null }));
711
717
  const mcpServers = {
712
718
  happy: {
713
719
  command: path.join(api.projectPath(), "bin", "very-happy-mcp.mjs"),
@@ -723,6 +729,7 @@ async function runAcp(opts) {
723
729
  env: {
724
730
  ...teamsPiEnv,
725
731
  HAPPY_MCP_URL: happyServer.url,
732
+ ...happyServer.contextUsageUrl ? { HAPPY_CONTEXT_USAGE_URL: happyServer.contextUsageUrl } : {},
726
733
  HAPPY_SESSION_ID: session.sessionId,
727
734
  HAPPY_PERMISSION_MODE: initialPermissionMode
728
735
  },
@@ -3,13 +3,13 @@
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
5
  var node_crypto = require('node:crypto');
6
- var api = require('./types-Ba9u0uZL.cjs');
7
- var persistence = require('./limits-B5wJ5Slz.cjs');
6
+ var api = require('./types-B20MYc5R.cjs');
7
+ var persistence = require('./limits-C9bJJEyR.cjs');
8
8
  var spawn = require('cross-spawn');
9
9
  var path = require('node:path');
10
10
  var node_readline = require('node:readline');
11
11
  var node_fs = require('node:fs');
12
- var agentGuidance = require('./agentGuidance-B1PsijGg.cjs');
12
+ var agentGuidance = require('./agentGuidance-B4bH8Nuz.cjs');
13
13
  var promises = require('node:fs/promises');
14
14
  var fs = require('fs/promises');
15
15
  var ink = require('ink');
@@ -3417,6 +3417,16 @@ class StreamRelay {
3417
3417
  this.flushPending();
3418
3418
  this.closeOpenBlocks();
3419
3419
  this.currentMid = typeof mid === "string" && mid.length > 0 ? mid : null;
3420
+ const usage = e.message?.usage;
3421
+ if (usage || ["inputTokens", "cacheTokens", "outputTokens", "thinkingTokens"].some((key) => key in this.progress)) {
3422
+ const count = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : 0;
3423
+ this.setProgress({
3424
+ inputTokens: count(usage?.input_tokens),
3425
+ cacheTokens: count(usage?.cache_creation_input_tokens) + count(usage?.cache_read_input_tokens),
3426
+ outputTokens: count(usage?.output_tokens),
3427
+ thinkingTokens: 0
3428
+ });
3429
+ }
3420
3430
  return;
3421
3431
  }
3422
3432
  if (e.type === "content_block_start") {
@@ -7704,7 +7714,7 @@ function parseJsonObject(text) {
7704
7714
  return null;
7705
7715
  }
7706
7716
  }
7707
- function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BdZ7Dlg0.cjs', document.baseURI).href))).resolve(s)) {
7717
+ function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B5Vv72dN.cjs', document.baseURI).href))).resolve(s)) {
7708
7718
  const platformArch = `${platform}-${arch}`;
7709
7719
  const candidates = [
7710
7720
  `@anthropic-ai/claude-agent-sdk-${platformArch}/claude`,
@@ -8885,6 +8895,24 @@ export default async function(pi) {
8885
8895
  const {readFile} = await import('node:fs/promises');
8886
8896
  const {join} = await import('node:path');
8887
8897
  const {homedir} = await import('node:os');
8898
+ const contextEndpoint = process.env.HAPPY_CONTEXT_USAGE_URL;
8899
+ if (contextEndpoint) {
8900
+ const target = new URL(contextEndpoint);
8901
+ if (target.origin !== url.origin || !target.pathname.startsWith('/runtime-context/')) throw new Error('Very Happy context must be local');
8902
+ let reporting = Promise.resolve();
8903
+ for (const name of ['session_start', 'session_switch', 'session_compact', 'model_select', 'turn_end', 'agent_end']) {
8904
+ pi.on(name, async (_event, ctx) => {
8905
+ const usage = ctx.getContextUsage?.();
8906
+ const contextWindow = usage?.contextWindow ?? ctx.model?.contextWindow;
8907
+ if (!(contextWindow > 0)) return;
8908
+ const snapshot = {source:'pi', tokens:usage?.tokens ?? null, contextWindow};
8909
+ reporting = reporting.catch(() => {}).then(async () => {
8910
+ try { await fetch(contextEndpoint, {method:'POST', redirect:'error', headers:{'content-type':'application/json'}, body:JSON.stringify(snapshot), signal:AbortSignal.timeout(2000)}); } catch {}
8911
+ });
8912
+ await reporting;
8913
+ });
8914
+ }
8915
+ }
8888
8916
  pi.on('tool_call', async (event, ctx) => {
8889
8917
  let mode = process.env.HAPPY_PERMISSION_MODE || 'default';
8890
8918
  const sid = process.env.HAPPY_SESSION_ID;
@@ -9608,6 +9636,10 @@ function createTeamWorker(deps) {
9608
9636
  await deps.stopAndWait(op.sessionId);
9609
9637
  await archiveSession(op.sessionId);
9610
9638
  }
9639
+ if (team.archivedAt !== void 0) {
9640
+ await complete(op, receipt);
9641
+ return;
9642
+ }
9611
9643
  const origins = team.operations.filter((candidate) => candidate.type === "spawn" && candidate.botId === op.botId && candidate.generation === op.generation && candidate.sessionId === op.sessionId);
9612
9644
  if (origins.length !== 1) throw new Error("Original worktree ownership is unknown; manual reconciliation required");
9613
9645
  const resource = readReceipt(home, origins[0].id);
@@ -9692,7 +9724,7 @@ Use the teams tools to inspect current task state before acting. This message is
9692
9724
  const status = axios.isAxiosError(error) ? error.response?.status : void 0;
9693
9725
  if (status !== 404) deps.log("Teams schedule advancement unavailable; regular reconciliation continues");
9694
9726
  }
9695
- const { data } = await http.get("/v1/teams/operations", { params: { machineId: deps.machineId, schedulesVersion: 1, teamLaunchVersion: 1 } });
9727
+ const { data } = await http.get("/v1/teams/operations", { params: { machineId: deps.machineId, schedulesVersion: 1, teamLaunchVersion: 1, teamArchiveVersion: 1 } });
9696
9728
  knownSessionIds = new Set((data.teams ?? []).flatMap((team) => team.bots.flatMap((bot) => bot.sessionId ? [bot.sessionId] : [])));
9697
9729
  for (const op of data.operations) {
9698
9730
  if (closed) break;
@@ -11774,7 +11806,30 @@ async function startHappyServer(client, options) {
11774
11806
  }
11775
11807
  }
11776
11808
  };
11809
+ const contextPath = "/runtime-context/" + node_crypto.randomUUID();
11777
11810
  const server = node_http.createServer(async (req, res) => {
11811
+ if (req.url?.startsWith("/runtime-context/")) {
11812
+ if (!options?.onContextUsage || req.url !== contextPath || req.method !== "POST" || req.headers.origin) {
11813
+ res.writeHead(403).end();
11814
+ return;
11815
+ }
11816
+ try {
11817
+ let body = "";
11818
+ for await (const chunk of req) {
11819
+ body += chunk.toString();
11820
+ if (Buffer.byteLength(body) > 2048) {
11821
+ res.writeHead(413).end();
11822
+ return;
11823
+ }
11824
+ }
11825
+ const usage = api.ContextUsageSchema.parse({ ...JSON.parse(body), updatedAt: Date.now() });
11826
+ options.onContextUsage(usage);
11827
+ res.writeHead(204).end();
11828
+ } catch {
11829
+ if (!res.headersSent) res.writeHead(400).end();
11830
+ }
11831
+ return;
11832
+ }
11778
11833
  const mcp = createMcpServer(handlers, options, client.sessionId);
11779
11834
  try {
11780
11835
  const transport = new streamableHttp_js.StreamableHTTPServerTransport({
@@ -11808,6 +11863,7 @@ async function startHappyServer(client, options) {
11808
11863
  persistence.logger.debug(`[happyMCP] server:ready sessionId=${client.sessionId} url=${baseUrl.toString()}`);
11809
11864
  return {
11810
11865
  url: baseUrl.toString(),
11866
+ contextUsageUrl: options?.onContextUsage ? new URL(contextPath, baseUrl).toString() : void 0,
11811
11867
  toolNames: [
11812
11868
  "change_title",
11813
11869
  persistence.CLIPBOARD_TOOL_NAME,
@@ -12075,7 +12131,7 @@ function registerSideQuestionHandler(rpc, deps) {
12075
12131
  const retainMs = deps.retainMs ?? SIDE_QUESTION_RETAIN_MS;
12076
12132
  const maxRunMs = deps.maxRunMs ?? SIDE_QUESTION_MAX_RUN_MS;
12077
12133
  const run = deps.run ?? (async (input) => {
12078
- const { query } = await Promise.resolve().then(function () { return require('./index-lwOIU7K9.cjs'); });
12134
+ const { query } = await Promise.resolve().then(function () { return require('./index-BjctcFpG.cjs'); });
12079
12135
  return runSideQuestion(query, input);
12080
12136
  });
12081
12137
  const slots = /* @__PURE__ */ new Map();
@@ -12177,7 +12233,7 @@ const MAX_TITLE_CHARS = 60;
12177
12233
  const GENERATION_TIMEOUT_MS = 3e4;
12178
12234
  function resolveClaudeBinary() {
12179
12235
  try {
12180
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BdZ7Dlg0.cjs', document.baseURI).href)));
12236
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B5Vv72dN.cjs', document.baseURI).href)));
12181
12237
  const utilsPath = path.resolve(path.join(api.projectPath(), "scripts", "claude_version_utils.cjs"));
12182
12238
  const { getClaudeCliPath } = require$1(utilsPath);
12183
12239
  const path$1 = getClaudeCliPath();
@@ -14395,9 +14451,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
14395
14451
  };
14396
14452
  }
14397
14453
 
14398
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BdZ7Dlg0.cjs', document.baseURI).href)));
14454
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B5Vv72dN.cjs', document.baseURI).href)));
14399
14455
  const __dirname$1 = path.dirname(__filename$1);
14400
- const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BdZ7Dlg0.cjs', document.baseURI).href)));
14456
+ const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B5Vv72dN.cjs', document.baseURI).href)));
14401
14457
  const PRISMA_QUERY_ENGINE_FILES = {
14402
14458
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
14403
14459
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -17092,7 +17148,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17092
17148
  process.exit(0);
17093
17149
  } else if (subcommand === "install-terminal-hooks") {
17094
17150
  try {
17095
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-CV2LAKXO.cjs'); });
17151
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-IaEGKZDR.cjs'); });
17096
17152
  const command = parseTerminalHooksArgs(args.slice(1));
17097
17153
  if (command.action === "help") {
17098
17154
  console.log(TERMINAL_HOOKS_HELP);
@@ -17109,7 +17165,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17109
17165
  }
17110
17166
  } else if (subcommand === "spawn") {
17111
17167
  try {
17112
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-BXwwueEs.cjs'); });
17168
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-ID9-RfTN.cjs'); });
17113
17169
  await handleSpawnCommand(args.slice(1));
17114
17170
  } catch (error) {
17115
17171
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -17121,7 +17177,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17121
17177
  return;
17122
17178
  } else if (subcommand === "sessions") {
17123
17179
  try {
17124
- const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-Bz243hZ9.cjs'); });
17180
+ const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-D4cvTe7G.cjs'); });
17125
17181
  await handleSessionsCommand(args.slice(1));
17126
17182
  } catch (error) {
17127
17183
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -17133,7 +17189,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17133
17189
  return;
17134
17190
  } else if (subcommand === "send") {
17135
17191
  try {
17136
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-DqedYZtc.cjs'); });
17192
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-CkfdImmJ.cjs'); });
17137
17193
  await handleSendCommand(args.slice(1));
17138
17194
  } catch (error) {
17139
17195
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -17239,9 +17295,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17239
17295
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
17240
17296
  const projectId = args[3];
17241
17297
  try {
17242
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-DswZvA8V.cjs'); });
17243
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-B5wJ5Slz.cjs'); }).then(function (n) { return n.persistence; });
17244
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-Ba9u0uZL.cjs'); }).then(function (n) { return n.api; });
17298
+ const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-onxMcdX3.cjs'); });
17299
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-C9bJJEyR.cjs'); }).then(function (n) { return n.persistence; });
17300
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-B20MYc5R.cjs'); }).then(function (n) { return n.api; });
17245
17301
  let userEmail = void 0;
17246
17302
  try {
17247
17303
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -17272,7 +17328,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17272
17328
  }
17273
17329
  if (geminiSubcommand === "project" && args[2] === "get") {
17274
17330
  try {
17275
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DswZvA8V.cjs'); });
17331
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-onxMcdX3.cjs'); });
17276
17332
  const config = readGeminiLocalConfig();
17277
17333
  if (config.googleCloudProject) {
17278
17334
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -17312,7 +17368,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17312
17368
  process.exit(0);
17313
17369
  }
17314
17370
  try {
17315
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-gbflWQ3_.cjs'); });
17371
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CRoqO5Mf.cjs'); });
17316
17372
  let startedBy = void 0;
17317
17373
  for (let i = 1; i < args.length; i++) {
17318
17374
  if (args[i] === "--started-by") {
@@ -17342,7 +17398,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17342
17398
  }
17343
17399
  };
17344
17400
  try {
17345
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-dqKLs4dZ.cjs'); });
17401
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-B1hbB5R7.cjs'); });
17346
17402
  const parsed = parsePiRunnerArgs(args.slice(1));
17347
17403
  const resolved = resolveAcpAgentConfig(["pi", ...parsed.passthrough]);
17348
17404
  const { credentials } = await authAndSetupMachineIfNeeded();
@@ -17370,7 +17426,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17370
17426
  return;
17371
17427
  } else if (subcommand === "acp") {
17372
17428
  try {
17373
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-dqKLs4dZ.cjs'); });
17429
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-B1hbB5R7.cjs'); });
17374
17430
  let startedBy = void 0;
17375
17431
  let verbose = false;
17376
17432
  const acpArgs = [];
@@ -17410,7 +17466,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17410
17466
  return;
17411
17467
  } else if (subcommand === "openclaw") {
17412
17468
  try {
17413
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-CmhYI7OB.cjs'); });
17469
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-BzY__v8T.cjs'); });
17414
17470
  let startedBy = void 0;
17415
17471
  let verbose = false;
17416
17472
  let gatewayUrl;
@@ -17461,7 +17517,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17461
17517
  return;
17462
17518
  } else if (subcommand === "todo") {
17463
17519
  try {
17464
- const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-B-Kj9lXl.cjs'); });
17520
+ const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-DK3L93BC.cjs'); });
17465
17521
  await handleTodoCommand(args.slice(1));
17466
17522
  } catch (error) {
17467
17523
  console.error(JSON.stringify({ error: error instanceof Error ? error.message : "Todo command failed" }));
@@ -17470,7 +17526,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17470
17526
  return;
17471
17527
  } else if (subcommand === "teams") {
17472
17528
  try {
17473
- const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-BtI6h4Dw.cjs'); });
17529
+ const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-CZ9xg-Rv.cjs'); });
17474
17530
  await handleTeamsCommand(args.slice(1));
17475
17531
  } catch (error) {
17476
17532
  console.error(error instanceof Error ? error.message : "Teams command failed");
@@ -17479,7 +17535,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17479
17535
  return;
17480
17536
  } else if (subcommand === "mcp" && args.length === 1) {
17481
17537
  try {
17482
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-B7lwVQT8.cjs'); });
17538
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-D4_4kl0R.cjs'); });
17483
17539
  await handleMcpCommand();
17484
17540
  } catch (error) {
17485
17541
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}