Skip to content

feat(saucepan): prototype opt-in locked card import - #42

Draft
DJLegends1011 wants to merge 8 commits into
Sillyanonymous:mainfrom
DJLegends1011:codex/saucepan-hidden-extraction
Draft

feat(saucepan): prototype opt-in locked card import#42
DJLegends1011 wants to merge 8 commits into
Sillyanonymous:mainfrom
DJLegends1011:codex/saucepan-hidden-extraction

Conversation

@DJLegends1011

Copy link
Copy Markdown

What

Prototype an opt-in path for importing one locked Saucepan companion into the user's local SillyTavern library when Saucepan reports that the creator allows custom providers.

  • adds a one-use authenticated loopback OpenAI-compatible capture listener
  • opens a short-lived Cloudflare Quick Tunnel targeting only that listener
  • creates one temporary Saucepan provider/chat/generation through Saucepan's HTTP API
  • extracts Companion Core, Example Dialogue, and the starting greeting from the assembled prompt
  • attempts every cleanup step independently, with bounded requests/process shutdown and visible cleanup warnings
  • reuses the captured V2 card during import so a second extraction cannot occur

Live feasibility proof

Before implementing this branch, I validated the same HTTP workflow end-to-end against one locked Saucepan companion using a dedicated proof harness and an authenticated user session. Saucepan delivered the assembled OpenAI request to the temporary provider, including the stable [ Background ], [ Example Dialogue ], and [ User Description ] boundaries, and accepted the capture response. The temporary chat, provider, tunnel, and listener were then removed/stopped. No captured definition content or account credential is included in this PR.

Safety and scope

  • explicit Extract for local import click; previewing never starts capture
  • one selected UUID per run, with a single concurrency slot; no bulk route, feed, cache, or redistribution feature
  • fail-closed creator policy checks in both browser and helper (custom_and_vetted plus Saucepan's owner-bypass profiles only)
  • independent 32-byte path and bearer secrets; loopback bind; one accepted request; 4 MiB body limit
  • captured definition remains in memory and is never logged or persisted by Character Library
  • tunnel/listener are stopped before remote cleanup; remote requests and cleanup have deadlines
  • cloudflared escalates from graceful to forced termination and reports failure
  • creator-disallowed cards retain the existing partial-only behavior

Current limitations / review points

  • Saucepan's provider/chat/generation endpoints and prompt section markers are undocumented and may change; this is intentionally a draft for maintainer validation.
  • Locked extraction requires cloudflared on PATH or CLOUDFLARED_PATH.
  • The live proof used a standalone one-use harness before implementation; the branch lifecycle itself is covered with mocked Saucepan requests plus real loopback listener tests.
  • Only fields that can be separated without importing persona/lore wrappers are captured: Companion Core, Example Dialogue, and a fallback starting greeting.

Verification

  • npm test --prefix extras/cl-helper — 24 passing
  • node --check extras/cl-helper/index.js
  • node --check extras/cl-helper/saucepan-hidden-extraction.js
  • node --check modules/providers/saucepan/saucepan-api.js
  • node --check modules/providers/saucepan/saucepan-provider.js
  • node --check modules/providers/saucepan/saucepan-browse.js
  • git diff --check upstream/main...HEAD

@frogicporn

Copy link
Copy Markdown

I used localhost.run for the version https://github.com/frogicporn/SillyTavern-CharacterLibrary/blob/local/janitorai-multi-extract/extras/cl-helper/index.js I did. I was failing with cloudflare but I think it wasn't cloudflare It was failing intermittingly without pinging it

@frogicporn

Copy link
Copy Markdown

did you verify it working in the ui? I'm trying out your POC and its hitting some similar walls that I had to get past. The big one is they don't seem to send the followup without polling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants