@skillstech/thunderlang 0.1.6 → 0.1.7
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/CHANGELOG.md +47 -47
- package/LICENSE +201 -21
- package/NOTICE +15 -0
- package/README.md +5 -8
- package/dist/core.cjs +12 -12
- package/dist/index.cjs +16 -16
- package/package.json +12 -12
- package/src/ai-events.mjs +1 -1
- package/src/cli.mjs +139 -134
- package/src/codegen.mjs +1 -1
- package/src/compile.mjs +3 -3
- package/src/drift.mjs +3 -3
- package/src/emit.mjs +2 -2
- package/src/focus.mjs +1 -1
- package/src/guard.mjs +3 -3
- package/src/intellisense.mjs +1 -1
- package/src/intent-schema.mjs +4 -4
- package/src/ledger.mjs +1 -1
- package/src/lift.mjs +2 -2
- package/src/lsp.mjs +1 -1
- package/src/mcp.mjs +1 -1
- package/src/parse.mjs +3 -3
- package/src/proof-schema.mjs +2 -2
- package/src/report.mjs +1 -1
- package/src/sarif.mjs +1 -1
- package/src/scan-queries.mjs +1 -1
- package/src/style.mjs +3 -3
- package/src/twelve-factor.mjs +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1309,7 +1309,7 @@ var FACTORS = [
|
|
|
1309
1309
|
const scoped = len(ast.scope?.include) + len(ast.scope?.exclude);
|
|
1310
1310
|
if (scoped) return { verdict: "satisfied", evidence: `context boundary declared (scope: ${len(ast.scope.include)} include / ${len(ast.scope.exclude)} exclude)` };
|
|
1311
1311
|
if (len(ast.requires)) return { verdict: "partial", evidence: "dependencies declared but no explicit scope boundary", fix: "Declare `scope include/exclude` so the context window is curated, not unbounded." };
|
|
1312
|
-
return { verdict: "absent", evidence: "no scope declared", fix: "Add a `scope` block to bound what belongs in context (
|
|
1312
|
+
return { verdict: "absent", evidence: "no scope declared", fix: "Add a `scope` block to bound what belongs in context (ThunderLens/Focus narrows it further)." };
|
|
1313
1313
|
}
|
|
1314
1314
|
},
|
|
1315
1315
|
{
|
|
@@ -1977,7 +1977,7 @@ function toDesignTokens(ast) {
|
|
|
1977
1977
|
});
|
|
1978
1978
|
for (const t of si.tokens) {
|
|
1979
1979
|
const leaf = { $value: coerceValue(t.value), $type: tokenType(t.path) };
|
|
1980
|
-
if (!isKnownPath(t.path)) leaf.$extensions = { "dev.
|
|
1980
|
+
if (!isKnownPath(t.path)) leaf.$extensions = { "dev.intentlanguage": { canonical: false } };
|
|
1981
1981
|
setPath(root, t.path, leaf);
|
|
1982
1982
|
}
|
|
1983
1983
|
}
|
|
@@ -1985,7 +1985,7 @@ function toDesignTokens(ast) {
|
|
|
1985
1985
|
$description: `Design tokens for ${ast.title || ast.mission || "intent"} (generated from style_intent by @skillstech/thunderlang)`,
|
|
1986
1986
|
...root,
|
|
1987
1987
|
$extensions: {
|
|
1988
|
-
"dev.
|
|
1988
|
+
"dev.intentlanguage": {
|
|
1989
1989
|
schema: DESIGN_TOKENS_SCHEMA,
|
|
1990
1990
|
format: "W3C Design Tokens (DTCG)",
|
|
1991
1991
|
source: ast.mission || null,
|
|
@@ -2750,7 +2750,7 @@ function intentProofJsonSchema() {
|
|
|
2750
2750
|
sourceProduct: { type: "string" },
|
|
2751
2751
|
missionName: { type: ["string", "null"] },
|
|
2752
2752
|
sourceFile: { type: "string" },
|
|
2753
|
-
// sha256:<hex> , the source fingerprint `
|
|
2753
|
+
// sha256:<hex> , the source fingerprint `thunder verify` re-checks for drift/tampering.
|
|
2754
2754
|
sourceHash: { type: "string", pattern: "^sha256:[0-9a-f]{64}$" },
|
|
2755
2755
|
compilerVersion: { type: "string" },
|
|
2756
2756
|
generatedAt: { type: ["string", "null"] },
|
|
@@ -2862,7 +2862,7 @@ function renderLensDoc(ast, lens) {
|
|
|
2862
2862
|
const L = [];
|
|
2863
2863
|
L.push(`# ${m} , for the ${lens} reader`, "");
|
|
2864
2864
|
L.push(
|
|
2865
|
-
`>
|
|
2865
|
+
`> ThunderLens \`${lens}\` notes are woven in below. They explain meaning for this`,
|
|
2866
2866
|
`> audience; they are documentation, not verification.`,
|
|
2867
2867
|
""
|
|
2868
2868
|
);
|
|
@@ -3104,7 +3104,7 @@ function getHover(source, position = {}) {
|
|
|
3104
3104
|
target: lens,
|
|
3105
3105
|
kind: "note_lens",
|
|
3106
3106
|
title: `note ${lens}`,
|
|
3107
|
-
description: LENS_INFO[lens] || "An
|
|
3107
|
+
description: LENS_INFO[lens] || "An ThunderLens reader lens.",
|
|
3108
3108
|
examples: [],
|
|
3109
3109
|
relatedSuggestions: []
|
|
3110
3110
|
}
|
|
@@ -3904,7 +3904,7 @@ var LANG_EXT = {
|
|
|
3904
3904
|
ruby: "rb",
|
|
3905
3905
|
perl: "pl"
|
|
3906
3906
|
};
|
|
3907
|
-
function liftSource(source, { language = "typescript", file = "", seeds } = {}) {
|
|
3907
|
+
function liftSource(source, { language = "typescript", file = "", seeds = void 0 } = {}) {
|
|
3908
3908
|
const key = String(language).toLowerCase();
|
|
3909
3909
|
const adapter = ADAPTERS[key];
|
|
3910
3910
|
if (!adapter) {
|
|
@@ -4051,7 +4051,7 @@ function checkDrift(intentText, codeSource, { language = "typescript" } = {}) {
|
|
|
4051
4051
|
add("warning", "INTENT_DRIFT_STALE_PROOF", "The approved intent was edited after approval (hash mismatch). Re-approve it.");
|
|
4052
4052
|
}
|
|
4053
4053
|
} else {
|
|
4054
|
-
add("info", "INTENT_DRIFT_NOT_APPROVED", "This intent has no approval block. Approve it first:
|
|
4054
|
+
add("info", "INTENT_DRIFT_NOT_APPROVED", "This intent has no approval block. Approve it first: thunder approve <file>.");
|
|
4055
4055
|
}
|
|
4056
4056
|
const lift = liftSource(codeSource, { language });
|
|
4057
4057
|
if (!lift.ok) {
|
|
@@ -5677,7 +5677,7 @@ var IL_AUTHOR_RULE_ROWS = [
|
|
|
5677
5677
|
{ ruleId: "IL-SEC-002", area: "security", severity: "blocker", blocks: ["release"], summary: "API returns a secret with no auth requirement." },
|
|
5678
5678
|
{ ruleId: "IL-TYPE-001", area: "type", severity: "info", blocks: [], summary: "Field uses an unrecognized (likely mistyped) type." },
|
|
5679
5679
|
// 12-Factor Agents conformance (twelve-factor-v1). Advisory: an intent's alignment with the
|
|
5680
|
-
// humanlayer/12-factor-agents principles. `
|
|
5680
|
+
// humanlayer/12-factor-agents principles. `thunder twelve-factor` scores these.
|
|
5681
5681
|
{ ruleId: "IL-12F-01", area: "twelve-factor", severity: "info", blocks: [], summary: "F1 Natural language to tool calls: model dispatch as a decision/command." },
|
|
5682
5682
|
{ ruleId: "IL-12F-02", area: "twelve-factor", severity: "info", blocks: [], summary: "F2 Own your prompts: behavior is an owned, guaranteed contract, not a black box." },
|
|
5683
5683
|
{ ruleId: "IL-12F-03", area: "twelve-factor", severity: "info", blocks: [], summary: "F3 Own your context window: declare a scope boundary." },
|
|
@@ -5703,8 +5703,8 @@ var IL_CORE_RULE_ROWS = [
|
|
|
5703
5703
|
{ ruleId: "unknown-block", area: "core", severity: "info", blocks: [], summary: "Unrecognized top-level block." },
|
|
5704
5704
|
{ ruleId: "INTENT-ARCH-001", area: "architecture", severity: "warning", blocks: [], summary: "Architecture rule not understood." },
|
|
5705
5705
|
{ ruleId: "INTENT-AI-010", area: "ai", severity: "warning", blocks: [], summary: "Unsupported implementation scope." },
|
|
5706
|
-
{ ruleId: "INTENT_NOTE_UNKNOWN_LENS", area: "note", severity: "info", blocks: [], summary: "
|
|
5707
|
-
{ ruleId: "INTENT_NOTE_EMPTY", area: "note", severity: "info", blocks: [], summary: "
|
|
5706
|
+
{ ruleId: "INTENT_NOTE_UNKNOWN_LENS", area: "note", severity: "info", blocks: [], summary: "ThunderLens note uses an unknown lens." },
|
|
5707
|
+
{ ruleId: "INTENT_NOTE_EMPTY", area: "note", severity: "info", blocks: [], summary: "ThunderLens note is empty." }
|
|
5708
5708
|
];
|
|
5709
5709
|
var RULE_PHASES = ["author", "verify"];
|
|
5710
5710
|
var RULE_OWNERS = ["IL", "OT"];
|
|
@@ -7246,7 +7246,7 @@ function fingerprint(parts) {
|
|
|
7246
7246
|
return `fp_${h.toString(16)}`;
|
|
7247
7247
|
}
|
|
7248
7248
|
function makeScope({ type = "custom", title = null, seeds = [], projectId = null, createdBy = null, createdAt = null, ...rest2 } = {}) {
|
|
7249
|
-
if (!SCOPE_TYPES.includes(type)) throw new Error(`
|
|
7249
|
+
if (!SCOPE_TYPES.includes(type)) throw new Error(`thunder focus: unknown scope type "${type}"`);
|
|
7250
7250
|
return {
|
|
7251
7251
|
schema: FOCUS_SCHEMA,
|
|
7252
7252
|
scopeId: `scope.${type}.${fingerprint([type, ...seeds].map(String))}`,
|
|
@@ -8071,7 +8071,7 @@ function payloadOf(seq, entry, prev) {
|
|
|
8071
8071
|
};
|
|
8072
8072
|
}
|
|
8073
8073
|
function record(ledger, entry) {
|
|
8074
|
-
if (!entry || !ENTRY_TYPES.includes(entry.type)) throw new Error(`
|
|
8074
|
+
if (!entry || !ENTRY_TYPES.includes(entry.type)) throw new Error(`thunder ledger: unknown entry type "${entry?.type}"`);
|
|
8075
8075
|
const base = ledger && Array.isArray(ledger.entries) ? ledger : emptyLedger();
|
|
8076
8076
|
const payload = payloadOf(base.entries.length, entry, base.head);
|
|
8077
8077
|
const hash = sha256(JSON.stringify(payload));
|
|
@@ -8218,7 +8218,7 @@ function emptyEventLog() {
|
|
|
8218
8218
|
}
|
|
8219
8219
|
function recordEvent(log, event) {
|
|
8220
8220
|
if (!event || !INTENT_AI_EVENTS.includes(event.type)) {
|
|
8221
|
-
throw new Error(`
|
|
8221
|
+
throw new Error(`thunder ai events: unknown event type "${event?.type}"`);
|
|
8222
8222
|
}
|
|
8223
8223
|
const base = log && Array.isArray(log.events) ? log : emptyEventLog();
|
|
8224
8224
|
return { ...base, events: [...base.events, event] };
|
|
@@ -8582,14 +8582,14 @@ function buildGuard(ast, { denyResults, mask = "[redacted]" } = {}) {
|
|
|
8582
8582
|
}
|
|
8583
8583
|
function decide(name, inputs) {
|
|
8584
8584
|
const d = decisions.get(name);
|
|
8585
|
-
if (!d) throw new Error(`
|
|
8585
|
+
if (!d) throw new Error(`thunder guard: no decision "${name}"`);
|
|
8586
8586
|
const r = evaluateDecision(d, inputs || {});
|
|
8587
8587
|
return { ...r, allowed: !isDenied(r.result) };
|
|
8588
8588
|
}
|
|
8589
8589
|
function assertAllowed(name, inputs) {
|
|
8590
8590
|
const r = decide(name, inputs);
|
|
8591
8591
|
if (!r.allowed) {
|
|
8592
|
-
const e = new Error(`
|
|
8592
|
+
const e = new Error(`thunder guard: decision "${name}" denied the action (result: ${r.result})`);
|
|
8593
8593
|
e.code = "INTENT_GUARD_DENIED";
|
|
8594
8594
|
e.decision = name;
|
|
8595
8595
|
e.result = r.result;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skillstech/thunderlang",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Deterministic ThunderLang compiler, CLI, and Language Server. No AI required. Turns .
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "Deterministic ThunderLang compiler, CLI, and Language Server. No AI required. Turns .thunder files into the canonical Intent Graph, docs, and a proof, and EXECUTES the intent: run decisions, simulate lifecycles, and check outcome contracts. Interops with DMN, BPMN, JSON Schema, and OpenAPI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.mjs",
|
|
7
7
|
"types": "./src/index.d.ts",
|
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"tl": "src/cli.mjs"
|
|
22
|
+
"thunder": "src/cli.mjs",
|
|
23
|
+
"intent": "src/cli.mjs"
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
26
|
"src",
|
|
@@ -30,7 +29,8 @@
|
|
|
30
29
|
"syntaxes",
|
|
31
30
|
"CHANGELOG.md",
|
|
32
31
|
"README.md",
|
|
33
|
-
"LICENSE"
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"NOTICE"
|
|
34
34
|
],
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"build:cjs": "node scripts/build-cjs.mjs",
|
|
41
41
|
"prepack": "node scripts/build-cjs.mjs",
|
|
42
42
|
"prepublishOnly": "node scripts/build-cjs.mjs && node --test",
|
|
43
|
-
"check:example": "node src/cli.mjs check ../examples/CreateInvoice.
|
|
44
|
-
"build:example": "node src/cli.mjs build ../examples/CreateInvoice.
|
|
43
|
+
"check:example": "node src/cli.mjs check ../examples/CreateInvoice.thunder",
|
|
44
|
+
"build:example": "node src/cli.mjs build ../examples/CreateInvoice.thunder"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"esbuild": "^0.28.1"
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
"homepage": "https://thunderlang.dev",
|
|
71
71
|
"repository": {
|
|
72
72
|
"type": "git",
|
|
73
|
-
"url": "git+https://github.com/SkillsTechTalk/
|
|
73
|
+
"url": "git+https://github.com/SkillsTechTalk/intent-language.git",
|
|
74
74
|
"directory": "compiler"
|
|
75
75
|
},
|
|
76
76
|
"bugs": {
|
|
77
|
-
"url": "https://github.com/SkillsTechTalk/
|
|
77
|
+
"url": "https://github.com/SkillsTechTalk/intent-language/issues"
|
|
78
78
|
},
|
|
79
|
-
"author": "
|
|
80
|
-
"license": "
|
|
79
|
+
"author": "Skills Tech Talk, LLC",
|
|
80
|
+
"license": "Apache-2.0",
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
}
|
package/src/ai-events.mjs
CHANGED
|
@@ -16,7 +16,7 @@ export function emptyEventLog() {
|
|
|
16
16
|
/** Append an event to the log. Returns a NEW log (append-only, never mutates). */
|
|
17
17
|
export function recordEvent(log, event) {
|
|
18
18
|
if (!event || !INTENT_AI_EVENTS.includes(event.type)) {
|
|
19
|
-
throw new Error(`
|
|
19
|
+
throw new Error(`thunder ai events: unknown event type "${event?.type}"`);
|
|
20
20
|
}
|
|
21
21
|
const base = log && Array.isArray(log.events) ? log : emptyEventLog();
|
|
22
22
|
return { ...base, events: [...base.events, event] };
|