@abelxiaoxing/cadence 2.0.49 → 2.1.0
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 +5 -3
- package/README.zh-CN.md +5 -2
- package/docs/conversation-mode.md +26 -6
- package/docs/history.md +15 -2
- package/package.json +4 -1
- package/src/cadence-instructions.ts +5 -5
- package/src/cadence-mode.ts +49 -7
- package/src/coordinator-tools.mjs +39 -5
- package/src/model-preview.mjs +4 -1
- package/src/native-build.ts +1 -1
- package/src/sdk-worker.mjs +80 -59
- package/src/service/contracts/models.ts +6 -0
- package/src/service/contracts/workbench.ts +218 -17
- package/src/service/contracts/workflow.ts +309 -30
- package/src/service-host.mjs +4588 -2279
- package/src/session-entries.mjs +3 -1
- package/src/session-file.mjs +26 -0
- package/src/session-rename.mjs +94 -0
- package/src/session-sharing.ts +3 -1
- package/src/worker-inputs.mjs +144 -0
- package/src/worker-toolkit.mjs +26 -1
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +31 -22
- package/web/dist/manifest.json +7 -7
package/README.md
CHANGED
|
@@ -59,10 +59,12 @@ Choose a vision-capable model; see [image input](docs/conversation-mode.md#image
|
|
|
59
59
|
|
|
60
60
|
Enter `/cadence <goal>` once in any trusted project's Pi conversation.
|
|
61
61
|
Continue with normal messages: Cadence investigates, consolidates questions and develops a readable plan with you.
|
|
62
|
-
After one explicit delivery approval it
|
|
63
|
-
|
|
62
|
+
After one explicit delivery approval it finishes without asking again: it implements, recovers, re-plans when the route does not work, reviews and verifies.
|
|
63
|
+
The goal, decisions, acceptance and its listed assumptions stay as approved; if an acceptance item proves impossible it delivers the closest result and reports that deviation first.
|
|
64
|
+
Each approved local delivery gets a named branch and one stable worktree that preserves partial work, runs independent assignments side by side in temporary worktrees beside it, then merges back into the displayed original branch.
|
|
64
65
|
Mode entry/research create no Git resources; approved local commits/merge never imply a remote push.
|
|
65
|
-
|
|
66
|
+
Workers are given the documents and sections that own the code they touch, and each delivery ends by curating a small knowledge store under `.cadence/` that stays inside a fixed budget: new lessons displace or compress old ones, without a separate knowledge-management command.
|
|
67
|
+
`CADENCE_PARALLEL` (default 4) sets how many workers of one run are active at once.
|
|
66
68
|
|
|
67
69
|
**Completing a goal leaves the conversation in Cadence mode.**
|
|
68
70
|
No repeated command is needed.
|
package/README.zh-CN.md
CHANGED
|
@@ -54,8 +54,11 @@ pi install "$(npm root -g)/@abelxiaoxing/cadence"
|
|
|
54
54
|
|
|
55
55
|
在任意已信任项目的 Pi 对话里输入一次 `/cadence <目标>`,之后正常对话即可。
|
|
56
56
|
Cadence 自动调查仓库和项目知识,只澄清真正影响结果的问题,并生成包含目标、验收、范围、环境准备和本地交付方式的约定。
|
|
57
|
-
确认后输入
|
|
58
|
-
|
|
57
|
+
确认后输入 `按计划实施`,系统自主实施、诊断、接续部分成果和调整技术路线,之后不再向你提问;没有固定修复轮数或总交付时长配额,真实验证后再交付。
|
|
58
|
+
目标、决定、验收标准和约定里列出的假设保持批准时的样子;某条验收确实做不到时,交付最接近的可行结果,并在报告开头说明这处偏离。
|
|
59
|
+
每个获批的 Git 交付创建一个命名任务分支和稳定 worktree,互不依赖的任务在旁边的临时 worktree 里并行执行,审查与验证后合回约定中的原分支。
|
|
60
|
+
Worker 会拿到与所改代码对应的文档和章节;每次交付结束时整理 `.cadence/` 下一个有固定预算的小型知识库,新经验会替换或压缩旧内容,无需单独的知识管理命令。
|
|
61
|
+
`CADENCE_PARALLEL`(默认 4)决定一次运行中同时活动的 worker 数量。
|
|
59
62
|
进入模式和只读研究不会创建 Git 资源;不会默认推送、发布或部署。
|
|
60
63
|
非 Git 项目可选择直接工作副本交付,不执行提交或合并。
|
|
61
64
|
|
|
@@ -10,16 +10,21 @@ Browser conversation mode is retained by the project owner, not by a browser-onl
|
|
|
10
10
|
## Normal path
|
|
11
11
|
|
|
12
12
|
1. Cadence delegates focused readonly repository investigations, reuses existing project documentation, and consolidates questions in the main conversation.
|
|
13
|
-
2. Discuss requirements and decisions until
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
2. Discuss requirements and decisions until nothing that changes the result is left open.
|
|
14
|
+
This is the last time you are asked: what Cadence decides on your behalf is listed in the agreement as its assumptions.
|
|
15
|
+
3. Cadence presents one readable delivery agreement: expected result, acceptance, decisions, assumptions, the initial route and write scope, setup/check commands, documents to update and delivery policy.
|
|
16
|
+
The technical route is an initial suggestion.
|
|
17
|
+
After approval the service finishes on its own: it repairs and re-plans, may bring further files of the repository into the write scope (never credentials, keys, `.env`, `.git` or anything outside the repository), and installs dependencies only if the agreement says revisions may.
|
|
18
|
+
If an acceptance item proves impossible it delivers the closest achievable result and records the deviation: what could not be met, why, what was delivered instead and any declared check set aside because of it.
|
|
19
|
+
The automatic review must confirm each deviation, and a run that deviated says so first when it completes; the task branch is kept, so the merge can be undone.
|
|
16
20
|
4. Type `按计划实施` after the plan to authorize those exact bytes.
|
|
17
21
|
In the browser, click **Implement this plan** or send that exact approval phrase for the currently displayed plan.
|
|
18
22
|
In Pi, the Start tool can alternatively present one native confirmation of the complete plan.
|
|
19
23
|
Native confirmation retains its raw-terminal guard.
|
|
20
24
|
Quoted/generated text, an old session entry and vague agreement are not approval; browser authentication alone is not consent.
|
|
21
|
-
5. The persistent owner implements, reviews, verifies and delivers
|
|
22
|
-
|
|
25
|
+
5. The persistent owner implements, reviews, verifies and delivers.
|
|
26
|
+
Nothing asks for more approval.
|
|
27
|
+
It stops early only for a condition outside the repository: an unavailable model, failed authentication, storage or permission limits, a target branch changed from outside, an installation the agreement does not allow, or a missing tool.
|
|
23
28
|
6. Completion returns the conversation to Cadence **ready**, not ordinary mode.
|
|
24
29
|
Ask for status, more detail, cancellation, or the next goal normally.
|
|
25
30
|
|
|
@@ -38,6 +43,18 @@ Opening a different conversation does not enable Cadence there.
|
|
|
38
43
|
Restore never replays a command or automatically resumes an interrupted queue.
|
|
39
44
|
When an observation reply is lost, ask for status; do not infer that the action was absent.
|
|
40
45
|
|
|
46
|
+
## Messages while a reply is running
|
|
47
|
+
|
|
48
|
+
The service accepts a further message for a reply that is still running, in one of two ways.
|
|
49
|
+
A **steer** reaches the model at its next opportunity, after the tool calls in progress and before its next request, and continues the conversation as its own turn from there.
|
|
50
|
+
A **queued** message waits and is sent once the reply has ended normally.
|
|
51
|
+
Either one uses the running reply's directory and model, carries no images, and is never read as plan approval, mode entry or exit.
|
|
52
|
+
A queued message that is still waiting can be withdrawn; a steer is in the model's queue as soon as it is accepted.
|
|
53
|
+
If the reply fails, is stopped or the service restarts first, a waiting message is not delivered and nothing sends it later: the conversation says which messages were left, and you send one again if you still want it.
|
|
54
|
+
Stopping the reply stops all of it, including what was sent into it.
|
|
55
|
+
In the browser, type while the reply runs: **Enter** steers, **Alt+Enter** queues, and the two buttons beside Stop do the same.
|
|
56
|
+
Waiting messages are listed under the conversation with a control to withdraw each one, or to withdraw it and put its text back into the message box; a message left undelivered offers its text back the same way.
|
|
57
|
+
|
|
41
58
|
## Resume a sent conversation on another device
|
|
42
59
|
|
|
43
60
|
Open the same authenticated workbench on the other device with the **complete conversation link**: `/app?project=<project-key>#chat=<session-id>`.
|
|
@@ -119,6 +136,7 @@ The plan chooses one delivery policy:
|
|
|
119
136
|
|
|
120
137
|
- **Local merge:** requires an existing Git branch and configured commit identity.
|
|
121
138
|
After approval, each delivery creates its own `cadence/<goal>-<run-id>` branch and one stable worktree; mode entry and research create neither.
|
|
139
|
+
Assignments that neither depend on one another nor write the same file run side by side, each in a temporary worktree beside it, as many at once as `CADENCE_PARALLEL` allows.
|
|
122
140
|
Assignments, diagnosis, recovery and knowledge updates reuse that candidate, preserving partial work.
|
|
123
141
|
The target is the current local branch displayed in the agreement, not necessarily `main`; the conversation stays in its original directory.
|
|
124
142
|
The owner commits only declared file changes, runs independent readonly Agent review and real checks, then fast-forwards the unchanged target branch.
|
|
@@ -214,7 +232,8 @@ Conversation response completion is distinct from workflow completion; read the
|
|
|
214
232
|
|
|
215
233
|
### Research scope, timing and retained results
|
|
216
234
|
|
|
217
|
-
Each research call accepts
|
|
235
|
+
Each research call accepts up to eight independent questions and optional specific `roots` (default: the conversation directory).
|
|
236
|
+
The service runs as many of them at once as `CADENCE_PARALLEL` allows (default 4, at most 16) and queues the rest; set it in the service's environment to match what your model provider or local model server can serve.
|
|
218
237
|
Provide the actual investigation directory, especially for large mounted/backup trees; do not begin by enumerating `/` or broad parent directories.
|
|
219
238
|
Research tools are readonly and bounded.
|
|
220
239
|
Search limits and omitted coverage are reported explicitly; a partial search does not prove that no other matching file exists.
|
|
@@ -236,6 +255,7 @@ A parent session may record a whole batch of tool results together, so those tim
|
|
|
236
255
|
Long workflows retain earlier steps in readonly pages rather than stopping at a step count.
|
|
237
256
|
Open **Earlier workflow steps** in the WebUI, **Earlier steps** in native history, or use `cadence_status` with the returned `stepsBefore` as `before`.
|
|
238
257
|
Route revisions and failed attempts remain visible; a later successful attempt never rewrites their original outcomes.
|
|
258
|
+
A revision may also change the assignments that have not started yet (drop, rewrite or add one); the workflow view shows which revision did, and a dropped assignment stays listed as superseded.
|
|
239
259
|
|
|
240
260
|
## Discover active Pi work
|
|
241
261
|
|
package/docs/history.md
CHANGED
|
@@ -7,6 +7,11 @@ History is evidence, not a second task manager or renewed execution consent.
|
|
|
7
7
|
|
|
8
8
|
- In the conversation, select a workflow's line to open its steps: actual checks, Agent review, delivery and failures.
|
|
9
9
|
**Open subagent context** shows the retained transcript; **Read retained step result** reads the retained result rather than its clipped status preview.
|
|
10
|
+
- A delivery's view lists the agreement's assignments with each one's state (queued, running, completed, failed), its steps, and its own worktree when it ran beside others.
|
|
11
|
+
While assignments run side by side, the line in the conversation counts them by state instead of naming steps.
|
|
12
|
+
- A delivery that could not meet an acceptance item or decision as written records a deviation.
|
|
13
|
+
The completed line then says "delivered with N deviations", and the view leads with each one: what could not be met, why, what was delivered instead and which declared checks it set aside.
|
|
14
|
+
A check set aside this way ran and failed; it is labelled as set aside, never as passed.
|
|
10
15
|
- A workflow belongs to the conversation that started it, in the browser or in the terminal, and its line stays after the turn it started in.
|
|
11
16
|
An active workflow is also listed under **Running conversations** in the browser sidebar.
|
|
12
17
|
- In a trusted Pi terminal, `/cadence-history` lists workflows without asking a model.
|
|
@@ -25,14 +30,22 @@ Automatic Agent review is never human review, and a check's actual exit is indep
|
|
|
25
30
|
|
|
26
31
|
Browser conversations are the project's Pi sessions, the same files `pi -r` and `/resume` list in the terminal.
|
|
27
32
|
The browser sidebar lists sessions started in either place, newest first, and labels where each one started.
|
|
33
|
+
Each row there offers **Rename** and **Archive**.
|
|
34
|
+
A rename is recorded in the session as the terminal's `/name` records it, so both places show the name; an emptied name titles the conversation by its first message again.
|
|
35
|
+
An archived conversation is left out of that list; archiving only hides it there, and its session file stays where Pi keeps it, so `pi -r` still lists it.
|
|
36
|
+
The archive button beside **Conversation history** shows the archived conversations, each with **Unarchive**; an archived conversation still opens from there or by its link, where its header says it is archived.
|
|
37
|
+
Rename and archive need the project's execution service running: while it is stopped the actions are shown disabled, and the next message you send starts it.
|
|
28
38
|
A conversation can be continued from either side: open it in the browser, or run `/resume` (or `pi --session <id>`) in the terminal.
|
|
29
39
|
Sessions from the selected checkout and its conversation directories are listed, and only those of the account the service runs as.
|
|
30
40
|
|
|
31
41
|
Pi keeps a session as a tree.
|
|
32
42
|
When a message continues an earlier point, the session gains a branch instead of losing anything:
|
|
33
43
|
|
|
34
|
-
- In the browser, **Continue from here** under an earlier reply
|
|
35
|
-
|
|
44
|
+
- In the browser, **Continue from here** under an earlier reply makes the next message start a new branch after that turn, and **Edit and resend** under one of your messages puts it back in the composer (with its images) so the rewritten message starts a branch beside it.
|
|
45
|
+
The later turns stay visible but dimmed, a strip above the composer says what is being rewritten and has **Cancel**, and only the conversation is rewound: files on disk are not changed.
|
|
46
|
+
- Where a message has several versions, `‹ 2/3 ›` beside it steps between their branches.
|
|
47
|
+
- The **Branches** tab of the right panel (the branch count in the conversation header opens it) shows the tree of messages; choose a line to read that branch, and **Show the latest** to follow the newest again.
|
|
48
|
+
The address keeps the branch shown, so a refresh returns to it.
|
|
36
49
|
- In the terminal, `/tree` shows the same tree.
|
|
37
50
|
|
|
38
51
|
A terminal holds its own copy of an open session.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abelxiaoxing/cadence",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
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",
|
|
@@ -78,6 +78,9 @@
|
|
|
78
78
|
"THIRD_PARTY_NOTICES.md",
|
|
79
79
|
"licenses",
|
|
80
80
|
"src/session-entries.mjs",
|
|
81
|
+
"src/session-file.mjs",
|
|
82
|
+
"src/session-rename.mjs",
|
|
83
|
+
"src/worker-inputs.mjs",
|
|
81
84
|
"src/image-content.mjs",
|
|
82
85
|
"src/session-sharing.ts",
|
|
83
86
|
"src/conversation-resources.mjs",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** Shared dialogue policy. Execution and recovery belong to the persistent owner. */
|
|
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
|
-
For a new goal, use focused cadence_research to inspect relevant code and project knowledge. Reuse still-current findings.
|
|
5
|
-
Once the result is clear, use cadence_plan with version:
|
|
6
|
-
|
|
7
|
-
Present a concise delivery expectation with the complete returned agreement available, then invite one clear approval (the user may type 按计划实施). cadence_start obtains fresh context-bound approval. It covers
|
|
8
|
-
During accepted work the service owns progress and
|
|
4
|
+
For a new goal, use focused cadence_research to inspect relevant code and project knowledge; one call takes up to eight independent questions and the service runs them side by side. 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 with version:3. 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 on that step of the research summary (a step that reused an earlier answer names the identity it reused). 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 first: worktrees do not inherit ignored dependencies. 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
|
+
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
|
+
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, files outside the repository, or installations beyond the listed setup and policy. You cannot approve yourself. Vague acknowledgement is not consent.
|
|
8
|
+
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.
|
|
9
9
|
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
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
workflowDiagnostics,
|
|
37
37
|
} from "./service/contracts/workflow.ts";
|
|
38
38
|
import { ServiceCoordination } from "./service/coordination.ts";
|
|
39
|
+
import { routeTableBrief } from "./service/project-knowledge.ts";
|
|
39
40
|
import {
|
|
40
41
|
ContractError,
|
|
41
42
|
canonicalJson,
|
|
@@ -234,13 +235,44 @@ const CHECK = Type.Object({
|
|
|
234
235
|
command: Type.String(),
|
|
235
236
|
timeoutMs: Type.Optional(Type.Integer({ minimum: 100, maximum: 2147483647 })),
|
|
236
237
|
});
|
|
238
|
+
const READING = Type.Union([
|
|
239
|
+
Type.Object({
|
|
240
|
+
path: Type.String({ description: "Project document to read first." }),
|
|
241
|
+
section: Type.Optional(
|
|
242
|
+
Type.String({ description: "One heading of that document." }),
|
|
243
|
+
),
|
|
244
|
+
reason: Type.String(),
|
|
245
|
+
}),
|
|
246
|
+
Type.Object({
|
|
247
|
+
research: Type.String({
|
|
248
|
+
description: "Identity of a recorded investigation to reuse.",
|
|
249
|
+
}),
|
|
250
|
+
reason: Type.String(),
|
|
251
|
+
}),
|
|
252
|
+
]);
|
|
237
253
|
const PLAN = Type.Object({
|
|
238
254
|
goal: Type.String(),
|
|
239
255
|
design: Type.String(),
|
|
240
256
|
decisions: Type.String(),
|
|
241
257
|
acceptance: Type.String(),
|
|
242
|
-
version: Type.Literal(
|
|
243
|
-
|
|
258
|
+
version: Type.Literal(3),
|
|
259
|
+
assumptions: Type.String({
|
|
260
|
+
description:
|
|
261
|
+
"What you decided on the user's behalf without asking; approval confirms it. Empty when there is none.",
|
|
262
|
+
}),
|
|
263
|
+
documents: Type.Array(
|
|
264
|
+
Type.String({
|
|
265
|
+
description: "Existing project Markdown this delivery may update.",
|
|
266
|
+
}),
|
|
267
|
+
{ maxItems: 16 },
|
|
268
|
+
),
|
|
269
|
+
reviewReads: Type.Array(READING, { maxItems: 16 }),
|
|
270
|
+
policy: Type.Object({
|
|
271
|
+
installs: Type.Boolean({
|
|
272
|
+
description:
|
|
273
|
+
"Whether a later revision may add dependency-installation commands. False unless the user agreed.",
|
|
274
|
+
}),
|
|
275
|
+
}),
|
|
244
276
|
tasks: Type.Array(
|
|
245
277
|
Type.Object({
|
|
246
278
|
id: Type.String(),
|
|
@@ -248,6 +280,7 @@ const PLAN = Type.Object({
|
|
|
248
280
|
instructions: Type.String(),
|
|
249
281
|
writes: Type.Array(Type.String()),
|
|
250
282
|
after: Type.Array(Type.String()),
|
|
283
|
+
reads: Type.Array(READING, { maxItems: 16 }),
|
|
251
284
|
}),
|
|
252
285
|
{ minItems: 1, maxItems: 16 },
|
|
253
286
|
),
|
|
@@ -391,8 +424,17 @@ export function registerCadenceMode(pi: ExtensionAPI): void {
|
|
|
391
424
|
context = ctx;
|
|
392
425
|
};
|
|
393
426
|
const summarize = (run: WorkflowRun) =>
|
|
394
|
-
`Cadence ${run.status} • ${run.goal}\nRun: ${run.id} · route revision ${run.revision ?? 0} · stepsBefore ${run.stepsBefore ?? 0}\n${workflowDiagnostics(run)}\n${readableDeliveryRun(run.delivery)}\n${run.steps.map((s) => `${s.kind} ${s.id}: ${s.status}${s.exitCode === null ? "" : ` (exit ${s.exitCode})`}\n${s.text}${s.truncated ? "\n[Preview truncated; full result retained by owner.]" : ""}`).join("\n")}\n${run.notice}${run.mergedCommit ? `\nLocal merge: ${run.mergedCommit}` : ""}${run.status === "unknown" ? "\nOutcome unknown: neither completed nor failed. Its actual effects are not inferred, and the owner keeps any fences." : ""}\nAutomatic review is not human review. Cadence mode remains enabled.`;
|
|
427
|
+
`Cadence ${run.status} • ${run.goal}\nRun: ${run.id} · route revision ${run.revision ?? 0} · stepsBefore ${run.stepsBefore ?? 0}\n${workflowDiagnostics(run)}\n${readableDeliveryRun(run.delivery)}\n${run.steps.map((s) => `${s.kind} ${s.id}${s.kind === "research" && s.childRunId ? ` · investigation ${s.childRunId}` : ""}: ${s.status}${s.exitCode === null ? "" : ` (exit ${s.exitCode})`}\n${s.text}${s.truncated ? "\n[Preview truncated; full result retained by owner.]" : ""}`).join("\n")}\n${run.notice}${run.mergedCommit ? `\nLocal merge: ${run.mergedCommit}` : ""}${run.status === "unknown" ? "\nOutcome unknown: neither completed nor failed. Its actual effects are not inferred, and the owner keeps any fences." : ""}\nAutomatic review is not human review. Cadence mode remains enabled.`;
|
|
395
428
|
const agentDir = () => getAgentDir();
|
|
429
|
+
/** The project's route table for this turn's system prompt. A turn never
|
|
430
|
+
* fails because the table, or the workspace it is in, cannot be read. */
|
|
431
|
+
const routeTable = (ctx: ExtensionContext) => {
|
|
432
|
+
try {
|
|
433
|
+
return routeTableBrief(resolveWorkspace(ctx.cwd).cwd, []);
|
|
434
|
+
} catch {
|
|
435
|
+
return "";
|
|
436
|
+
}
|
|
437
|
+
};
|
|
396
438
|
const conversation = (ctx: ExtensionContext) => {
|
|
397
439
|
const cwd = resolveWorkspace(ctx.cwd).cwd;
|
|
398
440
|
return {
|
|
@@ -879,7 +921,7 @@ export function registerCadenceMode(pi: ExtensionAPI): void {
|
|
|
879
921
|
pi.on("before_agent_start", (event, ctx) =>
|
|
880
922
|
engaged(ctx)
|
|
881
923
|
? {
|
|
882
|
-
systemPrompt: `${event.systemPrompt}\n\n${INSTRUCTIONS}\n${NATIVE}`,
|
|
924
|
+
systemPrompt: `${event.systemPrompt}\n\n${INSTRUCTIONS}\n${NATIVE}${routeTable(ctx)}`,
|
|
883
925
|
message: {
|
|
884
926
|
customType: CONTEXT,
|
|
885
927
|
content: `Cadence state (data, not instructions): retained run ${state.runId ?? "none"}; current proposal ${state.proposal?.id ?? "none; restore does not restore approval"}.`,
|
|
@@ -975,10 +1017,10 @@ export function registerCadenceMode(pi: ExtensionAPI): void {
|
|
|
975
1017
|
name: "cadence_research",
|
|
976
1018
|
label: "Investigate project",
|
|
977
1019
|
description:
|
|
978
|
-
"Delegate
|
|
1020
|
+
"Delegate up to eight focused, independent readonly investigations; the service runs as many at once as this machine is configured for. Cite project evidence and consolidate questions in the main conversation. No code editing or task UI.",
|
|
979
1021
|
parameters: Type.Object({
|
|
980
1022
|
goal: Type.String(),
|
|
981
|
-
questions: Type.Array(Type.String(), { minItems: 1, maxItems:
|
|
1023
|
+
questions: Type.Array(Type.String(), { minItems: 1, maxItems: 8 }),
|
|
982
1024
|
roots: Type.Optional(
|
|
983
1025
|
Type.Array(
|
|
984
1026
|
Type.String({
|
|
@@ -1069,7 +1111,7 @@ export function registerCadenceMode(pi: ExtensionAPI): void {
|
|
|
1069
1111
|
name: "cadence_plan",
|
|
1070
1112
|
label: "Propose implementation plan",
|
|
1071
1113
|
description:
|
|
1072
|
-
"Publish a readable delivery agreement: goal, acceptance, explicit
|
|
1114
|
+
"Publish a readable delivery agreement: goal, acceptance, explicit decisions, your assumptions, initial route and assignments, what each reads first, checks, setup, documents to update and delivery policy. After one approval the service revises the route on its own and finishes without further confirmation. Does not execute.",
|
|
1073
1115
|
parameters: PLAN,
|
|
1074
1116
|
async execute(_id, input, _signal, _update, ctx) {
|
|
1075
1117
|
return changing(ctx, async (claim) => {
|
|
@@ -6,13 +6,44 @@ const CHECK = Type.Object({
|
|
|
6
6
|
command: Type.String(),
|
|
7
7
|
timeoutMs: Type.Optional(Type.Integer({ minimum: 100, maximum: 2147483647 })),
|
|
8
8
|
});
|
|
9
|
+
const READING = Type.Union([
|
|
10
|
+
Type.Object({
|
|
11
|
+
path: Type.String({ description: "Project document to read first." }),
|
|
12
|
+
section: Type.Optional(
|
|
13
|
+
Type.String({ description: "One heading of that document." }),
|
|
14
|
+
),
|
|
15
|
+
reason: Type.String(),
|
|
16
|
+
}),
|
|
17
|
+
Type.Object({
|
|
18
|
+
research: Type.String({
|
|
19
|
+
description: "Identity of a recorded investigation to reuse.",
|
|
20
|
+
}),
|
|
21
|
+
reason: Type.String(),
|
|
22
|
+
}),
|
|
23
|
+
]);
|
|
9
24
|
const PLAN = Type.Object({
|
|
10
25
|
goal: Type.String(),
|
|
11
26
|
design: Type.String(),
|
|
12
27
|
decisions: Type.String(),
|
|
13
28
|
acceptance: Type.String(),
|
|
14
|
-
version: Type.Literal(
|
|
15
|
-
|
|
29
|
+
version: Type.Literal(3),
|
|
30
|
+
assumptions: Type.String({
|
|
31
|
+
description:
|
|
32
|
+
"What you decided on the user's behalf without asking; approval confirms it. Empty when there is none.",
|
|
33
|
+
}),
|
|
34
|
+
documents: Type.Array(
|
|
35
|
+
Type.String({
|
|
36
|
+
description: "Existing project Markdown this delivery may update.",
|
|
37
|
+
}),
|
|
38
|
+
{ maxItems: 16 },
|
|
39
|
+
),
|
|
40
|
+
reviewReads: Type.Array(READING, { maxItems: 16 }),
|
|
41
|
+
policy: Type.Object({
|
|
42
|
+
installs: Type.Boolean({
|
|
43
|
+
description:
|
|
44
|
+
"Whether a later revision may add dependency-installation commands. False unless the user agreed.",
|
|
45
|
+
}),
|
|
46
|
+
}),
|
|
16
47
|
tasks: Type.Array(
|
|
17
48
|
Type.Object({
|
|
18
49
|
id: Type.String(),
|
|
@@ -20,6 +51,7 @@ const PLAN = Type.Object({
|
|
|
20
51
|
instructions: Type.String(),
|
|
21
52
|
writes: Type.Array(Type.String()),
|
|
22
53
|
after: Type.Array(Type.String()),
|
|
54
|
+
reads: Type.Array(READING, { maxItems: 16 }),
|
|
23
55
|
}),
|
|
24
56
|
{ minItems: 1, maxItems: 16 },
|
|
25
57
|
),
|
|
@@ -47,8 +79,9 @@ export function createCoordinatorTools() {
|
|
|
47
79
|
};
|
|
48
80
|
process.on("disconnect", closed);
|
|
49
81
|
const receive = (reply) => {
|
|
50
|
-
// Credential replies
|
|
51
|
-
|
|
82
|
+
// Credential replies and messages for the running reply share the private
|
|
83
|
+
// transport, never the tool channel.
|
|
84
|
+
if (["auth", "input", "input-cancel"].includes(reply?.kind)) return;
|
|
52
85
|
if (
|
|
53
86
|
!reply ||
|
|
54
87
|
typeof reply !== "object" ||
|
|
@@ -73,7 +106,8 @@ export function createCoordinatorTools() {
|
|
|
73
106
|
"Investigate bounded project questions with readonly subagents; returns recorded evidence. Never edits.",
|
|
74
107
|
parameters: Type.Object({
|
|
75
108
|
goal: Type.String(),
|
|
76
|
-
questions
|
|
109
|
+
// Split independent questions freely; the owner bounds how many run at once.
|
|
110
|
+
questions: Type.Array(Type.String(), { minItems: 1, maxItems: 8 }),
|
|
77
111
|
roots: Type.Optional(
|
|
78
112
|
Type.Array(
|
|
79
113
|
Type.String({
|
package/src/model-preview.mjs
CHANGED
|
@@ -1641,10 +1641,12 @@ function decodeModelCandidate(value) {
|
|
|
1641
1641
|
"api",
|
|
1642
1642
|
"thinking",
|
|
1643
1643
|
"eligibility",
|
|
1644
|
-
...Object.hasOwn(value ?? {}, "images") ? ["images"] : []
|
|
1644
|
+
...Object.hasOwn(value ?? {}, "images") ? ["images"] : [],
|
|
1645
|
+
...Object.hasOwn(value ?? {}, "contextWindow") ? ["contextWindow"] : []
|
|
1645
1646
|
]);
|
|
1646
1647
|
const candidate = {
|
|
1647
1648
|
...o.images === undefined ? {} : { images: bool(o.images) },
|
|
1649
|
+
...o.contextWindow === undefined ? {} : { contextWindow: integer(o.contextWindow, 1) },
|
|
1648
1650
|
provider: text(o.provider, 128, true),
|
|
1649
1651
|
model: text(o.model, 256, true),
|
|
1650
1652
|
api: nullable(o.api, (v) => oneOf(v, modelApis)),
|
|
@@ -3094,6 +3096,7 @@ function projectModelCatalog(runtime, supportedThinking, current, literals, vali
|
|
|
3094
3096
|
selectable: t.selectable && eligibility === "candidate"
|
|
3095
3097
|
})),
|
|
3096
3098
|
images: model2.input.includes("image"),
|
|
3099
|
+
...Number.isSafeInteger(model2.contextWindow) && model2.contextWindow > 0 ? { contextWindow: model2.contextWindow } : {},
|
|
3097
3100
|
eligibility
|
|
3098
3101
|
}));
|
|
3099
3102
|
}
|
package/src/native-build.ts
CHANGED