openmates 0.29.0-alpha.11 → 0.29.0-alpha.12

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/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  Only SDK-relevant compatibility notes are recorded here. Release versions follow
4
4
  the product line (`0.29.x` alpha prereleases from `dev`, stable from `main`).
5
5
 
6
+ ## 0.30.0
7
+
8
+ ### Breaking
9
+
10
+ - **The SDK is API-key only and separate from the CLI login.** The root
11
+ `OpenMatesClient` export no longer loads the stored CLI login (the 0.29.x
12
+ `OPENMATES_SDK_CLI_SESSION` deprecation is complete). It is now the API-key
13
+ client: `new OpenMatesClient({ apiKey })`. Constructing it (or calling
14
+ `OpenMatesClient.load()`) without an `apiKey` throws
15
+ `OpenMatesApiKeyRequiredError` (code `OPENMATES_SDK_API_KEY_REQUIRED`), and the
16
+ `session` / `loadStoredSession` options are rejected. No SDK entrypoint reads
17
+ CLI state files or the keychain, so an SDK script can use a different account
18
+ from the logged-in CLI. `SDK_CLI_SESSION_DEPRECATION_CODE` is removed.
19
+
20
+ **Migration:** create an API key in Settings → Developers and pass it
21
+ explicitly (`new OpenMatesClient({ apiKey })` or `new OpenMates({ apiKey })`).
22
+ The key decrypts your chats locally with its own wrapped account key; nothing
23
+ else is needed. The `openmates` command line keeps its own login and is
24
+ unaffected.
25
+
26
+ ### Deprecated
27
+
28
+ - `SessionClient.loginPassword()` / `importSession()` in `openmates/sdk/v1`. Public
29
+ SDKs are API-key only; these login modes are removed once every capability they
30
+ offer is available through API-key authentication (open work tracked in
31
+ `config/sdk-capabilities.json`).
32
+
6
33
  ## 0.29.x
7
34
 
8
35
  ### Deprecated
package/README.md CHANGED
@@ -375,23 +375,37 @@ Use `chats.send()` for anonymous AI chat with automatic routing; `apps.ai.ask()`
375
375
  requires an account. With an API key, use `saveToAccount: true` when you want the
376
376
  chat saved to the OpenMates account.
377
377
 
378
- ### Deprecated: implicit CLI login in the root `OpenMatesClient`
378
+ ### API keys only, never the CLI login
379
379
 
380
- `new OpenMatesClient()` / `OpenMatesClient.load()` from the root `openmates`
381
- export still load the stored CLI login when no `session` is passed, but this is
382
- deprecated: SDK credentials must be explicit. It emits one `DeprecationWarning`
383
- with code `OPENMATES_SDK_CLI_SESSION` per process. Pass `session` explicitly,
384
- set `loadStoredSession: false`, or use `SessionClient` from `openmates/sdk/v1`.
385
- A later minor release will require explicit credentials (see `CHANGELOG.md`).
386
- The `openmates` command line is unaffected.
380
+ The SDK authenticates only with an API key you pass explicitly (or configure via
381
+ `OPENMATES_API_KEY`). It is completely separate from the `openmates` command
382
+ line: it never reads the CLI's `~/.openmates/session.json`, its state directory
383
+ or the OS keychain, so a script can use a different account than the one logged
384
+ in to the CLI. Create an API key in Settings → Developers. Each key carries its
385
+ own wrapped copy of your account key, so the SDK decrypts your chats locally,
386
+ in memory, with only that key.
387
+
388
+ Since 0.30.0 the root `OpenMatesClient` is the API-key client and requires
389
+ `apiKey`; constructing it without one throws `OpenMatesApiKeyRequiredError`
390
+ (code `OPENMATES_SDK_API_KEY_REQUIRED`). The former `session` and
391
+ `loadStoredSession` options are rejected.
392
+
393
+ ```typescript
394
+ import { OpenMatesClient } from "openmates";
395
+
396
+ const om = new OpenMatesClient({ apiKey: process.env.MY_OPENMATES_KEY! });
397
+ ```
387
398
 
388
399
  ### Native session SDK (preview)
389
400
 
390
401
  `openmates/sdk/v1` exports `SessionClient`, `RustApiKeyClient` and related
391
402
  types. Every operation runs in the shared OpenMates Rust core through a native
392
403
  Node-API module loaded from `native/<platform>-<arch>.node`; the SDK never
393
- launches the CLI and never reads CLI login state. Credentials are explicit:
394
- log in with `loginPassword()` or import a caller-owned session. If the native
404
+ launches the CLI and never reads CLI login state. Its password/imported-session
405
+ login modes (`loginPassword()`, `importSession()`) are deprecated: public SDKs
406
+ are API-key only, and these modes are removed once every capability they offer
407
+ is available through API-key authentication (tracked in
408
+ `config/sdk-capabilities.json`). Use an API key for new integrations. If the native
395
409
  module for your platform is missing or incompatible, construction throws
396
410
  `SessionClientError` with code `native_binding_unavailable` (no TypeScript
397
411
  fallback). The SDK is moving to one portable WebAssembly build of the core
@@ -0,0 +1,46 @@
1
+ import {
2
+ OpenMates,
3
+ OpenMatesConfigError
4
+ } from "./chunk-APUIUJ63.js";
5
+
6
+ // src/sdkRootClient.ts
7
+ var SDK_API_KEY_REQUIRED_CODE = "OPENMATES_SDK_API_KEY_REQUIRED";
8
+ var OpenMatesApiKeyRequiredError = class extends OpenMatesConfigError {
9
+ code = SDK_API_KEY_REQUIRED_CODE;
10
+ constructor(message) {
11
+ super(message);
12
+ this.name = "OpenMatesApiKeyRequiredError";
13
+ }
14
+ };
15
+ var ALLOWED_OPTIONS = /* @__PURE__ */ new Set(["apiKey", "apiUrl", "deviceId", "deviceIdPath"]);
16
+ var MIGRATION = "Create an API key in Settings \u2192 Developers and pass it explicitly: new OpenMatesClient({ apiKey }). The SDK never uses the CLI login.";
17
+ function requireApiKeyOptions(options) {
18
+ if (options === void 0 || options === null || typeof options !== "object" || Array.isArray(options)) {
19
+ throw new OpenMatesApiKeyRequiredError(`OpenMatesClient requires an explicit API key. ${MIGRATION}`);
20
+ }
21
+ const record = options;
22
+ for (const key of Object.keys(record)) {
23
+ if (key === "session" || key === "loadStoredSession") {
24
+ throw new OpenMatesApiKeyRequiredError(`OpenMatesClient no longer accepts \`${key}\`; CLI sessions are not SDK credentials. ${MIGRATION}`);
25
+ }
26
+ if (!ALLOWED_OPTIONS.has(key)) throw new OpenMatesConfigError(`Unknown OpenMatesClient option: ${key}`);
27
+ }
28
+ if (typeof record.apiKey !== "string" || record.apiKey.trim() === "") {
29
+ throw new OpenMatesApiKeyRequiredError(`OpenMatesClient requires an explicit API key. ${MIGRATION}`);
30
+ }
31
+ return { ...record, anonymous: false, sdkName: "npm" };
32
+ }
33
+ var OpenMatesClient = class _OpenMatesClient extends OpenMates {
34
+ constructor(options) {
35
+ super(requireApiKeyOptions(options));
36
+ }
37
+ static load(options) {
38
+ return new _OpenMatesClient(options);
39
+ }
40
+ };
41
+
42
+ export {
43
+ SDK_API_KEY_REQUIRED_CODE,
44
+ OpenMatesApiKeyRequiredError,
45
+ OpenMatesClient
46
+ };