ask-marcel-office-cli 1.5.0 → 1.5.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to `ask-marcel-office-cli` are documented here.
4
4
 
5
+ ## 1.5.1
6
+
7
+ ### Fixed
8
+
9
+ - **No browser window opens per command once a secondary token lapses** (completes
10
+ the 1.5.0 auth fix). The elevated / Teams-chat (chatsvcagg / ic3) token recaptures
11
+ each launched a _visible_ browser that "opens and closes within seconds" to
12
+ silently re-capture — per command, per process, with no cross-process throttle —
13
+ so after the short-lived elevated token (~59 min) expired, every elevated or
14
+ Teams-chat command popped a window. The command-path auth now **fails fast** with
15
+ an actionable "run `ask-marcel login`" instead; browser capture is reserved for
16
+ the explicit `login` command, which re-captures all four tokens in one session.
17
+
5
18
  ## 1.5.0
6
19
 
7
20
  Agent-ergonomics, a faster cold-start, a new command, and an LLM-safety pass.
@@ -50,11 +63,11 @@ change to note**: byte commands now refuse to inline a payload over ~1 MB withou
50
63
 
51
64
  ### Fixed
52
65
 
53
- - **Auth no longer pops a browser per command on re-auth.** A command whose token
54
- needed refreshing used to launch the Chrome extension-capture window — once per
55
- process, with no cross-process throttle, so a batch/agent run stacked up
56
- windows. Command re-auth now uses a headed Edge sign-in (one login re-caches all
57
- tokens); the extension capture is reserved for explicit `login --use-extension`.
66
+ - **Auth no longer pops a browser per command on re-auth.** The primary-token
67
+ refresh-fallback used to launch the Chrome extension-capture window — once per
68
+ process, with no cross-process throttle, so a batch/agent run stacked up windows.
69
+ Command re-auth now uses a headed Edge sign-in only when the silent refresh
70
+ genuinely fails; the extension capture is reserved for explicit `login --use-extension`.
58
71
  - **Stale doc numbers** — the `help-json` size hints (terse-category ~16 → ~6 KB
59
72
  after the trim) and the README command list now match reality.
60
73
 
package/dist/cli.js CHANGED
@@ -2457,7 +2457,7 @@ import updateNotifier from "update-notifier";
2457
2457
  // package.json
2458
2458
  var package_default = {
2459
2459
  name: "ask-marcel-office-cli",
2460
- version: "1.5.0",
2460
+ version: "1.5.1",
2461
2461
  description: "Microsoft Graph CLI + library — typed Bun/TypeScript wrapper around 150+ Graph operations (read + on-the-fly PDF/markdown conversion + federated Microsoft Search) reachable from a Teams browser-OAuth token.",
2462
2462
  license: "MIT",
2463
2463
  author: "Vincent Delacourt <vincent.delacourt@adama-development.com>",
@@ -3475,7 +3475,8 @@ var SCOPES = "https://graph.microsoft.com/.default openid profile offline_access
3475
3475
  var SPA_ORIGIN = "https://teams.microsoft.com";
3476
3476
  var TEAMS_URL2 = "https://teams.microsoft.com/";
3477
3477
  var DEFAULT_CHATSVCAGG_REGION2 = "emea";
3478
- var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logger, fs, systemBrowserAuthFn, usePlaywrightFallback = true, skipSystemBrowser = false) => {
3478
+ var failFastSecondaryMessage = (token, commands) => `${token} token is expired or was not captured at login. Run \`ask-marcel login\` to (re)capture it — the CLI does not open a browser per command for this token. (Commands that need it: ${commands}.)`;
3479
+ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logger, fs, systemBrowserAuthFn, usePlaywrightFallback = true, skipSystemBrowser = false, recaptureSecondaryViaBrowser = true) => {
3479
3480
  const systemBrowserAuth = systemBrowserAuthFn ?? defaultSystemBrowserAuth(logger, skipSystemBrowser);
3480
3481
  const readCache = async () => {
3481
3482
  const r = await fs.readJson(cachePath);
@@ -3697,6 +3698,8 @@ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logge
3697
3698
  logger.info("auth.elevated.cache_hit");
3698
3699
  return ok(validated.value);
3699
3700
  }
3701
+ if (!recaptureSecondaryViaBrowser)
3702
+ return err({ type: "auth_failed", message: failFastSecondaryMessage("Elevated (M365)", "list-chats, get-chat, list-chat-members, download-drive-item-version") });
3700
3703
  return recaptureElevatedShared();
3701
3704
  };
3702
3705
  const freshChatsvcaggToken = (cached) => {
@@ -3747,6 +3750,11 @@ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logge
3747
3750
  logger.info("auth.chatsvcagg.cache_hit");
3748
3751
  return ok(accessTokenUnsafe(fresh));
3749
3752
  }
3753
+ if (!recaptureSecondaryViaBrowser)
3754
+ return err({
3755
+ type: "auth_failed",
3756
+ message: failFastSecondaryMessage("chatsvcagg (Teams chat)", "list-teams-chats-with-messages, list-teams-chat-messages, get-teams-chat-message, find-chats-with-user")
3757
+ });
3750
3758
  return recaptureChatsvcaggShared();
3751
3759
  };
3752
3760
  const getChatsvcaggRegion = async () => {
@@ -3802,6 +3810,8 @@ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logge
3802
3810
  logger.info("auth.ic3.cache_hit");
3803
3811
  return ok(accessTokenUnsafe(fresh));
3804
3812
  }
3813
+ if (!recaptureSecondaryViaBrowser)
3814
+ return err({ type: "auth_failed", message: failFastSecondaryMessage("ic3 (Teams chat history)", "list-teams-chat-history") });
3805
3815
  return recaptureIc3Shared();
3806
3816
  };
3807
3817
  const logout = async () => {
@@ -3859,7 +3869,7 @@ var createAuthManager = (deps) => {
3859
3869
  freshCachedToken: createFreshCachedTokenProbe(fs, deps.cachePath),
3860
3870
  onProgress: stderrProgress
3861
3871
  });
3862
- return createAuthManagerFromApi(browserAuth, deps.cachePath, browserProfileDir, deps.logger, fs, deps.systemBrowserAuth, deps.usePlaywrightFallback, deps.skipSystemBrowser);
3872
+ return createAuthManagerFromApi(browserAuth, deps.cachePath, browserProfileDir, deps.logger, fs, deps.systemBrowserAuth, deps.usePlaywrightFallback, deps.skipSystemBrowser, deps.recaptureSecondaryViaBrowser);
3863
3873
  };
3864
3874
  // src/infra/network-error.ts
3865
3875
  var REQUEST_TIMEOUT_MS = 60000;
@@ -4338,7 +4348,7 @@ var buildDeps = (config = {}) => {
4338
4348
  const processRunner = config.processRunner ?? defaultProcessRunner();
4339
4349
  const logger = createWinstonLogger({ logLevel });
4340
4350
  const makeAuth = config.createAuth ?? createAuthManager;
4341
- const auth = makeAuth({ cachePath, logger, fs, skipSystemBrowser: true, usePlaywrightFallback: true });
4351
+ const auth = makeAuth({ cachePath, logger, fs, skipSystemBrowser: true, usePlaywrightFallback: true, recaptureSecondaryViaBrowser: false });
4342
4352
  const graph = createGraphClient(auth);
4343
4353
  const makeLoginAuth = ({ useExtension }) => makeAuth({ cachePath, logger, fs, skipSystemBrowser: !useExtension, usePlaywrightFallback: !useExtension });
4344
4354
  return { logger, auth, graph, processRunner, fs, makeLoginAuth };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "package": "ask-marcel-office-cli",
3
- "version": "1.5.0",
4
- "generatedAt": "2026-06-16T16:14:42.738Z",
3
+ "version": "1.5.1",
4
+ "generatedAt": "2026-06-22T01:10:59.323Z",
5
5
  "commands": [
6
6
  {
7
7
  "name": "convert-calendar-event-attachment-to-markdown",
package/dist/index.js CHANGED
@@ -1249,7 +1249,8 @@ var SCOPES = "https://graph.microsoft.com/.default openid profile offline_access
1249
1249
  var SPA_ORIGIN = "https://teams.microsoft.com";
1250
1250
  var TEAMS_URL2 = "https://teams.microsoft.com/";
1251
1251
  var DEFAULT_CHATSVCAGG_REGION2 = "emea";
1252
- var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logger, fs, systemBrowserAuthFn, usePlaywrightFallback = true, skipSystemBrowser = false) => {
1252
+ var failFastSecondaryMessage = (token, commands) => `${token} token is expired or was not captured at login. Run \`ask-marcel login\` to (re)capture it — the CLI does not open a browser per command for this token. (Commands that need it: ${commands}.)`;
1253
+ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logger, fs, systemBrowserAuthFn, usePlaywrightFallback = true, skipSystemBrowser = false, recaptureSecondaryViaBrowser = true) => {
1253
1254
  const systemBrowserAuth = systemBrowserAuthFn ?? defaultSystemBrowserAuth(logger, skipSystemBrowser);
1254
1255
  const readCache = async () => {
1255
1256
  const r = await fs.readJson(cachePath);
@@ -1471,6 +1472,8 @@ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logge
1471
1472
  logger.info("auth.elevated.cache_hit");
1472
1473
  return ok(validated.value);
1473
1474
  }
1475
+ if (!recaptureSecondaryViaBrowser)
1476
+ return err({ type: "auth_failed", message: failFastSecondaryMessage("Elevated (M365)", "list-chats, get-chat, list-chat-members, download-drive-item-version") });
1474
1477
  return recaptureElevatedShared();
1475
1478
  };
1476
1479
  const freshChatsvcaggToken = (cached) => {
@@ -1521,6 +1524,11 @@ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logge
1521
1524
  logger.info("auth.chatsvcagg.cache_hit");
1522
1525
  return ok(accessTokenUnsafe(fresh));
1523
1526
  }
1527
+ if (!recaptureSecondaryViaBrowser)
1528
+ return err({
1529
+ type: "auth_failed",
1530
+ message: failFastSecondaryMessage("chatsvcagg (Teams chat)", "list-teams-chats-with-messages, list-teams-chat-messages, get-teams-chat-message, find-chats-with-user")
1531
+ });
1524
1532
  return recaptureChatsvcaggShared();
1525
1533
  };
1526
1534
  const getChatsvcaggRegion = async () => {
@@ -1576,6 +1584,8 @@ var createAuthManagerFromApi = (browserAuth, cachePath, browserProfileDir, logge
1576
1584
  logger.info("auth.ic3.cache_hit");
1577
1585
  return ok(accessTokenUnsafe(fresh));
1578
1586
  }
1587
+ if (!recaptureSecondaryViaBrowser)
1588
+ return err({ type: "auth_failed", message: failFastSecondaryMessage("ic3 (Teams chat history)", "list-teams-chat-history") });
1579
1589
  return recaptureIc3Shared();
1580
1590
  };
1581
1591
  const logout = async () => {
@@ -1633,7 +1643,7 @@ var createAuthManager = (deps) => {
1633
1643
  freshCachedToken: createFreshCachedTokenProbe(fs, deps.cachePath),
1634
1644
  onProgress: stderrProgress
1635
1645
  });
1636
- return createAuthManagerFromApi(browserAuth, deps.cachePath, browserProfileDir, deps.logger, fs, deps.systemBrowserAuth, deps.usePlaywrightFallback, deps.skipSystemBrowser);
1646
+ return createAuthManagerFromApi(browserAuth, deps.cachePath, browserProfileDir, deps.logger, fs, deps.systemBrowserAuth, deps.usePlaywrightFallback, deps.skipSystemBrowser, deps.recaptureSecondaryViaBrowser);
1637
1647
  };
1638
1648
  // src/infra/network-error.ts
1639
1649
  var REQUEST_TIMEOUT_MS = 60000;
@@ -26018,7 +26028,7 @@ var buildDeps = (config2 = {}) => {
26018
26028
  const processRunner = config2.processRunner ?? defaultProcessRunner();
26019
26029
  const logger = createWinstonLogger({ logLevel });
26020
26030
  const makeAuth = config2.createAuth ?? createAuthManager;
26021
- const auth = makeAuth({ cachePath, logger, fs, skipSystemBrowser: true, usePlaywrightFallback: true });
26031
+ const auth = makeAuth({ cachePath, logger, fs, skipSystemBrowser: true, usePlaywrightFallback: true, recaptureSecondaryViaBrowser: false });
26022
26032
  const graph = createGraphClient(auth);
26023
26033
  const makeLoginAuth = ({ useExtension }) => makeAuth({ cachePath, logger, fs, skipSystemBrowser: !useExtension, usePlaywrightFallback: !useExtension });
26024
26034
  return { logger, auth, graph, processRunner, fs, makeLoginAuth };
@@ -81,7 +81,7 @@ type SystemBrowserAuthFn = () => Promise<Result<{
81
81
  type: string;
82
82
  message: string;
83
83
  }>>;
84
- declare const createAuthManagerFromApi: (browserAuth: BrowserAuth, cachePath: string, browserProfileDir: string, logger: Logger, fs: FileSystem, systemBrowserAuthFn?: SystemBrowserAuthFn, usePlaywrightFallback?: boolean, skipSystemBrowser?: boolean) => AuthManager;
84
+ declare const createAuthManagerFromApi: (browserAuth: BrowserAuth, cachePath: string, browserProfileDir: string, logger: Logger, fs: FileSystem, systemBrowserAuthFn?: SystemBrowserAuthFn, usePlaywrightFallback?: boolean, skipSystemBrowser?: boolean, recaptureSecondaryViaBrowser?: boolean) => AuthManager;
85
85
  /**
86
86
  * QA-010: probe the token cache for a fresh access token. Handed to the
87
87
  * browser capture so its poll loop can short-circuit the multi-minute dance
@@ -99,6 +99,7 @@ declare const createAuthManager: (deps: {
99
99
  systemBrowserAuth?: SystemBrowserAuthFn;
100
100
  usePlaywrightFallback?: boolean;
101
101
  skipSystemBrowser?: boolean;
102
+ recaptureSecondaryViaBrowser?: boolean;
102
103
  }) => AuthManager;
103
104
  export { createAuthManager, createAuthManagerFromApi, createFreshCachedTokenProbe, stderrProgress };
104
105
  export type { AuthError, AuthManager, ElevatedOutcome, SystemBrowserAuthFn };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "package": "ask-marcel-office-cli",
3
- "version": "1.5.0",
4
- "generatedAt": "2026-06-16T16:14:42.738Z",
3
+ "version": "1.5.1",
4
+ "generatedAt": "2026-06-22T01:10:59.323Z",
5
5
  "commands": [
6
6
  {
7
7
  "name": "convert-calendar-event-attachment-to-markdown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ask-marcel-office-cli",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Microsoft Graph CLI + library \u2014 typed Bun/TypeScript wrapper around 150+ Graph operations (read + on-the-fly PDF/markdown conversion + federated Microsoft Search) reachable from a Teams browser-OAuth token.",
5
5
  "license": "MIT",
6
6
  "author": "Vincent Delacourt <vincent.delacourt@adama-development.com>",