happy-imou-cloud 2.1.21 → 2.1.23

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 (26) hide show
  1. package/dist/{BaseReasoningProcessor-DdPnQSmQ.mjs → BaseReasoningProcessor-By0QiYEu.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DxFwO2z9.cjs → BaseReasoningProcessor-_EHQVXKN.cjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-B5Aq5gA_.cjs → ProviderSelectionHandler-BSzm8oJH.cjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-DQITIqZK.mjs → ProviderSelectionHandler-XwkBLKvY.mjs} +2 -2
  5. package/dist/{api-DB30ctmX.mjs → api-CDC4ZRT7.mjs} +73 -16
  6. package/dist/{api-8xtJZeXZ.cjs → api-CusZs0lm.cjs} +75 -15
  7. package/dist/{command-C6injNJE.mjs → command-B7O2Hn-D.mjs} +2 -2
  8. package/dist/{command-79M8Bz4I.cjs → command-Cp_bgCOD.cjs} +2 -2
  9. package/dist/{index-krVv4CWK.mjs → index-CFLvb1x1.mjs} +372 -55
  10. package/dist/{index-D4A092LJ.cjs → index-yX0QThPc.cjs} +374 -57
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +82 -22
  15. package/dist/lib.d.mts +82 -22
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-Cl_er9rg.cjs → registerKillSessionHandler-3f8MBSd6.cjs} +2 -2
  18. package/dist/{registerKillSessionHandler-beu2g-Qo.mjs → registerKillSessionHandler-aB2llDD3.mjs} +2 -2
  19. package/dist/{runClaude-DmXinUiz.cjs → runClaude-5moKE082.cjs} +4 -4
  20. package/dist/{runClaude-nzLh-orP.mjs → runClaude-BXO5ycyI.mjs} +4 -4
  21. package/dist/{runCodex-CoqsQ-cb.cjs → runCodex-BJn5KMLg.cjs} +9 -7
  22. package/dist/{runCodex-C-Pjpbxn.mjs → runCodex-DYEMgHdw.mjs} +9 -7
  23. package/dist/{runGemini-CIVm6NWC.mjs → runGemini-CHWnR9gf.mjs} +4 -4
  24. package/dist/{runGemini-BC_5rNMt.cjs → runGemini-CWG0QweX.cjs} +4 -4
  25. package/package.json +1 -1
  26. package/scripts/tooling-utils.mjs +167 -167
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var persistence = require('./api-8xtJZeXZ.cjs');
4
+ var persistence = require('./api-CusZs0lm.cjs');
5
5
  var z = require('zod');
6
6
  var fs$2 = require('fs/promises');
7
7
  var os$1 = require('os');
@@ -31,6 +31,7 @@ var crypto = require('crypto');
31
31
  var node_readline = require('node:readline');
32
32
  var http = require('http');
33
33
  var util = require('util');
34
+ var socket_ioClient = require('socket.io-client');
34
35
  var sdk = require('@agentclientprotocol/sdk');
35
36
  var node_url = require('node:url');
36
37
  require('node:events');
@@ -71,7 +72,7 @@ async function openBrowser(url) {
71
72
  }
72
73
  }
73
74
 
74
- 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-D4A092LJ.cjs', document.baseURI).href)));
75
+ 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-yX0QThPc.cjs', document.baseURI).href)));
75
76
  const QRCode = require$1("qrcode-terminal/vendor/QRCode");
76
77
  const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
77
78
  const pendingTempFiles = /* @__PURE__ */ new Set();
@@ -636,7 +637,7 @@ function setupCleanupHandlers() {
636
637
  });
637
638
  }
638
639
 
639
- const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-D4A092LJ.cjs', document.baseURI).href))));
640
+ const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-yX0QThPc.cjs', document.baseURI).href))));
640
641
  function projectPath() {
641
642
  const path = path$1.resolve(__dirname$2, "..");
642
643
  return path;
@@ -2595,6 +2596,63 @@ async function archiveDetachedManagedSessionIfNeeded(opts) {
2595
2596
  return true;
2596
2597
  }
2597
2598
 
2599
+ function createOfflineMachine(opts) {
2600
+ const { credentials, machineId, metadata, daemonState } = opts;
2601
+ if (credentials.encryption.type === "dataKey") {
2602
+ return {
2603
+ id: machineId,
2604
+ encryptionKey: credentials.encryption.machineKey,
2605
+ encryptionVariant: "dataKey",
2606
+ metadata,
2607
+ metadataVersion: 0,
2608
+ daemonState,
2609
+ daemonStateVersion: 0
2610
+ };
2611
+ }
2612
+ return {
2613
+ id: machineId,
2614
+ encryptionKey: credentials.encryption.secret,
2615
+ encryptionVariant: "legacy",
2616
+ metadata,
2617
+ metadataVersion: 0,
2618
+ daemonState,
2619
+ daemonStateVersion: 0
2620
+ };
2621
+ }
2622
+ async function registerDaemonMachine(opts) {
2623
+ let userScopedObserver = opts.userScopedObserver;
2624
+ let machine = createOfflineMachine(opts);
2625
+ let daemonHasAuthenticatedSync = false;
2626
+ try {
2627
+ machine = await opts.api.getOrCreateMachine({
2628
+ machineId: opts.machineId,
2629
+ metadata: opts.metadata,
2630
+ daemonState: opts.daemonState
2631
+ });
2632
+ daemonHasAuthenticatedSync = true;
2633
+ persistence.logger.debug(`[DAEMON RUN] Machine registered: ${machine.id}`);
2634
+ } catch (error) {
2635
+ if (!persistence.isAuthenticationRequiredError(error)) {
2636
+ throw error;
2637
+ }
2638
+ persistence.logger.warn(
2639
+ "[DAEMON RUN] Machine registration rejected by the server. Continuing with local-only daemon control until authentication is refreshed.",
2640
+ error instanceof Error ? error.message : String(error)
2641
+ );
2642
+ try {
2643
+ await userScopedObserver?.close();
2644
+ } catch (observerCloseError) {
2645
+ persistence.logger.debug("[DAEMON RUN] Failed to close user-scoped observer after auth fallback", observerCloseError);
2646
+ }
2647
+ userScopedObserver = null;
2648
+ }
2649
+ return {
2650
+ machine,
2651
+ daemonHasAuthenticatedSync,
2652
+ userScopedObserver
2653
+ };
2654
+ }
2655
+
2598
2656
  const NON_SESSION_PROCESS_TYPES$1 = /* @__PURE__ */ new Set([
2599
2657
  "current",
2600
2658
  "daemon",
@@ -2988,28 +3046,6 @@ const initialMachineMetadata = {
2988
3046
  happyHomeDir: persistence.configuration.happyCloudHomeDir,
2989
3047
  happyLibDir: projectPath()
2990
3048
  };
2991
- function createOfflineMachine(credentials, machineId, daemonState) {
2992
- if (credentials.encryption.type === "dataKey") {
2993
- return {
2994
- id: machineId,
2995
- encryptionKey: credentials.encryption.machineKey,
2996
- encryptionVariant: "dataKey",
2997
- metadata: initialMachineMetadata,
2998
- metadataVersion: 0,
2999
- daemonState,
3000
- daemonStateVersion: 0
3001
- };
3002
- }
3003
- return {
3004
- id: machineId,
3005
- encryptionKey: credentials.encryption.secret,
3006
- encryptionVariant: "legacy",
3007
- metadata: initialMachineMetadata,
3008
- metadataVersion: 0,
3009
- daemonState,
3010
- daemonStateVersion: 0
3011
- };
3012
- }
3013
3049
  async function getProfileEnvironmentVariablesForAgent(profileId, agentType) {
3014
3050
  try {
3015
3051
  const settings = await persistence.readSettings();
@@ -3584,31 +3620,16 @@ ${stderrSnapshot}`);
3584
3620
  persistence.logger.debug("[DAEMON RUN] Failed to start user-scoped observer, continuing without it", error);
3585
3621
  }
3586
3622
  }
3587
- let machine = createOfflineMachine(credentials, machineId, initialDaemonState);
3588
- let daemonHasAuthenticatedSync = false;
3589
- try {
3590
- machine = await activeApi.getOrCreateMachine({
3591
- machineId,
3592
- metadata: initialMachineMetadata,
3593
- daemonState: initialDaemonState
3594
- });
3595
- daemonHasAuthenticatedSync = true;
3596
- persistence.logger.debug(`[DAEMON RUN] Machine registered: ${machine.id}`);
3597
- } catch (error) {
3598
- if (!persistence.isAuthenticationRequiredError(error)) {
3599
- throw error;
3600
- }
3601
- persistence.logger.warn(
3602
- "[DAEMON RUN] Machine registration rejected by the server. Continuing with local-only daemon control until authentication is refreshed.",
3603
- error instanceof Error ? error.message : String(error)
3604
- );
3605
- try {
3606
- await userScopedObserver?.close();
3607
- } catch (observerCloseError) {
3608
- persistence.logger.debug("[DAEMON RUN] Failed to close user-scoped observer after auth fallback", observerCloseError);
3609
- }
3610
- userScopedObserver = null;
3611
- }
3623
+ const machineRegistration = await registerDaemonMachine({
3624
+ api: activeApi,
3625
+ credentials,
3626
+ machineId,
3627
+ metadata: initialMachineMetadata,
3628
+ daemonState: initialDaemonState,
3629
+ userScopedObserver
3630
+ });
3631
+ const { machine, daemonHasAuthenticatedSync } = machineRegistration;
3632
+ userScopedObserver = machineRegistration.userScopedObserver;
3612
3633
  const apiMachine = daemonHasAuthenticatedSync ? activeApi.machineSyncClient(machine) : null;
3613
3634
  apiMachine?.setRPCHandlers({
3614
3635
  spawnSession,
@@ -5029,6 +5050,291 @@ async function handleHappyOrgCommand(args, deps = {}) {
5029
5050
  throw new Error(`Unknown happy-org subcommand: ${subcommand}`);
5030
5051
  }
5031
5052
 
5053
+ const AGENT_SEND_AES_KEY_REQUIRED_MESSAGE = "Enterprise mode requires an AES key. Pass --aes-key or authenticate with a server response that includes credentials.aesKey.";
5054
+ const AGENT_SEND_E2EE_LEGACY_REQUIRED_MESSAGE = "Legacy e2ee mode is only available for legacy credentials. Use --mode enterprise or re-authenticate with a legacy account.";
5055
+ async function handleAgentCommand(args) {
5056
+ const subcommand = args[0];
5057
+ if (!subcommand || subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
5058
+ showAgentHelp();
5059
+ return;
5060
+ }
5061
+ if (subcommand === "send") {
5062
+ await handleAgentSend(args.slice(1));
5063
+ return;
5064
+ }
5065
+ console.error(chalk.red(`Unknown agent subcommand: ${subcommand}`));
5066
+ showAgentHelp();
5067
+ process.exit(1);
5068
+ }
5069
+ function showAgentHelp() {
5070
+ console.log(`
5071
+ ${chalk.bold("hicloud agent")} - Enterprise task communication relay
5072
+
5073
+ ${chalk.bold("Usage:")}
5074
+ hicloud agent send --session <id> --message <json>
5075
+ hicloud agent send --session <id> --message <json> --mode enterprise
5076
+ hicloud agent send --session <id> --message <json> --mode e2ee
5077
+ hicloud agent help
5078
+
5079
+ ${chalk.bold("Options:")}
5080
+ --session <id> Target session ID (alias: --session-id)
5081
+ --message <json> App-display-compatible JSON message
5082
+ --mode <mode> Communication mode: e2ee (default), enterprise, or aes
5083
+ --aes-key <hex> Override enterprise AES key with a 64-char hex value
5084
+
5085
+ ${chalk.bold("Message format:")}
5086
+ {"role":"user","content":{"type":"text","text":"Hello"}}
5087
+ {"role":"agent","content":{"type":"output","data":{"message":"Task complete"}}}
5088
+
5089
+ Optional meta fields such as meta.happyOrg are preserved so task replay and
5090
+ audit linkage survive enterprise communication writes.
5091
+
5092
+ ${chalk.bold("Communication modes:")}
5093
+ e2ee Legacy-compatible end-to-end encryption using legacy credentials.
5094
+ This mode stays explicit and is never auto-selected as a fallback.
5095
+ enterprise Enterprise-managed AES-256-GCM mode. Server decrypts authorized
5096
+ aes plaintext for replay/audit. Requires an AES key.
5097
+
5098
+ ${chalk.bold("Examples:")}
5099
+ hicloud agent send --session sess_abc123 --message '{"role":"user","content":{"type":"text","text":"Review this PR"}}'
5100
+ hicloud agent send --session sess_abc123 --message '{"role":"user","content":{"type":"text","text":"Review enterprise trace"},"meta":{"happyOrg":{"taskContext":{"taskId":"task-1","organizationId":"org-1","memberAgentId":"member-1","supervisorAgentId":"ceo-1"},"replyContext":{"dispatchId":"dispatch-1","scope":"cli-agent","replyTo":"ceo-1"}}}}' --mode enterprise
5101
+ `);
5102
+ }
5103
+ async function handleAgentSend(args) {
5104
+ const opts = parseAgentSendArgs(args);
5105
+ if (!opts) {
5106
+ process.exit(1);
5107
+ return;
5108
+ }
5109
+ let parsedMessage;
5110
+ try {
5111
+ parsedMessage = JSON.parse(opts.messageJson);
5112
+ } catch {
5113
+ console.error(chalk.red("Error: Message must be valid JSON."));
5114
+ process.exit(1);
5115
+ return;
5116
+ }
5117
+ if (!validateAgentSendMessage(parsedMessage)) {
5118
+ console.error(chalk.red("Error: Message does not match the App display schema."));
5119
+ console.error(chalk.yellow('Expected: {"role":"user","content":{"type":"text","text":"..."}} or {"role":"agent","content":{"type":"output","data":{...}}}.'));
5120
+ process.exit(1);
5121
+ return;
5122
+ }
5123
+ const credentials = await persistence.readCredentials();
5124
+ if (!credentials) {
5125
+ console.error(chalk.red('Error: Not authenticated. Please run "hicloud auth login" first.'));
5126
+ process.exit(1);
5127
+ return;
5128
+ }
5129
+ let resolved;
5130
+ try {
5131
+ resolved = resolveAgentSendOptions(opts, parsedMessage, credentials);
5132
+ } catch (error) {
5133
+ console.error(chalk.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
5134
+ process.exit(1);
5135
+ return;
5136
+ }
5137
+ console.log(chalk.bold(`
5138
+ Sending message to session: ${resolved.sessionId}`));
5139
+ console.log(chalk.gray(`Communication mode: ${resolved.encryptionMode === "aes" ? "enterprise (aes)" : "legacy e2ee"}`));
5140
+ console.log(chalk.gray(`Server: ${persistence.configuration.serverUrl}`));
5141
+ await sendMessage({
5142
+ ...resolved,
5143
+ credentials
5144
+ });
5145
+ }
5146
+ function validateAgentSendMessage(message) {
5147
+ return persistence.MessageContentSchema.safeParse(message).success;
5148
+ }
5149
+ function resolveAgentSendOptions(opts, messageContent, credentials) {
5150
+ if (opts.requestedMode === "aes") {
5151
+ const aesKey = opts.aesKey ?? credentials.aesKey ?? void 0;
5152
+ if (!aesKey) {
5153
+ throw new Error(AGENT_SEND_AES_KEY_REQUIRED_MESSAGE);
5154
+ }
5155
+ if (!/^[0-9a-fA-F]{64}$/.test(aesKey)) {
5156
+ throw new Error("Enterprise AES key must be a 64-character hex string.");
5157
+ }
5158
+ return {
5159
+ sessionId: opts.sessionId,
5160
+ messageContent,
5161
+ encryptionMode: "aes",
5162
+ aesKey
5163
+ };
5164
+ }
5165
+ if (credentials.encryption.type !== "legacy") {
5166
+ throw new Error(AGENT_SEND_E2EE_LEGACY_REQUIRED_MESSAGE);
5167
+ }
5168
+ return {
5169
+ sessionId: opts.sessionId,
5170
+ messageContent,
5171
+ encryptionMode: "e2ee",
5172
+ encryptionKey: credentials.encryption.secret,
5173
+ encryptionVariant: "legacy"
5174
+ };
5175
+ }
5176
+ async function sendMessage(opts) {
5177
+ let socket;
5178
+ let resolved = false;
5179
+ return await new Promise((resolve, reject) => {
5180
+ socket = socket_ioClient.io(persistence.configuration.serverUrl, {
5181
+ auth: (cb) => {
5182
+ cb(persistence.buildSocketAuth({
5183
+ credentials: opts.credentials,
5184
+ clientType: "session-scoped",
5185
+ sessionId: opts.sessionId
5186
+ }));
5187
+ },
5188
+ path: "/v1/updates",
5189
+ transports: ["websocket"],
5190
+ reconnection: false,
5191
+ timeout: 1e4
5192
+ });
5193
+ const timeout = setTimeout(() => {
5194
+ if (!resolved) {
5195
+ resolved = true;
5196
+ socket?.close();
5197
+ reject(new Error("Connection timeout"));
5198
+ }
5199
+ }, 1e4);
5200
+ socket.on("connect", () => {
5201
+ console.log(chalk.green("Connected to server"));
5202
+ });
5203
+ socket.on("connect_error", (err) => {
5204
+ if (!resolved) {
5205
+ resolved = true;
5206
+ clearTimeout(timeout);
5207
+ socket?.close();
5208
+ reject(new Error(`Connection error: ${err.message}`));
5209
+ }
5210
+ });
5211
+ socket.on("error", (err) => {
5212
+ if (!resolved) {
5213
+ resolved = true;
5214
+ clearTimeout(timeout);
5215
+ socket?.close();
5216
+ reject(new Error(`Socket error: ${err}`));
5217
+ }
5218
+ });
5219
+ const localId = `agent-${node_crypto.randomUUID()}`;
5220
+ const payload = {
5221
+ sid: opts.sessionId,
5222
+ localId
5223
+ };
5224
+ if (opts.encryptionMode === "aes") {
5225
+ const encrypted = encryptAesJson(JSON.stringify(opts.messageContent), opts.aesKey);
5226
+ if (!encrypted) {
5227
+ clearTimeout(timeout);
5228
+ if (!resolved) {
5229
+ resolved = true;
5230
+ socket?.close();
5231
+ reject(new Error("AES encryption failed"));
5232
+ }
5233
+ return;
5234
+ }
5235
+ payload.message = encrypted;
5236
+ payload.encryptionMode = "aes";
5237
+ } else {
5238
+ payload.message = persistence.encodeBase64(persistence.encrypt(opts.encryptionKey, opts.encryptionVariant, opts.messageContent));
5239
+ }
5240
+ socket.emit("message", payload, (ack) => {
5241
+ clearTimeout(timeout);
5242
+ if (!resolved) {
5243
+ resolved = true;
5244
+ socket?.close();
5245
+ if (ack?.ok) {
5246
+ console.log(chalk.green("\nMessage sent successfully!"));
5247
+ console.log(chalk.gray(` messageId: ${ack.messageId ?? "unknown"}`));
5248
+ console.log(chalk.gray(` status: ${ack.status ?? "accepted"}`));
5249
+ resolve();
5250
+ } else {
5251
+ reject(new Error(`Message rejected: ${ack?.error ?? "unknown"}`));
5252
+ }
5253
+ }
5254
+ });
5255
+ });
5256
+ }
5257
+ function encryptAesJson(jsonMessage, aesKeyHex) {
5258
+ try {
5259
+ const key = Buffer.from(aesKeyHex, "hex");
5260
+ if (key.length !== 32) {
5261
+ return null;
5262
+ }
5263
+ const nonce = node_crypto.randomBytes(12);
5264
+ const cipher = node_crypto.createCipheriv("aes-256-gcm", key, nonce);
5265
+ const plaintext = Buffer.from(jsonMessage, "utf8");
5266
+ const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
5267
+ const authTag = cipher.getAuthTag();
5268
+ const bundle = Buffer.alloc(1 + 12 + encrypted.length + 16);
5269
+ bundle.writeUInt8(0, 0);
5270
+ nonce.copy(bundle, 1);
5271
+ encrypted.copy(bundle, 13);
5272
+ authTag.copy(bundle, 13 + encrypted.length);
5273
+ return bundle.toString("base64");
5274
+ } catch {
5275
+ return null;
5276
+ }
5277
+ }
5278
+ function parseAgentSendArgs(args) {
5279
+ let sessionId;
5280
+ let messageJson;
5281
+ let requestedMode = "e2ee";
5282
+ let aesKey;
5283
+ for (let index = 0; index < args.length; index += 1) {
5284
+ const arg = args[index];
5285
+ if (arg === "--session" || arg === "-s" || arg === "--session-id") {
5286
+ sessionId = args[index + 1];
5287
+ index += 1;
5288
+ continue;
5289
+ }
5290
+ if (arg === "--message" || arg === "-m") {
5291
+ messageJson = args[index + 1];
5292
+ index += 1;
5293
+ continue;
5294
+ }
5295
+ if (arg === "--mode" || arg === "--encryption" || arg === "--encryption-mode") {
5296
+ const mode = args[index + 1]?.toLowerCase();
5297
+ index += 1;
5298
+ if (mode === "enterprise" || mode === "aes") {
5299
+ requestedMode = "aes";
5300
+ continue;
5301
+ }
5302
+ if (mode === "e2ee") {
5303
+ requestedMode = "e2ee";
5304
+ continue;
5305
+ }
5306
+ console.error(chalk.red(`Unknown communication mode: ${mode}. Use 'e2ee', 'enterprise', or 'aes'.`));
5307
+ return null;
5308
+ }
5309
+ if (arg === "--aes-key") {
5310
+ aesKey = args[index + 1];
5311
+ index += 1;
5312
+ continue;
5313
+ }
5314
+ if (arg === "--help" || arg === "-h") {
5315
+ showAgentHelp();
5316
+ return null;
5317
+ }
5318
+ if (!arg.startsWith("-")) {
5319
+ messageJson ??= arg;
5320
+ }
5321
+ }
5322
+ if (!sessionId) {
5323
+ console.error(chalk.red("Error: --session <sessionId> or --session-id <sessionId> is required."));
5324
+ return null;
5325
+ }
5326
+ if (!messageJson) {
5327
+ console.error(chalk.red("Error: --message <json> is required."));
5328
+ return null;
5329
+ }
5330
+ return {
5331
+ sessionId,
5332
+ messageJson,
5333
+ requestedMode,
5334
+ aesKey
5335
+ };
5336
+ }
5337
+
5032
5338
  function getProjectPath(workingDirectory, claudeConfigDirOverride) {
5033
5339
  const projectId = path.resolve(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
5034
5340
  const claudeConfigDirRaw = process.env.CLAUDE_CONFIG_DIR ?? "";
@@ -9143,7 +9449,7 @@ class AbortError extends Error {
9143
9449
  }
9144
9450
  }
9145
9451
 
9146
- 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-D4A092LJ.cjs', document.baseURI).href)));
9452
+ 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-yX0QThPc.cjs', document.baseURI).href)));
9147
9453
  const __dirname$1 = path.join(__filename$1, "..");
9148
9454
  function getGlobalClaudeVersion() {
9149
9455
  try {
@@ -10462,14 +10768,14 @@ var launch = /*#__PURE__*/Object.freeze({
10462
10768
  const unifiedProviderExecutors = {
10463
10769
  claude: async (opts) => {
10464
10770
  const claudeOptions = opts.claudeOptions ?? {};
10465
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-DmXinUiz.cjs'); });
10771
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-5moKE082.cjs'); });
10466
10772
  await runClaude(opts.credentials, {
10467
10773
  ...claudeOptions,
10468
10774
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
10469
10775
  });
10470
10776
  },
10471
10777
  codex: async (opts) => {
10472
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CoqsQ-cb.cjs'); });
10778
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BJn5KMLg.cjs'); });
10473
10779
  await runCodex({
10474
10780
  credentials: opts.credentials,
10475
10781
  startedBy: opts.startedBy,
@@ -10478,7 +10784,7 @@ const unifiedProviderExecutors = {
10478
10784
  });
10479
10785
  },
10480
10786
  gemini: async (opts) => {
10481
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BC_5rNMt.cjs'); });
10787
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CWG0QweX.cjs'); });
10482
10788
  await runGemini({
10483
10789
  credentials: opts.credentials,
10484
10790
  startedBy: opts.startedBy
@@ -10561,7 +10867,7 @@ function shouldRunMainClaudeFlow(opts) {
10561
10867
  return;
10562
10868
  } else if (subcommand === "runtime") {
10563
10869
  if (args[1] === "providers") {
10564
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-79M8Bz4I.cjs'); });
10870
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-Cp_bgCOD.cjs'); });
10565
10871
  console.log(renderRuntimeProviders());
10566
10872
  return;
10567
10873
  }
@@ -10623,6 +10929,17 @@ function shouldRunMainClaudeFlow(opts) {
10623
10929
  process.exit(1);
10624
10930
  }
10625
10931
  return;
10932
+ } else if (subcommand === "agent") {
10933
+ try {
10934
+ await handleAgentCommand(args.slice(1));
10935
+ } catch (error) {
10936
+ console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
10937
+ if (process.env.DEBUG) {
10938
+ console.error(error);
10939
+ }
10940
+ process.exit(1);
10941
+ }
10942
+ return;
10626
10943
  } else if (subcommand === "codex") {
10627
10944
  try {
10628
10945
  let startedBy = void 0;
@@ -10750,8 +11067,8 @@ function shouldRunMainClaudeFlow(opts) {
10750
11067
  const projectId = args[3];
10751
11068
  try {
10752
11069
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
10753
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-8xtJZeXZ.cjs'); }).then(function (n) { return n.persistence; });
10754
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-8xtJZeXZ.cjs'); }).then(function (n) { return n.api; });
11070
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-CusZs0lm.cjs'); }).then(function (n) { return n.persistence; });
11071
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-CusZs0lm.cjs'); }).then(function (n) { return n.api; });
10755
11072
  let userEmail = void 0;
10756
11073
  try {
10757
11074
  const credentials = await readCredentials2();
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./api-8xtJZeXZ.cjs');
4
+ require('./api-CusZs0lm.cjs');
5
5
  require('zod');
6
- require('./index-D4A092LJ.cjs');
6
+ require('./index-yX0QThPc.cjs');
7
7
  require('node:child_process');
8
8
  require('node:fs');
9
9
  require('cross-spawn');
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'chalk';
2
- import './api-DB30ctmX.mjs';
2
+ import './api-CDC4ZRT7.mjs';
3
3
  import 'zod';
4
- import './index-krVv4CWK.mjs';
4
+ import './index-CFLvb1x1.mjs';
5
5
  import 'node:child_process';
6
6
  import 'node:fs';
7
7
  import 'cross-spawn';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-8xtJZeXZ.cjs');
3
+ var persistence = require('./api-CusZs0lm.cjs');
4
4
  var types = require('./types-DVk3crez.cjs');
5
5
  require('axios');
6
6
  require('chalk');