glitch-javascript-sdk 3.3.2 → 3.3.5
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 +167 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Agents.d.ts +72 -0
- package/dist/esm/api/Campaigns.d.ts +8 -0
- package/dist/esm/api/Newsletters.d.ts +6 -0
- package/dist/esm/api/PlayTests.d.ts +15 -1
- package/dist/esm/index.js +167 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +100 -0
- package/package.json +1 -1
- package/src/api/Agents.ts +170 -0
- package/src/api/Campaigns.ts +14 -0
- package/src/api/Newsletters.ts +10 -1
- package/src/api/PlayTests.ts +29 -1
- package/src/routes/AgentsRoute.ts +7 -0
- package/src/routes/CampaignsRoute.ts +2 -0
- package/src/routes/NewslettersRoutes.ts +2 -1
- package/src/routes/PlayTestsRoute.ts +1 -0
package/dist/esm/api/Agents.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -36,6 +36,12 @@ declare class Newsletters {
|
|
|
36
36
|
* @param data { name, email, game }
|
|
37
37
|
*/
|
|
38
38
|
static joinNsfwWaitlist<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
39
|
+
/**
|
|
40
|
+
* Apply for Codex credit support for a playable AI game.
|
|
41
|
+
*
|
|
42
|
+
* @param data { name, email, game, game_description, game_url }
|
|
43
|
+
*/
|
|
44
|
+
static joinCodexCreditWaitlist<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
39
45
|
/**
|
|
40
46
|
* List all newsletter campaigns (Admin only).
|
|
41
47
|
*/
|
|
@@ -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 PlayTests {
|
|
4
4
|
/**
|
|
5
5
|
* Get a list of play tests associated with a title.
|
|
@@ -107,5 +107,19 @@ declare class PlayTests {
|
|
|
107
107
|
* @returns Promise
|
|
108
108
|
*/
|
|
109
109
|
static getResults<T>(title_id: string, playtest_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
110
|
+
/**
|
|
111
|
+
* Upload an audio/video answer file for a play test question. The file is
|
|
112
|
+
* stored by the Glitch backend (authenticated with the session token) and a
|
|
113
|
+
* media URL is returned that can then be passed to submitAnswers().
|
|
114
|
+
*
|
|
115
|
+
* @param title_id The ID of the title.
|
|
116
|
+
* @param playtest_id The ID of the play test.
|
|
117
|
+
* @param file The recorded audio/video file or blob.
|
|
118
|
+
* @param data Additional fields (question_id, media_type, title, description).
|
|
119
|
+
* @param params Optional query parameters.
|
|
120
|
+
* @param onUploadProgress Optional progress callback.
|
|
121
|
+
* @returns Promise
|
|
122
|
+
*/
|
|
123
|
+
static uploadAnswer<T>(title_id: string, playtest_id: string, file: File | Blob, data?: Record<string, any>, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
110
124
|
}
|
|
111
125
|
export default PlayTests;
|
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
|
*
|
|
@@ -15281,6 +15295,7 @@ var NewslettersRoutes = /** @class */ (function () {
|
|
|
15281
15295
|
joinRaffleWaitlist: { url: '/newsletters/joinRaffleWaitlist', method: HTTP_METHODS.POST },
|
|
15282
15296
|
joinDiscordMarketplaceWaitlist: { url: '/newsletters/joinDiscordMarketplaceWaitlist', method: HTTP_METHODS.POST },
|
|
15283
15297
|
joinNsfwWaitlist: { url: '/newsletters/joinNsfwWaitlist', method: HTTP_METHODS.POST },
|
|
15298
|
+
joinCodexCreditWaitlist: { url: '/newsletters/joinCodexCreditWaitlist', method: HTTP_METHODS.POST },
|
|
15284
15299
|
// --- Admin Campaign Management ---
|
|
15285
15300
|
listCampaigns: { url: '/admin/newsletters/campaigns', method: HTTP_METHODS.GET },
|
|
15286
15301
|
createCampaign: { url: '/admin/newsletters/campaigns', method: HTTP_METHODS.POST },
|
|
@@ -15352,6 +15367,14 @@ var Newsletters = /** @class */ (function () {
|
|
|
15352
15367
|
Newsletters.joinNsfwWaitlist = function (data, params) {
|
|
15353
15368
|
return Requests.processRoute(NewslettersRoutes.routes.joinNsfwWaitlist, data, undefined, params);
|
|
15354
15369
|
};
|
|
15370
|
+
/**
|
|
15371
|
+
* Apply for Codex credit support for a playable AI game.
|
|
15372
|
+
*
|
|
15373
|
+
* @param data { name, email, game, game_description, game_url }
|
|
15374
|
+
*/
|
|
15375
|
+
Newsletters.joinCodexCreditWaitlist = function (data, params) {
|
|
15376
|
+
return Requests.processRoute(NewslettersRoutes.routes.joinCodexCreditWaitlist, data, undefined, params);
|
|
15377
|
+
};
|
|
15355
15378
|
// --- ADMINISTRATIVE CAMPAIGN METHODS ---
|
|
15356
15379
|
/**
|
|
15357
15380
|
* List all newsletter campaigns (Admin only).
|
|
@@ -15477,6 +15500,7 @@ var PlayTestsRoute = /** @class */ (function () {
|
|
|
15477
15500
|
show: { url: '/playtests/{title_id}/view/{playtest_id}', method: HTTP_METHODS.GET },
|
|
15478
15501
|
mine: { url: '/playtests/mine', method: HTTP_METHODS.GET },
|
|
15479
15502
|
getResults: { url: '/playtests/{title_id}/{playtest_id}/results', method: HTTP_METHODS.GET },
|
|
15503
|
+
uploadAnswer: { url: '/playtests/{title_id}/{playtest_id}/upload-answer', method: HTTP_METHODS.POST },
|
|
15480
15504
|
};
|
|
15481
15505
|
return PlayTestsRoute;
|
|
15482
15506
|
}());
|
|
@@ -15616,6 +15640,25 @@ var PlayTests = /** @class */ (function () {
|
|
|
15616
15640
|
PlayTests.getResults = function (title_id, playtest_id, params) {
|
|
15617
15641
|
return Requests.processRoute(PlayTestsRoute.routes.getResults, {}, { title_id: title_id, playtest_id: playtest_id }, params);
|
|
15618
15642
|
};
|
|
15643
|
+
/**
|
|
15644
|
+
* Upload an audio/video answer file for a play test question. The file is
|
|
15645
|
+
* stored by the Glitch backend (authenticated with the session token) and a
|
|
15646
|
+
* media URL is returned that can then be passed to submitAnswers().
|
|
15647
|
+
*
|
|
15648
|
+
* @param title_id The ID of the title.
|
|
15649
|
+
* @param playtest_id The ID of the play test.
|
|
15650
|
+
* @param file The recorded audio/video file or blob.
|
|
15651
|
+
* @param data Additional fields (question_id, media_type, title, description).
|
|
15652
|
+
* @param params Optional query parameters.
|
|
15653
|
+
* @param onUploadProgress Optional progress callback.
|
|
15654
|
+
* @returns Promise
|
|
15655
|
+
*/
|
|
15656
|
+
PlayTests.uploadAnswer = function (title_id, playtest_id, file, data, params, onUploadProgress) {
|
|
15657
|
+
var url = PlayTestsRoute.routes.uploadAnswer.url
|
|
15658
|
+
.replace('{title_id}', title_id)
|
|
15659
|
+
.replace('{playtest_id}', playtest_id);
|
|
15660
|
+
return Requests.uploadFile(url, 'file', file, data, params, onUploadProgress);
|
|
15661
|
+
};
|
|
15619
15662
|
return PlayTests;
|
|
15620
15663
|
}());
|
|
15621
15664
|
|
|
@@ -19876,7 +19919,12 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
19876
19919
|
updateAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.PUT },
|
|
19877
19920
|
deleteAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.DELETE },
|
|
19878
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 },
|
|
19879
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 },
|
|
19880
19928
|
listRuns: { url: "/agents/titles/{title_id}/runs", method: HTTP_METHODS.GET },
|
|
19881
19929
|
viewRun: { url: "/agents/titles/{title_id}/runs/{run_id}", method: HTTP_METHODS.GET },
|
|
19882
19930
|
listRunEvents: { url: "/agents/titles/{title_id}/runs/{run_id}/events", method: HTTP_METHODS.GET },
|
|
@@ -19891,6 +19939,8 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
19891
19939
|
answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
|
|
19892
19940
|
rewriteAgentDraft: { url: "/agents/titles/{title_id}/drafts/rewrite", method: HTTP_METHODS.POST },
|
|
19893
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 },
|
|
19894
19944
|
results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
|
|
19895
19945
|
usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
|
|
19896
19946
|
credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
|
|
@@ -19907,6 +19957,22 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
19907
19957
|
var Agents = /** @class */ (function () {
|
|
19908
19958
|
function Agents() {
|
|
19909
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
|
+
};
|
|
19910
19976
|
/**
|
|
19911
19977
|
* List game titles that can be managed in the Agents section.
|
|
19912
19978
|
*/
|
|
@@ -19973,6 +20039,29 @@ var Agents = /** @class */ (function () {
|
|
|
19973
20039
|
Agents.runAgent = function (title_id, agent_id, data, params) {
|
|
19974
20040
|
return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id: title_id, agent_id: agent_id }, params);
|
|
19975
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
|
+
};
|
|
19976
20065
|
/**
|
|
19977
20066
|
* Upload one file for an agent run. data can include { agent_run_id }.
|
|
19978
20067
|
*/
|
|
@@ -19988,6 +20077,42 @@ var Agents = /** @class */ (function () {
|
|
|
19988
20077
|
Agents.uploadAgentFiles = function (title_id, agent_id, file, data, params, onUploadProgress) {
|
|
19989
20078
|
return Agents.uploadAgentFile(title_id, agent_id, file, data, params, onUploadProgress);
|
|
19990
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
|
+
};
|
|
19991
20116
|
/**
|
|
19992
20117
|
* List agent runs for a title.
|
|
19993
20118
|
*/
|
|
@@ -20067,12 +20192,54 @@ var Agents = /** @class */ (function () {
|
|
|
20067
20192
|
Agents.rewriteAgentDraft = function (title_id, data, params) {
|
|
20068
20193
|
return Requests.processRoute(AgentsRoute.routes.rewriteAgentDraft, data, { title_id: title_id }, params);
|
|
20069
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
|
+
};
|
|
20070
20225
|
/**
|
|
20071
20226
|
* List structured agent memories for a title.
|
|
20072
20227
|
*/
|
|
20073
20228
|
Agents.listMemories = function (title_id, params) {
|
|
20074
20229
|
return Requests.processRoute(AgentsRoute.routes.listMemories, {}, { title_id: title_id }, params);
|
|
20075
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
|
+
};
|
|
20076
20243
|
/**
|
|
20077
20244
|
* Get results and outcome summary for title agents. Returns 402 until subscription or prepaid credits are active.
|
|
20078
20245
|
*/
|