glitch-javascript-sdk 3.2.2 → 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/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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "publishConfig": {
6
6
  "access": "public"
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
  */
@@ -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 },