@auto-ai/agent 2.1.219 → 2.1.221
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/safe-a/404/index.html +1 -1
- package/dist/safe-a/404.html +1 -1
- package/dist/safe-a/index.html +2 -2
- package/dist/safe-a/index.txt +1 -1
- package/dist/safe-a/manage/about/index.html +2 -2
- package/dist/safe-a/manage/about/index.txt +1 -1
- package/dist/safe-a/manage/env/index.html +2 -2
- package/dist/safe-a/manage/env/index.txt +1 -1
- package/dist/safe-a/manage/geelib/index.html +2 -2
- package/dist/safe-a/manage/geelib/index.txt +1 -1
- package/dist/safe-a/manage/general/index.html +2 -2
- package/dist/safe-a/manage/general/index.txt +1 -1
- package/dist/safe-a/manage/git/index.html +2 -2
- package/dist/safe-a/manage/git/index.txt +1 -1
- package/dist/safe-a/manage/im/index.html +2 -2
- package/dist/safe-a/manage/im/index.txt +1 -1
- package/dist/safe-a/manage/index.html +2 -2
- package/dist/safe-a/manage/index.txt +1 -1
- package/dist/safe-a/manage/library/index.html +2 -2
- package/dist/safe-a/manage/library/index.txt +1 -1
- package/dist/safe-a/manage/mcp/index.html +2 -2
- package/dist/safe-a/manage/mcp/index.txt +1 -1
- package/dist/safe-a/manage/permissions/index.html +2 -2
- package/dist/safe-a/manage/permissions/index.txt +1 -1
- package/dist/safe-a/manage/skills/index.html +2 -2
- package/dist/safe-a/manage/skills/index.txt +1 -1
- package/dist/safe-a/manage/task/index.html +2 -2
- package/dist/safe-a/manage/task/index.txt +1 -1
- package/dist/safe-a/manage/teams/index.html +2 -2
- package/dist/safe-a/manage/teams/index.txt +1 -1
- package/dist/safe-a/manage/tools/index.html +2 -2
- package/dist/safe-a/manage/tools/index.txt +1 -1
- package/dist/ws-test/ws-test.js +92 -37
- package/mcps-runtime/claude-tuitui-channel/server/index.mjs +5 -0
- package/package.json +6 -6
- package/tools-runtime/git-tool/index.cjs +32 -31
- package/tools-runtime/git-tool/src/workspace.ts +42 -5
- package/tools-runtime/git-tool/src/wsInit.ts +13 -2
- /package/dist/safe-a/_next/static/{uUFkPsDuD-7lOu6Lp5qqZ → 1lVS2YCkhJeMjvIi_ropq}/_buildManifest.js +0 -0
- /package/dist/safe-a/_next/static/{uUFkPsDuD-7lOu6Lp5qqZ → 1lVS2YCkhJeMjvIi_ropq}/_clientMiddlewareManifest.json +0 -0
- /package/dist/safe-a/_next/static/{uUFkPsDuD-7lOu6Lp5qqZ → 1lVS2YCkhJeMjvIi_ropq}/_ssgManifest.js +0 -0
|
@@ -14387,6 +14387,19 @@ var GIT_NO_PROMPT_ENV = {
|
|
|
14387
14387
|
GIT_TERMINAL_PROMPT: "0",
|
|
14388
14388
|
GIT_ASKPASS: ""
|
|
14389
14389
|
};
|
|
14390
|
+
var agentGitPreparedDirs = new Set;
|
|
14391
|
+
function normalizeOperWorkspaceKey(operWorkspaceDir) {
|
|
14392
|
+
return operWorkspaceDir.normalize("NFC");
|
|
14393
|
+
}
|
|
14394
|
+
function logGitBootPhase(phase, startedAt, extra) {
|
|
14395
|
+
const parts = [`[session-boot] git.${phase}`, `duration_ms=${Date.now() - startedAt}`];
|
|
14396
|
+
if (extra) {
|
|
14397
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
14398
|
+
parts.push(`${k}=${v}`);
|
|
14399
|
+
}
|
|
14400
|
+
}
|
|
14401
|
+
console.warn(parts.join(" "));
|
|
14402
|
+
}
|
|
14390
14403
|
function getGitTimeoutMs() {
|
|
14391
14404
|
const envValue = process.env.CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS;
|
|
14392
14405
|
if (envValue) {
|
|
@@ -14587,41 +14600,43 @@ async function wsGitClone(params) {
|
|
|
14587
14600
|
${stderr}`.trim());
|
|
14588
14601
|
}
|
|
14589
14602
|
}
|
|
14590
|
-
async function wsGitPull(params) {
|
|
14591
|
-
console.warn(`[git-tool] pull cwd=${params.cwd}`);
|
|
14592
|
-
const result = await execGit(["pull", "origin", "HEAD"], {
|
|
14593
|
-
cwd: params.cwd,
|
|
14594
|
-
env: params.gitEnv
|
|
14595
|
-
});
|
|
14596
|
-
if (result.code !== 0) {
|
|
14597
|
-
throw new Error(`git pull 失败: cwd=${params.cwd} exit=${result.code}
|
|
14598
|
-
${result.stderr}`.trim());
|
|
14599
|
-
}
|
|
14600
|
-
}
|
|
14601
14603
|
async function prepareForAgent(params) {
|
|
14604
|
+
const bootStart = Date.now();
|
|
14605
|
+
const workspaceKey = normalizeOperWorkspaceKey(params.operWorkspaceDir);
|
|
14602
14606
|
const repoUrl = process.env.WS_GIT_REPO_URL?.trim() ?? "";
|
|
14603
14607
|
const creds = readGitCredentials();
|
|
14604
14608
|
const gitWorkDir = resolveGitWorkDir(params.operWorkspaceDir);
|
|
14605
14609
|
const gitEnv = buildGitCredentialEnv(creds);
|
|
14610
|
+
if (agentGitPreparedDirs.has(workspaceKey)) {
|
|
14611
|
+
configure({
|
|
14612
|
+
getGitWorkDir: () => gitWorkDir,
|
|
14613
|
+
getGitCommandEnv: () => gitEnv
|
|
14614
|
+
});
|
|
14615
|
+
logGitBootPhase("skip", bootStart, { reason: "already_prepared" });
|
|
14616
|
+
return "ready";
|
|
14617
|
+
}
|
|
14606
14618
|
if (repoUrl) {
|
|
14607
14619
|
const cloneUrl = withHttpsCredentials(repoUrl, creds);
|
|
14608
|
-
await probeGitRemote({ url: cloneUrl, gitEnv });
|
|
14609
14620
|
const repoExists = await pathExists(gitWorkDir);
|
|
14610
14621
|
if (!repoExists) {
|
|
14622
|
+
const probeStart = Date.now();
|
|
14623
|
+
await probeGitRemote({ url: cloneUrl, gitEnv });
|
|
14624
|
+
logGitBootPhase("probe", probeStart);
|
|
14625
|
+
const cloneStart = Date.now();
|
|
14611
14626
|
await import_promises.mkdir(import_node_path.dirname(gitWorkDir), { recursive: true });
|
|
14612
14627
|
await wsGitClone({
|
|
14613
14628
|
url: cloneUrl,
|
|
14614
14629
|
targetPath: gitWorkDir,
|
|
14615
14630
|
gitEnv
|
|
14616
14631
|
});
|
|
14617
|
-
|
|
14618
|
-
await wsGitPull({ cwd: gitWorkDir, gitEnv });
|
|
14632
|
+
logGitBootPhase("clone", cloneStart);
|
|
14619
14633
|
}
|
|
14620
14634
|
} else {
|
|
14621
14635
|
const repoReady = await pathExists(gitWorkDir) && await isGitWorkTree(gitWorkDir, gitEnv);
|
|
14622
14636
|
if (!repoReady) {
|
|
14623
14637
|
console.warn(`[git-tool] WS_GIT_REPO_URL 未配置且 ${gitWorkDir} 不是有效 git 工作区,跳过 GitTool 运行时配置`);
|
|
14624
14638
|
resetConfigure();
|
|
14639
|
+
logGitBootPhase("skip", bootStart, { reason: "no_repo" });
|
|
14625
14640
|
return "skipped";
|
|
14626
14641
|
}
|
|
14627
14642
|
}
|
|
@@ -14629,6 +14644,8 @@ async function prepareForAgent(params) {
|
|
|
14629
14644
|
getGitWorkDir: () => gitWorkDir,
|
|
14630
14645
|
getGitCommandEnv: () => gitEnv
|
|
14631
14646
|
});
|
|
14647
|
+
agentGitPreparedDirs.add(workspaceKey);
|
|
14648
|
+
logGitBootPhase("ready", bootStart);
|
|
14632
14649
|
return "ready";
|
|
14633
14650
|
}
|
|
14634
14651
|
function ensureConfigured() {
|
|
@@ -14644,23 +14661,7 @@ async function initWsSession(ctx) {
|
|
|
14644
14661
|
resetConfigure();
|
|
14645
14662
|
return { state: "skipped", reason: "GitTool disabled in agent config" };
|
|
14646
14663
|
}
|
|
14647
|
-
|
|
14648
|
-
const result = await prepareForAgent({ operWorkspaceDir: ctx.operWorkspaceDir });
|
|
14649
|
-
if (result === "skipped") {
|
|
14650
|
-
resetConfigure();
|
|
14651
|
-
return {
|
|
14652
|
-
state: "skipped",
|
|
14653
|
-
reason: "git work directory not ready (configure WS_GIT_REPO_URL or existing repo)"
|
|
14654
|
-
};
|
|
14655
|
-
}
|
|
14656
|
-
return { state: "ready" };
|
|
14657
|
-
} catch (e) {
|
|
14658
|
-
resetConfigure();
|
|
14659
|
-
return {
|
|
14660
|
-
state: "failed",
|
|
14661
|
-
error: e instanceof Error ? e.message : String(e)
|
|
14662
|
-
};
|
|
14663
|
-
}
|
|
14664
|
+
return { state: "ready" };
|
|
14664
14665
|
}
|
|
14665
14666
|
|
|
14666
14667
|
// src/index.ts
|
|
@@ -30,6 +30,27 @@ export type GitCredentials = {
|
|
|
30
30
|
|
|
31
31
|
export type PrepareForAgentResult = 'ready' | 'skipped'
|
|
32
32
|
|
|
33
|
+
/** 本进程内已完成 git 工作区准备的 operWorkspaceDir,避免 reload/boot 重复 pull */
|
|
34
|
+
const agentGitPreparedDirs = new Set<string>()
|
|
35
|
+
|
|
36
|
+
function normalizeOperWorkspaceKey(operWorkspaceDir: string): string {
|
|
37
|
+
return operWorkspaceDir.normalize('NFC')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function logGitBootPhase(
|
|
41
|
+
phase: string,
|
|
42
|
+
startedAt: number,
|
|
43
|
+
extra?: Record<string, string | number | boolean>,
|
|
44
|
+
): void {
|
|
45
|
+
const parts = [`[session-boot] git.${phase}`, `duration_ms=${Date.now() - startedAt}`]
|
|
46
|
+
if (extra) {
|
|
47
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
48
|
+
parts.push(`${k}=${v}`)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
console.warn(parts.join(' '))
|
|
52
|
+
}
|
|
53
|
+
|
|
33
54
|
function getGitTimeoutMs(): number {
|
|
34
55
|
const envValue = process.env.CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS
|
|
35
56
|
if (envValue) {
|
|
@@ -360,30 +381,43 @@ async function wsGitPull(params: {
|
|
|
360
381
|
|
|
361
382
|
/**
|
|
362
383
|
* WS init:按环境变量准备 git 工作区并 configure GitTool。
|
|
363
|
-
*
|
|
384
|
+
* 有 WS_GIT_REPO_URL 时仅缺目录才 clone;本地已有 repo 不再 pull(磁盘即真相)。
|
|
385
|
+
* 未配置 URL 且本地无 git 工作区时返回 skipped,不抛错。
|
|
364
386
|
*/
|
|
365
387
|
export async function prepareForAgent(params: {
|
|
366
388
|
operWorkspaceDir: string
|
|
367
389
|
}): Promise<PrepareForAgentResult> {
|
|
390
|
+
const bootStart = Date.now()
|
|
391
|
+
const workspaceKey = normalizeOperWorkspaceKey(params.operWorkspaceDir)
|
|
368
392
|
const repoUrl = process.env.WS_GIT_REPO_URL?.trim() ?? ''
|
|
369
393
|
const creds = readGitCredentials()
|
|
370
394
|
const gitWorkDir = resolveGitWorkDir(params.operWorkspaceDir)
|
|
371
395
|
const gitEnv = buildGitCredentialEnv(creds)
|
|
372
396
|
|
|
397
|
+
if (agentGitPreparedDirs.has(workspaceKey)) {
|
|
398
|
+
configure({
|
|
399
|
+
getGitWorkDir: () => gitWorkDir,
|
|
400
|
+
getGitCommandEnv: () => gitEnv,
|
|
401
|
+
})
|
|
402
|
+
logGitBootPhase('skip', bootStart, { reason: 'already_prepared' })
|
|
403
|
+
return 'ready'
|
|
404
|
+
}
|
|
405
|
+
|
|
373
406
|
if (repoUrl) {
|
|
374
407
|
const cloneUrl = withHttpsCredentials(repoUrl, creds)
|
|
375
|
-
await probeGitRemote({ url: cloneUrl, gitEnv })
|
|
376
408
|
const repoExists = await pathExists(gitWorkDir)
|
|
377
409
|
if (!repoExists) {
|
|
378
|
-
|
|
410
|
+
const probeStart = Date.now()
|
|
411
|
+
await probeGitRemote({ url: cloneUrl, gitEnv })
|
|
412
|
+
logGitBootPhase('probe', probeStart)
|
|
413
|
+
const cloneStart = Date.now()
|
|
379
414
|
await mkdir(dirname(gitWorkDir), { recursive: true })
|
|
380
415
|
await wsGitClone({
|
|
381
416
|
url: cloneUrl,
|
|
382
417
|
targetPath: gitWorkDir,
|
|
383
418
|
gitEnv,
|
|
384
419
|
})
|
|
385
|
-
|
|
386
|
-
await wsGitPull({ cwd: gitWorkDir, gitEnv })
|
|
420
|
+
logGitBootPhase('clone', cloneStart)
|
|
387
421
|
}
|
|
388
422
|
} else {
|
|
389
423
|
const repoReady =
|
|
@@ -394,6 +428,7 @@ export async function prepareForAgent(params: {
|
|
|
394
428
|
`[git-tool] WS_GIT_REPO_URL 未配置且 ${gitWorkDir} 不是有效 git 工作区,跳过 GitTool 运行时配置`,
|
|
395
429
|
)
|
|
396
430
|
resetConfigure()
|
|
431
|
+
logGitBootPhase('skip', bootStart, { reason: 'no_repo' })
|
|
397
432
|
return 'skipped'
|
|
398
433
|
}
|
|
399
434
|
}
|
|
@@ -402,6 +437,8 @@ export async function prepareForAgent(params: {
|
|
|
402
437
|
getGitWorkDir: () => gitWorkDir,
|
|
403
438
|
getGitCommandEnv: () => gitEnv,
|
|
404
439
|
})
|
|
440
|
+
agentGitPreparedDirs.add(workspaceKey)
|
|
441
|
+
logGitBootPhase('ready', bootStart)
|
|
405
442
|
return 'ready'
|
|
406
443
|
}
|
|
407
444
|
|
|
@@ -20,8 +20,8 @@ export type GitToolWsInitResult =
|
|
|
20
20
|
| { state: 'skipped'; reason?: string }
|
|
21
21
|
| { state: 'failed'; error: string }
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
export async function
|
|
23
|
+
/** Agent Worker 级:clone/pull 等重操作只执行一次 */
|
|
24
|
+
export async function initWsAgent(
|
|
25
25
|
ctx: GitToolWsInitContext,
|
|
26
26
|
): Promise<GitToolWsInitResult> {
|
|
27
27
|
if (!isEnabledInAgentConfig(ctx.agent)) {
|
|
@@ -46,3 +46,14 @@ export async function initWsSession(
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
/** Session 级:git 工作区已在 agent boot 准备,仅确认白名单 */
|
|
51
|
+
export async function initWsSession(
|
|
52
|
+
ctx: GitToolWsInitContext,
|
|
53
|
+
): Promise<GitToolWsInitResult> {
|
|
54
|
+
if (!isEnabledInAgentConfig(ctx.agent)) {
|
|
55
|
+
resetConfigure()
|
|
56
|
+
return { state: 'skipped', reason: 'GitTool disabled in agent config' }
|
|
57
|
+
}
|
|
58
|
+
return { state: 'ready' }
|
|
59
|
+
}
|
/package/dist/safe-a/_next/static/{uUFkPsDuD-7lOu6Lp5qqZ → 1lVS2YCkhJeMjvIi_ropq}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/safe-a/_next/static/{uUFkPsDuD-7lOu6Lp5qqZ → 1lVS2YCkhJeMjvIi_ropq}/_ssgManifest.js
RENAMED
|
File without changes
|