@tencent-ai/codebuddy-code 2.142.0-dev.fe3dd20.202609032157 → 2.142.0-dev.fe3dd20.202609032221

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.
@@ -0,0 +1,13 @@
1
+ import { Context, Middleware } from '@celljs/web/lib/node';
2
+ import { ConsoleManager } from '../console';
3
+ import { NavigationManager } from '../navigation';
4
+ import { WorkspaceFolderManager } from '../runtime';
5
+ import { SessionManager } from '../session';
6
+ export declare class AddDirMiddleWare implements Middleware {
7
+ protected readonly sessionManager: SessionManager;
8
+ protected readonly workspaceFolderManager: WorkspaceFolderManager;
9
+ protected readonly navigationManager: NavigationManager;
10
+ protected readonly consoleManager: ConsoleManager;
11
+ handle(ctx: Context, next: () => Promise<void>): Promise<void>;
12
+ readonly priority: number;
13
+ }
@@ -0,0 +1,8 @@
1
+ import { Logger } from '@celljs/core';
2
+ import { ExternalUriOpener } from '@genie/runtime';
3
+ import { Subject } from 'rxjs';
4
+ export declare class CliExternalUriOpener implements ExternalUriOpener {
5
+ urlSubject: Subject<string>;
6
+ protected readonly logger: Logger;
7
+ open(uri: string): Promise<boolean>;
8
+ }
@@ -0,0 +1,17 @@
1
+ import { FileSystem, LocalStorage, LocalStorageChangeEvent } from '@genie/runtime';
2
+ export declare class MemoryLocalStorage implements LocalStorage {
3
+ protected readonly fileSystem: FileSystem;
4
+ private emitter;
5
+ changeEvent: import("@celljs/core").Event<LocalStorageChangeEvent>;
6
+ /**
7
+ * server 面缺省 no-op(CODEBUDDY_DISABLE_LOCAL_STORAGE=1):消费者全是
8
+ * 交互产品面(问卷冷却、输入历史等),pod 上无消费者;写盘还会把多租户
9
+ * 状态混进进程全局文件。no-op 而非内存 Map——假共享不如无共享。
10
+ */
11
+ private get disabled();
12
+ set<T>(key: string, value: T): Promise<void>;
13
+ getSync<T>(key: string, defaultValue?: T): T | undefined;
14
+ get<T>(key: string, defaultValue?: T): Promise<T | undefined>;
15
+ remove(key: string): Promise<void>;
16
+ private resolveEntryPath;
17
+ }
@@ -0,0 +1,45 @@
1
+ import { Session, SessionManager } from '../session';
2
+ import { SettingsManager, SettingsScope } from '../settings';
3
+ export declare const WorkspaceFolderManager: unique symbol;
4
+ /**
5
+ * 工作目录的落点:
6
+ * - 'session':仅当前会话生效,存 session.options.addDir,不落盘
7
+ * - SettingsScope:持久化到对应的配置文件(user / project / project-local)
8
+ */
9
+ type WorkspaceFolderTarget = 'session' | SettingsScope;
10
+ export interface WorkspaceFolderManager {
11
+ /**
12
+ * 添加工作目录
13
+ */
14
+ addWorkspaceFolder(directory: string, target: WorkspaceFolderTarget): Promise<void>;
15
+ /**
16
+ * 移除工作目录
17
+ */
18
+ removeWorkspaceFolder(directory: string, target: WorkspaceFolderTarget): Promise<void>;
19
+ /**
20
+ * 从所有落点(session + 所有持久化 scope)移除工作目录
21
+ */
22
+ removeWorkspaceFolderEverywhere(directory: string): Promise<void>;
23
+ /**
24
+ * 获取所有工作目录
25
+ */
26
+ getWorkspaceFolders(target?: WorkspaceFolderTarget): Promise<string[]>;
27
+ /**
28
+ * 判断是否包含工作目录
29
+ */
30
+ hasWorkspaceFolder(directory: string, target: WorkspaceFolderTarget): Promise<boolean>;
31
+ }
32
+ export declare class WorkspaceFolderManagerImpl implements WorkspaceFolderManager {
33
+ protected readonly sessionManager: SessionManager;
34
+ protected readonly settingsManager: SettingsManager;
35
+ protected currentSession: Session | undefined;
36
+ protected init(): void;
37
+ private getScopeDirectories;
38
+ private operateWorkspaceFolder;
39
+ addWorkspaceFolder(directory: string, target: WorkspaceFolderTarget): Promise<void>;
40
+ removeWorkspaceFolder(directory: string, target: WorkspaceFolderTarget): Promise<void>;
41
+ removeWorkspaceFolderEverywhere(directory: string): Promise<void>;
42
+ getWorkspaceFolders(target?: WorkspaceFolderTarget): Promise<string[]>;
43
+ hasWorkspaceFolder(directory: string, target: WorkspaceFolderTarget): Promise<boolean>;
44
+ }
45
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Workspace, WorkspaceFolder } from '@genie/runtime';
2
+ export declare class CliWorkspace implements Workspace {
3
+ private readonly cwdService;
4
+ get workspaceFolders(): readonly WorkspaceFolder[];
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-ai/codebuddy-code",
3
- "version": "2.142.0-dev.fe3dd20.202609032157",
3
+ "version": "2.142.0-dev.fe3dd20.202609032221",
4
4
  "description": "Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
5
5
  "main": "lib/node/index.js",
6
6
  "typings": "lib/node/index.d.ts",
@@ -823,5 +823,5 @@
823
823
  "SkipToolCallSupportCheck": true
824
824
  },
825
825
  "commit": "fe3dd20e215af4f7c070ae4b65eec5a63ca4d5aa",
826
- "date": "2026-09-03T13:56:25.377Z"
826
+ "date": "2026-09-03T14:20:51.242Z"
827
827
  }
@@ -833,5 +833,5 @@
833
833
  }
834
834
  },
835
835
  "commit": "fe3dd20e215af4f7c070ae4b65eec5a63ca4d5aa",
836
- "date": "2026-09-03T13:56:25.321Z"
836
+ "date": "2026-09-03T14:20:51.164Z"
837
837
  }
package/product.ioa.json CHANGED
@@ -1326,5 +1326,5 @@
1326
1326
  }
1327
1327
  },
1328
1328
  "commit": "fe3dd20e215af4f7c070ae4b65eec5a63ca4d5aa",
1329
- "date": "2026-09-03T13:56:25.366Z"
1329
+ "date": "2026-09-03T14:20:51.150Z"
1330
1330
  }
package/product.json CHANGED
@@ -2227,5 +2227,5 @@
2227
2227
  }
2228
2228
  ],
2229
2229
  "commit": "fe3dd20e215af4f7c070ae4b65eec5a63ca4d5aa",
2230
- "date": "2026-09-03T13:56:25.341Z"
2230
+ "date": "2026-09-03T14:20:51.216Z"
2231
2231
  }
@@ -360,5 +360,5 @@
360
360
  "SkipToolCallSupportCheck": true
361
361
  },
362
362
  "commit": "fe3dd20e215af4f7c070ae4b65eec5a63ca4d5aa",
363
- "date": "2026-09-03T13:56:25.343Z"
363
+ "date": "2026-09-03T14:20:51.186Z"
364
364
  }
@@ -1,125 +0,0 @@
1
- import { Logger } from '@celljs/core';
2
- import type { SandboxExecPolicy as ISandboxExecPolicy } from '../permission/sandbox-exec-policy-protocol';
3
- import type { SensitiveCommandDetector as ISensitiveCommandDetector } from '../permission/sensitive-command-detector';
4
- import { SandboxTurnConfig } from '../sandbox-cli/sandbox-turn-config';
5
- import type { SettingsManager as ISettingsManager } from '../settings/settings-protocol';
6
- import { BashSandboxManager as IBashSandboxManager, SandboxConfig, SandboxDependencyError } from './bash-sandbox-protocol';
7
- export declare function expandWindowsNativeDirectoryGlobs(paths: readonly string[] | undefined, platform?: NodeJS.Platform): string[];
8
- /**
9
- * Bash 沙箱管理器实现
10
- * 封装 @anthropic-ai/sandbox-runtime 并提供配置管理和自动初始化
11
- */
12
- export declare class BashSandboxManagerImpl implements IBashSandboxManager {
13
- protected readonly settingsManager: ISettingsManager;
14
- protected readonly logger: Logger;
15
- /**
16
- * Optional so that environments that boot the sandbox manager without the
17
- * policy module registered (e.g. legacy headless paths) keep working;
18
- * when present we forward `settings.sandbox.execPolicy` updates on each
19
- * config load so the policy's user rules stay in sync with settings.
20
- */
21
- protected readonly execPolicy?: ISandboxExecPolicy;
22
- protected readonly sensitiveCommandDetector?: ISensitiveCommandDetector;
23
- protected readonly sandboxTurnConfig: SandboxTurnConfig;
24
- private initialized;
25
- private cachedConfig;
26
- /** Last user-rules payload we pushed into the ExecPolicy; used to avoid
27
- * redundant `setUserRules` calls when settings are unchanged. */
28
- private lastExecPolicyUserRulesKey;
29
- private lastOrderedCommandRulesKey;
30
- /**
31
- * 获取当前沙箱配置
32
- */
33
- getConfig(): Promise<SandboxConfig | undefined>;
34
- /**
35
- * 使用沙箱包装命令
36
- *
37
- * 仅 Linux 上调用 `@anthropic-ai/sandbox-runtime` 的 `wrapWithSandbox`,
38
- * 把命令包装成 `bwrap ... -- bash -c <cmd>` 形式后返回,供
39
- * `LegacySandboxShellService` 交给 `LocalShellService` 执行。
40
- *
41
- * 其它平台(macOS/Windows)由 `sandbox-cli` 接管命令执行,不经过这条
42
- * JS 侧包装路径;此处直接返回原命令,避免 `AnthropicSandboxManager`
43
- * 在未初始化的前提下被调用。
44
- */
45
- wrapCommand(command: string): Promise<string>;
46
- /**
47
- * 检查命令是否应该在沙箱中执行
48
- */
49
- shouldSandbox(command: string): Promise<boolean>;
50
- /**
51
- * 检查命令是否属于系统级工具(如 WSL)。
52
- * 复用 {@link getCommandRoots} 解析器提取命令根。
53
- */
54
- isSystemLevelTool(command: string): boolean;
55
- /**
56
- * 确保沙箱处于正确状态(检查配置变化并初始化/重新初始化)
57
- */
58
- private ensureSandboxReady;
59
- /**
60
- * 应用配置变化(智能初始化/重新初始化)
61
- */
62
- private applyConfigChange;
63
- /**
64
- * 检查 Linux 平台沙箱所需的依赖
65
- * @returns 缺失的依赖列表
66
- */
67
- private checkLinuxDependencies;
68
- /**
69
- * 检查 Linux 依赖并返回错误(如果有缺失)
70
- * 供外部调用(如 /sandbox 命令)显示给用户
71
- */
72
- checkDependencies(): Promise<SandboxDependencyError | undefined>;
73
- /**
74
- * 初始化沙箱
75
- *
76
- * 仅 Linux 需要走 `@anthropic-ai/sandbox-runtime`(bwrap + socat)这条
77
- * 老路径——对应 `LegacySandboxShellService`。macOS/Windows 已改为由
78
- * `SandboxShellService` 驱动 Rust `sandbox-cli` 二进制,`AnthropicSandboxManager`
79
- * 在那两个平台上不承担任何运行时职责,即便调用也只是内存里重设一份永远
80
- * 不会被读到的配置,因此直接跳过以避免额外开销和潜在的兼容性问题。
81
- */
82
- private initialize;
83
- /**
84
- * 重置沙箱
85
- *
86
- * 与 `initialize` 对称:只有 Linux 上才真正持有 AnthropicSandboxManager
87
- * 的状态,其它平台只要翻转 `this.initialized` 即可。
88
- */
89
- private reset;
90
- /**
91
- * 从设置中加载沙箱配置
92
- */
93
- private loadConfig;
94
- /**
95
- * 判断两个配置是否相等(通过 deepEqual 比较)
96
- */
97
- private isConfigEqual;
98
- /**
99
- * 将 SandboxConfig 转换为 SandboxRuntimeConfig
100
- */
101
- private toRuntimeConfig;
102
- /**
103
- * 扩展路径中的波浪号
104
- */
105
- private expandPaths;
106
- /**
107
- * Push user-authored ExecPolicy rules into the policy component.
108
- *
109
- * `undefined` fingerprint means "no execPolicy set" — we also forward
110
- * `undefined` so the policy clears any previously loaded user rules
111
- * (important when a user removes the settings block entirely).
112
- */
113
- private syncExecPolicyUserRules;
114
- private syncOrderedCommandRules;
115
- /** Prefix commands that wrap the real command — skip them to find the actual executable. */
116
- private static readonly SHELL_PREFIX_COMMANDS;
117
- /** Standalone builtins whose arguments are NOT commands — skip the whole sub-command. */
118
- private static readonly SHELL_STANDALONE_BUILTINS;
119
- /**
120
- * Extract command roots from ALL sub-commands in a compound command
121
- * (separated by &&, ||, ;, |). Each sub-command yields at most one
122
- * root — the first non-assignment, non-shell-prefix string token.
123
- */
124
- private getCommandRoots;
125
- }
@@ -1,33 +0,0 @@
1
- import { Logger } from '@celljs/core';
2
- import { type ShellExecuteParams, type ShellExecutionHandle, type ShellService } from '../shell/shell-protocol';
3
- import { BashSandboxManager as IBashSandboxManager } from './bash-sandbox-protocol';
4
- /**
5
- * Shell service backed by `@anthropic-ai/sandbox-runtime` (bwrap/socat on
6
- * Linux).
7
- *
8
- * Implementation strategy: transform the caller's command into its sandboxed
9
- * equivalent via `BashSandboxManager.wrapCommand()`, then hand the wrapped
10
- * command to `LocalShellService`. Execution semantics (PTY, env propagation,
11
- * cwd, timeout) therefore mirror the regular local pipeline — the sandbox
12
- * layer is just a `bwrap ...` / `sandbox-exec ...` prefix injected at the
13
- * command string level.
14
- *
15
- * Known limitations (Linux):
16
- *
17
- * - No structured violation reporting. Failures surface as a non-zero exit
18
- * code plus free-form stderr from bwrap / the launched process. The
19
- * orchestrator therefore suppresses its `[4] escalation` branch for this
20
- * backend; denied commands just fail and the model sees the stderr.
21
- * - `wrapCommand()` returns the original command verbatim when the sandbox
22
- * is globally disabled or its native deps (bwrap / socat) are missing. In
23
- * that case we still dispatch through `LocalShellService` for a graceful
24
- * degradation instead of spawning a broken sandbox.
25
- */
26
- export declare class LegacySandboxShellServiceImpl implements ShellService {
27
- protected readonly localShellService: ShellService;
28
- protected readonly bashSandboxManager: IBashSandboxManager;
29
- protected readonly logger: Logger;
30
- execute(params: ShellExecuteParams): Promise<ShellExecutionHandle>;
31
- disposeAll(): Promise<void>;
32
- getActiveHandleCount(): number;
33
- }
@@ -1,6 +0,0 @@
1
- import { type ResolvedSecurityCenterPolicy } from '@genie/product';
2
- /**
3
- * 从子进程 env 读取产品配置顶层 clientSecurity 并翻译为规范化策略。
4
- * 顺序:ACC_PRODUCT_CONFIG_V3 → V2 → ACC_PRODUCT_CONFIG_PATH 落盘文件。全部失败返回 managed:false。
5
- */
6
- export declare function readManagedSecurityPolicyFromEnv(env?: NodeJS.ProcessEnv): ResolvedSecurityCenterPolicy;