@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.
- package/dist/{auth-ZPA6O5KO.js → auth-5S7SPPEJ.js} +2 -2
- package/dist/{auth-T3ILGJKW.js → auth-YM7OI23X.js} +1 -1
- package/dist/{chunk-OVMQFFC2.js → chunk-24ZKQWG2.js} +39 -4
- package/dist/{chunk-5CCFSPAF.js → chunk-MPFTXJFG.js} +1 -1
- package/dist/{chunk-7G2F7IVO.js → chunk-NBFTPIAH.js} +1 -1
- package/dist/{client-NYAEJDQZ.js → client-7S23DVHH.js} +2 -2
- package/dist/{config-QZIEYXQZ.js → config-RVUESJRF.js} +1 -1
- package/dist/index.js +13 -13
- package/dist/{raw-6ZPW3YII.js → raw-5SYAUCJQ.js} +2 -2
- package/dist/{te-analysis-CFQBXUCO.js → te-analysis-RQST6AT3.js} +2 -2
- package/dist/{te-audience-WPBBWADL.js → te-audience-TJ74UJI3.js} +2 -2
- package/dist/{te-common-GL3KBZPD.js → te-common-W5URM2SH.js} +2 -2
- package/dist/{te-community-3XEJNSQL.js → te-community-YRV2VAD4.js} +2 -2
- package/dist/{te-dataops-H4WSMCG5.js → te-dataops-ZPH72BCK.js} +2 -2
- package/dist/{te-engage-2VFM37ZM.js → te-engage-57UKFV74.js} +2 -2
- package/dist/{te-kb-EHHYPYBN.js → te-kb-GD7SJRYB.js} +2 -2
- package/dist/{te-meta-BO45GW32.js → te-meta-25SLZFXJ.js} +2 -2
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
loadMcpTokenStore,
|
|
8
8
|
setMcpTokenManual,
|
|
9
9
|
validateMcpToken
|
|
10
|
-
} from "./chunk-
|
|
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-
|
|
18
|
+
} from "./chunk-24ZKQWG2.js";
|
|
19
19
|
import {
|
|
20
20
|
loadConfig,
|
|
21
21
|
saveConfig
|
|
@@ -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
|
-
|
|
168
|
-
if (
|
|
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
|
`);
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
8
|
+
} from "./chunk-NBFTPIAH.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveHost
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-24ZKQWG2.js";
|
|
12
12
|
import {
|
|
13
13
|
safeJsonParse
|
|
14
14
|
} from "./chunk-TMMUBSKW.js";
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
registerMcpMappings,
|
|
5
5
|
resolveMcpUrl
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
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-
|
|
7
|
-
import "./chunk-
|
|
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-
|
|
7
|
-
import "./chunk-
|
|
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
|