happy-imou-cloud 2.1.24 → 2.1.25

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 (30) hide show
  1. package/dist/{BaseReasoningProcessor-C12000HQ.cjs → BaseReasoningProcessor-2bLE0sSp.cjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-BTf3r0UP.mjs → BaseReasoningProcessor-CwRWOT0S.mjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-BFdeV3Qi.cjs → ProviderSelectionHandler-B9VPS_Rc.cjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-DXx9hcjB.mjs → ProviderSelectionHandler-gc5O4qz_.mjs} +2 -2
  5. package/dist/{api-Baax81ZI.cjs → api-D-eaNQRi.cjs} +35 -3
  6. package/dist/{api-DZeS3vrX.mjs → api-DIKoWlkZ.mjs} +35 -3
  7. package/dist/{command-DOZYbypd.cjs → command-B2c92N5-.cjs} +2 -2
  8. package/dist/{command-B_RdbyPU.mjs → command-BJM31yLo.mjs} +2 -2
  9. package/dist/{index-BNqCQ-lZ.cjs → index-C9H8DkAi.cjs} +195 -96
  10. package/dist/{index-DA3m13mn.mjs → index-DAd1S2uU.mjs} +191 -92
  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 +36 -36
  15. package/dist/lib.d.mts +36 -36
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-BiG3yHlk.mjs → registerKillSessionHandler-Clhr0VyF.mjs} +2 -2
  18. package/dist/{registerKillSessionHandler-BtXtFnRx.cjs → registerKillSessionHandler-DqGYmdQO.cjs} +2 -2
  19. package/dist/{runClaude-DGV1Dcv4.cjs → runClaude-ByM9SjF1.cjs} +4 -4
  20. package/dist/{runClaude-BqN1RhrO.mjs → runClaude-DCwdRRme.mjs} +4 -4
  21. package/dist/{runCodex-DQQkaW3Z.cjs → runCodex-C1J5kcWX.cjs} +5 -5
  22. package/dist/{runCodex-C3htqAO7.mjs → runCodex-CVJLnCCQ.mjs} +5 -5
  23. package/dist/{runGemini-CmDSS8Qz.cjs → runGemini-BbXO6nqw.cjs} +4 -4
  24. package/dist/{runGemini-CH9Cti4U.mjs → runGemini-CGCzDzMj.mjs} +4 -4
  25. package/package.json +2 -1
  26. package/scripts/release-smoke.mjs +22 -2
  27. package/skills/happy-cli-testing/SKILL.md +90 -0
  28. package/skills/happy-cli-testing/agents/openai.yaml +4 -0
  29. package/skills/hicloud-problem-investigation/SKILL.md +201 -0
  30. package/skills/hicloud-problem-investigation/agents/openai.yaml +4 -0
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BNqCQ-lZ.cjs');
4
- var persistence = require('./api-Baax81ZI.cjs');
3
+ var index = require('./index-C9H8DkAi.cjs');
4
+ var persistence = require('./api-D-eaNQRi.cjs');
5
5
  var node_events = require('node:events');
6
6
  var node_crypto = require('node:crypto');
7
7
 
@@ -1,5 +1,5 @@
1
- import { a as createSessionMetadata, p as publishSessionRegistration } from './index-DA3m13mn.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-DZeS3vrX.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-DAd1S2uU.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-DIKoWlkZ.mjs';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { randomUUID } from 'node:crypto';
5
5
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-Baax81ZI.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-BtXtFnRx.cjs');
3
+ var persistence = require('./api-D-eaNQRi.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-DqGYmdQO.cjs');
5
5
 
6
6
  async function runModeLoop(opts) {
7
7
  let currentMode = opts.startingMode;
@@ -1,5 +1,5 @@
1
- import { l as logger } from './api-DZeS3vrX.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BiG3yHlk.mjs';
1
+ import { l as logger } from './api-DIKoWlkZ.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-Clhr0VyF.mjs';
3
3
 
4
4
  async function runModeLoop(opts) {
5
5
  let currentMode = opts.startingMode;
@@ -38,7 +38,7 @@ function _interopNamespaceDefault(e) {
38
38
  var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
39
39
 
40
40
  var name = "happy-imou-cloud";
41
- var version = "2.1.24";
41
+ var version = "2.1.25";
42
42
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
43
43
  var author = "long.zhu";
44
44
  var license = "MIT";
@@ -76,6 +76,7 @@ var files = [
76
76
  "compat",
77
77
  "bin",
78
78
  "scripts",
79
+ "skills",
79
80
  "package.json"
80
81
  ];
81
82
  var scripts = {
@@ -3053,7 +3054,16 @@ class ApiSessionClient extends node_events.EventEmitter {
3053
3054
  this.emit("metadata-updated", this.metadata);
3054
3055
  }
3055
3056
  throw new Error("Metadata version mismatch");
3056
- } else if (answer.result === "error") ;
3057
+ } else if (answer.result === "error") {
3058
+ const failure = getSessionMutationFailureDetails(answer);
3059
+ if (failure.retryable) {
3060
+ throw createRetryableSessionMutationError("metadata", failure.error);
3061
+ }
3062
+ logger.debug("[API] Metadata update was rejected by the server", {
3063
+ sessionId: this.sessionId,
3064
+ error: failure.error
3065
+ });
3066
+ }
3057
3067
  });
3058
3068
  }).catch((error) => {
3059
3069
  logger.debug("[API] Metadata update failed unexpectedly", error);
@@ -3081,7 +3091,16 @@ class ApiSessionClient extends node_events.EventEmitter {
3081
3091
  this.emit("agent-state-updated", this.agentState);
3082
3092
  }
3083
3093
  throw new Error("Agent state version mismatch");
3084
- } else if (answer.result === "error") ;
3094
+ } else if (answer.result === "error") {
3095
+ const failure = getSessionMutationFailureDetails(answer);
3096
+ if (failure.retryable) {
3097
+ throw createRetryableSessionMutationError("agent-state", failure.error);
3098
+ }
3099
+ logger.debug("[API] Agent state update was rejected by the server", {
3100
+ sessionId: this.sessionId,
3101
+ error: failure.error
3102
+ });
3103
+ }
3085
3104
  });
3086
3105
  }).catch((error) => {
3087
3106
  logger.debug("[API] Agent state update failed unexpectedly", error);
@@ -3961,6 +3980,19 @@ function createAckTimeoutError(timeoutMs) {
3961
3980
  function isAckTimeoutError(error) {
3962
3981
  return error instanceof Error && error.name === "AckTimeoutError";
3963
3982
  }
3983
+ function getSessionMutationFailureDetails(answer) {
3984
+ const candidate = answer;
3985
+ return {
3986
+ retryable: candidate.retryable === true,
3987
+ error: typeof candidate.error === "string" && candidate.error.length > 0 ? candidate.error : null
3988
+ };
3989
+ }
3990
+ function createRetryableSessionMutationError(kind, errorCode) {
3991
+ const suffix = errorCode ? ` (${errorCode})` : "";
3992
+ const error = new Error(`Retryable session ${kind} update failed${suffix}`);
3993
+ error.name = "RetryableSessionMutationError";
3994
+ return error;
3995
+ }
3964
3996
 
3965
3997
  class ApiMachineClient {
3966
3998
  constructor(credentials, machine) {
@@ -18,7 +18,7 @@ import { unlink, readFile, mkdir, open, stat, writeFile, rename } from 'node:fs/
18
18
  import { Expo } from 'expo-server-sdk';
19
19
 
20
20
  var name = "happy-imou-cloud";
21
- var version = "2.1.24";
21
+ var version = "2.1.25";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -56,6 +56,7 @@ var files = [
56
56
  "compat",
57
57
  "bin",
58
58
  "scripts",
59
+ "skills",
59
60
  "package.json"
60
61
  ];
61
62
  var scripts = {
@@ -3033,7 +3034,16 @@ class ApiSessionClient extends EventEmitter {
3033
3034
  this.emit("metadata-updated", this.metadata);
3034
3035
  }
3035
3036
  throw new Error("Metadata version mismatch");
3036
- } else if (answer.result === "error") ;
3037
+ } else if (answer.result === "error") {
3038
+ const failure = getSessionMutationFailureDetails(answer);
3039
+ if (failure.retryable) {
3040
+ throw createRetryableSessionMutationError("metadata", failure.error);
3041
+ }
3042
+ logger.debug("[API] Metadata update was rejected by the server", {
3043
+ sessionId: this.sessionId,
3044
+ error: failure.error
3045
+ });
3046
+ }
3037
3047
  });
3038
3048
  }).catch((error) => {
3039
3049
  logger.debug("[API] Metadata update failed unexpectedly", error);
@@ -3061,7 +3071,16 @@ class ApiSessionClient extends EventEmitter {
3061
3071
  this.emit("agent-state-updated", this.agentState);
3062
3072
  }
3063
3073
  throw new Error("Agent state version mismatch");
3064
- } else if (answer.result === "error") ;
3074
+ } else if (answer.result === "error") {
3075
+ const failure = getSessionMutationFailureDetails(answer);
3076
+ if (failure.retryable) {
3077
+ throw createRetryableSessionMutationError("agent-state", failure.error);
3078
+ }
3079
+ logger.debug("[API] Agent state update was rejected by the server", {
3080
+ sessionId: this.sessionId,
3081
+ error: failure.error
3082
+ });
3083
+ }
3065
3084
  });
3066
3085
  }).catch((error) => {
3067
3086
  logger.debug("[API] Agent state update failed unexpectedly", error);
@@ -3941,6 +3960,19 @@ function createAckTimeoutError(timeoutMs) {
3941
3960
  function isAckTimeoutError(error) {
3942
3961
  return error instanceof Error && error.name === "AckTimeoutError";
3943
3962
  }
3963
+ function getSessionMutationFailureDetails(answer) {
3964
+ const candidate = answer;
3965
+ return {
3966
+ retryable: candidate.retryable === true,
3967
+ error: typeof candidate.error === "string" && candidate.error.length > 0 ? candidate.error : null
3968
+ };
3969
+ }
3970
+ function createRetryableSessionMutationError(kind, errorCode) {
3971
+ const suffix = errorCode ? ` (${errorCode})` : "";
3972
+ const error = new Error(`Retryable session ${kind} update failed${suffix}`);
3973
+ error.name = "RetryableSessionMutationError";
3974
+ return error;
3975
+ }
3944
3976
 
3945
3977
  class ApiMachineClient {
3946
3978
  constructor(credentials, machine) {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BNqCQ-lZ.cjs');
3
+ var index = require('./index-C9H8DkAi.cjs');
4
4
  require('chalk');
5
- require('./api-Baax81ZI.cjs');
5
+ require('./api-D-eaNQRi.cjs');
6
6
  require('axios');
7
7
  require('fs');
8
8
  require('node:fs');
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-DA3m13mn.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-DAd1S2uU.mjs';
2
2
  import 'chalk';
3
- import './api-DZeS3vrX.mjs';
3
+ import './api-DIKoWlkZ.mjs';
4
4
  import 'axios';
5
5
  import 'fs';
6
6
  import 'node:fs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var persistence = require('./api-Baax81ZI.cjs');
4
+ var persistence = require('./api-D-eaNQRi.cjs');
5
5
  var z = require('zod');
6
6
  var fs$2 = require('fs/promises');
7
7
  var os$1 = require('os');
@@ -72,7 +72,7 @@ async function openBrowser(url) {
72
72
  }
73
73
  }
74
74
 
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-BNqCQ-lZ.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-C9H8DkAi.cjs', document.baseURI).href)));
76
76
  const QRCode = require$1("qrcode-terminal/vendor/QRCode");
77
77
  const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
78
78
  const pendingTempFiles = /* @__PURE__ */ new Set();
@@ -637,7 +637,7 @@ function setupCleanupHandlers() {
637
637
  });
638
638
  }
639
639
 
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-BNqCQ-lZ.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-C9H8DkAi.cjs', document.baseURI).href))));
641
641
  function projectPath() {
642
642
  const path = path$1.resolve(__dirname$2, "..");
643
643
  return path;
@@ -5335,6 +5335,70 @@ function parseAgentSendArgs(args) {
5335
5335
  };
5336
5336
  }
5337
5337
 
5338
+ const defaultDeps = {
5339
+ listDaemonSessions,
5340
+ stopDaemonSession,
5341
+ log: (message) => console.log(message),
5342
+ error: (message) => console.error(message)
5343
+ };
5344
+ function renderSessionCommandHelp() {
5345
+ return [
5346
+ "Usage: hicloud session <command>",
5347
+ "",
5348
+ "Commands:",
5349
+ " list List active sessions tracked by the daemon",
5350
+ " kill <session|pid> Stop a tracked session by session ID or PID"
5351
+ ].join("\n");
5352
+ }
5353
+ async function resolveSessionIdFromTarget(target, deps) {
5354
+ if (!/^\d+$/.test(target)) {
5355
+ return target;
5356
+ }
5357
+ const sessions = await deps.listDaemonSessions();
5358
+ const match = sessions.find((session) => String(session.pid) === target);
5359
+ return match?.happySessionId ?? null;
5360
+ }
5361
+ async function handleSessionCommand(args, deps = defaultDeps) {
5362
+ const subcommand = args[0];
5363
+ if (subcommand === "list") {
5364
+ try {
5365
+ const sessions = await deps.listDaemonSessions();
5366
+ if (sessions.length === 0) {
5367
+ deps.log("No active sessions this daemon is aware of");
5368
+ return 0;
5369
+ }
5370
+ deps.log("Active sessions:");
5371
+ deps.log(JSON.stringify(sessions, null, 2));
5372
+ return 0;
5373
+ } catch {
5374
+ deps.log("No daemon running");
5375
+ return 0;
5376
+ }
5377
+ }
5378
+ if (subcommand === "kill") {
5379
+ const target = args[1];
5380
+ if (!target) {
5381
+ deps.error("Session ID or PID required");
5382
+ return 1;
5383
+ }
5384
+ try {
5385
+ const sessionId = await resolveSessionIdFromTarget(target, deps);
5386
+ if (!sessionId) {
5387
+ deps.error(`No tracked session found for PID ${target}`);
5388
+ return 1;
5389
+ }
5390
+ const success = await deps.stopDaemonSession(sessionId);
5391
+ deps.log(success ? "Session stopped" : "Failed to stop session");
5392
+ return success ? 0 : 1;
5393
+ } catch {
5394
+ deps.error("No daemon running");
5395
+ return 1;
5396
+ }
5397
+ }
5398
+ deps.log(renderSessionCommandHelp());
5399
+ return 0;
5400
+ }
5401
+
5338
5402
  function getProjectPath(workingDirectory, claudeConfigDirOverride) {
5339
5403
  const projectId = path.resolve(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
5340
5404
  const claudeConfigDirRaw = process.env.CLAUDE_CONFIG_DIR ?? "";
@@ -6980,12 +7044,11 @@ ${line.slice(-tailChars)}`;
6980
7044
  }
6981
7045
  function createAcpFilteredStdoutReadable(params) {
6982
7046
  const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : 1e6;
6983
- const decoder = new TextDecoder();
6984
7047
  const encoder = new TextEncoder();
6985
7048
  return new ReadableStream({
6986
7049
  async start(controller) {
6987
7050
  const reader = params.readable.getReader();
6988
- let buffer = "";
7051
+ let buffer = Buffer.alloc(0);
6989
7052
  let multiline = null;
6990
7053
  let discardingOversizedLine = false;
6991
7054
  let controllerErrored = false;
@@ -6998,14 +7061,16 @@ function createAcpFilteredStdoutReadable(params) {
6998
7061
  }
6999
7062
  const filtered = params.transport.filterStdoutLine?.(line);
7000
7063
  if (filtered === void 0) {
7001
- controller.enqueue(encoder.encode(line + "\n"));
7064
+ controller.enqueue(encoder.encode(`${line}
7065
+ `));
7002
7066
  return;
7003
7067
  }
7004
7068
  if (filtered === null) {
7005
7069
  drop("transport_filter_null", line);
7006
7070
  return;
7007
7071
  }
7008
- controller.enqueue(encoder.encode(filtered + "\n"));
7072
+ controller.enqueue(encoder.encode(`${filtered}
7073
+ `));
7009
7074
  };
7010
7075
  const tryFlushMultiline = (candidate) => {
7011
7076
  const trimmed = candidate.trim();
@@ -7026,6 +7091,46 @@ function createAcpFilteredStdoutReadable(params) {
7026
7091
  return false;
7027
7092
  }
7028
7093
  };
7094
+ const consumeLine = (line, lineBytes) => {
7095
+ if (multiline) {
7096
+ const nextBuf = multiline.buf.length > 0 ? `${multiline.buf}
7097
+ ${line}` : line;
7098
+ const nextBytes = multiline.bytes + lineBytes + 1;
7099
+ if (nextBytes > maxMultilineBytes) {
7100
+ drop("multiline_overflow", multiline.buf);
7101
+ multiline = null;
7102
+ if (lineBytes > maxMultilineBytes) {
7103
+ drop("multiline_overflow", line);
7104
+ return;
7105
+ }
7106
+ enqueueLine(line);
7107
+ return;
7108
+ }
7109
+ multiline = { buf: nextBuf, bytes: nextBytes };
7110
+ if (tryFlushMultiline(multiline.buf)) {
7111
+ multiline = null;
7112
+ }
7113
+ return;
7114
+ }
7115
+ if (lineBytes > maxMultilineBytes) {
7116
+ drop("multiline_overflow", line);
7117
+ return;
7118
+ }
7119
+ const trimmed = line.trim();
7120
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
7121
+ try {
7122
+ const parsed = JSON.parse(trimmed);
7123
+ if (typeof parsed === "object" && parsed !== null) {
7124
+ enqueueLine(line);
7125
+ return;
7126
+ }
7127
+ } catch {
7128
+ multiline = { buf: line, bytes: lineBytes };
7129
+ return;
7130
+ }
7131
+ }
7132
+ enqueueLine(line);
7133
+ };
7029
7134
  try {
7030
7135
  while (true) {
7031
7136
  const { value, done } = await reader.read();
@@ -7035,73 +7140,54 @@ function createAcpFilteredStdoutReadable(params) {
7035
7140
  if (!value) {
7036
7141
  continue;
7037
7142
  }
7038
- let decodedChunk = decoder.decode(value, { stream: true });
7143
+ let chunkBuffer = Buffer.from(value);
7039
7144
  if (discardingOversizedLine) {
7040
- const newlineIndex = decodedChunk.indexOf("\n");
7041
- if (newlineIndex === -1) {
7145
+ const newlineIndex2 = chunkBuffer.indexOf(10);
7146
+ if (newlineIndex2 === -1) {
7042
7147
  continue;
7043
7148
  }
7044
- decodedChunk = decodedChunk.slice(newlineIndex + 1);
7149
+ chunkBuffer = chunkBuffer.subarray(newlineIndex2 + 1);
7045
7150
  discardingOversizedLine = false;
7046
7151
  }
7047
- buffer += decodedChunk;
7048
- const lines = buffer.split("\n");
7049
- buffer = lines.pop() || "";
7050
- for (const line of lines) {
7051
- if (multiline) {
7052
- const nextBuf = multiline.buf.length > 0 ? `${multiline.buf}
7053
- ${line}` : line;
7054
- const nextBytes = multiline.bytes + line.length + 1;
7055
- if (nextBytes > maxMultilineBytes) {
7056
- drop("multiline_overflow", multiline.buf);
7057
- multiline = null;
7058
- if (line.length > maxMultilineBytes) {
7059
- drop("multiline_overflow", line);
7060
- continue;
7061
- }
7062
- enqueueLine(line);
7063
- continue;
7064
- }
7065
- multiline = { buf: nextBuf, bytes: nextBytes };
7066
- if (tryFlushMultiline(multiline.buf)) {
7067
- multiline = null;
7068
- }
7069
- continue;
7070
- }
7071
- if (line.length > maxMultilineBytes) {
7072
- drop("multiline_overflow", line);
7073
- continue;
7074
- }
7075
- const trimmed = line.trim();
7076
- if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
7077
- try {
7078
- const parsed = JSON.parse(trimmed);
7079
- if (typeof parsed === "object" && parsed !== null) {
7080
- enqueueLine(line);
7081
- continue;
7082
- }
7083
- } catch {
7084
- multiline = { buf: line, bytes: line.length };
7085
- continue;
7086
- }
7087
- }
7088
- enqueueLine(line);
7152
+ if (chunkBuffer.length === 0) {
7153
+ continue;
7154
+ }
7155
+ buffer = buffer.length === 0 ? chunkBuffer : Buffer.concat([buffer, chunkBuffer]);
7156
+ let newlineIndex = buffer.indexOf(10);
7157
+ while (newlineIndex !== -1) {
7158
+ const rawLine = buffer.subarray(0, newlineIndex);
7159
+ buffer = buffer.subarray(newlineIndex + 1);
7160
+ const lineBuffer = rawLine.at(-1) === 13 ? rawLine.subarray(0, rawLine.length - 1) : rawLine;
7161
+ const line = lineBuffer.toString("utf8");
7162
+ consumeLine(line, lineBuffer.length);
7163
+ newlineIndex = buffer.indexOf(10);
7089
7164
  }
7090
7165
  if (buffer.length > maxMultilineBytes) {
7091
- drop("multiline_overflow", buffer);
7092
- buffer = "";
7166
+ drop("multiline_overflow", buffer.toString("utf8"));
7167
+ buffer = Buffer.alloc(0);
7093
7168
  discardingOversizedLine = true;
7094
7169
  }
7095
7170
  }
7096
- if (multiline) {
7097
- if (!tryFlushMultiline(multiline.buf)) {
7098
- drop("multiline_incomplete", multiline.buf);
7171
+ if (buffer.length > 0) {
7172
+ const trailingLine = buffer.toString("utf8");
7173
+ const pendingMultiline = multiline;
7174
+ if (pendingMultiline) {
7175
+ const nextBuf = pendingMultiline.buf.length > 0 ? `${pendingMultiline.buf}
7176
+ ${trailingLine}` : trailingLine;
7177
+ if (!tryFlushMultiline(nextBuf)) {
7178
+ drop("multiline_incomplete", nextBuf);
7179
+ }
7180
+ multiline = null;
7181
+ } else if (trailingLine.trim()) {
7182
+ drop("multiline_incomplete", trailingLine);
7099
7183
  }
7100
- multiline = null;
7101
7184
  }
7102
- const trailing = buffer.trim();
7103
- if (trailing) {
7104
- drop("multiline_incomplete", buffer);
7185
+ const remainingMultiline = multiline;
7186
+ if (remainingMultiline) {
7187
+ if (!tryFlushMultiline(remainingMultiline.buf)) {
7188
+ drop("multiline_incomplete", remainingMultiline.buf);
7189
+ }
7190
+ multiline = null;
7105
7191
  }
7106
7192
  } catch (error) {
7107
7193
  controllerErrored = true;
@@ -9193,21 +9279,21 @@ function copyCodexHomeEntry(sourcePath, destPath) {
9193
9279
  });
9194
9280
  }
9195
9281
  function normalizePathForComparison(path$1, platform) {
9196
- const normalizedPath = path.normalize(path$1).replace(/[\\/]+$/, "");
9282
+ const normalizedPath = path.normalize(path$1).replace(/[\\/]+/g, "/").replace(/\/+$/, "");
9197
9283
  return platform === "win32" ? normalizedPath.toLowerCase() : normalizedPath;
9198
9284
  }
9199
- function isManagedTemporaryCodexHomePath(path$1, platform) {
9200
- const trimmedPath = path$1.trim();
9285
+ function isManagedTemporaryCodexHomePath(path, platform) {
9286
+ const trimmedPath = path.trim();
9201
9287
  if (!trimmedPath) {
9202
9288
  return false;
9203
9289
  }
9204
- if (!path.basename(trimmedPath).startsWith(MANAGED_CODEX_HOME_PREFIX)) {
9290
+ const pathBaseName = trimmedPath.replace(/[\\/]+$/, "").split(/[\\/]/).at(-1) ?? "";
9291
+ if (!pathBaseName.startsWith(MANAGED_CODEX_HOME_PREFIX)) {
9205
9292
  return false;
9206
9293
  }
9207
9294
  const normalizedTempRoot = normalizePathForComparison(os.tmpdir(), platform);
9208
9295
  const normalizedPath = normalizePathForComparison(trimmedPath, platform);
9209
- const separator = platform === "win32" ? "\\" : "/";
9210
- return normalizedPath.startsWith(`${normalizedTempRoot}${separator}`);
9296
+ return normalizedPath.startsWith(`${normalizedTempRoot}/`);
9211
9297
  }
9212
9298
  function extractSkillDescriptionFromFrontmatter(frontmatter) {
9213
9299
  const lines = frontmatter.split(/\r?\n/);
@@ -9263,25 +9349,7 @@ function shouldSeedCodexSkillEntry(sourcePath) {
9263
9349
  }
9264
9350
  return true;
9265
9351
  }
9266
- function seedIsolatedCodexHome(sourceHomeDir, isolatedHomeDir) {
9267
- if (!fs.existsSync(sourceHomeDir)) {
9268
- return;
9269
- }
9270
- for (const fileName of CODEX_HOME_SEED_FILES) {
9271
- try {
9272
- copyCodexHomeEntry(path.join(sourceHomeDir, fileName), path.join(isolatedHomeDir, fileName));
9273
- } catch (error) {
9274
- persistence.logger.debug(`[codex] Failed to seed CODEX_HOME file ${fileName}`, error);
9275
- }
9276
- }
9277
- for (const dirName of CODEX_HOME_SEED_DIRS) {
9278
- try {
9279
- copyCodexHomeEntry(path.join(sourceHomeDir, dirName), path.join(isolatedHomeDir, dirName));
9280
- } catch (error) {
9281
- persistence.logger.debug(`[codex] Failed to seed CODEX_HOME directory ${dirName}`, error);
9282
- }
9283
- }
9284
- const sourceSkillsDir = path.join(sourceHomeDir, "skills");
9352
+ function seedCodexSkillEntries(sourceSkillsDir, isolatedHomeDir, sourceLabel) {
9285
9353
  if (!fs.existsSync(sourceSkillsDir)) {
9286
9354
  return;
9287
9355
  }
@@ -9298,9 +9366,31 @@ function seedIsolatedCodexHome(sourceHomeDir, isolatedHomeDir) {
9298
9366
  path.join(destSkillsDir, entryName)
9299
9367
  );
9300
9368
  } catch (error) {
9301
- persistence.logger.debug(`[codex] Failed to seed CODEX_HOME skills entry ${entryName}`, error);
9369
+ persistence.logger.debug(`[codex] Failed to seed CODEX_HOME skills entry ${entryName} from ${sourceLabel}`, error);
9370
+ }
9371
+ }
9372
+ }
9373
+ function seedIsolatedCodexHome(sourceHomeDir, isolatedHomeDir, bundledSkillsDir) {
9374
+ if (fs.existsSync(sourceHomeDir)) {
9375
+ for (const fileName of CODEX_HOME_SEED_FILES) {
9376
+ try {
9377
+ copyCodexHomeEntry(path.join(sourceHomeDir, fileName), path.join(isolatedHomeDir, fileName));
9378
+ } catch (error) {
9379
+ persistence.logger.debug(`[codex] Failed to seed CODEX_HOME file ${fileName}`, error);
9380
+ }
9381
+ }
9382
+ for (const dirName of CODEX_HOME_SEED_DIRS) {
9383
+ try {
9384
+ copyCodexHomeEntry(path.join(sourceHomeDir, dirName), path.join(isolatedHomeDir, dirName));
9385
+ } catch (error) {
9386
+ persistence.logger.debug(`[codex] Failed to seed CODEX_HOME directory ${dirName}`, error);
9387
+ }
9302
9388
  }
9303
9389
  }
9390
+ if (bundledSkillsDir) {
9391
+ seedCodexSkillEntries(bundledSkillsDir, isolatedHomeDir, "bundled skills");
9392
+ }
9393
+ seedCodexSkillEntries(path.join(sourceHomeDir, "skills"), isolatedHomeDir, "source CODEX_HOME");
9304
9394
  }
9305
9395
  function prepareCodexAcpEnvironment(overrides = {}, options = {}) {
9306
9396
  const env = buildCodexAcpEnv(overrides, options);
@@ -9322,7 +9412,8 @@ function prepareCodexAcpEnvironment(overrides = {}, options = {}) {
9322
9412
  const isolatedHomeDir = tempDirFactory(path.join(os.tmpdir(), "happy-codex-home-"));
9323
9413
  fs.mkdirSync(isolatedHomeDir, { recursive: true });
9324
9414
  const sourceHomeDir = options.sourceHomeDir ?? path.join(os.homedir(), ".codex");
9325
- seedIsolatedCodexHome(sourceHomeDir, isolatedHomeDir);
9415
+ const bundledSkillsDir = options.bundledSkillsDir ?? path.join(projectPath(), "skills");
9416
+ seedIsolatedCodexHome(sourceHomeDir, isolatedHomeDir, bundledSkillsDir);
9326
9417
  env.CODEX_HOME = isolatedHomeDir;
9327
9418
  return {
9328
9419
  env,
@@ -9479,7 +9570,7 @@ class AbortError extends Error {
9479
9570
  }
9480
9571
  }
9481
9572
 
9482
- 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-BNqCQ-lZ.cjs', document.baseURI).href)));
9573
+ 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-C9H8DkAi.cjs', document.baseURI).href)));
9483
9574
  const __dirname$1 = path.join(__filename$1, "..");
9484
9575
  function getGlobalClaudeVersion() {
9485
9576
  try {
@@ -10798,14 +10889,14 @@ var launch = /*#__PURE__*/Object.freeze({
10798
10889
  const unifiedProviderExecutors = {
10799
10890
  claude: async (opts) => {
10800
10891
  const claudeOptions = opts.claudeOptions ?? {};
10801
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-DGV1Dcv4.cjs'); });
10892
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-ByM9SjF1.cjs'); });
10802
10893
  await runClaude(opts.credentials, {
10803
10894
  ...claudeOptions,
10804
10895
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
10805
10896
  });
10806
10897
  },
10807
10898
  codex: async (opts) => {
10808
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-DQQkaW3Z.cjs'); });
10899
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-C1J5kcWX.cjs'); });
10809
10900
  await runCodex({
10810
10901
  credentials: opts.credentials,
10811
10902
  startedBy: opts.startedBy,
@@ -10814,7 +10905,7 @@ const unifiedProviderExecutors = {
10814
10905
  });
10815
10906
  },
10816
10907
  gemini: async (opts) => {
10817
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CmDSS8Qz.cjs'); });
10908
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BbXO6nqw.cjs'); });
10818
10909
  await runGemini({
10819
10910
  credentials: opts.credentials,
10820
10911
  startedBy: opts.startedBy
@@ -10897,7 +10988,7 @@ function shouldRunMainClaudeFlow(opts) {
10897
10988
  return;
10898
10989
  } else if (subcommand === "runtime") {
10899
10990
  if (args[1] === "providers") {
10900
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DOZYbypd.cjs'); });
10991
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-B2c92N5-.cjs'); });
10901
10992
  console.log(renderRuntimeProviders());
10902
10993
  return;
10903
10994
  }
@@ -10970,6 +11061,12 @@ function shouldRunMainClaudeFlow(opts) {
10970
11061
  process.exit(1);
10971
11062
  }
10972
11063
  return;
11064
+ } else if (subcommand === "session") {
11065
+ const exitCode = await handleSessionCommand(args.slice(1));
11066
+ if (exitCode !== 0) {
11067
+ process.exit(exitCode);
11068
+ }
11069
+ return;
10973
11070
  } else if (subcommand === "codex") {
10974
11071
  try {
10975
11072
  let startedBy = void 0;
@@ -11097,8 +11194,8 @@ function shouldRunMainClaudeFlow(opts) {
11097
11194
  const projectId = args[3];
11098
11195
  try {
11099
11196
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
11100
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-Baax81ZI.cjs'); }).then(function (n) { return n.persistence; });
11101
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Baax81ZI.cjs'); }).then(function (n) { return n.api; });
11197
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-D-eaNQRi.cjs'); }).then(function (n) { return n.persistence; });
11198
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-D-eaNQRi.cjs'); }).then(function (n) { return n.api; });
11102
11199
  let userEmail = void 0;
11103
11200
  try {
11104
11201
  const credentials = await readCredentials2();
@@ -11391,6 +11488,7 @@ ${chalk.bold("Usage:")}
11391
11488
  hicloud gemini Start Gemini mode (ACP)
11392
11489
  hicloud cursor Start Cursor mode (experimental ACP)
11393
11490
  hicloud connect Connect AI vendor API keys
11491
+ hicloud session Manage tracked daemon sessions
11394
11492
  hicloud notify Send push notification
11395
11493
  hicloud daemon Manage background service that allows
11396
11494
  to spawn new sessions away from your computer
@@ -11406,6 +11504,7 @@ ${chalk.bold("Examples:")}
11406
11504
  hicloud --claude-env ANTHROPIC_BASE_URL=http://127.0.0.1:3456
11407
11505
  Use a custom API endpoint (e.g., claude-code-router)
11408
11506
  hicloud auth login --force Authenticate
11507
+ hicloud session list List daemon-tracked sessions
11409
11508
  hicloud doctor Run diagnostics
11410
11509
 
11411
11510
  ${chalk.bold(`${BRAND_CONFIG.name} supports ALL Claude options!`)}