@kepoai/provider 1.0.10 → 1.0.11
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 +108 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @kepoai/provider
|
|
2
|
+
|
|
3
|
+
Provider runtime API for building Kepo plugins.
|
|
4
|
+
|
|
5
|
+
Kepo is an AI desktop dashboard for building, installing, and running widget plugins. Use this package inside a Kepo plugin provider to access storage, configuration, browser automation, scheduled events, network requests, and AI calls.
|
|
6
|
+
|
|
7
|
+
Website: [kepo.ai](https://kepo.ai)
|
|
8
|
+
Plugin store: [kepo.ai/store](https://kepo.ai/store)
|
|
9
|
+
|
|
10
|
+
## What This Package Provides
|
|
11
|
+
|
|
12
|
+
`@kepoai/provider` is the TypeScript SDK surface for provider-side plugin logic. It is designed for developers building dashboard widgets, AI dashboard components, desktop widgets, and automation-backed plugins for Kepo.
|
|
13
|
+
|
|
14
|
+
Common use cases:
|
|
15
|
+
|
|
16
|
+
- Store and read provider data with `Storage`.
|
|
17
|
+
- Read and update plugin configuration with `Config`.
|
|
18
|
+
- Run scheduled refresh logic through `Events`.
|
|
19
|
+
- Use the Kepo-managed browser page with `getPage`.
|
|
20
|
+
- Make session-aware HTTP requests with `$fetch`.
|
|
21
|
+
- Call Kepo AI from provider code with `AI.complete` and `AI.stream`.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
pnpm add @kepoai/provider @kepoai/types
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Import
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { $fetch, AI, EventProps, Storage } from '@kepoai/provider/api'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { $fetch, EventProps, Storage } from '@kepoai/provider/api'
|
|
39
|
+
|
|
40
|
+
async function onScheduled(props: EventProps): Promise<void> {
|
|
41
|
+
const response = await $fetch<{ origin: string }>('https://httpbin.org/ip')
|
|
42
|
+
|
|
43
|
+
await Storage.set(`${props.name}:latest-ip`, response)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const exampleProvider = {
|
|
47
|
+
onScheduled,
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API Areas
|
|
52
|
+
|
|
53
|
+
### Storage
|
|
54
|
+
|
|
55
|
+
Use `Storage` for plugin-scoped local data.
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
await Storage.set('latestData', { updatedAt: new Date().toISOString() })
|
|
59
|
+
const latestData = await Storage.get('latestData')
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Config
|
|
63
|
+
|
|
64
|
+
Use `Config` to read and update user-facing plugin settings.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const keyword = await Config.get('keyword', 'AI tools')
|
|
68
|
+
await Config.setError('keyword', '')
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Browser
|
|
72
|
+
|
|
73
|
+
Use `getPage` when a plugin needs a Kepo-managed browser page for login-aware or page-based automation.
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const page = await getPage()
|
|
77
|
+
await page.setDevice('desktop')
|
|
78
|
+
await page.show()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Fetch
|
|
82
|
+
|
|
83
|
+
Use `$fetch` for provider-side HTTP requests.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const data = await $fetch<{ title: string }>('https://example.com/api/item', {
|
|
87
|
+
query: { limit: 10 },
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### AI
|
|
92
|
+
|
|
93
|
+
Use `AI` when a plugin needs Kepo AI capabilities from provider code.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
const result = await AI.complete({
|
|
97
|
+
prompt: 'Summarize the latest dashboard data in one sentence.',
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Related Packages
|
|
102
|
+
|
|
103
|
+
- [`@kepoai/types`](https://www.npmjs.com/package/@kepoai/types): shared plugin, widget, size, and configuration types.
|
|
104
|
+
- [`@kepoai/ui`](https://www.npmjs.com/package/@kepoai/ui): React hooks and viewer-side UI helpers for Kepo widgets.
|
|
105
|
+
|
|
106
|
+
## Keywords
|
|
107
|
+
|
|
108
|
+
Kepo plugin SDK, Kepo provider API, AI dashboard SDK, desktop dashboard plugin, widget plugin development, TypeScript plugin SDK, browser automation plugin, AI widget development.
|