@kelnishi/tropelang-wasm 0.13.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/package.json +22 -0
- package/tropelang_wasm.d.ts +175 -0
- package/tropelang_wasm.js +9 -0
- package/tropelang_wasm_bg.js +807 -0
- package/tropelang_wasm_bg.wasm +0 -0
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kelnishi/tropelang-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WASM bindings for the TropeLang analysis core (the LSP/IDE backend).",
|
|
5
|
+
"version": "0.13.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"tropelang_wasm_bg.wasm",
|
|
8
|
+
"tropelang_wasm.js",
|
|
9
|
+
"tropelang_wasm_bg.js",
|
|
10
|
+
"tropelang_wasm.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"main": "tropelang_wasm.js",
|
|
13
|
+
"types": "tropelang_wasm.d.ts",
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"./tropelang_wasm.js",
|
|
16
|
+
"./snippets/*"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/kelnishi/TropeLang.git"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Context-aware completion at char offset `off`. The offset is a CHAR offset (== the editor's CM
|
|
6
|
+
* position for BMP text); the returned `from` is likewise a char offset.
|
|
7
|
+
*/
|
|
8
|
+
export function complete(src: string, off: number): string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The corpus catalog (metadata, no source) for the browser — tropes plus the base libraries
|
|
12
|
+
* (concepts + module dynamics). Each entry carries `terms`: the names it declares so Library search
|
|
13
|
+
* can find a file by an element it defines. `{"tropes": [{name, bucket, category, url, terms}, ...]}`.
|
|
14
|
+
*/
|
|
15
|
+
export function corpus(): string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The repo-relative `.trl` path of a corpus file, by name (e.g. "heist" → "trl/tropes/conflict/tactics/
|
|
19
|
+
* heist.trl") — for the viewer title bar. Empty if the name is not a corpus file.
|
|
20
|
+
*/
|
|
21
|
+
export function corpus_path(name: string): string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The full `.trl` source of one corpus file (trope or base library), by name.
|
|
25
|
+
*/
|
|
26
|
+
export function corpus_source(name: string): string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Where in the corpus a name is defined → the file (open it with `corpus_source`), or "" if none.
|
|
30
|
+
* Alias-aware: a surface form chases through to its canonical declaration's file.
|
|
31
|
+
*/
|
|
32
|
+
export function define(name: string): string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Describe a name for the hover / caret callout: its declaration kind, tags, first-class docstring, and —
|
|
36
|
+
* if it is a corpus-defined trope — its category/domain and wiki laconic. Buffer first (a local
|
|
37
|
+
* declaration), then the corpus. Returns `null` when nothing is known.
|
|
38
|
+
*/
|
|
39
|
+
export function describe(src: string, name: string): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Exact drams over the buffer → `{density, coverage, facts, firings, gap}`.
|
|
43
|
+
*/
|
|
44
|
+
export function drams(src: string): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The engine/grammar version (the core crate's version) — the source of truth for the spec-19
|
|
48
|
+
* `engineMin` compatibility gate. The site compares a corpus's `engineMin` against this and refuses to
|
|
49
|
+
* load a corpus newer than the bundled engine.
|
|
50
|
+
*/
|
|
51
|
+
export function engine_version(): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Epistemic-marked regions in a buffer (`!…!` absolute, `*…*` contingent, `?…?` latent) → spans for
|
|
55
|
+
* rendering markup (bold / italic / small-caps) over the inner text.
|
|
56
|
+
* `{"regions":[{tier, line, col, off, len}, ...]}` where `tier` ∈ {"!","*","?"}.
|
|
57
|
+
*/
|
|
58
|
+
export function epistemics(src: string): string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Run S3 over the buffer → `{firings, derived, initial, final}`. (Named `eval_buffer`, not `eval`,
|
|
62
|
+
* because `eval` is a reserved word in JS and wasm-bindgen would mangle it to `_eval`.)
|
|
63
|
+
*/
|
|
64
|
+
export function eval_buffer(src: string): string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Tab auto-expand: if the cursor is in a POSITIONAL param slot, the edit that names it — `{from, insert}`
|
|
68
|
+
* where insert is `key=` (key from the signature, else a default reserved key). "" when not applicable.
|
|
69
|
+
*/
|
|
70
|
+
export function expand_param(src: string, off: number): string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Recognition provenance — the recognition `--why` for the embed's pill panel. Per recognition: which
|
|
74
|
+
* buffer event satisfied each `when:` clause, the coverage re-checks behind the confidence, and any
|
|
75
|
+
* kind violation. Mirrors `suggest` (corpus + buffer-local). Use `explain_local` to toggle inline rules.
|
|
76
|
+
* `{"explanations": [{trope, file, confidence, clauses, coverage, typeViolation, bindings}, ...]}`.
|
|
77
|
+
*/
|
|
78
|
+
export function explain(src: string): string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* `explain` with the buffer-local-rules toggle (paired with `suggest_local`).
|
|
82
|
+
*/
|
|
83
|
+
export function explain_local(src: string, include_local: boolean): string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Parse + canonically serialize the buffer (round-trip / format) → `{ok, canonical, roundtrips}` or `{ok:false, error}`.
|
|
87
|
+
*/
|
|
88
|
+
export function format(src: string): string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The whole documented vocabulary of the corpus, for generating reference pages (glossary + trope
|
|
92
|
+
* index) from close-to-code. One call → the whole reference dataset.
|
|
93
|
+
*/
|
|
94
|
+
export function glossary(): string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Inlay hints: at each entity declaration, the tags its written tags transitively IMPLY (the hidden truth
|
|
98
|
+
* the imply rules bring), placed at the end of the declaration line. `[{off, text}]` (off = char offset).
|
|
99
|
+
*/
|
|
100
|
+
export function inlays(src: string): string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Layer a `.trlb` payload onto the active corpus (later-wins-by-stem) and apply `strikes` (a JSON array
|
|
104
|
+
* of stems to redact), then rebuild — so subsequent loads compose (base + expansion packs + redactions)
|
|
105
|
+
* without re-fetching the base. Returns `{ ok, count, errors }`.
|
|
106
|
+
*/
|
|
107
|
+
export function layer_corpus_trlb(bytes: Uint8Array, strikes_json: string): string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Semantic links for a buffer — declarations, references, and tags. A tag is flagged `known` iff it
|
|
111
|
+
* has a CANONICAL DECLARATION in the corpus (i.e. it would chase — an `imply` title or a concept/decl).
|
|
112
|
+
* Drives semantic highlighting, go-to-definition, and the context menu.
|
|
113
|
+
* `{"declarations":[{name,line,col,off,len}], "references":[…], "tags":[{…,known}]}`.
|
|
114
|
+
*/
|
|
115
|
+
export function links(src: string): string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Load a corpus from `[{"path","source"}]` JSON, replacing the active one. Rust derives all metadata
|
|
119
|
+
* from the path + preamble. Returns `{ "ok": bool, "count": n, "errors": [..] }`.
|
|
120
|
+
*/
|
|
121
|
+
export function load_corpus(files_json: string): string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Load a corpus from a `.trlb` post-parse binary payload (spec 24), **replacing** the active corpus —
|
|
125
|
+
* the parse-skip peer of [`load_corpus`]. `bytes` is a JS `Uint8Array`; decode the transport
|
|
126
|
+
* (`.trlb.gz`/br) in JS via `DecompressionStream` before calling. Returns `{ ok, count, errors }`.
|
|
127
|
+
*/
|
|
128
|
+
export function load_corpus_trlb(bytes: Uint8Array): string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Signature help: when the cursor is inside a declared tag/verb's `(...)`, its signature + the active
|
|
132
|
+
* param. `{name, params:[{label}], active}` (active is the 0-based slot), or "" when not in a known call.
|
|
133
|
+
*/
|
|
134
|
+
export function signature(src: string, off: number): string;
|
|
135
|
+
|
|
136
|
+
export function state_at(src: string, name: string, offset: number): string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* S23 fabula lens: re-emit the buffer in **story-time order** — top-level scenes carrying a `@@` stamp
|
|
140
|
+
* sorted by the `~>` clock (presentation order as tiebreak). The first S11 lens exposed to the host
|
|
141
|
+
* (`specs/17 §`); closed under TRL. → `{ok, trl}` or `{ok:false, error}`.
|
|
142
|
+
*/
|
|
143
|
+
export function story(src: string): string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Recognize tropes in a buffer → tiered, ranked recognitions with bindings, confidence, a span, and the
|
|
147
|
+
* trope file's header `meta`. `{"recognitions": [{trope, status:{kind,…}, confidence, bindings, span,
|
|
148
|
+
* meta:{…}}, ...]}`. Buffer-local rules are included by default; use `suggest_local` to toggle that off.
|
|
149
|
+
*/
|
|
150
|
+
export function suggest(src: string): string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* `suggest` with the buffer-local-rules toggle (the embed's "recognize inline rules" switch). Pass
|
|
154
|
+
* `false` to recognize against the embedded corpus only; the plain `suggest` keeps it on.
|
|
155
|
+
*/
|
|
156
|
+
export function suggest_local(src: string, include_local: boolean): string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Declared symbols in a buffer (the document outline / go-to-def source).
|
|
160
|
+
* `{"declarations": [{name, line, col, off, len}, ...]}`.
|
|
161
|
+
*/
|
|
162
|
+
export function symbols(src: string): string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Validate a buffer → `{"diagnostics": [{severity, line, message, fix?}, ...]}`. Import- and
|
|
166
|
+
* corpus-aware (`ide::Workspace::diagnostics`): "ensure it is imported" warnings are dropped for names
|
|
167
|
+
* the imports/corpus actually provide, surviving unfounded references are promoted to errors (with a
|
|
168
|
+
* founding-concept quick-fix), and the auto-fixable tag issues + S13 typed-signature checks append.
|
|
169
|
+
*/
|
|
170
|
+
export function validate(src: string): string;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Core/grammar version, for a frontend sanity check that the WASM loaded.
|
|
174
|
+
*/
|
|
175
|
+
export function version(): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./tropelang_wasm.d.ts" */
|
|
2
|
+
import * as wasm from "./tropelang_wasm_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./tropelang_wasm_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
complete, corpus, corpus_path, corpus_source, define, describe, drams, engine_version, epistemics, eval_buffer, expand_param, explain, explain_local, format, glossary, inlays, layer_corpus_trlb, links, load_corpus, load_corpus_trlb, signature, state_at, story, suggest, suggest_local, symbols, validate, version
|
|
9
|
+
} from "./tropelang_wasm_bg.js";
|
|
@@ -0,0 +1,807 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context-aware completion at char offset `off`. The offset is a CHAR offset (== the editor's CM
|
|
3
|
+
* position for BMP text); the returned `from` is likewise a char offset.
|
|
4
|
+
* @param {string} src
|
|
5
|
+
* @param {number} off
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export function complete(src, off) {
|
|
9
|
+
let deferred2_0;
|
|
10
|
+
let deferred2_1;
|
|
11
|
+
try {
|
|
12
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
14
|
+
const len0 = WASM_VECTOR_LEN;
|
|
15
|
+
wasm.complete(retptr, ptr0, len0, off);
|
|
16
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
17
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
18
|
+
deferred2_0 = r0;
|
|
19
|
+
deferred2_1 = r1;
|
|
20
|
+
return getStringFromWasm0(r0, r1);
|
|
21
|
+
} finally {
|
|
22
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
23
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The corpus catalog (metadata, no source) for the browser — tropes plus the base libraries
|
|
29
|
+
* (concepts + module dynamics). Each entry carries `terms`: the names it declares so Library search
|
|
30
|
+
* can find a file by an element it defines. `{"tropes": [{name, bucket, category, url, terms}, ...]}`.
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
export function corpus() {
|
|
34
|
+
let deferred1_0;
|
|
35
|
+
let deferred1_1;
|
|
36
|
+
try {
|
|
37
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
38
|
+
wasm.corpus(retptr);
|
|
39
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
40
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
41
|
+
deferred1_0 = r0;
|
|
42
|
+
deferred1_1 = r1;
|
|
43
|
+
return getStringFromWasm0(r0, r1);
|
|
44
|
+
} finally {
|
|
45
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
46
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The repo-relative `.trl` path of a corpus file, by name (e.g. "heist" → "trl/tropes/conflict/tactics/
|
|
52
|
+
* heist.trl") — for the viewer title bar. Empty if the name is not a corpus file.
|
|
53
|
+
* @param {string} name
|
|
54
|
+
* @returns {string}
|
|
55
|
+
*/
|
|
56
|
+
export function corpus_path(name) {
|
|
57
|
+
let deferred2_0;
|
|
58
|
+
let deferred2_1;
|
|
59
|
+
try {
|
|
60
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
61
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
62
|
+
const len0 = WASM_VECTOR_LEN;
|
|
63
|
+
wasm.corpus_path(retptr, ptr0, len0);
|
|
64
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
65
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
66
|
+
deferred2_0 = r0;
|
|
67
|
+
deferred2_1 = r1;
|
|
68
|
+
return getStringFromWasm0(r0, r1);
|
|
69
|
+
} finally {
|
|
70
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
71
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The full `.trl` source of one corpus file (trope or base library), by name.
|
|
77
|
+
* @param {string} name
|
|
78
|
+
* @returns {string}
|
|
79
|
+
*/
|
|
80
|
+
export function corpus_source(name) {
|
|
81
|
+
let deferred2_0;
|
|
82
|
+
let deferred2_1;
|
|
83
|
+
try {
|
|
84
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
85
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
86
|
+
const len0 = WASM_VECTOR_LEN;
|
|
87
|
+
wasm.corpus_source(retptr, ptr0, len0);
|
|
88
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
89
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
90
|
+
deferred2_0 = r0;
|
|
91
|
+
deferred2_1 = r1;
|
|
92
|
+
return getStringFromWasm0(r0, r1);
|
|
93
|
+
} finally {
|
|
94
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
95
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Where in the corpus a name is defined → the file (open it with `corpus_source`), or "" if none.
|
|
101
|
+
* Alias-aware: a surface form chases through to its canonical declaration's file.
|
|
102
|
+
* @param {string} name
|
|
103
|
+
* @returns {string}
|
|
104
|
+
*/
|
|
105
|
+
export function define(name) {
|
|
106
|
+
let deferred2_0;
|
|
107
|
+
let deferred2_1;
|
|
108
|
+
try {
|
|
109
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
110
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
112
|
+
wasm.define(retptr, ptr0, len0);
|
|
113
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
114
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
115
|
+
deferred2_0 = r0;
|
|
116
|
+
deferred2_1 = r1;
|
|
117
|
+
return getStringFromWasm0(r0, r1);
|
|
118
|
+
} finally {
|
|
119
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
120
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Describe a name for the hover / caret callout: its declaration kind, tags, first-class docstring, and —
|
|
126
|
+
* if it is a corpus-defined trope — its category/domain and wiki laconic. Buffer first (a local
|
|
127
|
+
* declaration), then the corpus. Returns `null` when nothing is known.
|
|
128
|
+
* @param {string} src
|
|
129
|
+
* @param {string} name
|
|
130
|
+
* @returns {string}
|
|
131
|
+
*/
|
|
132
|
+
export function describe(src, name) {
|
|
133
|
+
let deferred3_0;
|
|
134
|
+
let deferred3_1;
|
|
135
|
+
try {
|
|
136
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
137
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
138
|
+
const len0 = WASM_VECTOR_LEN;
|
|
139
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
140
|
+
const len1 = WASM_VECTOR_LEN;
|
|
141
|
+
wasm.describe(retptr, ptr0, len0, ptr1, len1);
|
|
142
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
143
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
144
|
+
deferred3_0 = r0;
|
|
145
|
+
deferred3_1 = r1;
|
|
146
|
+
return getStringFromWasm0(r0, r1);
|
|
147
|
+
} finally {
|
|
148
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
149
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Exact drams over the buffer → `{density, coverage, facts, firings, gap}`.
|
|
155
|
+
* @param {string} src
|
|
156
|
+
* @returns {string}
|
|
157
|
+
*/
|
|
158
|
+
export function drams(src) {
|
|
159
|
+
let deferred2_0;
|
|
160
|
+
let deferred2_1;
|
|
161
|
+
try {
|
|
162
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
163
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
164
|
+
const len0 = WASM_VECTOR_LEN;
|
|
165
|
+
wasm.drams(retptr, ptr0, len0);
|
|
166
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
167
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
168
|
+
deferred2_0 = r0;
|
|
169
|
+
deferred2_1 = r1;
|
|
170
|
+
return getStringFromWasm0(r0, r1);
|
|
171
|
+
} finally {
|
|
172
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
173
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The engine/grammar version (the core crate's version) — the source of truth for the spec-19
|
|
179
|
+
* `engineMin` compatibility gate. The site compares a corpus's `engineMin` against this and refuses to
|
|
180
|
+
* load a corpus newer than the bundled engine.
|
|
181
|
+
* @returns {string}
|
|
182
|
+
*/
|
|
183
|
+
export function engine_version() {
|
|
184
|
+
let deferred1_0;
|
|
185
|
+
let deferred1_1;
|
|
186
|
+
try {
|
|
187
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
188
|
+
wasm.engine_version(retptr);
|
|
189
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
190
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
191
|
+
deferred1_0 = r0;
|
|
192
|
+
deferred1_1 = r1;
|
|
193
|
+
return getStringFromWasm0(r0, r1);
|
|
194
|
+
} finally {
|
|
195
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
196
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Epistemic-marked regions in a buffer (`!…!` absolute, `*…*` contingent, `?…?` latent) → spans for
|
|
202
|
+
* rendering markup (bold / italic / small-caps) over the inner text.
|
|
203
|
+
* `{"regions":[{tier, line, col, off, len}, ...]}` where `tier` ∈ {"!","*","?"}.
|
|
204
|
+
* @param {string} src
|
|
205
|
+
* @returns {string}
|
|
206
|
+
*/
|
|
207
|
+
export function epistemics(src) {
|
|
208
|
+
let deferred2_0;
|
|
209
|
+
let deferred2_1;
|
|
210
|
+
try {
|
|
211
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
212
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
213
|
+
const len0 = WASM_VECTOR_LEN;
|
|
214
|
+
wasm.epistemics(retptr, ptr0, len0);
|
|
215
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
216
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
217
|
+
deferred2_0 = r0;
|
|
218
|
+
deferred2_1 = r1;
|
|
219
|
+
return getStringFromWasm0(r0, r1);
|
|
220
|
+
} finally {
|
|
221
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
222
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Run S3 over the buffer → `{firings, derived, initial, final}`. (Named `eval_buffer`, not `eval`,
|
|
228
|
+
* because `eval` is a reserved word in JS and wasm-bindgen would mangle it to `_eval`.)
|
|
229
|
+
* @param {string} src
|
|
230
|
+
* @returns {string}
|
|
231
|
+
*/
|
|
232
|
+
export function eval_buffer(src) {
|
|
233
|
+
let deferred2_0;
|
|
234
|
+
let deferred2_1;
|
|
235
|
+
try {
|
|
236
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
237
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
239
|
+
wasm.eval_buffer(retptr, ptr0, len0);
|
|
240
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
241
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
242
|
+
deferred2_0 = r0;
|
|
243
|
+
deferred2_1 = r1;
|
|
244
|
+
return getStringFromWasm0(r0, r1);
|
|
245
|
+
} finally {
|
|
246
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
247
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Tab auto-expand: if the cursor is in a POSITIONAL param slot, the edit that names it — `{from, insert}`
|
|
253
|
+
* where insert is `key=` (key from the signature, else a default reserved key). "" when not applicable.
|
|
254
|
+
* @param {string} src
|
|
255
|
+
* @param {number} off
|
|
256
|
+
* @returns {string}
|
|
257
|
+
*/
|
|
258
|
+
export function expand_param(src, off) {
|
|
259
|
+
let deferred2_0;
|
|
260
|
+
let deferred2_1;
|
|
261
|
+
try {
|
|
262
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
263
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
264
|
+
const len0 = WASM_VECTOR_LEN;
|
|
265
|
+
wasm.expand_param(retptr, ptr0, len0, off);
|
|
266
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
267
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
268
|
+
deferred2_0 = r0;
|
|
269
|
+
deferred2_1 = r1;
|
|
270
|
+
return getStringFromWasm0(r0, r1);
|
|
271
|
+
} finally {
|
|
272
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
273
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Recognition provenance — the recognition `--why` for the embed's pill panel. Per recognition: which
|
|
279
|
+
* buffer event satisfied each `when:` clause, the coverage re-checks behind the confidence, and any
|
|
280
|
+
* kind violation. Mirrors `suggest` (corpus + buffer-local). Use `explain_local` to toggle inline rules.
|
|
281
|
+
* `{"explanations": [{trope, file, confidence, clauses, coverage, typeViolation, bindings}, ...]}`.
|
|
282
|
+
* @param {string} src
|
|
283
|
+
* @returns {string}
|
|
284
|
+
*/
|
|
285
|
+
export function explain(src) {
|
|
286
|
+
let deferred2_0;
|
|
287
|
+
let deferred2_1;
|
|
288
|
+
try {
|
|
289
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
290
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
291
|
+
const len0 = WASM_VECTOR_LEN;
|
|
292
|
+
wasm.explain(retptr, ptr0, len0);
|
|
293
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
294
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
295
|
+
deferred2_0 = r0;
|
|
296
|
+
deferred2_1 = r1;
|
|
297
|
+
return getStringFromWasm0(r0, r1);
|
|
298
|
+
} finally {
|
|
299
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
300
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* `explain` with the buffer-local-rules toggle (paired with `suggest_local`).
|
|
306
|
+
* @param {string} src
|
|
307
|
+
* @param {boolean} include_local
|
|
308
|
+
* @returns {string}
|
|
309
|
+
*/
|
|
310
|
+
export function explain_local(src, include_local) {
|
|
311
|
+
let deferred2_0;
|
|
312
|
+
let deferred2_1;
|
|
313
|
+
try {
|
|
314
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
315
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
316
|
+
const len0 = WASM_VECTOR_LEN;
|
|
317
|
+
wasm.explain_local(retptr, ptr0, len0, include_local);
|
|
318
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
319
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
320
|
+
deferred2_0 = r0;
|
|
321
|
+
deferred2_1 = r1;
|
|
322
|
+
return getStringFromWasm0(r0, r1);
|
|
323
|
+
} finally {
|
|
324
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
325
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Parse + canonically serialize the buffer (round-trip / format) → `{ok, canonical, roundtrips}` or `{ok:false, error}`.
|
|
331
|
+
* @param {string} src
|
|
332
|
+
* @returns {string}
|
|
333
|
+
*/
|
|
334
|
+
export function format(src) {
|
|
335
|
+
let deferred2_0;
|
|
336
|
+
let deferred2_1;
|
|
337
|
+
try {
|
|
338
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
339
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
wasm.format(retptr, ptr0, len0);
|
|
342
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
343
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
344
|
+
deferred2_0 = r0;
|
|
345
|
+
deferred2_1 = r1;
|
|
346
|
+
return getStringFromWasm0(r0, r1);
|
|
347
|
+
} finally {
|
|
348
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
349
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* The whole documented vocabulary of the corpus, for generating reference pages (glossary + trope
|
|
355
|
+
* index) from close-to-code. One call → the whole reference dataset.
|
|
356
|
+
* @returns {string}
|
|
357
|
+
*/
|
|
358
|
+
export function glossary() {
|
|
359
|
+
let deferred1_0;
|
|
360
|
+
let deferred1_1;
|
|
361
|
+
try {
|
|
362
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
363
|
+
wasm.glossary(retptr);
|
|
364
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
365
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
366
|
+
deferred1_0 = r0;
|
|
367
|
+
deferred1_1 = r1;
|
|
368
|
+
return getStringFromWasm0(r0, r1);
|
|
369
|
+
} finally {
|
|
370
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
371
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Inlay hints: at each entity declaration, the tags its written tags transitively IMPLY (the hidden truth
|
|
377
|
+
* the imply rules bring), placed at the end of the declaration line. `[{off, text}]` (off = char offset).
|
|
378
|
+
* @param {string} src
|
|
379
|
+
* @returns {string}
|
|
380
|
+
*/
|
|
381
|
+
export function inlays(src) {
|
|
382
|
+
let deferred2_0;
|
|
383
|
+
let deferred2_1;
|
|
384
|
+
try {
|
|
385
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
386
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
387
|
+
const len0 = WASM_VECTOR_LEN;
|
|
388
|
+
wasm.inlays(retptr, ptr0, len0);
|
|
389
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
390
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
391
|
+
deferred2_0 = r0;
|
|
392
|
+
deferred2_1 = r1;
|
|
393
|
+
return getStringFromWasm0(r0, r1);
|
|
394
|
+
} finally {
|
|
395
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
396
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Layer a `.trlb` payload onto the active corpus (later-wins-by-stem) and apply `strikes` (a JSON array
|
|
402
|
+
* of stems to redact), then rebuild — so subsequent loads compose (base + expansion packs + redactions)
|
|
403
|
+
* without re-fetching the base. Returns `{ ok, count, errors }`.
|
|
404
|
+
* @param {Uint8Array} bytes
|
|
405
|
+
* @param {string} strikes_json
|
|
406
|
+
* @returns {string}
|
|
407
|
+
*/
|
|
408
|
+
export function layer_corpus_trlb(bytes, strikes_json) {
|
|
409
|
+
let deferred3_0;
|
|
410
|
+
let deferred3_1;
|
|
411
|
+
try {
|
|
412
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
413
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
414
|
+
const len0 = WASM_VECTOR_LEN;
|
|
415
|
+
const ptr1 = passStringToWasm0(strikes_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
416
|
+
const len1 = WASM_VECTOR_LEN;
|
|
417
|
+
wasm.layer_corpus_trlb(retptr, ptr0, len0, ptr1, len1);
|
|
418
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
419
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
420
|
+
deferred3_0 = r0;
|
|
421
|
+
deferred3_1 = r1;
|
|
422
|
+
return getStringFromWasm0(r0, r1);
|
|
423
|
+
} finally {
|
|
424
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
425
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Semantic links for a buffer — declarations, references, and tags. A tag is flagged `known` iff it
|
|
431
|
+
* has a CANONICAL DECLARATION in the corpus (i.e. it would chase — an `imply` title or a concept/decl).
|
|
432
|
+
* Drives semantic highlighting, go-to-definition, and the context menu.
|
|
433
|
+
* `{"declarations":[{name,line,col,off,len}], "references":[…], "tags":[{…,known}]}`.
|
|
434
|
+
* @param {string} src
|
|
435
|
+
* @returns {string}
|
|
436
|
+
*/
|
|
437
|
+
export function links(src) {
|
|
438
|
+
let deferred2_0;
|
|
439
|
+
let deferred2_1;
|
|
440
|
+
try {
|
|
441
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
442
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
443
|
+
const len0 = WASM_VECTOR_LEN;
|
|
444
|
+
wasm.links(retptr, ptr0, len0);
|
|
445
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
446
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
447
|
+
deferred2_0 = r0;
|
|
448
|
+
deferred2_1 = r1;
|
|
449
|
+
return getStringFromWasm0(r0, r1);
|
|
450
|
+
} finally {
|
|
451
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
452
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Load a corpus from `[{"path","source"}]` JSON, replacing the active one. Rust derives all metadata
|
|
458
|
+
* from the path + preamble. Returns `{ "ok": bool, "count": n, "errors": [..] }`.
|
|
459
|
+
* @param {string} files_json
|
|
460
|
+
* @returns {string}
|
|
461
|
+
*/
|
|
462
|
+
export function load_corpus(files_json) {
|
|
463
|
+
let deferred2_0;
|
|
464
|
+
let deferred2_1;
|
|
465
|
+
try {
|
|
466
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
467
|
+
const ptr0 = passStringToWasm0(files_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
468
|
+
const len0 = WASM_VECTOR_LEN;
|
|
469
|
+
wasm.load_corpus(retptr, ptr0, len0);
|
|
470
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
471
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
472
|
+
deferred2_0 = r0;
|
|
473
|
+
deferred2_1 = r1;
|
|
474
|
+
return getStringFromWasm0(r0, r1);
|
|
475
|
+
} finally {
|
|
476
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
477
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Load a corpus from a `.trlb` post-parse binary payload (spec 24), **replacing** the active corpus —
|
|
483
|
+
* the parse-skip peer of [`load_corpus`]. `bytes` is a JS `Uint8Array`; decode the transport
|
|
484
|
+
* (`.trlb.gz`/br) in JS via `DecompressionStream` before calling. Returns `{ ok, count, errors }`.
|
|
485
|
+
* @param {Uint8Array} bytes
|
|
486
|
+
* @returns {string}
|
|
487
|
+
*/
|
|
488
|
+
export function load_corpus_trlb(bytes) {
|
|
489
|
+
let deferred2_0;
|
|
490
|
+
let deferred2_1;
|
|
491
|
+
try {
|
|
492
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
493
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
494
|
+
const len0 = WASM_VECTOR_LEN;
|
|
495
|
+
wasm.load_corpus_trlb(retptr, ptr0, len0);
|
|
496
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
497
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
498
|
+
deferred2_0 = r0;
|
|
499
|
+
deferred2_1 = r1;
|
|
500
|
+
return getStringFromWasm0(r0, r1);
|
|
501
|
+
} finally {
|
|
502
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
503
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Signature help: when the cursor is inside a declared tag/verb's `(...)`, its signature + the active
|
|
509
|
+
* param. `{name, params:[{label}], active}` (active is the 0-based slot), or "" when not in a known call.
|
|
510
|
+
* @param {string} src
|
|
511
|
+
* @param {number} off
|
|
512
|
+
* @returns {string}
|
|
513
|
+
*/
|
|
514
|
+
export function signature(src, off) {
|
|
515
|
+
let deferred2_0;
|
|
516
|
+
let deferred2_1;
|
|
517
|
+
try {
|
|
518
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
519
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
520
|
+
const len0 = WASM_VECTOR_LEN;
|
|
521
|
+
wasm.signature(retptr, ptr0, len0, off);
|
|
522
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
523
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
524
|
+
deferred2_0 = r0;
|
|
525
|
+
deferred2_1 = r1;
|
|
526
|
+
return getStringFromWasm0(r0, r1);
|
|
527
|
+
} finally {
|
|
528
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
529
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @param {string} src
|
|
535
|
+
* @param {string} name
|
|
536
|
+
* @param {number} offset
|
|
537
|
+
* @returns {string}
|
|
538
|
+
*/
|
|
539
|
+
export function state_at(src, name, offset) {
|
|
540
|
+
let deferred3_0;
|
|
541
|
+
let deferred3_1;
|
|
542
|
+
try {
|
|
543
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
544
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
545
|
+
const len0 = WASM_VECTOR_LEN;
|
|
546
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
547
|
+
const len1 = WASM_VECTOR_LEN;
|
|
548
|
+
wasm.state_at(retptr, ptr0, len0, ptr1, len1, offset);
|
|
549
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
550
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
551
|
+
deferred3_0 = r0;
|
|
552
|
+
deferred3_1 = r1;
|
|
553
|
+
return getStringFromWasm0(r0, r1);
|
|
554
|
+
} finally {
|
|
555
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
556
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* S23 fabula lens: re-emit the buffer in **story-time order** — top-level scenes carrying a `@@` stamp
|
|
562
|
+
* sorted by the `~>` clock (presentation order as tiebreak). The first S11 lens exposed to the host
|
|
563
|
+
* (`specs/17 §`); closed under TRL. → `{ok, trl}` or `{ok:false, error}`.
|
|
564
|
+
* @param {string} src
|
|
565
|
+
* @returns {string}
|
|
566
|
+
*/
|
|
567
|
+
export function story(src) {
|
|
568
|
+
let deferred2_0;
|
|
569
|
+
let deferred2_1;
|
|
570
|
+
try {
|
|
571
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
572
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
573
|
+
const len0 = WASM_VECTOR_LEN;
|
|
574
|
+
wasm.story(retptr, ptr0, len0);
|
|
575
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
576
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
577
|
+
deferred2_0 = r0;
|
|
578
|
+
deferred2_1 = r1;
|
|
579
|
+
return getStringFromWasm0(r0, r1);
|
|
580
|
+
} finally {
|
|
581
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
582
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Recognize tropes in a buffer → tiered, ranked recognitions with bindings, confidence, a span, and the
|
|
588
|
+
* trope file's header `meta`. `{"recognitions": [{trope, status:{kind,…}, confidence, bindings, span,
|
|
589
|
+
* meta:{…}}, ...]}`. Buffer-local rules are included by default; use `suggest_local` to toggle that off.
|
|
590
|
+
* @param {string} src
|
|
591
|
+
* @returns {string}
|
|
592
|
+
*/
|
|
593
|
+
export function suggest(src) {
|
|
594
|
+
let deferred2_0;
|
|
595
|
+
let deferred2_1;
|
|
596
|
+
try {
|
|
597
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
598
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
599
|
+
const len0 = WASM_VECTOR_LEN;
|
|
600
|
+
wasm.suggest(retptr, ptr0, len0);
|
|
601
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
602
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
603
|
+
deferred2_0 = r0;
|
|
604
|
+
deferred2_1 = r1;
|
|
605
|
+
return getStringFromWasm0(r0, r1);
|
|
606
|
+
} finally {
|
|
607
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
608
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* `suggest` with the buffer-local-rules toggle (the embed's "recognize inline rules" switch). Pass
|
|
614
|
+
* `false` to recognize against the embedded corpus only; the plain `suggest` keeps it on.
|
|
615
|
+
* @param {string} src
|
|
616
|
+
* @param {boolean} include_local
|
|
617
|
+
* @returns {string}
|
|
618
|
+
*/
|
|
619
|
+
export function suggest_local(src, include_local) {
|
|
620
|
+
let deferred2_0;
|
|
621
|
+
let deferred2_1;
|
|
622
|
+
try {
|
|
623
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
624
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
626
|
+
wasm.suggest_local(retptr, ptr0, len0, include_local);
|
|
627
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
628
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
629
|
+
deferred2_0 = r0;
|
|
630
|
+
deferred2_1 = r1;
|
|
631
|
+
return getStringFromWasm0(r0, r1);
|
|
632
|
+
} finally {
|
|
633
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
634
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Declared symbols in a buffer (the document outline / go-to-def source).
|
|
640
|
+
* `{"declarations": [{name, line, col, off, len}, ...]}`.
|
|
641
|
+
* @param {string} src
|
|
642
|
+
* @returns {string}
|
|
643
|
+
*/
|
|
644
|
+
export function symbols(src) {
|
|
645
|
+
let deferred2_0;
|
|
646
|
+
let deferred2_1;
|
|
647
|
+
try {
|
|
648
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
649
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
650
|
+
const len0 = WASM_VECTOR_LEN;
|
|
651
|
+
wasm.symbols(retptr, ptr0, len0);
|
|
652
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
653
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
654
|
+
deferred2_0 = r0;
|
|
655
|
+
deferred2_1 = r1;
|
|
656
|
+
return getStringFromWasm0(r0, r1);
|
|
657
|
+
} finally {
|
|
658
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
659
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Validate a buffer → `{"diagnostics": [{severity, line, message, fix?}, ...]}`. Import- and
|
|
665
|
+
* corpus-aware (`ide::Workspace::diagnostics`): "ensure it is imported" warnings are dropped for names
|
|
666
|
+
* the imports/corpus actually provide, surviving unfounded references are promoted to errors (with a
|
|
667
|
+
* founding-concept quick-fix), and the auto-fixable tag issues + S13 typed-signature checks append.
|
|
668
|
+
* @param {string} src
|
|
669
|
+
* @returns {string}
|
|
670
|
+
*/
|
|
671
|
+
export function validate(src) {
|
|
672
|
+
let deferred2_0;
|
|
673
|
+
let deferred2_1;
|
|
674
|
+
try {
|
|
675
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
676
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
677
|
+
const len0 = WASM_VECTOR_LEN;
|
|
678
|
+
wasm.validate(retptr, ptr0, len0);
|
|
679
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
680
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
681
|
+
deferred2_0 = r0;
|
|
682
|
+
deferred2_1 = r1;
|
|
683
|
+
return getStringFromWasm0(r0, r1);
|
|
684
|
+
} finally {
|
|
685
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
686
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Core/grammar version, for a frontend sanity check that the WASM loaded.
|
|
692
|
+
* @returns {string}
|
|
693
|
+
*/
|
|
694
|
+
export function version() {
|
|
695
|
+
let deferred1_0;
|
|
696
|
+
let deferred1_1;
|
|
697
|
+
try {
|
|
698
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
699
|
+
wasm.version(retptr);
|
|
700
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
701
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
702
|
+
deferred1_0 = r0;
|
|
703
|
+
deferred1_1 = r1;
|
|
704
|
+
return getStringFromWasm0(r0, r1);
|
|
705
|
+
} finally {
|
|
706
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
707
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
let cachedDataViewMemory0 = null;
|
|
711
|
+
function getDataViewMemory0() {
|
|
712
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
713
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
714
|
+
}
|
|
715
|
+
return cachedDataViewMemory0;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
function getStringFromWasm0(ptr, len) {
|
|
719
|
+
return decodeText(ptr >>> 0, len);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
let cachedUint8ArrayMemory0 = null;
|
|
723
|
+
function getUint8ArrayMemory0() {
|
|
724
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
725
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
726
|
+
}
|
|
727
|
+
return cachedUint8ArrayMemory0;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
731
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
732
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
733
|
+
WASM_VECTOR_LEN = arg.length;
|
|
734
|
+
return ptr;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
738
|
+
if (realloc === undefined) {
|
|
739
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
740
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
741
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
742
|
+
WASM_VECTOR_LEN = buf.length;
|
|
743
|
+
return ptr;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
let len = arg.length;
|
|
747
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
748
|
+
|
|
749
|
+
const mem = getUint8ArrayMemory0();
|
|
750
|
+
|
|
751
|
+
let offset = 0;
|
|
752
|
+
|
|
753
|
+
for (; offset < len; offset++) {
|
|
754
|
+
const code = arg.charCodeAt(offset);
|
|
755
|
+
if (code > 0x7F) break;
|
|
756
|
+
mem[ptr + offset] = code;
|
|
757
|
+
}
|
|
758
|
+
if (offset !== len) {
|
|
759
|
+
if (offset !== 0) {
|
|
760
|
+
arg = arg.slice(offset);
|
|
761
|
+
}
|
|
762
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
763
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
764
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
765
|
+
|
|
766
|
+
offset += ret.written;
|
|
767
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
WASM_VECTOR_LEN = offset;
|
|
771
|
+
return ptr;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
775
|
+
cachedTextDecoder.decode();
|
|
776
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
777
|
+
let numBytesDecoded = 0;
|
|
778
|
+
function decodeText(ptr, len) {
|
|
779
|
+
numBytesDecoded += len;
|
|
780
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
781
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
782
|
+
cachedTextDecoder.decode();
|
|
783
|
+
numBytesDecoded = len;
|
|
784
|
+
}
|
|
785
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
const cachedTextEncoder = new TextEncoder();
|
|
789
|
+
|
|
790
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
791
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
792
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
793
|
+
view.set(buf);
|
|
794
|
+
return {
|
|
795
|
+
read: arg.length,
|
|
796
|
+
written: buf.length
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
let WASM_VECTOR_LEN = 0;
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
let wasm;
|
|
805
|
+
export function __wbg_set_wasm(val) {
|
|
806
|
+
wasm = val;
|
|
807
|
+
}
|
|
Binary file
|