@downcity/agent 1.1.199 → 1.1.202
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 +3 -7
- package/bin/agent/local/Agent.d.ts.map +1 -1
- package/bin/agent/local/Agent.js +14 -19
- package/bin/agent/local/Agent.js.map +1 -1
- package/bin/agent/local/services/{AgentSessionManager.d.ts → AgentSessions.d.ts} +12 -17
- package/bin/agent/local/services/AgentSessions.d.ts.map +1 -0
- package/bin/agent/local/services/{AgentSessionManager.js → AgentSessions.js} +11 -26
- package/bin/agent/local/services/AgentSessions.js.map +1 -0
- package/bin/agent/remote/RemoteAgent.d.ts +2 -9
- package/bin/agent/remote/RemoteAgent.d.ts.map +1 -1
- package/bin/agent/remote/RemoteAgent.js +40 -22
- package/bin/agent/remote/RemoteAgent.js.map +1 -1
- package/bin/agent/remote/RemoteSession.d.ts +5 -5
- package/bin/agent/remote/RemoteSession.d.ts.map +1 -1
- package/bin/agent/remote/RemoteSession.js +5 -3
- package/bin/agent/remote/RemoteSession.js.map +1 -1
- package/bin/agent/remote/RemoteTransport.d.ts +2 -2
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +2 -2
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +5 -5
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +2 -2
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +2 -2
- package/bin/executor/Executor.d.ts +7 -7
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +41 -33
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/SessionRunScope.d.ts +1 -1
- package/bin/executor/SessionRunScope.d.ts.map +1 -1
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts +5 -5
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +4 -5
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +73 -40
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts +27 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts.map +1 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js +181 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js.map +1 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.d.ts +45 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.d.ts.map +1 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.js +144 -0
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.js.map +1 -0
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts +3 -3
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +1 -1
- package/bin/executor/composer/context/SessionContextComposer.d.ts +3 -3
- package/bin/executor/composer/context/SessionContextComposer.d.ts.map +1 -1
- package/bin/executor/composer/history/SessionHistoryComposer.d.ts +2 -2
- package/bin/executor/composer/history/SessionHistoryComposer.d.ts.map +1 -1
- package/bin/executor/composer/history/SessionHistoryWriter.d.ts +5 -5
- package/bin/executor/composer/history/SessionHistoryWriter.d.ts.map +1 -1
- package/bin/executor/composer/history/SessionHistoryWriter.js +6 -6
- package/bin/executor/composer/history/SessionHistoryWriter.js.map +1 -1
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts +2 -2
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +1 -1
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js +5 -4
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts +5 -5
- package/bin/executor/core-engine/CoreEngineMessageState.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineMessageState.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.d.ts +4 -4
- package/bin/executor/core-engine/CoreEngineSignals.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineSignals.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts +3 -3
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js.map +1 -1
- package/bin/executor/messages/AssistantResultPersistence.d.ts +5 -5
- package/bin/executor/messages/AssistantResultPersistence.d.ts.map +1 -1
- package/bin/executor/messages/AssistantResultPersistence.js +1 -1
- package/bin/executor/messages/AssistantResultPersistence.js.map +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.d.ts +3 -3
- package/bin/executor/messages/SessionAttachmentMapper.d.ts.map +1 -1
- package/bin/executor/messages/SessionAttachmentMapper.js.map +1 -1
- package/bin/executor/messages/SessionMessageCodec.d.ts +4 -4
- package/bin/executor/messages/SessionMessageCodec.d.ts.map +1 -1
- package/bin/executor/messages/SessionMessageCodec.js +5 -5
- package/bin/executor/messages/SessionMessageCodec.js.map +1 -1
- package/bin/executor/messages/SessionMessageLog.d.ts +3 -3
- package/bin/executor/messages/SessionMessageLog.d.ts.map +1 -1
- package/bin/executor/messages/SessionMessageLog.js.map +1 -1
- package/bin/executor/messages/SessionStepEventMapper.d.ts +2 -2
- package/bin/executor/messages/SessionStepEventMapper.d.ts.map +1 -1
- package/bin/executor/messages/SessionStepEventMapper.js.map +1 -1
- package/bin/executor/messages/UserVisibleText.d.ts +3 -3
- package/bin/executor/messages/UserVisibleText.d.ts.map +1 -1
- package/bin/executor/messages/UserVisibleText.js +3 -3
- package/bin/executor/messages/UserVisibleText.js.map +1 -1
- package/bin/executor/services/ExecutorInflightService.d.ts +2 -2
- package/bin/executor/services/ExecutorInflightService.d.ts.map +1 -1
- package/bin/executor/services/ExecutorInflightService.js +11 -7
- package/bin/executor/services/ExecutorInflightService.js.map +1 -1
- package/bin/executor/store/history/SessionHistoryStore.d.ts +30 -27
- package/bin/executor/store/history/SessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/SessionHistoryStore.js +3 -3
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +21 -20
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +114 -72
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts +1 -7
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +1 -1
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts +4 -6
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts.map +1 -1
- package/bin/executor/tools/plugin/PluginToolSchemas.js +24 -10
- package/bin/executor/tools/plugin/PluginToolSchemas.js.map +1 -1
- package/bin/executor/types/SessionRecords.d.ts +162 -0
- package/bin/executor/types/SessionRecords.d.ts.map +1 -0
- package/bin/executor/types/SessionRecords.js +52 -0
- package/bin/executor/types/SessionRecords.js.map +1 -0
- package/bin/executor/types/SessionRun.d.ts +3 -3
- package/bin/executor/types/SessionRun.d.ts.map +1 -1
- package/bin/index.d.ts +2 -2
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js.map +1 -1
- package/bin/rpc/Client.d.ts +5 -5
- package/bin/rpc/Client.js +4 -4
- package/bin/session/Session.d.ts +6 -6
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +8 -8
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionTitle.d.ts +2 -2
- package/bin/session/SessionTitle.d.ts.map +1 -1
- package/bin/session/SessionTitle.js +5 -0
- package/bin/session/SessionTitle.js.map +1 -1
- package/bin/session/browse/Browse.d.ts +12 -12
- package/bin/session/browse/Browse.d.ts.map +1 -1
- package/bin/session/browse/Browse.js +37 -34
- package/bin/session/browse/Browse.js.map +1 -1
- package/bin/session/index.d.ts +1 -1
- package/bin/session/index.js +1 -1
- package/bin/session/runtime/SessionPromptRuntime.d.ts +3 -3
- package/bin/session/runtime/SessionPromptRuntime.d.ts.map +1 -1
- package/bin/session/services/SessionStateService.d.ts +11 -12
- package/bin/session/services/SessionStateService.d.ts.map +1 -1
- package/bin/session/services/SessionStateService.js +43 -69
- package/bin/session/services/SessionStateService.js.map +1 -1
- package/bin/session/services/SessionTurnService.js +3 -3
- package/bin/session/services/SessionTurnService.js.map +1 -1
- package/bin/session/services/SessionViewService.d.ts +4 -4
- package/bin/session/services/SessionViewService.d.ts.map +1 -1
- package/bin/session/services/SessionViewService.js +26 -36
- package/bin/session/services/SessionViewService.js.map +1 -1
- package/bin/session/storage/Persistence.d.ts +4 -4
- package/bin/session/storage/Persistence.d.ts.map +1 -1
- package/bin/session/storage/RuntimeSessionPort.d.ts +2 -2
- package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
- package/bin/session/storage/RuntimeSessionPort.js +4 -4
- package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
- package/bin/types/agent/AgentTypes.d.ts +2 -2
- package/bin/types/agent/AgentTypes.d.ts.map +1 -1
- package/bin/types/agent/SessionActor.d.ts +11 -11
- package/bin/types/agent/SessionActor.d.ts.map +1 -1
- package/bin/types/agent/SessionTypes.d.ts +22 -22
- package/bin/types/agent/SessionTypes.d.ts.map +1 -1
- package/bin/types/executor/SessionRunContext.d.ts +7 -7
- package/bin/types/executor/SessionRunContext.d.ts.map +1 -1
- package/bin/types/rpc/RpcProtocol.d.ts +6 -6
- package/bin/types/runtime/agent/AgentContext.d.ts +7 -7
- package/bin/types/runtime/agent/AgentContext.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionAction.d.ts +26 -0
- package/bin/types/sdk/AgentSessionAction.d.ts.map +1 -0
- package/bin/types/sdk/AgentSessionAction.js +10 -0
- package/bin/types/sdk/AgentSessionAction.js.map +1 -0
- package/bin/types/sdk/AgentSessionEvent.d.ts +2 -2
- package/bin/types/sdk/AgentSessionEvent.d.ts.map +1 -1
- package/bin/types/sdk/AgentSessionTurn.d.ts +2 -2
- package/bin/types/sdk/AgentSessionTurn.d.ts.map +1 -1
- package/package.json +3 -3
- package/scripts/agent-ready.test.mjs +1 -1
- package/scripts/city-model-tool-loop.test.mjs +36 -4
- package/scripts/plugin-tool-bridge.test.mjs +13 -0
- package/scripts/session-action-message.test.mjs +199 -0
- package/scripts/session-compaction-prompts.test.mjs +97 -0
- package/scripts/session-history-archive.test.mjs +8 -8
- package/scripts/session-history-inflight.test.mjs +10 -10
- package/scripts/session-list-title.test.mjs +9 -9
- package/scripts/session-title-event.test.mjs +12 -10
- package/src/agent/local/Agent.ts +16 -22
- package/src/agent/local/services/{AgentSessionManager.ts → AgentSessions.ts} +16 -32
- package/src/agent/remote/RemoteAgent.ts +58 -23
- package/src/agent/remote/RemoteSession.ts +10 -8
- package/src/agent/remote/RemoteTransport.ts +5 -5
- package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +10 -10
- package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +6 -6
- package/src/executor/Executor.ts +51 -41
- package/src/executor/SessionRunScope.ts +1 -1
- package/src/executor/composer/compaction/SessionCompactionComposer.ts +5 -5
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts +1 -1
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +91 -52
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.ts +197 -0
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionPrompts.ts +162 -0
- package/src/executor/composer/context/LocalSessionContextComposer.ts +5 -5
- package/src/executor/composer/context/SessionContextComposer.ts +5 -5
- package/src/executor/composer/history/SessionHistoryComposer.ts +2 -2
- package/src/executor/composer/history/SessionHistoryWriter.ts +10 -10
- package/src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts +13 -10
- package/src/executor/core-engine/CoreEngineMessageState.ts +8 -8
- package/src/executor/core-engine/CoreEngineRunner.ts +7 -7
- package/src/executor/core-engine/CoreEngineSignals.ts +7 -7
- package/src/executor/core-engine/CoreEngineUiStreamCollector.ts +5 -5
- package/src/executor/messages/AssistantResultPersistence.ts +8 -8
- package/src/executor/messages/SessionAttachmentMapper.ts +11 -11
- package/src/executor/messages/SessionMessageCodec.ts +10 -10
- package/src/executor/messages/SessionMessageLog.ts +3 -3
- package/src/executor/messages/SessionStepEventMapper.ts +5 -5
- package/src/executor/messages/UserVisibleText.ts +9 -9
- package/src/executor/services/ExecutorInflightService.ts +13 -9
- package/src/executor/store/history/SessionHistoryStore.ts +32 -28
- package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +146 -95
- package/src/executor/tools/plugin/PluginToolSchemas.ts +24 -10
- package/src/executor/types/SessionRecords.ts +217 -0
- package/src/executor/types/SessionRun.ts +5 -5
- package/src/index.ts +9 -10
- package/src/rpc/Client.ts +9 -9
- package/src/session/Session.ts +10 -10
- package/src/session/SessionTitle.ts +7 -4
- package/src/session/browse/Browse.ts +66 -58
- package/src/session/index.ts +1 -1
- package/src/session/runtime/SessionPromptRuntime.ts +6 -6
- package/src/session/services/SessionStateService.ts +61 -86
- package/src/session/services/SessionTurnService.ts +7 -7
- package/src/session/services/SessionViewService.ts +35 -45
- package/src/session/storage/Persistence.ts +6 -6
- package/src/session/storage/RuntimeSessionPort.ts +6 -6
- package/src/types/agent/AgentTypes.ts +4 -4
- package/src/types/agent/SessionActor.ts +12 -12
- package/src/types/agent/SessionTypes.ts +22 -22
- package/src/types/executor/SessionRunContext.ts +12 -12
- package/src/types/rpc/RpcProtocol.ts +6 -6
- package/src/types/runtime/agent/AgentContext.ts +8 -8
- package/src/types/sdk/AgentSessionAction.ts +35 -0
- package/src/types/sdk/AgentSessionEvent.ts +2 -2
- package/src/types/sdk/AgentSessionTurn.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/agent/local/services/AgentSessionManager.d.ts.map +0 -1
- package/bin/agent/local/services/AgentSessionManager.js.map +0 -1
- package/bin/executor/types/SessionMessages.d.ts +0 -118
- package/bin/executor/types/SessionMessages.d.ts.map +0 -1
- package/bin/executor/types/SessionMessages.js +0 -28
- package/bin/executor/types/SessionMessages.js.map +0 -1
- package/bin/types/sdk/AgentSessionOperation.d.ts +0 -99
- package/bin/types/sdk/AgentSessionOperation.d.ts.map +0 -1
- package/bin/types/sdk/AgentSessionOperation.js +0 -10
- package/bin/types/sdk/AgentSessionOperation.js.map +0 -1
- package/scripts/session-operation-message.test.mjs +0 -197
- package/src/executor/types/SessionMessages.ts +0 -148
- package/src/types/sdk/AgentSessionOperation.ts +0 -125
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Session operation 类型定义。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - operation 描述 session 内部正在发生的辅助操作,不代表 assistant 正文。
|
|
6
|
-
* - operation 可以同时作为订阅事件发布,也可以作为 UIMessage 持久化到 JSONL。
|
|
7
|
-
* - operation message 只用于前端时间线与调试,不应进入 LLM 输入。
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { JsonValue } from "@/types/common/Json.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Session operation 当前状态。
|
|
14
|
-
*/
|
|
15
|
-
export type AgentSessionOperationStatus =
|
|
16
|
-
| "started"
|
|
17
|
-
| "progress"
|
|
18
|
-
| "finished"
|
|
19
|
-
| "skipped"
|
|
20
|
-
| "failed";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Session operation 名称。
|
|
24
|
-
*
|
|
25
|
-
* 说明(中文)
|
|
26
|
-
* - 内置名称用于 SDK 与前端约定常见辅助操作。
|
|
27
|
-
* - 字符串扩展允许 plugin 或宿主运行时声明自己的 operation。
|
|
28
|
-
*/
|
|
29
|
-
export type AgentSessionOperationName =
|
|
30
|
-
| "compacting"
|
|
31
|
-
| "model-switching"
|
|
32
|
-
| "history-forking"
|
|
33
|
-
| (string & {});
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Session operation 记录。
|
|
37
|
-
*/
|
|
38
|
-
export interface AgentSessionOperationRecord {
|
|
39
|
-
/**
|
|
40
|
-
* 同一个 operation 生命周期内稳定复用的 ID。
|
|
41
|
-
*/
|
|
42
|
-
operationId: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 当前 operation 名称。
|
|
46
|
-
*/
|
|
47
|
-
name: AgentSessionOperationName;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 当前 operation 状态。
|
|
51
|
-
*/
|
|
52
|
-
status: AgentSessionOperationStatus;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 当前 operation 关联的 turn 标识。
|
|
56
|
-
*
|
|
57
|
-
* 说明(中文)
|
|
58
|
-
* - turn 内触发的 operation 应写入该字段。
|
|
59
|
-
* - session 级 operation 可以省略。
|
|
60
|
-
*/
|
|
61
|
-
turnId?: string;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 面向用户展示的短文本。
|
|
65
|
-
*/
|
|
66
|
-
label?: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 机器可读原因。
|
|
70
|
-
*
|
|
71
|
-
* 示例(中文)
|
|
72
|
-
* - `under_budget`:未达到压缩阈值。
|
|
73
|
-
* - `summary_fallback`:摘要生成失败后使用降级摘要。
|
|
74
|
-
*/
|
|
75
|
-
reason?: string;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 当前 operation 进度,范围 0 到 1。
|
|
79
|
-
*
|
|
80
|
-
* 说明(中文)
|
|
81
|
-
* - 无法估算进度时省略。
|
|
82
|
-
*/
|
|
83
|
-
progress?: number;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* operation 完成后产生的轻量结果。
|
|
87
|
-
*/
|
|
88
|
-
result?: JsonValue;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* operation 失败时的错误文本。
|
|
92
|
-
*/
|
|
93
|
-
error?: string;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 是否建议前端展示。
|
|
97
|
-
*
|
|
98
|
-
* 说明(中文)
|
|
99
|
-
* - 默认视为 `true`。
|
|
100
|
-
* - 调试或审计类辅助事件可显式写入 `false`。
|
|
101
|
-
*/
|
|
102
|
-
visible?: boolean;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Session operation 订阅事件。
|
|
107
|
-
*/
|
|
108
|
-
export interface AgentSessionOperationEvent extends AgentSessionOperationRecord {
|
|
109
|
-
/**
|
|
110
|
-
* 当前事件类型。
|
|
111
|
-
*/
|
|
112
|
-
type: "operation";
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* 当前 session 唯一标识。
|
|
116
|
-
*/
|
|
117
|
-
sessionId: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Session operation 发布回调。
|
|
122
|
-
*/
|
|
123
|
-
export type AgentSessionOperationCallback = (
|
|
124
|
-
operation: AgentSessionOperationEvent,
|
|
125
|
-
) => Promise<void>;
|