@yuriai/web 0.3.6-beta.15 → 0.3.6-beta.17
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-DmUeOy5j.js → AgentAvatar-Bt0ODtE9.js} +1 -1
- package/dist/assets/{AgentSelector-p1Ai0tlg.js → AgentSelector-DRcx_ZQs.js} +1 -1
- package/dist/assets/{ArchivedSessionsDialog-Bjd3hgS2.js → ArchivedSessionsDialog-D9Hrnoe8.js} +1 -1
- package/dist/assets/{AssistantConversationSurface-CTYtqGK_.js → AssistantConversationSurface-B82MGZSI.js} +3 -3
- package/dist/assets/{AssistantSessionCard-CX8zzXnW.js → AssistantSessionCard-DZNj8yVx.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-Nhei_TuI.js → AssistantUnreadBadge-CQnnKD_O.js} +1 -1
- package/dist/assets/{AssistantView-BvmJC0q9.js → AssistantView-EYFjOoP6.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-BKPxjA77.js → AssistantWorkingAvatar-Co7OP4xS.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-CPYKT5su.js → AssistantsSettingsPage-DGgtOrSr.js} +1 -1
- package/dist/assets/{BinaryFileFallback-DAmQpBO1.js → BinaryFileFallback-BcGlqAM1.js} +1 -1
- package/dist/assets/{BtwPanel-BQgdeqj4.js → BtwPanel-CKSZ5LKq.js} +1 -1
- package/dist/assets/{BusyDots-CyVVXNMc.js → BusyDots-dQIHo-Ma.js} +1 -1
- package/dist/assets/{ChatContainer-_6gB1Tiu.js → ChatContainer-D_76doaH.js} +4 -4
- package/dist/assets/{ChatView-DfPX2ADw.js → ChatView-DU-_b_EH.js} +1 -1
- package/dist/assets/{DiagramView-BAZPsxz1.js → DiagramView-C0tuHBMp.js} +1 -1
- package/dist/assets/{DiffView-B_03bICv.js → DiffView-CRHue4c1.js} +1 -1
- package/dist/assets/{DiffViewToggle-CI-tbUKa.js → DiffViewToggle-D3uTowJs.js} +1 -1
- package/dist/assets/{ErrorBoundary-B1yQx4PN.js → ErrorBoundary-n23yui_O.js} +1 -1
- package/dist/assets/{FadeInOnReveal-CyF7ie8o.js → FadeInOnReveal-D2SbjK6C.js} +1 -1
- package/dist/assets/{GuiPluginMount-jUR5ZEw-.js → GuiPluginMount-Drl4CCU4.js} +1 -1
- package/dist/assets/{GuiPluginPage-Du-pLMlp.js → GuiPluginPage-DFIwtUfj.js} +1 -1
- package/dist/assets/{GuiPluginSurface-hCEJJ4PF.js → GuiPluginSurface-nrFT4ztD.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-DrOGcHI0.js → GuiPluginTitlebarItems-C-7Ph77t.js} +1 -1
- package/dist/assets/{GuiPluginWindow-CDiqRDYz.js → GuiPluginWindow-CDWjuvFN.js} +1 -1
- package/dist/assets/{Icon-D4ELZTbQ.js → Icon-CfO_2i8z.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-BKk1qYNK.js → ImageLoadingPlaceholder-qgu85eJI.js} +1 -1
- package/dist/assets/{LoadingImage-BWknOYgx.js → LoadingImage-7JiIIaoG.js} +1 -1
- package/dist/assets/{MarkdownRenderer-B8pnxnuP.js → MarkdownRenderer-iKD6XWgd.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-HvxkLk8k.js → MarkdownRendererImpl-Mcnt6PjF.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-oBJscGhT.js → MarkstreamRendererImpl-iG1jBKhy.js} +1 -1
- package/dist/assets/{MobileAssistantSettingsPage-ADZ_zb24.js → MobileAssistantSettingsPage-DmNuGjld.js} +1 -1
- package/dist/assets/{MobileAssistantTab-D2B1DhXn.js → MobileAssistantTab-CIvNRFvS.js} +1 -1
- package/dist/assets/{MobileBtwPage-D9AHKfUL.js → MobileBtwPage-D5mXBLA1.js} +1 -1
- package/dist/assets/{MobileChangesSurface-C-fS41BA.js → MobileChangesSurface-DhW8ecAl.js} +1 -1
- package/dist/assets/{MobileChatScreen-CpjY3NfP.js → MobileChatScreen-BKAI0EMZ.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DyEDDj7j.js → MobileDetailNavigation-DscFc9cA.js} +1 -1
- package/dist/assets/{MobileFilesSurface-i1CdOJt_.js → MobileFilesSurface-BHbQRuuZ.js} +2 -2
- package/dist/assets/{MobileHtmlNetworkBoundary-B0eGttNW.js → MobileHtmlNetworkBoundary-SkR4tADw.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-BRsSjQB0.js → MobileOverlayPanel-BWdpCuxm.js} +1 -1
- package/dist/assets/{MobileResizableSheet-Iz6IOJIC.js → MobileResizableSheet-yfyTX8Oo.js} +1 -1
- package/dist/assets/{MobileSettingsTab-IFxVifD4.js → MobileSettingsTab-C1zQ-7d4.js} +1 -1
- package/dist/assets/{MobileShareBridge-CYupKqbK.js → MobileShareBridge-BFbt-sk7.js} +1 -1
- package/dist/assets/{MobileSurface-Dj0XqWPS.js → MobileSurface-y5ztB7tU.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-DyDjEHij.js → MobileTabPageHeader-DbpsZVSd.js} +1 -1
- package/dist/assets/{ModelLogo-Ddsuaz2-.js → ModelLogo-CmNLEE95.js} +1 -1
- package/dist/assets/{ModelSelector-BLqwVn9h.js → ModelSelector-BVX9JJcb.js} +1 -1
- package/dist/assets/{MultiRunWindow-DOpqKyhx.js → MultiRunWindow-oHtBAdJv.js} +1 -1
- package/dist/assets/{OnboardingScreen-CyYxHZ27.js → OnboardingScreen-C3_aPUBH.js} +1 -1
- package/dist/assets/{OverlayScrollbar-DdK6iB_P.js → OverlayScrollbar-D1mX1ML1.js} +1 -1
- package/dist/assets/{PierreDiffViewer-DnLcVaQ_.js → PierreDiffViewer-BNCT7k1n.js} +1 -1
- package/dist/assets/{ProviderLogo-ClFNH0bR.js → ProviderLogo-Dc-sC7dP.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-Bf3dzN6s.js → RemoteAssistantSessionCard-DdwBtdTg.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-CYrH1ew9.js → RemoteDesktopPanel-CtdvGhZf.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Cjl3xt0U.js → ScheduledTasksDialog-DDiPlJh7.js} +1 -1
- package/dist/assets/{ScrollableOverlay-CpChvNBP.js → ScrollableOverlay-ByQtZZ3X.js} +1 -1
- package/dist/assets/{SettingsGroup-DiF6MwFq.js → SettingsGroup-I-AOS-W6.js} +1 -1
- package/dist/assets/{SettingsView-BG9k0S0n.js → SettingsView-CO6x-AEZ.js} +1 -1
- package/dist/assets/{SettingsWindow-CZqmOqJh.js → SettingsWindow-LrZQ0kzk.js} +1 -1
- package/dist/assets/{SetupTourDialog-Dm893t6A.js → SetupTourDialog-QMFyakMf.js} +1 -1
- package/dist/assets/{SyncActions-DxL0WqMS.js → SyncActions-DMLAgyBA.js} +1 -1
- package/dist/assets/{TerminalView-Cm_Az2IR.js → TerminalView-CM7WLYqz.js} +1 -1
- package/dist/assets/{TextSelectionMenu-C-QA2JSI.js → TextSelectionMenu-BNa9CCBn.js} +1 -1
- package/dist/assets/{ToolOutputDialog-IbK1m1cQ.js → ToolOutputDialog-DV0EAm53.js} +1 -1
- package/dist/assets/{assistantMessagePreview-DbTwPLzY.js → assistantMessagePreview-IXh41ri6.js} +1 -1
- package/dist/assets/{assistantQueries-DJyuR5Cm.js → assistantQueries-JkdxtUmV.js} +1 -1
- package/dist/assets/{auto-read-context-B0niCh-F.js → auto-read-context-CVIcuGan.js} +1 -1
- package/dist/assets/{capgoAdapter-CXshem6r.js → capgoAdapter-0ZrNrgn7.js} +1 -1
- package/dist/assets/{card-BCtykvi_.js → card-4IJyHoCN.js} +1 -1
- package/dist/assets/{chatUpwardIntent-DR7dxJwx.js → chatUpwardIntent-BFgRZSrN.js} +1 -1
- package/dist/assets/{checkbox-DsB97EEi.js → checkbox-B-alKvb4.js} +1 -1
- package/dist/assets/{collapsible-acYUve5w.js → collapsible-BtvaDglG.js} +1 -1
- package/dist/assets/{connection-hint-BYkEkoO4.js → connection-hint-D1LPeZnY.js} +1 -1
- package/dist/assets/{context-menu-HoHZ2sEw.js → context-menu-DEpAiC1U.js} +1 -1
- package/dist/assets/{diagram-Bp_Qevoe.js → diagram-CB-IGhF7.js} +1 -1
- package/dist/assets/{dialog-CeXUC0Ej.js → dialog-Wb82rwEB.js} +1 -1
- package/dist/assets/{dropdown-menu-CwcXAdvN.js → dropdown-menu-y9slmwEK.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-vrvxc508.js → fileMentionTouchSelection-CtFbRCDI.js} +1 -1
- package/dist/assets/{gitApi-Di_eB3Io.js → gitApi-bb-bBVgY.js} +1 -1
- package/dist/assets/{icons-P6A_c8tb.js → icons-PMky_BAk.js} +1 -1
- package/dist/assets/{input-CozXpDTq.js → input-DWlzP3il.js} +1 -1
- package/dist/assets/{insertionBoundaries-Cw7x86o4.js → insertionBoundaries-166bwz6m.js} +1 -1
- package/dist/assets/{kbd-DPRFdABo.js → kbd-B3OadSB1.js} +1 -1
- package/dist/assets/{main-CmWGNM6N.js → main-B8v7kGWB.js} +2 -2
- package/dist/assets/{main-DxvrNIsv.js → main-CO2_WUmS.js} +5 -5
- package/dist/assets/{markdownHeightCache-BIB64pXI.js → markdownHeightCache-CmqFuEAk.js} +1 -1
- package/dist/assets/{mcpQueries-WWAWy_n9.js → mcpQueries-CgVNVr9H.js} +1 -1
- package/dist/assets/{miniChat-CA9XT4K1.js → miniChat-DWon-j9p.js} +2 -2
- package/dist/assets/{mobile-BKQlIKz3.js → mobile-Dhvk6j7o.js} +2 -2
- package/dist/assets/{mobileBackNavigation-CX_MC0oM.js → mobileBackNavigation-DQ7Ks5Mg.js} +1 -1
- package/dist/assets/{mobileConnections-DuohwVoG.js → mobileConnections-CzEUaSbB.js} +2 -2
- package/dist/assets/{multirun-DXO3dw9u.js → multirun-BbzH49WH.js} +1 -1
- package/dist/assets/{native-config-C_hqdruM.js → native-config-B0QosfID.js} +1 -1
- package/dist/assets/{nativeComposerCover-Cyi4eoBm.js → nativeComposerCover-C2r8C1wi.js} +1 -1
- package/dist/assets/{navigation-Bxjv649w.js → navigation-DXOStpft.js} +1 -1
- package/dist/assets/{openRemoteProjectSession-W9p1SC1j.js → openRemoteProjectSession-CCu0VqnR.js} +1 -1
- package/dist/assets/{openSessionFromDeepLink-CeiBnoBN.js → openSessionFromDeepLink-ByuhkhhO.js} +2 -2
- package/dist/assets/{pluginPresentation-CWyI_3os.js → pluginPresentation-BVl1Nl3W.js} +1 -1
- package/dist/assets/{pwa-RpFKwS6l.js → pwa-hhnaGlo-.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-B624kCyc.js → queue-abort-optimistic-BaXwT1o8.js} +1 -1
- package/dist/assets/{reference-history-xOIH7D3x.js → reference-history-6VQhRGyq.js} +1 -1
- package/dist/assets/{remoteSessionReference-CNows8Mw.js → remoteSessionReference-Bn8SUuKD.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-C0VEQ1ge.js → renderElectronMiniChatApp-CCJm3UWr.js} +2 -2
- package/dist/assets/{renderMobileApp-ByzqYif5.js → renderMobileApp-CicHiIqo.js} +4 -4
- package/dist/assets/{runtimeConfig-CnEfMg7l.js → runtimeConfig-CNi8OY9x.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DFqTJZ0I.js → runtimeEndpointReset-zYV2dp-1.js} +2 -2
- package/dist/assets/{select-B2UkBeQN.js → select-CvycH4RI.js} +1 -1
- package/dist/assets/{sessionLookup-DCk6ryrM.js → sessionLookup-DKsuibUL.js} +1 -1
- package/dist/assets/{sessionOwnership-BAee5GI3.js → sessionOwnership-78OvDQfC.js} +1 -1
- package/dist/assets/{shortcuts-CiFlt2ws.js → shortcuts-ByiK-hNh.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-Doz9wEki.js → sortable-tabs-strip-NufNSTHC.js} +1 -1
- package/dist/assets/{speechSettingsQueries-DxCvZVJ0.js → speechSettingsQueries-V_UQyei3.js} +1 -1
- package/dist/assets/{switch-YSNGU195.js → switch-BCU-vSI0.js} +1 -1
- package/dist/assets/{textarea-DxGZoBdI.js → textarea-BPe3mQGO.js} +1 -1
- package/dist/assets/{tooltip-D2BtRCgs.js → tooltip-B1_fU6mY.js} +1 -1
- package/dist/assets/{truncated-path-ouBMaMLS.js → truncated-path-rTpv5zrZ.js} +1 -1
- package/dist/assets/{types-B-Io5z5w.js → types-BMWiwa3n.js} +1 -1
- package/dist/assets/{ui-BwSpLYDL.js → ui-aKYupUMJ.js} +4 -4
- package/dist/assets/{useAppFontEffects-Cuirbagj.js → useAppFontEffects-CxyttsAS.js} +2 -2
- package/dist/assets/{useDesktopWindowControlsLayout-BBO7snRO.js → useDesktopWindowControlsLayout-W12iS1Ex.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DeoADFfu.js → useEffectiveDirectory-CvKtJ-KR.js} +1 -1
- package/dist/assets/{useGitStore-BVToTkFp.js → useGitStore-BfKvtfEf.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-BN8BgIUL.js → useInlineCommentDraftStore-Ktp31o8d.js} +1 -1
- package/dist/assets/{useMcpConfigStore-CFUCk1mM.js → useMcpConfigStore-ebneJxuO.js} +1 -1
- package/dist/assets/{useMobileSwipeActions-l0OHTMa8.js → useMobileSwipeActions-C7NCJMnJ.js} +1 -1
- package/dist/assets/{useMobileTranscriptSyncHint-LoxQ23zb.js → useMobileTranscriptSyncHint-DtT_3oRi.js} +1 -1
- package/dist/assets/{useModelLists-RMIHCaOi.js → useModelLists-CrAJRZsV.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-Cw5UOeLB.js → useOpenCodeReadiness-CFmQ6kzC.js} +1 -1
- package/dist/assets/{usePluginsStore-Cnj8I3MZ.js → usePluginsStore-d8PkQjpx.js} +1 -1
- package/dist/assets/{useProjectGitActions-D9TZc59T.js → useProjectGitActions-CV2Uv86S.js} +1 -1
- package/dist/assets/{useProjectGitStore-qcnLHK_q.js → useProjectGitStore-DShehdFf.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-BoNGczR0.js → useProjectRuntimeAPIs-BUrgPkh7.js} +1 -1
- package/dist/assets/{useSessionBtwStore-DD2dFcs5.js → useSessionBtwStore-CL3DE2A6.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-Cj6xIVZf.js → useStreamingTextThrottle-BBUIHFIK.js} +1 -1
- package/dist/assets/{worktreeManager-CnxL8GZi.js → worktreeManager-D29PBBPo.js} +1 -1
- package/dist/assets/{worktreeSourceBranchPreference-ii7ydXPw.js → worktreeSourceBranchPreference-DJOBzShx.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +1 -1
- package/package.json +1 -1
- package/server/index.js +22 -10
- package/server/lib/assistants/DOCUMENTATION.md +7 -3
- package/server/lib/assistants/builtin-skills.js +19 -3
- package/server/lib/assistants/builtin-skills.test.js +16 -0
- package/server/lib/assistants/harness.js +2 -1
- package/server/lib/assistants/routes.js +1 -0
- package/server/lib/assistants/service.js +6 -2
- package/server/lib/gui-customization/DOCUMENTATION.md +19 -7
- package/server/lib/gui-customization/projects-client.mjs +1 -1
- package/server/lib/gui-customization/projects.js +6 -6
- package/server/lib/gui-customization/projects.test.js +13 -2
- package/server/lib/gui-customization/remote-connections-client.mjs +1 -1
- package/server/lib/gui-customization/remote-connections.js +6 -6
- package/server/lib/gui-customization/session-skill.js +15 -3
- package/server/lib/gui-customization/skill-caller.js +18 -0
- package/server/lib/opencode/feature-routes-runtime.js +20 -3
- package/server/lib/session-index/DOCUMENTATION.md +8 -0
- package/server/lib/session-index/adopt-unindexed-session.js +46 -0
- package/server/lib/session-index/adopt-unindexed-session.test.js +77 -0
- package/server/lib/session-index/event-ingest.js +14 -1
- package/server/lib/session-index/event-ingest.test.js +18 -0
|
@@ -23,7 +23,8 @@ import { registerProjectIconRoutes } from './project-icon-routes.js';
|
|
|
23
23
|
import { registerScheduledTaskRoutes } from '../scheduled-tasks/routes.js';
|
|
24
24
|
import { registerScheduledTaskToolRoute } from '../scheduled-tasks/managed-tool-route.js';
|
|
25
25
|
import { registerScheduledTaskSessionSkill } from '../scheduled-tasks/session-skill.js';
|
|
26
|
-
import { registerCustomizationSessionSkill } from '../gui-customization/session-skill.js';
|
|
26
|
+
import { registerCustomizationSessionSkill, createCustomizationSkillInstaller } from '../gui-customization/session-skill.js';
|
|
27
|
+
import { readSharedServiceRegistration, resolveSharedServiceRegistrationPath } from './shared-service.js';
|
|
27
28
|
import { registerConversationRoutes } from '../conversations/routes.js';
|
|
28
29
|
import { registerHistoryImportRoutes } from '../history-import/routes.js';
|
|
29
30
|
import { registerSessionTurnPageRoutes } from '../session-turn-pages/routes.js';
|
|
@@ -135,6 +136,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
135
136
|
getIsExternalOpenCode = () => false,
|
|
136
137
|
getIsSharedOpenCodeService = () => false,
|
|
137
138
|
remoteConnectionsAdapter = null,
|
|
139
|
+
getHostPort = () => null,
|
|
138
140
|
forceResolvedOpenCodeBinary = null,
|
|
139
141
|
upgradeOpenCodeCli = null,
|
|
140
142
|
restartOpenCode = null,
|
|
@@ -264,8 +266,22 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
264
266
|
scheduledTaskRouter,
|
|
265
267
|
remoteConnectionsAdapter,
|
|
266
268
|
});
|
|
269
|
+
const hasAssistant = (assistantID) => assistantRoutesRuntime?.service?.hasAssistant(assistantID) ?? false;
|
|
270
|
+
// Contacts run on this Host, so they get the same staged helpers as admitted Sessions, bound to their own ID.
|
|
271
|
+
const customizationSkill = createCustomizationSkillInstaller({ yuriDataDir });
|
|
272
|
+
const resolveAssistantCustomizationSkill = async (assistantID) => {
|
|
273
|
+
const port = getHostPort();
|
|
274
|
+
if (!getIsSharedOpenCodeService() || !port) return null;
|
|
275
|
+
const registrationFile = resolveSharedServiceRegistrationPath();
|
|
276
|
+
const upstreamOrigin = new URL(buildOpenCodeUrl('/', '')).origin;
|
|
277
|
+
const registration = await readSharedServiceRegistration({ file: registrationFile });
|
|
278
|
+
if (!registration?.password || registration.origin !== upstreamOrigin
|
|
279
|
+
|| getOpenCodeAuthHeaders().Authorization !== `Basic ${Buffer.from(`opencode:${registration.password}`).toString('base64')}`) return null;
|
|
280
|
+
const binding = { hostOrigin: `http://127.0.0.1:${port}`, upstreamOrigin, registrationFile };
|
|
281
|
+
return customizationSkill.resolve({ assistantID }, { projectBinding: binding, ...(remoteConnectionsAdapter ? { remoteBinding: binding } : {}) });
|
|
282
|
+
};
|
|
267
283
|
registerRemoteConnectionsSkill(app, {
|
|
268
|
-
express, adapter: remoteConnectionsAdapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
|
|
284
|
+
express, adapter: remoteConnectionsAdapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, hasAssistant,
|
|
269
285
|
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
270
286
|
});
|
|
271
287
|
registerCustomizationSessionSkill(app, {
|
|
@@ -310,7 +326,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
310
326
|
const projectRegistry = createProjectRegistry({ persistSettings, validateDirectoryPath });
|
|
311
327
|
registerProjectsSkill(app, {
|
|
312
328
|
remoteHostGateway: routeDependencies.remoteHostGateway,
|
|
313
|
-
express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
|
|
329
|
+
express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, hasAssistant,
|
|
314
330
|
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
315
331
|
registerProject: (input) => projectRegistry.register(input), readSettingsFromDiskStrict, sanitizeProjects,
|
|
316
332
|
sessionLifecycle: createProjectSessionLifecycle({
|
|
@@ -354,6 +370,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
354
370
|
getServerId,
|
|
355
371
|
getAllowedRoots: () => assistantAllowedRoots,
|
|
356
372
|
registerProject: registerAssistantProject,
|
|
373
|
+
resolveCustomizationSkill: resolveAssistantCustomizationSkill,
|
|
357
374
|
listProjects: async () => {
|
|
358
375
|
const settings = await readSettingsFromDiskMigrated();
|
|
359
376
|
return sanitizeProjects(settings?.projects ?? [])
|
|
@@ -168,6 +168,14 @@ completion events advance the separate `activity_updated_at` ordering field,
|
|
|
168
168
|
while session status transitions update `status` and `status_changed_at`.
|
|
169
169
|
Renderer event handling never performs these index writes and assistant
|
|
170
170
|
streaming events never change session ordering.
|
|
171
|
+
A user message for a session the index does not hold (an old session outside the
|
|
172
|
+
newest-20 window, or one resumed from history) is handed to
|
|
173
|
+
`adopt-unindexed-session.js`: it reads the session upstream, applies the Host
|
|
174
|
+
projection, lifts its clock to the message time so the retention bound accepts it,
|
|
175
|
+
writes the row and publishes a change. Concurrent messages share one read, a failed
|
|
176
|
+
read is retried by the next message, and a row written live meanwhile wins. Without
|
|
177
|
+
this the task view (which only lists indexed idle sessions) and recency ordering
|
|
178
|
+
would drop such a session as soon as its run ends.
|
|
171
179
|
Native creation projects the event's session identity, location, parent, metadata
|
|
172
180
|
and creation clock before the Host metadata overlay. User inbox enqueue advances
|
|
173
181
|
activity; native execution/retry events update status, and successful completion
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brings a session back into the index when the user writes to it while the
|
|
3
|
+
* index does not hold it (an old session outside the newest-20 window, or one
|
|
4
|
+
* resumed from history). `touchActivity` only updates existing rows, so without
|
|
5
|
+
* this the session never regains task-view membership or recency ordering.
|
|
6
|
+
*
|
|
7
|
+
* @param {object} deps
|
|
8
|
+
* @param {object} deps.service session-index service
|
|
9
|
+
* @param {(input: { sessionID: string, directory: string | null }) => Promise<object | null>} deps.fetchSession
|
|
10
|
+
* @param {(session: object) => object | null | undefined} deps.projectSession
|
|
11
|
+
* Host authority projection; `null` means Host metadata is unavailable.
|
|
12
|
+
* @param {() => void} deps.onChanged
|
|
13
|
+
* @param {(message: string, error?: unknown) => void} [deps.warn]
|
|
14
|
+
*/
|
|
15
|
+
export const createUnindexedSessionAdopter = ({
|
|
16
|
+
service,
|
|
17
|
+
fetchSession,
|
|
18
|
+
projectSession,
|
|
19
|
+
onChanged,
|
|
20
|
+
warn = console.warn,
|
|
21
|
+
}) => {
|
|
22
|
+
const inFlight = new Set();
|
|
23
|
+
|
|
24
|
+
return (sessionID, directory, activityAt) => {
|
|
25
|
+
if (inFlight.has(sessionID)) return;
|
|
26
|
+
inFlight.add(sessionID);
|
|
27
|
+
void (async () => {
|
|
28
|
+
try {
|
|
29
|
+
const upstream = await fetchSession({ sessionID, directory: directory || null });
|
|
30
|
+
if (!upstream || service.findBySessionId(sessionID)) return;
|
|
31
|
+
const projected = projectSession(upstream);
|
|
32
|
+
if (projected == null) return;
|
|
33
|
+
// The user message is newer than a possibly stale upstream clock; without
|
|
34
|
+
// this the newest-20 retention bound would refuse the row.
|
|
35
|
+
const time = { ...projected.time, updated: Math.max(Number(projected.time?.updated) || 0, activityAt) };
|
|
36
|
+
const upserted = service.upsertAndReportChange({ ...projected, time }, Date.now());
|
|
37
|
+
const touched = service.touchActivity(sessionID, activityAt);
|
|
38
|
+
if (upserted || touched) onChanged();
|
|
39
|
+
} catch (error) {
|
|
40
|
+
warn('[session-index] adopting an unindexed session failed:', error?.message ?? error);
|
|
41
|
+
} finally {
|
|
42
|
+
inFlight.delete(sessionID);
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createUnindexedSessionAdopter } from './adopt-unindexed-session.js';
|
|
3
|
+
|
|
4
|
+
const flush = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
5
|
+
|
|
6
|
+
const setup = (overrides = {}) => {
|
|
7
|
+
const service = {
|
|
8
|
+
findBySessionId: vi.fn(() => null),
|
|
9
|
+
upsertAndReportChange: vi.fn(() => true),
|
|
10
|
+
touchActivity: vi.fn(() => true),
|
|
11
|
+
};
|
|
12
|
+
const deps = {
|
|
13
|
+
service,
|
|
14
|
+
fetchSession: vi.fn(async () => ({ id: 'ses_old', directory: '/repo', time: { created: 1, updated: 2 } })),
|
|
15
|
+
projectSession: vi.fn((session) => ({ ...session, projected: true })),
|
|
16
|
+
onChanged: vi.fn(),
|
|
17
|
+
warn: vi.fn(),
|
|
18
|
+
...overrides,
|
|
19
|
+
};
|
|
20
|
+
return { service, deps, adopt: createUnindexedSessionAdopter(deps) };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe('createUnindexedSessionAdopter', () => {
|
|
24
|
+
it('writes the projected upstream session and advances activity to the user message', async () => {
|
|
25
|
+
const { service, deps, adopt } = setup();
|
|
26
|
+
adopt('ses_old', '/repo', 900);
|
|
27
|
+
await flush();
|
|
28
|
+
expect(deps.fetchSession).toHaveBeenCalledWith({ sessionID: 'ses_old', directory: '/repo' });
|
|
29
|
+
expect(service.upsertAndReportChange).toHaveBeenCalledWith(
|
|
30
|
+
expect.objectContaining({ id: 'ses_old', projected: true, time: { created: 1, updated: 900 } }),
|
|
31
|
+
expect.any(Number),
|
|
32
|
+
);
|
|
33
|
+
expect(service.touchActivity).toHaveBeenCalledWith('ses_old', 900);
|
|
34
|
+
expect(deps.onChanged).toHaveBeenCalledTimes(1);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('coalesces a burst of messages into one upstream read', async () => {
|
|
38
|
+
const { deps, adopt } = setup();
|
|
39
|
+
adopt('ses_old', '', 1);
|
|
40
|
+
adopt('ses_old', '', 2);
|
|
41
|
+
await flush();
|
|
42
|
+
expect(deps.fetchSession).toHaveBeenCalledTimes(1);
|
|
43
|
+
expect(deps.fetchSession).toHaveBeenCalledWith({ sessionID: 'ses_old', directory: null });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('writes nothing when Host metadata is unavailable or the session is missing upstream', async () => {
|
|
47
|
+
const unavailable = setup({ projectSession: vi.fn(() => null) });
|
|
48
|
+
unavailable.adopt('ses_old', '/repo', 1);
|
|
49
|
+
const missing = setup({ fetchSession: vi.fn(async () => null) });
|
|
50
|
+
missing.adopt('ses_old', '/repo', 1);
|
|
51
|
+
await flush();
|
|
52
|
+
expect(unavailable.service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
53
|
+
expect(missing.service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
54
|
+
expect(unavailable.deps.onChanged).not.toHaveBeenCalled();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('keeps a live-written row instead of overwriting it with the upstream read', async () => {
|
|
58
|
+
const { service, adopt } = setup();
|
|
59
|
+
service.findBySessionId.mockReturnValue({ id: 'ses_old' });
|
|
60
|
+
adopt('ses_old', '/repo', 1);
|
|
61
|
+
await flush();
|
|
62
|
+
expect(service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('reports a failed fetch and allows a later message to retry', async () => {
|
|
66
|
+
const fetchSession = vi.fn()
|
|
67
|
+
.mockRejectedValueOnce(new Error('offline'))
|
|
68
|
+
.mockResolvedValueOnce({ id: 'ses_old', directory: '/repo', time: {} });
|
|
69
|
+
const { service, deps, adopt } = setup({ fetchSession });
|
|
70
|
+
adopt('ses_old', '/repo', 1);
|
|
71
|
+
await flush();
|
|
72
|
+
expect(deps.warn).toHaveBeenCalledTimes(1);
|
|
73
|
+
adopt('ses_old', '/repo', 2);
|
|
74
|
+
await flush();
|
|
75
|
+
expect(service.upsertAndReportChange).toHaveBeenCalledTimes(1);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -26,6 +26,9 @@ const withDirectory = (session, directory) => {
|
|
|
26
26
|
* @param {(sessionID: string) => void | Promise<void>} [options.onSessionDeleted]
|
|
27
27
|
* @param {() => boolean} [options.isHostReady]
|
|
28
28
|
* When false, session lifecycle upserts are skipped until metadata is ready.
|
|
29
|
+
* @param {(sessionID: string, directory: string, activityAt: number) => void} [options.onUnindexedUserActivity]
|
|
30
|
+
* Called when a user message targets a session the index does not hold (an old
|
|
31
|
+
* session outside the newest-20 window); the owner adopts it asynchronously.
|
|
29
32
|
*/
|
|
30
33
|
export const applySessionIndexEvent = (service, event, observedAt = Date.now(), options = {}) => {
|
|
31
34
|
if (!service || !event || typeof event !== 'object') return false;
|
|
@@ -35,6 +38,9 @@ export const applySessionIndexEvent = (service, event, observedAt = Date.now(),
|
|
|
35
38
|
const projectSession = typeof options.projectSession === 'function' ? options.projectSession : null;
|
|
36
39
|
const onSessionDeleted = typeof options.onSessionDeleted === 'function' ? options.onSessionDeleted : null;
|
|
37
40
|
const isHostReady = typeof options.isHostReady === 'function' ? options.isHostReady : null;
|
|
41
|
+
const onUnindexedUserActivity = typeof options.onUnindexedUserActivity === 'function'
|
|
42
|
+
? options.onUnindexedUserActivity
|
|
43
|
+
: null;
|
|
38
44
|
|
|
39
45
|
const baseType = normalizeSessionEventType(payload.type);
|
|
40
46
|
|
|
@@ -127,14 +133,21 @@ export const applySessionIndexEvent = (service, event, observedAt = Date.now(),
|
|
|
127
133
|
const activityAt = typeof info.time?.created === 'number' ? info.time.created : observedAt;
|
|
128
134
|
const activityChanged = service.touchActivity(info.sessionID, activityAt);
|
|
129
135
|
const settleCleared = service.clearSettleOverride?.(info.sessionID) ?? false;
|
|
136
|
+
if (!activityChanged && onUnindexedUserActivity && !service.findBySessionId?.(info.sessionID)) {
|
|
137
|
+
onUnindexedUserActivity(info.sessionID, directory, activityAt);
|
|
138
|
+
}
|
|
130
139
|
return activityChanged || settleCleared;
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
if (baseType === 'session.inbox.enqueued') {
|
|
134
143
|
const data = payload.data ?? properties;
|
|
135
144
|
if (data.item?.type !== 'user' || typeof data.sessionID !== 'string') return false;
|
|
136
|
-
const
|
|
145
|
+
const activityAt = data.item.time?.created ?? payload.created ?? observedAt;
|
|
146
|
+
const activityChanged = service.touchActivity(data.sessionID, activityAt);
|
|
137
147
|
const settleCleared = service.clearSettleOverride?.(data.sessionID) ?? false;
|
|
148
|
+
if (!activityChanged && onUnindexedUserActivity && !service.findBySessionId?.(data.sessionID)) {
|
|
149
|
+
onUnindexedUserActivity(data.sessionID, directory, activityAt);
|
|
150
|
+
}
|
|
138
151
|
return activityChanged || settleCleared;
|
|
139
152
|
}
|
|
140
153
|
|
|
@@ -61,6 +61,24 @@ describe('session index event ingest', () => {
|
|
|
61
61
|
expect(applySessionIndexEvent(service, { payload: { type: 'session.idle', properties: { sessionID: 'ses_a' } } }, 30)).toBe(false);
|
|
62
62
|
expect(service.clearSettleOverride).not.toHaveBeenCalled();
|
|
63
63
|
});
|
|
64
|
+
it('hands user input for a session the index does not hold to the adopter, once per event', () => {
|
|
65
|
+
const adopt = vi.fn();
|
|
66
|
+
const service = { touchActivity: vi.fn(() => false), findBySessionId: vi.fn(() => null), clearSettleOverride: vi.fn(() => false) };
|
|
67
|
+
const user = { directory: '/repo', payload: { type: 'message.updated', properties: { info: { role: 'user', sessionID: 'ses_old', time: { created: 5 } } } } };
|
|
68
|
+
applySessionIndexEvent(service, user, 30, { onUnindexedUserActivity: adopt });
|
|
69
|
+
expect(adopt).toHaveBeenCalledWith('ses_old', '/repo', 5);
|
|
70
|
+
adopt.mockClear();
|
|
71
|
+
applySessionIndexEvent(service, { directory: '/repo', payload: { type: 'session.inbox.enqueued', data: { sessionID: 'ses_old', item: { type: 'user', time: { created: 7 } } } } }, 30, { onUnindexedUserActivity: adopt });
|
|
72
|
+
expect(adopt).toHaveBeenCalledWith('ses_old', '/repo', 7);
|
|
73
|
+
});
|
|
74
|
+
it('does not adopt a session the index already holds, or assistant messages', () => {
|
|
75
|
+
const adopt = vi.fn();
|
|
76
|
+
const service = { touchActivity: vi.fn(() => false), findBySessionId: vi.fn(() => ({ id: 'ses_held' })), clearSettleOverride: vi.fn(() => false) };
|
|
77
|
+
const user = { payload: { type: 'message.updated', properties: { info: { role: 'user', sessionID: 'ses_held', time: { created: 5 } } } } };
|
|
78
|
+
applySessionIndexEvent(service, user, 30, { onUnindexedUserActivity: adopt });
|
|
79
|
+
applySessionIndexEvent({ ...service, findBySessionId: () => null }, { payload: { type: 'message.updated', properties: { info: { role: 'assistant', sessionID: 'ses_old' } } } }, 30, { onUnindexedUserActivity: adopt });
|
|
80
|
+
expect(adopt).not.toHaveBeenCalled();
|
|
81
|
+
});
|
|
64
82
|
it('takes moved ownership from native data rather than the old event envelope directory', () => {
|
|
65
83
|
const service = { move: vi.fn(() => true) };
|
|
66
84
|
expect(applySessionIndexEvent(service, { directory: '/old', payload: {
|