@burdenoff/mcp-libs 2026.1031.2 → 2026.1101.1

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 (119) hide show
  1. package/dist/{chunk-FVLIANOQ.js → chunk-LUXDBCVJ.js} +3 -3
  2. package/dist/{chunk-FVLIANOQ.js.map → chunk-LUXDBCVJ.js.map} +1 -1
  3. package/dist/{chunk-76RGHRRS.js → chunk-WYCRYHHY.js} +83 -33
  4. package/dist/chunk-WYCRYHHY.js.map +1 -0
  5. package/dist/core/auth/store.d.ts +1 -0
  6. package/dist/core/gql/client.d.ts +6 -0
  7. package/dist/core/index.cjs +83 -30
  8. package/dist/core/index.cjs.map +1 -1
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.js +1 -1
  11. package/dist/index.cjs +80 -30
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/modules/adaptercloud/index.js +1 -1
  15. package/dist/modules/artistrybase/index.js +1 -1
  16. package/dist/modules/assethandler/index.js +1 -1
  17. package/dist/modules/atheletebridge/index.js +1 -1
  18. package/dist/modules/auth/index.cjs +1 -1
  19. package/dist/modules/auth/index.cjs.map +1 -1
  20. package/dist/modules/auth/index.js +4 -4
  21. package/dist/modules/auth/index.js.map +1 -1
  22. package/dist/modules/auth/operations.d.ts +2 -2
  23. package/dist/modules/billing/index.cjs +45 -19
  24. package/dist/modules/billing/index.cjs.map +1 -1
  25. package/dist/modules/billing/index.js +46 -20
  26. package/dist/modules/billing/index.js.map +1 -1
  27. package/dist/modules/billing/operations.d.ts +4 -4
  28. package/dist/modules/brainyrich/index.js +1 -1
  29. package/dist/modules/buildmyiq/index.js +1 -1
  30. package/dist/modules/channels/index.cjs +0 -35
  31. package/dist/modules/channels/index.cjs.map +1 -1
  32. package/dist/modules/channels/index.js +1 -36
  33. package/dist/modules/channels/index.js.map +1 -1
  34. package/dist/modules/channels/operations.d.ts +0 -1
  35. package/dist/modules/collabkin/index.js +1 -1
  36. package/dist/modules/comradecircle/index.js +1 -1
  37. package/dist/modules/conversations/index.cjs +6 -6
  38. package/dist/modules/conversations/index.cjs.map +1 -1
  39. package/dist/modules/conversations/index.js +7 -7
  40. package/dist/modules/conversations/index.js.map +1 -1
  41. package/dist/modules/conversations/operations.d.ts +1 -1
  42. package/dist/modules/coolandlovely/index.js +1 -1
  43. package/dist/modules/cosmicintersection/index.js +1 -1
  44. package/dist/modules/crewfoundry/index.js +1 -1
  45. package/dist/modules/devportal/index.js +1 -1
  46. package/dist/modules/ecoimpacthub/index.js +1 -1
  47. package/dist/modules/eventfullymanaged/index.js +1 -1
  48. package/dist/modules/export/index.js +1 -1
  49. package/dist/modules/files/index.cjs +421 -101
  50. package/dist/modules/files/index.cjs.map +1 -1
  51. package/dist/modules/files/index.js +412 -97
  52. package/dist/modules/files/index.js.map +1 -1
  53. package/dist/modules/files/operations.d.ts +9 -8
  54. package/dist/modules/files/tools.d.ts +2 -0
  55. package/dist/modules/fluidgrids/index.js +1 -1
  56. package/dist/modules/ggnomad/index.js +1 -1
  57. package/dist/modules/govcitizenhub/index.js +1 -1
  58. package/dist/modules/groups/index.js +1 -1
  59. package/dist/modules/headshotmarketing/index.js +1 -1
  60. package/dist/modules/health/index.js +1 -1
  61. package/dist/modules/healthybowl/index.js +1 -1
  62. package/dist/modules/hookmovies/index.js +1 -1
  63. package/dist/modules/housingvista/index.js +1 -1
  64. package/dist/modules/integrations/index.js +1 -1
  65. package/dist/modules/intelwatchtower/index.js +1 -1
  66. package/dist/modules/kadaikodi/index.js +1 -1
  67. package/dist/modules/labsofscience/index.js +1 -1
  68. package/dist/modules/manufacturedops/index.js +1 -1
  69. package/dist/modules/movethewheels/index.js +1 -1
  70. package/dist/modules/mybodyshield/index.js +1 -1
  71. package/dist/modules/notifications/index.js +1 -1
  72. package/dist/modules/organizations/index.js +1 -1
  73. package/dist/modules/planmagnet/index.js +1 -1
  74. package/dist/modules/products/index.cjs +1 -1
  75. package/dist/modules/products/index.cjs.map +1 -1
  76. package/dist/modules/products/index.js +2 -2
  77. package/dist/modules/products/index.js.map +1 -1
  78. package/dist/modules/products/operations.d.ts +1 -1
  79. package/dist/modules/proserviceworld/index.js +1 -1
  80. package/dist/modules/rbac/index.cjs +0 -64
  81. package/dist/modules/rbac/index.cjs.map +1 -1
  82. package/dist/modules/rbac/index.js +1 -65
  83. package/dist/modules/rbac/index.js.map +1 -1
  84. package/dist/modules/rbac/operations.d.ts +0 -2
  85. package/dist/modules/sandbox/index.js +1 -1
  86. package/dist/modules/scheduler/index.cjs +4 -4
  87. package/dist/modules/scheduler/index.cjs.map +1 -1
  88. package/dist/modules/scheduler/index.js +5 -5
  89. package/dist/modules/scheduler/index.js.map +1 -1
  90. package/dist/modules/scheduler/operations.d.ts +3 -3
  91. package/dist/modules/security/index.js +1 -1
  92. package/dist/modules/semanticfed/index.js +1 -1
  93. package/dist/modules/store/index.js +1 -1
  94. package/dist/modules/subscriberbot/index.js +1 -1
  95. package/dist/modules/support/index.js +1 -1
  96. package/dist/modules/tags/index.cjs +454 -48
  97. package/dist/modules/tags/index.cjs.map +1 -1
  98. package/dist/modules/tags/index.js +443 -42
  99. package/dist/modules/tags/index.js.map +1 -1
  100. package/dist/modules/tags/operations.d.ts +10 -6
  101. package/dist/modules/tags/tools.d.ts +1 -1
  102. package/dist/modules/technospam/index.js +1 -1
  103. package/dist/modules/theculturepost/index.js +1 -1
  104. package/dist/modules/theglobalfuel/index.js +1 -1
  105. package/dist/modules/timecampus/index.js +1 -1
  106. package/dist/modules/tours/index.js +1 -1
  107. package/dist/modules/vibecontrols/index.cjs +8 -8
  108. package/dist/modules/vibecontrols/index.cjs.map +1 -1
  109. package/dist/modules/vibecontrols/index.js +10 -10
  110. package/dist/modules/vibecontrols/index.js.map +1 -1
  111. package/dist/modules/workspaces/index.cjs +235 -5
  112. package/dist/modules/workspaces/index.cjs.map +1 -1
  113. package/dist/modules/workspaces/index.js +224 -6
  114. package/dist/modules/workspaces/index.js.map +1 -1
  115. package/dist/modules/workspaces/operations.d.ts +2 -2
  116. package/dist/modules/workspaces/prompts.d.ts +3 -0
  117. package/dist/modules/workspaces/resources.d.ts +4 -0
  118. package/package.json +1 -1
  119. package/dist/chunk-76RGHRRS.js.map +0 -1
@@ -16,6 +16,31 @@ var fetch__default = /*#__PURE__*/_interopDefault(fetch);
16
16
 
17
17
  // src/core/auth/store.ts
18
18
  var TOKEN_BUFFER_MS = 5 * 60 * 1e3;
19
+ function decodeJwtPayload(token) {
20
+ if (!token) return null;
21
+ const parts = token.split(".");
22
+ if (parts.length !== 3) return null;
23
+ try {
24
+ const payload = JSON.parse(
25
+ Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8")
26
+ );
27
+ return payload && typeof payload === "object" ? payload : null;
28
+ } catch {
29
+ return null;
30
+ }
31
+ }
32
+ function jwtExpiryMs(token) {
33
+ const exp = decodeJwtPayload(token)?.exp;
34
+ return typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : null;
35
+ }
36
+ function accessTokenExpiry(auth) {
37
+ if (!auth) return null;
38
+ return auth.expiresAt ?? jwtExpiryMs(auth.accessToken);
39
+ }
40
+ function workspaceTokenExpiry(auth) {
41
+ if (!auth?.workspaceToken) return auth?.workspaceTokenExpiresAt ?? null;
42
+ return auth.workspaceTokenExpiresAt ?? jwtExpiryMs(auth.workspaceToken);
43
+ }
19
44
  function createAuthStore(configDir, authFileName2 = "auth.json") {
20
45
  const authFile = path.join(configDir, authFileName2);
21
46
  function ensureConfigDir() {
@@ -47,24 +72,24 @@ function createAuthStore(configDir, authFileName2 = "auth.json") {
47
72
  }
48
73
  }
49
74
  function isTokenExpired() {
50
- const auth = read();
51
- if (!auth?.expiresAt) return false;
52
- return Date.now() >= auth.expiresAt;
75
+ const expiresAt = accessTokenExpiry(read());
76
+ if (!expiresAt) return false;
77
+ return Date.now() >= expiresAt;
53
78
  }
54
79
  function isTokenExpiringSoon() {
55
- const auth = read();
56
- if (!auth?.expiresAt) return false;
57
- return Date.now() + TOKEN_BUFFER_MS >= auth.expiresAt;
80
+ const expiresAt = accessTokenExpiry(read());
81
+ if (!expiresAt) return false;
82
+ return Date.now() + TOKEN_BUFFER_MS >= expiresAt;
58
83
  }
59
84
  function isWorkspaceTokenExpired() {
60
- const auth = read();
61
- if (!auth?.workspaceTokenExpiresAt) return false;
62
- return Date.now() >= auth.workspaceTokenExpiresAt;
85
+ const expiresAt = workspaceTokenExpiry(read());
86
+ if (!expiresAt) return false;
87
+ return Date.now() >= expiresAt;
63
88
  }
64
89
  function isWorkspaceTokenExpiringSoon() {
65
- const auth = read();
66
- if (!auth?.workspaceTokenExpiresAt) return false;
67
- return Date.now() + TOKEN_BUFFER_MS >= auth.workspaceTokenExpiresAt;
90
+ const expiresAt = workspaceTokenExpiry(read());
91
+ if (!expiresAt) return false;
92
+ return Date.now() + TOKEN_BUFFER_MS >= expiresAt;
68
93
  }
69
94
  function isAuthenticated() {
70
95
  const auth = read();
@@ -73,19 +98,8 @@ function createAuthStore(configDir, authFileName2 = "auth.json") {
73
98
  return !isTokenExpired();
74
99
  }
75
100
  function getActorUserId() {
76
- const auth = read();
77
- const token = auth?.accessToken;
78
- if (!token) return null;
79
- const parts = token.split(".");
80
- if (parts.length !== 3) return null;
81
- try {
82
- const payload = JSON.parse(
83
- Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8")
84
- );
85
- return typeof payload.sub === "string" ? payload.sub : null;
86
- } catch {
87
- return null;
88
- }
101
+ const sub = decodeJwtPayload(read()?.accessToken)?.sub;
102
+ return typeof sub === "string" ? sub : null;
89
103
  }
90
104
  return {
91
105
  read,
@@ -342,6 +356,30 @@ function isNetworkOrServerError(error) {
342
356
  }
343
357
  return false;
344
358
  }
359
+ var GqlRequestError = class extends Error {
360
+ status;
361
+ authFailure;
362
+ constructor(message, status, authFailure) {
363
+ super(message);
364
+ this.name = "GqlRequestError";
365
+ this.status = status;
366
+ this.authFailure = authFailure;
367
+ }
368
+ };
369
+ function toGqlRequestError(error) {
370
+ let status;
371
+ let authFailure;
372
+ if (error && typeof error === "object" && "response" in error) {
373
+ const resp = error.response;
374
+ if (typeof resp?.status === "number") status = resp.status;
375
+ const failure = resp?.errors?.find((e) => typeof e.extensions?.authFailure === "string")?.extensions?.authFailure;
376
+ if (typeof failure === "string") authFailure = failure;
377
+ }
378
+ return new GqlRequestError(extractGqlErrorMessage(error), status, authFailure);
379
+ }
380
+ function isExpiredCredentialError(error) {
381
+ return error instanceof GqlRequestError && error.authFailure === "CREDENTIAL_EXPIRED";
382
+ }
345
383
  function extractGqlErrorMessage(error) {
346
384
  if (error && typeof error === "object" && "response" in error) {
347
385
  const resp = error;
@@ -394,7 +432,7 @@ async function executeWithRetry(client, document, variables) {
394
432
  break;
395
433
  }
396
434
  }
397
- throw new Error(extractGqlErrorMessage(lastError));
435
+ throw toGqlRequestError(lastError);
398
436
  }
399
437
  function createGqlClients(config, authStore) {
400
438
  let workspaceClient = null;
@@ -456,7 +494,7 @@ function createGqlClients(config, authStore) {
456
494
  }
457
495
  async function refreshWorkspaceToken() {
458
496
  const auth = authStore.read();
459
- if (!auth?.accessToken || !auth.workspaceId || !auth.organizationId) return;
497
+ if (!auth?.accessToken || !auth.workspaceId || !auth.organizationId) return false;
460
498
  const cfg = config.read();
461
499
  try {
462
500
  const result = await issueWorkspaceToken(
@@ -471,7 +509,9 @@ function createGqlClients(config, authStore) {
471
509
  workspaceTokenExpiresAt: new Date(result.expiresAt).getTime()
472
510
  });
473
511
  workspaceClient = null;
512
+ return true;
474
513
  } catch {
514
+ return false;
475
515
  }
476
516
  }
477
517
  async function ensureFreshTokens() {
@@ -484,12 +524,22 @@ function createGqlClients(config, authStore) {
484
524
  await refreshWorkspaceToken();
485
525
  }
486
526
  }
527
+ async function requestWorkspace(document, variables) {
528
+ const { workspace: ws } = workspaceClient ? { workspace: workspaceClient } : init();
529
+ ws.setHeaders(getWorkspaceHeaders(authStore.read()));
530
+ return executeWithRetry(ws, document, variables);
531
+ }
487
532
  const workspace = {
488
533
  async request(document, variables) {
489
534
  await ensureFreshTokens();
490
- const { workspace: ws } = workspaceClient ? { workspace: workspaceClient } : init();
491
- ws.setHeaders(getWorkspaceHeaders(authStore.read()));
492
- return executeWithRetry(ws, document, variables);
535
+ try {
536
+ return await requestWorkspace(document, variables);
537
+ } catch (error) {
538
+ if (!isExpiredCredentialError(error) || authStore.read()?.apiKey) throw error;
539
+ if (authStore.isTokenExpiringSoon()) await refreshPlatformToken();
540
+ if (!await refreshWorkspaceToken()) throw error;
541
+ return requestWorkspace(document, variables);
542
+ }
493
543
  }
494
544
  };
495
545
  const global = {
@@ -1110,6 +1160,7 @@ function stringifyCause(cause) {
1110
1160
 
1111
1161
  exports.CircularDependencyError = CircularDependencyError;
1112
1162
  exports.DESTRUCTIVE_NAME_VERBS = DESTRUCTIVE_NAME_VERBS;
1163
+ exports.GqlRequestError = GqlRequestError;
1113
1164
  exports.McpAuthError = McpAuthError;
1114
1165
  exports.McpInternalError = McpInternalError;
1115
1166
  exports.McpUserError = McpUserError;
@@ -1128,8 +1179,10 @@ exports.extractGqlErrorMessage = extractGqlErrorMessage;
1128
1179
  exports.fetchWorkspaces = fetchWorkspaces;
1129
1180
  exports.inferDestructiveHint = inferDestructiveHint;
1130
1181
  exports.inferReadOnlyHint = inferReadOnlyHint;
1182
+ exports.isExpiredCredentialError = isExpiredCredentialError;
1131
1183
  exports.issueWorkspaceToken = issueWorkspaceToken;
1132
1184
  exports.jsonResult = jsonResult;
1185
+ exports.jwtExpiryMs = jwtExpiryMs;
1133
1186
  exports.mcpPromptName = mcpPromptName;
1134
1187
  exports.mcpResourceUri = mcpResourceUri;
1135
1188
  exports.mcpToolName = mcpToolName;