dsh-logicprobe 0.4.0 → 0.5.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.en-US.md +7 -1
- package/README.md +7 -1
- package/lib/concurrency-tool.js +34 -0
- package/lib/concurrency.js +76 -0
- package/lib/data-engine.js +930 -0
- package/lib/data-tool.js +61 -0
- package/lib/engine.js +1622 -1364
- package/lib/index.js +291 -277
- package/lib/tool.js +57 -57
- package/lib/types/concurrency-tool.d.ts +8 -0
- package/lib/types/concurrency.d.ts +20 -0
- package/lib/types/data-engine.d.ts +199 -0
- package/lib/types/data-tool.d.ts +10 -0
- package/lib/types/engine.d.ts +171 -151
- package/package.json +79 -78
- package/skills/logicprobe/SKILL.md +285 -268
- package/skills/logicprobe/references/__pycache__/verification-harness.cpython-312.pyc +0 -0
- package/skills/logicprobe/references/concurrency-risk-guide.md +54 -0
- package/skills/logicprobe/references/dsh-model-schema.md +145 -129
- package/skills/logicprobe/references/logic-verification-guide.md +463 -413
- package/skills/logicprobe/references/verification-harness.py +806 -582
- package/skills/logicprobe-datamodel/SKILL.md +124 -0
- package/skills/logicprobe-datamodel/references/__pycache__/data-model-harness.cpython-312.pyc +0 -0
- package/skills/logicprobe-datamodel/references/data-model-guide.md +62 -0
- package/skills/logicprobe-datamodel/references/data-model-harness.py +528 -0
- package/skills/logicprobe-datamodel/references/data-model-schema.md +128 -0
- package/src/concurrency-tool.ts +37 -0
- package/src/concurrency.ts +102 -0
- package/src/data-engine.ts +1001 -0
- package/src/data-tool.ts +65 -0
- package/src/engine.ts +234 -0
- package/src/index.ts +315 -301
- package/src/tool.ts +60 -60
package/src/tool.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { defineTool, type JsonValue } from '@deepseek-ai/dsh-tools'
|
|
2
|
-
import { runVerification } from './engine.js'
|
|
3
|
-
|
|
4
|
-
export const LOGICPROBE_VERIFY_TOOL_NAME = 'logicprobe_verify'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Model-visible DSH tool wrapping the bundled TypeScript verification engine.
|
|
8
|
-
* The model passes a LogicModelV1 object; the engine validates it and returns
|
|
9
|
-
* the 14-check report, or an 18-check report when beforeModel is supplied
|
|
10
|
-
* (D1 behavioral preservation, D2 invariant continuity, D3 regression delta,
|
|
11
|
-
* D4 deadlock/liveness regression). This is the dsh-native replacement for
|
|
12
|
-
* hand-filling the Python template shipped in the skill references.
|
|
13
|
-
*/
|
|
14
|
-
export const logicProbeVerifyTool = defineTool({
|
|
15
|
-
name: LOGICPROBE_VERIFY_TOOL_NAME,
|
|
16
|
-
description:
|
|
17
|
-
'Run executable state-machine verification (logicprobe). Takes a LogicModelV1 object with schemaVersion=1, init, states ({id, terminal?}), transitions ({from, event, to, guard?, updates?}), variables?, invariants?, concurrentPairs?, boundaryChecks?, resourcePairs?. Guards are structured ({variable, op, value} | {all} | {any} | {not}); invariants support never-states, var-in-range,
|
|
18
|
-
parameters: {
|
|
19
|
-
model: {
|
|
20
|
-
type: 'json',
|
|
21
|
-
required: true,
|
|
22
|
-
description: 'LogicModelV1 state machine model to verify.',
|
|
23
|
-
},
|
|
24
|
-
maxStates: {
|
|
25
|
-
type: 'integer',
|
|
26
|
-
description: 'Maximum runtime states to explore. Default 10000.',
|
|
27
|
-
},
|
|
28
|
-
maxPermutationEvents: {
|
|
29
|
-
type: 'integer',
|
|
30
|
-
description: 'Maximum event count for A3 order permutation. Default 5.',
|
|
31
|
-
},
|
|
32
|
-
beforeModel: {
|
|
33
|
-
type: 'json',
|
|
34
|
-
description: 'Optional BEFORE LogicModelV1 state machine model for refactoring/migration regression comparison.',
|
|
35
|
-
},
|
|
36
|
-
stateMapping: {
|
|
37
|
-
type: 'json',
|
|
38
|
-
description: 'Optional object mapping BEFORE state ids to AFTER state ids. Omit for identity mapping (same state names).',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
output: {
|
|
42
|
-
schema: {
|
|
43
|
-
type: 'json',
|
|
44
|
-
description: 'logicprobe verification report with summary and per-check findings.',
|
|
45
|
-
},
|
|
46
|
-
render(_args, value) {
|
|
47
|
-
return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
timeoutMs: 10_000,
|
|
51
|
-
isConcurrencySafe: () => true,
|
|
52
|
-
async execute(args) {
|
|
53
|
-
return runVerification(args.model, {
|
|
54
|
-
maxStates: args.maxStates,
|
|
55
|
-
maxPermutationEvents: args.maxPermutationEvents,
|
|
56
|
-
beforeModel: args.beforeModel,
|
|
57
|
-
stateMapping: args.stateMapping as Record<string, string> | undefined,
|
|
58
|
-
}) as unknown as JsonValue
|
|
59
|
-
},
|
|
60
|
-
})
|
|
1
|
+
import { defineTool, type JsonValue } from '@deepseek-ai/dsh-tools'
|
|
2
|
+
import { runVerification } from './engine.js'
|
|
3
|
+
|
|
4
|
+
export const LOGICPROBE_VERIFY_TOOL_NAME = 'logicprobe_verify'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Model-visible DSH tool wrapping the bundled TypeScript verification engine.
|
|
8
|
+
* The model passes a LogicModelV1 object; the engine validates it and returns
|
|
9
|
+
* the 14-check report, or an 18-check report when beforeModel is supplied
|
|
10
|
+
* (D1 behavioral preservation, D2 invariant continuity, D3 regression delta,
|
|
11
|
+
* D4 deadlock/liveness regression). This is the dsh-native replacement for
|
|
12
|
+
* hand-filling the Python template shipped in the skill references.
|
|
13
|
+
*/
|
|
14
|
+
export const logicProbeVerifyTool = defineTool({
|
|
15
|
+
name: LOGICPROBE_VERIFY_TOOL_NAME,
|
|
16
|
+
description:
|
|
17
|
+
'Run executable state-machine verification (logicprobe). Takes a LogicModelV1 object with schemaVersion=1, init, states ({id, terminal?}), transitions ({from, event, to, guard?, updates?}), variables?, invariants?, concurrentPairs?, boundaryChecks?, resourcePairs?, idempotentEvents?. Guards are structured ({variable, op, value} | {all} | {any} | {not}); invariants support never-states, var-in-range, event-before-state, leads-to, sequence, and atomicity; variables support monotonic inc/dec. Returns a report with S1-S7 structural checks and A1-A7 adversarial probes including shortest counterexample paths. If beforeModel is provided, also runs D1-D4 before/after regression checks. See skills/logicprobe/references/dsh-model-schema.md.',
|
|
18
|
+
parameters: {
|
|
19
|
+
model: {
|
|
20
|
+
type: 'json',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'LogicModelV1 state machine model to verify.',
|
|
23
|
+
},
|
|
24
|
+
maxStates: {
|
|
25
|
+
type: 'integer',
|
|
26
|
+
description: 'Maximum runtime states to explore. Default 10000.',
|
|
27
|
+
},
|
|
28
|
+
maxPermutationEvents: {
|
|
29
|
+
type: 'integer',
|
|
30
|
+
description: 'Maximum event count for A3 order permutation. Default 5.',
|
|
31
|
+
},
|
|
32
|
+
beforeModel: {
|
|
33
|
+
type: 'json',
|
|
34
|
+
description: 'Optional BEFORE LogicModelV1 state machine model for refactoring/migration regression comparison.',
|
|
35
|
+
},
|
|
36
|
+
stateMapping: {
|
|
37
|
+
type: 'json',
|
|
38
|
+
description: 'Optional object mapping BEFORE state ids to AFTER state ids. Omit for identity mapping (same state names).',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
output: {
|
|
42
|
+
schema: {
|
|
43
|
+
type: 'json',
|
|
44
|
+
description: 'logicprobe verification report with summary and per-check findings.',
|
|
45
|
+
},
|
|
46
|
+
render(_args, value) {
|
|
47
|
+
return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
timeoutMs: 10_000,
|
|
51
|
+
isConcurrencySafe: () => true,
|
|
52
|
+
async execute(args) {
|
|
53
|
+
return runVerification(args.model, {
|
|
54
|
+
maxStates: args.maxStates,
|
|
55
|
+
maxPermutationEvents: args.maxPermutationEvents,
|
|
56
|
+
beforeModel: args.beforeModel,
|
|
57
|
+
stateMapping: args.stateMapping as Record<string, string> | undefined,
|
|
58
|
+
}) as unknown as JsonValue
|
|
59
|
+
},
|
|
60
|
+
})
|