@ttsc/wasm 0.30.4 → 0.31.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.
Files changed (174) hide show
  1. package/README.md +3 -3
  2. package/build/build-wasm.cjs +5 -4
  3. package/build/go-build-cache.cjs +347 -0
  4. package/build/pack-prepare.cjs +3 -2
  5. package/cmd/ttsc-wasm/main.go +22 -10
  6. package/cmd/ttsc-wasm/main_wasm.go +2 -2
  7. package/dist/.ttsc-wasm-build.json +138 -58
  8. package/dist/go.mod +7 -5
  9. package/dist/ttsc.wasm +2 -2
  10. package/go.mod +7 -5
  11. package/go.sum +10 -10
  12. package/host/api.go +34 -41
  13. package/host/doc.go +7 -6
  14. package/host/expose.go +42 -0
  15. package/host/fountain.go +192 -22
  16. package/host/host.go +10 -25
  17. package/host/host_native.go +3 -5
  18. package/host/invoke.go +133 -0
  19. package/host/plugin.go +37 -72
  20. package/host/result.go +108 -0
  21. package/lib/src/BootTtscWorkerTerminationError.d.ts +20 -0
  22. package/lib/src/BootTtscWorkerTerminationError.js +20 -0
  23. package/lib/src/BootTtscWorkerTerminationError.js.map +1 -1
  24. package/lib/src/MemFSError.d.ts +21 -2
  25. package/lib/src/MemFSError.js +25 -2
  26. package/lib/src/MemFSError.js.map +1 -1
  27. package/lib/src/bootTtsc.d.ts +49 -2
  28. package/lib/src/bootTtsc.js +89 -23
  29. package/lib/src/bootTtsc.js.map +1 -1
  30. package/lib/src/createMemFS.d.ts +45 -0
  31. package/lib/src/createMemFS.js +269 -66
  32. package/lib/src/createMemFS.js.map +1 -1
  33. package/lib/src/parseResult.d.ts +19 -0
  34. package/lib/src/parseResult.js +19 -0
  35. package/lib/src/parseResult.js.map +1 -1
  36. package/lib/src/structures/IBootResult.d.ts +20 -2
  37. package/lib/src/structures/IBootTtscOptions.d.ts +28 -6
  38. package/lib/src/structures/IFileStats.d.ts +51 -0
  39. package/lib/src/structures/IMemFSHost.d.ts +89 -0
  40. package/lib/src/structures/ITtscApi.d.ts +154 -9
  41. package/lib/src/structures/ITtscBuildOpts.d.ts +18 -1
  42. package/lib/src/structures/ITtscCompileResult.d.ts +20 -2
  43. package/lib/src/structures/ITtscDiagnostic.d.ts +25 -1
  44. package/lib/src/structures/ITtscFileQuery.d.ts +19 -1
  45. package/lib/src/structures/ITtscFountainDiagnosticsResult.d.ts +20 -1
  46. package/lib/src/structures/ITtscNodeAtPositionResult.d.ts +18 -1
  47. package/lib/src/structures/ITtscNodeInfo.d.ts +23 -2
  48. package/lib/src/structures/ITtscPluginOpts.d.ts +24 -3
  49. package/lib/src/structures/ITtscPositionQuery.d.ts +21 -4
  50. package/lib/src/structures/ITtscReleaseSnapshotResult.d.ts +22 -2
  51. package/lib/src/structures/ITtscResult.d.ts +31 -5
  52. package/lib/src/structures/ITtscSnapshotHandle.d.ts +19 -1
  53. package/lib/src/structures/ITtscSnapshotResult.d.ts +22 -1
  54. package/lib/src/structures/ITtscSnapshotsResult.d.ts +19 -1
  55. package/lib/src/structures/ITtscSourceFileTextResult.d.ts +19 -1
  56. package/lib/src/structures/ITtscSourceFilesResult.d.ts +23 -2
  57. package/lib/src/structures/ITtscSymbolAtPositionResult.d.ts +18 -1
  58. package/lib/src/structures/ITtscSymbolDeclaration.d.ts +25 -2
  59. package/lib/src/structures/ITtscSymbolInfo.d.ts +19 -1
  60. package/lib/src/structures/ITtscTransformResult.d.ts +21 -3
  61. package/lib/src/structures/ITtscTypeAtPositionResult.d.ts +18 -1
  62. package/lib/src/structures/ITtscTypeInfo.d.ts +19 -1
  63. package/lib/src/structures/ITtscVersion.d.ts +28 -1
  64. package/lib/src/structures/IWasmExecFS.d.ts +310 -0
  65. package/package.json +4 -2
  66. package/shim-vendor/shim/ast/enums_gen.go +4 -2
  67. package/shim-vendor/shim/ast/go.mod +5 -5
  68. package/shim-vendor/shim/ast/go.sum +10 -10
  69. package/shim-vendor/shim/ast/lint.go +1088 -20
  70. package/shim-vendor/shim/ast/parent.go +38 -22
  71. package/shim-vendor/shim/ast/safe_text.go +48 -26
  72. package/shim-vendor/shim/ast/shim.go +1307 -20
  73. package/shim-vendor/shim/ast/test/next_jsdoc_comment_location_reaches_variable_statement_test.go +51 -0
  74. package/shim-vendor/shim/ast/test/node_text_joins_multi_hop_qualified_name_test.go +24 -9
  75. package/shim-vendor/shim/ast/test/node_text_joins_one_hop_qualified_name_test.go +9 -5
  76. package/shim-vendor/shim/ast/test/node_text_returns_empty_for_nil_test.go +13 -5
  77. package/shim-vendor/shim/ast/test/node_text_returns_identifier_text_test.go +12 -5
  78. package/shim-vendor/shim/ast/test/node_text_skips_empty_qualified_left_test.go +35 -5
  79. package/shim-vendor/shim/astnav/go.mod +5 -5
  80. package/shim-vendor/shim/astnav/go.sum +12 -10
  81. package/shim-vendor/shim/astnav/shim.go +9 -0
  82. package/shim-vendor/shim/bundled/go.mod +7 -1
  83. package/shim-vendor/shim/bundled/go.sum +12 -0
  84. package/shim-vendor/shim/checker/enums_gen.go +4 -2
  85. package/shim-vendor/shim/checker/extra-shim.json +6 -0
  86. package/shim-vendor/shim/checker/go.mod +5 -5
  87. package/shim-vendor/shim/checker/go.sum +10 -10
  88. package/shim-vendor/shim/checker/node_builder_fields_gen.go +19 -0
  89. package/shim-vendor/shim/checker/shim.go +827 -114
  90. package/shim-vendor/shim/compiler/emit_sourcemap.go +68 -29
  91. package/shim-vendor/shim/compiler/emitassemble.go +36 -2
  92. package/shim-vendor/shim/compiler/emithook.go +13 -3
  93. package/shim-vendor/shim/compiler/go.mod +5 -5
  94. package/shim-vendor/shim/compiler/go.sum +10 -10
  95. package/shim-vendor/shim/compiler/incremental.go +56 -20
  96. package/shim-vendor/shim/compiler/resolution.go +92 -9
  97. package/shim-vendor/shim/core/enums_gen.go +2 -2
  98. package/shim-vendor/shim/core/go.mod +6 -1
  99. package/shim-vendor/shim/core/go.sum +10 -0
  100. package/shim-vendor/shim/core/modulekind.go +9 -0
  101. package/shim-vendor/shim/core/shim.go +157 -6
  102. package/shim-vendor/shim/diagnosticwriter/go.mod +10 -1
  103. package/shim-vendor/shim/diagnosticwriter/go.sum +20 -0
  104. package/shim-vendor/shim/diagnosticwriter/lint.go +188 -10
  105. package/shim-vendor/shim/diagnosticwriter/shim.go +14 -0
  106. package/shim-vendor/shim/lsp/go.mod +5 -5
  107. package/shim-vendor/shim/lsp/go.sum +10 -10
  108. package/shim-vendor/shim/lsp/shim.go +78 -2
  109. package/shim-vendor/shim/parser/go.mod +10 -1
  110. package/shim-vendor/shim/parser/go.sum +22 -0
  111. package/shim-vendor/shim/printer/emithost.go +46 -1
  112. package/shim-vendor/shim/printer/go.mod +5 -5
  113. package/shim-vendor/shim/printer/go.sum +10 -10
  114. package/shim-vendor/shim/printer/shim.go +114 -7
  115. package/shim-vendor/shim/printer/sourcemap.go +55 -0
  116. package/shim-vendor/shim/scanner/go.mod +10 -1
  117. package/shim-vendor/shim/scanner/go.sum +20 -0
  118. package/shim-vendor/shim/scanner/regexp.go +19 -4
  119. package/shim-vendor/shim/scanner/shim.go +3 -0
  120. package/shim-vendor/shim/stringutil/extra-shim.json +1 -0
  121. package/shim-vendor/shim/stringutil/go.mod +5 -0
  122. package/shim-vendor/shim/stringutil/go.sum +2 -0
  123. package/shim-vendor/shim/stringutil/shim.go +119 -0
  124. package/shim-vendor/shim/transformers/go.mod +5 -5
  125. package/shim-vendor/shim/transformers/go.sum +12 -10
  126. package/shim-vendor/shim/transformers/shim.go +12 -3
  127. package/shim-vendor/shim/tsoptions/command_line_raw.go +44 -0
  128. package/shim-vendor/shim/tsoptions/go.mod +10 -1
  129. package/shim-vendor/shim/tsoptions/go.sum +22 -0
  130. package/shim-vendor/shim/tsoptions/shim.go +1 -1
  131. package/shim-vendor/shim/tspath/go.mod +1 -1
  132. package/shim-vendor/shim/tspath/go.sum +6 -0
  133. package/shim-vendor/shim/vfs/cachedvfs/go.mod +3 -1
  134. package/shim-vendor/shim/vfs/cachedvfs/go.sum +12 -0
  135. package/shim-vendor/shim/vfs/decode.go +26 -0
  136. package/shim-vendor/shim/vfs/decode_test.go +42 -0
  137. package/shim-vendor/shim/vfs/go.mod +7 -1
  138. package/shim-vendor/shim/vfs/go.sum +12 -0
  139. package/shim-vendor/shim/vfs/osvfs/go.mod +7 -1
  140. package/shim-vendor/shim/vfs/osvfs/go.sum +12 -0
  141. package/src/BootTtscWorkerTerminationError.ts +22 -0
  142. package/src/MemFSError.ts +29 -2
  143. package/src/bootTtsc.ts +104 -28
  144. package/src/createMemFS.ts +291 -64
  145. package/src/parseResult.ts +19 -0
  146. package/src/structures/IBootResult.ts +21 -2
  147. package/src/structures/IBootTtscOptions.ts +32 -6
  148. package/src/structures/IFileStats.ts +65 -0
  149. package/src/structures/IMemFSHost.ts +97 -0
  150. package/src/structures/ITtscApi.ts +154 -9
  151. package/src/structures/ITtscBuildOpts.ts +19 -1
  152. package/src/structures/ITtscCompileResult.ts +21 -2
  153. package/src/structures/ITtscDiagnostic.ts +32 -1
  154. package/src/structures/ITtscFileQuery.ts +19 -1
  155. package/src/structures/ITtscFountainDiagnosticsResult.ts +20 -1
  156. package/src/structures/ITtscNodeAtPositionResult.ts +18 -1
  157. package/src/structures/ITtscNodeInfo.ts +27 -2
  158. package/src/structures/ITtscPluginOpts.ts +28 -3
  159. package/src/structures/ITtscPositionQuery.ts +21 -4
  160. package/src/structures/ITtscReleaseSnapshotResult.ts +22 -2
  161. package/src/structures/ITtscResult.ts +34 -5
  162. package/src/structures/ITtscSnapshotHandle.ts +19 -1
  163. package/src/structures/ITtscSnapshotResult.ts +22 -1
  164. package/src/structures/ITtscSnapshotsResult.ts +19 -1
  165. package/src/structures/ITtscSourceFileTextResult.ts +19 -1
  166. package/src/structures/ITtscSourceFilesResult.ts +23 -2
  167. package/src/structures/ITtscSymbolAtPositionResult.ts +18 -1
  168. package/src/structures/ITtscSymbolDeclaration.ts +27 -2
  169. package/src/structures/ITtscSymbolInfo.ts +23 -1
  170. package/src/structures/ITtscTransformResult.ts +22 -3
  171. package/src/structures/ITtscTypeAtPositionResult.ts +18 -1
  172. package/src/structures/ITtscTypeInfo.ts +20 -1
  173. package/src/structures/ITtscVersion.ts +33 -1
  174. package/src/structures/IWasmExecFS.ts +336 -0
@@ -10,34 +10,103 @@ import type { ITtscVersion } from "./ITtscVersion";
10
10
  *
11
11
  * Obtain an instance via `bootTtsc`, which waits for the wasm to signal
12
12
  * readiness and returns the typed handle together with its `IMemFSHost`.
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation
15
+ * Signatures mirror host.Expose's direct metadata/list methods and asynchronous
16
+ * project/snapshot methods, sharing request DTOs and the native result envelope.
17
+ * @evidence contracts/common.md#clear-and-simple-design
18
+ * Named verbs distinguish project work from retained-program queries; requests
19
+ * share small DTOs and async results share one envelope. Direct metadata/list
20
+ * values stay synchronous because their native handlers do not load a project.
21
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
22
+ * Queries address retained programs through opaque handles rather than
23
+ * substituting JavaScript source heuristics for compiler semantics.
24
+ * @evidence contracts/common.md#meaningful-documentation
25
+ * JSDoc separates acquisition, decoding, coordinates and snapshot ownership,
26
+ * following the documentation skill's paragraph and context guidance.
27
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscApi only groups the wasm API verbs and acquires no handle, task or retained state.
28
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscApi only groups the wasm API verbs and chooses no algorithm.
29
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscApi only groups the wasm API verbs and coordinates no computation.
13
30
  */
14
31
  export interface ITtscApi {
15
- /** Build metadata reported by the wasm. Useful for diagnostics. */
32
+ /**
33
+ * Build metadata reported synchronously by the wasm.
34
+ *
35
+ * @evidence contracts/common.md#principled-implementation The direct return mirrors jsVersion's synchronous projection.
36
+ * @evidence contracts/common.md#clear-and-simple-design One direct metadata value requires no project request or asynchronous transport envelope.
37
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Binary metadata supplies identity rather than a guessed browser or release constant.
38
+ * @evidence contracts/common.md#meaningful-documentation JSDoc states direct-return behavior under the documentation skill's context rule.
39
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources version is a signature only; the lifetime of what it touches belongs to the Go host.
40
+ * @evidenceExclude contracts/performance.md#efficient-algorithms version is a signature only; its algorithm and cost belong to the Go host.
41
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work version is a signature only; sharing of repeated work belongs to the Go host.
42
+ */
16
43
  version(): ITtscVersion;
17
44
  /**
18
45
  * Compile a project: typecheck + emit. `result` is JSON;
19
46
  * `parseResult<ITtscCompileResult>` deserializes it.
47
+ *
48
+ * @evidence contracts/common.md#principled-implementation The Promise envelope follows native Build and the shared project request.
49
+ * @evidence contracts/common.md#clear-and-simple-design The named emit verb reuses project options and the result envelope without mixing no-emit switches into its request.
50
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The loaded program supplies output, without a consumer-specific emitter path.
51
+ * @evidence contracts/common.md#meaningful-documentation JSDoc states purpose and decoding under the documentation skill's context rule.
52
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources build is a signature only; the lifetime of what it touches belongs to the Go host.
53
+ * @evidenceExclude contracts/performance.md#efficient-algorithms build is a signature only; its algorithm and cost belong to the Go host.
54
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work build is a signature only; sharing of repeated work belongs to the Go host.
20
55
  */
21
56
  build(opts: ITtscBuildOpts): Promise<ITtscResult>;
22
57
  /**
23
58
  * Typecheck without emit. `result` is JSON; `parseResult<ITtscCompileResult>`
24
59
  * deserializes it.
60
+ *
61
+ * @evidence contracts/common.md#principled-implementation Native Check owns no-emit loading and the shared compile payload.
62
+ * @evidence contracts/common.md#clear-and-simple-design A separate no-emit verb makes intent explicit while sharing project and diagnostic representations.
63
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No-emit is a loader option rather than pretending an emitted build was a check.
64
+ * @evidence contracts/common.md#meaningful-documentation JSDoc explains no-emit and decoding under the documentation skill's clarity rule.
65
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources check is a signature only; the lifetime of what it touches belongs to the Go host.
66
+ * @evidenceExclude contracts/performance.md#efficient-algorithms check is a signature only; its algorithm and cost belong to the Go host.
67
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work check is a signature only; sharing of repeated work belongs to the Go host.
25
68
  */
26
69
  check(opts: ITtscBuildOpts): Promise<ITtscResult>;
27
70
  /**
28
- * Return every source file the program saw, keyed by project-relative path.
29
- * Used by playgrounds that want to render the TypeScript view after a source
30
- * rewriter (e.g. paths) has run. `result` is JSON; use
71
+ * Return source text keyed by project-relative path inside cwd and absolute
72
+ * path outside it. Used by playgrounds that want to render the TypeScript
73
+ * view after a source rewriter (e.g. paths) has run. `result` is JSON; use
31
74
  * `parseResult<ITtscTransformResult>` to deserialize.
75
+ *
76
+ * @evidence contracts/common.md#principled-implementation Native Transform projects post-plugin text through the shared project request.
77
+ * @evidence contracts/common.md#clear-and-simple-design The source projection is its own verb and DTO, keeping emitted output distinct from transformed TypeScript.
78
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Source comes from the transformed program rather than inference from emitted JavaScript.
79
+ * @evidence contracts/common.md#meaningful-documentation JSDoc explains source stage, paths and decoding under the documentation skill's context rule.
80
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources transform is a signature only; the lifetime of what it touches belongs to the Go host.
81
+ * @evidenceExclude contracts/performance.md#efficient-algorithms transform is a signature only; its algorithm and cost belong to the Go host.
82
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work transform is a signature only; sharing of repeated work belongs to the Go host.
32
83
  */
33
84
  transform(opts: ITtscBuildOpts): Promise<ITtscResult>;
34
85
  /**
35
86
  * Dispatch a registered plugin's subcommand. Returns the captured stdout /
36
87
  * stderr (the same streams the native sidecar binary would write to) together
37
88
  * with the exit code.
89
+ *
90
+ * @evidence contracts/common.md#principled-implementation Named dispatch adapts scalar options to a registered Go Plugin's command arguments.
91
+ * @evidence contracts/common.md#clear-and-simple-design One dispatcher forwards plugin-owned arguments without adding a host endpoint for each plugin command.
92
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Invocation-owned streams replace global-output mutation; command semantics stay with the plugin.
93
+ * @evidence contracts/common.md#meaningful-documentation JSDoc explains dispatch and output ownership under the documentation skill's ownership rule.
94
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources plugin is a signature only; the lifetime of what it touches belongs to the Go host.
95
+ * @evidenceExclude contracts/performance.md#efficient-algorithms plugin is a signature only; its algorithm and cost belong to the Go host.
96
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work plugin is a signature only; sharing of repeated work belongs to the Go host.
38
97
  */
39
98
  plugin(opts: ITtscPluginOpts): Promise<ITtscResult>;
40
- /** Names of the plugins this wasm was built with. */
99
+ /**
100
+ * Names of registered plugins, returned synchronously.
101
+ *
102
+ * @evidence contracts/common.md#principled-implementation The direct array mirrors the native registry's name projection.
103
+ * @evidence contracts/common.md#clear-and-simple-design A direct name list exposes registration discovery without leaking Plugin instances or invoking commands.
104
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Entries describe linked registrations rather than a fixed list of npm packages.
105
+ * @evidence contracts/common.md#meaningful-documentation JSDoc states registry provenance and direct return under the documentation skill's context rule.
106
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources plugins is a signature only; the lifetime of what it touches belongs to the Go host.
107
+ * @evidenceExclude contracts/performance.md#efficient-algorithms plugins is a signature only; its algorithm and cost belong to the Go host.
108
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work plugins is a signature only; sharing of repeated work belongs to the Go host.
109
+ */
41
110
  plugins(): string[];
42
111
  /**
43
112
  * Load a project once and retain the TypeScript-Go Program in memory for
@@ -46,26 +115,78 @@ export interface ITtscApi {
46
115
  * Callers MUST call `releaseSnapshot` for every handle they receive to free
47
116
  * the program's checker pool lease and let Go GC reclaim the AST. Use
48
117
  * `parseResult<ITtscSnapshotResult>` to read the handle.
118
+ *
119
+ * @evidence contracts/common.md#principled-implementation An opaque handle references a retained native program for repeated queries.
120
+ * @evidence contracts/common.md#clear-and-simple-design Acquisition is distinct from querying and release, so the caller can identify its explicit retained-program lifetime.
121
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Queries share the actual program rather than rebuilding approximations for each request.
122
+ * @evidence contracts/common.md#meaningful-documentation Separate JSDoc paragraphs explain acquisition, decoding and release under the documentation skill.
123
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources snapshot is a signature only; the lifetime of what it touches belongs to the Go host.
124
+ * @evidenceExclude contracts/performance.md#efficient-algorithms snapshot is a signature only; its algorithm and cost belong to the Go host.
125
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work snapshot is a signature only; sharing of repeated work belongs to the Go host.
49
126
  */
50
127
  snapshot(opts: ITtscBuildOpts): Promise<ITtscResult>;
51
128
  /**
52
129
  * Drop a snapshot held by the wasm. Safe to call with an already-released
53
- * handle — the response's `released` flag will be `false`.
130
+ * handle. The response's `released` flag will be `false`.
131
+ *
132
+ * @evidence contracts/common.md#principled-implementation Explicit release follows the registry's idempotent delete-and-close operation.
133
+ * @evidence contracts/common.md#clear-and-simple-design One handle-based release operation owns cleanup instead of coupling it to an unrelated query result.
134
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The owning registry controls release rather than a guessed JavaScript GC event.
135
+ * @evidence contracts/common.md#meaningful-documentation JSDoc explains already-released behavior under the documentation skill's absence guidance.
136
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources releaseSnapshot is a signature only; the lifetime of what it touches belongs to the Go host.
137
+ * @evidenceExclude contracts/performance.md#efficient-algorithms releaseSnapshot is a signature only; its algorithm and cost belong to the Go host.
138
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work releaseSnapshot is a signature only; sharing of repeated work belongs to the Go host.
54
139
  */
55
140
  releaseSnapshot(opts: ITtscSnapshotHandle): Promise<ITtscResult>;
56
- /** List the currently retained snapshot handles. Debug aid. */
141
+ /**
142
+ * List currently retained snapshot handles in unspecified order.
143
+ *
144
+ * @evidence contracts/common.md#principled-implementation The Promise envelope projects the live native registry without exposing programs.
145
+ * @evidence contracts/common.md#clear-and-simple-design The listing exposes only current handles and uses the same async envelope as other registry operations.
146
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Registry ownership supplies the list rather than a caller-side history.
147
+ * @evidence contracts/common.md#meaningful-documentation JSDoc states lifetime and order under the documentation skill's context rule.
148
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources snapshots is a signature only; the lifetime of what it touches belongs to the Go host.
149
+ * @evidenceExclude contracts/performance.md#efficient-algorithms snapshots is a signature only; its algorithm and cost belong to the Go host.
150
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work snapshots is a signature only; sharing of repeated work belongs to the Go host.
151
+ */
57
152
  snapshots(): Promise<ITtscResult>;
58
- /** List source file paths held by the snapshot's program. */
153
+ /**
154
+ * List non-declaration source paths held by the snapshot's program.
155
+ *
156
+ * @evidence contracts/common.md#principled-implementation A shared handle selects the retained program whose SourceFiles supplies the projection.
157
+ * @evidence contracts/common.md#clear-and-simple-design File identities are queried separately from their text and semantic details to keep this projection focused.
158
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Compiler membership determines files rather than a filesystem glob approximation.
159
+ * @evidence contracts/common.md#meaningful-documentation JSDoc names snapshot provenance and declaration exclusion under the documentation skill's context rule.
160
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources getSourceFiles is a signature only; the lifetime of what it touches belongs to the Go host.
161
+ * @evidenceExclude contracts/performance.md#efficient-algorithms getSourceFiles is a signature only; its algorithm and cost belong to the Go host.
162
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work getSourceFiles is a signature only; sharing of repeated work belongs to the Go host.
163
+ */
59
164
  getSourceFiles(opts: ITtscSnapshotHandle): Promise<ITtscResult>;
60
165
  /**
61
166
  * Read the current text the snapshot's program is holding for a file. After
62
167
  * transform-stage plugins ran inside this snapshot, the text reflects their
63
168
  * rewrites.
169
+ *
170
+ * @evidence contracts/common.md#principled-implementation A handle/file query reads the native program's current source text.
171
+ * @evidence contracts/common.md#clear-and-simple-design The shared file query selects one source; its text-only payload avoids duplicating snapshot or AST state.
172
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Readback does not substitute an editor buffer that may differ from the retained program.
173
+ * @evidence contracts/common.md#meaningful-documentation JSDoc names retained and transformed text under the documentation skill's provenance guidance.
174
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources getSourceFileText is a signature only; the lifetime of what it touches belongs to the Go host.
175
+ * @evidenceExclude contracts/performance.md#efficient-algorithms getSourceFileText is a signature only; its algorithm and cost belong to the Go host.
176
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work getSourceFileText is a signature only; sharing of repeated work belongs to the Go host.
64
177
  */
65
178
  getSourceFileText(opts: ITtscFileQuery): Promise<ITtscResult>;
66
179
  /**
67
180
  * Diagnostics from the snapshot's program. Pass `file` to filter to a single
68
- * project-relative path.
181
+ * project-relative or absolute path.
182
+ *
183
+ * @evidence contracts/common.md#principled-implementation Program diagnostics supply the result, narrowed by an optional file selector.
184
+ * @evidence contracts/common.md#clear-and-simple-design One optional file filter refines the same diagnostic operation without another per-file endpoint.
185
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Messages come from compiler diagnostics rather than a parallel source-pattern checker.
186
+ * @evidence contracts/common.md#meaningful-documentation JSDoc explains filter identity under the documentation skill's context rule.
187
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources getDiagnostics is a signature only; the lifetime of what it touches belongs to the Go host.
188
+ * @evidenceExclude contracts/performance.md#efficient-algorithms getDiagnostics is a signature only; its algorithm and cost belong to the Go host.
189
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work getDiagnostics is a signature only; sharing of repeated work belongs to the Go host.
69
190
  */
70
191
  getDiagnostics(opts: ITtscSnapshotHandle & {
71
192
  file?: string;
@@ -73,17 +194,41 @@ export interface ITtscApi {
73
194
  /**
74
195
  * Return the syntax token touching `position` (byte offset), including
75
196
  * punctuation. Returns `{node: null}` for whitespace and comments.
197
+ *
198
+ * @evidence contracts/common.md#principled-implementation Native astnav owns token lookup in the retained program using byte coordinates.
199
+ * @evidence contracts/common.md#clear-and-simple-design The shared position request drives a syntax-only result, leaving checker-specific queries separate.
200
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Compiler AST semantics replace guessed JavaScript lexical scans.
201
+ * @evidence contracts/common.md#meaningful-documentation JSDoc states units and null meaning under the documentation skill's coordinate/absence guidance.
202
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources getNodeAtPosition is a signature only; the lifetime of what it touches belongs to the Go host.
203
+ * @evidenceExclude contracts/performance.md#efficient-algorithms getNodeAtPosition is a signature only; its algorithm and cost belong to the Go host.
204
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work getNodeAtPosition is a signature only; sharing of repeated work belongs to the Go host.
76
205
  */
77
206
  getNodeAtPosition(opts: ITtscPositionQuery): Promise<ITtscResult>;
78
207
  /**
79
208
  * Resolve the token at `position` and return the enclosing TypeScript-Go
80
209
  * semantic node's printed type string + flags. Returns `{type: null}` when
81
210
  * the position has no token or no type-bearing token.
211
+ *
212
+ * @evidence contracts/common.md#principled-implementation The retained checker owns semantic lookup and printing after token navigation.
213
+ * @evidence contracts/common.md#clear-and-simple-design Type presentation has its own nullable payload while using the same position selector as syntax and symbol queries.
214
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Types come from compiler semantics rather than source spelling or a fabricated any result.
215
+ * @evidence contracts/common.md#meaningful-documentation JSDoc distinguishes token and semantic lookup under the documentation skill's context rule.
216
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources getTypeAtPosition is a signature only; the lifetime of what it touches belongs to the Go host.
217
+ * @evidenceExclude contracts/performance.md#efficient-algorithms getTypeAtPosition is a signature only; its algorithm and cost belong to the Go host.
218
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work getTypeAtPosition is a signature only; sharing of repeated work belongs to the Go host.
82
219
  */
83
220
  getTypeAtPosition(opts: ITtscPositionQuery): Promise<ITtscResult>;
84
221
  /**
85
222
  * Resolve the symbol the token at `position` refers to, including up to 16
86
223
  * declaration sites. Returns `{symbol: null}` when no symbol is bound.
224
+ *
225
+ * @evidence contracts/common.md#principled-implementation The retained checker resolves symbols and projects bounded declaration metadata.
226
+ * @evidence contracts/common.md#clear-and-simple-design One symbol payload combines identity with a small declaration projection without adding follow-up declaration handles.
227
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Declaration sites come from the symbol rather than searching text for equal names.
228
+ * @evidence contracts/common.md#meaningful-documentation JSDoc explains the cap and null result under the documentation skill's context rule.
229
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources getSymbolAtPosition is a signature only; the lifetime of what it touches belongs to the Go host.
230
+ * @evidenceExclude contracts/performance.md#efficient-algorithms getSymbolAtPosition is a signature only; its algorithm and cost belong to the Go host.
231
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work getSymbolAtPosition is a signature only; sharing of repeated work belongs to the Go host.
87
232
  */
88
233
  getSymbolAtPosition(opts: ITtscPositionQuery): Promise<ITtscResult>;
89
234
  }
@@ -1,4 +1,21 @@
1
- /** Options shared by `build`, `check`, and `transform`. */
1
+ /**
2
+ * Options shared by `build`, `check`, and `transform`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * Required cwd and optional tsconfig mirror the native project endpoints;
6
+ * omission delegates the default to the host that loads the project.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * The shared request contains project root and config selection only; the
9
+ * chosen API verb owns whether that project is emitted, checked or projected.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Project identity comes from the caller, rather than a consumer-specific root.
12
+ * @evidence contracts/common.md#meaningful-documentation
13
+ * Member JSDoc distinguishes virtual absolute cwd from relative config paths
14
+ * and names the default, following the documentation skill's clear prose.
15
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscBuildOpts is a data interface and acquires no handle, task or retained state.
16
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscBuildOpts is a data interface and chooses no algorithm or processing strategy.
17
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscBuildOpts is a data interface and coordinates no shared or repeated computation.
18
+ */
2
19
  export interface ITtscBuildOpts {
3
20
  /** Absolute virtual path the project lives at inside the MemFS. */
4
21
  cwd: string;
@@ -2,10 +2,28 @@ import type { ITtscDiagnostic } from "./ITtscDiagnostic";
2
2
  /**
3
3
  * Structured payload inside `ITtscResult.result` for `build` and `check`.
4
4
  *
5
- * `output` maps emit-destination paths (relative to `cwd`) to file contents. It
6
- * is empty when `check` is called without emit.
5
+ * `output` maps emit-destination paths to file contents. Paths inside `cwd` are
6
+ * relative; outside destinations remain absolute. `check` returns an empty
7
+ * map.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation
10
+ * A path-keyed string record matches the native JSON output map; optional
11
+ * diagnostics reflect its omitempty encoding rather than requiring a sentinel.
12
+ * @evidence contracts/common.md#clear-and-simple-design
13
+ * Diagnostics and emitted files have separate fields, reusing one diagnostic
14
+ * type while keeping the transport envelope outside this compile payload.
15
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
16
+ * Compiler-produced paths and contents remain data, without fixture-shaped keys.
17
+ * @evidence contracts/common.md#meaningful-documentation
18
+ * JSDoc identifies the enclosing envelope, path base and no-emit meaning;
19
+ * separate paragraphs follow the documentation skill's purpose and context rule.
20
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscCompileResult is a data interface and acquires no handle, task or retained state.
21
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscCompileResult is a data interface and chooses no algorithm or processing strategy.
22
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscCompileResult is a data interface and coordinates no shared or repeated computation.
7
23
  */
8
24
  export interface ITtscCompileResult {
25
+ /** Present when the native result includes diagnostic messages. */
9
26
  diagnostics?: ITtscDiagnostic[];
27
+ /** Emitted file contents keyed by their destination paths. */
10
28
  output: Record<string, string>;
11
29
  }
@@ -1,14 +1,38 @@
1
1
  /**
2
2
  * A single TypeScript compiler diagnostic emitted during `build`, `check`, or
3
- * `transform`. `line` and `character` are 0-based.
3
+ * `transform`. `line` and `character` are 1-based, matching the native driver.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * Nullable file identity and optional locations mirror CompileDiagnostic's
7
+ * native JSON projection; the severity union matches its two public categories.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * Identity, byte span, display location and message remain distinct fields;
10
+ * optional coordinates express absent context without an extra location model.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * Diagnostic codes and locations come from the compiler rather than a guessed
13
+ * editor coordinate or a fixture-specific message classification.
14
+ * @evidence contracts/common.md#meaningful-documentation
15
+ * Native JSDoc explains byte ranges, 1-based display locations and missing
16
+ * source context, following the documentation skill's units and absence rules.
17
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscDiagnostic is a data interface and acquires no handle, task or retained state.
18
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscDiagnostic is a data interface and chooses no algorithm or processing strategy.
19
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscDiagnostic is a data interface and coordinates no shared or repeated computation.
4
20
  */
5
21
  export interface ITtscDiagnostic {
22
+ /** Absolute slash-separated source path; null for project-wide diagnostics. */
6
23
  file: string | null;
24
+ /** Error affects the exit code; warning does not. */
7
25
  category: "error" | "warning";
26
+ /** Native compiler or plugin diagnostic identifier. */
8
27
  code: number;
28
+ /** Inclusive UTF-8 byte offset when source location is available. */
9
29
  start?: number;
30
+ /** Span length in UTF-8 bytes when source location is available. */
10
31
  length?: number;
32
+ /** 1-based source line; omitted when no display location is available. */
11
33
  line?: number;
34
+ /** 1-based UTF-8 byte column; omitted when no display location is available. */
12
35
  character?: number;
36
+ /** Complete diagnostic message for presentation to the caller. */
13
37
  messageText: string;
14
38
  }
@@ -1,5 +1,23 @@
1
1
  import type { ITtscSnapshotHandle } from "./ITtscSnapshotHandle";
2
- /** Request shape for `getSourceFileText`. */
2
+ /**
3
+ * Request shape for `getSourceFileText`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * Extending the shared handle keeps snapshot identity consistent while adding
7
+ * the file selector accepted by resolveSnapshotFile in the native host.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * Extending the common handle adds only the file selector, so all file queries
10
+ * share one snapshot identity definition and path interpretation boundary.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * The request names its snapshot and file explicitly; no project lookup is
13
+ * replaced by a fixed consumer path.
14
+ * @evidence contracts/common.md#meaningful-documentation
15
+ * JSDoc names the endpoint and accepted path bases, while the inherited member
16
+ * documents the opaque handle, following the documentation skill's context rule.
17
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscFileQuery is a data interface and acquires no handle, task or retained state.
18
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscFileQuery is a data interface and chooses no algorithm or processing strategy.
19
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscFileQuery is a data interface and coordinates no shared or repeated computation.
20
+ */
3
21
  export interface ITtscFileQuery extends ITtscSnapshotHandle {
4
22
  /** Project-relative or absolute path inside the snapshot's program. */
5
23
  path: string;
@@ -1,5 +1,24 @@
1
1
  import type { ITtscDiagnostic } from "./ITtscDiagnostic";
2
- /** Payload inside `ITtscResult.result` for `getDiagnostics`. */
2
+ /**
3
+ * Payload inside `ITtscResult.result` for `getDiagnostics`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * The required array matches the native endpoint's initialized result slice,
7
+ * unlike compile payloads where an absent diagnostics property is supported.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * A single initialized list represents the selection; messages reuse the
10
+ * compile diagnostic DTO and the transport status remains in its envelope.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * Reusing the compiler diagnostic shape avoids a separate simplified schema
13
+ * that discards information to satisfy a particular UI.
14
+ * @evidence contracts/common.md#meaningful-documentation
15
+ * Native JSDoc identifies the envelope and explains empty-result meaning,
16
+ * using the documentation skill's concrete context guidance.
17
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscFountainDiagnosticsResult is a data interface and acquires no handle, task or retained state.
18
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscFountainDiagnosticsResult is a data interface and chooses no algorithm or processing strategy.
19
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscFountainDiagnosticsResult is a data interface and coordinates no shared or repeated computation.
20
+ */
3
21
  export interface ITtscFountainDiagnosticsResult {
22
+ /** Messages selected by the query; an empty array means none were returned. */
4
23
  diagnostics: ITtscDiagnostic[];
5
24
  }
@@ -1,5 +1,22 @@
1
1
  import type { ITtscNodeInfo } from "./ITtscNodeInfo";
2
- /** Payload inside `ITtscResult.result` for `getNodeAtPosition`. */
2
+ /**
3
+ * Payload inside `ITtscResult.result` for `getNodeAtPosition`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * A nullable node mirrors the native pointer's JSON encoding and distinguishes
7
+ * a successful query with no token from an error envelope.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * One nullable node field expresses a token query result; node details and
10
+ * transport errors stay in their existing separate representations.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * No fabricated node stands in for an absent token; absence remains explicit.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * JSDoc names the endpoint and null meaning, following the documentation
15
+ * skill's requirement to explain optional or absent state.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscNodeAtPositionResult is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscNodeAtPositionResult is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscNodeAtPositionResult is a data interface and coordinates no shared or repeated computation.
19
+ */
3
20
  export interface ITtscNodeAtPositionResult {
4
21
  /** `null` when no syntax token touches the position. */
5
22
  node: ITtscNodeInfo | null;
@@ -1,10 +1,31 @@
1
- /** Syntax-token shape returned by `getNodeAtPosition`. */
1
+ /**
2
+ * Syntax-token shape returned by `getNodeAtPosition`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * Numeric kind and byte ranges preserve TypeScript-Go's AST representation;
6
+ * a printable name and optional text make the JSON usable without that AST.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * Kind, range and spelling are a flat token projection, without exposing
9
+ * parent links or mutable compiler nodes to the JavaScript consumer.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Positions remain native byte offsets, without a guessed UTF-16 conversion
12
+ * or an invented source span for a particular token.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Members explain range units, endpoint inclusion and optional text. Native
15
+ * JSDoc follows the documentation skill's concrete usage-context guidance.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscNodeInfo is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscNodeInfo is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscNodeInfo is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscNodeInfo {
3
21
  /** Numeric `ast.Kind` from TypeScript-Go. */
4
22
  kind: number;
5
23
  /** Human-readable name of `kind`. */
6
24
  kindName: string;
7
- /** Byte offset where the node begins (inclusive). */
25
+ /**
26
+ * Byte offset of the token's first byte (inclusive), after leading whitespace
27
+ * and comments.
28
+ */
8
29
  pos: number;
9
30
  /** Byte offset where the node ends (exclusive). */
10
31
  end: number;
@@ -1,4 +1,22 @@
1
- /** Options for dispatching a named plugin subcommand via `api.plugin`. */
1
+ /**
2
+ * Options for dispatching a named plugin subcommand via `api.plugin`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * Required dispatch fields plus scalar options mirror buildPluginArgv's native
6
+ * translation, allowing each registered plugin to own its argument schema.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * Named dispatch fields are separated from forwarded scalars; the index
9
+ * signature permits plugin-owned arguments without hardwiring plugin schemas.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Plugin defaults remain with the plugin; this transport does not hardcode
12
+ * consumer-specific arguments or pretend to validate an unknown command.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Member JSDoc distinguishes dispatch identity from forwarded arguments and
15
+ * boolean omission, following the documentation skill's usage-context guidance.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscPluginOpts is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscPluginOpts is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscPluginOpts is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscPluginOpts {
3
21
  /** Plugin id registered with `host.Expose` (e.g. `@ttsc/banner`). */
4
22
  name: string;
@@ -6,8 +24,11 @@ export interface ITtscPluginOpts {
6
24
  command: string;
7
25
  /** Forwarded as `--cwd=<value>`. */
8
26
  cwd?: string;
9
- /** Forwarded as `--tsconfig=<value>`. Defaults to `tsconfig.json`. */
27
+ /** Forwarded as `--tsconfig=<value>`; an absent value is left to the plugin. */
10
28
  tsconfig?: string;
11
- /** Any extra key/value pairs map to `--key=value` argv entries. */
29
+ /**
30
+ * Scalars become `--key=value`; true becomes `--key`, false/undefined are
31
+ * omitted.
32
+ */
12
33
  [key: string]: string | boolean | number | undefined;
13
34
  }
@@ -2,13 +2,30 @@ import type { ITtscFileQuery } from "./ITtscFileQuery";
2
2
  /**
3
3
  * Request shape for `getNodeAtPosition`, `getTypeAtPosition`,
4
4
  * `getSymbolAtPosition`.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation
7
+ * Extending the shared file query adds the native byte-offset selector without
8
+ * duplicating snapshot/file identity. The native boundary validates finite
9
+ * integer bounds before converting JavaScript numbers to Go byte offsets.
10
+ * @evidence contracts/common.md#clear-and-simple-design
11
+ * The file query owns snapshot and path selection; this extension adds only
12
+ * the byte coordinate shared by syntax, type and symbol endpoint handlers.
13
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
14
+ * The native coordinate system is explicit rather than repaired by guessing
15
+ * that a JavaScript character index equals an offset into UTF-8 source.
16
+ * @evidence contracts/common.md#meaningful-documentation
17
+ * Member JSDoc gives the accepted interval and explains the caller's UTF-16
18
+ * conversion responsibility, following the documentation skill's units rule.
19
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscPositionQuery is a data interface and acquires no handle, task or retained state.
20
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscPositionQuery is a data interface and chooses no algorithm or processing strategy.
21
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscPositionQuery is a data interface and coordinates no shared or repeated computation.
5
22
  */
6
23
  export interface ITtscPositionQuery extends ITtscFileQuery {
7
24
  /**
8
- * Byte offset into the file's source text. It must satisfy `0 <= position <
9
- * sourceText's UTF-8 byte length`; the offset immediately after the final
10
- * byte is out of range. JS callers with a UTF-16 line/character pair must
11
- * resolve it to a byte offset first.
25
+ * Integer byte offset into the file's source text. It must satisfy `0 <=
26
+ * position < sourceText's UTF-8 byte length`; the offset immediately after
27
+ * the final byte is out of range. JS callers with a UTF-16 line/character
28
+ * pair must resolve it to a byte offset first.
12
29
  */
13
30
  position: number;
14
31
  }
@@ -1,5 +1,25 @@
1
- /** Payload inside `ITtscResult.result` for `releaseSnapshot`. */
1
+ /**
2
+ * Payload inside `ITtscResult.result` for `releaseSnapshot`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * The boolean mirrors the native release outcome without making an unknown
6
+ * handle into a transport failure; idempotent callers can inspect the result.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * One outcome field conveys registry removal; handle lookup and resource
9
+ * cleanup belong to the native owner, outside this response value.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * The actual release outcome is represented instead of always reporting success.
12
+ * @evidence contracts/common.md#meaningful-documentation
13
+ * JSDoc separates the enclosing payload from absent-handle meaning, following
14
+ * the documentation skill's guidance for failure and optional state.
15
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscReleaseSnapshotResult is a data interface and acquires no handle, task or retained state.
16
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscReleaseSnapshotResult is a data interface and chooses no algorithm or processing strategy.
17
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscReleaseSnapshotResult is a data interface and coordinates no shared or repeated computation.
18
+ */
2
19
  export interface ITtscReleaseSnapshotResult {
3
- /** `false` when the handle was not present (already released). */
20
+ /**
21
+ * `false` when the handle was absent, whether never created or already
22
+ * released.
23
+ */
4
24
  released: boolean;
5
25
  }
@@ -1,14 +1,40 @@
1
- /** Envelope returned by every `ITtscApi` method. */
1
+ /**
2
+ * Envelope returned by asynchronous `ITtscApi` operations.
3
+ *
4
+ * `version` and `plugins` return their synchronous values directly.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation
7
+ * The uniform exit-code/stream/payload shape mirrors the native JavaScript
8
+ * bridge, with structured JSON separate from plugin output streams.
9
+ * @evidence contracts/common.md#clear-and-simple-design
10
+ * One envelope separates status, two output channels and structured payload
11
+ * text, leaving endpoint-specific DTOs outside the transport representation.
12
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
13
+ * A nonzero code remains visible; empty payload text is not replaced with a
14
+ * fabricated success object or interpreted as evidence that the call succeeded.
15
+ * @evidence contracts/common.md#meaningful-documentation
16
+ * Separate JSDoc paragraphs distinguish asynchronous envelopes from direct
17
+ * values; members explain channels, following the documentation skill's guidance.
18
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscResult is a data interface and acquires no handle, task or retained state.
19
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscResult is a data interface and chooses no algorithm or processing strategy.
20
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscResult is a data interface and coordinates no shared or repeated computation.
21
+ */
2
22
  export interface ITtscResult {
3
23
  /** Exit code. 0 = success, 2 = compiler/config/usage error, 3 = runtime error. */
4
24
  code: number;
5
- /** Anything the wasm wrote to its stdout stream. */
25
+ /**
26
+ * Invocation-owned plugin stdout; project/query endpoints use an empty
27
+ * string.
28
+ */
6
29
  stdout: string;
7
- /** Anything the wasm wrote to its stderr stream. */
30
+ /**
31
+ * Plugin stderr or a project/query failure message; distinct from host.stderr
32
+ * capture.
33
+ */
8
34
  stderr: string;
9
35
  /**
10
- * For the base endpoints, the JSON-encoded compile/transform result. For the
11
- * plugin endpoint, this is empty — the plugin's own output sits in
36
+ * For project and snapshot endpoints, the JSON-encoded structured result. For
37
+ * the plugin endpoint, this is empty. The plugin's own output sits in
12
38
  * stdout/stderr. Use `parseResult<T>` to deserialize.
13
39
  */
14
40
  result: string;
@@ -1,4 +1,22 @@
1
- /** Common request shape for fountain verbs that act on an existing snapshot. */
1
+ /**
2
+ * Common request shape for fountain verbs that act on an existing snapshot.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * The opaque string matches the native snapshot registry's public identity
6
+ * and is shared by query types through interface extension.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * The shared request contains only registry identity; derived requests add
9
+ * selectors without exposing the retained Program or duplicating its lifecycle.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Callers pass the returned identity; they need not reconstruct an internal
12
+ * sequence or depend on the current handle spelling.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * JSDoc identifies the shared request role and opaque producer, following the
15
+ * documentation skill's requirement for nonobvious usage context.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSnapshotHandle is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSnapshotHandle is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSnapshotHandle is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscSnapshotHandle {
3
21
  /** Opaque handle returned by `snapshot`. */
4
22
  handle: string;