@sleep2agi/dsh-anet 0.1.0-preview.28 → 0.1.0-preview.29

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/dsh-anet",
3
- "version": "0.1.0-preview.28",
3
+ "version": "0.1.0-preview.29",
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
@@ -114,8 +114,13 @@ window.__ModuleLoader__.load({
114
114
  );
115
115
  }
116
116
 
117
+ function sessionsUnder(sessions, projectDir, currentId) {
118
+ return (sessions ?? []).filter((session) => session.id === currentId || session.cwd === projectDir);
119
+ }
120
+
117
121
  function NodeRow(props) {
118
122
  const { node, t, onDelete, sessions, onSwitch, projects, onSwitchProject } = props;
123
+ const nodeSessions = sessionsUnder(sessions, node.projectDir, node.sessionId);
119
124
  return h("div", { style: { ...cardStyle, padding: "14px 16px", marginBottom: 10 } },
120
125
  h("div", { style: { display: "flex", alignItems: "center", gap: 10 } },
121
126
  h("div", { style: { fontSize: 14, fontWeight: 650, color: T.text, flex: 1, minWidth: 0, overflowWrap: "anywhere" } }, node.name),
@@ -141,12 +146,12 @@ window.__ModuleLoader__.load({
141
146
  h("span", { style: { fontSize: 11.5, color: T.muted, flex: "none", width: 44 } }, t("sessionPick")),
142
147
  h("select", {
143
148
  value: node.sessionId,
144
- disabled: !sessions || sessions.length === 0,
149
+ disabled: nodeSessions.length === 0,
145
150
  onChange: (event) => onSwitch(node, event.target.value),
146
151
  style: { ...inputStyle, height: 30, padding: "0 8px", fontSize: 12, flex: 1, minWidth: 0 },
147
152
  },
148
- (sessions ?? []).some((session) => session.id === node.sessionId) ? null : h("option", { value: node.sessionId }, node.sessionId),
149
- (sessions ?? []).map((session) => h("option", { key: session.id, value: session.id, title: session.id },
153
+ nodeSessions.some((session) => session.id === node.sessionId) ? null : h("option", { value: node.sessionId }, node.sessionId),
154
+ nodeSessions.map((session) => h("option", { key: session.id, value: session.id, title: session.id },
150
155
  sessionLabel(t, session))),
151
156
  ),
152
157
  ),
@@ -271,6 +276,13 @@ window.__ModuleLoader__.load({
271
276
  .catch(() => {});
272
277
  }, []);
273
278
 
279
+ const createSessions = sessionsUnder(sessions, draft.projectDir, sessionChoice === "__new__" ? null : sessionChoice);
280
+ React.useEffect(() => {
281
+ if (sessionChoice !== "__new__" && !sessions.some((item) => item.id === sessionChoice && item.cwd === draft.projectDir)) {
282
+ setSessionChoice("__new__");
283
+ }
284
+ }, [draft.projectDir, sessions]);
285
+
274
286
  const editLogin = (key) => (value) => setLoginDraft((current) => ({ ...current, [key]: value }));
275
287
  const editDraft = (key) => (value) => setDraft((current) => ({ ...current, [key]: value }));
276
288
 
@@ -420,7 +432,7 @@ window.__ModuleLoader__.load({
420
432
  onChange: (event) => setSessionChoice(event.target.value),
421
433
  },
422
434
  h("option", { value: "__new__" }, t("newSession")),
423
- sessions.map((item) => h("option", { key: item.id, value: item.id, title: item.id }, sessionLabel(t, item))),
435
+ createSessions.map((item) => h("option", { key: item.id, value: item.id, title: item.id }, sessionLabel(t, item))),
424
436
  ),
425
437
  h("p", { style: hintStyle }, t("sessionHint")),
426
438
  ),
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.28";
24
+ const VERSION = "dsh-anet@0.1.0-preview.29";
25
25
 
26
26
  function agentSetup(ctx) {
27
27
  const selection = ctx.agentDefaultModel.currentSelection();