@downcity/agent 1.1.43 → 1.1.62
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/README.md +11 -12
- package/bin/agent/Agent.d.ts +31 -16
- package/bin/agent/Agent.d.ts.map +1 -1
- package/bin/agent/Agent.js +47 -63
- package/bin/agent/Agent.js.map +1 -1
- package/bin/agent/RemoteAgent.d.ts +6 -6
- package/bin/agent/RemoteAgent.d.ts.map +1 -1
- package/bin/agent/RemoteAgent.js +377 -267
- package/bin/agent/RemoteAgent.js.map +1 -1
- package/bin/config/AgentInitializer.d.ts +5 -5
- package/bin/config/AgentInitializer.d.ts.map +1 -1
- package/bin/config/AgentInitializer.js +15 -13
- package/bin/config/AgentInitializer.js.map +1 -1
- package/bin/config/Config.d.ts +9 -30
- package/bin/config/Config.d.ts.map +1 -1
- package/bin/config/Config.js +23 -70
- package/bin/config/Config.js.map +1 -1
- package/bin/config/Defaults.d.ts.map +1 -1
- package/bin/config/Defaults.js +1 -9
- package/bin/config/Defaults.js.map +1 -1
- package/bin/config/DowncitySchema.d.ts.map +1 -1
- package/bin/config/DowncitySchema.js +4 -112
- package/bin/config/DowncitySchema.js.map +1 -1
- package/bin/config/ExecutionBinding.d.ts +1 -16
- package/bin/config/ExecutionBinding.d.ts.map +1 -1
- package/bin/config/ExecutionBinding.js +2 -22
- package/bin/config/ExecutionBinding.js.map +1 -1
- package/bin/config/Paths.d.ts +4 -43
- package/bin/config/Paths.d.ts.map +1 -1
- package/bin/config/Paths.js +10 -30
- package/bin/config/Paths.js.map +1 -1
- package/bin/config/PlatformPaths.d.ts +0 -4
- package/bin/config/PlatformPaths.d.ts.map +1 -1
- package/bin/config/PlatformPaths.js +5 -1
- package/bin/config/PlatformPaths.js.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +0 -4
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
- package/bin/executor/composer/system/default/InitPrompts.d.ts +1 -1
- package/bin/executor/composer/system/default/InitPrompts.js +1 -1
- package/bin/executor/composer/system/default/SystemDomain.js +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/init/PROFILE.md.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/init/PROFILE.md.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/init/PROFILE.md.js +1 -1
- package/bin/executor/composer/system/default/assets/init/PROFILE.md.js.map +1 -1
- package/bin/executor/composer/system/default/assets/plugin.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/plugin.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.js +1 -1
- package/bin/executor/messages/ChatMessageMarkupTypes.d.ts +1 -1
- package/bin/executor/messages/ChatMessageMarkupTypes.js +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +1 -2
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +17 -56
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
- package/bin/executor/tools/shell/ShellToolBridge.js +1 -1
- package/bin/executor/tools/shell/ShellToolBridge.js.map +1 -1
- package/bin/executor/tools/shell/ShellToolDefinition.d.ts +2 -2
- package/bin/executor/tools/shell/ShellToolFormatting.d.ts +1 -1
- package/bin/executor/tools/shell/ShellToolFormatting.js +9 -9
- package/bin/executor/tools/shell/ShellToolFormatting.js.map +1 -1
- package/bin/executor/tools/shell/ShellToolSchemas.d.ts +7 -75
- package/bin/executor/tools/shell/ShellToolSchemas.d.ts.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.d.ts +5 -24
- package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.js +1 -1
- package/bin/executor/types/SessionRun.d.ts +1 -1
- package/bin/index.d.ts +5 -6
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +6 -5
- package/bin/index.js.map +1 -1
- package/bin/model/CityModelAdapter.d.ts +23 -0
- package/bin/model/CityModelAdapter.d.ts.map +1 -0
- package/bin/model/CityModelAdapter.js +338 -0
- package/bin/model/CityModelAdapter.js.map +1 -0
- package/bin/plugin/core/PluginCommandRequest.d.ts +1 -1
- package/bin/plugin/core/PluginCommandRequest.js +1 -1
- package/bin/plugin/core/PluginLocalExecution.d.ts.map +1 -1
- package/bin/plugin/core/PluginLocalExecution.js +4 -8
- package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
- package/bin/plugin/types/PluginApi.d.ts +1 -1
- package/bin/rpc/Client.d.ts +104 -0
- package/bin/rpc/Client.d.ts.map +1 -0
- package/bin/rpc/Client.js +300 -0
- package/bin/rpc/Client.js.map +1 -0
- package/bin/rpc/Server.d.ts +41 -0
- package/bin/rpc/Server.d.ts.map +1 -0
- package/bin/rpc/Server.js +164 -0
- package/bin/rpc/Server.js.map +1 -0
- package/bin/runtime/host/daemon/Api.d.ts +1 -1
- package/bin/runtime/host/daemon/Client.d.ts +1 -1
- package/bin/runtime/host/daemon/Client.d.ts.map +1 -1
- package/bin/runtime/host/daemon/Client.js +30 -20
- package/bin/runtime/host/daemon/Client.js.map +1 -1
- package/bin/runtime/host/daemon/Paths.d.ts +1 -1
- package/bin/runtime/host/daemon/Paths.js +1 -1
- package/bin/runtime/host/daemon/ProjectSetup.js +2 -2
- package/bin/runtime/server/http/control/OverviewRoutes.js +1 -1
- package/bin/runtime/server/http/control/OverviewRoutes.js.map +1 -1
- package/bin/session/Session.d.ts +1 -0
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +32 -6
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionTitle.d.ts +49 -0
- package/bin/session/SessionTitle.d.ts.map +1 -0
- package/bin/session/SessionTitle.js +130 -0
- package/bin/session/SessionTitle.js.map +1 -0
- package/bin/session/browse/Browse.d.ts +2 -1
- package/bin/session/browse/Browse.d.ts.map +1 -1
- package/bin/session/browse/Browse.js +18 -15
- package/bin/session/browse/Browse.js.map +1 -1
- package/bin/session/index.d.ts +3 -2
- package/bin/session/index.d.ts.map +1 -1
- package/bin/session/index.js +3 -2
- package/bin/session/index.js.map +1 -1
- package/bin/session/storage/Metadata.d.ts +4 -0
- package/bin/session/storage/Metadata.d.ts.map +1 -1
- package/bin/session/storage/Metadata.js +12 -25
- package/bin/session/storage/Metadata.js.map +1 -1
- package/bin/session/storage/Paths.d.ts +0 -4
- package/bin/session/storage/Paths.d.ts.map +1 -1
- package/bin/session/storage/Paths.js +0 -6
- package/bin/session/storage/Paths.js.map +1 -1
- package/bin/session/storage/Persistence.d.ts.map +1 -1
- package/bin/session/storage/Persistence.js +1 -4
- package/bin/session/storage/Persistence.js.map +1 -1
- package/bin/types/agent/AgentTypes.d.ts +32 -57
- package/bin/types/agent/AgentTypes.d.ts.map +1 -1
- package/bin/types/config/AgentProject.d.ts +7 -6
- package/bin/types/config/AgentProject.d.ts.map +1 -1
- package/bin/types/config/DowncityConfig.d.ts +11 -69
- package/bin/types/config/DowncityConfig.d.ts.map +1 -1
- package/bin/types/config/ExecutionBinding.d.ts +4 -4
- package/bin/types/config/ExecutionBinding.js +1 -1
- package/bin/types/config/LlmConfig.d.ts +1 -1
- package/bin/types/config/Start.d.ts +3 -0
- package/bin/types/config/Start.d.ts.map +1 -1
- package/bin/types/config/Start.js +2 -0
- package/bin/types/config/Start.js.map +1 -1
- package/bin/types/runtime/auth/AuthPermission.js +2 -2
- package/bin/types/runtime/auth/AuthPermission.js.map +1 -1
- package/bin/types/runtime/host/Store.d.ts +10 -227
- package/bin/types/runtime/host/Store.d.ts.map +1 -1
- package/bin/types/runtime/host/Store.js +7 -0
- package/bin/types/runtime/host/Store.js.map +1 -1
- package/bin/types/runtime/http/InlineInstant.d.ts +1 -1
- package/bin/types/runtime/platform/Platform.d.ts +7 -7
- package/bin/types/runtime/platform/Platform.d.ts.map +1 -1
- package/bin/types/runtime/platform/PlatformGateway.d.ts +2 -2
- package/bin/types/runtime/platform/PlatformGateway.d.ts.map +1 -1
- package/bin/utils/Time.d.ts +0 -1
- package/bin/utils/Time.d.ts.map +1 -1
- package/bin/utils/Time.js +0 -7
- package/bin/utils/Time.js.map +1 -1
- package/bin/utils/storage/index.d.ts +0 -1
- package/bin/utils/storage/index.d.ts.map +1 -1
- package/bin/utils/storage/index.js +0 -6
- package/bin/utils/storage/index.js.map +1 -1
- package/package.json +22 -23
- package/src/agent/Agent.ts +57 -73
- package/src/agent/RemoteAgent.ts +515 -345
- package/src/config/AgentInitializer.ts +15 -13
- package/src/config/Config.ts +28 -85
- package/src/config/Defaults.ts +1 -9
- package/src/config/DowncitySchema.ts +4 -114
- package/src/config/ExecutionBinding.ts +2 -24
- package/src/config/Paths.ts +10 -43
- package/src/config/PlatformPaths.ts +5 -1
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +0 -4
- package/src/executor/composer/system/default/InitPrompts.ts +1 -1
- package/src/executor/composer/system/default/SystemDomain.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +1 -1
- package/src/executor/composer/system/default/assets/init/PROFILE.md.ts +1 -1
- package/src/executor/composer/system/default/assets/init/PROFILE.md.ts.txt +1 -2
- package/src/executor/composer/system/default/assets/plugin.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/plugin.prompt.ts.txt +18 -18
- package/src/executor/composer/system/default/assets/task.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/task.prompt.ts.txt +1 -1
- package/src/executor/messages/ChatMessageMarkupTypes.ts +1 -1
- package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +17 -57
- package/src/executor/tools/shell/ShellToolBridge.ts +1 -1
- package/src/executor/tools/shell/ShellToolFormatting.ts +9 -9
- package/src/executor/types/SessionHistoryMeta.ts +5 -25
- package/src/executor/types/SessionRun.ts +1 -1
- package/src/index.ts +12 -19
- package/src/model/CityModelAdapter.ts +384 -0
- package/src/plugin/core/PluginCommandRequest.ts +1 -1
- package/src/plugin/core/PluginLocalExecution.ts +4 -8
- package/src/plugin/types/PluginApi.ts +1 -1
- package/src/rpc/Client.ts +467 -0
- package/src/rpc/Server.ts +302 -0
- package/src/runtime/host/daemon/Api.ts +1 -1
- package/src/runtime/host/daemon/Client.ts +44 -22
- package/src/runtime/host/daemon/Paths.ts +1 -1
- package/src/runtime/host/daemon/ProjectSetup.ts +2 -2
- package/src/runtime/server/http/control/OverviewRoutes.ts +1 -1
- package/src/session/Session.ts +40 -6
- package/src/session/SessionTitle.ts +192 -0
- package/src/session/browse/Browse.ts +22 -13
- package/src/session/index.ts +5 -1
- package/src/session/storage/Metadata.ts +14 -29
- package/src/session/storage/Paths.ts +0 -10
- package/src/session/storage/Persistence.ts +1 -4
- package/src/types/agent/AgentTypes.ts +33 -62
- package/src/types/config/AgentProject.ts +7 -6
- package/src/types/config/DowncityConfig.ts +11 -70
- package/src/types/config/ExecutionBinding.ts +4 -4
- package/src/types/config/LlmConfig.ts +1 -1
- package/src/types/config/Start.ts +3 -0
- package/src/types/runtime/auth/AuthPermission.ts +2 -2
- package/src/types/runtime/host/Store.ts +10 -235
- package/src/types/runtime/http/InlineInstant.ts +1 -1
- package/src/types/runtime/platform/Platform.ts +7 -7
- package/src/types/runtime/platform/PlatformGateway.ts +2 -2
- package/src/utils/Time.ts +0 -6
- package/src/utils/storage/index.ts +0 -7
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/config/ConfigEnvResolver.d.ts +0 -22
- package/bin/config/ConfigEnvResolver.d.ts.map +0 -1
- package/bin/config/ConfigEnvResolver.js +0 -41
- package/bin/config/ConfigEnvResolver.js.map +0 -1
- package/bin/runtime/server/rpc/Server.d.ts +0 -18
- package/bin/runtime/server/rpc/Server.d.ts.map +0 -1
- package/bin/runtime/server/rpc/Server.js +0 -315
- package/bin/runtime/server/rpc/Server.js.map +0 -1
- package/bin/runtime/transport/rpc/Client.d.ts +0 -13
- package/bin/runtime/transport/rpc/Client.d.ts.map +0 -1
- package/bin/runtime/transport/rpc/Client.js +0 -98
- package/bin/runtime/transport/rpc/Client.js.map +0 -1
- package/bin/runtime/transport/rpc/Paths.d.ts +0 -14
- package/bin/runtime/transport/rpc/Paths.d.ts.map +0 -1
- package/bin/runtime/transport/rpc/Paths.js +0 -42
- package/bin/runtime/transport/rpc/Paths.js.map +0 -1
- package/bin/runtime/transport/rpc/Transport.d.ts +0 -21
- package/bin/runtime/transport/rpc/Transport.d.ts.map +0 -1
- package/bin/runtime/transport/rpc/Transport.js +0 -30
- package/bin/runtime/transport/rpc/Transport.js.map +0 -1
- package/bin/types/common/ResolvedConfigValue.d.ts +0 -12
- package/bin/types/common/ResolvedConfigValue.d.ts.map +0 -1
- package/bin/types/common/ResolvedConfigValue.js +0 -2
- package/bin/types/common/ResolvedConfigValue.js.map +0 -1
- package/bin/types/runtime/rpc/LocalRpc.d.ts +0 -69
- package/bin/types/runtime/rpc/LocalRpc.d.ts.map +0 -1
- package/bin/types/runtime/rpc/LocalRpc.js +0 -9
- package/bin/types/runtime/rpc/LocalRpc.js.map +0 -1
- package/src/config/ConfigEnvResolver.ts +0 -52
- package/src/runtime/server/rpc/Server.ts +0 -408
- package/src/runtime/transport/rpc/Client.ts +0 -113
- package/src/runtime/transport/rpc/Paths.ts +0 -50
- package/src/runtime/transport/rpc/Transport.ts +0 -43
- package/src/types/common/ResolvedConfigValue.ts +0 -16
- package/src/types/runtime/rpc/LocalRpc.ts +0 -72
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Session 标题生成与持久化辅助。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - session title 是 `meta.json` 顶层字段,列表与详情都以它为准。
|
|
6
|
+
* - 首次用户消息出现后优先使用模型生成标题,失败时回退到首条用户消息截断。
|
|
7
|
+
* - 老 session 缺失 title 时可在读取列表/详情时补写 fallback title。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { generateText, type LanguageModel } from "ai";
|
|
11
|
+
import type { SessionHistoryMetaV1 } from "@/executor/types/SessionHistoryMeta.js";
|
|
12
|
+
import type { SessionMessageV1 } from "@/executor/types/SessionMessages.js";
|
|
13
|
+
import {
|
|
14
|
+
normalizeSessionTitle,
|
|
15
|
+
readSessionMetadata,
|
|
16
|
+
writeSessionMetadata,
|
|
17
|
+
} from "@/session/storage/Metadata.js";
|
|
18
|
+
|
|
19
|
+
const FALLBACK_SESSION_TITLE_MAX_CHARS = 60;
|
|
20
|
+
const GENERATED_SESSION_TITLE_MAX_CHARS = 24;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 标题持久化参数。
|
|
24
|
+
*/
|
|
25
|
+
export interface EnsureSessionTitleParams {
|
|
26
|
+
/**
|
|
27
|
+
* 当前项目根目录。
|
|
28
|
+
*/
|
|
29
|
+
projectRoot: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 当前 agent 稳定标识。
|
|
33
|
+
*/
|
|
34
|
+
agentId: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 当前 sessionId。
|
|
38
|
+
*/
|
|
39
|
+
sessionId: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 当前 session 已落盘消息。
|
|
43
|
+
*/
|
|
44
|
+
messages: SessionMessageV1[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 可选模型实例;传入时会尝试生成更短标题。
|
|
48
|
+
*/
|
|
49
|
+
model?: LanguageModel;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 是否允许调用模型生成标题。
|
|
53
|
+
*/
|
|
54
|
+
generate?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function truncateTitle(input: string, maxChars: number): string {
|
|
58
|
+
const title = String(input || "").replace(/\s+/g, " ").trim();
|
|
59
|
+
if (!title) return "";
|
|
60
|
+
if (title.length <= maxChars) return title;
|
|
61
|
+
return title.slice(0, maxChars).trimEnd();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function extractTextFromMessage(message: SessionMessageV1): string {
|
|
65
|
+
if (!Array.isArray(message.parts)) return "";
|
|
66
|
+
const texts: string[] = [];
|
|
67
|
+
for (const part of message.parts) {
|
|
68
|
+
if (!part || typeof part !== "object") continue;
|
|
69
|
+
const textPart = part as { type?: unknown; text?: unknown };
|
|
70
|
+
if (textPart.type !== "text" || typeof textPart.text !== "string") continue;
|
|
71
|
+
const text = textPart.text.trim();
|
|
72
|
+
if (!text) continue;
|
|
73
|
+
texts.push(text);
|
|
74
|
+
}
|
|
75
|
+
return texts.join("\n").trim();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function resolveFirstUserText(messages: SessionMessageV1[]): string {
|
|
79
|
+
for (const message of messages) {
|
|
80
|
+
if (message.role !== "user") continue;
|
|
81
|
+
const text = extractTextFromMessage(message);
|
|
82
|
+
if (text) return text;
|
|
83
|
+
}
|
|
84
|
+
return "";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function normalizeGeneratedTitle(input: string): string | undefined {
|
|
88
|
+
const firstLine = String(input || "")
|
|
89
|
+
.split("\n")
|
|
90
|
+
.map((line) => line.trim())
|
|
91
|
+
.find(Boolean);
|
|
92
|
+
const title = normalizeSessionTitle(
|
|
93
|
+
String(firstLine || "")
|
|
94
|
+
.replace(/^["'`“”‘’]+|["'`“”‘’]+$/g, "")
|
|
95
|
+
.replace(/^标题[::]\s*/i, "")
|
|
96
|
+
.trim(),
|
|
97
|
+
);
|
|
98
|
+
return title
|
|
99
|
+
? truncateTitle(title, GENERATED_SESSION_TITLE_MAX_CHARS)
|
|
100
|
+
: undefined;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 从首条用户消息推导 fallback 标题。
|
|
105
|
+
*/
|
|
106
|
+
export function resolveFallbackSessionTitle(
|
|
107
|
+
messages: SessionMessageV1[],
|
|
108
|
+
): string | undefined {
|
|
109
|
+
const firstUserText = resolveFirstUserText(messages);
|
|
110
|
+
const title = truncateTitle(
|
|
111
|
+
firstUserText,
|
|
112
|
+
FALLBACK_SESSION_TITLE_MAX_CHARS,
|
|
113
|
+
);
|
|
114
|
+
return normalizeSessionTitle(title);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function generateSessionTitle(input: {
|
|
118
|
+
/**
|
|
119
|
+
* 当前模型实例。
|
|
120
|
+
*/
|
|
121
|
+
model: LanguageModel;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 首条用户消息文本。
|
|
125
|
+
*/
|
|
126
|
+
firstUserText: string;
|
|
127
|
+
}): Promise<string | undefined> {
|
|
128
|
+
try {
|
|
129
|
+
const result = await generateText({
|
|
130
|
+
model: input.model,
|
|
131
|
+
system:
|
|
132
|
+
"你负责为一段会话生成极简标题。只输出标题本身,不要解释,不要使用引号。",
|
|
133
|
+
prompt: [
|
|
134
|
+
"根据下面这条用户首条消息,生成一个简短的会话标题。",
|
|
135
|
+
"要求:3 到 12 个汉字或 2 到 6 个英文词;不要句号;不要前缀。",
|
|
136
|
+
"",
|
|
137
|
+
input.firstUserText,
|
|
138
|
+
].join("\n"),
|
|
139
|
+
});
|
|
140
|
+
return normalizeGeneratedTitle(result.text);
|
|
141
|
+
} catch {
|
|
142
|
+
// 关键点(中文):标题生成失败不能影响 session 主流程。
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 确保当前 session meta 中持久化 title。
|
|
149
|
+
*/
|
|
150
|
+
export async function ensureSessionTitle(
|
|
151
|
+
input: EnsureSessionTitleParams,
|
|
152
|
+
): Promise<SessionHistoryMetaV1> {
|
|
153
|
+
const current = await readSessionMetadata(input);
|
|
154
|
+
if (current.title) return current;
|
|
155
|
+
|
|
156
|
+
const firstUserText = resolveFirstUserText(input.messages);
|
|
157
|
+
const fallbackTitle = resolveFallbackSessionTitle(input.messages);
|
|
158
|
+
if (!fallbackTitle) return current;
|
|
159
|
+
|
|
160
|
+
const fallbackMeta: SessionHistoryMetaV1 = {
|
|
161
|
+
...current,
|
|
162
|
+
title: fallbackTitle,
|
|
163
|
+
};
|
|
164
|
+
await writeSessionMetadata({
|
|
165
|
+
projectRoot: input.projectRoot,
|
|
166
|
+
agentId: input.agentId,
|
|
167
|
+
sessionId: input.sessionId,
|
|
168
|
+
meta: fallbackMeta,
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
if (input.generate !== true || !input.model || !firstUserText) {
|
|
172
|
+
return fallbackMeta;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const generatedTitle = await generateSessionTitle({
|
|
176
|
+
model: input.model,
|
|
177
|
+
firstUserText,
|
|
178
|
+
});
|
|
179
|
+
if (!generatedTitle) return fallbackMeta;
|
|
180
|
+
|
|
181
|
+
const generatedMeta: SessionHistoryMetaV1 = {
|
|
182
|
+
...fallbackMeta,
|
|
183
|
+
title: generatedTitle,
|
|
184
|
+
};
|
|
185
|
+
await writeSessionMetadata({
|
|
186
|
+
projectRoot: input.projectRoot,
|
|
187
|
+
agentId: input.agentId,
|
|
188
|
+
sessionId: input.sessionId,
|
|
189
|
+
meta: generatedMeta,
|
|
190
|
+
});
|
|
191
|
+
return generatedMeta;
|
|
192
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* SDK Session 浏览辅助。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 统一负责 session 列表摘要、session 详情与 history
|
|
5
|
+
* - 统一负责 session 列表摘要、session 详情与 history 分页的投影逻辑。
|
|
6
|
+
* - 老 session 缺失持久化 title 时,会在列表读取阶段补写 fallback title。
|
|
6
7
|
* - 面向 SDK / RemoteAgent / HTTP route 复用,避免在多个入口重复拼列表与分页语义。
|
|
7
8
|
* - 这里不持有运行态状态;执行状态等动态信息通过调用参数显式注入。
|
|
8
9
|
*/
|
|
@@ -33,6 +34,10 @@ import { pickLastSuccessfulChatSendText } from "@/executor/messages/UserVisibleT
|
|
|
33
34
|
import { getSdkAgentSessionMessagesPath } from "@/session/storage/Paths.js";
|
|
34
35
|
import { getSdkAgentSessionsRootDirPath } from "@/session/storage/Paths.js";
|
|
35
36
|
import { readSessionMetadata } from "@/session/storage/Metadata.js";
|
|
37
|
+
import {
|
|
38
|
+
ensureSessionTitle,
|
|
39
|
+
resolveFallbackSessionTitle,
|
|
40
|
+
} from "@/session/SessionTitle.js";
|
|
36
41
|
|
|
37
42
|
type AnyUiPart = UIMessagePart<Record<string, never>, Record<string, never>>;
|
|
38
43
|
|
|
@@ -184,14 +189,7 @@ export function resolveSessionMessagePreview(message: SessionMessageV1): string
|
|
|
184
189
|
* 推导当前 session 的可读标题。
|
|
185
190
|
*/
|
|
186
191
|
export function resolveSessionTitle(messages: SessionMessageV1[]): string | undefined {
|
|
187
|
-
|
|
188
|
-
if (message.role !== "user") continue;
|
|
189
|
-
const preview = resolveSessionMessagePreview(message);
|
|
190
|
-
if (!preview) continue;
|
|
191
|
-
return truncateText(preview, 80);
|
|
192
|
-
}
|
|
193
|
-
const fallback = messages[0] ? resolveSessionMessagePreview(messages[0]) : "";
|
|
194
|
-
return fallback ? truncateText(fallback, 80) : undefined;
|
|
192
|
+
return resolveFallbackSessionTitle(messages);
|
|
195
193
|
}
|
|
196
194
|
|
|
197
195
|
function resolveToolName(part: ToolPartCompatShape, aiToolName?: string): string {
|
|
@@ -361,7 +359,10 @@ export function buildSessionInfo(
|
|
|
361
359
|
180,
|
|
362
360
|
)
|
|
363
361
|
: undefined;
|
|
364
|
-
const title =
|
|
362
|
+
const title =
|
|
363
|
+
typeof input.metadata.title === "string" && input.metadata.title.trim()
|
|
364
|
+
? input.metadata.title.trim()
|
|
365
|
+
: undefined;
|
|
365
366
|
return {
|
|
366
367
|
agentId: input.agentId,
|
|
367
368
|
sessionId: input.sessionId,
|
|
@@ -374,8 +375,8 @@ export function buildSessionInfo(
|
|
|
374
375
|
...(typeof input.metadata.updatedAt === "number"
|
|
375
376
|
? { updatedAt: input.metadata.updatedAt }
|
|
376
377
|
: {}),
|
|
377
|
-
...(input.metadata.
|
|
378
|
-
? { modelLabel: input.metadata.
|
|
378
|
+
...(input.metadata.modelLabel
|
|
379
|
+
? { modelLabel: input.metadata.modelLabel }
|
|
379
380
|
: {}),
|
|
380
381
|
...(typeof input.metadata.timezone === "string" && input.metadata.timezone.trim()
|
|
381
382
|
? { timezone: input.metadata.timezone.trim() }
|
|
@@ -470,11 +471,19 @@ export async function listAgentSessionSummaryPage(params: {
|
|
|
470
471
|
const messages = await loadSessionMessagesFromPath(
|
|
471
472
|
getSdkAgentSessionMessagesPath(params.projectRoot, params.agentId, sessionId),
|
|
472
473
|
);
|
|
474
|
+
const metadataWithTitle = metadata.title
|
|
475
|
+
? metadata
|
|
476
|
+
: await ensureSessionTitle({
|
|
477
|
+
projectRoot: params.projectRoot,
|
|
478
|
+
agentId: params.agentId,
|
|
479
|
+
sessionId,
|
|
480
|
+
messages,
|
|
481
|
+
});
|
|
473
482
|
const info = buildSessionInfo({
|
|
474
483
|
projectRoot: params.projectRoot,
|
|
475
484
|
agentId: params.agentId,
|
|
476
485
|
sessionId,
|
|
477
|
-
metadata,
|
|
486
|
+
metadata: metadataWithTitle,
|
|
478
487
|
messages,
|
|
479
488
|
executing: params.executingSessionIds?.has(sessionId),
|
|
480
489
|
});
|
package/src/session/index.ts
CHANGED
|
@@ -10,7 +10,6 @@ export { Session } from "./Session.js";
|
|
|
10
10
|
|
|
11
11
|
export {
|
|
12
12
|
getSdkAgentDirPath,
|
|
13
|
-
getSdkAgentRpcEndpointPath,
|
|
14
13
|
getSdkAgentSessionArchiveDirPath,
|
|
15
14
|
getSdkAgentSessionDirPath,
|
|
16
15
|
getSdkAgentSessionMessagesDirPath,
|
|
@@ -22,11 +21,16 @@ export {
|
|
|
22
21
|
} from "./storage/Paths.js";
|
|
23
22
|
export {
|
|
24
23
|
inferModelLabel,
|
|
24
|
+
normalizeSessionTitle,
|
|
25
25
|
patchSessionModelLabel,
|
|
26
26
|
readSessionMetadata,
|
|
27
27
|
resolveSystemTimezone,
|
|
28
28
|
writeSessionMetadata,
|
|
29
29
|
} from "./storage/Metadata.js";
|
|
30
|
+
export {
|
|
31
|
+
ensureSessionTitle,
|
|
32
|
+
resolveFallbackSessionTitle,
|
|
33
|
+
} from "./SessionTitle.js";
|
|
30
34
|
export {
|
|
31
35
|
persistSdkAssistantResult,
|
|
32
36
|
touchSessionMetadata,
|
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import fs from "fs-extra";
|
|
10
10
|
import type { LanguageModel } from "ai";
|
|
11
|
-
import type {
|
|
12
|
-
SessionHistoryMetaV1,
|
|
13
|
-
SessionHistorySdkConfigV1,
|
|
14
|
-
} from "@/executor/types/SessionHistoryMeta.js";
|
|
11
|
+
import type { SessionHistoryMetaV1 } from "@/executor/types/SessionHistoryMeta.js";
|
|
15
12
|
import { getSdkAgentSessionMetaPath } from "@/session/storage/Paths.js";
|
|
16
13
|
|
|
17
14
|
type ReadSessionMetadataInput = {
|
|
@@ -36,6 +33,14 @@ function normalizeModelLabel(input: unknown): string | undefined {
|
|
|
36
33
|
return label || undefined;
|
|
37
34
|
}
|
|
38
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 归一化 session 标题。
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeSessionTitle(input: unknown): string | undefined {
|
|
40
|
+
const title = typeof input === "string" ? input.trim() : "";
|
|
41
|
+
return title || undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* 读取当前系统时区。
|
|
41
46
|
*/
|
|
@@ -103,27 +108,11 @@ export async function readSessionMetadata(
|
|
|
103
108
|
typeof raw.updatedAt === "number" && Number.isFinite(raw.updatedAt)
|
|
104
109
|
? raw.updatedAt
|
|
105
110
|
: 0,
|
|
106
|
-
|
|
107
|
-
? raw.
|
|
108
|
-
.map((item) => (typeof item === "string" ? item.trim() : ""))
|
|
109
|
-
.filter(Boolean)
|
|
110
|
-
: [],
|
|
111
|
-
...(typeof raw.lastArchiveId === "string" && raw.lastArchiveId.trim()
|
|
112
|
-
? { lastArchiveId: raw.lastArchiveId.trim() }
|
|
113
|
-
: {}),
|
|
114
|
-
...(typeof raw.keepLastMessages === "number" &&
|
|
115
|
-
Number.isFinite(raw.keepLastMessages)
|
|
116
|
-
? { keepLastMessages: raw.keepLastMessages }
|
|
117
|
-
: {}),
|
|
118
|
-
...(typeof raw.maxInputTokensApprox === "number" &&
|
|
119
|
-
Number.isFinite(raw.maxInputTokensApprox)
|
|
120
|
-
? { maxInputTokensApprox: raw.maxInputTokensApprox }
|
|
121
|
-
: {}),
|
|
122
|
-
...(typeof raw.compactRatio === "number" && Number.isFinite(raw.compactRatio)
|
|
123
|
-
? { compactRatio: raw.compactRatio }
|
|
111
|
+
...(normalizeSessionTitle(raw.title)
|
|
112
|
+
? { title: normalizeSessionTitle(raw.title) }
|
|
124
113
|
: {}),
|
|
125
|
-
...(raw.
|
|
126
|
-
? {
|
|
114
|
+
...(normalizeModelLabel(raw.modelLabel)
|
|
115
|
+
? { modelLabel: normalizeModelLabel(raw.modelLabel) }
|
|
127
116
|
: {}),
|
|
128
117
|
};
|
|
129
118
|
} catch {
|
|
@@ -134,7 +123,6 @@ export async function readSessionMetadata(
|
|
|
134
123
|
createdAt: Date.now(),
|
|
135
124
|
timezone: resolveSystemTimezone(),
|
|
136
125
|
updatedAt: 0,
|
|
137
|
-
pinnedSkillIds: [],
|
|
138
126
|
};
|
|
139
127
|
}
|
|
140
128
|
}
|
|
@@ -181,10 +169,7 @@ export async function patchSessionModelLabel(
|
|
|
181
169
|
updatedAt: Date.now(),
|
|
182
170
|
...(modelLabel
|
|
183
171
|
? {
|
|
184
|
-
|
|
185
|
-
...(current.sdkConfig || {}),
|
|
186
|
-
modelLabel,
|
|
187
|
-
},
|
|
172
|
+
modelLabel,
|
|
188
173
|
}
|
|
189
174
|
: {}),
|
|
190
175
|
};
|
|
@@ -114,13 +114,3 @@ export function getSdkAgentSessionArchiveDirPath(
|
|
|
114
114
|
"archive",
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* 单个 agent 的本地 RPC socket 路径。
|
|
120
|
-
*/
|
|
121
|
-
export function getSdkAgentRpcEndpointPath(
|
|
122
|
-
projectRoot: string,
|
|
123
|
-
agentId: string,
|
|
124
|
-
): string {
|
|
125
|
-
return path.join(getSdkAgentDirPath(projectRoot, agentId), "agent.rpc.sock");
|
|
126
|
-
}
|
|
@@ -83,10 +83,7 @@ export async function touchSessionMetadata(
|
|
|
83
83
|
updatedAt: Date.now(),
|
|
84
84
|
...(params.sessionConfig.modelLabel
|
|
85
85
|
? {
|
|
86
|
-
|
|
87
|
-
...(current.sdkConfig || {}),
|
|
88
|
-
modelLabel: params.sessionConfig.modelLabel,
|
|
89
|
-
},
|
|
86
|
+
modelLabel: params.sessionConfig.modelLabel,
|
|
90
87
|
}
|
|
91
88
|
: {}),
|
|
92
89
|
};
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import type { LanguageModel, Tool } from "ai";
|
|
11
11
|
import type { BasePlugin } from "@/plugin/core/BasePlugin.js";
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
12
|
+
import type { AgentModel } from "@/model/CityModelAdapter.js";
|
|
13
|
+
import type { RpcServerInstance } from "@/rpc/Server.js";
|
|
14
14
|
import type { SessionMessageV1 } from "@/executor/types/SessionMessages.js";
|
|
15
15
|
import type {
|
|
16
16
|
AgentSessionSubscriber,
|
|
@@ -19,6 +19,8 @@ import type {
|
|
|
19
19
|
import type { AgentSessionPromptInput } from "@/types/sdk/AgentSessionPrompt.js";
|
|
20
20
|
import type { AgentSessionTurnHandle } from "@/types/sdk/AgentSessionTurn.js";
|
|
21
21
|
|
|
22
|
+
export type { AgentModel } from "@/model/CityModelAdapter.js";
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* 本地 Agent 构造参数。
|
|
24
26
|
*/
|
|
@@ -60,10 +62,11 @@ export interface AgentOptions {
|
|
|
60
62
|
* 当前 agent 为新建 session 提供的默认模型实例。
|
|
61
63
|
*
|
|
62
64
|
* 关键点(中文)
|
|
63
|
-
* - SDK
|
|
65
|
+
* - SDK 仍不负责“选择哪个模型”,这里只接收宿主已经创建好的模型实例。
|
|
66
|
+
* - 支持 AI SDK `LanguageModel`,也支持 City City 返回的 `CityModel`。
|
|
64
67
|
* - 该模型会作为 session 首次执行前的默认注入值。
|
|
65
68
|
*/
|
|
66
|
-
model?:
|
|
69
|
+
model?: AgentModel;
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
72
|
* 当前 agent 显式持有的插件实例集合。
|
|
@@ -77,12 +80,12 @@ export interface AgentOptions {
|
|
|
77
80
|
plugins?: BasePlugin[];
|
|
78
81
|
|
|
79
82
|
/**
|
|
80
|
-
* 当前 agent
|
|
83
|
+
* 当前 agent 的显式环境变量覆盖项。
|
|
81
84
|
*
|
|
82
85
|
* 关键点(中文)
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* -
|
|
86
|
+
* - 这里表示宿主显式注入给 agent 的基础 env。
|
|
87
|
+
* - `Agent` 会在这份基础 env 之上继续叠加项目 `.env`。
|
|
88
|
+
* - 覆盖后的最终 env 会参与配置解析与运行时上下文装配,但不会回写到宿主环境。
|
|
86
89
|
*/
|
|
87
90
|
env?: Record<string, string>;
|
|
88
91
|
|
|
@@ -93,23 +96,14 @@ export interface AgentOptions {
|
|
|
93
96
|
*/
|
|
94
97
|
export interface AgentStartOptions {
|
|
95
98
|
/**
|
|
96
|
-
*
|
|
99
|
+
* 是否启动本机 RPC 服务。
|
|
97
100
|
*
|
|
98
101
|
* 关键点(中文)
|
|
99
102
|
* - `false` 表示不启动。
|
|
100
103
|
* - 传对象时会按给定 host/port 启动。
|
|
101
104
|
* - 省略时默认不启动,避免 SDK 本地嵌入场景误开端口。
|
|
102
105
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* 是否启动本地 RPC 服务。
|
|
107
|
-
*
|
|
108
|
-
* 关键点(中文)
|
|
109
|
-
* - `true` 时启动主 local RPC server。
|
|
110
|
-
* - 省略或 `false` 时不启动。
|
|
111
|
-
*/
|
|
112
|
-
rpc?: boolean;
|
|
106
|
+
rpc?: false | AgentRpcStartOptions;
|
|
113
107
|
|
|
114
108
|
/**
|
|
115
109
|
* 是否启动当前 agent 的 plugins。
|
|
@@ -126,12 +120,7 @@ export interface AgentStartOptions {
|
|
|
126
120
|
*/
|
|
127
121
|
export interface AgentStopResult {
|
|
128
122
|
/**
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
httpStopped: boolean;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* 本次是否实际停止了本地 RPC 服务。
|
|
123
|
+
* 本次是否实际停止了本机 RPC 服务。
|
|
135
124
|
*/
|
|
136
125
|
rpcStopped: boolean;
|
|
137
126
|
|
|
@@ -146,12 +135,7 @@ export interface AgentStopResult {
|
|
|
146
135
|
*/
|
|
147
136
|
export interface AgentStartResult {
|
|
148
137
|
/**
|
|
149
|
-
* 当前 agent
|
|
150
|
-
*/
|
|
151
|
-
http?: AgentHttpBinding;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* 当前 agent 是否已启动本地 RPC 服务。
|
|
138
|
+
* 当前 agent 是否已启动本机 RPC 服务。
|
|
155
139
|
*/
|
|
156
140
|
rpc?: AgentRpcBinding;
|
|
157
141
|
|
|
@@ -162,28 +146,28 @@ export interface AgentStartResult {
|
|
|
162
146
|
}
|
|
163
147
|
|
|
164
148
|
/**
|
|
165
|
-
* Agent
|
|
149
|
+
* Agent RPC 启动参数。
|
|
166
150
|
*/
|
|
167
|
-
export interface
|
|
151
|
+
export interface AgentRpcStartOptions {
|
|
168
152
|
/**
|
|
169
|
-
*
|
|
153
|
+
* RPC 监听主机。
|
|
170
154
|
*/
|
|
171
155
|
host?: string;
|
|
172
156
|
|
|
173
157
|
/**
|
|
174
|
-
*
|
|
158
|
+
* RPC 监听端口。
|
|
175
159
|
*/
|
|
176
160
|
port?: number;
|
|
177
161
|
}
|
|
178
162
|
|
|
179
163
|
/**
|
|
180
|
-
* Agent
|
|
164
|
+
* Agent RPC 绑定信息。
|
|
181
165
|
*/
|
|
182
|
-
export interface
|
|
166
|
+
export interface AgentRpcBinding {
|
|
183
167
|
/**
|
|
184
|
-
*
|
|
168
|
+
* 远程访问地址。
|
|
185
169
|
*/
|
|
186
|
-
|
|
170
|
+
url: string;
|
|
187
171
|
|
|
188
172
|
/**
|
|
189
173
|
* 当前 host。
|
|
@@ -196,24 +180,9 @@ export interface AgentHttpBinding {
|
|
|
196
180
|
port: number;
|
|
197
181
|
|
|
198
182
|
/**
|
|
199
|
-
*
|
|
183
|
+
* RPC server 句柄。
|
|
200
184
|
*/
|
|
201
|
-
server:
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Agent RPC 绑定信息。
|
|
206
|
-
*/
|
|
207
|
-
export interface AgentRpcBinding {
|
|
208
|
-
/**
|
|
209
|
-
* 当前本地 RPC endpoint。
|
|
210
|
-
*/
|
|
211
|
-
endpoint: string;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* 本地 RPC server 句柄。
|
|
215
|
-
*/
|
|
216
|
-
server: LocalRpcServerHandle;
|
|
185
|
+
server: RpcServerInstance;
|
|
217
186
|
}
|
|
218
187
|
|
|
219
188
|
/**
|
|
@@ -221,11 +190,12 @@ export interface AgentRpcBinding {
|
|
|
221
190
|
*/
|
|
222
191
|
export interface RemoteAgentOptions {
|
|
223
192
|
/**
|
|
224
|
-
* 远程
|
|
193
|
+
* 远程 agent 访问地址。
|
|
225
194
|
*
|
|
226
|
-
* 例如:`http://127.0.0.1:15314`
|
|
195
|
+
* 例如:`https://city.example.com`、`http://127.0.0.1:15314`
|
|
196
|
+
* 或 `rpc://127.0.0.1:5314`
|
|
227
197
|
*/
|
|
228
|
-
|
|
198
|
+
url: string;
|
|
229
199
|
}
|
|
230
200
|
|
|
231
201
|
/**
|
|
@@ -286,7 +256,7 @@ export interface AgentSessionSetInput {
|
|
|
286
256
|
* - 这里接受运行中的模型实例,而不是模型 ID。
|
|
287
257
|
* - 由于模型实例通常不可序列化,落盘只保留轻量可读标签用于展示。
|
|
288
258
|
*/
|
|
289
|
-
model?:
|
|
259
|
+
model?: AgentModel;
|
|
290
260
|
}
|
|
291
261
|
|
|
292
262
|
/**
|
|
@@ -475,8 +445,9 @@ export interface AgentSessionSummary {
|
|
|
475
445
|
* 当前 session 可读标题。
|
|
476
446
|
*
|
|
477
447
|
* 说明(中文)
|
|
478
|
-
* -
|
|
479
|
-
* -
|
|
448
|
+
* - 标题持久化在 session `meta.json` 顶层。
|
|
449
|
+
* - 首条用户消息出现后,SDK 会优先生成标题,失败时回退到首条用户消息截断。
|
|
450
|
+
* - 空 session 可能暂时没有标题,调用方可回退到 `sessionId`。
|
|
480
451
|
*/
|
|
481
452
|
title?: string;
|
|
482
453
|
|
|
@@ -24,18 +24,19 @@ export interface AgentProjectInitializationInput {
|
|
|
24
24
|
projectRoot: string;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* agent
|
|
27
|
+
* agent 唯一标识。
|
|
28
28
|
*
|
|
29
29
|
* 关键点(中文)
|
|
30
|
-
* -
|
|
30
|
+
* - 为空时会自动回退到目录名推导出的默认 id。
|
|
31
|
+
* - 该字段会直接写入 `downcity.json.id`。
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
id?: string;
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* 项目执行绑定配置。
|
|
36
37
|
*
|
|
37
38
|
* 说明(中文)
|
|
38
|
-
* -
|
|
39
|
+
* - 绑定 City AIService 暴露的模型 ID。
|
|
39
40
|
*/
|
|
40
41
|
execution: ExecutionBindingConfig;
|
|
41
42
|
|
|
@@ -71,9 +72,9 @@ export interface AgentProjectInitializationResult {
|
|
|
71
72
|
projectRoot: string;
|
|
72
73
|
|
|
73
74
|
/**
|
|
74
|
-
* 最终写入的 agent
|
|
75
|
+
* 最终写入的 agent id。
|
|
75
76
|
*/
|
|
76
|
-
|
|
77
|
+
id: string;
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
80
|
* 最终启用的 chat channels。
|