feat(curator): vendor the backend application under scenarios/curator/backend

The curator app (Python backend, tests, systemd units, config, scripts) now lives in this repo under scenarios/curator/backend, exported from the standalone checkout's tracked tree (.pi mirror, venv and caches excluded). 149 unit tests pass from the new location; _SHARED_LIB and eval GOLDEN_DIR resolve unchanged. History not preserved per decision.

verify-no-secrets: the ASSIGN heuristic now requires the value to carry entropy (a digit or uppercase letter), so vendored Python kwargs like token=extraction_token no longer false-positive while real base64/hex/random secrets still trip it.
This commit is contained in:
Kai
2026-08-30 07:54:39 -07:00
parent 14c97d88cf
commit 35af26c794
54 changed files with 14207 additions and 2 deletions
@@ -0,0 +1,44 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/book_reviews.json",
"title": "book_reviews",
"type": "object",
"additionalProperties": false,
"required": [
"title"
],
"properties": {
"title": {
"type": "string",
"maxLength": 300
},
"creator": {
"type": "string",
"maxLength": 200,
"description": "Author, when known."
},
"external_ids": {
"type": "object",
"additionalProperties": false,
"properties": {
"imdb": {
"type": "string",
"maxLength": 64
},
"tmdb": {
"type": "string",
"maxLength": 64
},
"tvdb": {
"type": "string",
"maxLength": 64
},
"isbn": {
"type": "string",
"maxLength": 64
}
},
"description": "Only identifiers explicitly present in the input. Never inferred."
}
}
}
@@ -0,0 +1,8 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/counts.json",
"title": "counts",
"type": "object",
"additionalProperties": false,
"properties": {}
}
@@ -0,0 +1,140 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/extraction.json",
"title": "extraction",
"type": "object",
"additionalProperties": false,
"required": [
"items"
],
"properties": {
"source_title": {
"type": "string",
"maxLength": 500
},
"source_summary": {
"type": "string",
"maxLength": 600
},
"no_items_reason": {
"type": "string",
"maxLength": 600
},
"items": {
"type": "array",
"maxItems": 8,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"media_type",
"title"
],
"properties": {
"media_type": {
"type": "string",
"enum": [
"book",
"movie",
"tv",
"music"
]
},
"title": {
"type": "string",
"maxLength": 300
},
"original_title": {
"type": "string",
"maxLength": 300
},
"aliases": {
"type": "array",
"maxItems": 8,
"items": {
"type": "string",
"maxLength": 200
}
},
"creator": {
"type": "string",
"maxLength": 200
},
"year": {
"type": [
"integer",
"null"
],
"minimum": 1000,
"maximum": 2999,
"description": "Four-digit year, or null when not known. Never a guess."
},
"external_ids": {
"type": "object",
"additionalProperties": false,
"properties": {
"imdb": {
"type": "string",
"maxLength": 64
},
"tmdb": {
"type": "string",
"maxLength": 64
},
"tvdb": {
"type": "string",
"maxLength": 64
},
"isbn": {
"type": "string",
"maxLength": 64
}
},
"description": "Only identifiers explicitly present in the input. Never inferred."
},
"role": {
"type": "string",
"enum": [
"primary",
"secondary"
]
},
"evidence": {
"type": "string",
"maxLength": 400,
"description": "How the source substantively discusses the work."
},
"summary": {
"type": "string",
"maxLength": 600
},
"recommendation": {
"type": "string",
"enum": [
"strong",
"worth",
"optional",
"skip"
]
},
"reasons": {
"type": "array",
"maxItems": 3,
"items": {
"type": "string",
"maxLength": 300
}
},
"suggested_action": {
"type": "string",
"enum": [
"collect",
"wanted",
"ignore"
]
}
}
}
}
}
}
@@ -0,0 +1,130 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/fact_pack.json",
"title": "fact_pack",
"type": "object",
"additionalProperties": false,
"properties": {
"library": {
"type": "object",
"additionalProperties": false,
"properties": {
"matches": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"instance": {
"type": "string",
"description": "Which catalog instance, e.g. sonarr-4k."
},
"quality": {
"type": "string"
},
"title": {
"type": "string",
"maxLength": 300
},
"year": {
"type": [
"integer",
"null"
],
"minimum": 1000,
"maximum": 2999,
"description": "Four-digit year, or null when not known. Never a guess."
},
"has_file": {
"type": "boolean",
"description": "A file exists. Tracking alone is not ownership."
},
"has_file_basis": {
"type": "string",
"description": "What has_file was derived from."
},
"episode_count": {
"type": [
"integer",
"null"
]
},
"episode_file_count": {
"type": [
"integer",
"null"
]
},
"monitored": {
"type": [
"boolean",
"null"
]
},
"file_qualities": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
}
}
}
},
"catalogs_checked": {
"type": "array",
"items": {
"type": "string"
},
"description": "Catalogs that actually answered."
},
"catalogs_unavailable": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"catalog": {
"type": "string"
},
"state": {
"type": "string",
"enum": [
"ok",
"not_configured",
"failed"
]
},
"error": {
"type": "string"
}
}
}
},
"errors": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"online": {
"type": "object"
},
"counts": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"action_result": {
"type": [
"object",
"null"
]
},
"retry": {
"type": "object"
}
}
}
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/fetch_source.json",
"title": "fetch_source",
"type": "object",
"additionalProperties": false,
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"description": "Public HTTP(S) page to fetch.",
"maxLength": 2048
}
}
}
@@ -0,0 +1,73 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/lookup_online.json",
"title": "lookup_online",
"type": "object",
"additionalProperties": false,
"required": [
"media_type",
"title"
],
"properties": {
"media_type": {
"type": "string",
"enum": [
"book",
"movie",
"tv",
"music",
"unknown"
]
},
"title": {
"type": "string",
"maxLength": 300,
"description": "Work title as the user wrote it, or normalised."
},
"original_title": {
"type": "string",
"maxLength": 300,
"description": "Original-language title when known."
},
"aliases": {
"type": "array",
"maxItems": 8,
"items": {
"type": "string",
"maxLength": 200
}
},
"year": {
"type": [
"integer",
"null"
],
"minimum": 1000,
"maximum": 2999,
"description": "Four-digit year, or null when not known. Never a guess."
},
"external_ids": {
"type": "object",
"additionalProperties": false,
"properties": {
"imdb": {
"type": "string",
"maxLength": 64
},
"tmdb": {
"type": "string",
"maxLength": 64
},
"tvdb": {
"type": "string",
"maxLength": 64
},
"isbn": {
"type": "string",
"maxLength": 64
}
},
"description": "Only identifiers explicitly present in the input. Never inferred."
}
}
}
@@ -0,0 +1,73 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/query_library.json",
"title": "query_library",
"type": "object",
"additionalProperties": false,
"required": [
"media_type",
"title"
],
"properties": {
"media_type": {
"type": "string",
"enum": [
"book",
"movie",
"tv",
"music",
"unknown"
]
},
"title": {
"type": "string",
"maxLength": 300,
"description": "Work title as the user wrote it, or normalised."
},
"original_title": {
"type": "string",
"maxLength": 300,
"description": "Original-language title when known."
},
"aliases": {
"type": "array",
"maxItems": 8,
"items": {
"type": "string",
"maxLength": 200
}
},
"year": {
"type": [
"integer",
"null"
],
"minimum": 1000,
"maximum": 2999,
"description": "Four-digit year, or null when not known. Never a guess."
},
"external_ids": {
"type": "object",
"additionalProperties": false,
"properties": {
"imdb": {
"type": "string",
"maxLength": 64
},
"tmdb": {
"type": "string",
"maxLength": 64
},
"tvdb": {
"type": "string",
"maxLength": 64
},
"isbn": {
"type": "string",
"maxLength": 64
}
},
"description": "Only identifiers explicitly present in the input. Never inferred."
}
}
}
@@ -0,0 +1,81 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/review_synthesis.json",
"title": "review_synthesis",
"type": "object",
"additionalProperties": false,
"required": [
"reviews"
],
"properties": {
"reviews": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"candidate_index",
"verdict"
],
"properties": {
"candidate_index": {
"type": "integer",
"minimum": 0,
"description": "Index into the candidates supplied in the request."
},
"verdict": {
"type": "string",
"enum": [
"strong",
"worth",
"optional",
"skip",
"insufficient"
]
},
"confidence": {
"type": "string",
"enum": [
"high",
"medium",
"low"
]
},
"summary": {
"type": "string",
"maxLength": 600
},
"strengths": {
"type": "array",
"maxItems": 3,
"items": {
"type": "string",
"maxLength": 300
}
},
"caveats": {
"type": "array",
"maxItems": 3,
"items": {
"type": "string",
"maxLength": 300
}
},
"audience": {
"type": "string",
"maxLength": 300
},
"evidence_refs": {
"type": "array",
"maxItems": 8,
"items": {
"type": "integer",
"minimum": 0
},
"description": "Indices of the evidence entries that support this verdict."
}
}
}
}
}
}
@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/web_search.json",
"title": "web_search",
"type": "object",
"additionalProperties": false,
"required": [
"query"
],
"properties": {
"query": {
"type": "string",
"description": "Web search query.",
"maxLength": 200
},
"max_results": {
"type": "integer",
"minimum": 1,
"maximum": 8,
"description": "Maximum results to return; defaults to 5."
}
}
}
@@ -0,0 +1,83 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://curator.local/schemas/write_proposal.json",
"title": "write_proposal",
"type": "object",
"additionalProperties": false,
"required": [
"media_type",
"action",
"title",
"identity"
],
"properties": {
"media_type": {
"type": "string",
"enum": [
"book",
"movie",
"tv",
"music"
],
"description": "作品的媒介:book 书 / movie 电影 / tv 剧集 / music 音乐。电影与剧集必须同时给出恒定的外部 ID(imdb/tmdb/tvdb)。"
},
"action": {
"type": "string",
"enum": [
"collect",
"add_wanted"
],
"description": "collect 用于把电影或剧集加入追踪;add_wanted 用于把书加入待获取清单。"
},
"title": {
"type": "string",
"maxLength": 300
},
"year": {
"type": [
"integer",
"null"
],
"minimum": 1000,
"maximum": 2999,
"description": "Four-digit year, or null when not known. Never a guess."
},
"identity": {
"type": "object",
"additionalProperties": false,
"properties": {
"imdb": {
"type": "string",
"maxLength": 64
},
"tmdb": {
"type": "string",
"maxLength": 64
},
"tvdb": {
"type": "string",
"maxLength": 64
},
"isbn": {
"type": "string",
"maxLength": 64
}
},
"description": "Only identifiers explicitly present in the input. Never inferred."
},
"risk": {
"type": "string",
"enum": [
"read_only",
"low_write",
"high_write",
"destructive"
]
},
"reason": {
"type": "string",
"maxLength": 600,
"description": "Why this is being proposed now."
}
}
}