@sideboard-ai/core 0.1.203 → 0.1.204

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 (42) hide show
  1. package/dist/{abletime-JFGZBDHH.js → abletime-S3UHQZVW.js} +3 -3
  2. package/dist/{abletime-SISJEPJ3.js → abletime-TONBQP4O.js} +3 -3
  3. package/dist/{abletime-oauth-7TD5Z2QV.js → abletime-oauth-AVCEO2DY.js} +54 -5
  4. package/dist/{abletime-oauth-OSQYFB3E.js → abletime-oauth-SD4SZY5U.js} +14 -2
  5. package/dist/{abletime-rest-QPJTDLKX.js → abletime-rest-6ODSXV7G.js} +2 -2
  6. package/dist/{abletime-rest-ZJGWYALM.js → abletime-rest-J2OBB4VA.js} +2 -2
  7. package/dist/agents/cursor-runner.js +1 -1
  8. package/dist/{agents-ZMWL43SP.js → agents-67K4BQFJ.js} +3 -3
  9. package/dist/{agents-3755WYQM.js → agents-BVOJNHV6.js} +4 -4
  10. package/dist/{chunk-6VEIKW5C.js → chunk-3K257PCS.js} +6 -3
  11. package/dist/{chunk-LCU6GBZP.js → chunk-5SMS6QTO.js} +1 -1
  12. package/dist/{chunk-MHPINQKY.js → chunk-6Q7DFVDQ.js} +54 -5
  13. package/dist/{chunk-3PYH2RLA.js → chunk-CYLDJWRK.js} +6 -3
  14. package/dist/{chunk-FZ6IBUKY.js → chunk-FO2NTJ7L.js} +3 -3
  15. package/dist/{chunk-2DVCCLII.js → chunk-FO45DMJ5.js} +60 -60
  16. package/dist/{chunk-CQ5R3VPP.js → chunk-KZ7PI7FE.js} +18 -0
  17. package/dist/{chunk-FZYYEMET.js → chunk-QAVWH2RQ.js} +3 -3
  18. package/dist/{chunk-QSEF2YVQ.js → chunk-QUW5D62C.js} +33 -19
  19. package/dist/{chunk-PJHFNFXA.js → chunk-SGUVAK66.js} +27 -8
  20. package/dist/{chunk-TZNJKZ2A.js → chunk-ULZLWQBS.js} +58 -58
  21. package/dist/{chunk-TNDUTGDV.js → chunk-VIPA75ZA.js} +1 -1
  22. package/dist/{chunk-BFEBFGCS.js → chunk-W6VM36YO.js} +30 -8
  23. package/dist/{chunk-X2TFUFIS.js → chunk-WF33LOP4.js} +43 -5
  24. package/dist/{chunk-CMGRV36E.js → chunk-WVATAIF4.js} +33 -19
  25. package/dist/{chunk-5IXJTUST.js → chunk-YOSTWSNC.js} +26 -6
  26. package/dist/{coordinator-prompt-U4PEZDAW.js → coordinator-prompt-NPT555BO.js} +2 -2
  27. package/dist/{coordinator-prompt-2B2JA2IE.js → coordinator-prompt-WEPXXLLX.js} +2 -2
  28. package/dist/{global-workspace-JPJ3FKKY.js → global-workspace-2I2T7FL5.js} +2 -2
  29. package/dist/{global-workspace-PU7ZS3LS.js → global-workspace-NSILADOM.js} +2 -2
  30. package/dist/index.cjs +237 -83
  31. package/dist/index.d.cts +33 -11
  32. package/dist/index.d.ts +33 -11
  33. package/dist/index.js +39 -9
  34. package/dist/mcp/run-stdio.cjs +192 -78
  35. package/dist/mcp/run-stdio.js +7 -7
  36. package/dist/{orchestrator-3A6KUTNI.js → orchestrator-CMAVNELS.js} +5 -5
  37. package/dist/{orchestrator-Q33M24ZJ.js → orchestrator-I7GFXLHF.js} +4 -4
  38. package/dist/{workspaces-IMG7ZRUQ.js → workspaces-BOC6M7BW.js} +2 -2
  39. package/dist/{workspaces-U6P6DB44.js → workspaces-RFGZBUAR.js} +2 -2
  40. package/dist/{worktree-JSCDJPBU.js → worktree-G3ZLM4DC.js} +3 -1
  41. package/dist/{worktree-FL3UIUKQ.js → worktree-WSUQMMK4.js} +3 -1
  42. package/package.json +1 -1
@@ -17,9 +17,9 @@ import {
17
17
  toAbleTimeIssueInfo,
18
18
  updateAbleTimeTask,
19
19
  verifyAbleTimeConnection
20
- } from "./chunk-FZ6IBUKY.js";
21
- import "./chunk-6VEIKW5C.js";
22
- import "./chunk-PJHFNFXA.js";
20
+ } from "./chunk-FO2NTJ7L.js";
21
+ import "./chunk-3K257PCS.js";
22
+ import "./chunk-SGUVAK66.js";
23
23
  import "./chunk-VKQGAWHY.js";
24
24
  import "./chunk-X743YN5Y.js";
25
25
  import "./chunk-NSTQ6QKD.js";
@@ -15,9 +15,9 @@ import {
15
15
  toAbleTimeIssueInfo,
16
16
  updateAbleTimeTask,
17
17
  verifyAbleTimeConnection
18
- } from "./chunk-FZYYEMET.js";
19
- import "./chunk-3PYH2RLA.js";
20
- import "./chunk-BFEBFGCS.js";
18
+ } from "./chunk-QAVWH2RQ.js";
19
+ import "./chunk-CYLDJWRK.js";
20
+ import "./chunk-W6VM36YO.js";
21
21
  import "./chunk-N7WZ6NIN.js";
22
22
  import "./chunk-QFBBUFD4.js";
23
23
  import "./chunk-4TR3HZFT.js";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  DEFAULT_ABLETIME_HOST,
5
5
  normalizeAbleTimeHost
6
- } from "./chunk-PJHFNFXA.js";
6
+ } from "./chunk-SGUVAK66.js";
7
7
  import {
8
8
  httpFetch
9
9
  } from "./chunk-VKQGAWHY.js";
@@ -21,8 +21,51 @@ import "./chunk-FJZWM2ON.js";
21
21
  // src/integrations/abletime-oauth.ts
22
22
  import { createHash, randomBytes } from "crypto";
23
23
  import { createServer } from "http";
24
+ var ABLETIME_OAUTH_CALLBACK_PATH = "/oauth/abletime/callback";
24
25
  var ABLETIME_OAUTH_PORT = 19849;
25
- var ABLETIME_OAUTH_REDIRECT = `http://127.0.0.1:${ABLETIME_OAUTH_PORT}/callback`;
26
+ var ABLETIME_OAUTH_LOCAL_CALLBACK = `http://127.0.0.1:${ABLETIME_OAUTH_PORT}/callback`;
27
+ var ABLETIME_OAUTH_REDIRECT = `https://www.sideboard.cloud${ABLETIME_OAUTH_CALLBACK_PATH}`;
28
+ function ableTimeOAuthRedirectUri() {
29
+ return process.env.SIDEBOARD_ABLETIME_OAUTH_REDIRECT?.trim() || ABLETIME_OAUTH_REDIRECT;
30
+ }
31
+ var BOUNCE_QUERY_KEYS = ["code", "state", "error", "error_description"];
32
+ function parseAbleTimeOAuthCallbackUrl(reqUrl) {
33
+ let url;
34
+ try {
35
+ url = new URL(reqUrl, ABLETIME_OAUTH_REDIRECT);
36
+ } catch {
37
+ return null;
38
+ }
39
+ if (url.pathname !== ABLETIME_OAUTH_CALLBACK_PATH) return null;
40
+ return url;
41
+ }
42
+ function ableTimeOAuthLocalBounceUrl(reqUrl) {
43
+ const url = parseAbleTimeOAuthCallbackUrl(reqUrl);
44
+ if (!url) return null;
45
+ const dest = new URL(ABLETIME_OAUTH_LOCAL_CALLBACK);
46
+ for (const key of BOUNCE_QUERY_KEYS) {
47
+ const value = url.searchParams.get(key);
48
+ if (value) dest.searchParams.set(key, value);
49
+ }
50
+ return dest.toString();
51
+ }
52
+ function escapeHtml(value) {
53
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
54
+ }
55
+ function ableTimeOAuthBouncePage(localUrl) {
56
+ const safe = escapeHtml(localUrl);
57
+ return `<!doctype html><html><head><meta charset="utf-8">
58
+ <meta http-equiv="refresh" content="0;url=${safe}">
59
+ <title>Returning to Sideboard</title>
60
+ <script>location.replace(${JSON.stringify(localUrl)})</script>
61
+ <style>body{font-family:ui-sans-serif,system-ui,sans-serif;padding:48px 24px;max-width:36rem;margin:0 auto;color:#1a1a1a}
62
+ h1{font-size:1.25rem}p{line-height:1.5;color:#444}a{color:#0f7ed4}</style>
63
+ </head><body>
64
+ <h1>Returning to Sideboard</h1>
65
+ <p>AbleTime authorized. Opening the app\u2026</p>
66
+ <p><a href="${safe}">Open Sideboard</a> if it does not appear.</p>
67
+ </body></html>`;
68
+ }
26
69
  var BAKED_ABLETIME_OAUTH_CLIENT_ID = "https://www.sideboard.cloud/oauth/abletime-client.json";
27
70
  var ABLETIME_OAUTH_RESOURCE = `${DEFAULT_ABLETIME_HOST}/api/public/v2/mcp`;
28
71
  var REFRESH_SKEW_MS = 5 * 6e4;
@@ -45,7 +88,7 @@ function ableTimeOAuthAuthorizeUrl(clientId, state, codeChallenge, host) {
45
88
  const params = new URLSearchParams({
46
89
  response_type: "code",
47
90
  client_id: clientId,
48
- redirect_uri: ABLETIME_OAUTH_REDIRECT,
91
+ redirect_uri: ableTimeOAuthRedirectUri(),
49
92
  code_challenge: codeChallenge,
50
93
  code_challenge_method: "S256",
51
94
  state,
@@ -225,7 +268,7 @@ async function startAbleTimeOAuth(opts) {
225
268
  const body = new URLSearchParams({
226
269
  grant_type: "authorization_code",
227
270
  code,
228
- redirect_uri: ABLETIME_OAUTH_REDIRECT,
271
+ redirect_uri: ableTimeOAuthRedirectUri(),
229
272
  client_id: clientId,
230
273
  code_verifier: pkce.verifier,
231
274
  resource: ableTimeOAuthResource(host)
@@ -234,7 +277,7 @@ async function startAbleTimeOAuth(opts) {
234
277
  persistAbleTimeTokens(data, { host });
235
278
  const token = data.access_token.trim();
236
279
  try {
237
- const { getAbleTimeOrientation } = await import("./abletime-JFGZBDHH.js");
280
+ const { getAbleTimeOrientation } = await import("./abletime-S3UHQZVW.js");
238
281
  const orientation = await getAbleTimeOrientation({ token, host });
239
282
  return saveAbleTimeConnection({
240
283
  accessToken: token,
@@ -248,18 +291,24 @@ async function startAbleTimeOAuth(opts) {
248
291
  }
249
292
  }
250
293
  export {
294
+ ABLETIME_OAUTH_CALLBACK_PATH,
251
295
  ABLETIME_OAUTH_CANCELLED,
296
+ ABLETIME_OAUTH_LOCAL_CALLBACK,
252
297
  ABLETIME_OAUTH_PORT,
253
298
  ABLETIME_OAUTH_REDIRECT,
254
299
  ABLETIME_OAUTH_RESOURCE,
255
300
  AbleTimeOAuthCancelledError,
256
301
  BAKED_ABLETIME_OAUTH_CLIENT_ID,
257
302
  ableTimeOAuthAuthorizeUrl,
303
+ ableTimeOAuthBouncePage,
258
304
  ableTimeOAuthClientId,
305
+ ableTimeOAuthLocalBounceUrl,
306
+ ableTimeOAuthRedirectUri,
259
307
  ableTimeOAuthResource,
260
308
  createAbleTimePkce,
261
309
  ensureAbleTimeAccessToken,
262
310
  hasBakedAbleTimeOAuth,
263
311
  isAbleTimeOAuthCancelled,
312
+ parseAbleTimeOAuthCallbackUrl,
264
313
  startAbleTimeOAuth
265
314
  };
@@ -1,20 +1,26 @@
1
1
  import {
2
+ ABLETIME_OAUTH_CALLBACK_PATH,
2
3
  ABLETIME_OAUTH_CANCELLED,
4
+ ABLETIME_OAUTH_LOCAL_CALLBACK,
3
5
  ABLETIME_OAUTH_PORT,
4
6
  ABLETIME_OAUTH_REDIRECT,
5
7
  ABLETIME_OAUTH_RESOURCE,
6
8
  AbleTimeOAuthCancelledError,
7
9
  BAKED_ABLETIME_OAUTH_CLIENT_ID,
8
10
  ableTimeOAuthAuthorizeUrl,
11
+ ableTimeOAuthBouncePage,
9
12
  ableTimeOAuthClientId,
13
+ ableTimeOAuthLocalBounceUrl,
14
+ ableTimeOAuthRedirectUri,
10
15
  ableTimeOAuthResource,
11
16
  createAbleTimePkce,
12
17
  ensureAbleTimeAccessToken,
13
18
  hasBakedAbleTimeOAuth,
14
19
  isAbleTimeOAuthCancelled,
20
+ parseAbleTimeOAuthCallbackUrl,
15
21
  startAbleTimeOAuth
16
- } from "./chunk-MHPINQKY.js";
17
- import "./chunk-BFEBFGCS.js";
22
+ } from "./chunk-6Q7DFVDQ.js";
23
+ import "./chunk-W6VM36YO.js";
18
24
  import "./chunk-N7WZ6NIN.js";
19
25
  import "./chunk-QFBBUFD4.js";
20
26
  import "./chunk-4TR3HZFT.js";
@@ -23,18 +29,24 @@ import "./chunk-JT7R45JB.js";
23
29
  import "./chunk-77WWLBCI.js";
24
30
  import "./chunk-WFUDY6PC.js";
25
31
  export {
32
+ ABLETIME_OAUTH_CALLBACK_PATH,
26
33
  ABLETIME_OAUTH_CANCELLED,
34
+ ABLETIME_OAUTH_LOCAL_CALLBACK,
27
35
  ABLETIME_OAUTH_PORT,
28
36
  ABLETIME_OAUTH_REDIRECT,
29
37
  ABLETIME_OAUTH_RESOURCE,
30
38
  AbleTimeOAuthCancelledError,
31
39
  BAKED_ABLETIME_OAUTH_CLIENT_ID,
32
40
  ableTimeOAuthAuthorizeUrl,
41
+ ableTimeOAuthBouncePage,
33
42
  ableTimeOAuthClientId,
43
+ ableTimeOAuthLocalBounceUrl,
44
+ ableTimeOAuthRedirectUri,
34
45
  ableTimeOAuthResource,
35
46
  createAbleTimePkce,
36
47
  ensureAbleTimeAccessToken,
37
48
  hasBakedAbleTimeOAuth,
38
49
  isAbleTimeOAuthCancelled,
50
+ parseAbleTimeOAuthCallbackUrl,
39
51
  startAbleTimeOAuth
40
52
  };
@@ -7,8 +7,8 @@ import {
7
7
  callAbleTimeRestTool,
8
8
  looksLikeAbleTimeUlid,
9
9
  textFromAbleTimeDoc
10
- } from "./chunk-6VEIKW5C.js";
11
- import "./chunk-PJHFNFXA.js";
10
+ } from "./chunk-3K257PCS.js";
11
+ import "./chunk-SGUVAK66.js";
12
12
  import "./chunk-VKQGAWHY.js";
13
13
  import "./chunk-X743YN5Y.js";
14
14
  import "./chunk-NSTQ6QKD.js";
@@ -5,8 +5,8 @@ import {
5
5
  callAbleTimeRestTool,
6
6
  looksLikeAbleTimeUlid,
7
7
  textFromAbleTimeDoc
8
- } from "./chunk-3PYH2RLA.js";
9
- import "./chunk-BFEBFGCS.js";
8
+ } from "./chunk-CYLDJWRK.js";
9
+ import "./chunk-W6VM36YO.js";
10
10
  import "./chunk-N7WZ6NIN.js";
11
11
  import "./chunk-QFBBUFD4.js";
12
12
  import "./chunk-4TR3HZFT.js";
@@ -13,7 +13,7 @@ import {
13
13
  fetchCursorTurnCostUsd,
14
14
  formatUnknownDetail,
15
15
  looksLikeCursorHttp2StreamClose
16
- } from "../chunk-CQ5R3VPP.js";
16
+ } from "../chunk-KZ7PI7FE.js";
17
17
  import {
18
18
  dropNestedElectronEnvFromProcess
19
19
  } from "../chunk-4TR3HZFT.js";
@@ -50,12 +50,12 @@ import {
50
50
  resolveQuotaFallbackAgent,
51
51
  turnCostUsdFromCursorUsage,
52
52
  whichOnPath
53
- } from "./chunk-X2TFUFIS.js";
54
- import "./chunk-LCU6GBZP.js";
53
+ } from "./chunk-WF33LOP4.js";
54
+ import "./chunk-5SMS6QTO.js";
55
55
  import "./chunk-3OHR73VK.js";
56
56
  import "./chunk-Y4MIXGPA.js";
57
57
  import "./chunk-VKQGAWHY.js";
58
- import "./chunk-QSEF2YVQ.js";
58
+ import "./chunk-QUW5D62C.js";
59
59
  import "./chunk-D6JWYJ4P.js";
60
60
  import "./chunk-INNLWYXW.js";
61
61
  import "./chunk-SYFVUF2C.js";
@@ -44,9 +44,9 @@ import {
44
44
  resolveLoginCommand,
45
45
  resolveQuotaFallbackAgent,
46
46
  whichOnPath
47
- } from "./chunk-5IXJTUST.js";
48
- import "./chunk-TNDUTGDV.js";
49
- import "./chunk-CMGRV36E.js";
47
+ } from "./chunk-YOSTWSNC.js";
48
+ import "./chunk-VIPA75ZA.js";
49
+ import "./chunk-WVATAIF4.js";
50
50
  import "./chunk-6K64FJDD.js";
51
51
  import "./chunk-QQKDGPUI.js";
52
52
  import "./chunk-SALM35KD.js";
@@ -57,7 +57,7 @@ import {
57
57
  parseCursorRunnerLine,
58
58
  preferredCursorCostCents,
59
59
  turnCostUsdFromCursorUsage
60
- } from "./chunk-CQ5R3VPP.js";
60
+ } from "./chunk-KZ7PI7FE.js";
61
61
  import {
62
62
  ORCHESTRATOR_AGENT_KINDS,
63
63
  assertOrchestratorCapableAgent,
@@ -6,7 +6,7 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-PJHFNFXA.js";
9
+ } from "./chunk-SGUVAK66.js";
10
10
  import {
11
11
  httpFetch
12
12
  } from "./chunk-VKQGAWHY.js";
@@ -247,8 +247,11 @@ function firstStringArg(args, keys) {
247
247
  }
248
248
  async function callAbleTimeRestTool(name, args = {}, opts) {
249
249
  const token = normalizeAbleTimeCredential(opts?.token ?? getAbleTimeAccessToken() ?? "");
250
- if (ableTimeCredentialKind(token) !== "org") {
251
- throw new Error("AbleTime REST transport is for organization API keys (atk_\u2026)");
250
+ if (!token) {
251
+ throw new Error("AbleTime is not connected \u2014 paste an API key or connect via browser");
252
+ }
253
+ if (ableTimeCredentialKind(token) === "pat") {
254
+ throw new Error("AbleTime REST transport is for organization keys and OAuth tokens, not apt_\u2026");
252
255
  }
253
256
  const requestOpts = { ...opts, token };
254
257
  switch (name) {
@@ -7,7 +7,7 @@ import {
7
7
  resolveRepoRoot,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-QSEF2YVQ.js";
10
+ } from "./chunk-QUW5D62C.js";
11
11
  import {
12
12
  ATTACHMENTS_DIR,
13
13
  attachmentsGitignoreBody
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_ABLETIME_HOST,
3
3
  normalizeAbleTimeHost
4
- } from "./chunk-BFEBFGCS.js";
4
+ } from "./chunk-W6VM36YO.js";
5
5
  import {
6
6
  httpFetch
7
7
  } from "./chunk-N7WZ6NIN.js";
@@ -15,8 +15,51 @@ import {
15
15
  // src/integrations/abletime-oauth.ts
16
16
  import { createHash, randomBytes } from "crypto";
17
17
  import { createServer } from "http";
18
+ var ABLETIME_OAUTH_CALLBACK_PATH = "/oauth/abletime/callback";
18
19
  var ABLETIME_OAUTH_PORT = 19849;
19
- var ABLETIME_OAUTH_REDIRECT = `http://127.0.0.1:${ABLETIME_OAUTH_PORT}/callback`;
20
+ var ABLETIME_OAUTH_LOCAL_CALLBACK = `http://127.0.0.1:${ABLETIME_OAUTH_PORT}/callback`;
21
+ var ABLETIME_OAUTH_REDIRECT = `https://www.sideboard.cloud${ABLETIME_OAUTH_CALLBACK_PATH}`;
22
+ function ableTimeOAuthRedirectUri() {
23
+ return process.env.SIDEBOARD_ABLETIME_OAUTH_REDIRECT?.trim() || ABLETIME_OAUTH_REDIRECT;
24
+ }
25
+ var BOUNCE_QUERY_KEYS = ["code", "state", "error", "error_description"];
26
+ function parseAbleTimeOAuthCallbackUrl(reqUrl) {
27
+ let url;
28
+ try {
29
+ url = new URL(reqUrl, ABLETIME_OAUTH_REDIRECT);
30
+ } catch {
31
+ return null;
32
+ }
33
+ if (url.pathname !== ABLETIME_OAUTH_CALLBACK_PATH) return null;
34
+ return url;
35
+ }
36
+ function ableTimeOAuthLocalBounceUrl(reqUrl) {
37
+ const url = parseAbleTimeOAuthCallbackUrl(reqUrl);
38
+ if (!url) return null;
39
+ const dest = new URL(ABLETIME_OAUTH_LOCAL_CALLBACK);
40
+ for (const key of BOUNCE_QUERY_KEYS) {
41
+ const value = url.searchParams.get(key);
42
+ if (value) dest.searchParams.set(key, value);
43
+ }
44
+ return dest.toString();
45
+ }
46
+ function escapeHtml(value) {
47
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
48
+ }
49
+ function ableTimeOAuthBouncePage(localUrl) {
50
+ const safe = escapeHtml(localUrl);
51
+ return `<!doctype html><html><head><meta charset="utf-8">
52
+ <meta http-equiv="refresh" content="0;url=${safe}">
53
+ <title>Returning to Sideboard</title>
54
+ <script>location.replace(${JSON.stringify(localUrl)})</script>
55
+ <style>body{font-family:ui-sans-serif,system-ui,sans-serif;padding:48px 24px;max-width:36rem;margin:0 auto;color:#1a1a1a}
56
+ h1{font-size:1.25rem}p{line-height:1.5;color:#444}a{color:#0f7ed4}</style>
57
+ </head><body>
58
+ <h1>Returning to Sideboard</h1>
59
+ <p>AbleTime authorized. Opening the app\u2026</p>
60
+ <p><a href="${safe}">Open Sideboard</a> if it does not appear.</p>
61
+ </body></html>`;
62
+ }
20
63
  var BAKED_ABLETIME_OAUTH_CLIENT_ID = "https://www.sideboard.cloud/oauth/abletime-client.json";
21
64
  var ABLETIME_OAUTH_RESOURCE = `${DEFAULT_ABLETIME_HOST}/api/public/v2/mcp`;
22
65
  var REFRESH_SKEW_MS = 5 * 6e4;
@@ -39,7 +82,7 @@ function ableTimeOAuthAuthorizeUrl(clientId, state, codeChallenge, host) {
39
82
  const params = new URLSearchParams({
40
83
  response_type: "code",
41
84
  client_id: clientId,
42
- redirect_uri: ABLETIME_OAUTH_REDIRECT,
85
+ redirect_uri: ableTimeOAuthRedirectUri(),
43
86
  code_challenge: codeChallenge,
44
87
  code_challenge_method: "S256",
45
88
  state,
@@ -219,7 +262,7 @@ async function startAbleTimeOAuth(opts) {
219
262
  const body = new URLSearchParams({
220
263
  grant_type: "authorization_code",
221
264
  code,
222
- redirect_uri: ABLETIME_OAUTH_REDIRECT,
265
+ redirect_uri: ableTimeOAuthRedirectUri(),
223
266
  client_id: clientId,
224
267
  code_verifier: pkce.verifier,
225
268
  resource: ableTimeOAuthResource(host)
@@ -228,7 +271,7 @@ async function startAbleTimeOAuth(opts) {
228
271
  persistAbleTimeTokens(data, { host });
229
272
  const token = data.access_token.trim();
230
273
  try {
231
- const { getAbleTimeOrientation } = await import("./abletime-SISJEPJ3.js");
274
+ const { getAbleTimeOrientation } = await import("./abletime-TONBQP4O.js");
232
275
  const orientation = await getAbleTimeOrientation({ token, host });
233
276
  return saveAbleTimeConnection({
234
277
  accessToken: token,
@@ -243,8 +286,14 @@ async function startAbleTimeOAuth(opts) {
243
286
  }
244
287
 
245
288
  export {
289
+ ABLETIME_OAUTH_CALLBACK_PATH,
246
290
  ABLETIME_OAUTH_PORT,
291
+ ABLETIME_OAUTH_LOCAL_CALLBACK,
247
292
  ABLETIME_OAUTH_REDIRECT,
293
+ ableTimeOAuthRedirectUri,
294
+ parseAbleTimeOAuthCallbackUrl,
295
+ ableTimeOAuthLocalBounceUrl,
296
+ ableTimeOAuthBouncePage,
248
297
  BAKED_ABLETIME_OAUTH_CLIENT_ID,
249
298
  ABLETIME_OAUTH_RESOURCE,
250
299
  hasBakedAbleTimeOAuth,
@@ -4,7 +4,7 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-BFEBFGCS.js";
7
+ } from "./chunk-W6VM36YO.js";
8
8
  import {
9
9
  httpFetch
10
10
  } from "./chunk-N7WZ6NIN.js";
@@ -245,8 +245,11 @@ function firstStringArg(args, keys) {
245
245
  }
246
246
  async function callAbleTimeRestTool(name, args = {}, opts) {
247
247
  const token = normalizeAbleTimeCredential(opts?.token ?? getAbleTimeAccessToken() ?? "");
248
- if (ableTimeCredentialKind(token) !== "org") {
249
- throw new Error("AbleTime REST transport is for organization API keys (atk_\u2026)");
248
+ if (!token) {
249
+ throw new Error("AbleTime is not connected \u2014 paste an API key or connect via browser");
250
+ }
251
+ if (ableTimeCredentialKind(token) === "pat") {
252
+ throw new Error("AbleTime REST transport is for organization keys and OAuth tokens, not apt_\u2026");
250
253
  }
251
254
  const requestOpts = { ...opts, token };
252
255
  switch (name) {
@@ -2,13 +2,13 @@
2
2
 
3
3
  import {
4
4
  textFromAbleTimeDoc
5
- } from "./chunk-6VEIKW5C.js";
5
+ } from "./chunk-3K257PCS.js";
6
6
  import {
7
7
  assertAbleTimeCredential,
8
8
  callAbleTimeTool,
9
9
  normalizeAbleTimeHost,
10
10
  rewriteAbleTimeError
11
- } from "./chunk-PJHFNFXA.js";
11
+ } from "./chunk-SGUVAK66.js";
12
12
  import {
13
13
  isAbleTimeConnected,
14
14
  saveAbleTimeConnection
@@ -180,7 +180,7 @@ function isOpenTask(task) {
180
180
  async function getAbleTimeOrientation(opts) {
181
181
  const raw = await callAbleTimeTool("orientation", {}, opts);
182
182
  const record = asRecord(raw);
183
- const viewerRec = firstRecord(record, ["viewer", "user", "actor", "me", "person"]) ?? record;
183
+ const viewerRec = firstRecord(record, ["viewer", "principal", "user", "actor", "me", "person"]) ?? record;
184
184
  const viewer = {
185
185
  id: firstString(viewerRec, ["id", "user_id"]) || void 0,
186
186
  name: firstString(viewerRec, ["name", "display_name", "full_name"]) || firstString(record, ["name"]) || void 0