@atsumell/trace-weave 0.1.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/LICENSE +21 -0
- package/README.ja.md +99 -0
- package/README.md +105 -0
- package/dist/ai/index.d.ts +32 -0
- package/dist/ai/index.js +121 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/builder/index.d.ts +26 -0
- package/dist/builder/index.js +47 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/chunk-35PKIXFV.js +90 -0
- package/dist/chunk-35PKIXFV.js.map +1 -0
- package/dist/chunk-AS6LZLUH.js +32 -0
- package/dist/chunk-AS6LZLUH.js.map +1 -0
- package/dist/chunk-B4SEKVLL.js +29 -0
- package/dist/chunk-B4SEKVLL.js.map +1 -0
- package/dist/chunk-EICHUHZH.js +689 -0
- package/dist/chunk-EICHUHZH.js.map +1 -0
- package/dist/chunk-WIW3TVEK.js +324 -0
- package/dist/chunk-WIW3TVEK.js.map +1 -0
- package/dist/compiler/index.d.ts +19 -0
- package/dist/compiler/index.js +24 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +37 -0
- package/dist/core/index.js.map +1 -0
- package/dist/fast-check/index.d.ts +34 -0
- package/dist/fast-check/index.js +64 -0
- package/dist/fast-check/index.js.map +1 -0
- package/dist/formula-document-ChXznpvJ.d.ts +99 -0
- package/dist/formula-expr-DAHklv9S.d.ts +111 -0
- package/dist/monitor/index.d.ts +23 -0
- package/dist/monitor/index.js +251 -0
- package/dist/monitor/index.js.map +1 -0
- package/dist/patterns/index.d.ts +61 -0
- package/dist/patterns/index.js +57 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/prepare-CrKEArDt.d.ts +8 -0
- package/dist/runtime-Do1rQFhQ.d.ts +9 -0
- package/dist/types-xatgZlwH.d.ts +35 -0
- package/dist/values-CEF1lKTL.d.ts +48 -0
- package/dist/verdict-DYG0WE3o.d.ts +7 -0
- package/dist/vitest/index.d.ts +24 -0
- package/dist/vitest/index.js +40 -0
- package/dist/vitest/index.js.map +1 -0
- package/package.json +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Atsumell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# trace-weave
|
|
2
|
+
|
|
3
|
+
English version: [README.md](./README.md)
|
|
4
|
+
|
|
5
|
+
TypeScript 向けの有限長トレース時相ロジック検証フレームワークです。
|
|
6
|
+
|
|
7
|
+
`trace-weave` はイベント列に対する時系列仕様を記述し、有限実行に対して検証できます。単発のアサーションでは表現しにくい、リクエストとレスポンスの順序、期限付き eventuality、イベント間の値相関の検査を目的にしています。
|
|
8
|
+
|
|
9
|
+
実行可能なサンプルは [examples/README.ja.md](./examples/README.ja.md) に、ドキュメント全体の入口は [docs/README.ja.md](./docs/README.ja.md) にまとめています。
|
|
10
|
+
AI agent 向けの導入ガイドは [docs/skills.ja.md](./docs/skills.ja.md) にあります。
|
|
11
|
+
|
|
12
|
+
## 要件
|
|
13
|
+
|
|
14
|
+
- Node.js 20 以上
|
|
15
|
+
- ESM 専用パッケージ
|
|
16
|
+
|
|
17
|
+
## Node サポート方針
|
|
18
|
+
|
|
19
|
+
- `trace-weave` の `0.x` 系は Node.js 20 以上をサポートします。
|
|
20
|
+
- Node.js 20 のサポートは、upstream の Node.js 20 EOL である 2026年4月30日 まで維持します。
|
|
21
|
+
- 2026年4月30日 以降は、後続の release で最小サポート version を Node.js 22 以上へ引き上げる可能性があります。その場合は release note で明示します。
|
|
22
|
+
|
|
23
|
+
## インストール
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @atsumell/trace-weave
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
任意の peer dependency:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install fast-check vitest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## クイックスタート
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { predicate, always, implies, eventually } from "@atsumell/trace-weave/builder";
|
|
39
|
+
import { predicateId } from "@atsumell/trace-weave/core";
|
|
40
|
+
import { runOracle } from "@atsumell/trace-weave/monitor";
|
|
41
|
+
|
|
42
|
+
type AppEvent = { type: string };
|
|
43
|
+
|
|
44
|
+
const isRequest = predicateId("isRequest");
|
|
45
|
+
const isResponse = predicateId("isResponse");
|
|
46
|
+
|
|
47
|
+
const formula = always(
|
|
48
|
+
implies(predicate(isRequest), eventually(predicate(isResponse))),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const result = runOracle(
|
|
52
|
+
formula,
|
|
53
|
+
{
|
|
54
|
+
predicates: {
|
|
55
|
+
[isRequest]: (event) => event.type === "request",
|
|
56
|
+
[isResponse]: (event) => event.type === "response",
|
|
57
|
+
},
|
|
58
|
+
selectors: {},
|
|
59
|
+
},
|
|
60
|
+
[{ type: "request" }, { type: "response" }],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
console.log(result.verdict); // "satisfied"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## モジュール
|
|
67
|
+
|
|
68
|
+
- `@atsumell/trace-weave/core`: ID、型、verdict algebra、runtime interface
|
|
69
|
+
- `@atsumell/trace-weave/builder`: 時相式 builder
|
|
70
|
+
- `@atsumell/trace-weave/compiler`: compile、validate、print
|
|
71
|
+
- `@atsumell/trace-weave/monitor`: batch 評価と online monitor
|
|
72
|
+
- `@atsumell/trace-weave/patterns`: 高レベルの時相パターン
|
|
73
|
+
- `@atsumell/trace-weave/fast-check`: Property-based testing 連携
|
|
74
|
+
- `@atsumell/trace-weave/vitest`: custom matcher
|
|
75
|
+
- `@atsumell/trace-weave/ai`: レポート整形と AI 向け helper
|
|
76
|
+
|
|
77
|
+
## 開発コマンド
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm run lint
|
|
81
|
+
npm run skills:validate
|
|
82
|
+
npm run typecheck
|
|
83
|
+
npm test
|
|
84
|
+
npm run build
|
|
85
|
+
npm run pack:smoke
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## ドキュメント
|
|
89
|
+
|
|
90
|
+
- [Docs Index 日本語版](./docs/README.ja.md)
|
|
91
|
+
- [Getting Started 日本語版](./docs/getting-started.ja.md)
|
|
92
|
+
- [Examples 日本語版](./examples/README.ja.md)
|
|
93
|
+
- [AI Skill 日本語版](./docs/skills.ja.md)
|
|
94
|
+
- [Monitor 日本語版](./docs/monitor.ja.md)
|
|
95
|
+
- [English Docs Index](./docs/README.md)
|
|
96
|
+
|
|
97
|
+
## ライセンス
|
|
98
|
+
|
|
99
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# trace-weave
|
|
2
|
+
|
|
3
|
+
Japanese version: [README.ja.md](./README.ja.md)
|
|
4
|
+
|
|
5
|
+
Finite-trace temporal test oracle framework based on LTLf for TypeScript.
|
|
6
|
+
|
|
7
|
+
`trace-weave` lets you describe temporal properties over event traces and verify them against finite executions. It is designed for cases where single-step assertions are too weak, such as request/response ordering, bounded eventuality, and value correlation across events.
|
|
8
|
+
|
|
9
|
+
Runnable repository examples live in [examples/README.md](./examples/README.md). The full guide map is in [docs/README.md](./docs/README.md).
|
|
10
|
+
The AI-agent install guide is in [docs/skills.md](./docs/skills.md).
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Node.js 20 or later
|
|
15
|
+
- ESM-only package
|
|
16
|
+
|
|
17
|
+
## Node Support Policy
|
|
18
|
+
|
|
19
|
+
- `trace-weave` `0.x` supports Node.js 20 or later.
|
|
20
|
+
- Node.js 20 support remains in place through the upstream Node.js 20 end-of-life date, April 30, 2026.
|
|
21
|
+
- After April 30, 2026, a later release may raise the minimum supported version to Node.js 22 or later. Any such change will be called out in the release notes.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @atsumell/trace-weave
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Optional peer dependencies:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install fast-check vitest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Example
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { predicate, always, implies, eventually } from "@atsumell/trace-weave/builder";
|
|
39
|
+
import { predicateId } from "@atsumell/trace-weave/core";
|
|
40
|
+
import { runOracle } from "@atsumell/trace-weave/monitor";
|
|
41
|
+
|
|
42
|
+
type AppEvent = { type: string };
|
|
43
|
+
|
|
44
|
+
const isRequest = predicateId("isRequest");
|
|
45
|
+
const isResponse = predicateId("isResponse");
|
|
46
|
+
|
|
47
|
+
const formula = always(
|
|
48
|
+
implies(predicate(isRequest), eventually(predicate(isResponse))),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const result = runOracle(
|
|
52
|
+
formula,
|
|
53
|
+
{
|
|
54
|
+
predicates: {
|
|
55
|
+
[isRequest]: (event) => event.type === "request",
|
|
56
|
+
[isResponse]: (event) => event.type === "response",
|
|
57
|
+
},
|
|
58
|
+
selectors: {},
|
|
59
|
+
},
|
|
60
|
+
[{ type: "request" }, { type: "response" }],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
console.log(result.verdict); // "satisfied"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Modules
|
|
67
|
+
|
|
68
|
+
- `@atsumell/trace-weave/core`: IDs, types, verdict algebra, runtime interfaces
|
|
69
|
+
- `@atsumell/trace-weave/builder`: temporal formula builders
|
|
70
|
+
- `@atsumell/trace-weave/compiler`: compile, validate, and print formula documents
|
|
71
|
+
- `@atsumell/trace-weave/monitor`: batch and online evaluation
|
|
72
|
+
- `@atsumell/trace-weave/patterns`: higher-level temporal patterns
|
|
73
|
+
- `@atsumell/trace-weave/fast-check`: property-based testing helpers
|
|
74
|
+
- `@atsumell/trace-weave/vitest`: custom matchers
|
|
75
|
+
- `@atsumell/trace-weave/ai`: report formatting and AI-oriented helpers
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm run lint
|
|
81
|
+
npm run skills:validate
|
|
82
|
+
npm run typecheck
|
|
83
|
+
npm test
|
|
84
|
+
npm run build
|
|
85
|
+
npm run pack:smoke
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Documentation
|
|
89
|
+
|
|
90
|
+
- [Docs Index](./docs/README.md)
|
|
91
|
+
- [Getting Started](./docs/getting-started.md)
|
|
92
|
+
- [Examples](./examples/README.md)
|
|
93
|
+
- [AI Skill](./docs/skills.md)
|
|
94
|
+
- [Formulas](./docs/formulas.md)
|
|
95
|
+
- [Monitor](./docs/monitor.md)
|
|
96
|
+
- [Patterns](./docs/patterns.md)
|
|
97
|
+
- [Capture](./docs/capture.md)
|
|
98
|
+
- [fast-check Integration](./docs/fast-check.md)
|
|
99
|
+
- [Vitest Integration](./docs/vitest.md)
|
|
100
|
+
- [AI Integration](./docs/ai-integration.md)
|
|
101
|
+
- [API Reference](./docs/api-reference.md)
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { J as JsonValue, N as NodeId, a as NodeProvenance } from '../values-CEF1lKTL.js';
|
|
2
|
+
import { F as FormulaDocument } from '../formula-document-ChXznpvJ.js';
|
|
3
|
+
import { C as CounterexampleReport } from '../types-xatgZlwH.js';
|
|
4
|
+
import '../prepare-CrKEArDt.js';
|
|
5
|
+
import '../runtime-Do1rQFhQ.js';
|
|
6
|
+
import '../verdict-DYG0WE3o.js';
|
|
7
|
+
|
|
8
|
+
declare const formulaDocumentSchema: JsonValue;
|
|
9
|
+
|
|
10
|
+
declare function getNodeLabel(doc: FormulaDocument, nodeId: NodeId): string;
|
|
11
|
+
declare function getNodeProvenance(doc: FormulaDocument, nodeId: NodeId): NodeProvenance | undefined;
|
|
12
|
+
declare function getAllLabels(doc: FormulaDocument): Record<NodeId, string>;
|
|
13
|
+
|
|
14
|
+
interface FormattedReport {
|
|
15
|
+
readonly structured: {
|
|
16
|
+
readonly verdict: string;
|
|
17
|
+
readonly steps: readonly {
|
|
18
|
+
readonly nodeId: string;
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly verdict: string;
|
|
21
|
+
readonly step: number;
|
|
22
|
+
}[];
|
|
23
|
+
readonly traceSlice: readonly {
|
|
24
|
+
step: number;
|
|
25
|
+
event: unknown;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
readonly text: string;
|
|
29
|
+
}
|
|
30
|
+
declare function formatReport(report: CounterexampleReport, doc: FormulaDocument): FormattedReport;
|
|
31
|
+
|
|
32
|
+
export { type FormattedReport, formatReport, formulaDocumentSchema, getAllLabels, getNodeLabel, getNodeProvenance };
|
package/dist/ai/index.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// src/ai/schema.ts
|
|
2
|
+
var formulaDocumentSchema = {
|
|
3
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
title: "FormulaDocument",
|
|
5
|
+
description: "A compiled LTLf formula document for trace-weave",
|
|
6
|
+
type: "object",
|
|
7
|
+
required: ["schemaVersion", "root", "nodes"],
|
|
8
|
+
properties: {
|
|
9
|
+
schemaVersion: { type: "number", const: 1 },
|
|
10
|
+
root: { type: "string", description: "NodeId of the root formula node" },
|
|
11
|
+
nodes: {
|
|
12
|
+
type: "object",
|
|
13
|
+
description: "Map from NodeId to FormulaNode",
|
|
14
|
+
additionalProperties: {
|
|
15
|
+
type: "object",
|
|
16
|
+
required: ["kind"],
|
|
17
|
+
properties: {
|
|
18
|
+
kind: {
|
|
19
|
+
type: "string",
|
|
20
|
+
enum: [
|
|
21
|
+
"literal",
|
|
22
|
+
"predicate",
|
|
23
|
+
"when",
|
|
24
|
+
"capture",
|
|
25
|
+
"not",
|
|
26
|
+
"and",
|
|
27
|
+
"or",
|
|
28
|
+
"implies",
|
|
29
|
+
"always",
|
|
30
|
+
"eventually",
|
|
31
|
+
"next",
|
|
32
|
+
"weakNext",
|
|
33
|
+
"until",
|
|
34
|
+
"release",
|
|
35
|
+
"once",
|
|
36
|
+
"historically",
|
|
37
|
+
"since",
|
|
38
|
+
"withinSteps",
|
|
39
|
+
"withinMs"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
provenance: {
|
|
46
|
+
type: "object",
|
|
47
|
+
description: "Optional provenance information for nodes",
|
|
48
|
+
additionalProperties: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
nodeId: { type: "string" },
|
|
52
|
+
origin: { type: "string", enum: ["user", "compiler", "pattern"] },
|
|
53
|
+
sourceExprKind: { type: "string" },
|
|
54
|
+
meta: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
humanLabel: { type: "string" },
|
|
58
|
+
confidence: { type: "number" }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/ai/metadata.ts
|
|
68
|
+
function getNodeLabel(doc, nodeId) {
|
|
69
|
+
const provenance = doc.provenance?.[nodeId];
|
|
70
|
+
if (provenance?.meta?.humanLabel) return provenance.meta.humanLabel;
|
|
71
|
+
const node = doc.nodes[nodeId];
|
|
72
|
+
return node?.kind ?? "unknown";
|
|
73
|
+
}
|
|
74
|
+
function getNodeProvenance(doc, nodeId) {
|
|
75
|
+
return doc.provenance?.[nodeId];
|
|
76
|
+
}
|
|
77
|
+
function getAllLabels(doc) {
|
|
78
|
+
const labels = {};
|
|
79
|
+
for (const nodeId of Object.keys(doc.nodes)) {
|
|
80
|
+
labels[nodeId] = getNodeLabel(doc, nodeId);
|
|
81
|
+
}
|
|
82
|
+
return labels;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/ai/format-report.ts
|
|
86
|
+
function formatReport(report, doc) {
|
|
87
|
+
const steps = report.failurePath.map((snap) => ({
|
|
88
|
+
nodeId: snap.nodeId,
|
|
89
|
+
label: getNodeLabel(doc, snap.nodeId),
|
|
90
|
+
verdict: snap.verdict,
|
|
91
|
+
step: snap.step
|
|
92
|
+
}));
|
|
93
|
+
const structured = {
|
|
94
|
+
verdict: report.verdict,
|
|
95
|
+
steps,
|
|
96
|
+
traceSlice: report.traceSlice
|
|
97
|
+
};
|
|
98
|
+
const textParts = [
|
|
99
|
+
`Verdict: ${report.verdict}`,
|
|
100
|
+
"",
|
|
101
|
+
"Failure Path:",
|
|
102
|
+
...steps.map((s) => ` [step ${s.step}] ${s.label} (${s.nodeId}): ${s.verdict}`),
|
|
103
|
+
"",
|
|
104
|
+
"Trace:",
|
|
105
|
+
...report.traceSlice.map((t) => ` step ${t.step}: ${JSON.stringify(t.event)}`),
|
|
106
|
+
"",
|
|
107
|
+
report.summary
|
|
108
|
+
];
|
|
109
|
+
return {
|
|
110
|
+
structured,
|
|
111
|
+
text: textParts.join("\n")
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
formatReport,
|
|
116
|
+
formulaDocumentSchema,
|
|
117
|
+
getAllLabels,
|
|
118
|
+
getNodeLabel,
|
|
119
|
+
getNodeProvenance
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/schema.ts","../../src/ai/metadata.ts","../../src/ai/format-report.ts"],"sourcesContent":["import type { JsonValue } from \"../core/values.js\";\n\nexport const formulaDocumentSchema: JsonValue = {\n\t$schema: \"http://json-schema.org/draft-07/schema#\",\n\ttitle: \"FormulaDocument\",\n\tdescription: \"A compiled LTLf formula document for trace-weave\",\n\ttype: \"object\",\n\trequired: [\"schemaVersion\", \"root\", \"nodes\"],\n\tproperties: {\n\t\tschemaVersion: { type: \"number\", const: 1 },\n\t\troot: { type: \"string\", description: \"NodeId of the root formula node\" },\n\t\tnodes: {\n\t\t\ttype: \"object\",\n\t\t\tdescription: \"Map from NodeId to FormulaNode\",\n\t\t\tadditionalProperties: {\n\t\t\t\ttype: \"object\",\n\t\t\t\trequired: [\"kind\"],\n\t\t\t\tproperties: {\n\t\t\t\t\tkind: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tenum: [\n\t\t\t\t\t\t\t\"literal\",\n\t\t\t\t\t\t\t\"predicate\",\n\t\t\t\t\t\t\t\"when\",\n\t\t\t\t\t\t\t\"capture\",\n\t\t\t\t\t\t\t\"not\",\n\t\t\t\t\t\t\t\"and\",\n\t\t\t\t\t\t\t\"or\",\n\t\t\t\t\t\t\t\"implies\",\n\t\t\t\t\t\t\t\"always\",\n\t\t\t\t\t\t\t\"eventually\",\n\t\t\t\t\t\t\t\"next\",\n\t\t\t\t\t\t\t\"weakNext\",\n\t\t\t\t\t\t\t\"until\",\n\t\t\t\t\t\t\t\"release\",\n\t\t\t\t\t\t\t\"once\",\n\t\t\t\t\t\t\t\"historically\",\n\t\t\t\t\t\t\t\"since\",\n\t\t\t\t\t\t\t\"withinSteps\",\n\t\t\t\t\t\t\t\"withinMs\",\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tprovenance: {\n\t\t\ttype: \"object\",\n\t\t\tdescription: \"Optional provenance information for nodes\",\n\t\t\tadditionalProperties: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tnodeId: { type: \"string\" },\n\t\t\t\t\torigin: { type: \"string\", enum: [\"user\", \"compiler\", \"pattern\"] },\n\t\t\t\t\tsourceExprKind: { type: \"string\" },\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\thumanLabel: { type: \"string\" },\n\t\t\t\t\t\t\tconfidence: { type: \"number\" },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n","import type { FormulaDocument } from \"../core/formula-document.js\";\nimport type { NodeId } from \"../core/ids.js\";\nimport type { FormulaMeta, NodeProvenance } from \"../core/meta.js\";\n\nexport function getNodeLabel(doc: FormulaDocument, nodeId: NodeId): string {\n\tconst provenance = doc.provenance?.[nodeId];\n\tif (provenance?.meta?.humanLabel) return provenance.meta.humanLabel;\n\n\tconst node = doc.nodes[nodeId];\n\treturn node?.kind ?? \"unknown\";\n}\n\nexport function getNodeProvenance(\n\tdoc: FormulaDocument,\n\tnodeId: NodeId,\n): NodeProvenance | undefined {\n\treturn doc.provenance?.[nodeId];\n}\n\nexport function getAllLabels(doc: FormulaDocument): Record<NodeId, string> {\n\tconst labels: Record<string, string> = {};\n\tfor (const nodeId of Object.keys(doc.nodes)) {\n\t\tlabels[nodeId] = getNodeLabel(doc, nodeId as NodeId);\n\t}\n\treturn labels as Record<NodeId, string>;\n}\n","import type { FormulaDocument } from \"../core/formula-document.js\";\nimport type { CounterexampleReport } from \"../monitor/types.js\";\nimport { getNodeLabel } from \"./metadata.js\";\n\nexport interface FormattedReport {\n\treadonly structured: {\n\t\treadonly verdict: string;\n\t\treadonly steps: readonly {\n\t\t\treadonly nodeId: string;\n\t\t\treadonly label: string;\n\t\t\treadonly verdict: string;\n\t\t\treadonly step: number;\n\t\t}[];\n\t\treadonly traceSlice: readonly { step: number; event: unknown }[];\n\t};\n\treadonly text: string;\n}\n\nexport function formatReport(report: CounterexampleReport, doc: FormulaDocument): FormattedReport {\n\tconst steps = report.failurePath.map((snap) => ({\n\t\tnodeId: snap.nodeId as string,\n\t\tlabel: getNodeLabel(doc, snap.nodeId),\n\t\tverdict: snap.verdict,\n\t\tstep: snap.step,\n\t}));\n\n\tconst structured = {\n\t\tverdict: report.verdict,\n\t\tsteps,\n\t\ttraceSlice: report.traceSlice,\n\t};\n\n\tconst textParts: string[] = [\n\t\t`Verdict: ${report.verdict}`,\n\t\t\"\",\n\t\t\"Failure Path:\",\n\t\t...steps.map((s) => ` [step ${s.step}] ${s.label} (${s.nodeId}): ${s.verdict}`),\n\t\t\"\",\n\t\t\"Trace:\",\n\t\t...report.traceSlice.map((t) => ` step ${t.step}: ${JSON.stringify(t.event)}`),\n\t\t\"\",\n\t\treport.summary,\n\t];\n\n\treturn {\n\t\tstructured,\n\t\ttext: textParts.join(\"\\n\"),\n\t};\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { F as FormulaMeta, C as CaptureName, S as SelectorId, P as PredicateId, V as ValueExprArg } from '../values-CEF1lKTL.js';
|
|
2
|
+
import { F as FormulaExpr, A as AlwaysExpr, a as AndExpr, C as CaptureExpr, E as EventuallyExpr, H as HistoricallyExpr, I as ImpliesExpr, L as LiteralExpr, N as NextExpr, b as NotExpr, O as OnceExpr, c as OrExpr, P as PredicateExpr, R as ReleaseExpr, S as SinceExpr, U as UntilExpr, W as WeakNextExpr, d as WhenExpr, e as WithinMsExpr, f as WithinStepsExpr } from '../formula-expr-DAHklv9S.js';
|
|
3
|
+
|
|
4
|
+
declare function toExpr(v: boolean | FormulaExpr): FormulaExpr;
|
|
5
|
+
declare function annotate(expr: FormulaExpr, meta: FormulaMeta): FormulaExpr;
|
|
6
|
+
declare function literal(value: boolean): LiteralExpr;
|
|
7
|
+
declare function predicate(predicateId: PredicateId, ...args: readonly ValueExprArg[]): PredicateExpr;
|
|
8
|
+
declare function when(captureName: CaptureName, selectorId: SelectorId, child: boolean | FormulaExpr): WhenExpr;
|
|
9
|
+
declare function capture(captureName: CaptureName, selectorId: SelectorId, child: boolean | FormulaExpr): CaptureExpr;
|
|
10
|
+
declare function not(child: boolean | FormulaExpr): NotExpr;
|
|
11
|
+
declare function and(...children: readonly (boolean | FormulaExpr)[]): AndExpr;
|
|
12
|
+
declare function or(...children: readonly (boolean | FormulaExpr)[]): OrExpr;
|
|
13
|
+
declare function implies(left: boolean | FormulaExpr, right: boolean | FormulaExpr): ImpliesExpr;
|
|
14
|
+
declare function always(child: boolean | FormulaExpr): AlwaysExpr;
|
|
15
|
+
declare function eventually(child: boolean | FormulaExpr): EventuallyExpr;
|
|
16
|
+
declare function next(child: boolean | FormulaExpr): NextExpr;
|
|
17
|
+
declare function weakNext(child: boolean | FormulaExpr): WeakNextExpr;
|
|
18
|
+
declare function until(left: boolean | FormulaExpr, right: boolean | FormulaExpr): UntilExpr;
|
|
19
|
+
declare function release(left: boolean | FormulaExpr, right: boolean | FormulaExpr): ReleaseExpr;
|
|
20
|
+
declare function once(child: boolean | FormulaExpr): OnceExpr;
|
|
21
|
+
declare function historically(child: boolean | FormulaExpr): HistoricallyExpr;
|
|
22
|
+
declare function since(left: boolean | FormulaExpr, right: boolean | FormulaExpr): SinceExpr;
|
|
23
|
+
declare function withinSteps(steps: number, child: boolean | FormulaExpr): WithinStepsExpr;
|
|
24
|
+
declare function withinMs(ms: number, child: boolean | FormulaExpr): WithinMsExpr;
|
|
25
|
+
|
|
26
|
+
export { always, and, annotate, capture, eventually, historically, implies, literal, next, not, once, or, predicate, release, since, toExpr, until, weakNext, when, withinMs, withinSteps };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
always,
|
|
3
|
+
and,
|
|
4
|
+
annotate,
|
|
5
|
+
capture,
|
|
6
|
+
eventually,
|
|
7
|
+
historically,
|
|
8
|
+
implies,
|
|
9
|
+
literal,
|
|
10
|
+
next,
|
|
11
|
+
not,
|
|
12
|
+
once,
|
|
13
|
+
or,
|
|
14
|
+
predicate,
|
|
15
|
+
release,
|
|
16
|
+
since,
|
|
17
|
+
toExpr,
|
|
18
|
+
until,
|
|
19
|
+
weakNext,
|
|
20
|
+
when,
|
|
21
|
+
withinMs,
|
|
22
|
+
withinSteps
|
|
23
|
+
} from "../chunk-35PKIXFV.js";
|
|
24
|
+
export {
|
|
25
|
+
always,
|
|
26
|
+
and,
|
|
27
|
+
annotate,
|
|
28
|
+
capture,
|
|
29
|
+
eventually,
|
|
30
|
+
historically,
|
|
31
|
+
implies,
|
|
32
|
+
literal,
|
|
33
|
+
next,
|
|
34
|
+
not,
|
|
35
|
+
once,
|
|
36
|
+
or,
|
|
37
|
+
predicate,
|
|
38
|
+
release,
|
|
39
|
+
since,
|
|
40
|
+
toExpr,
|
|
41
|
+
until,
|
|
42
|
+
weakNext,
|
|
43
|
+
when,
|
|
44
|
+
withinMs,
|
|
45
|
+
withinSteps
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/builder/factory.ts
|
|
2
|
+
function toExpr(v) {
|
|
3
|
+
if (typeof v === "boolean") return literal(v);
|
|
4
|
+
return v;
|
|
5
|
+
}
|
|
6
|
+
function annotate(expr, meta) {
|
|
7
|
+
return { ...expr, meta };
|
|
8
|
+
}
|
|
9
|
+
function literal(value) {
|
|
10
|
+
return { kind: "literal", value };
|
|
11
|
+
}
|
|
12
|
+
function predicate(predicateId, ...args) {
|
|
13
|
+
return args.length > 0 ? { kind: "predicate", predicateId, args } : { kind: "predicate", predicateId };
|
|
14
|
+
}
|
|
15
|
+
function when(captureName, selectorId, child) {
|
|
16
|
+
return { kind: "when", captureName, selectorId, child: toExpr(child) };
|
|
17
|
+
}
|
|
18
|
+
function capture(captureName, selectorId, child) {
|
|
19
|
+
return { kind: "capture", captureName, selectorId, child: toExpr(child) };
|
|
20
|
+
}
|
|
21
|
+
function not(child) {
|
|
22
|
+
return { kind: "not", child: toExpr(child) };
|
|
23
|
+
}
|
|
24
|
+
function and(...children) {
|
|
25
|
+
return { kind: "and", children: children.map(toExpr) };
|
|
26
|
+
}
|
|
27
|
+
function or(...children) {
|
|
28
|
+
return { kind: "or", children: children.map(toExpr) };
|
|
29
|
+
}
|
|
30
|
+
function implies(left, right) {
|
|
31
|
+
return { kind: "implies", left: toExpr(left), right: toExpr(right) };
|
|
32
|
+
}
|
|
33
|
+
function always(child) {
|
|
34
|
+
return { kind: "always", child: toExpr(child) };
|
|
35
|
+
}
|
|
36
|
+
function eventually(child) {
|
|
37
|
+
return { kind: "eventually", child: toExpr(child) };
|
|
38
|
+
}
|
|
39
|
+
function next(child) {
|
|
40
|
+
return { kind: "next", child: toExpr(child) };
|
|
41
|
+
}
|
|
42
|
+
function weakNext(child) {
|
|
43
|
+
return { kind: "weakNext", child: toExpr(child) };
|
|
44
|
+
}
|
|
45
|
+
function until(left, right) {
|
|
46
|
+
return { kind: "until", left: toExpr(left), right: toExpr(right) };
|
|
47
|
+
}
|
|
48
|
+
function release(left, right) {
|
|
49
|
+
return { kind: "release", left: toExpr(left), right: toExpr(right) };
|
|
50
|
+
}
|
|
51
|
+
function once(child) {
|
|
52
|
+
return { kind: "once", child: toExpr(child) };
|
|
53
|
+
}
|
|
54
|
+
function historically(child) {
|
|
55
|
+
return { kind: "historically", child: toExpr(child) };
|
|
56
|
+
}
|
|
57
|
+
function since(left, right) {
|
|
58
|
+
return { kind: "since", left: toExpr(left), right: toExpr(right) };
|
|
59
|
+
}
|
|
60
|
+
function withinSteps(steps, child) {
|
|
61
|
+
return { kind: "withinSteps", steps, child: toExpr(child) };
|
|
62
|
+
}
|
|
63
|
+
function withinMs(ms, child) {
|
|
64
|
+
return { kind: "withinMs", ms, child: toExpr(child) };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
toExpr,
|
|
69
|
+
annotate,
|
|
70
|
+
literal,
|
|
71
|
+
predicate,
|
|
72
|
+
when,
|
|
73
|
+
capture,
|
|
74
|
+
not,
|
|
75
|
+
and,
|
|
76
|
+
or,
|
|
77
|
+
implies,
|
|
78
|
+
always,
|
|
79
|
+
eventually,
|
|
80
|
+
next,
|
|
81
|
+
weakNext,
|
|
82
|
+
until,
|
|
83
|
+
release,
|
|
84
|
+
once,
|
|
85
|
+
historically,
|
|
86
|
+
since,
|
|
87
|
+
withinSteps,
|
|
88
|
+
withinMs
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=chunk-35PKIXFV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/builder/factory.ts"],"sourcesContent":["import type {\n\tAlwaysExpr,\n\tAndExpr,\n\tCaptureExpr,\n\tCaptureName,\n\tEventuallyExpr,\n\tFormulaExpr,\n\tFormulaMeta,\n\tHistoricallyExpr,\n\tImpliesExpr,\n\tLiteralExpr,\n\tNextExpr,\n\tNotExpr,\n\tOnceExpr,\n\tOrExpr,\n\tPredicateExpr,\n\tPredicateId,\n\tReleaseExpr,\n\tSelectorId,\n\tSinceExpr,\n\tUntilExpr,\n\tValueExprArg,\n\tWeakNextExpr,\n\tWhenExpr,\n\tWithinMsExpr,\n\tWithinStepsExpr,\n} from \"../core/index.js\";\n\nexport function toExpr(v: boolean | FormulaExpr): FormulaExpr {\n\tif (typeof v === \"boolean\") return literal(v);\n\treturn v;\n}\n\nexport function annotate(expr: FormulaExpr, meta: FormulaMeta): FormulaExpr {\n\treturn { ...expr, meta } as FormulaExpr;\n}\n\n// --- Leaf nodes ---\n\nexport function literal(value: boolean): LiteralExpr {\n\treturn { kind: \"literal\", value };\n}\n\nexport function predicate(\n\tpredicateId: PredicateId,\n\t...args: readonly ValueExprArg[]\n): PredicateExpr {\n\treturn args.length > 0\n\t\t? { kind: \"predicate\", predicateId, args }\n\t\t: { kind: \"predicate\", predicateId };\n}\n\nexport function when(\n\tcaptureName: CaptureName,\n\tselectorId: SelectorId,\n\tchild: boolean | FormulaExpr,\n): WhenExpr {\n\treturn { kind: \"when\", captureName, selectorId, child: toExpr(child) };\n}\n\nexport function capture(\n\tcaptureName: CaptureName,\n\tselectorId: SelectorId,\n\tchild: boolean | FormulaExpr,\n): CaptureExpr {\n\treturn { kind: \"capture\", captureName, selectorId, child: toExpr(child) };\n}\n\n// --- Boolean operators ---\n\nexport function not(child: boolean | FormulaExpr): NotExpr {\n\treturn { kind: \"not\", child: toExpr(child) };\n}\n\nexport function and(...children: readonly (boolean | FormulaExpr)[]): AndExpr {\n\treturn { kind: \"and\", children: children.map(toExpr) };\n}\n\nexport function or(...children: readonly (boolean | FormulaExpr)[]): OrExpr {\n\treturn { kind: \"or\", children: children.map(toExpr) };\n}\n\nexport function implies(left: boolean | FormulaExpr, right: boolean | FormulaExpr): ImpliesExpr {\n\treturn { kind: \"implies\", left: toExpr(left), right: toExpr(right) };\n}\n\n// --- Future temporal operators ---\n\nexport function always(child: boolean | FormulaExpr): AlwaysExpr {\n\treturn { kind: \"always\", child: toExpr(child) };\n}\n\nexport function eventually(child: boolean | FormulaExpr): EventuallyExpr {\n\treturn { kind: \"eventually\", child: toExpr(child) };\n}\n\nexport function next(child: boolean | FormulaExpr): NextExpr {\n\treturn { kind: \"next\", child: toExpr(child) };\n}\n\nexport function weakNext(child: boolean | FormulaExpr): WeakNextExpr {\n\treturn { kind: \"weakNext\", child: toExpr(child) };\n}\n\nexport function until(left: boolean | FormulaExpr, right: boolean | FormulaExpr): UntilExpr {\n\treturn { kind: \"until\", left: toExpr(left), right: toExpr(right) };\n}\n\nexport function release(left: boolean | FormulaExpr, right: boolean | FormulaExpr): ReleaseExpr {\n\treturn { kind: \"release\", left: toExpr(left), right: toExpr(right) };\n}\n\n// --- Past temporal operators ---\n\nexport function once(child: boolean | FormulaExpr): OnceExpr {\n\treturn { kind: \"once\", child: toExpr(child) };\n}\n\nexport function historically(child: boolean | FormulaExpr): HistoricallyExpr {\n\treturn { kind: \"historically\", child: toExpr(child) };\n}\n\nexport function since(left: boolean | FormulaExpr, right: boolean | FormulaExpr): SinceExpr {\n\treturn { kind: \"since\", left: toExpr(left), right: toExpr(right) };\n}\n\n// --- Bounded operators ---\n\nexport function withinSteps(steps: number, child: boolean | FormulaExpr): WithinStepsExpr {\n\treturn { kind: \"withinSteps\", steps, child: toExpr(child) };\n}\n\nexport function withinMs(ms: number, child: boolean | FormulaExpr): WithinMsExpr {\n\treturn { kind: \"withinMs\", ms, child: toExpr(child) };\n}\n"],"mappings":";AA4BO,SAAS,OAAO,GAAuC;AAC7D,MAAI,OAAO,MAAM,UAAW,QAAO,QAAQ,CAAC;AAC5C,SAAO;AACR;AAEO,SAAS,SAAS,MAAmB,MAAgC;AAC3E,SAAO,EAAE,GAAG,MAAM,KAAK;AACxB;AAIO,SAAS,QAAQ,OAA6B;AACpD,SAAO,EAAE,MAAM,WAAW,MAAM;AACjC;AAEO,SAAS,UACf,gBACG,MACa;AAChB,SAAO,KAAK,SAAS,IAClB,EAAE,MAAM,aAAa,aAAa,KAAK,IACvC,EAAE,MAAM,aAAa,YAAY;AACrC;AAEO,SAAS,KACf,aACA,YACA,OACW;AACX,SAAO,EAAE,MAAM,QAAQ,aAAa,YAAY,OAAO,OAAO,KAAK,EAAE;AACtE;AAEO,SAAS,QACf,aACA,YACA,OACc;AACd,SAAO,EAAE,MAAM,WAAW,aAAa,YAAY,OAAO,OAAO,KAAK,EAAE;AACzE;AAIO,SAAS,IAAI,OAAuC;AAC1D,SAAO,EAAE,MAAM,OAAO,OAAO,OAAO,KAAK,EAAE;AAC5C;AAEO,SAAS,OAAO,UAAuD;AAC7E,SAAO,EAAE,MAAM,OAAO,UAAU,SAAS,IAAI,MAAM,EAAE;AACtD;AAEO,SAAS,MAAM,UAAsD;AAC3E,SAAO,EAAE,MAAM,MAAM,UAAU,SAAS,IAAI,MAAM,EAAE;AACrD;AAEO,SAAS,QAAQ,MAA6B,OAA2C;AAC/F,SAAO,EAAE,MAAM,WAAW,MAAM,OAAO,IAAI,GAAG,OAAO,OAAO,KAAK,EAAE;AACpE;AAIO,SAAS,OAAO,OAA0C;AAChE,SAAO,EAAE,MAAM,UAAU,OAAO,OAAO,KAAK,EAAE;AAC/C;AAEO,SAAS,WAAW,OAA8C;AACxE,SAAO,EAAE,MAAM,cAAc,OAAO,OAAO,KAAK,EAAE;AACnD;AAEO,SAAS,KAAK,OAAwC;AAC5D,SAAO,EAAE,MAAM,QAAQ,OAAO,OAAO,KAAK,EAAE;AAC7C;AAEO,SAAS,SAAS,OAA4C;AACpE,SAAO,EAAE,MAAM,YAAY,OAAO,OAAO,KAAK,EAAE;AACjD;AAEO,SAAS,MAAM,MAA6B,OAAyC;AAC3F,SAAO,EAAE,MAAM,SAAS,MAAM,OAAO,IAAI,GAAG,OAAO,OAAO,KAAK,EAAE;AAClE;AAEO,SAAS,QAAQ,MAA6B,OAA2C;AAC/F,SAAO,EAAE,MAAM,WAAW,MAAM,OAAO,IAAI,GAAG,OAAO,OAAO,KAAK,EAAE;AACpE;AAIO,SAAS,KAAK,OAAwC;AAC5D,SAAO,EAAE,MAAM,QAAQ,OAAO,OAAO,KAAK,EAAE;AAC7C;AAEO,SAAS,aAAa,OAAgD;AAC5E,SAAO,EAAE,MAAM,gBAAgB,OAAO,OAAO,KAAK,EAAE;AACrD;AAEO,SAAS,MAAM,MAA6B,OAAyC;AAC3F,SAAO,EAAE,MAAM,SAAS,MAAM,OAAO,IAAI,GAAG,OAAO,OAAO,KAAK,EAAE;AAClE;AAIO,SAAS,YAAY,OAAe,OAA+C;AACzF,SAAO,EAAE,MAAM,eAAe,OAAO,OAAO,OAAO,KAAK,EAAE;AAC3D;AAEO,SAAS,SAAS,IAAY,OAA4C;AAChF,SAAO,EAAE,MAAM,YAAY,IAAI,OAAO,OAAO,KAAK,EAAE;AACrD;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/core/verdict.ts
|
|
2
|
+
function notV(v) {
|
|
3
|
+
switch (v) {
|
|
4
|
+
case "satisfied":
|
|
5
|
+
return "violated";
|
|
6
|
+
case "violated":
|
|
7
|
+
return "satisfied";
|
|
8
|
+
case "pending":
|
|
9
|
+
return "pending";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function andV(a, b) {
|
|
13
|
+
if (a === "violated" || b === "violated") return "violated";
|
|
14
|
+
if (a === "pending" || b === "pending") return "pending";
|
|
15
|
+
return "satisfied";
|
|
16
|
+
}
|
|
17
|
+
function orV(a, b) {
|
|
18
|
+
if (a === "satisfied" || b === "satisfied") return "satisfied";
|
|
19
|
+
if (a === "pending" || b === "pending") return "pending";
|
|
20
|
+
return "violated";
|
|
21
|
+
}
|
|
22
|
+
function impliesV(a, b) {
|
|
23
|
+
return orV(notV(a), b);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
notV,
|
|
28
|
+
andV,
|
|
29
|
+
orV,
|
|
30
|
+
impliesV
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=chunk-AS6LZLUH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/verdict.ts"],"sourcesContent":["export type Verdict = \"satisfied\" | \"violated\" | \"pending\";\n\nexport function notV(v: Verdict): Verdict {\n\tswitch (v) {\n\t\tcase \"satisfied\":\n\t\t\treturn \"violated\";\n\t\tcase \"violated\":\n\t\t\treturn \"satisfied\";\n\t\tcase \"pending\":\n\t\t\treturn \"pending\";\n\t}\n}\n\nexport function andV(a: Verdict, b: Verdict): Verdict {\n\tif (a === \"violated\" || b === \"violated\") return \"violated\";\n\tif (a === \"pending\" || b === \"pending\") return \"pending\";\n\treturn \"satisfied\";\n}\n\nexport function orV(a: Verdict, b: Verdict): Verdict {\n\tif (a === \"satisfied\" || b === \"satisfied\") return \"satisfied\";\n\tif (a === \"pending\" || b === \"pending\") return \"pending\";\n\treturn \"violated\";\n}\n\nexport function impliesV(a: Verdict, b: Verdict): Verdict {\n\treturn orV(notV(a), b);\n}\n"],"mappings":";AAEO,SAAS,KAAK,GAAqB;AACzC,UAAQ,GAAG;AAAA,IACV,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO;AAAA,EACT;AACD;AAEO,SAAS,KAAK,GAAY,GAAqB;AACrD,MAAI,MAAM,cAAc,MAAM,WAAY,QAAO;AACjD,MAAI,MAAM,aAAa,MAAM,UAAW,QAAO;AAC/C,SAAO;AACR;AAEO,SAAS,IAAI,GAAY,GAAqB;AACpD,MAAI,MAAM,eAAe,MAAM,YAAa,QAAO;AACnD,MAAI,MAAM,aAAa,MAAM,UAAW,QAAO;AAC/C,SAAO;AACR;AAEO,SAAS,SAAS,GAAY,GAAqB;AACzD,SAAO,IAAI,KAAK,CAAC,GAAG,CAAC;AACtB;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/core/ids.ts
|
|
2
|
+
function nodeId(s) {
|
|
3
|
+
return s;
|
|
4
|
+
}
|
|
5
|
+
function predicateId(s) {
|
|
6
|
+
return s;
|
|
7
|
+
}
|
|
8
|
+
function selectorId(s) {
|
|
9
|
+
return s;
|
|
10
|
+
}
|
|
11
|
+
function captureName(s) {
|
|
12
|
+
return s;
|
|
13
|
+
}
|
|
14
|
+
function activationId(s) {
|
|
15
|
+
return s;
|
|
16
|
+
}
|
|
17
|
+
function envId(s) {
|
|
18
|
+
return s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
nodeId,
|
|
23
|
+
predicateId,
|
|
24
|
+
selectorId,
|
|
25
|
+
captureName,
|
|
26
|
+
activationId,
|
|
27
|
+
envId
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=chunk-B4SEKVLL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/ids.ts"],"sourcesContent":["declare const __brand: unique symbol;\ntype Brand<T, B extends string> = T & { readonly [__brand]: B };\n\nexport type NodeId = Brand<string, \"NodeId\">;\nexport type PredicateId = Brand<string, \"PredicateId\">;\nexport type SelectorId = Brand<string, \"SelectorId\">;\nexport type CaptureName = Brand<string, \"CaptureName\">;\nexport type ActivationId = Brand<string, \"ActivationId\">;\nexport type EnvId = Brand<string, \"EnvId\">;\n\nexport function nodeId(s: string): NodeId {\n\treturn s as NodeId;\n}\n\nexport function predicateId(s: string): PredicateId {\n\treturn s as PredicateId;\n}\n\nexport function selectorId(s: string): SelectorId {\n\treturn s as SelectorId;\n}\n\nexport function captureName(s: string): CaptureName {\n\treturn s as CaptureName;\n}\n\nexport function activationId(s: string): ActivationId {\n\treturn s as ActivationId;\n}\n\nexport function envId(s: string): EnvId {\n\treturn s as EnvId;\n}\n"],"mappings":";AAUO,SAAS,OAAO,GAAmB;AACzC,SAAO;AACR;AAEO,SAAS,YAAY,GAAwB;AACnD,SAAO;AACR;AAEO,SAAS,WAAW,GAAuB;AACjD,SAAO;AACR;AAEO,SAAS,YAAY,GAAwB;AACnD,SAAO;AACR;AAEO,SAAS,aAAa,GAAyB;AACrD,SAAO;AACR;AAEO,SAAS,MAAM,GAAkB;AACvC,SAAO;AACR;","names":[]}
|