@dsmm/dsmm 0.3.22 → 0.3.24
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/agent-presets/dsmm-builder/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-code-search/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-coding/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-complex/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-creative/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-deep/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-documenting/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-frontend/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-oracle/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-planner/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-quick/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-research/agent.cordis.yml +1 -17
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +1 -17
- package/cordis.patch.yml +3 -0
- package/docs/agent-presets.md +1 -1
- package/docs/compatibility.md +13 -1
- package/docs/maintenance.md +48 -10
- package/docs/model-routing.md +25 -3
- package/docs/native-permissions.md +20 -4
- package/docs/releasing.md +3 -3
- package/docs/roadmap.md +33 -11
- package/docs/runtime-recovery.md +5 -3
- package/docs/settings-status.md +2 -2
- package/docs/testing.md +10 -0
- package/docs/web-fetch-fakeip.md +8 -2
- package/dsh-plugin.json +1 -1
- package/lib/agent-prompt-scope.d.ts +6 -0
- package/lib/agent-prompt-scope.js +66 -0
- package/lib/child-capture.d.ts +1 -1
- package/lib/child-capture.js +3 -1
- package/lib/client/DeploymentFields.js +1 -1
- package/lib/client/RoleToolView-data.d.ts +4 -2
- package/lib/client/RoleToolView-data.js +18 -4
- package/lib/client/RoleToolView-locales.d.ts +9 -0
- package/lib/client/RoleToolView-locales.js +4 -0
- package/lib/client/RoleToolView.d.ts +9 -3
- package/lib/client/RoleToolView.js +29 -8
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/deployment-locales.d.ts +1 -0
- package/lib/client/deployment-locales.js +3 -1
- package/lib/client/index.js +36 -1
- package/lib/client/role-call-observations.d.ts +33 -0
- package/lib/client/role-call-observations.js +207 -0
- package/lib/client.js +501 -96
- package/lib/dsh-types.d.ts +15 -0
- package/lib/index.js +4 -1
- package/lib/live-pi-ai-owner.d.ts +1 -2
- package/lib/live-pi-ai-owner.js +10 -7
- package/lib/locale-guidance.d.ts +3 -0
- package/lib/locale-guidance.js +12 -0
- package/lib/model-family.d.ts +16 -0
- package/lib/model-family.js +156 -35
- package/lib/model-routing.d.ts +23 -2
- package/lib/model-routing.js +145 -7
- package/lib/native-admission.d.ts +36 -1
- package/lib/native-admission.js +408 -24
- package/lib/native-pi-ai-wire.js +17 -4
- package/lib/profile-diagnostics.js +1 -1
- package/lib/profile-remote.d.ts +2 -0
- package/lib/profile-remote.js +12 -3
- package/lib/profile-types.d.ts +5 -0
- package/lib/prompt-content.js +1 -1
- package/lib/prompts.d.ts +3 -2
- package/lib/prompts.js +32 -45
- package/lib/role-control-remote.d.ts +5 -2
- package/lib/role-control-remote.js +84 -4
- package/lib/role-control-rpc.d.ts +8 -1
- package/lib/role-control-rpc.js +122 -50
- package/lib/role-control-types.d.ts +62 -1
- package/lib/role-control-types.js +3 -0
- package/lib/role-invocation.js +1 -1
- package/lib/role-llm-runtime.js +2 -2
- package/lib/role-routing.d.ts +27 -7
- package/lib/role-routing.js +129 -16
- package/lib/role-subagents.js +13 -26
- package/lib/runtime-recovery.js +23 -6
- package/lib/session-metadata.d.ts +13 -1
- package/lib/session-metadata.js +21 -1
- package/lib/settings.d.ts +1 -0
- package/lib/settings.js +2 -1
- package/lib/web-fetch-address-policy.d.ts +6 -2
- package/lib/web-fetch-fakeip.d.ts +6 -0
- package/lib/web-fetch-fakeip.js +29 -2
- package/package.json +2 -2
- package/prompts/deepwork.md +3 -25
- package/prompts/source/deepwork/claude-opus-5.md +2 -8
- package/prompts/source/deepwork/codex.md +2 -8
- package/prompts/source/deepwork/default.md +3 -14
- package/prompts/source/deepwork/gemini-4.md +1 -7
- package/prompts/source/deepwork/gemini.md +3 -19
- package/prompts/source/deepwork/glm.md +6 -23
- package/prompts/source/deepwork/gpt.md +7 -15
- package/prompts/source/deepwork/kimi-k3-1.md +65 -0
- package/prompts/source/deepwork/kimi.md +1 -7
- package/prompts/source/deepwork/planner.md +0 -4
- package/prompts/source/deepwork/swe-2.md +2 -8
- package/prompts/source/shared/locale.md +1 -6
- package/skills/avoid-ai-slop/SKILL.md +2 -0
- package/skills/frontend/references/design/interaction-skill.md +14 -0
- package/skills/remove-ai-slops/SKILL.md +4 -4
- package/skills/report-fidelity/SKILL.md +3 -0
- package/prompts/source/shared/dsh-host-contract.md +0 -8
package/lib/client.js
CHANGED
|
@@ -2710,7 +2710,7 @@ var configFields = {
|
|
|
2710
2710
|
roleRouting: "role-routing",
|
|
2711
2711
|
runtimePolicy: { strategy: null, rateLimit },
|
|
2712
2712
|
presets: { materialize: null, root: null },
|
|
2713
|
-
subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, backgroundMode: null, maxDepth: null },
|
|
2713
|
+
subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, forceBackground: null, backgroundMode: null, maxDepth: null },
|
|
2714
2714
|
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
|
2715
2715
|
guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, gitWriteScope: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
|
|
2716
2716
|
runtimeRecovery: { enabled: null, retryOnStatusCodes: [null], retryOnCodes: [null], fallbackRoutes: [route], maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
|
|
@@ -2859,10 +2859,11 @@ function integer2(value, field, maximum = Number.MAX_SAFE_INTEGER) {
|
|
|
2859
2859
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0 || value > maximum) fail2(field);
|
|
2860
2860
|
return value;
|
|
2861
2861
|
}
|
|
2862
|
-
function
|
|
2862
|
+
function parseDsmmRoleId(value) {
|
|
2863
2863
|
if (typeof value !== "string" || !rolePattern.test(value)) fail2("role");
|
|
2864
2864
|
return value;
|
|
2865
2865
|
}
|
|
2866
|
+
var role2 = parseDsmmRoleId;
|
|
2866
2867
|
function object(value, required, optional2 = []) {
|
|
2867
2868
|
if (value === null || typeof value !== "object" || Array.isArray(value)) fail2("object");
|
|
2868
2869
|
if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null || Object.getOwnPropertySymbols(value).length || Object.values(Object.getOwnPropertyDescriptors(value)).some((property2) => !Object.hasOwn(property2, "value") || !property2.enumerable)) fail2("object");
|
|
@@ -3040,13 +3041,28 @@ function parseDsmmRoleRouteComparison(value) {
|
|
|
3040
3041
|
return { childId: sessionId(row.childId), initialRoute: initialRoleRoute(row.initialRoute), liveRoute: liveRoleRoute(row.liveRoute) };
|
|
3041
3042
|
}
|
|
3042
3043
|
function parseDsmmInvocationView(value) {
|
|
3043
|
-
const row = object(jsonData(value), ["role", "label", "level", "routeSource", "mode"], ["route", "runId", "childId", "jobId", "routeComparison"]);
|
|
3044
|
+
const row = object(jsonData(value), ["role", "label", "level", "routeSource", "mode"], ["route", "runId", "childId", "jobId", "routeComparison", "delivery", "phase", "stopReason"]);
|
|
3044
3045
|
if (typeof row.level !== "string" || !["normal", "low", "high", "max"].includes(row.level) || !DSMM_ROUTE_SOURCES.includes(row.routeSource) || typeof row.mode !== "string" || !["one-shot", "continuable"].includes(row.mode)) fail2("invocation");
|
|
3046
|
+
if (Object.hasOwn(row, "delivery") && !["caller", "parent"].includes(row.delivery) || Object.hasOwn(row, "phase") && !["reserved", "active", "settled"].includes(row.phase) || Object.hasOwn(row, "stopReason") && !["completed", "aborted", "error", "max-tokens", "refusal"].includes(row.stopReason) || Object.hasOwn(row, "stopReason") && row.phase !== "settled") fail2("invocation lifecycle");
|
|
3045
3047
|
const target = role2(row.role);
|
|
3046
3048
|
if (target === "dsmm-orchestrator") fail2("invocation target");
|
|
3047
3049
|
const routeComparison = Object.hasOwn(row, "routeComparison") ? parseDsmmRoleRouteComparison(row.routeComparison) : void 0;
|
|
3048
3050
|
if (routeComparison !== void 0 && (!Object.hasOwn(row, "childId") || routeComparison.childId !== row.childId)) fail2("invocation routeComparison childId");
|
|
3049
|
-
return {
|
|
3051
|
+
return {
|
|
3052
|
+
role: target,
|
|
3053
|
+
label: text2(row.label, "label", 120),
|
|
3054
|
+
level: row.level,
|
|
3055
|
+
routeSource: row.routeSource,
|
|
3056
|
+
mode: row.mode,
|
|
3057
|
+
...optional(row, "route", modelRoute),
|
|
3058
|
+
...optional(row, "runId", sessionId),
|
|
3059
|
+
...optional(row, "childId", sessionId),
|
|
3060
|
+
...optional(row, "jobId", sessionId),
|
|
3061
|
+
...routeComparison === void 0 ? {} : { routeComparison },
|
|
3062
|
+
...Object.hasOwn(row, "delivery") ? { delivery: row.delivery } : {},
|
|
3063
|
+
...Object.hasOwn(row, "phase") ? { phase: row.phase } : {},
|
|
3064
|
+
...Object.hasOwn(row, "stopReason") ? { stopReason: row.stopReason } : {}
|
|
3065
|
+
};
|
|
3050
3066
|
}
|
|
3051
3067
|
function selectionState(value) {
|
|
3052
3068
|
const item = object(value, ["selectedId", "appliedRevision", "selectionRevision"], ["sourceRevision", "refreshRequired"]);
|
|
@@ -7825,6 +7841,7 @@ var deploymentEn = {
|
|
|
7825
7841
|
core: "Core",
|
|
7826
7842
|
coreHint: "Core-owned desired settings. Model-parameter passthrough is ordinary config, not a subplugin. The permission-control enabled flag is startup-pinned. Save does not change current-session admission; inspect desired, startup and admitted values below. Unavailable admission stays unknown.",
|
|
7827
7843
|
modelParametersHint: "Off sends no custom parameters and uses native reasoning defaults. Saved values and the selected model stay unchanged.",
|
|
7844
|
+
forceBackgroundHint: "Takes priority over Allow background runs: every delegation uses native parent delivery, whether run_in_background is omitted, true or false. Returns accepted child/message IDs without waiting for completion.",
|
|
7828
7845
|
permissionControlHint: "Permission-control mounting is startup-pinned. Saved configuration does not prove runtime coverage or remove current protections. Root rules keep their independent authority inside Permissions.",
|
|
7829
7846
|
modules: "Configuration sections",
|
|
7830
7847
|
scope: "Configuration scope",
|
|
@@ -7930,6 +7947,7 @@ var deploymentZh = {
|
|
|
7930
7947
|
core: "Core 核心配置",
|
|
7931
7948
|
coreHint: "Core 所有的 desired 意图配置。模型参数透传为普通配置,非子插件;权限控制 enabled 仅启动时捕获。保存不改变当前会话准入;下方可检查意图、启动与准入值,不可用的准入仍为未知。",
|
|
7932
7949
|
modelParametersHint: "关闭后不发送自定义参数,改用原生推理默认值;已保存值与所选模型不变。",
|
|
7950
|
+
forceBackgroundHint: "优先于“允许后台执行”:run_in_background 无论省略、true 或 false,所有委派都使用原生父级后台交付,不等待任务完成,返回已接收的 child/message 标识。",
|
|
7933
7951
|
permissionControlHint: "权限控制挂载仅启动时捕获。保存配置不证明运行时覆盖,也不移除当前保护;Root 规则在权限模块内保持独立权限。",
|
|
7934
7952
|
modules: "配置分区",
|
|
7935
7953
|
scope: "配置范围",
|
|
@@ -8053,6 +8071,7 @@ var deploymentFieldLabels = {
|
|
|
8053
8071
|
maxLabelChars: ["Label character limit", "标签字符上限"],
|
|
8054
8072
|
todoDisciplineHelper: ["Todo discipline", "待办纪律"],
|
|
8055
8073
|
enableRunInBackground: ["Allow background runs", "允许后台执行"],
|
|
8074
|
+
forceBackground: ["Force all delegations into background", "强制所有委派后台执行"],
|
|
8056
8075
|
backgroundMode: ["Background mode", "后台模式"],
|
|
8057
8076
|
maxDepth: ["Maximum depth", "最大深度"],
|
|
8058
8077
|
policy: ["Policy", "策略"],
|
|
@@ -8879,6 +8898,7 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
|
|
|
8879
8898
|
] })
|
|
8880
8899
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScalarField, { schema, path, controller, inherited, t }),
|
|
8881
8900
|
name2 === "modelParameters.passthrough" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: t("modelParametersHint") }),
|
|
8901
|
+
name2 === "subagents.forceBackground" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: t("forceBackgroundHint") }),
|
|
8882
8902
|
name2 === "permissionControl.enabled" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })
|
|
8883
8903
|
] });
|
|
8884
8904
|
}
|
|
@@ -9757,6 +9777,9 @@ function DeploymentPage(props) {
|
|
|
9757
9777
|
}
|
|
9758
9778
|
|
|
9759
9779
|
// src/role-control-types.ts
|
|
9780
|
+
var ROLE_CALL_PHASES = ["reserved", "active", "settled"];
|
|
9781
|
+
var ROLE_CALL_DELIVERIES = ["caller", "parent"];
|
|
9782
|
+
var ROLE_CALL_STOP_REASONS = ["completed", "aborted", "error", "max-tokens", "refusal"];
|
|
9760
9783
|
var ROLE_CONTROL_DISABLED_REASONS = [
|
|
9761
9784
|
"module-off",
|
|
9762
9785
|
"role-disabled",
|
|
@@ -9860,6 +9883,84 @@ function child(value) {
|
|
|
9860
9883
|
...routeComparison === void 0 ? {} : { routeComparison }
|
|
9861
9884
|
};
|
|
9862
9885
|
}
|
|
9886
|
+
function callIdentity(value) {
|
|
9887
|
+
const valueText = text4(value, 512);
|
|
9888
|
+
if (valueText.length === 0) fail4();
|
|
9889
|
+
return valueText;
|
|
9890
|
+
}
|
|
9891
|
+
function observedRoute(value) {
|
|
9892
|
+
const row = object2(value, ["provider", "model"], ["reasoningEffort"]);
|
|
9893
|
+
const provider = text4(row.provider, 1024), model = text4(row.model, 4096);
|
|
9894
|
+
const reasoningEffort = Object.hasOwn(row, "reasoningEffort") ? text4(row.reasoningEffort, 128) : void 0;
|
|
9895
|
+
if (provider.length === 0 || model.length === 0 || reasoningEffort === "") fail4();
|
|
9896
|
+
return { provider, model, ...reasoningEffort === void 0 ? {} : { reasoningEffort } };
|
|
9897
|
+
}
|
|
9898
|
+
function observedInitialRoute(value) {
|
|
9899
|
+
const row = object2(value, ["status"], ["source", "route", "reason"]);
|
|
9900
|
+
if (row.status === "known") {
|
|
9901
|
+
object2(row, ["status", "source", "route"]);
|
|
9902
|
+
if (row.source !== "invocation-capture") fail4();
|
|
9903
|
+
return { status: "known", source: "invocation-capture", route: observedRoute(row.route) };
|
|
9904
|
+
}
|
|
9905
|
+
object2(row, ["status", "reason"]);
|
|
9906
|
+
if (row.status !== "unknown" || row.reason !== "missing-invocation-capture") fail4();
|
|
9907
|
+
return { status: "unknown", reason: "missing-invocation-capture" };
|
|
9908
|
+
}
|
|
9909
|
+
function observedActualRoute(value) {
|
|
9910
|
+
const row = object2(value, ["status"], ["source", "route", "reason"]);
|
|
9911
|
+
if (row.status === "known") {
|
|
9912
|
+
object2(row, ["status", "source", "route"]);
|
|
9913
|
+
if (row.source !== "own-native-request-header") fail4();
|
|
9914
|
+
return { status: "known", source: "own-native-request-header", route: observedRoute(row.route) };
|
|
9915
|
+
}
|
|
9916
|
+
object2(row, ["status", "reason"]);
|
|
9917
|
+
if (row.status !== "unknown" || !["no-own-request-header", "invalid-own-request-header", "not-observed"].includes(row.reason)) fail4();
|
|
9918
|
+
return { status: "unknown", reason: row.reason };
|
|
9919
|
+
}
|
|
9920
|
+
function roleCall(value) {
|
|
9921
|
+
const row = object2(value, ["parentSessionId", "parentAdmissionEpoch", "callId", "rootCallId", "childId", "role", "level", "routeSource", "initialRoute", "actualRoute", "phase", "delivery"], ["childAdmissionEpoch", "runId", "stopReason"]);
|
|
9922
|
+
const role3 = parseDsmmRoleId(row.role);
|
|
9923
|
+
if (role3 === "dsmm-orchestrator") fail4();
|
|
9924
|
+
const childId = identity(row.childId), initialRoute = observedInitialRoute(row.initialRoute), actualRoute = observedActualRoute(row.actualRoute);
|
|
9925
|
+
const phase = choice(row.phase, ROLE_CALL_PHASES), delivery = choice(row.delivery, ROLE_CALL_DELIVERIES);
|
|
9926
|
+
const stopReason = Object.hasOwn(row, "stopReason") ? choice(row.stopReason, ROLE_CALL_STOP_REASONS) : void 0;
|
|
9927
|
+
if (stopReason !== void 0 && phase !== "settled") fail4();
|
|
9928
|
+
return {
|
|
9929
|
+
parentSessionId: identity(row.parentSessionId),
|
|
9930
|
+
parentAdmissionEpoch: epoch2(row.parentAdmissionEpoch),
|
|
9931
|
+
...Object.hasOwn(row, "childAdmissionEpoch") ? { childAdmissionEpoch: epoch2(row.childAdmissionEpoch) } : {},
|
|
9932
|
+
callId: callIdentity(row.callId),
|
|
9933
|
+
rootCallId: callIdentity(row.rootCallId),
|
|
9934
|
+
childId,
|
|
9935
|
+
...Object.hasOwn(row, "runId") ? { runId: identity(row.runId) } : {},
|
|
9936
|
+
role: role3,
|
|
9937
|
+
level: choice(row.level, ["normal", "low", "high", "max"]),
|
|
9938
|
+
routeSource: choice(row.routeSource, DSMM_ROUTE_SOURCES),
|
|
9939
|
+
initialRoute,
|
|
9940
|
+
actualRoute,
|
|
9941
|
+
phase,
|
|
9942
|
+
delivery,
|
|
9943
|
+
...stopReason === void 0 ? {} : { stopReason }
|
|
9944
|
+
};
|
|
9945
|
+
}
|
|
9946
|
+
function observationFrame(value) {
|
|
9947
|
+
const row = object2(value, ["type", "sessionId", "admissionEpoch"], ["calls", "call", "callId"]), sessionId2 = identity(row.sessionId), admissionEpoch = epoch2(row.admissionEpoch);
|
|
9948
|
+
if (row.type === "snapshot") {
|
|
9949
|
+
object2(row, ["type", "sessionId", "admissionEpoch", "calls"]);
|
|
9950
|
+
const calls = array(row.calls).map(roleCall);
|
|
9951
|
+
if (calls.some((call) => call.parentSessionId !== sessionId2 || call.parentAdmissionEpoch !== admissionEpoch) || new Set(calls.map((call) => call.callId)).size !== calls.length) fail4();
|
|
9952
|
+
return { type: "snapshot", sessionId: sessionId2, admissionEpoch, calls };
|
|
9953
|
+
}
|
|
9954
|
+
if (row.type === "update") {
|
|
9955
|
+
object2(row, ["type", "sessionId", "admissionEpoch", "call"]);
|
|
9956
|
+
const call = roleCall(row.call);
|
|
9957
|
+
if (call.parentSessionId !== sessionId2 || call.parentAdmissionEpoch !== admissionEpoch) fail4();
|
|
9958
|
+
return { type: "update", sessionId: sessionId2, admissionEpoch, call };
|
|
9959
|
+
}
|
|
9960
|
+
object2(row, ["type", "sessionId", "admissionEpoch", "callId"]);
|
|
9961
|
+
if (row.type !== "remove") fail4();
|
|
9962
|
+
return { type: "remove", sessionId: sessionId2, admissionEpoch, callId: callIdentity(row.callId) };
|
|
9963
|
+
}
|
|
9863
9964
|
function snapshot3(value) {
|
|
9864
9965
|
const row = object2(value, ["sessionId", "admissionEpoch", "children", "capabilities"]);
|
|
9865
9966
|
const sessionId2 = identity(row.sessionId), admissionEpoch = epoch2(row.admissionEpoch), children = array(row.children).map(child);
|
|
@@ -9946,12 +10047,13 @@ var parseRoleControlPromptRequest = (value) => promptRequest(json(value));
|
|
|
9946
10047
|
function codec3(symbol, parse3) {
|
|
9947
10048
|
return { mode: "strict", typeSymbol: `@dsmm/dsmm#${symbol}`, create: () => ({ parse: (value) => parse3(json(value)) }) };
|
|
9948
10049
|
}
|
|
9949
|
-
function descriptor3(method, result, request) {
|
|
10050
|
+
function descriptor3(method, result, request, stream = false) {
|
|
9950
10051
|
return {
|
|
9951
10052
|
id: `@dsmm/dsmm-children#dsmmChildren/${method}`,
|
|
9952
10053
|
service: "dsmmChildren",
|
|
9953
10054
|
namespace: "dsmmChildren",
|
|
9954
10055
|
method,
|
|
10056
|
+
...stream ? { mode: "stream", cancellation: { parameter: "signal" } } : {},
|
|
9955
10057
|
invocation: { kind: "direct" },
|
|
9956
10058
|
parameters: [
|
|
9957
10059
|
{ name: "sessionId", wire: "sessionId", source: "json", codec: codec3("ChildControlSessionId", identity) },
|
|
@@ -9961,6 +10063,7 @@ function descriptor3(method, result, request) {
|
|
|
9961
10063
|
};
|
|
9962
10064
|
}
|
|
9963
10065
|
var ROLE_CONTROL_REMOTE = { package: "@dsmm/dsmm-children", descriptors: [
|
|
10066
|
+
descriptor3("observe", codec3("RoleCallObservationFrame", observationFrame), void 0, true),
|
|
9964
10067
|
descriptor3("describe", codec3("ChildSessionSnapshot", snapshot3)),
|
|
9965
10068
|
descriptor3("descendants", codec3("RoleControlDescendantsSnapshot", descendants)),
|
|
9966
10069
|
descriptor3("prompt", codec3("SubagentPromptReceipt", promptReceipt), codec3("SubagentPromptRequest", promptRequest)),
|
|
@@ -10053,10 +10156,27 @@ function actualRoleTool(toolName, meta, failed) {
|
|
|
10053
10156
|
return void 0;
|
|
10054
10157
|
}
|
|
10055
10158
|
}
|
|
10159
|
+
function observedRoleTool(toolName, observation) {
|
|
10160
|
+
if (!(toolName === "dsmm_category" ? categories : roles).has(observation.role)) return void 0;
|
|
10161
|
+
return {
|
|
10162
|
+
role: observation.role,
|
|
10163
|
+
label: roleToolDisplay(observation.role),
|
|
10164
|
+
level: observation.level,
|
|
10165
|
+
routeSource: observation.routeSource,
|
|
10166
|
+
mode: "continuable",
|
|
10167
|
+
childId: observation.childId,
|
|
10168
|
+
...observation.runId === void 0 ? {} : { runId: observation.runId },
|
|
10169
|
+
...observation.initialRoute.status === "known" ? { route: { ...observation.initialRoute.route } } : {},
|
|
10170
|
+
routeComparison: { childId: observation.childId, initialRoute: observation.initialRoute, liveRoute: observation.actualRoute },
|
|
10171
|
+
delivery: observation.delivery,
|
|
10172
|
+
phase: observation.phase,
|
|
10173
|
+
...observation.stopReason === void 0 ? {} : { stopReason: observation.stopReason }
|
|
10174
|
+
};
|
|
10175
|
+
}
|
|
10056
10176
|
function roleToolDisplay(target) {
|
|
10057
10177
|
return target.slice("dsmm-".length).split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
10058
10178
|
}
|
|
10059
|
-
function technicalTableRows(toolName, callId, rawArgs, meta, routeSource) {
|
|
10179
|
+
function technicalTableRows(toolName, callId, rawArgs, meta, routeSource, observation) {
|
|
10060
10180
|
const rows = [];
|
|
10061
10181
|
rows.push({ property: "toolName", value: toolName, isComplex: false });
|
|
10062
10182
|
rows.push({ property: "callId", value: callId, isComplex: false });
|
|
@@ -10082,9 +10202,10 @@ function technicalTableRows(toolName, callId, rawArgs, meta, routeSource) {
|
|
|
10082
10202
|
rows.push({ property: "meta", value: meta, isComplex: typeof meta === "object" });
|
|
10083
10203
|
}
|
|
10084
10204
|
}
|
|
10205
|
+
if (observation !== void 0) rows.push({ property: "observation", value: observation, isComplex: true });
|
|
10085
10206
|
return rows;
|
|
10086
10207
|
}
|
|
10087
|
-
function technicalJsonData(toolName, callId, rawArgs, meta, routeSource) {
|
|
10208
|
+
function technicalJsonData(toolName, callId, rawArgs, meta, routeSource, observation) {
|
|
10088
10209
|
const parsedArgs = roleToolArguments(rawArgs);
|
|
10089
10210
|
const data = {
|
|
10090
10211
|
toolName,
|
|
@@ -10094,9 +10215,8 @@ function technicalJsonData(toolName, callId, rawArgs, meta, routeSource) {
|
|
|
10094
10215
|
data.routeSource = routeSource;
|
|
10095
10216
|
}
|
|
10096
10217
|
data.args = parsedArgs !== void 0 ? parsedArgs : rawArgs;
|
|
10097
|
-
if (meta !== void 0 && meta !== null)
|
|
10098
|
-
|
|
10099
|
-
}
|
|
10218
|
+
if (meta !== void 0 && meta !== null) data.meta = meta;
|
|
10219
|
+
if (observation !== void 0) data.observation = observation;
|
|
10100
10220
|
return data;
|
|
10101
10221
|
}
|
|
10102
10222
|
|
|
@@ -10119,6 +10239,11 @@ var roleToolEn = {
|
|
|
10119
10239
|
error: "Failed",
|
|
10120
10240
|
stopped: "Interrupted",
|
|
10121
10241
|
technicalDetails: "Technical details",
|
|
10242
|
+
observation: "Route observation",
|
|
10243
|
+
observationUnavailable: "Unavailable",
|
|
10244
|
+
observationConnecting: "Connecting",
|
|
10245
|
+
observationLive: "Live",
|
|
10246
|
+
observationStale: "Connection lost",
|
|
10122
10247
|
args: "Original arguments",
|
|
10123
10248
|
preparingArgs: "Arguments received so far",
|
|
10124
10249
|
output: "Complete result content",
|
|
@@ -10132,6 +10257,10 @@ var roleToolEn = {
|
|
|
10132
10257
|
level: "Level",
|
|
10133
10258
|
route: "Reported route",
|
|
10134
10259
|
routeSource: "Route source",
|
|
10260
|
+
initialRoute: "Initial",
|
|
10261
|
+
actualRoute: "Actual",
|
|
10262
|
+
routeUnknown: "unknown",
|
|
10263
|
+
effortUnreported: "effort not reported",
|
|
10135
10264
|
table: "Table",
|
|
10136
10265
|
json: "JSON",
|
|
10137
10266
|
viewMode: "View mode",
|
|
@@ -10155,6 +10284,11 @@ var roleToolZh = {
|
|
|
10155
10284
|
error: "失败",
|
|
10156
10285
|
stopped: "已中断",
|
|
10157
10286
|
technicalDetails: "技术详情",
|
|
10287
|
+
observation: "路由观测",
|
|
10288
|
+
observationUnavailable: "不可用",
|
|
10289
|
+
observationConnecting: "连接中",
|
|
10290
|
+
observationLive: "实时",
|
|
10291
|
+
observationStale: "连接已断开",
|
|
10158
10292
|
args: "原始参数",
|
|
10159
10293
|
preparingArgs: "目前已收到的参数",
|
|
10160
10294
|
output: "完整结果内容",
|
|
@@ -10168,6 +10302,10 @@ var roleToolZh = {
|
|
|
10168
10302
|
level: "等级",
|
|
10169
10303
|
route: "报告的路由",
|
|
10170
10304
|
routeSource: "路由来源",
|
|
10305
|
+
initialRoute: "初始",
|
|
10306
|
+
actualRoute: "实际",
|
|
10307
|
+
routeUnknown: "未知",
|
|
10308
|
+
effortUnreported: "effort 未报告",
|
|
10171
10309
|
table: "表格",
|
|
10172
10310
|
json: "JSON",
|
|
10173
10311
|
viewMode: "视图模式",
|
|
@@ -10213,16 +10351,28 @@ function RoleToolView(props) {
|
|
|
10213
10351
|
const { t } = props;
|
|
10214
10352
|
const raw = props.phase === "preparing" ? partial.preview : props.phase === "start" ? props.block.argsRaw : props.block.call?.argsRaw ?? "";
|
|
10215
10353
|
const requested = partial?.requested ?? requestedRoleTool(props.toolName, raw);
|
|
10354
|
+
const observation = props.useRoleCalls((state2) => state2.calls.get(props.callId));
|
|
10355
|
+
const observationStatus = props.useRoleCalls((state2) => state2.status);
|
|
10356
|
+
const observationIssue2 = props.useRoleCalls((state2) => state2.issue);
|
|
10216
10357
|
const result = props.phase === "result" ? props.block : void 0;
|
|
10217
10358
|
const failed = result !== void 0 && (result.isError || result.error != null);
|
|
10218
|
-
const
|
|
10359
|
+
const persisted = result === void 0 ? void 0 : actualRoleTool(props.toolName, result.meta, failed);
|
|
10360
|
+
const observed = observation === void 0 ? void 0 : observedRoleTool(props.toolName, observation);
|
|
10361
|
+
const inactivePersisted = persisted === void 0 || persisted.phase === "settled" ? persisted : persisted.childId === void 0 ? { ...persisted, routeComparison: void 0 } : { ...persisted, routeComparison: {
|
|
10362
|
+
childId: persisted.childId,
|
|
10363
|
+
initialRoute: persisted.routeComparison?.initialRoute ?? (persisted.route === void 0 ? { status: "unknown", reason: "missing-invocation-capture" } : { status: "known", source: "invocation-capture", route: persisted.route }),
|
|
10364
|
+
liveRoute: { status: "unknown", reason: "not-observed" }
|
|
10365
|
+
} };
|
|
10366
|
+
const actual = persisted?.phase === "settled" ? persisted : observed ?? inactivePersisted;
|
|
10367
|
+
const comparison = actual?.routeComparison;
|
|
10219
10368
|
const target = actual?.role ?? requested.target;
|
|
10220
10369
|
const action2 = props.phase === "preparing" ? t("calling") : t("call");
|
|
10221
10370
|
const targetLabel = target === void 0 ? t("unknownTarget") : roleToolDisplay(target);
|
|
10222
10371
|
const rawDesc = requested.description?.trim();
|
|
10223
10372
|
const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : void 0;
|
|
10224
10373
|
const title = `${action2} ${targetLabel}`;
|
|
10225
|
-
const
|
|
10374
|
+
const observedStop = actual?.phase === "settled" ? actual.stopReason : void 0;
|
|
10375
|
+
const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped" : failed || observedStop !== void 0 && observedStop !== "completed" ? "error" : result === void 0 ? props.phase === "preparing" ? "preparing" : "running" : actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : "result";
|
|
10226
10376
|
const isOngoing = state === "running" || props.phase === "preparing";
|
|
10227
10377
|
const code = (value) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
10228
10378
|
const [viewMode, setViewMode] = (0, import_react11.useState)("table");
|
|
@@ -10231,103 +10381,138 @@ function RoleToolView(props) {
|
|
|
10231
10381
|
{ value: "table", label: t("table") },
|
|
10232
10382
|
{ value: "json", label: t("json") }
|
|
10233
10383
|
];
|
|
10234
|
-
const tableRows = technicalTableRows(props.toolName, props.callId, raw, result?.meta, actual?.routeSource);
|
|
10235
|
-
const jsonData2 = technicalJsonData(props.toolName, props.callId, raw, result?.meta, actual?.routeSource);
|
|
10384
|
+
const tableRows = technicalTableRows(props.toolName, props.callId, raw, result?.meta, actual?.routeSource, observation);
|
|
10385
|
+
const jsonData2 = technicalJsonData(props.toolName, props.callId, raw, result?.meta, actual?.routeSource, observation);
|
|
10236
10386
|
const roleDiffers = requested.target !== void 0 && actual !== void 0 && actual.role !== requested.target;
|
|
10237
10387
|
const levelDiffers = requested.level !== void 0 && actual !== void 0 && actual.level !== requested.level;
|
|
10238
10388
|
const showRequestedVsActual = roleDiffers || levelDiffers;
|
|
10389
|
+
const initialRoute = comparison?.initialRoute ?? (actual?.route === void 0 ? void 0 : { status: "known", source: "invocation-capture", route: actual.route });
|
|
10390
|
+
const actualRoute = comparison?.liveRoute;
|
|
10391
|
+
const routeLabel = (route3, missingEffort = false) => `${route3.provider}/${route3.model}${route3.reasoningEffort === void 0 ? missingEffort ? ` · ${t("effortUnreported")}` : "" : ` · ${route3.reasoningEffort}`}`;
|
|
10239
10392
|
const collapsedContent = singleLineDesc ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
10240
10393
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dsmm-role-sep", "aria-hidden": "true" }),
|
|
10241
10394
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dsmm-role-summary", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.TextShimmer, { active: isOngoing, children: singleLineDesc }) })
|
|
10242
10395
|
] }) : void 0;
|
|
10243
10396
|
const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : result === void 0 ? "ongoing" : state === "background" ? "idle" : "done";
|
|
10244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
10398
|
+
"div",
|
|
10399
|
+
{
|
|
10400
|
+
className: "dsmm-role-tool",
|
|
10401
|
+
"data-dsmm-role-tool": props.toolName,
|
|
10402
|
+
"data-identity": actual === void 0 ? "requested" : "actual",
|
|
10403
|
+
"data-state": state,
|
|
10404
|
+
"data-delivery": actual?.delivery,
|
|
10405
|
+
"data-phase": actual?.phase,
|
|
10406
|
+
"data-expanded": expanded ? "true" : "false",
|
|
10407
|
+
children: [
|
|
10408
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
10409
|
+
import_dsh_client_ui_primitives11.DisclosureRow,
|
|
10410
|
+
{
|
|
10411
|
+
title,
|
|
10412
|
+
titleClassName: "dsmm-role-title",
|
|
10413
|
+
rowClassName: "dsmm-role-heading",
|
|
10414
|
+
contentClassName: "dsmm-role-text",
|
|
10415
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }),
|
|
10416
|
+
collapsedContent,
|
|
10417
|
+
keepContentWhenOpen: true,
|
|
10418
|
+
running: isOngoing,
|
|
10419
|
+
open: expanded,
|
|
10420
|
+
expandable: true,
|
|
10421
|
+
onToggle: toggle,
|
|
10422
|
+
expandOnRowClick: true,
|
|
10423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-body", children: [
|
|
10424
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "dsmm-role-identity", children: [
|
|
10425
|
+
showRequestedVsActual ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
10426
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-dim", children: [
|
|
10427
|
+
t("requested"),
|
|
10428
|
+
": "
|
|
10429
|
+
] }),
|
|
10430
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
10431
|
+
requested.target === void 0 ? t("unknown") : roleToolDisplay(requested.target),
|
|
10432
|
+
requested.level ? ` (${requested.level})` : ""
|
|
10433
|
+
] }),
|
|
10434
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dsmm-role-dim", children: " → " }),
|
|
10435
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-dim", children: [
|
|
10436
|
+
t("actual"),
|
|
10437
|
+
": "
|
|
10438
|
+
] }),
|
|
10439
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
10440
|
+
roleToolDisplay(actual.role),
|
|
10441
|
+
" (",
|
|
10442
|
+
actual.level,
|
|
10443
|
+
")"
|
|
10444
|
+
] })
|
|
10445
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
10446
|
+
actual === void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-dim", children: [
|
|
10447
|
+
t("requested"),
|
|
10448
|
+
": "
|
|
10449
|
+
] }),
|
|
10450
|
+
actual !== void 0 ? roleToolDisplay(actual.role) : requested.target === void 0 ? t("unknownTarget") : roleToolDisplay(requested.target),
|
|
10451
|
+
(actual?.level ?? requested.level) !== void 0 && ` · ${actual?.level ?? requested.level}`,
|
|
10452
|
+
props.phase !== "preparing" && actual === void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-dim", children: [
|
|
10453
|
+
" · ",
|
|
10454
|
+
t("actualUnknown")
|
|
10455
|
+
] })
|
|
10456
|
+
] }),
|
|
10457
|
+
initialRoute !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-model", children: [
|
|
10458
|
+
" · ",
|
|
10459
|
+
t("initialRoute"),
|
|
10460
|
+
": ",
|
|
10461
|
+
initialRoute.status === "known" ? routeLabel(initialRoute.route) : t("routeUnknown")
|
|
10462
|
+
] }),
|
|
10463
|
+
actualRoute !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-model", children: [
|
|
10464
|
+
" · ",
|
|
10465
|
+
t("actualRoute"),
|
|
10466
|
+
": ",
|
|
10467
|
+
actualRoute.status === "known" ? routeLabel(actualRoute.route, true) : t("routeUnknown")
|
|
10468
|
+
] }) : props.phase !== "preparing" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-model", children: [
|
|
10469
|
+
" · ",
|
|
10470
|
+
t("actualRoute"),
|
|
10471
|
+
": ",
|
|
10472
|
+
t("routeUnknown")
|
|
10473
|
+
] })
|
|
10266
10474
|
] }),
|
|
10267
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("
|
|
10268
|
-
|
|
10269
|
-
|
|
10475
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "dsmm-role-identity", "data-observation-status": observationStatus, children: [
|
|
10476
|
+
t("observation"),
|
|
10477
|
+
": ",
|
|
10478
|
+
t({ unavailable: "observationUnavailable", connecting: "observationConnecting", live: "observationLive", stale: "observationStale" }[observationStatus]),
|
|
10479
|
+
observationIssue2 !== void 0 && ` · ${observationIssue2.kind}/${observationIssue2.code}`
|
|
10270
10480
|
] }),
|
|
10271
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("
|
|
10272
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("
|
|
10273
|
-
t("
|
|
10274
|
-
|
|
10481
|
+
requested.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-task", children: requested.description }),
|
|
10482
|
+
result?.error != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-failure", children: [
|
|
10483
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-section-title", children: t("failure") }),
|
|
10484
|
+
code(JSON.stringify(result.error, null, 2))
|
|
10275
10485
|
] }),
|
|
10276
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10486
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("details", { className: "dsmm-role-details", children: [
|
|
10487
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("summary", { children: t("technicalDetails") }),
|
|
10488
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-details-body", children: [
|
|
10489
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "dsmm-role-details-header", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }),
|
|
10490
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "dsmm-role-table", children: [
|
|
10491
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
|
|
10492
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { scope: "col", children: t("property") }),
|
|
10493
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { scope: "col", children: t("value") })
|
|
10494
|
+
] }) }),
|
|
10495
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { children: tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
|
|
10496
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "dsmm-role-prop-cell", children: row.property }),
|
|
10497
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "dsmm-role-val-cell", children: row.isComplex ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) }) : typeof row.value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dsmm-role-cell-text", children: row.value }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: row.value === null ? "null" : row.value === void 0 ? "undefined" : String(row.value) }) })
|
|
10498
|
+
] }, row.property)) })
|
|
10499
|
+
] }) }),
|
|
10500
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData2, null, 2)) })
|
|
10501
|
+
] })
|
|
10288
10502
|
] })
|
|
10289
|
-
] }),
|
|
10290
|
-
actual?.route !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "dsmm-role-model", children: [
|
|
10291
|
-
" · ",
|
|
10292
|
-
actual.route.provider,
|
|
10293
|
-
"/",
|
|
10294
|
-
actual.route.model,
|
|
10295
|
-
actual.route.reasoningEffort ? ` · ${actual.route.reasoningEffort}` : ""
|
|
10296
|
-
] })
|
|
10297
|
-
] }),
|
|
10298
|
-
requested.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-task", children: requested.description }),
|
|
10299
|
-
result?.error != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-failure", children: [
|
|
10300
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-section-title", children: t("failure") }),
|
|
10301
|
-
code(JSON.stringify(result.error, null, 2))
|
|
10302
|
-
] }),
|
|
10303
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("details", { className: "dsmm-role-details", children: [
|
|
10304
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("summary", { children: t("technicalDetails") }),
|
|
10305
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-details-body", children: [
|
|
10306
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "dsmm-role-details-header", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }),
|
|
10307
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "dsmm-role-table", children: [
|
|
10308
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
|
|
10309
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { scope: "col", children: t("property") }),
|
|
10310
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { scope: "col", children: t("value") })
|
|
10311
|
-
] }) }),
|
|
10312
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { children: tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
|
|
10313
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "dsmm-role-prop-cell", children: row.property }),
|
|
10314
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "dsmm-role-val-cell", children: row.isComplex ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) }) : typeof row.value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "dsmm-role-cell-text", children: row.value }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: row.value === null ? "null" : row.value === void 0 ? "undefined" : String(row.value) }) })
|
|
10315
|
-
] }, row.property)) })
|
|
10316
|
-
] }) }),
|
|
10317
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData2, null, 2)) })
|
|
10318
10503
|
] })
|
|
10319
|
-
|
|
10504
|
+
}
|
|
10505
|
+
),
|
|
10506
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-actions", children: [
|
|
10507
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.StateDot, { state: stateDotState }),
|
|
10508
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-status", role: "status", children: t(state) }),
|
|
10509
|
+
props.inspect !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.Button, { variant: "ghost", size: "sm", onClick: props.inspect, children: t("inspect") })
|
|
10320
10510
|
] })
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.StateDot, { state: stateDotState }),
|
|
10325
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-status", role: "status", children: t(state) }),
|
|
10326
|
-
props.inspect !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dsh_client_ui_primitives11.Button, { variant: "ghost", size: "sm", onClick: props.inspect, children: t("inspect") })
|
|
10327
|
-
] })
|
|
10328
|
-
] });
|
|
10511
|
+
]
|
|
10512
|
+
}
|
|
10513
|
+
);
|
|
10329
10514
|
}
|
|
10330
|
-
function registerRoleToolViews(ctx) {
|
|
10515
|
+
function registerRoleToolViews(ctx, observations) {
|
|
10331
10516
|
ctx.effect(() => ctx.locale.register(ROLE_TOOL_NS, { en: roleToolEn, zh: roleToolZh }), "dsmm: role tool locale");
|
|
10332
10517
|
ctx.effect(() => {
|
|
10333
10518
|
const style = document.createElement("style");
|
|
@@ -10337,13 +10522,203 @@ function registerRoleToolViews(ctx) {
|
|
|
10337
10522
|
return () => style.remove();
|
|
10338
10523
|
}, "dsmm: role tool styles");
|
|
10339
10524
|
ctx.slots.inject("tool.call.toolview", () => {
|
|
10340
|
-
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map((key) => ctx.slots.register({
|
|
10525
|
+
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map((key) => ctx.slots.register({
|
|
10526
|
+
name: "tool.call.toolview",
|
|
10527
|
+
key,
|
|
10528
|
+
locale: ROLE_TOOL_NS,
|
|
10529
|
+
inject: (sessionId2) => ({ hooks: { roleCalls: observations.source(sessionId2) } })
|
|
10530
|
+
}, RoleToolView));
|
|
10341
10531
|
return () => {
|
|
10342
10532
|
for (const dispose of disposers.reverse()) dispose();
|
|
10343
10533
|
};
|
|
10344
10534
|
});
|
|
10345
10535
|
}
|
|
10346
10536
|
|
|
10537
|
+
// node_modules/.pnpm/@deepseek-ai+dsh-typert-protocol@0.2.1-rc.2_@deepseek-ai+cordis@4.0.5/node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js
|
|
10538
|
+
function remoteErrorOf(value) {
|
|
10539
|
+
if (typeof value === "object" && value !== null && value.isDSHRemoteError === true && typeof value.code === "string") return value;
|
|
10540
|
+
}
|
|
10541
|
+
var TYPERT_OWNED_VALUE = Symbol.for("dsh.typert.owned-value");
|
|
10542
|
+
|
|
10543
|
+
// src/client/role-call-observations.ts
|
|
10544
|
+
var ObservationProtocolError = class extends Error {
|
|
10545
|
+
constructor(code) {
|
|
10546
|
+
super(code);
|
|
10547
|
+
this.code = code;
|
|
10548
|
+
}
|
|
10549
|
+
};
|
|
10550
|
+
function observationIssue(error) {
|
|
10551
|
+
if (error instanceof ObservationProtocolError) return { kind: "protocol", code: error.code };
|
|
10552
|
+
const remote = remoteErrorOf(error);
|
|
10553
|
+
if (remote?.code === "dsmm-children/refused") {
|
|
10554
|
+
try {
|
|
10555
|
+
return { kind: "domain", ...parseRoleControlErrorInfo(remote.details) };
|
|
10556
|
+
} catch {
|
|
10557
|
+
return { kind: "protocol", code: "invalid-error" };
|
|
10558
|
+
}
|
|
10559
|
+
}
|
|
10560
|
+
return { kind: "transport", code: remote?.code === "gateway/cancelled" ? "cancelled" : remote?.code === "gateway/internal" ? "internal" : "unavailable" };
|
|
10561
|
+
}
|
|
10562
|
+
var RoleCallObservationController = class {
|
|
10563
|
+
binding = null;
|
|
10564
|
+
sources = /* @__PURE__ */ new Map();
|
|
10565
|
+
disposed = false;
|
|
10566
|
+
source(sessionId2) {
|
|
10567
|
+
let source = this.sources.get(sessionId2);
|
|
10568
|
+
if (source === void 0) {
|
|
10569
|
+
source = new RoleCallObservationSource(sessionId2);
|
|
10570
|
+
if (this.disposed) source.dispose();
|
|
10571
|
+
else source.bind(this.binding);
|
|
10572
|
+
this.sources.set(sessionId2, source);
|
|
10573
|
+
}
|
|
10574
|
+
return source;
|
|
10575
|
+
}
|
|
10576
|
+
observeSessionAvailability(sessionId2, available) {
|
|
10577
|
+
if (!this.disposed && available) this.sources.get(sessionId2)?.observeAvailability();
|
|
10578
|
+
}
|
|
10579
|
+
bindConnection(factory, open) {
|
|
10580
|
+
if (this.disposed) return () => {
|
|
10581
|
+
};
|
|
10582
|
+
const binding = { identity: {}, factory, open };
|
|
10583
|
+
this.binding = binding;
|
|
10584
|
+
for (const source of this.sources.values()) source.bind(binding);
|
|
10585
|
+
return () => {
|
|
10586
|
+
if (this.binding !== binding) return;
|
|
10587
|
+
this.binding = null;
|
|
10588
|
+
for (const source of this.sources.values()) source.bind(null);
|
|
10589
|
+
};
|
|
10590
|
+
}
|
|
10591
|
+
dispose() {
|
|
10592
|
+
this.disposed = true;
|
|
10593
|
+
this.binding = null;
|
|
10594
|
+
for (const source of this.sources.values()) source.dispose();
|
|
10595
|
+
this.sources.clear();
|
|
10596
|
+
}
|
|
10597
|
+
};
|
|
10598
|
+
var RoleCallObservationSource = class {
|
|
10599
|
+
constructor(sessionId2) {
|
|
10600
|
+
this.sessionId = sessionId2;
|
|
10601
|
+
this.snapshot = { sessionId: sessionId2, status: "unavailable", calls: /* @__PURE__ */ new Map() };
|
|
10602
|
+
}
|
|
10603
|
+
snapshot;
|
|
10604
|
+
listeners = /* @__PURE__ */ new Set();
|
|
10605
|
+
binding = null;
|
|
10606
|
+
revision = 0;
|
|
10607
|
+
stream;
|
|
10608
|
+
hint = 0;
|
|
10609
|
+
consumedHint = 0;
|
|
10610
|
+
disposed = false;
|
|
10611
|
+
getSnapshot() {
|
|
10612
|
+
return this.snapshot;
|
|
10613
|
+
}
|
|
10614
|
+
observeAvailability() {
|
|
10615
|
+
if (this.disposed || this.binding === null || this.listeners.size === 0) return;
|
|
10616
|
+
this.hint++;
|
|
10617
|
+
if (this.snapshot.status === "live") this.consumedHint = this.hint;
|
|
10618
|
+
else this.start();
|
|
10619
|
+
}
|
|
10620
|
+
subscribe(listener) {
|
|
10621
|
+
if (this.disposed) return () => {
|
|
10622
|
+
};
|
|
10623
|
+
this.listeners.add(listener);
|
|
10624
|
+
if (this.listeners.size === 1) this.start();
|
|
10625
|
+
return () => {
|
|
10626
|
+
this.listeners.delete(listener);
|
|
10627
|
+
if (this.listeners.size !== 0) return;
|
|
10628
|
+
this.revision++;
|
|
10629
|
+
this.consumedHint = this.hint;
|
|
10630
|
+
const stream = this.stream;
|
|
10631
|
+
this.stream = void 0;
|
|
10632
|
+
if (stream !== void 0) void stream.dispose();
|
|
10633
|
+
};
|
|
10634
|
+
}
|
|
10635
|
+
bind(binding) {
|
|
10636
|
+
if (this.disposed || this.binding?.identity === binding?.identity) return;
|
|
10637
|
+
this.binding = binding;
|
|
10638
|
+
this.revision++;
|
|
10639
|
+
this.consumedHint = this.hint;
|
|
10640
|
+
const stream = this.stream;
|
|
10641
|
+
this.stream = void 0;
|
|
10642
|
+
if (stream !== void 0) void stream.dispose();
|
|
10643
|
+
this.publish({ sessionId: this.sessionId, status: "unavailable", calls: /* @__PURE__ */ new Map() });
|
|
10644
|
+
if (this.listeners.size > 0) this.start();
|
|
10645
|
+
}
|
|
10646
|
+
dispose() {
|
|
10647
|
+
this.disposed = true;
|
|
10648
|
+
this.binding = null;
|
|
10649
|
+
this.revision++;
|
|
10650
|
+
this.consumedHint = this.hint;
|
|
10651
|
+
const stream = this.stream;
|
|
10652
|
+
this.stream = void 0;
|
|
10653
|
+
if (stream !== void 0) void stream.dispose();
|
|
10654
|
+
this.listeners.clear();
|
|
10655
|
+
}
|
|
10656
|
+
start() {
|
|
10657
|
+
const binding = this.binding;
|
|
10658
|
+
if (this.disposed || binding === null || this.listeners.size === 0 || this.stream !== void 0) return;
|
|
10659
|
+
const revision2 = ++this.revision;
|
|
10660
|
+
this.consumedHint = this.hint;
|
|
10661
|
+
const stream = binding.factory.$stream({
|
|
10662
|
+
name: `DSMM role calls for ${this.sessionId}`,
|
|
10663
|
+
open: (signal) => binding.open(this.sessionId, signal),
|
|
10664
|
+
ended: (accepted) => new Error(`DSMM role call stream ended ${accepted ? "after" : "before"} its snapshot`),
|
|
10665
|
+
carrierFailed: () => {
|
|
10666
|
+
if (this.revision === revision2 && this.stream === stream) this.invalidate("stale", { kind: "transport", code: "unavailable" });
|
|
10667
|
+
}
|
|
10668
|
+
});
|
|
10669
|
+
this.stream = stream;
|
|
10670
|
+
this.invalidate("connecting", this.snapshot.issue);
|
|
10671
|
+
void this.consume(stream, revision2);
|
|
10672
|
+
}
|
|
10673
|
+
async consume(stream, revision2) {
|
|
10674
|
+
let generation = 0, admissionEpoch;
|
|
10675
|
+
try {
|
|
10676
|
+
for await (const item of stream) {
|
|
10677
|
+
if (this.revision !== revision2 || this.stream !== stream) return;
|
|
10678
|
+
const frame = item.value;
|
|
10679
|
+
if (frame.sessionId !== this.sessionId) throw new ObservationProtocolError("invalid-frame");
|
|
10680
|
+
if (item.generation !== generation) {
|
|
10681
|
+
if (frame.type !== "snapshot") throw new ObservationProtocolError("invalid-frame");
|
|
10682
|
+
generation = item.generation;
|
|
10683
|
+
admissionEpoch = frame.admissionEpoch;
|
|
10684
|
+
this.consumedHint = this.hint;
|
|
10685
|
+
item.accept();
|
|
10686
|
+
this.publish({
|
|
10687
|
+
sessionId: this.sessionId,
|
|
10688
|
+
status: "live",
|
|
10689
|
+
admissionEpoch,
|
|
10690
|
+
calls: new Map(frame.calls.map((call) => [call.callId, call]))
|
|
10691
|
+
});
|
|
10692
|
+
continue;
|
|
10693
|
+
}
|
|
10694
|
+
if (frame.type === "snapshot" || frame.admissionEpoch !== admissionEpoch) throw new ObservationProtocolError("invalid-frame");
|
|
10695
|
+
const calls = new Map(this.snapshot.calls);
|
|
10696
|
+
if (frame.type === "update") calls.set(frame.call.callId, frame.call);
|
|
10697
|
+
else calls.delete(frame.callId);
|
|
10698
|
+
this.publish({ sessionId: this.sessionId, status: "live", admissionEpoch, calls });
|
|
10699
|
+
}
|
|
10700
|
+
} catch (error) {
|
|
10701
|
+
if (this.revision === revision2 && this.stream === stream) this.invalidate("unavailable", observationIssue(error));
|
|
10702
|
+
} finally {
|
|
10703
|
+
if (this.revision === revision2 && this.stream === stream) {
|
|
10704
|
+
this.stream = void 0;
|
|
10705
|
+
if (this.hint > this.consumedHint) this.start();
|
|
10706
|
+
}
|
|
10707
|
+
}
|
|
10708
|
+
}
|
|
10709
|
+
invalidate(status, issue) {
|
|
10710
|
+
const calls = new Map([...this.snapshot.calls].map(([callId, call]) => [callId, call.phase === "settled" ? call : Object.freeze({
|
|
10711
|
+
...call,
|
|
10712
|
+
actualRoute: Object.freeze({ status: "unknown", reason: "not-observed" })
|
|
10713
|
+
})]));
|
|
10714
|
+
this.publish({ ...this.snapshot, status, issue, calls });
|
|
10715
|
+
}
|
|
10716
|
+
publish(snapshot4) {
|
|
10717
|
+
this.snapshot = snapshot4;
|
|
10718
|
+
for (const listener of this.listeners) listener();
|
|
10719
|
+
}
|
|
10720
|
+
};
|
|
10721
|
+
|
|
10347
10722
|
// src/client/profile-blank.ts
|
|
10348
10723
|
function profileBlankNative(services) {
|
|
10349
10724
|
const list = services.workspaces.list;
|
|
@@ -10985,7 +11360,9 @@ function ChildrenPanel(props) {
|
|
|
10985
11360
|
// src/client/index.ts
|
|
10986
11361
|
var inject = ["slots", "locale", "remote"];
|
|
10987
11362
|
async function apply(ctx) {
|
|
10988
|
-
|
|
11363
|
+
const roleCalls = new RoleCallObservationController();
|
|
11364
|
+
registerRoleToolViews(ctx, roleCalls);
|
|
11365
|
+
ctx.effect(() => () => roleCalls.dispose(), "dsmm: role call observations");
|
|
10989
11366
|
await ctx.remote.$mount(TYPERT_REMOTE);
|
|
10990
11367
|
await ctx.remote.$mount(ROLE_CONTROL_REMOTE);
|
|
10991
11368
|
await ctx.remote.$mount(PERMISSION_REMOTE);
|
|
@@ -11002,6 +11379,34 @@ async function apply(ctx) {
|
|
|
11002
11379
|
connectionCtx.effect(() => handle.generation.subscribe(update));
|
|
11003
11380
|
connectionCtx.effect(() => () => permissions.bindConnection(null), "dsmm: permission connection withdrawal");
|
|
11004
11381
|
});
|
|
11382
|
+
void ctx.inject(["connection", "remote.dsmmChildren"], (connectionCtx) => {
|
|
11383
|
+
const handle = connectionCtx.connection;
|
|
11384
|
+
let active = true, observedGeneration;
|
|
11385
|
+
let unbindRoleCalls, stopReady;
|
|
11386
|
+
const update = () => {
|
|
11387
|
+
if (!active) return;
|
|
11388
|
+
const generation = handle.generation.getSnapshot();
|
|
11389
|
+
if (generation === observedGeneration) return;
|
|
11390
|
+
stopReady?.();
|
|
11391
|
+
unbindRoleCalls?.();
|
|
11392
|
+
stopReady = void 0;
|
|
11393
|
+
unbindRoleCalls = void 0;
|
|
11394
|
+
observedGeneration = generation;
|
|
11395
|
+
if (generation === void 0) return;
|
|
11396
|
+
unbindRoleCalls = roleCalls.bindConnection(connectionCtx.remote, (sessionId2, signal) => connectionCtx.remote.dsmmChildren.observe(sessionId2, signal));
|
|
11397
|
+
stopReady = connectionCtx.remote.$on("api-session/added", (summary) => {
|
|
11398
|
+
if (!active || observedGeneration !== generation || handle.generation.getSnapshot() !== generation) return;
|
|
11399
|
+
roleCalls.observeSessionAvailability(summary.sessionId, summary.agentAvailable);
|
|
11400
|
+
});
|
|
11401
|
+
};
|
|
11402
|
+
update();
|
|
11403
|
+
connectionCtx.effect(() => handle.generation.subscribe(update));
|
|
11404
|
+
connectionCtx.effect(() => () => {
|
|
11405
|
+
active = false;
|
|
11406
|
+
stopReady?.();
|
|
11407
|
+
unbindRoleCalls?.();
|
|
11408
|
+
}, "dsmm: role call connection withdrawal");
|
|
11409
|
+
});
|
|
11005
11410
|
void ctx.inject(["uiSession", "sessions"], (sessionCtx) => {
|
|
11006
11411
|
const source = sessionCtx.uiSession.adapter.current, sessions = sessionCtx.sessions;
|
|
11007
11412
|
sessionCtx.effect(() => bindPermissionSession(source, sessions, permissions), "dsmm: permission native session withdrawal");
|