@cjhyy/code-shell-capability-coding 0.9.43 → 0.9.46

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 (49) hide show
  1. package/dist/capability-runtime.js +4 -1
  2. package/dist/cc-orchestrator/codex-session-history.d.ts +3 -1
  3. package/dist/cc-orchestrator/codex-session-history.js +11 -4
  4. package/dist/cc-orchestrator/external-agent-changes.js +7 -65
  5. package/dist/cc-orchestrator/external-agent-driver.js +61 -3
  6. package/dist/cc-orchestrator/session-discovery.d.ts +4 -2
  7. package/dist/cc-orchestrator/session-discovery.js +63 -6
  8. package/dist/cc-orchestrator/session-history.js +5 -0
  9. package/dist/external-runtimes/claude-code/event-translator.d.ts +7 -0
  10. package/dist/external-runtimes/claude-code/event-translator.js +58 -9
  11. package/dist/external-runtimes/claude-code/mcp-config.d.ts +8 -0
  12. package/dist/external-runtimes/claude-code/mcp-config.js +16 -3
  13. package/dist/external-runtimes/claude-code/permissions.d.ts +69 -0
  14. package/dist/external-runtimes/claude-code/permissions.js +120 -0
  15. package/dist/external-runtimes/claude-code/runtime.d.ts +40 -4
  16. package/dist/external-runtimes/claude-code/runtime.js +130 -39
  17. package/dist/external-runtimes/codex/app-server-client.d.ts +12 -0
  18. package/dist/external-runtimes/codex/app-server-client.js +16 -0
  19. package/dist/external-runtimes/codex/runtime.d.ts +11 -0
  20. package/dist/external-runtimes/codex/runtime.js +143 -16
  21. package/dist/external-runtimes/index.d.ts +2 -0
  22. package/dist/external-runtimes/index.js +1 -0
  23. package/dist/external-runtimes/session-factory.d.ts +14 -0
  24. package/dist/external-runtimes/session-factory.js +40 -1
  25. package/dist/external-runtimes/shared/mcp-bridge.d.ts +36 -1
  26. package/dist/external-runtimes/shared/mcp-bridge.js +93 -13
  27. package/dist/git/parse-log.d.ts +6 -2
  28. package/dist/git/parse-log.js +7 -3
  29. package/dist/git/utils.d.ts +4 -0
  30. package/dist/git/utils.js +29 -10
  31. package/dist/git/worktree/crud.js +28 -0
  32. package/dist/git/worktree/diff.js +57 -29
  33. package/dist/index.capability.js +14 -1
  34. package/dist/index.git.d.ts +1 -0
  35. package/dist/index.git.js +1 -0
  36. package/dist/quota/index.d.ts +2 -1
  37. package/dist/quota/index.js +27 -7
  38. package/dist/quota/types.d.ts +5 -2
  39. package/dist/review/review-prompt.d.ts +2 -0
  40. package/dist/review/review-prompt.js +70 -29
  41. package/dist/review/review-target.d.ts +29 -0
  42. package/dist/review/review-target.js +353 -0
  43. package/dist/tools/apply-patch/applier.js +64 -39
  44. package/dist/tools/apply-patch/backup-targets.d.ts +8 -0
  45. package/dist/tools/apply-patch/backup-targets.js +24 -0
  46. package/dist/tools/apply-patch/parser.js +4 -2
  47. package/dist/tools/check-quota.js +3 -1
  48. package/dist/tools/lsp.js +36 -5
  49. package/package.json +2 -2
package/dist/tools/lsp.js CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { getLSPManager } from "../lsp/manager.js";
5
5
  import { detectLSPServer } from "../lsp/servers.js";
6
- import { pathToFileURL } from "node:url";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import { isAbsolute, resolve } from "node:path";
8
8
  /**
9
9
  * How long to wait for `textDocument/publishDiagnostics` after opening a file.
@@ -19,6 +19,12 @@ const DIAGNOSTIC_SEVERITY = {
19
19
  3: "info",
20
20
  4: "hint",
21
21
  };
22
+ /**
23
+ * Documents this tool has opened on each client, with their last synced
24
+ * version. LSP allows one didOpen per document; later reads must sync the
25
+ * current disk text with didChange instead of reopening it.
26
+ */
27
+ const openDocuments = new WeakMap();
22
28
  export const lspToolDef = {
23
29
  name: "LSP",
24
30
  description: "Use Language Server Protocol for code intelligence operations. " +
@@ -134,9 +140,23 @@ export async function lspTool(args, ctx) {
134
140
  };
135
141
  const timer = setTimeout(() => finish(undefined), DIAGNOSTICS_TIMEOUT_MS);
136
142
  client.on?.("notification", onNotification);
137
- void client.notify("textDocument/didOpen", {
138
- textDocument: { uri, languageId: serverConfig.language, version: 1, text },
139
- });
143
+ let versions = openDocuments.get(client);
144
+ if (!versions)
145
+ openDocuments.set(client, (versions = new Map()));
146
+ const openVersion = versions.get(uri);
147
+ if (openVersion === undefined) {
148
+ versions.set(uri, 1);
149
+ void client.notify("textDocument/didOpen", {
150
+ textDocument: { uri, languageId: serverConfig.language, version: 1, text },
151
+ });
152
+ }
153
+ else {
154
+ versions.set(uri, openVersion + 1);
155
+ void client.notify("textDocument/didChange", {
156
+ textDocument: { uri, version: openVersion + 1 },
157
+ contentChanges: [{ text }],
158
+ });
159
+ }
140
160
  });
141
161
  if (diagnostics === undefined) {
142
162
  return `No diagnostics published within ${DIAGNOSTICS_TIMEOUT_MS}ms. The server may still be indexing.`;
@@ -184,12 +204,23 @@ function formatLocationResult(result, label) {
184
204
  const lines = locations.map((loc) => {
185
205
  const uri = loc.uri ?? loc.targetUri ?? "";
186
206
  const range = loc.range ?? loc.targetRange ?? {};
187
- const path = uri.replace("file://", "");
207
+ const path = locationPath(uri);
188
208
  const line = (range.start?.line ?? 0) + 1;
189
209
  return ` ${path}:${line}`;
190
210
  });
191
211
  return `${label} (${locations.length}):\n${lines.join("\n")}`;
192
212
  }
213
+ /** Decode a `file:` URI to a filesystem path; keep other URIs as reported. */
214
+ function locationPath(uri) {
215
+ if (!uri.startsWith("file:"))
216
+ return uri;
217
+ try {
218
+ return fileURLToPath(uri);
219
+ }
220
+ catch {
221
+ return uri;
222
+ }
223
+ }
193
224
  const SYMBOL_KINDS = {
194
225
  1: "File",
195
226
  2: "Module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell-capability-coding",
3
- "version": "0.9.43",
3
+ "version": "0.9.46",
4
4
  "description": "Coding capability pack for the generic code-shell agent core.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
40
40
  },
41
41
  "dependencies": {
42
- "@cjhyy/code-shell-core": "0.9.43"
42
+ "@cjhyy/code-shell-core": "0.9.46"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=20.10"