@parlor/shell-desktop 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +10 -2
- package/assets/icons/128x128.png +0 -0
- package/assets/icons/128x128@2x.png +0 -0
- package/assets/icons/32x32.png +0 -0
- package/assets/icons/icon.icns +0 -0
- package/assets/icons/icon.ico +0 -0
- package/dist/build.d.ts +3 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +18 -0
- package/dist/build.js.map +1 -0
- package/dist/dev.d.ts +9 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +28 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/prerequisites.d.ts +4 -0
- package/dist/prerequisites.d.ts.map +1 -0
- package/dist/prerequisites.js +12 -0
- package/dist/prerequisites.js.map +1 -0
- package/dist/project.d.ts +48 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +243 -0
- package/dist/project.js.map +1 -0
- package/dist/target-triple.d.ts +3 -0
- package/dist/target-triple.d.ts.map +1 -0
- package/dist/target-triple.js +10 -0
- package/dist/target-triple.js.map +1 -0
- package/dist/tauri-cli.d.ts +9 -0
- package/dist/tauri-cli.d.ts.map +1 -0
- package/dist/tauri-cli.js +42 -0
- package/dist/tauri-cli.js.map +1 -0
- package/package.json +45 -3
- package/rust/Cargo.toml +26 -0
- package/rust/src/control.rs +104 -0
- package/rust/src/device_key.rs +282 -0
- package/rust/src/dialog.rs +22 -0
- package/rust/src/host.rs +338 -0
- package/rust/src/keystore.rs +442 -0
- package/rust/src/lib.rs +20 -0
- package/rust/src/secret_store.rs +42 -0
- package/rust/src/session.rs +100 -0
- package/rust/src/vault.rs +133 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cychien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @parlor/shell-desktop
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The desktop shell: runs and builds the app as a Tauri window on macOS, Windows and Linux. Installed by `@parlor/cli`; you do not depend on it directly.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { TAURI_CONDITION } from "@parlor/shell-desktop";
|
|
7
|
+
|
|
8
|
+
console.log(TAURI_CONDITION);
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Docs: https://cychien.github.io/parlor/guides/targets/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AASnD,wBAAsB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CASxE"}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { buildWeb } from "@parlor/shell-web";
|
|
3
|
+
import { TAURI_CONDITION } from "./dev.js";
|
|
4
|
+
import { assertRustToolchain } from "./prerequisites.js";
|
|
5
|
+
import { prepareTauriProject } from "./project.js";
|
|
6
|
+
import { hostTargetTriple } from "./target-triple.js";
|
|
7
|
+
import { runTauri } from "./tauri-cli.js";
|
|
8
|
+
export async function buildDesktop(loaded) {
|
|
9
|
+
assertRustToolchain();
|
|
10
|
+
const projectDir = await prepareTauriProject(loaded, hostTargetTriple());
|
|
11
|
+
await buildWeb(loaded, {
|
|
12
|
+
conditions: [TAURI_CONDITION],
|
|
13
|
+
serverUrl: loaded.config.server.url,
|
|
14
|
+
});
|
|
15
|
+
await runTauri(["build"], { cwd: projectDir });
|
|
16
|
+
return join(projectDir, "src-tauri", "target", "release", "bundle");
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAoB;IACrD,mBAAmB,EAAE,CAAC;IACtB,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACzE,MAAM,QAAQ,CAAC,MAAM,EAAE;QACrB,UAAU,EAAE,CAAC,eAAe,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG;KACpC,CAAC,CAAC;IACH,MAAM,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LoadedConfig } from "@parlor/config";
|
|
2
|
+
export declare const TAURI_CONDITION = "parlor-tauri";
|
|
3
|
+
export interface DesktopDevOptions {
|
|
4
|
+
readonly signal?: AbortSignal | undefined;
|
|
5
|
+
/** The web target's origin when `parlor dev` runs both, so the window pairs and signs as it. */
|
|
6
|
+
readonly appOrigin?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function startDesktopDev(loaded: LoadedConfig, options?: DesktopDevOptions): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,gGAAgG;IAChG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmBf"}
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { startWebDev } from "@parlor/shell-web";
|
|
2
|
+
import { assertRustToolchain } from "./prerequisites.js";
|
|
3
|
+
import { prepareTauriProject } from "./project.js";
|
|
4
|
+
import { hostTargetTriple } from "./target-triple.js";
|
|
5
|
+
import { runTauri } from "./tauri-cli.js";
|
|
6
|
+
export const TAURI_CONDITION = "parlor-tauri";
|
|
7
|
+
export async function startDesktopDev(loaded, options = {}) {
|
|
8
|
+
assertRustToolchain();
|
|
9
|
+
const projectDir = await prepareTauriProject(loaded, hostTargetTriple(), {
|
|
10
|
+
onMissingHost: "warn",
|
|
11
|
+
});
|
|
12
|
+
const web = await startWebDev(loaded, {
|
|
13
|
+
conditions: [TAURI_CONDITION],
|
|
14
|
+
serverUrl: loaded.config.server.url,
|
|
15
|
+
appOrigin: options.appOrigin,
|
|
16
|
+
});
|
|
17
|
+
const devUrl = `http://localhost:${loaded.config.web.port}`;
|
|
18
|
+
try {
|
|
19
|
+
await runTauri(["dev", "--config", JSON.stringify({ build: { devUrl } })], {
|
|
20
|
+
cwd: projectDir,
|
|
21
|
+
signal: options.signal,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
await web.close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot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1
|
+
export { buildDesktop } from "./build.js";
|
|
2
|
+
export { type DesktopDevOptions, startDesktopDev, TAURI_CONDITION } from "./dev.js";
|
|
3
|
+
export { AGENT_HOST_SIDECAR, ensureTauriProject, libRs, type PrepareTauriProjectOptions, prepareTauriProject, stageAgentHost, stageAgentHostFrom, tauriConfig, tauriProjectDir, tauriProjectFiles, } from "./project.js";
|
|
4
|
+
export { assertRustToolchain, hasCargo } from "./prerequisites.js";
|
|
5
|
+
export { type RunTauriOptions, runTauri, TauriCliError } from "./tauri-cli.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,EACL,KAAK,0BAA0B,EAC/B,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { buildDesktop } from "./build.js";
|
|
2
|
+
export { startDesktopDev, TAURI_CONDITION } from "./dev.js";
|
|
3
|
+
export { AGENT_HOST_SIDECAR, ensureTauriProject, libRs, prepareTauriProject, stageAgentHost, stageAgentHostFrom, tauriConfig, tauriProjectDir, tauriProjectFiles, } from "./project.js";
|
|
4
|
+
export { assertRustToolchain, hasCargo } from "./prerequisites.js";
|
|
5
|
+
export { runTauri, TauriCliError } from "./tauri-cli.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAA0B,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,EAEL,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAwB,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerequisites.d.ts","sourceRoot":"","sources":["../src/prerequisites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,wBAAgB,QAAQ,CAAC,GAAG,GAAE,OAAO,SAAqB,GAAG,OAAO,CAGnE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,MAAM,OAAkB,GAAG,IAAI,CAKzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { TauriCliError } from "./tauri-cli.js";
|
|
3
|
+
export function hasCargo(run = spawnSync) {
|
|
4
|
+
const result = run("cargo", ["--version"], { stdio: "ignore" });
|
|
5
|
+
return result.status === 0;
|
|
6
|
+
}
|
|
7
|
+
export function assertRustToolchain(check = hasCargo) {
|
|
8
|
+
if (check())
|
|
9
|
+
return;
|
|
10
|
+
throw new TauriCliError("Rust toolchain not found. Desktop builds need cargo on PATH: install it from https://rustup.rs and run `rustup default stable`.");
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=prerequisites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerequisites.js","sourceRoot":"","sources":["../src/prerequisites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,UAAU,QAAQ,CAAC,GAAG,GAAqB,SAAS;IACxD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAK,GAAkB,QAAQ;IACjE,IAAI,KAAK,EAAE;QAAE,OAAO;IACpB,MAAM,IAAI,aAAa,CACrB,iIAAiI,CAClI,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type LoadedConfig, type ParlorConfig } from "@parlor/config";
|
|
2
|
+
export declare const TAURI_CARGO_PACKAGE = "parlor_app";
|
|
3
|
+
export declare function tauriProjectDir(rootDir: string): string;
|
|
4
|
+
export declare function tauriConfig(config: ParlorConfig): Record<string, unknown>;
|
|
5
|
+
export declare function cargoToml(config: ParlorConfig): string;
|
|
6
|
+
export declare const AGENT_HOST_SIDECAR = "binaries/parlor-host";
|
|
7
|
+
/**
|
|
8
|
+
* Every app registers the Keychain `parlor_session_*` and `parlor_device_key_*` commands.
|
|
9
|
+
* With `desktop.agentHost`, `setup()` also runs the bundled `parlor-host daemon --ensure`
|
|
10
|
+
* (adopt, install or upgrade the per-user service) and the `parlor_host_*` commands
|
|
11
|
+
* join them. The dialog and fs plugins back the `files` capability.
|
|
12
|
+
*/
|
|
13
|
+
export declare function libRs(config: ParlorConfig): string;
|
|
14
|
+
export declare class AgentHostStageError extends Error {
|
|
15
|
+
readonly name = "AgentHostStageError";
|
|
16
|
+
}
|
|
17
|
+
/** Copies a prebuilt host's `bin/` into the Tauri project, where `externalBin` and `resources` expect it. */
|
|
18
|
+
export declare function stageAgentHostFrom(packageDir: string, projectDir: string, targetTriple: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Copies the prebuilt host for `targetTriple` from its `@parlor/agent-host-<platform>`
|
|
21
|
+
* package to `binaries/parlor-host-<triple>`; copies only, compiles nothing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function stageAgentHost(projectDir: string, targetTriple: string): Promise<string>;
|
|
24
|
+
export declare const MAIN_RS = "#![cfg_attr(not(debug_assertions), windows_subsystem = \"windows\")]\n\nfn main() {\n parlor_app_lib::run()\n}\n";
|
|
25
|
+
export declare const BUILD_RS = "fn main() {\n tauri_build::build()\n}\n";
|
|
26
|
+
export declare const CAPABILITIES: {
|
|
27
|
+
$schema: string;
|
|
28
|
+
identifier: string;
|
|
29
|
+
description: string;
|
|
30
|
+
windows: string[];
|
|
31
|
+
permissions: string[];
|
|
32
|
+
};
|
|
33
|
+
export declare function tauriProjectFiles(config: ParlorConfig): Record<string, string>;
|
|
34
|
+
export declare function ensureTauriProject({ config, rootDir }: LoadedConfig, icons?: string): Promise<string>;
|
|
35
|
+
export interface PrepareTauriProjectOptions {
|
|
36
|
+
/** What a missing prebuilt host does: `fail` the build, or `warn` and go on without the sidecar. */
|
|
37
|
+
readonly onMissingHost?: "fail" | "warn";
|
|
38
|
+
readonly stage?: typeof stageAgentHost;
|
|
39
|
+
readonly warn?: (message: string) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generates the Tauri project, bundling the Parlor Host sidecar when `desktop.agentHost` is
|
|
43
|
+
* set. With no prebuilt host for the target it throws the staging error, or with
|
|
44
|
+
* `onMissingHost: "warn"` warns once and generates the project as if `agentHost` were off,
|
|
45
|
+
* so the app runs and the sidebar offers the install command.
|
|
46
|
+
*/
|
|
47
|
+
export declare function prepareTauriProject(loaded: LoadedConfig, targetTriple: string, { onMissingHost, stage, warn, }?: PrepareTauriProjectOptions): Promise<string>;
|
|
48
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAWrF,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAIhD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AASD,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8BzE;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAwBtD;AAED,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAgBzD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAiBlD;AAMD,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAkB,IAAI,yBAAyB;CAChD;AAgBD,6GAA6G;AAC7G,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,eAAO,MAAM,OAAO,wHAKnB,CAAC;AAEF,eAAO,MAAM,QAAQ,+CAGpB,CAAC;AAEF,eAAO,MAAM,YAAY;IACvB,OAAO;IACP,UAAU;IACV,WAAW;IACX,OAAO;IACP,WAAW;CASZ,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAW9E;AAaD,wBAAsB,kBAAkB,CACtC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,EACjC,KAAK,GAAE,MAAyB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,MAAM,WAAW,0BAA0B;IACzC,oGAAoG;IACpG,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,cAAc,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,EACpB,EACE,aAAsB,EACtB,KAAsB,EACtB,IAAmB,GACpB,GAAE,0BAA+B,GACjC,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
package/dist/project.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { chmod, copyFile, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { GENERATED_DIR } from "@parlor/config";
|
|
6
|
+
import { appCsp, extendCsp, serializeCsp } from "@parlor/shell-web";
|
|
7
|
+
const ICONS = [
|
|
8
|
+
"32x32.png",
|
|
9
|
+
"128x128.png",
|
|
10
|
+
"128x128@2x.png",
|
|
11
|
+
"icon.icns",
|
|
12
|
+
"icon.ico",
|
|
13
|
+
];
|
|
14
|
+
export const TAURI_CARGO_PACKAGE = "parlor_app";
|
|
15
|
+
const AGENT_HOST_SIGNATURE = "parlor-host.sig";
|
|
16
|
+
const SHELL_CRATE_DIR = fileURLToPath(new URL("../rust", import.meta.url));
|
|
17
|
+
export function tauriProjectDir(rootDir) {
|
|
18
|
+
return join(rootDir, GENERATED_DIR, "tauri");
|
|
19
|
+
}
|
|
20
|
+
const TAURI_IPC_SOURCES = ["ipc:", "http://ipc.localhost"];
|
|
21
|
+
function tauriCsp(config, dev) {
|
|
22
|
+
const policy = appCsp(config, { serverOrigin: config.server.url, dev });
|
|
23
|
+
return serializeCsp(extendCsp(policy, { "connect-src": TAURI_IPC_SOURCES }));
|
|
24
|
+
}
|
|
25
|
+
export function tauriConfig(config) {
|
|
26
|
+
return {
|
|
27
|
+
$schema: "https://schema.tauri.app/config/2",
|
|
28
|
+
productName: config.app.name,
|
|
29
|
+
version: config.app.version,
|
|
30
|
+
identifier: config.app.id,
|
|
31
|
+
build: { frontendDist: "../../web" },
|
|
32
|
+
app: {
|
|
33
|
+
windows: [
|
|
34
|
+
{
|
|
35
|
+
title: config.app.name,
|
|
36
|
+
width: config.desktop.width,
|
|
37
|
+
height: config.desktop.height,
|
|
38
|
+
resizable: true,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
security: { csp: tauriCsp(config, false), devCsp: tauriCsp(config, true) },
|
|
42
|
+
},
|
|
43
|
+
bundle: {
|
|
44
|
+
active: true,
|
|
45
|
+
targets: "all",
|
|
46
|
+
icon: ICONS.map((icon) => `icons/${icon}`),
|
|
47
|
+
...(config.desktop.agentHost
|
|
48
|
+
? { externalBin: [AGENT_HOST_SIDECAR], resources: [AGENT_HOST_SIGNATURE] }
|
|
49
|
+
: {}),
|
|
50
|
+
},
|
|
51
|
+
plugins: {
|
|
52
|
+
"deep-link": { desktop: { schemes: config.app.scheme ? [config.app.scheme] : [] } },
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function cargoToml(config) {
|
|
57
|
+
return `[package]
|
|
58
|
+
name = "${TAURI_CARGO_PACKAGE}"
|
|
59
|
+
version = "${config.app.version}"
|
|
60
|
+
description = "${config.app.description ?? config.app.name}"
|
|
61
|
+
edition = "2024"
|
|
62
|
+
|
|
63
|
+
[lib]
|
|
64
|
+
name = "${TAURI_CARGO_PACKAGE}_lib"
|
|
65
|
+
crate-type = ["staticlib", "cdylib", "rlib"]
|
|
66
|
+
|
|
67
|
+
[build-dependencies]
|
|
68
|
+
tauri-build = { version = "2", features = [] }
|
|
69
|
+
|
|
70
|
+
[dependencies]
|
|
71
|
+
tauri = { version = "2", features = [] }
|
|
72
|
+
tauri-plugin-deep-link = "2"
|
|
73
|
+
tauri-plugin-dialog = "2"
|
|
74
|
+
tauri-plugin-fs = "2"
|
|
75
|
+
tauri-plugin-notification = "2"
|
|
76
|
+
parlor-shell = { path = ${JSON.stringify(SHELL_CRATE_DIR)} }
|
|
77
|
+
serde = { version = "1", features = ["derive"] }
|
|
78
|
+
serde_json = "1"
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
export const AGENT_HOST_SIDECAR = "binaries/parlor-host";
|
|
82
|
+
const SHELL_COMMANDS = [
|
|
83
|
+
"parlor_device_key_public",
|
|
84
|
+
"parlor_device_key_sign",
|
|
85
|
+
"parlor_session_get",
|
|
86
|
+
"parlor_session_set",
|
|
87
|
+
];
|
|
88
|
+
const AGENT_HOST_COMMANDS = [
|
|
89
|
+
"parlor_host_bundled",
|
|
90
|
+
"parlor_host_status",
|
|
91
|
+
"parlor_host_begin",
|
|
92
|
+
"parlor_host_finish",
|
|
93
|
+
];
|
|
94
|
+
/**
|
|
95
|
+
* Every app registers the Keychain `parlor_session_*` and `parlor_device_key_*` commands.
|
|
96
|
+
* With `desktop.agentHost`, `setup()` also runs the bundled `parlor-host daemon --ensure`
|
|
97
|
+
* (adopt, install or upgrade the per-user service) and the `parlor_host_*` commands
|
|
98
|
+
* join them. The dialog and fs plugins back the `files` capability.
|
|
99
|
+
*/
|
|
100
|
+
export function libRs(config) {
|
|
101
|
+
const agentHost = Boolean(config.desktop.agentHost);
|
|
102
|
+
const commands = [...(agentHost ? AGENT_HOST_COMMANDS : []), ...SHELL_COMMANDS];
|
|
103
|
+
return `#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
104
|
+
pub fn run() {
|
|
105
|
+
tauri::Builder::default()
|
|
106
|
+
.plugin(tauri_plugin_deep_link::init())
|
|
107
|
+
.plugin(tauri_plugin_notification::init())
|
|
108
|
+
.plugin(tauri_plugin_dialog::init())
|
|
109
|
+
.plugin(tauri_plugin_fs::init())
|
|
110
|
+
${agentHost ? " .setup(|app| parlor_shell::setup(app))\n" : ""} .invoke_handler(tauri::generate_handler![
|
|
111
|
+
${commands.map((command) => ` parlor_shell::${command},`).join("\n")}
|
|
112
|
+
])
|
|
113
|
+
.run(tauri::generate_context!())
|
|
114
|
+
.expect("error while running tauri application");
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
const PREBUILT_HOST_PACKAGES = {
|
|
119
|
+
"aarch64-apple-darwin": "@parlor/agent-host-darwin-arm64",
|
|
120
|
+
};
|
|
121
|
+
export class AgentHostStageError extends Error {
|
|
122
|
+
name = "AgentHostStageError";
|
|
123
|
+
}
|
|
124
|
+
function prebuiltHostDir(targetTriple) {
|
|
125
|
+
const name = PREBUILT_HOST_PACKAGES[targetTriple];
|
|
126
|
+
if (!name) {
|
|
127
|
+
throw new AgentHostStageError(`There is no prebuilt Parlor Host for ${targetTriple}; desktop.agentHost supports ${Object.keys(PREBUILT_HOST_PACKAGES).join(", ")}.`);
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
return dirname(createRequire(import.meta.url).resolve(`${name}/package.json`));
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
throw new AgentHostStageError(`${name} is not installed.`, { cause: error });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** Copies a prebuilt host's `bin/` into the Tauri project, where `externalBin` and `resources` expect it. */
|
|
137
|
+
export async function stageAgentHostFrom(packageDir, projectDir, targetTriple) {
|
|
138
|
+
const bin = join(packageDir, "bin");
|
|
139
|
+
const source = {
|
|
140
|
+
binary: join(bin, "parlor-host"),
|
|
141
|
+
signature: join(bin, AGENT_HOST_SIGNATURE),
|
|
142
|
+
};
|
|
143
|
+
for (const file of Object.values(source)) {
|
|
144
|
+
if (!(await stat(file).catch(() => undefined))) {
|
|
145
|
+
throw new AgentHostStageError(`${file} is missing: build it with pnpm --filter @parlor/agent-host-darwin-arm64 build (needs PARLOR_HOST_SIGNING_KEY and PARLOR_HOST_RELEASE_KEY_FILE).`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const sidecar = join(projectDir, "src-tauri", `${AGENT_HOST_SIDECAR}-${targetTriple}`);
|
|
149
|
+
await mkdir(dirname(sidecar), { recursive: true });
|
|
150
|
+
await copyFile(source.binary, sidecar);
|
|
151
|
+
await chmod(sidecar, 0o755);
|
|
152
|
+
await copyFile(source.signature, join(projectDir, "src-tauri", AGENT_HOST_SIGNATURE));
|
|
153
|
+
return sidecar;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Copies the prebuilt host for `targetTriple` from its `@parlor/agent-host-<platform>`
|
|
157
|
+
* package to `binaries/parlor-host-<triple>`; copies only, compiles nothing.
|
|
158
|
+
*/
|
|
159
|
+
export async function stageAgentHost(projectDir, targetTriple) {
|
|
160
|
+
return stageAgentHostFrom(prebuiltHostDir(targetTriple), projectDir, targetTriple);
|
|
161
|
+
}
|
|
162
|
+
export const MAIN_RS = `#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
163
|
+
|
|
164
|
+
fn main() {
|
|
165
|
+
${TAURI_CARGO_PACKAGE}_lib::run()
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
export const BUILD_RS = `fn main() {
|
|
169
|
+
tauri_build::build()
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
export const CAPABILITIES = {
|
|
173
|
+
$schema: "../gen/schemas/desktop-schema.json",
|
|
174
|
+
identifier: "default",
|
|
175
|
+
description: "Permissions Parlor needs on desktop",
|
|
176
|
+
windows: ["main"],
|
|
177
|
+
permissions: [
|
|
178
|
+
"core:default",
|
|
179
|
+
"notification:default",
|
|
180
|
+
"deep-link:default",
|
|
181
|
+
"dialog:default",
|
|
182
|
+
"fs:allow-read-file",
|
|
183
|
+
"fs:allow-write-file",
|
|
184
|
+
"fs:allow-stat",
|
|
185
|
+
],
|
|
186
|
+
};
|
|
187
|
+
export function tauriProjectFiles(config) {
|
|
188
|
+
return {
|
|
189
|
+
"src-tauri/tauri.conf.json": `${JSON.stringify(tauriConfig(config), null, 2)}\n`,
|
|
190
|
+
"src-tauri/Cargo.toml": cargoToml(config),
|
|
191
|
+
"src-tauri/build.rs": BUILD_RS,
|
|
192
|
+
"src-tauri/src/main.rs": MAIN_RS,
|
|
193
|
+
"src-tauri/src/lib.rs": libRs(config),
|
|
194
|
+
"src-tauri/capabilities/default.json": `${JSON.stringify(CAPABILITIES, null, 2)}\n`,
|
|
195
|
+
"src-tauri/.gitignore": "target/\ngen/schemas/\n",
|
|
196
|
+
".gitignore": "*\n",
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function iconsSourceDir() {
|
|
200
|
+
return fileURLToPath(new URL("../assets/icons/", import.meta.url));
|
|
201
|
+
}
|
|
202
|
+
async function writeIfChanged(path, content) {
|
|
203
|
+
const current = await readFile(path).catch(() => undefined);
|
|
204
|
+
if (current && Buffer.compare(current, Buffer.from(content)) === 0)
|
|
205
|
+
return;
|
|
206
|
+
await mkdir(dirname(path), { recursive: true });
|
|
207
|
+
await writeFile(path, content);
|
|
208
|
+
}
|
|
209
|
+
export async function ensureTauriProject({ config, rootDir }, icons = iconsSourceDir()) {
|
|
210
|
+
const projectDir = tauriProjectDir(rootDir);
|
|
211
|
+
for (const [relative, content] of Object.entries(tauriProjectFiles(config))) {
|
|
212
|
+
await writeIfChanged(join(projectDir, relative), content);
|
|
213
|
+
}
|
|
214
|
+
for (const icon of ICONS) {
|
|
215
|
+
await writeIfChanged(join(projectDir, "src-tauri", "icons", icon), await readFile(join(icons, icon)));
|
|
216
|
+
}
|
|
217
|
+
return projectDir;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Generates the Tauri project, bundling the Parlor Host sidecar when `desktop.agentHost` is
|
|
221
|
+
* set. With no prebuilt host for the target it throws the staging error, or with
|
|
222
|
+
* `onMissingHost: "warn"` warns once and generates the project as if `agentHost` were off,
|
|
223
|
+
* so the app runs and the sidebar offers the install command.
|
|
224
|
+
*/
|
|
225
|
+
export async function prepareTauriProject(loaded, targetTriple, { onMissingHost = "fail", stage = stageAgentHost, warn = console.warn, } = {}) {
|
|
226
|
+
if (!loaded.config.desktop.agentHost)
|
|
227
|
+
return ensureTauriProject(loaded);
|
|
228
|
+
try {
|
|
229
|
+
await stage(tauriProjectDir(loaded.rootDir), targetTriple);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (!(error instanceof AgentHostStageError) || onMissingHost === "fail")
|
|
233
|
+
throw error;
|
|
234
|
+
warn(`Building without the bundled Parlor Host, so the sidebar will show the install command: ${error.message}`);
|
|
235
|
+
const { desktop } = loaded.config;
|
|
236
|
+
return ensureTauriProject({
|
|
237
|
+
...loaded,
|
|
238
|
+
config: { ...loaded.config, desktop: { ...desktop, agentHost: false } },
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return ensureTauriProject(loaded);
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,O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MAAM,CAAC,OAAO,CAAC,SAAS;QAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxE,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,mBAAmB,CAAC,IAAI,aAAa,KAAK,MAAM;YAAE,MAAM,KAAK,CAAC;QACrF,IAAI,CACF,2FAA2F,KAAK,CAAC,OAAO,EAAE,CAC3G,CAAC;QACF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;QAClC,OAAO,kBAAkB,CAAC;YACxB,GAAG,MAAM;YACT,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE;SACxE,CAAC,CAAC;IACL,CAAC;IACD,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-triple.d.ts","sourceRoot":"","sources":["../src/target-triple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,OAAO,SAAqB,GAAG,MAAM,CAO1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
export function hostTargetTriple(run = spawnSync) {
|
|
3
|
+
const result = run("rustc", ["-vV"], { encoding: "utf8" });
|
|
4
|
+
const triple = /^host: (\S+)$/m.exec(String(result.stdout))?.[1];
|
|
5
|
+
if (result.status !== 0 || !triple) {
|
|
6
|
+
throw new Error("Could not read the host target triple from `rustc -vV`.");
|
|
7
|
+
}
|
|
8
|
+
return triple;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=target-triple.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-triple.js","sourceRoot":"","sources":["../src/target-triple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAAC,GAAG,GAAqB,SAAS;IAChE,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class TauriCliError extends Error {
|
|
2
|
+
readonly name = "TauriCliError";
|
|
3
|
+
}
|
|
4
|
+
export interface RunTauriOptions {
|
|
5
|
+
readonly cwd: string;
|
|
6
|
+
readonly signal?: AbortSignal | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function runTauri(args: readonly string[], options: RunTauriOptions): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=tauri-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauri-cli.d.ts","sourceRoot":"","sources":["../src/tauri-cli.ts"],"names":[],"mappings":"AAMA,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAkB,IAAI,mBAAmB;CAC1C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC3C;AAUD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAuBf"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const FORCE_KILL_AFTER_MS = 5000;
|
|
5
|
+
export class TauriCliError extends Error {
|
|
6
|
+
name = "TauriCliError";
|
|
7
|
+
}
|
|
8
|
+
function killGroup(pid, signal) {
|
|
9
|
+
try {
|
|
10
|
+
process.kill(-pid, signal);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
// the group is already gone
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function runTauri(args, options) {
|
|
17
|
+
const bin = require.resolve("@tauri-apps/cli/tauri.js");
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const child = spawn(process.execPath, [bin, ...args], {
|
|
20
|
+
cwd: options.cwd,
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
detached: true,
|
|
23
|
+
});
|
|
24
|
+
const pid = child.pid;
|
|
25
|
+
const abort = () => {
|
|
26
|
+
if (pid === undefined)
|
|
27
|
+
return;
|
|
28
|
+
killGroup(pid, "SIGINT");
|
|
29
|
+
setTimeout(() => killGroup(pid, "SIGKILL"), FORCE_KILL_AFTER_MS).unref();
|
|
30
|
+
};
|
|
31
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
32
|
+
child.once("error", reject);
|
|
33
|
+
child.once("exit", (code, signal) => {
|
|
34
|
+
options.signal?.removeEventListener("abort", abort);
|
|
35
|
+
if (code === 0 || signal || options.signal?.aborted)
|
|
36
|
+
resolve();
|
|
37
|
+
else
|
|
38
|
+
reject(new TauriCliError(`tauri ${args[0]} exited with code ${code}`));
|
|
39
|
+
});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AAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,mBAAmB,CAAC,CAAC,KAAK,EAAE,CAAC;QAC3E,CAAC,CAAC;QACF,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAEjE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAClC,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACpD,IAAI,IAAI,KAAK,CAAC,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;gBAAE,OAAO,EAAE,CAAC;;gBAC1D,MAAM,CAAC,IAAI,aAAa,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parlor/shell-desktop",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"homepage": "https://cychien.github.io/parlor",
|
|
5
|
+
"bugs": "https://github.com/cychien/parlor/issues",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/cychien/parlor.git",
|
|
10
|
+
"directory": "packages/shell-desktop"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"assets",
|
|
15
|
+
"rust/Cargo.toml",
|
|
16
|
+
"rust/src"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@tauri-apps/api": "^2.12.1",
|
|
27
|
+
"@tauri-apps/cli": "^2.12.1",
|
|
28
|
+
"@tauri-apps/plugin-deep-link": "^2.6.1",
|
|
29
|
+
"@tauri-apps/plugin-dialog": "^2.8.3",
|
|
30
|
+
"@tauri-apps/plugin-fs": "^2.7.1",
|
|
31
|
+
"@tauri-apps/plugin-notification": "^2.5.1",
|
|
32
|
+
"@parlor/shell-web": "0.1.0",
|
|
33
|
+
"@parlor/config": "0.1.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^24.14.0",
|
|
37
|
+
"typescript": "^7.0.2",
|
|
38
|
+
"vitest": "^5.0.3"
|
|
39
|
+
},
|
|
40
|
+
"optionalDependencies": {
|
|
41
|
+
"@parlor/agent-host-darwin-arm64": "0.1.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
|
+
"test": "vitest run"
|
|
47
|
+
}
|
|
6
48
|
}
|