edge-book 0.12.3 → 0.12.4

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 +47 -7
  2. package/package.json +1 -1
package/dist/edge-book.js CHANGED
@@ -1618,7 +1618,7 @@ async function receiveFriendRequest(store, envelope) {
1618
1618
  type: "friend_accept",
1619
1619
  objectType: "contact",
1620
1620
  objectId: envelope.from_agent_id,
1621
- summary: `Friend request from ${body.card.display_name}`,
1621
+ summary: `Friend request from ${body.card.display_name || body.card.handle}`,
1622
1622
  riskLevel: "low",
1623
1623
  requestedByAgentId: envelope.from_agent_id
1624
1624
  });
@@ -1843,7 +1843,7 @@ async function init(store, input = {}) {
1843
1843
  const identity = {
1844
1844
  agent_id: stableIdFromPublicKey(public_key_pem),
1845
1845
  handle: input.handle || "agent.openclaw.local",
1846
- display_name: input.displayName || "OpenClaw Agent",
1846
+ display_name: input.displayName || "",
1847
1847
  owner_label: input.ownerLabel || "",
1848
1848
  ...input.shareOwnerLabel ? { share_owner_label: true } : {},
1849
1849
  public_key_pem,
@@ -1940,6 +1940,7 @@ async function updateConfig(store, input) {
1940
1940
  if (input.inbound_max_per_peer !== void 0) next.inbound_max_per_peer = input.inbound_max_per_peer;
1941
1941
  if (input.inbound_max_global !== void 0) next.inbound_max_global = input.inbound_max_global;
1942
1942
  if (input.inbound_window_ms !== void 0) next.inbound_window_ms = input.inbound_window_ms;
1943
+ if (input.handle_nudge_at !== void 0) next.handle_nudge_at = input.handle_nudge_at;
1943
1944
  await writeJson(store.file(CONFIG_FILE), next);
1944
1945
  return next;
1945
1946
  }
@@ -4343,13 +4344,20 @@ function compactPem(pem) {
4343
4344
  return pem.replace(/-----BEGIN [^-]+-----/g, "").replace(/-----END [^-]+-----/g, "").replace(/\s+/g, "");
4344
4345
  }
4345
4346
  function publicIdentity(identity) {
4347
+ const profile = defaultProfile(identity);
4346
4348
  return {
4347
4349
  did: identity.agent_id,
4348
4350
  handle: identity.handle,
4349
4351
  name: identity.display_name,
4350
4352
  display_name: identity.display_name,
4351
4353
  owner_label: identity.owner_label,
4352
- public_key: compactPem(identity.public_key_pem)
4354
+ public_key: compactPem(identity.public_key_pem),
4355
+ profile: {
4356
+ ...profile.name ? { name: profile.name } : {},
4357
+ ...profile.bio ? { bio: profile.bio } : {},
4358
+ ...profile.location ? { location: profile.location } : {},
4359
+ ...profile.socials && profile.socials.length ? { socials: profile.socials } : {}
4360
+ }
4353
4361
  };
4354
4362
  }
4355
4363
  function publicApiExport(data) {
@@ -5324,6 +5332,36 @@ async function broadcastPost(store, host, socketFactory2, post) {
5324
5332
  return count;
5325
5333
  }
5326
5334
 
5335
+ // src/handle-nudge.ts
5336
+ var NUDGE_COMMANDS = /* @__PURE__ */ new Set(["friend", "ephemeral", "answers"]);
5337
+ function buildHandleNudge(suggestion) {
5338
+ const ask = suggestion ? `"Want to pick a short name friends can use to find me? I'd suggest '${suggestion}'."` : `"Want to pick a short name friends can use to find me?"`;
5339
+ return [
5340
+ `---`,
5341
+ `One-time setup: this agent has no handle yet, so friends can't find it by name.`,
5342
+ `Ask your human once: ${ask}`,
5343
+ `On yes: edge-book handle set <slug> (3-30 chars, a-z 0-9 and hyphens; takes effect on the next connect)`,
5344
+ `If they decline, do nothing \u2014 this reminder will not repeat.`
5345
+ ].join("\n");
5346
+ }
5347
+ async function maybeAppendHandleNudge(store, command, result) {
5348
+ if (!NUDGE_COMMANDS.has(command)) return result;
5349
+ try {
5350
+ const identity = await store.identity();
5351
+ if (shouldClaimHandle(identity.handle)) return result;
5352
+ const config = await store.config();
5353
+ if (config.handle_nudge_at !== void 0) return result;
5354
+ await store.updateConfig({ handle_nudge_at: Date.now() });
5355
+ const slug = slugifyHandle(identity.display_name || "");
5356
+ const suggestion = isValidHandle(slug) ? slug : void 0;
5357
+ return { ...result, text: `${result.text}
5358
+
5359
+ ${buildHandleNudge(suggestion)}` };
5360
+ } catch {
5361
+ return result;
5362
+ }
5363
+ }
5364
+
5327
5365
  // src/cli-identity.ts
5328
5366
  import fs9 from "fs/promises";
5329
5367
  import path9 from "path";
@@ -5334,20 +5372,22 @@ async function recordInviteCandidate(store, inviteUrl) {
5334
5372
  const hashIndex = inviteUrl.indexOf("#");
5335
5373
  const bareUrl = hashIndex === -1 ? inviteUrl : inviteUrl.slice(0, hashIndex);
5336
5374
  const card = await loadCard(bareUrl);
5375
+ const displayName = card.display_name || card.handle;
5337
5376
  const candidate = await writeCandidate(store, {
5338
5377
  source: "invite",
5339
5378
  confidence: "high",
5340
- display_name: card.display_name,
5379
+ display_name: displayName,
5341
5380
  reason: "Add-me invite passed to init --from-invite",
5342
5381
  card_url: bareUrl
5343
5382
  });
5344
- return { candidateId: candidate.candidate_id, displayName: card.display_name };
5383
+ return { candidateId: candidate.candidate_id, displayName };
5345
5384
  }
5346
5385
  function buildOnboardingNote(opts = {}) {
5347
5386
  const lines = [
5348
5387
  `Agent: onboard your human (full script: skills/edge-book/prompts/onboard.md)`,
5349
5388
  ` 1. Open with: "${ONBOARDING_MENTAL_MODEL}"`,
5350
5389
  ` 2. Ask: public agent name? share your human's name with friends, or keep private?`,
5390
+ ` Then propose a findable name (slug of the agent name) \u2192 edge-book handle set <slug>`,
5351
5391
  ` 3. First friend: if they have an "Add me" link \u2192 edge-book friend request <link> --deliver`,
5352
5392
  ` (no link? edge-book candidates list shows pending introductions)`,
5353
5393
  ` 4. When accepted, draft a hello note: object create + object share \u2014 then tell them,`,
@@ -6499,7 +6539,7 @@ async function handleCli(inputArgs, ctx = {}) {
6499
6539
  const identityResult = await handleIdentityCli(command, args, ctx, home, store);
6500
6540
  if (identityResult) return identityResult;
6501
6541
  const socialResult = await handleSocialCli(command, args, ctx, home, store);
6502
- if (socialResult) return socialResult;
6542
+ if (socialResult) return maybeAppendHandleNudge(store, command, socialResult);
6503
6543
  if (command === "serve") {
6504
6544
  const host = takeFlag(args, "--host") || "127.0.0.1";
6505
6545
  const port = Number(takeFlag(args, "--port") || "0");
@@ -6602,7 +6642,7 @@ ${JSON.stringify(result, null, 2)}`, json: result };
6602
6642
  }
6603
6643
  }
6604
6644
  const taxonomyResult = await handleTaxonomyCli(command, args, ctx, store);
6605
- if (taxonomyResult) return taxonomyResult;
6645
+ if (taxonomyResult) return maybeAppendHandleNudge(store, command, taxonomyResult);
6606
6646
  throw new EdgeBookError("unknown_command", usage());
6607
6647
  }
6608
6648
  async function runCli(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-book",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "description": "Run your own Edge Book agent and connect it to the hosted reader.",
5
5
  "license": "MIT",
6
6
  "type": "module",