@komputer-ai/sdk 0.11.3 → 0.11.5
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/.openapi-generator/FILES +0 -1
- package/README.md +121 -150
- package/package.json +1 -1
package/.openapi-generator/FILES
CHANGED
package/README.md
CHANGED
|
@@ -1,172 +1,143 @@
|
|
|
1
|
-
# @komputer-ai/sdk
|
|
1
|
+
# @komputer-ai/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for the [komputer.ai](https://komputer.ai) platform. Create agents, send tasks, and stream real-time results.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
First, install the SDK from npm.
|
|
5
|
+
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
npm install @komputer-ai/sdk
|
|
8
|
+
npm install @komputer-ai/sdk
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
## Quick start
|
|
15
12
|
|
|
16
13
|
```ts
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const data = await api.agentsNameWsGet(body);
|
|
34
|
-
console.log(data);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error(error);
|
|
37
|
-
}
|
|
14
|
+
import { KomputerClient } from "@komputer-ai/sdk";
|
|
15
|
+
|
|
16
|
+
const client = new KomputerClient("http://localhost:8080");
|
|
17
|
+
|
|
18
|
+
// Create an agent
|
|
19
|
+
const agent = await client.createAgent({
|
|
20
|
+
name: "my-agent",
|
|
21
|
+
instructions: "Analyze our Kubernetes cluster",
|
|
22
|
+
model: "claude-sonnet-4-6",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Stream events
|
|
26
|
+
for await (const event of await client.watchAgent("my-agent")) {
|
|
27
|
+
if (event.type === "text") console.log(event.payload.content);
|
|
28
|
+
if (event.type === "task_completed") break;
|
|
38
29
|
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- Full REST API coverage: agents, memories, skills, schedules, secrets, connectors, offices, templates
|
|
35
|
+
- WebSocket event streaming with automatic history prefetch
|
|
36
|
+
- Idempotent create methods (safe to call twice without errors)
|
|
37
|
+
- TypeScript types for all request/response models
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### Client
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
```ts
|
|
44
|
+
const client = new KomputerClient(baseUrl?: string);
|
|
42
45
|
```
|
|
43
46
|
|
|
47
|
+
### Agents
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*AgentsApi* | [**createAgent**](docs/AgentsApi.md#createagentoperation) | **POST** /agents | Create agent or send task
|
|
56
|
-
*AgentsApi* | [**deleteAgent**](docs/AgentsApi.md#deleteagent) | **DELETE** /agents/{name} | Delete agent
|
|
57
|
-
*AgentsApi* | [**getAgent**](docs/AgentsApi.md#getagent) | **GET** /agents/{name} | Get agent details
|
|
58
|
-
*AgentsApi* | [**getAgentEvents**](docs/AgentsApi.md#getagentevents) | **GET** /agents/{name}/events | Get agent events
|
|
59
|
-
*AgentsApi* | [**listAgents**](docs/AgentsApi.md#listagents) | **GET** /agents | List agents
|
|
60
|
-
*AgentsApi* | [**patchAgent**](docs/AgentsApi.md#patchagentoperation) | **PATCH** /agents/{name} | Patch agent
|
|
61
|
-
*ConnectorsApi* | [**createConnector**](docs/ConnectorsApi.md#createconnectoroperation) | **POST** /connectors | Create connector
|
|
62
|
-
*ConnectorsApi* | [**deleteConnector**](docs/ConnectorsApi.md#deleteconnector) | **DELETE** /connectors/{name} | Delete connector
|
|
63
|
-
*ConnectorsApi* | [**getConnector**](docs/ConnectorsApi.md#getconnector) | **GET** /connectors/{name} | Get connector details
|
|
64
|
-
*ConnectorsApi* | [**listConnectorTools**](docs/ConnectorsApi.md#listconnectortools) | **GET** /connectors/{name}/tools | List connector tools
|
|
65
|
-
*ConnectorsApi* | [**listConnectors**](docs/ConnectorsApi.md#listconnectors) | **GET** /connectors | List connectors
|
|
66
|
-
*MemoriesApi* | [**createMemory**](docs/MemoriesApi.md#creatememoryoperation) | **POST** /memories | Create memory
|
|
67
|
-
*MemoriesApi* | [**deleteMemory**](docs/MemoriesApi.md#deletememory) | **DELETE** /memories/{name} | Delete memory
|
|
68
|
-
*MemoriesApi* | [**getMemory**](docs/MemoriesApi.md#getmemory) | **GET** /memories/{name} | Get memory details
|
|
69
|
-
*MemoriesApi* | [**listMemories**](docs/MemoriesApi.md#listmemories) | **GET** /memories | List memories
|
|
70
|
-
*MemoriesApi* | [**patchMemory**](docs/MemoriesApi.md#patchmemoryoperation) | **PATCH** /memories/{name} | Patch memory
|
|
71
|
-
*OfficesApi* | [**deleteOffice**](docs/OfficesApi.md#deleteoffice) | **DELETE** /offices/{name} | Delete office
|
|
72
|
-
*OfficesApi* | [**getOffice**](docs/OfficesApi.md#getoffice) | **GET** /offices/{name} | Get office details
|
|
73
|
-
*OfficesApi* | [**getOfficeEvents**](docs/OfficesApi.md#getofficeevents) | **GET** /offices/{name}/events | Get office events
|
|
74
|
-
*OfficesApi* | [**listOffices**](docs/OfficesApi.md#listoffices) | **GET** /offices | List offices
|
|
75
|
-
*SchedulesApi* | [**createSchedule**](docs/SchedulesApi.md#createscheduleoperation) | **POST** /schedules | Create schedule
|
|
76
|
-
*SchedulesApi* | [**deleteSchedule**](docs/SchedulesApi.md#deleteschedule) | **DELETE** /schedules/{name} | Delete schedule
|
|
77
|
-
*SchedulesApi* | [**getSchedule**](docs/SchedulesApi.md#getschedule) | **GET** /schedules/{name} | Get schedule details
|
|
78
|
-
*SchedulesApi* | [**listSchedules**](docs/SchedulesApi.md#listschedules) | **GET** /schedules | List schedules
|
|
79
|
-
*SchedulesApi* | [**patchSchedule**](docs/SchedulesApi.md#patchscheduleoperation) | **PATCH** /schedules/{name} | Patch schedule
|
|
80
|
-
*SecretsApi* | [**createSecret**](docs/SecretsApi.md#createsecretoperation) | **POST** /secrets | Create managed secret
|
|
81
|
-
*SecretsApi* | [**deleteSecret**](docs/SecretsApi.md#deletesecret) | **DELETE** /secrets/{name} | Delete managed secret
|
|
82
|
-
*SecretsApi* | [**listSecrets**](docs/SecretsApi.md#listsecrets) | **GET** /secrets | List secrets
|
|
83
|
-
*SecretsApi* | [**updateSecret**](docs/SecretsApi.md#updatesecretoperation) | **PATCH** /secrets/{name} | Update managed secret
|
|
84
|
-
*SkillsApi* | [**createSkill**](docs/SkillsApi.md#createskilloperation) | **POST** /skills | Create skill
|
|
85
|
-
*SkillsApi* | [**deleteSkill**](docs/SkillsApi.md#deleteskill) | **DELETE** /skills/{name} | Delete skill
|
|
86
|
-
*SkillsApi* | [**getSkill**](docs/SkillsApi.md#getskill) | **GET** /skills/{name} | Get skill details
|
|
87
|
-
*SkillsApi* | [**listSkills**](docs/SkillsApi.md#listskills) | **GET** /skills | List skills
|
|
88
|
-
*SkillsApi* | [**patchSkill**](docs/SkillsApi.md#patchskilloperation) | **PATCH** /skills/{name} | Patch skill
|
|
89
|
-
*TemplatesApi* | [**listTemplates**](docs/TemplatesApi.md#listtemplates) | **GET** /templates | List agent templates
|
|
90
|
-
*TemplatesApi* | [**namespacesGet**](docs/TemplatesApi.md#namespacesget) | **GET** /namespaces | List namespaces
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### Models
|
|
94
|
-
|
|
95
|
-
- [AgentListResponse](docs/AgentListResponse.md)
|
|
96
|
-
- [AgentResponse](docs/AgentResponse.md)
|
|
97
|
-
- [ConnectorResponse](docs/ConnectorResponse.md)
|
|
98
|
-
- [CreateAgentRequest](docs/CreateAgentRequest.md)
|
|
99
|
-
- [CreateConnectorRequest](docs/CreateConnectorRequest.md)
|
|
100
|
-
- [CreateMemoryRequest](docs/CreateMemoryRequest.md)
|
|
101
|
-
- [CreateScheduleAgentSpec](docs/CreateScheduleAgentSpec.md)
|
|
102
|
-
- [CreateScheduleRequest](docs/CreateScheduleRequest.md)
|
|
103
|
-
- [CreateSecretRequest](docs/CreateSecretRequest.md)
|
|
104
|
-
- [CreateSkillRequest](docs/CreateSkillRequest.md)
|
|
105
|
-
- [MemoryResponse](docs/MemoryResponse.md)
|
|
106
|
-
- [OfficeListResponse](docs/OfficeListResponse.md)
|
|
107
|
-
- [OfficeMemberResponse](docs/OfficeMemberResponse.md)
|
|
108
|
-
- [OfficeResponse](docs/OfficeResponse.md)
|
|
109
|
-
- [PatchAgentRequest](docs/PatchAgentRequest.md)
|
|
110
|
-
- [PatchMemoryRequest](docs/PatchMemoryRequest.md)
|
|
111
|
-
- [PatchScheduleRequest](docs/PatchScheduleRequest.md)
|
|
112
|
-
- [PatchSkillRequest](docs/PatchSkillRequest.md)
|
|
113
|
-
- [ScheduleListResponse](docs/ScheduleListResponse.md)
|
|
114
|
-
- [ScheduleResponse](docs/ScheduleResponse.md)
|
|
115
|
-
- [SecretListResponse](docs/SecretListResponse.md)
|
|
116
|
-
- [SecretResponse](docs/SecretResponse.md)
|
|
117
|
-
- [SkillResponse](docs/SkillResponse.md)
|
|
118
|
-
- [UpdateSecretRequest](docs/UpdateSecretRequest.md)
|
|
119
|
-
|
|
120
|
-
### Authorization
|
|
121
|
-
|
|
122
|
-
Endpoints do not require authorization.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
## About
|
|
126
|
-
|
|
127
|
-
This TypeScript SDK client supports the [Fetch API](https://fetch.spec.whatwg.org/)
|
|
128
|
-
and is automatically generated by the
|
|
129
|
-
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
130
|
-
|
|
131
|
-
- API version: `1.0`
|
|
132
|
-
- Package version: `0.1.0`
|
|
133
|
-
- Generator version: `7.21.0`
|
|
134
|
-
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
135
|
-
|
|
136
|
-
The generated npm module supports the following:
|
|
137
|
-
|
|
138
|
-
- Environments
|
|
139
|
-
* Node.js
|
|
140
|
-
* Webpack
|
|
141
|
-
* Browserify
|
|
142
|
-
- Language levels
|
|
143
|
-
* ES5 - you must have a Promises/A+ library installed
|
|
144
|
-
* ES6
|
|
145
|
-
- Module systems
|
|
146
|
-
* CommonJS
|
|
147
|
-
* ES6 module system
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
## Development
|
|
151
|
-
|
|
152
|
-
### Building
|
|
153
|
-
|
|
154
|
-
To build the TypeScript source code, you need to have Node.js and npm installed.
|
|
155
|
-
After cloning the repository, navigate to the project directory and run:
|
|
49
|
+
```ts
|
|
50
|
+
await client.createAgent({ name, instructions, model?, ... })
|
|
51
|
+
await client.getAgent(name)
|
|
52
|
+
await client.listAgents()
|
|
53
|
+
await client.patchAgent({ name, instructions?, model?, ... })
|
|
54
|
+
await client.deleteAgent(name)
|
|
55
|
+
await client.cancelAgentTask(name)
|
|
56
|
+
await client.getAgentEvents(name)
|
|
57
|
+
const stream = await client.watchAgent(name) // WebSocket + history
|
|
58
|
+
```
|
|
156
59
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
60
|
+
### Memories
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
await client.createMemory({ name, content, description? })
|
|
64
|
+
await client.getMemory(name)
|
|
65
|
+
await client.listMemories()
|
|
66
|
+
await client.patchMemory({ name, content?, description? })
|
|
67
|
+
await client.deleteMemory(name)
|
|
160
68
|
```
|
|
161
69
|
|
|
162
|
-
###
|
|
70
|
+
### Skills
|
|
163
71
|
|
|
164
|
-
|
|
72
|
+
```ts
|
|
73
|
+
await client.createSkill({ name, content, description })
|
|
74
|
+
await client.getSkill(name)
|
|
75
|
+
await client.listSkills()
|
|
76
|
+
await client.patchSkill({ name, content?, description? })
|
|
77
|
+
await client.deleteSkill(name)
|
|
78
|
+
```
|
|
165
79
|
|
|
166
|
-
|
|
167
|
-
|
|
80
|
+
### Schedules
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
await client.createSchedule({ name, instructions, schedule, ... })
|
|
84
|
+
await client.getSchedule(name)
|
|
85
|
+
await client.listSchedules()
|
|
86
|
+
await client.patchSchedule({ name, schedule? })
|
|
87
|
+
await client.deleteSchedule(name)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Secrets
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
await client.createSecret({ name, data })
|
|
94
|
+
await client.listSecrets()
|
|
95
|
+
await client.updateSecret({ name, data })
|
|
96
|
+
await client.deleteSecret(name)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Connectors
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
await client.createConnector({ name, service, url, ... })
|
|
103
|
+
await client.getConnector(name)
|
|
104
|
+
await client.listConnectors()
|
|
105
|
+
await client.deleteConnector(name)
|
|
106
|
+
await client.listConnectorTools(name)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Event streaming
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { KomputerClient } from "@komputer-ai/sdk";
|
|
113
|
+
import type { AgentEvent } from "@komputer-ai/sdk";
|
|
114
|
+
|
|
115
|
+
const stream = await client.watchAgent("my-agent");
|
|
116
|
+
|
|
117
|
+
for await (const event of stream) {
|
|
118
|
+
switch (event.type) {
|
|
119
|
+
case "task_started": // Agent began working
|
|
120
|
+
case "thinking": // Model is reasoning
|
|
121
|
+
case "text": // Text output (event.payload.content)
|
|
122
|
+
case "tool_call": // Tool invocation
|
|
123
|
+
case "tool_result": // Tool response
|
|
124
|
+
case "task_completed": // Done (event.payload.cost_usd)
|
|
125
|
+
case "error": // Error occurred
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Direct API access
|
|
131
|
+
|
|
132
|
+
For advanced use cases, the underlying generated API clients are available:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { AgentsApi, Configuration } from "@komputer-ai/sdk";
|
|
136
|
+
|
|
137
|
+
const config = new Configuration({ basePath: "http://localhost:8080/api/v1" });
|
|
138
|
+
const agents = new AgentsApi(config);
|
|
168
139
|
```
|
|
169
140
|
|
|
170
141
|
## License
|
|
171
142
|
|
|
172
|
-
|
|
143
|
+
MIT
|