olonghon-sdk 0.2.0-alpha.1 → 0.2.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Olonghon SDK
2
+
3
+ Olonghon authorizes agent actions, records intent before dispatch and verifies the outcome against the provider.
4
+
5
+ ```sh
6
+ npm install olonghon-sdk
7
+ npx olonghon-sdk self-test
8
+ ```
9
+
10
+ The self-test runs offline after installation. It simulates a lost reply and checks that the provider recorded exactly one credit. Three PASS lines indicate success. The package bundles the native CLI for macOS, Linux and Windows on x64 and ARM64.
11
+
12
+ Run `npx olonghon-sdk stack --role=api` with `OLONGHON_DATABASE_URL` set to your PostgreSQL connection URL to use the shared journal. Repeated concurrent submissions reuse one dispatch claim.
13
+
14
+ For an SDK walkthrough and the shared runtime, see the [Olonghon quickstart](https://github.com/ponickkhan/olonghon#install-an-sdk).
package/cli.js ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const system = { darwin: 'darwin', linux: 'linux', win32: 'windows' }[process.platform];
6
+ const arch = { x64: 'amd64', arm64: 'arm64' }[process.arch];
7
+
8
+ if (!system || !arch) {
9
+ console.error(`Bundled Olonghon CLI is unavailable for ${process.platform} ${process.arch}. Supported systems: Linux, macOS and Windows on x64 or ARM64.`);
10
+ process.exitCode = 1;
11
+ } else {
12
+ const suffix = system === 'windows' ? '.exe' : '';
13
+ const binary = fileURLToPath(new URL(`./runtime/olonghon-${system}-${arch}${suffix}`, import.meta.url));
14
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
15
+ if (result.error) {
16
+ console.error(`Unable to start the bundled Olonghon CLI: ${result.error.message}`);
17
+ process.exitCode = 1;
18
+ } else if (result.signal) {
19
+ process.kill(process.pid, result.signal);
20
+ } else {
21
+ process.exitCode = result.status;
22
+ }
23
+ }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "olonghon-sdk",
3
- "version": "0.2.0-alpha.1",
3
+ "version": "0.2.0-alpha.3",
4
4
  "description": "Typed client for the Olonghon developer preview",
5
5
  "type": "module",
6
6
  "exports": { ".": { "types": "./index.d.ts", "import": "./index.js" } },
7
7
  "engines": { "node": ">=18" },
8
- "files": ["index.js", "index.d.ts", "LICENSE"],
8
+ "bin": { "olonghon-sdk": "./cli.js" },
9
+ "files": ["index.js", "index.d.ts", "cli.js", "runtime", "LICENSE"],
9
10
  "repository": { "type": "git", "url": "git+https://github.com/ponickkhan/olonghon.git", "directory": "clients/typescript" },
10
11
  "license": "MIT"
11
12
  }