codex-copilot-dx 1.3.4 → 1.3.6

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 (51) hide show
  1. package/README.md +4 -2
  2. package/docs/ARCHITECTURE.md +42 -5
  3. package/docs/README.md +2 -0
  4. package/docs/REFERENCE.md +31 -2
  5. package/package.json +1 -1
  6. package/src/adapter.mjs +13 -8
  7. package/src/claude-capability-config.mjs +5 -6
  8. package/src/claude-client-config.mjs +8 -5
  9. package/src/claude-gateway.mjs +10 -9
  10. package/src/cli-management.mjs +3 -2
  11. package/src/client-integration.mjs +1 -1
  12. package/src/client-model-plan.mjs +10 -0
  13. package/src/connection-runtime.mjs +31 -9
  14. package/src/dashboard/connections.js +2 -2
  15. package/src/dashboard/console.js +2 -0
  16. package/src/dashboard/index.html +15 -2
  17. package/src/dashboard/language.js +15 -0
  18. package/src/dashboard/preferences.js +2 -2
  19. package/src/dashboard/privacy.js +67 -0
  20. package/src/dashboard/status.js +3 -1
  21. package/src/dashboard/ui.css +11 -0
  22. package/src/dashboard/ui.js +6 -0
  23. package/src/dashboard-api.mjs +19 -0
  24. package/src/dashboard.mjs +1 -0
  25. package/src/local-privacy.mjs +135 -0
  26. package/src/native-prediction-app.mjs +67 -0
  27. package/src/native-prediction-fix.mjs +1 -1
  28. package/src/native-prediction-profile.mjs +2 -36
  29. package/src/native-prediction-state.mjs +4 -1
  30. package/src/native-prediction-transport.mjs +21 -7
  31. package/src/native-prediction-windows.mjs +28 -11
  32. package/src/native-prediction.mjs +5 -3
  33. package/src/optional-routes.mjs +2 -2
  34. package/src/privacy-model.mjs +161 -0
  35. package/src/privacy-notices.txt +104 -0
  36. package/src/privacy-transform.mjs +192 -0
  37. package/src/provider-runtime.mjs +4 -3
  38. package/src/response-failures.mjs +12 -1
  39. package/src/responses-handler.mjs +11 -2
  40. package/src/responses-proxy.mjs +3 -3
  41. package/src/service-control.mjs +2 -1
  42. package/src/settings-preferences.mjs +3 -2
  43. package/src/startup-ui.mjs +1 -1
  44. package/src/stream-performance.mjs +1 -1
  45. package/src/terminal-colors.mjs +9 -5
  46. package/src/usage-analysis.mjs +79 -36
  47. package/src/usage-analytics.mjs +1 -0
  48. package/src/usage-store.mjs +21 -11
  49. package/src/usage.mjs +2 -0
  50. package/src/user-settings.mjs +3 -3
  51. package/src/native-prediction-protocol.mjs +0 -45
package/src/usage.mjs CHANGED
@@ -18,6 +18,8 @@ export {
18
18
  readUsageRecords,
19
19
  summarizeUsage,
20
20
  summarizeUsageLogs,
21
+ mergeUsageSummary,
22
+ subscribeUsageAppends,
21
23
  cacheReadTokens,
22
24
  usageCacheHitRate,
23
25
  } from "./usage-store.mjs";
@@ -51,12 +51,12 @@ export function readUserSettings({ env = process.env, home = os.homedir(), stric
51
51
  delete parsed[key];
52
52
  }
53
53
  }
54
- for (const key of ["nightly_updates", "auto_save_settings"]) if (Object.hasOwn(parsed, key) && typeof parsed[key] !== "boolean") {
54
+ for (const key of ["nightly_updates", "auto_save_settings", "privacy_enabled", "privacy_personal"]) if (Object.hasOwn(parsed, key) && typeof parsed[key] !== "boolean") {
55
55
  if (strict) throw invalidSettings(filePath, `${key} must be a boolean`);
56
56
  delete parsed[key];
57
57
  }
58
58
  if (Object.hasOwn(parsed, "terminal_color_theme") && !isColorTheme(parsed.terminal_color_theme)) {
59
- if (strict) throw invalidSettings(filePath, "terminal_color_theme must be green, klein or pink");
59
+ if (strict) throw invalidSettings(filePath, "terminal_color_theme must be green, klein, pink, mono or orange");
60
60
  delete parsed.terminal_color_theme;
61
61
  }
62
62
  if (Object.hasOwn(parsed, AUTO_REVIEW_MODEL_KEY)) {
@@ -152,7 +152,7 @@ export function terminalColorPreference(options = {}) {
152
152
  }
153
153
 
154
154
  export function writeTerminalColorTheme(theme, options = {}) {
155
- if (!isColorTheme(theme)) throw new Error("Choose green, klein or pink for the terminal color theme");
155
+ if (!isColorTheme(theme)) throw new Error("Choose green, klein, pink, mono or orange for the terminal color theme");
156
156
  return withFileLockSync(`${userSettingsPath(options)}.lock`, () => {
157
157
  const settings = readUserSettings({ ...options, strict: true });
158
158
  const next = { ...settings };
@@ -1,45 +0,0 @@
1
- import fs from "node:fs";
2
-
3
- const MAX_HEADER_BYTES = 32 * 1024 * 1024;
4
- const MAX_SOURCE_BYTES = 36 * 1024 * 1024;
5
-
6
- // Inspect only packed, named protocol/settings candidates in the installed
7
- // archive. A small forwarding chunk must not hide its real implementation.
8
- export function inspectPredictionArchive(archive) {
9
- const fd = fs.openSync(archive, "r");
10
- try {
11
- const before = fs.fstatSync(fd);
12
- const read = (size, offset) => {
13
- if (!before.isFile() || !Number.isSafeInteger(size) || size < 0 || !Number.isSafeInteger(offset)
14
- || offset < 0 || offset + size > before.size) throw new Error("Invalid prediction App archive bounds");
15
- const bytes = Buffer.alloc(size);
16
- if (fs.readSync(fd, bytes, 0, size, offset) !== size) throw new Error("Prediction App archive changed during inspection");
17
- return bytes;
18
- };
19
- const prefix = read(16, 0), headerSize = prefix.readUInt32LE(12);
20
- if (headerSize > MAX_HEADER_BYTES) throw new Error("Prediction App archive header exceeds its inspection limit");
21
- const tree = JSON.parse(read(headerSize, 16)).files;
22
- const base = 8 + prefix.readUInt32LE(4);
23
- let sourceBytes = 0;
24
- const contains = (files, pattern, markers, maxEntryBytes) => {
25
- const entries = Object.entries(files || {}).filter(([name]) => pattern.test(name));
26
- if (entries.length > 16) throw new Error("Prediction App protocol candidates exceed their inspection limit");
27
- for (const [, entry] of entries) {
28
- if (!entry || typeof entry !== "object") throw new Error("Invalid prediction App archive entry");
29
- if (entry.unpacked) continue;
30
- if (!Number.isSafeInteger(entry.size) || entry.size > maxEntryBytes
31
- || sourceBytes + entry.size > MAX_SOURCE_BYTES) throw new Error("Prediction App source exceeds its inspection limit");
32
- sourceBytes += entry.size;
33
- const bytes = read(entry.size, base + Number(entry.offset));
34
- if (markers.every(marker => bytes.includes(Buffer.from(marker)))) return true;
35
- }
36
- return false;
37
- };
38
- const compatible = contains(tree?.[".vite"]?.files?.build?.files, /^main-[\w-]+\.js$/,
39
- ["/wham/predictions/config", "experimentalPredictionMode"], 32 * 1024 * 1024)
40
- && contains(tree?.webview?.files?.assets?.files, /^general-settings-[\w-]+\.js$/, ["4290031608"], 4 * 1024 * 1024);
41
- const after = fs.fstatSync(fd);
42
- if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) throw new Error("Prediction App archive changed during inspection");
43
- return { compatible, size: after.size, mtimeMs: after.mtimeMs };
44
- } finally { fs.closeSync(fd); }
45
- }