@squadbase/vite-server 0.1.3-dev.11 → 0.1.3-dev.12

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/cli/index.js CHANGED
@@ -7216,8 +7216,8 @@ var init_body = __esm({
7216
7216
  const ct = this.headers.get("content-type");
7217
7217
  if (ct.startsWith("application/x-www-form-urlencoded")) {
7218
7218
  const formData = new FormData2();
7219
- const parameters61 = new URLSearchParams(await this.text());
7220
- for (const [name, value] of parameters61) {
7219
+ const parameters62 = new URLSearchParams(await this.text());
7220
+ for (const [name, value] of parameters62) {
7221
7221
  formData.append(name, value);
7222
7222
  }
7223
7223
  return formData;
@@ -10165,11 +10165,11 @@ var require_bignumber = __commonJS({
10165
10165
  return n6 > 0 || n6 === i7 ? i7 : i7 - 1;
10166
10166
  }
10167
10167
  function coeffToString(a6) {
10168
- var s7, z78, i7 = 1, j6 = a6.length, r7 = a6[0] + "";
10168
+ var s7, z80, i7 = 1, j6 = a6.length, r7 = a6[0] + "";
10169
10169
  for (; i7 < j6; ) {
10170
10170
  s7 = a6[i7++] + "";
10171
- z78 = LOG_BASE - s7.length;
10172
- for (; z78--; s7 = "0" + s7) ;
10171
+ z80 = LOG_BASE - s7.length;
10172
+ for (; z80--; s7 = "0" + s7) ;
10173
10173
  r7 += s7;
10174
10174
  }
10175
10175
  for (j6 = r7.length; r7.charCodeAt(--j6) === 48; ) ;
@@ -10202,15 +10202,15 @@ var require_bignumber = __commonJS({
10202
10202
  function toExponential(str, e7) {
10203
10203
  return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e7 < 0 ? "e" : "e+") + e7;
10204
10204
  }
10205
- function toFixedPoint(str, e7, z78) {
10205
+ function toFixedPoint(str, e7, z80) {
10206
10206
  var len, zs;
10207
10207
  if (e7 < 0) {
10208
- for (zs = z78 + "."; ++e7; zs += z78) ;
10208
+ for (zs = z80 + "."; ++e7; zs += z80) ;
10209
10209
  str = zs + str;
10210
10210
  } else {
10211
10211
  len = str.length;
10212
10212
  if (++e7 > len) {
10213
- for (zs = z78, e7 -= len; --e7; zs += z78) ;
10213
+ for (zs = z80, e7 -= len; --e7; zs += z80) ;
10214
10214
  str += zs;
10215
10215
  } else if (e7 < len) {
10216
10216
  str = str.slice(0, e7) + "." + str.slice(e7);
@@ -37123,14 +37123,14 @@ var init_NormalizedSchema = __esm({
37123
37123
  throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
37124
37124
  }
37125
37125
  const struct = this.getSchema();
37126
- const z78 = struct[4].length;
37126
+ const z80 = struct[4].length;
37127
37127
  let it = struct[anno.it];
37128
- if (it && z78 === it.length) {
37128
+ if (it && z80 === it.length) {
37129
37129
  yield* it;
37130
37130
  return;
37131
37131
  }
37132
- it = Array(z78);
37133
- for (let i7 = 0; i7 < z78; ++i7) {
37132
+ it = Array(z80);
37133
+ for (let i7 = 0; i7 < z80; ++i7) {
37134
37134
  const k6 = struct[4][i7];
37135
37135
  const v7 = member([struct[5][i7], 0], k6);
37136
37136
  yield it[i7] = [k6, v7];
@@ -37806,12 +37806,12 @@ var init_split_header = __esm({
37806
37806
  "../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"() {
37807
37807
  "use strict";
37808
37808
  splitHeader = (value) => {
37809
- const z78 = value.length;
37809
+ const z80 = value.length;
37810
37810
  const values = [];
37811
37811
  let withinQuotes = false;
37812
37812
  let prevChar = void 0;
37813
37813
  let anchor = 0;
37814
- for (let i7 = 0; i7 < z78; ++i7) {
37814
+ for (let i7 = 0; i7 < z80; ++i7) {
37815
37815
  const char = value[i7];
37816
37816
  switch (char) {
37817
37817
  case `"`:
@@ -37832,12 +37832,12 @@ var init_split_header = __esm({
37832
37832
  values.push(value.slice(anchor));
37833
37833
  return values.map((v7) => {
37834
37834
  v7 = v7.trim();
37835
- const z79 = v7.length;
37836
- if (z79 < 2) {
37835
+ const z81 = v7.length;
37836
+ if (z81 < 2) {
37837
37837
  return v7;
37838
37838
  }
37839
- if (v7[0] === `"` && v7[z79 - 1] === `"`) {
37840
- v7 = v7.slice(1, z79 - 1);
37839
+ if (v7[0] === `"` && v7[z81 - 1] === `"`) {
37840
+ v7 = v7.slice(1, z81 - 1);
37841
37841
  }
37842
37842
  return v7.replace(/\\"/g, '"');
37843
37843
  });
@@ -39235,11 +39235,11 @@ var init_EndpointCache = __esm({
39235
39235
  }
39236
39236
  hash(endpointParams) {
39237
39237
  let buffer = "";
39238
- const { parameters: parameters61 } = this;
39239
- if (parameters61.length === 0) {
39238
+ const { parameters: parameters62 } = this;
39239
+ if (parameters62.length === 0) {
39240
39240
  return false;
39241
39241
  }
39242
- for (const param of parameters61) {
39242
+ for (const param of parameters62) {
39243
39243
  const val = String(endpointParams[param] ?? "");
39244
39244
  if (val.includes("|;")) {
39245
39245
  return false;
@@ -39956,15 +39956,15 @@ var init_resolveEndpoint = __esm({
39956
39956
  init_utils3();
39957
39957
  resolveEndpoint = (ruleSetObject, options) => {
39958
39958
  const { endpointParams, logger: logger2 } = options;
39959
- const { parameters: parameters61, rules } = ruleSetObject;
39959
+ const { parameters: parameters62, rules } = ruleSetObject;
39960
39960
  options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
39961
- const paramsWithDefault = Object.entries(parameters61).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
39961
+ const paramsWithDefault = Object.entries(parameters62).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
39962
39962
  if (paramsWithDefault.length > 0) {
39963
39963
  for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
39964
39964
  endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
39965
39965
  }
39966
39966
  }
39967
- const requiredParams = Object.entries(parameters61).filter(([, v7]) => v7.required).map(([k6]) => k6);
39967
+ const requiredParams = Object.entries(parameters62).filter(([, v7]) => v7.required).map(([k6]) => k6);
39968
39968
  for (const requiredParam of requiredParams) {
39969
39969
  if (endpointParams[requiredParam] == null) {
39970
39970
  throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
@@ -45574,8 +45574,8 @@ var init_ProtocolLib = __esm({
45574
45574
  constructor(queryCompat = false) {
45575
45575
  this.queryCompat = queryCompat;
45576
45576
  }
45577
- resolveRestContentType(defaultContentType, inputSchema75) {
45578
- const members = inputSchema75.getMemberSchemas();
45577
+ resolveRestContentType(defaultContentType, inputSchema77) {
45578
+ const members = inputSchema77.getMemberSchemas();
45579
45579
  const httpPayloadMember = Object.values(members).find((m7) => {
45580
45580
  return !!m7.getMergedTraits().httpPayload;
45581
45581
  });
@@ -45590,7 +45590,7 @@ var init_ProtocolLib = __esm({
45590
45590
  } else {
45591
45591
  return defaultContentType;
45592
45592
  }
45593
- } else if (!inputSchema75.isUnitSchema()) {
45593
+ } else if (!inputSchema77.isUnitSchema()) {
45594
45594
  const hasBody = Object.values(members).find((m7) => {
45595
45595
  const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m7.getMergedTraits();
45596
45596
  const noPrefixHeaders = httpPrefixHeaders === void 0;
@@ -46433,9 +46433,9 @@ var init_AwsRestJsonProtocol = __esm({
46433
46433
  }
46434
46434
  async serializeRequest(operationSchema, input, context) {
46435
46435
  const request2 = await super.serializeRequest(operationSchema, input, context);
46436
- const inputSchema75 = NormalizedSchema.of(operationSchema.input);
46436
+ const inputSchema77 = NormalizedSchema.of(operationSchema.input);
46437
46437
  if (!request2.headers["content-type"]) {
46438
- const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema75);
46438
+ const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema77);
46439
46439
  if (contentType) {
46440
46440
  request2.headers["content-type"] = contentType;
46441
46441
  }
@@ -46447,8 +46447,8 @@ var init_AwsRestJsonProtocol = __esm({
46447
46447
  }
46448
46448
  async deserializeResponse(operationSchema, context, response) {
46449
46449
  const output = await super.deserializeResponse(operationSchema, context, response);
46450
- const outputSchema75 = NormalizedSchema.of(operationSchema.output);
46451
- for (const [name, member2] of outputSchema75.structIterator()) {
46450
+ const outputSchema77 = NormalizedSchema.of(operationSchema.output);
46451
+ for (const [name, member2] of outputSchema77.structIterator()) {
46452
46452
  if (member2.getMemberTraits().httpPayload && !(name in output)) {
46453
46453
  output[name] = null;
46454
46454
  }
@@ -50312,22 +50312,22 @@ var init_loadCognitoIdentity = __esm({
50312
50312
  });
50313
50313
 
50314
50314
  // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
50315
- function fromCognitoIdentity(parameters61) {
50315
+ function fromCognitoIdentity(parameters62) {
50316
50316
  return async (awsIdentityProperties) => {
50317
- parameters61.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
50317
+ parameters62.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
50318
50318
  const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
50319
- const fromConfigs = (property) => parameters61.clientConfig?.[property] ?? parameters61.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
50320
- const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters61.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters61.logger), SessionToken } = throwOnMissingCredentials(parameters61.logger) } = await (parameters61.client ?? new CognitoIdentityClient2(Object.assign({}, parameters61.clientConfig ?? {}, {
50319
+ const fromConfigs = (property) => parameters62.clientConfig?.[property] ?? parameters62.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
50320
+ const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters62.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters62.logger), SessionToken } = throwOnMissingCredentials(parameters62.logger) } = await (parameters62.client ?? new CognitoIdentityClient2(Object.assign({}, parameters62.clientConfig ?? {}, {
50321
50321
  region: fromConfigs("region"),
50322
50322
  profile: fromConfigs("profile"),
50323
50323
  userAgentAppId: fromConfigs("userAgentAppId")
50324
50324
  }))).send(new GetCredentialsForIdentityCommand2({
50325
- CustomRoleArn: parameters61.customRoleArn,
50326
- IdentityId: parameters61.identityId,
50327
- Logins: parameters61.logins ? await resolveLogins(parameters61.logins) : void 0
50325
+ CustomRoleArn: parameters62.customRoleArn,
50326
+ IdentityId: parameters62.identityId,
50327
+ Logins: parameters62.logins ? await resolveLogins(parameters62.logins) : void 0
50328
50328
  }));
50329
50329
  return {
50330
- identityId: parameters61.identityId,
50330
+ identityId: parameters62.identityId,
50331
50331
  accessKeyId: AccessKeyId,
50332
50332
  secretAccessKey: SecretKey,
50333
50333
  sessionToken: SessionToken,
@@ -89225,7 +89225,9 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
89225
89225
  if (body) {
89226
89226
  headers["Content-Type"] = "application/x-www-form-urlencoded";
89227
89227
  requestBody = new URLSearchParams(
89228
- Object.entries(body).map(([k6, v7]) => [k6, String(v7)])
89228
+ Object.entries(body).map(
89229
+ ([k6, v7]) => [k6, String(v7)]
89230
+ )
89229
89231
  ).toString();
89230
89232
  }
89231
89233
  const response = await fetch(url, {
@@ -101284,6 +101286,441 @@ await backlog.request("/api/v2/issues", {
101284
101286
  tools: tools60
101285
101287
  });
101286
101288
 
101289
+ // ../connectors/src/connectors/gamma/setup.ts
101290
+ var gammaOnboarding = new ConnectorOnboarding({
101291
+ dataOverviewInstructions: {
101292
+ en: `1. Call gamma_request with GET /themes to list available themes in the workspace
101293
+ 2. Call gamma_request with GET /folders to list workspace folders
101294
+ 3. Try generating a simple presentation with gamma_generate: inputText "Sample presentation about AI", textMode "generate", numCards 3`,
101295
+ ja: `1. gamma_request \u3067 GET /themes \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3067\u5229\u7528\u53EF\u80FD\u306A\u30C6\u30FC\u30DE\u4E00\u89A7\u3092\u53D6\u5F97
101296
+ 2. gamma_request \u3067 GET /folders \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306E\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3092\u53D6\u5F97
101297
+ 3. gamma_generate \u3067\u30B7\u30F3\u30D7\u30EB\u306A\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3092\u8A66\u4F5C: inputText "AI\u306B\u3064\u3044\u3066\u306E\u30B5\u30F3\u30D7\u30EB\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3", textMode "generate", numCards 3`
101298
+ }
101299
+ });
101300
+
101301
+ // ../connectors/src/connectors/gamma/parameters.ts
101302
+ var parameters61 = {
101303
+ apiKey: new ParameterDefinition({
101304
+ slug: "api-key",
101305
+ name: "Gamma API Key",
101306
+ description: "The Gamma API key for authentication. Generate from Account Settings > API Keys. Requires Pro, Ultra, Teams, or Business plan.",
101307
+ envVarBaseKey: "GAMMA_API_KEY",
101308
+ type: "text",
101309
+ secret: true,
101310
+ required: true
101311
+ })
101312
+ };
101313
+
101314
+ // ../connectors/src/connectors/gamma/tools/request.ts
101315
+ import { z as z77 } from "zod";
101316
+ var BASE_URL40 = "https://public-api.gamma.app/v1.0";
101317
+ var REQUEST_TIMEOUT_MS60 = 6e4;
101318
+ var inputSchema75 = z77.object({
101319
+ toolUseIntent: z77.string().optional().describe(
101320
+ "Brief description of what you intend to accomplish with this tool call"
101321
+ ),
101322
+ connectionId: z77.string().describe("ID of the Gamma connection to use"),
101323
+ method: z77.enum(["GET", "POST"]).describe("HTTP method. GET for listing resources, POST for creating."),
101324
+ path: z77.string().describe(
101325
+ "API path (e.g., '/themes', '/folders', '/generations', '/generations/{generationId}')"
101326
+ ),
101327
+ body: z77.record(z77.string(), z77.unknown()).optional().describe("Request body (JSON) for POST requests")
101328
+ });
101329
+ var outputSchema75 = z77.discriminatedUnion("success", [
101330
+ z77.object({
101331
+ success: z77.literal(true),
101332
+ status: z77.number(),
101333
+ data: z77.unknown()
101334
+ }),
101335
+ z77.object({
101336
+ success: z77.literal(false),
101337
+ error: z77.string()
101338
+ })
101339
+ ]);
101340
+ var requestTool46 = new ConnectorTool({
101341
+ name: "request",
101342
+ description: `Send authenticated requests to the Gamma REST API.
101343
+ Authentication is handled automatically using the API Key (X-API-KEY header).
101344
+ Use this tool for listing themes, listing folders, checking generation status, and other read operations.
101345
+ For creating presentations/documents, prefer the gamma_generate tool instead.`,
101346
+ inputSchema: inputSchema75,
101347
+ outputSchema: outputSchema75,
101348
+ async execute({ connectionId, method, path: path5, body }, connections) {
101349
+ const connection = connections.find((c6) => c6.id === connectionId);
101350
+ if (!connection) {
101351
+ return {
101352
+ success: false,
101353
+ error: `Connection ${connectionId} not found`
101354
+ };
101355
+ }
101356
+ console.log(
101357
+ `[connector-request] gamma/${connection.name}: ${method} ${path5}`
101358
+ );
101359
+ try {
101360
+ const apiKey = parameters61.apiKey.getValue(connection);
101361
+ const url = `${BASE_URL40}${path5}`;
101362
+ const controller = new AbortController();
101363
+ const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS60);
101364
+ try {
101365
+ const response = await fetch(url, {
101366
+ method,
101367
+ headers: {
101368
+ "X-API-KEY": apiKey,
101369
+ "Content-Type": "application/json"
101370
+ },
101371
+ body: body ? JSON.stringify(body) : void 0,
101372
+ signal: controller.signal
101373
+ });
101374
+ const data = await response.json();
101375
+ if (!response.ok) {
101376
+ const err = data;
101377
+ const errorMessage = typeof err?.message === "string" ? err.message : typeof err?.error === "string" ? err.error : `HTTP ${response.status} ${response.statusText}`;
101378
+ return { success: false, error: errorMessage };
101379
+ }
101380
+ return { success: true, status: response.status, data };
101381
+ } finally {
101382
+ clearTimeout(timeout);
101383
+ }
101384
+ } catch (err) {
101385
+ const msg = err instanceof Error ? err.message : String(err);
101386
+ return { success: false, error: msg };
101387
+ }
101388
+ }
101389
+ });
101390
+
101391
+ // ../connectors/src/connectors/gamma/tools/generate.ts
101392
+ import { z as z78 } from "zod";
101393
+ var BASE_URL41 = "https://public-api.gamma.app/v1.0";
101394
+ var POLL_INTERVAL_MS3 = 5e3;
101395
+ var MAX_POLL_DURATION_MS = 3e5;
101396
+ var inputSchema76 = z78.object({
101397
+ toolUseIntent: z78.string().optional().describe(
101398
+ "Brief description of what you intend to accomplish with this tool call"
101399
+ ),
101400
+ connectionId: z78.string().describe("ID of the Gamma connection to use"),
101401
+ inputText: z78.string().describe(
101402
+ "Content for the generation. Can include text and image URLs. Max ~400,000 characters."
101403
+ ),
101404
+ textMode: z78.enum(["generate", "condense", "preserve"]).describe(
101405
+ "How inputText is modified: 'generate' creates new content from the topic, 'condense' shortens existing text, 'preserve' keeps text as-is."
101406
+ ),
101407
+ format: z78.enum(["presentation", "document", "webpage", "social"]).optional().describe("Type of artifact to create. Defaults to 'presentation'."),
101408
+ numCards: z78.number().int().min(1).max(75).optional().describe("Number of cards/slides. Defaults to 10."),
101409
+ themeId: z78.string().optional().describe(
101410
+ "Theme ID for look and feel. Use gamma_request GET /themes to list available themes."
101411
+ ),
101412
+ tone: z78.string().optional().describe(
101413
+ "Tone/voice of the output (e.g., 'professional', 'casual', 'academic'). Max 500 chars."
101414
+ ),
101415
+ audience: z78.string().optional().describe(
101416
+ "Target audience description (e.g., 'marketing executives'). Max 500 chars."
101417
+ ),
101418
+ language: z78.string().optional().describe("Output language code (e.g., 'en', 'ja'). Defaults to 'en'."),
101419
+ textAmount: z78.enum(["brief", "medium", "detailed", "extensive"]).optional().describe("Text volume per card. Defaults to 'medium'."),
101420
+ imageSource: z78.enum([
101421
+ "aiGenerated",
101422
+ "pictographic",
101423
+ "pexels",
101424
+ "giphy",
101425
+ "webAllImages",
101426
+ "webFreeToUse",
101427
+ "webFreeToUseCommercially",
101428
+ "themeAccent",
101429
+ "placeholder",
101430
+ "noImages"
101431
+ ]).optional().describe("Image source. Defaults to 'aiGenerated'."),
101432
+ additionalInstructions: z78.string().optional().describe(
101433
+ "Additional specifications for content, layout, and aesthetics. Max 5000 chars."
101434
+ ),
101435
+ exportAs: z78.enum(["pdf", "pptx", "png"]).optional().describe("Export file format. If omitted, no export file is generated.")
101436
+ });
101437
+ var outputSchema76 = z78.discriminatedUnion("success", [
101438
+ z78.object({
101439
+ success: z78.literal(true),
101440
+ generationId: z78.string(),
101441
+ gammaId: z78.string(),
101442
+ gammaUrl: z78.string(),
101443
+ exportUrl: z78.string().optional(),
101444
+ credits: z78.object({
101445
+ deducted: z78.number(),
101446
+ remaining: z78.number()
101447
+ }).optional()
101448
+ }),
101449
+ z78.object({
101450
+ success: z78.literal(false),
101451
+ error: z78.string()
101452
+ })
101453
+ ]);
101454
+ var generateTool = new ConnectorTool({
101455
+ name: "generate",
101456
+ description: `Generate a presentation, document, webpage, or social post using Gamma AI.
101457
+ This tool creates the generation, then automatically polls until completion and returns the result URL.
101458
+ Use gamma_request GET /themes first if you want to pick a specific theme.`,
101459
+ inputSchema: inputSchema76,
101460
+ outputSchema: outputSchema76,
101461
+ async execute({
101462
+ connectionId,
101463
+ inputText,
101464
+ textMode,
101465
+ format: format2,
101466
+ numCards,
101467
+ themeId,
101468
+ tone,
101469
+ audience,
101470
+ language,
101471
+ textAmount,
101472
+ imageSource,
101473
+ additionalInstructions,
101474
+ exportAs
101475
+ }, connections) {
101476
+ const connection = connections.find((c6) => c6.id === connectionId);
101477
+ if (!connection) {
101478
+ return {
101479
+ success: false,
101480
+ error: `Connection ${connectionId} not found`
101481
+ };
101482
+ }
101483
+ console.log(
101484
+ `[connector-generate] gamma/${connection.name}: creating ${format2 ?? "presentation"}`
101485
+ );
101486
+ try {
101487
+ const apiKey = parameters61.apiKey.getValue(connection);
101488
+ const headers = {
101489
+ "X-API-KEY": apiKey,
101490
+ "Content-Type": "application/json"
101491
+ };
101492
+ const body = {
101493
+ inputText,
101494
+ textMode
101495
+ };
101496
+ if (format2) body.format = format2;
101497
+ if (numCards) body.numCards = numCards;
101498
+ if (themeId) body.themeId = themeId;
101499
+ if (additionalInstructions)
101500
+ body.additionalInstructions = additionalInstructions;
101501
+ if (exportAs) body.exportAs = exportAs;
101502
+ const textOptions = {};
101503
+ if (tone) textOptions.tone = tone;
101504
+ if (audience) textOptions.audience = audience;
101505
+ if (language) textOptions.language = language;
101506
+ if (textAmount) textOptions.amount = textAmount;
101507
+ if (Object.keys(textOptions).length > 0) body.textOptions = textOptions;
101508
+ if (imageSource) body.imageOptions = { source: imageSource };
101509
+ const createRes = await fetch(`${BASE_URL41}/generations`, {
101510
+ method: "POST",
101511
+ headers,
101512
+ body: JSON.stringify(body)
101513
+ });
101514
+ const createData = await createRes.json();
101515
+ if (!createRes.ok) {
101516
+ const errorMessage = typeof createData?.message === "string" ? createData.message : typeof createData?.error === "string" ? createData.error : `HTTP ${createRes.status} ${createRes.statusText}`;
101517
+ return { success: false, error: errorMessage };
101518
+ }
101519
+ const generationId = createData.generationId;
101520
+ if (!generationId) {
101521
+ return {
101522
+ success: false,
101523
+ error: "No generationId returned from API"
101524
+ };
101525
+ }
101526
+ const deadline = Date.now() + MAX_POLL_DURATION_MS;
101527
+ while (Date.now() < deadline) {
101528
+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS3));
101529
+ const pollRes = await fetch(`${BASE_URL41}/generations/${generationId}`, {
101530
+ method: "GET",
101531
+ headers
101532
+ });
101533
+ const pollData = await pollRes.json();
101534
+ if (!pollRes.ok) {
101535
+ const errorMessage = typeof pollData?.message === "string" ? pollData.message : `Polling failed: HTTP ${pollRes.status}`;
101536
+ return { success: false, error: errorMessage };
101537
+ }
101538
+ const status = pollData.status;
101539
+ if (status === "completed") {
101540
+ return {
101541
+ success: true,
101542
+ generationId,
101543
+ gammaId: pollData.gammaId,
101544
+ gammaUrl: pollData.gammaUrl,
101545
+ exportUrl: pollData.exportUrl || void 0,
101546
+ credits: pollData.credits
101547
+ };
101548
+ }
101549
+ if (status === "failed") {
101550
+ const error2 = pollData.error;
101551
+ const errorMessage = typeof error2?.message === "string" ? error2.message : "Generation failed";
101552
+ return { success: false, error: errorMessage };
101553
+ }
101554
+ }
101555
+ return {
101556
+ success: false,
101557
+ error: `Generation timed out after ${MAX_POLL_DURATION_MS / 1e3}s. generationId: ${generationId} \u2014 you can check status with GET /generations/${generationId}`
101558
+ };
101559
+ } catch (err) {
101560
+ const msg = err instanceof Error ? err.message : String(err);
101561
+ return { success: false, error: msg };
101562
+ }
101563
+ }
101564
+ });
101565
+
101566
+ // ../connectors/src/connectors/gamma/index.ts
101567
+ var tools61 = { request: requestTool46, generate: generateTool };
101568
+ var gammaConnector = new ConnectorPlugin({
101569
+ slug: "gamma",
101570
+ authType: AUTH_TYPES.API_KEY,
101571
+ name: "Gamma",
101572
+ description: "Connect to Gamma for AI-powered presentation, document, webpage, and social post generation.",
101573
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/KoMGPpPcgtB9oDYe1OBjS/1ba7eb061c4497106bf6d249866dc471/gamma.svg",
101574
+ parameters: parameters61,
101575
+ releaseFlag: { dev1: true, dev2: false, prod: false },
101576
+ onboarding: gammaOnboarding,
101577
+ systemPrompt: {
101578
+ en: `### Tools
101579
+
101580
+ - \`gamma_request\`: Send authenticated requests to the Gamma REST API. Use for listing themes, folders, and checking generation status. Authentication (X-API-KEY) is configured automatically.
101581
+ - \`gamma_generate\`: Generate a presentation, document, webpage, or social post using Gamma AI. This tool handles the full workflow: creates the generation, polls for completion, and returns the result URL. Prefer this over manually calling POST /generations + polling.
101582
+
101583
+ ### Business Logic
101584
+
101585
+ The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
101586
+
101587
+ SDK methods (client created via \`connection(connectionId)\`):
101588
+ - \`client.request(path, init?)\` \u2014 low-level authenticated fetch
101589
+ - \`client.listThemes(options?)\` \u2014 list available themes (query, limit, after)
101590
+ - \`client.listFolders(options?)\` \u2014 list workspace folders (query, limit, after)
101591
+ - \`client.createGeneration(options)\` \u2014 create a generation, returns generationId
101592
+ - \`client.getGeneration(generationId)\` \u2014 get generation status and result
101593
+ - \`client.generateAndWait(options)\` \u2014 create generation and poll until completion
101594
+
101595
+ \`\`\`ts
101596
+ import type { Context } from "hono";
101597
+ import { connection } from "@squadbase/vite-server/connectors/gamma";
101598
+
101599
+ const gamma = connection("<connectionId>");
101600
+
101601
+ export default async function handler(c: Context) {
101602
+ const { topic, numCards = 5 } = await c.req.json<{
101603
+ topic: string;
101604
+ numCards?: number;
101605
+ }>();
101606
+
101607
+ const result = await gamma.generateAndWait({
101608
+ inputText: topic,
101609
+ textMode: "generate",
101610
+ format: "presentation",
101611
+ numCards,
101612
+ });
101613
+
101614
+ return c.json(result);
101615
+ }
101616
+ \`\`\`
101617
+
101618
+ ### Gamma REST API Reference
101619
+
101620
+ - Base URL: \`https://public-api.gamma.app/v1.0\`
101621
+ - Authentication: X-API-KEY header (handled automatically)
101622
+
101623
+ #### Endpoints
101624
+
101625
+ - POST \`/generations\` \u2014 Create a generation (presentation, document, webpage, social)
101626
+ - Required: \`inputText\` (string), \`textMode\` ("generate" | "condense" | "preserve")
101627
+ - Optional: \`format\`, \`numCards\`, \`themeId\`, \`textOptions\` (tone, audience, language, amount), \`imageOptions\` (source, model, style), \`additionalInstructions\`, \`exportAs\` (pdf, pptx, png), \`folderIds\`, \`sharingOptions\`
101628
+ - Returns: \`{ generationId }\`
101629
+ - GET \`/generations/{generationId}\` \u2014 Poll generation status
101630
+ - Returns: \`{ generationId, status, gammaId?, gammaUrl?, exportUrl?, credits?, error? }\`
101631
+ - Status values: "pending", "completed", "failed"
101632
+ - Poll every 5 seconds until status changes from "pending"
101633
+ - GET \`/themes\` \u2014 List available themes (query, limit, after for pagination)
101634
+ - GET \`/folders\` \u2014 List workspace folders (query, limit, after for pagination)
101635
+
101636
+ #### Generation Formats
101637
+ - \`presentation\` \u2014 Slide deck (dimensions: fluid, 16x9, 4x3)
101638
+ - \`document\` \u2014 Document (dimensions: fluid, pageless, letter, a4)
101639
+ - \`webpage\` \u2014 Web page
101640
+ - \`social\` \u2014 Social media post (dimensions: 1x1, 4x5, 9x16)
101641
+
101642
+ #### Text Modes
101643
+ - \`generate\` \u2014 AI generates new content from the input topic
101644
+ - \`condense\` \u2014 AI shortens the provided text
101645
+ - \`preserve\` \u2014 Input text is used as-is
101646
+
101647
+ #### Image Sources
101648
+ - \`aiGenerated\`, \`pictographic\`, \`pexels\`, \`giphy\`, \`webFreeToUseCommercially\`, \`noImages\`, etc.`,
101649
+ ja: `### \u30C4\u30FC\u30EB
101650
+
101651
+ - \`gamma_request\`: Gamma REST API\u306B\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30C6\u30FC\u30DE\u4E00\u89A7\u3001\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3001\u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u78BA\u8A8D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08X-API-KEY\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
101652
+ - \`gamma_generate\`: Gamma AI\u3092\u4F7F\u3063\u3066\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3001\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u3001\u30BD\u30FC\u30B7\u30E3\u30EB\u6295\u7A3F\u3092\u751F\u6210\u3057\u307E\u3059\u3002\u751F\u6210\u306E\u4F5C\u6210\u304B\u3089\u30DD\u30FC\u30EA\u30F3\u30B0\u3001\u7D50\u679CURL\u306E\u8FD4\u5374\u307E\u3067\u4E00\u62EC\u3067\u51E6\u7406\u3057\u307E\u3059\u3002\u624B\u52D5\u3067POST /generations + \u30DD\u30FC\u30EA\u30F3\u30B0\u3059\u308B\u3088\u308A\u3082\u3053\u3061\u3089\u3092\u63A8\u5968\u3057\u307E\u3059\u3002
101653
+
101654
+ ### Business Logic
101655
+
101656
+ \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
101657
+
101658
+ SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
101659
+ - \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
101660
+ - \`client.listThemes(options?)\` \u2014 \u30C6\u30FC\u30DE\u4E00\u89A7\u306E\u53D6\u5F97\uFF08query, limit, after\uFF09
101661
+ - \`client.listFolders(options?)\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u306E\u53D6\u5F97\uFF08query, limit, after\uFF09
101662
+ - \`client.createGeneration(options)\` \u2014 \u751F\u6210\u306E\u4F5C\u6210\u3001generationId\u3092\u8FD4\u3059
101663
+ - \`client.getGeneration(generationId)\` \u2014 \u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u3068\u7D50\u679C\u306E\u53D6\u5F97
101664
+ - \`client.generateAndWait(options)\` \u2014 \u751F\u6210\u3092\u4F5C\u6210\u3057\u5B8C\u4E86\u307E\u3067\u30DD\u30FC\u30EA\u30F3\u30B0
101665
+
101666
+ \`\`\`ts
101667
+ import type { Context } from "hono";
101668
+ import { connection } from "@squadbase/vite-server/connectors/gamma";
101669
+
101670
+ const gamma = connection("<connectionId>");
101671
+
101672
+ export default async function handler(c: Context) {
101673
+ const { topic, numCards = 5 } = await c.req.json<{
101674
+ topic: string;
101675
+ numCards?: number;
101676
+ }>();
101677
+
101678
+ const result = await gamma.generateAndWait({
101679
+ inputText: topic,
101680
+ textMode: "generate",
101681
+ format: "presentation",
101682
+ numCards,
101683
+ });
101684
+
101685
+ return c.json(result);
101686
+ }
101687
+ \`\`\`
101688
+
101689
+ ### Gamma REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
101690
+
101691
+ - \u30D9\u30FC\u30B9URL: \`https://public-api.gamma.app/v1.0\`
101692
+ - \u8A8D\u8A3C: X-API-KEY\u30D8\u30C3\u30C0\u30FC\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
101693
+
101694
+ #### \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
101695
+
101696
+ - POST \`/generations\` \u2014 \u751F\u6210\u306E\u4F5C\u6210\uFF08\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3001\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u3001\u30BD\u30FC\u30B7\u30E3\u30EB\uFF09
101697
+ - \u5FC5\u9808: \`inputText\`\uFF08\u6587\u5B57\u5217\uFF09\u3001\`textMode\`\uFF08"generate" | "condense" | "preserve"\uFF09
101698
+ - \u30AA\u30D7\u30B7\u30E7\u30F3: \`format\`, \`numCards\`, \`themeId\`, \`textOptions\`\uFF08tone, audience, language, amount\uFF09, \`imageOptions\`\uFF08source, model, style\uFF09, \`additionalInstructions\`, \`exportAs\`\uFF08pdf, pptx, png\uFF09, \`folderIds\`, \`sharingOptions\`
101699
+ - \u8FD4\u5374: \`{ generationId }\`
101700
+ - GET \`/generations/{generationId}\` \u2014 \u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30DD\u30FC\u30EA\u30F3\u30B0
101701
+ - \u8FD4\u5374: \`{ generationId, status, gammaId?, gammaUrl?, exportUrl?, credits?, error? }\`
101702
+ - \u30B9\u30C6\u30FC\u30BF\u30B9\u5024: "pending", "completed", "failed"
101703
+ - status\u304C"pending"\u3067\u306A\u304F\u306A\u308B\u307E\u30675\u79D2\u3054\u3068\u306B\u30DD\u30FC\u30EA\u30F3\u30B0
101704
+ - GET \`/themes\` \u2014 \u30C6\u30FC\u30DE\u4E00\u89A7\uFF08query, limit, after\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\uFF09
101705
+ - GET \`/folders\` \u2014 \u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\uFF08query, limit, after\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\uFF09
101706
+
101707
+ #### \u751F\u6210\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8
101708
+ - \`presentation\` \u2014 \u30B9\u30E9\u30A4\u30C9\u30C7\u30C3\u30AD\uFF08\u5BF8\u6CD5: fluid, 16x9, 4x3\uFF09
101709
+ - \`document\` \u2014 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\uFF08\u5BF8\u6CD5: fluid, pageless, letter, a4\uFF09
101710
+ - \`webpage\` \u2014 \u30A6\u30A7\u30D6\u30DA\u30FC\u30B8
101711
+ - \`social\` \u2014 \u30BD\u30FC\u30B7\u30E3\u30EB\u30E1\u30C7\u30A3\u30A2\u6295\u7A3F\uFF08\u5BF8\u6CD5: 1x1, 4x5, 9x16\uFF09
101712
+
101713
+ #### \u30C6\u30AD\u30B9\u30C8\u30E2\u30FC\u30C9
101714
+ - \`generate\` \u2014 AI\u304C\u5165\u529B\u30C8\u30D4\u30C3\u30AF\u304B\u3089\u65B0\u3057\u3044\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u751F\u6210
101715
+ - \`condense\` \u2014 AI\u304C\u63D0\u4F9B\u3055\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u3092\u77ED\u7E2E
101716
+ - \`preserve\` \u2014 \u5165\u529B\u30C6\u30AD\u30B9\u30C8\u3092\u305D\u306E\u307E\u307E\u4F7F\u7528
101717
+
101718
+ #### \u753B\u50CF\u30BD\u30FC\u30B9
101719
+ - \`aiGenerated\`, \`pictographic\`, \`pexels\`, \`giphy\`, \`webFreeToUseCommercially\`, \`noImages\` \u306A\u3069`
101720
+ },
101721
+ tools: tools61
101722
+ });
101723
+
101287
101724
  // ../connectors/src/connectors/registry.ts
101288
101725
  var plugins = {
101289
101726
  snowflake: snowflakeConnector,
@@ -101345,7 +101782,8 @@ var plugins = {
101345
101782
  intercomOauth: intercomOauthConnector,
101346
101783
  mixpanel: mixpanelConnector,
101347
101784
  grafana: grafanaConnector,
101348
- backlog: backlogConnector
101785
+ backlog: backlogConnector,
101786
+ gamma: gammaConnector
101349
101787
  };
101350
101788
  var connectors = {
101351
101789
  ...plugins,
@@ -101562,62 +102000,62 @@ import { watch as fsWatch2 } from "fs";
101562
102000
  import path2 from "path";
101563
102001
 
101564
102002
  // src/types/server-logic.ts
101565
- import { z as z77 } from "zod";
101566
- var parameterMetaSchema = z77.object({
101567
- name: z77.string(),
101568
- type: z77.enum(["string", "number", "boolean"]),
101569
- description: z77.string(),
101570
- required: z77.boolean().optional(),
101571
- default: z77.union([z77.string(), z77.number(), z77.boolean()]).optional()
101572
- });
101573
- var serverLogicCacheConfigSchema = z77.object({
101574
- ttl: z77.number(),
101575
- staleWhileRevalidate: z77.boolean().optional()
101576
- });
101577
- var serverLogicSchemaObjectSchema = z77.lazy(
101578
- () => z77.object({
101579
- type: z77.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
101580
- format: z77.string().optional(),
101581
- description: z77.string().optional(),
101582
- nullable: z77.boolean().optional(),
101583
- enum: z77.array(z77.union([z77.string(), z77.number(), z77.boolean(), z77.null()])).optional(),
102003
+ import { z as z79 } from "zod";
102004
+ var parameterMetaSchema = z79.object({
102005
+ name: z79.string(),
102006
+ type: z79.enum(["string", "number", "boolean"]),
102007
+ description: z79.string(),
102008
+ required: z79.boolean().optional(),
102009
+ default: z79.union([z79.string(), z79.number(), z79.boolean()]).optional()
102010
+ });
102011
+ var serverLogicCacheConfigSchema = z79.object({
102012
+ ttl: z79.number(),
102013
+ staleWhileRevalidate: z79.boolean().optional()
102014
+ });
102015
+ var serverLogicSchemaObjectSchema = z79.lazy(
102016
+ () => z79.object({
102017
+ type: z79.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
102018
+ format: z79.string().optional(),
102019
+ description: z79.string().optional(),
102020
+ nullable: z79.boolean().optional(),
102021
+ enum: z79.array(z79.union([z79.string(), z79.number(), z79.boolean(), z79.null()])).optional(),
101584
102022
  items: serverLogicSchemaObjectSchema.optional(),
101585
- properties: z77.record(z77.string(), serverLogicSchemaObjectSchema).optional(),
101586
- required: z77.array(z77.string()).optional(),
101587
- additionalProperties: z77.union([z77.boolean(), serverLogicSchemaObjectSchema]).optional(),
101588
- minimum: z77.number().optional(),
101589
- maximum: z77.number().optional(),
101590
- minLength: z77.number().optional(),
101591
- maxLength: z77.number().optional(),
101592
- pattern: z77.string().optional()
102023
+ properties: z79.record(z79.string(), serverLogicSchemaObjectSchema).optional(),
102024
+ required: z79.array(z79.string()).optional(),
102025
+ additionalProperties: z79.union([z79.boolean(), serverLogicSchemaObjectSchema]).optional(),
102026
+ minimum: z79.number().optional(),
102027
+ maximum: z79.number().optional(),
102028
+ minLength: z79.number().optional(),
102029
+ maxLength: z79.number().optional(),
102030
+ pattern: z79.string().optional()
101593
102031
  })
101594
102032
  );
101595
- var serverLogicMediaTypeSchema = z77.object({
102033
+ var serverLogicMediaTypeSchema = z79.object({
101596
102034
  schema: serverLogicSchemaObjectSchema.optional(),
101597
- example: z77.unknown().optional()
102035
+ example: z79.unknown().optional()
101598
102036
  });
101599
- var serverLogicResponseSchema = z77.object({
101600
- description: z77.string().optional(),
101601
- content: z77.record(z77.string(), serverLogicMediaTypeSchema).optional()
102037
+ var serverLogicResponseSchema = z79.object({
102038
+ description: z79.string().optional(),
102039
+ content: z79.record(z79.string(), serverLogicMediaTypeSchema).optional()
101602
102040
  });
101603
102041
  var jsonBaseFields = {
101604
- description: z77.string(),
101605
- parameters: z77.array(parameterMetaSchema).optional(),
102042
+ description: z79.string(),
102043
+ parameters: z79.array(parameterMetaSchema).optional(),
101606
102044
  response: serverLogicResponseSchema.optional(),
101607
102045
  cache: serverLogicCacheConfigSchema.optional()
101608
102046
  };
101609
- var jsonSqlServerLogicSchema = z77.object({
102047
+ var jsonSqlServerLogicSchema = z79.object({
101610
102048
  ...jsonBaseFields,
101611
- type: z77.literal("sql").optional(),
101612
- query: z77.string(),
101613
- connectionId: z77.string()
102049
+ type: z79.literal("sql").optional(),
102050
+ query: z79.string(),
102051
+ connectionId: z79.string()
101614
102052
  });
101615
- var jsonTypeScriptServerLogicSchema = z77.object({
102053
+ var jsonTypeScriptServerLogicSchema = z79.object({
101616
102054
  ...jsonBaseFields,
101617
- type: z77.literal("typescript"),
101618
- handlerPath: z77.string()
102055
+ type: z79.literal("typescript"),
102056
+ handlerPath: z79.string()
101619
102057
  });
101620
- var anyJsonServerLogicSchema = z77.union([
102058
+ var anyJsonServerLogicSchema = z79.union([
101621
102059
  jsonTypeScriptServerLogicSchema,
101622
102060
  jsonSqlServerLogicSchema
101623
102061
  ]);