@ai-switch/tauri-plugin-runtime 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +327 -0
  3. package/THIRD_PARTY_NOTICES.md +210 -0
  4. package/dist/bridge/handshake.d.ts +11 -0
  5. package/dist/bridge/json-codec.d.ts +4 -0
  6. package/dist/bridge/rpc-peer.d.ts +7 -0
  7. package/dist/bridge/rpc-types.d.ts +20 -0
  8. package/dist/chunk-CFQSUF5W.js +1794 -0
  9. package/dist/chunk-JSBRDJBE.js +30 -0
  10. package/dist/chunk-K5YWIJN6.js +389 -0
  11. package/dist/chunk-PW7XHHWG.js +403 -0
  12. package/dist/chunk-RKQEK7DY.js +13879 -0
  13. package/dist/chunk-WT62GTMC.js +18 -0
  14. package/dist/chunk-YI6NQ6WR.js +513 -0
  15. package/dist/host/event-router.d.ts +19 -0
  16. package/dist/host/file-handles.d.ts +15 -0
  17. package/dist/host/host.d.ts +2 -0
  18. package/dist/host/index.d.ts +4 -0
  19. package/dist/host/index.js +791 -0
  20. package/dist/host/policy.d.ts +7 -0
  21. package/dist/host/requests.d.ts +13 -0
  22. package/dist/host/types.d.ts +19 -0
  23. package/dist/host/view.d.ts +18 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.js +9 -0
  26. package/dist/node/buffer.d.ts +7 -0
  27. package/dist/node/buffer.js +8 -0
  28. package/dist/node/events.d.ts +12 -0
  29. package/dist/node/events.js +458 -0
  30. package/dist/node/fs/backend.d.ts +8 -0
  31. package/dist/node/fs/callback-types.d.ts +43 -0
  32. package/dist/node/fs/callbacks.d.ts +3 -0
  33. package/dist/node/fs/client.d.ts +3 -0
  34. package/dist/node/fs/errors.d.ts +5 -0
  35. package/dist/node/fs/lifecycle.d.ts +11 -0
  36. package/dist/node/fs/options.d.ts +7 -0
  37. package/dist/node/fs/promises.d.ts +33 -0
  38. package/dist/node/fs/promises.js +30 -0
  39. package/dist/node/fs/transfer.d.ts +7 -0
  40. package/dist/node/fs/types.d.ts +86 -0
  41. package/dist/node/fs.d.ts +36 -0
  42. package/dist/node/fs.js +92 -0
  43. package/dist/node/path.d.ts +20 -0
  44. package/dist/node/path.js +434 -0
  45. package/dist/plugin/client.d.ts +4 -0
  46. package/dist/plugin/connection.d.ts +6 -0
  47. package/dist/plugin/errors.d.ts +3 -0
  48. package/dist/plugin/index.d.ts +6 -0
  49. package/dist/plugin/index.js +12 -0
  50. package/dist/plugin/types.d.ts +28 -0
  51. package/dist/protocol/capabilities.d.ts +8 -0
  52. package/dist/protocol/errors.d.ts +14 -0
  53. package/dist/protocol/generated/capabilities.generated.d.ts +56 -0
  54. package/dist/protocol/generated/fs.generated.d.ts +178 -0
  55. package/dist/protocol/generated/host-event.generated.d.ts +17 -0
  56. package/dist/protocol/generated/manifest.generated.d.ts +64 -0
  57. package/dist/protocol/generated/session.generated.d.ts +93 -0
  58. package/dist/protocol/generated/types.generated.d.ts +6 -0
  59. package/dist/protocol/generated/validators.generated.d.mts +24 -0
  60. package/dist/protocol/generated/wire.generated.d.ts +63 -0
  61. package/dist/protocol/index.d.ts +18 -0
  62. package/dist/protocol/index.js +746 -0
  63. package/dist/protocol/json-safety.d.ts +3 -0
  64. package/dist/protocol/limits.d.ts +11 -0
  65. package/dist/protocol/manifest.d.ts +5 -0
  66. package/dist/protocol/path-policy.d.ts +2 -0
  67. package/dist/protocol/schema/capabilities.schema.json +301 -0
  68. package/dist/protocol/schema/fs.schema.json +900 -0
  69. package/dist/protocol/schema/host-event.schema.json +116 -0
  70. package/dist/protocol/schema/manifest.schema.json +60 -0
  71. package/dist/protocol/schema/session.schema.json +145 -0
  72. package/dist/protocol/schema/wire.schema.json +358 -0
  73. package/dist/protocol/session.d.ts +3 -0
  74. package/dist/protocol/types.d.ts +27 -0
  75. package/dist/protocol/validation.d.ts +2 -0
  76. package/dist/protocol/wire.d.ts +16 -0
  77. package/package.json +95 -0
@@ -0,0 +1,27 @@
1
+ export type JsonValue = null | boolean | number | string | JsonValue[] | JsonObject;
2
+ export interface JsonObject {
3
+ [key: string]: JsonValue;
4
+ }
5
+ export interface Diagnostic {
6
+ code: string;
7
+ path: string;
8
+ message: string;
9
+ }
10
+ export type ValidationResult<T> = {
11
+ ok: true;
12
+ value: T;
13
+ } | {
14
+ ok: false;
15
+ diagnostics: Diagnostic[];
16
+ };
17
+ export interface SchemaError {
18
+ instancePath: string;
19
+ message?: string;
20
+ keyword: string;
21
+ params: Record<string, unknown>;
22
+ }
23
+ export interface SchemaValidator {
24
+ (value: unknown): boolean;
25
+ errors?: SchemaError[] | null;
26
+ }
27
+ export declare function schemaDiagnostics(validator: SchemaValidator, code: string): Diagnostic[];
@@ -0,0 +1,2 @@
1
+ import { type SchemaValidator, type ValidationResult } from "./types.js";
2
+ export declare function validateWithSchema<T>(value: unknown, schema: SchemaValidator, code: string): ValidationResult<T>;
@@ -0,0 +1,16 @@
1
+ import type { HostEvent, SessionDescriptor, WireMessage } from "./generated/types.generated.js";
2
+ import type { JsonObject, ValidationResult } from "./types.js";
3
+ export type SessionInfo = SessionDescriptor["info"];
4
+ export type CapabilityInfo = SessionInfo["capabilities"][string];
5
+ export type PluginRequest = Extract<WireMessage, {
6
+ kind: "request";
7
+ }>;
8
+ export type PluginOperation = PluginRequest["operation"];
9
+ export type HostOperation = PluginOperation | "session.open" | "session.close";
10
+ export type Unsubscribe = () => void;
11
+ export interface HostTransport {
12
+ call<T>(operation: HostOperation, args: JsonObject): Promise<T>;
13
+ subscribe(handler: (event: HostEvent) => void): Promise<Unsubscribe>;
14
+ }
15
+ export declare function validateWireMessage(value: unknown): ValidationResult<WireMessage>;
16
+ export declare function validateHostEvent(value: unknown): ValidationResult<HostEvent>;
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@ai-switch/tauri-plugin-runtime",
3
+ "version": "0.1.0",
4
+ "description": "Host-neutral APLG plugin runtime and protocol contracts.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ai-switch/ai-switch.git",
10
+ "directory": "packages/tauri-plugin-runtime"
11
+ },
12
+ "sideEffects": false,
13
+ "engines": {
14
+ "node": "^22.12.0 || ^24.0.0 || >=26.0.0"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE",
20
+ "THIRD_PARTY_NOTICES.md"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./protocol": {
31
+ "types": "./dist/protocol/index.d.ts",
32
+ "import": "./dist/protocol/index.js"
33
+ },
34
+ "./package.json": "./package.json",
35
+ "./plugin": {
36
+ "types": "./dist/plugin/index.d.ts",
37
+ "import": "./dist/plugin/index.js"
38
+ },
39
+ "./host": {
40
+ "types": "./dist/host/index.d.ts",
41
+ "import": "./dist/host/index.js"
42
+ },
43
+ "./node/path": {
44
+ "types": "./dist/node/path.d.ts",
45
+ "import": "./dist/node/path.js"
46
+ },
47
+ "./node/buffer": {
48
+ "types": "./dist/node/buffer.d.ts",
49
+ "import": "./dist/node/buffer.js"
50
+ },
51
+ "./node/events": {
52
+ "types": "./dist/node/events.d.ts",
53
+ "import": "./dist/node/events.js"
54
+ },
55
+ "./node/fs": {
56
+ "types": "./dist/node/fs.d.ts",
57
+ "import": "./dist/node/fs.js"
58
+ },
59
+ "./node/fs/promises": {
60
+ "types": "./dist/node/fs/promises.d.ts",
61
+ "import": "./dist/node/fs/promises.js"
62
+ }
63
+ },
64
+ "dependencies": {
65
+ "buffer": "6.0.3",
66
+ "events": "3.3.0",
67
+ "path-browserify": "1.0.1",
68
+ "semver": "7.8.5"
69
+ },
70
+ "devDependencies": {
71
+ "@playwright/test": "1.63.0",
72
+ "@types/events": "3.0.3",
73
+ "@types/node": "22.19.15",
74
+ "@types/path-browserify": "1.0.3",
75
+ "@types/semver": "7.7.1",
76
+ "ajv": "8.20.0",
77
+ "esbuild": "0.28.0",
78
+ "json-schema-to-typescript": "16.0.0",
79
+ "typescript": "5.9.3",
80
+ "vite": "8.3.0",
81
+ "vitest": "5.0.0"
82
+ },
83
+ "scripts": {
84
+ "generate": "node scripts/generate-protocol.mjs",
85
+ "check:generated": "node scripts/check-generated.mjs",
86
+ "typecheck": "tsc --noEmit -p tsconfig.json",
87
+ "test": "node scripts/build.mjs && vitest run",
88
+ "build": "node scripts/build.mjs",
89
+ "test:browser": "playwright test",
90
+ "test:types": "tsc --noEmit -p tsconfig.type-tests.json",
91
+ "test:types:public": "tsc --noEmit -p tsconfig.public-type-tests.json",
92
+ "verify:tarball": "node scripts/verify-tarball.mjs",
93
+ "test:package": "node --test tests/package/*.test.mjs"
94
+ }
95
+ }