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.
@@ -1,5 +1,5 @@
1
1
  import Response from "../util/Response";
2
- import { AxiosPromise } from "axios";
2
+ import { AxiosPromise, AxiosProgressEvent } from "axios";
3
3
  declare class Agents {
4
4
  /**
5
5
  * List game titles that can be managed in the Agents section.
@@ -37,10 +37,34 @@ declare class Agents {
37
37
  * Run an agent planning cycle. Returns 402 when trial/subscription is required.
38
38
  */
39
39
  static runAgent<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
40
+ /**
41
+ * Upload one file for an agent run. data can include { agent_run_id }.
42
+ */
43
+ 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>>;
44
+ /**
45
+ * Alias for callers that use plural naming while uploading one file at a time.
46
+ */
47
+ 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>>;
40
48
  /**
41
49
  * List agent runs for a title.
42
50
  */
43
51
  static listRuns<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
52
+ /**
53
+ * View one durable agent run, including events, files, actions, and guidance when loaded by the API.
54
+ */
55
+ static viewRun<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
56
+ /**
57
+ * List real-time user-visible events for an agent run.
58
+ */
59
+ static listRunEvents<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
60
+ /**
61
+ * Request cancellation for a queued or running agent run.
62
+ */
63
+ static cancelRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
64
+ /**
65
+ * Send a course correction to a queued or running agent run.
66
+ */
67
+ static interjectRun<T>(title_id: string, run_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
44
68
  /**
45
69
  * List agent actions/approval queue for a title.
46
70
  */
@@ -78,9 +102,26 @@ declare class Agents {
78
102
  * AI dollars spent vs the configured monthly AI budget). Powers usage meters and limit warnings.
79
103
  */
80
104
  static usage<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
105
+ /**
106
+ * Get the prepaid agent credit balance and ledger (Pay-As-You-Go plan).
107
+ */
108
+ static credits<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
109
+ /**
110
+ * Buy prepaid agent credits (Pay-As-You-Go). Charges the card up front; the agent draws down
111
+ * credits per run and stops when they run out. data: { paymentMethod, amount_usd }.
112
+ */
113
+ static purchaseCredits<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
81
114
  /**
82
115
  * Start a Stripe-backed agent trial/subscription after setup.
83
116
  */
84
117
  static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
118
+ /**
119
+ * Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
120
+ */
121
+ static agencyOverview<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
122
+ /**
123
+ * Unified cross-title "needs you" inbox (open guidance + pending approvals across all titles).
124
+ */
125
+ static agencyInbox<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
85
126
  }
86
127
  export default Agents;
package/dist/esm/index.js CHANGED
@@ -18895,7 +18895,12 @@ var AgentsRoute = /** @class */ (function () {
18895
18895
  updateAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.PUT },
18896
18896
  deleteAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.DELETE },
18897
18897
  runAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}/run", method: HTTP_METHODS.POST },
18898
+ uploadAgentFiles: { url: "/agents/titles/{title_id}/agents/{agent_id}/files", method: HTTP_METHODS.POST },
18898
18899
  listRuns: { url: "/agents/titles/{title_id}/runs", method: HTTP_METHODS.GET },
18900
+ viewRun: { url: "/agents/titles/{title_id}/runs/{run_id}", method: HTTP_METHODS.GET },
18901
+ listRunEvents: { url: "/agents/titles/{title_id}/runs/{run_id}/events", method: HTTP_METHODS.GET },
18902
+ cancelRun: { url: "/agents/titles/{title_id}/runs/{run_id}/cancel", method: HTTP_METHODS.POST },
18903
+ interjectRun: { url: "/agents/titles/{title_id}/runs/{run_id}/interject", method: HTTP_METHODS.POST },
18899
18904
  listActions: { url: "/agents/titles/{title_id}/actions", method: HTTP_METHODS.GET },
18900
18905
  approveAction: { url: "/agents/titles/{title_id}/actions/{action_id}/approve", method: HTTP_METHODS.POST },
18901
18906
  rejectAction: { url: "/agents/titles/{title_id}/actions/{action_id}/reject", method: HTTP_METHODS.POST },
@@ -18905,7 +18910,11 @@ var AgentsRoute = /** @class */ (function () {
18905
18910
  listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
18906
18911
  results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
18907
18912
  usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
18913
+ credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
18914
+ purchaseCredits: { url: "/agents/titles/{title_id}/credits/purchase", method: HTTP_METHODS.POST },
18908
18915
  startTrial: { url: "/agents/titles/{title_id}/subscription/trial", method: HTTP_METHODS.POST },
18916
+ agencyOverview: { url: "/agents/agency/overview", method: HTTP_METHODS.GET },
18917
+ agencyInbox: { url: "/agents/agency/inbox", method: HTTP_METHODS.GET },
18909
18918
  };
18910
18919
  return AgentsRoute;
18911
18920
  }());
@@ -18967,12 +18976,51 @@ var Agents = /** @class */ (function () {
18967
18976
  Agents.runAgent = function (title_id, agent_id, data, params) {
18968
18977
  return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id: title_id, agent_id: agent_id }, params);
18969
18978
  };
18979
+ /**
18980
+ * Upload one file for an agent run. data can include { agent_run_id }.
18981
+ */
18982
+ Agents.uploadAgentFile = function (title_id, agent_id, file, data, params, onUploadProgress) {
18983
+ var url = AgentsRoute.routes.uploadAgentFiles.url
18984
+ .replace("{title_id}", title_id)
18985
+ .replace("{agent_id}", agent_id);
18986
+ return Requests.uploadFile(url, "file", file, data, params, onUploadProgress);
18987
+ };
18988
+ /**
18989
+ * Alias for callers that use plural naming while uploading one file at a time.
18990
+ */
18991
+ Agents.uploadAgentFiles = function (title_id, agent_id, file, data, params, onUploadProgress) {
18992
+ return Agents.uploadAgentFile(title_id, agent_id, file, data, params, onUploadProgress);
18993
+ };
18970
18994
  /**
18971
18995
  * List agent runs for a title.
18972
18996
  */
18973
18997
  Agents.listRuns = function (title_id, params) {
18974
18998
  return Requests.processRoute(AgentsRoute.routes.listRuns, {}, { title_id: title_id }, params);
18975
18999
  };
19000
+ /**
19001
+ * View one durable agent run, including events, files, actions, and guidance when loaded by the API.
19002
+ */
19003
+ Agents.viewRun = function (title_id, run_id, params) {
19004
+ return Requests.processRoute(AgentsRoute.routes.viewRun, {}, { title_id: title_id, run_id: run_id }, params);
19005
+ };
19006
+ /**
19007
+ * List real-time user-visible events for an agent run.
19008
+ */
19009
+ Agents.listRunEvents = function (title_id, run_id, params) {
19010
+ return Requests.processRoute(AgentsRoute.routes.listRunEvents, {}, { title_id: title_id, run_id: run_id }, params);
19011
+ };
19012
+ /**
19013
+ * Request cancellation for a queued or running agent run.
19014
+ */
19015
+ Agents.cancelRun = function (title_id, run_id, data, params) {
19016
+ return Requests.processRoute(AgentsRoute.routes.cancelRun, data || {}, { title_id: title_id, run_id: run_id }, params);
19017
+ };
19018
+ /**
19019
+ * Send a course correction to a queued or running agent run.
19020
+ */
19021
+ Agents.interjectRun = function (title_id, run_id, data, params) {
19022
+ return Requests.processRoute(AgentsRoute.routes.interjectRun, data || {}, { title_id: title_id, run_id: run_id }, params);
19023
+ };
18976
19024
  /**
18977
19025
  * List agent actions/approval queue for a title.
18978
19026
  */
@@ -19028,12 +19076,37 @@ var Agents = /** @class */ (function () {
19028
19076
  Agents.usage = function (title_id, params) {
19029
19077
  return Requests.processRoute(AgentsRoute.routes.usage, {}, { title_id: title_id }, params);
19030
19078
  };
19079
+ /**
19080
+ * Get the prepaid agent credit balance and ledger (Pay-As-You-Go plan).
19081
+ */
19082
+ Agents.credits = function (title_id, params) {
19083
+ return Requests.processRoute(AgentsRoute.routes.credits, {}, { title_id: title_id }, params);
19084
+ };
19085
+ /**
19086
+ * Buy prepaid agent credits (Pay-As-You-Go). Charges the card up front; the agent draws down
19087
+ * credits per run and stops when they run out. data: { paymentMethod, amount_usd }.
19088
+ */
19089
+ Agents.purchaseCredits = function (title_id, data, params) {
19090
+ return Requests.processRoute(AgentsRoute.routes.purchaseCredits, data, { title_id: title_id }, params);
19091
+ };
19031
19092
  /**
19032
19093
  * Start a Stripe-backed agent trial/subscription after setup.
19033
19094
  */
19034
19095
  Agents.startTrial = function (title_id, data, params) {
19035
19096
  return Requests.processRoute(AgentsRoute.routes.startTrial, data, { title_id: title_id }, params);
19036
19097
  };
19098
+ /**
19099
+ * Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
19100
+ */
19101
+ Agents.agencyOverview = function (params) {
19102
+ return Requests.processRoute(AgentsRoute.routes.agencyOverview, {}, {}, params);
19103
+ };
19104
+ /**
19105
+ * Unified cross-title "needs you" inbox (open guidance + pending approvals across all titles).
19106
+ */
19107
+ Agents.agencyInbox = function (params) {
19108
+ return Requests.processRoute(AgentsRoute.routes.agencyInbox, {}, {}, params);
19109
+ };
19037
19110
  return Agents;
19038
19111
  }());
19039
19112