@duke-dsh-plugins/dsh-agent-approval 1.8.0 → 1.8.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.
Files changed (3) hide show
  1. package/client.js +7 -1
  2. package/index.js +18 -9
  3. package/package.json +4 -4
package/client.js CHANGED
@@ -200,6 +200,12 @@ window.__ModuleLoader__.load({
200
200
  // with no glyph the icon span is absent, leaving label + chevron.
201
201
  // Skip menu rows (handled above) and the settings dialog (its nav
202
202
  // row carries the same label but is owned by the settings-nav icon).
203
+ // The trigger renders whichever preset is CURRENTLY selected, so it
204
+ // must accept BOTH of our preset names (v1.8.2): 自动审批 and 自动审查
205
+ // are equally ours, and neither is in the host's permissionGlyphs —
206
+ // registerReviewMenuItem only marks menu rows, so without this the
207
+ // trigger showed 自动审查 with no icon at all.
208
+ const triggerLabels = [currentLabel, String(REVIEW_LABEL).trim()];
203
209
  const buttons = document.querySelectorAll("button");
204
210
  for (let i = 0; i < buttons.length; i++) {
205
211
  const button = buttons[i];
@@ -212,7 +218,7 @@ window.__ModuleLoader__.load({
212
218
  const s = spans[j].textContent ? spans[j].textContent.trim() : "";
213
219
  if (s.length > 0) { labelText = s; break; }
214
220
  }
215
- const matches = labelText === currentLabel && button.querySelector("svg") !== null;
221
+ const matches = triggerLabels.indexOf(labelText) !== -1 && button.querySelector("svg") !== null;
216
222
  if (matches) button.setAttribute(PERM_TRIGGER_MARKER, "");
217
223
  else button.removeAttribute(PERM_TRIGGER_MARKER);
218
224
  }
package/index.js CHANGED
@@ -948,19 +948,28 @@ export class AgentApprovalService extends TypertRemoteService {
948
948
  /**
949
949
  * Resolve the audit sidecar for one session: `agent-approval.jsonl` inside
950
950
  * the session's persistence directory (same directory as the session's own
951
- * durable log, via `sessionPersistence.locate(header)` — a pure path
952
- * resolution that also works for live sessions). Falls back to a
953
- * plugin-owned per-session file under DSH_HOME when the seam or the
954
- * location is unavailable; the fallback keeps restart-safety at the cost
955
- * of not being cleaned up when the session is deleted.
951
+ * durable log — a pure path resolution that also works for live sessions).
952
+ * DSH ≤0.1.7 exposes it as `sessionPersistence.locate(header)`; DSH 0.2.0
953
+ * dropped `locate` and moved resolution to the JSONL backend's async
954
+ * `resolveCurrentLog(id)` (returns the log path, or undefined while only a
955
+ * historical generation exists). Falls back to a plugin-owned per-session
956
+ * file under DSH_HOME when the seam or the location is unavailable; the
957
+ * fallback keeps restart-safety at the cost of not being cleaned up when the
958
+ * session is deleted.
956
959
  */
957
960
  async _recordsFileOf(session) {
958
961
  const persistence = this.ctx.get("sessionPersistence");
959
- if (persistence !== undefined && typeof persistence.locate === "function") {
962
+ if (persistence !== undefined) {
960
963
  try {
961
- const loc = persistence.locate(session.header);
962
- if (loc && typeof loc.path === "string" && loc.path !== "") {
963
- return join(dirname(loc.path), RECORDS_SIDECAR);
964
+ let path;
965
+ if (typeof persistence.locate === "function") {
966
+ const loc = persistence.locate(session.header);
967
+ if (loc && typeof loc.path === "string") path = loc.path;
968
+ } else if (typeof persistence.resolveCurrentLog === "function") {
969
+ path = await persistence.resolveCurrentLog(session.id);
970
+ }
971
+ if (typeof path === "string" && path !== "") {
972
+ return join(dirname(path), RECORDS_SIDECAR);
964
973
  }
965
974
  } catch (e) {
966
975
  /* fall through to the plugin-owned fallback */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duke-dsh-plugins/dsh-agent-approval",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "Agent-decided approvals for DeepSeek Harness: an 自动审批 permission mode where every sandbox escalation is judged automatically (default judge: one direct LLM call with no subagent session; optional isolated judge subagent or the TypeSafe Jev decision model), plus an opt-in 自动审查 per-call review mode (Full access base; every tool call reviewed by the Jev judge before execution, risky calls rejected with no human fallback), with a configurable judge model and a per-session audit trail in the conversation window's 审批 tab.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,13 +34,13 @@
34
34
  "platform": "web"
35
35
  },
36
36
  "engines": {
37
- "dsh": "^0.1.5-rc.3"
37
+ "dsh": "^0.1.5-rc.3 || ^0.2.0-rc.1"
38
38
  }
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@deepseek-ai/cordis": "^4.0.1",
42
- "@deepseek-ai/dsh": "^0.1.5-rc.3",
43
- "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.7 || ^0.1.7-rc.1"
42
+ "@deepseek-ai/dsh": "^0.1.5-rc.3 || ^0.2.0-rc.1",
43
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.7 || ^0.1.7-rc.1 || ^0.2.0-rc.1"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "@deepseek-ai/dsh": {