glitch-javascript-sdk 3.2.0 → 3.2.2

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
@@ -9171,10 +9171,32 @@ declare class Agents {
9171
9171
  * Get results and outcome summary for title agents. Returns 402 until trial/subscription is active.
9172
9172
  */
9173
9173
  static results<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9174
+ /**
9175
+ * Get this title's agent usage against plan limits (agents used/included, monthly runs, and
9176
+ * AI dollars spent vs the configured monthly AI budget). Powers usage meters and limit warnings.
9177
+ */
9178
+ static usage<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9179
+ /**
9180
+ * Get the prepaid agent credit balance and ledger (Pay-As-You-Go plan).
9181
+ */
9182
+ static credits<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9183
+ /**
9184
+ * Buy prepaid agent credits (Pay-As-You-Go). Charges the card up front; the agent draws down
9185
+ * credits per run and stops when they run out. data: { paymentMethod, amount_usd }.
9186
+ */
9187
+ static purchaseCredits<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9174
9188
  /**
9175
9189
  * Start a Stripe-backed agent trial/subscription after setup.
9176
9190
  */
9177
9191
  static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9192
+ /**
9193
+ * Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
9194
+ */
9195
+ static agencyOverview<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
9196
+ /**
9197
+ * Unified cross-title "needs you" inbox (open guidance + pending approvals across all titles).
9198
+ */
9199
+ static agencyInbox<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
9178
9200
  }
9179
9201
 
9180
9202
  interface Route {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/api/Agents.ts CHANGED
@@ -130,12 +130,49 @@ class Agents {
130
130
  return Requests.processRoute(AgentsRoute.routes.results, {}, { title_id }, params);
131
131
  }
132
132
 
133
+ /**
134
+ * Get this title's agent usage against plan limits (agents used/included, monthly runs, and
135
+ * AI dollars spent vs the configured monthly AI budget). Powers usage meters and limit warnings.
136
+ */
137
+ public static usage<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
138
+ return Requests.processRoute(AgentsRoute.routes.usage, {}, { title_id }, params);
139
+ }
140
+
141
+ /**
142
+ * Get the prepaid agent credit balance and ledger (Pay-As-You-Go plan).
143
+ */
144
+ public static credits<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
145
+ return Requests.processRoute(AgentsRoute.routes.credits, {}, { title_id }, params);
146
+ }
147
+
148
+ /**
149
+ * Buy prepaid agent credits (Pay-As-You-Go). Charges the card up front; the agent draws down
150
+ * credits per run and stops when they run out. data: { paymentMethod, amount_usd }.
151
+ */
152
+ public static purchaseCredits<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
153
+ return Requests.processRoute(AgentsRoute.routes.purchaseCredits, data, { title_id }, params);
154
+ }
155
+
133
156
  /**
134
157
  * Start a Stripe-backed agent trial/subscription after setup.
135
158
  */
136
159
  public static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
137
160
  return Requests.processRoute(AgentsRoute.routes.startTrial, data, { title_id }, params);
138
161
  }
162
+
163
+ /**
164
+ * Cross-title agency cockpit: per-title agent status, billing/credits, and portfolio totals.
165
+ */
166
+ public static agencyOverview<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
167
+ return Requests.processRoute(AgentsRoute.routes.agencyOverview, {}, {}, params);
168
+ }
169
+
170
+ /**
171
+ * Unified cross-title "needs you" inbox (open guidance + pending approvals across all titles).
172
+ */
173
+ public static agencyInbox<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
174
+ return Requests.processRoute(AgentsRoute.routes.agencyInbox, {}, {}, params);
175
+ }
139
176
  }
140
177
 
141
178
  export default Agents;
@@ -21,7 +21,12 @@ class AgentsRoute {
21
21
  answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
22
22
  listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
23
23
  results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
24
+ usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
25
+ credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
26
+ purchaseCredits: { url: "/agents/titles/{title_id}/credits/purchase", method: HTTP_METHODS.POST },
24
27
  startTrial: { url: "/agents/titles/{title_id}/subscription/trial", method: HTTP_METHODS.POST },
28
+ agencyOverview: { url: "/agents/agency/overview", method: HTTP_METHODS.GET },
29
+ agencyInbox: { url: "/agents/agency/inbox", method: HTTP_METHODS.GET },
25
30
  };
26
31
  }
27
32