@yuriai/web 0.2.39 → 0.2.40-beta.4
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-BPihSrmD.js → AgentAvatar-BmT_6apW.js} +1 -1
- package/dist/assets/{AssistantConversationSurface-CjY5PL5-.js → AssistantConversationSurface-B-D-mLgs.js} +3 -3
- package/dist/assets/{AssistantConversationSurface-B60CYrok.css → AssistantConversationSurface-n9w_Av0k.css} +1 -1
- package/dist/assets/{AssistantUnreadBadge-Cqm9s7su.js → AssistantUnreadBadge-C34eOGCL.js} +1 -1
- package/dist/assets/{AssistantView-DQYpQy2m.js → AssistantView-0nXkM9VG.js} +1 -1
- package/dist/assets/{DiagramView-B0BtdArn.js → DiagramView-BU6jWxKJ.js} +1 -1
- package/dist/assets/{FadeInOnReveal-tft8IuZn.js → FadeInOnReveal-CCVdl9Vt.js} +1 -1
- package/dist/assets/{GuiPluginPage-DbRaxEMz.js → GuiPluginPage-BMt5AMqg.js} +1 -1
- package/dist/assets/{GuiPluginSurface-slfiNhjw.js → GuiPluginSurface-kxAcgmf1.js} +1 -1
- package/dist/assets/{GuiPluginWindow-CncIyWAp.js → GuiPluginWindow-BVvzrnp1.js} +1 -1
- package/dist/assets/{Icon-CGEMyGrr.js → Icon-B5nBc6dO.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-DPV84_Pj.js → ImageLoadingPlaceholder-Bv5mmf2U.js} +1 -1
- package/dist/assets/{LoadingImage-C54k9D10.js → LoadingImage-BzBw_1lI.js} +1 -1
- package/dist/assets/MarkdownRenderer-CoMohPOZ.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-QZCYT1B1.js → MarkdownRendererImpl-DoZW1UKH.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-CH0XdDB8.js → MarkstreamRendererImpl-B3zd5x2O.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-doWZ3QnX.js → MobileDetailNavigation-bEZ_NA03.js} +1 -1
- package/dist/assets/{MobileResizableSheet-DmBfNDpy.js → MobileResizableSheet-D5PcZMuI.js} +1 -1
- package/dist/assets/{MobileShareBridge-CCRDZ5at.js → MobileShareBridge-Cjukxazk.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-RIJ0Tv9a.js → MobileTabPageHeader-Da1maXx-.js} +1 -1
- package/dist/assets/{MultiRunWindow-FISLdCRZ.js → MultiRunWindow-rMqP99ID.js} +1 -1
- package/dist/assets/{OnboardingScreen-D4OnZuHF.js → OnboardingScreen-CZhqHzAj.js} +1 -1
- package/dist/assets/{OverlayScrollbar-B5tpZ8bV.js → OverlayScrollbar-Byx2H3pc.js} +1 -1
- package/dist/assets/{SettingsView-B9qVD3Y-.js → SettingsView-7Bea2DvF.js} +1 -1
- package/dist/assets/{SettingsWindow-DUlTQkFw.js → SettingsWindow-U-RDDOS7.js} +1 -1
- package/dist/assets/{SetupTourDialog-Cfc1h-8p.js → SetupTourDialog-CKec5tUy.js} +1 -1
- package/dist/assets/{TerminalView-D0nGaGQc.js → TerminalView-CS1oSAuY.js} +1 -1
- package/dist/assets/{ToolOutputDialog-RBSVUj7J.js → ToolOutputDialog-BWhrFvvI.js} +1 -1
- package/dist/assets/{VoiceSettings-B6L3hyGL.js → VoiceSettings-7aFmJq9Z.js} +1 -1
- package/dist/assets/{appThemeRegistry-CvThoPJW.js → appThemeRegistry-LyWTE-mT.js} +1 -1
- package/dist/assets/{capgoAdapter-Bj8RLSP5.js → capgoAdapter-B5NImlKh.js} +1 -1
- package/dist/assets/{checkbox-CnTrXcOT.js → checkbox-Bdj4n5cI.js} +1 -1
- package/dist/assets/{collapsible-Brxkw3Ad.js → collapsible-D1JZOgJZ.js} +1 -1
- package/dist/assets/{context-menu-V40RXF6h.js → context-menu-DDX0ZFhc.js} +1 -1
- package/dist/assets/{diagram-DmtDqCEH.js → diagram-C72TQWfh.js} +1 -1
- package/dist/assets/{dialog-wNy9dklb.js → dialog-CIKJalI5.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-B35c9M1S.js → fileMentionTouchSelection-tnd9RDDh.js} +1 -1
- package/dist/assets/{gitApi-B6T5guw-.js → gitApi-BI8OG_ts.js} +1 -1
- package/dist/assets/{input-DKLf8ixL.js → input-gVHSS0EB.js} +1 -1
- package/dist/assets/{insertionBoundaries-BT7QMdXR.js → insertionBoundaries-B-yZI6iY.js} +1 -1
- package/dist/assets/{main-wQpnkA8l.js → main-BfAN93rT.js} +4 -4
- package/dist/assets/{main-Bto3lVGC.js → main-DYWwmI_W.js} +2 -2
- package/dist/assets/{markdownHeightCache-CDLGxKMx.js → markdownHeightCache-B-FoaQ1U.js} +1 -1
- package/dist/assets/{mcpQueries-W4pdjGH6.js → mcpQueries-CehWHIB1.js} +1 -1
- package/dist/assets/{miniChat-5-Hv0t6L.js → miniChat-BlkcLQBr.js} +2 -2
- package/dist/assets/{mobile-CIfJVgvD.js → mobile-I3Xe5NtO.js} +2 -2
- package/dist/assets/{mobileBackNavigation-DEYDDBvo.js → mobileBackNavigation-BFUH-c-G.js} +1 -1
- package/dist/assets/{mobileConnections-Ciduwjrk.js → mobileConnections-BFvtbJXX.js} +2 -2
- package/dist/assets/{multirun-DH5YM6eW.js → multirun-DdEjp77z.js} +1 -1
- package/dist/assets/{native-config-tZKBxKlJ.js → native-config-DqDXViVx.js} +1 -1
- package/dist/assets/{projectMeta-ByznasuE.js → projectMeta-BKgum5WN.js} +1 -1
- package/dist/assets/{pwa-6LwD5mEU.js → pwa-BvKUY4Hk.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-BxQHPU5z.js → queue-abort-optimistic-BcbiNk8t.js} +1 -1
- package/dist/assets/{react-KWIP7CQs.js → react-DeB-Vc_L.js} +1 -1
- package/dist/assets/{readiness-aRoinILZ.js → readiness-CIlvQ-aQ.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-CZScT8zj.js → renderElectronMiniChatApp-DIjWdFHu.js} +2 -2
- package/dist/assets/{renderMobileApp-DuXuzELH.js → renderMobileApp-CE0QyOH0.js} +4 -4
- package/dist/assets/{runtimeConfig-D6tyDSf2.js → runtimeConfig-uhjQn4kK.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-CTScNTQk.js → runtimeEndpointReset-DezNESKT.js} +3 -3
- package/dist/assets/{select-CM7BZ8sO.js → select-BwCKwnTH.js} +1 -1
- package/dist/assets/{sessionLookup-BU5wx0-q.js → sessionLookup-DzKZsy-W.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-DucBEuLZ.js → sortable-tabs-strip-m5JQrTx4.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BP-b2-GN.js → speechSettingsQueries-C5mPRWIv.js} +1 -1
- package/dist/assets/{src-CCKR0Tmd.css → src-HgtAe3Q4.css} +1 -1
- package/dist/assets/{textarea-C8G6xLAC.js → textarea-CaTDyZrS.js} +1 -1
- package/dist/assets/{tooltip-CeCFnNNR.js → tooltip-BvZzoiqg.js} +1 -1
- package/dist/assets/types-Bm8kDgSv.js +2 -0
- package/dist/assets/{useAppFontEffects-B2DfbicL.js → useAppFontEffects-C9IaiJgF.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-CD1Nr6Ms.js → useDesktopWindowControlsLayout-C3M12PjJ.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DT950TGk.js → useEffectiveDirectory-Do4UqfZR.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-CXnVqWpM.js → useMobileNavigationStore-InwdmuDX.js} +5 -5
- package/dist/assets/{usePluginsStore-DIah6ngo.js → usePluginsStore-BH4-CNcj.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-BrP3Yc-q.js → useStreamingTextThrottle-CeKHHK13.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-tpb9bWVl.js → useWorkerHighlightedLines-0XahwAbS.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/lib/assistants/DOCUMENTATION.md +15 -3
- package/server/lib/assistants/builtin-skills.js +19 -0
- package/server/lib/assistants/builtin-skills.test.js +40 -0
- package/server/lib/assistants/harness.js +2 -0
- package/server/lib/assistants/harness.test.js +41 -1
- package/server/lib/assistants/service.test.js +3 -0
- package/server/lib/gui-customization/DOCUMENTATION.md +31 -1
- package/server/lib/gui-customization/projects-client.mjs +59 -0
- package/server/lib/gui-customization/projects.js +43 -0
- package/server/lib/gui-customization/projects.test.js +103 -0
- package/server/lib/gui-customization/remote-connections-client.mjs +2 -8
- package/server/lib/gui-customization/session-skill-command.mjs +8 -0
- package/server/lib/gui-customization/session-skill.js +15 -10
- package/server/lib/gui-customization/session-skill.test.js +21 -2
- package/server/lib/gui-customization/skill/SKILL.md +3 -1
- package/server/lib/gui-customization/skill/references/projects.md +63 -0
- package/server/lib/notifications/DOCUMENTATION.md +12 -0
- package/server/lib/notifications/runtime.js +20 -2
- package/server/lib/notifications/runtime.test.js +21 -0
- package/server/lib/notifications/session-unread-runtime.js +51 -13
- package/server/lib/notifications/session-unread.test.js +113 -1
- package/server/lib/opencode/core-routes.js +2 -1
- package/server/lib/opencode/feature-routes-runtime.js +6 -0
- package/server/lib/opencode/feature-routes-runtime.test.js +4 -0
- package/server/lib/projects/DOCUMENTATION.md +6 -3
- package/server/lib/scheduled-tasks/session-skill.js +2 -1
- package/server/lib/scheduled-tasks/session-skill.test.js +34 -1
- package/server/lib/session-index/DOCUMENTATION.md +4 -1
- package/server/lib/session-index/event-ingest.js +8 -0
- package/server/lib/session-index/event-ingest.test.js +16 -0
- package/server/lib/session-index/service.js +1 -0
- package/server/lib/session-index/service.test.js +3 -1
- package/server/lib/session-metadata/DOCUMENTATION.md +18 -1
- package/server/lib/session-title/DOCUMENTATION.md +3 -0
- package/server/lib/session-title/runtime.js +1 -0
- package/server/lib/session-title/runtime.test.js +2 -0
- package/dist/assets/MarkdownRenderer-DBZS1O3m.js +0 -2
- package/dist/assets/types-Zl9uYRiX.js +0 -2
|
@@ -11,10 +11,12 @@ import { createSessionUnreadRuntime } from './session-unread-runtime.js';
|
|
|
11
11
|
const cleanup = [];
|
|
12
12
|
afterEach(async () => { for (const close of cleanup.splice(0).reverse()) await close(); });
|
|
13
13
|
const fixture = (options = {}) => {
|
|
14
|
+
const { seed, ...runtimeOptions } = options;
|
|
14
15
|
const changed = vi.fn();
|
|
15
16
|
const store = createSessionUnreadStore({ dbPath: ':memory:', onChanged: changed });
|
|
17
|
+
seed?.(store);
|
|
16
18
|
const loadSession = vi.fn(async id => ({ id, title: 'Conversation', location: { directory: '/project' } }));
|
|
17
|
-
const runtime = createSessionUnreadRuntime({ store, loadSession, ...
|
|
19
|
+
const runtime = createSessionUnreadRuntime({ store, loadSession, ...runtimeOptions });
|
|
18
20
|
cleanup.push(() => runtime.close());
|
|
19
21
|
const event = (type, sessionID = 'one', created = undefined, seq = undefined) => runtime.processEvent({
|
|
20
22
|
payload: { type, data: { sessionID }, created, ...(seq ? { durable: { seq } } : {}) },
|
|
@@ -25,6 +27,116 @@ const fixture = (options = {}) => {
|
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
describe('shared session unread', () => {
|
|
30
|
+
it('excludes explicitly linked CLI workers without guessing from titles or agent names', async () => {
|
|
31
|
+
const { store, event, loadSession, app } = fixture();
|
|
32
|
+
loadSession.mockImplementation(async id => ({ id, title: 'Worker', agent: 'general', directory: '/project',
|
|
33
|
+
metadata: { yuri: { worker: { parentSessionID: id === 'worker' ? 'root' : '' } } },
|
|
34
|
+
}));
|
|
35
|
+
await event('session.execution.succeeded', 'worker');
|
|
36
|
+
await event('session.execution.failed', 'worker');
|
|
37
|
+
expect((await request(app).put('/api/yuri/session-unread/worker').send({ unread: true })).status).toBe(400);
|
|
38
|
+
await event('session.execution.succeeded', 'ordinary');
|
|
39
|
+
expect(Object.keys(store.snapshot().sessions)).toEqual(['ordinary']);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('reconciles persisted child/worker attention once and retains unread state for ordinary roots', async () => {
|
|
43
|
+
const { app, store, loadSession } = fixture({ seed: store => {
|
|
44
|
+
for (const id of ['child', 'worker', 'missing', 'root']) store.mark({ id, directory: '/project', unread: true });
|
|
45
|
+
} });
|
|
46
|
+
loadSession.mockImplementation(async id => id === 'missing' ? null : ({ id, directory: '/project',
|
|
47
|
+
...(id === 'child' ? { parentID: 'root' } : {}),
|
|
48
|
+
...(id === 'worker' ? { metadata: { yuri: { worker: { parentSessionID: 'root' } } } } : {}),
|
|
49
|
+
}));
|
|
50
|
+
const first = await request(app).get('/api/yuri/session-unread');
|
|
51
|
+
expect(first.status).toBe(200);
|
|
52
|
+
expect(Object.keys(first.body.sessions)).toEqual(['root']);
|
|
53
|
+
expect(first.body.sessions.root).toMatchObject({ unreadCount: 1, manual: true });
|
|
54
|
+
expect(store.snapshot()).toEqual(first.body);
|
|
55
|
+
expect((await request(app).get('/api/yuri/session-unread')).body).toEqual(first.body);
|
|
56
|
+
expect(loadSession).toHaveBeenCalledTimes(4);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('preserves failed startup identities, repairs independent rows, and retries only the failed row', async () => {
|
|
60
|
+
const { app, store, loadSession } = fixture({ seed: store => {
|
|
61
|
+
for (const id of ['child', 'root']) store.mark({ id, unread: true });
|
|
62
|
+
} });
|
|
63
|
+
loadSession.mockImplementation(async id => {
|
|
64
|
+
if (id === 'root') throw new Error('temporarily unavailable');
|
|
65
|
+
return { id, parentID: 'root' };
|
|
66
|
+
});
|
|
67
|
+
expect((await request(app).get('/api/yuri/session-unread')).status).toBe(503);
|
|
68
|
+
expect(Object.keys(store.snapshot().sessions)).toEqual(['root']);
|
|
69
|
+
loadSession.mockResolvedValue({ id: 'root', directory: '/project' });
|
|
70
|
+
expect((await request(app).get('/api/yuri/session-unread')).body.sessions.root.unreadCount).toBe(1);
|
|
71
|
+
expect(loadSession.mock.calls.map(([id]) => id)).toEqual(['child', 'root', 'root']);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('removes prior attention when authoritative metadata makes a session hidden without a new completion', async () => {
|
|
75
|
+
const { event, store, loadSession, changed } = fixture();
|
|
76
|
+
await event('session.execution.succeeded');
|
|
77
|
+
loadSession.mockResolvedValue({ id: 'one', metadata: { yuri: { worker: { parentSessionID: 'root' } } } });
|
|
78
|
+
await event('session.metadata.updated');
|
|
79
|
+
expect(store.snapshot().sessions.one).toBeUndefined();
|
|
80
|
+
expect(changed).toHaveBeenCalledTimes(2);
|
|
81
|
+
await event('session.execution.succeeded');
|
|
82
|
+
expect(store.snapshot().sessions.one).toBeUndefined();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('coalesces startup snapshots, caps identity reads at four, and performs no warm snapshot reads', async () => {
|
|
86
|
+
const { app, loadSession } = fixture({ seed: store => {
|
|
87
|
+
for (let i = 0; i < 24; i++) store.mark({ id: `session-${i}`, unread: true });
|
|
88
|
+
store.mark({ id: 'already-read', unread: true });
|
|
89
|
+
const revision = store.snapshot().sessions['already-read'].revision;
|
|
90
|
+
store.mark({ id: 'already-read', unread: false, expectedRevision: revision });
|
|
91
|
+
} });
|
|
92
|
+
let active = 0;
|
|
93
|
+
let peak = 0;
|
|
94
|
+
loadSession.mockImplementation(async id => {
|
|
95
|
+
peak = Math.max(peak, ++active);
|
|
96
|
+
await new Promise(resolve => setTimeout(resolve, 1));
|
|
97
|
+
active--;
|
|
98
|
+
return { id, directory: '/project' };
|
|
99
|
+
});
|
|
100
|
+
const snapshots = await Promise.all([request(app).get('/api/yuri/session-unread'), request(app).get('/api/yuri/session-unread')]);
|
|
101
|
+
expect(snapshots.map(result => result.status)).toEqual([200, 200]);
|
|
102
|
+
expect(peak).toBe(4);
|
|
103
|
+
expect(loadSession).toHaveBeenCalledTimes(24);
|
|
104
|
+
await request(app).get('/api/yuri/session-unread');
|
|
105
|
+
expect(loadSession).toHaveBeenCalledTimes(24);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('returns retryable snapshot failure rather than waiting forever behind a failed lifecycle boundary', async () => {
|
|
109
|
+
const { app, event, loadSession, store } = fixture({ seed: store => store.mark({ id: 'one', unread: true }) });
|
|
110
|
+
loadSession.mockRejectedValue(new Error('offline'));
|
|
111
|
+
void event('session.execution.started');
|
|
112
|
+
expect((await request(app).get('/api/yuri/session-unread')).status).toBe(503);
|
|
113
|
+
expect(store.snapshot().sessions.one.unreadCount).toBe(1);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('keeps persisted unread and revision on cleanup write failure, then repairs only that row on retry', async () => {
|
|
117
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-unread-repair-'));
|
|
118
|
+
cleanup.push(() => fs.rmSync(dir, { recursive: true, force: true }));
|
|
119
|
+
const dbPath = path.join(dir, 'state.sqlite');
|
|
120
|
+
const store = createSessionUnreadStore({ dbPath });
|
|
121
|
+
store.mark({ id: 'worker', unread: true });
|
|
122
|
+
store.mark({ id: 'root', unread: true });
|
|
123
|
+
const previous = store.snapshot();
|
|
124
|
+
const loadSession = vi.fn(async id => ({ id, ...(id === 'worker' ? { parentID: 'root' } : {}) }));
|
|
125
|
+
const runtime = createSessionUnreadRuntime({ store, loadSession });
|
|
126
|
+
cleanup.push(() => runtime.close());
|
|
127
|
+
const app = express();
|
|
128
|
+
runtime.registerRoutes(app);
|
|
129
|
+
const Database = createRequire(import.meta.url)('better-sqlite3');
|
|
130
|
+
const db = new Database(dbPath);
|
|
131
|
+
cleanup.push(() => db.close());
|
|
132
|
+
db.exec("CREATE TRIGGER reject_cleanup BEFORE DELETE ON session_unread BEGIN SELECT RAISE(ABORT, 'write failed'); END");
|
|
133
|
+
expect((await request(app).get('/api/yuri/session-unread')).status).toBe(503);
|
|
134
|
+
expect(store.snapshot()).toEqual(previous);
|
|
135
|
+
db.exec('DROP TRIGGER reject_cleanup');
|
|
136
|
+
expect(Object.keys((await request(app).get('/api/yuri/session-unread')).body.sessions)).toEqual(['root']);
|
|
137
|
+
expect(loadSession.mock.calls.map(([id]) => id)).toEqual(['worker', 'root', 'worker']);
|
|
138
|
+
});
|
|
139
|
+
|
|
28
140
|
it('records completion with no clients, deduplicates succeeded/idle, and rearms on a new run', async () => {
|
|
29
141
|
const { store, event, changed } = fixture();
|
|
30
142
|
await event('session.execution.succeeded');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MANAGED_SCHEDULED_TASK_TOOL_PATH } from '../scheduled-tasks/managed-tool-contract.js';
|
|
2
2
|
import { authorizeScheduledTaskSkillRequest, SCHEDULED_TASK_SKILL_PATH } from '../scheduled-tasks/session-skill-contract.js';
|
|
3
3
|
import { REMOTE_CONNECTIONS_SKILL_PATH } from '../gui-customization/remote-connections.js';
|
|
4
|
+
import { PROJECTS_SKILL_PATH } from '../gui-customization/projects.js';
|
|
4
5
|
import { MESSAGE_QUEUE_ADMISSION_HTTP_MAX_BYTES } from '../message-queue/service.js';
|
|
5
6
|
|
|
6
7
|
const parseLoopbackUrl = (rawUrl) => {
|
|
@@ -660,7 +661,7 @@ export const registerAuthAndAccessRoutes = (app, dependencies) => {
|
|
|
660
661
|
}
|
|
661
662
|
return res.status(403).json({ error: 'Forbidden' });
|
|
662
663
|
}
|
|
663
|
-
if (normalizedRequestPathname === SCHEDULED_TASK_SKILL_PATH || normalizedRequestPathname === REMOTE_CONNECTIONS_SKILL_PATH) {
|
|
664
|
+
if (normalizedRequestPathname === SCHEDULED_TASK_SKILL_PATH || normalizedRequestPathname === REMOTE_CONNECTIONS_SKILL_PATH || normalizedRequestPathname === PROJECTS_SKILL_PATH) {
|
|
664
665
|
if (authorizeScheduledTaskSkillRequest(req, getScheduledTaskSkillAuthHeaders())) return next();
|
|
665
666
|
return res.status(403).json({ error: 'Forbidden' });
|
|
666
667
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerFsRoutes } from '../fs/routes.js';
|
|
2
2
|
import { registerRemoteConnectionsSkill } from '../gui-customization/remote-connections.js';
|
|
3
|
+
import { registerProjectsSkill } from '../gui-customization/projects.js';
|
|
3
4
|
import { registerQuotaRoutes } from '../quota/routes.js';
|
|
4
5
|
import { registerSmallModelRoutes } from '../small-model/routes.js';
|
|
5
6
|
import { registerSessionMetadataRoutes } from '../session-metadata/routes.js';
|
|
@@ -303,6 +304,11 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
303
304
|
};
|
|
304
305
|
await refreshAssistantAllowedRoots();
|
|
305
306
|
const projectRegistry = createProjectRegistry({ persistSettings, validateDirectoryPath });
|
|
307
|
+
registerProjectsSkill(app, {
|
|
308
|
+
express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
|
|
309
|
+
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
310
|
+
registerProject: (input) => projectRegistry.register(input), readSettingsFromDiskStrict, sanitizeProjects,
|
|
311
|
+
});
|
|
306
312
|
historyImportRuntime = registerHistoryImportRoutes(app, {
|
|
307
313
|
express, uiAuthController, dataDir: yuriDataDir,
|
|
308
314
|
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
@@ -3,6 +3,10 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
3
3
|
import { createWorktreeTopologyBroadcaster } from './feature-routes-runtime.js';
|
|
4
4
|
|
|
5
5
|
describe('feature routes runtime composition', () => {
|
|
6
|
+
it('wires session project registration to the shared registry and strict settings reader', async () => {
|
|
7
|
+
const routes = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
|
|
8
|
+
expect(routes).toMatch(/registerProjectsSkill\(app, \{[\s\S]*?registerProject: \(input\) => projectRegistry.register\(input\), readSettingsFromDiskStrict, sanitizeProjects/);
|
|
9
|
+
});
|
|
6
10
|
it('passes the native connection adapter to shared-session admission and the protected bridge', async () => {
|
|
7
11
|
const host = await fs.readFile(new URL('../../index.js', import.meta.url), 'utf8');
|
|
8
12
|
const routes = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`registry.js` owns registering existing directories. It reuses `validateDirectoryPath`, deterministic
|
|
4
4
|
path-derived IDs and the settings runtime's serialized persistence. The existing
|
|
5
|
-
`POST /api/opencode/directory` API and assistant business tools share this owner.
|
|
6
|
-
The
|
|
5
|
+
`POST /api/opencode/directory` API, the session-bound project API bridge and assistant business tools share this owner.
|
|
6
|
+
The UI directory API still selects the active directory; session/assistant registration does not
|
|
7
7
|
change an existing active selection. The first registered project becomes active
|
|
8
8
|
through the existing settings invariant.
|
|
9
9
|
|
|
@@ -21,7 +21,10 @@ normalization, migration, atomic write and project-order SSE notification paths.
|
|
|
21
21
|
Unlike full-list UI replacement, this form does not sweep other projects for
|
|
22
22
|
missing directories: callers validate the affected resource. Corrupt reads and
|
|
23
23
|
failed writes are errors, not empty state or successful registration. No new
|
|
24
|
-
database, settings file
|
|
24
|
+
database, settings file or client sync protocol is added. The session skill's
|
|
25
|
+
`POST /api/yuri/session-skills/projects` bridge adds authenticated `describe`,
|
|
26
|
+
`list` and `add` operations without exposing the full settings API; its admission
|
|
27
|
+
and result contract live in `../gui-customization/DOCUMENTATION.md`.
|
|
25
28
|
|
|
26
29
|
`registry.test.js` covers canonical alias deduplication, concurrent append/settings
|
|
27
30
|
writes, persistence, offline-project retention, corrupt
|
|
@@ -87,7 +87,8 @@ export const registerScheduledTaskSessionSkill = (app, {
|
|
|
87
87
|
key: SCHEDULED_TASK_SKILL_KEY,
|
|
88
88
|
value: `Yuri built-in skill: scheduled tasks. When the user asks to create, find, edit, pause, resume or delete scheduled tasks (including other projects and global tasks), load the skill by running:\n${scheduledTaskSkillCommand(executable, script, encoded, 'describe')}\nThe result supplies the workflow and authenticated task-management commands. Prefer this session's tasks when the target is unspecified. Do not ask for credentials or project IDs.`,
|
|
89
89
|
});
|
|
90
|
-
|
|
90
|
+
const projectBinding = { hostOrigin, upstreamOrigin, registrationFile };
|
|
91
|
+
await installCustomization(client, created.id, { projectBinding, ...(remoteConnectionsAdapter ? { remoteBinding: projectBinding } : {}) });
|
|
91
92
|
return res.json({ data: created });
|
|
92
93
|
} catch {
|
|
93
94
|
let retainedSessionID = created?.id;
|
|
@@ -13,9 +13,10 @@ import { registerScheduledTaskRoutes } from './routes.js';
|
|
|
13
13
|
import { registerScheduledTaskSessionSkill } from './session-skill.js';
|
|
14
14
|
import { authorizeScheduledTaskSkillRequest, SCHEDULED_TASK_SKILL_PATH } from './session-skill-contract.js';
|
|
15
15
|
import { registerRemoteConnectionsSkill, REMOTE_CONNECTIONS_SKILL_PATH } from '../gui-customization/remote-connections.js';
|
|
16
|
+
import { registerProjectsSkill, PROJECTS_SKILL_PATH } from '../gui-customization/projects.js';
|
|
16
17
|
|
|
17
18
|
describe('built-in session skill with authenticated Host', () => {
|
|
18
|
-
let root, server, origin, ui, sessions, entries, store, password, auth, registrationFile, sdk, sync, failInstructions, failCleanup, connections;
|
|
19
|
+
let root, server, origin, ui, sessions, entries, store, password, auth, registrationFile, sdk, sync, failInstructions, failCleanup, connections, registerProject;
|
|
19
20
|
const upstreamOrigin = 'http://127.0.0.1:4096';
|
|
20
21
|
beforeEach(async () => {
|
|
21
22
|
root = await fs.mkdtemp(path.join(os.tmpdir(), 'session-skill-'));
|
|
@@ -66,6 +67,9 @@ describe('built-in session skill with authenticated Host', () => {
|
|
|
66
67
|
buildOpenCodeUrl: () => upstreamOrigin, getOpenCodeAuthHeaders: () => auth,
|
|
67
68
|
};
|
|
68
69
|
const router = express.Router();
|
|
70
|
+
registerProject = vi.fn(async (input) => ({ project: { id: 'registered', ...input }, created: true, settings: { password } }));
|
|
71
|
+
registerProjectsSkill(app, { express, getIsSharedOpenCodeService: () => true, getOpenCodeAuthHeaders: () => auth, createClient: () => sdk,
|
|
72
|
+
registerProject, readSettingsFromDiskStrict: common.readSettingsFromDiskMigrated, sanitizeProjects: common.sanitizeProjects });
|
|
69
73
|
connections = { list: vi.fn(async () => ({ instances: [] })), setup: vi.fn(async () => ({ id: 'ssh_one', running: true })),
|
|
70
74
|
pair: vi.fn(async () => ({ url: 'yuri://connect?v=2&p=fixture', expiresAt: '2099-01-01' })) };
|
|
71
75
|
registerRemoteConnectionsSkill(app, { express, adapter: connections, getIsSharedOpenCodeService: () => true, getOpenCodeAuthHeaders: () => auth, createClient: () => sdk });
|
|
@@ -191,6 +195,35 @@ describe('built-in session skill with authenticated Host', () => {
|
|
|
191
195
|
expect(connections.setup).toHaveBeenCalledTimes(1);
|
|
192
196
|
});
|
|
193
197
|
|
|
198
|
+
it('executes the exact staged project API helper and refuses browser credentials or changed Host/service bindings', async () => {
|
|
199
|
+
const session = await create();
|
|
200
|
+
const pointer = entries.get(`${session.id}:customization`);
|
|
201
|
+
const command = pointer.split('Bound project helper: ')[1].split('\n')[0];
|
|
202
|
+
const described = await run(command);
|
|
203
|
+
expect(described.code).toBe(0);
|
|
204
|
+
expect(described.value.supported).toBe(true);
|
|
205
|
+
expect(Object.keys(described.value.commands)).toEqual(['list', 'add']);
|
|
206
|
+
const { commands: cmd } = described.value;
|
|
207
|
+
expect((await run(cmd.list)).value.projects).toHaveLength(2);
|
|
208
|
+
const input = { path: path.join(root, 'project-b'), label: 'Existing project' };
|
|
209
|
+
const added = await run(cmd.add, input);
|
|
210
|
+
expect(added.value).toEqual({ project: { id: 'registered', ...input }, created: true });
|
|
211
|
+
expect(registerProject).toHaveBeenCalledExactlyOnceWith(input);
|
|
212
|
+
expect(added.stdout + pointer).not.toContain(password);
|
|
213
|
+
for (const headers of [{}, { Authorization: 'Bearer test-browser-client' }, { ...auth, Origin: origin }, { Authorization: 'Basic wrong' }]) {
|
|
214
|
+
const response = await fetch(`${origin}${PROJECTS_SKILL_PATH}`, { method: 'POST', headers: { 'content-type': 'application/json', ...headers }, body: JSON.stringify({ sessionID: session.id, operation: 'add', input }) });
|
|
215
|
+
expect(response.status).toBe(403);
|
|
216
|
+
}
|
|
217
|
+
sessions.get(session.id).metadata.yuri.scheduledTaskSkill.hostOrigin = 'http://127.0.0.1:1';
|
|
218
|
+
expect((await run(cmd.add, input)).value).toMatchObject({ status: 403, terminal: true });
|
|
219
|
+
expect(registerProject).toHaveBeenCalledTimes(1);
|
|
220
|
+
await fs.writeFile(registrationFile, JSON.stringify({ url: 'http://127.0.0.1:1', password }));
|
|
221
|
+
const stale = await run(cmd.add, input);
|
|
222
|
+
expect(stale.value.terminal).toBe(true);
|
|
223
|
+
expect(stale.stdout + stale.stderr).not.toContain(password);
|
|
224
|
+
expect(registerProject).toHaveBeenCalledTimes(1);
|
|
225
|
+
});
|
|
226
|
+
|
|
194
227
|
it('rejects unbounded connection input and sanitizes remote errors', async () => {
|
|
195
228
|
const session = await create();
|
|
196
229
|
const request = (operation, input) => fetch(`${origin}${REMOTE_CONNECTIONS_SKILL_PATH}`, { method: 'POST',
|
|
@@ -96,7 +96,10 @@ the index excludes them from every snapshot and clears prior summaries when a
|
|
|
96
96
|
coding workers the Assistant subscribed to),
|
|
97
97
|
`metadata.yuri.scheduledTask.taskID`,
|
|
98
98
|
`metadata.yuri.smallModel.purpose`, or
|
|
99
|
-
|
|
99
|
+
`metadata.yuri.llm.purpose`, or `metadata.yuri.worker.parentSessionID`.
|
|
100
|
+
Native `session.metadata.updated` removes newly hidden summaries and pins
|
|
101
|
+
immediately; ordinary metadata-only updates do not fabricate partial rows.
|
|
102
|
+
Metadata remains the ownership/isolation signal;
|
|
100
103
|
reserved title tags are a separate background-list exclusion rule.
|
|
101
104
|
`time.archived` is archive state (Host authority via
|
|
102
105
|
`metadata.yuri.archive.archivedAt` when present — see
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
resolveSessionDirectory,
|
|
6
6
|
} from '../session-metadata/session-projection.js';
|
|
7
7
|
import { extractSessionStatusUpdate } from '../opencode/session-runtime.js';
|
|
8
|
+
import { isVisibleSession } from './service.js';
|
|
8
9
|
|
|
9
10
|
const withDirectory = (session, directory) => {
|
|
10
11
|
if (!session || typeof session !== 'object') return null;
|
|
@@ -37,6 +38,13 @@ export const applySessionIndexEvent = (service, event, observedAt = Date.now(),
|
|
|
37
38
|
|
|
38
39
|
const baseType = normalizeSessionEventType(payload.type);
|
|
39
40
|
|
|
41
|
+
if (baseType === 'session.metadata.updated') {
|
|
42
|
+
if (isHostReady && !isHostReady()) return false;
|
|
43
|
+
const data = payload.data ?? properties;
|
|
44
|
+
if (typeof data.sessionID !== 'string' || !data.metadata || typeof data.metadata !== 'object') return false;
|
|
45
|
+
return !isVisibleSession({ metadata: data.metadata }) ? service.remove(data.sessionID) : false;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
if (baseType === 'session.model.selected') {
|
|
41
49
|
if (isHostReady && !isHostReady()) return false;
|
|
42
50
|
const data = payload.data ?? properties;
|
|
@@ -3,6 +3,22 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
3
3
|
import { applySessionIndexEvent } from './event-ingest.js';
|
|
4
4
|
|
|
5
5
|
describe('session index event ingest', () => {
|
|
6
|
+
it('removes an indexed CLI worker on authoritative metadata updates without deleting its conversation', () => {
|
|
7
|
+
const service = { remove: vi.fn(() => true), upsertAndReportChange: vi.fn() };
|
|
8
|
+
const event = { payload: { type: 'session.metadata.updated', data: {
|
|
9
|
+
sessionID: 'worker', metadata: { yuri: { worker: { parentSessionID: 'root' } } },
|
|
10
|
+
} } };
|
|
11
|
+
expect(applySessionIndexEvent(service, event, 30, { isHostReady: () => false })).toBe(false);
|
|
12
|
+
expect(service.remove).not.toHaveBeenCalled();
|
|
13
|
+
expect(applySessionIndexEvent(service, event, 30)).toBe(true);
|
|
14
|
+
expect(service.remove).toHaveBeenCalledWith('worker');
|
|
15
|
+
expect(service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
16
|
+
service.remove.mockClear();
|
|
17
|
+
expect(applySessionIndexEvent(service, { payload: { type: 'session.metadata.updated', data: {
|
|
18
|
+
sessionID: 'ordinary', metadata: { yuri: { worker: { parentSessionID: '' } } },
|
|
19
|
+
} } }, 30)).toBe(false);
|
|
20
|
+
expect(service.remove).not.toHaveBeenCalled();
|
|
21
|
+
});
|
|
6
22
|
it('ingests native model selection through the existing-row mutation and respects Host readiness', () => {
|
|
7
23
|
const service = { updateModel: vi.fn(() => true) };
|
|
8
24
|
const model = { providerID: 'p', id: 'model', variant: 'high' };
|
|
@@ -16,6 +16,7 @@ const isContactAssignedSession = (yuri) => yuri?.assigned?.from === 'contact';
|
|
|
16
16
|
const isSystemSession = (session) => {
|
|
17
17
|
const yuri = session?.metadata?.yuri;
|
|
18
18
|
if (!yuri || typeof yuri !== 'object') return false;
|
|
19
|
+
if (nonEmptySystemID(yuri.worker?.parentSessionID)) return true;
|
|
19
20
|
// Contact-assigned workers stay visible in Chat. Only archived Assistant
|
|
20
21
|
// bindings use `yuri.assistant` as a hide marker.
|
|
21
22
|
if (nonEmptySystemID(yuri.assistant?.assistantID) && !isContactAssignedSession(yuri)) return true;
|
|
@@ -406,7 +406,8 @@ describe('Electron session index', () => {
|
|
|
406
406
|
|
|
407
407
|
service.replaceDirectory({
|
|
408
408
|
directory: '/repo',
|
|
409
|
-
sessions: [assistantSession, scheduledSession, smallModelSession, llmSession,
|
|
409
|
+
sessions: [assistantSession, scheduledSession, smallModelSession, llmSession,
|
|
410
|
+
{ ...session('ses_cli_worker', 95), metadata: { yuri: { worker: { parentSessionID: 'root' } } } }, ordinary],
|
|
410
411
|
cursor: null,
|
|
411
412
|
hasMore: false,
|
|
412
413
|
});
|
|
@@ -416,6 +417,7 @@ describe('Electron session index', () => {
|
|
|
416
417
|
service.upsert(scheduledSession);
|
|
417
418
|
service.upsert(smallModelSession);
|
|
418
419
|
service.upsert(llmSession);
|
|
420
|
+
service.upsert({ ...session('ses_cli_worker', 95), metadata: { yuri: { worker: { parentSessionID: 'root' } } } });
|
|
419
421
|
expect(service.snapshot().directories[0].sessions.map((item) => item.id)).toEqual(['ses_ordinary']);
|
|
420
422
|
service.close();
|
|
421
423
|
});
|
|
@@ -95,8 +95,25 @@ The Host has no goal routes, objective-file API, progress auditor or continuatio
|
|
|
95
95
|
System ownership for sidebar / session-index / notifications is established when Host metadata
|
|
96
96
|
carries a non-empty `yuri.assistant.assistantID` (unless
|
|
97
97
|
`assigned.from === 'contact'`), `yuri.scheduledTask.taskID`,
|
|
98
|
-
`yuri.smallModel.purpose`, or `yuri.llm.purpose`. Every system
|
|
98
|
+
`yuri.smallModel.purpose`, or `yuri.llm.purpose`. Every system
|
|
99
99
|
session creator must persist the matching patch through this store. Separately,
|
|
100
100
|
ordinary sidebar/session-index lists also exclude reserved leading title tags
|
|
101
101
|
`[Scheduled]`, `[Assistant]`, and `[yuri-llm]`, including legacy sessions
|
|
102
102
|
without metadata; these tags do not establish metadata ownership.
|
|
103
|
+
|
|
104
|
+
## Delegated CLI workers
|
|
105
|
+
|
|
106
|
+
Use the native subagent tool, or create the session with OpenCode's `parentID`
|
|
107
|
+
before passing its ID to `opencode run --session`. Bare `opencode run` creates
|
|
108
|
+
an ordinary root conversation; agent names, titles and prompt text do not prove
|
|
109
|
+
delegation and must not be used to hide it.
|
|
110
|
+
|
|
111
|
+
For an existing CLI worker whose delegating session is explicitly known, merge
|
|
112
|
+
`{ yuri: { worker: { parentSessionID: "<delegating-session-id>" } } }` through
|
|
113
|
+
`PUT /api/yuri/sessions/:sessionId/metadata`. Preserve the real native `parentID`;
|
|
114
|
+
this marker does not manufacture an upstream ancestry edge. It excludes the
|
|
115
|
+
worker from ordinary session catalogs, unread badges, title refresh and ordinary
|
|
116
|
+
notifications, including standalone VS Code. Transcript content is unchanged.
|
|
117
|
+
Only mark verified delegated workers, never every root session using a secondary
|
|
118
|
+
agent. Remove this marker with `{ yuri: { worker: null } }` to restore ordinary
|
|
119
|
+
visibility on the next catalog refresh; old hidden unread is not resurrected.
|
|
@@ -4,6 +4,9 @@ Server-side watcher that regenerates a session's sidebar title from the
|
|
|
4
4
|
conversation's **main subject** (overall feature / goal) with the small model
|
|
5
5
|
(`lib/small-model`), then PATCHes `title` plus `metadata.yuri.titleRefresh`.
|
|
6
6
|
|
|
7
|
+
Explicit delegated CLI workers (`metadata.yuri.worker.parentSessionID`) are
|
|
8
|
+
system-owned for title refresh, just as they are for catalog/unread visibility.
|
|
9
|
+
|
|
7
10
|
OpenCode starts its own initial title through `SessionTitle.generate`.
|
|
8
11
|
This module auto-refreshes sparsely (first user
|
|
9
12
|
admission of a new session, first newly-sent reply on a fork) and on explicit smart-title
|
|
@@ -156,6 +156,7 @@ const extractSessionStatus = (payload) => {
|
|
|
156
156
|
export const isSystemOwnedSession = (sessionOrInfo) => {
|
|
157
157
|
const yuri = sessionOrInfo?.metadata?.yuri;
|
|
158
158
|
if (!yuri || typeof yuri !== 'object') return false;
|
|
159
|
+
if (typeof yuri.worker?.parentSessionID === 'string' && yuri.worker.parentSessionID) return true;
|
|
159
160
|
if (yuri.assigned?.from === 'contact') return false;
|
|
160
161
|
if (typeof yuri.assistant?.assistantID === 'string' && yuri.assistant.assistantID) return true;
|
|
161
162
|
if (typeof yuri.scheduledTask?.taskID === 'string' && yuri.scheduledTask.taskID) return true;
|
|
@@ -226,6 +226,8 @@ describe('session-title helpers', () => {
|
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
it('detects system-owned sessions from metadata only', () => {
|
|
229
|
+
expect(isSystemOwnedSession({ metadata: { yuri: { worker: { parentSessionID: 'root' } } } })).toBe(true);
|
|
230
|
+
expect(isSystemOwnedSession({ metadata: { yuri: { worker: { parentSessionID: '' } } } })).toBe(false);
|
|
229
231
|
expect(isSystemOwnedSession({
|
|
230
232
|
metadata: { yuri: { assistant: { assistantID: 'assistant_1', name: 'A' } } },
|
|
231
233
|
})).toBe(true);
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-CH0XdDB8.js","assets/rolldown-runtime-hePW80VL.js","assets/platform-DMsFWy1a.js","assets/runtime-auth-mjIpsk3N.js","assets/runtime-switch-BMjl5Y5W.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-CzHs0bHY.js","assets/useUIStore-vvNwcOk3.js","assets/reasoning-projection-client-BEhVknv9.js","assets/vendor-zustand-vDaAPGfl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useMobileHtmlPreviewStore-C03uVLfX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-react-DlzBev0S.js","assets/fileQueries-D9l0crnM.js","assets/runtime-fetch-DKZOpfzo.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/vendor-markstream-react-6zxyQLCD.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-CuTmqEMK.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-CXnVqWpM.js","assets/gitApiHttp-D4d-rgcR.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-CL7EVzOG.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/bootstrap-BhC95qVC.js","assets/runtime-ead7P81A.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-sonner-BEHGipm5.js","assets/i18n-UaLestuf.js","assets/store-CzVMz42v.js","assets/tour-DDI0Zg7l.js","assets/useAssistantUIStore-nNYL140o.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/tooltip-CeCFnNNR.js","assets/useEffectiveDirectory-DT950TGk.js","assets/image-loading-BrDob6MW.js","assets/image-loading-DA9JEHD8.css","assets/LoadingImage-C54k9D10.js","assets/ImageLoadingPlaceholder-DPV84_Pj.js","assets/FadeInOnReveal-tft8IuZn.js","assets/markdownHeightCache-CDLGxKMx.js","assets/dualLimitLru-D8Sphgua.js","assets/useStreamingTextThrottle-BrP3Yc-q.js","assets/MarkdownRendererImpl-QZCYT1B1.js","assets/vendor-katex-DNVSTX6g.js","assets/themes-BgDJcxRc.js","assets/vendor-marked-S3gCOYp1.js","assets/markdownTheme-CHNl6tUv.js","assets/vendor-pierre-diffs-BFiZ3IhI.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-remend-C3cXc-tf.js","assets/fileReferenceActions-BmquJskG.js","assets/toolHelpers-iEHVHQ9p.js","assets/fileReferenceParser-1HHDBUum.js","assets/MarkstreamRendererImpl-C6aiJnjl.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-vDaAPGfl.js";import{ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{Jn as o}from"./useMobileNavigationStore-CXnVqWpM.js";import{t as s}from"./useEffectiveDirectory-DT950TGk.js";import{i as c,n as l,t as u}from"./markdownHeightCache-CDLGxKMx.js";var d=e(r(),1),f=i(),p=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},m=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},h=`yuri:markstream-react`,g=e=>p(h,e),_=t(e=>({markstreamReactEnabled:g(),setMarkstreamReactEnabled:t=>{m(h,t),e({markstreamReactEnabled:t})}})),v=null,y=()=>(v??=a(()=>import(`./MarkstreamRendererImpl-CH0XdDB8.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,77,78,79,80,81])).catch(e=>{throw v=null,e}),v),b=()=>{y().catch(()=>void 0)},x=null,S=()=>(x??=a(()=>import(`./MarkdownRendererImpl-QZCYT1B1.js`).then(e=>e.n),__vite__mapDeps([58,1,4,3,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,59,23,24,25,38,34,35,39,40,26,27,28,29,30,31,32,33,36,37,41,42,43,44,45,56,46,60,49,50,51,54,55,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80])).catch(e=>{throw x=null,e}),x),C=()=>{S().catch(()=>void 0),g()&&b()},w=`yuri:chunk-import-reload`,T=250,E=3e4,D=[/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 O(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 k(e){let t=O(e);return D.some(e=>e.test(t))}function A(e){return`0.2.39:${O(e).slice(0,500)}`}function j(e){if(typeof window>`u`)return;let t=Date.now(),n=A(e),r=null;try{let e=window.sessionStorage.getItem(w);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<E)){try{window.sessionStorage.setItem(w,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:O(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function M(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,!k(e)||t>=n)break;await new Promise(e=>setTimeout(e,T*(t+1)))}throw k(r)&&j(r),r}var N=e=>(0,d.lazy)(()=>M(e)),P=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),F=class extends d.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=d.createContext(!0),L=()=>d.useContext(I),R=n(),z=N(()=>S().then(e=>({default:e.MarkdownRenderer}))),B=N(()=>y().then(e=>({default:e.MarkstreamRenderer}))),V=N(()=>S().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,f.c)(15),n=_(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,d;t[5]!==e.className||t[6]!==e.variant?(d=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]=d):d=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]!==d||t[13]!==p?(m=(0,R.jsx)(`div`,{className:d,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,f.c)(13),n=L(),r=_(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)(d.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)(d.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||!P(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,f.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)(d.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{N as a,P as i,G as n,C as o,I as r,W as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-app-B5H_XtmE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e}from"./platform-DMsFWy1a.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";var n=async()=>{if(!e())return null;let{App:n}=await t(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),{id:r}=await n.getInfo();if(typeof r!=`string`||!/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(r))throw Error(`Native app identity unavailable`);return r},r=e=>typeof e==`string`&&e.trim().length>0?e.trim():null,i=()=>r(`0.2.39`),a=(e,t)=>r(t)||r(e),o=(e,t)=>{let n=r(e);return n?typeof t!=`number`||!Number.isFinite(t)?n:`${n} (${t})`:null},s=async()=>{let n=i();if(!e())return n;try{let{App:e}=await t(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2]));return a((await e.getInfo()).version,n)}catch{return n}},c=async()=>{if(!e())return null;try{let{App:e}=await t(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),n=await e.getInfo(),r=typeof n.build==`string`?n.build.trim():``;if(r.length===0)return null;let i=Number.parseInt(r,10);return Number.isFinite(i)?i:null}catch{return null}},l=class extends Error{code=`mobile_updates_unsupported`;constructor(e=`Mobile OTA updates are only available in the Capacitor native app`){super(e),this.name=`MobileUpdatesUnsupportedError`}};export{s as a,c as i,o as n,n as r,l as t};
|