dsh-logicprobe 0.6.8 → 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/src/tool.ts CHANGED
@@ -1,61 +1,61 @@
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 22-check report (S1-S8 structural, A1-A14), or a 26-check
10
- * report when beforeModel is supplied (D1 behavioral preservation, D2
11
- * invariant continuity, D3 regression delta, D4 deadlock/liveness regression).
12
- * This is the dsh-native replacement for hand-filling the Python template
13
- * shipped in the skill references.
14
- */
15
- export const logicProbeVerifyTool = defineTool({
16
- name: LOGICPROBE_VERIFY_TOOL_NAME,
17
- description:
18
- 'Run executable state-machine verification (logicprobe). Takes a LogicModelV1 object with schemaVersion=1, init, states ({id, terminal?}), transitions ({from, event, to, guard?, updates?, cost?}), variables?, invariants?, concurrentPairs?, boundaryChecks?, resourcePairs?, idempotentEvents?, narrative?. Guards are structured ({variable, op, value} | {all} | {any} | {not}); invariants support never-states, var-in-range, event-before-state, leads-to, sequence, atomicity, budget (transition cost defaults to 1; A12 checks every reachable path stays within the declared budget and reports the shortest over-budget counterexample), and probability (transition weight, default 1, makes the model a DTMC; A13 checks P(hit target) against the bound by value iteration). Variables support monotonic inc/dec. The optional narrative block carries natural-language descriptions of states (narrative.states), events (narrative.events), and (state, event) scenarios (narrative.scenarios: [{from, event, scenario}]); when present it must fully cover the model and is echoed in the report. Returns a report with S1-S8 structural checks and A1-A13 adversarial/probability 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.',
19
- parameters: {
20
- model: {
21
- type: 'json',
22
- required: true,
23
- description: 'LogicModelV1 state machine model to verify.',
24
- },
25
- maxStates: {
26
- type: 'integer',
27
- description: 'Maximum runtime states to explore. Default 10000.',
28
- },
29
- maxPermutationEvents: {
30
- type: 'integer',
31
- description: 'Maximum event count for A3 order permutation. Default 5.',
32
- },
33
- beforeModel: {
34
- type: 'json',
35
- description: 'Optional BEFORE LogicModelV1 state machine model for refactoring/migration regression comparison.',
36
- },
37
- stateMapping: {
38
- type: 'json',
39
- description: 'Optional object mapping BEFORE state ids to AFTER state ids. Omit for identity mapping (same state names).',
40
- },
41
- },
42
- output: {
43
- schema: {
44
- type: 'json',
45
- description: 'logicprobe verification report with summary and per-check findings.',
46
- },
47
- render(_args, value) {
48
- return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
49
- },
50
- },
51
- timeoutMs: 10_000,
52
- isConcurrencySafe: () => true,
53
- async execute(args) {
54
- return runVerification(args.model, {
55
- maxStates: args.maxStates,
56
- maxPermutationEvents: args.maxPermutationEvents,
57
- beforeModel: args.beforeModel,
58
- stateMapping: args.stateMapping as Record<string, string> | undefined,
59
- }) as unknown as JsonValue
60
- },
61
- })
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 22-check report (S1-S8 structural, A1-A14), or a 26-check
10
+ * report when beforeModel is supplied (D1 behavioral preservation, D2
11
+ * invariant continuity, D3 regression delta, D4 deadlock/liveness regression).
12
+ * This is the dsh-native replacement for hand-filling the Python template
13
+ * shipped in the skill references.
14
+ */
15
+ export const logicProbeVerifyTool = defineTool({
16
+ name: LOGICPROBE_VERIFY_TOOL_NAME,
17
+ description:
18
+ 'Run executable state-machine verification (logicprobe). Takes a LogicModelV1 object with schemaVersion=1, init, states ({id, terminal?}), transitions ({from, event, to, guard?, updates?, cost?}), variables?, invariants?, concurrentPairs?, boundaryChecks?, resourcePairs?, idempotentEvents?, narrative?. Guards are structured ({variable, op, value} | {all} | {any} | {not}); invariants support never-states, var-in-range ({variable, min?, max?, when?} — when scopes the range to a state ({state}) or a guard node, is evaluated on the post-state of every transition, leaves the initial state checked unconditionally, and is rejected on any other invariant kind), event-before-state, leads-to, sequence, atomicity, budget (transition cost defaults to 1; A12 checks every reachable path stays within the declared budget and reports the shortest over-budget counterexample), and probability (transition weight, default 1, makes the model a DTMC; A13 checks P(hit target) against the bound by value iteration). The schema is closed: an undeclared key on any model part (model, state, transition, update, variable, invariant, boundaryCheck, resourcePair, narrative, scenario) is a validation error, never ignored. Variables support monotonic inc/dec. The optional narrative block carries natural-language descriptions of states (narrative.states), events (narrative.events), and (state, event) scenarios (narrative.scenarios: [{from, event, scenario}]); when present it must fully cover the model and is echoed in the report. Returns a report with S1-S8 structural checks and A1-A13 adversarial/probability 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.',
19
+ parameters: {
20
+ model: {
21
+ type: 'json',
22
+ required: true,
23
+ description: 'LogicModelV1 state machine model to verify.',
24
+ },
25
+ maxStates: {
26
+ type: 'integer',
27
+ description: 'Maximum runtime states to explore. Default 10000.',
28
+ },
29
+ maxPermutationEvents: {
30
+ type: 'integer',
31
+ description: 'Maximum event count for A3 order permutation. Default 5.',
32
+ },
33
+ beforeModel: {
34
+ type: 'json',
35
+ description: 'Optional BEFORE LogicModelV1 state machine model for refactoring/migration regression comparison.',
36
+ },
37
+ stateMapping: {
38
+ type: 'json',
39
+ description: 'Optional object mapping BEFORE state ids to AFTER state ids. Omit for identity mapping (same state names).',
40
+ },
41
+ },
42
+ output: {
43
+ schema: {
44
+ type: 'json',
45
+ description: 'logicprobe verification report with summary and per-check findings.',
46
+ },
47
+ render(_args, value) {
48
+ return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
49
+ },
50
+ },
51
+ timeoutMs: 10_000,
52
+ isConcurrencySafe: () => true,
53
+ async execute(args) {
54
+ return runVerification(args.model, {
55
+ maxStates: args.maxStates,
56
+ maxPermutationEvents: args.maxPermutationEvents,
57
+ beforeModel: args.beforeModel,
58
+ stateMapping: args.stateMapping as Record<string, string> | undefined,
59
+ }) as unknown as JsonValue
60
+ },
61
+ })