clawconnect-agent 0.2.13 → 0.2.15

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 (87) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +1 -1
  3. package/dist/commands/install.js +5 -3
  4. package/dist/commands/install.js.map +1 -1
  5. package/dist/commands/send-file.d.ts +2 -0
  6. package/dist/commands/send-file.js +8 -0
  7. package/dist/commands/send-file.js.map +1 -1
  8. package/dist/config/profile-log-rotation.d.ts +1 -1
  9. package/dist/config/profile-log-rotation.js +1 -1
  10. package/dist/config/profile-log-rotation.js.map +1 -1
  11. package/dist/core/relay/source-commit.d.ts +7 -0
  12. package/dist/core/relay/source-commit.js +25 -1
  13. package/dist/core/relay/source-commit.js.map +1 -1
  14. package/dist/hermes/hermes-relay-manager.d.ts +3 -0
  15. package/dist/hermes/hermes-relay-manager.js +7 -0
  16. package/dist/hermes/hermes-relay-manager.js.map +1 -1
  17. package/dist/hermes/relay/hermes-cron-change-relay.d.ts +28 -0
  18. package/dist/hermes/relay/hermes-cron-change-relay.js +55 -0
  19. package/dist/hermes/relay/hermes-cron-change-relay.js.map +1 -0
  20. package/dist/hermes/runtime/hermes-cron-change-watcher.d.ts +34 -0
  21. package/dist/hermes/runtime/hermes-cron-change-watcher.js +135 -0
  22. package/dist/hermes/runtime/hermes-cron-change-watcher.js.map +1 -0
  23. package/dist/hermes/runtime/hermes-runtime-chat-cli.d.ts +16 -0
  24. package/dist/hermes/runtime/hermes-runtime-chat-cli.js +359 -0
  25. package/dist/hermes/runtime/hermes-runtime-chat-cli.js.map +1 -0
  26. package/dist/hermes/runtime/hermes-runtime-chat-file-transfer.d.ts +57 -0
  27. package/dist/hermes/runtime/hermes-runtime-chat-file-transfer.js +321 -0
  28. package/dist/hermes/runtime/hermes-runtime-chat-file-transfer.js.map +1 -0
  29. package/dist/hermes/runtime/hermes-runtime-chat-message.d.ts +10 -0
  30. package/dist/hermes/runtime/hermes-runtime-chat-message.js +133 -0
  31. package/dist/hermes/runtime/hermes-runtime-chat-message.js.map +1 -0
  32. package/dist/hermes/runtime/hermes-runtime-chat-output.d.ts +17 -0
  33. package/dist/hermes/runtime/hermes-runtime-chat-output.js +90 -0
  34. package/dist/hermes/runtime/hermes-runtime-chat-output.js.map +1 -0
  35. package/dist/hermes/runtime/hermes-runtime-chat-queue.d.ts +1 -0
  36. package/dist/hermes/runtime/hermes-runtime-chat-queue.js +18 -0
  37. package/dist/hermes/runtime/hermes-runtime-chat-queue.js.map +1 -0
  38. package/dist/hermes/runtime/hermes-runtime-chat.d.ts +3 -33
  39. package/dist/hermes/runtime/hermes-runtime-chat.js +41 -910
  40. package/dist/hermes/runtime/hermes-runtime-chat.js.map +1 -1
  41. package/dist/hermes/runtime/hermes-runtime-history-turn-output.d.ts +30 -0
  42. package/dist/hermes/runtime/hermes-runtime-history-turn-output.js +61 -0
  43. package/dist/hermes/runtime/hermes-runtime-history-turn-output.js.map +1 -0
  44. package/dist/hermes/runtime/hermes-runtime-history.js +24 -3
  45. package/dist/hermes/runtime/hermes-runtime-history.js.map +1 -1
  46. package/dist/hermes/runtime/hermes-runtime-slash-command.d.ts +14 -1
  47. package/dist/hermes/runtime/hermes-runtime-slash-command.js +6 -1
  48. package/dist/hermes/runtime/hermes-runtime-slash-command.js.map +1 -1
  49. package/dist/hermes/runtime/hermes-runtime-state-db.js +28 -0
  50. package/dist/hermes/runtime/hermes-runtime-state-db.js.map +1 -1
  51. package/dist/index.js +1 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/openclaw/handlers/local-handlers.js +1 -1
  54. package/dist/openclaw/handlers/local-handlers.js.map +1 -1
  55. package/dist/openclaw/relay/chat-history.d.ts +5 -1
  56. package/dist/openclaw/relay/chat-history.js +4 -7
  57. package/dist/openclaw/relay/chat-history.js.map +1 -1
  58. package/dist/openclaw/relay/openclaw-source-commit-watcher.d.ts +7 -4
  59. package/dist/openclaw/relay/openclaw-source-commit-watcher.js +2 -0
  60. package/dist/openclaw/relay/openclaw-source-commit-watcher.js.map +1 -1
  61. package/dist/openclaw/relay/openclaw-source-cursor-connections.d.ts +2 -0
  62. package/dist/openclaw/relay/openclaw-source-cursor-connections.js +12 -0
  63. package/dist/openclaw/relay/openclaw-source-cursor-connections.js.map +1 -1
  64. package/dist/openclaw/relay/source-commit-projection.d.ts +28 -6
  65. package/dist/openclaw/relay/source-commit-projection.js +106 -30
  66. package/dist/openclaw/relay/source-commit-projection.js.map +1 -1
  67. package/dist/openclaw/relay/source-row-fingerprints.d.ts +22 -0
  68. package/dist/openclaw/relay/source-row-fingerprints.js +48 -0
  69. package/dist/openclaw/relay/source-row-fingerprints.js.map +1 -0
  70. package/dist/openclaw/relay-manager.js +44 -22
  71. package/dist/openclaw/relay-manager.js.map +1 -1
  72. package/dist/platform/service-manager-windows.d.ts +39 -29
  73. package/dist/platform/service-manager-windows.js +256 -448
  74. package/dist/platform/service-manager-windows.js.map +1 -1
  75. package/dist/platform/windows-process-control.d.ts +16 -0
  76. package/dist/platform/windows-process-control.js +91 -0
  77. package/dist/platform/windows-process-control.js.map +1 -0
  78. package/dist/platform/windows-service-host-source.d.ts +23 -0
  79. package/dist/platform/windows-service-host-source.js +357 -0
  80. package/dist/platform/windows-service-host-source.js.map +1 -0
  81. package/dist/platform/windows-service-legacy-startup.d.ts +27 -0
  82. package/dist/platform/windows-service-legacy-startup.js +101 -0
  83. package/dist/platform/windows-service-legacy-startup.js.map +1 -0
  84. package/dist/platform/windows-service-paths.d.ts +15 -0
  85. package/dist/platform/windows-service-paths.js +30 -0
  86. package/dist/platform/windows-service-paths.js.map +1 -0
  87. package/package.json +1 -1
@@ -1,36 +1,46 @@
1
1
  import { execFileSync } from "child_process";
2
2
  import type { ServiceStatus } from "./service-manager-common.js";
3
- export declare const TASK_NAME = "ClawConnectAgent";
4
- export declare const WINDOWS_SERVICE_RUNNER_NAME = "clawconnect-service.ps1";
5
- export declare const WINDOWS_RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
6
- export declare const WINDOWS_READ_ONLY_QUERY_TIMEOUT_MS = 5000;
7
- export interface WindowsServiceStatusProbeOptions {
3
+ import type { WindowsQueryTimeoutReporter } from "./windows-process-control.js";
4
+ export { windowsServiceName } from "./windows-service-paths.js";
5
+ export { buildWindowsProcessQueryScript, WINDOWS_READ_ONLY_QUERY_TIMEOUT_MS, } from "./windows-process-control.js";
6
+ export declare const WINDOWS_SERVICE_STATE_POLL_INTERVAL_MS = 500;
7
+ export declare const WINDOWS_SERVICE_STATE_TIMEOUT_MS = 30000;
8
+ /** 失败后第 1、2 次 5 秒重启,之后 60 秒;24 小时无失败则清零计数。 */
9
+ export declare const WINDOWS_SERVICE_FAILURE_ACTIONS = "restart/5000/restart/5000/restart/60000";
10
+ export declare const WINDOWS_SERVICE_FAILURE_RESET_SECONDS = 86400;
11
+ export type WindowsServiceState = "running" | "stopped" | "pending" | "missing" | "unknown";
12
+ export interface WindowsServiceDeps {
8
13
  execFileSyncImpl?: typeof execFileSync;
9
- onQueryTimeout?: (probe: string) => void;
10
- scriptPath?: string;
14
+ onQueryTimeout?: WindowsQueryTimeoutReporter;
15
+ sleepSync?: (ms: number) => void;
16
+ /** 测试用:覆盖 csc.exe 路径解析。 */
17
+ cscPath?: string;
18
+ /** 测试用:替换"结束 Agent 进程"的动作,避免单测去执行 Windows 命令。 */
19
+ killProcess?: (profile: string | undefined) => boolean;
20
+ /** 测试用:替换"编译服务宿主 exe"的动作,避免单测写入真实主目录。 */
21
+ compileHost?: (profile: string | undefined) => void;
22
+ /** 测试用:替换"写服务宿主配置"的动作,避免单测写入真实主目录。 */
23
+ writeConfig?: (profile: string | undefined) => void;
24
+ /** 测试用:覆盖服务账户,避免依赖运行测试的机器的 USERNAME / USERDOMAIN。 */
25
+ account?: string;
11
26
  }
12
- export declare function windowsTaskName(profile?: string): string;
13
- export declare function buildWindowsPowerShellBootstrap(command: string): string;
14
27
  export declare function normalizeWindowsServiceLogEncoding(path: string): void;
15
- export declare function buildWindowsServiceProcessCommand(args: string[], logPath: string, errorLogPath: string): string;
16
- export declare function windowsServiceRunnerPath(profile?: string): string;
17
- export declare function buildWindowsServiceTaskCommand(runnerPath: string): string;
18
- export declare function buildWindowsStartupRegistryArgs(taskName: string, taskCommand: string): string[];
19
- export declare function migrateLegacyWindowsStartup(profile?: string, options?: Pick<WindowsServiceStatusProbeOptions, "execFileSyncImpl" | "onQueryTimeout"> & {
20
- defaultProfileConfigured?: boolean;
21
- stopLegacyProcess?: () => void;
22
- }): boolean;
23
- export declare function buildWindowsScheduledTaskStateScript(): string;
24
- export declare function buildWindowsDetachedRunnerStartScript(): string;
25
- export declare function writeWindowsServiceRunner(profile: string | undefined, args: string[], logPath: string, errorLogPath: string): string;
28
+ export declare function buildWindowsServiceStateScript(): string;
29
+ /** 服务账户:域/计算机名\用户名。服务必须以当前用户运行,才能读写其目录下的配置、日志与本机网关。 */
30
+ export declare function windowsServiceAccount(env?: NodeJS.ProcessEnv): string;
26
31
  /**
27
- * Kill any running node processes that are executing this specific script.
28
- * Uses execFileSync to bypass cmd.exe, avoiding CMD quote-mangling.
29
- * Returns true if any processes were killed.
32
+ * 创建服务并设置当前用户凭据。密码只经 Read-Host -AsSecureString 在 PowerShell 进程内流转,
33
+ * 不进入命令行参数,也不经过 Node。创建前先校验密码,避免注册一个永远以 1069 启动失败的服务。
30
34
  */
31
- export declare function buildWindowsProcessQueryScript(profile?: string): string;
32
- export declare function installWindowsService(profile?: string): boolean;
33
- export declare function uninstallWindowsService(profile?: string): boolean;
34
- export declare function restartWindowsService(profile?: string): boolean;
35
- export declare function stopWindowsService(profile?: string): boolean;
36
- export declare function getWindowsServiceStatus(profile?: string, options?: WindowsServiceStatusProbeOptions): ServiceStatus;
35
+ export declare function buildWindowsServiceCreateScript(): string;
36
+ /** SCM 启动宿主时传入的参数:服务名 + 宿主配置路径。 */
37
+ export declare function buildWindowsServiceBinaryPath(hostExePath: string, serviceName: string, configPath: string): string;
38
+ export declare function resolveWindowsCscPath(fileExists?: (path: string) => boolean, windowsDir?: string): string | undefined;
39
+ export declare function buildWindowsServiceHostCompileArgs(sourcePath: string, outputPath: string): string[];
40
+ export declare function isWindowsElevated(execFileSyncImpl?: typeof execFileSync): boolean;
41
+ export declare function queryWindowsServiceState(serviceName: string, deps?: WindowsServiceDeps): WindowsServiceState;
42
+ export declare function installWindowsService(profile?: string, deps?: WindowsServiceDeps): boolean;
43
+ export declare function restartWindowsService(profile?: string, deps?: WindowsServiceDeps): boolean;
44
+ export declare function stopWindowsService(profile?: string, deps?: WindowsServiceDeps): boolean;
45
+ export declare function uninstallWindowsService(profile?: string, deps?: WindowsServiceDeps): boolean;
46
+ export declare function getWindowsServiceStatus(profile?: string, deps?: WindowsServiceDeps): ServiceStatus;