Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix: address PR review and CI on the My browser change
Dashf0da1c745372
diff --git a/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-agent-tasks.md b/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-agent-tasks.mdindex 6a5312fc66..049aab043b 100644--- a/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-agent-tasks.md+++ b/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-agent-tasks.md@@ -271,7 +271,7 @@ text 与 context 合计不超过 64000;tasks.send 的 text 上限仍为 32768原有 `cindy.tasks` 的归属限制不变。先调用 `capabilities()` 获取实际支持操作。当前仅支持本插件创建的本机普通任务:`models`、`create`、`get`、`setModel`、`list`、`send`、`getRun`、`listRuns`、`readMessages`、`cancel`、`setHidden`、`archive`。-`archive({taskId})` 归档自有的空闲任务(执行中或有排队输入时 `TASK_BUSY`),用户可随时恢复;没有删除接口。按视频、按文档等开新任务的插件,切换时归档上一条,避免后台任务堆积。+`archive({taskId})` 归档自有的空闲任务(忙时 `TASK_BUSY`),用户可恢复,没有删除接口;按视频等开新任务的插件,切换时归档上一条。可对自有任务调用 `startTeam({taskId})` 启用 Orca 主任务,并用 `getTeam({taskId})` 读取实际协同状态。协调主任务需经用户授权 Auto,Worker 自动沿用 Auto。这些任务及其 Worker 不提供 `cindy_helper` 的账号级历史或跨任务控制能力,`cindy_memory.session_search` 也拒绝历史检索;协调使用独立 Orca 工具,结果由插件通过 `readMessages/getTeam` 读取。旧 errand/workspace 不因来源标记受到限制;明确卸载撤销归属后,调用方已无正在执行的输入或已接受新真人输入时,保留的用户任务恢复普通 helper 与历史检索能力;仍执行旧插件输入时继续受限,自动回报和插件输入重试不构成真人接管。这不恢复插件控制权,也不保证停止已接受执行,不构成通用执行沙箱。在首次派发前调用 `setTeamPlan({taskId,plan:{concurrency,task,items}})`,每项包含diff --git a/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-manifest.md b/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-manifest.mdindex d3aacd5cc2..269ae52899 100644--- a/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-manifest.md+++ b/apps/desktop/resources/system-skills/cindy-plugin-creator/references/plugin-manifest.md@@ -160,7 +160,7 @@ v3 直接用顶层字段声明插件贡献项与自主 Host 能力,不再有 ``agent`、`panel`、`mainView`、`taskView`、`card`、`subscribe`、`network`、`node`、`preview`、`browserExtension`、`skill`;布尔能力写成字面量 `true`:`notify`、`badge`、`confirm`、`fs`、`library`、`deviceSync`、`sessionContext`、`pick`、`workspace`。不用的字段直接省略。-`deviceSync` 的声明与调用约定见 [§4.10.2 同账号电脑间的插件资料同步](plugin-files-and-library.md#4102-同账号电脑间的插件资料同步)。+`deviceSync` 的声明与调用约定见 [§4.10.2 资料同步](plugin-files-and-library.md#4102-同账号电脑间的插件资料同步)。邮件插件声明 `mail: true`,调用 Cindy 内置 `cindyMail.register(adapter)`(version 1),不生成卡片 HTML、不打包公共流程;纯邮件插件不需要 `card`。阅读邮件可声明 `mailReader:{tool,hosts}`,工具接收 `{url}` 并返回 MailMessage,默认只读。diff --git a/apps/desktop/src/main/browser-extension/__tests__/bridge.test.ts b/apps/desktop/src/main/browser-extension/__tests__/bridge.test.tsindex 06f84cfca6..be2ab7f64f 100644--- a/apps/desktop/src/main/browser-extension/__tests__/bridge.test.ts+++ b/apps/desktop/src/main/browser-extension/__tests__/bridge.test.ts@@ -639,6 +639,34 @@ describe('bridge · 作业生命周期', () => {expect(redirected.text).toBeUndefined();});+ // Review 2026-10-29 (Codex P1): network-result entries were forwarded to the model with their URLs+ // untouched, including OAuth codes and embedded credentials.+ it('网络请求结果里的地址也由宿主脱敏', async () => {+ const { bridge, ready } = await fixture();+ const c = await ready();+ const p = bridge.act('requests', { url: 'https://example.test', tabId: 1 });+ await sleep(5);+ const { job } = await c.request('/poll');+ await c.request('/ack', { id: job.id });+ await c.request('/result', {+ id: job.id,+ result: {+ ok: true,+ requests: [+ { url: 'https://example.test/cb?code=11111111-1111-4111-8111-111111111111', status: 200 },+ { url: 'https://user:[email protected]/path', status: 200 },+ { url: 'https://example.test/' + 'a'.repeat(9000), status: 200 },+ ],+ },+ });+ const result = await p;+ const requests = result.requests as Array<{ url: string | null; status: number }>;+ expect(requests[0].url).not.toContain('11111111');+ expect(requests[1].url).not.toContain('secret');+ expect(requests[2].url).toBeNull();+ expect(requests.map((r) => r.status)).toEqual([200, 200, 200]);+ });+it('提取结果的最终预算覆盖脱敏后的增长;__proto__ 字段按自有属性保留', async () => {const { bridge, ready } = await fixture({ jobTimeout: 3000 });const c = await ready();diff --git a/apps/desktop/src/main/browser-extension/__tests__/native-binding.test.ts b/apps/desktop/src/main/browser-extension/__tests__/native-binding.test.tsindex 177fe2f7a4..015af5a88d 100644--- a/apps/desktop/src/main/browser-extension/__tests__/native-binding.test.ts+++ b/apps/desktop/src/main/browser-extension/__tests__/native-binding.test.ts@@ -17,11 +17,15 @@ import path from 'node:path';import { afterEach, describe, expect, it, vi } from 'vitest';+import net from 'node:net';+import { createNativeBinding } from '../native-binding';const EXT = 'a'.repeat(32);const dirs: string[] = [];+const servers: net.Server[] = [];afterEach(async () => {+ await Promise.all(servers.splice(0).map((server) => new Promise<void>((resolve) => server.close(() => resolve()))));await Promise.all(dirs.splice(0).map((dir) => fs.rm(dir, { recursive: true, force: true })));});@@ -64,8 +68,11 @@ describe('native-binding', () => {path: path.join(root, 'cindy-browser-native'),});expect(JSON.stringify(manifest)).not.toContain(n.token);- expect((await fs.stat(path.join(root, 'connections', '18819.json'))).mode & 0o777).toBe(0o600);- expect((await fs.stat(root)).mode & 0o777).toBe(0o700);+ // Windows reports its own permission bits (0o666); owner-only modes are a POSIX property.+ if (process.platform !== 'win32') {+ expect((await fs.stat(path.join(root, 'connections', '18819.json'))).mode & 0o777).toBe(0o600);+ expect((await fs.stat(root)).mode & 0o777).toBe(0o700);+ }expect(await fs.readFile(path.join(root, 'cindy-browser-native'), 'utf8')).toBe('fixture executable',);@@ -84,13 +91,18 @@ describe('native-binding', () => {platform: 'darwin' as const,arch: 'arm64',};+ // The instance that kept the port is running, so something listens on it.+ const server = net.createServer();+ await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));+ servers.push(server);+ const port = (server.address() as net.AddressInfo).port;const a = createNativeBinding(opts);const b = createNativeBinding(opts);- await a.install(18819, [EXT]);- await b.install(18819, [EXT]);+ await a.install(port, [EXT]);+ await b.install(port, [EXT]);await a.close();expect(- JSON.parse(await fs.readFile(path.join(root, 'connections', '18819.json'), 'utf8')).token,+ JSON.parse(await fs.readFile(path.join(root, 'connections', `${port}.json`), 'utf8')).token,).toBe(b.token);await b.close();});@@ -108,16 +120,52 @@ describe('native-binding', () => {arch: 'arm64',};const registration = path.join(profile, 'NativeMessagingHosts', 'com.example.browser.json');+ // A running Cindy listens on the port its connection file names.+ const listen = async () => {+ const server = net.createServer();+ await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));+ servers.push(server);+ return (server.address() as net.AddressInfo).port;+ };+ const releasePort = await listen();+ const devPort = await listen();const release = createNativeBinding(opts);const dev = createNativeBinding(opts);- await release.install(18810, [EXT]);- await dev.install(18811, [EXT]);+ await release.install(releasePort, [EXT]);+ await dev.install(devPort, [EXT]);await dev.close();await expect(fs.access(registration)).resolves.toBeUndefined();await release.close();await expect(fs.access(registration)).rejects.toThrow();});+ // Review 2026-10-29 (Greptile P2): a crashed Cindy leaves its connection file, which then kept the+ // registration alive for good once another port was in use.+ it('ignores and clears the connection file a crashed Cindy left behind', async () => {+ const { binaryDir, profile, root } = await fixture();+ const opts = {+ hostName: 'com.example.browser',+ binaryDir,+ root,+ profiles: [profile],+ platform: 'darwin' as const,+ arch: 'arm64',+ };+ const registration = path.join(profile, 'NativeMessagingHosts', 'com.example.browser.json');+ const server = net.createServer();+ await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));+ servers.push(server);+ const port = (server.address() as net.AddressInfo).port;+ // Nothing listens on this port any more.+ const deadPort = port === 65535 ? port - 1 : port + 1;+ const live = createNativeBinding(opts);+ await live.install(port, [EXT]);+ await fs.writeFile(path.join(root, 'connections', `${deadPort}.json`), JSON.stringify({ token: 'x'.repeat(64) }));+ await live.close();+ await expect(fs.access(registration)).rejects.toThrow();+ await expect(fs.access(path.join(root, 'connections', `${deadPort}.json`))).rejects.toThrow();+ });+it('Windows registration uses only current-user fixed registry keys and argv', async () => {const { dir, binaryDir } = await fixture();await fs.mkdir(path.join(binaryDir, 'win32-x64'), { recursive: true });diff --git a/apps/desktop/src/main/browser-extension/bridge.ts b/apps/desktop/src/main/browser-extension/bridge.tsindex 65fdc2a189..84f00fc6bb 100644--- a/apps/desktop/src/main/browser-extension/bridge.ts+++ b/apps/desktop/src/main/browser-extension/bridge.ts@@ -419,6 +419,14 @@ export class BrowserExtensionBridge {l && typeof l.url === 'string' ? { ...l, url: redactBrowserUrl(l.url) } : l,);}+ if (Array.isArray(out.requests)) {+ // Network results carry page URLs too (OAuth codes, reset tokens, embedded credentials).+ out.requests = out.requests.map((r: { url?: unknown }) =>+ r && typeof r === 'object' && typeof r.url === 'string'+ ? { ...r, url: r.url.length > 8192 ? null : redactBrowserUrl(r.url) }+ : r,+ );+ }let remaining = maxChars;const boundRecord = (entry: unknown): unknown => {if (!entry || typeof entry !== 'object') return entry;diff --git a/apps/desktop/src/main/browser-extension/native-binding.ts b/apps/desktop/src/main/browser-extension/native-binding.tsindex cab6ad1b8f..bc07dc774e 100644--- a/apps/desktop/src/main/browser-extension/native-binding.ts+++ b/apps/desktop/src/main/browser-extension/native-binding.ts@@ -14,6 +14,7 @@ import os from 'node:os';import crypto from 'node:crypto';import { execFile } from 'node:child_process';import { promisify } from 'node:util';+import net from 'node:net';export interface NativeBindingOptions {/** 注册名(身份卡 browserExtension.nativeHost.name)。 */@@ -110,6 +111,20 @@ export function createNativeBinding(options: NativeBindingOptions): NativeBindin);}+ /** Whether something answers on the loopback port a connection file names. */+ function portListening(port: number): Promise<boolean> {+ return new Promise((resolve) => {+ const socket = net.connect({ host: '127.0.0.1', port });+ const done = (value: boolean) => {+ socket.destroy();+ resolve(value);+ };+ socket.setTimeout(500, () => done(false));+ socket.once('connect', () => done(true));+ socket.once('error', () => done(false));+ });+ }+/*** Withdraw the browser registrations once no Cindy still serves a connection. The registration* is shared by every Cindy on this account (release and dev builds, both editions), and each@@ -117,8 +132,22 @@ export function createNativeBinding(options: NativeBindingOptions): NativeBindin* cut that one off until it restarts.*/async function unregisterIfUnused(): Promise<void> {- const live = await fs.readdir(path.join(root, 'connections')).catch(() => null);- if (live === null || live.some((name) => name.endsWith('.json'))) return;+ const dir = path.join(root, 'connections');+ const names = await fs.readdir(dir).catch(() => null);+ if (names === null) return;+ // A crashed Cindy leaves its file behind. A file whose port nothing listens on is stale: clear+ // it so it cannot keep the registration alive forever. An unreadable name counts as live.+ let anyLive = false;+ for (const name of names) {+ if (!name.endsWith('.json')) continue;+ const port = Number(name.slice(0, -'.json'.length));+ if (Number.isInteger(port) && port > 0 && !(await portListening(port))) {+ await fs.rm(path.join(dir, name), { force: true }).catch(() => undefined);+ } else {+ anyLive = true;+ }+ }+ if (anyLive) return;const binaryName = 'cindy-browser-native' + (platform === 'win32' ? '.exe' : '');const ours = path.join(root, binaryName);if (platform === 'win32') {diff --git a/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.tsindex 5bfbaffacb..6e26d43687 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts@@ -365,6 +365,31 @@ describe('browserExtensionSlot · 管子上行', () => {// Review 2026-10-29: with no cached policy the host bridge must not fall back to "allow every// site" while the plugin still holds the user's blocklist; it waits and asks the plugin.+ // Review 2026-10-29 (Greptile P1): a setPolicy that was still waiting when the account switched+ // saved the old account's permissions and pairings into the new account's cache.+ it('切换账号时在途的策略写入仍落在原账号的缓存目录', async () => {+ const other = await fs.mkdtemp(path.join(os.tmpdir(), 'cindy-browser-extension-slot-b-'));+ dirs.push(other);+ const { slot, bridges, dir, deps } = await makeSlot();+ slot.reconcile([extGhost()]);+ await vi.waitFor(() => expect(bridges[0]?.started).toBe(true));+ let release: () => void = () => undefined;+ const gate = new Promise<void>((resolve) => (release = resolve));+ const realSetPolicy = bridges[0].setPolicy.bind(bridges[0]);+ bridges[0].setPolicy = async (policy: unknown) => {+ await gate;+ return realSetPolicy(policy);+ };+ const policy = { read: { block: ['blocked.test'] }, interact: { allow: ['example.test'], block: [] } };+ const pending = slot.handleRequest('_root__my-browser', { kind: 'setPolicy', policy });+ // The account switches while the job is still settling.+ (deps as { policyDir: () => string }).policyDir = () => other;+ release();+ expect(await pending).toMatchObject({ ok: true });+ await expect(fs.readFile(path.join(dir, encodeURIComponent('_root__my-browser') + '.json'), 'utf8')).resolves.toContain('blocked.test');+ expect(await fs.readdir(other)).toEqual([]);+ });+it('没有缓存策略时让桥接等待策略并向插件索要;配对随策略一起落盘', async () => {const { slot, bridges, sent, dir } = await makeSlot();slot.reconcile([extGhost()]);diff --git a/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts b/apps/desktop/src/main/cindy-brain/browserExtensionSlot.tsindex 62b3aaa158..381ac471c4 100644--- a/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts+++ b/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts@@ -104,6 +104,12 @@ interface Entry {saved: SavedBrowserExtensionState;/** Serialises cache writes so an older write cannot land after a newer one. */writes: Promise<void>;+ /**+ * Cache directory of the account this entry was created for. Fixed at creation: an account+ * switch changes policyDir() while a setPolicy may still be waiting, and its permissions and+ * pairings must never be written into the new account's cache.+ */+ cacheDir: string;}interface SavedBrowserExtensionState {@@ -159,6 +165,7 @@ export class GhostBrowserExtensionSlot {private start(instanceId: string, ghost: InstalledGhost, ownerScopeKey: string): void {const needs = ghost.manifest.browserExtension!;let lastPolicyRequest = Number.NEGATIVE_INFINITY;+ const cacheDir = this.deps.policyDir();if (needs.nativeHost && !mayInstallNativeHost(ghost))this.deps.log?.warn('browser extension native host ignored: only the official plugin may install one', {instanceId,@@ -198,12 +205,13 @@ export class GhostBrowserExtensionSlot {policyRevision: 0,saved: { policy: null, trustedClients: [] },writes: Promise.resolve(),+ cacheDir,};const previous = this.stopping.get(instanceId);entry.ready = (async () => {// The old bridge must release its port and native registration before this one claims them.await previous?.catch(() => undefined);- const saved = await this.readSaved(instanceId);+ const saved = await this.readSaved(cacheDir, instanceId);let restored = false;if (saved) {entry.saved = saved;@@ -429,14 +437,14 @@ export class GhostBrowserExtensionSlot {// ── 策略持久化 ──────────────────────────────────────────────────────────- private policyFile(instanceId: string): string {- return path.join(this.deps.policyDir(), encodeURIComponent(instanceId) + '.json');+ private policyFile(cacheDir: string, instanceId: string): string {+ return path.join(cacheDir, encodeURIComponent(instanceId) + '.json');}/** Saved permissions and pairings; null when missing or unreadable (treated as unknown). */- private async readSaved(instanceId: string): Promise<SavedBrowserExtensionState | null> {+ private async readSaved(cacheDir: string, instanceId: string): Promise<SavedBrowserExtensionState | null> {try {- const raw = JSON.parse(await fs.readFile(this.policyFile(instanceId), 'utf8')) as {+ const raw = JSON.parse(await fs.readFile(this.policyFile(cacheDir, instanceId), 'utf8')) as {version?: unknown;policy?: unknown;trustedClients?: unknown;@@ -462,12 +470,16 @@ export class GhostBrowserExtensionSlot {private persist(entry: Entry, change: Partial<SavedBrowserExtensionState>): Promise<void> {entry.saved = { ...entry.saved, ...change };const snapshot = entry.saved;- entry.writes = entry.writes.then(() => this.writeSaved(entry.instanceId, snapshot));+ entry.writes = entry.writes.then(() => this.writeSaved(entry.cacheDir, entry.instanceId, snapshot));return entry.writes;}- private async writeSaved(instanceId: string, saved: SavedBrowserExtensionState): Promise<void> {- const file = this.policyFile(instanceId);+ private async writeSaved(+ cacheDir: string,+ instanceId: string,+ saved: SavedBrowserExtensionState,+ ): Promise<void> {+ const file = this.policyFile(cacheDir, instanceId);const tmp = `${file}.${crypto.randomUUID()}.tmp`;try {await fs.mkdir(path.dirname(file), { recursive: true, mode: 0o700 });diff --git a/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskService.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskService.test.tsindex e94c5110a3..6aa46c4d62 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskService.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskService.test.ts@@ -1465,6 +1465,21 @@ it('archives only its own idle task through the host writer and treats archivedawait expect(bare.service.archive('p', { taskId: plain.taskId })).rejects.toMatchObject({ code: 'HOST_NOT_READY' });});+// Review 2026-10-29 (Greptile P1): the idle check ran before the archive waited for the session+// write lock, so input sent in between was archived out from under the user. tier: unit.+it('does not archive a task that became busy while the archive waited for the session lock', async () => {+ const f = fixture(), task = await f.create();+ let busy = false;+ f.deps.isBusy = () => busy;+ f.deps.archive = vi.fn(async (taskId: string, assertAllowed: () => void) => {+ busy = true; // the user sends input while the write waits for the lock+ assertAllowed();+ f.tasks.set(taskId, { ...f.tasks.get(taskId)!, status: 'archived' });+ });+ await expect(f.service.archive('p', { taskId: task.taskId })).rejects.toMatchObject({ code: 'TASK_BUSY' });+ expect(f.tasks.get(task.taskId)!.status).toBe('active');+});+it.each([['provider', 'reset'], ['provider', 'partial'],['mutation', 'reset'], ['mutation', 'partial'],diff --git a/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskSnapshot.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskSnapshot.test.tsindex 7e87d46c7d..91aff41d75 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskSnapshot.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/pluginTaskSnapshot.test.ts@@ -8,6 +8,7 @@ import ts from 'typescript';import { PluginTaskError, readPluginTaskPlanReceipt } from '../pluginTaskService.js';import type { PluginTaskRoute } from '../../../shared/pluginTasks.js';import { resolvePluginWorkerDirectory } from '../pluginWorkerDirectory.js';+import { pluginTaskRouteAttempts, pluginTaskSelectionIsOpen } from '../pluginTaskDefaultRoute.js';import { createSessionExecutionResolver } from '../sessionExecutionSelection';import { createGhostProductionCallbacks } from '../../cindy-brain/__tests__/ghostProductionCallbacksFixture.js';@@ -193,6 +194,10 @@ it.each(['provider', 'receipt', 'directory', 'creator'])('keeps default-route co},}),routeUnavailable: () => { throw Error('unavailable'); },+ // These configurations name a complete route, so the auxiliary-chain default never applies.+ pluginTaskSelectionIsOpen, pluginTaskRouteAttempts,+ getEffectiveAuxiliaryModelRefs: () => [], getEffectiveAuxiliaryModelChainSnapshot: () => '',+ auxiliaryChainSessionCandidates: () => [],resolvePluginWorkerDirectory: async () => { if (phase === 'directory') change(); return '/root'; },createPluginTaskSession: create, clampPluginTaskPermissionMode: (value: string) => value,getCurrentDbClientSnapshot: () => epoch, isPluginTaskAuthorized: () => true,diff --git a/apps/desktop/src/main/maker-ipc/pluginTaskService.ts b/apps/desktop/src/main/maker-ipc/pluginTaskService.tsindex 421ef2c339..9aabb0a962 100644--- a/apps/desktop/src/main/maker-ipc/pluginTaskService.ts+++ b/apps/desktop/src/main/maker-ipc/pluginTaskService.ts@@ -175,6 +175,8 @@ export interface PluginTaskServiceDeps {revealPluginTasks?(pluginId: string): Promise<void>;/** Host archive writer (same path as the sidebar); `assertAllowed` runs right before the write. */archive?(taskId: string, assertAllowed: () => void): Promise<void>;+ /** Live execution or queued input right now; read synchronously so it can run under the write lock. */+ isBusy?(taskId: string): boolean;setModel?(taskId: string, route: PluginTaskRoute, assertCurrent: () => Promise<void>): Promise<{ status: string }>;readSession(taskId: string): Promise<PluginTaskView | null>;readLiveSession(taskId: string): Pick<Session, 'instanceId' | 'stablePlanModeState'> | undefined;@@ -522,6 +524,9 @@ export function createPluginTaskService(deps: PluginTaskServiceDeps) {await deps.archive(request.taskId, () => {deps.assertCurrent();deps.assertAuthorized(pluginId);+ // The idle check above ran before this write waited for the session lock; input sent in+ // between must still stop the archive.+ if (deps.isBusy?.(request.taskId)) throw new PluginTaskError('TASK_BUSY', 'The task is still working');});return ownTask(pluginId, request.taskId);}),diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex d4bc33ef1e..0196d6673d 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -14336,6 +14336,9 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)archive: async (taskId, assertAllowed) => {await patchSessionMetaInDb(taskId, { status: 'archived' }, { beforeWrite: assertAllowed });},+ // Synchronous, so the archive can look again under the session write lock.+ isBusy: taskId => Boolean(readExecution(taskId))+ || inputCoordinator.getQueueControlSnapshot(taskId).pendingQueue.length > 0,revealPluginTasks: async pluginId => {// 不受详情页列表的展示上限约束:分批恢复全部,避免卸载撤销归属后仍有任务隐藏。await revealAllPluginHiddenTasks(snapshot.client, pluginId, taskId =>diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.tsindex 26c71aaffc..9da05aa1f1 100644--- a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts@@ -758,6 +758,20 @@ describe('UserBrowserBackend · 读取与动作', () => {// Review 2026-10-29: an installed but unpaired extension waited 8 s and was then told to install// the extension; it must be reported at once with its real reason.+ // Review 2026-10-29 (Greptile P1): {kind:'wait', timeMs, text} was treated as a pure sleep and+ // returned success without ever checking that the text appeared.+ it('带文字条件的等待交给页面检查,不当作纯睡眠', async () => {+ const fake = fakeControl({ version: '0.4.46' });+ fake.responses.set('open', (payload) => ({ ok: true, tabId: 42, window: 500, url: payload.url, title: 'T' }));+ fake.responses.set('wait', () => ({ ok: true, execution: 'executed' }));+ const b = backend(fake.control);+ await call(b, { action: 'open', url: 'https://example.test/new', label: 'n' });+ const started = Date.now();+ await call(b, { action: 'act', targetId: 'n', request: { kind: 'wait', timeMs: 20000, text: '上传完成' } });+ expect(Date.now() - started).toBeLessThan(5000);+ expect(fake.jobs.at(-1)).toMatchObject(['wait', { text: '上传完成', tabId: 42 }]);+ });+// Review 2026-10-29: with many tabs the list is cut at its limit, and the handle of a tab the// agent had just opened vanished because it was not in the truncated list.it('标签页列表被截断时不丢掉没列出来的已记住标签', async () => {diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.tsindex 2d42e7d850..f89135a48b 100644--- a/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts@@ -891,6 +891,7 @@ export class UserBrowserBackend implements BrowserBackend {!request.selector &&!request.loadState &&!request.url &&+ !request.text &&!request.textGone &&!request.fn) {diff --git a/apps/desktop/src/preload/__tests__/deepLinkIslandEntryBridge.test.ts b/apps/desktop/src/preload/__tests__/deepLinkIslandEntryBridge.test.tsindex fe2f23ce41..ff2656c116 100644--- a/apps/desktop/src/preload/__tests__/deepLinkIslandEntryBridge.test.ts+++ b/apps/desktop/src/preload/__tests__/deepLinkIslandEntryBridge.test.ts@@ -64,6 +64,18 @@ it('delivers remote-control settings through the live bridge and cold-start buffexpect(takePendingDeepLink()).toBeNull();});+// Review 2026-10-29 (Codex P1): the warm-app path dropped installed-plugin payloads because the+// preload validator had no branch for them; only the cold-start buffer worked.+it('delivers cindy://plugins links through the live bridge and cold-start buffer', () => {+ const { received } = connect();+ handleIncomingDeepLink('cindy://plugins/my-browser', 'open-url');+ handleIncomingDeepLink('cindy://plugins', 'open-url');+ expect(received).toEqual([{ type: 'installed-plugin', ghostId: 'my-browser' }, { type: 'installed-plugin' }]);+ setDeepLinkMainWindow(null);+ handleIncomingDeepLink('cindy://plugins/my-browser', 'argv');+ expect(takePendingDeepLink()).toEqual({ type: 'installed-plugin', ghostId: 'my-browser' });+});+describe('Agent Island click id across the preload deep-link bridge', () => {// External links must keep their owning computer through both the live bridge// and the cold-start buffer; otherwise a same-id local task wins.diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.tsindex 967c54696d..391bfe4fde 100644--- a/apps/desktop/src/preload/preload.ts+++ b/apps/desktop/src/preload/preload.ts@@ -4084,6 +4084,7 @@ contextBridge.exposeInMainWorld('electronAPI', {importId?: unknown;pluginId?: unknown;snapshotId?: unknown;+ ghostId?: unknown;invitation?: unknown;token?: unknown;server?: unknown;@@ -4116,6 +4117,10 @@ contextBridge.exposeInMainWorld('electronAPI', {callback({ type: 'plugin', pluginId: p.pluginId });} else if (p.type === 'local-plugin-share' && isLocalPluginSnapshotId(p.snapshotId)) {callback({ type: 'local-plugin-share', snapshotId: p.snapshotId });+ } else if (p.type === 'installed-plugin' && (p.ghostId === undefined || (typeof p.ghostId === 'string' && /^[a-z0-9][a-z0-9-]{0,31}$/.test(p.ghostId)))) {+ // A plugin's own id (same rule as isValidGhostId in shared/ghost), not a market resource id.+ // The bare list link carries none. Main validated it already; a malformed id drops the payload.+ callback({ type: 'installed-plugin', ...(typeof p.ghostId === 'string' ? { ghostId: p.ghostId } : {}) });} else if (p.type === 'chat-message' && typeof p.groupId === 'string' && typeof p.messageId === 'string'&& [p.groupId, p.messageId, ...(p.threadRootId === undefined ? [] : [p.threadRootId])].every(value => typeof value === 'string' && /^[0-9a-f-]{36}$/i.test(value))) {callback({ type: 'chat-message', groupId: p.groupId, messageId: p.messageId,diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex ca63b7cd97..7cc51d5e70 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -5257,7 +5257,7 @@"title": "Use my browser logins","description": "The agent will open sites with your signed-in Chrome, Edge, or Brave accounts.","toggleAria": "Use my browser logins",- "unavailableEmbedded": "Only applies to the standalone browser. Turning it off deletes the copied login files.",+ "unavailableEmbedded": "Only applies to the standalone browser. Switching it off deletes the copied login files.","confirmTitle": "Let the agent use your browser logins?","confirmDescription": "The agent will be able to open sites with your signed-in accounts, including email, cloud drives, and work consoles. You can turn it off anytime; the copy will be deleted.","confirmDescriptionMac": "The agent will be able to open sites with your signed-in accounts, including email, cloud drives, and work consoles. Reading Chrome’s login files also needs Full Disk Access. You can turn this off anytime; the copy will be deleted.",@@ -5287,7 +5287,7 @@"statusFailed": "the controller status check failed","recoveryFailed": "the control connection could not be rebuilt","extensionDisconnected": "no browser extension is connected (install and enable the Cindy Chrome plugin and its extension)",- "pluginMissing": "the Cindy Chrome plugin is not installed or turned on"+ "pluginMissing": "the Cindy Chrome plugin is not installed or enabled"},"reconnect": "Reconnect Browser","recover": "Recover Browser",@@ -5311,12 +5311,12 @@},"userBrowserSetup": {"installPluginTitle": "Install the Cindy Chrome plugin",- "enablePluginTitle": "Turn on the Cindy Chrome plugin",+ "enablePluginTitle": "Enable the Cindy Chrome plugin","installExtensionTitle": "Add the Cindy extension to your browser","pluginBody": "My browser reaches your Chrome or Edge through the Cindy Chrome plugin and its browser extension. Install the plugin in Cindy first, then follow its prompt to add the extension.",- "extensionBody": "Add browser extension opens the Cindy extension’s store page in your browser; choose Add and this turns to connected on its own. Already added? Turn it on in the browser’s extension settings.",+ "extensionBody": "Add browser extension opens the Cindy extension’s store page in your browser; choose Add and this changes to connected on its own. Already added? Enable it in the browser’s extension settings.","installPlugin": "Install plugin",- "enablePlugin": "Turn on",+ "enablePlugin": "Enable","installExtension": "Add browser extension","updatePluginTitle": "Update the Cindy Chrome plugin","updatePluginBody": "The installed Cindy Chrome plugin is too old for My browser. Update it to the latest version, then follow its prompt to add the extension.",diff --git a/apps/desktop/src/shared/__tests__/ghost.test.ts b/apps/desktop/src/shared/__tests__/ghost.test.tsindex cd5c6f4a49..47cdba3a57 100644--- a/apps/desktop/src/shared/__tests__/ghost.test.ts+++ b/apps/desktop/src/shared/__tests__/ghost.test.ts@@ -19,6 +19,7 @@ import {ghostSettingsUiWithinCap,ghostSubscribeAuthorizationWithinCap,ghostToolParametersWithinCap,+ ghostBrowserExtensionWithinCap,ghostUnknownV3FieldsWithinCap,ghostNetworkHostMatches,ghostPanelKind,@@ -5022,6 +5023,18 @@ describe('ghost · browserExtension 槽(2026-10-27 浏览器扩展经宿主桥}});+ // Review 2026-10-29 (Greptile P2): browserExtension was missing from the known top-level fields, so+ // the full install check demanded the real package match the market manifest exactly and refused a+ // package that only narrows what was reviewed, although the cap check accepts it.+ it('完整安装检查接受只收窄浏览器扩展声明的真实包,仍拒绝扩权', () => {+ const reviewed = withNeeds(good);+ const narrowed = withNeeds({ protocol: good.protocol, extensionIds: [chromeId] });+ const expanded = withNeeds({ ...good, extensionIds: [chromeId, edgeId, 'c'.repeat(32)] });+ if (!reviewed.ok || !narrowed.ok || !expanded.ok) throw new Error('fixture');+ expect(ghostUnknownV3FieldsWithinCap(reviewed.manifest, narrowed.manifest)).toBe(true);+ expect(ghostBrowserExtensionWithinCap(reviewed.manifest, expanded.manifest)).toBe(false);+ });+it('pageControlReplaces 列出被「我的浏览器」取代的插件工具与手册,须与 pageControl 同时声明', () => {const replaces = { tools: ['browser_read', 'browser_act'], manual: ['browser'] };const ok = withNeeds({ ...good, pageControlReplaces: replaces });diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.tsindex 8c4cc53c6b..3b18f03c7b 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -3198,6 +3198,9 @@ const GHOST_MANIFEST_KNOWN_TOP_LEVEL_FIELDS = new Set(['pick','workspace','iosSimulator',+ // Interpreted by Host: ghostBrowserExtensionWithinCap checks it against the reviewed manifest+ // (narrowing is allowed), so it must not also fall under the exact-match rule for unknown fields.+ 'browserExtension',]);const V3_BOOLEAN_CAPABILITY_FIELDS = [diff --git a/packages/browser-control-runtime/upstream/MAINTAINING.md b/packages/browser-control-runtime/upstream/MAINTAINING.mdindex 9f6004c1d5..2cd41e299a 100644--- a/packages/browser-control-runtime/upstream/MAINTAINING.md+++ b/packages/browser-control-runtime/upstream/MAINTAINING.md@@ -230,8 +230,11 @@ pnpm --filter @cindy/browser-control-runtime test # 契约 + SSRF guard- 第三个 `BackendKind` `user-browser`:`apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts` 把 `BrowserControlRequest` 翻译成随包浏览器扩展的页面作业,经 `cindy-brain/browserExtensionSlot.ts` 持有的桥接(`main/browser-extension/bridge.ts`,从 Cindy Chrome 插件的接线进程原样迁入,线协议 `cindy-browser-extension/3` 不变,已装扩展无需更新)投递到用户正在使用的 Chrome / Edge。- 设置 →「自动操作」三选一:专用浏览器(默认)/ 侧边栏 / 我的浏览器;选哪一个是**默认**目标,Agent 的 `setBackend` 仍是同一个全局持久选择。没有声明 `browserExtension.pageControl` 的插件时该目标 `status.ready === false`,健康面板报 `extension-disconnected`,不提供恢复按钮。-- 能力边界由扩展决定(隔离世界固定函数,无 debugger):只支持 tabs / open / navigate / snapshot / extract / act(click / type / fill / press / hover / select / wait);`deps.backendCapabilities()` 让 MCP 层在派发前拒绝 screenshot / evaluate / requests / upload / dialog / console / pdf / focus / close / 坐标与拖拽,以及需要 guard / evaluate / 适配器 / 网络读取的配方,错误文案要求模型告知用户而不是自行切换。extract 与登录墙检测走 PR #7432 的声明式 `domRead`,不需要任意脚本。-- 寻址:扩展当前按精确 URL 寻址,后端维护 targetId ↔ {连接, tabId, url};作业前用 `tabs` 核对,URL 变化报 `PAGE_CHANGED` 并刷新记录,不猜新页。扩展侧加 tabId / documentId 寻址后这里只需改 `locate`。+- 能力边界由扩展版本决定(`USER_BROWSER_PARITY_VERSION`,当前 0.4.43):+ - 0.4.43 起与专用浏览器对齐:截图(含整页、元素、后台标签页)、evaluate、requests、上传、对话框、console、PDF、focus、关闭、坐标与拖拽、站点配方的协议会话都可用;调试接口(`chrome.debugger`)是可选权限,只在需要的动作里临时接上、用完断开,第一次用到时由扩展弹出授权页。+ - 更旧的扩展只有基础能力(tabs / open / navigate / snapshot / extract / act),由 `deps.backendCapabilities()`(`userBrowserCapabilities`)让 MCP 层在派发前拒绝其余动作,错误文案要求模型告知用户而不是自行切换。没有任何连接时按完整能力报,具体断开由后端按作业报告。+ - extract 与登录墙检测走 PR #7432 的声明式 `domRead`,不需要任意脚本。+- 寻址:新版扩展(≥ 0.4.43)按 tabId 寻址,后端维护 targetId ↔ {连接, 浏览器启动标识, tabId, url};targetId 带启动标识,浏览器重启后旧句柄不再解析。旧版扩展仍按精确 URL 寻址:作业前用 `tabs` 核对,URL 变化报 `PAGE_CHANGED` 并刷新记录,不猜新页。- 站点策略归插件:读与交互默认开放,本机与私网和公网网站一样可访问、也可写进名单屏蔽(2026-10-28);宿主没有缓存时在收到插件策略前拒绝作业;宿主缓存在 `ownerScopedUserDataPath('browser-extension')`,每个作业经桥接强制。`cindy_browser` 的免审批前提在该目标下由这套策略补上。- 回归:`browser-extension/__tests__/bridge.test.ts`(协议)、`cindy-brain/__tests__/browserExtensionSlot.test.ts`(槽)、`browser-backend/__tests__/user-browser-backend.test.ts`(翻译)、`lizi-mcps` 的 capability gating 用例;真实 Chrome 验收用 Google Play 发包案例与插件翻译。