@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.
Files changed (61) hide show
  1. package/README.md +3 -2
  2. package/bin/meridian-launchd.sh +128 -0
  3. package/dist/{cli-21w6xm0d.js → cli-4ghkaajs.js} +27332 -12903
  4. package/dist/{cli-xmweegb1.js → cli-8yp89fan.js} +52 -0
  5. package/dist/cli-pbvm9kc2.js +760 -0
  6. package/dist/cli.js +71 -12
  7. package/dist/meridian-v2.js +139 -0
  8. package/dist/{pluginPage-03q5j753.js → pluginPage-n3gdtbmj.js} +1 -1
  9. package/dist/{profileCli-39vshwdn.js → profileCli-ap7eg985.js} +2 -2
  10. package/dist/{profilePage-gtazq15d.js → profilePage-vfj2dbhn.js} +1 -1
  11. package/dist/proxy/adapter.d.ts +13 -0
  12. package/dist/proxy/adapter.d.ts.map +1 -1
  13. package/dist/proxy/adapters/opencode.d.ts +7 -0
  14. package/dist/proxy/adapters/opencode.d.ts.map +1 -1
  15. package/dist/proxy/buildInfo.d.ts +94 -0
  16. package/dist/proxy/buildInfo.d.ts.map +1 -0
  17. package/dist/proxy/cwd.d.ts.map +1 -1
  18. package/dist/proxy/errors.d.ts.map +1 -1
  19. package/dist/proxy/passthroughDenial.d.ts +17 -0
  20. package/dist/proxy/passthroughDenial.d.ts.map +1 -0
  21. package/dist/proxy/passthroughEarlyStop.d.ts +52 -7
  22. package/dist/proxy/passthroughEarlyStop.d.ts.map +1 -1
  23. package/dist/proxy/passthroughTools.d.ts.map +1 -1
  24. package/dist/proxy/query.d.ts +8 -0
  25. package/dist/proxy/query.d.ts.map +1 -1
  26. package/dist/proxy/server.d.ts.map +1 -1
  27. package/dist/proxy/session/cache.d.ts +11 -2
  28. package/dist/proxy/session/cache.d.ts.map +1 -1
  29. package/dist/proxy/session/crossProcessTurnCoordinator.d.ts +40 -0
  30. package/dist/proxy/session/crossProcessTurnCoordinator.d.ts.map +1 -0
  31. package/dist/proxy/session/durableFileSystem.d.ts +21 -0
  32. package/dist/proxy/session/durableFileSystem.d.ts.map +1 -0
  33. package/dist/proxy/session/lineage.d.ts +20 -0
  34. package/dist/proxy/session/lineage.d.ts.map +1 -1
  35. package/dist/proxy/session/processIncarnation.d.ts +46 -0
  36. package/dist/proxy/session/processIncarnation.d.ts.map +1 -0
  37. package/dist/proxy/session/recoveryClaim.d.ts +19 -0
  38. package/dist/proxy/session/recoveryClaim.d.ts.map +1 -0
  39. package/dist/proxy/session/sdkProcessGate.d.ts +19 -0
  40. package/dist/proxy/session/sdkProcessGate.d.ts.map +1 -0
  41. package/dist/proxy/sessionLifecycle.d.ts +105 -0
  42. package/dist/proxy/sessionLifecycle.d.ts.map +1 -0
  43. package/dist/proxy/sessionStore.d.ts +53 -7
  44. package/dist/proxy/sessionStore.d.ts.map +1 -1
  45. package/dist/proxy/setup.d.ts +35 -10
  46. package/dist/proxy/setup.d.ts.map +1 -1
  47. package/dist/proxy/types.d.ts +4 -0
  48. package/dist/proxy/types.d.ts.map +1 -1
  49. package/dist/proxy/updateCheck.d.ts +31 -0
  50. package/dist/proxy/updateCheck.d.ts.map +1 -0
  51. package/dist/server.js +5 -5
  52. package/dist/setup-4v3zg3c0.js +33 -0
  53. package/dist/telemetry/profileBar.d.ts +3 -3
  54. package/dist/telemetry/profileBar.d.ts.map +1 -1
  55. package/dist/telemetry/settingsPage.d.ts +1 -1
  56. package/dist/telemetry/settingsPage.d.ts.map +1 -1
  57. package/package.json +10 -5
  58. package/plugin/meridian-v2.ts +190 -0
  59. package/dist/cli-pc0mtjjv.js +0 -167
  60. package/dist/setup-0x573t61.js +0 -19
  61. package/dist/{cli-xfbhn15a.js → cli-0ed6j0vk.js} +3 -3
@@ -1,167 +0,0 @@
1
- // src/proxy/setup.ts
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
3
- import { homedir, platform } from "os";
4
- import { dirname, join } from "path";
5
- import { fileURLToPath } from "url";
6
- import { applyEdits, modify, parse as parseJsonc } from "jsonc-parser";
7
-
8
- // src/utils/lruMap.ts
9
- class LRUMap {
10
- maxSize;
11
- onEvict;
12
- map = new Map;
13
- constructor(maxSize, onEvict) {
14
- this.maxSize = maxSize;
15
- this.onEvict = onEvict;
16
- }
17
- get size() {
18
- return this.map.size;
19
- }
20
- get(key) {
21
- const value = this.map.get(key);
22
- if (value === undefined)
23
- return;
24
- this.map.delete(key);
25
- this.map.set(key, value);
26
- return value;
27
- }
28
- set(key, value) {
29
- if (this.map.has(key)) {
30
- this.map.delete(key);
31
- } else if (this.map.size >= this.maxSize) {
32
- this.evictOldest();
33
- }
34
- this.map.set(key, value);
35
- return this;
36
- }
37
- has(key) {
38
- return this.map.has(key);
39
- }
40
- delete(key) {
41
- return this.map.delete(key);
42
- }
43
- clear() {
44
- this.map.clear();
45
- }
46
- entries() {
47
- return this.map.entries();
48
- }
49
- keys() {
50
- return this.map.keys();
51
- }
52
- values() {
53
- return this.map.values();
54
- }
55
- forEach(callbackfn) {
56
- this.map.forEach((value, key) => callbackfn(value, key, this));
57
- }
58
- [Symbol.iterator]() {
59
- return this.map[Symbol.iterator]();
60
- }
61
- evictOldest() {
62
- const oldestKey = this.map.keys().next().value;
63
- if (oldestKey === undefined)
64
- return;
65
- const oldestValue = this.map.get(oldestKey);
66
- if (oldestValue === undefined)
67
- return;
68
- this.map.delete(oldestKey);
69
- this.onEvict?.(oldestKey, oldestValue);
70
- }
71
- }
72
-
73
- // src/proxy/setup.ts
74
- class UnparseableConfigError extends Error {
75
- configPath;
76
- constructor(configPath) {
77
- super(`Could not parse ${configPath} — it may contain a syntax error.`);
78
- this.configPath = configPath;
79
- this.name = "UnparseableConfigError";
80
- }
81
- }
82
- function parseOpencodeConfig(text) {
83
- const errors = [];
84
- const parsed = parseJsonc(text, errors, { allowTrailingComma: true });
85
- if (errors.length > 0 || parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
86
- return null;
87
- }
88
- return parsed;
89
- }
90
- function findOpencodeConfigPath() {
91
- if (process.env.OPENCODE_CONFIG_DIR) {
92
- return join(process.env.OPENCODE_CONFIG_DIR, "opencode.json");
93
- }
94
- if (process.env.XDG_CONFIG_HOME) {
95
- return join(process.env.XDG_CONFIG_HOME, "opencode", "opencode.json");
96
- }
97
- if (platform() === "win32" && process.env.APPDATA) {
98
- return join(process.env.APPDATA, "opencode", "opencode.json");
99
- }
100
- return join(homedir(), ".config", "opencode", "opencode.json");
101
- }
102
- function findPluginPath(fromUrl) {
103
- const dir = dirname(fileURLToPath(fromUrl));
104
- return join(dir, "..", "plugin", "meridian.ts");
105
- }
106
- var STALE_PATTERNS = [
107
- "opencode-claude-max-proxy",
108
- "claude-max-headers",
109
- "meridian-agent-mode"
110
- ];
111
- function isMeridianEntry(entry) {
112
- return STALE_PATTERNS.some((p) => entry.includes(p)) || entry.includes("meridian.ts") || entry.includes("@rynfar/meridian");
113
- }
114
- function checkPluginConfigured(configPath) {
115
- const path = configPath ?? findOpencodeConfigPath();
116
- if (!existsSync(path))
117
- return false;
118
- const config = parseOpencodeConfig(readFileSync(path, "utf-8"));
119
- if (config === null)
120
- return false;
121
- const plugins = Array.isArray(config.plugin) ? config.plugin : [];
122
- return plugins.some((p) => typeof p === "string" && isMeridianEntry(p));
123
- }
124
- var pluginlessWarned = new LRUMap(256);
125
- function clearPluginlessWarnings() {
126
- pluginlessWarned.clear();
127
- }
128
- function notePluginlessOpenCodeRequest(input) {
129
- if (!input.userAgent?.toLowerCase().startsWith("opencode/"))
130
- return;
131
- if (input.agentModeHeader)
132
- return;
133
- const key = input.sessionId || "(keyless)";
134
- if (pluginlessWarned.get(key))
135
- return;
136
- pluginlessWarned.set(key, true);
137
- const shortId = input.sessionId ? `${input.sessionId.slice(0, 12)}…` : "(no session header)";
138
- return `OpenCode request without the Meridian plugin's agent headers (session ${shortId}). ` + `OpenCode runs its internal title/summary agents under your session id, so Meridian ` + `cannot tell them apart from your conversation: the first turn of each session can fail ` + `with a 400 or replay against a cold cache. Fix: meridian setup (or update the plugin).`;
139
- }
140
- function runSetup(pluginPath, configPath) {
141
- const path = configPath ?? findOpencodeConfigPath();
142
- const dir = dirname(path);
143
- if (!existsSync(path)) {
144
- if (!existsSync(dir))
145
- mkdirSync(dir, { recursive: true });
146
- writeFileSync(path, `${JSON.stringify({ plugin: [pluginPath] }, null, 2)}
147
- `, "utf-8");
148
- return { configPath: path, pluginPath, alreadyConfigured: false, removedStale: [], created: true };
149
- }
150
- const text = readFileSync(path, "utf-8");
151
- const config = parseOpencodeConfig(text);
152
- if (config === null) {
153
- throw new UnparseableConfigError(path);
154
- }
155
- const existing = Array.isArray(config.plugin) ? config.plugin.filter((p) => typeof p === "string") : [];
156
- const removedStale = existing.filter(isMeridianEntry);
157
- const others = existing.filter((p) => !isMeridianEntry(p));
158
- const alreadyConfigured = removedStale.some((p) => p === pluginPath);
159
- const newPlugins = [...others, pluginPath];
160
- const edits = modify(text, ["plugin"], newPlugins, {
161
- formattingOptions: { insertSpaces: true, tabSize: 2 }
162
- });
163
- writeFileSync(path, applyEdits(text, edits), "utf-8");
164
- return { configPath: path, pluginPath, alreadyConfigured, removedStale, created: false };
165
- }
166
-
167
- export { LRUMap, UnparseableConfigError, findOpencodeConfigPath, findPluginPath, checkPluginConfigured, clearPluginlessWarnings, notePluginlessOpenCodeRequest, runSetup };
@@ -1,19 +0,0 @@
1
- import {
2
- UnparseableConfigError,
3
- checkPluginConfigured,
4
- clearPluginlessWarnings,
5
- findOpencodeConfigPath,
6
- findPluginPath,
7
- notePluginlessOpenCodeRequest,
8
- runSetup
9
- } from "./cli-pc0mtjjv.js";
10
- import"./cli-p9swy5t3.js";
11
- export {
12
- runSetup,
13
- notePluginlessOpenCodeRequest,
14
- findPluginPath,
15
- findOpencodeConfigPath,
16
- clearPluginlessWarnings,
17
- checkPluginConfigured,
18
- UnparseableConfigError
19
- };
@@ -1,9 +1,9 @@
1
- import {
2
- setSetting
3
- } from "./cli-vj9cv18n.js";
4
1
  import {
5
2
  createPlatformCredentialStore
6
3
  } from "./cli-khhjyk04.js";
4
+ import {
5
+ setSetting
6
+ } from "./cli-vj9cv18n.js";
7
7
  import {
8
8
  __esm
9
9
  } from "./cli-p9swy5t3.js";