@rynfar/meridian 1.70.0 → 1.71.1
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/dist/{cli-zdbv40d5.js → cli-hxxy0m1z.js} +8 -5
- package/dist/{cli-198xnjcn.js → cli-ryt69ryf.js} +182 -17
- package/dist/cli.js +4 -4
- package/dist/meridian/index.js +4 -1
- package/dist/meridian-v2/index.js +126 -10
- package/dist/meridian-v2.js +133 -10
- package/dist/proxy/errors.d.ts +55 -0
- package/dist/proxy/errors.d.ts.map +1 -1
- package/dist/proxy/requestAbort.d.ts +36 -0
- package/dist/proxy/requestAbort.d.ts.map +1 -1
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/proxy/setup.d.ts +13 -0
- package/dist/proxy/setup.d.ts.map +1 -1
- package/dist/server.js +2 -2
- package/dist/{setup-b3ymd9z8.js → setup-ndmjpy23.js} +3 -1
- package/package.json +1 -1
- package/plugin/meridian-v2.ts +224 -10
- package/plugin/priority-attestation.ts +11 -1
|
@@ -20192,6 +20192,10 @@ var Info6 = exports_Schema.Struct({
|
|
|
20192
20192
|
})
|
|
20193
20193
|
})));
|
|
20194
20194
|
|
|
20195
|
+
// plugin/meridian-v2.ts
|
|
20196
|
+
import { readFileSync as readFileSync2, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
20197
|
+
import { join as join3 } from "node:path";
|
|
20198
|
+
|
|
20195
20199
|
// plugin/priority-attestation.ts
|
|
20196
20200
|
import { createHash, createHmac } from "node:crypto";
|
|
20197
20201
|
import { readFileSync } from "node:fs";
|
|
@@ -20207,9 +20211,12 @@ var MAX_HEADER_BYTES = 768;
|
|
|
20207
20211
|
var MAX_PAYLOAD_BYTES = 384;
|
|
20208
20212
|
var TURN_DIGEST_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
20209
20213
|
var SAFE_ID_PATTERN = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
20210
|
-
function
|
|
20214
|
+
function meridianConfigDirectory() {
|
|
20211
20215
|
return process.env.MERIDIAN_CONFIG_DIR ?? join2(homedir(), ".config", "meridian");
|
|
20212
20216
|
}
|
|
20217
|
+
function configDirectory() {
|
|
20218
|
+
return meridianConfigDirectory();
|
|
20219
|
+
}
|
|
20213
20220
|
function priorityAttestationKeyPath() {
|
|
20214
20221
|
return join2(configDirectory(), PRIORITY_ATTESTATION_KEY_FILE);
|
|
20215
20222
|
}
|
|
@@ -20307,6 +20314,9 @@ var PARENT_SESSION_ONE_SHOTS = new Set(["title", "summary"]);
|
|
|
20307
20314
|
var ATTACHED_COMPACTION_AGENT = "compaction";
|
|
20308
20315
|
var MODEL_DISCOVERY_TIMEOUT_MS = 3000;
|
|
20309
20316
|
var PROVIDER_READY_POLL_MS = 25;
|
|
20317
|
+
var CATALOG_CACHE_FILE = "opencode-v2-catalog.json";
|
|
20318
|
+
var CATALOG_CACHE_VERSION = 1;
|
|
20319
|
+
var CATALOG_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
20310
20320
|
var MERIDIAN_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
20311
20321
|
var SESSION_AFFINITY_HEADERS = [
|
|
20312
20322
|
"x-opencode-session",
|
|
@@ -20465,15 +20475,109 @@ async function loadMeridianModels(catalog, signal, fetcher = globalThis.fetch) {
|
|
|
20465
20475
|
if (configured.length > 0) {
|
|
20466
20476
|
const discovered = await Promise.all(configured.map(async ({ providerID, baseURL }) => {
|
|
20467
20477
|
const models = await fetchMeridianModels(baseURL, signal, fetcher);
|
|
20468
|
-
return models ? { providerID, models } : undefined;
|
|
20478
|
+
return models ? { providerID, baseURL: typeof baseURL === "string" ? baseURL : undefined, models } : undefined;
|
|
20469
20479
|
}));
|
|
20470
|
-
return
|
|
20480
|
+
return {
|
|
20481
|
+
configured: configured.map((provider) => provider.providerID),
|
|
20482
|
+
discovered: discovered.flatMap((result3) => result3 ? [result3] : [])
|
|
20483
|
+
};
|
|
20471
20484
|
}
|
|
20472
20485
|
if (Date.now() >= deadline)
|
|
20473
|
-
return [];
|
|
20486
|
+
return { configured: [], discovered: [] };
|
|
20474
20487
|
await new Promise((resolve2) => setTimeout(resolve2, PROVIDER_READY_POLL_MS));
|
|
20475
20488
|
}
|
|
20476
|
-
return [];
|
|
20489
|
+
return { configured: [], discovered: [] };
|
|
20490
|
+
}
|
|
20491
|
+
function catalogCachePath() {
|
|
20492
|
+
return join3(meridianConfigDirectory(), CATALOG_CACHE_FILE);
|
|
20493
|
+
}
|
|
20494
|
+
function parseCatalogCache(value3, now3) {
|
|
20495
|
+
const entries3 = new Map;
|
|
20496
|
+
if (!isRecord(value3) || value3.version !== CATALOG_CACHE_VERSION)
|
|
20497
|
+
return entries3;
|
|
20498
|
+
if (!isRecord(value3.providers))
|
|
20499
|
+
return entries3;
|
|
20500
|
+
for (const [providerID, entry] of Object.entries(value3.providers)) {
|
|
20501
|
+
if (!MERIDIAN_PROVIDERS.has(providerID) || !isRecord(entry))
|
|
20502
|
+
continue;
|
|
20503
|
+
const { baseURL, fetchedAt } = entry;
|
|
20504
|
+
if (typeof baseURL !== "string" || meridianModelsURL(baseURL) === undefined)
|
|
20505
|
+
continue;
|
|
20506
|
+
if (typeof fetchedAt !== "number" || !Number.isSafeInteger(fetchedAt) || fetchedAt <= 0)
|
|
20507
|
+
continue;
|
|
20508
|
+
if (fetchedAt > now3 || now3 - fetchedAt > CATALOG_CACHE_TTL_MS)
|
|
20509
|
+
continue;
|
|
20510
|
+
const models = parseCachedModels(entry.models);
|
|
20511
|
+
if (!models || models.length === 0)
|
|
20512
|
+
continue;
|
|
20513
|
+
entries3.set(providerID, { baseURL, models });
|
|
20514
|
+
}
|
|
20515
|
+
return entries3;
|
|
20516
|
+
}
|
|
20517
|
+
function parseCachedModels(value3) {
|
|
20518
|
+
if (!Array.isArray(value3))
|
|
20519
|
+
return;
|
|
20520
|
+
const models = [];
|
|
20521
|
+
const ids = new Set;
|
|
20522
|
+
for (const item of value3) {
|
|
20523
|
+
if (!isRecord(item))
|
|
20524
|
+
return;
|
|
20525
|
+
const { id: id2, name, contextWindow, efforts } = item;
|
|
20526
|
+
if (typeof id2 !== "string" || id2.length === 0 || id2.length > 256 || /[^\x21-\x7E]/.test(id2) || ids.has(id2) || typeof name !== "string" || name.trim().length === 0 || name.length > 256 || typeof contextWindow !== "number" || !Number.isSafeInteger(contextWindow) || contextWindow <= 0 || !Array.isArray(efforts) || efforts.some((effort) => typeof effort !== "string" || !MERIDIAN_EFFORTS.includes(effort))) {
|
|
20527
|
+
return;
|
|
20528
|
+
}
|
|
20529
|
+
ids.add(id2);
|
|
20530
|
+
models.push({ id: id2, name, contextWindow, efforts });
|
|
20531
|
+
}
|
|
20532
|
+
return models;
|
|
20533
|
+
}
|
|
20534
|
+
function serializeCatalogCache(discovered, now3) {
|
|
20535
|
+
const providers = {};
|
|
20536
|
+
for (const entry of discovered) {
|
|
20537
|
+
if (typeof entry.baseURL !== "string" || entry.models.length === 0)
|
|
20538
|
+
continue;
|
|
20539
|
+
providers[entry.providerID] = { baseURL: entry.baseURL, fetchedAt: now3, models: entry.models };
|
|
20540
|
+
}
|
|
20541
|
+
return `${JSON.stringify({ version: CATALOG_CACHE_VERSION, providers }, null, 2)}
|
|
20542
|
+
`;
|
|
20543
|
+
}
|
|
20544
|
+
function removeCatalogCache(remove4 = (path) => rmSync(path, { force: true })) {
|
|
20545
|
+
try {
|
|
20546
|
+
remove4(catalogCachePath());
|
|
20547
|
+
} catch {}
|
|
20548
|
+
}
|
|
20549
|
+
function readCatalogCache(now3, read = (path) => readFileSync2(path, "utf-8")) {
|
|
20550
|
+
try {
|
|
20551
|
+
return parseCatalogCache(JSON.parse(read(catalogCachePath())), now3);
|
|
20552
|
+
} catch {
|
|
20553
|
+
return new Map;
|
|
20554
|
+
}
|
|
20555
|
+
}
|
|
20556
|
+
function writeCatalogCache(discovered, now3, write = (path, contents) => {
|
|
20557
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
20558
|
+
writeFileSync(temporary, contents, { encoding: "utf-8", mode: 384 });
|
|
20559
|
+
renameSync(temporary, path);
|
|
20560
|
+
}) {
|
|
20561
|
+
try {
|
|
20562
|
+
const contents = serializeCatalogCache(discovered, now3);
|
|
20563
|
+
if (contents.includes('"providers": {}'))
|
|
20564
|
+
return;
|
|
20565
|
+
write(catalogCachePath(), contents);
|
|
20566
|
+
} catch {}
|
|
20567
|
+
}
|
|
20568
|
+
function resolveCatalogModels(catalog, discovered, cached3) {
|
|
20569
|
+
if (discovered.length > 0)
|
|
20570
|
+
return [...discovered];
|
|
20571
|
+
const seeded = [];
|
|
20572
|
+
for (const providerID of MERIDIAN_PROVIDERS) {
|
|
20573
|
+
const entry = cached3.get(providerID);
|
|
20574
|
+
if (!entry)
|
|
20575
|
+
continue;
|
|
20576
|
+
if (!catalog.provider.get(providerID))
|
|
20577
|
+
continue;
|
|
20578
|
+
seeded.push({ providerID, baseURL: entry.baseURL, models: [...entry.models] });
|
|
20579
|
+
}
|
|
20580
|
+
return seeded;
|
|
20477
20581
|
}
|
|
20478
20582
|
function applyMeridianModels(catalog, providerID, models) {
|
|
20479
20583
|
for (const model of models) {
|
|
@@ -20533,19 +20637,31 @@ var MeridianV2Plugin = define({
|
|
|
20533
20637
|
const modelDiscoveryController = new AbortController;
|
|
20534
20638
|
let discoveredModels = [];
|
|
20535
20639
|
let discoveryStarted = false;
|
|
20640
|
+
const cachedModels = readCatalogCache(Date.now());
|
|
20536
20641
|
registered.push(await context3.catalog.transform((catalog) => {
|
|
20537
|
-
for (const
|
|
20538
|
-
applyMeridianModels(catalog,
|
|
20642
|
+
for (const entry of resolveCatalogModels(catalog, discoveredModels, cachedModels)) {
|
|
20643
|
+
applyMeridianModels(catalog, entry.providerID, entry.models);
|
|
20539
20644
|
}
|
|
20540
20645
|
}));
|
|
20541
20646
|
const discoverModels = async () => {
|
|
20542
20647
|
if (discoveryStarted || modelDiscoveryController.signal.aborted)
|
|
20543
20648
|
return false;
|
|
20544
|
-
const
|
|
20545
|
-
if (
|
|
20649
|
+
const loaded = await loadMeridianModels(context3.catalog, modelDiscoveryController.signal).catch(() => ({ configured: [], discovered: [] }));
|
|
20650
|
+
if (modelDiscoveryController.signal.aborted)
|
|
20651
|
+
return false;
|
|
20652
|
+
if (loaded.configured.length === 0) {
|
|
20653
|
+
if (cachedModels.size > 0) {
|
|
20654
|
+
cachedModels.clear();
|
|
20655
|
+
removeCatalogCache();
|
|
20656
|
+
await context3.catalog.reload();
|
|
20657
|
+
}
|
|
20658
|
+
return false;
|
|
20659
|
+
}
|
|
20660
|
+
if (loaded.discovered.length === 0)
|
|
20546
20661
|
return false;
|
|
20547
20662
|
discoveryStarted = true;
|
|
20548
|
-
discoveredModels =
|
|
20663
|
+
discoveredModels = loaded.discovered;
|
|
20664
|
+
writeCatalogCache(loaded.discovered, Date.now());
|
|
20549
20665
|
await context3.catalog.reload();
|
|
20550
20666
|
return true;
|
|
20551
20667
|
};
|
package/dist/meridian-v2.js
CHANGED
|
@@ -20181,6 +20181,10 @@ var Info6 = exports_Schema.Struct({
|
|
|
20181
20181
|
})
|
|
20182
20182
|
})));
|
|
20183
20183
|
|
|
20184
|
+
// plugin/meridian-v2.ts
|
|
20185
|
+
import { readFileSync as readFileSync2, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
20186
|
+
import { join as join3 } from "node:path";
|
|
20187
|
+
|
|
20184
20188
|
// plugin/priority-attestation.ts
|
|
20185
20189
|
import { createHash, createHmac } from "node:crypto";
|
|
20186
20190
|
import { readFileSync } from "node:fs";
|
|
@@ -20196,9 +20200,12 @@ var MAX_HEADER_BYTES = 768;
|
|
|
20196
20200
|
var MAX_PAYLOAD_BYTES = 384;
|
|
20197
20201
|
var TURN_DIGEST_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
20198
20202
|
var SAFE_ID_PATTERN = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
20199
|
-
function
|
|
20203
|
+
function meridianConfigDirectory() {
|
|
20200
20204
|
return process.env.MERIDIAN_CONFIG_DIR ?? join2(homedir(), ".config", "meridian");
|
|
20201
20205
|
}
|
|
20206
|
+
function configDirectory() {
|
|
20207
|
+
return meridianConfigDirectory();
|
|
20208
|
+
}
|
|
20202
20209
|
function priorityAttestationKeyPath() {
|
|
20203
20210
|
return join2(configDirectory(), PRIORITY_ATTESTATION_KEY_FILE);
|
|
20204
20211
|
}
|
|
@@ -20297,6 +20304,9 @@ var PARENT_SESSION_ONE_SHOTS = new Set(["title", "summary"]);
|
|
|
20297
20304
|
var ATTACHED_COMPACTION_AGENT = "compaction";
|
|
20298
20305
|
var MODEL_DISCOVERY_TIMEOUT_MS = 3000;
|
|
20299
20306
|
var PROVIDER_READY_POLL_MS = 25;
|
|
20307
|
+
var CATALOG_CACHE_FILE = "opencode-v2-catalog.json";
|
|
20308
|
+
var CATALOG_CACHE_VERSION = 1;
|
|
20309
|
+
var CATALOG_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
20300
20310
|
var MERIDIAN_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
20301
20311
|
var MERIDIAN_V2_EFFORTS = MERIDIAN_EFFORTS;
|
|
20302
20312
|
var SESSION_AFFINITY_HEADERS = [
|
|
@@ -20456,15 +20466,109 @@ async function loadMeridianModels(catalog, signal, fetcher = globalThis.fetch) {
|
|
|
20456
20466
|
if (configured.length > 0) {
|
|
20457
20467
|
const discovered = await Promise.all(configured.map(async ({ providerID, baseURL }) => {
|
|
20458
20468
|
const models = await fetchMeridianModels(baseURL, signal, fetcher);
|
|
20459
|
-
return models ? { providerID, models } : undefined;
|
|
20469
|
+
return models ? { providerID, baseURL: typeof baseURL === "string" ? baseURL : undefined, models } : undefined;
|
|
20460
20470
|
}));
|
|
20461
|
-
return
|
|
20471
|
+
return {
|
|
20472
|
+
configured: configured.map((provider) => provider.providerID),
|
|
20473
|
+
discovered: discovered.flatMap((result3) => result3 ? [result3] : [])
|
|
20474
|
+
};
|
|
20462
20475
|
}
|
|
20463
20476
|
if (Date.now() >= deadline)
|
|
20464
|
-
return [];
|
|
20477
|
+
return { configured: [], discovered: [] };
|
|
20465
20478
|
await new Promise((resolve2) => setTimeout(resolve2, PROVIDER_READY_POLL_MS));
|
|
20466
20479
|
}
|
|
20467
|
-
return [];
|
|
20480
|
+
return { configured: [], discovered: [] };
|
|
20481
|
+
}
|
|
20482
|
+
function catalogCachePath() {
|
|
20483
|
+
return join3(meridianConfigDirectory(), CATALOG_CACHE_FILE);
|
|
20484
|
+
}
|
|
20485
|
+
function parseCatalogCache(value3, now3) {
|
|
20486
|
+
const entries3 = new Map;
|
|
20487
|
+
if (!isRecord(value3) || value3.version !== CATALOG_CACHE_VERSION)
|
|
20488
|
+
return entries3;
|
|
20489
|
+
if (!isRecord(value3.providers))
|
|
20490
|
+
return entries3;
|
|
20491
|
+
for (const [providerID, entry] of Object.entries(value3.providers)) {
|
|
20492
|
+
if (!MERIDIAN_PROVIDERS.has(providerID) || !isRecord(entry))
|
|
20493
|
+
continue;
|
|
20494
|
+
const { baseURL, fetchedAt } = entry;
|
|
20495
|
+
if (typeof baseURL !== "string" || meridianModelsURL(baseURL) === undefined)
|
|
20496
|
+
continue;
|
|
20497
|
+
if (typeof fetchedAt !== "number" || !Number.isSafeInteger(fetchedAt) || fetchedAt <= 0)
|
|
20498
|
+
continue;
|
|
20499
|
+
if (fetchedAt > now3 || now3 - fetchedAt > CATALOG_CACHE_TTL_MS)
|
|
20500
|
+
continue;
|
|
20501
|
+
const models = parseCachedModels(entry.models);
|
|
20502
|
+
if (!models || models.length === 0)
|
|
20503
|
+
continue;
|
|
20504
|
+
entries3.set(providerID, { baseURL, models });
|
|
20505
|
+
}
|
|
20506
|
+
return entries3;
|
|
20507
|
+
}
|
|
20508
|
+
function parseCachedModels(value3) {
|
|
20509
|
+
if (!Array.isArray(value3))
|
|
20510
|
+
return;
|
|
20511
|
+
const models = [];
|
|
20512
|
+
const ids = new Set;
|
|
20513
|
+
for (const item of value3) {
|
|
20514
|
+
if (!isRecord(item))
|
|
20515
|
+
return;
|
|
20516
|
+
const { id: id2, name, contextWindow, efforts } = item;
|
|
20517
|
+
if (typeof id2 !== "string" || id2.length === 0 || id2.length > 256 || /[^\x21-\x7E]/.test(id2) || ids.has(id2) || typeof name !== "string" || name.trim().length === 0 || name.length > 256 || typeof contextWindow !== "number" || !Number.isSafeInteger(contextWindow) || contextWindow <= 0 || !Array.isArray(efforts) || efforts.some((effort) => typeof effort !== "string" || !MERIDIAN_EFFORTS.includes(effort))) {
|
|
20518
|
+
return;
|
|
20519
|
+
}
|
|
20520
|
+
ids.add(id2);
|
|
20521
|
+
models.push({ id: id2, name, contextWindow, efforts });
|
|
20522
|
+
}
|
|
20523
|
+
return models;
|
|
20524
|
+
}
|
|
20525
|
+
function serializeCatalogCache(discovered, now3) {
|
|
20526
|
+
const providers = {};
|
|
20527
|
+
for (const entry of discovered) {
|
|
20528
|
+
if (typeof entry.baseURL !== "string" || entry.models.length === 0)
|
|
20529
|
+
continue;
|
|
20530
|
+
providers[entry.providerID] = { baseURL: entry.baseURL, fetchedAt: now3, models: entry.models };
|
|
20531
|
+
}
|
|
20532
|
+
return `${JSON.stringify({ version: CATALOG_CACHE_VERSION, providers }, null, 2)}
|
|
20533
|
+
`;
|
|
20534
|
+
}
|
|
20535
|
+
function removeCatalogCache(remove4 = (path) => rmSync(path, { force: true })) {
|
|
20536
|
+
try {
|
|
20537
|
+
remove4(catalogCachePath());
|
|
20538
|
+
} catch {}
|
|
20539
|
+
}
|
|
20540
|
+
function readCatalogCache(now3, read = (path) => readFileSync2(path, "utf-8")) {
|
|
20541
|
+
try {
|
|
20542
|
+
return parseCatalogCache(JSON.parse(read(catalogCachePath())), now3);
|
|
20543
|
+
} catch {
|
|
20544
|
+
return new Map;
|
|
20545
|
+
}
|
|
20546
|
+
}
|
|
20547
|
+
function writeCatalogCache(discovered, now3, write = (path, contents) => {
|
|
20548
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
20549
|
+
writeFileSync(temporary, contents, { encoding: "utf-8", mode: 384 });
|
|
20550
|
+
renameSync(temporary, path);
|
|
20551
|
+
}) {
|
|
20552
|
+
try {
|
|
20553
|
+
const contents = serializeCatalogCache(discovered, now3);
|
|
20554
|
+
if (contents.includes('"providers": {}'))
|
|
20555
|
+
return;
|
|
20556
|
+
write(catalogCachePath(), contents);
|
|
20557
|
+
} catch {}
|
|
20558
|
+
}
|
|
20559
|
+
function resolveCatalogModels(catalog, discovered, cached3) {
|
|
20560
|
+
if (discovered.length > 0)
|
|
20561
|
+
return [...discovered];
|
|
20562
|
+
const seeded = [];
|
|
20563
|
+
for (const providerID of MERIDIAN_PROVIDERS) {
|
|
20564
|
+
const entry = cached3.get(providerID);
|
|
20565
|
+
if (!entry)
|
|
20566
|
+
continue;
|
|
20567
|
+
if (!catalog.provider.get(providerID))
|
|
20568
|
+
continue;
|
|
20569
|
+
seeded.push({ providerID, baseURL: entry.baseURL, models: [...entry.models] });
|
|
20570
|
+
}
|
|
20571
|
+
return seeded;
|
|
20468
20572
|
}
|
|
20469
20573
|
function applyMeridianModels(catalog, providerID, models) {
|
|
20470
20574
|
for (const model of models) {
|
|
@@ -20527,19 +20631,31 @@ var MeridianV2Plugin = define({
|
|
|
20527
20631
|
const modelDiscoveryController = new AbortController;
|
|
20528
20632
|
let discoveredModels = [];
|
|
20529
20633
|
let discoveryStarted = false;
|
|
20634
|
+
const cachedModels = readCatalogCache(Date.now());
|
|
20530
20635
|
registered.push(await context3.catalog.transform((catalog) => {
|
|
20531
|
-
for (const
|
|
20532
|
-
applyMeridianModels(catalog,
|
|
20636
|
+
for (const entry of resolveCatalogModels(catalog, discoveredModels, cachedModels)) {
|
|
20637
|
+
applyMeridianModels(catalog, entry.providerID, entry.models);
|
|
20533
20638
|
}
|
|
20534
20639
|
}));
|
|
20535
20640
|
const discoverModels = async () => {
|
|
20536
20641
|
if (discoveryStarted || modelDiscoveryController.signal.aborted)
|
|
20537
20642
|
return false;
|
|
20538
|
-
const
|
|
20539
|
-
if (
|
|
20643
|
+
const loaded = await loadMeridianModels(context3.catalog, modelDiscoveryController.signal).catch(() => ({ configured: [], discovered: [] }));
|
|
20644
|
+
if (modelDiscoveryController.signal.aborted)
|
|
20645
|
+
return false;
|
|
20646
|
+
if (loaded.configured.length === 0) {
|
|
20647
|
+
if (cachedModels.size > 0) {
|
|
20648
|
+
cachedModels.clear();
|
|
20649
|
+
removeCatalogCache();
|
|
20650
|
+
await context3.catalog.reload();
|
|
20651
|
+
}
|
|
20652
|
+
return false;
|
|
20653
|
+
}
|
|
20654
|
+
if (loaded.discovered.length === 0)
|
|
20540
20655
|
return false;
|
|
20541
20656
|
discoveryStarted = true;
|
|
20542
|
-
discoveredModels =
|
|
20657
|
+
discoveredModels = loaded.discovered;
|
|
20658
|
+
writeCatalogCache(loaded.discovered, Date.now());
|
|
20543
20659
|
await context3.catalog.reload();
|
|
20544
20660
|
return true;
|
|
20545
20661
|
};
|
|
@@ -20667,8 +20783,14 @@ var MeridianV2Plugin = define({
|
|
|
20667
20783
|
});
|
|
20668
20784
|
var meridian_v2_default = MeridianV2Plugin;
|
|
20669
20785
|
export {
|
|
20786
|
+
writeCatalogCache,
|
|
20670
20787
|
shouldDetachFromParentSession,
|
|
20788
|
+
serializeCatalogCache,
|
|
20789
|
+
resolveCatalogModels,
|
|
20790
|
+
removeCatalogCache,
|
|
20791
|
+
readCatalogCache,
|
|
20671
20792
|
parseMeridianModels,
|
|
20793
|
+
parseCatalogCache,
|
|
20672
20794
|
meridianModelsURL,
|
|
20673
20795
|
loadMeridianModels,
|
|
20674
20796
|
isRootV2Session,
|
|
@@ -20677,6 +20799,7 @@ export {
|
|
|
20677
20799
|
fetchMeridianModels,
|
|
20678
20800
|
fallbackAgentTraits,
|
|
20679
20801
|
meridian_v2_default as default,
|
|
20802
|
+
catalogCachePath,
|
|
20680
20803
|
applyMeridianV2Headers,
|
|
20681
20804
|
applyMeridianModels,
|
|
20682
20805
|
SUPPORTED_OPENCODE_V2_VERSION,
|
package/dist/proxy/errors.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Error classification for SDK errors.
|
|
3
3
|
* Maps raw error messages to structured HTTP error responses.
|
|
4
4
|
*/
|
|
5
|
+
import type { AbortCauseSnapshot } from "./requestAbort";
|
|
5
6
|
export interface ClassifiedError {
|
|
6
7
|
status: number;
|
|
7
8
|
type: string;
|
|
@@ -167,6 +168,58 @@ export declare function canRecoverCapturedToolUses(input: {
|
|
|
167
168
|
capturedToolUses: number;
|
|
168
169
|
abortIsOurs: boolean;
|
|
169
170
|
}): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Per-block completeness record for a tool_use the client received on the
|
|
173
|
+
* wire (uncaptured-recovery tracker). Populated only by real forwarding;
|
|
174
|
+
* `naturalStop` is set exclusively when the block's own content_block_stop
|
|
175
|
+
* was enqueued — a synthetic flush closure never counts, because a dangling
|
|
176
|
+
* block's arguments may be incomplete.
|
|
177
|
+
*/
|
|
178
|
+
export interface StreamedToolBlockRecord {
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
/** Accumulated input_json_delta partials (plus any inline start input). */
|
|
182
|
+
json: string;
|
|
183
|
+
/** True when the block carried an inline input object at start (no deltas). */
|
|
184
|
+
startedInputObject: boolean;
|
|
185
|
+
forwardedStart: boolean;
|
|
186
|
+
naturalStop: boolean;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Is a streamed-but-uncaptured tool call complete and executable?
|
|
190
|
+
* Pure function — no I/O.
|
|
191
|
+
*/
|
|
192
|
+
export declare function isStreamedToolBlockComplete(record: StreamedToolBlockRecord): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Can a failed passthrough turn whose tool_use blocks fully streamed but
|
|
195
|
+
* were NEVER captured by the PreToolUse hook still be delivered as a
|
|
196
|
+
* tool-use response?
|
|
197
|
+
*
|
|
198
|
+
* This is the 2026-09-10 0a95wd-tusk incident shape: an abort landing
|
|
199
|
+
* between stream completion and tool dispatch makes the CLI yield
|
|
200
|
+
* `max_turns_reached` WITHOUT running the hook, so captures are empty even
|
|
201
|
+
* though every streamed block is complete and names a declared client tool.
|
|
202
|
+
* This is a materially different trust basis from
|
|
203
|
+
* `canRecoverCapturedToolUses` (which requires the hook to have seen the
|
|
204
|
+
* calls) and is therefore a separate predicate, not a relaxed count.
|
|
205
|
+
*
|
|
206
|
+
* Callers must further verify: the attempted maxTurns was 1, the kill switch
|
|
207
|
+
* is enabled, no cancellation of any kind fired, no forced-single/duplicate/
|
|
208
|
+
* early-stop state exists, and the envelope is still open. Every streamed
|
|
209
|
+
* block must pass `isStreamedToolBlockComplete`.
|
|
210
|
+
*/
|
|
211
|
+
export declare function canRecoverUncapturedToolUses(input: {
|
|
212
|
+
reason: SdkTermination["reason"];
|
|
213
|
+
passthrough: boolean;
|
|
214
|
+
capturedToolUses: number;
|
|
215
|
+
streamedToolUses: number;
|
|
216
|
+
droppedToolUseIds: number;
|
|
217
|
+
sawDuplicateToolUse: boolean;
|
|
218
|
+
forceSingleToolUse: boolean;
|
|
219
|
+
earlyStopFired: boolean;
|
|
220
|
+
uncapturedRecoveryEnabled: boolean;
|
|
221
|
+
attemptedMaxTurns: number | undefined;
|
|
222
|
+
}): boolean;
|
|
170
223
|
export declare function extractSdkTermination(errMsg: string): SdkTermination;
|
|
171
224
|
/**
|
|
172
225
|
* Render an SdkTermination plus request context as a single greppable log line.
|
|
@@ -182,5 +235,7 @@ export declare function formatSdkTermination(t: SdkTermination, ctx: {
|
|
|
182
235
|
isResume?: boolean;
|
|
183
236
|
hasDeferredTools?: boolean;
|
|
184
237
|
sdkSessionId?: string;
|
|
238
|
+
/** Abort-cause snapshot: which Meridian-linked producer fired, if any. */
|
|
239
|
+
abort?: AbortCauseSnapshot;
|
|
185
240
|
}): string;
|
|
186
241
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/proxy/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AAE,OAAO,CAAA;IAC5B,kBAAkB,EAAE,OAAO,CAAA;IAC3B,cAAc,EAAE,OAAO,CAAA;IACvB,yBAAyB,EAAE,OAAO,CAAA;IAClC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC,GAAG,OAAO,CAeV;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAiEpE;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;IACrB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAC3B,GACA,MAAM,CAkBR"}
|
|
@@ -1,7 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-scoped abort link with an abort-cause registry.
|
|
3
|
+
*
|
|
4
|
+
* Meridian aborts a request's SDK query from several producers (client
|
|
5
|
+
* disconnect, cancelled response body, session turn watchdog, subtree
|
|
6
|
+
* cancellation, process shutdown, the proxy's own passthrough single-step
|
|
7
|
+
* abort). When a capped turn then dies with an opaque SDK termination, the
|
|
8
|
+
* operator needs to know WHICH producer fired — or that none did, which is
|
|
9
|
+
* the discriminating marker for the uncaptured-tool-turn incident
|
|
10
|
+
* (2026-09-10 0a95wd-tusk): an externally-initiated CLI abort masqueraded as
|
|
11
|
+
* "Reached maximum number of turns (1)".
|
|
12
|
+
*
|
|
13
|
+
* The registry latches the FIRST classified cause. `abortSnapshot` is the
|
|
14
|
+
* single read side used by diagnostics. `cause: "none"` means no
|
|
15
|
+
* Meridian-linked abort was observed — it is NOT proof that no abort occurred
|
|
16
|
+
* inside the CLI subprocess; only that nothing Meridian controls aborted.
|
|
17
|
+
*/
|
|
18
|
+
export type RequestAbortCause = "client_abort" | "stream_cancel" | "session_watchdog" | "process_shutdown" | "subtree_cancel" | "passthrough_single_step" | "unknown_abort";
|
|
19
|
+
export declare const REQUEST_ABORT_CAUSES: readonly RequestAbortCause[];
|
|
20
|
+
export interface AbortCauseSnapshot {
|
|
21
|
+
/** First classified cause; "none" when the observed signal never aborted. */
|
|
22
|
+
cause: RequestAbortCause | "none";
|
|
23
|
+
/** Whether the linked controller's signal is aborted. */
|
|
24
|
+
aborted: boolean;
|
|
25
|
+
/** Monotonic ms from link creation to abort; undefined when not aborted. */
|
|
26
|
+
elapsedMs?: number;
|
|
27
|
+
}
|
|
1
28
|
export interface RequestAbortLink {
|
|
2
29
|
controller: AbortController;
|
|
3
30
|
abort: (reason?: unknown) => void;
|
|
4
31
|
detach: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Latch the classified cause of an impending abort. First call wins; later
|
|
34
|
+
* labels are ignored so the earliest producer owns the diagnosis. Callers
|
|
35
|
+
* should label BEFORE invoking abort, and may label a cause that arrives
|
|
36
|
+
* with an already-aborted signal.
|
|
37
|
+
*/
|
|
38
|
+
setCause: (cause: RequestAbortCause) => void;
|
|
39
|
+
/** Read-side snapshot for diagnostics and telemetry. */
|
|
40
|
+
abortSnapshot: () => AbortCauseSnapshot;
|
|
5
41
|
}
|
|
6
42
|
/** Forward an HTTP request abort into the SDK query lifecycle. */
|
|
7
43
|
export declare function linkRequestAbort(signal: AbortSignal): RequestAbortLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestAbort.d.ts","sourceRoot":"","sources":["../../src/proxy/requestAbort.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,eAAe,CAAA;IAC3B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACjC,MAAM,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"requestAbort.d.ts","sourceRoot":"","sources":["../../src/proxy/requestAbort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,gBAAgB,GAChB,yBAAyB,GACzB,eAAe,CAAA;AAEnB,eAAO,MAAM,oBAAoB,EAAE,SAAS,iBAAiB,EAQnD,CAAA;AAEV,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAA;IACjC,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAA;IAChB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,eAAe,CAAA;IAC3B,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACjC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC5C,wDAAwD;IACxD,aAAa,EAAE,MAAM,kBAAkB,CAAA;CACxC;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,CAgDtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/proxy/server.ts"],"names":[],"mappings":"AAoBA,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,CA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iB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAynPhF;AAWD,wBAAgB,gCAAgC,IAAI,IAAI,CAavD;AAED,wBAAsB,gBAAgB,CAAC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CA8NhG"}
|
package/dist/proxy/setup.d.ts
CHANGED
|
@@ -102,6 +102,19 @@ export declare function clearPluginlessWarnings(): void;
|
|
|
102
102
|
* Returns the message to log, or undefined when there is nothing to say.
|
|
103
103
|
* Stateful but I/O-free — the caller owns the logging.
|
|
104
104
|
*/
|
|
105
|
+
/**
|
|
106
|
+
* Is this an OpenCode request that carries no Meridian plugin signal?
|
|
107
|
+
*
|
|
108
|
+
* Such a client cannot tell Meridian which of its concurrent streams is the
|
|
109
|
+
* hidden title/summary agent, so the proxy must not hold it to the strict
|
|
110
|
+
* one-turn-per-session-key rule — see the concurrent-flow declaration in
|
|
111
|
+
* server.ts. Pure so both the warning and that decision read the same fact.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isPluginlessOpenCodeRequest(input: {
|
|
114
|
+
userAgent: string | undefined;
|
|
115
|
+
/** The plugin's `x-opencode-agent-mode` header, if it sent one. */
|
|
116
|
+
agentModeHeader: string | undefined;
|
|
117
|
+
}): boolean;
|
|
105
118
|
export declare function notePluginlessOpenCodeRequest(input: {
|
|
106
119
|
userAgent: string | undefined;
|
|
107
120
|
/** The plugin's `x-opencode-agent-mode` header, if it sent one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/proxy/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aACnB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,YAAY,EAAE,MAAM;gBAApB,YAAY,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AE,OAAO,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,GAAE,kBAAyB,GACpC,WAAW,CAiFb"}
|
package/dist/server.js
CHANGED
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
runObserveHook,
|
|
12
12
|
runTransformHook,
|
|
13
13
|
startProxyServer
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-ryt69ryf.js";
|
|
15
15
|
import"./cli-5jxyma6z.js";
|
|
16
16
|
import"./cli-sry5aqdj.js";
|
|
17
17
|
import"./cli-8yp89fan.js";
|
|
18
18
|
import"./cli-9e5cxp89.js";
|
|
19
19
|
import"./cli-khhjyk04.js";
|
|
20
20
|
import"./cli-vj9cv18n.js";
|
|
21
|
-
import"./cli-
|
|
21
|
+
import"./cli-hxxy0m1z.js";
|
|
22
22
|
import"./cli-p9swy5t3.js";
|
|
23
23
|
export {
|
|
24
24
|
startProxyServer,
|
|
@@ -11,15 +11,17 @@ import {
|
|
|
11
11
|
findOpencodeConfigPath,
|
|
12
12
|
findPluginPath,
|
|
13
13
|
findV2PluginPath,
|
|
14
|
+
isPluginlessOpenCodeRequest,
|
|
14
15
|
notePluginlessOpenCodeRequest,
|
|
15
16
|
pluginPathForGeneration,
|
|
16
17
|
runSetup
|
|
17
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-hxxy0m1z.js";
|
|
18
19
|
import"./cli-p9swy5t3.js";
|
|
19
20
|
export {
|
|
20
21
|
runSetup,
|
|
21
22
|
pluginPathForGeneration,
|
|
22
23
|
notePluginlessOpenCodeRequest,
|
|
24
|
+
isPluginlessOpenCodeRequest,
|
|
23
25
|
findV2PluginPath,
|
|
24
26
|
findPluginPath,
|
|
25
27
|
findOpencodeConfigPath,
|
package/package.json
CHANGED