@uvl000/claude-trace 3.0.13-workflowexp.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.
- package/README.md +477 -0
- package/README.zh-CN.md +477 -0
- package/dist/adapt/api-format.d.ts +41 -0
- package/dist/adapt/api-format.d.ts.map +1 -0
- package/dist/adapt/api-format.js +132 -0
- package/dist/adapt/api-format.js.map +1 -0
- package/dist/adapt/openai-adapter.d.ts +123 -0
- package/dist/adapt/openai-adapter.d.ts.map +1 -0
- package/dist/adapt/openai-adapter.js +628 -0
- package/dist/adapt/openai-adapter.js.map +1 -0
- package/dist/cli/cli-common.d.ts +73 -0
- package/dist/cli/cli-common.d.ts.map +1 -0
- package/dist/cli/cli-common.js +189 -0
- package/dist/cli/cli-common.js.map +1 -0
- package/dist/cli/cli.d.ts +23 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +175 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/codex-cli.d.ts +24 -0
- package/dist/cli/codex-cli.d.ts.map +1 -0
- package/dist/cli/codex-cli.js +146 -0
- package/dist/cli/codex-cli.js.map +1 -0
- package/dist/cli/opencode-cli.d.ts +23 -0
- package/dist/cli/opencode-cli.d.ts.map +1 -0
- package/dist/cli/opencode-cli.js +156 -0
- package/dist/cli/opencode-cli.js.map +1 -0
- package/dist/cli/trace-runner.d.ts +21 -0
- package/dist/cli/trace-runner.d.ts.map +1 -0
- package/dist/cli/trace-runner.js +282 -0
- package/dist/cli/trace-runner.js.map +1 -0
- package/dist/cli/validate-trace.d.ts +30 -0
- package/dist/cli/validate-trace.d.ts.map +1 -0
- package/dist/cli/validate-trace.js +230 -0
- package/dist/cli/validate-trace.js.map +1 -0
- package/dist/cli/verify-offline-bundle.d.ts +13 -0
- package/dist/cli/verify-offline-bundle.d.ts.map +1 -0
- package/dist/cli/verify-offline-bundle.js +89 -0
- package/dist/cli/verify-offline-bundle.js.map +1 -0
- package/dist/cli/vibe-coding-proxy-cli.d.ts +12 -0
- package/dist/cli/vibe-coding-proxy-cli.d.ts.map +1 -0
- package/dist/cli/vibe-coding-proxy-cli.js +218 -0
- package/dist/cli/vibe-coding-proxy-cli.js.map +1 -0
- package/dist/config/claude-config-overlay.d.ts +69 -0
- package/dist/config/claude-config-overlay.d.ts.map +1 -0
- package/dist/config/claude-config-overlay.js +229 -0
- package/dist/config/claude-config-overlay.js.map +1 -0
- package/dist/config/codex-config-overlay.d.ts +122 -0
- package/dist/config/codex-config-overlay.d.ts.map +1 -0
- package/dist/config/codex-config-overlay.js +352 -0
- package/dist/config/codex-config-overlay.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/intercept/forward-proxy.d.ts +77 -0
- package/dist/intercept/forward-proxy.d.ts.map +1 -0
- package/dist/intercept/forward-proxy.js +368 -0
- package/dist/intercept/forward-proxy.js.map +1 -0
- package/dist/intercept/header-redaction.d.ts +7 -0
- package/dist/intercept/header-redaction.d.ts.map +1 -0
- package/dist/intercept/header-redaction.js +28 -0
- package/dist/intercept/header-redaction.js.map +1 -0
- package/dist/intercept/interceptor-loader.js +26 -0
- package/dist/intercept/interceptor.d.ts +164 -0
- package/dist/intercept/interceptor.d.ts.map +1 -0
- package/dist/intercept/interceptor.js +496 -0
- package/dist/intercept/interceptor.js.map +1 -0
- package/dist/intercept/mitm-cert.d.ts +53 -0
- package/dist/intercept/mitm-cert.d.ts.map +1 -0
- package/dist/intercept/mitm-cert.js +259 -0
- package/dist/intercept/mitm-cert.js.map +1 -0
- package/dist/intercept/proxy-log-writer.d.ts +77 -0
- package/dist/intercept/proxy-log-writer.d.ts.map +1 -0
- package/dist/intercept/proxy-log-writer.js +323 -0
- package/dist/intercept/proxy-log-writer.js.map +1 -0
- package/dist/intercept/proxy-targets.d.ts +69 -0
- package/dist/intercept/proxy-targets.d.ts.map +1 -0
- package/dist/intercept/proxy-targets.js +129 -0
- package/dist/intercept/proxy-targets.js.map +1 -0
- package/dist/intercept/reverse-proxy.d.ts +191 -0
- package/dist/intercept/reverse-proxy.d.ts.map +1 -0
- package/dist/intercept/reverse-proxy.js +807 -0
- package/dist/intercept/reverse-proxy.js.map +1 -0
- package/dist/intercept/token-extractor.js +28 -0
- package/dist/report/html-generator.d.ts +96 -0
- package/dist/report/html-generator.d.ts.map +1 -0
- package/dist/report/html-generator.js +225 -0
- package/dist/report/html-generator.js.map +1 -0
- package/dist/report/index-generator.d.ts +89 -0
- package/dist/report/index-generator.d.ts.map +1 -0
- package/dist/report/index-generator.js +319 -0
- package/dist/report/index-generator.js.map +1 -0
- package/dist/report/shared-conversation-processor.d.ts +200 -0
- package/dist/report/shared-conversation-processor.d.ts.map +1 -0
- package/dist/report/shared-conversation-processor.js +720 -0
- package/dist/report/shared-conversation-processor.js.map +1 -0
- package/dist/routing/codex-routing.d.ts +40 -0
- package/dist/routing/codex-routing.d.ts.map +1 -0
- package/dist/routing/codex-routing.js +96 -0
- package/dist/routing/codex-routing.js.map +1 -0
- package/dist/routing/proxy-routing.d.ts +48 -0
- package/dist/routing/proxy-routing.d.ts.map +1 -0
- package/dist/routing/proxy-routing.js +113 -0
- package/dist/routing/proxy-routing.js.map +1 -0
- package/dist/tools/binary-utils.d.ts +29 -0
- package/dist/tools/binary-utils.d.ts.map +1 -0
- package/dist/tools/binary-utils.js +134 -0
- package/dist/tools/binary-utils.js.map +1 -0
- package/dist/tools/claude.d.ts +61 -0
- package/dist/tools/claude.d.ts.map +1 -0
- package/dist/tools/claude.js +449 -0
- package/dist/tools/claude.js.map +1 -0
- package/dist/tools/codex.d.ts +70 -0
- package/dist/tools/codex.d.ts.map +1 -0
- package/dist/tools/codex.js +492 -0
- package/dist/tools/codex.js.map +1 -0
- package/dist/tools/opencode.d.ts +85 -0
- package/dist/tools/opencode.d.ts.map +1 -0
- package/dist/tools/opencode.js +401 -0
- package/dist/tools/opencode.js.map +1 -0
- package/dist/tools/types.d.ts +91 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +11 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types.d.ts +158 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/frontend/dist/index.global.js +1551 -0
- package/frontend/dist/styles.css +1027 -0
- package/frontend/template.html +19 -0
- package/node_modules/agent-base/LICENSE +22 -0
- package/node_modules/agent-base/README.md +69 -0
- package/node_modules/agent-base/dist/helpers.d.ts +15 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
- package/node_modules/agent-base/dist/helpers.js +66 -0
- package/node_modules/agent-base/dist/helpers.js.map +1 -0
- package/node_modules/agent-base/dist/index.d.ts +41 -0
- package/node_modules/agent-base/dist/index.d.ts.map +1 -0
- package/node_modules/agent-base/dist/index.js +178 -0
- package/node_modules/agent-base/dist/index.js.map +1 -0
- package/node_modules/agent-base/package.json +46 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/http-proxy-agent/LICENSE +22 -0
- package/node_modules/http-proxy-agent/README.md +44 -0
- package/node_modules/http-proxy-agent/dist/index.d.ts +44 -0
- package/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/http-proxy-agent/dist/index.js +148 -0
- package/node_modules/http-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/http-proxy-agent/package.json +47 -0
- package/node_modules/https-proxy-agent/LICENSE +22 -0
- package/node_modules/https-proxy-agent/README.md +70 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +47 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.js +180 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +15 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +50 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/node-forge/LICENSE +331 -0
- package/node_modules/node-forge/README.md +2071 -0
- package/node_modules/node-forge/dist/forge.all.min.js +2 -0
- package/node_modules/node-forge/dist/forge.all.min.js.map +1 -0
- package/node_modules/node-forge/dist/forge.min.js +2 -0
- package/node_modules/node-forge/dist/forge.min.js.map +1 -0
- package/node_modules/node-forge/dist/prime.worker.min.js +2 -0
- package/node_modules/node-forge/dist/prime.worker.min.js.map +1 -0
- package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
- package/node_modules/node-forge/lib/aes.js +1091 -0
- package/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
- package/node_modules/node-forge/lib/asn1-validator.js +91 -0
- package/node_modules/node-forge/lib/asn1.js +1503 -0
- package/node_modules/node-forge/lib/baseN.js +186 -0
- package/node_modules/node-forge/lib/cipher.js +230 -0
- package/node_modules/node-forge/lib/cipherModes.js +999 -0
- package/node_modules/node-forge/lib/des.js +496 -0
- package/node_modules/node-forge/lib/ed25519.js +1091 -0
- package/node_modules/node-forge/lib/forge.js +13 -0
- package/node_modules/node-forge/lib/form.js +149 -0
- package/node_modules/node-forge/lib/hmac.js +146 -0
- package/node_modules/node-forge/lib/http.js +1346 -0
- package/node_modules/node-forge/lib/index.all.js +16 -0
- package/node_modules/node-forge/lib/index.js +33 -0
- package/node_modules/node-forge/lib/jsbn.js +1294 -0
- package/node_modules/node-forge/lib/kem.js +168 -0
- package/node_modules/node-forge/lib/log.js +319 -0
- package/node_modules/node-forge/lib/md.all.js +13 -0
- package/node_modules/node-forge/lib/md.js +11 -0
- package/node_modules/node-forge/lib/md5.js +289 -0
- package/node_modules/node-forge/lib/mgf.js +12 -0
- package/node_modules/node-forge/lib/mgf1.js +57 -0
- package/node_modules/node-forge/lib/oids.js +180 -0
- package/node_modules/node-forge/lib/pbe.js +1023 -0
- package/node_modules/node-forge/lib/pbkdf2.js +211 -0
- package/node_modules/node-forge/lib/pem.js +237 -0
- package/node_modules/node-forge/lib/pkcs1.js +276 -0
- package/node_modules/node-forge/lib/pkcs12.js +1078 -0
- package/node_modules/node-forge/lib/pkcs7.js +1260 -0
- package/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
- package/node_modules/node-forge/lib/pki.js +102 -0
- package/node_modules/node-forge/lib/prime.js +297 -0
- package/node_modules/node-forge/lib/prime.worker.js +168 -0
- package/node_modules/node-forge/lib/prng.js +419 -0
- package/node_modules/node-forge/lib/pss.js +241 -0
- package/node_modules/node-forge/lib/random.js +191 -0
- package/node_modules/node-forge/lib/rc2.js +410 -0
- package/node_modules/node-forge/lib/rsa.js +1968 -0
- package/node_modules/node-forge/lib/sha1.js +319 -0
- package/node_modules/node-forge/lib/sha256.js +327 -0
- package/node_modules/node-forge/lib/sha512.js +561 -0
- package/node_modules/node-forge/lib/socket.js +287 -0
- package/node_modules/node-forge/lib/ssh.js +236 -0
- package/node_modules/node-forge/lib/tls.js +4282 -0
- package/node_modules/node-forge/lib/tlssocket.js +249 -0
- package/node_modules/node-forge/lib/util.js +2652 -0
- package/node_modules/node-forge/lib/x509.js +3251 -0
- package/node_modules/node-forge/lib/xhr.js +738 -0
- package/node_modules/node-forge/package.json +123 -0
- package/node_modules/smol-toml/LICENSE +24 -0
- package/node_modules/smol-toml/README.md +239 -0
- package/node_modules/smol-toml/dist/date.d.ts +41 -0
- package/node_modules/smol-toml/dist/date.js +127 -0
- package/node_modules/smol-toml/dist/error.d.ts +38 -0
- package/node_modules/smol-toml/dist/error.js +63 -0
- package/node_modules/smol-toml/dist/extract.d.ts +30 -0
- package/node_modules/smol-toml/dist/extract.js +100 -0
- package/node_modules/smol-toml/dist/index.cjs +897 -0
- package/node_modules/smol-toml/dist/index.d.ts +43 -0
- package/node_modules/smol-toml/dist/index.js +33 -0
- package/node_modules/smol-toml/dist/parse.d.ts +37 -0
- package/node_modules/smol-toml/dist/parse.js +148 -0
- package/node_modules/smol-toml/dist/primitive.d.ts +31 -0
- package/node_modules/smol-toml/dist/primitive.js +179 -0
- package/node_modules/smol-toml/dist/stringify.d.ts +31 -0
- package/node_modules/smol-toml/dist/stringify.js +167 -0
- package/node_modules/smol-toml/dist/struct.d.ts +32 -0
- package/node_modules/smol-toml/dist/struct.js +184 -0
- package/node_modules/smol-toml/dist/util.d.ts +42 -0
- package/node_modules/smol-toml/dist/util.js +111 -0
- package/node_modules/smol-toml/package.json +54 -0
- package/offline/bin/claude-trace +6 -0
- package/offline/bin/claude-wrapper +13 -0
- package/offline/bin/install-agent +14 -0
- package/offline/bin/validate-trace +6 -0
- package/offline/bin/verify-bundle +7 -0
- package/package.json +103 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Persistent Claude Code config overlay for reverse-proxy interception.
|
|
3
|
+
*
|
|
4
|
+
* When the user's `~/.claude/settings.json` defines its own `ANTHROPIC_BASE_URL`,
|
|
5
|
+
* setting the env var alone is insufficient — Claude Code prefers settings over env.
|
|
6
|
+
* This module builds a writable overlay at `~/.claude-trace/claude-config-overlay/`
|
|
7
|
+
* that symlinks all config entries except `settings.json`, which is rewritten to
|
|
8
|
+
* strip `ANTHROPIC_BASE_URL` so the trace runner's proxy URL takes effect.
|
|
9
|
+
*/
|
|
10
|
+
/** Result of syncing source config entries into the overlay directory. */
|
|
11
|
+
export interface OverlaySyncResult {
|
|
12
|
+
/** Entry names successfully linked into the overlay. */
|
|
13
|
+
linked: string[];
|
|
14
|
+
/** Entries that could not be linked, with error reasons. */
|
|
15
|
+
skipped: Array<{
|
|
16
|
+
entry: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the persistent overlay directory path for Claude Code config.
|
|
22
|
+
*
|
|
23
|
+
* @returns Absolute path under `~/.claude-trace/claude-config-overlay/`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getClaudeConfigOverlayDir(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns true when `dir` is the canonical persistent overlay directory.
|
|
28
|
+
*
|
|
29
|
+
* Used to avoid deleting or recreating an overlay that is already in use.
|
|
30
|
+
*
|
|
31
|
+
* @param dir - Directory path to check, or `null`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isPersistentOverlayDir(dir: string | null): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the user's real Claude Code config directory.
|
|
36
|
+
*
|
|
37
|
+
* @param env - Environment map; defaults to `process.env`.
|
|
38
|
+
* @returns `CLAUDE_CONFIG_DIR` if set, otherwise `~/.claude`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveUserClaudeConfigDir(env?: NodeJS.ProcessEnv): string;
|
|
41
|
+
/**
|
|
42
|
+
* Builds or refreshes the Claude config overlay by symlinking source entries.
|
|
43
|
+
*
|
|
44
|
+
* All entries from `sourceConfigDir` are linked except `settings.json`, which
|
|
45
|
+
* is handled separately by {@link writeOverlaySettings}. Home-level state files
|
|
46
|
+
* are also linked when present.
|
|
47
|
+
*
|
|
48
|
+
* @param sourceConfigDir - User's real Claude config directory (`~/.claude`).
|
|
49
|
+
* @param overlayDir - Writable overlay directory to populate.
|
|
50
|
+
* @param homeDir - User home directory for `.claude.json` / `.credentials.json`.
|
|
51
|
+
* @returns Summary of linked and skipped entries.
|
|
52
|
+
*/
|
|
53
|
+
export declare function syncClaudeConfigOverlay(sourceConfigDir: string, overlayDir: string, homeDir: string): OverlaySyncResult;
|
|
54
|
+
/**
|
|
55
|
+
* Writes a modified `settings.json` into the overlay, stripping `ANTHROPIC_BASE_URL`.
|
|
56
|
+
*
|
|
57
|
+
* Claude Code reads `settings.json` env overrides with higher priority than process
|
|
58
|
+
* environment variables. Removing `ANTHROPIC_BASE_URL` from settings ensures the
|
|
59
|
+
* trace runner's `ANTHROPIC_BASE_URL=http://127.0.0.1:{port}` proxy URL wins.
|
|
60
|
+
*
|
|
61
|
+
* @param sourceSettingsPath - Path to the user's original `settings.json`.
|
|
62
|
+
* @param overlayDir - Overlay directory to write the modified settings into.
|
|
63
|
+
* @returns Paths needed to spawn Claude with `CLAUDE_CONFIG_DIR` pointing at the overlay.
|
|
64
|
+
*/
|
|
65
|
+
export declare function writeOverlaySettings(sourceSettingsPath: string, overlayDir: string): {
|
|
66
|
+
overlayDir: string;
|
|
67
|
+
spawnClaudeConfigDir: string;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=claude-config-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-config-overlay.d.ts","sourceRoot":"","sources":["../../src/config/claude-config-overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IACjC,wDAAwD;IACxD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,4DAA4D;IAC5D,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAKlE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEvF;AAwGD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACtC,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACb,iBAAiB,CAuBnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CACnC,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,MAAM,GAChB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAA;CAAE,CAiBtD"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Persistent Claude Code config overlay for reverse-proxy interception.
|
|
4
|
+
*
|
|
5
|
+
* When the user's `~/.claude/settings.json` defines its own `ANTHROPIC_BASE_URL`,
|
|
6
|
+
* setting the env var alone is insufficient — Claude Code prefers settings over env.
|
|
7
|
+
* This module builds a writable overlay at `~/.claude-trace/claude-config-overlay/`
|
|
8
|
+
* that symlinks all config entries except `settings.json`, which is rewritten to
|
|
9
|
+
* strip `ANTHROPIC_BASE_URL` so the trace runner's proxy URL takes effect.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.getClaudeConfigOverlayDir = getClaudeConfigOverlayDir;
|
|
46
|
+
exports.isPersistentOverlayDir = isPersistentOverlayDir;
|
|
47
|
+
exports.resolveUserClaudeConfigDir = resolveUserClaudeConfigDir;
|
|
48
|
+
exports.syncClaudeConfigOverlay = syncClaudeConfigOverlay;
|
|
49
|
+
exports.writeOverlaySettings = writeOverlaySettings;
|
|
50
|
+
const fs = __importStar(require("fs"));
|
|
51
|
+
const os = __importStar(require("os"));
|
|
52
|
+
const path = __importStar(require("path"));
|
|
53
|
+
/** Filename of Claude Code's primary settings file within the config directory. */
|
|
54
|
+
const SETTINGS_FILE = "settings.json";
|
|
55
|
+
/**
|
|
56
|
+
* Returns the persistent overlay directory path for Claude Code config.
|
|
57
|
+
*
|
|
58
|
+
* @returns Absolute path under `~/.claude-trace/claude-config-overlay/`.
|
|
59
|
+
*/
|
|
60
|
+
function getClaudeConfigOverlayDir() {
|
|
61
|
+
return path.join(os.homedir(), ".claude-trace", "claude-config-overlay");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns true when `dir` is the canonical persistent overlay directory.
|
|
65
|
+
*
|
|
66
|
+
* Used to avoid deleting or recreating an overlay that is already in use.
|
|
67
|
+
*
|
|
68
|
+
* @param dir - Directory path to check, or `null`.
|
|
69
|
+
*/
|
|
70
|
+
function isPersistentOverlayDir(dir) {
|
|
71
|
+
if (!dir) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return path.resolve(dir) === path.resolve(getClaudeConfigOverlayDir());
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves the user's real Claude Code config directory.
|
|
78
|
+
*
|
|
79
|
+
* @param env - Environment map; defaults to `process.env`.
|
|
80
|
+
* @returns `CLAUDE_CONFIG_DIR` if set, otherwise `~/.claude`.
|
|
81
|
+
*/
|
|
82
|
+
function resolveUserClaudeConfigDir(env = process.env) {
|
|
83
|
+
return env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates a directory symlink (junction on Windows, dir symlink elsewhere).
|
|
87
|
+
*
|
|
88
|
+
* @param sourcePath - Existing directory to link from.
|
|
89
|
+
* @param overlayPath - Destination path inside the overlay.
|
|
90
|
+
*/
|
|
91
|
+
function linkDirectory(sourcePath, overlayPath) {
|
|
92
|
+
const absoluteSource = path.resolve(sourcePath);
|
|
93
|
+
if (process.platform === "win32") {
|
|
94
|
+
// Junctions work without admin privileges on Windows for directories.
|
|
95
|
+
fs.symlinkSync(absoluteSource, overlayPath, "junction");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
fs.symlinkSync(absoluteSource, overlayPath, "dir");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Symlinks a file into the overlay, falling back to a plain copy on failure.
|
|
102
|
+
*
|
|
103
|
+
* Symlink creation may fail on Windows without Developer Mode; copy preserves behavior.
|
|
104
|
+
*
|
|
105
|
+
* @param sourcePath - Existing file in the user's real config directory.
|
|
106
|
+
* @param overlayPath - Destination path inside the overlay.
|
|
107
|
+
*/
|
|
108
|
+
function linkOrCopyFile(sourcePath, overlayPath) {
|
|
109
|
+
try {
|
|
110
|
+
if (process.platform === "win32") {
|
|
111
|
+
fs.symlinkSync(path.resolve(sourcePath), overlayPath, "file");
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
fs.symlinkSync(sourcePath, overlayPath, "file");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
fs.copyFileSync(sourcePath, overlayPath);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Links a single source entry (file or directory) into the overlay if not present.
|
|
123
|
+
*
|
|
124
|
+
* Skips silently when the overlay entry already exists to preserve idempotency.
|
|
125
|
+
*
|
|
126
|
+
* @param sourcePath - Path to the source file or directory.
|
|
127
|
+
* @param overlayPath - Corresponding path inside the overlay directory.
|
|
128
|
+
*/
|
|
129
|
+
function linkEntry(sourcePath, overlayPath) {
|
|
130
|
+
if (fs.existsSync(overlayPath)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const stat = fs.lstatSync(sourcePath);
|
|
134
|
+
if (stat.isDirectory()) {
|
|
135
|
+
linkDirectory(sourcePath, overlayPath);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
linkOrCopyFile(sourcePath, overlayPath);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Attempts to link one entry and records success or failure in `result`.
|
|
142
|
+
*
|
|
143
|
+
* Missing source files are ignored (not an error — optional config entries).
|
|
144
|
+
*
|
|
145
|
+
* @param entryLabel - Human-readable name recorded in the sync result.
|
|
146
|
+
* @param sourcePath - Source file or directory path.
|
|
147
|
+
* @param overlayPath - Destination path inside the overlay.
|
|
148
|
+
* @param result - Mutable sync result accumulator.
|
|
149
|
+
*/
|
|
150
|
+
function tryLinkEntryWithResult(entryLabel, sourcePath, overlayPath, result) {
|
|
151
|
+
if (!fs.existsSync(sourcePath)) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
linkEntry(sourcePath, overlayPath);
|
|
156
|
+
result.linked.push(entryLabel);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
const err = error;
|
|
160
|
+
result.skipped.push({ entry: entryLabel, reason: err.message });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Links Claude home-level state files that live outside the config directory.
|
|
165
|
+
*
|
|
166
|
+
* These files (`.claude.json`, `.credentials.json`) are required for auth and
|
|
167
|
+
* session state but are not inside `~/.claude/`.
|
|
168
|
+
*
|
|
169
|
+
* @param overlayDir - Overlay directory receiving the links.
|
|
170
|
+
* @param homeDir - User home directory containing the state files.
|
|
171
|
+
* @param result - Mutable sync result accumulator.
|
|
172
|
+
*/
|
|
173
|
+
function linkHomeStateFiles(overlayDir, homeDir, result) {
|
|
174
|
+
for (const fileName of [".claude.json", ".credentials.json"]) {
|
|
175
|
+
tryLinkEntryWithResult(fileName, path.join(homeDir, fileName), path.join(overlayDir, fileName), result);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Builds or refreshes the Claude config overlay by symlinking source entries.
|
|
180
|
+
*
|
|
181
|
+
* All entries from `sourceConfigDir` are linked except `settings.json`, which
|
|
182
|
+
* is handled separately by {@link writeOverlaySettings}. Home-level state files
|
|
183
|
+
* are also linked when present.
|
|
184
|
+
*
|
|
185
|
+
* @param sourceConfigDir - User's real Claude config directory (`~/.claude`).
|
|
186
|
+
* @param overlayDir - Writable overlay directory to populate.
|
|
187
|
+
* @param homeDir - User home directory for `.claude.json` / `.credentials.json`.
|
|
188
|
+
* @returns Summary of linked and skipped entries.
|
|
189
|
+
*/
|
|
190
|
+
function syncClaudeConfigOverlay(sourceConfigDir, overlayDir, homeDir) {
|
|
191
|
+
const result = { linked: [], skipped: [] };
|
|
192
|
+
fs.mkdirSync(overlayDir, { recursive: true });
|
|
193
|
+
if (fs.existsSync(sourceConfigDir)) {
|
|
194
|
+
for (const entry of fs.readdirSync(sourceConfigDir)) {
|
|
195
|
+
// settings.json is rewritten separately to remove ANTHROPIC_BASE_URL.
|
|
196
|
+
if (entry === SETTINGS_FILE) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
tryLinkEntryWithResult(entry, path.join(sourceConfigDir, entry), path.join(overlayDir, entry), result);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
linkHomeStateFiles(overlayDir, homeDir, result);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Writes a modified `settings.json` into the overlay, stripping `ANTHROPIC_BASE_URL`.
|
|
207
|
+
*
|
|
208
|
+
* Claude Code reads `settings.json` env overrides with higher priority than process
|
|
209
|
+
* environment variables. Removing `ANTHROPIC_BASE_URL` from settings ensures the
|
|
210
|
+
* trace runner's `ANTHROPIC_BASE_URL=http://127.0.0.1:{port}` proxy URL wins.
|
|
211
|
+
*
|
|
212
|
+
* @param sourceSettingsPath - Path to the user's original `settings.json`.
|
|
213
|
+
* @param overlayDir - Overlay directory to write the modified settings into.
|
|
214
|
+
* @returns Paths needed to spawn Claude with `CLAUDE_CONFIG_DIR` pointing at the overlay.
|
|
215
|
+
*/
|
|
216
|
+
function writeOverlaySettings(sourceSettingsPath, overlayDir) {
|
|
217
|
+
const settings = JSON.parse(fs.readFileSync(sourceSettingsPath, "utf-8"));
|
|
218
|
+
if (settings.env?.ANTHROPIC_BASE_URL) {
|
|
219
|
+
const { ANTHROPIC_BASE_URL: _removed, ...restEnv } = settings.env;
|
|
220
|
+
settings.env = restEnv;
|
|
221
|
+
}
|
|
222
|
+
fs.mkdirSync(overlayDir, { recursive: true });
|
|
223
|
+
fs.writeFileSync(path.join(overlayDir, SETTINGS_FILE), JSON.stringify(settings, null, 2));
|
|
224
|
+
return {
|
|
225
|
+
overlayDir,
|
|
226
|
+
spawnClaudeConfigDir: overlayDir,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=claude-config-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-config-overlay.js","sourceRoot":"","sources":["../../src/config/claude-config-overlay.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBH,8DAEC;AASD,wDAKC;AAQD,gEAEC;AAoHD,0DA2BC;AAaD,oDAoBC;AA9ND,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAE7B,mFAAmF;AACnF,MAAM,aAAa,GAAG,eAAe,CAAC;AAUtC;;;;GAIG;AACH,SAAgB,yBAAyB;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,uBAAuB,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,GAAkB;IACxD,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC9E,OAAO,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,UAAkB,EAAE,WAAmB;IAC7D,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClC,sEAAsE;QACtE,EAAE,CAAC,WAAW,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QACxD,OA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;IAED,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,oBAAoB,CACnC,kBAA0B,EAC1B,UAAkB;IAElB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAEvE,CAAC;IAEF,IAAI,QAAQ,CAAC,GAAG,EAAE,kBAAkB,EAAE,CAAC;QACtC,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC;QAClE,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE1F,OAAO;QACN,UAAU;QACV,oBAAoB,EAAE,UAAU;KAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Persistent Codex CLI config overlay for reverse-proxy interception.
|
|
3
|
+
*
|
|
4
|
+
* Codex reads API base URLs from `$CODEX_HOME/config.toml` and optional profile
|
|
5
|
+
* files (`*.config.toml`). This module builds a writable overlay at
|
|
6
|
+
* `~/.claude-trace/codex-config-overlay/` that rewrites all base URLs to the local
|
|
7
|
+
* trace proxy while symlinking auth and other non-config files from the real
|
|
8
|
+
* `$CODEX_HOME`. WebSocket support is disabled in custom providers for MVP logging.
|
|
9
|
+
*/
|
|
10
|
+
import type { OverlaySyncResult } from "./claude-config-overlay";
|
|
11
|
+
/**
|
|
12
|
+
* Built-in Codex provider ids whose base URLs are managed by Codex itself.
|
|
13
|
+
* Custom providers in `model_providers` are rewritten; these are skipped.
|
|
14
|
+
*/
|
|
15
|
+
declare const RESERVED_BUILTIN_PROVIDERS: Set<string>;
|
|
16
|
+
/** Parsed shape of Codex `config.toml` relevant to proxy rewriting. */
|
|
17
|
+
export interface CodexConfig {
|
|
18
|
+
/** Default model identifier. */
|
|
19
|
+
model?: string;
|
|
20
|
+
/** Active model provider id. */
|
|
21
|
+
model_provider?: string;
|
|
22
|
+
/** OpenAI API key auth base URL (typically `/v1/responses`). */
|
|
23
|
+
openai_base_url?: string;
|
|
24
|
+
/** ChatGPT OAuth base URL (typically `/backend-api/codex/responses`). */
|
|
25
|
+
chatgpt_base_url?: string;
|
|
26
|
+
/** User-defined custom model providers keyed by provider id. */
|
|
27
|
+
model_providers?: Record<string, CodexModelProvider>;
|
|
28
|
+
/** Additional TOML keys preserved through parse/stringify round-trips. */
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
/** Parsed shape of Codex `auth.json` fields used for proxy routing. */
|
|
32
|
+
export interface CodexAuth {
|
|
33
|
+
/** Active auth mode when present (e.g. `"chatgpt"` for ChatGPT OAuth). */
|
|
34
|
+
auth_mode?: string;
|
|
35
|
+
/** OpenAI API key when using API-key auth; `null` under ChatGPT OAuth. */
|
|
36
|
+
OPENAI_API_KEY?: string | null;
|
|
37
|
+
/** Additional auth file keys preserved through parse round-trips. */
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** A custom model provider entry within `model_providers`. */
|
|
41
|
+
export interface CodexModelProvider {
|
|
42
|
+
/** Human-readable provider name. */
|
|
43
|
+
name?: string;
|
|
44
|
+
/** Upstream API base URL for this provider. */
|
|
45
|
+
base_url?: string;
|
|
46
|
+
/** Wire protocol identifier (e.g. OpenAI-compatible). */
|
|
47
|
+
wire_api?: string;
|
|
48
|
+
/** Whether the provider supports WebSocket streaming. */
|
|
49
|
+
supports_websockets?: boolean;
|
|
50
|
+
/** Additional provider-specific TOML keys. */
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns the persistent overlay directory path for Codex config.
|
|
55
|
+
*
|
|
56
|
+
* @returns Absolute path under `~/.claude-trace/codex-config-overlay/`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function getCodexConfigOverlayDir(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Returns true when `dir` is the canonical persistent Codex overlay directory.
|
|
61
|
+
*
|
|
62
|
+
* @param dir - Directory path to check, or `null`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isPersistentCodexOverlayDir(dir: string | null): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Resolves the user's real Codex home directory.
|
|
67
|
+
*
|
|
68
|
+
* @param env - Environment map; defaults to `process.env`.
|
|
69
|
+
* @returns `CODEX_HOME` if set, otherwise `~/.codex`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveUserCodexHome(env?: NodeJS.ProcessEnv): string;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the path to `config.toml` if it exists, otherwise `null`.
|
|
74
|
+
*
|
|
75
|
+
* @param codexHome - Codex home directory; defaults to {@link resolveUserCodexHome}.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveCodexConfigPath(codexHome?: string): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Reads and parses Codex `config.toml`, returning an empty object on missing/error.
|
|
80
|
+
*
|
|
81
|
+
* @param codexHome - Codex home directory; defaults to {@link resolveUserCodexHome}.
|
|
82
|
+
*/
|
|
83
|
+
export declare function readCodexConfig(codexHome?: string): CodexConfig;
|
|
84
|
+
/**
|
|
85
|
+
* Reads and parses Codex `auth.json`, returning `null` when missing or invalid.
|
|
86
|
+
*
|
|
87
|
+
* @param codexHome - Codex home directory; defaults to {@link resolveUserCodexHome}.
|
|
88
|
+
*/
|
|
89
|
+
export declare function readCodexAuth(codexHome?: string): CodexAuth | null;
|
|
90
|
+
/**
|
|
91
|
+
* Returns true when `auth.json` explicitly selects ChatGPT OAuth.
|
|
92
|
+
*
|
|
93
|
+
* Only checks the `auth_mode` field when it is present; older auth files
|
|
94
|
+
* without `auth_mode` fall through to {@link hasChatGptAuth} heuristics.
|
|
95
|
+
*
|
|
96
|
+
* @param codexHome - Codex home directory; defaults to {@link resolveUserCodexHome}.
|
|
97
|
+
*/
|
|
98
|
+
export declare function isChatGptAuthMode(codexHome?: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Detects whether the user has ChatGPT OAuth credentials (vs OpenAI API key auth).
|
|
101
|
+
*
|
|
102
|
+
* Prefers an explicit `auth_mode: "chatgpt"` in `auth.json`. When `auth_mode` is
|
|
103
|
+
* absent, falls back to a legacy content heuristic for older Codex installs.
|
|
104
|
+
*
|
|
105
|
+
* @param codexHome - Codex home directory; defaults to {@link resolveUserCodexHome}.
|
|
106
|
+
*/
|
|
107
|
+
export declare function hasChatGptAuth(codexHome?: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Builds or refreshes the Codex config overlay.
|
|
110
|
+
*
|
|
111
|
+
* 1. Rewrites main `config.toml` and all `*.config.toml` profiles with proxy URLs.
|
|
112
|
+
* 2. Symlinks remaining `$CODEX_HOME` entries (auth, sessions, etc.) into the overlay.
|
|
113
|
+
*
|
|
114
|
+
* @param sourceHome - User's real `$CODEX_HOME` directory.
|
|
115
|
+
* @param overlayDir - Writable overlay directory to populate.
|
|
116
|
+
* @param proxyUrl - Local trace proxy base URL (e.g. `http://127.0.0.1:PORT`).
|
|
117
|
+
* @returns Summary of linked and skipped non-config entries.
|
|
118
|
+
*/
|
|
119
|
+
export declare function syncCodexConfigOverlay(sourceHome: string, overlayDir: string, proxyUrl: string): OverlaySyncResult;
|
|
120
|
+
/** Built-in Codex provider ids excluded from proxy URL rewriting. */
|
|
121
|
+
export { RESERVED_BUILTIN_PROVIDERS };
|
|
122
|
+
//# sourceMappingURL=codex-config-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-config-overlay.d.ts","sourceRoot":"","sources":["../../src/config/codex-config-overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAKjE;;;GAGG;AACH,QAAA,MAAM,0BAA0B,aAA4C,CAAC;AAE7E,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC3B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACrD,0EAA0E;IAC1E,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACzB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,qEAAqE;IACrE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IAClC,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,8CAA8C;IAC9C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAiFD;;;;GAIG;AACH,wBAAgB,wBAAw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