@alwith/runtime 0.1.2

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 ADDED
@@ -0,0 +1,94 @@
1
+ ALwith Developer and Redistribution License, Version 1.0
2
+ Copyright 2026 ALWITHAI PTE. LTD. All rights reserved, except as expressly granted below.
3
+
4
+ 1. Scope
5
+ This license applies only to ALWITHAI PTE. LTD.'s ("ALwith") own material in
6
+ the binary distribution accompanying this license (the "Software"). It is a proprietary
7
+ license, not an open-source license. Third-party material is governed by its
8
+ respective licenses, as described in THIRD_PARTY_NOTICES.md. No restriction here
9
+ reduces rights granted by those licenses or by mandatory applicable law.
10
+
11
+ 2. Permission to develop and distribute applications
12
+ Subject to this license, ALwith grants you a worldwide, non-exclusive, royalty-free
13
+ copyright license to use, reproduce, integrate and modify the supplied Software
14
+ to develop, test, host and operate your own applications, including WorkBuddy
15
+ applications, for personal, internal business or commercial use. You may brand,
16
+ sell and distribute those applications, including the Software embedded in them,
17
+ to your customers and end users. No per-application registration, approval or
18
+ royalty is required by this software license.
19
+
20
+ You may bundle, minify, transform and otherwise adapt the supplied JavaScript,
21
+ styles and declarations for those applications. You may include the supplied
22
+ Software in an application source distribution when necessary to build or use
23
+ that application, provided it remains separately identified under this license.
24
+ You may combine it with separately licensed application code, including MPL-2.0
25
+ code, while complying with both licenses. Your own independent code remains yours;
26
+ this license does not require disclosure of your application source code.
27
+
28
+ Recipients may use the embedded Software to run the application and exercise the
29
+ permissions above under this same license. You may allow your contractors and
30
+ hosting providers to use it for those purposes. You must supply this license and
31
+ all applicable third-party notices with each redistribution (for example in an
32
+ included licenses directory or an accessible legal-notices page), identify your
33
+ modifications, and not impose terms that purport to change ALwith's license.
34
+
35
+ 3. Rights reserved
36
+ No right to ALwith's unpublished source code, private repositories, trademarks,
37
+ or separately distributed Runtime binaries, modules or services is granted here.
38
+ You may not relicense the Software as your own framework or redistribute it as
39
+ a standalone SDK/package for others, except for private development/build caches
40
+ used for applications permitted by Section 2. No restriction is imposed on
41
+ independently developed competing applications or on third-party licensed code.
42
+ You must not misrepresent authorship or imply ALwith endorses your application.
43
+
44
+ 4. Accounts and services
45
+ This license does not supply platform credentials, paid entitlements, hosting,
46
+ support, updates or a service-availability guarantee. Use of ALwith accounts,
47
+ pets, relay or other hosted services is separately subject to the applicable
48
+ service terms and authorization. Do not bypass service access controls or use
49
+ another person's credentials without authorization. Choosing or replacing an
50
+ authentication provider for your own application is not prohibited by this
51
+ software license. Distributing an Auth client does not authorize its recipients
52
+ to access another user's account, data or entitlements.
53
+
54
+ 5. Lawful use and independent responsibility
55
+ You must not use the Software to commit or knowingly facilitate unlawful acts.
56
+ You are responsible for your application's operation, permissions, business
57
+ practices, data processing, content and compliance with applicable law. You must
58
+ not make warranties or commitments on ALwith's behalf. ALwith does not endorse
59
+ your application merely because it uses the Software or connects to ALwith.
60
+ These allocations do not remove either party's own mandatory legal obligations.
61
+
62
+ 6. Disclaimer and limitation of liability
63
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED
64
+ "AS IS" AND "AS AVAILABLE", WITHOUT EXPRESS OR IMPLIED WARRANTIES, INCLUDING
65
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ACCURACY,
66
+ SECURITY OR UNINTERRUPTED OPERATION. AI OUTPUTS AND AUTOMATED ACTIONS MAY BE
67
+ INCORRECT OR HARMFUL; YOU MUST DETERMINE APPROPRIATE REVIEW AND SAFEGUARDS.
68
+
69
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ALWITH AND ITS CONTRIBUTORS
70
+ ARE NOT LIABLE FOR DAMAGES ARISING FROM USE, MODIFICATION OR DISTRIBUTION OF
71
+ THE SOFTWARE, INCLUDING LOST PROFITS, LOST DATA, BUSINESS INTERRUPTION AND
72
+ INDIRECT OR CONSEQUENTIAL LOSS. NOTHING EXCLUDES OR LIMITS LIABILITY THAT
73
+ CANNOT LAWFULLY BE EXCLUDED OR LIMITED, INCLUDING APPLICABLE MANDATORY CONSUMER
74
+ RIGHTS AND LIABILITY FOR FRAUD, WILLFUL MISCONDUCT OR GROSS NEGLIGENCE WHERE
75
+ SUCH EXCLUSION OR LIMITATION IS PROHIBITED. THIS LICENSE DOES NOT EXCLUDE
76
+ CRIMINAL OR REGULATORY RESPONSIBILITY IMPOSED BY LAW.
77
+
78
+ 7. Duration and termination
79
+ The grant for this version continues while you comply with this license. If
80
+ ALwith gives written notice of a material breach, your rights terminate if you
81
+ do not cure it within 30 days; no cure period authorizes continuing unlawful
82
+ conduct. On termination, cease new use and distribution of ALwith's proprietary
83
+ Software except as required by law. Independently compliant recipients retain
84
+ their own grants. Sections concerning reserved rights, notices, disclaimers and
85
+ mandatory-law exceptions survive as applicable. Third-party licenses are not
86
+ terminated by this provision.
87
+
88
+ 8. Versions and severability
89
+ This license governs the accompanying version. A later license or publication
90
+ of source code does not retroactively replace this grant or revoke rights in
91
+ earlier lawfully obtained versions. Any additional open-source license must be
92
+ expressly identified by ALwith. If a provision is unenforceable, the remaining
93
+ provisions continue to the extent permitted by law. A separate written agreement
94
+ signed by you and ALwith may expressly override these terms for its stated scope.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @alwith/runtime
2
+
3
+ The closed ALwith Runtime process, distributed as npm platform packages: `bun install` (or npm) pulls the
4
+ one binary for your platform via `optionalDependencies`; nothing else is downloaded, no credentials.
5
+
6
+ At build time:
7
+
8
+ ```js
9
+ import { stageRuntime } from "@alwith/runtime/stage"
10
+ stageRuntime("aarch64-apple-darwin", "src-tauri/binaries/alwith-runtime-aarch64-apple-darwin", "src-tauri/resources/licenses")
11
+ ```
12
+
13
+ The binary is verified against the sha256 pinned in the platform package before it is copied; the
14
+ Runtime's LICENSE and third-party notices land next to your app's other licence files.
15
+
16
+ Cross builds must install the optional package for the target too: `bun install --os='*' --cpu='*'`.
17
+ Platforms: macOS arm64, Linux x64/arm64, Windows x64/arm64. The protocol the binary speaks is
18
+ documented in the `alwith-api` repository (PROTOCOL.md); talk to it with `@alwith/api`.
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@alwith/runtime",
3
+ "version": "0.1.2",
4
+ "description": "The closed ALwith Runtime process for your platform: npm installs the matching binary, stageRuntime() copies it into your app's sidecars at build time",
5
+ "type": "module",
6
+ "license": "SEE LICENSE IN LICENSE",
7
+ "files": ["stage.js", "stage.d.ts", "README.md", "LICENSE"],
8
+ "exports": { "./stage": { "types": "./stage.d.ts", "import": "./stage.js" } },
9
+ "optionalDependencies": {
10
+ "@alwith/runtime-darwin-arm64": "0.1.2",
11
+ "@alwith/runtime-linux-arm64": "0.1.2",
12
+ "@alwith/runtime-linux-x64": "0.1.2",
13
+ "@alwith/runtime-win32-arm64": "0.1.2",
14
+ "@alwith/runtime-win32-x64": "0.1.2"
15
+ },
16
+ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" },
17
+ "repository": { "type": "git", "url": "git+https://github.com/ALwith-ai/alwith-runtime.git", "directory": "packages/runtime" }
18
+ }
package/stage.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Build-time only. Copies the installed, checksum-verified Runtime binary for `target` (a Rust
3
+ * target triple) to `destination` (the exact file path your bundler expects, e.g. a Tauri sidecar
4
+ * `binaries/alwith-runtime-<triple>`), and its LICENSE, THIRD_PARTY_NOTICES.md and licenses/ under
5
+ * `licenses`/alwith-runtime. Returns `destination`.
6
+ */
7
+ export declare function stageRuntime(target: string, destination: string, licenses: string): string;
package/stage.js ADDED
@@ -0,0 +1,31 @@
1
+ import { createRequire } from "node:module";
2
+ import { createHash } from "node:crypto";
3
+ import { chmodSync, cpSync, mkdirSync, readFileSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ const require = createRequire(import.meta.url);
6
+ const targets = {
7
+ "aarch64-apple-darwin": "darwin-arm64",
8
+ "aarch64-unknown-linux-gnu": "linux-arm64", "x86_64-unknown-linux-gnu": "linux-x64",
9
+ "aarch64-pc-windows-msvc": "win32-arm64", "x86_64-pc-windows-msvc": "win32-x64"
10
+ };
11
+ export function stageRuntime(target, destination, licenses) {
12
+ const platform = targets[target];
13
+ if (!platform) throw new Error(`Unsupported Runtime target: ${target}`);
14
+ const name = `@alwith/runtime-${platform}`;
15
+ let root;
16
+ try { root = dirname(require.resolve(`${name}/package.json`)); }
17
+ catch { throw new Error(`Missing ${name}. Install optional dependencies for the build target (Bun: bun install --os='*' --cpu='*').`); }
18
+ const pin = JSON.parse(readFileSync(join(root, "artifact.json"), "utf8"));
19
+ const version = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
20
+ const expectedFile = platform.startsWith("win32") ? "alwith-runtime.exe" : "alwith-runtime";
21
+ if (pin.version !== version || pin.target !== target || pin.binary !== expectedFile) throw new Error("Runtime artifact identity mismatch");
22
+ const binary = join(root, expectedFile);
23
+ if (createHash("sha256").update(readFileSync(binary)).digest("hex") !== pin.sha256) throw new Error("Runtime binary checksum mismatch");
24
+ mkdirSync(dirname(destination), { recursive: true });
25
+ cpSync(binary, destination);
26
+ if (!platform.startsWith("win32")) chmodSync(destination, 0o755);
27
+ const legal = join(licenses, "alwith-runtime");
28
+ mkdirSync(legal, { recursive: true });
29
+ for (const file of ["LICENSE", "THIRD_PARTY_NOTICES.md", "licenses"]) cpSync(join(root, file), join(legal, file), { recursive: true });
30
+ return destination;
31
+ }