@heyanon-arp/cli 0.0.9 → 0.0.11

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/cli.js CHANGED
@@ -246,10 +246,11 @@ function parseSseRecord(record) {
246
246
  }
247
247
  return id !== void 0 ? { type, data, id } : { type, data };
248
248
  }
249
- var import_sdk, DEFAULT_SERVER_URL, ApiError, ArpApiClient;
249
+ var import_sdk, import_shield, DEFAULT_SERVER_URL, ApiError, ArpApiClient;
250
250
  var init_api = __esm({
251
251
  "src/api.ts"() {
252
252
  import_sdk = require("@heyanon-arp/sdk");
253
+ import_shield = require("@heyanon-arp/shield");
253
254
  init_config();
254
255
  DEFAULT_SERVER_URL = "https://api.heyanon.ai/arp";
255
256
  ApiError = class extends Error {
@@ -382,7 +383,14 @@ var init_api = __esm({
382
383
  const record = buffer.slice(0, recordEnd);
383
384
  buffer = buffer.slice(recordEnd + 2);
384
385
  const event = parseSseRecord(record);
385
- if (event !== null) yield event;
386
+ if (event !== null) {
387
+ if (event.type === "envelope" && event.data !== null && typeof event.data === "object") {
388
+ const guarded = await (0, import_shield.guardInboundEvent)(event.data, { selfDid: did });
389
+ yield { ...event, data: guarded.event };
390
+ } else {
391
+ yield event;
392
+ }
393
+ }
386
394
  recordEnd = buffer.indexOf("\n\n");
387
395
  }
388
396
  }
@@ -441,13 +449,14 @@ var init_api = __esm({
441
449
  * walks FORWARD from a watermark (polling-worker pattern).
442
450
  */
443
451
  async listInbox(did, signer, query) {
444
- return this.signedRequest(
452
+ const events = await this.signedRequest(
445
453
  "GET",
446
454
  `/v1/agents/${encodeURIComponent(did)}/inbox`,
447
455
  null,
448
456
  signer,
449
457
  query
450
458
  );
459
+ return (0, import_shield.guardInboundBatch)(events, { selfDid: did });
451
460
  }
452
461
  /**
453
462
  * Signed `GET /v1/agents/:did/events/:eventId`. Direct envelope
@@ -461,7 +470,8 @@ var init_api = __esm({
461
470
  * not-a-member-of-pair.
462
471
  */
463
472
  async getEvent(did, eventId, signer) {
464
- return this.signedRequest("GET", `/v1/agents/${encodeURIComponent(did)}/events/${encodeURIComponent(eventId)}`, null, signer);
473
+ const event = await this.signedRequest("GET", `/v1/agents/${encodeURIComponent(did)}/events/${encodeURIComponent(eventId)}`, null, signer);
474
+ return (await (0, import_shield.guardInboundEvent)(event, { selfDid: did })).event;
465
475
  }
466
476
  /**
467
477
  * Signed `GET /v1/relationships/:id/events`. Returns the canonical
@@ -469,13 +479,14 @@ var init_api = __esm({
469
479
  * one of the relationship pair.
470
480
  */
471
481
  async listEvents(relationshipId, signer, query) {
472
- return this.signedRequest(
482
+ const events = await this.signedRequest(
473
483
  "GET",
474
484
  `/v1/relationships/${encodeURIComponent(relationshipId)}/events`,
475
485
  null,
476
486
  signer,
477
487
  query
478
488
  );
489
+ return (0, import_shield.guardInboundBatch)(events, { selfDid: signer.did });
479
490
  }
480
491
  /**
481
492
  * Signed `GET /v1/relationships/:id/delegations`. One row per
@@ -643,6 +654,22 @@ function formatGenericError(err, verbose = false) {
643
654
  return `${import_chalk.default.red("Error")} ${message}
644
655
  ${import_chalk.default.gray(err.stack)}`;
645
656
  }
657
+ function onboardingHelpFooter() {
658
+ return [
659
+ "",
660
+ "New here? The guides ship inside the CLI \u2014 read them first, no docs site needed:",
661
+ ` ${import_chalk.default.cyan("heyarp guide")} ${import_chalk.default.dim("role-based walkthrough (worker / buyer)")}`,
662
+ ` ${import_chalk.default.cyan("heyarp guide --setup")} ${import_chalk.default.dim("one-time setup: keys, server, multi-agent isolation")}`,
663
+ ` ${import_chalk.default.cyan("heyarp guide --troubleshoot")} ${import_chalk.default.dim("common errors \u2192 fixes")}`,
664
+ "",
665
+ `${import_chalk.default.bold("Driving heyarp from an AI agent?")} Pipe YOUR role's guide into its system prompt`,
666
+ import_chalk.default.dim("(role is per-deal: BUYER if you send the offer + pay; WORKER if an offer comes to you):"),
667
+ ` ${import_chalk.default.cyan("heyarp guide --role worker --format prompt")} ${import_chalk.default.dim("# you do tasks, get paid")}`,
668
+ ` ${import_chalk.default.cyan("heyarp guide --role buyer --format prompt")} ${import_chalk.default.dim("# you order tasks, pay")}`,
669
+ "",
670
+ `${import_chalk.default.dim("Then:")} ${import_chalk.default.cyan("heyarp register")} ${import_chalk.default.dim("\u2192 handshake \u2192 delegation \u2192 work \u2192 receipt \u2192 settlement.")}`
671
+ ].join("\n");
672
+ }
646
673
  function toCliErrorJson(err, includeStack = false) {
647
674
  const { ApiError: ApiError2 } = (init_api(), __toCommonJS(api_exports));
648
675
  if (err instanceof ApiError2) {
@@ -5022,14 +5049,14 @@ var init_receipt = __esm({
5022
5049
  });
5023
5050
 
5024
5051
  // src/cli.ts
5025
- var import_shield = require("@heyanon-arp/shield");
5052
+ var import_shield2 = require("@heyanon-arp/shield");
5026
5053
  var import_commander = require("commander");
5027
5054
  var import_simple_update_notifier = __toESM(require("simple-update-notifier"));
5028
5055
 
5029
5056
  // package.json
5030
5057
  var package_default = {
5031
5058
  name: "@heyanon-arp/cli",
5032
- version: "0.0.9",
5059
+ version: "0.0.11",
5033
5060
  description: "Command-line client for the Agent Relationship Protocol \u2014 register agents, sign envelopes, run escrowed work cycles on Solana.",
5034
5061
  license: "MIT",
5035
5062
  keywords: ["arp", "agent-relationship-protocol", "did", "solana", "escrow", "ed25519", "agents", "a2a", "cli"],
@@ -5039,7 +5066,7 @@ var package_default = {
5039
5066
  publishConfig: {
5040
5067
  access: "public"
5041
5068
  },
5042
- files: ["dist", "scripts/postinstall.mjs", "LICENSE", "README.md"],
5069
+ files: ["dist", "LICENSE", "README.md"],
5043
5070
  engines: {
5044
5071
  node: ">=22"
5045
5072
  },
@@ -5049,8 +5076,7 @@ var package_default = {
5049
5076
  test: "jest --runInBand --detectOpenHandles --forceExit --passWithNoTests",
5050
5077
  lint: "biome check . --write",
5051
5078
  prepublishOnly: "pnpm run build",
5052
- prepare: "pnpm run build",
5053
- postinstall: "node scripts/postinstall.mjs"
5079
+ prepare: "pnpm run build"
5054
5080
  },
5055
5081
  dependencies: {
5056
5082
  "@heyanon-arp/sdk": "workspace:*",
@@ -8402,6 +8428,7 @@ async function main() {
8402
8428
  process.stderr.write(str);
8403
8429
  }
8404
8430
  });
8431
+ program.addHelpText("after", () => onboardingHelpFooter());
8405
8432
  registerConfigCommand(program);
8406
8433
  registerGuideCommand(program);
8407
8434
  registerHomesCommand(program);
@@ -8430,7 +8457,7 @@ async function main() {
8430
8457
  registerReceiptsCommand(program);
8431
8458
  registerWalletCommands(program);
8432
8459
  registerSettlementCommands(program);
8433
- (0, import_shield.installMiddleware)(program);
8460
+ (0, import_shield2.installMiddleware)(program);
8434
8461
  try {
8435
8462
  await program.parseAsync(process.argv);
8436
8463
  } catch (err) {