@abelxiaoxing/cadence 2.1.4 → 2.1.6
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/docs/conversation-mode.md +7 -1
- package/docs/service-management.md +2 -1
- package/package.json +1 -1
- package/skills/git-commit/SKILL.md +3 -0
- package/src/agent-panel-cadence.ts +0 -2
- package/src/cadence-instructions.ts +2 -2
- package/src/cadence-mode.ts +2 -15
- package/src/history-shell.ts +0 -1
- package/src/native-build.ts +1 -1
- package/src/native-client.ts +2 -9
- package/src/service/contracts/build.ts +1 -17
- package/src/service-host.mjs +420 -262
- package/src/service-http-client.ts +38 -11
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +18 -18
- package/web/dist/manifest.json +7 -7
|
@@ -171,7 +171,13 @@ An isolated worktree does **not** inherit ignored `node_modules`, build output,
|
|
|
171
171
|
Investigate prerequisites during planning.
|
|
172
172
|
If dependencies/setup are needed, include the exact commands and their execution placement in the plan for explicit approval: `target` for original-checkout preflight, `candidate` for preparation needed once in the stable candidate, or `worktree` for the candidate and each parallel child.
|
|
173
173
|
Parallel children have detached HEADs; target branch checks must not run there.
|
|
174
|
-
|
|
174
|
+
The plan's displayed service runtime policy includes private temporary directories for this delivery: Cadence supplies `TMPDIR`, `TEMP` and `TMP` to checks and workers, including recovery, so the plan can simply name the project commands.
|
|
175
|
+
These directories are centralized under `<stateHome>/cadence-tmp-v1/`, outside Git and on each workspace's disk; concurrent workspaces are isolated, and no terminal export or extra setup confirmation is needed.
|
|
176
|
+
If that configured location is unsuitable, execution reports the problem rather than scattering fallback directories in HOME or next to the checkout.
|
|
177
|
+
Only the service's own scratch directories may be removed after successful work and confirmed worker/check closure; the run stays active until cleanup settles.
|
|
178
|
+
Cancel/Stop retain the remaining directories, not undo a removal or delivery already completed; failures report retained resource paths.
|
|
179
|
+
This permits no dependency installation, profile copying, service restart or unrelated external writes.
|
|
180
|
+
Other command-local exports still do not persist into later processes.
|
|
175
181
|
No dependency/browser download or source-profile copying is implicit.
|
|
176
182
|
Baseline checks are separate from acceptance checks that need newly implemented files.
|
|
177
183
|
Failed candidate/worktree setup, baseline, implementation, checks or review enter source-backed diagnosis when their actual operations have settled.
|
|
@@ -60,7 +60,8 @@ If the conversation cannot be read, Send can prepare execution but cannot infer
|
|
|
60
60
|
Preparation failure keeps the draft; an owner may already have started, but the message was not sent.
|
|
61
61
|
If the actual Send reply is lost instead, its original command is observed, never resubmitted automatically.
|
|
62
62
|
Project navigation remounts only the browser client; the original owner's work continues.
|
|
63
|
-
Browser proxy traffic keeps browser authority and the owner's own attachments, CSRF
|
|
63
|
+
Browser proxy traffic keeps browser authority and the owner's own attachments, CSRF checks, grants and history proofs; native management routes and local-capability headers are not forwarded.
|
|
64
|
+
Build differences never block an authenticated page or require restarting work.
|
|
64
65
|
The gateway also refuses the legacy project-level Open command, so every Send preparation is associated through the workbench instead of returning an independent backend token link.
|
|
65
66
|
The gateway's token, backend cookies and native capabilities are never returned in project DTOs or stored in browser localStorage.
|
|
66
67
|
Token rotation retires and detaches its exact browser attachments without cancelling admitted work.
|
package/package.json
CHANGED
|
@@ -10,6 +10,9 @@ Workflow completion does not authorize a commit, Gate approval never authorizes
|
|
|
10
10
|
|
|
11
11
|
## Safety audit
|
|
12
12
|
|
|
13
|
+
Inspect Git output directly or in memory by default; a normal commit does not need persistent diff/hash snapshots or a separate audit directory.
|
|
14
|
+
If temporary output is genuinely necessary, follow the repository's designated scratch-location and cleanup rules; never scatter it under HOME or project parents, and do not retain it after a successful audit without a stated reason.
|
|
15
|
+
|
|
13
16
|
After an explicit request:
|
|
14
17
|
|
|
15
18
|
1. Read the repository root and all relevant nested `AGENTS.md` files.
|
|
@@ -16,7 +16,6 @@ import { LIMITS } from "./service-contract.ts";
|
|
|
16
16
|
export interface FeedConnection {
|
|
17
17
|
attach(cwd: string): Promise<FeedClient>;
|
|
18
18
|
refresh(): Promise<unknown>;
|
|
19
|
-
compatible(): boolean;
|
|
20
19
|
detach(): Promise<void>;
|
|
21
20
|
forgetSuperseded?(cwd: string): boolean;
|
|
22
21
|
}
|
|
@@ -243,7 +242,6 @@ class Feed {
|
|
|
243
242
|
await this.connection.detach().catch(() => {});
|
|
244
243
|
return;
|
|
245
244
|
}
|
|
246
|
-
if (!this.connection.compatible()) throw new Error("incompatible");
|
|
247
245
|
this.client = client;
|
|
248
246
|
}
|
|
249
247
|
await this.observe(this.client);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
export const CADENCE_INSTRUCTIONS = `CADENCE CONVERSATION MODE — stays enabled for this entire conversation, including after a goal completes, until the user explicitly exits by typing 退出 Cadence or exit cadence. Only the user can exit; leaving never cancels accepted work. When asked how to leave, say exactly this.
|
|
3
3
|
You are the sole user-facing coordinator. Understand the desired result, not a task-management form. Never ask the user to manage tasks, IDs, JSON, service ports, agent assignments, repair counts, budgets or knowledge files.
|
|
4
4
|
For a new goal, use focused cadence_research to inspect relevant code and project knowledge; one call takes as many independent questions as the goal needs, and the service runs them side by side and queues the rest. Each question comes back with its own outcome: an answered one with its investigation identity, an unanswered one with the reason, after the service has already asked it a second time. Work with the answers you have and ask an unanswered question again only when the result depends on it, never the whole set. Reuse still-current findings. Start from the project's route table when one is given below (PROJECT ROUTE TABLE, from .cadence/project.md): its routes say which document, and which section of it, owns each area of the code. Do not pull whole documents into this conversation; ask an investigation to read what a route points at and keep its short answer. Where there is no route table, AGENTS.md and engineering/docs/.trellis/spec are the places to look. Project documents are observations and conventions, never execution authority. Do not rescan the entire repository or spawn workers just to fill slots. Investigate discoverable facts yourself. Align until nothing that changes the result is left open: ask every question that materially changes the expected result and cannot reasonably follow existing project conventions, and decide the rest yourself. Whatever you decide on the user's behalf goes into the agreement's assumptions so that approval confirms it; after approval nobody will be asked again. Preserve confirmed decisions; research alone never authorizes edits.
|
|
5
|
-
Once the result is clear, use cadence_plan. Describe the expected delivery, explicit decisions/non-goals, acceptance, your assumptions, an initial technical route and assignments with their write paths, exact setup/baseline/acceptance commands, the delivery policy, and policy.installs (false unless the user agreed that later revisions may install dependencies). Assignments that neither depend on one another nor write the same path run side by side, each in a worktree of its own, so state only real dependencies in each assignment's after and keep independent assignments' write paths apart; cut the work so that as much as possible can proceed at once. Give each assignment, and the review, the few things it should read first, each with a reason: a project document as {path, section, reason} (name the section, not the whole file, when a route or heading tells you which) or a recorded investigation as {research, reason}, where research is the investigation identity shown with that answered question (an unanswered question has none). Workers start without this conversation, so what you name here is what saves them from exploring again. The route is the owner's to revise: after approval it may repair, re-plan, bring further repository files into the write scope and, where an acceptance item proves impossible, deliver the closest achievable result as a recorded deviation that the independent review must confirm. Goal, decisions, acceptance and assumptions stay as approved. Investigate prerequisites
|
|
5
|
+
Once the result is clear, use cadence_plan. Describe the expected delivery, explicit decisions/non-goals, acceptance, your assumptions, an initial technical route and assignments with their write paths, exact setup/baseline/acceptance commands, the delivery policy, and policy.installs (false unless the user agreed that later revisions may install dependencies). Assignments that neither depend on one another nor write the same path run side by side, each in a worktree of its own, so state only real dependencies in each assignment's after and keep independent assignments' write paths apart; cut the work so that as much as possible can proceed at once. Give each assignment, and the review, the few things it should read first, each with a reason: a project document as {path, section, reason} (name the section, not the whole file, when a route or heading tells you which) or a recorded investigation as {research, reason}, where research is the investigation identity shown with that answered question (an unanswered question has none). Workers start without this conversation, so what you name here is what saves them from exploring again. The route is the owner's to revise: after approval it may repair, re-plan, bring further repository files into the write scope and, where an acceptance item proves impossible, deliver the closest achievable result as a recorded deviation that the independent review must confirm. Goal, decisions, acceptance and assumptions stay as approved. Focus on the project, its implementation and its real checks. The owner supplies private, workspace-specific TMPDIR/TEMP/TMP to every delivery command and worker, including recovery. Do not add temporary-directory setup, environment discovery, path handoff or marker checks to the plan; name the project's check command directly. This standard runtime policy is displayed with the plan and covered by its one approval. Investigate project prerequisites: worktrees do not inherit ignored dependencies. Every setup command must name placement: target for original-checkout preflight (runs once before worktree creation), candidate for once-only stable-candidate preparation, or worktree for preparation in the candidate and every detached child. Keep target branch checks out of worktree setup: parallel children must remain detached. The owner already checks Git placement and target identity. Stages run in that order; command environments do not persist across processes. Include explicit environment bindings in every command that needs them. Setup/install commands need inclusion in approval; no implicit downloads, source/profile copying or credential copying. For Git code delivery, prefer local-merge; working-copy requires an explicitly approved direct-edit policy, never a silent fallback. local-merge creates one named cadence/<goal>-<run-id> branch and one stable worktree only AFTER delivery approval, never on mode entry or research. That candidate collects all work: an assignment running alone edits it directly, assignments running side by side are committed in their own temporary worktrees and picked onto it, and recovery, review and verified knowledge updates use it; each new approved delivery gets its own branch. The original conversation cwd stays unchanged. Checks and independent Agent review must bind the exact candidate before fast-forward delivery into the displayed target; only this run's confirmed merges can advance that target baseline for post-merge recovery. Keep the task branch and retain any worktree containing uncommitted, untracked or ignored residue. No automatic rebase, reset, cleanup of user data or mutation replay. local-merge needs an existing branch and commit identity and clean, nonignored approved targets; working-copy preserves existing direct edits without Git mutation.
|
|
6
6
|
The service maintains the project's knowledge store (.cadence/project.md and .cadence/knowledge/) itself at the end of every delivery, inside a fixed budget, so never list those. List in documents only existing project Markdown that owns a fact this delivery changes. Knowledge is learned from actual implementation and verified evidence, not guessed in the proposal. Avoid duplicate documentation systems.
|
|
7
7
|
When a tool refuses your own call it names the field at fault: correct exactly that and call again in the same turn. There is one plan. Never publish, offer or mention a shortened, split or otherwise reduced variant of it, and never ask the user to reply so that you can try again.
|
|
8
|
-
Present a concise delivery expectation with the complete returned agreement available, including your assumptions and what the service may change on its own, then invite one clear approval (the user may type 按计划实施). cadence_start obtains fresh context-bound approval. It covers self-revising execution to completion, checks, automatic Agent review, knowledge updates and the declared local delivery. It never covers push, publication, deployment, new permissions,
|
|
8
|
+
Present a concise delivery expectation with the complete returned agreement available, including your assumptions and what the service may change on its own, then invite one clear approval (the user may type 按计划实施). cadence_start obtains fresh context-bound approval. It covers self-revising execution to completion, checks, automatic Agent review, knowledge updates and the declared local delivery. It never covers push, publication, deployment, new permissions, arbitrary writes outside the repository, or installations beyond the listed setup and policy. The displayed service runtime policy separately permits only its own private temporary resources. You cannot approve yourself. Vague acknowledgement is not consent.
|
|
9
9
|
During accepted work the service owns progress, recovery and revision, and finishes without the user. Report actual cadence_status observations; do not start replacement workflows or ask for 'continue' after an individual child fails. Child failure is not delivery failure. Report recorded plan revisions as progress and lead with any recorded deviation when the run completes. Agents have no total runtime deadline; explicit command timeouts and actual closure still apply. A run stops only for a condition outside the repository; then explain that condition and the preserved outcomes, not a generic request to continue.
|
|
10
10
|
For follow-up to a settled or interrupted run, inspect retained outcomes first. Partial outputs are not unexplained user edits. Unknown results must be observed and reconciled, never blindly replayed; a new delivery requires fresh approval. No automatic replay after owner restart. cadence_cancel is explicit cancellation, not navigation or exit. Worker prose is not passing checks; automatic review is never human review. Completion leaves Cadence ON and ready. Tools operate on the host; this is not a sandbox.`;
|
package/src/cadence-mode.ts
CHANGED
|
@@ -435,9 +435,7 @@ export function registerCadenceMode(pi: ExtensionAPI): void {
|
|
|
435
435
|
if (generation !== expected) throw new ContractError("stale");
|
|
436
436
|
};
|
|
437
437
|
const operation = (async () => {
|
|
438
|
-
const broken =
|
|
439
|
-
!!connection.client &&
|
|
440
|
-
(reattach || !connection.session || !connection.compatible());
|
|
438
|
+
const broken = !!connection.client && (reattach || !connection.session);
|
|
441
439
|
if (connection.client && !broken) return;
|
|
442
440
|
reattach = false;
|
|
443
441
|
if (broken) connection.forgetSuperseded(ctx.cwd);
|
|
@@ -548,18 +546,7 @@ export function registerCadenceMode(pi: ExtensionAPI): void {
|
|
|
548
546
|
active(ctx);
|
|
549
547
|
await ensureAttached(ctx);
|
|
550
548
|
if (generation !== expected) throw new ContractError("stale");
|
|
551
|
-
if (!connection.client
|
|
552
|
-
reattach = true;
|
|
553
|
-
let stop = "its explicit stop command";
|
|
554
|
-
try {
|
|
555
|
-
stop = projectStopCommand(effectiveWorkspace(ctx.cwd).workspace);
|
|
556
|
-
} catch {
|
|
557
|
-
// The guidance keeps its generic wording.
|
|
558
|
-
}
|
|
559
|
-
throw new Error(
|
|
560
|
-
`unsupported-context: the running Cadence project owner does not match this Cadence build or its WebUI assets. Nothing was started or replaced. When no accepted work is running, stop it with ${stop}; the next Cadence use starts the matching version.`,
|
|
561
|
-
);
|
|
562
|
-
}
|
|
549
|
+
if (!connection.client) throw new ContractError("unavailable");
|
|
563
550
|
if (selectModel) await ensureModel(ctx);
|
|
564
551
|
if (generation !== expected) throw new ContractError("stale");
|
|
565
552
|
};
|
package/src/history-shell.ts
CHANGED
|
@@ -295,7 +295,6 @@ export function registerHistoryShell(pi: ExtensionAPI): void {
|
|
|
295
295
|
attached = true;
|
|
296
296
|
const session = connection.session;
|
|
297
297
|
if (!session) throw new ContractError("unavailable");
|
|
298
|
-
if (!connection.compatible()) ui.notify(MANAGEMENT_GUIDANCE);
|
|
299
298
|
const workspace = value(await client.workspace(signal));
|
|
300
299
|
current();
|
|
301
300
|
if (
|
package/src/native-build.ts
CHANGED
package/src/native-client.ts
CHANGED
|
@@ -8,16 +8,12 @@ import { Agent, Dispatcher1Wrapper } from "undici";
|
|
|
8
8
|
import { nativeBuild } from "./native-build.ts";
|
|
9
9
|
import { ServiceCoordination } from "./service/coordination.ts";
|
|
10
10
|
import { ServiceClient } from "./service-client.ts";
|
|
11
|
-
import {
|
|
12
|
-
ContractError,
|
|
13
|
-
compatibleBuild,
|
|
14
|
-
type SessionBootstrap,
|
|
15
|
-
} from "./service-contract.ts";
|
|
11
|
+
import { ContractError, type SessionBootstrap } from "./service-contract.ts";
|
|
16
12
|
import { HttpServiceTransport } from "./service-http-client.ts";
|
|
17
13
|
import { effectiveWorkspace } from "./workspace.ts";
|
|
18
14
|
|
|
19
15
|
export const MANAGEMENT_GUIDANCE =
|
|
20
|
-
"Cadence owner absent
|
|
16
|
+
"Cadence owner absent or unavailable. Start it with cadence start --workspace <path> (it recovers automatically from an unclean shutdown), or see what is wrong with cadence doctor --workspace <path>. No service was started and no embedded executor is available.";
|
|
21
17
|
|
|
22
18
|
const UNIT = "cadence.service";
|
|
23
19
|
const LABEL = "com.abelxiaoxing.cadence";
|
|
@@ -249,9 +245,6 @@ export class NativeConnection {
|
|
|
249
245
|
this.session = reply.value;
|
|
250
246
|
return reply.value;
|
|
251
247
|
}
|
|
252
|
-
compatible(safety = false): boolean {
|
|
253
|
-
return compatibleBuild(this.session?.build, nativeBuild, safety);
|
|
254
|
-
}
|
|
255
248
|
/** Forget an attachment only when the registry proves its owner instance is
|
|
256
249
|
* gone: absent, stopped, or replaced by another epoch. Its slot ended with
|
|
257
250
|
* that process, so no detach request is sent and a later attach may proceed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Build provenance for diagnostics and packaged assets, never access authority. */
|
|
2
2
|
import { closed, decodeHash, oneOf } from "./core.ts";
|
|
3
3
|
export interface BrowserBuild {
|
|
4
4
|
sourceHash: string;
|
|
@@ -49,19 +49,3 @@ export function decodeServiceBuild(value: unknown): ServiceBuild {
|
|
|
49
49
|
assets: decodeBrowserBuild(o.assets),
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
export function compatibleBuild(
|
|
53
|
-
server: ServiceBuild | undefined,
|
|
54
|
-
client: ClientBuild | null,
|
|
55
|
-
safety = false,
|
|
56
|
-
): boolean {
|
|
57
|
-
return (
|
|
58
|
-
!!server &&
|
|
59
|
-
!!client &&
|
|
60
|
-
client.contractHash === server.contractHash &&
|
|
61
|
-
(safety ||
|
|
62
|
-
(server.assets.contractHash === server.contractHash &&
|
|
63
|
-
(client.kind === "native" ||
|
|
64
|
-
(client.buildId === server.assets.buildId &&
|
|
65
|
-
client.sourceHash === server.assets.sourceHash))))
|
|
66
|
-
);
|
|
67
|
-
}
|