(feat/agent) Agent threads

NI
2mo ago
+1924-34

Summary by cubic

Adds agent threads so follow-up runs continue an earlier conversation with full context, adds chat mode, and adds a firecrawl agent thread <id> command to print a conversation. The CLI now remembers the last thread per API key, so --continue picks it up without pasting an ID.

Threads and follow-ups

  • --thread <id>, --continue, and --new control which conversation a run belongs to; --thread wins over --continue.
  • --no-urls and --no-schema drop context inherited from earlier turns on follow-ups; passing them with explicit --urls/--schema fails with a clear error.
  • The shared --urls/--no-urls and --schema/--no-schema attributes are read by type, so declaration order no longer matters.
  • Lost or expired threads fall back to a new run with a notice, and the remembered entry is dropped when the server no longer has it.
  • Memory is stored in agent-threads.json keyed by a hash of the server and effective key, never the key itself, so switching accounts or servers never crosses threads; concurrent updates take a lock, including on a machine that has never run the CLI.
  • A cloud URL spelled with different casing or a trailing slash previously skipped the key check; it's now read through a shared normalizer and still requires a key.
  • agent thread <id> reads keyless self-hosted servers through --api-url without a key.

Chat mode

  • --mode chat prints the agent's prose reply before the JSON result and lists suggested follow-ups, single-quoted so copying them can't run anything.
  • Exchange options and approval commands are removed as Firecrawl Exchange is switched off.
  • Runs using the new fields go over raw HTTP because the pinned firecrawl SDK drops unknown request keys; runs without them post the same body as before.