@thinkingai/ae-cli 1.0.21 → 1.0.22

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.
@@ -7,7 +7,7 @@ import {
7
7
  loadMcpTokenStore,
8
8
  setMcpTokenManual,
9
9
  validateMcpToken
10
- } from "./chunk-5CCFSPAF.js";
10
+ } from "./chunk-MPFTXJFG.js";
11
11
  import {
12
12
  clearToken,
13
13
  getAuthStatus,
@@ -15,7 +15,7 @@ import {
15
15
  resolveHost,
16
16
  setTokenManual,
17
17
  validateToken
18
- } from "./chunk-OVMQFFC2.js";
18
+ } from "./chunk-24ZKQWG2.js";
19
19
  import {
20
20
  loadConfig,
21
21
  saveConfig
@@ -7,7 +7,7 @@ import {
7
7
  saveToken,
8
8
  setTokenManual,
9
9
  validateToken
10
- } from "./chunk-OVMQFFC2.js";
10
+ } from "./chunk-24ZKQWG2.js";
11
11
  import "./chunk-TMMUBSKW.js";
12
12
  export {
13
13
  clearToken,
@@ -140,6 +140,37 @@ function extractTokenViaOsascript(hostUrl) {
140
140
  return { token: null, error: "no_tab" };
141
141
  }
142
142
  }
143
+ function extractTokenFromAllTabs() {
144
+ const lines = [
145
+ 'tell application "Google Chrome"',
146
+ " repeat with w in windows",
147
+ " repeat with t in tabs of w",
148
+ " try",
149
+ ` set tokenVal to execute t javascript "localStorage.getItem('ACCESS_TOKEN')"`,
150
+ ' if tokenVal is not null and tokenVal is not missing value and tokenVal is not "" then',
151
+ " return tokenVal",
152
+ " end if",
153
+ " end try",
154
+ " end repeat",
155
+ " end repeat",
156
+ ' return "NO_TOKEN_FOUND"',
157
+ "end tell"
158
+ ];
159
+ try {
160
+ const args = lines.flatMap((line) => ["-e", line]);
161
+ const result = execFileSync("osascript", args, { encoding: "utf8", timeout: 1e4 }).trim();
162
+ if (result === "NO_TOKEN_FOUND" || !result || result === "missing value") {
163
+ return { token: null, error: "no_token" };
164
+ }
165
+ return { token: result.replace(/^["']|["']$/g, ""), error: null };
166
+ } catch (e) {
167
+ const msg = e.message || "";
168
+ if (msg.includes("not allowed") || msg.includes("assistive access") || msg.includes("(-1743)")) {
169
+ return { token: null, error: "no_js_permission" };
170
+ }
171
+ return { token: null, error: "no_tab" };
172
+ }
173
+ }
143
174
  async function requestTokenViaOsascript(hostUrl) {
144
175
  process.stderr.write(`[ae-cli] No AE tab found in Chrome. Opening ${hostUrl} ...
145
176
  `);
@@ -164,13 +195,17 @@ async function requestTokenViaOsascript(hostUrl) {
164
195
  const deadline = Date.now() + OSASCRIPT_POLL_TIMEOUT_MS;
165
196
  while (Date.now() < deadline) {
166
197
  await new Promise((r) => setTimeout(r, OSASCRIPT_POLL_INTERVAL_MS));
167
- const { token, error } = extractTokenViaOsascript(hostUrl);
168
- if (token) {
198
+ let result = extractTokenViaOsascript(hostUrl);
199
+ if (result.error === "no_tab") {
200
+ const fallback = extractTokenFromAllTabs();
201
+ if (fallback.token) result = fallback;
202
+ }
203
+ if (result.token) {
169
204
  process.stderr.write(`[ae-cli] Token captured from Chrome for ${hostUrl}.
170
205
  `);
171
- return token;
206
+ return result.token;
172
207
  }
173
- if (error === "no_js_permission") return null;
208
+ if (result.error === "no_js_permission") return null;
174
209
  }
175
210
  process.stderr.write(`[ae-cli] Polling timed out after ${OSASCRIPT_POLL_TIMEOUT_MS / 1e3}s.
176
211
  `);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getToken
3
- } from "./chunk-OVMQFFC2.js";
3
+ } from "./chunk-24ZKQWG2.js";
4
4
  import {
5
5
  forceMigrateFromFallback,
6
6
  getActiveHost,
@@ -2,7 +2,7 @@ import {
2
2
  clearToken,
3
3
  getToken,
4
4
  resolveHost
5
- } from "./chunk-OVMQFFC2.js";
5
+ } from "./chunk-24ZKQWG2.js";
6
6
  import {
7
7
  safeJsonParse
8
8
  } from "./chunk-TMMUBSKW.js";
@@ -6,8 +6,8 @@ import {
6
6
  queryReportData,
7
7
  querySql,
8
8
  wsQuery
9
- } from "./chunk-7G2F7IVO.js";
10
- import "./chunk-OVMQFFC2.js";
9
+ } from "./chunk-NBFTPIAH.js";
10
+ import "./chunk-24ZKQWG2.js";
11
11
  import "./chunk-TMMUBSKW.js";
12
12
  export {
13
13
  httpDelete,
@@ -4,7 +4,7 @@ import {
4
4
  getToken,
5
5
  loadToken,
6
6
  validateToken
7
- } from "./chunk-OVMQFFC2.js";
7
+ } from "./chunk-24ZKQWG2.js";
8
8
  import {
9
9
  addHost,
10
10
  listHosts,
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
62
62
  let _clientModule = null;
63
63
  async function getClient() {
64
64
  if (!_clientModule) {
65
- _clientModule = await import("./client-NYAEJDQZ.js");
65
+ _clientModule = await import("./client-7S23DVHH.js");
66
66
  }
67
67
  return _clientModule;
68
68
  }
@@ -105,7 +105,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
105
105
  return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
106
106
  },
107
107
  async token() {
108
- const { getToken } = await import("./auth-T3ILGJKW.js");
108
+ const { getToken } = await import("./auth-YM7OI23X.js");
109
109
  return getToken(ctx.host());
110
110
  },
111
111
  host() {
@@ -210,42 +210,42 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
210
210
  async function loadCommands() {
211
211
  const commands = [];
212
212
  try {
213
- const teAnalysis = await import("./te-analysis-CFQBXUCO.js");
213
+ const teAnalysis = await import("./te-analysis-RQST6AT3.js");
214
214
  commands.push(...teAnalysis.default);
215
215
  } catch {
216
216
  }
217
217
  try {
218
- const teAudience = await import("./te-audience-WPBBWADL.js");
218
+ const teAudience = await import("./te-audience-TJ74UJI3.js");
219
219
  commands.push(...teAudience.default);
220
220
  } catch {
221
221
  }
222
222
  try {
223
- const teMeta = await import("./te-meta-BO45GW32.js");
223
+ const teMeta = await import("./te-meta-25SLZFXJ.js");
224
224
  commands.push(...teMeta.default);
225
225
  } catch {
226
226
  }
227
227
  try {
228
- const teCommon = await import("./te-common-GL3KBZPD.js");
228
+ const teCommon = await import("./te-common-W5URM2SH.js");
229
229
  commands.push(...teCommon.default);
230
230
  } catch {
231
231
  }
232
232
  try {
233
- const engage = await import("./te-engage-2VFM37ZM.js");
233
+ const engage = await import("./te-engage-57UKFV74.js");
234
234
  commands.push(...engage.default);
235
235
  } catch {
236
236
  }
237
237
  try {
238
- const community = await import("./te-community-3XEJNSQL.js");
238
+ const community = await import("./te-community-YRV2VAD4.js");
239
239
  commands.push(...community.default);
240
240
  } catch {
241
241
  }
242
242
  try {
243
- const dataops = await import("./te-dataops-H4WSMCG5.js");
243
+ const dataops = await import("./te-dataops-ZPH72BCK.js");
244
244
  commands.push(...dataops.default);
245
245
  } catch {
246
246
  }
247
247
  try {
248
- const teKb = await import("./te-kb-EHHYPYBN.js");
248
+ const teKb = await import("./te-kb-GD7SJRYB.js");
249
249
  commands.push(...teKb.default);
250
250
  } catch {
251
251
  }
@@ -253,21 +253,21 @@ async function loadCommands() {
253
253
  }
254
254
  async function registerAuthCommands() {
255
255
  try {
256
- const { registerAuth } = await import("./auth-ZPA6O5KO.js");
256
+ const { registerAuth } = await import("./auth-5S7SPPEJ.js");
257
257
  registerAuth(program);
258
258
  } catch {
259
259
  }
260
260
  }
261
261
  async function registerConfigCommands() {
262
262
  try {
263
- const { registerConfig } = await import("./config-QZIEYXQZ.js");
263
+ const { registerConfig } = await import("./config-RVUESJRF.js");
264
264
  registerConfig(program);
265
265
  } catch {
266
266
  }
267
267
  }
268
268
  async function registerApiCommand() {
269
269
  try {
270
- const { registerApi } = await import("./raw-6ZPW3YII.js");
270
+ const { registerApi } = await import("./raw-5SYAUCJQ.js");
271
271
  registerApi(program);
272
272
  } catch {
273
273
  }
@@ -5,10 +5,10 @@ import {
5
5
  import {
6
6
  httpGet,
7
7
  httpPost
8
- } from "./chunk-7G2F7IVO.js";
8
+ } from "./chunk-NBFTPIAH.js";
9
9
  import {
10
10
  resolveHost
11
- } from "./chunk-OVMQFFC2.js";
11
+ } from "./chunk-24ZKQWG2.js";
12
12
  import {
13
13
  safeJsonParse
14
14
  } from "./chunk-TMMUBSKW.js";
@@ -2,8 +2,8 @@ import {
2
2
  callMcpTool,
3
3
  parseMcpResult,
4
4
  resolveMcpUrl
5
- } from "./chunk-5CCFSPAF.js";
6
- import "./chunk-OVMQFFC2.js";
5
+ } from "./chunk-MPFTXJFG.js";
6
+ import "./chunk-24ZKQWG2.js";
7
7
  import "./chunk-TMMUBSKW.js";
8
8
 
9
9
  // src/commands/te-analysis/shared.ts
@@ -2,8 +2,8 @@ import {
2
2
  callMcpTool,
3
3
  parseMcpResult,
4
4
  resolveMcpUrl
5
- } from "./chunk-5CCFSPAF.js";
6
- import "./chunk-OVMQFFC2.js";
5
+ } from "./chunk-MPFTXJFG.js";
6
+ import "./chunk-24ZKQWG2.js";
7
7
  import "./chunk-TMMUBSKW.js";
8
8
 
9
9
  // src/commands/te-audience/shared.ts
@@ -2,8 +2,8 @@ import {
2
2
  callMcpTool,
3
3
  parseMcpResult,
4
4
  resolveMcpUrl
5
- } from "./chunk-5CCFSPAF.js";
6
- import "./chunk-OVMQFFC2.js";
5
+ } from "./chunk-MPFTXJFG.js";
6
+ import "./chunk-24ZKQWG2.js";
7
7
  import "./chunk-TMMUBSKW.js";
8
8
 
9
9
  // src/commands/te-common/shared.ts
@@ -3,8 +3,8 @@ import {
3
3
  parseMcpResult,
4
4
  registerMcpMappings,
5
5
  resolveMcpUrl
6
- } from "./chunk-5CCFSPAF.js";
7
- import "./chunk-OVMQFFC2.js";
6
+ } from "./chunk-MPFTXJFG.js";
7
+ import "./chunk-24ZKQWG2.js";
8
8
  import "./chunk-TMMUBSKW.js";
9
9
 
10
10
  // src/commands/te-community/get_channel_info.ts
@@ -3,8 +3,8 @@ import {
3
3
  parseMcpResult,
4
4
  registerMcpMappings,
5
5
  resolveMcpUrl
6
- } from "./chunk-5CCFSPAF.js";
7
- import "./chunk-OVMQFFC2.js";
6
+ } from "./chunk-MPFTXJFG.js";
7
+ import "./chunk-24ZKQWG2.js";
8
8
  import "./chunk-TMMUBSKW.js";
9
9
 
10
10
  // src/commands/te-dataops/datatable/list-tables-by-page.ts
@@ -3,8 +3,8 @@ import {
3
3
  parseMcpResult,
4
4
  registerMcpMappings,
5
5
  resolveMcpUrl
6
- } from "./chunk-5CCFSPAF.js";
7
- import "./chunk-OVMQFFC2.js";
6
+ } from "./chunk-MPFTXJFG.js";
7
+ import "./chunk-24ZKQWG2.js";
8
8
  import "./chunk-TMMUBSKW.js";
9
9
 
10
10
  // src/commands/te-engage/utils.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  httpDelete,
3
3
  httpUpload
4
- } from "./chunk-7G2F7IVO.js";
5
- import "./chunk-OVMQFFC2.js";
4
+ } from "./chunk-NBFTPIAH.js";
5
+ import "./chunk-24ZKQWG2.js";
6
6
  import "./chunk-TMMUBSKW.js";
7
7
 
8
8
  // src/commands/te-kb/query.ts
@@ -2,8 +2,8 @@ import {
2
2
  callMcpTool,
3
3
  parseMcpResult,
4
4
  resolveMcpUrl
5
- } from "./chunk-5CCFSPAF.js";
6
- import "./chunk-OVMQFFC2.js";
5
+ } from "./chunk-MPFTXJFG.js";
6
+ import "./chunk-24ZKQWG2.js";
7
7
  import "./chunk-TMMUBSKW.js";
8
8
 
9
9
  // src/commands/te-meta/shared.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingai/ae-cli",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "CLI tool for ThinkingAI (AE) analytics platform",
5
5
  "type": "module",
6
6
  "bin": {