@tencent-ai/agent-harness 0.2.0-beta.3 → 0.2.0-beta.4
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/CHANGELOG.md +14 -0
- package/cli/dist-server/shared.cjs +267 -210
- package/cli/dist-server/types/node/acp/acp-protocol.d.ts +8 -0
- package/cli/dist-server/types/node/loopback/server-protocol.d.ts +5 -0
- package/cli/dist-server/types/node/tools/tool-protocol.d.ts +23 -22
- package/cli/dist-server/types/vendor/cbc-core/node/agent/runner-factory.d.ts +18 -0
- package/cli/dist-server/types/vendor/cbc-core/node/context/index.d.ts +1 -0
- package/cli/dist-server/types/vendor/cbc-core/node/context/mods-bridge.d.ts +115 -0
- package/cli/dist-server/types/vendor/cbc-core/node/message-queue/followup-queue-protocol.d.ts +3 -2
- package/cli/dist-server/types/vendor/cbc-core/node/message-queue/followup-queue.d.ts +1 -1
- package/cli/dist-server/types/vendor/cbc-core/node/message-queue/steer-input-buffer-protocol.d.ts +4 -0
- package/cli/dist-server/types/vendor/cbc-core/node/session/can-use-tool.d.ts +4 -0
- package/cli/dist-server/types/vendor/cbc-core/node/session/session-manager.d.ts +30 -0
- package/cli/dist-server/types/vendor/cbc-core/node/session/session-protocol.d.ts +12 -0
- package/cli/dist-server/types/vendor/cbc-core/node/utils/input-item-utils.d.ts +1 -1
- package/cli/dist-server/types/workspace/agent-client-protocol/lib/common/prompt-codec.d.ts +4 -0
- package/cli/dist-server/types/workspace/agent-client-protocol/lib/common/types.d.ts +15 -1
- package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/runner-factory.d.ts +18 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/context/index.d.ts +1 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/context/mods-bridge.d.ts +115 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/message-queue/followup-queue-protocol.d.ts +3 -2
- package/cli/dist-server/types/workspace/cbc-core/lib/node/message-queue/followup-queue.d.ts +1 -1
- package/cli/dist-server/types/workspace/cbc-core/lib/node/message-queue/steer-input-buffer-protocol.d.ts +4 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/session/can-use-tool.d.ts +4 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-manager.d.ts +30 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-protocol.d.ts +12 -0
- package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/input-item-utils.d.ts +1 -1
- package/cli/dist-server/types/workspace/product/lib/common/types/features.d.ts +16 -0
- package/cli/dist-server/types/workspace/prompts/lib/common/product-prompt-provider.d.ts +3 -1
- package/cli/dist-server/types/workspace/prompts/lib/common/prompt-protocol.d.ts +6 -0
- package/cli/product.cloudhosted.json +1 -803
- package/cli/product.internal.json +1 -1061
- package/cli/product.ioa.json +1 -1523
- package/cli/product.json +1 -2217
- package/cli/product.selfhosted.json +1 -364
- package/docs/acp-v2.md +19 -0
- package/docs/client.md +7 -0
- package/docs/product.md +4 -0
- package/docs/protocol.md +3 -1
- package/lib/agent/v2.js +1 -1
- package/lib/application/services.js +1 -1
- package/lib/auth/module.d.ts +3 -1
- package/lib/auth/module.js +1 -1
- package/lib/client/client.js +1 -1
- package/lib/components/sandbox.d.mts +2 -0
- package/lib/components/sandbox.mjs +1 -0
- package/lib/components/session-replay.d.mts +2 -0
- package/lib/components/session-replay.mjs +1 -1
- package/lib/effect-runtime/concurrency.d.mts +2 -4
- package/lib/effect-runtime/concurrency.mjs +1 -1
- package/lib/effect-runtime/process-runtime-context.d.ts +5 -1
- package/lib/protocol/acp-v2-credits.d.ts +10 -0
- package/lib/protocol/acp-v2-credits.js +1 -0
- package/lib/protocol/acp-v2-private-client.d.ts +1 -10
- package/lib/runtime/codebuddy-auth.d.ts +5 -3
- package/lib/runtime/codebuddy-auth.js +1 -1
- package/lib/session/replay.d.ts +1 -1
- package/lib/session/replay.js +1 -1
- package/lib/session/server-events.js +1 -1
- package/lib/session/server-interactions.js +1 -1
- package/lib/subagent/history.js +1 -1
- package/package.json +14 -9
|
@@ -28,6 +28,8 @@ export declare const SteerInputBuffer: unique symbol;
|
|
|
28
28
|
* drain 返回的一组:待插入内容 + 独立对账 id + 客户端不透明 metadata。
|
|
29
29
|
*/
|
|
30
30
|
export interface SteerDrainedGroup {
|
|
31
|
+
/** Set only after the host validates a one-time mod prompt receipt. */
|
|
32
|
+
readonly modsPromptSubmitted?: true;
|
|
31
33
|
readonly blocks: unknown[];
|
|
32
34
|
/** Native, already reviewed messages. Kept by reference for in-memory admission markers. */
|
|
33
35
|
readonly messages?: readonly UserMessageItem[];
|
|
@@ -49,6 +51,8 @@ export interface SteerDrainedGroup {
|
|
|
49
51
|
* push 的归属 + 客户端不透明 metadata 入参(合并为一个对象,避免 push 参数过多)。
|
|
50
52
|
*/
|
|
51
53
|
export interface SteerPushInput {
|
|
54
|
+
/** Server-only provenance, independent of untrusted clientMeta. */
|
|
55
|
+
readonly modsPromptSubmitted?: true;
|
|
52
56
|
/**
|
|
53
57
|
* 这组消息归属的请求 id(当前正在执行的 turn 的 requestId);
|
|
54
58
|
* `undefined` 表示无归属信息(drain 时按「当前也无归属」放行,退化为旧行为)。
|
|
@@ -40,6 +40,8 @@ export type PermissionResult = {
|
|
|
40
40
|
updatedPermissions?: PermissionUpdate[];
|
|
41
41
|
toolUseID?: string;
|
|
42
42
|
decisionClassification?: PermissionDecisionClassification;
|
|
43
|
+
/** Optional host response metadata; interpreted only by the requesting tool. */
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
43
45
|
} | {
|
|
44
46
|
behavior: 'deny';
|
|
45
47
|
message: string;
|
|
@@ -68,6 +70,8 @@ export interface CanUseToolOptions {
|
|
|
68
70
|
displayName?: string;
|
|
69
71
|
/** 桥端渲染的副标题说明。 */
|
|
70
72
|
description?: string;
|
|
73
|
+
/** Tool-provided display/context metadata for host permission UIs. Not an authorization grant. */
|
|
74
|
+
metadata?: Record<string, unknown>;
|
|
71
75
|
/** 本次工具调用在 assistant 消息内的唯一 id。 */
|
|
72
76
|
toolUseID: string;
|
|
73
77
|
/** 子代理上下文中触发时,子代理的 id。 */
|
|
@@ -32,6 +32,7 @@ export declare class SessionManagerImpl implements SessionManager, ApplicationLi
|
|
|
32
32
|
private skipHistoryContext;
|
|
33
33
|
private sessionStartTimes;
|
|
34
34
|
private addHistoryLocks;
|
|
35
|
+
private promptAdmissions;
|
|
35
36
|
private resultSubscriptions;
|
|
36
37
|
private readonly resultSubscriptionOwners;
|
|
37
38
|
/**
|
|
@@ -108,6 +109,7 @@ export declare class SessionManagerImpl implements SessionManager, ApplicationLi
|
|
|
108
109
|
private readonly loadedSessionIds;
|
|
109
110
|
private resetIdleTimer;
|
|
110
111
|
addHistory(session: Session, input: string | AgentInputItem[]): Promise<void>;
|
|
112
|
+
private writeHistory;
|
|
111
113
|
/**
|
|
112
114
|
* Record a UserPromptSubmit hook block as an in-band assistant message
|
|
113
115
|
* (issue #71907, cc-aligned: cc surfaces a warning system message and ends the
|
|
@@ -125,6 +127,34 @@ export declare class SessionManagerImpl implements SessionManager, ApplicationLi
|
|
|
125
127
|
* (use-message-sender). chalk=false because ACP does not strip ANSI codes.
|
|
126
128
|
*/
|
|
127
129
|
private recordHookBlockedMessage;
|
|
130
|
+
/**
|
|
131
|
+
* 把一条 mod 打出来的 `$.ui.log` 落到当前 session 的可见消息流里。
|
|
132
|
+
*
|
|
133
|
+
* ## 与 `recordHookBlockedMessage` 的关系
|
|
134
|
+
*
|
|
135
|
+
* 二者走**同一条落地路径**(history + inputSubject + combineSubject +
|
|
136
|
+
* sessionStore.appendHistory),因此 TUI / ACP / persisted transcript 都用
|
|
137
|
+
* 既有渲染,不必新增 sessionUpdate 类型(对齐根 CODEBUDDY.md 的 ACP 约束)。
|
|
138
|
+
*
|
|
139
|
+
* ## 与 hook 阻断消息刻意不同的三点
|
|
140
|
+
*
|
|
141
|
+
* 1. **不动 `session.lastMessageId`**:hook-block 是回合终点,需要挂上 replay
|
|
142
|
+
* 分支;mod-log 是**装饰性**通知,如果推进 lastMessageId 会让 `/rewind`
|
|
143
|
+
* 退到"一条 log 中间",语义混乱。
|
|
144
|
+
* 2. **不挂 `parentId`**:同样出于 replay 分支洁净。
|
|
145
|
+
* 3. **`chalk: false`**:ACP 侧不剥 ANSI,chalk 转义码会露出到 Web UI;此外
|
|
146
|
+
* 宿主已在 `<plugin>: <text>` 里给足了归属信号,terminal 也不再需要额外
|
|
147
|
+
* 颜色包装(TUI 侧后续可按 `hookStatus === 'mod-log'` 做专属渲染)。
|
|
148
|
+
*
|
|
149
|
+
* ## 失败语义
|
|
150
|
+
*
|
|
151
|
+
* 与 hook-block 同款:写盘失败只记日志,不向外抛 —— mod 打日志不该把 CLI 弄挂。
|
|
152
|
+
*
|
|
153
|
+
* @param session 目标 session(宿主取当前 session 后传入)
|
|
154
|
+
* @param text 已由宿主前缀成 `<plugin>: <text>` 的完整行文
|
|
155
|
+
* @param plugin 发起本次调用的 mod 名(`origin.plugin`),用于前端识别
|
|
156
|
+
*/
|
|
157
|
+
recordModLogMessage(session: Session, text: string, plugin: string): Promise<void>;
|
|
128
158
|
private readonly inflightSessionStarts;
|
|
129
159
|
emitSessionStart(session: Session, source: SessionStartSource): Promise<void>;
|
|
130
160
|
create(options?: Partial<Session>, needHandleRunResult?: boolean, parentSession?: Session): Promise<Session>;
|
|
@@ -1117,6 +1117,18 @@ export interface SessionManager {
|
|
|
1117
1117
|
* before injecting `additionalContext`.
|
|
1118
1118
|
*/
|
|
1119
1119
|
emitSessionStart(session: Session, source: SessionStartSource): Promise<void>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Record a mod-plugin `$.ui.log` line as a user-visible message on the
|
|
1122
|
+
* session transcript (mirrors `recordHookBlockedMessage` — same
|
|
1123
|
+
* inputSubject / combineSubject / sessionStore path — but leaves
|
|
1124
|
+
* `lastMessageId` and `parentId` untouched because mod logs are
|
|
1125
|
+
* decorative and must not become anchors on the replay branch).
|
|
1126
|
+
*
|
|
1127
|
+
* @param session target session (host resolves current session and passes it in)
|
|
1128
|
+
* @param text already prefixed as `<plugin>: <text>` by the host bridge
|
|
1129
|
+
* @param plugin the calling mod's name (`origin.plugin`), for provider metadata
|
|
1130
|
+
*/
|
|
1131
|
+
recordModLogMessage(session: Session, text: string, plugin: string): Promise<void>;
|
|
1120
1132
|
addHistory(session: Session, input: string | AgentInputItem[]): Promise<void>;
|
|
1121
1133
|
save(session: Session): Promise<void>;
|
|
1122
1134
|
/** Initialize an immutable full snapshot for a new fork; target must be absent or empty. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AcpTerminalStateItem, type AgentInputItem, type AssistantMessageItem, type CustomTitleItem, type FileHistorySnapshotItem, type FunctionCallItem, type FunctionCallResultItem, type HookBlockingDetail, HookEvent, type ResendForkNoticeItem, type UserMessageItem } from '../../../../cbc-shared/lib/node/index.js';
|
|
2
2
|
type ItemStatus = 'in_progress' | 'completed' | 'incomplete';
|
|
3
|
-
export type HookStatus = 'success' | 'blocked' | 'warning' | 'error';
|
|
3
|
+
export type HookStatus = 'success' | 'blocked' | 'warning' | 'error' | 'mod-log';
|
|
4
4
|
interface ItemOptions {
|
|
5
5
|
readonly skipRun?: boolean;
|
|
6
6
|
readonly status?: ItemStatus;
|
|
@@ -340,6 +340,7 @@ export declare enum ProductFeature {
|
|
|
340
340
|
SkillSecurityScan = "SkillSecurityScan",
|
|
341
341
|
SkillRecommend = "SkillRecommend",
|
|
342
342
|
BeforeConversationRecommend = "BeforeConversationRecommend",
|
|
343
|
+
AfterConversationRecommend = "AfterConversationRecommend",
|
|
343
344
|
/**
|
|
344
345
|
* 是否开启文本选择操作功能
|
|
345
346
|
*/
|
|
@@ -1420,6 +1421,21 @@ export declare enum ProductFeature {
|
|
|
1420
1421
|
* @default false
|
|
1421
1422
|
*/
|
|
1422
1423
|
EnableClawChannelControl = "EnableClawChannelControl",
|
|
1424
|
+
/**
|
|
1425
|
+
* 是否隐藏设置面板「助理设置 → 远程渠道」整个区块(含微信助理 / 企微机器人 /
|
|
1426
|
+
* QQ 机器人等通道卡片与定时任务企微 bot 推送卡片)。
|
|
1427
|
+
*
|
|
1428
|
+
* 仅隐藏 UI 入口,不影响「上下文管理」(Session Management)等其他区块。
|
|
1429
|
+
* 专享版(Cloud-Hosted)与私有化(Self-Hosted)定制渠道不支持远程助理渠道,
|
|
1430
|
+
* 在 workbuddy-custom base 的 productFeatures 配置 true(私有化构建自动继承);
|
|
1431
|
+
* 运行期也可经 /v3/config 下发覆盖(如放开某个已部署网关的租户)。
|
|
1432
|
+
*
|
|
1433
|
+
* - 旗舰版(标准渠道):不配置该 key → 不禁用,远程渠道照常展示(fail-open)
|
|
1434
|
+
* - 专享版 / 私有化:配置 true → 隐藏区块;缺省(未配置)同旗舰版展示
|
|
1435
|
+
*
|
|
1436
|
+
* @default false
|
|
1437
|
+
*/
|
|
1438
|
+
DisableClawRemoteChannels = "DisableClawRemoteChannels",
|
|
1423
1439
|
/**
|
|
1424
1440
|
* 是否启用 AI 代码入库率统计能力
|
|
1425
1441
|
*
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Application, ApplicationLifecycle } from '@celljs/core';
|
|
2
|
-
import { ProductManager } from '../../../product/lib/common/index.js';
|
|
2
|
+
import { ProductConfigurationContext, ProductManager } from '../../../product/lib/common/index.js';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { PromptProvider, PromptTemplate } from './prompt-protocol.js';
|
|
5
5
|
export declare class ProductPromptProvider implements PromptProvider, ApplicationLifecycle<Application> {
|
|
6
6
|
protected readonly productManager: ProductManager;
|
|
7
|
+
protected readonly executionConfiguration?: ProductConfigurationContext;
|
|
7
8
|
productTemplateSubject: BehaviorSubject<PromptTemplate[]>;
|
|
9
|
+
getScopedTemplates(): PromptTemplate[] | undefined;
|
|
8
10
|
initialize(): void;
|
|
9
11
|
}
|
|
@@ -39,6 +39,12 @@ export interface PromptManager {
|
|
|
39
39
|
}
|
|
40
40
|
export interface PromptProvider {
|
|
41
41
|
productTemplateSubject: BehaviorSubject<PromptTemplate[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Replace this provider's process templates for the current execution.
|
|
44
|
+
* undefined uses the process snapshot; [] explicitly supplies no templates.
|
|
45
|
+
* The result must never be published to the shared template map.
|
|
46
|
+
*/
|
|
47
|
+
getScopedTemplates?(): PromptTemplate[] | undefined;
|
|
42
48
|
}
|
|
43
49
|
export interface PromptEvaluator {
|
|
44
50
|
priority(context: PromptRenderContext): Promise<number>;
|