@coderifts/agent-guard 1.8.0 → 2.0.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.
- package/README.md +68 -23
- package/dist/cjs/deploy-gate.d.ts +10 -3
- package/dist/cjs/deploy-gate.d.ts.map +1 -1
- package/dist/cjs/deploy-gate.js +7 -0
- package/dist/cjs/deploy-gate.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/merge-gate.d.ts +10 -3
- package/dist/cjs/merge-gate.d.ts.map +1 -1
- package/dist/cjs/merge-gate.js +6 -0
- package/dist/cjs/merge-gate.js.map +1 -1
- package/dist/cjs/tool-registry.d.ts.map +1 -1
- package/dist/cjs/tool-registry.js +7 -0
- package/dist/cjs/tool-registry.js.map +1 -1
- package/dist/cjs/with-coderifts.d.ts +108 -87
- package/dist/cjs/with-coderifts.d.ts.map +1 -1
- package/dist/cjs/with-coderifts.js +129 -114
- package/dist/cjs/with-coderifts.js.map +1 -1
- package/dist/esm/deploy-gate.d.ts +10 -3
- package/dist/esm/deploy-gate.d.ts.map +1 -1
- package/dist/esm/deploy-gate.js +7 -0
- package/dist/esm/deploy-gate.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/merge-gate.d.ts +10 -3
- package/dist/esm/merge-gate.d.ts.map +1 -1
- package/dist/esm/merge-gate.js +6 -0
- package/dist/esm/merge-gate.js.map +1 -1
- package/dist/esm/tool-registry.d.ts.map +1 -1
- package/dist/esm/tool-registry.js +7 -0
- package/dist/esm/tool-registry.js.map +1 -1
- package/dist/esm/with-coderifts.d.ts +108 -87
- package/dist/esm/with-coderifts.d.ts.map +1 -1
- package/dist/esm/with-coderifts.js +126 -113
- package/dist/esm/with-coderifts.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,106 +15,88 @@
|
|
|
15
15
|
* `composition_assurance` so the trace survives into any later coverageReport consumer. S2 adds NO
|
|
16
16
|
* enforcement at call time.
|
|
17
17
|
*
|
|
18
|
-
* COMPOSITION OBSERVATION
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* coverage, residuals, or whether any tool runs.
|
|
18
|
+
* COMPOSITION OBSERVATION: optional `onEvent` is forwarded UNCHANGED onto the guard config.
|
|
19
|
+
* Optional `onSettledCall` is a composition-level hook: it fires EXACTLY ONCE for every SETTLED
|
|
20
|
+
* call through the RETURNED tool table (GUARDED | PASSTHROUGH | BYPASSED × RETURNED | THREW).
|
|
21
|
+
* Discriminant is an EXPLICIT TAG (`kind: 'settled_call'` plus route/terminal), never the absence of
|
|
22
|
+
* a field. On the GUARDED+RETURNED arm, `outcome` is non-optional. Observation is NOT enforcement —
|
|
23
|
+
* it does not change COMPOSITION_CALL_POLICY_COMPLETE, coverage, residuals, or whether any tool runs.
|
|
24
|
+
* The package holds NO counters and computes NO ratios at runtime; pure fold helpers are optional
|
|
25
|
+
* host-side tools (see foldTableSettledCalls / guardedFractionAmongRoutes).
|
|
24
26
|
*
|
|
25
27
|
* TELEMETRY GAPS (honest boundaries — read before claiming "every mutation was checked"):
|
|
26
28
|
* - onEvent does NOT emit a dedicated event for BLOCK or REQUIRE_APPROVAL; after preflight_result
|
|
27
|
-
* those paths return blocked with no further emit. Those outcomes ARE visible via
|
|
28
|
-
* (outcome.executed === false, outcome.verdict.kind === 'BLOCK' | 'APPROVAL')
|
|
29
|
+
* those paths return blocked with no further emit. Those outcomes ARE visible via onSettledCall
|
|
30
|
+
* on the GUARDED arm (outcome.executed === false, outcome.verdict.kind === 'BLOCK' | 'APPROVAL').
|
|
29
31
|
* - The GuardEvent payload carries no envelope, receipt, or fingerprint — only optional decisionId
|
|
30
|
-
* (and action/cause/signals/…).
|
|
31
|
-
* outcome.verdict.envelope where the frozen path attached one
|
|
32
|
-
* -
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* (and action/cause/signals/…). GUARDED+RETURNED onSettledCall carries the full GuardOutcome,
|
|
33
|
+
* including outcome.verdict.envelope where the frozen path attached one.
|
|
34
|
+
* - onSettledCall sees ONLY calls through the table withCodeRifts returned. Host-invoked raw tools
|
|
35
|
+
* outside that table are invisible. Never treat observation as "total operations" or "100%
|
|
36
|
+
* enforcement coverage".
|
|
35
37
|
* - onEvent is partial even for other branches (e.g. closed-availability stops may emit only
|
|
36
38
|
* preflight_start; the declared type 'execution_skipped' is never emitted by the frozen core).
|
|
37
39
|
* - Neither hook alone is a complete substrate for receipt carry-forward: onEvent lacks the
|
|
38
|
-
* envelope/receipt;
|
|
39
|
-
* across calls (that is a later slice).
|
|
40
|
+
* envelope/receipt; onSettledCall exposes them when present on the GUARDED+RETURNED arm but does
|
|
41
|
+
* not retain or re-inject them across calls (that is a later slice).
|
|
40
42
|
*
|
|
41
43
|
* S2 does NOT re-guard what the registry already fails closed on. A `forceReadonly`/`classify`
|
|
42
44
|
* downgrade of a heuristic mutator is, under the registry's default `failOnUnguardedMutator:true`,
|
|
43
45
|
* already a thrown `FORCE_READONLY_MUTATOR` (no report exists); when the caller passes
|
|
44
46
|
* `failOnUnguardedMutator:false` it is already registry coverage 'BYPASSED', which fails any
|
|
45
|
-
* `requireCoverage` above BYPASSED by the ordering alone.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* composition_unknown_treated_as_readonly) so the reason the composition is narrower than it looks is
|
|
49
|
-
* preserved on the assurance object. Registry-thrown errors propagate UNCHANGED (never wrapped or
|
|
50
|
-
* swallowed).
|
|
51
|
-
*
|
|
52
|
-
* How the weakening residuals are derived, and their KNOWN LIMITATION (a frozen-registry property, not
|
|
53
|
-
* a composition property): both residuals are read SOLELY from `registry_report.warnings` — the
|
|
54
|
-
* composition never recomputes classification. The registry emits `force_readonly_on_mutator_heuristic`
|
|
55
|
-
* ONLY for the downgrade of a HEURISTIC-classified mutator (a tool with no `classify` entry and no
|
|
56
|
-
* `mutationClass`, whose NAME heuristic is mutating), reached via `forceReadonly` OR a `classify`
|
|
57
|
-
* entry. Crucially, `forceReadonly` has NO effect on a tool the caller declared with an explicit
|
|
58
|
-
* `mutationClass`: `resolveClass` (tool-registry.ts:154-165) returns on `tool.mutationClass` at :157,
|
|
59
|
-
* BEFORE `forceReadonly` is consulted at :158 — so such a tool resolves `mutating`, stays guarded,
|
|
60
|
-
* yields coverage 'COMPLETE', and emits NO warning. The composition therefore produces NO residual in
|
|
61
|
-
* that case and CANNOT detect it: the caller's `forceReadonly` was silently ignored by the frozen
|
|
62
|
-
* registry. This is a limitation of the frozen registry surface, recorded (not worked around) here and
|
|
63
|
-
* pinned by a "documented limitation" test. The residual is named
|
|
64
|
-
* `composition_forced_readonly_on_heuristic_mutator` so it does not promise coverage of the case it
|
|
65
|
-
* cannot see.
|
|
47
|
+
* `requireCoverage` above BYPASSED by the ordering alone. The composition RECORDS residuals from
|
|
48
|
+
* registry warnings. When forceReadonly lists a tool that declared explicit mutationClass, the
|
|
49
|
+
* registry emits `force_readonly_ignored_explicit_mutation_class:<name>` (break-glass ignored).
|
|
66
50
|
*
|
|
67
51
|
* COMPOSITION_CALL_POLICY_COMPLETE (when the composition may claim product-level runtime
|
|
68
52
|
* inescapability) requires ALL of the following — do not flip the constant when only a subset lands:
|
|
69
53
|
* (1) Automatic binders for call shapes that ALREADY carry both sides of the change (old_string/
|
|
70
|
-
* new_string, edits[]) — DONE
|
|
71
|
-
* every real agent edit shape.
|
|
54
|
+
* new_string, edits[]) — DONE. Not the same as covering every real agent edit shape.
|
|
72
55
|
* (2) Receipt carry-forward (S5) — host-threaded chaining is POSSIBLE (optional previousReceipt +
|
|
73
|
-
* verifyReceiptChainLinkage
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* where the host never supplied `before` — NOT done. The package performs no IO, so a prior it
|
|
77
|
-
* was not given cannot be obtained; inventing one (including empty-string before) would send a
|
|
78
|
-
* fabricated artifact to the oracle. That needs a host/guard freshness protocol, not another
|
|
79
|
-
* binder rename. Flipping this constant on (1)+(2) alone is incorrect.
|
|
80
|
-
*
|
|
81
|
-
* STILL DELIBERATELY OUT OF SCOPE (later slices; not stubbed, not implied here): receipt carry-forward;
|
|
82
|
-
* freshness-safe prior content for write-style calls; call-time STOP re-implementation (already
|
|
83
|
-
* complete in the frozen guardToolCall path); WARN monitoring policy beyond the frozen sink gate;
|
|
84
|
-
* framework adapters. (Both-sides edit-side lifting in defaultBinder is landed — see (1) above.)
|
|
56
|
+
* verifyReceiptChainLinkage). NOT met for this constant: the composition holds no cursor.
|
|
57
|
+
* (3) A freshness-safe source of prior content for write-style calls (path + new content only) —
|
|
58
|
+
* NOT done.
|
|
85
59
|
*
|
|
86
60
|
* THE TWO-SCOPE RULE (never merged):
|
|
87
|
-
* - `registry_report` is EXACTLY what `guardToolRegistry` returned, passed through untouched.
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
61
|
+
* - `registry_report` is EXACTLY what `guardToolRegistry` returned, passed through untouched.
|
|
62
|
+
* - `composition_assurance` is the narrower PRODUCT-level statement, computed SEPARATELY.
|
|
63
|
+
*/
|
|
64
|
+
import { guardToolRegistry } from './tool-registry.js';
|
|
65
|
+
/**
|
|
66
|
+
* Pure fold: count routes in a host-owned list of settled-call observations.
|
|
67
|
+
* The package never accumulates these at runtime.
|
|
68
|
+
*/
|
|
69
|
+
export function foldTableSettledCalls(events) {
|
|
70
|
+
const counts = { GUARDED: 0, PASSTHROUGH: 0, BYPASSED: 0 };
|
|
71
|
+
for (const e of events) {
|
|
72
|
+
if (e.kind !== 'settled_call')
|
|
73
|
+
continue;
|
|
74
|
+
counts[e.route] += 1;
|
|
75
|
+
}
|
|
76
|
+
return counts;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Fraction of GUARDED among observed routes, or ABSENT when a ratio would be misleading.
|
|
103
80
|
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* therefore governs generic mutating tools and acts as the session-level default; it does NOT override
|
|
108
|
-
* a deploy-class tool's 'deploy'. It is mandatory because receipts bind to an operation and
|
|
109
|
-
* merge != deploy: a silent default would risk evaluating a deploy under merge semantics.
|
|
81
|
+
* Returns `kind: 'absent'` (not zero) when:
|
|
82
|
+
* - no settled calls were observed, or
|
|
83
|
+
* - only a single route tag has a non-zero count (one-sided observation).
|
|
110
84
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* requireCoverage-vs-actual check is necessarily sequenced AFTER the registry call (it needs the
|
|
114
|
-
* registry's coverage), so it is its own abort; it cannot be batched with the pre-registry problems
|
|
115
|
-
* because a valid operation+client are required even to reach the registry.
|
|
85
|
+
* Never returns a number that could be read as "0% enforcement" or "100% coverage" from partial data.
|
|
86
|
+
* The package does not call this automatically.
|
|
116
87
|
*/
|
|
117
|
-
|
|
88
|
+
export function guardedFractionAmongRoutes(counts) {
|
|
89
|
+
const routesWithCalls = ['GUARDED', 'PASSTHROUGH', 'BYPASSED']
|
|
90
|
+
.filter((r) => counts[r] > 0);
|
|
91
|
+
if (routesWithCalls.length === 0) {
|
|
92
|
+
return { kind: 'absent', why: 'no_settled_calls' };
|
|
93
|
+
}
|
|
94
|
+
if (routesWithCalls.length === 1) {
|
|
95
|
+
return { kind: 'absent', why: 'one_route_only' };
|
|
96
|
+
}
|
|
97
|
+
const sum = counts.GUARDED + counts.PASSTHROUGH + counts.BYPASSED;
|
|
98
|
+
return { kind: 'present', fraction: counts.GUARDED / sum };
|
|
99
|
+
}
|
|
118
100
|
/**
|
|
119
101
|
* Whether the composition's call-time / content policy is complete enough to claim product-level
|
|
120
102
|
* runtime inescapability. Stays FALSE until EVERY condition below is delivered — later slices ADD
|
|
@@ -122,23 +104,15 @@ import { guardToolRegistry } from './tool-registry.js';
|
|
|
122
104
|
*
|
|
123
105
|
* Conditions (all required; do NOT flip this constant because a subset landed):
|
|
124
106
|
* (1) DONE — automatic binders for shapes that already carry both edit sides (old_string/new_string,
|
|
125
|
-
* edits[] → artifacts).
|
|
107
|
+
* edits[] → artifacts). Does NOT cover write-style path+new-content-only calls.
|
|
126
108
|
* (2) NOT DONE — receipt carry-forward (S5).
|
|
127
|
-
* (3) NOT DONE — freshness-safe prior content for write-style calls.
|
|
128
|
-
* `before` the host never supplied cannot be obtained; inventing one (including empty string)
|
|
129
|
-
* fabricates an oracle input. Needs a host/guard freshness protocol, not binder renaming.
|
|
130
|
-
*
|
|
131
|
-
* Historically this comment named only (1) and (2). That wording is narrower than reality: after (1)
|
|
132
|
-
* shipped, a reader could think "binders + S5" was enough and flip the flag incorrectly. Do not.
|
|
109
|
+
* (3) NOT DONE — freshness-safe prior content for write-style calls.
|
|
133
110
|
*
|
|
134
111
|
* UNCHANGED by S2 / composition observation (observing ≠ enforcing). Value stays false until all three.
|
|
135
112
|
*/
|
|
136
113
|
const COMPOSITION_CALL_POLICY_COMPLETE = false;
|
|
137
114
|
const RESIDUAL_CALL_POLICY_INCOMPLETE = 'composition_call_policy_incomplete';
|
|
138
115
|
// S2 weakening-override residuals — derived SOLELY from registry report.warnings (never recomputed).
|
|
139
|
-
// The name says "heuristic_mutator" on purpose: the registry only emits the underlying warning for a
|
|
140
|
-
// downgrade of a HEURISTIC-classified mutator (see the header limitation), so the residual must not
|
|
141
|
-
// promise coverage of a downgrade it cannot see (an explicit-mutationClass tool).
|
|
142
116
|
const RESIDUAL_FORCED_READONLY = 'composition_forced_readonly_on_heuristic_mutator';
|
|
143
117
|
const RESIDUAL_UNKNOWN_READONLY = 'composition_unknown_treated_as_readonly';
|
|
144
118
|
/**
|
|
@@ -161,25 +135,23 @@ function coverageRank(coverage) {
|
|
|
161
135
|
: undefined;
|
|
162
136
|
}
|
|
163
137
|
/**
|
|
164
|
-
* Invoke
|
|
138
|
+
* Invoke onSettledCall without affecting the host call. Swallows synchronous throws AND rejected
|
|
165
139
|
* promises (unlike the frozen emit hook, which only try/catches sync throws and ignores returned
|
|
166
140
|
* promises — that host-side footgun is deliberately not reproduced here).
|
|
167
141
|
*/
|
|
168
|
-
async function
|
|
142
|
+
async function safeOnSettledCall(onSettledCall, payload) {
|
|
169
143
|
try {
|
|
170
|
-
await Promise.resolve(
|
|
144
|
+
await Promise.resolve(onSettledCall(payload));
|
|
171
145
|
}
|
|
172
146
|
catch {
|
|
173
147
|
/* observation never changes execution */
|
|
174
148
|
}
|
|
175
149
|
}
|
|
176
150
|
/**
|
|
177
|
-
* Build a NEW ProtectedTool shell
|
|
178
|
-
*
|
|
179
|
-
* copied by reference (the _coderifts bag is already frozen by the registry). The new shell is
|
|
180
|
-
* frozen for parity with registry tools.
|
|
151
|
+
* Build a NEW ProtectedTool shell so we can observe settle without mutating the frozen registry object.
|
|
152
|
+
* name / description / inputSchema / meta / _coderifts are copied by reference.
|
|
181
153
|
*/
|
|
182
|
-
function
|
|
154
|
+
function wrapForSettledCallObservation(tool, route, onSettledCall) {
|
|
183
155
|
const innerExecute = tool.execute;
|
|
184
156
|
const toolName = tool.name;
|
|
185
157
|
const shell = {
|
|
@@ -189,22 +161,63 @@ function wrapGuardedForObservation(tool, onOutcome) {
|
|
|
189
161
|
meta: tool.meta,
|
|
190
162
|
_coderifts: tool._coderifts,
|
|
191
163
|
execute: async (args) => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
164
|
+
try {
|
|
165
|
+
const result = await innerExecute(args);
|
|
166
|
+
if (route === 'GUARDED') {
|
|
167
|
+
await safeOnSettledCall(onSettledCall, {
|
|
168
|
+
kind: 'settled_call',
|
|
169
|
+
route: 'GUARDED',
|
|
170
|
+
terminal: 'RETURNED',
|
|
171
|
+
toolName,
|
|
172
|
+
// Guarded execute always returns a GuardOutcome from guardToolCall.
|
|
173
|
+
outcome: result,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
await safeOnSettledCall(onSettledCall, {
|
|
178
|
+
kind: 'settled_call',
|
|
179
|
+
route,
|
|
180
|
+
terminal: 'RETURNED',
|
|
181
|
+
toolName,
|
|
182
|
+
result,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// Host must receive the same object/value the unwrapped tool returned (reference-identical for objects).
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
await safeOnSettledCall(onSettledCall, {
|
|
190
|
+
kind: 'settled_call',
|
|
191
|
+
route,
|
|
192
|
+
terminal: 'THREW',
|
|
193
|
+
toolName,
|
|
194
|
+
error,
|
|
195
|
+
});
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
201
198
|
},
|
|
202
199
|
};
|
|
203
|
-
// Match registry freeze discipline: freeze _coderifts if not already, freeze the shell.
|
|
204
200
|
if (!Object.isFrozen(shell._coderifts))
|
|
205
201
|
Object.freeze(shell._coderifts);
|
|
206
202
|
return Object.freeze(shell);
|
|
207
203
|
}
|
|
204
|
+
/** Tools forced to readonly via heuristic break-glass — observed as BYPASSED, not true PASSTHROUGH. */
|
|
205
|
+
function bypassedToolNames(report) {
|
|
206
|
+
const names = new Set();
|
|
207
|
+
for (const w of report.warnings) {
|
|
208
|
+
const prefix = 'force_readonly_on_mutator_heuristic:';
|
|
209
|
+
if (w.startsWith(prefix))
|
|
210
|
+
names.add(w.slice(prefix.length));
|
|
211
|
+
}
|
|
212
|
+
return names;
|
|
213
|
+
}
|
|
214
|
+
function routeForTool(tool, bypassed) {
|
|
215
|
+
if (tool._coderifts.guarded)
|
|
216
|
+
return 'GUARDED';
|
|
217
|
+
if (bypassed.has(tool.name))
|
|
218
|
+
return 'BYPASSED';
|
|
219
|
+
return 'PASSTHROUGH';
|
|
220
|
+
}
|
|
208
221
|
/**
|
|
209
222
|
* Wrap guardToolRegistry with a mandatory operation and a separately-computed composition assurance.
|
|
210
223
|
* Fails at CONSTRUCTION (never at first tool call) for a missing client, a missing/empty operation, an
|
|
@@ -294,14 +307,14 @@ export function withCodeRifts(input) {
|
|
|
294
307
|
inescapable_runtime: compositionInescapableRuntime,
|
|
295
308
|
residuals,
|
|
296
309
|
};
|
|
297
|
-
//
|
|
298
|
-
// We cannot reassign execute on a frozen tool, so we build NEW shells for
|
|
299
|
-
//
|
|
300
|
-
// The tools ARRAY is also frozen by the registry — always return a fresh array when we wrap.
|
|
310
|
+
// Settled-call observation: registry returns FROZEN ProtectedTool objects (and a frozen tools array).
|
|
311
|
+
// We cannot reassign execute on a frozen tool, so we build NEW shells for EVERY tool in the table
|
|
312
|
+
// when onSettledCall is provided — including passthrough and forced-bypass (readonly) tools.
|
|
301
313
|
let toolsOut = tools;
|
|
302
|
-
if (input.
|
|
303
|
-
const
|
|
304
|
-
|
|
314
|
+
if (input.onSettledCall) {
|
|
315
|
+
const onSettledCall = input.onSettledCall;
|
|
316
|
+
const bypassed = bypassedToolNames(report);
|
|
317
|
+
toolsOut = Object.freeze(tools.map((t) => wrapForSettledCallObservation(t, routeForTool(t, bypassed), onSettledCall)));
|
|
305
318
|
}
|
|
306
319
|
const result = {
|
|
307
320
|
tools: toolsOut,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-coderifts.js","sourceRoot":"","sources":["../../src/with-coderifts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"with-coderifts.js","sourceRoot":"","sources":["../../src/with-coderifts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oB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AK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC,CAC1E,CAAC;IACvB,CAAC;IAED,MAAM,MAAM,GAAwB;QAClC,KAAK,EAAE,QAAQ;QACf,eAAe,EAAE,MAAM;QACvB,qBAAqB;KACtB,CAAC;IACF,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACzE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderifts/agent-guard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Fail-closed guard for AI agent tool calls — preflight contract changes before they execute. Security core frozen (agent-guard-api v1.0); v1.1 adds client-side enforcement: receipt→envelope binding, decision↔action reconciliation, safe_for_agent + degraded fail-closed, and enforced⟺executed (P0 client-enforcement pack).",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|