glitch-javascript-sdk 3.1.6 → 3.2.1

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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class AgentsRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default AgentsRoute;
package/dist/index.d.ts CHANGED
@@ -9098,6 +9098,90 @@ declare class ServerOperations {
9098
9098
  static updatePolicy<T>(title_id: string, build_id: string, data: object): AxiosPromise<Response<T>>;
9099
9099
  }
9100
9100
 
9101
+ declare class Agents {
9102
+ /**
9103
+ * List game titles that can be managed in the Agents section.
9104
+ */
9105
+ static listTitles<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
9106
+ /**
9107
+ * Return the full Laravel API route catalog agents use for route-aware planning.
9108
+ */
9109
+ static routeCatalog<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
9110
+ /**
9111
+ * Get a title-scoped agent workspace with setup, billing, counts, and route summary.
9112
+ */
9113
+ static workspace<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9114
+ /**
9115
+ * List agents for a title.
9116
+ */
9117
+ static listAgents<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9118
+ /**
9119
+ * Create an agent before payment. Runs/results remain gated until trial/subscription.
9120
+ */
9121
+ static createAgent<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9122
+ /**
9123
+ * View one agent.
9124
+ */
9125
+ static viewAgent<T>(title_id: string, agent_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9126
+ /**
9127
+ * Update an agent's setup, policies, and guidance stop rules.
9128
+ */
9129
+ static updateAgent<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9130
+ /**
9131
+ * Archive an agent.
9132
+ */
9133
+ static deleteAgent<T>(title_id: string, agent_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9134
+ /**
9135
+ * Run an agent planning cycle. Returns 402 when trial/subscription is required.
9136
+ */
9137
+ static runAgent<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9138
+ /**
9139
+ * List agent runs for a title.
9140
+ */
9141
+ static listRuns<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9142
+ /**
9143
+ * List agent actions/approval queue for a title.
9144
+ */
9145
+ static listActions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9146
+ /**
9147
+ * Approve an agent action.
9148
+ */
9149
+ static approveAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9150
+ /**
9151
+ * Reject an agent action.
9152
+ */
9153
+ static rejectAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9154
+ /**
9155
+ * Execute an approved safe action.
9156
+ */
9157
+ static executeAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9158
+ /**
9159
+ * List guidance requests where agents have stopped for developer direction.
9160
+ */
9161
+ static listGuidance<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9162
+ /**
9163
+ * Answer a guidance request and write structured agent memory.
9164
+ */
9165
+ static answerGuidance<T>(title_id: string, guidance_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9166
+ /**
9167
+ * List structured agent memories for a title.
9168
+ */
9169
+ static listMemories<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
9170
+ /**
9171
+ * Get results and outcome summary for title agents. Returns 402 until trial/subscription is active.
9172
+ */
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
+ * Start a Stripe-backed agent trial/subscription after setup.
9181
+ */
9182
+ static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
9183
+ }
9184
+
9101
9185
  interface Route {
9102
9186
  url: string;
9103
9187
  method: string;
@@ -9453,6 +9537,7 @@ declare class Glitch {
9453
9537
  Crm: typeof Crm;
9454
9538
  Multiplayer: typeof Multiplayer;
9455
9539
  ServerOperations: typeof ServerOperations;
9540
+ Agents: typeof Agents;
9456
9541
  };
9457
9542
  static util: {
9458
9543
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.1.6",
3
+ "version": "3.2.1",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,149 @@
1
+ import AgentsRoute from "../routes/AgentsRoute";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class Agents {
7
+ /**
8
+ * List game titles that can be managed in the Agents section.
9
+ */
10
+ public static listTitles<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
11
+ return Requests.processRoute(AgentsRoute.routes.listTitles, {}, {}, params);
12
+ }
13
+
14
+ /**
15
+ * Return the full Laravel API route catalog agents use for route-aware planning.
16
+ */
17
+ public static routeCatalog<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
18
+ return Requests.processRoute(AgentsRoute.routes.routeCatalog, {}, {}, params);
19
+ }
20
+
21
+ /**
22
+ * Get a title-scoped agent workspace with setup, billing, counts, and route summary.
23
+ */
24
+ public static workspace<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
25
+ return Requests.processRoute(AgentsRoute.routes.workspace, {}, { title_id }, params);
26
+ }
27
+
28
+ /**
29
+ * List agents for a title.
30
+ */
31
+ public static listAgents<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
32
+ return Requests.processRoute(AgentsRoute.routes.listAgents, {}, { title_id }, params);
33
+ }
34
+
35
+ /**
36
+ * Create an agent before payment. Runs/results remain gated until trial/subscription.
37
+ */
38
+ public static createAgent<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
39
+ return Requests.processRoute(AgentsRoute.routes.createAgent, data, { title_id }, params);
40
+ }
41
+
42
+ /**
43
+ * View one agent.
44
+ */
45
+ public static viewAgent<T>(title_id: string, agent_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
46
+ return Requests.processRoute(AgentsRoute.routes.viewAgent, {}, { title_id, agent_id }, params);
47
+ }
48
+
49
+ /**
50
+ * Update an agent's setup, policies, and guidance stop rules.
51
+ */
52
+ public static updateAgent<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
53
+ return Requests.processRoute(AgentsRoute.routes.updateAgent, data, { title_id, agent_id }, params);
54
+ }
55
+
56
+ /**
57
+ * Archive an agent.
58
+ */
59
+ public static deleteAgent<T>(title_id: string, agent_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
60
+ return Requests.processRoute(AgentsRoute.routes.deleteAgent, {}, { title_id, agent_id }, params);
61
+ }
62
+
63
+ /**
64
+ * Run an agent planning cycle. Returns 402 when trial/subscription is required.
65
+ */
66
+ public static runAgent<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
67
+ return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id, agent_id }, params);
68
+ }
69
+
70
+ /**
71
+ * List agent runs for a title.
72
+ */
73
+ public static listRuns<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
74
+ return Requests.processRoute(AgentsRoute.routes.listRuns, {}, { title_id }, params);
75
+ }
76
+
77
+ /**
78
+ * List agent actions/approval queue for a title.
79
+ */
80
+ public static listActions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
81
+ return Requests.processRoute(AgentsRoute.routes.listActions, {}, { title_id }, params);
82
+ }
83
+
84
+ /**
85
+ * Approve an agent action.
86
+ */
87
+ public static approveAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
88
+ return Requests.processRoute(AgentsRoute.routes.approveAction, data || {}, { title_id, action_id }, params);
89
+ }
90
+
91
+ /**
92
+ * Reject an agent action.
93
+ */
94
+ public static rejectAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
95
+ return Requests.processRoute(AgentsRoute.routes.rejectAction, data || {}, { title_id, action_id }, params);
96
+ }
97
+
98
+ /**
99
+ * Execute an approved safe action.
100
+ */
101
+ public static executeAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
102
+ return Requests.processRoute(AgentsRoute.routes.executeAction, data || {}, { title_id, action_id }, params);
103
+ }
104
+
105
+ /**
106
+ * List guidance requests where agents have stopped for developer direction.
107
+ */
108
+ public static listGuidance<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
109
+ return Requests.processRoute(AgentsRoute.routes.listGuidance, {}, { title_id }, params);
110
+ }
111
+
112
+ /**
113
+ * Answer a guidance request and write structured agent memory.
114
+ */
115
+ public static answerGuidance<T>(title_id: string, guidance_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
116
+ return Requests.processRoute(AgentsRoute.routes.answerGuidance, data, { title_id, guidance_id }, params);
117
+ }
118
+
119
+ /**
120
+ * List structured agent memories for a title.
121
+ */
122
+ public static listMemories<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
123
+ return Requests.processRoute(AgentsRoute.routes.listMemories, {}, { title_id }, params);
124
+ }
125
+
126
+ /**
127
+ * Get results and outcome summary for title agents. Returns 402 until trial/subscription is active.
128
+ */
129
+ public static results<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
130
+ return Requests.processRoute(AgentsRoute.routes.results, {}, { title_id }, params);
131
+ }
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
+ * Start a Stripe-backed agent trial/subscription after setup.
143
+ */
144
+ public static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
145
+ return Requests.processRoute(AgentsRoute.routes.startTrial, data, { title_id }, params);
146
+ }
147
+ }
148
+
149
+ export default Agents;
package/src/api/index.ts CHANGED
@@ -45,6 +45,7 @@ import Education from "./Education";
45
45
  import Crm from "./Crm";
46
46
  import Multiplayer from "./Multiplayer";
47
47
  import ServerOperations from "./ServerOperations";
48
+ import Agents from "./Agents";
48
49
 
49
50
  export {Ads};
50
51
  export {AccessKeys};
@@ -93,3 +94,4 @@ export {Education};
93
94
  export {Crm};
94
95
  export {Multiplayer};
95
96
  export {ServerOperations};
97
+ export {Agents};
package/src/index.ts CHANGED
@@ -49,6 +49,7 @@ import {Education} from './api';
49
49
  import {Crm} from './api';
50
50
  import {Multiplayer} from './api';
51
51
  import {ServerOperations} from './api';
52
+ import {Agents} from './api';
52
53
 
53
54
  import Requests from "./util/Requests";
54
55
  import Parser from "./util/Parser";
@@ -127,6 +128,7 @@ class Glitch {
127
128
  Crm : Crm,
128
129
  Multiplayer : Multiplayer,
129
130
  ServerOperations : ServerOperations,
131
+ Agents : Agents,
130
132
  }
131
133
 
132
134
  public static util = {
@@ -0,0 +1,29 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class AgentsRoute {
5
+ public static routes: { [key: string]: Route } = {
6
+ listTitles: { url: "/agents/titles", method: HTTP_METHODS.GET },
7
+ routeCatalog: { url: "/agents/routes/catalog", method: HTTP_METHODS.GET },
8
+ workspace: { url: "/agents/titles/{title_id}/workspace", method: HTTP_METHODS.GET },
9
+ listAgents: { url: "/agents/titles/{title_id}/agents", method: HTTP_METHODS.GET },
10
+ createAgent: { url: "/agents/titles/{title_id}/agents", method: HTTP_METHODS.POST },
11
+ viewAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.GET },
12
+ updateAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.PUT },
13
+ deleteAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.DELETE },
14
+ runAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}/run", method: HTTP_METHODS.POST },
15
+ listRuns: { url: "/agents/titles/{title_id}/runs", method: HTTP_METHODS.GET },
16
+ listActions: { url: "/agents/titles/{title_id}/actions", method: HTTP_METHODS.GET },
17
+ approveAction: { url: "/agents/titles/{title_id}/actions/{action_id}/approve", method: HTTP_METHODS.POST },
18
+ rejectAction: { url: "/agents/titles/{title_id}/actions/{action_id}/reject", method: HTTP_METHODS.POST },
19
+ executeAction: { url: "/agents/titles/{title_id}/actions/{action_id}/execute", method: HTTP_METHODS.POST },
20
+ listGuidance: { url: "/agents/titles/{title_id}/guidance", method: HTTP_METHODS.GET },
21
+ answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
22
+ listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
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
+ startTrial: { url: "/agents/titles/{title_id}/subscription/trial", method: HTTP_METHODS.POST },
26
+ };
27
+ }
28
+
29
+ export default AgentsRoute;