@abelxiaoxing/cadence 2.1.8 → 2.1.10
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/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/docs/remote-access.md +13 -3
- package/docs/service-management.md +1 -1
- package/package.json +18 -16
- package/src/model-preview.mjs +1 -0
- package/src/native-build.ts +1 -1
- package/src/service-cli.mjs +23 -1
- package/src/service-host.mjs +591 -80
- package/src/worker-public.mjs +1 -0
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +3 -3
- package/web/dist/manifest.json +7 -7
package/README.md
CHANGED
|
@@ -66,7 +66,9 @@ The token grants access to your workspace: keep the link private.
|
|
|
66
66
|
|
|
67
67
|
### Browser
|
|
68
68
|
|
|
69
|
-
1. Open the
|
|
69
|
+
1. Open the ordinary address (for example `http://127.0.0.1:17423`) and enter your access key.
|
|
70
|
+
This browser stays signed in for up to a year, including after service restarts, while the token and cookie remain valid.
|
|
71
|
+
The printed private link still works (`cadence token-link --reveal` prints it again).
|
|
70
72
|
2. Pick a working folder with the lower-right button.
|
|
71
73
|
3. Send `/cadence [goal]`, then answer the clarifying questions.
|
|
72
74
|
4. Click **Implement this plan** and follow the board and the **Subagents** dock.
|
package/README.zh-CN.md
CHANGED
|
@@ -66,7 +66,9 @@ cadence server install # 可选的 WebUI 与开机服务
|
|
|
66
66
|
|
|
67
67
|
### 浏览器
|
|
68
68
|
|
|
69
|
-
1.
|
|
69
|
+
1. 打开普通地址(例如 `http://127.0.0.1:17423`)并输入访问口令。
|
|
70
|
+
同一浏览器、同一地址、令牌未变且 Cookie 有效时,最长一年内无需重新输入,重启服务后也继续有效。
|
|
71
|
+
原有私有链接仍可使用(`cadence token-link --reveal` 可再次打印)。
|
|
70
72
|
2. 用右下角按钮选择工作文件夹。
|
|
71
73
|
3. 发送 `/cadence [目标]`,回答澄清问题。
|
|
72
74
|
4. 点击 **Implement this plan**,在看板和 **Subagents** 面板中跟进。
|
package/docs/remote-access.md
CHANGED
|
@@ -48,10 +48,19 @@ Audit any additional proxy-generated forwarding headers against the exact backen
|
|
|
48
48
|
HTTP and WebSocket upgrade must use the same authenticated route; no public backend bypass or insecure credential-bearing HTTP.
|
|
49
49
|
This example does not install Caddy, provision DNS/certificates, change a firewall or deploy a service.
|
|
50
50
|
|
|
51
|
-
Use `cadence-service token-link --workspace /absolute/project --reveal` to reveal a private entry link deliberately
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
Use `cadence-service token-link --workspace /absolute/project --reveal` to reveal a private entry link deliberately.
|
|
52
|
+
The background service prints its link at `cadence server install` and `restart`.
|
|
53
|
+
Unauthenticated `GET /` and `GET /app` answer 401 with a script-free password page (no script, no value backfill, no storage) that posts the key to `POST /auth`.
|
|
54
|
+
That page is the only `Referrer-Policy: same-origin` response, so a browser native form submits a valid Origin.
|
|
55
|
+
A correct key sets the `HttpOnly` `SameSite=Strict` cookie for one year (`Max-Age=31536000`) and 303s to the sanitized entry.
|
|
56
|
+
A wrong key redirects to the error page with a neutral notice and expires any stale cookie it carried; a sanitized `next` parameter preserves the selected project for another attempt.
|
|
57
|
+
Only the root `GET /?token=` bootstrap still accepts query credentials, and it sets the same one-year cookie.
|
|
58
|
+
Subsequent private reads, exports and WS use that cookie.
|
|
59
|
+
Browser mutations/readonly POSTs require exact Origin and CSRF.
|
|
60
|
+
`POST /auth` requires a present, exact Origin (missing/`null`/external is 403).
|
|
61
|
+
Access does not grant Start/check/review consent.
|
|
54
62
|
A bad explicit token refuses even with an older cookie.
|
|
63
|
+
An invalid or rotated cookie is answered 401 (password page for HTML acceptors, JSON otherwise) and the cookie is expired.
|
|
55
64
|
Never put provider credentials in a browser or URL.
|
|
56
65
|
|
|
57
66
|
`token-rotate` invalidates old links/cookies, pending grants, authenticated sockets and incomplete downloads without canceling admitted tasks.
|
|
@@ -68,6 +77,7 @@ Use the same `proxy.origin` and trusted immediate proxy addresses as above; the
|
|
|
68
77
|
The selected policy is retained in private workbench state, so after orderly `cadence workbench stop` a default `cadence server install` can register that entry without a project or a default workspace.
|
|
69
78
|
Do not install over an independently running detached entry; stop it explicitly first.
|
|
70
79
|
The gateway authenticates and validates Host/Origin before routing, rejects browser local-capability headers and management paths, and forwards project requests with browser cookies, not native authority.
|
|
80
|
+
Its unauthenticated `GET /` and `GET /app?project=` answer the same script-free 401 password page and `POST /auth` one-year cookie login as the owner; the sanitized entry preserves the `?project=` parameter.
|
|
71
81
|
Project attachment IDs, owner CSRF/build compatibility, consent, retained read proofs and exports remain owner-validated.
|
|
72
82
|
A workbench token rotation revokes its routes and retires its exact browser viewers without cancelling admitted project work.
|
|
73
83
|
Project ports, backend cookies and local capabilities remain server-side.
|
|
@@ -185,7 +185,7 @@ After `npm install -g`, `pi install "$(npm root -g)/@abelxiaoxing/cadence"` reco
|
|
|
185
185
|
Pi's own package install (`pi install npm:@abelxiaoxing/cadence`) also loads the native client and supports the WebUI update route above, but its copy puts no `cadence` on `PATH`; if you want the optional boot service, register it with `node ~/.pi/agent/npm/node_modules/@abelxiaoxing/cadence/src/service-cli.mjs server install`.
|
|
186
186
|
Keep one copy: two copies drift apart on upgrade, and a native client refuses an owner whose service contract differs from its own.
|
|
187
187
|
A unit registered by an earlier version's Pi install hook keeps running; `cadence server restart` from the copy you keep rewrites it, and `pi update` no longer restarts it.
|
|
188
|
-
Opening the private link once leaves an HttpOnly cookie in that browser; the address without the token
|
|
188
|
+
Opening the private link once leaves an HttpOnly `SameSite=Strict` cookie in that browser for one year; the address without the token shows a script-free password page that posts the key to `POST /auth` (a correct key sets the same one-year cookie).
|
|
189
189
|
|
|
190
190
|
### Port and token
|
|
191
191
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abelxiaoxing/cadence",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"description": "Conversation-driven Pi workspace: persistent native and WebUI workflows, explicit plan approval, checks and local delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -140,34 +140,36 @@
|
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@biomejs/biome": "^2.4.16",
|
|
142
142
|
"@earendil-works/pi-tui": "1.5.0",
|
|
143
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
143
144
|
"@types/node": "^22.15.3",
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"vitest": "^4.1.8",
|
|
145
|
+
"@types/react": "19.3.0",
|
|
146
|
+
"@types/react-dom": "19.3.0",
|
|
147
147
|
"@types/ws": "8.18.1",
|
|
148
|
+
"@vitejs/plugin-react": "6.1.1",
|
|
149
|
+
"highlight.js": "11.12.0",
|
|
150
|
+
"katex": "0.18.7",
|
|
151
|
+
"mdast-util-from-markdown": "2.0.3",
|
|
152
|
+
"mdast-util-math": "3.0.0",
|
|
153
|
+
"micromark-util-types": "2.0.2",
|
|
148
154
|
"react": "19.3.0",
|
|
149
155
|
"react-dom": "19.3.0",
|
|
150
156
|
"react-icons": "5.7.0",
|
|
151
|
-
"@types/react": "19.3.0",
|
|
152
|
-
"@types/react-dom": "19.3.0",
|
|
153
157
|
"react-markdown": "10.1.0",
|
|
154
|
-
"remark-gfm": "4.0.1",
|
|
155
|
-
"remark-breaks": "4.0.0",
|
|
156
|
-
"remark-math": "6.0.0",
|
|
157
158
|
"rehype-highlight": "7.0.2",
|
|
158
159
|
"rehype-katex": "7.0.1",
|
|
159
160
|
"rehype-raw": "7.0.0",
|
|
160
161
|
"rehype-sanitize": "6.0.0",
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
162
|
+
"remark-breaks": "4.0.0",
|
|
163
|
+
"remark-gfm": "4.0.1",
|
|
164
|
+
"remark-math": "6.0.0",
|
|
164
165
|
"remark-parse": "11.0.0",
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
166
|
+
"rumdl": "^0.2.10",
|
|
167
|
+
"tailwindcss": "^4.3.5",
|
|
168
|
+
"typescript": "^6.0.3",
|
|
169
|
+
"unified": "11.0.5",
|
|
168
170
|
"vis-timeline": "8.5.4",
|
|
169
171
|
"vite": "8.3.0",
|
|
170
|
-
"
|
|
172
|
+
"vitest": "^4.1.8"
|
|
171
173
|
},
|
|
172
174
|
"repository": {
|
|
173
175
|
"type": "git",
|
package/src/model-preview.mjs
CHANGED
package/src/native-build.ts
CHANGED
package/src/service-cli.mjs
CHANGED
|
@@ -193,6 +193,7 @@ var LIMITS = Object.freeze({
|
|
|
193
193
|
stopWaitMs: 60000,
|
|
194
194
|
authValidityMarginMs: 120000,
|
|
195
195
|
browserLifetimeMs: 12 * 60 * 60 * 1000,
|
|
196
|
+
cookieLifetimeMs: 365 * 24 * 60 * 60 * 1000,
|
|
196
197
|
terminateGraceMs: 1000,
|
|
197
198
|
unconfirmedStopMs: 3000,
|
|
198
199
|
graphBytes: 512 * 1024,
|
|
@@ -4249,7 +4250,28 @@ class HttpAuthentication {
|
|
|
4249
4250
|
throw new ContractError("forbidden");
|
|
4250
4251
|
if (!this.material.matches(value))
|
|
4251
4252
|
throw new ContractError("unauthenticated");
|
|
4252
|
-
return buildTokenCookie(this.cookieName, encodeURIComponent(value), LIMITS.
|
|
4253
|
+
return buildTokenCookie(this.cookieName, encodeURIComponent(value), LIMITS.cookieLifetimeMs / 1000, boundary.secure);
|
|
4254
|
+
}
|
|
4255
|
+
login(value, boundary) {
|
|
4256
|
+
this.material.assertCurrent();
|
|
4257
|
+
const origin = boundary.headers.get("origin");
|
|
4258
|
+
if (origin === undefined || origin !== boundary.origin)
|
|
4259
|
+
throw new ContractError("forbidden");
|
|
4260
|
+
if (!this.material.matches(value))
|
|
4261
|
+
throw new ContractError("unauthenticated");
|
|
4262
|
+
return buildTokenCookie(this.cookieName, encodeURIComponent(value), LIMITS.cookieLifetimeMs / 1000, boundary.secure);
|
|
4263
|
+
}
|
|
4264
|
+
clearCookie(secure) {
|
|
4265
|
+
return buildTokenCookie(this.cookieName, "", 0, secure);
|
|
4266
|
+
}
|
|
4267
|
+
carriesCookie(header) {
|
|
4268
|
+
if (!header)
|
|
4269
|
+
return false;
|
|
4270
|
+
for (const part of header.split(";")) {
|
|
4271
|
+
if (part.trim().split("=")[0] === this.cookieName)
|
|
4272
|
+
return true;
|
|
4273
|
+
}
|
|
4274
|
+
return false;
|
|
4253
4275
|
}
|
|
4254
4276
|
authenticate(boundary, attachmentId, mutation = false, websocket = false) {
|
|
4255
4277
|
this.material.assertCurrent();
|