@downcity/agent 1.1.204 → 1.1.206
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/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +1 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +3 -2
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js.map +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/init/SOUL.md.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/init/SOUL.md.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/init/SOUL.md.js +1 -1
- package/bin/executor/composer/system/default/assets/init/SOUL.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.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/plugin.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/plugin.prompt.js.map +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/task.prompt.js.map +1 -1
- package/bin/executor/composer/system/default/variables/VariableReplacer.js +1 -1
- package/bin/executor/composer/system/default/variables/VariableReplacer.js.map +1 -1
- package/bin/session/SessionTitle.d.ts.map +1 -1
- package/bin/session/SessionTitle.js +16 -8
- package/bin/session/SessionTitle.js.map +1 -1
- package/bin/types/runtime/auth/AuthPermission.js +3 -3
- package/bin/types/runtime/auth/AuthPermission.js.map +1 -1
- package/package.json +1 -1
- package/scripts/agent-ready.test.mjs +1 -2
- package/scripts/session-title-event.test.mjs +49 -24
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +4 -2
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +44 -42
- 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 +10 -11
- package/src/executor/composer/system/default/assets/init/SOUL.md.ts +1 -1
- package/src/executor/composer/system/default/assets/init/SOUL.md.ts.txt +58 -60
- package/src/executor/composer/system/default/assets/plugin.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/plugin.prompt.ts.txt +13 -13
- package/src/executor/composer/system/default/assets/task.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/task.prompt.ts.txt +28 -28
- package/src/executor/composer/system/default/variables/VariableReplacer.ts +1 -1
- package/src/session/SessionTitle.ts +16 -8
- package/src/types/runtime/auth/AuthPermission.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -144,7 +144,7 @@ export function buildRuntimeClockSystemPrompt(options?: {
|
|
|
144
144
|
const now = new Date();
|
|
145
145
|
return [
|
|
146
146
|
"# Runtime Clock Context",
|
|
147
|
-
"
|
|
147
|
+
"The following fields are the authoritative time context for this run. Prefer them when resolving relative time expressions such as today, tomorrow, or a specific hour:",
|
|
148
148
|
`- current_date: ${formatDateInTimezone(now, timezone)}`,
|
|
149
149
|
`- current_time: ${formatDateTimeInTimezone(now, timezone)}`,
|
|
150
150
|
`- timezone: ${timezone}`,
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* - 当 title 仍为空时,后续执行链路可以再次尝试生成。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { streamText, type LanguageModel } from "ai";
|
|
11
|
+
import { buildOpenAIResponsesProviderOptions } from "@executor/messages/SessionMessageCodec.js";
|
|
11
12
|
import type { SessionHistoryMetaV1 } from "@/executor/types/SessionHistoryMeta.js";
|
|
12
13
|
import type { SessionRecordV1 } from "@/executor/types/SessionRecords.js";
|
|
13
14
|
import { is_session_message_record } from "@/executor/types/SessionRecords.js";
|
|
@@ -203,19 +204,25 @@ async function generateSessionTitle(input: {
|
|
|
203
204
|
*/
|
|
204
205
|
logger?: Logger;
|
|
205
206
|
}): Promise<string | undefined> {
|
|
207
|
+
let observedStreamError: unknown;
|
|
206
208
|
try {
|
|
207
|
-
const result =
|
|
209
|
+
const result = streamText({
|
|
208
210
|
model: input.model,
|
|
209
211
|
system:
|
|
210
|
-
"
|
|
212
|
+
"You generate minimal conversation titles. Output only the title itself, with no explanation and no quotation marks.",
|
|
211
213
|
prompt: [
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
+
"Generate a short conversation title from the first user message below.",
|
|
215
|
+
"Requirements: 3 to 12 Chinese characters or 2 to 6 English words; no period; no prefix.",
|
|
214
216
|
"",
|
|
215
217
|
input.firstUserText,
|
|
216
218
|
].join("\n"),
|
|
219
|
+
providerOptions: buildOpenAIResponsesProviderOptions(),
|
|
220
|
+
onError: ({ error }) => {
|
|
221
|
+
observedStreamError = error;
|
|
222
|
+
},
|
|
217
223
|
});
|
|
218
|
-
const
|
|
224
|
+
const text = await result.text;
|
|
225
|
+
const generatedTitle = normalizeGeneratedTitle(text);
|
|
219
226
|
if (!generatedTitle) {
|
|
220
227
|
await logSessionTitleDiagnostic({
|
|
221
228
|
logger: input.logger,
|
|
@@ -225,12 +232,13 @@ async function generateSessionTitle(input: {
|
|
|
225
232
|
details: {
|
|
226
233
|
modelLabel: input.modelLabel || null,
|
|
227
234
|
firstUserTextLength: input.firstUserText.length,
|
|
228
|
-
rawTitleLength: String(
|
|
235
|
+
rawTitleLength: String(text || "").length,
|
|
229
236
|
},
|
|
230
237
|
});
|
|
231
238
|
}
|
|
232
239
|
return generatedTitle;
|
|
233
240
|
} catch (error) {
|
|
241
|
+
const effectiveError = observedStreamError || error;
|
|
234
242
|
await logSessionTitleDiagnostic({
|
|
235
243
|
logger: input.logger,
|
|
236
244
|
sessionId: input.sessionId,
|
|
@@ -239,7 +247,7 @@ async function generateSessionTitle(input: {
|
|
|
239
247
|
details: {
|
|
240
248
|
modelLabel: input.modelLabel || null,
|
|
241
249
|
firstUserTextLength: input.firstUserText.length,
|
|
242
|
-
...summarizeTitleError(
|
|
250
|
+
...summarizeTitleError(effectiveError),
|
|
243
251
|
},
|
|
244
252
|
});
|
|
245
253
|
// 关键点(中文):标题生成失败不能影响 session 主流程。
|
|
@@ -93,19 +93,19 @@ export interface AuthDefaultRoleDefinition {
|
|
|
93
93
|
export const AUTH_DEFAULT_ROLES: AuthDefaultRoleDefinition[] = [
|
|
94
94
|
{
|
|
95
95
|
name: "admin",
|
|
96
|
-
description: "
|
|
96
|
+
description: "System administrator who can manage unified accounts and all control-plane capabilities.",
|
|
97
97
|
permissions: [...AUTH_PERMISSION_KEYS],
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
name: "operator",
|
|
101
|
-
description: "
|
|
101
|
+
description: "Operations role that can view and operate the runtime but cannot manage unified accounts.",
|
|
102
102
|
permissions: AUTH_PERMISSION_KEYS.filter((permission) =>
|
|
103
103
|
permission !== "auth.write" && permission !== "auth.read"
|
|
104
104
|
),
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
name: "viewer",
|
|
108
|
-
description: "
|
|
108
|
+
description: "Read-only role that can view status but cannot perform high-risk changes.",
|
|
109
109
|
permissions: [
|
|
110
110
|
"agent.read",
|
|
111
111
|
"task.read",
|