@thinkingai/ae-cli 6.0.63 → 6.0.64
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 +8 -3
- package/README.zh.md +8 -3
- package/dist/{ai-monitor-X5GL44JT.js → ai-monitor-ABPXAOYL.js} +5 -5
- package/dist/ai-monitor.js +6 -6
- package/dist/{auth-SPQ46XQ3.js → auth-EV4FSIFI.js} +3 -3
- package/dist/{capability-JZP4KXZC.js → capability-B35ZQSSB.js} +3 -3
- package/dist/{chunk-E457FREE.js → chunk-434DSEOC.js} +6 -5
- package/dist/{chunk-F7TCQPQX.js → chunk-4COJB2CS.js} +1 -1
- package/dist/{chunk-YJYC5PLL.js → chunk-4CRZ2YUC.js} +2 -1
- package/dist/{chunk-RYY5NJK3.js → chunk-66F7SOGR.js} +2 -2
- package/dist/{chunk-PRCHMOWT.js → chunk-7AQ5Y6F2.js} +1 -1
- package/dist/{chunk-FGGEF7MI.js → chunk-7TENODN4.js} +2 -2
- package/dist/{chunk-VR2D54AA.js → chunk-7XTWP3NB.js} +1 -1
- package/dist/{chunk-6HOM2FOJ.js → chunk-A3PREN6Q.js} +4 -14
- package/dist/{chunk-2VKMHNUU.js → chunk-KVTFUP5T.js} +3 -3
- package/dist/{compat-check-JD5D77ET.js → compat-check-V3NGDQA5.js} +1 -1
- package/dist/{config-IIMRATTP.js → config-7OPBS5RW.js} +3 -3
- package/dist/context-WAR22IGB.js +349 -0
- package/dist/index.js +22 -22
- package/dist/{metadata-ZVPG2MIA.js → metadata-OROUBOO5.js} +5 -5
- package/dist/{personal-semantic-preference-YNCV4QG3.js → personal-semantic-preference-UQXUQJO3.js} +40 -15
- package/dist/{project-semantic-E7ZAQL5S.js → project-semantic-LEU2SN6J.js} +262 -14
- package/dist/{sync-Y4OZRQAY.js → sync-JXJUSBN3.js} +2 -2
- package/dist/{te-agent-RKAUTYJZ.js → te-agent-W67K6QTR.js} +1 -1
- package/dist/{te-analysis-7N5VC4JB.js → te-analysis-TJ7XHW6J.js} +306 -49
- package/dist/{te-community-SIA2UHTS.js → te-community-YNFYG42J.js} +4 -4
- package/dist/{te-dataops-5MJQCODU.js → te-dataops-GASA7SEG.js} +721 -217
- package/dist/{te-engage-ZTLOMKO3.js → te-engage-4CGFYLP6.js} +4 -4
- package/dist/{te-kb-LDL3MF2Y.js → te-kb-2ZYZKMDW.js} +27 -7
- package/dist/{te-team-JOWHCMZA.js → te-team-ZFQANIPN.js} +4 -4
- package/dist/{things-DOQ2L3O2.js → things-AYKSVWGZ.js} +1 -1
- package/dist/{update-KUS6TCPB.js → update-EDWNZQ6B.js} +2 -2
- package/package.json +4 -3
- package/skills/ae-analysis/SKILL.md +41 -16
- package/skills/ae-analysis/references/adhoc_export.md +1 -1
- package/skills/ae-analysis/references/adhoc_run.md +8 -2
- package/skills/ae-analysis/references/analysis_drilldown_contract.md +1 -1
- package/skills/ae-analysis/references/audience_scheduling.md +30 -0
- package/skills/ae-analysis/references/business_semantics_workspace.md +57 -0
- package/skills/ae-analysis/references/command_index.md +18 -13
- package/skills/ae-analysis/references/context_prepare.md +49 -0
- package/skills/ae-analysis/references/drilldown_entities_export.md +1 -1
- package/skills/ae-analysis/references/drilldown_entities_run.md +1 -1
- package/skills/ae-analysis/references/drilldown_user_events_export.md +3 -1
- package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -1
- package/skills/ae-analysis/references/governance_recommendation_export.md +1 -1
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +5 -1
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +4 -2
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +7 -6
- package/skills/ae-analysis/references/personal_semantic_preference_submit.md +1 -1
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +5 -1
- package/skills/ae-analysis/references/project_info_get.md +4 -0
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +1 -1
- package/skills/ae-analysis/references/project_semantic_setup.md +60 -0
- package/skills/ae-analysis/references/report_get.md +2 -0
- package/skills/ae-analysis/references/report_presentation.md +55 -0
- package/skills/ae-analysis/references/report_update.md +4 -2
- package/skills/ae-analysis/references/system_openapi_token_batch_generate.md +20 -0
- package/skills/ae-analysis/references/system_openapi_token_get.md +14 -0
- package/skills/ae-analysis/references/user_cluster_create.md +3 -1
- package/skills/ae-analysis/references/user_cluster_models.md +2 -0
- package/skills/ae-analysis/references/user_cluster_update.md +5 -3
- package/skills/ae-analysis/references/user_tag_create.md +4 -22
- package/skills/ae-analysis/references/user_tag_models.md +8 -0
- package/skills/ae-analysis/references/user_tag_update.md +6 -14
- package/skills/ae-analysis/scripts/read-semantic-catalog.mjs +40 -0
- package/skills/ae-dataops/SKILL.md +9 -6
- package/skills/ae-dataops/references/dataops-flow-create.md +64 -47
- package/skills/ae-dataops/references/dataops-flow-monitor.md +4 -2
- package/skills/ae-dataops/references/dataops-flow-python.md +109 -0
- package/skills/ae-kb/SKILL.md +10 -5
- package/skills/ae-kb/references/analysis-workflow.md +19 -10
- package/skills/ae-kb/references/query-workflow.md +34 -17
- package/skills/ae-kb-discovery/SKILL.md +4 -3
- package/dist/context-BXHIPIIX.js +0 -138
package/dist/{personal-semantic-preference-YNCV4QG3.js → personal-semantic-preference-UQXUQJO3.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCapabilityCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-434DSEOC.js";
|
|
5
5
|
import {
|
|
6
6
|
registerCapabilityGatewayRoute
|
|
7
7
|
} from "./chunk-AWW2T2WL.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-7XTWP3NB.js";
|
|
9
|
+
import "./chunk-A3PREN6Q.js";
|
|
10
10
|
import "./chunk-NNK3JBH4.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-4CRZ2YUC.js";
|
|
12
12
|
import "./chunk-PUSFEC6B.js";
|
|
13
13
|
import "./chunk-PLNS5J33.js";
|
|
14
14
|
import "./chunk-AMURHMS3.js";
|
|
@@ -32,6 +32,9 @@ function createPersonalSemanticPreferenceCommand(config) {
|
|
|
32
32
|
return {
|
|
33
33
|
...projectCommand,
|
|
34
34
|
validate: (ctx) => {
|
|
35
|
+
if (config.command === "get" && ctx.bool("include-expired") && ctx.bool("mark-used")) {
|
|
36
|
+
throw new Error("--include-expired cannot be combined with --mark-used.");
|
|
37
|
+
}
|
|
35
38
|
const projectId = ctx.num("project-id");
|
|
36
39
|
if (!Number.isSafeInteger(projectId) || projectId !== -1 && projectId <= 0) {
|
|
37
40
|
throw new Error("--project-id must be a positive integer or -1 for global personal semantics.");
|
|
@@ -117,7 +120,7 @@ function optionalResourceRefs(ctx) {
|
|
|
117
120
|
}
|
|
118
121
|
function validateContextType(ctx) {
|
|
119
122
|
const value = ctx.str("context-type");
|
|
120
|
-
const supported = ["preference", "asset_context", "experience", "background"];
|
|
123
|
+
const supported = ["preference", "business_rule", "asset_context", "experience", "background"];
|
|
121
124
|
if (!supported.includes(value)) {
|
|
122
125
|
throw new Error(`--context-type must be one of: ${supported.join(", ")}.`);
|
|
123
126
|
}
|
|
@@ -136,6 +139,14 @@ function validatePersonalSemanticWrite(ctx) {
|
|
|
136
139
|
function compactInput(input) {
|
|
137
140
|
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
|
|
138
141
|
}
|
|
142
|
+
function optionalSources(ctx) {
|
|
143
|
+
if (ctx.str("sources") === "") return void 0;
|
|
144
|
+
const value = ctx.json("sources");
|
|
145
|
+
if (!Array.isArray(value) || value.length > 200 || value.some((item) => !item || typeof item !== "object" || Array.isArray(item))) {
|
|
146
|
+
throw new Error("--sources must be a JSON array of at most 200 source objects.");
|
|
147
|
+
}
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
139
150
|
|
|
140
151
|
// src/commands/personal-semantic-preference/add.ts
|
|
141
152
|
var personalSemanticPreferenceAdd = createPersonalSemanticPreferenceCommand({
|
|
@@ -145,12 +156,15 @@ var personalSemanticPreferenceAdd = createPersonalSemanticPreferenceCommand({
|
|
|
145
156
|
description: "Add one personal semantic preference for the authenticated user.",
|
|
146
157
|
flags: [
|
|
147
158
|
{ name: "project-id", type: "number", required: true, desc: "Positive project ID, or -1 for current-user global personal semantics.", alias: "p" },
|
|
148
|
-
{ name: "context-type", type: "string", required: true, desc: "preference | asset_context | experience | background." },
|
|
149
|
-
{ name: "title", type: "string", required: true, desc: "
|
|
150
|
-
{ name: "summary", type: "string", required: true, desc: "Compact
|
|
159
|
+
{ name: "context-type", type: "string", required: true, desc: "preference | business_rule | asset_context | experience | background." },
|
|
160
|
+
{ name: "title", type: "string", required: true, desc: "Distinct business concept, adding only a necessary scope or condition.", maxLength: 255 },
|
|
161
|
+
{ name: "summary", type: "string", required: true, desc: "Compact selection summary with subject, applicability and key exclusions.", maxLength: 1e3 },
|
|
151
162
|
{ name: "content", type: "string", required: true, desc: "Full personal semantic preference content.", maxLength: 2e4 },
|
|
152
|
-
{ name: "keywords", type: "json", desc: "Optional JSON array of
|
|
163
|
+
{ name: "keywords", type: "json", desc: "Optional JSON array of distinctive business phrases or confirmed aliases; avoid generic fragments." },
|
|
153
164
|
{ name: "resource-refs", type: "json", desc: "Ordered JSON asset references; required only for asset_context." },
|
|
165
|
+
{ name: "applicable-question", type: "string", desc: "Questions and boundaries where this rule applies.", maxLength: 1e3 },
|
|
166
|
+
{ name: "dependency-ids", type: "json", desc: "Explicit dependency IDs, in the same scope/project." },
|
|
167
|
+
{ name: "sources", type: "json", desc: 'Source filenames as [{"name":"business-overview.docx"}]; optional input_file_id, or existing evidence_id. Keep paths and raw JSON local.' },
|
|
154
168
|
{ name: "fresh-until-at", type: "string", desc: "Optional freshness expiration timestamp: yyyy-MM-dd HH:mm:ss." },
|
|
155
169
|
{ name: "request-id", type: "string", desc: "Optional idempotency key; generated when omitted.", maxLength: 128 }
|
|
156
170
|
],
|
|
@@ -163,6 +177,9 @@ var personalSemanticPreferenceAdd = createPersonalSemanticPreferenceCommand({
|
|
|
163
177
|
summary: ctx.str("summary"),
|
|
164
178
|
content: ctx.str("content"),
|
|
165
179
|
keywords: optionalKeywords(ctx),
|
|
180
|
+
applicable_question: optionalString(ctx, "applicable-question"),
|
|
181
|
+
dependency_ids: optionalJsonStringArray(ctx, "dependency-ids", "--dependency-ids"),
|
|
182
|
+
sources: optionalSources(ctx),
|
|
166
183
|
resource_refs: optionalResourceRefs(ctx),
|
|
167
184
|
fresh_until_at: optionalString(ctx, "fresh-until-at"),
|
|
168
185
|
request_id: optionalString(ctx, "request-id")
|
|
@@ -200,6 +217,7 @@ var personalSemanticPreferenceGet = createPersonalSemanticPreferenceCommand({
|
|
|
200
217
|
{ name: "project-id", type: "number", required: true, desc: "Positive project ID, or -1 for current-user global personal semantics.", alias: "p" },
|
|
201
218
|
{ name: "id", type: "string", required: true, desc: "Preference ID returned by list/add." },
|
|
202
219
|
{ name: "title", type: "string", required: true, desc: "Preference title copied from list output for telemetry only.", minLength: 1, maxLength: 255 },
|
|
220
|
+
{ name: "include-expired", type: "boolean", desc: "Maintenance read of expired entries; cannot be combined with --mark-used." },
|
|
203
221
|
{ name: "mark-used", type: "boolean", desc: "Count this preference as adopted and update its usage heat." }
|
|
204
222
|
],
|
|
205
223
|
risk: "read",
|
|
@@ -207,7 +225,8 @@ var personalSemanticPreferenceGet = createPersonalSemanticPreferenceCommand({
|
|
|
207
225
|
project_id: ctx.num("project-id"),
|
|
208
226
|
id: ctx.str("id"),
|
|
209
227
|
title: ctx.str("title"),
|
|
210
|
-
mark_used: ctx.bool("mark-used")
|
|
228
|
+
mark_used: ctx.bool("mark-used"),
|
|
229
|
+
...ctx.bool("include-expired") ? { include_expired: true } : {}
|
|
211
230
|
})
|
|
212
231
|
});
|
|
213
232
|
|
|
@@ -217,7 +236,7 @@ var personalSemanticPreferenceList = createPersonalSemanticPreferenceCommand({
|
|
|
217
236
|
resource: "",
|
|
218
237
|
command: "list",
|
|
219
238
|
capabilityId: CAPABILITY_ID,
|
|
220
|
-
description: "List the current-user lightweight personal semantic preference catalog
|
|
239
|
+
description: "List the complete current-user lightweight personal semantic preference catalog for the selected scope.",
|
|
221
240
|
flags: [
|
|
222
241
|
{ name: "project-id", type: "number", required: true, desc: "Positive project ID, or -1 for current-user global personal semantics.", alias: "p" }
|
|
223
242
|
],
|
|
@@ -334,12 +353,15 @@ var personalSemanticPreferenceUpdate = createPersonalSemanticPreferenceCommand({
|
|
|
334
353
|
{ name: "project-id", type: "number", required: true, desc: "Positive project ID, or -1 for current-user global personal semantics.", alias: "p" },
|
|
335
354
|
{ name: "id", type: "string", required: true, desc: "Preference ID returned by list/add." },
|
|
336
355
|
{ name: "expected-revision", type: "number", required: true, desc: "Revision returned by the latest read.", min: 1 },
|
|
337
|
-
{ name: "context-type", type: "string", required: true, desc: "preference | asset_context | experience | background." },
|
|
338
|
-
{ name: "title", type: "string", required: true, desc: "
|
|
339
|
-
{ name: "summary", type: "string", required: true, desc: "Compact
|
|
356
|
+
{ name: "context-type", type: "string", required: true, desc: "preference | business_rule | asset_context | experience | background." },
|
|
357
|
+
{ name: "title", type: "string", required: true, desc: "Distinct business concept, adding only a necessary scope or condition.", maxLength: 255 },
|
|
358
|
+
{ name: "summary", type: "string", required: true, desc: "Compact selection summary with subject, applicability and key exclusions.", maxLength: 1e3 },
|
|
340
359
|
{ name: "content", type: "string", required: true, desc: "Full replacement content.", maxLength: 2e4 },
|
|
341
|
-
{ name: "keywords", type: "json", desc: "Optional JSON array of
|
|
360
|
+
{ name: "keywords", type: "json", desc: "Optional JSON array of distinctive business phrases or confirmed aliases; avoid generic fragments." },
|
|
342
361
|
{ name: "resource-refs", type: "json", desc: "Ordered JSON asset references; required only for asset_context." },
|
|
362
|
+
{ name: "applicable-question", type: "string", desc: "Questions and boundaries where this rule applies.", maxLength: 1e3 },
|
|
363
|
+
{ name: "dependency-ids", type: "json", desc: "Explicit dependency IDs, in the same scope/project." },
|
|
364
|
+
{ name: "sources", type: "json", desc: 'Source filenames as [{"name":"business-overview.docx"}]; optional input_file_id, or existing evidence_id. Keep paths and raw JSON local.' },
|
|
343
365
|
{ name: "fresh-until-at", type: "string", desc: "Optional freshness expiration timestamp: yyyy-MM-dd HH:mm:ss." },
|
|
344
366
|
{ name: "request-id", type: "string", desc: "Optional idempotency key; generated when omitted.", maxLength: 128 }
|
|
345
367
|
],
|
|
@@ -354,6 +376,9 @@ var personalSemanticPreferenceUpdate = createPersonalSemanticPreferenceCommand({
|
|
|
354
376
|
summary: ctx.str("summary"),
|
|
355
377
|
content: ctx.str("content"),
|
|
356
378
|
keywords: optionalKeywords(ctx),
|
|
379
|
+
applicable_question: optionalString(ctx, "applicable-question"),
|
|
380
|
+
dependency_ids: optionalJsonStringArray(ctx, "dependency-ids", "--dependency-ids"),
|
|
381
|
+
sources: optionalSources(ctx),
|
|
357
382
|
resource_refs: optionalResourceRefs(ctx),
|
|
358
383
|
fresh_until_at: optionalString(ctx, "fresh-until-at"),
|
|
359
384
|
request_id: optionalString(ctx, "request-id")
|
|
@@ -3,22 +3,23 @@ import {
|
|
|
3
3
|
assertOutputPathAvailable,
|
|
4
4
|
downloadAnalysisArtifact,
|
|
5
5
|
withAsyncArtifactLifecycle
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-66F7SOGR.js";
|
|
7
7
|
import {
|
|
8
8
|
registerCapabilityGatewayRoute,
|
|
9
9
|
resolveGatewayDomain
|
|
10
10
|
} from "./chunk-AWW2T2WL.js";
|
|
11
11
|
import {
|
|
12
|
+
unwrapOutputData,
|
|
12
13
|
withOutputMetadata
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7XTWP3NB.js";
|
|
14
15
|
import {
|
|
15
16
|
CapabilityGatewayError,
|
|
16
17
|
dryRunCapabilityWithEnvelope,
|
|
17
18
|
executeCapabilityWithEnvelope,
|
|
18
19
|
validateCapabilityWithEnvelope
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-A3PREN6Q.js";
|
|
20
21
|
import "./chunk-NNK3JBH4.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-4CRZ2YUC.js";
|
|
22
23
|
import "./chunk-PUSFEC6B.js";
|
|
23
24
|
import "./chunk-PLNS5J33.js";
|
|
24
25
|
import "./chunk-AMURHMS3.js";
|
|
@@ -308,15 +309,40 @@ function packageError(message, code) {
|
|
|
308
309
|
|
|
309
310
|
// src/commands/project-semantic/asset-package/export.ts
|
|
310
311
|
var ASSET_PACKAGE_EXPORT_CAPABILITY = "business_semantics.asset_package.export";
|
|
311
|
-
var ASSET_SCOPES = /* @__PURE__ */ new Set(["governed", "collaborative", "all_visible"]);
|
|
312
|
+
var ASSET_SCOPES = /* @__PURE__ */ new Set(["governed", "collaborative", "all_visible", "certified", "frequent", "all", "specified"]);
|
|
312
313
|
var GATEWAY_DOMAIN = "analysis";
|
|
313
314
|
function assetScope(ctx) {
|
|
314
315
|
const value = ctx.str("asset-scope") || "governed";
|
|
315
316
|
if (!ASSET_SCOPES.has(value)) {
|
|
316
|
-
throw new Error(
|
|
317
|
+
throw new Error(
|
|
318
|
+
"asset-scope must be one of: governed, collaborative, all_visible, certified, frequent, all, specified"
|
|
319
|
+
);
|
|
317
320
|
}
|
|
318
321
|
return value;
|
|
319
322
|
}
|
|
323
|
+
function buildAssetPackageInput(ctx) {
|
|
324
|
+
const scope = assetScope(ctx);
|
|
325
|
+
const refs = ctx.json("asset-refs");
|
|
326
|
+
if (scope === "specified") {
|
|
327
|
+
if (!Array.isArray(refs) || refs.length < 1 || refs.length > 1e3)
|
|
328
|
+
throw new Error("specified scope requires 1 to 1000 asset-refs.");
|
|
329
|
+
const seen = /* @__PURE__ */ new Set();
|
|
330
|
+
for (const ref of refs) {
|
|
331
|
+
if (!ref || typeof ref !== "object" || Array.isArray(ref) || Object.keys(ref).length !== 2 || !["dashboard", "report", "metric", "event", "event_prop", "user_prop", "user_tag", "user_cluster"].includes(
|
|
332
|
+
ref.resource_type
|
|
333
|
+
) || typeof ref.resource_key !== "string" || !ref.resource_key.trim())
|
|
334
|
+
throw new Error("Each asset reference requires a supported resource_type and a non-empty string resource_key.");
|
|
335
|
+
const key = `${ref.resource_type}:${ref.resource_key}`;
|
|
336
|
+
if (seen.has(key)) throw new Error("Duplicate asset reference.");
|
|
337
|
+
seen.add(key);
|
|
338
|
+
}
|
|
339
|
+
} else if (refs !== void 0 && refs !== null) throw new Error("asset-refs is only supported for specified scope.");
|
|
340
|
+
return {
|
|
341
|
+
project_id: ctx.num("project-id"),
|
|
342
|
+
asset_scope: scope,
|
|
343
|
+
...refs ? { asset_refs: refs } : {}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
320
346
|
var assetPackageExportCommand = {
|
|
321
347
|
service: "project-semantic",
|
|
322
348
|
resource: "asset-package",
|
|
@@ -324,12 +350,24 @@ var assetPackageExportCommand = {
|
|
|
324
350
|
description: "Export and materialize a knowledge-ready project asset package for CLI Agent consumption.",
|
|
325
351
|
helpText: "Requires access to the target project. Explicit asset-package export is independent of automatic knowledge-base discovery.",
|
|
326
352
|
flags: [
|
|
327
|
-
{
|
|
353
|
+
{
|
|
354
|
+
name: "project-id",
|
|
355
|
+
type: "number",
|
|
356
|
+
required: true,
|
|
357
|
+
desc: "Numeric project ID.",
|
|
358
|
+
alias: "p",
|
|
359
|
+
min: 1
|
|
360
|
+
},
|
|
328
361
|
{
|
|
329
362
|
name: "asset-scope",
|
|
330
363
|
type: "string",
|
|
331
364
|
required: false,
|
|
332
|
-
desc: "
|
|
365
|
+
desc: "Legacy scopes: governed (default), collaborative, all_visible. Manager setup scopes: certified, frequent (positive 90-day query count, ranked), all, specified."
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "asset-refs",
|
|
369
|
+
type: "json",
|
|
370
|
+
desc: "Exact [{resource_type,resource_key}] references for specified scope; JSON or @file. Keys must be strings."
|
|
333
371
|
}
|
|
334
372
|
],
|
|
335
373
|
risk: "read",
|
|
@@ -337,22 +375,20 @@ var assetPackageExportCommand = {
|
|
|
337
375
|
ctx.host(),
|
|
338
376
|
resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
|
|
339
377
|
ASSET_PACKAGE_EXPORT_CAPABILITY,
|
|
340
|
-
|
|
378
|
+
buildAssetPackageInput(ctx)
|
|
341
379
|
).then((response) => withOutputMetadata(response.data, response.meta)),
|
|
342
380
|
dryRun: (ctx) => dryRunCapabilityWithEnvelope(
|
|
343
381
|
ctx.host(),
|
|
344
382
|
resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
|
|
345
383
|
ASSET_PACKAGE_EXPORT_CAPABILITY,
|
|
346
|
-
|
|
384
|
+
buildAssetPackageInput(ctx)
|
|
347
385
|
).then((response) => withOutputMetadata(response.data, response.meta)),
|
|
348
386
|
execute: async (ctx) => {
|
|
349
|
-
const projectId = ctx.num("project-id");
|
|
350
|
-
const scope = assetScope(ctx);
|
|
351
387
|
const response = await executeCapabilityWithEnvelope(
|
|
352
388
|
ctx.host(),
|
|
353
389
|
resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
|
|
354
390
|
ASSET_PACKAGE_EXPORT_CAPABILITY,
|
|
355
|
-
|
|
391
|
+
buildAssetPackageInput(ctx)
|
|
356
392
|
);
|
|
357
393
|
return withOutputMetadata(response.data, response.meta);
|
|
358
394
|
}
|
|
@@ -362,13 +398,225 @@ var projectSemanticAssetPackageExport = withAsyncArtifactLifecycle(assetPackageE
|
|
|
362
398
|
materialize: materializeProjectSemanticAssetPackage
|
|
363
399
|
});
|
|
364
400
|
|
|
401
|
+
// src/commands/project-semantic/setup.ts
|
|
402
|
+
import { createHash as createHash2 } from "crypto";
|
|
403
|
+
import { mkdir as mkdir2, readFile as readFile2, stat as stat2, writeFile as writeFile2 } from "fs/promises";
|
|
404
|
+
import { basename as basename2, resolve as resolve2 } from "path";
|
|
405
|
+
var scopes = /* @__PURE__ */ new Set(["none", "certified", "frequent", "all", "specified"]);
|
|
406
|
+
function options(ctx) {
|
|
407
|
+
const scope = ctx.str("asset-scope") || "certified";
|
|
408
|
+
if (!scopes.has(scope)) throw new Error("asset-scope must be none, certified, frequent, all, or specified.");
|
|
409
|
+
const materials = ctx.json("materials");
|
|
410
|
+
if (materials !== void 0 && (!Array.isArray(materials) || materials.some((file) => typeof file !== "string" || !file.trim())))
|
|
411
|
+
throw new Error("materials must be an array of local file paths.");
|
|
412
|
+
if (scope === "none" && (!Array.isArray(materials) || !materials.length))
|
|
413
|
+
throw new Error("Provide materials or select an asset scope.");
|
|
414
|
+
const output = ctx.str("output");
|
|
415
|
+
if (!output) throw new Error("output must name a new private setup directory.");
|
|
416
|
+
if (!Number.isInteger(ctx.num("project-id")) || ctx.num("project-id") <= 0)
|
|
417
|
+
throw new Error("project-id must be a positive integer.");
|
|
418
|
+
if (scope !== "none")
|
|
419
|
+
buildAssetPackageInput({
|
|
420
|
+
...ctx,
|
|
421
|
+
str: (name) => name === "asset-scope" ? scope : ctx.str(name)
|
|
422
|
+
});
|
|
423
|
+
else if (ctx.json("asset-refs") !== void 0) throw new Error("asset-refs requires specified asset scope.");
|
|
424
|
+
return {
|
|
425
|
+
scope,
|
|
426
|
+
materials: materials || [],
|
|
427
|
+
output: resolve2(output)
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
var reference = "skills/ae-analysis/references/project_semantic_setup.md";
|
|
431
|
+
var nextSteps = [
|
|
432
|
+
"Read the complete retained semantic catalogs with the bundled catalog pager; do not mark use during management.",
|
|
433
|
+
"Read every input material and the selected asset indexes; inspect exact definitions and necessary dependencies. File inventory is not evidence extraction.",
|
|
434
|
+
"Synthesize one project background draft, distinct semantic candidates, source locators, conflicts and unanswered questions. Do not mechanically create one entry per file or asset.",
|
|
435
|
+
"Read likely existing matches by exact ID without marking use; propose CREATE, UPDATE or KEEP with scope, revision and source evidence.",
|
|
436
|
+
"Present all proposed writes for user confirmation. Persist an approved local import plan and reuse unchanged request IDs when resuming.",
|
|
437
|
+
"Save confirmed project entries through existing project_context capabilities and the background as a draft. Publish background only with separate explicit intent."
|
|
438
|
+
];
|
|
439
|
+
var projectSemanticSetup = {
|
|
440
|
+
service: "project-semantic",
|
|
441
|
+
command: "setup",
|
|
442
|
+
description: "Prepare a private evidence workspace for the CLI Agent project-semantics setup workflow; never generates or saves business facts automatically.",
|
|
443
|
+
helpText: `This read-only L1 workflow reuses asset-package export and existing background/catalog reads. Continue with ${reference}.`,
|
|
444
|
+
risk: "read",
|
|
445
|
+
sensitiveOutput: true,
|
|
446
|
+
flags: [
|
|
447
|
+
{
|
|
448
|
+
name: "project-id",
|
|
449
|
+
type: "number",
|
|
450
|
+
required: true,
|
|
451
|
+
min: 1,
|
|
452
|
+
desc: "Target project ID; semantic management permission is required."
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "asset-scope",
|
|
456
|
+
type: "string",
|
|
457
|
+
desc: "certified (default), frequent, all, specified, or none for materials only. frequent uses positive query counts from the latest 90-day usage snapshot."
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "asset-refs",
|
|
461
|
+
type: "json",
|
|
462
|
+
desc: "Exact asset references for specified scope; resolve supplied names or links before running."
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: "materials",
|
|
466
|
+
type: "json",
|
|
467
|
+
sensitive: true,
|
|
468
|
+
desc: "Optional array of local source file paths. The command inventories bytes; the calling Agent reads and interprets them."
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: "output",
|
|
472
|
+
type: "string",
|
|
473
|
+
required: true,
|
|
474
|
+
desc: "New private evidence directory. Existing directories are refused; retain it for review and recovery."
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
validate: (ctx) => {
|
|
478
|
+
options(ctx);
|
|
479
|
+
},
|
|
480
|
+
dryRun: async (ctx) => ({
|
|
481
|
+
workflow: "project_semantic_setup",
|
|
482
|
+
project_id: ctx.num("project-id"),
|
|
483
|
+
asset_scope: options(ctx).scope,
|
|
484
|
+
remote_writes: false,
|
|
485
|
+
agent_synthesis_required: true,
|
|
486
|
+
reference
|
|
487
|
+
}),
|
|
488
|
+
execute: async (ctx) => {
|
|
489
|
+
const selected = options(ctx);
|
|
490
|
+
try {
|
|
491
|
+
await stat2(selected.output);
|
|
492
|
+
throw new Error("Setup output already exists. Continue from its manifest or choose another output directory.");
|
|
493
|
+
} catch (error) {
|
|
494
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
495
|
+
}
|
|
496
|
+
const materials = [];
|
|
497
|
+
for (const file of selected.materials) {
|
|
498
|
+
const path = resolve2(file);
|
|
499
|
+
const info = await stat2(path);
|
|
500
|
+
if (!info.isFile() || info.size > 20 * 1024 * 1024)
|
|
501
|
+
throw new Error("Each material must be a regular file no larger than 20 MiB.");
|
|
502
|
+
const bytes = await readFile2(path);
|
|
503
|
+
materials.push({
|
|
504
|
+
path,
|
|
505
|
+
name: basename2(path),
|
|
506
|
+
bytes: bytes.length,
|
|
507
|
+
sha256: createHash2("sha256").update(bytes).digest("hex"),
|
|
508
|
+
parse_status: "not_read_by_agent"
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
const call = async (operation, projectId) => (await executeCapabilityWithEnvelope(ctx.host(), "analysis", `business_semantics.${operation}`, {
|
|
512
|
+
project_id: projectId
|
|
513
|
+
})).data;
|
|
514
|
+
const company = await call("background.get", 0);
|
|
515
|
+
const project = await call("background.get", ctx.num("project-id"));
|
|
516
|
+
const draft = await call("background.draft_get", ctx.num("project-id"));
|
|
517
|
+
const globalPersonal = await call("global_personal_context.list", -1);
|
|
518
|
+
const personal = await call("personal_context.list", ctx.num("project-id"));
|
|
519
|
+
const publicCatalog = await call("project_context.list", ctx.num("project-id"));
|
|
520
|
+
for (const catalog of [globalPersonal, personal, publicCatalog]) {
|
|
521
|
+
if (catalog?.complete !== true || catalog.truncated === true || !Array.isArray(catalog.items) || catalog.items.length !== catalog.total) {
|
|
522
|
+
throw new Error("A complete semantic catalog is required; do not silently continue with partial evidence.");
|
|
523
|
+
}
|
|
524
|
+
const seen = /* @__PURE__ */ new Set();
|
|
525
|
+
for (const row of catalog.items) {
|
|
526
|
+
if (!row || typeof row.id !== "string" || typeof row.title !== "string" || typeof row.summary !== "string" || !Number.isSafeInteger(row.revision) || seen.has(row.id) || row.keywords !== void 0 && (!Array.isArray(row.keywords) || row.keywords.some((keyword) => typeof keyword !== "string"))) {
|
|
527
|
+
throw new Error("Catalog row identity, revision, summary or keywords is invalid.");
|
|
528
|
+
}
|
|
529
|
+
seen.add(row.id);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
await mkdir2(selected.output, { recursive: false, mode: 448 });
|
|
533
|
+
const save = (name, data) => writeFile2(resolve2(selected.output, name), JSON.stringify(data, null, 2) + "\n", { flag: "wx", mode: 384 });
|
|
534
|
+
await save("context.json", {
|
|
535
|
+
company_background: company,
|
|
536
|
+
project_background: project,
|
|
537
|
+
project_draft: draft
|
|
538
|
+
});
|
|
539
|
+
await save("global-personal-catalog.json", {
|
|
540
|
+
ok: true,
|
|
541
|
+
data: globalPersonal
|
|
542
|
+
});
|
|
543
|
+
await save("project-personal-catalog.json", { ok: true, data: personal });
|
|
544
|
+
await save("project-public-catalog.json", {
|
|
545
|
+
ok: true,
|
|
546
|
+
data: publicCatalog
|
|
547
|
+
});
|
|
548
|
+
await save("materials.json", materials);
|
|
549
|
+
const pending = {
|
|
550
|
+
workflow: "project_semantic_setup",
|
|
551
|
+
status: "preparing_assets",
|
|
552
|
+
project_id: ctx.num("project-id"),
|
|
553
|
+
asset_scope: selected.scope,
|
|
554
|
+
remote_writes: false,
|
|
555
|
+
agent_synthesis_required: true,
|
|
556
|
+
reference
|
|
557
|
+
};
|
|
558
|
+
await save("setup.json", pending);
|
|
559
|
+
let assetPackage;
|
|
560
|
+
try {
|
|
561
|
+
if (selected.scope !== "none") {
|
|
562
|
+
const packageContext = {
|
|
563
|
+
...ctx,
|
|
564
|
+
str: (name) => name === "asset-scope" ? selected.scope : name === "output" ? resolve2(selected.output, "assets") : ctx.str(name),
|
|
565
|
+
bool: (name) => name === "force" ? false : ctx.bool(name)
|
|
566
|
+
};
|
|
567
|
+
assetPackage = unwrapOutputData(await projectSemanticAssetPackageExport.execute(packageContext));
|
|
568
|
+
const manifest2 = JSON.parse(await readFile2(resolve2(selected.output, "assets", "manifest.json"), "utf8"));
|
|
569
|
+
if (manifest2.truncated === true || manifest2.project_id !== ctx.num("project-id") || manifest2.asset_scope !== selected.scope)
|
|
570
|
+
throw new Error(
|
|
571
|
+
"Exported asset evidence is partial or belongs to another project/scope. Keep the workspace for diagnosis; do not synthesize from it."
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
} catch (error) {
|
|
575
|
+
await writeFile2(
|
|
576
|
+
resolve2(selected.output, "setup.json"),
|
|
577
|
+
JSON.stringify(
|
|
578
|
+
{
|
|
579
|
+
...pending,
|
|
580
|
+
status: "evidence_failed",
|
|
581
|
+
failed_step: "asset_export",
|
|
582
|
+
...error instanceof CapabilityGatewayError ? {
|
|
583
|
+
error_code: error.code,
|
|
584
|
+
...typeof error.meta?.run_id === "string" ? { run_id: error.meta.run_id } : {},
|
|
585
|
+
...typeof error.meta?.artifact_id === "string" ? { artifact_id: error.meta.artifact_id } : {}
|
|
586
|
+
} : {}
|
|
587
|
+
},
|
|
588
|
+
null,
|
|
589
|
+
2
|
|
590
|
+
) + "\n",
|
|
591
|
+
{ mode: 384 }
|
|
592
|
+
);
|
|
593
|
+
throw error;
|
|
594
|
+
}
|
|
595
|
+
const manifest = {
|
|
596
|
+
workflow: "project_semantic_setup",
|
|
597
|
+
status: "evidence_ready",
|
|
598
|
+
project_id: ctx.num("project-id"),
|
|
599
|
+
asset_scope: selected.scope,
|
|
600
|
+
materials: materials.length,
|
|
601
|
+
asset_package: assetPackage,
|
|
602
|
+
remote_writes: false,
|
|
603
|
+
agent_synthesis_required: true,
|
|
604
|
+
reference,
|
|
605
|
+
next_steps: nextSteps
|
|
606
|
+
};
|
|
607
|
+
await writeFile2(resolve2(selected.output, "setup.json"), JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
|
|
608
|
+
return { ...manifest, output_path: selected.output };
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
|
|
365
612
|
// src/commands/project-semantic/index.ts
|
|
366
613
|
registerCapabilityGatewayRoute("project-semantic", {
|
|
367
614
|
gatewayDomain: "analysis",
|
|
368
615
|
capabilityPrefixes: ["business_semantics.asset_package"]
|
|
369
616
|
});
|
|
370
617
|
var commands = [
|
|
371
|
-
projectSemanticAssetPackageExport
|
|
618
|
+
projectSemanticAssetPackageExport,
|
|
619
|
+
projectSemanticSetup
|
|
372
620
|
];
|
|
373
621
|
var project_semantic_default = commands;
|
|
374
622
|
export {
|
|
@@ -36,8 +36,8 @@ import {
|
|
|
36
36
|
} from "./chunk-ETQXIZFP.js";
|
|
37
37
|
import {
|
|
38
38
|
printError
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-7XTWP3NB.js";
|
|
40
|
+
import "./chunk-4CRZ2YUC.js";
|
|
41
41
|
import "./chunk-PUSFEC6B.js";
|
|
42
42
|
import "./chunk-PLNS5J33.js";
|
|
43
43
|
import "./chunk-AMURHMS3.js";
|