@squadbase/connectors 0.1.2-dev.3 → 0.1.2-dev.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.
Files changed (2) hide show
  1. package/dist/index.js +112 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6019,6 +6019,90 @@ const data = await res.json();
6019
6019
  tools: tools28
6020
6020
  });
6021
6021
 
6022
+ // src/connectors/slack/setup.ts
6023
+ var slackSetup = new ConnectorSetup({
6024
+ ja: `## Slack \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u624B\u9806
6025
+
6026
+ \u4EE5\u4E0B\u306E\u624B\u9806\u3067Slack\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
6027
+
6028
+ ### \u624B\u9806
6029
+
6030
+ #### \u30B9\u30C6\u30C3\u30D71: \u63A5\u7D9A\u78BA\u8A8D
6031
+ 1. Slack API \`auth.test\` \u3092\u547C\u3073\u51FA\u3057\u3066 Bot Token \u306E\u6709\u52B9\u6027\u3092\u78BA\u8A8D\u3059\u308B:
6032
+ - URL: \`https://slack.com/api/auth.test\`
6033
+ - Header: \`Authorization: Bearer {botToken}\`
6034
+ 2. \u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`ok\` \u304C \`false\` \u306E\u5834\u5408:
6035
+ - \`invalid_auth\`: Bot Token \u304C\u7121\u52B9\u3002\u30E6\u30FC\u30B6\u30FC\u306B\u30C8\u30FC\u30AF\u30F3\u306E\u518D\u78BA\u8A8D\u3092\u4F9D\u983C\u3059\u308B
6036
+ - \`missing_scope\` \u3084\u6A29\u9650\u30A8\u30E9\u30FC: \u5FC5\u8981\u306A\u30B9\u30B3\u30FC\u30D7\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u65E8\u3092\u6848\u5185\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u4FEE\u6B63\u3092\u4F9D\u983C\u3059\u308B
6037
+
6038
+ #### \u30B9\u30C6\u30C3\u30D72: \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u306E\u53D6\u5F97
6039
+ 3. \`team.info\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
6040
+ - URL: \`https://slack.com/api/team.info\`
6041
+ 4. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\uFF08\u7279\u306B \`missing_scope\`\uFF09:
6042
+ - \u4E0D\u8DB3\u3057\u3066\u3044\u308B\u30B9\u30B3\u30FC\u30D7\u3092\u6848\u5185\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u8FFD\u52A0\u3092\u4F9D\u983C\u3059\u308B
6043
+ - \u30E6\u30FC\u30B6\u30FC\u304C\u4FEE\u6B63\u5F8C\u300C\u5B8C\u4E86\u3057\u305F\u300D\u3068\u8FD4\u7B54\u3057\u305F\u3089\u3001\u518D\u5EA6 \`team.info\` \u3092\u547C\u3073\u51FA\u3057\u3066\u78BA\u8A8D\u3059\u308B
6044
+
6045
+ #### \u30B9\u30C6\u30C3\u30D73: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5B8C\u4E86
6046
+ 5. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3059:
6047
+ - \`workspace\`: \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u540D\u30FBID
6048
+ - \`note\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5185\u5BB9\u306E\u7C21\u5358\u306A\u8AAC\u660E
6049
+
6050
+ ### \u63A8\u5968 Bot Token Scopes
6051
+ \u4EE5\u4E0B\u306E\u30B9\u30B3\u30FC\u30D7\u304C\u4E00\u822C\u7684\u306B\u5FC5\u8981\u3067\u3059\u3002\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u30E6\u30FC\u30B6\u30FC\u306B\u6848\u5185\u3057\u3066\u304F\u3060\u3055\u3044:
6052
+ - \`channels:read\` \u2014 \u30D1\u30D6\u30EA\u30C3\u30AF\u30C1\u30E3\u30F3\u30CD\u30EB\u306E\u4E00\u89A7
6053
+ - \`groups:read\` \u2014 \u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30C1\u30E3\u30F3\u30CD\u30EB\u306E\u4E00\u89A7
6054
+ - \`users:read\` \u2014 \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7
6055
+ - \`team:read\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u60C5\u5831
6056
+ - \`chat:write\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u9001\u4FE1
6057
+
6058
+ ### \u91CD\u8981\u306A\u5236\u7D04
6059
+ - **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30C1\u30E3\u30F3\u30CD\u30EB\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u5185\u5BB9\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u63A5\u7D9A\u78BA\u8A8D\u30FB\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u307F
6060
+
6061
+ ### \u5B9F\u884C\u65B9\u91DD
6062
+ - \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057
6063
+ - \u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
6064
+ en: `## Slack Setup Instructions
6065
+
6066
+ Follow these steps to set up the Slack connection.
6067
+
6068
+ ### Steps
6069
+
6070
+ #### Step 1: Verify Connection
6071
+ 1. Call Slack API \`auth.test\` to verify the Bot Token:
6072
+ - URL: \`https://slack.com/api/auth.test\`
6073
+ - Header: \`Authorization: Bearer {botToken}\`
6074
+ 2. If the response \`ok\` is \`false\`:
6075
+ - \`invalid_auth\`: Bot Token is invalid. Ask the user to re-check the token
6076
+ - \`missing_scope\` or permission errors: Inform which scopes are missing and ask the user to fix
6077
+
6078
+ #### Step 2: Fetch Workspace Info
6079
+ 3. Call \`team.info\` to get workspace info:
6080
+ - URL: \`https://slack.com/api/team.info\`
6081
+ 4. If an error is returned (especially \`missing_scope\`):
6082
+ - Inform the user which scopes are missing and ask them to add the scopes
6083
+ - When the user confirms the fix, call \`team.info\` again to verify
6084
+
6085
+ #### Step 3: Complete Setup
6086
+ 5. Call \`updateConnectionContext\`:
6087
+ - \`workspace\`: Workspace name and ID
6088
+ - \`note\`: Brief description of the setup
6089
+
6090
+ ### Recommended Bot Token Scopes
6091
+ The following scopes are commonly required. Inform the user if any are missing:
6092
+ - \`channels:read\` \u2014 List public channels
6093
+ - \`groups:read\` \u2014 List private channels
6094
+ - \`users:read\` \u2014 List users
6095
+ - \`team:read\` \u2014 Get workspace info
6096
+ - \`chat:write\` \u2014 Send messages
6097
+
6098
+ ### Important Constraints
6099
+ - **Do NOT read channel message content during setup**. Only the connection verification and metadata requests specified in the steps above are allowed
6100
+
6101
+ ### Execution Policy
6102
+ - Write only 1 sentence between tool calls, then immediately call the next tool
6103
+ - Skip unnecessary explanations and proceed efficiently`
6104
+ });
6105
+
6022
6106
  // src/connectors/slack/index.ts
6023
6107
  var tools29 = {};
6024
6108
  var slackConnector = new ConnectorPlugin({
@@ -6029,35 +6113,42 @@ var slackConnector = new ConnectorPlugin({
6029
6113
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7zTp67vMTvAV1wPftt6Z9R/f859e25c223d9fe4c3fd4f83895acbf6/slack.svg",
6030
6114
  parameters: parameters17,
6031
6115
  releaseFlag: { dev1: true, dev2: false, prod: false },
6116
+ setup: slackSetup,
6032
6117
  systemPrompt: `## Slack SDK (TypeScript handler)
6033
6118
  Use the Slack connector via the SDK in TypeScript handlers:
6034
6119
 
6035
6120
  \`\`\`ts
6036
6121
  import { connection } from "@squadbase/vite-server/connectors/slack";
6037
- import { WebClient } from "@slack/web-api";
6038
6122
 
6039
6123
  const { botToken } = connection("<connectionId>");
6040
- const client = new WebClient(botToken);
6041
6124
 
6042
- const result = await client.conversations.list({ limit: 100 });
6125
+ // Use the Slack Web API with fetch
6126
+ const res = await fetch("https://slack.com/api/conversations.list", {
6127
+ headers: {
6128
+ Authorization: "Bearer " + botToken,
6129
+ "Content-Type": "application/json",
6130
+ },
6131
+ });
6132
+ const data = await res.json();
6043
6133
  \`\`\`
6044
6134
 
6045
- ### Common Web API Methods (Base URL: https://slack.com/api)
6046
- - \`conversations.list\` \u2014 List channels
6047
- - \`conversations.history\` \u2014 Get channel messages
6048
- - \`conversations.info\` \u2014 Get channel info
6049
- - \`conversations.members\` \u2014 List channel members
6050
- - \`users.list\` \u2014 List users
6051
- - \`users.info\` \u2014 Get user info
6052
- - \`chat.postMessage\` \u2014 Send a message
6053
- - \`reactions.list\` \u2014 List reactions
6054
- - \`search.messages\` \u2014 Search messages
6055
- - \`team.info\` \u2014 Get team info
6135
+ ### Common Endpoints (Base URL: https://slack.com/api)
6136
+ - GET \`/conversations.list\` \u2014 List channels
6137
+ - GET \`/conversations.history?channel={id}\` \u2014 Get channel messages
6138
+ - GET \`/conversations.info?channel={id}\` \u2014 Get channel info
6139
+ - GET \`/conversations.members?channel={id}\` \u2014 List channel members
6140
+ - GET \`/users.list\` \u2014 List users
6141
+ - GET \`/users.info?user={id}\` \u2014 Get user info
6142
+ - POST \`/chat.postMessage\` \u2014 Send a message (JSON body: channel, text)
6143
+ - GET \`/reactions.list\` \u2014 List reactions
6144
+ - GET \`/search.messages?query={query}\` \u2014 Search messages (requires user token)
6145
+ - GET \`/team.info\` \u2014 Get team info
6056
6146
 
6057
6147
  ### Tips
6058
- - Use the \`@slack/web-api\` package for type-safe API calls
6148
+ - All endpoints accept GET with query params or POST with JSON body
6059
6149
  - Pagination: use \`cursor\` parameter with \`response_metadata.next_cursor\`
6060
- - Rate limits: Tier 1-4, most methods are Tier 3 (50+ per minute)`,
6150
+ - Rate limits: Tier 1-4, most methods are Tier 3 (50+ per minute)
6151
+ - Check \`data.ok\` field \u2014 Slack returns HTTP 200 even on errors`,
6061
6152
  tools: tools29
6062
6153
  });
6063
6154
 
@@ -6314,7 +6405,7 @@ const data = await res.json();
6314
6405
  // src/connectors/ms-teams/index.ts
6315
6406
  var tools31 = {};
6316
6407
  var msTeamsConnector = new ConnectorPlugin({
6317
- slug: "ms-teams",
6408
+ slug: "microsoft-teams",
6318
6409
  authType: null,
6319
6410
  name: "Microsoft Teams",
6320
6411
  description: "Connect to Microsoft Teams for messaging, channels, and team data.",
@@ -6325,7 +6416,7 @@ var msTeamsConnector = new ConnectorPlugin({
6325
6416
  Use the Microsoft Teams connector via the SDK in TypeScript handlers:
6326
6417
 
6327
6418
  \`\`\`ts
6328
- import { connection } from "@squadbase/vite-server/connectors/ms-teams";
6419
+ import { connection } from "@squadbase/vite-server/connectors/microsoft-teams";
6329
6420
 
6330
6421
  const { clientId, clientSecret, tenantId } = connection("<connectionId>");
6331
6422
 
@@ -6495,7 +6586,7 @@ Authentication is handled automatically via OAuth proxy.`,
6495
6586
  });
6496
6587
 
6497
6588
  // src/connectors/ms-teams-oauth/setup.ts
6498
- var requestToolName6 = `ms-teams-oauth_${requestTool14.name}`;
6589
+ var requestToolName6 = `microsoft-teams-oauth_${requestTool14.name}`;
6499
6590
  var msTeamsOauthSetup = new ConnectorSetup({
6500
6591
  ja: `## Microsoft Teams \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u624B\u9806
6501
6592
 
@@ -6551,7 +6642,7 @@ var parameters32 = {};
6551
6642
  // src/connectors/ms-teams-oauth/index.ts
6552
6643
  var tools32 = { request: requestTool14 };
6553
6644
  var msTeamsOauthConnector = new ConnectorPlugin({
6554
- slug: "ms-teams",
6645
+ slug: "microsoft-teams",
6555
6646
  authType: AUTH_TYPES.OAUTH,
6556
6647
  name: "Microsoft Teams (OAuth)",
6557
6648
  description: "Connect to Microsoft Teams for messaging, channels, and team data using OAuth.",
@@ -6600,7 +6691,7 @@ var msTeamsOauthConnector = new ConnectorPlugin({
6600
6691
  ## Microsoft Teams SDK (TypeScript handler)
6601
6692
 
6602
6693
  \`\`\`ts
6603
- import { connection } from "@squadbase/vite-server/connectors/ms-teams-oauth";
6694
+ import { connection } from "@squadbase/vite-server/connectors/microsoft-teams-oauth";
6604
6695
 
6605
6696
  const teams = connection("<connectionId>");
6606
6697
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/connectors",
3
- "version": "0.1.2-dev.3",
3
+ "version": "0.1.2-dev.5",
4
4
  "description": "Squadbase Connectors",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",