@auto-ai/agent 2.1.224 → 2.1.226
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.css +6 -613
- package/dist/ws-test/ws-test.html +7 -23
- package/dist/ws-test/ws-test.js +89 -345
- package/package.json +6 -6
- package/tools-runtime/git-tool/index.cjs +31 -32
- package/tools-runtime/git-tool/src/workspace.ts +5 -42
- package/tools-runtime/git-tool/src/wsInit.ts +2 -13
- /package/dist/safe-a/_next/static/{fhaXRM3OAGMzPpk072rJg → ft4lngVPBVnD_YHbEfTse}/_buildManifest.js +0 -0
- /package/dist/safe-a/_next/static/{fhaXRM3OAGMzPpk072rJg → ft4lngVPBVnD_YHbEfTse}/_clientMiddlewareManifest.json +0 -0
- /package/dist/safe-a/_next/static/{fhaXRM3OAGMzPpk072rJg → ft4lngVPBVnD_YHbEfTse}/_ssgManifest.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auto-ai/agent",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.226",
|
|
4
4
|
"description": "Auto AI Agent 网关 CLI(WebSocket,独立二进制,无需 Bun)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"maintainers": [
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"zod": "^4.3.6"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@auto-ai/agent-linux-x64": "2.1.
|
|
36
|
-
"@auto-ai/agent-linux-arm64": "2.1.
|
|
37
|
-
"@auto-ai/agent-darwin-x64": "2.1.
|
|
38
|
-
"@auto-ai/agent-darwin-arm64": "2.1.
|
|
39
|
-
"@auto-ai/agent-win-x64": "2.1.
|
|
35
|
+
"@auto-ai/agent-linux-x64": "2.1.226",
|
|
36
|
+
"@auto-ai/agent-linux-arm64": "2.1.226",
|
|
37
|
+
"@auto-ai/agent-darwin-x64": "2.1.226",
|
|
38
|
+
"@auto-ai/agent-darwin-arm64": "2.1.226",
|
|
39
|
+
"@auto-ai/agent-win-x64": "2.1.226"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"prepare": "node ../../scripts/sync-launcher-env.js",
|
|
@@ -14387,19 +14387,6 @@ 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
|
-
}
|
|
14403
14390
|
function getGitTimeoutMs() {
|
|
14404
14391
|
const envValue = process.env.CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS;
|
|
14405
14392
|
if (envValue) {
|
|
@@ -14600,43 +14587,41 @@ async function wsGitClone(params) {
|
|
|
14600
14587
|
${stderr}`.trim());
|
|
14601
14588
|
}
|
|
14602
14589
|
}
|
|
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
|
+
}
|
|
14603
14601
|
async function prepareForAgent(params) {
|
|
14604
|
-
const bootStart = Date.now();
|
|
14605
|
-
const workspaceKey = normalizeOperWorkspaceKey(params.operWorkspaceDir);
|
|
14606
14602
|
const repoUrl = process.env.WS_GIT_REPO_URL?.trim() ?? "";
|
|
14607
14603
|
const creds = readGitCredentials();
|
|
14608
14604
|
const gitWorkDir = resolveGitWorkDir(params.operWorkspaceDir);
|
|
14609
14605
|
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
|
-
}
|
|
14618
14606
|
if (repoUrl) {
|
|
14619
14607
|
const cloneUrl = withHttpsCredentials(repoUrl, creds);
|
|
14608
|
+
await probeGitRemote({ url: cloneUrl, gitEnv });
|
|
14620
14609
|
const repoExists = await pathExists(gitWorkDir);
|
|
14621
14610
|
if (!repoExists) {
|
|
14622
|
-
const probeStart = Date.now();
|
|
14623
|
-
await probeGitRemote({ url: cloneUrl, gitEnv });
|
|
14624
|
-
logGitBootPhase("probe", probeStart);
|
|
14625
|
-
const cloneStart = Date.now();
|
|
14626
14611
|
await import_promises.mkdir(import_node_path.dirname(gitWorkDir), { recursive: true });
|
|
14627
14612
|
await wsGitClone({
|
|
14628
14613
|
url: cloneUrl,
|
|
14629
14614
|
targetPath: gitWorkDir,
|
|
14630
14615
|
gitEnv
|
|
14631
14616
|
});
|
|
14632
|
-
|
|
14617
|
+
} else {
|
|
14618
|
+
await wsGitPull({ cwd: gitWorkDir, gitEnv });
|
|
14633
14619
|
}
|
|
14634
14620
|
} else {
|
|
14635
14621
|
const repoReady = await pathExists(gitWorkDir) && await isGitWorkTree(gitWorkDir, gitEnv);
|
|
14636
14622
|
if (!repoReady) {
|
|
14637
14623
|
console.warn(`[git-tool] WS_GIT_REPO_URL 未配置且 ${gitWorkDir} 不是有效 git 工作区,跳过 GitTool 运行时配置`);
|
|
14638
14624
|
resetConfigure();
|
|
14639
|
-
logGitBootPhase("skip", bootStart, { reason: "no_repo" });
|
|
14640
14625
|
return "skipped";
|
|
14641
14626
|
}
|
|
14642
14627
|
}
|
|
@@ -14644,8 +14629,6 @@ async function prepareForAgent(params) {
|
|
|
14644
14629
|
getGitWorkDir: () => gitWorkDir,
|
|
14645
14630
|
getGitCommandEnv: () => gitEnv
|
|
14646
14631
|
});
|
|
14647
|
-
agentGitPreparedDirs.add(workspaceKey);
|
|
14648
|
-
logGitBootPhase("ready", bootStart);
|
|
14649
14632
|
return "ready";
|
|
14650
14633
|
}
|
|
14651
14634
|
function ensureConfigured() {
|
|
@@ -14661,7 +14644,23 @@ async function initWsSession(ctx) {
|
|
|
14661
14644
|
resetConfigure();
|
|
14662
14645
|
return { state: "skipped", reason: "GitTool disabled in agent config" };
|
|
14663
14646
|
}
|
|
14664
|
-
|
|
14647
|
+
try {
|
|
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
|
+
}
|
|
14665
14664
|
}
|
|
14666
14665
|
|
|
14667
14666
|
// src/index.ts
|
|
@@ -30,27 +30,6 @@ 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
|
-
|
|
54
33
|
function getGitTimeoutMs(): number {
|
|
55
34
|
const envValue = process.env.CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS
|
|
56
35
|
if (envValue) {
|
|
@@ -381,43 +360,30 @@ async function wsGitPull(params: {
|
|
|
381
360
|
|
|
382
361
|
/**
|
|
383
362
|
* WS init:按环境变量准备 git 工作区并 configure GitTool。
|
|
384
|
-
*
|
|
385
|
-
* 未配置 URL 且本地无 git 工作区时返回 skipped,不抛错。
|
|
363
|
+
* 未配置 WS_GIT_REPO_URL 且本地无 git 工作区时返回 skipped,不抛错。
|
|
386
364
|
*/
|
|
387
365
|
export async function prepareForAgent(params: {
|
|
388
366
|
operWorkspaceDir: string
|
|
389
367
|
}): Promise<PrepareForAgentResult> {
|
|
390
|
-
const bootStart = Date.now()
|
|
391
|
-
const workspaceKey = normalizeOperWorkspaceKey(params.operWorkspaceDir)
|
|
392
368
|
const repoUrl = process.env.WS_GIT_REPO_URL?.trim() ?? ''
|
|
393
369
|
const creds = readGitCredentials()
|
|
394
370
|
const gitWorkDir = resolveGitWorkDir(params.operWorkspaceDir)
|
|
395
371
|
const gitEnv = buildGitCredentialEnv(creds)
|
|
396
372
|
|
|
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
|
-
|
|
406
373
|
if (repoUrl) {
|
|
407
374
|
const cloneUrl = withHttpsCredentials(repoUrl, creds)
|
|
375
|
+
await probeGitRemote({ url: cloneUrl, gitEnv })
|
|
408
376
|
const repoExists = await pathExists(gitWorkDir)
|
|
409
377
|
if (!repoExists) {
|
|
410
|
-
|
|
411
|
-
await probeGitRemote({ url: cloneUrl, gitEnv })
|
|
412
|
-
logGitBootPhase('probe', probeStart)
|
|
413
|
-
const cloneStart = Date.now()
|
|
378
|
+
// clone 前创建 workspace/ 等父目录,避免 git clone 因路径不存在失败
|
|
414
379
|
await mkdir(dirname(gitWorkDir), { recursive: true })
|
|
415
380
|
await wsGitClone({
|
|
416
381
|
url: cloneUrl,
|
|
417
382
|
targetPath: gitWorkDir,
|
|
418
383
|
gitEnv,
|
|
419
384
|
})
|
|
420
|
-
|
|
385
|
+
} else {
|
|
386
|
+
await wsGitPull({ cwd: gitWorkDir, gitEnv })
|
|
421
387
|
}
|
|
422
388
|
} else {
|
|
423
389
|
const repoReady =
|
|
@@ -428,7 +394,6 @@ export async function prepareForAgent(params: {
|
|
|
428
394
|
`[git-tool] WS_GIT_REPO_URL 未配置且 ${gitWorkDir} 不是有效 git 工作区,跳过 GitTool 运行时配置`,
|
|
429
395
|
)
|
|
430
396
|
resetConfigure()
|
|
431
|
-
logGitBootPhase('skip', bootStart, { reason: 'no_repo' })
|
|
432
397
|
return 'skipped'
|
|
433
398
|
}
|
|
434
399
|
}
|
|
@@ -437,8 +402,6 @@ export async function prepareForAgent(params: {
|
|
|
437
402
|
getGitWorkDir: () => gitWorkDir,
|
|
438
403
|
getGitCommandEnv: () => gitEnv,
|
|
439
404
|
})
|
|
440
|
-
agentGitPreparedDirs.add(workspaceKey)
|
|
441
|
-
logGitBootPhase('ready', bootStart)
|
|
442
405
|
return 'ready'
|
|
443
406
|
}
|
|
444
407
|
|
|
@@ -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
|
+
/** WS init:按 agent 白名单与环境变量准备 git 工作区 */
|
|
24
|
+
export async function initWsSession(
|
|
25
25
|
ctx: GitToolWsInitContext,
|
|
26
26
|
): Promise<GitToolWsInitResult> {
|
|
27
27
|
if (!isEnabledInAgentConfig(ctx.agent)) {
|
|
@@ -46,14 +46,3 @@ export async function initWsAgent(
|
|
|
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/{fhaXRM3OAGMzPpk072rJg → ft4lngVPBVnD_YHbEfTse}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/safe-a/_next/static/{fhaXRM3OAGMzPpk072rJg → ft4lngVPBVnD_YHbEfTse}/_ssgManifest.js
RENAMED
|
File without changes
|