@thinkingai/ae-cli 6.1.24 → 6.1.26
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-YHMC3GDH.js} +168 -10
- package/dist/automation-NWWVLWG2.js +459 -0
- package/dist/{capability-FYTU3X6L.js → capability-3QLLIVFB.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-HVHR4SCP.js +133 -0
- package/dist/{chunk-CCS66K4K.js → chunk-KAEHZZH4.js} +3 -3
- 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-VYXXOKYS.js → chunk-XCHAYMSF.js} +7 -4
- package/dist/{community-report-client-CU22W53K.js → community-report-client-PEERQCX2.js} +1 -1
- package/dist/{config-XO3LI3SA.js → config-AHPMEW5A.js} +25 -6
- package/dist/context-YAE3QXP3.js +136 -0
- package/dist/{data-integration-HNGUKFIC.js → data-integration-HESZET7E.js} +6 -6
- package/dist/index.js +167 -53
- 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-DI5BMYFU.js → metadata-C7CEDHOJ.js} +7 -7
- package/dist/{model-RNPQXIBI.js → model-SBV2JFJI.js} +9 -5
- package/dist/{personal-semantic-preference-5C3WUXFI.js → personal-semantic-preference-QECDPHND.js} +119 -11
- package/dist/project-semantic-Z4QAMBWF.js +356 -0
- 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-AISWCOOZ.js → te-analysis-2ECAAIFK.js} +1227 -154
- 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-BAM3GBFX.js → te-engage-QKUGIWSR.js} +6 -6
- package/dist/{te-experiment-GUTZXZ5Z.js → te-experiment-26PXR2UO.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 +55 -23
- package/skills/ae-analysis/references/adhoc_export.md +1 -1
- package/skills/ae-analysis/references/adhoc_run.md +1 -1
- 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/session.md +76 -0
- package/skills/ae-analysis/references/ai_models/tag.md +2 -0
- package/skills/ae-analysis/references/ai_models.md +100 -3
- package/skills/ae-analysis/references/analysis_data_retrieval.md +4 -0
- package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -1
- 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 +29 -19
- 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/drilldown_session_details_run.md +41 -0
- 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 +77 -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 +4 -4
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +4 -4
- 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 +18 -4
- 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 +21 -4
- 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/dist/project-semantic-3LF6Q6JZ.js +0 -1119
- 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
- package/skills/ae-project-semantic/SKILL.md +0 -193
- package/skills/ae-project-semantic/references/query-routing-v5.md +0 -165
- package/skills/ae-project-semantic/references/recommendation-quality.md +0 -68
|
@@ -3,48 +3,353 @@ import {
|
|
|
3
3
|
assertValidSkillVersion
|
|
4
4
|
} from "./chunk-T6OSFQZD.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
6
|
+
buildWorkspaceCliUrl,
|
|
7
|
+
getWorkspaceApi,
|
|
8
|
+
postWorkspaceApi,
|
|
9
|
+
previewWorkspaceResourcePath,
|
|
10
|
+
resolveWorkspaceTarget,
|
|
11
|
+
workspaceResourcePath,
|
|
12
|
+
workspaceTargetFlags,
|
|
13
|
+
workspaceTargetPath
|
|
14
|
+
} from "./chunk-HVHR4SCP.js";
|
|
15
|
+
import {
|
|
16
|
+
currentAgentSpaceId
|
|
17
|
+
} from "./chunk-RK6GLDGI.js";
|
|
18
|
+
import {
|
|
19
|
+
deleteAgentApi,
|
|
20
|
+
getAgentApi,
|
|
21
|
+
getAgentBuffer,
|
|
22
|
+
patchAgentApi,
|
|
23
|
+
postAgentApi,
|
|
24
|
+
putAgentApi,
|
|
25
|
+
uploadAgentApi
|
|
26
|
+
} from "./chunk-4655PUNX.js";
|
|
27
|
+
import {
|
|
28
|
+
resolveTeClaudeBaseUrl
|
|
29
|
+
} from "./chunk-PLE722AJ.js";
|
|
15
30
|
import {
|
|
16
31
|
buildCapabilityGatewayUrl,
|
|
17
32
|
callCapabilityApi
|
|
18
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-EOYSKMXN.js";
|
|
19
34
|
import "./chunk-Y74WTIKJ.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-GIK6EDUG.js";
|
|
36
|
+
import "./chunk-UQ77JXYH.js";
|
|
22
37
|
import {
|
|
23
38
|
CliValidationError
|
|
24
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-WNGFSIOB.js";
|
|
25
40
|
|
|
26
|
-
// src/commands/te-agent/
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
// src/commands/te-agent/notifications.ts
|
|
42
|
+
import { openSync, closeSync, fstatSync, readSync } from "fs";
|
|
43
|
+
|
|
44
|
+
// src/commands/te-agent/approval-cli-client.ts
|
|
45
|
+
var APPROVAL_GATEWAY_DOMAIN = "approval";
|
|
46
|
+
var resolveApprovalApiBaseUrl = resolveTeClaudeBaseUrl;
|
|
47
|
+
function buildApprovalCliUrl(ctx, path) {
|
|
48
|
+
return buildCapabilityGatewayUrl(resolveApprovalApiBaseUrl(ctx.host()), APPROVAL_GATEWAY_DOMAIN, path);
|
|
29
49
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
50
|
+
function requestApprovalCli(ctx, method, path, body, options = {}) {
|
|
51
|
+
return callCapabilityApi(
|
|
52
|
+
ctx.host(),
|
|
53
|
+
APPROVAL_GATEWAY_DOMAIN,
|
|
54
|
+
path,
|
|
55
|
+
method,
|
|
56
|
+
body,
|
|
57
|
+
{
|
|
58
|
+
apiBaseUrl: resolveApprovalApiBaseUrl(ctx.host()),
|
|
59
|
+
...options,
|
|
60
|
+
retryOnInvalidTokenForbidden: false
|
|
61
|
+
}
|
|
62
|
+
);
|
|
32
63
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
64
|
+
function getApprovalCli(ctx, path) {
|
|
65
|
+
return requestApprovalCli(ctx, "GET", path);
|
|
35
66
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
67
|
+
function postApprovalCli(ctx, path, body, options = {}) {
|
|
68
|
+
return requestApprovalCli(ctx, "POST", path, body, options);
|
|
38
69
|
}
|
|
39
|
-
|
|
40
|
-
|
|
70
|
+
|
|
71
|
+
// src/commands/te-agent/notifications.ts
|
|
72
|
+
var invalidUnicode = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;
|
|
73
|
+
var PREVIEW = "Dry-run is a local preview with zero business requests, not a permission check. Reading never marks notifications as read. Retry a send with the same client-request-id and identical content.";
|
|
74
|
+
var flag = (name, desc, type = "string", required = false, sensitive = false) => ({ name, desc, type, required, sensitive });
|
|
75
|
+
var validId = (value) => typeof value === "string" && value.length > 0 && value.length <= 191 && value.trim() === value && !/[\x00-\x1f\x7f]/.test(value);
|
|
76
|
+
function ids(ctx, key) {
|
|
77
|
+
const value = ctx.json(key);
|
|
78
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > 100 || value.some((v) => !validId(v)))
|
|
79
|
+
throw new CliValidationError(
|
|
80
|
+
"Provide a JSON array of 1-100 non-empty user or notification IDs."
|
|
81
|
+
);
|
|
82
|
+
return value;
|
|
41
83
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
84
|
+
function identifier(ctx) {
|
|
85
|
+
const value = ctx.str("notificationId");
|
|
86
|
+
if (!validId(value))
|
|
87
|
+
throw new CliValidationError(
|
|
88
|
+
"--notification-id must be a non-empty ID of at most 191 characters."
|
|
89
|
+
);
|
|
90
|
+
return encodeURIComponent(value);
|
|
44
91
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
92
|
+
function sendBody(ctx) {
|
|
93
|
+
const title = ctx.str("title");
|
|
94
|
+
if (!title.trim() || [...title].length > 200 || invalidUnicode.test(title))
|
|
95
|
+
throw new CliValidationError(
|
|
96
|
+
"--title must contain 1-200 Unicode characters."
|
|
97
|
+
);
|
|
98
|
+
const hasBody = ctx.has?.("body") ?? !!ctx.str("body");
|
|
99
|
+
const file = ctx.str("bodyFile");
|
|
100
|
+
if (file && hasBody)
|
|
101
|
+
throw new CliValidationError("Use either --body or --body-file, not both.");
|
|
102
|
+
let body = ctx.str("body");
|
|
103
|
+
if (file) {
|
|
104
|
+
let descriptor;
|
|
105
|
+
try {
|
|
106
|
+
descriptor = openSync(file, "r");
|
|
107
|
+
if (!fstatSync(descriptor).isFile())
|
|
108
|
+
throw new Error("Not a regular file");
|
|
109
|
+
const bytes = Buffer.alloc(16385);
|
|
110
|
+
let count = 0;
|
|
111
|
+
while (count < bytes.length) {
|
|
112
|
+
const n = readSync(
|
|
113
|
+
descriptor,
|
|
114
|
+
bytes,
|
|
115
|
+
count,
|
|
116
|
+
bytes.length - count,
|
|
117
|
+
null
|
|
118
|
+
);
|
|
119
|
+
if (!n) break;
|
|
120
|
+
count += n;
|
|
121
|
+
}
|
|
122
|
+
if (count > 16384) throw new Error("Too large");
|
|
123
|
+
body = new TextDecoder("utf-8", { fatal: true }).decode(
|
|
124
|
+
bytes.subarray(0, count)
|
|
125
|
+
);
|
|
126
|
+
} catch {
|
|
127
|
+
throw new CliValidationError(
|
|
128
|
+
"--body-file must be a readable UTF-8 text file of at most 16 KiB."
|
|
129
|
+
);
|
|
130
|
+
} finally {
|
|
131
|
+
if (descriptor !== void 0) closeSync(descriptor);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (Buffer.byteLength(body) > 16384 || invalidUnicode.test(body))
|
|
135
|
+
throw new CliValidationError(
|
|
136
|
+
"--body must be valid Unicode text of at most 16 KiB."
|
|
137
|
+
);
|
|
138
|
+
const format = ctx.str("bodyFormat") || "text";
|
|
139
|
+
if (!["text", "markdown"].includes(format))
|
|
140
|
+
throw new CliValidationError("--body-format must be text or markdown.");
|
|
141
|
+
const key = ctx.str("clientRequestId");
|
|
142
|
+
if (!/^[\x21-\x7e]{1,128}$/.test(key))
|
|
143
|
+
throw new CliValidationError(
|
|
144
|
+
"--client-request-id must contain 1-128 printable ASCII characters without spaces."
|
|
145
|
+
);
|
|
146
|
+
return {
|
|
147
|
+
to_user_ids: ids(ctx, "toUserIds"),
|
|
148
|
+
title,
|
|
149
|
+
body,
|
|
150
|
+
body_format: format,
|
|
151
|
+
client_request_id: key
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function query(ctx, mode) {
|
|
155
|
+
const params = new URLSearchParams();
|
|
156
|
+
if (mode !== "count") {
|
|
157
|
+
const limit = ctx.optionalNum("limit") ?? 20;
|
|
158
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
159
|
+
throw new CliValidationError(
|
|
160
|
+
"--limit must be an integer between 1 and 100."
|
|
161
|
+
);
|
|
162
|
+
params.set("limit", String(limit));
|
|
163
|
+
const cursor = ctx.str("cursor");
|
|
164
|
+
if (cursor) {
|
|
165
|
+
if (cursor.length > (mode === "recipients" ? 191 : 2048))
|
|
166
|
+
throw new CliValidationError("--cursor is too long.");
|
|
167
|
+
params.set("cursor", cursor);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (mode === "recipients") {
|
|
171
|
+
if (ctx.str("query").length > 100)
|
|
172
|
+
throw new CliValidationError("--query exceeds 100 characters.");
|
|
173
|
+
if (ctx.str("query")) params.set("query", ctx.str("query"));
|
|
174
|
+
} else {
|
|
175
|
+
for (const key of ["source", "type"]) {
|
|
176
|
+
const value = ctx.str(key);
|
|
177
|
+
if (value && (!/^[a-z][a-z0-9._-]*$/.test(value) || value.length > (key === "source" ? 64 : 128)))
|
|
178
|
+
throw new CliValidationError(`--${key} is invalid.`);
|
|
179
|
+
if (value) params.set(key, value);
|
|
180
|
+
}
|
|
181
|
+
for (const [key, name] of [
|
|
182
|
+
["createdFrom", "created_from"],
|
|
183
|
+
["createdBefore", "created_before"]
|
|
184
|
+
]) {
|
|
185
|
+
const value = ctx.str(key);
|
|
186
|
+
if (value && (!/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/.test(value) || !Number.isFinite(Date.parse(value))))
|
|
187
|
+
throw new CliValidationError(
|
|
188
|
+
`${name} must be an ISO 8601 timestamp with a timezone.`
|
|
189
|
+
);
|
|
190
|
+
if (value) params.set(name, value);
|
|
191
|
+
}
|
|
192
|
+
if (ctx.str("createdFrom") && ctx.str("createdBefore") && Date.parse(ctx.str("createdFrom")) >= Date.parse(ctx.str("createdBefore")))
|
|
193
|
+
throw new CliValidationError(
|
|
194
|
+
"--created-from must be earlier than --created-before."
|
|
195
|
+
);
|
|
196
|
+
if (mode === "list") {
|
|
197
|
+
const status = ctx.str("readStatus") || "all";
|
|
198
|
+
if (!["all", "unread", "read"].includes(status))
|
|
199
|
+
throw new CliValidationError(
|
|
200
|
+
"--read-status must be all, unread, or read."
|
|
201
|
+
);
|
|
202
|
+
params.set("read_status", status);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return params.toString() ? `?${params}` : "";
|
|
47
206
|
}
|
|
207
|
+
function command(name, description, flags, method, path, body) {
|
|
208
|
+
return {
|
|
209
|
+
service: "agent",
|
|
210
|
+
resource: "notification",
|
|
211
|
+
command: name,
|
|
212
|
+
description,
|
|
213
|
+
helpText: PREVIEW,
|
|
214
|
+
flags,
|
|
215
|
+
risk: method === "GET" ? "read" : "write",
|
|
216
|
+
validate(ctx) {
|
|
217
|
+
path(ctx);
|
|
218
|
+
body?.(ctx);
|
|
219
|
+
},
|
|
220
|
+
dryRun(ctx) {
|
|
221
|
+
const payload = body?.(ctx);
|
|
222
|
+
return {
|
|
223
|
+
method,
|
|
224
|
+
url: buildCapabilityGatewayUrl(
|
|
225
|
+
resolveApprovalApiBaseUrl(ctx.host()),
|
|
226
|
+
"agent",
|
|
227
|
+
path(ctx)
|
|
228
|
+
),
|
|
229
|
+
...payload ? {
|
|
230
|
+
body: name === "send" ? { ...payload, title: "[redacted]", body: "[redacted]" } : payload
|
|
231
|
+
} : {}
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
execute(ctx) {
|
|
235
|
+
return callCapabilityApi(
|
|
236
|
+
ctx.host(),
|
|
237
|
+
"agent",
|
|
238
|
+
path(ctx),
|
|
239
|
+
method,
|
|
240
|
+
body?.(ctx),
|
|
241
|
+
{
|
|
242
|
+
apiBaseUrl: resolveApprovalApiBaseUrl(ctx.host()),
|
|
243
|
+
retryOnInvalidTokenForbidden: false,
|
|
244
|
+
retryOnUnauthorized: true
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
var pagination = [
|
|
251
|
+
flag("limit", "Page size, 1-100 (default 20)", "number"),
|
|
252
|
+
flag("cursor", "Opaque cursor from the previous response")
|
|
253
|
+
];
|
|
254
|
+
var filters = [
|
|
255
|
+
flag("source", "Exact producer filter"),
|
|
256
|
+
flag("type", "Exact notification type filter"),
|
|
257
|
+
flag("created-from", "Inclusive ISO 8601 creation timestamp"),
|
|
258
|
+
flag("created-before", "Exclusive ISO 8601 creation timestamp")
|
|
259
|
+
];
|
|
260
|
+
var notificationRecipients = command(
|
|
261
|
+
"recipients",
|
|
262
|
+
"Find enabled recipients in your company, including yourself",
|
|
263
|
+
[flag("query", "Search by name or display name"), ...pagination],
|
|
264
|
+
"GET",
|
|
265
|
+
(ctx) => `notifications/recipients${query(ctx, "recipients")}`
|
|
266
|
+
);
|
|
267
|
+
var notificationSend = command(
|
|
268
|
+
"send",
|
|
269
|
+
"Send an in-app user notification to explicit recipients",
|
|
270
|
+
[
|
|
271
|
+
flag(
|
|
272
|
+
"to-user-ids",
|
|
273
|
+
"Recipient user IDs as a JSON array, 1-100 entries",
|
|
274
|
+
"json",
|
|
275
|
+
true
|
|
276
|
+
),
|
|
277
|
+
flag(
|
|
278
|
+
"title",
|
|
279
|
+
"Notification title, up to 200 Unicode characters",
|
|
280
|
+
"string",
|
|
281
|
+
true,
|
|
282
|
+
true
|
|
283
|
+
),
|
|
284
|
+
flag("body", "Notification body, at most 16 KiB", "string", false, true),
|
|
285
|
+
flag(
|
|
286
|
+
"body-file",
|
|
287
|
+
"UTF-8 text file, mutually exclusive with --body",
|
|
288
|
+
"string",
|
|
289
|
+
false,
|
|
290
|
+
true
|
|
291
|
+
),
|
|
292
|
+
flag("body-format", "text (default) or markdown"),
|
|
293
|
+
flag(
|
|
294
|
+
"client-request-id",
|
|
295
|
+
"Required stable idempotency key; reuse for identical retries",
|
|
296
|
+
"string",
|
|
297
|
+
true,
|
|
298
|
+
true
|
|
299
|
+
)
|
|
300
|
+
],
|
|
301
|
+
"POST",
|
|
302
|
+
() => "notifications",
|
|
303
|
+
sendBody
|
|
304
|
+
);
|
|
305
|
+
var notificationList = command(
|
|
306
|
+
"list",
|
|
307
|
+
"List your notifications without changing read state",
|
|
308
|
+
[
|
|
309
|
+
...filters,
|
|
310
|
+
...pagination,
|
|
311
|
+
flag("read-status", "all (default), unread, or read")
|
|
312
|
+
],
|
|
313
|
+
"GET",
|
|
314
|
+
(ctx) => `notifications${query(ctx, "list")}`
|
|
315
|
+
);
|
|
316
|
+
var notificationGet = command(
|
|
317
|
+
"get",
|
|
318
|
+
"Read a notification and its opaque business data",
|
|
319
|
+
[flag("notification-id", "Notification ID", "string", true)],
|
|
320
|
+
"GET",
|
|
321
|
+
(ctx) => `notifications/${identifier(ctx)}`
|
|
322
|
+
);
|
|
323
|
+
var notificationUnreadCount = command(
|
|
324
|
+
"unread-count",
|
|
325
|
+
"Count your visible unread notifications",
|
|
326
|
+
filters,
|
|
327
|
+
"GET",
|
|
328
|
+
(ctx) => `notifications/unread-count${query(ctx, "count")}`
|
|
329
|
+
);
|
|
330
|
+
var notificationMarkRead = command(
|
|
331
|
+
"mark-read",
|
|
332
|
+
"Mark only the specified notifications as read",
|
|
333
|
+
[
|
|
334
|
+
flag(
|
|
335
|
+
"notification-ids",
|
|
336
|
+
"Notification IDs as a JSON array, 1-100 entries",
|
|
337
|
+
"json",
|
|
338
|
+
true
|
|
339
|
+
)
|
|
340
|
+
],
|
|
341
|
+
"POST",
|
|
342
|
+
() => "notifications/read",
|
|
343
|
+
(ctx) => ({ notification_ids: ids(ctx, "notificationIds") })
|
|
344
|
+
);
|
|
345
|
+
var notificationCommands = [
|
|
346
|
+
notificationRecipients,
|
|
347
|
+
notificationSend,
|
|
348
|
+
notificationList,
|
|
349
|
+
notificationGet,
|
|
350
|
+
notificationUnreadCount,
|
|
351
|
+
notificationMarkRead
|
|
352
|
+
];
|
|
48
353
|
|
|
49
354
|
// src/commands/te-agent/agents.ts
|
|
50
355
|
var BASE_PATH = "/api/sandbox/agent/agents";
|
|
@@ -248,37 +553,10 @@ var getAgent = {
|
|
|
248
553
|
}
|
|
249
554
|
};
|
|
250
555
|
|
|
251
|
-
// src/commands/te-agent/approval-cli-client.ts
|
|
252
|
-
var APPROVAL_GATEWAY_DOMAIN = "approval";
|
|
253
|
-
var resolveApprovalApiBaseUrl = resolveTeClaudeBaseUrl;
|
|
254
|
-
function buildApprovalCliUrl(ctx, path) {
|
|
255
|
-
return buildCapabilityGatewayUrl(resolveApprovalApiBaseUrl(ctx.host()), APPROVAL_GATEWAY_DOMAIN, path);
|
|
256
|
-
}
|
|
257
|
-
function requestApprovalCli(ctx, method, path, body, options = {}) {
|
|
258
|
-
return callCapabilityApi(
|
|
259
|
-
ctx.host(),
|
|
260
|
-
APPROVAL_GATEWAY_DOMAIN,
|
|
261
|
-
path,
|
|
262
|
-
method,
|
|
263
|
-
body,
|
|
264
|
-
{
|
|
265
|
-
apiBaseUrl: resolveApprovalApiBaseUrl(ctx.host()),
|
|
266
|
-
...options,
|
|
267
|
-
retryOnInvalidTokenForbidden: false
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
function getApprovalCli(ctx, path) {
|
|
272
|
-
return requestApprovalCli(ctx, "GET", path);
|
|
273
|
-
}
|
|
274
|
-
function postApprovalCli(ctx, path, body, options = {}) {
|
|
275
|
-
return requestApprovalCli(ctx, "POST", path, body, options);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
556
|
// src/commands/te-agent/agent-context.ts
|
|
279
557
|
function contextPath(ctx) {
|
|
280
|
-
const
|
|
281
|
-
return `agents/${encodeURIComponent(ctx.str("id"))}/context${
|
|
558
|
+
const query2 = ctx.bool("includeMcpCredentials") ? "?include_mcp_credentials=true" : "";
|
|
559
|
+
return `agents/${encodeURIComponent(ctx.str("id"))}/context${query2}`;
|
|
282
560
|
}
|
|
283
561
|
var getAgentContext = {
|
|
284
562
|
service: "agent",
|
|
@@ -314,11 +592,11 @@ var agentIdFlag = {
|
|
|
314
592
|
required: true,
|
|
315
593
|
desc: "Personal Agent ID from agent +list-agents"
|
|
316
594
|
};
|
|
317
|
-
function requireId(ctx, key,
|
|
595
|
+
function requireId(ctx, key, flag2) {
|
|
318
596
|
const value = ctx.str(key);
|
|
319
597
|
if (!value || value !== value.trim() || value.length > 191) {
|
|
320
598
|
throw new CliValidationError(
|
|
321
|
-
`--${
|
|
599
|
+
`--${flag2} must be a non-empty identifier of at most 191 characters`
|
|
322
600
|
);
|
|
323
601
|
}
|
|
324
602
|
return value;
|
|
@@ -536,10 +814,10 @@ function recipientsPath(ctx) {
|
|
|
536
814
|
const limit = ctx.optionalNum("limit") ?? 20;
|
|
537
815
|
if (!Number.isInteger(limit) || limit < 1 || limit > 50)
|
|
538
816
|
throw new CliValidationError("--limit must be an integer between 1 and 50");
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
817
|
+
const query2 = ctx.str("query").trim();
|
|
818
|
+
if (query2.length > 100) throw new CliValidationError("--query must not exceed 100 characters");
|
|
541
819
|
const params = new URLSearchParams({ limit: String(limit) });
|
|
542
|
-
if (
|
|
820
|
+
if (query2) params.set("query", query2);
|
|
543
821
|
if (ctx.str("cursor")) params.set("cursor", requireId(ctx, "cursor", "cursor"));
|
|
544
822
|
return `recipients?${params}`;
|
|
545
823
|
}
|
|
@@ -2803,400 +3081,15 @@ var attachmentStats = {
|
|
|
2803
3081
|
}
|
|
2804
3082
|
};
|
|
2805
3083
|
|
|
2806
|
-
// src/commands/te-agent/automations.ts
|
|
2807
|
-
var BASE_PATH6 = "/api/sandbox/agent/automations";
|
|
2808
|
-
var SCHEDULE_KINDS = ["hourly", "daily", "weekly", "monthly"];
|
|
2809
|
-
var TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
2810
|
-
var AUTOMATION_STATUSES = ["active", "paused"];
|
|
2811
|
-
function optional(value) {
|
|
2812
|
-
const trimmed = value.trim();
|
|
2813
|
-
return trimmed ? trimmed : void 0;
|
|
2814
|
-
}
|
|
2815
|
-
function envOptional(name) {
|
|
2816
|
-
return optional(process.env[name] ?? "");
|
|
2817
|
-
}
|
|
2818
|
-
function readEnabled(ctx) {
|
|
2819
|
-
return readEnabledOptional(ctx) ?? true;
|
|
2820
|
-
}
|
|
2821
|
-
function readEnabledOptional(ctx) {
|
|
2822
|
-
const enabled = ctx.json("enabled");
|
|
2823
|
-
if (enabled === void 0) return void 0;
|
|
2824
|
-
if (typeof enabled !== "boolean") {
|
|
2825
|
-
throw new Error("--enabled \u5FC5\u987B\u662F true \u6216 false");
|
|
2826
|
-
}
|
|
2827
|
-
return enabled;
|
|
2828
|
-
}
|
|
2829
|
-
function readReuseConversation(ctx) {
|
|
2830
|
-
return readReuseConversationOptional(ctx) ?? false;
|
|
2831
|
-
}
|
|
2832
|
-
function readReuseConversationOptional(ctx) {
|
|
2833
|
-
const reuseConversation = ctx.json("reuseConversation");
|
|
2834
|
-
if (reuseConversation === void 0) return void 0;
|
|
2835
|
-
if (typeof reuseConversation !== "boolean") {
|
|
2836
|
-
throw new Error("--reuse-conversation must be true or false");
|
|
2837
|
-
}
|
|
2838
|
-
return reuseConversation;
|
|
2839
|
-
}
|
|
2840
|
-
function buildSchedule(ctx) {
|
|
2841
|
-
const kind = optional(ctx.str("scheduleKind"));
|
|
2842
|
-
if (!kind) return void 0;
|
|
2843
|
-
if (kind === "hourly") {
|
|
2844
|
-
const minute = ctx.str("minute") ? ctx.num("minute") : void 0;
|
|
2845
|
-
return { kind, ...minute === void 0 ? {} : { minute } };
|
|
2846
|
-
}
|
|
2847
|
-
if (kind === "daily") return { kind, time: ctx.str("time") };
|
|
2848
|
-
if (kind === "weekly") {
|
|
2849
|
-
return { kind, time: ctx.str("time"), weekday: ctx.num("weekday") };
|
|
2850
|
-
}
|
|
2851
|
-
return {
|
|
2852
|
-
kind: "monthly",
|
|
2853
|
-
time: ctx.str("time"),
|
|
2854
|
-
dayOfMonth: ctx.num("dayOfMonth")
|
|
2855
|
-
};
|
|
2856
|
-
}
|
|
2857
|
-
function hasScheduleDetail(ctx) {
|
|
2858
|
-
return Boolean(
|
|
2859
|
-
optional(ctx.str("time")) || optional(ctx.str("minute")) || optional(ctx.str("weekday")) || optional(ctx.str("dayOfMonth"))
|
|
2860
|
-
);
|
|
2861
|
-
}
|
|
2862
|
-
function validateSchedule(ctx, required) {
|
|
2863
|
-
const cron = optional(ctx.str("cron"));
|
|
2864
|
-
const kind = optional(ctx.str("scheduleKind"));
|
|
2865
|
-
if (cron && kind) {
|
|
2866
|
-
throw new Error("--cron \u4E0E --schedule-kind \u53EA\u80FD\u4E8C\u9009\u4E00");
|
|
2867
|
-
}
|
|
2868
|
-
if (!cron && !kind) {
|
|
2869
|
-
if (required || hasScheduleDetail(ctx)) {
|
|
2870
|
-
throw new Error("\u5FC5\u987B\u63D0\u4F9B --cron \u6216 --schedule-kind");
|
|
2871
|
-
}
|
|
2872
|
-
return;
|
|
2873
|
-
}
|
|
2874
|
-
if (!kind) return;
|
|
2875
|
-
if (!SCHEDULE_KINDS.includes(kind)) {
|
|
2876
|
-
throw new Error("--schedule-kind \u5FC5\u987B\u662F hourly\u3001daily\u3001weekly \u6216 monthly");
|
|
2877
|
-
}
|
|
2878
|
-
const time = optional(ctx.str("time"));
|
|
2879
|
-
if (kind !== "hourly") {
|
|
2880
|
-
if (!time) throw new Error(`${kind} \u8C03\u5EA6\u5FC5\u987B\u63D0\u4F9B --time HH:mm`);
|
|
2881
|
-
if (!TIME_RE.test(time)) throw new Error("--time \u683C\u5F0F\u5FC5\u987B\u662F HH:mm");
|
|
2882
|
-
}
|
|
2883
|
-
if (kind === "hourly" && ctx.str("minute")) {
|
|
2884
|
-
const minute = ctx.num("minute");
|
|
2885
|
-
if (!Number.isInteger(minute) || minute < 0 || minute > 59) {
|
|
2886
|
-
throw new Error("--minute \u5FC5\u987B\u662F 0-59 \u7684\u6574\u6570");
|
|
2887
|
-
}
|
|
2888
|
-
}
|
|
2889
|
-
if (kind === "weekly") {
|
|
2890
|
-
const weekday = ctx.num("weekday");
|
|
2891
|
-
if (!Number.isInteger(weekday) || weekday < 0 || weekday > 6) {
|
|
2892
|
-
throw new Error("--weekday \u5FC5\u987B\u662F 0-6 \u7684\u6574\u6570\uFF0C0 \u8868\u793A\u5468\u65E5");
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
|
-
if (kind === "monthly") {
|
|
2896
|
-
const dayOfMonth = ctx.num("dayOfMonth");
|
|
2897
|
-
if (!Number.isInteger(dayOfMonth) || dayOfMonth < 1 || dayOfMonth > 28) {
|
|
2898
|
-
throw new Error("--day-of-month \u5FC5\u987B\u662F 1-28 \u7684\u6574\u6570");
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
function buildCreateBody(ctx) {
|
|
2903
|
-
const explicitAgentId = optional(ctx.str("agentId"));
|
|
2904
|
-
const explicitAgentName = optional(ctx.str("agentName"));
|
|
2905
|
-
const agentId = explicitAgentId ?? (explicitAgentName ? void 0 : envOptional("TE_AGENT_CURRENT_AGENT_ID"));
|
|
2906
|
-
const conversationId = optional(ctx.str("conversationId")) ?? envOptional("TE_AGENT_CONVERSATION_ID");
|
|
2907
|
-
const model = optional(ctx.str("model")) ?? envOptional("TE_AGENT_CURRENT_MODEL_ID");
|
|
2908
|
-
const enabled = readEnabled(ctx);
|
|
2909
|
-
const agentSpaceId = optional(ctx.str("agentSpaceId"));
|
|
2910
|
-
return {
|
|
2911
|
-
name: ctx.str("name"),
|
|
2912
|
-
message: ctx.str("message"),
|
|
2913
|
-
agentId,
|
|
2914
|
-
agentName: explicitAgentName,
|
|
2915
|
-
conversationId,
|
|
2916
|
-
...agentSpaceId ? { agentSpaceId } : {},
|
|
2917
|
-
cronExpression: optional(ctx.str("cron")),
|
|
2918
|
-
schedule: buildSchedule(ctx),
|
|
2919
|
-
triggerType: "scheduled",
|
|
2920
|
-
model,
|
|
2921
|
-
reuseConversation: readReuseConversation(ctx),
|
|
2922
|
-
status: enabled ? "active" : "paused"
|
|
2923
|
-
};
|
|
2924
|
-
}
|
|
2925
|
-
function buildListPath(ctx) {
|
|
2926
|
-
const params = new URLSearchParams();
|
|
2927
|
-
const q = optional(ctx.str("q"));
|
|
2928
|
-
const status = optional(ctx.str("status"));
|
|
2929
|
-
const limit = optional(ctx.str("limit"));
|
|
2930
|
-
const agentSpaceId = optional(ctx.str("agentSpaceId"));
|
|
2931
|
-
if (q) params.set("q", q);
|
|
2932
|
-
if (status) params.set("status", status);
|
|
2933
|
-
if (limit) params.set("limit", String(ctx.num("limit")));
|
|
2934
|
-
if (agentSpaceId) params.set("agentSpaceId", agentSpaceId);
|
|
2935
|
-
const query = params.toString();
|
|
2936
|
-
return query ? `${BASE_PATH6}?${query}` : BASE_PATH6;
|
|
2937
|
-
}
|
|
2938
|
-
function validateList(ctx) {
|
|
2939
|
-
const status = optional(ctx.str("status"));
|
|
2940
|
-
if (status && !AUTOMATION_STATUSES.includes(status)) {
|
|
2941
|
-
throw new Error("--status \u5FC5\u987B\u662F active \u6216 paused");
|
|
2942
|
-
}
|
|
2943
|
-
if (ctx.str("limit")) {
|
|
2944
|
-
const limit = ctx.num("limit");
|
|
2945
|
-
if (!Number.isInteger(limit) || limit < 1 || limit > 50) {
|
|
2946
|
-
throw new Error("--limit \u5FC5\u987B\u662F 1-10000 \u7684\u6574\u6570");
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
function buildUpdateBody2(ctx) {
|
|
2951
|
-
const enabled = readEnabledOptional(ctx);
|
|
2952
|
-
const reuseConversation = readReuseConversationOptional(ctx);
|
|
2953
|
-
const body = {};
|
|
2954
|
-
const name = optional(ctx.str("name"));
|
|
2955
|
-
const message = optional(ctx.str("message"));
|
|
2956
|
-
const cron = optional(ctx.str("cron"));
|
|
2957
|
-
const schedule = buildSchedule(ctx);
|
|
2958
|
-
if (name) body.name = name;
|
|
2959
|
-
if (message !== void 0) body.message = message;
|
|
2960
|
-
if (enabled !== void 0) body.status = enabled ? "active" : "paused";
|
|
2961
|
-
if (reuseConversation !== void 0)
|
|
2962
|
-
body.reuseConversation = reuseConversation;
|
|
2963
|
-
if (cron) body.cronExpression = cron;
|
|
2964
|
-
if (schedule) body.schedule = schedule;
|
|
2965
|
-
return body;
|
|
2966
|
-
}
|
|
2967
|
-
function validateUpdate(ctx) {
|
|
2968
|
-
validateSchedule(ctx, false);
|
|
2969
|
-
if (!Object.keys(buildUpdateBody2(ctx)).length) {
|
|
2970
|
-
throw new Error("\u81F3\u5C11\u63D0\u4F9B\u4E00\u4E2A\u66F4\u65B0\u5B57\u6BB5");
|
|
2971
|
-
}
|
|
2972
|
-
}
|
|
2973
|
-
function buildUpdatePath(ctx) {
|
|
2974
|
-
const path = `${BASE_PATH6}/${encodeURIComponent(ctx.str("id"))}`;
|
|
2975
|
-
const agentSpaceId = optional(ctx.str("agentSpaceId"));
|
|
2976
|
-
const params = new URLSearchParams();
|
|
2977
|
-
if (agentSpaceId) params.set("agentSpaceId", agentSpaceId);
|
|
2978
|
-
return agentSpaceId ? `${path}?${params}` : path;
|
|
2979
|
-
}
|
|
2980
|
-
var scheduleFlags = [
|
|
2981
|
-
{
|
|
2982
|
-
name: "cron",
|
|
2983
|
-
type: "string",
|
|
2984
|
-
required: false,
|
|
2985
|
-
desc: "Cron expression for supported hourly/daily/weekly/monthly schedules"
|
|
2986
|
-
},
|
|
2987
|
-
{
|
|
2988
|
-
name: "schedule-kind",
|
|
2989
|
-
type: "string",
|
|
2990
|
-
required: false,
|
|
2991
|
-
desc: "hourly | daily | weekly | monthly"
|
|
2992
|
-
},
|
|
2993
|
-
{
|
|
2994
|
-
name: "time",
|
|
2995
|
-
type: "string",
|
|
2996
|
-
required: false,
|
|
2997
|
-
desc: "Time in HH:mm for daily/weekly/monthly"
|
|
2998
|
-
},
|
|
2999
|
-
{
|
|
3000
|
-
name: "minute",
|
|
3001
|
-
type: "number",
|
|
3002
|
-
required: false,
|
|
3003
|
-
desc: "Minute 0-59 for hourly schedules"
|
|
3004
|
-
},
|
|
3005
|
-
{
|
|
3006
|
-
name: "weekday",
|
|
3007
|
-
type: "number",
|
|
3008
|
-
required: false,
|
|
3009
|
-
desc: "Weekday 0-6 for weekly schedules; 0 is Sunday"
|
|
3010
|
-
},
|
|
3011
|
-
{
|
|
3012
|
-
name: "day-of-month",
|
|
3013
|
-
type: "number",
|
|
3014
|
-
required: false,
|
|
3015
|
-
desc: "Day 1-28 for monthly schedules"
|
|
3016
|
-
}
|
|
3017
|
-
];
|
|
3018
|
-
var listAutomations = {
|
|
3019
|
-
service: "agent",
|
|
3020
|
-
command: "+list-automations",
|
|
3021
|
-
description: "List current user's Agent automation tasks in a workspace",
|
|
3022
|
-
flags: [
|
|
3023
|
-
{
|
|
3024
|
-
name: "agent-space-id",
|
|
3025
|
-
type: "string",
|
|
3026
|
-
required: false,
|
|
3027
|
-
maxLength: 191,
|
|
3028
|
-
desc: "Workspace ID; omit for the personal default workspace"
|
|
3029
|
-
},
|
|
3030
|
-
{
|
|
3031
|
-
name: "q",
|
|
3032
|
-
type: "string",
|
|
3033
|
-
required: false,
|
|
3034
|
-
desc: "Keyword for automation name or instruction"
|
|
3035
|
-
},
|
|
3036
|
-
{
|
|
3037
|
-
name: "status",
|
|
3038
|
-
type: "string",
|
|
3039
|
-
required: false,
|
|
3040
|
-
desc: "active | paused"
|
|
3041
|
-
},
|
|
3042
|
-
{
|
|
3043
|
-
name: "limit",
|
|
3044
|
-
type: "number",
|
|
3045
|
-
required: false,
|
|
3046
|
-
desc: "Maximum number of automations to return, 1-10000"
|
|
3047
|
-
}
|
|
3048
|
-
],
|
|
3049
|
-
risk: "read",
|
|
3050
|
-
validate: validateList,
|
|
3051
|
-
dryRun: (ctx) => ({
|
|
3052
|
-
method: "GET",
|
|
3053
|
-
url: buildListPath(ctx)
|
|
3054
|
-
}),
|
|
3055
|
-
execute: async (ctx) => getAgentApi(ctx, buildListPath(ctx))
|
|
3056
|
-
};
|
|
3057
|
-
var createAutomation = {
|
|
3058
|
-
service: "agent",
|
|
3059
|
-
command: "+create-automation",
|
|
3060
|
-
description: "Create an Agent automation task",
|
|
3061
|
-
flags: [
|
|
3062
|
-
{
|
|
3063
|
-
name: "name",
|
|
3064
|
-
type: "string",
|
|
3065
|
-
required: true,
|
|
3066
|
-
desc: "Automation task name"
|
|
3067
|
-
},
|
|
3068
|
-
{
|
|
3069
|
-
name: "message",
|
|
3070
|
-
type: "string",
|
|
3071
|
-
required: true,
|
|
3072
|
-
desc: "Instruction sent to the Agent"
|
|
3073
|
-
},
|
|
3074
|
-
{
|
|
3075
|
-
name: "agent-id",
|
|
3076
|
-
type: "string",
|
|
3077
|
-
required: false,
|
|
3078
|
-
desc: "Agent ID; defaults to current conversation Agent"
|
|
3079
|
-
},
|
|
3080
|
-
{
|
|
3081
|
-
name: "agent-name",
|
|
3082
|
-
type: "string",
|
|
3083
|
-
required: false,
|
|
3084
|
-
desc: "Agent name; use only after +list-agents discovery"
|
|
3085
|
-
},
|
|
3086
|
-
{
|
|
3087
|
-
name: "model",
|
|
3088
|
-
type: "string",
|
|
3089
|
-
required: false,
|
|
3090
|
-
desc: "Model record ID; defaults to current selected model"
|
|
3091
|
-
},
|
|
3092
|
-
{
|
|
3093
|
-
name: "enabled",
|
|
3094
|
-
type: "boolean",
|
|
3095
|
-
required: false,
|
|
3096
|
-
desc: "Whether to enable the automation immediately; defaults to true"
|
|
3097
|
-
},
|
|
3098
|
-
{
|
|
3099
|
-
name: "reuse-conversation",
|
|
3100
|
-
type: "boolean",
|
|
3101
|
-
required: false,
|
|
3102
|
-
desc: "Continue future runs in the same conversation; defaults to false"
|
|
3103
|
-
},
|
|
3104
|
-
{
|
|
3105
|
-
name: "conversation-id",
|
|
3106
|
-
type: "string",
|
|
3107
|
-
required: false,
|
|
3108
|
-
desc: "Conversation ID fallback for resolving the Agent and workspace"
|
|
3109
|
-
},
|
|
3110
|
-
{
|
|
3111
|
-
name: "agent-space-id",
|
|
3112
|
-
type: "string",
|
|
3113
|
-
required: false,
|
|
3114
|
-
maxLength: 191,
|
|
3115
|
-
desc: "Workspace ID; omit to inherit the conversation workspace, then the personal default"
|
|
3116
|
-
},
|
|
3117
|
-
...scheduleFlags
|
|
3118
|
-
],
|
|
3119
|
-
risk: "write",
|
|
3120
|
-
validate: (ctx) => {
|
|
3121
|
-
if (ctx.str("agentId") && ctx.str("agentName")) {
|
|
3122
|
-
throw new Error("--agent-id \u4E0E --agent-name \u53EA\u80FD\u4E8C\u9009\u4E00");
|
|
3123
|
-
}
|
|
3124
|
-
validateSchedule(ctx, true);
|
|
3125
|
-
},
|
|
3126
|
-
dryRun: (ctx) => ({
|
|
3127
|
-
method: "POST",
|
|
3128
|
-
url: BASE_PATH6,
|
|
3129
|
-
body: buildCreateBody(ctx)
|
|
3130
|
-
}),
|
|
3131
|
-
execute: async (ctx) => postAgentApi(ctx, BASE_PATH6, buildCreateBody(ctx))
|
|
3132
|
-
};
|
|
3133
|
-
var updateAutomation = {
|
|
3134
|
-
service: "agent",
|
|
3135
|
-
command: "+update-automation",
|
|
3136
|
-
description: "Update an Agent automation task",
|
|
3137
|
-
flags: [
|
|
3138
|
-
{
|
|
3139
|
-
name: "id",
|
|
3140
|
-
type: "string",
|
|
3141
|
-
required: true,
|
|
3142
|
-
desc: "Automation task ID from +list-automations"
|
|
3143
|
-
},
|
|
3144
|
-
{
|
|
3145
|
-
name: "agent-space-id",
|
|
3146
|
-
type: "string",
|
|
3147
|
-
required: false,
|
|
3148
|
-
maxLength: 191,
|
|
3149
|
-
desc: "Task's workspace ID; omit for the personal default workspace. Does not move the task"
|
|
3150
|
-
},
|
|
3151
|
-
{
|
|
3152
|
-
name: "name",
|
|
3153
|
-
type: "string",
|
|
3154
|
-
required: false,
|
|
3155
|
-
desc: "New automation task name"
|
|
3156
|
-
},
|
|
3157
|
-
{
|
|
3158
|
-
name: "message",
|
|
3159
|
-
type: "string",
|
|
3160
|
-
required: false,
|
|
3161
|
-
desc: "New instruction sent to the Agent"
|
|
3162
|
-
},
|
|
3163
|
-
{
|
|
3164
|
-
name: "enabled",
|
|
3165
|
-
type: "boolean",
|
|
3166
|
-
required: false,
|
|
3167
|
-
desc: "true to enable, false to pause"
|
|
3168
|
-
},
|
|
3169
|
-
{
|
|
3170
|
-
name: "reuse-conversation",
|
|
3171
|
-
type: "boolean",
|
|
3172
|
-
required: false,
|
|
3173
|
-
desc: "true to reuse one conversation, false to create one per run"
|
|
3174
|
-
},
|
|
3175
|
-
...scheduleFlags
|
|
3176
|
-
],
|
|
3177
|
-
risk: "write",
|
|
3178
|
-
validate: validateUpdate,
|
|
3179
|
-
dryRun: (ctx) => ({
|
|
3180
|
-
method: "PATCH",
|
|
3181
|
-
url: buildUpdatePath(ctx),
|
|
3182
|
-
body: buildUpdateBody2(ctx)
|
|
3183
|
-
}),
|
|
3184
|
-
execute: async (ctx) => patchAgentApi(
|
|
3185
|
-
ctx,
|
|
3186
|
-
buildUpdatePath(ctx),
|
|
3187
|
-
buildUpdateBody2(ctx)
|
|
3188
|
-
)
|
|
3189
|
-
};
|
|
3190
|
-
|
|
3191
3084
|
// src/commands/te-agent/sandbox-tools.ts
|
|
3192
3085
|
import {
|
|
3193
3086
|
accessSync,
|
|
3194
|
-
closeSync,
|
|
3087
|
+
closeSync as closeSync2,
|
|
3195
3088
|
constants,
|
|
3196
3089
|
existsSync as existsSync3,
|
|
3197
3090
|
lstatSync,
|
|
3198
|
-
openSync,
|
|
3199
|
-
readSync,
|
|
3091
|
+
openSync as openSync2,
|
|
3092
|
+
readSync as readSync2,
|
|
3200
3093
|
readdirSync,
|
|
3201
3094
|
realpathSync
|
|
3202
3095
|
} from "fs";
|
|
@@ -3211,12 +3104,12 @@ function hasControlCharacters(value) {
|
|
|
3211
3104
|
}
|
|
3212
3105
|
function readShimHeader(filePath, size) {
|
|
3213
3106
|
const buffer = Buffer.alloc(Math.min(size, MAX_SHIM_BYTES));
|
|
3214
|
-
const fd =
|
|
3107
|
+
const fd = openSync2(filePath, "r");
|
|
3215
3108
|
try {
|
|
3216
|
-
const bytesRead =
|
|
3109
|
+
const bytesRead = readSync2(fd, buffer, 0, buffer.length, 0);
|
|
3217
3110
|
return buffer.toString("utf8", 0, bytesRead);
|
|
3218
3111
|
} finally {
|
|
3219
|
-
|
|
3112
|
+
closeSync2(fd);
|
|
3220
3113
|
}
|
|
3221
3114
|
}
|
|
3222
3115
|
function parseShim(filePath) {
|
|
@@ -3250,11 +3143,11 @@ function parseShim(filePath) {
|
|
|
3250
3143
|
}
|
|
3251
3144
|
const tool = values.get("tool") ?? "";
|
|
3252
3145
|
const version = values.get("version") || "unknown";
|
|
3253
|
-
const
|
|
3146
|
+
const command2 = values.get("command") ?? "";
|
|
3254
3147
|
const target = values.get("target") ?? "";
|
|
3255
3148
|
const runtimeValue = values.get("runtime");
|
|
3256
3149
|
const runtime = runtimeValue === "node" || runtimeValue === "native" ? runtimeValue : void 0;
|
|
3257
|
-
if (!NAME_RE.test(tool) || !NAME_RE.test(
|
|
3150
|
+
if (!NAME_RE.test(tool) || !NAME_RE.test(command2)) {
|
|
3258
3151
|
return {
|
|
3259
3152
|
...fallback,
|
|
3260
3153
|
managed: true,
|
|
@@ -3266,7 +3159,7 @@ function parseShim(filePath) {
|
|
|
3266
3159
|
...fallback,
|
|
3267
3160
|
managed: true,
|
|
3268
3161
|
tool,
|
|
3269
|
-
command,
|
|
3162
|
+
command: command2,
|
|
3270
3163
|
reason: "invalid version or target marker"
|
|
3271
3164
|
};
|
|
3272
3165
|
}
|
|
@@ -3276,12 +3169,12 @@ function parseShim(filePath) {
|
|
|
3276
3169
|
managed: true,
|
|
3277
3170
|
tool,
|
|
3278
3171
|
version,
|
|
3279
|
-
command,
|
|
3172
|
+
command: command2,
|
|
3280
3173
|
target,
|
|
3281
3174
|
reason: "invalid runtime marker"
|
|
3282
3175
|
};
|
|
3283
3176
|
}
|
|
3284
|
-
return { managed: true, tool, version, command, target, runtime };
|
|
3177
|
+
return { managed: true, tool, version, command: command2, target, runtime };
|
|
3285
3178
|
} catch {
|
|
3286
3179
|
return fallback;
|
|
3287
3180
|
}
|
|
@@ -3384,18 +3277,23 @@ var CONVERSATION_PATH = "/api/sandbox/agent/conversations";
|
|
|
3384
3277
|
var ARCHIVE_SEARCH_PATH = `${CONVERSATION_PATH}/archived`;
|
|
3385
3278
|
var DEFAULT_LIMIT = 20;
|
|
3386
3279
|
var DEFAULT_TIME_ZONE = "Asia/Shanghai";
|
|
3387
|
-
function
|
|
3280
|
+
function optional(value) {
|
|
3388
3281
|
const trimmed = value.trim();
|
|
3389
3282
|
return trimmed ? trimmed : void 0;
|
|
3390
3283
|
}
|
|
3391
|
-
function
|
|
3392
|
-
return
|
|
3284
|
+
function envOptional(name) {
|
|
3285
|
+
return optional(process.env[name] ?? "");
|
|
3393
3286
|
}
|
|
3394
3287
|
function readAll(ctx) {
|
|
3395
3288
|
return ctx.str("all") === "true";
|
|
3396
3289
|
}
|
|
3290
|
+
function hasWorkspaceScope(ctx, useConversationContext) {
|
|
3291
|
+
return Boolean(
|
|
3292
|
+
optional(ctx.str("workspaceId")) || currentAgentSpaceId() || useConversationContext && optional(ctx.str("conversationId"))
|
|
3293
|
+
);
|
|
3294
|
+
}
|
|
3397
3295
|
function readTimeZone(ctx) {
|
|
3398
|
-
return
|
|
3296
|
+
return optional(ctx.str("timeZone")) ?? DEFAULT_TIME_ZONE;
|
|
3399
3297
|
}
|
|
3400
3298
|
function isValidTimeZone(timeZone) {
|
|
3401
3299
|
try {
|
|
@@ -3426,17 +3324,23 @@ function formatTimestampInTimeZone(timestamp, timeZone) {
|
|
|
3426
3324
|
function validateFind(ctx) {
|
|
3427
3325
|
const rawAll = ctx.str("all");
|
|
3428
3326
|
if (rawAll && rawAll !== "true" && rawAll !== "false") return;
|
|
3429
|
-
const agentId =
|
|
3327
|
+
const agentId = optional(ctx.str("agentId"));
|
|
3430
3328
|
const all = readAll(ctx);
|
|
3431
|
-
if (
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3329
|
+
if (hasWorkspaceScope(ctx, true)) {
|
|
3330
|
+
if (agentId || all) {
|
|
3331
|
+
throw new Error("Workspace archive scope cannot be combined with --agent-id or --all true");
|
|
3332
|
+
}
|
|
3333
|
+
} else {
|
|
3334
|
+
if (agentId && all) {
|
|
3335
|
+
throw new Error("--agent-id and --all true cannot be used together");
|
|
3336
|
+
}
|
|
3337
|
+
if (!agentId && !all && !envOptional("TE_AGENT_CURRENT_AGENT_ID")) {
|
|
3338
|
+
throw new Error(
|
|
3339
|
+
"Archive scope is required. Provide --agent-id or --all true, or run inside an Agent sandbox."
|
|
3340
|
+
);
|
|
3341
|
+
}
|
|
3438
3342
|
}
|
|
3439
|
-
const limit =
|
|
3343
|
+
const limit = optional(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
|
|
3440
3344
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
3441
3345
|
throw new Error("--limit must be an integer between 1 and 100");
|
|
3442
3346
|
}
|
|
@@ -3444,13 +3348,21 @@ function validateFind(ctx) {
|
|
|
3444
3348
|
throw new Error("--time-zone must be a valid IANA time zone");
|
|
3445
3349
|
}
|
|
3446
3350
|
}
|
|
3351
|
+
function buildWorkspaceArchiveSuffix(ctx) {
|
|
3352
|
+
const params = new URLSearchParams();
|
|
3353
|
+
const q = optional(ctx.str("q"));
|
|
3354
|
+
const limit = optional(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
|
|
3355
|
+
if (q) params.set("q", q);
|
|
3356
|
+
params.set("limit", String(limit));
|
|
3357
|
+
return `/conversations/archived?${params.toString()}`;
|
|
3358
|
+
}
|
|
3447
3359
|
function buildArchivedConversationSearchPath(ctx) {
|
|
3448
3360
|
const params = new URLSearchParams();
|
|
3449
|
-
const q =
|
|
3450
|
-
const explicitAgentId =
|
|
3361
|
+
const q = optional(ctx.str("q"));
|
|
3362
|
+
const explicitAgentId = optional(ctx.str("agentId"));
|
|
3451
3363
|
const all = readAll(ctx);
|
|
3452
|
-
const agentId = explicitAgentId ??
|
|
3453
|
-
const limit =
|
|
3364
|
+
const agentId = explicitAgentId ?? envOptional("TE_AGENT_CURRENT_AGENT_ID");
|
|
3365
|
+
const limit = optional(ctx.str("limit")) ? ctx.num("limit") : DEFAULT_LIMIT;
|
|
3454
3366
|
if (q) params.set("q", q);
|
|
3455
3367
|
if (all) params.set("all", "true");
|
|
3456
3368
|
else if (agentId) params.set("agentId", agentId);
|
|
@@ -3478,8 +3390,9 @@ function toArchivedConversationOutput(item, timeZone) {
|
|
|
3478
3390
|
var findArchivedConversations = {
|
|
3479
3391
|
service: "agent",
|
|
3480
3392
|
command: "+find-archived-conversations",
|
|
3481
|
-
description: "Find archived conversations
|
|
3393
|
+
description: "Find archived conversations in an AgentSpace, one legacy Agent, or the legacy all-Agent scope",
|
|
3482
3394
|
flags: [
|
|
3395
|
+
...workspaceTargetFlags,
|
|
3483
3396
|
{
|
|
3484
3397
|
name: "q",
|
|
3485
3398
|
type: "string",
|
|
@@ -3517,16 +3430,20 @@ var findArchivedConversations = {
|
|
|
3517
3430
|
],
|
|
3518
3431
|
risk: "read",
|
|
3519
3432
|
validate: validateFind,
|
|
3520
|
-
dryRun: (ctx) => ({
|
|
3433
|
+
dryRun: (ctx) => hasWorkspaceScope(ctx, true) ? {
|
|
3521
3434
|
method: "GET",
|
|
3522
|
-
url:
|
|
3523
|
-
|
|
3435
|
+
url: buildWorkspaceCliUrl(ctx, previewWorkspaceResourcePath(ctx, buildWorkspaceArchiveSuffix(ctx))),
|
|
3436
|
+
params: { target_url: buildWorkspaceCliUrl(ctx, workspaceTargetPath(ctx)) }
|
|
3437
|
+
} : { method: "GET", url: buildArchivedConversationSearchPath(ctx) },
|
|
3524
3438
|
execute: async (ctx) => {
|
|
3525
3439
|
const timeZone = readTimeZone(ctx);
|
|
3526
|
-
const result = await
|
|
3527
|
-
ctx
|
|
3528
|
-
|
|
3529
|
-
|
|
3440
|
+
const result = hasWorkspaceScope(ctx, true) ? await (async () => {
|
|
3441
|
+
const target = await resolveWorkspaceTarget(ctx);
|
|
3442
|
+
return getWorkspaceApi(
|
|
3443
|
+
ctx,
|
|
3444
|
+
workspaceResourcePath(target.agentSpaceId, buildWorkspaceArchiveSuffix(ctx))
|
|
3445
|
+
);
|
|
3446
|
+
})() : await getAgentApi(ctx, buildArchivedConversationSearchPath(ctx));
|
|
3530
3447
|
return {
|
|
3531
3448
|
items: result.items.map(
|
|
3532
3449
|
(item) => toArchivedConversationOutput(item, timeZone)
|
|
@@ -3540,6 +3457,7 @@ var restoreConversation = {
|
|
|
3540
3457
|
command: "+restore-conversation",
|
|
3541
3458
|
description: "Restore an archived conversation by conversation ID",
|
|
3542
3459
|
flags: [
|
|
3460
|
+
workspaceTargetFlags[0],
|
|
3543
3461
|
{
|
|
3544
3462
|
name: "conversation-id",
|
|
3545
3463
|
type: "string",
|
|
@@ -3548,13 +3466,21 @@ var restoreConversation = {
|
|
|
3548
3466
|
}
|
|
3549
3467
|
],
|
|
3550
3468
|
risk: "write",
|
|
3551
|
-
dryRun: (ctx) => ({
|
|
3469
|
+
dryRun: (ctx) => hasWorkspaceScope(ctx, false) ? {
|
|
3552
3470
|
method: "POST",
|
|
3553
|
-
url:
|
|
3471
|
+
url: buildWorkspaceCliUrl(ctx, previewWorkspaceResourcePath(ctx, `/conversations/${encodeURIComponent(ctx.str("conversationId"))}/restore`)),
|
|
3472
|
+
params: { target_url: buildWorkspaceCliUrl(ctx, workspaceTargetPath(ctx)) },
|
|
3554
3473
|
body: {}
|
|
3555
|
-
}),
|
|
3474
|
+
} : { method: "POST", url: `${CONVERSATION_PATH}/${encodeURIComponent(ctx.str("conversationId"))}/restore`, body: {} },
|
|
3556
3475
|
execute: async (ctx) => {
|
|
3557
|
-
const result = await
|
|
3476
|
+
const result = hasWorkspaceScope(ctx, false) ? await (async () => {
|
|
3477
|
+
const target = await resolveWorkspaceTarget(ctx);
|
|
3478
|
+
return postWorkspaceApi(
|
|
3479
|
+
ctx,
|
|
3480
|
+
workspaceResourcePath(target.agentSpaceId, `/conversations/${encodeURIComponent(ctx.str("conversationId"))}/restore`),
|
|
3481
|
+
{}
|
|
3482
|
+
);
|
|
3483
|
+
})() : await postAgentApi(
|
|
3558
3484
|
ctx,
|
|
3559
3485
|
`${CONVERSATION_PATH}/${encodeURIComponent(ctx.str("conversationId"))}/restore`,
|
|
3560
3486
|
{}
|
|
@@ -3678,8 +3604,8 @@ function buildQuery2(params) {
|
|
|
3678
3604
|
for (const [key, value] of Object.entries(params)) {
|
|
3679
3605
|
if (value !== void 0 && value !== "") searchParams.set(key, String(value));
|
|
3680
3606
|
}
|
|
3681
|
-
const
|
|
3682
|
-
return
|
|
3607
|
+
const query2 = searchParams.toString();
|
|
3608
|
+
return query2 ? `?${query2}` : "";
|
|
3683
3609
|
}
|
|
3684
3610
|
function requestListPath(ctx) {
|
|
3685
3611
|
return `requests${buildQuery2({
|
|
@@ -4089,6 +4015,7 @@ var retryApprovalEffect = {
|
|
|
4089
4015
|
|
|
4090
4016
|
// src/commands/te-agent/index.ts
|
|
4091
4017
|
var commands = [
|
|
4018
|
+
...notificationCommands,
|
|
4092
4019
|
// Agent CRUD
|
|
4093
4020
|
listAgents,
|
|
4094
4021
|
createAgent,
|
|
@@ -4182,10 +4109,6 @@ var commands = [
|
|
|
4182
4109
|
addAttachment,
|
|
4183
4110
|
delAttachment,
|
|
4184
4111
|
attachmentStats,
|
|
4185
|
-
// Automate tasks
|
|
4186
|
-
listAutomations,
|
|
4187
|
-
createAutomation,
|
|
4188
|
-
updateAutomation,
|
|
4189
4112
|
// Archived conversations
|
|
4190
4113
|
findArchivedConversations,
|
|
4191
4114
|
restoreConversation,
|
|
@@ -4194,5 +4117,11 @@ var commands = [
|
|
|
4194
4117
|
];
|
|
4195
4118
|
var te_agent_default = commands;
|
|
4196
4119
|
export {
|
|
4197
|
-
te_agent_default as default
|
|
4120
|
+
te_agent_default as default,
|
|
4121
|
+
notificationGet,
|
|
4122
|
+
notificationList,
|
|
4123
|
+
notificationMarkRead,
|
|
4124
|
+
notificationRecipients,
|
|
4125
|
+
notificationSend,
|
|
4126
|
+
notificationUnreadCount
|
|
4198
4127
|
};
|