@t2000/cli 10.30.1 → 10.30.2

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/index.js CHANGED
@@ -36442,6 +36442,46 @@ function summarizeSellerInbox(jobs, nowMs) {
36442
36442
  }
36443
36443
  return buckets;
36444
36444
  }
36445
+ var HYDRATE_MAX = 25;
36446
+ var HYDRATE_CONCURRENCY = 8;
36447
+ function mergeIndexedJobFromChain(row, chain) {
36448
+ return {
36449
+ ...row,
36450
+ jobId: chain.id ?? row.jobId,
36451
+ state: chain.state,
36452
+ buyer: chain.buyer ?? row.buyer,
36453
+ seller: chain.seller ?? row.seller,
36454
+ amountUsdc: chain.amountUsdc ?? row.amountUsdc,
36455
+ deliverByMs: chain.deliverByMs ?? row.deliverByMs,
36456
+ reviewWindowMs: chain.reviewWindowMs ?? row.reviewWindowMs,
36457
+ deliveryHash: chain.deliveryHash ?? row.deliveryHash,
36458
+ deliveredAtMs: chain.deliveredAtMs ?? row.deliveredAtMs ?? null,
36459
+ createdAtMs: chain.createdAtMs ?? row.createdAtMs,
36460
+ // Review clock prefers deliveredAtMs (reviewClosesMs anchors there when
36461
+ // set); for delivered rows keep updatedAtMs honest with the chain clock,
36462
+ // otherwise the index value stands — never invent a clock.
36463
+ updatedAtMs: chain.state === "delivered" && chain.deliveredAtMs != null ? chain.deliveredAtMs : row.updatedAtMs
36464
+ };
36465
+ }
36466
+ async function hydrateSellerJobsFromChain(rows, getJobById, opts) {
36467
+ const max = opts?.maxHydrate ?? HYDRATE_MAX;
36468
+ const out = [...rows];
36469
+ const targets = [];
36470
+ for (let i = 0; i < out.length && targets.length < max; i++) {
36471
+ if (!TERMINAL_STATES.has(out[i].state)) targets.push(i);
36472
+ }
36473
+ for (let at = 0; at < targets.length; at += HYDRATE_CONCURRENCY) {
36474
+ await Promise.all(
36475
+ targets.slice(at, at + HYDRATE_CONCURRENCY).map(async (i) => {
36476
+ try {
36477
+ out[i] = mergeIndexedJobFromChain(out[i], await getJobById(out[i].jobId));
36478
+ } catch {
36479
+ }
36480
+ })
36481
+ );
36482
+ }
36483
+ return out;
36484
+ }
36445
36485
  function inboxHint(job, bucket) {
36446
36486
  switch (bucket) {
36447
36487
  case "needsYou":
@@ -36906,7 +36946,9 @@ no fund step; unclaimed openings refund fee-free):
36906
36946
  if (opts.mine) {
36907
36947
  const base = opts.api ?? DEFAULT_API_BASE7;
36908
36948
  const seen = /* @__PURE__ */ new Map();
36909
- const jobs = await fetchSellerJobs(base, me);
36949
+ const mineClient = getSuiClient();
36950
+ const loadInbox = async () => hydrateSellerJobsFromChain(await fetchSellerJobs(base, me), (id) => getJob(mineClient, id));
36951
+ const jobs = await loadInbox();
36910
36952
  const inbox = summarizeSellerInbox(jobs, Date.now());
36911
36953
  if (isJsonMode()) {
36912
36954
  printJson({
@@ -36951,7 +36993,7 @@ no fund step; unclaimed openings refund fee-free):
36951
36993
  await new Promise((r) => setTimeout(r, intervalMs));
36952
36994
  let latest;
36953
36995
  try {
36954
- latest = await fetchSellerJobs(base, me);
36996
+ latest = await loadInbox();
36955
36997
  } catch {
36956
36998
  continue;
36957
36999
  }