Initial commit: hardened DeerFlow factory

Vendored deer-flow upstream (bytedance/deer-flow) plus prompt-injection
hardening:

- New deerflow.security package: content_delimiter, html_cleaner,
  sanitizer (8 layers — invisible chars, control chars, symbols, NFC,
  PUA, tag chars, horizontal whitespace collapse with newline/tab
  preservation, length cap)
- New deerflow.community.searx package: web_search, web_fetch,
  image_search backed by a private SearX instance, every external
  string sanitized and wrapped in <<<EXTERNAL_UNTRUSTED_CONTENT>>>
  delimiters
- All native community web providers (ddg_search, tavily, exa,
  firecrawl, jina_ai, infoquest, image_search) replaced with hard-fail
  stubs that raise NativeWebToolDisabledError at import time, so a
  misconfigured tool.use path fails loud rather than silently falling
  back to unsanitized output
- Native client back-doors (jina_client.py, infoquest_client.py)
  stubbed too
- Native-tool tests quarantined under tests/_disabled_native/
  (collect_ignore_glob via local conftest.py)
- Sanitizer Layer 7 fix: only collapse horizontal whitespace, preserve
  newlines and tabs so list/table structure survives
- Hardened runtime config.yaml references only the searx-backed tools
- Factory overlay (backend/) kept in sync with deer-flow tree as a
  reference / source

See HARDENING.md for the full audit trail and verification steps.
This commit is contained in:
2026-04-12 14:23:57 +02:00
commit 6de0bf9f5b
889 changed files with 173052 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
# Doraemon 8-Panel Comic Generator
## Workflow
1. Extract story context (theme, gadget, conflict, punchline)
2. Map to 8 narrative beats
3. Use the provided prompt template to generate the JSON prompt file
## Panel Layout
```
┌─────────┬─────────┐
│ Panel 1 │ Panel 2 │ Row 1: y=200, height=380
├─────────┼─────────┤
│ Panel 3 │ Panel 4 │ Row 2: y=600, height=380
├─────────┼─────────┤
│ Panel 5 │ Panel 6 │ Row 3: y=1000, height=380
├─────────┼─────────┤
│ Panel 7 │ Panel 8 │ Row 4: y=1400, height=380
└─────────┴─────────┘
Left column: x=90, width=450
Right column: x=540, width=450
```
## Characters
* Doraemon
* Nobita
* Shizuka
* Giant
* Suneo
## Prompt Template
```json
{
"canvas": {
"width": 1080,
"height": 1920,
"background": { "type": "solid", "color": "#F0F8FF" }
},
"header": {
"title": {
"text": "[Story Title]",
"position": { "x": 540, "y": 100 },
"style": {
"font_family": "Doraemon, sans-serif",
"font_size": 56,
"font_weight": "bold",
"color": "#0095D9",
"text_align": "center",
"stroke": "#FFFFFF",
"stroke_width": 4,
"text_shadow": "3px 3px 0px #FFD700"
}
}
},
"panels": [
{
"id": "panel1",
"position": { "x": 90, "y": 200 },
"size": { "width": 450, "height": 380 },
"border": { "width": 4, "color": "#000000", "radius": 12 },
"background": "#FFFFFF",
"scene": {
"location": "[Location name]",
"characters": [
{
"name": "[Character]",
"position": { "x": 0, "y": 0 },
"expression": "[Expression]",
"pose": "[Pose description]"
}
],
"dialogues": [
{
"speaker": "[Character]",
"text": "[Dialogue text]",
"position": { "x": 0, "y": 0 },
"style": {
"bubble_type": "speech",
"backgroundColor": "#FFFFFF",
"border_color": "#000000",
"font_size": 22,
"text_align": "center"
}
}
],
"props": []
}
}
],
"footer": {
"text": "[Closing note] - Doraemon",
"position": { "x": 540, "y": 1860 },
"style": {
"font_family": "Doraemon, sans-serif",
"font_size": 24,
"color": "#0095D9",
"text_align": "center"
}
},
}
```
## Story Pattern
Setup → Problem → Gadget → Misuse → Backfire → Chaos → Consequence → Ironic Punchline
## Aspect Ratio
9:16