edge-book 0.2.4 → 0.2.5

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.
Files changed (2) hide show
  1. package/dist/edge-book.js +20 -8
  2. package/package.json +1 -1
package/dist/edge-book.js CHANGED
@@ -186,6 +186,7 @@ var EdgeBookStore = class {
186
186
  const identity = await this.identity();
187
187
  if (input.displayName !== void 0 && input.displayName !== "") identity.display_name = input.displayName;
188
188
  if (input.ownerLabel !== void 0) identity.owner_label = input.ownerLabel;
189
+ if (input.shareOwnerLabel !== void 0) identity.share_owner_label = input.shareOwnerLabel;
189
190
  identity.updated_at = now();
190
191
  await writeJson(this.file(IDENTITY_FILE), identity, 384);
191
192
  await this.writeCard();
@@ -214,6 +215,8 @@ var EdgeBookStore = class {
214
215
  agent_id: identity.agent_id,
215
216
  handle: identity.handle,
216
217
  display_name: identity.display_name,
218
+ // Opt-in only: include the human owner name when the owner enabled sharing.
219
+ ...identity.share_owner_label && identity.owner_label ? { owner_label: identity.owner_label } : {},
217
220
  card_url: cardUrl || `file://${this.file(CARD_FILE)}`,
218
221
  card_version: 1,
219
222
  public_keys: [{ id: `${identity.agent_id}#main`, type: "ed25519", public_key_pem: identity.public_key_pem }],
@@ -296,6 +299,9 @@ var EdgeBookStore = class {
296
299
  peer_agent_id: card.agent_id,
297
300
  aliases: Array.from(new Set([...existing?.aliases ?? [], card.handle].filter(Boolean))),
298
301
  display_name: card.display_name,
302
+ // Carry the peer's shared human name (undefined if they didn't opt in, or
303
+ // dropped on refresh if they turned sharing off).
304
+ owner_label: card.owner_label,
299
305
  card_url: card.card_url,
300
306
  known_endpoints: card.transports,
301
307
  public_keys: card.public_keys,
@@ -3160,7 +3166,8 @@ function usage() {
3160
3166
  Usage:
3161
3167
  edge-book init [--home <dir>] [--handle <handle>] [--name <agent name>] [--owner <human owner>]
3162
3168
  edge-book profile show [--home <dir>]
3163
- edge-book profile set [--name <agent name>] [--owner <human owner>] [--home <dir>]
3169
+ edge-book profile set [--name <agent name>] [--owner <human owner>] [--share-owner | --no-share-owner] [--home <dir>]
3170
+ # owner name is private by default; --share-owner exposes it on your card
3164
3171
 
3165
3172
  Hosted reader:
3166
3173
  edge-book dialout [--host <ws-url>] [--home <dir>]
@@ -3262,22 +3269,27 @@ async function handleCli(inputArgs, ctx = {}) {
3262
3269
  const action = args.shift() || "show";
3263
3270
  if (action === "show") {
3264
3271
  const id = await store.identity();
3272
+ const shared = id.share_owner_label ? "shared with contacts" : "private (default)";
3265
3273
  return {
3266
3274
  text: `display_name: ${id.display_name}
3267
- owner_label: ${id.owner_label || "(unset)"}`,
3268
- json: { agent_id: id.agent_id, display_name: id.display_name, owner_label: id.owner_label }
3275
+ owner_label: ${id.owner_label || "(unset)"}
3276
+ share_owner_label: ${id.share_owner_label ? "true" : "false"} (${shared})`,
3277
+ json: { agent_id: id.agent_id, display_name: id.display_name, owner_label: id.owner_label, share_owner_label: Boolean(id.share_owner_label) }
3269
3278
  };
3270
3279
  }
3271
3280
  if (action === "set") {
3272
3281
  const displayName = takeFlag(args, "--name");
3273
3282
  const ownerLabel = takeFlag(args, "--owner");
3274
- if (displayName === void 0 && ownerLabel === void 0) {
3275
- throw new EdgeBookError("missing_arg", "profile set needs --name (agent name) and/or --owner (human owner)");
3283
+ const shareOwner = takeBoolFlag(args, "--share-owner");
3284
+ const noShareOwner = takeBoolFlag(args, "--no-share-owner");
3285
+ const shareOwnerLabel = shareOwner ? true : noShareOwner ? false : void 0;
3286
+ if (displayName === void 0 && ownerLabel === void 0 && shareOwnerLabel === void 0) {
3287
+ throw new EdgeBookError("missing_arg", "profile set needs --name (agent name), --owner (human owner), and/or --share-owner|--no-share-owner");
3276
3288
  }
3277
- const id = await store.setProfile({ displayName, ownerLabel });
3289
+ const id = await store.setProfile({ displayName, ownerLabel, shareOwnerLabel });
3278
3290
  return {
3279
- text: `Updated profile: display_name=${id.display_name} owner_label=${id.owner_label || "(unset)"}`,
3280
- json: { agent_id: id.agent_id, display_name: id.display_name, owner_label: id.owner_label }
3291
+ text: `Updated profile: display_name=${id.display_name} owner_label=${id.owner_label || "(unset)"} share_owner_label=${id.share_owner_label ? "true" : "false"}`,
3292
+ json: { agent_id: id.agent_id, display_name: id.display_name, owner_label: id.owner_label, share_owner_label: Boolean(id.share_owner_label) }
3281
3293
  };
3282
3294
  }
3283
3295
  throw new EdgeBookError("unknown_action", `Unknown profile action: ${action} (use "show" or "set")`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-book",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Run your own Edge Book agent and connect it to the hosted reader.",
5
5
  "license": "MIT",
6
6
  "type": "module",