glitch-javascript-sdk 3.2.2 → 3.2.4
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/dist/cjs/index.js +66 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Agents.d.ts +38 -1
- package/dist/esm/index.js +66 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +37 -0
- package/package.json +1 -1
- package/src/api/Agents.ts +83 -1
- package/src/routes/AgentsRoute.ts +8 -0
package/dist/index.d.ts
CHANGED
|
@@ -9135,10 +9135,39 @@ declare class Agents {
|
|
|
9135
9135
|
* Run an agent planning cycle. Returns 402 when trial/subscription is required.
|
|
9136
9136
|
*/
|
|
9137
9137
|
static runAgent<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9138
|
+
/**
|
|
9139
|
+
* Upload one file for an agent run. data can include { agent_run_id }.
|
|
9140
|
+
*/
|
|
9141
|
+
static uploadAgentFile<T>(title_id: string, agent_id: string, file: File | Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
9142
|
+
/**
|
|
9143
|
+
* Alias for callers that use plural naming while uploading one file at a time.
|
|
9144
|
+
*/
|
|
9145
|
+
static uploadAgentFiles<T>(title_id: string, agent_id: string, file: File | Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
9138
9146
|
/**
|
|
9139
9147
|
* List agent runs for a title.
|
|
9140
9148
|
*/
|
|
9141
9149
|
static listRuns<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9150
|
+
/**
|
|
9151
|
+
* View one durable agent run, including events, files, actions, and guidance when loaded by the API.
|
|
9152
|
+
*/
|
|
9153
|
+
static viewRun<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9154
|
+
/**
|
|
9155
|
+
* List real-time user-visible events for an agent run.
|
|
9156
|
+
*/
|
|
9157
|
+
static listRunEvents<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9158
|
+
/**
|
|
9159
|
+
* Mark a queued or running agent run as being watched live so the UI can stream the loop
|
|
9160
|
+
* and the backend can avoid sending delayed background summaries to active viewers.
|
|
9161
|
+
*/
|
|
9162
|
+
static heartbeatRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9163
|
+
/**
|
|
9164
|
+
* Request cancellation for a queued or running agent run.
|
|
9165
|
+
*/
|
|
9166
|
+
static cancelRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9167
|
+
/**
|
|
9168
|
+
* Send a course correction to a queued or running agent run.
|
|
9169
|
+
*/
|
|
9170
|
+
static interjectRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9142
9171
|
/**
|
|
9143
9172
|
* List agent actions/approval queue for a title.
|
|
9144
9173
|
*/
|
|
@@ -9189,6 +9218,14 @@ declare class Agents {
|
|
|
9189
9218
|
* Start a Stripe-backed agent trial/subscription after setup.
|
|
9190
9219
|
*/
|
|
9191
9220
|
static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9221
|
+
/**
|
|
9222
|
+
* List social/ad schedulers. Useful when agent setup needs to attach to an existing workflow.
|
|
9223
|
+
*/
|
|
9224
|
+
static listSchedulers<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9225
|
+
/**
|
|
9226
|
+
* Create a scheduler inline from an agent setup flow.
|
|
9227
|
+
*/
|
|
9228
|
+
static createScheduler<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9192
9229
|
/**
|
|
9193
9230
|
* Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
|
|
9194
9231
|
*/
|
package/package.json
CHANGED
package/src/api/Agents.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AgentsRoute from "../routes/AgentsRoute";
|
|
2
2
|
import Requests from "../util/Requests";
|
|
3
3
|
import Response from "../util/Response";
|
|
4
|
-
import { AxiosPromise } from "axios";
|
|
4
|
+
import { AxiosPromise, AxiosProgressEvent } from "axios";
|
|
5
5
|
|
|
6
6
|
class Agents {
|
|
7
7
|
/**
|
|
@@ -67,6 +67,38 @@ class Agents {
|
|
|
67
67
|
return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id, agent_id }, params);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Upload one file for an agent run. data can include { agent_run_id }.
|
|
72
|
+
*/
|
|
73
|
+
public static uploadAgentFile<T>(
|
|
74
|
+
title_id: string,
|
|
75
|
+
agent_id: string,
|
|
76
|
+
file: File | Blob,
|
|
77
|
+
data?: object,
|
|
78
|
+
params?: Record<string, any>,
|
|
79
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
80
|
+
): AxiosPromise<Response<T>> {
|
|
81
|
+
const url = AgentsRoute.routes.uploadAgentFiles.url
|
|
82
|
+
.replace("{title_id}", title_id)
|
|
83
|
+
.replace("{agent_id}", agent_id);
|
|
84
|
+
|
|
85
|
+
return Requests.uploadFile(url, "file", file, data, params, onUploadProgress);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Alias for callers that use plural naming while uploading one file at a time.
|
|
90
|
+
*/
|
|
91
|
+
public static uploadAgentFiles<T>(
|
|
92
|
+
title_id: string,
|
|
93
|
+
agent_id: string,
|
|
94
|
+
file: File | Blob,
|
|
95
|
+
data?: object,
|
|
96
|
+
params?: Record<string, any>,
|
|
97
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
98
|
+
): AxiosPromise<Response<T>> {
|
|
99
|
+
return Agents.uploadAgentFile(title_id, agent_id, file, data, params, onUploadProgress);
|
|
100
|
+
}
|
|
101
|
+
|
|
70
102
|
/**
|
|
71
103
|
* List agent runs for a title.
|
|
72
104
|
*/
|
|
@@ -74,6 +106,42 @@ class Agents {
|
|
|
74
106
|
return Requests.processRoute(AgentsRoute.routes.listRuns, {}, { title_id }, params);
|
|
75
107
|
}
|
|
76
108
|
|
|
109
|
+
/**
|
|
110
|
+
* View one durable agent run, including events, files, actions, and guidance when loaded by the API.
|
|
111
|
+
*/
|
|
112
|
+
public static viewRun<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
113
|
+
return Requests.processRoute(AgentsRoute.routes.viewRun, {}, { title_id, run_id }, params);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* List real-time user-visible events for an agent run.
|
|
118
|
+
*/
|
|
119
|
+
public static listRunEvents<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
120
|
+
return Requests.processRoute(AgentsRoute.routes.listRunEvents, {}, { title_id, run_id }, params);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Mark a queued or running agent run as being watched live so the UI can stream the loop
|
|
125
|
+
* and the backend can avoid sending delayed background summaries to active viewers.
|
|
126
|
+
*/
|
|
127
|
+
public static heartbeatRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
128
|
+
return Requests.processRoute(AgentsRoute.routes.heartbeatRun, data || {}, { title_id, run_id }, params);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Request cancellation for a queued or running agent run.
|
|
133
|
+
*/
|
|
134
|
+
public static cancelRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
135
|
+
return Requests.processRoute(AgentsRoute.routes.cancelRun, data || {}, { title_id, run_id }, params);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Send a course correction to a queued or running agent run.
|
|
140
|
+
*/
|
|
141
|
+
public static interjectRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
142
|
+
return Requests.processRoute(AgentsRoute.routes.interjectRun, data || {}, { title_id, run_id }, params);
|
|
143
|
+
}
|
|
144
|
+
|
|
77
145
|
/**
|
|
78
146
|
* List agent actions/approval queue for a title.
|
|
79
147
|
*/
|
|
@@ -160,6 +228,20 @@ class Agents {
|
|
|
160
228
|
return Requests.processRoute(AgentsRoute.routes.startTrial, data, { title_id }, params);
|
|
161
229
|
}
|
|
162
230
|
|
|
231
|
+
/**
|
|
232
|
+
* List social/ad schedulers. Useful when agent setup needs to attach to an existing workflow.
|
|
233
|
+
*/
|
|
234
|
+
public static listSchedulers<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
235
|
+
return Requests.processRoute(AgentsRoute.routes.listSchedulers, {}, {}, params);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Create a scheduler inline from an agent setup flow.
|
|
240
|
+
*/
|
|
241
|
+
public static createScheduler<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
242
|
+
return Requests.processRoute(AgentsRoute.routes.createScheduler, data || {}, {}, params);
|
|
243
|
+
}
|
|
244
|
+
|
|
163
245
|
/**
|
|
164
246
|
* Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
|
|
165
247
|
*/
|
|
@@ -12,7 +12,13 @@ class AgentsRoute {
|
|
|
12
12
|
updateAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.PUT },
|
|
13
13
|
deleteAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.DELETE },
|
|
14
14
|
runAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}/run", method: HTTP_METHODS.POST },
|
|
15
|
+
uploadAgentFiles: { url: "/agents/titles/{title_id}/agents/{agent_id}/files", method: HTTP_METHODS.POST },
|
|
15
16
|
listRuns: { url: "/agents/titles/{title_id}/runs", method: HTTP_METHODS.GET },
|
|
17
|
+
viewRun: { url: "/agents/titles/{title_id}/runs/{run_id}", method: HTTP_METHODS.GET },
|
|
18
|
+
listRunEvents: { url: "/agents/titles/{title_id}/runs/{run_id}/events", method: HTTP_METHODS.GET },
|
|
19
|
+
heartbeatRun: { url: "/agents/titles/{title_id}/runs/{run_id}/heartbeat", method: HTTP_METHODS.POST },
|
|
20
|
+
cancelRun: { url: "/agents/titles/{title_id}/runs/{run_id}/cancel", method: HTTP_METHODS.POST },
|
|
21
|
+
interjectRun: { url: "/agents/titles/{title_id}/runs/{run_id}/interject", method: HTTP_METHODS.POST },
|
|
16
22
|
listActions: { url: "/agents/titles/{title_id}/actions", method: HTTP_METHODS.GET },
|
|
17
23
|
approveAction: { url: "/agents/titles/{title_id}/actions/{action_id}/approve", method: HTTP_METHODS.POST },
|
|
18
24
|
rejectAction: { url: "/agents/titles/{title_id}/actions/{action_id}/reject", method: HTTP_METHODS.POST },
|
|
@@ -25,6 +31,8 @@ class AgentsRoute {
|
|
|
25
31
|
credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
|
|
26
32
|
purchaseCredits: { url: "/agents/titles/{title_id}/credits/purchase", method: HTTP_METHODS.POST },
|
|
27
33
|
startTrial: { url: "/agents/titles/{title_id}/subscription/trial", method: HTTP_METHODS.POST },
|
|
34
|
+
listSchedulers: { url: "/schedulers", method: HTTP_METHODS.GET },
|
|
35
|
+
createScheduler: { url: "/schedulers", method: HTTP_METHODS.POST },
|
|
28
36
|
agencyOverview: { url: "/agents/agency/overview", method: HTTP_METHODS.GET },
|
|
29
37
|
agencyInbox: { url: "/agents/agency/inbox", method: HTTP_METHODS.GET },
|
|
30
38
|
};
|