Skip to content

A full-featured download manager.

fix(plugins): preserve diagnostics and dispose bridge subscriptions (#2380)

Dr_rOotdc9158dde1ff
diff --git a/.github/pr-assets/plugin-log-history.png b/.github/pr-assets/plugin-log-history.png
new file mode 100644
index 00000000..6194ca06
Binary files /dev/null and b/.github/pr-assets/plugin-log-history.png differ
diff --git a/e2e/plugin-diagnostics.spec.ts b/e2e/plugin-diagnostics.spec.ts
new file mode 100644
index 00000000..942cf777
--- /dev/null
+++ b/e2e/plugin-diagnostics.spec.ts
@@ -0,0 +1,184 @@
+import { mkdir, writeFile } from 'node:fs/promises'
+import path from 'node:path'
+import type { ElectronApplication, Page } from '@playwright/test'
+import { Commands } from '@shared/protocol/commands'
+import { Events } from '@shared/protocol/events'
+import { Queries } from '@shared/protocol/queries'
+import type { PluginLogEntry } from '@shared/types/plugin'
+import {
+ expect,
+ launchMotrix,
+ test,
+ waitForQueryHandlers,
+} from './fixtures/electron-app'
+
+test('many bridge consumers share IPC delivery and unsubscribe across repeated mounts', async ({
+ electronApp,
+ mainWindow,
+}) => {
+ const warnings: string[] = []
+ mainWindow.on('console', (message) => {
+ if (message.text().includes('MaxListenersExceededWarning'))
+ warnings.push(message.text())
+ })
+ const channel = `${Events.PluginLog}:test.fanout` as const
+ await mainWindow.waitForFunction(() => Boolean(window.motrix))
+ for (let cycle = 0; cycle < 12; cycle++) {
+ await mainWindow.evaluate((eventChannel) => {
+ const callbacks = Array.from(
+ { length: 32 },
+ () =>
+ (...args: unknown[]) => {
+ const state = (
+ window as unknown as {
+ fanout: { calls: number; args: unknown[] }
+ }
+ ).fanout
+ state.calls++
+ state.args = args
+ }
+ )
+ const removers = callbacks.map((callback) =>
+ window.motrix!.on(eventChannel, callback)
+ )
+ Object.assign(window, { fanout: { removers, calls: 0, args: [] } })
+ }, channel)
+ await electronApp.evaluate(({ webContents }, eventChannel) => {
+ for (const contents of webContents.getAllWebContents())
+ contents.send(eventChannel, 'payload')
+ }, channel)
+ await expect
+ .poll(() =>
+ mainWindow.evaluate(
+ () =>
+ (window as unknown as { fanout: { calls: number } }).fanout.calls
+ )
+ )
+ .toBe(32)
+ await mainWindow.evaluate(() => {
+ const state = (
+ window as unknown as {
+ fanout: {
+ removers: Array<() => void>
+ args: unknown[]
+ }
+ }
+ ).fanout
+ if (JSON.stringify(state.args) !== JSON.stringify(['payload']))
+ throw new Error('Native event leaked across the bridge')
+ for (const remove of state.removers) remove()
+ })
+ }
+ // A surviving listener provides a delivery barrier for the final event.
+ await mainWindow.evaluate((eventChannel) => {
+ window.motrix!.on(eventChannel, () =>
+ Object.assign(window, { fanoutDone: true })
+ )
+ }, channel)
+ await electronApp.evaluate(({ webContents }, eventChannel) => {
+ for (const contents of webContents.getAllWebContents())
+ contents.send(eventChannel, 'after-unsubscribe')
+ }, channel)
+ await mainWindow.waitForFunction(
+ () => (window as unknown as { fanoutDone: boolean }).fanoutDone
+ )
+ expect(
+ await mainWindow.evaluate(
+ () => (window as unknown as { fanout: { calls: number } }).fanout.calls
+ )
+ ).toBe(32)
+ expect(warnings).toEqual([])
+})
+
+async function openPlugin(
+ app: ElectronApplication,
+ pluginId: string
+): Promise<Page> {
+ const page = await app.firstWindow()
+ await page.waitForLoadState('domcontentloaded')
+ await page.waitForFunction(() => Boolean(window.motrix))
+ await waitForQueryHandlers(page)
+ await page.evaluate((id) => {
+ location.hash = `/plugins/${id}`
+ }, pluginId)
+ await expect(
+ page.getByRole('button', { name: 'Logs', exact: true })
+ ).toBeVisible()
+ return page
+}
+
+async function logs(page: Page, pluginId: string): Promise<PluginLogEntry[]> {
+ return page.evaluate(
+ ({ channel, id }) =>
+ window.motrix!.invoke(channel, { pluginId: id, limit: 100 }),
+ { channel: Queries.GetPluginLogs, id: pluginId }
+ ) as Promise<PluginLogEntry[]>
+}
+
+test('host failures remain visible in plugin logs after restart and clearing persists', async ({
+ userDataDir,
+ rpcPort,
+}, testInfo) => {
+ const pluginId = 'test.diagnostics'
+ const pluginDir = path.join(userDataDir, 'plugins', pluginId)
+ await mkdir(pluginDir, { recursive: true })
+ await writeFile(
+ path.join(pluginDir, 'motrix-plugin.json'),
+ JSON.stringify({
+ manifestVersion: 1,
+ id: pluginId,
+ name: 'Diagnostics fixture',
+ version: '1.0.0',
+ description: 'Runtime error fixture',
+ categories: ['integration'],
+ engines: { motrix: '>=2.0.0-beta.48 <3.0.0' },
+ main: 'plugin.js',
+ permissions: [],
+ activationEvents: ['onStartup'],
+ contributes: {},
+ })
+ )
+ await writeFile(
+ path.join(pluginDir, 'plugin.js'),
+ 'throw new Error("diagnostic failure fixture");'
+ )
+ let app = await launchMotrix({ userDataDir, rpcPort })
+ try {
+ let page = await openPlugin(app, pluginId)
+ await expect
+ .poll(async () =>
+ (await logs(page, pluginId)).some(
+ (entry) =>
+ entry.msg.includes('diagnostic failure fixture') &&
+ entry.source === 'host'
+ )
+ )
+ .toBe(true)
+ const first = (await logs(page, pluginId)).find(
+ (entry) => entry.level === 'error'
+ )!
+ await page.evaluate(
+ ({ channel, id }) => window.motrix!.invoke(channel, id),
+ { channel: Commands.DisablePlugin, id: pluginId }
+ )
+ await app.close()
+ app = await launchMotrix({ userDataDir, rpcPort })
+ page = await openPlugin(app, pluginId)
+ expect(await logs(page, pluginId)).toContainEqual(first)
+ await page.getByRole('button', { name: 'Logs', exact: true }).click()
+ await expect(
+ page.getByText(/plugin.bundle.parse_error:.*diagnostic failure fixture/)
+ ).toBeVisible()
+ await page.screenshot({
+ path: testInfo.outputPath('persisted-host-error.png'),
+ })
+ await page.getByRole('button', { name: 'Clear', exact: true }).click()
+ await expect.poll(() => logs(page, pluginId)).toEqual([])
+ await app.close()
+ app = await launchMotrix({ userDataDir, rpcPort })
+ page = await openPlugin(app, pluginId)
+ expect(await logs(page, pluginId)).toEqual([])
+ } finally {
+ await app.close().catch(() => {})
+ }
+})
diff --git a/src/core/plugin/capabilities/interface.ts b/src/core/plugin/capabilities/interface.ts
index 36156ca4..bda76934 100644
--- a/src/core/plugin/capabilities/interface.ts
+++ b/src/core/plugin/capabilities/interface.ts
@@ -54,7 +54,7 @@ export interface CapabilityHost {
// ── Plan A ────────────────────────────────────────────────────────────────
createLog(pluginId: string): PluginLogCapability
getTail(pluginId: string, limit: number): LogEntry[]
- clearLog(pluginId: string): void
+ clearLog(pluginId: string): Promise<void> | void
setLogVerbose(pluginId: string, verbose: boolean): void
isLogVerbose(pluginId: string): boolean
getLogState(pluginId: string): PluginLogState
diff --git a/src/core/plugin/capabilities/log-history.ts b/src/core/plugin/capabilities/log-history.ts
new file mode 100644
index 00000000..33352fb7
--- /dev/null
+++ b/src/core/plugin/capabilities/log-history.ts
@@ -0,0 +1,54 @@
+import { closeSync, constants, fstatSync, openSync, readSync } from 'node:fs'
+import type { PluginLogEntry } from '@shared/types/plugin'
+import { z } from 'zod'
+
+const MAX_TAIL_BYTES = 512 * 1024
+const levels: Record<number, PluginLogEntry['level']> = {
+ 10: 'trace',
+ 20: 'debug',
+ 30: 'info',
+ 40: 'warn',
+ 50: 'error',
+ 60: 'fatal',
+}
+const persistedEntry = z.looseObject({
+ time: z.number().min(0).max(8_640_000_000_000_000),
+ level: z.number().refine((value) => Object.hasOwn(levels, value)),
+ msg: z.string(),
+})
+
+/** Read a bounded tail once per plugin, including logs from earlier processes. */
+export function readPluginLogTail(
+ file: string,
+ limit: number
+): { entries: PluginLogEntry[]; needsNewline: boolean } {
+ let fd: number | undefined
+ try {
+ fd = openSync(file, constants.O_RDONLY | constants.O_NOFOLLOW)
+ const stat = fstatSync(fd)
+ if (!stat.isFile()) return { entries: [], needsNewline: false }
+ const start = Math.max(0, stat.size - MAX_TAIL_BYTES)
+ const buffer = Buffer.alloc(Math.min(stat.size, MAX_TAIL_BYTES))
+ const bytes = readSync(fd, buffer, 0, buffer.length, start)
+ const lines = buffer.subarray(0, bytes).toString('utf8').split('\n')
+ // The bounded read can begin inside a record or a multibyte character.
+ if (start > 0) lines.shift()
+ const entries: PluginLogEntry[] = []
+ for (const line of lines) {
+ try {
+ const parsed = persistedEntry.safeParse(JSON.parse(line))
+ if (!parsed.success) continue
+ const { time, level, msg, ...fields } = parsed.data
+ entries.push({ ...fields, ts: time, level: levels[level], msg })
+ if (entries.length > limit) entries.shift()
+ } catch {
+ // A partial final write or one malformed record must not hide the tail.
+ }
+ }
+ return { entries, needsNewline: bytes > 0 && buffer[bytes - 1] !== 10 }
+ } catch {
+ return { entries: [], needsNewline: false }
+ } finally {
+ if (fd !== undefined) closeSync(fd)
+ }
+}
diff --git a/src/core/plugin/capabilities/log.test.ts b/src/core/plugin/capabilities/log.test.ts
index 1bbbec43..041b24b8 100644
--- a/src/core/plugin/capabilities/log.test.ts
+++ b/src/core/plugin/capabilities/log.test.ts
@@ -1,4 +1,9 @@
-import { mkdtempSync, readFileSync } from 'node:fs'
+import fs, {
+ mkdirSync,
+ mkdtempSync,
+ readFileSync,
+ writeFileSync,
+} from 'node:fs'
import { tmpdir } from 'node:os'
import path from 'node:path'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -6,7 +11,10 @@ import type { LogEntry } from './interface'
import { LogCapabilityHost } from './log'
describe('LogCapabilityHost', () => {
- afterEach(() => vi.useRealTimers())
+ afterEach(() => {
+ vi.useRealTimers()
+ vi.restoreAllMocks()
+ })
let dir: string
let host: LogCapabilityHost
@@ -27,6 +35,221 @@ describe('LogCapabilityHost', () => {
expect(entry.level).toBeDefined()
})
+ it('keeps the host and in-memory diagnostics available after the log destination cannot open', async () => {
+ const blocked = path.join(dir, 'not-a-directory')
+ writeFileSync(blocked, 'occupied')
+ const unavailable = new LogCapabilityHost({ pluginLogsDir: blocked })
+ const cap = unavailable.create('alice.demo')
+ cap.error('initial failure')
+ await expect(unavailable.flush()).rejects.toThrow(
+ 'Plugin log file is unavailable'
+ )
+ // A large follow-up must not trigger an immediate write to fd=-1 either.
+ expect(() => cap.error('x'.repeat(10_000))).not.toThrow()
+ await new Promise((resolve) => setTimeout(resolve, 1100))
+ expect(unavailable.getTail('alice.demo', 100)).toHaveLength(2)
+ await expect(unavailable.clear('alice.demo')).rejects.toThrow(
+ 'Plugin log file is unavailable'
+ )
+ expect(unavailable.getTail('alice.demo', 100)).toHaveLength(2)
+ fs.unlinkSync(blocked)
+ const retry = unavailable.clear('alice.demo')
+ cap.info('after destination recovery')
+ await retry
+ await unavailable.flush()
+ expect(
+ new LogCapabilityHost({ pluginLogsDir: blocked })
+ .getTail('alice.demo', 100)
+ .map((entry) => entry.msg)
+ ).toEqual(['after destination recovery'])
+ })
+
+ it('restores persisted entries before new entries without replaying them as live events', async () => {
+ host.create('alice.demo').error('worker failed', { source: 'host' })
+ host.create('alice.demo').debug('diagnostic detail')
+ const original = host.getTail('alice.demo', 10)
+ await host.flush()
+ const restarted = new LogCapabilityHost({ pluginLogsDir: dir })
+ const listener = vi.fn()
+ restarted.subscribe(listener)
+ expect(restarted.getTail('alice.demo', 10)).toEqual(original)
+ expect(listener).not.toHaveBeenCalled()
+ restarted.create('alice.demo').info('after restart')
+ expect(
+ restarted.getTail('alice.demo', 10).map((entry) => entry.msg)
+ ).toEqual(['worker failed', 'diagnostic detail', 'after restart'])
+ expect(restarted.getTail('bob.demo', 10)).toEqual([])
+ expect(restarted.getTail('alice.demo', 0)).toEqual([])
+ await restarted.flush()
+ })
+
+ it('clears persisted history while preserving writes made during the clear', async () => {
+ const cap = host.create('alice.demo')
+ cap.error('before clear')
+ const clearing = host.clear('alice.demo')
+ cap.info('during clear')
+ await clearing
+ await host.flush()
+ const restarted = new LogCapabilityHost({ pluginLogsDir: dir })
+ expect(
+ restarted.getTail('alice.demo', 100).map((entry) => entry.msg)
+ ).toEqual(['during clear'])
+ await restarted.clear('alice.demo')
+ const again = new LogCapabilityHost({ pluginLogsDir: dir })
+ expect(again.getTail('alice.demo', 100)).toEqual([])
+ })
+
+ it('rejects a failed flush without clearing history, then retries without resurrecting old logs', async () => {
+ const truncate = vi.spyOn(fs.promises, 'truncate')
+ const cap = host.create('alice.demo')
+ cap.info('persisted')
+ await host.flush()
+ cap.error('buffered')
+ const failure = Object.assign(new Error('disk full'), { code: 'ENOSPC' })
+ const write = vi
+ .spyOn(fs, 'write')
+ .mockImplementationOnce((...args: unknown[]) => {
+ const callback = args.at(-1) as (error: Error) => void
+ queueMicrotask(() => callback(failure))
+ })
+ const clearing = host.clear('alice.demo')
+ cap.info('during clear')
+ await expect(clearing).rejects.toBe(failure)
+ write.mockRestore()
+ expect(truncate).not.toHaveBeenCalled()
+ expect(host.getTail('alice.demo', 100).map((entry) => entry.msg)).toEqual([
+ 'persisted',
+ 'buffered',
+ 'during clear',
+ ])
+ await host.flush()
+ await host.clear('alice.demo')
+ await host.flush()
+ const restarted = new LogCapabilityHost({ pluginLogsDir: dir })
+ expect(restarted.getTail('alice.demo', 100)).toEqual([])
+ })
+
+ it('keeps visible and queued records when truncation fails and permits a later retry', async () => {
+ const cap = host.create('alice.demo')
+ cap.error('before clear')
+ await host.flush()
+ const failure = Object.assign(new Error('read only'), { code: 'EACCES' })
+ vi.spyOn(fs.promises, 'truncate').mockRejectedValueOnce(failure)
+ const clearing = host.clear('alice.demo')
+ cap.info('during clear')
+ await expect(clearing).rejects.toBe(failure)
+ expect(host.getTail('alice.demo', 100).map((entry) => entry.msg)).toEqual([
+ 'before clear',
+ 'during clear',
+ ])
+ await host.flush()
+ expect(
+ new LogCapabilityHost({ pluginLogsDir: dir })
+ .getTail('alice.demo', 100)
+ .map((entry) => entry.msg)
+ ).toEqual(['before clear', 'during clear'])
+ await host.clear('alice.demo')
+ await host.flush()
+ expect(
+ new LogCapabilityHost({ pluginLogsDir: dir }).getTail('alice.demo', 100)
+ ).toEqual([])
+ })
+
+ it('aborts clearing when fsync fails and retains the previous record', async () => {
+ const cap = host.create('alice.demo')
+ cap.error('before clear')
+ await host.flush()
+ const failure = Object.assign(new Error('sync failed'), { code: 'EIO' })
+ const sync = vi
+ .spyOn(fs, 'fsync')
+ .mockImplementationOnce((_fd, callback) => {
+ queueMicrotask(() => callback(failure))
+ })
+ const truncate = vi.spyOn(fs.promises, 'truncate')
+ await expect(host.clear('alice.demo')).rejects.toBe(failure)
+ sync.mockRestore()
+ expect(truncate).not.toHaveBeenCalled()
+ expect(host.getTail('alice.demo', 100).map((entry) => entry.msg)).toEqual([
+ 'before clear',
+ ])
+ await host.clear('alice.demo')
+ await host.flush()
+ expect(
+ new LogCapabilityHost({ pluginLogsDir: dir }).getTail('alice.demo', 100)
+ ).toEqual([])
+ })
+
+ it('coalesces overlapping clears and preserves entries received before the disk commit', async () => {
+ const cap = host.create('alice.demo')
+ cap.error('before clear')
+ let finish!: () => Promise<void>
+ const realTruncate = fs.promises.truncate
+ vi.spyOn(fs.promises, 'truncate').mockImplementationOnce(
+ (...args) =>
+ new Promise<void>((resolve, reject) => {
+ finish = async () => {
+ await realTruncate(...args).then(resolve, reject)
+ }
+ })
+ )
+ const clearing = host.clear('alice.demo')
+ await vi.waitFor(() => expect(finish).toBeTypeOf('function'))
+ expect(host.getTail('alice.demo', 100).map((entry) => entry.msg)).toEqual([
+ 'before clear',
+ ])
+ cap.info('during clear')
+ expect(host.clear('alice.demo')).toBe(clearing)
+ await finish()
+ await clearing
+ await host.flush()
+ expect(
+ new LogCapabilityHost({ pluginLogsDir: dir })
+ .getTail('alice.demo', 100)
+ .map((entry) => entry.msg)
+ ).toEqual(['during clear'])
+ })
+
+ it('continues host sequence across restart and wall-clock rollback', async () => {
+ const cap = host.create('alice.demo')
+ cap.info('first')
+ await host.flush()
+ const restarted = new LogCapabilityHost({ pluginLogsDir: dir })
+ vi.useFakeTimers({ toFake: ['Date'] })
+ vi.setSystemTime(1)
+ restarted.create('alice.demo').info('second')
+ const entries = restarted.getTail('alice.demo', 100)
+ expect(entries.map((entry) => entry.logSequence)).toEqual([1, 2])
+ expect(entries[1].ts).toBeLessThan(entries[0].ts)
+ await restarted.flush()
+ })
+
+ it('reads bounded historical tails and ignores malformed or truncated records', async () => {
+ const logDir = path.join(dir, 'alice.demo', 'logs')
+ mkdirSync(logDir, { recursive: true })
+ writeFileSync(
+ path.join(logDir, 'current.ndjson'),
+ [
+ JSON.stringify({ time: 1, level: 30, msg: 'x'.repeat(600_000) }),
+ '{broken',
+ JSON.stringify({ time: 2, level: 900, msg: 'invalid level' }),
+ JSON.stringify({ time: 3, level: 50, msg: 'retained', source: 'host' }),
+ '{"time":4',
+ ].join('\n')
+ )
+ expect(host.getTail('alice.demo', 100)).toEqual([
+ { ts: 3, level: 'error', msg: 'retained', source: 'host' },
+ ])
+ host.create('alice.demo').error('after truncated record')
+ await host.flush()
+ const restarted = new LogCapabilityHost({ pluginLogsDir: dir })
+ expect(
+ restarted.getTail('alice.demo', 100).map((entry) => entry.msg)
+ ).toEqual(['retained', 'after truncated record'])
+ expect(() => host.getTail('../alice.demo', 100)).toThrow(
+ 'Invalid plugin log identifier'
+ )
+ })
+
it('applies the shared plugin redaction to the ring and NDJSON', async () => {
const cap = host.create('alice.demo')
cap.info('request', {
@@ -72,6 +295,8 @@ describe('LogCapabilityHost', () => {
msg: 'forged message',
pid: 1,
hostname: 'attacker',
+ entryId: 'forged',
+ logSequence: 12345,
})
await host.flush()
@@ -85,6 +310,9 @@ describe('LogCapabilityHost', () => {
fieldMsg: 'forged message',
fieldPid: 1,
fieldHostname: 'attacker',
+ fieldEntryId: 'forged',
+ fieldLogSequence: 12345,
+ logSequence: 1,
})
expect(ringEntry.ts).toBeGreaterThan(0)
@@ -138,17 +366,17 @@ describe('LogCapabilityHost', () => {
expect(tail).toHaveLength(2)
})
- it('clear() empties the ring buffer for the given plugin', () => {
+ it('clear() empties the ring buffer for the given plugin', async () => {
const cap = host.create('alice.demo')
cap.info('a')
cap.info('b')
expect(host.getTail('alice.demo', 10)).toHaveLength(2)
- host.clear('alice.demo')
+ await host.clear('alice.demo')
expect(host.getTail('alice.demo', 10)).toHaveLength(0)
})
- it('clear() on an unknown plugin is a no-op', () => {
- expect(() => host.clear('nobody.here')).not.toThrow()
+ it('clear() on an unknown plugin keeps an empty history', async () => {
+ await expect(host.clear('nobody.here')).resolves.toBeUndefined()
})
it('setVerbose() / isVerbose() track per-plugin flag (default false)', () => {
diff --git a/src/core/plugin/capabilities/log.ts b/src/core/plugin/capabilities/log.ts
index d9142225..72c8eeb1 100644
--- a/src/core/plugin/capabilities/log.ts
+++ b/src/core/plugin/capabilities/log.ts
@@ -1,15 +1,20 @@
+import { randomUUID } from 'node:crypto'
+import { close, open } from 'node:fs'
+import fs from 'node:fs/promises'
import path from 'node:path'
import {
redactLogFields,
redactLogText,
truncateLogText,
} from '@core/log-redact'
+import { pluginLogSequence } from '@shared/lib/plugin-log-order'
import {
PLUGIN_LOG_VERBOSE_TTL_MS,
type PluginLogState,
} from '@shared/schemas/plugin-logs'
import pino, { type DestinationStream, type Logger } from 'pino'
import type { LogEntry, PluginLogCapability } from './interface'
+import { readPluginLogTail } from './log-history'
export interface LogCapabilityHostOptions {
pluginLogsDir: string
@@ -21,17 +26,22 @@ export type LogStreamListener = (pluginId: string, entry: LogEntry) => void
type LogDestination = ReturnType<typeof pino.destination>
interface Per {
- logger: Logger
- dest: LogDestination
+ logger?: Logger
+ dest?: LogDestination
/**
* Resolves `true` once the destination owns a file descriptor, `false` if it
- * failed to get one. `pino.destination` creates the parent directories and
- * opens the file asynchronously, so there is no fd in the tick that builds
- * it and early entries sit in SonicBoom's in-memory buffer.
+ * failed to get one. Directory creation and opening are asynchronous;
+ * early entries wait until the destination has an owned descriptor.
*/
opened: Promise<boolean>
+ retryOpen?: () => Promise<boolean>
ring: LogEntry[]
verboseUntil: number | null
+ clearing?: Promise<void>
+ queuedWrites: Array<() => void>
+ sequence: number
+ openingWrites: Array<() => void>
+ unavailable: boolean
}
/**
@@ -42,15 +52,14 @@ interface Per {
* in-flight async write, so it can return before that chunk lands.
*/
async function flushDestination(per: Per): Promise<void> {
- if (!(await per.opened)) return
- await new Promise<void>((resolve) => {
+ if (!(await per.opened) || !per.dest)
+ throw new Error('Plugin log file is unavailable')
+ const destination = per.dest
+ await new Promise<void>((resolve, reject) => {
try {
- per.dest.flush(() => resolve())
- } catch {
- // A destroyed or broken destination has nothing left to push. Plugin
- // logging must never take the host down, so report completion instead
- // of propagating: the destination's own 'error' path owns that failure.
- resolve()
+ destination.flush((error) => (error ? reject(error) : resolve()))
+ } catch (error) {
+ reject(error)
}
})
}
@@ -64,35 +73,78 @@ export class LogCapabilityHost {
this.opts = { ringSize: 100, ...opts }
}
+ private logPath(pluginId: string): string {
+ if (!/^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/.test(pluginId)) {
+ throw new Error('Invalid plugin log identifier')
+ }
+ return path.join(
+ this.opts.pluginLogsDir,
+ pluginId,
+ 'logs',
+ 'current.ndjson'
+ )
+ }
+
private getOrCreate(pluginId: string): Per {
let entry = this.per.get(pluginId)
if (entry) return entry
- const dest = pino.destination({
- dest: path.join(
- this.opts.pluginLogsDir,
- pluginId,
- 'logs',
- 'current.ndjson'
+ const file = this.logPath(pluginId)
+ const { entries: ring, needsNewline } = readPluginLogTail(
+ file,
+ this.opts.ringSize
+ )
+ entry = {
+ opened: Promise.resolve(false),
+ ring,
+ verboseUntil: null,
+ queuedWrites: [],
+ openingWrites: [],
+ sequence: Math.max(
+ 0,
+ ...ring.map((item) => pluginLogSequence(item) ?? 0)
),
- sync: false,
- mkdir: true,
- // Buffering is what makes `flush()` verifiable — SonicBoom's flush(cb)
- // is a documented no-op while minLength is 0. periodicFlush bounds how
- // long an entry may sit in memory so someone tailing current.ndjson
- // still sees output without an explicit flush.
- minLength: 4096,
- periodicFlush: 1000,
- })
- const logger = pino({ base: undefined }, dest as DestinationStream)
- // Safe to attach in this tick: with `sync: false` SonicBoom emits 'ready'
- // (and 'error') from the fs.open callback, which cannot run before this
- // synchronous block finishes, so neither event can be missed here.
- const opened = new Promise<boolean>((resolve) => {
- dest.once('ready', () => resolve(true))
- dest.once('error', () => resolve(false))
- })
- entry = { logger, dest, opened, ring: [], verboseUntil: null }
+ unavailable: false,
+ }
this.per.set(pluginId, entry)
+ const per = entry
+ per.retryOpen = async () => {
+ try {
+ await fs.mkdir(path.dirname(file), { recursive: true })
+ const fd = await new Promise<number>((resolve, reject) => {
+ open(file, 'a', (error, descriptor) =>
+ error ? reject(error) : resolve(descriptor)
+ )
+ })
+ try {
+ // Create the destination only with an owned descriptor. Otherwise a
+ // failed open leaves SonicBoom's timer and exit hook using fd=-1.
+ const dest = pino.destination({
+ // A numeric string preserves descriptor zero through Pino's defaults.
+ dest: String(fd),
+ sync: false,
+ minLength: 4096,
+ periodicFlush: 1000,
+ })
+ dest.on('error', () => {})
+ per.dest = dest
+ per.logger = pino(
+ { base: undefined, timestamp: false, level: 'trace' },
+ dest as DestinationStream
+ )
+ if (needsNewline) dest.write('\n')
+ } catch (error) {
+ close(fd, () => {})
+ throw error
+ }
+ for (const write of per.openingWrites.splice(0)) write()
+ return true
+ } catch {
+ per.unavailable = true
+ per.openingWrites.length = 0
+ return false
+ }
+ }
+ per.opened = per.retryOpen()
return entry
}
@@ -118,13 +170,32 @@ export class LogCapabilityHost {
const safeMessage = verbose ? truncateLogText(msg) : redactLogText(msg)
const entry: LogEntry = {
...safe,
+ entryId: randomUUID(),
+ logSequence: ++per.sequence,
ts: Date.now(),
level,
msg: safeMessage,
}
per.ring.push(entry)
while (per.ring.length > this.opts.ringSize) per.ring.shift()
- per.logger[level]({ ...safe }, safeMessage)
+ const write = () => {
+ if (per.unavailable) return
+ if (!per.logger) {
+ per.openingWrites.push(write)
+ return
+ }
+ per.logger[level](
+ {
+ ...safe,
+ entryId: entry.entryId,
+ logSequence: entry.logSequence,
+ time: entry.ts,
+ },
+ safeMessage
+ )
+ }
+ if (per.clearing) per.queuedWrites.push(write)
+ else write()
for (const listener of this.subscribers) {
try {
listener(pluginId, entry)
@@ -145,14 +216,33 @@ export class LogCapabilityHost {
}
getTail(pluginId: string, limit: number): LogEntry[] {
- const per = this.per.get(pluginId)
- if (!per) return []
- return per.ring.slice(-limit)
+ const per = this.getOrCreate(pluginId)
+ const count = Number.isFinite(limit)
+ ? Math.max(0, Math.min(this.opts.ringSize, Math.floor(limit)))
+ : this.opts.ringSize
+ return count === 0 ? [] : per.ring.slice(-count)
}
- clear(pluginId: string): void {
- const per = this.per.get(pluginId)
- if (per) per.ring.length = 0
+ clear(pluginId: string): Promise<void> {
+ const per = this.getOrCreate(pluginId)
+ if (per.clearing) return per.clearing
+ if (per.unavailable && per.retryOpen) {
+ per.unavailable = false
+ per.opened = per.retryOpen()
+ }
+ const previous = new Set(per.ring)
+ const clearing = (async () => {
+ await flushDestination(per)
+ await fs.truncate(this.logPath(pluginId), 0)
+ // Commit the visible clear only after disk success. Entries captured
+ // during the operation remain visible and are written after truncation.
+ per.ring = per.ring.filter((item) => !previous.has(item))
+ })().finally(() => {
+ per.clearing = undefined
+ for (const write of per.queuedWrites.splice(0)) write()
+ })
+ per.clearing = clearing
+ return clearing
}
setVerbose(pluginId: string, verbose: boolean): void {
@@ -189,6 +279,11 @@ export class LogCapabilityHost {
* real rather than a timing guess.
*/
async flush(): Promise<void> {
- await Promise.all([...this.per.values()].map(flushDestination))
+ await Promise.all(
+ [...this.per.values()].map(async (per) => {
+ await per.clearing
+ await flushDestination(per)
+ })
+ )
}
}
diff --git a/src/core/plugin/host/activation-dispatcher.test.ts b/src/core/plugin/host/activation-dispatcher.test.ts
index a941df7b..45e10549 100644
--- a/src/core/plugin/host/activation-dispatcher.test.ts
+++ b/src/core/plugin/host/activation-dispatcher.test.ts
@@ -119,6 +119,32 @@ function makeMockRegistry(
const startupEvent: HostActivationEvent = { kind: 'startup' }
describe('ActivationDispatcher', () => {
+ it('isolates startup failures while preserving command and Hook failure propagation', async () => {
+ const registry = makeMockRegistry([
+ { manifest: makeManifest('alice.broken') },
+ { manifest: makeManifest('bob.healthy') },
+ ])
+ const host = makeMockHost({ activeIds: [], meta: [] })
+ const failure = new Error('worker failed')
+ host.activate.mockRejectedValueOnce(failure)
+ const dispatcher = new ActivationDispatcher(
+ registry as never,
+ host as never
+ )
+ await expect(dispatcher.dispatch(startupEvent)).resolves.toBeUndefined()
+ expect(host.activeIds()).toEqual(['bob.healthy'])
+ host.activate.mockRejectedValueOnce(failure)
+ await expect(
+ dispatcher.admit(['alice.broken'], {
+ kind: 'command',
+ commandId: 'alice.broken.run',
+ })
+ ).rejects.toBe(failure)
+ host.activate.mockRejectedValueOnce(failure)
+ await expect(
+ dispatcher.activateForHook('alice.broken', 'beforeCreate')
+ ).rejects.toBe(failure)
+ })
describe('registry-backed Hook demand', () => {
it.each(HOST_PATTERN_CONFORMANCE_CASES)(
'matches shared host corpus: $name',
diff --git a/src/core/plugin/host/activation-dispatcher.ts b/src/core/plugin/host/activation-dispatcher.ts
index 9ebcca0f..4028d88c 100644
--- a/src/core/plugin/host/activation-dispatcher.ts
+++ b/src/core/plugin/host/activation-dispatcher.ts
@@ -210,14 +210,21 @@ export class ActivationDispatcher {
}
}
- private activateForEvent(
+ private async activateForEvent(
pluginId: string,
event: HostActivationEvent
): Promise<void> {
if (event.kind === 'hookDemand') {
return this.host.activate(pluginId, { waitForDeactivation: true })
}
- return this.host.activate(pluginId)
+ try {
+ await this.host.activate(pluginId)
+ } catch (error) {
+ if (event.kind !== 'startup') throw error
+ // The host records the plugin failure. Keep the application available
+ // so users can inspect its logs or disable it, and start other plugins.
+ log.warn({ pluginId, err: error }, 'startup plugin activation failed')
+ }
}
/**
diff --git a/src/core/plugin/host/plugin-host.test.ts b/src/core/plugin/host/plugin-host.test.ts
index 63086552..fcc3bf07 100644
--- a/src/core/plugin/host/plugin-host.test.ts
+++ b/src/core/plugin/host/plugin-host.test.ts
@@ -230,6 +230,149 @@ describe('PluginHost', () => {
rmSync(root, { recursive: true, force: true })
})
+ it('records a missing entry bundle before worker construction and starts other plugins', async () => {
+ rmSync(path.join(root, 'plugins', 'alice.demo', 'dist', 'plugin.js'))
+ const host = new PluginHost({
+ registry,
+ stateStore,
+ capabilityHost: capHost,
+ workerScriptPath: workerPath,
+ appVersion: '2.5.0',
+ runtime: 'server',
+ hostLanguage: 'en-US',
+ })
+ try {
+ await new ActivationDispatcher(registry, host).dispatch({
+ kind: 'startup',
+ })
+ expect(stateStore.get('alice.demo')).toMatchObject({
+ errorCount: 1,
+ lastError: expect.stringContaining('plugin.runtime.activation_failed:'),
+ })
+ expect(
+ capHost
+ .getTail('alice.demo', 100)
+ .filter((entry) => entry.level === 'error')
+ ).toEqual([
+ expect.objectContaining({
+ source: 'host',
+ msg: expect.stringContaining('ENOENT'),
+ }),
+ ])
+ expect(host.isActive('bob.demo')).toBe(true)
+ } finally {
+ await host.shutdown()
+ }
+ })
+
+ it('records coalesced activation failures exactly once', async () => {
+ const failure = new Error('entry bundle is unreadable')
+ const host = new PluginHost({
+ registry,
+ stateStore,
+ capabilityHost: capHost,
+ workerScriptPath: workerPath,
+ appVersion: '2.5.0',
+ runtime: 'server',
+ hostLanguage: 'en-US',
+ readBundleSource: async () => {
+ throw failure
+ },
+ })
+ try {
+ await Promise.all([
+ expect(host.activate('alice.demo')).rejects.toBe(failure),
+ expect(host.activate('alice.demo')).rejects.toBe(failure),
+ ])
+ expect(stateStore.get('alice.demo')?.errorCount).toBe(1)
+ expect(
+ capHost
+ .getTail('alice.demo', 100)
+ .filter((entry) => entry.level === 'error')
+ ).toHaveLength(1)
+ } finally {
+ await host.shutdown()
+ }
+ })
+
+ it('does not report a cancelled activation or its late bundle failure as a runtime error', async () => {
+ let rejectRead!: (reason: Error) => void
+ const readBundleSource = vi.fn(
+ () =>
+ new Promise<string>((_, reject) => {
+ rejectRead = reject
+ })
+ )
+ const host = new PluginHost({
+ registry,
+ stateStore,
+ capabilityHost: capHost,
+ workerScriptPath: workerPath,
+ appVersion: '2.5.0',
+ runtime: 'server',
+ hostLanguage: 'en-US',
+ readBundleSource,
+ })
+ try {
+ const rejected = expect(host.activate('alice.demo')).rejects.toThrow(
+ 'superseded'
+ )
+ await vi.waitFor(() => expect(readBundleSource).toHaveBeenCalled())
+ await host.deactivate('alice.demo')
+ rejectRead(new Error('late IO failure'))
+ await rejected
+ expect(stateStore.get('alice.demo')?.errorCount).toBe(0)
+ expect(
+ capHost
+ .getTail('alice.demo', 100)
+ .filter((entry) => entry.level === 'error')
+ ).toEqual([])
+ } finally {
+ await host.shutdown()
+ }
+ })
+
+ it.each(['electron', 'server'] as const)(
+ 'records missing-worker startup failures in persistent plugin logs (%s)',
+ async (runtime) => {
+ const host = new PluginHost({
+ registry,
+ stateStore,
+ capabilityHost: capHost,
+ workerScriptPath: path.join(root, 'missing-worker.cjs'),
+ appVersion: '2.5.0',
+ runtime,
+ hostLanguage: 'en-US',
+ })
+ try {
+ await expect(host.activate('alice.demo')).rejects.toThrow(
+ 'Cannot find module'
+ )
+ expect(stateStore.get('alice.demo')?.lastError).toMatch(
+ /^plugin\.runtime\.worker_start_failed:/
+ )
+ expect(stateStore.get('alice.demo')?.errorCount).toBe(1)
+ const entries = capHost.getTail('alice.demo', 10)
+ expect(entries.filter((entry) => entry.level === 'error')).toHaveLength(
+ 1
+ )
+ expect(entries[0]).toMatchObject({
+ level: 'error',
+ source: 'host',
+ msg: expect.stringContaining('plugin.runtime.worker_start_failed:'),
+ })
+ await host.shutdown()
+ const restarted = new LogCapabilityHost({
+ pluginLogsDir: path.join(root, 'logs'),
+ })
+ expect(restarted.getTail('alice.demo', 10)).toEqual(entries)
+ await restarted.flush()
+ } finally {
+ await host.shutdown()
+ }
+ }
+ )
+
it('revokes a running guest without executing guest cleanup or changing user preference', async () => {
let revoked = false
vi.spyOn(registry, 'securityDecision').mockImplementation((id) =>
diff --git a/src/core/plugin/host/plugin-host.ts b/src/core/plugin/host/plugin-host.ts
index ac227e35..636507d7 100644
--- a/src/core/plugin/host/plugin-host.ts
+++ b/src/core/plugin/host/plugin-host.ts
@@ -141,6 +141,7 @@ interface Active {
interface ActivationAttempt {
epoch: number
+ errorRecorded: boolean
cancelled: boolean
cancellation: Promise<never>
cancel(reason?: Error): void
@@ -365,6 +366,7 @@ export class PluginHost {
void cancellation.catch(() => undefined)
const attempt: ActivationAttempt = {
epoch,
+ errorRecorded: false,
cancelled: false,
cancellation,
cancel: (reason = this.activationSupersededError(pluginId)) => {
@@ -378,6 +380,23 @@ export class PluginHost {
// published before registry/capability test doubles can re-enter us.
const promise = Promise.resolve()
.then(() => this.doActivate(pluginId, attempt))
+ .catch((error: unknown) => {
+ if (
+ !attempt.errorRecorded &&
+ this.isActivationCurrent(pluginId, attempt) &&
+ !this.shuttingDown &&
+ this.opts.registry.get(pluginId)?.state.enabled &&
+ !this.opts.registry.securityDecision?.(pluginId)
+ ) {
+ const message = error instanceof Error ? error.message : String(error)
+ this.recordError(
+ pluginId,
+ `plugin.runtime.activation_failed: ${message}`
+ )
+ this.opts.registry.refreshState(pluginId)
+ }
+ throw error
+ })
.finally(() => {
if (this.activating.get(pluginId) === attempt) {
this.activating.delete(pluginId)
@@ -480,7 +499,7 @@ export class PluginHost {
error instanceof AppError &&
error.code === ErrorCode.PluginCapabilityUnavailable
) {
- this.opts.stateStore.recordError(pluginId, error.message)
+ this.recordError(pluginId, error.message)
this.opts.registry.refreshState(pluginId)
}
throw error
@@ -550,10 +569,7 @@ export class PluginHost {
this.opts.signingPubkeys
)
) {
- this.opts.stateStore.recordError(
- pluginId,
- 'plugin.update.builtin_bad_signature'
- )
+ this.recordError(pluginId, 'plugin.update.builtin_bad_signature')
this.opts.registry.refreshState(pluginId)
throw new AppError(
ErrorCode.PluginManifestInvalid,
@@ -566,10 +582,7 @@ export class PluginHost {
readMoextEntry(moextBytes, indexed.manifest.main)
)
if (!entryBytes) {
- this.opts.stateStore.recordError(
- pluginId,
- 'plugin.update.builtin_bundle_entry_missing'
- )
+ this.recordError(pluginId, 'plugin.update.builtin_bundle_entry_missing')
this.opts.registry.refreshState(pluginId)
throw new AppError(
ErrorCode.PluginManifestInvalid,
@@ -657,7 +670,7 @@ export class PluginHost {
ErrorCode.PluginRuntimeFault,
`plugin.hook.not_registered: ${missingHooks.join(',')}`
)
- this.opts.stateStore.recordError(pluginId, error.message)
+ this.recordError(pluginId, error.message)
this.opts.registry.refreshState(pluginId)
rejectReady(error)
return
@@ -685,7 +698,17 @@ export class PluginHost {
) {
return
}
- this.opts.stateStore.recordError(pluginId, `${code}: ${message}`)
+ const startupFailure =
+ !this.active.get(pluginId)?.ready &&
+ [
+ 'plugin.runtime.worker_crashed',
+ 'plugin.runtime.worker_exited',
+ 'plugin.runtime.boot_failed',
+ ].includes(code)
+ this.recordError(
+ pluginId,
+ `${startupFailure ? 'plugin.runtime.worker_start_failed' : code}: ${message}`
+ )
this.opts.registry.refreshState(pluginId)
const error = new AppError(ErrorCode.PluginRuntimeFault, message)
rejectReady(error)
@@ -953,6 +976,15 @@ export class PluginHost {
)
}
+ private recordError(pluginId: string, message: string): void {
+ const attempt = this.activating.get(pluginId)
+ if (attempt) attempt.errorRecorded = true
+ this.opts.stateStore.recordError(pluginId, message)
+ this.opts.capabilityHost
+ .createLog(pluginId)
+ .error(message, { source: 'host' })
+ }
+
private assertExecutableDigest(
pluginId: string,
expected: string | undefined,
@@ -960,10 +992,7 @@ export class PluginHost {
): void {
const actual = createHash('sha256').update(bytes).digest('hex')
if (!expected || actual !== expected) {
- this.opts.stateStore.recordError(
- pluginId,
- 'plugin.runtime.executable_identity_changed'
- )
+ this.recordError(pluginId, 'plugin.runtime.executable_identity_changed')
this.opts.registry.refreshState(pluginId)
throw new AppError(
ErrorCode.PluginRuntimeFault,
@@ -1259,7 +1288,7 @@ export class PluginHost {
const previousState = this.opts.stateStore.get(pluginId)
this.opts.stateStore.setEnabled(pluginId, false)
if (options.recordError !== false) {
- this.opts.stateStore.recordError(pluginId, reason)
+ this.recordError(pluginId, reason)
}
this.opts.registry.refreshState(pluginId)
try {
@@ -1299,6 +1328,7 @@ export class PluginHost {
...this.deactivating.keys(),
])
await Promise.all([...pluginIds].map((id) => this.deactivate(id)))
+ await this.opts.capabilityHost.flush()
}
private sweepIdle(): void {
diff --git a/src/core/task/create-task-handler.plugin-hook-e2e.test.ts b/src/core/task/create-task-handler.plugin-hook-e2e.test.ts
index 52f44435..49ea909f 100644
--- a/src/core/task/create-task-handler.plugin-hook-e2e.test.ts
+++ b/src/core/task/create-task-handler.plugin-hook-e2e.test.ts
@@ -94,18 +94,6 @@ function buildCapHost(_rootDir: string): CapabilityHost {
} as unknown as CapabilityHost
}
-// Mock fs/promises so handleCreateTask's mkdir() doesn't touch the real
-// disk for the temp saveDir.
-vi.mock('node:fs/promises', async () => {
- const actual =
- await vi.importActual<typeof import('node:fs/promises')>('node:fs/promises')
- return {
- ...actual,
- mkdir: vi.fn(async () => undefined),
- default: { ...actual, mkdir: vi.fn(async () => undefined) },
- }
-})
-
interface BootedStack {
host: PluginHost
logs: LogCapabilityHost
diff --git a/src/main/ipc/commands.ts b/src/main/ipc/commands.ts
index 8f3cad7e..dbcfaed9 100644
--- a/src/main/ipc/commands.ts
+++ b/src/main/ipc/commands.ts
@@ -1919,7 +1919,7 @@ export function buildCommandHandlers(ctx: CommandContext): CommandHandlerMap {
[Commands.ClearPluginLogs]: async (payload: unknown) => {
const parsed = z.object({ pluginId: z.string().min(1) }).parse(payload)
- capabilityHost.clearLog(parsed.pluginId)
+ await capabilityHost.clearLog(parsed.pluginId)
return { ok: true }
},
diff --git a/src/preload/api.ts b/src/preload/api.ts
index 495bb412..c5bbc13d 100644
--- a/src/preload/api.ts
+++ b/src/preload/api.ts
@@ -23,11 +23,7 @@ export interface MotrixAPI {
on(
channel: RendererEventChannel,
callback: (...args: unknown[]) => void
- ): void
- off(
- channel: RendererEventChannel,
- callback: (...args: unknown[]) => void
- ): void
+ ): () => void
platform: NodeJS.Platform
// Electron 32+ removed File.path; webUtils.getPathForFile resolves the
// absolute path of a File obtained from <input type="file"> or drag-drop.
diff --git a/src/preload/preload.test.ts b/src/preload/preload.test.ts
index 48215e00..7e6d085c 100644
--- a/src/preload/preload.test.ts
+++ b/src/preload/preload.test.ts
@@ -7,6 +7,7 @@ import { Commands } from '@shared/protocol/commands'
import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
import { beforeEach, describe, expect, it, vi } from 'vitest'
+import type { RendererEventChannel } from './api'
type IpcListener = (event: unknown, ...args: unknown[]) => void
@@ -49,6 +50,31 @@ function emit(channel: string, ...args: unknown[]): void {
}
}
+const removers = new WeakMap<
+ (...args: unknown[]) => void,
+ Map<string, () => void>
+>()
+function subscribe(
+ channel: RendererEventChannel,
+ callback: (...args: unknown[]) => void
+) {
+ const remove = mocks.exposed!.on(channel, callback)
+ let channels = removers.get(callback)
+ if (!channels) {
+ channels = new Map()
+ removers.set(callback, channels)
+ }
+ channels.set(channel, remove)
+ return remove
+}
+function unsubscribe(
+ channel: RendererEventChannel,
+ callback: (...args: unknown[]) => void
+) {
+ removers.get(callback)?.get(channel)?.()
+ removers.get(callback)?.delete(channel)
+}
+
describe('preload latest-value replay buffers', () => {
beforeEach(() => {
vi.resetModules()
@@ -61,12 +87,12 @@ describe('preload latest-value replay buffers', () => {
await import('./preload')
emit(Events.NavigateTo, '/downloads/active')
const callback = vi.fn()
- mocks.exposed?.on(Events.NavigateTo, callback)
+ subscribe(Events.NavigateTo, callback)
await Promise.resolve()
expect(callback).toHaveBeenCalledExactlyOnceWith('/downloads/active')
- mocks.exposed?.off(Events.NavigateTo, callback)
+ unsubscribe(Events.NavigateTo, callback)
const remounted = vi.fn()
- mocks.exposed?.on(Events.NavigateTo, remounted)
+ subscribe(Events.NavigateTo, remounted)
await Promise.resolve()
expect(remounted).not.toHaveBeenCalled()
emit(Events.NavigateTo, '/settings/about')
@@ -79,7 +105,7 @@ describe('preload latest-value replay buffers', () => {
emit(Events.LocaleChanged, { language: 'en-US' })
const callback = vi.fn()
- mocks.exposed?.on(Events.LocaleChanged, callback)
+ subscribe(Events.LocaleChanged, callback)
await Promise.resolve()
expect(callback).toHaveBeenCalledTimes(1)
@@ -95,7 +121,7 @@ describe('preload latest-value replay buffers', () => {
emit(Events.LocaleChanged, { language: 'zh-CN' })
const callback = vi.fn()
- mocks.exposed?.on(Events.LocaleChanged, callback)
+ subscribe(Events.LocaleChanged, callback)
emit(Events.LocaleChanged, { language: 'en-US' })
expect(callback).toHaveBeenCalledTimes(1)
@@ -109,8 +135,8 @@ describe('preload latest-value replay buffers', () => {
emit(Events.NavigateTo, '/downloads/active')
const callback = vi.fn()
- mocks.exposed?.on(Events.NavigateTo, callback)
- mocks.exposed?.off(Events.NavigateTo, callback)
+ subscribe(Events.NavigateTo, callback)
+ unsubscribe(Events.NavigateTo, callback)
await Promise.resolve()
emit(Events.NavigateTo, '/settings/about')
@@ -129,7 +155,7 @@ describe('preload latest-value replay buffers', () => {
})
const callback = vi.fn()
- mocks.exposed?.on(Events.WindowMaximizedChanged, callback)
+ subscribe(Events.WindowMaximizedChanged, callback)
await Promise.resolve()
expect(callback).toHaveBeenCalledOnce()
@@ -140,7 +166,7 @@ describe('preload latest-value replay buffers', () => {
})
})
-describe('preload wrapperMap (F10: same callback on two channels)', () => {
+describe('preload event subscriptions', () => {
beforeEach(() => {
vi.resetModules()
vi.clearAllMocks()
@@ -148,6 +174,49 @@ describe('preload wrapperMap (F10: same callback on two channels)', () => {
mocks.listeners.clear()
})
+ it('shares one native listener across many subscribers and repeated mount cycles', async () => {
+ await import('./preload')
+ for (const channel of [
+ Events.PluginInstalled,
+ Events.EngineStateChanged,
+ Events.LocaleChanged,
+ ]) {
+ for (let cycle = 0; cycle < 20; cycle++) {
+ const callbacks = Array.from({ length: 32 }, () => vi.fn())
+ for (const callback of callbacks) subscribe(channel, callback)
+ expect(mocks.listeners.get(channel)?.size).toBe(1)
+ emit(channel, 'payload')
+ for (const callback of callbacks)
+ expect(callback).toHaveBeenCalledExactlyOnceWith('payload')
+ for (const callback of callbacks.slice(0, 16))
+ unsubscribe(channel, callback)
+ emit(channel, 'remaining')
+ for (const callback of callbacks.slice(0, 16))
+ expect(callback).toHaveBeenCalledOnce()
+ for (const callback of callbacks.slice(16)) {
+ expect(callback).toHaveBeenCalledTimes(2)
+ unsubscribe(channel, callback)
+ }
+ expect(mocks.listeners.get(channel)?.size).toBe(0)
+ }
+ }
+ })
+
+ it('deduplicates subscriptions and removes callbacks during event delivery', async () => {
+ await import('./preload')
+ const channel = Events.PluginInstalled
+ const later = vi.fn()
+ const first = vi.fn(() => unsubscribe(channel, later))
+ subscribe(channel, first)
+ subscribe(channel, first)
+ subscribe(channel, later)
+ emit(channel, 'payload')
+ expect(first).toHaveBeenCalledOnce()
+ expect(later).not.toHaveBeenCalled()
+ unsubscribe(channel, first)
+ expect(mocks.listeners.get(channel)?.size).toBe(0)
+ })
+
it("off() on channel A removes only channel A's own wrapper, leaving channel B's real listener intact", async () => {
await import('./preload')
const callback = vi.fn()
@@ -156,13 +225,13 @@ describe('preload wrapperMap (F10: same callback on two channels)', () => {
const channelA = Events.NotificationAdded
const channelB = Events.NotificationsChanged
- mocks.exposed?.on(channelA, callback)
- mocks.exposed?.on(channelB, callback)
+ subscribe(channelA, callback)
+ subscribe(channelB, callback)
expect(mocks.listeners.get(channelA)?.size).toBe(1)
expect(mocks.listeners.get(channelB)?.size).toBe(1)
- mocks.exposed?.off(channelA, callback)
+ unsubscribe(channelA, callback)
// The old single-level `WeakMap<Callback, CallbackSubscription>` would
// have looked up channel B's wrapper here and called
@@ -179,7 +248,7 @@ describe('preload wrapperMap (F10: same callback on two channels)', () => {
emit(channelB, 'still-alive')
expect(callback).toHaveBeenCalledWith('still-alive')
- mocks.exposed?.off(channelB, callback)
+ unsubscribe(channelB, callback)
expect(mocks.removeListener).toHaveBeenCalledTimes(2)
expect(mocks.listeners.get(channelA)?.size).toBe(0)
expect(mocks.listeners.get(channelB)?.size).toBe(0)
@@ -242,7 +311,7 @@ describe('preload IPC channel allowlist', () => {
const callbacks = channels.map(() => vi.fn())
for (const [index, channel] of channels.entries()) {
- mocks.exposed?.on(channel, callbacks[index])
+ subscribe(channel, callbacks[index])
}
for (const [index, channel] of channels.entries()) {
@@ -253,7 +322,7 @@ describe('preload IPC channel allowlist', () => {
{ index },
'event-payload'
)
- mocks.exposed?.off(channel, callbacks[index])
+ unsubscribe(channel, callbacks[index])
emit(channel, 'after-unsubscribe')
expect(callbacks[index]).toHaveBeenCalledOnce()
}
@@ -262,16 +331,16 @@ describe('preload IPC channel allowlist', () => {
it('allows valid plugin log channels and rejects malformed events', () => {
const callback = vi.fn()
- mocks.exposed?.on(`${Events.PluginLog}:example.contract`, callback)
+ subscribe(`${Events.PluginLog}:example.contract`, callback)
expect(
mocks.listeners.get(`${Events.PluginLog}:example.contract`)?.size
).toBe(1)
+ expect(() => subscribe('event:notDeclared' as never, callback)).toThrow(
+ 'undeclared IPC event channel'
+ )
expect(() =>
- mocks.exposed?.on('event:notDeclared' as never, callback)
- ).toThrow('undeclared IPC event channel')
- expect(() =>
- mocks.exposed?.on(`${Events.PluginLog}:not-namespaced` as never, callback)
+ subscribe(`${Events.PluginLog}:not-namespaced` as never, callback)
).toThrow('undeclared IPC event channel')
})
})
diff --git a/src/preload/preload.ts b/src/preload/preload.ts
index a906201c..4a8dcaf6 100644
--- a/src/preload/preload.ts
+++ b/src/preload/preload.ts
@@ -15,20 +15,18 @@ type IpcListener = (
...args: unknown[]
) => void
interface CallbackSubscription {
- wrapper: IpcListener
- cancelReplay(): void
+ active: boolean
+ receivedLiveEvent: boolean
+ deliver: Callback
+ remove(): void
}
-// F10: keyed by (callback -> channel -> subscription), NOT just callback.
-// The same callback function subscribed to two different channels (e.g.
-// usePendingPairRequests's 4-channel `onChange` reused across PairRequested/
-// Paired/PairRequestSettled/PairRequestExpired) used to collide on a
-// single-level `WeakMap<Callback, CallbackSubscription>`: the second on()
-// overwrote the first channel's subscription entry, so off() for the FIRST
-// channel looked up the SECOND channel's wrapper, called
-// `ipcRenderer.removeListener(firstChannel, secondChannelsWrapper)` (a
-// no-op — wrong function reference), and then deleted the only entry left
-// in the map — leaking BOTH real ipcRenderer listeners.
-const wrapperMap = new WeakMap<Callback, Map<string, CallbackSubscription>>()
+interface ChannelSubscription {
+ listener: IpcListener
+ callbacks: Map<Callback, CallbackSubscription>
+}
+// A renderer can have many consumers of the same event. Keep one native IPC
+// listener per channel, with independent subscriptions and replay cancellation.
+const subscriptions = new Map<string, ChannelSubscription>()
const INVOKE_CHANNELS = new Set<string>([
...Object.values(Commands),
@@ -69,7 +67,7 @@ function assertEventChannel(channel: string): void {
// listeners here that buffer the first send for each cold-start
// channel. When the renderer eventually calls `motrix.on(channel, cb)`,
// we replay the buffer to that callback, then disengage the eager
-// listener so subsequent events flow normally through the wrapper.
+// listener so subsequent events flow through the shared channel listener.
const BUFFERED_CHANNELS = new Set<string>([
Events.SetAddTaskMode,
Events.ProtocolTorrentFile,
@@ -118,33 +116,53 @@ const api: MotrixAPI = {
},
on: (channel, callback) => {
assertEventChannel(channel)
- let active = true
- let receivedLiveEvent = false
- const wrapper = (_event: Electron.IpcRendererEvent, ...args: unknown[]) => {
- receivedLiveEvent = true
- callback(...args)
- }
- let channelMap = wrapperMap.get(callback)
- if (!channelMap) {
- channelMap = new Map()
- wrapperMap.set(callback, channelMap)
+ let subscription = subscriptions.get(channel)
+ const existing = subscription?.callbacks.get(callback)
+ if (existing) return existing.remove
+ if (!subscription) {
+ const callbacks = new Map<Callback, CallbackSubscription>()
+ const listener: IpcListener = (_event, ...args) => {
+ for (const current of [...callbacks.values()]) {
+ if (!current.active) continue
+ current.receivedLiveEvent = true
+ current.deliver(...args)
+ }
+ }
+ subscription = { listener, callbacks }
+ subscriptions.set(channel, subscription)
+ const eager = eagerListeners.get(channel)
+ if (eager) {
+ ipcRenderer.removeListener(channel, eager)
+ eagerListeners.delete(channel)
+ }
+ ipcRenderer.on(channel, listener)
}
- channelMap.set(channel, {
- wrapper,
- cancelReplay: () => {
- active = false
+ const registered = subscription
+ const current: CallbackSubscription = {
+ active: true,
+ receivedLiveEvent: false,
+ remove: () => {
+ if (!current.active) return
+ current.active = false
+ registered.callbacks.delete(callback)
+ if (registered.callbacks.size === 0) {
+ ipcRenderer.removeListener(channel, registered.listener)
+ subscriptions.delete(channel)
+ }
+ },
+ deliver: (...args) => {
+ try {
+ callback(...args)
+ } catch (error) {
+ // Surface the failure without starving the other event consumers.
+ queueMicrotask(() => {
+ throw error
+ })
+ }
},
- })
- ipcRenderer.on(channel, wrapper)
-
- // First real subscriber for this channel claims the buffered events
- // and disengages the eager pre-buffer (subsequent sends flow through
- // `wrapper` only — no double delivery).
- const eager = eagerListeners.get(channel)
- if (eager) {
- ipcRenderer.removeListener(channel, eager)
- eagerListeners.delete(channel)
}
+ subscription.callbacks.set(callback, current)
+
const buffered = replayBuffer.get(channel)
if (buffered && buffered.length > 0) {
replayBuffer.delete(channel)
@@ -152,24 +170,17 @@ const api: MotrixAPI = {
// (e.g. useEffect attaching the listener) before we invoke the
// callback, matching the normal async IPC arrival contract.
queueMicrotask(() => {
- if (!active) return
- if (REPLAY_LATEST_CHANNELS.has(channel) && receivedLiveEvent) return
- for (const args of buffered) callback(...args)
+ if (!current.active) return
+ if (REPLAY_LATEST_CHANNELS.has(channel) && current.receivedLiveEvent)
+ return
+ for (const args of buffered) {
+ if (!current.active) break
+ current.deliver(...args)
+ }
})
}
- },
- off: (channel, callback) => {
- assertEventChannel(channel)
- const channelMap = wrapperMap.get(callback)
- const subscription = channelMap?.get(channel)
- if (subscription) {
- subscription.cancelReplay()
- ipcRenderer.removeListener(channel, subscription.wrapper)
- channelMap?.delete(channel)
- if (channelMap && channelMap.size === 0) {
- wrapperMap.delete(callback)
- }
- }
+ // Returning a closure avoids comparing callback proxies across worlds.
+ return current.remove
},
platform: process.platform,
getPathForFile: (file) => webUtils.getPathForFile(file),
diff --git a/src/renderer/features/plugin-operations/operation-task-menu.test.tsx b/src/renderer/features/plugin-operations/operation-task-menu.test.tsx
index 75c54262..974d4aca 100644
--- a/src/renderer/features/plugin-operations/operation-task-menu.test.tsx
+++ b/src/renderer/features/plugin-operations/operation-task-menu.test.tsx
@@ -2,10 +2,12 @@ import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
import { transport } from '@renderer/lib/transport'
import { Commands } from '@shared/protocol/commands'
+import { Events } from '@shared/protocol/events'
import { TaskStatus } from '@shared/types/task'
import { textOperationManifest } from '@test-utils/plugin-operation-fixture'
import { makeDownloadTask } from '@test-utils/task'
import {
+ act,
cleanup,
fireEvent,
render,
@@ -16,7 +18,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { useOperationDialog } from './operation-store'
import { OperationTaskMenuItems } from './operation-task-menu'
-vi.mock('@renderer/lib/transport', () => ({ transport: { invoke: vi.fn() } }))
+vi.mock('@renderer/lib/transport', () => ({
+ transport: { invoke: vi.fn(), on: vi.fn(), off: vi.fn() },
+}))
vi.mock('@renderer/components/ui/dropdown-menu', () => ({
DropdownMenuItem: (props: React.ComponentProps<'button'>) => (
<button {...props} />
@@ -34,6 +38,7 @@ const task = makeDownloadTask({
finalPath: '/downloads/a.txt',
})
beforeEach(() => {
+ vi.mocked(transport.on).mockClear()
vi.mocked(transport.invoke)
.mockReset()
.mockResolvedValue({ descriptors: [descriptor] })
@@ -41,6 +46,27 @@ beforeEach(() => {
})
afterEach(cleanup)
describe('declarative task operation entries', () => {
+ it('removes disabled plugin actions from an open menu and restores them after enabling', async () => {
+ render(<OperationTaskMenuItems selected={[task]} open />)
+ expect(
+ await screen.findByRole('button', { name: 'Deduplicate lines' })
+ ).toBeEnabled()
+ vi.mocked(transport.invoke).mockResolvedValue({
+ descriptors: [{ ...descriptor, unavailable: 'disabled' }],
+ })
+ const onStatus = vi
+ .mocked(transport.on)
+ .mock.calls.find(
+ ([channel]) => channel === Events.PluginStatusChanged
+ )![1]
+ act(() => onStatus({ pluginId: manifest.id, enabled: false }))
+ await waitFor(() => expect(screen.queryByRole('button')).toBeNull())
+ vi.mocked(transport.invoke).mockResolvedValue({ descriptors: [descriptor] })
+ act(() => onStatus({ pluginId: manifest.id, enabled: true }))
+ expect(
+ await screen.findByRole('button', { name: 'Deduplicate lines' })
+ ).toBeEnabled()
+ })
it('loads only when opened and maps the selected task to the shared operation', async () => {
const view = render(
<OperationTaskMenuItems selected={[task]} open={false} />
@@ -57,13 +83,13 @@ describe('declarative task operation entries', () => {
taskIds: ['selected'],
})
})
- it('hides inapplicable selections and explains unavailable providers', async () => {
+ it('hides inapplicable selections and explains blocked providers', async () => {
vi.mocked(transport.invoke).mockResolvedValue({
- descriptors: [{ ...descriptor, unavailable: 'disabled' }],
+ descriptors: [{ ...descriptor, unavailable: 'blocked' }],
})
const view = render(<OperationTaskMenuItems selected={[task]} open />)
expect(await screen.findByRole('button')).toBeDisabled()
- expect(screen.getByRole('button')).toHaveTextContent('Enable')
+ expect(screen.getByRole('button')).toHaveTextContent('blocked')
view.rerender(
<OperationTaskMenuItems
selected={[{ ...task, status: TaskStatus.Downloading }]}
diff --git a/src/renderer/features/plugin-operations/operation-task-menu.tsx b/src/renderer/features/plugin-operations/operation-task-menu.tsx
index 90f227af..55913973 100644
--- a/src/renderer/features/plugin-operations/operation-task-menu.tsx
+++ b/src/renderer/features/plugin-operations/operation-task-menu.tsx
@@ -1,6 +1,8 @@
import { DropdownMenuItem } from '@renderer/components/ui/dropdown-menu'
import { invokeOperation } from '@renderer/features/plugin-operations/operation-client'
+import { useIpcEvent } from '@renderer/hooks/use-ipc-event'
import { Commands } from '@shared/protocol/commands'
+import { Events } from '@shared/protocol/events'
import type { OperationDescriptor } from '@shared/schemas/plugin-operations'
import { type DownloadTask, TaskStatus } from '@shared/types/task'
import { useEffect, useState } from 'react'
@@ -17,6 +19,12 @@ export function OperationTaskMenuItems({
const { t, i18n } = useTranslation()
const locale = i18n.resolvedLanguage
const [items, setItems] = useState<OperationDescriptor[]>([])
+ const [revision, setRevision] = useState(0)
+ useIpcEvent(Events.PluginStatusChanged, () =>
+ setRevision((value) => value + 1)
+ )
+ useIpcEvent(Events.PluginUninstalled, () => setRevision((value) => value + 1))
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Status events invalidate the open menu catalog.
useEffect(() => {
if (!locale) return
if (!open) return
@@ -33,21 +41,23 @@ export function OperationTaskMenuItems({
return () => {
active = false
}
- }, [open, locale])
+ }, [open, locale, revision])
return items
- .filter((item) =>
- item.definition.entries.some(
- (entry) =>
- entry.surface === 'task-menu' &&
- selected.length >= entry.selection.count.min &&
- selected.length <= entry.selection.count.max &&
- selected.every(
- (task) =>
- task.status === TaskStatus.Completed &&
- task.fileCount <= 1 &&
- task.finalPath
- )
- )
+ .filter(
+ (item) =>
+ item.unavailable !== 'disabled' &&
+ item.definition.entries.some(
+ (entry) =>
+ entry.surface === 'task-menu' &&
+ selected.length >= entry.selection.count.min &&
+ selected.length <= entry.selection.count.max &&
+ selected.every(
+ (task) =>
+ task.status === TaskStatus.Completed &&
+ task.fileCount <= 1 &&
+ task.finalPath
+ )
+ )
)
.map((item) => (
<DropdownMenuItem
diff --git a/src/renderer/lib/transport/electron.test.ts b/src/renderer/lib/transport/electron.test.ts
index 953b9303..0819afc9 100644
--- a/src/renderer/lib/transport/electron.test.ts
+++ b/src/renderer/lib/transport/electron.test.ts
@@ -6,6 +6,7 @@ import {
ProtocolEnvelopeError,
type TransportError,
} from '@shared/protocol/errors'
+import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { ElectronTransport } from './electron'
@@ -15,6 +16,27 @@ afterEach(() => {
})
describe('ElectronTransport', () => {
+ it('retains preload disposers per callback and channel without passing callbacks back across the bridge', () => {
+ const first = vi.fn()
+ const second = vi.fn()
+ const on = vi.fn().mockReturnValueOnce(first).mockReturnValueOnce(second)
+ Object.defineProperty(window, 'motrix', {
+ configurable: true,
+ value: { on, platform: 'darwin' },
+ })
+ const transport = new ElectronTransport()
+ const callback = vi.fn()
+ transport.on(Events.PluginInstalled, callback)
+ transport.on(Events.PluginInstalled, callback)
+ transport.on(Events.PluginStatusChanged, callback)
+ expect(on).toHaveBeenCalledTimes(2)
+ transport.off(Events.PluginInstalled, callback)
+ transport.off(Events.PluginInstalled, callback)
+ expect(first).toHaveBeenCalledOnce()
+ expect(second).not.toHaveBeenCalled()
+ transport.off(Events.PluginStatusChanged, callback)
+ expect(second).toHaveBeenCalledOnce()
+ })
it.each([Queries.GetTaskInspectorActivity, Commands.OpenTaskFile])(
'unwraps a protocol success envelope for %s',
async (channel) => {
diff --git a/src/renderer/lib/transport/electron.ts b/src/renderer/lib/transport/electron.ts
index ead01194..7a1c84e3 100644
--- a/src/renderer/lib/transport/electron.ts
+++ b/src/renderer/lib/transport/electron.ts
@@ -15,7 +15,7 @@ function getMotrix(): NonNullable<Window['motrix']> {
}
export class ElectronTransport implements Transport {
- private readonly intentListeners = new Map<
+ private readonly subscriptions = new Map<
EventListener,
Map<EventChannel, () => void>
>()
@@ -41,20 +41,23 @@ export class ElectronTransport implements Transport {
: value
}
on(channel: EventChannel, cb: EventListener): void {
- getMotrix().on(channel, cb)
- let channels = this.intentListeners.get(cb)
+ let channels = this.subscriptions.get(cb)
+ if (channels?.has(channel)) return
+ const unsubscribe = getMotrix().on(channel, cb)
if (!channels) {
channels = new Map()
- this.intentListeners.set(cb, channels)
+ this.subscriptions.set(cb, channels)
}
- channels.get(channel)?.()
- channels.set(channel, registerIntentConsumer(channel, cb))
+ const unregisterIntent = registerIntentConsumer(channel, cb)
+ channels.set(channel, () => {
+ unsubscribe?.()
+ unregisterIntent()
+ })
}
off(channel: EventChannel, cb: EventListener): void {
- getMotrix().off(channel, cb)
- const channels = this.intentListeners.get(cb)
+ const channels = this.subscriptions.get(cb)
channels?.get(channel)?.()
channels?.delete(channel)
- if (!channels?.size) this.intentListeners.delete(cb)
+ if (!channels?.size) this.subscriptions.delete(cb)
}
}
diff --git a/src/renderer/routes/plugins/components/overview-section.test.tsx b/src/renderer/routes/plugins/components/overview-section.test.tsx
index 5a514c8b..8e52157b 100644
--- a/src/renderer/routes/plugins/components/overview-section.test.tsx
+++ b/src/renderer/routes/plugins/components/overview-section.test.tsx
@@ -40,6 +40,38 @@ function manifest(over: Partial<PluginManifestDTO> = {}): PluginManifestDTO {
}
describe('OverviewSection', () => {
+ it.each([
+ [
+ 'plugin.runtime.activation_failed: ENOENT: plugin.js',
+ 'Plugin runtime could not start',
+ ],
+ [
+ 'plugin.runtime.worker_start_failed: Cannot find module worker.cjs',
+ 'Plugin runtime could not start',
+ ],
+ [
+ 'plugin.runtime.worker_crashed: Cannot find module /old/dist/core/plugin/host/quick-js-worker.cjs',
+ 'Plugin runtime could not start',
+ ],
+ [
+ 'plugin.runtime.worker_exited: worker exited with code 1',
+ 'Plugin runtime stopped unexpectedly',
+ ],
+ [
+ 'plugin.bundle.parse_error: Unexpected token',
+ 'This plugin reported a problem',
+ ],
+ ])('distinguishes the source of %s', (lastError, title) => {
+ render(
+ <OverviewSection
+ plugin={plugin({ errorCount: 1, lastError })}
+ manifest={manifest()}
+ onJumpToLogs={() => {}}
+ />
+ )
+ expect(screen.getAllByText(title).length).toBeGreaterThan(0)
+ expect(screen.getByText(lastError)).toBeInTheDocument()
+ })
it('renders Ready hero for safe tone', () => {
render(
<OverviewSection
diff --git a/src/renderer/routes/plugins/components/overview-section.tsx b/src/renderer/routes/plugins/components/overview-section.tsx
index 13588f2d..884904d8 100644
--- a/src/renderer/routes/plugins/components/overview-section.tsx
+++ b/src/renderer/routes/plugins/components/overview-section.tsx
@@ -9,6 +9,7 @@ import {
summarizeHealth,
truncateOneLine,
} from '../lib/audience'
+import { pluginErrorTitleKey } from '../lib/plugin-error'
import { PluginAvatar } from './plugin-avatar'
interface Props {
@@ -103,7 +104,7 @@ export function OverviewSection({ plugin, manifest, onJumpToLogs }: Props) {
<Alert variant="destructive">
<div className="flex-1">
<div className="text-sm font-semibold">
- {t('plugins.detail.attentionTitle')}
+ {t(pluginErrorTitleKey(plugin.lastError))}
</div>
<div className="mt-0.5 text-xs">
{plugin.lastError ?? t('plugins.detail.attentionGeneric')}
diff --git a/src/renderer/routes/plugins/components/plugin-log-row.tsx b/src/renderer/routes/plugins/components/plugin-log-row.tsx
index 0b56a6a9..8d560e43 100644
--- a/src/renderer/routes/plugins/components/plugin-log-row.tsx
+++ b/src/renderer/routes/plugins/components/plugin-log-row.tsx
@@ -17,12 +17,13 @@ function formatTs(ts: number): string {
export function PluginLogRow({ entry }: { entry: PluginLogEntry }) {
const extraFields = Object.entries(entry).filter(
- ([k]) => k !== 'ts' && k !== 'level' && k !== 'msg'
+ ([k]) => !['ts', 'level', 'msg', 'entryId', 'logSequence'].includes(k)
)
return (
<div className="grid grid-cols-[5.25rem_3.5rem_minmax(0,1fr)] items-start border-b border-border/50 px-3 py-2 font-mono text-[11px] leading-4 transition-colors last:border-b-0 hover:bg-muted/25">
<time
dateTime={new Date(entry.ts).toISOString()}
+ title={new Date(entry.ts).toLocaleString()}
className="tabular-nums text-muted-foreground"
>
{formatTs(entry.ts)}
diff --git a/src/renderer/routes/plugins/components/plugin-log-tab-clear.test.tsx b/src/renderer/routes/plugins/components/plugin-log-tab-clear.test.tsx
new file mode 100644
index 00000000..719cf07e
--- /dev/null
+++ b/src/renderer/routes/plugins/components/plugin-log-tab-clear.test.tsx
@@ -0,0 +1,74 @@
+import '@testing-library/jest-dom/vitest'
+import '@renderer/lib/i18n'
+import { toast } from '@renderer/components/ui/toast'
+import { transport } from '@renderer/lib/transport'
+import { Commands } from '@shared/protocol/commands'
+import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { PluginLogTab } from './plugin-log-tab'
+
+const { refresh } = vi.hoisted(() => ({ refresh: vi.fn() }))
+vi.mock('@renderer/lib/transport', () => ({ transport: { invoke: vi.fn() } }))
+vi.mock('@renderer/components/ui/toast', () => ({ toast: { add: vi.fn() } }))
+vi.mock('../hooks/use-plugin-log-stream', () => ({
+ usePluginLogStream: () => ({
+ entries: [{ ts: 1, level: 'error', msg: 'original failure' }],
+ refresh,
+ }),
+}))
+vi.mock('../hooks/use-plugin-log-state', () => ({
+ usePluginLogState: () => ({
+ verbose: false,
+ pending: false,
+ setVerbose: vi.fn(),
+ }),
+}))
+beforeEach(() => {
+ vi.clearAllMocks()
+ refresh.mockResolvedValue(undefined)
+})
+
+describe('plugin log clear feedback', () => {
+ it('reports a failed clear and keeps the existing entries visible for retry', async () => {
+ vi.mocked(transport.invoke)
+ .mockRejectedValueOnce(new Error('disk full'))
+ .mockResolvedValue({ ok: true })
+ const user = userEvent.setup()
+ render(<PluginLogTab pluginId="alice.demo" />)
+ const clear = screen.getByRole('button', { name: 'Clear' })
+ await user.click(clear)
+ await waitFor(() =>
+ expect(toast.add).toHaveBeenCalledWith({
+ title: 'Couldn’t clear logs. Try again.',
+ type: 'error',
+ })
+ )
+ expect(screen.getByText('original failure')).toBeInTheDocument()
+ expect(refresh).not.toHaveBeenCalled()
+ expect(clear).toBeEnabled()
+ await user.click(clear)
+ await waitFor(() => expect(refresh).toHaveBeenCalledOnce())
+ })
+ it('disables duplicate clear submissions until the command and refresh finish', async () => {
+ let resolve!: (value: unknown) => void
+ vi.mocked(transport.invoke).mockImplementation(
+ () =>
+ new Promise((done) => {
+ resolve = done
+ })
+ )
+ render(<PluginLogTab pluginId="alice.demo" />)
+ const clear = screen.getByRole('button', { name: 'Clear' })
+ fireEvent.click(clear)
+ expect(clear).toBeDisabled()
+ fireEvent.click(clear)
+ expect(transport.invoke).toHaveBeenCalledExactlyOnceWith(
+ Commands.ClearPluginLogs,
+ { pluginId: 'alice.demo' }
+ )
+ await act(async () => resolve({ ok: true }))
+ expect(refresh).toHaveBeenCalledOnce()
+ expect(clear).toBeEnabled()
+ })
+})
diff --git a/src/renderer/routes/plugins/components/plugin-log-tab.tsx b/src/renderer/routes/plugins/components/plugin-log-tab.tsx
index d63708a5..c93343f6 100644
--- a/src/renderer/routes/plugins/components/plugin-log-tab.tsx
+++ b/src/renderer/routes/plugins/components/plugin-log-tab.tsx
@@ -22,6 +22,7 @@ import {
} from '@renderer/components/ui/select'
import { Separator } from '@renderer/components/ui/separator'
import { Switch } from '@renderer/components/ui/switch'
+import { toast } from '@renderer/components/ui/toast'
import { transport } from '@renderer/lib/transport'
import { serializePluginLogsForExport } from '@shared/lib/plugin-log-export'
import { Commands } from '@shared/protocol/commands'
@@ -45,7 +46,8 @@ export function PluginLogTab({ pluginId }: { pluginId: string }) {
const { t } = useTranslation()
const [level, setLevel] = useState<(typeof LEVELS)[number]>('all')
const { verbose, pending, setVerbose } = usePluginLogState(pluginId)
- const { entries, setEntries } = usePluginLogStream(pluginId)
+ const { entries, refresh } = usePluginLogStream(pluginId)
+ const [clearing, setClearing] = useState(false)
const levelOptions = LEVELS.map((value) => ({
value,
label: t(`plugins.logs.levels.${value}`),
@@ -55,8 +57,16 @@ export function PluginLogTab({ pluginId }: { pluginId: string }) {
level === 'all' ? entries : entries.filter((e) => e.level === level)
async function onClear() {
- await transport.invoke(Commands.ClearPluginLogs, { pluginId })
- setEntries([])
+ if (clearing) return
+ setClearing(true)
+ try {
+ await transport.invoke(Commands.ClearPluginLogs, { pluginId })
+ await refresh()
+ } catch {
+ toast.add({ title: t('plugins.logs.clearFailed'), type: 'error' })
+ } finally {
+ setClearing(false)
+ }
}
return (
@@ -118,7 +128,7 @@ export function PluginLogTab({ pluginId }: { pluginId: string }) {
<Button
size="xs"
variant="ghost"
- disabled={entries.length === 0}
+ disabled={clearing || entries.length === 0}
onClick={onClear}
className="text-muted-foreground hover:bg-destructive/10 hover:text-destructive active:scale-[0.97] motion-reduce:transform-none dark:hover:bg-destructive/15"
>
@@ -142,7 +152,7 @@ export function PluginLogTab({ pluginId }: { pluginId: string }) {
<div className="flex h-9 shrink-0 items-center justify-between border-b border-border/60 bg-muted/30 px-3">
<div className="flex items-center gap-2 text-xs font-medium text-foreground">
<TerminalIcon className="size-3.5 text-muted-foreground" />
- <span>{t('plugins.logs.output')}</span>
+ <span>{t('plugins.detail.logs')}</span>
</div>
<span
aria-live="polite"
@@ -176,7 +186,14 @@ export function PluginLogTab({ pluginId }: { pluginId: string }) {
</div>
) : (
filtered.map((e) => (
- <PluginLogRow key={`${e.ts}-${e.level}-${e.msg}`} entry={e} />
+ <PluginLogRow
+ key={
+ typeof e.entryId === 'string'
+ ? e.entryId
+ : `${e.ts}-${e.level}-${e.msg}`
+ }
+ entry={e}
+ />
))
)}
</ScrollAreaContent>
diff --git a/src/renderer/routes/plugins/hooks/use-plugin-log-stream.test.tsx b/src/renderer/routes/plugins/hooks/use-plugin-log-stream.test.tsx
new file mode 100644
index 00000000..212dbbd8
--- /dev/null
+++ b/src/renderer/routes/plugins/hooks/use-plugin-log-stream.test.tsx
@@ -0,0 +1,136 @@
+import { transport } from '@renderer/lib/transport'
+import { Events } from '@shared/protocol/events'
+import type { PluginLogEntry } from '@shared/types/plugin'
+import { act, renderHook, waitFor } from '@testing-library/react'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { usePluginLogStream } from './use-plugin-log-stream'
+
+vi.mock('@renderer/lib/transport', () => ({
+ transport: {
+ invoke: vi.fn(),
+ on: vi.fn(),
+ off: vi.fn(),
+ onConnectionChange: vi.fn(),
+ },
+}))
+const entry = (entryId: string): PluginLogEntry => ({
+ entryId,
+ ts: 123,
+ level: 'error',
+ msg: entryId,
+})
+const emit = (pluginId: string, value: PluginLogEntry) => {
+ const callback = vi
+ .mocked(transport.on)
+ .mock.calls.findLast(
+ ([channel]) => channel === `${Events.PluginLog}:${pluginId}`
+ )?.[1]
+ callback?.(value)
+}
+beforeEach(() => vi.clearAllMocks())
+
+describe('plugin log history and live stream', () => {
+ it.each([false, true])(
+ 'keeps a burst in order when snapshot overlaps live records (equal timestamps: %s)',
+ async (equalTimestamps) => {
+ let resolve!: (entries: PluginLogEntry[]) => void
+ vi.mocked(transport.invoke).mockImplementation(
+ () =>
+ new Promise((done) => {
+ resolve = done
+ })
+ )
+ const { result } = renderHook(() => usePluginLogStream('alice.demo'))
+ const entries = Array.from({ length: 150 }, (_, index) => ({
+ ...entry(String(index)),
+ ts: equalTimestamps ? 1 : 1000 + index,
+ logSequence: index + 1,
+ }))
+ act(() => {
+ for (const item of entries) emit('alice.demo', item)
+ })
+ await act(async () => resolve(entries.slice(-100)))
+ expect(result.current.entries).toEqual(entries)
+ }
+ )
+
+ it('retains the newest records when delayed live delivery and snapshot exceed the cap', async () => {
+ let resolve!: (entries: PluginLogEntry[]) => void
+ vi.mocked(transport.invoke).mockImplementation(
+ () =>
+ new Promise((done) => {
+ resolve = done
+ })
+ )
+ const { result } = renderHook(() => usePluginLogStream('alice.demo'))
+ const entries = Array.from({ length: 600 }, (_, index) => ({
+ ...entry(String(index)),
+ ts: 10000 - index,
+ logSequence: index + 1,
+ }))
+ act(() => {
+ for (const item of entries.slice(0, 500)) emit('alice.demo', item)
+ })
+ await act(async () => resolve(entries.slice(-100)))
+ expect(result.current.entries).toEqual(entries.slice(-500))
+ })
+ it('subscribes before loading history and merges concurrent entries exactly once', async () => {
+ let resolve!: (value: PluginLogEntry[]) => void
+ vi.mocked(transport.invoke).mockImplementation(() => {
+ expect(transport.on).toHaveBeenCalled()
+ return new Promise((done) => {
+ resolve = done
+ })
+ })
+ const { result, unmount } = renderHook(() =>
+ usePluginLogStream('alice.demo')
+ )
+ act(() => emit('alice.demo', entry('live')))
+ await act(async () => resolve([entry('history'), entry('live')]))
+ expect(result.current.entries.map((e) => e.entryId)).toEqual([
+ 'history',
+ 'live',
+ ])
+ unmount()
+ expect(transport.off).toHaveBeenCalledWith(
+ `${Events.PluginLog}:alice.demo`,
+ expect.any(Function)
+ )
+ })
+
+ it('ignores stale snapshots and events when switching plugins', async () => {
+ let resolve!: (value: PluginLogEntry[]) => void
+ vi.mocked(transport.invoke)
+ .mockImplementationOnce(
+ () =>
+ new Promise((done) => {
+ resolve = done
+ })
+ )
+ .mockResolvedValue([entry('bob')])
+ const { result, rerender } = renderHook(
+ ({ id }) => usePluginLogStream(id),
+ { initialProps: { id: 'alice.demo' } }
+ )
+ rerender({ id: 'bob.demo' })
+ await waitFor(() => expect(result.current.entries).toEqual([entry('bob')]))
+ await act(async () => {
+ resolve([entry('alice')])
+ emit('alice.demo', entry('old-live'))
+ })
+ expect(result.current.entries).toEqual([entry('bob')])
+ })
+
+ it('refreshes after clearing and reconnecting without retaining old entries', async () => {
+ vi.mocked(transport.invoke).mockResolvedValue([entry('old')])
+ const { result } = renderHook(() => usePluginLogStream('alice.demo'))
+ await waitFor(() => expect(result.current.entries).toEqual([entry('old')]))
+ vi.mocked(transport.invoke).mockResolvedValue([])
+ await act(() => result.current.refresh())
+ expect(result.current.entries).toEqual([])
+ vi.mocked(transport.invoke).mockResolvedValue([entry('after-reconnect')])
+ const connected = vi.mocked(transport.onConnectionChange!).mock.calls[0][0]
+ await act(async () => connected({ state: 'connected' }))
+ expect(result.current.entries).toEqual([entry('after-reconnect')])
+ })
+})
diff --git a/src/renderer/routes/plugins/hooks/use-plugin-log-stream.ts b/src/renderer/routes/plugins/hooks/use-plugin-log-stream.ts
index ccfbd797..8b3d1564 100644
--- a/src/renderer/routes/plugins/hooks/use-plugin-log-stream.ts
+++ b/src/renderer/routes/plugins/hooks/use-plugin-log-stream.ts
@@ -1,43 +1,84 @@
import { transport } from '@renderer/lib/transport'
+import { comparePluginLogs } from '@shared/lib/plugin-log-order'
import type { EventChannel } from '@shared/protocol/events'
import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
import type { PluginLogEntry } from '@shared/types/plugin'
-import { useEffect, useState } from 'react'
+import { useCallback, useEffect, useRef, useState } from 'react'
const RING_MAX = 500
+function mergeEntries(...groups: PluginLogEntry[][]): PluginLogEntry[] {
+ const entries = new Map<string, PluginLogEntry>()
+ for (const entry of groups.flat()) {
+ const key =
+ typeof entry.entryId === 'string' ? entry.entryId : JSON.stringify(entry)
+ entries.set(key, entry)
+ }
+ return [...entries.values()].sort(comparePluginLogs).slice(-RING_MAX)
+}
+
export function usePluginLogStream(pluginId: string) {
- const [entries, setEntries] = useState<PluginLogEntry[]>([])
+ const [snapshot, setSnapshot] = useState({
+ pluginId,
+ entries: [] as PluginLogEntry[],
+ })
+ const refreshRef = useRef<() => Promise<void>>(async () => {})
+ const refresh = useCallback(() => refreshRef.current(), [])
useEffect(() => {
let cancelled = false
+ let generation = 0
+ let pending = false
+ let live: PluginLogEntry[] = []
const channel = `${Events.PluginLog}:${pluginId}` as EventChannel
-
- transport
- .invoke(Queries.GetPluginLogs, { pluginId, limit: 100 })
- .then((r) => {
- if (!cancelled) setEntries((r as PluginLogEntry[]) ?? [])
- })
- .catch(() => {
- /* swallow — empty initial tail */
- })
-
+ setSnapshot({ pluginId, entries: [] })
+ const readTail = async () => {
+ const request = ++generation
+ pending = true
+ live = []
+ try {
+ const entries = (await transport.invoke(Queries.GetPluginLogs, {
+ pluginId,
+ limit: 100,
+ })) as PluginLogEntry[]
+ if (!cancelled && request === generation) {
+ pending = false
+ setSnapshot({ pluginId, entries: mergeEntries(entries ?? [], live) })
+ }
+ } catch {
+ if (!cancelled && request === generation) pending = false
+ // Preserve live entries if the snapshot fails; reconnect retries it.
+ }
+ }
const onEntry = (...args: unknown[]) => {
+ if (cancelled) return
const entry = args[0] as PluginLogEntry
- setEntries((arr) =>
- arr.length >= RING_MAX
- ? [...arr.slice(-(RING_MAX - 1)), entry]
- : [...arr, entry]
- )
+ if (pending) live = mergeEntries(live, [entry])
+ setSnapshot((current) => ({
+ pluginId,
+ entries: mergeEntries(
+ current.pluginId === pluginId ? current.entries : [],
+ [entry]
+ ),
+ }))
}
-
transport.on(channel, onEntry)
+ refreshRef.current = readTail
+ const unsubscribe = transport.onConnectionChange?.(({ state }) => {
+ if (state === 'connected') void readTail()
+ })
+ void readTail()
return () => {
cancelled = true
+ refreshRef.current = async () => {}
transport.off(channel, onEntry)
+ unsubscribe?.()
}
}, [pluginId])
- return { entries, setEntries }
+ return {
+ entries: snapshot.pluginId === pluginId ? snapshot.entries : [],
+ refresh,
+ }
}
diff --git a/src/renderer/routes/plugins/lib/audience.ts b/src/renderer/routes/plugins/lib/audience.ts
index aea62a4b..4110af28 100644
--- a/src/renderer/routes/plugins/lib/audience.ts
+++ b/src/renderer/routes/plugins/lib/audience.ts
@@ -1,6 +1,7 @@
import type { PluginListDTO } from '@shared/types/plugin'
import type { GrantsMap } from '@shared/types/plugin-install'
import type { TFunction } from 'i18next'
+import { pluginErrorTitleKey } from './plugin-error'
export type { GrantState, GrantsMap } from '@shared/types/plugin-install'
@@ -303,7 +304,14 @@ export function computePluginAudience(
return {
tone,
toneLabel: t(`plugins.tone.${tone}`),
- plain: t(plainKeyFor(tone, errored)),
+ plain: t(
+ tone === 'review' &&
+ errored &&
+ pluginErrorTitleKey(plugin.lastError) !==
+ 'plugins.detail.attentionTitle'
+ ? pluginErrorTitleKey(plugin.lastError)
+ : plainKeyFor(tone, errored)
+ ),
heroHeadline: t(heroFor(tone, errored)),
primaryAction: primaryFor(tone, errored, hasSettingsSchema, t),
}
diff --git a/src/renderer/routes/plugins/lib/plugin-error.ts b/src/renderer/routes/plugins/lib/plugin-error.ts
new file mode 100644
index 00000000..3807bde1
--- /dev/null
+++ b/src/renderer/routes/plugins/lib/plugin-error.ts
@@ -0,0 +1,16 @@
+/** Classify persisted error codes, including worker startup failures from older hosts. */
+export function pluginErrorTitleKey(error: string | undefined) {
+ if (
+ /^plugin\.runtime\.(worker_start_failed|boot_failed|activation_failed):/.test(
+ error ?? ''
+ ) ||
+ /^plugin\.runtime\.worker_crashed:.*Cannot find module.*quick-js-worker\.cjs/s.test(
+ error ?? ''
+ )
+ )
+ return 'plugins.detail.runtimeStartFailed'
+ if (/^plugin\.runtime\.(worker_crashed|worker_exited):/.test(error ?? '')) {
+ return 'plugins.detail.runtimeFailed'
+ }
+ return 'plugins.detail.attentionTitle'
+}
diff --git a/src/renderer/routes/plugins/plugin-detail-page.test.tsx b/src/renderer/routes/plugins/plugin-detail-page.test.tsx
index 7bb9df43..f342f9d6 100644
--- a/src/renderer/routes/plugins/plugin-detail-page.test.tsx
+++ b/src/renderer/routes/plugins/plugin-detail-page.test.tsx
@@ -282,7 +282,7 @@ describe('PluginDetailPage', () => {
expect(
screen.getByRole('combobox', { name: 'Log level' })
).toBeInTheDocument()
- expect(screen.getByText('Live output')).toBeInTheDocument()
+ expect(screen.getByText('Logs')).toBeInTheDocument()
expect(screen.getByText('0 entries')).toBeInTheDocument()
expect(
screen.getByRole('button', { name: 'Copy redacted logs' })
diff --git a/src/server/ipc/commands.ts b/src/server/ipc/commands.ts
index ccf9ab29..e3b81dee 100644
--- a/src/server/ipc/commands.ts
+++ b/src/server/ipc/commands.ts
@@ -1106,7 +1106,7 @@ export function buildServerCommandHandlers(
[Commands.ClearPluginLogs]: async (payload: unknown) => {
const parsed = z.object({ pluginId: z.string().min(1) }).parse(payload)
- capabilityHost.clearLog(parsed.pluginId)
+ await capabilityHost.clearLog(parsed.pluginId)
return { ok: true }
},
diff --git a/src/shared/lib/log-redact.ts b/src/shared/lib/log-redact.ts
index f56638fa..1871f567 100644
--- a/src/shared/lib/log-redact.ts
+++ b/src/shared/lib/log-redact.ts
@@ -139,6 +139,8 @@ function outputKey(
): string {
if (depth !== 0 || profile === 'export') return key
if (profile === 'plugin' && key === 'ts') return 'fieldTs'
+ if (profile === 'plugin' && key === 'entryId') return 'fieldEntryId'
+ if (profile === 'plugin' && key === 'logSequence') return 'fieldLogSequence'
return ROOT_LOG_FIELD_RENAMES.get(key) ?? key
}
diff --git a/src/shared/lib/plugin-log-order.test.ts b/src/shared/lib/plugin-log-order.test.ts
new file mode 100644
index 00000000..4a4ce50e
--- /dev/null
+++ b/src/shared/lib/plugin-log-order.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from 'vitest'
+import type { PluginLogEntry } from '../types/plugin'
+import { comparePluginLogs, pluginLogSequence } from './plugin-log-order'
+
+describe('plugin log ordering', () => {
+ const entry = (ts: number, logSequence?: unknown): PluginLogEntry => ({
+ ts,
+ logSequence,
+ level: 'info',
+ msg: 'test',
+ })
+ it('orders sequenced records by append order and leaves legacy records first', () => {
+ const legacy = entry(100)
+ const first = entry(200, 1)
+ const second = entry(50, 2)
+ expect([second, first, legacy].sort(comparePluginLogs)).toEqual([
+ legacy,
+ first,
+ second,
+ ])
+ })
+ it('falls back to timestamps for old records and ignores invalid sequence metadata', () => {
+ for (const value of [
+ -1,
+ 0,
+ NaN,
+ Infinity,
+ 1.5,
+ '1',
+ Number.MAX_SAFE_INTEGER + 1,
+ ])
+ expect(pluginLogSequence(entry(1, value))).toBeUndefined()
+ expect(
+ [entry(2), entry(1)].sort(comparePluginLogs).map((item) => item.ts)
+ ).toEqual([1, 2])
+ })
+})
diff --git a/src/shared/lib/plugin-log-order.ts b/src/shared/lib/plugin-log-order.ts
new file mode 100644
index 00000000..ddb0a7d6
--- /dev/null
+++ b/src/shared/lib/plugin-log-order.ts
@@ -0,0 +1,22 @@
+import type { PluginLogEntry } from '../types/plugin'
+
+export function pluginLogSequence(entry: PluginLogEntry): number | undefined {
+ const value = entry.logSequence
+ return typeof value === 'number' && Number.isSafeInteger(value) && value > 0
+ ? value
+ : undefined
+}
+
+/** Host sequence preserves append order across equal timestamps and clock changes. */
+export function comparePluginLogs(
+ a: PluginLogEntry,
+ b: PluginLogEntry
+): number {
+ const first = pluginLogSequence(a)
+ const second = pluginLogSequence(b)
+ if (first !== undefined && second !== undefined) return first - second
+ // Records from hosts predating sequence metadata precede newly captured logs.
+ if (first !== undefined) return 1
+ if (second !== undefined) return -1
+ return a.ts - b.ts
+}
diff --git a/src/shared/locales/ar.json b/src/shared/locales/ar.json
index 414f6d51..d9298405 100644
--- a/src/shared/locales/ar.json
+++ b/src/shared/locales/ar.json
@@ -1401,6 +1401,8 @@
"advanced": "متقدم",
"attentionGeneric": "راجع السجلات للتفاصيل.",
"attentionTitle": "أبلغت هذه الإضافة عن مشكلة",
+ "runtimeStartFailed": "تعذر بدء بيئة تشغيل الإضافة",
+ "runtimeFailed": "توقفت بيئة تشغيل الإضافة بشكل غير متوقع",
"author": "المؤلف",
"back": "كل الإضافات",
"disabled": "معطّلة",
@@ -1620,6 +1622,7 @@
"lead": "أضف ميزات صغيرة إلى Motrix. احتفظ بالإضافات التي تثق بها، وعطّل الباقي.",
"logs": {
"clear": "مسح",
+ "clearFailed": "تعذر مسح السجلات. حاول مرة أخرى.",
"copy": "نسخ السجلات بعد حجب البيانات الحساسة",
"empty": "لا توجد إدخالات في السجل بعد",
"emptyFiltered": "لا توجد إدخالات تطابق هذا المستوى.",
diff --git a/src/shared/locales/bg.json b/src/shared/locales/bg.json
index 8a4d36e6..b0e74624 100644
--- a/src/shared/locales/bg.json
+++ b/src/shared/locales/bg.json
@@ -1349,6 +1349,8 @@
"advanced": "Разширени",
"attentionGeneric": "Вижте журналите за подробности.",
"attentionTitle": "Тази приставка докладва проблем",
+ "runtimeStartFailed": "Средата за изпълнение на приставката не може да стартира",
+ "runtimeFailed": "Средата за изпълнение на приставката спря неочаквано",
"author": "Автор",
"back": "Всички приставки",
"disabled": "Изключена",
@@ -1552,6 +1554,7 @@
"lead": "Добавяйте малки функции към Motrix. Оставете включени приставките, на които имате доверие, и изключете останалите.",
"logs": {
"clear": "Изчистване",
+ "clearFailed": "Дневниците не могат да бъдат изчистени. Опитайте отново.",
"copy": "Копиране на обезличени логове",
"empty": "Все още няма записи в журнала",
"emptyFiltered": "Няма записи с това ниво.",
diff --git a/src/shared/locales/ca.json b/src/shared/locales/ca.json
index ae569616..3a4dbd22 100644
--- a/src/shared/locales/ca.json
+++ b/src/shared/locales/ca.json
@@ -1362,6 +1362,8 @@
"advanced": "Avançat",
"attentionGeneric": "Consulteu els registres per veure'n els detalls.",
"attentionTitle": "Aquest connector ha notificat un problema",
+ "runtimeStartFailed": "No s’ha pogut iniciar l’entorn d’execució del connector",
+ "runtimeFailed": "L’entorn d’execució del connector s’ha aturat inesperadament",
"author": "Autor",
"back": "Tots els connectors",
"disabled": "Desactivat",
@@ -1569,6 +1571,7 @@
"lead": "Afegiu petites funcions al Motrix. Manteniu els connectors de confiança i desactiveu la resta.",
"logs": {
"clear": "Esborrar",
+ "clearFailed": "No s’han pogut esborrar els registres. Torna-ho a provar.",
"copy": "Copia els registres amb dades ocultes",
"empty": "Encara no hi ha entrades al registre",
"emptyFiltered": "No hi ha entrades d'aquest nivell.",
diff --git a/src/shared/locales/de.json b/src/shared/locales/de.json
index 9358f17d..0d841d68 100644
--- a/src/shared/locales/de.json
+++ b/src/shared/locales/de.json
@@ -2432,6 +2432,8 @@
"accessHosts_other": "Kann {{count}} Websites lesen",
"accessBroad": "Kann jede Website lesen",
"attentionTitle": "Dieses Plugin hat ein Problem gemeldet",
+ "runtimeStartFailed": "Die Plugin-Laufzeitumgebung konnte nicht gestartet werden",
+ "runtimeFailed": "Die Plugin-Laufzeitumgebung wurde unerwartet beendet",
"attentionGeneric": "Weitere Informationen finden Sie in den Protokollen.",
"viewIssue": "Problem anzeigen",
"removeTitle": "Plugin entfernen",
@@ -2461,6 +2463,7 @@
},
"copy": "Bereinigte Protokolle kopieren",
"clear": "Leeren",
+ "clearFailed": "Die Protokolle konnten nicht gelöscht werden. Versuche es erneut.",
"output": "Live-Ausgabe",
"entryCount_one": "{{count}} Eintrag",
"entryCount_other": "{{count}} Einträge",
diff --git a/src/shared/locales/el.json b/src/shared/locales/el.json
index bbb831a0..db878d3c 100644
--- a/src/shared/locales/el.json
+++ b/src/shared/locales/el.json
@@ -1349,6 +1349,8 @@
"advanced": "Για προχωρημένους",
"attentionGeneric": "Δείτε τις καταγραφές για λεπτομέρειες.",
"attentionTitle": "Αυτό το πρόσθετο ανέφερε ένα πρόβλημα",
+ "runtimeStartFailed": "Δεν ήταν δυνατή η εκκίνηση του περιβάλλοντος εκτέλεσης της προσθήκης",
+ "runtimeFailed": "Το περιβάλλον εκτέλεσης της προσθήκης σταμάτησε απροσδόκητα",
"author": "Δημιουργός",
"back": "Όλα τα πρόσθετα",
"disabled": "Απενεργοποιημένο",
@@ -1552,6 +1554,7 @@
"lead": "Προσθέστε μικρές λειτουργίες στο Motrix. Κρατήστε όσες εμπιστεύεστε και απενεργοποιήστε τις υπόλοιπες.",
"logs": {
"clear": "Εκκαθάριση",
+ "clearFailed": "Δεν ήταν δυνατή η εκκαθάριση των αρχείων καταγραφής. Δοκιμάστε ξανά.",
"copy": "Αντιγραφή αρχείων καταγραφής με απόκρυψη στοιχείων",
"empty": "Δεν υπάρχουν ακόμη εγγραφές καταγραφής",
"emptyFiltered": "Δεν υπάρχουν εγγραφές που να αντιστοιχούν σε αυτό το επίπεδο.",
diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.json
index ae6777f9..254dabf2 100644
--- a/src/shared/locales/en-US.json
+++ b/src/shared/locales/en-US.json
@@ -2432,6 +2432,8 @@
"accessHosts_other": "Can read {{count}} websites",
"accessBroad": "Can read any website",
"attentionTitle": "This plugin reported a problem",
+ "runtimeStartFailed": "Plugin runtime could not start",
+ "runtimeFailed": "Plugin runtime stopped unexpectedly",
"attentionGeneric": "See logs for details.",
"viewIssue": "View issue",
"removeTitle": "Remove plugin",
@@ -2461,6 +2463,7 @@
},
"copy": "Copy redacted logs",
"clear": "Clear",
+ "clearFailed": "Couldn’t clear logs. Try again.",
"output": "Live output",
"entryCount_one": "{{count}} entry",
"entryCount_other": "{{count}} entries",
diff --git a/src/shared/locales/es.json b/src/shared/locales/es.json
index a7e789f9..e6dfbfd3 100644
--- a/src/shared/locales/es.json
+++ b/src/shared/locales/es.json
@@ -2447,6 +2447,8 @@
"accessHosts_other": "Puede leer {{count}} sitios web",
"accessBroad": "Puede leer cualquier sitio web",
"attentionTitle": "Este plugin notificó un problema",
+ "runtimeStartFailed": "No se pudo iniciar el entorno de ejecución del plugin",
+ "runtimeFailed": "El entorno de ejecución del plugin se detuvo inesperadamente",
"attentionGeneric": "Consulta los registros para ver los detalles.",
"viewIssue": "Ver problema",
"removeTitle": "Quitar plugin",
@@ -2478,6 +2480,7 @@
},
"copy": "Copiar registros censurados",
"clear": "Borrar",
+ "clearFailed": "No se pudieron borrar los registros. Inténtalo de nuevo.",
"output": "Salida en tiempo real",
"entryCount_one": "{{count}} entrada",
"entryCount_other": "{{count}} entradas",
diff --git a/src/shared/locales/fa.json b/src/shared/locales/fa.json
index fb161cdd..08e9c10c 100644
--- a/src/shared/locales/fa.json
+++ b/src/shared/locales/fa.json
@@ -1349,6 +1349,8 @@
"advanced": "پیشرفته",
"attentionGeneric": "برای جزئیات، گزارش‌ها را ببینید.",
"attentionTitle": "این افزونه مشکلی گزارش کرده است",
+ "runtimeStartFailed": "محیط اجرای افزونه راه‌اندازی نشد",
+ "runtimeFailed": "محیط اجرای افزونه به‌طور غیرمنتظره متوقف شد",
"author": "نویسنده",
"back": "همهٔ افزونه‌ها",
"disabled": "غیرفعال",
@@ -1552,6 +1554,7 @@
"lead": "قابلیت‌های کوچکی به Motrix اضافه کنید. افزونه‌های مورد اعتماد را نگه دارید و بقیه را خاموش کنید.",
"logs": {
"clear": "پاک کردن",
+ "clearFailed": "پاک کردن گزارش‌ها ممکن نشد. دوباره تلاش کنید.",
"copy": "کپی گزارش‌های پالایش‌شده",
"empty": "هنوز گزارشی ثبت نشده",
"emptyFiltered": "موردی با این سطح مطابقت ندارد.",
diff --git a/src/shared/locales/fr.json b/src/shared/locales/fr.json
index b49ba41b..b2962d81 100644
--- a/src/shared/locales/fr.json
+++ b/src/shared/locales/fr.json
@@ -1362,6 +1362,8 @@
"advanced": "Avancé",
"attentionGeneric": "Consultez les journaux pour plus de détails.",
"attentionTitle": "Cette extension a signalé un problème",
+ "runtimeStartFailed": "Impossible de démarrer l’environnement d’exécution de l’extension",
+ "runtimeFailed": "L’environnement d’exécution de l’extension s’est arrêté de manière inattendue",
"author": "Auteur",
"back": "Toutes les extensions",
"disabled": "Désactivée",
@@ -1569,6 +1571,7 @@
"lead": "Ajoutez des fonctionnalités à Motrix. Gardez les extensions de confiance et désactivez les autres.",
"logs": {
"clear": "Effacer",
+ "clearFailed": "Impossible d’effacer les journaux. Réessayez.",
"copy": "Copier les journaux expurgés",
"empty": "Aucune entrée dans le journal pour le moment",
"emptyFiltered": "Aucune entrée ne correspond à ce niveau.",
diff --git a/src/shared/locales/hu.json b/src/shared/locales/hu.json
index ce892770..312c5388 100644
--- a/src/shared/locales/hu.json
+++ b/src/shared/locales/hu.json
@@ -2432,6 +2432,8 @@
"accessHosts_other": "{{count}} webhelyet olvashat",
"accessBroad": "Bármely webhelyet olvashat",
"attentionTitle": "A bővítmény problémát jelzett",
+ "runtimeStartFailed": "A bővítmény futtatókörnyezete nem indítható el",
+ "runtimeFailed": "A bővítmény futtatókörnyezete váratlanul leállt",
"attentionGeneric": "A részleteket a naplókban találod.",
"viewIssue": "Probléma megtekintése",
"removeTitle": "Bővítmény eltávolítása",
@@ -2461,6 +2463,7 @@
},
"copy": "Kitakart naplók másolása",
"clear": "Törlés",
+ "clearFailed": "Nem sikerült törölni a naplókat. Próbáld újra.",
"output": "Élő napló",
"entryCount_one": "{{count}} bejegyzés",
"entryCount_other": "{{count}} bejegyzés",
diff --git a/src/shared/locales/id.json b/src/shared/locales/id.json
index ac1427d5..d026f337 100644
--- a/src/shared/locales/id.json
+++ b/src/shared/locales/id.json
@@ -2414,6 +2414,8 @@
"accessHosts_other": "Dapat membaca {{count}} situs web",
"accessBroad": "Dapat membaca situs web mana pun",
"attentionTitle": "Plugin ini melaporkan masalah",
+ "runtimeStartFailed": "Lingkungan eksekusi plugin tidak dapat dimulai",
+ "runtimeFailed": "Lingkungan eksekusi plugin berhenti secara tidak terduga",
"attentionGeneric": "Lihat log untuk detailnya.",
"viewIssue": "Lihat masalah",
"removeTitle": "Hapus plugin",
@@ -2443,6 +2445,7 @@
},
"copy": "Salin log tersamarkan",
"clear": "Hapus",
+ "clearFailed": "Tidak dapat menghapus log. Coba lagi.",
"output": "Keluaran langsung",
"entryCount_other": "{{count}} entri",
"empty": "Belum ada entri log",
diff --git a/src/shared/locales/it.json b/src/shared/locales/it.json
index 9c398c2e..ce6a9fc3 100644
--- a/src/shared/locales/it.json
+++ b/src/shared/locales/it.json
@@ -2450,6 +2450,8 @@
"accessHosts_many": "Può leggere {{count}} siti web",
"accessBroad": "Può leggere qualsiasi sito web",
"attentionTitle": "Questo plugin ha segnalato un problema",
+ "runtimeStartFailed": "Impossibile avviare l’ambiente di esecuzione del plugin",
+ "runtimeFailed": "L’ambiente di esecuzione del plugin si è arrestato in modo imprevisto",
"attentionGeneric": "Consulta i log per i dettagli.",
"viewIssue": "Visualizza problema",
"removeTitle": "Rimuovi plugin",
@@ -2479,6 +2481,7 @@
},
"copy": "Copia log oscurati",
"clear": "Cancella",
+ "clearFailed": "Impossibile cancellare i registri. Riprova.",
"output": "Output in tempo reale",
"entryCount_one": "{{count}} voce",
"entryCount_other": "{{count}} voci",
diff --git a/src/shared/locales/ja.json b/src/shared/locales/ja.json
index afbb538c..f24cb35b 100644
--- a/src/shared/locales/ja.json
+++ b/src/shared/locales/ja.json
@@ -2414,6 +2414,8 @@
"accessHosts_other": "{{count}} 件の Web サイトを読み取り可能",
"accessBroad": "すべての Web サイトを読み取り可能",
"attentionTitle": "このプラグインが問題を報告しました",
+ "runtimeStartFailed": "プラグインの実行環境を起動できませんでした",
+ "runtimeFailed": "プラグインの実行環境が予期せず停止しました",
"attentionGeneric": "詳細はログを確認してください。",
"viewIssue": "問題を表示",
"removeTitle": "プラグインを削除",
@@ -2443,6 +2445,7 @@
},
"copy": "機密情報を除いてログをコピー",
"clear": "クリア",
+ "clearFailed": "ログを消去できませんでした。もう一度お試しください。",
"output": "リアルタイム出力",
"entryCount_other": "{{count}} 件",
"empty": "ログはまだありません",
diff --git a/src/shared/locales/ko.json b/src/shared/locales/ko.json
index f8d2db9c..40174856 100644
--- a/src/shared/locales/ko.json
+++ b/src/shared/locales/ko.json
@@ -2414,6 +2414,8 @@
"accessHosts_other": "웹사이트 {{count}}개 읽기 가능",
"accessBroad": "모든 웹사이트 읽기 가능",
"attentionTitle": "이 플러그인이 문제를 보고했습니다",
+ "runtimeStartFailed": "플러그인 실행 환경을 시작할 수 없습니다",
+ "runtimeFailed": "플러그인 실행 환경이 예기치 않게 중지되었습니다",
"attentionGeneric": "자세한 내용은 로그를 확인하세요.",
"viewIssue": "문제 보기",
"removeTitle": "플러그인 제거",
@@ -2443,6 +2445,7 @@
},
"copy": "민감 정보를 가린 로그 복사",
"clear": "지우기",
+ "clearFailed": "로그를 지울 수 없습니다. 다시 시도하세요.",
"output": "실시간 출력",
"entryCount_other": "항목 {{count}}개",
"empty": "아직 로그 항목이 없습니다",
diff --git a/src/shared/locales/nb.json b/src/shared/locales/nb.json
index 553938ce..3245337b 100644
--- a/src/shared/locales/nb.json
+++ b/src/shared/locales/nb.json
@@ -1349,6 +1349,8 @@
"advanced": "Avansert",
"attentionGeneric": "Se loggene for detaljer.",
"attentionTitle": "Dette programtillegget rapporterte et problem",
+ "runtimeStartFailed": "Kjøremiljøet for programtillegget kunne ikke starte",
+ "runtimeFailed": "Kjøremiljøet for programtillegget stoppet uventet",
"author": "Utvikler",
"back": "Alle programtillegg",
"disabled": "Deaktivert",
@@ -1552,6 +1554,7 @@
"lead": "Legg til små funksjoner i Motrix. Behold dem du stoler på, og slå av resten.",
"logs": {
"clear": "Tøm",
+ "clearFailed": "Kunne ikke tømme loggene. Prøv igjen.",
"copy": "Kopier sladdede logger",
"empty": "Ingen loggoppføringer ennå",
"emptyFiltered": "Ingen oppføringer samsvarer med dette nivået.",
diff --git a/src/shared/locales/nl.json b/src/shared/locales/nl.json
index f99f5d5a..c15cc921 100644
--- a/src/shared/locales/nl.json
+++ b/src/shared/locales/nl.json
@@ -1349,6 +1349,8 @@
"advanced": "Geavanceerd",
"attentionGeneric": "Bekijk de logboeken voor details.",
"attentionTitle": "Deze plug-in heeft een probleem gemeld",
+ "runtimeStartFailed": "De uitvoeromgeving van de plug-in kon niet starten",
+ "runtimeFailed": "De uitvoeromgeving van de plug-in is onverwacht gestopt",
"author": "Auteur",
"back": "Alle plug-ins",
"disabled": "Uitgeschakeld",
@@ -1552,6 +1554,7 @@
"lead": "Voeg kleine functies toe aan Motrix. Laat de plug-ins die je vertrouwt ingeschakeld en schakel de rest uit.",
"logs": {
"clear": "Wissen",
+ "clearFailed": "De logboeken konden niet worden gewist. Probeer het opnieuw.",
"copy": "Geredigeerde logboeken kopiëren",
"empty": "Nog geen logboekvermeldingen",
"emptyFiltered": "Geen vermeldingen op dit niveau.",
diff --git a/src/shared/locales/pl.json b/src/shared/locales/pl.json
index 703aba26..bd80b9c6 100644
--- a/src/shared/locales/pl.json
+++ b/src/shared/locales/pl.json
@@ -2468,6 +2468,8 @@
"accessHosts_many": "Może odczytywać {{count}} witryn",
"accessBroad": "Może odczytywać dowolną witrynę",
"attentionTitle": "Ta wtyczka zgłosiła problem",
+ "runtimeStartFailed": "Nie można uruchomić środowiska wykonawczego wtyczki",
+ "runtimeFailed": "Środowisko wykonawcze wtyczki niespodziewanie się zatrzymało",
"attentionGeneric": "Szczegóły znajdziesz w dziennikach.",
"viewIssue": "Zobacz problem",
"removeTitle": "Usuń wtyczkę",
@@ -2497,6 +2499,7 @@
},
"copy": "Kopiuj logi z ukrytymi danymi",
"clear": "Wyczyść",
+ "clearFailed": "Nie udało się wyczyścić dzienników. Spróbuj ponownie.",
"output": "Bieżące wpisy",
"entryCount_one": "{{count}} wpis",
"entryCount_other": "{{count}} wpisu",
diff --git a/src/shared/locales/pt-BR.json b/src/shared/locales/pt-BR.json
index 2e68934b..7fcecd22 100644
--- a/src/shared/locales/pt-BR.json
+++ b/src/shared/locales/pt-BR.json
@@ -2450,6 +2450,8 @@
"accessHosts_many": "Pode ler {{count}} sites",
"accessBroad": "Pode ler qualquer site",
"attentionTitle": "Este plugin relatou um problema",
+ "runtimeStartFailed": "Não foi possível iniciar o ambiente de execução do plugin",
+ "runtimeFailed": "O ambiente de execução do plugin parou inesperadamente",
"attentionGeneric": "Veja os logs para mais detalhes.",
"viewIssue": "Ver problema",
"removeTitle": "Remover plugin",
@@ -2479,6 +2481,7 @@
},
"copy": "Copiar logs com dados ocultos",
"clear": "Limpar",
+ "clearFailed": "Não foi possível limpar os registros. Tente novamente.",
"output": "Saída em tempo real",
"entryCount_one": "{{count}} registro",
"entryCount_other": "{{count}} registros",
diff --git a/src/shared/locales/ro.json b/src/shared/locales/ro.json
index 5e95f612..70225add 100644
--- a/src/shared/locales/ro.json
+++ b/src/shared/locales/ro.json
@@ -1362,6 +1362,8 @@
"advanced": "Avansat",
"attentionGeneric": "Consultă jurnalele pentru detalii.",
"attentionTitle": "Acest modul a raportat o problemă",
+ "runtimeStartFailed": "Mediul de execuție al extensiei nu a putut porni",
+ "runtimeFailed": "Mediul de execuție al extensiei s-a oprit neașteptat",
"author": "Autor",
"back": "Toate modulele",
"disabled": "Dezactivat",
@@ -1569,6 +1571,7 @@
"lead": "Adaugă funcții mici în Motrix. Păstrează active modulele în care ai încredere și dezactivează-le pe celelalte.",
"logs": {
"clear": "Șterge",
+ "clearFailed": "Jurnalele nu au putut fi șterse. Încearcă din nou.",
"copy": "Copiază jurnalele cu date mascate",
"empty": "Încă nu există înregistrări în jurnal",
"emptyFiltered": "Nicio înregistrare nu corespunde acestui nivel.",
diff --git a/src/shared/locales/ru.json b/src/shared/locales/ru.json
index c41da2dd..c2a47b46 100644
--- a/src/shared/locales/ru.json
+++ b/src/shared/locales/ru.json
@@ -2468,6 +2468,8 @@
"accessHosts_many": "Может читать {{count}} веб-сайтов",
"accessBroad": "Может читать любой веб-сайт",
"attentionTitle": "Этот плагин сообщил о проблеме",
+ "runtimeStartFailed": "Не удалось запустить среду выполнения плагина",
+ "runtimeFailed": "Среда выполнения плагина неожиданно остановилась",
"attentionGeneric": "Подробности в журналах.",
"viewIssue": "Посмотреть проблему",
"removeTitle": "Удаление плагина",
@@ -2497,6 +2499,7 @@
},
"copy": "Копировать логи со скрытыми данными",
"clear": "Очистить",
+ "clearFailed": "Не удалось очистить журналы. Попробуйте снова.",
"output": "Вывод в реальном времени",
"entryCount_one": "{{count}} запись",
"entryCount_other": "{{count}} записи",
diff --git a/src/shared/locales/th.json b/src/shared/locales/th.json
index adb391db..9a8b57dd 100644
--- a/src/shared/locales/th.json
+++ b/src/shared/locales/th.json
@@ -1336,6 +1336,8 @@
"advanced": "ขั้นสูง",
"attentionGeneric": "ดูรายละเอียดในบันทึก",
"attentionTitle": "ปลั๊กอินนี้รายงานปัญหา",
+ "runtimeStartFailed": "ไม่สามารถเริ่มสภาพแวดล้อมการทำงานของปลั๊กอินได้",
+ "runtimeFailed": "สภาพแวดล้อมการทำงานของปลั๊กอินหยุดทำงานโดยไม่คาดคิด",
"author": "ผู้เขียน",
"back": "ปลั๊กอินทั้งหมด",
"disabled": "ปิดใช้",
@@ -1535,6 +1537,7 @@
"lead": "เพิ่มความสามารถเล็กๆ ให้ Motrix เปิดใช้เฉพาะปลั๊กอินที่เชื่อถือและปิดที่เหลือ",
"logs": {
"clear": "ล้าง",
+ "clearFailed": "ไม่สามารถล้างบันทึกได้ โปรดลองอีกครั้ง",
"copy": "คัดลอกบันทึกที่ปกปิดข้อมูลแล้ว",
"empty": "ยังไม่มีรายการบันทึก",
"emptyFiltered": "ไม่มีรายการตรงกับระดับนี้",
diff --git a/src/shared/locales/tr.json b/src/shared/locales/tr.json
index 0cc29b4d..359cf510 100644
--- a/src/shared/locales/tr.json
+++ b/src/shared/locales/tr.json
@@ -2432,6 +2432,8 @@
"accessHosts_other": "{{count}} web sitesini okuyabilir",
"accessBroad": "Herhangi bir web sitesini okuyabilir",
"attentionTitle": "Bu eklenti bir sorun bildirdi",
+ "runtimeStartFailed": "Eklenti çalışma ortamı başlatılamadı",
+ "runtimeFailed": "Eklenti çalışma ortamı beklenmedik şekilde durdu",
"attentionGeneric": "Ayrıntılar için günlüklere bakın.",
"viewIssue": "Sorunu görüntüle",
"removeTitle": "Eklentiyi kaldır",
@@ -2461,6 +2463,7 @@
},
"copy": "Hassas verileri gizlenmiş günlükleri kopyala",
"clear": "Temizle",
+ "clearFailed": "Günlükler temizlenemedi. Tekrar deneyin.",
"output": "Canlı çıktı",
"entryCount_one": "{{count}} kayıt",
"entryCount_other": "{{count}} kayıt",
diff --git a/src/shared/locales/uk.json b/src/shared/locales/uk.json
index 487ec25b..9bff664c 100644
--- a/src/shared/locales/uk.json
+++ b/src/shared/locales/uk.json
@@ -1375,6 +1375,8 @@
"advanced": "Додатково",
"attentionGeneric": "Подробиці дивіться в журналах.",
"attentionTitle": "Цей плагін повідомив про проблему",
+ "runtimeStartFailed": "Не вдалося запустити середовище виконання плагіна",
+ "runtimeFailed": "Середовище виконання плагіна несподівано зупинилося",
"author": "Автор",
"back": "Усі плагіни",
"disabled": "Вимкнено",
@@ -1586,6 +1588,7 @@
"lead": "Додавайте невеликі можливості до Motrix. Залишайте довірені плагіни, решту вимикайте.",
"logs": {
"clear": "Очистити",
+ "clearFailed": "Не вдалося очистити журнали. Спробуйте ще раз.",
"copy": "Копіювати журнали з прихованими даними",
"empty": "У журналі ще немає записів",
"emptyFiltered": "Немає записів цього рівня.",
diff --git a/src/shared/locales/vi.json b/src/shared/locales/vi.json
index fcb53fc9..a575f2a2 100644
--- a/src/shared/locales/vi.json
+++ b/src/shared/locales/vi.json
@@ -2414,6 +2414,8 @@
"accessHosts_other": "Có thể đọc {{count}} trang web",
"accessBroad": "Có thể đọc mọi trang web",
"attentionTitle": "Tiện ích này đã báo cáo sự cố",
+ "runtimeStartFailed": "Không thể khởi động môi trường chạy tiện ích",
+ "runtimeFailed": "Môi trường chạy tiện ích đã dừng đột ngột",
"attentionGeneric": "Xem chi tiết trong nhật ký.",
"viewIssue": "Xem sự cố",
"removeTitle": "Gỡ tiện ích",
@@ -2443,6 +2445,7 @@
},
"copy": "Sao chép nhật ký đã che dữ liệu",
"clear": "Xóa",
+ "clearFailed": "Không thể xóa nhật ký. Hãy thử lại.",
"output": "Đầu ra trực tiếp",
"entryCount_other": "{{count}} mục",
"empty": "Chưa có mục nhật ký",
diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.json
index 206fa18e..f3111328 100644
--- a/src/shared/locales/zh-CN.json
+++ b/src/shared/locales/zh-CN.json
@@ -2414,6 +2414,8 @@
"accessHosts_other": "读取 {{count}} 个网站",
"accessBroad": "可读取任意网站",
"attentionTitle": "该插件报告了一个问题",
+ "runtimeStartFailed": "插件运行环境无法启动",
+ "runtimeFailed": "插件运行环境意外停止",
"attentionGeneric": "请查看日志了解详情。",
"viewIssue": "查看错误",
"removeTitle": "移除插件",
@@ -2443,6 +2445,7 @@
},
"copy": "复制脱敏日志",
"clear": "清空",
+ "clearFailed": "无法清空日志,请重试。",
"output": "实时输出",
"entryCount_other": "{{count}} 条日志",
"empty": "暂无日志条目",
diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.json
index ce28674c..b8dbc506 100644
--- a/src/shared/locales/zh-TW.json
+++ b/src/shared/locales/zh-TW.json
@@ -2518,6 +2518,8 @@
"accessHosts_other": "可讀取 {{count}} 個網站",
"accessBroad": "可讀取任何網站",
"attentionTitle": "此外掛程式回報問題",
+ "runtimeStartFailed": "外掛執行環境無法啟動",
+ "runtimeFailed": "外掛執行環境意外停止",
"attentionGeneric": "請查看日誌以瞭解詳細資料。",
"viewIssue": "檢視問題",
"removeTitle": "移除外掛程式",
@@ -2547,6 +2549,7 @@
},
"copy": "複製已遮蔽的日誌",
"clear": "清除",
+ "clearFailed": "無法清空日誌,請重試。",
"output": "即時輸出",
"entryCount_other": "{{count}} 筆項目",
"empty": "尚無日誌項目",