@wyattjoh/demur 0.5.0 → 0.7.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 +82 -25
- package/extensions/demur/index.ts +99 -15
- package/extensions/demur/training-store.ts +213 -35
- package/package.json +4 -2
- package/src/adapters/pi-worker.ts +21 -7
- package/src/cli.ts +554 -135
- package/src/guard.internal.ts +83 -33
- package/src/guard.ts +42 -2
- package/src/judge.ts +53 -7
- package/src/policy.ts +10 -1
- package/src/questions.ts +9 -1
- package/src/settings-model.ts +60 -0
- package/src/state.ts +14 -16
- package/src/training-evaluation.ts +408 -0
- package/src/training-review-model.ts +18 -2
- package/src/training-review-tui.tsx +408 -44
- package/src/types.ts +56 -0
package/src/types.ts
CHANGED
|
@@ -5,6 +5,24 @@ import type { CommandAnalysis } from "./analyze.ts";
|
|
|
5
5
|
*/
|
|
6
6
|
export type Host = "pi" | "claude-code" | "cli";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* JSON-compatible value accepted by the TypeSafe state boundary.
|
|
10
|
+
*/
|
|
11
|
+
export type JsonValue =
|
|
12
|
+
| string
|
|
13
|
+
| number
|
|
14
|
+
| boolean
|
|
15
|
+
| null
|
|
16
|
+
| ReadonlyArray<JsonValue>
|
|
17
|
+
| { readonly [key: string]: JsonValue };
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Exact JSON object submitted as TypeSafe state for one command.
|
|
21
|
+
*/
|
|
22
|
+
export type RenderedCommandState = {
|
|
23
|
+
readonly [key: string]: JsonValue;
|
|
24
|
+
};
|
|
25
|
+
|
|
8
26
|
/**
|
|
9
27
|
* Everything demur knows about a command before judging it.
|
|
10
28
|
*
|
|
@@ -160,3 +178,41 @@ export type Verdict = {
|
|
|
160
178
|
*/
|
|
161
179
|
usage: { inputTokens: number; outputTokens: number } | undefined;
|
|
162
180
|
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Reproducible inputs and implementation versions behind one guard verdict.
|
|
184
|
+
*/
|
|
185
|
+
export type GuardEvidence = {
|
|
186
|
+
/**
|
|
187
|
+
* Exact JSON state submitted to TypeSafe.
|
|
188
|
+
*/
|
|
189
|
+
modelState: RenderedCommandState;
|
|
190
|
+
/**
|
|
191
|
+
* Deterministic command analysis used only by the local policy gate.
|
|
192
|
+
*/
|
|
193
|
+
analysis: CommandAnalysis | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* TypeSafe model identifier used for the judgment.
|
|
196
|
+
*/
|
|
197
|
+
model: string;
|
|
198
|
+
/**
|
|
199
|
+
* Version of the question definitions used for the judgment.
|
|
200
|
+
*/
|
|
201
|
+
questionSetVersion: number;
|
|
202
|
+
/**
|
|
203
|
+
* Version of the policy composition used for the verdict.
|
|
204
|
+
*/
|
|
205
|
+
policyVersion: number;
|
|
206
|
+
/**
|
|
207
|
+
* Exact numeric thresholds used for the verdict.
|
|
208
|
+
*/
|
|
209
|
+
policyThresholds: { readonly [key: string]: number };
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Guard verdict paired with replayable evidence when state collection occurred.
|
|
214
|
+
*/
|
|
215
|
+
export type GuardEvaluation = {
|
|
216
|
+
verdict: Verdict;
|
|
217
|
+
evidence: GuardEvidence | undefined;
|
|
218
|
+
};
|