happy-imou-cloud 2.1.33 → 2.1.35

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 (25) hide show
  1. package/dist/{BaseReasoningProcessor-Dn4yfLtp.mjs → BaseReasoningProcessor-DbYQw-IT.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-Cf7ZloaL.cjs → BaseReasoningProcessor-vn-Cvazk.cjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-DPLBjVEC.cjs → ProviderSelectionHandler-CHXCKI8q.cjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-BuA83F9G.mjs → ProviderSelectionHandler-Dk4HaiPR.mjs} +2 -2
  5. package/dist/{api-D7CVG9j4.mjs → api-C_wLDBlG.mjs} +1 -1
  6. package/dist/{api-DdWb_F8T.cjs → api-CeZTggZF.cjs} +1 -1
  7. package/dist/{command-CDJ4E4Dk.mjs → command-Dth-tCSc.mjs} +2 -2
  8. package/dist/{command-CMsN76Yr.cjs → command-djmqu0my.cjs} +2 -2
  9. package/dist/{index-DDSbNPcY.cjs → index-CckDTAoL.cjs} +50 -28
  10. package/dist/{index-hvV-0nuB.mjs → index-l0zi9G9M.mjs} +47 -25
  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 +144 -116
  15. package/dist/lib.d.mts +144 -116
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-lYTMUILm.mjs → registerKillSessionHandler-BxbrcRl3.mjs} +2 -2
  18. package/dist/{registerKillSessionHandler-mjF_nLkn.cjs → registerKillSessionHandler-CMyw8PFY.cjs} +2 -2
  19. package/dist/{runClaude-8hpqBN48.mjs → runClaude-BK-xZzSe.mjs} +4 -4
  20. package/dist/{runClaude-D_KWeKjf.cjs → runClaude-CniBKZZh.cjs} +4 -4
  21. package/dist/{runCodex-Cl-S6dkS.mjs → runCodex-C4X1beyB.mjs} +5 -5
  22. package/dist/{runCodex-DnlU4uJq.cjs → runCodex-Dl1BeoP7.cjs} +5 -5
  23. package/dist/{runGemini-K3pPjvi4.mjs → runGemini-Bigzf0Vw.mjs} +4 -4
  24. package/dist/{runGemini-91fhiYl9.cjs → runGemini-Bw9Z5tD5.cjs} +4 -4
  25. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { a as createSessionMetadata, p as publishSessionRegistration } from './index-hvV-0nuB.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-D7CVG9j4.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-l0zi9G9M.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-C_wLDBlG.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 index = require('./index-DDSbNPcY.cjs');
4
- var persistence = require('./api-DdWb_F8T.cjs');
3
+ var index = require('./index-CckDTAoL.cjs');
4
+ var persistence = require('./api-CeZTggZF.cjs');
5
5
  var node_events = require('node:events');
6
6
  var node_crypto = require('node:crypto');
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-DdWb_F8T.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-mjF_nLkn.cjs');
3
+ var persistence = require('./api-CeZTggZF.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-CMyw8PFY.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-D7CVG9j4.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-lYTMUILm.mjs';
1
+ import { l as logger } from './api-C_wLDBlG.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BxbrcRl3.mjs';
3
3
 
4
4
  async function runModeLoop(opts) {
5
5
  let currentMode = opts.startingMode;
@@ -18,7 +18,7 @@ import { spawn } from 'node:child_process';
18
18
  import { Expo } from 'expo-server-sdk';
19
19
 
20
20
  var name = "happy-imou-cloud";
21
- var version = "2.1.33";
21
+ var version = "2.1.35";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -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.33";
41
+ var version = "2.1.35";
42
42
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
43
43
  var author = "long.zhu";
44
44
  var license = "MIT";
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-hvV-0nuB.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-l0zi9G9M.mjs';
2
2
  import 'chalk';
3
- import './api-D7CVG9j4.mjs';
3
+ import './api-C_wLDBlG.mjs';
4
4
  import 'axios';
5
5
  import 'fs';
6
6
  import 'node:fs';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DDSbNPcY.cjs');
3
+ var index = require('./index-CckDTAoL.cjs');
4
4
  require('chalk');
5
- require('./api-DdWb_F8T.cjs');
5
+ require('./api-CeZTggZF.cjs');
6
6
  require('axios');
7
7
  require('fs');
8
8
  require('node:fs');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var persistence = require('./api-DdWb_F8T.cjs');
4
+ var persistence = require('./api-CeZTggZF.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-DDSbNPcY.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-CckDTAoL.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-DDSbNPcY.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-CckDTAoL.cjs', document.baseURI).href))));
641
641
  function projectPath() {
642
642
  const path = path$1.resolve(__dirname$2, "..");
643
643
  return path;
@@ -697,6 +697,18 @@ function classifyHappyProcess(proc) {
697
697
  }
698
698
  return { pid: proc.pid, command: cmd || name, type };
699
699
  }
700
+ function collectProtectedProcessIds(processes, currentPid, fallbackParentPid) {
701
+ const pidToProcess = new Map(processes.map((proc) => [proc.pid, proc]));
702
+ const protectedPids = /* @__PURE__ */ new Set([currentPid]);
703
+ const visited = /* @__PURE__ */ new Set();
704
+ let parentPid = pidToProcess.get(currentPid)?.ppid ?? fallbackParentPid;
705
+ while (Number.isInteger(parentPid) && parentPid > 0 && !visited.has(parentPid)) {
706
+ protectedPids.add(parentPid);
707
+ visited.add(parentPid);
708
+ parentPid = pidToProcess.get(parentPid)?.ppid ?? 0;
709
+ }
710
+ return protectedPids;
711
+ }
700
712
  function parseWindowsProcessSnapshots(rawOutput) {
701
713
  if (!rawOutput) {
702
714
  return [];
@@ -710,6 +722,7 @@ function parseWindowsProcessSnapshots(rawOutput) {
710
722
  const rows = Array.isArray(parsed) ? parsed : [parsed];
711
723
  return rows.filter((row) => typeof row?.ProcessId === "number" && typeof row?.Name === "string").map((row) => ({
712
724
  pid: row.ProcessId,
725
+ ppid: typeof row.ParentProcessId === "number" ? row.ParentProcessId : 0,
713
726
  name: row.Name,
714
727
  cmd: typeof row.CommandLine === "string" ? row.CommandLine : ""
715
728
  }));
@@ -738,7 +751,7 @@ function runWindowsProcessSnapshotQuery(command) {
738
751
  }
739
752
  function getWindowsProcessSnapshots() {
740
753
  return runWindowsProcessSnapshotQuery(
741
- "Get-CimInstance Win32_Process | Select-Object ProcessId, Name, CommandLine | ConvertTo-Json -Compress"
754
+ "Get-CimInstance Win32_Process | Select-Object ProcessId, ParentProcessId, Name, CommandLine | ConvertTo-Json -Compress"
742
755
  );
743
756
  }
744
757
  function getWindowsProcessSnapshotByPid(pid) {
@@ -746,7 +759,7 @@ function getWindowsProcessSnapshotByPid(pid) {
746
759
  return null;
747
760
  }
748
761
  const [proc] = runWindowsProcessSnapshotQuery(
749
- `Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" | Select-Object ProcessId, Name, CommandLine | ConvertTo-Json -Compress`
762
+ `Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" | Select-Object ProcessId, ParentProcessId, Name, CommandLine | ConvertTo-Json -Compress`
750
763
  );
751
764
  return proc ?? null;
752
765
  }
@@ -782,10 +795,20 @@ function findWindowsHappyProcesses(processes) {
782
795
  function toProcessSnapshot(proc) {
783
796
  return {
784
797
  pid: proc.pid,
798
+ ppid: "ppid" in proc && typeof proc.ppid === "number" ? proc.ppid : 0,
785
799
  name: proc.name || "",
786
800
  cmd: proc.cmd || ""
787
801
  };
788
802
  }
803
+ async function listProcessSnapshots() {
804
+ if (process.platform === "win32") {
805
+ const windowsProcesses = getWindowsProcessSnapshots();
806
+ if (windowsProcesses.length > 0) {
807
+ return windowsProcesses;
808
+ }
809
+ }
810
+ return (await psList()).map(toProcessSnapshot);
811
+ }
789
812
  async function findHappyProcessByPid(pid) {
790
813
  try {
791
814
  if (process.platform === "win32") {
@@ -819,22 +842,13 @@ async function findHappyProcessByPid(pid) {
819
842
  }
820
843
  async function findAllHappyProcesses() {
821
844
  try {
845
+ const processSnapshots = await listProcessSnapshots();
822
846
  if (process.platform === "win32") {
823
- const windowsProcesses = getWindowsProcessSnapshots();
824
- if (windowsProcesses.length > 0) {
825
- return findWindowsHappyProcesses(windowsProcesses);
826
- }
827
- const fallbackProcesses = (await psList()).map(toProcessSnapshot);
828
- return findWindowsHappyProcesses(fallbackProcesses);
847
+ return findWindowsHappyProcesses(processSnapshots);
829
848
  }
830
- const processes = await psList();
831
849
  const allProcesses = [];
832
- for (const proc of processes) {
833
- const match = classifyHappyProcess({
834
- pid: proc.pid,
835
- name: proc.name || "",
836
- cmd: proc.cmd || ""
837
- });
850
+ for (const proc of processSnapshots) {
851
+ const match = classifyHappyProcess(proc);
838
852
  if (match) {
839
853
  allProcesses.push(match);
840
854
  }
@@ -845,9 +859,11 @@ async function findAllHappyProcesses() {
845
859
  }
846
860
  }
847
861
  async function findRunawayHappyProcesses() {
848
- const allProcesses = await findAllHappyProcesses();
862
+ const processSnapshots = await listProcessSnapshots();
863
+ const protectedPids = collectProtectedProcessIds(processSnapshots, process.pid, process.ppid);
864
+ const allProcesses = process.platform === "win32" ? findWindowsHappyProcesses(processSnapshots) : processSnapshots.map(classifyHappyProcess).filter((proc) => proc !== null);
849
865
  return allProcesses.filter(
850
- (p) => p.pid !== process.pid && (p.type === "daemon" || p.type === "dev-daemon" || p.type === "daemon-spawned-session" || p.type === "dev-daemon-spawned" || p.type === "daemon-version-check" || p.type === "dev-daemon-version-check")
866
+ (p) => !protectedPids.has(p.pid) && (p.type === "daemon" || p.type === "dev-daemon" || p.type === "daemon-spawned-session" || p.type === "dev-daemon-spawned" || p.type === "daemon-version-check" || p.type === "dev-daemon-version-check")
851
867
  ).map((p) => ({ pid: p.pid, command: p.command }));
852
868
  }
853
869
  async function killRunawayHappyProcesses() {
@@ -5243,6 +5259,12 @@ function formatDispatchReceipt(receipt) {
5243
5259
  `scope=${receipt.notice.scope}`,
5244
5260
  `member_agent_id=${receipt.notice.member_agent_id ?? receipt.business_ack?.member_agent_id ?? receipt.member?.agentId ?? receipt.business_ack?.memberAgentId ?? ""}`,
5245
5261
  `session_id=${receipt.notice.session_id ?? receipt.business_ack?.session_id ?? receipt.member?.sessionId ?? ""}`,
5262
+ `runtime_session_id=${receipt.notice.runtime_session_id ?? ""}`,
5263
+ `delivery_session_id=${receipt.notice.delivery_session_id}`,
5264
+ `reply_session_id=${receipt.notice.reply_session_id}`,
5265
+ `machine_id=${receipt.notice.machine_id ?? ""}`,
5266
+ `machine_locality=${receipt.notice.machine_locality}`,
5267
+ `machine_reachability=${receipt.notice.machine_reachability}`,
5246
5268
  `route_type=${receipt.business_ack?.route_type ?? receipt.notice.route_type}`,
5247
5269
  `ack_type=${receipt.business_ack?.ack_type ?? receipt.notice.ack_type}`,
5248
5270
  `reply_mode=${receipt.business_ack?.reply_mode ?? receipt.notice.reply_mode}`,
@@ -5255,7 +5277,7 @@ function formatDispatchReceipt(receipt) {
5255
5277
  `rejection_reason=${receipt.validation.rejection_reason ?? ""}`,
5256
5278
  `position_truth_agent_id=${receipt.validation.position_truth_agent_id ?? ""}`,
5257
5279
  `responsibility_truth_member_agent_id=${receipt.validation.responsibility_truth_member_agent_id ?? ""}`,
5258
- `runtime_session_id=${receipt.validation.runtime_session_id ?? ""}`
5280
+ `validation_runtime_session_id=${receipt.validation.runtime_session_id ?? ""}`
5259
5281
  ];
5260
5282
  return lines.join("\n");
5261
5283
  }
@@ -10347,7 +10369,7 @@ class AbortError extends Error {
10347
10369
  }
10348
10370
  }
10349
10371
 
10350
- 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-DDSbNPcY.cjs', document.baseURI).href)));
10372
+ 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-CckDTAoL.cjs', document.baseURI).href)));
10351
10373
  const __dirname$1 = path.join(__filename$1, "..");
10352
10374
  function getGlobalClaudeVersion() {
10353
10375
  try {
@@ -11670,14 +11692,14 @@ var launch = /*#__PURE__*/Object.freeze({
11670
11692
  const unifiedProviderExecutors = {
11671
11693
  claude: async (opts) => {
11672
11694
  const claudeOptions = opts.claudeOptions ?? {};
11673
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-D_KWeKjf.cjs'); });
11695
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-CniBKZZh.cjs'); });
11674
11696
  await runClaude(opts.credentials, {
11675
11697
  ...claudeOptions,
11676
11698
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
11677
11699
  });
11678
11700
  },
11679
11701
  codex: async (opts) => {
11680
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-DnlU4uJq.cjs'); });
11702
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-Dl1BeoP7.cjs'); });
11681
11703
  await runCodex({
11682
11704
  credentials: opts.credentials,
11683
11705
  startedBy: opts.startedBy,
@@ -11686,7 +11708,7 @@ const unifiedProviderExecutors = {
11686
11708
  });
11687
11709
  },
11688
11710
  gemini: async (opts) => {
11689
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-91fhiYl9.cjs'); });
11711
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-Bw9Z5tD5.cjs'); });
11690
11712
  await runGemini({
11691
11713
  credentials: opts.credentials,
11692
11714
  startedBy: opts.startedBy
@@ -11769,7 +11791,7 @@ function shouldRunMainClaudeFlow(opts) {
11769
11791
  return;
11770
11792
  } else if (subcommand === "runtime") {
11771
11793
  if (args[1] === "providers") {
11772
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-CMsN76Yr.cjs'); });
11794
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-djmqu0my.cjs'); });
11773
11795
  console.log(renderRuntimeProviders());
11774
11796
  return;
11775
11797
  }
@@ -11975,8 +11997,8 @@ function shouldRunMainClaudeFlow(opts) {
11975
11997
  const projectId = args[3];
11976
11998
  try {
11977
11999
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
11978
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-DdWb_F8T.cjs'); }).then(function (n) { return n.persistence; });
11979
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-DdWb_F8T.cjs'); }).then(function (n) { return n.api; });
12000
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-CeZTggZF.cjs'); }).then(function (n) { return n.persistence; });
12001
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-CeZTggZF.cjs'); }).then(function (n) { return n.api; });
11980
12002
  let userEmail = void 0;
11981
12003
  try {
11982
12004
  const credentials = await readCredentials2();
@@ -1,5 +1,5 @@
1
1
  import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
2
- import { l as logger, m as encodeBase64, c as configuration, n as readCredentials, o as ensureSigningCredentials, r as readSettings, u as updateSettings, q as encodeBase64Url, j as delay, t as buildClientHeaders, v as decodeBase64, w as writeCredentialsLegacy, x as writeCredentialsDataKey, y as readDaemonState, z as HAPPY_CLOUD_DAEMON_PORT, B as clearDaemonState, C as packageJson, i as isAuthenticationRequiredError, D as acquireDaemonLock, E as writeDaemonState, A as ApiClient, F as releaseDaemonLock, G as validateProfileForAgent, I as getProfileEnvironmentVariables, J as clearCredentials, K as clearMachineId, L as readHappyOrgDispatchTruthSnapshot, M as processHappyOrgRepoRequests, N as HappyOrgTurnReportSchema, O as recordHappyOrgTurnReport, P as MessageContentSchema, Q as buildSocketAuth, R as encrypt, H as HeadTailPreviewBuffer, S as getLatestDaemonLog } from './api-D7CVG9j4.mjs';
2
+ import { l as logger, m as encodeBase64, c as configuration, n as readCredentials, o as ensureSigningCredentials, r as readSettings, u as updateSettings, q as encodeBase64Url, j as delay, t as buildClientHeaders, v as decodeBase64, w as writeCredentialsLegacy, x as writeCredentialsDataKey, y as readDaemonState, z as HAPPY_CLOUD_DAEMON_PORT, B as clearDaemonState, C as packageJson, i as isAuthenticationRequiredError, D as acquireDaemonLock, E as writeDaemonState, A as ApiClient, F as releaseDaemonLock, G as validateProfileForAgent, I as getProfileEnvironmentVariables, J as clearCredentials, K as clearMachineId, L as readHappyOrgDispatchTruthSnapshot, M as processHappyOrgRepoRequests, N as HappyOrgTurnReportSchema, O as recordHappyOrgTurnReport, P as MessageContentSchema, Q as buildSocketAuth, R as encrypt, H as HeadTailPreviewBuffer, S as getLatestDaemonLog } from './api-C_wLDBlG.mjs';
3
3
  import { z } from 'zod';
4
4
  import fs, { writeFile as writeFile$1, rename, unlink as unlink$1 } from 'fs/promises';
5
5
  import os$1, { homedir } from 'os';
@@ -675,6 +675,18 @@ function classifyHappyProcess(proc) {
675
675
  }
676
676
  return { pid: proc.pid, command: cmd || name, type };
677
677
  }
678
+ function collectProtectedProcessIds(processes, currentPid, fallbackParentPid) {
679
+ const pidToProcess = new Map(processes.map((proc) => [proc.pid, proc]));
680
+ const protectedPids = /* @__PURE__ */ new Set([currentPid]);
681
+ const visited = /* @__PURE__ */ new Set();
682
+ let parentPid = pidToProcess.get(currentPid)?.ppid ?? fallbackParentPid;
683
+ while (Number.isInteger(parentPid) && parentPid > 0 && !visited.has(parentPid)) {
684
+ protectedPids.add(parentPid);
685
+ visited.add(parentPid);
686
+ parentPid = pidToProcess.get(parentPid)?.ppid ?? 0;
687
+ }
688
+ return protectedPids;
689
+ }
678
690
  function parseWindowsProcessSnapshots(rawOutput) {
679
691
  if (!rawOutput) {
680
692
  return [];
@@ -688,6 +700,7 @@ function parseWindowsProcessSnapshots(rawOutput) {
688
700
  const rows = Array.isArray(parsed) ? parsed : [parsed];
689
701
  return rows.filter((row) => typeof row?.ProcessId === "number" && typeof row?.Name === "string").map((row) => ({
690
702
  pid: row.ProcessId,
703
+ ppid: typeof row.ParentProcessId === "number" ? row.ParentProcessId : 0,
691
704
  name: row.Name,
692
705
  cmd: typeof row.CommandLine === "string" ? row.CommandLine : ""
693
706
  }));
@@ -716,7 +729,7 @@ function runWindowsProcessSnapshotQuery(command) {
716
729
  }
717
730
  function getWindowsProcessSnapshots() {
718
731
  return runWindowsProcessSnapshotQuery(
719
- "Get-CimInstance Win32_Process | Select-Object ProcessId, Name, CommandLine | ConvertTo-Json -Compress"
732
+ "Get-CimInstance Win32_Process | Select-Object ProcessId, ParentProcessId, Name, CommandLine | ConvertTo-Json -Compress"
720
733
  );
721
734
  }
722
735
  function getWindowsProcessSnapshotByPid(pid) {
@@ -724,7 +737,7 @@ function getWindowsProcessSnapshotByPid(pid) {
724
737
  return null;
725
738
  }
726
739
  const [proc] = runWindowsProcessSnapshotQuery(
727
- `Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" | Select-Object ProcessId, Name, CommandLine | ConvertTo-Json -Compress`
740
+ `Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" | Select-Object ProcessId, ParentProcessId, Name, CommandLine | ConvertTo-Json -Compress`
728
741
  );
729
742
  return proc ?? null;
730
743
  }
@@ -760,10 +773,20 @@ function findWindowsHappyProcesses(processes) {
760
773
  function toProcessSnapshot(proc) {
761
774
  return {
762
775
  pid: proc.pid,
776
+ ppid: "ppid" in proc && typeof proc.ppid === "number" ? proc.ppid : 0,
763
777
  name: proc.name || "",
764
778
  cmd: proc.cmd || ""
765
779
  };
766
780
  }
781
+ async function listProcessSnapshots() {
782
+ if (process.platform === "win32") {
783
+ const windowsProcesses = getWindowsProcessSnapshots();
784
+ if (windowsProcesses.length > 0) {
785
+ return windowsProcesses;
786
+ }
787
+ }
788
+ return (await psList()).map(toProcessSnapshot);
789
+ }
767
790
  async function findHappyProcessByPid(pid) {
768
791
  try {
769
792
  if (process.platform === "win32") {
@@ -797,22 +820,13 @@ async function findHappyProcessByPid(pid) {
797
820
  }
798
821
  async function findAllHappyProcesses() {
799
822
  try {
823
+ const processSnapshots = await listProcessSnapshots();
800
824
  if (process.platform === "win32") {
801
- const windowsProcesses = getWindowsProcessSnapshots();
802
- if (windowsProcesses.length > 0) {
803
- return findWindowsHappyProcesses(windowsProcesses);
804
- }
805
- const fallbackProcesses = (await psList()).map(toProcessSnapshot);
806
- return findWindowsHappyProcesses(fallbackProcesses);
825
+ return findWindowsHappyProcesses(processSnapshots);
807
826
  }
808
- const processes = await psList();
809
827
  const allProcesses = [];
810
- for (const proc of processes) {
811
- const match = classifyHappyProcess({
812
- pid: proc.pid,
813
- name: proc.name || "",
814
- cmd: proc.cmd || ""
815
- });
828
+ for (const proc of processSnapshots) {
829
+ const match = classifyHappyProcess(proc);
816
830
  if (match) {
817
831
  allProcesses.push(match);
818
832
  }
@@ -823,9 +837,11 @@ async function findAllHappyProcesses() {
823
837
  }
824
838
  }
825
839
  async function findRunawayHappyProcesses() {
826
- const allProcesses = await findAllHappyProcesses();
840
+ const processSnapshots = await listProcessSnapshots();
841
+ const protectedPids = collectProtectedProcessIds(processSnapshots, process.pid, process.ppid);
842
+ const allProcesses = process.platform === "win32" ? findWindowsHappyProcesses(processSnapshots) : processSnapshots.map(classifyHappyProcess).filter((proc) => proc !== null);
827
843
  return allProcesses.filter(
828
- (p) => p.pid !== process.pid && (p.type === "daemon" || p.type === "dev-daemon" || p.type === "daemon-spawned-session" || p.type === "dev-daemon-spawned" || p.type === "daemon-version-check" || p.type === "dev-daemon-version-check")
844
+ (p) => !protectedPids.has(p.pid) && (p.type === "daemon" || p.type === "dev-daemon" || p.type === "daemon-spawned-session" || p.type === "dev-daemon-spawned" || p.type === "daemon-version-check" || p.type === "dev-daemon-version-check")
829
845
  ).map((p) => ({ pid: p.pid, command: p.command }));
830
846
  }
831
847
  async function killRunawayHappyProcesses() {
@@ -5221,6 +5237,12 @@ function formatDispatchReceipt(receipt) {
5221
5237
  `scope=${receipt.notice.scope}`,
5222
5238
  `member_agent_id=${receipt.notice.member_agent_id ?? receipt.business_ack?.member_agent_id ?? receipt.member?.agentId ?? receipt.business_ack?.memberAgentId ?? ""}`,
5223
5239
  `session_id=${receipt.notice.session_id ?? receipt.business_ack?.session_id ?? receipt.member?.sessionId ?? ""}`,
5240
+ `runtime_session_id=${receipt.notice.runtime_session_id ?? ""}`,
5241
+ `delivery_session_id=${receipt.notice.delivery_session_id}`,
5242
+ `reply_session_id=${receipt.notice.reply_session_id}`,
5243
+ `machine_id=${receipt.notice.machine_id ?? ""}`,
5244
+ `machine_locality=${receipt.notice.machine_locality}`,
5245
+ `machine_reachability=${receipt.notice.machine_reachability}`,
5224
5246
  `route_type=${receipt.business_ack?.route_type ?? receipt.notice.route_type}`,
5225
5247
  `ack_type=${receipt.business_ack?.ack_type ?? receipt.notice.ack_type}`,
5226
5248
  `reply_mode=${receipt.business_ack?.reply_mode ?? receipt.notice.reply_mode}`,
@@ -5233,7 +5255,7 @@ function formatDispatchReceipt(receipt) {
5233
5255
  `rejection_reason=${receipt.validation.rejection_reason ?? ""}`,
5234
5256
  `position_truth_agent_id=${receipt.validation.position_truth_agent_id ?? ""}`,
5235
5257
  `responsibility_truth_member_agent_id=${receipt.validation.responsibility_truth_member_agent_id ?? ""}`,
5236
- `runtime_session_id=${receipt.validation.runtime_session_id ?? ""}`
5258
+ `validation_runtime_session_id=${receipt.validation.runtime_session_id ?? ""}`
5237
5259
  ];
5238
5260
  return lines.join("\n");
5239
5261
  }
@@ -11648,14 +11670,14 @@ var launch = /*#__PURE__*/Object.freeze({
11648
11670
  const unifiedProviderExecutors = {
11649
11671
  claude: async (opts) => {
11650
11672
  const claudeOptions = opts.claudeOptions ?? {};
11651
- const { runClaude } = await import('./runClaude-8hpqBN48.mjs');
11673
+ const { runClaude } = await import('./runClaude-BK-xZzSe.mjs');
11652
11674
  await runClaude(opts.credentials, {
11653
11675
  ...claudeOptions,
11654
11676
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
11655
11677
  });
11656
11678
  },
11657
11679
  codex: async (opts) => {
11658
- const { runCodex } = await import('./runCodex-Cl-S6dkS.mjs');
11680
+ const { runCodex } = await import('./runCodex-C4X1beyB.mjs');
11659
11681
  await runCodex({
11660
11682
  credentials: opts.credentials,
11661
11683
  startedBy: opts.startedBy,
@@ -11664,7 +11686,7 @@ const unifiedProviderExecutors = {
11664
11686
  });
11665
11687
  },
11666
11688
  gemini: async (opts) => {
11667
- const { runGemini } = await import('./runGemini-K3pPjvi4.mjs');
11689
+ const { runGemini } = await import('./runGemini-Bigzf0Vw.mjs');
11668
11690
  await runGemini({
11669
11691
  credentials: opts.credentials,
11670
11692
  startedBy: opts.startedBy
@@ -11747,7 +11769,7 @@ function shouldRunMainClaudeFlow(opts) {
11747
11769
  return;
11748
11770
  } else if (subcommand === "runtime") {
11749
11771
  if (args[1] === "providers") {
11750
- const { renderRuntimeProviders } = await import('./command-CDJ4E4Dk.mjs');
11772
+ const { renderRuntimeProviders } = await import('./command-Dth-tCSc.mjs');
11751
11773
  console.log(renderRuntimeProviders());
11752
11774
  return;
11753
11775
  }
@@ -11953,8 +11975,8 @@ function shouldRunMainClaudeFlow(opts) {
11953
11975
  const projectId = args[3];
11954
11976
  try {
11955
11977
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
11956
- const { readCredentials: readCredentials2 } = await import('./api-D7CVG9j4.mjs').then(function (n) { return n.T; });
11957
- const { ApiClient: ApiClient2 } = await import('./api-D7CVG9j4.mjs').then(function (n) { return n.U; });
11978
+ const { readCredentials: readCredentials2 } = await import('./api-C_wLDBlG.mjs').then(function (n) { return n.T; });
11979
+ const { ApiClient: ApiClient2 } = await import('./api-C_wLDBlG.mjs').then(function (n) { return n.U; });
11958
11980
  let userEmail = void 0;
11959
11981
  try {
11960
11982
  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-DdWb_F8T.cjs');
4
+ require('./api-CeZTggZF.cjs');
5
5
  require('zod');
6
- require('./index-DDSbNPcY.cjs');
6
+ require('./index-CckDTAoL.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-D7CVG9j4.mjs';
2
+ import './api-C_wLDBlG.mjs';
3
3
  import 'zod';
4
- import './index-hvV-0nuB.mjs';
4
+ import './index-l0zi9G9M.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-DdWb_F8T.cjs');
3
+ var persistence = require('./api-CeZTggZF.cjs');
4
4
  var types = require('./types-DVk3crez.cjs');
5
5
  require('axios');
6
6
  require('chalk');