@rynfar/meridian 1.62.7 → 1.64.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 +3 -2
- package/bin/meridian-launchd.sh +128 -0
- package/dist/{cli-21w6xm0d.js → cli-4ghkaajs.js} +27332 -12903
- package/dist/{cli-xmweegb1.js → cli-8yp89fan.js} +52 -0
- package/dist/cli-pbvm9kc2.js +760 -0
- package/dist/cli.js +71 -12
- package/dist/meridian-v2.js +139 -0
- package/dist/{pluginPage-03q5j753.js → pluginPage-n3gdtbmj.js} +1 -1
- package/dist/{profileCli-39vshwdn.js → profileCli-ap7eg985.js} +2 -2
- 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/passthroughTools.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/setup.d.ts +35 -10
- package/dist/proxy/setup.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 +5 -5
- package/dist/setup-4v3zg3c0.js +33 -0
- 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 +10 -5
- package/plugin/meridian-v2.ts +190 -0
- package/dist/cli-pc0mtjjv.js +0 -167
- package/dist/setup-0x573t61.js +0 -19
- package/dist/{cli-xfbhn15a.js → cli-0ed6j0vk.js} +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
startProxyServer
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-4ghkaajs.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-
|
|
11
|
-
import"./cli-vj9cv18n.js";
|
|
12
|
-
import"./cli-pc0mtjjv.js";
|
|
10
|
+
} from "./cli-0ed6j0vk.js";
|
|
13
11
|
import"./cli-khhjyk04.js";
|
|
12
|
+
import"./cli-vj9cv18n.js";
|
|
13
|
+
import"./cli-pbvm9kc2.js";
|
|
14
14
|
import {
|
|
15
15
|
__require
|
|
16
16
|
} from "./cli-p9swy5t3.js";
|
|
@@ -39,6 +39,11 @@ Commands:
|
|
|
39
39
|
profile Manage Claude account profiles (add, list, switch, remove)
|
|
40
40
|
refresh-token Refresh the Claude Code OAuth token
|
|
41
41
|
|
|
42
|
+
Setup options:
|
|
43
|
+
--v1 Install the OpenCode V1 plugin
|
|
44
|
+
--v2 Install the pinned OpenCode V2 beta plugin
|
|
45
|
+
--opencode-bin <executable> Probe this OpenCode executable
|
|
46
|
+
|
|
42
47
|
Options:
|
|
43
48
|
-v, --version Show version
|
|
44
49
|
-h, --help Show this help
|
|
@@ -55,7 +60,7 @@ See https://github.com/rynfar/meridian for full documentation.`);
|
|
|
55
60
|
process.exit(0);
|
|
56
61
|
}
|
|
57
62
|
if (args[0] === "profile") {
|
|
58
|
-
const { profileAdd, profileAddOauthToken, profileList, profileRemove, profileSwitch, profileLogin, profileHelp } = await import("./profileCli-
|
|
63
|
+
const { profileAdd, profileAddOauthToken, profileList, profileRemove, profileSwitch, profileLogin, profileHelp } = await import("./profileCli-ap7eg985.js");
|
|
59
64
|
const subcommand = args[1];
|
|
60
65
|
const profileId = args[2];
|
|
61
66
|
const headless = args.includes("--headless");
|
|
@@ -80,11 +85,57 @@ if (args[0] === "profile") {
|
|
|
80
85
|
process.exit(0);
|
|
81
86
|
}
|
|
82
87
|
if (args[0] === "setup") {
|
|
83
|
-
const {
|
|
84
|
-
|
|
88
|
+
const {
|
|
89
|
+
detectOpenCodeGeneration,
|
|
90
|
+
DuplicateMeridianConfigError,
|
|
91
|
+
MissingV2PluginError,
|
|
92
|
+
pluginPathForGeneration,
|
|
93
|
+
runSetup,
|
|
94
|
+
SUPPORTED_OPENCODE_V2_VERSION,
|
|
95
|
+
UnparseableConfigError
|
|
96
|
+
} = await import("./setup-4v3zg3c0.js");
|
|
97
|
+
const forceV1 = args.includes("--v1");
|
|
98
|
+
const forceV2 = args.includes("--v2");
|
|
99
|
+
if (forceV1 && forceV2) {
|
|
100
|
+
console.error("Choose only one OpenCode generation: --v1 or --v2");
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
const binaryIndex = args.indexOf("--opencode-bin");
|
|
104
|
+
const binary = binaryIndex >= 0 ? args[binaryIndex + 1] : undefined;
|
|
105
|
+
if (binaryIndex >= 0 && (!binary || binary.startsWith("--"))) {
|
|
106
|
+
console.error("--opencode-bin requires an executable path");
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
const environmentBinary = process.env.OPENCODE_BIN;
|
|
110
|
+
const commands = binary ? [binary] : environmentBinary ? [environmentBinary] : forceV2 ? ["opencode2", "opencode"] : undefined;
|
|
111
|
+
const detected = forceV1 ? { generation: "v1" } : detectOpenCodeGeneration(commands);
|
|
112
|
+
if (!forceV1 && (binary || environmentBinary) && !detected.version) {
|
|
113
|
+
console.error(`Could not read a supported OpenCode version from ${binary ?? environmentBinary}.`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
if (forceV2 && detected.generation !== "v2") {
|
|
117
|
+
console.error("Could not find an OpenCode V2 beta. Install the pinned beta or pass --opencode-bin <path>.");
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
if (detected.generation === "v2" && detected.version !== SUPPORTED_OPENCODE_V2_VERSION) {
|
|
121
|
+
console.error(`OpenCode V2 ${detected.version ?? "unknown"} is not supported by this Meridian build.`);
|
|
122
|
+
console.error(`Install @opencode-ai/cli@${SUPPORTED_OPENCODE_V2_VERSION}, then re-run meridian setup --v2.`);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
let pluginPath;
|
|
126
|
+
try {
|
|
127
|
+
pluginPath = pluginPathForGeneration(import.meta.url, detected.generation);
|
|
128
|
+
} catch (err) {
|
|
129
|
+
if (err instanceof MissingV2PluginError) {
|
|
130
|
+
console.error(`OpenCode V2 plugin bundle is missing: ${err.expectedPath}`);
|
|
131
|
+
console.error("Reinstall Meridian, then re-run meridian setup --v2.");
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
throw err;
|
|
135
|
+
}
|
|
85
136
|
let result;
|
|
86
137
|
try {
|
|
87
|
-
result = runSetup(pluginPath);
|
|
138
|
+
result = runSetup(pluginPath, undefined, detected.generation);
|
|
88
139
|
} catch (err) {
|
|
89
140
|
if (err instanceof UnparseableConfigError) {
|
|
90
141
|
console.error(`\x1B[31m✗ Could not parse ${err.configPath}\x1B[0m`);
|
|
@@ -93,16 +144,24 @@ if (args[0] === "setup") {
|
|
|
93
144
|
console.error(` "plugin": ["${pluginPath}"]`);
|
|
94
145
|
process.exit(1);
|
|
95
146
|
}
|
|
147
|
+
if (err instanceof DuplicateMeridianConfigError) {
|
|
148
|
+
console.error("\x1B[31m✗ Meridian is already present in the other OpenCode config file\x1B[0m");
|
|
149
|
+
console.error(` OpenCode loads both ${err.configPath} and ${err.siblingPath}.`);
|
|
150
|
+
console.error(` Remove the Meridian entry from ${err.siblingPath}, then re-run 'meridian setup'.`);
|
|
151
|
+
console.error(" Both files were left untouched.");
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
96
154
|
throw err;
|
|
97
155
|
}
|
|
156
|
+
const generationLabel = detected.generation === "v2" ? "OpenCode V2" : "OpenCode V1";
|
|
98
157
|
if (result.alreadyConfigured) {
|
|
99
|
-
console.log(`\x1B[32m✓ Meridian plugin already configured\x1B[0m`);
|
|
158
|
+
console.log(`\x1B[32m✓ Meridian plugin already configured for ${generationLabel}\x1B[0m`);
|
|
100
159
|
console.log(` ${result.configPath}`);
|
|
101
160
|
} else {
|
|
102
161
|
if (result.removedStale.length > 0) {
|
|
103
162
|
console.log(` Removed ${result.removedStale.length} stale plugin entr${result.removedStale.length === 1 ? "y" : "ies"}`);
|
|
104
163
|
}
|
|
105
|
-
console.log(`\x1B[32m✓ Meridian plugin configured\x1B[0m`);
|
|
164
|
+
console.log(`\x1B[32m✓ Meridian plugin configured for ${generationLabel}\x1B[0m`);
|
|
106
165
|
console.log(` Config: ${result.configPath}`);
|
|
107
166
|
console.log(` Plugin: ${result.pluginPath}`);
|
|
108
167
|
if (!result.created) {
|
|
@@ -146,7 +205,7 @@ async function runCli(start = startProxyServer, runAuthCheck = async () => {
|
|
|
146
205
|
return execFile(claudePath, ["auth", "status"], { timeout: 5000 });
|
|
147
206
|
}) {
|
|
148
207
|
try {
|
|
149
|
-
const { findOpencodeConfigPath, checkPluginConfigured, findPluginPath } = await import("./setup-
|
|
208
|
+
const { findOpencodeConfigPath, checkPluginConfigured, findPluginPath } = await import("./setup-4v3zg3c0.js");
|
|
150
209
|
const configPath = findOpencodeConfigPath();
|
|
151
210
|
const { existsSync } = await import("fs");
|
|
152
211
|
if (existsSync(configPath) && !checkPluginConfigured(configPath)) {
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import"./cli-p9swy5t3.js";
|
|
2
|
+
|
|
3
|
+
// node_modules/@opencode-ai/plugin/dist/promise/plugin.js
|
|
4
|
+
function define(plugin) {
|
|
5
|
+
return plugin;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// plugin/meridian-v2.ts
|
|
9
|
+
var SUPPORTED_OPENCODE_V2_VERSION = "0.0.0-beta-18314";
|
|
10
|
+
var MERIDIAN_PROVIDERS = new Set(["anthropic", "meridian"]);
|
|
11
|
+
var PARENT_SESSION_ONE_SHOTS = new Set(["title", "summary"]);
|
|
12
|
+
var ATTACHED_COMPACTION_AGENT = "compaction";
|
|
13
|
+
var SESSION_AFFINITY_HEADERS = [
|
|
14
|
+
"x-opencode-session",
|
|
15
|
+
"x-session-affinity",
|
|
16
|
+
"x-session-id",
|
|
17
|
+
"x-parent-session-id"
|
|
18
|
+
];
|
|
19
|
+
var MERIDIAN_CONTROL_HEADERS = [
|
|
20
|
+
"x-meridian-source",
|
|
21
|
+
"x-opencode-agent-name",
|
|
22
|
+
"x-opencode-agent-mode"
|
|
23
|
+
];
|
|
24
|
+
var BUILTIN_AGENT_TRAITS = {
|
|
25
|
+
build: { mode: "primary", hidden: false },
|
|
26
|
+
plan: { mode: "primary", hidden: false },
|
|
27
|
+
general: { mode: "subagent", hidden: false },
|
|
28
|
+
explore: { mode: "subagent", hidden: false },
|
|
29
|
+
title: { mode: "primary", hidden: true },
|
|
30
|
+
summary: { mode: "primary", hidden: true },
|
|
31
|
+
compaction: { mode: "primary", hidden: true }
|
|
32
|
+
};
|
|
33
|
+
function fallbackAgentTraits(agent) {
|
|
34
|
+
return BUILTIN_AGENT_TRAITS[agent] ?? { mode: "primary", hidden: false };
|
|
35
|
+
}
|
|
36
|
+
function deleteHeader(headers, name) {
|
|
37
|
+
if (headers instanceof Headers) {
|
|
38
|
+
headers.delete(name);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const lower = name.toLowerCase();
|
|
42
|
+
for (const key of Object.keys(headers)) {
|
|
43
|
+
if (key.toLowerCase() === lower)
|
|
44
|
+
delete headers[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function setHeader(headers, name, value) {
|
|
48
|
+
deleteHeader(headers, name);
|
|
49
|
+
if (headers instanceof Headers)
|
|
50
|
+
headers.set(name, value);
|
|
51
|
+
else
|
|
52
|
+
headers[name] = value;
|
|
53
|
+
}
|
|
54
|
+
function safeAgentName(agent) {
|
|
55
|
+
return agent.replace(/[^\x20-\x7E]/g, "").trim() || "unknown";
|
|
56
|
+
}
|
|
57
|
+
function shouldDetachFromParentSession(agent, _traits) {
|
|
58
|
+
return PARENT_SESSION_ONE_SHOTS.has(agent);
|
|
59
|
+
}
|
|
60
|
+
function applyMeridianV2Headers(headers, input) {
|
|
61
|
+
for (const name2 of SESSION_AFFINITY_HEADERS)
|
|
62
|
+
deleteHeader(headers, name2);
|
|
63
|
+
for (const name2 of MERIDIAN_CONTROL_HEADERS)
|
|
64
|
+
deleteHeader(headers, name2);
|
|
65
|
+
const name = safeAgentName(input.agent);
|
|
66
|
+
const detached = shouldDetachFromParentSession(input.agent, input.traits);
|
|
67
|
+
if (detached) {
|
|
68
|
+
setHeader(headers, "x-meridian-source", `subagent-${name}`);
|
|
69
|
+
} else {
|
|
70
|
+
setHeader(headers, "x-opencode-session", input.sessionID);
|
|
71
|
+
setHeader(headers, "x-session-affinity", input.sessionID);
|
|
72
|
+
setHeader(headers, "x-session-id", input.sessionID);
|
|
73
|
+
if (input.agent === ATTACHED_COMPACTION_AGENT) {
|
|
74
|
+
setHeader(headers, "x-meridian-source", "subagent-compaction");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const internalMode = PARENT_SESSION_ONE_SHOTS.has(input.agent) ? "subagent" : input.agent === ATTACHED_COMPACTION_AGENT ? "primary" : input.traits.mode;
|
|
78
|
+
setHeader(headers, "x-opencode-agent-name", name);
|
|
79
|
+
setHeader(headers, "x-opencode-agent-mode", internalMode);
|
|
80
|
+
}
|
|
81
|
+
var MeridianV2Plugin = define({
|
|
82
|
+
id: "meridian",
|
|
83
|
+
setup: async (context) => {
|
|
84
|
+
const traitsByAgent = new Map;
|
|
85
|
+
const registered = [];
|
|
86
|
+
const resolveAgentTraits = (agent) => {
|
|
87
|
+
const cached = traitsByAgent.get(agent);
|
|
88
|
+
if (cached && cached.expiresAt > Date.now())
|
|
89
|
+
return cached.pending;
|
|
90
|
+
const pending = Promise.resolve().then(() => context.agent.get({ agentID: agent })).then(({ data }) => ({
|
|
91
|
+
mode: data.mode === "subagent" ? "subagent" : "primary",
|
|
92
|
+
hidden: data.hidden
|
|
93
|
+
})).catch(() => {
|
|
94
|
+
if (traitsByAgent.get(agent)?.pending === pending)
|
|
95
|
+
traitsByAgent.delete(agent);
|
|
96
|
+
return fallbackAgentTraits(agent);
|
|
97
|
+
});
|
|
98
|
+
traitsByAgent.set(agent, { expiresAt: Date.now() + 5000, pending });
|
|
99
|
+
return pending;
|
|
100
|
+
};
|
|
101
|
+
const apply = async (input, headers) => {
|
|
102
|
+
if (!MERIDIAN_PROVIDERS.has(String(input.model.providerID)))
|
|
103
|
+
return;
|
|
104
|
+
const agent = String(input.agent);
|
|
105
|
+
applyMeridianV2Headers(headers, {
|
|
106
|
+
sessionID: String(input.sessionID),
|
|
107
|
+
agent,
|
|
108
|
+
traits: await resolveAgentTraits(agent)
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
try {
|
|
112
|
+
for (const providerID of MERIDIAN_PROVIDERS) {
|
|
113
|
+
registered.push(await context.session.hook("model.request", async (input) => {
|
|
114
|
+
await apply(input, input.headers);
|
|
115
|
+
}, { providerID }));
|
|
116
|
+
registered.push(await context.session.hook("http.request", async (input) => {
|
|
117
|
+
await apply(input, input.request.headers);
|
|
118
|
+
}, { providerID }));
|
|
119
|
+
}
|
|
120
|
+
} catch (error) {
|
|
121
|
+
await Promise.allSettled(registered.map(({ dispose }) => dispose()));
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
return async () => {
|
|
125
|
+
const results = await Promise.allSettled(registered.map(({ dispose }) => dispose()));
|
|
126
|
+
const failures = results.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
127
|
+
if (failures.length > 0)
|
|
128
|
+
throw new AggregateError(failures, "Failed to dispose Meridian V2 hooks");
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
var meridian_v2_default = MeridianV2Plugin;
|
|
133
|
+
export {
|
|
134
|
+
shouldDetachFromParentSession,
|
|
135
|
+
fallbackAgentTraits,
|
|
136
|
+
meridian_v2_default as default,
|
|
137
|
+
applyMeridianV2Headers,
|
|
138
|
+
SUPPORTED_OPENCODE_V2_VERSION
|
|
139
|
+
};
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
profileLogin,
|
|
14
14
|
profileRemove,
|
|
15
15
|
profileSwitch
|
|
16
|
-
} from "./cli-
|
|
17
|
-
import"./cli-vj9cv18n.js";
|
|
16
|
+
} from "./cli-0ed6j0vk.js";
|
|
18
17
|
import"./cli-khhjyk04.js";
|
|
18
|
+
import"./cli-vj9cv18n.js";
|
|
19
19
|
import"./cli-p9swy5t3.js";
|
|
20
20
|
export {
|
|
21
21
|
profileSwitch,
|
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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CAAA;IAEhF;;;OAGG;IACH,aAAa,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAA;IAE9D;;;OAGG;IACH,0BAA0B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAA;IAE9E;;;;;;OAMG;IACH,gBAAgB,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAA;IAErC;;;;;;;;OAQG;IACH,eAAe,CAAC,IAAI,OAAO,CAAA;IAE3B;;;;;;;OAOG;IACH,gBAAgB,CAAC,IAAI,SAAS,MAAM,EAAE,CAAA;IAEtC;;;;;;;;;;;;;;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;;;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AG,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,GA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MAAM,GAAG,OAAO,CAGjE;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAAA;IAC9E,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;wCAEoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAuBD;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,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"}
|
|
@@ -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,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,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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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthroughTools.d.ts","sourceRoot":"","sources":["../../src/proxy/passthroughTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,eAAO,MAAM,oBAAoB,OAAO,CAAA;AACxC,eAAO,MAAM,sBAAsB,cAAmC,CAAA;AA0CtE,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,GAAG,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EACjG,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE;;;;
|
|
1
|
+
{"version":3,"file":"passthroughTools.d.ts","sourceRoot":"","sources":["../../src/proxy/passthroughTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,eAAO,MAAM,oBAAoB,OAAO,CAAA;AACxC,eAAO,MAAM,sBAAsB,cAAmC,CAAA;AA0CtE,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,GAAG,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EACjG,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE;;;;EA8ClC;AAqBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAC9E,MAAM,CASR;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAErE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKvD;AAUD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC1C,YAAY,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,GACtF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAgCrC"}
|
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) */
|