Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
964b7cb
feat(desktop): reference bounded Session snapshots from Composer
Sep 1, 2026
922af87
fix(ui): simplify session reference picker
Sep 1, 2026
0ef2dff
fix(core): preserve snapshot content when truncating
Sep 1, 2026
77fecae
fix(core): avoid partial snapshot role prefixes
Sep 1, 2026
a20054b
docs: document trigger menu patch seam
Sep 1, 2026
1dd2e77
fix(ui): polish Session reference presentation
Sep 1, 2026
e483415
fix(ui): keep single Session references compact
Sep 1, 2026
ab60c5a
fix(deps): regenerate Astryx core patch after merge
Sep 1, 2026
e4abb81
fix(desktop): narrow conversation feature exports
Sep 2, 2026
4994a3a
fix(desktop): keep session reference within architecture budget
Sep 2, 2026
ac26e38
fix(desktop): preserve session picker identity on refresh
Sep 2, 2026
1e9c057
fix(desktop): address session reference review feedback
Sep 3, 2026
6903279
fix(core): redact secrets from session references
Sep 3, 2026
67c7688
fix(desktop): wire conversation feature services
Sep 4, 2026
c7d50ce
ci: retry unrelated code scroll check
Sep 4, 2026
6974ec0
fix(ci): align session references with current contracts
Sep 8, 2026
796d601
fix(desktop): align session references with feature services
Sep 8, 2026
49a3d64
docs: refresh Astryx surface inventory
Sep 8, 2026
2f91b0a
fix(desktop): trim unused conversation type exports
Sep 8, 2026
dfac3c1
fix(composer): await session references before send
testikun Sep 9, 2026
9cf8d53
fix(protocol): advance Session reference compatibility epoch
testikun Sep 9, 2026
a2e3ffe
fix(desktop): resolve session references at send boundary
testikun Sep 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/desktop/e2e-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"tests": 1,
"electron": "the folder reference has to survive a renderer reload and still agree with the Host's session record"
},
"composer-session-reference.spec.ts": {
"tests": 1,
"electron": "the referenced transcript snapshot crosses renderer, preload, main process, and Runtime Host boundaries before the staged quote can be sent"
},
"context-window-save.spec.ts": {
"tests": 1,
"electron": "the saved window is read back from the Host's connection snapshot, not from renderer state"
Expand Down
80 changes: 80 additions & 0 deletions apps/desktop/e2e/composer-session-reference.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { ensureSidebarExpanded, expect, test, COMPOSER_INPUT } from './fixtures';

test('references another Session from @, including a trailing-space browse', async ({
window: page,
}, testInfo) => {
const composer = page.locator(COMPOSER_INPUT);
const sourceName = 'Reference source';
const sourcePrompt = 'source transcript marker';

await composer.fill(sourcePrompt);
await composer.press('Enter');
await expect(page.getByText(`Fake backend received: ${sourcePrompt}`)).toBeVisible();
await expect(page.getByRole('button', { name: '重新生成' })).toHaveCount(1, {
timeout: 20_000,
});

await page.evaluate(async (name) => {
const source = (await window.maka.sessions.list())[0];
if (!source) throw new Error('the source Session was not created');
await window.maka.sessions.rename(source.id, name);
}, sourceName);

await ensureSidebarExpanded(page);
const sidebar = page.getByRole('navigation', { name: '任务列表' });
await sidebar.getByRole('button', { name: '新任务', exact: true }).click();
await expect(composer).toHaveText('');

await composer.click();
await composer.pressSequentially('@');
const menu = page.getByRole('listbox', { name: '工作区文件和会话' });
await expect(menu).toBeVisible();

const sourceOption = menu.getByRole('option', { name: sourceName, exact: true });
await expect(sourceOption).toBeVisible();
await expect(sourceOption.locator('svg.lucide-messages-square')).toHaveCount(1);

await composer.press('Space');
await expect(menu).toBeVisible();
await expect(sourceOption).toBeVisible();

await composer.fill('@reference');
await expect(sourceOption).toBeVisible();
await sourceOption.click();
await expect(menu).not.toBeVisible();

const chip = page.locator('.maka-composer-session-token');
await expect(chip).toContainText(sourceName);
await expect(chip.locator('svg.lucide-messages-square')).toHaveCount(1);
await page.screenshot({ path: testInfo.outputPath('session-reference-staged.png') });

const followUp = 'continue from the referenced session';
await composer.fill(followUp);
await composer.press('Enter');
const sent = page.getByLabel('你发送的消息').last();
await expect(sent).toContainText(followUp);
await expect(sent).toContainText(sourceName);
await expect(chip).toHaveCount(0);
await expect(page.getByRole('button', { name: '重新生成' })).toHaveCount(1, {
timeout: 20_000,
});
});
30 changes: 8 additions & 22 deletions apps/desktop/renderer-architecture.json
Original file line number Diff line number Diff line change
Expand Up @@ -898,21 +898,18 @@
"nonTriviaTokens": 14338
},
"src/renderer/use-app-shell-composer-quotes.ts": {
"importDeclarations": 2,
"importDeclarations": 0,
"bridgePaths": {},
"environmentCapabilities": {},
"hookCalls": {
"useState": 1
},
"hookCalls": {},
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {
"./pending-items.js": 1,
"react": 1
"./features/conversation/index.js": 1
},
"importSpecifiers": 5,
"nonTriviaTokens": 360
"importSpecifiers": 0,
"nonTriviaTokens": 24
},
"src/renderer/use-app-shell-session-list.ts": {
"importDeclarations": 8,
Expand Down Expand Up @@ -1252,25 +1249,14 @@
}
},
"src/renderer/composer-mentions.tsx": {
"bridgePaths": {
"window.maka.mcp.subscribeChanges": 1,
"window.maka.newTasks.listInvocableSkills": 1,
"window.maka.newTasks.searchFiles": 1,
"window.maka.newTasks.subscribeChanges": 1,
"window.maka.sessions.subscribeChanges": 1,
"window.maka.skills.listInvocable": 1,
"window.maka.workspace.searchFiles": 1
},
"bridgePaths": {},
"environmentCapabilities": {},
"hookCalls": {
"useEffect": 1,
"useState": 1
},
"hookCalls": {},
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {
"react": 1
"./features/conversation/index.js": 2
}
},
"src/renderer/conversation-markdown.ts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10155,7 +10155,7 @@ THE SOFTWARE.

================================================================================

Package: js-yaml@4.3.1
Package: js-yaml@4.3.2
Declared license: MIT
Selected license: MIT
Repository: nodeca/js-yaml
Expand Down
41 changes: 34 additions & 7 deletions apps/desktop/src/main/__tests__/composer-mentions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ import { parseHTML } from 'linkedom';
import { act, createElement, useLayoutEffect } from 'react';
import { createRoot } from 'react-dom/client';
import type { InvocableSkillEntry } from '@maka/runtime/skill-invocation';
import { LocaleProvider } from '@maka/ui';
import {
ComposerMentionsProvider,
useComposerMentionsContext,
type ComposerMentions,
} from '../../renderer/composer-mentions.js';
import {
ConversationServicesProvider,
type ConversationServices,
} from '../../renderer/features/conversation/index.js';

interface CatalogObservation {
sessionId: string;
Expand Down Expand Up @@ -71,14 +76,30 @@ function installCatalogRenderer(t: TestContext) {
sessionId: string;
resolve(skills: InvocableSkillEntry[]): void;
}> = [];
(window as unknown as { maka: unknown }).maka = {
const services: ConversationServices = {
listMessages: async () => [],
cancelMessage: async () => undefined,
reconcileMessage: async () => undefined,
subscribeChanges: () => () => undefined,
skills: {
listInvocable: (sessionId: string) => new Promise<InvocableSkillEntry[]>((resolve) => {
pending.push({ sessionId, resolve });
}),
},
sessions: { subscribeChanges: () => () => {} },
mcp: { subscribeChanges: () => () => {} },
sessions: {
list: () => new Promise(() => undefined),
readSnapshot: async () => {
throw new Error('Session snapshot is not used in catalog tests');
},
subscribeChanges: () => () => undefined,
},
workspace: { searchFiles: async () => ({ ok: false, reason: 'no_project' }) },
newTasks: {
subscribeChanges: () => () => undefined,
listInvocableSkills: async () => [],
searchFiles: async () => ({ ok: false, reason: 'no_project' }),
},
mcp: { subscribeChanges: () => () => undefined },
};

const observations: CatalogObservation[] = [];
Expand Down Expand Up @@ -117,10 +138,16 @@ function installCatalogRenderer(t: TestContext) {
return observation;
},
async render(sessionId: string, skillCatalogRevision = 0) {
await act(() => root.render(createElement(ComposerMentionsProvider, {
sessionId,
skillCatalogRevision,
children: createElement(Consumer, { sessionId }),
await act(() => root.render(createElement(LocaleProvider, {
locale: 'en',
children: createElement(ConversationServicesProvider, {
services,
children: createElement(ComposerMentionsProvider, {
sessionId,
skillCatalogRevision,
children: createElement(Consumer, { sessionId }),
}),
}),
})));
},
async settleNext(sessionId: string, skills: InvocableSkillEntry[]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import assert from 'node:assert/strict';
import test from 'node:test';
import type { MakaBridge } from '../../preload/bridge-contract.js';
import { createDesktopConversationServices } from '../../renderer/platform/desktop/create-conversation-services.js';

test('Desktop conversation adapter keeps snapshot reads and catalog access on the bridge', async () => {
const calls: string[] = [];
const bridge = {
sessionLocal: {
listMessages: async () => [],
cancelMessage: async () => undefined,
reconcileMessage: async () => undefined,
subscribeChanges: () => () => undefined,
},
sessions: {
list: async () => [],
subscribeChanges: () => () => undefined,
readSnapshot: async (sessionId: string) => {
calls.push(`snapshot:${sessionId}`);
return {};
},
},
skills: { listInvocable: async () => [] },
workspace: { searchFiles: async () => ({ ok: false as const, reason: 'no_project' as const }) },
newTasks: {
subscribeChanges: () => () => undefined,
listInvocableSkills: async () => [],
searchFiles: async () => ({ ok: false as const, reason: 'no_project' as const }),
},
mcp: { subscribeChanges: () => () => undefined },
} as unknown as MakaBridge;
const services = createDesktopConversationServices(bridge);

await services.sessions.readSnapshot('source');
assert.deepEqual(await services.sessions.list(), []);
assert.deepEqual(calls, ['snapshot:source']);
});
17 changes: 17 additions & 0 deletions apps/desktop/src/main/__tests__/new-task-staged-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,23 @@ test('a Session keeps its own staged quotes, and the new-task bucket keeps its o
['quoted for the Session'],
);

await act(() => probe.latest().addQuote({
text: 'bounded session context',
label: 'Session: Research',
sourceSessionId: 'source-session',
sourceSessionName: 'Research',
sourceCapturedAt: 123,
sourceTruncated: true,
}));
assert.deepEqual(probe.latest().pendingQuotes.at(-1), {
text: 'bounded session context',
label: 'Session: Research',
sourceSessionId: 'source-session',
sourceSessionName: 'Research',
sourceCapturedAt: 123,
sourceTruncated: true,
});

await probe.render(NEW_TASK_PENDING_KEY);
assert.deepEqual(
probe.latest().pendingQuotes.map((quote) => quote.text),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,16 @@ describe('permission response IPC boundary', () => {
],
turnOrchestration: { mode: 'swarm', source: 'slash_command', ignored: true },
quotes: [
{ text: 'the excerpt', label: ' Assistant ', sourceTurnId: 'turn-9', extra: true },
{
text: 'the excerpt',
label: ' Assistant ',
sourceTurnId: 'turn-9',
sourceSessionId: 'source-session',
sourceSessionName: 'Research',
sourceCapturedAt: 123,
sourceTruncated: false,
extra: true,
},
],
workspaceFileReferences: [
{
Expand Down Expand Up @@ -223,7 +232,15 @@ describe('permission response IPC boundary', () => {
},
],
turnOrchestration: { mode: 'swarm', source: 'slash_command' },
quotes: [{ text: 'the excerpt', label: 'Assistant', sourceTurnId: 'turn-9' }],
quotes: [{
text: 'the excerpt',
label: 'Assistant',
sourceTurnId: 'turn-9',
sourceSessionId: 'source-session',
sourceSessionName: 'Research',
sourceCapturedAt: 123,
sourceTruncated: false,
}],
workspaceFileReferences: [
{
value: '@packages/ui/src/chat turn.tsx',
Expand Down Expand Up @@ -253,6 +270,7 @@ describe('permission response IPC boundary', () => {
{ type: 'send', text: 'hello', quotes: Array(17).fill({ text: 'x' }) },
{ type: 'send', text: 'hello', quotes: [{ text: '' }] },
{ type: 'send', text: 'hello', quotes: [{ text: 'x', sourceTurnId: 1 }] },
{ type: 'send', text: 'hello', quotes: [{ text: 'x', sourceSessionId: 'source-session' }] },
{ type: 'send', text: 'hello', workspaceFileReferences: {} },
{
type: 'send',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,7 @@ function executionClient(overrides: Partial<ExecutionClient>): ExecutionClient {
queryMessages: unavailable,
queryTurnResume: unavailable,
readExecutionBoundary: unavailable,
openSession: unavailable,
regenerateTurn: unavailable,
retractQueueEntry: unavailable,
promoteQueueEntry: unavailable,
Expand Down
Loading
Loading