@rynfar/meridian 1.57.0 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{cli-sz964j04.js → cli-5rkcyzzm.js} +141 -77
- package/dist/{cli-ngtexmne.js → cli-h6hfkg3s.js} +30 -2
- package/dist/{cli-aq5zz92m.js → cli-khhjyk04.js} +62 -3
- package/dist/{cli-bsg2dd52.js → cli-p3ggjwgn.js} +23 -2
- package/dist/{cli-340h1chz.js → cli-vj9cv18n.js} +11 -6
- package/dist/cli.js +8 -8
- package/dist/{profileCli-00z04stw.js → profileCli-c8bejc7w.js} +3 -3
- package/dist/{profiles-sq9t3fh9.js → profiles-3rg4x7cz.js} +2 -2
- package/dist/proxy/models.d.ts +2 -0
- package/dist/proxy/models.d.ts.map +1 -1
- package/dist/proxy/openaiResponses.d.ts +4 -2
- package/dist/proxy/openaiResponses.d.ts.map +1 -1
- package/dist/proxy/rateLimitStore.d.ts +26 -22
- package/dist/proxy/rateLimitStore.d.ts.map +1 -1
- package/dist/proxy/routing.d.ts +24 -1
- package/dist/proxy/routing.d.ts.map +1 -1
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/proxy/session/cache.d.ts.map +1 -1
- package/dist/proxy/session/fingerprint.d.ts +26 -0
- package/dist/proxy/session/fingerprint.d.ts.map +1 -1
- package/dist/proxy/session/lineage.d.ts +15 -9
- package/dist/proxy/session/lineage.d.ts.map +1 -1
- package/dist/proxy/settings.d.ts.map +1 -1
- package/dist/proxy/tokenRefresh.d.ts +41 -0
- package/dist/proxy/tokenRefresh.d.ts.map +1 -1
- package/dist/server.js +5 -5
- package/dist/{tokenRefresh-tkeg8wjq.js → tokenRefresh-kzz08kea.js} +10 -2
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setSetting
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-vj9cv18n.js";
|
|
4
4
|
import {
|
|
5
5
|
createPlatformCredentialStore
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-khhjyk04.js";
|
|
7
7
|
import {
|
|
8
8
|
__esm
|
|
9
9
|
} from "./cli-p9swy5t3.js";
|
|
@@ -77,6 +77,13 @@ var lastKnownGoodAuthStatus = null;
|
|
|
77
77
|
var cachedAuthStatusAt = 0;
|
|
78
78
|
var cachedAuthStatusIsFailure = false;
|
|
79
79
|
var cachedAuthStatusPromise = null;
|
|
80
|
+
var warnedTierOverrides = new Set;
|
|
81
|
+
function warnUnrecognizedTierOverride(varName, raw, tierBase) {
|
|
82
|
+
if (warnedTierOverrides.has(varName))
|
|
83
|
+
return;
|
|
84
|
+
warnedTierOverrides.add(varName);
|
|
85
|
+
console.warn(`[PROXY] Unrecognized MERIDIAN_${varName} value "${raw}"; expected "${tierBase}" or "${tierBase}[1m]" — ignoring, ${tierBase}[1m] remains the default`);
|
|
86
|
+
}
|
|
80
87
|
function supports1mContext(model) {
|
|
81
88
|
const override = env("1M_CONTEXT_SUPPORT");
|
|
82
89
|
if (override === "0" || override === "false" || override === "no")
|
|
@@ -91,11 +98,25 @@ function mapModelToClaudeModel(model, subscriptionType, agentMode) {
|
|
|
91
98
|
const use1m = supports1mContext(model);
|
|
92
99
|
const isSubagent = agentMode === "subagent";
|
|
93
100
|
if (model.includes("fable") || model.includes("mythos")) {
|
|
101
|
+
const fableOverrideRaw = env("FABLE_MODEL");
|
|
102
|
+
const fableOverride = fableOverrideRaw?.trim().toLowerCase();
|
|
103
|
+
if (fableOverride === "fable")
|
|
104
|
+
return "fable";
|
|
105
|
+
if (fableOverrideRaw && fableOverride !== "fable[1m]") {
|
|
106
|
+
warnUnrecognizedTierOverride("FABLE_MODEL", fableOverrideRaw, "fable");
|
|
107
|
+
}
|
|
94
108
|
if (use1m && !isSubagent && !isExtendedContextKnownUnavailable())
|
|
95
109
|
return "fable[1m]";
|
|
96
110
|
return "fable";
|
|
97
111
|
}
|
|
98
112
|
if (model.includes("opus")) {
|
|
113
|
+
const opusOverrideRaw = env("OPUS_MODEL");
|
|
114
|
+
const opusOverride = opusOverrideRaw?.trim().toLowerCase();
|
|
115
|
+
if (opusOverride === "opus")
|
|
116
|
+
return "opus";
|
|
117
|
+
if (opusOverrideRaw && opusOverride !== "opus[1m]") {
|
|
118
|
+
warnUnrecognizedTierOverride("OPUS_MODEL", opusOverrideRaw, "opus");
|
|
119
|
+
}
|
|
99
120
|
if (use1m && !isSubagent && !isExtendedContextKnownUnavailable())
|
|
100
121
|
return "opus[1m]";
|
|
101
122
|
return "opus";
|
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
3
3
|
import { join, dirname } from "node:path";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
|
|
5
|
+
function settingsFile() {
|
|
6
|
+
const override = process.env.MERIDIAN_CONFIG_DIR;
|
|
7
|
+
return override ? join(override, "settings.json") : join(homedir(), ".config", "meridian", "settings.json");
|
|
8
|
+
}
|
|
6
9
|
function loadSettings() {
|
|
10
|
+
const file = settingsFile();
|
|
7
11
|
try {
|
|
8
|
-
if (!existsSync(
|
|
12
|
+
if (!existsSync(file))
|
|
9
13
|
return {};
|
|
10
|
-
return JSON.parse(readFileSync(
|
|
14
|
+
return JSON.parse(readFileSync(file, "utf-8"));
|
|
11
15
|
} catch {
|
|
12
16
|
return {};
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
function saveSettings(updates) {
|
|
20
|
+
const file = settingsFile();
|
|
16
21
|
const current = loadSettings();
|
|
17
22
|
const merged = { ...current, ...updates };
|
|
18
23
|
try {
|
|
19
|
-
mkdirSync(dirname(
|
|
20
|
-
writeFileSync(
|
|
24
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
25
|
+
writeFileSync(file, JSON.stringify(merged, null, 2) + `
|
|
21
26
|
`, { mode: 384 });
|
|
22
27
|
} catch (err) {
|
|
23
|
-
console.warn(`[meridian] Failed to write ${
|
|
28
|
+
console.warn(`[meridian] Failed to write ${file}: ${err instanceof Error ? err.message : err}`);
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
31
|
function getSetting(key) {
|
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
startProxyServer
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-5rkcyzzm.js";
|
|
5
|
+
import"./cli-h6hfkg3s.js";
|
|
6
6
|
import"./cli-sry5aqdj.js";
|
|
7
7
|
import"./cli-xmweegb1.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveClaudeExecutableAsync
|
|
10
|
-
} from "./cli-
|
|
11
|
-
import"./cli-
|
|
10
|
+
} from "./cli-p3ggjwgn.js";
|
|
11
|
+
import"./cli-vj9cv18n.js";
|
|
12
12
|
import"./cli-je60fevk.js";
|
|
13
|
-
import"./cli-
|
|
13
|
+
import"./cli-khhjyk04.js";
|
|
14
14
|
import {
|
|
15
15
|
__require
|
|
16
16
|
} from "./cli-p9swy5t3.js";
|
|
@@ -55,7 +55,7 @@ See https://github.com/rynfar/meridian for full documentation.`);
|
|
|
55
55
|
process.exit(0);
|
|
56
56
|
}
|
|
57
57
|
if (args[0] === "profile") {
|
|
58
|
-
const { profileAdd, profileAddOauthToken, profileList, profileRemove, profileSwitch, profileLogin, profileHelp } = await import("./profileCli-
|
|
58
|
+
const { profileAdd, profileAddOauthToken, profileList, profileRemove, profileSwitch, profileLogin, profileHelp } = await import("./profileCli-c8bejc7w.js");
|
|
59
59
|
const subcommand = args[1];
|
|
60
60
|
const profileId = args[2];
|
|
61
61
|
const headless = args.includes("--headless");
|
|
@@ -113,7 +113,7 @@ Restart OpenCode for the plugin to take effect.`);
|
|
|
113
113
|
process.exit(0);
|
|
114
114
|
}
|
|
115
115
|
if (args[0] === "refresh-token") {
|
|
116
|
-
const { refreshOAuthToken } = await import("./tokenRefresh-
|
|
116
|
+
const { refreshOAuthToken } = await import("./tokenRefresh-kzz08kea.js");
|
|
117
117
|
const success = await refreshOAuthToken();
|
|
118
118
|
if (success) {
|
|
119
119
|
console.log("Token refreshed successfully");
|
|
@@ -171,7 +171,7 @@ async function runCli(start = startProxyServer, runAuthCheck = async () => {
|
|
|
171
171
|
console.error("\x1B[33m⚠ Could not verify Claude auth status. If requests fail, run: claude login\x1B[0m");
|
|
172
172
|
}
|
|
173
173
|
if (!profiles) {
|
|
174
|
-
const { enableDiskProfileDiscovery } = await import("./profiles-
|
|
174
|
+
const { enableDiskProfileDiscovery } = await import("./profiles-3rg4x7cz.js");
|
|
175
175
|
enableDiskProfileDiscovery();
|
|
176
176
|
}
|
|
177
177
|
const proxy = await start({ port, host, idleTimeoutSeconds, pluginDir, pluginConfigPath, profiles, defaultProfile, version, installProcessErrorHandlers: true });
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
profileLogin,
|
|
14
14
|
profileRemove,
|
|
15
15
|
profileSwitch
|
|
16
|
-
} from "./cli-
|
|
17
|
-
import"./cli-
|
|
18
|
-
import"./cli-
|
|
16
|
+
} from "./cli-p3ggjwgn.js";
|
|
17
|
+
import"./cli-vj9cv18n.js";
|
|
18
|
+
import"./cli-khhjyk04.js";
|
|
19
19
|
import"./cli-p9swy5t3.js";
|
|
20
20
|
export {
|
|
21
21
|
profileSwitch,
|
package/dist/proxy/models.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export interface ClaudeAuthStatus {
|
|
|
52
52
|
subscriptionType?: string;
|
|
53
53
|
email?: string;
|
|
54
54
|
}
|
|
55
|
+
/** Clear the per-variable warn-once tracking — for testing only. */
|
|
56
|
+
export declare function resetWarnedTierOverrides(): void;
|
|
55
57
|
export declare function mapModelToClaudeModel(model: string, subscriptionType?: string | null, agentMode?: string | null): ClaudeModel;
|
|
56
58
|
/**
|
|
57
59
|
* Record that Extra Usage is not enabled on this subscription.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/proxy/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAA;AAEzG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,mBAAmB,CAAA;AACrD,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AACnD,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AACvD,eAAO,MAAM,qBAAqB,qBAAqB,CAAA;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAM3F;AACD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/proxy/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAA;AAEzG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,mBAAmB,CAAA;AACrD,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AACnD,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AACvD,eAAO,MAAM,qBAAqB,qBAAqB,CAAA;AAEvD;;;;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AG,IAAI,CAE7E;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,MAAM,CAAC,CAqBpE;AAED,2CAA2C;AAC3C,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAED,kDAAkD;AAClD,wBAAgB,2BAA2B,IAAI,IAAI,CAOlD;AAED;;6DAE6D;AAC7D,wBAAgB,qBAAqB,IAAI,IAAI,CAO5C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG/D"}
|
|
@@ -24,9 +24,11 @@ interface ResponsesContentPart {
|
|
|
24
24
|
image_url?: string;
|
|
25
25
|
}
|
|
26
26
|
interface ResponsesMessageItem {
|
|
27
|
-
|
|
27
|
+
/** Optional per the spec — `EasyInputMessage` requires only `role`. */
|
|
28
|
+
type?: "message";
|
|
28
29
|
role: "user" | "assistant" | "developer" | "system";
|
|
29
|
-
|
|
30
|
+
/** Also optional per the spec: `EasyInputMessage` requires only `role`. */
|
|
31
|
+
content?: ResponsesContentPart[] | string;
|
|
30
32
|
}
|
|
31
33
|
interface ResponsesFunctionCallItem {
|
|
32
34
|
type: "function_call";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openaiResponses.d.ts","sourceRoot":"","sources":["../../src/proxy/openaiResponses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,UAAU,CAAA;AAOjB,UAAU,oBAAoB;IAC5B,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,aAAa,GAAG,MAAM,CAAA;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"openaiResponses.d.ts","sourceRoot":"","sources":["../../src/proxy/openaiResponses.ts"],"names":[],"mappings":"AAAA;;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AAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;IAC5D,aAAa,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAC9E,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACxG,KAAK,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,YAAY,IA0CpD,OAAO,iBAAiB,KAAG,oBAAoB,EAAE,CAsI1D"}
|
|
@@ -27,13 +27,16 @@
|
|
|
27
27
|
* in memory. State resets on proxy restart — that's fine because the SDK will
|
|
28
28
|
* push a fresh event on the next request.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
30
|
+
* Entries are scoped per profile. Each profile is a separate Claude Max
|
|
31
|
+
* subscription with separate quotas, so a flat store would let one account's
|
|
32
|
+
* reset time be read as another's — which is exactly how priority routing
|
|
33
|
+
* (`routing: "priority"`) mis-derived exhaustion cooldowns before this was
|
|
34
|
+
* scoped. Every read names its profile explicitly; single-profile setups
|
|
35
|
+
* simply use the literal `"default"` key.
|
|
36
|
+
*
|
|
37
|
+
* `clear(profileId)` drops one account (wired into `POST /auth/refresh`,
|
|
38
|
+
* which re-authenticates one credential); `clear()` drops everything and is
|
|
39
|
+
* used by tests.
|
|
37
40
|
*/
|
|
38
41
|
import type { SDKRateLimitInfo } from "@anthropic-ai/claude-agent-sdk";
|
|
39
42
|
export interface RateLimitEntry extends SDKRateLimitInfo {
|
|
@@ -43,29 +46,30 @@ export interface RateLimitEntry extends SDKRateLimitInfo {
|
|
|
43
46
|
/** Type discriminator for the entry's bucket key. */
|
|
44
47
|
export type RateLimitBucketKey = NonNullable<SDKRateLimitInfo["rateLimitType"]> | "default";
|
|
45
48
|
declare class RateLimitStore {
|
|
46
|
-
|
|
49
|
+
/** profileId -> (bucket key -> entry). One inner map per configured profile. */
|
|
50
|
+
private byProfile;
|
|
47
51
|
/**
|
|
48
|
-
* Record a rate-limit info snapshot.
|
|
49
|
-
* Last-write-wins per
|
|
50
|
-
* same
|
|
52
|
+
* Record a rate-limit info snapshot for a specific profile.
|
|
53
|
+
* Last-write-wins per (profileId, rateLimitType). Older entries for the
|
|
54
|
+
* same pair are overwritten — clients should treat the latest as canonical.
|
|
51
55
|
*
|
|
52
56
|
* `observedAt` defaults to the current wall clock but may be supplied
|
|
53
57
|
* explicitly so callers (and tests) can control the capture timestamp used
|
|
54
58
|
* for newest-first ordering in {@link getAll}.
|
|
55
59
|
*/
|
|
56
|
-
record(info: SDKRateLimitInfo | undefined | null, observedAt?: number): void;
|
|
57
|
-
/** Snapshot
|
|
58
|
-
getAll(): RateLimitEntry[];
|
|
59
|
-
/** Snapshot a single bucket, or undefined if not yet seen. */
|
|
60
|
-
get(key: RateLimitBucketKey): RateLimitEntry | undefined;
|
|
61
|
-
/**
|
|
62
|
-
|
|
60
|
+
record(profileId: string, info: SDKRateLimitInfo | undefined | null, observedAt?: number): void;
|
|
61
|
+
/** Snapshot one profile's entries, newest-first by observedAt. */
|
|
62
|
+
getAll(profileId: string): RateLimitEntry[];
|
|
63
|
+
/** Snapshot a single bucket for one profile, or undefined if not yet seen. */
|
|
64
|
+
get(profileId: string, key: RateLimitBucketKey): RateLimitEntry | undefined;
|
|
65
|
+
/** Bucket count for one profile, or across all profiles when omitted. */
|
|
66
|
+
size(profileId?: string): number;
|
|
63
67
|
/**
|
|
64
|
-
* Drop
|
|
65
|
-
* `POST /auth/refresh`
|
|
66
|
-
* stale
|
|
68
|
+
* Drop stored entries for one profile, or every profile when `profileId`
|
|
69
|
+
* is omitted. Wired into the `POST /auth/refresh` handler so a refreshed
|
|
70
|
+
* credential's stale quotas can't linger. Also used by tests for isolation.
|
|
67
71
|
*/
|
|
68
|
-
clear(): void;
|
|
72
|
+
clear(profileId?: string): void;
|
|
69
73
|
}
|
|
70
74
|
/**
|
|
71
75
|
* Process-wide singleton. Importers should always use this instance — do
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimitStore.d.ts","sourceRoot":"","sources":["../../src/proxy/rateLimitStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rateLimitStore.d.ts","sourceRoot":"","sources":["../../src/proxy/rateLimitStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,qDAAqD;AACrD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GAAG,SAAS,CAAA;AAE3F,cAAM,cAAc;IAClB,gFAAgF;IAChF,OAAO,CAAC,SAAS,CAA6D;IAE9E;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,EAAE,UAAU,GAAE,MAAmB,GAAG,IAAI;IAW3G,kEAAkE;IAClE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,EAAE;IAM3C,8EAA8E;IAC9E,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,GAAG,cAAc,GAAG,SAAS;IAI3E,yEAAyE;IACzE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAOhC;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;CAIhC;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,gBAAuB,CAAA;AAElD,wCAAwC;AACxC,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,CAAA"}
|
package/dist/proxy/routing.d.ts
CHANGED
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
* Default mode is "active" (the pre-#383 chain) — existing setups are
|
|
18
18
|
* byte-identical unless routing is explicitly enabled.
|
|
19
19
|
*
|
|
20
|
-
* This is a leaf module —
|
|
20
|
+
* This is a leaf module — no I/O. Most functions here are pure; the
|
|
21
|
+
* exhaustion/assignment trackers below hold mutable in-memory state (by
|
|
22
|
+
* design — see their own doc comments) but still perform no I/O.
|
|
21
23
|
*/
|
|
22
24
|
export type RoutingMode = "active" | "sticky" | "priority";
|
|
23
25
|
/**
|
|
@@ -82,4 +84,25 @@ export declare class ProfileExhaustion {
|
|
|
82
84
|
/** Live entries only — expired marks are dropped on read. */
|
|
83
85
|
snapshot(): ExhaustionEntry[];
|
|
84
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Session-to-profile assignments with LRU eviction.
|
|
89
|
+
*
|
|
90
|
+
* A JS Map preserves insertion order and a bare `set()` on an EXISTING key
|
|
91
|
+
* does not reorder it — so a plain map evicts first-inserted, which drops a
|
|
92
|
+
* long-lived active conversation ahead of a newer idle one. Both read and
|
|
93
|
+
* write therefore delete-then-set to refresh recency.
|
|
94
|
+
*
|
|
95
|
+
* Deliberately not persisted: this is routing hygiene, not durable truth.
|
|
96
|
+
* After a restart the next request re-establishes the assignment.
|
|
97
|
+
*/
|
|
98
|
+
export declare class AssignmentStore {
|
|
99
|
+
private readonly max;
|
|
100
|
+
private readonly entries;
|
|
101
|
+
constructor(max: number);
|
|
102
|
+
/** Read an assignment, marking it most-recently-used. */
|
|
103
|
+
get(key: string): string | undefined;
|
|
104
|
+
/** Write an assignment, marking it most-recently-used and evicting if over capacity. */
|
|
105
|
+
set(key: string, value: string): void;
|
|
106
|
+
get size(): number;
|
|
107
|
+
}
|
|
85
108
|
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/proxy/routing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/proxy/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;AAE1D;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAKnE;AAaD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAYvG;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,CAAC,CAM/F,CAAA;AAOD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,SAAS,MAAM,EAAE,E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"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AAGvD,YAAY,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAkDnG,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EAEpB,KAAK,aAAa,EAGnB,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AAGvD,YAAY,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAkDnG,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EAEpB,KAAK,aAAa,EAGnB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EAA+B,iBAAiB,EAAE,mBAAmB,EAAsC,MAAM,iBAAiB,CAAA;AAGzI,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,CAAA;AAgR7B,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CA0/HhF;AAWD,wBAAgB,gCAAgC,IAAI,IAAI,CAavD;AAED,wBAAsB,gBAAgB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAmGhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,WAAW,CAAA;AAMlB,wBAAgB,mBAAmB,IAAI,MAAM,CAW5C;AAqCD;kGACkG;AAClG,wBAAgB,iBAAiB,SAYhC;AAED;iFACiF;AACjF,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,gBAAgB,CAAC,EAAE,MAAM,EACzB,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,GAC/C,IAAI,CAoBN;AAkCD;;uDAEuD;AACvD,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,EAC/C,gBAAgB,CAAC,EAAE,MAAM,GACxB,aAAa,CAuDf;AAED;;uFAEuF;AACvF,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CA2BtF;AAED;;;yFAGyF;AACzF,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,EACnD,eAAe,EAAE,MAAM,EACvB,gBAAgB,CAAC,EAAE,MAAM,EACzB,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,EACtC,YAAY,CAAC,EAAE,UAAU,QAoC1B"}
|
|
@@ -28,4 +28,30 @@ export declare function getConversationFingerprint(messages: Array<{
|
|
|
28
28
|
role: string;
|
|
29
29
|
content: any;
|
|
30
30
|
}>, workingDirectory?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Key a conversation for priority-pool assignment.
|
|
33
|
+
*
|
|
34
|
+
* An explicit session id always wins — keyed clients behave exactly as before.
|
|
35
|
+
* Without one, the conversation fingerprint stands in, which is what gives
|
|
36
|
+
* keyless clients pool affinity: Pylon's main process deliberately sends no
|
|
37
|
+
* session key (its provider headers are per-process, so one key would merge
|
|
38
|
+
* every open chat into a single meridian session), and without a fallback
|
|
39
|
+
* such a conversation re-picks its account every turn — bouncing back to the
|
|
40
|
+
* preferred profile the moment its cooldown expires and replaying its whole
|
|
41
|
+
* history against a cold cache.
|
|
42
|
+
*
|
|
43
|
+
* The `fp:` prefix namespaces fingerprint-derived keys so they can never
|
|
44
|
+
* collide with a real session id. An empty fingerprint returns null rather
|
|
45
|
+
* than inventing a key, preserving today's no-affinity behavior for requests
|
|
46
|
+
* we cannot identify.
|
|
47
|
+
*
|
|
48
|
+
* NOTE: this is only ever an ACCOUNT key, never a session key. Two unrelated
|
|
49
|
+
* conversations that share a first message and working directory will share
|
|
50
|
+
* an assignment — that costs nothing, because it selects a profile and never
|
|
51
|
+
* a resumable SDK session.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getPriorityAssignmentKey(sessionId: string | undefined, messages: Array<{
|
|
54
|
+
role: string;
|
|
55
|
+
content: any;
|
|
56
|
+
}>, workingDirectory?: string): string | null;
|
|
31
57
|
//# sourceMappingURL=fingerprint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAc9D;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAW7H"}
|
|
1
|
+
{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAc9D;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAW7H;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,EAC/C,gBAAgB,CAAC,EAAE,MAAM,GACxB,MAAM,GAAG,IAAI,CAIf"}
|
|
@@ -49,9 +49,12 @@ export interface SessionState {
|
|
|
49
49
|
export type LineageResult = {
|
|
50
50
|
type: "continuation";
|
|
51
51
|
session: SessionState;
|
|
52
|
+
resumeFrom: number;
|
|
52
53
|
} | {
|
|
53
54
|
type: "compaction";
|
|
54
55
|
session: SessionState;
|
|
56
|
+
resumeFrom: number;
|
|
57
|
+
suffixOverlap: number;
|
|
55
58
|
} | {
|
|
56
59
|
type: "undo";
|
|
57
60
|
session: SessionState;
|
|
@@ -59,7 +62,10 @@ export type LineageResult = {
|
|
|
59
62
|
rollbackUuid: string | undefined;
|
|
60
63
|
} | {
|
|
61
64
|
type: "diverged";
|
|
65
|
+
reason: LineageDivergenceReason;
|
|
66
|
+
prefixOverlap?: number;
|
|
62
67
|
};
|
|
68
|
+
export type LineageDivergenceReason = "unverifiable" | "replayed-request" | "modified-history" | "unrelated-history" | "not-found" | "independent-request" | "missing-session-header";
|
|
63
69
|
/**
|
|
64
70
|
* Compute a lineage hash of an ordered message array.
|
|
65
71
|
* Used as a fast-path check: if the aggregate hash matches, the messages
|
|
@@ -117,22 +123,22 @@ export declare function measurePrefixOverlap(storedHashes: string[], incomingHas
|
|
|
117
123
|
* contiguity.
|
|
118
124
|
*/
|
|
119
125
|
export declare function measureSuffixOverlap(storedHashes: string[], incomingHashes: string[]): number;
|
|
120
|
-
/** Cache-like interface for verifyLineage — only needs get/set/delete */
|
|
121
|
-
export interface SessionCacheLike {
|
|
122
|
-
delete(key: string): boolean;
|
|
123
|
-
}
|
|
124
126
|
/**
|
|
125
127
|
* Verify that incoming messages are a valid continuation of a cached session.
|
|
126
128
|
* Uses per-message hash comparison to deterministically classify mutations.
|
|
129
|
+
* This function is deliberately side-effect free: it never mutates the cached
|
|
130
|
+
* state. The caller commits new hashes/counts only after the upstream request
|
|
131
|
+
* succeeds.
|
|
127
132
|
*
|
|
128
133
|
* Decision matrix:
|
|
129
|
-
* Full prefix match (fast-path) → continuation (resume
|
|
130
|
-
* Suffix overlap >= MIN_SUFFIX → compaction (resume
|
|
131
|
-
* Prefix overlap > 0, no suffix
|
|
132
|
-
*
|
|
134
|
+
* Full prefix match (fast-path) → continuation (resume from stored count)
|
|
135
|
+
* Suffix overlap >= MIN_SUFFIX → compaction (resume after matched suffix)
|
|
136
|
+
* Prefix overlap > 0, no suffix, shrank → undo (fork at rollback point)
|
|
137
|
+
* Cached prefix changed while growing → diverged (fresh full-history replay)
|
|
138
|
+
* No overlap → diverged (fresh full-history replay)
|
|
133
139
|
*/
|
|
134
140
|
export declare function verifyLineage(cached: SessionState, messages: Array<{
|
|
135
141
|
role: string;
|
|
136
142
|
content: any;
|
|
137
|
-
}
|
|
143
|
+
}>): LineageResult;
|
|
138
144
|
//# sourceMappingURL=lineage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/lineage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/lineage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,2BAA2B,CAAC,EAAE,MAAM,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,kFAAkF;AAClF,MAAM,WAAW,UAAW,SAAQ,mBAAmB;IACrD,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;CACnC;AAED;;6DAE6D;AAC7D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,CAG5E;AAED;0EAC0E;AAC1E,eAAO,MAAM,yBAAyB,IAAI,CAAA;AAE1C,MAAM,WAAW,YAAY;IAC3B,eAA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,OAAO,EAAE,GAAG,CAAA;CAAE,GAAG,MAAM,CAK3E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,GAAG,MAAM,EAAE,CAG9F;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ7F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,CA6B7F;AAyBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,GAC9C,aAAa,CA4Gf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/proxy/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/proxy/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;8EAC0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;gFAC4E;IAC5E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAED,yFAAyF;AACzF,wBAAgB,YAAY,IAAI,gBAAgB,CAQ/C;AAED,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAUrE;AAED,iCAAiC;AACjC,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAExF;AAED,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAErG"}
|
|
@@ -29,6 +29,16 @@ interface OAuthCredentials {
|
|
|
29
29
|
accessToken: string;
|
|
30
30
|
refreshToken: string;
|
|
31
31
|
expiresAt: number;
|
|
32
|
+
/**
|
|
33
|
+
* When the *refresh* token itself stops working — i.e. when the login dies
|
|
34
|
+
* and an interactive `claude login` becomes mandatory. Written by the CLI at
|
|
35
|
+
* login; optional because nothing guarantees its presence.
|
|
36
|
+
*
|
|
37
|
+
* Distinct from `expiresAt`, which is the ~8h access-token lifetime that the
|
|
38
|
+
* background scheduler rolls on its own. No amount of refreshing extends
|
|
39
|
+
* this one unless Anthropic hands back a new value (see `doRefresh`).
|
|
40
|
+
*/
|
|
41
|
+
refreshTokenExpiresAt?: number;
|
|
32
42
|
scopes?: string[];
|
|
33
43
|
subscriptionType?: string;
|
|
34
44
|
rateLimitTier?: string;
|
|
@@ -94,6 +104,37 @@ export declare function refreshOAuthToken(store?: CredentialStore): Promise<bool
|
|
|
94
104
|
* refresh-on-401 path if Anthropic rejects it.
|
|
95
105
|
*/
|
|
96
106
|
export declare function ensureFreshToken(store?: CredentialStore, bufferMs?: number): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Default warning window before the login dies, in days.
|
|
109
|
+
*
|
|
110
|
+
* Three, matching the CLI's own `tff` constant — the window outside which it
|
|
111
|
+
* suppresses the expiry tip entirely. The login only lasts 30 days, so a wider
|
|
112
|
+
* window would spend a tenth of every cycle in the alerting state and train
|
|
113
|
+
* the alert to be ignored. Override with MERIDIAN_AUTH_RENEWAL_WARN_DAYS.
|
|
114
|
+
*/
|
|
115
|
+
export declare const DEFAULT_RENEWAL_WARN_DAYS = 3;
|
|
116
|
+
/**
|
|
117
|
+
* Parse the MERIDIAN_AUTH_RENEWAL_WARN_DAYS window, falling back to the
|
|
118
|
+
* default for anything unusable.
|
|
119
|
+
*
|
|
120
|
+
* An explicit finite check rather than `Number(raw) || DEFAULT`: `0` is a
|
|
121
|
+
* legitimate setting — warn only once the login has actually lapsed — and the
|
|
122
|
+
* shortcut would swallow it as falsy. Negative windows are rejected too; they
|
|
123
|
+
* would mean "warn only after the login has been dead for N days", which no
|
|
124
|
+
* monitor wants.
|
|
125
|
+
*/
|
|
126
|
+
export declare function resolveRenewalWarnDays(raw: string | undefined): number;
|
|
127
|
+
export interface AuthRenewalStatus {
|
|
128
|
+
/** Epoch ms the refresh token stops working, when known. */
|
|
129
|
+
refreshTokenExpiresAt?: number;
|
|
130
|
+
/** Whole days until then. Negative once it has passed. */
|
|
131
|
+
daysUntilRenewal?: number;
|
|
132
|
+
/** True once inside the warning window — the field monitors should alert on. */
|
|
133
|
+
renewalRequiredSoon: boolean;
|
|
134
|
+
}
|
|
135
|
+
/** Drop cached refresh-token expiries — for tests, and after a re-login. */
|
|
136
|
+
export declare function resetAuthRenewalCache(): void;
|
|
137
|
+
export declare function getAuthRenewalStatus(store?: CredentialStore, warnDays?: number): Promise<AuthRenewalStatus>;
|
|
97
138
|
/**
|
|
98
139
|
* Start a self-rescheduling timer that refreshes the access token shortly
|
|
99
140
|
* before each expiry — regardless of incoming traffic.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenRefresh.d.ts","sourceRoot":"","sources":["../../src/proxy/tokenRefresh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAkBH;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,gEAAgE;AAChE,wBAAgB,0BAA0B,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OG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAA;AAE1C;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGtE;AAED,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gFAAgF;IAChF,mBAAmB,EAAE,OAAO,CAAA;CAC7B;AA6BD,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AA2CD,wBAAsB,oBAAoB,CACxC,KAAK,CAAC,EAAE,eAAe,EACvB,QAAQ,SAA4B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAkB5B;AAiBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,EAAE,eAAe,EACvB,QAAQ,SAAgB,EACxB,cAAc,SAAgB,GAC7B,IAAI,CAKN;AAED,iDAAiD;AACjD,wBAAgB,qBAAqB,IAAI,IAAI,CAK5C;AAoED,wBAAwB;AACxB,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD;AAED,gDAAgD;AAChD,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
package/dist/server.js
CHANGED
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
runObserveHook,
|
|
12
12
|
runTransformHook,
|
|
13
13
|
startProxyServer
|
|
14
|
-
} from "./cli-
|
|
15
|
-
import"./cli-
|
|
14
|
+
} from "./cli-5rkcyzzm.js";
|
|
15
|
+
import"./cli-h6hfkg3s.js";
|
|
16
16
|
import"./cli-sry5aqdj.js";
|
|
17
17
|
import"./cli-xmweegb1.js";
|
|
18
|
-
import"./cli-
|
|
19
|
-
import"./cli-
|
|
18
|
+
import"./cli-p3ggjwgn.js";
|
|
19
|
+
import"./cli-vj9cv18n.js";
|
|
20
20
|
import"./cli-je60fevk.js";
|
|
21
|
-
import"./cli-
|
|
21
|
+
import"./cli-khhjyk04.js";
|
|
22
22
|
import"./cli-p9swy5t3.js";
|
|
23
23
|
export {
|
|
24
24
|
startProxyServer,
|
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DEFAULT_RENEWAL_WARN_DAYS,
|
|
2
3
|
configDirToCredentialsFile,
|
|
3
4
|
configDirToKeychainService,
|
|
4
5
|
createPlatformCredentialStore,
|
|
5
6
|
credentialsFilePathForProfile,
|
|
6
7
|
ensureFreshToken,
|
|
8
|
+
getAuthRenewalStatus,
|
|
7
9
|
isBackgroundRefreshActive,
|
|
8
10
|
refreshOAuthToken,
|
|
11
|
+
resetAuthRenewalCache,
|
|
9
12
|
resetInflightRefresh,
|
|
13
|
+
resolveRenewalWarnDays,
|
|
10
14
|
serializeCredentials,
|
|
11
15
|
startBackgroundRefresh,
|
|
12
16
|
stopBackgroundRefresh
|
|
13
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-khhjyk04.js";
|
|
14
18
|
import"./cli-p9swy5t3.js";
|
|
15
19
|
export {
|
|
16
20
|
stopBackgroundRefresh,
|
|
17
21
|
startBackgroundRefresh,
|
|
18
22
|
serializeCredentials,
|
|
23
|
+
resolveRenewalWarnDays,
|
|
19
24
|
resetInflightRefresh,
|
|
25
|
+
resetAuthRenewalCache,
|
|
20
26
|
refreshOAuthToken,
|
|
21
27
|
isBackgroundRefreshActive,
|
|
28
|
+
getAuthRenewalStatus,
|
|
22
29
|
ensureFreshToken,
|
|
23
30
|
credentialsFilePathForProfile,
|
|
24
31
|
createPlatformCredentialStore,
|
|
25
32
|
configDirToKeychainService,
|
|
26
|
-
configDirToCredentialsFile
|
|
33
|
+
configDirToCredentialsFile,
|
|
34
|
+
DEFAULT_RENEWAL_WARN_DAYS
|
|
27
35
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rynfar/meridian",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "Local Anthropic API powered by your Claude Max subscription. One subscription, every agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"proxy": "./bin/claude-proxy-supervisor.sh",
|
|
24
24
|
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && bun build bin/cli.ts src/proxy/server.ts --outdir dist --target node --splitting --external @anthropic-ai/claude-agent-sdk --external jsonc-parser --entry-naming \"[name].js\" && tsc -p tsconfig.build.json",
|
|
25
25
|
"postbuild": "node scripts/fix-bun-exports.mjs && node --check dist/cli.js && node --check dist/server.js && node -e \"if(!require('fs').existsSync('dist/proxy/server.d.ts'))process.exit(1)\"",
|
|
26
|
-
"postinstall": "node
|
|
26
|
+
"postinstall": "node -e \"try{require('child_process').spawnSync(process.execPath,[require.resolve('@anthropic-ai/claude-code/install.cjs')],{stdio:'inherit'})}catch(e){console.error('[meridian] claude-code postinstall skipped:',e.message)}\"",
|
|
27
27
|
"prepublishOnly": "bun run build",
|
|
28
28
|
"test": "bun test --path-ignore-patterns '**/*session-store*' --path-ignore-patterns '**/*proxy-async-ops*' --path-ignore-patterns '**/*models-auth-status*' --path-ignore-patterns '**/*proxy-context-usage-store*' --path-ignore-patterns '**/*proxy-passthrough-thinking*' --path-ignore-patterns '**/*proxy-thinking-setting*' --path-ignore-patterns '**/*session-recovery*' --path-ignore-patterns '**/*models.test*' && bun test src/__tests__/proxy-async-ops.test.ts && bun test src/__tests__/proxy-session-store.test.ts && bun test src/__tests__/session-store-pruning.test.ts && bun test src/__tests__/proxy-session-store-locking.test.ts && bun test src/__tests__/proxy-context-usage-store.test.ts && bun test src/__tests__/models-auth-status.test.ts && bun test src/__tests__/proxy-passthrough-thinking.test.ts && bun test src/__tests__/proxy-session-recovery.test.ts && bun test src/__tests__/proxy-thinking-setting.test.ts && bun test src/__tests__/models.test.ts",
|
|
29
29
|
"nix:lock": "bun2nix -o bun.nix",
|