@hyperfixi/patterns-reference 2.11.1 → 3.0.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/CHANGELOG.md +120 -0
- package/data/engine-verification.json +3 -4
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/{index-1ENU9L4F.d.mts → index-6GkHj5yJ.d.mts} +15 -1
- package/dist/{index-1ENU9L4F.d.ts → index-6GkHj5yJ.d.ts} +15 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/{llm-BfjUr-al.d.mts → llm-B5nGz8V1.d.mts} +1 -1
- package/dist/{llm-FVj71n77.d.ts → llm-rEdJQScF.d.ts} +1 -1
- package/dist/sync/index.d.mts +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/sync/db-stamp.ts +4 -0
- package/src/sync/markup-attributes.ts +111 -0
- package/src/types/index.ts +24 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,126 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.0.0] - 2026-09-03
|
|
11
|
+
|
|
12
|
+
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v3.0.0).
|
|
13
|
+
|
|
14
|
+
One major, two themes. `@lokascript/i18n`'s grammar transformer is gone,
|
|
15
|
+
because `@lokascript/semantic` overtook it on every row of the translation
|
|
16
|
+
corpus (#973–#1001). And the engine-migration plan
|
|
17
|
+
(`docs-internal/ENGINE_MIGRATION_PLAN.md`) is complete: its last arc deleted
|
|
18
|
+
the exported dead code it had been carrying and collapsed the browser bundle
|
|
19
|
+
lineup to two names (#1099–#1105).
|
|
20
|
+
|
|
21
|
+
### ⚠ BREAKING
|
|
22
|
+
|
|
23
|
+
- **`@lokascript/i18n` no longer translates** (#1001). `translate()`, `toLocale()`,
|
|
24
|
+
`toEnglish()`, `GrammarTransformer` and `createTransformer` are deleted; the
|
|
25
|
+
package is per-language vocabulary and grammar profiles. Migrate to
|
|
26
|
+
`import { translate } from '@lokascript/semantic'` (same signature; it throws
|
|
27
|
+
on unparseable input where the transformer returned nonsense). The classic-i18n
|
|
28
|
+
browser bundle, `@hyperscript-tools/i18n` and `@lokascript/types-browser` drop
|
|
29
|
+
the same members (#998, #999); the patterns corpus writer is semantic-only (#1000).
|
|
30
|
+
- **The prebuilt browser bundles are two names** (#1105): `hyperfixi-hx.js`
|
|
31
|
+
(small: hybrid parser, blocks, expressions, htmx v1/v2 attributes) and
|
|
32
|
+
`hyperfixi.js` (everything); `hyperfixi-hx-v4.js` and
|
|
33
|
+
`hyperfixi-multilingual.js` stay as separate products. `hyperfixi-lite.js`,
|
|
34
|
+
`-lite-plus.js`, `-minimal.js`, `-standard.js` and their `./browser/*`
|
|
35
|
+
exports are gone — use `hyperfixi-hx.js`, `hyperfixi.js`, or the Vite
|
|
36
|
+
plugin, which picks the tier itself. `./browser/hybrid-complete` remains as
|
|
37
|
+
the plugin's internal fallback.
|
|
38
|
+
- **Exported dead code deleted from `@hyperfixi/core`** — none had a
|
|
39
|
+
production caller: the six `@deprecated` `features/` families and the
|
|
40
|
+
modular bundle's `features` namespace (#1099); `Lexer`/`Tokens` (#1100 —
|
|
41
|
+
use `tokenize`); the `unified-types` `Validator`, the `types.d.ts` shim and
|
|
42
|
+
`registry/multilingual` (#1101); the `async` command (#1102 — it was
|
|
43
|
+
unreachable from parsed hyperscript; the manifest is 58 commands);
|
|
44
|
+
`ContextProviderRegistry`, the context-provider `Proxy`, the registry's
|
|
45
|
+
`context` slot and the plugin `contextProviders` field (#1104 — set
|
|
46
|
+
request-scoped values as `context.locals`).
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- **A small bundle fails loudly on a command it lacks and names `hyperfixi.js`**
|
|
51
|
+
(#1103). The hybrid parser had been dropping an unrecognised word silently;
|
|
52
|
+
making it loud also exposed and fixed three silent mis-parses in the hybrid
|
|
53
|
+
bundles: unquoted `fetch /api/data` fetched `/`, `send custom:event` sent
|
|
54
|
+
`custom` to `me`, and `repeat forever` ran zero iterations.
|
|
55
|
+
- **English→foreign rendering is gated** (#931–#972, #953): 3105/3105 corpus
|
|
56
|
+
renders parse on the canonical engine; the bare (handler-less) surface has its
|
|
57
|
+
own gate. `as JSON` stays part of the value (#991); a flattened loop header
|
|
58
|
+
closes (#992).
|
|
59
|
+
- Plugins report their real versions (#926); `analyze_content` is unshadowed in
|
|
60
|
+
the MCP server (#927); four dependency advisories resolved; the `domain-flow`
|
|
61
|
+
→ `server-bridge` route contract is pinned (#1000s).
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- `hyperfixi.js` and `hyperfixi-hx-v4.js` carry the 24-language render
|
|
66
|
+
vocabulary (~19 KB gzip each) so `translate` works in the browser (#931).
|
|
67
|
+
- Deprecated `@lokascript/domain-*` references repoint to `@lokascript/domains`.
|
|
68
|
+
|
|
69
|
+
## [2.11.1] - 2026-08-25
|
|
70
|
+
|
|
71
|
+
Patch release. Fixes the release workflow itself: the build now runs **after**
|
|
72
|
+
the version sync, so a published tarball carries its own version rather than
|
|
73
|
+
the previous one, and `version.ts` is committed (#925). Also lands the
|
|
74
|
+
agent-loop A/B benchmark with an isolated generator (#924).
|
|
75
|
+
|
|
76
|
+
## [2.11.0] - 2026-08-24
|
|
77
|
+
|
|
78
|
+
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.11.0).
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- **The domain-DSL family moved out** (#909). Twelve packages left this
|
|
83
|
+
monorepo: the ten publishable `@lokascript/domain-*` packages (bdd,
|
|
84
|
+
behaviorspec, config, flow, jsx, learn, llm, sql, todo, voice) plus the
|
|
85
|
+
private `domain-toolkit` and `mcp-multilingual-intent`. They now ship as
|
|
86
|
+
**`@lokascript/domains`**, one subpath export per domain, from the
|
|
87
|
+
[lokascript-domains](https://github.com/codetalcott/lokascript-domains)
|
|
88
|
+
repository.
|
|
89
|
+
|
|
90
|
+
All ten published names are **deprecated on npm**, each naming its
|
|
91
|
+
replacement subpath (`@lokascript/domain-sql` → "import from
|
|
92
|
+
`@lokascript/domains/sql`"). Existing installs keep working — deprecation is
|
|
93
|
+
a warning, not a removal — they simply stop receiving updates. The
|
|
94
|
+
pre-deletion tree is preserved at the `moved/domain-family` tag.
|
|
95
|
+
|
|
96
|
+
_Migration:_ replace nine dependencies with one, and change
|
|
97
|
+
`from '@lokascript/domain-x'` to `from '@lokascript/domains/x'`. The root
|
|
98
|
+
entry absorbed `domain-config` and exports `createDomainRegistry`,
|
|
99
|
+
`registerAllDomains` and `DOMAIN_PRIORITY`.
|
|
100
|
+
|
|
101
|
+
### Added
|
|
102
|
+
|
|
103
|
+
- **"Show in My Language"** — LSP request plus VSCode command (#921).
|
|
104
|
+
- **Verified-translation badge** in the compilation service (#920).
|
|
105
|
+
- **`scoreFidelity` / `@lokascript/semantic/fidelity`** (#919).
|
|
106
|
+
- **Inert-shape warnings** (#918) and surfaced unconsumed-input warnings (#916)
|
|
107
|
+
in the compilation service.
|
|
108
|
+
- **The agent-loop benchmark** and the silent-failure finding it produced
|
|
109
|
+
(#915), and the MCP server's agent-era roadmap (#914).
|
|
110
|
+
- **Element-collection write-back** for hypermedia tables, with gallery
|
|
111
|
+
examples and four system fixes (#904).
|
|
112
|
+
- **The comprehensive Playwright tier now runs in CI** (#908) alongside
|
|
113
|
+
`quick`. It had never run: 122 specs, hiding four real bugs — a detached
|
|
114
|
+
`startViewTransition`, untracked reads of unset globals, concurrent effects
|
|
115
|
+
clobbering dependency capture, and `put` stringifying DocumentFragments
|
|
116
|
+
(#905).
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
|
|
120
|
+
- **The `hyperscript-adapter` review arc** (#895–#902): whole-string
|
|
121
|
+
translation first, taking canonical validity from 2849/3105 to **3105/3105**
|
|
122
|
+
(#899); a host-parser validity gate so an invalid render falls back to the
|
|
123
|
+
author's text (#900); the dead split-statement fallback deleted after
|
|
124
|
+
measuring 0 outputs (#901); and the slim divergence set burned 6 → 1 via
|
|
125
|
+
schema marker data, repairing 39 body-dropping corpus rows (#902).
|
|
126
|
+
- **`qu take.recipient`** — the R1 tail's last `take` row (#910).
|
|
127
|
+
- **The release workflows** no longer reference the moved-out domain family
|
|
128
|
+
(#922).
|
|
129
|
+
|
|
10
130
|
## [2.10.0] - 2026-08-01
|
|
11
131
|
|
|
12
132
|
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.10.0).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"hyperscript": "upstream _hyperscript parse with zero recovered errors (extensions loaded: socket, worker, eventsource); parse-level only",
|
|
6
6
|
"html": "HTML-markup patterns: each _= / script-tag snippet verified individually; hx-live/sse-*/ws-* attributes are hyperfixi-only and block the upstream claim"
|
|
7
7
|
},
|
|
8
|
-
"lokascriptVersion": "2.
|
|
8
|
+
"lokascriptVersion": "2.11.1",
|
|
9
9
|
"hyperscriptVersion": "0.9.93"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"wait-for-event": "both",
|
|
170
170
|
"wait-then": "both",
|
|
171
171
|
"when-multiple-changes": "both",
|
|
172
|
-
"when-value-changes": "
|
|
172
|
+
"when-value-changes": "both",
|
|
173
173
|
"window-keydown": "both",
|
|
174
174
|
"window-resize": "both",
|
|
175
175
|
"window-scroll": "both",
|
|
@@ -847,8 +847,7 @@
|
|
|
847
847
|
},
|
|
848
848
|
"when-value-changes": {
|
|
849
849
|
"lokascript": true,
|
|
850
|
-
"hyperscript":
|
|
851
|
-
"hyperscriptError": "Unexpected value: $"
|
|
850
|
+
"hyperscript": true
|
|
852
851
|
},
|
|
853
852
|
"window-keydown": {
|
|
854
853
|
"lokascript": true,
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from '../llm-
|
|
2
|
-
import { C as ConnectionOptions, P as PatternRole, a as Pattern, R as RoleType } from '../index-
|
|
1
|
+
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from '../llm-B5nGz8V1.mjs';
|
|
2
|
+
import { C as ConnectionOptions, P as PatternRole, a as Pattern, R as RoleType } from '../index-6GkHj5yJ.mjs';
|
|
3
3
|
import { SemanticRole } from '@lokascript/semantic';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from '../llm-
|
|
2
|
-
import { C as ConnectionOptions, P as PatternRole, a as Pattern, R as RoleType } from '../index-
|
|
1
|
+
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from '../llm-rEdJQScF.js';
|
|
2
|
+
import { C as ConnectionOptions, P as PatternRole, a as Pattern, R as RoleType } from '../index-6GkHj5yJ.js';
|
|
3
3
|
import { SemanticRole } from '@lokascript/semantic';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -36,7 +36,21 @@ interface ClassifiedPattern extends Pattern {
|
|
|
36
36
|
}
|
|
37
37
|
type ComplexityLevel = 'simple-command' | 'simple-event' | 'chained-command' | 'multi-line-event' | 'behavior-install' | 'behavior-def' | 'def-function' | 'complex';
|
|
38
38
|
type WordOrder = 'SVO' | 'SOV' | 'VSO' | 'V2';
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* How a `pattern_translations` row was produced. The first three are the
|
|
41
|
+
* values `sync-translations` writes today; the rest are legacy/aspirational
|
|
42
|
+
* labels kept so existing rows and `getTranslationPriority` keep typing.
|
|
43
|
+
*
|
|
44
|
+
* - `semantic-render`: @lokascript/semantic `render(parse_en(en), L)` chosen by
|
|
45
|
+
* the `best` writer (or the `semantic` writer).
|
|
46
|
+
* - `grammar-transform`: @lokascript/i18n GrammarTransformer — under the `best`
|
|
47
|
+
* writer, a row i18n still renders better than semantic (the kept-row ratchet).
|
|
48
|
+
* - `grammar-transform-no-reference`: `best` only — the i18n row because semantic
|
|
49
|
+
* cannot parse the ENGLISH source (a parser-coverage gap, not a render loss).
|
|
50
|
+
* - `keyword-substitute`: word-for-word fallback for a language with no grammar profile.
|
|
51
|
+
* - `original`: the English row; `non-translatable-identity`: markup rows copied verbatim.
|
|
52
|
+
*/
|
|
53
|
+
type TranslationMethod = 'semantic-render' | 'grammar-transform' | 'grammar-transform-no-reference' | 'keyword-substitute' | 'original' | 'non-translatable-identity' | 'auto-generated' | 'hand-crafted' | 'verified';
|
|
40
54
|
/**
|
|
41
55
|
* A translation of a pattern to a specific language.
|
|
42
56
|
*/
|
|
@@ -36,7 +36,21 @@ interface ClassifiedPattern extends Pattern {
|
|
|
36
36
|
}
|
|
37
37
|
type ComplexityLevel = 'simple-command' | 'simple-event' | 'chained-command' | 'multi-line-event' | 'behavior-install' | 'behavior-def' | 'def-function' | 'complex';
|
|
38
38
|
type WordOrder = 'SVO' | 'SOV' | 'VSO' | 'V2';
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* How a `pattern_translations` row was produced. The first three are the
|
|
41
|
+
* values `sync-translations` writes today; the rest are legacy/aspirational
|
|
42
|
+
* labels kept so existing rows and `getTranslationPriority` keep typing.
|
|
43
|
+
*
|
|
44
|
+
* - `semantic-render`: @lokascript/semantic `render(parse_en(en), L)` chosen by
|
|
45
|
+
* the `best` writer (or the `semantic` writer).
|
|
46
|
+
* - `grammar-transform`: @lokascript/i18n GrammarTransformer — under the `best`
|
|
47
|
+
* writer, a row i18n still renders better than semantic (the kept-row ratchet).
|
|
48
|
+
* - `grammar-transform-no-reference`: `best` only — the i18n row because semantic
|
|
49
|
+
* cannot parse the ENGLISH source (a parser-coverage gap, not a render loss).
|
|
50
|
+
* - `keyword-substitute`: word-for-word fallback for a language with no grammar profile.
|
|
51
|
+
* - `original`: the English row; `non-translatable-identity`: markup rows copied verbatim.
|
|
52
|
+
*/
|
|
53
|
+
type TranslationMethod = 'semantic-render' | 'grammar-transform' | 'grammar-transform-no-reference' | 'keyword-substitute' | 'original' | 'non-translatable-identity' | 'auto-generated' | 'hand-crafted' | 'verified';
|
|
40
54
|
/**
|
|
41
55
|
* A translation of a pattern to a specific language.
|
|
42
56
|
*/
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as ConnectionOptions, b as Command, E as Expression, F as Feature, K as Keyword, S as SpecialSymbol, L as LanguageDocsStats, c as LanguageElementType, d as LanguageElement, e as LLMExample, f as PatternsReference } from './index-
|
|
2
|
-
export { g as ClassifiedPattern, h as ComplexityLevel, D as DiscoveryResult, i as EngineCompat, j as ExpressionOperator, a as Pattern, k as PatternStats, l as SearchOptions, m as SyncOptions, n as SyncResult, T as TestOptions, o as Translation, p as TranslationMethod, V as ValidationOptions, q as ValidationResult, r as VerificationResult, W as WordOrder } from './index-
|
|
1
|
+
import { C as ConnectionOptions, b as Command, E as Expression, F as Feature, K as Keyword, S as SpecialSymbol, L as LanguageDocsStats, c as LanguageElementType, d as LanguageElement, e as LLMExample, f as PatternsReference } from './index-6GkHj5yJ.mjs';
|
|
2
|
+
export { g as ClassifiedPattern, h as ComplexityLevel, D as DiscoveryResult, i as EngineCompat, j as ExpressionOperator, a as Pattern, k as PatternStats, l as SearchOptions, m as SyncOptions, n as SyncResult, T as TestOptions, o as Translation, p as TranslationMethod, V as ValidationOptions, q as ValidationResult, r as VerificationResult, W as WordOrder } from './index-6GkHj5yJ.mjs';
|
|
3
3
|
import Database from 'better-sqlite3';
|
|
4
|
-
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, w as getBehaviorPatterns, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from './llm-
|
|
4
|
+
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, w as getBehaviorPatterns, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from './llm-B5nGz8V1.mjs';
|
|
5
5
|
export { DbStampStatus, checkDbStamp, computeDbInputHash, dbStampPath, discoverPatterns, seedLLMExamples, syncTranslations, validateAllTranslations, writeDbStamp } from './sync/index.mjs';
|
|
6
6
|
import '@lokascript/semantic';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as ConnectionOptions, b as Command, E as Expression, F as Feature, K as Keyword, S as SpecialSymbol, L as LanguageDocsStats, c as LanguageElementType, d as LanguageElement, e as LLMExample, f as PatternsReference } from './index-
|
|
2
|
-
export { g as ClassifiedPattern, h as ComplexityLevel, D as DiscoveryResult, i as EngineCompat, j as ExpressionOperator, a as Pattern, k as PatternStats, l as SearchOptions, m as SyncOptions, n as SyncResult, T as TestOptions, o as Translation, p as TranslationMethod, V as ValidationOptions, q as ValidationResult, r as VerificationResult, W as WordOrder } from './index-
|
|
1
|
+
import { C as ConnectionOptions, b as Command, E as Expression, F as Feature, K as Keyword, S as SpecialSymbol, L as LanguageDocsStats, c as LanguageElementType, d as LanguageElement, e as LLMExample, f as PatternsReference } from './index-6GkHj5yJ.js';
|
|
2
|
+
export { g as ClassifiedPattern, h as ComplexityLevel, D as DiscoveryResult, i as EngineCompat, j as ExpressionOperator, a as Pattern, k as PatternStats, l as SearchOptions, m as SyncOptions, n as SyncResult, T as TestOptions, o as Translation, p as TranslationMethod, V as ValidationOptions, q as ValidationResult, r as VerificationResult, W as WordOrder } from './index-6GkHj5yJ.js';
|
|
3
3
|
import Database from 'better-sqlite3';
|
|
4
|
-
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, w as getBehaviorPatterns, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from './llm-
|
|
4
|
+
export { a as addLLMExample, b as buildFewShotContext, g as getAllPatterns, c as getAllTranslations, w as getBehaviorPatterns, d as getExamplesByCommand, e as getHighConfidenceTranslations, f as getHighQualityExamples, h as getLLMExamples, i as getLLMStats, j as getMostUsedExamples, k as getPatternById, l as getPatternStats, m as getPatternsByCategory, n as getPatternsByCommand, o as getTranslation, p as getTranslationStats, q as getTranslationsByLanguage, r as getVerifiedTranslations, s as getWordOrder, t as searchPatterns, u as updateQualityScore, v as verifyTranslation } from './llm-rEdJQScF.js';
|
|
5
5
|
export { DbStampStatus, checkDbStamp, computeDbInputHash, dbStampPath, discoverPatterns, seedLLMExamples, syncTranslations, validateAllTranslations, writeDbStamp } from './sync/index.js';
|
|
6
6
|
import '@lokascript/semantic';
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as SearchOptions, C as ConnectionOptions, a as Pattern, k as PatternStats, o as Translation, W as WordOrder, r as VerificationResult, e as LLMExample } from './index-
|
|
1
|
+
import { l as SearchOptions, C as ConnectionOptions, a as Pattern, k as PatternStats, o as Translation, W as WordOrder, r as VerificationResult, e as LLMExample } from './index-6GkHj5yJ.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Pattern Queries API
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as SearchOptions, C as ConnectionOptions, a as Pattern, k as PatternStats, o as Translation, W as WordOrder, r as VerificationResult, e as LLMExample } from './index-
|
|
1
|
+
import { l as SearchOptions, C as ConnectionOptions, a as Pattern, k as PatternStats, o as Translation, W as WordOrder, r as VerificationResult, e as LLMExample } from './index-6GkHj5yJ.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Pattern Queries API
|
package/dist/sync/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DiscoveryResult, m as SyncOptions, n as SyncResult, V as ValidationOptions, q as ValidationResult } from '../index-
|
|
1
|
+
import { D as DiscoveryResult, m as SyncOptions, n as SyncResult, V as ValidationOptions, q as ValidationResult } from '../index-6GkHj5yJ.mjs';
|
|
2
2
|
import '@lokascript/semantic';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/sync/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DiscoveryResult, m as SyncOptions, n as SyncResult, V as ValidationOptions, q as ValidationResult } from '../index-
|
|
1
|
+
import { D as DiscoveryResult, m as SyncOptions, n as SyncResult, V as ValidationOptions, q as ValidationResult } from '../index-6GkHj5yJ.js';
|
|
2
2
|
import '@lokascript/semantic';
|
|
3
3
|
|
|
4
4
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixi/patterns-reference",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Queryable patterns database for hyperscript with multilingual translations and LLM support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://github.com/codetalcott/hyperfixi/tree/main/packages/patterns-reference#readme",
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@lokascript/semantic": "^
|
|
69
|
+
"@lokascript/semantic": "^3.0.0",
|
|
70
70
|
"better-sqlite3": "^13.0.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@hyperfixi/core": "^
|
|
74
|
-
"@hyperfixi/reactivity": "^
|
|
75
|
-
"@hyperfixi/realtime": "^
|
|
73
|
+
"@hyperfixi/core": "^3.0.0",
|
|
74
|
+
"@hyperfixi/reactivity": "^3.0.0",
|
|
75
|
+
"@hyperfixi/realtime": "^3.0.0",
|
|
76
76
|
"@types/better-sqlite3": "^7.6.0",
|
|
77
77
|
"@types/node": "^26.1.2",
|
|
78
78
|
"hyperscript.org": "0.9.93",
|
package/src/sync/db-stamp.ts
CHANGED
|
@@ -74,6 +74,10 @@ export function computeDbInputHash(dbPath: string): string {
|
|
|
74
74
|
const root = repoRootFromDbPath(dbPath);
|
|
75
75
|
const files = dbInputFiles(dbPath);
|
|
76
76
|
const h = createHash('sha256');
|
|
77
|
+
// The renderer used to be hashed in here, because a DB written under
|
|
78
|
+
// PATTERNS_RENDERER=i18n|semantic|best was a DIFFERENT corpus from the same
|
|
79
|
+
// source and a gate expecting the default had to see it as stale. There is one
|
|
80
|
+
// renderer now, so the source files alone determine the corpus.
|
|
77
81
|
h.update(`files:${files.length}\0`);
|
|
78
82
|
for (const f of files) {
|
|
79
83
|
h.update(relative(root, f).split(sep).join('/'));
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locate and replace the hyperscript bodies inside an HTML-markup corpus row.
|
|
3
|
+
*
|
|
4
|
+
* WHY A REGEX, HERE, DELIBERATELY
|
|
5
|
+
* -------------------------------
|
|
6
|
+
* `html-snippets.ts` warns against regex-scanning HTML — correctly, for its job
|
|
7
|
+
* (walking whole `.html` FILES, where a `<pre>` showing escaped source matches a
|
|
8
|
+
* live attribute). This module has the opposite job: it takes one known-markup
|
|
9
|
+
* corpus row and must splice a translated body back in **without disturbing a
|
|
10
|
+
* single other byte** — indentation, quote style, attribute order, inner text.
|
|
11
|
+
* A DOM round-trip (jsdom `innerHTML`) reserializes all of that, so it is the
|
|
12
|
+
* wrong tool: the corpus stores these rows verbatim and they are compared
|
|
13
|
+
* verbatim. Offsets + splice keeps everything outside the attribute value
|
|
14
|
+
* untouched by construction.
|
|
15
|
+
*
|
|
16
|
+
* Scope: the `_` attribute, double- or single-quoted, which is what the corpus's
|
|
17
|
+
* markup rows carry. A value may contain the OTHER quote character — hyperscript
|
|
18
|
+
* string literals inside a double-quoted attribute are single-quoted, which is
|
|
19
|
+
* how `_="set ^user to {name: 'Demo'}"` is written — so the value class excludes
|
|
20
|
+
* only its own delimiter. (`hx-live` bodies are hyperscript too, but every corpus row
|
|
21
|
+
* using one is flagged non-translatable — its attribute NAMES are resolved
|
|
22
|
+
* per-language by vocab modules, so translating only the body would be half a
|
|
23
|
+
* job.) An attribute whose value contains its own quote character cannot occur
|
|
24
|
+
* in well-formed HTML and is not handled.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** One `_="…"` attribute value found in a markup row. */
|
|
28
|
+
export interface AttributeSpan {
|
|
29
|
+
/** Offset of the first character of the VALUE (inside the quotes). */
|
|
30
|
+
readonly start: number;
|
|
31
|
+
/** Offset one past the last character of the value. */
|
|
32
|
+
readonly end: number;
|
|
33
|
+
/** The raw attribute value — the hyperscript body. */
|
|
34
|
+
readonly body: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// `_` preceded by a tag-name/whitespace boundary so `data_x="…"` is not matched.
|
|
38
|
+
// The value excludes only its own delimiter: `[^"]*` for a double-quoted value,
|
|
39
|
+
// `[^']*` for a single-quoted one. (A single class excluding BOTH quotes was the
|
|
40
|
+
// first version and it silently skipped every attribute containing a hyperscript
|
|
41
|
+
// string literal — `component-with-conditional`, in all 23 languages.)
|
|
42
|
+
const ATTRIBUTE = /(^|[\s"'])_\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
|
|
43
|
+
|
|
44
|
+
/** Every `_="…"` body in `markup`, in source order. */
|
|
45
|
+
export function findHyperscriptAttributes(markup: string): AttributeSpan[] {
|
|
46
|
+
const spans: AttributeSpan[] = [];
|
|
47
|
+
ATTRIBUTE.lastIndex = 0;
|
|
48
|
+
let match: RegExpExecArray | null;
|
|
49
|
+
while ((match = ATTRIBUTE.exec(markup)) !== null) {
|
|
50
|
+
const body = match[2] ?? match[3];
|
|
51
|
+
// The value's offset: match start + everything before the body in the match.
|
|
52
|
+
const start = match.index + match[0].length - body.length - 1;
|
|
53
|
+
spans.push({ start, end: start + body.length, body });
|
|
54
|
+
}
|
|
55
|
+
return spans;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Replace each span's body with `replacements[i]`, leaving every other byte of
|
|
60
|
+
* `markup` untouched. Splices right-to-left so earlier offsets stay valid.
|
|
61
|
+
*/
|
|
62
|
+
export function spliceHyperscriptAttributes(
|
|
63
|
+
markup: string,
|
|
64
|
+
spans: readonly AttributeSpan[],
|
|
65
|
+
replacements: readonly string[]
|
|
66
|
+
): string {
|
|
67
|
+
if (spans.length !== replacements.length) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`spliceHyperscriptAttributes: ${spans.length} spans but ${replacements.length} replacements`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
let out = markup;
|
|
73
|
+
for (let i = spans.length - 1; i >= 0; i--) {
|
|
74
|
+
out = out.slice(0, spans[i].start) + replacements[i] + out.slice(spans[i].end);
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether a corpus row is HTML markup rather than hyperscript text.
|
|
81
|
+
*
|
|
82
|
+
* Mirrors testing-framework's `isHtmlMarkupPattern` (top-level hyperscript never
|
|
83
|
+
* begins with `<`; a leading selector literal like `<button/>` is an expression,
|
|
84
|
+
* never a statement start). Kept as its own copy rather than a dependency: this
|
|
85
|
+
* package is upstream of the testing framework in the build order.
|
|
86
|
+
*/
|
|
87
|
+
export function isMarkupRow(code: string): boolean {
|
|
88
|
+
return /^\s*<[a-zA-Z!]/.test(code);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Whether a parse carried the whole body: every non-whitespace character of the
|
|
93
|
+
* source reappears in its own English re-render.
|
|
94
|
+
*
|
|
95
|
+
* This is the guard that keeps a TRUNCATING parse out of the corpus. Measured
|
|
96
|
+
* 2026-08-27: `set ^user to attrs.data as JSON` parses, scores "faithful"
|
|
97
|
+
* against itself in all 23 languages, and has silently dropped `as JSON` — the
|
|
98
|
+
* conversion is in no role, so every recall metric compares two equally
|
|
99
|
+
* truncated things. Translating such a body would ship the truncation into 23
|
|
100
|
+
* languages; leaving it English keeps the text intact until the parser is fixed.
|
|
101
|
+
*
|
|
102
|
+
* Whitespace is ignored because a faithful re-render legitimately re-spaces
|
|
103
|
+
* punctuation (`{name: 'Demo'}` → `{ name : 'Demo' }`). The known limitation:
|
|
104
|
+
* whitespace INSIDE a string literal is ignored too, so a body differing only
|
|
105
|
+
* by spaces inside quotes would be accepted — narrow, and it cannot drop
|
|
106
|
+
* content, only re-space it.
|
|
107
|
+
*/
|
|
108
|
+
export function reRenderPreservesContent(source: string, reRenderedEnglish: string): boolean {
|
|
109
|
+
const strip = (s: string) => s.replace(/\s+/g, '');
|
|
110
|
+
return strip(source) === strip(reRenderedEnglish);
|
|
111
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -55,7 +55,30 @@ export type ComplexityLevel =
|
|
|
55
55
|
// =============================================================================
|
|
56
56
|
|
|
57
57
|
export type WordOrder = 'SVO' | 'SOV' | 'VSO' | 'V2';
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* How a `pattern_translations` row was produced. The first three are the
|
|
60
|
+
* values `sync-translations` writes today; the rest are legacy/aspirational
|
|
61
|
+
* labels kept so existing rows and `getTranslationPriority` keep typing.
|
|
62
|
+
*
|
|
63
|
+
* - `semantic-render`: @lokascript/semantic `render(parse_en(en), L)` chosen by
|
|
64
|
+
* the `best` writer (or the `semantic` writer).
|
|
65
|
+
* - `grammar-transform`: @lokascript/i18n GrammarTransformer — under the `best`
|
|
66
|
+
* writer, a row i18n still renders better than semantic (the kept-row ratchet).
|
|
67
|
+
* - `grammar-transform-no-reference`: `best` only — the i18n row because semantic
|
|
68
|
+
* cannot parse the ENGLISH source (a parser-coverage gap, not a render loss).
|
|
69
|
+
* - `keyword-substitute`: word-for-word fallback for a language with no grammar profile.
|
|
70
|
+
* - `original`: the English row; `non-translatable-identity`: markup rows copied verbatim.
|
|
71
|
+
*/
|
|
72
|
+
export type TranslationMethod =
|
|
73
|
+
| 'semantic-render'
|
|
74
|
+
| 'grammar-transform'
|
|
75
|
+
| 'grammar-transform-no-reference'
|
|
76
|
+
| 'keyword-substitute'
|
|
77
|
+
| 'original'
|
|
78
|
+
| 'non-translatable-identity'
|
|
79
|
+
| 'auto-generated'
|
|
80
|
+
| 'hand-crafted'
|
|
81
|
+
| 'verified';
|
|
59
82
|
|
|
60
83
|
/**
|
|
61
84
|
* Pattern priority levels for translation selection.
|