qlogicagent 2.18.6 → 2.18.8
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/agent.js +30 -30
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -0
- package/dist/index.js +538 -528
- package/dist/orchestration.js +4 -4
- package/dist/permissions.js +1 -1
- package/dist/plugin-marketplace-compute.js +1 -0
- package/dist/protocol.js +1 -1
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +4 -4
- package/dist/tunables.js +1 -0
- package/dist/types/agent/runtime-vars.d.ts +1 -2
- package/dist/types/agent/tool-loop.d.ts +6 -0
- package/dist/types/agent/tool-loop.test-harness.d.ts +20 -0
- package/dist/types/agent/types.d.ts +2 -0
- package/dist/types/cli/acp-extended-handlers.d.ts +7 -0
- package/dist/types/cli/acp-extended-host-adapter.d.ts +2 -0
- package/dist/types/cli/acp-session-host.d.ts +15 -2
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/community-skill-installer.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +4 -0
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/config-tool-service.d.ts +7 -5
- package/dist/types/cli/default-project-bootstrap.d.ts +1 -0
- package/dist/types/cli/handlers/agents-handler.d.ts +4 -1
- package/dist/types/cli/handlers/community-handler.d.ts +2 -0
- package/dist/types/cli/handlers/config-handler.d.ts +2 -15
- package/dist/types/cli/handlers/pet-handler.d.ts +3 -2
- package/dist/types/cli/handlers/session-handler.d.ts +1 -1
- package/dist/types/cli/handlers/skills-handler.d.ts +12 -10
- package/dist/types/cli/handlers/solo-handler.d.ts +3 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +47 -33
- package/dist/types/cli/handlers/workflow-handler.d.ts +6 -0
- package/dist/types/cli/mcp-bootstrap.d.ts +0 -2
- package/dist/types/cli/media-inline.d.ts +14 -0
- package/dist/types/cli/media-understanding.d.ts +65 -8
- package/dist/types/cli/memory-coordinator.d.ts +8 -0
- package/dist/types/cli/multi-agent-handler-host.d.ts +2 -0
- package/dist/types/cli/permission-bootstrap.d.ts +2 -0
- package/dist/types/cli/pet-runtime.d.ts +0 -1
- package/dist/types/cli/plugin-bootstrap.d.ts +2 -1
- package/dist/types/cli/product-coordinator.d.ts +4 -1
- package/dist/types/cli/rpc-registry.d.ts +1 -3
- package/dist/types/cli/runtime-watcher-bootstrap.d.ts +0 -2
- package/dist/types/cli/session-context.d.ts +4 -2
- package/dist/types/cli/skill-invocation-service.d.ts +2 -0
- package/dist/types/cli/skill-tools-bootstrap.d.ts +2 -0
- package/dist/types/cli/skills-query-service.d.ts +2 -1
- package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +9 -0
- package/dist/types/cli/stdio-acp-request-host.d.ts +11 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -1
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +6 -0
- package/dist/types/cli/stdio-runtime-services.d.ts +6 -1
- package/dist/types/cli/stdio-server.d.ts +33 -4
- package/dist/types/cli/task-distillation-coordinator.d.ts +9 -4
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +3 -0
- package/dist/types/cli/tool-bootstrap-media-registration.d.ts +10 -0
- package/dist/types/cli/tool-bootstrap-web-registration.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap.d.ts +9 -0
- package/dist/types/cli/turn-core.d.ts +2 -0
- package/dist/types/cli/turn-preview-browser-setup.d.ts +15 -0
- package/dist/types/cli/turn-project-router.d.ts +1 -1
- package/dist/types/cli/workflow-host-adapter.d.ts +2 -0
- package/dist/types/contracts/structured-planner.d.ts +2 -0
- package/dist/types/host-contract/index.d.ts +1475 -0
- package/dist/types/host-contract/project-id.d.ts +5 -0
- package/dist/types/host-contract/provider-profile.d.ts +46 -0
- package/dist/types/orchestration/agent-instance.d.ts +6 -0
- package/dist/types/orchestration/delegation-coordinator.d.ts +40 -0
- package/dist/types/orchestration/goal-mode-adapters.d.ts +3 -0
- package/dist/types/orchestration/product-planner.d.ts +3 -0
- package/dist/types/orchestration/solo-evaluator.d.ts +19 -5
- package/dist/types/orchestration/solo-persistence.d.ts +2 -0
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +4 -0
- package/dist/types/permissions.d.ts +2 -0
- package/dist/types/protocol/methods.d.ts +0 -199
- package/dist/types/protocol/wire/acp-protocol.d.ts +16 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +1 -173
- package/dist/types/protocol/wire/chat-types.d.ts +6 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +13 -3
- package/dist/types/runtime/execution/dream-agent.d.ts +9 -8
- package/dist/types/runtime/infra/agent-paths.d.ts +3 -3
- package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +1 -1
- package/dist/types/runtime/infra/clixml-sanitize.d.ts +16 -0
- package/dist/types/runtime/infra/external-agent-approvals.d.ts +18 -0
- package/dist/types/runtime/infra/feedback-distillation.d.ts +3 -1
- package/dist/types/runtime/infra/feedback-host-authority.d.ts +4 -0
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +2 -13
- package/dist/types/runtime/infra/model-registry.d.ts +3 -1
- package/dist/types/runtime/infra/project-authority-facade.d.ts +11 -0
- package/dist/types/runtime/infra/project-host-authority.d.ts +10 -0
- package/dist/types/runtime/ports/memory-provider.d.ts +11 -7
- package/dist/types/runtime/ports/tool-contracts.d.ts +2 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +2 -2
- package/dist/types/runtime/session/session-persistence.d.ts +29 -10
- package/dist/types/runtime/session/session-recovery.d.ts +4 -0
- package/dist/types/runtime/session/session-summary.d.ts +3 -1
- package/dist/types/runtime/session/session-transcript-store.d.ts +7 -0
- package/dist/types/skills/memory/host-memory-provider.d.ts +148 -0
- package/dist/types/skills/memory/local-memory-provider.d.ts +19 -10
- package/dist/types/skills/memory/task-distillation.d.ts +6 -0
- package/dist/types/skills/plugins/plugin-marketplace.d.ts +23 -57
- package/dist/types/skills/tools/media-understand-tool.d.ts +28 -0
- package/dist/types/skills/tools/preview-browser-tool.d.ts +136 -0
- package/dist/types/skills/tools/shell/task-output.d.ts +10 -1
- package/dist/types/skills/tools/skill-tool.d.ts +1 -1
- package/dist/types/skills/web-search/brave-source.d.ts +2 -1
- package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +3 -2
- package/dist/types/skills/web-search/exa-source.d.ts +2 -1
- package/dist/types/skills/web-search/search-svc-source.d.ts +4 -3
- package/dist/types/skills/web-search/searxng-source.d.ts +3 -1
- package/dist/types/skills/web-search/serper-source.d.ts +2 -1
- package/dist/types/skills/web-search/source-factory.d.ts +2 -1
- package/dist/types/skills/web-search/web-tunable-resolver.d.ts +16 -0
- package/dist/types/test-support/global-home-setup.d.ts +2 -0
- package/dist/types/transport/acp-server.d.ts +29 -0
- package/dist/types/transport/delegate-client.d.ts +82 -0
- package/dist/types/transport/host-capability-client.d.ts +21 -0
- package/dist/types/transport/host-feedback-client.d.ts +25 -0
- package/dist/types/transport/host-profile-client.d.ts +19 -0
- package/dist/types/transport/host-project-client.d.ts +16 -0
- package/dist/types/transport/host-request-client.d.ts +38 -0
- package/dist/types/transport/host-session-client.d.ts +29 -0
- package/dist/types/tunables.d.ts +2 -0
- package/package.json +26 -3
- package/dist/types/cli/handlers/settings-handler.d.ts +0 -19
- package/dist/types/cli/permission-rule-persistence.d.ts +0 -16
- package/dist/types/cli/tunable-store.d.ts +0 -26
- package/dist/types/skills/permissions/settings-watcher.d.ts +0 -26
- /package/dist/types/{skills/memory → host-contract}/fts-segment.d.ts +0 -0
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { Transport } from "./io-transport.js";
|
|
20
20
|
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionNewParams, type AcpSessionLoadParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionCloseParams, type AcpSessionSetConfigParams, type AcpSessionUpdateType, type AcpPermissionRequestParams, type AcpPermissionRequestResult } from "../protocol/wire/index.js";
|
|
21
|
+
import { DelegateClient } from "./delegate-client.js";
|
|
22
|
+
import type { HostRequestClient } from "./host-request-client.js";
|
|
23
|
+
import { type HostRequestService } from "../host-contract/index.js";
|
|
21
24
|
export declare const ACP_ERROR_CODES: {
|
|
22
25
|
readonly PARSE_ERROR: -32700;
|
|
23
26
|
readonly INVALID_REQUEST: -32600;
|
|
@@ -109,6 +112,8 @@ export interface AcpRequestHandler {
|
|
|
109
112
|
}
|
|
110
113
|
export interface AcpServerConfig {
|
|
111
114
|
verbose?: boolean;
|
|
115
|
+
/** Coordinator-owned unary host client used only for response claiming here. */
|
|
116
|
+
hostRequestClient?: HostRequestClient;
|
|
112
117
|
}
|
|
113
118
|
/**
|
|
114
119
|
* AcpServermanages the ACP protocol state machine.
|
|
@@ -130,12 +135,24 @@ export declare class AcpServer {
|
|
|
130
135
|
private hostSupportsExtendedEvents;
|
|
131
136
|
/** Whether the host supports x/ extended RPC methods */
|
|
132
137
|
private hostSupportsExtendedMethods;
|
|
138
|
+
/** T9(S3a):host 是否在 initialize 声明服务 gateway-routed delegate(x/delegate 族;设计 §2.4)。 */
|
|
139
|
+
private hostSupportsDelegate;
|
|
140
|
+
/** Exact host-request capability negotiated during initialize. */
|
|
141
|
+
private negotiatedHostRequestCapability;
|
|
133
142
|
/** Sessions registered via session/new on this connection (multi-session per connection). */
|
|
134
143
|
private registeredSessions;
|
|
135
144
|
/** Pending permission requests (agent -> host) waiting for response */
|
|
136
145
|
private pendingPermissions;
|
|
137
146
|
/** Map from outbound JSON-RPC request id -> permissionId for response matching */
|
|
138
147
|
private outboundRequestMap;
|
|
148
|
+
/**
|
|
149
|
+
* S3a 跨进程 delegate 客户端(泛化本类的 outbound-request 底座;设计 §5.1)。与审批 outboundRequestMap
|
|
150
|
+
* 并存:x/delegate 用 `del-*` rpc id,审批用 `perm-*`,handleResponse 先问 delegate 再落审批,互不干扰。
|
|
151
|
+
* S3c 接线点:DelegationCoordinator.delegate() 改经 `server.delegate.delegate(...)`(本 S3a 只建能力+测,不切)。
|
|
152
|
+
*/
|
|
153
|
+
private readonly delegateClient;
|
|
154
|
+
/** Coordinator-owned client reference; AcpServer only offers its response-claim seam. */
|
|
155
|
+
private readonly hostRequestClient?;
|
|
139
156
|
constructor(transport: Transport, handler: AcpRequestHandler, config?: AcpServerConfig);
|
|
140
157
|
/**
|
|
141
158
|
* Route an incoming raw message through ACP protocol handling.
|
|
@@ -164,6 +181,18 @@ export declare class AcpServer {
|
|
|
164
181
|
get supportsExtendedEvents(): boolean;
|
|
165
182
|
/** Whether the host supports extended methods */
|
|
166
183
|
get supportsExtendedMethods(): boolean;
|
|
184
|
+
/** T9(S3a):host 是否声明服务 gateway-routed delegate(gate;设计 §2.4)。 */
|
|
185
|
+
get supportsDelegate(): boolean;
|
|
186
|
+
/** Exact service check over the initialize capability; no boolean/prefix fallback. */
|
|
187
|
+
supportsHostRequestService(service: HostRequestService): boolean;
|
|
188
|
+
/** Capability snapshot consumed by the coordinator-owned HostRequestClient. */
|
|
189
|
+
get hostRequestCapability(): unknown;
|
|
190
|
+
/**
|
|
191
|
+
* S3a 跨进程 delegate 客户端(leader 侧接缝)。S3c 接线:DelegationCoordinator.delegate() 改为
|
|
192
|
+
* 铸 delegationId → `server.delegate.delegate({delegationId,to,input,session,opts}, sink)` 上行 x/delegate、
|
|
193
|
+
* 消费 x/delegate.update 下行喂规划环/RunStateStore(delegation-coordinator.ts:87 复用点)。本 S3a 只交付+测,不切。
|
|
194
|
+
*/
|
|
195
|
+
get delegate(): DelegateClient;
|
|
167
196
|
/** Whether a session id has been registered via session/new on this connection. */
|
|
168
197
|
hasSession(sessionId: string): boolean;
|
|
169
198
|
private handleRequest;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DelegateClient —— qlogicagent(leader)侧的跨进程 delegate 传输客户端(S3a lane impl-transport-qla)。
|
|
3
|
+
*
|
|
4
|
+
* 契约单一事实源:host-contract §12 DelegateWire(冻结,严禁本文件自改契约)。
|
|
5
|
+
* 设计单一事实源:docs/agent-supervision-s3a-transport-design.md(§3 帧 / §4 保序背压取消失败 / §5.1 两端职责)。
|
|
6
|
+
*
|
|
7
|
+
* 方向倒置(设计 §1):今天 qlogicagent→gateway 唯一 outbound 请求 = session/request_permission
|
|
8
|
+
* (acp-server.ts:247 requestPermission)。本客户端泛化该 outbound-request 底座,新增:
|
|
9
|
+
* - `x/delegate`(agent→host 请求,有 id,resolve TurnResult)—— leader 请网关代派一个 worker 回合。
|
|
10
|
+
* - `x/delegate.update`(host→agent 通知,回流帧)—— 消费 worker 的 SupervisorEventSink 事件喂 leader。
|
|
11
|
+
* - `x/delegate.respond` / `x/delegate.cancel`(agent→host 通知)—— 审批应答 / 取消。
|
|
12
|
+
*
|
|
13
|
+
* 不变式落点(设计 §6,注释标 T 号):
|
|
14
|
+
* T3/T6 消费方 seq 单调连续校验(跳号=丢帧/乱序,fail-loud);
|
|
15
|
+
* T5 请求无客户端硬超时(回合可跑数分钟;挂死靠 gateway 判活 + 下行 lifecycle 暴露,不靠客户端计时);
|
|
16
|
+
* T7 结构化 error 保结构(code + data.diagnostics,禁裸串);
|
|
17
|
+
* T9 capability 握手 gate:host 未声明 delegate 能力则拒发 x/delegate(fail-loud,不静默降级);
|
|
18
|
+
* E1/R1 每帧带权威 member(=to.handle);leader 断言帧 member 与请求一致(不等=路由漂移,fail-loud)。
|
|
19
|
+
*
|
|
20
|
+
* 纪律:fail-loud(丢帧/漂移/gate 未过一律炸,不静默);单轨(delegationId 唯一关联主键,无第二关联轴);零 mock。
|
|
21
|
+
*/
|
|
22
|
+
import { type DelegateCancelParams, type DelegateRequestParams, type DelegateRespondParams, type DelegateUpdateFrame, type SupervisorEventSink, type TurnResult } from "../host-contract/index.js";
|
|
23
|
+
import type { AcpJsonRpcNotification, AcpJsonRpcRequest, AcpJsonRpcResponse } from "../protocol/wire/index.js";
|
|
24
|
+
/** 结构化 JSON-RPC error(保留 code + data;T7)。 */
|
|
25
|
+
export type DelegateRpcError = Error & {
|
|
26
|
+
code?: number;
|
|
27
|
+
data?: unknown;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 传输底座(由 AcpServer 注入):把帧写到与 gateway 的 ACP/stdio 双向连接(T1 单通道),
|
|
31
|
+
* 并暴露 T9 gate(host 是否在 initialize 声明了 delegate 能力位)。
|
|
32
|
+
*/
|
|
33
|
+
export interface DelegateClientTransport {
|
|
34
|
+
/** 发一帧(请求或通知)到 host(复用现有 ACP/stdio 连接;不开第二通道,T1)。 */
|
|
35
|
+
send(msg: AcpJsonRpcRequest | AcpJsonRpcNotification): void;
|
|
36
|
+
/** T9:host 是否在 initialize 声明服务 delegate(否则拒发 x/delegate,fail-loud,不静默降级)。 */
|
|
37
|
+
hostSupportsDelegate(): boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface DelegateClientOptions {
|
|
40
|
+
/** 结构化日志出口(默认 stderr;绝不含 prompt/凭据明文)。 */
|
|
41
|
+
log?: (line: string) => void;
|
|
42
|
+
}
|
|
43
|
+
export declare class DelegateClient {
|
|
44
|
+
private readonly transport;
|
|
45
|
+
/** rpc id → 在飞 delegation(x/delegate 终态响应按此匹配)。 */
|
|
46
|
+
private readonly byRpcId;
|
|
47
|
+
/** delegationId → 在飞 delegation(x/delegate.update 回流帧按此路由;本地唯一性去重)。 */
|
|
48
|
+
private readonly byDelegationId;
|
|
49
|
+
private readonly log;
|
|
50
|
+
constructor(transport: DelegateClientTransport, options?: DelegateClientOptions);
|
|
51
|
+
/**
|
|
52
|
+
* 发 `x/delegate` 请求(agent→host),resolve 出最终 TurnResult。回流事件经 sink 喂 leader。
|
|
53
|
+
* 【请求即隐式订阅】(设计 §3.1):gateway 收到即开始把该 delegation 的 sink 事件泵成 x/delegate.update
|
|
54
|
+
* 下行,本客户端按 delegationId 路由到传入 sink。**无客户端硬超时**(T5:回合可跑数分钟)。
|
|
55
|
+
*/
|
|
56
|
+
delegate(params: DelegateRequestParams, sink: SupervisorEventSink): Promise<TurnResult>;
|
|
57
|
+
/** 发 `x/delegate.respond`(leader 来源审批应答;通知,fire-and-forget)。optionId 不透明透传(E2)。 */
|
|
58
|
+
respond(params: DelegateRespondParams): void;
|
|
59
|
+
/** 发 `x/delegate.cancel`(取消回合,不杀进程;通知)。终态由 gateway 保证下行显式 cancelled(E3)。 */
|
|
60
|
+
cancel(params: DelegateCancelParams): void;
|
|
61
|
+
/** 是否有该 delegationId 在飞(观测/测试用)。 */
|
|
62
|
+
has(delegationId: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* AcpServer.handleResponse 优先问本客户端是否认领该 rpc 响应(x/delegate 终态)。
|
|
65
|
+
* 返回 true=已认领并处理;false=非 delegate 响应(调用方继续走审批映射)。
|
|
66
|
+
*/
|
|
67
|
+
handleResponse(msg: AcpJsonRpcResponse): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* AcpServer.handleNotification 收到 `x/delegate.update` 回流帧时调用。
|
|
70
|
+
* T3/T6 seq 单调连续校验(跳号=丢帧/乱序,fail-loud reject 该 delegation);
|
|
71
|
+
* E1/R1 member 断言(帧 member 必须 = 请求的 to.handle,不等=路由漂移,fail-loud);
|
|
72
|
+
* 反序列化 event → 本地 sink 回调(1:1 无损镜像,设计 §3.2)。
|
|
73
|
+
*/
|
|
74
|
+
handleUpdate(frame: DelegateUpdateFrame): void;
|
|
75
|
+
/** 连接关闭/重生:拒绝全部在飞 delegation(禁悬挂;调用方据 reject 决定重派)。 */
|
|
76
|
+
dispose(reason?: string): void;
|
|
77
|
+
/** 帧 → 本地 SupervisorEventSink 回调(去 member 的 event 重新盖回权威 frame.member,1:1 无损)。 */
|
|
78
|
+
private dispatchToSink;
|
|
79
|
+
private forget;
|
|
80
|
+
private settleResolve;
|
|
81
|
+
private settleReject;
|
|
82
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Thin, read-only Capability facade over the coordinator-owned HostRequestClient. */
|
|
2
|
+
import { type HostCapabilityRequestParams, type HostApplyCuratorPlanResult, type HostCuratorTransition, type HostFinalizeSkillInstallResult, type HostPrepareSkillInstallParams, type HostPrepareSkillInstallResult, type HostSkillFileResponse, type HostSkillInvocationResult, type HostSkillMutation, type HostSkillMutationResult, type HostSkillSnapshotResponse } from "../host-contract/index.js";
|
|
3
|
+
export interface HostCapabilityRequester {
|
|
4
|
+
request(params: HostCapabilityRequestParams): Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface HostCapabilityClientConfig {
|
|
7
|
+
client: HostCapabilityRequester;
|
|
8
|
+
}
|
|
9
|
+
export declare class HostCapabilityClient {
|
|
10
|
+
private readonly config;
|
|
11
|
+
constructor(config: HostCapabilityClientConfig);
|
|
12
|
+
getSkillSnapshot(projectId?: string, knownRevision?: string): Promise<HostSkillSnapshotResponse>;
|
|
13
|
+
readSkillFile(name: string, relativePath?: string, expectedRevision?: string): Promise<HostSkillFileResponse>;
|
|
14
|
+
recordSkillInvocation(name: string, success: boolean): Promise<HostSkillInvocationResult>;
|
|
15
|
+
commitSkillMutation<T extends HostSkillMutation>(mutation: T): Promise<Extract<HostSkillMutationResult, {
|
|
16
|
+
kind: T["kind"];
|
|
17
|
+
}>>;
|
|
18
|
+
applyCuratorPlan(expectedRevision: string, transitions: HostCuratorTransition[]): Promise<HostApplyCuratorPlanResult>;
|
|
19
|
+
prepareSkillInstall(params: HostPrepareSkillInstallParams): Promise<HostPrepareSkillInstallResult>;
|
|
20
|
+
finalizeSkillInstall(installationId: string, action: "adopt" | "discard"): Promise<HostFinalizeSkillInstallResult>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Thin D2 feedback/telemetry facade over the coordinator-owned HostRequestClient. */
|
|
2
|
+
import { type HostDistillableFeedbackEvent, type HostFeedbackRequestParams, type HostFeedbackSweepResult } from "../host-contract/index.js";
|
|
3
|
+
export interface HostFeedbackRequester {
|
|
4
|
+
request(params: HostFeedbackRequestParams): Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare class HostFeedbackClient {
|
|
7
|
+
private readonly config;
|
|
8
|
+
constructor(config: {
|
|
9
|
+
client: HostFeedbackRequester;
|
|
10
|
+
});
|
|
11
|
+
commitTurnTelemetry(params: Extract<HostFeedbackRequestParams, {
|
|
12
|
+
method: "commitTurnTelemetry";
|
|
13
|
+
}>["params"]): Promise<{
|
|
14
|
+
ok: true;
|
|
15
|
+
}>;
|
|
16
|
+
listDistillableFeedback(projectId: string): Promise<HostDistillableFeedbackEvent[]>;
|
|
17
|
+
markFeedbackDistilled(projectId: string, turnId: string, info: {
|
|
18
|
+
clusterKey: string;
|
|
19
|
+
idempotencyKey: string;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
ok: true;
|
|
22
|
+
updated: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
runUploadSweep(projectId: string): Promise<HostFeedbackSweepResult>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin profile facade over the coordinator-owned HostRequestClient.
|
|
3
|
+
* It owns no transport, request ids, timers, or pending table.
|
|
4
|
+
*/
|
|
5
|
+
import type { HostProfileRequestParams } from "../host-contract/index.js";
|
|
6
|
+
export interface HostProfileRequester {
|
|
7
|
+
request(params: HostProfileRequestParams): Promise<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface HostProfileClientConfig {
|
|
10
|
+
client: HostProfileRequester;
|
|
11
|
+
}
|
|
12
|
+
export declare class HostProfileClient {
|
|
13
|
+
private readonly config;
|
|
14
|
+
constructor(config: HostProfileClientConfig);
|
|
15
|
+
getTunables(): Promise<Record<string, unknown>>;
|
|
16
|
+
updateTunable(key: string, value: unknown): Promise<void>;
|
|
17
|
+
clearTunable(key: string): Promise<void>;
|
|
18
|
+
appendDirectoryAllowRule(pathPrefix: string): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Thin project-registry facade over the coordinator-owned HostRequestClient. */
|
|
2
|
+
import { type HostProjectInfo, type HostProjectMutationResult, type HostProjectRequestParams, type HostProjectSnapshotResult } from "../host-contract/index.js";
|
|
3
|
+
export interface HostProjectRequester {
|
|
4
|
+
request(params: HostProjectRequestParams): Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare class HostProjectClient {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: HostProjectRequester);
|
|
9
|
+
getSnapshot(): Promise<HostProjectSnapshotResult>;
|
|
10
|
+
create(params: Extract<HostProjectRequestParams, {
|
|
11
|
+
method: "create";
|
|
12
|
+
}>["params"]): Promise<HostProjectMutationResult>;
|
|
13
|
+
switch(projectIdOrQuery: string): Promise<HostProjectMutationResult>;
|
|
14
|
+
update(projectId: string, patch: Partial<Pick<HostProjectInfo, "planStatus" | "planAgents" | "planWinnerId" | "leaderSessionId" | "primaryWorkflowId">>): Promise<HostProjectMutationResult>;
|
|
15
|
+
private mutation;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unary agent-to-host request client over the existing ACP/stdio transport.
|
|
3
|
+
* Memory/profile requests have no implicit timeout; callers with bounded work
|
|
4
|
+
* (notably preview) provide a per-request timeout explicitly.
|
|
5
|
+
*/
|
|
6
|
+
import { type HostRequestParams } from "../host-contract/index.js";
|
|
7
|
+
import type { AcpJsonRpcNotification, AcpJsonRpcRequest, AcpJsonRpcResponse } from "../protocol/wire/index.js";
|
|
8
|
+
export type HostRequestRpcError = Error & {
|
|
9
|
+
code?: number;
|
|
10
|
+
data?: unknown;
|
|
11
|
+
};
|
|
12
|
+
export interface HostRequestClientTransport {
|
|
13
|
+
send(msg: AcpJsonRpcRequest | AcpJsonRpcNotification): void;
|
|
14
|
+
hostRequestCapability(): unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface HostRequestClientOptions {
|
|
17
|
+
log?: (line: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface HostRequestOptions {
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
export declare class HostRequestClient {
|
|
24
|
+
private readonly transport;
|
|
25
|
+
private readonly byRpcId;
|
|
26
|
+
private readonly log;
|
|
27
|
+
private disposedReason;
|
|
28
|
+
constructor(transport: HostRequestClientTransport, options?: HostRequestClientOptions);
|
|
29
|
+
request(params: HostRequestParams, opts?: HostRequestOptions): Promise<unknown>;
|
|
30
|
+
get pendingCount(): number;
|
|
31
|
+
handleResponse(msg: AcpJsonRpcResponse): boolean;
|
|
32
|
+
/** Cancel only one service lane; preview follows turn cancellation while durable store work does not. */
|
|
33
|
+
cancelByService(service: HostRequestParams["service"], reason?: string): void;
|
|
34
|
+
dispose(reason?: string): void;
|
|
35
|
+
private cleanup;
|
|
36
|
+
private settleResolve;
|
|
37
|
+
private settleReject;
|
|
38
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Thin Session persistence facade over the coordinator-owned HostRequestClient. */
|
|
2
|
+
import { type HostSessionAppendResult, type HostSessionGroupSplitResult, type HostSessionLoadForResumeResult, type HostSessionMutationResult, type HostSessionRequestParams } from "../host-contract/index.js";
|
|
3
|
+
export interface HostSessionRequester {
|
|
4
|
+
request(params: HostSessionRequestParams): Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface HostSessionClientConfig {
|
|
7
|
+
client: HostSessionRequester;
|
|
8
|
+
}
|
|
9
|
+
type AppendParams = Extract<HostSessionRequestParams, {
|
|
10
|
+
method: "appendTranscript";
|
|
11
|
+
}>["params"];
|
|
12
|
+
type StateUsage = Extract<HostSessionRequestParams, {
|
|
13
|
+
method: "saveState";
|
|
14
|
+
}>["params"]["usage"];
|
|
15
|
+
type SplitParams = Extract<HostSessionRequestParams, {
|
|
16
|
+
method: "groupSplit";
|
|
17
|
+
}>["params"];
|
|
18
|
+
export declare class HostSessionClient {
|
|
19
|
+
private readonly config;
|
|
20
|
+
constructor(config: HostSessionClientConfig);
|
|
21
|
+
loadForResume(sessionId: string, projectId?: string, includeMessages?: boolean): Promise<HostSessionLoadForResumeResult>;
|
|
22
|
+
appendTranscript(params: AppendParams): Promise<HostSessionAppendResult>;
|
|
23
|
+
updateTitle(sessionId: string, operationId: string, title: string): Promise<HostSessionMutationResult>;
|
|
24
|
+
saveState(sessionId: string, turnId: string, operationId: string, usage: StateUsage, model?: string): Promise<HostSessionMutationResult>;
|
|
25
|
+
saveTaskSummary(sessionId: string, operationId: string, summary: string, generatedAtTurn: number): Promise<HostSessionMutationResult>;
|
|
26
|
+
groupSplit(sessionId: string, operationId: string, reason: SplitParams["reason"], cas?: Pick<SplitParams, "expectedLastActiveAt" | "expectedTurnCount">): Promise<HostSessionGroupSplitResult>;
|
|
27
|
+
private mutation;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.8",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,9 +32,21 @@
|
|
|
32
32
|
"types": "./dist/types/permissions.d.ts",
|
|
33
33
|
"default": "./dist/permissions.js"
|
|
34
34
|
},
|
|
35
|
+
"./tunables": {
|
|
36
|
+
"types": "./dist/types/tunables.d.ts",
|
|
37
|
+
"default": "./dist/tunables.js"
|
|
38
|
+
},
|
|
35
39
|
"./pet-contracts": {
|
|
36
40
|
"types": "./dist/types/pet-contracts.d.ts",
|
|
37
41
|
"default": "./dist/pet-contracts.js"
|
|
42
|
+
},
|
|
43
|
+
"./host-contract": {
|
|
44
|
+
"types": "./dist/types/host-contract/index.d.ts",
|
|
45
|
+
"default": "./dist/host-contract.js"
|
|
46
|
+
},
|
|
47
|
+
"./plugin-marketplace-compute": {
|
|
48
|
+
"types": "./dist/types/skills/plugins/plugin-marketplace.d.ts",
|
|
49
|
+
"default": "./dist/plugin-marketplace-compute.js"
|
|
38
50
|
}
|
|
39
51
|
},
|
|
40
52
|
"files": [
|
|
@@ -57,8 +69,17 @@
|
|
|
57
69
|
"permissions": [
|
|
58
70
|
"./dist/types/permissions.d.ts"
|
|
59
71
|
],
|
|
72
|
+
"tunables": [
|
|
73
|
+
"./dist/types/tunables.d.ts"
|
|
74
|
+
],
|
|
60
75
|
"pet-contracts": [
|
|
61
76
|
"./dist/types/pet-contracts.d.ts"
|
|
77
|
+
],
|
|
78
|
+
"host-contract": [
|
|
79
|
+
"./dist/types/host-contract/index.d.ts"
|
|
80
|
+
],
|
|
81
|
+
"plugin-marketplace-compute": [
|
|
82
|
+
"./dist/types/skills/plugins/plugin-marketplace.d.ts"
|
|
62
83
|
]
|
|
63
84
|
}
|
|
64
85
|
},
|
|
@@ -70,7 +91,7 @@
|
|
|
70
91
|
"start": "node dist/cli.js",
|
|
71
92
|
"test": "vitest run",
|
|
72
93
|
"test:replay": "vitest run benchmarks/transcript-replay",
|
|
73
|
-
"check": "pnpm run check:encoding-corruption && pnpm run check:mechanical-rules && pnpm run check:windows-hide && tsc --noEmit && pnpm test && pnpm run check:architecture-boundaries && pnpm run check:provider-core-boundary && pnpm run check:provider-core-release-sync && pnpm run check:pet-core-boundary && pnpm run check:workspace-hygiene && pnpm run check:package-artifact",
|
|
94
|
+
"check": "pnpm run check:encoding-corruption && pnpm run check:mechanical-rules && pnpm run check:windows-hide && tsc --noEmit && pnpm test && pnpm run check:architecture-boundaries && pnpm run check:route-a-teardown && pnpm run check:transcript-tool-persistence && pnpm run check:provider-core-boundary && pnpm run check:provider-core-release-sync && pnpm run check:pet-core-boundary && pnpm run check:workspace-hygiene && pnpm run check:package-artifact",
|
|
74
95
|
"test:watch": "vitest",
|
|
75
96
|
"benchmark:hermes-superiority": "tsx benchmarks/hermes-superiority/runner.ts",
|
|
76
97
|
"lint": "oxlint .",
|
|
@@ -78,6 +99,8 @@
|
|
|
78
99
|
"check:mechanical-rules": "node scripts/check-mechanical-rules.mjs",
|
|
79
100
|
"check:windows-hide": "node scripts/check-windows-hide.mjs src",
|
|
80
101
|
"check:architecture-boundaries": "node scripts/check-architecture-boundaries.mjs",
|
|
102
|
+
"check:route-a-teardown": "node scripts/check-route-a-teardown.mjs",
|
|
103
|
+
"check:transcript-tool-persistence": "node scripts/check-transcript-tool-persistence.mjs",
|
|
81
104
|
"check:provider-core-boundary": "node scripts/check-provider-core-boundary.mjs",
|
|
82
105
|
"check:provider-core-release-sync": "node scripts/check-provider-core-release-sync.mjs",
|
|
83
106
|
"check:pet-core-boundary": "node scripts/check-pet-core-boundary.mjs",
|
|
@@ -96,7 +119,7 @@
|
|
|
96
119
|
"@agentclientprotocol/sdk": "^0.25.0",
|
|
97
120
|
"@napi-rs/canvas": "0.1.100",
|
|
98
121
|
"@xiaozhiclaw/pet-core": "0.1.3",
|
|
99
|
-
"@xiaozhiclaw/provider-core": "^0.1.
|
|
122
|
+
"@xiaozhiclaw/provider-core": "^0.1.25",
|
|
100
123
|
"better-sqlite3": "^12.10.0",
|
|
101
124
|
"dotenv": "^17.3.1",
|
|
102
125
|
"ioredis": "^5.11.1",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type AgentRpcError, type AgentRpcRequest } from "../../protocol/wire/index.js";
|
|
2
|
-
export interface SettingsHandlerHost {
|
|
3
|
-
sendError?(id: string | number, code: number, message: string): void;
|
|
4
|
-
sendResponse(id: string | number, result?: unknown, error?: AgentRpcError): void;
|
|
5
|
-
writeClipboard?(text: string): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare function handleSettingsListProviders(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
8
|
-
export declare function handleSettingsAddKey(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
9
|
-
export declare function handleSettingsRemoveKey(this: SettingsHandlerHost, msg: AgentRpcRequest): void;
|
|
10
|
-
export declare function handleSettingsGetKey(this: SettingsHandlerHost, msg: AgentRpcRequest): void;
|
|
11
|
-
export declare function handleSettingsCopyKey(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
12
|
-
export declare function handleSettingsToggleKey(this: SettingsHandlerHost, msg: AgentRpcRequest): void;
|
|
13
|
-
export declare function handleSettingsToggleModel(this: SettingsHandlerHost, msg: AgentRpcRequest): void;
|
|
14
|
-
export declare function handleSettingsListModels(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
15
|
-
export declare function handleSettingsSetActiveModel(this: SettingsHandlerHost, msg: AgentRpcRequest): void;
|
|
16
|
-
export declare function handleSettingsGetActiveModel(this: SettingsHandlerHost, msg: AgentRpcRequest): void;
|
|
17
|
-
export declare function handleSettingsGetOverview(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
18
|
-
export declare function handleSettingsRefreshModels(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
19
|
-
export declare function handleSettingsValidateKey(this: SettingsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persist "始终允许此文件夹" approvals into the USER-level settings.json
|
|
3
|
-
* (`~/.qlogicagent/profiles/<owner>/settings.json` → permissions.rules).
|
|
4
|
-
*
|
|
5
|
-
* Same file config.update writes and the settings-watcher's user layer reads,
|
|
6
|
-
* so a persisted rule survives restarts via loadInitialSettings/watchSettings.
|
|
7
|
-
* turn-permission-sync leaves rules alone when a frame carries only `{ mode }`,
|
|
8
|
-
* so desktop turns cannot wipe these entries.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Append an allow rule for `pathPrefix` to the user settings, preserving the rest
|
|
12
|
-
* of the file. Idempotent: an existing allow rule with the same prefix is kept as-is.
|
|
13
|
-
*/
|
|
14
|
-
export declare function persistUserDirectoryAllowRule(rule: {
|
|
15
|
-
pathPrefix: string;
|
|
16
|
-
}): Promise<void>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tunable override store — the SINGLE write/read path for settings.tunables.
|
|
3
|
-
*
|
|
4
|
-
* Shared by the config.updateTunable RPC (UI settings page) and the `config`
|
|
5
|
-
* tool (conversational tuning), so both go through identical validation,
|
|
6
|
-
* persistence, and runtime sync. Values are hot: ModelRegistry.getTunable()
|
|
7
|
-
* re-reads settings.json on every call, so a persisted override takes effect
|
|
8
|
-
* on the next read with no restart.
|
|
9
|
-
*/
|
|
10
|
-
import { type TunableDefaults } from "../runtime/config/tunable-defaults.js";
|
|
11
|
-
/** Read the current override map from settings.json (missing file → empty). */
|
|
12
|
-
export declare function readTunableOverrides(settingsPath: string): Record<string, unknown>;
|
|
13
|
-
/**
|
|
14
|
-
* Validate a tunable update against the declared defaults.
|
|
15
|
-
* Returns an error message, or null when the update is acceptable.
|
|
16
|
-
* Coercible values ("3" → 3, "true" → true) are NOT accepted here —
|
|
17
|
-
* callers wanting leniency must coerce before validating.
|
|
18
|
-
*/
|
|
19
|
-
export declare function validateTunableUpdate(key: string, value: unknown): string | null;
|
|
20
|
-
/** Coerce a string value toward the tunable's declared type ("3"→3, "true"→true). */
|
|
21
|
-
export declare function coerceTunableValue(key: string, value: unknown): unknown;
|
|
22
|
-
/** Persist one override into settings.json and sync live runtime state. */
|
|
23
|
-
export declare function writeTunableOverride(settingsPath: string, key: string, value: unknown): Promise<void>;
|
|
24
|
-
/** Remove one override (value falls back to the declared default). */
|
|
25
|
-
export declare function clearTunableOverride(settingsPath: string, key: string): Promise<void>;
|
|
26
|
-
export type { TunableDefaults };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings watcher for canonical qlogicagent permission settings.
|
|
3
|
-
*
|
|
4
|
-
* Two layers (CC settings semantics):
|
|
5
|
-
* - user level ~/.qlogicagent/profiles/<owner>/settings.json — where config.update persists
|
|
6
|
-
* - project level <projectRoot>/.qlogicagent/settings.json — repo-local overrides
|
|
7
|
-
* The project file's `permissions` object, when present, overrides the user file's.
|
|
8
|
-
* Both layers are watched; either changing re-resolves the effective permissions.
|
|
9
|
-
* (写读同源:此前 config.update 写用户级、watcher 只读项目级,重启后持久模式永远丢失。)
|
|
10
|
-
*
|
|
11
|
-
* Only the `permissions` object is accepted. Removed top-level aliases such as
|
|
12
|
-
* `permissionMode`, `permissionRules`, and `defaultBehavior` must fail loudly.
|
|
13
|
-
*/
|
|
14
|
-
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
15
|
-
import type { PermissionRuleEnginePort } from "../../runtime/ports/index.js";
|
|
16
|
-
export interface SettingsFile {
|
|
17
|
-
permissions?: unknown;
|
|
18
|
-
}
|
|
19
|
-
export interface SettingsWatcherDeps {
|
|
20
|
-
projectRoot: string;
|
|
21
|
-
ruleEngine: PermissionRuleEnginePort;
|
|
22
|
-
hooks?: HookRegistry;
|
|
23
|
-
log?: (msg: string) => void;
|
|
24
|
-
}
|
|
25
|
-
export declare function watchSettings(deps: SettingsWatcherDeps): () => void;
|
|
26
|
-
export declare function loadInitialSettings(projectRoot: string, ruleEngine: PermissionRuleEnginePort): Promise<SettingsFile | null>;
|
|
File without changes
|