@huanlin/dsh-plugin-yet-another-subagent 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/lib/client.js +10 -10
- package/lib/index.js +17 -2042
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- 单一 `subagent` 工具,通过 `profile` 枚举参数选择 profile(非每 profile 一个工具)
|
|
11
11
|
- 复用官方 `spawn` provider,支持前台(foreground)和后台(continuable / one-shot)两种模式
|
|
12
12
|
- Profile 状态通过 settings seam 持久化到 `$DSH_HOME/settings.yaml`
|
|
13
|
-
- RPC CRUD:`
|
|
13
|
+
- RPC CRUD:`profiles.list` / `.add` / `.update` / `.remove`(专用 `/ya-subagent` 通道,不共享 `/api`)
|
|
14
14
|
- 两个 session projection:`subagentProfile`(父会话 childId→profileId 映射 + callId→childId)+ `yaSubagentProgress`(子会话实时 toolcall/token/活动状态)
|
|
15
15
|
- **Client 半**(`src/client/index.ts`):
|
|
16
16
|
- `settings.section` — Profile 编辑页
|
|
@@ -107,16 +107,17 @@ Profile 状态通过 DSH settings seam 持久化到 `$DSH_HOME/settings.yaml`
|
|
|
107
107
|
|
|
108
108
|
## RPC API
|
|
109
109
|
|
|
110
|
-
Profile CRUD 走 host
|
|
110
|
+
Profile CRUD 走 host 的专用 `/ya-subagent` 通道(不共享 `/api`,避免与 Typert gateway 的单拦截器冲突):
|
|
111
111
|
|
|
112
112
|
| endpoint | payload | result (ok) |
|
|
113
113
|
|----------|---------|-------------|
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
114
|
+
| `profiles.list` | `{}` | `{ profiles: SubagentProfile[] }` |
|
|
115
|
+
| `profiles.add` | `{ profile: SubagentProfile }` | `{ profiles: SubagentProfile[] }` |
|
|
116
|
+
| `profiles.update` | `{ profile: SubagentProfile }` | `{ profiles: SubagentProfile[] }` |
|
|
117
|
+
| `profiles.remove` | `{ id: string }` | `{ profiles: SubagentProfile[] }` |
|
|
118
|
+
| `tools.list` | `{}` | `{ tools: { name, description }[] }` |
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
URL 形如 `POST /ya-subagent/profiles.list`。业务错误返回 `{ ok: false, error: { code: 'internal', message } }`。
|
|
120
121
|
|
|
121
122
|
## 已知限制
|
|
122
123
|
|
package/lib/client.js
CHANGED
|
@@ -604,11 +604,11 @@ window.__ModuleLoader__.load({
|
|
|
604
604
|
* The persona field is a radio (inherit deployment persona vs custom text);
|
|
605
605
|
* the textarea is shown only when custom. The tool filter is a select
|
|
606
606
|
* (none / allow / deny); a multi-select dropdown is shown only when allow or
|
|
607
|
-
* deny is picked, populated from `
|
|
607
|
+
* deny is picked, populated from `tools.list` (the host's current
|
|
608
608
|
* `ctx.tools.schemas()`).
|
|
609
609
|
*
|
|
610
|
-
* Pulls the profile list once on mount via `connection.rpc.call('/
|
|
611
|
-
* '
|
|
610
|
+
* Pulls the profile list once on mount via `connection.rpc.call('/ya-subagent',
|
|
611
|
+
* 'profiles.list')`, dispatches add/update/remove through the
|
|
612
612
|
* same RPC. The toolview slot is keyed by `subagent` and registered once at
|
|
613
613
|
* plugin load, so profile mutations do not need to re-register slots.
|
|
614
614
|
*
|
|
@@ -632,7 +632,7 @@ window.__ModuleLoader__.load({
|
|
|
632
632
|
};
|
|
633
633
|
}
|
|
634
634
|
async function callRpc(rpc, endpoint, payload) {
|
|
635
|
-
return rpc.call("/
|
|
635
|
+
return rpc.call("/ya-subagent", endpoint, payload);
|
|
636
636
|
}
|
|
637
637
|
/**
|
|
638
638
|
* Render the subagent profiles settings page.
|
|
@@ -656,8 +656,8 @@ window.__ModuleLoader__.load({
|
|
|
656
656
|
try {
|
|
657
657
|
const [list, toolsResult, modelsResult] = await Promise.all([
|
|
658
658
|
fetchProfiles(),
|
|
659
|
-
callRpc(rpc, "
|
|
660
|
-
|
|
659
|
+
callRpc(rpc, "tools.list", {}),
|
|
660
|
+
rpc.call("/api", "llm.models", {})
|
|
661
661
|
]);
|
|
662
662
|
setProfiles(list);
|
|
663
663
|
setDrafts(list.map((p) => ({ ...p })));
|
|
@@ -676,7 +676,7 @@ window.__ModuleLoader__.load({
|
|
|
676
676
|
}, [refresh]);
|
|
677
677
|
const addProfile = (0, react.useCallback)(async () => {
|
|
678
678
|
if (newDraft.id === "" || newDraft.label === "") return;
|
|
679
|
-
const result = await callRpc(rpc, "
|
|
679
|
+
const result = await callRpc(rpc, "profiles.add", { profile: newDraft });
|
|
680
680
|
if (result.ok) {
|
|
681
681
|
setProfiles(result.value.profiles);
|
|
682
682
|
setDrafts(result.value.profiles.map((p) => ({ ...p })));
|
|
@@ -690,14 +690,14 @@ window.__ModuleLoader__.load({
|
|
|
690
690
|
rpc
|
|
691
691
|
]);
|
|
692
692
|
const updateProfile = (0, react.useCallback)(async (draft) => {
|
|
693
|
-
const result = await callRpc(rpc, "
|
|
693
|
+
const result = await callRpc(rpc, "profiles.update", { profile: draft });
|
|
694
694
|
if (result.ok) {
|
|
695
695
|
setProfiles(result.value.profiles);
|
|
696
696
|
setDrafts(result.value.profiles.map((p) => ({ ...p })));
|
|
697
697
|
} else setError(result.error.message);
|
|
698
698
|
}, [rpc]);
|
|
699
699
|
const removeProfile = (0, react.useCallback)(async (id) => {
|
|
700
|
-
const result = await callRpc(rpc, "
|
|
700
|
+
const result = await callRpc(rpc, "profiles.remove", { id });
|
|
701
701
|
if (result.ok) {
|
|
702
702
|
setProfiles(result.value.profiles);
|
|
703
703
|
setDrafts(result.value.profiles.map((p) => ({ ...p })));
|
|
@@ -1380,7 +1380,7 @@ window.__ModuleLoader__.load({
|
|
|
1380
1380
|
for (const p of profiles) profileLabels.set(p.id, p.label);
|
|
1381
1381
|
};
|
|
1382
1382
|
const fetchProfilesInternal = async () => {
|
|
1383
|
-
const result = await connection.rpc.call("/
|
|
1383
|
+
const result = await connection.rpc.call("/ya-subagent", "profiles.list", {});
|
|
1384
1384
|
return result.ok ? result.value.profiles : [];
|
|
1385
1385
|
};
|
|
1386
1386
|
fetchProfilesInternal().then(refreshProfileLabels).catch((error) => {
|