dsh-plugin-subagent-director 0.2.0 → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -21
- package/LICENSE +21 -21
- package/README.md +80 -74
- package/cordis.patch.yml +11 -11
- package/lib/bridge-contract.d.ts +21 -0
- package/lib/bridge-contract.d.ts.map +1 -1
- package/lib/bridge-contract.js +4 -0
- package/lib/bridge-contract.js.map +1 -1
- package/lib/bridge-entry.d.ts +5 -1
- package/lib/bridge-entry.d.ts.map +1 -1
- package/lib/bridge-entry.js +6 -2
- package/lib/bridge-entry.js.map +1 -1
- package/lib/client/RoleCard.js +2 -2
- package/lib/client/RoleCard.js.map +1 -1
- package/lib/client/SubagentCloseAction.d.ts +32 -0
- package/lib/client/SubagentCloseAction.d.ts.map +1 -0
- package/lib/client/SubagentCloseAction.js +99 -0
- package/lib/client/SubagentCloseAction.js.map +1 -0
- package/lib/client/SubagentModelDock.d.ts +19 -9
- package/lib/client/SubagentModelDock.d.ts.map +1 -1
- package/lib/client/SubagentModelDock.js +79 -4
- package/lib/client/SubagentModelDock.js.map +1 -1
- package/lib/client/SubagentOptionsSection.d.ts +1 -1
- package/lib/client/SubagentOptionsSection.d.ts.map +1 -1
- package/lib/client/SubagentOptionsSection.js +1 -1
- package/lib/client/SubagentOptionsSection.js.map +1 -1
- package/lib/client/bind.d.ts +14 -0
- package/lib/client/bind.d.ts.map +1 -0
- package/lib/client/bind.js +24 -0
- package/lib/client/bind.js.map +1 -0
- package/lib/client/index.d.ts +5 -0
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +262 -16
- package/lib/client/index.js.map +1 -1
- package/lib/client/locales.d.ts +1 -1
- package/lib/client/locales.d.ts.map +1 -1
- package/lib/client/locales.js +20 -2
- package/lib/client/locales.js.map +1 -1
- package/lib/client/subagent-model.d.ts +13 -0
- package/lib/client/subagent-model.d.ts.map +1 -1
- package/lib/client/subagent-model.js +20 -0
- package/lib/client/subagent-model.js.map +1 -1
- package/lib/close-tool.d.ts +29 -0
- package/lib/close-tool.d.ts.map +1 -0
- package/lib/close-tool.js +60 -0
- package/lib/close-tool.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/remote.d.ts +59 -3
- package/lib/remote.d.ts.map +1 -1
- package/lib/remote.js +148 -10
- package/lib/remote.js.map +1 -1
- package/lib/route-resolver.d.ts +7 -0
- package/lib/route-resolver.d.ts.map +1 -1
- package/lib/route-resolver.js +10 -1
- package/lib/route-resolver.js.map +1 -1
- package/lib/settings.d.ts.map +1 -1
- package/lib/settings.js +10 -2
- package/lib/settings.js.map +1 -1
- package/package.json +113 -114
package/lib/client/index.js
CHANGED
|
@@ -4,10 +4,33 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let _deepseek_ai_dsh_client_web_react = require("@deepseek-ai/dsh-client-web-react");
|
|
8
|
-
let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
9
7
|
let react = require("react");
|
|
8
|
+
let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
10
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/client/bind.ts
|
|
11
|
+
/**
|
|
12
|
+
* uSES bridge: turns any bare observable snapshot source into a selector hook.
|
|
13
|
+
*
|
|
14
|
+
* DSH rc8 removed the `@deepseek-ai/dsh-client-web-react` package (its client
|
|
15
|
+
* store-binding helpers were folded into the core slot kit). This is a local
|
|
16
|
+
* copy of the same `bindSnapshotSelector` contract, implemented against the
|
|
17
|
+
* `react` seed provided by the DSH client module table, so the plugin keeps
|
|
18
|
+
* working on rc8+ without an extra runtime dependency.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Bind a bare observable source (subscribe/getSnapshot) to a selector hook.
|
|
22
|
+
* The selector is applied to the snapshot on every render; identity stores can
|
|
23
|
+
* simply pass `(s) => s`.
|
|
24
|
+
*/
|
|
25
|
+
function bindSnapshotSelector(store) {
|
|
26
|
+
const subscribe = (listener) => store.subscribe(listener);
|
|
27
|
+
const getSnapshot = () => store.getSnapshot();
|
|
28
|
+
return function useSelector(selector) {
|
|
29
|
+
const select = selector ?? ((state) => state);
|
|
30
|
+
return (0, react.useSyncExternalStore)(subscribe, () => select(getSnapshot()));
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
11
34
|
//#region src/client/locales.ts
|
|
12
35
|
/** English dictionary ($subagentDirector). */
|
|
13
36
|
const en = {
|
|
@@ -45,6 +68,8 @@ window.__ModuleLoader__.load({
|
|
|
45
68
|
"readonly": "Settings are read-only in this deployment.",
|
|
46
69
|
"save": "Save",
|
|
47
70
|
"cancel": "Cancel",
|
|
71
|
+
"edit": "Edit",
|
|
72
|
+
"retry": "Retry",
|
|
48
73
|
"fallbackOnInvalid": "Fall back to the parent agent when a role-bound model is invalid",
|
|
49
74
|
"roleIdPlaceholder": "e.g. code-reviewer",
|
|
50
75
|
"displayNamePlaceholder": "e.g. Code Reviewer",
|
|
@@ -57,7 +82,14 @@ window.__ModuleLoader__.load({
|
|
|
57
82
|
"bridgeUnavailable": "The Subagent Director settings bridge is not available on this server. Please update/restart the web application so it installs the /subagent-director channel.",
|
|
58
83
|
"modelRanOn": "Subagent ran on",
|
|
59
84
|
"modelNotRecorded": "Subagent model not recorded yet",
|
|
60
|
-
"
|
|
85
|
+
"modelQueryFailed": "Subagent model unavailable",
|
|
86
|
+
"modelRanOnTitle": "Model route: {model}",
|
|
87
|
+
"closeContinuable": "Release subagent",
|
|
88
|
+
"closeContinuableTitle": "Release this continuable subagent (free its resident handle)",
|
|
89
|
+
"closingContinuable": "Releasing…",
|
|
90
|
+
"closedSubagent": "Released",
|
|
91
|
+
"confirmCloseContinuable": "Release continuable subagent “{id}”? It will stop being resident; you can no longer continue it with send_message.",
|
|
92
|
+
"closeFailed": "Release failed: {message}"
|
|
61
93
|
};
|
|
62
94
|
/** Chinese dictionary. */
|
|
63
95
|
const zh = {
|
|
@@ -95,6 +127,8 @@ window.__ModuleLoader__.load({
|
|
|
95
127
|
"readonly": "当前部署中设置为只读。",
|
|
96
128
|
"save": "保存",
|
|
97
129
|
"cancel": "取消",
|
|
130
|
+
"edit": "编辑",
|
|
131
|
+
"retry": "重试",
|
|
98
132
|
"fallbackOnInvalid": "当角色绑定的模型无效时回退到父代理",
|
|
99
133
|
"roleIdPlaceholder": "例如 code-reviewer",
|
|
100
134
|
"displayNamePlaceholder": "例如 代码审查员",
|
|
@@ -107,7 +141,14 @@ window.__ModuleLoader__.load({
|
|
|
107
141
|
"bridgeUnavailable": "此服务器尚未提供 Subagent Director 设置桥接通道(/subagent-director)。请重启 Web 应用以安装该通道后再试。",
|
|
108
142
|
"modelRanOn": "子代理实际运行于",
|
|
109
143
|
"modelNotRecorded": "尚未记录到子代理模型",
|
|
110
|
-
"
|
|
144
|
+
"modelQueryFailed": "暂时无法获取子代理模型",
|
|
145
|
+
"modelRanOnTitle": "模型路由:{model}",
|
|
146
|
+
"closeContinuable": "终止可持续状态",
|
|
147
|
+
"closeContinuableTitle": "释放此可持续子代理(解除驻留句柄)",
|
|
148
|
+
"closingContinuable": "正在终止…",
|
|
149
|
+
"closedSubagent": "已终止",
|
|
150
|
+
"confirmCloseContinuable": "终止可持续子代理“{id}”?终止后将不再驻留,无法再用 send_message 继续它。",
|
|
151
|
+
"closeFailed": "终止失败:{message}"
|
|
111
152
|
};
|
|
112
153
|
//#endregion
|
|
113
154
|
//#region src/bridge-contract.ts
|
|
@@ -117,6 +158,10 @@ window.__ModuleLoader__.load({
|
|
|
117
158
|
const SUBAGENT_DIRECTOR_RPC_VIEW = "settingsView";
|
|
118
159
|
/** Endpoint that applies one path-op mutation. */
|
|
119
160
|
const SUBAGENT_DIRECTOR_RPC_MUTATE = "settingsMutate";
|
|
161
|
+
/** Endpoint that releases one resident continuable child of a live parent. */
|
|
162
|
+
const SUBAGENT_DIRECTOR_RPC_CLOSE = "subagentClose";
|
|
163
|
+
/** Endpoint that returns the actual provider/model of one child session. */
|
|
164
|
+
const SUBAGENT_DIRECTOR_RPC_MODEL = "subagentModel";
|
|
120
165
|
//#endregion
|
|
121
166
|
//#region src/client/store-logic.ts
|
|
122
167
|
/** Path of the roles map from the section root. */
|
|
@@ -772,7 +817,7 @@ window.__ModuleLoader__.load({
|
|
|
772
817
|
style: primaryButtonStyle,
|
|
773
818
|
disabled: busy,
|
|
774
819
|
onClick: save,
|
|
775
|
-
children: "
|
|
820
|
+
children: t("save")
|
|
776
821
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
777
822
|
style: ghostButtonStyle,
|
|
778
823
|
disabled: busy,
|
|
@@ -871,7 +916,7 @@ window.__ModuleLoader__.load({
|
|
|
871
916
|
style: ghostButtonStyle,
|
|
872
917
|
disabled: busy,
|
|
873
918
|
onClick: () => setEditing(true),
|
|
874
|
-
children: t("
|
|
919
|
+
children: t("edit")
|
|
875
920
|
}),
|
|
876
921
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
877
922
|
style: ghostButtonStyle,
|
|
@@ -961,7 +1006,7 @@ window.__ModuleLoader__.load({
|
|
|
961
1006
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
962
1007
|
style: ghostButtonStyle,
|
|
963
1008
|
onClick: () => void controller.load(),
|
|
964
|
-
children: t("
|
|
1009
|
+
children: t("retry")
|
|
965
1010
|
})]
|
|
966
1011
|
});
|
|
967
1012
|
if (state.status !== "ready") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -1424,10 +1469,48 @@ window.__ModuleLoader__.load({
|
|
|
1424
1469
|
function formatModelRef(ref) {
|
|
1425
1470
|
return `${ref.provider}/${ref.model}`;
|
|
1426
1471
|
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Whether this session is a continuable child (the surface where the
|
|
1474
|
+
* "release sustained state" control is meaningful). Reads the catalog
|
|
1475
|
+
* address's mode; ordinary sessions and one-shot children are false.
|
|
1476
|
+
*/
|
|
1477
|
+
function isContinuableChild(snapshot) {
|
|
1478
|
+
if (snapshot === null || snapshot === void 0) return false;
|
|
1479
|
+
const address = snapshot.subagent?.address;
|
|
1480
|
+
return address !== void 0 && address !== null && address.mode === "continuable";
|
|
1481
|
+
}
|
|
1482
|
+
/**
|
|
1483
|
+
* Merge a local snapshot-derived lookup with a remote (RPC) lookup: the local
|
|
1484
|
+
* provenance wins when present (the runtime's own record), otherwise the
|
|
1485
|
+
* remote result decides. Kept pure so the dock's data-source preference is
|
|
1486
|
+
* unit-testable without a wire.
|
|
1487
|
+
*/
|
|
1488
|
+
function mergeModelLookup(local, remote) {
|
|
1489
|
+
return local.found ? local : remote;
|
|
1490
|
+
}
|
|
1427
1491
|
//#endregion
|
|
1428
1492
|
//#region src/client/SubagentModelDock.tsx
|
|
1493
|
+
/**
|
|
1494
|
+
* Subagent Director — M3b observability dock readout.
|
|
1495
|
+
*
|
|
1496
|
+
* Contributes a single ambient line to the `conversation.composer.dock` seat
|
|
1497
|
+
* (the band under the composer card). When the current session is an
|
|
1498
|
+
* addressed subagent child it shows the provider/model that child actually
|
|
1499
|
+
* ran on:
|
|
1500
|
+
* - fast path: the opened transcript's latest assistant message already
|
|
1501
|
+
* records provenance/requestConfig (zero extra RPC — see subagent-model.ts);
|
|
1502
|
+
* - fallback: current DSH runtimes do not populate those fields, so the
|
|
1503
|
+
* dock asks the Host bridge for the child's last `request/header` event
|
|
1504
|
+
* (`subagentModel` endpoint) and caches the answer per child session.
|
|
1505
|
+
* When neither source proves a model it degrades to a short notice. Ordinary
|
|
1506
|
+
* sessions render nothing, so the dock stays clean.
|
|
1507
|
+
*
|
|
1508
|
+
* The dock is an additive list slot declared by ui-conversation at runtime;
|
|
1509
|
+
* we only contribute an occupant, never re-declare it. Our compile-time
|
|
1510
|
+
* SlotMap augmentation in index.ts narrows the registration typing.
|
|
1511
|
+
*/
|
|
1429
1512
|
/** Inline styling using the shared token surface (no CSS pipeline; M2 deviation). */
|
|
1430
|
-
const style = {
|
|
1513
|
+
const style$1 = {
|
|
1431
1514
|
root: {
|
|
1432
1515
|
display: "flex",
|
|
1433
1516
|
alignItems: "center",
|
|
@@ -1443,26 +1526,179 @@ window.__ModuleLoader__.load({
|
|
|
1443
1526
|
}
|
|
1444
1527
|
};
|
|
1445
1528
|
/** Render the provider/model readout for an addressed subagent, or nothing. */
|
|
1446
|
-
function SubagentModelDock({ session, t }) {
|
|
1529
|
+
function SubagentModelDock({ session, rpc, t }) {
|
|
1530
|
+
const [query, setQuery] = (0, react.useState)({ status: "idle" });
|
|
1531
|
+
const cache = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
1532
|
+
const local = latestSubagentModel(session);
|
|
1533
|
+
const childSessionId = session?.subagent?.address?.childSessionId;
|
|
1534
|
+
const lastSeq = session && Array.isArray(session.nodes) && session.nodes.length > 0 ? session.nodes[session.nodes.length - 1].seq ?? 0 : 0;
|
|
1535
|
+
(0, react.useEffect)(() => {
|
|
1536
|
+
if (!isAddressedSubagent(session)) {
|
|
1537
|
+
setQuery({ status: "idle" });
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
if (local.found || childSessionId === void 0) return;
|
|
1541
|
+
const cached = cache.current.get(childSessionId);
|
|
1542
|
+
if (cached !== void 0) {
|
|
1543
|
+
setQuery(cached);
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
let alive = true;
|
|
1547
|
+
setQuery({ status: "querying" });
|
|
1548
|
+
rpc.call(SUBAGENT_DIRECTOR_RPC_CHANNEL, SUBAGENT_DIRECTOR_RPC_MODEL, { sessionId: childSessionId }).then((result) => {
|
|
1549
|
+
if (!alive) return;
|
|
1550
|
+
let next;
|
|
1551
|
+
if (result.ok) {
|
|
1552
|
+
const value = result.value;
|
|
1553
|
+
next = value.found === true ? {
|
|
1554
|
+
status: "found",
|
|
1555
|
+
ref: {
|
|
1556
|
+
found: true,
|
|
1557
|
+
provider: value.provider,
|
|
1558
|
+
model: value.model
|
|
1559
|
+
}
|
|
1560
|
+
} : { status: "missing" };
|
|
1561
|
+
} else next = { status: "failed" };
|
|
1562
|
+
cache.current.set(childSessionId, next);
|
|
1563
|
+
setQuery(next);
|
|
1564
|
+
}).catch(() => {
|
|
1565
|
+
if (!alive) return;
|
|
1566
|
+
const next = { status: "failed" };
|
|
1567
|
+
cache.current.set(childSessionId, next);
|
|
1568
|
+
setQuery(next);
|
|
1569
|
+
});
|
|
1570
|
+
return () => {
|
|
1571
|
+
alive = false;
|
|
1572
|
+
};
|
|
1573
|
+
}, [
|
|
1574
|
+
session?.sessionId,
|
|
1575
|
+
childSessionId,
|
|
1576
|
+
lastSeq,
|
|
1577
|
+
local.found,
|
|
1578
|
+
rpc
|
|
1579
|
+
]);
|
|
1447
1580
|
if (!isAddressedSubagent(session)) return null;
|
|
1448
|
-
const lookup =
|
|
1581
|
+
const lookup = mergeModelLookup(local, query.status === "found" ? query.ref : { found: false });
|
|
1449
1582
|
if (!lookup.found) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1450
|
-
style: style.root,
|
|
1583
|
+
style: style$1.root,
|
|
1451
1584
|
role: "status",
|
|
1452
|
-
children: t("modelNotRecorded")
|
|
1585
|
+
children: query.status === "failed" ? t("modelQueryFailed") : t("modelNotRecorded")
|
|
1453
1586
|
});
|
|
1454
1587
|
const ref = lookup;
|
|
1455
1588
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1456
|
-
style: style.root,
|
|
1589
|
+
style: style$1.root,
|
|
1457
1590
|
role: "status",
|
|
1458
1591
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("modelRanOn") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1459
|
-
style: style.ref,
|
|
1592
|
+
style: style$1.ref,
|
|
1460
1593
|
title: t("modelRanOnTitle", { model: formatModelRef(ref) }),
|
|
1461
1594
|
children: formatModelRef(ref)
|
|
1462
1595
|
})]
|
|
1463
1596
|
});
|
|
1464
1597
|
}
|
|
1465
1598
|
//#endregion
|
|
1599
|
+
//#region src/client/SubagentCloseAction.tsx
|
|
1600
|
+
/**
|
|
1601
|
+
* Subagent Director — "release sustained state" header action (issue #1).
|
|
1602
|
+
*
|
|
1603
|
+
* Contributes one button to the `conversation.session.header.actions` seat
|
|
1604
|
+
* (the additive per-session control row beside the session title). It renders
|
|
1605
|
+
* only while the CURRENT session is a continuable subagent child
|
|
1606
|
+
* (snapshot.subagent.address.mode === 'continuable') and otherwise returns
|
|
1607
|
+
* null, so ordinary sessions and one-shot children see nothing.
|
|
1608
|
+
*
|
|
1609
|
+
* Clicking asks the Host bridge's `subagentClose` endpoint to
|
|
1610
|
+
* drainContinuableChildren under the address's durable parent authority; on
|
|
1611
|
+
* success the button turns into a settled label (the child's handle is
|
|
1612
|
+
* released), on failure a short inline error shows the core message.
|
|
1613
|
+
*
|
|
1614
|
+
* The seat is a list slot declared by ui-conversation; the framework session
|
|
1615
|
+
* standard kit supplies `useSession`/`sessionId` (dsh-client-runtime merge),
|
|
1616
|
+
* the registration injects the RPC caller.
|
|
1617
|
+
*/
|
|
1618
|
+
/** Inline styling using the shared token surface (no CSS pipeline; M2 deviation). */
|
|
1619
|
+
const style = {
|
|
1620
|
+
wrap: {
|
|
1621
|
+
display: "inline-flex",
|
|
1622
|
+
alignItems: "center",
|
|
1623
|
+
gap: 8
|
|
1624
|
+
},
|
|
1625
|
+
button: {
|
|
1626
|
+
...dangerButtonStyle,
|
|
1627
|
+
height: 24,
|
|
1628
|
+
fontSize: 12,
|
|
1629
|
+
padding: "0 10px"
|
|
1630
|
+
},
|
|
1631
|
+
settled: {
|
|
1632
|
+
color: token.labelTertiary,
|
|
1633
|
+
fontSize: 12,
|
|
1634
|
+
lineHeight: "16px"
|
|
1635
|
+
},
|
|
1636
|
+
error: {
|
|
1637
|
+
color: token.danger,
|
|
1638
|
+
fontSize: 12,
|
|
1639
|
+
lineHeight: "16px",
|
|
1640
|
+
maxWidth: 260,
|
|
1641
|
+
overflow: "hidden",
|
|
1642
|
+
textOverflow: "ellipsis",
|
|
1643
|
+
whiteSpace: "nowrap"
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
/** Render the release-sustained-state button for a continuable child, or nothing. */
|
|
1647
|
+
function SubagentCloseAction({ useSession, sessionId, rpc, t }) {
|
|
1648
|
+
const session = useSession((s) => s);
|
|
1649
|
+
const [state, setState] = (0, react.useState)("idle");
|
|
1650
|
+
const [error, setError] = (0, react.useState)(null);
|
|
1651
|
+
(0, react.useEffect)(() => {
|
|
1652
|
+
setState("idle");
|
|
1653
|
+
setError(null);
|
|
1654
|
+
}, [sessionId]);
|
|
1655
|
+
if (!isContinuableChild(session)) return null;
|
|
1656
|
+
const address = session.subagent.address;
|
|
1657
|
+
const onClose = async () => {
|
|
1658
|
+
if (state === "closing") return;
|
|
1659
|
+
setState("closing");
|
|
1660
|
+
setError(null);
|
|
1661
|
+
try {
|
|
1662
|
+
const result = await rpc.call(SUBAGENT_DIRECTOR_RPC_CHANNEL, SUBAGENT_DIRECTOR_RPC_CLOSE, {
|
|
1663
|
+
parentSessionId: address.parentSessionId,
|
|
1664
|
+
childSessionId: address.childSessionId
|
|
1665
|
+
});
|
|
1666
|
+
if (result.ok) setState("closed");
|
|
1667
|
+
else {
|
|
1668
|
+
setState("failed");
|
|
1669
|
+
setError(result.error.message);
|
|
1670
|
+
}
|
|
1671
|
+
} catch {
|
|
1672
|
+
setState("failed");
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
if (state === "closed") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1676
|
+
style: style.wrap,
|
|
1677
|
+
role: "status",
|
|
1678
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1679
|
+
style: style.settled,
|
|
1680
|
+
children: t("closedSubagent")
|
|
1681
|
+
})
|
|
1682
|
+
});
|
|
1683
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1684
|
+
style: style.wrap,
|
|
1685
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1686
|
+
type: "button",
|
|
1687
|
+
style: style.button,
|
|
1688
|
+
disabled: state === "closing",
|
|
1689
|
+
onClick: () => {
|
|
1690
|
+
if (typeof window === "undefined" || window.confirm(t("confirmCloseContinuable", { id: address.childSessionId }))) onClose();
|
|
1691
|
+
},
|
|
1692
|
+
title: t("closeContinuableTitle", { id: address.childSessionId }),
|
|
1693
|
+
children: state === "closing" ? t("closingContinuable") : t("closeContinuable")
|
|
1694
|
+
}), state === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1695
|
+
style: style.error,
|
|
1696
|
+
role: "alert",
|
|
1697
|
+
children: t("closeFailed", { message: error ?? "" })
|
|
1698
|
+
})]
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
//#endregion
|
|
1466
1702
|
//#region src/client/index.ts
|
|
1467
1703
|
/** Dictionary namespace owned by Subagent Director (bilingual, typed). */
|
|
1468
1704
|
const NS = "settings.subagentDirector";
|
|
@@ -1495,13 +1731,15 @@ window.__ModuleLoader__.load({
|
|
|
1495
1731
|
llm: connection.api.llm,
|
|
1496
1732
|
t
|
|
1497
1733
|
});
|
|
1498
|
-
const useSnapshot =
|
|
1734
|
+
const useSnapshot = bindSnapshotSelector(controller.store);
|
|
1499
1735
|
const injected = () => ({
|
|
1500
1736
|
controller,
|
|
1501
1737
|
useSnapshot,
|
|
1502
1738
|
api: connection.api,
|
|
1503
1739
|
t
|
|
1504
1740
|
});
|
|
1741
|
+
const dockInjected = () => ({ rpc: connection.rpc });
|
|
1742
|
+
const closeInjected = () => ({ rpc: connection.rpc });
|
|
1505
1743
|
ctx.effect(() => {
|
|
1506
1744
|
const refresh = () => refreshIfLoaded(controller);
|
|
1507
1745
|
const disposers = [
|
|
@@ -1525,8 +1763,16 @@ window.__ModuleLoader__.load({
|
|
|
1525
1763
|
name: "conversation.composer.dock",
|
|
1526
1764
|
id: "subagent-director-model",
|
|
1527
1765
|
order: 90,
|
|
1528
|
-
locale: NS
|
|
1766
|
+
locale: NS,
|
|
1767
|
+
inject: dockInjected
|
|
1529
1768
|
}, SubagentModelDock));
|
|
1769
|
+
ctx.slots.inject("conversation.session.header.actions", () => ctx.slots.register({
|
|
1770
|
+
name: "conversation.session.header.actions",
|
|
1771
|
+
id: "subagent-director-close",
|
|
1772
|
+
order: 20,
|
|
1773
|
+
locale: NS,
|
|
1774
|
+
inject: closeInjected
|
|
1775
|
+
}, SubagentCloseAction));
|
|
1530
1776
|
}
|
|
1531
1777
|
//#endregion
|
|
1532
1778
|
exports.NS = NS;
|
package/lib/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,EAAE,EAA4B,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAA6B,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAkC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAoC,MAAM,0BAA0B,CAAC;AAEjG,0EAA0E;AAC1E,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QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,YAAY;KACrB,EACD,iBAAiB,CAClB,CACF,CAAC;IAEF,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAC3D,GAAG,CAAC,KAAK,CAAC,QAAQ,CAChB;QACE,IAAI,EAAE,qCAAqC;QAC3C,EAAE,EAAE,yBAAyB;QAC7B,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,aAAa;KACtB,EACD,mBAAmB,CACpB,CACF,CAAC;AACJ,CAAC"}
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ever reaches the runtime's bilingual balance check.
|
|
6
6
|
*/
|
|
7
7
|
/** Keys for the settings.subagentDirector namespace (bilingual, enforced). */
|
|
8
|
-
export type SubagentDirectorKey = 'nav' | 'sectionIntro' | 'defaultsHeading' | 'defaultsHint' | 'defaultProvider' | 'defaultModel' | 'defaultReasoningEffort' | 'restoreDefaults' | 'provider' | 'model' | 'reasoningEffort' | 'persona' | 'rolesHeading' | 'rolesHint' | 'addRole' | 'emptyRoles' | 'roleId' | 'roleDisplayName' | 'roleDescription' | 'rolePersona' | 'setDefaultRole' | 'defaultRoleBadge' | 'deleteRole' | 'confirmDeleteRole' | 'removeRoleDone' | 'addedRole' | 'roleUpdated' | 'conflict' | 'rejected' | 'fatal' | 'loadError' | 'readonly' | 'save' | 'cancel' | 'fallbackOnInvalid' | 'roleIdPlaceholder' | 'displayNamePlaceholder' | 'descriptionPlaceholder' | 'personaPlaceholder' | 'modelOptional' | 'providerMissing' | 'restoreDone' | 'invalidRoleId' | 'bridgeUnavailable' | 'modelRanOn' | 'modelNotRecorded' | 'modelRanOnTitle';
|
|
8
|
+
export type SubagentDirectorKey = 'nav' | 'sectionIntro' | 'defaultsHeading' | 'defaultsHint' | 'defaultProvider' | 'defaultModel' | 'defaultReasoningEffort' | 'restoreDefaults' | 'provider' | 'model' | 'reasoningEffort' | 'persona' | 'rolesHeading' | 'rolesHint' | 'addRole' | 'emptyRoles' | 'roleId' | 'roleDisplayName' | 'roleDescription' | 'rolePersona' | 'setDefaultRole' | 'defaultRoleBadge' | 'deleteRole' | 'confirmDeleteRole' | 'removeRoleDone' | 'addedRole' | 'roleUpdated' | 'conflict' | 'rejected' | 'fatal' | 'loadError' | 'readonly' | 'save' | 'cancel' | 'edit' | 'retry' | 'fallbackOnInvalid' | 'roleIdPlaceholder' | 'displayNamePlaceholder' | 'descriptionPlaceholder' | 'personaPlaceholder' | 'modelOptional' | 'providerMissing' | 'restoreDone' | 'invalidRoleId' | 'bridgeUnavailable' | 'modelRanOn' | 'modelNotRecorded' | 'modelQueryFailed' | 'modelRanOnTitle' | 'closeContinuable' | 'closeContinuableTitle' | 'closingContinuable' | 'closedSubagent' | 'confirmCloseContinuable' | 'closeFailed';
|
|
9
9
|
/** English dictionary ($subagentDirector). */
|
|
10
10
|
export declare const en: Record<SubagentDirectorKey, string>;
|
|
11
11
|
/** Chinese dictionary. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,wBAAwB,GACxB,iBAAiB,GACjB,UAAU,GACV,OAAO,GACP,iBAAiB,GACjB,SAAS,GACT,cAAc,GACd,WAAW,GACX,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,YAAY,GACZ,mBAAmB,GACnB,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,UAAU,GACV,UAAU,GACV,OAAO,GACP,WAAW,GACX,UAAU,GACV,MAAM,GACN,QAAQ,GACR,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,GACxB,wBAAwB,GACxB,oBAAoB,GACpB,eAAe,GACf,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,mBAAmB,GACnB,YAAY,GACZ,kBAAkB,GAClB,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,wBAAwB,GACxB,iBAAiB,GACjB,UAAU,GACV,OAAO,GACP,iBAAiB,GACjB,SAAS,GACT,cAAc,GACd,WAAW,GACX,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,YAAY,GACZ,mBAAmB,GACnB,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,UAAU,GACV,UAAU,GACV,OAAO,GACP,WAAW,GACX,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,GACxB,wBAAwB,GACxB,oBAAoB,GACpB,eAAe,GACf,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,mBAAmB,GACnB,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,uBAAuB,GACvB,oBAAoB,GACpB,gBAAgB,GAChB,yBAAyB,GACzB,aAAa,CAAC;AAElB,8CAA8C;AAC9C,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAyDlD,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAyDlD,CAAC"}
|
package/lib/client/locales.js
CHANGED
|
@@ -40,6 +40,8 @@ export const en = {
|
|
|
40
40
|
"readonly": "Settings are read-only in this deployment.",
|
|
41
41
|
"save": "Save",
|
|
42
42
|
"cancel": "Cancel",
|
|
43
|
+
"edit": "Edit",
|
|
44
|
+
"retry": "Retry",
|
|
43
45
|
"fallbackOnInvalid": "Fall back to the parent agent when a role-bound model is invalid",
|
|
44
46
|
"roleIdPlaceholder": "e.g. code-reviewer",
|
|
45
47
|
"displayNamePlaceholder": "e.g. Code Reviewer",
|
|
@@ -52,7 +54,14 @@ export const en = {
|
|
|
52
54
|
"bridgeUnavailable": "The Subagent Director settings bridge is not available on this server. Please update/restart the web application so it installs the /subagent-director channel.",
|
|
53
55
|
"modelRanOn": "Subagent ran on",
|
|
54
56
|
"modelNotRecorded": "Subagent model not recorded yet",
|
|
55
|
-
"
|
|
57
|
+
"modelQueryFailed": "Subagent model unavailable",
|
|
58
|
+
"modelRanOnTitle": "Model route: {model}",
|
|
59
|
+
"closeContinuable": "Release subagent",
|
|
60
|
+
"closeContinuableTitle": "Release this continuable subagent (free its resident handle)",
|
|
61
|
+
"closingContinuable": "Releasing…",
|
|
62
|
+
"closedSubagent": "Released",
|
|
63
|
+
"confirmCloseContinuable": "Release continuable subagent “{id}”? It will stop being resident; you can no longer continue it with send_message.",
|
|
64
|
+
"closeFailed": "Release failed: {message}"
|
|
56
65
|
};
|
|
57
66
|
/** Chinese dictionary. */
|
|
58
67
|
export const zh = {
|
|
@@ -90,6 +99,8 @@ export const zh = {
|
|
|
90
99
|
"readonly": "当前部署中设置为只读。",
|
|
91
100
|
"save": "保存",
|
|
92
101
|
"cancel": "取消",
|
|
102
|
+
"edit": "编辑",
|
|
103
|
+
"retry": "重试",
|
|
93
104
|
"fallbackOnInvalid": "当角色绑定的模型无效时回退到父代理",
|
|
94
105
|
"roleIdPlaceholder": "例如 code-reviewer",
|
|
95
106
|
"displayNamePlaceholder": "例如 代码审查员",
|
|
@@ -102,6 +113,13 @@ export const zh = {
|
|
|
102
113
|
"bridgeUnavailable": "此服务器尚未提供 Subagent Director 设置桥接通道(/subagent-director)。请重启 Web 应用以安装该通道后再试。",
|
|
103
114
|
"modelRanOn": "子代理实际运行于",
|
|
104
115
|
"modelNotRecorded": "尚未记录到子代理模型",
|
|
105
|
-
"
|
|
116
|
+
"modelQueryFailed": "暂时无法获取子代理模型",
|
|
117
|
+
"modelRanOnTitle": "模型路由:{model}",
|
|
118
|
+
"closeContinuable": "终止可持续状态",
|
|
119
|
+
"closeContinuableTitle": "释放此可持续子代理(解除驻留句柄)",
|
|
120
|
+
"closingContinuable": "正在终止…",
|
|
121
|
+
"closedSubagent": "已终止",
|
|
122
|
+
"confirmCloseContinuable": "终止可持续子代理“{id}”?终止后将不再驻留,无法再用 send_message 继续它。",
|
|
123
|
+
"closeFailed": "终止失败:{message}"
|
|
106
124
|
};
|
|
107
125
|
//# sourceMappingURL=locales.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6DH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,EAAE,GAAwC;IACrD,KAAK,EAAE,mBAAmB;IAC1B,cAAc,EAAE,gIAAgI;IAChJ,iBAAiB,EAAE,eAAe;IAClC,cAAc,EAAE,0DAA0D;IAC1E,iBAAiB,EAAE,UAAU;IAC7B,cAAc,EAAE,OAAO;IACvB,wBAAwB,EAAE,kBAAkB;IAC5C,iBAAiB,EAAE,kBAAkB;IACrC,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,OAAO;IAChB,iBAAiB,EAAE,kBAAkB;IACrC,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,6FAA6F;IAC1G,SAAS,EAAE,UAAU;IACrB,YAA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,kBAAkB,EAAE,SAAS;IAC7B,uBAAuB,EAAE,mBAAmB;IAC5C,oBAAoB,EAAE,OAAO;IAC7B,gBAAgB,EAAE,KAAK;IACvB,yBAAyB,EAAE,gDAAgD;IAC3E,aAAa,EAAE,gBAAgB;CAChC,CAAC"}
|
|
@@ -44,4 +44,17 @@ export declare function isAddressedSubagent(snapshot: Pick<ConversationSnapshot,
|
|
|
44
44
|
* so the exact route stays readable in one line.
|
|
45
45
|
*/
|
|
46
46
|
export declare function formatModelRef(ref: SubagentModelRef): string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether this session is a continuable child (the surface where the
|
|
49
|
+
* "release sustained state" control is meaningful). Reads the catalog
|
|
50
|
+
* address's mode; ordinary sessions and one-shot children are false.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isContinuableChild(snapshot: Pick<ConversationSnapshot, 'subagent'> | null | undefined): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Merge a local snapshot-derived lookup with a remote (RPC) lookup: the local
|
|
55
|
+
* provenance wins when present (the runtime's own record), otherwise the
|
|
56
|
+
* remote result decides. Kept pure so the dock's data-source preference is
|
|
57
|
+
* unit-testable without a wire.
|
|
58
|
+
*/
|
|
59
|
+
export declare function mergeModelLookup(local: SubagentModelLookup, remote: SubagentModelLookup): SubagentModelLookup;
|
|
47
60
|
//# sourceMappingURL=subagent-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-model.d.ts","sourceRoot":"","sources":["../../src/client/subagent-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAGpB,oBAAoB,EACrB,MAAM,wCAAwC,CAAC;AAEhD,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAA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E;AAC/E,wBAAgB,YAAY,CAC1B,SAAS,EAAE,oBAAoB,GAC9B,gBAAgB,GAAG,IAAI,CAwBzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GAAG,IAAI,GAAG,SAAS,GAClE,OAAO,CAIT;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GAAG,IAAI,GAAG,SAAS,GAClE,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAErB"}
|
|
@@ -78,4 +78,24 @@ export function isAddressedSubagent(snapshot) {
|
|
|
78
78
|
export function formatModelRef(ref) {
|
|
79
79
|
return `${ref.provider}/${ref.model}`;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Whether this session is a continuable child (the surface where the
|
|
83
|
+
* "release sustained state" control is meaningful). Reads the catalog
|
|
84
|
+
* address's mode; ordinary sessions and one-shot children are false.
|
|
85
|
+
*/
|
|
86
|
+
export function isContinuableChild(snapshot) {
|
|
87
|
+
if (snapshot === null || snapshot === undefined)
|
|
88
|
+
return false;
|
|
89
|
+
const address = snapshot.subagent?.address;
|
|
90
|
+
return address !== undefined && address !== null && address.mode === 'continuable';
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Merge a local snapshot-derived lookup with a remote (RPC) lookup: the local
|
|
94
|
+
* provenance wins when present (the runtime's own record), otherwise the
|
|
95
|
+
* remote result decides. Kept pure so the dock's data-source preference is
|
|
96
|
+
* unit-testable without a wire.
|
|
97
|
+
*/
|
|
98
|
+
export function mergeModelLookup(local, remote) {
|
|
99
|
+
return local.found ? local : remote;
|
|
100
|
+
}
|
|
81
101
|
//# sourceMappingURL=subagent-model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-model.js","sourceRoot":"","sources":["../../src/client/subagent-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAA6C;IAE7C,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IACD,MAAM,KAAK,GAA4C,QAAQ,CAAC,KAAK,CAAC;IACtE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,SAAS;QACxD,IAAK,IAA2B,CAAC,IAAI,KAAK,WAAW;YAAE,SAAS;QAChE,MAAM,SAAS,GAAG,IAA4B,CAAC;QAC/C,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,GAAG,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAC1B,SAA+B;IAE/B,MAAM,QAAQ,GAAwC,SAAS,CAAC,UAAU,CAAC;IAC3E,IACE,QAAQ,KAAK,IAAI;QACjB,OAAO,QAAQ,KAAK,Q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AO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,CAAC;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA0B,EAC1B,MAA2B;IAE3B,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* close_subagent — release one resident continuable subagent (issue #1).
|
|
3
|
+
*
|
|
4
|
+
* Model-facing counterpart of dsh-tool-subagent-control's send_message /
|
|
5
|
+
* interrupt_agent: the calling agent (exec.agent) authorizes release of its
|
|
6
|
+
* OWN direct continuable child through ctx.subagents.drainContinuableChildren,
|
|
7
|
+
* which throws UNAUTHORIZED when the target is not a direct child of the
|
|
8
|
+
* caller and treats absent/non-resident targets as a no-op. The tool is
|
|
9
|
+
* registered unconditionally (like the control tools); on a deployment
|
|
10
|
+
* without continuable children it is a safe no-op.
|
|
11
|
+
*/
|
|
12
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
13
|
+
import { type ParameterSchemaSpec, type ValueSchemaSpec } from '@deepseek-ai/dsh-tools';
|
|
14
|
+
/** Stable tool name (fixed, mirroring send_message / interrupt_agent). */
|
|
15
|
+
export declare const CLOSE_SUBAGENT_TOOL_NAME = "close_subagent";
|
|
16
|
+
/** Model-facing arguments of close_subagent. */
|
|
17
|
+
export interface CloseSubagentArgs {
|
|
18
|
+
/** Durable child id returned by a continuable delegation (subagent_role). */
|
|
19
|
+
subagent_id: string;
|
|
20
|
+
}
|
|
21
|
+
/** Parameter schema (pure, exposed for tests). */
|
|
22
|
+
export declare function createCloseSubagentParameters(): ParameterSchemaSpec;
|
|
23
|
+
/** Output schema (pure, exposed for tests). */
|
|
24
|
+
export declare function createCloseSubagentOutputSchema(): ValueSchemaSpec;
|
|
25
|
+
/** Create the close_subagent ToolDefinition bound to one context. */
|
|
26
|
+
export declare function createCloseSubagentTool(options: {
|
|
27
|
+
ctx: Context;
|
|
28
|
+
}): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
29
|
+
//# sourceMappingURL=close-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close-tool.d.ts","sourceRoot":"","sources":["../src/close-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAc,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGpG,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAIzD,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,kDAAkD;AAClD,wBAAgB,6BAA6B,IAAI,mBAAmB,CASnE;AAED,+CAA+C;AAC/C,wBAAgB,+BAA+B,IAAI,eAAe,CAQjE;AAED,qEAAqE;AACrE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,mDAkChE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
import { SessionId } from '@deepseek-ai/dsh-session';
|
|
3
|
+
/** Stable tool name (fixed, mirroring send_message / interrupt_agent). */
|
|
4
|
+
export const CLOSE_SUBAGENT_TOOL_NAME = 'close_subagent';
|
|
5
|
+
const ERROR_PREFIX = 'subagent-director:';
|
|
6
|
+
/** Parameter schema (pure, exposed for tests). */
|
|
7
|
+
export function createCloseSubagentParameters() {
|
|
8
|
+
return {
|
|
9
|
+
subagent_id: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true,
|
|
12
|
+
description: 'The durable subagent id returned when the background subagent was started (continuable mode). Releases the resident child so the parent no longer holds its handle.',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** Output schema (pure, exposed for tests). */
|
|
17
|
+
export function createCloseSubagentOutputSchema() {
|
|
18
|
+
return {
|
|
19
|
+
type: 'object',
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
properties: {
|
|
22
|
+
closed: { type: 'boolean', required: true },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Create the close_subagent ToolDefinition bound to one context. */
|
|
27
|
+
export function createCloseSubagentTool(options) {
|
|
28
|
+
const { ctx } = options;
|
|
29
|
+
return defineTool({
|
|
30
|
+
name: CLOSE_SUBAGENT_TOOL_NAME,
|
|
31
|
+
description: 'Close/release one resident continuable subagent by its durable id: the continuation manager stops holding its AgentHandle, freeing memory and session context. The target must be a direct child of the calling agent; a non-resident or already-finished target is an accepted no-op. Pairs with send_message (continue) and interrupt_agent (stop one turn) to complete the lifecycle.',
|
|
32
|
+
parameters: {
|
|
33
|
+
subagent_id: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
required: true,
|
|
36
|
+
description: 'The durable subagent id returned when the background subagent was started (continuable mode). Releases the resident child so the parent no longer holds its handle.',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
output: {
|
|
40
|
+
schema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
properties: {
|
|
44
|
+
closed: { type: 'boolean', required: true },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
render: (args, _value) => [{ type: 'text', text: `closed subagent ${args.subagent_id}` }],
|
|
48
|
+
},
|
|
49
|
+
isConcurrencySafe: () => true,
|
|
50
|
+
async execute(args, exec) {
|
|
51
|
+
const parent = exec.agent;
|
|
52
|
+
if (!parent) {
|
|
53
|
+
throw new Error(`${ERROR_PREFIX} close_subagent requires a calling agent (exec.agent was undefined)`);
|
|
54
|
+
}
|
|
55
|
+
await ctx.subagents.drainContinuableChildren(parent, [SessionId(args.subagent_id)]);
|
|
56
|
+
return { closed: true };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=close-tool.js.map
|