@rynfar/meridian 1.62.7 → 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-21w6xm0d.js → cli-hdyptm7z.js} +4890 -766
- package/dist/cli.js +2 -2
- package/dist/{pluginPage-03q5j753.js → pluginPage-n3gdtbmj.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/passthroughDenial.d.ts +17 -0
- package/dist/proxy/passthroughDenial.d.ts.map +1 -0
- package/dist/proxy/passthroughEarlyStop.d.ts +52 -7
- package/dist/proxy/passthroughEarlyStop.d.ts.map +1 -1
- package/dist/proxy/query.d.ts +8 -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 +2 -2
- 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
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
10
|
} from "./cli-xfbhn15a.js";
|
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;IAEtC;;;OAGG;IACH,gBAAgB,IAAI,MAAM,CAAA;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,C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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;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAM3D;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,aAAa,GAAG,iBAAiB,CAAA;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rB,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"}
|
|
@@ -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,7 +12,7 @@
|
|
|
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
|
-
*
|
|
15
|
+
* durable SDK transcript after an immediate abort. The proxy therefore freezes the
|
|
16
16
|
* assistant UUID/tool IDs at deny settlement and stores the checkpoint only
|
|
17
17
|
* after the SDK's canonical terminal result commits the transcript.
|
|
18
18
|
*
|
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
* deferred tools, advisors, structured output, and the kill switch. In those
|
|
27
27
|
* configurations the digest turn does generate and is discarded here.
|
|
28
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.
|
|
40
|
+
*
|
|
29
41
|
* Pure module — no I/O, no imports from server.ts or session/.
|
|
30
42
|
*/
|
|
31
43
|
export interface EarlyStopTracker {
|
|
@@ -48,7 +60,12 @@ export declare function createEarlyStopTracker(): EarlyStopTracker;
|
|
|
48
60
|
* or as bare names (read) — the SDK strips the prefix in some event paths.
|
|
49
61
|
* Internal MCP tools (mcp__opencode__*) and ToolSearch are excluded.
|
|
50
62
|
*/
|
|
51
|
-
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;
|
|
52
69
|
/**
|
|
53
70
|
* Record the client-forwarded tool_use ids from an assistant message's content.
|
|
54
71
|
*/
|
|
@@ -83,13 +100,41 @@ export declare function noteUserContent(tracker: EarlyStopTracker, content: unkn
|
|
|
83
100
|
export declare function allForwardedCallsResolved(tracker: EarlyStopTracker): boolean;
|
|
84
101
|
/**
|
|
85
102
|
* Verify that a resumed tool-result delta settles exactly the tool calls at the
|
|
86
|
-
* stored assistant checkpoint
|
|
87
|
-
* 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.
|
|
88
106
|
*/
|
|
89
|
-
export declare function
|
|
107
|
+
export declare function coalesceCompleteToolResultContinuation(messages: Array<{
|
|
108
|
+
role?: unknown;
|
|
109
|
+
content?: unknown;
|
|
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<{
|
|
90
116
|
role?: unknown;
|
|
91
117
|
content?: unknown;
|
|
92
|
-
}>, expectedIds: readonly string[]):
|
|
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;
|
|
93
138
|
/** The cache-stable assistant boundary after every forwarded call settled. */
|
|
94
139
|
export declare function settledToolCallAssistantUuid(tracker: EarlyStopTracker): string | undefined;
|
|
95
140
|
export declare function shouldEarlyStop(tracker: EarlyStopTracker): boolean;
|
|
@@ -106,7 +151,7 @@ export type ClientAbortDisposition = {
|
|
|
106
151
|
* A client abort leaves the SDK session ending in an interrupted tail. Even an
|
|
107
152
|
* assistant UUID already seen in the iterator is not known durable until the
|
|
108
153
|
* canonical result: the live PTY regression yielded that UUID but never wrote
|
|
109
|
-
* it
|
|
154
|
+
* it durably after abort. Therefore every owned mapping is evicted; a replay
|
|
110
155
|
* costs one cache miss but cannot wedge on a missing or interrupted boundary.
|
|
111
156
|
*/
|
|
112
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,gBAA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gB,gCAAgC,CAC9C,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EACtD,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,CAoBzD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,GACtC,OAAO,CAOT;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAE1F;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAMlE;AAED,qEAAqE;AACrE,MAAM,MAAM,sBAAsB,GAC9B;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtB;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,oBAAoB,EAAE,OAAO,CAAA;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,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>;
|
|
@@ -59,6 +63,10 @@ export interface QueryContext {
|
|
|
59
63
|
* fallback — the original stays registered as a bg agent; the fork gets a
|
|
60
64
|
* fresh id with the full history). */
|
|
61
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;
|
|
62
70
|
/** SDK hooks (PreToolUse etc.) */
|
|
63
71
|
sdkHooks?: any;
|
|
64
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,E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Aa,CAAC,EAAE,MAAM,CAAA;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,+CAA+C;IAC/C,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;CACjB;AAuED;;;;;;;GAOG;AACH,wBAAgB,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,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AE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EACjF,gBAAgB,CAAC,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChF,kBAAkB,CAAC,EAAE,uBAAuB,GAAG,IAAI,GAClD,uBAAuB,GAAG,KAAK,CA4CjC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface CrossProcessTurnCoordinatorOptions {
|
|
2
|
+
/** Maximum time an acquire may wait. Acquires always have a finite bound. */
|
|
3
|
+
acquireTimeoutMs?: number;
|
|
4
|
+
/** A lock with no fresh heartbeat for this long may be recovered. */
|
|
5
|
+
staleAfterMs?: number;
|
|
6
|
+
/** Defaults to one third of `staleAfterMs`. Must be shorter than it. */
|
|
7
|
+
heartbeatIntervalMs?: number;
|
|
8
|
+
/** Delay between attempts while another process owns the turn. */
|
|
9
|
+
retryDelayMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CrossProcessTurnLease {
|
|
12
|
+
readonly waitedMs: number;
|
|
13
|
+
/** Stop the heartbeat and release the lock if this lease still owns it. */
|
|
14
|
+
release(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare class CrossProcessTurnAcquireTimeoutError extends Error {
|
|
17
|
+
constructor(timeoutMs: number);
|
|
18
|
+
}
|
|
19
|
+
export declare class CrossProcessTurnOwnershipError extends Error {
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Serializes one logical turn key across processes using atomic filesystem
|
|
24
|
+
* directory operations. Lock errors never cause an unlocked turn to proceed.
|
|
25
|
+
*/
|
|
26
|
+
export declare class CrossProcessTurnCoordinator {
|
|
27
|
+
private readonly root;
|
|
28
|
+
private readonly acquireTimeoutMs;
|
|
29
|
+
private readonly staleAfterMs;
|
|
30
|
+
private readonly heartbeatIntervalMs;
|
|
31
|
+
private readonly retryDelayMs;
|
|
32
|
+
constructor(root: string, options?: CrossProcessTurnCoordinatorOptions);
|
|
33
|
+
acquire(key: string, signal?: AbortSignal): Promise<CrossProcessTurnLease>;
|
|
34
|
+
private tryAcquire;
|
|
35
|
+
private createLease;
|
|
36
|
+
private recover;
|
|
37
|
+
private releaseOwned;
|
|
38
|
+
private wait;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=crossProcessTurnCoordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crossProcessTurnCoordinator.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/crossProcessTurnCoordinator.ts"],"names":[],"mappings":"AAwCA,MAAM,WAAW,kCAAkC;IACjD,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,2EAA2E;IAC3E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAkBD,qBAAa,mCAAoC,SAAQ,KAAK;gBAChD,SAAS,EAAE,MAAM;CAI9B;AAED,qBAAa,8BAA+B,SAAQ,KAAK;gBAC3C,OAAO,SAAqD;CAIzE;AAmRD;;;GAGG;AACH,qBAAa,2BAA2B;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IACrC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAQ;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;gBAEzB,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kCAAuC;IAwBpE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;YA2ClE,UAAU;IA2CxB,OAAO,CAAC,WAAW;YA0CL,OAAO;YA2CP,YAAY;IAgC1B,OAAO,CAAC,IAAI;CAsBb"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persist directory metadata where the runtime exposes a directory handle.
|
|
3
|
+
*
|
|
4
|
+
* Node on Windows does not support opening directories for fsync. Windows has
|
|
5
|
+
* no equivalent API here, so preserve the fsynced-file + atomic-rename order
|
|
6
|
+
* and skip only this unsupported metadata flush. On supported platforms every
|
|
7
|
+
* open, sync, and close error remains fail-closed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function syncDirectoryDurably(path: string): Promise<void>;
|
|
10
|
+
/** Synchronous form for the session store's synchronous lock protocol. */
|
|
11
|
+
export declare function syncDirectoryDurablySync(path: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Classify an atomic directory publication collision without masking a real
|
|
14
|
+
* Windows permission or filesystem error. Windows reports EPERM/EACCES rather
|
|
15
|
+
* than EEXIST when the destination directory is already present, so accept
|
|
16
|
+
* those codes only after proving that the destination currently exists.
|
|
17
|
+
*/
|
|
18
|
+
export declare function directoryRenameWasBlocked(error: unknown, destination: string): Promise<boolean>;
|
|
19
|
+
/** Synchronous form for the session store's recovery-claim protocol. */
|
|
20
|
+
export declare function directoryRenameWasBlockedSync(error: unknown, destination: string): boolean;
|
|
21
|
+
//# sourceMappingURL=durableFileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durableFileSystem.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/durableFileSystem.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtE;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQ3D;AAWD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,CAalB;AAED,wEAAwE;AACxE,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAa1F"}
|
|
@@ -50,6 +50,17 @@ export interface SessionState {
|
|
|
50
50
|
passthroughToolCallIds?: string[];
|
|
51
51
|
/** Last observed token usage for this session (from SDK message_start / message_delta events) */
|
|
52
52
|
contextUsage?: TokenUsage;
|
|
53
|
+
/** Exact SDK transcript roots for cross-process lifecycle retention. */
|
|
54
|
+
currentTranscript?: {
|
|
55
|
+
sessionId: string;
|
|
56
|
+
configDir: string;
|
|
57
|
+
projectDir?: string;
|
|
58
|
+
};
|
|
59
|
+
previousTranscript?: {
|
|
60
|
+
sessionId: string;
|
|
61
|
+
configDir: string;
|
|
62
|
+
projectDir?: string;
|
|
63
|
+
};
|
|
53
64
|
}
|
|
54
65
|
/**
|
|
55
66
|
* Associate SDK assistant events from the current upstream run with the single
|
|
@@ -58,6 +69,15 @@ export interface SessionState {
|
|
|
58
69
|
* assistant UUID as the undo checkpoint for the consolidated client turn.
|
|
59
70
|
*/
|
|
60
71
|
export declare function withClientAssistantUuid(existing: Array<string | null>, clientMessageCount: number, uuid: unknown): Array<string | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Reconcile rollback UUIDs with the session the SDK actually returned.
|
|
74
|
+
*
|
|
75
|
+
* A fork remaps every copied transcript UUID, so UUIDs inherited from the
|
|
76
|
+
* resumed session are invalid in the returned session. The one UUID observed
|
|
77
|
+
* for this request's new client-visible assistant remains valid and occupies
|
|
78
|
+
* its future client message slot.
|
|
79
|
+
*/
|
|
80
|
+
export declare function reconcileReturnedSessionUuids(existing: Array<string | null>, clientMessageCount: number, currentAssistantUuid: string | null, resumeSessionId: string | undefined, returnedSessionId: string | undefined): Array<string | null>;
|
|
61
81
|
/**
|
|
62
82
|
* Result of lineage verification — classifies the mutation and provides
|
|
63
83
|
* the information needed to take the correct SDK action.
|
|
@@ -1 +1 @@
|
|
|
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,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB;;qDAEiD;IACjD,WAAW,EAAE,MAAM,CAAA;IACnB;;kCAE8B;IAC9B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB;;iDAE6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,CAAA;IAC/B;;oDAEgD;IAChD,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACtC;6FACyF;IACzF,gCAAgC,CAAC,EAAE,MAAM,CAAA;IACzC,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,MAA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MAAM,EAAE,GACnC,eAAe,CAwBjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAcnF;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;AAcD,uEAAuE;AACvE,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAA;CAAE,CAAC,GAAG,MAAM,EAAE,EAAE,CAKrG;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,CAkKf"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const PROCESS_INCARNATION_VERSION = 1;
|
|
2
|
+
export type ProcessStartIdKind = "linux-proc-start-ticks" | "darwin-ps-lstart" | "windows-start-ticks";
|
|
3
|
+
/**
|
|
4
|
+
* OS-backed identity for one process incarnation.
|
|
5
|
+
*
|
|
6
|
+
* `hostId` identifies the machine (and Linux PID namespace), `bootId`
|
|
7
|
+
* identifies one boot of that machine, and `startId` distinguishes PID reuse
|
|
8
|
+
* within the boot. Raw machine IDs are hashed before they are persisted.
|
|
9
|
+
*/
|
|
10
|
+
export interface ProcessIncarnation {
|
|
11
|
+
version: typeof PROCESS_INCARNATION_VERSION;
|
|
12
|
+
pid: number;
|
|
13
|
+
hostId: string;
|
|
14
|
+
bootId: string;
|
|
15
|
+
startId: string;
|
|
16
|
+
startIdKind: ProcessStartIdKind;
|
|
17
|
+
}
|
|
18
|
+
export type ProcessIncarnationProbe = "alive" | "dead" | "indeterminate";
|
|
19
|
+
export interface LocalBootIdentity {
|
|
20
|
+
hostId: string;
|
|
21
|
+
bootId: string;
|
|
22
|
+
}
|
|
23
|
+
export type ProcessStartObservation = {
|
|
24
|
+
status: "found";
|
|
25
|
+
startId: string;
|
|
26
|
+
startIdKind: ProcessStartIdKind;
|
|
27
|
+
} | {
|
|
28
|
+
status: "missing";
|
|
29
|
+
} | {
|
|
30
|
+
status: "indeterminate";
|
|
31
|
+
};
|
|
32
|
+
export declare function parseProcessIncarnation(value: unknown): ProcessIncarnation | undefined;
|
|
33
|
+
export declare function parseProcessIncarnationJson(raw: string): ProcessIncarnation | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Pure recovery decision. Only `dead` is permission to retire an owner's lock.
|
|
36
|
+
* Unknown hosts and every unavailable or malformed observation fail closed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function evaluateProcessIncarnation(owner: ProcessIncarnation, localBoot: LocalBootIdentity | undefined, observedStart: ProcessStartObservation | undefined): ProcessIncarnationProbe;
|
|
39
|
+
/** Parse field 22 (`starttime`) without assuming that comm contains no `)`. */
|
|
40
|
+
export declare function parseLinuxProcStatStartId(raw: string, expectedPid: number): string | undefined;
|
|
41
|
+
/** Capture metadata for a lock created by `pid` (normally the current process). */
|
|
42
|
+
export declare function captureProcessIncarnation(pid?: number): ProcessIncarnation | undefined;
|
|
43
|
+
/** Probe one stored owner. Recovery callers must act only on `dead`. */
|
|
44
|
+
export declare function probeProcessIncarnation(owner: ProcessIncarnation): ProcessIncarnationProbe;
|
|
45
|
+
export declare function processIncarnationIsDead(owner: ProcessIncarnation): boolean;
|
|
46
|
+
//# sourceMappingURL=processIncarnation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processIncarnation.d.ts","sourceRoot":"","sources":["../../../src/proxy/session/processIncarnation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C,MAAM,MAAM,kBAAkB,GAC1B,wBAAwB,GACxB,kBAAkB,GAClB,qBAAqB,CAAA;AAEzB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,2BAA2B,CAAA;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,kBAAkB,CAAA;CAChC;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,CAAA;AAExE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,kBAAkB,CAAA;CAAE,GACrE;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAA;AAkC/B,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAqBtF;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAMvF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,iBAAiB,GAAG,SAAS,EACxC,aAAa,EAAE,uBAAuB,GAAG,SAAS,GACjD,uBAAuB,CAsBzB;AA6HD,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ9F;AAsDD,mFAAmF;AACnF,wBAAgB,yBAAyB,CAAC,GAAG,SAAc,GAAG,kBAAkB,GAAG,SAAS,CAkB3F;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,GAAG,uBAAuB,CAS1F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAE3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ProcessIncarnation } from "./processIncarnation";
|
|
2
|
+
export declare const RECOVERY_CLAIM_VERSION = 2;
|
|
3
|
+
export interface RecoveryClaimOwner {
|
|
4
|
+
version: typeof RECOVERY_CLAIM_VERSION;
|
|
5
|
+
generation: string;
|
|
6
|
+
token: string;
|
|
7
|
+
pid: number;
|
|
8
|
+
hostname: string;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
incarnation: ProcessIncarnation;
|
|
11
|
+
}
|
|
12
|
+
export declare function createRecoveryClaimOwner(generation: string): RecoveryClaimOwner;
|
|
13
|
+
export declare function parseRecoveryClaimOwner(value: unknown): RecoveryClaimOwner | undefined;
|
|
14
|
+
export declare function parseRecoveryClaimOwnerJson(raw: string): RecoveryClaimOwner | undefined;
|
|
15
|
+
/** Only an authoritative OS incarnation mismatch proves that an owner is dead. */
|
|
16
|
+
export declare function recoveryClaimOwnerIsDead(owner: RecoveryClaimOwner, probe?: (incarnation: ProcessIncarnation) => boolean): boolean;
|
|
17
|
+
export declare function getRecoveryClaimPath(lockPath: string, generation: string): string;
|
|
18
|
+
export declare function getRecoveryClaimTombstonePath(claimPath: string, claimToken: string): string;
|
|
19
|
+
//# sourceMappingURL=recoveryClaim.d.ts.map
|