dsh-mcviseron-plugin 0.7.2 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcviseron-plugin",
3
- "version": "0.7.2",
3
+ "version": "0.7.8",
4
4
  "description": "DeepSeek Harness (DSH) master plugin — one package hosting MCviseron's DSH components as separate bundle entries: a time-based light/dark Appearance schedule, an Auto-review fix (shutdown preset guard + Chinese approval-reason translation), and a todo plan guard that keeps multi-stage work advancing, one-shot after-session restart/close actions with task-aware waiting, and automatic auth-cookie hygiene for repeated desktop restarts, and model-editable official automation tasks.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -78,7 +78,7 @@
78
78
  "scripts": {
79
79
  "build": "node build.mjs",
80
80
  "typecheck": "tsc --noEmit",
81
- "test": "node --experimental-strip-types test/schedule.test.ts && node --experimental-strip-types test/routes.test.ts && node --experimental-strip-types test/config.test.ts && node --experimental-strip-types test/auto-review-fix.test.ts && node --experimental-strip-types test/auto-review-fix-cordis.test.ts && node --experimental-strip-types test/review-context.test.ts && node --experimental-strip-types test/global-notice.test.ts && node --experimental-strip-types test/task-guard.test.ts && node --experimental-strip-types test/task-guard-cordis.test.ts && node --experimental-strip-types test/session-end.test.ts && node --experimental-strip-types test/auth-cookie.test.ts && node --experimental-strip-types test/automation-tasks.test.ts && node --experimental-strip-types test/restart.test.ts && node --experimental-strip-types test/plugin.test.ts",
81
+ "test": "node --experimental-strip-types test/schedule.test.ts && node --experimental-strip-types test/routes.test.ts && node --experimental-strip-types test/config.test.ts && node --experimental-strip-types test/auto-review-fix.test.ts && node --experimental-strip-types test/auto-review-fix-cordis.test.ts && node --experimental-strip-types test/review-context.test.ts && node --experimental-strip-types test/global-notice.test.ts && node --experimental-strip-types test/task-guard.test.ts && node --experimental-strip-types test/task-guard-cordis.test.ts && node --experimental-strip-types test/session-end.test.ts && node --experimental-strip-types test/auth-cookie.test.ts && node --experimental-strip-types test/automation-tasks.test.ts && node --experimental-strip-types test/archive-integration.test.ts && node --experimental-strip-types test/restart.test.ts && node --experimental-strip-types test/plugin.test.ts",
82
82
  "check": "pnpm typecheck && pnpm test && pnpm build",
83
83
  "prepare": "pnpm build",
84
84
  "prepublishOnly": "pnpm check",
@@ -86,12 +86,12 @@
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@deepseek-ai/cordis": "^4.0.1",
89
- "@deepseek-ai/dsh-client-connection": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1",
90
- "@deepseek-ai/dsh-client-locale": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1",
91
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1",
92
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1",
93
- "@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1",
94
- "@deepseek-ai/dsh-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1",
89
+ "@deepseek-ai/dsh-client-connection": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1 || ^0.2.2-rc.3 || ^0.2.2-rc.5",
90
+ "@deepseek-ai/dsh-client-locale": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1 || ^0.2.2-rc.3 || ^0.2.2-rc.5",
91
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1 || ^0.2.2-rc.3 || ^0.2.2-rc.5",
92
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1 || ^0.2.2-rc.3 || ^0.2.2-rc.5",
93
+ "@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1 || ^0.2.2-rc.3 || ^0.2.2-rc.5",
94
+ "@deepseek-ai/dsh-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.1-rc.3 || ^0.2.1-rc.5 || ^0.2.2-rc.1 || ^0.2.2-rc.3 || ^0.2.2-rc.5",
95
95
  "react": "^18.2.0",
96
96
  "react-dom": "^18.2.0"
97
97
  },
@@ -129,21 +129,22 @@
129
129
  "@deepseek-ai/cordis-plugin-group": "^1.1.0",
130
130
  "@deepseek-ai/cordis-plugin-include": "^1.1.0",
131
131
  "@deepseek-ai/cordis-plugin-loader": "^1.1.0",
132
- "@deepseek-ai/dsh-app-boot": "^0.2.2-rc.1",
133
- "@deepseek-ai/dsh-brand": "^0.2.2-rc.1",
134
- "@deepseek-ai/dsh-client-connection": "^0.2.2-rc.1",
135
- "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.1",
136
- "@deepseek-ai/dsh-client-store": "^0.2.2-rc.1",
137
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.1",
138
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.1",
139
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.1",
140
- "@deepseek-ai/dsh-config-editor": "^0.2.2-rc.1",
141
- "@deepseek-ai/dsh-home-paths": "^0.2.2-rc.1",
142
- "@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.1",
143
- "@deepseek-ai/dsh-launch-environment": "^0.2.2-rc.1",
144
- "@deepseek-ai/dsh-scope": "^0.2.2-rc.1",
145
- "@deepseek-ai/dsh-session": "^0.2.2-rc.1",
146
- "@deepseek-ai/dsh-settings": "^0.2.2-rc.1",
132
+ "@deepseek-ai/dsh-app-boot": "^0.2.2-rc.5",
133
+ "@deepseek-ai/dsh-brand": "^0.2.2-rc.5",
134
+ "@deepseek-ai/dsh-client-connection": "^0.2.2-rc.5",
135
+ "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.5",
136
+ "@deepseek-ai/dsh-client-store": "^0.2.2-rc.5",
137
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.5",
138
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.5",
139
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.5",
140
+ "@deepseek-ai/dsh-config-editor": "^0.2.2-rc.5",
141
+ "@deepseek-ai/dsh-error": "^0.2.2-rc.5",
142
+ "@deepseek-ai/dsh-home-paths": "^0.2.2-rc.5",
143
+ "@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.5",
144
+ "@deepseek-ai/dsh-launch-environment": "^0.2.2-rc.5",
145
+ "@deepseek-ai/dsh-scope": "^0.2.2-rc.5",
146
+ "@deepseek-ai/dsh-session": "^0.2.2-rc.5",
147
+ "@deepseek-ai/dsh-settings": "^0.2.2-rc.5",
147
148
  "@deepseek-ai/schemastery": "^3.19.0",
148
149
  "@types/node": "^22.20.0",
149
150
  "@types/nodemailer": "^6.4.15",
package/src/api.ts CHANGED
@@ -15,3 +15,8 @@ export const SESSION_END_API = {
15
15
  export const AUTH_COOKIE_API = {
16
16
  prune: '/api/dsh-mcviseron/auth-cookies/prune',
17
17
  } as const
18
+
19
+ /** Optional third-party archive-plugin integration. */
20
+ export const ARCHIVE_API = {
21
+ status: '/api/dsh-mcviseron/archive-integration/status',
22
+ } as const
@@ -0,0 +1,83 @@
1
+ import { existsSync, readFileSync } from 'node:fs'
2
+ import { homedir } from 'node:os'
3
+ import { join } from 'node:path'
4
+ import type { Context } from '@deepseek-ai/cordis'
5
+ import { ARCHIVE_API } from '../api.ts'
6
+ import { isLoopbackRequest } from '../loopback.ts'
7
+
8
+ interface Ledger { version?: unknown; entries?: Record<string, { archivedAt?: unknown; source?: unknown }> }
9
+ interface ArchiveEntry { options?: { name?: unknown }; disabled?: boolean; fiber?: unknown }
10
+
11
+ function dshHome(): string {
12
+ const raw = process.env.DSH_HOME
13
+ if (raw !== undefined && raw.trim() !== '') return raw.trim().startsWith('~') ? join(homedir(), raw.trim().slice(1).replace(/^[\\/]/, '')) : raw.trim()
14
+ return join(homedir(), '.dsh')
15
+ }
16
+
17
+ function archiveAvailable(ctx: Context): boolean {
18
+ try {
19
+ const loader = (ctx as unknown as { loader?: { entries?: () => Iterable<ArchiveEntry> } }).loader
20
+ for (const entry of loader?.entries?.() ?? []) {
21
+ const name = String(entry.options?.name ?? '')
22
+ if (name.includes('session-archive') && entry.disabled !== true && entry.fiber !== undefined && entry.fiber !== null) return true
23
+ }
24
+ } catch { /* no loader */ }
25
+ return false
26
+ }
27
+
28
+ function archivedIds(ctx: Context): string[] {
29
+ try {
30
+ const registry = (ctx as unknown as { get?: (name: string) => unknown }).get?.('workspaceRegistry') as { archivedSessionIds?: unknown } | undefined
31
+ const value = registry?.archivedSessionIds
32
+ return Array.isArray(value) ? value.filter((id): id is string => typeof id === 'string' && id.length > 0) : []
33
+ } catch {
34
+ return []
35
+ }
36
+ }
37
+
38
+ export function makeArchiveStatus(ctx: Context): Record<string, unknown> {
39
+ const available = archiveAvailable(ctx)
40
+ const ledgerPath = join(dshHome(), 'dsh-session-archive', 'archive-ledger.json')
41
+ let ledger: Ledger | undefined
42
+ try { ledger = JSON.parse(readFileSync(ledgerPath, 'utf8')) as Ledger } catch { ledger = undefined }
43
+ const entries = ledger?.entries !== null && typeof ledger?.entries === 'object' ? ledger.entries : {}
44
+ const ids = archivedIds(ctx)
45
+ let observed = 0
46
+ let manual = 0
47
+ for (const entry of Object.values(entries)) {
48
+ if (entry.source === 'observed') observed++
49
+ else if (entry.source === 'manual') manual++
50
+ }
51
+ let unknown = 0
52
+ for (const id of ids) if (entries[id] === undefined) unknown++
53
+ return {
54
+ ok: true,
55
+ available,
56
+ ledgerPath,
57
+ ledgerExists: existsSync(ledgerPath),
58
+ entries: Object.keys(entries).length,
59
+ observed,
60
+ manual,
61
+ archivedCount: ids.length,
62
+ unknownCount: unknown,
63
+ }
64
+ }
65
+
66
+ export const inject = ['webServer']
67
+
68
+ export function apply(ctx: Context): void {
69
+ ctx.effect(() => ctx.webServer.register({
70
+ kind: 'exact',
71
+ path: ARCHIVE_API.status,
72
+ handler: async (req, res): Promise<void> => {
73
+ const send = (status: number, value: unknown): void => {
74
+ res.statusCode = status
75
+ res.setHeader('content-type', 'application/json; charset=utf-8')
76
+ res.end(JSON.stringify(value))
77
+ }
78
+ if (req.method !== 'GET' && req.method !== 'POST') return send(405, { ok: false, error: 'method-not-allowed' })
79
+ if (!isLoopbackRequest(req)) return send(403, { ok: false, error: 'forbidden' })
80
+ try { send(200, makeArchiveStatus(ctx)) } catch (error) { send(500, { ok: false, error: error instanceof Error ? error.message : String(error) }) }
81
+ },
82
+ }), 'mcviseron: archive integration status')
83
+ }
@@ -16,8 +16,8 @@ export const DEFAULT_AUTO_REVIEW_CONFIG = {
16
16
  translateProvider: '',
17
17
  translateModel: '',
18
18
  reviewContextGuard: true,
19
- reviewMaxHistoryChars: 120000,
20
- reviewKeepRecentEntries: 16,
19
+ reviewMaxHistoryChars: 200000,
20
+ reviewKeepRecentEntries: 32,
21
21
  } as const
22
22
 
23
23
  export const Config = z.object({
@@ -21,10 +21,11 @@ interface ScheduleRecord {
21
21
  }
22
22
 
23
23
  interface ScheduleService {
24
- list(filter: { sessionId: string }): Promise<ScheduleRecord[]>
25
- create(sessionId: string, input: Record<string, unknown>, signal?: AbortSignal): Promise<ScheduleRecord>
26
- update(input: Record<string, unknown>, signal?: AbortSignal): Promise<Record<string, unknown>>
27
- delete(input: Record<string, unknown>, signal?: AbortSignal): Promise<Record<string, unknown>>
24
+ list(filter?: Record<string, unknown>): Promise<ScheduleRecord[] | { items: ScheduleRecord[] }>
25
+ create(...args: any[]): Promise<ScheduleRecord>
26
+ update?(...args: any[]): Promise<Record<string, unknown>>
27
+ delete?(...args: any[]): Promise<Record<string, unknown>>
28
+ edit?(...args: any[]): Promise<Record<string, unknown>>
28
29
  }
29
30
 
30
31
  interface ToolExecution {
@@ -61,6 +62,25 @@ function log(message: string): void {
61
62
  }
62
63
  }
63
64
 
65
+ function isModernSchedule(schedule: ScheduleService): boolean {
66
+ return typeof schedule.edit === 'function'
67
+ }
68
+
69
+ function modernTiming(args: Record<string, unknown>): Record<string, unknown> | undefined {
70
+ if (args.after_seconds !== undefined) return { kind: 'after', after_seconds: args.after_seconds }
71
+ if (args.at !== undefined) return { kind: 'at', at: args.at }
72
+ if (args.every_seconds !== undefined) return { kind: 'every', every_seconds: args.every_seconds }
73
+ if (args.daily !== undefined) return { kind: 'daily', daily: args.daily }
74
+ if (args.weekly !== undefined) return { kind: 'weekly', weekly: args.weekly }
75
+ if (args.cron !== undefined) return { kind: 'cron', cron: args.cron }
76
+ if (args.rrule !== undefined) return { kind: 'rrule', rrule: args.rrule }
77
+ return undefined
78
+ }
79
+
80
+ function listRecords(result: ScheduleRecord[] | { items: ScheduleRecord[] }): ScheduleRecord[] {
81
+ return Array.isArray(result) ? result : result.items
82
+ }
83
+
64
84
  function sessionIdOf(exec: ToolExecution): string {
65
85
  const id = exec.agent?.session?.id
66
86
  return typeof id === 'string' ? id : ''
@@ -189,7 +209,7 @@ export function makeAutomationTaskTools(schedule: ScheduleService): ToolDefiniti
189
209
  const sessionId = sessionIdOf(exec)
190
210
  if (sessionId === '') return { ok: false, code: 'no_session', error: 'no current session' }
191
211
  try {
192
- return { ok: true, tasks: await schedule.list({ sessionId }) }
212
+ return { ok: true, tasks: listRecords(await schedule.list(isModernSchedule(schedule) ? {} : { sessionId })) }
193
213
  } catch (error) {
194
214
  return serviceFailure(error)
195
215
  }
@@ -206,11 +226,23 @@ export function makeAutomationTaskTools(schedule: ScheduleService): ToolDefiniti
206
226
  const invalidInput = validateCreate(args)
207
227
  if (invalidInput !== undefined) return invalid(invalidInput)
208
228
  try {
209
- const record = await schedule.create(sessionId, {
210
- ...args,
211
- title: String(args.title).trim(),
212
- prompt: String(args.prompt).trim(),
213
- }, exec.signal)
229
+ let record: ScheduleRecord
230
+ if (isModernSchedule(schedule)) {
231
+ const timing = modernTiming(args)
232
+ if (timing === undefined) return invalid('timing is required')
233
+ record = await schedule.create({
234
+ title: String(args.title).trim(),
235
+ prompt: String(args.prompt).trim(),
236
+ timing,
237
+ target: { kind: 'session', sessionId },
238
+ }, sessionId, exec.signal)
239
+ } else {
240
+ record = await schedule.create(sessionId, {
241
+ ...args,
242
+ title: String(args.title).trim(),
243
+ prompt: String(args.prompt).trim(),
244
+ }, exec.signal)
245
+ }
214
246
  return { ok: true, task: record }
215
247
  } catch (error) {
216
248
  return serviceFailure(error)
@@ -229,10 +261,19 @@ export function makeAutomationTaskTools(schedule: ScheduleService): ToolDefiniti
229
261
  if (invalidInput !== undefined) return invalid(invalidInput)
230
262
  try {
231
263
  const id = String(args.id)
232
- const expected = (await schedule.list({ sessionId })).find(record => record.id === id)
233
- if (expected === undefined) return { ok: false, code: 'schedule_not_found', error: 'automation task not found in this session: ' + id }
264
+ const expected = listRecords(await schedule.list(isModernSchedule(schedule) ? {} : { sessionId })).find(record => record.id === id)
265
+ if (expected === undefined) return { ok: false, code: 'schedule_not_found', error: 'automation task not found: ' + id }
234
266
  const change = timingChange(args)
235
- const result = await schedule.update({
267
+ if (isModernSchedule(schedule)) {
268
+ const patch: Record<string, unknown> = {}
269
+ if (args.title !== undefined) patch.title = String(args.title).trim()
270
+ if (args.prompt !== undefined) patch.prompt = String(args.prompt).trim()
271
+ const timing = modernTiming(args)
272
+ if (timing !== undefined) patch.timing = timing
273
+ const result = await schedule.edit!({ id, action: 'update', patch }, sessionId, exec.signal)
274
+ return { ok: true, task: result }
275
+ }
276
+ const result = await schedule.update!({
236
277
  sessionId,
237
278
  id,
238
279
  expected,
@@ -259,7 +300,11 @@ export function makeAutomationTaskTools(schedule: ScheduleService): ToolDefiniti
259
300
  return invalid('id must be a non-empty string without surrounding whitespace')
260
301
  }
261
302
  try {
262
- const result = await schedule.delete({ sessionId, id: String(args.id) }, exec.signal)
303
+ if (isModernSchedule(schedule)) {
304
+ const result = await schedule.edit!({ id: String(args.id), action: 'delete' }, sessionId, exec.signal)
305
+ return { ok: true, ...result }
306
+ }
307
+ const result = await schedule.delete!({ sessionId, id: String(args.id) }, exec.signal)
263
308
  return { ok: true, ...result }
264
309
  } catch (error) {
265
310
  return serviceFailure(error)
@@ -1,10 +1,22 @@
1
- import { useState } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import type { McviseronKey } from './locales.ts'
3
+ import { ARCHIVE_API } from '../api.ts'
3
4
  import { AUTO_REVIEW_FIELDS, ConfigForm, SESSION_END_FIELDS, TASK_GUARD_FIELDS } from './ConfigForm.tsx'
4
5
  import { RestartCard } from './RestartCard.tsx'
5
6
  import { pageStyles } from './styles.ts'
6
7
 
7
- type Tab = 'restart' | 'autoReview' | 'taskGuard' | 'sessionEnd' | 'components'
8
+ type Tab = 'restart' | 'autoReview' | 'taskGuard' | 'sessionEnd' | 'archive' | 'components'
9
+
10
+ interface ArchiveStatus {
11
+ available: boolean
12
+ ledgerPath: string
13
+ ledgerExists: boolean
14
+ entries: number
15
+ observed: number
16
+ manual: number
17
+ archivedCount: number
18
+ unknownCount: number
19
+ }
8
20
 
9
21
  /** Props composed by the `settings.section` slot. */
10
22
  export interface SettingsSectionProps {
@@ -19,6 +31,31 @@ export interface SettingsSectionProps {
19
31
  */
20
32
  export function SettingsSection({ t }: SettingsSectionProps) {
21
33
  const [tab, setTab] = useState<Tab>('restart')
34
+ const [archive, setArchive] = useState<ArchiveStatus | null>(null)
35
+
36
+ const loadArchive = async (): Promise<void> => {
37
+ try {
38
+ const response = await fetch(ARCHIVE_API.status, { credentials: 'same-origin', cache: 'no-store' })
39
+ if (!response.ok) { setArchive(null); return }
40
+ const value = await response.json() as ArchiveStatus
41
+ if (value.available) {
42
+ try {
43
+ const inventoryResponse = await fetch('/api/dsh-session-archive/inventory', { credentials: 'same-origin', cache: 'no-store' })
44
+ if (inventoryResponse.ok) {
45
+ const inventory = await inventoryResponse.json() as { rows?: Array<{ archived?: boolean; archivedAt?: number }> }
46
+ const rows = Array.isArray(inventory.rows) ? inventory.rows : []
47
+ value.archivedCount = rows.filter(row => row.archived === true).length
48
+ value.unknownCount = rows.filter(row => row.archived === true && row.archivedAt === undefined).length
49
+ }
50
+ } catch { /* keep host counts */ }
51
+ }
52
+ setArchive(value.available ? value : null)
53
+ } catch {
54
+ setArchive(null)
55
+ }
56
+ }
57
+
58
+ useEffect(() => { void loadArchive() }, [])
22
59
 
23
60
  return (
24
61
  <div style={pageStyles.page}>
@@ -61,6 +98,19 @@ export function SettingsSection({ t }: SettingsSectionProps) {
61
98
  >
62
99
  {t('page.tab.sessionEnd')}
63
100
  </button>
101
+ {archive?.available
102
+ ? (
103
+ <button
104
+ type="button"
105
+ role="tab"
106
+ aria-selected={tab === 'archive'}
107
+ onClick={() => { setTab('archive') }}
108
+ style={tab === 'archive' ? { ...pageStyles.tab, ...pageStyles.tabActive } : pageStyles.tab}
109
+ >
110
+ {t('page.tab.archive')}
111
+ </button>
112
+ )
113
+ : null}
64
114
  <button
65
115
  type="button"
66
116
  role="tab"
@@ -101,7 +151,38 @@ export function SettingsSection({ t }: SettingsSectionProps) {
101
151
  fields={SESSION_END_FIELDS}
102
152
  />
103
153
  )
104
- : (
154
+ : tab === 'archive' && archive?.available
155
+ ? (
156
+ <div style={pageStyles.card}>
157
+ <div style={pageStyles.cardTitle}>{t('page.archive.title')}</div>
158
+ <div style={pageStyles.componentRow}>
159
+ <span style={pageStyles.componentName}>{t('page.archive.available')}</span>
160
+ <span style={pageStyles.componentHint}>{archive.ledgerExists ? t('page.archive.ledger') : archive.ledgerPath}</span>
161
+ </div>
162
+ <div style={pageStyles.componentRow}>
163
+ <span style={pageStyles.componentName}>{t('page.archive.archived')}</span>
164
+ <span style={pageStyles.componentHint}>{archive.archivedCount}</span>
165
+ </div>
166
+ <div style={pageStyles.componentRow}>
167
+ <span style={pageStyles.componentName}>{t('page.archive.observed')}</span>
168
+ <span style={pageStyles.componentHint}>{archive.observed}</span>
169
+ </div>
170
+ <div style={pageStyles.componentRow}>
171
+ <span style={pageStyles.componentName}>{t('page.archive.manual')}</span>
172
+ <span style={pageStyles.componentHint}>{archive.manual}</span>
173
+ </div>
174
+ <div style={pageStyles.componentRow}>
175
+ <span style={pageStyles.componentName}>{t('page.archive.unknown')}</span>
176
+ <span style={pageStyles.componentHint}>{archive.unknownCount}</span>
177
+ </div>
178
+ <div style={pageStyles.componentRow}>
179
+ <span style={pageStyles.componentName}>{t('page.archive.ledger')}</span>
180
+ <span style={pageStyles.componentHint}>{archive.ledgerPath}</span>
181
+ </div>
182
+ <button type="button" onClick={() => { void loadArchive() }} style={pageStyles.tab}>{t('page.archive.refresh')}</button>
183
+ </div>
184
+ )
185
+ : (
105
186
  <div style={pageStyles.card}>
106
187
  <div style={pageStyles.cardTitle}>{t('page.components.title')}</div>
107
188
  <div style={pageStyles.componentRow}>
@@ -128,6 +209,14 @@ export function SettingsSection({ t }: SettingsSectionProps) {
128
209
  <span style={pageStyles.componentName}>{t('page.components.sessionEnd')}</span>
129
210
  <span style={pageStyles.componentHint}>{t('page.components.sessionEndHint')}</span>
130
211
  </div>
212
+ {archive?.available
213
+ ? (
214
+ <div style={pageStyles.componentRow}>
215
+ <span style={pageStyles.componentName}>{t('page.components.archive')}</span>
216
+ <span style={pageStyles.componentHint}>{t('page.components.archiveHint')}</span>
217
+ </div>
218
+ )
219
+ : null}
131
220
  <div style={pageStyles.cardStatus}>{t('page.components.note')}</div>
132
221
  </div>
133
222
  )}
@@ -111,12 +111,26 @@ export const zh = {
111
111
  'form.taskGuard.exclude': '不统计这些工具',
112
112
  'form.taskGuard.listHint': '逗号分隔,支持 *;留空表示全部',
113
113
  'page.tab.sessionEnd': '会话后动作',
114
+ 'page.tab.archive': '归档时间',
115
+ 'page.archive.title': '归档时间',
116
+ 'page.archive.description': '第三方会话归档插件的归档时间状态。仅在检测到 @linxin666/dsh-session-archive 时显示,未安装时不会注册此页。',
117
+ 'page.archive.available': '已检测到第三方归档插件',
118
+ 'page.archive.ledger': '归档台账',
119
+ 'page.archive.observed': '历史补记',
120
+ 'page.archive.manual': '正常记录',
121
+ 'page.archive.unknown': '未知归档时间',
122
+ 'page.archive.archived': '已归档会话',
123
+ 'page.archive.refresh': '刷新状态',
124
+ 'page.archive.note': '历史未知归档在首次初始化时补记(补记);初始化后的新归档记录正常时间。自动删除仍由归档插件控制。',
125
+
114
126
  'page.sessionEnd.title': '会话后动作',
115
127
  'page.sessionEnd.description': '本轮最终回复完整显示后执行一次动作;重启会等待所有会话与后台任务结束,设置页的重启不受此约束。',
116
128
  'page.components.authCookie': '认证 cookie 清理',
117
129
  'page.components.authCookieHint': '自动运行,无设置',
118
130
  'page.components.sessionEnd': '会话后动作',
119
131
  'page.components.sessionEndHint': '输入框左侧的「会话后重启」下拉',
132
+ 'page.components.archive': '归档时间(可选)',
133
+ 'page.components.archiveHint': '检测到第三方归档插件时显示',
120
134
  'form.sessionEnd.enabled': '启用会话后动作',
121
135
  'form.sessionEnd.enabledHint': '在对话输入框显示「会话后重启」下拉,并允许 AI 设置',
122
136
  'form.sessionEnd.grace': '最终回复显示等待(毫秒)',
@@ -242,12 +256,26 @@ export const en = {
242
256
  'form.taskGuard.exclude': 'Exclude these tools',
243
257
  'form.taskGuard.listHint': 'Comma-separated, * supported; empty means all',
244
258
  'page.tab.sessionEnd': 'After-session action',
259
+ 'page.tab.archive': 'Archive time',
260
+ 'page.archive.title': 'Archive time',
261
+ 'page.archive.description': 'Archive-time status of the third-party session archive plugin. Shown only when @linxin666/dsh-session-archive is detected; no page is registered when it is absent.',
262
+ 'page.archive.available': 'Third-party archive plugin detected',
263
+ 'page.archive.ledger': 'Archive ledger',
264
+ 'page.archive.observed': 'Historical backfilled',
265
+ 'page.archive.manual': 'Normal records',
266
+ 'page.archive.unknown': 'Unknown archive times',
267
+ 'page.archive.archived': 'Archived sessions',
268
+ 'page.archive.refresh': 'Refresh status',
269
+ 'page.archive.note': 'Historical unknown archives are backfilled on first initialization and marked (backfilled); new archives after initialization are recorded as normal times. Auto-delete remains controlled by the archive plugin.',
270
+
245
271
  'page.sessionEnd.title': 'After-session action',
246
272
  'page.sessionEnd.description': 'One action after the final reply is fully displayed. A restart waits for every running conversation and background job; the Settings restart button is not delayed.',
247
273
  'page.components.authCookie': 'Auth-cookie cleanup',
248
274
  'page.components.authCookieHint': 'Runs automatically; no settings',
249
275
  'page.components.sessionEnd': 'After-session action',
250
276
  'page.components.sessionEndHint': 'The “Restart after session” dropdown left of the composer',
277
+ 'page.components.archive': 'Archive time (optional)',
278
+ 'page.components.archiveHint': 'Shown only when the third-party archive plugin is detected',
251
279
  'form.sessionEnd.enabled': 'Enable after-session actions',
252
280
  'form.sessionEnd.enabledHint': 'Show the “Restart after session” dropdown in the composer and let the AI arm it',
253
281
  'form.sessionEnd.grace': 'Final-reply render grace (ms)',
@@ -91,8 +91,8 @@ export function normalizeConfig(config?: unknown): AutoReviewSettings {
91
91
  model: stringSetting(source, 'translateModel', ''),
92
92
  reviewContext: {
93
93
  enabled: boolSetting(source, 'reviewContextGuard', true),
94
- maxHistoryChars: numberSetting(source, 'reviewMaxHistoryChars', 120000, 20000, 600000),
95
- keepRecentEntries: numberSetting(source, 'reviewKeepRecentEntries', 16, 4, 64),
94
+ maxHistoryChars: numberSetting(source, 'reviewMaxHistoryChars', 200000, 20000, 600000),
95
+ keepRecentEntries: numberSetting(source, 'reviewKeepRecentEntries', 32, 4, 64),
96
96
  },
97
97
  }
98
98
  }