clawconnect-agent 0.1.5 → 0.1.7

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 (126) hide show
  1. package/README.md +83 -7
  2. package/README.zh-CN.md +93 -17
  3. package/dist/commands/install.js +10 -4
  4. package/dist/commands/install.js.map +1 -1
  5. package/dist/commands/local-handlers.js +0 -28
  6. package/dist/commands/local-handlers.js.map +1 -1
  7. package/dist/commands/pair.d.ts +2 -0
  8. package/dist/commands/pair.js +17 -6
  9. package/dist/commands/pair.js.map +1 -1
  10. package/dist/commands/run.js +14 -17
  11. package/dist/commands/run.js.map +1 -1
  12. package/dist/commands/send-file.d.ts +2 -0
  13. package/dist/commands/send-file.js +6 -0
  14. package/dist/commands/send-file.js.map +1 -1
  15. package/dist/commands/status.d.ts +13 -1
  16. package/dist/commands/status.js +58 -15
  17. package/dist/commands/status.js.map +1 -1
  18. package/dist/config/config.d.ts +6 -11
  19. package/dist/config/config.js +19 -48
  20. package/dist/config/config.js.map +1 -1
  21. package/dist/config/env.d.ts +1 -1
  22. package/dist/config/env.js +4 -5
  23. package/dist/config/env.js.map +1 -1
  24. package/dist/config/profile.d.ts +11 -0
  25. package/dist/config/profile.js +80 -0
  26. package/dist/config/profile.js.map +1 -0
  27. package/dist/gateway-profiles.d.ts +8 -0
  28. package/dist/gateway-profiles.js +24 -0
  29. package/dist/gateway-profiles.js.map +1 -0
  30. package/dist/hermes/hermes-relay-manager.d.ts +49 -0
  31. package/dist/hermes/hermes-relay-manager.js +636 -0
  32. package/dist/hermes/hermes-relay-manager.js.map +1 -0
  33. package/dist/hermes/hermes-runtime.d.ts +8 -0
  34. package/dist/hermes/hermes-runtime.js +8 -0
  35. package/dist/hermes/hermes-runtime.js.map +1 -0
  36. package/dist/hermes/hermes-session-store.d.ts +15 -0
  37. package/dist/hermes/hermes-session-store.js +152 -0
  38. package/dist/hermes/hermes-session-store.js.map +1 -0
  39. package/dist/hermes/hermes-voice-input.d.ts +13 -0
  40. package/dist/hermes/hermes-voice-input.js +27 -0
  41. package/dist/hermes/hermes-voice-input.js.map +1 -0
  42. package/dist/hermes/models/hermes-runtime-artifacts.d.ts +3 -0
  43. package/dist/hermes/models/hermes-runtime-artifacts.js +65 -0
  44. package/dist/hermes/models/hermes-runtime-artifacts.js.map +1 -0
  45. package/dist/hermes/models/hermes-runtime-backups.d.ts +5 -0
  46. package/dist/hermes/models/hermes-runtime-backups.js +128 -0
  47. package/dist/hermes/models/hermes-runtime-backups.js.map +1 -0
  48. package/dist/hermes/models/hermes-runtime-chat.d.ts +40 -0
  49. package/dist/hermes/models/hermes-runtime-chat.js +623 -0
  50. package/dist/hermes/models/hermes-runtime-chat.js.map +1 -0
  51. package/dist/hermes/models/hermes-runtime-command-router.d.ts +2 -0
  52. package/dist/hermes/models/hermes-runtime-command-router.js +93 -0
  53. package/dist/hermes/models/hermes-runtime-command-router.js.map +1 -0
  54. package/dist/hermes/models/hermes-runtime-command-utils.d.ts +3 -0
  55. package/dist/hermes/models/hermes-runtime-command-utils.js +19 -0
  56. package/dist/hermes/models/hermes-runtime-command-utils.js.map +1 -0
  57. package/dist/hermes/models/hermes-runtime-cron.d.ts +11 -0
  58. package/dist/hermes/models/hermes-runtime-cron.js +301 -0
  59. package/dist/hermes/models/hermes-runtime-cron.js.map +1 -0
  60. package/dist/hermes/models/hermes-runtime-lifecycle.d.ts +9 -0
  61. package/dist/hermes/models/hermes-runtime-lifecycle.js +111 -0
  62. package/dist/hermes/models/hermes-runtime-lifecycle.js.map +1 -0
  63. package/dist/hermes/models/hermes-runtime-models.d.ts +29 -0
  64. package/dist/hermes/models/hermes-runtime-models.js +125 -0
  65. package/dist/hermes/models/hermes-runtime-models.js.map +1 -0
  66. package/dist/hermes/models/hermes-runtime-process.d.ts +22 -0
  67. package/dist/hermes/models/hermes-runtime-process.js +130 -0
  68. package/dist/hermes/models/hermes-runtime-process.js.map +1 -0
  69. package/dist/hermes/models/hermes-runtime-sessions.d.ts +5 -0
  70. package/dist/hermes/models/hermes-runtime-sessions.js +71 -0
  71. package/dist/hermes/models/hermes-runtime-sessions.js.map +1 -0
  72. package/dist/hermes/models/hermes-runtime-skills.d.ts +13 -0
  73. package/dist/hermes/models/hermes-runtime-skills.js +322 -0
  74. package/dist/hermes/models/hermes-runtime-skills.js.map +1 -0
  75. package/dist/hermes/models/hermes-runtime-types.d.ts +19 -0
  76. package/dist/hermes/models/hermes-runtime-types.js +2 -0
  77. package/dist/hermes/models/hermes-runtime-types.js.map +1 -0
  78. package/dist/hermes/models/hermes-runtime-usage.d.ts +22 -0
  79. package/dist/hermes/models/hermes-runtime-usage.js +211 -0
  80. package/dist/hermes/models/hermes-runtime-usage.js.map +1 -0
  81. package/dist/hermes/models/hermes-runtime-values.d.ts +14 -0
  82. package/dist/hermes/models/hermes-runtime-values.js +105 -0
  83. package/dist/hermes/models/hermes-runtime-values.js.map +1 -0
  84. package/dist/i18n/index.js +4 -0
  85. package/dist/i18n/index.js.map +1 -1
  86. package/dist/index.js +115 -9
  87. package/dist/index.js.map +1 -1
  88. package/dist/platform/service-manager-common.d.ts +5 -2
  89. package/dist/platform/service-manager-common.js +18 -7
  90. package/dist/platform/service-manager-common.js.map +1 -1
  91. package/dist/platform/service-manager.d.ts +16 -5
  92. package/dist/platform/service-manager.js +85 -50
  93. package/dist/platform/service-manager.js.map +1 -1
  94. package/dist/relay/chat-history.js +18 -0
  95. package/dist/relay/chat-history.js.map +1 -1
  96. package/dist/relay/gateway-client.d.ts +2 -1
  97. package/dist/relay/gateway-client.js +8 -4
  98. package/dist/relay/gateway-client.js.map +1 -1
  99. package/dist/relay/mobile-chat-run-bridge.d.ts +93 -0
  100. package/dist/relay/mobile-chat-run-bridge.js +68 -0
  101. package/dist/relay/mobile-chat-run-bridge.js.map +1 -0
  102. package/dist/relay/openclaw-voice-input.d.ts +13 -0
  103. package/dist/relay/openclaw-voice-input.js +18 -0
  104. package/dist/relay/openclaw-voice-input.js.map +1 -0
  105. package/dist/relay/relay-manager.d.ts +1 -4
  106. package/dist/relay/relay-manager.js +39 -170
  107. package/dist/relay/relay-manager.js.map +1 -1
  108. package/dist/relay/session-context.js +11 -1
  109. package/dist/relay/session-context.js.map +1 -1
  110. package/dist/relay/slash-command-catalog.d.ts +1 -1
  111. package/dist/relay/slash-command-catalog.generated.d.ts +0 -5
  112. package/dist/relay/slash-command-catalog.generated.js +0 -6
  113. package/dist/relay/slash-command-catalog.generated.js.map +1 -1
  114. package/dist/relay/voice-input.d.ts +11 -0
  115. package/dist/relay/voice-input.js +118 -0
  116. package/dist/relay/voice-input.js.map +1 -0
  117. package/dist/runtime-adapters.d.ts +19 -0
  118. package/dist/runtime-adapters.js +39 -0
  119. package/dist/runtime-adapters.js.map +1 -0
  120. package/package.json +3 -3
  121. package/dist/commands/voice-reply.d.ts +0 -39
  122. package/dist/commands/voice-reply.js +0 -329
  123. package/dist/commands/voice-reply.js.map +0 -1
  124. package/dist/relay/voice-reply-preference.d.ts +0 -25
  125. package/dist/relay/voice-reply-preference.js +0 -103
  126. package/dist/relay/voice-reply-preference.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ import { readdirSync, statSync } from "fs";
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ export const CLAWCONNECT_HOME = join(homedir(), ".clawconnect");
5
+ export const PROFILE_ENV = "CLAWCONNECT_PROFILE";
6
+ export function normalizeProfileName(value) {
7
+ const trimmed = value?.trim() ?? "";
8
+ if (!trimmed || trimmed === "default") {
9
+ return undefined;
10
+ }
11
+ const normalized = trimmed.toLowerCase().replace(/[^a-z0-9_.-]+/g, "-").replace(/^-+|-+$/g, "");
12
+ return normalized || undefined;
13
+ }
14
+ export function setActiveProfile(profile) {
15
+ const normalized = normalizeProfileName(profile);
16
+ if (normalized) {
17
+ process.env[PROFILE_ENV] = normalized;
18
+ }
19
+ else {
20
+ delete process.env[PROFILE_ENV];
21
+ }
22
+ }
23
+ export function getActiveProfile() {
24
+ return normalizeProfileName(process.env[PROFILE_ENV]);
25
+ }
26
+ export function profileDisplayName(profile) {
27
+ return normalizeProfileName(profile) ?? "default";
28
+ }
29
+ export function profileRoot(profile = getActiveProfile()) {
30
+ const normalized = normalizeProfileName(profile);
31
+ return normalized ? join(CLAWCONNECT_HOME, "profiles", normalized) : CLAWCONNECT_HOME;
32
+ }
33
+ export function profileConfigPath(profile = getActiveProfile()) {
34
+ return join(profileRoot(profile), "config.json");
35
+ }
36
+ export function profileLogPath(profile = getActiveProfile()) {
37
+ return join(profileRoot(profile), "clawconnect.log");
38
+ }
39
+ export function profileErrorLogPath(profile = getActiveProfile()) {
40
+ return join(profileRoot(profile), "clawconnect-error.log");
41
+ }
42
+ export function listProfileNames() {
43
+ const names = new Set();
44
+ try {
45
+ if (statSync(profileConfigPath(undefined)).isFile()) {
46
+ names.add("default");
47
+ }
48
+ }
49
+ catch {
50
+ // ignore
51
+ }
52
+ const profilesDir = join(CLAWCONNECT_HOME, "profiles");
53
+ try {
54
+ for (const entry of readdirSync(profilesDir)) {
55
+ const normalized = normalizeProfileName(entry);
56
+ if (!normalized) {
57
+ continue;
58
+ }
59
+ try {
60
+ if (statSync(profileConfigPath(normalized)).isFile()) {
61
+ names.add(normalized);
62
+ }
63
+ }
64
+ catch {
65
+ // ignore
66
+ }
67
+ }
68
+ }
69
+ catch {
70
+ // ignore
71
+ }
72
+ return [...names].sort((left, right) => {
73
+ if (left === "default")
74
+ return -1;
75
+ if (right === "default")
76
+ return 1;
77
+ return left.localeCompare(right);
78
+ });
79
+ }
80
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/config/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,CAAC,MAA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CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACrC,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type GatewayType = "openclaw" | "hermes";
2
+ export type GatewayProfile = {
3
+ type: GatewayType;
4
+ capabilities: string[];
5
+ };
6
+ export declare function normalizeGatewayType(value: string | undefined): GatewayType;
7
+ export declare function getGatewayProfile(gatewayType: GatewayType): GatewayProfile;
8
+ export declare function gatewayCapabilitiesForType(gatewayType: GatewayType): string[];
@@ -0,0 +1,24 @@
1
+ const GATEWAY_PROFILES = {
2
+ openclaw: {
3
+ type: "openclaw",
4
+ capabilities: ["chat", "skills", "schedules", "logs", "files", "voice_input"],
5
+ },
6
+ hermes: {
7
+ type: "hermes",
8
+ capabilities: ["chat", "files", "logs", "restart", "sessions", "skills", "gateway_service", "voice_input"],
9
+ },
10
+ };
11
+ export function normalizeGatewayType(value) {
12
+ return value === "hermes" ? "hermes" : "openclaw";
13
+ }
14
+ export function getGatewayProfile(gatewayType) {
15
+ const profile = GATEWAY_PROFILES[gatewayType];
16
+ return {
17
+ type: profile.type,
18
+ capabilities: [...profile.capabilities],
19
+ };
20
+ }
21
+ export function gatewayCapabilitiesForType(gatewayType) {
22
+ return getGatewayProfile(gatewayType).capabilities;
23
+ }
24
+ //# sourceMappingURL=gateway-profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway-profiles.js","sourceRoot":"","sources":["../src/gateway-profiles.ts"],"names":[],"mappings":"AAOA,MAAM,gBAAgB,GAAwC;IAC5D,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC;KAC9E;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,EAAE,aAAa,CAAC;KAC3G;CACF,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,KAAyB;IAC5D,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAwB;IACxD,MAAM,OAAO,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,WAAwB;IACjE,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC;AACrD,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { SendFileCommandOptions } from "../commands/send-file.js";
2
+ import type { RelaySlashCommandDescriptor } from "../relay/slash-command-catalog.js";
3
+ export type HermesRelayHelloMessage = {
4
+ type: "hello";
5
+ platform: string;
6
+ agentVersion: string;
7
+ capabilities?: string[];
8
+ slashCommands?: readonly RelaySlashCommandDescriptor[];
9
+ };
10
+ export interface HermesRelayManagerOptions {
11
+ relayServerUrl: string;
12
+ gatewayId: string;
13
+ relaySecret: string;
14
+ displayName?: string;
15
+ capabilities?: string[];
16
+ signal?: AbortSignal;
17
+ onConnected?: () => void;
18
+ onDisconnected?: () => void;
19
+ }
20
+ type HermesSlashCommandRunner = (script: string) => string;
21
+ type HermesSlashCommandCollector = () => readonly RelaySlashCommandDescriptor[];
22
+ export interface HermesSlashCommandSearchResult {
23
+ items: RelaySlashCommandDescriptor[];
24
+ hasMore: boolean;
25
+ nextOffset?: number;
26
+ total: number;
27
+ }
28
+ export declare function collectHermesSlashCommandCatalog(runPython?: HermesSlashCommandRunner): RelaySlashCommandDescriptor[];
29
+ export declare function searchHermesSlashCommandCatalog(opts?: {
30
+ query?: unknown;
31
+ limit?: unknown;
32
+ offset?: unknown;
33
+ collect?: HermesSlashCommandCollector;
34
+ }): HermesSlashCommandSearchResult;
35
+ export declare function buildHermesRelayHelloMessage(opts: {
36
+ platform: string;
37
+ agentVersion: string;
38
+ capabilities?: string[];
39
+ slashCommands?: readonly RelaySlashCommandDescriptor[];
40
+ }): HermesRelayHelloMessage;
41
+ export declare function runHermesRelayManager(opts: HermesRelayManagerOptions): Promise<boolean>;
42
+ export declare function buildHermesArtifactSendOptions(params: {
43
+ artifactPath: string;
44
+ gatewayId: string;
45
+ sessionKey: string;
46
+ runId: string;
47
+ }): SendFileCommandOptions;
48
+ export declare function shouldPublishHermesOfficeSnapshot(eventName: string | undefined, payload: unknown): boolean;
49
+ export {};