@hasna/connectors 1.3.36 → 1.3.37

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 (49) hide show
  1. package/bin/index.js +167 -241
  2. package/bin/mcp.js +190 -267
  3. package/bin/serve.js +264 -341
  4. package/connectors/bluesky/README.md +34 -0
  5. package/connectors/bluesky/package.json +41 -0
  6. package/connectors/bluesky/src/api/client.test.ts +122 -0
  7. package/connectors/bluesky/src/api/client.ts +194 -0
  8. package/connectors/bluesky/src/api/index.ts +108 -0
  9. package/connectors/bluesky/src/index.ts +17 -0
  10. package/connectors/bluesky/src/types/index.ts +46 -0
  11. package/connectors/bluesky/tsconfig.json +16 -0
  12. package/connectors/x/src/api/media.ts +4 -3
  13. package/dashboard/dist/assets/index-ClBXkNbL.css +1 -0
  14. package/dashboard/dist/assets/index-DvfmyAO4.js +284 -0
  15. package/dashboard/dist/index.html +2 -2
  16. package/dist/.types/connectors/bluesky/src/api/client.d.ts +73 -0
  17. package/dist/.types/connectors/bluesky/src/api/index.d.ts +76 -0
  18. package/dist/.types/connectors/bluesky/src/index.d.ts +11 -0
  19. package/dist/.types/connectors/bluesky/src/types/index.d.ts +33 -0
  20. package/dist/.types/connectors/x/src/api/client.d.ts +96 -0
  21. package/dist/.types/connectors/x/src/api/index.d.ts +80 -0
  22. package/dist/.types/connectors/x/src/api/media.d.ts +54 -0
  23. package/dist/.types/connectors/x/src/api/oauth.d.ts +82 -0
  24. package/dist/.types/connectors/x/src/api/oauth1.d.ts +68 -0
  25. package/dist/.types/connectors/x/src/api/tweets.d.ts +175 -0
  26. package/dist/.types/connectors/x/src/api/users.d.ts +127 -0
  27. package/dist/.types/connectors/x/src/cli/index.d.ts +2 -0
  28. package/dist/.types/connectors/x/src/index.d.ts +6 -0
  29. package/dist/.types/connectors/x/src/types/index.d.ts +156 -0
  30. package/dist/.types/connectors/x/src/utils/config.d.ts +99 -0
  31. package/dist/.types/connectors/x/src/utils/output.d.ts +8 -0
  32. package/dist/.types/src/social/bluesky.d.ts +65 -0
  33. package/dist/.types/src/social/errors.d.ts +9 -0
  34. package/dist/.types/src/social/index.d.ts +16 -0
  35. package/dist/.types/src/social/mastodon.d.ts +32 -0
  36. package/dist/.types/src/social/types.d.ts +73 -0
  37. package/dist/.types/src/social/util.d.ts +5 -0
  38. package/dist/.types/src/social/x.d.ts +82 -0
  39. package/dist/cli/components/App.d.ts +1 -2
  40. package/dist/cli/components/CategorySelect.d.ts +1 -2
  41. package/dist/cli/components/ConnectorSelect.d.ts +1 -2
  42. package/dist/cli/components/Header.d.ts +1 -2
  43. package/dist/cli/components/InstallProgress.d.ts +1 -2
  44. package/dist/cli/components/SearchView.d.ts +1 -2
  45. package/dist/index.js +122 -109
  46. package/dist/social/index.js +1531 -0
  47. package/package.json +7 -3
  48. package/dashboard/dist/assets/index-DJjxFlTl.css +0 -1
  49. package/dashboard/dist/assets/index-DNPZ58_i.js +0 -284
package/bin/serve.js CHANGED
@@ -61,14 +61,14 @@ import { join, relative } from "path";
61
61
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
62
62
  import { homedir as homedir2 } from "os";
63
63
  import { join as join2 } from "path";
64
- import { readdirSync as readdirSync3, existsSync as existsSync6 } from "fs";
65
- import { join as join6 } from "path";
66
- import { homedir as homedir5 } from "os";
67
- import { hostname } from "os";
68
- import { homedir as homedir3 } from "os";
64
+ import { readdirSync as readdirSync2, existsSync as existsSync3 } from "fs";
69
65
  import { join as join3 } from "path";
70
- import { join as join5, dirname } from "path";
71
- import { homedir as homedir4, platform } from "os";
66
+ import { homedir as homedir3 } from "os";
67
+ import { hostname } from "os";
68
+ import { homedir as homedir4 } from "os";
69
+ import { join as join4 } from "path";
70
+ import { join as join6, dirname } from "path";
71
+ import { homedir as homedir5, platform } from "os";
72
72
  function __accessProp2(key) {
73
73
  return this[key];
74
74
  }
@@ -996,11 +996,11 @@ function isSyncExcludedTable(table) {
996
996
  return SYNC_EXCLUDED_TABLE_PATTERNS.some((p) => p.test(table));
997
997
  }
998
998
  function discoverServices() {
999
- const dataDir = join6(homedir5(), ".hasna");
1000
- if (!existsSync6(dataDir))
999
+ const dataDir = join3(homedir3(), ".hasna");
1000
+ if (!existsSync3(dataDir))
1001
1001
  return [];
1002
1002
  try {
1003
- const entries = readdirSync3(dataDir, { withFileTypes: true });
1003
+ const entries = readdirSync2(dataDir, { withFileTypes: true });
1004
1004
  return entries.filter((e) => {
1005
1005
  if (!e.isDirectory())
1006
1006
  return false;
@@ -1012,30 +1012,30 @@ function discoverServices() {
1012
1012
  return [];
1013
1013
  }
1014
1014
  }
1015
- function discoverSyncableServices2() {
1015
+ function discoverSyncableServices() {
1016
1016
  const local = discoverServices();
1017
1017
  const pgSet = new Set(KNOWN_PG_SERVICES);
1018
1018
  return local.filter((s) => pgSet.has(s));
1019
1019
  }
1020
1020
  function getServiceDbPath(service) {
1021
- const dataDir = join6(homedir5(), ".hasna", service);
1022
- if (!existsSync6(dataDir))
1021
+ const dataDir = join3(homedir3(), ".hasna", service);
1022
+ if (!existsSync3(dataDir))
1023
1023
  return null;
1024
1024
  const candidates = [
1025
- join6(dataDir, `${service}.db`),
1026
- join6(dataDir, "data.db"),
1027
- join6(dataDir, "database.db")
1025
+ join3(dataDir, `${service}.db`),
1026
+ join3(dataDir, "data.db"),
1027
+ join3(dataDir, "database.db")
1028
1028
  ];
1029
1029
  try {
1030
- const files = readdirSync3(dataDir);
1030
+ const files = readdirSync2(dataDir);
1031
1031
  for (const f of files) {
1032
1032
  if (f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm")) {
1033
- candidates.push(join6(dataDir, f));
1033
+ candidates.push(join3(dataDir, f));
1034
1034
  }
1035
1035
  }
1036
1036
  } catch {}
1037
1037
  for (const p of candidates) {
1038
- if (existsSync6(p))
1038
+ if (existsSync3(p))
1039
1039
  return p;
1040
1040
  }
1041
1041
  return null;
@@ -10000,7 +10000,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
10000
10000
  __export2(exports_discover, {
10001
10001
  isSyncExcludedTable: () => isSyncExcludedTable,
10002
10002
  getServiceDbPath: () => getServiceDbPath,
10003
- discoverSyncableServices: () => discoverSyncableServices2,
10003
+ discoverSyncableServices: () => discoverSyncableServices,
10004
10004
  discoverServices: () => discoverServices,
10005
10005
  SYNC_EXCLUDED_TABLE_PATTERNS: () => SYNC_EXCLUDED_TABLE_PATTERNS,
10006
10006
  KNOWN_PG_SERVICES: () => KNOWN_PG_SERVICES
@@ -10055,13 +10055,15 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
10055
10055
  init_config();
10056
10056
  init_config();
10057
10057
  init_dotfile();
10058
+ init_adapter();
10058
10059
  init_config();
10059
- AUTO_SYNC_CONFIG_PATH = join3(homedir3(), ".hasna", "cloud", "config.json");
10060
+ init_discover();
10061
+ AUTO_SYNC_CONFIG_PATH = join4(homedir4(), ".hasna", "cloud", "config.json");
10060
10062
  init_config();
10061
10063
  init_adapter();
10062
10064
  init_dotfile();
10063
10065
  init_config();
10064
- CONFIG_DIR2 = join5(homedir4(), ".hasna", "cloud");
10066
+ CONFIG_DIR2 = join6(homedir5(), ".hasna", "cloud");
10065
10067
  init_adapter();
10066
10068
  init_config();
10067
10069
  init_discover();
@@ -10083,24 +10085,24 @@ __export(exports_database, {
10083
10085
  getConnectorsHome: () => getConnectorsHome,
10084
10086
  closeDatabase: () => closeDatabase
10085
10087
  });
10086
- import { dirname as dirname2, join as join4 } from "path";
10088
+ import { dirname as dirname2, join as join5 } from "path";
10087
10089
  import { homedir as homedir6 } from "os";
10088
- import { mkdirSync as mkdirSync3, existsSync as existsSync3, readdirSync as readdirSync2, copyFileSync as copyFileSync2, statSync } from "fs";
10090
+ import { mkdirSync as mkdirSync3, existsSync as existsSync4, readdirSync as readdirSync3, copyFileSync as copyFileSync2, statSync } from "fs";
10089
10091
  function mergeDirectoryContents(sourceDir, targetDir) {
10090
- if (!existsSync3(sourceDir)) {
10092
+ if (!existsSync4(sourceDir)) {
10091
10093
  return;
10092
10094
  }
10093
10095
  mkdirSync3(targetDir, { recursive: true });
10094
- for (const entry of readdirSync2(sourceDir)) {
10095
- const sourcePath = join4(sourceDir, entry);
10096
- const targetPath = join4(targetDir, entry);
10096
+ for (const entry of readdirSync3(sourceDir)) {
10097
+ const sourcePath = join5(sourceDir, entry);
10098
+ const targetPath = join5(targetDir, entry);
10097
10099
  try {
10098
10100
  const sourceStat = statSync(sourcePath);
10099
10101
  if (sourceStat.isDirectory()) {
10100
10102
  mergeDirectoryContents(sourcePath, targetPath);
10101
10103
  continue;
10102
10104
  }
10103
- if (!existsSync3(targetPath)) {
10105
+ if (!existsSync4(targetPath)) {
10104
10106
  copyFileSync2(sourcePath, targetPath);
10105
10107
  }
10106
10108
  } catch {}
@@ -10108,8 +10110,8 @@ function mergeDirectoryContents(sourceDir, targetDir) {
10108
10110
  }
10109
10111
  function getConnectorsHome() {
10110
10112
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir6();
10111
- const newDir = join4(home, ".hasna", "connectors");
10112
- const legacyDirs = [join4(home, ".connectors"), join4(home, ".connect")];
10113
+ const newDir = join5(home, ".hasna", "connectors");
10114
+ const legacyDirs = [join5(home, ".connectors"), join5(home, ".connect")];
10113
10115
  mkdirSync3(newDir, { recursive: true });
10114
10116
  for (const legacyDir of legacyDirs) {
10115
10117
  try {
@@ -10257,7 +10259,7 @@ var DB_DIR, DB_PATH, _db = null, _dbPath = null;
10257
10259
  var init_database = __esm(() => {
10258
10260
  init_dist();
10259
10261
  DB_DIR = getConnectorsHome();
10260
- DB_PATH = join4(DB_DIR, "connectors.db");
10262
+ DB_PATH = join5(DB_DIR, "connectors.db");
10261
10263
  });
10262
10264
 
10263
10265
  // src/lib/llm.ts
@@ -10271,14 +10273,14 @@ __export(exports_llm, {
10271
10273
  PROVIDER_DEFAULTS: () => PROVIDER_DEFAULTS,
10272
10274
  LLMClient: () => LLMClient
10273
10275
  });
10274
- import { existsSync as existsSync5, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync5 } from "fs";
10276
+ import { existsSync as existsSync6, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync5 } from "fs";
10275
10277
  import { join as join7 } from "path";
10276
10278
  function getLlmConfigPath() {
10277
10279
  return join7(getConnectorsHome(), "llm.json");
10278
10280
  }
10279
10281
  function getLlmConfig() {
10280
10282
  const path = getLlmConfigPath();
10281
- if (!existsSync5(path))
10283
+ if (!existsSync6(path))
10282
10284
  return null;
10283
10285
  try {
10284
10286
  return JSON.parse(readFileSync2(path, "utf-8"));
@@ -14732,14 +14734,14 @@ var init_zod2 = __esm(() => {
14732
14734
  // src/core/connectors/github.ts
14733
14735
  import { Buffer as Buffer2 } from "buffer";
14734
14736
  import { existsSync as existsSync7 } from "fs";
14735
- import { dirname as dirname3, join as join9 } from "path";
14737
+ import { dirname as dirname3, join as join8 } from "path";
14736
14738
  import { fileURLToPath, pathToFileURL } from "url";
14737
14739
  function resolveGithubConnectorDir() {
14738
14740
  const candidates = [
14739
- join9(__dirname2, "..", "..", "..", "connectors", "github"),
14740
- join9(__dirname2, "..", "..", "connectors", "github"),
14741
- join9(__dirname2, "..", "connectors", "github"),
14742
- join9(process.cwd(), "connectors", "github")
14741
+ join8(__dirname2, "..", "..", "..", "connectors", "github"),
14742
+ join8(__dirname2, "..", "..", "connectors", "github"),
14743
+ join8(__dirname2, "..", "connectors", "github"),
14744
+ join8(process.cwd(), "connectors", "github")
14743
14745
  ];
14744
14746
  for (const candidate of candidates) {
14745
14747
  if (existsSync7(candidate)) {
@@ -14749,10 +14751,10 @@ function resolveGithubConnectorDir() {
14749
14751
  return candidates[0];
14750
14752
  }
14751
14753
  async function loadGitHubApiModule() {
14752
- return await import(pathToFileURL(join9(CONNECTOR_DIR, "src", "api", "index.ts")).href);
14754
+ return await import(pathToFileURL(join8(CONNECTOR_DIR, "src", "api", "index.ts")).href);
14753
14755
  }
14754
14756
  async function loadGitHubConfigModule() {
14755
- return await import(pathToFileURL(join9(CONNECTOR_DIR, "src", "utils", "config.ts")).href);
14757
+ return await import(pathToFileURL(join8(CONNECTOR_DIR, "src", "utils", "config.ts")).href);
14756
14758
  }
14757
14759
  function extractGlobalArgs(args) {
14758
14760
  const remaining = [];
@@ -15596,9 +15598,9 @@ Commands:
15596
15598
  });
15597
15599
 
15598
15600
  // src/core/connectors/gmail.ts
15599
- import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync3, readdirSync as readdirSync4, writeFileSync as writeFileSync3 } from "fs";
15601
+ import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync3, readdirSync as readdirSync5, writeFileSync as writeFileSync3 } from "fs";
15600
15602
  import { homedir as homedir8 } from "os";
15601
- import { basename, join as join10 } from "path";
15603
+ import { basename, join as join9 } from "path";
15602
15604
  async function modifyMessage(profile, messageId, addLabelIds, removeLabelIds) {
15603
15605
  return requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}/modify`, {}, {
15604
15606
  method: "POST",
@@ -15635,7 +15637,7 @@ async function replyToMessage(profile, messageId, input) {
15635
15637
  }
15636
15638
  async function downloadAttachments(profile, input) {
15637
15639
  const messageId = getMessageId(input);
15638
- const outputDir = input.dir ?? input.outputDir ?? join10(configDirs()[0], "attachments", messageId);
15640
+ const outputDir = input.dir ?? input.outputDir ?? join9(configDirs()[0], "attachments", messageId);
15639
15641
  mkdirSync6(outputDir, { recursive: true });
15640
15642
  const attachments = input.attachmentId && input.filename ? [{
15641
15643
  attachmentId: input.attachmentId,
@@ -15647,7 +15649,7 @@ async function downloadAttachments(profile, input) {
15647
15649
  for (const attachment of attachments) {
15648
15650
  const data = await requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachment.attachmentId)}`, {});
15649
15651
  const filename = safeFilename(attachment.filename);
15650
- const path = join10(outputDir, filename);
15652
+ const path = join9(outputDir, filename);
15651
15653
  const buffer = Buffer.from(data.data, "base64url");
15652
15654
  writeFileSync3(path, buffer);
15653
15655
  downloaded.push({
@@ -15764,10 +15766,10 @@ async function refreshAccessToken(profile, currentTokens) {
15764
15766
  function listProfiles() {
15765
15767
  const profiles = new Set;
15766
15768
  for (const baseDir of configDirs()) {
15767
- const profilesDir = join10(baseDir, "profiles");
15768
- if (!existsSync9(profilesDir))
15769
+ const profilesDir = join9(baseDir, "profiles");
15770
+ if (!existsSync8(profilesDir))
15769
15771
  continue;
15770
- for (const entry of readdirSync4(profilesDir, { withFileTypes: true })) {
15772
+ for (const entry of readdirSync5(profilesDir, { withFileTypes: true })) {
15771
15773
  if (entry.isDirectory())
15772
15774
  profiles.add(entry.name);
15773
15775
  if (entry.isFile() && entry.name.endsWith(".json"))
@@ -15783,8 +15785,8 @@ function loadCredentials(profile) {
15783
15785
  return { clientId: envClientId, clientSecret: envClientSecret };
15784
15786
  for (const baseDir of configDirs()) {
15785
15787
  const credentials = {
15786
- ...readJson(join10(baseDir, "credentials.json")),
15787
- ...readJson(join10(baseDir, "profiles", profile, "config.json"))
15788
+ ...readJson(join9(baseDir, "credentials.json")),
15789
+ ...readJson(join9(baseDir, "profiles", profile, "config.json"))
15788
15790
  };
15789
15791
  if (credentials.clientId || credentials.clientSecret)
15790
15792
  return credentials;
@@ -15793,30 +15795,30 @@ function loadCredentials(profile) {
15793
15795
  }
15794
15796
  function loadTokens(profile) {
15795
15797
  for (const baseDir of configDirs()) {
15796
- const fromProfile = readJson(join10(baseDir, "profiles", profile, "tokens.json"));
15798
+ const fromProfile = readJson(join9(baseDir, "profiles", profile, "tokens.json"));
15797
15799
  if (fromProfile)
15798
15800
  return fromProfile;
15799
- const flat = readJson(join10(baseDir, "profiles", `${profile}.json`));
15801
+ const flat = readJson(join9(baseDir, "profiles", `${profile}.json`));
15800
15802
  if (flat)
15801
15803
  return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
15802
15804
  }
15803
15805
  return null;
15804
15806
  }
15805
15807
  function saveTokens(profile, tokens) {
15806
- const baseDir = configDirs().find((dir) => existsSync9(dir)) ?? configDirs()[0];
15807
- const profileDir = join10(baseDir, "profiles", profile);
15808
+ const baseDir = configDirs().find((dir) => existsSync8(dir)) ?? configDirs()[0];
15809
+ const profileDir = join9(baseDir, "profiles", profile);
15808
15810
  mkdirSync6(profileDir, { recursive: true });
15809
- writeFileSync3(join10(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
15811
+ writeFileSync3(join9(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
15810
15812
  }
15811
15813
  function configDirs() {
15812
15814
  const explicit = process.env.HASNA_GMAIL_CONNECTOR_DIR ?? process.env.GMAIL_CONNECTOR_DIR;
15813
15815
  if (explicit)
15814
15816
  return [explicit];
15815
- const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join10(homedir8(), ".hasna", "connectors");
15816
- return [join10(baseDir, "gmail"), join10(baseDir, "connect-gmail")];
15817
+ const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join9(homedir8(), ".hasna", "connectors");
15818
+ return [join9(baseDir, "gmail"), join9(baseDir, "connect-gmail")];
15817
15819
  }
15818
15820
  function readJson(path) {
15819
- if (!existsSync9(path))
15821
+ if (!existsSync8(path))
15820
15822
  return null;
15821
15823
  try {
15822
15824
  return JSON.parse(readFileSync3(path, "utf8"));
@@ -16066,9 +16068,9 @@ var init_gmail = __esm(() => {
16066
16068
  });
16067
16069
 
16068
16070
  // src/core/connectors/googledrive.ts
16069
- import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync4, readdirSync as readdirSync6, writeFileSync as writeFileSync4 } from "fs";
16071
+ import { existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync4, readdirSync as readdirSync6, writeFileSync as writeFileSync4 } from "fs";
16070
16072
  import { homedir as homedir9 } from "os";
16071
- import { basename as basename2, join as join11 } from "path";
16073
+ import { basename as basename2, join as join10 } from "path";
16072
16074
  async function requestJson2(profile, path, params) {
16073
16075
  const response = await request(profile, path, params);
16074
16076
  const text = await response.text();
@@ -16136,8 +16138,8 @@ async function refreshAccessToken2(profile, currentTokens) {
16136
16138
  function listProfiles2() {
16137
16139
  const profiles = new Set;
16138
16140
  for (const baseDir of configDirs2()) {
16139
- const profilesDir = join11(baseDir, "profiles");
16140
- if (!existsSync10(profilesDir))
16141
+ const profilesDir = join10(baseDir, "profiles");
16142
+ if (!existsSync9(profilesDir))
16141
16143
  continue;
16142
16144
  for (const entry of readdirSync6(profilesDir, { withFileTypes: true })) {
16143
16145
  if (entry.isDirectory())
@@ -16184,8 +16186,8 @@ function loadCredentials2(profile) {
16184
16186
  return { clientId: envClientId, clientSecret: envClientSecret };
16185
16187
  for (const baseDir of configDirs2()) {
16186
16188
  const credentials = {
16187
- ...readJson2(join11(baseDir, "credentials.json")),
16188
- ...readJson2(join11(baseDir, "profiles", profile, "config.json"))
16189
+ ...readJson2(join10(baseDir, "credentials.json")),
16190
+ ...readJson2(join10(baseDir, "profiles", profile, "config.json"))
16189
16191
  };
16190
16192
  if (credentials.clientId || credentials.clientSecret)
16191
16193
  return credentials;
@@ -16194,30 +16196,30 @@ function loadCredentials2(profile) {
16194
16196
  }
16195
16197
  function loadTokens2(profile) {
16196
16198
  for (const baseDir of configDirs2()) {
16197
- const fromProfile = readJson2(join11(baseDir, "profiles", profile, "tokens.json"));
16199
+ const fromProfile = readJson2(join10(baseDir, "profiles", profile, "tokens.json"));
16198
16200
  if (fromProfile)
16199
16201
  return fromProfile;
16200
- const flat = readJson2(join11(baseDir, "profiles", `${profile}.json`));
16202
+ const flat = readJson2(join10(baseDir, "profiles", `${profile}.json`));
16201
16203
  if (flat)
16202
16204
  return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
16203
16205
  }
16204
16206
  return null;
16205
16207
  }
16206
16208
  function saveTokens2(profile, tokens) {
16207
- const baseDir = configDirs2().find((dir) => existsSync10(dir)) ?? configDirs2()[0];
16208
- const profileDir = join11(baseDir, "profiles", profile);
16209
+ const baseDir = configDirs2().find((dir) => existsSync9(dir)) ?? configDirs2()[0];
16210
+ const profileDir = join10(baseDir, "profiles", profile);
16209
16211
  mkdirSync7(profileDir, { recursive: true });
16210
- writeFileSync4(join11(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
16212
+ writeFileSync4(join10(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
16211
16213
  }
16212
16214
  function configDirs2() {
16213
16215
  const explicit = process.env.HASNA_GOOGLE_DRIVE_CONNECTOR_DIR ?? process.env.GOOGLE_DRIVE_CONNECTOR_DIR;
16214
16216
  if (explicit)
16215
16217
  return [explicit];
16216
- const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join11(homedir9(), ".hasna", "connectors");
16217
- return [join11(baseDir, "googledrive"), join11(baseDir, "connect-googledrive")];
16218
+ const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join10(homedir9(), ".hasna", "connectors");
16219
+ return [join10(baseDir, "googledrive"), join10(baseDir, "connect-googledrive")];
16218
16220
  }
16219
16221
  function readJson2(path) {
16220
- if (!existsSync10(path))
16222
+ if (!existsSync9(path))
16221
16223
  return null;
16222
16224
  try {
16223
16225
  return JSON.parse(readFileSync4(path, "utf8"));
@@ -16400,7 +16402,7 @@ var package_default;
16400
16402
  var init_package = __esm(() => {
16401
16403
  package_default = {
16402
16404
  name: "@hasna/connectors",
16403
- version: "1.3.36",
16405
+ version: "1.3.37",
16404
16406
  description: "Open source connector library - Install API connectors with a single command",
16405
16407
  type: "module",
16406
16408
  bin: {
@@ -16419,16 +16421,20 @@ var init_package = __esm(() => {
16419
16421
  ".": {
16420
16422
  import: "./dist/index.js",
16421
16423
  types: "./dist/index.d.ts"
16424
+ },
16425
+ "./social": {
16426
+ import: "./dist/social/index.js",
16427
+ types: "./dist/.types/src/social/index.d.ts"
16422
16428
  }
16423
16429
  },
16424
16430
  main: "./dist/index.js",
16425
16431
  types: "./dist/index.d.ts",
16426
16432
  scripts: {
16427
- build: "cd dashboard && bun run build && cd .. && bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk --external conf && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/serve.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --outDir ./dist",
16433
+ build: "cd dashboard && bun run build && cd .. && bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk --external conf && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/serve.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun && bun build ./src/social/index.ts --outfile ./dist/social/index.js --target bun && tsc --emitDeclarationOnly --outDir ./dist && tsc -p tsconfig.social.json",
16428
16434
  "build:dashboard": "cd dashboard && bun run build",
16429
16435
  postinstall: 'mkdir -p $HOME/.hasna/connectors 2>/dev/null || true; [ "$SKIP_DASHBOARD" = "1" ] || [ ! -f dashboard/package.json ] || [ -d dashboard/node_modules ] || (cd dashboard && bun install)',
16430
16436
  dev: "bun run ./src/cli/index.tsx",
16431
- typecheck: "tsc --noEmit",
16437
+ typecheck: "tsc --noEmit && tsc -p tsconfig.social.json --noEmit",
16432
16438
  test: "bun test",
16433
16439
  "sdk:build": "cd sdk && bun run build",
16434
16440
  prepublishOnly: "bun run build && bun test"
@@ -16489,8 +16495,8 @@ var init_package = __esm(() => {
16489
16495
  });
16490
16496
 
16491
16497
  // src/lib/connector-resolver.ts
16492
- import { existsSync as existsSync11, readdirSync as readdirSync7, statSync as statSync2 } from "fs";
16493
- import { join as join12 } from "path";
16498
+ import { existsSync as existsSync10, readdirSync as readdirSync7, statSync as statSync2 } from "fs";
16499
+ import { join as join11 } from "path";
16494
16500
  function normalizeConnectorName(name) {
16495
16501
  const trimmed = name.trim().toLowerCase();
16496
16502
  return trimmed.startsWith(LEGACY_CONNECTOR_PREFIX) ? trimmed.slice(LEGACY_CONNECTOR_PREFIX.length) : trimmed;
@@ -16524,8 +16530,8 @@ function connectorPackageDirNames(name) {
16524
16530
  function resolveConnectorPackagePath(connectorsDir, name) {
16525
16531
  const resolution = resolveConnectorName(name);
16526
16532
  const dirNames = connectorPackageDirNames(name);
16527
- const checkedPaths = dirNames.map((dirName) => join12(connectorsDir, dirName));
16528
- const existingPath = checkedPaths.find((path) => existsSync11(path)) ?? null;
16533
+ const checkedPaths = dirNames.map((dirName) => join11(connectorsDir, dirName));
16534
+ const existingPath = checkedPaths.find((path) => existsSync10(path)) ?? null;
16529
16535
  const existingDirName = existingPath ? dirNames[checkedPaths.indexOf(existingPath)] : null;
16530
16536
  return {
16531
16537
  ...resolution,
@@ -16544,10 +16550,10 @@ function getConnectorPackagePath(connectorsDir, name) {
16544
16550
  function resolveConnectorConfigPaths(name, connectorsHome = getConnectorsHome()) {
16545
16551
  const resolution = resolveConnectorName(name);
16546
16552
  const preferredDirName = resolution.canonicalName || resolution.legacyName;
16547
- const preferredPath = join12(connectorsHome, preferredDirName);
16548
- const legacyPath = join12(connectorsHome, resolution.legacyName);
16553
+ const preferredPath = join11(connectorsHome, preferredDirName);
16554
+ const legacyPath = join11(connectorsHome, resolution.legacyName);
16549
16555
  const paths = preferredPath === legacyPath ? [preferredPath] : [preferredPath, legacyPath];
16550
- const existingPaths = paths.filter((path) => existsSync11(path));
16556
+ const existingPaths = paths.filter((path) => existsSync10(path));
16551
16557
  return {
16552
16558
  ...resolution,
16553
16559
  connectorsHome,
@@ -16565,11 +16571,11 @@ function getConnectorConfigReadDirs(name, connectorsHome = getConnectorsHome())
16565
16571
  return resolveConnectorConfigPaths(name, connectorsHome).readPaths;
16566
16572
  }
16567
16573
  function listConfiguredConnectorNames(connectorsHome = getConnectorsHome()) {
16568
- if (!existsSync11(connectorsHome))
16574
+ if (!existsSync10(connectorsHome))
16569
16575
  return [];
16570
16576
  const names = new Set;
16571
16577
  for (const entry of readdirSync7(connectorsHome)) {
16572
- const fullPath = join12(connectorsHome, entry);
16578
+ const fullPath = join11(connectorsHome, entry);
16573
16579
  try {
16574
16580
  if (!statSync2(fullPath).isDirectory())
16575
16581
  continue;
@@ -16588,7 +16594,7 @@ var init_connector_resolver = __esm(() => {
16588
16594
 
16589
16595
  // src/core/connectors/imessage.ts
16590
16596
  import {
16591
- existsSync as existsSync12,
16597
+ existsSync as existsSync11,
16592
16598
  mkdirSync as mkdirSync8,
16593
16599
  readFileSync as readFileSync5,
16594
16600
  readdirSync as readdirSync8,
@@ -16596,7 +16602,7 @@ import {
16596
16602
  statSync as statSync3,
16597
16603
  writeFileSync as writeFileSync5
16598
16604
  } from "fs";
16599
- import { join as join13 } from "path";
16605
+ import { join as join12 } from "path";
16600
16606
  function buildRootHelp(specs) {
16601
16607
  const lines = [
16602
16608
  "Usage: connect-imessage [options] [command]",
@@ -16647,12 +16653,12 @@ function getConfigReadDirs() {
16647
16653
  return getConnectorConfigReadDirs(CONNECTOR_NAME);
16648
16654
  }
16649
16655
  function getProfilesDir() {
16650
- return join13(getConfigDir2(), "profiles");
16656
+ return join12(getConfigDir2(), "profiles");
16651
16657
  }
16652
16658
  function getCurrentProfile() {
16653
16659
  for (const configDir of getConfigReadDirs()) {
16654
- const currentProfileFile = join13(configDir, "current_profile");
16655
- if (!existsSync12(currentProfileFile))
16660
+ const currentProfileFile = join12(configDir, "current_profile");
16661
+ if (!existsSync11(currentProfileFile))
16656
16662
  continue;
16657
16663
  try {
16658
16664
  return readFileSync5(currentProfileFile, "utf-8").trim() || "default";
@@ -16665,16 +16671,16 @@ function getCurrentProfile() {
16665
16671
  function setCurrentProfile(profile) {
16666
16672
  const configDir = getConfigDir2();
16667
16673
  mkdirSync8(configDir, { recursive: true });
16668
- writeFileSync5(join13(configDir, "current_profile"), profile);
16674
+ writeFileSync5(join12(configDir, "current_profile"), profile);
16669
16675
  }
16670
16676
  function getFlatProfilePath(profile) {
16671
- return join13(getProfilesDir(), `${profile}.json`);
16677
+ return join12(getProfilesDir(), `${profile}.json`);
16672
16678
  }
16673
16679
  function getFlatProfileReadPaths(profile) {
16674
- return getConfigReadDirs().map((dir) => join13(dir, "profiles", `${profile}.json`));
16680
+ return getConfigReadDirs().map((dir) => join12(dir, "profiles", `${profile}.json`));
16675
16681
  }
16676
16682
  function getDirectoryProfileReadPaths(profile) {
16677
- return getConfigReadDirs().map((dir) => join13(dir, "profiles", profile, "config.json"));
16683
+ return getConfigReadDirs().map((dir) => join12(dir, "profiles", profile, "config.json"));
16678
16684
  }
16679
16685
  function loadJsonFile(path) {
16680
16686
  try {
@@ -16694,8 +16700,8 @@ function sanitizeProfileConfig(config) {
16694
16700
  };
16695
16701
  }
16696
16702
  function loadProfile(profile = getCurrentProfile()) {
16697
- const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...existsSync12(path) ? loadJsonFile(path) : {} }), {});
16698
- const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...existsSync12(path) ? loadJsonFile(path) : {} }), {});
16703
+ const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...existsSync11(path) ? loadJsonFile(path) : {} }), {});
16704
+ const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...existsSync11(path) ? loadJsonFile(path) : {} }), {});
16699
16705
  return sanitizeProfileConfig({
16700
16706
  ...flatConfig,
16701
16707
  ...directoryConfig
@@ -16711,17 +16717,17 @@ function profileExists(profile) {
16711
16717
  if (profile === "default") {
16712
16718
  return true;
16713
16719
  }
16714
- return getFlatProfileReadPaths(profile).some((path) => existsSync12(path)) || getConfigReadDirs().some((dir) => existsSync12(join13(dir, "profiles", profile)));
16720
+ return getFlatProfileReadPaths(profile).some((path) => existsSync11(path)) || getConfigReadDirs().some((dir) => existsSync11(join12(dir, "profiles", profile)));
16715
16721
  }
16716
16722
  function listProfiles3() {
16717
16723
  const seen = new Set(["default"]);
16718
16724
  for (const configDir of getConfigReadDirs()) {
16719
- const profilesDir = join13(configDir, "profiles");
16720
- if (!existsSync12(profilesDir))
16725
+ const profilesDir = join12(configDir, "profiles");
16726
+ if (!existsSync11(profilesDir))
16721
16727
  continue;
16722
16728
  try {
16723
16729
  for (const entry of readdirSync8(profilesDir)) {
16724
- const fullPath = join13(profilesDir, entry);
16730
+ const fullPath = join12(profilesDir, entry);
16725
16731
  const stat = statSync3(fullPath);
16726
16732
  if (stat.isDirectory()) {
16727
16733
  seen.add(entry);
@@ -16743,11 +16749,11 @@ function createProfile(profile, config = {}) {
16743
16749
  }
16744
16750
  function clearProfile(profile = getCurrentProfile()) {
16745
16751
  const flatPath = getFlatProfilePath(profile);
16746
- const directoryPath = join13(getProfilesDir(), profile);
16747
- if (existsSync12(flatPath)) {
16752
+ const directoryPath = join12(getProfilesDir(), profile);
16753
+ if (existsSync11(flatPath)) {
16748
16754
  rmSync(flatPath);
16749
16755
  }
16750
- if (existsSync12(directoryPath)) {
16756
+ if (existsSync11(directoryPath)) {
16751
16757
  rmSync(directoryPath, { recursive: true, force: true });
16752
16758
  }
16753
16759
  }
@@ -17673,18 +17679,18 @@ var init_imessage = __esm(() => {
17673
17679
  });
17674
17680
 
17675
17681
  // src/core/connectors/stripe.ts
17676
- import { existsSync as existsSync13 } from "fs";
17677
- import { dirname as dirname4, join as join14 } from "path";
17682
+ import { existsSync as existsSync12 } from "fs";
17683
+ import { dirname as dirname4, join as join13 } from "path";
17678
17684
  import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
17679
17685
  function resolveStripeConnectorDir() {
17680
17686
  const candidates = [
17681
- join14(__dirname3, "..", "..", "..", "connectors", "stripe"),
17682
- join14(__dirname3, "..", "..", "connectors", "stripe"),
17683
- join14(__dirname3, "..", "connectors", "stripe"),
17684
- join14(process.cwd(), "connectors", "stripe")
17687
+ join13(__dirname3, "..", "..", "..", "connectors", "stripe"),
17688
+ join13(__dirname3, "..", "..", "connectors", "stripe"),
17689
+ join13(__dirname3, "..", "connectors", "stripe"),
17690
+ join13(process.cwd(), "connectors", "stripe")
17685
17691
  ];
17686
17692
  for (const candidate of candidates) {
17687
- if (existsSync13(candidate)) {
17693
+ if (existsSync12(candidate)) {
17688
17694
  return candidate;
17689
17695
  }
17690
17696
  }
@@ -17732,10 +17738,10 @@ function buildCommandHelp2(spec) {
17732
17738
  `);
17733
17739
  }
17734
17740
  async function loadStripeApiModule() {
17735
- return await import(pathToFileURL2(join14(CONNECTOR_DIR2, "src", "api", "index.ts")).href);
17741
+ return await import(pathToFileURL2(join13(CONNECTOR_DIR2, "src", "api", "index.ts")).href);
17736
17742
  }
17737
17743
  async function loadStripeConfigModule() {
17738
- return await import(pathToFileURL2(join14(CONNECTOR_DIR2, "src", "utils", "config.ts")).href);
17744
+ return await import(pathToFileURL2(join13(CONNECTOR_DIR2, "src", "utils", "config.ts")).href);
17739
17745
  }
17740
17746
  function extractGlobalArgs3(args) {
17741
17747
  const remaining = [];
@@ -18581,30 +18587,30 @@ __export(exports_installer, {
18581
18587
  getConnectorDocs: () => getConnectorDocs,
18582
18588
  connectorExists: () => connectorExists
18583
18589
  });
18584
- import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync7, writeFileSync as writeFileSync6, readdirSync as readdirSync9, statSync as statSync4, rmSync as rmSync2 } from "fs";
18585
- import { join as join16, dirname as dirname6 } from "path";
18590
+ import { existsSync as existsSync14, mkdirSync as mkdirSync9, readFileSync as readFileSync7, writeFileSync as writeFileSync6, readdirSync as readdirSync9, statSync as statSync4, rmSync as rmSync2 } from "fs";
18591
+ import { join as join15, dirname as dirname6 } from "path";
18586
18592
  import { fileURLToPath as fileURLToPath4 } from "url";
18587
18593
  function resolveConnectorsDir() {
18588
- const fromBin = join16(__dirname4, "..", "connectors");
18589
- if (existsSync15(fromBin))
18594
+ const fromBin = join15(__dirname4, "..", "connectors");
18595
+ if (existsSync14(fromBin))
18590
18596
  return fromBin;
18591
- const fromSrc = join16(__dirname4, "..", "..", "connectors");
18592
- if (existsSync15(fromSrc))
18597
+ const fromSrc = join15(__dirname4, "..", "..", "connectors");
18598
+ if (existsSync14(fromSrc))
18593
18599
  return fromSrc;
18594
18600
  return fromBin;
18595
18601
  }
18596
18602
  function getProjectConnectorsDir(targetDir) {
18597
- return join16(targetDir, PROJECT_CONNECTORS_DIRNAME);
18603
+ return join15(targetDir, PROJECT_CONNECTORS_DIRNAME);
18598
18604
  }
18599
18605
  function getEnablementManifestPath(targetDir) {
18600
- return join16(getProjectConnectorsDir(targetDir), ENABLEMENT_MANIFEST_FILENAME);
18606
+ return join15(getProjectConnectorsDir(targetDir), ENABLEMENT_MANIFEST_FILENAME);
18601
18607
  }
18602
18608
  function getLegacyInstallPath(targetDir, name) {
18603
- return join16(getProjectConnectorsDir(targetDir), legacyConnectorName(name));
18609
+ return join15(getProjectConnectorsDir(targetDir), legacyConnectorName(name));
18604
18610
  }
18605
18611
  function loadEnablementManifest(targetDir) {
18606
18612
  const manifestPath = getEnablementManifestPath(targetDir);
18607
- if (!existsSync15(manifestPath)) {
18613
+ if (!existsSync14(manifestPath)) {
18608
18614
  return null;
18609
18615
  }
18610
18616
  try {
@@ -18624,11 +18630,11 @@ function loadEnablementManifest(targetDir) {
18624
18630
  }
18625
18631
  function getLegacyInstalledConnectors(targetDir) {
18626
18632
  const connectorsDir = getProjectConnectorsDir(targetDir);
18627
- if (!existsSync15(connectorsDir)) {
18633
+ if (!existsSync14(connectorsDir)) {
18628
18634
  return [];
18629
18635
  }
18630
18636
  return readdirSync9(connectorsDir).filter((entry) => {
18631
- const fullPath = join16(connectorsDir, entry);
18637
+ const fullPath = join15(connectorsDir, entry);
18632
18638
  return entry.startsWith("connect-") && statSync4(fullPath).isDirectory();
18633
18639
  }).map((entry) => entry.replace("connect-", "")).sort();
18634
18640
  }
@@ -18637,7 +18643,7 @@ function getEnabledConnectors(targetDir) {
18637
18643
  return [...new Set([...manifestConnectors, ...getLegacyInstalledConnectors(targetDir)])].sort();
18638
18644
  }
18639
18645
  function updateConnectorsIndex(connectorsDir, connectors18) {
18640
- const indexPath = join16(connectorsDir, ENABLEMENT_INDEX_FILENAME);
18646
+ const indexPath = join15(connectorsDir, ENABLEMENT_INDEX_FILENAME);
18641
18647
  const connectorList = connectors18.map((connector) => ` "${connector}",`).join(`
18642
18648
  `);
18643
18649
  const content = `/**
@@ -18673,7 +18679,7 @@ function getConnectorPath(name) {
18673
18679
  }
18674
18680
  function connectorExists(name) {
18675
18681
  const normalizedName = normalizeConnectorName(name);
18676
- return hasInternalConnectorDefinition(normalizedName) || existsSync15(getConnectorPath(normalizedName));
18682
+ return hasInternalConnectorDefinition(normalizedName) || existsSync14(getConnectorPath(normalizedName));
18677
18683
  }
18678
18684
  function installConnector(name, options = {}) {
18679
18685
  const { targetDir = process.cwd(), overwrite = false } = options;
@@ -18706,7 +18712,7 @@ function installConnector(name, options = {}) {
18706
18712
  try {
18707
18713
  const nextEnabled = [...new Set([...installed, normalizedName])].sort();
18708
18714
  writeEnablementManifest(targetDir, nextEnabled);
18709
- if (overwrite && existsSync15(legacyInstallPath)) {
18715
+ if (overwrite && existsSync14(legacyInstallPath)) {
18710
18716
  rmSync2(legacyInstallPath, { recursive: true });
18711
18717
  }
18712
18718
  return {
@@ -18741,8 +18747,8 @@ function parseConnectorDocs(raw) {
18741
18747
  function getConnectorDocs(name) {
18742
18748
  const normalizedName = normalizeConnectorName(name);
18743
18749
  const connectorPath = getConnectorPath(normalizedName);
18744
- const claudeMdPath = join16(connectorPath, "CLAUDE.md");
18745
- if (existsSync15(claudeMdPath)) {
18750
+ const claudeMdPath = join15(connectorPath, "CLAUDE.md");
18751
+ if (existsSync14(claudeMdPath)) {
18746
18752
  return parseConnectorDocs(readFileSync7(claudeMdPath, "utf-8"));
18747
18753
  }
18748
18754
  const internalDocs = getInternalConnectorDefinition(normalizedName)?.docsMarkdown;
@@ -18787,7 +18793,7 @@ function removeConnector(name, targetDir = process.cwd()) {
18787
18793
  const nextEnabled = installed.filter((connector) => connector !== normalizedName);
18788
18794
  writeEnablementManifest(targetDir, nextEnabled);
18789
18795
  const legacyInstallPath = getLegacyInstallPath(targetDir, normalizedName);
18790
- if (existsSync15(legacyInstallPath)) {
18796
+ if (existsSync14(legacyInstallPath)) {
18791
18797
  rmSync2(legacyInstallPath, { recursive: true });
18792
18798
  }
18793
18799
  return true;
@@ -18801,7 +18807,7 @@ var init_installer = __esm(() => {
18801
18807
  });
18802
18808
 
18803
18809
  // src/lib/lock.ts
18804
- import { openSync, closeSync, unlinkSync, existsSync as existsSync16, statSync as statSync5 } from "fs";
18810
+ import { openSync, closeSync, unlinkSync, existsSync as existsSync15, statSync as statSync5 } from "fs";
18805
18811
  import { mkdirSync as mkdirSync10 } from "fs";
18806
18812
  function lockPath(connector) {
18807
18813
  const dir = getConnectorConfigDir(connector);
@@ -18817,7 +18823,7 @@ function isStale(path) {
18817
18823
  }
18818
18824
  }
18819
18825
  function tryAcquire(path) {
18820
- if (existsSync16(path) && isStale(path)) {
18826
+ if (existsSync15(path) && isStale(path)) {
18821
18827
  try {
18822
18828
  unlinkSync(path);
18823
18829
  } catch {}
@@ -18867,9 +18873,9 @@ var init_lock = __esm(() => {
18867
18873
  });
18868
18874
 
18869
18875
  // src/server/auth.ts
18870
- import { existsSync as existsSync17, readFileSync as readFileSync8, writeFileSync as writeFileSync7, mkdirSync as mkdirSync11, readdirSync as readdirSync10, rmSync as rmSync3, statSync as statSync6 } from "fs";
18876
+ import { existsSync as existsSync16, readFileSync as readFileSync8, writeFileSync as writeFileSync7, mkdirSync as mkdirSync11, readdirSync as readdirSync10, rmSync as rmSync3, statSync as statSync6 } from "fs";
18871
18877
  import { randomBytes } from "crypto";
18872
- import { join as join17 } from "path";
18878
+ import { join as join16 } from "path";
18873
18879
  function getAuthType(name) {
18874
18880
  name = normalizeConnectorName(name);
18875
18881
  const docs = getConnectorDocs(name);
@@ -18893,8 +18899,8 @@ function getConnectorConfigReadDirs2(name) {
18893
18899
  function getCurrentProfile2(name) {
18894
18900
  name = normalizeConnectorName(name);
18895
18901
  for (const configDir of getConnectorConfigReadDirs2(name)) {
18896
- const currentProfileFile = join17(configDir, "current_profile");
18897
- if (existsSync17(currentProfileFile)) {
18902
+ const currentProfileFile = join16(configDir, "current_profile");
18903
+ if (existsSync16(currentProfileFile)) {
18898
18904
  try {
18899
18905
  return readFileSync8(currentProfileFile, "utf-8").trim() || "default";
18900
18906
  } catch {
@@ -18907,14 +18913,14 @@ function getCurrentProfile2(name) {
18907
18913
  function loadProfileConfigFromDir(configDir, profile) {
18908
18914
  let flatConfig = {};
18909
18915
  let dirConfig = {};
18910
- const profileFile = join17(configDir, "profiles", `${profile}.json`);
18911
- if (existsSync17(profileFile)) {
18916
+ const profileFile = join16(configDir, "profiles", `${profile}.json`);
18917
+ if (existsSync16(profileFile)) {
18912
18918
  try {
18913
18919
  flatConfig = JSON.parse(readFileSync8(profileFile, "utf-8"));
18914
18920
  } catch {}
18915
18921
  }
18916
- const profileDirConfig = join17(configDir, "profiles", profile, "config.json");
18917
- if (existsSync17(profileDirConfig)) {
18922
+ const profileDirConfig = join16(configDir, "profiles", profile, "config.json");
18923
+ if (existsSync16(profileDirConfig)) {
18918
18924
  try {
18919
18925
  dirConfig = JSON.parse(readFileSync8(profileDirConfig, "utf-8"));
18920
18926
  } catch {}
@@ -18934,8 +18940,8 @@ function loadTokens3(name) {
18934
18940
  name = normalizeConnectorName(name);
18935
18941
  const profile = getCurrentProfile2(name);
18936
18942
  for (const configDir of getConnectorConfigReadDirs2(name)) {
18937
- const tokensFile = join17(configDir, "profiles", profile, "tokens.json");
18938
- if (existsSync17(tokensFile)) {
18943
+ const tokensFile = join16(configDir, "profiles", profile, "tokens.json");
18944
+ if (existsSync16(tokensFile)) {
18939
18945
  try {
18940
18946
  return JSON.parse(readFileSync8(tokensFile, "utf-8"));
18941
18947
  } catch {
@@ -19030,10 +19036,10 @@ function _saveApiKey(name, key, field) {
19030
19036
  const profile = getCurrentProfile2(name);
19031
19037
  const keyField = field || guessKeyField(name);
19032
19038
  if (keyField === "clientId" || keyField === "clientSecret") {
19033
- const credentialsFile = join17(configDir, "credentials.json");
19039
+ const credentialsFile = join16(configDir, "credentials.json");
19034
19040
  mkdirSync11(configDir, { recursive: true });
19035
19041
  let creds = {};
19036
- if (existsSync17(credentialsFile)) {
19042
+ if (existsSync16(credentialsFile)) {
19037
19043
  try {
19038
19044
  creds = JSON.parse(readFileSync8(credentialsFile, "utf-8"));
19039
19045
  } catch {}
@@ -19042,9 +19048,9 @@ function _saveApiKey(name, key, field) {
19042
19048
  writeFileSync7(credentialsFile, JSON.stringify(creds, null, 2));
19043
19049
  return;
19044
19050
  }
19045
- const profileFile = join17(configDir, "profiles", `${profile}.json`);
19046
- const profileDir = join17(configDir, "profiles", profile);
19047
- if (existsSync17(profileFile)) {
19051
+ const profileFile = join16(configDir, "profiles", `${profile}.json`);
19052
+ const profileDir = join16(configDir, "profiles", profile);
19053
+ if (existsSync16(profileFile)) {
19048
19054
  let config = {};
19049
19055
  try {
19050
19056
  config = JSON.parse(readFileSync8(profileFile, "utf-8"));
@@ -19053,10 +19059,10 @@ function _saveApiKey(name, key, field) {
19053
19059
  writeFileSync7(profileFile, JSON.stringify(config, null, 2));
19054
19060
  return;
19055
19061
  }
19056
- if (existsSync17(profileDir)) {
19057
- const configFile = join17(profileDir, "config.json");
19062
+ if (existsSync16(profileDir)) {
19063
+ const configFile = join16(profileDir, "config.json");
19058
19064
  let config = {};
19059
- if (existsSync17(configFile)) {
19065
+ if (existsSync16(configFile)) {
19060
19066
  try {
19061
19067
  config = JSON.parse(readFileSync8(configFile, "utf-8"));
19062
19068
  } catch {}
@@ -19066,7 +19072,7 @@ function _saveApiKey(name, key, field) {
19066
19072
  return;
19067
19073
  }
19068
19074
  mkdirSync11(profileDir, { recursive: true });
19069
- writeFileSync7(join17(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
19075
+ writeFileSync7(join16(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
19070
19076
  }
19071
19077
  function guessKeyField(name) {
19072
19078
  name = normalizeConnectorName(name);
@@ -19086,8 +19092,8 @@ function guessKeyField(name) {
19086
19092
  function getOAuthConfig(name) {
19087
19093
  name = normalizeConnectorName(name);
19088
19094
  for (const configDir of getConnectorConfigReadDirs2(name)) {
19089
- const credentialsFile = join17(configDir, "credentials.json");
19090
- if (existsSync17(credentialsFile)) {
19095
+ const credentialsFile = join16(configDir, "credentials.json");
19096
+ if (existsSync16(credentialsFile)) {
19091
19097
  try {
19092
19098
  const creds = JSON.parse(readFileSync8(credentialsFile, "utf-8"));
19093
19099
  return { clientId: creds.clientId, clientSecret: creds.clientSecret };
@@ -19173,9 +19179,9 @@ function saveOAuthTokens(name, tokens) {
19173
19179
  name = normalizeConnectorName(name);
19174
19180
  const configDir = getConnectorConfigDir2(name);
19175
19181
  const profile = getCurrentProfile2(name);
19176
- const profileDir = join17(configDir, "profiles", profile);
19182
+ const profileDir = join16(configDir, "profiles", profile);
19177
19183
  mkdirSync11(profileDir, { recursive: true });
19178
- const tokensFile = join17(profileDir, "tokens.json");
19184
+ const tokensFile = join16(profileDir, "tokens.json");
19179
19185
  writeFileSync7(tokensFile, JSON.stringify(tokens, null, 2), { mode: 384 });
19180
19186
  }
19181
19187
  async function refreshOAuthToken(name) {
@@ -19222,13 +19228,13 @@ function listProfiles4(name) {
19222
19228
  name = normalizeConnectorName(name);
19223
19229
  const seen = new Set;
19224
19230
  for (const configDir of getConnectorConfigReadDirs2(name)) {
19225
- const profilesDir = join17(configDir, "profiles");
19226
- if (!existsSync17(profilesDir))
19231
+ const profilesDir = join16(configDir, "profiles");
19232
+ if (!existsSync16(profilesDir))
19227
19233
  continue;
19228
19234
  try {
19229
19235
  const entries = readdirSync10(profilesDir);
19230
19236
  for (const entry of entries) {
19231
- const fullPath = join17(profilesDir, entry);
19237
+ const fullPath = join16(profilesDir, entry);
19232
19238
  const stat = statSync6(fullPath);
19233
19239
  if (stat.isDirectory()) {
19234
19240
  seen.add(entry);
@@ -19245,24 +19251,24 @@ function switchProfile(name, profile) {
19245
19251
  name = normalizeConnectorName(name);
19246
19252
  const configDir = getConnectorConfigDir2(name);
19247
19253
  mkdirSync11(configDir, { recursive: true });
19248
- writeFileSync7(join17(configDir, "current_profile"), profile);
19254
+ writeFileSync7(join16(configDir, "current_profile"), profile);
19249
19255
  }
19250
19256
  function deleteProfile2(name, profile) {
19251
19257
  name = normalizeConnectorName(name);
19252
19258
  if (profile === "default")
19253
19259
  return false;
19254
19260
  const configDir = getConnectorConfigDir2(name);
19255
- const profilesDir = join17(configDir, "profiles");
19256
- const profileFile = join17(profilesDir, `${profile}.json`);
19257
- if (existsSync17(profileFile)) {
19261
+ const profilesDir = join16(configDir, "profiles");
19262
+ const profileFile = join16(profilesDir, `${profile}.json`);
19263
+ if (existsSync16(profileFile)) {
19258
19264
  rmSync3(profileFile);
19259
19265
  if (getCurrentProfile2(name) === profile) {
19260
19266
  switchProfile(name, "default");
19261
19267
  }
19262
19268
  return true;
19263
19269
  }
19264
- const profileDir = join17(profilesDir, profile);
19265
- if (existsSync17(profileDir)) {
19270
+ const profileDir = join16(profilesDir, profile);
19271
+ if (existsSync16(profileDir)) {
19266
19272
  rmSync3(profileDir, { recursive: true });
19267
19273
  if (getCurrentProfile2(name) === profile) {
19268
19274
  switchProfile(name, "default");
@@ -19331,16 +19337,16 @@ __export(exports_runner, {
19331
19337
  buildEnvWithCredentials: () => buildEnvWithCredentials,
19332
19338
  buildConnectorOperationArgs: () => buildConnectorOperationArgs
19333
19339
  });
19334
- import { existsSync as existsSync18, readdirSync as readdirSync11 } from "fs";
19335
- import { join as join18, dirname as dirname7 } from "path";
19340
+ import { existsSync as existsSync17, readdirSync as readdirSync11 } from "fs";
19341
+ import { join as join17, dirname as dirname7 } from "path";
19336
19342
  import { fileURLToPath as fileURLToPath5 } from "url";
19337
19343
  import { spawn as spawn2 } from "child_process";
19338
19344
  function resolveConnectorsDir2() {
19339
- const fromBin = join18(__dirname5, "..", "connectors");
19340
- if (existsSync18(fromBin))
19345
+ const fromBin = join17(__dirname5, "..", "connectors");
19346
+ if (existsSync17(fromBin))
19341
19347
  return fromBin;
19342
- const fromSrc = join18(__dirname5, "..", "..", "connectors");
19343
- if (existsSync18(fromSrc))
19348
+ const fromSrc = join17(__dirname5, "..", "..", "connectors");
19349
+ if (existsSync17(fromSrc))
19344
19350
  return fromSrc;
19345
19351
  return fromBin;
19346
19352
  }
@@ -19408,8 +19414,8 @@ function buildEnvWithCredentials(connectorName, baseEnv) {
19408
19414
  function getConnectorCliPath(name) {
19409
19415
  const safeName = normalizeConnectorName(name).replace(/[^a-z0-9-]/g, "");
19410
19416
  const connectorDir = getConnectorPackagePath(CONNECTORS_DIR2, safeName);
19411
- const cliPath = join18(connectorDir, "src", "cli", "index.ts");
19412
- if (existsSync18(cliPath))
19417
+ const cliPath = join17(connectorDir, "src", "cli", "index.ts");
19418
+ if (existsSync17(cliPath))
19413
19419
  return cliPath;
19414
19420
  return null;
19415
19421
  }
@@ -22725,9 +22731,6 @@ var require_data = __commonJS((exports, module) => {
22725
22731
  var require_utils3 = __commonJS((exports, module) => {
22726
22732
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
22727
22733
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
22728
- var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
22729
- var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
22730
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
22731
22734
  function stringArrayToHexStripped(input) {
22732
22735
  let acc = "";
22733
22736
  let code = 0;
@@ -22921,77 +22924,27 @@ var require_utils3 = __commonJS((exports, module) => {
22921
22924
  }
22922
22925
  return output.join("");
22923
22926
  }
22924
- var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
22925
- var HOST_DELIM_RE = /[@/?#:]/g;
22926
- var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
22927
- function reescapeHostDelimiters(host, isIP) {
22928
- const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
22929
- re.lastIndex = 0;
22930
- return host.replace(re, (ch) => HOST_DELIMS[ch]);
22931
- }
22932
- function normalizePercentEncoding(input, decodeUnreserved = false) {
22933
- if (input.indexOf("%") === -1) {
22934
- return input;
22927
+ function normalizeComponentEncoding(component, esc2) {
22928
+ const func = esc2 !== true ? escape : unescape;
22929
+ if (component.scheme !== undefined) {
22930
+ component.scheme = func(component.scheme);
22935
22931
  }
22936
- let output = "";
22937
- for (let i = 0;i < input.length; i++) {
22938
- if (input[i] === "%" && i + 2 < input.length) {
22939
- const hex = input.slice(i + 1, i + 3);
22940
- if (isHexPair(hex)) {
22941
- const normalizedHex = hex.toUpperCase();
22942
- const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
22943
- if (decodeUnreserved && isUnreserved(decoded)) {
22944
- output += decoded;
22945
- } else {
22946
- output += "%" + normalizedHex;
22947
- }
22948
- i += 2;
22949
- continue;
22950
- }
22951
- }
22952
- output += input[i];
22932
+ if (component.userinfo !== undefined) {
22933
+ component.userinfo = func(component.userinfo);
22953
22934
  }
22954
- return output;
22955
- }
22956
- function normalizePathEncoding(input) {
22957
- let output = "";
22958
- for (let i = 0;i < input.length; i++) {
22959
- if (input[i] === "%" && i + 2 < input.length) {
22960
- const hex = input.slice(i + 1, i + 3);
22961
- if (isHexPair(hex)) {
22962
- const normalizedHex = hex.toUpperCase();
22963
- const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
22964
- if (decoded !== "." && isUnreserved(decoded)) {
22965
- output += decoded;
22966
- } else {
22967
- output += "%" + normalizedHex;
22968
- }
22969
- i += 2;
22970
- continue;
22971
- }
22972
- }
22973
- if (isPathCharacter(input[i])) {
22974
- output += input[i];
22975
- } else {
22976
- output += escape(input[i]);
22977
- }
22935
+ if (component.host !== undefined) {
22936
+ component.host = func(component.host);
22978
22937
  }
22979
- return output;
22980
- }
22981
- function escapePreservingEscapes(input) {
22982
- let output = "";
22983
- for (let i = 0;i < input.length; i++) {
22984
- if (input[i] === "%" && i + 2 < input.length) {
22985
- const hex = input.slice(i + 1, i + 3);
22986
- if (isHexPair(hex)) {
22987
- output += "%" + hex.toUpperCase();
22988
- i += 2;
22989
- continue;
22990
- }
22991
- }
22992
- output += escape(input[i]);
22938
+ if (component.path !== undefined) {
22939
+ component.path = func(component.path);
22993
22940
  }
22994
- return output;
22941
+ if (component.query !== undefined) {
22942
+ component.query = func(component.query);
22943
+ }
22944
+ if (component.fragment !== undefined) {
22945
+ component.fragment = func(component.fragment);
22946
+ }
22947
+ return component;
22995
22948
  }
22996
22949
  function recomposeAuthority(component) {
22997
22950
  const uriTokens = [];
@@ -23006,7 +22959,7 @@ var require_utils3 = __commonJS((exports, module) => {
23006
22959
  if (ipV6res.isIPV6 === true) {
23007
22960
  host = `[${ipV6res.escapedHost}]`;
23008
22961
  } else {
23009
- host = reescapeHostDelimiters(host, false);
22962
+ host = component.host;
23010
22963
  }
23011
22964
  }
23012
22965
  uriTokens.push(host);
@@ -23020,10 +22973,7 @@ var require_utils3 = __commonJS((exports, module) => {
23020
22973
  module.exports = {
23021
22974
  nonSimpleDomain,
23022
22975
  recomposeAuthority,
23023
- reescapeHostDelimiters,
23024
- normalizePercentEncoding,
23025
- normalizePathEncoding,
23026
- escapePreservingEscapes,
22976
+ normalizeComponentEncoding,
23027
22977
  removeDotSegments,
23028
22978
  isIPv4,
23029
22979
  isUUID,
@@ -23208,11 +23158,11 @@ var require_schemes = __commonJS((exports, module) => {
23208
23158
 
23209
23159
  // node_modules/fast-uri/index.js
23210
23160
  var require_fast_uri = __commonJS((exports, module) => {
23211
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils3();
23161
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils3();
23212
23162
  var { SCHEMES, getSchemeHandler } = require_schemes();
23213
23163
  function normalize(uri, options) {
23214
23164
  if (typeof uri === "string") {
23215
- uri = normalizeString(uri, options);
23165
+ uri = serialize(parse6(uri, options), options);
23216
23166
  } else if (typeof uri === "object") {
23217
23167
  uri = parse6(serialize(uri, options), options);
23218
23168
  }
@@ -23278,9 +23228,19 @@ var require_fast_uri = __commonJS((exports, module) => {
23278
23228
  return target;
23279
23229
  }
23280
23230
  function equal(uriA, uriB, options) {
23281
- const normalizedA = normalizeComparableURI(uriA, options);
23282
- const normalizedB = normalizeComparableURI(uriB, options);
23283
- return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
23231
+ if (typeof uriA === "string") {
23232
+ uriA = unescape(uriA);
23233
+ uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
23234
+ } else if (typeof uriA === "object") {
23235
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
23236
+ }
23237
+ if (typeof uriB === "string") {
23238
+ uriB = unescape(uriB);
23239
+ uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
23240
+ } else if (typeof uriB === "object") {
23241
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
23242
+ }
23243
+ return uriA.toLowerCase() === uriB.toLowerCase();
23284
23244
  }
23285
23245
  function serialize(cmpts, opts) {
23286
23246
  const component = {
@@ -23306,12 +23266,12 @@ var require_fast_uri = __commonJS((exports, module) => {
23306
23266
  schemeHandler.serialize(component, options);
23307
23267
  if (component.path !== undefined) {
23308
23268
  if (!options.skipEscape) {
23309
- component.path = escapePreservingEscapes(component.path);
23269
+ component.path = escape(component.path);
23310
23270
  if (component.scheme !== undefined) {
23311
23271
  component.path = component.path.split("%3A").join(":");
23312
23272
  }
23313
23273
  } else {
23314
- component.path = normalizePercentEncoding(component.path);
23274
+ component.path = unescape(component.path);
23315
23275
  }
23316
23276
  }
23317
23277
  if (options.reference !== "suffix" && component.scheme) {
@@ -23346,16 +23306,7 @@ var require_fast_uri = __commonJS((exports, module) => {
23346
23306
  return uriTokens.join("");
23347
23307
  }
23348
23308
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
23349
- function getParseError(parsed, matches) {
23350
- if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
23351
- return 'URI path must start with "/" when authority is present.';
23352
- }
23353
- if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
23354
- return "URI port is malformed.";
23355
- }
23356
- return;
23357
- }
23358
- function parseWithStatus(uri, opts) {
23309
+ function parse6(uri, opts) {
23359
23310
  const options = Object.assign({}, opts);
23360
23311
  const parsed = {
23361
23312
  scheme: undefined,
@@ -23366,7 +23317,6 @@ var require_fast_uri = __commonJS((exports, module) => {
23366
23317
  query: undefined,
23367
23318
  fragment: undefined
23368
23319
  };
23369
- let malformedAuthorityOrPort = false;
23370
23320
  let isIP = false;
23371
23321
  if (options.reference === "suffix") {
23372
23322
  if (options.scheme) {
@@ -23387,11 +23337,6 @@ var require_fast_uri = __commonJS((exports, module) => {
23387
23337
  if (isNaN(parsed.port)) {
23388
23338
  parsed.port = matches[5];
23389
23339
  }
23390
- const parseError = getParseError(parsed, matches);
23391
- if (parseError !== undefined) {
23392
- parsed.error = parsed.error || parseError;
23393
- malformedAuthorityOrPort = true;
23394
- }
23395
23340
  if (parsed.host) {
23396
23341
  const ipv4result = isIPv4(parsed.host);
23397
23342
  if (ipv4result === false) {
@@ -23430,18 +23375,14 @@ var require_fast_uri = __commonJS((exports, module) => {
23430
23375
  parsed.scheme = unescape(parsed.scheme);
23431
23376
  }
23432
23377
  if (parsed.host !== undefined) {
23433
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
23378
+ parsed.host = unescape(parsed.host);
23434
23379
  }
23435
23380
  }
23436
23381
  if (parsed.path) {
23437
- parsed.path = normalizePathEncoding(parsed.path);
23382
+ parsed.path = escape(unescape(parsed.path));
23438
23383
  }
23439
23384
  if (parsed.fragment) {
23440
- try {
23441
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
23442
- } catch {
23443
- parsed.error = parsed.error || "URI malformed";
23444
- }
23385
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
23445
23386
  }
23446
23387
  }
23447
23388
  if (schemeHandler && schemeHandler.parse) {
@@ -23450,29 +23391,7 @@ var require_fast_uri = __commonJS((exports, module) => {
23450
23391
  } else {
23451
23392
  parsed.error = parsed.error || "URI can not be parsed.";
23452
23393
  }
23453
- return { parsed, malformedAuthorityOrPort };
23454
- }
23455
- function parse6(uri, opts) {
23456
- return parseWithStatus(uri, opts).parsed;
23457
- }
23458
- function normalizeString(uri, opts) {
23459
- return normalizeStringWithStatus(uri, opts).normalized;
23460
- }
23461
- function normalizeStringWithStatus(uri, opts) {
23462
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
23463
- return {
23464
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
23465
- malformedAuthorityOrPort
23466
- };
23467
- }
23468
- function normalizeComparableURI(uri, opts) {
23469
- if (typeof uri === "string") {
23470
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
23471
- return malformedAuthorityOrPort ? undefined : normalized;
23472
- }
23473
- if (typeof uri === "object") {
23474
- return serialize(uri, opts);
23475
- }
23394
+ return parsed;
23476
23395
  }
23477
23396
  var fastUri = {
23478
23397
  SCHEMES,
@@ -23607,7 +23526,7 @@ var require_core = __commonJS((exports) => {
23607
23526
  constructor(opts = {}) {
23608
23527
  this.schemas = {};
23609
23528
  this.refs = {};
23610
- this.formats = Object.create(null);
23529
+ this.formats = {};
23611
23530
  this._compilations = new Set;
23612
23531
  this._loading = {};
23613
23532
  this._cache = new Map;
@@ -26348,7 +26267,7 @@ var init_usage = __esm(() => {
26348
26267
  });
26349
26268
 
26350
26269
  // src/server/serve.ts
26351
- import { existsSync as existsSync20, readdirSync as readdirSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync8, mkdirSync as mkdirSync12 } from "fs";
26270
+ import { existsSync as existsSync19, readdirSync as readdirSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync8, mkdirSync as mkdirSync12 } from "fs";
26352
26271
 
26353
26272
  // src/db/agents.ts
26354
26273
  init_database();
@@ -26589,13 +26508,13 @@ async function runWorkflow(workflow) {
26589
26508
 
26590
26509
  // src/server/serve.ts
26591
26510
  init_database();
26592
- import { join as join20, dirname as dirname8, extname, basename as basename3 } from "path";
26511
+ import { join as join19, dirname as dirname8, extname, basename as basename3 } from "path";
26593
26512
  import { fileURLToPath as fileURLToPath6 } from "url";
26594
26513
 
26595
26514
  // src/lib/registry.ts
26596
26515
  init_builtins();
26597
- import { existsSync as existsSync14, readFileSync as readFileSync6 } from "fs";
26598
- import { join as join15, dirname as dirname5 } from "path";
26516
+ import { existsSync as existsSync13, readFileSync as readFileSync6 } from "fs";
26517
+ import { join as join14, dirname as dirname5 } from "path";
26599
26518
  import { fileURLToPath as fileURLToPath3 } from "url";
26600
26519
 
26601
26520
  // src/lib/fuzzy.ts
@@ -32640,6 +32559,13 @@ var connectors17 = [
32640
32559
  category: "Social Media",
32641
32560
  tags: ["social", "fediverse", "decentralized"]
32642
32561
  },
32562
+ {
32563
+ name: "bluesky",
32564
+ displayName: "Bluesky",
32565
+ description: "AT Protocol social network - posts, threads, mentions",
32566
+ category: "Social Media",
32567
+ tags: ["social", "atproto", "decentralized"]
32568
+ },
32643
32569
  {
32644
32570
  name: "brandblast",
32645
32571
  displayName: "BrandBlast",
@@ -32872,16 +32798,16 @@ function loadConnectorVersions() {
32872
32798
  versionsLoaded = true;
32873
32799
  const thisDir = dirname5(fileURLToPath3(import.meta.url));
32874
32800
  const candidates = [
32875
- join15(thisDir, "..", "connectors"),
32876
- join15(thisDir, "..", "..", "connectors")
32801
+ join14(thisDir, "..", "connectors"),
32802
+ join14(thisDir, "..", "..", "connectors")
32877
32803
  ];
32878
- const connectorsDir = candidates.find((d) => existsSync14(d));
32804
+ const connectorsDir = candidates.find((d) => existsSync13(d));
32879
32805
  if (!connectorsDir)
32880
32806
  return;
32881
32807
  for (const connector of CONNECTORS) {
32882
32808
  try {
32883
- const pkgPath = join15(getConnectorPackagePath(connectorsDir, connector.name), "package.json");
32884
- if (existsSync14(pkgPath)) {
32809
+ const pkgPath = join14(getConnectorPackagePath(connectorsDir, connector.name), "package.json");
32810
+ if (existsSync13(pkgPath)) {
32885
32811
  const pkg = JSON.parse(readFileSync6(pkgPath, "utf-8"));
32886
32812
  connector.version = pkg.version || "0.0.0";
32887
32813
  continue;
@@ -37439,7 +37365,7 @@ var AssertObjectSchema = custom3((v) => v !== null && (typeof v === "object" ||
37439
37365
  var ProgressTokenSchema = union([string2(), number2().int()]);
37440
37366
  var CursorSchema = string2();
37441
37367
  var TaskCreationParamsSchema = looseObject({
37442
- ttl: number2().optional(),
37368
+ ttl: union([number2(), _null3()]).optional(),
37443
37369
  pollInterval: number2().optional()
37444
37370
  });
37445
37371
  var TaskMetadataSchema = object({
@@ -37593,8 +37519,7 @@ var ClientCapabilitiesSchema = object({
37593
37519
  roots: object({
37594
37520
  listChanged: boolean2().optional()
37595
37521
  }).optional(),
37596
- tasks: ClientTasksCapabilitySchema.optional(),
37597
- extensions: record(string2(), AssertObjectSchema).optional()
37522
+ tasks: ClientTasksCapabilitySchema.optional()
37598
37523
  });
37599
37524
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
37600
37525
  protocolVersion: string2(),
@@ -37620,8 +37545,7 @@ var ServerCapabilitiesSchema = object({
37620
37545
  tools: object({
37621
37546
  listChanged: boolean2().optional()
37622
37547
  }).optional(),
37623
- tasks: ServerTasksCapabilitySchema.optional(),
37624
- extensions: record(string2(), AssertObjectSchema).optional()
37548
+ tasks: ServerTasksCapabilitySchema.optional()
37625
37549
  });
37626
37550
  var InitializeResultSchema = ResultSchema.extend({
37627
37551
  protocolVersion: string2(),
@@ -37736,7 +37660,6 @@ var ResourceSchema = object({
37736
37660
  uri: string2(),
37737
37661
  description: optional(string2()),
37738
37662
  mimeType: optional(string2()),
37739
- size: optional(number2()),
37740
37663
  annotations: AnnotationsSchema.optional(),
37741
37664
  _meta: optional(looseObject({}))
37742
37665
  });
@@ -42704,8 +42627,8 @@ init_zod2();
42704
42627
  init_auth();
42705
42628
  init_database();
42706
42629
  init_connector_resolver();
42707
- import { existsSync as existsSync19, readFileSync as readFileSync9 } from "fs";
42708
- import { join as join19 } from "path";
42630
+ import { existsSync as existsSync18, readFileSync as readFileSync9 } from "fs";
42631
+ import { join as join18 } from "path";
42709
42632
  import { spawn as spawn3 } from "child_process";
42710
42633
  function registerAuthTools(server, stripped) {
42711
42634
  server.registerTool("connector_auth_status", {
@@ -42841,7 +42764,7 @@ function registerAuthTools(server, stripped) {
42841
42764
  const oauthUrl = `http://localhost:${serverPort}/oauth/${name}/start`;
42842
42765
  if (noBrowser) {
42843
42766
  const connectorsHome = getConnectorsHome();
42844
- const tokenPaths = getConnectorConfigReadDirs(name, connectorsHome).map((dir) => join19(dir, "profiles", "default", "tokens.json"));
42767
+ const tokenPaths = getConnectorConfigReadDirs(name, connectorsHome).map((dir) => join18(dir, "profiles", "default", "tokens.json"));
42845
42768
  let serverRunning = false;
42846
42769
  try {
42847
42770
  await fetch(`http://localhost:${serverPort}/api/connectors`);
@@ -42860,7 +42783,7 @@ function registerAuthTools(server, stripped) {
42860
42783
  const maxAttempts = 120;
42861
42784
  while (attempts < maxAttempts) {
42862
42785
  await new Promise((resolve) => setTimeout(resolve, 500));
42863
- if (tokenPaths.some((tokensPath) => existsSync19(tokensPath))) {
42786
+ if (tokenPaths.some((tokensPath) => existsSync18(tokensPath))) {
42864
42787
  break;
42865
42788
  }
42866
42789
  attempts++;
@@ -42879,7 +42802,7 @@ function registerAuthTools(server, stripped) {
42879
42802
  };
42880
42803
  }
42881
42804
  try {
42882
- const tokensPath = tokenPaths.find((path) => existsSync19(path)) ?? tokenPaths[0];
42805
+ const tokensPath = tokenPaths.find((path) => existsSync18(path)) ?? tokenPaths[0];
42883
42806
  const tokenData = JSON.parse(readFileSync9(tokensPath, "utf-8"));
42884
42807
  return {
42885
42808
  content: [{
@@ -43402,20 +43325,20 @@ function resolveDashboardDir() {
43402
43325
  const candidates = [];
43403
43326
  try {
43404
43327
  const scriptDir = dirname8(fileURLToPath6(import.meta.url));
43405
- candidates.push(join20(scriptDir, "..", "dashboard", "dist"));
43406
- candidates.push(join20(scriptDir, "..", "..", "dashboard", "dist"));
43328
+ candidates.push(join19(scriptDir, "..", "dashboard", "dist"));
43329
+ candidates.push(join19(scriptDir, "..", "..", "dashboard", "dist"));
43407
43330
  } catch {}
43408
43331
  if (process.argv[1]) {
43409
43332
  const mainDir = dirname8(process.argv[1]);
43410
- candidates.push(join20(mainDir, "..", "dashboard", "dist"));
43411
- candidates.push(join20(mainDir, "..", "..", "dashboard", "dist"));
43333
+ candidates.push(join19(mainDir, "..", "dashboard", "dist"));
43334
+ candidates.push(join19(mainDir, "..", "..", "dashboard", "dist"));
43412
43335
  }
43413
- candidates.push(join20(process.cwd(), "dashboard", "dist"));
43336
+ candidates.push(join19(process.cwd(), "dashboard", "dist"));
43414
43337
  for (const candidate of candidates) {
43415
- if (existsSync20(candidate))
43338
+ if (existsSync19(candidate))
43416
43339
  return candidate;
43417
43340
  }
43418
- return join20(process.cwd(), "dashboard", "dist");
43341
+ return join19(process.cwd(), "dashboard", "dist");
43419
43342
  }
43420
43343
  var MIME_TYPES = {
43421
43344
  ".html": "text/html; charset=utf-8",
@@ -43514,7 +43437,7 @@ function oauthPage(type, title, message, hint, extra) {
43514
43437
  </body></html>`;
43515
43438
  }
43516
43439
  function serveStaticFile(filePath) {
43517
- if (!existsSync20(filePath))
43440
+ if (!existsSync19(filePath))
43518
43441
  return null;
43519
43442
  const ext = extname(filePath);
43520
43443
  const contentType = MIME_TYPES[ext] || "application/octet-stream";
@@ -43551,7 +43474,7 @@ async function startServer(requestedPort, options) {
43551
43474
  const strict = options?.strict ?? false;
43552
43475
  loadConnectorVersions();
43553
43476
  const dashboardDir = resolveDashboardDir();
43554
- const dashboardExists = existsSync20(dashboardDir);
43477
+ const dashboardExists = existsSync19(dashboardDir);
43555
43478
  if (!dashboardExists) {
43556
43479
  console.error(`
43557
43480
  Dashboard not found at: ${dashboardDir}`);
@@ -43982,8 +43905,8 @@ ${result.stderr}`;
43982
43905
  const profiles = listProfiles4(name);
43983
43906
  let current = "default";
43984
43907
  for (const configDir of getConnectorConfigReadDirs(name)) {
43985
- const currentProfileFile = join20(configDir, "current_profile");
43986
- if (existsSync20(currentProfileFile)) {
43908
+ const currentProfileFile = join19(configDir, "current_profile");
43909
+ if (existsSync19(currentProfileFile)) {
43987
43910
  try {
43988
43911
  current = readFileSync10(currentProfileFile, "utf-8").trim() || "default";
43989
43912
  } catch {}
@@ -44036,25 +43959,25 @@ ${result.stderr}`;
44036
43959
  try {
44037
43960
  const connectDir = getConnectorsHome();
44038
43961
  const result = {};
44039
- if (existsSync20(connectDir)) {
43962
+ if (existsSync19(connectDir)) {
44040
43963
  for (const connectorName of listConfiguredConnectorNames(connectDir)) {
44041
43964
  const profiles = {};
44042
43965
  for (const configDir of [...getConnectorConfigReadDirs(connectorName, connectDir)].reverse()) {
44043
- const profilesDir = join20(configDir, "profiles");
44044
- if (!existsSync20(profilesDir))
43966
+ const profilesDir = join19(configDir, "profiles");
43967
+ if (!existsSync19(profilesDir))
44045
43968
  continue;
44046
43969
  const profileEntries = readdirSync12(profilesDir, { withFileTypes: true });
44047
43970
  for (const pEntry of profileEntries) {
44048
43971
  if (pEntry.isFile() && pEntry.name.endsWith(".json")) {
44049
43972
  const profileName = basename3(pEntry.name, ".json");
44050
43973
  try {
44051
- const config2 = JSON.parse(readFileSync10(join20(profilesDir, pEntry.name), "utf-8"));
43974
+ const config2 = JSON.parse(readFileSync10(join19(profilesDir, pEntry.name), "utf-8"));
44052
43975
  profiles[profileName] = config2;
44053
43976
  } catch {}
44054
43977
  }
44055
43978
  if (pEntry.isDirectory()) {
44056
- const configPath = join20(profilesDir, pEntry.name, "config.json");
44057
- if (existsSync20(configPath)) {
43979
+ const configPath = join19(profilesDir, pEntry.name, "config.json");
43980
+ if (existsSync19(configPath)) {
44058
43981
  try {
44059
43982
  const config2 = JSON.parse(readFileSync10(configPath, "utf-8"));
44060
43983
  profiles[pEntry.name] = config2;
@@ -44099,12 +44022,12 @@ ${result.stderr}`;
44099
44022
  if (!data.profiles || typeof data.profiles !== "object")
44100
44023
  continue;
44101
44024
  const connectorDir = getConnectorConfigDir(connectorName, connectDir);
44102
- const profilesDir = join20(connectorDir, "profiles");
44025
+ const profilesDir = join19(connectorDir, "profiles");
44103
44026
  for (const [profileName, config2] of Object.entries(data.profiles)) {
44104
44027
  if (!config2 || typeof config2 !== "object")
44105
44028
  continue;
44106
44029
  mkdirSync12(profilesDir, { recursive: true });
44107
- const profileFile = join20(profilesDir, `${profileName}.json`);
44030
+ const profileFile = join19(profilesDir, `${profileName}.json`);
44108
44031
  writeFileSync8(profileFile, JSON.stringify(config2, null, 2));
44109
44032
  imported++;
44110
44033
  }
@@ -44160,12 +44083,12 @@ ${result.stderr}`;
44160
44083
  }
44161
44084
  if (dashboardExists && (method === "GET" || method === "HEAD")) {
44162
44085
  if (path !== "/") {
44163
- const filePath = join20(dashboardDir, path);
44086
+ const filePath = join19(dashboardDir, path);
44164
44087
  const res2 = serveStaticFile(filePath);
44165
44088
  if (res2)
44166
44089
  return res2;
44167
44090
  }
44168
- const indexPath = join20(dashboardDir, "index.html");
44091
+ const indexPath = join19(dashboardDir, "index.html");
44169
44092
  const res = serveStaticFile(indexPath);
44170
44093
  if (res)
44171
44094
  return res;