@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.
Files changed (195) hide show
  1. package/README.md +35 -10
  2. package/README.zh.md +32 -10
  3. package/bin/ae-cli.js +6 -1
  4. package/cli-installation-guide.md +91 -0
  5. package/dist/{auth-XZNXFRJS.js → auth-YHMC3GDH.js} +168 -10
  6. package/dist/automation-NWWVLWG2.js +459 -0
  7. package/dist/{capability-FYTU3X6L.js → capability-3QLLIVFB.js} +11 -6
  8. package/dist/chunk-4655PUNX.js +43 -0
  9. package/dist/{chunk-4NRCTUZJ.js → chunk-5XJYLEVC.js} +4 -4
  10. package/dist/{chunk-JOCDD4ON.js → chunk-7QXISROD.js} +1 -1
  11. package/dist/{chunk-EQ255HKO.js → chunk-AP7YP2NX.js} +2 -2
  12. package/dist/{chunk-DVMLWQD4.js → chunk-CT7QDJS6.js} +2 -2
  13. package/dist/chunk-D6ACFILC.js +56 -0
  14. package/dist/{chunk-HFGZGYCG.js → chunk-EOYSKMXN.js} +264 -10
  15. package/dist/{chunk-57RRFUEZ.js → chunk-FMNNGNYO.js} +43 -8
  16. package/dist/{chunk-7XGFSUOM.js → chunk-GIK6EDUG.js} +291 -84
  17. package/dist/chunk-HVHR4SCP.js +133 -0
  18. package/dist/{chunk-CCS66K4K.js → chunk-KAEHZZH4.js} +3 -3
  19. package/dist/{chunk-DX5CDO34.js → chunk-KFNMQTZI.js} +580 -214
  20. package/dist/{chunk-HBGADCKA.js → chunk-PLE722AJ.js} +28 -11
  21. package/dist/chunk-RK6GLDGI.js +27 -0
  22. package/dist/{chunk-V2NUHPXF.js → chunk-S6M42KND.js} +1 -1
  23. package/dist/{chunk-7FTTULED.js → chunk-UQ77JXYH.js} +7 -3
  24. package/dist/{chunk-MAPZ7VB6.js → chunk-WNGFSIOB.js} +20 -1
  25. package/dist/{chunk-VYXXOKYS.js → chunk-XCHAYMSF.js} +7 -4
  26. package/dist/{community-report-client-CU22W53K.js → community-report-client-PEERQCX2.js} +1 -1
  27. package/dist/{config-XO3LI3SA.js → config-AHPMEW5A.js} +25 -6
  28. package/dist/context-YAE3QXP3.js +136 -0
  29. package/dist/{data-integration-HNGUKFIC.js → data-integration-HESZET7E.js} +6 -6
  30. package/dist/index.js +167 -53
  31. package/dist/{local-data-upload-client-GTRIT64F.js → local-data-upload-client-TWMHFLUA.js} +1 -1
  32. package/dist/memory-62BJOULV.js +580 -0
  33. package/dist/{metadata-DI5BMYFU.js → metadata-C7CEDHOJ.js} +7 -7
  34. package/dist/{model-RNPQXIBI.js → model-SBV2JFJI.js} +9 -5
  35. package/dist/{personal-semantic-preference-5C3WUXFI.js → personal-semantic-preference-QECDPHND.js} +119 -11
  36. package/dist/project-semantic-Z4QAMBWF.js +356 -0
  37. package/dist/{sync-O45NXEQY.js → sync-SU33KYX7.js} +12 -8
  38. package/dist/{te-agent-K5MSPNHJ.js → te-agent-F5QBZSQA.js} +423 -494
  39. package/dist/{te-analysis-AISWCOOZ.js → te-analysis-2ECAAIFK.js} +1227 -154
  40. package/dist/{te-community-4OYU3BDA.js → te-community-PFLDLPP4.js} +3 -3
  41. package/dist/{te-dataops-NFIPB6FX.js → te-dataops-FOQSRIAZ.js} +644 -276
  42. package/dist/{te-engage-BAM3GBFX.js → te-engage-QKUGIWSR.js} +6 -6
  43. package/dist/{te-experiment-GUTZXZ5Z.js → te-experiment-26PXR2UO.js} +6 -6
  44. package/dist/{te-kb-3TS73NO6.js → te-kb-MHDOST62.js} +666 -244
  45. package/dist/{te-system-STMHLS5J.js → te-system-J2FQF5ER.js} +6 -6
  46. package/dist/{te-team-3I5AOX3N.js → te-team-5UOZPTU3.js} +6 -6
  47. package/dist/things-VPPXXLHB.js +1091 -0
  48. package/dist/{update-RZXLPCRH.js → update-EEUTEI6R.js} +59 -51
  49. package/dist/workspace-O3EEIYQM.js +554 -0
  50. package/package.json +30 -11
  51. package/skills/ae-agent/SKILL.md +95 -140
  52. package/skills/ae-agent/references/add-model.md +1 -1
  53. package/skills/ae-agent/references/create-agent.md +1 -1
  54. package/skills/ae-agent/references/find-archived-conversations.md +12 -5
  55. package/skills/ae-agent/references/get-agent.md +1 -1
  56. package/skills/ae-agent/references/list-agents.md +2 -2
  57. package/skills/ae-agent/references/list-models.md +2 -2
  58. package/skills/ae-agent/references/notification.md +40 -0
  59. package/skills/ae-agent/references/restore-conversation.md +3 -1
  60. package/skills/ae-analysis/SKILL.md +55 -23
  61. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  62. package/skills/ae-analysis/references/adhoc_run.md +1 -1
  63. package/skills/ae-analysis/references/agent_review_submit_to_page.md +2 -0
  64. package/skills/ae-analysis/references/ai_models/event.md +6 -1
  65. package/skills/ae-analysis/references/ai_models/funnel.md +12 -4
  66. package/skills/ae-analysis/references/ai_models/heat_map.md +23 -0
  67. package/skills/ae-analysis/references/ai_models/interval.md +24 -0
  68. package/skills/ae-analysis/references/ai_models/path.md +20 -0
  69. package/skills/ae-analysis/references/ai_models/prop_analysis.md +2 -0
  70. package/skills/ae-analysis/references/ai_models/rank_list.md +30 -0
  71. package/skills/ae-analysis/references/ai_models/retention.md +45 -1
  72. package/skills/ae-analysis/references/ai_models/revenue.md +20 -2
  73. package/skills/ae-analysis/references/ai_models/session.md +76 -0
  74. package/skills/ae-analysis/references/ai_models/tag.md +2 -0
  75. package/skills/ae-analysis/references/ai_models.md +100 -3
  76. package/skills/ae-analysis/references/analysis_data_retrieval.md +4 -0
  77. package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -1
  78. package/skills/ae-analysis/references/asset_batch_info_export.md +10 -0
  79. package/skills/ae-analysis/references/asset_batch_sql_export.md +13 -1
  80. package/skills/ae-analysis/references/asset_export.md +12 -1
  81. package/skills/ae-analysis/references/asset_list.md +1 -0
  82. package/skills/ae-analysis/references/asset_search.md +11 -5
  83. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  84. package/skills/ae-analysis/references/catalog_list.md +1 -1
  85. package/skills/ae-analysis/references/collaboration.md +48 -0
  86. package/skills/ae-analysis/references/command_index.md +29 -19
  87. package/skills/ae-analysis/references/dashboard_list.md +4 -4
  88. package/skills/ae-analysis/references/dashboard_move.md +21 -0
  89. package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
  90. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  91. package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
  92. package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
  93. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  94. package/skills/ae-analysis/references/drilldown_session_details_run.md +41 -0
  95. package/skills/ae-analysis/references/event_export.md +3 -1
  96. package/skills/ae-analysis/references/event_report_presentation.md +76 -0
  97. package/skills/ae-analysis/references/feedback_submit.md +37 -0
  98. package/skills/ae-analysis/references/governance_recommendation_auto_review.md +77 -0
  99. package/skills/ae-analysis/references/governance_recommendation_export.md +11 -0
  100. package/skills/ae-analysis/references/metadata_resolution.md +18 -3
  101. package/skills/ae-analysis/references/metric_export.md +3 -1
  102. package/skills/ae-analysis/references/metric_list.md +1 -1
  103. package/skills/ae-analysis/references/operation_record_export.md +10 -0
  104. package/skills/ae-analysis/references/personal_semantic_preference_add.md +2 -2
  105. package/skills/ae-analysis/references/personal_semantic_preference_get.md +4 -4
  106. package/skills/ae-analysis/references/personal_semantic_preference_list.md +4 -4
  107. package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
  108. package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
  109. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
  110. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +91 -32
  111. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +99 -1
  112. package/skills/ae-analysis/references/property_export.md +3 -1
  113. package/skills/ae-analysis/references/report_create.md +18 -4
  114. package/skills/ae-analysis/references/report_data_export.md +6 -0
  115. package/skills/ae-analysis/references/report_get.md +7 -1
  116. package/skills/ae-analysis/references/report_list.md +5 -5
  117. package/skills/ae-analysis/references/report_update.md +21 -4
  118. package/skills/ae-analysis/references/sql_table_columns.md +4 -4
  119. package/skills/ae-analysis/references/sql_table_list.md +5 -5
  120. package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
  121. package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
  122. package/skills/ae-analysis/references/system_query_task_export.md +6 -2
  123. package/skills/ae-analysis/references/system_query_task_get.md +2 -0
  124. package/skills/ae-analysis/references/system_query_task_list.md +7 -3
  125. package/skills/ae-analysis/references/system_query_task_options.md +2 -2
  126. package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
  127. package/skills/ae-analysis/references/user_cluster_models.md +8 -0
  128. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  129. package/skills/ae-analysis/references/user_tag_get.md +1 -1
  130. package/skills/ae-analysis/references/user_tag_models.md +20 -2
  131. package/skills/ae-analysis/references/user_tag_refresh.md +1 -1
  132. package/skills/ae-analysis/references/user_tag_update.md +2 -2
  133. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
  134. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +669 -29
  135. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
  136. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +28 -10
  137. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
  138. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +285 -24
  139. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +262 -30
  140. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
  141. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +46 -2
  142. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
  143. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
  144. package/skills/ae-automation/SKILL.md +16 -0
  145. package/skills/ae-automation/references/cli.md +53 -0
  146. package/skills/ae-automation/references/command_index.md +17 -0
  147. package/skills/ae-capability/SKILL.md +73 -2
  148. package/skills/ae-capability/references/collaboration.md +48 -0
  149. package/skills/ae-community/SKILL.md +5 -1
  150. package/skills/ae-community/references/collaboration.md +48 -0
  151. package/skills/ae-current-context/SKILL.md +3 -2
  152. package/skills/ae-data-integration/SKILL.md +4 -0
  153. package/skills/ae-data-integration/references/collaboration.md +48 -0
  154. package/skills/ae-dataops/SKILL.md +54 -74
  155. package/skills/ae-dataops/references/collaboration.md +48 -0
  156. package/skills/ae-dataops/references/dataops-backfill.md +23 -18
  157. package/skills/ae-dataops/references/dataops-flow-create.md +74 -23
  158. package/skills/ae-dataops/references/dataops-flow-monitor.md +45 -13
  159. package/skills/ae-dataops/references/dataops-integration.md +57 -30
  160. package/skills/ae-dataops/references/dataops-query.md +21 -4
  161. package/skills/ae-dataops/references/dataops-table.md +143 -11
  162. package/skills/ae-engage/SKILL.md +21 -6
  163. package/skills/ae-engage/references/channel-mgmt.md +3 -3
  164. package/skills/ae-engage/references/collaboration.md +48 -0
  165. package/skills/ae-engage/references/scene-config-channel.md +4 -4
  166. package/skills/ae-generate-tracking-plan/SKILL.md +4 -0
  167. package/skills/ae-generate-tracking-plan/references/collaboration.md +48 -0
  168. package/skills/ae-kb/SKILL.md +70 -12
  169. package/skills/ae-kb/references/analysis-workflow.md +73 -36
  170. package/skills/ae-kb/references/collaboration.md +48 -0
  171. package/skills/ae-kb/references/query-workflow.md +67 -33
  172. package/skills/ae-kb/references/schema-import.md +32 -0
  173. package/skills/ae-kb/references/source-mutations.md +6 -4
  174. package/skills/ae-kb/references/text-sources.md +53 -0
  175. package/skills/ae-kb-discovery/SKILL.md +8 -3
  176. package/skills/ae-kb-discovery/references/collaboration.md +48 -0
  177. package/skills/ae-metadata/SKILL.md +20 -12
  178. package/skills/ae-metadata/references/collaboration.md +48 -0
  179. package/skills/ae-team/SKILL.md +23 -17
  180. package/skills/ae-things/SKILL.md +85 -0
  181. package/skills/ae-things/references/cli.md +103 -0
  182. package/skills/ae-things-progress/SKILL.md +43 -0
  183. package/skills/ae-things-review/SKILL.md +42 -0
  184. package/skills/ae-workspace/SKILL.md +43 -0
  185. package/skills/ae-workspace/references/commands.md +51 -0
  186. package/dist/chunk-E2JKXMVO.js +0 -29
  187. package/dist/context-IFJI3LIT.js +0 -46
  188. package/dist/memory-QGPSNCQS.js +0 -892
  189. package/dist/project-semantic-3LF6Q6JZ.js +0 -1119
  190. package/skills/ae-agent/references/create-automation.md +0 -125
  191. package/skills/ae-agent/references/list-automations.md +0 -56
  192. package/skills/ae-agent/references/update-automation.md +0 -107
  193. package/skills/ae-project-semantic/SKILL.md +0 -193
  194. package/skills/ae-project-semantic/references/query-routing-v5.md +0 -165
  195. package/skills/ae-project-semantic/references/recommendation-quality.md +0 -68
@@ -1,16 +1,16 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCapabilityCommand
4
- } from "./chunk-CCS66K4K.js";
5
- import "./chunk-HFGZGYCG.js";
4
+ } from "./chunk-KAEHZZH4.js";
5
+ import "./chunk-EOYSKMXN.js";
6
6
  import {
7
7
  registerCapabilityGatewayRoute
8
8
  } from "./chunk-KPQY44JQ.js";
9
- import "./chunk-DX5CDO34.js";
9
+ import "./chunk-KFNMQTZI.js";
10
10
  import "./chunk-Y74WTIKJ.js";
11
- import "./chunk-7XGFSUOM.js";
12
- import "./chunk-7FTTULED.js";
13
- import "./chunk-MAPZ7VB6.js";
11
+ import "./chunk-GIK6EDUG.js";
12
+ import "./chunk-UQ77JXYH.js";
13
+ import "./chunk-WNGFSIOB.js";
14
14
 
15
15
  // src/commands/personal-semantic-preference/shared.ts
16
16
  function createPersonalSemanticPreferenceCommand(config) {
@@ -24,16 +24,22 @@ function optionalString(ctx, name) {
24
24
  const value = ctx.str(name);
25
25
  return value === "" ? void 0 : value;
26
26
  }
27
- function optionalKeywords(ctx) {
28
- if (ctx.str("keywords") === "") {
27
+ function optionalNumber(ctx, name) {
28
+ return ctx.optionalNum(name);
29
+ }
30
+ function optionalJsonStringArray(ctx, name, flag) {
31
+ if (ctx.str(name) === "") {
29
32
  return void 0;
30
33
  }
31
- const value = ctx.json("keywords");
34
+ const value = ctx.json(name);
32
35
  if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
33
- throw new Error("--keywords must be a JSON array of strings.");
36
+ throw new Error(`${flag} must be a JSON array of strings.`);
34
37
  }
35
38
  return value;
36
39
  }
40
+ function optionalKeywords(ctx) {
41
+ return optionalJsonStringArray(ctx, "keywords", "--keywords");
42
+ }
37
43
  function optionalResourceRefs(ctx) {
38
44
  if (ctx.str("resource-refs") === "") {
39
45
  return void 0;
@@ -161,12 +167,14 @@ var personalSemanticPreferenceGet = createPersonalSemanticPreferenceCommand({
161
167
  flags: [
162
168
  { name: "project-id", type: "number", required: true, desc: "Numeric project ID.", alias: "p", min: 1 },
163
169
  { name: "id", type: "string", required: true, desc: "Preference ID returned by list/add." },
170
+ { name: "title", type: "string", required: true, desc: "Preference title copied from list output for telemetry only.", minLength: 1, maxLength: 255 },
164
171
  { name: "mark-used", type: "boolean", desc: "Count this preference as adopted and update its usage heat." }
165
172
  ],
166
173
  risk: "read",
167
174
  buildInput: (ctx) => ({
168
175
  project_id: ctx.num("project-id"),
169
176
  id: ctx.str("id"),
177
+ title: ctx.str("title"),
170
178
  mark_used: ctx.bool("mark-used")
171
179
  })
172
180
  });
@@ -187,6 +195,103 @@ var personalSemanticPreferenceList = createPersonalSemanticPreferenceCommand({
187
195
  })
188
196
  });
189
197
 
198
+ // src/commands/personal-semantic-preference/review-list.ts
199
+ var REVIEW_STATUSES = ["none", "pending", "adopted", "rejected"];
200
+ var CONTEXT_TYPES = ["preference", "asset_context", "experience", "background"];
201
+ var personalSemanticPreferenceReviewList = createPersonalSemanticPreferenceCommand({
202
+ resource: "",
203
+ command: "review-list",
204
+ capabilityId: "business_semantics.personal_context.review_list",
205
+ description: "List all project personal semantic preferences for admin review.",
206
+ flags: [
207
+ { name: "project-id", type: "number", required: true, desc: "Numeric project ID.", alias: "p", min: 1 },
208
+ { name: "project-review-status", type: "string", desc: "none | pending | adopted | rejected." },
209
+ { name: "owner", type: "string", desc: "Owner selector: user name, login name, or user ID. open_id is not accepted." },
210
+ { name: "context-type", type: "string", desc: "preference | asset_context | experience | background." },
211
+ { name: "keyword", type: "string", desc: "Match title, summary, content, or keywords." },
212
+ { name: "limit", type: "number", desc: "Page size. Defaults to 50.", min: 1, max: 200 },
213
+ { name: "offset", type: "number", desc: "Zero-based page offset.", min: 0 }
214
+ ],
215
+ risk: "read",
216
+ validate: (ctx) => {
217
+ const status = ctx.str("project-review-status");
218
+ if (status !== "" && !REVIEW_STATUSES.includes(status)) {
219
+ throw new Error(`--project-review-status must be one of: ${REVIEW_STATUSES.join(", ")}.`);
220
+ }
221
+ const contextType = ctx.str("context-type");
222
+ if (contextType !== "" && !CONTEXT_TYPES.includes(contextType)) {
223
+ throw new Error(`--context-type must be one of: ${CONTEXT_TYPES.join(", ")}.`);
224
+ }
225
+ },
226
+ buildInput: (ctx) => compactInput({
227
+ project_id: ctx.num("project-id"),
228
+ project_review_status: optionalString(ctx, "project-review-status"),
229
+ owner: optionalString(ctx, "owner"),
230
+ context_type: optionalString(ctx, "context-type"),
231
+ keyword: optionalString(ctx, "keyword"),
232
+ limit: optionalNumber(ctx, "limit"),
233
+ offset: optionalNumber(ctx, "offset")
234
+ })
235
+ });
236
+
237
+ // src/commands/personal-semantic-preference/review.ts
238
+ var ACTIONS = ["adopt", "reject"];
239
+ var personalSemanticPreferenceReview = createPersonalSemanticPreferenceCommand({
240
+ resource: "",
241
+ command: "review",
242
+ capabilityId: "business_semantics.personal_context.review",
243
+ description: "Adopt or reject personal semantic preferences, including unsubmitted ones, for future project KB refresh.",
244
+ flags: [
245
+ { name: "project-id", type: "number", required: true, desc: "Numeric project ID.", alias: "p", min: 1 },
246
+ { name: "ids", type: "json", required: true, desc: "JSON array of preference IDs from review-list." },
247
+ { name: "action", type: "string", required: true, desc: "adopt | reject." },
248
+ { name: "project-review-note", type: "string", desc: "Optional reviewer note.", maxLength: 1e3 },
249
+ { name: "request-id", type: "string", desc: "Optional idempotency key; generated when omitted.", maxLength: 128 }
250
+ ],
251
+ risk: "write",
252
+ validate: (ctx) => {
253
+ const action = ctx.str("action");
254
+ if (!ACTIONS.includes(action)) {
255
+ throw new Error(`--action must be one of: ${ACTIONS.join(", ")}.`);
256
+ }
257
+ const ids = optionalJsonStringArray(ctx, "ids", "--ids");
258
+ if (!ids || ids.length === 0) {
259
+ throw new Error("--ids must contain at least one preference ID.");
260
+ }
261
+ if (ids.length > 100) {
262
+ throw new Error("--ids must contain at most 100 preference IDs.");
263
+ }
264
+ },
265
+ buildInput: (ctx) => compactInput({
266
+ project_id: ctx.num("project-id"),
267
+ ids: optionalJsonStringArray(ctx, "ids", "--ids"),
268
+ action: ctx.str("action"),
269
+ project_review_note: optionalString(ctx, "project-review-note"),
270
+ request_id: optionalString(ctx, "request-id")
271
+ })
272
+ });
273
+
274
+ // src/commands/personal-semantic-preference/submit.ts
275
+ var personalSemanticPreferenceSubmit = createPersonalSemanticPreferenceCommand({
276
+ resource: "",
277
+ command: "submit",
278
+ capabilityId: "business_semantics.personal_context.submit",
279
+ description: "Submit one personal semantic preference for project semantic review.",
280
+ flags: [
281
+ { name: "project-id", type: "number", required: true, desc: "Numeric project ID.", alias: "p", min: 1 },
282
+ { name: "id", type: "string", required: true, desc: "Preference ID returned by list/add." },
283
+ { name: "project-review-note", type: "string", desc: "Optional note for the reviewer.", maxLength: 1e3 },
284
+ { name: "request-id", type: "string", desc: "Optional idempotency key; generated when omitted.", maxLength: 128 }
285
+ ],
286
+ risk: "write",
287
+ buildInput: (ctx) => compactInput({
288
+ project_id: ctx.num("project-id"),
289
+ id: ctx.str("id"),
290
+ project_review_note: optionalString(ctx, "project-review-note"),
291
+ request_id: optionalString(ctx, "request-id")
292
+ })
293
+ });
294
+
190
295
  // src/commands/personal-semantic-preference/update.ts
191
296
  var personalSemanticPreferenceUpdate = createPersonalSemanticPreferenceCommand({
192
297
  resource: "",
@@ -233,7 +338,10 @@ var commands = [
233
338
  personalSemanticPreferenceGet,
234
339
  personalSemanticPreferenceAdd,
235
340
  personalSemanticPreferenceUpdate,
236
- personalSemanticPreferenceDelete
341
+ personalSemanticPreferenceDelete,
342
+ personalSemanticPreferenceSubmit,
343
+ personalSemanticPreferenceReviewList,
344
+ personalSemanticPreferenceReview
237
345
  ];
238
346
  var personal_semantic_preference_default = commands;
239
347
  export {
@@ -0,0 +1,356 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ assertOutputPathAvailable,
4
+ downloadAnalysisArtifact,
5
+ withAsyncArtifactLifecycle
6
+ } from "./chunk-XCHAYMSF.js";
7
+ import {
8
+ CapabilityGatewayError,
9
+ dryRunCapability,
10
+ executeCapabilityWithEnvelope,
11
+ validateCapability
12
+ } from "./chunk-EOYSKMXN.js";
13
+ import {
14
+ registerCapabilityGatewayRoute,
15
+ resolveGatewayDomain
16
+ } from "./chunk-KPQY44JQ.js";
17
+ import "./chunk-KFNMQTZI.js";
18
+ import "./chunk-Y74WTIKJ.js";
19
+ import "./chunk-GIK6EDUG.js";
20
+ import "./chunk-UQ77JXYH.js";
21
+ import "./chunk-WNGFSIOB.js";
22
+
23
+ // src/commands/project-semantic/asset-package/materializer.ts
24
+ import { createHash, randomBytes } from "crypto";
25
+ import { createReadStream } from "fs";
26
+ import {
27
+ appendFile,
28
+ mkdir,
29
+ readFile,
30
+ rename,
31
+ rm,
32
+ stat,
33
+ writeFile
34
+ } from "fs/promises";
35
+ import { createInterface } from "readline";
36
+ import { createGunzip } from "zlib";
37
+ import { basename, dirname, resolve } from "path";
38
+ var MAX_COMPRESSED_BYTES = 64 * 1024 * 1024;
39
+ var MAX_UNCOMPRESSED_BYTES = 512 * 1024 * 1024;
40
+ var MAX_RECORDS = 2e5;
41
+ var SHA256_PATTERN = /^[0-9a-f]{64}$/;
42
+ var SUPPORTED_SCHEMA_VERSIONS = /* @__PURE__ */ new Set(["1.0", "3.0"]);
43
+ var REQUIRED_FILES = [
44
+ "manifest.json",
45
+ "indexes/work-units.jsonl",
46
+ "indexes/asset-directory.jsonl",
47
+ "indexes/coverage-batches.jsonl",
48
+ "indexes/definition-families.jsonl",
49
+ "indexes/governance-coverage.jsonl",
50
+ "catalog/published.jsonl",
51
+ "catalog/active-candidates.jsonl",
52
+ "catalog/rejected-candidates.jsonl"
53
+ ];
54
+ async function preflightAssetPackageOutput(args) {
55
+ await assertOutputPathAvailable(args.output, args.force);
56
+ }
57
+ async function materializeProjectSemanticAssetPackage(args) {
58
+ const descriptor = packageDescriptor(args.finalDescriptor);
59
+ const output = resolve(args.output);
60
+ const parent = dirname(output);
61
+ const nonce = `${process.pid}-${randomBytes(6).toString("hex")}`;
62
+ const staging = resolve(parent, `.${basename(output)}.staging-${nonce}`);
63
+ const archive = resolve(parent, `.${basename(output)}.archive-${nonce}.jsonl.gz`);
64
+ const backup = resolve(parent, `.${basename(output)}.backup-${nonce}`);
65
+ let movedExisting = false;
66
+ await assertOutputPathAvailable(output, args.force, {
67
+ run_id: args.runId,
68
+ artifact_id: args.artifactId
69
+ });
70
+ await mkdir(parent, { recursive: true });
71
+ await mkdir(staging, { recursive: false });
72
+ try {
73
+ const download = await downloadAnalysisArtifact(
74
+ args.ctx.host(),
75
+ args.runId,
76
+ args.artifactId,
77
+ archive,
78
+ { signal: args.signal, ensureReady: false }
79
+ );
80
+ if (download.bytes > MAX_COMPRESSED_BYTES) {
81
+ throw packageError("Asset package archive exceeds 64 MiB.", "ASSET_PACKAGE_ARCHIVE_TOO_LARGE");
82
+ }
83
+ const materialized = await materializeArchive(archive, staging, descriptor);
84
+ if (args.force && await exists(output)) {
85
+ await rename(output, backup);
86
+ movedExisting = true;
87
+ }
88
+ await rename(staging, output);
89
+ if (movedExisting) {
90
+ await rm(backup, { recursive: true, force: true });
91
+ movedExisting = false;
92
+ }
93
+ return {
94
+ ...args.finalDescriptor,
95
+ output_path: output,
96
+ archive_bytes: download.bytes,
97
+ record_count: materialized.recordCount,
98
+ uncompressed_bytes: materialized.uncompressedBytes
99
+ };
100
+ } catch (error) {
101
+ if (movedExisting) {
102
+ await rename(backup, output).catch(() => void 0);
103
+ }
104
+ throw error;
105
+ } finally {
106
+ await rm(archive, { force: true }).catch(() => void 0);
107
+ await rm(staging, { recursive: true, force: true }).catch(() => void 0);
108
+ if (!movedExisting) {
109
+ await rm(backup, { recursive: true, force: true }).catch(() => void 0);
110
+ }
111
+ }
112
+ }
113
+ async function materializeArchive(archive, staging, descriptor) {
114
+ const compressed = await stat(archive);
115
+ if (compressed.size > MAX_COMPRESSED_BYTES) {
116
+ throw packageError("Asset package archive exceeds 64 MiB.", "ASSET_PACKAGE_ARCHIVE_TOO_LARGE");
117
+ }
118
+ const digest = createHash("sha256");
119
+ const lines = createInterface({
120
+ input: createReadStream(archive).pipe(createGunzip()),
121
+ crlfDelay: Infinity
122
+ });
123
+ let recordCount = 0;
124
+ let uncompressedBytes = 0;
125
+ let manifest;
126
+ for await (const line of lines) {
127
+ if (!line.trim()) continue;
128
+ uncompressedBytes += Buffer.byteLength(line, "utf8") + 1;
129
+ if (uncompressedBytes > MAX_UNCOMPRESSED_BYTES) {
130
+ throw packageError(
131
+ "Asset package archive exceeds 512 MiB after decompression.",
132
+ "ASSET_PACKAGE_ARCHIVE_TOO_LARGE"
133
+ );
134
+ }
135
+ recordCount += 1;
136
+ if (recordCount > MAX_RECORDS) {
137
+ throw packageError("Asset package has too many records.", "ASSET_PACKAGE_RECORD_LIMIT_EXCEEDED");
138
+ }
139
+ digest.update(line, "utf8");
140
+ digest.update("\n", "utf8");
141
+ const record = parseRecord(line);
142
+ const target = resolveRecordPath(staging, record.path);
143
+ await mkdir(dirname(target), { recursive: true });
144
+ const content = `${JSON.stringify(record.content)}
145
+ `;
146
+ if (record.append) {
147
+ await appendFile(target, content, "utf8");
148
+ } else {
149
+ await writeFile(target, content, { encoding: "utf8", flag: "wx" });
150
+ }
151
+ if (record.path === "manifest.json") {
152
+ manifest = asObject(record.content);
153
+ }
154
+ }
155
+ const actualHash = digest.digest("hex");
156
+ if (actualHash !== descriptor.snapshotHash) {
157
+ throw packageError(
158
+ `Asset package content hash mismatch: expected ${descriptor.snapshotHash}, received ${actualHash}.`,
159
+ "ASSET_PACKAGE_HASH_MISMATCH"
160
+ );
161
+ }
162
+ if (!manifest || !Number.isInteger(Number(manifest.project_id))) {
163
+ throw packageError("Asset package manifest is missing project identity.", "ASSET_PACKAGE_MANIFEST_INVALID");
164
+ }
165
+ const schemaVersion = typeof manifest.schema_version === "string" ? manifest.schema_version : "";
166
+ if (!SUPPORTED_SCHEMA_VERSIONS.has(schemaVersion)) {
167
+ throw packageError(
168
+ `Project semantic asset package schema ${[...SUPPORTED_SCHEMA_VERSIONS].join(" or ")} is required.`,
169
+ "ASSET_PACKAGE_VERSION_MISMATCH"
170
+ );
171
+ }
172
+ for (const required of REQUIRED_FILES) {
173
+ if (!await exists(resolve(staging, required))) {
174
+ throw packageError(`Asset package is missing required file ${required}.`, "ASSET_PACKAGE_MANIFEST_INVALID");
175
+ }
176
+ }
177
+ await verifyDetailLocators(staging, schemaVersion);
178
+ await writeFile(resolve(staging, ".asset-package.json"), JSON.stringify({
179
+ snapshot_id: descriptor.snapshotId,
180
+ snapshot_hash: descriptor.snapshotHash,
181
+ schema_version: schemaVersion,
182
+ package_kind: typeof manifest.package_kind === "string" ? manifest.package_kind : "project_semantic_asset_package",
183
+ company_id: Number(manifest.company_id),
184
+ project_id: Number(manifest.project_id),
185
+ project_name: typeof manifest.project_name === "string" ? manifest.project_name : void 0,
186
+ record_count: recordCount,
187
+ asset_scope: typeof manifest.asset_scope === "string" ? manifest.asset_scope : "governed",
188
+ exported_asset_count: Number(manifest.exported_asset_count ?? manifest.authenticated_asset_count),
189
+ authenticated_asset_count: Number(manifest.authenticated_asset_count),
190
+ unauthenticated_asset_count: Number(manifest.unauthenticated_asset_count ?? 0),
191
+ truncated: Boolean(manifest.truncated),
192
+ counts: manifest.counts,
193
+ filter_policy: manifest.filter_policy
194
+ }, null, 2), "utf8");
195
+ return { recordCount, uncompressedBytes };
196
+ }
197
+ async function verifyDetailLocators(root, schemaVersion) {
198
+ const directory = await readFile(resolve(root, "indexes/asset-directory.jsonl"), "utf8");
199
+ for (const line of directory.split(/\r?\n/)) {
200
+ if (!line.trim()) continue;
201
+ const row = asObject(JSON.parse(line));
202
+ if (!row || row.record_type === "header") continue;
203
+ const detail = await verifyContentLocator(root, row.detail_locator, "Detail");
204
+ await verifyContentLocator(root, detail.raw_locator, "Raw detail", { skipHash: schemaVersion === "3.0" });
205
+ }
206
+ }
207
+ async function verifyContentLocator(root, value, label, options = {}) {
208
+ const locator = asObject(value);
209
+ if (!locator || typeof locator.path !== "string" || typeof locator.content_hash !== "string" || !SHA256_PATTERN.test(locator.content_hash)) {
210
+ throw packageError(
211
+ `Asset package contains an invalid ${label.toLowerCase()} locator.`,
212
+ "ASSET_PACKAGE_MANIFEST_INVALID"
213
+ );
214
+ }
215
+ const target = resolveRecordPath(root, locator.path);
216
+ if (!await exists(target)) {
217
+ throw packageError(`Asset package is missing ${label.toLowerCase()} file ${locator.path}.`, "ASSET_PACKAGE_MANIFEST_INVALID");
218
+ }
219
+ const content = asObject(JSON.parse(await readFile(target, "utf8")));
220
+ if (!content) {
221
+ throw packageError(`${label} file is not a JSON object: ${locator.path}.`, "ASSET_PACKAGE_MANIFEST_INVALID");
222
+ }
223
+ if (!options.skipHash) {
224
+ const actualHash = createHash("sha256").update(JSON.stringify(content), "utf8").digest("hex");
225
+ if (actualHash !== locator.content_hash) {
226
+ throw packageError(`${label} content hash mismatch for ${locator.path}.`, "ASSET_PACKAGE_HASH_MISMATCH");
227
+ }
228
+ }
229
+ return content;
230
+ }
231
+ function parseRecord(line) {
232
+ const value = JSON.parse(line);
233
+ const record = asObject(value);
234
+ if (!record || typeof record.path !== "string") {
235
+ throw packageError("Asset package record is missing path.", "ASSET_PACKAGE_RECORD_INVALID");
236
+ }
237
+ if (!Object.prototype.hasOwnProperty.call(record, "content")) {
238
+ throw packageError("Asset package record is missing content.", "ASSET_PACKAGE_RECORD_INVALID");
239
+ }
240
+ return {
241
+ path: record.path,
242
+ append: Boolean(record.append),
243
+ content: record.content
244
+ };
245
+ }
246
+ function resolveRecordPath(root, path) {
247
+ if (path.startsWith("/") || path.includes("\0")) {
248
+ throw packageError(`Invalid asset package path: ${path}`, "ASSET_PACKAGE_PATH_INVALID");
249
+ }
250
+ const target = resolve(root, path);
251
+ const normalizedRoot = `${resolve(root)}/`;
252
+ if (!target.startsWith(normalizedRoot)) {
253
+ throw packageError(`Invalid asset package path: ${path}`, "ASSET_PACKAGE_PATH_INVALID");
254
+ }
255
+ return target;
256
+ }
257
+ function packageDescriptor(descriptor) {
258
+ const snapshotHash = stringValue(descriptor.snapshot_hash, "snapshot_hash").toLowerCase();
259
+ if (!SHA256_PATTERN.test(snapshotHash)) {
260
+ throw packageError("Asset package export returned invalid snapshot_hash.", "ASSET_PACKAGE_DESCRIPTOR_INVALID");
261
+ }
262
+ return {
263
+ snapshotId: typeof descriptor.snapshot_id === "string" ? descriptor.snapshot_id : void 0,
264
+ snapshotHash
265
+ };
266
+ }
267
+ function asObject(value) {
268
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
269
+ return value;
270
+ }
271
+ function stringValue(value, label) {
272
+ if (typeof value !== "string" || value.trim() === "") {
273
+ throw packageError(`${label} must be a non-empty string.`, "ASSET_PACKAGE_DESCRIPTOR_INVALID");
274
+ }
275
+ return value;
276
+ }
277
+ async function exists(path) {
278
+ try {
279
+ await stat(path);
280
+ return true;
281
+ } catch {
282
+ return false;
283
+ }
284
+ }
285
+ function packageError(message, code) {
286
+ return new CapabilityGatewayError(message, code, 422);
287
+ }
288
+
289
+ // src/commands/project-semantic/asset-package/export.ts
290
+ var ASSET_PACKAGE_EXPORT_CAPABILITY = "business_semantics.asset_package.export";
291
+ var ASSET_SCOPES = /* @__PURE__ */ new Set(["governed", "collaborative", "all_visible"]);
292
+ var GATEWAY_DOMAIN = "analysis";
293
+ function assetScope(ctx) {
294
+ const value = ctx.str("asset-scope") || "governed";
295
+ if (!ASSET_SCOPES.has(value)) {
296
+ throw new Error("asset-scope must be one of: governed, collaborative, all_visible");
297
+ }
298
+ return value;
299
+ }
300
+ var assetPackageExportCommand = {
301
+ service: "project-semantic",
302
+ resource: "asset-package",
303
+ command: "export",
304
+ description: "Export and materialize a knowledge-ready project asset package for CLI Agent consumption.",
305
+ helpText: "Requires access to the target project. Explicit asset-package export is independent of automatic knowledge-base discovery.",
306
+ flags: [
307
+ { name: "project-id", type: "number", required: true, desc: "Numeric project ID.", alias: "p", min: 1 },
308
+ {
309
+ name: "asset-scope",
310
+ type: "string",
311
+ required: false,
312
+ desc: "Asset scope: governed, collaborative, or all_visible. Defaults to governed."
313
+ }
314
+ ],
315
+ risk: "read",
316
+ validateInput: (ctx) => validateCapability(
317
+ ctx.host(),
318
+ resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
319
+ ASSET_PACKAGE_EXPORT_CAPABILITY,
320
+ { project_id: ctx.num("project-id"), asset_scope: assetScope(ctx) }
321
+ ),
322
+ dryRun: (ctx) => dryRunCapability(
323
+ ctx.host(),
324
+ resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
325
+ ASSET_PACKAGE_EXPORT_CAPABILITY,
326
+ { project_id: ctx.num("project-id"), asset_scope: assetScope(ctx) }
327
+ ),
328
+ execute: async (ctx) => {
329
+ const projectId = ctx.num("project-id");
330
+ const scope = assetScope(ctx);
331
+ const response = await executeCapabilityWithEnvelope(
332
+ ctx.host(),
333
+ resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
334
+ ASSET_PACKAGE_EXPORT_CAPABILITY,
335
+ { project_id: projectId, asset_scope: scope }
336
+ );
337
+ return response.data;
338
+ }
339
+ };
340
+ var projectSemanticAssetPackageExport = withAsyncArtifactLifecycle(assetPackageExportCommand, {
341
+ preflightOutput: ({ output, force }) => preflightAssetPackageOutput({ output, force }),
342
+ materialize: materializeProjectSemanticAssetPackage
343
+ });
344
+
345
+ // src/commands/project-semantic/index.ts
346
+ registerCapabilityGatewayRoute("project-semantic", {
347
+ gatewayDomain: "analysis",
348
+ capabilityPrefixes: ["business_semantics.asset_package"]
349
+ });
350
+ var commands = [
351
+ projectSemanticAssetPackageExport
352
+ ];
353
+ var project_semantic_default = commands;
354
+ export {
355
+ project_semantic_default as default
356
+ };
@@ -19,10 +19,13 @@ import {
19
19
  import {
20
20
  assertSkillDocumentSize
21
21
  } from "./chunk-T6OSFQZD.js";
22
+ import {
23
+ assertLegacyWorkspaceCommand
24
+ } from "./chunk-RK6GLDGI.js";
22
25
  import {
23
26
  require_lib
24
- } from "./chunk-DVMLWQD4.js";
25
- import "./chunk-V2NUHPXF.js";
27
+ } from "./chunk-CT7QDJS6.js";
28
+ import "./chunk-S6M42KND.js";
26
29
  import {
27
30
  TeAgentApiError,
28
31
  TeAgentCredentialsError,
@@ -30,16 +33,16 @@ import {
30
33
  postSandboxSyncPull,
31
34
  postToMainApp,
32
35
  uploadToMainApp
33
- } from "./chunk-HBGADCKA.js";
36
+ } from "./chunk-PLE722AJ.js";
34
37
  import {
35
38
  printError
36
- } from "./chunk-DX5CDO34.js";
39
+ } from "./chunk-KFNMQTZI.js";
37
40
  import "./chunk-Y74WTIKJ.js";
38
- import "./chunk-7XGFSUOM.js";
39
- import "./chunk-7FTTULED.js";
41
+ import "./chunk-GIK6EDUG.js";
42
+ import "./chunk-UQ77JXYH.js";
40
43
  import {
41
44
  __toESM
42
- } from "./chunk-MAPZ7VB6.js";
45
+ } from "./chunk-WNGFSIOB.js";
43
46
 
44
47
  // src/commands/sync/index.ts
45
48
  var import_jszip = __toESM(require_lib(), 1);
@@ -488,8 +491,9 @@ async function runPull(kind) {
488
491
  renderResults(pullResultRows(resp));
489
492
  }
490
493
  function registerSync(program) {
491
- program.command("sync").description("Sync Skills / MCPs between current workspace and te-claude main app").option("--direction <direction>", "push | pull (skip interactive direction picker)").option("--include-secrets", "Include MCP env secrets (TOKEN/SECRET/KEY) in push", false).option("--kind <kind>", "skill | mcp | both (skip interactive picker)").action(async (opts) => {
494
+ program.command("sync").description("Sync Skills / MCPs between a legacy sandbox workspace and te-claude main app").option("--direction <direction>", "push | pull (skip interactive direction picker)").option("--include-secrets", "Include MCP env secrets (TOKEN/SECRET/KEY) in push", false).option("--kind <kind>", "skill | mcp | both (skip interactive picker)").action(async (opts) => {
492
495
  try {
496
+ assertLegacyWorkspaceCommand("sync");
493
497
  const direction = await selectDirection(opts.direction);
494
498
  const kind = await selectKind(opts.kind);
495
499
  if (direction === "push") await runPush(kind, !!opts.includeSecrets);