unbrowse 2.8.3 → 2.8.4

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
@@ -16741,7 +16741,20 @@ async function registerRoutes(app) {
16741
16741
  const clientScope = clientScopeFor(req);
16742
16742
  const { skill_id } = req.params;
16743
16743
  const { params, projection, confirm_unsafe, dry_run, intent, context_url } = req.body;
16744
- const skill = getRecentLocalSkill(skill_id, clientScope) ?? await getSkill2(skill_id, clientScope);
16744
+ let skill = getRecentLocalSkill(skill_id, clientScope);
16745
+ if (!skill) {
16746
+ const { findExistingSkillForDomain: findLocal } = await Promise.resolve().then(() => (init_client2(), exports_client2));
16747
+ for (const [, entry] of domainSkillCache) {
16748
+ if (entry.skillId === skill_id && entry.localSkillPath) {
16749
+ try {
16750
+ skill = JSON.parse(__require("fs").readFileSync(entry.localSkillPath, "utf-8"));
16751
+ } catch {}
16752
+ break;
16753
+ }
16754
+ }
16755
+ }
16756
+ if (!skill)
16757
+ skill = await getSkill2(skill_id, clientScope);
16745
16758
  if (!skill)
16746
16759
  return reply.code(404).send({ error: "Skill not found" });
16747
16760
  const execParams = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unbrowse",
3
- "version": "2.8.3",
3
+ "version": "2.8.4",
4
4
  "description": "Reverse-engineer any website into reusable API skills. Zero-dep single binary with embedded browser engine.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -410,7 +410,21 @@ export async function registerRoutes(app: FastifyInstance) {
410
410
  intent?: string;
411
411
  context_url?: string;
412
412
  };
413
- const skill = getRecentLocalSkill(skill_id, clientScope) ?? await getSkill(skill_id, clientScope);
413
+ // Check local caches first: recent skills domain snapshots → marketplace
414
+ let skill = getRecentLocalSkill(skill_id, clientScope);
415
+ if (!skill) {
416
+ // Check domain snapshot cache — passively indexed skills live here
417
+ const { findExistingSkillForDomain: findLocal } = await import("../client/index.js");
418
+ for (const [, entry] of domainSkillCache) {
419
+ if (entry.skillId === skill_id && entry.localSkillPath) {
420
+ try {
421
+ skill = JSON.parse(require("fs").readFileSync(entry.localSkillPath, "utf-8"));
422
+ } catch { /* snapshot read failed */ }
423
+ break;
424
+ }
425
+ }
426
+ }
427
+ if (!skill) skill = await getSkill(skill_id, clientScope);
414
428
  if (!skill) return reply.code(404).send({ error: "Skill not found" });
415
429
  const execParams = {
416
430
  ...(params ?? {}),