@creator-notes/cnotes 0.116.0 → 0.117.1
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/.claude-plugin/plugin.json +1 -1
- package/dist/commands/draft.js +9 -0
- package/dist/commands/files.js +2 -1
- package/dist/commands/operations.js +18 -0
- package/dist/lib/image-types.js +15 -0
- package/dist/lib/waiting-proposals.js +39 -0
- package/dist/mcp-server.js +3 -2
- package/package.json +1 -1
- package/skills/cnotes/SKILL.md +1 -1
- package/skills/cnotes/references/drafts.md +10 -0
- package/skills/cnotes/references/more-commands.md +1 -0
package/dist/commands/draft.js
CHANGED
|
@@ -1033,6 +1033,10 @@ verb (Changes), or repeats the headline or the Why; nothing is saved, so
|
|
|
1033
1033
|
rewrite the line and ask again. The runs you flagged with operations end
|
|
1034
1034
|
--unsure are listed for the person as the ones to look at.
|
|
1035
1035
|
|
|
1036
|
+
If another open proposal you can see rewords one of the same notes, the ask
|
|
1037
|
+
prints it to stderr as "Overlaps: ...": compare the two (cnotes draft status
|
|
1038
|
+
<id>) and say in the ask which should land first, or fold one into the other.
|
|
1039
|
+
|
|
1036
1040
|
If a check blocks when you ask, the ask is still made, so a person can help
|
|
1037
1041
|
settle it. Each blocking check is printed to stderr, the person sees the
|
|
1038
1042
|
proposal blocked, and nothing can be accepted until you fix it and ask again.
|
|
@@ -1060,6 +1064,11 @@ Examples:
|
|
|
1060
1064
|
const blocking = asked.checks.findings.filter((f) => f.blocking);
|
|
1061
1065
|
for (const f of blocking)
|
|
1062
1066
|
console.error(`Blocking: ${f.message} ${f.fix}`);
|
|
1067
|
+
// Another open proposal rewords the same notes: say so whatever the
|
|
1068
|
+
// output mode, so the agent compares the two before the person decides.
|
|
1069
|
+
for (const f of asked.checks.findings.filter((f) => f.code === "proposal-overlap")) {
|
|
1070
|
+
console.error(`Overlaps: ${f.message} ${f.fix}`);
|
|
1071
|
+
}
|
|
1063
1072
|
if (cfg.quiet) {
|
|
1064
1073
|
console.log(inPlaceId);
|
|
1065
1074
|
return;
|
package/dist/commands/files.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveConfig } from "../lib/config.js";
|
|
|
5
5
|
import { handleError, ValidationError, ApiError, CliError, EXIT_CODES, } from "../lib/errors.js";
|
|
6
6
|
import { outputJson, outputQuiet } from "../lib/output.js";
|
|
7
7
|
import { extractStorageId } from "../lib/storage-id.js";
|
|
8
|
+
import { unsupportedImageTypeMessage } from "../lib/image-types.js";
|
|
8
9
|
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
|
|
9
10
|
const MIME_MAP = {
|
|
10
11
|
".jpg": "image/jpeg",
|
|
@@ -134,7 +135,7 @@ Examples:
|
|
|
134
135
|
const mimeType = getMimeType(absPath);
|
|
135
136
|
if (!mimeType) {
|
|
136
137
|
const ext = path.extname(absPath) || "(none)";
|
|
137
|
-
throw new ValidationError(
|
|
138
|
+
throw new ValidationError(unsupportedImageTypeMessage(ext));
|
|
138
139
|
}
|
|
139
140
|
// Read file into memory once; build fresh FormData per attempt for retry safety
|
|
140
141
|
const buffer = readFileSync(absPath);
|
|
@@ -9,6 +9,7 @@ import { loadConfig, setActiveAgentRunId, registerAgentRun, unregisterAgentRun,
|
|
|
9
9
|
import { resolveHostAgentSession } from "../lib/claude-session.js";
|
|
10
10
|
import { allWorkspaceRubrics, loadRubricMap } from "../lib/rubrics.js";
|
|
11
11
|
import { briefIsEmpty, loadSessionBrief, renderBrief } from "../lib/session-brief.js";
|
|
12
|
+
import { renderProposalsForCaller } from "../lib/waiting-proposals.js";
|
|
12
13
|
/**
|
|
13
14
|
* `cnotes operations` — workspace-scoped lifecycle for agentic batches.
|
|
14
15
|
*
|
|
@@ -64,6 +65,12 @@ pointer, so neither agent can clobber or close the other's run.
|
|
|
64
65
|
|
|
65
66
|
-q prints only the run id, without the rubrics and the brief.
|
|
66
67
|
|
|
68
|
+
Proposals: begin lists the open proposals asked of you in this workspace
|
|
69
|
+
(waitingOnYou) and your own not yet asked that reword a note another open
|
|
70
|
+
proposal also rewords (overlapping), each with its overlaps. Compare
|
|
71
|
+
overlapping proposals before either is accepted. Under -q these lines go to
|
|
72
|
+
stderr.
|
|
73
|
+
|
|
67
74
|
--json includes typeRubrics: [{type, rubric}, ...] for every workspace type
|
|
68
75
|
that has a validationPrompt. Read the ones you will author BEFORE notes create
|
|
69
76
|
(or run cnotes types show <Type>). Post-write rubric echoes are too late to
|
|
@@ -150,7 +157,13 @@ start fresh, or --detached to open your own run alongside it.
|
|
|
150
157
|
]);
|
|
151
158
|
const typeRubrics = allWorkspaceRubrics(rubricMap);
|
|
152
159
|
reportHeadlineWarnings(readHeadlineWarnings(result));
|
|
160
|
+
// Proposals waiting on the caller, and the ones that overlap, reach
|
|
161
|
+
// the agent even under -q (on stderr), so it hears of another agent's
|
|
162
|
+
// work at the start of its own.
|
|
163
|
+
const proposalLines = renderProposalsForCaller(result);
|
|
153
164
|
if (cfg.quiet) {
|
|
165
|
+
for (const line of proposalLines)
|
|
166
|
+
console.error(line);
|
|
154
167
|
console.log(result.agentRunId);
|
|
155
168
|
return;
|
|
156
169
|
}
|
|
@@ -181,6 +194,11 @@ start fresh, or --detached to open your own run alongside it.
|
|
|
181
194
|
if (typeRubrics.length > 0) {
|
|
182
195
|
console.log(`${typeRubrics.length} type rubric${typeRubrics.length === 1 ? "" : "s"} in this workspace — read with \`cnotes types show <Type>\` BEFORE notes create (also in --json as typeRubrics).`);
|
|
183
196
|
}
|
|
197
|
+
if (proposalLines.length > 0) {
|
|
198
|
+
console.log("");
|
|
199
|
+
for (const line of proposalLines)
|
|
200
|
+
console.log(line);
|
|
201
|
+
}
|
|
184
202
|
if (brief && !briefIsEmpty(brief)) {
|
|
185
203
|
console.log("");
|
|
186
204
|
console.log("What the workspace already knows about this (read before acting):");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusal `files upload` and the stdio MCP server's `cnotes_files_upload`
|
|
3
|
+
* give for a file the server will not store. SVG gets its own reason because
|
|
4
|
+
* diagram renderers (Mermaid via Pele, statechart skills) emit it and an agent
|
|
5
|
+
* attaching a diagram reaches for it first; the server refuses SVG because an
|
|
6
|
+
* SVG file can carry script. Mirrors SVG_UPLOAD_REFUSAL in
|
|
7
|
+
* lib/image-constraints.ts (the CLI cannot import the app's lib).
|
|
8
|
+
*/
|
|
9
|
+
export function unsupportedImageTypeMessage(ext) {
|
|
10
|
+
if (ext.toLowerCase() === ".svg") {
|
|
11
|
+
return ("SVG isn't accepted, because an SVG file can carry scripts. Convert it to PNG first " +
|
|
12
|
+
"(for example `rsvg-convert -o diagram.png diagram.svg`) and upload the PNG.");
|
|
13
|
+
}
|
|
14
|
+
return `Unsupported file type: ${ext}. Allowed: .jpg, .jpeg, .png, .gif, .webp`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `operations begin` says about proposals in the workspace: the ones
|
|
3
|
+
* asked of the caller, and the caller's own that overlap another (V1 on
|
|
4
|
+
* CANVAS-461). Two agents rewording the same note in two proposals hear of
|
|
5
|
+
* each other here, at the start of their work, in output they already read.
|
|
6
|
+
*/
|
|
7
|
+
function overlapText(overlaps) {
|
|
8
|
+
return overlaps.map((o) => `overlaps ${o.displayId} on ${o.notes.join(", ")}`).join("; ");
|
|
9
|
+
}
|
|
10
|
+
/** The lines to print, or none when nothing waits and nothing overlaps. */
|
|
11
|
+
export function renderProposalsForCaller(result) {
|
|
12
|
+
const waiting = result.waitingOnYou ?? [];
|
|
13
|
+
const overlapping = result.overlapping ?? [];
|
|
14
|
+
if (waiting.length === 0 && overlapping.length === 0)
|
|
15
|
+
return [];
|
|
16
|
+
const lines = [];
|
|
17
|
+
if (waiting.length > 0) {
|
|
18
|
+
lines.push("Waiting on you in this workspace:");
|
|
19
|
+
for (const p of waiting) {
|
|
20
|
+
const parts = [`${p.displayId} "${p.name}"`, `built by ${p.builtBy}`];
|
|
21
|
+
if (p.sentBack)
|
|
22
|
+
parts.push("sent back");
|
|
23
|
+
if (p.overlaps.length > 0)
|
|
24
|
+
parts.push(overlapText(p.overlaps));
|
|
25
|
+
lines.push(` ${parts.join(" · ")}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (overlapping.length > 0) {
|
|
29
|
+
lines.push("Your proposals not yet asked that overlap another:");
|
|
30
|
+
for (const p of overlapping) {
|
|
31
|
+
lines.push(` ${p.displayId} "${p.name}" · ${overlapText(p.overlaps)}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const anyOverlap = overlapping.length > 0 || waiting.some((p) => p.overlaps.length > 0);
|
|
35
|
+
if (anyOverlap) {
|
|
36
|
+
lines.push("Overlapping proposals reword the same notes: compare them before either is accepted (`cnotes draft status <id>`), and say in the ask which should land first.");
|
|
37
|
+
}
|
|
38
|
+
return lines;
|
|
39
|
+
}
|
package/dist/mcp-server.js
CHANGED
|
@@ -38,6 +38,7 @@ import { parseReviewRef } from "./lib/review-helpers.js";
|
|
|
38
38
|
import { runQuery } from "./commands/query.js";
|
|
39
39
|
import { isLocalDbEnabled } from "./lib/auth-store.js";
|
|
40
40
|
import { explainTruncation, listNotes, SERVER_LIST_CAP } from "./lib/notes-list.js";
|
|
41
|
+
import { unsupportedImageTypeMessage } from "./lib/image-types.js";
|
|
41
42
|
// ---------------------------------------------------------------------------
|
|
42
43
|
// Environment
|
|
43
44
|
// ---------------------------------------------------------------------------
|
|
@@ -1404,7 +1405,7 @@ const FILE_MIME_MAP = {
|
|
|
1404
1405
|
".gif": "image/gif",
|
|
1405
1406
|
".webp": "image/webp",
|
|
1406
1407
|
};
|
|
1407
|
-
server.tool("cnotes_files_upload", "Upload an image file to the workspace. Returns the public URL. Supports .jpg, .jpeg, .png, .gif, .webp (max 5MB).", {
|
|
1408
|
+
server.tool("cnotes_files_upload", "Upload an image file to the workspace. Returns the public URL. Supports .jpg, .jpeg, .png, .gif, .webp (max 5MB). Convert an SVG to PNG first.", {
|
|
1408
1409
|
filePath: z.string().describe("Absolute path to the image file on disk"),
|
|
1409
1410
|
}, async ({ filePath }) => withErrorHandling(async () => {
|
|
1410
1411
|
const absPath = path.resolve(filePath);
|
|
@@ -1423,7 +1424,7 @@ server.tool("cnotes_files_upload", "Upload an image file to the workspace. Retur
|
|
|
1423
1424
|
const ext = path.extname(absPath).toLowerCase();
|
|
1424
1425
|
const mimeType = FILE_MIME_MAP[ext];
|
|
1425
1426
|
if (!mimeType)
|
|
1426
|
-
throw new Error(
|
|
1427
|
+
throw new Error(unsupportedImageTypeMessage(ext));
|
|
1427
1428
|
const buffer = readFileSync(absPath);
|
|
1428
1429
|
const filename = path.basename(absPath);
|
|
1429
1430
|
const buildFormData = () => {
|
package/package.json
CHANGED
package/skills/cnotes/SKILL.md
CHANGED
|
@@ -17,7 +17,7 @@ Every note and canvas you write is context: what the next reader, a teammate or
|
|
|
17
17
|
|
|
18
18
|
1. **Confirm the workspace.** `cnotes workspace current` names it and lists its relationship types. `-w <id>` targets another one for a single command.
|
|
19
19
|
2. **Read before you write.** Past sessions and teammates left context for this task. `cnotes brief "<task>"` returns the notes, canvases and recent changes most relevant to the task. Search notes and canvases separately (they are different corpora): `cnotes search semantic "<topic>"` and `cnotes canvas search "<topic>"`. `cnotes notes get <id> --expand` loads a note with the notes it rests on. Before changing a canvas, `cnotes canvas read <canvasId>`. A Decision or Guide you find may already settle what you were about to propose.
|
|
20
|
-
3. **Open a run.** `cnotes operations begin --prompt "<the change as a past-tense headline, e.g. Added a risks list to the Q1 roadmap>" --json`, as its own command; check its exit code before writing (a pipe hides it). `notes create` refuses to run without one. The response carries `typeRubrics
|
|
20
|
+
3. **Open a run.** `cnotes operations begin --prompt "<the change as a past-tense headline, e.g. Added a risks list to the Q1 roadmap>" --json`, as its own command; check its exit code before writing (a pipe hides it). `notes create` refuses to run without one. The response carries `typeRubrics`, the same brief, and the proposals waiting on you with any that reword the same note as another (read those first, [references/drafts.md](references/drafts.md) step 8); `-q` prints only the run id, with the proposals on stderr. One canvas per run: end it and begin another before writing to a second canvas.
|
|
21
21
|
4. **Write to the type's rubric.** Pick the type, run `cnotes types show <Type>`, and author to its rubric. Audience-facing prose (note bodies, banners, pre-reads) goes through [references/humanizer.md](references/humanizer.md) first; transcripts, quotes and other raw capture are stored verbatim.
|
|
22
22
|
5. **Create notes in one batch.** `cnotes notes create --notes '[{"key":"A","type":"Insight","markdownFile":"./a.md"}, ...]'`. Each body starts with a `# h1` (the title). Cross-link inside the batch with `[@A: Title](relationship:<verb>)`. Detail: [references/notes.md](references/notes.md).
|
|
23
23
|
6. **Grade what you wrote.** `cnotes quality <displayIds...> --fail-below 4`, then revise weak notes with `cnotes versions create <id> --description "<what changed>" --markdown-file <path>`.
|
|
@@ -199,6 +199,16 @@ the checkout that reaches it.
|
|
|
199
199
|
reads "Waiting on <you>: ..." instead of a proposal to decide. Make the fix,
|
|
200
200
|
then `draft ask` again and stop. A live save of a note with a proposed new
|
|
201
201
|
text prints that the save puts the proposal out of date.
|
|
202
|
+
8. **When another proposal rewords the same note,** you are told wherever you
|
|
203
|
+
look: `draft ask` prints "Overlaps: PROPOSAL-7 "Team price" also rewords
|
|
204
|
+
DECISION-1, built by you via Codex (Slack)." on stderr, `draft status`
|
|
205
|
+
lists it as a `proposal-overlap` warning, and `operations begin` lists it
|
|
206
|
+
under the proposals waiting on you. You only ever hear of a proposal you
|
|
207
|
+
could already see (yours, or one asked of you). It never blocks. Read the
|
|
208
|
+
other one (`cnotes draft status PROPOSAL-7`) and decide which of three
|
|
209
|
+
holds: they agree (say in your ask which should land first), yours
|
|
210
|
+
repeats it (fold what is new into the other or dismiss yours), or they
|
|
211
|
+
conflict (write a Question for the person naming both, with your lean).
|
|
202
212
|
|
|
203
213
|
## Deciding as someone's agent
|
|
204
214
|
|
|
@@ -90,6 +90,7 @@ is by design, not a bug — there is nothing to open.
|
|
|
90
90
|
## Files (`cnotes files` / `cnotes f`)
|
|
91
91
|
```bash
|
|
92
92
|
# Upload an image to the workspace (max 5MB, supports .jpg .jpeg .png .gif .webp)
|
|
93
|
+
# An SVG (a rendered diagram, say) is refused: convert it first, e.g. rsvg-convert -o diagram.png diagram.svg
|
|
93
94
|
cnotes files upload <path> [--markdown] # --markdown outputs  syntax
|
|
94
95
|
|
|
95
96
|
# Read an image that's INSIDE a note. A note's content prints images as
|