@agentuity/server 1.0.1 → 1.0.2
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/AGENTS.md +38 -34
- package/dist/api/api.d.ts +32 -2
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +14 -2
- package/dist/api/api.js.map +1 -1
- package/dist/api/apikey/create.d.ts +12 -2
- package/dist/api/apikey/create.d.ts.map +1 -1
- package/dist/api/apikey/create.js +2 -2
- package/dist/api/apikey/create.js.map +1 -1
- package/dist/api/apikey/delete.d.ts +9 -0
- package/dist/api/apikey/delete.d.ts.map +1 -1
- package/dist/api/apikey/delete.js +1 -1
- package/dist/api/apikey/delete.js.map +1 -1
- package/dist/api/apikey/get.d.ts +21 -2
- package/dist/api/apikey/get.d.ts.map +1 -1
- package/dist/api/apikey/get.js +2 -2
- package/dist/api/apikey/get.js.map +1 -1
- package/dist/api/apikey/index.d.ts +1 -0
- package/dist/api/apikey/index.d.ts.map +1 -1
- package/dist/api/apikey/index.js +1 -0
- package/dist/api/apikey/index.js.map +1 -1
- package/dist/api/apikey/list.d.ts +1 -2
- package/dist/api/apikey/list.d.ts.map +1 -1
- package/dist/api/apikey/list.js +1 -1
- package/dist/api/apikey/list.js.map +1 -1
- package/dist/api/db/index.d.ts +3 -3
- package/dist/api/db/index.d.ts.map +1 -1
- package/dist/api/db/index.js +3 -3
- package/dist/api/db/index.js.map +1 -1
- package/dist/api/db/logs.d.ts +14 -2
- package/dist/api/db/logs.d.ts.map +1 -1
- package/dist/api/db/logs.js +4 -4
- package/dist/api/db/logs.js.map +1 -1
- package/dist/api/db/query.d.ts +14 -1
- package/dist/api/db/query.d.ts.map +1 -1
- package/dist/api/db/query.js +2 -2
- package/dist/api/db/query.js.map +1 -1
- package/dist/api/db/tables.d.ts +1 -1
- package/dist/api/db/tables.d.ts.map +1 -1
- package/dist/api/db/tables.js +1 -1
- package/dist/api/db/tables.js.map +1 -1
- package/dist/api/eval/get.d.ts +1 -2
- package/dist/api/eval/get.d.ts.map +1 -1
- package/dist/api/eval/get.js +1 -1
- package/dist/api/eval/get.js.map +1 -1
- package/dist/api/eval/index.d.ts +4 -4
- package/dist/api/eval/index.d.ts.map +1 -1
- package/dist/api/eval/index.js +4 -4
- package/dist/api/eval/index.js.map +1 -1
- package/dist/api/eval/list.d.ts +12 -2
- package/dist/api/eval/list.d.ts.map +1 -1
- package/dist/api/eval/list.js +2 -2
- package/dist/api/eval/list.js.map +1 -1
- package/dist/api/eval/run-get.d.ts +1 -2
- package/dist/api/eval/run-get.d.ts.map +1 -1
- package/dist/api/eval/run-get.js +1 -1
- package/dist/api/eval/run-get.js.map +1 -1
- package/dist/api/eval/run-list.d.ts +18 -2
- package/dist/api/eval/run-list.d.ts.map +1 -1
- package/dist/api/eval/run-list.js +2 -2
- package/dist/api/eval/run-list.js.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/machine/machine.d.ts +134 -3
- package/dist/api/machine/machine.d.ts.map +1 -1
- package/dist/api/machine/machine.js +11 -11
- package/dist/api/machine/machine.js.map +1 -1
- package/dist/api/org/env-delete.d.ts +10 -3
- package/dist/api/org/env-delete.d.ts.map +1 -1
- package/dist/api/org/env-delete.js +2 -2
- package/dist/api/org/env-delete.js.map +1 -1
- package/dist/api/org/env-get.d.ts +14 -1
- package/dist/api/org/env-get.d.ts.map +1 -1
- package/dist/api/org/env-get.js +2 -2
- package/dist/api/org/env-get.js.map +1 -1
- package/dist/api/org/env-update.d.ts +10 -3
- package/dist/api/org/env-update.d.ts.map +1 -1
- package/dist/api/org/env-update.js +2 -2
- package/dist/api/org/env-update.js.map +1 -1
- package/dist/api/org/list.d.ts +2 -3
- package/dist/api/org/list.d.ts.map +1 -1
- package/dist/api/org/list.js +2 -2
- package/dist/api/org/list.js.map +1 -1
- package/dist/api/org/resources.d.ts +4 -5
- package/dist/api/org/resources.d.ts.map +1 -1
- package/dist/api/org/resources.js +4 -4
- package/dist/api/org/resources.js.map +1 -1
- package/dist/api/project/agent.d.ts +1 -2
- package/dist/api/project/agent.d.ts.map +1 -1
- package/dist/api/project/agent.js +1 -1
- package/dist/api/project/agent.js.map +1 -1
- package/dist/api/project/create.d.ts +3 -3
- package/dist/api/project/create.d.ts.map +1 -1
- package/dist/api/project/create.js +3 -3
- package/dist/api/project/create.js.map +1 -1
- package/dist/api/project/delete.d.ts +4 -0
- package/dist/api/project/delete.d.ts.map +1 -1
- package/dist/api/project/delete.js +1 -1
- package/dist/api/project/delete.js.map +1 -1
- package/dist/api/project/deploy.d.ts +168 -9
- package/dist/api/project/deploy.d.ts.map +1 -1
- package/dist/api/project/deploy.js +23 -23
- package/dist/api/project/deploy.js.map +1 -1
- package/dist/api/project/deployment.d.ts +27 -3
- package/dist/api/project/deployment.d.ts.map +1 -1
- package/dist/api/project/deployment.js +3 -3
- package/dist/api/project/deployment.js.map +1 -1
- package/dist/api/project/env-delete.d.ts +2 -2
- package/dist/api/project/env-delete.d.ts.map +1 -1
- package/dist/api/project/env-delete.js +5 -1
- package/dist/api/project/env-delete.js.map +1 -1
- package/dist/api/project/env-update.d.ts +2 -2
- package/dist/api/project/env-update.d.ts.map +1 -1
- package/dist/api/project/env-update.js +1 -1
- package/dist/api/project/env-update.js.map +1 -1
- package/dist/api/project/exists.d.ts +2 -2
- package/dist/api/project/exists.d.ts.map +1 -1
- package/dist/api/project/exists.js +1 -1
- package/dist/api/project/exists.js.map +1 -1
- package/dist/api/project/get.d.ts +3 -3
- package/dist/api/project/get.d.ts.map +1 -1
- package/dist/api/project/get.js +2 -2
- package/dist/api/project/get.js.map +1 -1
- package/dist/api/project/list.d.ts +11 -2
- package/dist/api/project/list.d.ts.map +1 -1
- package/dist/api/project/list.js +4 -3
- package/dist/api/project/list.js.map +1 -1
- package/dist/api/project/malware.d.ts +14 -7
- package/dist/api/project/malware.d.ts.map +1 -1
- package/dist/api/project/malware.js +9 -9
- package/dist/api/project/malware.js.map +1 -1
- package/dist/api/project/update-region.d.ts +4 -0
- package/dist/api/project/update-region.d.ts.map +1 -1
- package/dist/api/project/update-region.js +1 -1
- package/dist/api/project/update-region.js.map +1 -1
- package/dist/api/region/create.d.ts +18 -4
- package/dist/api/region/create.d.ts.map +1 -1
- package/dist/api/region/create.js +5 -5
- package/dist/api/region/create.js.map +1 -1
- package/dist/api/region/delete.d.ts +17 -4
- package/dist/api/region/delete.d.ts.map +1 -1
- package/dist/api/region/delete.js +5 -5
- package/dist/api/region/delete.js.map +1 -1
- package/dist/api/region/list.d.ts +2 -3
- package/dist/api/region/list.d.ts.map +1 -1
- package/dist/api/region/list.js +2 -2
- package/dist/api/region/list.js.map +1 -1
- package/dist/api/region/resources.d.ts +2 -3
- package/dist/api/region/resources.d.ts.map +1 -1
- package/dist/api/region/resources.js +2 -2
- package/dist/api/region/resources.js.map +1 -1
- package/dist/api/sandbox/cli-list.d.ts +99 -0
- package/dist/api/sandbox/cli-list.d.ts.map +1 -0
- package/dist/api/sandbox/cli-list.js +63 -0
- package/dist/api/sandbox/cli-list.js.map +1 -0
- package/dist/api/sandbox/files.d.ts +100 -0
- package/dist/api/sandbox/files.d.ts.map +1 -1
- package/dist/api/sandbox/files.js +16 -16
- package/dist/api/sandbox/files.js.map +1 -1
- package/dist/api/sandbox/index.d.ts +5 -1
- package/dist/api/sandbox/index.d.ts.map +1 -1
- package/dist/api/sandbox/index.js +3 -1
- package/dist/api/sandbox/index.js.map +1 -1
- package/dist/api/sandbox/resolve.d.ts +52 -0
- package/dist/api/sandbox/resolve.d.ts.map +1 -0
- package/dist/api/sandbox/resolve.js +71 -0
- package/dist/api/sandbox/resolve.js.map +1 -0
- package/dist/api/sandbox/run.d.ts.map +1 -1
- package/dist/api/sandbox/run.js +6 -0
- package/dist/api/sandbox/run.js.map +1 -1
- package/dist/api/session/get.d.ts +123 -8
- package/dist/api/session/get.d.ts.map +1 -1
- package/dist/api/session/get.js +8 -8
- package/dist/api/session/get.js.map +1 -1
- package/dist/api/session/index.d.ts +3 -6
- package/dist/api/session/index.d.ts.map +1 -1
- package/dist/api/session/index.js +3 -3
- package/dist/api/session/index.js.map +1 -1
- package/dist/api/session/list.d.ts +2 -2
- package/dist/api/session/list.d.ts.map +1 -1
- package/dist/api/session/list.js +2 -2
- package/dist/api/session/list.js.map +1 -1
- package/dist/api/session/logs.d.ts +19 -2
- package/dist/api/session/logs.d.ts.map +1 -1
- package/dist/api/session/logs.js +4 -4
- package/dist/api/session/logs.js.map +1 -1
- package/dist/api/stream/get.d.ts +59 -0
- package/dist/api/stream/get.d.ts.map +1 -0
- package/dist/api/stream/get.js +40 -0
- package/dist/api/stream/get.js.map +1 -0
- package/dist/api/stream/index.d.ts +4 -0
- package/dist/api/stream/index.d.ts.map +1 -0
- package/dist/api/stream/index.js +4 -0
- package/dist/api/stream/index.js.map +1 -0
- package/dist/api/stream/list.d.ts +108 -0
- package/dist/api/stream/list.d.ts.map +1 -0
- package/dist/api/stream/list.js +71 -0
- package/dist/api/stream/list.js.map +1 -0
- package/dist/api/stream/util.d.ts +23 -0
- package/dist/api/stream/util.d.ts.map +1 -0
- package/dist/api/stream/util.js +3 -0
- package/dist/api/stream/util.js.map +1 -0
- package/dist/api/thread/delete.d.ts +10 -3
- package/dist/api/thread/delete.d.ts.map +1 -1
- package/dist/api/thread/delete.js +2 -2
- package/dist/api/thread/delete.js.map +1 -1
- package/dist/api/thread/get.d.ts +23 -5
- package/dist/api/thread/get.d.ts.map +1 -1
- package/dist/api/thread/get.js +2 -2
- package/dist/api/thread/get.js.map +1 -1
- package/dist/api/thread/index.d.ts +4 -4
- package/dist/api/thread/index.d.ts.map +1 -1
- package/dist/api/thread/index.js +4 -4
- package/dist/api/thread/index.js.map +1 -1
- package/dist/api/thread/list.d.ts +4 -5
- package/dist/api/thread/list.d.ts.map +1 -1
- package/dist/api/thread/list.js +3 -4
- package/dist/api/thread/list.js.map +1 -1
- package/dist/api/user/whoami.d.ts +6 -3
- package/dist/api/user/whoami.d.ts.map +1 -1
- package/dist/api/user/whoami.js +3 -3
- package/dist/api/user/whoami.js.map +1 -1
- package/package.json +4 -4
- package/src/api/api.ts +23 -2
- package/src/api/apikey/create.ts +2 -2
- package/src/api/apikey/delete.ts +1 -1
- package/src/api/apikey/get.ts +2 -2
- package/src/api/apikey/index.ts +1 -0
- package/src/api/apikey/list.ts +1 -1
- package/src/api/db/index.ts +17 -2
- package/src/api/db/logs.ts +6 -6
- package/src/api/db/query.ts +2 -2
- package/src/api/db/tables.ts +1 -1
- package/src/api/eval/get.ts +1 -1
- package/src/api/eval/index.ts +16 -4
- package/src/api/eval/list.ts +2 -2
- package/src/api/eval/run-get.ts +1 -1
- package/src/api/eval/run-list.ts +2 -2
- package/src/api/index.ts +1 -0
- package/src/api/machine/machine.ts +15 -11
- package/src/api/org/env-delete.ts +4 -4
- package/src/api/org/env-get.ts +3 -3
- package/src/api/org/env-update.ts +4 -4
- package/src/api/org/list.ts +2 -2
- package/src/api/org/resources.ts +4 -4
- package/src/api/project/agent.ts +1 -1
- package/src/api/project/create.ts +4 -4
- package/src/api/project/delete.ts +1 -1
- package/src/api/project/deploy.ts +32 -32
- package/src/api/project/deployment.ts +3 -3
- package/src/api/project/env-delete.ts +10 -6
- package/src/api/project/env-update.ts +2 -2
- package/src/api/project/exists.ts +2 -2
- package/src/api/project/get.ts +3 -3
- package/src/api/project/list.ts +13 -13
- package/src/api/project/malware.ts +12 -12
- package/src/api/project/update-region.ts +1 -1
- package/src/api/region/create.ts +5 -5
- package/src/api/region/delete.ts +5 -5
- package/src/api/region/list.ts +2 -2
- package/src/api/region/resources.ts +2 -2
- package/src/api/sandbox/cli-list.ts +99 -0
- package/src/api/sandbox/files.ts +16 -16
- package/src/api/sandbox/index.ts +21 -0
- package/src/api/sandbox/resolve.ts +98 -0
- package/src/api/sandbox/run.ts +6 -1
- package/src/api/session/get.ts +13 -13
- package/src/api/session/index.ts +3 -6
- package/src/api/session/list.ts +2 -2
- package/src/api/session/logs.ts +4 -4
- package/src/api/stream/get.ts +51 -0
- package/src/api/stream/index.ts +3 -0
- package/src/api/stream/list.ts +111 -0
- package/src/api/stream/util.ts +3 -0
- package/src/api/thread/delete.ts +4 -4
- package/src/api/thread/get.ts +5 -7
- package/src/api/thread/index.ts +4 -4
- package/src/api/thread/list.ts +4 -6
- package/src/api/user/whoami.ts +3 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient, APIResponseSchema } from '../api';
|
|
3
|
+
import { StreamResponseError } from './util';
|
|
4
|
+
|
|
5
|
+
const StreamDetailSchema = z.object({
|
|
6
|
+
id: z.string().describe('the stream id'),
|
|
7
|
+
namespace: z.string().describe('the stream namespace'),
|
|
8
|
+
metadata: z.record(z.string(), z.string()).describe('stream metadata'),
|
|
9
|
+
url: z.string().describe('public URL to access the stream'),
|
|
10
|
+
sizeBytes: z.number().describe('size in bytes'),
|
|
11
|
+
createdAt: z.string().nullable().describe('ISO 8601 creation timestamp'),
|
|
12
|
+
updatedAt: z.string().nullable().describe('ISO 8601 last update timestamp'),
|
|
13
|
+
startedAt: z.string().nullable().describe('ISO 8601 stream start timestamp'),
|
|
14
|
+
endedAt: z.string().nullable().describe('ISO 8601 stream end timestamp'),
|
|
15
|
+
expiresAt: z.string().nullable().describe('ISO 8601 expiration timestamp or null'),
|
|
16
|
+
orgId: z.string().describe('the organization id'),
|
|
17
|
+
projectId: z.string().nullable().describe('the project id'),
|
|
18
|
+
completed: z.boolean().describe('whether the stream upload is completed'),
|
|
19
|
+
headers: z.record(z.string(), z.string()).describe('stream headers'),
|
|
20
|
+
chunks: z.number().describe('number of chunks'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const StreamDetailResponseSchema = APIResponseSchema(StreamDetailSchema);
|
|
24
|
+
|
|
25
|
+
export type StreamDetailResponse = z.infer<typeof StreamDetailResponseSchema>;
|
|
26
|
+
export type StreamDetail = z.infer<typeof StreamDetailSchema>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get a specific stream by ID.
|
|
30
|
+
*
|
|
31
|
+
* @param client - The API client
|
|
32
|
+
* @param id - The stream ID
|
|
33
|
+
* @returns A promise that resolves to the stream details
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const stream = await streamGet(client, 'stream_abc123');
|
|
37
|
+
* console.log(`Namespace: ${stream.namespace}, Size: ${stream.sizeBytes} bytes`);
|
|
38
|
+
*/
|
|
39
|
+
export async function streamGet(client: APIClient, id: string): Promise<StreamDetail> {
|
|
40
|
+
const resp = await client.request<StreamDetailResponse>(
|
|
41
|
+
'GET',
|
|
42
|
+
`/cli/stream/${encodeURIComponent(id)}`,
|
|
43
|
+
StreamDetailResponseSchema
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (resp.success) {
|
|
47
|
+
return resp.data;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
throw new StreamResponseError({ message: resp.message });
|
|
51
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient, APIResponseSchema } from '../api';
|
|
3
|
+
import { StreamResponseError } from './util';
|
|
4
|
+
|
|
5
|
+
const StreamInfoSchema = z.object({
|
|
6
|
+
id: z.string().describe('the stream id'),
|
|
7
|
+
namespace: z.string().describe('the stream namespace'),
|
|
8
|
+
metadata: z.record(z.string(), z.string()).describe('stream metadata'),
|
|
9
|
+
url: z.string().describe('public URL to access the stream'),
|
|
10
|
+
sizeBytes: z.number().describe('size in bytes'),
|
|
11
|
+
expiresAt: z.string().nullable().describe('ISO 8601 expiration timestamp or null'),
|
|
12
|
+
orgId: z.string().describe('the organization id'),
|
|
13
|
+
projectId: z.string().nullable().describe('the project id'),
|
|
14
|
+
projectName: z.string().nullable().describe('the project name'),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const StreamListDataSchema = z.object({
|
|
18
|
+
streams: z.array(StreamInfoSchema).describe('list of streams'),
|
|
19
|
+
total: z.number().describe('total count of matching streams'),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const StreamListResponseSchema = APIResponseSchema(StreamListDataSchema);
|
|
23
|
+
|
|
24
|
+
export type StreamListResponse = z.infer<typeof StreamListResponseSchema>;
|
|
25
|
+
export type StreamListData = z.infer<typeof StreamListDataSchema>;
|
|
26
|
+
export type StreamInfo = z.infer<typeof StreamInfoSchema>;
|
|
27
|
+
|
|
28
|
+
export interface StreamListOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Filter by specific project ID
|
|
31
|
+
*/
|
|
32
|
+
projectId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Filter by specific organization ID
|
|
35
|
+
*/
|
|
36
|
+
orgId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Filter by stream namespace
|
|
39
|
+
*/
|
|
40
|
+
namespace?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of streams to return (default: 100, max: 1000)
|
|
43
|
+
*/
|
|
44
|
+
limit?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Number of streams to skip for pagination
|
|
47
|
+
*/
|
|
48
|
+
offset?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Filter by metadata key-value pairs
|
|
51
|
+
*/
|
|
52
|
+
metadata?: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* List streams with optional filtering.
|
|
57
|
+
*
|
|
58
|
+
* If no projectId or orgId is provided, returns streams from all orgs the user is a member of.
|
|
59
|
+
*
|
|
60
|
+
* @param client - The API client
|
|
61
|
+
* @param options - Filtering and pagination options
|
|
62
|
+
* @returns A promise that resolves to the list of streams with metadata
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* // List all streams across all orgs
|
|
66
|
+
* const result = await streamList(client);
|
|
67
|
+
* console.log(`Found ${result.total} streams`);
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // List streams for a specific project
|
|
71
|
+
* const result = await streamList(client, { projectId: 'proj_123' });
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // List streams with namespace filter
|
|
75
|
+
* const result = await streamList(client, { namespace: 'agent-logs' });
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // List streams with metadata filter
|
|
79
|
+
* const result = await streamList(client, {
|
|
80
|
+
* metadata: { type: 'export', env: 'production' }
|
|
81
|
+
* });
|
|
82
|
+
*/
|
|
83
|
+
export async function streamList(
|
|
84
|
+
client: APIClient,
|
|
85
|
+
options: StreamListOptions = {}
|
|
86
|
+
): Promise<StreamListData> {
|
|
87
|
+
const { projectId, orgId, namespace, limit, offset, metadata } = options;
|
|
88
|
+
const params = new URLSearchParams();
|
|
89
|
+
|
|
90
|
+
if (projectId) params.set('projectId', projectId);
|
|
91
|
+
if (orgId) params.set('orgId', orgId);
|
|
92
|
+
if (namespace) params.set('namespace', namespace);
|
|
93
|
+
if (limit !== undefined) params.set('limit', limit.toString());
|
|
94
|
+
if (offset !== undefined) params.set('offset', offset.toString());
|
|
95
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
96
|
+
params.set('metadata', JSON.stringify(metadata));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const queryString = params.toString();
|
|
100
|
+
const resp = await client.request<StreamListResponse>(
|
|
101
|
+
'GET',
|
|
102
|
+
`/cli/stream${queryString ? `?${queryString}` : ''}`,
|
|
103
|
+
StreamListResponseSchema
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
if (resp.success) {
|
|
107
|
+
return resp.data;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
throw new StreamResponseError({ message: resp.message });
|
|
111
|
+
}
|
package/src/api/thread/delete.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { z } from 'zod';
|
|
|
2
2
|
import { APIClient, APIResponseSchemaNoData } from '../api';
|
|
3
3
|
import { ThreadResponseError } from './util';
|
|
4
4
|
|
|
5
|
-
const _ThreadDeleteRequestSchema = z.object({
|
|
5
|
+
export const _ThreadDeleteRequestSchema = z.object({
|
|
6
6
|
id: z.string().describe('the thread id'),
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
const ThreadDeleteResponseSchema = APIResponseSchemaNoData();
|
|
9
|
+
export const ThreadDeleteResponseSchema = APIResponseSchemaNoData();
|
|
10
10
|
|
|
11
|
-
type ThreadDeleteRequest = z.infer<typeof _ThreadDeleteRequestSchema>;
|
|
12
|
-
type ThreadDeleteResponse = z.infer<typeof ThreadDeleteResponseSchema>;
|
|
11
|
+
export type ThreadDeleteRequest = z.infer<typeof _ThreadDeleteRequestSchema>;
|
|
12
|
+
export type ThreadDeleteResponse = z.infer<typeof ThreadDeleteResponseSchema>;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Delete a thread by id
|
package/src/api/thread/get.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { APIClient, APIResponseSchema } from '../api';
|
|
3
|
-
import { ThreadSchema } from './list';
|
|
3
|
+
import { ThreadSchema, type Thread } from './list';
|
|
4
4
|
import { ThreadResponseError } from './util';
|
|
5
5
|
|
|
6
|
-
const _ThreadGetRequestSchema = z.object({
|
|
6
|
+
export const _ThreadGetRequestSchema = z.object({
|
|
7
7
|
id: z.string().describe('the thread id'),
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
const ThreadGetResponseSchema = APIResponseSchema(ThreadSchema);
|
|
10
|
+
export const ThreadGetResponseSchema = APIResponseSchema(ThreadSchema);
|
|
11
11
|
|
|
12
|
-
type ThreadGetRequest = z.infer<typeof _ThreadGetRequestSchema>;
|
|
13
|
-
type ThreadGetResponse = z.infer<typeof ThreadGetResponseSchema>;
|
|
14
|
-
|
|
15
|
-
export type Thread = z.infer<typeof ThreadSchema>;
|
|
12
|
+
export type ThreadGetRequest = z.infer<typeof _ThreadGetRequestSchema>;
|
|
13
|
+
export type ThreadGetResponse = z.infer<typeof ThreadGetResponseSchema>;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* Get a single thread by id
|
package/src/api/thread/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './get';
|
|
2
|
+
export * from './list';
|
|
3
|
+
export * from './delete';
|
|
4
|
+
export * from './util';
|
package/src/api/thread/list.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { APIClient, APIResponseSchema } from '../api';
|
|
3
3
|
import { ThreadResponseError } from './util';
|
|
4
4
|
|
|
5
|
-
const ThreadSchema = z.object({
|
|
5
|
+
export const ThreadSchema = z.object({
|
|
6
6
|
id: z.string().describe('the thread id'),
|
|
7
7
|
created_at: z.string().describe('the creation timestamp'),
|
|
8
8
|
updated_at: z.string().describe('the last update timestamp'),
|
|
@@ -19,14 +19,12 @@ const ThreadSchema = z.object({
|
|
|
19
19
|
.describe('unencrypted key-value metadata'),
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export const ThreadListResponseData = z.array(ThreadSchema);
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const ThreadListResponseSchema = APIResponseSchema(ThreadListResponse);
|
|
24
|
+
export const ThreadListResponseSchema = APIResponseSchema(ThreadListResponseData);
|
|
27
25
|
|
|
28
26
|
export type ThreadListResponse = z.infer<typeof ThreadListResponseSchema>;
|
|
29
|
-
export type ThreadList = z.infer<typeof
|
|
27
|
+
export type ThreadList = z.infer<typeof ThreadListResponseData>;
|
|
30
28
|
export type Thread = z.infer<typeof ThreadSchema>;
|
|
31
29
|
|
|
32
30
|
export interface ThreadListOptions {
|
package/src/api/user/whoami.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { z } from 'zod';
|
|
|
2
2
|
import { APIResponseSchema, APIClient } from '../api';
|
|
3
3
|
import { UserResponseError } from './util';
|
|
4
4
|
|
|
5
|
-
const OrganizationSchema = z.object({
|
|
5
|
+
export const OrganizationSchema = z.object({
|
|
6
6
|
id: z.string().describe('the unique id for the organization'),
|
|
7
7
|
name: z.string().describe('the name of the organization'),
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
const WhoamiResponse = z.object({
|
|
10
|
+
export const WhoamiResponse = z.object({
|
|
11
11
|
firstName: z.string().describe('the first name of the user'),
|
|
12
12
|
lastName: z.string().describe('the last name of the user'),
|
|
13
13
|
organizations: z.array(OrganizationSchema).describe('the organizations the user is a member of'),
|
|
14
14
|
});
|
|
15
|
-
const WhoamiResponseSchema = APIResponseSchema(WhoamiResponse);
|
|
15
|
+
export const WhoamiResponseSchema = APIResponseSchema(WhoamiResponse);
|
|
16
16
|
|
|
17
17
|
export type WhoamiResponse = z.infer<typeof WhoamiResponseSchema>;
|
|
18
18
|
export type User = z.infer<typeof WhoamiResponse>;
|