dsh-logicprobe 0.3.1 → 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.
Files changed (34) hide show
  1. package/README.en-US.md +7 -1
  2. package/README.md +9 -2
  3. package/lib/concurrency-tool.js +34 -0
  4. package/lib/concurrency.js +76 -0
  5. package/lib/data-engine.js +930 -0
  6. package/lib/data-tool.js +61 -0
  7. package/lib/engine.js +1622 -1103
  8. package/lib/index.js +291 -277
  9. package/lib/tool.js +57 -45
  10. package/lib/types/concurrency-tool.d.ts +8 -0
  11. package/lib/types/concurrency.d.ts +20 -0
  12. package/lib/types/data-engine.d.ts +199 -0
  13. package/lib/types/data-tool.d.ts +10 -0
  14. package/lib/types/engine.d.ts +171 -133
  15. package/lib/types/tool.d.ts +4 -2
  16. package/package.json +79 -78
  17. package/skills/logicprobe/SKILL.md +285 -266
  18. package/skills/logicprobe/references/__pycache__/verification-harness.cpython-312.pyc +0 -0
  19. package/skills/logicprobe/references/concurrency-risk-guide.md +54 -0
  20. package/skills/logicprobe/references/dsh-model-schema.md +145 -104
  21. package/skills/logicprobe/references/logic-verification-guide.md +463 -413
  22. package/skills/logicprobe/references/verification-harness.py +806 -582
  23. package/skills/logicprobe-datamodel/SKILL.md +124 -0
  24. package/skills/logicprobe-datamodel/references/__pycache__/data-model-harness.cpython-312.pyc +0 -0
  25. package/skills/logicprobe-datamodel/references/data-model-guide.md +62 -0
  26. package/skills/logicprobe-datamodel/references/data-model-harness.py +528 -0
  27. package/skills/logicprobe-datamodel/references/data-model-schema.md +128 -0
  28. package/src/concurrency-tool.ts +37 -0
  29. package/src/concurrency.ts +102 -0
  30. package/src/data-engine.ts +1001 -0
  31. package/src/data-tool.ts +65 -0
  32. package/src/engine.ts +533 -0
  33. package/src/index.ts +315 -301
  34. package/src/tool.ts +60 -48
package/src/tool.ts CHANGED
@@ -1,48 +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. This is the dsh-native replacement for hand-filling the
10
- * Python template shipped in the skill references.
11
- */
12
- export const logicProbeVerifyTool = defineTool({
13
- name: LOGICPROBE_VERIFY_TOOL_NAME,
14
- description:
15
- '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, and event-before-state. Returns a report with S1-S7 structural checks and A1-A7 adversarial probes including shortest counterexample paths. See skills/logicprobe/references/dsh-model-schema.md.',
16
- parameters: {
17
- model: {
18
- type: 'json',
19
- required: true,
20
- description: 'LogicModelV1 state machine model to verify.',
21
- },
22
- maxStates: {
23
- type: 'integer',
24
- description: 'Maximum runtime states to explore. Default 10000.',
25
- },
26
- maxPermutationEvents: {
27
- type: 'integer',
28
- description: 'Maximum event count for A3 order permutation. Default 5.',
29
- },
30
- },
31
- output: {
32
- schema: {
33
- type: 'json',
34
- description: 'logicprobe verification report with summary and per-check findings.',
35
- },
36
- render(_args, value) {
37
- return [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }]
38
- },
39
- },
40
- timeoutMs: 10_000,
41
- isConcurrencySafe: () => true,
42
- async execute(args) {
43
- return runVerification(args.model, {
44
- maxStates: args.maxStates,
45
- maxPermutationEvents: args.maxPermutationEvents,
46
- }) as unknown as JsonValue
47
- },
48
- })
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
+ })