codex-multi-auth 2.3.0-beta.2 → 2.3.0-beta.3
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/.codex-plugin/plugin.json +2 -1
- package/README.md +1 -1
- package/dist/lib/account-policy.d.ts.map +1 -1
- package/dist/lib/account-policy.js +2 -1
- package/dist/lib/audit.d.ts +0 -9
- package/dist/lib/audit.d.ts.map +1 -1
- package/dist/lib/auth/device-auth.d.ts +1 -6
- package/dist/lib/auth/device-auth.d.ts.map +1 -1
- package/dist/lib/auth/device-auth.js +5 -5
- package/dist/lib/budget-guard.d.ts.map +1 -1
- package/dist/lib/budget-guard.js +2 -1
- package/dist/lib/codex-cli/writer.d.ts.map +1 -1
- package/dist/lib/codex-cli/writer.js +2 -1
- package/dist/lib/codex-manager/backend-settings-helpers.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-helpers.d.ts.map +1 -1
- package/dist/lib/codex-manager/backend-settings-helpers.js +1 -1
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts +0 -19
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/report.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/report.js +2 -1
- package/dist/lib/codex-manager/commands/uninstall.d.ts +2 -2
- package/dist/lib/codex-manager/commands/uninstall.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/uninstall.js +1 -1
- package/dist/lib/codex-manager/commands/usage.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/usage.js +2 -1
- package/dist/lib/codex-manager/commands/verify.d.ts +2 -2
- package/dist/lib/codex-manager/commands/verify.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/why-selected.d.ts +1 -22
- package/dist/lib/codex-manager/commands/why-selected.d.ts.map +1 -1
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts +0 -14
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.d.ts +2 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.d.ts.map +1 -1
- package/dist/lib/codex-manager/forecast-report-shared.d.ts +2 -2
- package/dist/lib/codex-manager/forecast-report-shared.d.ts.map +1 -1
- package/dist/lib/codex-manager/forecast-report-shared.js +2 -2
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts +0 -2
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -1
- package/dist/lib/codex-manager/formatters/quota-formatters.js +2 -2
- package/dist/lib/codex-manager/help.d.ts +2 -1
- package/dist/lib/codex-manager/help.d.ts.map +1 -1
- package/dist/lib/codex-manager/repair-commands.d.ts +0 -15
- package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -1
- package/dist/lib/codex-manager/repair-commands.js +5 -5
- package/dist/lib/codex-manager/settings-hub/backend.d.ts +0 -5
- package/dist/lib/codex-manager/settings-hub/backend.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-hub/backend.js +1 -1
- package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +1 -14
- package/dist/lib/codex-manager/settings-hub/dashboard.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-hub/dashboard.js +8 -8
- package/dist/lib/codex-manager/settings-write-queue.d.ts +0 -10
- package/dist/lib/codex-manager/settings-write-queue.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-write-queue.js +10 -10
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts +2 -17
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/theme-settings-panel.d.ts +0 -13
- package/dist/lib/codex-manager/theme-settings-panel.d.ts.map +1 -1
- package/dist/lib/config.d.ts +0 -13
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +22 -19
- package/dist/lib/dashboard-settings.d.ts +3 -3
- package/dist/lib/dashboard-settings.d.ts.map +1 -1
- package/dist/lib/dashboard-settings.js +0 -1
- package/dist/lib/errors.d.ts +0 -1
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/forecast.d.ts +4 -3
- package/dist/lib/forecast.d.ts.map +1 -1
- package/dist/lib/fs-retry.d.ts +0 -3
- package/dist/lib/fs-retry.d.ts.map +1 -1
- package/dist/lib/fs-retry.js +3 -3
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/local-client-tokens.d.ts.map +1 -1
- package/dist/lib/local-client-tokens.js +2 -1
- package/dist/lib/oc-chatgpt-import-adapter.d.ts +1 -1
- package/dist/lib/oc-chatgpt-import-adapter.d.ts.map +1 -1
- package/dist/lib/oc-chatgpt-orchestrator.d.ts.map +1 -1
- package/dist/lib/oc-chatgpt-orchestrator.js +2 -1
- package/dist/lib/oc-chatgpt-target-detection.d.ts +1 -1
- package/dist/lib/oc-chatgpt-target-detection.d.ts.map +1 -1
- package/dist/lib/prompts/codex-host-bridge.d.ts +0 -8
- package/dist/lib/prompts/codex-host-bridge.d.ts.map +1 -1
- package/dist/lib/prompts/codex-host-bridge.js +0 -20
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +2 -1
- package/dist/lib/prompts/fetch-utils.d.ts +0 -2
- package/dist/lib/prompts/fetch-utils.d.ts.map +1 -1
- package/dist/lib/prompts/fetch-utils.js +2 -2
- package/dist/lib/prompts/host-codex-prompt.d.ts.map +1 -1
- package/dist/lib/prompts/host-codex-prompt.js +2 -1
- package/dist/lib/quota-cache.d.ts.map +1 -1
- package/dist/lib/quota-cache.js +2 -1
- package/dist/lib/recovery/storage.d.ts.map +1 -1
- package/dist/lib/recovery/storage.js +5 -3
- package/dist/lib/recovery/types.d.ts +4 -12
- package/dist/lib/recovery/types.d.ts.map +1 -1
- package/dist/lib/recovery.d.ts +2 -2
- package/dist/lib/recovery.d.ts.map +1 -1
- package/dist/lib/request/response-compaction.d.ts +2 -1
- package/dist/lib/request/response-compaction.d.ts.map +1 -1
- package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -1
- package/dist/lib/request/stream-failover-runtime.js +23 -1
- package/dist/lib/rotation.d.ts +1 -3
- package/dist/lib/rotation.d.ts.map +1 -1
- package/dist/lib/rotation.js +1 -2
- package/dist/lib/routing-profiles.d.ts.map +1 -1
- package/dist/lib/routing-profiles.js +2 -1
- package/dist/lib/runtime/config-toml.d.ts +0 -6
- package/dist/lib/runtime/config-toml.d.ts.map +1 -1
- package/dist/lib/runtime/config-toml.js +6 -6
- package/dist/lib/runtime/event-handler.d.ts +0 -31
- package/dist/lib/runtime/event-handler.d.ts.map +1 -1
- package/dist/lib/runtime/event-handler.js +0 -22
- package/dist/lib/runtime/first-run.d.ts +3 -5
- package/dist/lib/runtime/first-run.d.ts.map +1 -1
- package/dist/lib/runtime/first-run.js +2 -2
- package/dist/lib/runtime/quota-headers.d.ts +1 -6
- package/dist/lib/runtime/quota-headers.d.ts.map +1 -1
- package/dist/lib/runtime/quota-headers.js +5 -5
- package/dist/lib/runtime/runtime-current-account.d.ts +3 -3
- package/dist/lib/runtime/runtime-current-account.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-current-account.js +1 -1
- package/dist/lib/runtime/runtime-observability.d.ts +2 -2
- package/dist/lib/runtime/runtime-observability.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-observability.js +0 -4
- package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
- package/dist/lib/runtime-rotation-proxy.js +4 -3
- package/dist/lib/schemas.d.ts +3 -91
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +8 -8
- package/dist/lib/storage/file-paths.d.ts +2 -2
- package/dist/lib/storage/file-paths.d.ts.map +1 -1
- package/dist/lib/storage/file-paths.js +2 -2
- package/dist/lib/storage/flagged-storage-io.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage-io.js +2 -2
- package/dist/lib/storage/import-export.d.ts.map +1 -1
- package/dist/lib/storage/import-export.js +2 -2
- package/dist/lib/storage/migrations.d.ts +2 -1
- package/dist/lib/storage/migrations.d.ts.map +1 -1
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +30 -23
- package/dist/lib/temp-path.d.ts +26 -0
- package/dist/lib/temp-path.d.ts.map +1 -0
- package/dist/lib/temp-path.js +30 -0
- package/dist/lib/ui/theme.d.ts +3 -2
- package/dist/lib/ui/theme.d.ts.map +1 -1
- package/dist/lib/unified-settings.d.ts.map +1 -1
- package/dist/lib/unified-settings.js +2 -1
- package/dist/lib/update-notice.d.ts.map +1 -1
- package/dist/lib/update-notice.js +2 -1
- package/package.json +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-retry.d.ts","sourceRoot":"","sources":["../../lib/fs-retry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,aAM3B,CAAC;
|
|
1
|
+
{"version":3,"file":"fs-retry.d.ts","sourceRoot":"","sources":["../../lib/fs-retry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,aAM3B,CAAC;AASH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOhE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,CAAC;IACzD,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAgCD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAChC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAC/B,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,CAAC,CAqB7E;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EACvC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|
package/dist/lib/fs-retry.js
CHANGED
|
@@ -5,9 +5,9 @@ export const FILE_RETRY_CODES = new Set([
|
|
|
5
5
|
"ENOTEMPTY",
|
|
6
6
|
"EACCES",
|
|
7
7
|
]);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const FILE_RETRY_MAX_ATTEMPTS = 6;
|
|
9
|
+
const FILE_RETRY_BASE_DELAY_MS = 25;
|
|
10
|
+
const FILE_RETRY_JITTER_MS = 20;
|
|
11
11
|
function sleep(ms) {
|
|
12
12
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13
13
|
}
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,6BAA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9C,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,iCAAiC,IAAI,2CAA2C,EAChF,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-client-tokens.d.ts","sourceRoot":"","sources":["../../lib/local-client-tokens.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-client-tokens.d.ts","sourceRoot":"","sources":["../../lib/local-client-tokens.ts"],"names":[],"mappings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C,CASlB;AAED,wBAAsB,4BAA4B,CACjD,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,GAAG,SAAa,GACd,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAwBxC;AAED,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
|
|
@@ -4,6 +4,7 @@ import { basename, join } from "node:path";
|
|
|
4
4
|
import { logWarn } from "./logger.js";
|
|
5
5
|
import { getCodexMultiAuthDir } from "./runtime-paths.js";
|
|
6
6
|
import { isRecord, sleep } from "./utils.js";
|
|
7
|
+
import { tempPathFor } from "./temp-path.js";
|
|
7
8
|
const TOKEN_FILE_NAME = "local-client-tokens.json";
|
|
8
9
|
const TOKEN_PREFIX = "cma_local";
|
|
9
10
|
// Debounce window for persisting a record's lastUsedAt. Bearer verification is
|
|
@@ -138,7 +139,7 @@ async function writeStoreToDisk(store) {
|
|
|
138
139
|
// Best-effort hardening only.
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
|
-
const tempPath =
|
|
142
|
+
const tempPath = tempPathFor(path);
|
|
142
143
|
let moved = false;
|
|
143
144
|
try {
|
|
144
145
|
await fs.writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\n`, {
|
|
@@ -7,7 +7,7 @@ export type OcChatgptPreviewPayload = {
|
|
|
7
7
|
activeIndexByFamily?: AccountStorageV3["activeIndexByFamily"];
|
|
8
8
|
accounts: OcChatgptAccountRef[];
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type OcChatgptAccountRef = {
|
|
11
11
|
accountId?: string;
|
|
12
12
|
email?: string;
|
|
13
13
|
refreshTokenLast4: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oc-chatgpt-import-adapter.d.ts","sourceRoot":"","sources":["../../lib/oc-chatgpt-import-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,gBAAgB,EAIrB,MAAM,cAAc,CAAC;AAEtB,KAAK,aAAa,GAAG,WAAW,GAAG,OAA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AAE,mBAAmB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/D,wBAAwB,EAAE,mBAAmB,EAAE,CAAC;IAChD,uBAAuB,EAAE,sBAAsB,CAAC;CAChD,CAAC;AAseF;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAC7B,sBAAsB,CAGxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACpD,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACrC,GAAG,qBAAqB,CA2ExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oc-chatgpt-orchestrator.d.ts","sourceRoot":"","sources":["../../lib/oc-chatgpt-orchestrator.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,2BAA2B,EAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,mBAAmB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,KAAK,gBAAgB,EACrB,iBAAiB,EAEjB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"oc-chatgpt-orchestrator.d.ts","sourceRoot":"","sources":["../../lib/oc-chatgpt-orchestrator.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,2BAA2B,EAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,mBAAmB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,KAAK,gBAAgB,EACrB,iBAAiB,E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C;IAChB,YAAY,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GACnC;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACZ,GACD;IACA,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACZ,GACD;IACA,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CACd,CAAC;AAoBL,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,GAClC,OAAO,CAAC,0BAA0B,CAAC,CAYrC"}
|
|
@@ -4,6 +4,7 @@ import { withFileOperationRetry } from "./fs-retry.js";
|
|
|
4
4
|
import { previewOcChatgptImportMerge, } from "./oc-chatgpt-import-adapter.js";
|
|
5
5
|
import { detectOcChatgptMultiAuthTarget, } from "./oc-chatgpt-target-detection.js";
|
|
6
6
|
import { exportNamedBackup, normalizeAccountStorage, } from "./storage.js";
|
|
7
|
+
import { tempPathFor } from "./temp-path.js";
|
|
7
8
|
function mapDetectionToBlocked(detection) {
|
|
8
9
|
if (detection.kind === "ambiguous") {
|
|
9
10
|
return { kind: "blocked-ambiguous", detection };
|
|
@@ -84,7 +85,7 @@ async function persistMergedDefault(target, merged) {
|
|
|
84
85
|
if (process.platform !== "win32") {
|
|
85
86
|
await fs.chmod(dir, 0o700).catch(() => undefined);
|
|
86
87
|
}
|
|
87
|
-
const tempPath =
|
|
88
|
+
const tempPath = tempPathFor(path);
|
|
88
89
|
const content = `${JSON.stringify(merged, null, 2)}\n`;
|
|
89
90
|
try {
|
|
90
91
|
await fs.writeFile(tempPath, content, { encoding: "utf-8", mode: 0o600 });
|
|
@@ -27,7 +27,7 @@ export type OcChatgptTargetNone = {
|
|
|
27
27
|
reason: string;
|
|
28
28
|
tried: Array<Pick<OcChatgptTargetCandidate, "scope" | "root" | "accountPath" | "backupRoot" | "source">>;
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
type OcChatgptTargetFound = {
|
|
31
31
|
kind: "target";
|
|
32
32
|
descriptor: OcChatgptTargetDescriptor;
|
|
33
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oc-chatgpt-target-detection.d.ts","sourceRoot":"","sources":["../../lib/oc-chatgpt-target-detection.ts"],"names":[],"mappings":"AAcA,KAAK,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,KAAK,qBAAqB,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAEvE,KAAK,wBAAwB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAChB,IAAI,CACH,wBAAwB,EACtB,OAAO,GACP,MAAM,GACN,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,qBAAqB,GACrB,YAAY,CACd,CACD,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CACX,IAAI,CACH,wBAAwB,EACxB,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,CAC1D,CACD,CAAC;CACF,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"oc-chatgpt-target-detection.d.ts","sourceRoot":"","sources":["../../lib/oc-chatgpt-target-detection.ts"],"names":[],"mappings":"AAcA,KAAK,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,KAAK,qBAAqB,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAEvE,KAAK,wBAAwB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAChB,IAAI,CACH,wBAAwB,EACtB,OAAO,GACP,MAAM,GACN,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,qBAAqB,GACrB,YAAY,CACd,CACD,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CACX,IAAI,CACH,wBAAwB,EACxB,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,CAC1D,CACD,CAAC;CACF,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACvC,oBAAoB,GACpB,wBAAwB,GACxB,mBAAmB,CAAC;AAoMvB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,CAAC,EAAE;IACxD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,8BAA8B,CA4JjC"}
|
|
@@ -8,12 +8,4 @@
|
|
|
8
8
|
* Token Count: ~450 tokens (~90% reduction vs full host prompt)
|
|
9
9
|
*/
|
|
10
10
|
export declare const CODEX_HOST_BRIDGE = "# Codex Host Bridge\n\nYou are running Codex through a host terminal coding runtime. The host provides specific tools to help you work efficiently.\n\n## CRITICAL: Tool Usage\n\n<critical_rule priority=\"0\">\napply_patch/applyPatch are Codex names, but host tool names vary by version.\n- Inspect the actual tool list before editing.\n- If `edit` exists: use `edit` for precise in-place string replacements and hashline edits.\n- If `edit` is absent and `apply_patch` exists: use `apply_patch` for those precise/hashline edits in this plugin.\n- For diff-style or multi-line structural edits: use `patch` if available, otherwise use `apply_patch`.\n- In this plugin, `edit` / `apply_patch` also support hashline refs (`lineRef`, `endLineRef`, `operation`, `content`)\n</critical_rule>\n\n<critical_rule priority=\"0\">\nUPDATE_PLAN DOES NOT EXIST -> USE \"todowrite\" INSTEAD\n- NEVER use: update_plan, updatePlan, read_plan, readPlan\n- ALWAYS use: todowrite for task/plan updates, todoread to read plans\n- Before plan operations: Verify you're using \"todowrite\", NOT \"update_plan\"\n</critical_rule>\n\n## Available Host Tools\n\n**File Operations:**\n- `write` - Create new files\n - Overwriting existing files requires a prior Read in this session; default to ASCII unless the file already uses Unicode.\n- `edit` - Modify existing files with string replacement (version-dependent)\n - Requires a prior Read in this session; preserve exact indentation; ensure `oldString` uniquely matches or use `replaceAll`; edit fails if ambiguous or missing.\n - Never pass unresolved template placeholders in `oldString` (e.g. `${TARGET_SNIPPET}`); `oldString` must be literal text copied from the current file.\n - For complex multi-line changes: break into multiple sequential edit calls, each with unique oldString context.\n- `apply_patch` - May be the edit/patch tool name in newer host builds (version-dependent)\n - In this plugin, `apply_patch` also accepts hashline edit args (`path`, `lineRef`, `endLineRef`, `operation`, `content`) when `edit` is not available.\n- `hashline_read` - Read file with hashline refs (`L<line>#<hash>`) for deterministic edits\n- `patch` - Apply diff-style patches for multi-line updates (version-dependent)\n- `read` - Read file contents\n\nNote: Tool naming is version-dependent. If `edit` is unavailable but `apply_patch` exists, use `apply_patch`.\n\nWhen available, prefer hashline workflow for reliability:\n1. Call `hashline_read` for target file and capture refs.\n2. Call `edit` or `apply_patch` with `lineRef` (and optional `endLineRef`) plus `operation` and `content`.\n3. Use legacy `oldString` / `newString` only when hashline refs are unavailable, and only with literal file text (no template placeholders).\n\n**Search/Discovery:**\n- `grep` - Search file contents (tool, not bash grep); use `include` to filter patterns; set `path` only when not searching workspace root; for cross-file match counts use bash with `rg`.\n- `glob` - Find files by pattern; defaults to workspace cwd unless `path` is set.\n- `list` - List directories (requires absolute paths)\n\n**Execution:**\n- `bash` - Run shell commands\n - No workdir parameter; do not include it in tool calls.\n - Always include a short description for the command.\n - Do not use cd; use absolute paths in commands.\n - Quote paths containing spaces with double quotes.\n - Chain multiple commands with ';' or '&&'; avoid newlines.\n - Use Grep/Glob tools for searches; only use bash with `rg` when you need counts or advanced features.\n - Do not use `ls`/`cat` in bash; use `list`/`read` tools instead.\n - For deletions (rm), verify by listing parent dir with `list`.\n\n**Network:**\n- `webfetch` - Fetch web content\n - Use fully-formed URLs (http/https; http auto-upgrades to https).\n - Always set `format` to one of: text | markdown | html; prefer markdown unless otherwise required.\n - Read-only; short cache window.\n\n**Task Management:**\n- `todowrite` - Manage tasks/plans (REPLACES update_plan)\n- `todoread` - Read current plan\n\n## Substitution Rules\n\nBase instruction says: You MUST use instead:\napply_patch -> patch (preferred if available), otherwise edit/apply_patch based on actual tool list\nupdate_plan -> todowrite\nread_plan -> todoread\n\n**Path Usage:** Use per-tool conventions to avoid conflicts:\n- Tool calls: `read`, `edit`, `write`, `list` require absolute paths.\n- Searches: `grep`/`glob` default to the workspace cwd; prefer relative include patterns; set `path` only when a different root is needed.\n- Presentation: In assistant messages, show workspace-relative paths; use absolute paths only inside tool calls.\n- Tool schema overrides general path preferences-do not convert required absolute paths to relative.\n\n## Verification Checklist\n\nBefore file/plan modifications:\n1. Am I using the actual available edit tool name (`edit`, `patch`, or `apply_patch`)?\n2. Am I using \"todowrite\" NOT \"update_plan\"?\n3. Is this tool in the approved list above?\n4. Am I following each tool's path requirements?\n\nIf ANY answer is NO -> STOP and correct before proceeding.\n\n## Host Working Style\n\n**Communication:**\n- Send brief preambles (8-12 words) before tool calls, building on prior context\n- Provide progress updates during longer tasks\n\n**Execution:**\n- Keep working autonomously until query is fully resolved before yielding\n- Don't return to user with partial solutions\n\n**Code Approach:**\n- New projects: Be ambitious and creative\n- Existing codebases: Surgical precision - modify only what's requested unless explicitly instructed to do otherwise\n\n**Testing:**\n- If tests exist: Start specific to your changes, then broader validation\n\n## Advanced Tools\n\n**Task Tool (Sub-Agents):**\n- Use the Task tool (functions.task) to launch sub-agents\n- Check the Task tool description for current agent types and their capabilities\n- Useful for complex analysis, specialized workflows, or tasks requiring isolated context\n- The agent list is dynamically generated - refer to tool schema for available agents\n\n**Parallelization:**\n- When multiple independent tool calls are needed, use multi_tool_use.parallel to run them concurrently.\n- Reserve sequential calls for ordered or data-dependent steps.\n\n**MCP Tools:**\n- Model Context Protocol servers provide additional capabilities\n- MCP tools are prefixed: `mcp__<server-name>__<tool-name>`\n- Check your available tools for MCP integrations\n- Use when the tool's functionality matches your task needs\n\n## What Remains from Codex\n \nSandbox policies, approval mechanisms, final answer formatting, git commit protocols, and file reference formats all follow Codex instructions. In approval policy \"never\", never request escalations.\n\n## Approvals & Safety\n- Assume workspace-write filesystem, network enabled, approval on-failure unless explicitly stated otherwise.\n- When a command fails due to sandboxing or permissions, retry with escalated permissions if allowed by policy, including a one-line justification.\n- Treat destructive commands (e.g., `rm`, `git reset --hard`) as requiring explicit user request or approval.\n- Never run `git reset --hard`, `git checkout --`, or force deletes unless the user explicitly asked for that exact action.\n- `request_user_input` is Plan-mode only; do not call it in Default mode.\n- When uncertain, prefer non-destructive verification first (e.g., confirm file existence with `list`, then delete with `bash`).";
|
|
11
|
-
export interface CodexHostBridgeMeta {
|
|
12
|
-
estimatedTokens: number;
|
|
13
|
-
reductionVsCurrent: string;
|
|
14
|
-
reductionVsToolRemap: string;
|
|
15
|
-
protects: string[];
|
|
16
|
-
omits: string[];
|
|
17
|
-
}
|
|
18
|
-
export declare const CODEX_HOST_BRIDGE_META: CodexHostBridgeMeta;
|
|
19
11
|
//# sourceMappingURL=codex-host-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-host-bridge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex-host-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,y5OA0IuG,CAAC
|
|
1
|
+
{"version":3,"file":"codex-host-bridge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex-host-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,y5OA0IuG,CAAC"}
|
|
@@ -146,23 +146,3 @@ Sandbox policies, approval mechanisms, final answer formatting, git commit proto
|
|
|
146
146
|
- Never run \`git reset --hard\`, \`git checkout --\`, or force deletes unless the user explicitly asked for that exact action.
|
|
147
147
|
- \`request_user_input\` is Plan-mode only; do not call it in Default mode.
|
|
148
148
|
- When uncertain, prefer non-destructive verification first (e.g., confirm file existence with \`list\`, then delete with \`bash\`).`;
|
|
149
|
-
export const CODEX_HOST_BRIDGE_META = {
|
|
150
|
-
estimatedTokens: 550,
|
|
151
|
-
reductionVsCurrent: "88%",
|
|
152
|
-
reductionVsToolRemap: "10%",
|
|
153
|
-
protects: [
|
|
154
|
-
"Tool name confusion (update_plan)",
|
|
155
|
-
"Missing tool awareness",
|
|
156
|
-
"Task tool / sub-agent awareness",
|
|
157
|
-
"MCP tool awareness",
|
|
158
|
-
"Premature yielding to user",
|
|
159
|
-
"Over-modification of existing code",
|
|
160
|
-
"Environment confusion",
|
|
161
|
-
],
|
|
162
|
-
omits: [
|
|
163
|
-
"Sandbox details (in Codex)",
|
|
164
|
-
"Formatting rules (in Codex)",
|
|
165
|
-
"Tool schemas (in tool JSONs)",
|
|
166
|
-
"Git protocols (in Codex)",
|
|
167
|
-
],
|
|
168
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AA4EnG;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C;AAcD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAyBnE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,WAAW,CAEnE;AA4ED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACzC,eAAe,SAAgB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAkHjB;AA6GD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,MAAM,EAAO,GAAG,IAAI,CAiBpE;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,ozGA+EV,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { getCodexCacheDir } from "../runtime-paths.js";
|
|
|
7
7
|
import { DEFAULT_MODEL, getModelProfile } from "../request/helpers/model-map.js";
|
|
8
8
|
import { fetchWithTimeout, readBodyTextGuarded, withBodyTimeout } from "./fetch-utils.js";
|
|
9
9
|
import { withFileOperationRetry } from "../fs-retry.js";
|
|
10
|
+
import { tempFileNonce } from "../temp-path.js";
|
|
10
11
|
/** SHA-256 of cache content for integrity verification (prompts-03). */
|
|
11
12
|
function sha256(content) {
|
|
12
13
|
return createHash("sha256").update(content, "utf8").digest("hex");
|
|
@@ -29,7 +30,7 @@ function sha256(content) {
|
|
|
29
30
|
*/
|
|
30
31
|
async function writeCacheAtomically(cacheFile, cacheMetaFile, content, meta) {
|
|
31
32
|
await withFileOperationRetry(() => fs.mkdir(CACHE_DIR, { recursive: true }));
|
|
32
|
-
const nonce =
|
|
33
|
+
const nonce = tempFileNonce();
|
|
33
34
|
const contentTmp = `${cacheFile}.${nonce}.tmp`;
|
|
34
35
|
const metaTmp = `${cacheMetaFile}.${nonce}.tmp`;
|
|
35
36
|
try {
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
* - a User-Agent (api.github.com rejects requests without one) plus a sensible
|
|
14
14
|
* Accept, applied to every request (prompts-08)
|
|
15
15
|
*/
|
|
16
|
-
export declare const PROMPT_FETCH_TIMEOUT_MS = 10000;
|
|
17
16
|
export declare const PROMPT_FETCH_MAX_BYTES = 1000000;
|
|
18
|
-
export declare const PROMPT_FETCH_USER_AGENT = "codex-multi-auth";
|
|
19
17
|
export interface PromptFetchOptions {
|
|
20
18
|
headers?: Record<string, string>;
|
|
21
19
|
timeoutMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-utils.d.ts","sourceRoot":"","sources":["../../../lib/prompts/fetch-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"fetch-utils.d.ts","sourceRoot":"","sources":["../../../lib/prompts/fetch-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,eAAO,MAAM,sBAAsB,UAAY,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACpC,IAAI,UAAQ,GACV,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,kBAAuB,EAChC,SAAS,GAAE,OAAO,KAAa,GAC7B,OAAO,CAAC,QAAQ,CAAC,CAYnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACtC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,SAAS,GAAE,MAAgC,GACzC,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACxC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,GAAE,MAA+B,EACzC,SAAS,GAAE,MAAgC,GACzC,OAAO,CAAC,MAAM,CAAC,CA2DjB"}
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* - a User-Agent (api.github.com rejects requests without one) plus a sensible
|
|
14
14
|
* Accept, applied to every request (prompts-08)
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
const PROMPT_FETCH_TIMEOUT_MS = 10_000;
|
|
17
17
|
export const PROMPT_FETCH_MAX_BYTES = 1_000_000; // 1 MB ceiling for a prompt body
|
|
18
|
-
|
|
18
|
+
const PROMPT_FETCH_USER_AGENT = "codex-multi-auth";
|
|
19
19
|
/**
|
|
20
20
|
* Merge caller headers with the mandatory User-Agent / Accept defaults.
|
|
21
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-codex-prompt.d.ts","sourceRoot":"","sources":["../../../lib/prompts/host-codex-prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"host-codex-prompt.d.ts","sourceRoot":"","sources":["../../../lib/prompts/host-codex-prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2VH;;;;;;GAMG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CA+B1D;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAO9E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C"}
|
|
@@ -10,6 +10,7 @@ import { logDebug } from "../logger.js";
|
|
|
10
10
|
import { getCodexCacheDir } from "../runtime-paths.js";
|
|
11
11
|
import { sleep } from "../utils.js";
|
|
12
12
|
import { fetchWithTimeout, readBodyTextGuarded } from "./fetch-utils.js";
|
|
13
|
+
import { tempFileNonce } from "../temp-path.js";
|
|
13
14
|
const DEFAULT_HOST_CODEX_PROMPT_URLS = [
|
|
14
15
|
// Canonical upstream is sst/opencode. The previous list pointed at a rebrand
|
|
15
16
|
// artifact (`anomalyco/Codex`, `sst/Codex`, `packages/Codex/...`) that 404s, so
|
|
@@ -132,7 +133,7 @@ async function removeFileQuietly(path) {
|
|
|
132
133
|
}
|
|
133
134
|
async function writeCacheFilesAtomically(content, meta) {
|
|
134
135
|
await mkdir(CACHE_DIR, { recursive: true });
|
|
135
|
-
const nonce =
|
|
136
|
+
const nonce = tempFileNonce();
|
|
136
137
|
const contentTmp = `${CACHE_FILE}.${nonce}.tmp`;
|
|
137
138
|
const metaTmp = `${CACHE_META_FILE}.${nonce}.tmp`;
|
|
138
139
|
const metaJson = JSON.stringify(meta, null, 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quota-cache.d.ts","sourceRoot":"","sources":["../../lib/quota-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quota-cache.d.ts","sourceRoot":"","sources":["../../lib/quota-cache.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACzC;AAsGD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CA4B9D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DxE"}
|
package/dist/lib/quota-cache.js
CHANGED
|
@@ -3,6 +3,7 @@ import { basename, join } from "node:path";
|
|
|
3
3
|
import { withRetry } from "./fs-retry.js";
|
|
4
4
|
import { logWarn } from "./logger.js";
|
|
5
5
|
import { getCodexMultiAuthDir } from "./runtime-paths.js";
|
|
6
|
+
import { tempPathFor } from "./temp-path.js";
|
|
6
7
|
import { isRecord } from "./utils.js";
|
|
7
8
|
const QUOTA_CACHE_PATH = join(getCodexMultiAuthDir(), "quota-cache.json");
|
|
8
9
|
const QUOTA_CACHE_LABEL = basename(QUOTA_CACHE_PATH);
|
|
@@ -192,7 +193,7 @@ export async function saveQuotaCache(data) {
|
|
|
192
193
|
// Best-effort hardening only.
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
|
-
const tempPath =
|
|
196
|
+
const tempPath = tempPathFor(QUOTA_CACHE_PATH);
|
|
196
197
|
await fs.writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\n`, {
|
|
197
198
|
encoding: "utf8",
|
|
198
199
|
mode: 0o600,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../lib/recovery/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../lib/recovery/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAkB,MAAM,YAAY,CAAC;AA4EhF,mFAAmF;AACnF,wBAAgB,0BAA0B,IAAI;IAC7C,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC3B,CAEA;AAED,kDAAkD;AAClD,wBAAgB,8BAA8B,IAAI,IAAI,CAGrD;AAuJD,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAUD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CA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AM,GAAG,MAAM,EAAE,CAkB1E"}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Based on Codex-antigravity-auth recovery module.
|
|
5
5
|
*/
|
|
6
|
+
import { randomBytes } from "node:crypto";
|
|
6
7
|
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
7
8
|
import { join } from "node:path";
|
|
8
9
|
import { withRetrySync } from "../fs-retry.js";
|
|
9
10
|
import { MESSAGE_STORAGE, PART_STORAGE, THINKING_TYPES, META_TYPES, } from "./constants.js";
|
|
10
11
|
import { createLogger } from "../logger.js";
|
|
12
|
+
import { tempFileNonce } from "../temp-path.js";
|
|
11
13
|
const recoveryLog = createLogger("recovery-storage");
|
|
12
14
|
/**
|
|
13
15
|
* recovery-10: corrupt session files were silently skipped (`continue`) with no
|
|
@@ -176,7 +178,7 @@ function renameSyncWithRetry(source, target) {
|
|
|
176
178
|
* do not silently drop the payload. See AUDIT-M01 HIGH-2.
|
|
177
179
|
*/
|
|
178
180
|
function atomicWriteFileSync(path, data, options = {}) {
|
|
179
|
-
const tempSuffix = `.tmp.${
|
|
181
|
+
const tempSuffix = `.tmp.${tempFileNonce()}`;
|
|
180
182
|
const tempPath = `${path}${tempSuffix}`;
|
|
181
183
|
try {
|
|
182
184
|
writeFileSync(tempPath, data, { mode: options.mode ?? 0o600 });
|
|
@@ -225,7 +227,7 @@ function safeUnlinkWithRetry(filePath, maxAttempts = 4) {
|
|
|
225
227
|
// =============================================================================
|
|
226
228
|
export function generatePartId() {
|
|
227
229
|
const timestamp = Date.now().toString(16);
|
|
228
|
-
const random =
|
|
230
|
+
const random = randomBytes(4).toString("hex");
|
|
229
231
|
return `prt_${timestamp}${random}`;
|
|
230
232
|
}
|
|
231
233
|
/**
|
|
@@ -250,7 +252,7 @@ let thinkingPartCounter = 0;
|
|
|
250
252
|
export function generateThinkingPartId() {
|
|
251
253
|
const timestamp = Date.now().toString(16);
|
|
252
254
|
const counter = (thinkingPartCounter++).toString(36);
|
|
253
|
-
const random =
|
|
255
|
+
const random = randomBytes(3).toString("hex");
|
|
254
256
|
return `prt_0000000000_thinking_${timestamp}_${counter}_${random}`;
|
|
255
257
|
}
|
|
256
258
|
// =============================================================================
|
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Based on Codex-antigravity-auth recovery module.
|
|
5
5
|
*/
|
|
6
|
-
export type ThinkingPartType = "thinking" | "redacted_thinking" | "reasoning";
|
|
7
|
-
export type MetaPartType = "step-start" | "step-finish";
|
|
8
|
-
export type ContentPartType = "text" | "tool" | "tool_use" | "tool_result";
|
|
9
6
|
export interface StoredMessageMeta {
|
|
10
7
|
id: string;
|
|
11
8
|
sessionID: string;
|
|
@@ -26,7 +23,7 @@ export interface StoredTextPart {
|
|
|
26
23
|
synthetic?: boolean;
|
|
27
24
|
ignored?: boolean;
|
|
28
25
|
}
|
|
29
|
-
|
|
26
|
+
interface StoredToolPart {
|
|
30
27
|
id: string;
|
|
31
28
|
sessionID: string;
|
|
32
29
|
messageID: string;
|
|
@@ -40,14 +37,14 @@ export interface StoredToolPart {
|
|
|
40
37
|
error?: string;
|
|
41
38
|
};
|
|
42
39
|
}
|
|
43
|
-
|
|
40
|
+
interface StoredReasoningPart {
|
|
44
41
|
id: string;
|
|
45
42
|
sessionID: string;
|
|
46
43
|
messageID: string;
|
|
47
44
|
type: "reasoning";
|
|
48
45
|
text: string;
|
|
49
46
|
}
|
|
50
|
-
|
|
47
|
+
interface StoredStepPart {
|
|
51
48
|
id: string;
|
|
52
49
|
sessionID: string;
|
|
53
50
|
messageID: string;
|
|
@@ -102,15 +99,10 @@ export interface ResumeConfig {
|
|
|
102
99
|
};
|
|
103
100
|
}
|
|
104
101
|
export type RecoveryErrorType = "tool_result_missing" | "thinking_block_order" | "thinking_disabled_violation" | null;
|
|
105
|
-
export interface ToolUsePart {
|
|
106
|
-
type: "tool_use";
|
|
107
|
-
id: string;
|
|
108
|
-
name: string;
|
|
109
|
-
input: Record<string, unknown>;
|
|
110
|
-
}
|
|
111
102
|
export interface ToolResultPart {
|
|
112
103
|
type: "tool_result";
|
|
113
104
|
tool_use_id: string;
|
|
114
105
|
content: string;
|
|
115
106
|
}
|
|
107
|
+
export {};
|
|
116
108
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/recovery/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/recovery/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,MAAM,EAAE,SAAS,GAAG,SAAS,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,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE;YACN,UAAU,EAAE,MAAM,CAAC;YACnB,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,CAAC;IACF,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAMD,MAAM,MAAM,iBAAiB,GACzB,qBAAqB,GACrB,sBAAsB,GACtB,6BAA6B,GAC7B,IAAI,CAAC;AAET,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/lib/recovery.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginInput } from "@codex-ai/plugin";
|
|
2
2
|
import type { PluginConfig } from "./types.js";
|
|
3
|
-
import type { MessageInfo,
|
|
4
|
-
export type { RecoveryErrorType
|
|
3
|
+
import type { MessageInfo, RecoveryErrorType } from "./recovery/types.js";
|
|
4
|
+
export type { RecoveryErrorType };
|
|
5
5
|
type PluginClient = PluginInput["client"];
|
|
6
6
|
export declare function detectErrorType(error: unknown): RecoveryErrorType;
|
|
7
7
|
export declare function isRecoverableError(error: unknown): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../lib/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/C,OAAO,KAAK,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../lib/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/C,OAAO,KAAK,EACV,WAAW,EAIX,iBAAiB,EAElB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,KAAK,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AAuC1C,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAsBjE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE1D;AAkKD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,iBAAiB,GAAG;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAWA;AAED,wBAAgB,uBAAuB,IAAI;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAKA;AAED,wBAAgB,uBAAuB,IAAI;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAKA;AAED,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAChD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACpE,6BAA6B,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;CAChF;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,sBAAsB,EAC3B,MAAM,EAAE,YAAY,GACnB,mBAAmB,GAAG,IAAI,CA6H5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequestBody } from "../types.js";
|
|
2
|
-
|
|
2
|
+
interface DeferredFastSessionInputTrim {
|
|
3
3
|
maxItems: number;
|
|
4
4
|
preferLatestUserOnly: boolean;
|
|
5
5
|
}
|
|
@@ -17,4 +17,5 @@ export interface ApplyResponseCompactionParams {
|
|
|
17
17
|
timeoutMs?: number;
|
|
18
18
|
}
|
|
19
19
|
export declare function applyResponseCompaction(params: ApplyResponseCompactionParams): Promise<ResponseCompactionResult>;
|
|
20
|
+
export {};
|
|
20
21
|
//# sourceMappingURL=response-compaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-compaction.d.ts","sourceRoot":"","sources":["../../../lib/request/response-compaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1D,
|
|
1
|
+
{"version":3,"file":"response-compaction.d.ts","sourceRoot":"","sources":["../../../lib/request/response-compaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1D,UAAU,4BAA4B;IACrC,QA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jB;
|
|
1
|
+
{"version":3,"file":"stream-failover-runtime.d.ts","sourceRoot":"","sources":["../../../lib/request/stream-failover-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,eAAO,MAAM,kBAAkB,aAW7B,CAAC;AAWH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUzF;AAED,wBAAsB,WAAW,CAAC,CAAC,EAClC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,IAAI,EACrB,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,CAAC,CAmBZ;AAED,wBAAsB,aAAa,CAClC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,SAAc,GACpB,OAAO,CAAC,MAAM,CAAC,CAuDjB;AAoBD,wBAAsB,wBAAwB,CAC7C,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,0BAA0B,EAClC,aAAa,EAAE,MAAM,IAAI,EACzB,oBAAoB,EAAE,MAAM,GAC1B,OAAO,CAAC,OAAO,CAAC,CA+ClB"}
|
|
@@ -111,6 +111,23 @@ export async function readErrorBody(response, timeoutMs, maxBytes = 1024 * 1024)
|
|
|
111
111
|
return "";
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
// Resolve once the client response can accept more data again. Also resolves
|
|
115
|
+
// on close/error so a client that disconnects mid-backpressure cannot park the
|
|
116
|
+
// forwarder forever — the next reader.read() then observes the cancellation
|
|
117
|
+
// installed by the close handler.
|
|
118
|
+
function waitForDrain(res) {
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
const settle = () => {
|
|
121
|
+
res.off("drain", settle);
|
|
122
|
+
res.off("close", settle);
|
|
123
|
+
res.off("error", settle);
|
|
124
|
+
resolve();
|
|
125
|
+
};
|
|
126
|
+
res.once("drain", settle);
|
|
127
|
+
res.once("close", settle);
|
|
128
|
+
res.once("error", settle);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
114
131
|
export async function forwardStreamingResponse(upstream, res, status, onStreamError, streamStallTimeoutMs) {
|
|
115
132
|
status.streamsStarted += 1;
|
|
116
133
|
res.writeHead(upstream.status, responseHeadersForClient(upstream.headers));
|
|
@@ -132,7 +149,12 @@ export async function forwardStreamingResponse(upstream, res, status, onStreamEr
|
|
|
132
149
|
if (done)
|
|
133
150
|
break;
|
|
134
151
|
if (value && value.byteLength > 0) {
|
|
135
|
-
|
|
152
|
+
// Respect backpressure: when the client's socket buffer is full,
|
|
153
|
+
// pause upstream reads until it drains instead of buffering the
|
|
154
|
+
// whole stream in memory for a slow consumer.
|
|
155
|
+
if (!res.write(Buffer.from(value)) && !res.destroyed) {
|
|
156
|
+
await waitForDrain(res);
|
|
157
|
+
}
|
|
136
158
|
}
|
|
137
159
|
}
|
|
138
160
|
res.end();
|
package/dist/lib/rotation.d.ts
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
* Ported from antigravity-auth rotation logic for optimal account rotation
|
|
6
6
|
* when rate limits are encountered.
|
|
7
7
|
*/
|
|
8
|
-
export type { SelectionRecord, RoutingMutexMode, AsyncMutex, } from "./routing-mutex.js";
|
|
9
|
-
export { createAsyncMutex, getRoutingMutex, withRoutingMutex, } from "./routing-mutex.js";
|
|
10
8
|
export interface HealthScoreConfig {
|
|
11
9
|
/** Points added on successful request */
|
|
12
10
|
successDelta: number;
|
|
@@ -104,7 +102,6 @@ export interface HybridSelectionConfig {
|
|
|
104
102
|
/** Weight for freshness/last used (default: 2) */
|
|
105
103
|
freshnessWeight: number;
|
|
106
104
|
}
|
|
107
|
-
export declare const DEFAULT_HYBRID_SELECTION_CONFIG: HybridSelectionConfig;
|
|
108
105
|
/**
|
|
109
106
|
* Selects the best account using a hybrid scoring strategy.
|
|
110
107
|
*
|
|
@@ -231,4 +228,5 @@ export declare function exponentialBackoff(attempt: number, baseMs?: number, max
|
|
|
231
228
|
export declare function getHealthTracker(config?: Partial<HealthScoreConfig>): HealthScoreTracker;
|
|
232
229
|
export declare function getTokenTracker(config?: Partial<TokenBucketConfig>): TokenBucketTracker;
|
|
233
230
|
export declare function resetTrackers(): void;
|
|
231
|
+
export {};
|
|
234
232
|
//# sourceMappingURL=rotation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotation.d.ts","sourceRoot":"","sources":["../../lib/rotation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"rotation.d.ts","sourceRoot":"","sources":["../../lib/rotation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,MAAM,WAAW,iBAAiB;IACjC,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,sBAAsB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,2BAA2B,EAAE,iBAOzC,CAAC;AAQF,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAWlC;;;GAGG;AACH,qBAAa,kBAAkB;IAC9B,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,GAAE,OAAO,CAAC,iBAAiB,CAAM;IAInD,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,oBAAoB;IAO5B,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IA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A0B,CA2F5B;AAMD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,GAAE,MAAY,GAAG,MAAM,CAG5E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,MAAM,WAAW,yBAAyB;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAAC;AAC/E,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACnB,MAAM,CAAC;AA2DV,wBAAgB,gBAAgB,CAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACjC,kBAAkB,CAKpB;AAED,wBAAgB,eAAe,CAC9B,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACjC,kBAAkB,CAKpB;AAED,wBAAgB,aAAa,IAAI,IAAI,CAGpC"}
|
package/dist/lib/rotation.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* when rate limits are encountered.
|
|
7
7
|
*/
|
|
8
8
|
import { createLogger } from "./logger.js";
|
|
9
|
-
export { createAsyncMutex, getRoutingMutex, withRoutingMutex, } from "./routing-mutex.js";
|
|
10
9
|
const log = createLogger("rotation");
|
|
11
10
|
export const DEFAULT_HEALTH_SCORE_CONFIG = {
|
|
12
11
|
successDelta: 1,
|
|
@@ -261,7 +260,7 @@ export class TokenBucketTracker {
|
|
|
261
260
|
}
|
|
262
261
|
}
|
|
263
262
|
}
|
|
264
|
-
|
|
263
|
+
const DEFAULT_HYBRID_SELECTION_CONFIG = {
|
|
265
264
|
healthWeight: 2,
|
|
266
265
|
tokenWeight: 5,
|
|
267
266
|
freshnessWeight: 2.0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing-profiles.d.ts","sourceRoot":"","sources":["../../lib/routing-profiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routing-profiles.d.ts","sourceRoot":"","sources":["../../lib/routing-profiles.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IACnC,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/B;AAoGD,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAa5E;AAED,wBAAsB,uBAAuB,CAC5C,KAAK,EAAE,m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