@twinsearth/ai-prison-dsh-plugin 1.7.3 → 1.7.4
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/CHANGELOG.md +16 -0
- package/client.js +8 -5
- package/lib/notifier.js +1 -0
- package/lib/remediation.js +1 -1
- package/lib/status.js +3 -1
- package/lib/version.js +17 -0
- package/lib/watchdog-enforcement.js +11 -0
- package/lib/watchdog-persistence.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@twinsearth/ai-prison-dsh-plugin` are recorded here.
|
|
4
4
|
|
|
5
|
+
## [1.7.4] — 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Enforcement card: the Top5 action button now reads **立即缉拿 / Arrest now**
|
|
10
|
+
(previously 立即关闭 / Close now), and its confirmation prompt uses the same
|
|
11
|
+
wording. The underlying action is unchanged (close the plugin); only the
|
|
12
|
+
AI-Prison-themed label changed.
|
|
13
|
+
- Enabling a quarantined plugin from the UI is immediately closed again and raises
|
|
14
|
+
a tray notification: **请到 AI 监狱释放该插件!再开启。** The reminder is forced
|
|
15
|
+
even when general notifications are off (rate limited per kind).
|
|
16
|
+
- Header version pill shows the **plugin version** (`AI Prison vX.Y.Z`) instead of
|
|
17
|
+
the bundled aiprison CLI version; the CLI version stays in the footer. Before,
|
|
18
|
+
the pill always read `aiprison 1.0.9` regardless of plugin releases.
|
|
19
|
+
|
|
20
|
+
## [1.7.3] — 2026-11-19
|
|
5
21
|
## [1.7.3] — 2026-11-19
|
|
6
22
|
|
|
7
23
|
### Added
|
package/client.js
CHANGED
|
@@ -17,6 +17,7 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
const DICTS = {
|
|
18
18
|
en: {
|
|
19
19
|
'panel.label': 'AI Prison',
|
|
20
|
+
'panel.version': 'AI Prison v{version}',
|
|
20
21
|
'page.title': 'AI Prison',
|
|
21
22
|
'page.subtitle': 'Graduated capability deprivation for agents. Every backend is simulated.',
|
|
22
23
|
'matrix.title': 'L0–L5 grading matrix',
|
|
@@ -63,7 +64,7 @@ window.__ModuleLoader__.load({
|
|
|
63
64
|
'watchdog.noQuarantine': 'No quarantined plugins.',
|
|
64
65
|
'watchdog.release': 'Release',
|
|
65
66
|
'watchdog.topFive': 'Top {n} by estimated heap',
|
|
66
|
-
'watchdog.close': '
|
|
67
|
+
'watchdog.close': 'Arrest now',
|
|
67
68
|
'watchdog.plans': 'Crash plans',
|
|
68
69
|
'watchdog.baseline': 'Clean baseline: {at}',
|
|
69
70
|
'watchdog.tamper': 'Profile watch: {n} critical file(s) · policy {policy} · last check {at}',
|
|
@@ -97,6 +98,7 @@ window.__ModuleLoader__.load({
|
|
|
97
98
|
},
|
|
98
99
|
zh: {
|
|
99
100
|
'panel.label': 'AI Prison',
|
|
101
|
+
'panel.version': 'AI Prison v{version}',
|
|
100
102
|
'page.title': 'AI Prison · AI 监狱',
|
|
101
103
|
'page.subtitle': '面向 AI Agent 的分级能力剥夺与行为矫正;所有后端均为内存模拟。',
|
|
102
104
|
'matrix.title': 'L0–L5 分级矩阵',
|
|
@@ -143,7 +145,7 @@ window.__ModuleLoader__.load({
|
|
|
143
145
|
'watchdog.noQuarantine': '没有被隔离的插件。',
|
|
144
146
|
'watchdog.release': '假释',
|
|
145
147
|
'watchdog.topFive': '按估算内存排序的前 {n} 个插件',
|
|
146
|
-
'watchdog.close': '
|
|
148
|
+
'watchdog.close': '立即缉拿',
|
|
147
149
|
'watchdog.plans': '崩溃降级计划',
|
|
148
150
|
'watchdog.baseline': '干净基线:{at}',
|
|
149
151
|
'watchdog.tamper': '配置监控:{n} 个关键文件 · 策略 {policy} · 最近检查 {at}',
|
|
@@ -524,7 +526,7 @@ window.__ModuleLoader__.load({
|
|
|
524
526
|
h('td', { style: { ...C.td, ...C.mono, fontSize: 11.5, wordBreak: 'break-all' } }, row.target),
|
|
525
527
|
h('td', { style: C.td }, row.estimateMB + ' MB'),
|
|
526
528
|
h('td', { style: C.td }, (row.rssMB || 0) + ' MB'),
|
|
527
|
-
h('td', { style: C.td }, h('button', { style: button, onClick: () => act('close', row.target, '
|
|
529
|
+
h('td', { style: C.td }, h('button', { style: button, onClick: () => act('close', row.target, '立即缉拿 ' + row.target + ' ?') }, t('watchdog.close'))),
|
|
528
530
|
))),
|
|
529
531
|
),
|
|
530
532
|
),
|
|
@@ -719,6 +721,7 @@ window.__ModuleLoader__.load({
|
|
|
719
721
|
|
|
720
722
|
const cli = data?.cli
|
|
721
723
|
const cliText = cli && cli.found ? t('cli.found', { version: cli.version || '?' }) : t('cli.missing')
|
|
724
|
+
const pillText = data && data.pluginVersion ? t('panel.version', { version: data.pluginVersion }) : cliText
|
|
722
725
|
const timeText = updated ? updated.toLocaleTimeString() : ''
|
|
723
726
|
|
|
724
727
|
return h(
|
|
@@ -729,7 +732,7 @@ window.__ModuleLoader__.load({
|
|
|
729
732
|
{ style: C.header },
|
|
730
733
|
h('span', { style: { display: 'inline-flex' } }, h(PrisonIcon, { size: 26, active: true })),
|
|
731
734
|
h('div', { style: { minWidth: 0 } }, h('h1', { style: C.title }, t('page.title')), h('p', { style: C.sub }, t('page.subtitle'))),
|
|
732
|
-
h(Pill, { tone: cli && cli.found ? 'ok' : 'error', text:
|
|
735
|
+
h(Pill, { tone: cli && cli.found ? 'ok' : 'error', text: pillText }),
|
|
733
736
|
h('button', { type: 'button', style: C.btn, onClick: load, disabled: loading }, loading ? t('action.loading') : t('action.refresh')),
|
|
734
737
|
),
|
|
735
738
|
error
|
|
@@ -756,7 +759,7 @@ window.__ModuleLoader__.load({
|
|
|
756
759
|
'p',
|
|
757
760
|
{ style: { ...C.muted, fontSize: 12, margin: '2px 0 0', display: 'flex', gap: 12, flexWrap: 'wrap' } },
|
|
758
761
|
h('span', null, t('meta.readonly')),
|
|
759
|
-
cli && cli.path ? h('span', { style: C.mono }, `${t('cli.source')}: ${cli.source} · ${cli.path}`) : null,
|
|
762
|
+
cli && cli.path ? h('span', { style: C.mono }, `${t('cli.source')}: ${cli.source} · ${cli.path} · aiprison ${cli.version || '?'}`) : null,
|
|
760
763
|
timeText ? h('span', null, t('meta.updated', { time: timeText })) : null,
|
|
761
764
|
),
|
|
762
765
|
)
|
package/lib/notifier.js
CHANGED
package/lib/remediation.js
CHANGED
|
@@ -24,7 +24,7 @@ const REMEDIATION = {
|
|
|
24
24
|
steps: [
|
|
25
25
|
'先重启 DSH,确认在没有该插件时环境稳定。',
|
|
26
26
|
'检查插件版本是否有修复(升级到最新版),或查看其 README 的已知崩溃问题。',
|
|
27
|
-
'
|
|
27
|
+
'确需继续使用时,先在面板"插件监狱"点"假释",再开启;直接开启会被立即缉拿并弹窗提醒。',
|
|
28
28
|
],
|
|
29
29
|
release: '仅手动释放(面板"假释");重启不会自动解除,防止崩溃循环。',
|
|
30
30
|
},
|
package/lib/status.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, readdirSync } from 'node:fs'
|
|
|
2
2
|
import { describeCli, resolveCli, resolveDataDir, runCli } from './cli.js'
|
|
3
3
|
import { parseLevels } from './levels.js'
|
|
4
4
|
import { listSegments } from './ledger.js'
|
|
5
|
+
import { PLUGIN_VERSION } from './version.js'
|
|
5
6
|
|
|
6
7
|
const MAX_DETAIL = 600
|
|
7
8
|
|
|
@@ -70,6 +71,7 @@ export async function buildStatus({ config = {}, cwd, timeoutMs = 120_000, root
|
|
|
70
71
|
generatedAt: new Date().toISOString(),
|
|
71
72
|
cwd: cwd || null,
|
|
72
73
|
platform: `${process.platform}-${process.arch}`,
|
|
74
|
+
pluginVersion: PLUGIN_VERSION,
|
|
73
75
|
cli,
|
|
74
76
|
levels,
|
|
75
77
|
ledger,
|
|
@@ -79,7 +81,7 @@ export async function buildStatus({ config = {}, cwd, timeoutMs = 120_000, root
|
|
|
79
81
|
/** Bounded human summary used by tool results. */
|
|
80
82
|
export function statusSummary(status) {
|
|
81
83
|
const cliLine = status.cli.found
|
|
82
|
-
? `aiprison ${status.cli.version || '?'}(${status.cli.source}: ${status.cli.path})`
|
|
84
|
+
? `AI Prison v${status.pluginVersion || '?'} · aiprison ${status.cli.version || '?'}(${status.cli.source}: ${status.cli.path})`
|
|
83
85
|
: `CLI 不可用:${status.cli.error || 'unknown'}`
|
|
84
86
|
const ledgerLine = status.ledger.exists
|
|
85
87
|
? `账本 ${status.ledger.dir}:${status.ledger.integrity === 'ok' ? `INTEGRITY OK(${status.ledger.records ?? '?'} 条记录)` : `校验失败(${status.ledger.detail})`}`
|
package/lib/version.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Version of the installed plugin package.
|
|
6
|
+
*
|
|
7
|
+
* The panel must show the bundle version (which follows releases), not the
|
|
8
|
+
* bundled aiprison CLI version (which is the Go tool's own 1.0.x line).
|
|
9
|
+
*/
|
|
10
|
+
export const PLUGIN_VERSION = (() => {
|
|
11
|
+
try {
|
|
12
|
+
const manifest = fileURLToPath(new URL('../package.json', import.meta.url))
|
|
13
|
+
return JSON.parse(fs.readFileSync(manifest, 'utf8')).version || null
|
|
14
|
+
} catch {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
})()
|
|
@@ -124,6 +124,17 @@ export function createEnforcement({ watchdogState, refs, dataDir, journalDir, ex
|
|
|
124
124
|
entry.lastApplication = operation.application || null
|
|
125
125
|
watchdogState.operations.set(target, entry)
|
|
126
126
|
const additive = operation.stage === 'install' || (operation.stage === 'enable' && operation.enabled !== false)
|
|
127
|
+
if (operation.stage === 'enable' && operation.enabled !== false && watchdogState.enforce && watchdogState.quarantine.has(target)) {
|
|
128
|
+
const quarantined = watchdogState.quarantine.get(target)
|
|
129
|
+
appendIncident({
|
|
130
|
+
kind: 'quarantine-reminder',
|
|
131
|
+
target,
|
|
132
|
+
level: quarantined.level,
|
|
133
|
+
notify: true,
|
|
134
|
+
detail: '请到,AI监狱释放该插件!再开启。(原因:' + quarantined.reason + ';本次开启已被立即关闭)',
|
|
135
|
+
})
|
|
136
|
+
void disableTarget(target, 'quarantined-enable')
|
|
137
|
+
}
|
|
127
138
|
if (
|
|
128
139
|
watchdogState.enforce
|
|
129
140
|
&& additive
|
|
@@ -95,7 +95,8 @@ export function createPersistence({ watchdogState, stateFile, incidentsFile }) {
|
|
|
95
95
|
|
|
96
96
|
function appendIncident(incident) {
|
|
97
97
|
const record = { at: new Date().toISOString(), mode: watchdogState.mode, ...incident }
|
|
98
|
-
|
|
98
|
+
const notificationKinds = ['freeze', 'pause', 'quarantine', 'tamper', 'crash-enforced', 'budget', 'quarantine-reminder']
|
|
99
|
+
if ((record.notify === true || (watchdogState.config && watchdogState.config.notify === true)) && notificationKinds.includes(record.kind)) {
|
|
99
100
|
try {
|
|
100
101
|
notify(record)
|
|
101
102
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/ai-prison-dsh-plugin",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "AI Prison for DSH: eight governance tools wrapping the aiprison CLI (levels, status, watchdog status, demo, drill, inspect, verify, repair-tail) plus a panel for the L0–L5 matrix and the audit-chain state. The CLI ships bundled for Windows, macOS and Linux; every capability-removal backend stays simulated.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|