@twinsearth/ai-prison-dsh-plugin 1.7.1 → 1.7.3
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 +43 -0
- package/README.md +19 -9
- package/docs/SUPPLY-CHAIN.md +166 -0
- package/lib/harness.js +1 -1
- package/lib/tools.js +29 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@twinsearth/ai-prison-dsh-plugin` are recorded here.
|
|
4
4
|
|
|
5
|
+
## [1.7.3] — 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Official tool API**: tools register through `ctx.tools.register(plainDefinition)`
|
|
10
|
+
first (Host `ToolDefinition` contract); `defineTool` from
|
|
11
|
+
`@deepseek-ai/dsh-tools` is now only a legacy fallback, so registration no
|
|
12
|
+
longer depends on installation-path guessing.
|
|
13
|
+
- **Artifact attestation**: the release workflow attests the npm tarball, the
|
|
14
|
+
six platform-lite tarballs and `SHA256SUMS` (`actions/attest-build-provenance`).
|
|
15
|
+
- **SignPath OSS signing wired**: conditional workflow steps upload the Windows
|
|
16
|
+
CLIs, request Authenticode signing (wait for completion), replace the binaries
|
|
17
|
+
and continue; without SignPath variables the build stays unsigned with an
|
|
18
|
+
explicit warning. Setup, variables and verification are documented in
|
|
19
|
+
`docs/SUPPLY-CHAIN.md`.
|
|
20
|
+
- **Full-platform distribution**: the release also builds six platform-lite
|
|
21
|
+
tarballs (1.37–1.56 MB each) next to the all-platform tarball, with checksums
|
|
22
|
+
and attestation; the npm package layout is unchanged.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- `scripts/pack-platform.mjs` gained `--all`, exported argument parsing, target
|
|
27
|
+
suffixes and three tests; release assets no longer overwrite each other.
|
|
28
|
+
|
|
29
|
+
## [1.7.2] — 2026-11-19
|
|
30
|
+
## [1.7.2] — 2026-11-19
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Entry-based installation anchors accept a non-absolute `argv[1]`; the 1.7.1
|
|
35
|
+
tag accidentally shipped without this portability change, so the harness
|
|
36
|
+
tests failed on ubuntu CI.
|
|
37
|
+
- `manifest.test.mjs` normalizes CRLF before comparing the embedded market icon
|
|
38
|
+
with `icon.svg`; `patch-docs.test.mjs` accepts `\r?\n` row separators, so a
|
|
39
|
+
Windows checkout with `autocrlf` no longer fails those assertions.
|
|
40
|
+
|
|
41
|
+
### Note
|
|
42
|
+
|
|
43
|
+
- 1.7.0 and 1.7.1 reached npm but their tag-triggered GitHub Releases failed on
|
|
44
|
+
the two test portability issues above; 1.7.2 is the complete three-channel
|
|
45
|
+
release.
|
|
46
|
+
|
|
47
|
+
## [1.7.1] — 2026-11-19
|
|
5
48
|
## [1.7.1] — 2026-11-19
|
|
6
49
|
|
|
7
50
|
### Fixed
|
package/README.md
CHANGED
|
@@ -109,25 +109,35 @@ library, `CGO_ENABLED=0`, no module downloads) and are not committed to git.
|
|
|
109
109
|
|
|
110
110
|
### Per-platform packaging (size)
|
|
111
111
|
|
|
112
|
-
The published tarball carries all six CLIs (about 8.8 MB packed). For a
|
|
113
|
-
single-machine deployment
|
|
114
|
-
|
|
112
|
+
The published npm tarball carries all six CLIs (about 8.8 MB packed). For a
|
|
113
|
+
single-machine deployment, build a platform-lite tarball that keeps only one
|
|
114
|
+
`bin/<platform>-<arch>/` tree:
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
117
|
cd dsh-plugin
|
|
118
118
|
node scripts/pack-platform.mjs --platform windows --arch amd64 --out ../dist
|
|
119
|
-
# prints { target, tarball, sizeMB,
|
|
120
|
-
node scripts/pack-platform.mjs --
|
|
119
|
+
# prints { target, tarball, sizeMB, platformBinaryMB, skippedTargets }
|
|
120
|
+
node scripts/pack-platform.mjs --all --out ../dist/platform-packs # six assets
|
|
121
|
+
node scripts/pack-platform.mjs --all --dry-run
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
The release workflow now builds all six lite tarballs, checksums them together
|
|
125
|
+
with the all-platform tarball, attests the whole set and attaches them to the
|
|
126
|
+
GitHub Release. The npm package keeps the all-platform layout: the lite
|
|
127
|
+
tarballs are an offline/air-gapped option, not a replacement for `npm install`.
|
|
127
128
|
|
|
128
129
|
On a platform without a bundled build, point `cliPath` / `AIPRISON_BIN` at a
|
|
129
130
|
binary built from `cmd/aiprison`.
|
|
130
131
|
|
|
132
|
+
## Supply chain
|
|
133
|
+
|
|
134
|
+
Tool registration uses the official `ctx.tools.register(plainDefinition)` seam
|
|
135
|
+
(`defineTool` remains only as a legacy fallback), and release artifacts get a
|
|
136
|
+
GitHub artifact attestation. Code signing (Windows Authenticode, macOS
|
|
137
|
+
notarization, Linux detached signatures) needs a certificate/upstream decision;
|
|
138
|
+
see [docs/SUPPLY-CHAIN.md](docs/SUPPLY-CHAIN.md) for the concrete options and
|
|
139
|
+
verification commands.
|
|
140
|
+
|
|
131
141
|
## Development
|
|
132
142
|
|
|
133
143
|
```bash
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Supply chain: official tool API, signing and provenance
|
|
2
|
+
|
|
3
|
+
Status: strategy document, 2026-11-19. Code signing needs a certificate/upstream
|
|
4
|
+
decision; everything in “Implemented now” already ships with 1.7.2.
|
|
5
|
+
|
|
6
|
+
## 1. Official Host API for tool registration
|
|
7
|
+
|
|
8
|
+
Fact from the installed DSH version (`cordis_inspect_query` → `tools` service):
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
register(definition: ToolDefinition, options?: ToolRegistrationOptions): () => void;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`ToolDefinition` is a plain object: `name`, `description`, `parameters`,
|
|
15
|
+
`output` and `execute`. `defineTool` from `@deepseek-ai/dsh-tools` is not part of
|
|
16
|
+
the required seam.
|
|
17
|
+
|
|
18
|
+
What the plugin does now:
|
|
19
|
+
|
|
20
|
+
1. `ctx.inject(['tools'])` → `child.tools.register(plainDefinition)` — official
|
|
21
|
+
path, no package-path guessing.
|
|
22
|
+
2. Only if that throws (older harness build) it falls back to
|
|
23
|
+
`defineTool(definition)` resolved through `lib/harness.js`.
|
|
24
|
+
3. The path-guessing anchors therefore no longer gate tool registration; they
|
|
25
|
+
are a best-effort compatibility fallback and never the primary code path.
|
|
26
|
+
|
|
27
|
+
Bundled packages resolve from the DSH installation and profile bundles from the
|
|
28
|
+
profile, so a bundle must not guess `@deepseek-ai/*` locations from
|
|
29
|
+
`$DSH_PROFILE_DIR` (see the installed DSH plugin-development documentation).
|
|
30
|
+
`lib/harness.js` remains only for the legacy fallback and is covered by tests.
|
|
31
|
+
|
|
32
|
+
## 2. Signing strategy (needs a certificate / upstream decision)
|
|
33
|
+
|
|
34
|
+
| Target | Recommended option | Requirements | Status |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| Windows `aiprison.exe` (6 builds) | Azure Trusted Signing (cheaper, CI-native) or an OV/EV Authenticode certificate; SignPath.io offers free OSS signing | Azure account/subscription or CA-issued cert; `signtool` with timestamp server | not signed |
|
|
37
|
+
| macOS `aiprison` | Apple Developer ID Application + `notarytool` (hardened runtime), staple the ticket | Apple Developer Program (~99 USD/year) | not signed/not notarized |
|
|
38
|
+
| Linux `aiprison` | Detached signature: `minisign`/`cosign` over `SHA256SUMS`, or upstream distro signing | maintainer key, published public key | checksums only |
|
|
39
|
+
| npm tarball | npm registry integrity (`sha512`) + GitHub Release `SHA256SUMS` | none (already done) | done |
|
|
40
|
+
| CI artifacts | GitHub artifact attestation (`actions/attest-build-provenance`) | public repo; `id-token`/`attestations` permissions | added in 1.7.2 workflow |
|
|
41
|
+
| npm provenance | `npm publish --provenance` from CI with OIDC | publish must move from a maintainer laptop into CI (currently manual due 2FA) | not enabled |
|
|
42
|
+
|
|
43
|
+
No private key belongs in the repository. Signing steps run in CI with secrets
|
|
44
|
+
(`WINDOWS_CERT_*`, `APPLE_ID_*`, `APPLE_TEAM_ID`, `APPLE_APP_PASSWORD` or a
|
|
45
|
+
self-hosted signer); the repo only documents and verifies the result.
|
|
46
|
+
|
|
47
|
+
### Verification users can run today
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# npm integrity (registry)
|
|
51
|
+
npm view @twinsearth/ai-prison-dsh-plugin@1.7.2 dist.integrity
|
|
52
|
+
|
|
53
|
+
# GitHub Release checksum
|
|
54
|
+
curl -LO https://github.com/TwinsEarth/Ai-PRISON/releases/download/dsh-plugin-v1.7.2/SHA256SUMS
|
|
55
|
+
sha256sum -c SHA256SUMS # or: Get-FileHash <tgz> -Algorithm SHA256
|
|
56
|
+
|
|
57
|
+
# per-platform lite tarball (unsigned, local build)
|
|
58
|
+
node dsh-plugin/scripts/pack-platform.mjs --platform windows --arch amd64
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Recommended rollout once a certificate exists
|
|
62
|
+
|
|
63
|
+
1. Windows: sign all six `aiprison.exe` in `scripts/build-binaries.mjs` before
|
|
64
|
+
the tarball is packed; verify with `Get-AuthenticodeSignature`.
|
|
65
|
+
2. macOS: codesign + notarize the two Mach-O builds, staple and verify with
|
|
66
|
+
`codesign --verify --strict` / `spctl -a`.
|
|
67
|
+
3. Publish `SHA256SUMS` plus a detached `SHA256SUMS.minisig`.
|
|
68
|
+
4. Move `npm publish` into the tag workflow with `--provenance` (removes the
|
|
69
|
+
manual 2FA step) once the release guard/approval policy allows it.
|
|
70
|
+
5. Add a CI check that fails when a Windows/macOS artifact is unsigned.
|
|
71
|
+
|
|
72
|
+
## 3. What remains open (honest list)
|
|
73
|
+
|
|
74
|
+
- No code-signing certificate is available to this project yet; the binaries
|
|
75
|
+
remain unsigned, and the README “Limitations” notes the Controlled Folder
|
|
76
|
+
Access / SmartScreen consequences.
|
|
77
|
+
- Official-API adoption is implemented (plain `register` first); the legacy
|
|
78
|
+
`defineTool` fallback can be removed after the minimum supported DSH version
|
|
79
|
+
is known to accept plain definitions everywhere.
|
|
80
|
+
- npm provenance requires publishing from CI, which conflicts with the current
|
|
81
|
+
manual/2FA publish flow; decide whether to move publishing.
|
|
82
|
+
|
|
83
|
+
## 4. Full-platform distribution strategy (P2-5)
|
|
84
|
+
|
|
85
|
+
**Current (implemented in the release workflow):**
|
|
86
|
+
|
|
87
|
+
| Channel | Artifact | Size |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| npm | one tarball with all six `bin/<platform>-<arch>/` trees | ~7.1 MB tgz (~8.8 MB unpacked) |
|
|
90
|
+
| GitHub Release | the same all-platform tarball **plus six lite tarballs** `<name>-<version>-<platform>-<arch>.tgz` | ~1.4–1.6 MB each |
|
|
91
|
+
| GitHub Release | `SHA256SUMS` covering the full tarball **and** the six lite ones | — |
|
|
92
|
+
| GitHub Release | artifact attestation over all tarballs + `SHA256SUMS` | — |
|
|
93
|
+
|
|
94
|
+
Lite tarballs are built with `scripts/pack-platform.mjs --all`; each keeps only
|
|
95
|
+
one binary tree and still contains the same Host/Client code, locale, docs and
|
|
96
|
+
manifest. They are meant for offline/air-gapped machines:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# on the target machine, after downloading the matching lite tarball
|
|
100
|
+
npm install ./twinsearth-ai-prison-dsh-plugin-<version>-windows-amd64.tgz
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Measured with 1.7.2: windows-amd64 1.56 MB, windows-arm64 1.40 MB,
|
|
104
|
+
macos-amd64 1.52 MB, macos-arm64 1.41 MB, linux-amd64 1.50 MB, linux-arm64 1.37 MB
|
|
105
|
+
(six together 8.8 MB, i.e. the same bytes as one all-platform tarball).
|
|
106
|
+
|
|
107
|
+
**Not done yet (needs a decision):** splitting the npm package itself into a
|
|
108
|
+
meta-package plus six `@twinsearth/ai-prison-cli-<platform>` optional
|
|
109
|
+
dependencies (the esbuild/swc pattern). That would cut a normal `npm install`
|
|
110
|
+
to ~1.5 MB, but it requires publishing seven packages, keeping their versions in
|
|
111
|
+
lockstep, and reworking the release/2FA flow. The all-platform npm package stays
|
|
112
|
+
the default until that is explicitly approved.
|
|
113
|
+
|
|
114
|
+
## 5. SignPath OSS signing (CI wired)
|
|
115
|
+
|
|
116
|
+
SignPath.io signs open-source Windows binaries for free. The release workflow
|
|
117
|
+
already contains the integration; it stays inactive until the repository is
|
|
118
|
+
configured, and prints a warning with an unsigned fallback otherwise.
|
|
119
|
+
|
|
120
|
+
### One-time SignPath setup
|
|
121
|
+
|
|
122
|
+
1. Apply to the [SignPath Foundation/OSS program](https://signpath.io/) and
|
|
123
|
+
install the SignPath GitHub app on `TwinsEarth/Ai-PRISON`.
|
|
124
|
+
2. Create an organization and a project for this repository.
|
|
125
|
+
3. Artifact configuration (ZIP-root paths):
|
|
126
|
+
- `windows-amd64/aiprison.exe`
|
|
127
|
+
- `windows-arm64/aiprison.exe`
|
|
128
|
+
The workflow uploads `dsh-plugin/bin/windows-*` as the `unsigned-windows-clis`
|
|
129
|
+
artifact; the artifact configuration signs every `aiprison.exe` with
|
|
130
|
+
Authenticode and returns the same layout under `signed-windows/`.
|
|
131
|
+
4. Create a signing policy (e.g. `release-signing`) with the Authenticode
|
|
132
|
+
signing tool; note the policy slug.
|
|
133
|
+
|
|
134
|
+
### Repository variables and secret
|
|
135
|
+
|
|
136
|
+
| Kind | Name | Value |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| Variable | `SIGNPATH_ORGANIZATION_ID` | SignPath organization id |
|
|
139
|
+
| Variable | `SIGNPATH_PROJECT_SLUG` | project slug |
|
|
140
|
+
| Variable | `SIGNPATH_SIGNING_POLICY_SLUG` | signing policy slug |
|
|
141
|
+
| Variable | `SIGNPATH_ARTIFACT_CONFIGURATION_SLUG` | artifact configuration slug |
|
|
142
|
+
| Secret | `SIGNPATH_API_TOKEN` | API token (never committed) |
|
|
143
|
+
|
|
144
|
+
### Workflow behavior
|
|
145
|
+
|
|
146
|
+
- Steps `Upload unsigned Windows CLIs`, `Sign Windows CLIs with SignPath` and
|
|
147
|
+
`Install signed Windows CLIs` run only when the two variables above are set;
|
|
148
|
+
the action is `signpath/github-action-submit-signing-request@v3` with
|
|
149
|
+
`wait-for-completion: true` and `output-artifact-directory: signed-windows`;
|
|
150
|
+
- the job needs `actions: read` (download the uploaded artifact) in addition to
|
|
151
|
+
`contents: read`;
|
|
152
|
+
- after a successful signing request the signed `aiprison.exe` files replace the
|
|
153
|
+
unsigned ones before tests, tarballs, checksums and attestation run;
|
|
154
|
+
- without credentials the steps are skipped and `::warning::` names this doc;
|
|
155
|
+
Windows binaries stay unsigned (current default).
|
|
156
|
+
|
|
157
|
+
### Verification once signing is active
|
|
158
|
+
|
|
159
|
+
```powershell
|
|
160
|
+
# on a Windows machine after downloading the release binary
|
|
161
|
+
Get-AuthenticodeSignature .\aiprison.exe | Format-List Status,SignerCertificate
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The GitHub Release attestation also covers the signed tarballs, so a verifier
|
|
165
|
+
can tie the artifact back to the workflow run (`gh attestation verify <tgz>
|
|
166
|
+
--repo TwinsEarth/Ai-PRISON`).
|
package/lib/harness.js
CHANGED
|
@@ -18,7 +18,7 @@ export function installationAnchors({ execPath = process.execPath, env = process
|
|
|
18
18
|
// The entry module (argv[1]) often sits either directly in the runtime root
|
|
19
19
|
// (…/app.asar/dsh/index.js) or in a subdirectory (…/dsh/dist/index.js). Both
|
|
20
20
|
// are useful anchors when execPath no longer points at the installation.
|
|
21
|
-
const entry = typeof argv[1] === 'string' &&
|
|
21
|
+
const entry = typeof argv[1] === 'string' && argv[1] ? argv[1] : undefined
|
|
22
22
|
const entryDir = entry ? path.dirname(entry) : undefined
|
|
23
23
|
const entryParent = entryDir ? path.dirname(entryDir) : undefined
|
|
24
24
|
const entryLooksLikeDsh = (candidate) => Boolean(candidate) && /(^|[\\/])(app\.asar|dsh|dsh-runtime)([\\/]|$)/.test(candidate)
|
package/lib/tools.js
CHANGED
|
@@ -97,17 +97,39 @@ function toolResult(payload) {
|
|
|
97
97
|
return JSON.stringify(payload, null, 2)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Register one tool definition.
|
|
102
|
+
*
|
|
103
|
+
* The official Host API is `ctx.tools.register(definition)` and accepts a plain
|
|
104
|
+
* ToolDefinition (name/description/parameters/output/execute). `defineTool` from
|
|
105
|
+
* @deepseek-ai/dsh-tools is only a compatibility fallback for older harness
|
|
106
|
+
* builds; resolving it by guessing an installation path must never be required.
|
|
107
|
+
*/
|
|
108
|
+
export function registerToolDefinition(tools, definition, { defineTool } = {}) {
|
|
109
|
+
try {
|
|
110
|
+
tools.register(definition)
|
|
111
|
+
return 'plain'
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (typeof defineTool !== 'function') throw error
|
|
114
|
+
tools.register(defineTool(definition))
|
|
115
|
+
return 'fallback'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
100
119
|
export async function installTools({ ctx, config = {}, logger } = {}) {
|
|
101
120
|
if (!ctx || typeof ctx.inject !== 'function') {
|
|
102
121
|
logger?.warn?.('ctx.inject 不可用,跳过 aiprison_* 工具注册')
|
|
103
122
|
return false
|
|
104
123
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
// Official API first: ctx.tools.register accepts a plain ToolDefinition.
|
|
125
|
+
// defineTool is loaded lazily only as a fallback for older harness builds.
|
|
126
|
+
let defineTool
|
|
127
|
+
try {
|
|
128
|
+
const loaded = await loadDefineTool()
|
|
129
|
+
defineTool = loaded && loaded.defineTool
|
|
130
|
+
} catch {
|
|
131
|
+
defineTool = undefined
|
|
109
132
|
}
|
|
110
|
-
const { defineTool } = loaded
|
|
111
133
|
const stringOutput = {
|
|
112
134
|
schema: { type: 'string' },
|
|
113
135
|
render: (_args, value) => [{ type: 'text', text: String(value) }],
|
|
@@ -120,7 +142,8 @@ export async function installTools({ ctx, config = {}, logger } = {}) {
|
|
|
120
142
|
ctx.inject(['tools'], (child) => {
|
|
121
143
|
const register = (definition) => {
|
|
122
144
|
try {
|
|
123
|
-
child.tools
|
|
145
|
+
const mode = registerToolDefinition(child.tools, definition, { defineTool })
|
|
146
|
+
if (mode === 'fallback') logger?.info?.(`工具 ${definition.name} 使用 defineTool 兼容路径注册`)
|
|
124
147
|
} catch (error) {
|
|
125
148
|
logger?.warn?.(`注册工具 ${definition.name} 失败:${String(error && error.message)}`)
|
|
126
149
|
}
|
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.3",
|
|
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",
|