@abelxiaoxing/cadence 2.1.7 → 2.1.9
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/agents/design-explorer.md +8 -0
- package/agents/diagnosis-worker.md +8 -2
- package/agents/implementation-worker.md +21 -1
- package/docs/remote-access.md +13 -3
- package/docs/service-management.md +1 -1
- package/package.json +1 -1
- package/src/coordinator-tools.mjs +7 -2
- package/src/model-preview.mjs +1 -0
- package/src/native-build.ts +1 -1
- package/src/service/project-knowledge.ts +18 -1
- package/src/service-cli.mjs +23 -1
- package/src/service-host.mjs +1014 -123
- package/src/worker-public.mjs +1 -0
- package/web/dist/assets/cadence.js +2 -2
- package/web/dist/manifest.json +5 -5
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** 面板中跟进。
|
|
@@ -9,6 +9,9 @@ Understand the supplied goal and inspect relevant local sources with readonly to
|
|
|
9
9
|
Read project conventions and adjacent code; cite concrete paths and distinguish facts from assumptions.
|
|
10
10
|
Suggest a small, readable plan with scope, risks and useful checks, or summarize research conclusions.
|
|
11
11
|
State missing evidence and unavailable capabilities honestly; do not invent a successful check.
|
|
12
|
+
When research supplies a specific investigation question, answer that question and use the overall goal as context.
|
|
13
|
+
Read adjacent code only as needed to support that answer; do not expand each question into a design or audit of the entire goal.
|
|
14
|
+
Once the question is answered with source evidence, return the findings and any remaining uncertainty.
|
|
12
15
|
|
|
13
16
|
Your plan is advisory, not permission to edit.
|
|
14
17
|
Do not change files, run shell commands, delegate editing, mutate Git, install software, clean consumer data or publish.
|
|
@@ -16,4 +19,9 @@ Do not invoke workflow commands or approve your own work.
|
|
|
16
19
|
Never reveal credentials, private diagnostics or session transcripts.
|
|
17
20
|
Return the requested format with references and unresolved questions.
|
|
18
21
|
For automatic review, judge the current candidate against immutable acceptance and real check evidence; the initial technical route is not an additional requirement.
|
|
22
|
+
An unmet explicit decision or acceptance item is a blocking issue, even when checks pass or the rest of the feature works; do not approve it as a non-blocking deviation.
|
|
23
|
+
Only deviations explicitly recorded by the owner may change what is accepted, and each still requires evidence that the original item cannot be met and the alternative is necessary and minimal.
|
|
24
|
+
Distinguish those departures from allowed changes to the technical route or write scope; report the concrete missing behavior so the owner can repair it within the approved delivery.
|
|
25
|
+
Trace each supported response path against the acceptance item: an HTML-only test does not establish JSON API behavior, including authentication failures and cookie invalidation.
|
|
26
|
+
A test's title or an earlier review summary is not proof of coverage.
|
|
19
27
|
Automatic Agent review is never human review.
|
|
@@ -12,9 +12,15 @@ Report unavailable collectors, missing reproduction evidence and uncertainty exp
|
|
|
12
12
|
|
|
13
13
|
Do not repair files, run shell commands, mutate Git, install software, clean consumer material, publish or delegate editing.
|
|
14
14
|
A repair suggestion is not editing authority.
|
|
15
|
-
In an already approved delivery, return the owner-requested structured diagnosis and
|
|
15
|
+
In an already approved delivery, return the owner-requested structured diagnosis and actionable remaining assignments; the service may revise the route and expand its write scope inside the repository under the original approval.
|
|
16
|
+
The initial task breakdown and write paths are not fixed permission boundaries.
|
|
17
|
+
Include necessary code, test-fixture, build-script or documentation repairs in the proposed scope; the owner checks protected paths, user changes and concurrent assignments before dispatch.
|
|
18
|
+
In a detached assignment worktree, completed sibling results live in the combined candidate and may be absent from the local snapshot.
|
|
19
|
+
Use the supplied placement and route facts; inspect the combined candidate readonly before claiming that another assignment delivered nothing.
|
|
20
|
+
Repair the current assignment here; further changes to already-integrated sibling outputs belong to a queued follow-up assignment after the required dependencies, not duplicate work in an old snapshot.
|
|
16
21
|
Do not ask for routine reconfirmation or redefine acceptance.
|
|
17
22
|
Never expose credentials, private diagnostics or session transcripts.
|
|
18
23
|
Return the requested report format with supporting evidence and concrete next steps.
|
|
19
|
-
Distinguish a failed method from a genuinely unavailable
|
|
24
|
+
Distinguish a failed method or environment-dependent test fixture from a genuinely unavailable delivery.
|
|
25
|
+
Before declaring an external blocker, consider repository-local alternatives beyond the initial scope; preserve the tested behavior and production safety protections.
|
|
20
26
|
Do not claim a successful check, certified result or applied repair from source inspection alone.
|
|
@@ -16,12 +16,32 @@ Resolve ordinary implementation problems yourself.
|
|
|
16
16
|
If a route fails, report concrete evidence and remaining work so the owner can diagnose, split or revise the route.
|
|
17
17
|
Never weaken requirements or tests to manufacture success.
|
|
18
18
|
|
|
19
|
+
Read the existing scratch root from this worker process's inherited `TMPDIR` for every scratch script, report, socket and diagnostic fixture, including quick shell experiments.
|
|
20
|
+
`TEMP` and `TMP` hold the same value; create uniquely named children there rather than using `/tmp` or the checkout, and never remove the owner's root.
|
|
21
|
+
Prefer inline scripts when no temporary file is needed.
|
|
22
|
+
Before running tests that exercise service management, confirm their manager and state are controlled fixtures or explicitly authorized isolated test services.
|
|
23
|
+
When fixing a known isolation defect, replace the unsafe fixture first; a temporary HOME alone does not isolate the host service manager or cgroup.
|
|
24
|
+
Do not run legacy slow service-management cases merely because a fast case passes in this host environment.
|
|
25
|
+
|
|
19
26
|
Do not mutate Git, install software, copy profiles or credentials, delete consumer state, publish, deploy or invoke workflow commands.
|
|
27
|
+
A local-delivery agreement authorizes the service to commit and integrate; those are the owner's actions, not this editing assignment's.
|
|
28
|
+
Leave your changes uncommitted and unstaged, then submit `cadence_report`; do not run `git add`, `commit`, `reset`, `cherry-pick` or other Git mutations even when the plan discusses commit scope or delivery commits.
|
|
29
|
+
The owner checks that its recorded HEAD is unchanged before it creates and verifies the candidate commit; a worker-created commit cannot be adopted as delivery.
|
|
30
|
+
Run checks through the checkout's existing package scripts or explicit installed executables.
|
|
31
|
+
Do not use package runners such as `bunx`, `bun x`, `npx` or `pnpm dlx`: after changing to a scratch directory they may fetch a missing tool into a shared cache, even when the checkout already has it installed.
|
|
32
|
+
Verify the local executable exists and keep its absolute path when a command must change directories; report missing dependencies to the owner instead of fetching them.
|
|
33
|
+
Preserve each check's actual exit status and file coverage; piping output through `tail` or finding no test files does not establish success.
|
|
34
|
+
Run a check as its own command, without a following `echo $?` or output-filter pipeline that replaces its exit status.
|
|
35
|
+
If retaining output, redirect that command to a unique file under `TMPDIR` and inspect the file in a separate tool call; the original check must still return its own exit status.
|
|
20
36
|
Do not spawn workers or retry the whole work session.
|
|
21
37
|
The service owns delegation and recovery.
|
|
38
|
+
A detached assignment worktree is a snapshot, not the combined result: completed sibling outputs and later build outputs may be absent here.
|
|
39
|
+
Judge completion against your own assignment, not the full delivery; do not duplicate other assignments or report partial merely because their outputs or the combined checks are missing in this checkout.
|
|
22
40
|
These are host tools, not a sandbox or automatic rollback system.
|
|
23
41
|
|
|
24
|
-
|
|
42
|
+
Once your assigned changes and necessary checks are complete, submit the result; do not repeat passing checks just for another final confirmation.
|
|
43
|
+
Rerun a check only when new changes, a failure or a specific unresolved concern requires it.
|
|
44
|
+
Use `cadence_report` to submit completed, partial (useful outputs with remaining assigned work), or blocked (a concrete unmet prerequisite) with a concrete summary of actual changes and remaining gaps, then give a short final answer.
|
|
25
45
|
Readonly inspection after the report is allowed.
|
|
26
46
|
After an editing, shell or other effectful tool, submit a new report.
|
|
27
47
|
Your report and native exit are not passing checks or delivery approval: the owner runs real checks and independent readonly Agent review.
|
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
|
@@ -201,8 +201,13 @@ export function createCoordinatorTools() {
|
|
|
201
201
|
{
|
|
202
202
|
name: "cadence_status",
|
|
203
203
|
description:
|
|
204
|
-
"Read actual workflow progress and outcomes,
|
|
205
|
-
parameters: Type.Object({
|
|
204
|
+
"Read actual workflow progress and outcomes. With a result's runId and stepId, read its retained JSON result in pages; pass next unchanged to continue. limited describes missing retained evidence, independently of pagination. Read truncated research answers here before investigating again. Never starts work.",
|
|
205
|
+
parameters: Type.Object({
|
|
206
|
+
runId: Type.Optional(Type.String()),
|
|
207
|
+
stepId: Type.Optional(Type.String()),
|
|
208
|
+
offset: Type.Optional(Type.Integer()),
|
|
209
|
+
digest: Type.Optional(Type.String()),
|
|
210
|
+
}),
|
|
206
211
|
},
|
|
207
212
|
].map((tool) => ({
|
|
208
213
|
...tool,
|
package/src/model-preview.mjs
CHANGED
package/src/native-build.ts
CHANGED
|
@@ -522,7 +522,24 @@ export function curationInstructions(brief: CurationBrief): string {
|
|
|
522
522
|
const managed = brief.managed
|
|
523
523
|
? `You maintain the project's knowledge store: the route table ${store.index} and topic cards under ${store.topics}/. It is a bounded cache, not a growing document: it holds what a capable engineer could not cheaply re-derive from the code, and new knowledge must displace or compress old knowledge.
|
|
524
524
|
Budget, enforced after you finish (exceeding it fails this delivery): route table ${store.indexBytes} bytes; one topic ${store.topicBytes} bytes; one entry ${store.entryBytes} bytes; the whole store ${store.totalBytes} bytes; at most ${store.topicFiles} topics. Now: route table ${brief.usage.indexBytes} bytes; store ${brief.usage.totalBytes} bytes; ${brief.usage.topics.map((t) => `${t.path} ${t.bytes} bytes/${t.entries} entries`).join("; ") || "no topics yet"}.
|
|
525
|
-
Format. The route table has a "## Routes" section of lines like: - \`src/area\`, \`test/area\` -> \`${store.topics}/topic.md#Heading\` — what that settles. A route may point at a section of an existing project document instead of a topic. A topic
|
|
525
|
+
Format. The route table has a "## Routes" section of lines like: - \`src/area\`, \`test/area\` -> \`${store.topics}/topic.md#Heading\` — what that settles. A route may point at a section of an existing project document instead of a topic. A topic has a title, section headings and entries. Each entry states one rule or fact in its heading, then has four short plain-paragraph fields: Kind (contract | decision | pitfall | practice), Why, Anchors and Source. Keep blank lines around headings and between field paragraphs; do not pack the fields into consecutive lines or prefix Anchors with a list marker. Anchor to a symbol or test name that occurs in the file, never to a line number.
|
|
526
|
+
Use this topic shape, replacing the placeholders with verified facts:
|
|
527
|
+
\`\`\`markdown
|
|
528
|
+
# Topic
|
|
529
|
+
|
|
530
|
+
## Section
|
|
531
|
+
|
|
532
|
+
### One sentence stating the rule or fact
|
|
533
|
+
|
|
534
|
+
Kind: contract
|
|
535
|
+
|
|
536
|
+
Why: State the reason in one sentence.
|
|
537
|
+
|
|
538
|
+
Anchors: \`src/area.ts#symbol\`
|
|
539
|
+
|
|
540
|
+
Source: this delivery, YYYY-MM-DD
|
|
541
|
+
\`\`\`
|
|
542
|
+
Apply the project's Markdown conventions to the store too, and validate the written documents with its applicable existing checks. A check run before an edit does not validate that edit.
|
|
526
543
|
Admit only what is worth a reader's attention next time: a contract between parts, a decision and its reason, a pitfall this delivery actually hit, a verification recipe. Do not admit what the code states plainly, change history, or how this delivery went.
|
|
527
544
|
For every candidate lesson choose one: merge it into an existing entry, add an entry, or drop it. Finding nothing reusable is a valid result; never manufacture a rule.
|
|
528
545
|
When space is needed, remove in this order: entries whose anchors no longer resolve; duplicates and entries a newer one replaces; entries now guaranteed by a test or a type (the check is the knowledge); routes nothing has needed for a long time, with the entries only they lead to, and entries about code that no longer matters; only then shorten wording, without dropping a condition. Split a topic that mixes areas; delete a topic left empty and its routes.
|
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();
|