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.
- package/README.en.md +86 -52
- package/README.md +93 -59
- package/cordis.patch.yml +1 -1
- package/docs/images/icon.png +0 -0
- package/lib/client.js +2088 -1136
- package/lib/client.js.map +4 -4
- package/lib/config.d.ts +66 -9
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +161 -25
- package/lib/config.js.map +1 -7
- package/lib/constants.d.ts +21 -2
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +83 -60
- package/lib/constants.js.map +1 -7
- package/lib/contract.d.ts +90 -6
- package/lib/contract.d.ts.map +1 -1
- package/lib/contract.js +9 -1
- package/lib/contract.js.map +1 -7
- package/lib/diagnostic-text.d.ts +13 -0
- package/lib/diagnostic-text.d.ts.map +1 -0
- package/lib/diagnostic-text.js +28 -0
- package/lib/diagnostic-text.js.map +1 -0
- package/lib/errors.d.ts +57 -15
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +154 -79
- package/lib/errors.js.map +1 -7
- package/lib/host/facts.d.ts.map +1 -1
- package/lib/host/facts.js +133 -139
- package/lib/host/facts.js.map +1 -7
- package/lib/host/which.d.ts +20 -0
- package/lib/host/which.d.ts.map +1 -0
- package/lib/host/which.js +50 -0
- package/lib/host/which.js.map +1 -0
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -7
- package/lib/remote.d.ts +5 -4
- package/lib/remote.d.ts.map +1 -1
- package/lib/remote.js +153 -143
- package/lib/remote.js.map +1 -7
- package/lib/service.d.ts +28 -4
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +202 -99
- package/lib/service.js.map +1 -7
- package/lib/skills/typst.js +74 -68
- package/lib/skills/typst.js.map +1 -7
- package/lib/status-codec.js +10 -5
- package/lib/status-codec.js.map +1 -7
- package/lib/tools/registration.d.ts +4 -3
- package/lib/tools/registration.d.ts.map +1 -1
- package/lib/tools/registration.js +726 -493
- package/lib/tools/registration.js.map +1 -7
- package/lib/tools/shared.d.ts +4 -5
- package/lib/tools/shared.d.ts.map +1 -1
- package/lib/tools/shared.js +73 -64
- package/lib/tools/shared.js.map +1 -7
- package/lib/typert.d.ts +5 -3
- package/lib/typert.d.ts.map +1 -1
- package/lib/typert.js +113 -64
- package/lib/typert.js.map +1 -7
- package/lib/typst/diagnostics.d.ts.map +1 -1
- package/lib/typst/diagnostics.js +218 -152
- package/lib/typst/diagnostics.js.map +1 -7
- package/lib/typst/flags.d.ts +8 -0
- package/lib/typst/flags.d.ts.map +1 -0
- package/lib/typst/flags.js +8 -0
- package/lib/typst/flags.js.map +1 -0
- package/lib/typst/locate.d.ts +6 -13
- package/lib/typst/locate.d.ts.map +1 -1
- package/lib/typst/locate.js +138 -180
- package/lib/typst/locate.js.map +1 -7
- package/lib/typst/mainfile.d.ts +23 -4
- package/lib/typst/mainfile.d.ts.map +1 -1
- package/lib/typst/mainfile.js +131 -59
- package/lib/typst/mainfile.js.map +1 -7
- package/lib/typst/match.d.ts +9 -1
- package/lib/typst/match.d.ts.map +1 -1
- package/lib/typst/match.js +213 -157
- package/lib/typst/match.js.map +1 -7
- package/lib/typst/oneshot.d.ts +8 -5
- package/lib/typst/oneshot.d.ts.map +1 -1
- package/lib/typst/oneshot.js +76 -66
- package/lib/typst/oneshot.js.map +1 -7
- package/lib/typst/owners.d.ts +28 -0
- package/lib/typst/owners.d.ts.map +1 -0
- package/lib/typst/owners.js +98 -0
- package/lib/typst/owners.js.map +1 -0
- package/lib/typst/pdf-extract.d.ts +1 -2
- package/lib/typst/pdf-extract.d.ts.map +1 -1
- package/lib/typst/pdf-extract.js +98 -74
- package/lib/typst/pdf-extract.js.map +1 -7
- package/lib/typst/process.d.ts +73 -0
- package/lib/typst/process.d.ts.map +1 -0
- package/lib/typst/process.js +147 -0
- package/lib/typst/process.js.map +1 -0
- package/lib/typst/text.d.ts +4 -7
- package/lib/typst/text.d.ts.map +1 -1
- package/lib/typst/text.js +258 -290
- package/lib/typst/text.js.map +1 -7
- package/lib/typst/watcher.d.ts +16 -17
- package/lib/typst/watcher.d.ts.map +1 -1
- package/lib/typst/watcher.js +199 -208
- package/lib/typst/watcher.js.map +1 -7
- package/lib/wire-schemas.d.ts +8 -153
- package/lib/wire-schemas.d.ts.map +1 -1
- package/lib/wire-schemas.js +405 -361
- package/lib/wire-schemas.js.map +1 -7
- package/lib/workspace/containment.d.ts +25 -0
- package/lib/workspace/containment.d.ts.map +1 -0
- package/lib/workspace/containment.js +54 -0
- package/lib/workspace/containment.js.map +1 -0
- package/lib/workspace/session.d.ts +73 -14
- package/lib/workspace/session.d.ts.map +1 -1
- package/lib/workspace/session.js +1516 -1172
- package/lib/workspace/session.js.map +1 -7
- package/locale/en.json +8 -2
- package/locale/zh.json +8 -2
- package/package.json +36 -179
- package/release-provenance.json +137 -0
- package/lib/typst/pdfjs-worker.d.js +0 -1
- package/lib/typst/pdfjs-worker.d.js.map +0 -7
package/lib/wire-schemas.js
CHANGED
|
@@ -1,384 +1,428 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire boundary's single source: every zod schema the `typst` namespace
|
|
3
|
+
* validates with, and the one shared invocation list both halves register.
|
|
4
|
+
* `TYPST_INVOCATIONS` materializes each schema once through `strictCodec()`;
|
|
5
|
+
* the host manifest aliases it in `src/status-codec.ts` and the browser face
|
|
6
|
+
* aliases it in `src/client/status-codec.ts`. Neither half imports the
|
|
7
|
+
* other's module or builds its own descriptor list, so the two sides cannot
|
|
8
|
+
* disagree about a boundary.
|
|
9
|
+
*
|
|
10
|
+
* Client-safe: its imports are `zod`, the contract's own types, and the
|
|
11
|
+
* runtime constants module, all of which
|
|
12
|
+
* `scripts/client-graph-authority.mjs` allowlists.
|
|
13
|
+
* @module dsh-typst/wire-schemas
|
|
14
|
+
*/
|
|
1
15
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
import { TYPST_LOCATE_SOURCE_METHOD, TYPST_READ_PREVIEW_METHOD, TYPST_REMOTE_PACKAGE, TYPST_SCOPE_WIRE_SYMBOL, TYPST_SET_MAIN_METHOD, TYPST_STATUS_METHOD, TYPST_STATUS_SERVICE_KEY, TYPST_SETTINGS_NAMESPACE, TYPST_WATCH_METHOD, } from "./constants.js";
|
|
17
|
+
/**
|
|
18
|
+
* Wrap a wire schema in the strict codec arm Typert expects. The strict arm
|
|
19
|
+
* is exactly `{ mode, typeSymbol, create }` (plus optional `encode`/`decode`
|
|
20
|
+
* for byte-carrying results, which the preview result adds), so no live
|
|
21
|
+
* schema property is carried and `create()` materializes on first use.
|
|
22
|
+
* @param typeSymbol - the boundary type identity the manifest declares.
|
|
23
|
+
* @param schema - the shared wire schema both halves validate through.
|
|
24
|
+
* @returns the strict codec arm.
|
|
25
|
+
*/
|
|
26
|
+
export function strictCodec(typeSymbol, schema) {
|
|
27
|
+
return { mode: "strict", typeSymbol, create: () => schema };
|
|
13
28
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
state: z.literal("
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
/** The boundary symbol of a type this package owns. */
|
|
30
|
+
function typstTypeSymbol(name) {
|
|
31
|
+
return `${TYPST_REMOTE_PACKAGE}#${name}`;
|
|
32
|
+
}
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Schemas
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
export const typstSourceSchema = z.enum(["setting", "path", "common", "shell"]);
|
|
37
|
+
export const toolchainSchema = z.discriminatedUnion("state", [
|
|
38
|
+
z
|
|
39
|
+
.object({
|
|
40
|
+
state: z.literal("ready"),
|
|
41
|
+
version: z.string(),
|
|
42
|
+
path: z.string(),
|
|
43
|
+
source: typstSourceSchema,
|
|
44
|
+
})
|
|
45
|
+
.strict(),
|
|
46
|
+
z.object({ state: z.literal("missing") }).strict(),
|
|
47
|
+
z
|
|
48
|
+
.object({
|
|
49
|
+
state: z.literal("too_old"),
|
|
50
|
+
version: z.string(),
|
|
51
|
+
path: z.string(),
|
|
52
|
+
source: typstSourceSchema,
|
|
53
|
+
error: z.string(),
|
|
54
|
+
})
|
|
55
|
+
.strict(),
|
|
56
|
+
z
|
|
57
|
+
.object({
|
|
58
|
+
state: z.literal("error"),
|
|
59
|
+
path: z.string().optional(),
|
|
60
|
+
source: typstSourceSchema.optional(),
|
|
61
|
+
error: z.string(),
|
|
62
|
+
})
|
|
63
|
+
.strict(),
|
|
36
64
|
]);
|
|
37
|
-
const diagnosticLocationSchema = z
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
export const diagnosticLocationSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
file: z.string(),
|
|
68
|
+
line: z.number().int(),
|
|
69
|
+
column: z.number().int(),
|
|
70
|
+
})
|
|
71
|
+
.strict();
|
|
72
|
+
export const diagnosticPointSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
message: z.string(),
|
|
75
|
+
location: diagnosticLocationSchema.nullable(),
|
|
76
|
+
})
|
|
77
|
+
.strict();
|
|
78
|
+
export const diagnosticSchema = z
|
|
79
|
+
.object({
|
|
80
|
+
severity: z.enum(["error", "warning"]),
|
|
81
|
+
message: z.string(),
|
|
82
|
+
location: diagnosticLocationSchema.nullable(),
|
|
83
|
+
excerpt: z.string().optional(),
|
|
84
|
+
hints: z.array(z.string()),
|
|
85
|
+
trace: z.array(diagnosticPointSchema),
|
|
86
|
+
})
|
|
87
|
+
.strict();
|
|
88
|
+
export const compilePhaseSchema = z.enum([
|
|
89
|
+
"idle",
|
|
90
|
+
"starting",
|
|
91
|
+
"compiling",
|
|
92
|
+
"ok",
|
|
93
|
+
"warnings",
|
|
94
|
+
"error",
|
|
95
|
+
"crashed",
|
|
62
96
|
]);
|
|
63
|
-
const statusSchema = z
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
createdAt: z.number()
|
|
101
|
-
}).strict();
|
|
102
|
-
const panelViewSchema = z.discriminatedUnion("kind", [
|
|
103
|
-
z.object({
|
|
104
|
-
kind: z.literal("page"),
|
|
105
|
-
pageIndex: z.number().int(),
|
|
106
|
-
identity: previewIdentitySchema
|
|
107
|
-
}).strict(),
|
|
108
|
-
z.object({
|
|
109
|
-
kind: z.literal("highlight"),
|
|
97
|
+
export const statusSchema = z
|
|
98
|
+
.object({
|
|
99
|
+
phase: compilePhaseSchema,
|
|
100
|
+
run: z.number().int(),
|
|
101
|
+
durationMs: z.number().optional(),
|
|
102
|
+
error: z.string().optional(),
|
|
103
|
+
finishedAt: z.number().optional(),
|
|
104
|
+
})
|
|
105
|
+
.strict();
|
|
106
|
+
export const previewIdentitySchema = z
|
|
107
|
+
.object({
|
|
108
|
+
generation: z.number().int(),
|
|
109
|
+
seq: z.number().int(),
|
|
110
|
+
sha256: z.string(),
|
|
111
|
+
})
|
|
112
|
+
.strict();
|
|
113
|
+
export const snapshotSchema = z
|
|
114
|
+
.object({
|
|
115
|
+
generation: z.number().int(),
|
|
116
|
+
main: z.string(),
|
|
117
|
+
run: z.number().int(),
|
|
118
|
+
seq: z.number().int(),
|
|
119
|
+
bytes: z.number().int(),
|
|
120
|
+
pages: z.number().int(),
|
|
121
|
+
sha256: z.string(),
|
|
122
|
+
createdAt: z.number(),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
export const sourceRefSchema = z
|
|
126
|
+
.object({
|
|
127
|
+
file: z.string(),
|
|
128
|
+
line: z.number().int(),
|
|
129
|
+
endLine: z.number().int(),
|
|
130
|
+
})
|
|
131
|
+
.strict();
|
|
132
|
+
export const highlightSchema = z
|
|
133
|
+
.object({
|
|
110
134
|
id: z.string(),
|
|
111
|
-
identity: previewIdentitySchema
|
|
112
|
-
|
|
135
|
+
identity: previewIdentitySchema,
|
|
136
|
+
quote: z.string(),
|
|
137
|
+
comment: z.string(),
|
|
138
|
+
source: sourceRefSchema.optional(),
|
|
139
|
+
seq: z.number().int(),
|
|
140
|
+
pageIndex: z.number().int(),
|
|
141
|
+
startOffset: z.number().int().optional(),
|
|
142
|
+
occurrence: z.number().int().optional(),
|
|
143
|
+
rects: z.array(z.array(z.number())),
|
|
144
|
+
stale: z.boolean(),
|
|
145
|
+
createdAt: z.number(),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
export const panelViewSchema = z.discriminatedUnion("kind", [
|
|
149
|
+
z
|
|
150
|
+
.object({
|
|
151
|
+
kind: z.literal("page"),
|
|
152
|
+
pageIndex: z.number().int(),
|
|
153
|
+
identity: previewIdentitySchema,
|
|
154
|
+
})
|
|
155
|
+
.strict(),
|
|
156
|
+
z
|
|
157
|
+
.object({
|
|
158
|
+
kind: z.literal("highlight"),
|
|
159
|
+
id: z.string(),
|
|
160
|
+
identity: previewIdentitySchema,
|
|
161
|
+
})
|
|
162
|
+
.strict(),
|
|
113
163
|
]);
|
|
114
|
-
const packageManagerSchema = z
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
export const packageManagerSchema = z
|
|
165
|
+
.object({
|
|
166
|
+
name: z.string(),
|
|
167
|
+
version: z.string().optional(),
|
|
168
|
+
path: z.string(),
|
|
169
|
+
})
|
|
170
|
+
.strict();
|
|
171
|
+
export const hostFactsSchema = z
|
|
172
|
+
.object({
|
|
173
|
+
os: z.enum(["macos", "windows", "linux", "other"]),
|
|
174
|
+
osName: z.string(),
|
|
175
|
+
arch: z.string(),
|
|
176
|
+
tools: z.array(packageManagerSchema),
|
|
177
|
+
})
|
|
178
|
+
.strict();
|
|
179
|
+
export const setupSchema = z
|
|
180
|
+
.object({
|
|
181
|
+
facts: hostFactsSchema.nullable(),
|
|
182
|
+
searched: z.array(z.string()),
|
|
183
|
+
})
|
|
184
|
+
.strict();
|
|
185
|
+
export const typstStateFrameSchema = z
|
|
186
|
+
.object({
|
|
187
|
+
version: z.number().int(),
|
|
188
|
+
generation: z.number().int(),
|
|
189
|
+
previewError: z.string().nullable(),
|
|
190
|
+
discovery: z
|
|
191
|
+
.object({
|
|
192
|
+
scanning: z.boolean(),
|
|
193
|
+
includeExcluded: z.boolean(),
|
|
194
|
+
visited: z.number().int(),
|
|
195
|
+
errors: z.array(z.string()),
|
|
196
|
+
})
|
|
197
|
+
.strict(),
|
|
198
|
+
toolchain: toolchainSchema,
|
|
199
|
+
workspace: z.string(),
|
|
200
|
+
workspaceRoot: z.string(),
|
|
201
|
+
main: z.string().nullable(),
|
|
202
|
+
candidates: z.array(z.string()),
|
|
203
|
+
fragments: z.array(z.string()),
|
|
204
|
+
status: statusSchema,
|
|
205
|
+
diagnostics: z.array(diagnosticSchema),
|
|
206
|
+
diagnosticsTotal: z.number().int(),
|
|
207
|
+
diagnosticsTruncated: z.boolean(),
|
|
208
|
+
snapshot: snapshotSchema.nullable(),
|
|
209
|
+
highlights: z.array(highlightSchema),
|
|
210
|
+
view: z.union([panelViewSchema, z.null()]),
|
|
211
|
+
viewSeq: z.number().int(),
|
|
212
|
+
setup: setupSchema,
|
|
213
|
+
})
|
|
214
|
+
.strict();
|
|
215
|
+
export const setMainResultSchema = z.object({ main: z.string() }).strict();
|
|
216
|
+
export const sourceMatchSchema = z
|
|
217
|
+
.object({
|
|
218
|
+
file: z.string(),
|
|
219
|
+
line: z.number().int(),
|
|
220
|
+
column: z.number().int(),
|
|
221
|
+
endLine: z.number().int(),
|
|
222
|
+
excerpt: z.string(),
|
|
223
|
+
score: z.number(),
|
|
224
|
+
})
|
|
225
|
+
.strict();
|
|
226
|
+
export const locateSourceResultSchema = z
|
|
227
|
+
.object({ matches: z.array(sourceMatchSchema) })
|
|
228
|
+
.strict();
|
|
229
|
+
export const previewBytesSchema = z
|
|
230
|
+
.object({
|
|
231
|
+
generation: z.number().int(),
|
|
232
|
+
seq: z.number().int(),
|
|
233
|
+
sha256: z.string(),
|
|
234
|
+
data: z.instanceof(Uint8Array),
|
|
235
|
+
})
|
|
236
|
+
.strict();
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// Invocation descriptors
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
169
240
|
const SERVICE = TYPST_STATUS_SERVICE_KEY;
|
|
170
241
|
const NAMESPACE = TYPST_SETTINGS_NAMESPACE;
|
|
242
|
+
/** One strict result codec keyed to the manifest's declared symbol. */
|
|
171
243
|
function resultCodec(typeSymbol, schema) {
|
|
172
|
-
|
|
244
|
+
return strictCodec(typeSymbol, schema);
|
|
173
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Strict result codec that projects one typed binary field into the RPC's
|
|
248
|
+
* byte attachments: the preview PDF never rides JSON as base64.
|
|
249
|
+
*/
|
|
174
250
|
function bytesCodec(typeSymbol, schema, byteField) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
251
|
+
return {
|
|
252
|
+
mode: "strict",
|
|
253
|
+
typeSymbol,
|
|
254
|
+
create: () => schema,
|
|
255
|
+
encode: (value, writeBytes) => {
|
|
256
|
+
const record = value;
|
|
257
|
+
const { [byteField]: data, ...rest } = record;
|
|
258
|
+
return {
|
|
259
|
+
...rest,
|
|
260
|
+
[byteField]: writeBytes(data, [byteField]),
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
decode: (value) => schema.parse(value),
|
|
264
|
+
};
|
|
188
265
|
}
|
|
266
|
+
/** The scope lookup parameter every endpoint takes (registered by the service). */
|
|
189
267
|
function scopeParameter() {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
268
|
+
return {
|
|
269
|
+
name: "typstScope",
|
|
270
|
+
wire: "typstScopeId",
|
|
271
|
+
source: "lookup",
|
|
272
|
+
lookup: "typstScope",
|
|
273
|
+
codec: strictCodec(TYPST_SCOPE_WIRE_SYMBOL, z.string()),
|
|
274
|
+
};
|
|
197
275
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
result: stateFrameCodec
|
|
276
|
+
/** The typst state frame result codec, shared by `status`, `watch`, and `recheck`. */
|
|
277
|
+
export const stateFrameCodec = resultCodec(typstTypeSymbol("TypstStateFrame"), typstStateFrameSchema);
|
|
278
|
+
/** `status`: the current state frame, first push of the panel's data. */
|
|
279
|
+
export const typstStatusInvocation = {
|
|
280
|
+
id: "dsh-typst/status",
|
|
281
|
+
service: SERVICE,
|
|
282
|
+
namespace: NAMESPACE,
|
|
283
|
+
method: TYPST_STATUS_METHOD,
|
|
284
|
+
invocation: { kind: "direct" },
|
|
285
|
+
cancellation: { parameter: "signal" },
|
|
286
|
+
parameters: [scopeParameter()],
|
|
287
|
+
result: stateFrameCodec,
|
|
211
288
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
],
|
|
231
|
-
result: resultCodec(
|
|
232
|
-
"@deepseek-ai/dsh-typst/types#SetMainResult",
|
|
233
|
-
setMainResultSchema
|
|
234
|
-
)
|
|
289
|
+
/** `setMain`: choose the main `.typ` file; the frame updates follow on the stream. */
|
|
290
|
+
export const typstSetMainInvocation = {
|
|
291
|
+
id: "dsh-typst/setMain",
|
|
292
|
+
service: SERVICE,
|
|
293
|
+
namespace: NAMESPACE,
|
|
294
|
+
method: TYPST_SET_MAIN_METHOD,
|
|
295
|
+
invocation: { kind: "direct" },
|
|
296
|
+
cancellation: { parameter: "signal" },
|
|
297
|
+
parameters: [
|
|
298
|
+
scopeParameter(),
|
|
299
|
+
{
|
|
300
|
+
name: "path",
|
|
301
|
+
wire: "path",
|
|
302
|
+
source: "json",
|
|
303
|
+
codec: strictCodec(typstTypeSymbol("typst/setMain:path"), z.string().min(1).max(1024)),
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
result: resultCodec(typstTypeSymbol("typst/setMain:result"), setMainResultSchema),
|
|
235
307
|
};
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
308
|
+
/**
|
|
309
|
+
* `watch`: the live state stream. `mode: 'stream'`: the first yielded frame
|
|
310
|
+
* is the current state, one frame follows every relevant change.
|
|
311
|
+
*/
|
|
312
|
+
export const typstWatchInvocation = {
|
|
313
|
+
id: "dsh-typst/watch",
|
|
314
|
+
service: SERVICE,
|
|
315
|
+
namespace: NAMESPACE,
|
|
316
|
+
method: TYPST_WATCH_METHOD,
|
|
317
|
+
mode: "stream",
|
|
318
|
+
invocation: { kind: "direct" },
|
|
319
|
+
cancellation: { parameter: "signal" },
|
|
320
|
+
parameters: [scopeParameter()],
|
|
321
|
+
result: stateFrameCodec,
|
|
246
322
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
323
|
+
/**
|
|
324
|
+
* `readPreview`: the current preview PDF's bytes. The strict codec projects
|
|
325
|
+
* the `data` field into the RPC's byte attachments on the wire.
|
|
326
|
+
*/
|
|
327
|
+
export const typstReadPreviewInvocation = {
|
|
328
|
+
id: "dsh-typst/readPreview",
|
|
329
|
+
service: SERVICE,
|
|
330
|
+
namespace: NAMESPACE,
|
|
331
|
+
method: TYPST_READ_PREVIEW_METHOD,
|
|
332
|
+
invocation: { kind: "direct" },
|
|
333
|
+
cancellation: { parameter: "signal" },
|
|
334
|
+
parameters: [
|
|
335
|
+
scopeParameter(),
|
|
336
|
+
{
|
|
337
|
+
name: "identity",
|
|
338
|
+
wire: "identity",
|
|
339
|
+
source: "json",
|
|
340
|
+
codec: strictCodec(typstTypeSymbol("PreviewIdentity"), previewIdentitySchema),
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
result: bytesCodec(typstTypeSymbol("PreviewBytes"), previewBytesSchema, "data"),
|
|
268
344
|
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
z.string().min(1).max(2e4).nullable()
|
|
294
|
-
)
|
|
295
|
-
}
|
|
296
|
-
],
|
|
297
|
-
result: resultCodec(
|
|
298
|
-
"@deepseek-ai/dsh-typst/types#LocateSourceResult",
|
|
299
|
-
locateSourceResultSchema
|
|
300
|
-
)
|
|
345
|
+
/** `locateSource`: match rendered text against the workspace's sources. */
|
|
346
|
+
export const typstLocateSourceInvocation = {
|
|
347
|
+
id: "dsh-typst/locateSource",
|
|
348
|
+
service: SERVICE,
|
|
349
|
+
namespace: NAMESPACE,
|
|
350
|
+
method: TYPST_LOCATE_SOURCE_METHOD,
|
|
351
|
+
invocation: { kind: "direct" },
|
|
352
|
+
cancellation: { parameter: "signal" },
|
|
353
|
+
parameters: [
|
|
354
|
+
scopeParameter(),
|
|
355
|
+
{
|
|
356
|
+
name: "text",
|
|
357
|
+
wire: "text",
|
|
358
|
+
source: "json",
|
|
359
|
+
codec: strictCodec(typstTypeSymbol("typst/locateSource:text"), z.string().min(1).max(20_000)),
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: "focus",
|
|
363
|
+
wire: "focus",
|
|
364
|
+
source: "json",
|
|
365
|
+
codec: strictCodec(typstTypeSymbol("typst/locateSource:focus"), z.string().min(1).max(20_000).nullable()),
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
result: resultCodec(typstTypeSymbol("typst/locateSource:result"), locateSourceResultSchema),
|
|
301
369
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
370
|
+
/** `recheck`: look Typst up again (the setup page's refresh), returning the new frame. */
|
|
371
|
+
export const typstRecheckInvocation = {
|
|
372
|
+
id: "dsh-typst/recheck",
|
|
373
|
+
service: SERVICE,
|
|
374
|
+
namespace: NAMESPACE,
|
|
375
|
+
method: "recheck",
|
|
376
|
+
invocation: { kind: "direct" },
|
|
377
|
+
cancellation: { parameter: "signal" },
|
|
378
|
+
parameters: [scopeParameter()],
|
|
379
|
+
result: stateFrameCodec,
|
|
311
380
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
381
|
+
/** `restart`: stop the watch, relocate typst, rescan, restart (the panel's restart button). */
|
|
382
|
+
export const typstRestartInvocation = {
|
|
383
|
+
id: "dsh-typst/restart",
|
|
384
|
+
service: SERVICE,
|
|
385
|
+
namespace: NAMESPACE,
|
|
386
|
+
method: "restart",
|
|
387
|
+
invocation: { kind: "direct" },
|
|
388
|
+
cancellation: { parameter: "signal" },
|
|
389
|
+
parameters: [scopeParameter()],
|
|
390
|
+
result: stateFrameCodec,
|
|
321
391
|
};
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
392
|
+
/** Explicit index refresh; the stream reports incremental progress. */
|
|
393
|
+
export const typstDiscoverInvocation = {
|
|
394
|
+
id: "dsh-typst/discover",
|
|
395
|
+
service: SERVICE,
|
|
396
|
+
namespace: NAMESPACE,
|
|
397
|
+
method: "discover",
|
|
398
|
+
invocation: { kind: "direct" },
|
|
399
|
+
cancellation: { parameter: "signal" },
|
|
400
|
+
parameters: [
|
|
401
|
+
scopeParameter(),
|
|
402
|
+
{
|
|
403
|
+
name: "includeExcluded",
|
|
404
|
+
wire: "includeExcluded",
|
|
405
|
+
source: "json",
|
|
406
|
+
codec: strictCodec(typstTypeSymbol("typst/discover:includeExcluded"), z.boolean()),
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
result: resultCodec(typstTypeSymbol("typst/discover:result"), z
|
|
410
|
+
.object({
|
|
411
|
+
candidates: z.number().int(),
|
|
412
|
+
includeExcluded: z.boolean(),
|
|
413
|
+
errors: z.array(z.string()),
|
|
414
|
+
})
|
|
415
|
+
.strict()),
|
|
339
416
|
};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
417
|
+
/** Both halves register exactly this list. */
|
|
418
|
+
export const TYPST_INVOCATIONS = [
|
|
419
|
+
typstStatusInvocation,
|
|
420
|
+
typstSetMainInvocation,
|
|
421
|
+
typstWatchInvocation,
|
|
422
|
+
typstReadPreviewInvocation,
|
|
423
|
+
typstLocateSourceInvocation,
|
|
424
|
+
typstRecheckInvocation,
|
|
425
|
+
typstRestartInvocation,
|
|
426
|
+
typstDiscoverInvocation,
|
|
349
427
|
];
|
|
350
|
-
|
|
351
|
-
TYPST_INVOCATIONS,
|
|
352
|
-
compilePhaseSchema,
|
|
353
|
-
diagnosticLocationSchema,
|
|
354
|
-
diagnosticPointSchema,
|
|
355
|
-
diagnosticSchema,
|
|
356
|
-
highlightSchema,
|
|
357
|
-
hostFactsSchema,
|
|
358
|
-
locateSourceResultSchema,
|
|
359
|
-
packageManagerSchema,
|
|
360
|
-
panelViewSchema,
|
|
361
|
-
previewBytesSchema,
|
|
362
|
-
previewIdentitySchema,
|
|
363
|
-
recheckResultSchema,
|
|
364
|
-
setMainResultSchema,
|
|
365
|
-
setupSchema,
|
|
366
|
-
snapshotSchema,
|
|
367
|
-
sourceMatchSchema,
|
|
368
|
-
sourceRefSchema,
|
|
369
|
-
stateFrameCodec,
|
|
370
|
-
statusSchema,
|
|
371
|
-
strictCodec,
|
|
372
|
-
toolchainSchema,
|
|
373
|
-
typstDiscoverInvocation,
|
|
374
|
-
typstLocateSourceInvocation,
|
|
375
|
-
typstReadPreviewInvocation,
|
|
376
|
-
typstRecheckInvocation,
|
|
377
|
-
typstRestartInvocation,
|
|
378
|
-
typstSetMainInvocation,
|
|
379
|
-
typstSourceSchema,
|
|
380
|
-
typstStateFrameSchema,
|
|
381
|
-
typstStatusInvocation,
|
|
382
|
-
typstWatchInvocation
|
|
383
|
-
};
|
|
384
|
-
//# sourceMappingURL=wire-schemas.js.map
|
|
428
|
+
//# sourceMappingURL=wire-schemas.js.map
|