Milestone 2.2: result and input protocol between module, host adapter and berhtjan #24

Open
opened 2026-11-08 14:10:21 +01:00 by michael · 2 comments
Owner

Goal

Installing a module works end to end: the module returns results and
questions as data, the host program intercepts them, decides how to handle
errors, hands them to berhtjan for display and input, and calls the module
again with the answer.

Background

berhtjan-cli passes the return value of a handler through unchanged and does
not present it. Only the host knows how errors are to be handled, so the
host adapter is where results are intercepted. The contracts for questions
and answers exist already (daw_event/v1 with decision_required,
daw_event_response/v1).

Scope

  • align the decision protocol of install() (status = "decision_required",
    opts.decision) with daw_event/v1 and daw_event_response/v1
  • align progress reports ({ phase, state }) and warnings with daw_event/v1
  • document what each API function returns (install, install_local, list,
    update_index) as a contract in the README
  • host side: the adapter intercepts handler results, renders them through
    berhtjan and asks through berhtjan (cross-repo issue in DAW/fragjan)
  • the host gives a module only the fields it asks for, not a complete
    configuration table
  • replace the on_progress observer by the host-wide event delivery once it
    exists (see DAW/daw-module-manager#22)

Acceptance criteria

  • install of a module with several candidates asks the user through
    berhtjan and continues with the answer
  • warnings and errors of install and update_index are shown through
    berhtjan, decided by the host
  • tests for each result shape
## Goal Installing a module works end to end: the module returns results and questions as data, the host program intercepts them, decides how to handle errors, hands them to berhtjan for display and input, and calls the module again with the answer. ## Background berhtjan-cli passes the return value of a handler through unchanged and does not present it. Only the host knows how errors are to be handled, so the host adapter is where results are intercepted. The contracts for questions and answers exist already (daw_event/v1 with decision_required, daw_event_response/v1). ## Scope - [ ] align the decision protocol of install() (status = "decision_required", opts.decision) with daw_event/v1 and daw_event_response/v1 - [ ] align progress reports ({ phase, state }) and warnings with daw_event/v1 - [ ] document what each API function returns (install, install_local, list, update_index) as a contract in the README - [ ] host side: the adapter intercepts handler results, renders them through berhtjan and asks through berhtjan (cross-repo issue in DAW/fragjan) - [ ] the host gives a module only the fields it asks for, not a complete configuration table - [ ] replace the on_progress observer by the host-wide event delivery once it exists (see DAW/daw-module-manager#22) ## Acceptance criteria - [ ] install of a module with several candidates asks the user through berhtjan and continues with the answer - [ ] warnings and errors of install and update_index are shown through berhtjan, decided by the host - [ ] tests for each result shape
Author
Owner

Status after v2.0.0. Done: every function returns a result as data, documented in the README; progress and warnings are daw_event/v1 events through the interim sink opts.emit (see DAW/daw-module-manager#22); the host (fragjan) intercepts the results, shows them through berhtjan and asks through berhtjan-cli; the host gives the module only the fields it asks for. Changed: install without a version no longer asks, it takes the newest compatible version ('opts.decision' with install-select stays for a choice the caller makes itself). Open: the questions of the module (upgrade_required, confirmation_required, dependents_present) are returned as statuses, and the host answers by calling again with a flag (upgrade, confirmed, with_dependents). This is a stopgap, and the host has to know these statuses. The contract describes a question as a decision_required event during the operation, answered by a daw_event_response/v1. The way events leave a module and answers come back is the host-wide event delivery, which does not exist yet (DAW/daw-module-manager#22 is its interim twin for the progress events). The questions are to be asked as decision_required events once it does.

Status after v2.0.0. Done: every function returns a result as data, documented in the README; progress and warnings are daw_event/v1 events through the interim sink opts.emit (see DAW/daw-module-manager#22); the host (fragjan) intercepts the results, shows them through berhtjan and asks through berhtjan-cli; the host gives the module only the fields it asks for. Changed: install without a version no longer asks, it takes the newest compatible version ('opts.decision' with install-select stays for a choice the caller makes itself). Open: the questions of the module (upgrade_required, confirmation_required, dependents_present) are returned as statuses, and the host answers by calling again with a flag (upgrade, confirmed, with_dependents). This is a stopgap, and the host has to know these statuses. The contract describes a question as a decision_required event during the operation, answered by a daw_event_response/v1. The way events leave a module and answers come back is the host-wide event delivery, which does not exist yet (DAW/daw-module-manager#22 is its interim twin for the progress events). The questions are to be asked as decision_required events once it does.
Author
Owner

The questions of this module and the questions of the fragjan catalog (DAW/fragjan#137) are the same kind of thing: a question that reaches the user through whatever UI there is, and an answer that comes back. They are meant to use one mechanism, so that the same question works in a CLI, web, API or desktop UI. The stopgap of this module (statuses answered by a second call with a flag) is to be replaced by decision_required events once the host-wide event delivery exists. A first validation of that path with one question of this module (the confirmation of a removal) is planned. This comment changes nothing in the scope above.

The questions of this module and the questions of the fragjan catalog (DAW/fragjan#137) are the same kind of thing: a question that reaches the user through whatever UI there is, and an answer that comes back. They are meant to use one mechanism, so that the same question works in a CLI, web, API or desktop UI. The stopgap of this module (statuses answered by a second call with a flag) is to be replaced by decision_required events once the host-wide event delivery exists. A first validation of that path with one question of this module (the confirmation of a removal) is planned. This comment changes nothing in the scope above.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-module-manager#24
No description provided.