@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.
- package/README.md +73 -23
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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
|
|
15
|
-
- `@nimiplatform/sdk/runtime/browser` — Runtime browser transport
|
|
16
|
-
- `@nimiplatform/sdk/types` —
|
|
17
|
-
- `@nimiplatform/sdk/scope` —
|
|
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/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
```
|