Config surface — per-project config introspection, coherence verification, and
audited mutation without destroying NCL structure (ADR-008):
- crates/ontoref-daemon/src/config.rs — typed DaemonNclConfig (parse-at-boundary
pattern); all section structs derive ConfigFields + config_section(id, ncl_file)
emitting inventory::submit!(ConfigFieldsEntry{...}) at link time
- crates/ontoref-derive/src/lib.rs — #[derive(ConfigFields)] proc-macro; serde
rename support; serde_rename_of() helper extracted to fix excessive_nesting
- crates/ontoref-daemon/src/main.rs — 3-tuple bootstrap block (nickel_import_path,
loaded_ncl_config: Option<DaemonNclConfig>, stdin_raw); apply_ui_config takes
&UiConfig; NATS call site typed; resolve_asset_dir cfg(feature = "ui")
- crates/ontoref-daemon/src/api.rs — config GET/PUT endpoints, quickref, coherence,
cross-project comparison; index_section_fields() extracted (excessive_nesting)
- crates/ontoref-daemon/src/config_coherence.rs — multi-consumer coherence;
merge_meta_into_section() extracted; and() replaces unnecessary and_then
NCL contracts for ontoref's own config:
- .ontoref/contracts.ncl — LogConfig (LogLevel, LogRotation, PositiveInt) and
DaemonConfig (Port, optional overrides); std.contract.from_validator throughout
- .ontoref/config.ncl — log | C.LogConfig applied
- .ontology/manifest.ncl — contracts_path, log/daemon contract refs, daemon section
with DaemonRuntimeConfig consumer and 7 declared fields
Protocol:
- adrs/adr-008-ncl-first-config-validation-and-override-layer.ncl — NCL contracts
as single validation gate; Rust structs are contract-trusted; override-layer
mutation writes {section}.overrides.ncl + _overrides_meta, never touches source
on+re update:
- .ontology/core.ncl — config-surface node (28 practices); adr-lifecycle extended
to adr-007 + adr-008; 6 new edges (ManifestsIn daemon, DependsOn ontology-crate,
Complements api-catalog-surface/dag-formalized/self-describing/adopt-ontoref)
- .ontology/state.ncl — protocol-maturity blocker and self-description-coverage
catalyst updated for session 2026-03-26
- README.md / CHANGELOG.md updated
187 lines
7.3 KiB
HTML
187 lines
7.3 KiB
HTML
{% extends "base.html" %}
|
|
{% import "macros/ui.html" as m %}
|
|
|
|
{% block title %}Notifications — Ontoref{% endblock title %}
|
|
{% block nav_notifications %}active{% endblock nav_notifications %}
|
|
{% block nav_group_track %}active{% endblock nav_group_track %}
|
|
|
|
{% block content %}
|
|
<div class="mb-6 flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-2xl font-bold">Notifications</h1>
|
|
<p class="text-base-content/50 text-sm mt-0.5">{{ total }} total</p>
|
|
</div>
|
|
{% if other_projects %}
|
|
<button onclick="document.getElementById('emit-modal').showModal()"
|
|
class="btn btn-sm btn-primary gap-1.5">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/>
|
|
</svg>
|
|
Emit notification
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if notifications | length == 0 %}
|
|
{{ m::empty_state(message="No notifications in store") }}
|
|
{% else %}
|
|
<div class="overflow-x-auto">
|
|
<table class="table table-zebra table-sm w-full bg-base-200 rounded-lg">
|
|
<thead>
|
|
<tr class="text-base-content/50 text-xs uppercase tracking-wider">
|
|
<th>#</th>
|
|
<th>Type</th>
|
|
<th>Project</th>
|
|
<th>Content</th>
|
|
<th>Source</th>
|
|
<th>Age</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for n in notifications %}
|
|
<tr>
|
|
<td class="font-mono text-xs text-base-content/40">{{ n.id }}</td>
|
|
<td>
|
|
{% if n.is_custom %}
|
|
<span class="badge badge-xs badge-primary font-mono">{{ n.custom_kind | default(value="custom") }}</span>
|
|
{% else %}
|
|
{{ m::event_badge(event=n.event) }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="font-mono text-sm">
|
|
{{ n.project }}
|
|
{% if n.source_project and n.source_project != n.project %}
|
|
<span class="text-xs text-base-content/40 block">← {{ n.source_project }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if n.is_custom %}
|
|
<div class="font-medium text-sm">{{ n.custom_title | default(value="") }}</div>
|
|
{% if n.custom_payload %}
|
|
{% set p = n.custom_payload %}
|
|
{% if p.actions %}
|
|
<!-- DAG action buttons -->
|
|
<div class="flex flex-wrap gap-1 mt-1.5">
|
|
{% for act in p.actions %}
|
|
<form method="post" action="{{ base_url }}/notifications/{{ n.id }}/action" class="inline">
|
|
<input type="hidden" name="action_id" value="{{ act.id }}">
|
|
<button type="submit" class="btn btn-xs
|
|
{% if act.mode == 'auto' %}btn-error
|
|
{% elif act.mode == 'semi' %}btn-warning
|
|
{% else %}btn-ghost{% endif %} gap-1">
|
|
{% if act.mode == 'auto' %}▶{% elif act.mode == 'semi' %}◑{% else %}→{% endif %}
|
|
{{ act.label }}
|
|
</button>
|
|
</form>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<details class="mt-1">
|
|
<summary class="text-xs text-base-content/40 cursor-pointer">payload</summary>
|
|
<pre class="text-xs text-base-content/60 mt-1 bg-base-300 rounded p-2 max-w-xs overflow-auto">{{ p }}</pre>
|
|
</details>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% else %}
|
|
<div class="flex flex-col gap-0.5">
|
|
{% for f in n.files %}
|
|
<code class="text-xs text-base-content/60">{{ f }}</code>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</td>
|
|
<td class="text-xs font-mono text-base-content/50">
|
|
{{ n.source_actor | default(value="—") }}
|
|
</td>
|
|
<td class="text-xs text-base-content/60 whitespace-nowrap">{{ n.age_secs }}s ago</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if other_projects %}
|
|
<!-- Emit notification modal -->
|
|
<dialog id="emit-modal" class="modal">
|
|
<div class="modal-box max-w-lg">
|
|
<h3 class="font-bold text-base mb-4">Emit Notification</h3>
|
|
<form method="post" action="{{ base_url }}/notifications/emit" class="space-y-3">
|
|
<div class="form-control">
|
|
<label class="label py-1"><span class="label-text text-sm">Target project</span></label>
|
|
<select name="target_slug" class="select select-bordered select-sm" required>
|
|
{% for p in other_projects %}
|
|
<option value="{{ p }}" {% if p == slug %}selected{% endif %}>{{ p }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="grid grid-cols-2 gap-3">
|
|
<div class="form-control">
|
|
<label class="label py-1"><span class="label-text text-sm">Kind</span></label>
|
|
<input type="text" name="kind" id="emit-kind" required
|
|
placeholder="e.g. backlog_delegation"
|
|
list="kind-suggestions"
|
|
class="input input-bordered input-sm w-full">
|
|
<datalist id="kind-suggestions">
|
|
<option value="backlog_delegation">
|
|
<option value="cross_ref">
|
|
<option value="alert">
|
|
<option value="review_request">
|
|
<option value="status_update">
|
|
</datalist>
|
|
</div>
|
|
<div class="form-control">
|
|
<label class="label py-1"><span class="label-text text-sm">Actor (optional)</span></label>
|
|
<input type="text" name="source_actor" placeholder="your name or role"
|
|
class="input input-bordered input-sm w-full">
|
|
</div>
|
|
</div>
|
|
<div class="form-control">
|
|
<label class="label py-1"><span class="label-text text-sm">Title</span></label>
|
|
<input type="text" name="title" id="emit-title" required
|
|
placeholder="Short description"
|
|
class="input input-bordered input-sm w-full">
|
|
</div>
|
|
<div class="form-control">
|
|
<label class="label py-1"><span class="label-text text-sm">Payload (JSON, optional)</span></label>
|
|
<textarea name="payload" id="emit-payload" rows="4"
|
|
placeholder='{ "item_id": "TSK-001", "url": "..." }'
|
|
class="textarea textarea-bordered textarea-sm w-full font-mono text-xs"></textarea>
|
|
</div>
|
|
<div class="modal-action mt-2">
|
|
<button type="button" onclick="document.getElementById('emit-modal').close()"
|
|
class="btn btn-sm btn-ghost">Cancel</button>
|
|
<button type="submit" class="btn btn-sm btn-primary">Send</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<form method="dialog" class="modal-backdrop"><button>close</button></form>
|
|
</dialog>
|
|
{% endif %}
|
|
{% endblock content %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
// Pre-fill emit modal from URL params (?kind=...&title=...&payload=...&target=...)
|
|
(function() {
|
|
const p = new URLSearchParams(location.search);
|
|
if (!p.has('kind') && !p.has('title')) return;
|
|
const modal = document.getElementById('emit-modal');
|
|
if (!modal) return;
|
|
['kind','title','payload'].forEach(k => {
|
|
const v = p.get(k);
|
|
const el = document.getElementById('emit-' + k);
|
|
if (v && el) el.value = v;
|
|
});
|
|
const target = p.get('target');
|
|
if (target) {
|
|
const sel = modal.querySelector('select[name=target_slug]');
|
|
if (sel) sel.value = target;
|
|
}
|
|
modal.showModal();
|
|
history.replaceState(null, '', location.pathname);
|
|
})();
|
|
</script>
|
|
{% endblock scripts %}
|