@nimiplatform/sdk 0.5.14 → 0.5.15

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 (2) hide show
  1. package/README.md +73 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,30 +1,80 @@
1
- # sdk
1
+ # @nimiplatform/sdk
2
2
 
3
- SDK 已完成单包收敛:
3
+ TypeScript SDK for Nimi apps and integrations.
4
4
 
5
- - 物理包仅保留 `sdk`
6
- - 对外仅发布 `@nimiplatform/sdk`
7
- - 根入口 `@nimiplatform/sdk` 作为 app 级组合面
8
- - 能力通过稳定子路径暴露:`@nimiplatform/sdk/*`
5
+ `@nimiplatform/sdk` provides the public client surface for Realm services,
6
+ local Runtime access, Nimi App runtime projection, shared SDK types, scope
7
+ helpers, and the Vercel AI SDK provider adapter. Product authority remains in
8
+ `.nimi/spec/**`; this package is the typed application boundary for consumers.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pnpm add @nimiplatform/sdk
14
+ ```
15
+
16
+ ## Quick Start
17
+
18
+ Use the root package for app-level composition:
19
+
20
+ ```ts
21
+ import { createPlatformClient } from '@nimiplatform/sdk';
22
+
23
+ const platform = createPlatformClient({
24
+ realm: { baseUrl: 'https://api.nimi.ai' },
25
+ runtime: { endpoint: 'http://127.0.0.1:7345' },
26
+ });
27
+ ```
28
+
29
+ Generated third-party Nimi App scaffolds use the app-runtime projection helper:
30
+
31
+ ```ts
32
+ import { createNimiAppRuntimePlatformClient } from '@nimiplatform/sdk';
33
+
34
+ const projection = await createNimiAppRuntimePlatformClient({
35
+ mode: 'third-party-nimi-app',
36
+ appId: 'my-nimi-app',
37
+ });
38
+ ```
9
39
 
10
40
  ## Public Subpaths
11
41
 
12
- - `@nimiplatform/sdk` — app-level composition entry (`createPlatformClient`)
42
+ - `@nimiplatform/sdk` — app-level composition entry
43
+ - `@nimiplatform/sdk/app` — Nimi App auth and runtime projection types
13
44
  - `@nimiplatform/sdk/realm` — Realm cloud state integration
14
- - `@nimiplatform/sdk/runtime` — Runtime core (Node/gRPC transport)
15
- - `@nimiplatform/sdk/runtime/browser` — Runtime browser transport (Tauri IPC / HTTP)
16
- - `@nimiplatform/sdk/types` — Shared type definitions
17
- - `@nimiplatform/sdk/scope` — Scope and capability management
45
+ - `@nimiplatform/sdk/runtime` — Runtime Node/gRPC transport
46
+ - `@nimiplatform/sdk/runtime/browser` — Runtime browser transport
47
+ - `@nimiplatform/sdk/types` — shared type definitions
48
+ - `@nimiplatform/sdk/scope` — scope and capability helpers
18
49
  - `@nimiplatform/sdk/ai-provider` — Vercel AI SDK provider adapter
19
- - `@nimiplatform/sdk/mod` — Mod system entry
20
- - `@nimiplatform/sdk/mod/shell` — Mod shell utilities
21
- - `@nimiplatform/sdk/mod/lifecycle` — Mod lifecycle hooks
22
- - `@nimiplatform/sdk/mod/storage` — Mod storage system
23
-
24
- ## Guardrails
25
-
26
- - 禁止 legacy 包导入(`sdk-realm/sdk-runtime/sdk-types/mod-sdk/ai-provider`)
27
- - 禁止 `@nimiplatform/sdk/realm/core|models|services|generated` 深层导入
28
- - 第一方 app/docs/examples 默认使用 `createPlatformClient()`,子路径仅在 low-level escape hatch 或 domain-specific 语境下直接使用
29
- - `reasonCode` 必须使用 `ReasonCode` 常量
30
- - TypeScript 统一 `strict + noImplicitAny`
50
+ - `@nimiplatform/sdk/world` — world-facing SDK types and helpers
51
+
52
+ ## Runtime Example
53
+
54
+ ```ts
55
+ import { createRuntimeClient } from '@nimiplatform/sdk/runtime';
56
+
57
+ const runtime = createRuntimeClient({
58
+ endpoint: 'http://127.0.0.1:7345',
59
+ });
60
+
61
+ const result = await runtime.ai.text.generate({
62
+ prompt: 'Write a one sentence greeting from Nimi.',
63
+ });
64
+ ```
65
+
66
+ ## Package Boundaries
67
+
68
+ - Use `createPlatformClient()` for app-level composition.
69
+ - Use `createNimiAppRuntimePlatformClient()` in third-party Nimi App
70
+ scaffolds that need the admitted Runtime app projection.
71
+ - Use subpath imports only when a consumer intentionally targets a narrower
72
+ Realm, Runtime, scope, app, or provider surface.
73
+ - Do not import generated or private deep paths.
74
+
75
+ ## Verification
76
+
77
+ ```bash
78
+ pnpm --filter @nimiplatform/sdk build
79
+ pnpm --filter @nimiplatform/sdk test
80
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimiplatform/sdk",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "license": "Apache-2.0",
5
5
  "private": false,
6
6
  "repository": {