@sleep2agi/dsh-anet 0.1.0-preview.28 → 0.1.0-preview.30
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/package.json +1 -1
- package/src/client.js +29 -6
- package/src/plugin.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/dsh-anet",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.30",
|
|
4
4
|
"description": "DSH (DeepSeek Harness) plugin: expose one or more DSH sessions as Agent Network (anet.sh / CommHub) nodes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/plugin.mjs",
|
package/src/client.js
CHANGED
|
@@ -88,6 +88,17 @@ window.__ModuleLoader__.load({
|
|
|
88
88
|
return `${title} · ${sessionWhen(session.createdAt)} · ${baseName(session.cwd)}`;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
function AnetMark(props) {
|
|
92
|
+
const size = props.size ?? 20;
|
|
93
|
+
return h("svg", { width: size, height: size, viewBox: "0 0 64 64", "aria-hidden": "true", style: { display: "block", flex: "none" } },
|
|
94
|
+
h("rect", { width: 64, height: 64, rx: 14, fill: "#0f172a" }),
|
|
95
|
+
h("circle", { cx: 20, cy: 22, r: 6, fill: "#38bdf8" }),
|
|
96
|
+
h("circle", { cx: 44, cy: 22, r: 6, fill: "#a78bfa" }),
|
|
97
|
+
h("circle", { cx: 32, cy: 44, r: 6, fill: "#f472b6" }),
|
|
98
|
+
h("path", { d: "M20 22 L32 44 L44 22 Z", stroke: "#e2e8f0", strokeWidth: 2, fill: "none" }),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
function Field(props) {
|
|
92
103
|
return h("div", { style: props.style ?? null },
|
|
93
104
|
h("label", { style: labelStyle, htmlFor: props.id }, props.label),
|
|
@@ -114,8 +125,13 @@ window.__ModuleLoader__.load({
|
|
|
114
125
|
);
|
|
115
126
|
}
|
|
116
127
|
|
|
128
|
+
function sessionsUnder(sessions, projectDir, currentId) {
|
|
129
|
+
return (sessions ?? []).filter((session) => session.id === currentId || session.cwd === projectDir);
|
|
130
|
+
}
|
|
131
|
+
|
|
117
132
|
function NodeRow(props) {
|
|
118
133
|
const { node, t, onDelete, sessions, onSwitch, projects, onSwitchProject } = props;
|
|
134
|
+
const nodeSessions = sessionsUnder(sessions, node.projectDir, node.sessionId);
|
|
119
135
|
return h("div", { style: { ...cardStyle, padding: "14px 16px", marginBottom: 10 } },
|
|
120
136
|
h("div", { style: { display: "flex", alignItems: "center", gap: 10 } },
|
|
121
137
|
h("div", { style: { fontSize: 14, fontWeight: 650, color: T.text, flex: 1, minWidth: 0, overflowWrap: "anywhere" } }, node.name),
|
|
@@ -141,12 +157,12 @@ window.__ModuleLoader__.load({
|
|
|
141
157
|
h("span", { style: { fontSize: 11.5, color: T.muted, flex: "none", width: 44 } }, t("sessionPick")),
|
|
142
158
|
h("select", {
|
|
143
159
|
value: node.sessionId,
|
|
144
|
-
disabled:
|
|
160
|
+
disabled: nodeSessions.length === 0,
|
|
145
161
|
onChange: (event) => onSwitch(node, event.target.value),
|
|
146
162
|
style: { ...inputStyle, height: 30, padding: "0 8px", fontSize: 12, flex: 1, minWidth: 0 },
|
|
147
163
|
},
|
|
148
|
-
|
|
149
|
-
|
|
164
|
+
nodeSessions.some((session) => session.id === node.sessionId) ? null : h("option", { value: node.sessionId }, node.sessionId),
|
|
165
|
+
nodeSessions.map((session) => h("option", { key: session.id, value: session.id, title: session.id },
|
|
150
166
|
sessionLabel(t, session))),
|
|
151
167
|
),
|
|
152
168
|
),
|
|
@@ -180,7 +196,7 @@ window.__ModuleLoader__.load({
|
|
|
180
196
|
fontSize: props.wide ? 13 : 11, fontWeight: 600, cursor: "pointer",
|
|
181
197
|
},
|
|
182
198
|
},
|
|
183
|
-
h(
|
|
199
|
+
h(AnetMark, { size: 18 }),
|
|
184
200
|
props.wide ? "ANet" : null,
|
|
185
201
|
),
|
|
186
202
|
open ? h(AnetOverlay, { t, onClose: () => openStore.set(false) }) : null,
|
|
@@ -204,7 +220,7 @@ window.__ModuleLoader__.load({
|
|
|
204
220
|
},
|
|
205
221
|
},
|
|
206
222
|
h("div", { style: { display: "flex", alignItems: "center", gap: 12, padding: "18px 20px", borderBottom: `1px solid ${T.border}` } },
|
|
207
|
-
h(
|
|
223
|
+
h(AnetMark, { size: 34 }),
|
|
208
224
|
h("div", { style: { flex: 1, minWidth: 0 } },
|
|
209
225
|
h("div", { style: { fontSize: 16, fontWeight: 700, color: T.text } }, t("title")),
|
|
210
226
|
h("div", { style: { fontSize: 12, color: T.muted, marginTop: 2 } }, t("subtitle")),
|
|
@@ -271,6 +287,13 @@ window.__ModuleLoader__.load({
|
|
|
271
287
|
.catch(() => {});
|
|
272
288
|
}, []);
|
|
273
289
|
|
|
290
|
+
const createSessions = sessionsUnder(sessions, draft.projectDir, sessionChoice === "__new__" ? null : sessionChoice);
|
|
291
|
+
React.useEffect(() => {
|
|
292
|
+
if (sessionChoice !== "__new__" && !sessions.some((item) => item.id === sessionChoice && item.cwd === draft.projectDir)) {
|
|
293
|
+
setSessionChoice("__new__");
|
|
294
|
+
}
|
|
295
|
+
}, [draft.projectDir, sessions]);
|
|
296
|
+
|
|
274
297
|
const editLogin = (key) => (value) => setLoginDraft((current) => ({ ...current, [key]: value }));
|
|
275
298
|
const editDraft = (key) => (value) => setDraft((current) => ({ ...current, [key]: value }));
|
|
276
299
|
|
|
@@ -420,7 +443,7 @@ window.__ModuleLoader__.load({
|
|
|
420
443
|
onChange: (event) => setSessionChoice(event.target.value),
|
|
421
444
|
},
|
|
422
445
|
h("option", { value: "__new__" }, t("newSession")),
|
|
423
|
-
|
|
446
|
+
createSessions.map((item) => h("option", { key: item.id, value: item.id, title: item.id }, sessionLabel(t, item))),
|
|
424
447
|
),
|
|
425
448
|
h("p", { style: hintStyle }, t("sessionHint")),
|
|
426
449
|
),
|
package/src/plugin.mjs
CHANGED
|
@@ -21,7 +21,7 @@ export { summarizeTurn } from "./turn.mjs";
|
|
|
21
21
|
export const name = "anet";
|
|
22
22
|
export const inject = ["agents", "agentDefaultModel", "sessions", "tools"];
|
|
23
23
|
|
|
24
|
-
const VERSION = "dsh-anet@0.1.0-preview.
|
|
24
|
+
const VERSION = "dsh-anet@0.1.0-preview.30";
|
|
25
25
|
|
|
26
26
|
function agentSetup(ctx) {
|
|
27
27
|
const selection = ctx.agentDefaultModel.currentSelection();
|