dsh-logicprobe 0.5.0 → 0.5.2

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.
@@ -1,171 +1,171 @@
1
- export declare const ENGINE_SCHEMA_VERSION = 1;
2
- export type VarValue = number | boolean;
3
- export type GuardOp = '==' | '!=' | '<' | '<=' | '>' | '>=';
4
- export interface LeafGuard {
5
- variable: string;
6
- op: GuardOp;
7
- value: VarValue;
8
- }
9
- export interface AllGuard {
10
- all: GuardNode[];
11
- }
12
- export interface AnyGuard {
13
- any: GuardNode[];
14
- }
15
- export interface NotGuard {
16
- not: GuardNode;
17
- }
18
- export type GuardNode = LeafGuard | AllGuard | AnyGuard | NotGuard;
19
- export interface StateSpec {
20
- id: string;
21
- terminal?: boolean;
22
- }
23
- export interface UpdateSpec {
24
- variable: string;
25
- op: 'set' | 'inc' | 'dec';
26
- value?: number;
27
- }
28
- export interface TransitionSpec {
29
- from: string;
30
- event: string;
31
- to: string;
32
- /** Absent guard is the else/default branch for the same (from, event) group. */
33
- guard?: GuardNode;
34
- updates?: UpdateSpec[];
35
- }
36
- export interface VariableSpec {
37
- name: string;
38
- kind: 'integer' | 'boolean';
39
- init: number | boolean;
40
- min?: number;
41
- max?: number;
42
- monotonic?: 'inc' | 'dec';
43
- }
44
- export type InvariantSpec = {
45
- id: string;
46
- description: string;
47
- kind: 'never-states';
48
- states: string[];
49
- } | {
50
- id: string;
51
- description: string;
52
- kind: 'var-in-range';
53
- variable: string;
54
- min?: number;
55
- max?: number;
56
- } | {
57
- id: string;
58
- description: string;
59
- kind: 'event-before-state';
60
- event: string;
61
- state: string;
62
- } | {
63
- id: string;
64
- description: string;
65
- kind: 'leads-to';
66
- from: string;
67
- to: string;
68
- } | {
69
- id: string;
70
- description: string;
71
- kind: 'sequence';
72
- events: string[];
73
- } | {
74
- id: string;
75
- description: string;
76
- kind: 'atomicity';
77
- events: string[];
78
- commit: string;
79
- rollback?: string;
80
- };
81
- export interface ResourcePairSpec {
82
- resource: string;
83
- acquireEvent: string;
84
- releaseEvent: string;
85
- failEvent?: string;
86
- }
87
- export interface BoundaryCheckSpec {
88
- variable: string;
89
- values: number[];
90
- }
91
- export interface LogicModelV1 {
92
- schemaVersion: 1;
93
- init: string;
94
- states: StateSpec[];
95
- transitions: TransitionSpec[];
96
- variables?: VariableSpec[];
97
- invariants?: InvariantSpec[];
98
- concurrentPairs?: [string, string][];
99
- boundaryChecks?: BoundaryCheckSpec[];
100
- resourcePairs?: ResourcePairSpec[];
101
- idempotentEvents?: string[];
102
- }
103
- export interface VerificationOptions {
104
- maxStates?: number;
105
- maxPermutationEvents?: number;
106
- beforeModel?: unknown;
107
- stateMapping?: Record<string, string>;
108
- }
109
- export interface PathStep {
110
- from: string;
111
- event: string;
112
- to: string;
113
- }
114
- export interface Finding {
115
- code: string;
116
- severity: 'error' | 'warning';
117
- message: string;
118
- path?: PathStep[];
119
- evidence?: Record<string, unknown>;
120
- }
121
- export interface CheckResult {
122
- id: string;
123
- name: string;
124
- status: 'pass' | 'fail' | 'skip';
125
- detail: string;
126
- findings: Finding[];
127
- }
128
- export interface VerificationReport {
129
- ok: boolean;
130
- schemaVersion: 1;
131
- modelHash: string;
132
- summary: {
133
- states: number;
134
- transitions: number;
135
- errors: number;
136
- warnings: number;
137
- checksRun: number;
138
- truncated?: boolean;
139
- };
140
- checks: CheckResult[];
141
- comparison?: ComparisonSummary;
142
- }
143
- export interface ComparisonSummary {
144
- beforeModelHash: string;
145
- afterModelHash: string;
146
- stateMapping: Record<string, string>;
147
- beforeStates: number;
148
- beforeTransitions: number;
149
- afterStates: number;
150
- afterTransitions: number;
151
- addedStates: string[];
152
- removedStates: string[];
153
- addedEvents: string[];
154
- removedEvents: string[];
155
- addedTransitions: TransitionSpec[];
156
- removedTransitions: TransitionSpec[];
157
- }
158
- export interface RuntimeState {
159
- state: string;
160
- vars: Record<string, VarValue>;
161
- }
162
- export declare function modelHash(model: LogicModelV1): string;
163
- export declare function validateModel(input: unknown): {
164
- ok: true;
165
- model: LogicModelV1;
166
- } | {
167
- ok: false;
168
- errors: string[];
169
- };
170
- export declare function guardVariables(guard: GuardNode | undefined): string[];
171
- export declare function runVerification(input: unknown, options?: VerificationOptions): VerificationReport;
1
+ export declare const ENGINE_SCHEMA_VERSION = 1;
2
+ export type VarValue = number | boolean;
3
+ export type GuardOp = '==' | '!=' | '<' | '<=' | '>' | '>=';
4
+ export interface LeafGuard {
5
+ variable: string;
6
+ op: GuardOp;
7
+ value: VarValue;
8
+ }
9
+ export interface AllGuard {
10
+ all: GuardNode[];
11
+ }
12
+ export interface AnyGuard {
13
+ any: GuardNode[];
14
+ }
15
+ export interface NotGuard {
16
+ not: GuardNode;
17
+ }
18
+ export type GuardNode = LeafGuard | AllGuard | AnyGuard | NotGuard;
19
+ export interface StateSpec {
20
+ id: string;
21
+ terminal?: boolean;
22
+ }
23
+ export interface UpdateSpec {
24
+ variable: string;
25
+ op: 'set' | 'inc' | 'dec';
26
+ value?: number;
27
+ }
28
+ export interface TransitionSpec {
29
+ from: string;
30
+ event: string;
31
+ to: string;
32
+ /** Absent guard is the else/default branch for the same (from, event) group. */
33
+ guard?: GuardNode;
34
+ updates?: UpdateSpec[];
35
+ }
36
+ export interface VariableSpec {
37
+ name: string;
38
+ kind: 'integer' | 'boolean';
39
+ init: number | boolean;
40
+ min?: number;
41
+ max?: number;
42
+ monotonic?: 'inc' | 'dec';
43
+ }
44
+ export type InvariantSpec = {
45
+ id: string;
46
+ description: string;
47
+ kind: 'never-states';
48
+ states: string[];
49
+ } | {
50
+ id: string;
51
+ description: string;
52
+ kind: 'var-in-range';
53
+ variable: string;
54
+ min?: number;
55
+ max?: number;
56
+ } | {
57
+ id: string;
58
+ description: string;
59
+ kind: 'event-before-state';
60
+ event: string;
61
+ state: string;
62
+ } | {
63
+ id: string;
64
+ description: string;
65
+ kind: 'leads-to';
66
+ from: string;
67
+ to: string;
68
+ } | {
69
+ id: string;
70
+ description: string;
71
+ kind: 'sequence';
72
+ events: string[];
73
+ } | {
74
+ id: string;
75
+ description: string;
76
+ kind: 'atomicity';
77
+ events: string[];
78
+ commit: string;
79
+ rollback?: string;
80
+ };
81
+ export interface ResourcePairSpec {
82
+ resource: string;
83
+ acquireEvent: string;
84
+ releaseEvent: string;
85
+ failEvent?: string;
86
+ }
87
+ export interface BoundaryCheckSpec {
88
+ variable: string;
89
+ values: number[];
90
+ }
91
+ export interface LogicModelV1 {
92
+ schemaVersion: 1;
93
+ init: string;
94
+ states: StateSpec[];
95
+ transitions: TransitionSpec[];
96
+ variables?: VariableSpec[];
97
+ invariants?: InvariantSpec[];
98
+ concurrentPairs?: [string, string][];
99
+ boundaryChecks?: BoundaryCheckSpec[];
100
+ resourcePairs?: ResourcePairSpec[];
101
+ idempotentEvents?: string[];
102
+ }
103
+ export interface VerificationOptions {
104
+ maxStates?: number;
105
+ maxPermutationEvents?: number;
106
+ beforeModel?: unknown;
107
+ stateMapping?: Record<string, string>;
108
+ }
109
+ export interface PathStep {
110
+ from: string;
111
+ event: string;
112
+ to: string;
113
+ }
114
+ export interface Finding {
115
+ code: string;
116
+ severity: 'error' | 'warning';
117
+ message: string;
118
+ path?: PathStep[];
119
+ evidence?: Record<string, unknown>;
120
+ }
121
+ export interface CheckResult {
122
+ id: string;
123
+ name: string;
124
+ status: 'pass' | 'fail' | 'skip';
125
+ detail: string;
126
+ findings: Finding[];
127
+ }
128
+ export interface VerificationReport {
129
+ ok: boolean;
130
+ schemaVersion: 1;
131
+ modelHash: string;
132
+ summary: {
133
+ states: number;
134
+ transitions: number;
135
+ errors: number;
136
+ warnings: number;
137
+ checksRun: number;
138
+ truncated?: boolean;
139
+ };
140
+ checks: CheckResult[];
141
+ comparison?: ComparisonSummary;
142
+ }
143
+ export interface ComparisonSummary {
144
+ beforeModelHash: string;
145
+ afterModelHash: string;
146
+ stateMapping: Record<string, string>;
147
+ beforeStates: number;
148
+ beforeTransitions: number;
149
+ afterStates: number;
150
+ afterTransitions: number;
151
+ addedStates: string[];
152
+ removedStates: string[];
153
+ addedEvents: string[];
154
+ removedEvents: string[];
155
+ addedTransitions: TransitionSpec[];
156
+ removedTransitions: TransitionSpec[];
157
+ }
158
+ export interface RuntimeState {
159
+ state: string;
160
+ vars: Record<string, VarValue>;
161
+ }
162
+ export declare function modelHash(model: LogicModelV1): string;
163
+ export declare function validateModel(input: unknown): {
164
+ ok: true;
165
+ model: LogicModelV1;
166
+ } | {
167
+ ok: false;
168
+ errors: string[];
169
+ };
170
+ export declare function guardVariables(guard: GuardNode | undefined): string[];
171
+ export declare function runVerification(input: unknown, options?: VerificationOptions): VerificationReport;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-logicprobe",
3
- "version": "0.5.0",
4
- "description": "Design document & plan claim verification — enumerate claims, verify against codebase facts, then escalate to logic-primitive verification (7 structural checks + 7 adversarial probes) for behavioral claims. Before/after model comparison for refactoring regression detection. Ships a native DeepSeek Harness (dsh) bundle that injects the claim-verification gate into the first model step.",
3
+ "version": "0.5.2",
4
+ "description": "Design document & plan claim verification — enumerate claims, verify against codebase facts, then escalate to state-machine verification (S1-S8/A1-A11) and data-model verification (DS/DA/DD) for behavioral claims. Supports before/after regression, idempotency/monotonic/sequence/leads-to/atomicity constraints, and concurrency risk mining. Ships a native DeepSeek Harness (dsh) bundle that injects the claim-verification gate into the first model step.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",
@@ -20,6 +20,9 @@
20
20
  "cordis.patch.yml"
21
21
  ],
22
22
  "dsh": {
23
+ "engines": {
24
+ "dsh": ">=0.1.1-rc.1"
25
+ },
23
26
  "category": "skill",
24
27
  "displayName": "逻辑探针",
25
28
  "bundle": {
@@ -36,8 +39,8 @@
36
39
  "peerDependencies": {
37
40
  "@deepseek-ai/cordis": "^4.0.1",
38
41
  "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
39
- "@deepseek-ai/dsh-llm": "^0.0.1-rc.1",
40
- "@deepseek-ai/dsh-session": "^0.0.1-rc.1",
42
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
43
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.6",
41
44
  "@deepseek-ai/dsh-skill-filesystem": "^0.1.0-rc.6",
42
45
  "@deepseek-ai/schemastery": "^3.18.1",
43
46
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.6"
@@ -47,13 +50,13 @@
47
50
  "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
48
51
  "@deepseek-ai/dsh-cordis-host-runner": "^0.1.0-rc.6",
49
52
  "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6",
50
- "@deepseek-ai/dsh-llm": "^0.0.1-rc.1",
53
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
51
54
  "@deepseek-ai/dsh-scope": "^0.1.0-rc.6",
52
- "@deepseek-ai/dsh-session": "^0.0.1-rc.1",
55
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.6",
53
56
  "@deepseek-ai/dsh-skill": "^0.1.0-rc.6",
54
57
  "@deepseek-ai/dsh-skill-filesystem": "^0.1.0-rc.6",
55
58
  "@deepseek-ai/schemastery": "^3.18.1",
56
- "@deepseek-ai/dsh-timeout": "^0.0.1-rc.1",
59
+ "@deepseek-ai/dsh-timeout": "^0.1.0-rc.6",
57
60
  "@types/node": "^20.0.0",
58
61
  "typescript": "^5.0.0",
59
62
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",