@twinsearth/ai-prison-dsh-plugin 1.1.0 → 1.1.1
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 +18 -0
- package/README.md +11 -6
- package/bin/linux-amd64/aiprison +0 -0
- package/bin/linux-arm64/aiprison +0 -0
- package/bin/macos-amd64/aiprison +0 -0
- package/bin/macos-arm64/aiprison +0 -0
- package/bin/windows-amd64/aiprison.exe +0 -0
- package/bin/windows-arm64/aiprison.exe +0 -0
- package/client.js +99 -4
- package/lib/api.js +110 -30
- package/lib/status.js +13 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@twinsearth/ai-prison-dsh-plugin` are recorded here.
|
|
4
4
|
|
|
5
|
+
## [1.1.1] — 2026-11-18
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Panel actions**: the audit-chain card now has **Run demo (create ledger)** and
|
|
10
|
+
**Run recovery drill** buttons plus a last-action line. They call the new
|
|
11
|
+
`POST /api/ai-prison/run` Host route (authenticated through
|
|
12
|
+
`ctx.connection.fetch`), which runs the bundled CLI with the resolved ledger
|
|
13
|
+
directory; the panel itself still never writes on its own.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **Panel ledger directory**: the status route resolved `process.cwd()` (the
|
|
18
|
+
profile directory, e.g. `…/.dsh/profiles/desktop/.ai-prison`) because a Fetch
|
|
19
|
+
route carries no Agent. It now resolves the most recent live Session's
|
|
20
|
+
effective directory through `ctx.sessions` + `ctx.workingDirectory`, so the
|
|
21
|
+
panel and its action buttons use the session workspace by default.
|
|
22
|
+
|
|
5
23
|
## [1.1.0] — 2026-11-17
|
|
6
24
|
|
|
7
25
|
First release: the AI Prison governance prototype as a DeepSeek Harness bundle.
|
package/README.md
CHANGED
|
@@ -34,13 +34,18 @@ panel; the six tools become visible to the Agent on the next session step.
|
|
|
34
34
|
|
|
35
35
|
The panel shows the matrix from `ai_prison_levels` data plus the ledger
|
|
36
36
|
directory, integrity pill, record and file counts; it refreshes every 20 seconds
|
|
37
|
-
and on demand.
|
|
37
|
+
and on demand. Below the audit-chain card sit two explicit buttons — **Run demo
|
|
38
|
+
(create ledger)** and **Run recovery drill** — which call `POST
|
|
39
|
+
/api/ai-prison/run` and therefore write the ledger only when pressed; the panel
|
|
40
|
+
never writes on its own.
|
|
38
41
|
|
|
39
42
|
## Ledger directory
|
|
40
43
|
|
|
41
|
-
Default: `<session working directory>/.ai-prison`, so the audit trail
|
|
42
|
-
to the project it governs.
|
|
43
|
-
|
|
44
|
+
Default for tools: `<session working directory>/.ai-prison`, so the audit trail
|
|
45
|
+
stays next to the project it governs. The panel resolves the most recent live
|
|
46
|
+
Session's effective directory for the same reason (a Fetch route carries no
|
|
47
|
+
Agent of its own). Override with a tool argument (`data_dir`) or with the plugin
|
|
48
|
+
config:
|
|
44
49
|
|
|
45
50
|
```yaml
|
|
46
51
|
- id: ai-prison
|
|
@@ -80,8 +85,8 @@ the release check, packs the npm tarball and publishes the GitHub Release assets
|
|
|
80
85
|
|
|
81
86
|
- Backends are simulations: no real isolation, revocation distribution,
|
|
82
87
|
hardware binding or capability removal happens.
|
|
83
|
-
- The plugin never writes the ledger from
|
|
84
|
-
`demo`, `drill` and `repair-tail` mutate it.
|
|
88
|
+
- The plugin never writes the ledger from status calls; only the two explicit
|
|
89
|
+
panel buttons and the `demo`, `drill` and `repair-tail` tools mutate it.
|
|
85
90
|
- A wrong `data_dir` reveals that directory's integrity state only; the plugin
|
|
86
91
|
reads and checks, it does not repair anything except the torn tail the CLI
|
|
87
92
|
itself accepts.
|
package/bin/linux-amd64/aiprison
CHANGED
|
Binary file
|
package/bin/linux-arm64/aiprison
CHANGED
|
Binary file
|
package/bin/macos-amd64/aiprison
CHANGED
|
Binary file
|
package/bin/macos-arm64/aiprison
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/client.js
CHANGED
|
@@ -10,6 +10,7 @@ window.__ModuleLoader__.load({
|
|
|
10
10
|
const PANEL_ID = 'ai-prison'
|
|
11
11
|
const NS = 'ai-prison'
|
|
12
12
|
const STATUS_URL = 'api/ai-prison/status'
|
|
13
|
+
const RUN_URL = 'api/ai-prison/run'
|
|
13
14
|
|
|
14
15
|
const DICTS = {
|
|
15
16
|
en: {
|
|
@@ -37,8 +38,14 @@ window.__ModuleLoader__.load({
|
|
|
37
38
|
'cli.source': 'Source',
|
|
38
39
|
'action.refresh': 'Refresh',
|
|
39
40
|
'action.loading': 'Reading…',
|
|
41
|
+
'action.runDemo': 'Run demo (create ledger)',
|
|
42
|
+
'action.runDrill': 'Run recovery drill',
|
|
43
|
+
'action.running': 'Running…',
|
|
44
|
+
'ledger.actions': 'Explicit actions',
|
|
45
|
+
'ledger.actionsHint': 'These buttons run the bundled CLI and write the ledger; the panel never writes on its own.',
|
|
46
|
+
'ledger.lastAction': 'Last action',
|
|
40
47
|
'meta.updated': 'Updated {time}',
|
|
41
|
-
'meta.readonly': 'Read-only view:
|
|
48
|
+
'meta.readonly': 'Read-only view: the panel never writes by itself; only the buttons above do.',
|
|
42
49
|
'error.title': 'Cannot read the status',
|
|
43
50
|
'error.hint': 'Check that the bundle is enabled and the aiprison CLI resolves for this platform.',
|
|
44
51
|
},
|
|
@@ -67,8 +74,14 @@ window.__ModuleLoader__.load({
|
|
|
67
74
|
'cli.source': '来源',
|
|
68
75
|
'action.refresh': '刷新',
|
|
69
76
|
'action.loading': '读取中…',
|
|
77
|
+
'action.runDemo': '运行 demo(创建账本)',
|
|
78
|
+
'action.runDrill': '运行恢复演练',
|
|
79
|
+
'action.running': '运行中…',
|
|
80
|
+
'ledger.actions': '显式操作',
|
|
81
|
+
'ledger.actionsHint': '这些按钮会运行内置 CLI 并写入账本;面板本身不会自动写入。',
|
|
82
|
+
'ledger.lastAction': '最近操作',
|
|
70
83
|
'meta.updated': '更新于 {time}',
|
|
71
|
-
'meta.readonly': '
|
|
84
|
+
'meta.readonly': '只读视图:面板不会自行写入账本,只有上方按钮会写入。',
|
|
72
85
|
'error.title': '无法读取状态',
|
|
73
86
|
'error.hint': '请确认插件已启用,且本平台能解析到 aiprison CLI。',
|
|
74
87
|
},
|
|
@@ -151,6 +164,15 @@ window.__ModuleLoader__.load({
|
|
|
151
164
|
},
|
|
152
165
|
error: { color: '#c81e1e' },
|
|
153
166
|
ok: { color: '#15803d' },
|
|
167
|
+
actionBtn: {
|
|
168
|
+
padding: '5px 12px',
|
|
169
|
+
borderRadius: 7,
|
|
170
|
+
border: '1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.16))',
|
|
171
|
+
background: 'transparent',
|
|
172
|
+
color: 'inherit',
|
|
173
|
+
cursor: 'pointer',
|
|
174
|
+
fontSize: 12,
|
|
175
|
+
},
|
|
154
176
|
}
|
|
155
177
|
|
|
156
178
|
function PrisonIcon({ size = 36, active = true }) {
|
|
@@ -190,6 +212,22 @@ window.__ModuleLoader__.load({
|
|
|
190
212
|
})
|
|
191
213
|
}
|
|
192
214
|
|
|
215
|
+
/** Run one explicit ledger action through the Host half. */
|
|
216
|
+
function postRun(action) {
|
|
217
|
+
return fetch(new URL(RUN_URL, document.baseURI), {
|
|
218
|
+
method: 'POST',
|
|
219
|
+
credentials: 'same-origin',
|
|
220
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
221
|
+
body: JSON.stringify({ action }),
|
|
222
|
+
}).then(async (response) => {
|
|
223
|
+
const payload = await response.json().catch(() => ({}))
|
|
224
|
+
if (!response.ok || payload.ok !== true) {
|
|
225
|
+
throw new Error(payload.error || payload.summary || `HTTP ${response.status}`)
|
|
226
|
+
}
|
|
227
|
+
return payload
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
|
|
193
231
|
function MatrixCard({ levels }) {
|
|
194
232
|
if (!Array.isArray(levels) || levels.length === 0) {
|
|
195
233
|
return h('section', { style: C.card }, h('div', { style: C.cardHead }, t('matrix.title')), h('p', { style: { ...C.muted, margin: 0, fontSize: 12 } }, t('matrix.empty')))
|
|
@@ -224,7 +262,7 @@ window.__ModuleLoader__.load({
|
|
|
224
262
|
)
|
|
225
263
|
}
|
|
226
264
|
|
|
227
|
-
function LedgerCard({ ledger }) {
|
|
265
|
+
function LedgerCard({ ledger, cliFound, busy, onAction, lastResult }) {
|
|
228
266
|
const exists = Boolean(ledger && ledger.exists)
|
|
229
267
|
const integrityTone = !exists ? 'none' : ledger.integrity === 'ok' ? 'ok' : 'error'
|
|
230
268
|
const integrityText = !exists ? t('integrity.none') : ledger.integrity === 'ok' ? t('integrity.ok') : t('integrity.failed')
|
|
@@ -239,6 +277,7 @@ window.__ModuleLoader__.load({
|
|
|
239
277
|
if (exists && ledger.detail) {
|
|
240
278
|
entries.push({ key: 'detail', label: t('ledger.detail'), value: h('span', { style: { ...C.mono, wordBreak: 'break-word' } }, ledger.detail) })
|
|
241
279
|
}
|
|
280
|
+
const disabled = Boolean(busy) || !cliFound
|
|
242
281
|
return h(
|
|
243
282
|
'section',
|
|
244
283
|
{ style: C.card },
|
|
@@ -252,6 +291,36 @@ window.__ModuleLoader__.load({
|
|
|
252
291
|
]),
|
|
253
292
|
),
|
|
254
293
|
!exists ? h('p', { style: { ...C.muted, fontSize: 12, margin: '8px 0 0' } }, t('ledger.empty')) : null,
|
|
294
|
+
h(
|
|
295
|
+
'div',
|
|
296
|
+
{ style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap', marginTop: 10 } },
|
|
297
|
+
h(
|
|
298
|
+
'button',
|
|
299
|
+
{ type: 'button', style: C.actionBtn, disabled, onClick: () => onAction('demo') },
|
|
300
|
+
busy === 'demo' ? t('action.running') : t('action.runDemo'),
|
|
301
|
+
),
|
|
302
|
+
h(
|
|
303
|
+
'button',
|
|
304
|
+
{ type: 'button', style: C.actionBtn, disabled, onClick: () => onAction('drill') },
|
|
305
|
+
busy === 'drill' ? t('action.running') : t('action.runDrill'),
|
|
306
|
+
),
|
|
307
|
+
h('span', { style: { ...C.muted, fontSize: 11.5 } }, t('ledger.actionsHint')),
|
|
308
|
+
),
|
|
309
|
+
lastResult
|
|
310
|
+
? h(
|
|
311
|
+
'p',
|
|
312
|
+
{
|
|
313
|
+
style: {
|
|
314
|
+
...C.mono,
|
|
315
|
+
fontSize: 11.5,
|
|
316
|
+
margin: '8px 0 0',
|
|
317
|
+
color: lastResult.ok ? C.ok.color : C.error.color,
|
|
318
|
+
wordBreak: 'break-word',
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
`${t('ledger.lastAction')}: ${lastResult.action} — ${lastResult.summary}`,
|
|
322
|
+
)
|
|
323
|
+
: null,
|
|
255
324
|
)
|
|
256
325
|
}
|
|
257
326
|
|
|
@@ -260,6 +329,8 @@ window.__ModuleLoader__.load({
|
|
|
260
329
|
const [error, setError] = React.useState(null)
|
|
261
330
|
const [loading, setLoading] = React.useState(true)
|
|
262
331
|
const [updated, setUpdated] = React.useState(null)
|
|
332
|
+
const [busy, setBusy] = React.useState(null)
|
|
333
|
+
const [lastResult, setLastResult] = React.useState(null)
|
|
263
334
|
|
|
264
335
|
const load = React.useCallback(() => {
|
|
265
336
|
setLoading(true)
|
|
@@ -282,6 +353,24 @@ window.__ModuleLoader__.load({
|
|
|
282
353
|
return () => clearInterval(timer)
|
|
283
354
|
}, [load])
|
|
284
355
|
|
|
356
|
+
const runAction = React.useCallback(
|
|
357
|
+
(action) => {
|
|
358
|
+
setBusy(action)
|
|
359
|
+
setLastResult(null)
|
|
360
|
+
postRun(action)
|
|
361
|
+
.then((payload) => {
|
|
362
|
+
setLastResult({ action, ok: true, summary: payload.summary || '' })
|
|
363
|
+
setBusy(null)
|
|
364
|
+
load()
|
|
365
|
+
})
|
|
366
|
+
.catch((cause) => {
|
|
367
|
+
setLastResult({ action, ok: false, summary: String((cause && cause.message) || cause) })
|
|
368
|
+
setBusy(null)
|
|
369
|
+
})
|
|
370
|
+
},
|
|
371
|
+
[load],
|
|
372
|
+
)
|
|
373
|
+
|
|
285
374
|
const cli = data?.cli
|
|
286
375
|
const cliText = cli && cli.found ? t('cli.found', { version: cli.version || '?' }) : t('cli.missing')
|
|
287
376
|
const timeText = updated ? updated.toLocaleTimeString() : ''
|
|
@@ -307,7 +396,13 @@ window.__ModuleLoader__.load({
|
|
|
307
396
|
)
|
|
308
397
|
: null,
|
|
309
398
|
h(MatrixCard, { levels: data?.levels }),
|
|
310
|
-
h(LedgerCard, {
|
|
399
|
+
h(LedgerCard, {
|
|
400
|
+
ledger: data?.ledger,
|
|
401
|
+
cliFound: Boolean(cli && cli.found),
|
|
402
|
+
busy,
|
|
403
|
+
onAction: runAction,
|
|
404
|
+
lastResult,
|
|
405
|
+
}),
|
|
311
406
|
h(
|
|
312
407
|
'p',
|
|
313
408
|
{ style: { ...C.muted, fontSize: 12, margin: '2px 0 0', display: 'flex', gap: 12, flexWrap: 'wrap' } },
|
package/lib/api.js
CHANGED
|
@@ -1,40 +1,120 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveCli, resolveDataDir, runCli } from './cli.js'
|
|
2
|
+
import { buildStatus, summarizeRun } from './status.js'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Resolve the directory panel actions should default to. The route has no Agent
|
|
6
|
+
* of its own, so it borrows the most recent live Session's effective directory;
|
|
7
|
+
* without one it falls back to the Host process directory.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveSessionCwd(ctx) {
|
|
10
|
+
try {
|
|
11
|
+
const sessions = ctx && typeof ctx.get === 'function' ? ctx.get('sessions') : undefined
|
|
12
|
+
const workingDirectory = ctx && typeof ctx.get === 'function' ? ctx.get('workingDirectory') : undefined
|
|
13
|
+
const list = sessions && typeof sessions.list === 'function' ? sessions.list() : []
|
|
14
|
+
for (let index = list.length - 1; index >= 0; index -= 1) {
|
|
15
|
+
const session = list[index]
|
|
16
|
+
if (workingDirectory && typeof workingDirectory.get === 'function') {
|
|
17
|
+
try {
|
|
18
|
+
const dir = workingDirectory.get(session)
|
|
19
|
+
if (typeof dir === 'string' && dir) return dir
|
|
20
|
+
} catch {
|
|
21
|
+
// A session whose directory is unavailable falls through to its header.
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const headerCwd = session && session.header ? session.header.cwd : undefined
|
|
25
|
+
if (typeof headerCwd === 'string' && headerCwd) return headerCwd
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
// A profile without sessions keeps the process directory.
|
|
29
|
+
}
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function jsonResponse(payload, status = 200) {
|
|
34
|
+
return Response.json(payload, { status, headers: { 'cache-control': 'no-store' } })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Panel API: read-only status plus the two explicit ledger actions the panel
|
|
39
|
+
* offers. Actions run the bundled CLI and therefore write the ledger only when
|
|
40
|
+
* the user presses the corresponding button.
|
|
7
41
|
*/
|
|
8
42
|
export function registerApi({ ctx, config = {}, logger } = {}) {
|
|
9
43
|
if (!ctx || typeof ctx.inject !== 'function') return false
|
|
10
44
|
ctx.inject(['connection'], (child) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
() =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
requestBody: 'buffered',
|
|
18
|
-
fetch: async (request) => {
|
|
19
|
-
try {
|
|
20
|
-
const url = new URL(request.url)
|
|
21
|
-
const requested = url.searchParams.get('data_dir')
|
|
22
|
-
const statusConfig = requested ? { ...config, dataDir: requested } : config
|
|
23
|
-
const status = await buildStatus({ config: statusConfig })
|
|
24
|
-
return Response.json(status, { headers: { 'cache-control': 'no-store' } })
|
|
25
|
-
} catch (error) {
|
|
26
|
-
return Response.json(
|
|
27
|
-
{ ok: false, error: String((error && error.message) || error) },
|
|
28
|
-
{ status: 500 },
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
'ai-prison: status api',
|
|
34
|
-
)
|
|
35
|
-
} catch (error) {
|
|
36
|
-
logger?.warn?.(`注册 /api/ai-prison/status 失败:${String(error && error.message)}`)
|
|
45
|
+
const registerRoute = (route, label) => {
|
|
46
|
+
try {
|
|
47
|
+
child.effect(() => child.connection.fetch.register(route), label)
|
|
48
|
+
} catch (error) {
|
|
49
|
+
logger?.warn?.(`注册 ${route.path} 失败:${String(error && error.message)}`)
|
|
50
|
+
}
|
|
37
51
|
}
|
|
52
|
+
|
|
53
|
+
registerRoute(
|
|
54
|
+
{
|
|
55
|
+
path: '/api/ai-prison/status',
|
|
56
|
+
methods: ['GET'],
|
|
57
|
+
requestBody: 'buffered',
|
|
58
|
+
fetch: async (request) => {
|
|
59
|
+
try {
|
|
60
|
+
const url = new URL(request.url)
|
|
61
|
+
const requested = url.searchParams.get('data_dir')
|
|
62
|
+
const statusConfig = requested ? { ...config, dataDir: requested } : config
|
|
63
|
+
const cwd = resolveSessionCwd(ctx)
|
|
64
|
+
const status = await buildStatus({ config: statusConfig, cwd })
|
|
65
|
+
return jsonResponse(status)
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return jsonResponse({ ok: false, error: String((error && error.message) || error) }, 500)
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
'ai-prison: status api',
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
registerRoute(
|
|
75
|
+
{
|
|
76
|
+
path: '/api/ai-prison/run',
|
|
77
|
+
methods: ['POST'],
|
|
78
|
+
requestBody: 'buffered',
|
|
79
|
+
fetch: async (request) => {
|
|
80
|
+
let body
|
|
81
|
+
try {
|
|
82
|
+
body = await request.json()
|
|
83
|
+
} catch {
|
|
84
|
+
body = {}
|
|
85
|
+
}
|
|
86
|
+
const action = String(body?.action ?? '')
|
|
87
|
+
if (action !== 'demo' && action !== 'drill') {
|
|
88
|
+
return jsonResponse({ ok: false, error: 'action must be "demo" or "drill"' }, 400)
|
|
89
|
+
}
|
|
90
|
+
const resolved = resolveCli({ config })
|
|
91
|
+
if (!resolved.path) {
|
|
92
|
+
return jsonResponse({ ok: false, error: resolved.missing, reason: 'cli-missing' }, 409)
|
|
93
|
+
}
|
|
94
|
+
const cwd = resolveSessionCwd(ctx) || process.cwd()
|
|
95
|
+
const requested = typeof body?.data_dir === 'string' && body.data_dir ? body.data_dir : undefined
|
|
96
|
+
const dataDir = requested ? requested : resolveDataDir({ config, cwd })
|
|
97
|
+
const timeoutMs = Number(config.timeoutMs) > 0 ? Number(config.timeoutMs) : 120_000
|
|
98
|
+
const result = await runCli(['--data-dir', dataDir, action], {
|
|
99
|
+
bin: resolved.path,
|
|
100
|
+
cwd,
|
|
101
|
+
timeoutMs: Math.max(timeoutMs, 180_000),
|
|
102
|
+
})
|
|
103
|
+
return jsonResponse({
|
|
104
|
+
ok: result.ok,
|
|
105
|
+
action,
|
|
106
|
+
dataDir,
|
|
107
|
+
cwd,
|
|
108
|
+
exitCode: result.exitCode,
|
|
109
|
+
timedOut: result.timedOut === true,
|
|
110
|
+
summary: summarizeRun(action, result),
|
|
111
|
+
stdout: result.stdout,
|
|
112
|
+
stderr: result.stderr,
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
'ai-prison: run api',
|
|
117
|
+
)
|
|
38
118
|
})
|
|
39
119
|
return true
|
|
40
120
|
}
|
package/lib/status.js
CHANGED
|
@@ -80,3 +80,16 @@ export function statusSummary(status) {
|
|
|
80
80
|
: `账本 ${status.ledger.dir}:尚未初始化`
|
|
81
81
|
return [cliLine, ledgerLine, `分级矩阵:${status.levels.length} 级`].join('\n')
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
/** One-line outcome for a panel action (`demo` or `drill`). */
|
|
85
|
+
export function summarizeRun(action, result) {
|
|
86
|
+
if (result && result.timedOut) return `超时:${action} 超过时间上限`
|
|
87
|
+
const lines = `${(result && result.stdout) || ''}\n${(result && result.stderr) || ''}`
|
|
88
|
+
.split(/\r?\n/)
|
|
89
|
+
.map((line) => line.trim())
|
|
90
|
+
.filter(Boolean)
|
|
91
|
+
const picked = lines.filter((line) => /OVERALL|已落盘|INTEGRITY|记录数|段数|最终运行状态|恢复令/.test(line)).slice(-4)
|
|
92
|
+
const detail = (picked.length > 0 ? picked : lines.slice(-2)).join(' · ').slice(0, 500)
|
|
93
|
+
if (result && result.ok) return detail || `${action} 完成`
|
|
94
|
+
return `失败(exit ${result ? result.exitCode : '?'}):${detail || 'no output'}`
|
|
95
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/ai-prison-dsh-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "AI Prison for DSH: six governance tools wrapping the aiprison CLI (levels, 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",
|