@neta-art/neta-search-cli 0.2.50 → 0.2.53

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/neta-search.mjs +16 -9
  2. package/package.json +1 -1
package/neta-search.mjs CHANGED
@@ -29796,8 +29796,8 @@ async function cmdSubmit(name, opts) {
29796
29796
  );
29797
29797
  }
29798
29798
  } else if (s.state !== "queued") {
29799
- const hints = s.state === "admitted" && s.published === true && s.taken_down !== true ? await usedHints(env, name, digest, adopts) : [];
29800
- return finish(opts, id, digest, name, s, adopts, hints, src ? src.handle ?? src.id : void 0);
29799
+ const sugg = s.state === "admitted" && s.published === true && s.taken_down !== true ? await suggestionsAfterSubmit(env, name, digest, adopts) : { hints: [], open: 0 };
29800
+ return finish(opts, id, digest, name, s, adopts, sugg, src ? src.handle ?? src.id : void 0);
29801
29801
  } else if (!toldWaiting && !opts.json) {
29802
29802
  console.error(`Waiting for the server to collect it${s.reason ? ` (last attempt failed: ${s.reason}; it retries)` : ""} ...`);
29803
29803
  toldWaiting = true;
@@ -29813,21 +29813,25 @@ async function cmdSubmit(name, opts) {
29813
29813
  await new Promise((r) => setTimeout(r, poll));
29814
29814
  }
29815
29815
  }
29816
- async function usedHints(env, name, digest, adopts) {
29817
- if (!env.turnId) return [];
29816
+ async function suggestionsAfterSubmit(env, name, digest, adopts) {
29817
+ const none = { hints: [], open: 0 };
29818
+ if (!env.turnId) return none;
29818
29819
  try {
29819
29820
  const a = await accessState(env, 10, 1e3);
29820
- if (a === "unreachable" || a.body.state !== "granted") return [];
29821
+ if (a === "unreachable" || a.body.state !== "granted") return none;
29821
29822
  const q = new URLSearchParams({ space: env.spaceId, turn: env.turnId, name });
29822
29823
  const res = await fetch(`${env.apiBase}/v1/skills/proposals?${q}`, { signal: AbortSignal.timeout(1e4) });
29823
- if (res.status !== 200) return [];
29824
+ if (res.status !== 200) return none;
29824
29825
  const body = await res.json();
29825
- return (body.proposals ?? []).filter((p) => p.state === "open" && p.looks_used_in === digest && !adopts.includes(p.id)).map((p) => ({ id: p.id, from: p.from }));
29826
+ const open = (body.proposals ?? []).filter((p) => p.state === "open" && !adopts.includes(p.id));
29827
+ const hints = open.filter((p) => p.looks_used_in === digest).map((p) => ({ id: p.id, from: p.from }));
29828
+ return { hints, open: open.length - hints.length };
29826
29829
  } catch {
29827
- return [];
29830
+ return none;
29828
29831
  }
29829
29832
  }
29830
- function finish(opts, id, digest, name, s, adopts = [], hints = [], adaptationOf) {
29833
+ function finish(opts, id, digest, name, s, adopts = [], sugg = { hints: [], open: 0 }, adaptationOf) {
29834
+ const hints = sugg.hints;
29831
29835
  const base = { id, digest, state: s.state, handle: s.handle || void 0, released: s.released, reason: s.reason || void 0, duplicate_of: s.duplicate_of || void 0, adaptation_of: adaptationOf };
29832
29836
  switch (s.state) {
29833
29837
  case "rejected":
@@ -29859,10 +29863,12 @@ function finish(opts, id, digest, name, s, adopts = [], hints = [], adaptationOf
29859
29863
  const credit = creditLines(name, digest, adopts, s.adopted);
29860
29864
  lines.push(...credit.lines);
29861
29865
  for (const h of hints) lines.push(`This version seems to use suggestion ${h.id} from ${h.from || "another creator"}. ${creditHint(name, h.id, digest)}`);
29866
+ if (sugg.open > 0) lines.push(`${sugg.open} suggestion${sugg.open === 1 ? "" : "s"} from other creators ${sugg.open === 1 ? "is" : "are"} still waiting for you: neta-search skills proposals ${name}`);
29862
29867
  lines.push(`To take it down later: neta-search skills submit --withdraw ${name} (deleting the directory does not withdraw it).`);
29863
29868
  const json = { ...base, ...s.listing ? { listing: s.listing } : {} };
29864
29869
  if (adopts.length) Object.assign(json, { adopted: s.adopted, adopts_not_recorded: credit.missing });
29865
29870
  if (hints.length) json["suggestions_maybe_used"] = hints;
29871
+ if (sugg.open > 0) json["open_suggestions"] = sugg.open;
29866
29872
  return done(opts, json, lines.join("\n"), 0);
29867
29873
  }
29868
29874
  }
@@ -30172,6 +30178,7 @@ async function cmdPropose(name, opts) {
30172
30178
  const c = changeLine(p.changed);
30173
30179
  if (c) say(c);
30174
30180
  say("They see it the next time they list their skills. Nothing was published, and only they and you can see it.");
30181
+ say("If they adopt it, the skills site credits you by your Cohub username; without a username you are not credited (set one with: cohub profile update --username <name>).");
30175
30182
  say(`To see whether they adopt it: neta-search skills proposals --mine. To take it back: neta-search skills propose ${name} --withdraw`);
30176
30183
  return 0;
30177
30184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/neta-search-cli",
3
- "version": "0.2.50",
3
+ "version": "0.2.53",
4
4
  "description": "neta-search CLI — find, try and install skills from the Cohub / Neta skill registry",
5
5
  "type": "module",
6
6
  "bin": {