@xmoon76/dsh-pi-tui 0.5.7 → 0.5.9
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.en.md +64 -26
- package/README.md +64 -26
- package/cordis.patch.yml +13 -0
- package/dist/acp-stdio.mjs +151 -0
- package/dist/{bootstrap-C9nl6e13.mjs → bootstrap-CVyHGQDX.mjs} +22330 -6888
- package/dist/browser-CDUSHIIr.mjs +76 -0
- package/dist/builtins.mjs +2 -2
- package/dist/{client-bootstrap-CGezi85O.mjs → client-bootstrap-4UoeVIHE.mjs} +2407 -1830
- package/dist/client-runtime-BHBlVUf5.mjs +1376 -0
- package/dist/{daemon-launcher-H_1r5Cqs.mjs → daemon-launcher-DxIgjBHW.mjs} +1551 -57
- package/dist/daemon-launcher.d.mts +85 -14
- package/dist/daemon-launcher.mjs +2 -2
- package/dist/diagnostics-Db5iVcuJ.mjs +123 -0
- package/dist/{entry-control-jBfKn1qO.mjs → entry-control-BDLZgg4m.mjs} +1 -1
- package/dist/{extensions-6a5vvJUT.mjs → extensions-Dx7ncPNA.mjs} +1 -4
- package/dist/extensions.mjs +1 -1
- package/dist/handoff-BjoEy3f8.mjs +106 -0
- package/dist/history-search-limits-Cx2UvRC2.mjs +16 -0
- package/dist/history-search-remote-BHuoellG.mjs +113 -0
- package/dist/history-search-remote-BzXdvrxk.mjs +26 -0
- package/dist/history-search-seat-BcHJTpeB.mjs +639 -0
- package/dist/history-search-seat-rZcq0XV6.mjs +639 -0
- package/dist/{host-bootstrap-MVxks641.mjs → host-bootstrap-BfnufpnW.mjs} +37 -72
- package/dist/{host-foundation-probe-DK7n5jDu.mjs → host-foundation-probe-DlD8-N_Q.mjs} +2 -2
- package/dist/host-runtime.mjs +5611 -290
- package/dist/index.d.mts +13 -6
- package/dist/index.mjs +22766 -6893
- package/dist/installed-dsh-BjUiJSwR.mjs +142 -0
- package/dist/interaction-port-D1Yv9zgu.mjs +45 -0
- package/dist/local-acp-control-CC5z4Xbq.mjs +304 -0
- package/dist/local-acp-endpoint-D1jYdJdv.mjs +41 -0
- package/dist/local-acp-listener-Cmgb5M0H.mjs +9493 -0
- package/dist/local-acp-status-B_25Q6kU.mjs +101 -0
- package/dist/local-client.mjs +719 -93
- package/dist/local-daemon-control-BFJAC8Kg.mjs +2199 -0
- package/dist/local-daemon-control-Bm3imctD.mjs +2101 -0
- package/dist/{local-discovery-BPZw1wEd.mjs → local-discovery-BMhaGIiJ.mjs} +254 -544
- package/dist/{local-discovery-BMoNXZjJ.mjs → local-discovery-Ba7_-NNC.mjs} +1 -1
- package/dist/{local-discovery-Bq3jLAn1.mjs → local-discovery-QSbFpjK2.mjs} +301 -544
- package/dist/local-host.mjs +970 -501
- package/dist/local-profile-daemon-admin-otpm69R6.mjs +469 -0
- package/dist/{local-scope-DEuGAy8l.mjs → local-scope-5DEKA_lW.mjs} +1075 -31
- package/dist/{local-transport-X4ZCe2uE.mjs → local-transport-DeWmdZ5E.mjs} +14 -3
- package/dist/{local-web-control-DKWtXIkr.mjs → local-web-control-Dny93N-r.mjs} +10 -7
- package/dist/{local-workspace-object-D06GL0UO.mjs → local-workspace-object-D0RVQt8U.mjs} +33 -9
- package/dist/model-selection-CYlqg2DV.mjs +83 -0
- package/dist/native-client-domains-Dg4srzYt.mjs +2 -0
- package/dist/native-client.d.mts +735 -0
- package/dist/native-client.mjs +3534 -0
- package/dist/{open-CmOBxSjN.mjs → open-QQva8-ar.mjs} +24 -20
- package/dist/{pi-tui-remote-contribution-Do8ECrUy.mjs → pi-tui-remote-contribution-565wiLWp.mjs} +741 -150
- package/dist/preferences.mjs +1 -1
- package/dist/{profile-preferences-migration-CThz4rHH.mjs → profile-preferences-migration-CNOWIdnr.mjs} +1 -1
- package/dist/{profile-preferences-migration-BfUGdPZx.mjs → profile-preferences-migration-IrnXcJWK.mjs} +10 -8
- package/dist/{prompt-sections-DXmjB58H.mjs → prompt-sections-Bi-9_Gr_.mjs} +28 -10
- package/dist/{prompt-sections-DUKmWb8g.mjs → prompt-sections-DFS1dqsY.mjs} +342 -56
- package/dist/{dist-BFgC-5tL.mjs → recall-scope-9Nuoto_i.mjs} +353 -1
- package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
- package/dist/schema-CCLvDa7Q.mjs +177 -0
- package/dist/{schema-qE_P09zJ.mjs → schema-t97l3aK8.mjs} +56 -3
- package/dist/{session-DC0XQr5O.mjs → session-Cs8iLCEx.mjs} +784 -342
- package/dist/{session-Cihe8PPS.mjs → session-EBRZF6Ow.mjs} +783 -341
- package/dist/session-create-facts-CkfG5DpQ.mjs +20 -0
- package/dist/{startup-CarQxWwi.d.mts → startup-Dti3Udne.d.mts} +30 -3
- package/dist/{startup-CARqn3kV.mjs → startup-UtFQSDe_.mjs} +90 -15
- package/dist/startup.d.mts +2 -2
- package/dist/startup.mjs +1 -1
- package/dist/task-read-remote-DRtkXDrZ.mjs +1083 -0
- package/dist/{terminal-progress-source-D4DHyXDo.mjs → terminal-progress-source-VsczdXA-.mjs} +610 -335
- package/dist/{transcript-view-a7cROAaI.mjs → transcript-view-B6vCnukn.mjs} +2284 -1166
- package/dist/{transcript-view-hvNVkPtv.mjs → transcript-view-DSSdE2vK.mjs} +2191 -765
- package/dist/write-failure-xNKczXH7.mjs +189 -0
- package/package.json +25 -8
- package/dist/local-acp-listener-CNkguN5-.mjs +0 -2566
- package/dist/local-daemon-control-Bg9s2aYi.mjs +0 -1424
- package/dist/local-daemon-control-Cu_4FIdd.mjs +0 -1585
- package/dist/local-profile-daemon-admin-AXgVH-6y.mjs +0 -91
- package/dist/preset-BcWqOtY7.mjs +0 -46
package/dist/{terminal-progress-source-D4DHyXDo.mjs → terminal-progress-source-VsczdXA-.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { u as isRemoteBusinessRefusalCode } from "./write-failure-xNKczXH7.mjs";
|
|
2
3
|
import { f as stripControlChars } from "./command-trust-DChWUamk.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { I as parseKey, N as isKeyRelease, P as isKeyRepeat } from "./recall-scope-9Nuoto_i.mjs";
|
|
4
5
|
import { r as parsePiTuiTerminalProgressFrame } from "./pi-tui-terminal-progress-contract-B3RoEzjK.mjs";
|
|
5
6
|
import { t as extensionConfigRowId } from "./row-id-DPbyt9Nn.mjs";
|
|
6
|
-
import "node:module";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { readFileSync, realpathSync } from "node:fs";
|
|
9
9
|
import { dirname, join } from "node:path";
|
|
@@ -13,17 +13,6 @@ import "@deepseek-ai/dsh-cmdline";
|
|
|
13
13
|
import z from "@deepseek-ai/schemastery";
|
|
14
14
|
import { parseCommand } from "@deepseek-ai/dsh-commands";
|
|
15
15
|
import { Service, symbols } from "@deepseek-ai/cordis";
|
|
16
|
-
//#region \0rolldown/runtime.js
|
|
17
|
-
var __defProp = Object.defineProperty;
|
|
18
|
-
var __exportAll = (all, no_symbols) => {
|
|
19
|
-
let target = {};
|
|
20
|
-
for (var name in all) __defProp(target, name, {
|
|
21
|
-
get: all[name],
|
|
22
|
-
enumerable: true
|
|
23
|
-
});
|
|
24
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
return target;
|
|
26
|
-
};
|
|
27
16
|
//#endregion
|
|
28
17
|
//#region src/startup.ts
|
|
29
18
|
/** The shared matrix. The bundler inlines this JSON, so the startup island
|
|
@@ -57,11 +46,11 @@ const COMPAT = {
|
|
|
57
46
|
"not by itself qualify every such prerelease."
|
|
58
47
|
],
|
|
59
48
|
current: {
|
|
60
|
-
"since": "0.5.
|
|
49
|
+
"since": "0.5.9",
|
|
61
50
|
"requires": "DeepSeek Harness 0.2.2-rc.3 or later",
|
|
62
51
|
"upgradeDsh": "0.2.2-rc.5",
|
|
63
52
|
"upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.2-rc.5",
|
|
64
|
-
"guidance": "The 0.5.
|
|
53
|
+
"guidance": "The 0.5.9 release requires DeepSeek Harness 0.2.2-rc.3 or later; this checkout validates that runtime floor and targets 0.2.2-rc.5 (validated pairing; on Hosts older than rc.5 the automatic web-search routing decision may differ). The previous 0.2.2-rc.2 and 0.2.2-rc.1 pairings are no longer claimed by this release, so finish in-flight turns and background jobs before upgrading. See README.en.md for the DSH/TUI pairing table, and docs/guides/dsh-compatibility.md for compatibility/recovery rules."
|
|
65
54
|
},
|
|
66
55
|
floor: {
|
|
67
56
|
"below": "0.1.0-rc.8",
|
|
@@ -165,7 +154,7 @@ const COMPAT = {
|
|
|
165
154
|
},
|
|
166
155
|
{
|
|
167
156
|
"dshFrom": "0.2.2-rc.3",
|
|
168
|
-
"tui": "0.5.
|
|
157
|
+
"tui": "0.5.9",
|
|
169
158
|
"versions": [
|
|
170
159
|
"0.2.2-rc.3",
|
|
171
160
|
"0.2.2-rc.4",
|
|
@@ -285,25 +274,6 @@ function contextPressureOccupancy(value) {
|
|
|
285
274
|
if (typeof pressure.pressureTokens === "number") return pressure.pressureTokens;
|
|
286
275
|
}
|
|
287
276
|
//#endregion
|
|
288
|
-
//#region src/runtime/read-error.ts
|
|
289
|
-
/**
|
|
290
|
-
* A typed semantic READ failure: the read was superseded by a connection or
|
|
291
|
-
* surface change, so its result must not be presented as the current Host
|
|
292
|
-
* state. Remote adapters throw this instead of a generic Error so a consumer
|
|
293
|
-
* can stay UI-silent (v2 §0.2.3/§0.3.1) rather than surfacing a stale failure.
|
|
294
|
-
* Host-free; no I/O.
|
|
295
|
-
* @module @xmoon76/dsh-pi-tui/read-error
|
|
296
|
-
*/
|
|
297
|
-
/** The read no longer owns the surface (generation change or superseded epoch). */
|
|
298
|
-
var SupersededReadError = class extends Error {
|
|
299
|
-
reason;
|
|
300
|
-
constructor(reason) {
|
|
301
|
-
super(reason);
|
|
302
|
-
this.name = "SupersededReadError";
|
|
303
|
-
this.reason = reason;
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
//#endregion
|
|
307
277
|
//#region src/domain/catalog/provider.ts
|
|
308
278
|
/**
|
|
309
279
|
* Read a value at a dotted path inside a plain object (the web schema-form
|
|
@@ -1570,19 +1540,9 @@ const FETCH_PROVIDER_IDS = /* @__PURE__ */ new Set(["http", "deepseek-fetch-api"
|
|
|
1570
1540
|
function assertSearchProviderId(id) {
|
|
1571
1541
|
if (!SEARCH_PROVIDER_IDS.has(id)) throw new Error(`unsupported web search provider id "${id}"`);
|
|
1572
1542
|
}
|
|
1573
|
-
function assertSearchProviderReplaceable(value) {
|
|
1574
|
-
if (value === void 0 || value === "") return;
|
|
1575
|
-
if (typeof value !== "string") throw new Error("the configured Web search provider is unreadable and cannot be replaced");
|
|
1576
|
-
if (!SEARCH_PROVIDER_IDS.has(value)) throw new Error(`the configured Web search provider uses a custom route "${value}" and cannot be replaced`);
|
|
1577
|
-
}
|
|
1578
1543
|
function assertFetchProviderId(id) {
|
|
1579
1544
|
if (!FETCH_PROVIDER_IDS.has(id)) throw new Error(`unsupported web fetch provider id "${id}"`);
|
|
1580
1545
|
}
|
|
1581
|
-
function assertFetchProviderReplaceable(value) {
|
|
1582
|
-
if (value === void 0 || value === "") return;
|
|
1583
|
-
if (typeof value !== "string") throw new Error("the configured Web fetch provider is unreadable and cannot be replaced");
|
|
1584
|
-
if (!FETCH_PROVIDER_IDS.has(value)) throw new Error(`the configured Web fetch provider uses a custom route "${value}" and cannot be replaced`);
|
|
1585
|
-
}
|
|
1586
1546
|
function assertSearchApiCount(count) {
|
|
1587
1547
|
if (!Number.isInteger(count) || count < 1 || count > 50) throw new Error(`the web search API count must be an integer from 1 through 50`);
|
|
1588
1548
|
}
|
|
@@ -1663,7 +1623,7 @@ function webApiAdvancedFactsOf(value) {
|
|
|
1663
1623
|
* object: the caller MUST treat that as an unreadable section, never as "no
|
|
1664
1624
|
* USER override". */
|
|
1665
1625
|
function webProviderSelectionFactsOf(base, user, field) {
|
|
1666
|
-
if (!isPlainRecord$
|
|
1626
|
+
if (!isPlainRecord$1(base) || !isPlainRecord$1(user)) return void 0;
|
|
1667
1627
|
const baseValue = base[field];
|
|
1668
1628
|
const userValue = user[field];
|
|
1669
1629
|
return {
|
|
@@ -1673,11 +1633,81 @@ function webProviderSelectionFactsOf(base, user, field) {
|
|
|
1673
1633
|
};
|
|
1674
1634
|
}
|
|
1675
1635
|
/** Whether a value is a plain data object (not an array, null, or class instance). */
|
|
1676
|
-
function isPlainRecord$
|
|
1636
|
+
function isPlainRecord$1(value) {
|
|
1677
1637
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
1678
1638
|
const proto = Object.getPrototypeOf(value);
|
|
1679
1639
|
return proto === Object.prototype || proto === null;
|
|
1680
1640
|
}
|
|
1641
|
+
/** The effective provider id of one official `web` descriptor value. */
|
|
1642
|
+
function webProviderEffectiveId(value, field) {
|
|
1643
|
+
const raw = value?.[field];
|
|
1644
|
+
return typeof raw === "string" && raw !== "" ? raw : void 0;
|
|
1645
|
+
}
|
|
1646
|
+
/** Whether the official USER/base layering facts moved since the capture. The
|
|
1647
|
+
* target namespace revision is checked separately; this is the semantic fact
|
|
1648
|
+
* comparison (a same-revision Host can still project different layers). */
|
|
1649
|
+
function webProviderSelectionChanged(current, captured) {
|
|
1650
|
+
return current === void 0 || current.baseId !== captured.baseId || current.userSet !== captured.userSet || current.userId !== captured.userId;
|
|
1651
|
+
}
|
|
1652
|
+
/** Whether an explicit provider select is already stored as a USER own-field.
|
|
1653
|
+
* An inherited effective value with the same id is NOT a no-op: the explicit
|
|
1654
|
+
* pin must reach the official setter. */
|
|
1655
|
+
function webProviderSelectIsNoOp(selection, effective, id) {
|
|
1656
|
+
return effective === id && selection.userSet && selection.userId === id;
|
|
1657
|
+
}
|
|
1658
|
+
/** Whether a provider restore is already satisfied: no USER own-field and the
|
|
1659
|
+
* effective value already equals the deployment base. */
|
|
1660
|
+
function webProviderRestoreIsNoOp(selection, effective) {
|
|
1661
|
+
return !selection.userSet && effective === selection.baseId;
|
|
1662
|
+
}
|
|
1663
|
+
/** The refusal reason for an explicit provider select when the current
|
|
1664
|
+
* effective route is a CUSTOM id. A custom route is never overwritten here. */
|
|
1665
|
+
function webProviderSelectRefusal(capability, effective) {
|
|
1666
|
+
if (effective === void 0) return void 0;
|
|
1667
|
+
if ((capability === "search" ? SEARCH_PROVIDER_IDS : FETCH_PROVIDER_IDS).has(effective)) return void 0;
|
|
1668
|
+
return `the configured provider is a custom route (${effective}); only the official candidates are selectable here`;
|
|
1669
|
+
}
|
|
1670
|
+
/** The non-empty rc.2 YAML-only override FIELD NAMES of one capability, read
|
|
1671
|
+
* from the official `web-deepseek-api` descriptor value. This is the raw
|
|
1672
|
+
* presence guard: display labels, masked facts or a UI boolean never decide
|
|
1673
|
+
* billing eligibility. */
|
|
1674
|
+
function webAdvancedOverrideFieldNames(value, capability) {
|
|
1675
|
+
return (capability === "search" ? ["searchBaseURL", "searchApiKeyEnv"] : ["fetchBaseURL", "fetchApiKeyEnv"]).filter((field) => typeof value?.[field] === "string" && value[field] !== "");
|
|
1676
|
+
}
|
|
1677
|
+
/** The shared eligibility REASON: the same product policy answers both the
|
|
1678
|
+
* command admission (detached facts) and the adapter dispatch guard (raw
|
|
1679
|
+
* descriptor facts). */
|
|
1680
|
+
function webBillingEligibilityReason(capability, effectiveProvider, overrideFields) {
|
|
1681
|
+
if (effectiveProvider !== (capability === "search" ? "deepseek-search-api" : "deepseek-fetch-api")) return capability === "search" ? "the DeepSeek Search API Billing is editable here only while that API is the explicitly selected provider; Automatic routes at request time" : "the Fetch route is not the DeepSeek Fetch API; Fetch Billing applies only to that API";
|
|
1682
|
+
if (overrideFields.length > 0) return `the ${capability} API is overridden by Host YAML (${overrideFields.join(" and ")}); the billing choice cannot be written here`;
|
|
1683
|
+
}
|
|
1684
|
+
function webBillingEligibility(webValue, apiValue, capability) {
|
|
1685
|
+
const reason = webBillingEligibilityReason(capability, webProviderEffectiveId(webValue, capability === "search" ? "searchProvider" : "fetchProvider"), webAdvancedOverrideFieldNames(apiValue, capability));
|
|
1686
|
+
return reason === void 0 ? { ok: true } : {
|
|
1687
|
+
ok: false,
|
|
1688
|
+
reason
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
/** Whether two Web observations belong to the SAME Host authority observation:
|
|
1692
|
+
* the opaque generation always, plus the target namespace revision(s) (`both`
|
|
1693
|
+
* by default). A→B→A is three distinct observations even when the numeric
|
|
1694
|
+
* revisions and values repeat. */
|
|
1695
|
+
function sameWebAuthority(a, b, target = "both") {
|
|
1696
|
+
if (a === void 0 || b === void 0) return a === b;
|
|
1697
|
+
if (!Object.is(a.generation, b.generation)) return false;
|
|
1698
|
+
const web = a.webRevision === b.webRevision;
|
|
1699
|
+
const api = a.apiRevision === b.apiRevision;
|
|
1700
|
+
return target === "web" ? web : target === "api" ? api : web && api;
|
|
1701
|
+
}
|
|
1702
|
+
/** Internal control-flow sentinel: the captured request is already satisfied
|
|
1703
|
+
* and NO Host mutation may be dispatched. Adapters translate it into the
|
|
1704
|
+
* distinct `no-changes` outcome; it never reaches a UI or a wire. */
|
|
1705
|
+
var WebProviderNoChanges = class extends Error {
|
|
1706
|
+
constructor() {
|
|
1707
|
+
super("the Host already holds the requested Web setting; nothing was written");
|
|
1708
|
+
this.name = "WebProviderNoChanges";
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1681
1711
|
//#endregion
|
|
1682
1712
|
//#region src/domain/mcp/server-config.ts
|
|
1683
1713
|
/**
|
|
@@ -1976,22 +2006,22 @@ function mcpSetEnabledOps(name, enabled) {
|
|
|
1976
2006
|
}];
|
|
1977
2007
|
}
|
|
1978
2008
|
/** Whether one raw value is a plain record (not an array/null). */
|
|
1979
|
-
function isPlainRecord
|
|
2009
|
+
function isPlainRecord(value) {
|
|
1980
2010
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1981
2011
|
}
|
|
1982
2012
|
/** Read one layer's `servers` map (own keys only — a name like `__proto__`
|
|
1983
2013
|
* must never resolve through the prototype chain). */
|
|
1984
2014
|
function serverMapOf(layer) {
|
|
1985
|
-
if (!isPlainRecord
|
|
2015
|
+
if (!isPlainRecord(layer)) return void 0;
|
|
1986
2016
|
const servers = layer.servers;
|
|
1987
|
-
return isPlainRecord
|
|
2017
|
+
return isPlainRecord(servers) ? servers : void 0;
|
|
1988
2018
|
}
|
|
1989
2019
|
/** Structural equality of two detached JSON-shaped values: key order does not
|
|
1990
2020
|
* matter for objects, array order does, and absent ≠ present. */
|
|
1991
2021
|
function structurallyEqual(left, right) {
|
|
1992
2022
|
if (left === right) return true;
|
|
1993
2023
|
if (Array.isArray(left) || Array.isArray(right)) return Array.isArray(left) && Array.isArray(right) && left.length === right.length && left.every((item, index) => structurallyEqual(item, right[index]));
|
|
1994
|
-
if (isPlainRecord
|
|
2024
|
+
if (isPlainRecord(left) && isPlainRecord(right)) {
|
|
1995
2025
|
const keys = Object.keys(left);
|
|
1996
2026
|
return keys.length === Object.keys(right).length && keys.every((key) => Object.hasOwn(right, key) && structurallyEqual(left[key], right[key]));
|
|
1997
2027
|
}
|
|
@@ -2017,9 +2047,9 @@ function classifyMcpServerProvenance(base, value, name) {
|
|
|
2017
2047
|
* when the descriptor carries no base entry / no dict fields.
|
|
2018
2048
|
*/
|
|
2019
2049
|
function baseDictKeysOf(baseEntry) {
|
|
2020
|
-
if (!isPlainRecord
|
|
2050
|
+
if (!isPlainRecord(baseEntry)) return void 0;
|
|
2021
2051
|
const of = (value) => {
|
|
2022
|
-
if (!isPlainRecord
|
|
2052
|
+
if (!isPlainRecord(value)) return void 0;
|
|
2023
2053
|
return new Set(Object.keys(value));
|
|
2024
2054
|
};
|
|
2025
2055
|
const env = of(baseEntry.env);
|
|
@@ -2036,7 +2066,7 @@ function baseDictKeysOf(baseEntry) {
|
|
|
2036
2066
|
* stored value with a guess. The effective `enabled` defaults to true per the
|
|
2037
2067
|
* official schema. */
|
|
2038
2068
|
function projectMcpServerEntry(value) {
|
|
2039
|
-
if (!isPlainRecord
|
|
2069
|
+
if (!isPlainRecord(value)) return void 0;
|
|
2040
2070
|
const transport = value.transport;
|
|
2041
2071
|
if (transport !== "stdio" && transport !== "streamable-http") return void 0;
|
|
2042
2072
|
const stringOf = (input) => typeof input === "string" ? input : void 0;
|
|
@@ -2045,7 +2075,7 @@ function projectMcpServerEntry(value) {
|
|
|
2045
2075
|
return Object.freeze([...input]);
|
|
2046
2076
|
};
|
|
2047
2077
|
const mapOf = (input) => {
|
|
2048
|
-
if (!isPlainRecord
|
|
2078
|
+
if (!isPlainRecord(input)) return void 0;
|
|
2049
2079
|
const out = /* @__PURE__ */ new Map();
|
|
2050
2080
|
for (const [key, entry] of Object.entries(input)) {
|
|
2051
2081
|
if (typeof entry !== "string") return void 0;
|
|
@@ -2618,69 +2648,6 @@ function normalizeInputEvent(data) {
|
|
|
2618
2648
|
};
|
|
2619
2649
|
}
|
|
2620
2650
|
//#endregion
|
|
2621
|
-
//#region src/domain/session/model-selection.ts
|
|
2622
|
-
function recordOf(value) {
|
|
2623
|
-
return typeof value === "object" && value !== null ? value : void 0;
|
|
2624
|
-
}
|
|
2625
|
-
/**
|
|
2626
|
-
* Normalize untrusted event data into a detached model-selection value.
|
|
2627
|
-
* Provider and model identifiers are intentionally not trimmed: whitespace is
|
|
2628
|
-
* part of an identifier if a provider elected to use it.
|
|
2629
|
-
*/
|
|
2630
|
-
function normalizeModelSelection(value) {
|
|
2631
|
-
const record = recordOf(value);
|
|
2632
|
-
if (record === void 0 || typeof record.provider !== "string" || record.provider.length === 0 || typeof record.model !== "string" || record.model.length === 0) return void 0;
|
|
2633
|
-
if (record.reasoningEffort === void 0 || record.reasoningEffort === null) return {
|
|
2634
|
-
provider: record.provider,
|
|
2635
|
-
model: record.model
|
|
2636
|
-
};
|
|
2637
|
-
if (typeof record.reasoningEffort !== "string" || record.reasoningEffort.length === 0) return void 0;
|
|
2638
|
-
return {
|
|
2639
|
-
provider: record.provider,
|
|
2640
|
-
model: record.model,
|
|
2641
|
-
reasoningEffort: record.reasoningEffort
|
|
2642
|
-
};
|
|
2643
|
-
}
|
|
2644
|
-
/** Compare provider, model, and the presence/value of reasoning effort.
|
|
2645
|
-
* Defensive by contract: malformed runtime values (null, non-objects) are
|
|
2646
|
-
* never equal to anything, so untrusted event data cannot throw here. */
|
|
2647
|
-
function sameModelSelection(left, right) {
|
|
2648
|
-
if (left === void 0 || right === void 0) return false;
|
|
2649
|
-
if (typeof left !== "object" || left === null || typeof right !== "object" || right === null) return false;
|
|
2650
|
-
return left.provider === right.provider && left.model === right.model && left.reasoningEffort === right.reasoningEffort;
|
|
2651
|
-
}
|
|
2652
|
-
function requestConfig(header) {
|
|
2653
|
-
const headerRecord = recordOf(header);
|
|
2654
|
-
return headerRecord === void 0 ? void 0 : recordOf(headerRecord.config);
|
|
2655
|
-
}
|
|
2656
|
-
/**
|
|
2657
|
-
* Read the raw selection used for pending-intent matching. This intentionally
|
|
2658
|
-
* keeps an adapter-generated effort: consumption compares the exact request
|
|
2659
|
-
* header fields, not the sanitized user-facing representation.
|
|
2660
|
-
*/
|
|
2661
|
-
function rawSelectionFromRequestHeader(header) {
|
|
2662
|
-
const config = requestConfig(header);
|
|
2663
|
-
if (config === void 0 || typeof config.provider !== "string" || config.provider.length === 0 || typeof config.model !== "string" || config.model.length === 0) return void 0;
|
|
2664
|
-
if (config.reasoningEffort === void 0 || config.reasoningEffort === null) return {
|
|
2665
|
-
provider: config.provider,
|
|
2666
|
-
model: config.model
|
|
2667
|
-
};
|
|
2668
|
-
if (typeof config.reasoningEffort !== "string" || config.reasoningEffort.length === 0) return void 0;
|
|
2669
|
-
return {
|
|
2670
|
-
provider: config.provider,
|
|
2671
|
-
model: config.model,
|
|
2672
|
-
reasoningEffort: config.reasoningEffort
|
|
2673
|
-
};
|
|
2674
|
-
}
|
|
2675
|
-
/** Clone a detached value so a Host-owned selection cannot cross the boundary by alias. */
|
|
2676
|
-
function copyModelSelection(value) {
|
|
2677
|
-
return value === void 0 ? void 0 : {
|
|
2678
|
-
provider: value.provider,
|
|
2679
|
-
model: value.model,
|
|
2680
|
-
...value.reasoningEffort === void 0 ? {} : { reasoningEffort: value.reasoningEffort }
|
|
2681
|
-
};
|
|
2682
|
-
}
|
|
2683
|
-
//#endregion
|
|
2684
2651
|
//#region src/domain/command/policy.ts
|
|
2685
2652
|
/**
|
|
2686
2653
|
* The transport/UI-neutral command-line policy (plan §27 / TS8-F3): which slash
|
|
@@ -2717,7 +2684,6 @@ const SESSIONLESS_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
2717
2684
|
"focus",
|
|
2718
2685
|
"footer",
|
|
2719
2686
|
"settings",
|
|
2720
|
-
"help",
|
|
2721
2687
|
"attach",
|
|
2722
2688
|
"image",
|
|
2723
2689
|
"login",
|
|
@@ -2816,7 +2782,6 @@ const LOCAL_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
2816
2782
|
"focus",
|
|
2817
2783
|
"footer",
|
|
2818
2784
|
"fork",
|
|
2819
|
-
"help",
|
|
2820
2785
|
"attach",
|
|
2821
2786
|
"image",
|
|
2822
2787
|
"keybindings",
|
|
@@ -3009,7 +2974,6 @@ const READ_ONLY_LOCAL_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
3009
2974
|
"reload",
|
|
3010
2975
|
"exit",
|
|
3011
2976
|
"quit",
|
|
3012
|
-
"help",
|
|
3013
2977
|
"keybindings",
|
|
3014
2978
|
"copy",
|
|
3015
2979
|
"attach",
|
|
@@ -6169,193 +6133,6 @@ var ScheduleOutcomeUnknownError = class extends Error {
|
|
|
6169
6133
|
}
|
|
6170
6134
|
};
|
|
6171
6135
|
//#endregion
|
|
6172
|
-
//#region src/runtime/write-outcome.ts
|
|
6173
|
-
/**
|
|
6174
|
-
* Pinned Gateway infrastructure codes raised strictly BEFORE the addressed
|
|
6175
|
-
* business method is invoked (descriptor/argument/receiver/endpoint resolution
|
|
6176
|
-
* and context/lookup provider resolution — all inside `prepareInvocation` and
|
|
6177
|
-
* boundary decoding): such a failure proves the operation did not commit. The
|
|
6178
|
-
* only Gateway code raised AFTER invocation is `gateway/result-invalid`, so it
|
|
6179
|
-
* is deliberately absent.
|
|
6180
|
-
*/
|
|
6181
|
-
const GATEWAY_PRE_INVOCATION_CODES = /* @__PURE__ */ new Set([
|
|
6182
|
-
"gateway/ambiguous-endpoint",
|
|
6183
|
-
"gateway/arguments-invalid",
|
|
6184
|
-
"gateway/binding-invalid",
|
|
6185
|
-
"gateway/context-failed",
|
|
6186
|
-
"gateway/context-not-found",
|
|
6187
|
-
"gateway/context-unavailable",
|
|
6188
|
-
"gateway/definition-unavailable",
|
|
6189
|
-
"gateway/input-invalid",
|
|
6190
|
-
"gateway/invocation-unavailable",
|
|
6191
|
-
"gateway/lookup-failed",
|
|
6192
|
-
"gateway/lookup-not-found",
|
|
6193
|
-
"gateway/lookup-unavailable",
|
|
6194
|
-
"gateway/method-unavailable",
|
|
6195
|
-
"gateway/provider-mismatch",
|
|
6196
|
-
"gateway/service-unavailable",
|
|
6197
|
-
"gateway/signature-invalid",
|
|
6198
|
-
"gateway/interactions-forbidden"
|
|
6199
|
-
]);
|
|
6200
|
-
/**
|
|
6201
|
-
* Whether a failure code PROVES the addressed operation was refused: domain
|
|
6202
|
-
* codes, `gateway/bad-request`, and the pinned pre-invocation Gateway
|
|
6203
|
-
* infrastructure codes qualify. `gateway/cancelled`, `gateway/internal`,
|
|
6204
|
-
* `gateway/result-invalid`, an unknown `gateway/*` code, or a code-less failure
|
|
6205
|
-
* do NOT (the commit state stays unproven).
|
|
6206
|
-
*
|
|
6207
|
-
* SCOPE: this predicate expresses ONLY the D2.2-verified write vocabulary plus
|
|
6208
|
-
* the pinned Gateway pre-invocation codes. It is NOT a general
|
|
6209
|
-
* idempotency/commit judgement: a domain code does not universally prove that
|
|
6210
|
-
* no mutation happened (e.g. `session/workspace-attach-failed` can follow a
|
|
6211
|
-
* successful Session create/fork). Later operation families (D2.3/D2.4) must
|
|
6212
|
-
* use their own operation-specific settlement table rather than extending this
|
|
6213
|
-
* helper.
|
|
6214
|
-
*/
|
|
6215
|
-
function isRemoteBusinessRefusalCode(code) {
|
|
6216
|
-
if (code === void 0) return false;
|
|
6217
|
-
if (code === "gateway/bad-request") return true;
|
|
6218
|
-
if (code.startsWith("gateway/")) return GATEWAY_PRE_INVOCATION_CODES.has(code);
|
|
6219
|
-
return true;
|
|
6220
|
-
}
|
|
6221
|
-
//#endregion
|
|
6222
|
-
//#region src/runtime/remote/write-failure.ts
|
|
6223
|
-
/**
|
|
6224
|
-
* Remote write settlement classification (D2.2): map one official Client
|
|
6225
|
-
* `RemoteResult` failure into the shared `WriteOutcome` vocabulary without
|
|
6226
|
-
* inventing a second Remote-only taxonomy.
|
|
6227
|
-
*
|
|
6228
|
-
* The official failure vocabulary is code-discriminated. Business refusals
|
|
6229
|
-
* carry their domain code (`session/*`, `subagent/*`, `agent-preset/*`, ...),
|
|
6230
|
-
* the gateway's own admission code (`gateway/bad-request`), or one of the
|
|
6231
|
-
* pinned Gateway's infrastructure codes that are raised BEFORE the addressed
|
|
6232
|
-
* business method runs (descriptor/argument/receiver/endpoint resolution and
|
|
6233
|
-
* context/lookup provider resolution), so the operation definitely did not
|
|
6234
|
-
* commit. `gateway/cancelled` is a caller cancellation; `gateway/internal` and
|
|
6235
|
-
* `gateway/result-invalid` (which the Gateway raises AFTER the method returned)
|
|
6236
|
-
* leave the commit state unproven. A failure this classifier cannot prove was a
|
|
6237
|
-
* refusal must never be reported as `rejected` — it stays `indeterminate`,
|
|
6238
|
-
* because the write may still have committed.
|
|
6239
|
-
*
|
|
6240
|
-
* @module @xmoon76/dsh-pi-tui/runtime/remote/write-failure
|
|
6241
|
-
*/
|
|
6242
|
-
/** Read the stable code off a structural official failure. */
|
|
6243
|
-
function remoteFailureCode(error) {
|
|
6244
|
-
if (typeof error !== "object" || error === null) return void 0;
|
|
6245
|
-
const code = error.code;
|
|
6246
|
-
return typeof code === "string" && code !== "" ? code : void 0;
|
|
6247
|
-
}
|
|
6248
|
-
/**
|
|
6249
|
-
* The official Client carrier rebuilds a failure as a plain `{code, message,
|
|
6250
|
-
* details}` value across the wire, not necessarily an `Error` instance.
|
|
6251
|
-
* `safeErrorMessage` would `String()` such an object to `[object Object]`, so
|
|
6252
|
-
* prefer the structural `message` string before falling back.
|
|
6253
|
-
*/
|
|
6254
|
-
function remoteFailureMessage(error) {
|
|
6255
|
-
if (typeof error === "object" && error !== null) {
|
|
6256
|
-
const message = error.message;
|
|
6257
|
-
if (typeof message === "string") return message;
|
|
6258
|
-
}
|
|
6259
|
-
return safeErrorMessage(error);
|
|
6260
|
-
}
|
|
6261
|
-
/** A caller/backend cancellation proved by the official code or the error name. */
|
|
6262
|
-
function isRemoteCancellation(error) {
|
|
6263
|
-
if (isCancellation(error)) return true;
|
|
6264
|
-
return remoteFailureCode(error) === "gateway/cancelled";
|
|
6265
|
-
}
|
|
6266
|
-
/** Whether one value is a structurally-owned wire record (never an array, a
|
|
6267
|
-
* class instance, or a primitive). */
|
|
6268
|
-
function isPlainRecord(value) {
|
|
6269
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
6270
|
-
const prototype = Object.getPrototypeOf(value);
|
|
6271
|
-
return prototype === Object.prototype || prototype === null;
|
|
6272
|
-
}
|
|
6273
|
-
/**
|
|
6274
|
-
* Copy one wire-shaped value into an owned frozen plain tree.
|
|
6275
|
-
*
|
|
6276
|
-
* The official failure `details` crosses the wire as JSON — nested `issues`
|
|
6277
|
-
* arrays and objects included — so plain objects, arrays and scalars are the
|
|
6278
|
-
* only transferable shapes. A non-plain value (a Host class instance,
|
|
6279
|
-
* function, symbol or bigint) is not wire data: it is detached to `undefined`
|
|
6280
|
-
* rather than escaping as a live Host object.
|
|
6281
|
-
*/
|
|
6282
|
-
function detachWireValue(value) {
|
|
6283
|
-
if (typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") return void 0;
|
|
6284
|
-
if (value === null || typeof value !== "object") return value;
|
|
6285
|
-
if (Array.isArray(value)) return Object.freeze(value.map(detachWireValue));
|
|
6286
|
-
if (!isPlainRecord(value)) return void 0;
|
|
6287
|
-
const copy = {};
|
|
6288
|
-
for (const [key, entry] of Object.entries(value)) copy[key] = detachWireValue(entry);
|
|
6289
|
-
return Object.freeze(copy);
|
|
6290
|
-
}
|
|
6291
|
-
/**
|
|
6292
|
-
* Copy the official failure `details` into an owned, deeply frozen plain tree
|
|
6293
|
-
* so no Host-owned object — nested arrays/objects included — escapes the
|
|
6294
|
-
* adapter. A non-record `details` value, and an empty one that carries no
|
|
6295
|
-
* structural payload, is dropped.
|
|
6296
|
-
*/
|
|
6297
|
-
function copyFailureDetails(error) {
|
|
6298
|
-
if (typeof error !== "object" || error === null) return void 0;
|
|
6299
|
-
if (!isPlainRecord(error.details)) return void 0;
|
|
6300
|
-
const copy = {};
|
|
6301
|
-
for (const [key, entry] of Object.entries(error.details)) copy[key] = detachWireValue(entry);
|
|
6302
|
-
const detached = Object.freeze(copy);
|
|
6303
|
-
return Object.keys(detached).length === 0 ? void 0 : detached;
|
|
6304
|
-
}
|
|
6305
|
-
/** Actionable recovery guidance for `session/writer-held`.
|
|
6306
|
-
*
|
|
6307
|
-
* The official Host reports only that a Session writer handle is held; it
|
|
6308
|
-
* cannot tell which process or context owns it, and the TUI must never take
|
|
6309
|
-
* over, kill a holder, force a resume, or retry automatically. The guidance is
|
|
6310
|
-
* therefore a recovery action for the user, and it must not claim a specific
|
|
6311
|
-
* holder. */
|
|
6312
|
-
const SESSION_WRITER_HELD_GUIDANCE = "this Session is already in use, possibly by another running DSH instance or context; exit the instance or context holding it, then retry";
|
|
6313
|
-
/** The user-facing message for one settled failure code. `session/writer-held`
|
|
6314
|
-
* replaces the Host's internal diagnostic with actionable recovery guidance —
|
|
6315
|
-
* the code and `details` keep the machine-readable facts. */
|
|
6316
|
-
function settledWriteMessage(code, error) {
|
|
6317
|
-
return code === "session/writer-held" ? SESSION_WRITER_HELD_GUIDANCE : remoteFailureMessage(error);
|
|
6318
|
-
}
|
|
6319
|
-
/**
|
|
6320
|
-
* Classify one failed official write (a `RemoteResult` error branch) into the
|
|
6321
|
-
* shared non-committed outcome vocabulary.
|
|
6322
|
-
*/
|
|
6323
|
-
function classifyRemoteWriteFailure(error) {
|
|
6324
|
-
if (isRemoteCancellation(error)) return { kind: "cancelled" };
|
|
6325
|
-
const code = remoteFailureCode(error);
|
|
6326
|
-
const details = copyFailureDetails(error);
|
|
6327
|
-
if (isRemoteBusinessRefusalCode(code)) return {
|
|
6328
|
-
kind: "rejected",
|
|
6329
|
-
error: {
|
|
6330
|
-
code,
|
|
6331
|
-
message: settledWriteMessage(code, error),
|
|
6332
|
-
...details === void 0 ? {} : { details }
|
|
6333
|
-
}
|
|
6334
|
-
};
|
|
6335
|
-
return {
|
|
6336
|
-
kind: "indeterminate",
|
|
6337
|
-
error: {
|
|
6338
|
-
code: code ?? "session/write-indeterminate",
|
|
6339
|
-
message: settledWriteMessage(code, error),
|
|
6340
|
-
...details === void 0 ? {} : { details }
|
|
6341
|
-
}
|
|
6342
|
-
};
|
|
6343
|
-
}
|
|
6344
|
-
/** A rejection the adapter itself proved before any Host dispatch. */
|
|
6345
|
-
function remoteRejected(code, message) {
|
|
6346
|
-
return {
|
|
6347
|
-
kind: "rejected",
|
|
6348
|
-
error: {
|
|
6349
|
-
code,
|
|
6350
|
-
message
|
|
6351
|
-
}
|
|
6352
|
-
};
|
|
6353
|
-
}
|
|
6354
|
-
/** A pre-dispatch fence refusal: the operation is known not to have been sent. */
|
|
6355
|
-
function remoteNotDispatched() {
|
|
6356
|
-
return { kind: "cancelled" };
|
|
6357
|
-
}
|
|
6358
|
-
//#endregion
|
|
6359
6136
|
//#region src/runtime/capability.ts
|
|
6360
6137
|
/** The capabilities the experimental Remote backend serves: exactly the
|
|
6361
6138
|
* ports its M3-3B assembly provides. A capability is added HERE only when its
|
|
@@ -6650,31 +6427,6 @@ function detachedTodos(value) {
|
|
|
6650
6427
|
return Object.freeze(todos);
|
|
6651
6428
|
}
|
|
6652
6429
|
//#endregion
|
|
6653
|
-
//#region src/runtime/interaction-port.ts
|
|
6654
|
-
/** The official Host code for a late answer whose reply is already queued. */
|
|
6655
|
-
const QUESTION_REPLY_QUEUED = "REPLY_QUEUED";
|
|
6656
|
-
/** The official Host code for a late answer that does not name each question. */
|
|
6657
|
-
const QUESTION_BAD_ANSWER = "BAD_ANSWER";
|
|
6658
|
-
/**
|
|
6659
|
-
* One rejected late answer with the Host's stable code (`REPLY_QUEUED`,
|
|
6660
|
-
* `BAD_ANSWER`, `CALLER_NOT_LIVE`, or a transport/gateway code). Both
|
|
6661
|
-
* adapters throw THIS shape so a consumer can offer truthful recovery
|
|
6662
|
-
* without switching on a backend.
|
|
6663
|
-
*/
|
|
6664
|
-
var QuestionAnswerError = class extends Error {
|
|
6665
|
-
code;
|
|
6666
|
-
constructor(code, message, options) {
|
|
6667
|
-
super(message, options);
|
|
6668
|
-
this.name = "QuestionAnswerError";
|
|
6669
|
-
this.code = code;
|
|
6670
|
-
}
|
|
6671
|
-
};
|
|
6672
|
-
/** Wrap an unknown failure from the late-answer path in the port vocabulary. */
|
|
6673
|
-
function questionAnswerError(error) {
|
|
6674
|
-
if (error instanceof QuestionAnswerError) return error;
|
|
6675
|
-
return new QuestionAnswerError(typeof error === "object" && error !== null && typeof error.code === "string" ? error.code : "question/answer-failed", typeof error === "object" && error !== null && typeof error.message === "string" ? error.message : String(error), { cause: error });
|
|
6676
|
-
}
|
|
6677
|
-
//#endregion
|
|
6678
6430
|
//#region src/runtime/subagent-settings.ts
|
|
6679
6431
|
function plainRecord$1(value) {
|
|
6680
6432
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
@@ -7195,6 +6947,529 @@ function detachPluginUpdateResult(result) {
|
|
|
7195
6947
|
});
|
|
7196
6948
|
}
|
|
7197
6949
|
//#endregion
|
|
6950
|
+
//#region src/runtime/session-inspector-projection.ts
|
|
6951
|
+
/**
|
|
6952
|
+
* The detached Session Inspector projection (Session Workspace PR2): one pure,
|
|
6953
|
+
* Host-import-free mapping from the official projection values of ONE exact
|
|
6954
|
+
* Session to the UI-neutral Inspector DTO.
|
|
6955
|
+
*
|
|
6956
|
+
* The mapper owns the numeric/derived semantics only (the fixed Inspector
|
|
6957
|
+
* contract): the official `sessionStats` whole-log counters with their wall
|
|
6958
|
+
* time averages, the four disjoint `tokenUsage` buckets, the approximate
|
|
6959
|
+
* `contextPressure` occupancy, and the identity/reading facts already defined
|
|
6960
|
+
* by {@link detachedSessionStatus}. It never recomputes a whole-log statistic
|
|
6961
|
+
* from a window, never reads an Agent, never falls back to another Session and
|
|
6962
|
+
* never coerces an unknown value into a fabricated zero.
|
|
6963
|
+
*
|
|
6964
|
+
* Full contract: docs/architecture/host-client.md.
|
|
6965
|
+
* @module @xmoon76/dsh-pi-tui/runtime/session-inspector-projection
|
|
6966
|
+
*/
|
|
6967
|
+
/**
|
|
6968
|
+
* The fixed official projection keys one Session Inspector read requests. This
|
|
6969
|
+
* is the ONE key list both real adapters use; there is no second copy.
|
|
6970
|
+
* `sessionStats` is whole-log and summary-excluded, so it is only ever read
|
|
6971
|
+
* through this exact-key/observation path.
|
|
6972
|
+
*/
|
|
6973
|
+
const INSPECTOR_PROJECTION_KEYS = [
|
|
6974
|
+
"sessionStats",
|
|
6975
|
+
"tokenUsage",
|
|
6976
|
+
"contextPressure",
|
|
6977
|
+
"modelSelection",
|
|
6978
|
+
"agentPreset",
|
|
6979
|
+
"title",
|
|
6980
|
+
"workingDirectory",
|
|
6981
|
+
"goal",
|
|
6982
|
+
"todos"
|
|
6983
|
+
];
|
|
6984
|
+
/** One finite non-negative projection number, or `undefined` (never coerced). */
|
|
6985
|
+
function finiteNonNegative(value) {
|
|
6986
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
6987
|
+
}
|
|
6988
|
+
/** One finite non-negative integer counter, or `undefined`. */
|
|
6989
|
+
function countOf(value) {
|
|
6990
|
+
const number = finiteNonNegative(value);
|
|
6991
|
+
return number !== void 0 && Number.isInteger(number) ? number : void 0;
|
|
6992
|
+
}
|
|
6993
|
+
/** A non-empty own object record (projection values are always JSON objects). */
|
|
6994
|
+
function isRecord$2(value) {
|
|
6995
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6996
|
+
}
|
|
6997
|
+
/**
|
|
6998
|
+
* Detach the official whole-log `sessionStats` unit. ALL eight fields must be
|
|
6999
|
+
* legal; a missing/malformed unit omits the whole group rather than presenting
|
|
7000
|
+
* a partial or fabricated statistic. Authoritative zero is preserved.
|
|
7001
|
+
*/
|
|
7002
|
+
function statsOf(value) {
|
|
7003
|
+
if (!isRecord$2(value)) return void 0;
|
|
7004
|
+
const turns = countOf(value.turns);
|
|
7005
|
+
const steps = countOf(value.steps);
|
|
7006
|
+
const llmMs = finiteNonNegative(value.llmMs);
|
|
7007
|
+
const toolMs = finiteNonNegative(value.toolMs);
|
|
7008
|
+
const ttftMs = finiteNonNegative(value.ttftMs);
|
|
7009
|
+
const ttftSteps = countOf(value.ttftSteps);
|
|
7010
|
+
const decodeMs = finiteNonNegative(value.decodeMs);
|
|
7011
|
+
const decodeTokens = countOf(value.decodeTokens);
|
|
7012
|
+
if (turns === void 0 || steps === void 0 || llmMs === void 0 || toolMs === void 0 || ttftMs === void 0 || ttftSteps === void 0 || decodeMs === void 0 || decodeTokens === void 0) return;
|
|
7013
|
+
const avgTtftMs = ttftSteps > 0 ? ttftMs / ttftSteps : void 0;
|
|
7014
|
+
const decodeTokensPerSec = decodeMs > 0 ? decodeTokens * 1e3 / decodeMs : void 0;
|
|
7015
|
+
return {
|
|
7016
|
+
turns,
|
|
7017
|
+
steps,
|
|
7018
|
+
llmMs,
|
|
7019
|
+
toolMs,
|
|
7020
|
+
...avgTtftMs !== void 0 && Number.isFinite(avgTtftMs) ? { avgTtftMs } : {},
|
|
7021
|
+
...decodeTokensPerSec !== void 0 && Number.isFinite(decodeTokensPerSec) ? { decodeTokensPerSec } : {}
|
|
7022
|
+
};
|
|
7023
|
+
}
|
|
7024
|
+
/**
|
|
7025
|
+
* Detach the official `tokenUsage` four-bucket projection. The buckets must all
|
|
7026
|
+
* be legal; the total/ratio derived values are omitted rather than emitted as
|
|
7027
|
+
* `Infinity`/`NaN`.
|
|
7028
|
+
*/
|
|
7029
|
+
function usageOf(value) {
|
|
7030
|
+
if (!isRecord$2(value)) return void 0;
|
|
7031
|
+
const uncachedInputTokens = finiteNonNegative(value.uncachedInputTokens);
|
|
7032
|
+
const outputTokens = finiteNonNegative(value.outputTokens);
|
|
7033
|
+
const cacheReadTokens = finiteNonNegative(value.cacheReadTokens);
|
|
7034
|
+
const cacheWriteTokens = finiteNonNegative(value.cacheWriteTokens);
|
|
7035
|
+
if (uncachedInputTokens === void 0 || outputTokens === void 0 || cacheReadTokens === void 0 || cacheWriteTokens === void 0) return;
|
|
7036
|
+
const totalTokens = uncachedInputTokens + outputTokens + cacheReadTokens + cacheWriteTokens;
|
|
7037
|
+
if (!Number.isFinite(totalTokens)) return void 0;
|
|
7038
|
+
const cacheDenominator = uncachedInputTokens + cacheReadTokens + cacheWriteTokens;
|
|
7039
|
+
return {
|
|
7040
|
+
uncachedInputTokens,
|
|
7041
|
+
outputTokens,
|
|
7042
|
+
cacheReadTokens,
|
|
7043
|
+
cacheWriteTokens,
|
|
7044
|
+
totalTokens,
|
|
7045
|
+
...cacheDenominator > 0 ? { cacheHitPct: cacheReadTokens / cacheDenominator * 100 } : {}
|
|
7046
|
+
};
|
|
7047
|
+
}
|
|
7048
|
+
/**
|
|
7049
|
+
* Detach the approximate context occupancy: `projectedTokens ?? pressureTokens`
|
|
7050
|
+
* over the official window. A PRESENT but illegal preferred field leaves the
|
|
7051
|
+
* numerator unknown (never a fallback to the other field); a legal `0` stays 0.
|
|
7052
|
+
* Both fields are independent, so either may cross alone.
|
|
7053
|
+
*/
|
|
7054
|
+
function contextOf(value) {
|
|
7055
|
+
if (!isRecord$2(value)) return void 0;
|
|
7056
|
+
let usedTokens;
|
|
7057
|
+
if (Object.prototype.hasOwnProperty.call(value, "projectedTokens")) usedTokens = finiteNonNegative(value.projectedTokens);
|
|
7058
|
+
else if (Object.prototype.hasOwnProperty.call(value, "pressureTokens")) usedTokens = finiteNonNegative(value.pressureTokens);
|
|
7059
|
+
const windowTokens = finiteNonNegative(value.contextWindow);
|
|
7060
|
+
const legalWindow = windowTokens !== void 0 && windowTokens > 0 ? windowTokens : void 0;
|
|
7061
|
+
if (usedTokens === void 0 && legalWindow === void 0) return void 0;
|
|
7062
|
+
const percent = usedTokens !== void 0 && legalWindow !== void 0 ? Math.min(100, Math.max(0, Math.round(usedTokens / legalWindow * 100))) : void 0;
|
|
7063
|
+
return {
|
|
7064
|
+
...usedTokens === void 0 ? {} : { usedTokens },
|
|
7065
|
+
...legalWindow === void 0 ? {} : { windowTokens: legalWindow },
|
|
7066
|
+
...percent === void 0 ? {} : { percent },
|
|
7067
|
+
approximate: true
|
|
7068
|
+
};
|
|
7069
|
+
}
|
|
7070
|
+
/** Reduce the official whole-list `todos` value to its status counts. */
|
|
7071
|
+
function todosOf(todos) {
|
|
7072
|
+
if (todos === void 0 || todos === null) return todos;
|
|
7073
|
+
let pending = 0;
|
|
7074
|
+
let inProgress = 0;
|
|
7075
|
+
let completed = 0;
|
|
7076
|
+
for (const todo of todos) if (todo.status === "pending") pending += 1;
|
|
7077
|
+
else if (todo.status === "in_progress") inProgress += 1;
|
|
7078
|
+
else completed += 1;
|
|
7079
|
+
return {
|
|
7080
|
+
pending,
|
|
7081
|
+
inProgress,
|
|
7082
|
+
completed
|
|
7083
|
+
};
|
|
7084
|
+
}
|
|
7085
|
+
/**
|
|
7086
|
+
* Map one exact Session's official projection values to the detached Inspector
|
|
7087
|
+
* DTO. The caller guarantees `sessionId` is the authorized target and
|
|
7088
|
+
* `asOfSeq` is the official exact cut (a safe integer >= -1).
|
|
7089
|
+
*/
|
|
7090
|
+
function detachSessionInspector(sessionId, asOfSeq, values) {
|
|
7091
|
+
const status = detachedSessionStatus(sessionId, {
|
|
7092
|
+
modelSelection: values.modelSelection,
|
|
7093
|
+
agentPreset: values.agentPreset,
|
|
7094
|
+
title: values.title,
|
|
7095
|
+
goal: values.goal,
|
|
7096
|
+
todos: values.todos
|
|
7097
|
+
}, void 0);
|
|
7098
|
+
const stats = statsOf(values.sessionStats);
|
|
7099
|
+
const usage = usageOf(values.tokenUsage);
|
|
7100
|
+
const context = contextOf(values.contextPressure);
|
|
7101
|
+
const todos = todosOf(status.todos);
|
|
7102
|
+
const effectiveCwd = typeof values.workingDirectory === "string" && values.workingDirectory !== "" ? values.workingDirectory : void 0;
|
|
7103
|
+
return {
|
|
7104
|
+
sessionId,
|
|
7105
|
+
asOfSeq,
|
|
7106
|
+
...stats === void 0 ? {} : { stats },
|
|
7107
|
+
...usage === void 0 ? {} : { usage },
|
|
7108
|
+
...context === void 0 ? {} : { context },
|
|
7109
|
+
...status.model === void 0 ? {} : { model: status.model },
|
|
7110
|
+
...status.preset === void 0 ? {} : { preset: status.preset },
|
|
7111
|
+
...status.title === void 0 ? {} : { title: status.title },
|
|
7112
|
+
...effectiveCwd === void 0 ? {} : { effectiveCwd },
|
|
7113
|
+
...status.goal === void 0 ? {} : { goal: status.goal },
|
|
7114
|
+
...todos === void 0 ? {} : { todos }
|
|
7115
|
+
};
|
|
7116
|
+
}
|
|
7117
|
+
//#endregion
|
|
7118
|
+
//#region src/runtime/session-browser-status.ts
|
|
7119
|
+
/** Read the official client-safe `subagentCatalog` shape. `undefined` means the
|
|
7120
|
+
* catalog is not proven; an empty array means a proven empty direct catalog.
|
|
7121
|
+
* External rows never name a local child Session and are excluded. */
|
|
7122
|
+
function provenDirectChildIds(value) {
|
|
7123
|
+
if (!Array.isArray(value)) return void 0;
|
|
7124
|
+
const ids = /* @__PURE__ */ new Set();
|
|
7125
|
+
for (const entry of value) {
|
|
7126
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return void 0;
|
|
7127
|
+
const id = entry.id;
|
|
7128
|
+
const mode = entry.mode;
|
|
7129
|
+
if (typeof id !== "string" || id === "" || typeof mode !== "string") return void 0;
|
|
7130
|
+
if (mode === "external") continue;
|
|
7131
|
+
ids.add(id);
|
|
7132
|
+
}
|
|
7133
|
+
return [...ids];
|
|
7134
|
+
}
|
|
7135
|
+
/** Count only current-generation positives. A positive is publishable even when
|
|
7136
|
+
* siblings are unknown; zero requires every legal direct child to be proven
|
|
7137
|
+
* idle. */
|
|
7138
|
+
function provenRunningChildCount(childIds, runningOf) {
|
|
7139
|
+
let positive = 0;
|
|
7140
|
+
let allKnown = true;
|
|
7141
|
+
for (const childId of childIds) {
|
|
7142
|
+
const running = runningOf(childId);
|
|
7143
|
+
if (running === true) positive += 1;
|
|
7144
|
+
else if (running !== false) allKnown = false;
|
|
7145
|
+
}
|
|
7146
|
+
if (positive > 0) return positive;
|
|
7147
|
+
return allKnown ? 0 : void 0;
|
|
7148
|
+
}
|
|
7149
|
+
/**
|
|
7150
|
+
* The single root owner. `subscribe` happens BEFORE the initial snapshot read:
|
|
7151
|
+
* adapters register list/generation/status/current first, then call
|
|
7152
|
+
* `initialize()` to read the existing baseline.
|
|
7153
|
+
*/
|
|
7154
|
+
var SessionBrowserStatusView = class {
|
|
7155
|
+
source;
|
|
7156
|
+
listeners = /* @__PURE__ */ new Set();
|
|
7157
|
+
offs = [];
|
|
7158
|
+
rows = /* @__PURE__ */ new Map();
|
|
7159
|
+
revision = 0;
|
|
7160
|
+
capturedGeneration;
|
|
7161
|
+
baselineProven = false;
|
|
7162
|
+
currentSessionId;
|
|
7163
|
+
currentLease;
|
|
7164
|
+
currentRead;
|
|
7165
|
+
pendingCurrentRead;
|
|
7166
|
+
currentBindingEver = false;
|
|
7167
|
+
disposed = false;
|
|
7168
|
+
constructor(source) {
|
|
7169
|
+
this.source = source;
|
|
7170
|
+
this.capturedGeneration = source.generation?.getSnapshot();
|
|
7171
|
+
this.offs.push(source.generation?.subscribe(() => {
|
|
7172
|
+
this.synchronizeGeneration();
|
|
7173
|
+
}) ?? (() => {}));
|
|
7174
|
+
this.offs.push(source.list?.subscribe(() => {
|
|
7175
|
+
this.onListChanged();
|
|
7176
|
+
}) ?? (() => {}));
|
|
7177
|
+
this.offs.push(source.events.onStatus((sessionId, running, identity) => {
|
|
7178
|
+
this.onStatus(sessionId, running, identity);
|
|
7179
|
+
}));
|
|
7180
|
+
if (source.events.onAdded !== void 0) this.offs.push(source.events.onAdded((identity, running) => {
|
|
7181
|
+
this.onAdded(identity, running);
|
|
7182
|
+
}));
|
|
7183
|
+
if (source.events.onRemoved !== void 0) this.offs.push(source.events.onRemoved((sessionId) => {
|
|
7184
|
+
this.onRemoved(sessionId);
|
|
7185
|
+
}));
|
|
7186
|
+
if (source.events.onRevoked !== void 0) this.offs.push(source.events.onRevoked((sessionId) => {
|
|
7187
|
+
this.onRevoked(sessionId);
|
|
7188
|
+
}));
|
|
7189
|
+
}
|
|
7190
|
+
/** Read the baseline AFTER every source is subscribed. */
|
|
7191
|
+
initialize() {
|
|
7192
|
+
if (this.disposed) return;
|
|
7193
|
+
this.onListChanged();
|
|
7194
|
+
}
|
|
7195
|
+
/** Direct has no authoritative list stream. A real Browser roster read may
|
|
7196
|
+
* prune a Client-local unread whose Session is no longer officially listed.
|
|
7197
|
+
* Remote keeps its explicit `api-session/removed` authority and ignores this. */
|
|
7198
|
+
acceptRoster(rows) {
|
|
7199
|
+
if (this.disposed || this.source.generation !== void 0 || !this.generationActive()) return;
|
|
7200
|
+
const ids = new Set(rows.map((row) => row.id));
|
|
7201
|
+
let changed = false;
|
|
7202
|
+
for (const id of [...this.rows.keys()]) {
|
|
7203
|
+
if (ids.has(id)) continue;
|
|
7204
|
+
this.rows.delete(id);
|
|
7205
|
+
changed = true;
|
|
7206
|
+
}
|
|
7207
|
+
if (changed) this.changed();
|
|
7208
|
+
}
|
|
7209
|
+
/** Borrow the one committed-Session owner's live getter and invalidation. */
|
|
7210
|
+
bindCurrent(binding) {
|
|
7211
|
+
const token = Symbol("session-browser-status-current");
|
|
7212
|
+
const firstBinding = !this.currentBindingEver;
|
|
7213
|
+
this.currentBindingEver = true;
|
|
7214
|
+
const off = binding.subscribe(() => {
|
|
7215
|
+
if (this.currentLease !== token) return;
|
|
7216
|
+
if (this.pendingCurrentRead !== void 0) {
|
|
7217
|
+
this.currentRead = this.pendingCurrentRead;
|
|
7218
|
+
this.pendingCurrentRead = void 0;
|
|
7219
|
+
}
|
|
7220
|
+
this.onCurrentChanged();
|
|
7221
|
+
});
|
|
7222
|
+
this.currentLease = token;
|
|
7223
|
+
this.offs.push(off);
|
|
7224
|
+
if (firstBinding) {
|
|
7225
|
+
this.currentRead = binding.getSessionId;
|
|
7226
|
+
this.onCurrentChanged();
|
|
7227
|
+
} else this.pendingCurrentRead = binding.getSessionId;
|
|
7228
|
+
return { detach: () => {
|
|
7229
|
+
if (this.currentLease !== token) return;
|
|
7230
|
+
this.currentLease = void 0;
|
|
7231
|
+
this.pendingCurrentRead = void 0;
|
|
7232
|
+
this.currentRead = () => this.currentSessionId;
|
|
7233
|
+
const index = this.offs.indexOf(off);
|
|
7234
|
+
if (index >= 0) this.offs.splice(index, 1);
|
|
7235
|
+
off();
|
|
7236
|
+
} };
|
|
7237
|
+
}
|
|
7238
|
+
subscribe(listener) {
|
|
7239
|
+
if (this.disposed) return () => {};
|
|
7240
|
+
this.listeners.add(listener);
|
|
7241
|
+
return () => {
|
|
7242
|
+
this.listeners.delete(listener);
|
|
7243
|
+
};
|
|
7244
|
+
}
|
|
7245
|
+
/** Proven running of an exact authorized id; unknown is never `false`. */
|
|
7246
|
+
runningOf(sessionId) {
|
|
7247
|
+
this.synchronize();
|
|
7248
|
+
return this.rows.get(sessionId)?.running;
|
|
7249
|
+
}
|
|
7250
|
+
isAuthorized(sessionId) {
|
|
7251
|
+
this.synchronize();
|
|
7252
|
+
return this.rows.get(sessionId)?.authorized === true;
|
|
7253
|
+
}
|
|
7254
|
+
isMain(sessionId) {
|
|
7255
|
+
this.synchronize();
|
|
7256
|
+
return this.rows.get(sessionId)?.main === true;
|
|
7257
|
+
}
|
|
7258
|
+
getSnapshot() {
|
|
7259
|
+
this.synchronize();
|
|
7260
|
+
const rows = /* @__PURE__ */ new Map();
|
|
7261
|
+
for (const [sessionId, row] of this.rows) rows.set(sessionId, {
|
|
7262
|
+
sessionId,
|
|
7263
|
+
main: row.main,
|
|
7264
|
+
running: row.running,
|
|
7265
|
+
completionUnread: row.completionUnread && row.main && sessionId !== this.currentSessionId
|
|
7266
|
+
});
|
|
7267
|
+
return {
|
|
7268
|
+
revision: this.revision,
|
|
7269
|
+
currentSessionId: this.currentSessionId,
|
|
7270
|
+
rows
|
|
7271
|
+
};
|
|
7272
|
+
}
|
|
7273
|
+
dispose() {
|
|
7274
|
+
if (this.disposed) return;
|
|
7275
|
+
this.disposed = true;
|
|
7276
|
+
for (const off of this.offs.splice(0)) off();
|
|
7277
|
+
this.rows.clear();
|
|
7278
|
+
this.listeners.clear();
|
|
7279
|
+
this.currentRead = void 0;
|
|
7280
|
+
this.pendingCurrentRead = void 0;
|
|
7281
|
+
this.currentLease = void 0;
|
|
7282
|
+
}
|
|
7283
|
+
emit() {
|
|
7284
|
+
if (this.disposed) return;
|
|
7285
|
+
for (const listener of [...this.listeners]) listener();
|
|
7286
|
+
}
|
|
7287
|
+
changed() {
|
|
7288
|
+
this.revision += 1;
|
|
7289
|
+
this.emit();
|
|
7290
|
+
}
|
|
7291
|
+
synchronize() {
|
|
7292
|
+
if (this.disposed) return;
|
|
7293
|
+
this.synchronizeGeneration();
|
|
7294
|
+
this.synchronizeCurrent();
|
|
7295
|
+
}
|
|
7296
|
+
generationActive() {
|
|
7297
|
+
return this.source.generation === void 0 || this.capturedGeneration !== void 0;
|
|
7298
|
+
}
|
|
7299
|
+
synchronizeGeneration() {
|
|
7300
|
+
if (this.source.generation === void 0 || this.disposed) return;
|
|
7301
|
+
const next = this.source.generation.getSnapshot();
|
|
7302
|
+
if (Object.is(next, this.capturedGeneration)) return;
|
|
7303
|
+
this.capturedGeneration = next;
|
|
7304
|
+
const provedUnread = [...this.rows].filter(([id, row]) => row.completionUnread && row.main && id !== this.currentSessionId).map(([id]) => id);
|
|
7305
|
+
this.rows.clear();
|
|
7306
|
+
for (const id of provedUnread) this.rows.set(id, {
|
|
7307
|
+
main: true,
|
|
7308
|
+
running: void 0,
|
|
7309
|
+
completionUnread: true,
|
|
7310
|
+
authorized: false
|
|
7311
|
+
});
|
|
7312
|
+
this.baselineProven = false;
|
|
7313
|
+
this.changed();
|
|
7314
|
+
}
|
|
7315
|
+
synchronizeCurrent(emit = true) {
|
|
7316
|
+
const next = this.currentRead?.();
|
|
7317
|
+
if (next === this.currentSessionId) return false;
|
|
7318
|
+
this.currentSessionId = next;
|
|
7319
|
+
if (next !== void 0) {
|
|
7320
|
+
const row = this.rows.get(next);
|
|
7321
|
+
if (row !== void 0 && row.completionUnread) row.completionUnread = false;
|
|
7322
|
+
}
|
|
7323
|
+
if (emit) this.changed();
|
|
7324
|
+
return true;
|
|
7325
|
+
}
|
|
7326
|
+
onCurrentChanged() {
|
|
7327
|
+
if (this.disposed) return;
|
|
7328
|
+
this.synchronizeCurrent();
|
|
7329
|
+
}
|
|
7330
|
+
initialBaselineAllowed() {
|
|
7331
|
+
if (this.source.generation === void 0 || this.source.initialGeneration === void 0) return false;
|
|
7332
|
+
return Object.is(this.capturedGeneration, this.source.initialGeneration);
|
|
7333
|
+
}
|
|
7334
|
+
onListChanged() {
|
|
7335
|
+
if (this.disposed) return;
|
|
7336
|
+
this.synchronizeGeneration();
|
|
7337
|
+
if (!this.generationActive()) return;
|
|
7338
|
+
const list = this.source.list;
|
|
7339
|
+
if (list === void 0) return;
|
|
7340
|
+
const snapshot = list.getSnapshot();
|
|
7341
|
+
if (!snapshot.ready) return;
|
|
7342
|
+
const initial = !this.baselineProven && this.initialBaselineAllowed();
|
|
7343
|
+
let changed = false;
|
|
7344
|
+
const ids = new Set(snapshot.ids);
|
|
7345
|
+
if (initial) this.baselineProven = true;
|
|
7346
|
+
for (const id of snapshot.ids) {
|
|
7347
|
+
const main = snapshot.isMain(id);
|
|
7348
|
+
const row = this.rows.get(id);
|
|
7349
|
+
if (row === void 0) {
|
|
7350
|
+
this.rows.set(id, {
|
|
7351
|
+
main,
|
|
7352
|
+
running: initial ? snapshot.runningOf(id) : void 0,
|
|
7353
|
+
completionUnread: false,
|
|
7354
|
+
authorized: true
|
|
7355
|
+
});
|
|
7356
|
+
changed = true;
|
|
7357
|
+
continue;
|
|
7358
|
+
}
|
|
7359
|
+
if (row.main !== main) {
|
|
7360
|
+
row.main = main;
|
|
7361
|
+
changed = true;
|
|
7362
|
+
}
|
|
7363
|
+
if (!row.authorized) {
|
|
7364
|
+
row.authorized = true;
|
|
7365
|
+
changed = true;
|
|
7366
|
+
}
|
|
7367
|
+
}
|
|
7368
|
+
if (this.baselineProven) for (const id of [...this.rows.keys()]) {
|
|
7369
|
+
if (ids.has(id)) continue;
|
|
7370
|
+
const row = this.rows.get(id);
|
|
7371
|
+
this.rows.delete(id);
|
|
7372
|
+
if (row.completionUnread) changed = true;
|
|
7373
|
+
}
|
|
7374
|
+
if (changed) this.changed();
|
|
7375
|
+
}
|
|
7376
|
+
onAdded(identity, running) {
|
|
7377
|
+
if (this.disposed) return;
|
|
7378
|
+
this.synchronizeGeneration();
|
|
7379
|
+
if (!this.generationActive()) return;
|
|
7380
|
+
const row = this.rows.get(identity.sessionId);
|
|
7381
|
+
if (row === void 0) {
|
|
7382
|
+
this.rows.set(identity.sessionId, {
|
|
7383
|
+
main: identity.main,
|
|
7384
|
+
running,
|
|
7385
|
+
completionUnread: false,
|
|
7386
|
+
authorized: true
|
|
7387
|
+
});
|
|
7388
|
+
this.changed();
|
|
7389
|
+
return;
|
|
7390
|
+
}
|
|
7391
|
+
const authorized = row.authorized;
|
|
7392
|
+
row.authorized = true;
|
|
7393
|
+
const unreadCleared = running === true && row.completionUnread;
|
|
7394
|
+
if (row.main !== identity.main || running !== void 0 && row.running !== running || !authorized || unreadCleared) {
|
|
7395
|
+
row.main = identity.main;
|
|
7396
|
+
if (running !== void 0) row.running = running;
|
|
7397
|
+
if (running === true) row.completionUnread = false;
|
|
7398
|
+
this.changed();
|
|
7399
|
+
}
|
|
7400
|
+
}
|
|
7401
|
+
onRemoved(sessionId) {
|
|
7402
|
+
if (this.disposed) return;
|
|
7403
|
+
this.synchronizeGeneration();
|
|
7404
|
+
if (!this.generationActive()) return;
|
|
7405
|
+
if (this.rows.get(sessionId) === void 0) return;
|
|
7406
|
+
this.rows.delete(sessionId);
|
|
7407
|
+
this.changed();
|
|
7408
|
+
}
|
|
7409
|
+
onRevoked(sessionId) {
|
|
7410
|
+
if (this.disposed) return;
|
|
7411
|
+
this.synchronizeGeneration();
|
|
7412
|
+
if (!this.generationActive()) return;
|
|
7413
|
+
const changed = this.synchronizeCurrent(false);
|
|
7414
|
+
const row = this.rows.get(sessionId);
|
|
7415
|
+
if (row === void 0) {
|
|
7416
|
+
if (changed) this.changed();
|
|
7417
|
+
return;
|
|
7418
|
+
}
|
|
7419
|
+
if (row.running === false && row.main && row.completionUnread) {
|
|
7420
|
+
if (changed) this.changed();
|
|
7421
|
+
return;
|
|
7422
|
+
}
|
|
7423
|
+
if (row.main && row.completionUnread) {
|
|
7424
|
+
row.running = false;
|
|
7425
|
+
row.authorized = false;
|
|
7426
|
+
} else this.rows.delete(sessionId);
|
|
7427
|
+
this.changed();
|
|
7428
|
+
}
|
|
7429
|
+
onStatus(sessionId, running, identity) {
|
|
7430
|
+
if (this.disposed) return;
|
|
7431
|
+
this.synchronizeGeneration();
|
|
7432
|
+
if (!this.generationActive()) return;
|
|
7433
|
+
let changed = this.synchronizeCurrent(false);
|
|
7434
|
+
let row = this.rows.get(sessionId);
|
|
7435
|
+
if (row === void 0) {
|
|
7436
|
+
if (identity === void 0) {
|
|
7437
|
+
if (changed) this.changed();
|
|
7438
|
+
return;
|
|
7439
|
+
}
|
|
7440
|
+
row = {
|
|
7441
|
+
main: identity.main,
|
|
7442
|
+
running: void 0,
|
|
7443
|
+
completionUnread: false,
|
|
7444
|
+
authorized: false
|
|
7445
|
+
};
|
|
7446
|
+
this.rows.set(sessionId, row);
|
|
7447
|
+
changed = true;
|
|
7448
|
+
}
|
|
7449
|
+
if (identity !== void 0 && (!row.authorized || row.main !== identity.main)) {
|
|
7450
|
+
row.main = identity.main;
|
|
7451
|
+
row.authorized = true;
|
|
7452
|
+
changed = true;
|
|
7453
|
+
}
|
|
7454
|
+
if (!row.authorized) {
|
|
7455
|
+
if (changed) this.changed();
|
|
7456
|
+
return;
|
|
7457
|
+
}
|
|
7458
|
+
if (row.running === running) {
|
|
7459
|
+
if (changed) this.changed();
|
|
7460
|
+
return;
|
|
7461
|
+
}
|
|
7462
|
+
if (running) {
|
|
7463
|
+
row.running = true;
|
|
7464
|
+
row.completionUnread = false;
|
|
7465
|
+
} else if (row.running === true) {
|
|
7466
|
+
row.running = false;
|
|
7467
|
+
if (row.main && sessionId !== this.currentSessionId) row.completionUnread = true;
|
|
7468
|
+
} else row.running = false;
|
|
7469
|
+
this.changed();
|
|
7470
|
+
}
|
|
7471
|
+
};
|
|
7472
|
+
//#endregion
|
|
7198
7473
|
//#region src/runtime/host-directory-browse-port.ts
|
|
7199
7474
|
/** The official code that proves the Host refused the requested path. */
|
|
7200
7475
|
const HOST_DIRECTORY_UNREADABLE_CODES = /* @__PURE__ */ new Set(["directory-unreadable", "directory-picker/unreadable"]);
|
|
@@ -8231,4 +8506,4 @@ function createRemoteTerminalProgressSource(deps) {
|
|
|
8231
8506
|
} };
|
|
8232
8507
|
}
|
|
8233
8508
|
//#endregion
|
|
8234
|
-
export {
|
|
8509
|
+
export { normalizeInputEvent as $, providerOptionsFor as $t, projectSubagentModelSelection as A, webBillingEligibilityReason as At, PI_TUI_EXTENSIONS_SERVICE as B, isTerminalAmbiguousKeyId as Bt, extensionConfigUserDataPresent as C, assertWebApiBilling as Ct, projectSessionLogUpload as D, sameWebAuthority as Dt, projectAgentLoopSettings as E, readWebApiBilling as Et, DIRECT_IMPLEMENTED_CAPABILITIES as F, webProviderSelectionChanged as Ft, SESSION_NAVIGATION_COMMANDS as G, isRuntimeBindableKeyId as Gt, IMMEDIATE_SESSIONLESS_COMMANDS as H, APP_KEYBINDINGS as Ht, REMOTE_IMPLEMENTED_CAPABILITIES as I, webProviderSelectionFactsOf as It, isBareCommandLine as J, PROTOCOL_CHOICES as Jt, classifyCommandLine as K, isTextProducingKeyId as Kt, ScheduleOutcomeUnknownError as L, DEFAULT_LEADER_TIMEOUT_MS as Lt, detachedTurnOutline as M, webProviderRestoreIsNoOp as Mt, classifySubagentPromptSettlement as N, webProviderSelectIsNoOp as Nt, projectShellExecutionSettings as O, webApiAdvancedFactsOf as Ot, safeSubagentErrorMessage as P, webProviderSelectRefusal as Pt, shouldConsumeAdvertisedMiss as Q, getPath as Qt, ScheduleUnavailableError as R, isEditorSubmitPreSubmitKey as Rt, ownedClientExtensionEntryIds as S, assertSearchProviderId as St, snapshotExtensionConfigOps as T, maskWebProviderOverrideUrl as Tt, LOCAL_COMMANDS as U, VIEWER_BLOCKED_PARENT_ACTIONS as Ut, InvalidateBatcher as V, parseUserKeybindings as Vt, SESSIONLESS_COMMANDS as W, canonicalizeKeyId as Wt, localCommandMayWrite as X, classifyCredentialArg as Xt, isPlainExitPrompt as Y, ROUTE_PATTERN as Yt, normalizeSkillInvocation as Z, deriveKeyRef as Zt, detachPluginManagerSnapshot as _, projectMcpServerEntry as _t, detachMcpProbeResult as a, directAgentOf as at, detachPluginVersionList as b, assertFetchProviderId as bt, SessionBrowserStatusView as c, requireOpened as ct, INSPECTOR_PROJECTION_KEYS as d, classifyMcpServerProvenance as dt, providerProfileProjectionOf as en, DeliveredFileReadError as et, detachSessionInspector as f, diffMcpServerDraft as ft, detachPhase as g, mcpSetEnabledOps as gt, detachLog as h, mcpRemoveOps as ht, PluginManagerStaleResultError as i, TUI_STARTUP_SERVICE as in, clientOwnerOf as it, detachedSessionStatus as j, webProviderEffectiveId as jt, projectSubagentLimits as k, webBillingEligibility as kt, provenDirectChildIds as l, CuaAccessUnavailableError as lt, detachInspection as m, mcpEditOps as mt, createRemoteTerminalProgressSource as n, bundleVersion as nn, LifecycleError as nt, detachMcpServerRoster as o, ownerHandleOf as ot, detachChange as p, mcpAddOps as pt, classifyExitIntent as q, isValidKeyId as qt, createClientExtensionMountOwner as r, dshVersion as rn, WorkspaceSelectionError as rt, hostDirectoryBrowseFailureOutcome as s, requireCreated as st, consumeRemoteTerminalProgress as t, contextPressureOccupancy as tn, deliveredFileReadErrorFrom as tt, provenRunningChildCount as u, baseDictKeysOf as ut, detachPluginUpdateProgress as v, validateMcpServerDraft as vt, projectExtensionConfigData as w, isWebApiBilling as wt, pluginInstallRequestId as x, assertSearchApiCount as xt, detachPluginUpdateResult as y, WebProviderNoChanges as yt, extensions_exports as z, isPhysicalEscapeAction as zt };
|