@stmcw1/dacw 1.0.1 → 1.1.0

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.
@@ -5,26 +5,20 @@ export class StateManager {
5
5
  stateDir;
6
6
  stateFilePath;
7
7
  taskId;
8
- macSecret;
8
+ checksumFn;
9
9
  writeChain = Promise.resolve();
10
10
  authoritative = null;
11
11
  tmpSeq = 0;
12
- constructor(stateDir, rawTaskId, workspaceDir, macSecret){
12
+ constructor(stateDir, rawTaskId, workspaceDir, checksumFn){
13
13
  const safeTaskId = rawTaskId.replace(/[^a-zA-Z0-9_\-]/g, '_');
14
14
  const idHash = crypto.createHash('sha256').update(String(rawTaskId) + '\n' + String(workspaceDir)).digest('hex').slice(0, 8);
15
15
  this.taskId = safeTaskId;
16
- this.macSecret = macSecret ?? null;
16
+ this.checksumFn = checksumFn ?? ((body)=>crypto.createHash('sha256').update(body).digest('hex'));
17
17
  this.stateDir = path.resolve(stateDir);
18
18
  this.stateFilePath = path.join(this.stateDir, `state_${safeTaskId}_${idHash}.json`);
19
19
  }
20
- macOf(body) {
21
- if (this.macSecret !== null) {
22
- return crypto.createHmac('sha256', this.macSecret).update(body).digest('hex');
23
- }
24
- return crypto.createHash('sha256').update(body).digest('hex');
25
- }
26
20
  checksumOf(state) {
27
- const { taskId, round, status, taskPrompt, writtenFiles, testResult, reviewResult, lastError } = state;
21
+ const { taskId, round, status, taskPrompt, writtenFiles, testResult, reviewResult, reviewExcluded, secretScanHits, rollbackPoint, rollback, lastError } = state;
28
22
  const body = JSON.stringify({
29
23
  taskId,
30
24
  round,
@@ -33,9 +27,13 @@ export class StateManager {
33
27
  writtenFiles,
34
28
  testResult,
35
29
  reviewResult,
30
+ reviewExcluded: reviewExcluded ?? null,
31
+ secretScanHits: secretScanHits ?? null,
32
+ rollbackPoint: rollbackPoint ?? null,
33
+ rollback: rollback ?? null,
36
34
  lastError
37
35
  });
38
- return this.macOf(body);
36
+ return this.checksumFn(body);
39
37
  }
40
38
  async persist(state) {
41
39
  await fs.mkdir(this.stateDir, {
@@ -108,6 +106,10 @@ export class StateManager {
108
106
  writtenFiles: null,
109
107
  testResult: null,
110
108
  reviewResult: null,
109
+ reviewExcluded: null,
110
+ secretScanHits: null,
111
+ rollbackPoint: null,
112
+ rollback: null,
111
113
  lastError: null
112
114
  };
113
115
  await this.persist(initial);
package/icon.png ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stmcw1/dacw",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Defensive Agent Coding Workflow (DACW) as a DSH Host plugin: an AI writer proposes code, a deterministic runner tests it, a separate reviewer audits it, and a human gate decides the merge.",
5
5
  "keywords": [
6
6
  "dacw",
@@ -27,16 +27,13 @@
27
27
  "exports": {
28
28
  ".": "./dist/plugin.js",
29
29
  "./locale/*.json": "./locale/*.json",
30
- "./icon": "./icon.svg"
30
+ "./icon": "./icon.png"
31
31
  },
32
32
  "files": [
33
- "dist/index.js",
34
- "dist/plugin.js",
35
- "dist/runner.js",
36
- "dist/state_manager.js",
33
+ "dist/",
37
34
  "cordis.patch.yml",
38
35
  "locale/*.json",
39
- "icon.svg",
36
+ "icon.png",
40
37
  "README.md",
41
38
  "README_EN.md",
42
39
  "SAFETY.md",
package/icon.svg DELETED
@@ -1,20 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-label="DACW">
2
- <defs>
3
- <linearGradient id="dacw-bg" x1="0" y1="0" x2="1" y2="1">
4
- <stop offset="0" stop-color="#2f3a4f"/>
5
- <stop offset="1" stop-color="#15202f"/>
6
- </linearGradient>
7
- <linearGradient id="dacw-shield" x1="0" y1="0" x2="0" y2="1">
8
- <stop offset="0" stop-color="#7cb6ff"/>
9
- <stop offset="1" stop-color="#4f7cff"/>
10
- </linearGradient>
11
- </defs>
12
- <rect width="64" height="64" rx="14" fill="url(#dacw-bg)"/>
13
- <path d="M32 8 L52 15 L52 31 C52 42 44 51 32 56 C20 51 12 42 12 31 L12 15 Z"
14
- fill="none" stroke="url(#dacw-shield)" stroke-width="3.5" stroke-linejoin="round"/>
15
- <path d="M25 24 L18.5 32 L25 40" fill="none" stroke="#e8f1ff" stroke-width="3"
16
- stroke-linecap="round" stroke-linejoin="round"/>
17
- <path d="M39 24 L45.5 32 L39 40" fill="none" stroke="#e8f1ff" stroke-width="3"
18
- stroke-linecap="round" stroke-linejoin="round"/>
19
- <path d="M35 20 L29 44" fill="none" stroke="#8fd3a8" stroke-width="3" stroke-linecap="round"/>
20
- </svg>