@auto-ai/agent 2.1.220 → 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.
Files changed (41) hide show
  1. package/dist/safe-a/404/index.html +1 -1
  2. package/dist/safe-a/404.html +1 -1
  3. package/dist/safe-a/index.html +2 -2
  4. package/dist/safe-a/index.txt +1 -1
  5. package/dist/safe-a/manage/about/index.html +2 -2
  6. package/dist/safe-a/manage/about/index.txt +1 -1
  7. package/dist/safe-a/manage/env/index.html +2 -2
  8. package/dist/safe-a/manage/env/index.txt +1 -1
  9. package/dist/safe-a/manage/geelib/index.html +2 -2
  10. package/dist/safe-a/manage/geelib/index.txt +1 -1
  11. package/dist/safe-a/manage/general/index.html +2 -2
  12. package/dist/safe-a/manage/general/index.txt +1 -1
  13. package/dist/safe-a/manage/git/index.html +2 -2
  14. package/dist/safe-a/manage/git/index.txt +1 -1
  15. package/dist/safe-a/manage/im/index.html +2 -2
  16. package/dist/safe-a/manage/im/index.txt +1 -1
  17. package/dist/safe-a/manage/index.html +2 -2
  18. package/dist/safe-a/manage/index.txt +1 -1
  19. package/dist/safe-a/manage/library/index.html +2 -2
  20. package/dist/safe-a/manage/library/index.txt +1 -1
  21. package/dist/safe-a/manage/mcp/index.html +2 -2
  22. package/dist/safe-a/manage/mcp/index.txt +1 -1
  23. package/dist/safe-a/manage/permissions/index.html +2 -2
  24. package/dist/safe-a/manage/permissions/index.txt +1 -1
  25. package/dist/safe-a/manage/skills/index.html +2 -2
  26. package/dist/safe-a/manage/skills/index.txt +1 -1
  27. package/dist/safe-a/manage/task/index.html +2 -2
  28. package/dist/safe-a/manage/task/index.txt +1 -1
  29. package/dist/safe-a/manage/teams/index.html +2 -2
  30. package/dist/safe-a/manage/teams/index.txt +1 -1
  31. package/dist/safe-a/manage/tools/index.html +2 -2
  32. package/dist/safe-a/manage/tools/index.txt +1 -1
  33. package/dist/ws-test/ws-test.js +71 -1
  34. package/mcps-runtime/claude-tuitui-channel/server/index.mjs +5 -0
  35. package/package.json +6 -6
  36. package/tools-runtime/git-tool/index.cjs +32 -31
  37. package/tools-runtime/git-tool/src/workspace.ts +42 -5
  38. package/tools-runtime/git-tool/src/wsInit.ts +13 -2
  39. /package/dist/safe-a/_next/static/{tLBo5EqCFXrKR3ERjvMIi → 1lVS2YCkhJeMjvIi_ropq}/_buildManifest.js +0 -0
  40. /package/dist/safe-a/_next/static/{tLBo5EqCFXrKR3ERjvMIi → 1lVS2YCkhJeMjvIi_ropq}/_clientMiddlewareManifest.json +0 -0
  41. /package/dist/safe-a/_next/static/{tLBo5EqCFXrKR3ERjvMIi → 1lVS2YCkhJeMjvIi_ropq}/_ssgManifest.js +0 -0
@@ -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
- * 未配置 WS_GIT_REPO_URL 且本地无 git 工作区时返回 skipped,不抛错。
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
- // clone 前创建 workspace/ 等父目录,避免 git clone 因路径不存在失败
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
- } else {
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
- /** WS init:按 agent 白名单与环境变量准备 git 工作区 */
24
- export async function initWsSession(
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
+ }