@gobing-ai/ts-rule-engine 0.3.17 → 0.3.18

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 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAIH,KAAK,oBAAoB,EAE5B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAqB,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGhH,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAC9B,+DAA+D;IAC/D,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,mCAAmC;IACnC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,kEAAkE;IAClE,MAAM,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IACpC,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,4EAA4E;AAC5E,qBAAa,UAAU;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAE9B,OAAO,C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IAI5B;;;;;;;;;;;;;;;;;;OAkBG;IACG,iBAAiB,CACnB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,OAAgB,EAC5B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAC3C,OAAO,CAAC,gBAAgB,CAAC;IAmK5B;;;;;;;OAOG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAG1G"}
package/dist/engine.js CHANGED
@@ -128,6 +128,7 @@ export class RuleEngine {
128
128
  ruleId: rule.id,
129
129
  findings: ruleFindings.length,
130
130
  durationMs,
131
+ details: ruleFindings,
131
132
  });
132
133
  // Persist eval completion.
133
134
  await this.persistence?.updateEvalRun({
package/dist/events.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ConstraintFinding } from './types';
1
2
  /** Typed event map for rule-engine run observability. All events prefixed `rule.`. */
2
3
  export type RuleEngineEvents = {
3
4
  /** Emitted before the first rule is evaluated. */
@@ -11,11 +12,17 @@ export type RuleEngineEvents = {
11
12
  index: number;
12
13
  total: number;
13
14
  }) => void;
14
- /** Emitted after a single rule evaluation finishes successfully. */
15
+ /**
16
+ * Emitted after a single rule evaluation finishes successfully.
17
+ * `findings` is the count; `details` carries the actual finding objects so
18
+ * progress subscribers can render per-rule detail inline without waiting
19
+ * for the aggregate result.
20
+ */
15
21
  'rule.eval.done': (data: {
16
22
  ruleId: string;
17
23
  findings: number;
18
24
  durationMs: number;
25
+ details: ConstraintFinding[];
19
26
  }) => void;
20
27
  /** Emitted when a rule evaluator throws (in addition to the `kind:'error'` finding). */
21
28
  'rule.eval.error': (data: {
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GAAG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,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACpF;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,iBAAiB,EAAE,CAAC;KAChC,KAAK,IAAI,CAAC;IACX,wFAAwF;IACxF,iBAAiB,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,qEAAqE;IACrE,eAAe,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CACnH,CAAC"}
@@ -7,5 +7,6 @@
7
7
  * unit. Timestamps are TEXT (ISO 8601) for portability across SQLite drivers
8
8
  * including D1.
9
9
  */
10
+ /** DDL for the rule-engine persistence tables (`rule_runs`, `rule_eval_runs`). */
10
11
  export declare const RULE_ENGINE_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS rule_runs (\n id TEXT PRIMARY KEY,\n preset TEXT,\n source_kind TEXT NOT NULL,\n source_value TEXT,\n status TEXT NOT NULL DEFAULT 'running',\n rule_count INTEGER NOT NULL DEFAULT 0,\n finding_count INTEGER NOT NULL DEFAULT 0,\n fix_count INTEGER NOT NULL DEFAULT 0,\n applied_fix_count INTEGER NOT NULL DEFAULT 0,\n fail_on TEXT,\n stop_on_first TEXT,\n fix_mode TEXT NOT NULL DEFAULT 'none',\n dry_run INTEGER NOT NULL DEFAULT 0,\n started_at TEXT NOT NULL,\n completed_at TEXT,\n duration_ms INTEGER,\n metadata_json TEXT NOT NULL DEFAULT '{}',\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS rule_eval_runs (\n id TEXT PRIMARY KEY,\n run_id TEXT NOT NULL REFERENCES rule_runs(id),\n rule_id TEXT NOT NULL,\n severity TEXT NOT NULL,\n evaluator TEXT NOT NULL,\n status TEXT NOT NULL DEFAULT 'running',\n finding_count INTEGER NOT NULL DEFAULT 0,\n fix_count INTEGER NOT NULL DEFAULT 0,\n duration_ms INTEGER,\n error TEXT,\n findings_json TEXT,\n fixes_json TEXT,\n started_at TEXT NOT NULL,\n completed_at TEXT,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_rule_eval_runs_run_id ON rule_eval_runs (run_id);\n";
11
12
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/persistence/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,sBAAsB,4zCA2ClC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/persistence/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,4zCA2ClC,CAAC"}
@@ -7,6 +7,7 @@
7
7
  * unit. Timestamps are TEXT (ISO 8601) for portability across SQLite drivers
8
8
  * including D1.
9
9
  */
10
+ /** DDL for the rule-engine persistence tables (`rule_runs`, `rule_eval_runs`). */
10
11
  export const RULE_ENGINE_SCHEMA_SQL = `
11
12
  CREATE TABLE IF NOT EXISTS rule_runs (
12
13
  id TEXT PRIMARY KEY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/ts-rule-engine",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "@gobing-ai/ts-rule-engine — Constraint rule schemas, loading, evaluation, and result formatting.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -49,10 +49,10 @@
49
49
  "release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-rule-engine-v<version> && git push --tags' && exit 1"
50
50
  },
51
51
  "dependencies": {
52
- "@gobing-ai/ts-ai-runner": "^0.3.17",
53
- "@gobing-ai/ts-infra": "^0.3.17",
54
- "@gobing-ai/ts-runtime": "^0.3.17",
55
- "@gobing-ai/ts-db": "^0.3.17",
52
+ "@gobing-ai/ts-ai-runner": "^0.3.18",
53
+ "@gobing-ai/ts-infra": "^0.3.18",
54
+ "@gobing-ai/ts-runtime": "^0.3.18",
55
+ "@gobing-ai/ts-db": "^0.3.18",
56
56
  "yaml": "^2.7.0",
57
57
  "zod": "^4.1.0"
58
58
  },
package/src/engine.ts CHANGED
@@ -180,6 +180,7 @@ export class RuleEngine {
180
180
  ruleId: rule.id,
181
181
  findings: ruleFindings.length,
182
182
  durationMs,
183
+ details: ruleFindings,
183
184
  });
184
185
 
185
186
  // Persist eval completion.
package/src/events.ts CHANGED
@@ -1,11 +1,23 @@
1
+ import type { ConstraintFinding } from './types';
2
+
1
3
  /** Typed event map for rule-engine run observability. All events prefixed `rule.`. */
2
4
  export type RuleEngineEvents = {
3
5
  /** Emitted before the first rule is evaluated. */
4
6
  'rule.run.start': (data: { rules: number; total: number }) => void;
5
7
  /** Emitted immediately before a single rule's evaluator is invoked. */
6
8
  'rule.eval.start': (data: { ruleId: string; index: number; total: number }) => void;
7
- /** Emitted after a single rule evaluation finishes successfully. */
8
- 'rule.eval.done': (data: { ruleId: string; findings: number; durationMs: number }) => void;
9
+ /**
10
+ * Emitted after a single rule evaluation finishes successfully.
11
+ * `findings` is the count; `details` carries the actual finding objects so
12
+ * progress subscribers can render per-rule detail inline without waiting
13
+ * for the aggregate result.
14
+ */
15
+ 'rule.eval.done': (data: {
16
+ ruleId: string;
17
+ findings: number;
18
+ durationMs: number;
19
+ details: ConstraintFinding[];
20
+ }) => void;
9
21
  /** Emitted when a rule evaluator throws (in addition to the `kind:'error'` finding). */
10
22
  'rule.eval.error': (data: { ruleId: string; error: string }) => void;
11
23
  /** Emitted after the last rule finishes (or was short-circuited). */
@@ -8,6 +8,7 @@
8
8
  * including D1.
9
9
  */
10
10
 
11
+ /** DDL for the rule-engine persistence tables (`rule_runs`, `rule_eval_runs`). */
11
12
  export const RULE_ENGINE_SCHEMA_SQL = `
12
13
  CREATE TABLE IF NOT EXISTS rule_runs (
13
14
  id TEXT PRIMARY KEY,