weacpx 0.6.0 → 0.6.1

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 (48) hide show
  1. package/dist/bridge/bridge-main.js +59 -23
  2. package/dist/channels/types.d.ts +5 -0
  3. package/dist/cli.js +328 -158
  4. package/dist/commands/command-hints.d.ts +11 -0
  5. package/dist/commands/command-list.d.ts +3 -0
  6. package/dist/commands/config-clone.d.ts +2 -0
  7. package/dist/commands/handlers/agent-handler.d.ts +6 -0
  8. package/dist/commands/handlers/config-handler.d.ts +5 -0
  9. package/dist/commands/handlers/later-handler.d.ts +21 -0
  10. package/dist/commands/handlers/orchestration-handler.d.ts +16 -0
  11. package/dist/commands/handlers/permission-handler.d.ts +9 -0
  12. package/dist/commands/handlers/session-handler.d.ts +37 -0
  13. package/dist/commands/handlers/workspace-handler.d.ts +8 -0
  14. package/dist/commands/help/help-registry.d.ts +4 -0
  15. package/dist/commands/help/help-types.d.ts +12 -0
  16. package/dist/commands/parse-command.d.ts +175 -0
  17. package/dist/commands/router-types.d.ts +144 -0
  18. package/dist/commands/workspace-name.d.ts +4 -0
  19. package/dist/commands/workspace-path.d.ts +4 -0
  20. package/dist/config/agent-templates.d.ts +4 -0
  21. package/dist/config/config-store.d.ts +13 -0
  22. package/dist/config/load-config.d.ts +10 -0
  23. package/dist/config/resolve-agent-command.d.ts +2 -0
  24. package/dist/formatting/render-text.d.ts +23 -0
  25. package/dist/orchestration/async-mutex.d.ts +4 -0
  26. package/dist/orchestration/build-coordinator-prompt.d.ts +66 -0
  27. package/dist/orchestration/orchestration-service.d.ts +471 -0
  28. package/dist/orchestration/progress-line-parser.d.ts +19 -0
  29. package/dist/orchestration/render-delegate-group-result.d.ts +6 -0
  30. package/dist/orchestration/render-delegate-question-package.d.ts +21 -0
  31. package/dist/orchestration/render-delegate-result.d.ts +2 -0
  32. package/dist/orchestration/task-watch-timeouts.d.ts +5 -0
  33. package/dist/plugin-api.d.ts +1 -0
  34. package/dist/scheduled/parse-later-time.d.ts +11 -0
  35. package/dist/scheduled/scheduled-render.d.ts +7 -0
  36. package/dist/scheduled/scheduled-service.d.ts +41 -0
  37. package/dist/scheduled/scheduled-types.d.ts +29 -0
  38. package/dist/sessions/session-service.d.ts +83 -0
  39. package/dist/state/state-store.d.ts +8 -0
  40. package/dist/state/types.d.ts +44 -0
  41. package/dist/transport/tool-event-mode.d.ts +14 -0
  42. package/dist/transport/types.d.ts +129 -0
  43. package/dist/util/path.d.ts +4 -0
  44. package/dist/util/sanitize.d.ts +10 -0
  45. package/dist/util/text.d.ts +3 -0
  46. package/dist/version.d.ts +2 -0
  47. package/dist/weixin/auth/accounts.d.ts +0 -1
  48. package/package.json +1 -1
@@ -826,6 +826,19 @@ async function defaultRunProcessCommand(command, args) {
826
826
  }
827
827
  var init_terminate_process_tree = () => {};
828
828
 
829
+ // src/util/text.ts
830
+ function truncateText(text, maxLength, ellipsis = "…") {
831
+ if (text.length <= maxLength)
832
+ return text;
833
+ return text.slice(0, maxLength - ellipsis.length) + ellipsis;
834
+ }
835
+ function escapeForDoubleQuotes(input) {
836
+ return input.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
837
+ }
838
+ function quoteIfNeeded(input) {
839
+ return `"${escapeForDoubleQuotes(input)}"`;
840
+ }
841
+
829
842
  // src/transport/acpx-queue-owner-launcher.ts
830
843
  import { createHash } from "node:crypto";
831
844
  import { spawn as spawn3 } from "node:child_process";
@@ -1013,7 +1026,7 @@ function resolveDefaultWeacpxCommand(env) {
1013
1026
  return "weacpx";
1014
1027
  }
1015
1028
  function quoteCommandPart(value) {
1016
- return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
1029
+ return quoteIfNeeded(value);
1017
1030
  }
1018
1031
  var init_acpx_queue_owner_launcher = __esm(() => {
1019
1032
  init_spawn_command();
@@ -1032,8 +1045,46 @@ function permissionModeToFlag(permissionMode) {
1032
1045
  }
1033
1046
  }
1034
1047
 
1035
- // src/transport/agent-session-list.ts
1048
+ // src/util/path.ts
1036
1049
  import path2 from "node:path";
1050
+ import { homedir as homedir3 } from "node:os";
1051
+ function normalizePath(input) {
1052
+ const expanded = expandHome(input);
1053
+ if (isWindowsLikePath(expanded)) {
1054
+ return path2.win32.normalize(expanded).replace(/\\/g, "/");
1055
+ }
1056
+ return path2.posix.normalize(expanded.replace(/\\/g, "/"));
1057
+ }
1058
+ function basenameForPath(input) {
1059
+ const normalized = normalizePath(input);
1060
+ if (ROOT_PATH_RE.test(normalized)) {
1061
+ return normalized;
1062
+ }
1063
+ const base = path2.posix.basename(normalized);
1064
+ return base || normalized;
1065
+ }
1066
+ function isSamePath(left, right) {
1067
+ const normalizedLeft = normalizePath(left);
1068
+ const normalizedRight = normalizePath(right);
1069
+ if (isWindowsLikePath(normalizedLeft) || isWindowsLikePath(normalizedRight)) {
1070
+ return normalizedLeft.toLowerCase() === normalizedRight.toLowerCase();
1071
+ }
1072
+ return normalizedLeft === normalizedRight;
1073
+ }
1074
+ function isWindowsLikePath(input) {
1075
+ return WINDOWS_DRIVE_PATH_RE.test(input) || WINDOWS_UNC_PATH_RE.test(input);
1076
+ }
1077
+ function expandHome(input) {
1078
+ return input.startsWith("~") ? homedir3() + input.slice(1) : input;
1079
+ }
1080
+ var WINDOWS_DRIVE_PATH_RE, WINDOWS_UNC_PATH_RE, ROOT_PATH_RE;
1081
+ var init_path = __esm(() => {
1082
+ WINDOWS_DRIVE_PATH_RE = /^[a-zA-Z]:[\\/]/;
1083
+ WINDOWS_UNC_PATH_RE = /^\\\\/;
1084
+ ROOT_PATH_RE = /^(\/|[a-zA-Z]:\/?)$/;
1085
+ });
1086
+
1087
+ // src/transport/agent-session-list.ts
1037
1088
  function isUnknownFilterCwdOption(output) {
1038
1089
  return /(?:unknown|unrecognized) option/i.test(output) && output.includes("--filter-cwd");
1039
1090
  }
@@ -1080,27 +1131,12 @@ function isAgentSessionListResult(value) {
1080
1131
  function filterAgentSessionListByCwd(result, cwd) {
1081
1132
  return {
1082
1133
  ...result,
1083
- sessions: result.sessions.filter((session) => session.cwd && sameAgentSessionCwd(session.cwd, cwd))
1134
+ sessions: result.sessions.filter((session) => session.cwd && isSamePath(session.cwd, cwd))
1084
1135
  };
1085
1136
  }
1086
- function sameAgentSessionCwd(left, right) {
1087
- const normalizedLeft = normalizeAgentSessionCwd(left);
1088
- const normalizedRight = normalizeAgentSessionCwd(right);
1089
- if (isWindowsLikePath(normalizedLeft) || isWindowsLikePath(normalizedRight)) {
1090
- return normalizedLeft.toLowerCase() === normalizedRight.toLowerCase();
1091
- }
1092
- return normalizedLeft === normalizedRight;
1093
- }
1094
- function normalizeAgentSessionCwd(input) {
1095
- if (isWindowsLikePath(input)) {
1096
- return path2.win32.normalize(input).replace(/\\/g, "/");
1097
- }
1098
- return path2.posix.normalize(input.replace(/\\/g, "/"));
1099
- }
1100
- function isWindowsLikePath(input) {
1101
- return /^[a-zA-Z]:[\\/]/.test(input) || input.startsWith("\\\\");
1102
- }
1103
- var init_agent_session_list = () => {};
1137
+ var init_agent_session_list = __esm(() => {
1138
+ init_path();
1139
+ });
1104
1140
 
1105
1141
  // src/bridge/bridge-main.ts
1106
1142
  import { createInterface } from "node:readline";
@@ -1161,7 +1197,7 @@ init_prompt_output();
1161
1197
  init_prompt_media();
1162
1198
  init_streaming_prompt();
1163
1199
  import { copyFile, readdir } from "node:fs/promises";
1164
- import { homedir as homedir3 } from "node:os";
1200
+ import { homedir as homedir4 } from "node:os";
1165
1201
  import { dirname as dirname2, join as join3, win32 } from "node:path";
1166
1202
  import { spawn as spawn4 } from "node:child_process";
1167
1203
 
@@ -1636,7 +1672,7 @@ async function tryRepairAcpxSessionIndex(deps = {}) {
1636
1672
  if (platform !== "win32") {
1637
1673
  return false;
1638
1674
  }
1639
- const home = deps.home ?? process.env.HOME ?? process.env.USERPROFILE ?? homedir3();
1675
+ const home = deps.home ?? process.env.HOME ?? process.env.USERPROFILE ?? homedir4();
1640
1676
  if (!home) {
1641
1677
  return false;
1642
1678
  }
@@ -1,4 +1,5 @@
1
1
  import type { Agent as ChatAgent } from "../weixin/agent/interface.js";
2
+ import type { CommandHint } from "../commands/command-hints.js";
2
3
  import type { OrchestrationTaskRecord } from "../orchestration/orchestration-types.js";
3
4
  import type { AppLogger } from "../logging/app-logger.js";
4
5
  import type { PendingFinalChunk } from "../weixin/messaging/quota-manager.js";
@@ -50,6 +51,10 @@ export interface ChannelStartInput {
50
51
  quota: OutboundQuota;
51
52
  logger: AppLogger;
52
53
  perfTracer?: PerfTracer;
54
+ /** weacpx 内置命令目录,供支持输入框命令提示的频道使用。 */
55
+ commandHints?: CommandHint[];
56
+ /** weacpx 核心版本字符串,供需要它的频道(如命令同步元数据)使用。 */
57
+ coreVersion?: string;
53
58
  }
54
59
  export interface OrchestrationDeliveryCallbacks {
55
60
  markTaskNoticeDelivered: (taskId: string, accountId: string) => Promise<void>;