glitch-javascript-sdk 3.2.10 → 3.2.13
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 +198 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Agents.d.ts +8 -4
- package/dist/esm/api/Mcp.d.ts +73 -0
- package/dist/esm/api/Users.d.ts +8 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +198 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/user.d.ts +10 -0
- package/dist/esm/routes/McpRoute.d.ts +15 -0
- package/dist/esm/util/Requests.d.ts +7 -0
- package/dist/index.d.ts +95 -4
- package/package.json +1 -1
- package/src/api/Agents.ts +11 -4
- package/src/api/Mcp.ts +150 -0
- package/src/api/Users.ts +13 -1
- package/src/api/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/models/user.ts +10 -1
- package/src/routes/AgentsRoute.ts +1 -0
- package/src/routes/McpRoute.ts +38 -0
- package/src/routes/UserRoutes.ts +2 -1
- package/src/util/Requests.ts +29 -0
package/dist/esm/api/Agents.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare class Agents {
|
|
|
29
29
|
*/
|
|
30
30
|
static listAgents<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
31
31
|
/**
|
|
32
|
-
* Create an agent before payment. Runs/results remain gated until
|
|
32
|
+
* Create an agent before payment. Runs/results remain gated until subscription or prepaid credits.
|
|
33
33
|
*/
|
|
34
34
|
static createAgent<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
35
35
|
/**
|
|
@@ -45,7 +45,7 @@ declare class Agents {
|
|
|
45
45
|
*/
|
|
46
46
|
static deleteAgent<T>(title_id: string, agent_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
47
47
|
/**
|
|
48
|
-
* Run an agent planning cycle. Returns 402 when
|
|
48
|
+
* Run an agent planning cycle. Returns 402 when subscription or prepaid credits are required.
|
|
49
49
|
*/
|
|
50
50
|
static runAgent<T>(title_id: string, agent_id: string, data?: AgentRunRequest, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
51
51
|
/**
|
|
@@ -105,12 +105,16 @@ declare class Agents {
|
|
|
105
105
|
* Answer a guidance request and write structured agent memory.
|
|
106
106
|
*/
|
|
107
107
|
static answerGuidance<T>(title_id: string, guidance_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
108
|
+
/**
|
|
109
|
+
* Rewrite an editable agent draft for review without executing the parent action.
|
|
110
|
+
*/
|
|
111
|
+
static rewriteAgentDraft<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
108
112
|
/**
|
|
109
113
|
* List structured agent memories for a title.
|
|
110
114
|
*/
|
|
111
115
|
static listMemories<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
112
116
|
/**
|
|
113
|
-
* Get results and outcome summary for title agents. Returns 402 until
|
|
117
|
+
* Get results and outcome summary for title agents. Returns 402 until subscription or prepaid credits are active.
|
|
114
118
|
*/
|
|
115
119
|
static results<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
116
120
|
/**
|
|
@@ -128,7 +132,7 @@ declare class Agents {
|
|
|
128
132
|
*/
|
|
129
133
|
static purchaseCredits<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
130
134
|
/**
|
|
131
|
-
* Start a Stripe-backed agent
|
|
135
|
+
* Start a Stripe-backed agent subscription after setup.
|
|
132
136
|
*/
|
|
133
137
|
static startTrial<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
134
138
|
/**
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise, AxiosProgressEvent } from "axios";
|
|
3
|
+
export interface McpStartRunRequest {
|
|
4
|
+
agent_id?: string | null;
|
|
5
|
+
initial_message?: string | null;
|
|
6
|
+
prompt?: string | null;
|
|
7
|
+
run_type?: string;
|
|
8
|
+
trigger_source?: string;
|
|
9
|
+
background?: boolean;
|
|
10
|
+
live_mode?: boolean;
|
|
11
|
+
attachment_ids?: string[];
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Client for the Glitch MCP paid facade (/mcp/v1).
|
|
16
|
+
*
|
|
17
|
+
* Authenticate with a Glitch user JWT or a title-scoped MCP token. The facade
|
|
18
|
+
* enforces subscription, title permissions, scope, and approval guardrails on
|
|
19
|
+
* every call; this client only forwards requests.
|
|
20
|
+
*/
|
|
21
|
+
declare class Mcp {
|
|
22
|
+
/** Health/auth probe. Returns authenticated=false (200) when no credential is set. */
|
|
23
|
+
static authStatus<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
24
|
+
/** List titles visible to the current user token or title-scoped MCP token. */
|
|
25
|
+
static listTitles<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
26
|
+
/** Fetch safe, subscription-gated workspace context for a title. */
|
|
27
|
+
static titleContext<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
28
|
+
/** Check subscription, trial, plan, and credit state for a title. */
|
|
29
|
+
static billing<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
30
|
+
/** Start a paid Glitch Agent run for a title. */
|
|
31
|
+
static startRun<T>(title_id: string, data?: McpStartRunRequest, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
32
|
+
/** Fetch a durable run with status, actions, guidance, events, files, and report. */
|
|
33
|
+
static viewRun<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
34
|
+
/** List user-visible timeline events for a run. */
|
|
35
|
+
static runEvents<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
36
|
+
/** Fetch the human-friendly final or partial report for a run. */
|
|
37
|
+
static finalReport<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
38
|
+
/**
|
|
39
|
+
* Server-Sent Events URL for a run's live event stream.
|
|
40
|
+
*
|
|
41
|
+
* Returns the absolute URL to open with an EventSource/fetch reader; the
|
|
42
|
+
* endpoint emits `status`, `run_event`, and a terminal `settled`/`timeout` event.
|
|
43
|
+
*/
|
|
44
|
+
static runStreamUrl(title_id: string, run_id: string, params?: Record<string, any>): string;
|
|
45
|
+
/** List downloadable files and hosted report artifacts for a run. */
|
|
46
|
+
static artifacts<T>(title_id: string, run_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
47
|
+
/** List proposed/guidance/approval/executed actions for a title. */
|
|
48
|
+
static listActions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
49
|
+
/** Approve a reviewable action. Execution remains guarded server-side. */
|
|
50
|
+
static approveAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
51
|
+
/** Reject a proposed or approval-needed action. */
|
|
52
|
+
static rejectAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
53
|
+
/** Execute an approved action. Public/paid/creator-facing work stays guarded. */
|
|
54
|
+
static executeAction<T>(title_id: string, action_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
55
|
+
/** List open or answered guidance requests for a title or run. */
|
|
56
|
+
static listGuidance<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
57
|
+
/** Answer a guidance request and resume the server-side workflow when possible. */
|
|
58
|
+
static answerGuidance<T>(title_id: string, guidance_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
59
|
+
/** Get instructions for uploading a file (points at uploadFile below). */
|
|
60
|
+
static createUpload<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
61
|
+
/**
|
|
62
|
+
* Upload a file (image, video, or document) to a title or run as multipart/form-data.
|
|
63
|
+
* The facade re-checks the title scope, subscription, and allowed mime types.
|
|
64
|
+
*/
|
|
65
|
+
static uploadFile<T>(title_id: string, file: File | Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
66
|
+
/** List MCP title tokens (user JWT only). */
|
|
67
|
+
static listTokens<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
68
|
+
/** Create a revocable title-scoped MCP token (user JWT only). */
|
|
69
|
+
static createToken<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
70
|
+
/** Revoke a title-scoped MCP token (user JWT only). */
|
|
71
|
+
static revokeToken<T>(title_id: string, token_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
72
|
+
}
|
|
73
|
+
export default Mcp;
|
package/dist/esm/api/Users.d.ts
CHANGED
|
@@ -179,6 +179,14 @@ declare class Users {
|
|
|
179
179
|
* @returns promise
|
|
180
180
|
*/
|
|
181
181
|
static clearGoogleAuth<T>(): AxiosPromise<Response<T>>;
|
|
182
|
+
/**
|
|
183
|
+
* Clear Gmail Workspace authentication information from the current user.
|
|
184
|
+
*
|
|
185
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/clearGmailAuth
|
|
186
|
+
*
|
|
187
|
+
* @returns promise
|
|
188
|
+
*/
|
|
189
|
+
static clearGmailAuth<T>(): AxiosPromise<Response<T>>;
|
|
182
190
|
/**
|
|
183
191
|
* Clear Stripe authentication information from the current user.
|
|
184
192
|
*
|
package/dist/esm/api/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ import Crm from "./Crm";
|
|
|
46
46
|
import Multiplayer from "./Multiplayer";
|
|
47
47
|
import ServerOperations from "./ServerOperations";
|
|
48
48
|
import Agents from "./Agents";
|
|
49
|
+
import Mcp from "./Mcp";
|
|
49
50
|
import PrDirectory from "./PrDirectory";
|
|
50
51
|
export { Ads };
|
|
51
52
|
export { AccessKeys };
|
|
@@ -95,4 +96,5 @@ export { Crm };
|
|
|
95
96
|
export { Multiplayer };
|
|
96
97
|
export { ServerOperations };
|
|
97
98
|
export { Agents };
|
|
99
|
+
export { Mcp };
|
|
98
100
|
export { PrDirectory };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ import { Crm } from './api';
|
|
|
46
46
|
import { Multiplayer } from './api';
|
|
47
47
|
import { ServerOperations } from './api';
|
|
48
48
|
import { Agents } from './api';
|
|
49
|
+
import { Mcp } from './api';
|
|
49
50
|
import { PrDirectory } from './api';
|
|
50
51
|
import Requests from "./util/Requests";
|
|
51
52
|
import Parser from "./util/Parser";
|
|
@@ -114,6 +115,7 @@ declare class Glitch {
|
|
|
114
115
|
Multiplayer: typeof Multiplayer;
|
|
115
116
|
ServerOperations: typeof ServerOperations;
|
|
116
117
|
Agents: typeof Agents;
|
|
118
|
+
Mcp: typeof Mcp;
|
|
117
119
|
PrDirectory: typeof PrDirectory;
|
|
118
120
|
};
|
|
119
121
|
static util: {
|
package/dist/esm/index.js
CHANGED
|
@@ -5326,6 +5326,35 @@ var Requests = /** @class */ (function () {
|
|
|
5326
5326
|
Requests.setCommunityID = function (community_id) {
|
|
5327
5327
|
Requests.community_id = community_id;
|
|
5328
5328
|
};
|
|
5329
|
+
/**
|
|
5330
|
+
* Build an absolute API URL using the currently configured base URL.
|
|
5331
|
+
*
|
|
5332
|
+
* This is useful for browser primitives such as EventSource that need a URL
|
|
5333
|
+
* string instead of an Axios request wrapper.
|
|
5334
|
+
*/
|
|
5335
|
+
Requests.buildUrl = function (url, params) {
|
|
5336
|
+
var path = url;
|
|
5337
|
+
if (params && Object.keys(params).length > 0) {
|
|
5338
|
+
var queryString = Object.entries(params)
|
|
5339
|
+
.filter(function (_a) {
|
|
5340
|
+
var value = _a[1];
|
|
5341
|
+
return value !== undefined && value !== null && value !== '';
|
|
5342
|
+
})
|
|
5343
|
+
.map(function (_a) {
|
|
5344
|
+
var key = _a[0], value = _a[1];
|
|
5345
|
+
if (Array.isArray(value)) {
|
|
5346
|
+
return value.map(function (item) { return "".concat(key, "[]=").concat(encodeURIComponent(item)); }).join('&');
|
|
5347
|
+
}
|
|
5348
|
+
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
5349
|
+
})
|
|
5350
|
+
.filter(Boolean)
|
|
5351
|
+
.join('&');
|
|
5352
|
+
if (queryString) {
|
|
5353
|
+
path = "".concat(path).concat(path.includes('?') ? '&' : '?').concat(queryString);
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
return Requests.baseUrl.replace(/\/+$/, '') + '/' + path.replace(/^\/+/, '');
|
|
5357
|
+
};
|
|
5329
5358
|
Requests.request = function (method, url, data, fileData) {
|
|
5330
5359
|
var headers = {
|
|
5331
5360
|
'Content-Type': 'application/json',
|
|
@@ -8831,6 +8860,7 @@ var UserRoutes = /** @class */ (function () {
|
|
|
8831
8860
|
clearTwitchAuth: { url: '/users/clearTwitchAuth', method: HTTP_METHODS.DELETE },
|
|
8832
8861
|
clearFacebookAuth: { url: '/users/clearFacebookAuth', method: HTTP_METHODS.DELETE },
|
|
8833
8862
|
clearGoogleAuth: { url: '/users/clearGoogleAuth', method: HTTP_METHODS.DELETE },
|
|
8863
|
+
clearGmailAuth: { url: '/users/clearGmailAuth', method: HTTP_METHODS.DELETE },
|
|
8834
8864
|
clearStripeAuth: { url: '/users/clearStripeAuth', method: HTTP_METHODS.DELETE },
|
|
8835
8865
|
clearTikTokAuth: { url: '/users/clearTikTokAuth', method: HTTP_METHODS.DELETE },
|
|
8836
8866
|
clearYoutubeAuth: { url: '/users/clearYoutubeAuth', method: HTTP_METHODS.DELETE },
|
|
@@ -9096,6 +9126,16 @@ var Users = /** @class */ (function () {
|
|
|
9096
9126
|
Users.clearGoogleAuth = function () {
|
|
9097
9127
|
return Requests.processRoute(UserRoutes.routes.clearGoogleAuth, {});
|
|
9098
9128
|
};
|
|
9129
|
+
/**
|
|
9130
|
+
* Clear Gmail Workspace authentication information from the current user.
|
|
9131
|
+
*
|
|
9132
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/clearGmailAuth
|
|
9133
|
+
*
|
|
9134
|
+
* @returns promise
|
|
9135
|
+
*/
|
|
9136
|
+
Users.clearGmailAuth = function () {
|
|
9137
|
+
return Requests.processRoute(UserRoutes.routes.clearGmailAuth, {});
|
|
9138
|
+
};
|
|
9099
9139
|
/**
|
|
9100
9140
|
* Clear Stripe authentication information from the current user.
|
|
9101
9141
|
*
|
|
@@ -19066,6 +19106,7 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
19066
19106
|
executeAction: { url: "/agents/titles/{title_id}/actions/{action_id}/execute", method: HTTP_METHODS.POST },
|
|
19067
19107
|
listGuidance: { url: "/agents/titles/{title_id}/guidance", method: HTTP_METHODS.GET },
|
|
19068
19108
|
answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
|
|
19109
|
+
rewriteAgentDraft: { url: "/agents/titles/{title_id}/drafts/rewrite", method: HTTP_METHODS.POST },
|
|
19069
19110
|
listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
|
|
19070
19111
|
results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
|
|
19071
19112
|
usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
|
|
@@ -19108,7 +19149,7 @@ var Agents = /** @class */ (function () {
|
|
|
19108
19149
|
return Requests.processRoute(AgentsRoute.routes.listAgents, {}, { title_id: title_id }, params);
|
|
19109
19150
|
};
|
|
19110
19151
|
/**
|
|
19111
|
-
* Create an agent before payment. Runs/results remain gated until
|
|
19152
|
+
* Create an agent before payment. Runs/results remain gated until subscription or prepaid credits.
|
|
19112
19153
|
*/
|
|
19113
19154
|
Agents.createAgent = function (title_id, data, params) {
|
|
19114
19155
|
return Requests.processRoute(AgentsRoute.routes.createAgent, data, { title_id: title_id }, params);
|
|
@@ -19132,7 +19173,7 @@ var Agents = /** @class */ (function () {
|
|
|
19132
19173
|
return Requests.processRoute(AgentsRoute.routes.deleteAgent, {}, { title_id: title_id, agent_id: agent_id }, params);
|
|
19133
19174
|
};
|
|
19134
19175
|
/**
|
|
19135
|
-
* Run an agent planning cycle. Returns 402 when
|
|
19176
|
+
* Run an agent planning cycle. Returns 402 when subscription or prepaid credits are required.
|
|
19136
19177
|
*/
|
|
19137
19178
|
Agents.runAgent = function (title_id, agent_id, data, params) {
|
|
19138
19179
|
return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id: title_id, agent_id: agent_id }, params);
|
|
@@ -19225,6 +19266,12 @@ var Agents = /** @class */ (function () {
|
|
|
19225
19266
|
Agents.answerGuidance = function (title_id, guidance_id, data, params) {
|
|
19226
19267
|
return Requests.processRoute(AgentsRoute.routes.answerGuidance, data, { title_id: title_id, guidance_id: guidance_id }, params);
|
|
19227
19268
|
};
|
|
19269
|
+
/**
|
|
19270
|
+
* Rewrite an editable agent draft for review without executing the parent action.
|
|
19271
|
+
*/
|
|
19272
|
+
Agents.rewriteAgentDraft = function (title_id, data, params) {
|
|
19273
|
+
return Requests.processRoute(AgentsRoute.routes.rewriteAgentDraft, data, { title_id: title_id }, params);
|
|
19274
|
+
};
|
|
19228
19275
|
/**
|
|
19229
19276
|
* List structured agent memories for a title.
|
|
19230
19277
|
*/
|
|
@@ -19232,7 +19279,7 @@ var Agents = /** @class */ (function () {
|
|
|
19232
19279
|
return Requests.processRoute(AgentsRoute.routes.listMemories, {}, { title_id: title_id }, params);
|
|
19233
19280
|
};
|
|
19234
19281
|
/**
|
|
19235
|
-
* Get results and outcome summary for title agents. Returns 402 until
|
|
19282
|
+
* Get results and outcome summary for title agents. Returns 402 until subscription or prepaid credits are active.
|
|
19236
19283
|
*/
|
|
19237
19284
|
Agents.results = function (title_id, params) {
|
|
19238
19285
|
return Requests.processRoute(AgentsRoute.routes.results, {}, { title_id: title_id }, params);
|
|
@@ -19258,7 +19305,7 @@ var Agents = /** @class */ (function () {
|
|
|
19258
19305
|
return Requests.processRoute(AgentsRoute.routes.purchaseCredits, data, { title_id: title_id }, params);
|
|
19259
19306
|
};
|
|
19260
19307
|
/**
|
|
19261
|
-
* Start a Stripe-backed agent
|
|
19308
|
+
* Start a Stripe-backed agent subscription after setup.
|
|
19262
19309
|
*/
|
|
19263
19310
|
Agents.startTrial = function (title_id, data, params) {
|
|
19264
19311
|
return Requests.processRoute(AgentsRoute.routes.startTrial, data, { title_id: title_id }, params);
|
|
@@ -19290,6 +19337,152 @@ var Agents = /** @class */ (function () {
|
|
|
19290
19337
|
return Agents;
|
|
19291
19338
|
}());
|
|
19292
19339
|
|
|
19340
|
+
/**
|
|
19341
|
+
* Glitch MCP paid facade (/mcp/v1).
|
|
19342
|
+
*
|
|
19343
|
+
* Mirrors the routes served by McpAgentController. These endpoints authenticate
|
|
19344
|
+
* with either a Glitch user JWT or a title-scoped MCP token and keep all planner,
|
|
19345
|
+
* billing, and executor logic server-side. The public @glitch/mcp adapter calls
|
|
19346
|
+
* the same endpoints; this SDK surface lets first-party TypeScript clients reuse them.
|
|
19347
|
+
*/
|
|
19348
|
+
var McpRoute = /** @class */ (function () {
|
|
19349
|
+
function McpRoute() {
|
|
19350
|
+
}
|
|
19351
|
+
McpRoute.routes = {
|
|
19352
|
+
authStatus: { url: "/mcp/v1/auth/status", method: HTTP_METHODS.GET },
|
|
19353
|
+
listTitles: { url: "/mcp/v1/titles", method: HTTP_METHODS.GET },
|
|
19354
|
+
titleContext: { url: "/mcp/v1/titles/{title_id}/context", method: HTTP_METHODS.GET },
|
|
19355
|
+
billing: { url: "/mcp/v1/titles/{title_id}/billing", method: HTTP_METHODS.GET },
|
|
19356
|
+
startRun: { url: "/mcp/v1/titles/{title_id}/runs", method: HTTP_METHODS.POST },
|
|
19357
|
+
viewRun: { url: "/mcp/v1/titles/{title_id}/runs/{run_id}", method: HTTP_METHODS.GET },
|
|
19358
|
+
runEvents: { url: "/mcp/v1/titles/{title_id}/runs/{run_id}/events", method: HTTP_METHODS.GET },
|
|
19359
|
+
streamRun: { url: "/mcp/v1/titles/{title_id}/runs/{run_id}/stream", method: HTTP_METHODS.GET },
|
|
19360
|
+
finalReport: { url: "/mcp/v1/titles/{title_id}/runs/{run_id}/report", method: HTTP_METHODS.GET },
|
|
19361
|
+
artifacts: { url: "/mcp/v1/titles/{title_id}/runs/{run_id}/artifacts", method: HTTP_METHODS.GET },
|
|
19362
|
+
listActions: { url: "/mcp/v1/titles/{title_id}/actions", method: HTTP_METHODS.GET },
|
|
19363
|
+
approveAction: { url: "/mcp/v1/titles/{title_id}/actions/{action_id}/approve", method: HTTP_METHODS.POST },
|
|
19364
|
+
rejectAction: { url: "/mcp/v1/titles/{title_id}/actions/{action_id}/reject", method: HTTP_METHODS.POST },
|
|
19365
|
+
executeAction: { url: "/mcp/v1/titles/{title_id}/actions/{action_id}/execute", method: HTTP_METHODS.POST },
|
|
19366
|
+
listGuidance: { url: "/mcp/v1/titles/{title_id}/guidance", method: HTTP_METHODS.GET },
|
|
19367
|
+
answerGuidance: { url: "/mcp/v1/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
|
|
19368
|
+
createUpload: { url: "/mcp/v1/titles/{title_id}/uploads", method: HTTP_METHODS.POST },
|
|
19369
|
+
uploadFile: { url: "/mcp/v1/titles/{title_id}/files", method: HTTP_METHODS.POST },
|
|
19370
|
+
listTokens: { url: "/mcp/v1/titles/{title_id}/tokens", method: HTTP_METHODS.GET },
|
|
19371
|
+
createToken: { url: "/mcp/v1/titles/{title_id}/tokens", method: HTTP_METHODS.POST },
|
|
19372
|
+
revokeToken: { url: "/mcp/v1/titles/{title_id}/tokens/{token_id}", method: HTTP_METHODS.DELETE },
|
|
19373
|
+
};
|
|
19374
|
+
return McpRoute;
|
|
19375
|
+
}());
|
|
19376
|
+
|
|
19377
|
+
/**
|
|
19378
|
+
* Client for the Glitch MCP paid facade (/mcp/v1).
|
|
19379
|
+
*
|
|
19380
|
+
* Authenticate with a Glitch user JWT or a title-scoped MCP token. The facade
|
|
19381
|
+
* enforces subscription, title permissions, scope, and approval guardrails on
|
|
19382
|
+
* every call; this client only forwards requests.
|
|
19383
|
+
*/
|
|
19384
|
+
var Mcp = /** @class */ (function () {
|
|
19385
|
+
function Mcp() {
|
|
19386
|
+
}
|
|
19387
|
+
/** Health/auth probe. Returns authenticated=false (200) when no credential is set. */
|
|
19388
|
+
Mcp.authStatus = function (params) {
|
|
19389
|
+
return Requests.processRoute(McpRoute.routes.authStatus, {}, {}, params);
|
|
19390
|
+
};
|
|
19391
|
+
/** List titles visible to the current user token or title-scoped MCP token. */
|
|
19392
|
+
Mcp.listTitles = function (params) {
|
|
19393
|
+
return Requests.processRoute(McpRoute.routes.listTitles, {}, {}, params);
|
|
19394
|
+
};
|
|
19395
|
+
/** Fetch safe, subscription-gated workspace context for a title. */
|
|
19396
|
+
Mcp.titleContext = function (title_id, params) {
|
|
19397
|
+
return Requests.processRoute(McpRoute.routes.titleContext, {}, { title_id: title_id }, params);
|
|
19398
|
+
};
|
|
19399
|
+
/** Check subscription, trial, plan, and credit state for a title. */
|
|
19400
|
+
Mcp.billing = function (title_id, params) {
|
|
19401
|
+
return Requests.processRoute(McpRoute.routes.billing, {}, { title_id: title_id }, params);
|
|
19402
|
+
};
|
|
19403
|
+
/** Start a paid Glitch Agent run for a title. */
|
|
19404
|
+
Mcp.startRun = function (title_id, data, params) {
|
|
19405
|
+
return Requests.processRoute(McpRoute.routes.startRun, data !== null && data !== void 0 ? data : {}, { title_id: title_id }, params);
|
|
19406
|
+
};
|
|
19407
|
+
/** Fetch a durable run with status, actions, guidance, events, files, and report. */
|
|
19408
|
+
Mcp.viewRun = function (title_id, run_id, params) {
|
|
19409
|
+
return Requests.processRoute(McpRoute.routes.viewRun, {}, { title_id: title_id, run_id: run_id }, params);
|
|
19410
|
+
};
|
|
19411
|
+
/** List user-visible timeline events for a run. */
|
|
19412
|
+
Mcp.runEvents = function (title_id, run_id, params) {
|
|
19413
|
+
return Requests.processRoute(McpRoute.routes.runEvents, {}, { title_id: title_id, run_id: run_id }, params);
|
|
19414
|
+
};
|
|
19415
|
+
/** Fetch the human-friendly final or partial report for a run. */
|
|
19416
|
+
Mcp.finalReport = function (title_id, run_id, params) {
|
|
19417
|
+
return Requests.processRoute(McpRoute.routes.finalReport, {}, { title_id: title_id, run_id: run_id }, params);
|
|
19418
|
+
};
|
|
19419
|
+
/**
|
|
19420
|
+
* Server-Sent Events URL for a run's live event stream.
|
|
19421
|
+
*
|
|
19422
|
+
* Returns the absolute URL to open with an EventSource/fetch reader; the
|
|
19423
|
+
* endpoint emits `status`, `run_event`, and a terminal `settled`/`timeout` event.
|
|
19424
|
+
*/
|
|
19425
|
+
Mcp.runStreamUrl = function (title_id, run_id, params) {
|
|
19426
|
+
var url = McpRoute.routes.streamRun.url
|
|
19427
|
+
.replace("{title_id}", encodeURIComponent(title_id))
|
|
19428
|
+
.replace("{run_id}", encodeURIComponent(run_id));
|
|
19429
|
+
return Requests.buildUrl(url, params);
|
|
19430
|
+
};
|
|
19431
|
+
/** List downloadable files and hosted report artifacts for a run. */
|
|
19432
|
+
Mcp.artifacts = function (title_id, run_id, params) {
|
|
19433
|
+
return Requests.processRoute(McpRoute.routes.artifacts, {}, { title_id: title_id, run_id: run_id }, params);
|
|
19434
|
+
};
|
|
19435
|
+
/** List proposed/guidance/approval/executed actions for a title. */
|
|
19436
|
+
Mcp.listActions = function (title_id, params) {
|
|
19437
|
+
return Requests.processRoute(McpRoute.routes.listActions, {}, { title_id: title_id }, params);
|
|
19438
|
+
};
|
|
19439
|
+
/** Approve a reviewable action. Execution remains guarded server-side. */
|
|
19440
|
+
Mcp.approveAction = function (title_id, action_id, data, params) {
|
|
19441
|
+
return Requests.processRoute(McpRoute.routes.approveAction, data !== null && data !== void 0 ? data : {}, { title_id: title_id, action_id: action_id }, params);
|
|
19442
|
+
};
|
|
19443
|
+
/** Reject a proposed or approval-needed action. */
|
|
19444
|
+
Mcp.rejectAction = function (title_id, action_id, data, params) {
|
|
19445
|
+
return Requests.processRoute(McpRoute.routes.rejectAction, data !== null && data !== void 0 ? data : {}, { title_id: title_id, action_id: action_id }, params);
|
|
19446
|
+
};
|
|
19447
|
+
/** Execute an approved action. Public/paid/creator-facing work stays guarded. */
|
|
19448
|
+
Mcp.executeAction = function (title_id, action_id, data, params) {
|
|
19449
|
+
return Requests.processRoute(McpRoute.routes.executeAction, data !== null && data !== void 0 ? data : {}, { title_id: title_id, action_id: action_id }, params);
|
|
19450
|
+
};
|
|
19451
|
+
/** List open or answered guidance requests for a title or run. */
|
|
19452
|
+
Mcp.listGuidance = function (title_id, params) {
|
|
19453
|
+
return Requests.processRoute(McpRoute.routes.listGuidance, {}, { title_id: title_id }, params);
|
|
19454
|
+
};
|
|
19455
|
+
/** Answer a guidance request and resume the server-side workflow when possible. */
|
|
19456
|
+
Mcp.answerGuidance = function (title_id, guidance_id, data, params) {
|
|
19457
|
+
return Requests.processRoute(McpRoute.routes.answerGuidance, data !== null && data !== void 0 ? data : {}, { title_id: title_id, guidance_id: guidance_id }, params);
|
|
19458
|
+
};
|
|
19459
|
+
/** Get instructions for uploading a file (points at uploadFile below). */
|
|
19460
|
+
Mcp.createUpload = function (title_id, data, params) {
|
|
19461
|
+
return Requests.processRoute(McpRoute.routes.createUpload, data !== null && data !== void 0 ? data : {}, { title_id: title_id }, params);
|
|
19462
|
+
};
|
|
19463
|
+
/**
|
|
19464
|
+
* Upload a file (image, video, or document) to a title or run as multipart/form-data.
|
|
19465
|
+
* The facade re-checks the title scope, subscription, and allowed mime types.
|
|
19466
|
+
*/
|
|
19467
|
+
Mcp.uploadFile = function (title_id, file, data, params, onUploadProgress) {
|
|
19468
|
+
var url = McpRoute.routes.uploadFile.url.replace("{title_id}", title_id);
|
|
19469
|
+
return Requests.uploadFile(url, "file", file, data, params, onUploadProgress);
|
|
19470
|
+
};
|
|
19471
|
+
/** List MCP title tokens (user JWT only). */
|
|
19472
|
+
Mcp.listTokens = function (title_id, params) {
|
|
19473
|
+
return Requests.processRoute(McpRoute.routes.listTokens, {}, { title_id: title_id }, params);
|
|
19474
|
+
};
|
|
19475
|
+
/** Create a revocable title-scoped MCP token (user JWT only). */
|
|
19476
|
+
Mcp.createToken = function (title_id, data, params) {
|
|
19477
|
+
return Requests.processRoute(McpRoute.routes.createToken, data !== null && data !== void 0 ? data : {}, { title_id: title_id }, params);
|
|
19478
|
+
};
|
|
19479
|
+
/** Revoke a title-scoped MCP token (user JWT only). */
|
|
19480
|
+
Mcp.revokeToken = function (title_id, token_id, params) {
|
|
19481
|
+
return Requests.processRoute(McpRoute.routes.revokeToken, {}, { title_id: title_id, token_id: token_id }, params);
|
|
19482
|
+
};
|
|
19483
|
+
return Mcp;
|
|
19484
|
+
}());
|
|
19485
|
+
|
|
19293
19486
|
/**
|
|
19294
19487
|
* Route declarations for the PR Directory API.
|
|
19295
19488
|
*
|
|
@@ -19949,6 +20142,7 @@ var Glitch = /** @class */ (function () {
|
|
|
19949
20142
|
Multiplayer: Multiplayer,
|
|
19950
20143
|
ServerOperations: ServerOperations,
|
|
19951
20144
|
Agents: Agents,
|
|
20145
|
+
Mcp: Mcp,
|
|
19952
20146
|
PrDirectory: PrDirectory,
|
|
19953
20147
|
};
|
|
19954
20148
|
Glitch.util = {
|