@sideboard-ai/core 0.1.218 → 0.1.220

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 (35) hide show
  1. package/dist/{agents-YABJUV3V.js → agents-6UOWJLXX.js} +4 -4
  2. package/dist/{agents-NWJ7DFJD.js → agents-DYSZ2JFY.js} +4 -4
  3. package/dist/{chunk-FSIJGLSV.js → chunk-3Y4FIARC.js} +39 -11
  4. package/dist/{chunk-JWBPSD7Q.js → chunk-ALDVGAIO.js} +8 -8
  5. package/dist/{chunk-SRFFIFW6.js → chunk-B73KKJQB.js} +9 -9
  6. package/dist/{chunk-OPYBLX4V.js → chunk-N2VST3NL.js} +49 -2
  7. package/dist/chunk-P2BSMNHB.js +179 -0
  8. package/dist/{chunk-MW57SKKR.js → chunk-P2EAAM3H.js} +49 -2
  9. package/dist/{chunk-IILG7DPX.js → chunk-QILV2BRW.js} +31 -18
  10. package/dist/chunk-ROPGQRPU.js +178 -0
  11. package/dist/{chunk-SVXIJ2IC.js → chunk-UNMMKZ4Q.js} +26 -13
  12. package/dist/{chunk-XRHTRXZN.js → chunk-YG2X34EF.js} +39 -11
  13. package/dist/{connected-teams-LX5DLL2I.js → connected-teams-PRHZS6B4.js} +2 -2
  14. package/dist/{connected-teams-PQETXUWV.js → connected-teams-YOIB42RB.js} +2 -2
  15. package/dist/{coordinator-prompt-5V7GEPBG.js → coordinator-prompt-JLMQVORO.js} +1 -1
  16. package/dist/{coordinator-prompt-J4QSNTKE.js → coordinator-prompt-VZ7OSRLD.js} +1 -1
  17. package/dist/{global-workspace-4TEMLESD.js → global-workspace-3FDAUNN2.js} +1 -1
  18. package/dist/{global-workspace-XPTFHMKL.js → global-workspace-QPSJEXGR.js} +1 -1
  19. package/dist/index.cjs +216 -43
  20. package/dist/index.d.cts +40 -2
  21. package/dist/index.d.ts +40 -2
  22. package/dist/index.js +17 -5
  23. package/dist/mcp/run-stdio.cjs +196 -41
  24. package/dist/mcp/run-stdio.js +5 -5
  25. package/dist/oauth-K6CWZEQO.js +23 -0
  26. package/dist/oauth-S3M7B475.js +21 -0
  27. package/dist/{orchestrator-SWRTYFHX.js → orchestrator-P4KNHFHG.js} +5 -5
  28. package/dist/{orchestrator-HKW3VLGX.js → orchestrator-Y5IDLJ7D.js} +5 -5
  29. package/dist/{workspaces-BCBBMMXB.js → workspaces-76W7IEKR.js} +3 -1
  30. package/dist/{workspaces-2HQP654Q.js → workspaces-TDBA64II.js} +3 -1
  31. package/package.json +1 -1
  32. package/dist/chunk-AN3THU7F.js +0 -103
  33. package/dist/chunk-Y4MIXGPA.js +0 -104
  34. package/dist/oauth-6ZQ4Q4XN.js +0 -11
  35. package/dist/oauth-O7UGLZOY.js +0 -13
@@ -1,103 +0,0 @@
1
- import {
2
- formatFetchError
3
- } from "./chunk-N7WZ6NIN.js";
4
-
5
- // src/brightsy/config.ts
6
- import { existsSync, readFileSync, writeFileSync } from "fs";
7
- import { homedir } from "os";
8
- import { join } from "path";
9
- function brightsyConfigPath() {
10
- const override = process.env.BRIGHTSY_CONFIG?.trim();
11
- if (override) return override;
12
- return join(homedir(), ".brightsy", "config.json");
13
- }
14
- function loadBrightsyConfig() {
15
- const path = brightsyConfigPath();
16
- if (!existsSync(path)) {
17
- throw new Error("Brightsy not logged in \u2014 run `brightsy login` first");
18
- }
19
- const raw = JSON.parse(readFileSync(path, "utf8"));
20
- if (!raw.access_token || !raw.account_id) {
21
- throw new Error("Brightsy config incomplete \u2014 run `brightsy login`");
22
- }
23
- return raw;
24
- }
25
- function saveBrightsyConfig(cfg) {
26
- writeFileSync(brightsyConfigPath(), `${JSON.stringify(cfg, null, 2)}
27
- `, {
28
- mode: 384
29
- });
30
- }
31
-
32
- // src/brightsy/oauth.ts
33
- var REFRESH_SKEW_MS = 6e4;
34
- function brightsyAccessTokenNeedsRefresh(expiresAt, now = Date.now()) {
35
- if (typeof expiresAt !== "number" || !Number.isFinite(expiresAt) || expiresAt <= 0) {
36
- return true;
37
- }
38
- return now >= expiresAt - REFRESH_SKEW_MS;
39
- }
40
- function applyGrant(current, grant) {
41
- return {
42
- access_token: grant.access_token,
43
- refresh_token: grant.refresh_token || current.refresh_token,
44
- expires_at: grant.expires_at ?? current.expires_at
45
- };
46
- }
47
- async function refreshBrightsyAccessToken(opts) {
48
- const endpoint = (opts.endpoint || "https://brightsy.ai").replace(/\/$/, "");
49
- const url = `${endpoint}/oauth/token`;
50
- const fetchImpl = opts.fetchImpl ?? globalThis.fetch.bind(globalThis);
51
- let res;
52
- try {
53
- res = await fetchImpl(url, {
54
- method: "POST",
55
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
56
- body: new URLSearchParams({
57
- grant_type: "refresh_token",
58
- refresh_token: opts.refreshToken,
59
- client_id: opts.clientId || "brightsy-cli"
60
- })
61
- });
62
- } catch (err) {
63
- throw new Error(formatFetchError(err, url));
64
- }
65
- if (!res.ok) return null;
66
- const data = await res.json();
67
- if (!data.access_token) return null;
68
- return {
69
- access_token: data.access_token,
70
- refresh_token: data.refresh_token,
71
- expires_at: data.expires_in ? Date.now() + data.expires_in * 1e3 : void 0
72
- };
73
- }
74
- async function ensureBrightsyLocalConfigFresh(opts) {
75
- let cfg;
76
- try {
77
- cfg = loadBrightsyConfig();
78
- } catch {
79
- return null;
80
- }
81
- if (!cfg.refresh_token || !brightsyAccessTokenNeedsRefresh(cfg.expires_at)) {
82
- return cfg;
83
- }
84
- const grant = await refreshBrightsyAccessToken({
85
- endpoint: cfg.endpoint || "https://brightsy.ai",
86
- refreshToken: cfg.refresh_token,
87
- clientId: cfg.oauth_client_id,
88
- fetchImpl: opts?.fetchImpl
89
- });
90
- if (!grant) return cfg;
91
- const next = { ...cfg, ...applyGrant(cfg, grant) };
92
- saveBrightsyConfig(next);
93
- return next;
94
- }
95
-
96
- export {
97
- brightsyConfigPath,
98
- loadBrightsyConfig,
99
- saveBrightsyConfig,
100
- brightsyAccessTokenNeedsRefresh,
101
- refreshBrightsyAccessToken,
102
- ensureBrightsyLocalConfigFresh
103
- };
@@ -1,104 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import {
4
- formatFetchError
5
- } from "./chunk-VKQGAWHY.js";
6
-
7
- // src/brightsy/config.ts
8
- import { existsSync, readFileSync, writeFileSync } from "fs";
9
- import { homedir } from "os";
10
- import { join } from "path";
11
- function brightsyConfigPath() {
12
- const override = process.env.BRIGHTSY_CONFIG?.trim();
13
- if (override) return override;
14
- return join(homedir(), ".brightsy", "config.json");
15
- }
16
- function loadBrightsyConfig() {
17
- const path = brightsyConfigPath();
18
- if (!existsSync(path)) {
19
- throw new Error("Brightsy not logged in \u2014 run `brightsy login` first");
20
- }
21
- const raw = JSON.parse(readFileSync(path, "utf8"));
22
- if (!raw.access_token || !raw.account_id) {
23
- throw new Error("Brightsy config incomplete \u2014 run `brightsy login`");
24
- }
25
- return raw;
26
- }
27
- function saveBrightsyConfig(cfg) {
28
- writeFileSync(brightsyConfigPath(), `${JSON.stringify(cfg, null, 2)}
29
- `, {
30
- mode: 384
31
- });
32
- }
33
-
34
- // src/brightsy/oauth.ts
35
- var REFRESH_SKEW_MS = 6e4;
36
- function brightsyAccessTokenNeedsRefresh(expiresAt, now = Date.now()) {
37
- if (typeof expiresAt !== "number" || !Number.isFinite(expiresAt) || expiresAt <= 0) {
38
- return true;
39
- }
40
- return now >= expiresAt - REFRESH_SKEW_MS;
41
- }
42
- function applyGrant(current, grant) {
43
- return {
44
- access_token: grant.access_token,
45
- refresh_token: grant.refresh_token || current.refresh_token,
46
- expires_at: grant.expires_at ?? current.expires_at
47
- };
48
- }
49
- async function refreshBrightsyAccessToken(opts) {
50
- const endpoint = (opts.endpoint || "https://brightsy.ai").replace(/\/$/, "");
51
- const url = `${endpoint}/oauth/token`;
52
- const fetchImpl = opts.fetchImpl ?? globalThis.fetch.bind(globalThis);
53
- let res;
54
- try {
55
- res = await fetchImpl(url, {
56
- method: "POST",
57
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
58
- body: new URLSearchParams({
59
- grant_type: "refresh_token",
60
- refresh_token: opts.refreshToken,
61
- client_id: opts.clientId || "brightsy-cli"
62
- })
63
- });
64
- } catch (err) {
65
- throw new Error(formatFetchError(err, url));
66
- }
67
- if (!res.ok) return null;
68
- const data = await res.json();
69
- if (!data.access_token) return null;
70
- return {
71
- access_token: data.access_token,
72
- refresh_token: data.refresh_token,
73
- expires_at: data.expires_in ? Date.now() + data.expires_in * 1e3 : void 0
74
- };
75
- }
76
- async function ensureBrightsyLocalConfigFresh(opts) {
77
- let cfg;
78
- try {
79
- cfg = loadBrightsyConfig();
80
- } catch {
81
- return null;
82
- }
83
- if (!cfg.refresh_token || !brightsyAccessTokenNeedsRefresh(cfg.expires_at)) {
84
- return cfg;
85
- }
86
- const grant = await refreshBrightsyAccessToken({
87
- endpoint: cfg.endpoint || "https://brightsy.ai",
88
- refreshToken: cfg.refresh_token,
89
- clientId: cfg.oauth_client_id,
90
- fetchImpl: opts?.fetchImpl
91
- });
92
- if (!grant) return cfg;
93
- const next = { ...cfg, ...applyGrant(cfg, grant) };
94
- saveBrightsyConfig(next);
95
- return next;
96
- }
97
-
98
- export {
99
- loadBrightsyConfig,
100
- saveBrightsyConfig,
101
- brightsyAccessTokenNeedsRefresh,
102
- refreshBrightsyAccessToken,
103
- ensureBrightsyLocalConfigFresh
104
- };
@@ -1,11 +0,0 @@
1
- import {
2
- brightsyAccessTokenNeedsRefresh,
3
- ensureBrightsyLocalConfigFresh,
4
- refreshBrightsyAccessToken
5
- } from "./chunk-AN3THU7F.js";
6
- import "./chunk-N7WZ6NIN.js";
7
- export {
8
- brightsyAccessTokenNeedsRefresh,
9
- ensureBrightsyLocalConfigFresh,
10
- refreshBrightsyAccessToken
11
- };
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import {
4
- brightsyAccessTokenNeedsRefresh,
5
- ensureBrightsyLocalConfigFresh,
6
- refreshBrightsyAccessToken
7
- } from "./chunk-Y4MIXGPA.js";
8
- import "./chunk-VKQGAWHY.js";
9
- export {
10
- brightsyAccessTokenNeedsRefresh,
11
- ensureBrightsyLocalConfigFresh,
12
- refreshBrightsyAccessToken
13
- };