@creator-notes/cnotes 0.79.0 → 0.80.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/.claude-plugin/plugin.json +1 -1
- package/dist/commands/canvas.d.ts.map +1 -1
- package/dist/commands/canvas.js +82 -35
- package/dist/commands/canvas.js.map +1 -1
- package/dist/commands/notes.d.ts.map +1 -1
- package/dist/commands/notes.js +3 -2
- package/dist/commands/notes.js.map +1 -1
- package/dist/commands/operations.d.ts +9 -0
- package/dist/commands/operations.d.ts.map +1 -1
- package/dist/commands/operations.js +148 -45
- package/dist/commands/operations.js.map +1 -1
- package/dist/lib/active-run.d.ts +62 -0
- package/dist/lib/active-run.d.ts.map +1 -0
- package/dist/lib/active-run.js +75 -0
- package/dist/lib/active-run.js.map +1 -0
- package/dist/lib/auth-store.d.ts +66 -0
- package/dist/lib/auth-store.d.ts.map +1 -1
- package/dist/lib/auth-store.js +204 -28
- package/dist/lib/auth-store.js.map +1 -1
- package/dist/lib/build-schema.d.ts +1 -1
- package/dist/lib/build-schema.js +1 -1
- package/dist/lib/build-schema.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/cnotes/SKILL.md +18 -4
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `begin` does about a run that already holds the active slot, and how
|
|
3
|
+
* stale local records of runs are reconciled with the server.
|
|
4
|
+
*
|
|
5
|
+
* A bot that crashes after `begin` leaves two things behind: a `running` row
|
|
6
|
+
* server-side (the reaper marks it `abandoned` after about an hour) and a
|
|
7
|
+
* local record — the active pointer and/or an open-run registry entry — that
|
|
8
|
+
* no process will ever `end`. Before this, the next `begin` could only refuse
|
|
9
|
+
* ("end it first or --force") and the usual reaction, --force, is exactly the
|
|
10
|
+
* destructive step this module exists to avoid when the slot holder is a run
|
|
11
|
+
* another bot is still writing to. So `begin` now asks the server first: a
|
|
12
|
+
* run that is no longer running is simply forgotten, and only a run that IS
|
|
13
|
+
* still running needs --force (or --detached).
|
|
14
|
+
*/
|
|
15
|
+
import { ApiClient } from "./api-client.js";
|
|
16
|
+
import { type OpenAgentRun } from "./auth-store.js";
|
|
17
|
+
/** The server's view of a run; "missing" is a 404, "unknown" means it could not be asked. */
|
|
18
|
+
export type ServerRunStatus = "running" | "completed" | "abandoned" | "missing" | "unknown";
|
|
19
|
+
export declare function fetchRunStatus(api: ApiClient, agentRunId: string): Promise<ServerRunStatus>;
|
|
20
|
+
/** A run is open for our purposes only while the server says it is running — or cannot be asked. */
|
|
21
|
+
export declare function isStillOpen(status: ServerRunStatus): boolean;
|
|
22
|
+
export interface ActiveRunResolution {
|
|
23
|
+
/** The stale run `begin` forgot on the caller's behalf, if any. */
|
|
24
|
+
forgot?: {
|
|
25
|
+
agentRunId: string;
|
|
26
|
+
status: ServerRunStatus;
|
|
27
|
+
};
|
|
28
|
+
/** The running run `begin --force` ended on the caller's behalf, if any. */
|
|
29
|
+
forced?: {
|
|
30
|
+
agentRunId: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Make room in the active slot for a new (non-detached) run.
|
|
35
|
+
*
|
|
36
|
+
* - empty slot → nothing to do
|
|
37
|
+
* - holder no longer running → forget it locally (crashed bot)
|
|
38
|
+
* - holder running, --force → end it server-side, forget it
|
|
39
|
+
* - holder running, no --force → refuse (exit 5) naming the ways out
|
|
40
|
+
* - server unreachable → treated as running: refuse
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveActiveSlot(api: ApiClient, serverUrl: string, opts: {
|
|
43
|
+
force?: boolean;
|
|
44
|
+
endCommand: string;
|
|
45
|
+
}): Promise<ActiveRunResolution>;
|
|
46
|
+
export type OpenRunReport = {
|
|
47
|
+
agentRunId: string;
|
|
48
|
+
active: boolean;
|
|
49
|
+
status: ServerRunStatus;
|
|
50
|
+
} & OpenAgentRun;
|
|
51
|
+
/**
|
|
52
|
+
* Every run this CLI has open on `serverUrl`, each with the server's view of
|
|
53
|
+
* it. With `prune`, runs the server no longer considers running are forgotten
|
|
54
|
+
* (the record a crashed bot — or an older CLI, see below — left behind).
|
|
55
|
+
*/
|
|
56
|
+
export declare function reconcileOpenAgentRuns(api: ApiClient, serverUrl: string, opts: {
|
|
57
|
+
prune?: boolean;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
runs: OpenRunReport[];
|
|
60
|
+
pruned: string[];
|
|
61
|
+
}>;
|
|
62
|
+
//# sourceMappingURL=active-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-run.d.ts","sourceRoot":"","sources":["../../src/lib/active-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAIzB,6FAA6F;AAC7F,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5F,wBAAsB,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAajG;AAED,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAE5D;AAED,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,eAAe,CAAA;KAAE,CAAC;IACzD,4EAA4E;IAC5E,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,mBAAmB,CAAC,CA0B9B;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAAG,YAAY,CAAC;AAE5G;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACxB,OAAO,CAAC;IAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CActD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { loadConfig, getActiveAgentRunId, listOpenAgentRuns, unregisterAgentRun, } from "./auth-store.js";
|
|
2
|
+
import { ApiError, CliError, EXIT_CODES } from "./errors.js";
|
|
3
|
+
import { formatAgo } from "./output.js";
|
|
4
|
+
export async function fetchRunStatus(api, agentRunId) {
|
|
5
|
+
try {
|
|
6
|
+
const result = await api.get("/api/operations", {
|
|
7
|
+
agentRunId,
|
|
8
|
+
});
|
|
9
|
+
const status = result.operation?.status;
|
|
10
|
+
return status === "running" || status === "completed" || status === "abandoned"
|
|
11
|
+
? status
|
|
12
|
+
: "unknown";
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (error instanceof ApiError && error.status === 404)
|
|
16
|
+
return "missing";
|
|
17
|
+
return "unknown";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** A run is open for our purposes only while the server says it is running — or cannot be asked. */
|
|
21
|
+
export function isStillOpen(status) {
|
|
22
|
+
return status === "running" || status === "unknown";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Make room in the active slot for a new (non-detached) run.
|
|
26
|
+
*
|
|
27
|
+
* - empty slot → nothing to do
|
|
28
|
+
* - holder no longer running → forget it locally (crashed bot)
|
|
29
|
+
* - holder running, --force → end it server-side, forget it
|
|
30
|
+
* - holder running, no --force → refuse (exit 5) naming the ways out
|
|
31
|
+
* - server unreachable → treated as running: refuse
|
|
32
|
+
*/
|
|
33
|
+
export async function resolveActiveSlot(api, serverUrl, opts) {
|
|
34
|
+
const existing = getActiveAgentRunId(loadConfig(), serverUrl);
|
|
35
|
+
if (!existing)
|
|
36
|
+
return {};
|
|
37
|
+
const status = await fetchRunStatus(api, existing.agentRunId);
|
|
38
|
+
if (!isStillOpen(status)) {
|
|
39
|
+
unregisterAgentRun(loadConfig(), serverUrl, existing.agentRunId);
|
|
40
|
+
return { forgot: { agentRunId: existing.agentRunId, status } };
|
|
41
|
+
}
|
|
42
|
+
if (opts.force) {
|
|
43
|
+
try {
|
|
44
|
+
await api.post("/api/operations", { action: "end", agentRunId: existing.agentRunId });
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Best-effort: ending an already-completed/abandoned run is idempotent
|
|
48
|
+
// server-side. Either way forget it locally so the caller isn't wedged.
|
|
49
|
+
}
|
|
50
|
+
unregisterAgentRun(loadConfig(), serverUrl, existing.agentRunId);
|
|
51
|
+
return { forced: { agentRunId: existing.agentRunId } };
|
|
52
|
+
}
|
|
53
|
+
throw new CliError(`An active agent-run already exists on this server (agentRunId ${existing.agentRunId}, started ${formatAgo(existing.startedAt)}).`, EXIT_CODES.CONFLICT, `End it first with \`${opts.endCommand}\`; open your own run alongside it with --detached (writes then need CNOTES_AGENT_RUN_ID=<id>); or pass --force to end it server-side and start fresh.`);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Every run this CLI has open on `serverUrl`, each with the server's view of
|
|
57
|
+
* it. With `prune`, runs the server no longer considers running are forgotten
|
|
58
|
+
* (the record a crashed bot — or an older CLI, see below — left behind).
|
|
59
|
+
*/
|
|
60
|
+
export async function reconcileOpenAgentRuns(api, serverUrl, opts) {
|
|
61
|
+
const runs = listOpenAgentRuns(loadConfig(), serverUrl);
|
|
62
|
+
const statuses = await Promise.all(runs.map((r) => fetchRunStatus(api, r.agentRunId)));
|
|
63
|
+
const report = runs.map((r, i) => ({ ...r, status: statuses[i] }));
|
|
64
|
+
const pruned = [];
|
|
65
|
+
if (opts.prune) {
|
|
66
|
+
for (const r of report) {
|
|
67
|
+
if (!isStillOpen(r.status)) {
|
|
68
|
+
unregisterAgentRun(loadConfig(), serverUrl, r.agentRunId);
|
|
69
|
+
pruned.push(r.agentRunId);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { runs: report, pruned };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=active-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-run.js","sourceRoot":"","sources":["../../src/lib/active-run.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAc,EAAE,UAAkB;IACrE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAuC,iBAAiB,EAAE;YACpF,UAAU;SACX,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC;QACxC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,WAAW;YAC7E,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,MA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one slot on purpose: a request carries
|
|
14
14
|
* exactly one X-Agent-Run-Id, so two concurrent "active" runs would be
|
|
15
15
|
* ambiguous. `begin` refuses when this is already set (unless --force).
|
|
16
|
+
*
|
|
17
|
+
* This slot is only the IMPLICIT-attach default. It is not the record of
|
|
18
|
+
* which runs this CLI has open — that is `agentRuns` below. A run opened
|
|
19
|
+
* with `begin --detached` never touches this slot: its writes carry the run
|
|
20
|
+
* id through CNOTES_AGENT_RUN_ID instead, so two agents sharing one config
|
|
21
|
+
* (two bots on one machine) can each hold their own run without one
|
|
22
|
+
* overwriting, or ending, the other's.
|
|
16
23
|
*/
|
|
17
24
|
activeAgentRunId?: string;
|
|
18
25
|
/** When activeAgentRunId was opened — used to surface helpful "started
|
|
@@ -34,6 +41,29 @@ export interface ServerConfig {
|
|
|
34
41
|
* canvas snapshot to carry.
|
|
35
42
|
*/
|
|
36
43
|
activeAgentBeforeSnapshotId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Every agent-run this CLI config opened on this server and has not yet
|
|
46
|
+
* ended, keyed by agentRunId — the active one AND any detached ones. This is
|
|
47
|
+
* the ownership record `end` checks before closing a run: a run that is not
|
|
48
|
+
* here was opened by someone else (another machine, another login), and
|
|
49
|
+
* `end` refuses it unless told --force. The active pointer above is always
|
|
50
|
+
* also a key here (except for configs written by older CLIs, which `end`
|
|
51
|
+
* still honours).
|
|
52
|
+
*/
|
|
53
|
+
agentRuns?: Record<string, OpenAgentRun>;
|
|
54
|
+
}
|
|
55
|
+
/** One open run in {@link ServerConfig.agentRuns}. */
|
|
56
|
+
export interface OpenAgentRun {
|
|
57
|
+
startedAt: number;
|
|
58
|
+
/** Canvas runs only — see {@link ServerConfig.activeAgentBeforeSnapshotId}. */
|
|
59
|
+
beforeSnapshotId?: string;
|
|
60
|
+
/** Canvas runs only: the canvas the run was opened on. */
|
|
61
|
+
canvasId?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Opened with --detached: never installed as the active pointer, so its
|
|
64
|
+
* writes attach only through CNOTES_AGENT_RUN_ID.
|
|
65
|
+
*/
|
|
66
|
+
detached?: boolean;
|
|
37
67
|
}
|
|
38
68
|
export interface CliConfig {
|
|
39
69
|
version: 1;
|
|
@@ -68,6 +98,42 @@ export declare function setWorkspaceId(config: CliConfig, serverUrl: string, wor
|
|
|
68
98
|
* unattributed human edits. Same contract as setWorkspaceId above.
|
|
69
99
|
*/
|
|
70
100
|
export declare function setActiveAgentRunId(config: CliConfig, serverUrl: string, agentRunId: string, startedAt: number, beforeSnapshotId?: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Record an open run WITHOUT making it the active one. This is what
|
|
103
|
+
* `begin --detached` and `agent-run wrap` use: the run is tracked here (so
|
|
104
|
+
* `end` recognises it as ours) but writes attach to it only through
|
|
105
|
+
* CNOTES_AGENT_RUN_ID, never implicitly — so it can coexist with another
|
|
106
|
+
* agent's active run on the same config.
|
|
107
|
+
*
|
|
108
|
+
* Returns false when there is no stored config entry for `serverUrl` (same
|
|
109
|
+
* contract as setActiveAgentRunId): nothing on disk to record the run in.
|
|
110
|
+
*/
|
|
111
|
+
export declare function registerAgentRun(config: CliConfig, serverUrl: string, agentRunId: string, run: OpenAgentRun): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Forget one open run after it was ended: drops it from the registry and, if
|
|
114
|
+
* it was the active pointer, clears the pointer too. Any OTHER run — the
|
|
115
|
+
* active one when a detached run ends, or a detached run when the active one
|
|
116
|
+
* ends — is left exactly as it was. No-op when the run is unknown.
|
|
117
|
+
*/
|
|
118
|
+
export declare function unregisterAgentRun(config: CliConfig, serverUrl: string, agentRunId: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Did this CLI config open `agentRunId` on `serverUrl`? The answer `end` uses
|
|
121
|
+
* to refuse closing somebody else's run.
|
|
122
|
+
*
|
|
123
|
+
* - true: it is in the registry, or it is the active pointer (configs from
|
|
124
|
+
* CLIs that predate the registry only have the pointer).
|
|
125
|
+
* - false: there is a stored login for the server and the run is not ours.
|
|
126
|
+
* - null: no stored login for the server at all (token came from --token /
|
|
127
|
+
* CNOTES_TOKEN), so there is no record to check against. Callers
|
|
128
|
+
* treat this as "cannot tell" rather than "not ours": the run id
|
|
129
|
+
* can only have come from the caller's own `begin` output.
|
|
130
|
+
*/
|
|
131
|
+
export declare function isOwnedAgentRun(config: CliConfig, serverUrl: string, agentRunId: string): boolean | null;
|
|
132
|
+
/** Every run this CLI config has open on `serverUrl`, oldest first. */
|
|
133
|
+
export declare function listOpenAgentRuns(config: CliConfig, serverUrl: string): Array<{
|
|
134
|
+
agentRunId: string;
|
|
135
|
+
active: boolean;
|
|
136
|
+
} & OpenAgentRun>;
|
|
71
137
|
/**
|
|
72
138
|
* Clear the active agent-run for a server. Called by `cnotes operations end` /
|
|
73
139
|
* `cnotes canvas agent-run end` after a successful close, so the next cnotes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../../src/lib/auth-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-store.d.ts","sourceRoot":"","sources":["../../src/lib/auth-store.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;yEACqE;IACrE,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;;;;;;;;OAcG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC1C;AAED,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC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AIT;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,IAAI,CAgBN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,GAAG,IAAI,CAKhB;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,GAChB,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,CAAC,CAoB/D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,GAChB,IAAI,CAgBN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,GAChB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAU7E"}
|
package/dist/lib/auth-store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync, renameSync } from "node:fs";
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync, renameSync, rmSync, statSync, } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { BRAND } from "./brand.js";
|
|
@@ -60,12 +60,95 @@ export function loadConfig() {
|
|
|
60
60
|
}
|
|
61
61
|
export function saveConfig(config) {
|
|
62
62
|
mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
63
|
-
|
|
63
|
+
// Write to a sibling temp file and rename it into place: the rename is
|
|
64
|
+
// atomic, so a cnotes process reading the config at the same moment (two
|
|
65
|
+
// bots on one machine) sees either the old file or the new one, never a
|
|
66
|
+
// half-written one that parses as "logged out".
|
|
67
|
+
const tmp = `${CONFIG_FILE}.${process.pid}.${Date.now()}.tmp`;
|
|
68
|
+
writeFileSync(tmp, JSON.stringify(config, null, 2) + "\n", {
|
|
64
69
|
encoding: "utf-8",
|
|
65
70
|
mode: 0o600,
|
|
66
71
|
});
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
chmodSync(tmp, 0o600);
|
|
73
|
+
renameSync(tmp, CONFIG_FILE);
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Read-modify-write under a lock.
|
|
77
|
+
//
|
|
78
|
+
// Every mutator below re-reads the config from disk, applies its change and
|
|
79
|
+
// writes it back while holding a directory lock (mkdir is atomic on every
|
|
80
|
+
// platform Node runs on). Without it, two `begin`s running at the same time
|
|
81
|
+
// (two bots on one machine) each load the same config, each add their own
|
|
82
|
+
// run, and the second write silently drops the first bot's run — which is
|
|
83
|
+
// then "not ours" when that bot tries to end it.
|
|
84
|
+
//
|
|
85
|
+
// The lock is advisory and bounded: a holder that died leaves a directory
|
|
86
|
+
// behind, so a lock older than LOCK_STALE_MS is broken, and after LOCK_WAIT_MS
|
|
87
|
+
// of waiting the write proceeds unlocked rather than wedging the command.
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
const LOCK_DIR = `${CONFIG_FILE}.lock`;
|
|
90
|
+
const LOCK_STALE_MS = 10_000;
|
|
91
|
+
const LOCK_WAIT_MS = 5_000;
|
|
92
|
+
const LOCK_POLL_MS = 15;
|
|
93
|
+
function sleepSync(ms) {
|
|
94
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
95
|
+
}
|
|
96
|
+
function acquireConfigLock() {
|
|
97
|
+
mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
98
|
+
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
99
|
+
while (true) {
|
|
100
|
+
try {
|
|
101
|
+
mkdirSync(LOCK_DIR);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
if (e.code !== "EEXIST")
|
|
106
|
+
return false;
|
|
107
|
+
try {
|
|
108
|
+
if (Date.now() - statSync(LOCK_DIR).mtimeMs > LOCK_STALE_MS) {
|
|
109
|
+
rmSync(LOCK_DIR, { recursive: true, force: true });
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
continue; // vanished between the EEXIST and the stat — retry
|
|
115
|
+
}
|
|
116
|
+
if (Date.now() > deadline)
|
|
117
|
+
return false;
|
|
118
|
+
sleepSync(LOCK_POLL_MS);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function releaseConfigLock() {
|
|
123
|
+
try {
|
|
124
|
+
rmSync(LOCK_DIR, { recursive: true, force: true });
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
/* a stale lock is broken by the next acquirer */
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Apply `fn` to the on-disk entry for `serverUrl` atomically, and mirror the
|
|
132
|
+
* result onto `config` (the caller's in-memory copy) so it does not go stale.
|
|
133
|
+
* Returns false, without writing, when there is no stored entry for the
|
|
134
|
+
* server. `fn` returns false to skip the write (nothing changed).
|
|
135
|
+
*/
|
|
136
|
+
function mutateServerConfig(config, serverUrl, fn) {
|
|
137
|
+
const locked = acquireConfigLock();
|
|
138
|
+
try {
|
|
139
|
+
const fresh = loadConfig();
|
|
140
|
+
const sc = fresh.servers[serverUrl];
|
|
141
|
+
if (!sc)
|
|
142
|
+
return false;
|
|
143
|
+
if (fn(sc) !== false)
|
|
144
|
+
saveConfig(fresh);
|
|
145
|
+
config.servers[serverUrl] = sc;
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
if (locked)
|
|
150
|
+
releaseConfigLock();
|
|
151
|
+
}
|
|
69
152
|
}
|
|
70
153
|
export function getServerConfig(config, server) {
|
|
71
154
|
const serverUrl = server || config.currentServer;
|
|
@@ -91,13 +174,9 @@ export function setCurrentServer(config, serverUrl) {
|
|
|
91
174
|
* back to a caller should surface this instead of claiming success.
|
|
92
175
|
*/
|
|
93
176
|
export function setWorkspaceId(config, serverUrl, workspaceId) {
|
|
94
|
-
|
|
95
|
-
if (sc) {
|
|
177
|
+
return mutateServerConfig(config, serverUrl, (sc) => {
|
|
96
178
|
sc.workspaceId = workspaceId;
|
|
97
|
-
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
179
|
+
});
|
|
101
180
|
}
|
|
102
181
|
/**
|
|
103
182
|
* Mark a given agent-run as the active one for a server. Subsequent cnotes
|
|
@@ -113,22 +192,111 @@ export function setWorkspaceId(config, serverUrl, workspaceId) {
|
|
|
113
192
|
* unattributed human edits. Same contract as setWorkspaceId above.
|
|
114
193
|
*/
|
|
115
194
|
export function setActiveAgentRunId(config, serverUrl, agentRunId, startedAt, beforeSnapshotId) {
|
|
195
|
+
return mutateServerConfig(config, serverUrl, (sc) => {
|
|
196
|
+
sc.activeAgentRunId = agentRunId;
|
|
197
|
+
sc.activeAgentRunStartedAt = startedAt;
|
|
198
|
+
// Always write the slot, so a canvas run never inherits the stale
|
|
199
|
+
// before-snapshot of a previous run (which belongs to a different canvas
|
|
200
|
+
// and would be dropped server-side anyway, silently costing
|
|
201
|
+
// revertability).
|
|
202
|
+
if (beforeSnapshotId) {
|
|
203
|
+
sc.activeAgentBeforeSnapshotId = beforeSnapshotId;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
delete sc.activeAgentBeforeSnapshotId;
|
|
207
|
+
}
|
|
208
|
+
// The active run is an open run like any other: record it so `end` can
|
|
209
|
+
// tell it apart from a run this CLI never opened.
|
|
210
|
+
sc.agentRuns = {
|
|
211
|
+
...(sc.agentRuns ?? {}),
|
|
212
|
+
[agentRunId]: {
|
|
213
|
+
startedAt,
|
|
214
|
+
...(beforeSnapshotId ? { beforeSnapshotId } : {}),
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Record an open run WITHOUT making it the active one. This is what
|
|
221
|
+
* `begin --detached` and `agent-run wrap` use: the run is tracked here (so
|
|
222
|
+
* `end` recognises it as ours) but writes attach to it only through
|
|
223
|
+
* CNOTES_AGENT_RUN_ID, never implicitly — so it can coexist with another
|
|
224
|
+
* agent's active run on the same config.
|
|
225
|
+
*
|
|
226
|
+
* Returns false when there is no stored config entry for `serverUrl` (same
|
|
227
|
+
* contract as setActiveAgentRunId): nothing on disk to record the run in.
|
|
228
|
+
*/
|
|
229
|
+
export function registerAgentRun(config, serverUrl, agentRunId, run) {
|
|
230
|
+
return mutateServerConfig(config, serverUrl, (sc) => {
|
|
231
|
+
sc.agentRuns = { ...(sc.agentRuns ?? {}), [agentRunId]: run };
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Forget one open run after it was ended: drops it from the registry and, if
|
|
236
|
+
* it was the active pointer, clears the pointer too. Any OTHER run — the
|
|
237
|
+
* active one when a detached run ends, or a detached run when the active one
|
|
238
|
+
* ends — is left exactly as it was. No-op when the run is unknown.
|
|
239
|
+
*/
|
|
240
|
+
export function unregisterAgentRun(config, serverUrl, agentRunId) {
|
|
241
|
+
mutateServerConfig(config, serverUrl, (sc) => {
|
|
242
|
+
let changed = false;
|
|
243
|
+
if (sc.agentRuns && agentRunId in sc.agentRuns) {
|
|
244
|
+
delete sc.agentRuns[agentRunId];
|
|
245
|
+
if (Object.keys(sc.agentRuns).length === 0)
|
|
246
|
+
delete sc.agentRuns;
|
|
247
|
+
changed = true;
|
|
248
|
+
}
|
|
249
|
+
if (sc.activeAgentRunId === agentRunId) {
|
|
250
|
+
delete sc.activeAgentRunId;
|
|
251
|
+
delete sc.activeAgentRunStartedAt;
|
|
252
|
+
delete sc.activeAgentBeforeSnapshotId;
|
|
253
|
+
changed = true;
|
|
254
|
+
}
|
|
255
|
+
return changed;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Did this CLI config open `agentRunId` on `serverUrl`? The answer `end` uses
|
|
260
|
+
* to refuse closing somebody else's run.
|
|
261
|
+
*
|
|
262
|
+
* - true: it is in the registry, or it is the active pointer (configs from
|
|
263
|
+
* CLIs that predate the registry only have the pointer).
|
|
264
|
+
* - false: there is a stored login for the server and the run is not ours.
|
|
265
|
+
* - null: no stored login for the server at all (token came from --token /
|
|
266
|
+
* CNOTES_TOKEN), so there is no record to check against. Callers
|
|
267
|
+
* treat this as "cannot tell" rather than "not ours": the run id
|
|
268
|
+
* can only have come from the caller's own `begin` output.
|
|
269
|
+
*/
|
|
270
|
+
export function isOwnedAgentRun(config, serverUrl, agentRunId) {
|
|
116
271
|
const sc = config.servers[serverUrl];
|
|
117
272
|
if (!sc)
|
|
118
|
-
return
|
|
119
|
-
sc.activeAgentRunId
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
273
|
+
return null;
|
|
274
|
+
if (sc.activeAgentRunId === agentRunId)
|
|
275
|
+
return true;
|
|
276
|
+
return Boolean(sc.agentRuns && agentRunId in sc.agentRuns);
|
|
277
|
+
}
|
|
278
|
+
/** Every run this CLI config has open on `serverUrl`, oldest first. */
|
|
279
|
+
export function listOpenAgentRuns(config, serverUrl) {
|
|
280
|
+
const sc = config.servers[serverUrl];
|
|
281
|
+
if (!sc)
|
|
282
|
+
return [];
|
|
283
|
+
const runs = { ...(sc.agentRuns ?? {}) };
|
|
284
|
+
// A pointer written by an older CLI has no registry entry; surface it too.
|
|
285
|
+
if (sc.activeAgentRunId && !(sc.activeAgentRunId in runs)) {
|
|
286
|
+
runs[sc.activeAgentRunId] = {
|
|
287
|
+
startedAt: sc.activeAgentRunStartedAt ?? 0,
|
|
288
|
+
...(sc.activeAgentBeforeSnapshotId
|
|
289
|
+
? { beforeSnapshotId: sc.activeAgentBeforeSnapshotId }
|
|
290
|
+
: {}),
|
|
291
|
+
};
|
|
129
292
|
}
|
|
130
|
-
|
|
131
|
-
|
|
293
|
+
return Object.entries(runs)
|
|
294
|
+
.map(([agentRunId, run]) => ({
|
|
295
|
+
agentRunId,
|
|
296
|
+
active: sc.activeAgentRunId === agentRunId,
|
|
297
|
+
...run,
|
|
298
|
+
}))
|
|
299
|
+
.sort((a, b) => a.startedAt - b.startedAt);
|
|
132
300
|
}
|
|
133
301
|
/**
|
|
134
302
|
* Clear the active agent-run for a server. Called by `cnotes operations end` /
|
|
@@ -136,14 +304,22 @@ export function setActiveAgentRunId(config, serverUrl, agentRunId, startedAt, be
|
|
|
136
304
|
* write reverts to "unattached" unless the user opens a new run.
|
|
137
305
|
*/
|
|
138
306
|
export function clearActiveAgentRunId(config, serverUrl) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
307
|
+
mutateServerConfig(config, serverUrl, (sc) => {
|
|
308
|
+
if (!(sc.activeAgentRunId || sc.activeAgentRunStartedAt || sc.activeAgentBeforeSnapshotId)) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
// The active run has ended, so it leaves the open-run registry with the
|
|
312
|
+
// pointer. Detached runs in the registry are untouched: they are other
|
|
313
|
+
// agents' business.
|
|
314
|
+
if (sc.activeAgentRunId && sc.agentRuns && sc.activeAgentRunId in sc.agentRuns) {
|
|
315
|
+
delete sc.agentRuns[sc.activeAgentRunId];
|
|
316
|
+
if (Object.keys(sc.agentRuns).length === 0)
|
|
317
|
+
delete sc.agentRuns;
|
|
318
|
+
}
|
|
142
319
|
delete sc.activeAgentRunId;
|
|
143
320
|
delete sc.activeAgentRunStartedAt;
|
|
144
321
|
delete sc.activeAgentBeforeSnapshotId;
|
|
145
|
-
|
|
146
|
-
}
|
|
322
|
+
});
|
|
147
323
|
}
|
|
148
324
|
/**
|
|
149
325
|
* Read the active agent-run for a server (if any). `beforeSnapshotId` is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../../src/lib/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../../src/lib/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA6EnC,4EAA4E;AAC5E,+EAA+E;AAC/E,4EAA4E;AAC5E,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;AACrF,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC,CAAC;AAC3D,SAAS,sBAAsB;IAC7B,IAAI,CAAC;QACH,IACE,UAAU,KAAK,iBAAiB;YAChC,UAAU,CAAC,iBAAiB,CAAC;YAC7B,CAAC,UAAU,CAAC,UAAU,CAAC,EACvB,CAAC;YACD,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,mDAAmD;IACrD,C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AC;QAClC,OAAO,EAAE,CAAC,2BAA2B,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,SAAiB;IAEjB,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,EAAE,gBAAgB,IAAI,EAAE,CAAC,uBAAuB,EAAE,CAAC;QACvD,OAAO;YACL,UAAU,EAAE,EAAE,CAAC,gBAAgB;YAC/B,SAAS,EAAE,EAAE,CAAC,uBAAuB;YACrC,gBAAgB,EAAE,EAAE,CAAC,2BAA2B;SACjD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -21,7 +21,7 @@ export declare const STATIC_SCHEMA: {
|
|
|
21
21
|
readonly note: "After finding a note (search semantic / notes list), see how it connects before acting — the agent mirror of the editor's Backlinks + Canvases affordances.";
|
|
22
22
|
readonly backlinks: "`cnotes rel list --note <displayId> --json` → { incoming, outgoing, all }. `incoming` = what links TO this note (backlinks); `outgoing` = what it cites. Each row carries relatedNote {displayId,title,type}, relationshipType {name,label}, and isStale.";
|
|
23
23
|
readonly canvases: "`cnotes notes canvases <displayId> --json` → the canvases the note appears on (container-aware: direct node OR nested in a list/grid). Each row: { id, name, via, viewType, visibility, isHome, goal, updatedAt }. `via` = node | list | both.";
|
|
24
|
-
readonly expand: "`cnotes notes get <id> --expand` returns the note plus the notes it links to, in one round-trip. Sources: live outgoing relationship rows and inline [[rel::ID]] / [[ID]] mentions (a bare [[ID]] is references). Each linked note is labelled `assumes -> OBSERVATION-6K13` (incoming: `assumes <- OTHER-1`). `--depth N` (default 1, max 4) walks further, deduped. The walk stops at 40 notes and sets `notice` when it does. `--rel a,b` limits slugs. `--summary` keeps the title and
|
|
24
|
+
readonly expand: "`cnotes notes get <id> --expand` returns the note plus the notes it links to, in one round-trip. Sources: live outgoing relationship rows and inline [[rel::ID]] / [[ID]] mentions (a bare [[ID]] is references). Each linked note is labelled `assumes -> OBSERVATION-6K13` (incoming: `assumes <- OTHER-1`). `--depth N` (default 1, max 4) walks further, deduped. The walk stops at 40 notes and sets `notice` when it does. `--rel a,b` limits slugs. `--summary` keeps the title and the first real prose paragraph of linked notes (skips leading headings, blanks, and chip-only lines; heading-only notes fall back to the last heading text, list-only notes to the first list); requested notes stay whole. `--incoming` also follows backlinks. JSON is `{ notes, linked, truncated, cap, omitted, notice }`. Each linked entry is `{ displayId, relation, direction, depth, from, label, links, note }` and `note` matches a `notes get` row. Without `--expand`, `notes get --json` stays a bare array.";
|
|
25
25
|
};
|
|
26
26
|
readonly resources: {
|
|
27
27
|
readonly note: {
|
package/dist/lib/build-schema.js
CHANGED
|
@@ -32,7 +32,7 @@ export const STATIC_SCHEMA = {
|
|
|
32
32
|
note: "After finding a note (search semantic / notes list), see how it connects before acting — the agent mirror of the editor's Backlinks + Canvases affordances.",
|
|
33
33
|
backlinks: "`cnotes rel list --note <displayId> --json` → { incoming, outgoing, all }. `incoming` = what links TO this note (backlinks); `outgoing` = what it cites. Each row carries relatedNote {displayId,title,type}, relationshipType {name,label}, and isStale.",
|
|
34
34
|
canvases: "`cnotes notes canvases <displayId> --json` → the canvases the note appears on (container-aware: direct node OR nested in a list/grid). Each row: { id, name, via, viewType, visibility, isHome, goal, updatedAt }. `via` = node | list | both.",
|
|
35
|
-
expand: "`cnotes notes get <id> --expand` returns the note plus the notes it links to, in one round-trip. Sources: live outgoing relationship rows and inline [[rel::ID]] / [[ID]] mentions (a bare [[ID]] is references). Each linked note is labelled `assumes -> OBSERVATION-6K13` (incoming: `assumes <- OTHER-1`). `--depth N` (default 1, max 4) walks further, deduped. The walk stops at 40 notes and sets `notice` when it does. `--rel a,b` limits slugs. `--summary` keeps the title and
|
|
35
|
+
expand: "`cnotes notes get <id> --expand` returns the note plus the notes it links to, in one round-trip. Sources: live outgoing relationship rows and inline [[rel::ID]] / [[ID]] mentions (a bare [[ID]] is references). Each linked note is labelled `assumes -> OBSERVATION-6K13` (incoming: `assumes <- OTHER-1`). `--depth N` (default 1, max 4) walks further, deduped. The walk stops at 40 notes and sets `notice` when it does. `--rel a,b` limits slugs. `--summary` keeps the title and the first real prose paragraph of linked notes (skips leading headings, blanks, and chip-only lines; heading-only notes fall back to the last heading text, list-only notes to the first list); requested notes stay whole. `--incoming` also follows backlinks. JSON is `{ notes, linked, truncated, cap, omitted, notice }`. Each linked entry is `{ displayId, relation, direction, depth, from, label, links, note }` and `note` matches a `notes get` row. Without `--expand`, `notes get --json` stays a bare array.",
|
|
36
36
|
},
|
|
37
37
|
resources: {
|
|
38
38
|
note: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-schema.js","sourceRoot":"","sources":["../../src/lib/build-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE;QACb,IAAI,EAAE,iIAAiI;QACvI,MAAM,EAAE;YACN,YAAY;YACZ,UAAU;YACV,QAAQ;YACR,cAAc;YACd,aAAa;YACb,UAAU;YACV,SAAS;SACV;KACF;IACD,MAAM,EAAE;QACN,WAAW,EAAE,uCAAuC;QACpD,gBAAgB,EAAE,oGAAoG;QACtH,KAAK,EAAE;YACL,6FAA6F;YAC7F,qQAAqQ;YACrQ,uOAAuO;SACxO;KACF;IACD,SAAS,EAAE;QACT,IAAI,EAAE,6JAA6J;QACnK,SAAS,EAAE,2PAA2P;QACtQ,QAAQ,EAAE,gPAAgP;QAC1P,MAAM,EACJ,
|
|
1
|
+
{"version":3,"file":"build-schema.js","sourceRoot":"","sources":["../../src/lib/build-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE;QACb,IAAI,EAAE,iIAAiI;QACvI,MAAM,EAAE;YACN,YAAY;YACZ,UAAU;YACV,QAAQ;YACR,cAAc;YACd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ChE,GAAG,aAAa;KACjB,CAAC;AACJ,CAAC"}
|
package/dist/mcp-server.js
CHANGED
|
@@ -174,7 +174,7 @@ server.tool("cnotes_notes_get", "Get one or more notes by display ID (e.g. MEETI
|
|
|
174
174
|
summary: z
|
|
175
175
|
.boolean()
|
|
176
176
|
.optional()
|
|
177
|
-
.describe("With expand, linked notes return title and
|
|
177
|
+
.describe("With expand, linked notes return title and the first real prose paragraph (skips leading headings, blanks, and chip-only lines). Requested notes stay whole."),
|
|
178
178
|
incoming: z
|
|
179
179
|
.boolean()
|
|
180
180
|
.optional()
|