@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/main.js CHANGED
@@ -18892,14 +18892,14 @@ var init_NormalizedSchema = __esm({
18892
18892
  throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
18893
18893
  }
18894
18894
  const struct = this.getSchema();
18895
- const z78 = struct[4].length;
18895
+ const z80 = struct[4].length;
18896
18896
  let it = struct[anno.it];
18897
- if (it && z78 === it.length) {
18897
+ if (it && z80 === it.length) {
18898
18898
  yield* it;
18899
18899
  return;
18900
18900
  }
18901
- it = Array(z78);
18902
- for (let i6 = 0; i6 < z78; ++i6) {
18901
+ it = Array(z80);
18902
+ for (let i6 = 0; i6 < z80; ++i6) {
18903
18903
  const k6 = struct[4][i6];
18904
18904
  const v7 = member([struct[5][i6], 0], k6);
18905
18905
  yield it[i6] = [k6, v7];
@@ -19575,12 +19575,12 @@ var init_split_header = __esm({
19575
19575
  "../../node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"() {
19576
19576
  "use strict";
19577
19577
  splitHeader = (value) => {
19578
- const z78 = value.length;
19578
+ const z80 = value.length;
19579
19579
  const values = [];
19580
19580
  let withinQuotes = false;
19581
19581
  let prevChar = void 0;
19582
19582
  let anchor = 0;
19583
- for (let i6 = 0; i6 < z78; ++i6) {
19583
+ for (let i6 = 0; i6 < z80; ++i6) {
19584
19584
  const char = value[i6];
19585
19585
  switch (char) {
19586
19586
  case `"`:
@@ -19601,12 +19601,12 @@ var init_split_header = __esm({
19601
19601
  values.push(value.slice(anchor));
19602
19602
  return values.map((v7) => {
19603
19603
  v7 = v7.trim();
19604
- const z79 = v7.length;
19605
- if (z79 < 2) {
19604
+ const z81 = v7.length;
19605
+ if (z81 < 2) {
19606
19606
  return v7;
19607
19607
  }
19608
- if (v7[0] === `"` && v7[z79 - 1] === `"`) {
19609
- v7 = v7.slice(1, z79 - 1);
19608
+ if (v7[0] === `"` && v7[z81 - 1] === `"`) {
19609
+ v7 = v7.slice(1, z81 - 1);
19610
19610
  }
19611
19611
  return v7.replace(/\\"/g, '"');
19612
19612
  });
@@ -21004,11 +21004,11 @@ var init_EndpointCache = __esm({
21004
21004
  }
21005
21005
  hash(endpointParams) {
21006
21006
  let buffer = "";
21007
- const { parameters: parameters61 } = this;
21008
- if (parameters61.length === 0) {
21007
+ const { parameters: parameters62 } = this;
21008
+ if (parameters62.length === 0) {
21009
21009
  return false;
21010
21010
  }
21011
- for (const param of parameters61) {
21011
+ for (const param of parameters62) {
21012
21012
  const val = String(endpointParams[param] ?? "");
21013
21013
  if (val.includes("|;")) {
21014
21014
  return false;
@@ -21725,15 +21725,15 @@ var init_resolveEndpoint = __esm({
21725
21725
  init_utils3();
21726
21726
  resolveEndpoint = (ruleSetObject, options) => {
21727
21727
  const { endpointParams, logger: logger2 } = options;
21728
- const { parameters: parameters61, rules } = ruleSetObject;
21728
+ const { parameters: parameters62, rules } = ruleSetObject;
21729
21729
  options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
21730
- const paramsWithDefault = Object.entries(parameters61).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
21730
+ const paramsWithDefault = Object.entries(parameters62).filter(([, v7]) => v7.default != null).map(([k6, v7]) => [k6, v7.default]);
21731
21731
  if (paramsWithDefault.length > 0) {
21732
21732
  for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
21733
21733
  endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
21734
21734
  }
21735
21735
  }
21736
- const requiredParams = Object.entries(parameters61).filter(([, v7]) => v7.required).map(([k6]) => k6);
21736
+ const requiredParams = Object.entries(parameters62).filter(([, v7]) => v7.required).map(([k6]) => k6);
21737
21737
  for (const requiredParam of requiredParams) {
21738
21738
  if (endpointParams[requiredParam] == null) {
21739
21739
  throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
@@ -27343,8 +27343,8 @@ var init_ProtocolLib = __esm({
27343
27343
  constructor(queryCompat = false) {
27344
27344
  this.queryCompat = queryCompat;
27345
27345
  }
27346
- resolveRestContentType(defaultContentType, inputSchema75) {
27347
- const members = inputSchema75.getMemberSchemas();
27346
+ resolveRestContentType(defaultContentType, inputSchema77) {
27347
+ const members = inputSchema77.getMemberSchemas();
27348
27348
  const httpPayloadMember = Object.values(members).find((m6) => {
27349
27349
  return !!m6.getMergedTraits().httpPayload;
27350
27350
  });
@@ -27359,7 +27359,7 @@ var init_ProtocolLib = __esm({
27359
27359
  } else {
27360
27360
  return defaultContentType;
27361
27361
  }
27362
- } else if (!inputSchema75.isUnitSchema()) {
27362
+ } else if (!inputSchema77.isUnitSchema()) {
27363
27363
  const hasBody = Object.values(members).find((m6) => {
27364
27364
  const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m6.getMergedTraits();
27365
27365
  const noPrefixHeaders = httpPrefixHeaders === void 0;
@@ -28202,9 +28202,9 @@ var init_AwsRestJsonProtocol = __esm({
28202
28202
  }
28203
28203
  async serializeRequest(operationSchema, input, context) {
28204
28204
  const request2 = await super.serializeRequest(operationSchema, input, context);
28205
- const inputSchema75 = NormalizedSchema.of(operationSchema.input);
28205
+ const inputSchema77 = NormalizedSchema.of(operationSchema.input);
28206
28206
  if (!request2.headers["content-type"]) {
28207
- const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema75);
28207
+ const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema77);
28208
28208
  if (contentType) {
28209
28209
  request2.headers["content-type"] = contentType;
28210
28210
  }
@@ -28216,8 +28216,8 @@ var init_AwsRestJsonProtocol = __esm({
28216
28216
  }
28217
28217
  async deserializeResponse(operationSchema, context, response) {
28218
28218
  const output = await super.deserializeResponse(operationSchema, context, response);
28219
- const outputSchema75 = NormalizedSchema.of(operationSchema.output);
28220
- for (const [name, member2] of outputSchema75.structIterator()) {
28219
+ const outputSchema77 = NormalizedSchema.of(operationSchema.output);
28220
+ for (const [name, member2] of outputSchema77.structIterator()) {
28221
28221
  if (member2.getMemberTraits().httpPayload && !(name in output)) {
28222
28222
  output[name] = null;
28223
28223
  }
@@ -32081,22 +32081,22 @@ var init_loadCognitoIdentity = __esm({
32081
32081
  });
32082
32082
 
32083
32083
  // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
32084
- function fromCognitoIdentity(parameters61) {
32084
+ function fromCognitoIdentity(parameters62) {
32085
32085
  return async (awsIdentityProperties) => {
32086
- parameters61.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
32086
+ parameters62.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
32087
32087
  const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
32088
- const fromConfigs = (property) => parameters61.clientConfig?.[property] ?? parameters61.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
32089
- const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters61.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters61.logger), SessionToken } = throwOnMissingCredentials(parameters61.logger) } = await (parameters61.client ?? new CognitoIdentityClient2(Object.assign({}, parameters61.clientConfig ?? {}, {
32088
+ const fromConfigs = (property) => parameters62.clientConfig?.[property] ?? parameters62.parentClientConfig?.[property] ?? awsIdentityProperties?.callerClientConfig?.[property];
32089
+ const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters62.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters62.logger), SessionToken } = throwOnMissingCredentials(parameters62.logger) } = await (parameters62.client ?? new CognitoIdentityClient2(Object.assign({}, parameters62.clientConfig ?? {}, {
32090
32090
  region: fromConfigs("region"),
32091
32091
  profile: fromConfigs("profile"),
32092
32092
  userAgentAppId: fromConfigs("userAgentAppId")
32093
32093
  }))).send(new GetCredentialsForIdentityCommand2({
32094
- CustomRoleArn: parameters61.customRoleArn,
32095
- IdentityId: parameters61.identityId,
32096
- Logins: parameters61.logins ? await resolveLogins(parameters61.logins) : void 0
32094
+ CustomRoleArn: parameters62.customRoleArn,
32095
+ IdentityId: parameters62.identityId,
32096
+ Logins: parameters62.logins ? await resolveLogins(parameters62.logins) : void 0
32097
32097
  }));
32098
32098
  return {
32099
- identityId: parameters61.identityId,
32099
+ identityId: parameters62.identityId,
32100
32100
  accessKeyId: AccessKeyId,
32101
32101
  secretAccessKey: SecretKey,
32102
32102
  sessionToken: SessionToken,
@@ -44657,11 +44657,11 @@ var require_bignumber = __commonJS({
44657
44657
  return n6 > 0 || n6 === i6 ? i6 : i6 - 1;
44658
44658
  }
44659
44659
  function coeffToString(a6) {
44660
- var s6, z78, i6 = 1, j6 = a6.length, r6 = a6[0] + "";
44660
+ var s6, z80, i6 = 1, j6 = a6.length, r6 = a6[0] + "";
44661
44661
  for (; i6 < j6; ) {
44662
44662
  s6 = a6[i6++] + "";
44663
- z78 = LOG_BASE - s6.length;
44664
- for (; z78--; s6 = "0" + s6) ;
44663
+ z80 = LOG_BASE - s6.length;
44664
+ for (; z80--; s6 = "0" + s6) ;
44665
44665
  r6 += s6;
44666
44666
  }
44667
44667
  for (j6 = r6.length; r6.charCodeAt(--j6) === 48; ) ;
@@ -44694,15 +44694,15 @@ var require_bignumber = __commonJS({
44694
44694
  function toExponential(str, e6) {
44695
44695
  return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e6 < 0 ? "e" : "e+") + e6;
44696
44696
  }
44697
- function toFixedPoint(str, e6, z78) {
44697
+ function toFixedPoint(str, e6, z80) {
44698
44698
  var len, zs;
44699
44699
  if (e6 < 0) {
44700
- for (zs = z78 + "."; ++e6; zs += z78) ;
44700
+ for (zs = z80 + "."; ++e6; zs += z80) ;
44701
44701
  str = zs + str;
44702
44702
  } else {
44703
44703
  len = str.length;
44704
44704
  if (++e6 > len) {
44705
- for (zs = z78, e6 -= len; --e6; zs += z78) ;
44705
+ for (zs = z80, e6 -= len; --e6; zs += z80) ;
44706
44706
  str += zs;
44707
44707
  } else if (e6 < len) {
44708
44708
  str = str.slice(0, e6) + "." + str.slice(e6);
@@ -73565,7 +73565,9 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
73565
73565
  if (body) {
73566
73566
  headers["Content-Type"] = "application/x-www-form-urlencoded";
73567
73567
  requestBody = new URLSearchParams(
73568
- Object.entries(body).map(([k6, v7]) => [k6, String(v7)])
73568
+ Object.entries(body).map(
73569
+ ([k6, v7]) => [k6, String(v7)]
73570
+ )
73569
73571
  ).toString();
73570
73572
  }
73571
73573
  const response = await fetch(url, {
@@ -85624,6 +85626,441 @@ await backlog.request("/api/v2/issues", {
85624
85626
  tools: tools60
85625
85627
  });
85626
85628
 
85629
+ // ../connectors/src/connectors/gamma/setup.ts
85630
+ var gammaOnboarding = new ConnectorOnboarding({
85631
+ dataOverviewInstructions: {
85632
+ en: `1. Call gamma_request with GET /themes to list available themes in the workspace
85633
+ 2. Call gamma_request with GET /folders to list workspace folders
85634
+ 3. Try generating a simple presentation with gamma_generate: inputText "Sample presentation about AI", textMode "generate", numCards 3`,
85635
+ 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
85636
+ 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
85637
+ 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`
85638
+ }
85639
+ });
85640
+
85641
+ // ../connectors/src/connectors/gamma/parameters.ts
85642
+ var parameters61 = {
85643
+ apiKey: new ParameterDefinition({
85644
+ slug: "api-key",
85645
+ name: "Gamma API Key",
85646
+ description: "The Gamma API key for authentication. Generate from Account Settings > API Keys. Requires Pro, Ultra, Teams, or Business plan.",
85647
+ envVarBaseKey: "GAMMA_API_KEY",
85648
+ type: "text",
85649
+ secret: true,
85650
+ required: true
85651
+ })
85652
+ };
85653
+
85654
+ // ../connectors/src/connectors/gamma/tools/request.ts
85655
+ import { z as z77 } from "zod";
85656
+ var BASE_URL40 = "https://public-api.gamma.app/v1.0";
85657
+ var REQUEST_TIMEOUT_MS60 = 6e4;
85658
+ var inputSchema75 = z77.object({
85659
+ toolUseIntent: z77.string().optional().describe(
85660
+ "Brief description of what you intend to accomplish with this tool call"
85661
+ ),
85662
+ connectionId: z77.string().describe("ID of the Gamma connection to use"),
85663
+ method: z77.enum(["GET", "POST"]).describe("HTTP method. GET for listing resources, POST for creating."),
85664
+ path: z77.string().describe(
85665
+ "API path (e.g., '/themes', '/folders', '/generations', '/generations/{generationId}')"
85666
+ ),
85667
+ body: z77.record(z77.string(), z77.unknown()).optional().describe("Request body (JSON) for POST requests")
85668
+ });
85669
+ var outputSchema75 = z77.discriminatedUnion("success", [
85670
+ z77.object({
85671
+ success: z77.literal(true),
85672
+ status: z77.number(),
85673
+ data: z77.unknown()
85674
+ }),
85675
+ z77.object({
85676
+ success: z77.literal(false),
85677
+ error: z77.string()
85678
+ })
85679
+ ]);
85680
+ var requestTool46 = new ConnectorTool({
85681
+ name: "request",
85682
+ description: `Send authenticated requests to the Gamma REST API.
85683
+ Authentication is handled automatically using the API Key (X-API-KEY header).
85684
+ Use this tool for listing themes, listing folders, checking generation status, and other read operations.
85685
+ For creating presentations/documents, prefer the gamma_generate tool instead.`,
85686
+ inputSchema: inputSchema75,
85687
+ outputSchema: outputSchema75,
85688
+ async execute({ connectionId, method, path: path6, body }, connections) {
85689
+ const connection2 = connections.find((c6) => c6.id === connectionId);
85690
+ if (!connection2) {
85691
+ return {
85692
+ success: false,
85693
+ error: `Connection ${connectionId} not found`
85694
+ };
85695
+ }
85696
+ console.log(
85697
+ `[connector-request] gamma/${connection2.name}: ${method} ${path6}`
85698
+ );
85699
+ try {
85700
+ const apiKey = parameters61.apiKey.getValue(connection2);
85701
+ const url = `${BASE_URL40}${path6}`;
85702
+ const controller = new AbortController();
85703
+ const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS60);
85704
+ try {
85705
+ const response = await fetch(url, {
85706
+ method,
85707
+ headers: {
85708
+ "X-API-KEY": apiKey,
85709
+ "Content-Type": "application/json"
85710
+ },
85711
+ body: body ? JSON.stringify(body) : void 0,
85712
+ signal: controller.signal
85713
+ });
85714
+ const data = await response.json();
85715
+ if (!response.ok) {
85716
+ const err = data;
85717
+ const errorMessage = typeof err?.message === "string" ? err.message : typeof err?.error === "string" ? err.error : `HTTP ${response.status} ${response.statusText}`;
85718
+ return { success: false, error: errorMessage };
85719
+ }
85720
+ return { success: true, status: response.status, data };
85721
+ } finally {
85722
+ clearTimeout(timeout);
85723
+ }
85724
+ } catch (err) {
85725
+ const msg = err instanceof Error ? err.message : String(err);
85726
+ return { success: false, error: msg };
85727
+ }
85728
+ }
85729
+ });
85730
+
85731
+ // ../connectors/src/connectors/gamma/tools/generate.ts
85732
+ import { z as z78 } from "zod";
85733
+ var BASE_URL41 = "https://public-api.gamma.app/v1.0";
85734
+ var POLL_INTERVAL_MS3 = 5e3;
85735
+ var MAX_POLL_DURATION_MS = 3e5;
85736
+ var inputSchema76 = z78.object({
85737
+ toolUseIntent: z78.string().optional().describe(
85738
+ "Brief description of what you intend to accomplish with this tool call"
85739
+ ),
85740
+ connectionId: z78.string().describe("ID of the Gamma connection to use"),
85741
+ inputText: z78.string().describe(
85742
+ "Content for the generation. Can include text and image URLs. Max ~400,000 characters."
85743
+ ),
85744
+ textMode: z78.enum(["generate", "condense", "preserve"]).describe(
85745
+ "How inputText is modified: 'generate' creates new content from the topic, 'condense' shortens existing text, 'preserve' keeps text as-is."
85746
+ ),
85747
+ format: z78.enum(["presentation", "document", "webpage", "social"]).optional().describe("Type of artifact to create. Defaults to 'presentation'."),
85748
+ numCards: z78.number().int().min(1).max(75).optional().describe("Number of cards/slides. Defaults to 10."),
85749
+ themeId: z78.string().optional().describe(
85750
+ "Theme ID for look and feel. Use gamma_request GET /themes to list available themes."
85751
+ ),
85752
+ tone: z78.string().optional().describe(
85753
+ "Tone/voice of the output (e.g., 'professional', 'casual', 'academic'). Max 500 chars."
85754
+ ),
85755
+ audience: z78.string().optional().describe(
85756
+ "Target audience description (e.g., 'marketing executives'). Max 500 chars."
85757
+ ),
85758
+ language: z78.string().optional().describe("Output language code (e.g., 'en', 'ja'). Defaults to 'en'."),
85759
+ textAmount: z78.enum(["brief", "medium", "detailed", "extensive"]).optional().describe("Text volume per card. Defaults to 'medium'."),
85760
+ imageSource: z78.enum([
85761
+ "aiGenerated",
85762
+ "pictographic",
85763
+ "pexels",
85764
+ "giphy",
85765
+ "webAllImages",
85766
+ "webFreeToUse",
85767
+ "webFreeToUseCommercially",
85768
+ "themeAccent",
85769
+ "placeholder",
85770
+ "noImages"
85771
+ ]).optional().describe("Image source. Defaults to 'aiGenerated'."),
85772
+ additionalInstructions: z78.string().optional().describe(
85773
+ "Additional specifications for content, layout, and aesthetics. Max 5000 chars."
85774
+ ),
85775
+ exportAs: z78.enum(["pdf", "pptx", "png"]).optional().describe("Export file format. If omitted, no export file is generated.")
85776
+ });
85777
+ var outputSchema76 = z78.discriminatedUnion("success", [
85778
+ z78.object({
85779
+ success: z78.literal(true),
85780
+ generationId: z78.string(),
85781
+ gammaId: z78.string(),
85782
+ gammaUrl: z78.string(),
85783
+ exportUrl: z78.string().optional(),
85784
+ credits: z78.object({
85785
+ deducted: z78.number(),
85786
+ remaining: z78.number()
85787
+ }).optional()
85788
+ }),
85789
+ z78.object({
85790
+ success: z78.literal(false),
85791
+ error: z78.string()
85792
+ })
85793
+ ]);
85794
+ var generateTool = new ConnectorTool({
85795
+ name: "generate",
85796
+ description: `Generate a presentation, document, webpage, or social post using Gamma AI.
85797
+ This tool creates the generation, then automatically polls until completion and returns the result URL.
85798
+ Use gamma_request GET /themes first if you want to pick a specific theme.`,
85799
+ inputSchema: inputSchema76,
85800
+ outputSchema: outputSchema76,
85801
+ async execute({
85802
+ connectionId,
85803
+ inputText,
85804
+ textMode,
85805
+ format: format2,
85806
+ numCards,
85807
+ themeId,
85808
+ tone,
85809
+ audience,
85810
+ language,
85811
+ textAmount,
85812
+ imageSource,
85813
+ additionalInstructions,
85814
+ exportAs
85815
+ }, connections) {
85816
+ const connection2 = connections.find((c6) => c6.id === connectionId);
85817
+ if (!connection2) {
85818
+ return {
85819
+ success: false,
85820
+ error: `Connection ${connectionId} not found`
85821
+ };
85822
+ }
85823
+ console.log(
85824
+ `[connector-generate] gamma/${connection2.name}: creating ${format2 ?? "presentation"}`
85825
+ );
85826
+ try {
85827
+ const apiKey = parameters61.apiKey.getValue(connection2);
85828
+ const headers = {
85829
+ "X-API-KEY": apiKey,
85830
+ "Content-Type": "application/json"
85831
+ };
85832
+ const body = {
85833
+ inputText,
85834
+ textMode
85835
+ };
85836
+ if (format2) body.format = format2;
85837
+ if (numCards) body.numCards = numCards;
85838
+ if (themeId) body.themeId = themeId;
85839
+ if (additionalInstructions)
85840
+ body.additionalInstructions = additionalInstructions;
85841
+ if (exportAs) body.exportAs = exportAs;
85842
+ const textOptions = {};
85843
+ if (tone) textOptions.tone = tone;
85844
+ if (audience) textOptions.audience = audience;
85845
+ if (language) textOptions.language = language;
85846
+ if (textAmount) textOptions.amount = textAmount;
85847
+ if (Object.keys(textOptions).length > 0) body.textOptions = textOptions;
85848
+ if (imageSource) body.imageOptions = { source: imageSource };
85849
+ const createRes = await fetch(`${BASE_URL41}/generations`, {
85850
+ method: "POST",
85851
+ headers,
85852
+ body: JSON.stringify(body)
85853
+ });
85854
+ const createData = await createRes.json();
85855
+ if (!createRes.ok) {
85856
+ const errorMessage = typeof createData?.message === "string" ? createData.message : typeof createData?.error === "string" ? createData.error : `HTTP ${createRes.status} ${createRes.statusText}`;
85857
+ return { success: false, error: errorMessage };
85858
+ }
85859
+ const generationId = createData.generationId;
85860
+ if (!generationId) {
85861
+ return {
85862
+ success: false,
85863
+ error: "No generationId returned from API"
85864
+ };
85865
+ }
85866
+ const deadline = Date.now() + MAX_POLL_DURATION_MS;
85867
+ while (Date.now() < deadline) {
85868
+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS3));
85869
+ const pollRes = await fetch(`${BASE_URL41}/generations/${generationId}`, {
85870
+ method: "GET",
85871
+ headers
85872
+ });
85873
+ const pollData = await pollRes.json();
85874
+ if (!pollRes.ok) {
85875
+ const errorMessage = typeof pollData?.message === "string" ? pollData.message : `Polling failed: HTTP ${pollRes.status}`;
85876
+ return { success: false, error: errorMessage };
85877
+ }
85878
+ const status = pollData.status;
85879
+ if (status === "completed") {
85880
+ return {
85881
+ success: true,
85882
+ generationId,
85883
+ gammaId: pollData.gammaId,
85884
+ gammaUrl: pollData.gammaUrl,
85885
+ exportUrl: pollData.exportUrl || void 0,
85886
+ credits: pollData.credits
85887
+ };
85888
+ }
85889
+ if (status === "failed") {
85890
+ const error2 = pollData.error;
85891
+ const errorMessage = typeof error2?.message === "string" ? error2.message : "Generation failed";
85892
+ return { success: false, error: errorMessage };
85893
+ }
85894
+ }
85895
+ return {
85896
+ success: false,
85897
+ error: `Generation timed out after ${MAX_POLL_DURATION_MS / 1e3}s. generationId: ${generationId} \u2014 you can check status with GET /generations/${generationId}`
85898
+ };
85899
+ } catch (err) {
85900
+ const msg = err instanceof Error ? err.message : String(err);
85901
+ return { success: false, error: msg };
85902
+ }
85903
+ }
85904
+ });
85905
+
85906
+ // ../connectors/src/connectors/gamma/index.ts
85907
+ var tools61 = { request: requestTool46, generate: generateTool };
85908
+ var gammaConnector = new ConnectorPlugin({
85909
+ slug: "gamma",
85910
+ authType: AUTH_TYPES.API_KEY,
85911
+ name: "Gamma",
85912
+ description: "Connect to Gamma for AI-powered presentation, document, webpage, and social post generation.",
85913
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/KoMGPpPcgtB9oDYe1OBjS/1ba7eb061c4497106bf6d249866dc471/gamma.svg",
85914
+ parameters: parameters61,
85915
+ releaseFlag: { dev1: true, dev2: false, prod: false },
85916
+ onboarding: gammaOnboarding,
85917
+ systemPrompt: {
85918
+ en: `### Tools
85919
+
85920
+ - \`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.
85921
+ - \`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.
85922
+
85923
+ ### Business Logic
85924
+
85925
+ The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
85926
+
85927
+ SDK methods (client created via \`connection(connectionId)\`):
85928
+ - \`client.request(path, init?)\` \u2014 low-level authenticated fetch
85929
+ - \`client.listThemes(options?)\` \u2014 list available themes (query, limit, after)
85930
+ - \`client.listFolders(options?)\` \u2014 list workspace folders (query, limit, after)
85931
+ - \`client.createGeneration(options)\` \u2014 create a generation, returns generationId
85932
+ - \`client.getGeneration(generationId)\` \u2014 get generation status and result
85933
+ - \`client.generateAndWait(options)\` \u2014 create generation and poll until completion
85934
+
85935
+ \`\`\`ts
85936
+ import type { Context } from "hono";
85937
+ import { connection } from "@squadbase/vite-server/connectors/gamma";
85938
+
85939
+ const gamma = connection("<connectionId>");
85940
+
85941
+ export default async function handler(c: Context) {
85942
+ const { topic, numCards = 5 } = await c.req.json<{
85943
+ topic: string;
85944
+ numCards?: number;
85945
+ }>();
85946
+
85947
+ const result = await gamma.generateAndWait({
85948
+ inputText: topic,
85949
+ textMode: "generate",
85950
+ format: "presentation",
85951
+ numCards,
85952
+ });
85953
+
85954
+ return c.json(result);
85955
+ }
85956
+ \`\`\`
85957
+
85958
+ ### Gamma REST API Reference
85959
+
85960
+ - Base URL: \`https://public-api.gamma.app/v1.0\`
85961
+ - Authentication: X-API-KEY header (handled automatically)
85962
+
85963
+ #### Endpoints
85964
+
85965
+ - POST \`/generations\` \u2014 Create a generation (presentation, document, webpage, social)
85966
+ - Required: \`inputText\` (string), \`textMode\` ("generate" | "condense" | "preserve")
85967
+ - Optional: \`format\`, \`numCards\`, \`themeId\`, \`textOptions\` (tone, audience, language, amount), \`imageOptions\` (source, model, style), \`additionalInstructions\`, \`exportAs\` (pdf, pptx, png), \`folderIds\`, \`sharingOptions\`
85968
+ - Returns: \`{ generationId }\`
85969
+ - GET \`/generations/{generationId}\` \u2014 Poll generation status
85970
+ - Returns: \`{ generationId, status, gammaId?, gammaUrl?, exportUrl?, credits?, error? }\`
85971
+ - Status values: "pending", "completed", "failed"
85972
+ - Poll every 5 seconds until status changes from "pending"
85973
+ - GET \`/themes\` \u2014 List available themes (query, limit, after for pagination)
85974
+ - GET \`/folders\` \u2014 List workspace folders (query, limit, after for pagination)
85975
+
85976
+ #### Generation Formats
85977
+ - \`presentation\` \u2014 Slide deck (dimensions: fluid, 16x9, 4x3)
85978
+ - \`document\` \u2014 Document (dimensions: fluid, pageless, letter, a4)
85979
+ - \`webpage\` \u2014 Web page
85980
+ - \`social\` \u2014 Social media post (dimensions: 1x1, 4x5, 9x16)
85981
+
85982
+ #### Text Modes
85983
+ - \`generate\` \u2014 AI generates new content from the input topic
85984
+ - \`condense\` \u2014 AI shortens the provided text
85985
+ - \`preserve\` \u2014 Input text is used as-is
85986
+
85987
+ #### Image Sources
85988
+ - \`aiGenerated\`, \`pictographic\`, \`pexels\`, \`giphy\`, \`webFreeToUseCommercially\`, \`noImages\`, etc.`,
85989
+ ja: `### \u30C4\u30FC\u30EB
85990
+
85991
+ - \`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
85992
+ - \`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
85993
+
85994
+ ### Business Logic
85995
+
85996
+ \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
85997
+
85998
+ SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
85999
+ - \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
86000
+ - \`client.listThemes(options?)\` \u2014 \u30C6\u30FC\u30DE\u4E00\u89A7\u306E\u53D6\u5F97\uFF08query, limit, after\uFF09
86001
+ - \`client.listFolders(options?)\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u306E\u53D6\u5F97\uFF08query, limit, after\uFF09
86002
+ - \`client.createGeneration(options)\` \u2014 \u751F\u6210\u306E\u4F5C\u6210\u3001generationId\u3092\u8FD4\u3059
86003
+ - \`client.getGeneration(generationId)\` \u2014 \u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u3068\u7D50\u679C\u306E\u53D6\u5F97
86004
+ - \`client.generateAndWait(options)\` \u2014 \u751F\u6210\u3092\u4F5C\u6210\u3057\u5B8C\u4E86\u307E\u3067\u30DD\u30FC\u30EA\u30F3\u30B0
86005
+
86006
+ \`\`\`ts
86007
+ import type { Context } from "hono";
86008
+ import { connection } from "@squadbase/vite-server/connectors/gamma";
86009
+
86010
+ const gamma = connection("<connectionId>");
86011
+
86012
+ export default async function handler(c: Context) {
86013
+ const { topic, numCards = 5 } = await c.req.json<{
86014
+ topic: string;
86015
+ numCards?: number;
86016
+ }>();
86017
+
86018
+ const result = await gamma.generateAndWait({
86019
+ inputText: topic,
86020
+ textMode: "generate",
86021
+ format: "presentation",
86022
+ numCards,
86023
+ });
86024
+
86025
+ return c.json(result);
86026
+ }
86027
+ \`\`\`
86028
+
86029
+ ### Gamma REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
86030
+
86031
+ - \u30D9\u30FC\u30B9URL: \`https://public-api.gamma.app/v1.0\`
86032
+ - \u8A8D\u8A3C: X-API-KEY\u30D8\u30C3\u30C0\u30FC\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
86033
+
86034
+ #### \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
86035
+
86036
+ - 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
86037
+ - \u5FC5\u9808: \`inputText\`\uFF08\u6587\u5B57\u5217\uFF09\u3001\`textMode\`\uFF08"generate" | "condense" | "preserve"\uFF09
86038
+ - \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\`
86039
+ - \u8FD4\u5374: \`{ generationId }\`
86040
+ - GET \`/generations/{generationId}\` \u2014 \u751F\u6210\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30DD\u30FC\u30EA\u30F3\u30B0
86041
+ - \u8FD4\u5374: \`{ generationId, status, gammaId?, gammaUrl?, exportUrl?, credits?, error? }\`
86042
+ - \u30B9\u30C6\u30FC\u30BF\u30B9\u5024: "pending", "completed", "failed"
86043
+ - status\u304C"pending"\u3067\u306A\u304F\u306A\u308B\u307E\u30675\u79D2\u3054\u3068\u306B\u30DD\u30FC\u30EA\u30F3\u30B0
86044
+ - GET \`/themes\` \u2014 \u30C6\u30FC\u30DE\u4E00\u89A7\uFF08query, limit, after\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\uFF09
86045
+ - GET \`/folders\` \u2014 \u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\uFF08query, limit, after\u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\uFF09
86046
+
86047
+ #### \u751F\u6210\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8
86048
+ - \`presentation\` \u2014 \u30B9\u30E9\u30A4\u30C9\u30C7\u30C3\u30AD\uFF08\u5BF8\u6CD5: fluid, 16x9, 4x3\uFF09
86049
+ - \`document\` \u2014 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\uFF08\u5BF8\u6CD5: fluid, pageless, letter, a4\uFF09
86050
+ - \`webpage\` \u2014 \u30A6\u30A7\u30D6\u30DA\u30FC\u30B8
86051
+ - \`social\` \u2014 \u30BD\u30FC\u30B7\u30E3\u30EB\u30E1\u30C7\u30A3\u30A2\u6295\u7A3F\uFF08\u5BF8\u6CD5: 1x1, 4x5, 9x16\uFF09
86052
+
86053
+ #### \u30C6\u30AD\u30B9\u30C8\u30E2\u30FC\u30C9
86054
+ - \`generate\` \u2014 AI\u304C\u5165\u529B\u30C8\u30D4\u30C3\u30AF\u304B\u3089\u65B0\u3057\u3044\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u751F\u6210
86055
+ - \`condense\` \u2014 AI\u304C\u63D0\u4F9B\u3055\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u3092\u77ED\u7E2E
86056
+ - \`preserve\` \u2014 \u5165\u529B\u30C6\u30AD\u30B9\u30C8\u3092\u305D\u306E\u307E\u307E\u4F7F\u7528
86057
+
86058
+ #### \u753B\u50CF\u30BD\u30FC\u30B9
86059
+ - \`aiGenerated\`, \`pictographic\`, \`pexels\`, \`giphy\`, \`webFreeToUseCommercially\`, \`noImages\` \u306A\u3069`
86060
+ },
86061
+ tools: tools61
86062
+ });
86063
+
85627
86064
  // ../connectors/src/connectors/registry.ts
85628
86065
  var plugins = {
85629
86066
  snowflake: snowflakeConnector,
@@ -85685,7 +86122,8 @@ var plugins = {
85685
86122
  intercomOauth: intercomOauthConnector,
85686
86123
  mixpanel: mixpanelConnector,
85687
86124
  grafana: grafanaConnector,
85688
- backlog: backlogConnector
86125
+ backlog: backlogConnector,
86126
+ gamma: gammaConnector
85689
86127
  };
85690
86128
  var connectors = {
85691
86129
  ...plugins,
@@ -85886,62 +86324,62 @@ function resolveParams2(entry, connectionId, plugin) {
85886
86324
  var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
85887
86325
 
85888
86326
  // src/types/server-logic.ts
85889
- import { z as z77 } from "zod";
85890
- var parameterMetaSchema = z77.object({
85891
- name: z77.string(),
85892
- type: z77.enum(["string", "number", "boolean"]),
85893
- description: z77.string(),
85894
- required: z77.boolean().optional(),
85895
- default: z77.union([z77.string(), z77.number(), z77.boolean()]).optional()
85896
- });
85897
- var serverLogicCacheConfigSchema = z77.object({
85898
- ttl: z77.number(),
85899
- staleWhileRevalidate: z77.boolean().optional()
85900
- });
85901
- var serverLogicSchemaObjectSchema = z77.lazy(
85902
- () => z77.object({
85903
- type: z77.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
85904
- format: z77.string().optional(),
85905
- description: z77.string().optional(),
85906
- nullable: z77.boolean().optional(),
85907
- enum: z77.array(z77.union([z77.string(), z77.number(), z77.boolean(), z77.null()])).optional(),
86327
+ import { z as z79 } from "zod";
86328
+ var parameterMetaSchema = z79.object({
86329
+ name: z79.string(),
86330
+ type: z79.enum(["string", "number", "boolean"]),
86331
+ description: z79.string(),
86332
+ required: z79.boolean().optional(),
86333
+ default: z79.union([z79.string(), z79.number(), z79.boolean()]).optional()
86334
+ });
86335
+ var serverLogicCacheConfigSchema = z79.object({
86336
+ ttl: z79.number(),
86337
+ staleWhileRevalidate: z79.boolean().optional()
86338
+ });
86339
+ var serverLogicSchemaObjectSchema = z79.lazy(
86340
+ () => z79.object({
86341
+ type: z79.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
86342
+ format: z79.string().optional(),
86343
+ description: z79.string().optional(),
86344
+ nullable: z79.boolean().optional(),
86345
+ enum: z79.array(z79.union([z79.string(), z79.number(), z79.boolean(), z79.null()])).optional(),
85908
86346
  items: serverLogicSchemaObjectSchema.optional(),
85909
- properties: z77.record(z77.string(), serverLogicSchemaObjectSchema).optional(),
85910
- required: z77.array(z77.string()).optional(),
85911
- additionalProperties: z77.union([z77.boolean(), serverLogicSchemaObjectSchema]).optional(),
85912
- minimum: z77.number().optional(),
85913
- maximum: z77.number().optional(),
85914
- minLength: z77.number().optional(),
85915
- maxLength: z77.number().optional(),
85916
- pattern: z77.string().optional()
86347
+ properties: z79.record(z79.string(), serverLogicSchemaObjectSchema).optional(),
86348
+ required: z79.array(z79.string()).optional(),
86349
+ additionalProperties: z79.union([z79.boolean(), serverLogicSchemaObjectSchema]).optional(),
86350
+ minimum: z79.number().optional(),
86351
+ maximum: z79.number().optional(),
86352
+ minLength: z79.number().optional(),
86353
+ maxLength: z79.number().optional(),
86354
+ pattern: z79.string().optional()
85917
86355
  })
85918
86356
  );
85919
- var serverLogicMediaTypeSchema = z77.object({
86357
+ var serverLogicMediaTypeSchema = z79.object({
85920
86358
  schema: serverLogicSchemaObjectSchema.optional(),
85921
- example: z77.unknown().optional()
86359
+ example: z79.unknown().optional()
85922
86360
  });
85923
- var serverLogicResponseSchema = z77.object({
85924
- description: z77.string().optional(),
85925
- content: z77.record(z77.string(), serverLogicMediaTypeSchema).optional()
86361
+ var serverLogicResponseSchema = z79.object({
86362
+ description: z79.string().optional(),
86363
+ content: z79.record(z79.string(), serverLogicMediaTypeSchema).optional()
85926
86364
  });
85927
86365
  var jsonBaseFields = {
85928
- description: z77.string(),
85929
- parameters: z77.array(parameterMetaSchema).optional(),
86366
+ description: z79.string(),
86367
+ parameters: z79.array(parameterMetaSchema).optional(),
85930
86368
  response: serverLogicResponseSchema.optional(),
85931
86369
  cache: serverLogicCacheConfigSchema.optional()
85932
86370
  };
85933
- var jsonSqlServerLogicSchema = z77.object({
86371
+ var jsonSqlServerLogicSchema = z79.object({
85934
86372
  ...jsonBaseFields,
85935
- type: z77.literal("sql").optional(),
85936
- query: z77.string(),
85937
- connectionId: z77.string()
86373
+ type: z79.literal("sql").optional(),
86374
+ query: z79.string(),
86375
+ connectionId: z79.string()
85938
86376
  });
85939
- var jsonTypeScriptServerLogicSchema = z77.object({
86377
+ var jsonTypeScriptServerLogicSchema = z79.object({
85940
86378
  ...jsonBaseFields,
85941
- type: z77.literal("typescript"),
85942
- handlerPath: z77.string()
86379
+ type: z79.literal("typescript"),
86380
+ handlerPath: z79.string()
85943
86381
  });
85944
- var anyJsonServerLogicSchema = z77.union([
86382
+ var anyJsonServerLogicSchema = z79.union([
85945
86383
  jsonTypeScriptServerLogicSchema,
85946
86384
  jsonSqlServerLogicSchema
85947
86385
  ]);