@klarkxy/dsh-safe-auto 0.5.0 → 0.5.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/README.md CHANGED
@@ -34,7 +34,7 @@ Recording starts after installing the review-history feature; earlier reviews ar
34
34
 
35
35
  | Tool | What it does |
36
36
  |---|---|
37
- | `safe_auto_history` | Read-only lookup of the current session's review history. `list` returns summaries plus a pagination cursor; `get` returns one complete record. Use the Plugins page to read history across sessions. Reading history never triggers a review and never calls the reviewer model. |
37
+ | `safe_auto_history` | Read-only lookup of the current session's review history. `list` returns summaries and a next-page cursor only when more records remain; `get` returns one complete record. Use the Plugins page to read history across sessions. Reading history never triggers a review and never calls the reviewer model. |
38
38
 
39
39
  ## What gets reviewed
40
40
 
package/README.zh-CN.md CHANGED
@@ -34,7 +34,7 @@ dsh plugin --profile web add @klarkxy/dsh-safe-auto
34
34
 
35
35
  | 工具 | 作用 |
36
36
  |---|---|
37
- | `safe_auto_history` | 只读查询当前会话的审核历史:`list` 返回摘要列表和分页游标,`get` 返回单条完整记录。跨会话历史可在插件页查看。查询历史不会触发审核,也不会调用审核模型。 |
37
+ | `safe_auto_history` | 只读查询当前会话的审核历史:`list` 返回摘要列表,仅在还有记录时提供下一页游标;`get` 返回单条完整记录。跨会话历史可在插件页查看。查询历史不会触发审核,也不会调用审核模型。 |
38
38
 
39
39
  ## 会审核什么
40
40
 
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "@klarkxy/dsh-safe-auto",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "main": "src/index.js",
5
5
  "description": "Safe Auto: a reviewer model answers native approval requests, Codex auto-review style; only a pass approves that one call.",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klarkxy/dsh-safe-auto",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Safe Auto: a reviewer model answers native approval requests, Codex auto-review style; only a pass approves that one call.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
@@ -90,6 +90,6 @@
90
90
  "registry": "https://registry.npmjs.org/"
91
91
  },
92
92
  "dshRelease": {
93
- "contentHash": "cd60c780b7fbf05cb1366838a1a521e8f9bbecb1fd2511415fb2920ef1f27db0"
93
+ "contentHash": "f1c3c6a5282fcee7e6ae41538bd2c87f4eaa362ec2165412a4b5292d46f430ff"
94
94
  }
95
95
  }
package/src/audit.js CHANGED
@@ -441,8 +441,9 @@ export async function openAudit(storageDomain) {
441
441
  };
442
442
  const view = row => {
443
443
  if (row === undefined) return undefined;
444
- // Deep copy: callers must never mutate the authoritative in-memory row.
445
- const next = { ...structuredClone(row), executionState: row.execution?.state ?? 'not-observed' };
444
+ // Schema-validated rows may retain undefined optional fields in memory.
445
+ // Match their persisted JSON form and detach the caller's copy.
446
+ const next = { ...JSON.parse(JSON.stringify(row)), executionState: row.execution?.state ?? 'not-observed' };
446
447
  return decorate(row, next);
447
448
  };
448
449
  /*
@@ -455,7 +456,7 @@ export async function openAudit(storageDomain) {
455
456
  const summary = row => {
456
457
  const light = {};
457
458
  for (const [key, value] of Object.entries(row)) if (!HEAVY.has(key)) light[key] = value;
458
- const out = structuredClone(light);
459
+ const out = JSON.parse(JSON.stringify(light));
459
460
  out.executionState = row.execution?.state ?? 'not-observed';
460
461
  decorate(row, out);
461
462
  return out;
@@ -649,7 +650,7 @@ export async function openAudit(storageDomain) {
649
650
  /**
650
651
  * Synchronous filtered listing, newest first, keyset-paginated so new
651
652
  * inserts during iteration never shift page boundaries.
652
- * @returns {{items: object[], nextCursor: string|undefined, total: number}}
653
+ * @returns {{items: object[], nextCursor?: string, total: number}}
653
654
  */
654
655
  list(payload = {}) {
655
656
  const filter = listPayloadSchema.parse(payload ?? {});
@@ -683,7 +684,7 @@ export async function openAudit(storageDomain) {
683
684
  }
684
685
  const last = page[page.length - 1];
685
686
  const hasMore = last !== undefined && rows.some(row => afterCursor(row, { startedAt: last.startedAt, id: last.id }));
686
- return { items: page.map(summary), nextCursor: hasMore ? encodeCursor(last) : undefined, total };
687
+ return { items: page.map(summary), ...(hasMore ? { nextCursor: encodeCursor(last) } : {}), total };
687
688
  },
688
689
 
689
690
  /** Synchronous full record read, including heavy fields. */