@alexrockshouts/miri-sdk 0.0.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.
@@ -0,0 +1,302 @@
1
+ export interface MiriSession {
2
+ id?: string;
3
+ client_id?: string;
4
+ total_tokens?: number;
5
+ messages?: MiriMessage[];
6
+ }
7
+ export interface MiriMessage {
8
+ role?: string;
9
+ content?: string;
10
+ }
11
+ export interface MiriUsage {
12
+ prompt_tokens?: number;
13
+ completion_tokens?: number;
14
+ total_tokens?: number;
15
+ }
16
+ export interface MiriHumanInfo {
17
+ id?: string;
18
+ data?: Record<string, string>;
19
+ notes?: string;
20
+ }
21
+ export interface MiriSkill {
22
+ name?: string;
23
+ description?: string;
24
+ version?: string;
25
+ tags?: string[];
26
+ }
27
+ export interface MiriConfig {
28
+ storage_dir?: string;
29
+ server?: {
30
+ addr?: string;
31
+ key?: string;
32
+ admin_user?: string;
33
+ admin_pass?: string;
34
+ };
35
+ models?: {
36
+ mode?: string;
37
+ providers?: Record<string, MiriProviderConfig>;
38
+ };
39
+ agents?: {
40
+ debug?: boolean;
41
+ defaults?: {
42
+ model?: {
43
+ primary?: string;
44
+ fallbacks?: string[];
45
+ };
46
+ };
47
+ };
48
+ channels?: {
49
+ whatsapp?: {
50
+ enabled?: boolean;
51
+ allowlist?: string[];
52
+ blocklist?: string[];
53
+ };
54
+ irc?: {
55
+ enabled?: boolean;
56
+ host?: string;
57
+ port?: number;
58
+ tls?: boolean;
59
+ nick?: string;
60
+ user?: string;
61
+ realname?: string;
62
+ channels?: string[];
63
+ nickserv?: {
64
+ enabled?: boolean;
65
+ password?: string;
66
+ };
67
+ };
68
+ };
69
+ }
70
+ export interface MiriProviderConfig {
71
+ baseUrl?: string;
72
+ apiKey?: string;
73
+ api?: string;
74
+ models?: MiriModelConfig[];
75
+ }
76
+ export interface MiriModelConfig {
77
+ id?: string;
78
+ name?: string;
79
+ contextWindow?: number;
80
+ maxTokens?: number;
81
+ reasoning?: boolean;
82
+ input?: string[];
83
+ cost?: {
84
+ input?: number;
85
+ output?: number;
86
+ cacheRead?: number;
87
+ cacheWrite?: number;
88
+ };
89
+ }
90
+ import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios";
91
+ export type QueryParamsType = Record<string | number, any>;
92
+ export interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
93
+ /** set parameter to `true` for call `securityWorker` for this request */
94
+ secure?: boolean;
95
+ /** request path */
96
+ path: string;
97
+ /** content type of request body */
98
+ type?: ContentType;
99
+ /** query params */
100
+ query?: QueryParamsType;
101
+ /** format of response (i.e. response.json() -> format: "json") */
102
+ format?: ResponseType;
103
+ /** request body */
104
+ body?: unknown;
105
+ }
106
+ export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
107
+ export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
108
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
109
+ secure?: boolean;
110
+ format?: ResponseType;
111
+ }
112
+ export declare enum ContentType {
113
+ Json = "application/json",
114
+ JsonApi = "application/vnd.api+json",
115
+ FormData = "multipart/form-data",
116
+ UrlEncoded = "application/x-www-form-urlencoded",
117
+ Text = "text/plain"
118
+ }
119
+ export declare class HttpClient<SecurityDataType = unknown> {
120
+ instance: AxiosInstance;
121
+ private securityData;
122
+ private securityWorker?;
123
+ private secure?;
124
+ private format?;
125
+ constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
126
+ setSecurityData: (data: SecurityDataType | null) => void;
127
+ protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
128
+ protected stringifyFormItem(formItem: unknown): string;
129
+ protected createFormData(input: Record<string, unknown>): FormData;
130
+ request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<AxiosResponse<T>>;
131
+ }
132
+ /**
133
+ * @title Miri Autonomous Agent API
134
+ * @version 1.0.0
135
+ * @baseUrl http://localhost:8080
136
+ *
137
+ * API for interacting with the Miri autonomous agent service.
138
+ */
139
+ export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
140
+ api: {
141
+ /**
142
+ * No description
143
+ *
144
+ * @name V1PromptCreate
145
+ * @summary Send a prompt to the agent
146
+ * @request POST:/api/v1/prompt
147
+ * @secure
148
+ */
149
+ v1PromptCreate: (data: {
150
+ prompt?: string;
151
+ session_id?: string;
152
+ model?: string;
153
+ temperature?: number;
154
+ max_tokens?: number;
155
+ }, params?: RequestParams) => Promise<AxiosResponse<{
156
+ response?: string;
157
+ }, any, {}>>;
158
+ /**
159
+ * No description
160
+ *
161
+ * @name V1PromptStreamList
162
+ * @summary Stream a prompt response via SSE
163
+ * @request GET:/api/v1/prompt/stream
164
+ * @secure
165
+ */
166
+ v1PromptStreamList: (query: {
167
+ prompt: string;
168
+ session_id?: string;
169
+ model?: string;
170
+ }, params?: RequestParams) => Promise<AxiosResponse<string, any, {}>>;
171
+ /**
172
+ * No description
173
+ *
174
+ * @name V1InteractionCreate
175
+ * @summary Manage sessions or check global status
176
+ * @request POST:/api/v1/interaction
177
+ * @secure
178
+ */
179
+ v1InteractionCreate: (data: {
180
+ action?: "new" | "status";
181
+ client_id?: string;
182
+ }, params?: RequestParams) => Promise<AxiosResponse<void, any, {}>>;
183
+ /**
184
+ * No description
185
+ *
186
+ * @name AdminV1HealthList
187
+ * @summary Check health of the admin API
188
+ * @request GET:/api/admin/v1/health
189
+ * @secure
190
+ */
191
+ adminV1HealthList: (params?: RequestParams) => Promise<AxiosResponse<{
192
+ status?: string;
193
+ message?: string;
194
+ }, any, {}>>;
195
+ /**
196
+ * No description
197
+ *
198
+ * @name AdminV1ConfigList
199
+ * @summary Get current configuration
200
+ * @request GET:/api/admin/v1/config
201
+ * @secure
202
+ */
203
+ adminV1ConfigList: (params?: RequestParams) => Promise<AxiosResponse<MiriConfig, any, {}>>;
204
+ /**
205
+ * No description
206
+ *
207
+ * @name AdminV1ConfigCreate
208
+ * @summary Update configuration
209
+ * @request POST:/api/admin/v1/config
210
+ * @secure
211
+ */
212
+ adminV1ConfigCreate: (data: MiriConfig, params?: RequestParams) => Promise<AxiosResponse<void, any, {}>>;
213
+ /**
214
+ * No description
215
+ *
216
+ * @name AdminV1HumanList
217
+ * @summary List all stored human information
218
+ * @request GET:/api/admin/v1/human
219
+ * @secure
220
+ */
221
+ adminV1HumanList: (params?: RequestParams) => Promise<AxiosResponse<MiriHumanInfo[], any, {}>>;
222
+ /**
223
+ * No description
224
+ *
225
+ * @name AdminV1HumanCreate
226
+ * @summary Store human information
227
+ * @request POST:/api/admin/v1/human
228
+ * @secure
229
+ */
230
+ adminV1HumanCreate: (data: MiriHumanInfo, params?: RequestParams) => Promise<AxiosResponse<void, any, {}>>;
231
+ /**
232
+ * No description
233
+ *
234
+ * @name AdminV1SkillsList
235
+ * @summary List all installed skills
236
+ * @request GET:/api/admin/v1/skills
237
+ * @secure
238
+ */
239
+ adminV1SkillsList: (params?: RequestParams) => Promise<AxiosResponse<MiriSkill[], any, {}>>;
240
+ /**
241
+ * No description
242
+ *
243
+ * @name AdminV1ChannelsCreate
244
+ * @summary Perform actions on communication channels
245
+ * @request POST:/api/admin/v1/channels
246
+ * @secure
247
+ */
248
+ adminV1ChannelsCreate: (data: {
249
+ channel?: string;
250
+ action?: "status" | "enroll" | "send" | "devices" | "chat";
251
+ device?: string;
252
+ message?: string;
253
+ prompt?: string;
254
+ }, params?: RequestParams) => Promise<AxiosResponse<void, any, {}>>;
255
+ /**
256
+ * No description
257
+ *
258
+ * @name AdminV1SessionsList
259
+ * @summary List active session IDs
260
+ * @request GET:/api/admin/v1/sessions
261
+ * @secure
262
+ */
263
+ adminV1SessionsList: (params?: RequestParams) => Promise<AxiosResponse<string[], any, {}>>;
264
+ /**
265
+ * No description
266
+ *
267
+ * @name AdminV1SessionsDetail
268
+ * @summary Get session details
269
+ * @request GET:/api/admin/v1/sessions/{id}
270
+ * @secure
271
+ */
272
+ adminV1SessionsDetail: (id: string, params?: RequestParams) => Promise<AxiosResponse<MiriSession, any, {}>>;
273
+ /**
274
+ * No description
275
+ *
276
+ * @name AdminV1SessionsHistoryList
277
+ * @summary Get session message history
278
+ * @request GET:/api/admin/v1/sessions/{id}/history
279
+ * @secure
280
+ */
281
+ adminV1SessionsHistoryList: (id: string, params?: RequestParams) => Promise<AxiosResponse<{
282
+ messages?: MiriMessage[];
283
+ total_tokens?: number;
284
+ }, any, {}>>;
285
+ };
286
+ ws: {
287
+ /**
288
+ * No description
289
+ *
290
+ * @name GetWs
291
+ * @summary WebSocket for interactive streaming
292
+ * @request GET:/ws
293
+ * @secure
294
+ */
295
+ getWs: (query?: {
296
+ session_id?: string;
297
+ client_id?: string;
298
+ channel?: string;
299
+ device?: string;
300
+ }, params?: RequestParams) => Promise<AxiosResponse<any, any, {}>>;
301
+ };
302
+ }
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ /* tslint:disable */
4
+ // @ts-nocheck
5
+ /*
6
+ * ---------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
8
+ * ## ##
9
+ * ## AUTHOR: acacode ##
10
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
11
+ * ---------------------------------------------------------------
12
+ */
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Api = exports.HttpClient = exports.ContentType = void 0;
18
+ const axios_1 = __importDefault(require("axios"));
19
+ var ContentType;
20
+ (function (ContentType) {
21
+ ContentType["Json"] = "application/json";
22
+ ContentType["JsonApi"] = "application/vnd.api+json";
23
+ ContentType["FormData"] = "multipart/form-data";
24
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
25
+ ContentType["Text"] = "text/plain";
26
+ })(ContentType || (exports.ContentType = ContentType = {}));
27
+ class HttpClient {
28
+ instance;
29
+ securityData = null;
30
+ securityWorker;
31
+ secure;
32
+ format;
33
+ constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
34
+ this.instance = axios_1.default.create({
35
+ ...axiosConfig,
36
+ baseURL: axiosConfig.baseURL || "http://localhost:8080",
37
+ });
38
+ this.secure = secure;
39
+ this.format = format;
40
+ this.securityWorker = securityWorker;
41
+ }
42
+ setSecurityData = (data) => {
43
+ this.securityData = data;
44
+ };
45
+ mergeRequestParams(params1, params2) {
46
+ const method = params1.method || (params2 && params2.method);
47
+ return {
48
+ ...this.instance.defaults,
49
+ ...params1,
50
+ ...(params2 || {}),
51
+ headers: {
52
+ ...((method &&
53
+ this.instance.defaults.headers[method.toLowerCase()]) ||
54
+ {}),
55
+ ...(params1.headers || {}),
56
+ ...((params2 && params2.headers) || {}),
57
+ },
58
+ };
59
+ }
60
+ stringifyFormItem(formItem) {
61
+ if (typeof formItem === "object" && formItem !== null) {
62
+ return JSON.stringify(formItem);
63
+ }
64
+ else {
65
+ return `${formItem}`;
66
+ }
67
+ }
68
+ createFormData(input) {
69
+ if (input instanceof FormData) {
70
+ return input;
71
+ }
72
+ return Object.keys(input || {}).reduce((formData, key) => {
73
+ const property = input[key];
74
+ const propertyContent = property instanceof Array ? property : [property];
75
+ for (const formItem of propertyContent) {
76
+ const isFileType = formItem instanceof Blob || formItem instanceof File;
77
+ formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
78
+ }
79
+ return formData;
80
+ }, new FormData());
81
+ }
82
+ request = async ({ secure, path, type, query, format, body, ...params }) => {
83
+ const secureParams = ((typeof secure === "boolean" ? secure : this.secure) &&
84
+ this.securityWorker &&
85
+ (await this.securityWorker(this.securityData))) ||
86
+ {};
87
+ const requestParams = this.mergeRequestParams(params, secureParams);
88
+ const responseFormat = format || this.format || undefined;
89
+ if (type === ContentType.FormData &&
90
+ body &&
91
+ body !== null &&
92
+ typeof body === "object") {
93
+ body = this.createFormData(body);
94
+ }
95
+ if (type === ContentType.Text &&
96
+ body &&
97
+ body !== null &&
98
+ typeof body !== "string") {
99
+ body = JSON.stringify(body);
100
+ }
101
+ return this.instance.request({
102
+ ...requestParams,
103
+ headers: {
104
+ ...(requestParams.headers || {}),
105
+ ...(type ? { "Content-Type": type } : {}),
106
+ },
107
+ params: query,
108
+ responseType: responseFormat,
109
+ data: body,
110
+ url: path,
111
+ });
112
+ };
113
+ }
114
+ exports.HttpClient = HttpClient;
115
+ /**
116
+ * @title Miri Autonomous Agent API
117
+ * @version 1.0.0
118
+ * @baseUrl http://localhost:8080
119
+ *
120
+ * API for interacting with the Miri autonomous agent service.
121
+ */
122
+ class Api extends HttpClient {
123
+ api = {
124
+ /**
125
+ * No description
126
+ *
127
+ * @name V1PromptCreate
128
+ * @summary Send a prompt to the agent
129
+ * @request POST:/api/v1/prompt
130
+ * @secure
131
+ */
132
+ v1PromptCreate: (data, params = {}) => this.request({
133
+ path: `/api/v1/prompt`,
134
+ method: "POST",
135
+ body: data,
136
+ secure: true,
137
+ type: ContentType.Json,
138
+ format: "json",
139
+ ...params,
140
+ }),
141
+ /**
142
+ * No description
143
+ *
144
+ * @name V1PromptStreamList
145
+ * @summary Stream a prompt response via SSE
146
+ * @request GET:/api/v1/prompt/stream
147
+ * @secure
148
+ */
149
+ v1PromptStreamList: (query, params = {}) => this.request({
150
+ path: `/api/v1/prompt/stream`,
151
+ method: "GET",
152
+ query: query,
153
+ secure: true,
154
+ ...params,
155
+ }),
156
+ /**
157
+ * No description
158
+ *
159
+ * @name V1InteractionCreate
160
+ * @summary Manage sessions or check global status
161
+ * @request POST:/api/v1/interaction
162
+ * @secure
163
+ */
164
+ v1InteractionCreate: (data, params = {}) => this.request({
165
+ path: `/api/v1/interaction`,
166
+ method: "POST",
167
+ body: data,
168
+ secure: true,
169
+ type: ContentType.Json,
170
+ ...params,
171
+ }),
172
+ /**
173
+ * No description
174
+ *
175
+ * @name AdminV1HealthList
176
+ * @summary Check health of the admin API
177
+ * @request GET:/api/admin/v1/health
178
+ * @secure
179
+ */
180
+ adminV1HealthList: (params = {}) => this.request({
181
+ path: `/api/admin/v1/health`,
182
+ method: "GET",
183
+ secure: true,
184
+ format: "json",
185
+ ...params,
186
+ }),
187
+ /**
188
+ * No description
189
+ *
190
+ * @name AdminV1ConfigList
191
+ * @summary Get current configuration
192
+ * @request GET:/api/admin/v1/config
193
+ * @secure
194
+ */
195
+ adminV1ConfigList: (params = {}) => this.request({
196
+ path: `/api/admin/v1/config`,
197
+ method: "GET",
198
+ secure: true,
199
+ format: "json",
200
+ ...params,
201
+ }),
202
+ /**
203
+ * No description
204
+ *
205
+ * @name AdminV1ConfigCreate
206
+ * @summary Update configuration
207
+ * @request POST:/api/admin/v1/config
208
+ * @secure
209
+ */
210
+ adminV1ConfigCreate: (data, params = {}) => this.request({
211
+ path: `/api/admin/v1/config`,
212
+ method: "POST",
213
+ body: data,
214
+ secure: true,
215
+ type: ContentType.Json,
216
+ ...params,
217
+ }),
218
+ /**
219
+ * No description
220
+ *
221
+ * @name AdminV1HumanList
222
+ * @summary List all stored human information
223
+ * @request GET:/api/admin/v1/human
224
+ * @secure
225
+ */
226
+ adminV1HumanList: (params = {}) => this.request({
227
+ path: `/api/admin/v1/human`,
228
+ method: "GET",
229
+ secure: true,
230
+ format: "json",
231
+ ...params,
232
+ }),
233
+ /**
234
+ * No description
235
+ *
236
+ * @name AdminV1HumanCreate
237
+ * @summary Store human information
238
+ * @request POST:/api/admin/v1/human
239
+ * @secure
240
+ */
241
+ adminV1HumanCreate: (data, params = {}) => this.request({
242
+ path: `/api/admin/v1/human`,
243
+ method: "POST",
244
+ body: data,
245
+ secure: true,
246
+ type: ContentType.Json,
247
+ ...params,
248
+ }),
249
+ /**
250
+ * No description
251
+ *
252
+ * @name AdminV1SkillsList
253
+ * @summary List all installed skills
254
+ * @request GET:/api/admin/v1/skills
255
+ * @secure
256
+ */
257
+ adminV1SkillsList: (params = {}) => this.request({
258
+ path: `/api/admin/v1/skills`,
259
+ method: "GET",
260
+ secure: true,
261
+ format: "json",
262
+ ...params,
263
+ }),
264
+ /**
265
+ * No description
266
+ *
267
+ * @name AdminV1ChannelsCreate
268
+ * @summary Perform actions on communication channels
269
+ * @request POST:/api/admin/v1/channels
270
+ * @secure
271
+ */
272
+ adminV1ChannelsCreate: (data, params = {}) => this.request({
273
+ path: `/api/admin/v1/channels`,
274
+ method: "POST",
275
+ body: data,
276
+ secure: true,
277
+ type: ContentType.Json,
278
+ ...params,
279
+ }),
280
+ /**
281
+ * No description
282
+ *
283
+ * @name AdminV1SessionsList
284
+ * @summary List active session IDs
285
+ * @request GET:/api/admin/v1/sessions
286
+ * @secure
287
+ */
288
+ adminV1SessionsList: (params = {}) => this.request({
289
+ path: `/api/admin/v1/sessions`,
290
+ method: "GET",
291
+ secure: true,
292
+ format: "json",
293
+ ...params,
294
+ }),
295
+ /**
296
+ * No description
297
+ *
298
+ * @name AdminV1SessionsDetail
299
+ * @summary Get session details
300
+ * @request GET:/api/admin/v1/sessions/{id}
301
+ * @secure
302
+ */
303
+ adminV1SessionsDetail: (id, params = {}) => this.request({
304
+ path: `/api/admin/v1/sessions/${id}`,
305
+ method: "GET",
306
+ secure: true,
307
+ format: "json",
308
+ ...params,
309
+ }),
310
+ /**
311
+ * No description
312
+ *
313
+ * @name AdminV1SessionsHistoryList
314
+ * @summary Get session message history
315
+ * @request GET:/api/admin/v1/sessions/{id}/history
316
+ * @secure
317
+ */
318
+ adminV1SessionsHistoryList: (id, params = {}) => this.request({
319
+ path: `/api/admin/v1/sessions/${id}/history`,
320
+ method: "GET",
321
+ secure: true,
322
+ format: "json",
323
+ ...params,
324
+ }),
325
+ };
326
+ ws = {
327
+ /**
328
+ * No description
329
+ *
330
+ * @name GetWs
331
+ * @summary WebSocket for interactive streaming
332
+ * @request GET:/ws
333
+ * @secure
334
+ */
335
+ getWs: (query, params = {}) => this.request({
336
+ path: `/ws`,
337
+ method: "GET",
338
+ query: query,
339
+ secure: true,
340
+ ...params,
341
+ }),
342
+ };
343
+ }
344
+ exports.Api = Api;
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@alexrockshouts/miri-sdk",
3
+ "version": "0.0.1",
4
+ "description": "TypeScript SDK for Miri Autonomous Agent",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "keywords": [
18
+ "miri",
19
+ "agent",
20
+ "sdk",
21
+ "typescript"
22
+ ],
23
+ "author": "Miri Team",
24
+ "license": "Apache-2.0",
25
+ "dependencies": {
26
+ "axios": "^1.7.0"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^5.0.0"
30
+ }
31
+ }