dsh-logicprobe 0.6.8 → 0.7.1

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/lib/tool.js CHANGED
@@ -12,7 +12,7 @@ export const LOGICPROBE_VERIFY_TOOL_NAME = 'logicprobe_verify';
12
12
  */
13
13
  export const logicProbeVerifyTool = defineTool({
14
14
  name: LOGICPROBE_VERIFY_TOOL_NAME,
15
- description: '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.',
15
+ description: '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.',
16
16
  parameters: {
17
17
  model: {
18
18
  type: 'json',
@@ -65,6 +65,18 @@ export interface VariableSpec {
65
65
  max?: number;
66
66
  monotonic?: 'inc' | 'dec';
67
67
  }
68
+ /**
69
+ * Scope filter for a state-predicate invariant (see `InvariantSpec`): the range is
70
+ * only required to hold in runtime states that satisfy the filter. Exactly one of
71
+ * `state` / guard-node form must be present.
72
+ */
73
+ export interface StateGuard {
74
+ /** Only runtime states whose id is this state are checked. */
75
+ state: string;
76
+ }
77
+ /** A `when` filter: either a single-state scope or the ordinary guard language. */
78
+ export type InvariantWhen = StateGuard | GuardNode;
79
+ export declare function isStateGuard(when: InvariantWhen): when is StateGuard;
68
80
  export type InvariantSpec = {
69
81
  id: string;
70
82
  description: string;
@@ -77,6 +89,16 @@ export type InvariantSpec = {
77
89
  variable: string;
78
90
  min?: number;
79
91
  max?: number;
92
+ /**
93
+ * Optional scope. `when` is evaluated against the POST-state of every transition
94
+ * (and, for the `{ state }` form, against the initial state regardless), so a
95
+ * `{ state }` scope is sound: for every reachable runtime state inside the scope
96
+ * the variable is in range. A guard-node scope that references the constrained
97
+ * variable can mask its own violation — prefer `{ state }` or an independent
98
+ * control variable. Not offered on trace-property kinds (leads-to, sequence, ...),
99
+ * whose scope over a path would be ambiguous.
100
+ */
101
+ when?: InvariantWhen;
80
102
  } | {
81
103
  id: string;
82
104
  description: string;
@@ -1,54 +1,60 @@
1
- /**
2
- * logicprobe — DeepSeek Harness native plugin for the Logic Probe toolbox.
3
- * Injects the session-start gate text (claim-verification doctrine, 1% Rule,
4
- * Red Flags, proactive suggestion) into the first model step of every agent
5
- * session, mirroring the SessionStart hook the Claude Code plugin installs.
6
- * The skill ships in this package's `skills/` directory and is registered at
7
- * apply time into dsh's `ctx.skills` registry through the standard filesystem
8
- * provider, so it appears in every session catalog without a manual copy step.
9
- *
10
- * Injection listens on agent/pre-step and appends the gate to the FIRST
11
- * model step that runs, once per session (guarded by the session's durable
12
- * history). Session-start inbox injection was dropped: a blank-session preset
13
- * switch (agentPreset.select -> recompose) can clear the inbox before the
14
- * first step, losing the gate for the whole session. The pre-step decision is
15
- * the durable path - anchored/bootstrap presets that strip first-step injected
16
- * reminders (skill catalog, AGENTS.md, gate plugins) simply defer this message
17
- * to the first step after their promotion, and the history guard re-injects it
18
- * there. The default gate text is the dsh-native adaptation of
19
- * `hooks/session-start-content.md`: behavior rules
20
- * (1% Rule / Red Flags / proactive suggestion) stay in sync, while
21
- * presentation is adapted to dsh's native skill catalog — the trigger list
22
- * lives in the skill description, not duplicated in the gate. Deployments
23
- * override via Config.
24
- *
25
- * @module logicprobe-dsh
26
- */
27
- import type { Context } from '@deepseek-ai/cordis';
28
- import z from '@deepseek-ai/schemastery';
29
- import type { ContextFormed } from '@deepseek-ai/dsh-llm';
30
- declare module '@deepseek-ai/dsh-llm' {
31
- interface MessageSourceMap {
32
- 'plugin:logicprobe': {
33
- kind: 'plugin:logicprobe';
34
- } & ContextFormed;
35
- }
36
- }
37
- export declare const name = "logicprobe";
38
- export declare const inject: string[];
39
- export type InteractionMode = 'ask' | 'auto' | 'follow-approval';
40
- export interface Config {
41
- enabled: boolean;
42
- gateContent: string;
43
- interaction: InteractionMode;
44
- }
45
- export declare const Config: z<Schemastery.ObjectS<{
46
- enabled: z<boolean, boolean>;
47
- gateContent: z<string, string>;
48
- interaction: z<"ask" | "auto" | "follow-approval", "ask" | "auto" | "follow-approval">;
49
- }>, Schemastery.ObjectT<{
50
- enabled: z<boolean, boolean>;
51
- gateContent: z<string, string>;
52
- interaction: z<"ask" | "auto" | "follow-approval", "ask" | "auto" | "follow-approval">;
53
- }>>;
54
- export declare function apply(ctx: Context, config: Config): void;
1
+ /**
2
+ * logicprobe — DeepSeek Harness native plugin for the Logic Probe toolbox.
3
+ * Injects the session-start gate text (claim-verification doctrine, 1% Rule,
4
+ * Red Flags, proactive suggestion) into the first model step of every agent
5
+ * session, mirroring the SessionStart hook the Claude Code plugin installs.
6
+ * The skill ships in this package's `skills/` directory and is registered at
7
+ * apply time into dsh's `ctx.skills` registry through the standard filesystem
8
+ * provider, so it appears in every session catalog without a manual copy step.
9
+ *
10
+ * Injection listens on agent/pre-step and appends the gate to the FIRST
11
+ * model step that runs, once per session (guarded by the session's durable
12
+ * history). Session-start inbox injection was dropped: a blank-session preset
13
+ * switch (agentPreset.select -> recompose) can clear the inbox before the
14
+ * first step, losing the gate for the whole session. The pre-step decision is
15
+ * the durable path - anchored/bootstrap presets that strip first-step injected
16
+ * reminders (skill catalog, AGENTS.md, gate plugins) simply defer this message
17
+ * to the first step after their promotion, and the history guard re-injects it
18
+ * there. The default gate text is the dsh-native adaptation of
19
+ * `hooks/session-start-content.md`: behavior rules
20
+ * (1% Rule / Red Flags / proactive suggestion) stay in sync, while
21
+ * presentation is adapted to dsh's native skill catalog — the trigger list
22
+ * lives in the skill description, not duplicated in the gate. Deployments
23
+ * override via Config.
24
+ *
25
+ * @module logicprobe-dsh
26
+ */
27
+ import type { Context, Volatile } from '@deepseek-ai/cordis';
28
+ import z from '@deepseek-ai/schemastery';
29
+ import type { ContextFormed } from '@deepseek-ai/dsh-llm';
30
+ declare module '@deepseek-ai/dsh-llm' {
31
+ interface MessageSourceMap {
32
+ 'plugin:logicprobe': {
33
+ kind: 'plugin:logicprobe';
34
+ } & ContextFormed;
35
+ }
36
+ }
37
+ export declare const name = "logicprobe";
38
+ export declare const inject: string[];
39
+ export type InteractionMode = 'ask' | 'auto' | 'follow-approval';
40
+ export interface Config {
41
+ /**
42
+ * The injection switch the Web client's Plugins page edits live: a `Volatile`
43
+ * reference on a host whose schemastery supports one, an ordinary boolean on a
44
+ * host that predates `.volatile()`. Read it through {@link injectionEnabled},
45
+ * which accepts both shapes.
46
+ */
47
+ enabled: Volatile<boolean> | boolean;
48
+ gateContent: string;
49
+ interaction: InteractionMode;
50
+ }
51
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
52
+ enabled: z<boolean, boolean, "defined">;
53
+ gateContent: z<string, string, "defined">;
54
+ interaction: z<"ask" | "auto" | "follow-approval", "ask" | "auto" | "follow-approval", "defined">;
55
+ }>>, Schemastery.ObjectT<NoInfer<{
56
+ enabled: z<boolean, boolean, "defined">;
57
+ gateContent: z<string, string, "defined">;
58
+ interaction: z<"ask" | "auto" | "follow-approval", "ask" | "auto" | "follow-approval", "defined">;
59
+ }>>, "plain">;
60
+ export declare function apply(ctx: Context, config: Config): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-logicprobe",
3
- "version": "0.6.8",
3
+ "version": "0.7.1",
4
4
  "description": "Design document & plan claim verification — enumerate claims, verify against codebase facts, then escalate to state-machine verification (S1-S8/A1-A12, including budget/worst-case path-cost checks) 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",
@@ -11,6 +11,7 @@
11
11
  "default": "./lib/index.js"
12
12
  },
13
13
  "./cordis.patch.yml": "./cordis.patch.yml",
14
+ "./client": "./lib/client.js",
14
15
  "./package.json": "./package.json"
15
16
  },
16
17
  "files": [
@@ -28,8 +29,16 @@
28
29
  "bundle": {
29
30
  "patch": "./cordis.patch.yml"
30
31
  },
32
+ "client": {
33
+ "platform": "web",
34
+ "inject": [
35
+ "@deepseek-ai/dsh-client-locale",
36
+ "@deepseek-ai/dsh-client-ui-settings",
37
+ "@deepseek-ai/dsh-client-ui-plugin-manager"
38
+ ]
39
+ },
31
40
  "compatibility": {
32
- "dsh": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5 || ^0.1.2-rc.1 || ^0.1.3-alpha.1 || ^0.1.3-alpha.2 || ^0.1.5-alpha.1 || ^0.1.5-rc.1 || ^0.1.5-alpha.2 || ^0.1.5-rc.2 || ^0.1.6-alpha.1 || ^0.1.6-alpha.2 || ^0.1.7-alpha.1",
41
+ "dsh": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5 || ^0.1.2-rc.1 || ^0.1.3-alpha.1 || ^0.1.3-alpha.2 || ^0.1.5-alpha.1 || ^0.1.5-rc.1 || ^0.1.5-alpha.2 || ^0.1.5-rc.2 || ^0.1.5-rc.3 || ^0.1.6-alpha.1 || ^0.1.6-alpha.2 || ^0.1.7-alpha.1 || ^0.1.7-alpha.2 || ^0.1.7-rc.1 || ^0.1.7-rc.2 || ^0.2.0-rc.1",
33
42
  "dshReleases": {
34
43
  "0.1.0-rc.7": "compatible",
35
44
  "0.1.0-rc.8": "compatible",
@@ -46,34 +55,41 @@
46
55
  "0.1.5-alpha.2": "compatible",
47
56
  "0.1.5-rc.1": "compatible",
48
57
  "0.1.5-rc.2": "compatible",
58
+ "0.1.5-rc.3": "compatible",
49
59
  "0.1.6-alpha.1": "compatible",
50
60
  "0.1.6-alpha.2": "compatible",
51
- "0.1.7-alpha.1": "compatible"
61
+ "0.1.7-alpha.1": "compatible",
62
+ "0.1.7-alpha.2": "compatible",
63
+ "0.1.7-rc.1": "compatible",
64
+ "0.1.7-rc.2": "compatible",
65
+ "0.2.0-rc.1": "compatible",
66
+ "0.2.0-rc.2": "compatible"
52
67
  },
53
68
  "profiles": [
54
- "headless"
69
+ "headless",
70
+ "web"
55
71
  ]
56
72
  }
57
73
  },
58
74
  "scripts": {
59
- "build": "tsc -p tsconfig.json",
75
+ "build": "tsc -p tsconfig.json && node scripts/build-client.mjs",
60
76
  "typecheck": "tsc -p tsconfig.json --noEmit",
61
77
  "bump": "node scripts/bump-version.mjs",
62
- "test:engine": "npm run build && node tests/engine/run.mjs && node tests/data-engine/run.mjs && node tests/concurrency/run.mjs && node tests/apply-smoke.mjs && node tests/exporters/run.mjs && node tests/external/run.mjs && node tests/python/run.mjs",
78
+ "test:engine": "npm run build && node tests/engine/run.mjs && node tests/data-engine/run.mjs && node tests/concurrency/run.mjs && node tests/apply-smoke.mjs && node tests/dsh-client-half.test.mjs && node tests/dsh-volatile-fallback.test.mjs && node tests/exporters/run.mjs && node tests/external/run.mjs && node tests/python/run.mjs",
63
79
  "test:full": "npm run build && node tests/full-suite.mjs",
64
80
  "test:python": "npm run build && node tests/python/run.mjs"
65
81
  },
66
82
  "peerDependencies": {
67
- "@deepseek-ai/cordis": "^4.0.2",
68
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
69
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
70
- "@deepseek-ai/dsh-session": "^0.1.0-rc.6",
71
- "@deepseek-ai/dsh-skill-filesystem": "^0.1.0-rc.8",
72
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
73
- "@deepseek-ai/schemastery": "^3.18.2"
83
+ "@deepseek-ai/cordis": "^4.0.4",
84
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.6 || ^0.2.0-rc.1",
85
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.2.0-rc.1",
86
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.6 || ^0.2.0-rc.1",
87
+ "@deepseek-ai/dsh-skill-filesystem": "^0.1.0-rc.8 || ^0.2.0-rc.1",
88
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.6 || ^0.2.0-rc.1",
89
+ "@deepseek-ai/schemastery": "^3.18.4"
74
90
  },
75
91
  "devDependencies": {
76
- "@deepseek-ai/cordis": "^4.0.2",
92
+ "@deepseek-ai/cordis": "^4.0.4",
77
93
  "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
78
94
  "@deepseek-ai/dsh-cordis-host-runner": "^0.1.0-rc.8",
79
95
  "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.8",
@@ -85,8 +101,8 @@
85
101
  "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.6",
86
102
  "@deepseek-ai/dsh-timeout": "^0.1.0-rc.6",
87
103
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
88
- "@deepseek-ai/schemastery": "^3.18.2",
89
- "@types/node": "^26.5.1",
104
+ "@deepseek-ai/schemastery": "^3.18.4",
105
+ "@types/node": "^26.6.2",
90
106
  "typescript": "^7.0.2"
91
107
  },
92
108
  "author": {