@anuma/sdk 1.0.0 → 1.1.1
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 +54 -53
- package/dist/api/spec.cjs +30 -0
- package/dist/api/spec.d.mts +3 -0
- package/dist/api/spec.d.ts +3 -0
- package/dist/api/spec.mjs +12 -0
- package/dist/chunk-4ETHWSXJ.mjs +25 -0
- package/dist/client/index.cjs +2344 -0
- package/dist/client/index.d.mts +10368 -0
- package/dist/client/index.d.ts +10368 -0
- package/dist/client/index.mjs +2168 -0
- package/dist/clientConfig-WITO4T6L.mjs +12 -0
- package/dist/constants/index.cjs +30 -0
- package/dist/constants/index.d.mts +20 -0
- package/dist/constants/index.d.ts +20 -0
- package/dist/constants/index.mjs +5 -0
- package/dist/design/index.cjs +1523 -0
- package/dist/design/index.d.mts +561 -0
- package/dist/design/index.d.ts +561 -0
- package/dist/design/index.mjs +1468 -0
- package/dist/expo/chunk-3HZFU3PV.mjs +5283 -0
- package/dist/expo/chunk-DFVCS3QQ.mjs +246 -0
- package/dist/{react/chunk-MJJIYFAX.mjs → expo/chunk-GYKJOWEO.mjs} +13 -1
- package/dist/expo/chunk-Y7XT2VNQ.mjs +646 -0
- package/dist/expo/clientConfig-VPOGQRNP.mjs +12 -0
- package/dist/expo/consolidate-HEMQGOUD.mjs +131 -0
- package/dist/expo/index.cjs +16904 -6750
- package/dist/expo/index.d.mts +5755 -1474
- package/dist/expo/index.d.ts +5755 -1474
- package/dist/expo/index.mjs +9718 -6182
- package/dist/expo/recall-MCB3TVBW.mjs +8 -0
- package/dist/index.cjs +2992 -42
- package/dist/index.d.mts +7719 -1835
- package/dist/index.d.ts +7719 -1835
- package/dist/index.mjs +2859 -39
- package/dist/next/index.cjs +6 -2
- package/dist/next/index.d.mts +24 -1
- package/dist/next/index.d.ts +24 -1
- package/dist/next/index.mjs +6 -2
- package/dist/pii/transformers.cjs +126 -0
- package/dist/pii/transformers.d.mts +103 -0
- package/dist/pii/transformers.d.ts +103 -0
- package/dist/pii/transformers.mjs +90 -0
- package/dist/react/chunk-DFVCS3QQ.mjs +246 -0
- package/dist/react/chunk-ELDXIXRE.mjs +5656 -0
- package/dist/{expo/chunk-MJJIYFAX.mjs → react/chunk-GYKJOWEO.mjs} +13 -1
- package/dist/react/chunk-TP6CJZ25.mjs +645 -0
- package/dist/react/clientConfig-VPOGQRNP.mjs +12 -0
- package/dist/react/consolidate-IJH7LD2T.mjs +131 -0
- package/dist/react/index.cjs +25683 -11143
- package/dist/react/index.d.mts +7399 -1393
- package/dist/react/index.d.ts +7399 -1393
- package/dist/react/index.mjs +16709 -9196
- package/dist/react/recall-CSOMIT4H.mjs +8 -0
- package/dist/server/chunk-FMGZTVXQ.mjs +62 -0
- package/dist/server/chunk-G3DC7QBH.mjs +19457 -0
- package/dist/server/chunk-PXN5Q3MD.mjs +643 -0
- package/dist/server/chunk-RCCKRTBI.mjs +230 -0
- package/dist/server/clientConfig-GMADOBPK.mjs +12 -0
- package/dist/server/consolidate-A2ZIX5WF.mjs +131 -0
- package/dist/server/index.cjs +32161 -0
- package/dist/server/index.d.mts +7319 -0
- package/dist/server/index.d.ts +7319 -0
- package/dist/server/index.mjs +11217 -0
- package/dist/server/recall-LFYTTIIY.mjs +8 -0
- package/dist/tools/index.cjs +12682 -34
- package/dist/tools/index.d.mts +2733 -18
- package/dist/tools/index.d.ts +2733 -18
- package/dist/tools/index.mjs +12565 -33
- package/dist/utils/index.cjs +165 -0
- package/dist/utils/index.d.mts +14 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.mjs +145 -0
- package/dist/vercel/index.d.mts +0 -3
- package/dist/vercel/index.d.ts +0 -3
- package/package.json +127 -16
- package/dist/expo/chunk-LJYAMK62.mjs +0 -25
- package/dist/expo/chunk-PJCZO4BQ.mjs +0 -25
- package/dist/expo/clientConfig-2MI4KULF.mjs +0 -10
- package/dist/expo/clientConfig-QDAXFL3W.mjs +0 -10
- package/dist/expo/clientConfig-R4IOW7I2.mjs +0 -10
- package/dist/react/chunk-LJYAMK62.mjs +0 -25
- package/dist/react/chunk-PJCZO4BQ.mjs +0 -25
- package/dist/react/clientConfig-2MI4KULF.mjs +0 -10
- package/dist/react/clientConfig-QDAXFL3W.mjs +0 -10
- package/dist/react/clientConfig-R4IOW7I2.mjs +0 -10
- package/dist/tools/chunk-KDFGY4SK.mjs +0 -13
- package/dist/tools/clientConfig-RMDOT5YM.mjs +0 -10
package/README.md
CHANGED
|
@@ -1,98 +1,99 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Anuma SDK
|
|
2
2
|
|
|
3
|
-
A TypeScript SDK
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A TypeScript SDK for building AI-powered applications with streaming chat
|
|
4
|
+
completions, long-term memory, tool calling, and end-to-end encryption.
|
|
5
|
+
|
|
6
|
+
To learn more, check out the [Documentation](https://docs.anuma.ai/).
|
|
6
7
|
|
|
7
8
|
## Installation
|
|
8
9
|
|
|
9
10
|
```bash
|
|
10
|
-
|
|
11
|
+
npm install @anuma/sdk
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
> under the `next` tag (released on every merge to the `main` branch). Check out
|
|
15
|
-
> npm to see the latest version.
|
|
16
|
-
|
|
17
|
-
## Configuration
|
|
14
|
+
### Testing prereleases
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
Stable releases go to the default `latest` tag (the command above). Prerelease
|
|
17
|
+
builds for trying out unreleased changes are published to the `next` tag —
|
|
18
|
+
install them explicitly:
|
|
20
19
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
API_URL=https://portal.anuma-dev.ai
|
|
20
|
+
```bash
|
|
21
|
+
npm install @anuma/sdk@next
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
These carry a `X.Y.Z-next.<timestamp>` version and never affect `latest`.
|
|
25
|
+
Maintainers publish them on demand via the **Publish Next (prerelease)** GitHub
|
|
26
|
+
Actions workflow.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
expects a Privy identity token.
|
|
28
|
+
## Getting Started
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const { identityToken } = useIdentityToken();
|
|
35
|
-
```
|
|
30
|
+
Create an app on the [Anuma Dashboard](https://dashboard.anuma.ai/) to get your
|
|
31
|
+
API key or configure Privy authentication.
|
|
36
32
|
|
|
37
|
-
##
|
|
33
|
+
## Usage
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
### React Hooks
|
|
40
36
|
|
|
41
|
-
```
|
|
37
|
+
```tsx
|
|
42
38
|
import { useChat } from "@anuma/sdk/react";
|
|
43
39
|
|
|
44
40
|
const { sendMessage, isLoading, stop } = useChat({
|
|
45
|
-
getToken: async () =>
|
|
46
|
-
|
|
47
|
-
onError: (error) => console.error("Chat error:", error),
|
|
48
|
-
onData: (chunk) => console.log("Received chunk:", chunk),
|
|
41
|
+
getToken: async () => token,
|
|
42
|
+
onData: (chunk) => console.log(chunk),
|
|
49
43
|
});
|
|
50
44
|
|
|
51
45
|
await sendMessage({
|
|
52
46
|
messages: [{ role: "user", content: [{ type: "text", text: "Hello!" }] }],
|
|
53
|
-
model: "
|
|
47
|
+
model: "fireworks/accounts/fireworks/models/kimi-k2p5",
|
|
54
48
|
});
|
|
55
49
|
```
|
|
56
50
|
|
|
57
|
-
|
|
51
|
+
### API Functions
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
import { postApiV1Responses } from "@anuma/sdk";
|
|
53
|
+
```ts
|
|
54
|
+
import { postApiV1Responses } from "@anuma/sdk/client";
|
|
63
55
|
|
|
64
56
|
const response = await postApiV1Responses({
|
|
65
57
|
body: {
|
|
66
58
|
messages: [
|
|
67
|
-
{ role: "user", content: [{ type: "text", text: "
|
|
59
|
+
{ role: "user", content: [{ type: "text", text: "Hello!" }] },
|
|
68
60
|
],
|
|
69
|
-
model: "
|
|
61
|
+
model: "fireworks/accounts/fireworks/models/kimi-k2p5",
|
|
70
62
|
},
|
|
71
63
|
headers: {
|
|
72
|
-
Authorization: `Bearer ${
|
|
64
|
+
Authorization: `Bearer ${apiKey}`,
|
|
73
65
|
},
|
|
74
66
|
});
|
|
75
67
|
```
|
|
76
68
|
|
|
77
|
-
|
|
69
|
+
### Platforms
|
|
78
70
|
|
|
79
|
-
The SDK provides
|
|
80
|
-
applications:
|
|
71
|
+
The SDK provides entry points for different platforms:
|
|
81
72
|
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
- **Web search** integration
|
|
86
|
-
- **PDF and image text extraction** (OCR)
|
|
87
|
-
- **Memory and context management** for conversational AI
|
|
88
|
-
- **Wallet-based encryption** for secure data storage
|
|
73
|
+
- `@anuma/sdk/react` — React hooks
|
|
74
|
+
- `@anuma/sdk/expo` — React Native / Expo
|
|
75
|
+
- `@anuma/sdk/client` — Generated API client and types
|
|
89
76
|
|
|
90
|
-
##
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
The SDK gives you access to a unified API across multiple LLM providers through
|
|
80
|
+
a single integration. Key capabilities include:
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
- Streaming chat completions with tool calling and auto-execution
|
|
83
|
+
- Extended thinking and reasoning support
|
|
84
|
+
- Long-term memory with semantic search and encrypted storage
|
|
85
|
+
- Best-effort client-side PII redaction (see [PII_REDACTION.md](PII_REDACTION.md))
|
|
86
|
+
- Voice recording and transcription via Whisper
|
|
87
|
+
- PDF and image text extraction (OCR)
|
|
88
|
+
- Phone call integration
|
|
89
|
+
- End-to-end encryption with wallet-based key management
|
|
90
|
+
- Credit and subscription management
|
|
91
|
+
|
|
92
|
+
## Documentation
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
https://docs.anuma.ai/
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
repo](https://github.com/zeta-chain/ai-examples).
|
|
96
|
+
## Contributing
|
|
98
97
|
|
|
98
|
+
Contributions are welcome. Please open an issue or pull request on
|
|
99
|
+
[GitHub](https://github.com/anuma-ai/sdk).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/api/spec.ts
|
|
21
|
+
var spec_exports = {};
|
|
22
|
+
__export(spec_exports, {
|
|
23
|
+
spec: () => spec
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(spec_exports);
|
|
26
|
+
var spec = require("@anuma/portal/swagger.json");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
spec
|
|
30
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/api/spec.ts
|
|
9
|
+
var spec = __require("@anuma/portal/swagger.json");
|
|
10
|
+
export {
|
|
11
|
+
spec
|
|
12
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/clientConfig.ts
|
|
2
|
+
var DEFAULT_BASE_URL = "https://portal.anuma-dev.ai";
|
|
3
|
+
function readGlobal(key) {
|
|
4
|
+
if (typeof globalThis === "undefined") return void 0;
|
|
5
|
+
const value = globalThis[key];
|
|
6
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
7
|
+
}
|
|
8
|
+
function resolveBaseUrl() {
|
|
9
|
+
const fromProcess = typeof process !== "undefined" ? process.env.API_URL || process.env.NEXT_PUBLIC_API_URL || process.env.EXPO_PUBLIC_API_URL : void 0;
|
|
10
|
+
const fromGlobal = readGlobal("API_URL") ?? readGlobal("NEXT_PUBLIC_API_URL") ?? readGlobal("EXPO_PUBLIC_API_URL");
|
|
11
|
+
return (fromProcess || fromGlobal || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
12
|
+
}
|
|
13
|
+
var BASE_URL = resolveBaseUrl();
|
|
14
|
+
var MCP_R2_DOMAIN = "4cf0e0ea50b97e72386fcf2f92a2d4e8.r2.cloudflarestorage.com";
|
|
15
|
+
var createClientConfig = (config) => ({
|
|
16
|
+
...config,
|
|
17
|
+
baseUrl: BASE_URL
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
resolveBaseUrl,
|
|
22
|
+
BASE_URL,
|
|
23
|
+
MCP_R2_DOMAIN,
|
|
24
|
+
createClientConfig
|
|
25
|
+
};
|