dsh-typst-plugin 0.1.0-alpha.0 → 0.1.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 (120) hide show
  1. package/README.en.md +86 -52
  2. package/README.md +93 -59
  3. package/cordis.patch.yml +1 -1
  4. package/docs/images/icon.png +0 -0
  5. package/lib/client.js +2088 -1136
  6. package/lib/client.js.map +4 -4
  7. package/lib/config.d.ts +66 -9
  8. package/lib/config.d.ts.map +1 -1
  9. package/lib/config.js +161 -25
  10. package/lib/config.js.map +1 -7
  11. package/lib/constants.d.ts +21 -2
  12. package/lib/constants.d.ts.map +1 -1
  13. package/lib/constants.js +83 -60
  14. package/lib/constants.js.map +1 -7
  15. package/lib/contract.d.ts +90 -6
  16. package/lib/contract.d.ts.map +1 -1
  17. package/lib/contract.js +9 -1
  18. package/lib/contract.js.map +1 -7
  19. package/lib/diagnostic-text.d.ts +13 -0
  20. package/lib/diagnostic-text.d.ts.map +1 -0
  21. package/lib/diagnostic-text.js +28 -0
  22. package/lib/diagnostic-text.js.map +1 -0
  23. package/lib/errors.d.ts +57 -15
  24. package/lib/errors.d.ts.map +1 -1
  25. package/lib/errors.js +154 -79
  26. package/lib/errors.js.map +1 -7
  27. package/lib/host/facts.d.ts.map +1 -1
  28. package/lib/host/facts.js +133 -139
  29. package/lib/host/facts.js.map +1 -7
  30. package/lib/host/which.d.ts +20 -0
  31. package/lib/host/which.d.ts.map +1 -0
  32. package/lib/host/which.js +50 -0
  33. package/lib/host/which.js.map +1 -0
  34. package/lib/index.js +2 -5
  35. package/lib/index.js.map +1 -7
  36. package/lib/remote.d.ts +5 -4
  37. package/lib/remote.d.ts.map +1 -1
  38. package/lib/remote.js +153 -143
  39. package/lib/remote.js.map +1 -7
  40. package/lib/service.d.ts +28 -4
  41. package/lib/service.d.ts.map +1 -1
  42. package/lib/service.js +202 -99
  43. package/lib/service.js.map +1 -7
  44. package/lib/skills/typst.js +74 -68
  45. package/lib/skills/typst.js.map +1 -7
  46. package/lib/status-codec.js +10 -5
  47. package/lib/status-codec.js.map +1 -7
  48. package/lib/tools/registration.d.ts +4 -3
  49. package/lib/tools/registration.d.ts.map +1 -1
  50. package/lib/tools/registration.js +726 -493
  51. package/lib/tools/registration.js.map +1 -7
  52. package/lib/tools/shared.d.ts +4 -5
  53. package/lib/tools/shared.d.ts.map +1 -1
  54. package/lib/tools/shared.js +73 -64
  55. package/lib/tools/shared.js.map +1 -7
  56. package/lib/typert.d.ts +5 -3
  57. package/lib/typert.d.ts.map +1 -1
  58. package/lib/typert.js +113 -64
  59. package/lib/typert.js.map +1 -7
  60. package/lib/typst/diagnostics.d.ts.map +1 -1
  61. package/lib/typst/diagnostics.js +218 -152
  62. package/lib/typst/diagnostics.js.map +1 -7
  63. package/lib/typst/flags.d.ts +8 -0
  64. package/lib/typst/flags.d.ts.map +1 -0
  65. package/lib/typst/flags.js +8 -0
  66. package/lib/typst/flags.js.map +1 -0
  67. package/lib/typst/locate.d.ts +6 -13
  68. package/lib/typst/locate.d.ts.map +1 -1
  69. package/lib/typst/locate.js +138 -180
  70. package/lib/typst/locate.js.map +1 -7
  71. package/lib/typst/mainfile.d.ts +23 -4
  72. package/lib/typst/mainfile.d.ts.map +1 -1
  73. package/lib/typst/mainfile.js +131 -59
  74. package/lib/typst/mainfile.js.map +1 -7
  75. package/lib/typst/match.d.ts +9 -1
  76. package/lib/typst/match.d.ts.map +1 -1
  77. package/lib/typst/match.js +213 -157
  78. package/lib/typst/match.js.map +1 -7
  79. package/lib/typst/oneshot.d.ts +8 -5
  80. package/lib/typst/oneshot.d.ts.map +1 -1
  81. package/lib/typst/oneshot.js +76 -66
  82. package/lib/typst/oneshot.js.map +1 -7
  83. package/lib/typst/owners.d.ts +28 -0
  84. package/lib/typst/owners.d.ts.map +1 -0
  85. package/lib/typst/owners.js +98 -0
  86. package/lib/typst/owners.js.map +1 -0
  87. package/lib/typst/pdf-extract.d.ts +1 -2
  88. package/lib/typst/pdf-extract.d.ts.map +1 -1
  89. package/lib/typst/pdf-extract.js +98 -74
  90. package/lib/typst/pdf-extract.js.map +1 -7
  91. package/lib/typst/process.d.ts +73 -0
  92. package/lib/typst/process.d.ts.map +1 -0
  93. package/lib/typst/process.js +147 -0
  94. package/lib/typst/process.js.map +1 -0
  95. package/lib/typst/text.d.ts +4 -7
  96. package/lib/typst/text.d.ts.map +1 -1
  97. package/lib/typst/text.js +258 -290
  98. package/lib/typst/text.js.map +1 -7
  99. package/lib/typst/watcher.d.ts +16 -17
  100. package/lib/typst/watcher.d.ts.map +1 -1
  101. package/lib/typst/watcher.js +199 -208
  102. package/lib/typst/watcher.js.map +1 -7
  103. package/lib/wire-schemas.d.ts +8 -153
  104. package/lib/wire-schemas.d.ts.map +1 -1
  105. package/lib/wire-schemas.js +405 -361
  106. package/lib/wire-schemas.js.map +1 -7
  107. package/lib/workspace/containment.d.ts +25 -0
  108. package/lib/workspace/containment.d.ts.map +1 -0
  109. package/lib/workspace/containment.js +54 -0
  110. package/lib/workspace/containment.js.map +1 -0
  111. package/lib/workspace/session.d.ts +73 -14
  112. package/lib/workspace/session.d.ts.map +1 -1
  113. package/lib/workspace/session.js +1516 -1172
  114. package/lib/workspace/session.js.map +1 -7
  115. package/locale/en.json +8 -2
  116. package/locale/zh.json +8 -2
  117. package/package.json +36 -179
  118. package/release-provenance.json +137 -0
  119. package/lib/typst/pdfjs-worker.d.js +0 -1
  120. package/lib/typst/pdfjs-worker.d.js.map +0 -7
package/lib/contract.d.ts CHANGED
@@ -5,16 +5,79 @@
5
5
  * the client-graph allowlist (`scripts/client-graph-authority.mjs`).
6
6
  * @module dsh-typst/contract
7
7
  */
8
+ import type { TypstErrorCode } from "./errors.js";
8
9
  /**
9
- * The plugin's one Remote failure code: every domain error crosses the wire
10
- * as `typst/domain` with the stable domain code in `details`, so consumers
11
- * discriminate by `details.code` while the wire keeps a single declared
12
- * shape (the dsh-zotero pattern).
10
+ * One Remote failure code per stable domain failure: every domain error
11
+ * crosses the wire as its own `typst/<reason>`, so consumers discriminate on
12
+ * `error.code` while `details.code` keeps the host's stable domain code.
13
13
  */
14
14
  declare module "@deepseek-ai/dsh-typert-protocol" {
15
15
  interface RemoteErrorDetailsMap {
16
- "typst/domain": {
17
- readonly code: string;
16
+ "typst/missing": {
17
+ readonly code: TypstErrorCode;
18
+ };
19
+ "typst/too-old": {
20
+ readonly code: TypstErrorCode;
21
+ };
22
+ "typst/unusable": {
23
+ readonly code: TypstErrorCode;
24
+ };
25
+ "typst/no-main": {
26
+ readonly code: TypstErrorCode;
27
+ };
28
+ "typst/no-preview": {
29
+ readonly code: TypstErrorCode;
30
+ };
31
+ "typst/not-found": {
32
+ readonly code: TypstErrorCode;
33
+ };
34
+ "typst/invalid-argument": {
35
+ readonly code: TypstErrorCode;
36
+ };
37
+ "typst/path-outside-workspace": {
38
+ readonly code: TypstErrorCode;
39
+ };
40
+ "typst/timeout": {
41
+ readonly code: TypstErrorCode;
42
+ };
43
+ "typst/watch-failed": {
44
+ readonly code: TypstErrorCode;
45
+ };
46
+ "typst/quote-not-found": {
47
+ readonly code: TypstErrorCode;
48
+ };
49
+ "typst/not-composed": {
50
+ readonly code: TypstErrorCode;
51
+ };
52
+ "typst/attachment-unavailable": {
53
+ readonly code: TypstErrorCode;
54
+ };
55
+ "typst/compile-failed": {
56
+ readonly code: TypstErrorCode;
57
+ };
58
+ "typst/sandbox-read-only": {
59
+ readonly code: TypstErrorCode;
60
+ };
61
+ "typst/sandbox-invalid-root": {
62
+ readonly code: TypstErrorCode;
63
+ };
64
+ "typst/page-out-of-range": {
65
+ readonly code: TypstErrorCode;
66
+ };
67
+ "typst/main-changed": {
68
+ readonly code: TypstErrorCode;
69
+ };
70
+ "typst/clock-skew": {
71
+ readonly code: TypstErrorCode;
72
+ };
73
+ "typst/invalid-target": {
74
+ readonly code: TypstErrorCode;
75
+ };
76
+ "typst/settle-failed": {
77
+ readonly code: TypstErrorCode;
78
+ };
79
+ "typst/unexpected": {
80
+ readonly code: TypstErrorCode;
18
81
  };
19
82
  }
20
83
  }
@@ -100,6 +163,10 @@ export interface HighlightView {
100
163
  identity: PreviewIdentity;
101
164
  seq: number;
102
165
  pageIndex: number;
166
+ /** UTF-16 offset of the matched text on its page, kept for re-location. */
167
+ startOffset?: number;
168
+ /** Ordinal of the quote occurrence in its source file, when created from lines. */
169
+ occurrence?: number;
103
170
  rects: number[][];
104
171
  stale: boolean;
105
172
  createdAt: number;
@@ -129,6 +196,13 @@ export interface SetupView {
129
196
  facts: HostFactsView | null;
130
197
  searched: string[];
131
198
  }
199
+ /** What one explicit index refresh discovered, returned to its caller. */
200
+ export interface DiscoveryView {
201
+ /** Number of `.typ` candidates the refresh left in the workspace index. */
202
+ candidates: number;
203
+ includeExcluded: boolean;
204
+ errors: string[];
205
+ }
132
206
  /**
133
207
  * Everything the panel renders, in one frame: the stream's first frame is
134
208
  * the current state, later frames follow every relevant change (compile
@@ -146,6 +220,8 @@ export interface TypstStateFrame {
146
220
  };
147
221
  toolchain: ToolchainView;
148
222
  workspace: string;
223
+ /** Absolute workspace root the diagnostics' relative file paths resolve against. */
224
+ workspaceRoot: string;
149
225
  main: string | null;
150
226
  candidates: string[];
151
227
  /**
@@ -156,7 +232,15 @@ export interface TypstStateFrame {
156
232
  */
157
233
  fragments: string[];
158
234
  status: StatusView;
235
+ /**
236
+ * Diagnostics of this round, capped at `LIMITS.diagnostics`. When the
237
+ * compiler produced more, `diagnosticsTotal` is the full count and
238
+ * `diagnosticsTruncated` is true; the model text and the panel both show
239
+ * the same bounded views.
240
+ */
159
241
  diagnostics: DiagnosticView[];
242
+ diagnosticsTotal: number;
243
+ diagnosticsTruncated: boolean;
160
244
  snapshot: SnapshotView | null;
161
245
  highlights: HighlightView[];
162
246
  view: PanelView;
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,OAAO,QAAQ,k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UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB;;;;;OAKG;IACH,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CAC/B;AAMD,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf"}
package/lib/contract.js CHANGED
@@ -1 +1,9 @@
1
- //# sourceMappingURL=contract.js.map
1
+ /**
2
+ * Wire identity shared by both halves: the view types the host serves and
3
+ * the browser half renders, plus the strict zod codecs both arms materialize
4
+ * (`wire-schemas.ts`). Values and type-only imports only — this module is on
5
+ * the client-graph allowlist (`scripts/client-graph-authority.mjs`).
6
+ * @module dsh-typst/contract
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=contract.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The one rendering of a diagnostic as model-facing text. Both the host
3
+ * tools and the browser panel (its feedback drafts) import this module, so a
4
+ * compile error reads the same in `typst_check` and in an Agent request.
5
+ * Pure values only: safe for the browser bundle.
6
+ * @module dsh-typst/diagnostic-text
7
+ */
8
+ import type { DiagnosticLocationView, DiagnosticView } from "./contract.js";
9
+ /** A location as `file:line:column`, or the explicit absence marker. */
10
+ export declare function formatDiagnosticLocation(location: DiagnosticLocationView | null): string;
11
+ /** One diagnostic: severity/message, location, excerpt, hints and call trace. */
12
+ export declare function diagnosticText(diagnostic: DiagnosticView): string;
13
+ //# sourceMappingURL=diagnostic-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic-text.d.ts","sourceRoot":"","sources":["../src/diagnostic-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5E,wEAAwE;AACxE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,GACtC,MAAM,CAIR;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,CAajE"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The one rendering of a diagnostic as model-facing text. Both the host
3
+ * tools and the browser panel (its feedback drafts) import this module, so a
4
+ * compile error reads the same in `typst_check` and in an Agent request.
5
+ * Pure values only: safe for the browser bundle.
6
+ * @module dsh-typst/diagnostic-text
7
+ */
8
+ /** A location as `file:line:column`, or the explicit absence marker. */
9
+ export function formatDiagnosticLocation(location) {
10
+ return location
11
+ ? `${location.file}:${location.line}:${location.column}`
12
+ : "(no location)";
13
+ }
14
+ /** One diagnostic: severity/message, location, excerpt, hints and call trace. */
15
+ export function diagnosticText(diagnostic) {
16
+ const lines = [
17
+ `${diagnostic.severity}: ${diagnostic.message}`,
18
+ ` at ${formatDiagnosticLocation(diagnostic.location)}`,
19
+ ];
20
+ if (diagnostic.excerpt !== undefined)
21
+ lines.push(` | ${diagnostic.excerpt.trim()}`);
22
+ for (const hint of diagnostic.hints)
23
+ lines.push(` hint: ${hint}`);
24
+ for (const point of diagnostic.trace)
25
+ lines.push(` from ${formatDiagnosticLocation(point.location)}: ${point.message}`);
26
+ return lines.join("\n");
27
+ }
28
+ //# sourceMappingURL=diagnostic-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic-text.js","sourceRoot":"","sources":["../src/diagnostic-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,wEAAwE;AACxE,MAAM,UAAU,wBAAwB,CACtC,QAAuC;IAEvC,OAAO,QAAQ;QACb,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE;QACxD,CAAC,CAAC,eAAe,CAAC;AACtB,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,UAA0B;IACvD,MAAM,KAAK,GAAa;QACtB,GAAG,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,OAAO,EAAE;QAC/C,QAAQ,wBAAwB,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;KACxD,CAAC;IACF,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS;QAClC,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACnE,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,KAAK;QAClC,KAAK,CAAC,IAAI,CACR,UAAU,wBAAwB,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CACvE,CAAC;IACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/lib/errors.d.ts CHANGED
@@ -30,11 +30,29 @@ export declare const TYPST_WATCH_FAILED = "TYPST_WATCH_FAILED";
30
30
  export declare const TYPST_QUOTE_NOT_FOUND = "TYPST_QUOTE_NOT_FOUND";
31
31
  /** The Typst workbench service is not composed. */
32
32
  export declare const TYPST_NOT_COMPOSED = "TYPST_NOT_COMPOSED";
33
+ /** The attachment store is missing; rendered images cannot be returned. */
34
+ export declare const TYPST_ATTACHMENT_UNAVAILABLE = "TYPST_ATTACHMENT_UNAVAILABLE";
35
+ /** The document did not compile, so the requested output was not produced. */
36
+ export declare const TYPST_COMPILE_FAILED = "TYPST_COMPILE_FAILED";
37
+ /** The session's sandbox policy forbids writing the target. */
38
+ export declare const TYPST_SANDBOX_READ_ONLY = "TYPST_SANDBOX_READ_ONLY";
39
+ /** A granted writable root cannot be enforced: missing, not a directory, or a symlink. */
40
+ export declare const TYPST_SANDBOX_INVALID_ROOT = "TYPST_SANDBOX_INVALID_ROOT";
41
+ /** A requested page is outside the document or the render budget. */
42
+ export declare const TYPST_PAGE_OUT_OF_RANGE = "TYPST_PAGE_OUT_OF_RANGE";
43
+ /** The main file changed while a one-shot compile was in flight. */
44
+ export declare const TYPST_MAIN_CHANGED = "TYPST_MAIN_CHANGED";
45
+ /** The filesystem mtime is ahead of the host clock; the document cannot settle. */
46
+ export declare const TYPST_CLOCK_SKEW = "TYPST_CLOCK_SKEW";
47
+ /** The highlight target arguments are not exactly one valid target. */
48
+ export declare const TYPST_INVALID_TARGET = "TYPST_INVALID_TARGET";
49
+ /** A compile did not settle, so the answer cannot represent the new main file. */
50
+ export declare const TYPST_SETTLE_FAILED = "TYPST_SETTLE_FAILED";
33
51
  /** Something unexpected; the message carries the domain fact. */
34
52
  export declare const TYPST_UNEXPECTED = "TYPST_UNEXPECTED";
35
53
  /** The one message every "typst workbench is not composed" answer spells. */
36
54
  export declare const TYPST_NOT_COMPOSED_MESSAGE = "The Typst workbench service is not composed.";
37
- export declare const TYPST_ERROR_CODES: readonly ["TYPST_MISSING", "TYPST_TOO_OLD", "TYPST_UNUSABLE", "TYPST_NO_MAIN", "TYPST_NO_PREVIEW", "TYPST_NOT_FOUND", "TYPST_INVALID_ARGUMENT", "TYPST_PATH_OUTSIDE_WORKSPACE", "TYPST_TIMEOUT", "TYPST_WATCH_FAILED", "TYPST_QUOTE_NOT_FOUND", "TYPST_NOT_COMPOSED", "TYPST_UNEXPECTED"];
55
+ export declare const TYPST_ERROR_CODES: readonly ["TYPST_MISSING", "TYPST_TOO_OLD", "TYPST_UNUSABLE", "TYPST_NO_MAIN", "TYPST_NO_PREVIEW", "TYPST_NOT_FOUND", "TYPST_INVALID_ARGUMENT", "TYPST_PATH_OUTSIDE_WORKSPACE", "TYPST_TIMEOUT", "TYPST_WATCH_FAILED", "TYPST_QUOTE_NOT_FOUND", "TYPST_NOT_COMPOSED", "TYPST_ATTACHMENT_UNAVAILABLE", "TYPST_COMPILE_FAILED", "TYPST_SANDBOX_READ_ONLY", "TYPST_SANDBOX_INVALID_ROOT", "TYPST_PAGE_OUT_OF_RANGE", "TYPST_MAIN_CHANGED", "TYPST_CLOCK_SKEW", "TYPST_INVALID_TARGET", "TYPST_SETTLE_FAILED", "TYPST_UNEXPECTED"];
38
56
  /** Every stable error code a `TypstError` may carry. */
39
57
  export type TypstErrorCode = (typeof TYPST_ERROR_CODES)[number];
40
58
  /**
@@ -46,24 +64,48 @@ export declare class TypstError extends HarnessError {
46
64
  readonly code: TypstErrorCode;
47
65
  constructor(message: string, code: TypstErrorCode, options?: ErrorOptions);
48
66
  }
49
- /** The remote layer's one failure code (details carry the domain code). */
50
- export declare const TYPST_REMOTE_DOMAIN: "typst/domain";
51
67
  /**
52
- * Rethrow a domain failure across the Typert wire as the plugin's one
53
- * `typst/domain` code with the stable domain code in `details`. Consumers
54
- * discriminate by `details.code`, never by instanceof (the client never
55
- * sees these classes).
56
- * @param error - the thrown value.
57
- * @returns never; throws a `RemoteError` keyed `typst/domain`.
68
+ * The wire code each stable domain failure crosses the Typert boundary as.
69
+ * Typert's protocol reserves one `<domain>/<reason>` code per failure and
70
+ * discriminates `RemoteFailure` by that code; the details still carry the
71
+ * stable domain code so a handler that needs the finer domain fact can read
72
+ * it without matching message text.
58
73
  */
59
- export declare function rethrowRemote(error: unknown): never;
74
+ export declare const TYPST_REMOTE_CODES: {
75
+ readonly TYPST_MISSING: "typst/missing";
76
+ readonly TYPST_TOO_OLD: "typst/too-old";
77
+ readonly TYPST_UNUSABLE: "typst/unusable";
78
+ readonly TYPST_NO_MAIN: "typst/no-main";
79
+ readonly TYPST_NO_PREVIEW: "typst/no-preview";
80
+ readonly TYPST_NOT_FOUND: "typst/not-found";
81
+ readonly TYPST_INVALID_ARGUMENT: "typst/invalid-argument";
82
+ readonly TYPST_PATH_OUTSIDE_WORKSPACE: "typst/path-outside-workspace";
83
+ readonly TYPST_TIMEOUT: "typst/timeout";
84
+ readonly TYPST_WATCH_FAILED: "typst/watch-failed";
85
+ readonly TYPST_QUOTE_NOT_FOUND: "typst/quote-not-found";
86
+ readonly TYPST_NOT_COMPOSED: "typst/not-composed";
87
+ readonly TYPST_ATTACHMENT_UNAVAILABLE: "typst/attachment-unavailable";
88
+ readonly TYPST_COMPILE_FAILED: "typst/compile-failed";
89
+ readonly TYPST_SANDBOX_READ_ONLY: "typst/sandbox-read-only";
90
+ readonly TYPST_SANDBOX_INVALID_ROOT: "typst/sandbox-invalid-root";
91
+ readonly TYPST_PAGE_OUT_OF_RANGE: "typst/page-out-of-range";
92
+ readonly TYPST_MAIN_CHANGED: "typst/main-changed";
93
+ readonly TYPST_CLOCK_SKEW: "typst/clock-skew";
94
+ readonly TYPST_INVALID_TARGET: "typst/invalid-target";
95
+ readonly TYPST_SETTLE_FAILED: "typst/settle-failed";
96
+ readonly TYPST_UNEXPECTED: "typst/unexpected";
97
+ };
98
+ /** Every Typert Remote failure code this plugin may emit. */
99
+ export type TypstRemoteCode = (typeof TYPST_REMOTE_CODES)[TypstErrorCode];
60
100
  /**
61
- * Throw an argument error: the message is model-facing and names the
62
- * offending value.
63
- * @param message - the model-facing argument error text.
64
- * @throws {TypstError} `TYPST_INVALID_ARGUMENT`.
101
+ * Rethrow a domain failure across the Typert wire as its own
102
+ * `<domain>/<reason>` code, with the stable domain code in `details`.
103
+ * Consumers discriminate by `error.code`, never by instanceof (the client
104
+ * never sees these classes).
105
+ * @param error - the thrown value.
106
+ * @returns never; throws a `RemoteError` keyed `typst/<reason>`.
65
107
  */
66
- export declare function invalid(message: string): never;
108
+ export declare function rethrowRemote(error: unknown): never;
67
109
  /** Install guidance shown whenever Typst cannot be found. */
68
110
  export declare const INSTALL_HINT: string;
69
111
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,qEAAqE;AACrE,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,+DAA+D;AAC/D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,0EAA0E;AAC1E,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,4EAA4E;AAC5E,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,4DAA4D;AAC5D,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,qDAAqD;AACrD,eAAO,MAAM,4BAA4B,iCAAiC,CAAC;AAC3E,6DAA6D;AAC7D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,mDAAmD;AACnD,eAAO,MAAM,kBAAkB,uBA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iB,IAAI,EAAE,cAAc,CAAC;gBAE1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY;CAI1E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;CAuB+B,CAAC;AAE/D,6DAA6D;AAC7D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,cAAc,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAcnD;AAED,6DAA6D;AAC7D,eAAO,MAAM,YAAY,QAGwE,CAAC;AAElG;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMtE"}
package/lib/errors.js CHANGED
@@ -1,86 +1,161 @@
1
+ /**
2
+ * Stable error classes and codes for the Typst domain. Mirrors the
3
+ * dsh-zotero convention: `HarnessError` subclasses carry a machine-routable
4
+ * code on the host half; the remote layer re-arms them as `RemoteError`s
5
+ * keyed `<domain>/<reason>`, discriminated by code, never by instanceof.
6
+ * @module dsh-typst/errors
7
+ */
1
8
  import { HarnessError } from "@deepseek-ai/dsh-llm";
2
9
  import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
3
- const TYPST_MISSING = "TYPST_MISSING";
4
- const TYPST_TOO_OLD = "TYPST_TOO_OLD";
5
- const TYPST_UNUSABLE = "TYPST_UNUSABLE";
6
- const TYPST_NO_MAIN = "TYPST_NO_MAIN";
7
- const TYPST_NO_PREVIEW = "TYPST_NO_PREVIEW";
8
- const TYPST_NOT_FOUND = "TYPST_NOT_FOUND";
9
- const TYPST_INVALID_ARGUMENT = "TYPST_INVALID_ARGUMENT";
10
- const TYPST_PATH_OUTSIDE_WORKSPACE = "TYPST_PATH_OUTSIDE_WORKSPACE";
11
- const TYPST_TIMEOUT = "TYPST_TIMEOUT";
12
- const TYPST_WATCH_FAILED = "TYPST_WATCH_FAILED";
13
- const TYPST_QUOTE_NOT_FOUND = "TYPST_QUOTE_NOT_FOUND";
14
- const TYPST_NOT_COMPOSED = "TYPST_NOT_COMPOSED";
15
- const TYPST_UNEXPECTED = "TYPST_UNEXPECTED";
16
- const TYPST_NOT_COMPOSED_MESSAGE = "The Typst workbench service is not composed.";
17
- const TYPST_ERROR_CODES = [
18
- TYPST_MISSING,
19
- TYPST_TOO_OLD,
20
- TYPST_UNUSABLE,
21
- TYPST_NO_MAIN,
22
- TYPST_NO_PREVIEW,
23
- TYPST_NOT_FOUND,
24
- TYPST_INVALID_ARGUMENT,
25
- TYPST_PATH_OUTSIDE_WORKSPACE,
26
- TYPST_TIMEOUT,
27
- TYPST_WATCH_FAILED,
28
- TYPST_QUOTE_NOT_FOUND,
29
- TYPST_NOT_COMPOSED,
30
- TYPST_UNEXPECTED
10
+ /** Typst is not installed anywhere this computer's lookup covers. */
11
+ export const TYPST_MISSING = "TYPST_MISSING";
12
+ /** The installed Typst is older than the supported minimum. */
13
+ export const TYPST_TOO_OLD = "TYPST_TOO_OLD";
14
+ /** Typst exists but does not run (`--version` failed, broken install). */
15
+ export const TYPST_UNUSABLE = "TYPST_UNUSABLE";
16
+ /** No main `.typ` file is chosen and none could be picked automatically. */
17
+ export const TYPST_NO_MAIN = "TYPST_NO_MAIN";
18
+ /** The requested preview does not exist (nothing compiled successfully yet). */
19
+ export const TYPST_NO_PREVIEW = "TYPST_NO_PREVIEW";
20
+ /** A requested snapshot/page/highlight no longer exists. */
21
+ export const TYPST_NOT_FOUND = "TYPST_NOT_FOUND";
22
+ /** An argument the schemas cannot express violates a domain constraint. */
23
+ export const TYPST_INVALID_ARGUMENT = "TYPST_INVALID_ARGUMENT";
24
+ /** A path resolves outside the session workspace. */
25
+ export const TYPST_PATH_OUTSIDE_WORKSPACE = "TYPST_PATH_OUTSIDE_WORKSPACE";
26
+ /** The compile did not settle within the caller's budget. */
27
+ export const TYPST_TIMEOUT = "TYPST_TIMEOUT";
28
+ /** `typst watch` died or could not start. */
29
+ export const TYPST_WATCH_FAILED = "TYPST_WATCH_FAILED";
30
+ /** The requested quote/text was not found in the rendered preview. */
31
+ export const TYPST_QUOTE_NOT_FOUND = "TYPST_QUOTE_NOT_FOUND";
32
+ /** The Typst workbench service is not composed. */
33
+ export const TYPST_NOT_COMPOSED = "TYPST_NOT_COMPOSED";
34
+ /** The attachment store is missing; rendered images cannot be returned. */
35
+ export const TYPST_ATTACHMENT_UNAVAILABLE = "TYPST_ATTACHMENT_UNAVAILABLE";
36
+ /** The document did not compile, so the requested output was not produced. */
37
+ export const TYPST_COMPILE_FAILED = "TYPST_COMPILE_FAILED";
38
+ /** The session's sandbox policy forbids writing the target. */
39
+ export const TYPST_SANDBOX_READ_ONLY = "TYPST_SANDBOX_READ_ONLY";
40
+ /** A granted writable root cannot be enforced: missing, not a directory, or a symlink. */
41
+ export const TYPST_SANDBOX_INVALID_ROOT = "TYPST_SANDBOX_INVALID_ROOT";
42
+ /** A requested page is outside the document or the render budget. */
43
+ export const TYPST_PAGE_OUT_OF_RANGE = "TYPST_PAGE_OUT_OF_RANGE";
44
+ /** The main file changed while a one-shot compile was in flight. */
45
+ export const TYPST_MAIN_CHANGED = "TYPST_MAIN_CHANGED";
46
+ /** The filesystem mtime is ahead of the host clock; the document cannot settle. */
47
+ export const TYPST_CLOCK_SKEW = "TYPST_CLOCK_SKEW";
48
+ /** The highlight target arguments are not exactly one valid target. */
49
+ export const TYPST_INVALID_TARGET = "TYPST_INVALID_TARGET";
50
+ /** A compile did not settle, so the answer cannot represent the new main file. */
51
+ export const TYPST_SETTLE_FAILED = "TYPST_SETTLE_FAILED";
52
+ /** Something unexpected; the message carries the domain fact. */
53
+ export const TYPST_UNEXPECTED = "TYPST_UNEXPECTED";
54
+ /** The one message every "typst workbench is not composed" answer spells. */
55
+ export const TYPST_NOT_COMPOSED_MESSAGE = "The Typst workbench service is not composed.";
56
+ export const TYPST_ERROR_CODES = [
57
+ TYPST_MISSING,
58
+ TYPST_TOO_OLD,
59
+ TYPST_UNUSABLE,
60
+ TYPST_NO_MAIN,
61
+ TYPST_NO_PREVIEW,
62
+ TYPST_NOT_FOUND,
63
+ TYPST_INVALID_ARGUMENT,
64
+ TYPST_PATH_OUTSIDE_WORKSPACE,
65
+ TYPST_TIMEOUT,
66
+ TYPST_WATCH_FAILED,
67
+ TYPST_QUOTE_NOT_FOUND,
68
+ TYPST_NOT_COMPOSED,
69
+ TYPST_ATTACHMENT_UNAVAILABLE,
70
+ TYPST_COMPILE_FAILED,
71
+ TYPST_SANDBOX_READ_ONLY,
72
+ TYPST_SANDBOX_INVALID_ROOT,
73
+ TYPST_PAGE_OUT_OF_RANGE,
74
+ TYPST_MAIN_CHANGED,
75
+ TYPST_CLOCK_SKEW,
76
+ TYPST_INVALID_TARGET,
77
+ TYPST_SETTLE_FAILED,
78
+ TYPST_UNEXPECTED,
31
79
  ];
32
- class TypstError extends HarnessError {
33
- constructor(message, code, options) {
34
- super(message, code, options);
35
- this.name = "TypstError";
36
- }
37
- }
38
- const TYPST_REMOTE_DOMAIN = "typst/domain";
39
- function rethrowRemote(error) {
40
- if (error instanceof TypstError) {
41
- throw new RemoteError("typst/domain", error.message, { code: error.code });
42
- }
43
- if (error instanceof RemoteError) throw error;
44
- throw new RemoteError(
45
- "typst/domain",
46
- error instanceof Error ? error.message : String(error),
47
- {
48
- code: TYPST_UNEXPECTED
80
+ /**
81
+ * Domain failure with a stable machine-routable code and an actionable,
82
+ * model-facing message. The tool registry renders it as `Error: <message>`
83
+ * with `isError: true`.
84
+ */
85
+ export class TypstError extends HarnessError {
86
+ constructor(message, code, options) {
87
+ super(message, code, options);
88
+ this.name = "TypstError";
49
89
  }
50
- );
51
90
  }
52
- function invalid(message) {
53
- throw new TypstError(message, TYPST_INVALID_ARGUMENT);
91
+ /**
92
+ * The wire code each stable domain failure crosses the Typert boundary as.
93
+ * Typert's protocol reserves one `<domain>/<reason>` code per failure and
94
+ * discriminates `RemoteFailure` by that code; the details still carry the
95
+ * stable domain code so a handler that needs the finer domain fact can read
96
+ * it without matching message text.
97
+ */
98
+ export const TYPST_REMOTE_CODES = {
99
+ [TYPST_MISSING]: "typst/missing",
100
+ [TYPST_TOO_OLD]: "typst/too-old",
101
+ [TYPST_UNUSABLE]: "typst/unusable",
102
+ [TYPST_NO_MAIN]: "typst/no-main",
103
+ [TYPST_NO_PREVIEW]: "typst/no-preview",
104
+ [TYPST_NOT_FOUND]: "typst/not-found",
105
+ [TYPST_INVALID_ARGUMENT]: "typst/invalid-argument",
106
+ [TYPST_PATH_OUTSIDE_WORKSPACE]: "typst/path-outside-workspace",
107
+ [TYPST_TIMEOUT]: "typst/timeout",
108
+ [TYPST_WATCH_FAILED]: "typst/watch-failed",
109
+ [TYPST_QUOTE_NOT_FOUND]: "typst/quote-not-found",
110
+ [TYPST_NOT_COMPOSED]: "typst/not-composed",
111
+ [TYPST_ATTACHMENT_UNAVAILABLE]: "typst/attachment-unavailable",
112
+ [TYPST_COMPILE_FAILED]: "typst/compile-failed",
113
+ [TYPST_SANDBOX_READ_ONLY]: "typst/sandbox-read-only",
114
+ [TYPST_SANDBOX_INVALID_ROOT]: "typst/sandbox-invalid-root",
115
+ [TYPST_PAGE_OUT_OF_RANGE]: "typst/page-out-of-range",
116
+ [TYPST_MAIN_CHANGED]: "typst/main-changed",
117
+ [TYPST_CLOCK_SKEW]: "typst/clock-skew",
118
+ [TYPST_INVALID_TARGET]: "typst/invalid-target",
119
+ [TYPST_SETTLE_FAILED]: "typst/settle-failed",
120
+ [TYPST_UNEXPECTED]: "typst/unexpected",
121
+ };
122
+ /**
123
+ * Rethrow a domain failure across the Typert wire as its own
124
+ * `<domain>/<reason>` code, with the stable domain code in `details`.
125
+ * Consumers discriminate by `error.code`, never by instanceof (the client
126
+ * never sees these classes).
127
+ * @param error - the thrown value.
128
+ * @returns never; throws a `RemoteError` keyed `typst/<reason>`.
129
+ */
130
+ export function rethrowRemote(error) {
131
+ if (error instanceof TypstError) {
132
+ throw new RemoteError(TYPST_REMOTE_CODES[error.code], error.message, {
133
+ code: error.code,
134
+ });
135
+ }
136
+ if (error instanceof RemoteError)
137
+ throw error;
138
+ throw new RemoteError(TYPST_REMOTE_CODES[TYPST_UNEXPECTED], error instanceof Error ? error.message : String(error), {
139
+ code: TYPST_UNEXPECTED,
140
+ });
54
141
  }
55
- const INSTALL_HINT = 'Install Typst (for example `brew install typst`, `winget install --id Typst.Typst`, `cargo install --locked typst-cli`, or a release from https://github.com/typst/typst/releases), or set its path in the plugin setting "Typst path".';
56
- async function domainCall(call) {
57
- try {
58
- return await call();
59
- } catch (error) {
60
- rethrowRemote(error);
61
- }
142
+ /** Install guidance shown whenever Typst cannot be found. */
143
+ export const INSTALL_HINT = "Install Typst (for example `brew install typst`, `winget install --id Typst.Typst`, " +
144
+ "`cargo install --locked typst-cli`, or a release from " +
145
+ 'https://github.com/typst/typst/releases), or set its path in the plugin setting "Typst path".';
146
+ /**
147
+ * Wrap a domain call so every failure crosses the wire as a `RemoteError`
148
+ * with a stable `typst/<reason>` code (client remote calls never reject with
149
+ * anything else; they resolve `{ ok: false }`).
150
+ * @param call - the domain call.
151
+ * @returns the call's value.
152
+ */
153
+ export async function domainCall(call) {
154
+ try {
155
+ return await call();
156
+ }
157
+ catch (error) {
158
+ rethrowRemote(error);
159
+ }
62
160
  }
63
- export {
64
- INSTALL_HINT,
65
- TYPST_ERROR_CODES,
66
- TYPST_INVALID_ARGUMENT,
67
- TYPST_MISSING,
68
- TYPST_NOT_COMPOSED,
69
- TYPST_NOT_COMPOSED_MESSAGE,
70
- TYPST_NOT_FOUND,
71
- TYPST_NO_MAIN,
72
- TYPST_NO_PREVIEW,
73
- TYPST_PATH_OUTSIDE_WORKSPACE,
74
- TYPST_QUOTE_NOT_FOUND,
75
- TYPST_REMOTE_DOMAIN,
76
- TYPST_TIMEOUT,
77
- TYPST_TOO_OLD,
78
- TYPST_UNEXPECTED,
79
- TYPST_UNUSABLE,
80
- TYPST_WATCH_FAILED,
81
- TypstError,
82
- domainCall,
83
- invalid,
84
- rethrowRemote
85
- };
86
- //# sourceMappingURL=errors.js.map
161
+ //# sourceMappingURL=errors.js.map
package/lib/errors.js.map CHANGED
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/errors.ts"],
4
- "sourcesContent": ["/**\n * Stable error classes and codes for the Typst domain. Mirrors the\n * dsh-zotero convention: `HarnessError` subclasses carry a machine-routable\n * code on the host half; the remote layer re-arms them as `RemoteError`s\n * keyed `<domain>/<reason>`, discriminated by code, never by instanceof.\n * @module dsh-typst/errors\n */\n\nimport { HarnessError } from \"@deepseek-ai/dsh-llm\";\nimport { RemoteError } from \"@deepseek-ai/dsh-typert-protocol\";\n\n/** Typst is not installed anywhere this computer's lookup covers. */\nexport const TYPST_MISSING = \"TYPST_MISSING\";\n/** The installed Typst is older than the supported minimum. */\nexport const TYPST_TOO_OLD = \"TYPST_TOO_OLD\";\n/** Typst exists but does not run (`--version` failed, broken install). */\nexport const TYPST_UNUSABLE = \"TYPST_UNUSABLE\";\n/** No main `.typ` file is chosen and none could be picked automatically. */\nexport const TYPST_NO_MAIN = \"TYPST_NO_MAIN\";\n/** The requested preview does not exist (nothing compiled successfully yet). */\nexport const TYPST_NO_PREVIEW = \"TYPST_NO_PREVIEW\";\n/** A requested snapshot/page/highlight no longer exists. */\nexport const TYPST_NOT_FOUND = \"TYPST_NOT_FOUND\";\n/** An argument the schemas cannot express violates a domain constraint. */\nexport const TYPST_INVALID_ARGUMENT = \"TYPST_INVALID_ARGUMENT\";\n/** A path resolves outside the session workspace. */\nexport const TYPST_PATH_OUTSIDE_WORKSPACE = \"TYPST_PATH_OUTSIDE_WORKSPACE\";\n/** The compile did not settle within the caller's budget. */\nexport const TYPST_TIMEOUT = \"TYPST_TIMEOUT\";\n/** `typst watch` died or could not start. */\nexport const TYPST_WATCH_FAILED = \"TYPST_WATCH_FAILED\";\n/** The requested quote/text was not found in the rendered preview. */\nexport const TYPST_QUOTE_NOT_FOUND = \"TYPST_QUOTE_NOT_FOUND\";\n/** The Typst workbench service is not composed. */\nexport const TYPST_NOT_COMPOSED = \"TYPST_NOT_COMPOSED\";\n/** Something unexpected; the message carries the domain fact. */\nexport const TYPST_UNEXPECTED = \"TYPST_UNEXPECTED\";\n\n/** The one message every \"typst workbench is not composed\" answer spells. */\nexport const TYPST_NOT_COMPOSED_MESSAGE =\n \"The Typst workbench service is not composed.\";\n\nexport const TYPST_ERROR_CODES = [\n TYPST_MISSING,\n TYPST_TOO_OLD,\n TYPST_UNUSABLE,\n TYPST_NO_MAIN,\n TYPST_NO_PREVIEW,\n TYPST_NOT_FOUND,\n TYPST_INVALID_ARGUMENT,\n TYPST_PATH_OUTSIDE_WORKSPACE,\n TYPST_TIMEOUT,\n TYPST_WATCH_FAILED,\n TYPST_QUOTE_NOT_FOUND,\n TYPST_NOT_COMPOSED,\n TYPST_UNEXPECTED,\n] as const;\n\n/** Every stable error code a `TypstError` may carry. */\nexport type TypstErrorCode = (typeof TYPST_ERROR_CODES)[number];\n\n/**\n * Domain failure with a stable machine-routable code and an actionable,\n * model-facing message. The tool registry renders it as `Error: <message>`\n * with `isError: true`.\n */\nexport class TypstError extends HarnessError {\n declare readonly code: TypstErrorCode;\n\n constructor(message: string, code: TypstErrorCode, options?: ErrorOptions) {\n super(message, code, options);\n this.name = \"TypstError\";\n }\n}\n\n/** The remote layer's one failure code (details carry the domain code). */\nexport const TYPST_REMOTE_DOMAIN = \"typst/domain\" as const;\n\n/**\n * Rethrow a domain failure across the Typert wire as the plugin's one\n * `typst/domain` code with the stable domain code in `details`. Consumers\n * discriminate by `details.code`, never by instanceof (the client never\n * sees these classes).\n * @param error - the thrown value.\n * @returns never; throws a `RemoteError` keyed `typst/domain`.\n */\nexport function rethrowRemote(error: unknown): never {\n if (error instanceof TypstError) {\n throw new RemoteError(\"typst/domain\", error.message, { code: error.code });\n }\n if (error instanceof RemoteError) throw error;\n throw new RemoteError(\n \"typst/domain\",\n error instanceof Error ? error.message : String(error),\n {\n code: TYPST_UNEXPECTED,\n },\n );\n}\n\n/**\n * Throw an argument error: the message is model-facing and names the\n * offending value.\n * @param message - the model-facing argument error text.\n * @throws {TypstError} `TYPST_INVALID_ARGUMENT`.\n */\nexport function invalid(message: string): never {\n throw new TypstError(message, TYPST_INVALID_ARGUMENT);\n}\n\n/** Install guidance shown whenever Typst cannot be found. */\nexport const INSTALL_HINT =\n \"Install Typst (for example `brew install typst`, `winget install --id Typst.Typst`, \" +\n \"`cargo install --locked typst-cli`, or a release from \" +\n 'https://github.com/typst/typst/releases), or set its path in the plugin setting \"Typst path\".';\n\n/**\n * Wrap a domain call so every failure crosses the wire as a `RemoteError`\n * with a stable `typst/<reason>` code (client remote calls never reject with\n * anything else; they resolve `{ ok: false }`).\n * @param call - the domain call.\n * @returns the call's value.\n */\nexport async function domainCall<T>(call: () => Promise<T>): Promise<T> {\n try {\n return await call();\n } catch (error) {\n rethrowRemote(error);\n }\n}\n"],
5
- "mappings": "AAQA,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAGrB,MAAM,gBAAgB;AAEtB,MAAM,gBAAgB;AAEtB,MAAM,iBAAiB;AAEvB,MAAM,gBAAgB;AAEtB,MAAM,mBAAmB;AAEzB,MAAM,kBAAkB;AAExB,MAAM,yBAAyB;AAE/B,MAAM,+BAA+B;AAErC,MAAM,gBAAgB;AAEtB,MAAM,qBAAqB;AAE3B,MAAM,wBAAwB;AAE9B,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AAGzB,MAAM,6BACX;AAEK,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,MAAM,mBAAmB,aAAa;AAAA,EAG3C,YAAY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