@@ -4,18 +4,18 @@ This file is the canonical instruction set for ongoing YOOS-VIL product work.
44
55## Product Goal
66
7- YOOS-VIL must become a real reusable application, not a pile of one-off scripts.
7+ YOOS-VIL must be a reusable application surface , not a collection of one-off scripts.
88
9- It must support two simultaneous use cases :
9+ It must support two simultaneous workflows :
1010
11111 . Operator workflow:
12- When Kemal says "attach images to post ` POST_ID ` with VIL", the protocol must run reliably end-to- end.
12+ When Kemal says "attach images to post ` POST_ID ` with VIL", the protocol must run reliably end to end.
13132 . Reusable product workflow:
14- Another user/project must be able to use the same engine with a different site profile and configuration .
14+ Another site/profile must be able to use the same engine through the same core surface .
1515
1616## Non-Negotiable Rules
1717
18- 1 . Do not optimize for repo appearance by breaking runtime behavior.
18+ 1 . Do not optimize repo appearance by breaking runtime behavior.
19192 . Do not delete a file if any runtime path still imports or calls it.
20203 . Do not report planned architecture as completed architecture.
21214 . Unpushed work is not done.
@@ -26,9 +26,9 @@ It must support two simultaneous use cases:
2626 - what was tested
2727 - what failed
2828
29- ## Target Product Shape
29+ ## Canonical Product Shape
3030
31- The system should be split into three layers.
31+ The system is split into three layers.
3232
3333### 1. Product Core
3434
@@ -67,13 +67,16 @@ Target modules:
6767- ` src/vil/app/api.py `
6868- ` src/vil/app/jobs.py `
6969- ` src/vil/app/health.py `
70+ - ` src/vil/app/server.py `
71+ - ` src/vil/app/state.py `
7072
7173Responsibilities:
7274
7375- CLI entrypoint
74- - future API surface
76+ - HTTP surface
7577- background job orchestration
7678- structured health checks
79+ - job state tracking
7780
7881### 3. Ops
7982
@@ -91,31 +94,34 @@ These are not the product surface.
9194
9295## Canonical User Contract
9396
94- The first stable public contract is CLI.
97+ The first stable public contracts are CLI and HTTP .
9598
96- Target command shape:
99+ CLI shape:
97100
98101``` bash
99102vil attach --site yoldaolmak --post 264459
100103vil attach --site yoldaolmak --post 264459 --count 4 --lang tr --people-first
101104vil review --site yoldaolmak --post 264459
105+ vil plan --site yoldaolmak --post 264459 --count 4 --people-first
106+ vil process --site yoldaolmak --post 264459 --count 4 --people-first
102107vil health
108+ vil serve --host 127.0.0.1 --port 8040
103109```
104110
105- The engine behind ` vil attach ` must :
111+ HTTP shape :
106112
107- 1 . fetch post context
108- 2 . select relevant images
109- 3 . reject watermark / stock-feeling / wrong-language assets
110- 4 . prefer Turkish, human-centered assets when the content requires it
111- 5 . process images
112- 6 . upload media
113- 7 . attach correct blocks to the target post
114- 8 . return a structured result
113+ - ` GET /health `
114+ - ` POST /review `
115+ - ` POST /plan `
116+ - ` POST /process `
117+ - ` POST /attach `
118+ - ` POST /jobs/attach `
119+ - ` GET /jobs `
120+ - ` GET /jobs/{job_id} `
115121
116122## Required Structured Output
117123
118- The attach pipeline should return a machine-readable result with fields like:
124+ The attach pipeline should return machine-readable output with fields like:
119125
120126- ` site `
121127- ` post_id `
@@ -126,93 +132,67 @@ The attach pipeline should return a machine-readable result with fields like:
126132- ` warnings `
127133- ` duration_ms `
128134
129- ## Current Review Findings To Respect
135+ Job endpoints should additionally expose:
130136
131- The current PR branch is not mergeable yet.
137+ - ` job_id `
138+ - ` status `
139+ - ` created_at `
140+ - ` updated_at `
141+ - ` payload `
142+ - ` result `
143+ - ` error `
132144
133- Verified problems:
145+ ## Current State
134146
135- 1 . ` ops/yoos_vil_health.py ` has a syntax error.
136- 2 . ` src/core/processor.py ` still imports ` yo_yoldaolmak_filter ` , but that file was deleted.
137- 3 . The branch uses Python 3.11 type syntax in places while this environment is currently running Python 3.9.
138- 4 . The repo cleanup removed files more aggressively than the runtime contract allows.
147+ The branch has already completed the earlier stabilization work.
139148
140- These must be fixed before any new cleanup wave.
149+ Current verified surface:
141150
142- ## Immediate Implementation Order
143-
144- ### Milestone 1: Stabilize Current PR
145-
146- Goal: make the PR branch runnable again before further architecture changes.
147-
148- Tasks:
149-
150- 1 . Fix syntax/runtime breakages in the existing PR branch.
151- 2 . Restore or relocate any runtime dependency that was deleted while still imported.
152- 3 . Make the branch compatible with the declared Python version strategy.
153- 4 . Run compile/import/tests and record exact results in ` QWEN_STATUS.md ` .
151+ - canonical ` src/vil/* ` package root exists
152+ - CLI exists and is tested
153+ - native ` plan ` , ` process ` , and ` attach ` contracts exist
154+ - minimal HTTP surface exists and is tested
155+ - async attach job registry exists and is tested
154156
155- Acceptance :
157+ Still incomplete :
156158
157- - no syntax errors
158- - no missing imports in the canonical attach path
159- - tests run or failures are explicitly recorded
159+ - auth on HTTP surface
160+ - persisted job store
161+ - richer native metadata parity with legacy path
162+ - gradual retirement of legacy internals in ` src/main.py ` and ` src/core/* `
160163
161- ### Milestone 2: Define Canonical Package Layout
164+ ## Immediate Implementation Order
162165
163- Goal: move from ad hoc rename-only restructuring to a coherent package.
166+ ### Milestone A: Secure the HTTP Surface
164167
165168Tasks:
166169
167- 1 . Introduce ` src/vil/ ` as the canonical package root.
168- 2 . Move current runtime code into ` engine ` , ` providers ` , ` profiles ` , ` app ` .
169- 3 . Keep backward-compatibility wrappers only if needed temporarily.
170- 4 . Remove dead code only after callers are updated.
171-
172- Acceptance:
170+ 1 . Add token-based auth for HTTP endpoints.
171+ 2 . Keep health behavior explicit and intentional.
172+ 3 . Ensure error payloads stay structured.
173173
174- - one clear package root
175- - canonical CLI entrypoint exists
176- - imports resolve without relying on deleted root scripts
177-
178- ### Milestone 3: Ship ` vil attach `
179-
180- Goal: one stable operator command for real post workflows.
174+ ### Milestone B: Persist Job State
181175
182176Tasks:
183177
184- 1 . Implement ` vil attach --site ... --post ... `
185- 2 . Support ` --count ` , ` --lang ` , ` --people-first `
186- 3 . Return structured output
187- 4 . Cover the attach flow with at least one integration-style test
188-
189- Acceptance:
190-
191- - command exists
192- - command runs through the core path
193- - behavior is documented
178+ 1 . Replace in-memory-only registry with persistent storage.
179+ 2 . Preserve job history across restarts.
180+ 3 . Keep the HTTP contract stable.
194181
195- ### Milestone 4: Add API Surface
196-
197- Goal: prepare the system to behave like a reusable app.
182+ ### Milestone C: Reduce Legacy Dependency
198183
199184Tasks:
200185
201- 1 . Add a minimal API layer, preferably FastAPI.
202- 2 . Expose a job-style endpoint for image attachment.
203- 3 . Keep API thin; business logic must remain in product core.
204-
205- Acceptance:
206-
207- - API wraps the same attach engine
208- - no duplicated business logic
186+ 1 . Move more attach behavior from legacy orchestrator paths into ` src/vil/engine/* ` .
187+ 2 . Keep backward compatibility only where necessary.
188+ 3 . Remove dead code only after callers are updated.
209189
210190## Do Not Do
211191
212192- Do not invent a second parallel architecture.
213- - Do not hide breakages behind README claims.
193+ - Do not hide runtime breakage behind README claims.
214194- Do not delete domain-specific runtime modules just because they look messy.
215- - Do not merge the current PR until Milestone 1 is truly complete .
195+ - Do not merge work that is untested in the current environment .
216196
217197## Required Working Style
218198
0 commit comments