@agentproto/runtime 3.3.0 → 3.4.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/dist/catalog-models.d.ts +15 -5
- package/dist/catalog-models.mjs +12 -3
- package/dist/catalog-models.mjs.map +1 -1
- package/dist/index.d.ts +21 -8
- package/dist/index.mjs +48 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +27 -27
package/dist/index.d.ts
CHANGED
|
@@ -5260,6 +5260,15 @@ interface SessionDescriptor {
|
|
|
5260
5260
|
* posture or a raw `{ harnessModeId }` sourced from the harness's ACP mode
|
|
5261
5261
|
* registry (SPEC §3.4a). */
|
|
5262
5262
|
posture?: Posture;
|
|
5263
|
+
/**
|
|
5264
|
+
* Read-surface echo of the live harness's advertised ACP session modes
|
|
5265
|
+
* (`SessionModeState.availableModes`, #482) — stamped at READ TIME from the
|
|
5266
|
+
* live agent session by `list()`/`get()`, never persisted. A client posture
|
|
5267
|
+
* picker resolves the native (enforced, live-switchable) rows from this;
|
|
5268
|
+
* absent for arms with no native mode registry (print/proprietary) and for a
|
|
5269
|
+
* session whose live runtime handle is gone.
|
|
5270
|
+
*/
|
|
5271
|
+
availableModes?: SessionMode[];
|
|
5263
5272
|
/** Endpoint / gateway rail (SPEC §3.1 axis 4). `baseUrl` is carried only
|
|
5264
5273
|
* for a custom gateway the catalog can't resolve; `access` is downstream
|
|
5265
5274
|
* of this axis (SPEC §1c). */
|
|
@@ -6227,6 +6236,7 @@ interface SessionsRegistry {
|
|
|
6227
6236
|
*/
|
|
6228
6237
|
listSummaries(opts?: {
|
|
6229
6238
|
includeArchived?: boolean;
|
|
6239
|
+
lane?: "agents" | "auto";
|
|
6230
6240
|
limit?: number;
|
|
6231
6241
|
offset?: number;
|
|
6232
6242
|
}): {
|
|
@@ -7533,14 +7543,17 @@ declare function registerBuiltinRoutes(opts?: {
|
|
|
7533
7543
|
* kind-organized catalogs, so NO adapters, NO profiles, NO host wiring.
|
|
7534
7544
|
* `getModelsByProvider` is itself router-aware: OpenRouter's route table is
|
|
7535
7545
|
* spread into `LLM_PRICING_CATALOG` upstream (`llm/catalog.ts`), so an
|
|
7536
|
-
* `openrouter` query returns that full, large list with bare ids; Requesty
|
|
7537
|
-
*
|
|
7538
|
-
*
|
|
7539
|
-
* pricing
|
|
7540
|
-
*
|
|
7541
|
-
*
|
|
7542
|
-
*
|
|
7543
|
-
*
|
|
7546
|
+
* `openrouter` query returns that full, large list with bare ids; Requesty,
|
|
7547
|
+
* HuggingFace and OpenCode's two hosted endpoints (`opencode-go`,
|
|
7548
|
+
* `opencode`) are NOT spread into that catalog — spreading a second router's
|
|
7549
|
+
* bare-id pricing there would repoint direct-vendor ids at router pricing
|
|
7550
|
+
* (`route-identity/index.ts`) — so `getModelsByProvider` instead folds their
|
|
7551
|
+
* generated route tables in directly. The emitted id is whatever the ref
|
|
7552
|
+
* formats to: `vendor/product@route` for the vendor-namespacing routers, and
|
|
7553
|
+
* the bare `opencode-go/glm-5.3` form for the OpenCode endpoints, whose route
|
|
7554
|
+
* IS the id's leading segment. Every provider enumerates through the same
|
|
7555
|
+
* path; the picker paginates client-side. NEVER log the rows: OpenRouter
|
|
7556
|
+
* alone is thousands.
|
|
7544
7557
|
*/
|
|
7545
7558
|
|
|
7546
7559
|
interface CatalogProviderModelsQuery {
|
package/dist/index.mjs
CHANGED
|
@@ -4036,7 +4036,13 @@ function resolveWorktreeIdentity(cwd) {
|
|
|
4036
4036
|
dir = parent;
|
|
4037
4037
|
}
|
|
4038
4038
|
}
|
|
4039
|
-
var WIDENING_ROUTES = [
|
|
4039
|
+
var WIDENING_ROUTES = [
|
|
4040
|
+
"openrouter",
|
|
4041
|
+
"requesty",
|
|
4042
|
+
"huggingface",
|
|
4043
|
+
"opencode-go",
|
|
4044
|
+
"opencode"
|
|
4045
|
+
];
|
|
4040
4046
|
var VENDOR_COMPATIBILITY_ROUTES = {
|
|
4041
4047
|
xai: ["xai", "xai-anthropic"]
|
|
4042
4048
|
};
|
|
@@ -4375,9 +4381,12 @@ function reconcileModelRoute(input) {
|
|
|
4375
4381
|
}
|
|
4376
4382
|
function serviceableModelRoutes(model) {
|
|
4377
4383
|
const routes = /* @__PURE__ */ new Set();
|
|
4378
|
-
const provider = getModelProvider(model);
|
|
4379
|
-
if (provider) routes.add(provider);
|
|
4380
4384
|
const parsed = tryParseModelRef(normalizeRouterPrefixedId(model));
|
|
4385
|
+
const selfRouted = parsed !== void 0 && parsed.route === parsed.vendor && WIDENING_ROUTES.includes(parsed.vendor) && tryResolveLlmModelRoute(`${parsed.vendor}/${parsed.product}`)?.pricing.provider === parsed.vendor;
|
|
4386
|
+
if (!selfRouted) {
|
|
4387
|
+
const provider = getModelProvider(model);
|
|
4388
|
+
if (provider) routes.add(provider);
|
|
4389
|
+
}
|
|
4381
4390
|
if (parsed) {
|
|
4382
4391
|
if (parsed.route !== parsed.vendor) routes.add(parsed.route);
|
|
4383
4392
|
if (resolvePricingExact(parsed.product)?.provider === parsed.vendor) {
|
|
@@ -11091,6 +11100,14 @@ function stampInterrupted(desc) {
|
|
|
11091
11100
|
delete desc.interrupted;
|
|
11092
11101
|
}
|
|
11093
11102
|
}
|
|
11103
|
+
function stampLiveModes(desc, rt) {
|
|
11104
|
+
const modes = rt.agentSession?.availableModes;
|
|
11105
|
+
if (modes && modes.length > 0) {
|
|
11106
|
+
desc.availableModes = [...modes];
|
|
11107
|
+
} else {
|
|
11108
|
+
delete desc.availableModes;
|
|
11109
|
+
}
|
|
11110
|
+
}
|
|
11094
11111
|
function isResumable(desc) {
|
|
11095
11112
|
return desc.kind === "agent-cli" && !!desc.adapterSlug && !!desc.adapterSessionId && !!desc.cwd && !desc.archived;
|
|
11096
11113
|
}
|
|
@@ -11525,6 +11542,7 @@ function createSessionsRegistry(opts) {
|
|
|
11525
11542
|
secondsSinceLastActivity: _secondsSinceLastActivity,
|
|
11526
11543
|
toolCallsThisTurn: _toolCallsThisTurn,
|
|
11527
11544
|
eventsPath: _eventsPath,
|
|
11545
|
+
availableModes: _availableModes,
|
|
11528
11546
|
...rest
|
|
11529
11547
|
} = s.desc;
|
|
11530
11548
|
return rest;
|
|
@@ -13529,6 +13547,7 @@ ${message}`;
|
|
|
13529
13547
|
stampInterrupted(desc);
|
|
13530
13548
|
stampCurrentStatus(rt);
|
|
13531
13549
|
stampWatchers(desc);
|
|
13550
|
+
stampLiveModes(desc, rt);
|
|
13532
13551
|
desc.childrenBusy = childrenBusy.get(desc.id) ?? 0;
|
|
13533
13552
|
desc.queuedPrompts = desc.promptQueue?.length ?? 0;
|
|
13534
13553
|
return desc;
|
|
@@ -13536,10 +13555,30 @@ ${message}`;
|
|
|
13536
13555
|
},
|
|
13537
13556
|
listSummaries(opts2) {
|
|
13538
13557
|
const includeArchived = opts2?.includeArchived ?? false;
|
|
13558
|
+
const lane = opts2?.lane;
|
|
13539
13559
|
const limit = Math.max(1, Math.min(200, opts2?.limit ?? 50));
|
|
13540
13560
|
const offset = Math.max(0, opts2?.offset ?? 0);
|
|
13541
13561
|
const childrenBusy = childrenBusyCounts();
|
|
13542
|
-
const
|
|
13562
|
+
const hasMachineLineage = (rt) => {
|
|
13563
|
+
const ownMachine = (desc) => desc.origin === "cron" || desc.origin === "gate";
|
|
13564
|
+
if (ownMachine(rt.desc)) return true;
|
|
13565
|
+
const seen = /* @__PURE__ */ new Set([rt.desc.id]);
|
|
13566
|
+
let current = rt.desc;
|
|
13567
|
+
while (current.parentSessionId) {
|
|
13568
|
+
const parent = sessions.get(current.parentSessionId)?.desc;
|
|
13569
|
+
if (!parent || seen.has(parent.id)) return true;
|
|
13570
|
+
if (parent.kind === "terminal" || parent.kind === "command") return true;
|
|
13571
|
+
seen.add(parent.id);
|
|
13572
|
+
current = parent;
|
|
13573
|
+
}
|
|
13574
|
+
return ownMachine(current);
|
|
13575
|
+
};
|
|
13576
|
+
const all = Array.from(sessions.values()).filter((rt) => includeArchived || !rt.desc.archived).filter((rt) => {
|
|
13577
|
+
if (!lane) return true;
|
|
13578
|
+
if (rt.desc.kind === "terminal" || rt.desc.kind === "command") return false;
|
|
13579
|
+
const machine = hasMachineLineage(rt);
|
|
13580
|
+
return lane === "auto" ? machine : !machine;
|
|
13581
|
+
}).sort((a, b) => b.desc.startedAt.localeCompare(a.desc.startedAt));
|
|
13543
13582
|
const slice = all.slice(offset, offset + limit);
|
|
13544
13583
|
const summaries = slice.map((rt) => {
|
|
13545
13584
|
const desc = rt.desc;
|
|
@@ -13561,6 +13600,7 @@ ${message}`;
|
|
|
13561
13600
|
stampInterrupted(desc);
|
|
13562
13601
|
stampCurrentStatus(rt);
|
|
13563
13602
|
stampWatchers(desc);
|
|
13603
|
+
stampLiveModes(desc, rt);
|
|
13564
13604
|
desc.childrenBusy = childrenBusyCounts().get(desc.id) ?? 0;
|
|
13565
13605
|
desc.queuedPrompts = desc.promptQueue?.length ?? 0;
|
|
13566
13606
|
}
|
|
@@ -22891,7 +22931,7 @@ var STANDALONE_REST_BRIDGE_SCRIPT = `<script>
|
|
|
22891
22931
|
return res.json().catch(function () {
|
|
22892
22932
|
throw new Error("tool-call failed: HTTP " + res.status);
|
|
22893
22933
|
}).then(function (body) {
|
|
22894
|
-
if (!res.ok) throw new Error((body && body.error) || ("tool-call failed: HTTP " + res.status));
|
|
22934
|
+
if (!res.ok) throw new Error((body && (body.message || body.error)) || ("tool-call failed: HTTP " + res.status));
|
|
22895
22935
|
return body;
|
|
22896
22936
|
});
|
|
22897
22937
|
});
|
|
@@ -28819,10 +28859,13 @@ async function handleSessions(req, res, path, registry, resolveAgentAdapter, pty
|
|
|
28819
28859
|
const queryString = reqUrl.includes("?") ? reqUrl.slice(reqUrl.indexOf("?") + 1) : "";
|
|
28820
28860
|
const params = new URLSearchParams(queryString);
|
|
28821
28861
|
const includeArchived = params.get("includeArchived") === "true";
|
|
28862
|
+
const laneParam = params.get("lane");
|
|
28863
|
+
const lane = laneParam === "agents" || laneParam === "auto" ? laneParam : void 0;
|
|
28822
28864
|
const limit = Number.parseInt(params.get("limit") ?? "", 10);
|
|
28823
28865
|
const offset = Number.parseInt(params.get("offset") ?? "", 10);
|
|
28824
28866
|
const result = registry.listSummaries({
|
|
28825
28867
|
includeArchived,
|
|
28868
|
+
lane,
|
|
28826
28869
|
limit: Number.isNaN(limit) ? void 0 : limit,
|
|
28827
28870
|
offset: Number.isNaN(offset) ? void 0 : offset
|
|
28828
28871
|
});
|