@intutic/sync-daemon 1.10.0 → 1.10.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.
Files changed (200) hide show
  1. package/README.md +2 -2
  2. package/dist/agentReporter.d.ts +205 -0
  3. package/dist/agentReporter.d.ts.map +1 -0
  4. package/dist/agentReporter.js +394 -0
  5. package/dist/agentReporter.js.map +1 -0
  6. package/dist/configReader.d.ts +39 -2
  7. package/dist/configReader.d.ts.map +1 -1
  8. package/dist/configReader.js +56 -2
  9. package/dist/configReader.js.map +1 -1
  10. package/dist/configWriter.d.ts +51 -1
  11. package/dist/configWriter.d.ts.map +1 -1
  12. package/dist/configWriter.js +490 -63
  13. package/dist/configWriter.js.map +1 -1
  14. package/dist/harness/antigravityHooks.d.ts.map +1 -1
  15. package/dist/harness/antigravityHooks.js +33 -55
  16. package/dist/harness/antigravityHooks.js.map +1 -1
  17. package/dist/harness/claudeCodeHooks.d.ts +47 -13
  18. package/dist/harness/claudeCodeHooks.d.ts.map +1 -1
  19. package/dist/harness/claudeCodeHooks.js +316 -54
  20. package/dist/harness/claudeCodeHooks.js.map +1 -1
  21. package/dist/harness/claudeDesktopHooks.d.ts.map +1 -1
  22. package/dist/harness/claudeDesktopHooks.js +35 -48
  23. package/dist/harness/claudeDesktopHooks.js.map +1 -1
  24. package/dist/harness/clineHooks.d.ts.map +1 -1
  25. package/dist/harness/clineHooks.js +42 -34
  26. package/dist/harness/clineHooks.js.map +1 -1
  27. package/dist/harness/codexHooks.d.ts +36 -0
  28. package/dist/harness/codexHooks.d.ts.map +1 -0
  29. package/dist/harness/codexHooks.js +227 -0
  30. package/dist/harness/codexHooks.js.map +1 -0
  31. package/dist/harness/continueHooks.d.ts +45 -5
  32. package/dist/harness/continueHooks.d.ts.map +1 -1
  33. package/dist/harness/continueHooks.js +225 -5
  34. package/dist/harness/continueHooks.js.map +1 -1
  35. package/dist/harness/cursorHooks.d.ts +31 -0
  36. package/dist/harness/cursorHooks.d.ts.map +1 -1
  37. package/dist/harness/cursorHooks.js +78 -49
  38. package/dist/harness/cursorHooks.js.map +1 -1
  39. package/dist/harness/dshHooks.d.ts +198 -0
  40. package/dist/harness/dshHooks.d.ts.map +1 -0
  41. package/dist/harness/dshHooks.js +569 -0
  42. package/dist/harness/dshHooks.js.map +1 -0
  43. package/dist/harness/gateBody.d.ts +422 -0
  44. package/dist/harness/gateBody.d.ts.map +1 -0
  45. package/dist/harness/gateBody.js +1816 -0
  46. package/dist/harness/gateBody.js.map +1 -0
  47. package/dist/harness/gateKind.d.ts +164 -0
  48. package/dist/harness/gateKind.d.ts.map +1 -0
  49. package/dist/harness/gateKind.js +143 -0
  50. package/dist/harness/gateKind.js.map +1 -0
  51. package/dist/harness/githubCopilotHooks.d.ts +54 -0
  52. package/dist/harness/githubCopilotHooks.d.ts.map +1 -0
  53. package/dist/harness/githubCopilotHooks.js +218 -0
  54. package/dist/harness/githubCopilotHooks.js.map +1 -0
  55. package/dist/harness/gooseHooks.d.ts.map +1 -1
  56. package/dist/harness/gooseHooks.js +67 -37
  57. package/dist/harness/gooseHooks.js.map +1 -1
  58. package/dist/harness/grokHooks.d.ts +77 -0
  59. package/dist/harness/grokHooks.d.ts.map +1 -0
  60. package/dist/harness/grokHooks.js +350 -0
  61. package/dist/harness/grokHooks.js.map +1 -0
  62. package/dist/harness/hermesHooks.d.ts.map +1 -1
  63. package/dist/harness/hermesHooks.js +26 -55
  64. package/dist/harness/hermesHooks.js.map +1 -1
  65. package/dist/harness/holdRedaction.d.ts +69 -0
  66. package/dist/harness/holdRedaction.d.ts.map +1 -0
  67. package/dist/harness/holdRedaction.js +211 -0
  68. package/dist/harness/holdRedaction.js.map +1 -0
  69. package/dist/harness/jetbrainsXmlConfig.d.ts +51 -0
  70. package/dist/harness/jetbrainsXmlConfig.d.ts.map +1 -0
  71. package/dist/harness/jetbrainsXmlConfig.js +151 -0
  72. package/dist/harness/jetbrainsXmlConfig.js.map +1 -0
  73. package/dist/harness/mcpAutoWrite.d.ts +100 -3
  74. package/dist/harness/mcpAutoWrite.d.ts.map +1 -1
  75. package/dist/harness/mcpAutoWrite.js +712 -90
  76. package/dist/harness/mcpAutoWrite.js.map +1 -1
  77. package/dist/harness/museHooks.d.ts +53 -0
  78. package/dist/harness/museHooks.d.ts.map +1 -0
  79. package/dist/harness/museHooks.js +273 -0
  80. package/dist/harness/museHooks.js.map +1 -0
  81. package/dist/harness/n8nHooks.d.ts +25 -9
  82. package/dist/harness/n8nHooks.d.ts.map +1 -1
  83. package/dist/harness/n8nHooks.js +174 -9
  84. package/dist/harness/n8nHooks.js.map +1 -1
  85. package/dist/harness/openCodeHooks.d.ts +93 -0
  86. package/dist/harness/openCodeHooks.d.ts.map +1 -0
  87. package/dist/harness/openCodeHooks.js +248 -0
  88. package/dist/harness/openCodeHooks.js.map +1 -0
  89. package/dist/harness/openWebuiHooks.d.ts.map +1 -1
  90. package/dist/harness/openWebuiHooks.js +56 -11
  91. package/dist/harness/openWebuiHooks.js.map +1 -1
  92. package/dist/harness/openclawHooks.d.ts.map +1 -1
  93. package/dist/harness/openclawHooks.js +30 -54
  94. package/dist/harness/openclawHooks.js.map +1 -1
  95. package/dist/harness/openhandsHooks.d.ts.map +1 -1
  96. package/dist/harness/openhandsHooks.js +35 -41
  97. package/dist/harness/openhandsHooks.js.map +1 -1
  98. package/dist/harness/piHooks.d.ts.map +1 -1
  99. package/dist/harness/piHooks.js +31 -58
  100. package/dist/harness/piHooks.js.map +1 -1
  101. package/dist/harness/protectedPaths.d.ts +353 -0
  102. package/dist/harness/protectedPaths.d.ts.map +1 -0
  103. package/dist/harness/protectedPaths.js +805 -0
  104. package/dist/harness/protectedPaths.js.map +1 -0
  105. package/dist/harness/rooCodeHooks.d.ts.map +1 -1
  106. package/dist/harness/rooCodeHooks.js +34 -48
  107. package/dist/harness/rooCodeHooks.js.map +1 -1
  108. package/dist/harness/windsurfHooks.d.ts +72 -0
  109. package/dist/harness/windsurfHooks.d.ts.map +1 -1
  110. package/dist/harness/windsurfHooks.js +172 -58
  111. package/dist/harness/windsurfHooks.js.map +1 -1
  112. package/dist/harness/windsurfJetBrainsProxy.d.ts +78 -0
  113. package/dist/harness/windsurfJetBrainsProxy.d.ts.map +1 -0
  114. package/dist/harness/windsurfJetBrainsProxy.js +159 -0
  115. package/dist/harness/windsurfJetBrainsProxy.js.map +1 -0
  116. package/dist/hashReporter.js +1 -1
  117. package/dist/hashReporter.js.map +1 -1
  118. package/dist/index.d.ts +12 -6
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +14 -6
  121. package/dist/index.js.map +1 -1
  122. package/dist/integrityStore.d.ts +0 -8
  123. package/dist/integrityStore.d.ts.map +1 -1
  124. package/dist/integrityStore.js +6 -29
  125. package/dist/integrityStore.js.map +1 -1
  126. package/dist/lib/approvedBypasses.d.ts +76 -0
  127. package/dist/lib/approvedBypasses.d.ts.map +1 -0
  128. package/dist/lib/approvedBypasses.js +140 -0
  129. package/dist/lib/approvedBypasses.js.map +1 -0
  130. package/dist/lib/complianceProbes.d.ts.map +1 -1
  131. package/dist/lib/complianceProbes.js +5 -0
  132. package/dist/lib/complianceProbes.js.map +1 -1
  133. package/dist/lib/decisionsDigest.d.ts +99 -0
  134. package/dist/lib/decisionsDigest.d.ts.map +1 -0
  135. package/dist/lib/decisionsDigest.js +199 -0
  136. package/dist/lib/decisionsDigest.js.map +1 -0
  137. package/dist/lib/egressPolicy.d.ts +69 -0
  138. package/dist/lib/egressPolicy.d.ts.map +1 -0
  139. package/dist/lib/egressPolicy.js +126 -0
  140. package/dist/lib/egressPolicy.js.map +1 -0
  141. package/dist/lib/gitWorktrees.d.ts +140 -0
  142. package/dist/lib/gitWorktrees.d.ts.map +1 -0
  143. package/dist/lib/gitWorktrees.js +191 -0
  144. package/dist/lib/gitWorktrees.js.map +1 -0
  145. package/dist/lib/policySnapshot.d.ts +224 -0
  146. package/dist/lib/policySnapshot.d.ts.map +1 -0
  147. package/dist/lib/policySnapshot.js +637 -0
  148. package/dist/lib/policySnapshot.js.map +1 -0
  149. package/dist/lib/processPoller.d.ts +44 -0
  150. package/dist/lib/processPoller.d.ts.map +1 -1
  151. package/dist/lib/processPoller.js +176 -1
  152. package/dist/lib/processPoller.js.map +1 -1
  153. package/dist/lib/runtimeEnv.d.ts +8 -0
  154. package/dist/lib/runtimeEnv.d.ts.map +1 -1
  155. package/dist/lib/runtimeEnv.js +3 -0
  156. package/dist/lib/runtimeEnv.js.map +1 -1
  157. package/dist/localTrajectoryHeuristics.d.ts +51 -0
  158. package/dist/localTrajectoryHeuristics.d.ts.map +1 -0
  159. package/dist/localTrajectoryHeuristics.js +90 -0
  160. package/dist/localTrajectoryHeuristics.js.map +1 -0
  161. package/dist/sessionReporter.d.ts +70 -0
  162. package/dist/sessionReporter.d.ts.map +1 -0
  163. package/dist/sessionReporter.js +140 -0
  164. package/dist/sessionReporter.js.map +1 -0
  165. package/dist/skillWriter.d.ts +1 -1
  166. package/dist/skillWriter.d.ts.map +1 -1
  167. package/dist/skillWriter.js +5 -2
  168. package/dist/skillWriter.js.map +1 -1
  169. package/dist/syncLoop.d.ts +105 -3
  170. package/dist/syncLoop.d.ts.map +1 -1
  171. package/dist/syncLoop.js +397 -65
  172. package/dist/syncLoop.js.map +1 -1
  173. package/dist/trajectoryMonitor.d.ts +2 -0
  174. package/dist/trajectoryMonitor.d.ts.map +1 -1
  175. package/dist/trajectoryMonitor.js +57 -0
  176. package/dist/trajectoryMonitor.js.map +1 -1
  177. package/dist/watcher/driftWatcher.d.ts.map +1 -1
  178. package/dist/watcher/driftWatcher.js +12 -3
  179. package/dist/watcher/driftWatcher.js.map +1 -1
  180. package/dist/watcher/settingsGuard.d.ts +23 -0
  181. package/dist/watcher/settingsGuard.d.ts.map +1 -1
  182. package/dist/watcher/settingsGuard.js +202 -17
  183. package/dist/watcher/settingsGuard.js.map +1 -1
  184. package/package.json +37 -6
  185. package/dist/brainIndexer.d.ts +0 -51
  186. package/dist/brainIndexer.d.ts.map +0 -1
  187. package/dist/brainIndexer.js +0 -148
  188. package/dist/brainIndexer.js.map +0 -1
  189. package/dist/harness/cursorHooksJson.d.ts +0 -29
  190. package/dist/harness/cursorHooksJson.d.ts.map +0 -1
  191. package/dist/harness/cursorHooksJson.js +0 -130
  192. package/dist/harness/cursorHooksJson.js.map +0 -1
  193. package/dist/harness/gooseHooksWriter.d.ts +0 -27
  194. package/dist/harness/gooseHooksWriter.d.ts.map +0 -1
  195. package/dist/harness/gooseHooksWriter.js +0 -147
  196. package/dist/harness/gooseHooksWriter.js.map +0 -1
  197. package/dist/harness/openhandsHooksWriter.d.ts +0 -23
  198. package/dist/harness/openhandsHooksWriter.d.ts.map +0 -1
  199. package/dist/harness/openhandsHooksWriter.js +0 -146
  200. package/dist/harness/openhandsHooksWriter.js.map +0 -1
@@ -0,0 +1,224 @@
1
+ /**
2
+ * policySnapshot.ts — ships workspace policy *to* the machine, so the gate does
3
+ * not have to ship the decision off it.
4
+ *
5
+ * # Why
6
+ *
7
+ * TD-307: `POST /api/v1/hook-gate` was called by two of thirteen gates, so DLP,
8
+ * `BLOCK:` SOPs, SSO policy and promoted findings reached two of thirteen. The
9
+ * obvious repair — route the other eleven through the gate — is the wrong one:
10
+ * those eleven enforce locally and **fail closed**, the two network callers were
11
+ * the only ones that **fail open**, and the gate's allow path is five or six
12
+ * sequential Postgres round-trips. Routing everyone through it would trade
13
+ * fail-closed for fail-open and put a control-plane outage on every `Bash`.
14
+ *
15
+ * Almost none of that decision needs the network. So the daemon resolves policy
16
+ * once per sync cycle and writes it here; every gate reads a local file.
17
+ *
18
+ * # Two tiers, one invariant
19
+ *
20
+ * The **static floor** (`staticFloorPatterns()`) is compiled into each gate and
21
+ * always enforced. The **dynamic tier** is this file, and it is *additive only*:
22
+ *
23
+ * > For every harness and every snapshot state, the set of calls blocked after
24
+ * > this change is a superset of the set blocked before.
25
+ *
26
+ * That is what makes the failure modes tractable. A missing or corrupt snapshot
27
+ * costs only rules that, for eleven of the thirteen gates, did not exist at all
28
+ * before — so degrading returns to yesterday's behaviour rather than opening a
29
+ * new hole. It is also why an absent snapshot does **not** fail closed: that
30
+ * would brick every agent on every machine at install time, to replace
31
+ * protection the floor already provides.
32
+ *
33
+ * # Where it lives, and why that matters
34
+ *
35
+ * `~/.intutic/hooks/policy-snapshot.{json,rules}`. The directory is load-bearing:
36
+ * `.intutic/hooks` is already in `UNIVERSAL_PROTECTED_PATHS`, so all thirteen
37
+ * gates refuse an agent's attempt to write the snapshot on day one, with no new
38
+ * entry and no new code.
39
+ *
40
+ * # The ` WHERE ` clause survives this pipeline now
41
+ *
42
+ * A SOP titled `BLOCK:^shell$ WHERE kubectl\s+apply(?!.*@sha256:):reason`
43
+ * resolves to `{toolPattern, argPattern}` at `GET /api/v1/policy/resolve`
44
+ * (the demo doctor's "argPattern served" check proves that half). This module
45
+ * used to be where the other half died: `ResolvedPolicy` did not declare
46
+ * `argPattern`, `toGuardPattern` did not carry it, and the rule reached all
47
+ * twelve tool-call gates as "block `shell` unconditionally" — simultaneously
48
+ * failing to enforce the argument condition and re-manufacturing the exact
49
+ * over-blocking (`make test` refused) the WHERE grammar was invented to
50
+ * eliminate. It now travels: verbatim in the JSON's `sopRules` and `rules`,
51
+ * base64-encoded in the `.rules` projection's seventh column (see
52
+ * `RULES_COLUMNS` in gateBody.ts for the encoding contract), and every gate
53
+ * family conditions a name-matched rule on it before firing.
54
+ *
55
+ * @module
56
+ */
57
+ import { type GuardPattern } from '../harness/protectedPaths.js';
58
+ /** Directory every gate looks in. Inside `.intutic/hooks`, which is already
59
+ * protected — see the module note. */
60
+ export declare const DEFAULT_SNAPSHOT_DIR: string;
61
+ export declare const SNAPSHOT_JSON = "policy-snapshot.json";
62
+ export declare const SNAPSHOT_RULES = "policy-snapshot.rules";
63
+ /**
64
+ * Whether the destructive tier ships as `block` or as `warn`.
65
+ *
66
+ * `warn`. These seven patterns qualify for `block` on the merits — every one is
67
+ * unrecoverable without a reinstall or a backup — but they have never run
68
+ * against real developer traffic, and they would land on thirteen harnesses at
69
+ * once. A false positive here does not merely annoy: the fastest workaround
70
+ * available to a blocked developer is `chflags nouchg` on the hook, which is the
71
+ * exact bypass `GOVERNANCE_BYPASS_PATTERNS` exists to stop. Shipping too hard
72
+ * manufactures our own adversary.
73
+ *
74
+ * So they ride the advisory tier first and earn promotion from
75
+ * `tool_flagged` telemetry — the same discipline `sslGateEvaluator.ts` follows
76
+ * for SSL enforcement, and the same one `packages/proxy/src/plugins/anomaly`
77
+ * states as the promotion rule. Flipping this constant is the promotion, and it
78
+ * belongs in a commit alongside the measurement that licenses it.
79
+ *
80
+ * Shipping them *through the snapshot* rather than compiling them into the gate
81
+ * is the other half: the set we are least sure about is the set we can retract
82
+ * in one sync cycle instead of one release.
83
+ */
84
+ export declare const DESTRUCTIVE_TIER_SEVERITY: 'block' | 'warn';
85
+ /**
86
+ * Whether the skill-directory-write tier ships as `block` or as `warn`.
87
+ *
88
+ * `block` — deliberately not following `DESTRUCTIVE_TIER_SEVERITY`'s warn-first
89
+ * ramp, because the thing that ramp is buying time for does not exist on this
90
+ * surface. `DESTRUCTIVE_COMMAND_PATTERNS` rides at `warn` because those seven
91
+ * families are unmeasured against real developer traffic and a false positive
92
+ * has a real cost (see that constant's own comment). `SKILL_SURFACE_PATTERNS`
93
+ * is not that kind of rule: it does not run `scanSkillContent` or judge
94
+ * anything about what a skill file says, only WHERE a write's target path
95
+ * points — `.agents/skills/**` or `.claude/skills/**`, a deterministic,
96
+ * zero-ambiguity match. TD-358 (`docs/TECH_DEBT.md`) says this about exactly
97
+ * that distinction: "Path-matching is the one exception, and it is not
98
+ * actually an exception to the measurement requirement — it never needed
99
+ * one." There is no false-positive rate to earn a promotion by measuring,
100
+ * because there is nothing probabilistic here to measure in the first place.
101
+ *
102
+ * The second half of the argument is what `warn` actually buys on this
103
+ * surface, and the answer is nothing. `SECRET_CONTENT_PATTERNS`
104
+ * (`harness/protectedPaths.ts`) skips the warn-first ramp for the same reason
105
+ * and states the principle this constant now follows: "A warn that lets the
106
+ * write proceed IS the incident." A poisoned skill file written under
107
+ * warn-only is not a near-miss sitting in telemetry waiting for a human to
108
+ * notice — it is a file on disk that the very next agent session loads and
109
+ * trusts as instructions, the same way it trusts its own system prompt. Warn
110
+ * logs the write and lets it land anyway, so there is no window in which the
111
+ * advisory tier protected anything. That is what makes this different from
112
+ * `DESTRUCTIVE_COMMAND_PATTERNS`: a destructive *command*'s warn tier buys a
113
+ * chance for a human to notice before the damage is done; a skill file, once
114
+ * written, already is the damage.
115
+ *
116
+ * Shipped *through the snapshot* rather than promoted in place in
117
+ * `staticFloorPatterns()`, for the same operational reason
118
+ * `DESTRUCTIVE_TIER_SEVERITY` is: the rollout, not the mechanism, is the thing
119
+ * still short on field time, and the snapshot channel is what makes it
120
+ * retractable in one sync cycle instead of one release if that turns out
121
+ * wrong. `staticFloorPatterns()` keeps its two `SKILL_SURFACE_PATTERNS`
122
+ * entries at `warn` — unchanged by this constant — as the degraded-mode
123
+ * baseline for a workspace with no snapshot, or an invalid one; this constant
124
+ * is what promotes the steady state to `block` everywhere a valid snapshot has
125
+ * landed. Flipping it back to `'warn'` is the retraction, exactly as it is for
126
+ * `DESTRUCTIVE_TIER_SEVERITY`.
127
+ */
128
+ export declare const SKILL_SURFACE_TIER_SEVERITY: 'block' | 'warn';
129
+ /** Rules the control plane resolved for this workspace. Mirrors the
130
+ * `GET /api/v1/policy/resolve` response — including `argPattern`, the
131
+ * ` WHERE ` clause of a SOP title. This type is where that field used to
132
+ * fall on the floor: resolve served it, the type did not declare it, and the
133
+ * gates enforced the rule as an unconditional tool-name block. */
134
+ export interface ResolvedPolicy {
135
+ workspaceId: string;
136
+ sopRules: Array<{
137
+ id: string;
138
+ toolPattern: string;
139
+ argPattern?: string;
140
+ action: string;
141
+ reason: string;
142
+ /**
143
+ * LLD #71: `'guardrail'` on rules the control plane projects from a cited
144
+ * policy guardrail. The only origin for which `action: 'warn'` is shipped
145
+ * (at severity `warn`, report-only); every other warn rule is still
146
+ * dropped, the HIGH/CRITICAL catch-all included.
147
+ */
148
+ origin?: string;
149
+ }>;
150
+ interventionMode: string;
151
+ /**
152
+ * Per-server MCP allowlist, absorbed verbatim from `allowedServers` on
153
+ * `GET /api/v1/policy/resolve` (confirmed against `evaluate.ts` and
154
+ * `lib/mcpCuration.ts` — both the daemon-mode and stdio-mode routes read
155
+ * this same field name off `workspaces.settings`, so this is not a new
156
+ * name invented for the snapshot). Absent/empty means unrestricted — the
157
+ * MCP proxy already reads it that way (`packages/mcp-proxy/src/policy.ts`),
158
+ * and the gate-side `#mcpservers` header this field feeds
159
+ * (`writePolicySnapshot` below) preserves the same convention: an empty
160
+ * list omits the header entirely rather than shipping a deny-everything one.
161
+ */
162
+ mcpAllowedServers: string[];
163
+ /**
164
+ * Wave 7 (audit-remediation): promotes `destructive.sql_drop` from `warn`
165
+ * to `block` in `buildSnapshotRules` below — a per-rule override, not a
166
+ * flip of `DESTRUCTIVE_TIER_SEVERITY`. Absent/wrongly-typed degrades to
167
+ * `false` (stays `warn`), the same fail-safe direction every other field
168
+ * here degrades in.
169
+ */
170
+ sqlDropStrictBlock: boolean;
171
+ }
172
+ export interface PolicySnapshotOptions {
173
+ controlPlaneUrl: string;
174
+ apiKey: string;
175
+ workspaceId: string;
176
+ /** Override the directory (tests). */
177
+ snapshotDir?: string;
178
+ /**
179
+ * `review_before:` tokens from the workspace's local SOPs and settings
180
+ * (`parseSopConstraints(...).reviewBefore`). Each becomes a `hold` rule,
181
+ * `sop.local.review_before.<token>`, so every gate holds on them — not only
182
+ * the Claude Code hook that used to bake them in (TD-474 item 4).
183
+ */
184
+ localHoldTokens?: readonly string[];
185
+ }
186
+ /**
187
+ * Decides whether a control-plane rule is safe to put on a blocking path.
188
+ *
189
+ * Returns the reason for rejection, or `null` if the rule is fine. Rejections
190
+ * are logged rather than thrown: one bad SOP must not cost the workspace every
191
+ * other rule.
192
+ */
193
+ export declare function validateRule(toolPattern: string, ruleId: string): string | null;
194
+ /** Fetches resolved policy for the workspace. Returns null on any failure —
195
+ * the caller keeps the previous snapshot rather than replacing it with nothing. */
196
+ export declare function fetchResolvedPolicy(opts: PolicySnapshotOptions): Promise<ResolvedPolicy | null>;
197
+ /** Builds the rule set a snapshot would carry, without writing it. Exported so
198
+ * a test can assert the contents rather than re-deriving them. */
199
+ export declare function buildSnapshotRules(policy: ResolvedPolicy, localHoldTokens?: readonly string[]): GuardPattern[];
200
+ /**
201
+ * Writes the snapshot atomically.
202
+ *
203
+ * Two artifacts from one source: the canonical JSON, and a tab-separated
204
+ * `.rules` projection so the five bash gates need no JSON parser on the decision
205
+ * path. Both carry the same digest, so a test — and the gate — can tell that the
206
+ * projection really came from the JSON.
207
+ */
208
+ export declare function writePolicySnapshot(policy: ResolvedPolicy, snapshotDir?: string, localHoldTokens?: readonly string[]): Promise<{
209
+ digest: string;
210
+ ruleCount: number;
211
+ }>;
212
+ /**
213
+ * Fetch and write in one call. Safe to run on every sync cycle.
214
+ *
215
+ * Never throws: policy refresh must not be able to take down the sync loop. A
216
+ * failed fetch leaves the previous snapshot in place, which is the correct
217
+ * degradation — stale rules stay enforced. If they expired into permissiveness,
218
+ * "kill the daemon and wait" would be a supported way to disarm governance.
219
+ */
220
+ export declare function refreshPolicySnapshot(opts: PolicySnapshotOptions): Promise<{
221
+ digest: string;
222
+ ruleCount: number;
223
+ } | null>;
224
+ //# sourceMappingURL=policySnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policySnapshot.d.ts","sourceRoot":"","sources":["../../src/lib/policySnapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAQH,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAA;AAIrC;uCACuC;AACvC,eAAO,MAAM,oBAAoB,QAA+C,CAAA;AAChF,eAAO,MAAM,aAAa,yBAAyB,CAAA;AACnD,eAAO,MAAM,cAAc,0BA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