@omacode/micromanager 0.1.1 → 1.0.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 +7 -4
- package/THIRD_PARTY.md +100 -0
- package/decider/.python-version +1 -0
- package/decider/README.md +35 -0
- package/decider/decider/__init__.py +1 -0
- package/decider/decider/server.py +327 -0
- package/decider/pyproject.toml +34 -0
- package/decider/uv.lock +1255 -0
- package/dist/agenda.js +51 -0
- package/dist/agents.js +58 -0
- package/dist/artifact/handoff.js +281 -0
- package/dist/ask.js +200 -0
- package/dist/backends.js +219 -0
- package/dist/backlog.js +414 -0
- package/dist/bench.js +427 -0
- package/dist/board.js +1 -0
- package/dist/brief.js +202 -0
- package/dist/browser.js +679 -0
- package/dist/budget.js +61 -0
- package/dist/catalog.js +187 -0
- package/dist/checkchange.js +145 -0
- package/dist/checkpoint.js +94 -0
- package/dist/cli.js +764 -0
- package/dist/comfy-gate.js +258 -0
- package/dist/compact.js +142 -0
- package/dist/config.js +344 -0
- package/dist/context/capture.js +1 -0
- package/dist/context/digest.js +1 -0
- package/dist/context/embed.js +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/ledger.js +1 -0
- package/dist/context/manager.js +1 -0
- package/dist/context/memory.js +1 -0
- package/dist/context/policy.js +1 -0
- package/dist/context/prices.js +1 -0
- package/dist/context/recall.js +1 -0
- package/dist/context/rules.js +1 -0
- package/dist/context/search.js +1 -0
- package/dist/context/status.js +1 -0
- package/dist/context/store.js +1 -0
- package/dist/context/summary.js +1 -0
- package/dist/context/tokens.js +1 -0
- package/dist/context/tools.js +1 -0
- package/dist/continuation.js +184 -0
- package/dist/contract.js +294 -0
- package/dist/contractround.js +178 -0
- package/dist/control.js +1 -0
- package/dist/creative-tools.js +237 -0
- package/dist/dataset.js +175 -0
- package/dist/decide.js +676 -0
- package/dist/decider.js +171 -0
- package/dist/design-shell.js +448 -0
- package/dist/design.js +1410 -0
- package/dist/desktop.js +44 -0
- package/dist/egress.js +156 -0
- package/dist/eval.js +60 -0
- package/dist/evolver.js +302 -0
- package/dist/features.js +193 -0
- package/dist/followups.js +32 -0
- package/dist/forms.js +195 -0
- package/dist/gate.js +108 -0
- package/dist/gatebox.js +46 -0
- package/dist/grants.js +189 -0
- package/dist/graph.js +65 -0
- package/dist/guard/index.js +1 -0
- package/dist/guard/wire.js +1 -0
- package/dist/helpers.js +85 -0
- package/dist/hooks.js +158 -0
- package/dist/image-models.js +117 -0
- package/{src/integration.ts → dist/integration.js} +1 -2
- package/dist/journal.js +1 -0
- package/dist/look.js +363 -0
- package/dist/memory.js +1 -0
- package/dist/mode.js +97 -0
- package/dist/native.js +3348 -0
- package/dist/nogit.js +259 -0
- package/dist/outcomes.js +148 -0
- package/dist/permission.js +35 -0
- package/dist/pick.js +89 -0
- package/dist/pipelines.js +262 -0
- package/dist/plan.js +641 -0
- package/dist/plandoc.js +211 -0
- package/dist/plugin.js +4736 -0
- package/dist/policy.js +58 -0
- package/dist/pools.js +1 -0
- package/dist/preview.js +274 -0
- package/dist/profile.js +165 -0
- package/dist/progress.js +1 -0
- package/dist/promote.js +313 -0
- package/dist/redact.js +1 -0
- package/dist/registry.js +179 -0
- package/dist/riskscore.js +126 -0
- package/dist/roles.js +1 -0
- package/dist/routing.js +1 -0
- package/dist/runner.js +1892 -0
- package/{src/sandbox.ts → dist/sandbox.js} +1 -2
- package/dist/sandboxgate.js +90 -0
- package/dist/scheduler.js +170 -0
- package/dist/services-main.js +131 -0
- package/dist/services.js +265 -0
- package/dist/session.js +241 -0
- package/dist/setup.js +423 -0
- package/dist/shell/decide.js +1 -0
- package/dist/shell/index.js +2 -0
- package/dist/shell/sandbox.js +1 -0
- package/dist/shell/wire.js +1 -0
- package/dist/skills.js +103 -0
- package/dist/state.js +1 -0
- package/dist/store.js +1 -0
- package/dist/switcher.js +1 -0
- package/dist/synth.js +418 -0
- package/dist/tools.js +477 -0
- package/dist/trials.js +223 -0
- package/dist/usage.js +1 -0
- package/dist/wait.js +167 -0
- package/dist/watchdog.js +476 -0
- package/dist/web-guidance.js +43 -0
- package/dist/which.js +20 -0
- package/dist/worktree/git.js +545 -0
- package/dist/writeguard.js +311 -0
- package/package.json +36 -17
- package/skills/deck/SKILL.md +98 -0
- package/skills/design/SKILL.md +150 -0
- package/skills/image/SKILL.md +66 -0
- package/skills/orchestrator/SKILL.md +107 -0
- package/skills/video/SKILL.md +97 -0
- package/skills/web/SKILL.md +60 -0
- package/src/agenda.ts +0 -56
- package/src/agents.ts +0 -74
- package/src/ask.ts +0 -243
- package/src/backends.ts +0 -144
- package/src/backlog.ts +0 -436
- package/src/bench.ts +0 -163
- package/src/board.ts +0 -1
- package/src/brief.ts +0 -151
- package/src/browser.ts +0 -624
- package/src/budget.ts +0 -73
- package/src/catalog.ts +0 -214
- package/src/checkchange.ts +0 -180
- package/src/checkpoint.ts +0 -99
- package/src/cli.ts +0 -117
- package/src/compact.ts +0 -162
- package/src/config.ts +0 -340
- package/src/context/capture.ts +0 -1
- package/src/context/digest.ts +0 -1
- package/src/context/embed.ts +0 -1
- package/src/context/index.ts +0 -2
- package/src/context/ledger.ts +0 -1
- package/src/context/manager.ts +0 -1
- package/src/context/memory.ts +0 -1
- package/src/context/policy.ts +0 -1
- package/src/context/prices.ts +0 -1
- package/src/context/recall.ts +0 -1
- package/src/context/rules.ts +0 -1
- package/src/context/search.ts +0 -1
- package/src/context/status.ts +0 -1
- package/src/context/store.ts +0 -1
- package/src/context/summary.ts +0 -1
- package/src/context/tokens.ts +0 -1
- package/src/context/tools.ts +0 -1
- package/src/continuation.ts +0 -122
- package/src/contract.ts +0 -342
- package/src/contractround.ts +0 -225
- package/src/control.ts +0 -1
- package/src/dataset.ts +0 -133
- package/src/decide.ts +0 -690
- package/src/eval.ts +0 -66
- package/src/evolver.ts +0 -369
- package/src/followups.ts +0 -50
- package/src/forms.ts +0 -191
- package/src/gate.ts +0 -90
- package/src/grants.ts +0 -239
- package/src/graph.ts +0 -74
- package/src/guard/index.ts +0 -1
- package/src/guard/wire.ts +0 -1
- package/src/helpers.ts +0 -105
- package/src/hooks.ts +0 -199
- package/src/jev.ts +0 -141
- package/src/journal.ts +0 -1
- package/src/look.ts +0 -390
- package/src/memory.ts +0 -1
- package/src/native.ts +0 -2455
- package/src/nogit.ts +0 -112
- package/src/outcomes.ts +0 -210
- package/src/pick.ts +0 -112
- package/src/pipelines.ts +0 -252
- package/src/plan.ts +0 -449
- package/src/plugin.ts +0 -3187
- package/src/policy.ts +0 -84
- package/src/pools.ts +0 -1
- package/src/profile.ts +0 -186
- package/src/progress.ts +0 -1
- package/src/redact.ts +0 -1
- package/src/registry.ts +0 -207
- package/src/roles.ts +0 -1
- package/src/routing.ts +0 -1
- package/src/runner.ts +0 -1506
- package/src/scheduler.ts +0 -200
- package/src/session.ts +0 -269
- package/src/shell/decide.ts +0 -1
- package/src/shell/index.ts +0 -2
- package/src/shell/sandbox.ts +0 -1
- package/src/shell/wire.ts +0 -1
- package/src/skills.ts +0 -111
- package/src/state.ts +0 -1
- package/src/store.ts +0 -1
- package/src/switcher.ts +0 -1
- package/src/tools.ts +0 -480
- package/src/trials.ts +0 -247
- package/src/usage.ts +0 -1
- package/src/wait.ts +0 -180
- package/src/watchdog.ts +0 -498
- package/src/worktree/git.ts +0 -378
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// A1-T6: the plan boundary's guard on the tool calls themselves. Plan mode is a hard boundary (design.md, D10): the
|
|
2
|
+
// plan agent and the investigator it delegates to write only under <stateDir>/plan, and the obvious ways out of that
|
|
3
|
+
// directory in a shell command are refused before the command runs.
|
|
4
|
+
//
|
|
5
|
+
// This reads a path or a command, not what a program does. A shell line is not parsed: only the simple forms are seen
|
|
6
|
+
// (`cd ..`, `git checkout`, an absolute path spelled out), and the sandbox of A1-T7 is the barrier. What this adds is
|
|
7
|
+
// the cheap, readable refusal of the forms a model writes when it decides to change the project anyway.
|
|
8
|
+
//
|
|
9
|
+
// The target is resolved through the filesystem, not lexically: `realpath` of the nearest existing ancestor, with the
|
|
10
|
+
// part that does not exist yet appended in order. A symlink under the plan directory that points at the checkout is
|
|
11
|
+
// therefore seen for what it is, which a `resolve` would never show.
|
|
12
|
+
import { lstatSync, realpathSync } from "node:fs";
|
|
13
|
+
import { homedir, tmpdir } from "node:os";
|
|
14
|
+
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
15
|
+
import { statePath } from "@omacode/core/paths";
|
|
16
|
+
// The tools that name a file they change. A `patch` with only patch text names nothing here and is left to the
|
|
17
|
+
// permission layer; the paths a model writes are the ones this guard can read.
|
|
18
|
+
const WRITE_TOOLS = new Set(["edit", "write", "patch"]);
|
|
19
|
+
const PATH_FIELDS = ["path", "filePath", "file", "filename"];
|
|
20
|
+
const PATH_LISTS = ["files", "paths"];
|
|
21
|
+
// A git subcommand that moves refs the user's own checkout shares. A plan reads the history; it never rewrites it.
|
|
22
|
+
const REFS = new Set(["checkout", "stash", "branch", "worktree", "config", "gc", "update-ref"]);
|
|
23
|
+
// The git options that take the next word, so the subcommand is found past them ("git -C dir checkout main").
|
|
24
|
+
const GIT_VALUE_OPTS = new Set(["-C", "-c", "--git-dir", "--work-tree", "--namespace", "--config-env"]);
|
|
25
|
+
// Absolute paths that are not a place a command works in: the standard streams. Everything else absolute is checked,
|
|
26
|
+
// except the system temp directory, which is where a command writes its own scratch files.
|
|
27
|
+
const STREAMS = new Set(["/dev/null", "/dev/stdin", "/dev/stdout", "/dev/stderr"]);
|
|
28
|
+
// An absolute path with every symlink along it resolved, including the ones in the part that does not exist yet:
|
|
29
|
+
// `realpath` of the nearest existing ancestor, and the missing tail appended in order. A link that cannot be followed
|
|
30
|
+
// (its target is missing) is treated as that ancestor: its own directory resolves and its name stays a name, so
|
|
31
|
+
// nothing is followed through it. Never throws.
|
|
32
|
+
export function realish(path) {
|
|
33
|
+
let current = resolve(path);
|
|
34
|
+
const below = [];
|
|
35
|
+
for (;;) {
|
|
36
|
+
try {
|
|
37
|
+
const real = realpathSync(current);
|
|
38
|
+
return below.length ? join(real, ...below) : real;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Not resolvable: missing, or a link whose target is missing.
|
|
42
|
+
}
|
|
43
|
+
let link = false;
|
|
44
|
+
try {
|
|
45
|
+
link = lstatSync(current).isSymbolicLink();
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
link = false;
|
|
49
|
+
}
|
|
50
|
+
const parent = dirname(current);
|
|
51
|
+
if (link) {
|
|
52
|
+
let up = parent;
|
|
53
|
+
try {
|
|
54
|
+
up = realpathSync(parent);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// The root itself is unreadable: use it as it is rather than guess.
|
|
58
|
+
}
|
|
59
|
+
return join(up, basename(current), ...below);
|
|
60
|
+
}
|
|
61
|
+
if (parent === current)
|
|
62
|
+
return join(current, ...below);
|
|
63
|
+
below.unshift(basename(current));
|
|
64
|
+
current = parent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Equals or lies under a resolved root, without a sibling whose name merely starts with the same characters:
|
|
68
|
+
// "/p/plan-old" is not "/p/plan".
|
|
69
|
+
export function insidePath(path, root) {
|
|
70
|
+
const p = resolve(path);
|
|
71
|
+
const r = resolve(root);
|
|
72
|
+
return p === r || p.startsWith(r.endsWith(sep) ? r : r + sep);
|
|
73
|
+
}
|
|
74
|
+
// Where a plan lives: <project>/<stateDir>/plan (statePath answers the directory's name, old or new).
|
|
75
|
+
export function planRoot(project) {
|
|
76
|
+
return statePath(project, "plan");
|
|
77
|
+
}
|
|
78
|
+
// Every path a call names: the single-valued fields and the list-valued ones, in that order. Nothing else in an
|
|
79
|
+
// input is a path; an unknown shape names nothing and is left to the permission layer.
|
|
80
|
+
export function writePaths(call) {
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const field of PATH_FIELDS) {
|
|
83
|
+
const value = call.input[field];
|
|
84
|
+
if (typeof value === "string" && value.trim())
|
|
85
|
+
out.push(value);
|
|
86
|
+
}
|
|
87
|
+
for (const field of PATH_LISTS) {
|
|
88
|
+
const value = call.input[field];
|
|
89
|
+
if (Array.isArray(value))
|
|
90
|
+
for (const item of value)
|
|
91
|
+
if (typeof item === "string" && item.trim())
|
|
92
|
+
out.push(item);
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
// The guard itself: a pure answer for one call, so the hook stays a journal line and a throw. Nothing here blocks
|
|
97
|
+
// anything on its own; the caller turns `ok: false` into the tool's error and journals `advisory` without blocking.
|
|
98
|
+
export function writeGuard(call, scope) {
|
|
99
|
+
try {
|
|
100
|
+
const root = realish(scope.root);
|
|
101
|
+
const base = scope.directory === undefined ? undefined : realish(scope.directory);
|
|
102
|
+
if (WRITE_TOOLS.has(call.tool))
|
|
103
|
+
return writes(call, root, base);
|
|
104
|
+
if (call.tool === "shell")
|
|
105
|
+
return shell(call, root, base);
|
|
106
|
+
return { ok: true };
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
// A throw here would become the tool's error anyway, but with no reason the journal can read. Failing closed is
|
|
110
|
+
// the boundary's rule (D10): a target this cannot resolve is refused, not waved through.
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
reason: "a target the plan guard could not read",
|
|
114
|
+
message: `The plan guard could not read the target of this ${call.tool} call (${err instanceof Error ? err.message : String(err)}). Nothing was changed; use a path under the plan directory and say in the report what you wanted instead.`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const refused = (reason, message) => ({ ok: false, reason, message });
|
|
119
|
+
function writes(call, root, base) {
|
|
120
|
+
const named = writePaths(call);
|
|
121
|
+
// Fail closed: a patch whose targets are inside its text, or a write tool whose input this guard cannot read, names
|
|
122
|
+
// no path it can check. Refusing is the boundary's rule; the message says which tool to use instead.
|
|
123
|
+
if (named.length === 0) {
|
|
124
|
+
return refused(`a ${call.tool} whose target cannot be read`, `This ${call.tool} call names no path this guard can check (the patch tool carries its targets inside the patch text). Plan mode changes nothing outside the plan directory, so it was refused; use edit or write with an explicit path under the plan directory.`);
|
|
125
|
+
}
|
|
126
|
+
for (const path of named) {
|
|
127
|
+
const expanded = homeward(path);
|
|
128
|
+
const target = realish(isAbsolute(expanded) ? expanded : resolve(base ?? process.cwd(), expanded));
|
|
129
|
+
if (!insidePath(target, root)) {
|
|
130
|
+
return refused("a write outside the plan root", `"${path}" resolves outside the plan directory (${root}). The project is read-only in plan mode, so this write was refused; write the plan and its artifacts under the plan directory, and say in the report what you wanted to change.`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { ok: true };
|
|
134
|
+
}
|
|
135
|
+
function shell(call, root, base) {
|
|
136
|
+
const command = typeof call.input.command === "string" ? call.input.command : "";
|
|
137
|
+
if (!command.trim())
|
|
138
|
+
return { ok: true };
|
|
139
|
+
const notes = [];
|
|
140
|
+
for (const words of segments(command)) {
|
|
141
|
+
for (let i = 0; i < words.length; i++) {
|
|
142
|
+
const word = opening(words[i]);
|
|
143
|
+
if (word === "cd") {
|
|
144
|
+
const target = words[i + 1];
|
|
145
|
+
// No argument goes home, `-` goes back to wherever the user was: both leave the plan root.
|
|
146
|
+
if (target === undefined || target === "-" || climbsOrLeaves(target, root)) {
|
|
147
|
+
return refused("a cd that leaves the plan root", `"${command.trim()}" changes directory out of the plan directory (${root}). A command outside the plan root sees the user's own checkout, which plan mode changes nothing of; stay in the plan directory or report what you need.`);
|
|
148
|
+
}
|
|
149
|
+
notes.push(`cd ${target} stays inside the plan directory`);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (word === "git") {
|
|
153
|
+
const sub = gitSubcommand(words, i + 1);
|
|
154
|
+
if (sub !== undefined && REFS.has(sub)) {
|
|
155
|
+
return refused(`git ${sub}`, `"git ${sub}" moves refs that the user's own checkout shares with this worktree, and a plan changes nothing of the project. Read the history instead (git log, git show, git status).`);
|
|
156
|
+
}
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (word === "rm") {
|
|
160
|
+
const args = words.slice(i + 1).filter((w) => !w.startsWith("-"));
|
|
161
|
+
if (args.some((arg) => climbsOrLeaves(arg, root))) {
|
|
162
|
+
return refused("an rm that leaves the plan root", `"${command.trim()}" deletes outside the plan directory (${root}). Files there belong to the project, which plan mode changes nothing of; delete only what the plan itself wrote.`);
|
|
163
|
+
}
|
|
164
|
+
notes.push(`rm ${args.join(" ")} stays inside the plan directory, where deletion is allowed but not contained`);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Last, so a path that belongs to a refused `cd`, `rm` or git command is named by that clearer refusal above.
|
|
169
|
+
for (const word of words) {
|
|
170
|
+
for (const abs of absolutePaths(word)) {
|
|
171
|
+
if (outside(abs, root, base)) {
|
|
172
|
+
return refused("an absolute path outside the plan root", `"${abs}" is outside the plan directory (${root}) and outside the session's own directory. A plan works in the plan directory; use a path there, or report what you need instead of reading or writing this one.`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// The words this cannot read: it reads command text, not what a program does, so everything else is the sandbox's
|
|
178
|
+
// (A1-T7) to hold. What is named here is journalled, not blocked.
|
|
179
|
+
return notes.length ? { ok: true, advisory: notes.join("; ") } : { ok: true };
|
|
180
|
+
}
|
|
181
|
+
// A `~` is the user's home, which is outside the plan root and is refused by the same rule as any other outside path.
|
|
182
|
+
function homeward(path) {
|
|
183
|
+
if (path === "~")
|
|
184
|
+
return homedir();
|
|
185
|
+
if (path.startsWith("~/"))
|
|
186
|
+
return join(homedir(), path.slice(2));
|
|
187
|
+
return path;
|
|
188
|
+
}
|
|
189
|
+
// Whether a relative `cd`/`rm` argument climbs with `..`, or an absolute one points outside the root. A relative path
|
|
190
|
+
// without `..` stays where the command already is, so it cannot leave the root.
|
|
191
|
+
function climbsOrLeaves(word, root) {
|
|
192
|
+
const path = homeward(word);
|
|
193
|
+
if (path.split("/").includes(".."))
|
|
194
|
+
return true;
|
|
195
|
+
return isAbsolute(path) && !insidePath(realish(path), root);
|
|
196
|
+
}
|
|
197
|
+
// An absolute path outside the plan root and outside the session's own directory. The streams and the system temp
|
|
198
|
+
// directory are not places a command works in, so they are not refused.
|
|
199
|
+
function outside(path, root, base) {
|
|
200
|
+
if (!isAbsolute(path))
|
|
201
|
+
return false;
|
|
202
|
+
if (STREAMS.has(path))
|
|
203
|
+
return false;
|
|
204
|
+
const target = realish(path);
|
|
205
|
+
if (insidePath(target, root))
|
|
206
|
+
return false;
|
|
207
|
+
if (base !== undefined && insidePath(target, base))
|
|
208
|
+
return false;
|
|
209
|
+
return !insidePath(target, realish(tmpdir()));
|
|
210
|
+
}
|
|
211
|
+
// The simple commands a shell joins with `&&`, `||`, `;`, `|` and a newline, each as its words. Quotes keep a path in
|
|
212
|
+
// one piece; a backslash escapes the next character. Not a parser: a substitution or a heredoc is left alone, and the
|
|
213
|
+
// sandbox is what catches those.
|
|
214
|
+
function segments(command) {
|
|
215
|
+
const out = [];
|
|
216
|
+
let current = [];
|
|
217
|
+
let word = "";
|
|
218
|
+
let quoted;
|
|
219
|
+
let started = false;
|
|
220
|
+
const flush = () => {
|
|
221
|
+
if (started)
|
|
222
|
+
current.push(word);
|
|
223
|
+
word = "";
|
|
224
|
+
started = false;
|
|
225
|
+
};
|
|
226
|
+
const next = () => {
|
|
227
|
+
flush();
|
|
228
|
+
if (current.length)
|
|
229
|
+
out.push(current);
|
|
230
|
+
current = [];
|
|
231
|
+
};
|
|
232
|
+
for (let i = 0; i < command.length; i++) {
|
|
233
|
+
const c = command[i];
|
|
234
|
+
if (quoted !== undefined) {
|
|
235
|
+
if (c === quoted)
|
|
236
|
+
quoted = undefined;
|
|
237
|
+
else
|
|
238
|
+
word += c;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (c === '"' || c === "'") {
|
|
242
|
+
quoted = c;
|
|
243
|
+
started = true;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (c === "\\") {
|
|
247
|
+
i++;
|
|
248
|
+
if (i < command.length) {
|
|
249
|
+
word += command[i];
|
|
250
|
+
started = true;
|
|
251
|
+
}
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (c === " " || c === "\t" || c === "\r") {
|
|
255
|
+
flush();
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (c === "\n") {
|
|
259
|
+
next();
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (c === ";" || c === "|" || c === "&") {
|
|
263
|
+
next();
|
|
264
|
+
if (command[i + 1] === c)
|
|
265
|
+
i++;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
word += c;
|
|
269
|
+
started = true;
|
|
270
|
+
}
|
|
271
|
+
next();
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
// A command name with a subshell's opening bracket in front of it: "(cd .." is a cd too.
|
|
275
|
+
function opening(word) {
|
|
276
|
+
return word.replace(/^[({]+/, "");
|
|
277
|
+
}
|
|
278
|
+
// The git subcommand, past the options that come before it. `-C <dir>` and the other value-taking options are
|
|
279
|
+
// stepped over with their value; anything else that starts with "-" is a flag on its own.
|
|
280
|
+
function gitSubcommand(words, from) {
|
|
281
|
+
for (let i = from; i < words.length; i++) {
|
|
282
|
+
const word = words[i];
|
|
283
|
+
if (word === "--")
|
|
284
|
+
return undefined;
|
|
285
|
+
if (word.startsWith("-")) {
|
|
286
|
+
if (!word.includes("=") && GIT_VALUE_OPTS.has(word))
|
|
287
|
+
i++;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
return word;
|
|
291
|
+
}
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
294
|
+
// The absolute paths a word can name: the word itself, a redirection target ("2>/tmp/x"), and an option's value
|
|
295
|
+
// ("--out=/tmp/x").
|
|
296
|
+
function absolutePaths(word) {
|
|
297
|
+
const out = [];
|
|
298
|
+
let bare = word.replace(/^\d+(?=[<>])/, "");
|
|
299
|
+
bare = bare.replace(/^[<>]+/, "");
|
|
300
|
+
if (!bare)
|
|
301
|
+
return out;
|
|
302
|
+
if (isAbsolute(bare))
|
|
303
|
+
out.push(bare);
|
|
304
|
+
const eq = bare.indexOf("=");
|
|
305
|
+
if (eq > 0) {
|
|
306
|
+
const value = bare.slice(eq + 1);
|
|
307
|
+
if (isAbsolute(value))
|
|
308
|
+
out.push(value);
|
|
309
|
+
}
|
|
310
|
+
return out;
|
|
311
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omacode/micromanager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "An OpenCode v2 plugin that orchestrates sub-agents, with
|
|
6
|
+
"description": "An OpenCode v2 plugin that orchestrates sub-agents, with a local GLiNER decider making the decisions",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"author": "Tobias Rentschler <tobias-rentschler@gmx.de>",
|
|
9
9
|
"repository": {
|
|
@@ -16,20 +16,28 @@
|
|
|
16
16
|
"url": "https://github.com/RentschlerTobias/Omacode/issues"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=22.
|
|
19
|
+
"node": ">=22.18.0"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
|
-
".": "./
|
|
23
|
-
"./guard": "./
|
|
24
|
-
"./shell": "./
|
|
25
|
-
"./context": "./
|
|
22
|
+
".": "./dist/plugin.js",
|
|
23
|
+
"./guard": "./dist/guard/index.js",
|
|
24
|
+
"./shell": "./dist/shell/index.js",
|
|
25
|
+
"./context": "./dist/context/index.js",
|
|
26
|
+
"./features": "./dist/features.js",
|
|
27
|
+
"./setup": "./dist/setup.js",
|
|
28
|
+
"./mode": "./dist/mode.js"
|
|
29
|
+
},
|
|
30
|
+
"bin": {
|
|
31
|
+
"omacode": "./dist/cli.js"
|
|
26
32
|
},
|
|
27
33
|
"files": [
|
|
28
|
-
"src",
|
|
29
34
|
"skills",
|
|
30
35
|
"evolver/pyproject.toml",
|
|
31
36
|
"evolver/uv.lock",
|
|
32
|
-
"evolver/mm_evolve"
|
|
37
|
+
"evolver/mm_evolve",
|
|
38
|
+
"dist",
|
|
39
|
+
"decider",
|
|
40
|
+
"THIRD_PARTY.md"
|
|
33
41
|
],
|
|
34
42
|
"keywords": [
|
|
35
43
|
"opencode",
|
|
@@ -41,17 +49,28 @@
|
|
|
41
49
|
"access": "public"
|
|
42
50
|
},
|
|
43
51
|
"scripts": {
|
|
44
|
-
"prepack": "node ../../scripts/
|
|
45
|
-
"postpack": "node ../../scripts/
|
|
52
|
+
"prepack": "node ../../scripts/pack-js.mjs",
|
|
53
|
+
"postpack": "node ../../scripts/pack-js.mjs --restore"
|
|
46
54
|
},
|
|
47
55
|
"dependencies": {
|
|
48
|
-
"@omacode/context": "0.
|
|
49
|
-
"@omacode/core": "0.
|
|
50
|
-
"@omacode/guard": "0.
|
|
51
|
-
"@omacode/sandbox": "0.
|
|
52
|
-
"@omacode/state": "0.
|
|
53
|
-
"@omacode/tui": "0.
|
|
56
|
+
"@omacode/context": "1.0.0",
|
|
57
|
+
"@omacode/core": "1.0.0",
|
|
58
|
+
"@omacode/guard": "1.0.0",
|
|
59
|
+
"@omacode/sandbox": "1.0.0",
|
|
60
|
+
"@omacode/state": "1.0.0",
|
|
61
|
+
"@omacode/tui": "1.0.0",
|
|
54
62
|
"@anthropic-ai/sandbox-runtime": "0.0.81",
|
|
55
63
|
"playwright-core": "^1.64.1"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@omacode/artifact": "^1.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"@omacode/artifact": {
|
|
70
|
+
"optional": true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@omacode/artifact": "1.0.0"
|
|
56
75
|
}
|
|
57
76
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deck
|
|
3
|
+
description: Build and check an HTML deck with the deck adapter. Use when a task produces slides, a presentation or a talk, or when a deck has to pass its checks before it is presented.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
source: own
|
|
7
|
+
verified_against: hyperframes 0.9.54, its slideshow manifest and `hyperframes check --json`
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Deck
|
|
11
|
+
|
|
12
|
+
A deck is data first: a `DeckSpec` (version 2) of slides, notes, reveals, branches and hotspots. The deck adapter
|
|
13
|
+
writes it as a HyperFrames project, the engine's own checks decide whether it may be presented, and the quality gate
|
|
14
|
+
decides whether it is worth presenting. Your job is the spec and its content, not the HTML.
|
|
15
|
+
|
|
16
|
+
## What the spec says
|
|
17
|
+
|
|
18
|
+
A complete `deck.json`; `kind`, `version`, `job`, `brief` and `slides` are required, and there is no top-level `title`:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"kind": "deck",
|
|
23
|
+
"version": 2,
|
|
24
|
+
"job": "local-ai",
|
|
25
|
+
"brief": "Why run AI models on your own computer",
|
|
26
|
+
"slides": [
|
|
27
|
+
{ "id": "intro", "title": "Your AI, your machine", "body": "Why run models at home", "notes": "Open with the question." },
|
|
28
|
+
{ "id": "privacy", "title": "Privacy", "body": "Nothing leaves the machine\nNo account, no upload", "notes": "Two points, one per click.", "reveals": [0, 1] }
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- `job` is a short name for this deck (letters, digits, `-`); `brief` is one sentence on what it is for.
|
|
34
|
+
- `slides[]`, each with `id`, `title`, `body`, `notes`, and optionally `asset`, `reveals`, `hotspots`, `hidden`.
|
|
35
|
+
- `branches[]` are the optional paths off a slide; a `hotspot` with `target` names one. The main line's id `main` is
|
|
36
|
+
the player's, so a branch cannot use it.
|
|
37
|
+
- `reveals` are line indices of the slide's `body` (lines split at `\n`, counted from 0): each named line appears on
|
|
38
|
+
its own click, in ascending order, after the slide has come up with its other lines. They are not seconds.
|
|
39
|
+
`"body": "Point\nDetail one\nDetail two", "reveals": [1, 2]` shows "Point", then "Detail one", then "Detail two".
|
|
40
|
+
- Every path is relative to the job directory. An absolute path, a `..` or a backslash is refused, as is a slide id
|
|
41
|
+
that is used twice or a hotspot that points at a branch that does not exist.
|
|
42
|
+
|
|
43
|
+
## What the deck must survive
|
|
44
|
+
|
|
45
|
+
The adapter runs the engine's checks, and each one can fail:
|
|
46
|
+
|
|
47
|
+
- **slide count** — the rendered deck has a scene per visible slide; a hidden slide is not a scene.
|
|
48
|
+
- **overflow** — no text leaves its box, at nine sampled moments.
|
|
49
|
+
- **contrast** — every text pair passes WCAG AA; grey on grey fails even when it "looks fine".
|
|
50
|
+
- **notes** — every visible slide has speaker notes; a deck read aloud without them is not finished.
|
|
51
|
+
- **unresolved targets** — every `img`, audio and stylesheet reference points at a file in the project. An `<a href>`
|
|
52
|
+
is **not** checked by the engine; if a slide links somewhere, say so in the notes so a reader knows.
|
|
53
|
+
- **branch** — every hotspot names a branch, and every branch slide is a scene.
|
|
54
|
+
- **snapshots** — one frame per slide, and no frame is blank (99.9 % of one colour).
|
|
55
|
+
- **presenter** — a probe opens `hyperframes present` in a real browser and steps through every slide and reveal:
|
|
56
|
+
exactly one slide on stage at each step, its title shown, no console error. This is what the audience sees; a
|
|
57
|
+
deck can pass every frame check and still fail here.
|
|
58
|
+
|
|
59
|
+
In the presenter each slide comes up with a short rise-in of its rule, title and lines; snapshots and checks see the
|
|
60
|
+
finished slide. You do not write animation code: the adapter owns the HTML.
|
|
61
|
+
|
|
62
|
+
## Studio and hand edits
|
|
63
|
+
|
|
64
|
+
`make_artifact` with `present: studio` opens the deck in HyperFrames Studio instead of the presenter: the user sees the
|
|
65
|
+
slides on a timeline and can change them by hand. When they point at something ("make this bigger"), read what they
|
|
66
|
+
selected with `hyperframes preview --selection --json`, run in the deck's folder.
|
|
67
|
+
|
|
68
|
+
The adapter writes `index.html` from `deck.json` and records what it wrote. If the page was changed since (in the
|
|
69
|
+
Studio or an editor), the next build stops with "index.html was changed by hand" instead of overwriting it. Then ask
|
|
70
|
+
the user: keep the changes (leave the deck, or carry text, order and notes into `deck.json` yourself), or drop them
|
|
71
|
+
(delete `index.html` and build again). Never delete it without asking.
|
|
72
|
+
|
|
73
|
+
Share and Publish in the Studio upload the deck to HeyGen's servers; say so when you open the Studio.
|
|
74
|
+
|
|
75
|
+
## History: undo and go back
|
|
76
|
+
|
|
77
|
+
Every build is one entry in the deck's HyperFrames history, beside the user's Studio edits and the changes made outside
|
|
78
|
+
the app (your edits to `deck.json`). It lives in the deck's folder; read it there with
|
|
79
|
+
`HYPERFRAMES_CACHE_DIR=.home/.cache/hyperframes hyperframes history` (`show <id>`, `peek <id>`, `undo`, `restore <id>`).
|
|
80
|
+
|
|
81
|
+
`restore <id>` makes the files what they were right after that entry. To go back to an older deck, restore the entry
|
|
82
|
+
from before the `deck.json` change that came after it; otherwise the next build makes the newer deck again from
|
|
83
|
+
`deck.json`. Restoring an earlier build is not a hand edit, so building afterwards works. Ask the user before restoring.
|
|
84
|
+
|
|
85
|
+
A missing picture is not a failure: it becomes a labelled placeholder (`missing asset: <path>`), and the check names it.
|
|
86
|
+
Write the path you meant anyway — the placeholder is how the deck stays presentable while the image is still missing.
|
|
87
|
+
|
|
88
|
+
## Presenting
|
|
89
|
+
|
|
90
|
+
`hyperframes present` serves the deck; `hyperframes render` is for video compositions and is **never** run on a deck.
|
|
91
|
+
The presenter needs the host's network because its server listens inside the sandbox, which is the one call the adapter
|
|
92
|
+
runs unwrapped; every check runs without it.
|
|
93
|
+
|
|
94
|
+
## When something fails
|
|
95
|
+
|
|
96
|
+
Fix the spec or the content, not the check. A slide that overflows needs fewer words, not a smaller font; a slide
|
|
97
|
+
without notes needs the sentence you would have said. If a check is `skipped` with a reason (no vision model, an
|
|
98
|
+
unsupported frame), say so in the report — a skipped check is an absence, never a pass.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design
|
|
3
|
+
description: Edit the user's real website, deck, media or 3D scene through the design canvas. Use when a `.design.json` part is to change, when the user queued an intent by clicking the canvas, or when a task produces a preview the user points at.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
source: own
|
|
7
|
+
verified_against: .design.json v1 (packages/artifact/src/design) and the four design tools (packages/micromanager/src/plugin.ts, design.ts)
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Design canvas
|
|
11
|
+
|
|
12
|
+
The canvas is an interactive view over the project's **real files**: one read-only content origin and one control
|
|
13
|
+
origin in the plugin process, shown as a page in the user's own browser. The user clicks an element, writes a prompt,
|
|
14
|
+
and the click becomes an intent. The next agent turn drains the intent, edits the files, and commits them. Your job is
|
|
15
|
+
the files and that one commit — not the canvas page itself.
|
|
16
|
+
|
|
17
|
+
## When to use design mode
|
|
18
|
+
|
|
19
|
+
- The task changes a part named in the worktree's `.design.json`, or `design_status` shows queued intents.
|
|
20
|
+
- The user says "change this" about something rendered on the canvas: a website, a slide, a picture or clip, a 3D
|
|
21
|
+
scene.
|
|
22
|
+
- A task produces a preview the user will point at, rather than a file only a terminal reads.
|
|
23
|
+
|
|
24
|
+
Design mode is not for terminal-only work, and **none of the design tools work in plan mode**: `design_open`,
|
|
25
|
+
`design_status`, `design_pull`, `design_commit` and `design_release` are all in the deny set. If `design_status` says
|
|
26
|
+
no session is open, `design_open` the worktree first; never invent a worktree path.
|
|
27
|
+
|
|
28
|
+
## The manifest and the four part kinds
|
|
29
|
+
|
|
30
|
+
A `.design.json` (version 1) at the worktree root points at the real files; it does not wrap or replace them:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"version": 1,
|
|
35
|
+
"parts": [
|
|
36
|
+
{ "id": "site", "kind": "html", "path": "site", "entry": "index.html", "driver": "scroll", "source": "site/index.html" },
|
|
37
|
+
{ "id": "talk", "kind": "composition", "path": "deck", "entry": "index.html", "driver": "play", "source": "deck/deck.json" },
|
|
38
|
+
{ "id": "proof", "kind": "media", "path": "media/proof", "entry": "index.html", "driver": "play", "source": "video/proof.json" },
|
|
39
|
+
{ "id": "world", "kind": "scene", "path": "scene/world", "entry": "index.html", "driver": "click", "source": "scene/world.ts" }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `id`, `kind`, `path`, `entry` and `source` are required. `path` is the part's directory (served as a root), `entry`
|
|
45
|
+
is the page the browser loads, and `source` is the real file you edit. All paths are relative to the worktree: an
|
|
46
|
+
absolute path, a `..` or a backslash is refused, and the entry file must exist.
|
|
47
|
+
- `driver` is optional and may be `play`, `scroll` or `click` on any kind; it tells the shell how the part is driven.
|
|
48
|
+
Match what the part really does; when it is omitted the shell shows the part as it is.
|
|
49
|
+
- `tokens` is either inline values or a path to a token file relative to the part's directory. Keep design values
|
|
50
|
+
(colours, spacing, durations) there rather than hard-coding them, so the canvas sliders can change them.
|
|
51
|
+
|
|
52
|
+
| Part kind | Engine | What it is | Usual driver |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| `html` | plain site source | the website: HTML, CSS and JavaScript | `scroll` (or `click` for an app-like page) |
|
|
55
|
+
| `composition` | HyperFrames | slide decks and motion pieces | `play` |
|
|
56
|
+
| `media` | ComfyUI + Manim | generated images and clips, math animation | `play` |
|
|
57
|
+
| `scene` | three.js | interactive 3D scenes | `click` |
|
|
58
|
+
|
|
59
|
+
Each kind has its own driver because each is a different engine:
|
|
60
|
+
|
|
61
|
+
- **`html`** — edit the site's own files with your normal tools. When the `web` skill is available, follow it for the
|
|
62
|
+
HTML, CSS and JavaScript.
|
|
63
|
+
- **`composition`** — HyperFrames owns the HTML; you author the deck or video spec and build it with the `deck` or
|
|
64
|
+
`video` skill. Do not hand-write the composition's generated page.
|
|
65
|
+
- **`media`** — make the image or clip with ComfyUI, or a math animation with Manim through the `video` skill, then
|
|
66
|
+
point the part at the result. An animated clip is a media part; a still picture can also live inside an `html` part.
|
|
67
|
+
- **`scene`** — you write the three.js scene source yourself; the part is the rendered scene, not a page around it.
|
|
68
|
+
|
|
69
|
+
## Composition parts
|
|
70
|
+
|
|
71
|
+
For a deck the source is the deck's **folder** — `deck.json` plus its assets — so `path` and `source` are the same
|
|
72
|
+
directory and `entry` is the built HTML inside it. The build is an adapter step, never a manifest rewrite:
|
|
73
|
+
|
|
74
|
+
- After an intent edits the source, rebuild the entry through the deck adapter and `design_commit` the **source
|
|
75
|
+
only** — never `index.html`. Committing the built output is refused; a commit that touches the source settles the
|
|
76
|
+
part's intents, because the build is derived work, not the change itself.
|
|
77
|
+
- A **`stale build`** tag on the part means the source is newer than the entry. The canvas keeps serving the older
|
|
78
|
+
build rather than the source, so rebuild before you judge the render — the tag is about the page you are looking
|
|
79
|
+
at, not about the deck being broken.
|
|
80
|
+
- `driver: "play"` makes the shell's Play/Pause/Restart reach the deck through `window.__player`
|
|
81
|
+
(`play`/`pause`/`seek`/`getTime`/`getDuration`/`isPlaying`) over `postMessage`, not a CSS imitation. A hand-rolled
|
|
82
|
+
player may instead listen for a `design:driver` CustomEvent on `document`; the injected overlay raises one for
|
|
83
|
+
every transport action.
|
|
84
|
+
|
|
85
|
+
## Static math is KaTeX; an animated derivation is Manim
|
|
86
|
+
|
|
87
|
+
The choice is motion, not subject:
|
|
88
|
+
|
|
89
|
+
- **KaTeX** for an equation that stays still: it renders TeX in the page as text, needs no LaTeX install, and stays
|
|
90
|
+
crisp at every zoom. Bundle it locally — the canvas works offline, so no CDN.
|
|
91
|
+
- **Manim** for a derivation that moves: terms that rearrange, a proof that builds line by line, a graph that is drawn.
|
|
92
|
+
Make the clip with the `video` skill (`video.json`, `make_artifact`) and embed it in the page or as a `media` part.
|
|
93
|
+
|
|
94
|
+
Do not render a static equation with Manim: it costs a render for pixels where text would do, and the equation cannot
|
|
95
|
+
be selected or resized. Do not fake an animated derivation with CSS transforms: each step has to be right, and Manim
|
|
96
|
+
is what makes the steps consistent. LaTeX is not installed on this host, so Manim's `Tex` and `MathTex` fail — use
|
|
97
|
+
`Text` with Unicode (`Text("a² + b² = c²")`) or tell the user LaTeX is needed.
|
|
98
|
+
|
|
99
|
+
## The scroll rule
|
|
100
|
+
|
|
101
|
+
**HyperFrames cannot scroll.** A `composition` (and a `media` clip) is a fixed-size stage that the playhead moves;
|
|
102
|
+
there is no scrollbar, and anything below the frame is simply clipped.
|
|
103
|
+
|
|
104
|
+
- Content longer than the frame moves with the **playhead**: pan it through the timeline, or cut it into scenes.
|
|
105
|
+
- A long page that must really scroll is an `html` part with `driver: "scroll"`. If the user asks to scroll a deck or
|
|
106
|
+
a film, say no and offer scenes, a playhead pan, or an image sequence instead of a scrollbar.
|
|
107
|
+
- Never put a page-long page into a composition and hope the iframe scrolls: it will not.
|
|
108
|
+
|
|
109
|
+
## The one-writer rule, and one commit
|
|
110
|
+
|
|
111
|
+
- One lock per worktree. The session that opened the canvas holds it; `design_open` refuses a second session for the
|
|
112
|
+
same worktree and names the holder. Do not edit around a lock or kill the session: use the open canvas, and ask the
|
|
113
|
+
user if it should be released.
|
|
114
|
+
- **One commit per applied change**, in the worker worktree, and the lock's holder is that commit's only author. Do not
|
|
115
|
+
run your own `git add` or `git commit` for a part, do not batch two changes into one commit, and do not split one
|
|
116
|
+
change across two.
|
|
117
|
+
- The session lives while the user's shell heartbeats. Do not call `design_release` just because a turn ended or as a
|
|
118
|
+
way to "save": it stops both origins and ends the page the user is looking at. Release only when the work over the
|
|
119
|
+
canvas is done.
|
|
120
|
+
|
|
121
|
+
## The loop: drain, edit, commit
|
|
122
|
+
|
|
123
|
+
1. **Drain at the start of the turn.** Call `design_pull` with the worktree before touching files. It returns the
|
|
124
|
+
queued intents — part id, `cssPath`, `outerHTML`, computed styles and the user's prompt — and marks them in-flight,
|
|
125
|
+
so a later turn is not given the same request twice. An empty list means there is no canvas change to make. Never
|
|
126
|
+
wake an agent from the canvas and never edit from a prompt you only read on the page.
|
|
127
|
+
2. **Edit the real files.** Read the part's `source` and `path`, then use your normal tools. If another writer could
|
|
128
|
+
touch the same part, hash each file before you edit it (`sha256sum`) and pass the hashes as `told` to the commit; a
|
|
129
|
+
changed hash is refused instead of silently overwritten. Edit only what the intents ask for; leave the rest of the
|
|
130
|
+
worktree alone.
|
|
131
|
+
3. **`design_commit` exactly the part paths.** Pass the worktree, a message, and the `path` of each part you touched
|
|
132
|
+
(plus any token file the change wrote). The commit stages only those paths — never `git add -A` — refuses when a
|
|
133
|
+
`told` hash no longer matches, records a `design.commit` decision, and settles the in-flight intents of those parts,
|
|
134
|
+
which is what marks them done.
|
|
135
|
+
4. **Leave unrelated work uncommitted.** A file that was already dirty elsewhere stays dirty; a part you did not touch
|
|
136
|
+
is not in the commit. One intent that spans two parts is still one applied change, so if the parts belong together
|
|
137
|
+
commit them in one `design_commit`, otherwise commit each change on its own.
|
|
138
|
+
5. **Keep the canvas open.** The shell reloads the changed part from the commit; the user continues from there. Call
|
|
139
|
+
`design_release` only when the work over the canvas is finished.
|
|
140
|
+
|
|
141
|
+
## When something fails
|
|
142
|
+
|
|
143
|
+
- A refused `design_open` names the holder's sessionID. Do not force a second session; work through the one that is
|
|
144
|
+
open, or ask the user before releasing it.
|
|
145
|
+
- A drift refusal in `design_commit` means the files changed after you read them. Re-read the part, decide whether the
|
|
146
|
+
other change should stay, then edit and commit again. Never work around it with `git add -A` or by dropping `told`
|
|
147
|
+
to hide a conflict.
|
|
148
|
+
- When the design checks report a failure (manifest, parts, revision, reload), it is about the work, not the check:
|
|
149
|
+
fix the manifest or the part. `design_status` reports the queued and in-flight counts; say so in the report when a
|
|
150
|
+
check is skipped rather than green.
|