@thinkingai/ae-cli 6.1.41 → 6.1.43
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 +14 -4
- package/README.zh.md +14 -4
- package/bin/ae-cli.js +3 -0
- package/bin/heari/commander-LICENSE +22 -0
- package/bin/heari/engine.mjs +6136 -0
- package/bin/heari/package.json +6 -0
- package/bin/heari.mjs +29 -0
- package/cli-installation-guide.md +6 -7
- package/dist/{ai-monitor-OOOD4QDK.js → ai-monitor-4VPHXQTL.js} +7 -6
- package/dist/ai-monitor.js +10 -9
- package/dist/{auth-6BUUY5XS.js → auth-RDSS2LUT.js} +18 -16
- package/dist/{automation-IMDCJUML.js → automation-VLIWG2XY.js} +5 -4
- package/dist/{capability-XXFCANX7.js → capability-CUOEIB5F.js} +5 -4
- package/dist/{chunk-KE5WGBXS.js → chunk-3DTMWDJX.js} +1 -1
- package/dist/{chunk-FPPCXG6K.js → chunk-3FSYICDW.js} +6 -5
- package/dist/{chunk-BEVWMPCZ.js → chunk-3TV24AVQ.js} +10 -10
- package/dist/{chunk-DTODOQ6T.js → chunk-3U75VLCP.js} +1 -1
- package/dist/{chunk-6W56UQPO.js → chunk-4MOCV6HU.js} +1 -1
- package/dist/{chunk-M2OCZRVX.js → chunk-6VLHJKDD.js} +2 -2
- package/dist/{chunk-WG27BD67.js → chunk-7KBENPQF.js} +8 -16
- package/dist/{chunk-5YQSCMGS.js → chunk-BFSWGXM2.js} +3 -3
- package/dist/{chunk-UK7HQ4IL.js → chunk-CBNE2S44.js} +2 -2
- package/dist/{chunk-UWQXGF44.js → chunk-FEYZBUFQ.js} +4 -353
- package/dist/chunk-FKTVD63C.js +369 -0
- package/dist/{chunk-2H3SFJE3.js → chunk-FKVG7LOP.js} +5 -3
- package/dist/{chunk-I7H72CMN.js → chunk-IAZ4AMVY.js} +109 -85
- package/dist/{chunk-KDRE7SWM.js → chunk-LSELMDKQ.js} +2 -2
- package/dist/{chunk-2RORKIF6.js → chunk-NJGB4YOH.js} +2 -2
- package/dist/{chunk-L7MT53VM.js → chunk-PWG5IGCP.js} +1 -1
- package/dist/{chunk-EHH3ZF7D.js → chunk-TFEGYB4X.js} +2 -2
- package/dist/{chunk-DZRQGI2Z.js → chunk-ZPAOEDK7.js} +5 -3
- package/dist/{compat-check-AO3BFA3N.js → compat-check-L3C7HCVG.js} +4 -3
- package/dist/{config-N5V4VNER.js → config-LAF5MMYK.js} +6 -5
- package/dist/context-E4YKECC4.js +350 -0
- package/dist/{evaluation-OZM54MES.js → evaluation-I4IJ25CY.js} +4 -3
- package/dist/heari-cli-login.js +83 -0
- package/dist/index.js +43 -34
- package/dist/{memory-VPOPSU52.js → memory-Y7LPCRP4.js} +5 -4
- package/dist/{metadata-OUJPEMLD.js → metadata-T6HYAU7E.js} +7 -6
- package/dist/{model-2F2354QP.js → model-2BNN72MN.js} +7 -6
- package/dist/{personal-semantic-preference-WEAIZQXM.js → personal-semantic-preference-WCZBOA7V.js} +42 -16
- package/dist/{project-semantic-6VXUYU4A.js → project-semantic-WW5AZST3.js} +266 -17
- package/dist/{sync-BAV3UY46.js → sync-6PL25V42.js} +13 -12
- package/dist/{te-agent-QWZC36YS.js → te-agent-KXLDW4NE.js} +6 -5
- package/dist/{te-analysis-43RCOPUA.js → te-analysis-KKRECQ7F.js} +311 -52
- package/dist/{te-community-ECNTP35Z.js → te-community-6RGX7IWH.js} +8 -6
- package/dist/{te-dataops-ISEKYRLZ.js → te-dataops-RSPBC6WJ.js} +726 -220
- package/dist/{te-engage-LBKIZXZO.js → te-engage-FIPP5L2Z.js} +6 -5
- package/dist/{te-experiment-5TPQKN6B.js → te-experiment-KQ5CBYKI.js} +86 -10
- package/dist/{te-kb-SHL56BJ5.js → te-kb-XYSDXZUG.js} +32 -11
- package/dist/{te-system-Z4VEB6PL.js → te-system-QSOHAP7M.js} +7 -6
- package/dist/{te-team-EZ3TZTLV.js → te-team-R6MZ4RK2.js} +6 -5
- package/dist/{things-UBMLTY3S.js → things-DEONFUGS.js} +6 -5
- package/dist/{update-WE7VNRKZ.js → update-C6G4P3C7.js} +5 -4
- package/dist/{web-runtime-H53QKJS2.js → web-runtime-UGKPTBOK.js} +18 -12
- package/dist/{workspace-W5ZPVWJS.js → workspace-OBIIE5FN.js} +5 -4
- package/package.json +7 -5
- 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-capability/SKILL.md +5 -1
- 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-experiment/SKILL.md +9 -1
- package/skills/ae-experiment/references/manage_feature_fixed_value.md +73 -0
- package/skills/ae-experiment/references/save_feature.md +14 -1
- package/skills/ae-heari-research/SKILL.md +40 -0
- package/skills/ae-heari-research/references/design.md +35 -0
- package/skills/ae-heari-research/references/examples.md +46 -0
- package/skills/ae-heari-research/references/platform-auth.md +35 -0
- package/skills/ae-heari-research/references/platform-research.md +74 -0
- package/skills/ae-heari-research/references/platform-results.md +73 -0
- package/skills/ae-heari-research/references/platform.md +34 -0
- package/skills/ae-heari-research/references/probing-screening.md +31 -0
- package/skills/ae-heari-research/references/quality.md +44 -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/skills/ae-onboarding/SKILL.md +4 -6
- package/skills/ae-onboarding/references/onboarding_run.md +5 -1
- package/dist/context-WJQGJD6F.js +0 -139
- package/dist/{data-integration-KMJWYAKK.js → data-integration-SCYYZLWI.js} +4 -4
|
@@ -3,22 +3,24 @@ import {
|
|
|
3
3
|
assertOutputPathAvailable,
|
|
4
4
|
downloadAnalysisArtifact,
|
|
5
5
|
withAsyncArtifactLifecycle
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LSELMDKQ.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
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-4MOCV6HU.js";
|
|
15
|
+
import "./chunk-IAZ4AMVY.js";
|
|
15
16
|
import {
|
|
16
17
|
CapabilityGatewayError,
|
|
17
18
|
dryRunCapabilityWithEnvelope,
|
|
18
19
|
executeCapabilityWithEnvelope,
|
|
19
20
|
validateCapabilityWithEnvelope
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-7KBENPQF.js";
|
|
22
|
+
import "./chunk-FKTVD63C.js";
|
|
23
|
+
import "./chunk-FEYZBUFQ.js";
|
|
22
24
|
import "./chunk-IGU3R2JD.js";
|
|
23
25
|
import "./chunk-MTK4ZE7W.js";
|
|
24
26
|
import "./chunk-3ZQY7SLZ.js";
|
|
@@ -207,7 +209,7 @@ async function verifyDetailLocators(root, schemaVersion) {
|
|
|
207
209
|
await verifyContentLocator(root, detail.raw_locator, "Raw detail", { skipHash: schemaVersion === "3.0" });
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
|
-
async function verifyContentLocator(root, value, label,
|
|
212
|
+
async function verifyContentLocator(root, value, label, options2 = {}) {
|
|
211
213
|
const locator = asObject(value);
|
|
212
214
|
if (!locator || typeof locator.path !== "string" || typeof locator.content_hash !== "string" || !SHA256_PATTERN.test(locator.content_hash)) {
|
|
213
215
|
throw packageError(
|
|
@@ -223,7 +225,7 @@ async function verifyContentLocator(root, value, label, options = {}) {
|
|
|
223
225
|
if (!content) {
|
|
224
226
|
throw packageError(`${label} file is not a JSON object: ${locator.path}.`, "ASSET_PACKAGE_MANIFEST_INVALID");
|
|
225
227
|
}
|
|
226
|
-
if (!
|
|
228
|
+
if (!options2.skipHash) {
|
|
227
229
|
const actualHash = createHash("sha256").update(JSON.stringify(content), "utf8").digest("hex");
|
|
228
230
|
if (actualHash !== locator.content_hash) {
|
|
229
231
|
throw packageError(`${label} content hash mismatch for ${locator.path}.`, "ASSET_PACKAGE_HASH_MISMATCH");
|
|
@@ -291,15 +293,40 @@ function packageError(message, code) {
|
|
|
291
293
|
|
|
292
294
|
// src/commands/project-semantic/asset-package/export.ts
|
|
293
295
|
var ASSET_PACKAGE_EXPORT_CAPABILITY = "business_semantics.asset_package.export";
|
|
294
|
-
var ASSET_SCOPES = /* @__PURE__ */ new Set(["governed", "collaborative", "all_visible"]);
|
|
296
|
+
var ASSET_SCOPES = /* @__PURE__ */ new Set(["governed", "collaborative", "all_visible", "certified", "frequent", "all", "specified"]);
|
|
295
297
|
var GATEWAY_DOMAIN = "analysis";
|
|
296
298
|
function assetScope(ctx) {
|
|
297
299
|
const value = ctx.str("asset-scope") || "governed";
|
|
298
300
|
if (!ASSET_SCOPES.has(value)) {
|
|
299
|
-
throw new Error(
|
|
301
|
+
throw new Error(
|
|
302
|
+
"asset-scope must be one of: governed, collaborative, all_visible, certified, frequent, all, specified"
|
|
303
|
+
);
|
|
300
304
|
}
|
|
301
305
|
return value;
|
|
302
306
|
}
|
|
307
|
+
function buildAssetPackageInput(ctx) {
|
|
308
|
+
const scope = assetScope(ctx);
|
|
309
|
+
const refs = ctx.json("asset-refs");
|
|
310
|
+
if (scope === "specified") {
|
|
311
|
+
if (!Array.isArray(refs) || refs.length < 1 || refs.length > 1e3)
|
|
312
|
+
throw new Error("specified scope requires 1 to 1000 asset-refs.");
|
|
313
|
+
const seen = /* @__PURE__ */ new Set();
|
|
314
|
+
for (const ref of refs) {
|
|
315
|
+
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(
|
|
316
|
+
ref.resource_type
|
|
317
|
+
) || typeof ref.resource_key !== "string" || !ref.resource_key.trim())
|
|
318
|
+
throw new Error("Each asset reference requires a supported resource_type and a non-empty string resource_key.");
|
|
319
|
+
const key = `${ref.resource_type}:${ref.resource_key}`;
|
|
320
|
+
if (seen.has(key)) throw new Error("Duplicate asset reference.");
|
|
321
|
+
seen.add(key);
|
|
322
|
+
}
|
|
323
|
+
} else if (refs !== void 0 && refs !== null) throw new Error("asset-refs is only supported for specified scope.");
|
|
324
|
+
return {
|
|
325
|
+
project_id: ctx.num("project-id"),
|
|
326
|
+
asset_scope: scope,
|
|
327
|
+
...refs ? { asset_refs: refs } : {}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
303
330
|
var assetPackageExportCommand = {
|
|
304
331
|
service: "project-semantic",
|
|
305
332
|
resource: "asset-package",
|
|
@@ -307,12 +334,24 @@ var assetPackageExportCommand = {
|
|
|
307
334
|
description: "Export and materialize a knowledge-ready project asset package for CLI Agent consumption.",
|
|
308
335
|
helpText: "Requires access to the target project. Explicit asset-package export is independent of automatic knowledge-base discovery.",
|
|
309
336
|
flags: [
|
|
310
|
-
{
|
|
337
|
+
{
|
|
338
|
+
name: "project-id",
|
|
339
|
+
type: "number",
|
|
340
|
+
required: true,
|
|
341
|
+
desc: "Numeric project ID.",
|
|
342
|
+
alias: "p",
|
|
343
|
+
min: 1
|
|
344
|
+
},
|
|
311
345
|
{
|
|
312
346
|
name: "asset-scope",
|
|
313
347
|
type: "string",
|
|
314
348
|
required: false,
|
|
315
|
-
desc: "
|
|
349
|
+
desc: "Legacy scopes: governed (default), collaborative, all_visible. Manager setup scopes: certified, frequent (positive 90-day query count, ranked), all, specified."
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: "asset-refs",
|
|
353
|
+
type: "json",
|
|
354
|
+
desc: "Exact [{resource_type,resource_key}] references for specified scope; JSON or @file. Keys must be strings."
|
|
316
355
|
}
|
|
317
356
|
],
|
|
318
357
|
risk: "read",
|
|
@@ -320,22 +359,20 @@ var assetPackageExportCommand = {
|
|
|
320
359
|
ctx.host(),
|
|
321
360
|
resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
|
|
322
361
|
ASSET_PACKAGE_EXPORT_CAPABILITY,
|
|
323
|
-
|
|
362
|
+
buildAssetPackageInput(ctx)
|
|
324
363
|
).then((response) => withOutputMetadata(response.data, response.meta)),
|
|
325
364
|
dryRun: (ctx) => dryRunCapabilityWithEnvelope(
|
|
326
365
|
ctx.host(),
|
|
327
366
|
resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
|
|
328
367
|
ASSET_PACKAGE_EXPORT_CAPABILITY,
|
|
329
|
-
|
|
368
|
+
buildAssetPackageInput(ctx)
|
|
330
369
|
).then((response) => withOutputMetadata(response.data, response.meta)),
|
|
331
370
|
execute: async (ctx) => {
|
|
332
|
-
const projectId = ctx.num("project-id");
|
|
333
|
-
const scope = assetScope(ctx);
|
|
334
371
|
const response = await executeCapabilityWithEnvelope(
|
|
335
372
|
ctx.host(),
|
|
336
373
|
resolveGatewayDomain(GATEWAY_DOMAIN, GATEWAY_DOMAIN),
|
|
337
374
|
ASSET_PACKAGE_EXPORT_CAPABILITY,
|
|
338
|
-
|
|
375
|
+
buildAssetPackageInput(ctx)
|
|
339
376
|
);
|
|
340
377
|
return withOutputMetadata(response.data, response.meta);
|
|
341
378
|
}
|
|
@@ -345,13 +382,225 @@ var projectSemanticAssetPackageExport = withAsyncArtifactLifecycle(assetPackageE
|
|
|
345
382
|
materialize: materializeProjectSemanticAssetPackage
|
|
346
383
|
});
|
|
347
384
|
|
|
385
|
+
// src/commands/project-semantic/setup.ts
|
|
386
|
+
import { createHash as createHash2 } from "crypto";
|
|
387
|
+
import { mkdir as mkdir2, readFile as readFile2, stat as stat2, writeFile as writeFile2 } from "fs/promises";
|
|
388
|
+
import { basename as basename2, resolve as resolve2 } from "path";
|
|
389
|
+
var scopes = /* @__PURE__ */ new Set(["none", "certified", "frequent", "all", "specified"]);
|
|
390
|
+
function options(ctx) {
|
|
391
|
+
const scope = ctx.str("asset-scope") || "certified";
|
|
392
|
+
if (!scopes.has(scope)) throw new Error("asset-scope must be none, certified, frequent, all, or specified.");
|
|
393
|
+
const materials = ctx.json("materials");
|
|
394
|
+
if (materials !== void 0 && (!Array.isArray(materials) || materials.some((file) => typeof file !== "string" || !file.trim())))
|
|
395
|
+
throw new Error("materials must be an array of local file paths.");
|
|
396
|
+
if (scope === "none" && (!Array.isArray(materials) || !materials.length))
|
|
397
|
+
throw new Error("Provide materials or select an asset scope.");
|
|
398
|
+
const output = ctx.str("output");
|
|
399
|
+
if (!output) throw new Error("output must name a new private setup directory.");
|
|
400
|
+
if (!Number.isInteger(ctx.num("project-id")) || ctx.num("project-id") <= 0)
|
|
401
|
+
throw new Error("project-id must be a positive integer.");
|
|
402
|
+
if (scope !== "none")
|
|
403
|
+
buildAssetPackageInput({
|
|
404
|
+
...ctx,
|
|
405
|
+
str: (name) => name === "asset-scope" ? scope : ctx.str(name)
|
|
406
|
+
});
|
|
407
|
+
else if (ctx.json("asset-refs") !== void 0) throw new Error("asset-refs requires specified asset scope.");
|
|
408
|
+
return {
|
|
409
|
+
scope,
|
|
410
|
+
materials: materials || [],
|
|
411
|
+
output: resolve2(output)
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
var reference = "skills/ae-analysis/references/project_semantic_setup.md";
|
|
415
|
+
var nextSteps = [
|
|
416
|
+
"Read the complete retained semantic catalogs with the bundled catalog pager; do not mark use during management.",
|
|
417
|
+
"Read every input material and the selected asset indexes; inspect exact definitions and necessary dependencies. File inventory is not evidence extraction.",
|
|
418
|
+
"Synthesize one project background draft, distinct semantic candidates, source locators, conflicts and unanswered questions. Do not mechanically create one entry per file or asset.",
|
|
419
|
+
"Read likely existing matches by exact ID without marking use; propose CREATE, UPDATE or KEEP with scope, revision and source evidence.",
|
|
420
|
+
"Present all proposed writes for user confirmation. Persist an approved local import plan and reuse unchanged request IDs when resuming.",
|
|
421
|
+
"Save confirmed project entries through existing project_context capabilities and the background as a draft. Publish background only with separate explicit intent."
|
|
422
|
+
];
|
|
423
|
+
var projectSemanticSetup = {
|
|
424
|
+
service: "project-semantic",
|
|
425
|
+
command: "setup",
|
|
426
|
+
description: "Prepare a private evidence workspace for the CLI Agent project-semantics setup workflow; never generates or saves business facts automatically.",
|
|
427
|
+
helpText: `This read-only L1 workflow reuses asset-package export and existing background/catalog reads. Continue with ${reference}.`,
|
|
428
|
+
risk: "read",
|
|
429
|
+
sensitiveOutput: true,
|
|
430
|
+
flags: [
|
|
431
|
+
{
|
|
432
|
+
name: "project-id",
|
|
433
|
+
type: "number",
|
|
434
|
+
required: true,
|
|
435
|
+
min: 1,
|
|
436
|
+
desc: "Target project ID; semantic management permission is required."
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: "asset-scope",
|
|
440
|
+
type: "string",
|
|
441
|
+
desc: "certified (default), frequent, all, specified, or none for materials only. frequent uses positive query counts from the latest 90-day usage snapshot."
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: "asset-refs",
|
|
445
|
+
type: "json",
|
|
446
|
+
desc: "Exact asset references for specified scope; resolve supplied names or links before running."
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: "materials",
|
|
450
|
+
type: "json",
|
|
451
|
+
sensitive: true,
|
|
452
|
+
desc: "Optional array of local source file paths. The command inventories bytes; the calling Agent reads and interprets them."
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "output",
|
|
456
|
+
type: "string",
|
|
457
|
+
required: true,
|
|
458
|
+
desc: "New private evidence directory. Existing directories are refused; retain it for review and recovery."
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
validate: (ctx) => {
|
|
462
|
+
options(ctx);
|
|
463
|
+
},
|
|
464
|
+
dryRun: async (ctx) => ({
|
|
465
|
+
workflow: "project_semantic_setup",
|
|
466
|
+
project_id: ctx.num("project-id"),
|
|
467
|
+
asset_scope: options(ctx).scope,
|
|
468
|
+
remote_writes: false,
|
|
469
|
+
agent_synthesis_required: true,
|
|
470
|
+
reference
|
|
471
|
+
}),
|
|
472
|
+
execute: async (ctx) => {
|
|
473
|
+
const selected = options(ctx);
|
|
474
|
+
try {
|
|
475
|
+
await stat2(selected.output);
|
|
476
|
+
throw new Error("Setup output already exists. Continue from its manifest or choose another output directory.");
|
|
477
|
+
} catch (error) {
|
|
478
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
479
|
+
}
|
|
480
|
+
const materials = [];
|
|
481
|
+
for (const file of selected.materials) {
|
|
482
|
+
const path = resolve2(file);
|
|
483
|
+
const info = await stat2(path);
|
|
484
|
+
if (!info.isFile() || info.size > 20 * 1024 * 1024)
|
|
485
|
+
throw new Error("Each material must be a regular file no larger than 20 MiB.");
|
|
486
|
+
const bytes = await readFile2(path);
|
|
487
|
+
materials.push({
|
|
488
|
+
path,
|
|
489
|
+
name: basename2(path),
|
|
490
|
+
bytes: bytes.length,
|
|
491
|
+
sha256: createHash2("sha256").update(bytes).digest("hex"),
|
|
492
|
+
parse_status: "not_read_by_agent"
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
const call = async (operation, projectId) => (await executeCapabilityWithEnvelope(ctx.host(), "analysis", `business_semantics.${operation}`, {
|
|
496
|
+
project_id: projectId
|
|
497
|
+
})).data;
|
|
498
|
+
const company = await call("background.get", 0);
|
|
499
|
+
const project = await call("background.get", ctx.num("project-id"));
|
|
500
|
+
const draft = await call("background.draft_get", ctx.num("project-id"));
|
|
501
|
+
const globalPersonal = await call("global_personal_context.list", -1);
|
|
502
|
+
const personal = await call("personal_context.list", ctx.num("project-id"));
|
|
503
|
+
const publicCatalog = await call("project_context.list", ctx.num("project-id"));
|
|
504
|
+
for (const catalog of [globalPersonal, personal, publicCatalog]) {
|
|
505
|
+
if (catalog?.complete !== true || catalog.truncated === true || !Array.isArray(catalog.items) || catalog.items.length !== catalog.total) {
|
|
506
|
+
throw new Error("A complete semantic catalog is required; do not silently continue with partial evidence.");
|
|
507
|
+
}
|
|
508
|
+
const seen = /* @__PURE__ */ new Set();
|
|
509
|
+
for (const row of catalog.items) {
|
|
510
|
+
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"))) {
|
|
511
|
+
throw new Error("Catalog row identity, revision, summary or keywords is invalid.");
|
|
512
|
+
}
|
|
513
|
+
seen.add(row.id);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
await mkdir2(selected.output, { recursive: false, mode: 448 });
|
|
517
|
+
const save = (name, data) => writeFile2(resolve2(selected.output, name), JSON.stringify(data, null, 2) + "\n", { flag: "wx", mode: 384 });
|
|
518
|
+
await save("context.json", {
|
|
519
|
+
company_background: company,
|
|
520
|
+
project_background: project,
|
|
521
|
+
project_draft: draft
|
|
522
|
+
});
|
|
523
|
+
await save("global-personal-catalog.json", {
|
|
524
|
+
ok: true,
|
|
525
|
+
data: globalPersonal
|
|
526
|
+
});
|
|
527
|
+
await save("project-personal-catalog.json", { ok: true, data: personal });
|
|
528
|
+
await save("project-public-catalog.json", {
|
|
529
|
+
ok: true,
|
|
530
|
+
data: publicCatalog
|
|
531
|
+
});
|
|
532
|
+
await save("materials.json", materials);
|
|
533
|
+
const pending = {
|
|
534
|
+
workflow: "project_semantic_setup",
|
|
535
|
+
status: "preparing_assets",
|
|
536
|
+
project_id: ctx.num("project-id"),
|
|
537
|
+
asset_scope: selected.scope,
|
|
538
|
+
remote_writes: false,
|
|
539
|
+
agent_synthesis_required: true,
|
|
540
|
+
reference
|
|
541
|
+
};
|
|
542
|
+
await save("setup.json", pending);
|
|
543
|
+
let assetPackage;
|
|
544
|
+
try {
|
|
545
|
+
if (selected.scope !== "none") {
|
|
546
|
+
const packageContext = {
|
|
547
|
+
...ctx,
|
|
548
|
+
str: (name) => name === "asset-scope" ? selected.scope : name === "output" ? resolve2(selected.output, "assets") : ctx.str(name),
|
|
549
|
+
bool: (name) => name === "force" ? false : ctx.bool(name)
|
|
550
|
+
};
|
|
551
|
+
assetPackage = unwrapOutputData(await projectSemanticAssetPackageExport.execute(packageContext));
|
|
552
|
+
const manifest2 = JSON.parse(await readFile2(resolve2(selected.output, "assets", "manifest.json"), "utf8"));
|
|
553
|
+
if (manifest2.truncated === true || manifest2.project_id !== ctx.num("project-id") || manifest2.asset_scope !== selected.scope)
|
|
554
|
+
throw new Error(
|
|
555
|
+
"Exported asset evidence is partial or belongs to another project/scope. Keep the workspace for diagnosis; do not synthesize from it."
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
} catch (error) {
|
|
559
|
+
await writeFile2(
|
|
560
|
+
resolve2(selected.output, "setup.json"),
|
|
561
|
+
JSON.stringify(
|
|
562
|
+
{
|
|
563
|
+
...pending,
|
|
564
|
+
status: "evidence_failed",
|
|
565
|
+
failed_step: "asset_export",
|
|
566
|
+
...error instanceof CapabilityGatewayError ? {
|
|
567
|
+
error_code: error.code,
|
|
568
|
+
...typeof error.meta?.run_id === "string" ? { run_id: error.meta.run_id } : {},
|
|
569
|
+
...typeof error.meta?.artifact_id === "string" ? { artifact_id: error.meta.artifact_id } : {}
|
|
570
|
+
} : {}
|
|
571
|
+
},
|
|
572
|
+
null,
|
|
573
|
+
2
|
|
574
|
+
) + "\n",
|
|
575
|
+
{ mode: 384 }
|
|
576
|
+
);
|
|
577
|
+
throw error;
|
|
578
|
+
}
|
|
579
|
+
const manifest = {
|
|
580
|
+
workflow: "project_semantic_setup",
|
|
581
|
+
status: "evidence_ready",
|
|
582
|
+
project_id: ctx.num("project-id"),
|
|
583
|
+
asset_scope: selected.scope,
|
|
584
|
+
materials: materials.length,
|
|
585
|
+
asset_package: assetPackage,
|
|
586
|
+
remote_writes: false,
|
|
587
|
+
agent_synthesis_required: true,
|
|
588
|
+
reference,
|
|
589
|
+
next_steps: nextSteps
|
|
590
|
+
};
|
|
591
|
+
await writeFile2(resolve2(selected.output, "setup.json"), JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
|
|
592
|
+
return { ...manifest, output_path: selected.output };
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
348
596
|
// src/commands/project-semantic/index.ts
|
|
349
597
|
registerCapabilityGatewayRoute("project-semantic", {
|
|
350
598
|
gatewayDomain: "analysis",
|
|
351
599
|
capabilityPrefixes: ["business_semantics.asset_package"]
|
|
352
600
|
});
|
|
353
601
|
var commands = [
|
|
354
|
-
projectSemanticAssetPackageExport
|
|
602
|
+
projectSemanticAssetPackageExport,
|
|
603
|
+
projectSemanticSetup
|
|
355
604
|
];
|
|
356
605
|
var project_semantic_default = commands;
|
|
357
606
|
export {
|
|
@@ -17,6 +17,14 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
assertLegacyWorkspaceCommand
|
|
19
19
|
} from "./chunk-RK6GLDGI.js";
|
|
20
|
+
import {
|
|
21
|
+
TeAgentApiError,
|
|
22
|
+
TeAgentCredentialsError,
|
|
23
|
+
getSandboxSyncPullCandidates,
|
|
24
|
+
postSandboxSyncPull,
|
|
25
|
+
postToMainApp,
|
|
26
|
+
uploadToMainApp
|
|
27
|
+
} from "./chunk-3DTMWDJX.js";
|
|
20
28
|
import {
|
|
21
29
|
require_lib
|
|
22
30
|
} from "./chunk-EQMGH32F.js";
|
|
@@ -28,18 +36,11 @@ import {
|
|
|
28
36
|
} from "./chunk-7K24F7T2.js";
|
|
29
37
|
import {
|
|
30
38
|
printError
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
postSandboxSyncPull,
|
|
37
|
-
postToMainApp,
|
|
38
|
-
uploadToMainApp
|
|
39
|
-
} from "./chunk-KE5WGBXS.js";
|
|
40
|
-
import "./chunk-I7H72CMN.js";
|
|
41
|
-
import "./chunk-WG27BD67.js";
|
|
42
|
-
import "./chunk-UWQXGF44.js";
|
|
39
|
+
} from "./chunk-4MOCV6HU.js";
|
|
40
|
+
import "./chunk-IAZ4AMVY.js";
|
|
41
|
+
import "./chunk-7KBENPQF.js";
|
|
42
|
+
import "./chunk-FKTVD63C.js";
|
|
43
|
+
import "./chunk-FEYZBUFQ.js";
|
|
43
44
|
import "./chunk-IGU3R2JD.js";
|
|
44
45
|
import "./chunk-MTK4ZE7W.js";
|
|
45
46
|
import {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
workspaceResourcePath,
|
|
12
12
|
workspaceTargetFlags,
|
|
13
13
|
workspaceTargetPath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NJGB4YOH.js";
|
|
15
15
|
import {
|
|
16
16
|
currentAgentSpaceId
|
|
17
17
|
} from "./chunk-RK6GLDGI.js";
|
|
@@ -27,19 +27,20 @@ import {
|
|
|
27
27
|
requestResourcePackageRaw,
|
|
28
28
|
resourcePackagePreflightChange,
|
|
29
29
|
uploadAgentApi
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-CBNE2S44.js";
|
|
31
31
|
import {
|
|
32
32
|
TeAgentApiError,
|
|
33
33
|
resolveTeClaudeBaseUrl
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3DTMWDJX.js";
|
|
35
35
|
import {
|
|
36
36
|
buildCapabilityGatewayUrl,
|
|
37
37
|
callCapabilityApi
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-7KBENPQF.js";
|
|
39
39
|
import {
|
|
40
40
|
clearCliTokenCache,
|
|
41
41
|
getCliToken
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-FKTVD63C.js";
|
|
43
|
+
import "./chunk-FEYZBUFQ.js";
|
|
43
44
|
import {
|
|
44
45
|
getConfigDir
|
|
45
46
|
} from "./chunk-IGU3R2JD.js";
|