dsh-codex-subscription 2.2.2 → 2.2.3
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 +150 -153
- package/README.md +150 -154
- package/lib/client.js +304 -12
- package/lib/index.js +496 -71
- package/locale/en.json +6 -0
- package/locale/zh-CN.json +6 -0
- package/package.json +4 -2
package/lib/client.js
CHANGED
|
@@ -4627,6 +4627,50 @@ window.__ModuleLoader__.load({
|
|
|
4627
4627
|
//#endregion
|
|
4628
4628
|
//#region src/client-locales.js
|
|
4629
4629
|
const zh = {
|
|
4630
|
+
"diagnosticReason_catalog-online": "在线目录已载入",
|
|
4631
|
+
"diagnosticReason_catalog-fallback": "使用备用目录",
|
|
4632
|
+
"diagnosticReason_storage-readable": "预测缓存可读",
|
|
4633
|
+
"diagnosticReason_tool-registered": "全局工具已注册",
|
|
4634
|
+
"diagnosticReason_tool-missing": "未找到全局工具",
|
|
4635
|
+
"diagnosticsCoverageHint": "分别展示已检查的前置条件与最近 15 分钟的操作结果。请求完成不代表整个功能通过验收;未验证不等于故障。",
|
|
4636
|
+
"diagnosticsVersionMismatch": "前后端插件版本不同,请重载后重试。",
|
|
4637
|
+
"diagnosticsPartial": "部分信息未能采集,其余检查结果已保留。请在详情中查看失败或超时项。",
|
|
4638
|
+
"diagnosticsCapability": "功能",
|
|
4639
|
+
"diagnosticsReadiness": "前置条件",
|
|
4640
|
+
"diagnosticsEvidence": "近期操作证据",
|
|
4641
|
+
"diagnosticsUnverified": "尚未验证",
|
|
4642
|
+
"diagnosticsHostCollected": "已采集宿主注册与选中结果(详情内)。这不证明界面可见或功能执行正常。",
|
|
4643
|
+
"diagnosticsHostUnknown": "宿主界面检查不可用或未挂载,不能据此判断插件干扰。",
|
|
4644
|
+
"diagnosticsDetails": "展开脱敏详情",
|
|
4645
|
+
"diagnosticsCopyFailed": "复制失败,可展开详情手动复制。",
|
|
4646
|
+
"diagnosticSource_rpc": "接口响应",
|
|
4647
|
+
"diagnosticSource_tool": "工具",
|
|
4648
|
+
"diagnosticOutcome_completed": "完成",
|
|
4649
|
+
"diagnosticOutcome_failed": "失败",
|
|
4650
|
+
"diagnosticOutcome_cancelled": "取消",
|
|
4651
|
+
"diagnosticCapability_account": "登录",
|
|
4652
|
+
"diagnosticCapability_accounts": "多账号",
|
|
4653
|
+
"diagnosticCapability_settings": "设置",
|
|
4654
|
+
"diagnosticCapability_models": "模型",
|
|
4655
|
+
"diagnosticCapability_quota": "额度",
|
|
4656
|
+
"diagnosticCapability_search": "搜索",
|
|
4657
|
+
"diagnosticCapability_images": "生图与编辑",
|
|
4658
|
+
"diagnosticCapability_sketch": "草图",
|
|
4659
|
+
"diagnosticCapability_subagents": "子任务",
|
|
4660
|
+
"diagnosticCapability_compaction": "压缩",
|
|
4661
|
+
"diagnosticCapability_transport": "连接",
|
|
4662
|
+
"diagnosticCapability_storage": "存储",
|
|
4663
|
+
"diagnosticCapability_host-ui": "宿主界面",
|
|
4664
|
+
"diagnosticReason_not-instrumented": "证据不足",
|
|
4665
|
+
"diagnosticReason_disabled-or-host-owned": "未启用或由宿主管理",
|
|
4666
|
+
"diagnosticReason_sign-in-required": "依赖登录",
|
|
4667
|
+
"diagnosticReason_local-sign-in-present": "本地登录存在",
|
|
4668
|
+
"diagnosticReason_sign-in-unverified": "登录未确认",
|
|
4669
|
+
"diagnosticReason_settings-writable": "可写",
|
|
4670
|
+
"diagnosticReason_settings-readonly": "不可写",
|
|
4671
|
+
"diagnosticReason_restart-required": "需要重启",
|
|
4672
|
+
"diagnosticReason_runtime-present": "组件已安装",
|
|
4673
|
+
"diagnosticReason_runtime-missing": "组件未安装",
|
|
4630
4674
|
storageLoading: "正在读取缓存占用…",
|
|
4631
4675
|
storageTitle: "存储与缓存",
|
|
4632
4676
|
storageForecast: "额度预测缓存",
|
|
@@ -5099,6 +5143,50 @@ window.__ModuleLoader__.load({
|
|
|
5099
5143
|
imageRemoveAnnotation: "删除标注"
|
|
5100
5144
|
};
|
|
5101
5145
|
const en = {
|
|
5146
|
+
"diagnosticReason_catalog-online": "Online catalog loaded",
|
|
5147
|
+
"diagnosticReason_catalog-fallback": "Fallback catalog",
|
|
5148
|
+
"diagnosticReason_storage-readable": "Forecast cache readable",
|
|
5149
|
+
"diagnosticReason_tool-registered": "Global tool registered",
|
|
5150
|
+
"diagnosticReason_tool-missing": "Global tool not found",
|
|
5151
|
+
"diagnosticsCoverageHint": "Shows inspected prerequisites and operations observed in the last 15 minutes. Request completion is not end-to-end validation; unverified does not mean broken.",
|
|
5152
|
+
"diagnosticsVersionMismatch": "Client and server versions differ. Reload and retry.",
|
|
5153
|
+
"diagnosticsPartial": "Some inspections failed or timed out. Other results are preserved; see details.",
|
|
5154
|
+
"diagnosticsCapability": "Capability",
|
|
5155
|
+
"diagnosticsReadiness": "Prerequisites",
|
|
5156
|
+
"diagnosticsEvidence": "Recent evidence",
|
|
5157
|
+
"diagnosticsUnverified": "Unverified",
|
|
5158
|
+
"diagnosticsHostCollected": "Host registrations and selection are included in details, not proof of visibility or execution.",
|
|
5159
|
+
"diagnosticsHostUnknown": "Host inspection unavailable or unmounted; interference cannot be determined.",
|
|
5160
|
+
"diagnosticsDetails": "Redacted details",
|
|
5161
|
+
"diagnosticsCopyFailed": "Copy failed. Expand the details to copy manually.",
|
|
5162
|
+
"diagnosticSource_rpc": "RPC response",
|
|
5163
|
+
"diagnosticSource_tool": "Tool",
|
|
5164
|
+
"diagnosticOutcome_completed": "Completed",
|
|
5165
|
+
"diagnosticOutcome_failed": "Failed",
|
|
5166
|
+
"diagnosticOutcome_cancelled": "Cancelled",
|
|
5167
|
+
"diagnosticCapability_account": "Sign-in",
|
|
5168
|
+
"diagnosticCapability_accounts": "Accounts",
|
|
5169
|
+
"diagnosticCapability_settings": "Settings",
|
|
5170
|
+
"diagnosticCapability_models": "Models",
|
|
5171
|
+
"diagnosticCapability_quota": "Quota",
|
|
5172
|
+
"diagnosticCapability_search": "Search",
|
|
5173
|
+
"diagnosticCapability_images": "Images",
|
|
5174
|
+
"diagnosticCapability_sketch": "Sketch",
|
|
5175
|
+
"diagnosticCapability_subagents": "Subtasks",
|
|
5176
|
+
"diagnosticCapability_compaction": "Compaction",
|
|
5177
|
+
"diagnosticCapability_transport": "Connection",
|
|
5178
|
+
"diagnosticCapability_storage": "Storage",
|
|
5179
|
+
"diagnosticCapability_host-ui": "Host UI",
|
|
5180
|
+
"diagnosticReason_not-instrumented": "Insufficient evidence",
|
|
5181
|
+
"diagnosticReason_disabled-or-host-owned": "Disabled or host-managed",
|
|
5182
|
+
"diagnosticReason_sign-in-required": "Sign-in required",
|
|
5183
|
+
"diagnosticReason_local-sign-in-present": "Local sign-in present",
|
|
5184
|
+
"diagnosticReason_sign-in-unverified": "Sign-in unverified",
|
|
5185
|
+
"diagnosticReason_settings-writable": "Writable",
|
|
5186
|
+
"diagnosticReason_settings-readonly": "Read-only",
|
|
5187
|
+
"diagnosticReason_restart-required": "Restart required",
|
|
5188
|
+
"diagnosticReason_runtime-present": "Runtime installed",
|
|
5189
|
+
"diagnosticReason_runtime-missing": "Runtime missing",
|
|
5102
5190
|
storageLoading: "Reading cache size…",
|
|
5103
5191
|
storageTitle: "Storage and cache",
|
|
5104
5192
|
storageForecast: "Quota forecast cache",
|
|
@@ -5752,7 +5840,7 @@ window.__ModuleLoader__.load({
|
|
|
5752
5840
|
.codexModelSelectEffort{flex:none;color:var(--dsw-alias-label-caption)}
|
|
5753
5841
|
.codexModelSelectChevron{flex:none;color:var(--dsw-alias-label-caption);transition:transform 120ms}
|
|
5754
5842
|
.codexModelSelectTrigger[aria-expanded=true] .codexModelSelectChevron{transform:rotate(180deg)}
|
|
5755
|
-
.codexModelSelectMenu,.codexModelSelectSubmenu{position:absolute;z-index:30;box-sizing:border-box;width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:min(420px,calc(100vw - 32px));max-height:min(360px,calc(100vh - 96px));padding:4px;border:1px solid var(--dsw-alias-border-inverted);border-radius:12px;background:var(--dsw-
|
|
5843
|
+
.codexModelSelectMenu,.codexModelSelectSubmenu{position:absolute;z-index:30;box-sizing:border-box;width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:min(420px,calc(100vw - 32px));max-height:min(360px,calc(100vh - 96px));padding:4px;border:1px solid var(--dsw-alias-border-inverted);border-radius:12px;background:var(--dsw-alias-bg-layer-2,#2c2c2e);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);overflow:hidden}
|
|
5756
5844
|
.codexModelSelectMenu{right:0;bottom:calc(100% + 8px)}
|
|
5757
5845
|
.codexModelSelectSubmenu{right:calc(100% + 8px);bottom:0;min-width:min(230px,calc(100vw - 32px))}
|
|
5758
5846
|
.codexModelSelectCell{display:flex;align-items:center;gap:8px;width:100%;min-width:100%;height:40px;box-sizing:border-box;padding:0 10px;border:0;border-radius:10px;background:transparent;color:inherit;font-size:14px;line-height:22px;text-align:left;cursor:pointer}
|
|
@@ -5763,7 +5851,7 @@ window.__ModuleLoader__.load({
|
|
|
5763
5851
|
.codexModelSelectCellChevron{flex:none;color:var(--dsw-alias-label-tertiary)}
|
|
5764
5852
|
.codexModelSelectGroups{min-height:0;max-height:352px;overflow-y:auto}
|
|
5765
5853
|
.codexModelSelectGroup+.codexModelSelectGroup{margin-top:4px}
|
|
5766
|
-
.codexModelSelectGroupTitle{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-
|
|
5854
|
+
.codexModelSelectGroupTitle{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-alias-bg-layer-2,#2c2c2e);color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:500;line-height:18px}
|
|
5767
5855
|
.codexModelSelectOption{display:flex;align-items:center;gap:8px;width:100%;min-width:100%;min-height:38px;box-sizing:border-box;padding:6px 8px;border:0;border-radius:10px;outline:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
5768
5856
|
.codexModelSelectOption:hover:not(:disabled),.codexModelSelectOption:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}
|
|
5769
5857
|
.codexModelSelectOption:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}
|
|
@@ -7445,7 +7533,7 @@ window.__ModuleLoader__.load({
|
|
|
7445
7533
|
}
|
|
7446
7534
|
//#endregion
|
|
7447
7535
|
//#region src/version.js
|
|
7448
|
-
const PACKAGE_VERSION = "2.2.
|
|
7536
|
+
const PACKAGE_VERSION = "2.2.3";
|
|
7449
7537
|
//#endregion
|
|
7450
7538
|
//#region src/client-recovery.js
|
|
7451
7539
|
async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
|
|
@@ -9426,23 +9514,29 @@ window.__ModuleLoader__.load({
|
|
|
9426
9514
|
}
|
|
9427
9515
|
//#endregion
|
|
9428
9516
|
//#region src/client-diagnostics.jsx
|
|
9429
|
-
function DiagnosticsCard({ rpc, t }) {
|
|
9517
|
+
function DiagnosticsCard({ rpc, t, diagnostics }) {
|
|
9430
9518
|
const [report, setReport] = (0, react.useState)();
|
|
9431
9519
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
9432
9520
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
9433
9521
|
const [error, setError] = (0, react.useState)(false);
|
|
9522
|
+
const [copyError, setCopyError] = (0, react.useState)(false);
|
|
9434
9523
|
const load = () => {
|
|
9435
9524
|
setBusy(true);
|
|
9436
9525
|
setError(false);
|
|
9437
9526
|
setCopied(false);
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
setError(
|
|
9527
|
+
setCopyError(false);
|
|
9528
|
+
Promise.allSettled([recoveryCall(rpc, "diagnostics"), Promise.resolve().then(() => diagnostics?.collect())]).then(([server, client]) => {
|
|
9529
|
+
setError(server.status === "rejected");
|
|
9530
|
+
setReport({
|
|
9531
|
+
...server.status === "fulfilled" ? server.value : clientDiagnostic(server.reason),
|
|
9532
|
+
client: client.status === "fulfilled" && client.value ? client.value : { status: "unknown" }
|
|
9533
|
+
});
|
|
9441
9534
|
}).finally(() => setBusy(false));
|
|
9442
9535
|
};
|
|
9443
9536
|
const copy = () => {
|
|
9444
9537
|
if (report === void 0) return;
|
|
9445
|
-
|
|
9538
|
+
setCopyError(false);
|
|
9539
|
+
Promise.resolve().then(() => navigator.clipboard.writeText(JSON.stringify(report, null, 2))).then(() => setCopied(true)).catch(() => setCopyError(true));
|
|
9446
9540
|
};
|
|
9447
9541
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9448
9542
|
className: "codexSubscriptionCard codexSubscriptionDiagnostics",
|
|
@@ -9481,11 +9575,51 @@ window.__ModuleLoader__.load({
|
|
|
9481
9575
|
]
|
|
9482
9576
|
})]
|
|
9483
9577
|
}),
|
|
9484
|
-
report === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.
|
|
9578
|
+
report === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
9579
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9580
|
+
className: "codexSubscriptionHelp",
|
|
9581
|
+
children: t("diagnosticsCoverageHint")
|
|
9582
|
+
}),
|
|
9583
|
+
report.version && report.client?.version && report.version !== report.client.version ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9584
|
+
role: "status",
|
|
9585
|
+
children: t("diagnosticsVersionMismatch")
|
|
9586
|
+
}) : null,
|
|
9587
|
+
(report.inspection?.checks ?? []).some((item) => ["inspection-failed", "inspection-timeout"].includes(item.reason)) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9588
|
+
role: "status",
|
|
9589
|
+
children: t("diagnosticsPartial")
|
|
9590
|
+
}) : null,
|
|
9591
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
9592
|
+
style: {
|
|
9593
|
+
width: "100%",
|
|
9594
|
+
fontSize: 12,
|
|
9595
|
+
textAlign: "left",
|
|
9596
|
+
borderSpacing: "0 8px"
|
|
9597
|
+
},
|
|
9598
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
9599
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("diagnosticsCapability") }),
|
|
9600
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("diagnosticsReadiness") }),
|
|
9601
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("diagnosticsEvidence") })
|
|
9602
|
+
] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: (report.inspection?.capabilities ?? []).map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
9603
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: t(`diagnosticCapability_${item.id}`) }),
|
|
9604
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", { children: [t(`diagnosticReason_${item.reason}`), item.blockedBy ? ` · ${t(`diagnosticCapability_${item.blockedBy}`)}` : ""] }),
|
|
9605
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: item.latest ? `${item.latest.action} · ${t(`diagnosticSource_${item.latest.source}`)} · ${t(`diagnosticOutcome_${item.latest.status}`)} · ${new Date(item.latest.observedAt).toLocaleTimeString()}` : t("diagnosticsUnverified") })
|
|
9606
|
+
] }, item.id)) })]
|
|
9607
|
+
}),
|
|
9608
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9609
|
+
className: "codexSubscriptionHelp",
|
|
9610
|
+
children: report.client?.topology?.length ? t("diagnosticsHostCollected") : t("diagnosticsHostUnknown")
|
|
9611
|
+
}),
|
|
9612
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("diagnosticsDetails") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: JSON.stringify(report, null, 2) })] })
|
|
9613
|
+
] }),
|
|
9485
9614
|
error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9486
9615
|
className: "codexSubscriptionError",
|
|
9487
9616
|
role: "alert",
|
|
9488
9617
|
children: t("diagnosticsFailed")
|
|
9618
|
+
}) : null,
|
|
9619
|
+
copyError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
9620
|
+
className: "codexSubscriptionError",
|
|
9621
|
+
role: "alert",
|
|
9622
|
+
children: t("diagnosticsCopyFailed")
|
|
9489
9623
|
}) : null
|
|
9490
9624
|
]
|
|
9491
9625
|
});
|
|
@@ -9996,7 +10130,7 @@ window.__ModuleLoader__.load({
|
|
|
9996
10130
|
}
|
|
9997
10131
|
//#endregion
|
|
9998
10132
|
//#region src/client-section.jsx
|
|
9999
|
-
function CodexSection({ preference, rpc, accountStatus, t }) {
|
|
10133
|
+
function CodexSection({ preference, rpc, accountStatus, t, diagnostics }) {
|
|
10000
10134
|
const [tab, setTab] = (0, react.useState)("account");
|
|
10001
10135
|
const id = (0, react.useId)();
|
|
10002
10136
|
const tabs = [
|
|
@@ -10115,13 +10249,167 @@ window.__ModuleLoader__.load({
|
|
|
10115
10249
|
t
|
|
10116
10250
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DiagnosticsCard, {
|
|
10117
10251
|
rpc,
|
|
10118
|
-
t
|
|
10252
|
+
t,
|
|
10253
|
+
diagnostics
|
|
10119
10254
|
})]
|
|
10120
10255
|
})
|
|
10121
10256
|
]
|
|
10122
10257
|
});
|
|
10123
10258
|
}
|
|
10124
10259
|
//#endregion
|
|
10260
|
+
//#region src/diagnostic-checks.js
|
|
10261
|
+
const states = /* @__PURE__ */ new Set([
|
|
10262
|
+
"pass",
|
|
10263
|
+
"fail",
|
|
10264
|
+
"warn",
|
|
10265
|
+
"unknown",
|
|
10266
|
+
"not-applicable"
|
|
10267
|
+
]);
|
|
10268
|
+
/** Adapters return bounded reason codes, never exceptions or raw service data. */
|
|
10269
|
+
async function collectChecks(definitions, { timeoutMs = 1500, now = Date.now, source = "server", scope = "plugin-process" } = {}) {
|
|
10270
|
+
return Promise.all(definitions.map(async ({ id, capability, run }) => {
|
|
10271
|
+
const startedAt = now();
|
|
10272
|
+
let timer;
|
|
10273
|
+
const controller = new AbortController();
|
|
10274
|
+
const base = {
|
|
10275
|
+
id,
|
|
10276
|
+
capability,
|
|
10277
|
+
source,
|
|
10278
|
+
scope
|
|
10279
|
+
};
|
|
10280
|
+
try {
|
|
10281
|
+
if (!run) return {
|
|
10282
|
+
...base,
|
|
10283
|
+
status: "unknown",
|
|
10284
|
+
reason: "not-instrumented",
|
|
10285
|
+
observedAt: now()
|
|
10286
|
+
};
|
|
10287
|
+
const result = await Promise.race([Promise.resolve().then(() => run(controller.signal)), new Promise((resolve) => {
|
|
10288
|
+
timer = setTimeout(() => {
|
|
10289
|
+
controller.abort();
|
|
10290
|
+
resolve({
|
|
10291
|
+
status: "unknown",
|
|
10292
|
+
reason: "inspection-timeout"
|
|
10293
|
+
});
|
|
10294
|
+
}, timeoutMs);
|
|
10295
|
+
})]);
|
|
10296
|
+
const valid = states.has(result?.status) && /^[a-z][a-z0-9-]{0,63}$/u.test(result?.reason ?? "");
|
|
10297
|
+
return {
|
|
10298
|
+
...base,
|
|
10299
|
+
status: valid ? result.status : "unknown",
|
|
10300
|
+
reason: valid ? result.reason : "invalid-inspection-result",
|
|
10301
|
+
observedAt: now(),
|
|
10302
|
+
elapsedMs: Math.max(0, now() - startedAt)
|
|
10303
|
+
};
|
|
10304
|
+
} catch {
|
|
10305
|
+
return {
|
|
10306
|
+
...base,
|
|
10307
|
+
status: "unknown",
|
|
10308
|
+
reason: "inspection-failed",
|
|
10309
|
+
observedAt: now(),
|
|
10310
|
+
elapsedMs: Math.max(0, now() - startedAt)
|
|
10311
|
+
};
|
|
10312
|
+
} finally {
|
|
10313
|
+
clearTimeout(timer);
|
|
10314
|
+
}
|
|
10315
|
+
}));
|
|
10316
|
+
}
|
|
10317
|
+
Object.freeze([
|
|
10318
|
+
"account",
|
|
10319
|
+
"accounts",
|
|
10320
|
+
"settings",
|
|
10321
|
+
"models",
|
|
10322
|
+
"quota",
|
|
10323
|
+
"search",
|
|
10324
|
+
"images",
|
|
10325
|
+
"sketch",
|
|
10326
|
+
"subagents",
|
|
10327
|
+
"compaction",
|
|
10328
|
+
"transport",
|
|
10329
|
+
"storage",
|
|
10330
|
+
"host-ui"
|
|
10331
|
+
]);
|
|
10332
|
+
//#endregion
|
|
10333
|
+
//#region src/diagnostic-host.js
|
|
10334
|
+
const roots = [
|
|
10335
|
+
"settings.section",
|
|
10336
|
+
"conversation.input.right",
|
|
10337
|
+
"conversation.input.model",
|
|
10338
|
+
"conversation.input.attachments",
|
|
10339
|
+
"conversation.message.images",
|
|
10340
|
+
"conversation.trajectory.images",
|
|
10341
|
+
"shell.overlay"
|
|
10342
|
+
];
|
|
10343
|
+
const packageName = /^(?:@[a-z0-9_.-]+\/)?[a-z0-9][a-z0-9_.-]{0,99}$/u;
|
|
10344
|
+
function projectHostSlots(slots) {
|
|
10345
|
+
if (typeof slots?.snapshot !== "function") return void 0;
|
|
10346
|
+
return roots.map((name) => {
|
|
10347
|
+
const nodes = slots.snapshot(name);
|
|
10348
|
+
const node = Array.isArray(nodes) ? nodes.find((item) => item.type === "slot" && item.name === name) : void 0;
|
|
10349
|
+
const occupants = Array.isArray(node?.occupants) ? node.occupants : [];
|
|
10350
|
+
return {
|
|
10351
|
+
name,
|
|
10352
|
+
declared: !!node,
|
|
10353
|
+
truncated: occupants.length > 16,
|
|
10354
|
+
occupants: occupants.slice(0, 16).map((value) => ({
|
|
10355
|
+
owner: typeof value.registrant === "string" && packageName.test(value.registrant) ? value.registrant : "unknown",
|
|
10356
|
+
active: value.active === true
|
|
10357
|
+
}))
|
|
10358
|
+
};
|
|
10359
|
+
});
|
|
10360
|
+
}
|
|
10361
|
+
function createHostDiagnostics() {
|
|
10362
|
+
const scopes = /* @__PURE__ */ new Map();
|
|
10363
|
+
let sequence = 0;
|
|
10364
|
+
return {
|
|
10365
|
+
register(slots) {
|
|
10366
|
+
const item = scopes.get(slots) ?? {
|
|
10367
|
+
alias: `scope-${++sequence}`,
|
|
10368
|
+
count: 0
|
|
10369
|
+
};
|
|
10370
|
+
item.count++;
|
|
10371
|
+
scopes.set(slots, item);
|
|
10372
|
+
return () => {
|
|
10373
|
+
if (--item.count === 0) scopes.delete(slots);
|
|
10374
|
+
};
|
|
10375
|
+
},
|
|
10376
|
+
async collect() {
|
|
10377
|
+
const topology = [];
|
|
10378
|
+
const active = [...scopes.entries()].slice(0, 8);
|
|
10379
|
+
const checks = await collectChecks(active.map(([slots, item]) => ({
|
|
10380
|
+
id: `host-slots-${item.alias}`,
|
|
10381
|
+
capability: "host-ui",
|
|
10382
|
+
run: () => {
|
|
10383
|
+
const value = projectHostSlots(slots);
|
|
10384
|
+
if (!value) return {
|
|
10385
|
+
status: "unknown",
|
|
10386
|
+
reason: "host-inspection-unavailable"
|
|
10387
|
+
};
|
|
10388
|
+
topology.push({
|
|
10389
|
+
scope: item.alias,
|
|
10390
|
+
slots: value
|
|
10391
|
+
});
|
|
10392
|
+
return {
|
|
10393
|
+
status: "pass",
|
|
10394
|
+
reason: "inspection-completed"
|
|
10395
|
+
};
|
|
10396
|
+
}
|
|
10397
|
+
})), {
|
|
10398
|
+
source: "client",
|
|
10399
|
+
scope: "mounted-host-scopes"
|
|
10400
|
+
});
|
|
10401
|
+
return {
|
|
10402
|
+
version: PACKAGE_VERSION,
|
|
10403
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10404
|
+
checks,
|
|
10405
|
+
topology,
|
|
10406
|
+
truncated: scopes.size > active.length,
|
|
10407
|
+
interpretation: "host-selection-not-visual-or-execution-proof"
|
|
10408
|
+
};
|
|
10409
|
+
}
|
|
10410
|
+
};
|
|
10411
|
+
}
|
|
10412
|
+
//#endregion
|
|
10125
10413
|
//#region src/client.jsx
|
|
10126
10414
|
const inject = [
|
|
10127
10415
|
"slots",
|
|
@@ -10134,6 +10422,8 @@ window.__ModuleLoader__.load({
|
|
|
10134
10422
|
"sessions"
|
|
10135
10423
|
];
|
|
10136
10424
|
function apply(ctx) {
|
|
10425
|
+
const diagnostics = createHostDiagnostics();
|
|
10426
|
+
ctx.effect(() => diagnostics.register(ctx.slots), "codex-subscription: host inspection");
|
|
10137
10427
|
const imageViewer = new SubscriptionImageViewerService();
|
|
10138
10428
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
10139
10429
|
zh,
|
|
@@ -10194,11 +10484,13 @@ window.__ModuleLoader__.load({
|
|
|
10194
10484
|
preference,
|
|
10195
10485
|
rpc,
|
|
10196
10486
|
accountStatus,
|
|
10197
|
-
t
|
|
10487
|
+
t,
|
|
10488
|
+
diagnostics
|
|
10198
10489
|
})
|
|
10199
10490
|
}, CodexSection));
|
|
10200
10491
|
const sessions = ctx.get("sessions");
|
|
10201
10492
|
const installDirectorySlots = (scope) => {
|
|
10493
|
+
scope.effect(() => diagnostics.register(scope.slots), "codex-subscription: scoped host inspection");
|
|
10202
10494
|
const modelDirectories = scope.get("modelDirectories");
|
|
10203
10495
|
scope.slots.inject("conversation.input.right", () => scope.slots.register({
|
|
10204
10496
|
name: "conversation.input.right",
|