@thinkingai/ae-cli 6.0.52 → 6.0.54
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/README.md +35 -10
- package/README.zh.md +32 -10
- package/bin/ae-cli.js +6 -1
- package/cli-installation-guide.md +91 -0
- package/dist/{auth-XZNXFRJS.js → auth-MBWRZTB6.js} +171 -13
- package/dist/automation-NWWVLWG2.js +459 -0
- package/dist/{capability-RJZ4KRGP.js → capability-7SSN6PNZ.js} +11 -6
- package/dist/chunk-4655PUNX.js +43 -0
- package/dist/{chunk-4NRCTUZJ.js → chunk-5XJYLEVC.js} +4 -4
- package/dist/{chunk-JOCDD4ON.js → chunk-7QXISROD.js} +1 -1
- package/dist/{chunk-EQ255HKO.js → chunk-AP7YP2NX.js} +2 -2
- package/dist/{chunk-DVMLWQD4.js → chunk-CT7QDJS6.js} +2 -2
- package/dist/chunk-D6ACFILC.js +56 -0
- package/dist/{chunk-HFGZGYCG.js → chunk-EOYSKMXN.js} +264 -10
- package/dist/{chunk-57RRFUEZ.js → chunk-FMNNGNYO.js} +43 -8
- package/dist/{chunk-7XGFSUOM.js → chunk-GIK6EDUG.js} +291 -84
- package/dist/{chunk-WEPZ5M3Z.js → chunk-HBLK3ZHW.js} +7 -4
- package/dist/chunk-HVHR4SCP.js +133 -0
- package/dist/{chunk-DX5CDO34.js → chunk-KFNMQTZI.js} +580 -214
- package/dist/{chunk-HBGADCKA.js → chunk-PLE722AJ.js} +28 -11
- package/dist/chunk-RK6GLDGI.js +27 -0
- package/dist/{chunk-V2NUHPXF.js → chunk-S6M42KND.js} +1 -1
- package/dist/{chunk-7FTTULED.js → chunk-UQ77JXYH.js} +7 -3
- package/dist/{chunk-MAPZ7VB6.js → chunk-WNGFSIOB.js} +20 -1
- package/dist/{chunk-L2QUIZTS.js → chunk-ZIQWCZTS.js} +3 -3
- package/dist/{community-report-client-CU22W53K.js → community-report-client-PEERQCX2.js} +1 -1
- package/dist/{config-XO3LI3SA.js → config-FF6YVJKI.js} +29 -10
- package/dist/context-YAE3QXP3.js +136 -0
- package/dist/{data-integration-HNGUKFIC.js → data-integration-HESZET7E.js} +6 -6
- package/dist/index.js +169 -55
- package/dist/{local-data-upload-client-GTRIT64F.js → local-data-upload-client-TWMHFLUA.js} +1 -1
- package/dist/memory-62BJOULV.js +580 -0
- package/dist/{metadata-JAQW7KGZ.js → metadata-7CUMWIB4.js} +7 -7
- package/dist/{model-RNPQXIBI.js → model-SBV2JFJI.js} +9 -5
- package/dist/{personal-semantic-preference-QCZ2IZTK.js → personal-semantic-preference-6SRCYPGE.js} +119 -11
- package/dist/{project-semantic-64JURXKF.js → project-semantic-YYEM4OSU.js} +7 -7
- package/dist/{sync-O45NXEQY.js → sync-SU33KYX7.js} +12 -8
- package/dist/{te-agent-K5MSPNHJ.js → te-agent-F5QBZSQA.js} +423 -494
- package/dist/{te-analysis-KQKCAI5H.js → te-analysis-U4I2W2WC.js} +1090 -67
- package/dist/{te-community-4OYU3BDA.js → te-community-PFLDLPP4.js} +3 -3
- package/dist/{te-dataops-NFIPB6FX.js → te-dataops-FOQSRIAZ.js} +644 -276
- package/dist/{te-engage-HSVSRW22.js → te-engage-ZX76CNAB.js} +6 -6
- package/dist/{te-kb-3TS73NO6.js → te-kb-MHDOST62.js} +666 -244
- package/dist/{te-system-STMHLS5J.js → te-system-J2FQF5ER.js} +6 -6
- package/dist/{te-team-3I5AOX3N.js → te-team-5UOZPTU3.js} +6 -6
- package/dist/things-VPPXXLHB.js +1091 -0
- package/dist/{update-RZXLPCRH.js → update-EEUTEI6R.js} +59 -51
- package/dist/workspace-O3EEIYQM.js +554 -0
- package/package.json +30 -11
- package/skills/ae-agent/SKILL.md +95 -140
- package/skills/ae-agent/references/add-model.md +1 -1
- package/skills/ae-agent/references/create-agent.md +1 -1
- package/skills/ae-agent/references/find-archived-conversations.md +12 -5
- package/skills/ae-agent/references/get-agent.md +1 -1
- package/skills/ae-agent/references/list-agents.md +2 -2
- package/skills/ae-agent/references/list-models.md +2 -2
- package/skills/ae-agent/references/notification.md +40 -0
- package/skills/ae-agent/references/restore-conversation.md +3 -1
- package/skills/ae-analysis/SKILL.md +76 -15
- package/skills/ae-analysis/references/agent_review_submit_to_page.md +2 -0
- package/skills/ae-analysis/references/ai_models/event.md +6 -1
- package/skills/ae-analysis/references/ai_models/funnel.md +12 -4
- package/skills/ae-analysis/references/ai_models/heat_map.md +23 -0
- package/skills/ae-analysis/references/ai_models/interval.md +24 -0
- package/skills/ae-analysis/references/ai_models/path.md +20 -0
- package/skills/ae-analysis/references/ai_models/prop_analysis.md +2 -0
- package/skills/ae-analysis/references/ai_models/rank_list.md +30 -0
- package/skills/ae-analysis/references/ai_models/retention.md +45 -1
- package/skills/ae-analysis/references/ai_models/revenue.md +20 -2
- package/skills/ae-analysis/references/ai_models/tag.md +2 -0
- package/skills/ae-analysis/references/ai_models.md +96 -0
- package/skills/ae-analysis/references/analysis_data_retrieval.md +4 -0
- package/skills/ae-analysis/references/asset_batch_info_export.md +10 -0
- package/skills/ae-analysis/references/asset_batch_sql_export.md +13 -1
- package/skills/ae-analysis/references/asset_export.md +12 -1
- package/skills/ae-analysis/references/asset_list.md +1 -0
- package/skills/ae-analysis/references/asset_search.md +11 -5
- package/skills/ae-analysis/references/bi_panel_list.md +1 -1
- package/skills/ae-analysis/references/catalog_list.md +1 -1
- package/skills/ae-analysis/references/collaboration.md +48 -0
- package/skills/ae-analysis/references/command_index.md +26 -17
- package/skills/ae-analysis/references/dashboard_list.md +4 -4
- package/skills/ae-analysis/references/dashboard_move.md +21 -0
- package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
- package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
- package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
- package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
- package/skills/ae-analysis/references/dashboard_update.md +1 -1
- package/skills/ae-analysis/references/event_export.md +3 -1
- package/skills/ae-analysis/references/event_report_presentation.md +76 -0
- package/skills/ae-analysis/references/feedback_submit.md +37 -0
- package/skills/ae-analysis/references/governance_recommendation_auto_review.md +71 -0
- package/skills/ae-analysis/references/governance_recommendation_export.md +11 -0
- package/skills/ae-analysis/references/metadata_resolution.md +18 -3
- package/skills/ae-analysis/references/metric_export.md +3 -1
- package/skills/ae-analysis/references/metric_list.md +1 -1
- package/skills/ae-analysis/references/operation_record_export.md +10 -0
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +6 -4
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +5 -3
- package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
- package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
- package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +91 -32
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +99 -1
- package/skills/ae-analysis/references/property_export.md +3 -1
- package/skills/ae-analysis/references/report_create.md +17 -3
- package/skills/ae-analysis/references/report_data_export.md +6 -0
- package/skills/ae-analysis/references/report_get.md +7 -1
- package/skills/ae-analysis/references/report_list.md +5 -5
- package/skills/ae-analysis/references/report_update.md +20 -3
- package/skills/ae-analysis/references/sql_table_columns.md +4 -4
- package/skills/ae-analysis/references/sql_table_list.md +5 -5
- package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
- package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
- package/skills/ae-analysis/references/system_query_task_export.md +6 -2
- package/skills/ae-analysis/references/system_query_task_get.md +2 -0
- package/skills/ae-analysis/references/system_query_task_list.md +7 -3
- package/skills/ae-analysis/references/system_query_task_options.md +2 -2
- package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
- package/skills/ae-analysis/references/user_cluster_models.md +8 -0
- package/skills/ae-analysis/references/user_tag_create.md +7 -1
- package/skills/ae-analysis/references/user_tag_get.md +1 -1
- package/skills/ae-analysis/references/user_tag_models.md +20 -2
- package/skills/ae-analysis/references/user_tag_refresh.md +1 -1
- package/skills/ae-analysis/references/user_tag_update.md +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +669 -29
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +28 -10
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +285 -24
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +262 -30
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +46 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
- package/skills/ae-automation/SKILL.md +16 -0
- package/skills/ae-automation/references/cli.md +53 -0
- package/skills/ae-automation/references/command_index.md +17 -0
- package/skills/ae-capability/SKILL.md +73 -2
- package/skills/ae-capability/references/collaboration.md +48 -0
- package/skills/ae-community/SKILL.md +5 -1
- package/skills/ae-community/references/collaboration.md +48 -0
- package/skills/ae-current-context/SKILL.md +3 -2
- package/skills/ae-data-integration/SKILL.md +4 -0
- package/skills/ae-data-integration/references/collaboration.md +48 -0
- package/skills/ae-dataops/SKILL.md +54 -74
- package/skills/ae-dataops/references/collaboration.md +48 -0
- package/skills/ae-dataops/references/dataops-backfill.md +23 -18
- package/skills/ae-dataops/references/dataops-flow-create.md +74 -23
- package/skills/ae-dataops/references/dataops-flow-monitor.md +45 -13
- package/skills/ae-dataops/references/dataops-integration.md +57 -30
- package/skills/ae-dataops/references/dataops-query.md +21 -4
- package/skills/ae-dataops/references/dataops-table.md +143 -11
- package/skills/ae-engage/SKILL.md +21 -6
- package/skills/ae-engage/references/channel-mgmt.md +3 -3
- package/skills/ae-engage/references/collaboration.md +48 -0
- package/skills/ae-engage/references/scene-config-channel.md +4 -4
- package/skills/ae-generate-tracking-plan/SKILL.md +4 -0
- package/skills/ae-generate-tracking-plan/references/collaboration.md +48 -0
- package/skills/ae-kb/SKILL.md +70 -12
- package/skills/ae-kb/references/analysis-workflow.md +73 -36
- package/skills/ae-kb/references/collaboration.md +48 -0
- package/skills/ae-kb/references/query-workflow.md +67 -33
- package/skills/ae-kb/references/schema-import.md +32 -0
- package/skills/ae-kb/references/source-mutations.md +6 -4
- package/skills/ae-kb/references/text-sources.md +53 -0
- package/skills/ae-kb-discovery/SKILL.md +8 -3
- package/skills/ae-kb-discovery/references/collaboration.md +48 -0
- package/skills/ae-metadata/SKILL.md +20 -12
- package/skills/ae-metadata/references/collaboration.md +48 -0
- package/skills/ae-team/SKILL.md +23 -17
- package/skills/ae-things/SKILL.md +85 -0
- package/skills/ae-things/references/cli.md +103 -0
- package/skills/ae-things-progress/SKILL.md +43 -0
- package/skills/ae-things-review/SKILL.md +42 -0
- package/skills/ae-workspace/SKILL.md +43 -0
- package/skills/ae-workspace/references/commands.md +51 -0
- package/dist/chunk-E2JKXMVO.js +0 -29
- package/dist/context-IFJI3LIT.js +0 -46
- package/dist/memory-QGPSNCQS.js +0 -892
- package/skills/ae-agent/references/create-automation.md +0 -125
- package/skills/ae-agent/references/list-automations.md +0 -56
- package/skills/ae-agent/references/update-automation.md +0 -107
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-Y74WTIKJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getCliToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GIK6EDUG.js";
|
|
8
8
|
import {
|
|
9
9
|
getActiveHost,
|
|
10
10
|
getSandboxRuntimeRoot
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UQ77JXYH.js";
|
|
12
12
|
import {
|
|
13
|
-
PermissionError
|
|
14
|
-
|
|
13
|
+
PermissionError,
|
|
14
|
+
isApiErrorType
|
|
15
|
+
} from "./chunk-WNGFSIOB.js";
|
|
15
16
|
|
|
16
17
|
// src/core/te-agent-credentials.ts
|
|
17
18
|
import { readFileSync } from "fs";
|
|
@@ -120,16 +121,22 @@ function resolveTeClaudeBaseUrl(host) {
|
|
|
120
121
|
|
|
121
122
|
// src/core/te-agent-client.ts
|
|
122
123
|
var TeAgentApiError = class extends Error {
|
|
123
|
-
constructor(message, status, code, body) {
|
|
124
|
+
constructor(message, status, code, body, errorType = "api", hint, details) {
|
|
124
125
|
super(message);
|
|
125
126
|
this.status = status;
|
|
126
127
|
this.code = code;
|
|
127
128
|
this.body = body;
|
|
129
|
+
this.errorType = errorType;
|
|
130
|
+
this.hint = hint;
|
|
131
|
+
this.details = details;
|
|
128
132
|
this.name = "TeAgentApiError";
|
|
129
133
|
}
|
|
130
134
|
status;
|
|
131
135
|
code;
|
|
132
136
|
body;
|
|
137
|
+
errorType;
|
|
138
|
+
hint;
|
|
139
|
+
details;
|
|
133
140
|
};
|
|
134
141
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
135
142
|
var UPLOAD_TIMEOUT_MS = 12e4;
|
|
@@ -241,7 +248,13 @@ function errorDetails(parsed, defaultErrorPrefix, status) {
|
|
|
241
248
|
const message = typeof parsed?.error === "string" ? parsed.error : typeof nested?.message === "string" ? nested.message : typeof parsed?.message === "string" ? parsed.message : typeof parsed?.return_message === "string" ? parsed.return_message : `${defaultErrorPrefix} ${status}`;
|
|
242
249
|
const code = typeof nested?.code === "string" ? nested.code : typeof parsed?.code === "string" ? parsed.code : void 0;
|
|
243
250
|
const hint = typeof nested?.hint === "string" ? nested.hint : typeof parsed?.hint === "string" ? parsed.hint : void 0;
|
|
244
|
-
|
|
251
|
+
const declaredType = isApiErrorType(nested?.type) ? nested.type : void 0;
|
|
252
|
+
const type = status === 401 ? "auth" : status === 403 ? "permission" : declaredType ?? ([400, 413, 422].includes(status) ? "validation" : status === 404 ? "not_found" : "api");
|
|
253
|
+
return { message, code, hint, type, details: declaredType ? nested?.details : void 0 };
|
|
254
|
+
}
|
|
255
|
+
function createTeAgentApiError(body, status, defaultErrorPrefix = "Main app returned") {
|
|
256
|
+
const error = errorDetails(body, defaultErrorPrefix, status);
|
|
257
|
+
return new TeAgentApiError(error.message, status, error.code, body, error.type, error.hint, error.details);
|
|
245
258
|
}
|
|
246
259
|
async function parseResponse(response, defaultErrorPrefix) {
|
|
247
260
|
const text = await response.text();
|
|
@@ -256,17 +269,20 @@ async function parseResponse(response, defaultErrorPrefix) {
|
|
|
256
269
|
if (!response.ok) {
|
|
257
270
|
const details = errorDetails(parsed, defaultErrorPrefix, response.status);
|
|
258
271
|
if (response.status === 403) {
|
|
259
|
-
throw new PermissionError(details.message, details.code, details.hint);
|
|
272
|
+
throw new PermissionError(details.message, details.code, details.hint, details.details);
|
|
260
273
|
}
|
|
261
274
|
if (response.status === 401) {
|
|
262
275
|
throw new TeAgentApiError(
|
|
263
|
-
"Session expired or unauthorized. Please run: ae-cli auth login",
|
|
276
|
+
isApiErrorType(parsed?.error?.type) && typeof parsed.error.message === "string" && parsed.error.message.trim() ? details.message : "Session expired or unauthorized. Please run: ae-cli auth login",
|
|
264
277
|
response.status,
|
|
265
|
-
"auth_expired",
|
|
266
|
-
parsed
|
|
278
|
+
details.code ?? "auth_expired",
|
|
279
|
+
parsed,
|
|
280
|
+
"auth",
|
|
281
|
+
details.hint ?? "Run: ae-cli auth login",
|
|
282
|
+
details.details
|
|
267
283
|
);
|
|
268
284
|
}
|
|
269
|
-
throw
|
|
285
|
+
throw createTeAgentApiError(parsed, response.status, defaultErrorPrefix);
|
|
270
286
|
}
|
|
271
287
|
return parsed;
|
|
272
288
|
}
|
|
@@ -487,6 +503,7 @@ export {
|
|
|
487
503
|
getClaudeConfigDir,
|
|
488
504
|
resolveTeClaudeBaseUrl,
|
|
489
505
|
TeAgentApiError,
|
|
506
|
+
createTeAgentApiError,
|
|
490
507
|
postToMainApp,
|
|
491
508
|
getFromMainApp,
|
|
492
509
|
getSandboxModels,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/core/agent-space-context.ts
|
|
4
|
+
function value(name) {
|
|
5
|
+
const current = process.env[name]?.trim();
|
|
6
|
+
return current || void 0;
|
|
7
|
+
}
|
|
8
|
+
function currentAgentSpaceId() {
|
|
9
|
+
const explicit = value("TE_AGENT_CURRENT_AGENT_SPACE_ID");
|
|
10
|
+
if (explicit) return explicit;
|
|
11
|
+
const match = /(?:^|\/)spaces\/actived\/([^/]+)(?:\/|$)/.exec(process.cwd());
|
|
12
|
+
return match?.[1];
|
|
13
|
+
}
|
|
14
|
+
function isAgentSpaceRuntime() {
|
|
15
|
+
return Boolean(currentAgentSpaceId());
|
|
16
|
+
}
|
|
17
|
+
function assertLegacyWorkspaceCommand(command) {
|
|
18
|
+
if (!isAgentSpaceRuntime()) return;
|
|
19
|
+
throw new Error(
|
|
20
|
+
`ae-cli ${command} manages the legacy sandbox Workspace and is disabled in an AgentSpace runtime. Use ae-cli workspace capability list/set for AgentSpace capabilities.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
currentAgentSpaceId,
|
|
26
|
+
assertLegacyWorkspaceCommand
|
|
27
|
+
};
|
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
__commonJS,
|
|
4
4
|
__require
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WNGFSIOB.js";
|
|
6
6
|
|
|
7
7
|
// node_modules/process-nextick-args/index.js
|
|
8
8
|
var require_process_nextick_args = __commonJS({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
logger
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNGFSIOB.js";
|
|
5
5
|
|
|
6
6
|
// src/core/url-utils.ts
|
|
7
7
|
function normalizeUrl(url) {
|
|
@@ -15,6 +15,7 @@ function normalizeUrl(url) {
|
|
|
15
15
|
// src/core/config.ts
|
|
16
16
|
import fs3 from "fs";
|
|
17
17
|
import path from "path";
|
|
18
|
+
import os from "os";
|
|
18
19
|
|
|
19
20
|
// src/core/json-utils.ts
|
|
20
21
|
import fs from "fs";
|
|
@@ -76,6 +77,9 @@ function isAeSandboxRuntime() {
|
|
|
76
77
|
if (process.env.SANDBOX_RUNTIME_ROOT) {
|
|
77
78
|
return true;
|
|
78
79
|
}
|
|
80
|
+
if (process.platform !== "linux") {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
79
83
|
try {
|
|
80
84
|
if (fs2.existsSync(getSandboxCliTokenFilePath())) {
|
|
81
85
|
return true;
|
|
@@ -86,11 +90,11 @@ function isAeSandboxRuntime() {
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
// src/core/config.ts
|
|
89
|
-
var CONFIG_DIR = path.join(process.env.HOME ||
|
|
93
|
+
var CONFIG_DIR = path.join(process.env.HOME || os.homedir(), ".ae-cli");
|
|
90
94
|
var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
91
95
|
function sandboxCliTokenCandidatePaths() {
|
|
92
96
|
const paths = [getSandboxCliTokenFilePath()];
|
|
93
|
-
const homeFallback = path.join(process.env.HOME ||
|
|
97
|
+
const homeFallback = path.join(process.env.HOME || os.homedir(), ".ae-config", "cli-token.json");
|
|
94
98
|
if (!paths.includes(homeFallback)) {
|
|
95
99
|
paths.push(homeFallback);
|
|
96
100
|
}
|
|
@@ -133,15 +133,20 @@ var logger = new Logger();
|
|
|
133
133
|
|
|
134
134
|
// src/core/errors.ts
|
|
135
135
|
var PermissionError = class extends Error {
|
|
136
|
-
constructor(message, code, hint) {
|
|
136
|
+
constructor(message, code, hint, details) {
|
|
137
137
|
super(message);
|
|
138
138
|
this.code = code;
|
|
139
139
|
this.hint = hint;
|
|
140
|
+
this.details = details;
|
|
140
141
|
this.name = "PermissionError";
|
|
141
142
|
}
|
|
142
143
|
code;
|
|
143
144
|
hint;
|
|
145
|
+
details;
|
|
144
146
|
};
|
|
147
|
+
function isApiErrorType(value) {
|
|
148
|
+
return value === "auth" || value === "permission" || value === "validation" || value === "not_found" || value === "api";
|
|
149
|
+
}
|
|
145
150
|
var CliValidationError = class extends Error {
|
|
146
151
|
code;
|
|
147
152
|
hint;
|
|
@@ -166,6 +171,18 @@ var CliValidationError = class extends Error {
|
|
|
166
171
|
}
|
|
167
172
|
}
|
|
168
173
|
};
|
|
174
|
+
var CliApiError = class extends Error {
|
|
175
|
+
code;
|
|
176
|
+
hint;
|
|
177
|
+
meta;
|
|
178
|
+
constructor(message, options = {}) {
|
|
179
|
+
super(message);
|
|
180
|
+
this.name = "CliApiError";
|
|
181
|
+
this.code = options.code;
|
|
182
|
+
this.hint = options.hint;
|
|
183
|
+
this.meta = options.meta;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
169
186
|
var CommunityReportError = class extends Error {
|
|
170
187
|
code;
|
|
171
188
|
httpStatus;
|
|
@@ -204,7 +221,9 @@ export {
|
|
|
204
221
|
__toCommonJS,
|
|
205
222
|
logger,
|
|
206
223
|
PermissionError,
|
|
224
|
+
isApiErrorType,
|
|
207
225
|
CliValidationError,
|
|
226
|
+
CliApiError,
|
|
208
227
|
CommunityReportError,
|
|
209
228
|
LocalDataUploadError
|
|
210
229
|
};
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
dryRunCapability,
|
|
7
7
|
executeCapabilityWithEnvelope,
|
|
8
8
|
validateCapability
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EOYSKMXN.js";
|
|
10
10
|
import {
|
|
11
11
|
withOutputMetadata
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KFNMQTZI.js";
|
|
13
13
|
import {
|
|
14
14
|
CliValidationError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WNGFSIOB.js";
|
|
16
16
|
|
|
17
17
|
// src/core/definition-intent.ts
|
|
18
18
|
import { createHash } from "crypto";
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
MultiselectCancelled,
|
|
4
|
-
promptSingleSelect
|
|
5
|
-
} from "./chunk-7K24F7T2.js";
|
|
6
2
|
import {
|
|
7
3
|
AE_TRIAL_URL,
|
|
8
4
|
missingAeHostHint
|
|
9
5
|
} from "./chunk-6ZIQV5GW.js";
|
|
10
6
|
import {
|
|
7
|
+
MultiselectCancelled,
|
|
8
|
+
promptSingleSelect
|
|
9
|
+
} from "./chunk-7K24F7T2.js";
|
|
10
|
+
import {
|
|
11
|
+
fetchCliConfig,
|
|
11
12
|
printError,
|
|
12
|
-
printOutput
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
printOutput,
|
|
14
|
+
resolveKbAutoDiscoveryFeature
|
|
15
|
+
} from "./chunk-KFNMQTZI.js";
|
|
16
|
+
import {
|
|
17
|
+
peekCliToken
|
|
18
|
+
} from "./chunk-GIK6EDUG.js";
|
|
15
19
|
import {
|
|
16
20
|
addHost,
|
|
21
|
+
getActiveHost,
|
|
17
22
|
listHosts,
|
|
18
23
|
loadConfig,
|
|
19
24
|
normalizeUrl,
|
|
@@ -21,8 +26,8 @@ import {
|
|
|
21
26
|
resolveHostSelector,
|
|
22
27
|
setActiveHost,
|
|
23
28
|
updateHostLabel
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-UQ77JXYH.js";
|
|
30
|
+
import "./chunk-WNGFSIOB.js";
|
|
26
31
|
|
|
27
32
|
// src/commands/config.ts
|
|
28
33
|
import * as readline2 from "readline";
|
|
@@ -252,7 +257,7 @@ async function confirm(question) {
|
|
|
252
257
|
|
|
253
258
|
// src/commands/config.ts
|
|
254
259
|
function registerConfig(program) {
|
|
255
|
-
const configCmd = program.command("config").description("Manage AE host environments
|
|
260
|
+
const configCmd = program.command("config").description("Manage AE host environments and read configuration values").action(async () => {
|
|
256
261
|
if (!process.stdin.isTTY || !process.stderr.isTTY) {
|
|
257
262
|
failConfig(
|
|
258
263
|
"Interactive config requires a TTY.",
|
|
@@ -268,6 +273,20 @@ function registerConfig(program) {
|
|
|
268
273
|
configCmd.command("current").description("Show the active AE environment").action(async () => {
|
|
269
274
|
await printCurrentConfig(program);
|
|
270
275
|
});
|
|
276
|
+
configCmd.command("show").description("Show effective configuration for the selected AE host and account").action(async () => {
|
|
277
|
+
const host = program.opts().host || getActiveHost();
|
|
278
|
+
const token = host ? peekCliToken(host) : null;
|
|
279
|
+
const feature = host && token ? await resolveKbAutoDiscoveryFeature(host, token, () => fetchCliConfig(host, token)) : { enabled: false, source: "unavailable" };
|
|
280
|
+
await printOutput(
|
|
281
|
+
{
|
|
282
|
+
host: host || null,
|
|
283
|
+
routing: { knowledge_base: feature.enabled ? "auto" : "explicit" },
|
|
284
|
+
source: feature.source
|
|
285
|
+
},
|
|
286
|
+
program.opts().format || "json",
|
|
287
|
+
program.opts().jq
|
|
288
|
+
);
|
|
289
|
+
});
|
|
271
290
|
configCmd.command("use <env>").description("Switch active AE environment by exact URL or unique label").action(async (env) => {
|
|
272
291
|
await useConfigEnv(program, env);
|
|
273
292
|
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
TeAgentApiError,
|
|
4
|
+
getFromMainApp
|
|
5
|
+
} from "./chunk-PLE722AJ.js";
|
|
6
|
+
import "./chunk-Y74WTIKJ.js";
|
|
7
|
+
import "./chunk-GIK6EDUG.js";
|
|
8
|
+
import {
|
|
9
|
+
safeJsonParse
|
|
10
|
+
} from "./chunk-UQ77JXYH.js";
|
|
11
|
+
import {
|
|
12
|
+
CliValidationError
|
|
13
|
+
} from "./chunk-WNGFSIOB.js";
|
|
14
|
+
|
|
15
|
+
// src/core/current-page-context-client.ts
|
|
16
|
+
async function readCurrentPageContext(path) {
|
|
17
|
+
const url = process.env.TE_AGENT_PAGE_CONTEXT_MCP_URL;
|
|
18
|
+
const grant = process.env.TE_AGENT_PAGE_CONTEXT_TOKEN;
|
|
19
|
+
if (url === void 0 && grant === void 0) return getFromMainApp(path);
|
|
20
|
+
let endpoint;
|
|
21
|
+
try {
|
|
22
|
+
endpoint = new URL(url ?? "");
|
|
23
|
+
if (!grant || !["http:", "https:"].includes(endpoint.protocol) || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || !endpoint.pathname.endsWith("/api/internal/dashboard-context/mcp")) throw new Error();
|
|
24
|
+
} catch {
|
|
25
|
+
throw new TeAgentApiError("Current page context Run binding is invalid.", 0, "CURRENT_PAGE_CONTEXT_BINDING_INVALID");
|
|
26
|
+
}
|
|
27
|
+
let response;
|
|
28
|
+
try {
|
|
29
|
+
response = await fetch(endpoint.toString(), {
|
|
30
|
+
method: "POST",
|
|
31
|
+
redirect: "error",
|
|
32
|
+
signal: AbortSignal.timeout(3e4),
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
Accept: "application/json, text/event-stream",
|
|
36
|
+
"MCP-Protocol-Version": "2025-03-26",
|
|
37
|
+
"X-TE-Page-Context-Token": grant
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
jsonrpc: "2.0",
|
|
41
|
+
id: 1,
|
|
42
|
+
method: "tools/call",
|
|
43
|
+
params: { name: "read_current_page_context", arguments: {} }
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
} catch {
|
|
47
|
+
throw new TeAgentApiError("Current page context MCP request failed.", 0, "CURRENT_PAGE_CONTEXT_NETWORK_ERROR");
|
|
48
|
+
}
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
await response.body?.cancel();
|
|
51
|
+
throw new TeAgentApiError(
|
|
52
|
+
`Current page context authorization/request failed (HTTP ${response.status}).`,
|
|
53
|
+
response.status,
|
|
54
|
+
"CURRENT_PAGE_CONTEXT_UNAVAILABLE",
|
|
55
|
+
void 0,
|
|
56
|
+
response.status === 403 ? "permission" : response.status === 401 ? "auth" : "api"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const reader = response.body?.getReader();
|
|
60
|
+
if (!reader) throw invalidResponse();
|
|
61
|
+
const chunks = [];
|
|
62
|
+
let size = 0;
|
|
63
|
+
try {
|
|
64
|
+
while (true) {
|
|
65
|
+
const { value, done } = await reader.read();
|
|
66
|
+
if (done) break;
|
|
67
|
+
size += value.byteLength;
|
|
68
|
+
if (size > 4 * 1024 * 1024) throw invalidResponse();
|
|
69
|
+
chunks.push(value);
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
await reader.cancel().catch(() => void 0);
|
|
73
|
+
throw invalidResponse();
|
|
74
|
+
} finally {
|
|
75
|
+
reader.releaseLock();
|
|
76
|
+
}
|
|
77
|
+
let envelope;
|
|
78
|
+
try {
|
|
79
|
+
envelope = safeJsonParse(Buffer.concat(chunks).toString("utf8"));
|
|
80
|
+
} catch {
|
|
81
|
+
throw invalidResponse();
|
|
82
|
+
}
|
|
83
|
+
if (envelope?.error || envelope?.result?.isError) {
|
|
84
|
+
throw new TeAgentApiError(
|
|
85
|
+
"Current page context is unavailable for this Run; authorization may have expired or been revoked.",
|
|
86
|
+
403,
|
|
87
|
+
"CURRENT_PAGE_CONTEXT_UNAVAILABLE"
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
const content = envelope?.result?.content;
|
|
91
|
+
if (envelope?.jsonrpc !== "2.0" || envelope.id !== 1 || !Array.isArray(content) || content.length !== 1 || content[0]?.type !== "text") throw invalidResponse();
|
|
92
|
+
try {
|
|
93
|
+
return safeJsonParse(content[0].text);
|
|
94
|
+
} catch {
|
|
95
|
+
throw invalidResponse();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function invalidResponse() {
|
|
99
|
+
return new TeAgentApiError("Invalid current page context MCP response.", 0, "CURRENT_PAGE_CONTEXT_RESPONSE_INVALID");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/commands/context/current.ts
|
|
103
|
+
var CURRENT_PAGE_CONTEXT_PATH = "/api/sandbox/agent/context/current";
|
|
104
|
+
function createCurrentPageContextCommand(read = readCurrentPageContext, readConversationId = () => process.env.TE_AGENT_CONVERSATION_ID) {
|
|
105
|
+
return {
|
|
106
|
+
service: "context",
|
|
107
|
+
command: "+current",
|
|
108
|
+
description: "Read the current page context bound to the active Agent Run",
|
|
109
|
+
flags: [],
|
|
110
|
+
risk: "read",
|
|
111
|
+
usesAeHost: false,
|
|
112
|
+
execute: async () => {
|
|
113
|
+
const conversationId = readConversationId()?.trim();
|
|
114
|
+
if (!conversationId) {
|
|
115
|
+
throw new CliValidationError(
|
|
116
|
+
"Current page context is available only inside an active Agent Run.",
|
|
117
|
+
{
|
|
118
|
+
code: "CURRENT_PAGE_CONTEXT_RUN_REQUIRED",
|
|
119
|
+
hint: "Open AE Agent from a supported product page and ask about the current page."
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
const query = new URLSearchParams({ conversationId });
|
|
124
|
+
return read(`${CURRENT_PAGE_CONTEXT_PATH}?${query.toString()}`);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
var currentPageContext = createCurrentPageContextCommand();
|
|
129
|
+
|
|
130
|
+
// src/commands/context/index.ts
|
|
131
|
+
var commands = [currentPageContext];
|
|
132
|
+
var context_default = commands;
|
|
133
|
+
export {
|
|
134
|
+
currentPageContext,
|
|
135
|
+
context_default as default
|
|
136
|
+
};
|
|
@@ -8,20 +8,20 @@ import {
|
|
|
8
8
|
utils,
|
|
9
9
|
validateAndFix,
|
|
10
10
|
validateDraft
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-5XJYLEVC.js";
|
|
12
|
+
import "./chunk-CT7QDJS6.js";
|
|
13
13
|
import {
|
|
14
14
|
require_archiver
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-AP7YP2NX.js";
|
|
16
|
+
import "./chunk-S6M42KND.js";
|
|
17
17
|
import {
|
|
18
18
|
getConfigDir
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UQ77JXYH.js";
|
|
20
20
|
import {
|
|
21
21
|
CliValidationError,
|
|
22
22
|
LocalDataUploadError,
|
|
23
23
|
__toESM
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WNGFSIOB.js";
|
|
25
25
|
|
|
26
26
|
// src/commands/data-integration/inspect.ts
|
|
27
27
|
import { basename as basename3 } from "path";
|