Skip to content

feat(ai): dossiq ships its case prompts into hermiq and declares its request catalogue - #3659

Merged
rubenvdlinde merged 41 commits into
developmentfrom
build/dq-l6-9
Oct 12, 2026
Merged

rubenvdlinde merged 41 commits into
developmentfrom
build/dq-l6-9

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Stacked on #3648 (build/dq-l6-8), and through it on #3629, #3625 and #3607. Land those first.

What this builds

ai-features-on-the-case-consume-hermiq, tasks 6.1 and 5.3. Decision 182 applies: both are generic capabilities, configured per case type, and no class is named after a procedure.

6.1: the prompt library moves to hermiq (REQ-AIC-06)

  • The initial library is data in lib/Settings/assistant-prompts.json (usage scope dossiq-case). It holds four prompts, labelled after the questions on board DqZaakAssistent.
  • lib/Repair/ShipAssistantPrompts.php (new) is registered in post-migration and install. It hands the prompts to hermiq's AssistantPromptLibrary::seed('dossiq', ...) under the system identity. hermiq skips every prompt an administrator has touched, so a rerun restores nothing. If hermiq is missing, or has no library that can take seeds, the step warns and the upgrade still succeeds. The app version is bumped (gate 110).
  • GET /api/assistant/prompts (AssistantController::prompts) reads the prompts back through HermiqAiFeatureClient::prompts(). That client method had no caller until now. The case assistant panel shows them under "Questions", and clicking one sends that prompt to the assistant through the existing converse endpoint.
  • Not moved: AiPromptFactory. Its templates are what dossiq's own AiService sends. They are not prompts the assistant offers on a case.

5.3: the request catalogue

  • A case type counts as a request type when it is published and places an AI feature on the intake surface (caseType.aiFeatures). That is configuration; no list lives in code. lib/Service/Intake/RequestCatalogue.php (new) lists these case types once per identifier. Each entry's type is the value dossiq.fileCase accepts.
  • The read tool dossiq.requestCatalogue (IntakeTools::requestCatalogue) offers the list. It has scope read and reach user, is marked outsideAgent, and carries no intake mark.
  • New spec scenario: "The request catalogue is the case types declared for intake".

New classes and their tests (coverage guard):

  • ShipAssistantPrompts -> tests/Unit/Repair/ShipAssistantPromptsTest.php (4 tests: the shipped scope matches what the case reads back, absent hermiq, no seedable library, unreadable file).
  • RequestCatalogue -> tests/Unit/Service/Intake/RequestCatalogueTest.php (3 tests).
  • Extended: AssistantControllerTest (+2), IntakeToolsTest (+1), DossiqScannableServicesTest (read tools, reach), caseAiFeaturesPanel.spec.js (+3), caseAiFeaturesApi.spec.js (+1).

Verified (exit codes)

  • PHPUnit, targeted (Architecture, Mcp, Repair, AppInfo, Service/Intake, Service/Mcp, Service/Ai, AssistantControllerTest): 689 tests, exit 0.
  • phpcs, phpmd (both rulesets), phpstan and psalm on every changed lib file: 0.
  • vitest on the touched specs: 23/23, exit 0. eslint and prettier: 0. tsc -p tests/e2e: 0. l10n check, check:l10n-js, check:schema-l10n, debt-ratchet: 0.
  • check:strict: queued behind 16 waiters and did not start within 10 minutes. I stopped the waiter by PID (slot rule, decision 149), so CI is the full check.
  • Hydra gates: the local run did not finish before this PR opened (load average 43). CI runs the full gate set. The same gates on feat(ai): the assistant panel on the case renders AI features, refusals and the report group #3648 exited 3, with only the inherited 22/23/53 failing.

Still owed

  • e2e live pass (decision 139): npx playwright test tests/e2e/ai-features-on-the-case.spec.ts, now with the questions test.
  • A live check that a case type declaring "conversational-intake": "intake" shows up in tools/call dossiq.requestCatalogue.

Twelve schemas declare a curated x-openregister-mcp block, so OpenRegister
derives 20 read tools (dossiq.case.search, dossiq.statusRecord.search, ...).
The hand-written DossiqToolProvider and its helpers are deleted, so nothing
shadows the derived tools. OpenRegister RBAC is the only gate.

Archives dossiq-mcp-adoption; live tasks 4.1-4.4 stay owed (decision 139).
A change outside properties/required/authorization only reaches an instance
when the schema version moves (SchemaVersionFloorTest). Digests regenerated.
…nd workload figures

First IMcpScannableServices opt-in (DossiqScannableServices, registered under
OpenRegister's per-app alias). Curated #[McpTool] reads: getDeadlineDashboard,
getDoorlooptijdMetrics, getKpiOverview, getWorkload (ReportingTools),
listAvailableTransitions (CaseTools) and listOverdueComplaints on
ComplaintService, a projection that never carries the complainant. Each tool
runs the gate its controller runs, then calls the owning service.
…creens.md for the touched specs and the archived change
# Conflicts:
#	lib/Settings/dossiq_register.json
#	lib/Settings/register.d/60-termijnbewaking.json
#	tests/schemas/schema-version-digests.json
# Conflicts:
#	lib/Settings/dossiq_register.json
#	lib/Settings/register.d/60-termijnbewaking.json
#	tests/schemas/schema-version-digests.json
…them without a grant

Every curated read (deadline dashboard, lead times, KPIs, workload, available
transitions, overdue complaints) now declares reach: 'user'. Without it a
two-segment id resolves to external and needs an explicit grant.
Needs openregister build/dep-dossiq-mcptool-reach on the instance first.
… and work its terms

Curated write tools, each on the service its controller calls:
transitionCase (StatusTransitionService, guards and status record intact),
reassignCase (new CaseAssignmentService::reassign, coordinators only, the
receiver is notified), completeTask (the engine's complete verb),
extendDeadline/pauseDeadline/resumeDeadline (new TermTools: the term is read
and its CASE must be changeable by the caller before the term services run).
Refusals come back as envelopes with the service's own rule and sentence.

WIP: AppointmentTools and BeschikkingTools are listed but not written yet.
…chikking

AppointmentTools (scheduleAppointment, cancelAppointment; external reach: the
resident is told) run AppointmentController's case checks and call
AppointmentService. BeschikkingTools offers draftBeschikking only, through
BeschikkingService::compose(); approving, signing and sending stay with the
caseworker. A test holds the tool classes off ObjectService.

hermiq-ai-tooling 3.1-3.3 ticked; the spec names the services as found.
# Conflicts:
#	lib/Settings/register.d/60-termijnbewaking.json
#	tests/schemas/schema-version-digests.json
# Conflicts:
#	.debt-baseline.json
#	appinfo/info.xml
#	lib/Settings/dossiq_register.json
#	lib/Settings/register.d/60-termijnbewaking.json
#	tests/schemas/schema-version-digests.json
# Conflicts:
#	lib/Settings/register.d/60-termijnbewaking.json
#	tests/schemas/schema-version-digests.json
…duleAppointment (phpmd finds nothing without it)
…s no approval floor

Decision 176 (Q-dossiq-L6-2): REQ-MCP-206 now says hermiq decides which AI
writes wait for a person. dossiq declares readOnlyHint: false and a scope on
every write so hermiq can gate it, and ships no grant or waiver. CHANGELOG
entry for the curated tools (task 4.3).
…siq.fileCase

dossiq.fileCase carries the citizenIntake mark with scope and action create,
which is how hermiq now recognises an intake tool (decision 177). It writes
through the create form's own path: one save on the case schema as the caller,
so the schema, the intake requirements, the duplicate policy and RBAC all run,
and a refusal is thrown so hermiq hands the resident to a person. No
intermediate intake object (decision 179). The six curated reads carry
outsideAgent for hermiq's outbound surface.

ai-features-on-the-case-consume-hermiq 5.1, 5.2; screens.md added.
caseType.aiFeatures (register fragment 43) maps hermiq's feature slug to
case, intake or none, and holds no provider, model or residency. Register
0.20.25, info.xml bumped, en/nl strings. Ticks ai-features 1.1, and 1.2/2.1
with the files that already carry them.
…spelled-out alias (gate 57 could not see AppointmentTools)
…y in CaseIntakeFiling (phpmd), REQ-MCP-206 anchor follows the rewritten heading (gate 46)
…its group is read on the case

A case type declares grouping as aiFeatures["report-similarity"]. hermiq's
evaluation adds the report to a group, so asking twice would count the same
resident twice: a created case is placed once, off the request, by
ReportGroupingJob as the background service account, and the group id is kept
on the case (case.reportGroupId, register fragment 44, register 0.20.26).
GET /api/report-group reads the group as it now stands, with the count and the
near-duplicates, and never places the case again. A group reduces no
confirmation of receipt: confirmationsOwed() counts the reports.

Ticks ai-features 2.2 (HermiqAiFeatureClientTest, absent hermiq over the real
client) and 4.2; 4.1 backend built, the render on the case is open. Records
the schema digests for fragments 43 and 44.
# Conflicts:
#	tests/schemas/schema-version-digests.json
…iq, and is refused before sending without one

src/services/caseAiFeatureGateway.js runs a case type's feature on a case
document through hermiq's run-on-document endpoint (hermiq#1148), in the
handler's own session, so hermiq reads the document as the handler. A request
without a usable file id is refused before any request; hermiq's refusal
comes back carrying its gate, and refusalSentence() names the feature and the
reason. Ticks ai-features 3.1.
… absent-hermiq test declares the classes it uses
…ls and the report group

ai-features-on-the-case-consume-hermiq 3.2 and 4.1 (board DqZaakAssistent):
CaseAiFeaturesPanel as the case sidebar tab 'assistant'. Features show where
they run as hermiq answers; a run on a case document goes through the gateway
and a refusal names the feature, the reason and hermiq's gate. The report group
shows its count and the near-duplicates. The case type's declaration is read
first, so an undeclared case type asks nobody. Also drops a redundant
psalm-suppress on RepairPortRegistrar (debt ratchet).
ai-features-on-the-case-consume-hermiq 6.1 (REQ-AIC-06). The initial library is
data (lib/Settings/assistant-prompts.json); ShipAssistantPrompts hands it to
hermiq's library on install and upgrade, which keeps every prompt an
administrator touched. GET /api/assistant/prompts reads them back through
HermiqAiFeatureClient::prompts(), and the case assistant panel offers them as
questions.
ai-features-on-the-case-consume-hermiq 5.3. A case type is a request type when
it is published and places an AI feature on the intake surface. RequestCatalogue
lists them once per identifier, the type dossiq.fileCase accepts, and the read
tool dossiq.requestCatalogue offers the list to hermiq's outside surface.
@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Local Hydra gates finished after this PR was opened: exit 3, failing only on the inherited gates 22/23/53.

@rubenvdlinde
rubenvdlinde merged commit fd35b93 into development Oct 12, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant