@liangjie559567/ultrapower 7.0.3 → 7.1.0

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 (152) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +4 -0
  4. package/bridge/mcp-server.cjs +140 -91
  5. package/dist/features/delegation-routing/speckit-integration.d.ts +17 -0
  6. package/dist/features/delegation-routing/speckit-integration.d.ts.map +1 -0
  7. package/dist/features/delegation-routing/speckit-integration.js +26 -0
  8. package/dist/features/delegation-routing/speckit-integration.js.map +1 -0
  9. package/dist/features/speckit-core/constitution.d.ts +7 -0
  10. package/dist/features/speckit-core/constitution.d.ts.map +1 -0
  11. package/dist/features/speckit-core/constitution.js +160 -0
  12. package/dist/features/speckit-core/constitution.js.map +1 -0
  13. package/dist/features/speckit-core/index.d.ts +9 -0
  14. package/dist/features/speckit-core/index.d.ts.map +1 -0
  15. package/dist/features/speckit-core/index.js +9 -0
  16. package/dist/features/speckit-core/index.js.map +1 -0
  17. package/dist/features/speckit-core/plan.d.ts +7 -0
  18. package/dist/features/speckit-core/plan.d.ts.map +1 -0
  19. package/dist/features/speckit-core/plan.js +134 -0
  20. package/dist/features/speckit-core/plan.js.map +1 -0
  21. package/dist/features/speckit-core/specify.d.ts +7 -0
  22. package/dist/features/speckit-core/specify.d.ts.map +1 -0
  23. package/dist/features/speckit-core/specify.js +101 -0
  24. package/dist/features/speckit-core/specify.js.map +1 -0
  25. package/dist/features/speckit-core/tasks.d.ts +7 -0
  26. package/dist/features/speckit-core/tasks.d.ts.map +1 -0
  27. package/dist/features/speckit-core/tasks.js +80 -0
  28. package/dist/features/speckit-core/tasks.js.map +1 -0
  29. package/dist/features/speckit-core/types.d.ts +48 -0
  30. package/dist/features/speckit-core/types.d.ts.map +1 -0
  31. package/dist/features/speckit-core/types.js +5 -0
  32. package/dist/features/speckit-core/types.js.map +1 -0
  33. package/dist/features/speckit-integration/axiom-bridge.d.ts +18 -0
  34. package/dist/features/speckit-integration/axiom-bridge.d.ts.map +1 -0
  35. package/dist/features/speckit-integration/axiom-bridge.js +21 -0
  36. package/dist/features/speckit-integration/axiom-bridge.js.map +1 -0
  37. package/dist/features/speckit-integration/exports.d.ts +11 -0
  38. package/dist/features/speckit-integration/exports.d.ts.map +1 -0
  39. package/dist/features/speckit-integration/exports.js +8 -0
  40. package/dist/features/speckit-integration/exports.js.map +1 -0
  41. package/dist/features/speckit-integration/index.d.ts +19 -0
  42. package/dist/features/speckit-integration/index.d.ts.map +1 -0
  43. package/dist/features/speckit-integration/index.js +24 -0
  44. package/dist/features/speckit-integration/index.js.map +1 -0
  45. package/dist/features/speckit-integration/recommender.d.ts +18 -0
  46. package/dist/features/speckit-integration/recommender.d.ts.map +1 -0
  47. package/dist/features/speckit-integration/recommender.js +31 -0
  48. package/dist/features/speckit-integration/recommender.js.map +1 -0
  49. package/dist/features/speckit-integration/router.d.ts +18 -0
  50. package/dist/features/speckit-integration/router.d.ts.map +1 -0
  51. package/dist/features/speckit-integration/router.js +41 -0
  52. package/dist/features/speckit-integration/router.js.map +1 -0
  53. package/dist/features/task-decomposer/speckit-integration.d.ts +16 -0
  54. package/dist/features/task-decomposer/speckit-integration.d.ts.map +1 -0
  55. package/dist/features/task-decomposer/speckit-integration.js +32 -0
  56. package/dist/features/task-decomposer/speckit-integration.js.map +1 -0
  57. package/dist/hooks/autopilot/cancel.d.ts.map +1 -1
  58. package/dist/hooks/autopilot/cancel.js +15 -15
  59. package/dist/hooks/autopilot/cancel.js.map +1 -1
  60. package/dist/hooks/autopilot/enforcement.js +12 -12
  61. package/dist/hooks/autopilot/enforcement.js.map +1 -1
  62. package/dist/hooks/autopilot/state.d.ts.map +1 -1
  63. package/dist/hooks/autopilot/state.js +28 -30
  64. package/dist/hooks/autopilot/state.js.map +1 -1
  65. package/dist/hooks/bridge-normalize.d.ts +11 -0
  66. package/dist/hooks/bridge-normalize.d.ts.map +1 -1
  67. package/dist/hooks/bridge-normalize.js +4 -3
  68. package/dist/hooks/bridge-normalize.js.map +1 -1
  69. package/dist/hooks/bridge-types.d.ts +2 -0
  70. package/dist/hooks/bridge-types.d.ts.map +1 -1
  71. package/dist/hooks/bridge-types.js.map +1 -1
  72. package/dist/hooks/bridge.d.ts.map +1 -1
  73. package/dist/hooks/bridge.js +11 -2
  74. package/dist/hooks/bridge.js.map +1 -1
  75. package/dist/hooks/handlers/route-map.d.ts.map +1 -1
  76. package/dist/hooks/handlers/route-map.js +15 -0
  77. package/dist/hooks/handlers/route-map.js.map +1 -1
  78. package/dist/hooks/index.d.ts +1 -0
  79. package/dist/hooks/index.d.ts.map +1 -1
  80. package/dist/hooks/index.js +3 -0
  81. package/dist/hooks/index.js.map +1 -1
  82. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  83. package/dist/hooks/keyword-detector/index.js +60 -8
  84. package/dist/hooks/keyword-detector/index.js.map +1 -1
  85. package/dist/hooks/mode-cancel-sync.d.ts.map +1 -1
  86. package/dist/hooks/mode-cancel-sync.js +11 -12
  87. package/dist/hooks/mode-cancel-sync.js.map +1 -1
  88. package/dist/hooks/persistent-mode/index.js +2 -2
  89. package/dist/hooks/persistent-mode/index.js.map +1 -1
  90. package/dist/hooks/ralph/loop.d.ts.map +1 -1
  91. package/dist/hooks/ralph/loop.js +7 -8
  92. package/dist/hooks/ralph/loop.js.map +1 -1
  93. package/dist/hooks/ralph/verifier.js +11 -11
  94. package/dist/hooks/ralph/verifier.js.map +1 -1
  95. package/dist/hooks/ultrawork/index.d.ts.map +1 -1
  96. package/dist/hooks/ultrawork/index.js +7 -4
  97. package/dist/hooks/ultrawork/index.js.map +1 -1
  98. package/dist/hooks/validation.d.ts.map +1 -1
  99. package/dist/hooks/validation.js +2 -0
  100. package/dist/hooks/validation.js.map +1 -1
  101. package/dist/hooks/workflow-gate/index.d.ts +116 -0
  102. package/dist/hooks/workflow-gate/index.d.ts.map +1 -0
  103. package/dist/hooks/workflow-gate/index.js +352 -0
  104. package/dist/hooks/workflow-gate/index.js.map +1 -0
  105. package/dist/lib/file-lock.d.ts +4 -0
  106. package/dist/lib/file-lock.d.ts.map +1 -1
  107. package/dist/lib/file-lock.js +85 -2
  108. package/dist/lib/file-lock.js.map +1 -1
  109. package/dist/lib/state-adapter.d.ts.map +1 -1
  110. package/dist/lib/state-adapter.js +20 -12
  111. package/dist/lib/state-adapter.js.map +1 -1
  112. package/dist/lib/state-cache.d.ts +8 -5
  113. package/dist/lib/state-cache.d.ts.map +1 -1
  114. package/dist/lib/state-cache.js +26 -16
  115. package/dist/lib/state-cache.js.map +1 -1
  116. package/dist/mcp/adapters/state-adapter.d.ts +8 -8
  117. package/dist/team/index.d.ts +1 -0
  118. package/dist/team/index.d.ts.map +1 -1
  119. package/dist/team/index.js +1 -0
  120. package/dist/team/index.js.map +1 -1
  121. package/dist/team/workflow-integration.d.ts +8 -0
  122. package/dist/team/workflow-integration.d.ts.map +1 -0
  123. package/dist/team/workflow-integration.js +62 -0
  124. package/dist/team/workflow-integration.js.map +1 -0
  125. package/dist/tools/lsp/client.d.ts +8 -2
  126. package/dist/tools/lsp/client.d.ts.map +1 -1
  127. package/dist/tools/lsp/client.js +114 -68
  128. package/dist/tools/lsp/client.js.map +1 -1
  129. package/dist/tools/lsp-tools.d.ts.map +1 -1
  130. package/dist/tools/lsp-tools.js +1 -4
  131. package/dist/tools/lsp-tools.js.map +1 -1
  132. package/docs/BUG_ANALYSIS.md +188 -0
  133. package/docs/CLAUDE.md +1 -1
  134. package/docs/CODE_BASED_FLOW.md +997 -0
  135. package/docs/INSTALL.md +2 -2
  136. package/docs/REFERENCE.md +4 -1
  137. package/docs/SPECKIT_INTEGRATION.md +60 -0
  138. package/docs/SPECKIT_NATIVE.md +170 -0
  139. package/docs/architecture/ultrapower-flow-analysis.md +807 -0
  140. package/docs/reviews/autoresearch-integration/review_domain.md +295 -295
  141. package/docs/reviews/autoresearch-integration/review_product.md +287 -287
  142. package/docs/standards/README.md +1 -1
  143. package/docs/ultrapower-complete-workflow.md +900 -0
  144. package/package.json +3 -2
  145. package/skills/brainstorming/SKILL.md +57 -14
  146. package/skills/omc-doctor/SKILL.md +45 -0
  147. package/skills/speckit-constitution/SKILL.md +43 -0
  148. package/skills/speckit-implement/SKILL.md +32 -0
  149. package/skills/speckit-plan/SKILL.md +26 -0
  150. package/skills/speckit-specify/SKILL.md +26 -0
  151. package/skills/speckit-tasks/SKILL.md +26 -0
  152. package/skills/team/SKILL.md +12 -0
@@ -8,11 +8,11 @@
8
8
  {
9
9
  "name": "ultrapower",
10
10
  "description": "Disciplined multi-agent orchestration: workflow enforcement + parallel execution",
11
- "version": "7.0.3",
11
+ "version": "7.1.0",
12
12
  "source": {
13
13
  "source": "npm",
14
14
  "package": "@liangjie559567/ultrapower",
15
- "version": "7.0.3"
15
+ "version": "7.1.0"
16
16
  },
17
17
  "author": {
18
18
  "name": "liangjie559567"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ultrapower",
3
3
  "description": "Disciplined multi-agent orchestration: workflow enforcement + parallel execution",
4
- "version": "7.0.3",
4
+ "version": "7.1.0",
5
5
  "author": {
6
6
  "name": "liangjie559567"
7
7
  },
package/README.md CHANGED
@@ -53,6 +53,8 @@ graph TB
53
53
  /ultrapower:omc-setup
54
54
  ```
55
55
 
56
+ > **Windows 用户注意**:如果安装后 HUD 不显示,运行 `/ultrapower:omc-doctor` 检查路径格式。Claude Code 要求配置文件中使用正斜杠(`C:/Users/...`)而非反斜杠。
57
+
56
58
  ### 验证安装
57
59
 
58
60
  ```bash
@@ -79,6 +81,8 @@ autopilot "创建一个 hello world 函数"
79
81
 
80
82
  ## 基础工作流
81
83
 
84
+ > **🛡️ 工作流门禁系统**:ultrapower 自动强制执行 superpowers 工作流纪律。尝试跳过必要步骤时,系统会自动注入对应 skill 并显示警告。
85
+
82
86
  1. **brainstorming** — 代码前必须先设计。通过对话细化需求,探索 2-3 种方案,呈现设计并获批准,保存设计文档。
83
87
 
84
88
  1. **using-git-worktrees** — 设计批准后创建隔离工作区,新建分支,运行项目初始化,验证测试基线。
@@ -2995,7 +2995,7 @@ var require_compile = __commonJS({
2995
2995
  const schOrFunc = root.refs[ref];
2996
2996
  if (schOrFunc)
2997
2997
  return schOrFunc;
2998
- let _sch = resolve6.call(this, root, ref);
2998
+ let _sch = resolve7.call(this, root, ref);
2999
2999
  if (_sch === void 0) {
3000
3000
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
3001
3001
  const { schemaId } = this.opts;
@@ -3022,7 +3022,7 @@ var require_compile = __commonJS({
3022
3022
  function sameSchemaEnv(s1, s2) {
3023
3023
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3024
3024
  }
3025
- function resolve6(root, ref) {
3025
+ function resolve7(root, ref) {
3026
3026
  let sch;
3027
3027
  while (typeof (sch = this.refs[ref]) == "string")
3028
3028
  ref = sch;
@@ -3597,7 +3597,7 @@ var require_fast_uri = __commonJS({
3597
3597
  }
3598
3598
  return uri;
3599
3599
  }
3600
- function resolve6(baseURI, relativeURI, options) {
3600
+ function resolve7(baseURI, relativeURI, options) {
3601
3601
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3602
3602
  const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
3603
3603
  schemelessOptions.skipEscape = true;
@@ -3824,7 +3824,7 @@ var require_fast_uri = __commonJS({
3824
3824
  var fastUri = {
3825
3825
  SCHEMES,
3826
3826
  normalize: normalize6,
3827
- resolve: resolve6,
3827
+ resolve: resolve7,
3828
3828
  resolveComponent,
3829
3829
  equal,
3830
3830
  serialize,
@@ -16675,7 +16675,7 @@ var Protocol = class {
16675
16675
  return;
16676
16676
  }
16677
16677
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
16678
- await new Promise((resolve6) => setTimeout(resolve6, pollInterval));
16678
+ await new Promise((resolve7) => setTimeout(resolve7, pollInterval));
16679
16679
  options?.signal?.throwIfAborted();
16680
16680
  }
16681
16681
  } catch (error2) {
@@ -16692,7 +16692,7 @@ var Protocol = class {
16692
16692
  */
16693
16693
  request(request, resultSchema, options) {
16694
16694
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
16695
- return new Promise((resolve6, reject) => {
16695
+ return new Promise((resolve7, reject) => {
16696
16696
  const earlyReject = (error2) => {
16697
16697
  reject(error2);
16698
16698
  };
@@ -16770,7 +16770,7 @@ var Protocol = class {
16770
16770
  if (!parseResult.success) {
16771
16771
  reject(parseResult.error);
16772
16772
  } else {
16773
- resolve6(parseResult.data);
16773
+ resolve7(parseResult.data);
16774
16774
  }
16775
16775
  } catch (error2) {
16776
16776
  reject(error2);
@@ -17031,12 +17031,12 @@ var Protocol = class {
17031
17031
  }
17032
17032
  } catch {
17033
17033
  }
17034
- return new Promise((resolve6, reject) => {
17034
+ return new Promise((resolve7, reject) => {
17035
17035
  if (signal.aborted) {
17036
17036
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
17037
17037
  return;
17038
17038
  }
17039
- const timeoutId = setTimeout(resolve6, interval);
17039
+ const timeoutId = setTimeout(resolve7, interval);
17040
17040
  signal.addEventListener("abort", () => {
17041
17041
  clearTimeout(timeoutId);
17042
17042
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -17906,12 +17906,12 @@ var StdioServerTransport = class {
17906
17906
  this.onclose?.();
17907
17907
  }
17908
17908
  send(message) {
17909
- return new Promise((resolve6) => {
17909
+ return new Promise((resolve7) => {
17910
17910
  const json = serializeMessage(message);
17911
17911
  if (this._stdout.write(json)) {
17912
- resolve6();
17912
+ resolve7();
17913
17913
  } else {
17914
- this._stdout.once("drain", resolve6);
17914
+ this._stdout.once("drain", resolve7);
17915
17915
  }
17916
17916
  });
17917
17917
  }
@@ -18084,6 +18084,47 @@ function getAllServers() {
18084
18084
 
18085
18085
  // src/tools/lsp/client.ts
18086
18086
  var MAX_BUFFER_BYTES = 64 * 1024 * 1024;
18087
+ var LANGUAGE_MAP = {
18088
+ "ts": "typescript",
18089
+ "tsx": "typescriptreact",
18090
+ "js": "javascript",
18091
+ "jsx": "javascriptreact",
18092
+ "mts": "typescript",
18093
+ "cts": "typescript",
18094
+ "mjs": "javascript",
18095
+ "cjs": "javascript",
18096
+ "py": "python",
18097
+ "rs": "rust",
18098
+ "go": "go",
18099
+ "c": "c",
18100
+ "h": "c",
18101
+ "cpp": "cpp",
18102
+ "cc": "cpp",
18103
+ "hpp": "cpp",
18104
+ "java": "java",
18105
+ "json": "json",
18106
+ "html": "html",
18107
+ "css": "css",
18108
+ "scss": "scss",
18109
+ "yaml": "yaml",
18110
+ "yml": "yaml",
18111
+ "php": "php",
18112
+ "phtml": "php",
18113
+ "rb": "ruby",
18114
+ "rake": "ruby",
18115
+ "gemspec": "ruby",
18116
+ "erb": "ruby",
18117
+ "lua": "lua",
18118
+ "kt": "kotlin",
18119
+ "kts": "kotlin",
18120
+ "ex": "elixir",
18121
+ "exs": "elixir",
18122
+ "heex": "elixir",
18123
+ "eex": "elixir",
18124
+ "cs": "csharp"
18125
+ };
18126
+ var workspaceRootCache = /* @__PURE__ */ new Map();
18127
+ var MAX_WORKSPACE_CACHE = 100;
18087
18128
  function fileUri(filePath) {
18088
18129
  return (0, import_url.pathToFileURL)((0, import_path2.resolve)(filePath)).href;
18089
18130
  }
@@ -18091,9 +18132,11 @@ var LspClient = class {
18091
18132
  process = null;
18092
18133
  requestId = 0;
18093
18134
  pendingRequests = /* @__PURE__ */ new Map();
18094
- buffer = "";
18135
+ bufferChunks = [];
18136
+ bufferOffset = 0;
18095
18137
  openDocuments = /* @__PURE__ */ new Set();
18096
18138
  diagnostics = /* @__PURE__ */ new Map();
18139
+ pendingDiagnostics = /* @__PURE__ */ new Map();
18097
18140
  workspaceRoot;
18098
18141
  serverConfig;
18099
18142
  initialized = false;
@@ -18114,7 +18157,7 @@ var LspClient = class {
18114
18157
  Install with: ${this.serverConfig.installHint}`
18115
18158
  );
18116
18159
  }
18117
- return new Promise((resolve6, reject) => {
18160
+ return new Promise((resolve7, reject) => {
18118
18161
  this.process = (0, import_child_process2.spawn)(this.serverConfig.command, this.serverConfig.args, {
18119
18162
  cwd: this.workspaceRoot,
18120
18163
  stdio: ["pipe", "pipe", "pipe"],
@@ -18140,7 +18183,7 @@ Install with: ${this.serverConfig.installHint}`
18140
18183
  });
18141
18184
  this.initialize().then(() => {
18142
18185
  this.initialized = true;
18143
- resolve6();
18186
+ resolve7();
18144
18187
  }).catch(reject);
18145
18188
  });
18146
18189
  }
@@ -18169,7 +18212,8 @@ Install with: ${this.serverConfig.installHint}`
18169
18212
  * Handle incoming data from the server
18170
18213
  */
18171
18214
  handleData(data) {
18172
- if (this.buffer.length + data.length > MAX_BUFFER_BYTES) {
18215
+ const totalLength = this.bufferChunks.reduce((sum, chunk) => sum + chunk.length, 0) - this.bufferOffset + data.length;
18216
+ if (totalLength > MAX_BUFFER_BYTES) {
18173
18217
  console.error(
18174
18218
  `[ultrapower] \u9519\u8BEF\uFF1ALSP \u7F13\u51B2\u533A\u8D85\u8FC7 ${MAX_BUFFER_BYTES} \u5B57\u8282\uFF0864MB\uFF09\u4E0A\u9650\uFF0C\u6B63\u5728\u65AD\u5F00\u8FDE\u63A5`
18175
18219
  );
@@ -18177,24 +18221,27 @@ Install with: ${this.serverConfig.installHint}`
18177
18221
  });
18178
18222
  return;
18179
18223
  }
18180
- this.buffer += data;
18224
+ this.bufferChunks.push(data);
18181
18225
  while (true) {
18182
- const headerEnd = this.buffer.indexOf("\r\n\r\n");
18226
+ const buffer = this.bufferChunks.join("").slice(this.bufferOffset);
18227
+ const headerEnd = buffer.indexOf("\r\n\r\n");
18183
18228
  if (headerEnd === -1) break;
18184
- const header = this.buffer.slice(0, headerEnd);
18229
+ const header = buffer.slice(0, headerEnd);
18185
18230
  const contentLengthMatch = header.match(/Content-Length: (\d+)/i);
18186
18231
  if (!contentLengthMatch) {
18187
- this.buffer = this.buffer.slice(headerEnd + 4);
18232
+ this.bufferOffset += headerEnd + 4;
18188
18233
  continue;
18189
18234
  }
18190
18235
  const contentLength = parseInt(contentLengthMatch[1], 10);
18191
18236
  const messageStart = headerEnd + 4;
18192
18237
  const messageEnd = messageStart + contentLength;
18193
- if (this.buffer.length < messageEnd) {
18194
- break;
18238
+ if (buffer.length < messageEnd) break;
18239
+ const messageJson = buffer.slice(messageStart, messageEnd);
18240
+ this.bufferOffset += messageEnd;
18241
+ if (this.bufferOffset > 8192) {
18242
+ this.bufferChunks = [buffer.slice(messageEnd)];
18243
+ this.bufferOffset = 0;
18195
18244
  }
18196
- const messageJson = this.buffer.slice(messageStart, messageEnd);
18197
- this.buffer = this.buffer.slice(messageEnd);
18198
18245
  try {
18199
18246
  const message = JSON.parse(messageJson);
18200
18247
  this.handleMessage(message);
@@ -18228,6 +18275,12 @@ Install with: ${this.serverConfig.installHint}`
18228
18275
  if (notification.method === "textDocument/publishDiagnostics") {
18229
18276
  const params = notification.params;
18230
18277
  this.diagnostics.set(params.uri, params.diagnostics);
18278
+ const pending = this.pendingDiagnostics.get(params.uri);
18279
+ if (pending) {
18280
+ clearTimeout(pending.timeout);
18281
+ this.pendingDiagnostics.delete(params.uri);
18282
+ pending.resolve(params.diagnostics);
18283
+ }
18231
18284
  }
18232
18285
  }
18233
18286
  /**
@@ -18248,13 +18301,13 @@ Install with: ${this.serverConfig.installHint}`
18248
18301
  const message = `Content-Length: ${Buffer.byteLength(content)}\r
18249
18302
  \r
18250
18303
  ${content}`;
18251
- return new Promise((resolve6, reject) => {
18304
+ return new Promise((resolve7, reject) => {
18252
18305
  const timeoutHandle = setTimeout(() => {
18253
18306
  this.pendingRequests.delete(id);
18254
18307
  reject(new Error(`LSP request '${method}' timed out after ${timeout}ms`));
18255
18308
  }, timeout);
18256
18309
  this.pendingRequests.set(id, {
18257
- resolve: resolve6,
18310
+ resolve: resolve7,
18258
18311
  reject,
18259
18312
  timeout: timeoutHandle
18260
18313
  });
@@ -18323,7 +18376,7 @@ ${content}`;
18323
18376
  }
18324
18377
  });
18325
18378
  this.openDocuments.add(uri);
18326
- await new Promise((resolve6) => setTimeout(resolve6, 100));
18379
+ return this.waitForDiagnostics(uri, 500);
18327
18380
  }
18328
18381
  /**
18329
18382
  * Close a document
@@ -18341,46 +18394,25 @@ ${content}`;
18341
18394
  */
18342
18395
  getLanguageId(filePath) {
18343
18396
  const ext = filePath.split(".").pop()?.toLowerCase() || "";
18344
- const langMap = {
18345
- "ts": "typescript",
18346
- "tsx": "typescriptreact",
18347
- "js": "javascript",
18348
- "jsx": "javascriptreact",
18349
- "mts": "typescript",
18350
- "cts": "typescript",
18351
- "mjs": "javascript",
18352
- "cjs": "javascript",
18353
- "py": "python",
18354
- "rs": "rust",
18355
- "go": "go",
18356
- "c": "c",
18357
- "h": "c",
18358
- "cpp": "cpp",
18359
- "cc": "cpp",
18360
- "hpp": "cpp",
18361
- "java": "java",
18362
- "json": "json",
18363
- "html": "html",
18364
- "css": "css",
18365
- "scss": "scss",
18366
- "yaml": "yaml",
18367
- "yml": "yaml",
18368
- "php": "php",
18369
- "phtml": "php",
18370
- "rb": "ruby",
18371
- "rake": "ruby",
18372
- "gemspec": "ruby",
18373
- "erb": "ruby",
18374
- "lua": "lua",
18375
- "kt": "kotlin",
18376
- "kts": "kotlin",
18377
- "ex": "elixir",
18378
- "exs": "elixir",
18379
- "heex": "elixir",
18380
- "eex": "elixir",
18381
- "cs": "csharp"
18382
- };
18383
- return langMap[ext] || ext;
18397
+ return LANGUAGE_MAP[ext] || ext;
18398
+ }
18399
+ /**
18400
+ * Wait for diagnostics to be published for a URI
18401
+ */
18402
+ waitForDiagnostics(uri, timeout) {
18403
+ return new Promise((resolve7) => {
18404
+ const timeoutHandle = setTimeout(() => {
18405
+ this.pendingDiagnostics.delete(uri);
18406
+ resolve7();
18407
+ }, timeout);
18408
+ this.pendingDiagnostics.set(uri, {
18409
+ resolve: () => {
18410
+ clearTimeout(timeoutHandle);
18411
+ resolve7();
18412
+ },
18413
+ timeout: timeoutHandle
18414
+ });
18415
+ });
18384
18416
  }
18385
18417
  /**
18386
18418
  * Convert file path to URI and ensure document is open
@@ -18592,25 +18624,38 @@ var LspClientManager = class {
18592
18624
  }
18593
18625
  }
18594
18626
  /**
18595
- * Find the workspace root for a file
18627
+ * Find the workspace root for a file (with LRU cache)
18596
18628
  */
18597
18629
  findWorkspaceRoot(filePath) {
18598
- let dir = (0, import_path2.dirname)((0, import_path2.resolve)(filePath));
18630
+ const resolved = (0, import_path2.resolve)(filePath);
18631
+ if (workspaceRootCache.has(resolved)) {
18632
+ const cached2 = workspaceRootCache.get(resolved);
18633
+ workspaceRootCache.delete(resolved);
18634
+ workspaceRootCache.set(resolved, cached2);
18635
+ return cached2;
18636
+ }
18637
+ let dir = (0, import_path2.dirname)(resolved);
18599
18638
  const markers = ["package.json", "tsconfig.json", "pyproject.toml", "Cargo.toml", "go.mod", ".git"];
18600
18639
  while (true) {
18601
18640
  const parsed = (0, import_path2.parse)(dir);
18602
- if (parsed.root === dir) {
18603
- break;
18604
- }
18641
+ if (parsed.root === dir) break;
18605
18642
  for (const marker of markers) {
18606
- const markerPath = (0, import_path2.join)(dir, marker);
18607
- if ((0, import_fs.existsSync)(markerPath)) {
18643
+ if ((0, import_fs.existsSync)((0, import_path2.join)(dir, marker))) {
18644
+ if (workspaceRootCache.size >= MAX_WORKSPACE_CACHE) {
18645
+ const firstKey = workspaceRootCache.keys().next().value;
18646
+ if (firstKey !== void 0) {
18647
+ workspaceRootCache.delete(firstKey);
18648
+ }
18649
+ }
18650
+ workspaceRootCache.set(resolved, dir);
18608
18651
  return dir;
18609
18652
  }
18610
18653
  }
18611
18654
  dir = (0, import_path2.dirname)(dir);
18612
18655
  }
18613
- return (0, import_path2.dirname)((0, import_path2.resolve)(filePath));
18656
+ const fallback = (0, import_path2.dirname)(resolved);
18657
+ workspaceRootCache.set(resolved, fallback);
18658
+ return fallback;
18614
18659
  }
18615
18660
  /**
18616
18661
  * Start periodic idle check
@@ -18975,7 +19020,7 @@ async function runLspAggregatedDiagnostics(directory, extensions = [".ts", ".tsx
18975
19020
  try {
18976
19021
  await lspClientManager.runWithClientLease(file, async (client) => {
18977
19022
  await client.openDocument(file);
18978
- await new Promise((resolve6) => setTimeout(resolve6, LSP_DIAGNOSTICS_WAIT_MS));
19023
+ await new Promise((resolve7) => setTimeout(resolve7, LSP_DIAGNOSTICS_WAIT_MS));
18979
19024
  const diagnostics = client.getDiagnostics(file);
18980
19025
  for (const diagnostic of diagnostics) {
18981
19026
  allDiagnostics.push({
@@ -19225,7 +19270,6 @@ var lspDiagnosticsTool = {
19225
19270
  const { file, severity } = args;
19226
19271
  return withLspClient(file, "diagnostics", async (client) => {
19227
19272
  await client.openDocument(file);
19228
- await new Promise((resolve6) => setTimeout(resolve6, LSP_DIAGNOSTICS_WAIT_MS));
19229
19273
  let diagnostics = client.getDiagnostics(file);
19230
19274
  if (severity) {
19231
19275
  const severityMap = {
@@ -19608,7 +19652,7 @@ async function readFileStream(filePath, onProgress) {
19608
19652
  if (fileSize < LARGE_FILE_THRESHOLD) {
19609
19653
  return (0, import_fs5.readFileSync)(filePath, "utf-8");
19610
19654
  }
19611
- return new Promise((resolve6, reject) => {
19655
+ return new Promise((resolve7, reject) => {
19612
19656
  const chunks = [];
19613
19657
  let bytesRead = 0;
19614
19658
  const stream = (0, import_fs5.createReadStream)(filePath, { encoding: "utf-8" });
@@ -19618,7 +19662,7 @@ async function readFileStream(filePath, onProgress) {
19618
19662
  bytesRead += Buffer.byteLength(str, "utf-8");
19619
19663
  onProgress?.(bytesRead, fileSize);
19620
19664
  });
19621
- stream.on("end", () => resolve6(chunks.join("")));
19665
+ stream.on("end", () => resolve7(chunks.join("")));
19622
19666
  stream.on("error", reject);
19623
19667
  });
19624
19668
  }
@@ -20567,7 +20611,7 @@ var SessionLock = class {
20567
20611
  }
20568
20612
  };
20569
20613
  function sleep(ms) {
20570
- return new Promise((resolve6) => setTimeout(resolve6, ms));
20614
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
20571
20615
  }
20572
20616
 
20573
20617
  // src/tools/python-repl/socket-client.ts
@@ -20597,7 +20641,7 @@ var JsonRpcError = class extends Error {
20597
20641
  }
20598
20642
  };
20599
20643
  async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
20600
- return new Promise((resolve6, reject) => {
20644
+ return new Promise((resolve7, reject) => {
20601
20645
  const id = (0, import_crypto.randomUUID)();
20602
20646
  const request = {
20603
20647
  jsonrpc: "2.0",
@@ -20661,7 +20705,7 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
20661
20705
  ));
20662
20706
  return;
20663
20707
  }
20664
- resolve6(response.result);
20708
+ resolve7(response.result);
20665
20709
  } catch (e) {
20666
20710
  reject(new Error(
20667
20711
  `Failed to parse JSON-RPC response: ${e.message}`
@@ -20983,7 +21027,7 @@ async function deleteBridgeMeta(sessionId) {
20983
21027
  }
20984
21028
  }
20985
21029
  function sleep2(ms) {
20986
- return new Promise((resolve6) => setTimeout(resolve6, ms));
21030
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
20987
21031
  }
20988
21032
 
20989
21033
  // src/tools/python-repl/tool.ts
@@ -22102,17 +22146,22 @@ function assertValidMode(mode) {
22102
22146
  var import_fs8 = require("fs");
22103
22147
  var stateCache = /* @__PURE__ */ new Map();
22104
22148
  function readStateWithCache(path13, data, ttl = 5e3) {
22149
+ const now = Date.now();
22150
+ const cached2 = stateCache.get(path13);
22151
+ if (cached2 && now - cached2.cachedAt < ttl) {
22152
+ if (now - cached2.mtimeCheckedAt < 1e3) {
22153
+ return Object.freeze(cached2.data);
22154
+ }
22155
+ }
22105
22156
  try {
22106
22157
  const mtime = (0, import_fs8.statSync)(path13).mtimeMs;
22107
- const cached2 = stateCache.get(path13);
22108
- if (cached2 && cached2.mtime === mtime && Date.now() - cached2.cachedAt < ttl) {
22109
- if (typeof cached2.data === "object" && cached2.data !== null) {
22110
- return { ...cached2.data };
22111
- }
22112
- return cached2.data;
22158
+ if (cached2 && cached2.mtime === mtime) {
22159
+ cached2.mtimeCheckedAt = now;
22160
+ return Object.freeze(cached2.data);
22113
22161
  }
22114
- stateCache.set(path13, { data, mtime, cachedAt: Date.now() });
22115
- return data;
22162
+ const frozenData = Object.freeze(data);
22163
+ stateCache.set(path13, { data: frozenData, mtime, cachedAt: now, mtimeCheckedAt: now });
22164
+ return frozenData;
22116
22165
  } catch {
22117
22166
  return data;
22118
22167
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Delegation Routing + Spec Kit Integration
3
+ * 在委托路由中添加 Spec Kit 工作流支持
4
+ */
5
+ /**
6
+ * 检查是否应该路由到 Spec Kit 工作流
7
+ */
8
+ export declare function shouldRouteToSpecKit(taskDescription: string): boolean;
9
+ /**
10
+ * 获取 Spec Kit 委托建议
11
+ */
12
+ export declare function getSpecKitDelegation(currentStage: string): {
13
+ command: string;
14
+ description: string;
15
+ stage: string;
16
+ } | null;
17
+ //# sourceMappingURL=speckit-integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speckit-integration.d.ts","sourceRoot":"","sources":["../../../src/features/delegation-routing/speckit-integration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAErE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM;;;;SAUxD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Delegation Routing + Spec Kit Integration
3
+ * 在委托路由中添加 Spec Kit 工作流支持
4
+ */
5
+ import { shouldUseSpecKit } from '../speckit-integration/index.js';
6
+ import { getNextSpecKitStep } from '../speckit-integration/router.js';
7
+ /**
8
+ * 检查是否应该路由到 Spec Kit 工作流
9
+ */
10
+ export function shouldRouteToSpecKit(taskDescription) {
11
+ return shouldUseSpecKit(taskDescription);
12
+ }
13
+ /**
14
+ * 获取 Spec Kit 委托建议
15
+ */
16
+ export function getSpecKitDelegation(currentStage) {
17
+ const next = getNextSpecKitStep(currentStage);
18
+ if (!next)
19
+ return null;
20
+ return {
21
+ command: next.nextCommand,
22
+ description: next.description,
23
+ stage: next.stage
24
+ };
25
+ }
26
+ //# sourceMappingURL=speckit-integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speckit-integration.js","sourceRoot":"","sources":["../../../src/features/delegation-routing/speckit-integration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,eAAuB;IAC1D,OAAO,gBAAgB,CAAC,eAAe,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,YAAoB;IACvD,MAAM,IAAI,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAE9C,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,WAAW;QACzB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Constitution Generator - 分析项目生成核心原则
3
+ */
4
+ import type { Constitution } from './types.js';
5
+ export declare function generateConstitution(projectPath: string): Promise<Constitution>;
6
+ export declare function formatConstitution(constitution: Constitution): string;
7
+ //# sourceMappingURL=constitution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constitution.d.ts","sourceRoot":"","sources":["../../../src/features/speckit-core/constitution.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,YAAY,CAAC;AAE1D,wBAAsB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CASrF;AAyJD,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,CAYrE"}