@heyanon-arp/cli 0.0.10 → 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
@@ -5038,14 +5049,14 @@ var init_receipt = __esm({
5038
5049
  });
5039
5050
 
5040
5051
  // src/cli.ts
5041
- var import_shield = require("@heyanon-arp/shield");
5052
+ var import_shield2 = require("@heyanon-arp/shield");
5042
5053
  var import_commander = require("commander");
5043
5054
  var import_simple_update_notifier = __toESM(require("simple-update-notifier"));
5044
5055
 
5045
5056
  // package.json
5046
5057
  var package_default = {
5047
5058
  name: "@heyanon-arp/cli",
5048
- version: "0.0.10",
5059
+ version: "0.0.11",
5049
5060
  description: "Command-line client for the Agent Relationship Protocol \u2014 register agents, sign envelopes, run escrowed work cycles on Solana.",
5050
5061
  license: "MIT",
5051
5062
  keywords: ["arp", "agent-relationship-protocol", "did", "solana", "escrow", "ed25519", "agents", "a2a", "cli"],
@@ -8446,7 +8457,7 @@ async function main() {
8446
8457
  registerReceiptsCommand(program);
8447
8458
  registerWalletCommands(program);
8448
8459
  registerSettlementCommands(program);
8449
- (0, import_shield.installMiddleware)(program);
8460
+ (0, import_shield2.installMiddleware)(program);
8450
8461
  try {
8451
8462
  await program.parseAsync(process.argv);
8452
8463
  } catch (err) {