@yuriai/web 0.2.8-beta.2 → 0.2.8
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-BjpY2u0c.js → AssistantView-CaLm2pDU.js} +3 -3
- package/dist/assets/{DiagramView-7j0sZC_P.js → DiagramView-Bh_Y3wjs.js} +1 -1
- package/dist/assets/{FadeInOnReveal-DkmfVoTO.js → FadeInOnReveal-NAFOww9Y.js} +1 -1
- package/dist/assets/{GuiPluginSurface-D_TK-2vZ.js → GuiPluginSurface-qGOqnbF5.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-CniMrVC7.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-Dh7XVDLd.js → MarkdownRendererImpl-BoMHV8l0.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-D-qtRrvg.js → MarkstreamRendererImpl-BXEZlJGP.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-LkTVYLZX.js → MobileDetailNavigation-B6Ohvu93.js} +1 -1
- package/dist/assets/{MobileResizableSheet-C9YzOQis.js → MobileResizableSheet-BN07cmQQ.js} +1 -1
- package/dist/assets/{MobileShareBridge-CsTyKMtN.js → MobileShareBridge-DRx1mbUO.js} +1 -1
- package/dist/assets/MobileTabPageHeader-CHXNz-XU.js +2 -0
- package/dist/assets/{MultiRunWindow-hMpjV7so.js → MultiRunWindow-CWwawp5s.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-D8qpss-X.js → SettingsView-q2q_C3kF.js} +1 -1
- package/dist/assets/{SettingsWindow-B1VuFkFq.js → SettingsWindow-BO4fG8ON.js} +1 -1
- package/dist/assets/{TerminalView-CLcaJh2M.js → TerminalView-OVVhfpeZ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-BuZo3XvN.js → ToolOutputDialog-CqirE_Q0.js} +1 -1
- package/dist/assets/{YuriLogo-DvRSd5NN.js → YuriLogo-kwLWc5Hi.js} +1 -1
- package/dist/assets/{appThemeRegistry-B7sp1Hw8.js → appThemeRegistry-Dg6MpoKd.js} +1 -1
- package/dist/assets/{button-BSFWH-Ok.js → button-Dodw6LWV.js} +1 -1
- package/dist/assets/{capgoAdapter-vxOdqloD.js → capgoAdapter-B7ToX3Rx.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-DspnKU8D.js → fileMentionTouchSelection-CHBe_36a.js} +1 -1
- package/dist/assets/{fr-YDYbYIZQ.js → fr-CPRTMaky.js} +1 -1
- package/dist/assets/{gitApi-BLYdWaG8.js → gitApi-CesLpypb.js} +1 -1
- package/dist/assets/{input-BhHXFla6.js → input-HddqDhRi.js} +1 -1
- package/dist/assets/{insertionBoundaries-DqlfZVY9.js → insertionBoundaries-BLxQiOvC.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-DA7z198b.js → main-DlTR1Jke.js} +2 -2
- package/dist/assets/{main-Qw23QJ7L.js → main-Z6Jwv7Aw.js} +4 -4
- package/dist/assets/{markdownHeightCache-DV2j4PlS.js → markdownHeightCache-BQiIj0aM.js} +1 -1
- package/dist/assets/{mcpQueries-C6Tu2cF3.js → mcpQueries-CZLOskV8.js} +1 -1
- package/dist/assets/{miniChat-HafcB3H-.js → miniChat-SzvTUnN9.js} +2 -2
- package/dist/assets/{mobile-DwXoGpxm.js → mobile-dh54OsZj.js} +2 -2
- package/dist/assets/{mobileBackNavigation-9MR5h5K6.js → mobileBackNavigation-D9_5Uqi3.js} +1 -1
- package/dist/assets/{multirun-D-je_w02.js → multirun-J_f9gEPw.js} +1 -1
- package/dist/assets/{native-config-Bb3pPQPD.js → native-config-Bohk_yve.js} +1 -1
- package/dist/assets/{pl-vh0XFuDb.js → pl-mUyhvp8O.js} +1 -1
- package/dist/assets/{projectMeta-DaCyZW_D.js → projectMeta-BH9vbJqs.js} +1 -1
- package/dist/assets/{pt-BR-Cv5tssQz.js → pt-BR-D3E4Wxao.js} +1 -1
- package/dist/assets/{readiness-BHqz_NPS.js → readiness-D1Glg4WD.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-COaMALRh.js → renderElectronMiniChatApp-DM5OW4_M.js} +2 -2
- package/dist/assets/{renderMobileApp-BOGntDSu.js → renderMobileApp-CvDZu5Qx.js} +4 -4
- package/dist/assets/{runtimeConfig-BiSluBXe.js → runtimeConfig-CwEhy80T.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-CJwlI_R-.js → runtimeEndpointReset-CFELYYml.js} +3 -3
- package/dist/assets/{scheduledTaskNavigation-BZ3B5bpN.js → scheduledTaskNavigation-CyPkVBKs.js} +1 -1
- package/dist/assets/{sessionChangeSummary-BAv8zzro.js → sessionChangeSummary-DnCiwEhi.js} +1 -1
- package/dist/assets/{sessionLookup-DOw7g15p.js → sessionLookup-BxXJcGxg.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-BnTV_KYG.js → sortable-tabs-strip-C-qSUWlr.js} +1 -1
- package/dist/assets/{speechSettingsQueries-B8zEN5QM.js → speechSettingsQueries-7aN_QCn_.js} +1 -1
- package/dist/assets/src-BJ51FtVW.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-Dzzdq2e0.js +2 -0
- package/dist/assets/{uk-3a9vdLJ-.js → uk-D9iQbGbr.js} +1 -1
- package/dist/assets/{useAppFontEffects-De1qI6c-.js → useAppFontEffects-Ql6SjWay.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-BzXi6Wf1.js → useDesktopWindowControlsLayout-DpovjCsM.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-BcbBl_6y.js → useEffectiveDirectory-CjXQBqAr.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DqDCVXO1.js → useMobileNavigationStore-BTJNY1Yo.js} +6 -6
- package/dist/assets/{useWorkerHighlightedLines-CDVleuma.js → useWorkerHighlightedLines-cS9vGi9t.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 +16 -16
- package/server/lib/assistants/bubbles.js +0 -14
- package/server/lib/assistants/bubbles.test.js +1 -18
- package/server/lib/assistants/contact-tools.js +64 -231
- package/server/lib/assistants/contact-tools.test.js +29 -164
- package/server/lib/assistants/harness.js +72 -237
- package/server/lib/assistants/harness.test.js +199 -280
- 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/service.test.js +23 -42
- package/server/lib/scheduled-tasks/runtime.test.js +3 -3
- package/dist/assets/MarkdownRenderer-B8zgOCfr.js +0 -2
- package/dist/assets/MobileTabPageHeader-xz9RMXg4.js +0 -2
- package/dist/assets/src-NlrSCyPZ.css +0 -2
- package/dist/assets/types-BiP0jssb.js +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');
|
|
@@ -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 () => {
|
|
@@ -3308,9 +3310,9 @@ describe('assistants service', () => {
|
|
|
3308
3310
|
backgroundTurns.push(input);
|
|
3309
3311
|
return realRunContactTurn({
|
|
3310
3312
|
...input,
|
|
3311
|
-
createChatCompletion: async () => (
|
|
3312
|
-
? '
|
|
3313
|
-
: '资料已整理:本周有两项相关更新。' }),
|
|
3313
|
+
createChatCompletion: async () => (silent
|
|
3314
|
+
? toolBatch([['stay_silent', {}]])
|
|
3315
|
+
: { text: '资料已整理:本周有两项相关更新。' }),
|
|
3314
3316
|
});
|
|
3315
3317
|
}
|
|
3316
3318
|
await input.tools.find((tool) => tool.name === 'schedule_task').execute('schedule', {
|
|
@@ -3747,7 +3749,7 @@ describe('assistants service', () => {
|
|
|
3747
3749
|
backgroundTurns.push(input);
|
|
3748
3750
|
return realRunContactTurn({
|
|
3749
3751
|
...input,
|
|
3750
|
-
createChatCompletion: async () => (
|
|
3752
|
+
createChatCompletion: async () => toolBatch([['stay_silent', {}]], '正在查看该会话的执行结果'),
|
|
3751
3753
|
});
|
|
3752
3754
|
},
|
|
3753
3755
|
});
|
|
@@ -4901,15 +4903,12 @@ describe('read_session referenced conversation', () => {
|
|
|
4901
4903
|
it('real harness two read_session preambles: SSE done bubbles match SQLite 1:1 including duplicates', async () => {
|
|
4902
4904
|
const directory = root();
|
|
4903
4905
|
const events = [];
|
|
4904
|
-
const fence = (name, args) => '```yuri-tool\n' + JSON.stringify({ name, arguments: args }) + '\n```';
|
|
4905
4906
|
const replies = [
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4907
|
+
sayThen('我去读一下', 'read_session', { sessionID: 'ses_a' }),
|
|
4908
|
+
sayThen('我再读一下', 'read_session', { sessionID: 'ses_b' }),
|
|
4909
|
+
{ text: '办好了' },
|
|
4909
4910
|
];
|
|
4910
|
-
const createChatCompletion = vi.fn(async () => ({
|
|
4911
|
-
completion: { choices: [{ message: { content: replies.shift() || '' } }] },
|
|
4912
|
-
}));
|
|
4911
|
+
const createChatCompletion = vi.fn(async () => replies.shift() || { text: '' });
|
|
4913
4912
|
const service = setup(directory, {
|
|
4914
4913
|
get: async ({ sessionID }) => ({
|
|
4915
4914
|
data: { id: sessionID, directory, title: sessionID },
|
|
@@ -4956,15 +4955,11 @@ describe('read_session referenced conversation', () => {
|
|
|
4956
4955
|
service.close();
|
|
4957
4956
|
});
|
|
4958
4957
|
|
|
4959
|
-
it('persists
|
|
4958
|
+
it('persists notify_user messages before tool completion, with no final replay', async () => {
|
|
4960
4959
|
const directory = root();
|
|
4961
4960
|
const events = [];
|
|
4962
|
-
let releaseGeneration;
|
|
4963
4961
|
let releaseTool;
|
|
4964
|
-
const generationGate = new Promise((resolve) => { releaseGeneration = resolve; });
|
|
4965
4962
|
const toolGate = new Promise((resolve) => { releaseTool = resolve; });
|
|
4966
|
-
const prefix = '```yuri-message\n{"text":"我先读一下会话,确认目前的进展。"}\n```\n';
|
|
4967
|
-
const tool = '```yuri-tool\n{"name":"read_session","arguments":{"sessionID":"ses_progress"}}\n```';
|
|
4968
4963
|
let calls = 0;
|
|
4969
4964
|
const read = vi.fn(async () => {
|
|
4970
4965
|
await toolGate;
|
|
@@ -4975,25 +4970,17 @@ describe('read_session referenced conversation', () => {
|
|
|
4975
4970
|
}, {
|
|
4976
4971
|
onContactTurnEvent: (event) => events.push(event),
|
|
4977
4972
|
runContactTurn: realRunContactTurn,
|
|
4978
|
-
createChatCompletion: async (
|
|
4979
|
-
if (++calls === 1) {
|
|
4980
|
-
|
|
4981
|
-
await generationGate;
|
|
4982
|
-
onTextDelta(tool);
|
|
4983
|
-
return { text: prefix + tool };
|
|
4984
|
-
}
|
|
4985
|
-
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: '这个会话目前为空。' };
|
|
4986
4976
|
},
|
|
4987
4977
|
});
|
|
4988
4978
|
const assistant = service.createAssistant(assistantInput);
|
|
4989
4979
|
try {
|
|
4990
4980
|
await service.send(assistant.id, { messageID: 'live_public', parts: [{ type: 'text', text: '读一下会话' }] });
|
|
4991
|
-
await vi.waitFor(() => expect(
|
|
4992
|
-
expect(read).not.toHaveBeenCalled();
|
|
4981
|
+
await vi.waitFor(() => expect(read).toHaveBeenCalledTimes(1));
|
|
4993
4982
|
expect(service.snapshot().assistants.find((a) => a.id === assistant.id).working).toBe(true);
|
|
4994
4983
|
expect(events.some((e) => e.type === 'yuri:contact-turn-end')).toBe(false);
|
|
4995
|
-
releaseGeneration();
|
|
4996
|
-
await vi.waitFor(() => expect(read).toHaveBeenCalledTimes(1));
|
|
4997
4984
|
// A fresh snapshot/history read while the actual tool is pending restores the same message.
|
|
4998
4985
|
expect(service.contactMessages(assistant.id).messages.filter((m) => m.role === 'assistant').map((m) => m.text)).toEqual(['我先读一下会话,确认目前的进展。']);
|
|
4999
4986
|
releaseTool();
|
|
@@ -5002,18 +4989,17 @@ describe('read_session referenced conversation', () => {
|
|
|
5002
4989
|
const deltas = events.filter((e) => e.type === 'yuri:contact-bubble-delta' && e.properties.done);
|
|
5003
4990
|
expect(deltas.map((e) => e.properties.bubbleIndex)).toEqual([0, 1]);
|
|
5004
4991
|
} finally {
|
|
5005
|
-
|
|
4992
|
+
releaseTool(); service.close();
|
|
5006
4993
|
}
|
|
5007
4994
|
});
|
|
5008
4995
|
|
|
5009
4996
|
it('real harness duplicate preambles keep both lines in SSE and SQLite', async () => {
|
|
5010
4997
|
const directory = root();
|
|
5011
4998
|
const events = [];
|
|
5012
|
-
const fence = (name, args) => '```yuri-tool\n' + JSON.stringify({ name, arguments: args }) + '\n```';
|
|
5013
4999
|
const replies = [
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5000
|
+
sayThen('我去读一下', 'read_session', { sessionID: 'ses_dup_a' }),
|
|
5001
|
+
sayThen('我去读一下', 'read_session', { sessionID: 'ses_dup_b' }),
|
|
5002
|
+
{ text: '办好了' },
|
|
5017
5003
|
];
|
|
5018
5004
|
const service = setup(directory, {
|
|
5019
5005
|
get: async ({ sessionID }) => ({ data: { id: sessionID, directory, title: sessionID } }),
|
|
@@ -5023,9 +5009,7 @@ describe('read_session referenced conversation', () => {
|
|
|
5023
5009
|
}, {
|
|
5024
5010
|
onContactTurnEvent: (event) => events.push(event),
|
|
5025
5011
|
runContactTurn: realRunContactTurn,
|
|
5026
|
-
createChatCompletion: vi.fn(async () => ({
|
|
5027
|
-
completion: { choices: [{ message: { content: replies.shift() || '' } }] },
|
|
5028
|
-
})),
|
|
5012
|
+
createChatCompletion: vi.fn(async () => replies.shift() || { text: '' }),
|
|
5029
5013
|
});
|
|
5030
5014
|
const assistant = service.createAssistant(assistantInput);
|
|
5031
5015
|
await settleSend(service, assistant.id, {
|
|
@@ -5046,17 +5030,14 @@ describe('read_session referenced conversation', () => {
|
|
|
5046
5030
|
it('real harness missed-tool retry keeps pre-retry spoken in SSE and SQLite', async () => {
|
|
5047
5031
|
const directory = root();
|
|
5048
5032
|
const events = [];
|
|
5049
|
-
const fence = (name, args) => '```yuri-tool\n' + JSON.stringify({ name, arguments: args }) + '\n```';
|
|
5050
5033
|
const replies = [
|
|
5051
|
-
|
|
5052
|
-
|
|
5034
|
+
{ text: '好的,我来创建。' },
|
|
5035
|
+
sayThen('这就建好', 'create_assistant', { name: 'MissSvc', model: 'p/m' }),
|
|
5053
5036
|
];
|
|
5054
5037
|
const service = setup(directory, {}, {
|
|
5055
5038
|
onContactTurnEvent: (event) => events.push(event),
|
|
5056
5039
|
runContactTurn: realRunContactTurn,
|
|
5057
|
-
createChatCompletion: vi.fn(async () => ({
|
|
5058
|
-
completion: { choices: [{ message: { content: replies.shift() || '' } }] },
|
|
5059
|
-
})),
|
|
5040
|
+
createChatCompletion: vi.fn(async () => replies.shift() || { text: '' }),
|
|
5060
5041
|
});
|
|
5061
5042
|
const assistant = service.createAssistant(assistantInput);
|
|
5062
5043
|
await settleSend(service, assistant.id, {
|
|
@@ -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,
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-D-qtRrvg.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-NMQx_cnG.js","assets/runtime-switch-CAZiOV2G.js","assets/runtime-auth-ef9W7A43.js","assets/vendor-zustand-o69pgTEK.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-BP2cRVqX.js","assets/fileQueries-DbUx7NwP.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/queryRuntime-BuRnpVtK.js","assets/runtime-fetch-BAN5Gnnp.js","assets/vendor-markstream-react-Bm0cO70Z.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-BpfIZ1tg.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-BSFWH-Ok.js","assets/desktop-dp2Z0toS.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/store-CgQdmzpX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useMobileNavigationStore-DqDCVXO1.js","assets/platform-DXeTzJHG.js","assets/vendor-opencode-client-fxfj4IA_.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-BfjCXjLZ.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-D3k0hKDj.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-D7JZlg_Q.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/useThemeSystem-8jhE4Zyk.js","assets/tooltip-DygQ-2xe.js","assets/image-loading-FUFYiO1j.js","assets/image-loading-D9Z_BASK.css","assets/url-MRa-FtQa.js","assets/useEffectiveDirectory-BcbBl_6y.js","assets/LoadingImage-B7cT_4Oe.js","assets/ImageLoadingPlaceholder-CUKFQTAG.js","assets/markdownHeightCache-DV2j4PlS.js","assets/dualLimitLru-D8Sphgua.js","assets/MarkdownRendererImpl-Dh7XVDLd.js","assets/vendor-katex-DNVSTX6g.js","assets/FadeInOnReveal-DkmfVoTO.js","assets/markdownTheme-DHoKvD6O.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-No7p4Kdo.js","assets/toolHelpers-DL452NVK.js","assets/fileReferenceParser-1HHDBUum.js","assets/MarkstreamRendererImpl-EpBnVy9J.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-o69pgTEK.js";import{it as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as o}from"./button-BSFWH-Ok.js";import{t as s}from"./useEffectiveDirectory-BcbBl_6y.js";import{i as c,n as l,t as u}from"./markdownHeightCache-DV2j4PlS.js";var d=i(),f=e(n(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.8-beta.2:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-D-qtRrvg.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-Dh7XVDLd.js`).then(e=>e.n),__vite__mapDeps([53,1,4,5,24,25,2,30,14,6,31,32,7,8,3,33,9,13,12,34,35,36,10,11,37,38,16,54,20,21,22,23,26,27,28,29,39,40,41,42,52,43,45,46,47,48,55,51,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=r(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
|