@rynfar/meridian 1.62.6 → 1.63.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/bin/meridian-launchd.sh +128 -0
- package/dist/{cli-xmweegb1.js → cli-8yp89fan.js} +52 -0
- package/dist/{cli-wxk8xvd3.js → cli-hdyptm7z.js} +4934 -769
- package/dist/{cli-d45dq9gf.js → cli-xfbhn15a.js} +31 -10
- package/dist/cli.js +4 -4
- package/dist/{pluginPage-03q5j753.js → pluginPage-n3gdtbmj.js} +1 -1
- package/dist/{profileCli-7f6yhakj.js → profileCli-39vshwdn.js} +1 -1
- package/dist/{profilePage-gtazq15d.js → profilePage-vfj2dbhn.js} +1 -1
- package/dist/proxy/adapter.d.ts +13 -0
- package/dist/proxy/adapter.d.ts.map +1 -1
- package/dist/proxy/adapters/opencode.d.ts +7 -0
- package/dist/proxy/adapters/opencode.d.ts.map +1 -1
- package/dist/proxy/buildInfo.d.ts +94 -0
- package/dist/proxy/buildInfo.d.ts.map +1 -0
- package/dist/proxy/cwd.d.ts.map +1 -1
- package/dist/proxy/errors.d.ts.map +1 -1
- package/dist/proxy/models.d.ts +20 -9
- package/dist/proxy/models.d.ts.map +1 -1
- package/dist/proxy/passthroughDenial.d.ts +17 -0
- package/dist/proxy/passthroughDenial.d.ts.map +1 -0
- package/dist/proxy/passthroughEarlyStop.d.ts +64 -10
- package/dist/proxy/passthroughEarlyStop.d.ts.map +1 -1
- package/dist/proxy/query.d.ts +16 -0
- package/dist/proxy/query.d.ts.map +1 -1
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/proxy/session/cache.d.ts +11 -2
- package/dist/proxy/session/cache.d.ts.map +1 -1
- package/dist/proxy/session/crossProcessTurnCoordinator.d.ts +40 -0
- package/dist/proxy/session/crossProcessTurnCoordinator.d.ts.map +1 -0
- package/dist/proxy/session/durableFileSystem.d.ts +21 -0
- package/dist/proxy/session/durableFileSystem.d.ts.map +1 -0
- package/dist/proxy/session/lineage.d.ts +20 -0
- package/dist/proxy/session/lineage.d.ts.map +1 -1
- package/dist/proxy/session/processIncarnation.d.ts +46 -0
- package/dist/proxy/session/processIncarnation.d.ts.map +1 -0
- package/dist/proxy/session/recoveryClaim.d.ts +19 -0
- package/dist/proxy/session/recoveryClaim.d.ts.map +1 -0
- package/dist/proxy/session/sdkProcessGate.d.ts +19 -0
- package/dist/proxy/session/sdkProcessGate.d.ts.map +1 -0
- package/dist/proxy/sessionLifecycle.d.ts +105 -0
- package/dist/proxy/sessionLifecycle.d.ts.map +1 -0
- package/dist/proxy/sessionStore.d.ts +53 -7
- package/dist/proxy/sessionStore.d.ts.map +1 -1
- package/dist/proxy/types.d.ts +4 -0
- package/dist/proxy/types.d.ts.map +1 -1
- package/dist/proxy/updateCheck.d.ts +31 -0
- package/dist/proxy/updateCheck.d.ts.map +1 -0
- package/dist/server.js +3 -3
- package/dist/telemetry/profileBar.d.ts +3 -3
- package/dist/telemetry/profileBar.d.ts.map +1 -1
- package/dist/telemetry/settingsPage.d.ts +1 -1
- package/dist/telemetry/settingsPage.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -92,7 +92,7 @@ function supports1mContext(model) {
|
|
|
92
92
|
return false;
|
|
93
93
|
return true;
|
|
94
94
|
}
|
|
95
|
-
function mapModelToClaudeModel(model, subscriptionType, agentMode) {
|
|
95
|
+
function mapModelToClaudeModel(model, subscriptionType, agentMode, profileId) {
|
|
96
96
|
if (model.includes("haiku"))
|
|
97
97
|
return "haiku";
|
|
98
98
|
const use1m = supports1mContext(model);
|
|
@@ -105,7 +105,7 @@ function mapModelToClaudeModel(model, subscriptionType, agentMode) {
|
|
|
105
105
|
if (fableOverrideRaw && fableOverride !== "fable[1m]") {
|
|
106
106
|
warnUnrecognizedTierOverride("FABLE_MODEL", fableOverrideRaw, "fable");
|
|
107
107
|
}
|
|
108
|
-
if (use1m && !isSubagent && !isExtendedContextKnownUnavailable())
|
|
108
|
+
if (use1m && !isSubagent && !isExtendedContextKnownUnavailable(profileId))
|
|
109
109
|
return "fable[1m]";
|
|
110
110
|
return "fable";
|
|
111
111
|
}
|
|
@@ -117,25 +117,46 @@ function mapModelToClaudeModel(model, subscriptionType, agentMode) {
|
|
|
117
117
|
if (opusOverrideRaw && opusOverride !== "opus[1m]") {
|
|
118
118
|
warnUnrecognizedTierOverride("OPUS_MODEL", opusOverrideRaw, "opus");
|
|
119
119
|
}
|
|
120
|
-
if (use1m && !isSubagent && !isExtendedContextKnownUnavailable())
|
|
120
|
+
if (use1m && !isSubagent && !isExtendedContextKnownUnavailable(profileId))
|
|
121
121
|
return "opus[1m]";
|
|
122
122
|
return "opus";
|
|
123
123
|
}
|
|
124
124
|
const sonnetOverride = process.env.MERIDIAN_SONNET_MODEL ?? process.env.CLAUDE_PROXY_SONNET_MODEL;
|
|
125
125
|
if (sonnetOverride === "sonnet[1m]") {
|
|
126
|
-
if (!use1m || isSubagent || isExtendedContextKnownUnavailable())
|
|
126
|
+
if (!use1m || isSubagent || isExtendedContextKnownUnavailable(profileId))
|
|
127
127
|
return "sonnet";
|
|
128
128
|
return "sonnet[1m]";
|
|
129
129
|
}
|
|
130
130
|
return "sonnet";
|
|
131
131
|
}
|
|
132
132
|
var EXTRA_USAGE_RETRY_MS = 60 * 60 * 1000;
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
var DEFAULT_BENCH_KEY = "__default__";
|
|
134
|
+
var extendedContextBenchedUntil = new Map;
|
|
135
|
+
function benchExtendedContext(profileId, until) {
|
|
136
|
+
if (until <= Date.now())
|
|
137
|
+
return;
|
|
138
|
+
const key = profileId || DEFAULT_BENCH_KEY;
|
|
139
|
+
const existing = extendedContextBenchedUntil.get(key);
|
|
140
|
+
if (existing !== undefined && existing >= until)
|
|
141
|
+
return;
|
|
142
|
+
extendedContextBenchedUntil.set(key, until);
|
|
143
|
+
}
|
|
144
|
+
function recordExtendedContextUnavailable(profileId) {
|
|
145
|
+
benchExtendedContext(profileId, Date.now() + EXTRA_USAGE_RETRY_MS);
|
|
146
|
+
}
|
|
147
|
+
function recordExtendedContextRateLimited(profileId, until) {
|
|
148
|
+
benchExtendedContext(profileId, until);
|
|
136
149
|
}
|
|
137
|
-
function isExtendedContextKnownUnavailable() {
|
|
138
|
-
|
|
150
|
+
function isExtendedContextKnownUnavailable(profileId) {
|
|
151
|
+
const key = profileId || DEFAULT_BENCH_KEY;
|
|
152
|
+
const until = extendedContextBenchedUntil.get(key);
|
|
153
|
+
if (until === undefined)
|
|
154
|
+
return false;
|
|
155
|
+
if (until <= Date.now()) {
|
|
156
|
+
extendedContextBenchedUntil.delete(key);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
139
160
|
}
|
|
140
161
|
function stripExtendedContext(model) {
|
|
141
162
|
if (model === "opus[1m]")
|
|
@@ -855,4 +876,4 @@ Examples:
|
|
|
855
876
|
meridian profile list # Show all profiles`);
|
|
856
877
|
}
|
|
857
878
|
|
|
858
|
-
export { env, envBool, resolvePassthrough, envInt, init_env, CANONICAL_SONNET_MODEL, resolveSdkModelDefaults, explicitModelPin, mapModelToClaudeModel, recordExtendedContextUnavailable, stripExtendedContext, hasExtendedContext, subscriptionIncludesExtendedContext, getAuthCacheInfo, getClaudeAuthStatusAsync, getResolvedClaudeExecutableInfo, resolveClaudeExecutableAsync, isClosedControllerError, OAUTH_TOKEN_URL, OAUTH_CLIENT_ID, OAUTH_REDIRECT_URI, buildAuthLoginEnv, createManualOAuthSession, parseAuthorizationCodeInput, profileAdd, profileAddOauthToken, profileList, dirsToRemoveOnProfileRemove, profileRemove, profileSwitch, profileLogin, profileHelp };
|
|
879
|
+
export { env, envBool, resolvePassthrough, envInt, init_env, CANONICAL_SONNET_MODEL, resolveSdkModelDefaults, explicitModelPin, mapModelToClaudeModel, recordExtendedContextUnavailable, recordExtendedContextRateLimited, stripExtendedContext, hasExtendedContext, subscriptionIncludesExtendedContext, getAuthCacheInfo, getClaudeAuthStatusAsync, getResolvedClaudeExecutableInfo, resolveClaudeExecutableAsync, isClosedControllerError, OAUTH_TOKEN_URL, OAUTH_CLIENT_ID, OAUTH_REDIRECT_URI, buildAuthLoginEnv, createManualOAuthSession, parseAuthorizationCodeInput, profileAdd, profileAddOauthToken, profileList, dirsToRemoveOnProfileRemove, profileRemove, profileSwitch, profileLogin, profileHelp };
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
startProxyServer
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-hdyptm7z.js";
|
|
5
5
|
import"./cli-m0p2bc8v.js";
|
|
6
6
|
import"./cli-sry5aqdj.js";
|
|
7
|
-
import"./cli-
|
|
7
|
+
import"./cli-8yp89fan.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveClaudeExecutableAsync
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-xfbhn15a.js";
|
|
11
11
|
import"./cli-vj9cv18n.js";
|
|
12
12
|
import"./cli-pc0mtjjv.js";
|
|
13
13
|
import"./cli-khhjyk04.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-39vshwdn.js");
|
|
59
59
|
const subcommand = args[1];
|
|
60
60
|
const profileId = args[2];
|
|
61
61
|
const headless = args.includes("--headless");
|
package/dist/proxy/adapter.d.ts
CHANGED
|
@@ -60,6 +60,19 @@ export interface AgentIdentity {
|
|
|
60
60
|
* for hashing. Agents may send content in different formats.
|
|
61
61
|
*/
|
|
62
62
|
normalizeContent(content: any): string;
|
|
63
|
+
/**
|
|
64
|
+
* Remove request-scoped client metadata before lineage hashing while keeping
|
|
65
|
+
* the original request body untouched for model execution. Implementations
|
|
66
|
+
* must preserve message count and order because SDK UUIDs and resume indexes
|
|
67
|
+
* are aligned by message position.
|
|
68
|
+
*/
|
|
69
|
+
canonicalizeMessagesForLineage?(messages: Array<{
|
|
70
|
+
role: string;
|
|
71
|
+
content: unknown;
|
|
72
|
+
}>): Array<{
|
|
73
|
+
role: string;
|
|
74
|
+
content: unknown;
|
|
75
|
+
}>;
|
|
63
76
|
/**
|
|
64
77
|
* The MCP server name used by this agent.
|
|
65
78
|
* Tools are registered as `mcp__{name}__{tool}`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/proxy/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEnE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAE5D;;;OAGG;IACH,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAE7D;;;;;;;;;;;;;;;;OAgBG;IACH,uBAAuB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAAA;IAEtD;;;;;;;;;;;OAWG;IACH,6BAA6B,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAAA;IAE7D;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAAA;IAEt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C;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,IAAI,aAAa,EAAE,CAAA;IAErC;;;;;;;OAOG;IACH,gBAAgB,CAAC,IAAI,OAAO,CAAA;IAE5B;;;;;;OAMG;IACH,sBAAsB,CAAC,IAAI,OAAO,CAAA;IAElC;;;;;;;;OAQG;IACH,yBAAyB,CAAC,IAAI,OAAO,CAAA;IAErC;;;;;;;;;;;;;;;OAeG;IACH,6BAA6B,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,eAAe,EAAE,UAAU,EAAE,CAAA;CAC3G"}
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* working directory extraction, content normalization, and tool configuration.
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentAdapter } from "../adapter";
|
|
8
|
+
export declare function canonicalizeOpenCodeMessagesForLineage(messages: Array<{
|
|
9
|
+
role: string;
|
|
10
|
+
content: unknown;
|
|
11
|
+
}>): Array<{
|
|
12
|
+
role: string;
|
|
13
|
+
content: unknown;
|
|
14
|
+
}>;
|
|
8
15
|
export declare const openCodeAdapter: AgentAdapter;
|
|
9
16
|
import { openCodeTransforms } from "../transforms/opencode";
|
|
10
17
|
export { openCodeTransforms };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../src/proxy/adapters/opencode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../src/proxy/adapters/opencode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAqC9C,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GAClD,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAU3C;AAED,eAAO,MAAM,eAAe,EAAE,YAwK7B,CAAA;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build provenance — what code is this process actually running?
|
|
3
|
+
*
|
|
4
|
+
* `/health` used to report `require("package.json").version` and nothing else.
|
|
5
|
+
* That string is identical on a released tag and on a feature branch built from
|
|
6
|
+
* the same commit, so an instance running uncommitted code reported the same
|
|
7
|
+
* version as the published release. Drift was not merely unnoticed, it was
|
|
8
|
+
* unobservable: a monitor, a downstream plugin, and the operator all saw
|
|
9
|
+
* "1.62.7" whatever the working tree contained.
|
|
10
|
+
*
|
|
11
|
+
* This module answers the question the version string cannot: where did this
|
|
12
|
+
* code come from, and is it current? `source` is derived (no configuration
|
|
13
|
+
* required, so it is honest for every npm install); `sha`/`branch`/`dirty` are
|
|
14
|
+
* stamped by whatever launches the process, and are simply absent otherwise.
|
|
15
|
+
*
|
|
16
|
+
* Pure module — every export is a function of its arguments plus `process.env`.
|
|
17
|
+
* No I/O, no imports from server.ts or session/. The registry lookup that
|
|
18
|
+
* supplies `latest` lives in updateCheck.ts.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Where the running code came from.
|
|
22
|
+
* - `npm` — resolved out of a node_modules install; version is trustworthy
|
|
23
|
+
* - `local` — running from a checkout or a build output next to sources
|
|
24
|
+
* - `dev` — explicitly stamped as a development build by the launcher
|
|
25
|
+
*/
|
|
26
|
+
export type BuildSource = "npm" | "local" | "dev";
|
|
27
|
+
export interface BuildInfo {
|
|
28
|
+
source: BuildSource;
|
|
29
|
+
/**
|
|
30
|
+
* package.json version. Proof of what is running ONLY when source is "npm" —
|
|
31
|
+
* otherwise it is the version the tree was last released at, which says
|
|
32
|
+
* nothing about the commits on top of it.
|
|
33
|
+
*/
|
|
34
|
+
version: string;
|
|
35
|
+
/** Commit the build came from, when the launcher stamped one. */
|
|
36
|
+
sha?: string;
|
|
37
|
+
branch?: string;
|
|
38
|
+
/** True when the stamped tree had uncommitted changes at launch. */
|
|
39
|
+
dirty?: boolean;
|
|
40
|
+
/** Newest published version, from the cached registry check. */
|
|
41
|
+
latest?: string;
|
|
42
|
+
/** `latest` is strictly newer than `version`. Absent when unknown. */
|
|
43
|
+
updateAvailable?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface ParsedVersion {
|
|
46
|
+
major: number;
|
|
47
|
+
minor: number;
|
|
48
|
+
patch: number;
|
|
49
|
+
prerelease: string[];
|
|
50
|
+
}
|
|
51
|
+
/** Parse a semver string. Returns null for anything unrecognized. */
|
|
52
|
+
export declare function parseVersion(value: string): ParsedVersion | null;
|
|
53
|
+
/**
|
|
54
|
+
* Compare two semver strings: -1 if a < b, 1 if a > b, 0 if equal.
|
|
55
|
+
*
|
|
56
|
+
* Unparseable input compares equal, which makes every caller fail closed —
|
|
57
|
+
* a malformed registry response must never be read as "you are out of date".
|
|
58
|
+
*/
|
|
59
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
60
|
+
/**
|
|
61
|
+
* Is `latest` strictly newer than `current`?
|
|
62
|
+
*
|
|
63
|
+
* False when either is missing or unparseable, and false when the running
|
|
64
|
+
* build is AHEAD of the registry — a local build of an unreleased commit is
|
|
65
|
+
* drift worth reporting, but it is not an available update.
|
|
66
|
+
*/
|
|
67
|
+
export declare function isUpdateAvailable(current: string | undefined, latest: string | undefined): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Derive the build source from the path this module was loaded from.
|
|
70
|
+
*
|
|
71
|
+
* Deliberately path-derived rather than configured: the overwhelming majority
|
|
72
|
+
* of installs never set an env var, and a provenance field that only works when
|
|
73
|
+
* someone remembers to populate it is the very failure this module exists to
|
|
74
|
+
* fix. An explicit `MERIDIAN_BUILD_SOURCE` stamp still wins when present.
|
|
75
|
+
*/
|
|
76
|
+
export declare function detectBuildSource(modulePath: string, stamped?: string): BuildSource;
|
|
77
|
+
/**
|
|
78
|
+
* Assemble the build block. `latest` comes from the caller (updateCheck's
|
|
79
|
+
* cache) so this module stays free of I/O and its tests need no mocks.
|
|
80
|
+
*/
|
|
81
|
+
export declare function getBuildInfo(input: {
|
|
82
|
+
version: string;
|
|
83
|
+
modulePath: string;
|
|
84
|
+
latest?: string;
|
|
85
|
+
env?: NodeJS.ProcessEnv;
|
|
86
|
+
}): BuildInfo;
|
|
87
|
+
/**
|
|
88
|
+
* One-line human summary for the startup log — the operator-facing half of
|
|
89
|
+
* this feature. Returns undefined when there is nothing worth saying (a
|
|
90
|
+
* current npm install), so a healthy start stays quiet.
|
|
91
|
+
*/
|
|
92
|
+
export declare function describeBuildDrift(build: BuildInfo): string | undefined;
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=buildInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildInfo.d.ts","sourceRoot":"","sources":["../../src/proxy/buildInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAA;AAEjD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,WAAW,CAAA;IACnB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAID,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAShE;AA0BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAGlG;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAGnF;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CACxB,GAAG,SAAS,CAgBZ;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAiBvE"}
|
package/dist/proxy/cwd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cwd.d.ts","sourceRoot":"","sources":["../../src/proxy/cwd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"cwd.d.ts","sourceRoot":"","sources":["../../src/proxy/cwd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAA;IAC/B,yEAAyE;IACzE,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,oDAAoD;IACpD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAA;IAChB,qEAAqE;IACrE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CACnC;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CAQ9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/proxy/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAc1D;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/proxy/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAc1D;AAiCD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,eAAe,CAiI7E;AAED;;;;;;;;;;;;;;;;;;GAk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CAAC,KAAK,EAAE;IAChD,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,WAAW,EAAE,OAAO,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,OAAO,CAAA;CACrB,GAAG,OAAO,CAYV;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAuDpE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,cAAc,EACjB,GAAG,EAAE;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GACA,MAAM,CAYR"}
|
package/dist/proxy/models.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export interface ClaudeAuthStatus {
|
|
|
54
54
|
}
|
|
55
55
|
/** Clear the per-variable warn-once tracking — for testing only. */
|
|
56
56
|
export declare function resetWarnedTierOverrides(): void;
|
|
57
|
-
export declare function mapModelToClaudeModel(model: string, subscriptionType?: string | null, agentMode?: string | null): ClaudeModel;
|
|
57
|
+
export declare function mapModelToClaudeModel(model: string, subscriptionType?: string | null, agentMode?: string | null, profileId?: string): ClaudeModel;
|
|
58
58
|
/**
|
|
59
59
|
* Record that Extra Usage is not enabled on this subscription.
|
|
60
60
|
* For the next hour, mapModelToClaudeModel will return the base model
|
|
@@ -62,15 +62,26 @@ export declare function mapModelToClaudeModel(model: string, subscriptionType?:
|
|
|
62
62
|
* the next request probes [1m] once; if Extra Usage was enabled in the
|
|
63
63
|
* meantime it succeeds and the flag is never set again.
|
|
64
64
|
*/
|
|
65
|
-
export declare function recordExtendedContextUnavailable(): void;
|
|
65
|
+
export declare function recordExtendedContextUnavailable(profileId?: string): void;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
* Record that a [1m] request was rate-limited, benching it until `until`.
|
|
68
|
+
*
|
|
69
|
+
* Callers derive `until` from the account's own observed reset rather than a
|
|
70
|
+
* constant. Stripping [1m] on a rate limit while recording nothing is what
|
|
71
|
+
* makes the next request map straight back to [1m]: the conversation then
|
|
72
|
+
* flaps between two models and pays a cold prompt cache in BOTH directions,
|
|
73
|
+
* which routinely costs more than the rate limit it was routing around (#862).
|
|
74
|
+
*/
|
|
75
|
+
export declare function recordExtendedContextRateLimited(profileId: string | undefined, until: number): void;
|
|
76
|
+
/**
|
|
77
|
+
* Returns true while this profile's [1m] access is benched. Expired marks are
|
|
78
|
+
* dropped on read, so the next request probes [1m] once — and if the window
|
|
79
|
+
* has genuinely reset, it simply succeeds.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isExtendedContextKnownUnavailable(profileId?: string): boolean;
|
|
82
|
+
/** Clear extended-context benches — for testing only. Clears every profile
|
|
83
|
+
* when no id is given. */
|
|
84
|
+
export declare function resetExtendedContextUnavailable(profileId?: string): void;
|
|
74
85
|
/**
|
|
75
86
|
* Strip the [1m] suffix from a model, returning the base variant.
|
|
76
87
|
* Used for fallback when the 1M context window is rate-limited.
|
|
@@ -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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;GAiBG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,GAAE,YAA2B,GAChC,oBAAoB,GAAG,IAAI,CAQ7B;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,IAAI,oBAAoB,GAAG,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marker used when Meridian forwards a passthrough tool call to the client.
|
|
3
|
+
*
|
|
4
|
+
* Keep this module pure. Runtime hooks, diagnostics, and E2E assertions must
|
|
5
|
+
* agree on the exact text, but none of them should know the Claude CLI's
|
|
6
|
+
* private transcript storage format.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PASSTHROUGH_DENY_REASON: string;
|
|
9
|
+
export interface ToolResultLike {
|
|
10
|
+
type?: unknown;
|
|
11
|
+
tool_use_id?: unknown;
|
|
12
|
+
content?: unknown;
|
|
13
|
+
is_error?: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** True only for the synthetic error result emitted by the forwarding hook. */
|
|
16
|
+
export declare function isForwardedDenial(block: ToolResultLike | undefined): boolean;
|
|
17
|
+
//# sourceMappingURL=passthroughDenial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passthroughDenial.d.ts","sourceRoot":"","sources":["../../src/proxy/passthroughDenial.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,QAGiE,CAAA;AAMrG,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAcD,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAI5E"}
|
|
@@ -12,10 +12,31 @@
|
|
|
12
12
|
* fires the hidden digest turn. Those messages identify a stable assistant
|
|
13
13
|
* checkpoint, but they are NOT a durability acknowledgement: a live PTY E2E
|
|
14
14
|
* observed the assistant and deny in the iterator while neither existed in the
|
|
15
|
-
*
|
|
16
|
-
* assistant UUID/tool IDs at deny settlement
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* durable SDK transcript after an immediate abort. The proxy therefore freezes the
|
|
16
|
+
* assistant UUID/tool IDs at deny settlement and stores the checkpoint only
|
|
17
|
+
* after the SDK's canonical terminal result commits the transcript.
|
|
18
|
+
*
|
|
19
|
+
* What stops the digest turn is the maxTurns cap in query.ts, not this module:
|
|
20
|
+
* capped at 1, the SDK reaches the tool-use boundary and then declines to start
|
|
21
|
+
* another turn, so the digest never generates AND the terminal result still
|
|
22
|
+
* arrives (as `error_max_turns`) to commit the transcript. That is the
|
|
23
|
+
* combination an immediate abort could not give — it skipped the commit.
|
|
24
|
+
*
|
|
25
|
+
* This module still drains rather than aborts, because the cap is lifted for
|
|
26
|
+
* deferred tools, advisors, structured output, and the kill switch. In those
|
|
27
|
+
* configurations the digest turn does generate and is discarded here.
|
|
28
|
+
*
|
|
29
|
+
* Settlement is necessary but NOT sufficient to freeze the checkpoint. Two
|
|
30
|
+
* further conditions belong to the caller, which owns the wire:
|
|
31
|
+
*
|
|
32
|
+
* - the turn has stopped generating, so no further call can appear, and
|
|
33
|
+
* - trackerCoversStreamedCalls agrees the tracker has caught up with every
|
|
34
|
+
* forwarded call the wire carried.
|
|
35
|
+
*
|
|
36
|
+
* Both exist because `expected` is armed from assistant messages, which the SDK
|
|
37
|
+
* can surface after the deny that settles them — so "everything I know about is
|
|
38
|
+
* answered" is true long before "everything is answered". Freezing on the
|
|
39
|
+
* former drops the calls still in flight, silently, from the client's set.
|
|
19
40
|
*
|
|
20
41
|
* Pure module — no I/O, no imports from server.ts or session/.
|
|
21
42
|
*/
|
|
@@ -39,7 +60,12 @@ export declare function createEarlyStopTracker(): EarlyStopTracker;
|
|
|
39
60
|
* or as bare names (read) — the SDK strips the prefix in some event paths.
|
|
40
61
|
* Internal MCP tools (mcp__opencode__*) and ToolSearch are excluded.
|
|
41
62
|
*/
|
|
42
|
-
export
|
|
63
|
+
export interface ClientForwardedToolUse {
|
|
64
|
+
type: "tool_use";
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function isClientForwardedToolUse(block: unknown): block is ClientForwardedToolUse;
|
|
43
69
|
/**
|
|
44
70
|
* Record the client-forwarded tool_use ids from an assistant message's content.
|
|
45
71
|
*/
|
|
@@ -74,13 +100,41 @@ export declare function noteUserContent(tracker: EarlyStopTracker, content: unkn
|
|
|
74
100
|
export declare function allForwardedCallsResolved(tracker: EarlyStopTracker): boolean;
|
|
75
101
|
/**
|
|
76
102
|
* Verify that a resumed tool-result delta settles exactly the tool calls at the
|
|
77
|
-
* stored assistant checkpoint
|
|
78
|
-
* content, matching the
|
|
103
|
+
* stored assistant checkpoint, then coalesce queued user turns into one SDK
|
|
104
|
+
* input. Tool results must precede any ordinary user content, matching the
|
|
105
|
+
* Anthropic Messages protocol.
|
|
79
106
|
*/
|
|
80
|
-
export declare function
|
|
107
|
+
export declare function coalesceCompleteToolResultContinuation(messages: Array<{
|
|
81
108
|
role?: unknown;
|
|
82
109
|
content?: unknown;
|
|
83
|
-
}>, expectedIds: readonly string[]):
|
|
110
|
+
}>, expectedIds: readonly string[]): Array<{
|
|
111
|
+
role: "user";
|
|
112
|
+
content: unknown[];
|
|
113
|
+
}> | undefined;
|
|
114
|
+
/** Find and validate the exact echoed assistant checkpoint plus its result tail. */
|
|
115
|
+
export declare function findCompleteToolResultCheckpoint(messages: Array<{
|
|
116
|
+
role?: unknown;
|
|
117
|
+
content?: unknown;
|
|
118
|
+
}>, expectedIds: readonly string[]): Array<{
|
|
119
|
+
role: "user";
|
|
120
|
+
content: unknown[];
|
|
121
|
+
}> | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Has the tracker caught up with every forwarded call the wire actually
|
|
124
|
+
* carried?
|
|
125
|
+
*
|
|
126
|
+
* `expected` is armed from assistant messages, which the SDK can surface AFTER
|
|
127
|
+
* the deny that settles them. Settlement alone therefore proves only that the
|
|
128
|
+
* calls seen SO FAR are answered — freeze on that and any call whose assistant
|
|
129
|
+
* fragment is still in flight lands past the checkpoint and is dropped from the
|
|
130
|
+
* client-facing set. Silently: a dropped call is not a malformed envelope, so
|
|
131
|
+
* nothing downstream looks wrong.
|
|
132
|
+
*
|
|
133
|
+
* `streamedToolUseIds` comes from content_block_start, which cannot lag, so it
|
|
134
|
+
* is the completeness oracle both paths gate on. Callers build it with
|
|
135
|
+
* isClientForwardedToolUse so the two sets are comparable by construction.
|
|
136
|
+
*/
|
|
137
|
+
export declare function trackerCoversStreamedCalls(tracker: EarlyStopTracker, streamedToolUseIds: ReadonlySet<string>): boolean;
|
|
84
138
|
/** The cache-stable assistant boundary after every forwarded call settled. */
|
|
85
139
|
export declare function settledToolCallAssistantUuid(tracker: EarlyStopTracker): string | undefined;
|
|
86
140
|
export declare function shouldEarlyStop(tracker: EarlyStopTracker): boolean;
|
|
@@ -97,7 +151,7 @@ export type ClientAbortDisposition = {
|
|
|
97
151
|
* A client abort leaves the SDK session ending in an interrupted tail. Even an
|
|
98
152
|
* assistant UUID already seen in the iterator is not known durable until the
|
|
99
153
|
* canonical result: the live PTY regression yielded that UUID but never wrote
|
|
100
|
-
* it
|
|
154
|
+
* it durably after abort. Therefore every owned mapping is evicted; a replay
|
|
101
155
|
* costs one cache miss but cannot wedge on a missing or interrupted boundary.
|
|
102
156
|
*/
|
|
103
157
|
export declare function clientAbortDisposition(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthroughEarlyStop.d.ts","sourceRoot":"","sources":["../../src/proxy/passthroughEarlyStop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"passthroughEarlyStop.d.ts","sourceRoot":"","sources":["../../src/proxy/passthroughEarlyStop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAUH,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrB,6EAA6E;IAC7E,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrB;yEACqE;IACrE,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,0EAA0E;IAC1E,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAEzD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,UAAU,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAQxF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAatF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAQjF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC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CAAC,EAAE,MAAM,CAAA;IACzB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oEAAoE;IACpE,WAAW,EAAE,OAAO,CAAA;CACrB,GAAG,sBAAsB,CAMzB"}
|
package/dist/proxy/query.d.ts
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
import type { Options, OutputFormat, SettingSource } from "@anthropic-ai/claude-agent-sdk";
|
|
8
8
|
import { createPassthroughMcpServer } from "./passthroughTools";
|
|
9
9
|
import type { Effort } from "./effort";
|
|
10
|
+
/** Resolve the exact config root the child SDK process will use. Lifecycle GC
|
|
11
|
+
* stores this absolute locator at creation time so later profile changes cannot
|
|
12
|
+
* redirect deletion at a different root. */
|
|
13
|
+
export declare function resolveQueryConfigDir(cleanEnv: Record<string, string | undefined>, sharedMemory: boolean | undefined, workingDirectory?: string): string;
|
|
10
14
|
export interface QueryContext {
|
|
11
15
|
/** The prompt to send (text or async iterable for multimodal) */
|
|
12
16
|
prompt: string | AsyncIterable<any>;
|
|
@@ -39,6 +43,14 @@ export interface QueryContext {
|
|
|
39
43
|
envOverrides?: Record<string, string | undefined>;
|
|
40
44
|
/** Whether any passthrough tools use deferred loading */
|
|
41
45
|
hasDeferredTools: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether passthrough early stop is active (MERIDIAN_PASSTHROUGH_EARLY_STOP
|
|
48
|
+
* != "0"). Gates the single-turn maxTurns cap: the cap is only safe when the
|
|
49
|
+
* checkpoint machinery is running to capture and store the tool boundary.
|
|
50
|
+
* Defaults to on — omitting it must not silently reintroduce the billed
|
|
51
|
+
* digest turn.
|
|
52
|
+
*/
|
|
53
|
+
earlyStop?: boolean;
|
|
42
54
|
/** SDK session ID for resume (if continuing a session) */
|
|
43
55
|
resumeSessionId?: string;
|
|
44
56
|
/** Whether this is an undo operation */
|
|
@@ -51,6 +63,10 @@ export interface QueryContext {
|
|
|
51
63
|
* fallback — the original stays registered as a bg agent; the fork gets a
|
|
52
64
|
* fresh id with the full history). */
|
|
53
65
|
forkSession?: boolean;
|
|
66
|
+
/** Preallocated SDK session ID for any Meridian-created transcript. Persisting
|
|
67
|
+
* this ID before spawn lets lifecycle recovery identify a fresh session or
|
|
68
|
+
* fork even if the proxy crashes before the SDK emits its first event. */
|
|
69
|
+
forkSessionId?: string;
|
|
54
70
|
/** SDK hooks (PreToolUse etc.) */
|
|
55
71
|
sdkHooks?: any;
|
|
56
72
|
/** Blocked SDK built-in tools (from pipeline) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/proxy/query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/proxy/query.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAW,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEnG,OAAO,EAAE,0BAA0B,EAAwB,MAAM,oBAAoB,CAAA;AAErF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AA6CtC;;4CAE4C;AAC5C,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC5C,YAAY,EAAE,OAAO,GAAG,SAAS,EACjC,gBAAgB,GAAE,MAAsB,GACvC,MAAM,CAWR;AAED,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;IACnC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAA;IACrB,gCAAgC;IAChC,g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B,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBvE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,0BAA0B,QAWnB,CAAA;AAiCpB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,EAAE,eAAe,CAAC,EAAE,eAAe,GAAG,gBAAgB,CA0KxG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAkBA,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;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAkBA,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;AAuDnG,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EAIpB,KAAK,aAAa,EAGnB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EAA+B,iBAAiB,EAAE,mBAAmB,EAA4D,MAAM,iBAAiB,CAAA;AAsC/J,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,CAAA;AAiY7B,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAywMhF;AAWD,wBAAgB,gCAAgC,IAAI,IAAI,CAavD;AAED,wBAAsB,gBAAgB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAuLhG"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Manages in-memory LRU caches for session and fingerprint lookups,
|
|
5
5
|
* coordinates with the shared file store for cross-proxy session resume.
|
|
6
6
|
*/
|
|
7
|
+
import { type StoredSessionGeneration } from "../sessionStore";
|
|
7
8
|
import { type SessionState, type TokenUsage, type LineageResult } from "./lineage";
|
|
8
9
|
export declare function getMaxSessionsLimit(): number;
|
|
9
10
|
/** Clear all session caches (used in tests).
|
|
@@ -14,7 +15,7 @@ export declare function clearSessionCache(): void;
|
|
|
14
15
|
export declare function evictSession(sessionId: string | undefined, workingDirectory?: string, messages?: Array<{
|
|
15
16
|
role: string;
|
|
16
17
|
content: any;
|
|
17
|
-
}
|
|
18
|
+
}>, expectedGeneration?: StoredSessionGeneration): boolean;
|
|
18
19
|
/** Look up a cached session by header or fingerprint.
|
|
19
20
|
* Returns a LineageResult that classifies the mutation and includes the
|
|
20
21
|
* session state needed for the correct SDK action. */
|
|
@@ -33,5 +34,13 @@ export declare function getSessionByClaudeId(claudeSessionId: string): SessionSt
|
|
|
33
34
|
export declare function storeSession(sessionId: string | undefined, messages: Array<{
|
|
34
35
|
role: string;
|
|
35
36
|
content: unknown;
|
|
36
|
-
}>, claudeSessionId: string, workingDirectory?: string, sdkMessageUuids?: Array<string | null>, contextUsage?: TokenUsage, passthroughToolCallAssistantUuid?: string | null, passthroughToolCallIds?: string[] | null
|
|
37
|
+
}>, claudeSessionId: string, workingDirectory?: string, sdkMessageUuids?: Array<string | null>, contextUsage?: TokenUsage, passthroughToolCallAssistantUuid?: string | null, passthroughToolCallIds?: string[] | null, currentTranscript?: {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
configDir: string;
|
|
40
|
+
projectDir?: string;
|
|
41
|
+
}, sourceTranscript?: {
|
|
42
|
+
sessionId: string;
|
|
43
|
+
configDir: string;
|
|
44
|
+
projectDir?: string;
|
|
45
|
+
}, expectedGeneration?: StoredSessionGeneration | null): StoredSessionGeneration | false;
|
|
37
46
|
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -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;AAIH,OAAO,EAOL,KAAK,uBAAuB,EAC7B,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAML,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,C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