create-evda 0.1.8 → 0.1.9
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/CHANGELOG.md +37 -1
- package/README.md +8 -2
- package/bin/evda.mjs +157 -4
- package/create-evda.mjs +6 -1
- package/dist/pairing.mjs +2932 -1684
- package/hooks/evda-day-writer-guard.mjs +7 -0
- package/lib/acknowledge.mjs +187 -0
- package/lib/browse.mjs +354 -0
- package/lib/circles.mjs +5 -1
- package/lib/clients.mjs +18 -2
- package/lib/connect.mjs +8 -1
- package/lib/day-file.mjs +58 -9
- package/lib/day-writer.mjs +103 -0
- package/lib/doctor.mjs +13 -0
- package/lib/every-chat.mjs +132 -0
- package/lib/filechanges.mjs +203 -68
- package/lib/gather-apply.mjs +44 -3
- package/lib/gather.mjs +3 -1
- package/lib/keychain.mjs +144 -0
- package/lib/manifest.mjs +3 -1
- package/lib/mcp-auth.mjs +41 -1
- package/lib/mcp-http.mjs +24 -4
- package/lib/mcp.mjs +893 -73
- package/lib/measurement-log.mjs +246 -0
- package/lib/messages.mjs +5 -2
- package/lib/pairing.mjs +243 -5
- package/lib/parity.mjs +47 -13
- package/lib/qr.mjs +317 -0
- package/lib/record.mjs +20 -0
- package/lib/routines.mjs +42 -3
- package/lib/sigstore-trust.json +20 -0
- package/lib/skills.mjs +1 -1
- package/lib/sync-lock.mjs +143 -0
- package/lib/sync-rules.mjs +154 -1
- package/lib/tools.mjs +423 -24
- package/lib/watch.mjs +160 -0
- package/package.json +1 -1
- package/skills/evda/SKILL.md +14 -0
- package/templates/AGENTS.md +25 -4
- package/templates/evda-digest.md +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,15 +4,51 @@ Plain-English notes on how Iris behaves differently after each version. Not a co
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
When two of your machines share one record through iCloud, one of them can be the only one that
|
|
8
|
+
writes the daily note. Set EVDA_DAY_WRITER on every other machine and add hooks/evda-day-writer-guard.mjs
|
|
9
|
+
to that machine's own Claude Code settings: an agent there that tries to write the note directly is
|
|
10
|
+
stopped and told to file through evda_write on the writing machine, because two machines writing the
|
|
11
|
+
same note within seconds lose one of the writes with no conflict copy.
|
|
12
|
+
|
|
13
|
+
The first time you talk to your EVÐA from a chat app (Claude, ChatGPT, or any other), Iris gives
|
|
14
|
+
you one line to add to that app's every-chat instructions, and says where that setting is. With it
|
|
15
|
+
there, every chat starts as Iris, even one that never opens your record. Tell Iris it is set, or
|
|
16
|
+
that you don't want it, and that app never asks again; a second app asks once for itself. If you
|
|
17
|
+
file only when you ask, the line loads Iris and asks for nothing more. `create-evda` and `evda
|
|
18
|
+
connect` print the same line.
|
|
19
|
+
|
|
20
|
+
The EVÐA app is one sidebar and the page you are reading. Today's Journal is first, there even
|
|
21
|
+
before you have written today, and what you type at the end of it is added to today's note,
|
|
22
|
+
verbatim, the way your AI's evda_write does. Below it, Journal, Captures, People and your project,
|
|
23
|
+
area and knowledge folders are pinned from your mapping, then Instructions (CLAUDE.md, AGENTS.md,
|
|
24
|
+
evda.json and any file the agents block is written into), then every folder of the record. Devices,
|
|
25
|
+
Connect your AI and Switch EVÐA sit quietly at the foot. A file's circle shows only when it is not
|
|
26
|
+
your record's usual one, and markdown reads formatted. Entries you noted or sealed, and parts you
|
|
27
|
+
set so no AI reads, stay closed. Tooling (dot-files, lockfiles, scripts, licenses, backups, empty
|
|
28
|
+
files) is left out, with one line per folder counting it. The window drags by its top edge. Large
|
|
29
|
+
files open whole: `evda browse` and `evda capture` wait for their answer to reach the app before
|
|
30
|
+
exiting, where before a file past 64 KB arrived cut off.
|
|
31
|
+
|
|
7
32
|
Your phone can join your EVÐA. `evda pair` on the computer your record is on shows a one-time code
|
|
8
33
|
and a QR link; it works once, for 10 minutes, and the phone gets only the parts you name (the
|
|
9
34
|
journal by default). `evda sync` adds the phone once it has used the code, takes in what it wrote,
|
|
10
35
|
and sends what changed; a note written on the phone lands under the day, in your words. `evda
|
|
11
36
|
devices` lists what is paired and `evda remove <device>` removes one: it adds nothing more and
|
|
12
|
-
receives nothing new. You can also ask your AI to
|
|
37
|
+
receives nothing new. You can also ask your AI to do all of it (`evda_pair`, `evda_devices`, `evda_sync_status`,
|
|
38
|
+
`evda_remove_device`): it shows a QR code to scan, adds the phone on its own once it scans, says
|
|
39
|
+
when each device was last heard from and what is still on its way to it, and removes a device only
|
|
40
|
+
after you say yes to what removing does. A phone paired this way pairs to the computer the AI's
|
|
41
|
+
EVÐA server runs on, and the answer names that computer. A second computer of yours (Hestia) speaks
|
|
42
|
+
as its own device and never as the laptop: until a grant makes it owner of a part it refuses to
|
|
43
|
+
pair, and once it owns one it pairs a phone to itself. Pairing goes
|
|
13
44
|
through a relay that cannot read what it carries, and needs Node 22.13 or newer; everything else
|
|
14
45
|
still runs on Node 20.
|
|
15
46
|
|
|
47
|
+
One sync of a record runs at a time. The Mac app syncing on its own, a launchd job and `evda sync`
|
|
48
|
+
at a terminal wait for each other; if a sync is still running after twenty seconds, the second says
|
|
49
|
+
"A sync of this EVÐA is already running. Try again in a moment." and changes nothing. A sync that
|
|
50
|
+
crashed leaves nothing in the way: the next one sees the process is gone and goes ahead.
|
|
51
|
+
|
|
16
52
|
Organizing is on from the start. Setup installs the morning organize on a Mac (a launchd job that
|
|
17
53
|
runs your own Claude each morning at 8:00, or when the computer wakes), says so in one line, and
|
|
18
54
|
offers off: answer no during setup, pass `--no-routines`, or later run `evda routine morning
|
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ apply places only what is new, in the record's own folders.
|
|
|
76
76
|
evda_operating_layer AGENTS.md, read first every session
|
|
77
77
|
evda_recent the last few days of the record
|
|
78
78
|
evda_write your words, verbatim, appended to today's daily file, with one line of context labeled as not yours. It takes no path and never edits
|
|
79
|
+
evda_record_correction one dated line appended to AGENTS.md's "What I have been taught", outside the installer's block. Never edits an earlier entry
|
|
79
80
|
evda_import what another AI said about you, filed under record/imports with its source and date
|
|
80
81
|
evda_search plain text search inside the record, on this machine
|
|
81
82
|
evda_circles your circles and their policies
|
|
@@ -91,9 +92,12 @@ apply places only what is new, in the record's own folders.
|
|
|
91
92
|
evda_write_skill writes or revises a skill at .claude/skills/<name>/SKILL.md. Never outside that folder, never a rule about your life
|
|
92
93
|
evda_create_subrecord an EVÐA inside this one, with the four roles and its own AGENTS.md, then doctor. Your evda.json changes only on bounded with confirmed: true
|
|
93
94
|
evda_doctor evda doctor, as a report
|
|
94
|
-
|
|
95
|
+
evda_pair a one-time code and a QR code to scan for your phone, paired to the computer this server runs on; the phone gets only the parts named, and is added on its own once it uses the code
|
|
96
|
+
evda_finish_pairing waits, at most two minutes, for the phone to use its code, and says when it is in
|
|
95
97
|
evda_sync_devices adds a phone that used its code, takes in what your devices wrote, sends what changed
|
|
96
|
-
evda_devices the devices paired with your EVÐA
|
|
98
|
+
evda_devices the devices paired with your EVÐA on this computer, what each reads, and when it was last heard from
|
|
99
|
+
evda_sync_status per device what is waiting, sent and confirmed, and whether a sync is running. Reads only
|
|
100
|
+
evda_remove_device removes a device; without confirm: true it only says what removing would do, for your yes
|
|
97
101
|
evda_check_update whether newer EVDA tooling exists
|
|
98
102
|
|
|
99
103
|
Every write appends, refuses anything shaped like a password, key or token, and says the path it wrote. Two kinds of call leave this machine. `evda_check_update` asks the npm registry for a version number; it carries nothing from the record and installs nothing, and the update itself is a command you run in a terminal. The device tools talk to the relay that carries your EVÐA between your own devices, and everything they send is sealed here first: the relay cannot read it. `evda connect` prints the setup for your record, with its path filled in:
|
|
@@ -103,6 +107,8 @@ claude mcp add --scope user evda -- /path/to/node /path/to/evda.mjs mcp ~/my-evd
|
|
|
103
107
|
codex mcp add evda -- /path/to/node /path/to/evda.mjs mcp ~/my-evda # Codex
|
|
104
108
|
```
|
|
105
109
|
|
|
110
|
+
**One layer, sized per app.** `evda_operating_layer` serves the core and AGENTS.md to every app, but a section that only makes sense with a shell (scripts to run, hosts to ssh to, local MCP servers) is noise in a chat app. Put `<!-- evda:surface terminal -->` on the line right after a `## ` heading and that section, with its subsections, goes only to coding agents (Claude Code, Codex). Every other app, including one the server has never heard of, gets the rest, in as few parts as its tool result limit allows, and is told which sections were left out. A record with no marker reads the same everywhere. The server knows the app by `initialize`'s `clientInfo` name, and the remote server logs that name and version, nothing else of it.
|
|
111
|
+
|
|
106
112
|
For the Claude desktop app, add the same command under `mcpServers` in `claude_desktop_config.json` (Settings, then Developer, then Edit Config) and restart the app. `create-evda` prints all three at the end of setup.
|
|
107
113
|
|
|
108
114
|
**The skill.** `skills/evda/SKILL.md` (Agent Skills format) tells Claude Code to act as Iris through the tools: load the operating layer first, file verbatim, never quiz, circles only on your yes. `evda skill install` copies it to `~/.claude/skills/evda/`; setup offers it.
|
package/bin/evda.mjs
CHANGED
|
@@ -34,8 +34,9 @@ import { parity, formatParity } from "../lib/parity.mjs";
|
|
|
34
34
|
import { note, releaseNote, ownerSearch, readContext, readersFor, describeReaders, parseReaders, READ_BY } from "../lib/readers.mjs";
|
|
35
35
|
import { runHook } from "../lib/guard.mjs";
|
|
36
36
|
import { markdownFiles } from "../lib/circles.mjs";
|
|
37
|
-
import { refuseSecrets, message as messageTool, replies as repliesTool } from "../lib/tools.mjs";
|
|
37
|
+
import { refuseSecrets, message as messageTool, replies as repliesTool, acknowledgeEntry as acknowledgeTool, acknowledgements as acknowledgementsTool } from "../lib/tools.mjs";
|
|
38
38
|
import * as pairing from "../lib/pairing.mjs";
|
|
39
|
+
import { watchRecord, watchRelay } from "../lib/watch.mjs";
|
|
39
40
|
|
|
40
41
|
const HELP = `evda: operate an EVDA. The files are the truth; this is optional.
|
|
41
42
|
|
|
@@ -101,6 +102,10 @@ const HELP = `evda: operate an EVDA. The files are the truth; this is optional.
|
|
|
101
102
|
run doctor. Writes a reversal manifest beside the proposal
|
|
102
103
|
evda gather revert <manifest> [--force]
|
|
103
104
|
undo an apply byte for byte; refused when a placed file was edited
|
|
105
|
+
evda secret <file> [dir] [--keychain <path>]
|
|
106
|
+
a credential note (in Credentials/, or --into a path of its own) with
|
|
107
|
+
every "in your Keychain" pointer read back and filled in, to this
|
|
108
|
+
terminal only (HQ-1916). No MCP tool reads a value this way
|
|
104
109
|
evda look-back [dir] [--model M]
|
|
105
110
|
the week, read back by the owner's claude -p, appended to a report
|
|
106
111
|
evda routine <morning|weekly> [dir] [--launchd] [--install] [--uninstall]
|
|
@@ -116,11 +121,24 @@ const HELP = `evda: operate an EVDA. The files are the truth; this is optional.
|
|
|
116
121
|
evda pair [dir] [--name phone] [--parts journal[,people]] [--json]
|
|
117
122
|
a one-time code (and a QR link) for a phone to join this EVÐA. It
|
|
118
123
|
works once, for 10 minutes, and gives the device only the parts named
|
|
124
|
+
(with no --parts, the part that holds the day folder)
|
|
125
|
+
evda pair --finish [dir] [--json]
|
|
126
|
+
add a device that used its code, without a full sync. It never waits:
|
|
127
|
+
while a sync runs it says so, and that sync adds the device itself
|
|
119
128
|
evda devices [dir] [--json] the devices paired with this EVÐA, and what each reads
|
|
129
|
+
evda watch [dir] one line (CHANGED <n>) per burst of saves in the record, and INCOMING
|
|
130
|
+
when a device sent something, for the Mac app's sync; runs until stopped
|
|
131
|
+
evda sync-status [dir] [--json]
|
|
132
|
+
what is syncing on this computer now, since when, and what is still owed
|
|
120
133
|
evda remove <device> [dir] remove a device: it adds nothing more and receives nothing new
|
|
121
134
|
evda sync [dir] add devices that used their code, take in what they sent, send what
|
|
122
135
|
changed. Pairing needs Node 22.13 or newer; --relay <url> for another relay
|
|
136
|
+
One sync of a record runs at a time (the Mac app, launchd, a terminal); a
|
|
137
|
+
second waits for it, then says so in one line if it is still running
|
|
123
138
|
--json on pair, devices, remove and sync prints data for an app, no ids
|
|
139
|
+
evda compact [dir] [--yes] give back the space this computer's sync state keeps for sealed copies
|
|
140
|
+
nothing needs: media (which travels by name only) and copies no device is
|
|
141
|
+
still owed. Shows what it would remove; --yes removes them
|
|
124
142
|
evda status [dir] one screen summary
|
|
125
143
|
evda publish public [dir] --out <dir> --key <seed file>
|
|
126
144
|
the public circle as a signed plaintext export; refuses (exit 2) on a
|
|
@@ -154,8 +172,14 @@ const HELP = `evda: operate an EVDA. The files are the truth; this is optional.
|
|
|
154
172
|
evda replies [--peek] [--in dir] [--json]
|
|
155
173
|
the owner's replies not seen yet, marked seen unless --peek; read
|
|
156
174
|
under read_by as the AI $EVDA_READER names (claude, local, ...)
|
|
175
|
+
evda acknowledge <path> [--section "## HH:MM"] [--note "<one line>"] [--by NAME] [--in dir] [--json]
|
|
176
|
+
you said a weighty entry back to the owner: one mark beside the
|
|
177
|
+
record, so no other reader says it again. Already marked prints who
|
|
178
|
+
did it and writes nothing. No path lists every mark
|
|
157
179
|
evda search <words> [dir] your own search, on this device, no model; just-noted and sealed entries included and marked
|
|
158
180
|
evda readers [dir] which AI reads each part of the record, from read_by
|
|
181
|
+
evda browse [dir] [--folder F | --pins | --operating | --today | --index | --open P | --attachments | --attach P] one folder of the record, the pinned folders, the files on how it works, today's note, every text file's path, one file, every PDF, image and other attachment's path, or one attachment, as JSON (the app)
|
|
182
|
+
evda capture [dir] < words append the words on stdin to today's note, verbatim, under a new timestamped section (the app)
|
|
159
183
|
evda local-model how to run a model on your own computer and point a circle at it
|
|
160
184
|
evda guard the Claude Code read guard (a PreToolUse hook; reads the tool call on stdin)
|
|
161
185
|
evda where which EVDA the locator resolves to, and by which rule
|
|
@@ -185,7 +209,7 @@ function isDirArg(a) {
|
|
|
185
209
|
}
|
|
186
210
|
|
|
187
211
|
// `--name value` or `--name=value`. The value of a `--name value` pair is not a positional.
|
|
188
|
-
const VALUE_FLAGS = ["to", "kind", "name", "role", "by", "as", "model", "project", "hour", "weekday", "out", "key", "plan", "device", "shadow", "record-id", "env-file", "port", "host", "public-url", "log", "lifeline", "ttl", "parts", "relay"];
|
|
212
|
+
const VALUE_FLAGS = ["open", "folder", "to", "kind", "name", "role", "by", "as", "model", "project", "hour", "weekday", "out", "key", "plan", "device", "shadow", "record-id", "env-file", "port", "host", "public-url", "log", "lifeline", "ttl", "parts", "relay"];
|
|
189
213
|
function flagValue(args, name) {
|
|
190
214
|
const eq = args.find((a) => a.startsWith(`--${name}=`));
|
|
191
215
|
if (eq) return eq.slice(name.length + 3);
|
|
@@ -272,7 +296,7 @@ async function main(argv) {
|
|
|
272
296
|
|
|
273
297
|
case "version":
|
|
274
298
|
case "--version":
|
|
275
|
-
console.log(`evda tool schema ${SCHEMA_VERSION}`);
|
|
299
|
+
console.log(`evda ${packageVersion()} (tool schema ${SCHEMA_VERSION})`);
|
|
276
300
|
return 0;
|
|
277
301
|
|
|
278
302
|
case "init": {
|
|
@@ -369,6 +393,25 @@ async function main(argv) {
|
|
|
369
393
|
throw new EvdaError("usage: evda gather scan <source>... | questions <proposal> | answer <proposal> <question> <value> | show <proposal> | apply <proposal> --into <record> | revert <manifest>", { exit: 2 });
|
|
370
394
|
}
|
|
371
395
|
|
|
396
|
+
// HQ-1916: a credential note's Keychain pointers, read back and printed to this terminal only.
|
|
397
|
+
// No MCP tool calls into this, on purpose -- the whole point of the Keychain move is that no AI
|
|
398
|
+
// reads the value; only the owner does, on their own Mac.
|
|
399
|
+
case "secret": {
|
|
400
|
+
const { dir, rest } = pickDir(args);
|
|
401
|
+
const file = rest[0];
|
|
402
|
+
if (!file) throw new EvdaError("usage: evda secret <file> [dir] [--keychain <path>]", { exit: 2 });
|
|
403
|
+
const g2 = await import("../lib/gather.mjs");
|
|
404
|
+
const k = await import("../lib/keychain.mjs");
|
|
405
|
+
const abs = file.includes("/") ? resolve(dir, file) : join(dir, g2.CREDENTIALS, file);
|
|
406
|
+
if (!existsSync(abs)) throw new EvdaError(`REFUSED: no file at ${abs}.`, { code: "NOT_FOUND", exit: 2 });
|
|
407
|
+
const text = readFileSync(abs, "utf8");
|
|
408
|
+
const r = k.resolvePointers(text, { keychainPath: flagValue(args, "keychain") ?? process.env.EVDA_KEYCHAIN_PATH ?? null });
|
|
409
|
+
console.log(r.text);
|
|
410
|
+
if (!r.resolved && !r.failed) console.log(`\nSKIPPED Keychain: ${abs} holds no "in your Keychain" pointer -- its value(s) never left the file (not macOS at apply, or the write failed then)`);
|
|
411
|
+
else console.log(`\nCHECKED ${r.resolved} Keychain pointer(s) resolved, ${r.failed} could not be read`);
|
|
412
|
+
return r.failed ? 1 : 0;
|
|
413
|
+
}
|
|
414
|
+
|
|
372
415
|
case "look-back": {
|
|
373
416
|
const { dir } = pickDir(args);
|
|
374
417
|
const { lookBack } = await import("../lib/organize.mjs");
|
|
@@ -507,6 +550,12 @@ async function main(argv) {
|
|
|
507
550
|
|
|
508
551
|
case "pair": {
|
|
509
552
|
const { dir } = pickDir(args);
|
|
553
|
+
// --finish: add a device that used its code, without a full sync (HQ-2017).
|
|
554
|
+
if (args.includes("--finish")) {
|
|
555
|
+
if (args.includes("--json")) console.log(JSON.stringify(await pairing.finishData(dir, { relay: flagValue(args, "relay") })));
|
|
556
|
+
else for (const line of await pairing.finish(dir, { relay: flagValue(args, "relay") })) console.log(line);
|
|
557
|
+
return 0;
|
|
558
|
+
}
|
|
510
559
|
const r = await pairing.pair(dir, { name: flagValue(args, "name"), parts: flagValue(args, "parts"), relay: flagValue(args, "relay") });
|
|
511
560
|
// --json is for an app (the EVÐA Mac app, HQ-1925): the code and its QR link, and nothing with an id.
|
|
512
561
|
if (args.includes("--json")) console.log(JSON.stringify({ name: r.name, code: r.code, qr: r.qr, computer: r.computer, expiresAt: r.expiresAt, parts: r.parts }));
|
|
@@ -514,6 +563,16 @@ async function main(argv) {
|
|
|
514
563
|
return 0;
|
|
515
564
|
}
|
|
516
565
|
|
|
566
|
+
case "sync-status": {
|
|
567
|
+
// What is syncing on this computer now, for the Mac app (HQ-2041): who holds the state and
|
|
568
|
+
// since when, and how much is still owed. Never waits.
|
|
569
|
+
const { dir } = pickDir(args);
|
|
570
|
+
const r = await pairing.statusData(dir, { relay: flagValue(args, "relay") });
|
|
571
|
+
if (args.includes("--json")) console.log(JSON.stringify(r));
|
|
572
|
+
else console.log(r.holder ? `Syncing: ${r.holder.by === "tick" ? "the background sync" : r.holder.by === "app" ? "the EVÐA app" : "a command"} (${r.holder.op}) since ${new Date(r.holder.since).toLocaleTimeString()}.` : "Nothing is syncing.", r.owed ? `${r.owed} change(s) still owed to a device.` : "");
|
|
573
|
+
return 0;
|
|
574
|
+
}
|
|
575
|
+
|
|
517
576
|
case "devices":
|
|
518
577
|
case "sync": {
|
|
519
578
|
const { dir } = pickDir(args);
|
|
@@ -527,6 +586,24 @@ async function main(argv) {
|
|
|
527
586
|
return 0;
|
|
528
587
|
}
|
|
529
588
|
|
|
589
|
+
case "watch": {
|
|
590
|
+
// For the Mac app (HQ-2068): one line a burst of saves in the record, so it syncs in seconds.
|
|
591
|
+
// Runs until it is stopped; the app runs the sync, this only says when.
|
|
592
|
+
const { dir } = pickDir(args);
|
|
593
|
+
watchRecord(dir, (paths) => console.log(`CHANGED ${paths.length}`));
|
|
594
|
+
// And the relay: a device's note says INCOMING within seconds, so the app syncs it in then.
|
|
595
|
+
const relay = flagValue(args, "relay");
|
|
596
|
+
if (!pairing.pairingUnsupported()) watchRelay(() => pairing.inboundMailboxes(dir, { relay }), () => console.log("INCOMING"));
|
|
597
|
+
console.log("WATCHING");
|
|
598
|
+
return await new Promise(() => undefined);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
case "compact": {
|
|
602
|
+
const { dir } = pickDir(args);
|
|
603
|
+
for (const line of await pairing.compact(dir, { yes: args.includes("--yes") })) console.log(line);
|
|
604
|
+
return 0;
|
|
605
|
+
}
|
|
606
|
+
|
|
530
607
|
case "remove": {
|
|
531
608
|
// The device's name comes first and is never read as the record, even when a folder by
|
|
532
609
|
// that name sits in the working directory.
|
|
@@ -572,7 +649,7 @@ async function main(argv) {
|
|
|
572
649
|
let body = args.join(" ");
|
|
573
650
|
if (body === "-" || body === "") body = readFileSync(0, "utf8");
|
|
574
651
|
const r = messageTool(openEvda(dir), { title, body, ...(from === undefined ? {} : { from }) });
|
|
575
|
-
console.log(`
|
|
652
|
+
console.log(`Filed the message ${r.id} at ${r.path}. This does not confirm it reached the owner's phone.`);
|
|
576
653
|
return 0;
|
|
577
654
|
}
|
|
578
655
|
|
|
@@ -588,6 +665,33 @@ async function main(argv) {
|
|
|
588
665
|
return 0;
|
|
589
666
|
}
|
|
590
667
|
|
|
668
|
+
case "acknowledge": {
|
|
669
|
+
// HQ-2060. A note may hold a slash, so the record is --in <dir> or the locator, as with
|
|
670
|
+
// note and message. No path lists what every reader has already acknowledged.
|
|
671
|
+
const take = (flag) => { const i = args.indexOf(flag); if (i < 0) return undefined; const v = args[i + 1]; if (v === undefined) throw new EvdaError(`${flag} needs a value`, { exit: 2 }); args.splice(i, 2); return v; };
|
|
672
|
+
const json = args.includes("--json") && (args.splice(args.indexOf("--json"), 1), true);
|
|
673
|
+
const dirArg = take("--in");
|
|
674
|
+
const section = take("--section");
|
|
675
|
+
const note = take("--note");
|
|
676
|
+
const by = take("--by");
|
|
677
|
+
const dir = locate({ explicit: dirArg }).dir;
|
|
678
|
+
const evda = openEvda(dir);
|
|
679
|
+
const path = args.filter((a) => !a.startsWith("--")).join(" ").trim();
|
|
680
|
+
if (!path) {
|
|
681
|
+
const r = acknowledgementsTool(evda);
|
|
682
|
+
if (json) { console.log(JSON.stringify(r, null, 2)); return 0; }
|
|
683
|
+
for (const m of r.marks) console.log(`- ${m.key} (${m.by ?? "unknown"}, ${m.at}): ${m.note}`);
|
|
684
|
+
console.log(`CHECKED ${r.count} acknowledged entr${r.count === 1 ? "y" : "ies"}`);
|
|
685
|
+
return 0;
|
|
686
|
+
}
|
|
687
|
+
const r = acknowledgeTool(evda, { path, ...(section === undefined ? {} : { section }), ...(note === undefined ? {} : { note }), ...(by === undefined ? {} : { by }) });
|
|
688
|
+
if (json) { console.log(JSON.stringify(r, null, 2)); return 0; }
|
|
689
|
+
const what = r.section ? `${r.path} "${r.section}"` : r.path;
|
|
690
|
+
if (!r.first) console.log(`Already acknowledged by ${r.by ?? "an earlier reader"} at ${r.at}: ${r.note}\nNothing was written. Say nothing about ${what} unless the owner brings it up.`);
|
|
691
|
+
else console.log(`Marked ${what} acknowledged, as ${r.by}. You reached it first, so every later reader sees this mark and stays quiet.`);
|
|
692
|
+
return 0;
|
|
693
|
+
}
|
|
694
|
+
|
|
591
695
|
case "release": {
|
|
592
696
|
const { dir, entry } = pickReleaseArgs(args);
|
|
593
697
|
const r = releaseNote(openEvda(dir), entry);
|
|
@@ -607,6 +711,37 @@ async function main(argv) {
|
|
|
607
711
|
return 0;
|
|
608
712
|
}
|
|
609
713
|
|
|
714
|
+
case "browse": {
|
|
715
|
+
// The owner's app reads the record through this (HQ-2038): the pinned folders, one folder's
|
|
716
|
+
// children, or one file opened, each as one JSON line. The rules are lib/browse.mjs.
|
|
717
|
+
const { dir } = pickDir(args);
|
|
718
|
+
const evda = openEvda(dir);
|
|
719
|
+
const b = await import("../lib/browse.mjs");
|
|
720
|
+
const bctx = b.browseContext(evda);
|
|
721
|
+
const open = flagValue(args, "open");
|
|
722
|
+
const folder = flagValue(args, "folder");
|
|
723
|
+
const attach = flagValue(args, "attach");
|
|
724
|
+
const answer = attach !== undefined ? b.attachEntry(evda, attach, { bctx }) : args.includes("--attachments") ? b.attachments(evda, { bctx }) : open !== undefined ? b.openEntry(evda, open, { bctx }) : args.includes("--pins") ? b.pins(evda, { bctx }) : args.includes("--operating") ? b.operating(evda, { bctx }) : args.includes("--today") ? b.today(evda, { bctx }) : args.includes("--index") ? b.index(evda, { bctx }) : b.browse(evda, folder ?? "", { bctx });
|
|
725
|
+
// Written to the end before returning: on macOS a pipe write is asynchronous, and the exit
|
|
726
|
+
// that follows cut anything past the pipe's 64 KB buffer (his 71 KB CLAUDE.md, HQ-2038).
|
|
727
|
+
await new Promise((done) => process.stdout.write(`${JSON.stringify(answer)}\n`, done));
|
|
728
|
+
return 0;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
case "capture": {
|
|
732
|
+
// The app's capture box (HQ-2038): the words come on stdin, verbatim, and are appended to
|
|
733
|
+
// today's daily note under a new timestamped section, by the same write evda_write makes.
|
|
734
|
+
const { dir } = pickDir(args);
|
|
735
|
+
const evda = openEvda(dir);
|
|
736
|
+
const chunks = [];
|
|
737
|
+
for await (const c of process.stdin) chunks.push(c);
|
|
738
|
+
const words = Buffer.concat(chunks).toString("utf8");
|
|
739
|
+
const { capture } = await import("../lib/browse.mjs");
|
|
740
|
+
const r = capture(evda, words);
|
|
741
|
+
await new Promise((done) => process.stdout.write(`${JSON.stringify(r)}\n`, done));
|
|
742
|
+
return 0;
|
|
743
|
+
}
|
|
744
|
+
|
|
610
745
|
case "readers": {
|
|
611
746
|
const { dir } = pickDir(args);
|
|
612
747
|
const evda = openEvda(dir);
|
|
@@ -963,7 +1098,25 @@ async function main(argv) {
|
|
|
963
1098
|
|
|
964
1099
|
// Through realpath: an installed bin is a symlink and resolve() does not follow it (see the same
|
|
965
1100
|
// guard in create-evda.mjs, and test/bins.test.mjs).
|
|
1101
|
+
/**
|
|
1102
|
+
* A command the EVÐA app runs ends when the app does (HQ-2041). The app names itself in
|
|
1103
|
+
* EVDA_PARENT_PID; once this process's parent is no longer that pid (the app quit or crashed and
|
|
1104
|
+
* this process was handed to launchd), it stops. A lock it held is then stale and taken over.
|
|
1105
|
+
*/
|
|
1106
|
+
export function watchParent(env = process.env, { ppid = () => process.ppid, exit = (c) => process.exit(c), everyMs = 1000 } = {}) {
|
|
1107
|
+
const want = Number(env.EVDA_PARENT_PID);
|
|
1108
|
+
if (!Number.isInteger(want) || want <= 0) return null;
|
|
1109
|
+
const check = () => {
|
|
1110
|
+
if (ppid() !== want) exit(1);
|
|
1111
|
+
};
|
|
1112
|
+
check();
|
|
1113
|
+
const t = setInterval(check, everyMs);
|
|
1114
|
+
t.unref();
|
|
1115
|
+
return t;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
966
1118
|
if (process.argv[1] && isEntry(process.argv[1], import.meta.url)) {
|
|
1119
|
+
watchParent();
|
|
967
1120
|
main(process.argv.slice(2)).then(
|
|
968
1121
|
(code) => process.exit(code),
|
|
969
1122
|
(e) => {
|
package/create-evda.mjs
CHANGED
|
@@ -33,6 +33,7 @@ import { readPointer, setPointer, pointerPath } from "./lib/locate.mjs";
|
|
|
33
33
|
import { FOLDER_MANIFEST } from "./lib/folders.mjs";
|
|
34
34
|
import { EvdaError } from "./lib/errors.mjs";
|
|
35
35
|
import { clients, installSkill, installGuard } from "./lib/connect.mjs";
|
|
36
|
+
import { everyChatSetupLines } from "./lib/every-chat.mjs";
|
|
36
37
|
import { defaultRoutines, installAtSetup } from "./lib/routines.mjs";
|
|
37
38
|
import { installHook } from "./lib/hooks.mjs";
|
|
38
39
|
import { applyPreset, listPresets, planLines, presetIds, NONE } from "./lib/presets.mjs";
|
|
@@ -332,7 +333,11 @@ export async function main(argv, io = null) {
|
|
|
332
333
|
}
|
|
333
334
|
log("");
|
|
334
335
|
log("Or connect your AI to this record from any folder, through the evda MCP server. No key and no model call in EVÐA:");
|
|
335
|
-
for (const c of clients(dir)) if (c.key !== "project") { log(` ${c.label}:`); for (const l of c.text.split("\n")) log(` ${l}`); }
|
|
336
|
+
for (const c of clients(dir)) if (c.key !== "project" && c.key !== "every-chat") { log(` ${c.label}:`); for (const l of c.text.split("\n")) log(` ${l}`); }
|
|
337
|
+
// The every-chat line (HQ-2205), from the one source: a chat that never calls an evda tool is
|
|
338
|
+
// reached only by the app's own every-chat setting.
|
|
339
|
+
log("");
|
|
340
|
+
for (const l of everyChatSetupLines(manifest.filing ?? null)) log(l);
|
|
336
341
|
if (opts.skill) {
|
|
337
342
|
const r = installSkill({ env: io?.env ?? process.env });
|
|
338
343
|
log("");
|