glitch-javascript-sdk 3.2.1 → 3.2.3
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 +73 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Agents.d.ts +42 -1
- package/dist/esm/index.js +73 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +41 -0
- package/package.json +1 -1
- package/src/api/Agents.ts +90 -1
- package/src/routes/AgentsRoute.ts +9 -0
package/dist/index.d.ts
CHANGED
|
@@ -9135,10 +9135,34 @@ 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
|
+
* Request cancellation for a queued or running agent run.
|
|
9160
|
+
*/
|
|
9161
|
+
static cancelRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9162
|
+
/**
|
|
9163
|
+
* Send a course correction to a queued or running agent run.
|
|
9164
|
+
*/
|
|
9165
|
+
static interjectRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9142
9166
|
/**
|
|
9143
9167
|
* List agent actions/approval queue for a title.
|
|
9144
9168
|
*/
|
|
@@ -9176,10 +9200,27 @@ declare class Agents {
|
|
|
9176
9200
|
* AI dollars spent vs the configured monthly AI budget). Powers usage meters and limit warnings.
|
|
9177
9201
|
*/
|
|
9178
9202
|
static usage<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9203
|
+
/**
|
|
9204
|
+
* Get the prepaid agent credit balance and ledger (Pay-As-You-Go plan).
|
|
9205
|
+
*/
|
|
9206
|
+
static credits<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9207
|
+
/**
|
|
9208
|
+
* Buy prepaid agent credits (Pay-As-You-Go). Charges the card up front; the agent draws down
|
|
9209
|
+
* credits per run and stops when they run out. data: { paymentMethod, amount_usd }.
|
|
9210
|
+
*/
|
|
9211
|
+
static purchaseCredits<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9179
9212
|
/**
|
|
9180
9213
|
* Start a Stripe-backed agent trial/subscription after setup.
|
|
9181
9214
|
*/
|
|
9182
9215
|
static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9216
|
+
/**
|
|
9217
|
+
* Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
|
|
9218
|
+
*/
|
|
9219
|
+
static agencyOverview<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9220
|
+
/**
|
|
9221
|
+
* Unified cross-title "needs you" inbox (open guidance + pending approvals across all titles).
|
|
9222
|
+
*/
|
|
9223
|
+
static agencyInbox<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
9183
9224
|
}
|
|
9184
9225
|
|
|
9185
9226
|
interface Route {
|
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,34 @@ 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
|
+
* Request cancellation for a queued or running agent run.
|
|
125
|
+
*/
|
|
126
|
+
public static cancelRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
127
|
+
return Requests.processRoute(AgentsRoute.routes.cancelRun, data || {}, { title_id, run_id }, params);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Send a course correction to a queued or running agent run.
|
|
132
|
+
*/
|
|
133
|
+
public static interjectRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
134
|
+
return Requests.processRoute(AgentsRoute.routes.interjectRun, data || {}, { title_id, run_id }, params);
|
|
135
|
+
}
|
|
136
|
+
|
|
77
137
|
/**
|
|
78
138
|
* List agent actions/approval queue for a title.
|
|
79
139
|
*/
|
|
@@ -138,12 +198,41 @@ class Agents {
|
|
|
138
198
|
return Requests.processRoute(AgentsRoute.routes.usage, {}, { title_id }, params);
|
|
139
199
|
}
|
|
140
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Get the prepaid agent credit balance and ledger (Pay-As-You-Go plan).
|
|
203
|
+
*/
|
|
204
|
+
public static credits<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
205
|
+
return Requests.processRoute(AgentsRoute.routes.credits, {}, { title_id }, params);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Buy prepaid agent credits (Pay-As-You-Go). Charges the card up front; the agent draws down
|
|
210
|
+
* credits per run and stops when they run out. data: { paymentMethod, amount_usd }.
|
|
211
|
+
*/
|
|
212
|
+
public static purchaseCredits<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
213
|
+
return Requests.processRoute(AgentsRoute.routes.purchaseCredits, data, { title_id }, params);
|
|
214
|
+
}
|
|
215
|
+
|
|
141
216
|
/**
|
|
142
217
|
* Start a Stripe-backed agent trial/subscription after setup.
|
|
143
218
|
*/
|
|
144
219
|
public static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
145
220
|
return Requests.processRoute(AgentsRoute.routes.startTrial, data, { title_id }, params);
|
|
146
221
|
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
|
|
225
|
+
*/
|
|
226
|
+
public static agencyOverview<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
227
|
+
return Requests.processRoute(AgentsRoute.routes.agencyOverview, {}, {}, params);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Unified cross-title "needs you" inbox (open guidance + pending approvals across all titles).
|
|
232
|
+
*/
|
|
233
|
+
public static agencyInbox<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
234
|
+
return Requests.processRoute(AgentsRoute.routes.agencyInbox, {}, {}, params);
|
|
235
|
+
}
|
|
147
236
|
}
|
|
148
237
|
|
|
149
238
|
export default Agents;
|
|
@@ -12,7 +12,12 @@ 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
|
+
cancelRun: { url: "/agents/titles/{title_id}/runs/{run_id}/cancel", method: HTTP_METHODS.POST },
|
|
20
|
+
interjectRun: { url: "/agents/titles/{title_id}/runs/{run_id}/interject", method: HTTP_METHODS.POST },
|
|
16
21
|
listActions: { url: "/agents/titles/{title_id}/actions", method: HTTP_METHODS.GET },
|
|
17
22
|
approveAction: { url: "/agents/titles/{title_id}/actions/{action_id}/approve", method: HTTP_METHODS.POST },
|
|
18
23
|
rejectAction: { url: "/agents/titles/{title_id}/actions/{action_id}/reject", method: HTTP_METHODS.POST },
|
|
@@ -22,7 +27,11 @@ class AgentsRoute {
|
|
|
22
27
|
listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
|
|
23
28
|
results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
|
|
24
29
|
usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
|
|
30
|
+
credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
|
|
31
|
+
purchaseCredits: { url: "/agents/titles/{title_id}/credits/purchase", method: HTTP_METHODS.POST },
|
|
25
32
|
startTrial: { url: "/agents/titles/{title_id}/subscription/trial", method: HTTP_METHODS.POST },
|
|
33
|
+
agencyOverview: { url: "/agents/agency/overview", method: HTTP_METHODS.GET },
|
|
34
|
+
agencyInbox: { url: "/agents/agency/inbox", method: HTTP_METHODS.GET },
|
|
26
35
|
};
|
|
27
36
|
}
|
|
28
37
|
|