@downcity/agent 1.1.232 → 1.1.237
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/bin/agent/local/Agent.d.ts +1 -1
- package/bin/agent/local/Agent.js +2 -2
- package/bin/agent/local/Agent.js.map +1 -1
- package/bin/agent/local/services/AgentSessions.d.ts +4 -4
- package/bin/agent/local/services/AgentSessions.d.ts.map +1 -1
- package/bin/agent/local/services/AgentSessions.js +8 -8
- package/bin/agent/local/services/AgentSessions.js.map +1 -1
- package/bin/agent/remote/RemoteSession.d.ts +2 -0
- package/bin/agent/remote/RemoteSession.d.ts.map +1 -1
- package/bin/agent/remote/RemoteSession.js +4 -0
- package/bin/agent/remote/RemoteSession.js.map +1 -1
- package/bin/agent/remote/RemoteTransport.d.ts +2 -0
- package/bin/agent/remote/RemoteTransport.d.ts.map +1 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +1 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +11 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +1 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +1 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +3 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +1 -1
- package/bin/executor/Executor.d.ts +20 -2
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +102 -18
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts +6 -0
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts +0 -9
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js +4 -38
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +1 -3
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +7 -59
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineContextCompaction.d.ts +38 -0
- package/bin/executor/core-engine/CoreEngineContextCompaction.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineContextCompaction.js +392 -0
- package/bin/executor/core-engine/CoreEngineContextCompaction.js.map +1 -0
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts +15 -0
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.js +20 -0
- package/bin/executor/core-engine/CoreEngineMessageState.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.d.ts +9 -5
- package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.js +146 -35
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
- package/bin/executor/store/history/SessionHistoryStore.d.ts +4 -10
- package/bin/executor/store/history/SessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +1 -3
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
- package/bin/executor/types/SessionRun.d.ts +8 -0
- package/bin/executor/types/SessionRun.d.ts.map +1 -1
- package/bin/index.d.ts +1 -1
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +1 -1
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/PluginLocalExecution.js +3 -3
- package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts +20 -2
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/core/PluginRegistry.js +100 -3
- package/bin/plugin/core/PluginRegistry.js.map +1 -1
- package/bin/rpc/Client.d.ts +6 -4
- package/bin/rpc/Client.d.ts.map +1 -1
- package/bin/rpc/Client.js +11 -0
- package/bin/rpc/Client.js.map +1 -1
- package/bin/session/Session.d.ts +7 -3
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +26 -19
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionSystemBuilder.d.ts.map +1 -1
- package/bin/session/SessionSystemBuilder.js +3 -1
- package/bin/session/SessionSystemBuilder.js.map +1 -1
- package/bin/session/recorder/SessionRecorderCompaction.d.ts.map +1 -1
- package/bin/session/recorder/SessionRecorderCompaction.js +102 -60
- package/bin/session/recorder/SessionRecorderCompaction.js.map +1 -1
- package/bin/session/runtime/SessionPromptRuntime.d.ts +11 -7
- package/bin/session/runtime/SessionPromptRuntime.d.ts.map +1 -1
- package/bin/session/runtime/SessionPromptRuntime.js +22 -24
- package/bin/session/runtime/SessionPromptRuntime.js.map +1 -1
- package/bin/session/services/SessionStateService.d.ts +10 -6
- package/bin/session/services/SessionStateService.d.ts.map +1 -1
- package/bin/session/services/SessionStateService.js +29 -20
- package/bin/session/services/SessionStateService.js.map +1 -1
- package/bin/session/services/SessionTurnService.d.ts +13 -3
- package/bin/session/services/SessionTurnService.d.ts.map +1 -1
- package/bin/session/services/SessionTurnService.js +90 -7
- package/bin/session/services/SessionTurnService.js.map +1 -1
- package/bin/types/agent/SessionActor.d.ts +8 -0
- package/bin/types/agent/SessionActor.d.ts.map +1 -1
- package/bin/types/executor/SessionRunContext.d.ts +16 -8
- package/bin/types/executor/SessionRunContext.d.ts.map +1 -1
- package/bin/types/plugin/PluginRuntime.d.ts +36 -4
- package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
- package/bin/types/plugin/PluginState.d.ts +10 -0
- package/bin/types/plugin/PluginState.d.ts.map +1 -1
- package/bin/types/rpc/RpcProtocol.d.ts +21 -0
- package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
- package/bin/types/runtime/agent/AgentContext.d.ts +2 -2
- package/bin/types/runtime/agent/AgentContext.js +1 -1
- package/bin/types/session/SessionLocalState.d.ts +2 -2
- package/bin/types/session/SessionOptions.d.ts +5 -5
- package/bin/types/session/SessionOptions.d.ts.map +1 -1
- package/bin/types/session/SessionQueueCommand.d.ts +68 -0
- package/bin/types/session/SessionQueueCommand.d.ts.map +1 -0
- package/bin/types/session/SessionQueueCommand.js +10 -0
- package/bin/types/session/SessionQueueCommand.js.map +1 -0
- package/bin/utils/logger/Logger.d.ts +7 -9
- package/bin/utils/logger/Logger.d.ts.map +1 -1
- package/bin/utils/logger/Logger.js +11 -9
- package/bin/utils/logger/Logger.js.map +1 -1
- package/package.json +3 -3
- package/scripts/core-engine-context-compaction.test.mjs +411 -0
- package/scripts/logger-isolation.test.mjs +55 -0
- package/scripts/multi-agent-plugin-isolation.test.mjs +289 -0
- package/scripts/plugin-tool-bridge.test.mjs +52 -0
- package/scripts/remote-session-reconnect.test.mjs +18 -0
- package/scripts/session-compaction-context-window.test.mjs +27 -26
- package/scripts/session-config-turn-boundary.test.mjs +80 -26
- package/scripts/session-prompt-runtime.test.mjs +23 -15
- package/scripts/session-recorder.test.mjs +15 -24
- package/src/agent/local/Agent.ts +2 -2
- package/src/agent/local/services/AgentSessions.ts +10 -10
- package/src/agent/remote/RemoteSession.ts +5 -0
- package/src/agent/remote/RemoteTransport.ts +2 -0
- package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +15 -0
- package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +4 -0
- package/src/executor/Executor.ts +111 -19
- package/src/executor/composer/compaction/SessionCompactionComposer.ts +7 -0
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts +4 -57
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +8 -66
- package/src/executor/core-engine/CoreEngineContextCompaction.ts +477 -0
- package/src/executor/core-engine/CoreEngineMessageState.ts +29 -0
- package/src/executor/core-engine/CoreEngineRunner.ts +200 -48
- package/src/executor/store/history/SessionHistoryStore.ts +4 -12
- package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +1 -3
- package/src/executor/types/SessionRun.ts +9 -0
- package/src/index.ts +1 -1
- package/src/plugin/core/PluginLocalExecution.ts +3 -3
- package/src/plugin/core/PluginRegistry.ts +116 -3
- package/src/rpc/Client.ts +15 -2
- package/src/session/Session.ts +28 -20
- package/src/session/SessionSystemBuilder.ts +4 -1
- package/src/session/recorder/SessionRecorderCompaction.ts +113 -65
- package/src/session/runtime/SessionPromptRuntime.ts +31 -46
- package/src/session/services/SessionStateService.ts +34 -25
- package/src/session/services/SessionTurnService.ts +97 -8
- package/src/types/agent/SessionActor.ts +9 -0
- package/src/types/executor/SessionRunContext.ts +17 -8
- package/src/types/plugin/PluginRuntime.ts +38 -4
- package/src/types/plugin/PluginState.ts +10 -0
- package/src/types/rpc/RpcProtocol.ts +23 -0
- package/src/types/runtime/agent/AgentContext.ts +2 -2
- package/src/types/session/SessionLocalState.ts +2 -2
- package/src/types/session/SessionOptions.ts +6 -6
- package/src/types/session/SessionQueueCommand.ts +78 -0
- package/src/utils/logger/Logger.ts +10 -10
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/types/session/SessionConfigMutation.d.ts +0 -68
- package/bin/types/session/SessionConfigMutation.d.ts.map +0 -1
- package/bin/types/session/SessionConfigMutation.js +0 -10
- package/bin/types/session/SessionConfigMutation.js.map +0 -1
- package/src/types/session/SessionConfigMutation.ts +0 -78
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session 配置 Mutation 运行时类型。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 配置 API 负责把 configured state 修改成功后创建 mutation。
|
|
6
|
-
* - mutation 与 steer 共用 Session 输入队列,并在下一次模型 turn 开始前提交。
|
|
7
|
-
* - 这里只描述进程内提交协议,不属于持久化格式或公开 SDK 协议。
|
|
8
|
-
*/
|
|
9
|
-
import type { AgentSessionSystemBlock } from "../../types/agent/SessionTypes.js";
|
|
10
|
-
import type { AgentPluginExecutionRuntime } from "../../types/plugin/PluginRuntime.js";
|
|
11
|
-
/**
|
|
12
|
-
* 配置 Mutation 的归属作用域。
|
|
13
|
-
*/
|
|
14
|
-
export type SessionConfigMutationScope = "agent" | "session";
|
|
15
|
-
/**
|
|
16
|
-
* 配置 Mutation 生效时的模型 turn 上下文。
|
|
17
|
-
*/
|
|
18
|
-
export interface SessionConfigMutationApplyContext {
|
|
19
|
-
/** 当前公开 Session turn 标识。 */
|
|
20
|
-
turn_id: string;
|
|
21
|
-
/** 当前 Session turn 内即将开始的模型 turn 序号。 */
|
|
22
|
-
model_turn_index: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 等待在下一次模型 turn 提交的配置 Mutation。
|
|
26
|
-
*/
|
|
27
|
-
export interface SessionRuntimeConfigMutation {
|
|
28
|
-
/** 当前配置修改的稳定唯一标识。 */
|
|
29
|
-
mutation_id: string;
|
|
30
|
-
/** 当前配置修改属于 Agent 还是 Session。 */
|
|
31
|
-
scope: SessionConfigMutationScope;
|
|
32
|
-
/**
|
|
33
|
-
* 把 configured state 提交为当前 Session 的 effective state。
|
|
34
|
-
*
|
|
35
|
-
* 关键点(中文)
|
|
36
|
-
* - 成功或失败的 action message 由具体配置实现负责写入。
|
|
37
|
-
* - 抛错只终止当前 mutation,不应让后续 mutation 静默丢失。
|
|
38
|
-
*/
|
|
39
|
-
apply(context: SessionConfigMutationApplyContext): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Agent configured state 广播给已有 Session 的配置修改。
|
|
43
|
-
*/
|
|
44
|
-
export type AgentSessionConfigMutation = {
|
|
45
|
-
/** 当前修改固定为 instruction。 */
|
|
46
|
-
type: "instruction";
|
|
47
|
-
/** 当前配置修改唯一标识。 */
|
|
48
|
-
mutation_id: string;
|
|
49
|
-
/** 下一模型 turn 使用的 instruction blocks。 */
|
|
50
|
-
instruction_blocks: AgentSessionSystemBlock[];
|
|
51
|
-
} | {
|
|
52
|
-
/** 当前修改固定为 env。 */
|
|
53
|
-
type: "env";
|
|
54
|
-
/** 当前配置修改唯一标识。 */
|
|
55
|
-
mutation_id: string;
|
|
56
|
-
/** 下一模型 turn 使用的完整 Agent env。 */
|
|
57
|
-
env: Record<string, string>;
|
|
58
|
-
} | {
|
|
59
|
-
/** 当前修改固定为 plugin registry。 */
|
|
60
|
-
type: "plugins";
|
|
61
|
-
/** 当前配置修改唯一标识。 */
|
|
62
|
-
mutation_id: string;
|
|
63
|
-
/** 当前 plugin 配置修改的用户可读标题。 */
|
|
64
|
-
title: string;
|
|
65
|
-
/** 下一模型 turn 使用的 Plugin 执行视图。 */
|
|
66
|
-
plugins: AgentPluginExecutionRuntime;
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=SessionConfigMutation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionConfigMutation.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionConfigMutation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAEhB,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,qBAAqB;IACrB,WAAW,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,KAAK,EAAE,0BAA0B,CAAC;IAElC;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAClC;IACE,2BAA2B;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,kBAAkB;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,kBAAkB,EAAE,uBAAuB,EAAE,CAAC;CAC/C,GACD;IACE,mBAAmB;IACnB,IAAI,EAAE,KAAK,CAAC;IACZ,kBAAkB;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,GACD;IACE,+BAA+B;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,kBAAkB;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session 配置 Mutation 运行时类型。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 配置 API 负责把 configured state 修改成功后创建 mutation。
|
|
6
|
-
* - mutation 与 steer 共用 Session 输入队列,并在下一次模型 turn 开始前提交。
|
|
7
|
-
* - 这里只描述进程内提交协议,不属于持久化格式或公开 SDK 协议。
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=SessionConfigMutation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionConfigMutation.js","sourceRoot":"","sources":["../../../src/types/session/SessionConfigMutation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session 配置 Mutation 运行时类型。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 配置 API 负责把 configured state 修改成功后创建 mutation。
|
|
6
|
-
* - mutation 与 steer 共用 Session 输入队列,并在下一次模型 turn 开始前提交。
|
|
7
|
-
* - 这里只描述进程内提交协议,不属于持久化格式或公开 SDK 协议。
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { AgentSessionSystemBlock } from "@/types/agent/SessionTypes.js";
|
|
11
|
-
import type { AgentPluginExecutionRuntime } from "@/types/plugin/PluginRuntime.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* 配置 Mutation 的归属作用域。
|
|
15
|
-
*/
|
|
16
|
-
export type SessionConfigMutationScope = "agent" | "session";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 配置 Mutation 生效时的模型 turn 上下文。
|
|
20
|
-
*/
|
|
21
|
-
export interface SessionConfigMutationApplyContext {
|
|
22
|
-
/** 当前公开 Session turn 标识。 */
|
|
23
|
-
turn_id: string;
|
|
24
|
-
|
|
25
|
-
/** 当前 Session turn 内即将开始的模型 turn 序号。 */
|
|
26
|
-
model_turn_index: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 等待在下一次模型 turn 提交的配置 Mutation。
|
|
31
|
-
*/
|
|
32
|
-
export interface SessionRuntimeConfigMutation {
|
|
33
|
-
/** 当前配置修改的稳定唯一标识。 */
|
|
34
|
-
mutation_id: string;
|
|
35
|
-
|
|
36
|
-
/** 当前配置修改属于 Agent 还是 Session。 */
|
|
37
|
-
scope: SessionConfigMutationScope;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 把 configured state 提交为当前 Session 的 effective state。
|
|
41
|
-
*
|
|
42
|
-
* 关键点(中文)
|
|
43
|
-
* - 成功或失败的 action message 由具体配置实现负责写入。
|
|
44
|
-
* - 抛错只终止当前 mutation,不应让后续 mutation 静默丢失。
|
|
45
|
-
*/
|
|
46
|
-
apply(context: SessionConfigMutationApplyContext): Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Agent configured state 广播给已有 Session 的配置修改。
|
|
51
|
-
*/
|
|
52
|
-
export type AgentSessionConfigMutation =
|
|
53
|
-
| {
|
|
54
|
-
/** 当前修改固定为 instruction。 */
|
|
55
|
-
type: "instruction";
|
|
56
|
-
/** 当前配置修改唯一标识。 */
|
|
57
|
-
mutation_id: string;
|
|
58
|
-
/** 下一模型 turn 使用的 instruction blocks。 */
|
|
59
|
-
instruction_blocks: AgentSessionSystemBlock[];
|
|
60
|
-
}
|
|
61
|
-
| {
|
|
62
|
-
/** 当前修改固定为 env。 */
|
|
63
|
-
type: "env";
|
|
64
|
-
/** 当前配置修改唯一标识。 */
|
|
65
|
-
mutation_id: string;
|
|
66
|
-
/** 下一模型 turn 使用的完整 Agent env。 */
|
|
67
|
-
env: Record<string, string>;
|
|
68
|
-
}
|
|
69
|
-
| {
|
|
70
|
-
/** 当前修改固定为 plugin registry。 */
|
|
71
|
-
type: "plugins";
|
|
72
|
-
/** 当前配置修改唯一标识。 */
|
|
73
|
-
mutation_id: string;
|
|
74
|
-
/** 当前 plugin 配置修改的用户可读标题。 */
|
|
75
|
-
title: string;
|
|
76
|
-
/** 下一模型 turn 使用的 Plugin 执行视图。 */
|
|
77
|
-
plugins: AgentPluginExecutionRuntime;
|
|
78
|
-
};
|