@yuriai/web 0.2.8-beta.1 → 0.2.8-beta.3
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/assets/{AgentAvatar-MzDm6uBf.js → AgentAvatar--DsfGfhZ.js} +1 -1
- package/dist/assets/{AssistantView-Df-G2DX8.js → AssistantView-Bf19-qvJ.js} +3 -3
- package/dist/assets/{DiagramView-BoVqJRQb.js → DiagramView-UvYyjtWA.js} +1 -1
- package/dist/assets/{FadeInOnReveal-DkmfVoTO.js → FadeInOnReveal-NAFOww9Y.js} +1 -1
- package/dist/assets/{GuiPluginSurface-DxLoeTDb.js → GuiPluginSurface-DNzJNcMh.js} +1 -1
- package/dist/assets/{GuiPluginWindow-dDG5Uyqb.js → GuiPluginWindow-C73klYx3.js} +1 -1
- package/dist/assets/{Icon-BjiyvtB2.js → Icon-Cy25fgQb.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-CUKFQTAG.js → ImageLoadingPlaceholder-DGRjdn_K.js} +1 -1
- package/dist/assets/{LoadingImage-B7cT_4Oe.js → LoadingImage-2pPdTFHh.js} +1 -1
- package/dist/assets/{MarkdownRenderer-DYi_qpYy.js → MarkdownRenderer-GuwP9qiJ.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-CMxRMFqp.js → MarkdownRendererImpl-tHItN1IG.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-DQ4urBZW.js → MarkstreamRendererImpl-Dh13e1UE.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-C4fJlKdu.js → MobileDetailNavigation-CSxBgVuQ.js} +1 -1
- package/dist/assets/{MobileResizableSheet-C9YzOQis.js → MobileResizableSheet-BN07cmQQ.js} +1 -1
- package/dist/assets/{MobileShareBridge-DLC-TdRy.js → MobileShareBridge-7SAELdqu.js} +1 -1
- package/dist/assets/MobileTabPageHeader-Bbb36BtD.js +2 -0
- package/dist/assets/{MultiRunWindow-Cwp8-_Wh.js → MultiRunWindow-DbI9KTph.js} +1 -1
- package/dist/assets/{OnboardingScreen-D6iQ5qjF.js → OnboardingScreen-rp0qwvgz.js} +1 -1
- package/dist/assets/{OverlayScrollbar-Dbx1atD-.js → OverlayScrollbar-B--v-oQW.js} +1 -1
- package/dist/assets/{SettingsView-CYDk0wpN.js → SettingsView-C1AQoEIQ.js} +1 -1
- package/dist/assets/{SettingsWindow-Vuzphf9b.js → SettingsWindow-6M0ssWHM.js} +1 -1
- package/dist/assets/{TerminalView-Dhalx6_Z.js → TerminalView-bhL6Ccen.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DBxSxWNh.js → ToolOutputDialog-BaLKI3Yc.js} +1 -1
- package/dist/assets/{YuriLogo-DvRSd5NN.js → YuriLogo-kwLWc5Hi.js} +1 -1
- package/dist/assets/{appThemeRegistry-JEhMXHGF.js → appThemeRegistry-Bk_N8btz.js} +1 -1
- package/dist/assets/{button-BSFWH-Ok.js → button-Dodw6LWV.js} +1 -1
- package/dist/assets/{capgoAdapter-BgD0wyhC.js → capgoAdapter-DqHX7fkj.js} +1 -1
- package/dist/assets/{collapsible-DaevjAvt.js → collapsible-C9kOfVDe.js} +1 -1
- package/dist/assets/{diagram-7OgmyecX.js → diagram-CfBQ9Icg.js} +1 -1
- package/dist/assets/{dialog-D1pXn_b9.js → dialog-D0bq7nr2.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-CGHPvEgD.js → dropdown-menu.styles-CLxDPSrk.js} +1 -1
- package/dist/assets/{es-DJzbuYpv.js → es-Diy_UpPF.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-BQdfRBkk.js → fileMentionTouchSelection-C16Q21Ht.js} +1 -1
- package/dist/assets/{fr-YDYbYIZQ.js → fr-CPRTMaky.js} +1 -1
- package/dist/assets/{gitApi-DhDVqj9b.js → gitApi-_yKaBF0a.js} +1 -1
- package/dist/assets/{input-BhHXFla6.js → input-HddqDhRi.js} +1 -1
- package/dist/assets/{insertionBoundaries-BMe1F3uB.js → insertionBoundaries-CHqJLwJg.js} +1 -1
- package/dist/assets/{ja-SjX3NBJz.js → ja-Cc1jn0Ag.js} +1 -1
- package/dist/assets/{ko-BxcUEWjB.js → ko-CfHUuNNe.js} +1 -1
- package/dist/assets/{main-DXlMu2LF.js → main-Bja5DG1P.js} +2 -2
- package/dist/assets/{main-CfOYzhn0.js → main-njE9rVzm.js} +4 -4
- package/dist/assets/{markdownHeightCache-DV2j4PlS.js → markdownHeightCache-BQiIj0aM.js} +1 -1
- package/dist/assets/{mcpQueries-vxcQAIGB.js → mcpQueries-uM1Chfdc.js} +1 -1
- package/dist/assets/{miniChat-D48iGEEW.js → miniChat-DAwBa-3U.js} +2 -2
- package/dist/assets/{mobile-Cy5qSiDY.js → mobile-BQmrdXmD.js} +2 -2
- package/dist/assets/{mobileBackNavigation-QtBK9OSb.js → mobileBackNavigation-DsU3qQ8W.js} +1 -1
- package/dist/assets/{multirun-BR9a6EBo.js → multirun-DRL1Wf-K.js} +1 -1
- package/dist/assets/{native-config-CHySeHif.js → native-config-BMflOjo8.js} +1 -1
- package/dist/assets/{pl-vh0XFuDb.js → pl-mUyhvp8O.js} +1 -1
- package/dist/assets/{projectMeta-Bn2vBNDe.js → projectMeta-DK-kl6vM.js} +1 -1
- package/dist/assets/{pt-BR-Cv5tssQz.js → pt-BR-D3E4Wxao.js} +1 -1
- package/dist/assets/{readiness-BAssoNVf.js → readiness-CMHDs1YN.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-B9Kci_8q.js → renderElectronMiniChatApp-CkSP0eQz.js} +2 -2
- package/dist/assets/{renderMobileApp-CBivL8Ps.js → renderMobileApp-wELnHLDT.js} +4 -4
- package/dist/assets/{runtimeConfig-COdEwlK-.js → runtimeConfig-KpW0l510.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-D3x76Qpf.js → runtimeEndpointReset-BBxpXfkE.js} +3 -3
- package/dist/assets/{scheduledTaskNavigation-BZ3B5bpN.js → scheduledTaskNavigation-CyPkVBKs.js} +1 -1
- package/dist/assets/{sessionChangeSummary-Dtgq0CWg.js → sessionChangeSummary-Bb7dqAie.js} +1 -1
- package/dist/assets/{sessionLookup--Wlr3e8X.js → sessionLookup-D_P3C7rX.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-BnTV_KYG.js → sortable-tabs-strip-C-qSUWlr.js} +1 -1
- package/dist/assets/{speechSettingsQueries-D3fc_4Iy.js → speechSettingsQueries-BSBjx3wG.js} +1 -1
- package/dist/assets/src-CbY9YJrh.css +2 -0
- package/dist/assets/{store-CgQdmzpX.js → store-FxBFwq--.js} +2 -2
- package/dist/assets/{textarea-Deh9E1KP.js → textarea-BvfW0tsL.js} +1 -1
- package/dist/assets/{tooltip-DygQ-2xe.js → tooltip-BmKpb74n.js} +1 -1
- package/dist/assets/{types-D8_26ZKT.js → types-rJezumB4.js} +1 -1
- package/dist/assets/{uk-3a9vdLJ-.js → uk-D9iQbGbr.js} +1 -1
- package/dist/assets/{useAppFontEffects-DLT9jVl1.js → useAppFontEffects-DZ1W3_cy.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-BNAZWH9L.js → useDesktopWindowControlsLayout-D_1DLCOD.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-D2_-KCB7.js → useEffectiveDirectory-joUiryc3.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DJwk64Po.js → useMobileNavigationStore-BaQ7TIpx.js} +6 -6
- package/dist/assets/{useWorkerHighlightedLines-k48txabk.js → useWorkerHighlightedLines-CiU1xPjX.js} +1 -1
- package/dist/assets/{zh-CN-kwaUr5W5.js → zh-CN-mNVX6pMK.js} +1 -1
- package/dist/assets/{zh-TW-BBs44W7l.js → zh-TW-B7T0e-Qv.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +6 -6
- package/package.json +1 -1
- package/server/lib/assistants/DOCUMENTATION.md +18 -15
- package/server/lib/assistants/bubbles.js +0 -14
- package/server/lib/assistants/bubbles.test.js +1 -18
- package/server/lib/assistants/contact-tools.js +179 -211
- package/server/lib/assistants/contact-tools.test.js +35 -161
- package/server/lib/assistants/harness.js +76 -238
- package/server/lib/assistants/harness.test.js +255 -279
- package/server/lib/assistants/memory.http.test.js +2 -2
- package/server/lib/assistants/pi-tools.js +1 -54
- package/server/lib/assistants/pi-tools.test.js +5 -9
- package/server/lib/assistants/routes.js +1 -0
- package/server/lib/assistants/service.js +66 -1
- package/server/lib/assistants/service.test.js +60 -42
- package/server/lib/llm/DOCUMENTATION.md +3 -0
- package/server/lib/llm/completions.js +2 -1
- package/server/lib/llm/completions.test.js +9 -0
- package/server/lib/opencode/feature-routes-runtime.js +1 -0
- package/server/lib/scheduled-tasks/runtime.test.js +3 -3
- package/dist/assets/MobileTabPageHeader-CMbbtHh7.js +0 -2
- package/dist/assets/src-NlrSCyPZ.css +0 -2
|
@@ -20,8 +20,8 @@ const listen = async (app) => {
|
|
|
20
20
|
closers.push(() => new Promise((resolve) => { server.close(resolve); server.closeAllConnections(); }));
|
|
21
21
|
return `http://127.0.0.1:${server.address().port}`;
|
|
22
22
|
};
|
|
23
|
-
const final = (text) => ({ text
|
|
24
|
-
const call = (name, args) => ({
|
|
23
|
+
const final = (text) => ({ text });
|
|
24
|
+
const call = (name, args) => ({ completion: { choices: [{ message: { content: '', tool_calls: [{ id: `call_${name}`, type: 'function', function: { name, arguments: JSON.stringify(args) } }] } }] } });
|
|
25
25
|
const resultFor = (body, name) => {
|
|
26
26
|
const row = body.messages.findLast((m) => m.role === 'tool' && m.name === name);
|
|
27
27
|
if (!row) return null;
|
|
@@ -71,46 +71,8 @@ const bindHarnessTool = (tool, context) => ({
|
|
|
71
71
|
),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
* Serialize a tool parameter schema for the contact system prompt.
|
|
76
|
-
* Mirrors contact-tools.serializeToolParametersForPrompt without a circular import.
|
|
77
|
-
*/
|
|
78
|
-
const serializeParameters = (parameters) => {
|
|
79
|
-
if (parameters == null) return '{"type":"object","properties":{}}';
|
|
80
|
-
try {
|
|
81
|
-
const text = JSON.stringify(parameters, (_key, value) => {
|
|
82
|
-
if (typeof value === 'function' || typeof value === 'symbol') return undefined;
|
|
83
|
-
return value;
|
|
84
|
-
});
|
|
85
|
-
if (typeof text === 'string' && text.trim() && text !== 'undefined') return text;
|
|
86
|
-
} catch {
|
|
87
|
-
// Fall through.
|
|
88
|
-
}
|
|
89
|
-
return '{"type":"object","properties":{}}';
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const formatCodingToolEntry = (tool) => {
|
|
93
|
-
if (!tool || typeof tool.name !== 'string' || !tool.name.trim()) return '';
|
|
94
|
-
const name = tool.name.trim();
|
|
95
|
-
const description = typeof tool.description === 'string' && tool.description.trim()
|
|
96
|
-
? tool.description.trim()
|
|
97
|
-
: name;
|
|
98
|
-
return `- ${name}: ${description}\n arguments schema: ${serializeParameters(tool.parameters)}`;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export function formatPiCodingPrompt({ cwd, skillsPrompt = '', tools = [] } = {}) {
|
|
74
|
+
export function formatPiCodingPrompt({ cwd, skillsPrompt = '' } = {}) {
|
|
102
75
|
if (typeof cwd !== 'string' || !cwd.trim()) return '';
|
|
103
|
-
const codingTools = Array.isArray(tools)
|
|
104
|
-
? tools.filter((tool) => isPiCodingToolName(tool?.name))
|
|
105
|
-
: [];
|
|
106
|
-
const catalog = codingTools.length > 0
|
|
107
|
-
? codingTools.map(formatCodingToolEntry).filter(Boolean)
|
|
108
|
-
: [
|
|
109
|
-
'- bash: Execute a bash command in the working directory.\n arguments schema: {"type":"object","required":["command"],"properties":{"command":{"type":"string"},"timeout":{"type":"number"}}}',
|
|
110
|
-
'- read: Read a file (path required; optional offset/limit).\n arguments schema: {"type":"object","required":["path"],"properties":{"path":{"type":"string"},"offset":{"type":"number"},"limit":{"type":"number"}}}',
|
|
111
|
-
'- write: Write/create a file (path + content required).\n arguments schema: {"type":"object","required":["path","content"],"properties":{"path":{"type":"string"},"content":{"type":"string"}}}',
|
|
112
|
-
'- edit: Exact text replacement (path + edits[{oldText,newText}] required).\n arguments schema: {"type":"object","required":["path","edits"],"properties":{"path":{"type":"string"},"edits":{"type":"array","items":{"type":"object","required":["oldText","newText"],"properties":{"oldText":{"type":"string"},"newText":{"type":"string"}}}}}}',
|
|
113
|
-
];
|
|
114
76
|
return [
|
|
115
77
|
`Working directory: ${cwd}`,
|
|
116
78
|
'You have application-owned pi coding tools in this directory: read, write, edit, bash.',
|
|
@@ -119,21 +81,6 @@ export function formatPiCodingPrompt({ cwd, skillsPrompt = '', tools = [] } = {}
|
|
|
119
81
|
'This is your working directory. Ignore any other cwd from the environment, including temporary generator workspaces under /var/folders or os.tmpdir.',
|
|
120
82
|
'When the user asks pwd, the current directory, or to look at files, call bash/read yourself. Never say you have no terminal or cannot read or write files.',
|
|
121
83
|
'Skills are merged from ~/.claude/skills, ~/.agents/skills, and this project\'s .claude/skills plus .agents/skills (project wins on name). Read a skill file when the task matches its description.',
|
|
122
|
-
'Call these tools with the same fenced JSON as other tools. Match the argument schemas exactly:',
|
|
123
|
-
'```yuri-tool',
|
|
124
|
-
'{"name":"bash","arguments":{"command":"pwd"}}',
|
|
125
|
-
'```',
|
|
126
|
-
'```yuri-tool',
|
|
127
|
-
'{"name":"read","arguments":{"path":".agents/skills/example/SKILL.md"}}',
|
|
128
|
-
'```',
|
|
129
|
-
'```yuri-tool',
|
|
130
|
-
'{"name":"write","arguments":{"path":"notes.txt","content":"hello"}}',
|
|
131
|
-
'```',
|
|
132
|
-
'```yuri-tool',
|
|
133
|
-
'{"name":"edit","arguments":{"path":"notes.txt","edits":[{"oldText":"hello","newText":"hello world"}]}}',
|
|
134
|
-
'```',
|
|
135
|
-
'Available pi coding tools (full argument schemas):',
|
|
136
|
-
...catalog,
|
|
137
84
|
typeof skillsPrompt === 'string' && skillsPrompt.trim() ? skillsPrompt.trim() : '',
|
|
138
85
|
].filter(Boolean).join('\n');
|
|
139
86
|
}
|
|
@@ -86,22 +86,18 @@ describe('mergeSkillsByName', () => {
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
describe('formatPiCodingPrompt', () => {
|
|
89
|
-
it('
|
|
89
|
+
it('names the pi coding tools without a schema catalog and distinguishes skills from tools', async () => {
|
|
90
90
|
const cwd = temp();
|
|
91
91
|
const home = temp();
|
|
92
92
|
const runtime = await createPiCodingRuntime(cwd, { homeDir: home });
|
|
93
93
|
const prompt = formatPiCodingPrompt({
|
|
94
94
|
cwd: runtime.cwd,
|
|
95
95
|
skillsPrompt: runtime.skillsPrompt,
|
|
96
|
-
tools: runtime.tools,
|
|
97
96
|
});
|
|
98
|
-
expect(prompt).toContain('
|
|
99
|
-
expect(prompt).toContain('
|
|
100
|
-
expect(prompt).toContain('"
|
|
101
|
-
expect(prompt).toContain('
|
|
102
|
-
expect(prompt).toContain('"oldText"');
|
|
103
|
-
expect(prompt).toContain('"newText"');
|
|
104
|
-
expect(prompt).toContain('"command"');
|
|
97
|
+
expect(prompt).toContain('read, write, edit, bash');
|
|
98
|
+
expect(prompt).not.toContain('arguments schema:');
|
|
99
|
+
expect(prompt).not.toContain('"oldText"');
|
|
100
|
+
expect(prompt).not.toContain('yuri-tool');
|
|
105
101
|
expect(prompt).toContain('not OpenCode native tools and not MCP');
|
|
106
102
|
expect(prompt).toContain('never invent skill or MCP tool names');
|
|
107
103
|
expect(prompt).toContain('context7');
|
|
@@ -33,6 +33,7 @@ export const registerAssistantRoutes = (app, dependencies) => {
|
|
|
33
33
|
listScheduledTasks: dependencies.listScheduledTasks,
|
|
34
34
|
sessionIndexService: dependencies.sessionIndexService,
|
|
35
35
|
upsertScheduledTask: dependencies.upsertScheduledTask,
|
|
36
|
+
patchScheduledTask: dependencies.patchScheduledTask,
|
|
36
37
|
syncScheduledTaskProject: dependencies.syncScheduledTaskProject,
|
|
37
38
|
globalEventHub: dependencies.globalEventHub,
|
|
38
39
|
onRevisionTip: dependencies.onRevisionTip,
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
normalizeConnectedModels,
|
|
61
61
|
normalizeRegisteredProjects,
|
|
62
62
|
sanitizeRegisteredProject,
|
|
63
|
+
summarizeScheduledTask,
|
|
63
64
|
} from './contact-tools.js';
|
|
64
65
|
import {
|
|
65
66
|
AssignError,
|
|
@@ -236,7 +237,7 @@ const awaitWithDeadline = async (work, ms = CONTACT_CATALOG_DEADLINE_MS, code =
|
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
239
|
|
|
239
|
-
export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, getOpenCodeAuthHeaders, getServerId = async () => null, getAllowedRoots = () => [], listProjects = async () => [], readModelPreferences = async () => null, listScheduledTasks = null, sessionIndexService = null, upsertScheduledTask = null, syncScheduledTaskProject = null, globalEventHub = null, onRevisionTip = null, onContactTurnEvent = null, onContactTurnComplete = null, /** Host archive op: ({ sessionID, directory, archivedAt }) => Promise */ archiveSessionHost = null, /** Idempotent Host metadata drop after successful SDK delete */ forgetSessionHost = null, /** Host store write: (sessionId, patch) => Promise */ persistSessionMetadata = null, /** After Host isolation metadata is committed. */ onSystemSessionPersisted = null, clock = () => Date.now(), setIntervalFn = setInterval, clearIntervalFn = clearInterval, setImmediateFn = setImmediate, reconcileIntervalMs = 60_000, clientFactory, fetchImpl, createChatCompletion = null, runContactTurn = defaultRunContactTurn, listWorktrees = defaultListWorktrees } = {}) => {
|
|
240
|
+
export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, getOpenCodeAuthHeaders, getServerId = async () => null, getAllowedRoots = () => [], listProjects = async () => [], readModelPreferences = async () => null, listScheduledTasks = null, sessionIndexService = null, upsertScheduledTask = null, patchScheduledTask = null, syncScheduledTaskProject = null, globalEventHub = null, onRevisionTip = null, onContactTurnEvent = null, onContactTurnComplete = null, /** Host archive op: ({ sessionID, directory, archivedAt }) => Promise */ archiveSessionHost = null, /** Idempotent Host metadata drop after successful SDK delete */ forgetSessionHost = null, /** Host store write: (sessionId, patch) => Promise */ persistSessionMetadata = null, /** After Host isolation metadata is committed. */ onSystemSessionPersisted = null, clock = () => Date.now(), setIntervalFn = setInterval, clearIntervalFn = clearInterval, setImmediateFn = setImmediate, reconcileIntervalMs = 60_000, clientFactory, fetchImpl, createChatCompletion = null, runContactTurn = defaultRunContactTurn, listWorktrees = defaultListWorktrees } = {}) => {
|
|
240
241
|
if (!dbPath || !dataDir) return null;
|
|
241
242
|
const Database = require('better-sqlite3');
|
|
242
243
|
fs.mkdirSync(path.dirname(dbPath), { recursive: true });
|
|
@@ -2489,6 +2490,66 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
2489
2490
|
prompt: upserted?.task?.execution?.prompt || params.prompt,
|
|
2490
2491
|
};
|
|
2491
2492
|
};
|
|
2493
|
+
const listScheduledTaskWork = async (params = {}) => {
|
|
2494
|
+
if (typeof listScheduledTasks !== 'function') throw new AssignError(ASSIGN_CODES.UPSTREAM, 'Listing scheduled tasks is unavailable.');
|
|
2495
|
+
const projects = normalizeRegisteredProjects(await listProjects());
|
|
2496
|
+
const scope = typeof params.projectPath === 'string' ? params.projectPath.trim() : '';
|
|
2497
|
+
const scoped = scope ? projects.filter((project) => project.id === scope || path.resolve(project.path) === path.resolve(scope)) : projects;
|
|
2498
|
+
if (scope && scoped.length === 0) throw new AssignError(ASSIGN_CODES.PROJECT_REQUIRED, 'No registered project matches that projectPath.');
|
|
2499
|
+
const query = typeof params.query === 'string' ? params.query.trim().toLowerCase() : '';
|
|
2500
|
+
const tasks = [];
|
|
2501
|
+
const failed = [];
|
|
2502
|
+
for (const project of scoped) {
|
|
2503
|
+
try {
|
|
2504
|
+
const listed = await listScheduledTasks(project.id);
|
|
2505
|
+
if (!Array.isArray(listed)) throw new Error('Invalid scheduled task list');
|
|
2506
|
+
for (const task of listed) {
|
|
2507
|
+
const summary = { ...summarizeScheduledTask(task, project.id), projectPath: project.path };
|
|
2508
|
+
if (query && !JSON.stringify([summary.id, summary.name, summary.providerID, summary.modelID, task?.execution?.prompt]).toLowerCase().includes(query)) continue;
|
|
2509
|
+
tasks.push(summary);
|
|
2510
|
+
}
|
|
2511
|
+
} catch {
|
|
2512
|
+
// One unreadable project must not hide the others.
|
|
2513
|
+
failed.push({ projectID: project.id, projectPath: project.path });
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
return { tasks, ...(failed.length > 0 ? { partial: true, failed } : {}) };
|
|
2517
|
+
};
|
|
2518
|
+
const updateScheduledTaskWork = async (row, params, signal) => {
|
|
2519
|
+
signal?.throwIfAborted();
|
|
2520
|
+
if (typeof patchScheduledTask !== 'function') throw new AssignError(ASSIGN_CODES.UPSTREAM, 'Updating a scheduled task is unavailable.');
|
|
2521
|
+
const projects = normalizeRegisteredProjects(await listProjects());
|
|
2522
|
+
if (!projects.some((project) => project.id === params.projectID)) throw new AssignError(ASSIGN_CODES.PROJECT_REQUIRED, 'projectID must be a registered project from list_scheduled_tasks.');
|
|
2523
|
+
const execution = {};
|
|
2524
|
+
if (typeof params.prompt === 'string' && params.prompt.trim()) execution.prompt = params.prompt;
|
|
2525
|
+
if (params.providerID || params.modelID || params.model) {
|
|
2526
|
+
const workerModel = resolveAssignWorkerModel({ providerID: params.providerID, modelID: params.modelID, model: params.model,
|
|
2527
|
+
fallback: { providerID: row.provider_id, modelID: row.model_id }, catalog: await loadAssignCatalog(signal) });
|
|
2528
|
+
execution.providerID = workerModel.providerID;
|
|
2529
|
+
execution.modelID = workerModel.modelID;
|
|
2530
|
+
}
|
|
2531
|
+
const schedule = {};
|
|
2532
|
+
for (const key of ['kind', 'time', 'timezone', 'date', 'cron']) {
|
|
2533
|
+
if (typeof params[key] === 'string' && params[key].trim()) schedule[key] = params[key].trim();
|
|
2534
|
+
}
|
|
2535
|
+
if (typeof params.weekdays === 'string' && params.weekdays.trim()) schedule.weekdays = params.weekdays.split(',').map((item) => Number(item.trim())).filter((item) => Number.isInteger(item));
|
|
2536
|
+
if (schedule.time) schedule.times = [schedule.time];
|
|
2537
|
+
const patch = {
|
|
2538
|
+
...(typeof params.name === 'string' && params.name.trim() ? { name: params.name.trim() } : {}),
|
|
2539
|
+
...(params.enabled === 'true' || params.enabled === true ? { enabled: true } : {}),
|
|
2540
|
+
...(params.enabled === 'false' || params.enabled === false ? { enabled: false } : {}),
|
|
2541
|
+
...(Object.keys(schedule).length > 0 ? { schedule } : {}),
|
|
2542
|
+
...(Object.keys(execution).length > 0 ? { execution } : {}),
|
|
2543
|
+
};
|
|
2544
|
+
if (Object.keys(patch).length === 0) throw new AssignError(ASSIGN_CODES.VALIDATION, 'update_scheduled_task needs at least one field to change.');
|
|
2545
|
+
signal?.throwIfAborted();
|
|
2546
|
+
const patched = await patchScheduledTask(params.projectID, params.taskID, patch);
|
|
2547
|
+
if (!patched?.task) throw new AssignError(ASSIGN_CODES.VALIDATION, 'Scheduled task not found. Use an exact taskID from list_scheduled_tasks.');
|
|
2548
|
+
if (typeof syncScheduledTaskProject === 'function') {
|
|
2549
|
+
try { await syncScheduledTaskProject(params.projectID); } catch { /* The saved config stays authoritative; the scheduler reloads it on its next sync. */ }
|
|
2550
|
+
}
|
|
2551
|
+
return { task: patched.task, projectID: params.projectID };
|
|
2552
|
+
};
|
|
2492
2553
|
const listSessionsFromIndex = (params = {}) => {
|
|
2493
2554
|
if (!sessionIndexService || typeof sessionIndexService.snapshot !== 'function') {
|
|
2494
2555
|
throw new AssignError(ASSIGN_CODES.UPSTREAM, 'Session index is unavailable.');
|
|
@@ -2867,6 +2928,8 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
2867
2928
|
deleteSession: (params) => mutateSessionWork('delete', params),
|
|
2868
2929
|
createAssistant: (toolInput) => createAssistant(toolInput),
|
|
2869
2930
|
scheduleTask: (params) => scheduleWork(live, params),
|
|
2931
|
+
listScheduledTasks: (params) => listScheduledTaskWork(params),
|
|
2932
|
+
updateScheduledTask: (params) => updateScheduledTaskWork(live, params, controller.signal),
|
|
2870
2933
|
deliverPeerMessage: (toolInput) => deliverPeerMessage(assistantID, toolInput),
|
|
2871
2934
|
clearContactMemory: () => {
|
|
2872
2935
|
const result = clearContactMemory(assistantID, {});
|
|
@@ -3224,6 +3287,8 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
3224
3287
|
deleteSession: (params) => mutateSessionWork('delete', params),
|
|
3225
3288
|
createAssistant: (toolInput) => createAssistant(toolInput),
|
|
3226
3289
|
scheduleTask: (params) => scheduleWork(row, params),
|
|
3290
|
+
listScheduledTasks: (params) => listScheduledTaskWork(params),
|
|
3291
|
+
updateScheduledTask: (params) => updateScheduledTaskWork(row, params, controller.signal),
|
|
3227
3292
|
deliverPeerMessage: (toolInput) => deliverPeerMessage(row.assistant_id, toolInput),
|
|
3228
3293
|
clearContactMemory: () => {
|
|
3229
3294
|
// Cap the watermark at this turn's user ordinal — never global MAX,
|
|
@@ -114,6 +114,8 @@ const settleSend = async (service, assistantID, body) => {
|
|
|
114
114
|
return { ...sent, settled };
|
|
115
115
|
};
|
|
116
116
|
const assistantInput = { name: 'A', providerID: 'p', modelID: 'm' };
|
|
117
|
+
const toolBatch = (calls, content = '') => ({ completion: { choices: [{ message: { content, tool_calls: calls.map(([name, args, id = `call_${name}`]) => ({ id, type: 'function', function: { name, arguments: JSON.stringify(args) } })) } }] } });
|
|
118
|
+
const sayThen = (text, name, args) => toolBatch([['notify_user', { text }], [name, args]]);
|
|
117
119
|
|
|
118
120
|
describe('assistants service', () => {
|
|
119
121
|
it('migrates legacy avatar seeds and persists edits without changing identity', async () => {
|
|
@@ -3190,6 +3192,43 @@ describe('assistants service', () => {
|
|
|
3190
3192
|
service.close();
|
|
3191
3193
|
});
|
|
3192
3194
|
|
|
3195
|
+
it('lists scheduled tasks with partial failures and updates only the requested model', async () => {
|
|
3196
|
+
const directory = root();
|
|
3197
|
+
const patches = [];
|
|
3198
|
+
const synced = [];
|
|
3199
|
+
const task = { id: 'task_a', name: 'Weekly', enabled: true, schedule: { kind: 'daily', times: ['09:00'] }, execution: { prompt: 'review notes', providerID: 'old', modelID: 'old-model' } };
|
|
3200
|
+
let listed;
|
|
3201
|
+
let missing;
|
|
3202
|
+
let updated;
|
|
3203
|
+
const service = setup(directory, {
|
|
3204
|
+
provider: { list: async () => ({ data: [{ id: 'new-provider' }] }) },
|
|
3205
|
+
model: { list: async () => ({ data: [{ providerID: 'new-provider', id: 'new-model' }] }) },
|
|
3206
|
+
}, {
|
|
3207
|
+
listProjects: async () => [{ id: 'proj_a', path: directory }, { id: 'proj_bad', path: path.join(directory, 'bad') }],
|
|
3208
|
+
listScheduledTasks: async (projectID) => { if (projectID === 'proj_bad') throw new Error('unreadable'); return [task]; },
|
|
3209
|
+
patchScheduledTask: async (projectID, taskID, patch) => {
|
|
3210
|
+
patches.push({ projectID, taskID, patch });
|
|
3211
|
+
return { task: { ...task, execution: { ...task.execution, ...patch.execution } } };
|
|
3212
|
+
},
|
|
3213
|
+
syncScheduledTaskProject: async (projectID) => { synced.push(projectID); },
|
|
3214
|
+
runContactTurn: async ({ tools }) => {
|
|
3215
|
+
listed = await tools.find(tool => tool.name === 'list_scheduled_tasks').execute('call_list', {});
|
|
3216
|
+
const update = tools.find(tool => tool.name === 'update_scheduled_task');
|
|
3217
|
+
missing = await update.execute('call_missing', { projectID: 'proj_a', taskID: 'task_a', model: 'missing/not-real' });
|
|
3218
|
+
updated = await update.execute('call_update', { projectID: 'proj_a', taskID: 'task_a', model: 'new-provider/new-model' });
|
|
3219
|
+
return { text: 'done', bubbles: ['done'], cards: [updated.details.card], tools };
|
|
3220
|
+
},
|
|
3221
|
+
});
|
|
3222
|
+
const host = service.createAssistant(assistantInput);
|
|
3223
|
+
await settleSend(service, host.id, { messageID: 'client_update_schedule', parts: [{ type: 'text', text: '修改定时任务模型' }] });
|
|
3224
|
+
expect(listed.details).toMatchObject({ tasks: [{ id: 'task_a', projectID: 'proj_a' }], partial: true, failed: [{ projectID: 'proj_bad' }] });
|
|
3225
|
+
expect(missing.details.error).toBe('model_not_found');
|
|
3226
|
+
expect(patches).toEqual([{ projectID: 'proj_a', taskID: 'task_a', patch: { execution: { providerID: 'new-provider', modelID: 'new-model' } } }]);
|
|
3227
|
+
expect(synced).toEqual(['proj_a']);
|
|
3228
|
+
expect(updated.details.card).toMatchObject({ taskID: 'task_a' });
|
|
3229
|
+
service.close();
|
|
3230
|
+
});
|
|
3231
|
+
|
|
3193
3232
|
it('creates a scheduled task from schedule_task and persists the schedule card', async () => {
|
|
3194
3233
|
const directory = root();
|
|
3195
3234
|
const upserts = [];
|
|
@@ -3271,9 +3310,9 @@ describe('assistants service', () => {
|
|
|
3271
3310
|
backgroundTurns.push(input);
|
|
3272
3311
|
return realRunContactTurn({
|
|
3273
3312
|
...input,
|
|
3274
|
-
createChatCompletion: async () => (
|
|
3275
|
-
? '
|
|
3276
|
-
: '资料已整理:本周有两项相关更新。' }),
|
|
3313
|
+
createChatCompletion: async () => (silent
|
|
3314
|
+
? toolBatch([['stay_silent', {}]])
|
|
3315
|
+
: { text: '资料已整理:本周有两项相关更新。' }),
|
|
3277
3316
|
});
|
|
3278
3317
|
}
|
|
3279
3318
|
await input.tools.find((tool) => tool.name === 'schedule_task').execute('schedule', {
|
|
@@ -3710,7 +3749,7 @@ describe('assistants service', () => {
|
|
|
3710
3749
|
backgroundTurns.push(input);
|
|
3711
3750
|
return realRunContactTurn({
|
|
3712
3751
|
...input,
|
|
3713
|
-
createChatCompletion: async () => (
|
|
3752
|
+
createChatCompletion: async () => toolBatch([['stay_silent', {}]], '正在查看该会话的执行结果'),
|
|
3714
3753
|
});
|
|
3715
3754
|
},
|
|
3716
3755
|
});
|
|
@@ -4864,15 +4903,12 @@ describe('read_session referenced conversation', () => {
|
|
|
4864
4903
|
it('real harness two read_session preambles: SSE done bubbles match SQLite 1:1 including duplicates', async () => {
|
|
4865
4904
|
const directory = root();
|
|
4866
4905
|
const events = [];
|
|
4867
|
-
const fence = (name, args) => '```yuri-tool\n' + JSON.stringify({ name, arguments: args }) + '\n```';
|
|
4868
4906
|
const replies = [
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4907
|
+
sayThen('我去读一下', 'read_session', { sessionID: 'ses_a' }),
|
|
4908
|
+
sayThen('我再读一下', 'read_session', { sessionID: 'ses_b' }),
|
|
4909
|
+
{ text: '办好了' },
|
|
4872
4910
|
];
|
|
4873
|
-
const createChatCompletion = vi.fn(async () => ({
|
|
4874
|
-
completion: { choices: [{ message: { content: replies.shift() || '' } }] },
|
|
4875
|
-
}));
|
|
4911
|
+
const createChatCompletion = vi.fn(async () => replies.shift() || { text: '' });
|
|
4876
4912
|
const service = setup(directory, {
|
|
4877
4913
|
get: async ({ sessionID }) => ({
|
|
4878
4914
|
data: { id: sessionID, directory, title: sessionID },
|
|
@@ -4919,15 +4955,11 @@ describe('read_session referenced conversation', () => {
|
|
|
4919
4955
|
service.close();
|
|
4920
4956
|
});
|
|
4921
4957
|
|
|
4922
|
-
it('persists
|
|
4958
|
+
it('persists notify_user messages before tool completion, with no final replay', async () => {
|
|
4923
4959
|
const directory = root();
|
|
4924
4960
|
const events = [];
|
|
4925
|
-
let releaseGeneration;
|
|
4926
4961
|
let releaseTool;
|
|
4927
|
-
const generationGate = new Promise((resolve) => { releaseGeneration = resolve; });
|
|
4928
4962
|
const toolGate = new Promise((resolve) => { releaseTool = resolve; });
|
|
4929
|
-
const prefix = '```yuri-message\n{"text":"我先读一下会话,确认目前的进展。"}\n```\n';
|
|
4930
|
-
const tool = '```yuri-tool\n{"name":"read_session","arguments":{"sessionID":"ses_progress"}}\n```';
|
|
4931
4963
|
let calls = 0;
|
|
4932
4964
|
const read = vi.fn(async () => {
|
|
4933
4965
|
await toolGate;
|
|
@@ -4938,25 +4970,17 @@ describe('read_session referenced conversation', () => {
|
|
|
4938
4970
|
}, {
|
|
4939
4971
|
onContactTurnEvent: (event) => events.push(event),
|
|
4940
4972
|
runContactTurn: realRunContactTurn,
|
|
4941
|
-
createChatCompletion: async (
|
|
4942
|
-
if (++calls === 1) {
|
|
4943
|
-
|
|
4944
|
-
await generationGate;
|
|
4945
|
-
onTextDelta(tool);
|
|
4946
|
-
return { text: prefix + tool };
|
|
4947
|
-
}
|
|
4948
|
-
return { text: '```yuri-final\n{"status":"complete","text":"这个会话目前为空。"}\n```' };
|
|
4973
|
+
createChatCompletion: async () => {
|
|
4974
|
+
if (++calls === 1) return sayThen('我先读一下会话,确认目前的进展。', 'read_session', { sessionID: 'ses_progress' });
|
|
4975
|
+
return { text: '这个会话目前为空。' };
|
|
4949
4976
|
},
|
|
4950
4977
|
});
|
|
4951
4978
|
const assistant = service.createAssistant(assistantInput);
|
|
4952
4979
|
try {
|
|
4953
4980
|
await service.send(assistant.id, { messageID: 'live_public', parts: [{ type: 'text', text: '读一下会话' }] });
|
|
4954
|
-
await vi.waitFor(() => expect(
|
|
4955
|
-
expect(read).not.toHaveBeenCalled();
|
|
4981
|
+
await vi.waitFor(() => expect(read).toHaveBeenCalledTimes(1));
|
|
4956
4982
|
expect(service.snapshot().assistants.find((a) => a.id === assistant.id).working).toBe(true);
|
|
4957
4983
|
expect(events.some((e) => e.type === 'yuri:contact-turn-end')).toBe(false);
|
|
4958
|
-
releaseGeneration();
|
|
4959
|
-
await vi.waitFor(() => expect(read).toHaveBeenCalledTimes(1));
|
|
4960
4984
|
// A fresh snapshot/history read while the actual tool is pending restores the same message.
|
|
4961
4985
|
expect(service.contactMessages(assistant.id).messages.filter((m) => m.role === 'assistant').map((m) => m.text)).toEqual(['我先读一下会话,确认目前的进展。']);
|
|
4962
4986
|
releaseTool();
|
|
@@ -4965,18 +4989,17 @@ describe('read_session referenced conversation', () => {
|
|
|
4965
4989
|
const deltas = events.filter((e) => e.type === 'yuri:contact-bubble-delta' && e.properties.done);
|
|
4966
4990
|
expect(deltas.map((e) => e.properties.bubbleIndex)).toEqual([0, 1]);
|
|
4967
4991
|
} finally {
|
|
4968
|
-
|
|
4992
|
+
releaseTool(); service.close();
|
|
4969
4993
|
}
|
|
4970
4994
|
});
|
|
4971
4995
|
|
|
4972
4996
|
it('real harness duplicate preambles keep both lines in SSE and SQLite', async () => {
|
|
4973
4997
|
const directory = root();
|
|
4974
4998
|
const events = [];
|
|
4975
|
-
const fence = (name, args) => '```yuri-tool\n' + JSON.stringify({ name, arguments: args }) + '\n```';
|
|
4976
4999
|
const replies = [
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
5000
|
+
sayThen('我去读一下', 'read_session', { sessionID: 'ses_dup_a' }),
|
|
5001
|
+
sayThen('我去读一下', 'read_session', { sessionID: 'ses_dup_b' }),
|
|
5002
|
+
{ text: '办好了' },
|
|
4980
5003
|
];
|
|
4981
5004
|
const service = setup(directory, {
|
|
4982
5005
|
get: async ({ sessionID }) => ({ data: { id: sessionID, directory, title: sessionID } }),
|
|
@@ -4986,9 +5009,7 @@ describe('read_session referenced conversation', () => {
|
|
|
4986
5009
|
}, {
|
|
4987
5010
|
onContactTurnEvent: (event) => events.push(event),
|
|
4988
5011
|
runContactTurn: realRunContactTurn,
|
|
4989
|
-
createChatCompletion: vi.fn(async () => ({
|
|
4990
|
-
completion: { choices: [{ message: { content: replies.shift() || '' } }] },
|
|
4991
|
-
})),
|
|
5012
|
+
createChatCompletion: vi.fn(async () => replies.shift() || { text: '' }),
|
|
4992
5013
|
});
|
|
4993
5014
|
const assistant = service.createAssistant(assistantInput);
|
|
4994
5015
|
await settleSend(service, assistant.id, {
|
|
@@ -5009,17 +5030,14 @@ describe('read_session referenced conversation', () => {
|
|
|
5009
5030
|
it('real harness missed-tool retry keeps pre-retry spoken in SSE and SQLite', async () => {
|
|
5010
5031
|
const directory = root();
|
|
5011
5032
|
const events = [];
|
|
5012
|
-
const fence = (name, args) => '```yuri-tool\n' + JSON.stringify({ name, arguments: args }) + '\n```';
|
|
5013
5033
|
const replies = [
|
|
5014
|
-
|
|
5015
|
-
|
|
5034
|
+
{ text: '好的,我来创建。' },
|
|
5035
|
+
sayThen('这就建好', 'create_assistant', { name: 'MissSvc', model: 'p/m' }),
|
|
5016
5036
|
];
|
|
5017
5037
|
const service = setup(directory, {}, {
|
|
5018
5038
|
onContactTurnEvent: (event) => events.push(event),
|
|
5019
5039
|
runContactTurn: realRunContactTurn,
|
|
5020
|
-
createChatCompletion: vi.fn(async () => ({
|
|
5021
|
-
completion: { choices: [{ message: { content: replies.shift() || '' } }] },
|
|
5022
|
-
})),
|
|
5040
|
+
createChatCompletion: vi.fn(async () => replies.shift() || { text: '' }),
|
|
5023
5041
|
});
|
|
5024
5042
|
const assistant = service.createAssistant(assistantInput);
|
|
5025
5043
|
await settleSend(service, assistant.id, {
|
|
@@ -79,6 +79,9 @@ Shutdown removes the owned directory; a failed staging operation cleans up.
|
|
|
79
79
|
- Messages retain structured roles: system/user/assistant/tool. Native tool
|
|
80
80
|
calls carry their original IDs and JSON arguments; tool results retain name
|
|
81
81
|
and tool_call_id. The Assistant supplies its actual tool JSON schemas.
|
|
82
|
+
The contact harness may internally defer tool-name validation to its bounded
|
|
83
|
+
correction loop (`validateToolCalls: false`); HTTP body fields cannot disable
|
|
84
|
+
validation, and the harness validates/normalizes every call before execution.
|
|
82
85
|
- Results retain text, tool calls, finish reason, input/output/cache-read usage.
|
|
83
86
|
Empty text with valid tool calls is success. Truly empty results are errors;
|
|
84
87
|
content-filter/error/length endings cannot masquerade as complete output.
|
|
@@ -115,6 +115,7 @@ export async function createChatCompletion({
|
|
|
115
115
|
retryEmptyTextUntilCancelled = false,
|
|
116
116
|
cacheKey,
|
|
117
117
|
maxOutputTokens,
|
|
118
|
+
validateToolCalls = true,
|
|
118
119
|
}) {
|
|
119
120
|
signal?.throwIfAborted();
|
|
120
121
|
if (!isRecord(body)) throw new LlmError('validation_error', 400, 'JSON body is required');
|
|
@@ -207,7 +208,7 @@ export async function createChatCompletion({
|
|
|
207
208
|
}
|
|
208
209
|
const text = typeof generated?.text === 'string' ? generated.text.trim() : '';
|
|
209
210
|
if (!text && !generated?.toolCalls?.length) throw new LlmError('upstream_error', 502, 'OpenCode returned no assistant text');
|
|
210
|
-
if (generated.toolCalls?.some(call => !tools.some(tool => tool.name === call.name))) throw new LlmError('upstream_error', 502, 'Model returned an unavailable tool');
|
|
211
|
+
if (validateToolCalls && generated.toolCalls?.some(call => !tools.some(tool => tool.name === call.name))) throw new LlmError('upstream_error', 502, 'Model returned an unavailable tool');
|
|
211
212
|
|
|
212
213
|
const model = `${resolved.providerID}/${resolved.modelID}`;
|
|
213
214
|
return {
|
|
@@ -2,6 +2,15 @@ import { describe, expect, it, vi } from 'vitest'
|
|
|
2
2
|
import { LlmError, createChatCompletion } from './completions.js'
|
|
3
3
|
|
|
4
4
|
describe('createChatCompletion', () => {
|
|
5
|
+
it('keeps tool-name checks strict for HTTP input while allowing internal harness correction', async () => {
|
|
6
|
+
const input = {
|
|
7
|
+
body: { model: 'p/m', messages: [{ role: 'user', content: 'lookup' }], validateToolCalls: false },
|
|
8
|
+
loadCatalog: async () => ({ models: [{ providerID: 'p', modelID: 'm' }] }),
|
|
9
|
+
generateText: async () => ({ text: '', toolCalls: [{ id: 'bad', name: 'unknown', arguments: {} }] }),
|
|
10
|
+
};
|
|
11
|
+
await expect(createChatCompletion(input)).rejects.toMatchObject({ code: 'upstream_error' });
|
|
12
|
+
await expect(createChatCompletion({ ...input, validateToolCalls: false })).resolves.toMatchObject({ completion: { choices: [{ message: { tool_calls: [{ id: 'bad' }] } }] } });
|
|
13
|
+
});
|
|
5
14
|
it.each([{}, [{ id: 1, function: { name: 'read', arguments: '{}' } }]])('rejects malformed native tool calls before inference: %j', async (tool_calls) => {
|
|
6
15
|
const generateText = vi.fn();
|
|
7
16
|
await expect(createChatCompletion({ generateText, body: { model: 'p/m', messages: [{ role: 'assistant', content: '', tool_calls }] } })).rejects.toMatchObject({ code: 'validation_error', statusCode: 400 });
|
|
@@ -336,6 +336,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
336
336
|
persistSessionMetadata,
|
|
337
337
|
onSystemSessionPersisted,
|
|
338
338
|
upsertScheduledTask: (projectID, task) => projectConfigRuntime.upsertScheduledTask(projectID, task),
|
|
339
|
+
patchScheduledTask: (projectID, taskID, patch) => projectConfigRuntime.patchScheduledTask(projectID, taskID, patch),
|
|
339
340
|
syncScheduledTaskProject: (projectID) => scheduledTasksRuntime.syncProject(projectID),
|
|
340
341
|
setTaskResultHandler: (handler) => scheduledTasksRuntime.setTaskResultHandler(handler),
|
|
341
342
|
refreshAllowedRoots: refreshAssistantAllowedRoots,
|
|
@@ -387,9 +387,9 @@ describe('scheduled task result handoff', () => {
|
|
|
387
387
|
expect(input.userText).toContain(task.execution.prompt);
|
|
388
388
|
if (mode === 'failure') expect(input.userText).toContain('upstream failed');
|
|
389
389
|
else expect(input.userText).toContain('Actual research findings');
|
|
390
|
-
return reviewTaskResult({ ...input, createChatCompletion: async () => (
|
|
391
|
-
? '
|
|
392
|
-
: mode === 'failure' ? '任务执行失败,需要检查服务。' : '资料汇总:有两项值得关注的更新。' }) });
|
|
390
|
+
return reviewTaskResult({ ...input, createChatCompletion: async () => (mode === 'silent'
|
|
391
|
+
? { completion: { choices: [{ message: { content: '', tool_calls: [{ id: 'call_silent', type: 'function', function: { name: 'stay_silent', arguments: '{}' } }] } }] } }
|
|
392
|
+
: { text: mode === 'failure' ? '任务执行失败,需要检查服务。' : '资料汇总:有两项值得关注的更新。' }) });
|
|
393
393
|
});
|
|
394
394
|
const runtime = createRuntime(null, {
|
|
395
395
|
projectConfigRuntime, listProjects, runHistoryStore: store, notifyTaskRun,
|