opensink 0.1.0

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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +200 -0
  3. package/dist/index.d.ts +9 -0
  4. package/dist/index.js +9 -0
  5. package/dist/modules/resources/agent-configurations-resource.d.ts +23 -0
  6. package/dist/modules/resources/agent-configurations-resource.js +83 -0
  7. package/dist/modules/resources/agent-session-activities-resource.d.ts +25 -0
  8. package/dist/modules/resources/agent-session-activities-resource.js +67 -0
  9. package/dist/modules/resources/agent-session-input-requests-resource.d.ts +24 -0
  10. package/dist/modules/resources/agent-session-input-requests-resource.js +74 -0
  11. package/dist/modules/resources/agent-sessions-resource.d.ts +13 -0
  12. package/dist/modules/resources/agent-sessions-resource.js +24 -0
  13. package/dist/modules/resources/agents-resource.d.ts +8 -0
  14. package/dist/modules/resources/agents-resource.js +24 -0
  15. package/dist/modules/resources/sink-items-resource.d.ts +26 -0
  16. package/dist/modules/resources/sink-items-resource.js +67 -0
  17. package/dist/modules/resources/sinks-resource.d.ts +6 -0
  18. package/dist/modules/resources/sinks-resource.js +24 -0
  19. package/dist/modules/shared/api-resource.d.ts +15 -0
  20. package/dist/modules/shared/api-resource.js +79 -0
  21. package/dist/opensink.d.ts +23 -0
  22. package/dist/opensink.js +28 -0
  23. package/dist/types/agent-config-data.d.ts +12 -0
  24. package/dist/types/agent-config-data.js +1 -0
  25. package/dist/types/agent-data.d.ts +9 -0
  26. package/dist/types/agent-data.js +1 -0
  27. package/dist/types/agent-session-activity-data.d.ts +32 -0
  28. package/dist/types/agent-session-activity-data.js +16 -0
  29. package/dist/types/agent-session-data.d.ts +18 -0
  30. package/dist/types/agent-session-data.js +8 -0
  31. package/dist/types/agent-session-input-request-data.d.ts +15 -0
  32. package/dist/types/agent-session-input-request-data.js +1 -0
  33. package/dist/types/sink-data.d.ts +23 -0
  34. package/dist/types/sink-data.js +11 -0
  35. package/dist/types/sink-item-data.d.ts +14 -0
  36. package/dist/types/sink-item-data.js +1 -0
  37. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenSink
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ # OpenSink JavaScript SDK
2
+
3
+ The official JavaScript/TypeScript client for the [OpenSink](https://opensink.com) REST API. OpenSink is a control and observation platform for AI agents in production — manage sessions, configurations, human-in-the-loop input requests, and structured agent outputs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install opensink
9
+ # or
10
+ yarn add opensink
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import Opensink from 'opensink';
17
+
18
+ const client = new Opensink({
19
+ apiKey: 'your-api-key',
20
+ url: 'https://api.opensink.com',
21
+ });
22
+ ```
23
+
24
+ ## Resources
25
+
26
+ ### Sinks
27
+
28
+ Named containers for storing structured agent outputs.
29
+
30
+ ```typescript
31
+ // Create a sink
32
+ const { data: sink } = await client.sinks.create({
33
+ name: 'research-results',
34
+ description: 'Summaries from research agent',
35
+ });
36
+
37
+ // List sinks
38
+ const { data: { items } } = await client.sinks.list();
39
+
40
+ // Get a sink
41
+ const { data: sink } = await client.sinks.get('sink-id');
42
+ ```
43
+
44
+ ### Sink Items
45
+
46
+ Structured records written to sinks. Supports full-text search and bulk creation.
47
+
48
+ ```typescript
49
+ // Create an item
50
+ const { data: item } = await client.sinkItems.create({
51
+ sink_id: 'sink-id',
52
+ title: 'Q1 Summary',
53
+ body: 'Revenue grew 15% quarter over quarter.',
54
+ type: 'summary',
55
+ url: 'https://example.com/report',
56
+ fields: { quarter: 'Q1', growth: 15 },
57
+ });
58
+
59
+ // Bulk create items
60
+ const { data } = await client.sinkItems.createMany([
61
+ { sink_id: 'sink-id', title: 'Item 1' },
62
+ { sink_id: 'sink-id', title: 'Item 2' },
63
+ ]);
64
+
65
+ // List items
66
+ const { data: { items } } = await client.sinkItems.list();
67
+ ```
68
+
69
+ ### Agents
70
+
71
+ ```typescript
72
+ // Register an agent
73
+ const { data: agent } = await client.agents.create({
74
+ name: 'research-agent',
75
+ description: 'Gathers and summarizes research',
76
+ });
77
+
78
+ // List agents
79
+ const { data: { items } } = await client.agents.list();
80
+ ```
81
+
82
+ ### Agent Configurations
83
+
84
+ Versioned, inspectable settings that define agent behavior without hardcoding logic.
85
+
86
+ ```typescript
87
+ // Create a configuration
88
+ const { data: config } = await client.agentConfigurations.create({
89
+ agent_id: 'agent-id',
90
+ variant: 'default',
91
+ schema: { type: 'object', properties: { model: { type: 'string' } } },
92
+ value: { model: 'gpt-4o' },
93
+ });
94
+
95
+ // Get the active configuration for an agent
96
+ const { data: active } = await client.agentConfigurations.getActiveForAgent('agent-id');
97
+
98
+ // List configuration variants
99
+ const { data: { items } } = await client.agentConfigurations.listVariants('agent-id');
100
+
101
+ // List configurations with filters
102
+ const { data: { items } } = await client.agentConfigurations.listConfigs({
103
+ agent_id: 'agent-id',
104
+ variant: 'default',
105
+ });
106
+ ```
107
+
108
+ ### Agent Sessions
109
+
110
+ Durable execution records that let agents pause, crash, and resume without losing context.
111
+
112
+ ```typescript
113
+ // Start a session
114
+ const { data: session } = await client.agentSessions.create({
115
+ agent_id: 'agent-id',
116
+ status: 'running',
117
+ state: { step: 'init' },
118
+ metadata: { triggered_by: 'cron' },
119
+ });
120
+
121
+ // Update session state
122
+ const { data: updated } = await client.agentSessions.update('session-id', {
123
+ state: { step: 'processing', progress: 50 },
124
+ });
125
+
126
+ // Mark session as completed
127
+ await client.agentSessions.update('session-id', { status: 'completed' });
128
+ ```
129
+
130
+ ### Agent Session Input Requests
131
+
132
+ Enable human-in-the-loop workflows by letting agents pause and request input.
133
+
134
+ ```typescript
135
+ // Create an input request
136
+ const { data: request } = await client.agentSessionInputRequests.create({
137
+ session_id: 'session-id',
138
+ agent_id: 'agent-id',
139
+ key: 'approval',
140
+ title: 'Approve purchase',
141
+ message: 'Agent wants to purchase 100 units. Approve?',
142
+ schema: { type: 'object', properties: { approved: { type: 'boolean' } } },
143
+ });
144
+
145
+ // List pending requests
146
+ const { data: { items } } = await client.agentSessionInputRequests.listRequests({
147
+ session_id: 'session-id',
148
+ status: 'pending',
149
+ });
150
+
151
+ // Resolve a request
152
+ const { data: resolved } = await client.agentSessionInputRequests.resolve(
153
+ 'request-id',
154
+ { approved: true },
155
+ );
156
+ ```
157
+
158
+ ### Agent Session Activities
159
+
160
+ A log of events within a session for debugging and auditing.
161
+
162
+ ```typescript
163
+ // Log an activity
164
+ const { data: activity } = await client.agentSessionActivities.create({
165
+ session_id: 'session-id',
166
+ agent_id: 'agent-id',
167
+ type: 'message',
168
+ source: 'agent',
169
+ message: 'Started processing batch',
170
+ });
171
+
172
+ // List activities with filters
173
+ const { data: { items } } = await client.agentSessionActivities.listActivities({
174
+ session_id: 'session-id',
175
+ type: 'message',
176
+ source: 'agent',
177
+ });
178
+ ```
179
+
180
+ ## Pagination
181
+
182
+ List endpoints return paginated results using trail-based pagination:
183
+
184
+ ```typescript
185
+ // First page
186
+ const { data: page1 } = await client.sinkItems.list({ $limit: 20 });
187
+
188
+ // Next page
189
+ if (page1.trail) {
190
+ const { data: page2 } = await client.sinkItems.list({ $limit: 20, $trail: page1.trail });
191
+ }
192
+ ```
193
+
194
+ ## Documentation
195
+
196
+ For full API documentation, visit [docs.opensink.com](https://docs.opensink.com).
197
+
198
+ ## License
199
+
200
+ [MIT](LICENSE)
@@ -0,0 +1,9 @@
1
+ export * from './types/agent-config-data.js';
2
+ export * from './types/agent-data.js';
3
+ export * from './types/agent-session-activity-data.js';
4
+ export * from './types/agent-session-data.js';
5
+ export * from './types/agent-session-input-request-data.js';
6
+ export * from './types/sink-data.js';
7
+ export * from './types/sink-item-data.js';
8
+ import Opensink from './opensink.js';
9
+ export default Opensink;
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from './types/agent-config-data.js';
2
+ export * from './types/agent-data.js';
3
+ export * from './types/agent-session-activity-data.js';
4
+ export * from './types/agent-session-data.js';
5
+ export * from './types/agent-session-input-request-data.js';
6
+ export * from './types/sink-data.js';
7
+ export * from './types/sink-item-data.js';
8
+ import Opensink from './opensink.js';
9
+ export default Opensink;
@@ -0,0 +1,23 @@
1
+ import { AxiosInstance, AxiosResponse } from 'axios';
2
+ import AgentConfig from '../../types/agent-config-data.js';
3
+ import APIResource, { PaginatedResponse } from '../shared/api-resource.js';
4
+ type CreateConfigData = {
5
+ agent_id: string;
6
+ variant?: string;
7
+ schema_version?: number;
8
+ schema?: Record<string, unknown>;
9
+ value?: Record<string, unknown>;
10
+ };
11
+ interface ListParams {
12
+ agent_id?: string;
13
+ variant?: string;
14
+ $limit?: number;
15
+ $trail?: string;
16
+ }
17
+ export default class AgentConfigurationsResource extends APIResource<AgentConfig, CreateConfigData> {
18
+ constructor(axios: AxiosInstance);
19
+ listConfigs(params?: ListParams): Promise<AxiosResponse<PaginatedResponse<AgentConfig>>>;
20
+ listVariants(agentId?: string): Promise<AxiosResponse<PaginatedResponse<AgentConfig>>>;
21
+ getActiveForAgent<T = Record<string, unknown>>(agentId: string): Promise<AxiosResponse<AgentConfig<T>>>;
22
+ }
23
+ export {};
@@ -0,0 +1,83 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import APIResource from '../shared/api-resource.js';
53
+ var AgentConfigurationsResource = /** @class */ (function (_super) {
54
+ __extends(AgentConfigurationsResource, _super);
55
+ function AgentConfigurationsResource(axios) {
56
+ return _super.call(this, axios, '/agent-configurations') || this;
57
+ }
58
+ AgentConfigurationsResource.prototype.listConfigs = function (params) {
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ return [2 /*return*/, this.axios.get(this.path, { params: params })];
62
+ });
63
+ });
64
+ };
65
+ AgentConfigurationsResource.prototype.listVariants = function (agentId) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ return __generator(this, function (_a) {
68
+ return [2 /*return*/, this.axios.get("".concat(this.path, "/variants"), {
69
+ params: agentId ? { agent_id: agentId } : undefined,
70
+ })];
71
+ });
72
+ });
73
+ };
74
+ AgentConfigurationsResource.prototype.getActiveForAgent = function (agentId) {
75
+ return __awaiter(this, void 0, void 0, function () {
76
+ return __generator(this, function (_a) {
77
+ return [2 /*return*/, this.axios.get("".concat(this.path, "/agent/").concat(agentId))];
78
+ });
79
+ });
80
+ };
81
+ return AgentConfigurationsResource;
82
+ }(APIResource));
83
+ export default AgentConfigurationsResource;
@@ -0,0 +1,25 @@
1
+ import { AxiosInstance, AxiosResponse } from 'axios';
2
+ import AgentSessionActivity, { AgentSessionActivityType, AgentSessionActivitySource } from '../../types/agent-session-activity-data.js';
3
+ import APIResource, { PaginatedResponse } from '../shared/api-resource.js';
4
+ type CreateActivityData = {
5
+ session_id: string;
6
+ agent_id: string;
7
+ type: AgentSessionActivityType;
8
+ source: AgentSessionActivitySource;
9
+ related_entity_id?: string;
10
+ message?: string;
11
+ payload?: Record<string, unknown>;
12
+ };
13
+ interface ListParams {
14
+ session_id?: string;
15
+ agent_id?: string;
16
+ type?: AgentSessionActivityType;
17
+ source?: AgentSessionActivitySource;
18
+ $limit?: number;
19
+ $trail?: string;
20
+ }
21
+ export default class AgentSessionActivitiesResource extends APIResource<AgentSessionActivity, CreateActivityData> {
22
+ constructor(axios: AxiosInstance);
23
+ listActivities(params?: ListParams): Promise<AxiosResponse<PaginatedResponse<AgentSessionActivity>>>;
24
+ }
25
+ export {};
@@ -0,0 +1,67 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import APIResource from '../shared/api-resource.js';
53
+ var AgentSessionActivitiesResource = /** @class */ (function (_super) {
54
+ __extends(AgentSessionActivitiesResource, _super);
55
+ function AgentSessionActivitiesResource(axios) {
56
+ return _super.call(this, axios, '/agent-session-activities') || this;
57
+ }
58
+ AgentSessionActivitiesResource.prototype.listActivities = function (params) {
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ return [2 /*return*/, this.axios.get(this.path, { params: params })];
62
+ });
63
+ });
64
+ };
65
+ return AgentSessionActivitiesResource;
66
+ }(APIResource));
67
+ export default AgentSessionActivitiesResource;
@@ -0,0 +1,24 @@
1
+ import { AxiosInstance, AxiosResponse } from 'axios';
2
+ import AgentSessionInputRequest, { AgentSessionInputRequestStatus } from '../../types/agent-session-input-request-data.js';
3
+ import APIResource, { PaginatedResponse } from '../shared/api-resource.js';
4
+ type CreateInputRequestData = {
5
+ session_id: string;
6
+ agent_id: string;
7
+ key: string;
8
+ title: string;
9
+ message: string;
10
+ schema: Record<string, unknown>;
11
+ };
12
+ interface ListParams {
13
+ session_id?: string;
14
+ agent_id?: string;
15
+ status?: AgentSessionInputRequestStatus;
16
+ $limit?: number;
17
+ $trail?: string;
18
+ }
19
+ export default class AgentSessionInputRequestsResource extends APIResource<AgentSessionInputRequest, CreateInputRequestData> {
20
+ constructor(axios: AxiosInstance);
21
+ listRequests(params?: ListParams): Promise<AxiosResponse<PaginatedResponse<AgentSessionInputRequest>>>;
22
+ resolve(id: string, response: Record<string, unknown>): Promise<AxiosResponse<AgentSessionInputRequest>>;
23
+ }
24
+ export {};
@@ -0,0 +1,74 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import APIResource from '../shared/api-resource.js';
53
+ var AgentSessionInputRequestsResource = /** @class */ (function (_super) {
54
+ __extends(AgentSessionInputRequestsResource, _super);
55
+ function AgentSessionInputRequestsResource(axios) {
56
+ return _super.call(this, axios, '/agent-session-input-requests') || this;
57
+ }
58
+ AgentSessionInputRequestsResource.prototype.listRequests = function (params) {
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ return [2 /*return*/, this.axios.get(this.path, { params: params })];
62
+ });
63
+ });
64
+ };
65
+ AgentSessionInputRequestsResource.prototype.resolve = function (id, response) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ return __generator(this, function (_a) {
68
+ return [2 /*return*/, this.axios.post("".concat(this.path, "/").concat(id, "/resolve"), { response: response })];
69
+ });
70
+ });
71
+ };
72
+ return AgentSessionInputRequestsResource;
73
+ }(APIResource));
74
+ export default AgentSessionInputRequestsResource;
@@ -0,0 +1,13 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import AgentSession, { AgentSessionStatus } from '../../types/agent-session-data.js';
3
+ import APIResource from '../shared/api-resource.js';
4
+ type CreateSessionData = {
5
+ agent_id: string;
6
+ status?: AgentSessionStatus;
7
+ state?: Record<string, unknown>;
8
+ metadata?: Record<string, unknown>;
9
+ };
10
+ export default class AgentSessionsResource extends APIResource<AgentSession, CreateSessionData> {
11
+ constructor(axios: AxiosInstance);
12
+ }
13
+ export {};
@@ -0,0 +1,24 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import APIResource from '../shared/api-resource.js';
17
+ var AgentSessionsResource = /** @class */ (function (_super) {
18
+ __extends(AgentSessionsResource, _super);
19
+ function AgentSessionsResource(axios) {
20
+ return _super.call(this, axios, '/agent-sessions') || this;
21
+ }
22
+ return AgentSessionsResource;
23
+ }(APIResource));
24
+ export default AgentSessionsResource;
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import Agent from '../../types/agent-data.js';
3
+ import APIResource from '../shared/api-resource.js';
4
+ type CreateAgentData = Pick<Agent, 'name'> & Partial<Pick<Agent, 'description'>>;
5
+ export default class AgentsResource extends APIResource<Agent, CreateAgentData> {
6
+ constructor(axios: AxiosInstance);
7
+ }
8
+ export {};
@@ -0,0 +1,24 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import APIResource from '../shared/api-resource.js';
17
+ var AgentsResource = /** @class */ (function (_super) {
18
+ __extends(AgentsResource, _super);
19
+ function AgentsResource(axios) {
20
+ return _super.call(this, axios, '/agents') || this;
21
+ }
22
+ return AgentsResource;
23
+ }(APIResource));
24
+ export default AgentsResource;
@@ -0,0 +1,26 @@
1
+ import { AxiosInstance, AxiosResponse } from 'axios';
2
+ import SinkItemData from '../../types/sink-item-data.js';
3
+ import APIResource from '../shared/api-resource.js';
4
+ type CreateSinkItemData = Omit<SinkItemData, 'id' | 'created_at' | 'updated_at' | 'workspace_id'>;
5
+ interface BulkCreateResponse {
6
+ created: SinkItemData[];
7
+ failed: {
8
+ item: CreateSinkItemData;
9
+ error: string;
10
+ }[];
11
+ invalid: {
12
+ item: CreateSinkItemData;
13
+ errors: string[];
14
+ }[];
15
+ }
16
+ export interface ListSinkItemsParams {
17
+ sink_id?: string;
18
+ q?: string;
19
+ $limit?: number;
20
+ $trail?: string;
21
+ }
22
+ export default class SinkItemsResource extends APIResource<SinkItemData, CreateSinkItemData> {
23
+ constructor(axios: AxiosInstance);
24
+ createMany(data: CreateSinkItemData[]): Promise<AxiosResponse<BulkCreateResponse>>;
25
+ }
26
+ export {};
@@ -0,0 +1,67 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
27
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
52
+ import APIResource from '../shared/api-resource.js';
53
+ var SinkItemsResource = /** @class */ (function (_super) {
54
+ __extends(SinkItemsResource, _super);
55
+ function SinkItemsResource(axios) {
56
+ return _super.call(this, axios, '/sink-items') || this;
57
+ }
58
+ SinkItemsResource.prototype.createMany = function (data) {
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ return [2 /*return*/, this.axios.post("".concat(this.path, "/many"), { items: data })];
62
+ });
63
+ });
64
+ };
65
+ return SinkItemsResource;
66
+ }(APIResource));
67
+ export default SinkItemsResource;
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import SinkData from '../../types/sink-data.js';
3
+ import APIResource from '../shared/api-resource.js';
4
+ export default class SinksResource extends APIResource<SinkData> {
5
+ constructor(axios: AxiosInstance);
6
+ }
@@ -0,0 +1,24 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import APIResource from '../shared/api-resource.js';
17
+ var SinksResource = /** @class */ (function (_super) {
18
+ __extends(SinksResource, _super);
19
+ function SinksResource(axios) {
20
+ return _super.call(this, axios, '/sinks') || this;
21
+ }
22
+ return SinksResource;
23
+ }(APIResource));
24
+ export default SinksResource;
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance, AxiosResponse } from 'axios';
2
+ export interface PaginatedResponse<T> {
3
+ items: T[];
4
+ trail: string | null;
5
+ }
6
+ export default class APIResource<T, D = T> {
7
+ readonly axios: AxiosInstance;
8
+ readonly path: string;
9
+ constructor(axios: AxiosInstance, path: string);
10
+ create(data: D): Promise<AxiosResponse<T>>;
11
+ list<P>(params?: P): Promise<AxiosResponse<PaginatedResponse<T>>>;
12
+ get(id: string): Promise<AxiosResponse<T>>;
13
+ update(id: string, data: Partial<D>): Promise<AxiosResponse<T>>;
14
+ delete(id: string): Promise<AxiosResponse<void>>;
15
+ }
@@ -0,0 +1,79 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var APIResource = /** @class */ (function () {
38
+ function APIResource(axios, path) {
39
+ this.axios = axios;
40
+ this.path = path;
41
+ }
42
+ APIResource.prototype.create = function (data) {
43
+ return __awaiter(this, void 0, void 0, function () {
44
+ return __generator(this, function (_a) {
45
+ return [2 /*return*/, this.axios.post(this.path, data)];
46
+ });
47
+ });
48
+ };
49
+ APIResource.prototype.list = function (params) {
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ return __generator(this, function (_a) {
52
+ return [2 /*return*/, this.axios.get(this.path, { params: params })];
53
+ });
54
+ });
55
+ };
56
+ APIResource.prototype.get = function (id) {
57
+ return __awaiter(this, void 0, void 0, function () {
58
+ return __generator(this, function (_a) {
59
+ return [2 /*return*/, this.axios.get("".concat(this.path, "/").concat(id))];
60
+ });
61
+ });
62
+ };
63
+ APIResource.prototype.update = function (id, data) {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ return __generator(this, function (_a) {
66
+ return [2 /*return*/, this.axios.patch("".concat(this.path, "/").concat(id), data)];
67
+ });
68
+ });
69
+ };
70
+ APIResource.prototype.delete = function (id) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ return __generator(this, function (_a) {
73
+ return [2 /*return*/, this.axios.delete("".concat(this.path, "/").concat(id))];
74
+ });
75
+ });
76
+ };
77
+ return APIResource;
78
+ }());
79
+ export default APIResource;
@@ -0,0 +1,23 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import SinksResource from './modules/resources/sinks-resource.js';
3
+ import SinkItemsResource from './modules/resources/sink-items-resource.js';
4
+ import AgentsResource from './modules/resources/agents-resource.js';
5
+ import AgentConfigurationsResource from './modules/resources/agent-configurations-resource.js';
6
+ import AgentSessionsResource from './modules/resources/agent-sessions-resource.js';
7
+ import AgentSessionInputRequestsResource from './modules/resources/agent-session-input-requests-resource.js';
8
+ import AgentSessionActivitiesResource from './modules/resources/agent-session-activities-resource.js';
9
+ export type OpenSinkConstructorOptions = {
10
+ apiKey: string;
11
+ url?: string;
12
+ };
13
+ export default class Opensink {
14
+ axios: AxiosInstance;
15
+ sinks: SinksResource;
16
+ sinkItems: SinkItemsResource;
17
+ agents: AgentsResource;
18
+ agentConfigurations: AgentConfigurationsResource;
19
+ agentSessions: AgentSessionsResource;
20
+ agentSessionInputRequests: AgentSessionInputRequestsResource;
21
+ agentSessionActivities: AgentSessionActivitiesResource;
22
+ constructor(options: OpenSinkConstructorOptions);
23
+ }
@@ -0,0 +1,28 @@
1
+ import axios from 'axios';
2
+ import SinksResource from './modules/resources/sinks-resource.js';
3
+ import SinkItemsResource from './modules/resources/sink-items-resource.js';
4
+ import AgentsResource from './modules/resources/agents-resource.js';
5
+ import AgentConfigurationsResource from './modules/resources/agent-configurations-resource.js';
6
+ import AgentSessionsResource from './modules/resources/agent-sessions-resource.js';
7
+ import AgentSessionInputRequestsResource from './modules/resources/agent-session-input-requests-resource.js';
8
+ import AgentSessionActivitiesResource from './modules/resources/agent-session-activities-resource.js';
9
+ var Opensink = /** @class */ (function () {
10
+ function Opensink(options) {
11
+ this.axios = axios.create({
12
+ baseURL: "".concat(options.url, "/api/v1"),
13
+ headers: {
14
+ 'Authorization': "Bearer ".concat(options.apiKey),
15
+ 'Content-Type': 'application/json',
16
+ },
17
+ });
18
+ this.sinks = new SinksResource(this.axios);
19
+ this.sinkItems = new SinkItemsResource(this.axios);
20
+ this.agents = new AgentsResource(this.axios);
21
+ this.agentConfigurations = new AgentConfigurationsResource(this.axios);
22
+ this.agentSessions = new AgentSessionsResource(this.axios);
23
+ this.agentSessionInputRequests = new AgentSessionInputRequestsResource(this.axios);
24
+ this.agentSessionActivities = new AgentSessionActivitiesResource(this.axios);
25
+ }
26
+ return Opensink;
27
+ }());
28
+ export default Opensink;
@@ -0,0 +1,12 @@
1
+ export default interface AgentConfig<T = Record<string, unknown>> {
2
+ id: string;
3
+ agent_id: string;
4
+ variant: string;
5
+ version: number;
6
+ variant_version: number;
7
+ schema_version: number;
8
+ schema: Record<string, unknown>;
9
+ value: T;
10
+ created_at: string;
11
+ updated_at: string;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export default interface Agent {
2
+ id: string;
3
+ workspace_id: string;
4
+ name: string;
5
+ description?: string;
6
+ config_id?: string;
7
+ created_at: string;
8
+ updated_at: string;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ export declare enum AgentSessionActivityType {
2
+ SESSION_STARTED = "session_started",
3
+ SESSION_ENDED = "session_ended",
4
+ MESSAGE = "message",
5
+ INPUT_REQUEST_CREATED = "input_request_created",
6
+ INPUT_REQUEST_RESOLVED = "input_request_resolved",
7
+ SINK_ITEM_CREATED = "sink_item_created",
8
+ STATE_UPDATED = "state_updated"
9
+ }
10
+ export declare enum AgentSessionActivitySource {
11
+ SYSTEM = "system",
12
+ AGENT = "agent",
13
+ USER = "user"
14
+ }
15
+ export interface AgentSessionActivityLink {
16
+ href: string;
17
+ text: string;
18
+ }
19
+ export default interface AgentSessionActivity {
20
+ id: string;
21
+ session_id: string;
22
+ agent_id: string;
23
+ workspace_id: string;
24
+ type: AgentSessionActivityType;
25
+ source: AgentSessionActivitySource;
26
+ related_entity_id?: string | null;
27
+ message?: string | null;
28
+ payload?: Record<string, unknown> | null;
29
+ links?: AgentSessionActivityLink[] | null;
30
+ created_at: string;
31
+ updated_at: string;
32
+ }
@@ -0,0 +1,16 @@
1
+ export var AgentSessionActivityType;
2
+ (function (AgentSessionActivityType) {
3
+ AgentSessionActivityType["SESSION_STARTED"] = "session_started";
4
+ AgentSessionActivityType["SESSION_ENDED"] = "session_ended";
5
+ AgentSessionActivityType["MESSAGE"] = "message";
6
+ AgentSessionActivityType["INPUT_REQUEST_CREATED"] = "input_request_created";
7
+ AgentSessionActivityType["INPUT_REQUEST_RESOLVED"] = "input_request_resolved";
8
+ AgentSessionActivityType["SINK_ITEM_CREATED"] = "sink_item_created";
9
+ AgentSessionActivityType["STATE_UPDATED"] = "state_updated";
10
+ })(AgentSessionActivityType || (AgentSessionActivityType = {}));
11
+ export var AgentSessionActivitySource;
12
+ (function (AgentSessionActivitySource) {
13
+ AgentSessionActivitySource["SYSTEM"] = "system";
14
+ AgentSessionActivitySource["AGENT"] = "agent";
15
+ AgentSessionActivitySource["USER"] = "user";
16
+ })(AgentSessionActivitySource || (AgentSessionActivitySource = {}));
@@ -0,0 +1,18 @@
1
+ export declare enum AgentSessionStatus {
2
+ RUNNING = "running",
3
+ WAITING_FOR_INPUT = "waiting_for_input",
4
+ PROCESSING_INPUT = "processing_input",
5
+ COMPLETED = "completed",
6
+ FAILED = "failed"
7
+ }
8
+ export default interface AgentSession {
9
+ id: string;
10
+ agent_id: string;
11
+ workspace_id: string;
12
+ status: AgentSessionStatus;
13
+ state: Record<string, unknown>;
14
+ metadata: Record<string, unknown>;
15
+ error_message?: string;
16
+ created_at: string;
17
+ updated_at: string;
18
+ }
@@ -0,0 +1,8 @@
1
+ export var AgentSessionStatus;
2
+ (function (AgentSessionStatus) {
3
+ AgentSessionStatus["RUNNING"] = "running";
4
+ AgentSessionStatus["WAITING_FOR_INPUT"] = "waiting_for_input";
5
+ AgentSessionStatus["PROCESSING_INPUT"] = "processing_input";
6
+ AgentSessionStatus["COMPLETED"] = "completed";
7
+ AgentSessionStatus["FAILED"] = "failed";
8
+ })(AgentSessionStatus || (AgentSessionStatus = {}));
@@ -0,0 +1,15 @@
1
+ export type AgentSessionInputRequestStatus = 'pending' | 'resolved';
2
+ export default interface AgentSessionInputRequest {
3
+ id: string;
4
+ session_id: string;
5
+ agent_id: string;
6
+ workspace_id: string;
7
+ key: string;
8
+ title: string;
9
+ message: string;
10
+ schema: Record<string, unknown>;
11
+ response: Record<string, unknown> | null;
12
+ status: AgentSessionInputRequestStatus;
13
+ created_at: string;
14
+ resolved_at?: string;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ export declare enum SinkColor {
2
+ NEUTRAL = "neutral",
3
+ BLUE = "blue",
4
+ GREEN = "green",
5
+ YELLOW = "yellow",
6
+ ORANGE = "orange",
7
+ RED = "red",
8
+ PURPLE = "purple",
9
+ PINK = "pink"
10
+ }
11
+ export default interface SinkData {
12
+ id: string;
13
+ name: string;
14
+ description?: string;
15
+ color: SinkColor;
16
+ is_public: boolean;
17
+ public_slug?: string;
18
+ secret: string;
19
+ workspace_id: string;
20
+ owner_id: string;
21
+ created_at: string;
22
+ updated_at: string;
23
+ }
@@ -0,0 +1,11 @@
1
+ export var SinkColor;
2
+ (function (SinkColor) {
3
+ SinkColor["NEUTRAL"] = "neutral";
4
+ SinkColor["BLUE"] = "blue";
5
+ SinkColor["GREEN"] = "green";
6
+ SinkColor["YELLOW"] = "yellow";
7
+ SinkColor["ORANGE"] = "orange";
8
+ SinkColor["RED"] = "red";
9
+ SinkColor["PURPLE"] = "purple";
10
+ SinkColor["PINK"] = "pink";
11
+ })(SinkColor || (SinkColor = {}));
@@ -0,0 +1,14 @@
1
+ export type FieldValue = string | number | boolean | null;
2
+ export default interface SinkItem {
3
+ id: string;
4
+ sink_id: string;
5
+ workspace_id: string;
6
+ title: string;
7
+ body?: string;
8
+ type?: string;
9
+ url?: string;
10
+ fields?: Record<string, FieldValue>;
11
+ occurred_at?: string;
12
+ created_at: string;
13
+ updated_at: string;
14
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "opensink",
3
+ "version": "0.1.0",
4
+ "description": "Official JavaScript/TypeScript client for the OpenSink API",
5
+ "private": false,
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "author": "OpenSink <hello@opensink.com> (https://opensink.com)",
9
+ "homepage": "https://github.com/opensinkai/opensink-javascript#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/opensinkai/opensink-javascript.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/opensinkai/opensink-javascript/issues"
16
+ },
17
+ "keywords": [
18
+ "opensink",
19
+ "ai",
20
+ "agents",
21
+ "api",
22
+ "sdk"
23
+ ],
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "scripts": {
36
+ "lint:fix": "yarn lint --fix",
37
+ "lint": "eslint ./src --ext .ts",
38
+ "build": "tsc && tsc-alias",
39
+ "build:packages": "yarn build",
40
+ "typecheck": "tsc --noEmit"
41
+ },
42
+ "devDependencies": {
43
+ "@eslint/js": "9.32.0",
44
+ "@stylistic/eslint-plugin": "5.2.2",
45
+ "@types/node": "24.1.0",
46
+ "eslint": "9.32.0",
47
+ "globals": "16.3.0",
48
+ "typescript": "5.8.3",
49
+ "tsc-alias": "1.8.16",
50
+ "typescript-eslint": "8.38.0"
51
+ },
52
+ "dependencies": {
53
+ "axios": "^1.13.4"
54
+ }
55
+ }