dsh-typst-plugin 0.0.0-stage → 0.1.0-alpha.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/LICENSE +21 -0
- package/README.en.md +87 -0
- package/README.md +86 -2
- package/cordis.patch.yml +6 -0
- package/docs/images/icon.png +0 -0
- package/docs/plugin-detail.en.md +2 -0
- package/docs/plugin-detail.md +2 -0
- package/lib/client.js +41044 -0
- package/lib/client.js.map +7 -0
- package/lib/config.d.ts +50 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +31 -0
- package/lib/config.js.map +7 -0
- package/lib/constants.d.ts +58 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +62 -0
- package/lib/constants.js.map +7 -0
- package/lib/contract.d.ts +179 -0
- package/lib/contract.d.ts.map +1 -0
- package/lib/contract.js +1 -0
- package/lib/contract.js.map +7 -0
- package/lib/errors.d.ts +77 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +86 -0
- package/lib/errors.js.map +7 -0
- package/lib/host/facts.d.ts +31 -0
- package/lib/host/facts.d.ts.map +1 -0
- package/lib/host/facts.js +151 -0
- package/lib/host/facts.js.map +7 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +7 -0
- package/lib/remote.d.ts +69 -0
- package/lib/remote.d.ts.map +1 -0
- package/lib/remote.js +146 -0
- package/lib/remote.js.map +7 -0
- package/lib/service.d.ts +47 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +110 -0
- package/lib/service.js.map +7 -0
- package/lib/skills/typst.d.ts +13 -0
- package/lib/skills/typst.d.ts.map +1 -0
- package/lib/skills/typst.js +72 -0
- package/lib/skills/typst.js.map +7 -0
- package/lib/status-codec.d.ts +11 -0
- package/lib/status-codec.d.ts.map +1 -0
- package/lib/status-codec.js +6 -0
- package/lib/status-codec.js.map +7 -0
- package/lib/tools/registration.d.ts +22 -0
- package/lib/tools/registration.d.ts.map +1 -0
- package/lib/tools/registration.js +525 -0
- package/lib/tools/registration.js.map +7 -0
- package/lib/tools/shared.d.ts +31 -0
- package/lib/tools/shared.d.ts.map +1 -0
- package/lib/tools/shared.js +70 -0
- package/lib/tools/shared.js.map +7 -0
- package/lib/typert.d.ts +23 -0
- package/lib/typert.d.ts.map +1 -0
- package/lib/typert.js +67 -0
- package/lib/typert.js.map +7 -0
- package/lib/typst/diagnostics.d.ts +58 -0
- package/lib/typst/diagnostics.d.ts.map +1 -0
- package/lib/typst/diagnostics.js +171 -0
- package/lib/typst/diagnostics.js.map +7 -0
- package/lib/typst/locate.d.ts +68 -0
- package/lib/typst/locate.d.ts.map +1 -0
- package/lib/typst/locate.js +194 -0
- package/lib/typst/locate.js.map +7 -0
- package/lib/typst/mainfile.d.ts +21 -0
- package/lib/typst/mainfile.d.ts.map +1 -0
- package/lib/typst/mainfile.js +64 -0
- package/lib/typst/mainfile.js.map +7 -0
- package/lib/typst/match.d.ts +59 -0
- package/lib/typst/match.d.ts.map +1 -0
- package/lib/typst/match.js +171 -0
- package/lib/typst/match.js.map +7 -0
- package/lib/typst/oneshot.d.ts +45 -0
- package/lib/typst/oneshot.d.ts.map +1 -0
- package/lib/typst/oneshot.js +76 -0
- package/lib/typst/oneshot.js.map +7 -0
- package/lib/typst/pdf-extract.d.ts +29 -0
- package/lib/typst/pdf-extract.d.ts.map +1 -0
- package/lib/typst/pdf-extract.js +87 -0
- package/lib/typst/pdf-extract.js.map +7 -0
- package/lib/typst/pdfjs-worker.d.js +1 -0
- package/lib/typst/pdfjs-worker.d.js.map +7 -0
- package/lib/typst/text.d.ts +65 -0
- package/lib/typst/text.d.ts.map +1 -0
- package/lib/typst/text.js +314 -0
- package/lib/typst/text.js.map +7 -0
- package/lib/typst/watcher.d.ts +77 -0
- package/lib/typst/watcher.d.ts.map +1 -0
- package/lib/typst/watcher.js +219 -0
- package/lib/typst/watcher.js.map +7 -0
- package/lib/wire-schemas.d.ts +578 -0
- package/lib/wire-schemas.d.ts.map +1 -0
- package/lib/wire-schemas.js +384 -0
- package/lib/wire-schemas.js.map +7 -0
- package/lib/workspace/session.d.ts +209 -0
- package/lib/workspace/session.d.ts.map +1 -0
- package/lib/workspace/session.js +1232 -0
- package/lib/workspace/session.js.map +7 -0
- package/locale/en.json +9 -0
- package/locale/zh.json +9 -0
- package/package.json +256 -4
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host facts for the setup page: OS name, architecture, and the package
|
|
3
|
+
* managers that could install Typst. Probed once per session (and refreshed
|
|
4
|
+
* when the setup page re-checks with the shell). Ported from the ZCode
|
|
5
|
+
* typst-workbench server (0.2.0) `src/host/facts.ts`. Host half only.
|
|
6
|
+
* @module dsh-typst/host/facts
|
|
7
|
+
*/
|
|
8
|
+
import type { HostFactsView } from "../contract.js";
|
|
9
|
+
interface PmSpec {
|
|
10
|
+
name: string;
|
|
11
|
+
bin: string;
|
|
12
|
+
dirs: string[];
|
|
13
|
+
version?: {
|
|
14
|
+
args: string[];
|
|
15
|
+
pattern: RegExp;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Extra specs to probe alongside the platform defaults (cargo, for typst). */
|
|
19
|
+
export declare function cargoSpec(env: NodeJS.ProcessEnv): PmSpec;
|
|
20
|
+
/**
|
|
21
|
+
* Detect the host facts the setup page shows: OS, architecture, and every
|
|
22
|
+
* package manager that could install Typst.
|
|
23
|
+
*/
|
|
24
|
+
export declare function detectFacts(extra?: PmSpec[], options?: {
|
|
25
|
+
env?: NodeJS.ProcessEnv;
|
|
26
|
+
platform?: string;
|
|
27
|
+
home?: string;
|
|
28
|
+
arch?: string;
|
|
29
|
+
}): Promise<HostFactsView>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facts.d.ts","sourceRoot":"","sources":["../../src/host/facts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,gBAAgB,CAAC;AAkGxE,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AA8CD,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAGxD;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,KAAK,GAAE,MAAM,EAAO,EACpB,OAAO,GAAE;IACP,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACV,GACL,OAAO,CAAC,aAAa,CAAC,CAwCxB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { access, constants, readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { homedir, release } from "node:os";
|
|
4
|
+
import { delimiter, join, sep } from "node:path";
|
|
5
|
+
function output(command, args, env, timeout = 5e3) {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
try {
|
|
8
|
+
execFile(
|
|
9
|
+
command,
|
|
10
|
+
args,
|
|
11
|
+
{ env, timeout, windowsHide: true },
|
|
12
|
+
(error, stdout) => resolve(error ? null : String(stdout))
|
|
13
|
+
);
|
|
14
|
+
} catch {
|
|
15
|
+
resolve(null);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async function isExecutable(path, platform) {
|
|
20
|
+
try {
|
|
21
|
+
if (!(await stat(path)).isFile()) return false;
|
|
22
|
+
await access(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function findExecutable(bin, dirs, options = {}) {
|
|
29
|
+
const env = options.env ?? process.env;
|
|
30
|
+
const platform = options.platform ?? process.platform;
|
|
31
|
+
const names = platform === "win32" ? [`${bin}.exe`, `${bin}.cmd`, bin] : [bin];
|
|
32
|
+
const path = (env.PATH ?? env.Path ?? "").split(delimiter).filter(Boolean);
|
|
33
|
+
for (const dir of [...path, ...dirs]) {
|
|
34
|
+
for (const name of names) {
|
|
35
|
+
const candidate = join(dir, name);
|
|
36
|
+
if (await isExecutable(candidate, platform)) return candidate;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function tilde(path, home) {
|
|
42
|
+
if (!home) return path;
|
|
43
|
+
if (path === home) return "~";
|
|
44
|
+
return path.startsWith(home + sep) ? `~${path.slice(home.length)}` : path;
|
|
45
|
+
}
|
|
46
|
+
async function osName(platform, env) {
|
|
47
|
+
if (platform === "darwin") {
|
|
48
|
+
const version = (await output("/usr/bin/sw_vers", ["-productVersion"], env))?.trim();
|
|
49
|
+
return version ? `macOS ${version}` : "macOS";
|
|
50
|
+
}
|
|
51
|
+
if (platform === "win32") {
|
|
52
|
+
const [major, , build] = release().split(".").map(Number);
|
|
53
|
+
return major === 10 ? build >= 22e3 ? "Windows 11" : "Windows 10" : `Windows ${release()}`;
|
|
54
|
+
}
|
|
55
|
+
if (platform === "linux") {
|
|
56
|
+
const text = await readFile("/etc/os-release", "utf8").catch(() => "");
|
|
57
|
+
const pretty = /^PRETTY_NAME="?([^"\n]+)"?/m.exec(text)?.[1];
|
|
58
|
+
return pretty ?? "Linux";
|
|
59
|
+
}
|
|
60
|
+
return platform;
|
|
61
|
+
}
|
|
62
|
+
async function archName(platform, arch, env) {
|
|
63
|
+
if (platform === "darwin") {
|
|
64
|
+
if (arch === "arm64") return "Apple silicon";
|
|
65
|
+
const arm = (await output("/usr/sbin/sysctl", ["-n", "hw.optional.arm64"], env))?.trim();
|
|
66
|
+
return arm === "1" ? "Apple silicon" : "Intel";
|
|
67
|
+
}
|
|
68
|
+
return arch;
|
|
69
|
+
}
|
|
70
|
+
function packageManagers(platform, env, home) {
|
|
71
|
+
if (platform === "win32") {
|
|
72
|
+
const local = env.LOCALAPPDATA ?? join(home, "AppData", "Local");
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
name: "winget",
|
|
76
|
+
bin: "winget",
|
|
77
|
+
dirs: [join(local, "Microsoft", "WindowsApps")]
|
|
78
|
+
},
|
|
79
|
+
{ name: "Scoop", bin: "scoop", dirs: [join(home, "scoop", "shims")] },
|
|
80
|
+
{
|
|
81
|
+
name: "Chocolatey",
|
|
82
|
+
bin: "choco",
|
|
83
|
+
dirs: [join(env.ProgramData ?? "C:\\ProgramData", "chocolatey", "bin")]
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
const brew = {
|
|
88
|
+
name: "Homebrew",
|
|
89
|
+
bin: "brew",
|
|
90
|
+
dirs: [
|
|
91
|
+
"/opt/homebrew/bin",
|
|
92
|
+
"/usr/local/bin",
|
|
93
|
+
"/home/linuxbrew/.linuxbrew/bin",
|
|
94
|
+
join(home, ".linuxbrew", "bin")
|
|
95
|
+
],
|
|
96
|
+
version: { args: ["--version"], pattern: /Homebrew\s+(\d+\.\d+\.\d+)/ }
|
|
97
|
+
};
|
|
98
|
+
if (platform !== "linux") return [brew];
|
|
99
|
+
return [
|
|
100
|
+
brew,
|
|
101
|
+
{ name: "apt", bin: "apt-get", dirs: ["/usr/bin"] },
|
|
102
|
+
{ name: "dnf", bin: "dnf", dirs: ["/usr/bin"] },
|
|
103
|
+
{ name: "pacman", bin: "pacman", dirs: ["/usr/bin"] },
|
|
104
|
+
{ name: "zypper", bin: "zypper", dirs: ["/usr/bin"] },
|
|
105
|
+
{ name: "snap", bin: "snap", dirs: ["/usr/bin", "/snap/bin"] },
|
|
106
|
+
{ name: "Flatpak", bin: "flatpak", dirs: ["/usr/bin"] }
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
function cargoSpec(env) {
|
|
110
|
+
const home = env.HOME ?? env.USERPROFILE ?? "";
|
|
111
|
+
return { name: "cargo", bin: "cargo", dirs: [join(home, ".cargo", "bin")] };
|
|
112
|
+
}
|
|
113
|
+
async function detectFacts(extra = [], options = {}) {
|
|
114
|
+
const env = options.env ?? process.env;
|
|
115
|
+
const platform = options.platform ?? process.platform;
|
|
116
|
+
const home = options.home ?? env.HOME ?? env.USERPROFILE ?? homedir();
|
|
117
|
+
const specs = [...packageManagers(platform, env, home), ...extra];
|
|
118
|
+
const [name, arch, tools] = await Promise.all([
|
|
119
|
+
osName(platform, env),
|
|
120
|
+
archName(platform, options.arch ?? process.arch, env),
|
|
121
|
+
Promise.all(
|
|
122
|
+
specs.map(async (spec) => {
|
|
123
|
+
const path = await findExecutable(spec.bin, spec.dirs, {
|
|
124
|
+
env,
|
|
125
|
+
platform
|
|
126
|
+
});
|
|
127
|
+
if (!path) return null;
|
|
128
|
+
const probe = spec.version;
|
|
129
|
+
const text = probe ? await output(path, probe.args, env) : null;
|
|
130
|
+
const version = text ? probe?.pattern.exec(text)?.[1] : void 0;
|
|
131
|
+
return {
|
|
132
|
+
name: spec.name,
|
|
133
|
+
...version ? { version } : {},
|
|
134
|
+
path: tilde(path, home)
|
|
135
|
+
};
|
|
136
|
+
})
|
|
137
|
+
)
|
|
138
|
+
]);
|
|
139
|
+
const os = platform === "darwin" ? "macos" : platform === "win32" ? "windows" : platform === "linux" ? "linux" : "other";
|
|
140
|
+
return {
|
|
141
|
+
os,
|
|
142
|
+
osName: name,
|
|
143
|
+
arch,
|
|
144
|
+
tools: tools.filter((tool) => tool !== null)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
cargoSpec,
|
|
149
|
+
detectFacts
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=facts.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/host/facts.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Host facts for the setup page: OS name, architecture, and the package\n * managers that could install Typst. Probed once per session (and refreshed\n * when the setup page re-checks with the shell). Ported from the ZCode\n * typst-workbench server (0.2.0) `src/host/facts.ts`. Host half only.\n * @module dsh-typst/host/facts\n */\n\nimport { execFile } from \"node:child_process\";\nimport { access, constants, readFile, stat } from \"node:fs/promises\";\nimport { homedir, release } from \"node:os\";\nimport { delimiter, join, sep } from \"node:path\";\nimport type { HostFactsView, PackageManagerView } from \"../contract.js\";\n\nfunction output(\n command: string,\n args: string[],\n env: NodeJS.ProcessEnv,\n timeout = 5_000,\n): Promise<string | null> {\n return new Promise((resolve) => {\n try {\n execFile(\n command,\n args,\n { env, timeout, windowsHide: true },\n (error, stdout) => resolve(error ? null : String(stdout)),\n );\n } catch {\n resolve(null);\n }\n });\n}\n\nasync function isExecutable(path: string, platform: string): Promise<boolean> {\n try {\n if (!(await stat(path)).isFile()) return false;\n await access(path, platform === \"win32\" ? constants.F_OK : constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function findExecutable(\n bin: string,\n dirs: string[],\n options: { env?: NodeJS.ProcessEnv; platform?: string } = {},\n): Promise<string | null> {\n const env = options.env ?? process.env;\n const platform = options.platform ?? process.platform;\n const names =\n platform === \"win32\" ? [`${bin}.exe`, `${bin}.cmd`, bin] : [bin];\n const path = (env.PATH ?? env.Path ?? \"\").split(delimiter).filter(Boolean);\n for (const dir of [...path, ...dirs]) {\n for (const name of names) {\n const candidate = join(dir, name);\n if (await isExecutable(candidate, platform)) return candidate;\n }\n }\n return null;\n}\n\nfunction tilde(path: string, home: string): string {\n if (!home) return path;\n if (path === home) return \"~\";\n return path.startsWith(home + sep) ? `~${path.slice(home.length)}` : path;\n}\n\nasync function osName(\n platform: string,\n env: NodeJS.ProcessEnv,\n): Promise<string> {\n if (platform === \"darwin\") {\n const version = (\n await output(\"/usr/bin/sw_vers\", [\"-productVersion\"], env)\n )?.trim();\n return version ? `macOS ${version}` : \"macOS\";\n }\n if (platform === \"win32\") {\n const [major, , build] = release().split(\".\").map(Number);\n return major === 10\n ? build >= 22_000\n ? \"Windows 11\"\n : \"Windows 10\"\n : `Windows ${release()}`;\n }\n if (platform === \"linux\") {\n const text = await readFile(\"/etc/os-release\", \"utf8\").catch(() => \"\");\n const pretty = /^PRETTY_NAME=\"?([^\"\\n]+)\"?/m.exec(text)?.[1];\n return pretty ?? \"Linux\";\n }\n return platform;\n}\n\nasync function archName(\n platform: string,\n arch: string,\n env: NodeJS.ProcessEnv,\n): Promise<string> {\n if (platform === \"darwin\") {\n if (arch === \"arm64\") return \"Apple silicon\";\n const arm = (\n await output(\"/usr/sbin/sysctl\", [\"-n\", \"hw.optional.arm64\"], env)\n )?.trim();\n return arm === \"1\" ? \"Apple silicon\" : \"Intel\";\n }\n return arch;\n}\n\ninterface PmSpec {\n name: string;\n bin: string;\n dirs: string[];\n version?: { args: string[]; pattern: RegExp };\n}\n\nfunction packageManagers(\n platform: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): PmSpec[] {\n if (platform === \"win32\") {\n const local = env.LOCALAPPDATA ?? join(home, \"AppData\", \"Local\");\n return [\n {\n name: \"winget\",\n bin: \"winget\",\n dirs: [join(local, \"Microsoft\", \"WindowsApps\")],\n },\n { name: \"Scoop\", bin: \"scoop\", dirs: [join(home, \"scoop\", \"shims\")] },\n {\n name: \"Chocolatey\",\n bin: \"choco\",\n dirs: [join(env.ProgramData ?? \"C:\\\\ProgramData\", \"chocolatey\", \"bin\")],\n },\n ];\n }\n const brew: PmSpec = {\n name: \"Homebrew\",\n bin: \"brew\",\n dirs: [\n \"/opt/homebrew/bin\",\n \"/usr/local/bin\",\n \"/home/linuxbrew/.linuxbrew/bin\",\n join(home, \".linuxbrew\", \"bin\"),\n ],\n version: { args: [\"--version\"], pattern: /Homebrew\\s+(\\d+\\.\\d+\\.\\d+)/ },\n };\n if (platform !== \"linux\") return [brew];\n return [\n brew,\n { name: \"apt\", bin: \"apt-get\", dirs: [\"/usr/bin\"] },\n { name: \"dnf\", bin: \"dnf\", dirs: [\"/usr/bin\"] },\n { name: \"pacman\", bin: \"pacman\", dirs: [\"/usr/bin\"] },\n { name: \"zypper\", bin: \"zypper\", dirs: [\"/usr/bin\"] },\n { name: \"snap\", bin: \"snap\", dirs: [\"/usr/bin\", \"/snap/bin\"] },\n { name: \"Flatpak\", bin: \"flatpak\", dirs: [\"/usr/bin\"] },\n ];\n}\n\n/** Extra specs to probe alongside the platform defaults (cargo, for typst). */\nexport function cargoSpec(env: NodeJS.ProcessEnv): PmSpec {\n const home = env.HOME ?? env.USERPROFILE ?? \"\";\n return { name: \"cargo\", bin: \"cargo\", dirs: [join(home, \".cargo\", \"bin\")] };\n}\n\n/**\n * Detect the host facts the setup page shows: OS, architecture, and every\n * package manager that could install Typst.\n */\nexport async function detectFacts(\n extra: PmSpec[] = [],\n options: {\n env?: NodeJS.ProcessEnv;\n platform?: string;\n home?: string;\n arch?: string;\n } = {},\n): Promise<HostFactsView> {\n const env = options.env ?? process.env;\n const platform = options.platform ?? process.platform;\n const home = options.home ?? env.HOME ?? env.USERPROFILE ?? homedir();\n const specs: PmSpec[] = [...packageManagers(platform, env, home), ...extra];\n const [name, arch, tools] = await Promise.all([\n osName(platform, env),\n archName(platform, options.arch ?? process.arch, env),\n Promise.all(\n specs.map(async (spec): Promise<PackageManagerView | null> => {\n const path = await findExecutable(spec.bin, spec.dirs, {\n env,\n platform,\n });\n if (!path) return null;\n const probe = spec.version;\n const text = probe ? await output(path, probe.args, env) : null;\n const version = text ? probe?.pattern.exec(text)?.[1] : undefined;\n return {\n name: spec.name,\n ...(version ? { version } : {}),\n path: tilde(path, home),\n };\n }),\n ),\n ]);\n const os =\n platform === \"darwin\"\n ? \"macos\"\n : platform === \"win32\"\n ? \"windows\"\n : platform === \"linux\"\n ? \"linux\"\n : \"other\";\n return {\n os,\n osName: name,\n arch,\n tools: tools.filter((tool) => tool !== null),\n };\n}\n"],
|
|
5
|
+
"mappings": "AAQA,SAAS,gBAAgB;AACzB,SAAS,QAAQ,WAAW,UAAU,YAAY;AAClD,SAAS,SAAS,eAAe;AACjC,SAAS,WAAW,MAAM,WAAW;AAGrC,SAAS,OACP,SACA,MACA,KACA,UAAU,KACc;AACxB,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,QAAI;AACF;AAAA,QACE;AAAA,QACA;AAAA,QACA,EAAE,KAAK,SAAS,aAAa,KAAK;AAAA,QAClC,CAAC,OAAO,WAAW,QAAQ,QAAQ,OAAO,OAAO,MAAM,CAAC;AAAA,MAC1D;AAAA,IACF,QAAQ;AACN,cAAQ,IAAI;AAAA,IACd;AAAA,EACF,CAAC;AACH;AAEA,eAAe,aAAa,MAAc,UAAoC;AAC5E,MAAI;AACF,QAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,EAAG,QAAO;AACzC,UAAM,OAAO,MAAM,aAAa,UAAU,UAAU,OAAO,UAAU,IAAI;AACzE,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,eACb,KACA,MACA,UAA0D,CAAC,GACnC;AACxB,QAAM,MAAM,QAAQ,OAAO,QAAQ;AACnC,QAAM,WAAW,QAAQ,YAAY,QAAQ;AAC7C,QAAM,QACJ,aAAa,UAAU,CAAC,GAAG,GAAG,QAAQ,GAAG,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG;AACjE,QAAM,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,MAAM,SAAS,EAAE,OAAO,OAAO;AACzE,aAAW,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACpC,eAAW,QAAQ,OAAO;AACxB,YAAM,YAAY,KAAK,KA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AAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
package/lib/remote.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host Typert Remote runtime for the `typst` namespace: state frames,
|
|
3
|
+
* the live watch stream, preview bytes, file discovery, and source
|
|
4
|
+
* matching, all scoped to the calling Session's workspace through the
|
|
5
|
+
* `typstScope` lookup (the `workspaceFileScope` pattern from
|
|
6
|
+
* `@deepseek-ai/dsh-api-workspace-files`). Host half only.
|
|
7
|
+
* @module dsh-typst/remote
|
|
8
|
+
*/
|
|
9
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
10
|
+
import type { SessionId } from "@deepseek-ai/dsh-session/types";
|
|
11
|
+
import { TypertRemoteService, type TypertLookup } from "@deepseek-ai/dsh-typert-protocol";
|
|
12
|
+
import type { PreviewIdentity, PreviewBytes, TypstStateFrame } from "./contract.js";
|
|
13
|
+
import type { SourceMatch } from "./typst/match.js";
|
|
14
|
+
/**
|
|
15
|
+
* The session identity every endpoint is scoped by: received on the wire as
|
|
16
|
+
* the calling Session's id, resolved to its workspace root before the method
|
|
17
|
+
* body runs.
|
|
18
|
+
*/
|
|
19
|
+
export interface TypstScope {
|
|
20
|
+
readonly sessionId: SessionId;
|
|
21
|
+
readonly workspaceRoot: string;
|
|
22
|
+
}
|
|
23
|
+
declare module "@deepseek-ai/dsh-typert-protocol" {
|
|
24
|
+
interface TypertLookupMap {
|
|
25
|
+
/** Resolve a Session id to its workspace root without loading its event body or activating an Agent. */
|
|
26
|
+
typstScope: TypertLookup<TypstScope, SessionId>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The `typst` namespace's host service. Every method resolves the calling
|
|
31
|
+
* session's workspace through the service's session registry, so two
|
|
32
|
+
* sessions on two workspaces preview independently.
|
|
33
|
+
*/
|
|
34
|
+
export declare class TypstRuntime extends TypertRemoteService {
|
|
35
|
+
/**
|
|
36
|
+
* Register the service under the shared cordis key bound to the `typst`
|
|
37
|
+
* wire namespace.
|
|
38
|
+
* @param ctx - owning cordis context.
|
|
39
|
+
*/
|
|
40
|
+
constructor(ctx: Context);
|
|
41
|
+
/** The composed workbench service, or a stable not-composed failure. */
|
|
42
|
+
private workbench;
|
|
43
|
+
/** Live state frame for the calling session's workspace; activates the session. */
|
|
44
|
+
status(typstScope: TypstScope, signal: AbortSignal): Promise<TypstStateFrame>;
|
|
45
|
+
/** Choose the main `.typ` file; state updates follow on the watch stream. */
|
|
46
|
+
setMain(typstScope: TypstScope, path: string, signal: AbortSignal): Promise<{
|
|
47
|
+
main: string;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* The live state stream: the current frame first, then one frame per
|
|
51
|
+
* relevant change. Opening the stream counts as a panel subscription, so
|
|
52
|
+
* the setup re-lookup runs while Typst is unusable and stops when the
|
|
53
|
+
* stream closes.
|
|
54
|
+
*/
|
|
55
|
+
watch(typstScope: TypstScope, signal: AbortSignal): AsyncIterable<TypstStateFrame>;
|
|
56
|
+
/** The current preview PDF's bytes, or the telling no-preview failure. */
|
|
57
|
+
readPreview(typstScope: TypstScope, identity: PreviewIdentity, signal: AbortSignal): Promise<PreviewBytes>;
|
|
58
|
+
/** Match rendered text against the workspace's sources (the panel's selection toolbar). */
|
|
59
|
+
locateSource(typstScope: TypstScope, text: string, focus: string | null, signal: AbortSignal): Promise<{
|
|
60
|
+
matches: SourceMatch[];
|
|
61
|
+
}>;
|
|
62
|
+
/** Look Typst up again (the setup page's refresh); answers with the new frame. */
|
|
63
|
+
recheck(typstScope: TypstScope, signal: AbortSignal): Promise<TypstStateFrame>;
|
|
64
|
+
/** Stop the watch, relocate typst, rescan, restart; answers with the new frame. */
|
|
65
|
+
restart(typstScope: TypstScope, signal: AbortSignal): Promise<TypstStateFrame>;
|
|
66
|
+
/** Refresh the cancellable workspace index, optionally including excluded directories. */
|
|
67
|
+
discover(typstScope: TypstScope, includeExcluded: boolean, signal: AbortSignal): Promise<object>;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAChB,MAAM,eAAe,CAAC;AAQvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,eAAe;QACvB,wGAAwG;QACxG,UAAU,EAAE,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;KACjD;CACF;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,mBAAmB;IACnD;;;;OAIG;gBACS,GAAG,EAAE,OAAO;IAMxB,wEAAwE;IACxE,OAAO,CAAC,SAAS;IAQjB,mFAAmF;IAC7E,MAAM,CACV,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,CAAC;IAW3B,6EAA6E;IACvE,OAAO,CACX,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAW5B;;;;;OAKG;IACI,KAAK,CACV,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,GAClB,aAAa,CAAC,eAAe,CAAC;IAsBjC,0EAA0E;IACpE,WAAW,CACf,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,YAAY,CAAC;IAgBxB,2FAA2F;IACrF,YAAY,CAChB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC;QAAE,OAAO,EAAE,WAAW,EAAE,CAAA;KAAE,CAAC;IAWtC,kFAAkF;IAC5E,OAAO,CACX,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,CAAC;IAW3B,mFAAmF;IAC7E,OAAO,CACX,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,CAAC;IAW3B,0FAA0F;IACpF,QAAQ,CACZ,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC;CAUnB"}
|
package/lib/remote.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TypertRemoteService
|
|
3
|
+
} from "@deepseek-ai/dsh-typert-protocol";
|
|
4
|
+
import {
|
|
5
|
+
TYPST_STATUS_SERVICE_KEY,
|
|
6
|
+
TYPST_SETTINGS_NAMESPACE
|
|
7
|
+
} from "./constants.js";
|
|
8
|
+
import {
|
|
9
|
+
domainCall,
|
|
10
|
+
TYPST_NOT_COMPOSED_MESSAGE,
|
|
11
|
+
TypstError,
|
|
12
|
+
TYPST_NOT_COMPOSED
|
|
13
|
+
} from "./errors.js";
|
|
14
|
+
class TypstRuntime extends TypertRemoteService {
|
|
15
|
+
/**
|
|
16
|
+
* Register the service under the shared cordis key bound to the `typst`
|
|
17
|
+
* wire namespace.
|
|
18
|
+
* @param ctx - owning cordis context.
|
|
19
|
+
*/
|
|
20
|
+
constructor(ctx) {
|
|
21
|
+
super(ctx, TYPST_STATUS_SERVICE_KEY, {
|
|
22
|
+
namespace: TYPST_SETTINGS_NAMESPACE
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** The composed workbench service, or a stable not-composed failure. */
|
|
26
|
+
workbench() {
|
|
27
|
+
const service = this.ctx.get("typstWorkbench");
|
|
28
|
+
if (service === void 0) {
|
|
29
|
+
throw new TypstError(TYPST_NOT_COMPOSED_MESSAGE, TYPST_NOT_COMPOSED);
|
|
30
|
+
}
|
|
31
|
+
return service;
|
|
32
|
+
}
|
|
33
|
+
/** Live state frame for the calling session's workspace; activates the session. */
|
|
34
|
+
async status(typstScope, signal) {
|
|
35
|
+
signal.throwIfAborted();
|
|
36
|
+
return domainCall(async () => {
|
|
37
|
+
const session = await this.workbench().sessionFor(
|
|
38
|
+
typstScope.workspaceRoot
|
|
39
|
+
);
|
|
40
|
+
await session.activate();
|
|
41
|
+
return session.state();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** Choose the main `.typ` file; state updates follow on the watch stream. */
|
|
45
|
+
async setMain(typstScope, path, signal) {
|
|
46
|
+
signal.throwIfAborted();
|
|
47
|
+
return domainCall(async () => {
|
|
48
|
+
const session = await this.workbench().sessionFor(
|
|
49
|
+
typstScope.workspaceRoot
|
|
50
|
+
);
|
|
51
|
+
const main = await session.setMain(path);
|
|
52
|
+
return { main };
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The live state stream: the current frame first, then one frame per
|
|
57
|
+
* relevant change. Opening the stream counts as a panel subscription, so
|
|
58
|
+
* the setup re-lookup runs while Typst is unusable and stops when the
|
|
59
|
+
* stream closes.
|
|
60
|
+
*/
|
|
61
|
+
async *watch(typstScope, signal) {
|
|
62
|
+
signal.throwIfAborted();
|
|
63
|
+
const session = await domainCall(async () => {
|
|
64
|
+
const workbench = this.workbench();
|
|
65
|
+
const workspaceSession = await workbench.sessionFor(
|
|
66
|
+
typstScope.workspaceRoot
|
|
67
|
+
);
|
|
68
|
+
await workspaceSession.activate();
|
|
69
|
+
return workspaceSession;
|
|
70
|
+
});
|
|
71
|
+
session.watchSetup(true);
|
|
72
|
+
try {
|
|
73
|
+
const queue = session.state();
|
|
74
|
+
yield queue;
|
|
75
|
+
for await (const _ of session.onChangeWaiter(signal)) {
|
|
76
|
+
yield session.state();
|
|
77
|
+
}
|
|
78
|
+
} finally {
|
|
79
|
+
session.watchSetup(false);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** The current preview PDF's bytes, or the telling no-preview failure. */
|
|
83
|
+
async readPreview(typstScope, identity, signal) {
|
|
84
|
+
signal.throwIfAborted();
|
|
85
|
+
return domainCall(async () => {
|
|
86
|
+
const session = await this.workbench().sessionFor(
|
|
87
|
+
typstScope.workspaceRoot
|
|
88
|
+
);
|
|
89
|
+
const { info, bytes } = session.previewBytes(identity);
|
|
90
|
+
return {
|
|
91
|
+
generation: info.generation,
|
|
92
|
+
seq: info.seq,
|
|
93
|
+
sha256: info.sha256,
|
|
94
|
+
data: Uint8Array.from(bytes)
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Match rendered text against the workspace's sources (the panel's selection toolbar). */
|
|
99
|
+
async locateSource(typstScope, text, focus, signal) {
|
|
100
|
+
signal.throwIfAborted();
|
|
101
|
+
return domainCall(async () => {
|
|
102
|
+
const session = await this.workbench().sessionFor(
|
|
103
|
+
typstScope.workspaceRoot
|
|
104
|
+
);
|
|
105
|
+
const matches = await session.locateSource(text, focus ?? void 0);
|
|
106
|
+
return { matches };
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/** Look Typst up again (the setup page's refresh); answers with the new frame. */
|
|
110
|
+
async recheck(typstScope, signal) {
|
|
111
|
+
signal.throwIfAborted();
|
|
112
|
+
return domainCall(async () => {
|
|
113
|
+
const session = await this.workbench().sessionFor(
|
|
114
|
+
typstScope.workspaceRoot
|
|
115
|
+
);
|
|
116
|
+
await session.recheck(true);
|
|
117
|
+
return session.state();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** Stop the watch, relocate typst, rescan, restart; answers with the new frame. */
|
|
121
|
+
async restart(typstScope, signal) {
|
|
122
|
+
signal.throwIfAborted();
|
|
123
|
+
return domainCall(async () => {
|
|
124
|
+
const session = await this.workbench().sessionFor(
|
|
125
|
+
typstScope.workspaceRoot
|
|
126
|
+
);
|
|
127
|
+
await session.restart();
|
|
128
|
+
return session.state();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** Refresh the cancellable workspace index, optionally including excluded directories. */
|
|
132
|
+
async discover(typstScope, includeExcluded, signal) {
|
|
133
|
+
signal.throwIfAborted();
|
|
134
|
+
return domainCall(async () => {
|
|
135
|
+
const session = await this.workbench().sessionFor(
|
|
136
|
+
typstScope.workspaceRoot
|
|
137
|
+
);
|
|
138
|
+
await session.discover(includeExcluded, signal);
|
|
139
|
+
return {};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
TypstRuntime
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/remote.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The host Typert Remote runtime for the `typst` namespace: state frames,\n * the live watch stream, preview bytes, file discovery, and source\n * matching, all scoped to the calling Session's workspace through the\n * `typstScope` lookup (the `workspaceFileScope` pattern from\n * `@deepseek-ai/dsh-api-workspace-files`). Host half only.\n * @module dsh-typst/remote\n */\n\nimport type { Context } from \"@deepseek-ai/cordis\";\nimport type { SessionId } from \"@deepseek-ai/dsh-session/types\";\nimport {\n TypertRemoteService,\n type TypertLookup,\n} from \"@deepseek-ai/dsh-typert-protocol\";\nimport {\n TYPST_STATUS_SERVICE_KEY,\n TYPST_SETTINGS_NAMESPACE,\n} from \"./constants.js\";\nimport type {\n PreviewIdentity,\n PreviewBytes,\n TypstStateFrame,\n} from \"./contract.js\";\nimport {\n domainCall,\n TYPST_NOT_COMPOSED_MESSAGE,\n TypstError,\n TYPST_NOT_COMPOSED,\n} from \"./errors.js\";\nimport type { TypstWorkbenchService } from \"./service.js\";\nimport type { SourceMatch } from \"./typst/match.js\";\n\n/**\n * The session identity every endpoint is scoped by: received on the wire as\n * the calling Session's id, resolved to its workspace root before the method\n * body runs.\n */\nexport interface TypstScope {\n readonly sessionId: SessionId;\n readonly workspaceRoot: string;\n}\n\ndeclare module \"@deepseek-ai/dsh-typert-protocol\" {\n interface TypertLookupMap {\n /** Resolve a Session id to its workspace root without loading its event body or activating an Agent. */\n typstScope: TypertLookup<TypstScope, SessionId>;\n }\n}\n\n/**\n * The `typst` namespace's host service. Every method resolves the calling\n * session's workspace through the service's session registry, so two\n * sessions on two workspaces preview independently.\n */\nexport class TypstRuntime extends TypertRemoteService {\n /**\n * Register the service under the shared cordis key bound to the `typst`\n * wire namespace.\n * @param ctx - owning cordis context.\n */\n constructor(ctx: Context) {\n super(ctx, TYPST_STATUS_SERVICE_KEY, {\n namespace: TYPST_SETTINGS_NAMESPACE,\n });\n }\n\n /** The composed workbench service, or a stable not-composed failure. */\n private workbench(): TypstWorkbenchService {\n const service = this.ctx.get(\"typstWorkbench\");\n if (service === undefined) {\n throw new TypstError(TYPST_NOT_COMPOSED_MESSAGE, TYPST_NOT_COMPOSED);\n }\n return service;\n }\n\n /** Live state frame for the calling session's workspace; activates the session. */\n async status(\n typstScope: TypstScope,\n signal: AbortSignal,\n ): Promise<TypstStateFrame> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n await session.activate();\n return session.state();\n });\n }\n\n /** Choose the main `.typ` file; state updates follow on the watch stream. */\n async setMain(\n typstScope: TypstScope,\n path: string,\n signal: AbortSignal,\n ): Promise<{ main: string }> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n const main = await session.setMain(path);\n return { main };\n });\n }\n\n /**\n * The live state stream: the current frame first, then one frame per\n * relevant change. Opening the stream counts as a panel subscription, so\n * the setup re-lookup runs while Typst is unusable and stops when the\n * stream closes.\n */\n async *watch(\n typstScope: TypstScope,\n signal: AbortSignal,\n ): AsyncIterable<TypstStateFrame> {\n signal.throwIfAborted();\n const session = await domainCall(async () => {\n const workbench = this.workbench();\n const workspaceSession = await workbench.sessionFor(\n typstScope.workspaceRoot,\n );\n await workspaceSession.activate();\n return workspaceSession;\n });\n session.watchSetup(true);\n try {\n const queue = session.state();\n yield queue;\n for await (const _ of session.onChangeWaiter(signal)) {\n yield session.state();\n }\n } finally {\n session.watchSetup(false);\n }\n }\n\n /** The current preview PDF's bytes, or the telling no-preview failure. */\n async readPreview(\n typstScope: TypstScope,\n identity: PreviewIdentity,\n signal: AbortSignal,\n ): Promise<PreviewBytes> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n const { info, bytes } = session.previewBytes(identity);\n return {\n generation: info.generation,\n seq: info.seq,\n sha256: info.sha256,\n data: Uint8Array.from(bytes),\n };\n });\n }\n\n /** Match rendered text against the workspace's sources (the panel's selection toolbar). */\n async locateSource(\n typstScope: TypstScope,\n text: string,\n focus: string | null,\n signal: AbortSignal,\n ): Promise<{ matches: SourceMatch[] }> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n const matches = await session.locateSource(text, focus ?? undefined);\n return { matches };\n });\n }\n\n /** Look Typst up again (the setup page's refresh); answers with the new frame. */\n async recheck(\n typstScope: TypstScope,\n signal: AbortSignal,\n ): Promise<TypstStateFrame> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n await session.recheck(true);\n return session.state();\n });\n }\n\n /** Stop the watch, relocate typst, rescan, restart; answers with the new frame. */\n async restart(\n typstScope: TypstScope,\n signal: AbortSignal,\n ): Promise<TypstStateFrame> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n await session.restart();\n return session.state();\n });\n }\n\n /** Refresh the cancellable workspace index, optionally including excluded directories. */\n async discover(\n typstScope: TypstScope,\n includeExcluded: boolean,\n signal: AbortSignal,\n ): Promise<object> {\n signal.throwIfAborted();\n return domainCall(async () => {\n const session = await this.workbench().sessionFor(\n typstScope.workspaceRoot,\n );\n await session.discover(includeExcluded, signal);\n return {};\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWA;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAMP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA0BA,MAAM,qBAAqB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpD,YAAY,KAAc;AACxB,UAAM,KAAK,0BAA0B;AAAA,MACnC,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AAAA;AAAA,EAGQ,YAAmC;AACzC,UAAM,UAAU,KAAK,IAAI,IAAI,gBAAgB;AAC7C,QAAI,YAAY,QAAW;AACzB,YAAM,IAAI,WAAW,4BAA4B,kBAAkB;AAAA,IACrE;AACA,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,MAAM,OACJ,YACA,QAC0B;AAC1B,WAAO,eAAe;AACtB,WAAO,WAAW,YAAY;AAC5B,YAAM,UAAU,MAAM,KAAK,UAAU,EAAE;AAAA,QACrC,WAAW;AAAA,MACb;AACA,YAAM,QAAQ,SAAS;AACvB,aAAO,QAAQ,MAAM;AAAA,IACvB,CAAC;AAAA,EACH;AAAA;A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AU,MAAM,KAAK,UAAU,EAAE;AAAA,QACrC,WAAW;AAAA,MACb;AACA,YAAM,UAAU,MAAM,QAAQ,aAAa,MAAM,SAAS,MAAS;AACnE,aAAO,EAAE,QAAQ;AAAA,IACnB,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,QACJ,YACA,QAC0B;AAC1B,WAAO,eAAe;AACtB,WAAO,WAAW,YAAY;AAC5B,YAAM,UAAU,MAAM,KAAK,UAAU,EAAE;AAAA,QACrC,WAAW;AAAA,MACb;AACA,YAAM,QAAQ,QAAQ,IAAI;AAC1B,aAAO,QAAQ,MAAM;AAAA,IACvB,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,QACJ,YACA,QAC0B;AAC1B,WAAO,eAAe;AACtB,WAAO,WAAW,YAAY;AAC5B,YAAM,UAAU,MAAM,KAAK,UAAU,EAAE;AAAA,QACrC,WAAW;AAAA,MACb;AACA,YAAM,QAAQ,QAAQ;AACtB,aAAO,QAAQ,MAAM;AAAA,IACvB,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,SACJ,YACA,iBACA,QACiB;AACjB,WAAO,eAAe;AACtB,WAAO,WAAW,YAAY;AAC5B,YAAM,UAAU,MAAM,KAAK,UAAU,EAAE;AAAA,QACrC,WAAW;AAAA,MACb;AACA,YAAM,QAAQ,SAAS,iBAAiB,MAAM;AAC9C,aAAO,CAAC;AAAA,IACV,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/service.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ctx.typstWorkbench`: the plugin's stable boundary. It owns the per-
|
|
3
|
+
* workspace `WorkspaceSession` registry (one `typst watch` per workspace
|
|
4
|
+
* root, stopped on dispose), the plugin configuration lifecycle, the Typert
|
|
5
|
+
* manifest and scope lookup, and the agent tools. Host half only.
|
|
6
|
+
*
|
|
7
|
+
* Request-driven like the dsh-zotero core: loading the plugin never spawns
|
|
8
|
+
* typst and touches nothing on disk. The first tool call, or the first
|
|
9
|
+
* panel subscription on a workspace, starts that workspace's session.
|
|
10
|
+
* @module dsh-typst/service
|
|
11
|
+
*/
|
|
12
|
+
import { Service, type Context } from "@deepseek-ai/cordis";
|
|
13
|
+
import { Config } from "./config.js";
|
|
14
|
+
import { WorkspaceSession } from "./workspace/session.js";
|
|
15
|
+
declare module "@deepseek-ai/cordis" {
|
|
16
|
+
interface Context {
|
|
17
|
+
typstWorkbench: TypstWorkbenchService;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare class TypstWorkbenchService extends Service {
|
|
21
|
+
static inject: string[];
|
|
22
|
+
static Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<NoInfer<{
|
|
23
|
+
typstPath: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
24
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
25
|
+
typstPath: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
26
|
+
}>>, "plain">;
|
|
27
|
+
/** Live entry config: volatile references re-read per request. */
|
|
28
|
+
private readonly entry;
|
|
29
|
+
/** Workspace sessions keyed by resolved workspace root. */
|
|
30
|
+
private readonly sessions;
|
|
31
|
+
constructor(ctx: Context, config: Config);
|
|
32
|
+
/** The live entry's current values, read per request. */
|
|
33
|
+
private get resolved();
|
|
34
|
+
protected [Service.init](): Promise<void>;
|
|
35
|
+
/** The configured Typst path setting ('' = look it up). */
|
|
36
|
+
get typstPath(): string;
|
|
37
|
+
/**
|
|
38
|
+
* The workspace's session, creating it on first use. Keyed by the
|
|
39
|
+
* realpath of the workspace root so symlinked paths of the same workspace
|
|
40
|
+
* share one watcher.
|
|
41
|
+
* @param workspaceRoot - the session workspace's absolute root.
|
|
42
|
+
*/
|
|
43
|
+
sessionFor(workspaceRoot: string): Promise<WorkspaceSession>;
|
|
44
|
+
/** A changed Typst path makes every live session look the binary up again. */
|
|
45
|
+
private recheckAll;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK5D,OAAO,EACL,MAAM,EAIP,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,cAAc,EAAE,qBAAqB,CAAC;KACvC;CACF;AAED,qBAAa,qBAAsB,SAAQ,OAAO;IAChD,MAAM,CAAC,MAAM,WAAa;IAE1B,MAAM,CAAC,MAAM;;;;kBAAU;IAEvB,kEAAkE;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAElC,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuC;gBAEpD,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAKxC,yDAAyD;IACzD,OAAO,KAAK,QAAQ,GAEnB;cAEe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IA8D/C,2DAA2D;IAC3D,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;OAKG;IACG,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAclE,8EAA8E;YAChE,UAAU;CAKzB"}
|
package/lib/service.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { realpath } from "node:fs/promises";
|
|
2
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
3
|
+
import { dshCachePath } from "@deepseek-ai/dsh-home-paths";
|
|
4
|
+
import {
|
|
5
|
+
Config,
|
|
6
|
+
readResolvedConfig,
|
|
7
|
+
toLiveEntry
|
|
8
|
+
} from "./config.js";
|
|
9
|
+
import { registerTypstTools } from "./tools/registration.js";
|
|
10
|
+
import { registerTypstSkill } from "./skills/typst.js";
|
|
11
|
+
import { TypstRuntime } from "./remote.js";
|
|
12
|
+
import { TYPERT_MANIFEST } from "./typert.js";
|
|
13
|
+
import { WorkspaceSession } from "./workspace/session.js";
|
|
14
|
+
class TypstWorkbenchService extends Service {
|
|
15
|
+
static inject = ["tools"];
|
|
16
|
+
static Config = Config;
|
|
17
|
+
/** Live entry config: volatile references re-read per request. */
|
|
18
|
+
entry;
|
|
19
|
+
/** Workspace sessions keyed by resolved workspace root. */
|
|
20
|
+
sessions = /* @__PURE__ */ new Map();
|
|
21
|
+
constructor(ctx, config) {
|
|
22
|
+
super(ctx, "typstWorkbench");
|
|
23
|
+
this.entry = toLiveEntry(config);
|
|
24
|
+
}
|
|
25
|
+
/** The live entry's current values, read per request. */
|
|
26
|
+
get resolved() {
|
|
27
|
+
return readResolvedConfig(this.entry);
|
|
28
|
+
}
|
|
29
|
+
async [Service.init]() {
|
|
30
|
+
const ctx = this.ctx;
|
|
31
|
+
ctx.plugin(TypstRuntime);
|
|
32
|
+
ctx.inject(["sessions", "typert"], (scope) => {
|
|
33
|
+
scope.effect(
|
|
34
|
+
() => scope.typert.register(TYPERT_MANIFEST),
|
|
35
|
+
"typst: wire manifest"
|
|
36
|
+
);
|
|
37
|
+
scope.effect(
|
|
38
|
+
() => scope.typert.lookups.register("typstScope", {
|
|
39
|
+
parameter: "typstScope",
|
|
40
|
+
wire: "typstScopeId",
|
|
41
|
+
resource: "session",
|
|
42
|
+
hostTypeSymbol: "dsh-typst#TypstScope",
|
|
43
|
+
// The invocation codec carries the public TypstScopeId alias;
|
|
44
|
+
// strict Gateway resolution requires this symbol to match it.
|
|
45
|
+
wireTypeSymbol: "@deepseek-ai/dsh-typst#TypstScopeId",
|
|
46
|
+
resolve: (sessionId) => {
|
|
47
|
+
const header = scope.sessions.get(sessionId)?.header;
|
|
48
|
+
if (header === void 0) return void 0;
|
|
49
|
+
return {
|
|
50
|
+
sessionId,
|
|
51
|
+
workspaceRoot: header.cwd ?? scope.get("workingDirectory")?.defaultDirectory ?? process.cwd()
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
"typst: session scope lookup"
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
ctx.on("loader/volatile-update", () => {
|
|
59
|
+
void this.recheckAll();
|
|
60
|
+
});
|
|
61
|
+
ctx.effect(() => {
|
|
62
|
+
const sessions = [...this.sessions.values()];
|
|
63
|
+
return async () => {
|
|
64
|
+
await Promise.all(sessions.map((session) => session.close()));
|
|
65
|
+
this.sessions.clear();
|
|
66
|
+
};
|
|
67
|
+
}, "typst: session teardown");
|
|
68
|
+
ctx.effect(
|
|
69
|
+
() => () => {
|
|
70
|
+
for (const session of this.sessions.values()) session.killNow();
|
|
71
|
+
},
|
|
72
|
+
"typst: process-exit kill"
|
|
73
|
+
);
|
|
74
|
+
registerTypstTools(ctx, this);
|
|
75
|
+
registerTypstSkill(ctx);
|
|
76
|
+
}
|
|
77
|
+
/** The configured Typst path setting ('' = look it up). */
|
|
78
|
+
get typstPath() {
|
|
79
|
+
return this.resolved.typstPath;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The workspace's session, creating it on first use. Keyed by the
|
|
83
|
+
* realpath of the workspace root so symlinked paths of the same workspace
|
|
84
|
+
* share one watcher.
|
|
85
|
+
* @param workspaceRoot - the session workspace's absolute root.
|
|
86
|
+
*/
|
|
87
|
+
async sessionFor(workspaceRoot) {
|
|
88
|
+
const root = await realpath(workspaceRoot).catch(() => workspaceRoot);
|
|
89
|
+
const existing = this.sessions.get(root);
|
|
90
|
+
if (existing !== void 0) return existing;
|
|
91
|
+
const session = new WorkspaceSession({
|
|
92
|
+
workspaceRoot: root,
|
|
93
|
+
typstPath: this.typstPath || void 0,
|
|
94
|
+
dataDir: dshCachePath("typst"),
|
|
95
|
+
log: (message) => this.ctx.logger.debug(`[dsh-typst] ${message}`)
|
|
96
|
+
});
|
|
97
|
+
this.sessions.set(root, session);
|
|
98
|
+
return session;
|
|
99
|
+
}
|
|
100
|
+
/** A changed Typst path makes every live session look the binary up again. */
|
|
101
|
+
async recheckAll() {
|
|
102
|
+
for (const session of this.sessions.values()) {
|
|
103
|
+
await session.recheck(true).catch(() => void 0);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
TypstWorkbenchService
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=service.js.map
|