@heyamiko/amiko-cli 0.9.9-beta.5 → 0.9.9-beta.6

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/index.js +57 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26283,8 +26283,29 @@ function registerImageCommand(program2) {
26283
26283
  console.error(error(`Unknown model "${opts.model}". Supported: ${SUPPORTED_MODELS.join(", ")}.`));
26284
26284
  process.exit(1);
26285
26285
  }
26286
+ const ALLOWED_SIZES = ["1024x1024", "1024x1536", "1536x1024"];
26287
+ const ALLOWED_QUALITIES = ["low", "medium", "high", "auto"];
26288
+ const ALLOWED_FORMATS = ["png", "webp", "jpeg"];
26289
+ const ALLOWED_BACKGROUNDS = ["transparent", "opaque", "auto"];
26290
+ if (!ALLOWED_SIZES.includes(opts.size)) {
26291
+ console.error(error(`Unknown --size "${opts.size}". Allowed: ${ALLOWED_SIZES.join(", ")}.`));
26292
+ process.exit(1);
26293
+ }
26294
+ if (!ALLOWED_QUALITIES.includes(opts.quality)) {
26295
+ console.error(error(`Unknown --quality "${opts.quality}". Allowed: ${ALLOWED_QUALITIES.join(", ")}.`));
26296
+ process.exit(1);
26297
+ }
26298
+ if (opts.format && !ALLOWED_FORMATS.includes(opts.format)) {
26299
+ console.error(error(`Unknown --format "${opts.format}". Allowed: ${ALLOWED_FORMATS.join(", ")}.`));
26300
+ process.exit(1);
26301
+ }
26302
+ if (opts.background && !ALLOWED_BACKGROUNDS.includes(opts.background)) {
26303
+ console.error(error(`Unknown --background "${opts.background}". Allowed: ${ALLOWED_BACKGROUNDS.join(", ")}.`));
26304
+ process.exit(1);
26305
+ }
26306
+ const billedQuality = opts.quality === "auto" ? "high" : opts.quality;
26286
26307
  const n = Math.max(1, Math.min(Math.floor(Number(opts.n) || 1), 4));
26287
- const usdCost = computeImageUsd(opts.model, opts.quality, opts.size, n);
26308
+ const usdCost = computeImageUsd(opts.model, billedQuality, opts.size, n);
26288
26309
  let auth;
26289
26310
  try {
26290
26311
  auth = requireAuth();
@@ -27372,6 +27393,17 @@ function registerAvatarCommand(program2) {
27372
27393
  // src/lib/mpp-friend-report.ts
27373
27394
  var AMIKO_TREASURY = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
27374
27395
  var PRICE_USD = "0.10";
27396
+ async function quoteFriendReport(auth) {
27397
+ const amikoUsd = await getTokenUsdPrice(auth, "AMIKO");
27398
+ if (!amikoUsd || amikoUsd <= 0) {
27399
+ return { error: "Failed to fetch AMIKO/USD price" };
27400
+ }
27401
+ return {
27402
+ amikoAmount: (Number(PRICE_USD) / amikoUsd).toFixed(6),
27403
+ amikoUsd,
27404
+ usdAnchor: PRICE_USD
27405
+ };
27406
+ }
27375
27407
  async function mppFriendReportGenerate(auth, body, opts = {}) {
27376
27408
  const config2 = loadConfig();
27377
27409
  const mppBase2 = config2.apiBase.replace(/\/$/, "");
@@ -27407,7 +27439,8 @@ async function mppFriendReportGenerate(auth, body, opts = {}) {
27407
27439
  body: {
27408
27440
  to: AMIKO_TREASURY,
27409
27441
  amount: amikoAmount,
27410
- token: "AMIKO"
27442
+ token: "AMIKO",
27443
+ chain: "solana"
27411
27444
  }
27412
27445
  });
27413
27446
  const candidate = transferData.txHash ?? transferData.tx_hash ?? transferData.signature;
@@ -27480,8 +27513,10 @@ async function runPaidRegenerate(args) {
27480
27513
  console.error(error("Paid regenerate requires your user id. Add 'amikoUserId' to your .amiko.json (alongside amikoTwinToken/amikoTwinId)."));
27481
27514
  process.exit(1);
27482
27515
  }
27516
+ const quote = await quoteFriendReport(auth);
27517
+ const priceLine = "error" in quote ? "(price oracle down — actual amount computed at server)" : `${quote.amikoAmount} AMIKO ≈ $${quote.usdAnchor} (1 AMIKO = $${quote.amikoUsd.toFixed(4)})`;
27483
27518
  await confirmDestructive({
27484
- action: `Pay AMIKO to regenerate a ${args.type} matching report with user ${args.id} (~$0.10 USD-equivalent in AMIKO; signed by your agent's wallet via amiko-web)`,
27519
+ action: `Pay ${priceLine} to regenerate a ${args.type} matching report with user ${args.id} (signed by your agent's wallet via amiko-web)`,
27485
27520
  yes: args.yes,
27486
27521
  commandExample: `amiko friends reports request --id ${args.id} --type ${args.type} --pay`
27487
27522
  });
@@ -27671,6 +27706,7 @@ Accept with: amiko friends accept <friendshipId>`));
27671
27706
  const reports = program2.command("reports").description("Friend matching reports");
27672
27707
  reports.command("list").description("List friend matching reports").option("--page <n>", "Page number", "1").option("--limit <n>", "Page size (1-50)", "20").option("--json", "Output as JSON").action(async (opts) => {
27673
27708
  const auth = resolveAuth();
27709
+ const meId = (auth.userId ?? "").replace(/^did:privy:/, "");
27674
27710
  const spinner = opts.json ? null : ora("Loading reports...").start();
27675
27711
  try {
27676
27712
  const data = await amikoWebFetch(auth, "/api/friends/reports", {
@@ -27694,7 +27730,7 @@ Accept with: amiko friends accept <friendshipId>`));
27694
27730
  dim("CREATED")
27695
27731
  ],
27696
27732
  ...items.map((r) => {
27697
- const other = r.respondent ?? r.initiator;
27733
+ const other = r.initiator?.id === meId ? r.respondent : r.respondent?.id === meId ? r.initiator : r.respondent ?? r.initiator;
27698
27734
  return [
27699
27735
  r.id,
27700
27736
  r.report_type ?? "-",
@@ -27715,6 +27751,7 @@ Accept with: amiko friends accept <friendshipId>`));
27715
27751
  });
27716
27752
  reports.command("view <id>").description("View a friend matching report").option("--json", "Output as JSON").action(async (id, opts) => {
27717
27753
  const auth = resolveAuth();
27754
+ const meId = (auth.userId ?? "").replace(/^did:privy:/, "");
27718
27755
  const spinner = opts.json ? null : ora("Loading report...").start();
27719
27756
  try {
27720
27757
  const data = await amikoWebFetch(auth, `/api/friends/reports/${encodeURIComponent(id)}`);
@@ -27726,7 +27763,7 @@ Accept with: amiko friends accept <friendshipId>`));
27726
27763
  console.log(label("Type", r.report_type));
27727
27764
  if (r.status)
27728
27765
  console.log(label("Status", r.status));
27729
- const other = r.respondent ?? r.initiator;
27766
+ const other = r.initiator?.id === meId ? r.respondent : r.respondent?.id === meId ? r.initiator : r.respondent ?? r.initiator;
27730
27767
  if (other)
27731
27768
  console.log(label("With", other.name ?? other.handle ?? other.id));
27732
27769
  if (r.created_at)
@@ -28599,8 +28636,12 @@ function registerNotificationsCommand(program2) {
28599
28636
  }
28600
28637
 
28601
28638
  // src/commands/memory.ts
28602
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2, statSync } from "node:fs";
28603
- import { dirname, isAbsolute, normalize, resolve as resolve2 } from "node:path";
28639
+ import { existsSync as existsSync3, lstatSync, readdirSync, readFileSync as readFileSync2, statSync } from "node:fs";
28640
+ import { dirname, isAbsolute, normalize, relative, resolve as resolve2 } from "node:path";
28641
+ function isInsideRoot(abs, root) {
28642
+ const rel = relative(root, abs);
28643
+ return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
28644
+ }
28604
28645
  var VALID_CATEGORIES = ["fact", "preference", "pattern", "decision", "context"];
28605
28646
  var VALID_SOURCES = ["chat", "file", "manual"];
28606
28647
  var DEFAULT_WORKSPACE = "/data/.openclaw/workspace";
@@ -28878,7 +28919,7 @@ function collectMemoryFiles(root, indexPaths, memoryDir) {
28878
28919
  if (isExternal(ref))
28879
28920
  continue;
28880
28921
  const abs = normalize(isAbsolute(ref) ? ref : resolve2(indexDir, ref));
28881
- if (!abs.startsWith(root)) {
28922
+ if (!isInsideRoot(abs, root)) {
28882
28923
  errors3.push(`Skipping ${ref}: outside workspace ${root}`);
28883
28924
  continue;
28884
28925
  }
@@ -28886,7 +28927,11 @@ function collectMemoryFiles(root, indexPaths, memoryDir) {
28886
28927
  errors3.push(`Referenced file missing: ${ref}`);
28887
28928
  continue;
28888
28929
  }
28889
- const st = statSync(abs);
28930
+ const st = lstatSync(abs);
28931
+ if (st.isSymbolicLink()) {
28932
+ errors3.push(`Skipping ${ref}: symlinks not followed`);
28933
+ continue;
28934
+ }
28890
28935
  if (!st.isFile())
28891
28936
  continue;
28892
28937
  const content = safeRead(abs, errors3);
@@ -28918,10 +28963,12 @@ function walkMarkdown(dir, errors3) {
28918
28963
  const abs = resolve2(dir, name);
28919
28964
  let st;
28920
28965
  try {
28921
- st = statSync(abs);
28966
+ st = lstatSync(abs);
28922
28967
  } catch {
28923
28968
  continue;
28924
28969
  }
28970
+ if (st.isSymbolicLink())
28971
+ continue;
28925
28972
  if (st.isDirectory()) {
28926
28973
  out.push(...walkMarkdown(abs, errors3));
28927
28974
  } else if (st.isFile() && name.toLowerCase().endsWith(".md")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.9.9-beta.5",
3
+ "version": "0.9.9-beta.6",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {