glitch-javascript-sdk 3.3.4 → 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 +138 -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/index.js +138 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +80 -0
- package/package.json +1 -1
- package/src/api/Agents.ts +170 -0
- package/src/api/Campaigns.ts +14 -0
- package/src/routes/AgentsRoute.ts +7 -0
- package/src/routes/CampaignsRoute.ts +2 -0
package/dist/cjs/index.js
CHANGED
|
@@ -25257,6 +25257,8 @@ var CampaignsRoute = /** @class */ (function () {
|
|
|
25257
25257
|
addType: { url: '/campaigns/{campaign_id}/addType', method: HTTP_METHODS.POST },
|
|
25258
25258
|
removeType: { url: '/campaigns/{campaign_id}/removeType/{type_id}', method: HTTP_METHODS.DELETE },
|
|
25259
25259
|
inviteInfluencer: { url: '/campaigns/{campaign_id}/influencers/invites', method: HTTP_METHODS.POST },
|
|
25260
|
+
influencerInviteProfileContext: { url: '/campaigns/{campaign_id}/influencers/invites/profile-context', method: HTTP_METHODS.GET },
|
|
25261
|
+
influencerInviteProfileSend: { url: '/campaigns/{campaign_id}/influencers/invites/profile-send', method: HTTP_METHODS.POST },
|
|
25260
25262
|
viewInfluencerInvite: { url: '/campaigns/{campaign_id}/influencers/invites/{influencer_id}', method: HTTP_METHODS.GET },
|
|
25261
25263
|
updateInfluencerInvite: { url: '/campaigns/{campaign_id}/influencers/invites/{influencer_id}', method: HTTP_METHODS.PUT },
|
|
25262
25264
|
updateInfluencerCompensationInvite: { url: '/campaigns/{campaign_id}/influencers/invites/{influencer_id}/compensation', method: HTTP_METHODS.PUT },
|
|
@@ -25811,6 +25813,18 @@ var Campaigns = /** @class */ (function () {
|
|
|
25811
25813
|
Campaigns.sendInfluencerInvite = function (campaign_id, data, params) {
|
|
25812
25814
|
return Requests.processRoute(CampaignsRoute.routes.sendInfluencerInvite, data, { campaign_id: campaign_id }, params);
|
|
25813
25815
|
};
|
|
25816
|
+
/**
|
|
25817
|
+
* Get creator context used when preparing a personalized invite.
|
|
25818
|
+
*/
|
|
25819
|
+
Campaigns.creatorInviteContext = function (campaign_id, params) {
|
|
25820
|
+
return Requests.processRoute(CampaignsRoute.routes.influencerInviteProfileContext, {}, { campaign_id: campaign_id }, params);
|
|
25821
|
+
};
|
|
25822
|
+
/**
|
|
25823
|
+
* Send a personalized creator invite after review.
|
|
25824
|
+
*/
|
|
25825
|
+
Campaigns.sendCreatorInvite = function (campaign_id, data, params) {
|
|
25826
|
+
return Requests.processRoute(CampaignsRoute.routes.influencerInviteProfileSend, data, { campaign_id: campaign_id }, params);
|
|
25827
|
+
};
|
|
25814
25828
|
/**
|
|
25815
25829
|
* Invites an influencer to join this campaign.
|
|
25816
25830
|
*
|
|
@@ -31903,7 +31917,12 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
31903
31917
|
updateAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.PUT },
|
|
31904
31918
|
deleteAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}", method: HTTP_METHODS.DELETE },
|
|
31905
31919
|
runAgent: { url: "/agents/titles/{title_id}/agents/{agent_id}/run", method: HTTP_METHODS.POST },
|
|
31920
|
+
streamAnswer: { url: "/agents/titles/{title_id}/agents/{agent_id}/stream-answer", method: HTTP_METHODS.POST },
|
|
31906
31921
|
uploadAgentFiles: { url: "/agents/titles/{title_id}/agents/{agent_id}/files", method: HTTP_METHODS.POST },
|
|
31922
|
+
listGoogleDriveFiles: { url: "/agents/titles/{title_id}/gmail/drive/files", method: HTTP_METHODS.GET },
|
|
31923
|
+
attachGoogleDriveFile: { url: "/agents/titles/{title_id}/agents/{agent_id}/drive/files", method: HTTP_METHODS.POST },
|
|
31924
|
+
downloadAgentFile: { url: "/agents/titles/{title_id}/files/{file_id}/download", method: HTTP_METHODS.GET },
|
|
31925
|
+
exportAgentFileToGoogleDrive: { url: "/agents/titles/{title_id}/files/{file_id}/export/google-drive", method: HTTP_METHODS.POST },
|
|
31907
31926
|
listRuns: { url: "/agents/titles/{title_id}/runs", method: HTTP_METHODS.GET },
|
|
31908
31927
|
viewRun: { url: "/agents/titles/{title_id}/runs/{run_id}", method: HTTP_METHODS.GET },
|
|
31909
31928
|
listRunEvents: { url: "/agents/titles/{title_id}/runs/{run_id}/events", method: HTTP_METHODS.GET },
|
|
@@ -31918,6 +31937,8 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
31918
31937
|
answerGuidance: { url: "/agents/titles/{title_id}/guidance/{guidance_id}/answer", method: HTTP_METHODS.POST },
|
|
31919
31938
|
rewriteAgentDraft: { url: "/agents/titles/{title_id}/drafts/rewrite", method: HTTP_METHODS.POST },
|
|
31920
31939
|
listMemories: { url: "/agents/titles/{title_id}/memories", method: HTTP_METHODS.GET },
|
|
31940
|
+
updateMemory: { url: "/agents/titles/{title_id}/memories/{memory_id}", method: HTTP_METHODS.PATCH },
|
|
31941
|
+
deactivateMemory: { url: "/agents/titles/{title_id}/memories/{memory_id}", method: HTTP_METHODS.DELETE },
|
|
31921
31942
|
results: { url: "/agents/titles/{title_id}/results", method: HTTP_METHODS.GET },
|
|
31922
31943
|
usage: { url: "/agents/titles/{title_id}/usage", method: HTTP_METHODS.GET },
|
|
31923
31944
|
credits: { url: "/agents/titles/{title_id}/credits", method: HTTP_METHODS.GET },
|
|
@@ -31934,6 +31955,22 @@ var AgentsRoute = /** @class */ (function () {
|
|
|
31934
31955
|
var Agents = /** @class */ (function () {
|
|
31935
31956
|
function Agents() {
|
|
31936
31957
|
}
|
|
31958
|
+
Agents.fetchWithAuth = function (path, init, options) {
|
|
31959
|
+
var _a;
|
|
31960
|
+
if (options === void 0) { options = {}; }
|
|
31961
|
+
var url = Requests.buildUrl(path, options.params);
|
|
31962
|
+
var token = (_a = Config.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(Config);
|
|
31963
|
+
var headers = __assign({}, (init.headers || {}));
|
|
31964
|
+
if (token && !headers.Authorization) {
|
|
31965
|
+
headers.Authorization = "Bearer ".concat(token);
|
|
31966
|
+
}
|
|
31967
|
+
Object.assign(headers, options.headers || {});
|
|
31968
|
+
var fetcher = options.fetcher || (typeof globalThis !== "undefined" ? globalThis.fetch : undefined);
|
|
31969
|
+
if (!fetcher) {
|
|
31970
|
+
return Promise.reject(new Error("Fetch API is not available in this environment."));
|
|
31971
|
+
}
|
|
31972
|
+
return fetcher(url, __assign(__assign({}, init), { headers: headers, signal: options.signal }));
|
|
31973
|
+
};
|
|
31937
31974
|
/**
|
|
31938
31975
|
* List game titles that can be managed in the Agents section.
|
|
31939
31976
|
*/
|
|
@@ -32000,6 +32037,29 @@ var Agents = /** @class */ (function () {
|
|
|
32000
32037
|
Agents.runAgent = function (title_id, agent_id, data, params) {
|
|
32001
32038
|
return Requests.processRoute(AgentsRoute.routes.runAgent, data, { title_id: title_id, agent_id: agent_id }, params);
|
|
32002
32039
|
};
|
|
32040
|
+
/**
|
|
32041
|
+
* Stream a quick advisory answer for the agent workspace.
|
|
32042
|
+
*
|
|
32043
|
+
* This returns the native Fetch API Response so callers can consume the
|
|
32044
|
+
* ReadableStream body incrementally. A 409 response means streaming is
|
|
32045
|
+
* disabled server-side and the caller should fall back to the normal run
|
|
32046
|
+
* flow.
|
|
32047
|
+
*/
|
|
32048
|
+
Agents.streamAnswer = function (title_id, agent_id, data, options) {
|
|
32049
|
+
if (options === void 0) { options = {}; }
|
|
32050
|
+
var body = typeof data === "string" ? { prompt: data } : data;
|
|
32051
|
+
var path = AgentsRoute.routes.streamAnswer.url
|
|
32052
|
+
.replace("{title_id}", title_id)
|
|
32053
|
+
.replace("{agent_id}", agent_id);
|
|
32054
|
+
return Agents.fetchWithAuth(path, {
|
|
32055
|
+
method: AgentsRoute.routes.streamAnswer.method,
|
|
32056
|
+
headers: {
|
|
32057
|
+
"Content-Type": "application/json",
|
|
32058
|
+
Accept: "text/event-stream",
|
|
32059
|
+
},
|
|
32060
|
+
body: JSON.stringify(body),
|
|
32061
|
+
}, options);
|
|
32062
|
+
};
|
|
32003
32063
|
/**
|
|
32004
32064
|
* Upload one file for an agent run. data can include { agent_run_id }.
|
|
32005
32065
|
*/
|
|
@@ -32015,6 +32075,42 @@ var Agents = /** @class */ (function () {
|
|
|
32015
32075
|
Agents.uploadAgentFiles = function (title_id, agent_id, file, data, params, onUploadProgress) {
|
|
32016
32076
|
return Agents.uploadAgentFile(title_id, agent_id, file, data, params, onUploadProgress);
|
|
32017
32077
|
};
|
|
32078
|
+
/**
|
|
32079
|
+
* List Google Drive files/folders available to attach to a title agent.
|
|
32080
|
+
*/
|
|
32081
|
+
Agents.listGoogleDriveFiles = function (title_id, params) {
|
|
32082
|
+
return Requests.processRoute(AgentsRoute.routes.listGoogleDriveFiles, {}, { title_id: title_id }, params);
|
|
32083
|
+
};
|
|
32084
|
+
/**
|
|
32085
|
+
* Attach a Google Drive file as a reference file for an agent.
|
|
32086
|
+
*/
|
|
32087
|
+
Agents.attachGoogleDriveFile = function (title_id, agent_id, data, params) {
|
|
32088
|
+
return Requests.processRoute(AgentsRoute.routes.attachGoogleDriveFile, data || {}, { title_id: title_id, agent_id: agent_id }, params);
|
|
32089
|
+
};
|
|
32090
|
+
/**
|
|
32091
|
+
* Download a protected agent file through the authenticated API route.
|
|
32092
|
+
*
|
|
32093
|
+
* Returns the native Fetch API Response so callers can inspect headers such
|
|
32094
|
+
* as Content-Disposition before creating a browser download or preview blob.
|
|
32095
|
+
*/
|
|
32096
|
+
Agents.downloadAgentFile = function (title_id, file_id, options) {
|
|
32097
|
+
if (options === void 0) { options = {}; }
|
|
32098
|
+
var path = AgentsRoute.routes.downloadAgentFile.url
|
|
32099
|
+
.replace("{title_id}", title_id)
|
|
32100
|
+
.replace("{file_id}", file_id);
|
|
32101
|
+
return Agents.fetchWithAuth(path, {
|
|
32102
|
+
method: AgentsRoute.routes.downloadAgentFile.method,
|
|
32103
|
+
headers: {
|
|
32104
|
+
Accept: "application/octet-stream",
|
|
32105
|
+
},
|
|
32106
|
+
}, options);
|
|
32107
|
+
};
|
|
32108
|
+
/**
|
|
32109
|
+
* Export a generated agent artifact to Google Drive.
|
|
32110
|
+
*/
|
|
32111
|
+
Agents.exportAgentFileToGoogleDrive = function (title_id, file_id, data, params) {
|
|
32112
|
+
return Requests.processRoute(AgentsRoute.routes.exportAgentFileToGoogleDrive, data || {}, { title_id: title_id, file_id: file_id }, params);
|
|
32113
|
+
};
|
|
32018
32114
|
/**
|
|
32019
32115
|
* List agent runs for a title.
|
|
32020
32116
|
*/
|
|
@@ -32094,12 +32190,54 @@ var Agents = /** @class */ (function () {
|
|
|
32094
32190
|
Agents.rewriteAgentDraft = function (title_id, data, params) {
|
|
32095
32191
|
return Requests.processRoute(AgentsRoute.routes.rewriteAgentDraft, data, { title_id: title_id }, params);
|
|
32096
32192
|
};
|
|
32193
|
+
/**
|
|
32194
|
+
* Agent workflow convenience wrapper for creator invite context.
|
|
32195
|
+
*/
|
|
32196
|
+
Agents.creatorInviteContext = function (campaign_id, params) {
|
|
32197
|
+
return Campaigns.creatorInviteContext(campaign_id, params);
|
|
32198
|
+
};
|
|
32199
|
+
/**
|
|
32200
|
+
* Agent workflow convenience wrapper for sending a reviewed creator invite.
|
|
32201
|
+
*/
|
|
32202
|
+
Agents.sendCreatorInvite = function (campaign_id, data, params) {
|
|
32203
|
+
return Campaigns.sendCreatorInvite(campaign_id, data || {}, params);
|
|
32204
|
+
};
|
|
32205
|
+
/**
|
|
32206
|
+
* Agent workflow convenience wrapper for updating a drafted social post.
|
|
32207
|
+
*/
|
|
32208
|
+
Agents.updateSocialPost = function (post_id, data, params) {
|
|
32209
|
+
return SocialPosts.update(post_id, data || {}, params);
|
|
32210
|
+
};
|
|
32211
|
+
/**
|
|
32212
|
+
* Agent workflow convenience wrapper for updating campaign settings.
|
|
32213
|
+
*/
|
|
32214
|
+
Agents.updateCampaign = function (campaign_id, data, params) {
|
|
32215
|
+
return Campaigns.update(campaign_id, data || {}, params);
|
|
32216
|
+
};
|
|
32217
|
+
/**
|
|
32218
|
+
* Agent workflow convenience wrapper for saving manual access keys.
|
|
32219
|
+
*/
|
|
32220
|
+
Agents.createAccessKeys = function (title_id, data, params) {
|
|
32221
|
+
return AccessKeys.store(title_id, data, params);
|
|
32222
|
+
};
|
|
32097
32223
|
/**
|
|
32098
32224
|
* List structured agent memories for a title.
|
|
32099
32225
|
*/
|
|
32100
32226
|
Agents.listMemories = function (title_id, params) {
|
|
32101
32227
|
return Requests.processRoute(AgentsRoute.routes.listMemories, {}, { title_id: title_id }, params);
|
|
32102
32228
|
};
|
|
32229
|
+
/**
|
|
32230
|
+
* Update one structured agent memory.
|
|
32231
|
+
*/
|
|
32232
|
+
Agents.updateMemory = function (title_id, memory_id, data, params) {
|
|
32233
|
+
return Requests.processRoute(AgentsRoute.routes.updateMemory, data || {}, { title_id: title_id, memory_id: memory_id }, params);
|
|
32234
|
+
};
|
|
32235
|
+
/**
|
|
32236
|
+
* Deactivate one structured agent memory.
|
|
32237
|
+
*/
|
|
32238
|
+
Agents.deactivateMemory = function (title_id, memory_id, params) {
|
|
32239
|
+
return Requests.processRoute(AgentsRoute.routes.deactivateMemory, {}, { title_id: title_id, memory_id: memory_id }, params);
|
|
32240
|
+
};
|
|
32103
32241
|
/**
|
|
32104
32242
|
* Get results and outcome summary for title agents. Returns 402 until subscription or prepaid credits are active.
|
|
32105
32243
|
*/
|