glitch-javascript-sdk 3.3.4 → 3.3.6

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.
@@ -19,6 +19,17 @@ declare class AdminUsers {
19
19
  * @returns promise
20
20
  */
21
21
  static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
22
+ /**
23
+ * Retrieve aggregated user analytics for the admin directory.
24
+ *
25
+ * Supported params include `search`, `is_site_admin`, `is_verified`,
26
+ * `user_type`, `start_date`, `end_date`, `period`, `sort_by`, and
27
+ * `sort_order`.
28
+ *
29
+ * @param params Optional query parameters.
30
+ * @returns promise
31
+ */
32
+ static analytics<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
22
33
  /**
23
34
  * Retrieve a comprehensive profile for a single user, including communities,
24
35
  * administered titles, games played, roles, billing status, social presence,
@@ -11,7 +11,20 @@ export interface AgentRunRequest {
11
11
  agent_run_id?: string | null;
12
12
  [key: string]: any;
13
13
  }
14
+ export interface AgentStreamAnswerRequest {
15
+ prompt: string;
16
+ [key: string]: any;
17
+ }
18
+ export interface AgentFetchOptions {
19
+ params?: Record<string, any>;
20
+ signal?: AbortSignal;
21
+ headers?: Record<string, string>;
22
+ fetcher?: typeof fetch;
23
+ }
24
+ export interface AgentStreamAnswerOptions extends AgentFetchOptions {
25
+ }
14
26
  declare class Agents {
27
+ private static fetchWithAuth;
15
28
  /**
16
29
  * List game titles that can be managed in the Agents section.
17
30
  */
@@ -56,6 +69,15 @@ declare class Agents {
56
69
  * Run an agent planning cycle. Returns 402 when subscription or prepaid credits are required.
57
70
  */
58
71
  static runAgent<T>(title_id: string, agent_id: string, data?: AgentRunRequest, params?: Record<string, any>): AxiosPromise<Response<T>>;
72
+ /**
73
+ * Stream a quick advisory answer for the agent workspace.
74
+ *
75
+ * This returns the native Fetch API Response so callers can consume the
76
+ * ReadableStream body incrementally. A 409 response means streaming is
77
+ * disabled server-side and the caller should fall back to the normal run
78
+ * flow.
79
+ */
80
+ static streamAnswer(title_id: string, agent_id: string, data: AgentStreamAnswerRequest | string, options?: AgentStreamAnswerOptions): Promise<globalThis.Response>;
59
81
  /**
60
82
  * Upload one file for an agent run. data can include { agent_run_id }.
61
83
  */
@@ -64,6 +86,25 @@ declare class Agents {
64
86
  * Alias for callers that use plural naming while uploading one file at a time.
65
87
  */
66
88
  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>>;
89
+ /**
90
+ * List Google Drive files/folders available to attach to a title agent.
91
+ */
92
+ static listGoogleDriveFiles<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
93
+ /**
94
+ * Attach a Google Drive file as a reference file for an agent.
95
+ */
96
+ static attachGoogleDriveFile<T>(title_id: string, agent_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
97
+ /**
98
+ * Download a protected agent file through the authenticated API route.
99
+ *
100
+ * Returns the native Fetch API Response so callers can inspect headers such
101
+ * as Content-Disposition before creating a browser download or preview blob.
102
+ */
103
+ static downloadAgentFile(title_id: string, file_id: string, options?: AgentFetchOptions): Promise<globalThis.Response>;
104
+ /**
105
+ * Export a generated agent artifact to Google Drive.
106
+ */
107
+ static exportAgentFileToGoogleDrive<T>(title_id: string, file_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
67
108
  /**
68
109
  * List agent runs for a title.
69
110
  */
@@ -117,10 +158,41 @@ declare class Agents {
117
158
  * Rewrite an editable agent draft for review without executing the parent action.
118
159
  */
119
160
  static rewriteAgentDraft<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
161
+ /**
162
+ * Agent workflow convenience wrapper for creator invite context.
163
+ */
164
+ static creatorInviteContext<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
165
+ /**
166
+ * Agent workflow convenience wrapper for sending a reviewed creator invite.
167
+ */
168
+ static sendCreatorInvite<T>(campaign_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
169
+ /**
170
+ * Agent workflow convenience wrapper for updating a drafted social post.
171
+ */
172
+ static updateSocialPost<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
173
+ /**
174
+ * Agent workflow convenience wrapper for updating campaign settings.
175
+ */
176
+ static updateCampaign<T>(campaign_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
177
+ /**
178
+ * Agent workflow convenience wrapper for saving manual access keys.
179
+ */
180
+ static createAccessKeys<T>(title_id: string, data: {
181
+ platform: string;
182
+ codes: string;
183
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
120
184
  /**
121
185
  * List structured agent memories for a title.
122
186
  */
123
187
  static listMemories<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
188
+ /**
189
+ * Update one structured agent memory.
190
+ */
191
+ static updateMemory<T>(title_id: string, memory_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
192
+ /**
193
+ * Deactivate one structured agent memory.
194
+ */
195
+ static deactivateMemory<T>(title_id: string, memory_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
124
196
  /**
125
197
  * Get results and outcome summary for title agents. Returns 402 until subscription or prepaid credits are active.
126
198
  */
@@ -397,6 +397,14 @@ declare class Campaigns {
397
397
  * @returns promise
398
398
  */
399
399
  static sendInfluencerInvite<T>(campaign_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
400
+ /**
401
+ * Get creator context used when preparing a personalized invite.
402
+ */
403
+ static creatorInviteContext<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
404
+ /**
405
+ * Send a personalized creator invite after review.
406
+ */
407
+ static sendCreatorInvite<T>(campaign_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
400
408
  /**
401
409
  * Invites an influencer to join this campaign.
402
410
  *
package/dist/esm/index.js CHANGED
@@ -13259,6 +13259,8 @@ var CampaignsRoute = /** @class */ (function () {
13259
13259
  addType: { url: '/campaigns/{campaign_id}/addType', method: HTTP_METHODS.POST },
13260
13260
  removeType: { url: '/campaigns/{campaign_id}/removeType/{type_id}', method: HTTP_METHODS.DELETE },
13261
13261
  inviteInfluencer: { url: '/campaigns/{campaign_id}/influencers/invites', method: HTTP_METHODS.POST },
13262
+ influencerInviteProfileContext: { url: '/campaigns/{campaign_id}/influencers/invites/profile-context', method: HTTP_METHODS.GET },
13263
+ influencerInviteProfileSend: { url: '/campaigns/{campaign_id}/influencers/invites/profile-send', method: HTTP_METHODS.POST },
13262
13264
  viewInfluencerInvite: { url: '/campaigns/{campaign_id}/influencers/invites/{influencer_id}', method: HTTP_METHODS.GET },
13263
13265
  updateInfluencerInvite: { url: '/campaigns/{campaign_id}/influencers/invites/{influencer_id}', method: HTTP_METHODS.PUT },
13264
13266
  updateInfluencerCompensationInvite: { url: '/campaigns/{campaign_id}/influencers/invites/{influencer_id}/compensation', method: HTTP_METHODS.PUT },
@@ -13813,6 +13815,18 @@ var Campaigns = /** @class */ (function () {
13813
13815
  Campaigns.sendInfluencerInvite = function (campaign_id, data, params) {
13814
13816
  return Requests.processRoute(CampaignsRoute.routes.sendInfluencerInvite, data, { campaign_id: campaign_id }, params);
13815
13817
  };
13818
+ /**
13819
+ * Get creator context used when preparing a personalized invite.
13820
+ */
13821
+ Campaigns.creatorInviteContext = function (campaign_id, params) {
13822
+ return Requests.processRoute(CampaignsRoute.routes.influencerInviteProfileContext, {}, { campaign_id: campaign_id }, params);
13823
+ };
13824
+ /**
13825
+ * Send a personalized creator invite after review.
13826
+ */
13827
+ Campaigns.sendCreatorInvite = function (campaign_id, data, params) {
13828
+ return Requests.processRoute(CampaignsRoute.routes.influencerInviteProfileSend, data, { campaign_id: campaign_id }, params);
13829
+ };
13816
13830
  /**
13817
13831
  * Invites an influencer to join this campaign.
13818
13832
  *
@@ -19905,7 +19919,12 @@ var AgentsRoute = /** @class */ (function () {
19905
19919
  updateAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.PUT },
19906
19920
  deleteAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.DELETE },
19907
19921
  runAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}/run", method: HTTP_METHODS.POST },
19922
+ streamAnswer: { url: "/agents/titles/{title_id}/agents/{agent_id}/stream-answer", method: HTTP_METHODS.POST },
19908
19923
  uploadAgentFiles: { url: "/agents/titles/{title_id}/agents/{agent_id}/files", method: HTTP_METHODS.POST },
19924
+ listGoogleDriveFiles: { url: "/agents/titles/{title_id}/gmail/drive/files", method: HTTP_METHODS.GET },
19925
+ attachGoogleDriveFile: { url: "/agents/titles/{title_id}/agents/{agent_id}/drive/files", method: HTTP_METHODS.POST },
19926
+ downloadAgentFile: { url: "/agents/titles/{title_id}/files/{file_id}/download", method: HTTP_METHODS.GET },
19927
+ exportAgentFileToGoogleDrive: { url: "/agents/titles/{title_id}/files/{file_id}/export/google-drive", method: HTTP_METHODS.POST },
19909
19928
  listRuns: { url: "/agents/titles/{title_id}/runs", method: HTTP_METHODS.GET },
19910
19929
  viewRun: { url: "/agents/titles/{title_id}/runs/{run_id}", method: HTTP_METHODS.GET },
19911
19930
  listRunEvents: { url: "/agents/titles/{title_id}/runs/{run_id}/events", method: HTTP_METHODS.GET },
@@ -19920,6 +19939,8 @@ var AgentsRoute = /** @class */ (function () {
19920
19939
  answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
19921
19940
  rewriteAgentDraft: { url: "/agents/titles/{title_id}/drafts/rewrite", method: HTTP_METHODS.POST },
19922
19941
  listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
19942
+ updateMemory: { url: "/agents/titles/{title_id}/memories/{memory_id}", method: HTTP_METHODS.PATCH },
19943
+ deactivateMemory: { url: "/agents/titles/{title_id}/memories/{memory_id}", method: HTTP_METHODS.DELETE },
19923
19944
  results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
19924
19945
  usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
19925
19946
  credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
@@ -19936,6 +19957,22 @@ var AgentsRoute = /** @class */ (function () {
19936
19957
  var Agents = /** @class */ (function () {
19937
19958
  function Agents() {
19938
19959
  }
19960
+ Agents.fetchWithAuth = function (path, init, options) {
19961
+ var _a;
19962
+ if (options === void 0) { options = {}; }
19963
+ var url = Requests.buildUrl(path, options.params);
19964
+ var token = (_a = Config.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(Config);
19965
+ var headers = __assign({}, (init.headers || {}));
19966
+ if (token && !headers.Authorization) {
19967
+ headers.Authorization = "Bearer ".concat(token);
19968
+ }
19969
+ Object.assign(headers, options.headers || {});
19970
+ var fetcher = options.fetcher || (typeof globalThis !== "undefined" ? globalThis.fetch : undefined);
19971
+ if (!fetcher) {
19972
+ return Promise.reject(new Error("Fetch API is not available in this environment."));
19973
+ }
19974
+ return fetcher(url, __assign(__assign({}, init), { headers: headers, signal: options.signal }));
19975
+ };
19939
19976
  /**
19940
19977
  * List game titles that can be managed in the Agents section.
19941
19978
  */
@@ -20002,6 +20039,29 @@ var Agents = /** @class */ (function () {
20002
20039
  Agents.runAgent = function (title_id, agent_id, data, params) {
20003
20040
  return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id: title_id, agent_id: agent_id }, params);
20004
20041
  };
20042
+ /**
20043
+ * Stream a quick advisory answer for the agent workspace.
20044
+ *
20045
+ * This returns the native Fetch API Response so callers can consume the
20046
+ * ReadableStream body incrementally. A 409 response means streaming is
20047
+ * disabled server-side and the caller should fall back to the normal run
20048
+ * flow.
20049
+ */
20050
+ Agents.streamAnswer = function (title_id, agent_id, data, options) {
20051
+ if (options === void 0) { options = {}; }
20052
+ var body = typeof data === "string" ? { prompt: data } : data;
20053
+ var path = AgentsRoute.routes.streamAnswer.url
20054
+ .replace("{title_id}", title_id)
20055
+ .replace("{agent_id}", agent_id);
20056
+ return Agents.fetchWithAuth(path, {
20057
+ method: AgentsRoute.routes.streamAnswer.method,
20058
+ headers: {
20059
+ "Content-Type": "application/json",
20060
+ Accept: "text/event-stream",
20061
+ },
20062
+ body: JSON.stringify(body),
20063
+ }, options);
20064
+ };
20005
20065
  /**
20006
20066
  * Upload one file for an agent run. data can include { agent_run_id }.
20007
20067
  */
@@ -20017,6 +20077,42 @@ var Agents = /** @class */ (function () {
20017
20077
  Agents.uploadAgentFiles = function (title_id, agent_id, file, data, params, onUploadProgress) {
20018
20078
  return Agents.uploadAgentFile(title_id, agent_id, file, data, params, onUploadProgress);
20019
20079
  };
20080
+ /**
20081
+ * List Google Drive files/folders available to attach to a title agent.
20082
+ */
20083
+ Agents.listGoogleDriveFiles = function (title_id, params) {
20084
+ return Requests.processRoute(AgentsRoute.routes.listGoogleDriveFiles, {}, { title_id: title_id }, params);
20085
+ };
20086
+ /**
20087
+ * Attach a Google Drive file as a reference file for an agent.
20088
+ */
20089
+ Agents.attachGoogleDriveFile = function (title_id, agent_id, data, params) {
20090
+ return Requests.processRoute(AgentsRoute.routes.attachGoogleDriveFile, data || {}, { title_id: title_id, agent_id: agent_id }, params);
20091
+ };
20092
+ /**
20093
+ * Download a protected agent file through the authenticated API route.
20094
+ *
20095
+ * Returns the native Fetch API Response so callers can inspect headers such
20096
+ * as Content-Disposition before creating a browser download or preview blob.
20097
+ */
20098
+ Agents.downloadAgentFile = function (title_id, file_id, options) {
20099
+ if (options === void 0) { options = {}; }
20100
+ var path = AgentsRoute.routes.downloadAgentFile.url
20101
+ .replace("{title_id}", title_id)
20102
+ .replace("{file_id}", file_id);
20103
+ return Agents.fetchWithAuth(path, {
20104
+ method: AgentsRoute.routes.downloadAgentFile.method,
20105
+ headers: {
20106
+ Accept: "application/octet-stream",
20107
+ },
20108
+ }, options);
20109
+ };
20110
+ /**
20111
+ * Export a generated agent artifact to Google Drive.
20112
+ */
20113
+ Agents.exportAgentFileToGoogleDrive = function (title_id, file_id, data, params) {
20114
+ return Requests.processRoute(AgentsRoute.routes.exportAgentFileToGoogleDrive, data || {}, { title_id: title_id, file_id: file_id }, params);
20115
+ };
20020
20116
  /**
20021
20117
  * List agent runs for a title.
20022
20118
  */
@@ -20096,12 +20192,54 @@ var Agents = /** @class */ (function () {
20096
20192
  Agents.rewriteAgentDraft = function (title_id, data, params) {
20097
20193
  return Requests.processRoute(AgentsRoute.routes.rewriteAgentDraft, data, { title_id: title_id }, params);
20098
20194
  };
20195
+ /**
20196
+ * Agent workflow convenience wrapper for creator invite context.
20197
+ */
20198
+ Agents.creatorInviteContext = function (campaign_id, params) {
20199
+ return Campaigns.creatorInviteContext(campaign_id, params);
20200
+ };
20201
+ /**
20202
+ * Agent workflow convenience wrapper for sending a reviewed creator invite.
20203
+ */
20204
+ Agents.sendCreatorInvite = function (campaign_id, data, params) {
20205
+ return Campaigns.sendCreatorInvite(campaign_id, data || {}, params);
20206
+ };
20207
+ /**
20208
+ * Agent workflow convenience wrapper for updating a drafted social post.
20209
+ */
20210
+ Agents.updateSocialPost = function (post_id, data, params) {
20211
+ return SocialPosts.update(post_id, data || {}, params);
20212
+ };
20213
+ /**
20214
+ * Agent workflow convenience wrapper for updating campaign settings.
20215
+ */
20216
+ Agents.updateCampaign = function (campaign_id, data, params) {
20217
+ return Campaigns.update(campaign_id, data || {}, params);
20218
+ };
20219
+ /**
20220
+ * Agent workflow convenience wrapper for saving manual access keys.
20221
+ */
20222
+ Agents.createAccessKeys = function (title_id, data, params) {
20223
+ return AccessKeys.store(title_id, data, params);
20224
+ };
20099
20225
  /**
20100
20226
  * List structured agent memories for a title.
20101
20227
  */
20102
20228
  Agents.listMemories = function (title_id, params) {
20103
20229
  return Requests.processRoute(AgentsRoute.routes.listMemories, {}, { title_id: title_id }, params);
20104
20230
  };
20231
+ /**
20232
+ * Update one structured agent memory.
20233
+ */
20234
+ Agents.updateMemory = function (title_id, memory_id, data, params) {
20235
+ return Requests.processRoute(AgentsRoute.routes.updateMemory, data || {}, { title_id: title_id, memory_id: memory_id }, params);
20236
+ };
20237
+ /**
20238
+ * Deactivate one structured agent memory.
20239
+ */
20240
+ Agents.deactivateMemory = function (title_id, memory_id, params) {
20241
+ return Requests.processRoute(AgentsRoute.routes.deactivateMemory, {}, { title_id: title_id, memory_id: memory_id }, params);
20242
+ };
20105
20243
  /**
20106
20244
  * Get results and outcome summary for title agents. Returns 402 until subscription or prepaid credits are active.
20107
20245
  */
@@ -20521,6 +20659,11 @@ var AdminUsersRoute = /** @class */ (function () {
20521
20659
  url: '/admin/users',
20522
20660
  method: HTTP_METHODS.GET
20523
20661
  },
20662
+ // Aggregated user analytics for charts on the admin directory.
20663
+ analytics: {
20664
+ url: '/admin/users/analytics',
20665
+ method: HTTP_METHODS.GET
20666
+ },
20524
20667
  // Full profile for a single user (site admin only).
20525
20668
  view: {
20526
20669
  url: '/admin/users/{user_id}',
@@ -20558,6 +20701,19 @@ var AdminUsers = /** @class */ (function () {
20558
20701
  AdminUsers.list = function (params) {
20559
20702
  return Requests.processRoute(AdminUsersRoute.routes.list, undefined, undefined, params);
20560
20703
  };
20704
+ /**
20705
+ * Retrieve aggregated user analytics for the admin directory.
20706
+ *
20707
+ * Supported params include `search`, `is_site_admin`, `is_verified`,
20708
+ * `user_type`, `start_date`, `end_date`, `period`, `sort_by`, and
20709
+ * `sort_order`.
20710
+ *
20711
+ * @param params Optional query parameters.
20712
+ * @returns promise
20713
+ */
20714
+ AdminUsers.analytics = function (params) {
20715
+ return Requests.processRoute(AdminUsersRoute.routes.analytics, undefined, undefined, params);
20716
+ };
20561
20717
  /**
20562
20718
  * Retrieve a comprehensive profile for a single user, including communities,
20563
20719
  * administered titles, games played, roles, billing status, social presence,