ai-project-manage-cli 7.1.28 → 7.1.30
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/dist/index.js +161 -132
- package/dist/webide-message-worker.js +48 -16
- package/package.json +1 -1
- package/template/AGENTS.md +1 -0
- package/template/rules/webide_reply.md +18 -0
package/dist/index.js
CHANGED
|
@@ -480,123 +480,33 @@ var init_minio = __esm({
|
|
|
480
480
|
}
|
|
481
481
|
});
|
|
482
482
|
|
|
483
|
-
// src/commands/
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
function sanitizeDeployProjectName(name) {
|
|
490
|
-
const trimmed = name.trim().replace(/\\/g, "/");
|
|
491
|
-
const base = trimmed.split("/").filter(Boolean).pop() ?? trimmed;
|
|
492
|
-
try {
|
|
493
|
-
return sanitizeRelativePath(base.replace(/[/\\:*?"<>|]/g, "_"));
|
|
494
|
-
} catch {
|
|
495
|
-
return "project";
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
function buildDeployArtifactFileName(kind, projectName, timestamp = formatDeployArtifactTimestamp()) {
|
|
499
|
-
const safeName = sanitizeDeployProjectName(projectName);
|
|
500
|
-
const suffix = kind === "frontend" ? "dist.zip" : "jar.zip";
|
|
501
|
-
return `${timestamp}-${safeName}.${suffix}`;
|
|
502
|
-
}
|
|
503
|
-
function buildDeployArtifactObjectKey(projectName, fileName) {
|
|
504
|
-
const safeProject = sanitizeDeployProjectName(projectName);
|
|
505
|
-
return `deploy/${safeProject}/${fileName}`;
|
|
506
|
-
}
|
|
507
|
-
function resolveDeploymentRunIdFromEnv() {
|
|
508
|
-
const raw = process.env[APM_DEPLOYMENT_RUN_ID_ENV]?.trim();
|
|
509
|
-
return raw || null;
|
|
510
|
-
}
|
|
511
|
-
async function fetchDeployArtifactStorage(api) {
|
|
512
|
-
return api.cli.getDeployArtifactStorage(void 0);
|
|
513
|
-
}
|
|
514
|
-
async function uploadDeployArtifactZip(options) {
|
|
515
|
-
const deploymentRunId = options.deploymentRunId ?? resolveDeploymentRunIdFromEnv();
|
|
516
|
-
if (!deploymentRunId && !options.uploadWithoutRunId) {
|
|
517
|
-
return null;
|
|
518
|
-
}
|
|
519
|
-
const cfg = await tryReadApmConfig();
|
|
520
|
-
if (!cfg || !resolveApiKey(cfg)) {
|
|
521
|
-
console.warn("[apm] \u672A\u767B\u5F55\uFF0C\u8DF3\u8FC7 MinIO \u90E8\u7F72\u4EA7\u7269\u5F52\u6863");
|
|
522
|
-
return null;
|
|
523
|
-
}
|
|
524
|
-
const api = options.api ?? createApmApiClient(cfg);
|
|
525
|
-
let storage;
|
|
526
|
-
try {
|
|
527
|
-
storage = await fetchDeployArtifactStorage(api);
|
|
528
|
-
} catch (error) {
|
|
529
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
530
|
-
console.warn(`[apm] \u83B7\u53D6 MinIO \u914D\u7F6E\u5931\u8D25\uFF0C\u8DF3\u8FC7\u90E8\u7F72\u4EA7\u7269\u5F52\u6863: ${detail}`);
|
|
531
|
-
return null;
|
|
532
|
-
}
|
|
533
|
-
const fileName = buildDeployArtifactFileName(
|
|
534
|
-
options.kind,
|
|
535
|
-
options.projectName,
|
|
536
|
-
options.timestamp
|
|
537
|
-
);
|
|
538
|
-
const objectKey = buildDeployArtifactObjectKey(options.projectName, fileName);
|
|
539
|
-
let body;
|
|
540
|
-
try {
|
|
541
|
-
body = await readFile2(options.zipPath);
|
|
542
|
-
} catch (error) {
|
|
543
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
544
|
-
console.warn(`[apm] \u8BFB\u53D6\u90E8\u7F72\u4EA7\u7269 zip \u5931\u8D25\uFF0C\u8DF3\u8FC7 MinIO \u5F52\u6863: ${detail}`);
|
|
545
|
-
return null;
|
|
546
|
-
}
|
|
547
|
-
try {
|
|
548
|
-
const client = new MinioClient({
|
|
483
|
+
// src/commands/connect/apm-log-minio.ts
|
|
484
|
+
function createApmLogMinioClient() {
|
|
485
|
+
const storage = APM_LOG_MINIO_CONFIG;
|
|
486
|
+
return {
|
|
487
|
+
client: new MinioClient({
|
|
549
488
|
endPoint: storage.endpoint,
|
|
550
489
|
port: storage.port,
|
|
551
490
|
useSSL: storage.useSsl,
|
|
552
491
|
accessKey: storage.accessKey,
|
|
553
492
|
secretKey: storage.secretKey
|
|
554
|
-
})
|
|
555
|
-
await client.ensureBucket(storage.bucket);
|
|
556
|
-
await client.putObject(storage.bucket, objectKey, body, {
|
|
557
|
-
"Content-Type": "application/zip"
|
|
558
|
-
});
|
|
559
|
-
console.error(
|
|
560
|
-
`[apm] \u672C\u5730\u76F4\u4F20 MinIO\uFF08\u4E0D\u7ECF\u5E73\u53F0\u670D\u52A1\u5668\uFF09: ${storage.endpoint}:${storage.port}/${storage.bucket}/${objectKey} (${(body.length / 1024 / 1024).toFixed(
|
|
561
|
-
2
|
|
562
|
-
)} MB)`
|
|
563
|
-
);
|
|
564
|
-
} catch (error) {
|
|
565
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
566
|
-
console.warn(`[apm] MinIO \u90E8\u7F72\u4EA7\u7269\u5F52\u6863\u5931\u8D25: ${detail}`);
|
|
567
|
-
return null;
|
|
568
|
-
}
|
|
569
|
-
if (deploymentRunId) {
|
|
570
|
-
try {
|
|
571
|
-
await api.cli.attachTaskDeploymentArtifact({
|
|
572
|
-
id: deploymentRunId,
|
|
573
|
-
artifactObjectKey: objectKey,
|
|
574
|
-
artifactFileName: fileName
|
|
575
|
-
});
|
|
576
|
-
console.error(
|
|
577
|
-
`[apm] \u5DF2\u7ED1\u5B9A\u90E8\u7F72\u4EA7\u7269\u5230\u8BB0\u5F55 id=${deploymentRunId} file=${fileName}`
|
|
578
|
-
);
|
|
579
|
-
} catch (error) {
|
|
580
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
581
|
-
console.warn(`[apm] \u7ED1\u5B9A\u90E8\u7F72\u4EA7\u7269\u5230\u8BB0\u5F55\u5931\u8D25: ${detail}`);
|
|
582
|
-
return null;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return {
|
|
586
|
-
objectKey,
|
|
587
|
-
fileName,
|
|
493
|
+
}),
|
|
588
494
|
bucket: storage.bucket
|
|
589
495
|
};
|
|
590
496
|
}
|
|
591
|
-
var
|
|
592
|
-
var
|
|
593
|
-
"src/commands/
|
|
497
|
+
var APM_LOG_MINIO_CONFIG;
|
|
498
|
+
var init_apm_log_minio = __esm({
|
|
499
|
+
"src/commands/connect/apm-log-minio.ts"() {
|
|
594
500
|
"use strict";
|
|
595
|
-
init_client();
|
|
596
|
-
init_config();
|
|
597
|
-
init_minio();
|
|
598
501
|
init_minio();
|
|
599
|
-
|
|
502
|
+
APM_LOG_MINIO_CONFIG = {
|
|
503
|
+
endpoint: "objectstorageapi.gzg.sealos.run",
|
|
504
|
+
port: 443,
|
|
505
|
+
useSsl: true,
|
|
506
|
+
accessKey: "428hqav4",
|
|
507
|
+
secretKey: "68b8srk4vdbjdhlc",
|
|
508
|
+
bucket: "428hqav4-apm-log"
|
|
509
|
+
};
|
|
600
510
|
}
|
|
601
511
|
});
|
|
602
512
|
|
|
@@ -719,8 +629,7 @@ var init_webide_terminal_registry = __esm({
|
|
|
719
629
|
"src/commands/connect/webide-terminal-registry.ts"() {
|
|
720
630
|
"use strict";
|
|
721
631
|
init_client();
|
|
722
|
-
|
|
723
|
-
init_minio();
|
|
632
|
+
init_apm_log_minio();
|
|
724
633
|
execFileAsync3 = promisify3(execFile3);
|
|
725
634
|
WEBIDE_TERMINAL_LINES_PER_CHUNK = 50;
|
|
726
635
|
SYNC_INTERVAL_MS = 400;
|
|
@@ -738,17 +647,9 @@ var init_webide_terminal_registry = __esm({
|
|
|
738
647
|
bucket = "";
|
|
739
648
|
async ensureMinio() {
|
|
740
649
|
if (this.minio) return;
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
this.minio = new MinioClient({
|
|
745
|
-
endPoint: storage.endpoint,
|
|
746
|
-
port: storage.port,
|
|
747
|
-
useSSL: storage.useSsl,
|
|
748
|
-
accessKey: storage.accessKey,
|
|
749
|
-
secretKey: storage.secretKey
|
|
750
|
-
});
|
|
751
|
-
this.bucket = storage.bucket;
|
|
650
|
+
const created = createApmLogMinioClient();
|
|
651
|
+
this.minio = created.client;
|
|
652
|
+
this.bucket = created.bucket;
|
|
752
653
|
await this.minio.ensureBucket(this.bucket);
|
|
753
654
|
}
|
|
754
655
|
listLocal(taskId) {
|
|
@@ -4374,11 +4275,124 @@ var DeployExecutionError = class extends Error {
|
|
|
4374
4275
|
};
|
|
4375
4276
|
|
|
4376
4277
|
// src/commands/deploy/deploy-debug-log.ts
|
|
4377
|
-
init_deploy_artifact_minio();
|
|
4378
4278
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
4379
4279
|
import { existsSync as existsSync17 } from "node:fs";
|
|
4380
4280
|
import { dirname as dirname6, join as join18 } from "node:path";
|
|
4381
4281
|
|
|
4282
|
+
// src/commands/deploy/internal/deploy-artifact-minio.ts
|
|
4283
|
+
init_client();
|
|
4284
|
+
init_config();
|
|
4285
|
+
init_minio();
|
|
4286
|
+
init_minio();
|
|
4287
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
4288
|
+
var APM_DEPLOYMENT_RUN_ID_ENV = "APM_DEPLOYMENT_RUN_ID";
|
|
4289
|
+
function formatDeployArtifactTimestamp(date = /* @__PURE__ */ new Date()) {
|
|
4290
|
+
const pad2 = (n) => String(n).padStart(2, "0");
|
|
4291
|
+
return `${date.getFullYear()}${pad2(date.getMonth() + 1)}${pad2(date.getDate())}${pad2(date.getHours())}${pad2(date.getMinutes())}${pad2(date.getSeconds())}`;
|
|
4292
|
+
}
|
|
4293
|
+
function sanitizeDeployProjectName(name) {
|
|
4294
|
+
const trimmed = name.trim().replace(/\\/g, "/");
|
|
4295
|
+
const base = trimmed.split("/").filter(Boolean).pop() ?? trimmed;
|
|
4296
|
+
try {
|
|
4297
|
+
return sanitizeRelativePath(base.replace(/[/\\:*?"<>|]/g, "_"));
|
|
4298
|
+
} catch {
|
|
4299
|
+
return "project";
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
function buildDeployArtifactFileName(kind, projectName, timestamp = formatDeployArtifactTimestamp()) {
|
|
4303
|
+
const safeName = sanitizeDeployProjectName(projectName);
|
|
4304
|
+
const suffix = kind === "frontend" ? "dist.zip" : "jar.zip";
|
|
4305
|
+
return `${timestamp}-${safeName}.${suffix}`;
|
|
4306
|
+
}
|
|
4307
|
+
function buildDeployArtifactObjectKey(projectName, fileName) {
|
|
4308
|
+
const safeProject = sanitizeDeployProjectName(projectName);
|
|
4309
|
+
return `deploy/${safeProject}/${fileName}`;
|
|
4310
|
+
}
|
|
4311
|
+
function resolveDeploymentRunIdFromEnv() {
|
|
4312
|
+
const raw = process.env[APM_DEPLOYMENT_RUN_ID_ENV]?.trim();
|
|
4313
|
+
return raw || null;
|
|
4314
|
+
}
|
|
4315
|
+
async function fetchDeployArtifactStorage(api) {
|
|
4316
|
+
return api.cli.getDeployArtifactStorage(void 0);
|
|
4317
|
+
}
|
|
4318
|
+
async function uploadDeployArtifactZip(options) {
|
|
4319
|
+
const deploymentRunId = options.deploymentRunId ?? resolveDeploymentRunIdFromEnv();
|
|
4320
|
+
if (!deploymentRunId && !options.uploadWithoutRunId) {
|
|
4321
|
+
return null;
|
|
4322
|
+
}
|
|
4323
|
+
const cfg = await tryReadApmConfig();
|
|
4324
|
+
if (!cfg || !resolveApiKey(cfg)) {
|
|
4325
|
+
console.warn("[apm] \u672A\u767B\u5F55\uFF0C\u8DF3\u8FC7 MinIO \u90E8\u7F72\u4EA7\u7269\u5F52\u6863");
|
|
4326
|
+
return null;
|
|
4327
|
+
}
|
|
4328
|
+
const api = options.api ?? createApmApiClient(cfg);
|
|
4329
|
+
let storage;
|
|
4330
|
+
try {
|
|
4331
|
+
storage = await fetchDeployArtifactStorage(api);
|
|
4332
|
+
} catch (error) {
|
|
4333
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4334
|
+
console.warn(`[apm] \u83B7\u53D6 MinIO \u914D\u7F6E\u5931\u8D25\uFF0C\u8DF3\u8FC7\u90E8\u7F72\u4EA7\u7269\u5F52\u6863: ${detail}`);
|
|
4335
|
+
return null;
|
|
4336
|
+
}
|
|
4337
|
+
const fileName = buildDeployArtifactFileName(
|
|
4338
|
+
options.kind,
|
|
4339
|
+
options.projectName,
|
|
4340
|
+
options.timestamp
|
|
4341
|
+
);
|
|
4342
|
+
const objectKey = buildDeployArtifactObjectKey(options.projectName, fileName);
|
|
4343
|
+
let body;
|
|
4344
|
+
try {
|
|
4345
|
+
body = await readFile2(options.zipPath);
|
|
4346
|
+
} catch (error) {
|
|
4347
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4348
|
+
console.warn(`[apm] \u8BFB\u53D6\u90E8\u7F72\u4EA7\u7269 zip \u5931\u8D25\uFF0C\u8DF3\u8FC7 MinIO \u5F52\u6863: ${detail}`);
|
|
4349
|
+
return null;
|
|
4350
|
+
}
|
|
4351
|
+
try {
|
|
4352
|
+
const client = new MinioClient({
|
|
4353
|
+
endPoint: storage.endpoint,
|
|
4354
|
+
port: storage.port,
|
|
4355
|
+
useSSL: storage.useSsl,
|
|
4356
|
+
accessKey: storage.accessKey,
|
|
4357
|
+
secretKey: storage.secretKey
|
|
4358
|
+
});
|
|
4359
|
+
await client.ensureBucket(storage.bucket);
|
|
4360
|
+
await client.putObject(storage.bucket, objectKey, body, {
|
|
4361
|
+
"Content-Type": "application/zip"
|
|
4362
|
+
});
|
|
4363
|
+
console.error(
|
|
4364
|
+
`[apm] \u672C\u5730\u76F4\u4F20 MinIO\uFF08\u4E0D\u7ECF\u5E73\u53F0\u670D\u52A1\u5668\uFF09: ${storage.endpoint}:${storage.port}/${storage.bucket}/${objectKey} (${(body.length / 1024 / 1024).toFixed(
|
|
4365
|
+
2
|
|
4366
|
+
)} MB)`
|
|
4367
|
+
);
|
|
4368
|
+
} catch (error) {
|
|
4369
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4370
|
+
console.warn(`[apm] MinIO \u90E8\u7F72\u4EA7\u7269\u5F52\u6863\u5931\u8D25: ${detail}`);
|
|
4371
|
+
return null;
|
|
4372
|
+
}
|
|
4373
|
+
if (deploymentRunId) {
|
|
4374
|
+
try {
|
|
4375
|
+
await api.cli.attachTaskDeploymentArtifact({
|
|
4376
|
+
id: deploymentRunId,
|
|
4377
|
+
artifactObjectKey: objectKey,
|
|
4378
|
+
artifactFileName: fileName
|
|
4379
|
+
});
|
|
4380
|
+
console.error(
|
|
4381
|
+
`[apm] \u5DF2\u7ED1\u5B9A\u90E8\u7F72\u4EA7\u7269\u5230\u8BB0\u5F55 id=${deploymentRunId} file=${fileName}`
|
|
4382
|
+
);
|
|
4383
|
+
} catch (error) {
|
|
4384
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4385
|
+
console.warn(`[apm] \u7ED1\u5B9A\u90E8\u7F72\u4EA7\u7269\u5230\u8BB0\u5F55\u5931\u8D25: ${detail}`);
|
|
4386
|
+
return null;
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
return {
|
|
4390
|
+
objectKey,
|
|
4391
|
+
fileName,
|
|
4392
|
+
bucket: storage.bucket
|
|
4393
|
+
};
|
|
4394
|
+
}
|
|
4395
|
+
|
|
4382
4396
|
// src/commands/deploy/internal/deploy-shell-env.ts
|
|
4383
4397
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
4384
4398
|
import { existsSync as existsSync16 } from "node:fs";
|
|
@@ -5527,7 +5541,6 @@ function runDeployShellCommand(command, cwd, captureOutput) {
|
|
|
5527
5541
|
|
|
5528
5542
|
// src/commands/deploy/internal/wisdom-backend/index.ts
|
|
5529
5543
|
import path9 from "node:path";
|
|
5530
|
-
init_deploy_artifact_minio();
|
|
5531
5544
|
|
|
5532
5545
|
// src/commands/deploy/internal/wisdom-backend/jar-incremental.ts
|
|
5533
5546
|
import {
|
|
@@ -5596,7 +5609,6 @@ import SftpClient from "ssh2-sftp-client";
|
|
|
5596
5609
|
import { readdir as readdir2, readFile as readFile3, unlink, writeFile } from "node:fs/promises";
|
|
5597
5610
|
import path3 from "node:path";
|
|
5598
5611
|
import JSZip from "jszip";
|
|
5599
|
-
init_deploy_artifact_minio();
|
|
5600
5612
|
init_minio();
|
|
5601
5613
|
async function addDirToZip(dir, zipFolder) {
|
|
5602
5614
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
@@ -5686,7 +5698,6 @@ async function packDirectoryWithMinioArchive(input) {
|
|
|
5686
5698
|
}
|
|
5687
5699
|
|
|
5688
5700
|
// src/commands/deploy/internal/wisdom-sftp.ts
|
|
5689
|
-
init_deploy_artifact_minio();
|
|
5690
5701
|
var SFTP_UPLOAD_MAX_ATTEMPTS = 3;
|
|
5691
5702
|
var SFTP_FAST_PUT_OPTIONS = {
|
|
5692
5703
|
chunkSize: 64 * 1024,
|
|
@@ -6896,9 +6907,6 @@ function printDeployExecutionError(error) {
|
|
|
6896
6907
|
console.error(error.message);
|
|
6897
6908
|
}
|
|
6898
6909
|
|
|
6899
|
-
// src/commands/deploy/platform/deploy-run-coordinator.ts
|
|
6900
|
-
init_deploy_artifact_minio();
|
|
6901
|
-
|
|
6902
6910
|
// src/commands/deploy/platform/deploy-console-capture.ts
|
|
6903
6911
|
function captureDeployConsole(logSyncer) {
|
|
6904
6912
|
const chunks = [];
|
|
@@ -7428,14 +7436,34 @@ var EventSession = class {
|
|
|
7428
7436
|
});
|
|
7429
7437
|
this.markDirty(this.events.length - 1);
|
|
7430
7438
|
}
|
|
7431
|
-
/**
|
|
7439
|
+
/**
|
|
7440
|
+
* CLI 本地准备步骤(工作区/分支/文档等),写入日志供 WebIDE 查看。
|
|
7441
|
+
* 同名 step 原地更新(进行中→完成合并为一行),终态时写入 durationMs。
|
|
7442
|
+
*/
|
|
7432
7443
|
addCliStep(step, text, status = "ok") {
|
|
7444
|
+
const existingIndex = this.events.findIndex(
|
|
7445
|
+
(e) => e.type === "cli_step" && e.step === step
|
|
7446
|
+
);
|
|
7447
|
+
const now = Date.now();
|
|
7448
|
+
if (existingIndex >= 0) {
|
|
7449
|
+
const existing = this.events[existingIndex];
|
|
7450
|
+
existing.status = status;
|
|
7451
|
+
existing.text = text;
|
|
7452
|
+
if (status !== "running") {
|
|
7453
|
+
const startedAt = typeof existing.at === "string" ? Date.parse(existing.at) : NaN;
|
|
7454
|
+
if (Number.isFinite(startedAt)) {
|
|
7455
|
+
existing.durationMs = Math.max(0, now - startedAt);
|
|
7456
|
+
}
|
|
7457
|
+
}
|
|
7458
|
+
this.markDirty(existingIndex);
|
|
7459
|
+
return;
|
|
7460
|
+
}
|
|
7433
7461
|
this.events.push({
|
|
7434
7462
|
type: "cli_step",
|
|
7435
7463
|
step,
|
|
7436
7464
|
status,
|
|
7437
7465
|
text,
|
|
7438
|
-
at:
|
|
7466
|
+
at: new Date(now).toISOString()
|
|
7439
7467
|
});
|
|
7440
7468
|
this.markDirty(this.events.length - 1);
|
|
7441
7469
|
}
|
|
@@ -7739,13 +7767,13 @@ function createAppendMessageCustomTools(cfg, messageId, appendContent) {
|
|
|
7739
7767
|
const doAppend = appendContent ?? ((content) => appendMessageContent(cfg, messageId, content));
|
|
7740
7768
|
return {
|
|
7741
7769
|
AppendMessage: {
|
|
7742
|
-
description: "\u5411\u5F53\u524D\u4F1A\u8BDD\u6D88\u606F\u8FFD\u52A0\u56DE\u590D\
|
|
7770
|
+
description: "\u5411\u5F53\u524D\u4F1A\u8BDD/WebIDE \u6D88\u606F\u8FFD\u52A0\u7528\u6237\u53EF\u89C1\u56DE\u590D\u3002\u53EF\u591A\u6B21\u8C03\u7528\u8865\u5145\u8FDB\u5C55\uFF1B\u88AB @ \u65F6\u6536\u5230\u540E\u5E94\u5148\u7B80\u77ED\u786E\u8BA4\u518D\u6267\u884C\u4EFB\u52A1\u3002\u7ED3\u8BBA\u4E0E\u8FDB\u5C55\u5E94\u5199\u5728\u672C\u5DE5\u5177\u4E2D\uFF1B\u6700\u7EC8\u81EA\u7136\u8BED\u8A00\u6536\u5C3E\u52FF\u518D\u590D\u8FF0\u6B64\u5904\u5185\u5BB9\u3002",
|
|
7743
7771
|
inputSchema: {
|
|
7744
7772
|
type: "object",
|
|
7745
7773
|
properties: {
|
|
7746
7774
|
content: {
|
|
7747
7775
|
type: "string",
|
|
7748
|
-
description: "\u8981\
|
|
7776
|
+
description: "\u8981\u5C55\u793A\u7ED9\u7528\u6237\u7684\u56DE\u590D\u5185\u5BB9\uFF08\u975E\u6700\u7EC8 assistant \u590D\u8FF0\uFF09"
|
|
7749
7777
|
}
|
|
7750
7778
|
},
|
|
7751
7779
|
required: ["content"]
|
|
@@ -8657,7 +8685,8 @@ function spawnWebIdeMessageWorker(cfg, msg) {
|
|
|
8657
8685
|
const api = createApmApiClient2(cfg);
|
|
8658
8686
|
await api.cli.webideSetMessageError({
|
|
8659
8687
|
id: msg.messageId,
|
|
8660
|
-
error: reason
|
|
8688
|
+
error: reason,
|
|
8689
|
+
asCancelled: true
|
|
8661
8690
|
});
|
|
8662
8691
|
} catch (err) {
|
|
8663
8692
|
console.error(
|
|
@@ -1362,14 +1362,34 @@ var EventSession = class {
|
|
|
1362
1362
|
});
|
|
1363
1363
|
this.markDirty(this.events.length - 1);
|
|
1364
1364
|
}
|
|
1365
|
-
/**
|
|
1365
|
+
/**
|
|
1366
|
+
* CLI 本地准备步骤(工作区/分支/文档等),写入日志供 WebIDE 查看。
|
|
1367
|
+
* 同名 step 原地更新(进行中→完成合并为一行),终态时写入 durationMs。
|
|
1368
|
+
*/
|
|
1366
1369
|
addCliStep(step, text, status = "ok") {
|
|
1370
|
+
const existingIndex = this.events.findIndex(
|
|
1371
|
+
(e) => e.type === "cli_step" && e.step === step
|
|
1372
|
+
);
|
|
1373
|
+
const now = Date.now();
|
|
1374
|
+
if (existingIndex >= 0) {
|
|
1375
|
+
const existing = this.events[existingIndex];
|
|
1376
|
+
existing.status = status;
|
|
1377
|
+
existing.text = text;
|
|
1378
|
+
if (status !== "running") {
|
|
1379
|
+
const startedAt = typeof existing.at === "string" ? Date.parse(existing.at) : NaN;
|
|
1380
|
+
if (Number.isFinite(startedAt)) {
|
|
1381
|
+
existing.durationMs = Math.max(0, now - startedAt);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
this.markDirty(existingIndex);
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1367
1387
|
this.events.push({
|
|
1368
1388
|
type: "cli_step",
|
|
1369
1389
|
step,
|
|
1370
1390
|
status,
|
|
1371
1391
|
text,
|
|
1372
|
-
at:
|
|
1392
|
+
at: new Date(now).toISOString()
|
|
1373
1393
|
});
|
|
1374
1394
|
this.markDirty(this.events.length - 1);
|
|
1375
1395
|
}
|
|
@@ -1748,13 +1768,13 @@ function createAppendMessageCustomTools(cfg, messageId, appendContent2) {
|
|
|
1748
1768
|
const doAppend = appendContent2 ?? ((content) => appendMessageContent(cfg, messageId, content));
|
|
1749
1769
|
return {
|
|
1750
1770
|
AppendMessage: {
|
|
1751
|
-
description: "\u5411\u5F53\u524D\u4F1A\u8BDD\u6D88\u606F\u8FFD\u52A0\u56DE\u590D\
|
|
1771
|
+
description: "\u5411\u5F53\u524D\u4F1A\u8BDD/WebIDE \u6D88\u606F\u8FFD\u52A0\u7528\u6237\u53EF\u89C1\u56DE\u590D\u3002\u53EF\u591A\u6B21\u8C03\u7528\u8865\u5145\u8FDB\u5C55\uFF1B\u88AB @ \u65F6\u6536\u5230\u540E\u5E94\u5148\u7B80\u77ED\u786E\u8BA4\u518D\u6267\u884C\u4EFB\u52A1\u3002\u7ED3\u8BBA\u4E0E\u8FDB\u5C55\u5E94\u5199\u5728\u672C\u5DE5\u5177\u4E2D\uFF1B\u6700\u7EC8\u81EA\u7136\u8BED\u8A00\u6536\u5C3E\u52FF\u518D\u590D\u8FF0\u6B64\u5904\u5185\u5BB9\u3002",
|
|
1752
1772
|
inputSchema: {
|
|
1753
1773
|
type: "object",
|
|
1754
1774
|
properties: {
|
|
1755
1775
|
content: {
|
|
1756
1776
|
type: "string",
|
|
1757
|
-
description: "\u8981\
|
|
1777
|
+
description: "\u8981\u5C55\u793A\u7ED9\u7528\u6237\u7684\u56DE\u590D\u5185\u5BB9\uFF08\u975E\u6700\u7EC8 assistant \u590D\u8FF0\uFF09"
|
|
1758
1778
|
}
|
|
1759
1779
|
},
|
|
1760
1780
|
required: ["content"]
|
|
@@ -2683,9 +2703,27 @@ var MinioClient = class {
|
|
|
2683
2703
|
}
|
|
2684
2704
|
};
|
|
2685
2705
|
|
|
2686
|
-
// src/commands/
|
|
2687
|
-
|
|
2688
|
-
|
|
2706
|
+
// src/commands/connect/apm-log-minio.ts
|
|
2707
|
+
var APM_LOG_MINIO_CONFIG = {
|
|
2708
|
+
endpoint: "objectstorageapi.gzg.sealos.run",
|
|
2709
|
+
port: 443,
|
|
2710
|
+
useSsl: true,
|
|
2711
|
+
accessKey: "428hqav4",
|
|
2712
|
+
secretKey: "68b8srk4vdbjdhlc",
|
|
2713
|
+
bucket: "428hqav4-apm-log"
|
|
2714
|
+
};
|
|
2715
|
+
function createApmLogMinioClient() {
|
|
2716
|
+
const storage = APM_LOG_MINIO_CONFIG;
|
|
2717
|
+
return {
|
|
2718
|
+
client: new MinioClient({
|
|
2719
|
+
endPoint: storage.endpoint,
|
|
2720
|
+
port: storage.port,
|
|
2721
|
+
useSSL: storage.useSsl,
|
|
2722
|
+
accessKey: storage.accessKey,
|
|
2723
|
+
secretKey: storage.secretKey
|
|
2724
|
+
}),
|
|
2725
|
+
bucket: storage.bucket
|
|
2726
|
+
};
|
|
2689
2727
|
}
|
|
2690
2728
|
|
|
2691
2729
|
// src/commands/connect/webide-message-log.ts
|
|
@@ -2728,15 +2766,9 @@ function createThrottledWebIdeMessageLogSync(cfg, ctx, onError, options) {
|
|
|
2728
2766
|
let firstLogNotified = false;
|
|
2729
2767
|
const ensureMinio = async () => {
|
|
2730
2768
|
if (minio) return;
|
|
2731
|
-
const
|
|
2732
|
-
minio =
|
|
2733
|
-
|
|
2734
|
-
port: storage.port,
|
|
2735
|
-
useSSL: storage.useSsl,
|
|
2736
|
-
accessKey: storage.accessKey,
|
|
2737
|
-
secretKey: storage.secretKey
|
|
2738
|
-
});
|
|
2739
|
-
bucket = storage.bucket;
|
|
2769
|
+
const created = createApmLogMinioClient();
|
|
2770
|
+
minio = created.client;
|
|
2771
|
+
bucket = created.bucket;
|
|
2740
2772
|
await minio.ensureBucket(bucket);
|
|
2741
2773
|
};
|
|
2742
2774
|
const notifyFirstLog = async () => {
|
package/package.json
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
- 规则: `.apm/rules/*`
|
|
30
30
|
- reply.md:当需要回复消息时需要读取这个文档,记住回复规则
|
|
31
31
|
- write_doc.md:当需要写文档时需要读取这个文档,记住写文档的规则
|
|
32
|
+
- webide_reply.md:WebIDE 任务必守;用户可见只走 AppendMessage,最终自然语言收尾最多 1 句、禁止复述
|
|
32
33
|
- webide_git_commit.md:WebIDE 开发/修码时读取,按规范分轮 commit,结束前 push
|
|
33
34
|
- webide_sql_change.md:WebIDE 开发/修码时读取;若有数据表或 SQL 变更,须在 AppendMessage 中醒目提示
|
|
34
35
|
- webide_testcase.md:WebIDE 生成测试用例时读取,按规范编写并提交用例
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## WebIDE 输出通道
|
|
2
|
+
|
|
3
|
+
适用:WebIDE 任务(`webide-message` / 本轮 prompt 含 `taskId` + `action`)。
|
|
4
|
+
|
|
5
|
+
### 分工
|
|
6
|
+
|
|
7
|
+
1. **用户可见内容 → 只走 `AppendMessage`**
|
|
8
|
+
进展、评估结论、改动说明、错误原因、下一步等,一律用 `AppendMessage` 写入(可多次追加)。
|
|
9
|
+
|
|
10
|
+
2. **最终自然语言回复(非工具调用的收尾文本)→ 极简**
|
|
11
|
+
最多 1 句状态确认,例如「本轮已完成」或「本轮已阻塞:…」。
|
|
12
|
+
**禁止**复述、扩写或总结 `AppendMessage` 已写内容;**禁止**再列改动清单、步骤回放或长篇收尾。
|
|
13
|
+
|
|
14
|
+
3. 本轮若已调用过 `AppendMessage`,最终回复不要重复其要点。
|
|
15
|
+
|
|
16
|
+
### 为何
|
|
17
|
+
|
|
18
|
+
对话面板只展示 `AppendMessage`;最终 assistant 文本会进执行日志并触发同步,重复总结既无助于用户,又增加耗时。
|