@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
@@ -1,4 +1,25 @@
1
- /** Payload inside `ITtscResult.result` for `snapshot`. */
1
+ /**
2
+ * Payload inside `ITtscResult.result` for `snapshot`.
3
+ *
4
+ * The caller owns the returned snapshot and must release it when queries
5
+ * finish.
6
+ *
7
+ * @evidence contracts/common.md#principled-implementation
8
+ * Returning an opaque handle keeps retained Go program objects behind the
9
+ * native registry while allowing several queries to share one snapshot.
10
+ * @evidence contracts/common.md#clear-and-simple-design
11
+ * A single opaque handle transfers query access to the caller; registry state
12
+ * and Program cleanup remain with the host instead of entering the payload.
13
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
14
+ * The handle refers to a real registered program, without encoding a consumer
15
+ * path or fabricated query result into the public identity.
16
+ * @evidence contracts/common.md#meaningful-documentation
17
+ * Separate JSDoc paragraphs explain the envelope and release ownership, and
18
+ * the member names its consumers, following the documentation skill's guidance.
19
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSnapshotResult is a data interface and acquires no handle, task or retained state.
20
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSnapshotResult is a data interface and chooses no algorithm or processing strategy.
21
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSnapshotResult is a data interface and coordinates no shared or repeated computation.
22
+ */
2
23
  export interface ITtscSnapshotResult {
3
24
  /** Opaque handle; pass back to fountain verbs and to `releaseSnapshot`. */
4
25
  handle: string;
@@ -1,4 +1,22 @@
1
- /** Payload inside `ITtscResult.result` for `snapshots`. */
1
+ /**
2
+ * Payload inside `ITtscResult.result` for `snapshots`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * A string array mirrors the registry listing without exposing program objects
6
+ * or implying an ordering that the native map does not provide.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * A flat list exposes live registry identities without a second snapshot
9
+ * descriptor layer or ownership information already supplied by its API.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Entries are current registry identities rather than an expected debug list.
12
+ * @evidence contracts/common.md#meaningful-documentation
13
+ * JSDoc identifies the envelope, empty state and unspecified order using the
14
+ * documentation skill's concrete context guidance.
15
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSnapshotsResult is a data interface and acquires no handle, task or retained state.
16
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSnapshotsResult is a data interface and chooses no algorithm or processing strategy.
17
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSnapshotsResult is a data interface and coordinates no shared or repeated computation.
18
+ */
2
19
  export interface ITtscSnapshotsResult {
20
+ /** Live handles in unspecified order; empty when none are registered. */
3
21
  handles: string[];
4
22
  }
@@ -1,4 +1,22 @@
1
- /** Payload inside `ITtscResult.result` for `getSourceFileText`. */
1
+ /**
2
+ * Payload inside `ITtscResult.result` for `getSourceFileText`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * A required text field mirrors the native successful response; missing files
6
+ * use the error envelope rather than overloading an empty source string.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * The selected file's text is the only payload field; request identity and
9
+ * error status remain in the existing request and transport envelope.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Text comes from the retained program, without substituting the caller's
12
+ * editor buffer or a separately loaded approximation of the snapshot.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Native JSDoc names the endpoint and retained-program provenance, following
15
+ * the documentation skill's rule to explain the facts needed by a consumer.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSourceFileTextResult is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSourceFileTextResult is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSourceFileTextResult is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscSourceFileTextResult {
3
21
  /** Current source text held by the snapshot's program. */
4
22
  text: string;
@@ -1,5 +1,26 @@
1
- /** Payload inside `ITtscResult.result` for `getSourceFiles`. */
1
+ /**
2
+ * Payload inside `ITtscResult.result` for `getSourceFiles`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * A string array carries the native program's source-file keys without making
6
+ * the JavaScript consumer depend on Go AST objects.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * The payload exposes only source identities; source text and semantic queries
9
+ * remain separate operations instead of inflating every file-list response.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * The program supplies file identity; the response does not invent a fixed
12
+ * entry file or hide files according to a consumer name.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * JSDoc identifies the endpoint, declaration-file exclusion and path convention,
15
+ * following the documentation skill's usage-context guidance.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSourceFilesResult is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSourceFilesResult is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSourceFilesResult is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscSourceFilesResult {
3
- /** Project-relative paths of non-declaration source files. */
21
+ /**
22
+ * Non-declaration source paths: project-relative inside cwd, absolute
23
+ * outside.
24
+ */
4
25
  files: string[];
5
26
  }
@@ -1,5 +1,22 @@
1
1
  import type { ITtscSymbolInfo } from "./ITtscSymbolInfo";
2
- /** Payload inside `ITtscResult.result` for `getSymbolAtPosition`. */
2
+ /**
3
+ * Payload inside `ITtscResult.result` for `getSymbolAtPosition`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * The nullable symbol follows native pointer JSON encoding, keeping successful
7
+ * absence distinct from a failed query envelope.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * A nullable symbol field holds the lookup outcome; reusable symbol metadata
10
+ * and transport failure are represented separately without another status flag.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * Absence is explicit rather than filled with a guessed identifier or symbol.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * JSDoc names the envelope and null meaning, following the documentation
15
+ * skill's requirement to explain absence rather than repeat the field type.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSymbolAtPositionResult is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSymbolAtPositionResult is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSymbolAtPositionResult is a data interface and coordinates no shared or repeated computation.
19
+ */
3
20
  export interface ITtscSymbolAtPositionResult {
4
21
  /** `null` when no touching token has an associated symbol. */
5
22
  symbol: ITtscSymbolInfo | null;
@@ -1,7 +1,30 @@
1
- /** A single declaration site for a symbol. */
1
+ /**
2
+ * A single declaration site for a symbol.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * Nullable file identity and byte ranges preserve the native AST declaration
6
+ * projection, including declarations without an associated source file.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * Source identity and a byte interval are sufficient for a declaration site;
9
+ * this value contains no redundant source text or compiler object references.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * A missing source file remains null; neither a placeholder filename nor a
12
+ * guessed JavaScript character range is inserted into the declaration.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Member JSDoc explains path provenance and interval units, following the
15
+ * documentation skill's guidance for absent state and coordinates.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSymbolDeclaration is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSymbolDeclaration is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSymbolDeclaration is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscSymbolDeclaration {
3
- /** Project-relative or absolute path; `null` for synthetic declarations. */
21
+ /** Project-relative or absolute path; null when no source file is associated. */
4
22
  file: string | null;
23
+ /**
24
+ * Inclusive start offset of the declaration's first token in the source's
25
+ * UTF-8 bytes, after leading whitespace, comments and JSDoc.
26
+ */
5
27
  pos: number;
28
+ /** Exclusive end offset in the source's UTF-8 bytes. */
6
29
  end: number;
7
30
  }
@@ -1,5 +1,23 @@
1
1
  import type { ITtscSymbolDeclaration } from "./ITtscSymbolDeclaration";
2
- /** Symbol shape returned by `getSymbolAtPosition`. */
2
+ /**
3
+ * Symbol shape returned by `getSymbolAtPosition`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * Names, flags and declaration projections match the native checker result;
7
+ * separate displayed text avoids confusing raw internal names with presentation.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * Identity and presentation are separate, while bounded declaration sites reuse
10
+ * one site DTO and their total count explains a truncated projection directly.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * The declaration cap is the host's response-size policy, with the original
13
+ * total retained rather than pretending the shortened list is complete.
14
+ * @evidence contracts/common.md#meaningful-documentation
15
+ * JSDoc explains internal naming, printing and capped versus total declarations,
16
+ * following the documentation skill's concrete context guidance.
17
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscSymbolInfo is a data interface and acquires no handle, task or retained state.
18
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscSymbolInfo is a data interface and chooses no algorithm or processing strategy.
19
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscSymbolInfo is a data interface and coordinates no shared or repeated computation.
20
+ */
3
21
  export interface ITtscSymbolInfo {
4
22
  /** Raw symbol name, including TypeScript's internal prefix markers. */
5
23
  name: string;
@@ -2,11 +2,29 @@ import type { ITtscDiagnostic } from "./ITtscDiagnostic";
2
2
  /**
3
3
  * Structured payload inside `ITtscResult.result` for `transform`.
4
4
  *
5
- * `typescript` maps source file paths (relative to `cwd`) to their
6
- * post-transform TypeScript text — useful for playgrounds that want to show the
7
- * rewritten source before it is emitted.
5
+ * `typescript` maps source paths to post-transform TypeScript text for a
6
+ * preview before emit. Paths inside `cwd` are relative; outside sources remain
7
+ * absolute.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation
10
+ * A path-keyed string record matches the native transform payload, keeping
11
+ * transformed TypeScript distinct from build's emitted JavaScript map.
12
+ * @evidence contracts/common.md#clear-and-simple-design
13
+ * A source-text map and the shared diagnostic DTO serve transform consumers;
14
+ * emitted files belong to the compile result instead of a mixed payload.
15
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
16
+ * The payload exposes actual transformed source, without treating expected
17
+ * emitted answers as a replacement for the transform result.
18
+ * @evidence contracts/common.md#meaningful-documentation
19
+ * Separate paragraphs identify the envelope and source stage; members explain
20
+ * optional diagnostics, following the documentation skill's clarity guidance.
21
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscTransformResult is a data interface and acquires no handle, task or retained state.
22
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscTransformResult is a data interface and chooses no algorithm or processing strategy.
23
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscTransformResult is a data interface and coordinates no shared or repeated computation.
8
24
  */
9
25
  export interface ITtscTransformResult {
26
+ /** Present when the native transform includes diagnostic messages. */
10
27
  diagnostics?: ITtscDiagnostic[];
28
+ /** Post-transform source text keyed by source-file paths. */
11
29
  typescript: Record<string, string>;
12
30
  }
@@ -1,5 +1,22 @@
1
1
  import type { ITtscTypeInfo } from "./ITtscTypeInfo";
2
- /** Payload inside `ITtscResult.result` for `getTypeAtPosition`. */
2
+ /**
3
+ * Payload inside `ITtscResult.result` for `getTypeAtPosition`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation
6
+ * A nullable type mirrors the native optional semantic result, separately from
7
+ * the error code carried by the enclosing request envelope.
8
+ * @evidence contracts/common.md#clear-and-simple-design
9
+ * The nullable type field carries the semantic result without conflating it
10
+ * with request failure or adding a parallel state discriminator.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
12
+ * No universal any/error type is fabricated for positions without type semantics.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Native JSDoc identifies the endpoint and meaningful null state, following
15
+ * the documentation skill's guidance for consumer-facing context.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscTypeAtPositionResult is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscTypeAtPositionResult is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscTypeAtPositionResult is a data interface and coordinates no shared or repeated computation.
19
+ */
3
20
  export interface ITtscTypeAtPositionResult {
4
21
  /** `null` when no touching token has a type. */
5
22
  type: ITtscTypeInfo | null;
@@ -1,4 +1,22 @@
1
- /** Type shape returned by `getTypeAtPosition`. */
1
+ /**
2
+ * Type shape returned by `getTypeAtPosition`.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * Printed text and native flag bits project the checker result through JSON
6
+ * without exposing Go checker objects or an incomplete parallel type model.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * Printed text and native flags provide presentation and classification in a
9
+ * small value; structural compiler types remain owned by the native checker.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * TypeToString is the presentation authority; the consumer need not infer
12
+ * a type from source spelling or a manually maintained flag lookup.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Member JSDoc names the native printing API and flag provenance, following
15
+ * the documentation skill's concrete context guidance.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscTypeInfo is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscTypeInfo is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscTypeInfo is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscTypeInfo {
3
21
  /** Printed type, equivalent to TypeScript's `TypeToString(t)`. */
4
22
  text: string;
@@ -1,9 +1,36 @@
1
- /** Build metadata embedded in the wasm by the Go linker at compile time. */
1
+ /**
2
+ * Build and runtime metadata returned synchronously by the wasm.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation
5
+ * String fields match jsVersion's linker metadata and runtime queries; the
6
+ * API can report an unversioned development binary without guessing a release.
7
+ * @evidence contracts/common.md#clear-and-simple-design
8
+ * Link-time release metadata and runtime target/toolchain identity remain
9
+ * explicit fields, without a version-parsing or environment-inference layer.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
11
+ * Target and toolchain identity come from the binary rather than the browser's
12
+ * platform or a consumer-specific version constant.
13
+ * @evidence contracts/common.md#meaningful-documentation
14
+ * Members distinguish release metadata from Go runtime/target identity,
15
+ * following the documentation skill's concrete context guidance.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources ITtscVersion is a data interface and acquires no handle, task or retained state.
17
+ * @evidenceExclude contracts/performance.md#efficient-algorithms ITtscVersion is a data interface and chooses no algorithm or processing strategy.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work ITtscVersion is a data interface and coordinates no shared or repeated computation.
19
+ */
2
20
  export interface ITtscVersion {
21
+ /** Linker-supplied release version, or the development placeholder. */
3
22
  version: string;
23
+ /** Linker-supplied source revision, or the development placeholder. */
4
24
  commit: string;
25
+ /**
26
+ * Linker-supplied date, or unknown for an unannotated build. The base binary
27
+ * stamps the date of its source commit rather than the time it was built.
28
+ */
5
29
  date: string;
30
+ /** Go runtime's toolchain version. */
6
31
  go: string;
32
+ /** Binary target OS, js for the browser build. */
7
33
  goos: string;
34
+ /** Binary target architecture, wasm for the browser build. */
8
35
  goarch: string;
9
36
  }