@cello-protocol/cli 0.0.295 → 0.0.297

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/dist/commands.js CHANGED
@@ -356,9 +356,8 @@ waitOpts) {
356
356
  };
357
357
  }
358
358
  /**
359
- * register(celloDir, agent, devToken):
360
- * - Refuse any token other than the local test directory's `DEV-` sentinel, before the daemon
361
- * is asked.
359
+ * register(celloDir, agent, token):
360
+ * - Refuse any token, before the daemon is asked: registration tokens are retired.
362
361
  * - Read the lock file to find the daemon's socket (the daemon must be running).
363
362
  * - With no token, pair this device first if it is not yet paired: print the approve link and
364
363
  * code, then wait for the approval.
@@ -368,9 +367,13 @@ waitOpts) {
368
367
  */
369
368
  /**
370
369
  * The OS opener for the approve link, or null where there is no browser to open: a Linux machine
371
- * with no display, or any session over SSH. Opening is best effort and never blocks the wait.
370
+ * with no display, any session over SSH, or anywhere CELLO_NO_BROWSER is set non-empty (test
371
+ * harnesses). Opening is best effort and never blocks the wait.
372
372
  */
373
373
  export function browserOpener(platform = process.platform, env = process.env) {
374
+ // Test harnesses register many agents and must not fill the operator's screen with pairing pages.
375
+ if (env["CELLO_NO_BROWSER"])
376
+ return null;
374
377
  if (platform === "darwin")
375
378
  return "open";
376
379
  if (platform === "linux" && (env["DISPLAY"] || env["WAYLAND_DISPLAY"]) && !env["SSH_CONNECTION"])
@@ -394,7 +397,7 @@ function openBrowser(url) {
394
397
  function displayCode(code) {
395
398
  return code.length === 8 ? `${code.slice(0, 4)}-${code.slice(4)}` : code;
396
399
  }
397
- export async function register(celloDir, agent, devToken, onProgress) {
400
+ export async function register(celloDir, agent, token, onProgress) {
398
401
  // Failures print JSON on stdout, with the prose in `guidance` on stderr, so a script that parses
399
402
  // the output reads the reason instead of a parse error.
400
403
  const fail = (reason, guidance) => ({
@@ -405,9 +408,8 @@ export async function register(celloDir, agent, devToken, onProgress) {
405
408
  if (!agent) {
406
409
  return fail("missing_agent_name", "You didn't name an agent to register. Usage: cello register-agent <agent>. See your agents with 'cello status'.");
407
410
  }
408
- // A `DEV-` token is the sentinel a local test directory (CELLO_ENV=local) accepts; production
409
- // directories refuse it, and every real registration pairs this device instead.
410
- if (devToken !== "" && !devToken.startsWith("DEV-")) {
411
+ // Every registration pairs this device; no directory accepts a token.
412
+ if (token !== "") {
411
413
  return fail("token_retired", "CELLO no longer uses registration tokens. Run 'cello register-agent <name>' with no token; the first time on this machine it shows a link to approve this device.");
412
414
  }
413
415
  const lockFilePath = join(celloDir, "daemon.lock");
@@ -417,7 +419,7 @@ export async function register(celloDir, agent, devToken, onProgress) {
417
419
  }
418
420
  try {
419
421
  const { result, sharePubkey } = await withIpc(lock.socketPath, async (client) => {
420
- if (!devToken) {
422
+ {
421
423
  // This device presents its own credential, pairing first if it has none.
422
424
  const start = (await client.send("cello_pair_start"));
423
425
  if (!start.ok)
@@ -432,7 +434,7 @@ export async function register(celloDir, agent, devToken, onProgress) {
432
434
  onProgress?.("This device is paired.");
433
435
  }
434
436
  }
435
- const reg = (await client.send("cello_register", { agent, ...(devToken ? { preAuthToken: devToken } : {}) }));
437
+ const reg = (await client.send("cello_register", { agent }));
436
438
  if (!reg.ok)
437
439
  return { result: reg, sharePubkey: undefined };
438
440
  const list = (await client.send("cello_list_agents"));
@@ -706,21 +708,422 @@ export async function sessions(celloDir, opts = {}) {
706
708
  * daemon-wide bot credentials (narrow, dedicated surface; NOT folded into the parked `cello
707
709
  * config`, since a bot token has no sensible default and can't wait for M9-CFG-001). */
708
710
  /**
709
- * `cello attestations` — YOUR words about ANOTHER agent, and what became of them.
711
+ * `cello attestations` — the M10E REVIEW system (008-ENDRENAME).
710
712
  *
711
- * SEPARATE FROM `trust-signals` ON PURPOSE. On the wire an attestation IS a trust signal, so folding
712
- * the two together is the obvious move — and it is the wrong one. A trust signal is the NETWORK
713
- * verifying an attribute of yours; an attestation is a PERSON vouching for a PERSON. That second
714
- * thing is the primitive collaboration rests on, and filing it as a subcommand of a wallet listing
715
- * makes the most important capability the hardest one to find.
713
+ * Namespaces, service-event marks, rights, the owner index, claim-service and activity counts — a
714
+ * review earned at a service event, which nothing can refuse or withdraw. The person-to-person
715
+ * ENDORSEMENT (vouch + accept/refuse) that used to live under `issue`/`issued` here is now
716
+ * `cello endorsements`; those two sub-verbs refuse with a rename line.
717
+ */
718
+ export async function attestations(celloDir, sub, args) {
719
+ // 008-ENDRENAME — `issue`/`issued` are the person-to-person ENDORSEMENT, now `cello endorsements`.
720
+ // A CLI is typed by a person, so point them at the new name and act on nothing, rather than
721
+ // silently aliasing. The MCP tools keep deprecated aliases; a typed command does not need one.
722
+ if (sub === "issue" || sub === "issued") {
723
+ return { exitCode: 1, output: `renamed: use \`cello endorsements ${sub}\`` };
724
+ }
725
+ const lockFilePath = join(celloDir, "daemon.lock");
726
+ const lock = await readLock(lockFilePath);
727
+ if (!lock) {
728
+ return { exitCode: 1, output: "No daemon running. Run 'cello login' first." };
729
+ }
730
+ // M10E 003-NSCLIENT — attestation namespaces.
731
+ if (sub === "namespace") {
732
+ const [action, ns, ...flags] = args;
733
+ if (action === "create") {
734
+ let mode;
735
+ let condition;
736
+ let scored = false;
737
+ let ttl;
738
+ for (let i = 0; i < flags.length; i++) {
739
+ if (flags[i] === "--mode")
740
+ mode = flags[++i];
741
+ else if (flags[i] === "--scored")
742
+ scored = true;
743
+ else if (flags[i] === "--ttl")
744
+ ttl = Number(flags[++i]);
745
+ else if (flags[i] === "--condition")
746
+ condition = flags[++i];
747
+ }
748
+ if (!ns || !mode || !condition) {
749
+ return {
750
+ exitCode: 1,
751
+ output: 'Usage: cello attestations namespace create <ns> --mode <public|private> [--scored] [--ttl <days>] --condition "<words>"\n' +
752
+ "\n" +
753
+ " <ns> 1–3 dotted segments, e.g. reviews.prop_8821\n" +
754
+ " --mode public (anyone reads the reviews) or private (chosen readers)\n" +
755
+ " --scored a 1–5 rating plus text; omit for text-only\n" +
756
+ " --ttl how many days a reviewer has, 7–180 (default 30)\n" +
757
+ " --condition the plain-words rule under which the right to review is granted",
758
+ };
759
+ }
760
+ try {
761
+ const params = { namespace: ns, mode, scored, condition };
762
+ if (ttl !== undefined)
763
+ params.ttl_days = ttl;
764
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_namespace_create", params)));
765
+ if (!result.ok)
766
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
767
+ return { exitCode: 0, output: result.guidance ?? "Created." };
768
+ }
769
+ catch (err) {
770
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
771
+ }
772
+ }
773
+ if (action === "close") {
774
+ if (!ns)
775
+ return { exitCode: 1, output: "Usage: cello attestations namespace close <ns>" };
776
+ try {
777
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_namespace_close", { namespace: ns })));
778
+ if (!result.ok)
779
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
780
+ return { exitCode: 0, output: result.guidance ?? "Closed." };
781
+ }
782
+ catch (err) {
783
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
784
+ }
785
+ }
786
+ return { exitCode: 1, output: "Usage:\n cello attestations namespace create <ns> --mode <public|private> [--scored] [--ttl <days>] --condition \"<words>\"\n cello attestations namespace close <ns>" };
787
+ }
788
+ if (sub === "index") {
789
+ let owner;
790
+ let after;
791
+ for (let i = 0; i < args.length; i++) {
792
+ if (args[i] === "--after")
793
+ after = args[++i];
794
+ else if (!args[i].startsWith("--"))
795
+ owner = args[i];
796
+ }
797
+ try {
798
+ const params = {};
799
+ if (owner)
800
+ params.owner_pubkey = owner;
801
+ if (after)
802
+ params.after = after;
803
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_index", params)));
804
+ if (!result.ok)
805
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
806
+ const entries = result.entries ?? [];
807
+ if (entries.length === 0)
808
+ return { exitCode: 0, output: "No namespaces." };
809
+ const lines = entries.map((e) => {
810
+ const ttl = e.right_ttl_days === null ? "—" : `${e.right_ttl_days}d`;
811
+ const state = e.closed_at === null ? "open" : "closed";
812
+ const flag = e.verified ? "" : " UNVERIFIED";
813
+ return ` ${e.namespace.padEnd(28)} ${(e.mode ?? "—").padEnd(8)} ${(e.template ?? "—").padEnd(7)} ${ttl.padEnd(5)} ${state}${flag}`;
814
+ });
815
+ const more = result.next ? `\n\n More — cello attestations index ${owner ?? ""} --after ${result.next}` : "";
816
+ return { exitCode: 0, output: lines.join("\n") + more };
817
+ }
818
+ catch (err) {
819
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
820
+ }
821
+ }
822
+ // M10E 005-SVCCLIENT — mark a service event while a session is open.
823
+ if (sub === "mark") {
824
+ const [sessionId, ns, ...flags] = args;
825
+ let originChannel;
826
+ for (let i = 0; i < flags.length; i++) {
827
+ if (flags[i] === "--origin-channel")
828
+ originChannel = flags[++i];
829
+ }
830
+ if (!sessionId || !ns) {
831
+ return { exitCode: 1, output: "Usage: cello attestations mark <session-id> <namespace> [--origin-channel <pubkey>]" };
832
+ }
833
+ try {
834
+ const params = { session_id: sessionId, namespace: ns };
835
+ if (originChannel)
836
+ params.origin_channel = originChannel;
837
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_mark", params)));
838
+ if (!result.ok)
839
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
840
+ return { exitCode: 0, output: result.guidance ?? "Marked." };
841
+ }
842
+ catch (err) {
843
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
844
+ }
845
+ }
846
+ // M10E 005-SVCCLIENT — the rights this agent holds (expired ones shown, flagged).
847
+ if (sub === "rights") {
848
+ let after;
849
+ for (let i = 0; i < args.length; i++) {
850
+ if (args[i] === "--after")
851
+ after = args[++i];
852
+ }
853
+ try {
854
+ const params = {};
855
+ if (after)
856
+ params.after = after;
857
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_rights", params)));
858
+ if (!result.ok)
859
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
860
+ const rights = result.rights ?? [];
861
+ if (rights.length === 0)
862
+ return { exitCode: 0, output: "No rights." };
863
+ const lines = rights.map((r) => {
864
+ const flag = r.expired ? " EXPIRED" : "";
865
+ return ` ${r.namespace.padEnd(28)} ${(r.template ?? "—").padEnd(7)} ${r.subject_pubkey.slice(0, 16)}… ${r.right_id.slice(0, 16)}…${flag}`;
866
+ });
867
+ const more = result.next ? `\n\n More — cello attestations rights --after ${result.next}` : "";
868
+ return { exitCode: 0, output: lines.join("\n") + more };
869
+ }
870
+ catch (err) {
871
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
872
+ }
873
+ }
874
+ // M10E 013-PRIVATE — the readers of a PRIVATE namespace (owner only).
875
+ // cello attestations readers list <ns>
876
+ // cello attestations readers add|remove <ns> <pubkey>
877
+ if (sub === "readers") {
878
+ const [action, ns, pubkey] = args;
879
+ if (action === "list") {
880
+ if (!ns)
881
+ return { exitCode: 1, output: "Usage: cello attestations readers list <ns>" };
882
+ try {
883
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_readers_list", { namespace: ns })));
884
+ if (!result.ok)
885
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
886
+ const readers = result.readers ?? [];
887
+ const body = readers.length === 0 ? "No readers." : readers.map((r) => ` ${r}`).join("\n");
888
+ return { exitCode: 0, output: `${body}\n\n ${result.guidance ?? ""}`.trimEnd() };
889
+ }
890
+ catch (err) {
891
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
892
+ }
893
+ }
894
+ if (action === "add" || action === "remove") {
895
+ if (!ns || !pubkey || !/^[0-9a-f]{64}$/i.test(pubkey)) {
896
+ return { exitCode: 1, output: `Usage: cello attestations readers ${action} <ns> <pubkey-64hex>` };
897
+ }
898
+ try {
899
+ const verb = action === "add" ? "cello_attestations_readers_add" : "cello_attestations_readers_remove";
900
+ const result = (await withIpc(lock.socketPath, (client) => client.send(verb, { namespace: ns, pubkey: pubkey.toLowerCase() })));
901
+ if (!result.ok)
902
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
903
+ return { exitCode: 0, output: result.guidance ?? "Reader list updated." };
904
+ }
905
+ catch (err) {
906
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
907
+ }
908
+ }
909
+ return { exitCode: 1, output: "Usage:\n cello attestations readers list <ns>\n cello attestations readers add <ns> <pubkey>\n cello attestations readers remove <ns> <pubkey>" };
910
+ }
911
+ // M10E 011-CLAIM — write a review for a right you hold. Text after `--`, so it can contain flags
912
+ // or dashes without being parsed. `cello attestations write <right-id> [--rating N] [--origin-channel pk] -- <text…>`
913
+ if (sub === "write") {
914
+ const [rightId, ...rest] = args;
915
+ let rating;
916
+ let originChannel;
917
+ const textParts = [];
918
+ for (let i = 0; i < rest.length; i++) {
919
+ if (rest[i] === "--rating")
920
+ rating = Number(rest[++i]);
921
+ else if (rest[i] === "--origin-channel")
922
+ originChannel = rest[++i];
923
+ else if (rest[i] === "--") {
924
+ textParts.push(...rest.slice(i + 1));
925
+ break;
926
+ }
927
+ else
928
+ textParts.push(rest[i]);
929
+ }
930
+ const text = textParts.join(" ").trim();
931
+ if (!rightId || text.length === 0) {
932
+ return { exitCode: 1, output: 'Usage: cello attestations write <right-id> [--rating <1-5>] [--origin-channel <pubkey>] -- <review text>' };
933
+ }
934
+ try {
935
+ const params = { right_id: rightId, text };
936
+ if (rating !== undefined)
937
+ params.rating = rating;
938
+ if (originChannel)
939
+ params.origin_channel = originChannel;
940
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_write", params)));
941
+ if (!result.ok)
942
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
943
+ return { exitCode: 0, output: result.guidance ?? "Review submitted." };
944
+ }
945
+ catch (err) {
946
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
947
+ }
948
+ }
949
+ // M10E 011-CLAIM — the reviews you have written, each with its submission outcome.
950
+ if (sub === "written") {
951
+ try {
952
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_written", {})));
953
+ if (!result.ok)
954
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
955
+ const claimed = result.claimed ?? [];
956
+ if (claimed.length === 0)
957
+ return { exitCode: 0, output: "No reviews written." };
958
+ const lines = claimed.map((c) => {
959
+ const score = c.rating === null ? "—" : `${c.rating}/5`;
960
+ return ` ${c.namespace.padEnd(28)} ${c.subject_pubkey.slice(0, 16)}… ${score.padEnd(4)} ${c.outcome.padEnd(8)} ${c.submission_id.slice(0, 16)}…`;
961
+ });
962
+ const note = result.results_unavailable ? `\n\n Outcomes could not be read now (${result.results_unavailable}); they show 'pending'. Nothing is lost.` : "";
963
+ return { exitCode: 0, output: lines.join("\n") + note };
964
+ }
965
+ catch (err) {
966
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
967
+ }
968
+ }
969
+ // M10E 007-NOTICES — file a service-received claim for a session that earned no right.
970
+ if (sub === "claim-service") {
971
+ const [sessionId, ns] = args;
972
+ if (!sessionId || !ns) {
973
+ return { exitCode: 1, output: "Usage: cello attestations claim-service <session-id> <namespace>" };
974
+ }
975
+ try {
976
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_claim_service", { session_id: sessionId, namespace: ns })));
977
+ if (!result.ok)
978
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
979
+ return { exitCode: 0, output: result.guidance ?? "Claim filed." };
980
+ }
981
+ catch (err) {
982
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
983
+ }
984
+ }
985
+ // M10E 015-READ — a buyer reads a namespace's summary from a MAJORITY of directories.
986
+ // cello attestations summary <owner> <namespace>
987
+ if (sub === "summary") {
988
+ const [owner, ns] = args;
989
+ if (!owner || !ns)
990
+ return { exitCode: 1, output: "Usage: cello attestations summary <owner-pubkey> <namespace>" };
991
+ try {
992
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_summary", { owner_pubkey: owner, namespace: ns })));
993
+ if (!result.ok)
994
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
995
+ const avg = result.average_rating === null || result.average_rating === undefined ? "—" : result.average_rating.toFixed(2);
996
+ return { exitCode: 0, output: ` ${ns}\n reviews: ${result.count ?? 0}\n average rating: ${avg}\n removed by ruling: ${result.removed_count ?? 0}\n unmarked claims: ${result.unmarked_claims ?? 0}\n directories agreed: ${result.agreed ?? 0} of ${result.validators ?? 0}` };
997
+ }
998
+ catch (err) {
999
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
1000
+ }
1001
+ }
1002
+ // M10E 015-READ — the reviews themselves, each verified against the majority root.
1003
+ // cello attestations reviews <owner> <namespace>
1004
+ if (sub === "reviews") {
1005
+ const [owner, ns] = args;
1006
+ if (!owner || !ns)
1007
+ return { exitCode: 1, output: "Usage: cello attestations reviews <owner-pubkey> <namespace>" };
1008
+ try {
1009
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_reviews", { owner_pubkey: owner, namespace: ns })));
1010
+ if (!result.ok)
1011
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
1012
+ const reviews = result.reviews ?? [];
1013
+ const removed = result.removed ?? [];
1014
+ // Review text is quoted, untrusted data — shown indented under a label, never as a bare line
1015
+ // that could read as an instruction.
1016
+ const body = reviews.length === 0 ? "No reviews." : reviews.map((r) => {
1017
+ const score = r.rating === null ? "—" : `${r.rating}/5`;
1018
+ return ` [${r.index}] ${score} review (quoted, untrusted):\n ${r.quoted_text.replace(/\n/g, "\n ")}`;
1019
+ }).join("\n");
1020
+ const removedBlock = removed.length === 0 ? "" : "\n\n Removed by ruling:\n" + removed.map((rm) => ` ${rm.attestation_hash.slice(0, 16)}… reason: ${rm.reason}`).join("\n");
1021
+ return { exitCode: 0, output: ` ${ns} — ${result.count ?? 0} verified, ${result.agreed ?? 0} directories agreed\n${body}${removedBlock}` };
1022
+ }
1023
+ catch (err) {
1024
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
1025
+ }
1026
+ }
1027
+ // M10E 015-READ — a channel's deals and average rating, read from the home directory.
1028
+ // cello attestations deals <channel-pubkey>
1029
+ if (sub === "deals") {
1030
+ const [channel] = args;
1031
+ if (!channel)
1032
+ return { exitCode: 1, output: "Usage: cello attestations deals <channel-pubkey>" };
1033
+ try {
1034
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_deals", { channel_pubkey: channel })));
1035
+ if (!result.ok)
1036
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
1037
+ const avg = result.average_rating === null || result.average_rating === undefined ? "—" : result.average_rating.toFixed(2);
1038
+ return { exitCode: 0, output: ` channel ${channel.slice(0, 16)}…\n deals: ${result.deals ?? 0}\n average rating: ${avg}` };
1039
+ }
1040
+ catch (err) {
1041
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
1042
+ }
1043
+ }
1044
+ // M10E 015-READ — the judge's client: build, sign and submit a removal ruling to every node.
1045
+ // cello attestations rule <attestation-hash> --owner <pubkey> --namespace <ns> --reason <text> [--evidence <hash>…]
1046
+ if (sub === "rule") {
1047
+ const [attHash, ...rest] = args;
1048
+ let owner;
1049
+ let ns;
1050
+ let reason;
1051
+ const evidence = [];
1052
+ for (let i = 0; i < rest.length; i++) {
1053
+ if (rest[i] === "--owner")
1054
+ owner = rest[++i];
1055
+ else if (rest[i] === "--namespace")
1056
+ ns = rest[++i];
1057
+ else if (rest[i] === "--reason")
1058
+ reason = rest[++i];
1059
+ else if (rest[i] === "--evidence") {
1060
+ const h = rest[++i];
1061
+ if (h)
1062
+ evidence.push(h);
1063
+ }
1064
+ }
1065
+ if (!attHash || !owner || !ns || !reason) {
1066
+ return { exitCode: 1, output: "Usage: cello attestations rule <attestation-hash> --owner <pubkey> --namespace <ns> --reason <text> [--evidence <hash>…]" };
1067
+ }
1068
+ try {
1069
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_rule", { attestation_hash: attHash, owner_pubkey: owner, namespace: ns, reason, evidence_hashes: evidence })));
1070
+ if (!result.ok)
1071
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
1072
+ const rows = (result.results ?? []).map((n) => ` ${n.node_id.padEnd(16)} ${n.error ? `error: ${n.error}` : `countersigns: ${n.countersigns ?? 0}${n.in_force ? " (in force)" : ""}`}`).join("\n");
1073
+ return { exitCode: 0, output: ` ${rows}\n\n ${result.guidance ?? ""}`.trimEnd() };
1074
+ }
1075
+ catch (err) {
1076
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
1077
+ }
1078
+ }
1079
+ // M10E 007-NOTICES — the public activity counts for an owner's namespace.
1080
+ if (sub === "activity") {
1081
+ const [owner, ns] = args;
1082
+ if (!owner || !ns) {
1083
+ return { exitCode: 1, output: "Usage: cello attestations activity <pubkey> <namespace>" };
1084
+ }
1085
+ try {
1086
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_activity", { owner_pubkey: owner, namespace: ns })));
1087
+ if (!result.ok)
1088
+ return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
1089
+ return { exitCode: 0, output: ` ${ns}\n service events: ${result.service_events ?? 0}\n unmarked claims: ${result.unmarked_claims ?? 0}` };
1090
+ }
1091
+ catch (err) {
1092
+ return { exitCode: 1, output: `Could not reach the daemon: ${err instanceof Error ? err.message : String(err)}` };
1093
+ }
1094
+ }
1095
+ return {
1096
+ exitCode: 1,
1097
+ output: "Usage:\n" +
1098
+ " cello attestations namespace create <ns> … — open a review namespace\n" +
1099
+ " cello attestations namespace close <ns> — stop a namespace granting new rights\n" +
1100
+ " cello attestations index [<pubkey>] — list an owner's namespaces\n" +
1101
+ " cello attestations mark <session-id> <ns> — mark a service event during a session\n" +
1102
+ " cello attestations rights — the rights to review that you hold\n" +
1103
+ " cello attestations write <right-id> -- <text> — write a review for a right you hold\n" +
1104
+ " cello attestations written — the reviews you have written, with outcomes\n" +
1105
+ " cello attestations claim-service <sid> <ns> — claim a dodged service event (no right)\n" +
1106
+ " cello attestations activity <pubkey> <ns> — service-event and unmarked-claim counts\n" +
1107
+ " cello attestations summary <owner> <ns> — a namespace's review summary, from a majority of directories\n" +
1108
+ " cello attestations reviews <owner> <ns> — the reviews, each verified against the majority root\n" +
1109
+ " cello attestations deals <channel> — the deals a channel is credited with\n" +
1110
+ " cello attestations rule <att-hash> --owner <pk> --namespace <ns> --reason <text> — a judge removes a false review\n" +
1111
+ "\n" +
1112
+ "To vouch for another agent in your own words, that is 'cello endorsements' (008-ENDRENAME).",
1113
+ };
1114
+ }
1115
+ /**
1116
+ * `cello endorsements` — YOUR words about ANOTHER agent, and what became of them (008-ENDRENAME).
1117
+ *
1118
+ * Split from `cello attestations` so the two systems stop sharing a word. `cello attestations` is
1119
+ * the M10E review system, where nothing can be refused; an ENDORSEMENT is a PERSON vouching for a
1120
+ * PERSON, which the subject accepts or refuses. The receiving direction is `cello endorsement-consent`.
716
1121
  *
717
1122
  * Subcommands:
718
- * issue <pubkey> <text…> — attest to something you have seen them do
1123
+ * issue <pubkey> <text…> — vouch for something you have seen them do
719
1124
  * issued — what happened to the ones you wrote
720
- *
721
- * The receiving direction — what others wrote about YOU — is `cello attestation-consent`.
722
1125
  */
723
- export async function attestations(celloDir, sub, args) {
1126
+ export async function endorsements(celloDir, sub, args) {
724
1127
  const lockFilePath = join(celloDir, "daemon.lock");
725
1128
  const lock = await readLock(lockFilePath);
726
1129
  if (!lock) {
@@ -812,18 +1215,18 @@ export async function attestations(celloDir, sub, args) {
812
1215
  if (!subject || body.length === 0) {
813
1216
  return {
814
1217
  exitCode: 1,
815
- output: "Usage: cello attestations issue <subject-pubkey> <what you are endorsing them for…>\n" +
1218
+ output: "Usage: cello endorsements issue <subject-pubkey> <what you are endorsing them for…>\n" +
816
1219
  "\n" +
817
1220
  "The text: MAXIMUM 500 CHARACTERS — a testimonial, not a document. Line breaks are fine;\n" +
818
1221
  "no other control characters, and no < or >.\n" +
819
1222
  "\n" +
820
1223
  "If your text contains something that looks like a flag (a leading '-', or '-h'), put `--`\n" +
821
1224
  "before it so it is read as text:\n" +
822
- " cello attestations issue <pubkey> -- cut p99 by -30ms on the auth path",
1225
+ " cello endorsements issue <pubkey> -- cut p99 by -30ms on the auth path",
823
1226
  };
824
1227
  }
825
1228
  try {
826
- const result = (await withIpc(lock.socketPath, (client) => client.send("cello_attestations_issue", { subject_pubkey: subject, body })));
1229
+ const result = (await withIpc(lock.socketPath, (client) => client.send("cello_endorsements_issue", { subject_pubkey: subject, body })));
827
1230
  if (!result.ok) {
828
1231
  return { exitCode: 1, output: `${result.reason}\n${result.guidance ?? ""}`.trim() };
829
1232
  }
@@ -836,10 +1239,10 @@ export async function attestations(celloDir, sub, args) {
836
1239
  return {
837
1240
  exitCode: 1,
838
1241
  output: "Usage:\n" +
839
- " cello attestations issue <pubkey> <text…> — attest to something you have seen them do\n" +
840
- " cello attestations issued — what happened to the ones you wrote\n" +
1242
+ " cello endorsements issue <pubkey> <text…> — vouch for something you have seen them do\n" +
1243
+ " cello endorsements issued — what happened to the ones you wrote\n" +
841
1244
  "\n" +
842
- "What others wrote about YOU is 'cello attestation-consent'.",
1245
+ "What others wrote about YOU is 'cello endorsement-consent'.",
843
1246
  };
844
1247
  }
845
1248
  /**