@fossil-lang/wasm 0.3.0-alpha.3 → 0.3.0-alpha.5

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/README.md CHANGED
@@ -3,16 +3,20 @@
3
3
  JS/TS wrapper around the `fossil-wasm` Rust crate's wasm-bindgen artefacts. Provides:
4
4
 
5
5
  - `initFossilWasm({ wasmUrl })` — consumer-controlled `.wasm` URL loader (memoised).
6
- - `tokenize(text)` — calls the Rust lexer, returns `TokenRow[]` (ADR-0030).
7
- - `semanticLegend()` — returns the LSP semantic-tokens legend (Phase 6 plan 06-07).
8
- - `FossilPlayground` — the Workspace API class (ADR-0024) for LSP + compile.
6
+ - `tokenize(text)` — calls the Rust lexer, returns `TokenRow[]`. The Rust lexer
7
+ is the only lexer: no host reimplements one and drifts from the grammar.
8
+ - `semanticLegend()` — returns the LSP semantic-tokens legend.
9
+ - `FossilPlayground` — the Workspace API class for LSP + compile. `fossil-lsp`
10
+ itself is native-only (stdio over crossbeam), so the browser gets this
11
+ equivalent dispatch surface over the same `fossil-ide` functions.
9
12
 
10
13
  ## Why explicit `init({ wasmUrl })` and not auto-load?
11
14
 
12
15
  We use `wasm-bindgen --target web` (NOT `--target bundler`). This means consumers
13
16
  control the `.wasm` URL resolution — works in Vite, Next.js, Webpack, Rspack, or
14
- plain `new URL(...)` in a Web Worker context. See `08-RESEARCH.md` Pitfall 1
15
- (this monorepo's phase-8 research) for why `--target bundler` was rejected.
17
+ plain `new URL(...)` in a Web Worker context. `--target bundler` was rejected
18
+ because its output assumes the consumer's bundler resolves `.wasm` ESM imports,
19
+ which a republished library cannot assume of a host's Vite/Next/Webpack config.
16
20
 
17
21
  ## Consumer patterns
18
22
 
@@ -23,7 +27,7 @@ import { initFossilWasm, tokenize } from '@fossil-lang/wasm';
23
27
  import wasmUrl from '@fossil-lang/wasm/pkg/fossil_wasm_bg.wasm?url';
24
28
 
25
29
  await initFossilWasm({ wasmUrl });
26
- const tokens = tokenize('prefix ex: <https://example.org/>');
30
+ const tokens = tokenize('User := io.csv("data/people.csv")');
27
31
  ```
28
32
 
29
33
  ### Next.js host (in a Client Component)
@@ -63,8 +67,6 @@ Optionally `wasm-opt` (binaryen) for size reduction.
63
67
 
64
68
  ## Source of truth
65
69
 
66
- - Rust crate: `crates/fossil-wasm/`
67
- - tokenize ADR: `decisions/0030-wasm-exported-tokenizer.md`
68
- - Workspace API ADR: `decisions/0024-fossil-wasm-workspace-api.md`
69
- - Distribution pattern: `decisions/0028-playground-as-react-library.md`
70
- (this package is one of the six in the `@fossil-lang/*` family)
70
+ - Rust crate: `crates/fossil-wasm/` — everything here is a wrapper over its
71
+ wasm-bindgen exports, and nothing in this package reimplements it.
72
+ - The grammar the tokenizer follows: `grammar.bnf` at the repo root.
package/dist/client.d.ts CHANGED
@@ -9,16 +9,18 @@
9
9
  * the `wasm` binding in one instance while these functions read `undefined` from
10
10
  * another (→ `Cannot read properties of undefined (reading '__wbindgen_malloc…')`,
11
11
  * seen when the codemirror tokenizer calls `tokenize` on the main thread).
12
- * Mirrors `@fossil-lang/graph`'s `client.ts` split, the known-good shape.
12
+ * Mirrors `@fossil-lang/corpus`'s `client.ts` split, the known-good shape.
13
13
  */
14
14
  import { FileHandle as RawFileHandle } from '../pkg/fossil_wasm.js';
15
- import type { TokenRow, SemanticTokensLegend } from '@fossil-lang/types';
16
- import type { CheckRow, StdlibClass, InferredDescriptorJson, SourceRefInfo, ProviderInfo } from './index.js';
15
+ import type { TokenRow, TokenKindLegend, SemanticTokensLegend } from '@fossil-lang/types';
16
+ import type { CheckRow, CompletionRow, DefinitionRow, HoverRow, InferredDescriptorJson, SourceRefInfo, ProviderInfo } from './index.js';
17
17
  /**
18
18
  * Install the LSP-over-postMessage dispatcher on the current Worker scope.
19
19
  *
20
- * Per ADR-0024 (`fossil-wasm` IS the LSP server-side) + Phase 7 plan 07-03
21
- * (the 16-route dispatch loop). The Rust function (re-exported from
20
+ * `fossil-wasm` IS the LSP server-side in the browser: `fossil-lsp` is
21
+ * native-only (it speaks stdio over crossbeam and does not compile to
22
+ * `wasm32`), so the Worker gets an equivalent 16-route dispatch loop over the
23
+ * same `fossil-ide` free functions. The Rust function (re-exported from
22
24
  * `crates/fossil-wasm/src/lsp_worker.rs`) installs `self.onmessage` on the
23
25
  * Worker scope and owns LSP JSON-RPC dispatch from that point forward.
24
26
  *
@@ -37,14 +39,32 @@ export declare function start_lsp_worker(): void;
37
39
  export type FileHandle = RawFileHandle;
38
40
  /**
39
41
  * Tokenize a Fossil source string. Returns the byte-range tokens from the
40
- * canonical Rust lexer (`fossil_syntax::lexer::raw_lex`) — single grammar
41
- * source of truth per ADR-0030.
42
+ * canonical Rust lexer (`fossil_syntax::lexer::raw_lex`) — the single grammar
43
+ * source of truth, so no editor ever reimplements the lexer in TS and drifts.
42
44
  *
43
45
  * MUST be called after {@link initFossilWasm} has resolved; otherwise the
44
46
  * underlying wasm-bindgen function throws (the wasm module is not yet
45
47
  * instantiated).
46
48
  */
47
49
  export declare function tokenize(text: string): TokenRow[];
50
+ /**
51
+ * The legend for {@link TokenRow.kind}: every lexer variant NAME, indexed by the
52
+ * discriminant a row carries. `tokenKinds()[row.kind]` is `"Comment"`,
53
+ * `"KwFrom"`, `"String"`, …
54
+ *
55
+ * **This is the contract, and the numbers are not.** `kind` is a variant
56
+ * discriminant of `fossil_syntax::lexer::Token`, so any reorder of that enum
57
+ * remaps every value with nothing going red. The predecessor of this package
58
+ * hard-coded the table (`enum FossilKind { Whitespace = 0, … }`) under a comment
59
+ * saying it had to be updated in lockstep; it was wrong in nine places by the
60
+ * time it was deleted. Keying on the name is what makes a reorder a non-event.
61
+ *
62
+ * An index past the end of the legend is a variant appended by a compiler newer
63
+ * than this host: `undefined`, and a host styles it as plain text.
64
+ *
65
+ * MUST be called after {@link initFossilWasm} has resolved.
66
+ */
67
+ export declare function tokenKinds(): TokenKindLegend;
48
68
  /**
49
69
  * Returns the LSP `SemanticTokensLegend` (token types + modifiers list) the
50
70
  * editor uses to map LSP `semanticTokens/full` response indices to highlight
@@ -59,7 +79,7 @@ export declare function semanticLegend(): SemanticTokensLegend;
59
79
  * (every data URI + `schema =` argument, each tagged with its `@conn` alias and
60
80
  * role). keasy's client-compute job runner reads this to derive a job's
61
81
  * connections WITHOUT subprocessing `fossil` / a server round-trip. Identical
62
- * shape to the native `fossil refs` (the SAME `fossil_run_status::SourceRefInfo`
82
+ * shape to the native `fossil refs` (the SAME `fossil_lineage::SourceRefInfo`
63
83
  * struct), so the browser and the CLI never diverge.
64
84
  *
65
85
  * MUST be called after {@link initFossilWasm} has resolved.
@@ -74,7 +94,7 @@ export declare function refs(program: string): SourceRefInfo[];
74
94
  */
75
95
  export declare function providers(): ProviderInfo[];
76
96
  /**
77
- * Workspace API class (ADR-0024). Thin TS wrapper around the wasm-bindgen
97
+ * Workspace API class. Thin TS wrapper around the wasm-bindgen
78
98
  * `FossilPlayground` that exposes camelCase method names for JS idiom + better
79
99
  * TS inference (the raw bindings use snake_case from the Rust impl block).
80
100
  *
@@ -92,11 +112,6 @@ export declare class FossilPlayground {
92
112
  * longer needed (e.g. component unmount).
93
113
  */
94
114
  free(): void;
95
- /**
96
- * Return the stdlib classification manifest (STDL-07). The playground reads
97
- * this once at startup to render `native_udf_only` functions as disabled.
98
- */
99
- classification(): StdlibClass[];
100
115
  /**
101
116
  * Open a file in the workspace. Returns the {@link FileHandle} subsequent
102
117
  * `updateFile` / `closeFile` / `diagnosticsFor` calls key on.
@@ -104,8 +119,9 @@ export declare class FossilPlayground {
104
119
  openFile(path: string, contents: string): FileHandle;
105
120
  /**
106
121
  * Apply an edit to an open file. Mutates the SAME `SourceFile` via the Salsa
107
- * `Setter` (`set_text`) — bumps the revision (ADR-0022) for incremental
108
- * invalidation rather than a full recompute.
122
+ * `Setter` (`set_text`) — bumps the revision for incremental
123
+ * invalidation rather than a full recompute, and that revision bump is also
124
+ * what cancels any analysis still running on an older snapshot.
109
125
  */
110
126
  updateFile(handle: FileHandle, contents: string): void;
111
127
  /**
@@ -124,17 +140,59 @@ export declare class FossilPlayground {
124
140
  */
125
141
  diagnosticsFor(handle: FileHandle): CheckRow[];
126
142
  /**
127
- * Install a user-supplied ShEx schema as the active output descriptor. On
128
- * parse failure the previously-installed descriptor is RETAINED.
143
+ * What is under the cursor — `{ markdown, range }`, or `null` when nothing
144
+ * there has a type.
145
+ *
146
+ * `line` / `character` are LSP: zero-based, `character` in UTF-16 code units.
147
+ * A CodeMirror or Monaco host already counts in those units, so a document
148
+ * offset converts with `doc.lineAt(pos)` and no byte arithmetic — unlike
149
+ * {@link tokenize}, whose offsets ARE bytes.
150
+ *
151
+ * ## Push the buffer before you ask
152
+ *
153
+ * This reads the text of the last {@link updateFile}. Hover fires on
154
+ * mouse-move and the checker is debounced, so a hover mid-debounce answers
155
+ * about text one keystroke old and its range lands one keystroke wrong. The
156
+ * three read-only methods take a SHARED borrow on the Rust side and cannot
157
+ * poison the workspace the way a re-entered `updateFile` once could — see the
158
+ * `ide` module in `crates/fossil-wasm` — but staleness is not a borrow
159
+ * problem and nothing here can fix it for you.
160
+ */
161
+ hover(handle: FileHandle, line: number, character: number): HoverRow | null;
162
+ /**
163
+ * The completion candidates at a position, already narrowed by the receiver:
164
+ * `str.` offers string members and no reader, a property-key position offers
165
+ * the target shape's predicates and no catalogue row at all.
166
+ *
167
+ * `kind` is the LSP `CompletionItemKind` **by name** (`"function"`,
168
+ * `"field"`) rather than by number. The numbers never cross this boundary —
169
+ * `packages/codemirror-fossil`'s deleted predecessor is what happens when
170
+ * they do.
171
+ *
172
+ * The same staleness note as {@link hover} applies, and harder: completion
173
+ * fires on nearly every keystroke.
129
174
  */
130
- setTargetShex(text: string): void;
175
+ completions(handle: FileHandle, line: number, character: number): CompletionRow[];
131
176
  /**
132
- * Register an {@link InferredDescriptorJson} for a source binding name BEFORE
133
- * invoking {@link check}. The Rust compiler reads from this during forward
134
- * type propagation.
177
+ * Where the name under the cursor is defined. Empty when nothing there has a
178
+ * definition.
179
+ *
180
+ * `uri` is the key the buffer was opened under, verbatim — and two of the
181
+ * four positions this recognises resolve into the **shape document**, so a
182
+ * host with a single editor pane has to read `uri` before it moves a cursor.
183
+ */
184
+ gotoDefinition(handle: FileHandle, line: number, character: number): DefinitionRow[];
185
+ /**
186
+ * Register an {@link InferredDescriptorJson} under the source URI the program
187
+ * wrote, BEFORE invoking {@link check}. The Rust compiler reads from this
188
+ * during forward type propagation.
189
+ *
190
+ * The compiler never introspects a source itself: it performs no network or
191
+ * file IO — that would break the WASM gate and Salsa's determinism alike —
192
+ * so a host that wants column types must run the `DESCRIBE` and push the
193
+ * result in here.
135
194
  *
136
195
  * @throws Error if the descriptor JSON fails to deserialise on the Rust side.
137
- * @see ADR-0037
138
196
  */
139
197
  registerInferredDescriptor(descriptor: InferredDescriptorJson): void;
140
198
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,UAAU,IAAI,aAAa,EAM5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC;AAEvC;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAMjD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,CAErD;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAErD;AAED;;;;;;GA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UAAU,EAAE,sBAAsB,GAAG,IAAI;CAKrE"}
package/dist/client.js CHANGED
@@ -9,14 +9,16 @@
9
9
  * the `wasm` binding in one instance while these functions read `undefined` from
10
10
  * another (→ `Cannot read properties of undefined (reading '__wbindgen_malloc…')`,
11
11
  * seen when the codemirror tokenizer calls `tokenize` on the main thread).
12
- * Mirrors `@fossil-lang/graph`'s `client.ts` split, the known-good shape.
12
+ * Mirrors `@fossil-lang/corpus`'s `client.ts` split, the known-good shape.
13
13
  */
14
- import { FossilPlayground as RawFossilPlayground, FileHandle as RawFileHandle, tokenize as rawTokenize, semantic_legend as rawSemanticLegend, start_lsp_worker as rawStartLspWorker, refs as rawRefs, providers as rawProviders, } from '../pkg/fossil_wasm.js';
14
+ import { FossilPlayground as RawFossilPlayground, FileHandle as RawFileHandle, tokenize as rawTokenize, semantic_legend as rawSemanticLegend, tokenKinds as rawTokenKinds, start_lsp_worker as rawStartLspWorker, refs as rawRefs, providers as rawProviders, } from '../pkg/fossil_wasm.js';
15
15
  /**
16
16
  * Install the LSP-over-postMessage dispatcher on the current Worker scope.
17
17
  *
18
- * Per ADR-0024 (`fossil-wasm` IS the LSP server-side) + Phase 7 plan 07-03
19
- * (the 16-route dispatch loop). The Rust function (re-exported from
18
+ * `fossil-wasm` IS the LSP server-side in the browser: `fossil-lsp` is
19
+ * native-only (it speaks stdio over crossbeam and does not compile to
20
+ * `wasm32`), so the Worker gets an equivalent 16-route dispatch loop over the
21
+ * same `fossil-ide` free functions. The Rust function (re-exported from
20
22
  * `crates/fossil-wasm/src/lsp_worker.rs`) installs `self.onmessage` on the
21
23
  * Worker scope and owns LSP JSON-RPC dispatch from that point forward.
22
24
  *
@@ -29,8 +31,8 @@ export function start_lsp_worker() {
29
31
  }
30
32
  /**
31
33
  * Tokenize a Fossil source string. Returns the byte-range tokens from the
32
- * canonical Rust lexer (`fossil_syntax::lexer::raw_lex`) — single grammar
33
- * source of truth per ADR-0030.
34
+ * canonical Rust lexer (`fossil_syntax::lexer::raw_lex`) — the single grammar
35
+ * source of truth, so no editor ever reimplements the lexer in TS and drifts.
34
36
  *
35
37
  * MUST be called after {@link initFossilWasm} has resolved; otherwise the
36
38
  * underlying wasm-bindgen function throws (the wasm module is not yet
@@ -43,6 +45,26 @@ export function tokenize(text) {
43
45
  // exactly. Cast is safe because the Rust ↔ JS contract is enforced upstream.
44
46
  return rawTokenize(text);
45
47
  }
48
+ /**
49
+ * The legend for {@link TokenRow.kind}: every lexer variant NAME, indexed by the
50
+ * discriminant a row carries. `tokenKinds()[row.kind]` is `"Comment"`,
51
+ * `"KwFrom"`, `"String"`, …
52
+ *
53
+ * **This is the contract, and the numbers are not.** `kind` is a variant
54
+ * discriminant of `fossil_syntax::lexer::Token`, so any reorder of that enum
55
+ * remaps every value with nothing going red. The predecessor of this package
56
+ * hard-coded the table (`enum FossilKind { Whitespace = 0, … }`) under a comment
57
+ * saying it had to be updated in lockstep; it was wrong in nine places by the
58
+ * time it was deleted. Keying on the name is what makes a reorder a non-event.
59
+ *
60
+ * An index past the end of the legend is a variant appended by a compiler newer
61
+ * than this host: `undefined`, and a host styles it as plain text.
62
+ *
63
+ * MUST be called after {@link initFossilWasm} has resolved.
64
+ */
65
+ export function tokenKinds() {
66
+ return rawTokenKinds();
67
+ }
46
68
  /**
47
69
  * Returns the LSP `SemanticTokensLegend` (token types + modifiers list) the
48
70
  * editor uses to map LSP `semanticTokens/full` response indices to highlight
@@ -59,7 +81,7 @@ export function semanticLegend() {
59
81
  * (every data URI + `schema =` argument, each tagged with its `@conn` alias and
60
82
  * role). keasy's client-compute job runner reads this to derive a job's
61
83
  * connections WITHOUT subprocessing `fossil` / a server round-trip. Identical
62
- * shape to the native `fossil refs` (the SAME `fossil_run_status::SourceRefInfo`
84
+ * shape to the native `fossil refs` (the SAME `fossil_lineage::SourceRefInfo`
63
85
  * struct), so the browser and the CLI never diverge.
64
86
  *
65
87
  * MUST be called after {@link initFossilWasm} has resolved.
@@ -78,7 +100,7 @@ export function providers() {
78
100
  return rawProviders();
79
101
  }
80
102
  /**
81
- * Workspace API class (ADR-0024). Thin TS wrapper around the wasm-bindgen
103
+ * Workspace API class. Thin TS wrapper around the wasm-bindgen
82
104
  * `FossilPlayground` that exposes camelCase method names for JS idiom + better
83
105
  * TS inference (the raw bindings use snake_case from the Rust impl block).
84
106
  *
@@ -100,13 +122,6 @@ export class FossilPlayground {
100
122
  free() {
101
123
  this._inner.free();
102
124
  }
103
- /**
104
- * Return the stdlib classification manifest (STDL-07). The playground reads
105
- * this once at startup to render `native_udf_only` functions as disabled.
106
- */
107
- classification() {
108
- return this._inner.classification();
109
- }
110
125
  /**
111
126
  * Open a file in the workspace. Returns the {@link FileHandle} subsequent
112
127
  * `updateFile` / `closeFile` / `diagnosticsFor` calls key on.
@@ -116,8 +131,9 @@ export class FossilPlayground {
116
131
  }
117
132
  /**
118
133
  * Apply an edit to an open file. Mutates the SAME `SourceFile` via the Salsa
119
- * `Setter` (`set_text`) — bumps the revision (ADR-0022) for incremental
120
- * invalidation rather than a full recompute.
134
+ * `Setter` (`set_text`) — bumps the revision for incremental
135
+ * invalidation rather than a full recompute, and that revision bump is also
136
+ * what cancels any analysis still running on an older snapshot.
121
137
  */
122
138
  updateFile(handle, contents) {
123
139
  this._inner.update_file(handle, contents);
@@ -144,19 +160,67 @@ export class FossilPlayground {
144
160
  return this._inner.diagnostics_for(handle);
145
161
  }
146
162
  /**
147
- * Install a user-supplied ShEx schema as the active output descriptor. On
148
- * parse failure the previously-installed descriptor is RETAINED.
163
+ * What is under the cursor — `{ markdown, range }`, or `null` when nothing
164
+ * there has a type.
165
+ *
166
+ * `line` / `character` are LSP: zero-based, `character` in UTF-16 code units.
167
+ * A CodeMirror or Monaco host already counts in those units, so a document
168
+ * offset converts with `doc.lineAt(pos)` and no byte arithmetic — unlike
169
+ * {@link tokenize}, whose offsets ARE bytes.
170
+ *
171
+ * ## Push the buffer before you ask
172
+ *
173
+ * This reads the text of the last {@link updateFile}. Hover fires on
174
+ * mouse-move and the checker is debounced, so a hover mid-debounce answers
175
+ * about text one keystroke old and its range lands one keystroke wrong. The
176
+ * three read-only methods take a SHARED borrow on the Rust side and cannot
177
+ * poison the workspace the way a re-entered `updateFile` once could — see the
178
+ * `ide` module in `crates/fossil-wasm` — but staleness is not a borrow
179
+ * problem and nothing here can fix it for you.
180
+ */
181
+ hover(handle, line, character) {
182
+ // `serde_wasm_bindgen` writes `None` as `undefined`; a host reading this
183
+ // should have one falsy answer to check, not two.
184
+ return this._inner.hover(handle, line, character) ?? null;
185
+ }
186
+ /**
187
+ * The completion candidates at a position, already narrowed by the receiver:
188
+ * `str.` offers string members and no reader, a property-key position offers
189
+ * the target shape's predicates and no catalogue row at all.
190
+ *
191
+ * `kind` is the LSP `CompletionItemKind` **by name** (`"function"`,
192
+ * `"field"`) rather than by number. The numbers never cross this boundary —
193
+ * `packages/codemirror-fossil`'s deleted predecessor is what happens when
194
+ * they do.
195
+ *
196
+ * The same staleness note as {@link hover} applies, and harder: completion
197
+ * fires on nearly every keystroke.
149
198
  */
150
- setTargetShex(text) {
151
- this._inner.set_target_shex(text);
199
+ completions(handle, line, character) {
200
+ return this._inner.completions(handle, line, character);
152
201
  }
153
202
  /**
154
- * Register an {@link InferredDescriptorJson} for a source binding name BEFORE
155
- * invoking {@link check}. The Rust compiler reads from this during forward
156
- * type propagation.
203
+ * Where the name under the cursor is defined. Empty when nothing there has a
204
+ * definition.
205
+ *
206
+ * `uri` is the key the buffer was opened under, verbatim — and two of the
207
+ * four positions this recognises resolve into the **shape document**, so a
208
+ * host with a single editor pane has to read `uri` before it moves a cursor.
209
+ */
210
+ gotoDefinition(handle, line, character) {
211
+ return this._inner.gotoDefinition(handle, line, character);
212
+ }
213
+ /**
214
+ * Register an {@link InferredDescriptorJson} under the source URI the program
215
+ * wrote, BEFORE invoking {@link check}. The Rust compiler reads from this
216
+ * during forward type propagation.
217
+ *
218
+ * The compiler never introspects a source itself: it performs no network or
219
+ * file IO — that would break the WASM gate and Salsa's determinism alike —
220
+ * so a host that wants column types must run the `DESCRIBE` and push the
221
+ * result in here.
157
222
  *
158
223
  * @throws Error if the descriptor JSON fails to deserialise on the Rust side.
159
- * @see ADR-0037
160
224
  */
161
225
  registerInferredDescriptor(descriptor) {
162
226
  // The wasm-bindgen wrapper accepts a JSON string; serialise here so callers
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,gBAAgB,IAAI,mBAAmB,EACvC,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,eAAe,IAAI,iBAAiB,EACpC,gBAAgB,IAAI,iBAAiB,EACrC,IAAI,IAAI,OAAO,EACf,SAAS,IAAI,YAAY,GAC1B,MAAM,uBAAuB,CAAC;AAU/B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB;IAC9B,iBAAiB,EAAE,CAAC;AACtB,CAAC;AAWD;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,6EAA6E;IAC7E,sEAAsE;IACtE,8EAA8E;IAC9E,6EAA6E;IAC7E,OAAO,WAAW,CAAC,IAAI,CAAe,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,iBAAiB,EAA0B,CAAC;AACrD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,OAAO,CAAC,OAAO,CAAoB,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,YAAY,EAAoB,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAsB;IAEpC;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,IAAI;QAC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S wrapper around the fossil-wasm wasm-bindgen artifacts.
3
3
  *
4
- * Public API (one of the six @fossil-lang/* packages per ADR-0028):
4
+ * Public API (one of the @fossil-lang/* packages; `git ls-files packages` is
5
+ * the list):
5
6
  * - {@link initFossilWasm} — consumer-controlled .wasm URL loader (memoised).
6
- * - {@link tokenize} — calls the Rust lexer, returns TokenRow[] (ADR-0030).
7
- * - {@link semanticLegend} — returns the LSP SemanticTokensLegend (Phase-6 06-07).
8
- * - {@link FossilPlayground} — Workspace API class (ADR-0024) for the LSP.
7
+ * - {@link tokenize} — calls the Rust lexer, returns TokenRow[].
8
+ * - {@link tokenKinds} — the legend for TokenRow.kind: variant names by index.
9
+ * - {@link semanticLegend} — returns the LSP SemanticTokensLegend.
10
+ * - {@link FossilPlayground} — Workspace API class: open / update / close,
11
+ * `check`, and the three position queries (`hover`, `completions`,
12
+ * `gotoDefinition`) an editor draws its IDE surface from.
9
13
  *
10
- * Consumer pattern (wasm-bindgen --target web — RESEARCH.md Pattern 3):
14
+ * Consumer pattern (wasm-bindgen --target web):
11
15
  *
12
16
  * import { initFossilWasm, tokenize } from '@fossil-lang/wasm';
13
17
  * import wasmUrl from '@fossil-lang/wasm/pkg/fossil_wasm_bg.wasm?url'; // Vite
14
18
  *
15
19
  * await initFossilWasm({ wasmUrl });
16
- * const tokens = tokenize('prefix ex: <https://example.org/>');
20
+ * const tokens = tokenize('User := io.csv("data/people.csv")');
17
21
  */
18
22
  export { initFossilWasm } from './load.js';
19
23
  export type { InitFossilWasmOpts } from './load.js';
20
- export { start_lsp_worker, tokenize, semanticLegend, FossilPlayground, refs, providers, } from './client.js';
24
+ export { start_lsp_worker, tokenize, tokenKinds, semanticLegend, FossilPlayground, refs, providers, } from './client.js';
21
25
  export type { FileHandle } from './client.js';
22
26
  /** One external reference a program makes — the typed lineage returned by
23
- * {@link refs}. Mirrors `fossil_run_status::SourceRefInfo` (the SAME struct the
27
+ * {@link refs}. Mirrors `fossil_lineage::SourceRefInfo` (the SAME struct the
24
28
  * native `fossil refs` emits). `connection` is the `@conn` alias the reference
25
29
  * targets, or `null` for a direct URL/path; `role` is where it appears in the
26
30
  * source constructor. The host resolves `@conn` → `{base}/path` itself. */
@@ -30,7 +34,7 @@ export interface SourceRefInfo {
30
34
  role: 'data' | 'schema';
31
35
  }
32
36
  /** One data-source provider returned by {@link providers}. Mirrors
33
- * `fossil_run_status::ProviderInfo`: the short name (`csv`, `rdf`, …), the file
37
+ * `fossil_lineage::ProviderInfo`: the short name (`csv`, `rdf`, …), the file
34
38
  * extensions it reads (no leading dot), and how it can be used. */
35
39
  export interface ProviderInfo {
36
40
  name: string;
@@ -44,66 +48,110 @@ export interface ProviderInfo {
44
48
  */
45
49
  export interface CheckRow {
46
50
  uri: string;
47
- range: {
48
- start: {
49
- line: number;
50
- character: number;
51
- };
52
- end: {
53
- line: number;
54
- character: number;
55
- };
56
- };
51
+ range: LspRange;
57
52
  severity: number;
58
53
  message: string;
59
54
  }
60
- /** Stdlib classification entry returned by {@link FossilPlayground.classification}.
61
- * `wasm_class` indicates whether a stdlib function can execute in-browser
62
- * (`"pure_sql"`) or requires the native runtime (`"native_udf_only"`). The
63
- * playground reads this once at startup to render `native_udf_only` functions
64
- * as disabled (STDL-07 / SC#1 playground half).
65
- */
66
- export interface StdlibClass {
67
- name: string;
68
- wasm_class: 'pure_sql' | 'native_udf_only';
55
+ /** An LSP range: zero-based lines, `character` in UTF-16 code units — the units
56
+ * a JavaScript string is indexed in, so no byte arithmetic converts it. (The
57
+ * lexer's {@link TokenRow} offsets are the other thing: those ARE bytes.) */
58
+ export interface LspRange {
59
+ start: {
60
+ line: number;
61
+ character: number;
62
+ };
63
+ end: {
64
+ line: number;
65
+ character: number;
66
+ };
67
+ }
68
+ /** What {@link FossilPlayground.hover} found: the rendered Markdown — a
69
+ * ` ```fossil ` fence, the type of what you wrote and where it came from, and
70
+ * a second block with the type the target shape demands of that predicate when
71
+ * the shape resolves — and the range it applies to. */
72
+ export interface HoverRow {
73
+ markdown: string;
74
+ range: LspRange;
75
+ }
76
+ /** One candidate from {@link FossilPlayground.completions}.
77
+ *
78
+ * `kind` is the LSP `CompletionItemKind` **by name**, lowercased —
79
+ * `"function"`, `"field"`, `"enum_member"` — and `""` when the item carries
80
+ * none. Rust owns that table (`fossil_wasm::ide::kind_name`, total over the
81
+ * twenty-five the spec defines) because a table in TypeScript is one nothing
82
+ * can check: the deleted predecessor of `@fossil-lang/codemirror-fossil`
83
+ * hard-copied the lexer's discriminants and was wrong in nine places by the
84
+ * time it went.
85
+ *
86
+ * `detail` is the signature, the shape property's IRI, or the source field's
87
+ * inferred type — whatever the compiler wrote beside the label; `""` when it
88
+ * wrote none. Neither field is optional, on purpose: an absent optional is the
89
+ * one shape `serde_json` and `serde_wasm_bindgen` are measured to disagree
90
+ * about. */
91
+ export interface CompletionRow {
92
+ label: string;
93
+ kind: string;
94
+ detail: string;
95
+ }
96
+ /** One place {@link FossilPlayground.gotoDefinition} found a definition.
97
+ *
98
+ * `uri` is the key the buffer was opened under, VERBATIM — matching
99
+ * {@link CheckRow.uri}, and not a `file://` URI. Two of the four positions
100
+ * goto-def recognises resolve into the shape document, so a target in another
101
+ * file is the ordinary case and a host with one editor pane has to read this
102
+ * before it moves a cursor. */
103
+ export interface DefinitionRow {
104
+ uri: string;
105
+ range: LspRange;
69
106
  }
70
107
  /**
71
- * Canonical primitive names for inferred-descriptor columns. Must match the
72
- * lookup table in `fossil-hir::infer::primitive_from_name` (ADR-0037). Names
73
- * map 1:1 to the `Primitive` enum in HIR (Integer, Float, String, Bool, Date,
74
- * DateTime, Time, GYear, AnyURI).
108
+ * The primitive lattice, as `fossil-graph-schema` serialises it — the same enum
109
+ * the checker types against, not a set of names it looks up.
75
110
  *
76
- * Unknown / non-canonical strings are accepted on the wire — the Rust side
77
- * coerces them to `String` and emits a `D-INFERRED-UNKNOWN-DATATYPE`
78
- * diagnostic. Hosts SHOULD canonicalise their DuckDB `DESCRIBE` output to
79
- * these names before registering.
111
+ * A value outside this union is REJECTED when the descriptor is registered:
112
+ * `registerInferredDescriptor` returns the serde error naming the offending
113
+ * value. It is no longer coerced to `string` with a diagnostic three crates
114
+ * later, so a host that sends a type fossil does not carry finds out at the
115
+ * call, not in a compile.
80
116
  */
81
- export type InferredPrimitive = 'String' | 'Integer' | 'Float' | 'Bool' | 'Date' | 'DateTime' | 'Time' | 'GYear' | 'AnyURI';
117
+ export type InferredPrimitive = 'string' | 'integer' | 'float' | 'bool' | 'date' | 'date_time' | 'time' | 'g_year' | 'any_uri';
82
118
  /** One column from a host-introspected source. */
83
119
  export interface InferredColumnJson {
84
120
  name: string;
85
121
  primitive: InferredPrimitive;
86
122
  }
87
123
  /**
88
- * Host-introspected input schema. Produced by the playground's browser-side
89
- * `DuckDB-WASM` `DESCRIBE read_csv_auto('<url>')` call (see plan 13-04b);
90
- * consumed by the Rust compiler via
91
- * {@link FossilPlayground.registerInferredDescriptor}. See ADR-0037 for the
92
- * full architectural rationale (drop user-facing CSVW; host-side
93
- * introspection feeds the compiler ahead of `compile()`).
124
+ * Host-introspected input schema. Produced by a `DESCRIBE SELECT * FROM
125
+ * <reader>('<url>')` the host runs — `DuckDB-WASM` in a browser — where the
126
+ * reader is the one the binding's `io.` constructor names: `read_csv_auto`,
127
+ * `read_json_auto` or `read_parquet`. `@fossil-lang/introspect` is the one home
128
+ * for that, and picking the reader off the constructor is not a nicety: a
129
+ * Parquet file read as CSV fails DuckDB's sniffer outright, and a JSON array
130
+ * read as CSV introspects to a single column named `[`.
131
+ *
132
+ * Consumed by the Rust compiler via
133
+ * {@link FossilPlayground.registerInferredDescriptor}. There is no metadata
134
+ * sidecar for the user to write and keep in sync: the host introspects the
135
+ * real file and feeds the compiler ahead of `compile()`.
94
136
  */
95
137
  export interface InferredDescriptorJson {
96
- /** Source binding name (e.g. `"users"` for `users := io.csv(...)`). */
97
- source_name: string;
138
+ /**
139
+ * The source URI exactly as the program writes it — the string inside
140
+ * `io.csv("examples/users.csv")`. NOT the binding name, and NOT the URL the
141
+ * host resolved in order to read the file: the checker only ever sees what
142
+ * the program says.
143
+ */
144
+ uri: string;
98
145
  /** Ordered columns — order is significant for column-position fallback. */
99
146
  columns: InferredColumnJson[];
100
147
  /**
101
- * Opaque content-hash. Empty string means "let the Rust side derive a
102
- * deterministic hash from the column tuple list" (used for Salsa keying).
103
- * Hosts that already maintain a per-file content-hash (e.g. resolver-side)
104
- * MAY supply it.
148
+ * Opaque token identifying the state of the source this was read from. The
149
+ * cache compares it and nothing interprets it: an ETag, a digest, a
150
+ * `Last-Modified`, whatever the host can get cheaply. Empty means "I cannot
151
+ * tell", which the cache reads as never-fresh, so that source is
152
+ * re-introspected on every compile.
105
153
  */
106
- content_hash: string;
154
+ freshness_token: string;
107
155
  }
108
156
  export type { TokenRow, SemanticTokensLegend } from '@fossil-lang/types';
109
157
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;4EAI4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAED;;oEAEoE;AACpE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CA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