@shomra/agent 0.3.18 → 0.3.19

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": "@shomra/agent",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "description": "Shomra - adversarial assurance for AI agents, as a local-first CLI. Blocks dangerous tool-calls before they run, attacks your own guardrails to prove they hold, and gates AI artifacts in your editor and CI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,8 +16,16 @@ export function loadConfig() {
16
16
  }
17
17
 
18
18
  export function saveConfig(cfg) {
19
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
20
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2));
19
+ fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
20
+ try {
21
+ fs.chmodSync(CONFIG_DIR, 0o700);
22
+ } catch {}
23
+ const tmp = `${CONFIG_FILE}.${process.pid}.tmp`;
24
+ fs.writeFileSync(tmp, JSON.stringify(cfg, null, 2), { mode: 0o600 });
25
+ try {
26
+ fs.chmodSync(tmp, 0o600);
27
+ } catch {}
28
+ fs.renameSync(tmp, CONFIG_FILE);
21
29
  }
22
30
 
23
31
  export function getMachineId(cfg) {