Nhật ký thay đổi

Những gì mỗi bản phát hành đã thêm, sửa và giới hạn.

Sửa trang này trên GitHub · Nguồn: CHANGELOG.md

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased#

Added#

  • AHV primary LLM gateway, centralized chat session memory & multi-turn conversational intake v2 (OpenCoop DX-OS v2.5 Wave 1, Batch 1).
  • Anthropic-compatible AHV primary provider (dxos-agent & apps/web): dxos-agent supports DXOS_AGENT_PROVIDER (ollama default, or anthropic / openai), ANTHROPIC_BASE_URL / OPENAI_BASE_URL trailing-/v1 normalization, "stream": false, explicit User-Agent, default model minimax/MiniMax-M3 on ahvchat.com, and unblocked execution when budget.monthly_limit_usd is null (budget_has_limit=False). docker-compose.yml (web non-secret DXOS_AGENT_PROVIDER, dxos-agent base URLs, dxos-builder-proxy allowlist auto.ahvchat.com) and .env.local.example keep real API keys out of git and out of the web container. AgentSettingsUseCase.read selects defaultAgentProvider when unconfigured per agent and the agent container heartbeat reports the external key.
  • Centralized chat session persistence & rolling Vietnamese summary: platform/postgres/init/08-agent.sql adds platform.chat_sessions and platform.chat_messages (idempotent, without audit triggers so high-frequency turns do not bloat the hash chain); 09-telegram.sql adds session_id and session_context on platform.assistant_requests (cleared to NULL on finish/expiry). PostgresChatSessionRepository uses transactional $queryRaw queries, preserving the Prisma core ratchet (27). ChatSessionService caps prompt context (summary <= 800 chars, up to 6 recent_turns <= 240 chars) and works with internal route GET/POST /api/internal/agent/sessions/summaries plus dxos_agent/agents/session_summarizer.py (4-point Vietnamese summary once (turn_count - summarized_turn) >= 8).
  • Multi-Turn Conversational Intake v2: dxos_agent/agents/assistant.py (PROMPT_VERSION = "m5-a7-v3") adds bounded session context fencing, natural slot merging, mid-flow natural cancellation (reset: true), and concise reply_vi replies. ChatEngine and ZaloIntakeEngine support free-form multi-turn slot filling and card edits via submitFollowUp while preserving deterministic fast paths, guardrails.bounds (boundsReasonVi) enforcement on both typed and AI-extracted out-of-range numbers, and seamless offline fallback.
  • Mini-app dragon-fruit, part 5 (PR 5 of 5): events for coop-finance and coop-ledger. The plugin now announces, through the core's event box (POST /events, service events), app.dragon-fruit.intake.confirmed when a ticket passes the PHI gate and is saved, app.dragon-fruit.intake.voided when it is voided, and app.dragon-fruit.lighting.advanced when the cooperative advanced the electricity of a night-lighting log. Payloads hold identifiers and quantities only (ticket, orchard, household, market, grade, date, weight, nights, kWh), never money or names, as the event contract asks. Migration 005_events.sql adds pending_events: each event is written in the same transaction as what it announces, once per (topic, subject), sent right after the commit and, when the core is down, over its limit or answers 5xx, sent again by the orchard-and-cold-watch worker in order; after 12 refusals an event stops and the overview card "Sự kiện lõi chưa nhận" shows it. The manifest declares events and now asks for core >=1.36.0, the release that has PUT/GET /files/content, which the certificate pages already use. coop-finance and coop-ledger still take these records by hand; the operator subscribes a receiver with ./dxos events subscribe.
  • Realistic dev data: generator scaffold, common layer, tea sector and the demo-data command (dev and CI only). python -m dxos_cli demo-data [HTX ...] [--reset] [--seed N] [--anchor YYYY-MM-DD], also ./dxos demo data ... and make demo-data (DEMO_DATA_ARGS=--reset to remove), builds a year of history (the 365 days before the anchor, default today in Vietnam) for the demo cooperatives by writing SQL directly, one transaction per cooperative, with triggers off for the run (so history has no audit.events rows). Package platform/cli/dxos_cli/demo_data/: common.py (seeded Rng per <HTX>:<seed>, Vietnam-day helpers, weather loader with a year-earlier fallback, price series interpolated between dated reference points with seasonal shape and bounded noise, fictional names from parts lists, the rd_<HTX>_<table>_<n> key convention, the in-memory Plan with foreign-key validation, the parameterised writer, reset and the per-cooperative "already generated" check), a registry of sectors in __init__.py, and tea.py for TC (60 households) and LB (45): parcels, flushes, daily leaf prices per grade, weighing tickets that respect the pesticide waiting period, journal, input advances, monthly settlement with ledger, roasting batches at the fresh/dry ratio, lots with trace snapshots, certificates (VietGAP; organic at LB), partners, sales and payments, weather cache. platform/demo/reference/tea/defaults.json holds every value the research left open, each with why and confidence. A cooperative that is missing or already generated is skipped with the reason. Tests: platform/cli/tests/test_demo_data_common.py, test_demo_data_tea.py (no database).
  • Shrimp sector for ST (shrimp.py, plugin shrimp-farm). 24 households with 2 to 4 ponds each (3,000 to 4,700 m2, six canals K03 to K08, pond codes C01, D01, ... by canal letter), two to three crops a year inside the 10 Jan - 30 Sep stocking window (at most 90 days, harvest size and yield from the days of culture and the reference band), the stocking plans (no overlapping intake on a canal), hatcheries with quarantine certificates and seed batches, a daily feeding log whose total is the harvested biomass times an FCR of 1.17 to 1.37 (a few corrected lines), the pond log with doxycycline and iodine lines that keep their withdrawal days (no schedule, weigh ticket or harvest lot inside one), disease reports that lock the pond (no water out while one is open) with canal advisories (a blocked canal takes no water in), harvest schedules, joint lots with three buyers' quotes by size band, confirmed weigh tickets and harvest lots (ST-<yyyymmdd>-<n> from 2, clear of seed-demo's lots), and, in the telemetry tables, the ponds as assets and 21 days of hourly dissolved oxygen, pH, salinity and temperature (dissolved oxygen under 4 mg/L only after 20 mm rain days). platform/demo/reference/shrimp/defaults.json holds every value the research left open. Tests: platform/cli/tests/test_demo_data_shrimp.py.
  • Dragon fruit sector for BT (dragon_fruit.py, plugin dragon-fruit). 35 households with 47 orchards (0.5 to 2 ha, about 1,100 pillars a hectare, codes V01 to V47), growing-area codes BT-HTN-003 on, two packing facilities, natural and lighting flowering cycles with the lighting logs (kWh from the reference), nine registered pesticides with an interval for each of the six markets (15 days, 21 for the EU: defaults.json, low confidence), a cultivation log in which sprays stay out of the interval before every pick (a few lines corrected), daily prices for every market and grade from the dated reference series, intake tickets, packing batches (one market each, mass balance, a reason above the 8% threshold, the 400 Gy dose in the box spec of US batches), export lots behind the growing-area and packing-facility gate with their day counters, two cold rooms KL-02 and KL-03 and 21 days of hourly temperature and humidity (out of the 5 to 8 C range only on afternoons of 34 C or more). The plugin's event box (pending_events, migration 005) is filled by its code, not by a trigger, and the generator never writes it, so the history announces nothing. Tests: platform/cli/tests/test_demo_data_dragon_fruit.py.
  • Realism fixes: at BT every non-void ticket older than three days is in a packing batch of its own market (domestic included), only the last three days stay unpacked; when the anchor is today (the default) the ST pond and BT cold-room readings run up to the current hour (common.vn_now()), a fixed past anchor stays deterministic.
  • Common layer, backward compatible: TableSpec.reset_where (a whole SQL condition for tables keyed by a natural code or a marker uuid, with or without the prefix parameter), marker_prefix, marker_uuid, marker_where (uuid primary keys found again by their text form), and Plan.validate accepts marker uuids. The tea runner test fixture pins the registry to tea so registering more sectors does not change it.
  • Realistic dev data: safety fixes after the review of PR #191. ./dxos demo data now refuses unless DXOS_ALLOW_DEMO_DATA=1 given by the caller on the command line (make demo-data and the CI smoke set it; the compose file defaults to 0, because ./dxos uses only the dev compose file, also on a release stack), refuses a database with a cooperative outside the six samples (--allow-other-htx to override) and an anchor in the future, prints the database and host, takes an advisory lock per cooperative, and stops without superuser. The writer and --reset count the orphans of every foreign key before they commit and roll back on a new one. --reset deletes exactly what the generator wrote (a key, a full-shape marker uuid, a marker time on sensor readings and BT prices), only for a cooperative that was generated (--force-reset otherwise); catalogue rows (shrimp canals, hatcheries, drugs, BT markets, grades, cold rooms, telemetry assets, lychee products, rice seasons) are added if absent and never deleted, and the BT day counter is no longer written (generated lots are numbered from 501). An error in one cooperative no longer stops the others, a reset still removes the core rows when a plugin was removed, no row is dated on or after a past anchor, tea no longer publishes today's price, the smoke checks more invariants (shrimp, BT lot gate, rice stage order), compares every table on the rerun, fails under CI when a sector it installs is missing, and passes on a fresh database (the MX reset compares only what reset deletes). Invented buyers and irradiation facilities carry invented names.
  • Realistic dev data: CI smoke and notes. platform/tests/smoke-demo-data.sh (with demo-data-fk-orphans.sql) is the new step "Demo Data Smoke" of the job sector-acceptance, after the rice seed and before the browser stories: it generates, checks row minimums per cooperative, the sector invariants as SQL (lychee PHI, one rice reading per plot and day, BT interval per market, tea PHI, household cooperative), every foreign key for orphans, the second run ("đã có, không thêm gì") and --reset of MX; a sector whose plugin is not installed is skipped with a message. docs/dev-setup.md gives the measured figures and says shrimp-farm must be 0.7.0 or later; the spec has a status line and "Ghi chú sau triển khai".
  • Realistic dev data: lychee sector for LN (plugin lychee-orchard). demo_data/lychee.py builds 40 households with 1-3 blocks each, ten spray products (PHI of at least 15 days, a stop-spray policy in platform/demo/reference/lychee/defaults.json), sprays by pest window (mites, downy blight, stink bug, fruit borer) and harvest lots in May-July (early varieties from 25 May, main crop from 10 June). The PHI gate holds by construction: a spray is only made when its date plus its PHI is not after the block's first harvest, so no lot is flagged and a voided spray never counts. Closed export batches of at most 40 lots for China, Japan, the United States, Australia and the EU (GlobalGAP lots only); US and Australia batches, and a part of the Japan ones, carry the irradiation record at 0.4 kGy or more (the plugin stores kGy). Test: platform/cli/tests/test_demo_data_lychee.py.
  • Realistic dev data: rice sector for MX (plugin rice-coop). demo_data/rice.py builds 30 households with 1-2 plots, two seasons (the closed LT2526, harvested December to March and closed on 15 April, and the open, mid-crop LT2627), plantings of ST25 sown September to November with the six stages as the plugin's stageDates gives them (SOWING done at planting), inputs (seed, basal, urea, panicle fertiliser, blast and leaf-folder products that stay out of their waiting period), daily AWD readings on the enrolled plots (one per plot per day, down to -15 cm then re-flooded, flooded from panicle initiation to ripening) and lots only after the ripening stage. TableSpec gets an optional reset_where for a table with no key column (the stages are deleted with the plantings of a generated household); the other sectors are unaffected. Test: platform/cli/tests/test_demo_data_rice.py.

Fixed#

  • A container restart no longer leaves /tmp read-only for the non-root user. A tmpfs mounted on a path the image does not have (FROM scratch: dxos-outbox and the Go plugins) is created 1777 on the first start but comes back 0755 root after docker restart or a Docker restart, so dxos-outbox could no longer write its heartbeat and stayed unhealthy (seen on a dev stack after Docker Desktop restarted; make platform-up and make up-core then stop on it), and a Go plugin could not spill a large upload to /tmp. Every /tmp tmpfs in docker/docker-compose.yml and in the app compose written by ./dxos install now sets mode=1777. Existing containers keep the old mount until they are recreated: make platform-up recreates the core services, and ./dxos upgrade <dir> or a reinstall the apps.
  • make up-chat starts Mattermost. It never could: no script created the mattermost database (only keycloak), so the container restarted forever on database "mattermost" does not exist, and on an arm64 host (Apple Silicon) the pull failed first because Mattermost publishes amd64 images only. docker/postgres-init.sql now creates the database on a fresh volume, make up-chat creates it on an existing one (idempotent), and the mattermost service sets platform: linux/amd64 (Docker Desktop runs it under emulation; no effect on amd64 hosts).

[1.42.0] - 2026-12-01#

Added#

  • Demo cooperative MX, rice smoke and story, four-sector check (Phase 4, task 7). platform/demo/mx-htx.sql adds "HTX Lúa Tôm Mỹ Xuyên" (htx_mx, phone 0900600000, crop Lúa ST25, no pack) and the households hh_mx_1 (linked to farmer_mx), hh_mx_2, hh_mx_3; the realm gets manager_mx, officer_mx and farmer_mx (fixed id …0000000000d1, password Test1234!, attribute htx_code MX) and ./dxos demo accounts accepts them by name (DEMO_USERS_MX, the default list is unchanged). platform/demo/seed-rice.sh (make demo-seed-rice, called by make demo-up after the lychee seed and before the shrimp one) loads the SQL, creates the accounts, installs rice-coop for MX and runs seed-demo MX. platform/tests/smoke-sectors.sh gets a [rice-coop acceptance] section (install, health, seed totals and rerun, isolation, a second AWD reading for the same plot and day 409, farmer_mx on another household's plot 403, a lot for the closed season 409, a new lot with an RICE_LOT_RECORDED audit row and an app.rice-coop.harvest_lot.recorded event of MX, --purge keeping every earlier audit and outbox row), and the cleanup purges rice-coop too. New browser story apps/web/tests/e2e/story/rice-coop.spec.ts (E2E_RICE_COOP=installed; desktop and phone: no "chè" in the sidebar, R3 "Luân canh với ao A1", the tillering stage of R2 in DX2627 due tomorrow; desktop: an AWD reading for R1 today accepted, a second refused). The job sector-acceptance seeds MX, runs the rice story and ends on a "Four Sector Check" step (shrimp-farm only on ST, lychee-orchard only on LN, rice-coop only on MX, TC and LB keep tea-core). Static tests in platform/tests/test_sector_demos.py and test_realm_policy.py. Docs: README.md, docs/miniapps.md, docs/dev-setup.md. The smoke, the story and the check run in CI only.
  • Mini-app rice-coop, part 1 (v2.0 phase 4, task 6a): schema, store and rules. A Go plugin in the shrimp-farm shape (FROM scratch, pgx/v5 v5.13.0, own schema, no pack). Migration 001_init.sql adds plots, seasons, plantings, stages, input_logs, water_readings and harvest_lots, every table with htx_code; the rotation CHECK keeps a pond off RICE_ONLY, and water_readings is unique per plot and day. The Store (pgx implementation plus an in-memory fake for the handler tests) keeps the date windows in the Vietnam day (AWD reading 3 days back, inputs and lots 7), refuses plantings, inputs and lots in a CLOSED season but not AWD readings, creates the six crop-calendar stages with the planting, and numbers lots <plot>-<YYMMDD>-<n>. The pure rules (stageDates, dueStages, awdVerdict, rotationValid, harvestEvent) have unit tests; the Postgres tests run in scripts/db-integration.sh (RICE_TEST_DB_URL). No server, manifest or menu yet: parts 2 and 3 add them.
  • Mini-app rice-coop 0.1.0, part 2 (v2.0 phase 4, task 6b): server, pages, AWD evidence with photo, audit and events. Routes for plots, seasons (plantings with the six-stage calendar, stage edits, close), inputs, AWD water readings and harvest lots, as Go templates with no script (CSP script-src 'none'), farmers writing only on plots of their own household (checked again under the plot lock). An AWD reading takes an optional JPEG, PNG or WebP photo of at most 10 MB (size and magic bytes checked, then sent through the core files service; the photo page says "Đang quét" or "Bị cách ly" until the scanner has found it clean). Every reading writes the audit entry AWD_RECORDED and every lot RICE_LOT_RECORDED plus the event harvest_lot.recorded inside the transaction, with their own 2 s deadline: the core not taking them means 502 and nothing stored. A change of a plot's household is audited as PLOT_HOUSEHOLD_CHANGED; saving a plot copies the household's account whenever the core answers. Manifest app.yaml (services audit, files, notify, events), README. Also: the readings list counts its days from the route's Vietnam day, a plot stopped mid-season still takes inputs and lots (not AWD readings or new plantings), and dates before the year 2000 are a rule error. The agent keys, worker, checks, dashboard and MX demo come in part 3.
  • rice-coop requires core >=1.38.0 (fix of the part 2 review). The AWD photo upload uses PUT /files/content, which the core has had since 1.38.0; the manifest floor was >=1.36.0, so on an older core the plugin would install and every reading with a photo would fail. Spec section 4.5 and the plan state the new floor.
  • Mini-app rice-coop 0.1.0, part 3 (v2.0 phase 4, task 6c): agent actions, worker, check, dashboard and demo; plus the part 2 review fixes. Actions record_water_level (a message such as "ruộng R1 nước âm 12 cm": the sender is the recorder, the approver is approved_by_sub, same AddReading as the form, so the unique key of the day decides) and notify_stage_due (household first, office second), both risk: low, money: false, no food_safety (rice has no pre-harvest gate in 0.1.0). Worker season-watch (undone stages planned in the next 2 days, at most 10), check plot_awd (judged on the Vietnam day of Requested-At, window enforced, a farmer sender held to the plot owner), dashboard overview (four cards) and rice-coop seed-demo MX (refuses any other code; a rerun on any day adds nothing). Review fixes: editing a plot keeps its household unless "Bỏ gắn hộ" is chosen, the form can be preloaded with ?edit=<code>, the stage done day is validated before it is compared, the photo upload has its own 30 s client timeout (the hook calls keep 2 s), and the README documents that a stopped plot refuses new plantings and the one remaining orphan-photo case. Review minors of part 3: season-watch suggests a stage only until its reminder was sent (migration 002_stage_reminders.sql adds stages.reminded_on, cleared when the planned day moves), the dashboard stages card counts active plots only, the demo no longer marks SOWING done on the open season, and the README says only notify_stage_due can auto-run. Audit entries and events are written in app mode (Caller{Htx}), not with the forwarded user token that the web accepts only from its own client; the person is named by id (recorded_by_sub, changed_by_sub).

Changed#

  • CI: sector-acceptance now has timeout-minutes: 25 (it was 45). Measured on the green run 46634870798 (last head of PR #186): 15 minutes 15 seconds from the first step to the last (stack 10:30, smoke 2:13, the three demo seeds 2:01, both stories 0:30); 25 is 1.5 times that, rounded up to a multiple of 5. The total is under 35 minutes, so the job is not split. Spec section 4.6, docs/dev-setup.md and the roadmap (Epics 4.1 and 4.2 done) carry the measured numbers; the spec has the acceptance map for section 7.

Fixed#

  • dxos init --template node: a malformed request target no longer kills the process. new URL(req.url) threw on a target such as //[ before anything else; the template now answers 400 and keeps serving (its own test sends the request and then /healthz). The Python template only drops that one connection and the Go one is unaffected.
  • Tenant test for PUT /api/farm/households/[id]: a household of another cooperative answers 404 and nothing is written (the route was already correct; the case was untested).
  • lychee-orchard: NaN and Inf are refused as spray doses and irradiation doses (they parsed without error and passed the range checks, so a US batch could close with "NaN kGy"); doses that round to 0 at the column scale, area_m2 and tree_count above int4, and an irradiation date before 2000 or after 2100 now give the form message instead of a 500; a block is validated before BLOCK_HOUSEHOLD_CHANGED is audited. A breach found on a lot of a closed export batch now names the batch (batch_code, batch_status) in the audit entry and notifies the officers and managers once per batch. SPRAY_PRODUCT_CHANGED (new product, or a changed phi_days or approval, with old and new values) and IRRADIATION_RECORDED are audited in the transaction hook. The README now says the hook deadline is 2 s and that the audit and event reach the core before the plugin commits.
  • rice-coop: the photo upload, the status check and the photo download are made in app mode (the files service accepts the app key and the cooperative), so a client other than nextjs-web works; a core 4xx on a photo is no longer told to "retry later" and offers a reading without the photo; smoke-sectors.sh records one reading with a 1x1 PNG for R2 today and reads the photo back once the scanner cleared it. Planting a sowing on or before today marks the SOWING stage done on that day (the seed does the same), so the season page no longer shows it overdue; the dashboard card "Mốc thời vụ trong 7 ngày" counts the undone stages from today to today + 6 and leaves SOWING out, as the worker does.
  • Rollback docs: every rollback line to a version before a plugin existed now says to remove that plugin first (lychee-orchard before 1.41.0, rice-coop before 1.42.0), in README.md and docs/dev-setup.md.

Upgrade notes#

  • No core database migration and no service change. Compared with 1.41.0, docker/ changes only docker/keycloak/realm-agrimarket.json (three demo users), and apps/web/prisma/ does not change; there is no new table, column, service, image or init script change. The web image only carries the new version number. make platform-up / make demo-up (or the release steps in the README, "Nâng cấp một cài đặt đang chạy") are enough.
  • New plugin miniapps/rice-coop 0.1.0 (Go), not installed by default. Nothing changes on a stack until you install it: ./dxos install miniapps/rice-coop --htx <CODE> (MX is what platform/demo/seed-rice.sh runs; use your own cooperative's code otherwise). Its own schema app_rice_coop is created by its migrations 001_init.sql and 002_stage_reminders.sql at install; the core schemas are untouched. It needs ./dxos worker like every app, and core >=1.38.0 (the AWD photo uses PUT /files/content).
  • Demo: make demo-seed-rice and make demo-up now seed the rice cooperative MX (demo-up runs it after the lychee seed and before the shrimp one). It adds the cooperative "HTX Lúa Tôm Mỹ Xuyên" and three households (only when missing, from platform/demo/mx-htx.sql), creates the accounts manager_mx, officer_mx and farmer_mx, installs rice-coop for MX only and runs seed-demo MX. It needs postgres and web running, and it is safe to repeat. On an existing Keycloak realm the accounts are created by the script through ./dxos demo accounts manager_mx officer_mx farmer_mx (set a password with --password or DEMO_PASSWORD; without one a missing user has no password).
  • Not verified on a clean stack: make demo-up with all nine _st, _ln, _mx accounts logging in was not run before this release (CI proves the seeds and the manager_ln and manager_mx logins). Also not verified: the pre-harvest lock of lychee-orchard under real concurrent load outside the Postgres test, the agronomic stage coefficients of rice-coop, and irradiation dose limits (the plugin checks that the record is complete, not the dose).
  • Rolling back to 1.41.x needs no script: nothing in the core database or the stack changed. If you installed the plugin, remove it first from the 1.42.0 checkout with ./dxos remove rice-coop --purge: it removes the app, its route and the schema app_rice_coop, and keeps the audit history and core.outbox (omit --purge to keep the app's data; ./dxos remove rice-coop alone leaves the schema). The MX cooperative, its households and the three Keycloak accounts stay and are harmless on 1.41.x.

[1.41.0] - 2026-12-01#

Added#

  • Demo cooperative LN, job sector-acceptance, lychee smoke and story (Phase 4, task 5). platform/demo/ln-htx.sql adds the cooperative "HTX Vải thiều Lục Ngạn" (htx_ln, phone 0900500000, no pack) and the households hh_ln_1 (linked to farmer_ln), hh_ln_2, hh_ln_3; the realm gets manager_ln, officer_ln and farmer_ln (fixed id …0000000000c1, password Test1234!, attribute htx_code LN) and ./dxos demo accounts accepts them by name (DEMO_USERS_LN, the default list is unchanged). platform/demo/seed-lychee.sh (make demo-seed-lychee, called by make demo-up before the shrimp seed) loads the SQL, creates the accounts, installs lychee-orchard for LN and runs seed-demo LN; there is no MQTT step. New platform/tests/smoke-sectors.sh (households section: POST /api/farm/households on a no-pack cooperative, the tea search still 403 PACK_NOT_ENABLED, accountant PUT 403, linked phone 409 HOUSEHOLD_PHONE_LOCKED, the unchanged phone 200; lychee section: install, seed totals, isolation, the PHI gate 409 and the 400 window through the gateway, a farmer on another household's block 403, the US batch refused without irradiation then closed with an EXPORT_BATCH_CLOSED audit row and a core.outbox event of LN, --purge keeping the audit) and the story apps/web/tests/e2e/story/lychee-orchard.spec.ts (desktop and phone) run in a new CI job sector-acceptance (timeout-minutes: 45, budget table in docs/dev-setup.md); apps-smoke and browser-store are not changed. The households section needs the shared household page of 1.39.0 (PR #182), so it passes only on a branch that has it. Static test platform/tests/test_sector_demos.py; test_realm_policy.py has three more accounts.
  • lychee-orchard: audit entries and events are written in app mode. Forwarding the user's token made the web answer 401 whenever the token came from a client other than its own (nextjs-web), which failed the first audited write of the sector-acceptance smoke (token of the dxos-smoke client). The plugin now calls the core for audit and events as Caller{Htx} with the app's key, as dragon-fruit does; the person is named by id in the details (recorded_by_sub, voided_by_sub, changed_by_sub, closed_by_sub). The household list is still read with the user's token (Hasura needs it).
  • lychee-orchard, review fixes of part 3: the phi_clear check now also refuses a farmer's draft for a block that is not the sender's household's and a draft dated outside [today - 3, today] (so the sender hears it before approval); notify_phi_ending tells the household first and the office second; seed-demo accepts only LN; the audit entry of record_harvest_lot carries the ids of the recorder and the approver; the preview of notify_phi_ending shows the day as dd/mm/yyyy (label phi_until_vi next to the ISO phi_until).
  • lychee-orchard 0.1.0, part 3 (Phase 4, task 4c): agent actions, phi-watch, check, dashboard and seed-demo. Actions record_harvest_lot (from a message, food_safety: true, risk: medium: never auto-run, bounds 10 t, check phi_clear) and notify_phi_ending; the first goes through the same RecordLot as the form, with source = message, the sender as recorder, the approver in approved_by_sub, and for a farmer sender the block must belong to their household (judged under the block lock). Worker phi-watch (every 1440 minutes, at most 10 blocks whose interval ends tomorrow and that have no lot dated tomorrow), check phi_clear (judged on the Vietnam day of Requested-At, else today), dashboard overview with four cards, and lychee-orchard seed-demo <HTX> (the demo of LN; a rerun on any day adds nothing). Fix round of 4b: the household account is copied again at every block save while the core answers, a change of household is audited (BLOCK_HOUSEHOLD_CHANGED), the core call inside a transaction hook has its own 2 s deadline and a deadline error is a 502, the db-integration step counts the TestPG tests of the package instead of a fixed number. The plugin is complete as a plugin; the demo accounts, install and smoke come in task 5, the release step stays with the controller.
  • lychee-orchard 0.1.0, part 2 (Phase 4, task 4b): server, pages, audit and export events. Routes /blocks, /products, /sprays, /lots, /batches (Go templates, no script, light and dark by /dxos-app.css), gateway guard and claims copied from shrimp-farm, app.yaml (requires.core >=1.36.0, services audit, notify, events; the agent keys, dashboard and demo data come in task 4c). Every write runs in one transaction with the block lock and its audit entries: HARVEST_LOT_RECORDED, SPRAY_VOIDED, PHI_BREACH_FOUND, PHI_BREACH_CLEARED, EXPORT_BATCH_CLOSED, and the event export_batch.closed (output by household, no names, no money). TxHook now receives what was written (spray id, lot code, lots newly flagged or cleared). A farmer writes sprays only on a block whose household account is theirs, judged on the locked block row (OwnerSub). Today is always the Vietnam day. When the core does not take the audit entry or the event the page answers 502 and nothing is stored. CI: the db-integration job now runs the lychee Postgres tests against its throwaway database. Review fixes of part 1: dose and kGy capped under the column types, lots locked in lot-code order on the spray path, indexes on harvest_lots(export_batch_code) and (harvested_on), READ COMMITTED pinned, the Postgres test guard reads the parsed DSN.
  • lychee-orchard, part 1 (Phase 4, task 4a): schema, store and rules, not yet a runnable app. New Go plugin miniapps/lychee-orchard in the shrimp-farm shape (pgx/v5 v5.13.0, FROM scratch): migration 001_init.sql (orchard blocks, spray catalogue, spray log, harvest lots, export batches; every table has htx_code; no CHECK for the PHI gate, because a CHECK cannot read spray_logs), a Store interface with the pgx implementation, and pure rules in rules.go. Rules: harvest date within [today - 3, today] and spray date within [today - 7, today] in the Vietnam day; a lot is allowed only when harvested_on >= max(sprayed_on + phi_days) over every non-void spray of the block, whatever its date; a spray recorded later flags the lots it covers (phi_breach) and a void recomputes the flags; the lot, spray and void paths lock the block row (SELECT ... FOR UPDATE) before reading sprays or lots; export batches hold at most 40 lots, need no breached lot, and need a full irradiation record for US and AU. Unit tests, a fake store for the next tasks, and a PostgreSQL test (set LYCHEE_TEST_DB_URL; refuses hosts other than 127.0.0.1 and localhost) that runs a spray and a lot on one block at once 50 times. The server, pages, manifest and actions come in the next tasks, so the plugin is not installable yet and the release step stays with the controller.

Upgrade notes#

  • No core database migration and no service change. Compared with 1.40.0, docker/ changes only docker/keycloak/realm-agrimarket.json (three demo users), and apps/web/prisma/ does not change; there is no new table, column, service, image or init script change. The web image only carries the new version number. make platform-up / make demo-up (or the release steps in the README, "Nâng cấp một cài đặt đang chạy") are enough.
  • New plugin miniapps/lychee-orchard 0.1.0 (Go), not installed by default. Nothing changes on a stack until you install it: ./dxos install miniapps/lychee-orchard --htx LN (what platform/demo/seed-lychee.sh runs), or for another cooperative the same command with its code. Its own schema app_lychee_orchard is created by its migration 001_init.sql at install; the core schemas are untouched. It needs ./dxos worker like every app, and core >=1.36.0.
  • Demo: make demo-seed-lychee and make demo-up now seed the lychee cooperative LN (demo-up runs it between the TC seed and the shrimp seed). It adds the cooperative "HTX Vải thiều Lục Ngạn" and three households (only when missing, from platform/demo/ln-htx.sql), creates the accounts manager_ln, officer_ln and farmer_ln, installs lychee-orchard for LN only and runs seed-demo LN. It needs postgres and web running, and it is safe to repeat. The realm file docker/keycloak/realm-agrimarket.json is imported only into an empty Keycloak, so on an existing realm the accounts do not appear by themselves: the script creates them by calling ./dxos demo accounts manager_ln officer_ln farmer_ln (with --password "$DEMO_PASSWORD" when you set it; without it a missing user is created with no password, so set one with ./dxos demo accounts --password ... manager_ln officer_ln farmer_ln). No realm reimport is needed.
  • CI: new job sector-acceptance (smoke platform/tests/smoke-sectors.sh, the demo seeds and the lychee browser story; timeout-minutes: 45), and the db-integration job now also runs the lychee Postgres tests (scripts/db-integration.sh). apps-smoke and browser-store are unchanged.
  • Rolling back to 1.40.x needs no script: nothing in the core database or the stack changed. If you installed the plugin, remove it first from the 1.41.0 checkout with ./dxos remove lychee-orchard --purge: it removes the app, its route and the schema app_lychee_orchard, and keeps the audit history and core.outbox (omit --purge to keep the app's data). The LN cooperative, its households and the three Keycloak accounts stay and are harmless on 1.40.x.

[1.40.0] - 2026-12-01#

Added#

  • dxos-cli pip package with dxos init, validate and reuse (Phase 4, SDK). platform/cli is now installable (pyproject.toml, name dxos-cli, version read from dxos_cli/sdk_data/core-version.txt, Python 3.11+, compatible dependency ranges; the operator commands keep psycopg behind the operator extra). The dxos command of the package has only the SDK commands: init <id> --template python|node|go writes a runnable plugin (greeting page from the token claims, open GET /healthz, the gateway key check, a test and a Dockerfile; the listen address comes from DXOS_APP_LISTEN, default :8080) and then runs validate and reuse; validate is the former cmd_validate (moved to dxos_cli/sdk.py, ./dxos validate still goes through Docker and is unchanged); reuse is an approximate per-file SPDX header check that does not replace reuse lint. Outside the repository the commands use the schema, dxos-app.css and core version packaged in sdk_data/ (copies kept equal by the new scripts/sdk-sync.sh, make sdk-sync, make lint and the CI step "SDK Data Check"); inside it, or with DXOS_REPO_ROOT, they use the repo files. REUSE.toml gets an override entry for the template files, whose headers hold the __YEAR__ __PUBLISHER__ placeholders. dxos dev <dir> runs the plugin and stands in front of it as a loopback-only (127.0.0.1) gateway and login simulator, for development only: an unsigned token with the claims the plugins read, a random gateway key per run, routes matched with the manifest rules, a foreign Host or Origin and Sec-Fetch-Site: cross-site refused, the whole process group stopped on exit. It does not simulate the agent, the actor, the core services (answered 501 CORE_NOT_SIMULATED) or Hasura. CI job sdk-quickstart (templates python, node, go on Python 3.12, python also on 3.11) installs the package from the repo path outside the repository and runs init, validate, the template test, dev and a health check under a 300 second limit, then builds each template image and checks /healthz of the running container; it does not need the stack. docs/miniapps.md section 9 is now "Năm phút với dxos" and the Go skeleton block points to the Go template; docs/dev-setup.md has the post-release check of the pip install.

Upgrade notes#

  • No database migration and no service change. No new table, column, service, image or init script change; only the web image carries the new version number, and platform/cli is a separate pip package that is not part of any image. make platform-up / make demo-up (or the release steps in the README, "Nâng cấp một cài đặt đang chạy") are enough.
  • New CLI package for plugin authors. Install it outside the repository with pipx install "dxos-cli @ git+https://github.com/maiychrus25/[email protected]#subdirectory=platform/cli" (Python 3.11 or later; not on PyPI), or with pip install -e platform/cli inside a clone. The commands (dxos init, validate, reuse, dev) are listed in platform/cli/README.md and in docs/miniapps.md sections 9 and 11; the root README has a short block that points there.
  • psycopg moved to the operator extra. A plain pip install dxos-cli no longer installs it. Only the operator commands (python -m dxos_cli, which the dxos bash script runs inside the CLI image) need it; the CLI image still installs psycopg from platform/cli/requirements.txt, so nothing changes for ./dxos. Install dxos-cli[operator] yourself only if you run those commands on the host.
  • The bash ./dxos is unchanged, including ./dxos validate, which still goes through Docker. The pip dxos command is a different, SDK-only entry point.
  • Rolling back to 1.39.x needs no script: nothing in the database or the stack changed.

[1.39.0] - 2026-12-01#

Added#

  • Household page and API for every cooperative (spec 2026-12-01-v2-phase4-sectors-and-sdk-design.md §4.1, Phase 4 Task 1). /manager/households is new (menu "Nông hộ" for managers, after "Quản lý thành viên"); /officer/households now shows the same shared list to every cooperative. A cooperative without tea-core sees members and contacts only: no parcel, area, share bar or detail link, and the "Quản lý thành viên" list has no parcel or area columns (table and CSV). Each household has a Sửa button that edits owner name, phone and address in place. The paths /manager/households, /officer/households, /api/farm/households and /api/farm/households/<id> are core in pack-paths.ts; the tea household detail pages stay tea. The Telegram household.add action admits managers as well as officers.

Changed#

  • POST /api/farm/households admits manager as well as officer (other roles still 403).
  • PUT /api/farm/households/[id] admits officer, manager and farmer (own household only); accountant gets 403 (it used to be able to edit). Changing the phone of a household linked to an account answers 409 HOUSEHOLD_PHONE_LOCKED; the chat household.edit action is refused with the same rule.
  • Form controls of the households page are at least 44 px tall (tap target).

Upgrade notes#

  • No database migration. No new table, column, service or init script change, so make platform-up / make demo-up (or the release steps in the README, "Nâng cấp một cài đặt đang chạy") only need the new web image. The web image must be rebuilt or pulled: the households page, the two household routes and the menus are web code.
  • The household list page and API are core for every cooperative. /manager/households, /officer/households, /api/farm/households and /api/farm/households/<id> no longer need tea-core, so a cooperative of any sector (for example ST, with no pack) reads the shared list. A cooperative without tea-core sees members and contacts only; the tea household detail pages stay tea. GET /api/households (the tea route) still answers 403 PACK_NOT_ENABLED there.
  • Managers can create households. POST /api/farm/households admits manager as well as officer; accountant and farmer still get 403. The Telegram household.add action is open to officer and manager for the same reason.
  • Accountants can no longer PUT a household. PUT /api/farm/households/<id> admits officer, manager and farmer (own household only); accountant gets 403 where it used to be able to edit. Tell any accountant who edited households that the page is now read-only for them (Hasura read access from 1.38.0 is unchanged).
  • A linked household's phone is locked. Changing phone of a household that has a keycloak_user_id answers 409 HOUSEHOLD_PHONE_LOCKED (the chat household.edit action is refused the same way); owner name and address of that household can still be changed.
  • Members lists hide the parcel columns for non-tea cooperatives. "Quản lý thành viên" (table and CSV export) has no parcel or area columns when the cooperative lacks tea-core; a script that reads those CSV columns for a non-tea cooperative must stop expecting them.
  • Rolling back to 1.38.x needs no script (README, "Lùi về bản trước", PREV=1.38.0). Nothing in the database changed, so the web goes back and nothing else; the households page of a non-tea cooperative is then gone again.

[1.38.0] - 2026-12-01#

Added#

  • Phase 3 acceptance map and the upgrade path 1.33.0 to 1.38.0 (v2.0 phase 3, task 8): the 13 acceptance items of the Phase 3 spec are mapped to the CI assertions that prove them (## Ghi chú sau triển khai of docs/specs/2026-12-01-v2-phase3-agentic-workshop-design.md; item 8 of the Zalo flow is deferred until the Zalo API is confirmed). docs/dev-setup.md gets the 1.38.0 row of the upgrade table and the section "Chưa kiểm với API Zalo thật". CI: browser-core seeds one decided and three open proposals (platform/tests/seed-command-center.sh) and runs tests/e2e/agent/command-center-v2.spec.ts on desktop and mobile, light and dark.
  • PUT /files/content?key= for plugins (app core API, service files): a plugin on dxos-apps-net (internal, only apisix and postgres) cannot reach the upload_url of POST /files, which is signed for the public S3 address, and its pages run without script, so neither the app nor the browser could upload a file. The app now sends the bytes through the gateway: the key must be one POST /files gave the same app and cooperative (403 KEY_NOT_OWNED), is written once (409 FILE_EXISTS, so bytes the scanner judged are never replaced), the body is at most 10 MB (413 FILE_TOO_LARGE, checked on Content-Length and again while reading), and its first bytes must match the declared type (400). The object lands in agrimarket-private and waits for dxos-scanner like any upload, so GET /files/status says pending until it is scanned. Needed by shrimp-farm for the quarantine certificate of a seed batch (spec 2026-11-30, PR 2). GET /files/content?key= is its pair for reading: the bytes of a clean file (409 FILE_NOT_CLEAN while pending, quarantined, missing or replaced during the read; 413 over 10 MB), with nosniff and no-store. A plugin page cannot redirect to the presigned URL of POST /files/download-url (the web answers 502 for a redirect out of /apps/<id>/), so shrimp-farm streams quarantine certificates and incident photos back itself as an attachment.
  • shrimp-farm 0.7.0 — canal routes and stocking plans (spec 2026-11-30-shrimp-farm-v1-and-coop-plugins-design.md, PR 1, Q0 and Q1). Migration 002_canals_and_plans.sql adds canal_routes (code, name, tide zone, water_intake_status OPEN / ADVISORY / BLOCKED_DISEASE), six columns on ponds (household_id, canal_route_code, farming_mode THAM_CANH / QCCT, aquaculture_reg_no, vietgap_certified, disease_lock, withdrawal_until; every one nullable or with a default, so the ponds of 0.1.0 stay valid as intensive ponds without a canal) and crop_plans. New pages /canals (manager, officer) and /plans (all three roles read; manager and officer plan and cancel). Two PLANNED plans on one canal route may not share a water intake day (both ends count); the check holds a row lock on the canal, so plans saved at the same moment are checked one after the other. The plan page sums the planned seed per season. The household of a pond is read from Hasura with the user's token and must be one the user can see; a pond with open plans cannot change canal. seed-demo adds canals K1 (A1, A2) and K2 (B1).
  • shrimp-farm 0.7.0 — hatcheries, quarantine certificates and seed batches with the Seed Gate (spec PR 2, Q2). Migration 003_seed_batches.sql adds hatcheries, quarantine_certs and seed_batches; the batch's foreign keys to its certificate, plan, hatchery and pond all carry htx_code. New pages /hatcheries (only the manager approves a hatchery), /certificates (the photo or PDF goes to the core's file store through POST /files and PUT /files/content, at most 10 MB, type decided from the bytes; the list asks the core for each scan result and opens clean files through GET /files/content) and /seed-batches. A batch is saved only when the core says its certificate's file is clean at that moment (422 while pending or quarantined, 502 when the core cannot say), from an approved hatchery, with a certificate of that hatchery. End-of-season survival scores the hatchery. The manifest declares the files service (requires.core >= 1.36.0).
  • shrimp-farm 0.7.0 — drug catalogue, pond log, disease reports and canal advisories (spec PR 3, Q4 to Q6). Migration 004_pond_health.sql adds aquaculture_drugs, pond_events (never changed, one correcting line each; a DRUG line keeps the drug's withdrawal days), disease_incidents, water_advisories and ponds.household_user_id. Pages /drugs (only the manager approves), /pond-log (a farmer writes only for their own household's ponds; an officer's line for a household is marked on behalf) and /incidents (up to three photos through the core's file store), and an advisory form on /canals. Gates: a DRUG line sets withdrawal_until again from every uncorrected DRUG line, and a lot cannot be closed until the withdrawal has passed (409, the lot point of the Triple Red-Lock); an open disease report locks the pond and refuses letting water out (409); a canal blocked for disease refuses taking water in (409). A report tells the manager and the officer the pond, and the households of the other ponds on the canal only that their canal has a suspected pond; a farmer sees only the reports of their own ponds. An advisory sets the canal's intake state and tells its households.
  • shrimp-farm 0.7.0 — harvest schedules, joint lots, size-banded quotes and weigh tickets with the Dual-Confirm Gate (spec PR 4, Q7). Migration 005_harvest_sales.sql adds harvest_schedules, lot_rfqs, lot_rfq_items (a schedule in one lot only), buyer_quotes, weigh_tickets (whole grams and dong; net and amount rounded half up) and harvests.rfq_id with a unique index per joint lot and pond. Pages /harvest-schedules and /lots (only the manager awards a buyer), and a public page per ticket where the buyer, who has no account, confirms through a 128-bit address shown as a QR code at the pond bank. The Triple Red-Lock now refuses a schedule inside the withdrawal, a weigh ticket while today is inside it, and closing while today or the day the lot is dated is inside it (so a harvest cannot be dated back into the withdrawal, on the Harvests page too). Making a joint lot checks again, under a share lock of the pond row: a pond drugged after its schedule cannot be offered for a harvest day inside the withdrawal. Closing needs every live ticket confirmed by the member (or by the office on their behalf, recorded) and the buyer, then makes one traceable, audited lot per pond; closing again after an audit failure makes no second lot. A farmer sees the lots and tickets of their own ponds; quotes are public to the lot's members. The menu keeps "Thu hoạch" before "Lịch thu hoạch", which the browser story finds by text.
  • shrimp-farm 0.7.0 — pond-watch reminders (spec section 4). After the oxygen alerts (while keeping event-driven oxygen threshold alerts and Telegram record_feeding intake from 0.2.0/0.3.0), the scheduled worker suggests notify_pond_reminder on the first day of the 20 to 45 and 60 to 65 day watch windows after the newest stocking of a pond (subject per pond, batch and window, so each window is announced once), and for a harvest in the next 14 days that falls inside a drug withdrawal written after it was scheduled. The approved action checks the reason again, tells the manager and the officer, then the pond's household when it has an account on file. A failure to read the reminders does not drop the oxygen alerts.
  • coop-finance 0.1.0: joint purchase and internal lending for every cooperative (spec 2026-11-30-shrimp-farm-v1-and-coop-plugins-design.md, PR 5, Q3). A horizontal Go plugin (FROM scratch, no pack). The manager sets the lending pool and its two caps (default 5 %, at most 5 %, also a database CHECK); the manager and the accountant make one contract per household and season (household read from Hasura with the user's token) and record repayments; joint purchases compare supplier prices and the manager picks one; deliveries on credit become disbursements only when the member themself confirms receipt, written to the core's audit chain (LOAN_DISBURSED, LOAN_REPAID) before they count. Gates, run under a row lock on the cooperative's pool: a household's principal plus pending deliveries may not pass the member cap; no new delivery or confirmation anywhere while overdue principal is above the overdue cap; a pending delivery is never debt. Money is whole dong, shares basis points. The legal reading of the caps is not yet confirmed (README). CI runs its go vet and go test.
  • coop-ledger 0.1.0: the cooperative's ledger, season settlements and the yearly distribution (spec 2026-11-30-shrimp-farm-v1-and-coop-plugins-design.md, PR 6, Q8 and Q9). A horizontal Go plugin (no pack). Postings split INTERNAL (with a member) and EXTERNAL, carry the member's use of services, are idempotent per voucher and never changed. A season settlement is sales less principal, interest and fee (a database CHECK), issued with a due day exactly seven days later and audited; a negative net stays owed (issued, never marked paid: no button, and the update requires net_vnd >= 0). The yearly distribution keeps a fund share of the internal result, never shares a loss or the external result, and divides the rest by use of services with the largest remainder method so the lines add up to the dong; a supervisory-board member named in the app (the core has no supervisor role yet), never the preparer (also a CHECK) nor a manager, checks it, then the manager records the general assembly's approval, audited. Issuing a settlement and recording the approval write their audit event inside the transaction, before the commit (as ConfirmDelivery in coop-finance): when the core does not take the event, nothing changes and the page answers 502. Members see their own issued settlements and approved benefit slips. Until core.outbox, amounts are entered by hand. The legal reading is not yet confirmed (README). CI runs its go vet and go test.
  • Hasura: accountant reads the households of its cooperative (core_households.yaml: id, name, keycloak_user_id, htx_profile_id; core_htx_profiles.yaml: id, name, htx_code), filtered on htx_code with the htx_code <> '' guard. coop-finance and coop-ledger query households with the accountant's own token and X-Hasura-Role: accountant; before this the query failed and the pages answered 502. Pinned by platform/tests/test_hasura_accountant_permissions.py.
  • Mini-app dragon-fruit 0.1.0, part 1 (spec docs/specs/2026-11-30-dragon-fruit-plugin-design.md, PR 1 of 5): a Go plugin for a dragon fruit cooperative that exports, built on the shrimp-farm pattern (FROM scratch, uid 10001, pgx, no script in the pages) and on the plugin contract only, with its tables in schema app_dragon_fruit (migration 001_init.sql): export markets and what each asks of a lot (growing-area code, packing facility code), growing-area codes (PUC) with markets and validity, packing facilities (PHC), orchards with pillar count, variety and growing-area code, flowering cycles (several open at once on one orchard: natural and lighting overlap, moving one way from open to harvesting to closed) and night-lighting logs (pillars lit capped by the orchard's pillars; only a manager or officer marks electricity the cooperative paid in advance). Every table has htx_code and every foreign key is the pair (htx_code, id). Certificate scans (VietGAP, PUC, PHC) are sniffed from their bytes (PDF, JPEG, PNG, WebP, up to 10 MB), stored through the core's files service (POST /files and PUT /files/content) and streamed back as attachments through GET /files/content only when the scanner found them clean. Household names come from Hasura with the user's own token, for managers and officers only. The manifest declares the cold_room asset type (AgriWarehouse, temperature and humidity) and an overview dashboard. CI runs its go vet and go test.
  • Mini-app dragon-fruit, part 2 (PR 2 of 5): the multi-market PHI gate and intake tickets. Migration 002_intake_phi.sql adds the pesticide catalogue (markets that ban a product), the pre-harvest interval of each product per market, the cultivation log, fruit grades, daily prices and intake tickets. The log is append-only: a trigger refuses UPDATE and DELETE, and a wrong line is replaced once by a correcting line. Before a ticket is saved, the store locks the orchard (SELECT ... FOR UPDATE, which writing a log line also takes), reads every spray of the last 365 days up to the harvest date (a correction stands for the line it replaces) and the pure CheckPHI refuses with 409 when a product is banned for the market, has no interval declared for it (fail closed), or the harvest date is before the spray date plus the interval; the Vietnamese message names the product, the market and the first date allowed ("còn 11 ngày"), and the same orchard still delivers to a market whose interval has passed. The unit price is copied from the day's price list into the ticket; a missing price is also a 409. Voiding a ticket needs a reason. Two more overview cards: today's intake in kilograms and tickets.
  • Mini-app dragon-fruit, part 3 (PR 3 of 5): packing batches, export lots, the public trace page and labels. Migration 003_packing_lots.sql adds the cooperative's settings (shrinkage threshold, default 8%), packing batches, the tickets of each batch (UNIQUE (htx_code, ticket_id)), export lots (one per batch) and a per-day lot counter. A batch holds tickets of one market only (market segregation gate, 409), its input weight is the sum of its tickets and its output may not exceed it (mass-balance gate, 422; also a CHECK); a shrinkage above the threshold needs a reason and notifies the managers. A ticket that went into a batch can no longer change or be voided (trigger), and batches and lots are append-only. A lot is made behind the PUC & PHC gate: for a market that requires them, every orchard of the batch needs a growing-area code listing the market and valid on the export day, and the facility a code listing the market and not expired; one orchard failing blocks the whole lot (409) and the message names every orchard that fails. Lots are numbered DF-<HTX>-<YYYYMMDD>-<n> in the same transaction that writes EXPORT_LOT_CREATED into the core's SHA-256 audit chain, so no lot exists without its event. The public page /public/<HTX>/lot/<token> (a random 128-bit token) shows growing-area codes, flowering cycles, harvest dates, sprays with their interval for the lot's market, the packing facility, certificates on file and the chain verdict, never a household, a person or a price; a printable label carries the lot and the QR code of that page.
  • Mini-app dragon-fruit, part 4 (PR 4 of 5): cold rooms, the orchard-and-cold-watch worker and the BT demo. Migration 004_cold_watch.sql adds cold rooms (each registered as a core entity of kind cold_room, so its temperature and humidity sensors publish over MQTT) and watch_alerts, which keeps the worker from suggesting the same alert twice a day. Lots name an active cold room, and the public trace page shows the room's temperature range since packing (read in app mode, cached for a minute). The worker, every 30 minutes, only suggests: a cold room outside its range (default 5 to 8 °C) on a current reading, the orchards to harvest within 7 days whose interval for CN or EU has passed (and whose growing-area code allows the market), and growing-area or packing facility codes that expire within 30 days; three approved actions (notify_cold_room, notify_harvest_ready, notify_code_expiry) read the data again and notify through the core, and a 429 of the core becomes a 424 with a Vietnamese explanation. dragon-fruit seed-demo <HTX> and make demo-seed-dragon-fruit (platform/demo/seed-dragon-fruit.sh, called by make demo-up after the shrimp step) make the scene of spec section 5 for cooperative BT: four orchards on two growing-area codes, overlapping cycles, a lighting advance, a fungicide sprayed 10 days before, the usual markets, grades and prices, and 24 hours of cold room readings ending above 8 °C. New demo cooperative BT (demo-cooperatives.ts, platform/demo/bt-htx.sql), realm users manager_bt, officer_bt, farmer_bt (./dxos demo accounts accepts them by name), a BT broker account in docker/.env.local.example, and a CI step that seeds BT and runs the story apps/web/tests/e2e/story/dragon-fruit.spec.ts. The finance part (PR 5: core.outbox to coop-finance and coop-ledger) follows in a separate PR.
  • Mini-app dragon-fruit, review fixes of #161 and #173: a farmer writes cultivation log lines and night lighting only for the orchards of their own household (checked through Hasura with the farmer's own token; no answer from the core writes nothing, 502; another household's orchard or one with no household is 403), and corrects only lines they wrote themselves, so no farmer can lift another household's PHI wait by correcting a spray to watering. Certificate uploads and downloads now go through the core gateway routes PUT /files/content?key= and GET /files/content?key= (streaming attachments instead of redirecting out of /apps/dragon-fruit/). The dragon fruit palette moved from an inline <style> (which the web proxy's style-src 'self' drops) to the app's stylesheet static/dragon-fruit.css, served at /field/dragon-fruit.css for signed-in pages and /public/<HTX>/dragon-fruit.css for the public trace page, and the Playwright story waits for each iframe form POST and frame navigation before reading gate alerts. The spec docs/specs/2026-11-30-dragon-fruit-plugin-design.md is now in the branch.
  • Trung tâm duyệt v2 trên /manager/ai và /officer/ai: làn «Cần duyệt» nhóm theo rủi ro, duyệt theo lô (tối đa 50, cùng loại), chip luật từ verdict đã lưu, ảnh bằng chứng, làn «Tự chạy» với nút Chặn và liên kết ?proposal=<id> mở đúng thẻ.
  • Trang /platform/zalo có ô App ID và khoá ký webhook (khoá chỉ ghi).

Upgrade notes#

  • No migration and no new core table or column. The release has no new service and no init script change. Build or pull the new web; the usual make platform-up / make demo-up (or the release steps in the README) is enough.
  • Restart Hasura. The metadata gives the accountant role read access to households and htx_profiles of its own cooperative (coop-finance and coop-ledger read them with the accountant's token). Hasura reads metadata only at start: make platform-up / make demo-up restart it, a release package needs restart hasura apisix.
  • New core route for apps. PUT /files/content (service files) lets a plugin on the internal app network upload a file it got a key for. shrimp-farm 0.7.0 uses it for certificates, so its manifest requires core >=1.38.0: upgrade the core first, then run ./dxos upgrade miniapps/shrimp-farm. The app migrations 002 to 005 belong to the app and run on that upgrade; coop-finance and coop-ledger are new apps that nobody has installed until ./dxos install.
  • shrimp-farm 0.7.0 needs core 1.38.0 or later (requires.core >=1.38.0; it was >=1.36.0 while the file upload route did not exist yet). ./dxos upgrade refuses it on an older core.
  • coop-finance 0.1.0 and coop-ledger 0.1.0 need core 1.38.0 or later (requires.core was >=1.27.0): they read households with the accountant's own token, which Hasura allows only with this release's metadata.
  • The command center is UI only. /manager/ai and /officer/ai show the two lanes, batch approval, rule chips and evidence photos from data 1.34.0 to 1.37.0 already store. Nothing in Zalo changes: inbound stays closed (ZALO_INBOUND_VERIFIED = false, CS_API_VERIFIED = False), see docs/dev-setup.md, "Chưa kiểm với API Zalo thật".
  • Rolling back to 1.37.0 needs no script (README, "Lùi về bản trước", PREV=1.37.0). The web goes back; the Hasura metadata goes back with its restart. If shrimp-farm 0.7.0 is installed it keeps running, but certificate uploads answer 404 until the web is 1.38.0 again, and the household reads of coop-finance and coop-ledger answer 502 on the old metadata. The app tables stay; app migrations are not reversed.

[1.37.0] - 2026-12-01#

Added#

  • Zalo inbound: signed webhook seam, replay and duplicate guard, one-time link codes, image relay (v2.0 phase 3, task 6a):
  • POST /api/public/zalo/webhook (public; APISIX route zalo-webhook: 120 requests per 60 s per source IP, 64 KB body cap, also enforced in the web with 413). Order of answers: 413, 503 ZALO_INBOUND_NOT_VERIFIED, 401 (bad signature, timestamp more than 5 minutes off), then 200 {} for every accepted, duplicate or ignored event. One msg_id is one row in platform.zalo_inbound; rows older than 7 days are deleted on each insert.
  • Not confirmed from Zalo's official documentation: the signature formula and header, the event JSON shapes and the image hosts (the developers.zalo.me pages render with JavaScript and could not be read automatically; a third-party formula was deliberately not used). Everything else is built behind one function, verifyAndParseZaloEvent, which refuses every request with 503 ZALO_INBOUND_NOT_VERIFIED until the formula is read from the official page. ZALO_MEDIA_HOSTS stays empty for the same reason, so no image is downloaded yet.
  • Linking: POST|DELETE /api/zalo/link, GET /api/zalo/link/status, a "Kết nối Zalo" card on the three profile pages. A 96-bit code (the Telegram generator), valid 10 minutes, single use, hash only; a text equal to a live code links the sender; an unlinked sender gets the instructions. Text of a linked sender reaches the ZaloIntake seam, which task 6b connected to the text chat (below).
  • Relay dxos-zalo: GET /api/internal/zalo/media/pending and POST /api/internal/zalo/media; media.py downloads only from the host list, at most 5 MB, JPEG or PNG by magic bytes, no redirect to another host; the stub image host serves a PNG, a JPEG, a GIF and an over-size JPEG.
  • Database (additive, 10-zalo.sql, 09-telegram.sql): zalo_links (audited), zalo_link_codes, zalo_inbound, zalo_conversations; zalo_credentials.app_id and webhook_secret_enc (set with PUT /api/platform/zalo/credentials, the key is never returned); assistant_requests.channel and zalo_user_id with telegram_user_id and chat_id now nullable under a CHECK that keeps exactly one identity per channel.
  • Until the seam is confirmed (ZALO_INBOUND_VERIFIED = false, next to verifyAndParseZaloEvent) or while the app id and key are not set, GET /api/zalo/link/status answers available: false, the "Kết nối Zalo" cards (farmer, officer, manager and accountant profile pages) render nothing and POST /api/zalo/link answers 409 ZALO_INBOUND_UNAVAILABLE. The copy names "Zalo OA của nền tảng" (one platform OA).
  • Gateway: platform/gateway/config.yaml now loads client-control (its plugins: list replaces APISIX's default, so the zalo-webhook route was dropped without it). A test checks that every plugin named in apisix.yaml and in the routes gateway-sync generates is in that list.
  • Relay: the media loop starts only when the host list is not empty and polls every 10 s when idle (the outbox shares the same per-token rate limit); the relay has no environment setting for the host list or for plain http. An event with a msg_id over 128 characters is ignored; the webhook stops reading a body at 65 537 bytes even without a Content-Length. The app id is any [A-Za-z0-9_-]{1,64} (its shape is not confirmed).

  • Zalo replies, text chat, plugin channel zalo (v2.0 phase 3, task 6b):

  • platform.zalo_cs_outbox (additive, 10-zalo.sql; not audited): kinds chat, result, plugin_notify; text 1 to 2000 characters; at most 6 attempts, then failed; the backoff of the template outbox (retry_after_seconds, else 5 s doubling to 15 min); no quiet hours. The relay leases with GET /api/internal/zalo/cs-outbox?limit=1..20 and reports with POST /api/internal/zalo/cs-outbox/{id}/result {ok, zalo_msg_id?, error?, retry_after_seconds?, permanent?, out_of_window?}; out_of_window makes the row skipped, and for a result the requester also gets an in-app notification with the same text.
  • A user draft with reply_channel = zalo is answered on Zalo through that queue (to the sender's active Zalo link in the same cooperative), and in the app when there is no link; never for an agent proposal or an auto-run.
  • ZaloIntakeEngine: text-only chat for the plugin actions that take user drafts (origins has user, the sender's role in starters); the built-in tea flows stay Telegram-only and A7 gets the plugin actions only for a Zalo request (assistant_requests.channel = 'zalo', new createForZalo; a Zalo request that expires is answered through the same queue). Choices are numbered (1. …; Có/Không for booleans), an answer is the number or the exact label, a number outside the list repeats the question, numbers and text are checked like on Telegram (the plugin's reason_vi on a bound), the card ends with "Gửi" / "Huỷ" (with or without marks). State is kept in zalo_conversations for 15 minutes; the draft is named zalo:<msg_id of the first message>; the live role is read again on every message (roles.read). The engine has no way to decide a proposal: approving stays on Telegram and the web. A checked image answers a required photo step, anything else gets "Mình chưa cần ảnh lúc này." (the image is not stored).
  • Plugin POST /notifications accepts channels: ["zalo"] next to in_app and telegram: only members with an active Zalo link of the cooperative are reached (rows of kind plugin_notify), inside the same 30 calls an hour; queued.zalo appears only when the channel was asked for. While nobody can link, it queues nothing.
  • The webhook queues its own replies into zalo_cs_outbox: the link instructions for an unlinked sender (kind = link_help, no cooperative, at most one per Zalo user in 10 minutes) and the "linked" confirmation (kind = link_done, under the link's cooperative). htx_code is nullable only for those two kinds (CHECK); the relay's claim route hands them out like any row. The DDL moves a 1.37.0 table made by an earlier build (idempotent).
  • The CS lease route expires only the Zalo assistant requests (expire(now, 'zalo')); the Telegram expiry and its timeout reply stay on the Telegram outbox route. An answer of the assistant starts a flow only while it is still the request the member waits for (carried in zalo_conversations.state.__request_id); after "Huỷ" or a newer sentence it is dropped silently.
  • A failure inside the intake removes the dedupe row of the event, so Zalo's retry is processed (the 6a known limit for the intake step).
  • Not confirmed from Zalo's official documentation: the consultation (CS) message API (URL, body, response field, the error code of "outside the interaction window"). The page "Gửi tin Tư vấn dạng văn bản" (https://developers.zalo.me/docs/official-account/tin-nhan/tin-tu-van/gui-tin-tu-van-dang-van-ban) renders with JavaScript and an automated fetch returned only its title. The relay's one function send_cs_message (platform/zalo/dxos_zalo/cs_api.py) therefore refuses without any network call while CS_API_VERIFIED = False, and the relay does not lease the rows at all, so replies stay pending (no attempt is spent, nothing is marked failed). The endpoint written there is the shape the code expects, not a confirmed one.
  • Zalo end-to-end smoke deferred. It needs a signed event, so it waits for verifyAndParseZaloEvent. To turn the whole Zalo path on: (1) fill verifyAndParseZaloEvent and set ZALO_INBOUND_VERIFIED = true; (2) fill ZALO_MEDIA_HOSTS; (3) confirm the CS API and set CS_ENDPOINT, the body, CS_OUT_OF_WINDOW_CODES, the permanent error codes (none is reported permanent yet, so a user who does not follow the OA would be retried 6 times) and CS_API_VERIFIED = True; (4) write smoke-zalo steps: link farmer_st, send the shrimp sentence, answer the numbered steps and "Gửi", approve on Telegram, check the feedings row and the "Đã ghi: …" CS message at the stub, and the link instructions for an unlinked sender. Unit and integration tests cover the pieces (engine, outbox, reply, channel, relay against the stub, real-Postgres repositories).
  • Database (additive): platform.zalo_cs_outbox. Stub: POST /v3.0/oa/message/cs (same fail-next queue as the template call).

Upgrade notes#

  • Run the init scripts before the new web starts. make platform-up / make demo-up apply platform/postgres/init/09-telegram.sql and 10-zalo.sql. The web selects zalo_credentials.app_id and webhook_secret_enc, so until the columns exist the Zalo relay's token fetch and the platform admin's credentials page fail. All changes are additive (new tables, nullable columns, assistant_requests.telegram_user_id and chat_id lose NOT NULL under a CHECK that existing rows satisfy). To roll back, return to the previous image and leave the tables and columns in place.
  • Run make gateway-sync and restart apisix so the new public route zalo-webhook and the client-control plugin are loaded (config.yaml is mounted, not generated).
  • Nothing is reachable from Zalo yet. Inbound stays closed (503 ZALO_INBOUND_NOT_VERIFIED, cards hidden) until someone reads Zalo's official webhook documentation and fills in verifyAndParseZaloEvent and ZALO_MEDIA_HOSTS. Then: the platform admin sets app_id and the webhook key with PUT /api/platform/zalo/credentials, and a public HTTPS URL is forwarded to APISIX port 9080 (/api/public/zalo/webhook). Use a plain TCP forward or enable real-ip: behind a reverse proxy every caller, Zalo included, shares one 120 per 60 s bucket on remote_addr.
  • Replies and the chat need no new setting; the relay needs no new environment variable. The relay image sends consultation replies only after CS_API_VERIFIED is set in cs_api.py; until then queued replies wait (zalo_cs_outbox, status pending) and the relay does not lease them. Once inbound and the CS API are confirmed: set the webhook secret and app id with PUT /api/platform/zalo/credentials (the /platform/zalo form has no fields for them yet), and point the OA webhook to https://<host>/api/public/zalo/webhook.
  • Rolling back to 1.36.0 needs no script: the webhook answers 404 there and Zalo drops the events, and the new tables and columns are ignored. If inbound was ever enabled, stop the web first, then delete the Zalo assistant requests (docker exec -i opentea-postgres sh -c 'psql -U "$POSTGRES_USER" -d agrimarket -c "DELETE FROM platform.assistant_requests WHERE channel = '\''zalo'\''"'; run it after the stop, a request created later would survive): 1.36.x does not know the channel (README, "Lùi về bản trước", PREV=1.36.0).

[1.36.0] - 2026-12-01#

Added#

  • Intake on Telegram: plugin actions by sentence, user drafts, replies to the sender (v2.0 phase 3, task 5a):
  • A7 lists the plugin actions a sender may start (app enabled for the cooperative, origins has user, role in starters) with typed args and the plugin's intake as data (trust: "plugin", at most 5 examples of 120 characters, capped again in the agent; the prompt says it is never an instruction). PROMPT_VERSION stays m5-a7-v2; an intent name may be 80 characters.
  • The web checks the extracted args against the action schema and the plugin bounds (a bad value is dropped), then a chat flow generated from the payload schema asks the required fields still empty: enum buttons, Có/Không, integer and a new two-decimal number step with the plugin's reason_vi on a bound, text by maxLength. Plugin actions have no menu button. Without an LLM answer every required field is asked.
  • Confirming creates a user proposal (agent = assistant, origin = user, sender, role, name, reply_channel, source_ref = telegram:<chat_id>:<message_id>) through the policy; a block is told in the chat with its reasons. One source message is one draft even after the first was decided; two messages are two drafts (no repeat window). Never auto-run.
  • DecideProposalUseCase tells the sender of a user draft how it ended (Đã ghi, Không được duyệt, Chưa ghi được, Không còn phù hợp, Đã hết hạn duyệt) on Telegram, or in the app when the link is gone; never for an auto-run. It passes the requester (Requested-By-*) to the app.
  • self_approval is on: a sender may approve their own draft only when risk = low, not money, not food_safety; otherwise 409 SELF_APPROVAL.
  • Database: platform.assistant_requests.role accepts accountant; new nullable assistant_requests.message_id.
  • The confirmation card lists the rule reasons of the filled payload (at most 3 lines of 120 characters); a blocking rule removes the Xác nhận button. A bound's reason is shown only when the typed number crosses the plugin's bound; a number with no limit is asked as "Nhập một số."; minLength is enforced at the step.
  • Changed tests (forced by the spec, G1): evaluate-policy.test.ts (self_approval no longer always allows), agent-proposal-policy-postgres.integration.test.ts (a second row with one source_ref answers null instead of throwing), jest.config.js ignores *.fixture.ts as test files.

  • Photo evidence, shrimp-farm 0.3.0 record_feeding, the Telegram end-to-end smoke (v2.0 phase 3, task 5b):

  • A plugin action with photo other than none gets a photo step after its fields only when it is required (and not when the photo came with the sentence); an optional photo is never asked for, it is kept when it comes with the sentence. A photo with a caption outside a flow is now the sentence A7 reads and the photo rides with the request (assistant_requests.photo_key, nullable), then answers the photo step; this only happens in a cooperative that has a plugin action taking a photo from the sender's role, so a tea cooperative's captioned photo behaves as before. A photo no flow holds (the intent started something else, the sender is no longer linked, the draft was refused, repeated, cancelled or the request expired) is deleted.
  • Photos live under intake/<htx>/<uuid>.jpg|png (intakePhotoKey) in agrimarket-private, where dxos-scanner already looks. The draft cites the photo as an evidence row of table file (id = key, values = {sha256 of the bytes, content_type, size_bytes}). The new file evidence loader accepts only a key under the proposal's own intake/<htx>/, hashes the object again at each decision (the plugin action's staleness check runs it over the proposal's file rows): a missing, quarantined or replaced photo makes the proposal stale with the reason "Ảnh đính kèm đã bị xoá, bị cách ly hoặc đã thay đổi."; a storage failure is "could not check" (503 POLICY_CHECK_UNAVAILABLE at create and decide, the proposal stays proposed and the decision can be tried again; a read that takes longer than 3 s counts as a failure), never "missing".
  • New GET /api/agent/proposals/{id}/evidence-file?key= (manager, officer): 302 to a presigned URL valid 60 s once the scan is clean, 409 FILE_PENDING_SCAN, 410 FILE_QUARANTINED, 404 NOT_FOUND for another cooperative's key, a key the proposal does not cite or an unknown proposal. It has a row in the Telegram coverage table.
  • shrimp-farm 0.3.0 (requires.core >=1.36.0, agent.checks_path: /agent/checks): action record_feeding ("Ghi nhật ký cho ăn", risk: low, money: false, approvers officer and manager, origins: [user], starters farmer, officer, manager, editable: [amount_kg], photo: optional) with pond_code 1-40, feed_type 1-60 and amount_kg an integer from 1; guardrails.bounds.amount_kg.max = 200 with its reason, guardrails.checks: [pond_active] and the example "ao A1 cho ăn 12 kg thức ăn số 2" (plus a description for each field, which the chat asks with). POST /agent/actions/record-feeding writes a feedings row recorded by the sender (Requested-By-*, not the approver) on the Vietnam day of Requested-At; no sender is 400 "Thiếu người ghi nhật ký." and an inactive pond is 400, and so is an amount_kg over the 200 kg bound (the app re-checks it and answers with the bound's reason_vi, in case a caller bypasses the web policy). GET /agent/checks/pond_active?pond_code= answers {ok, reason_vi} for any starter role. No migration.
  • CI: platform/tests/smoke-intake.sh, sourced last by smoke-agentic.sh (so it adds no PASS line to platform-smoke, and smoke-apps.sh keeps its count), runs the done-when on Telegram for the ST farmer: the sentence through A7 and the LLM stub, the card, the signed approve button of the ST manager, a feedings row recorded by the farmer on today's Vietnam date, audit.verify_chain(), and "Đã ghi:" in the farmer's chat. Then: the same message again (still one proposal), 250 kg refused with the reason of the bound and no proposal, a manager's own low draft sent and approved, and a captioned photo that becomes a file evidence row and executes. stub_llm.py also reads the sentence "ao A1 cho ăn 12 kg thức ăn số 2" (pond, amount and feed type).
  • Database: new nullable platform.assistant_requests.photo_key (additive, 09-telegram.sql).
  • Changed tests (forced by the spec, G1): platform/cli/tests/test_manifest.py test_shrimp_farm_stays_valid loads the manifest at core 1.36.0 (0.3.0 requires it) and checks 1.35.0 is refused; worker_test.go no longer pins the old version/core lines (feeding_action_test.go pins the 0.3.0 ones); agent-proposal-policy-postgres.integration.test.ts and test_smoke_scripts.py gained cases.

Changed#

  • self_approval also applies to proposals created through MCP (origin = user): a requester cannot approve their own medium, high, money or food_safety proposal. Proposals without a reply_channel (MCP, web) get no result notice.

Fixed#

  • Model download in CI: download-model.sh retries every failed download (5 tries, 5 s apart, --retry-all-errors); GitHub release assets answered HTTP 618 several times on 2026-12-01 and failed whole CI jobs, which the old --retry 3 did not retry.

Upgrade notes#

  • Run the init scripts before the new web starts. make platform-up / make demo-up apply platform/postgres/init/09-telegram.sql. The web selects assistant_requests.message_id and photo_key, so until the columns exist every A7 claim fails. The change is additive (two nullable columns and a wider role CHECK); to roll back, return to the previous image and leave the columns in place.
  • shrimp-farm 0.3.0 needs core 1.36.0. An installed shrimp-farm stays at 0.2.0 until you run ./dxos upgrade miniapps/shrimp-farm (after the web is on 1.36.0; the upgrade refuses an older core). It rebuilds and recreates the app's container (no migration) and writes its routes, including the new check route GET /apps/shrimp-farm/agent/checks/pond_active; if the gateway was down at that moment, run make gateway-sync and then make apps-recreate (it recreates only the apps gateway-sync flagged). On a stack that never ran it, run ./dxos apps actor enable once: the web needs the dxos-apps-actor client to carry out an approved action and to ask a check, and without it a draft cannot be approved. After the upgrade a farmer of ST can send "ao A1 cho ăn 12 kg thức ăn số 2" to the Telegram bot; a cooperative without shrimp-farm sees no change.
  • Photos of drafts live under intake/<htx>/ in agrimarket-private. Nothing to set; dxos-scanner already scans the bucket. A photo sent to a draft that is never decided stays there (the draft expires, the photo is kept with it).
  • Rolling back to 1.35.x needs no script, but first put shrimp-farm back to 0.2.0 (./dxos upgrade miniapps/shrimp-farm from the 1.35.0 checkout, while the web is still 1.36.0): an open origin = user draft can still be approved on the old web, which sends no Requested-By-* headers, so 0.3.0 would answer 400 and mark it failed (README, "Lùi về bản trước", PREV=1.35.0).

[1.35.0] - 2026-12-01#

Added#

  • Low-risk autopilot out of labs, agents by pack, neutral A7 prompt (v2.0 phase 3, task 3):
  • The autopilot no longer needs DXOS_LABS: GET /api/agent/autopilot, enable, stop, the internal tick route, the agent's tick call, /tuvanhanh and the autopilot section of the manager and officer AI settings pages answer with labs off. A8, A11, A12, MCP and the app workshop tab stay frozen. The mode stays off by default for each cooperative; a manager turns it on as before (sign-in at most 5 minutes old, probation still a hard block).
  • autoEligibility (the one place): only an origin = agent proposal of a low, auto kind that is not money, not food_safety and has no stored require_human verdict runs on its own. Reasons not_low, money, food_safety, require_human are new; unlockable is never eligible; windowFor is 0 for every eligible proposal (the medium, high, money and strategy.adopt windows are gone). Today that means notification.internal and the low actions of the cooperative's apps.
  • The enable screen lists only those kinds (AppActionCatalog.listFor(htxCode) adds the apps' actions); POST /api/agent/autopilot/enable ignores unlocked_kinds; GET /api/agent/autopilot gains today.items (each auto-run: kind, title, one-line preview, time, status) and the manager settings page lists them with a link to /manager/ai?proposal=<id>.
  • Tick: a total budget of 8 s (budgetMs, clock); items not reached are released (releaseClaims, run_claimed_at = NULL, run_at kept) and run on the next tick, none twice. A policy block clears the window and returns the proposal to a person; a check that did not answer keeps the window.
  • New POST /api/agent/proposals/{id}/block: Chặn on the web for any approver of the kind (blocked|already_ran|not_scheduled|not_found).
  • dxos-agent: A1 to A5 and A13 run only for a cooperative whose htx_profiles.enabled_packs has tea-core (CoreGatewayClient.get_enabled_packs, fail closed when unreadable); A6, A7, A9 and A10 run for every cooperative. Leaf-ticket events are still acknowledged without it.
  • A7: PROMPT_VERSION = "m5-a7-v2". The system prompt names no sector; the web sends htx_name and packs with each request and lists the tea tools and chat actions (pack: 'tea-core') only for a cooperative with the pack.
  • CI: a No-Labs Smoke step (platform/tests/smoke-nolabs.sh), last in platform-smoke, restarts the web with DXOS_LABS empty, checks that the autopilot answers and that POST /api/agent/app-requests and GET /api/mcp/tools still answer 404, and restarts the web as it was.
  • Docs: the freeze row of docs/product-roadmap.md, §3.17 of docs/rules-and-limits.md, docs/api-contract.md and a post-release note in the agentic layer spec.
  • Review fixes: the 18:00 Telegram report lists each auto-run in a trailing block outside its 8-line cap (time, title, preview cut at 80 characters; at most 5, then và N việc khác; the link from DXOS_WEB_PUBLIC_URL only for a manager in a direct chat; a failed read of the runs keeps the report; the report is marked sent after it is built); the Telegram menu, typed tools, assistant intents and open flows refuse tea work for a cooperative without tea-core (HTX của bạn chưa dùng gói có tính năng: …, and the menu hides those buttons); an unreadable pack list leaves the agent's events unacked; the agent waits up to 30 s for the tick; the enable screen lists only kinds a manager may approve; re-enabling keeps the old unlocked_kinds data; the officer sees the run list as plain text; smoke-nolabs.sh asks the web with a session cookie and checks its own 404 body; smoke-autopilot.sh blocks a low notice through the web and checks /dung clears a pending run_at.
  • Changed tests (forced by the spec, G1): eligibility.test.ts (medium kinds, unlockable and money/food-safety reasons; windows are all 0), create-hook.test.ts, autopilot-service.test.ts, tick.test.ts (the medium, unlocked-kind and household-cap cases now expect a person to decide; the real-decide cases use the low notice), agent-autopilot-routes.test.ts, internal-autopilot-tick.test.ts, autopilot-telegram.test.ts, autopilot-section.test.tsx, manager-ai-settings-labs.test.tsx, labs-frozen-routes.test.ts (the four autopilot rows leave the frozen table), assistant-requests.test.ts (the fifth argument), platform/agent/tests/test_labs.py (the tick runs without labs), the get_enabled_packs method of the fake gateway in test_main.py, smoke-autopilot.sh (a medium proposal gets no window, so the Chặn-button step is gone) and test_smoke_scripts.py.

  • Event workers, threshold events, shrimp-farm 0.2.0 (v2.0 phase 3, task 4):

  • dxos-ingest emits telemetry.reading.threshold_crossed into core.outbox (subject <asset_type>:<asset_code>, payload asset_type, asset_code, sensor, value, bound, direction, reading_at) when a stored plugin reading is below alert.below or above alert.above of its sensor. The reading and the event commit together; the event runs in a savepoint, so a failure keeps the reading and writes event_failed to telemetry.ingest_rejects. One event per (asset, sensor, direction) in 15 minutes, kept in the new telemetry.alert_state; a duplicate reading emits nothing.
  • dxos-agent runs the new run_event_dispatch first in every cycle, for every cooperative, before A1: A13 on a leaf ticket (tea cooperatives only, now recorded with trigger = 'event', which was schedule) and dispatch_event_workers for the workers whose on matches (GET /apps/<id><path>?event_id=&topic=&subject=, 10 s). At most 20 calls per page of events, the rest logged as skipped; a failing call leaves a failed run and the page is still acknowledged; an event run does not move the interval schedule. A threshold event goes only to an app that declares the asset type of its subject; on is checked like the CLI (allowed_on). A worker with on and no every_minutes is no longer "malformed": it has no schedule.
  • dxos validate and ./dxos install read a bare on: key of a worker (YAML 1.1 turns it into true).
  • shrimp-farm 0.2.0 (requires.core >=1.35.0): dissolved_oxygen has alert: {below: 4} and pond-watch has on: [telemetry.reading.threshold_crossed]. With subject=pond:<code> it judges the newest reading of the last 60 minutes of that pond; without it, the 60-minute average as before. The approval preview reads ao {pond_code} thiếu oxy ({avg_do} mg/L) for both.
  • CI: smoke-app-actions.sh publishes htx/ST/pond/A1/dissolved_oxygen = 3.2 and waits up to 90 s for an open proposal whose run has trigger = 'event'.
  • Changed tests (forced by the spec, G1): platform/cli/tests/test_manifest.py test_shrimp_farm_0_1_0_stays_valid is now test_shrimp_farm_stays_valid and loads the manifest at core 1.35.0 (0.2.0 requires it); the FakeDb of platform/dataops/tests/test_ingest.py gained transaction() and the fake gateway of platform/agent/tests/test_main.py get_app_worker and apps.

Upgrade notes#

  • New table, created by the usual init run: make platform-up / make demo-up run platform-init (13-registered-assets.sql), which adds telemetry.alert_state. There is no migration, no new service and no manual step for the core, but the init run must come before the new dxos-ingest starts (the order of the README blocks already does that); an ingest that starts first still stores every reading and files event_failed in telemetry.ingest_rejects until the table exists.
  • shrimp-farm 0.2.0 needs core 1.35.0. An installed shrimp-farm stays at 0.1.0 until you run ./dxos upgrade miniapps/shrimp-farm (after the web is on 1.35.0; the upgrade refuses an older core). From then on a dissolved-oxygen reading under 4 mg/L reaches the app within about 90 seconds instead of the next 30-minute run. Other apps are not affected: an event is sent only to a worker that declares on.
  • The autopilot is out of labs and off by default. It is reachable without DXOS_LABS, but still off for every cooperative until a manager turns it on. Only low-risk proposals run on their own and only low-risk kinds are listed; a manager who enabled it under labs sees the narrower list, and proposals of other kinds that already had a window go back to a person on the next tick.
  • A cooperative without tea-core no longer runs A1 to A5 and A13. Nothing changes for the tea cooperatives. Events are read for every cooperative, so the outbox never backs up.
  • Rolling back to 1.34.x needs no script: the old ingest does not emit threshold events and nothing reads telemetry.alert_state (README, "Lùi về bản trước", PREV=1.34.0). Do not set DXOS_LABS after the rollback. An installed shrimp-farm 0.2.0 keeps running on its 30-minute schedule. The path from 1.29.0 is in docs/dev-setup.md, section "Nâng cấp từ 1.29.0 lên 1.35.0".

[1.34.0] - 2026-12-01#

Added#

  • Manifest v2 and actor contract v2 (v2.0 phase 3, task 1; the contract the next tasks build on, nothing new runs yet):
  • agent.actions[] gains editable, food_safety, guardrails.bounds, guardrails.checks (floor 1.34.0) and origins, starters, intake, photo (floor 1.36.0); agent gains checks_path (1.34.0); agent.workers[] gains on (and every_minutes becomes optional when on is present) and sensors[] gains alert (1.35.0). ./dxos validate checks each rule and refuses a manifest whose requires.core is below the floor of a key it uses; shrimp-farm 0.1.0 and every existing app stay valid.
  • The gateway removes the four X-DXOS-Requested-By-* / X-DXOS-Requested-At headers on every app route but the actor and check routes, and adds one GET route app-<id>-check-<n> (internal port only, azp = dxos-apps-actor, Acting headers kept) per distinct check name. dxos sync also strips the new headers from fragments written before this change.
  • ActionDefinition gains foodSafety, starters, guardrails, photo, intake; execute(payload, approver, ctx?) takes the requester and AppsActorClient.call sends the four Requested-By headers (name percent-encoded). AppsActorClient.check runs a plugin check (GET, 3 s, no redirect) and throws AppCheckUnavailableError on anything but a clean {ok: boolean}.
  • App kit: read_claims(authorization, headers, check=False) and Claims.requested_by; with check=True any role of the manifest may act. The ten vendored copies are synced. shrimp-farm: checkRoute and Claims.RequestedBy with the same rules.
  • Review fixes: agent.checks_path may not end with / (schema, CLI; gateway and client also strip it); a generated check uri may not equal another agent path; an empty guardrails block needs the 1.34.0 floor; sync's actor/check exemption matches the exact route id; the app kit refuses a malformed % escape in the requester name like the Go helper.
  • Changed tests (forced): the ACTING header lists in platform/cli/tests/test_gateway.py and platform/tests/test_app_gateway_routes.py now hold the seven headers the gateway removes; the three readClaims calls in miniapps/shrimp-farm/server_test.go pass the route kind.
  • Policy layer (v2.0 phase 3, task 2):
  • apps/web/src/application/agent/policy/: evaluateProposalPolicy (rbac, food_safety, money, bounds, plugin_checks, self_approval; no LLM), isBatchEligible and policyDigest. It runs when a proposal is created (CreateProposalUseCase; the plugin check only for a user draft) and again inside DecideProposalUseCase for every channel (web, Telegram, batch, campaign, tick), after the stale check and before the claim: a block answers 409 POLICY_BLOCKED (or 409 SELF_APPROVAL), a clean ok: false of a plugin check makes the proposal stale with the app's reason, and a check that gives no clean answer answers 503 POLICY_CHECK_UNAVAILABLE and leaves the proposal proposed. At creation a block is 400 POLICY_BLOCKED with reasons and nothing is created. A rejection is never judged. self_approval always allows until the draft lane turns it on.
  • foodSafety: true on harvest.approve and journal.approve.
  • A plugin action with food_safety: true is autonomy: never, like money, and autoEligibility refuses any foodSafety or money kind and any stored require_human verdict, so none of them auto-runs under the labs autopilot.
  • platform.agent_proposals gains policy, reply_channel, source_ref (unique per cooperative), requested_by_name and requested_by_role (all nullable); the verdicts and their digest are stored at creation, and the audit events of the approval and the execution carry policy: {rules, digest}. A proposal made before 1.34.0 has policy NULL and is read as having no verdicts.
  • GET /api/agent/proposals items gain policy, batchEligible, foodSafety, money, requestedByName, requestedByRole, replyChannel, runAt; new GET /api/agent/proposals/[id] and POST /api/agent/proposals/batch-decision (at most 50 ids of one kind, decided one by one through the same use case within 25 s; the results say not_found, not_eligible, not_processed and the policy outcomes per id).
  • Telegram: the card shows one line per stored require_human verdict; the three new outcomes have their own texts. The autopilot tick hands a policy block back to a person; for a check that did not answer it frees the claim (the window stays), so the next tick tries again. A refused decision no longer moves a draft campaign to partial.
  • Tests: unit tests for every rule and stage, the decide order, a check error never marking a proposal stale, isBatchEligible, the campaign and batch use cases, the three routes, and agent-proposal-policy-postgres.integration.test.ts (columns, index, stale reason and audit details on a real Postgres; db-integration.sh sets PROPOSAL_POLICY_TEST_DATABASE_URL).

Changed#

  • "Duyệt cả chiến dịch" narrowed on purpose: an item that is not batch-eligible (money, food_safety such as journal.approve, or a stored require_human verdict) is no longer decided by it. It stays proposed, is counted in the new waitingSingle, and the campaign becomes partial when waitingHigh + forwarded + waitingSingle > 0. An item the policy refuses at decision time is counted there too, not as failed. The Telegram result line adds the count.
  • Changed tests (forced): campaign-decisions.test.ts (the results carry waitingSingle; its journal.approve item now waits one by one, and the officer case uses a low notification.internal item so it still pins the forwarding), the campaign-panel.test.tsx result fixture (type only) and the web route table of application/telegram/coverage.ts (the two new routes).

Upgrade notes#

  • New columns arrive with the usual init run: make platform-up / make demo-up run platform-init (08-agent.sql) twice; the five nullable columns and the unique index agent_proposals_source_ref are added idempotently. There is no migration, no new service and no manual step. Open proposals keep their policy NULL and decide as before.
  • "Duyệt cả chiến dịch" now leaves money and food_safety items for one-by-one decisions (waitingSingle; in a campaign this includes journal.approve, which used to run from it). Tell managers who relied on it.
  • Plugin keys of 1.34.0: an app may now declare editable, food_safety, guardrails.bounds, guardrails.checks and agent.checks_path with requires.core >= 1.34.0. A plugin that touches pesticides, harvest or withdrawal must declare food_safety: true: the core cannot check it. A check answers {ok: boolean} within 3 s; anything else is "could not check" (503), never a pass. ./dxos sync / make platform-up write the -check- gateway routes.
  • Rolling back to 1.33.x needs no script: the old web ignores the new columns (README, "Lùi về bản trước", PREV=1.33.0). Do not set DXOS_LABS after the rollback. The path from 1.29.0 is in docs/dev-setup.md, section "Nâng cấp từ 1.29.0 lên 1.34.0".

[1.33.0] - 2026-12-01#

Added#

  • Core reads through the gateway (v2.0 phase 2, task 6): GatewayNotificationReader, GatewayBulletinReader and GatewayHtxProfileReader (apps/web/src/infrastructure/core/) read with the signed-in user's token, so the Hasura permissions decide what each role sees. Moved reads: GET /api/notifications (every role but accountant), the unread count of the farmer menu, the bulletin lists of the farmer, manager and officer pages, GET /api/bulletin (bulletins and the default crop), and the manager's cooperative profile. A page whose gateway call fails shows its error state; it never falls back to Prisma. There is no Prisma read of htx_memberships to move (the member list comes from Keycloak), so only its Hasura permission ships.
  • Hasura permissions: htx_memberships is tracked (core_htx_memberships.yaml): manager and officer read the rows of their cooperative, a farmer only its own row, the agent nothing; four columns (id, keycloak_user_id, htx_profile_id, roles), no *. Every new cooperative filter carries the house guard htx_code <> '', so a token with no htx_code matches no cooperative. notifications gets the object relationship htx_profile: farmer, officer and manager read the rows addressed to them or the broadcasts of their cooperative, without the columns htx_profile_id, pushed_to_mattermost, sender_id and tts_text; only farmer may aggregate (the unread badge).
  • Ratchet test src/__tests__/architecture/core-model-access.test.ts: counts prisma.<core model> call sites outside src/infrastructure and a short allow-list, and fails when the count differs from the record (30 before this change, 27 after; lower the record when you move a read).
  • Tests: platform/tests/test_hasura_farmer_permissions.py; smoke-platform.sh checks that two farmers of two cooperatives each see only their own membership row, notifications and bulletins (15 more PASS lines: 167, in smoke-apps.sh too; memberships are inserted on conflict do nothing because requireTenant keeps one row per user and cooperative, so the platform smoke can run again on a used database; an LB farmer with no household and a token with no htx_code are checked too).
  • Acceptance of phase 2 (v2.0 phase 2, task 7): the ten items of spec section 7 are mapped to the checks that run in CI (table in the spec's "Ghi chú sau triển khai"); the only new check is database-layout-postgres.integration.test.ts, which now pins the exact table set of public (_prisma_migrations and PostGIS's spatial_ref_sys), core (the eight tables and the four outbox* tables) and app_tea (28 tables). Docs: the three schemas and how to write SQL against them (docs/database-schema.md), event topics, emitting and subscribing (docs/miniapps.md), the limits (docs/rules-and-limits.md) and the path from 1.29.0 to 1.33.0 (docs/dev-setup.md).

Changed#

  • Behaviour narrowed on purpose (owner's rules): a notification of the n8n kind (SYSTEM, no recipient, no cooperative) no longer shows in the notification list of the roles read through Hasura (it did before), nor in the live stream of the bell (/api/notifications/stream, still Prisma, now with the same rule; the accountant keeps both as before). A filter of GET /api/notifications that names no notification type is now a 400 instead of an error; the mobile app now also sees the broadcasts of its cooperative. The accountant has no Hasura permission, so its notification list stays on Prisma, unchanged.
  • Existing tests that pinned a Prisma call for a read that moved now pin the gateway request; the others only gained the mock of @/lib/auth/core-token that the gateway client imports (list in the spec's "Ghi chú sau triển khai", item 2).

Fixed#

  • Bulletins: the cooperative branch of the farmer, manager and officer filters (core_bulletins.yaml) now carries the house guard htx_code <> '', so a token with no htx_code never matches a bulletin whose code is empty (shared bulletins, htx_code null, stay visible). Pinned in test_hasura_farmer_permissions.py.
  • The web loads Be Vietnam Pro from files in the image: apps/web uses next/font/local with woff2 files in apps/web/src/app/fonts, so next build no longer downloads Google Fonts (a DNS miss on fonts.googleapis.com failed make web-up).
  • Keycloak login font: the sign-in page loads Be Vietnam Pro from the theme's own resources/fonts files, with no request to Google Fonts.
  • Zalo smoke at night: platform/tests/smoke-zalo.sh set the quiet window to 00:00-01:00, which delays three message kinds between 00:00 and 01:00 Vietnam time and failed the four-template-ids check; the window is now one hour, two hours ahead of Vietnam time, so it never covers the present.
  • Notification limit: GET /api/notifications ignored limit when no filter was given (a missing filter reached the schema as null), so the inbox's "all" view and "load more" stayed at 5 rows and the 4-row dashboard lists got 5; a missing query value is now read as absent, and limit is capped at 100.

Upgrade notes#

  • Release bundle (kind C) has no make up-workflow, so n8n was never subscribed there since 1.32.0 and Mattermost pushes only every 15 minutes. After importing and publishing the new mattermost-push and restarting n8n, run from the bundle folder: $COMPOSE --profile tools build --quiet dxos-cli && $COMPOSE --profile tools run --rm -T dxos-cli events subscribe n8n-notifications core.notification.created http://n8n:5678/webhook/outbox-notification (README, "Lùi về bản trước", has the check to make first). A rollback below 1.32.0 leaves the 1.32.0 copy of mattermost-push in n8n; re-import the older file to get the one-minute push back.
  • Behaviour narrowed on purpose: the bell (list and live stream) no longer shows n8n SYSTEM alerts to managers, a filter with no notification type is a 400, and the mobile app sees the broadcasts of its cooperative; read "Changed: Behaviour narrowed on purpose" above before upgrading.
  • From 1.29.0: the whole path (1.30.0, 1.31.0, 1.32.0, 1.33.0) with the manual steps of each version is in docs/dev-setup.md, section "Nâng cấp từ 1.29.0 lên 1.33.0"; the commands are in the README ("Nâng cấp một cài đặt đang chạy"). 1.33.0 itself adds no database migration, so the way back to 1.32.x needs no SQL (README, "Lùi về bản trước").
  • Hasura must load the new metadata: make platform-up and make demo-up restart hasura after migrate (true since 1.30.0). Pages moved to the gateway need Hasura running; it is a core service, so a normal start already has it. Without a restart Hasura would answer these pages with an error until it is restarted.

[1.32.0] - 2026-11-30#

Added#

  • Event box core.outbox (v2.0 phase 2, task 4; producing side only): platform/postgres/init/15-core-outbox.sql creates core.outbox (append-only: triggers refuse UPDATE, DELETE and TRUNCATE), core.outbox_subscriptions, core.outbox_cursors, core.outbox_failures and the function core.emit_event(topic, htx_code, subject, payload), which checks the topic (^[a-z][a-z0-9_-]*(\.[a-z][a-z0-9_-]*){1,3}$) and the payload (at most 4096 bytes of jsonb text), inserts, calls pg_notify('core_outbox', id) and returns the id. The file does nothing until the first Prisma migration has run (schema core is one of Prisma's schemas, and tables in it before migrate deploy make Prisma stop with P3005); platform-init applies it again after migrate. Delivery is dxos-outbox, below.
  • Eight topics emitted by the web, in the transaction of the change they announce (an event of a rolled-back change does not exist): core.notification.created (one per notification row, in one statement per batch; its cooperative is the one of the write's own context, never guessed from the recipients), core.proposal.created, core.proposal.decided (approved or rejected), tea.leaf_ticket.created, tea.journal_entry.created (when an entry is written as recorded, and when a draft such as the disease review's draft spraying is resubmitted), tea.disease_report.created, tea.batch.closed, tea.lot.created (both lot paths). Payloads hold identifiers and classification fields only; keys are listed in docs/miniapps.md.
  • Plugins emit events: POST /api/internal/apps/core/events with { topic, subject?, payload? } (service events, requires.core >= 1.32.0; user mode and app mode like the other core routes). The stored topic is forced to app.<id>.<topic> (the app's part has one or two segments), the cooperative comes from the caller's context and never from the body, at most 300 events an hour for one app and cooperative (429 RATE_LIMITED), payload at most 4096 bytes. platform/apps/manifest.schema.json accepts events in requires.services and ./dxos validate requires requires.core >= 1.32.0 for it. Documented in docs/miniapps.md, docs/api-contract.md and docs/database-schema.md.
  • Integration test and script: outbox-postgres.integration.test.ts (variable OUTBOX_TEST_DATABASE_URL, exported by scripts/db-integration.sh).
  • dxos-outbox, the dispatcher (v2.0 phase 2, task 5): a small Go service (platform/outbox, scratch image, user 10001, go.mod with pgx/v5 only; container opentea-outbox, 64 MB) that pushes the events of core.outbox to the subscriptions of core.outbox_subscriptions. One goroutine per enabled subscription, LISTEN core_outbox plus a 5 s poll, in (txid, id) order (see the next entry), at least once (the cursor moves only after a 2xx or a recorded failure), body {id, occurred_at, htx_code, topic, subject, payload} with the header X-Dxos-Event-Id, 10 s timeout, no redirect followed. The retry rule: a transient error (network error, timeout, any 5xx, 408, 429) backs off 5 s doubling to 5 min, at most 12 attempts; a permanent error (every other 4xx, and a 3xx) gets two retries 2 s apart; when the attempts run out, one transaction inserts core.outbox_failures (status code, class), inserts a platform.system_alerts row (source outbox) and moves the cursor. So one bad event of one cooperative holds the others for at most four seconds. Retry state lives in core.outbox_cursors, so a restart keeps it. Heartbeat in platform.service_heartbeats (dxos-outbox); dxos-outbox healthcheck is the container health check.
  • Commit-safe order, not id order (core.outbox.txid): ids come from a sequence and commits land out of id order, so a reader that moved its cursor past id 6 while the transaction of id 5 was still open would never see 5. core.outbox gets txid xid8 DEFAULT pg_current_xact_id() and core.outbox_cursors gets last_txid; a consumer (the dispatcher, the agent API) reads only rows with txid < pg_snapshot_xmin(pg_current_snapshot()), which means every transaction that could still add an older row has ended, in (txid, id) order, and keeps its position as that pair. A long-running writer delays delivery; it can no longer lose an event. Delivery order per subscription is therefore (txid, id): the order in which the transactions started, then the order of the rows inside one. Indexes (txid, id) and (htx_code, txid, id) replace (htx_code, id). An earlier draft used a one-second age window; it compared with occurred_at, the START of the transaction, and could lose an event.
  • Allow-list for targets: only http://n8n... and http://web... (no credentials), checked when ./dxos events subscribe writes a subscription and again before every send; a row written by hand with another host is refused, alerted once and never sent. The list is DXOS_OUTBOX_ALLOWED_HOSTS of the dxos-outbox and dxos-cli services (operator-only, default n8n,web; only the platform smoke widens it).
  • ./dxos events subscribe <name> <topic-pattern> <url> | unsubscribe <name> | list (platform/cli/dxos_cli/outbox.py): name [a-z][a-z0-9-]{1,40}, pattern an exact topic or a prefix ending in .*; subscribe is idempotent (updates the row, keeps the cursor) and a new subscription starts after the newest event (no history replay); unsubscribe removes the row and its cursor.
  • Events API for the agent of a cooperative: GET /api/internal/agent/events?limit=<1..100> returns the events of the token's cooperative after the cursor of consumer agent:<htx_code> (never another cooperative's, never one without htx_code) in (txid, id) order, and POST /api/internal/agent/events/ack {last_id} moves that cursor to that event, never backwards; last_id must be a readable event of that cooperative (anything else: 400 INVALID_LAST_ID). The agent acknowledges the LAST event of a page, which is not always the highest id. dxos-agent reads it each cycle, runs cross_check (A13) at once, at most once per cycle, when a tea.leaf_ticket.created arrived (the daily schedule stays; in that cycle it waits for the next one) and acknowledges a page only after what it triggered succeeded; a failure of the events API stops nothing else.
  • mattermost-push reacts to core.notification.created: a webhook trigger (POST outbox-notification) pushes the notification named by the event's subject at once; the schedule goes from every minute to every 15 minutes and stays as the safety net (seven n8n workflows insert notifications by raw SQL without an event). make up-workflow subscribes n8n (n8n-notifications) only once the new mattermost-push is imported and published, checked through the n8n CLI without running it (n8n gives 404 for the webhook until then; otherwise it prints how to import it and subscribes nothing); make stop-extras removes that subscription with n8n.
  • platform/tests/smoke-outbox.sh (job platform-smoke, after make web-up; not part of the agentic smoke): a leaf ticket written through the web is an outbox row within 5 s; a stub receiver subscribed with the CLI gets two tickets once each and in order, gets the backlog after being stopped, and for a 422 on TC gets three attempts, a row in core.outbox_failures and an alert while an event of LB arrives within 10 s; a hand-written subscription to a host outside the list is refused and alerted; the agent of TC reads its events, the agent of LB none of them, nobody reads an event without a cooperative. CI also runs go vet and go test of platform/outbox (job platform-units), and scripts/db-integration.sh runs the Go store test against the real tables.
  • Image …-outbox in the publish and release matrices, in the release override and in the README pull lists.

Changed#

  • The layout test's drift check names four tolerated statements: DROP TABLE "core"."outbox", outbox_cursors, outbox_failures and outbox_subscriptions. They sit in schema core, which Prisma covers, but are made by SQL and have no model; nothing else is tolerated. Do not accept these drops into a migration if prisma migrate dev proposes them.
  • Notification writes are transactional: PrismaNotificationRepository writes a row and its event in one transaction (createMany became createManyAndReturn so each row has an id for its event).
  • platform.system_alerts.source accepts outbox: 09-telegram.sql (the owner of the table) replaces the check constraint (n8n, agent, web, outbox) with an idempotent drop and add.
  • Alerts of the dispatcher: the text carries the subscription, the event id, the topic, the class and the status code, never the raw error (that stays in core.outbox_failures.last_error and the log). An alert of an event reaches the managers of that event's cooperative; one without a cooperative (a refused subscription, an event without htx_code) is stored as already notified, because TelegramNotifier would send a NULL-cooperative alert to the managers of every cooperative, and no platform-admin route exists.
  • dxos-cli and the compose files get DXOS_OUTBOX_ALLOWED_HOSTS; make platform-up and make up-core start dxos-outbox (a core service, never stopped by make stop-extras); RELEASE_IMAGES lists it.
  • Existing unit tests whose mocks needed the new dependency, or whose pinned call arguments gained the cooperative of the write (broadcastAnnouncement, notifyRecipients, sendDirectNotification now take it): see the task report.

Fixed#

  • CI stability (browser stories): a mini-app frame whose document request Chromium aborts with net::ERR_NETWORK_CHANGED (a host interface changed while Docker started or stopped a container) is loaded again once; no Playwright retry is enabled and no assertion or timeout is loosened. The helper apps/web/tests/e2e/helpers/network-changed.ts is attached through the shared test that the frame-opening specs import.
  • The manager's "Bán hàng" page no longer crashes when it loads the receivables (since 1.21.0): SalesListPanel stored the whole answer of /api/sales/receivables instead of its data key.

Upgrade notes#

  • The event-box tables are created by the second platform-init. 15-core-outbox.sql does nothing until the first migration has run (see Added), so the tables core.outbox* and core.emit_event exist only after the platform-init that follows migrate. make platform-up and make demo-up already run it (postgres, platform-init, migrate, platform-init), and so does the release block of the README (platform-init, migrate, platform-init again).
  • Rebuilding only the web is not enough. An operator who starts a web of this branch with make web-up on a database that never saw the second platform-init (no make platform-up) gets HTTP 500 on every write of the eight producers (notifications, proposals, leaf tickets, journal entries, disease reports, batch close, lot creation): their events need core.emit_event. The fix is make platform-up (or the same three steps by hand).
  • New core service. make platform-up and make demo-up start dxos-outbox; make up-core starts it too. Release bundle (kind C): add dxos-outbox to the pull list (README updated). It needs the second platform-init (the tables) like the web's producers.
  • Re-import mattermost-push into n8n, as for weather-sync in 1.31.0: n8n keeps its workflows in its own storage and nothing imports this one. The copy in n8n has no webhook and still runs every minute; import the new file and publish it from the CLI: docker cp workflows/mattermost-push.json opentea-n8n:/tmp/, docker exec opentea-n8n n8n import:workflow --input=/tmp/mattermost-push.json, docker exec opentea-n8n n8n publish:workflow --id=mattermost-push-wf, then restart n8n (docker compose -f docker/docker-compose.yml restart n8n): n8n registers a published webhook only when it starts. Then run make up-workflow, which subscribes n8n; without the subscription the schedule (every 15 minutes) still pushes.
  • Check deliveries. ./dxos events list (position, attempts, number of events given up on), select * from core.outbox_failures order by failed_at desc and select * from platform.system_alerts where source = 'outbox'. A subscription whose target is down retries each event for about 30 minutes before the alert; make stop-extras removes the n8n subscription for that reason.
  • On stacks started with make platform-up or make demo-up, n8n is not subscribed until make up-workflow runs (and it subscribes only when the n8n CLI shows the new mattermost-push published, with its webhook path; it reads the stored workflow, not what the running n8n registered, which is why the restart above comes first; it never calls the webhook). Until then Mattermost pushes wait for the schedule, up to 15 minutes instead of one.
  • Known limits. core.outbox has no retention (it only grows; the table is append-only and nothing deletes from it yet). A transaction that stays open delays delivery of every later event until it ends (no event is lost). The dispatcher reads DXOS_DB_URL as the owner role, like the web; its pool is three connections unless the URL says pool_max_conns.
  • Going back to 1.31.x needs no SQL: the new tables and the wider source constraint do not disturb it; remove the container (docker rm -f opentea-outbox) and start 1.31.x.

[1.31.0] - 2026-11-30#

Added#

  • The twenty-eight tea tables move to schema app_tea (v2.0 phase 2, task 3, wave 2): parcels, parcel_crop_cycles, journal_entries, journal_activities, pesticide_products, htx_pesticide_labels, lots, lot_parcels, disease_reports, disease_labels, weather_cache, partners, leaf_grades, daily_leaf_prices, fresh_leaf_tickets, input_items, input_advances, settlement_periods, member_settlements, member_ledger_entries, processing_batches, processing_batch_outputs, lot_batch_sources, htx_certificates, lot_certificates, sales_orders, sales_order_lines and sales_payments leave public through migration 20261130120000_app_tea_schema (ALTER TABLE ... SET SCHEMA, no row is copied; indexes, foreign keys, triggers, sequences and grants go with the table, and the audit and append-only triggers and telemetry.registered_assets follow by OID). The migration repeats the wave-1 search_path statement unchanged and revokes PUBLIC on app_tea. After this version public holds only the enum types, the two *_refuse_change functions, _prisma_migrations and what the PostGIS extension keeps there (spatial_ref_sys, its types and functions); the new layout assertion of database-layout-postgres.integration.test.ts allows no other table. Table names, columns and the Prisma model API do not change (schemas = ["public", "core", "app_tea"], every model has @@schema).
  • GraphQL contract unchanged: the thirteen tracked tea tables are tracked from schema app_tea with configuration.custom_name equal to the bare table name (files app_tea_<table>.yaml), and every relationship that names one of them (including those of htx_profiles and households in core) follows. platform/tests/test_hasura_root_fields.py passes unchanged.
  • Reversible: scripts/schema-move-rollback-tea.sql (shipped in the release bundle) moves the twenty-eight tables back to public and deletes the migration's row from _prisma_migrations, in one transaction; it leaves the search_path of the role alone because 1.30.x still needs it. A full bash scripts/db-integration.sh now proves both waves on every CI run: it gives each of the thirty-six moved tables at least one row, snapshots count and md5 per table, rolls back wave 2, compares, rolls back wave 1, compares, migrates again and compares; it also checks that the wave-1 script refuses while app_tea holds tables and that the wave-2 script fails when run twice.

Changed#

  • Explicit public. references to tea tables became app_tea.: platform/dataops/dxos_dataops/simulate.py and platform/tests/smoke-dataops.sh. The init scripts and every other statement name tea tables without a schema and keep working through the role's search_path.
  • The weather-sync workflow no longer names a schema: its "Upsert Weather" node (the only n8n node that set schema: public) is replaced by one parameterised INSERT ... ON CONFLICT (parcel_id, recorded_at) DO UPDATE with the same columns and values, so it works before the move, after it and after a rollback. Without the import described in the upgrade notes the old node fails every hourly run once the table has moved. platform/tests/test_workflow_schema_names.py fails when any Postgres node of workflows/*.json sets a schema or names public., core. or app_tea. before one of the 36 moved tables (list read from schema.prisma).
  • docs/database-schema.md states **Schema:**app_tea` in the section of each tea table;scripts/check-schema-doc.pycompares it with@@schema`.

Fixed#

  • make apps-recreate and ./dxos find a stopped web container: both read AUTH_URL from the web container with compose ps -q web, which lists only running containers, so after make web-stop a recreated app got the default address. They now use ps -aq.

Upgrade notes#

  • From 1.29.x, read the 1.30.0 notes too. Going straight to 1.31.0 skips 1.30.0, so its notes apply as well (the n8n credential's role, ?schema= in DATABASE_URL, restarting every service after migrate).
  • Import the corrected weather-sync workflow into n8n. n8n keeps its workflows in its own storage, and nothing in this repository imports weather-sync (the Makefile, dxos and the CLI import only mini-app workflows; docs/dev-setup.md lists three other workflows). The copy in n8n still has the public upsert and fails every run after the migration. Import it the way you installed it: in the n8n UI (Workflows, Import from file, workflows/weather-sync.json), or docker cp workflows/weather-sync.json opentea-n8n:/tmp/ && docker exec opentea-n8n n8n import:workflow --input=/tmp/weather-sync.json; the file has the id weather-sync-id, so it replaces the existing workflow. Import it before or right after migrate, then check that it is still active (an import by id can leave a workflow unpublished: docker exec opentea-n8n n8n publish:workflow --id=weather-sync-id). The corrected workflow also works on 1.30.x, so importing it early is safe.
  • Commands. The step-by-step commands for the three kinds of install (A: source clone with images built from source; B: source clone with release images, make demo-up; C: release bundle, no Makefile) are in README.md, subsections "Nâng cấp một cài đặt đang chạy" and "Lùi về bản trước". They are right for an upgrade from 1.30.x and from 1.29.x straight to 1.31.0 (one migrate applies both migrations); this list holds only what is specific to 1.31.0.
  • The old web must not run during migrate, and now it matters for the whole tea product. From the moment the migration commits, a 1.30.x (or 1.29.x) web fails on every page and API route that reads parcels, lots, journals, leaf tickets, the ledger, processing batches, certificates or sales (its Prisma client asks for "public"."<tea table>"), which is nearly all of the product of a tea cooperative; only the pages that read the core tables keep working. The migration changes no row. Stop the web first (make web-stop, or $COMPOSE stop web n8n in a bundle) and start the new one after migrate.
  • Restart every service after migrate, as for 1.30.0: make platform-up and make demo-up restart hasura, apisix and n8n when they were running; Hasura must load the new metadata (thirteen more tables under app_tea). The role's search_path already lists app_tea since 1.30.0, so no connection setting changes in this version. A role that is not POSTGRES_USER (for example an n8n credential that logs in as another user) must name app_tea.<table> or carry the same search_path and GRANT USAGE ON SCHEMA app_tea.
  • If migrate fails: the migration is atomic, so nothing moved, but Prisma records it as failed and the next deploy stops with P3009. Clear it as in the 1.30.0 notes with the name 20261130120000_app_tea_schema instead of 20261130110000_core_schema; for kind B use OPENTEA_VERSION=1.31.0 (the 1.30.0 note shows 1.30.0), for kinds A and C nothing else changes. Then run migrate again.
  • Roll back. scripts/schema-move-rollback-tea.sql ships in the release bundle: run it through docker exec -i opentea-postgres sh -c 'psql -U "$POSTGRES_USER" -d agrimarket -v ON_ERROR_STOP=1' < scripts/schema-move-rollback-tea.sql with the web and n8n stopped, then start 1.30.x from its own directory and restart Hasura. To go on to 1.29.x run scripts/schema-move-rollback-core.sql after it (it refuses while app_tea holds tables), then start 1.29.x. The README subsection "Lùi về bản trước" has the commands per kind of install.

[1.30.0] - 2026-11-30#

Added#

  • The eight core tables move to schema core (v2.0 phase 2, task 2, wave 1): htx_profiles, htx_memberships, households, notifications, bulletins, chat_history, fx_rates and market_data leave public through migration 20261130110000_core_schema (ALTER TABLE ... SET SCHEMA: no row is copied; indexes, foreign keys, triggers, sequences and grants go with the table, and the audit triggers and telemetry.registered_assets follow by OID). The migration also sets search_path = "$user", public, core, app_tea on the migrating role in this database (ALTER ROLE ... IN DATABASE ... SET, never on the database, so the app_<id> roles of mini-apps inherit nothing) and revokes PUBLIC on core, so every statement of the core services that names a table without a schema (web raw SQL, n8n, scripts, smokes, ./dxos) still finds it. Enums, the two append-only trigger functions and _prisma_migrations stay in public. Table names, columns and the Prisma model API do not change (multiSchema is on, every model and enum has @@schema).
  • GraphQL contract unchanged: the seven tracked tables are tracked from schema core with configuration.custom_name equal to the bare table name (files core_<table>.yaml), so htx_profiles, households_by_pk, notifications_aggregate, ... keep their names; htx_memberships is still not tracked. platform/tests/test_hasura_root_fields.py pins every bare name and every relationship target.
  • make platform-up and make demo-up restart what was already running (hasura, apisix and n8n) after migrate, so their connections are made after the migration; both targets share one block and still start the platform's services as before (a stopped n8n is started by them, with new connections). make web-stop stops the web before a migration that moves tables.
  • Reversible: scripts/schema-move-rollback-core.sql (shipped in the release bundle) moves the eight tables back, resets the role's search_path and deletes the migration's row from _prisma_migrations, in one transaction. A full bash scripts/db-integration.sh proves it on every CI run: it snapshots rows and md5 of each moved table, rolls back, compares, migrates again and compares.
  • scripts/check-schema-doc.py compares schemas: docs/database-schema.md states **Schema:**core` in the section of each core table (no line meanspublic) and the check fails when it disagrees with@@schema`.
  • Database integration tests in CI (v2.0 phase 2, task 1): bash scripts/db-integration.sh [jest args] starts a throwaway Postgres from platform/postgres (unique name, 127.0.0.1, free port), applies the init scripts, prisma migrate deploy, the init scripts again and prisma db seed (the order of make platform-up, plus the seed the demo-seed suite needs), exports the thirteen test URLs and runs jest src/__tests__/db --runInBand (or only the file pattern the caller gives); a skipped or pending test fails the run; the container is removed on every exit path. The CI job "Database Integration Tests" (db-integration) runs it with --ci, gated on the stack scope like the smokes, so the release gate includes it. scripts/ci-change-scope.sh counts apps/web/src/__tests__/db/ as stack. The new suite database-layout-postgres.integration.test.ts pins every model's table in its schema, the dxos_audit_row triggers of 03-audit-triggers.sql, the append-only triggers of the ledger and sales payments, telemetry.registered_assets (a plot and a batch) and that prisma migrate diff shows no table or column drift. Details in docs/dev-setup.md.
  • Platform smoke: three assertions (every table of 03-audit-triggers.sql has dxos_audit_row; telemetry.registered_assets reads parcels and processing_batches; Hasura reports no inconsistent metadata). The PASS count that apps-smoke compares goes from 149 to 152.
  • Reserved app schemas: RESERVED_SCHEMAS = {core, app_tea} in the CLI; ./dxos validate, install and the store catalogue sync refuse an app whose schema_name(id) is reserved (id tea). tea-shop, tea-tour and an id that maps to app_core stay valid.

Changed#

  • The init scripts find a table in core, then app_tea, then public: 03-audit-triggers.sql puts dxos_audit_row on the table wherever it is and 13-registered-assets.sql builds the tea part of telemetry.registered_assets from the resolved names, so both are right before migrate, after it, and on every later platform-up.
  • A schema parameter in DATABASE_URL is ignored by the web (it is removed once at start-up with a warning): Prisma would pin search_path to that schema and hide the tables in core from raw SQL. apps/web/.env.example no longer has ?schema=public. The three schedule routes use the shared Prisma client instead of their own.
  • Explicit public. references to core tables became core.: PrismaZaloRepository.ts, platform/dataops/dxos_dataops/simulate.py, platform/tests/smoke-dataops.sh; smoke-platform.sh finds the audit trigger of a table by its unqualified name.

Removed#

  • scripts/init_n8n_tables.sql: a legacy script (a mock users table and unqualified market_data and fx_rates with IF NOT EXISTS) that nothing in the repository, Makefile, compose files, CI or docs referenced. Run against a database it would create a public.market_data that shadows core.market_data for unqualified SQL (the role's search_path lists public first).

Fixed#

  • The agent respects industry packs: get_enabled_apps() drops an app whose manifest pack is not in the cooperative's htx_profiles.enabled_packs (the rule the web applies); the Hasura agent role may read enabled_packs on htx_profiles.

Upgrade notes#

  • Commands. The step-by-step commands for the three kinds of install (A: source clone with images built from source; B: source clone with release images, make demo-up; C: release bundle, no Makefile) are in README.md, subsections "Nâng cấp một cài đặt đang chạy" and "Lùi về bản trước". Read them before upgrading; this list holds only what is specific to 1.30.0.
  • The old web must not run during migrate. From the moment the migration commits until the new web starts, every request of the 1.29.x web that touches one of the eight tables fails (that image asks for "public"."<table>"). The migration copies and changes no row. An operation made of several separate writes can stop half-way while the old web runs against the moved tables, which is the reason to stop the web first.
  • Which services reconnect. make platform-up and make demo-up start the platform's services as always (n8n included) and additionally restart hasura, apisix and n8n when they were already running before the target started, so their connections and metadata are fresh. Neither target's restart touches the web: on kind A the next step make web-up builds and starts it, on kind B make demo-up itself recreates it (its up -d --no-build uses the new image tag), and in a bundle (kind C) up -d --no-build recreates it. A release bundle has no Makefile: its sequence stops web and n8n before migrate, starts every service without a profile afterwards (optional ones too) and restarts hasura and apisix (n8n reconnects because it was stopped and started). dxos-agent, dxos-telegram and dxos-zalo read through Hasura or the web API and need nothing. On a demo-up install the target also re-runs the demo seeds after the restart.
  • n8n's Postgres credential (creds_postgres_new) is created by hand in n8n; it is not in this repository. It must log in as the database owner role (POSTGRES_USER), the role that carries the new search_path. If yours logs in as another role, either change the credential's user, or give that role the same setting and access: ALTER ROLE <role> IN DATABASE <db> SET search_path = "$user", public, core, app_tea; and GRANT USAGE ON SCHEMA core TO <role>; (plus the table privileges that role already had on the moved tables, which went with them).
  • schema parameter in DATABASE_URL: the web drops it at start-up and logs one warning, so the web is safe either way. Remove it from your env file anyway: psql and any other libpq client reject a URI with an unknown schema parameter, and a Prisma client built elsewhere (for example a script that does not use the web's shared client) pins search_path to that schema and cannot see the tables in core. The same holds for options=-c search_path=... in the URL, which the web does not touch.
  • If migrate fails (for example schema core already exists and belongs to a role that did not grant CREATE to the migrating role): the migration is atomic, so nothing moved, but Prisma records it as failed and the next deploy stops with P3009. Fix the cause, then clear the record with the migrate service, which builds DATABASE_URL itself (its image runs DATABASE_URL="$(node /app/database-url.js)" prisma migrate deploy by default, from POSTGRES_USER and POSTGRES_PASSWORD of the service), so the override repeats that step. Kind A (dev compose, from the clone): docker compose -f docker/docker-compose.yml --profile tools run --rm --build migrate sh -c 'DATABASE_URL="$(node /app/database-url.js)" exec prisma migrate resolve --rolled-back 20261130110000_core_schema --schema /app/schema.prisma'. Kind B (from the clone, release images): OPENTEA_VERSION=1.30.0 docker compose --env-file docker/.env.local -f docker/docker-compose.yml -f docker/docker-compose.release.yml --profile tools run --rm migrate sh -c '<same command>'. Kind C (bundle): $COMPOSE --profile tools run --rm migrate sh -c '<same command>' with COMPOSE and OPENTEA_VERSION set as in the README. Then run migrate again. These commands were written from apps/web/prisma/Dockerfile, database-url.js and the compose files, not run on an install.
  • Roll back. The script scripts/schema-move-rollback-core.sql ships in the release bundle: one transaction that moves the eight tables back, resets the role's search_path and removes the migration's row so migrate can apply it again. It refuses while schema app_tea holds tables. Run it through docker exec -i opentea-postgres sh -c 'psql -U "$POSTGRES_USER" -d agrimarket -v ON_ERROR_STOP=1' < scripts/schema-move-rollback-core.sql (no host psql). The order (stop what writes, run the script, start the previous version from its own directory, because Hasura reads its metadata from there, and restart Hasura, because it reads it only at start) and the commands per kind of install are in the README subsection "Lùi về bản trước". On kind B never use the dev targets make platform-up / make web-up for this: they recreate containers from the dev compose file.
  • Restart hasura after pulling this change so it reloads the metadata (the agent role reads enabled_packs on htx_profiles); the agent's app list uses that column and is empty of pack apps until then.

[1.29.0] - 2026-11-30#

Added#

  • Neutral dashboards and app cards (v2.0 phase 1, step 3): a cooperative without tea-core gets one core dashboard for all four roles (CoreDashboard: greeting and cooperative name, newest notices, weather, and the cards of its apps) instead of the tea blocks. A cooperative with tea-core keeps its four dashboards exactly and gains the cards block below them only when an app has a card. An app declares its cards in the manifest key dashboards; the web calls GET /apps/<id><path> with the user's token through the same gateway reader as the feed (createGatewayReader: waits 1.5 s at most, reads 64 KB at most, caches a good answer 15 s and a failure 5 s per app, path, cooperative and role) and checks every card (12 at most, label_vi 1-40, value 1-20, unit at most 16, status ok/warn/alert, href a path inside the app); a card that breaks the contract, or an app that answers badly, only loses itself. Cards render as plain text, show the status as a word and an icon as well as a colour, and are links only with an href. Without a card a manager is pointed to the Kho ứng dụng and the other roles are told only that no app has sent a figure yet (a role can have an app in its menu and no card of its own).
  • miniapps/shrimp-farm 0.1.0, the first industry plugin after tea and the first Go code in the repository: pond management for a shrimp cooperative, using only the plugin contract. Ponds are registered as assets of kind pond (NGSI-LD type FishContainment; sensors dissolved_oxygen 0 to 20 mg/L, ph 0 to 14, salinity 0 to 50 ppt, water_temp 0 to 45 °C), so devices publish on htx/<htx>/pond/<code>/<sensor>; the pond page shows the newest readings and the latest 100 of each sensor from the last 24 hours, dissolved oxygen under 4 mg/L is an alert and pH outside 7.5 to 8.5 a warning. A feeding log (editable on the day it was written in Vietnam time, afterwards only a correcting line), harvest lots <HTX>-<YYYYMMDD>-<n> that each write HARVEST_RECORDED into the audit chain, and a public trace page /public/<HTX>/lot/<code> (pond, date, weight, feedings of the 30 days before, the event hash, whether the chain is intact, a QR code of the page's own address; no person's name). Worker pond-watch (every 30 minutes) suggests notify_low_oxygen when the 60-minute average oxygen of a pond is under 4 mg/L; it only suggests, and the action notifies managers and officers through the core after a person approved. A dashboard /dashboards/overview declares four cards. Roles are enforced in the handlers as well as in routes.protected: manager and officer do everything, a farmer views ponds and writes feeding entries. Dependencies: pgx/v5 and rsc.io/qr only. The image is golang:1.27-alpine building into FROM scratch (no shell, uid 10001, health check by the binary's own healthcheck). shrimp-farm seed-demo <HTX> fills the demo data idempotently. Harvest lots are saved in one transaction with their audit event (no event, no lot); a feeding line can be corrected once; readings older than 60 minutes are shown as old and not judged; every request has a deadline and the worker answers 502 when it could read no pond. The CI job platform-units now sets up Go and runs go vet and go test in the plugin. It requires core >=1.29.0.
  • Demo cooperative ST ("HTX Nuôi Tôm Sóc Trăng") and its demo (v2.0 phase 1, step 6): prisma/seed.ts creates ST with crop_types: ['Tôm thẻ chân trắng'] and no industry pack (the profiles of TC, LB and ST are in prisma/demo-cooperatives.ts; TC and LB keep tea-core, and a jest test and platform/tests/seed-test.sh assert it). The Keycloak realm has manager_st, officer_st and farmer_st in the form of the _tc users, and ./dxos demo accounts accepts the three _st names (it creates them on a realm that was imported before); its default list stays the five accounts of TC. make demo-seed-shrimp (platform/demo/seed-shrimp.sh) creates ST if the database has none, sets up its three accounts, installs shrimp-farm with --htx ST, runs shrimp-farm seed-demo ST (3 ponds, 14 days of feeding, 2 lots) and publishes 24 hourly readings per sensor per pond over MQTT with the broker account ST; pond B1 ends under 4 mg/L of dissolved oxygen so the pond-watch worker has a case. Besides the hourly history it publishes one point per sensor stamped "now", with B1 under 4 mg/L in its last three readings, because the worker and the pond page judge only the last 60 minutes (so the case lasts an hour after the run); a rerun in the same hour adds only one new "now" point per sensor. Without an ST broker account (or when the broker refuses it) the readings are skipped with a message that says how to add it (see Upgrade notes), and the command exits 0. It needs the web running (make web-up) and stops with a message naming it when it is not; it never turns the AI layer on, and prints how (./dxos agent enable ST, ./dxos apps actor enable) when platform.agent_settings has no enabled row for ST. DEMO_PASSWORD is forwarded to the three accounts. make demo-up runs it after the TC demo. The script reads only the DXOS_MQTT_DEVICES line of docker/.env.local and never runs that file as shell.
  • Acceptance of the phase 1 spec (§7): the section [shrimp-farm acceptance] of platform/tests/smoke-apps.sh (a fixture creates ST when the seed has not, install for ST, enablement, DXOS_PUBLIC_BASE_URL equal to the web's AUTH_URL, the platform admin switching tea-core of LB off and on, git status outside the app, seed-demo and its rerun, ponds in telemetry.registered_assets, an MQTT reading in telemetry.asset_readings, the audit event of a lot with source app:shrimp-farm, the public trace page through the gateway saying "Chuỗi kiểm toán còn nguyên" with a QR code, 403 for app mode with X-Dxos-Htx: TC, --purge), the chain of the agent for ST in smoke-app-actions.sh (a low reading, the proposal app.shrimp-farm.notify_low_oxygen, approval through the web, the notification to the manager) and the browser story apps/web/tests/e2e/story/shrimp-farm.spec.ts (no "chè" in the sidebar, bottom navigation and dashboard of manager_st, officer_st and farmer_st; the app cards; a tea page lands on the dashboard; pond, feeding line, lot and the public trace page; manager_tc keeps the 23-entry menu). CI installs shrimp-farm for ST before the story.
  • Apps scoped by industry pack (v2.0 phase 1, task 7): a manifest can declare pack (^[a-z][a-z0-9-]{1,30}$, needs requires.core: ">=1.29.0", refused for generated: true apps). An installed app with a pack is visible to a cooperative only when the pack is in htx_profiles.enabled_packs, in one place per query: PrismaInstalledAppRepository.list (menus, dashboard cards, the store's created apps) and isEnabledFor (the /apps/<id>/ proxy, the internal app API, the season figures), PrismaAppStoreRepository.snapshot (store listing, detail, install requests; platform.app_catalog.pack is new) and PrismaAppActionRepository.listAgentApps (an app with a pack is named only for the cooperatives that have it). A cooperative with no profile row sees only apps without a pack. leaf-purchase, tea-cupping, tea-shop, tea-tour, workshop-hygiene, htx-dashboard and ocop-dossier declare pack: tea-core (patch version bumps, requires.core >=1.29.0); TC and LB see them as before. The sweep expireOrphaned expires open proposals of a pack app for a cooperative that lacks the pack (app_disabled). isEnabledFor now answers false for an enablement row whose app is not installed (it used to answer true). A guarded Prisma migration 20261130100000_app_catalog_pack adds platform.app_catalog.pack after migrate as well as after platform-init.

Changed#

  • Core pages say "chè" only for a cooperative with tea-core: the farmer account page (parcel stats and list, subtitle), the farmer bulletin subtitle, the crop placeholder of Hồ sơ HTX and the disease-model consent switch of Hồ sơ HTX use neutral wording or are hidden without the pack; with the pack they are unchanged.
  • DXOS_PUBLIC_BASE_URL for every app container: the compose file ./dxos writes for an app now has environment: DXOS_PUBLIC_BASE_URL: ${AUTH_URL:-http://localhost:3000}, the web's own public address and default (./dxos and make apps-recreate take it from the running web container, so a release stack's AUTH_URL reaches the app without an env file), so a plugin can draw an absolute address (shrimp-farm draws the QR code of its trace page). No secret is copied. An app installed before gets it on the next make gateway-sync or make platform-up (they add the line and flag the container, make apps-recreate recreates it) or ./dxos upgrade <app>. Documented in docs/miniapps.md, section 10.
  • miniapps/shrimp-farm requires core >=1.29.0.
  • make demo-up example names 1.29.0; its shrimp step needs that release or later.

Fixed#

  • A proposal of an app installed a moment ago was refused with UNKNOWN_KIND: the agent's catalogue of app actions is kept for 60 s and ./dxos install runs in another process, so it could not know a fresh app. A miss for an app. kind now reloads the catalogue once when its entries are older than 5 s and looks again (at most one reload per 5 s; a known kind never reloads).
  • The farmer account menu shows "Hướng dẫn sử dụng" (the tea handbook) only for a cooperative with tea-core; in 1.28.0 it was shown to every farmer.

Upgrade notes#

  • Tea apps need ./dxos upgrade miniapps/<app>. The web reads pack from the installed manifest, which only ./dxos install and ./dxos upgrade rewrite; no Make target reinstalls apps. Run it for leaf-purchase, tea-cupping, tea-shop, tea-tour, workshop-hygiene, htx-dashboard and ocop-dossier (and any other installed tea app). Until then they behave as apps without a pack for every cooperative that enabled them, while the store already hides them from a cooperative without the pack.
  • Broker account for ST. Add ST:<password> to DXOS_MQTT_DEVICES in docker/.env.local (comma-separated with TC and LB; the example file has it). The broker takes it up when it is recreated: on a dev stack run make up-sensors; on a release stack run make demo-up OPENTEA_VERSION=<same version> again (make up-sensors uses the dev compose file). Without it make demo-seed-shrimp skips the readings and exits 0.
  • Every installed app is rebuilt and recreated once. The next make platform-up (or make gateway-sync then make apps-recreate) adds DXOS_PUBLIC_BASE_URL to the compose file of each installed app and recreates its container; ./dxos upgrade <app> does the same for one app.
  • The three _st accounts on a realm imported before v1.29.0. ./dxos demo accounts --password <password> manager_st officer_st farmer_st creates them; without --password a missing account has no password.

[1.28.0] - 2026-11-30#

Added#

  • Industry packs per cooperative (v2.0 phase 1, step 1): htx_profiles.enabled_packs (migration 20261130090000_htx_enabled_packs: every existing cooperative gets tea-core, a cooperative created later has none), the pack catalogue domain/packs (only tea-core for now), enabledPacks on the profile the web loads, and PUT /api/platform/htx/[code]/packs (platform_admin only; a pack outside the catalogue or a repeated one is 400). The platform page of cooperatives has a "Gói chè (tea-core)" checkbox per cooperative. Nothing is hidden yet: the tea menus, pages and APIs behave exactly as before. TC and LB are seeded with tea-core.
  • One menu source, pack-scoped pages and APIs (v2.0 phase 1, step 2): the four role menus live in lib/navigation/role-menus.ts with a pack mark per entry and are filtered by the cooperative's packs (menuFor); a cooperative without tea-core sees only the core entries, and "Thửa chè của tôi" shows only with the tea pack. The middleware sets x-dxos-pathname (overwriting any client value); the role layouts send a cooperative without the pack from a tea page to /<role>/dashboard, and requireTenant answers a tea API with 403 PACK_NOT_ENABLED, without a new database query. The login and register pages say "hợp tác xã" instead of "hợp tác xã chè". /api/search returns nothing for a cooperative without the pack, and the farmer profile shows the Zalo opt-out only with it. A user with no cooperative now sees the core-only menu instead of the full tea menu. TC and LB see and do exactly what they did before.
  • Audit read API for plugins: GET /api/internal/app-core/[appId]/audit/events?subject=&limit= (service audit) returns the app's own events for one subject in the cooperative of the context, newest first (limit 1 to 100, default 20), with chain_intact from the existing chain check of the public lot page. Another app's events and another cooperative's are never returned; subject and limit are bound parameters. The chain verdict is kept for 30 s.
  • ./dxos install <dir> --htx CODE[,CODE...]: enables the app only for the named cooperatives instead of every one. A bad value (a code, a space, a newline) is a usage error before anything is prepared, and a cooperative missing from htx_profiles is refused; an app already installed gets the missing cooperatives added (or nothing changes, and it says so). New dxos-cli pieces: commit --enable-for and enable <id> <CODES>. Without --htx install behaves as before.
  • miniapps/hello-node 0.2.0, the acceptance plugin of the plugin protocol: it uses nothing but the Node.js standard library and needs no change outside its own folder. POST /tanks (manager) registers a sample_tank through the core in user mode (the user's token is forwarded, the cooperative comes from it) and writes a TANK_REGISTERED audit event; callCore also speaks app mode. The sample_tank kind has one sensor level (0 to 300 cm), so the ingest worker accepts htx/<htx_code>/sample_tank/<code>/level. A migration creates the app's schema and a hook_calls table (the sample stays free of dependencies and does not query it); a workflow ping (webhook app-hello-node/ping calling the public route /hooks/ping) is counted in memory and read at /hooks/count.
  • Acceptance smoke of the nine items of the phase 0 spec (§7): the section [hello-node acceptance] of platform/tests/smoke-apps.sh installs hello-node, calls the core in app mode with the app's own key, publishes MQTT readings (stored, out_of_range, a plot and a batch reading still in their old tables), checks the isolation cases (an HTX the app is not enabled for, a wrong or empty key, the app-core path of another app), then removes it (container, route, compose file gone; webhook 404; kind inactive; unknown_kind; no row of telemetry.asset_readings or audit.events lost; chain intact), reinstalls it and checks that git status shows nothing outside miniapps/hello-node/. The user-mode flow is a browser story, apps/web/tests/e2e/story/hello-node.spec.ts, which the browser-store job runs after installing the app (a smoke token cannot reach user mode: the core takes a forwarded user token only from the web's client).
  • "Viết plugin bằng ngôn ngữ bất kỳ" in docs/miniapps.md (§10): the whole contract in one place (headers, the two modes, error codes, limits, the MQTT topic, the healthcheck for an image without a shell, workflow rules, the removal guarantees) and a Go skeleton, enough to write a plugin without the Python helpers. A schedule trigger of a plugin workflow should not fire more often than once a minute (no validation rule yet).
  • Asset kinds and sensors declared by a plugin: the new manifest key telemetry.asset_types (1 to 5 kinds, 1 to 12 sensors each with unit, min < max; plot and batch are reserved; needs requires.core: ">=1.27.0", not allowed for AI-generated apps). ./dxos install registers the kinds in telemetry.asset_kinds in a new journaled telemetry step (a failed install puts a kind that already existed back exactly as it was, upgrade deactivates a dropped kind, remove and --purge only deactivate and delete nothing). A kind belongs to one app; a second app declaring it is refused.
  • General MQTT topic htx/<htx_code>/<asset_kind>/<asset_code>/<sensor>: the ingest worker listens to htx/+/+/+/+ and the broker ACL lets a device write htx/%u/+/+/+ (still only under its own HTX). A kind the plugin declared is checked against telemetry.asset_kinds (cached for 30 s) and stored in telemetry.asset_readings; new reject reasons unknown_kind and unknown_asset. plot and batch keep their ranges, reasons and tables.
  • Asset API for plugins (needs telemetry.asset_types): PUT and DELETE /api/internal/app-core/[appId]/assets/[kind]/[code] (register or update, deactivate; never deletes), GET .../assets, GET .../assets/[kind]/[code]/readings and GET .../ngsi-ld/entities (normalized NGSI-LD, urn:ngsi-ld:<type>:<htx>:<code>). The cooperative comes only from the caller context; at most 1,000 active assets per app and cooperative.
  • n8n workflows shipped by a plugin: the new manifest key workflows (1 to 5 entries of name and a .json file of at most 256 KB; needs requires.core: ">=1.27.0", not allowed for AI-generated apps). Only one shape is accepted, a schedule or a webhook that calls back into the app's own public route: five node types (scheduleTrigger, webhook, respondToWebhook, httpRequest, noOp), no credentials, no = expression at any depth, httpRequest urls fixed to http://apisix:9081/apps/<id>/... under a prefix of routes.public, webhook paths under app-<id>/, no pinData or staticData. ./dxos validate checks every file before anything reaches n8n. A new journaled workflows step (last) normalises each workflow (app-<id>-<name>, inactive, settings reduced to executionOrder) into docker/runtime/<project>/n8n/apps/<id>/; ./dxos install imports and publishes them once the app is healthy and before it is registered (a failed install unpublishes and archives them), upgrade imports and publishes again and archives a dropped workflow, remove and --purge unpublish and archive them first and keep the app if n8n refuses. With n8n stopped, ./dxos uses a one-off n8n container and says so. An app without workflows never calls n8n. Workflow nodes never follow redirects (followRedirects: false is forced on every httpRequest; a file that turns it on is rejected). A failed upgrade after n8n was touched puts the previous set back. New subcommands workflows-archive <id> and workflows-rollback <id>.
  • File and notification API for plugins (needs requires.services files or notify): POST /api/internal/app-core/[appId]/files (a presigned upload URL, valid 300 s, into the private bucket dxos-scanner polls; key apps/<id>/<htx>/<uuid>/<clean name> built by the core; JPEG, PNG, WebP, PDF, CSV, XLSX up to 50 MB), GET .../files/status (pending, clean, quarantined from audit.file_scans) and POST .../files/download-url (only for a file the scanner found clean, else 409 FILE_NOT_CLEAN); a key outside the caller's app and cooperative is 403 before storage is touched. POST .../notifications notifies roles or up to 20 named members of the caller's cooperative in the app and, optionally, on Telegram through the existing outbox; link must stay in the app's own area; at most 30 a cooperative and app an hour (429), counted under an advisory lock in the new platform.app_notifications (platform/postgres/init/14-app-core.sql).
  • Background workers for plugins: the new manifest key agent.workers (1 to 5 named routes with every_minutes 30 to 1440; agent now needs actions and at least one of suggestions or workers; needs requires.core: ">=1.27.0", not allowed for AI-generated apps). dxos-agent calls each worker of an enabled app with the cooperative's agent token on its own interval (checked every 30 minutes), reads the same answer as suggestions (at most 10 items) and files each as an app.<id>.<action> proposal through the existing approval path; a worker never runs anything itself, and a failing worker is retried next cycle without stopping the others. The gateway adds an agent-only route app-<id>-agent-<n> per worker (the suggestions route keeps agent-1). The web treats agent.suggestions as optional.
  • Reserved sensor names: a sensor of telemetry.asset_types may not be named id, type or name, since it would overwrite the NGSI-LD entity's own key.
  • dashboards declaration: the new manifest key dashboards (1 to 6 card sources with id, title_vi, path under a protected prefix and roles that prefix allows). Declaration and validation only; the response contract ({"cards": [...]}, at most 12) is documented, nothing is rendered yet.

Fixed#

  • Pages and app frames no longer hang after a few idle seconds. The web server closed an idle connection after 5 s (Node's default). A browser that reused the connection at that moment, through Docker's port proxy, got no answer and no reset, so a few requests of one page never finished (seen as a failed browser test in two release runs). The web container now sets KEEP_ALIVE_TIMEOUT to 310 s, longer than a browser keeps an idle connection.

[1.27.0] - 2026-11-30#

Added#

  • miniapps/workshop-hygiene 0.1.0 (Sổ vệ sinh xưởng): a five-item hygiene checklist per shift (start and end), quick scale checks against a reference weight, scale calibration and machine maintenance logs with green/amber/red due states, an A4 print copy, CSV and OCOP metrics JSON for VietGAP and food-safety inspections. Ledger rows are append-only (database triggers); a mistake is fixed by a correction row with a reason, and new rows can only be dated today or the two days before. The agent suggests followup.create tasks before calibration and maintenance deadlines and when the core shows lots, leaf tickets or roasting batches with no start-of-shift log; it never writes a log. Farmers can see the purchase scales' calibration state when the manager turns it on.
  • App identity and the audit API for plugins: a mini-app that declares the new requires.services (audit, files, notify; needs requires.core: ">=1.27.0", not allowed for AI-generated apps) can call the core. The app sends its own gateway secret in X-Dxos-App-Gateway; ./dxos writes a per-app app-<id>-core-1 gateway route that checks it, rewrites the path to /api/internal/app-core/<id>/... and rate-limits the app to 300 requests per minute. sync_gateway rebuilds that route on every run and refuses a fragment whose core route names another uri or another app.
  • POST /api/internal/app-core/[appId]/audit/events appends an event to the SHA-256 audit chain with source app:<id>. The cooperative comes only from the verified user token or from X-Dxos-Htx checked against the app's enablements, never from the body. ./dxos remove --purge still deletes no audit row.

Fixed#

  • The improvement smoke passes at any hour. A weekly agent is not due on a Monday before 06:30 (Vietnam), so the smoke failed in CI runs started in that window. The agent reads an optional DXOS_AGENT_IMPROVEMENT_AT (HH:MM) and the smoke starts it with 00:00.

[1.26.4] - 2026-11-29#

Changed#

  • Updated the manager lot register, members, partner map, cooperative profile, bulletin and notifications to use the illustrated manager layout.

  • The manager certificate page places the register beside the upload form and shows an illustrated empty state.

  • The manager workshop groups batch planning, selection and processing results above the two-week forecast. The seasonal report picker uses smaller type.

  • The manager report picker groups the annual shortcuts and custom date range in two illustrated panels.

  • Managers can select a date range on the illustrated settlement page and review it before creating a draft period.

  • The manager input-supplies page groups the catalogue, household advances, daily total and bank details in a responsive illustrated workspace.

  • The manager weighing-ticket page groups date, status and household filters above the filtered weight and amount, with daily CSV export and locally scrollable ticket details.

  • The manager purchase-price page groups daily price editing by grade and reserves a clearly disabled panel for price history.

  • The manager pesticide catalogue adds an illustrated header and a compact table showing product targets, linked material units and the source of the effective withdrawal period.

  • The manager growing-zones page pairs the interactive parcel map with area, status and crop filters, a filtered summary, and CSV export for visible or selected parcels.

  • The manager journal approval page pairs four status filters with the review table, CSV export and bulk approval on an illustrated tea landscape.

  • The manager overview and harvest schedule use illustrated tea landscapes. The overview groups six operational figures with notices, weather and pending journals. The harvest calendar pairs the selected day with its planned work and lists parcels awaiting a date.

Fixed#

  • Manager journal approval shows the child holding a checklist at the same height and position as the tea picker on overview and harvest schedule. The pending journal panel aligns with the overview panels above it.

  • The sidebar keeps the same width and menu spacing when switching between manager overview, harvest schedule and journal approval.

[1.26.3] - 2026-11-29#

The 1.26.2 fixes, released. The v1.26.2 tag stays, but its release gate failed and nothing was published under it.

Fixed#

  • The platform smoke waits 180 s for the agent's first TC journal-review run. Credentials load in sorted order, so LB's agents call the CPU Ollama before TC runs; one slow LB round kept TC past the old 90 s and failed the v1.26.2 release gate twice.

[1.26.2] - 2026-11-29#

Fixed#

  • The cooperative chat answers the dry tea stock with the right number. The snapshot the model reads listed all five grades, most at "0,0 kg", and the small local model answered with the first zero. It now gives one total and only the grades in stock, or says none is left.
  • A fresh install without a Groq key has a working chat. Both example env files set OLLAMA_MODEL=openai/gpt-oss-20b, a Groq model; without GROQ_API_KEY the chat went to the local Ollama, which answered 404, and showed "Dịch vụ AI hiện không khả dụng". The default is now qwen2.5:0.5b, the model the platform pulls; the comments say to name a Groq model only with a Groq key.

[1.26.1] - 2026-11-29#

Fixed#

  • The PWA service worker no longer caches API calls or page data requests. Cached /api/* calls and Next.js router data requests (RSC) could hold the browser's six connections per host, so pages and mini-app frames hung. They now go straight to the network; static assets and HTML pages keep their cache, and the offline journal queue (IndexedDB) is unchanged.
  • Browser tests block the PWA service worker. Two CI runs hung on a mini-app frame while sw.js and other requests stayed pending: the service worker can hold the browser's six connections per host. No spec tests the service worker.
  • After signing in, a person lands on their role's home, not the public lookup page. The home page / is prerendered, so Next.js served a bare / without running the middleware's role redirect. Auth.js now returns to /?from=auth, which the middleware sends to the role home (src/lib/auth/sign-in-redirect.ts).
  • The platform smoke no longer stops silently after the concurrent audit writers. Its watchdog cleanup failed under set -e when the watchdog had already exited, which ended the smoke with no FAIL line (a flake since 2026-11-08, hit by the v1.26.0 release gate).

[1.26.0] - 2026-11-29#

Added#

  • accountant role for mini-apps: the manifest schema, appkit.ROLES (synced into every app), the web AppRole and a new /accountant/apps/<id>/... page work as the manager's do. The accountant menu has an "Ứng dụng" group that lists only the apps with an accountant menu entry.
  • runtime.healthcheck: an optional exec-form command (["CMD", ...]) for the Docker healthcheck, so an image without Python can be a mini-app. Without it the compose file is unchanged.
  • miniapps/hello-node: a Node.js sample mini-app (standard library only, no npm package) with the gateway-secret check, the identity page, a read-only non-root container and its own healthcheck. node --test runs in CI and make apps-smoke installs it.

Changed#

  • CI skips the stack smokes for light pull requests. A PR that only touches docs, the site, n8n workflow exports, licence metadata or web unit tests runs lint, type-check, unit tests, build and REUSE in a few minutes. scripts/ci-change-scope.sh decides; a push to main and a release still run everything.
  • Containers are named opentea-* (opentea-postgres, opentea-web, ...) instead of agrimarket-*. Volumes and networks keep their names, so data stays. On an existing stack, make platform-up and make web-up recreate the containers under the new names; docker exec commands use the new names (docs/dev-setup.md).

Fixed#

  • n8n officer-reminder: its error log wrote the literal {{$workflow.name}}. The workflow name and execution id now go in as query parameters, with commas in the name replaced. Contributed by @jay23606 (PR #118, issue #69).

Upgrade notes#

  • Containers are renamed opentea-*. Run make platform-up and make web-up: they recreate every container under its new name. Data stays, because volumes and networks keep their names. Scripts of your own that call docker exec agrimarket-... need the new names.
  • Mini-apps can declare runtime.healthcheck and an accountant menu entry. Such an app needs requires.core: ">=1.26.0".

[1.25.0] - 2026-11-29#

Added#

  • docker/docker-compose.public.yml for a public host behind a reverse proxy. It pins every published port to 127.0.0.1, because Docker's ports bypass the host firewall, and it sets Keycloak's public URL from KC_PUBLIC_URL with forwarded headers. A test fails when a new published port is not pinned.
  • H-P-D-I share radar on the manager board: the maturity card now splits 100% into H, P, D and I from real records (P from weighings that passed the withdrawal gate, D from sensor parcels with a reading in 24 hours, I from AI proposals a person approved; each capped at 30%, H is the rest) and draws it as a plain SVG radar with the evidence under it.
  • Headless Tier 1:
  • make up-headless starts the platform without web or any UI;
  • MQTT ingest now checks telemetry.registered_assets, a platform view over the new telemetry.assets table (any domain registers assets there) and the tea parcels and batches, so it no longer reads tea tables;
  • existing stacks get both with make platform-up.
  • Non-tea book template: custom-books gains craftlog, a production log for a bamboo and rattan craft village.
  • One-click backward lineage from a lot: GET /api/lineage?kind=lot&code=...&direction=backward walks lot, processing batches, fresh leaf tickets, crop cycles and journal entries (legacy lots go parcel to cycle to journal), each node with the SHA-256 of its latest audit row, in one batched read per level. A "Truy hồi" button on every lot row on /manager/lots and /officer/lots opens the recall panel with the trace and the line "Chuỗi kiểm toán: N/M bản ghi có dấu SHA-256". The default forward drill and the signed evidence bundle are unchanged.
  • make demo-up OPENTEA_VERSION=X.Y.Z [DEMO_PASSWORD=...]: one command for a stage demo from the published images. It fetches and checks the model files, pulls the release, starts the stack in the README order, seeds the base sample data on a fresh database only, prepares the five demo accounts and loads the TC demo story.
  • REUSE 3.3 compliance:
  • REUSE.toml and LICENSES/ (MIT, Apache-2.0, CC-BY-4.0, OFL-1.1) cover every file;
  • third-party material is named: the ICTU-OpenAgri model, the Piper voice, the Be Vietnam Pro font and the Gradle wrapper;
  • CI runs reuse lint and a gitleaks scan of the whole history.
  • GS1 Digital Link, EPCIS 2.0 and NGSI-LD:
  • /01/{gtin}/10/{lot} checks the GTIN check digit, then redirects to /q/{lot}; with Accept: application/ld+json or ?format=epcis it returns EPCIS 2.0 JSON-LD for lots whose QR was exported. The GTIN is not stored.
  • GET /api/ngsi-ld/v1/entities lists the cooperative's parcels and processing batches as NGSI-LD, read only, for manager and officer.
  • GET /api/iot/ngsi-ld/parcels/{code} is one parcel's digital twin: location, current cycle and the latest value of each sensor with its observedAt.
  • Workshop roasting telemetry: MQTT topic htx/<HTX>/batch/<batch_code>/<sensor> (roast_temp, dry_temp, dry_humidity) into telemetry.batch_readings; /q shows "Mẻ sao đạt chuẩn nhiệt" for a verified curve, and a flat stream never earns it. Existing stacks get the table with make platform-up.
  • Lineage, recall drill and signed evidence:
  • GET /api/lineage runs a read-only recall drill from a parcel, a pesticide, a batch or a lot, down to the orders it reached.
  • GET /api/lineage/bundle downloads a lot's evidence bundle, signed with Ed25519; GET /api/public/verify-key publishes the key that checks it.
  • The "Truy vết và thu hồi thử" panel is on the lots pages of the head and the officer.
  • Production needs DXOS_EVIDENCE_SIGNING_KEY; without it the bundle answers 503.
  • Chat mode "Vận hành HTX" (type: cooperative) for the manager, officer and accountant, with a new /accountant/chat page.
  • It answers from the HTX's own board figures; a sentence with a number outside them is dropped, and with the model down the figures themselves answer.
  • The accountant gets this mode only; market and technical stay 403 for that role.
  • H-P-D-I self-assessment card below the six manager board blocks, with an honest empty state under 5 records and the source of every figure.
  • Wind tunnel on the cross-check thresholds: GET /api/agent/settings/cross-check?preview_* returns the alerts the last 30 days would raise now and with the previewed values. Read only.
  • One-click handoffs between existing screens: no schema change.
  • Cross-check notices (A13) show their evidence in plain Vietnamese (kg, day, parcel code, household) and link to the screen where the person acts. An officer can now decide internal staff notices (A2, A9, A13) as well as a manager, and gets their Telegram prompts; notices to households stay manager-only.
  • Price board: "Giữ nguyên giá kỳ trước cho hôm nay" publishes the latest earlier price of each grade not priced today, through the existing publish use case, after a confirmation that names the grades with no earlier price. The board shows the date of that price, and the weighing form shows a banner while nothing is published today.
  • A finished processing batch links to "Đóng lô từ mẻ này →", which preselects the batch in the lot-from-batches form. Nothing is created until the person confirms.
  • The farmer diagnosis result links to a new spraying entry for the parcel that was diagnosed.
  • /officer/journal shows the open A1 verdict per entry ("AI A1: Đạt quy tắc" or "AI A1: Cần kiểm tra") from one batched read, GET /api/journal/review-status.

Changed#

  • CI: the 56-minute platform job is five parallel jobs.
  • Platform Unit Tests (about 3 min) needs no stack.
  • The other four each start their own stack: Platform Smoke Test (smokes and agentic, about 24 min), Browser Smoke (Core), Browser Smoke (Store & Apps), and Mini-app Smoke.
  • apps-smoke checks the platform after removing the apps without the web checks: 149 PASS. The Platform Smoke Test job runs those 42 web checks.
  • The project site moved to https://opencoop.ailearn.website and the live demo is https://app.ailearn.website. The site has a "Dùng thử bản demo" button. GitHub Pages now only redirects the old maiychrus25.github.io/OpenTea-DX-OS/<path> links to the same path on the new site (scripts/build-pages-redirect.sh).
  • audit.events gets an index on (table_name, row_id, id DESC). The backward lineage reads the newest event of given rows; without the index it would scan the whole append-only log. make platform-up adds it.
  • The three model files left the Git tree (about 80 MB: leaf_disease_model.keras, tea_leaf_model.keras, vi_VN-vais1000-medium.onnx).
  • They live on the release models-2026.11.
  • download-model.sh and download-model.ps1 fetch them and check each SHA-256 against models.sha256.
  • A file that is already in place with another hash is reported and kept.
  • The release bundle drops from about 80 MB to under 1 MB.
  • Seven scratch scripts were removed from apps/web. They held a hard-coded Keycloak admin/admin login and test phone numbers.
  • The autopilot probation is a hard block: a kind is opened and runs on its own only with at least 10 human decisions in 30 days and a match rate of 90% or more. Before, 90% was only a warning.

Fixed#

  • GET /api/seed-farmer answers 404 in production. It is a development helper that let any signed-in user create a household linked to their own account.
  • Telegram: once a proposal is decided from its card, the card turns into the result and loses the Duyệt and Từ chối buttons.

Upgrade notes#

  • Run make platform-up, then make web-up.
  • platform-up applies 12-batch-telemetry.sql, 13-registered-assets.sql and the new audit.events index.
  • web-up rebuilds the web.
  • Set DXOS_EVIDENCE_SIGNING_KEY in docker/.env.local: a PKCS#8 PEM from openssl genpkey -algorithm ed25519, on one line with \n between the PEM lines. Without it, a production web answers 503 on the evidence bundle and 404 on /api/public/verify-key.
  • A public host behind a reverse proxy adds -f docker/docker-compose.public.yml and sets AUTH_URL, KC_PUBLIC_ISSUER, KC_PUBLIC_URL and MINIO_PUBLIC_ENDPOINT (README, "Bản phát hành").
  • After pulling, run bash download-model.sh (Windows: .\download-model.ps1). Git removes the three model files from your working tree when you pull, because they are no longer tracked; until you run it, disease-api and piper have no model.

[1.24.0] - 2026-11-29#

Added#

  • Stage demo data for HTX Tân Cương: make demo-seed (or npm run demo-seed in apps/web) runs after seed and builds one connected story, with no new business feature. It covers:
  • today's leaf prices;
  • recent weighing tickets;
  • TC-A3 still in withdrawal, so the weighing station shows the red block;
  • a finished processing batch at 4.75 : 1;
  • lot TC-CHE-A3-001 with all four layers on /q and a sample VietGAP certificate;
  • a closed settlement with an advance offset and a VietQR on the slip;
  • the inputs that make the cross-check agent raise both alerts.

A second run adds nothing. The closed settlement is never touched again, because the ledger is append-only. - ./dxos demo accounts [--reset-otp] [--password <p>] prepares the five demo accounts (platform_admin, manager_tc, accountant_tc, officer_tc, farmer_tc): - it creates a missing one with its role and htx_code; - it clears stuck required actions such as TOTP setup; - it removes OTP only with --reset-otp.

Any other username is refused. - python -m dxos_agent --once cross-check --htx TC runs the cross-check agent once, on the same code path as the daily schedule. - scripts/check-schema-doc.py fails CI when docs/database-schema.md and schema.prisma disagree on a table or column.

Changed#

  • Mini-apps accept only requests that came through the gateway.
  • Each installed app gets its own secret in its env file.
  • APISIX sends it as X-Dxos-App-Gateway on every route of that app, public routes included.
  • The app kit, hello and hub-mobile refuse anything else with 403, except GET /healthz. Without the secret they refuse every request.
  • This closes the cross-app spoofing limit on dxos-apps-net (R24).
  • The app store hides htx-dashboard and hub-mobile unless DXOS_LABS is on, like leaf-purchase and farm-supply, so the store matches the README and the site. They show "Đang đóng băng" and cannot be installed. The board's "Phân tích chi tiết" link still works for an HTX that already has htx-dashboard.
  • README and site are rewritten for v1.23, centred on the OSI-licensed core.
  • n8n (Sustainable Use License) and the Groq, OpenAI and Anthropic APIs are optional integrations.
  • They cover five roles with role switching, dxos-zalo in the release images, and the advertised mini-apps only: tea-shop 0.4.0, tea-tour, custom-books 0.3.0 and hello.
  • The site screens and the social card are real screenshots of the demo data. No frozen app is shown.
  • docs/database-schema.md matches schema.prisma column by column: chat_history is added, and the old users table is removed. DEV-016 is fixed. DEV-015 is updated for v1.23.0.

Fixed#

  • make apps-recreate rebuilds the app image. It only recreated the container, so an app installed before v1.24 kept its old image, whose code ignores the gateway secret, and still answered direct requests on dxos-apps-net.
  • The cross-check agent (A13) never reached Hasura (since 1.22.0). It declared its spraying and ticket filters as timestamptz, while journal_entries.entry_date and fresh_leaf_tickets.weighed_at are timestamp columns. Hasura refused the query, and the run only logged an error. The filters now use timestamp, from Vietnam midnight written in UTC. Its read of its own earlier proposals also filtered on a column the agent role cannot see; the Hasura permission already limits it to cross-check proposals. A test now checks every field it reads against the agent role's columns.

Upgrade notes#

  • Run make platform-up after pulling. It creates a gateway secret for every installed mini-app, then rebuilds and recreates those apps so they check it. Until it runs, an app installed before this release still accepts requests that did not come through the gateway.
  • Demo stage: 1. ./dxos demo accounts (add --reset-otp if an account still asks for TOTP); 2. npm run seed once on a fresh database; 3. make demo-seed.

Do not run seed again on the same database after demo-seed; rebuild the database instead. - The cross-check alerts for the demo appear after python -m dxos_agent --once cross-check --htx TC, run in the agent container.

Known limits#

  • hub-mobile (frozen) has no gateway check.
  • make demo-seed needs network for npm ci in the migrate image (about 30 s).

[1.23.0] - 2026-11-28#

Added#

  • One label list for tea pests and diseases (apps/web): officers confirm a disease report with a label from disease_labels, 14 codes, with the five targets first: Rầy xanh, Bọ cánh tơ, Nhện đỏ, Phồng lá chè, Bọ xít muỗi.
  • The free-text name stays.
  • Telegram asks for the label too.
  • Older reports are labelled only on an exact name match.
  • Training consent (apps/web): the head can let the cooperative's confirmed photos be used to train the tea model. It is off by default, needs a confirm step to turn on, and is audited.
  • Field photo manifest: GET /api/platform/disease-dataset (platform_admin only) lists the confirmed, labelled photos of the cooperatives that agreed.
  • It carries no names, phones or household ids; each photo has a one-way household_key, its sha256 and a download link that lives 15 minutes.
  • It is paged (500 per page, next_cursor), and fetch-field follows the pages.
  • ai-models/tea: training can now use the cooperatives' confirmed field photos, with stricter checks before a model ships.
  • train.py fetch-field downloads the photos, checks their sha256 and strips every EXIF and GPS tag.
  • A class without public photos needs at least 150 field photos.
  • A not_tea_leaf class is always included.
  • Stricter quality gates: accuracy 0.80, recall 0.70 per target, field accuracy 0.75 on photos held out by cooperative, or by household while only one cooperative has agreed (recorded as field_split in the registry). A model that fails, or a class with too few households to split, prints BLOCKED with the reason and writes nothing.
  • Model registry: ai-models/tea/registry.json pins the tea model's version and sha256.
  • disease-api refuses a model file that does not match it: /health shows why, and the general model keeps working.
  • Every tea prediction reports model_version, and the web stores it on the report.
  • CI checks that the sha256 matches.
  • Care steps (no medicine) for the four new targets, and a "chụp lại" step when the photo is not a tea leaf.

Changed#

  • Zalo errors: the relay follows the real ZNS error codes.
  • -124 and -216 refresh the OA token and resend.
  • Template errors (-109, -111, -112, -117, -131), a wrong phone (-108), no Zalo account (-118) and no balance or quota (-115, -126, -211) stop at once, with a Vietnamese reason.
  • Chatbot sources: the technical chatbot names the files of the passages it used as sources when the model writes none.
  • Scientific names: Rầy xanh and Bọ cánh tơ use the names of Vietnamese tea references: Empoasca flavescens and Physothrips setiventris.

Fixed#

  • make up-voice failed on Apple Silicon because the whisper.cpp image is amd64 only. The two whisper services now ask for linux/amd64, which Docker Desktop runs emulated.

Upgrade notes#

  • make platform-up, then make web-up: the first applies two migrations (20261128180000_disease_labels and 20261128180100_disease_training_consent), the second rebuilds web and disease-api. disease-api now loads the tea model only when its sha256 matches ai-models/tea/registry.json.
  • Field data is not collected until a cooperative's head turns on "Cho phép dùng ảnh đã xác nhận để huấn luyện mô hình nhận diện sâu bệnh".

Known limits#

  • With photos from a single cooperative, the field test holds out whole households, not cooperatives, so its score may flatter the model on a new cooperative. The registry says which split was used.
  • not_tea_leaf is trained on synthetic noise only.
  • The officer disease list needs the core gateway. It cannot be checked on a stack without it.

[1.22.0] - 2026-11-28#

Added#

  • Cross-check agent (A13): every morning at 05:45 the agent raises two alerts for officers and the head, as proposals with evidence; it never changes data.
  • Pesticide advanced to a household, but no spraying logged on any of its parcels within 10 days.
  • Leaf weighed on a parcel in one flush above 1,800 kg per hectare × 1.35. It is raised again only after a further 20% of that limit.

The head changes the four thresholds on /manager/ai/settings. The agent reads advances, tickets and batches without any money, name or phone column. - 14-day forecast (apps/web): /officer/processing and /manager/processing show the fresh and dry tea expected over the next 14 days, by week and by parcel. - A parcel's figure is the median of its last three flushes, or its area times the norm when it has none (marked "Theo định mức"). - Dry tea is fresh ÷ 4.75. The director board's dry stock block adds the 14-day figure. - Technical chatbot reads PDFs: text PDFs in the cooperative library are read, and the answer is built from the four passages that best match the question, each citing its file. - A question with or without Vietnamese diacritics finds the same passage. - Scanned PDFs are named as unreadable and never used. - Files marked ai: false, or in a folder with .ai-ignore, are never read. - New dependency unpdf 1.6.2 (MIT). - "Nghe" for farmers: a listen button on today's prices and picking dates, the journal guidance, the diagnosis care plan and the ledger balance. It never reads a bank account. Spoken audio is cached for 7 days. - Zalo messages for members (platform OA): members who agreed get four ZNS messages, through one platform Zalo OA and the new dxos-zalo relay: - today's leaf price; - a weighing receipt; - "withdrawal ended" for their parcel; - their settlement result, with a link to the slip.

The details: - Each cooperative turns Zalo on, picks the kinds, sets quiet hours (default 21:00–06:00) and a monthly quota (default 2,000) on /manager/zalo, which also lists deliveries with the reason a message was not sent. - Officers record consent on the household page. A farmer can turn messages off for their own household from the profile. A household without consent is never sent anything. - The platform admin enters the OA token and the approved ZNS template ids on /platform/zalo. Tokens are stored encrypted and never shown again. - A ZNS stub (dxos-zalo-stub, profile zalo-test, port 8084) lets the smoke run every message end to end without an OA. - Tea handbook template (docs/templates/para-tea-cooperative): 66 notes and 5 tables on cultivation, pests and diseases, processing and sales, food safety, cooperative law, finance and regional data, ported from the resource survey by Nguyễn Bá Quyến (PR #99) into English kebab-case folders, each file crediting the author and its own sources. The officer pesticide reference carries ai: false. ./dxos para seed <HTX> [--dry-run] copies the template into para/<HTX>/ through the web document API, only files that do not exist yet.

Changed#

  • POST /api/tts now enforces 20 requests per minute per person (429 RATE_LIMITED).

Upgrade notes#

  • Set DXOS_ZALO_TOKEN_KEY in docker/.env.local to 32 random bytes (64 hex characters, for example openssl rand -hex 32) before saving an OA token; the web refuses to store a token without it.
  • make platform-up, then make web-up: the first creates the Zalo tables (10-zalo.sql), restarts Hasura so the agent can read the new tables, and starts dxos-zalo, which waits healthy until a token exists; the second rebuilds the web app at 1.22.0. No data migration.
  • Cross-check agent: it runs for each cooperative that already has the agent enabled. Review the thresholds on /manager/ai/settings.
  • Zalo (optional): ./dxos zalo enable creates the Keycloak client dxos-zalo. Set ZALO_APP_ID and ZALO_APP_SECRET so the relay can refresh the token. As platform_admin, enter the OA token and the four ZNS template ids on /platform/zalo. Then turn Zalo on per cooperative on /manager/zalo and record consent.

Known limits#

  • The ZNS error codes in platform/zalo/dxos_zalo/zns_api.py have not been checked against Zalo's documentation; check them before going live.
  • The TTS limit is per web process.
  • Text is pulled from a PDF the first time the chatbot reads it, not when it is uploaded.
  • The forecast does not use the weather.

[1.21.0] - 2026-11-28#

Added#

  • Director board (apps/web): /manager/dashboard answers the six morning questions on one screen:
  • fresh leaf weighed today against yesterday;
  • today's leaf prices, or a button to publish them;
  • what the cooperative owes its members;
  • dry tea in stock by grade;
  • what traders still owe;
  • red alerts: parcels in withdrawal, off-band batches, batches left open, old stock, a draft settlement, members unpaid for more than 7 days, no price after 7:00, and overdue wholesale orders.

Each block loads on its own. /accountant/dashboard shows the money blocks. - Sales drawn from lot stock (apps/web): the head and the accountant record wholesale orders to a partner from QR-exported lots, in kilograms with one decimal at a price per kg. - Stock is counted in grams, and an order larger than what is left is refused. - Payments are recorded against the order and can never exceed it. - The default due date is 30 days after the order and can be changed per order. - Trader receivables and overdue orders show on the board and in "Công nợ thương lái". Nothing is sent to traders. - Only the head cancels an order, and only before any payment. - Core Action API for mini-apps: /api/internal/apps/*, reachable only on the internal gateway port. A mini-app calls it with the manager's own token, which the core checks again. - tea-shop 0.4.0: a product can be linked to a QR-exported lot, with the net weight of one pack. - Confirming an order records it in the core, so retail and wholesale draw from the same lot stock. - If the lot is short or the core cannot be reached, the order is not confirmed. - It needs core 1.21.0. - Season and year report (apps/web): /manager/reports builds a report for the members' assembly over a year or chosen dates. It covers members and area, leaf bought by month and grade, member payments and advances, processing, lots and valid certificates, sales and receivables, and safety. It prints on A4, and each section downloads as CSV.

Changed#

  • The cooperative head's home page is the director board. The world tea price and the area cards moved off it.
  • The accountant can read the partner list, to pick the buyer of a wholesale order.

[1.20.0] - 2026-11-28#

Added#

  • Processing batches (apps/web):
  • Officers and heads open a roasting and drying batch, add whole weighing tickets that are not in another batch, and record the dry tea out by grade (Đinh, Tôm nõn, Móc câu, Bồm, Cám).
  • The fresh to dry ratio is checked against 4.50–5.00 : 1. A batch outside that range finishes only with a written explanation.
  • A ticket in a batch cannot be voided.
  • Lots from batches (apps/web): a lot is closed from the dry tea stock of finished batches, one grade at a time. Its weight is the stock drawn, never more than what is left.
  • Its parcels and flushes come from the batches' tickets.
  • Each ticket is checked against withdrawal on its own weigh day.
  • Certificates (apps/web):
  • The cooperative stores VietGAP, OCOP, organic and other certificates with number, issuer, dates and the original file (PDF, JPG or PNG up to 10 MB) in the stack's SeaweedFS store.
  • A QR export attaches the certificates valid that day.
  • The head can revoke a certificate, and the public page then shows it as revoked.
  • One public QR page (apps/web):
  • /q/<lot code> shows four layers: origin, withdrawal safety ticket by ticket, the processing batches with their ratio, and certificates.
  • Names of people are hidden unless the head allows them in the cooperative profile.
  • Old labels pointing at /lot/<lot code> are redirected with a 308.
  • A label page prints QR labels at 50×30, 40×30 or 60×40 mm, one label per page.

Changed#

  • Creating a lot straight from parcels (POST /api/lots and the chat action) and exporting a lot that has no batch behind it now need DXOS_LABS; lots already exported keep their pages.
  • Lot codes are numbered under a lock, so two lots made at the same moment no longer collide.

[1.19.0] - 2026-11-28#

Added#

  • Flushes and the pesticide catalogue (apps/web):
  • Journals, weighing tickets and lots belong to a flush (cycle_id). After a harvest, the next care entry opens a new flush. Pruning is a journal activity.
  • Farmers and officers pick sprays from a catalogue of 20 products with a minimum withdrawal period by group: 7 days for botanical, microbial and biological products, 14 for chemical ones and for "Thuốc khác". Each floor is flagged "Mức sàn mặc định — cần đối chiếu nhãn thực tế". The platform admin sets the label period for the catalogue, and the cooperative can set its own label above the floor.
  • The journal form shows only the fields of the chosen activity. A harvest records "Sản lượng búp tươi (kg)".
  • Farmers can fix a journal sent back with "Sửa lại", and journals written offline are queued and sent once.
  • A disease prescription creates a draft spraying journal for the farmer.
  • Several roles on one account (apps/web):
  • New roles accountant (kế toán, bàn cân) and platform_admin.
  • One account can hold several roles of its cooperative and switch between them from the menu.
  • The platform admin manages cooperatives, the pesticide catalogue and each cooperative's AI settings and budget. These settings left the cooperative head's screens.
  • Sign-in codes (TOTP) are optional for heads and officers, and an invitation no longer needs an email.
  • Weighing station and daily leaf price (apps/web):
  • The cooperative head publishes today's price per leaf grade on one screen, with yesterday's prices filled in.
  • The accountant writes a ticket per household, parcel and grade, with a rain and impurity deduction. The server computes net kg and amount, and a receipt prints at 80 mm.
  • A parcel inside its withdrawal period cannot be weighed, with no override for anyone.
  • Tickets can be voided with a reason until they are settled. Farmers see today's price and their tickets.
  • Input advances, member ledger and settlement (apps/web):
  • The accountant records inputs (fertiliser, pesticide, other) advanced to a household. The amount is quantity × price, rounded half up to whole dong.
  • The cooperative head closes a settlement period after a confirmation that shows the totals. Each household gets Tiền búp − Nợ vật tư = Thực lĩnh, and a debt left over carries into the next period.
  • Each line prints as an A5 slip with a VietQR code for the transfer, and a payout is recorded once.
  • Farmers see their balance, unsettled tickets and advances, and their slips with the account number masked.
  • The ledger is append-only: corrections are adjustment rows.

Changed#

  • The leaf-purchase and farm-supply mini-apps are hidden from the app store unless DXOS_LABS is on; their work now lives in the core.
  • Lot traces and lot export use the date rules for withdrawal:
  • An open parcel on day D is blocked by every spraying done by D whose safe date is after D, whatever its flush.
  • A lot line harvested on day H counts a spraying of its flush, or one done by H, whose safe date is after H.

Security#

  • Household bank details are visible in full only to the head and the accountant. They are not sent to Telegram, agents or logs, and are left out of the Hasura household columns. A change of payout account records who made it in the audit trail.
  • New core tables (pesticides, memberships, leaf grades and prices, tickets, input items and advances, settlement periods and lines, ledger entries) are covered by the audit hash chain.

[1.18.0] - 2026-11-28#

Added#

  • Farmer pages (apps/web): overview, journal grouped by date, harvest calendar with withdrawal periods and day details, farming handbook linking to real articles, a bulletin page with article pages, account page, disease diagnosis with a care plan after the AI names a disease (the product and dose stay with the officer), and a side menu with counts, an account menu and a folded rail
  • Maps (apps/web): street and labelled satellite layers centred on Tân Cương, clearer partner, parcel and parcel-drawing maps
  • Sign-in and registration (apps/web): new two-panel layout; the name typed on the sign-in page pre-fills Keycloak, which still takes the password
  • Sample content, such as the camera watch, tea prices and handbook counts, is marked "Mẫu" until a data source exists
  • Cooperative head pages follow the new design (apps/web): journal approval gains headline figures (waiting, overdue, approved this month, to be corrected), filters, a detail view and CSV export. Members lists join requests first, with land columns and export; lots show the chosen lot beside the list; the calendar lists unscheduled parcels; farm zones add a parcel table and GeoJSON export; the inbox separates today; the dashboard adds notices, the coming days' weather and approval of chosen journals. Where there is no data yet (weekly yield, partners, apps, notices, parcel positions) the design's example is shown with a "Mẫu" tag.
  • Officer web design (apps/web): the officer pages take the new look (path line, underlined page headers, striped tables, grouped menu), with new Products, Orders, Revenue, Tours and Tour bookings screens. These five show fixed sample content and cannot be edited; they do not read from the shop or tour mini-apps. The headline figures on each officer page can be pressed to filter or order the list below, and the dashboard figures open the list behind them.
  • Weather in the farmer's greeting banner (apps/web): the dashboard banner shows the live temperature, humidity and rainfall over the parcels, rain falls across it when it is raining there, and it replaces the separate weather panel.
  • Reels on the web (apps/web): farmers, officers and managers have a "Reels" page with sample clips: like, save, follow, comment, reply, share, auto-advance, playback speed, and posting a clip from the computer. There is no video service yet, so everything done there stays in the browser and is gone after a reload.
  • Live weather on the bulletin pages (apps/web): managers and farmers see the weather where the cooperative's parcels are, read from Open-Meteo through GET /api/weather/live: temperature, rain chance, humidity, wind, a 24 hour strip and a 10 day forecast. Parcels about 5 km apart share one card, and parcels without coordinates are left out. The card animates rain when the forecast says it is raining, and stays still for people who ask for reduced motion.

Changed#

  • Officer overview (apps/web): compact, tenant-scoped dashboard with live weather, withdrawal conflicts, six-row journal pagination and approval, disease photos, upcoming harvest safety, a tagged schematic, real weekly activity and approval metrics, household journal coverage and tagged shop/tour samples; farmer weather defaults stay unchanged.
  • Officer summaries and cards (apps/web): shared icon summary strips derived from loaded data, hill-decorated headers and reference-style household/lot/disease cards; preserve existing actions and tables, scope journal/document counts to visible results, and leave manager/farmer styling unchanged.
  • Farmer web screens follow the new design, with the handbook showing fixed placeholder content until the feature exists. Farmers' Q&A uses the same full-window chat as staff; the AI is not open to farmers yet and says so.
  • New web interface (apps/web): new colour tokens, a grouped sidebar, a breadcrumb top bar and a bottom bar for farmers on phones; new dashboards for the three roles; page headers, filters, tables and cards restyled across the role pages; a rebuilt login page and cooperative profile page. The profile page now shows the cooperative's own parcel and household figures instead of fixed sample numbers.

Removed#

  • Sample screens and blocks (apps/web): the Reels pages of all three roles; the officer shop and tour pages (Products, Orders, Revenue, Tours, Tour bookings) and the "Trợ lý TT" market assistant, so the officer keeps one chatbot; the farmer camera watch, sample detections, sample tasks, sample pest report, sample bulletin prices and articles, and the farmer chatbot page; the manager sample yield chart, sample apps, sample partners, sample notices and the in-memory certificate manager; the demo /forgot-pin flow, which now sends a signed-out visitor to /login with a line telling the member to ask the cooperative officer to reset the PIN. A bookmark to a removed page shows the normal 404 page. This replaces the earlier "Mẫu"-tagged sample content listed above.
  • Simulated and off-domain market data: the workflows vietnam_market_sync, worldbank_sync, faostat_sync, nasa_power_sync and wto_tariffs and the simulated-price label. comtrade_export_sync keeps only tea (HS 0902). The migration 20261128110000_purge_market_data deletes the rows those workflows wrote and the non-tea Comtrade rows from market_data; it is not reversible and has not been run on any running stack.
  • custom-books 0.3.0: the four templates that duplicate core records (picking, spraying, fertilising, pest). Books already made from them keep working; an open book.create proposal that names a removed template is rejected when approved.

Fixed#

  • Withdrawal period (apps/web, platform/agent): a REJECTED spraying journal no longer counts toward the withdrawal period, so it no longer blocks harvest approval or lot creation. DRAFT and REJECTED are left out; PENDING_APPROVAL, APPROVED and REQUEST_CHANGES still count. One shared rule serves harvest approval, lot creation, the harvest calendar, the farmer dashboard, the campaign candidates, the lot trace and the harvest-ready agent.
  • Public trace page (apps/web): /q/[lot_code] no longer reads ?status= from the URL, so a link cannot show a lot as revoked or valid; the status comes from the lot.
  • Dashboards (apps/web, miniapps/htx-dashboard 0.3.1): market blocks show tea prices only, or an empty state; documents and bulletin pages show an error or empty state instead of sample files and articles.
  • Wording: rice terms are replaced by tea terms ("Trồng mới" instead of "Gieo sạ", "nương chè" instead of "thửa ruộng", the sample address is in Tân Cương). The content test no-rice-copy now also rejects those words. Some mis-encoded Badge labels are repaired.

Changed#

  • Frozen features behind DXOS_LABS (ADR 0005): the mini-app factory, autopilot, strategy agent, MCP and staff sync run only when DXOS_LABS is 1 or true. The default is off. When off, 21 routes answer 404, their pages and tabs are hidden, the Telegram /tuvanhanh command and the app.request chat intent answer "chưa mở" (/dung still stops), and dxos-agent does not schedule those jobs. The code is kept. The compose file passes the variable to web and dxos-agent; .env.example documents it. Mini-apps already built and installed keep running.
  • Food safety and money stay with people: harvest.approve, journal.approve and every app action marked money are now never, so no switch lets autopilot run them. The init script 08-agent.sql drops those kinds from stored unlocked kinds.
  • Search (apps/web): invented suggestions are gone and each result links to the page of the searcher's role.

Security#

  • GET /api/members and GET /api/search answer 403 to farmers; the global search box is hidden for farmers. members/invite and members/[id] stay manager only.
  • Partners belong to a cooperative: the migration 20261128100000_partners_tenant adds partners.htx_profile_id, every read and write is scoped to the caller's cooperative, managers and officers read, only managers write, and a row of another cooperative answers 404. Existing demo partners go to cooperative TC, or to the only cooperative if there is one.
  • Known follow-up: the store screenshots of custom-books (miniapps/custom-books/store/*.png) still show a removed template and must be re-shot with a running stack (see docs/dev-setup.md).

[1.17.0] - 2026-11-27#

The agentic layer is complete. Agents now hand work to staff, plan the season, and can run approved kinds of work on their own inside hard limits, with a stop button and a full audit trail. A manager can ask for a new mini-app in chat and an AI builds it behind seven gates. Everything a role can do on the web can now be done through the Telegram bot: in chat, by voice, or in the Mini App.

Added#

  • Agentic layer milestone M10: staff tasks (platform/agent, apps/web, apps/staff-desktop):
  • 05:50 tasks. Agent A8 proposes up to 10 staff tasks from the work approved in the last 24 hours: picking after an approved harvest, a disease inspection, watering when the soil is dry. It suggests the person with the fewest open tasks and uses no model.
  • Hand-over. An approved task waits as "Đã gửi app nhân sự". The staff app pulls it every minute, creates the task and reports its id back.
  • Head count. The staff app reports who is present today, and the daily campaign uses that number for its people limit.
  • One client per cooperative. ./dxos staff enable <HTX> creates the client and prints what to enter in the staff app. Staff desktop 1.4.0.
  • Agentic layer milestone M6: Telegram Mini App (apps/web, platform/telegram):
  • Mở ứng dụng. The bot's menu button opens the web inside Telegram when the web has an HTTPS address (DXOS_WEB_PUBLIC_URL). Without HTTPS the button is not set and chat works as before.
  • Sign-in. A person signs in with Keycloak inside Telegram once. The web then ties the Telegram account to the session only when initData has a valid signature, is under 24 hours old and names the linked account.
  • Buttons in chat. Sửa on a farmer's journal card opens the form already filled in, and Mở chi tiết opens a high-risk proposal.
  • Agentic layer milestone M12: autonomous mode (apps/web, platform/agent, platform/telegram):
  • Off by default. A manager turns it on in the AI settings after signing in again within 5 minutes and accepting responsibility. The screen shown at that moment is stored in the audit log.
  • Veto window. An eligible proposal is scheduled, then runs after a wait by risk: the next cycle for low, 15 minutes for medium, 2 hours for high. Anyone who could decide it can press Chặn meanwhile.
  • Same checks. The web runs the proposal through the same use case as a human approval, under the name of the person who turned the mode on, with the channel autopilot.
  • Stops. /dung on Telegram or Dừng ngay on the web stops it. It also stops by itself when the enabler loses the manager role, when no manager has interacted for 7 days, or when a brake trips (3 failed runs in an hour, the daily cap, more than 30% blocked, or 3 times the usual number of proposals).
  • Shadow runs. In normal mode every proposal records whether it would have run, and the enable screen shows the 30-day match rate of each kind.
  • Farmers. A message sent by an automatic run says "(Tin do AI của HTX gửi)", and a household gets at most 2 automatic messages a day.
  • Agentic layer milestone M9: mini-app actions (platform/cli, platform/agent, apps/web, miniapps/tea-shop):
  • agent block in app.yaml. A mini-app declares a suggestions path and up to 10 actions. dxos validate checks the block.
  • Suggestions become proposals. The agent asks each enabled app every 30 minutes and files its suggestions as app.<app>.<action> proposals, decided like every other kind.
  • Execution. The web calls the app through the internal gateway with the client dxos-apps-actor and three headers naming the approver. The gateway strips those headers on every other route.
  • tea-shop promotions. The shop suggests a promotion for stock of 20 packs or more unsold for 21 days. promotion.create involves money, so it runs on its own only when unlocked, after a 2-hour window.
  • Agentic layer milestone M11: season plan (platform/agent, apps/web):
  • Quarterly draft. Agent A11 drafts the quarter's plan on its first day at 06:15. Targets follow fixed rules against the same quarter last year; the model only writes priorities.
  • Adoption. A manager adopts it with strategy.adopt. The daily campaign then puts work that serves a target first, and the Monday report compares real figures with last year.
  • Low targets. A plan with a target below last year carries a warning and never runs on its own.
  • Agentic layer milestone M13: mini-app factory (platform/builder, platform/agent, apps/web, platform/cli):
  • Request. A manager asks in chat ("cần app …") or at /manager/ai/apps. Agent A12 picks the cheapest answer: enable an existing app, draft a book in Sổ tự tạo, or ask up to 5 questions and write a spec for the manager to approve.
  • Build. ./dxos builder builds from the approved spec in single-use containers. The build container sees only its workspace, reaches the network through an allowlist proxy and holds no core secret. The gate container has no network.
  • Seven gates. Manifest, markup (no script, no inline style), kit, tests, dependencies, files, and a trial run with screenshots. An app gets at most 3 repair rounds.
  • Install. A passing app is tagged in its own git repository, listed in the store as "App do AI xây" for the requesting cooperative only, and installed after the manager approves miniapp.install. It runs on a private network that reaches only the gateway and the database.
  • Agentic layer milestone M15: voice messages (platform/telegram, apps/web, new service dxos-stt):
  • On the cooperative's server. A voice message of up to 60 seconds is turned into text by whisper.cpp (make up-voice). The audio stays in memory and is dropped once the text exists.
  • Confirm first. The bot answers "Em nghe được: “…”" with Đúng, Sửa and Huỷ. Only Đúng sends the sentence on, as if typed, so a write still needs its confirmation card.
  • Model choice. make stt-measure measures the word error rate of each model on the cooperative's own recordings.
  • The rest of the Telegram chat operations (apps/web, platform/telegram, Keycloak, gateway, #80):
  • Every in-chat row is served. Ten more read tools (search, certificate, soil, photo, households, members, disease reports, profile, documents, partners) and sixteen more actions with a confirmation card. Deletes, announcements, member approval and QR export take two cards. Inviting a member stays in the app, because it makes an account with a password.
  • Disease photo in chat. A farmer picks a parcel and sends a photo. The web calls the disease API with the token of its own client dxos-web-service, on a route that exists only on the internal gateway port. An officer still confirms the result.
  • Nghe. The bulletin has a Nghe button: the web reads it with Piper and the relay sends the audio file ban-tin.wav.
  • Captions and photos. A photo's caption is read as text. The photos of cancelled, replaced or expired cards are deleted.

Changed#

  • ./dxos telegram enable now also creates the client dxos-web-service and writes its secret, next to the Mini App key, into the web's roles.env. ./dxos telegram disable removes them.

Fixed#

  • A farmer with no household (apps/web). GET /api/journal answers an empty list for a farmer whose account has no household, instead of every entry the role can read.
  • Tests on the real clock (apps/web). Proposal fixtures no longer expire on a fixed date, which made the unit tests fail from 2026-11-27.
  • Throwaway test databases (platform/cli). The CLI tests remove their Postgres container with its volume, so a test run no longer leaves a volume behind.

[1.16.0] - 2026-11-26#

The agentic layer starts to plan and learn. Every morning an agent turns the open proposals into one daily campaign that a manager approves with one button. Every Monday another agent looks at how the agents did and proposes improvements, which are measured again weeks later. Outside AI clients can now connect through MCP with a person's own account, the public lot page shows when an AI decision is verified in the audit chain, and a public benchmark compares models on the agents' scenarios.

Added#

  • Agentic layer milestone M7: daily campaign (platform/agent, apps/web):
  • 06:00 campaign. At 06:00 agent A9 groups the cooperative's open proposals into one campaign of at most 15 actions, each with a measurable goal.
    • Fixed rules order the items and drop conflicts: no harvest on a parcel still in its withdrawal period, no spraying before rain, and no more work than the people available.
    • The model only writes the summary.
  • Deciding. Managers receive the campaign on Telegram (Duyệt cả chiến dịch, Xem từng mục, Bỏ chiến dịch, and /chiendich) and in a new "Chiến dịch hôm nay" panel above the AI inbox.
    • Approving the whole campaign runs every item the approver may decide.
    • High-risk items still wait for their own confirmation, and items for another role are forwarded.
  • 18:00 report. The report shows target against actual for each goal.
  • Schedule. The harvest and disease agents now run at 05:30 and 05:40, so their warnings are ready before 06:00.
  • Agentic layer milestone M8: weekly improvements and the AI tab (platform/agent, apps/web, miniapps/htx-dashboard, Hasura):
  • Weekly rules. Every Monday agent A10 looks for:
    • a warning that managers keep rejecting;
    • journal entries returned for missing information;
    • slow decisions;
    • campaign goals that keep slipping.
  • Proposals. It proposes at most five improvements as ordinary proposals:
    • agent.settings.update changes a threshold within fixed ranges, marking whether it tightens or loosens;
    • improvement.adopt covers a process note or a Monday reminder.
  • Measurement. Adopted improvements are measured again after two and four weeks, and the Monday report says whether they helped.
  • AI tab. htx-dashboard 0.3.0 adds an AI tab with each agent's approval rate, waiting time, failures and cost, read with the manager's own rights.
  • Agentic layer milestone M14: MCP, lot verification and the public benchmark (apps/web, platform/mcp, platform/agent, Keycloak, gateway):
  • MCP. A person can connect any MCP client with their own Keycloak account, through the device-login bridge platform/mcp/dxos_mcp.py and the new client dxos-mcp.
    • The client gets the assistant's read tools and one write tool, which creates a proposal that a person still has to approve.
  • Lot verification. The public lot page shows "AI đề xuất, đã duyệt ngày …, kiểm chứng trong sổ audit" only when the decision is in an intact audit chain with a matching evidence hash. It never shows a name.
  • Benchmark. make benchmark runs every agent scenario suite with a chosen model, and the results are published in docs/benchmark.md.

Fixed#

  • Proposal deletes in a campaign (platform/postgres). Deleting a proposal also removes it from campaign items, so cleanup and retention jobs no longer fail on proposals that a campaign listed.

[1.15.0] - 2026-11-26#

The agentic layer goes to work in the field and in the chat. Four new agents watch sensors and weather, disease reports, harvest readiness and the market, and propose warnings, inspections, harvest approvals and a bulletin that a person approves. The Telegram bot becomes an assistant: farmers, officers and managers ask questions, share a location, and record a journal entry with a photo from the chat, with a confirmation card before anything is written.

Added#

  • Agentic layer milestone M4: field, disease, harvest and bulletin agents (platform/agent, apps/web, Hasura): four agents per cooperative propose, and a person approves on the web or in Telegram. field-watch (every 30 minutes) warns officers about a sensor silent for 6 hours and households about dry soil, heat, frost and heavy rain forecast after a recent spraying. disease-watch (daily and on new reports) asks officers to inspect when 3 reports of one disease fall within 2 km in 7 days, and warns the households around them. harvest-ready (each morning) proposes approving the harvest of parcels past their withdrawal period and due for picking. bulletin (each morning) writes a market bulletin for the cooperative with the provider chosen in the settings. Messages to households use fixed templates with typed slots: an agent cannot add text of its own, and only the approver can add a note (spec test 32). A warning that was approved or rejected is not proposed again within 24 hours. Bulletins gain a status and a cooperative, and readers show only published ones. Thresholds are per-cooperative settings, with defaults in docs/rules-and-limits.md §3.10.

  • Agentic layer milestone M5: Telegram chat assistant (apps/web, platform/agent, platform/telegram): a linked farmer, officer or manager now uses the bot as an assistant in a private chat. A button menu by role and typed commands (/menu, /nhatky, /cho, /tomtat, /hoi, /huy) open 11 read tools (today, pending approvals, weather, market, bulletin, notifications, journal, harvest schedule, parcels, lots, and the nearest parcel from a shared location); answers come from the web's own use cases with the asker's scope, so a farmer sees only their household, and each answer names its source. Writes go through a confirmation card that expires after 10 minutes: a farmer records a journal entry with a photo using only Telegram, an officer or manager approves the pending journal backlog, and a harvest approval takes two cards. Nothing is written without Confirm. Free sentences the web's keyword router cannot place go to the new agent A7, which picks a tool or action with the cooperative's provider; the model sees only the sentence and the list of tools, never business data. The relay forwards photos and locations, each user may send 60 messages an hour, and every web route is classified for Telegram in one table checked by a test (spec test 17). Sending a disease photo from chat, the read-aloud button and the remaining chat operations follow in #80.

Fixed#

  • Random sign-outs right after sign-in (apps/web, #75): the session no longer keeps the Keycloak id token, so it fits in one cookie (3593 characters for the CI user, under the 3936 Auth.js chunk size). With two cookies, responses arriving a few milliseconds apart could leave the browser with mismatched halves and the next requests sent the user to the login page. Sign-out ends the Keycloak session with a back-channel logout using the refresh token. Sessions made before this change drop the id token on their next request.

[1.14.0] - 2026-11-25#

The agentic layer arrives. One AI agent per cooperative reviews pending journal entries and proposes; a manager or officer approves on the web or from Telegram, and every step is in the audit chain. A cooperative can switch an agent to Claude or OpenAI within a monthly budget, with personal data masked first. Staff work gains automation and AI-ranked suggestions, and a sensor station simulator joins the repository.

Added#

  • Agentic layer milestone M3: external LLM providers (platform/agent, apps/web, docker): a manager can switch each agent of the cooperative (A1 journal review, A6 digest) from the local Ollama to Claude (Anthropic) or OpenAI on a new settings page (/manager/ai/settings, read only for officers), with a confirmation that lists what leaves the server; only providers whose key the agent container holds are offered, and every change is audited. The agent calls both APIs over plain HTTP from the standard library, masks phone numbers, e-mails and identity numbers before any external call, and falls back to Ollama, then to the rules, on any failure (cut network, 5xx, timeout, refusal, malformed output; a 429 pauses the provider for at least 60 s). Runs report provider, model, tokens and estimated cost; a run that called an external provider writes one agent.external_call audit event without content. A monthly budget per cooperative warns the managers at 80% and stops external calls at 100% until the Vietnam month ends (Telegram message once per threshold and month, banner in the inbox). A6 sends the daily report at the cooperative's report time. The keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, optional DXOS_ANTHROPIC_MODEL, DXOS_OPENAI_MODEL) reach only dxos-agent; a test-only LLM stub (profile llm-test) and platform/tests/smoke-llm.sh cover the path in CI.
  • Agentic layer milestone M2: Telegram (platform/telegram, apps/web, platform/agent, workflows): dxos-telegram relays Telegram updates to the web and sends what the web queues (long polling, no public address needed; idle when no bot token is set). People link their account from their profile page with a one-time code (/start <code>, /stop); a manager can link the cooperative's group for reports. Proposals reach linked approvers with Approve and Reject buttons signed by the web (callback_data HMAC, private chats only, roles re-checked with Keycloak at the moment of the tap); a rejection asks for a reason; every message of a proposal is edited to show who decided. The agent posts daily (18:00) and weekly (Monday 07:00) figures that the web renders and sends; health alerts cover stale agent or relay heartbeats, repeated agent failures and n8n failures, recorded by the new workflows/system-error-alert.json (set as errorWorkflow of every workflow). New: ./dxos telegram enable|disable, realm role telegram, tables in platform/postgres/init/09-telegram.sql, a stub Bot API and platform/tests/smoke-telegram.sh. Set TELEGRAM_BOT_TOKEN, TELEGRAM_BOT_USERNAME and, for a release, DXOS_TELEGRAM_CALLBACK_KEY in docker/.env.local.
  • Tea IoT Station (apps/tea-iot): a WPF sensor station simulator for tea hills that publishes soil moisture, soil and air temperature, air humidity and rainfall to the core broker (htx/<HTX>/plot/<parcel>/<sensor>, QoS 1, store and forward while offline), with drought, heavy rain, frost and faulty-sensor scenarios. Field alerts (dry soil, frost, heat) become task suggestions in Tea Staff Manager. apps/tea-iot/docker/mqtt-port.override.yml publishes the broker on 127.0.0.1 for local development.
  • Tea Staff Manager 1.3.0: Automation page (recurring work, cover for rejected work and approved leave, forgotten check-outs, overdue warnings, draft payroll), an explainable ranking of who fits a task shown with its facts, POST /api/iot/alerts, and Tea Work sign-in with the shared Keycloak account. Tea Work 1.2.0 documents the shared account on its sign-in screen.
  • Agentic layer milestone M1c (platform/agent, APISIX, docker/docker-compose.yml): implemented stdlib-only dxos-agent runtime modules: cross-language canonical JSON + SHA-256 evidence.py, schema-validated LLM provider abstraction with 1-retry JSON repair (ReplayProvider and OllamaProvider with >= 60s HTTP 429 backoff over dedicated APISIX route /api/internal/agent/llm/v1/chat/completions), Keycloak/Hasura/internal-API client, Agent A1 journal-review with deterministic farming hard rules (WITHDRAWAL_PERIOD, MISSING_INFO, DOSAGE, INCONSISTENT), prompt-injection resistance, rule-based fallback on LLM outage, and platform/agent/tests/scenarios/a1_journal_review.json scenario tests.
  • Agentic layer milestone M1b (dxos, Keycloak, Hasura, APISIX, apps/web): added realm role agent and ./dxos agent enable|disable <HTX> to provision/revoke per-cooperative Keycloak client-credentials clients (dxos-agent-<htx> with mode-600 runtime env files), read-only zero-PII Hasura agent permissions across cooperative tables, internal-only APISIX :9081 route /api/internal/agent/* injecting X-Dxos-Gateway after claim validation, RS256 JWKS verification + internal run/proposal ingestion routes in apps/web, Jest unit/route tests, and platform/tests/smoke-agent.sh boundary smoke checks.
  • Agentic layer milestone M1a (apps/web, platform/postgres/init/08-agent.sql): added platform.agent_runs, platform.agent_proposals (with agent_proposals_one_open partial unique index), and platform.agent_settings with row-level audit triggers; typed action catalogue (journal.approve, journal.reject), canonical evidence hashing, proposal creation and single-execution claim/decision use cases with audit trail, HTTP routes (/api/agent/proposals, /api/agent/proposals/[id]/decision, /api/journal/[id]/review), journal_entries.review_note migration, and the ProposalInbox UI at /manager/ai and /officer/ai.
  • Agentic layer milestone M0 skeletons (platform/agent, platform/telegram): stdlib-only heartbeat skeleton containers (dxos-agent, dxos-telegram) added to docker/docker-compose.yml, docker/docker-compose.release.yml, Makefile (make up-agent, stop-extras, platform-up), CI unit test jobs, and release/edge image matrices. They start and report health without running agents or connecting to Telegram yet.
  • Architecture Decision Records: ADR 0003 (agentic layer with human approval and trust-zone separation) and ADR 0004 (optional external LLM providers with local-first fallback).
  • Mini-app hub-mobile (miniapps/hub-mobile): a card in the app store and an open page (/public/<htxCode>) with the download link of the Android APK and the steps to add the web build to an iPhone home screen. Links come from HUB_APK_URL and HUB_WEB_URL; the app stores and reads nothing. The 67 MB APK itself is not in the repository.

Changed#

  • Web package version 1.14.0.
  • Agent credentials (./dxos agent enable|disable, docker/docker-compose.yml): the per-cooperative credentials now live in the dxos-agent-env volume, written by a short-lived root helper that receives them on stdin and stores them as uid 10001, so the agent can read them on Linux. Upgrade note: run ./dxos agent enable <HTX> once for every cooperative that had the agent enabled; the old files under docker/runtime/<project>/agent/ are no longer read. enable now refuses a cooperative that does not exist.
  • Agent evidence version 2 (apps/web, platform/agent): proposals carry every column the rules read (journal entry, its activities and the crop cycles compared), hashed with one canonical JSON shared by TypeScript and Python (platform/agent/tests/fixtures/evidence-vectors.json). Open proposals made with version 1 answer stale on decision.
  • Agent schedule (platform/agent): journal review runs on the first cycle, when the pending entries change, or hourly between 06:00 and 20:00 Vietnam time; an empty queue no longer writes a run row. Out-of-range dosage and a missing withdrawal period now ask for a correction (REQUEST_CHANGES) instead of a rejection. Thresholds are documented in docs/rules-and-limits.md §3.8.
  • Proposal dedupe (apps/web, 08-agent.sql): duplicates are judged by the journal entries a proposal acts on (subject_ids), not by the key the agent sends.
  • Release override: the web and APISIX refuse to start when DXOS_INTERNAL_GATEWAY_SECRET is missing or still the public development value.
  • docs/rules-and-limits.md: amended §1.1 (AI Principle Invariant) and §1.2 (MNM Invariant) per milestone M0 to permit typed catalogue action proposals (with human approval in normal mode, or manager-enabled bounded autonomous mode) and optional per-cooperative external LLM providers while keeping local Ollama as the zero-key default.

Fixed#

  • Telegram messages for proposals, reports and alerts (PrismaTelegramRepository): the link and outbox column lists were plain strings inside $queryRaw templates, so Prisma sent them as a bound value; recipients came back without a chat id and queuing a message failed. They are SQL fragments now, checked by a unit test and against a real Postgres.
  • Mosquitto restart loop: on kernels with fs.protected_regular (including WSL 2) a restarted broker container failed with "can't create /tmp/mosquitto.passwd: Permission denied"; the entrypoint now removes the old password file first.
  • The PostgreSQL scripts of the staff app (apps/staff-desktop/database/postgres) were hidden by the root *.sql ignore rule.
  • Withdrawal checks fail closed (approve-harvest, CreateLotUseCase, lot trace, farmer dashboard): spraying recorded in a rejected, returned or pending journal entry still blocks harvest approval, lot creation and QR export; only drafts are ignored. Without this, rejecting a journal through the new review flow would have hidden a real spray from the withdrawal period.
  • Agent A1 withdrawal rule: compares Vietnam calendar days (a harvest on the spraying day is a violation, a harvest on the safe day is allowed) instead of UTC timestamps; the invented 7-day minimum is removed; Vietnamese numbers such as "1.200 ml" and "0,5 kg" are read correctly.
  • Agent tokens limited to their routes (APISIX): tokens of the agent role are refused on the workflow, disease and chat LLM routes; the internal agent route is rate-limited per token.
  • Proposal creation checks: evidence values must match their hashes, referenced rows must belong to the caller's cooperative, at most 50 rows, known agent names only, bounded body size.
  • Journal review races: review and batch approval change only entries that are still pending and record the reviewer; a returned or rejected entry can be edited and goes back to pending.
  • Agent containers: dxos-agent and dxos-telegram run read-only, without capabilities, with process and CPU limits; 08-agent.sql is mounted for fresh databases.
  • Agent resilience: provider failures of any kind fall back to rule-only reasons, HTTP 429 no longer blocks the agent loop, and one malformed credentials file or journal entry no longer stops the others.

  • Journal reject/request-changes flow (officer-journal-approval.tsx, POST /api/journal/[id]/review): officer "Từ chối" / "Yêu cầu sửa" actions previously posted ignored isApproved / rejectionReason fields to /api/journal/batch-approve and approved the entry; they now invoke the dedicated review endpoint, record review_note, and keep rejected entries out of APPROVED.

Upgrade notes#

  • Set DXOS_INTERNAL_GATEWAY_SECRET and DXOS_TELEGRAM_CALLBACK_KEY in docker/.env.local to long random values. With the release override the web does not start while either is missing or still the development value, and APISIX does not start without the first.
  • make platform-up, then make web-up: the first creates the agent and Telegram tables (08-agent.sql, 09-telegram.sql), applies the database migrations and starts dxos-agent and dxos-telegram; the second rebuilds the web app at 1.14.0. No data migration.
  • AI layer: ./dxos agent enable <HTX> for each cooperative that should get it; the running agent picks it up on its next cycle, and the command creates the realm role agent when it is missing (on a smaller stack, make up-agent starts the agent). A cooperative enabled from main before this release runs enable once more: the credentials moved to the dxos-agent-env volume.
  • Telegram (optional): set TELEGRAM_BOT_TOKEN and TELEGRAM_BOT_USERNAME from BotFather, run ./dxos telegram enable, then link a phone from the profile page.
  • External LLM providers (optional): set ANTHROPIC_API_KEY (and DXOS_ANTHROPIC_MODEL to change the default claude-haiku-5-5) or OPENAI_API_KEY with DXOS_OPENAI_MODEL, restart dxos-agent, then choose the provider for an agent on /manager/ai/settings. Without a key everything runs on Ollama as before.
  • n8n: import the workflows again (n8n import:workflow, see docs/dev-setup.md); every workflow now names workflows/system-error-alert.json as its error workflow, so failures reach managers.
  • Withdrawal checks now count every journal entry that is not a draft: a harvest or a lot that passed before because the spraying entry was rejected, returned or pending is blocked until the withdrawal period ends. Open AI proposals made before the upgrade answer stale when decided.
  • Tea Staff Manager's shared sign-in needs a Keycloak client created by hand: see apps/staff-desktop/docs/core-integration.md.

Known limits#

  • The withdrawal checks read at most 100 journal entries of a parcel (issue #67).
  • A farmer cannot yet edit a returned journal entry from the web form (issue #68).
  • Telegram delivery is at least once: a message can arrive twice if the relay stops between Telegram's answer and reporting it.
  • With an external provider, names a farmer writes inside a note are not masked; the confirmation on the settings page says so. Costs are estimated from a small price table in code; a model not in the table counts as 0.
  • The browser checks of app-kit.spec.ts can fail on a frame that is still navigating (issue #44); a failed Platform Smoke Test job on that spec is re-run.

1.13.0 - 2026-11-22#

A cooperative manager gets a chart dashboard over the core's data and sensor readings, and three client apps join the repository: the multi-role Flutter app hub-mobile and the staff management pair staff-desktop and staff-mobile.

Added#

  • Project site (site/, published with GitHub Pages by .github/workflows/pages.yml): a static, dependency-free landing page in Vietnamese (/) and English (/en/) with real screenshots from the mini-apps and staff apps, a three-tier diagram, light and dark themes, and the known limits from this changelog. scripts/build-site.sh assembles the publishable folder with the screenshots taken from their repository paths. Self-hosted Be Vietnam Pro (OFL-1.1) is listed in DEPENDENCIES.md.

  • App hub-mobile (apps/hub-mobile): one Flutter (Dart) app for Android, iOS and the web demo with roles chosen from the token claims after sign-in: guest, customer, farmer, HTX manager (officer read-only) and tour guide (guide, a staff account of an HTX). Tours belong to the HTX: the manager creates and edits tours (with a briefing for the guides), adds or removes guides, reads the member list of each tour and checks groups in; a guide sees only the tours an HTX assigned, with the HTX that assigned it, the schedule (Lộ trình), the itinerary, the groups with phone numbers and a check-in; a customer's ticket shows the guides of the tour. Guest browses news, tours and products; customer books tours, buys products, pays by VietQR, and keeps orders and tickets on the device (open offline). Leaf diagnosis sends a photo (gallery or live camera) to the web classifier with the app token. AI assistant pages per role (market, technical, shop, tour topics) with a local keyword answerer for guests and the web POST /api/chatbot stream for signed-in users. Reels: short videos with a For-you and Following feed, hearts, comments, share and follow, posted from the phone gallery (own videos on a page opened from the + button of Reels). Runs on a mock HubRepository and a demo AuthService or, with an issuer configured, on Keycloak OIDC PKCE (client dxos-mobile) and the web API through HttpHubRepository; storefront, tours and Reels still use sample data. No Google Play services, Firebase, Maps or analytics. Build: apps/hub-mobile/tool/build.sh. Not yet built as a release APK or run on iOS, and the VietQR code has not been scanned by a real banking app. See apps/hub-mobile/README.md.

  • Staff management clients (apps/staff-desktop, apps/staff-mobile): Tea Staff Manager, a C# .NET 10 WPF app (MVVM) where the HTX owner manages employee records, teams, task assignment, a monthly timesheet, leave approval and payroll (prorated monthly salary or daily wage, overtime, allowance, bonus, compulsory insurance, advances; Draft, Approved, Paid), and Tea Work, a Kotlin Jetpack Compose app (MVVM) where staff accept and report tasks, check in and out, request leave and read payslips. The desktop app serves the phones over a small REST API (docs/mobile-api.md), stores data in SQLite or in the core schema app_staff_work (every table has htx_code), and signs in with a local owner account or the shared Keycloak account (realm agrimarket, role manager). Both follow DESIGN.md. Tests: xUnit for payroll and the task state machine, a Robolectric walkthrough of every mobile screen and an API contract test between the two apps.

  • Staff apps 1.1 (apps/staff-desktop, apps/staff-mobile): leave requests carry evidence (photo or PDF, checked by content, required for sick leave of two days or more); a Reports page with KPI tiles and charts and a Kanban board for tasks; toasts, sound and red counters on the desktop when staff act on their phones; phone connection self-test, one-click firewall rule and a DX-OS core connection check in Settings; quiet 30-second refresh and an offline-demo banner on the phone.

  • Keycloak client dxos-mobile: a public PKCE client (S256; no password grant, no service account) for mobile apps, with the same scopes and roles as nextjs-web and the redirect URIs of the Android tour app and of the Flutter hub-mobile app (docker/keycloak/realm-agrimarket.json). make mobile-client adds it to a running realm and does nothing if it exists. Covered by platform/tests/test_realm_policy.py.

  • View telemetry.sensor_daily (platform/postgres/init/07-telemetry-views.sql): read-only daily summary of telemetry.sensor_readings per (htx_code, parcel_code, sensor, Vietnam day) with reading_count, min_value, max_value, avg_value, first_ts, last_ts. Tracked in Hasura as telemetry_sensor_daily with the same htx_code filter as the raw table for manager and officer; farmer has no access. Covered by platform/tests/smoke-dataops.sh.

  • Mini-app htx-dashboard ("Bảng điều hành HTX", 0.1.0): a read-only overall view of a cooperative for its manager, with no database of its own. Tổng quan lists what needs attention (journals waiting more than 3 days, disease reports waiting, sensors silent for 6 hours, harvests due or overdue, failed transfers to the cold store) over a strip of figures, a grid of parcels, journals per week, lots and the newest tea prices; the tabs Sản xuất, Vùng trồng, Sức khoẻ cây, Lô chè and Dữ liệu have a CSV file and a print page; each parcel has a page with the newest reading and the daily chart of each sensor, the crop round, weather, journal, disease reports and lots. Every figure is read from the core through Hasura with the viewer's own token, so a manager sees only their cooperative. Lists ask for at most 5,000 rows and say when cut; sensor charts cover at most 30 days. Requires core 1.13.0. Covered by the app's pytest suite, a block of make apps-smoke (every tab against the real core, the figures of seeded readings, the gateway's refusal of other roles, the view's permissions asked from Hasura), a browser story and the screens at 1280 and 390 px in light and dark.

Changed#

  • make platform-smoke gives 131 PASS (was 124): five checks for the daily view and two for the officer role. The daily-view readings are dated yesterday and today instead of March 2026, so the lifecycle job cannot archive them between the insert and the query.
  • Web package version 1.13.0.
  • htx-dashboard 0.2.0, a chart dashboard: the app draws its figures as charts instead of tiles, with a server-side SVG toolkit of its own (line and area, stacked and grouped columns, donut, sparkline, gauge, ring, calendar and matrix heatmaps, funnel, timeline, scatter) and one palette for both themes. The overview has a KPI strip with the change against the previous period, cooperative-wide sensor charts, a sensor freshness matrix and a harvest timeline; every other tab gains charts of its own. A rejected disease report is no longer listed as a kind of disease. Still no JavaScript and no new dependency. Upgrade an installed copy with ./dxos upgrade miniapps/htx-dashboard; a preview with sample data runs with python tests/preview.py in the app's folder.

Upgrade notes#

  • make platform-up, then make web-up: the first creates the view telemetry.sensor_daily and restarts Hasura so it loads the new metadata; the second rebuilds the web app at 1.13.0. No data migration.
  • ./dxos install miniapps/htx-dashboard (or install "Bảng điều hành HTX" from the App Store with a worker running). A copy of 0.1.0 installed from main before this release is replaced with ./dxos upgrade miniapps/htx-dashboard.
  • A realm that already exists gets the mobile client with make mobile-client; a new realm has it from the realm file.
  • apps/hub-mobile, apps/staff-desktop and apps/staff-mobile are built from source with their own toolchains (Flutter, .NET, Gradle); see the README of each. The release workflow does not publish them as images.

Known limits#

  • htx-dashboard shows the core's data only: figures of other mini-apps and of the staff apps are not included. Its charts are drawn on the server, so they do not update while the page is open. Sensor charts cover at most the 30 days the hot store keeps. Rainfall is shown as the average of a day's readings.
  • The staff apps keep their data in a schema of their own and are not installed through ./dxos.
  • What hub-mobile reads from a real server and what it still shows from sample data is listed in apps/hub-mobile/README.md.
  • The browser checks of app-kit.spec.ts can fail on a frame that is still navigating (issue #44); a failed Platform Smoke Test job on that spec is re-run.

1.12.0 - 2026-11-14#

The v1.11.0 tag has no GitHub Release, images or bundle: its release run failed twice on a race in a browser test (the test typed into a frame that was still navigating), fixed here. v1.12.0 contains everything in 1.11.0.

Added#

  • Manifest feed (platform/apps/manifest.schema.json, dxos validate): an app may name a protected path that returns, for the calling user, a JSON list of sub-apps (entries and an optional create link). The web menu shows them after the app's own items in each role's sidebar, and the App Store shows a section "Ứng dụng do HTX tự tạo". The web validates the feed (30 entries, label 60, path ^/[a-z0-9_-]+(/[a-z0-9_-]+)*$, icon allowlist, 64 KB, 1.5 s, cached 15 s) and a broken feed leaves the menu intact. GET /api/app-store gains created. The icon map moved to lib/apps/app-icons.tsx. See docs/miniapps.md.

  • Mini-app custom-books ("Sổ tự tạo", 0.1.0): the HTX manager designs record-keeping books without code. Eight templates (picking attendance, spraying, fertilising, cashbook, meeting minutes, supply hand-over, pest tracking, visitors) and a blank book; a form-based designer (name, description, menu icon, fields of eight types, which fields show in the list or are summed, access of officers and farmers: none, view, own rows, all rows; optional approval of each row); preview, publish, archive and publish again. Each published book appears in the menu of the roles allowed to use it and in the App Store section "Ứng dụng do HTX tự tạo", with a form, a filtered list with search and paging, a summary with totals and charts, a CSV download and a print page. With approval on, a row waits for the manager, who approves or rejects it on a page with a reason; the author corrects a rejected row, an approved row is locked, and the summary counts approved rows only. A user at level "own" never reads another user's row (list, edit, CSV, print, summary). Requires core 1.12.0.

  • Smaller dev stack: make up-core (postgres, keycloak, hasura, apisix, web) and one target per optional group (up-docs, up-sensors, up-ai, up-voice, up-workflow, up-chat) start only their own containers; make stop-extras stops (never removes) every optional container. make up and make platform-up are unchanged. See the README.
  • Designer table (dxos-app.css): a form-table modifier gives the input columns of a table of inputs a share of its width, the name column the largest (about 230 px at 1280 px), and the table stays inside its card with any system font.
  • Tests: the app smoke installs custom-books, drives a book from the picking template through publish, feed per role, rows at level own, rejection, approval, CSV, print, archive and purge; a browser story installs it from the App Store, designs and publishes a book, checks that the officer and farmer menus gain the entry on their own, a farmer row at 390 px, approval, summary, CSV, print and archive, and that the shell still renders when the app is stopped; screens for the books list, template chooser, designer, list, summary, print and farmer list at 1280 and 390 px, light and dark.

Changed#

  • Keycloak heap cap in the dev stack (docker/docker-compose.yml): JAVA_OPTS_KC_HEAP defaults to -Xms64m -Xmx512m (override with KEYCLOAK_HEAP_OPTS); Keycloak used about 1.1 GiB before and about 360 MiB after for the same activity.
  • The sidebar lights only the most specific menu item, so a feed entry no longer lights its app's own item as well.

Upgrade notes#

  • The Keycloak cap applies when the keycloak container is next recreated (make up-core or make platform-up after pulling); recreating it also restarts web.
  • Run make platform-up and make web-up (new menu feed, store section and designer CSS), then ./dxos install miniapps/custom-books or install "Sổ tự tạo" from the App Store (a worker must be running). No migration of existing apps; keep every docker_* volume.
  • ./dxos validate now accepts the feed key; an app that declares it should require core >=1.12.0.

Known limits#

  • No photo or file fields (mini-apps have no object storage access).
  • No formulas or calculated fields: the summary only totals number and money fields.
  • Approval is one step, by the manager.
  • The designer is a form, not a drag-and-drop canvas; a field's type cannot change once the book has rows, and a choice field that has rows cannot lose options.
  • A book's menu entry shows on the next page load, up to 15 seconds after publishing (the feed is cached 15 s per app, HTX and role, 5 s after a failure).
  • The menu entry cap is 30 books per role; an HTX has at most 50 books; CSV and print hold at most 5000 rows.
  • A second household field in one book shows "Nông hộ khác" for households a farmer may not see; only the first household field's name is stored.

1.11.0 - 2026-11-13#

Added#

  • Shared mini-app kit (platform/appkit/): CSS components in dxos-app.css (header, tabs, stats, SVG bar chart, toolbar, pagination, cards, steps, empty state, field errors, disclosure, row actions, print sheet), Jinja macros (kit.html), Python helpers (appkit.py: paging, safe date and integer parameters, ILIKE escaping, Vietnamese money, number and date formats, CSV with BOM and formula escaping, chart widths) and a showcase page. make appkit-sync copies the two files into the four apps; make lint fails when a copy differs.
  • Mini-apps can offer downloads: the app frame sandbox gains allow-downloads and the proxy keeps a content-disposition header when it starts with attachment. Scripts stay blocked and the CSP is unchanged.
  • ./dxos upgrade <dir> gives an installed mini-app new code in place: it validates the manifest, applies only pending migrations (same role and password), rewrites the route and compose file, rebuilds and restarts the container, then stores the new name, version, menu and manifest. Enablements are never touched; a failed build or health check leaves the registry on the old version. The App Store card and detail show Có bản mới when the running version differs from the catalogue.

  • The four business apps rebuilt on the kit (version 0.2.0): leaf-purchase (overview, ticket list with filters and search, print of a weighing slip and a payout sheet, CSV of tickets and payouts, month filter for farmers, inline field errors), tea-shop (overview with revenue chart and best sellers, order and product lists, delivery note, order CSV, tracking steps), farm-supply (overview, round list, item and household CSV, delivery sheet with a signature column, inline item errors, round cards for farmers) and tea-tour (overview, tour and booking lists, guest CSV, group list with check-in boxes, public cards). Status pills carry tones (amber waiting, red cancelled, grey closed). Existing paths, form fields, status codes and redirects are unchanged.

  • Tests: the app smoke checks a list, a CSV download (text/csv, attachment, BOM) and a print page for each app, wildcard and out-of-range page values, role refusals on exports, and ./dxos upgrade (installed app: exit 0, version, same enablement rows, still answering; not installed: refused). A new browser story (app-kit.spec.ts) writes sample data through each app and checks tabs, a second page, CSV download inside the frame, the print page in the top window and the way back, inline errors and the stored theme; screens cover the overview, one list and one print page of every app at 1280 and 390 px, light and dark. The five store screenshots are recaptured from the new pages (the tea-shop picture is now manager-orders.png).

Upgrade notes#

  • Run make platform-up and make web-up (rebuilds the web image: new dxos-app.css, allow-downloads on the app frame, "Có bản mới" in the store), then ./dxos upgrade miniapps/<id> for each installed app (leaf-purchase, tea-shop, farm-supply, tea-tour). Enablements are kept; until you upgrade, an installed app keeps its 0.1.0 code and pages. The new leaf-purchase route /overview reaches an installed app only after its upgrade. Restart ./dxos worker if one runs.
  • No database migration; keep every docker_* volume.

Known limits#

  • Search in the apps is accent-sensitive (Nguyen does not find Nguyễn): the app roles cannot create the unaccent extension.
  • No notifications: nothing tells a manager that a new order or booking arrived; the overview shows the count when opened.
  • Printing goes through the browser's own print command (Ctrl+P); the pages only prepare the sheet. No script may call print().
  • CSV files hold every row of the current filter, with no row cap.
  • farm-supply prints inside a section rather than on the body, so its print page keeps the page background in dark mode.

Fixed#

  • Flaky crash-recovery check in make apps-smoke: the check of the leftover container and gateway route now waits (up to 60 s) for the worker to undo the half install, which it does after marking the request FAILED.

1.10.1 - 2026-11-13#

Added#

  • make web-up and make gateway-up: web-up rebuilds or starts web and disease-api on the generated route file (it replaces the hand-typed docker compose up for web, in the README, docs/miniapps.md and CI); gateway-up puts the gateway back on that file after a hand-typed compose command recreated it on the base one.

Fixed#

  • ./dxos install and ./dxos worker refuse to run while the gateway reads the base route file: after a hand-typed docker compose up without DXOS_GATEWAY_FILE recreated apisix, every mini-app route answered 404 and an install still ended "Đã cài". They now stop with a message naming make gateway-up; the check never blocks when docker cannot be asked.

1.10.0 - 2026-11-13#

Added#

  • App Store detail page (/manager/app-store/<id>, web version 1.10.0): header with the Cài, Gỡ, Thử lại and Mở ứng dụng buttons, a step progress while an install runs (Đã gửi yêu cầu, Chuẩn bị, Dựng và khởi động, Đăng ký), a strip of screenshots that open at full size, the "Giới thiệu" text, a preview "Khi cài, ứng dụng sẽ" of what the install does for the HTX ("Ứng dụng đã thêm vào HTX" once the HTX uses the app), the data and personal data the app declares, version information, the full address of the app's public page with a "Chép địa chỉ" button, and the history of the app.
  • Richer store page: accent-insensitive search, filters by status and category, cards that link to the detail page, and a "Lịch sử" tab with the 50 newest install and removal requests of the HTX and the name of who asked. The history only holds requests of the caller's HTX.
  • Optional store block in the mini-app manifest (category, icon from an allowlist, about, data, personal data, core reads, up to 4 screenshots of at most 400 KB, PNG, WebP or JPEG detected from the first bytes). Text from a manifest is shown as plain text only. ./dxos validate also checks the screenshot files (inside the app directory, size, type); catalog-sync stores the block (platform.app_catalog.store, requires_core, has_database) and the screenshots (platform.app_catalog_screenshots) in the platform database.
  • Install phases: while the worker installs an app it sets platform.app_requests.phase to prepare, build and register through the new ./dxos worker-progress, so the page can show the step; a failed install keeps the phase that failed. A hand ./dxos install never writes a request or a phase.
  • Store text and screenshots for the five apps: leaf-purchase, tea-shop, farm-supply (two screenshots each), tea-tour (one) and hello carry a store block in Vietnamese; the screenshots come from the real apps with sample data and are retaken with apps/web/tests/e2e/tools/store-screenshots.spec.ts (E2E_STORE_SHOTS=1).
  • Tests: the app smoke checks the synced store block, the phases seen during a queued install, the build phase of a failed install, that a hand install writes no request, and that validate refuses a text file declared as a screenshot; the App Store story now searches, opens the detail page, installs from it, opens the app and finds the history row; the screens add the history tab and the detail page at 1280 and 390 px, light and dark.

Upgrade notes#

  • make platform-up applies the new columns and tables without recreating postgres (06-app-store.sql is extended in place and stays idempotent). Keep every docker_* volume.
  • Rebuild the web image (make web-up from v1.10.1; before that the full command of the v1.8.0 note, with DXOS_GATEWAY_FILE) and restart ./dxos worker, otherwise the page works but no install phase is reported.
  • Apps that carry a store block declare requires.core: ">=1.10.0"; app versions are unchanged.

Known limits#

  • The declared data is not enforced: what an app says it stores or reads is the publisher's statement, shown as such; nothing checks it against the app's real behaviour.
  • There is no update flow: an installed app is not upgraded from the store, and its version does not change for a metadata-only edit.
  • The install steps show only what the worker reports (three phases); building and starting the container are one step.

1.9.0 - 2026-11-13#

Added#

  • Optional description in the mini-app manifest (1-200 characters), shown by the upcoming app store; hello and tea-tour now declare one. docs/miniapps.md documents it and the rule that public pages live under /public/<htxCode>/... (from v1.9.0 the web proxy serves a public page only when that HTX has enabled the app). Web package version is now 1.9.0
  • App Store: install mini-apps per cooperative (the manifest description above feeds it). A manager opens "Kho ứng dụng" (/manager/app-store) and installs or removes an app for their own HTX; the card shows Chưa cài, Đang cài…, Đã cài, Đang gỡ…, Lỗi (with Thử lại) or "Đã cài cho mọi HTX (quản trị máy chủ)", and polls every 3 s only while something is in progress, then refreshes the sidebar menu of the manager who pressed the button (other signed-in users of the HTX see the change at their next page load). A mini-app is now served, and listed in the menu, only to the HTXs that enabled it: the proxy answers 404 to any other HTX on protected and public paths, and a public page names its HTX in /public/<htxCode>/.... New tables in schema platform (platform/postgres/init/06-app-store.sql, applied by platform-init): app_catalog (synced from miniapps/*/app.yaml by make platform-up and by the worker; an installed app keeps its card when its directory is gone), app_enablements (* means every HTX), app_requests (one open request per app and HTX, enforced by a unique index) and app_worker (heartbeat); requests and enablements are audited. ./dxos worker is the host process that claims requests one at a time (ENABLE installs the app when needed, DISABLE removes the container once no HTX is left, and keeps the data), takes a lock in docker/runtime/<project>/worker.lock, fails requests a crashed worker left running (undoing the half install) and logs one line per job; without it the page warns that requests wait for the administrator. ./dxos install <dir> is unchanged and enables the app for *. New API: GET /api/app-store, POST /api/app-store/requests (docs/api-contract.md)
  • Mini-app leaf-purchase (Thu mua búp tươi): officers and managers write fresh-leaf weighing tickets (household, date, grade, kg with one decimal, price copied from the grade when written; money is integer VND shown as 9.000 ₫) and can edit or void a ticket until its period closes; managers set the price per grade (/prices), close a payment period over a date range (/periods: every non-voided ticket in the range joins it and gets one payout per household) and mark each payout paid; a farmer sees their own tickets and payouts at /mine. The household lists come from Hasura with the caller's own token and role, so a farmer sees only their household. Periods of one HTX never overlap (checked in a transaction under an advisory lock, since the app role cannot create btree_gist), and a ticket cannot be written or moved into a closed period's dates. Menu: "Thu mua búp tươi" (officer, manager), "Kỳ thanh toán" (manager), "Phiếu cân của tôi" (farmer). Schema app_leaf_purchase
  • Mini-app tea-shop (Cửa hàng chè): managers list products (name, pack, price, stock, optional trace lot code) and process orders (Mới → Đã xác nhận → Đang giao → Hoàn tất, or cancel, which gives the stock back); guests order without an account at /apps/tea-shop/public/<htxCode> (cash on delivery), get an 8-character order code and look the order up with code and phone together. Stock is locked per order in a fixed product order, so concurrent orders never oversell and never deadlock; an order keeps the product name and price it was placed with; a manager's stock edit is an adjustment (+/-), never an overwrite. Personal data (name, phone, address, note) is shown only to the HTX's manager and never on a public page. Menu: "Cửa hàng chè" (manager). Schema app_tea_shop
  • Mini-app farm-supply (Vật tư mua chung): managers open a group-buying round with a deadline and add items (name, unit, price) while it is open; each farmer registers quantities for their own household (the household comes from Hasura with the farmer's token, never from the form) until the round closes; closing creates one settlement per registered household, and the manager marks each delivered and paid and sees totals per item and per household. Menu: "Vật tư mua chung" (manager), "Đăng ký vật tư" (farmer). Schema app_farm_supply
  • Tests for the store and the three apps: make apps-smoke now also installs, calls through the gateway (200 with the right role, 404 on the published port, the gateway's refusal for a wrong role, including /tickets/* and /periods/* of leaf-purchase), reads the real Hasura household lists as officer, manager and farmer, makes one write per app (a ticket, a closed period and a payout, a public order, a registration) and purges each app; through the queue it enables tea-shop for TC, checks that the web proxy answers 404 for LB when the web container runs, disables it, enables it again and checks that the product created before is still there. It refuses to start when one of the five apps is installed, and starts its own ./dxos worker. Browser: tests/e2e/story/app-store.spec.ts (TC installs the shop from the page and sees Đang cài… then Đã cài; LB does not see it and gets 404; a guest orders on a 390 px phone; the manager advances the order, presses Gỡ, installs again and finds the order) and business-apps.spec.ts (the leaf-purchase and farm-supply stories); screens.spec.ts adds the store page and one screen per app and role at 1280 and 390 px, light and dark. CI runs the pytest suites of the three apps next to tea-tour's and, in platform-smoke, a ./dxos worker for the store stories

Upgrade notes#

  • First make platform-up recreates postgres once: it mounts the new platform/postgres/init/06-app-store.sql. The data in docker_pgdata is kept, and platform-init creates the store tables on the existing database. Never delete the docker_* volumes
  • Apps installed before the upgrade stay enabled for every HTX: the platform-init run that creates platform.app_enablements enables each already-installed app for * once (enabled_by = 'dxos-upgrade'), so nothing disappears from the menu. Later runs never do it again: an installed app with no enablement is a valid state (every HTX turned it off) and is not handed back to everyone
  • Start ./dxos worker: the store only queues a request until a worker runs. Start it from the repo root (README, "Kho ứng dụng và ./dxos worker", has a systemd unit); until it runs, the page warns "Trình cài đặt chưa chạy". ./dxos install and ./dxos remove work without it
  • The web image must be rebuilt (make web-up from v1.10.1; before that the full command of the v1.8.0 note, with DXOS_GATEWAY_FILE): the proxy, the menu and the store page read platform.app_enablements; the package version is now 1.9.0, which the new manifests require
  • Demo: build the images of the three new apps ahead (install each once, then ./dxos remove <id> --purge) and start the worker before the demo; the first Cài otherwise builds an image, which takes minutes

Known limits#

  • Apps still trust each other (ruling R24, unchanged): enabling an app per HTX only decides who sees it; every installed app shares dxos-apps-net and decodes the token without verifying it, so another installed app can read or change the data of leaf-purchase, tea-shop and farm-supply. Install only apps of this repository. Real per-app isolation is deferred
  • The worker is a host process, not a container (the web app must never hold the Docker socket): it must be started and kept alive by the operator, and one worker serves one compose project
  • The farm-supply item form shows a rejected item (empty name, bad price) as a plain error page (heading and one message, no form and no link back; the browser's Back button returns to the round) instead of an inline error; nothing is stored
  • The gateway can answer 503 for up to about 30 seconds after a core service restarts (for example Hasura): its DNS client caches the "name not found" answer it got while the service was down, and apisix.dns_resolver_valid only shortens the cache of valid answers. Unchanged from earlier releases

1.8.1 - 2026-11-12#

The v1.8.0 tag has no GitHub Release, images or bundle: the release workflow's smoke gate failed on the flaky restart fixed below. v1.8.1 is the same product with that fix and is the first published build of the mini-app platform.

Fixed#

  • make platform-up no longer recreates containers whose build inputs did not change: BuildKit attached a provenance attestation with a new digest to every build, so rebuilding an unchanged image (up --build, run --build migrate, the web step) produced a new image ID and Compose recreated agrimarket-postgres (and its dependents) under a running Keycloak. Keycloak then answered 500 on its next admin call, which failed make apps-smoke on main and in the release gate (FAIL: keycloak admin PUT .../default-client-scopes/..., Error 22). The Makefile, ./dxos and the CI platform-smoke job now set BUILDX_NO_DEFAULT_ATTESTATIONS=1, so the same inputs give the same image ID. First-start behaviour is unchanged
  • make apps-smoke waits for Keycloak after make platform-up: it now asserts that the postgres container is the same one as before, then waits (bounded, 120 s for the admin API, 60 s for the user token) before using Keycloak, so a legitimate restart no longer fails the run. New helper kc_ready in platform/tests/tokens.sh; no assertion was removed

1.8.0 - 2026-11-12#

Added#

  • Mini-app manifest and dxos validate: a mini-app is described by app.yaml (apiVersion: dxos/v1), published as the JSON Schema platform/apps/manifest.schema.json with additionalProperties: false everywhere. ./dxos validate <dir>... refuses a manifest with a schema error, an id already installed, a licence outside the CLI's OSI list, a requires.core the core (version in apps/web/package.json) does not satisfy, an image not pinned by @sha256: digest, a route or menu path with .., // or characters outside [a-z0-9/_-], a role other than farmer, officer and manager, a prefix listed as both public and protected, or a protected prefix nested under a public one (the web proxy would never send it a token). The developer guide is docs/miniapps.md; the decision is recorded in docs/adr/0002-miniapp-architecture.md
  • ./dxos install, remove and list: ./dxos at the repo root runs the dxos-cli container (profile tools, no host port, no docker socket) for the manifest, database, gateway, install journal and registry work, and starts or stops the app container itself with docker compose. Install validates the manifest, prepares the database (when declared), writes the app's APISIX routes under /apps/<id>/ and the app's compose file, starts the container with up -d --build --wait, then records the app in platform.installed_apps (id, name, version, menu, manifest, install time; created by platform-init from platform/postgres/init/05-apps.sql). A failure at any step, a failing health check, Ctrl-C or TERM undoes the earlier steps in reverse order from the journal docker/runtime/<project>/apps/<id>.pending.json; installing an installed app only makes sure its container runs. remove <id> stops the container, removes the routes and the registry row and keeps the data; --purge also drops it. list prints id, version, install time and container state. Protected routes use openid-connect bearer_only with a claim_schema check on realm_access.roles; a token without one of the manifest's roles gets 401 from the gateway. The routes are merged with the tracked platform/gateway/apisix.yaml into docker/runtime/<project>/gateway/apisix.yaml, which APISIX reloads in place within about a second; with no app installed that file is identical to the base, and the tracked file is never modified. make platform-up and make up run gateway-sync first, so installed apps keep their routes and containers across a restart. App routes match only on the gateway's internal listener 9081 (vars: [["server_port", "==", "9081"]]), so the published 9080 answers 404 under /apps/ and every outside request goes through the web proxy; gateway-sync refuses an app route without that condition
  • Hardened app containers: the generated compose file runs service app-<id> as user 10001:10001 with a read-only root filesystem and a /tmp tmpfs, cap_drop: [ALL], no-new-privileges, 256 MB of memory and 0.5 CPU, no host port, and only on the new network dxos-apps-net. That network is internal: true (no egress) and holds only apisix and postgres besides the apps. Every installed app shares it, so apps can reach each other (see Known limits). The manifest cannot change any of this
  • App database: for a manifest with database.migrations, install creates the login role and schema app_<id> (- becomes _): no superuser, database, role, replication or RLS-bypass right, CONNECTION LIMIT 10, a random password sent to the server only as a SCRAM verifier, and rights on its own schema only. Migrations (*.sql, in file-name order, one transaction per file) run on a connection logged in as the app role with search_path set to its schema, never on the superuser connection, and are recorded in app_<id>.schema_migrations. Every app table must have htx_code text NOT NULL, checked after each file and again from a fresh session. The app reads DXOS_APP_DB_URL from docker/runtime/<project>/apps/<id>.env (mode 600, git-ignored). A failed install drops a schema and role it created and keeps ones that existed before. --purge drops the schema (refused, dropping nothing, when an object outside it depends on it), then DROP OWNED BY and the role, and deletes the env file
  • Mini-app hello: about 80 lines of standard-library Python with no database. It greets the user with the name, HTX and role from the token, on one menu item for every role, and its README is the walkthrough for a first mini-app
  • Mini-app web proxy: /apps/<id>/... on the web app forwards to installed mini-apps through the gateway, only for ids in platform.installed_apps (read on every request, so a removed app answers 404 at once, and 503 when the list cannot be read). Protected paths get the user's access token and answer 401 with a sign-in link when the session has expired; public manifest paths get no token and are limited to 10 requests a minute per client IP across every app (429 with a Vietnamese message), with new IPs sharing one bucket once the 10,000-IP table is full. Paths with empty or dot segments or encoded separators answer 400; only content-type, accept and content-length (plus the token) are forwarded, so the browser's cookie, authorization and x-hasura-* headers never reach the app; only content-type and location come back, so the app's set-cookie is dropped, and a redirect that leaves the app answers 502. Every response carries Content-Security-Policy with script-src 'none' and X-Content-Type-Options: nosniff. The per-IP limiter of /api/register now lives in apps/web/src/lib/ip-rate-limit.ts, unchanged
  • DXOS_APP_PUBLIC_LIMIT: the public mini-app limit per minute and IP for the web container, read by Compose interpolation, default 10; a value that is not a positive integer keeps 10. The CI Start Web step raises it (to 1000), so a Playwright retry cannot hit 429. A demo machine on Docker Desktop should raise it too (for example 300), because Docker Desktop shows every client as one IP and the limit becomes shared by the whole room. Production and the compose default keep 10
  • Cross-site form posts to mini-apps refused: the web proxy answers 403, without forwarding, to a non-GET request under /apps/ whose Origin header is neither <scheme>://<Host> of the request nor the AUTH_URL origin (Origin: null included), or that has no Origin but Sec-Fetch-Site: cross-site, since the proxy attaches the signed-in user's token
  • Mini-apps in the app shell: each role's menu lists the installed mini-apps whose manifest menu names that role (read on every page load; when the list cannot be read the menu shows no app and the other items stay). /<role>/apps/<id>/... shows the app in an <iframe sandbox="allow-forms allow-same-origin allow-top-navigation-by-user-activation"> (no allow-scripts) on /apps/<id>/..., passes the page query through, adds ?theme=light|dark from the stored theme choice, and answers 404 when the app is not installed, has no menu entry for the role, or the path has an unsafe segment; when the app list cannot be read the page shows "Dịch vụ dữ liệu đang tạm gián đoạn" with "Thử lại". The service worker never answers /apps/ from its cache
  • /dxos-app.css: the shared stylesheet for mini-apps, served without a session. It holds the core tokens (same values as globals.css, checked by a test) for light, dark and data-theme, plus styles for text, tables, forms, buttons and button.secondary, .notice, .error, .pill. Tables span their card, header row included. Below 640 px each row is stacked as a card: a cell with data-label shows that column name next to its value, and a cell without one keeps the card's full width. Apps set data-theme on <html> from ?theme= and keep it across their links and forms, as hello and tea-tour do
  • Mini-app tea-tour (Đặt tour đồi chè): ./dxos install miniapps/tea-tour adds "Tour đồi chè" to the manager menu and "Lịch dẫn tour" to the farmer menu. Managers create tours (title, Vietnam-time start, meeting point, 1–50 seats, price in VND shown as 250.000 ₫, description) with a guide picked from their HTX's households, read through the gateway with the user's own token (the tour list stays usable when the core does not answer within 5 s), edit an open, upcoming tour (seats never below those booked, checked under the tour's row lock), see each tour's bookings with phone numbers, confirm (only while the tour is open; the confirm locks only that booking's tour) or cancel them, and cancel tours; a confirm or cancel that changes nothing says so. Guests book without signing in at /apps/tea-tour/public/<htx> (name, Vietnamese phone, 1–10 people, note), get an 8-character code and look the booking up with code and phone together; public pages never show another guest's name or phone. A booking locks the tour row, so concurrent bookings never oversell; past, cancelled and other-HTX tours are refused with a Vietnamese message and nothing stored. The guide farmer sees their tours with confirmed guest counts. Its tables carry ARIA table roles and data-label on every cell, so they keep their meaning when stacked on phones. Data lives in schema app_tea_tour (tours, bookings, both with htx_code; a booking's foreign key includes its HTX). The app holds at most 8 database connections and answers 503 "Hệ thống đang bận" when none frees within 2 s; it never holds one while waiting for the core
  • Mini-app tests and CI: make apps-smoke installs and removes hello, tea-tour and the CLI fixtures on a seeded stack (it purges their data, so it refuses to start, with exit 1, when ./dxos list shows tea-tour or hello installed): routes 200 with a token and 401 without on the internal port 9081, 404 on the published 9080, the gateway's 401 for the wrong role, a tour booked end to end, idempotent re-install, rollback of a failing health check, routes kept across make platform-up, 404 after removal, --purge, and finally make platform-smoke on the app-free stack. tests/e2e/story/tea-tour.spec.ts runs the tour story in the browser (the manager creates a tour with a TC household as guide, a guest books on a 390 px phone, the manager confirms, the guide sees 2 guests) and, with E2E_TEA_TOUR=removed, checks that the menu item is gone and the public page answers 404; screens.spec.ts adds the tea-tour manager, public and guide screens at 1280 and 390 px in light and dark, and also checks overflow and overlap inside the app frame. CI runs the CLI, hello and tea-tour tests, validates every manifest under miniapps/, and in the platform-smoke job installs tea-tour, runs the story and the screens, removes it, runs the removal check, then make apps-smoke

Changed#

  • Version: apps/web/package.json is 1.8.0, the core version the mini-app manifests require (ruling R7)
  • APISIX route file: apisix now mounts ${DXOS_GATEWAY_FILE:-../platform/gateway/apisix.yaml}. The Makefile and ./dxos set DXOS_GATEWAY_FILE to the generated ../docker/runtime/<project>/gateway/apisix.yaml; without it (release bundle, a bare docker compose up) apisix reads the tracked base file and serves no app route
  • Compose: postgres also mounts platform/postgres/init/05-apps.sql and, like apisix, joins dxos-apps-net; the dxos-cli service is added under profile tools

Fixed#

  • make platform-smoke re-run on a seeded stack: two checks of smoke-dataops.sh counted every LB reading, including the ones [lifecycle] backfills for the seeded LB parcels in the first run, so any second run failed. They now count only the fixture parcel P-LB-001, whose rows the section deletes first
  • The gateway could send one mini-app's requests to another after a reinstall: Docker's DNS answers app names with a 600 s TTL and gives a removed app's IP to the next container, and APISIX kept the old answer. After ./dxos remove tea-tour, ./dxos install miniapps/hello and a reinstall of tea-tour, tea-tour's requests, with the user's token, reached hello (CI run 43178558735: creating a tour got hello's 404). platform/gateway/config.yaml now sets apisix.dns_resolver_valid: 1, so the gateway resolves app names again every second. make apps-smoke first replays that sequence and checks that 30 requests on new connections all reach tea-tour

Upgrade notes#

  • Routes written before the internal-port fix: an app installed from a pre-release build of this branch has a route file without the 9081 condition, and gateway-sync refuses it. Run ./dxos remove <id> (it deletes that route file), then ./dxos install miniapps/<id> again
  • Start the stack with make: make platform-up (or make up) creates docker/runtime/<project>/gateway/apisix.yaml and sets DXOS_GATEWAY_FILE. When starting web on its own, pass the same variable (DXOS_GATEWAY_FILE=../docker/runtime/docker/gateway/apisix.yaml docker compose -f docker/docker-compose.yml up -d --build --wait web disease-api), or Compose recreates apisix on the base file and the app routes disappear until the next make platform-up
  • First make platform-up recreates postgres and apisix: their mounts changed (the new init file, the generated route file) and both join dxos-apps-net. The data in docker_pgdata is kept, and platform-init creates platform.installed_apps on the existing database. Never delete the docker_* volumes
  • Runtime state per compose project: generated files live under docker/runtime/<project>/ (git-ignored), where <project> is the COMPOSE_PROJECT_NAME environment variable, default docker. Set the project with that variable; ./dxos and the Makefile do not read -p or docker/.env. No app was installed before this release, so nothing needs moving
  • Release bundle: v1.8.0 does not install mini-apps from the release bundle (no dxos-cli image is published); the release stack starts apisix on the base route file as before, with no change to the release steps
  • Demo: build the tea-tour image ahead (install it once, then ./dxos remove tea-tour --purge), so ./dxos install miniapps/tea-tour takes about 11–12 seconds. On Docker Desktop, start web for the demo with a higher DXOS_APP_PUBLIC_LIMIT (for example 300), since every phone shares one IP (README, "Chuẩn bị demo")

Known limits#

  • Cross-app trust (ruling R24): every installed app shares dxos-apps-net, and an app decodes the token's claims without verifying the signature (the gateway verifies user requests). Another installed app can therefore call it directly with a forged token, with any HTX and role, and read or change its data. Install only trusted apps. Real per-app isolation (JWT verification or a network per app) is deferred to v1.9
  • npm run dev outside Docker cannot reach mini-apps: app routes match only on apisix:9081, which the host cannot reach; work on mini-apps with the web container
  • Public limit and X-Forwarded-For: the public mini-app limit trusts the first X-Forwarded-For element and counts per web process, like /api/register; a client can forge the header to get a new bucket. It must move to the gateway or a shared store when web runs more than one instance
  • PUBLIC keeps CONNECT on the other databases (keycloak, postgres, template1) in v1.8.0 (ruling R17): an app role can connect there, and default privileges an app leaves there make --purge fail (the env file is kept) until an admin runs DROP OWNED BY app_<id> in that database
  • The --purge dependency guard covers table, type and function dependencies only: an object outside the schema that depends on another kind of app object (for example a core column using an app collation) is dropped by DROP SCHEMA ... CASCADE
  • Migrations are recorded by file name only, with no checksum: editing an applied file has no effect on an existing install, and an unpurged dev install keeps the old version. A COMMIT inside a migration file breaks its one-transaction-per-file rule (the app's schema only)
  • Re-installing over an existing app role logs in as that role: a stale env-file password or 10 connections already held make the install fail, safely, with nothing changed
  • Soft 404 on a missing app's shell page (ruling R15): /<role>/apps/<missing> renders the 404 page with HTTP 200, because the role layouts stream their loading state first, like the existing /lot, /q and /htx pages. The proxy /apps/<id>/... answers a real 404, so a removed app is unreachable
  • A bare docker compose up has no app routes: without DXOS_GATEWAY_FILE, apisix serves only the base routes, which fails closed
  • /apps/<id> without a trailing slash answers 404 at the gateway; the web proxy always sends /apps/<id>/...
  • Behind a TLS proxy the proxy's own scheme is http, so the Origin check relies on AUTH_URL naming the public URL, as the documented deployment already sets it

1.7.0 - 2026-11-11#

Added#

  • Tea leaf disease model: ai-models/tea_leaf_model.keras (MobileNetV2 transfer learning, 224×224, 8 classes listed in ai-models/tea_class_names.txt, 9.2 MB) with Vietnamese labels in tea_class_names_vi.json, each marked for officer review. ai-models/tea/ holds the reproducible pipeline (train.py, datasets.json with DOIs, download URLs and SHA-256, pinned requirements.txt) that runs in python:3.12.15-slim-bookworm. It is trained on three CC BY 4.0 Mendeley datasets (Kimutai and Förster, Kenya; Islam, Bangladesh; Billah et al., Bangladesh), credited in ai-models/ATTRIBUTION.md; no image is committed. ai-models/tea/MODEL_CARD.md reports the measured numbers: test accuracy 0.8683 on 1,025 images and confidence threshold 0.60, but only 0.12 to 0.35 when one source is held out, and a random-noise image is called healthy at 0.988. Accuracy on Thái Nguyên photos is not measured; every result goes to an officer
  • Tea disease model served: POST /predict?model=tea on disease-api uses the tea leaf model next to the general one (still the default; any other model name answers 400). Responses gain model and uncertain; a tea result below TEA_CONFIDENCE_THRESHOLD (default 0.60, rejected at startup outside (0, 1]) has null names and keeps top3. /health adds models with each model's state
  • Tea disease flow in the web app: a parcel whose crop names chè/tea is diagnosed with the tea model, any other with the general one. An uncertain result is stored as Không xác định, and every result still goes to the officers; the farmer screen says Đã gửi cán bộ kỹ thuật xem instead of presenting a final diagnosis. A 503 from the tea model is an outage (503 AI_UNAVAILABLE), never a fallback to the general model
  • Officer's confirmed diagnosis: the review form has a Tên bệnh đã xác nhận field, pre-filled with the AI name (empty when uncertain). PUT /api/officer/diseases/[id]/review takes confirmed_diagnosis, required when approving, and stores it in confirmed_diagnosis; the farmer history, officer lists, soil-health screen, notification and archived report show it over the AI name
  • Tea harvest rounds: POST /api/parcels/[id]/start-round (officer only, TenantGuard.parcel) moves a HARVESTED parcel to TENDING and opens the cycle Lứa <n>/<year>, numbered within the year in Vietnam time. The status check and the new cycle are one transaction, so a second start, or a start on any other status, is refused with 422 and creates nothing. The officer's household screen has a Bắt đầu lứa mới button on harvested parcels
  • Journal photo upload: POST /api/journal/upload (farmer and officer) returns a presigned upload URL valid for 900 seconds and the key para/<htxCode>/Areas/Journal/<yyyy>/<uuid>-<safe name>, which POST /api/journal accepts as photo_minio_key. Only image/jpeg, image/png and image/webp are accepted; the name is reduced to its last segment without Vietnamese marks or unsafe characters, capped at 100 characters. The farmer journal form's photo upload called this route before it existed; the A3 browser story uploads a photo through it to storage and opens it again
  • Withdrawal on the farmer dashboard: Thửa <mã> còn <N> ngày cách ly for each parcel of the farmer's household whose latest safe harvest date (from journal entries not rejected) is still ahead; N is whole days, rounded up
  • Tea demo data: npm run seed (new script, runs prisma db seed) creates the Tân Cương (TC) and La Bằng (LB) cooperatives with made-up households and tea parcels (Trung du, LDP1, Kim Tuyên). Parcel TC-A3 has, relative to the seed run, a fertiliser entry, a spraying entry still under its 7-day withdrawal, a harvested previous round whose lot TC-CHE-A3-001 is already exported with a public trace page, and one pending tea disease report. Re-running it changes only TC and LB rows (plus the shared market, bulletin and partner rows); the history of the seeded parcels is rebuilt with fresh dates. platform/tests/seed-test.sh checks this on a throwaway database
  • Tea demo accounts in the realm: manager_tc, officer_tc, farmer_tc, manager_lb, officer_lb, farmer_lb (password Test1234!; managers and officers must set up TOTP). The farmers have fixed ids, which the seed uses to link them to their household
  • Tea market data: comtrade_export_sync also fetches HS 0902 and stores it as Tea; vietnam_market_sync adds a simulated dried tea bud price (Tea, VND/kg). Every price that workflow simulates is now written under the source Mô phỏng (Toàn quốc) instead of naming a ministry or market portal, and the dashboard price list, the market widget and the chatbot's market context label such prices giá mô phỏng; the chatbot and the bulletin prompt must say so too, and the chatbot's context no longer calls its market data "thực tế". The market widget names no source when it has no data. Prices already stored under the old source names are not relabelled
  • Design system and dark mode: DESIGN.md (google-labs-code/design.md format) documents the tokens of apps/web/src/styles/globals.css, which now has a dark value for every colour token, applied under prefers-color-scheme: dark unless the viewer picked light, or under data-theme="dark". A theme button (Sáng → Tối → Theo hệ thống, stored in localStorage key opentea-theme) sits in the top bar and on the home and login pages; an inline script sets the stored theme before first paint and does nothing if storage is blocked. Tailwind's dark: variant follows the same choice, and semantic tokens (bg-danger-subtle, text-ink-secondary, ...) are available as Tailwind colours. Tests check that every light token has a dark value, that text/background pairs reach WCAG AA 4.5:1 in both themes, and that DESIGN.md matches globals.css. A colour guard fails on hard-coded colours in *.module.css and *.tsx; its baseline of files still to convert (74 when it was added) was emptied by the move to tokens below
  • A3 story and priority screens in the browser: tests/e2e/story/tea-a3.spec.ts runs "Một ngày của lô chè A3" on the seeded stack with real Keycloak logins: the farmer sees A3's withdrawal and adds a journal entry with a photo uploaded to storage; a tea photo diagnosis goes through the gateway to the tea model (checked in the disease-api access log) and into the officer queue, where the officer confirms it with a name the farmer then sees; harvest approval and a lot of A3 are refused during the withdrawal; the officer creates and exports a lot of TC-A2; the public pages /q/<code> of that lot and of TC-CHE-A3-001 show their withdrawal status. tests/e2e/visual/screens.spec.ts saves the priority screens of spec §6.4 (9 pages: the disease review is both the queue and the review form) at 1280×800 and 390×844 in light and dark (36 screenshots under test-results/screens/) and fails on page-level horizontal overflow, on overlapping visible text, and on a theme button missing from or crowded in the phone top bar. The platform-smoke CI job now seeds the demo data, starts disease-api with web, runs both specs after the core tenant spec and uploads the screenshots as the priority-screens artifact. make platform-smoke also creates smoke_officer_tc, because the demo officers must set up TOTP first
  • Home page: / is now public for signed-out visitors, with a short introduction, a sign-in button and a lot code field that opens the public trace page /q/<code> (signed-in users are still sent to their dashboard). The PWA icons are real 192 and 512 px tea-leaf icons and are served without a session

Changed#

  • disease-api dependencies pinned: every package in apps/disease-api/requirements.txt has an exact version, and tensorflow-cpu (unpinned, no arm64 wheel) is replaced by tensorflow==2.21.0 with keras==3.15.1, so the image also builds on arm64; it is larger than before. The 46-class general model gives the same prediction as with the previously resolved versions. A pytest suite (requirements-dev.txt: pytest, httpx2) covers model selection, the threshold and the general model, and the CI job "Lint FastAPI" now runs it with -W error
  • Brand: the product is named OpenTea DX-OS everywhere (page titles via one title template, sidebar, top bar, login, register and PIN pages, trace pages, PWA manifest and the Keycloak login theme's title), from apps/web/src/lib/brand.ts. The Keycloak theme directory and realm keep the name agrimarket
  • Colours: the accent is now amber (#b45309, was orange #EA580C); the status, feedback and tertiary text colours are darkened where white or coloured text missed 4.5:1; --font-family-sans uses Be Vietnam Pro instead of an Inter font that was never loaded. The login page uses tokens only
  • Tea vocabulary: the app no longer speaks of rice. Placeholders, chat suggestions, mock bulletins, the soil-health warning and the seeded market, bulletin and partner rows use tea; the seed no longer attributes made-up figures to real bodies (its FAOSTAT rows and the bulletin's WTO and Sở NN&PTNT sources are gone, and its one demo price is simulated); the menu item Lịch vụ mùa is now Lịch thu hái; a new zone's season defaults to Lứa 1/<year>; the default commodity of the bulletin, market widget and market API is Chè/Tea (the farmer bulletin page now looks it up by its English name, as the workflows store it, and GET /api/bulletin without ?commodity reads Tea for any tea crop of the HTX, such as Chè Trung du). The manager dashboard's price list shows the 3 newest tea prices, topped up with the newest other commodities only when fewer than 3 exist. A test fails when a rice word is back in the web source or the seed; its only exceptions are the commodity name maps for Comtrade rice and wheat rows
  • Demo data and accounts: the MD2 rice cooperative is no longer seeded, the old seed's backfill of households without an HTX is gone, and weather rows are seeded only for the seeded parcels. manager1, officer1 and farmer1 are removed from the realm
  • Smoke and browser tests use their own smoke_ accounts (smoke_manager_tc, smoke_manager_lb, smoke_manager_none, smoke_farmer_tc, smoke_officer_tc); ensure_user refuses any other name, so tests never reset a demo user's password or TOTP. The A3 story and the screenshots also sign in as farmer_tc, which has no TOTP step; a login does not change the account. The two-htx.sql fixture shares the TC/LB profiles with the seed instead of deleting them, and the household checks are scoped to the fixture rows plus an every-row HTX check
  • Colour tokens everywhere: every *.module.css and *.tsx under apps/web/src takes its colours from globals.css, so all screens follow the dark theme, and the colour guard's baseline is empty. Text on primary fills uses --color-primary-foreground and on success or danger fills --color-ink-inverse; the always-dark surfaces (sidebar, bulletin header) use the sidebar tokens. The guard's exceptions name the exact fixed colours a file may keep, each with a reason and the number of times it may occur: parcel colours drawn on map tiles, and text in Leaflet popups and controls, which leaflet.css keeps white. The lot page's decorative QR preview follows the theme. About 80 variables that globals.css never declared (--color-surface-border, --text-secondary, --radius-lg, ...) now point at real tokens, so borders, muted text and rounded corners that had fallen back to nothing render as designed; @theme names count as undeclared because Tailwind emits them only when a utility needs them. A test fails on any var(--…) that globals.css does not declare, apart from four variables set at runtime
  • QR export rule: every parcel of the lot needs a crop cycle harvested on or before the lot's harvest date (same day counts, in Vietnam time) instead of being in HARVESTED, TENDING or HARVEST_APPROVED. A lot of the previous round can be exported while the next round runs, and a parcel harvested only after the lot date is refused. The withdrawal block is unchanged

Upgrade#

  • Realm: Keycloak imports the realm only when it is missing, and the Admin Console cannot set a user id, which farmer_tc and farmer_lb need. On an existing stack either (a) delete the realm (Realm settings > Action > Delete) and run docker compose -f docker/docker-compose.yml restart keycloak so --import-realm imports it again, which also drops users created at runtime; or (b) delete manager1, officer1 and farmer1, then Realm settings > Action > Partial import of docker/keycloak/realm-agrimarket.json with only Users and Overwrite, which replaces the manager_tc, manager_lb and farmer_tc the old smoke created and keeps the fixed ids. Overwrite also resets the six demo users' passwords and TOTP, so do it before setting up TOTP for a demo. Never delete docker_pgdata: the realm lives in its keycloak database next to all app data
  • Demo data: run npm run seed only on a demo database: it rebuilds the history of the TC and LB parcels with fresh dates. Re-run it before each demo so A3's withdrawal is active again
  • TOTP: managers and officers set up TOTP at their first login; set it up on the demo phone before the demo (README, "Cài TOTP trước buổi demo")
  • Disease diagnosis needs the disease-api container (docker compose -f docker/docker-compose.yml up -d --build --wait web disease-api); make platform-up does not start it
  • Never down -v on the main stack: earlier upgrade notes (1.3.0) suggested recreating the Postgres volume or running docker compose down -v once for n8n. Both delete docker_pgdata, which holds the Keycloak realm and all app data. Use REINDEX DATABASE for the collation change and let n8n create its tables in the n8n schema (README, "Nâng cấp môi trường dev cũ")
  • Storage: no change to docker/.env.local is needed. MINIO_ENDPOINT may be minio or minio:9000

Fixed#

  • web image on arm64: npm install in the Dockerfile could leave out @next/swc-linux-*-musl without an error (npm skips an optional download that fails), and BuildKit then reused that broken layer, so next build failed on arm64 with "Failed to load SWC binary". The install step now fails when the musl SWC binary is missing
  • Photo uploads from the web app: the storage adapters used MINIO_ENDPOINT as a host name while docker/.env.local.example sets minio:9000, so every request of web that touched storage failed with Invalid endPoint: journal photo upload, diagnosis, the farmer's diagnosis history, the officer's disease screens, documents and QR export. Both adapters now accept host or host:port. The browser's presigned PUT to SeaweedFS needed no CORS change
  • Pages hanging after a few clicks in the installed app: the PWA service worker cached every same-origin /api/ GET with NetworkFirst, including the /api/notifications/stream event stream, which never ends. Each page left an open connection behind, and after a few pages the browser's 6 connections per host were taken: requests hung, then came from the cache after 10 seconds, and form posts never went out. The stream now bypasses the cache (NetworkOnly). Found by the A3 browser story, which failed about one run in six before
  • Vietnamese status labels on the demo screens: the trace page that the printed QR opens (/lot/<code>) showed the raw QR_EXPORTED (or READY) pill and now shows Đã xuất QR, Sẵn sàng or Bản nháp; the officer disease queue and review showed PENDING and now show Chờ duyệt; the farmer's diagnosis history mapped a status the reports never take (RESOLVED) and showed CONFIRMED/REJECTED raw, and now shows Chờ duyệt, Đã xác nhận or Bị từ chối. The lot form and the QR export show a refusal without its machine code (WITHDRAWAL_NOT_PASSED:), which the API still returns
  • Market sources on the manager dashboard: the source box counted price rows instead of sources, called a simulated price "nguồn đã kiểm chứng", and with no data named USDA, WTO and Sở NN&PTNT. It now counts distinct real sources only, names simulated sources on their own line ("Nguồn mô phỏng: …"), and names none when there is no data
  • Farmer dashboard weather showed the stored WMO code (for example 3) and now shows its Vietnamese name (U ám)
  • Phone top bar: the product name broke after the hyphen ("OpenTea DX-" / "OS"); it now stays on one line, slightly smaller at 400 px and below
  • Demo lot grade: the seeded lot TC-CHE-A3-001 is graded Loại 1 instead of Grade 1
  • disease-api health check allows 60 seconds for both TensorFlow models to load before failed checks count, so up --wait does not give up on a cold machine
  • Missing report photos: a disease report whose photo is not in storage (the seeded A3 report, or one quarantined by the scanner) now shows "Không tải được ảnh" in the officer queue, the officer review and the farmer's history instead of a broken image
  • e2e session harness: the specs that forge an Auth.js cookie signed it with a fallback secret the Playwright dev server never had, and without htxCode, so 20 of them landed on /login or the NO_HTX notice. playwright.config.ts sets an e2e-only AUTH_SECRET for the dev server and the specs, and one helper (tests/e2e/helpers/forged-session.ts, HTX TC) replaces the 12 copies
  • Chatbot market context: its header said the data covered 48 hours while the query reads 30 days; it now says 30 days
  • Sidebar profile menu: it sat on --card with white text, so in light mode its links were white on white. It now uses the overlay surface and ink tokens
  • Journal reject button: the officer's "Từ chối nhật ký" button set its fill from an undefined variable, so it was transparent and its white text was invisible on the white dialog. It is now a danger fill with --color-ink-inverse text
  • Exported lot status on the public trace page: the snapshot stored at QR export was read before the export, so it kept status: 'READY' and the lot's earlier QR image (normally none); the public page then showed a READY pill and no "locked" banner for every lot exported in the app. The snapshot now stores QR_EXPORTED and the generated QR image. Snapshots already stored with READY are not rewritten, so lots exported before this fix still show READY on their public page (an exported lot cannot be exported again)
  • Journal photo keys: POST /api/journal accepted any photo_minio_key inside para/<htxCode>/, so a farmer could attach any document of their HTX, a manager-only one for example, and receive a signed download URL for it from GET /api/journal. It now accepts only a file key under para/<htxCode>/Areas/Journal/ (400 otherwise), and the journal list signs only such keys; a row stored with another key comes back without a photo. No legitimate photo is lost: the upload route did not exist before this release
  • Farmer diagnosis confidence: the result and history showed the 0–1 confidence as a percentage without scaling (0.988 as 1.0%), and the low-confidence warning always showed. They now show 98.8% and warn only below 70%

1.6.0 - 2026-11-10#

Added#

  • Identity-aware core access: the web app keeps the Keycloak access and refresh tokens server-side in the encrypted session cookie and refreshes them in the middleware when under 30 seconds remain; a failed refresh sends the user to /login. /api/auth/session exposes neither token
  • Tenant isolation: requireTenant() resolves the caller's HTX from the htx_code claim, answering 403 NO_HTX when it is missing or unknown; TenantGuard answers 404 before any write by ID on a record of another HTX. Notifications sent to a whole HTX now carry htx_profile_id
  • Gateway read adapters: parcels, households, lots, journal entries and disease reports are read through Hasura with the user's token. A core outage gives 503 CORE_UNAVAILABLE and a Vietnamese error page, never a fallback to Prisma
  • Internal gateway port 9081 for the web container: not limited per IP, JWT and permissions as on 9080
  • Browser test tests/e2e/tenant/core-tenant.spec.ts (E2E_CORE=1), run in the platform-smoke CI job against a real web container and real Keycloak: isolation between two HTXs, no token in the session endpoint, a live refresh of an expired token, and a Hasura outage

Changed#

  • Disease detection and the local LLM go through the gateway with the user's token; the Groq path is unchanged when a key is set. The LLM route is limited per bearer token
  • Sessions: ssoSessionIdleTimeout and ssoSessionMaxLifespan are 8 hours, matching the app session
  • Accounts: registration and invitations write htx_code; invited managers and officers must set up TOTP (#18)
  • docker/.env.local.example, .env.example: removed DISEASE_API_URL and OLLAMA_BASE_URL, which no service reads. docker/.env.local.example also drops the KEYCLOAK_ISSUER that Compose overrides and adds AUTH_URL; .env.example has no AUTH_URL
  • Documents are namespaced by HTX: keys are para/<htxCode>/.... The list, URL and upload routes derive the namespace from the session and answer 404 for anything outside it, including .. traversal; certificate_keys outside it answer 400. The one exception is para/Archives/Market_Reports/, written by the n8n workflow and holding no tenant data: the list and URL routes may read it, and the document screen shows it without upload

Fixed#

  • Migration drift (#7): migrations now produce the database described by schema.prisma, without dropping any column
  • Login from the Docker image: web built the redirect_uri from HOSTNAME (0.0.0.0) and Keycloak refused it; Compose now sets AUTH_URL
  • Account attributes: Keycloak 24 silently dropped fullName, phone and htxId; the realm now declares them as admin-only
  • HTX assumed to be the first one: every htxProfile.findFirst() now reads the caller's HTX
  • Cross-HTX reads: schedule/harvest, schedule/unscheduled, weather/forecast and the officer soil-health page returned data of every HTX; they now filter by the caller's HTX
  • Role frozen at sign-in: the role is read again from each refreshed access token, and is cleared when no recognised role remains
  • Keycloak admin credentials on a release: the web app also reads KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD, and refuses to fall back to admin/admin in production
  • Self-registration: the middleware no longer answers 401 to the anonymous POST /api/register; new accounts stay disabled until a manager approves them
  • Pre-upgrade sessions: in production a session without a refresh token goes to login instead of showing the no-HTX notice
  • Silent load failures: the officer journal approval and manager farm-zone screens now say when loading failed
  • Anonymous POST /api/register: limited to 5 requests per IP per 10 minutes (429), and anything other than a validation error answers a generic message instead of the raw error text
  • Rejected registrations: the household is unlinked before the Keycloak account is deleted, so a failed unlink can be retried and never leaves the phone taken
  • Object keys from clients: POST /api/journal answers 400 for a photo_minio_key outside the caller's document root, and the journal list signs a stored key only when it is inside that root; other entries come back without a photo. The public certificate route signs a key only inside the document root of the lot's HTX

Upgrade notes#

  • Run migrate (two new migrations: 20261109120000_sync_schema_drift and 20261109130000_notifications_htx), then platform-init, as in the deploy section.
  • On a running release, after up -d --no-build run docker compose --env-file docker/.env.local -f docker/docker-compose.yml -f docker/docker-compose.release.yml restart hasura apisix. Their compose config is unchanged, so they are not recreated: APISIX keeps listening on 9080 only and Hasura lacks the new relationships, and every list answers 503.
  • Keycloak imports the realm only on a new database. On a running realm, set SSO Session Idle and SSO Session Max to 8 hours (Realm settings > Sessions) and declare fullName, phone and htxId as admin-only attributes (Realm settings > User profile).
  • Assign the htx_code attribute to existing accounts in Keycloak, or they receive NO_HTX.
  • Old notifications with neither a recipient nor an HTX are no longer shown; n8n system alerts remain visible.
  • Rows with a null htx_profile_id (households, lots) become invisible and unwritable and must be assigned to an HTX (see scripts/backfill-htx-profile-id.sql).
  • Documents written before this release stay under para/Projects/, para/Areas/, para/Resources/ and para/Archives/. They are no longer listed and are not moved automatically; copy them to para/<htxCode>/... to use them again.
  • Certificates of exported lots whose keys are outside para/<htxCode>/ of the lot's HTX now answer 403 on the public page, and such journal photos stop showing. Copy the object into that folder and update the key to use it again.
  • Set KEYCLOAK_ADMIN as well as KEYCLOAK_ADMIN_PASSWORD in docker/.env.local, or the admin routes answer 500 in production.
  • Set AUTH_URL in docker/.env.local when the web app is not served from http://localhost:3000, and add that URL to the redirect URIs of the nextjs-web client.
  • Known limits: 9081 must stay unpublished, because it is not rate limited per IP; workflows/mattermost-push.json posts disease and harvest events of all HTXs to one webhook; in production, pre-upgrade cookies go to login; /api/dev-login cookies carry no access token, so core reads fail closed; the write path is protected in the application, not in the database; the POST /api/register limit is per process and trusts X-Forwarded-For, clients behind one proxy or NAT share it and a value that is not a valid IP goes to one shared unknown bucket, so it must move to the gateway or a shared store when web runs more than one instance.

1.5.0 - 2026-11-09#

Added#

  • MQTT sensor ingest: mosquitto (no host port, per-HTX device accounts restricted to their own topics) and dxos-ingest validate every message and store it in telemetry.sensor_readings; rejected messages are kept with a reason in telemetry.ingest_rejects. dxos-simulator (profile demo) publishes demo readings
  • Data lifecycle and lineage: dxos-lifecycle moves readings older than 30 days to Parquet (ZSTD) in the dxos-lake bucket in whole UTC days (the cutoff is floored to midnight UTC, so a row can stay hot for up to about one extra day), verifies SHA-256 and row count before deleting the hot rows, and records each export in telemetry.lifecycle_runs and audit.events. python -m dxos_dataops query reads the cold data through the sensor_readings_cold view. Hasura exposes both telemetry tables to managers and officers (scoped by htx_code)
  • In-house LLM: ollama serves qwen2.5:0.5b (Apache-2.0) behind the gateway at POST /api/ai/llm/v1/chat/completions (JWT with the dx-os-core audience, 30 requests per minute); the Ollama management API is not routed. ollama-init pulls the model and checks its ID
  • Dataops image: published to GHCR as opentea-dx-os-dataops (6 images per release with migrate); CI runs the dataops unit tests
  • Dependencies: Mosquitto (EPL-2.0), Ollama (MIT), paho-mqtt (EPL-2.0 OR BSD-3-Clause), duckdb (MIT)

Changed#

  • Deploy order: postgres -> platform-init -> migrate -> platform-init -> the rest -> ollama-init. make platform-up runs it end to end, and the release flow is identical (--profile tools run --rm ollama-init last)
  • migrate moved into docker/docker-compose.yml (profile tools), so the same service is used in dev and release

Fixed#

  • Hasura started before migrations (#17): it is no longer restarted by the smoke test; platform-up migrates first
  • Prebuilt migrate image (#15): apps/web/prisma/Dockerfile ships [email protected], the schema and the migrations; the entrypoint URL-encodes POSTGRES_PASSWORD when it builds DATABASE_URL
  • LLM smoke check retries on HTTP 429 and reports failures instead of exiting silently

Upgrade notes#

  • Add DXOS_MQTT_DEVICES (comma list of HTX_CODE:password) and DXOS_MQTT_INGEST_PASSWORD to docker/.env.local (see docker/.env.local.example). The release override makes the broker refuse to start while any of these passwords begins with change_me.
  • Re-run migrate and platform-init (the postgres image gains 04-telemetry.sql); create the mosquitto, dxos-ingest, dxos-lifecycle and ollama containers, then run --profile tools run --rm ollama-init.
  • Release flow: every docker compose command now takes --env-file docker/.env.local before -f; without it Compose used the defaults published in this repo. SeaweedFS refuses to start while MINIO_ACCESS_KEY or MINIO_SECRET_KEY is empty or a placeholder, and Keycloak refuses to start while KEYCLOAK_ADMIN_PASSWORD is empty, admin or begins with change_me. Keycloak reads that value only on a new database, so on a running system also change the admin password inside Keycloak. On existing volumes, POSTGRES_PASSWORD, KEYCLOAK_DB_PASSWORD and N8N_ENCRYPTION_KEY in that file must match the values the volumes were initialised with (until now the docker-compose.yml defaults).
  • On a running release stack, restart hasura and apisix after up -d --no-build (docker compose --env-file docker/.env.local -f docker/docker-compose.yml -f docker/docker-compose.release.yml restart hasura apisix): Hasura loads metadata only at start and APISIX keeps the old inode of its route file. make platform-up does this in dev when the stack is already running.
  • Known limits: the cold view keeps the first-ingested copy of a duplicated key; Mosquitto saves its state every 60 seconds (autosave_interval 60), so messages queued in the last 60 seconds can be lost if the broker crashes; a cold make platform-up is slow because of the Ollama image and the 397 MB model pull; dxos-ingest and dxos-lifecycle share the agrimarket database account (a least-privilege role is Tier 2).

1.4.0 - 2026-11-09#

Added#

  • File quarantine: ClamAV (clamav) and the dxos-scanner service scan new objects in agrimarket-docs and agrimarket-private; infected or unscannable (> 50 MiB) objects are copied to dxos-quarantine/<bucket>/<key> and removed, with verdicts in audit.file_scans. The scanner image is published to GHCR as opentea-dx-os-scanner
  • Audit log: hash-chained, append-only audit.events fed by row triggers on 9 business tables; verify with select * from audit.verify_chain()

Security#

  • ClamAV fails closed on archives: encrypted archives and archives exceeding a scan limit (nesting depth, size, scan time 25 s) are reported as FOUND and quarantined instead of OK. Encrypted documents (for example password-protected PDFs) are still allowed
  • Scanner re-scans replaced objects: a clean row is only trusted while the object's LastModified is unchanged, so an MD5 (etag) collision cannot hide a replacement; the source object is removed only if its etag still equals the scanned one
  • Audit chain head can only advance; verify_chain() proves chain integrity, not capture coverage (a superuser can disable triggers)

Changed#

  • Deploy order: postgres -> platform-init -> migrate -> platform-init (attaches audit triggers to the migrated tables) -> the rest
  • SeaweedFS starts with -volume.max=100

Fixed#

  • SeaweedFS: a PUT to a second bucket returned HTTP 500 (default limit of 8 volumes, 7 per bucket)

Upgrade notes#

  • Re-run platform-init after prisma migrate deploy (the postgres image did not change); recreate the seaweedfs, clamav and dxos-scanner containers.
  • On an upgraded stack, existing objects over 50 MiB in the watched buckets are moved to dxos-quarantine during the first scan rounds.

1.3.0 - 2026-11-08#

Added#

  • Contribution tooling: Bilingual issue templates (bug report, feature request), pull request template and SECURITY.md with a private vulnerability reporting policy
  • Tier 1 API gateway: APISIX on :9080 with JWT validation for /api/data/graphql, /api/workflow/* and /api/ai/disease/*
  • Hasura data API: read-only GraphQL with row-level permissions scoped by the htx_code claim
  • PostGIS and pgvector: the Postgres image now ships both extensions and is published to GHCR as opentea-dx-os-postgres
  • Platform smoke CI job: make platform-up + make platform-smoke run in CI (platform-smoke)
  • Release migrate service: --profile tools run --rm migrate applies Prisma migrations inside the compose network

Security#

  • Gateway: strips the client-supplied x-hasura-admin-secret header on the GraphQL route (it previously let any authenticated user act as Hasura admin); /api/workflow/* and /api/ai/disease/* now require the dx-os-core audience
  • Release override: Hasura refuses to start while HASURA_GRAPHQL_ADMIN_SECRET is empty or a change_me* placeholder

Changed#

  • Gateway CORS: allows the x-hasura-role request header and exposes X-Request-Id
  • Release ports: SeaweedFS S3 :9000 stays published (browsers use presigned URLs on it) until storage moves behind the gateway
  • Hasura JWT issuer is configurable through KC_PUBLIC_ISSUER
  • Object storage: MinIO replaced by SeaweedFS S3 on :9000 (network alias minio kept)
  • Keycloak: TOTP required for staff, tokens carry the dx-os-core audience and the admin-only htx_code claim; the nextjs-web password grant is disabled
  • n8n: tables moved to the Postgres schema n8n
  • Images: all service images are pinned to exact tags
  • Release override: only apisix:9080, web:3000, keycloak:8080 and SeaweedFS :9000 publish host ports; deploy order is postgres, platform-init, migrate, then the rest

Upgrade notes#

  • Dev environments: recreate the Postgres volume (or run REINDEX DATABASE agrimarket; after the alpine to bookworm switch), recreate the Keycloak realm (it is imported only on a fresh database), run docker compose down --remove-orphans, and (dev only — never on production data) docker compose down -v once for n8n. MinIO data is not migrated to SeaweedFS.

1.2.0 - 2026-11-08#

Added#

  • Tag-driven release pipeline: Pushing a vX.Y.Z tag runs the full CI quality gate, publishes versioned web and api images to GHCR and creates a GitHub Release with CHANGELOG notes and a deployment bundle
  • Release compose override: docker/docker-compose.release.yml runs web and disease-api from prebuilt GHCR images instead of building from source
  • Container images on GHCR: web and api images are published to GitHub Container Registry
  • Build-from-source guide and dependency register: Documented building without Docker and added DEPENDENCIES.md with third-party licenses

Changed#

  • Project identity: Renamed the project to OpenTea DX-OS; copyright, contacts and repository links now point to OpenTea Developers
  • README: Rewritten with an architecture diagram, feature overview, setup, testing, release and documentation sections
  • Docker edge images: docker-publish.yml now publishes edge and sha-<commit> images only after the CI Quality Gate passes on main, using lowercase GHCR image names
  • License headers: Added MIT license headers to remaining source files

Removed#

  • BMAD tooling: Removed .agent/, .agents/, _bmad/, _bmad-output/ and docs/bmad-workflow-guide.md; project rules now live in the root AGENTS.md

Fixed#

  • Hexagonal architecture: Resolved layer-boundary violations reported in code review
  • Use case tests: Fixed TypeScript errors caused by newly injected dependencies
  • Git ignore rules: Rewrote a UTF-16 encoded *.tar.gz entry that made git ignore every new file

1.1.0 - 2026-09-15#

Added#

  • Harvest Schedule Calendar: Interactive calendar for scheduling and viewing expected harvest dates
  • Vietnamese Localization (Auth): Translated Keycloak login interface labels to Vietnamese for farmers
  • Soil Health Dashboard: Soil analysis and pest risk visualization with interactive charts
  • Docker Publish CI: Automated Docker image publishing to GitHub Container Registry (GHCR)

Changed#

  • Streamlined user onboarding: removed mandatory email requirement for agricultural profiles
  • Improved QR traceability public page with snapshot immutability and safety guards

Fixed#

  • NextAuth TypeScript compilation issues with generic Route Handlers
  • Leaflet SSR hydration mismatches in Map components

1.0.0 - 2026-09-15#

Added#

  • Farm Zone Map: GIS mapping with Leaflet.js for digitizing agricultural parcels
  • Smart Journal: Farming log tracking with approval workflow and withdrawal days calculation
  • QR Lot Traceability: Full lifecycle tracking from seed to harvest with public QR pages
  • Disease AI Assistant: Computer vision for crop disease diagnosis via FastAPI
  • Audio Bulletin: Automated agricultural news synthesis via n8n and Piper TTS
  • Market Chatbot: LLM-powered market intelligence assistant (Groq Llama-3.1)
  • Keycloak SSO: Role-based authentication (Manager/Officer/Farmer)
  • n8n Data Pipelines: Automated FAOSTAT, Open-Meteo, Frankfurter FX, NASA POWER data sync
  • CI/CD Pipeline: GitHub Actions with lint, test, build, Docker smoke test
  • DEPENDENCIES.md: Full third-party library listing with license information
  • CODE_OF_CONDUCT.md and CONTRIBUTING.md for open-source community

Security#

  • All API routes protected with server-side auth checks (getServerSession)
  • MinIO access via pre-signed URLs only (no client-side SDK exposure)

0.1.0-alpha - 2026-08-11#

Added#

  • Hexagonal Architecture scaffold — Domain / Application / Infrastructure / Presentation layers with sample profile slice (#91)
  • Hybrid AI architecture — Migration to Groq cloud API with Ollama local fallback (#52)
  • PR Deep Review skill — Adversarial code review automation for CI

Fixed#

  • CI: restore package-lock.json, add Zod dependency
  • CI: remove BOM from package.json causing Prisma generate JSON parse error
  • Remove redundant CREATE DATABASE agrimarket to fix CI pipeline

0.0.4-alpha - 2026-08-10#

Added#

  • Design System — CSS custom properties (design tokens), Google Fonts integration (#89)
  • Shared UI components — Button, Badge, Card, Modal, Skeleton with CSS Modules
  • Layout shell — AppShell, Sidebar, TopBar, BottomNav responsive components
  • Unit tests — Jest config + tests for tokens, Button, Badge, Skeleton, Sidebar

Changed#

  • Refactored design system components based on code review findings

Fixed#

  • CI: resolve lint, build, and docker-compose errors

0.0.3-alpha - 2026-08-08#

Added#

  • n8n data pipelines — FAOSTAT commodity sync, Open-Meteo weather cache, Frankfurter FX rates, market bulletin generation (#87)
  • CI/CD workflow for n8n JSON linting
  • HTX profile and Lot public pages

0.0.2-alpha - 2026-08-06#

Added#

  • Full Prisma schema — All 15+ tables with JSONB multi-currency support (#86)
  • Keycloak SSO integration — NextAuth.js v5 + Keycloak OIDC with role-based routing (Manager/Officer/Farmer) (#84)

Fixed#

  • Auth: correct relative import paths, remove unused variables
  • Routing: remove route groups for role directories to fix build conflict
  • CI: update env validation, use npm install for cross-platform lockfile

0.0.1-alpha - 2026-08-04#

Added#

  • Monorepo structure — apps/web (Next.js 14) + apps/disease-api (FastAPI)
  • Docker Compose stack — PostgreSQL 16, Keycloak 24, n8n, Piper TTS, MinIO, Disease API
  • CI/CD pipeline (GitHub Actions) — Lint, build, Docker smoke test
  • Environment validation script (scripts/validate-env.sh)
  • Structure validation script (scripts/validate-structure.sh)

Fixed#

  • Add missing public/ directory for Next.js Docker build
  • Docker Compose healthchecks and initial Next.js page

0.0.0 - 2026-07-09#

Added#

  • Initial project scaffold
  • Business Analysis Document (BA) with HPDI architecture
  • MIT License
  • BMAD Method AI-Native Agile framework initialization
  • Story splitting, testing strategy, and dependency mapping for Epics 1–6
  • Complete project documentation (PRD, Architecture Spine, UX Design, API Contract)

Ghi chú: Dự án DX-AgriMarket đang trong giai đoạn phát triển ban đầu (pre-release). Phiên bản đầu tiên sẽ chính thức được đánh số v1.0.0 khi hệ thống được triển khai hoàn chỉnh với đầy đủ các tính năng MVP theo PRD.