@soulguard/openclaw 0.1.4 → 0.2.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/src/templates.ts CHANGED
@@ -1,113 +1,104 @@
1
1
  /**
2
- * OpenClaw configuration templates for Soulguard.
2
+ * OpenClaw protection templates for Soulguard.
3
3
  *
4
- * Every known path is explicitly placed in vault, ledger, or unprotected.
5
- * Tests validate that all paths are accounted for in every template.
4
+ * Each template partitions the same set of known paths into protect, watch,
5
+ * and release tiers. This makes templates authoritative switching from
6
+ * paranoid to relaxed will release previously protected paths.
7
+ *
8
+ * Paths are relative to the OpenClaw home directory (~/.openclaw/).
9
+ * Trailing "/" marks directories.
10
+ * soulguard.json is omitted — init auto-protects it.
6
11
  */
7
12
 
8
- import type { SoulguardConfig } from "@soulguard/core";
9
-
10
- // ── Known path groups ──────────────────────────────────────────────────
11
-
12
- export const SOULGUARD_CONFIG = ["soulguard.json"] as const;
13
- export const CORE_IDENTITY = ["SOUL.md", "AGENTS.md", "IDENTITY.md", "USER.md"] as const;
14
- export const CORE_SESSION = ["TOOLS.md", "HEARTBEAT.md", "BOOTSTRAP.md"] as const;
15
- export const CORE_MEMORY = ["MEMORY.md"] as const;
16
- export const MEMORY_DIR = ["memory/**"] as const;
17
- export const SKILLS = ["skills/**"] as const;
18
- export const OPENCLAW_CONFIG = ["openclaw.json"] as const;
19
- export const CRON = ["cron/jobs.json"] as const;
20
- export const EXTENSIONS = ["extensions/**"] as const;
21
- export const SESSIONS = ["sessions/**"] as const;
22
-
23
- /** All known paths — every template must account for all of these */
24
- export const ALL_KNOWN_PATHS = [
25
- ...SOULGUARD_CONFIG,
26
- ...CORE_IDENTITY,
27
- ...CORE_SESSION,
28
- ...CORE_MEMORY,
29
- ...MEMORY_DIR,
30
- ...SKILLS,
31
- ...OPENCLAW_CONFIG,
32
- ...CRON,
33
- ...EXTENSIONS,
34
- ...SESSIONS,
35
- ] as const;
36
-
37
- // ── Template type ──────────────────────────────────────────────────────
38
-
39
13
  export type TemplateName = "default" | "paranoid" | "relaxed";
40
14
 
41
15
  export type Template = {
42
16
  name: TemplateName;
43
17
  description: string;
44
- vault: readonly string[];
45
- ledger: readonly string[];
46
- unprotected: readonly string[];
18
+ protect: readonly string[];
19
+ watch: readonly string[];
20
+ release: readonly string[];
47
21
  };
48
22
 
49
- /** Extract just the SoulguardConfig from a template */
50
- export function templateToConfig(template: Template): SoulguardConfig {
51
- return {
52
- vault: [...template.vault],
53
- ledger: [...template.ledger],
54
- };
55
- }
56
-
57
- // ── Templates ──────────────────────────────────────────────────────────
58
-
59
- export const defaultTemplate: Template = {
60
- name: "default",
61
- description: "Core identity and config in vault, memory and skills tracked in ledger",
62
- vault: [
63
- ...SOULGUARD_CONFIG,
64
- ...CORE_IDENTITY,
65
- ...CORE_SESSION,
66
- ...OPENCLAW_CONFIG,
67
- ...CRON,
68
- ...EXTENSIONS,
69
- ],
70
- ledger: [...CORE_MEMORY, ...MEMORY_DIR, ...SKILLS],
71
- unprotected: [...SESSIONS],
72
- };
23
+ /** All known paths every template must partition exactly this set. */
24
+ export const ALL_KNOWN_PATHS = [
25
+ "workspace/SOUL.md",
26
+ "workspace/AGENTS.md",
27
+ "workspace/IDENTITY.md",
28
+ "workspace/USER.md",
29
+ "workspace/TOOLS.md",
30
+ "workspace/HEARTBEAT.md",
31
+ "workspace/BOOTSTRAP.md",
32
+ "workspace/MEMORY.md",
33
+ "workspace/memory/",
34
+ "workspace/skills/",
35
+ "workspace/sessions/",
36
+ "openclaw.json",
37
+ "cron/",
38
+ "extensions/",
39
+ ] as const;
73
40
 
74
- export const paranoidTemplate: Template = {
75
- name: "paranoid",
76
- description: "Everything possible in vault, only skills in ledger",
77
- vault: [
78
- ...SOULGUARD_CONFIG,
79
- ...CORE_IDENTITY,
80
- ...CORE_SESSION,
81
- ...CORE_MEMORY,
82
- ...MEMORY_DIR,
83
- ...SKILLS,
84
- ...OPENCLAW_CONFIG,
85
- ...CRON,
86
- ...EXTENSIONS,
87
- ],
88
- ledger: [...SESSIONS],
89
- unprotected: [],
90
- };
41
+ export const templates: Record<TemplateName, Template> = {
42
+ default: {
43
+ name: "default",
44
+ description: "Core identity and config protected, memory and skills watched",
45
+ protect: [
46
+ "workspace/SOUL.md",
47
+ "workspace/AGENTS.md",
48
+ "workspace/IDENTITY.md",
49
+ "workspace/USER.md",
50
+ "workspace/TOOLS.md",
51
+ "workspace/HEARTBEAT.md",
52
+ "workspace/BOOTSTRAP.md",
53
+ "openclaw.json",
54
+ "cron/",
55
+ "extensions/",
56
+ ],
57
+ watch: ["workspace/MEMORY.md", "workspace/memory/", "workspace/skills/"],
58
+ release: ["workspace/sessions/"],
59
+ },
91
60
 
92
- export const relaxedTemplate: Template = {
93
- name: "relaxed",
94
- description: "Only soulguard config locked, everything else tracked — good for initial setup",
95
- vault: [...SOULGUARD_CONFIG],
96
- ledger: [
97
- ...CORE_IDENTITY,
98
- ...CORE_SESSION,
99
- ...CORE_MEMORY,
100
- ...MEMORY_DIR,
101
- ...SKILLS,
102
- ...OPENCLAW_CONFIG,
103
- ...CRON,
104
- ...EXTENSIONS,
105
- ],
106
- unprotected: [...SESSIONS],
107
- };
61
+ paranoid: {
62
+ name: "paranoid",
63
+ description: "Everything protected, only sessions watched",
64
+ protect: [
65
+ "workspace/SOUL.md",
66
+ "workspace/AGENTS.md",
67
+ "workspace/IDENTITY.md",
68
+ "workspace/USER.md",
69
+ "workspace/TOOLS.md",
70
+ "workspace/HEARTBEAT.md",
71
+ "workspace/BOOTSTRAP.md",
72
+ "workspace/MEMORY.md",
73
+ "workspace/memory/",
74
+ "workspace/skills/",
75
+ "openclaw.json",
76
+ "cron/",
77
+ "extensions/",
78
+ ],
79
+ watch: ["workspace/sessions/"],
80
+ release: [],
81
+ },
108
82
 
109
- export const templates: Record<TemplateName, Template> = {
110
- default: defaultTemplate,
111
- paranoid: paranoidTemplate,
112
- relaxed: relaxedTemplate,
83
+ relaxed: {
84
+ name: "relaxed",
85
+ description: "Everything watched — good for initial setup",
86
+ protect: [],
87
+ watch: [
88
+ "workspace/SOUL.md",
89
+ "workspace/AGENTS.md",
90
+ "workspace/IDENTITY.md",
91
+ "workspace/USER.md",
92
+ "workspace/TOOLS.md",
93
+ "workspace/HEARTBEAT.md",
94
+ "workspace/BOOTSTRAP.md",
95
+ "workspace/MEMORY.md",
96
+ "workspace/memory/",
97
+ "workspace/skills/",
98
+ "openclaw.json",
99
+ "cron/",
100
+ "extensions/",
101
+ ],
102
+ release: ["workspace/sessions/"],
103
+ },
113
104
  };