agentxchain 2.72.0 → 2.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/app.js +2 -1
- package/dashboard/components/hooks.js +95 -42
- package/package.json +1 -1
package/dashboard/app.js
CHANGED
|
@@ -21,7 +21,7 @@ import { render as renderCoordinatorTimeouts } from './components/coordinator-ti
|
|
|
21
21
|
const VIEWS = {
|
|
22
22
|
timeline: { fetch: ['state', 'continuity', 'history', 'audit', 'annotations', 'connectors'], render: renderTimeline },
|
|
23
23
|
ledger: { fetch: ['state', 'ledger', 'coordinatorState', 'coordinatorLedger'], render: renderLedger },
|
|
24
|
-
hooks: { fetch: ['audit', 'annotations'], render: renderHooks },
|
|
24
|
+
hooks: { fetch: ['audit', 'annotations', 'coordinatorAudit', 'coordinatorAnnotations'], render: renderHooks },
|
|
25
25
|
blocked: { fetch: ['state', 'audit', 'coordinatorState', 'coordinatorAudit'], render: renderBlocked },
|
|
26
26
|
gate: { fetch: ['state', 'history', 'coordinatorState', 'coordinatorHistory', 'coordinatorBarriers'], render: renderGate },
|
|
27
27
|
initiative: { fetch: ['coordinatorState', 'coordinatorBarriers', 'barrierLedger', 'coordinatorBlockers'], render: renderInitiative },
|
|
@@ -46,6 +46,7 @@ const API_MAP = {
|
|
|
46
46
|
coordinatorBarriers: '/api/coordinator/barriers',
|
|
47
47
|
barrierLedger: '/api/coordinator/barrier-ledger',
|
|
48
48
|
coordinatorAudit: '/api/coordinator/hooks/audit',
|
|
49
|
+
coordinatorAnnotations: '/api/coordinator/hooks/annotations',
|
|
49
50
|
coordinatorBlockers: '/api/coordinator/blockers',
|
|
50
51
|
workflowKitArtifacts: '/api/workflow-kit-artifacts',
|
|
51
52
|
connectors: '/api/connectors',
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Hook Audit view — renders hook-audit.jsonl entries.
|
|
3
3
|
*
|
|
4
4
|
* Pure render function: takes data, returns HTML string. Testable in Node.js.
|
|
5
|
+
* Supports both repo-local and coordinator hook audit/annotation data.
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
function esc(str) {
|
|
@@ -90,26 +91,82 @@ function collectHookNames(audit) {
|
|
|
90
91
|
return Array.from(unique).sort();
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
function renderAuditTable(entries, filter) {
|
|
95
|
+
const filtered = filterAudit(entries, filter);
|
|
96
|
+
let html = `<p class="section-subtitle">${filtered.length} of ${entries.length} hook execution${entries.length !== 1 ? 's' : ''}</p>
|
|
97
|
+
<table class="data-table">
|
|
98
|
+
<thead><tr><th>Time</th><th>Phase</th><th>Hook</th><th>Verdict</th><th>Action</th><th>Duration</th></tr></thead>
|
|
99
|
+
<tbody>`;
|
|
100
|
+
|
|
101
|
+
for (const entry of filtered) {
|
|
102
|
+
const duration = entry.duration_ms != null ? `${entry.duration_ms}ms` : '-';
|
|
103
|
+
const action = entry.orchestrator_action || entry.action || 'continued';
|
|
104
|
+
html += `<tr>
|
|
105
|
+
<td class="mono">${esc(entry.timestamp || '-')}</td>
|
|
106
|
+
<td class="mono">${esc(getHookPhase(entry))}</td>
|
|
107
|
+
<td>${esc(getHookName(entry))}</td>
|
|
108
|
+
<td>${verdictBadge(entry.verdict)}</td>
|
|
109
|
+
<td class="mono">${esc(action)}</td>
|
|
110
|
+
<td class="mono">${esc(duration)}</td>
|
|
111
|
+
</tr>`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
html += `</tbody></table>`;
|
|
115
|
+
return html;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function renderAnnotationList(entries) {
|
|
119
|
+
let html = `<p class="section-subtitle">${entries.length} annotation${entries.length !== 1 ? 's' : ''}</p>
|
|
120
|
+
<div class="annotation-list">`;
|
|
121
|
+
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const annotationText = formatAnnotations(entry);
|
|
124
|
+
html += `<div class="annotation-card">
|
|
125
|
+
<span class="mono">${esc(entry.turn_id || '-')}</span>
|
|
126
|
+
<span class="mono">${esc(getHookName(entry))}</span>
|
|
127
|
+
<span>${esc(annotationText || JSON.stringify(entry))}</span>
|
|
128
|
+
</div>`;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
html += `</div>`;
|
|
132
|
+
return html;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function render({
|
|
136
|
+
audit,
|
|
137
|
+
annotations,
|
|
138
|
+
coordinatorAudit = null,
|
|
139
|
+
coordinatorAnnotations = null,
|
|
140
|
+
filter = {},
|
|
141
|
+
}) {
|
|
94
142
|
const hasAudit = Array.isArray(audit) && audit.length > 0;
|
|
95
143
|
const hasAnnotations = Array.isArray(annotations) && annotations.length > 0;
|
|
144
|
+
const hasCoordinatorAudit = Array.isArray(coordinatorAudit) && coordinatorAudit.length > 0;
|
|
145
|
+
const hasCoordinatorAnnotations = Array.isArray(coordinatorAnnotations) && coordinatorAnnotations.length > 0;
|
|
146
|
+
const hasAnyData = hasAudit || hasAnnotations || hasCoordinatorAudit || hasCoordinatorAnnotations;
|
|
147
|
+
const hasCoordinatorData = hasCoordinatorAudit || hasCoordinatorAnnotations;
|
|
96
148
|
|
|
97
|
-
if (!
|
|
149
|
+
if (!hasAnyData) {
|
|
98
150
|
return `<div class="placeholder"><h2>Hook Audit</h2><p>No hook activity recorded.</p></div>`;
|
|
99
151
|
}
|
|
100
152
|
|
|
153
|
+
// Build combined audit for shared filter bar
|
|
154
|
+
const combinedAudit = [
|
|
155
|
+
...(Array.isArray(audit) ? audit : []),
|
|
156
|
+
...(Array.isArray(coordinatorAudit) ? coordinatorAudit : []),
|
|
157
|
+
];
|
|
158
|
+
const phases = collectHookPhases(combinedAudit);
|
|
159
|
+
const hookNames = collectHookNames(combinedAudit);
|
|
160
|
+
const selectedPhase = filter.phase || 'all';
|
|
161
|
+
const selectedVerdict = filter.verdict || 'all';
|
|
162
|
+
const selectedHookName = filter.hookName || 'all';
|
|
163
|
+
|
|
101
164
|
let html = `<div class="hooks-view">`;
|
|
102
165
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const selectedPhase = filter.phase || 'all';
|
|
108
|
-
const selectedVerdict = filter.verdict || 'all';
|
|
109
|
-
const selectedHookName = filter.hookName || 'all';
|
|
110
|
-
|
|
111
|
-
html += `<div class="section"><h3>Hook Audit Log</h3>
|
|
112
|
-
<p class="section-subtitle">${filtered.length} of ${audit.length} hook execution${audit.length !== 1 ? 's' : ''}</p>
|
|
166
|
+
// Shared filter bar (covers both repo-local and coordinator data)
|
|
167
|
+
if (hasAudit || hasCoordinatorAudit) {
|
|
168
|
+
html += `<div class="section"><h3>Hook Audit</h3>
|
|
169
|
+
<p class="section-subtitle">${hasCoordinatorData ? 'Repo-local and coordinator hook audit surfaces' : 'Hook audit surface'}</p>
|
|
113
170
|
<div class="filter-bar">
|
|
114
171
|
<label class="filter-control">
|
|
115
172
|
<span>Phase</span>
|
|
@@ -135,41 +192,37 @@ export function render({ audit, annotations, filter = {} }) {
|
|
|
135
192
|
</select>
|
|
136
193
|
</label>
|
|
137
194
|
</div>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<tbody>`;
|
|
141
|
-
|
|
142
|
-
for (const entry of filtered) {
|
|
143
|
-
const duration = entry.duration_ms != null ? `${entry.duration_ms}ms` : '-';
|
|
144
|
-
const action = entry.orchestrator_action || entry.action || 'continued';
|
|
145
|
-
html += `<tr>
|
|
146
|
-
<td class="mono">${esc(entry.timestamp || '-')}</td>
|
|
147
|
-
<td class="mono">${esc(getHookPhase(entry))}</td>
|
|
148
|
-
<td>${esc(getHookName(entry))}</td>
|
|
149
|
-
<td>${verdictBadge(entry.verdict)}</td>
|
|
150
|
-
<td class="mono">${esc(action)}</td>
|
|
151
|
-
<td class="mono">${esc(duration)}</td>
|
|
152
|
-
</tr>`;
|
|
153
|
-
}
|
|
195
|
+
</div>`;
|
|
196
|
+
}
|
|
154
197
|
|
|
155
|
-
|
|
198
|
+
// Repo-local audit section
|
|
199
|
+
if (hasAudit) {
|
|
200
|
+
const sectionTitle = hasCoordinatorData ? 'Repo Hook Audit Log' : 'Hook Audit Log';
|
|
201
|
+
html += `<div class="section"><h3>${sectionTitle}</h3>`;
|
|
202
|
+
html += renderAuditTable(audit, filter);
|
|
203
|
+
html += `</div>`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Coordinator audit section
|
|
207
|
+
if (hasCoordinatorAudit) {
|
|
208
|
+
html += `<div class="section"><h3>Coordinator Hook Audit Log</h3>`;
|
|
209
|
+
html += renderAuditTable(coordinatorAudit, filter);
|
|
210
|
+
html += `</div>`;
|
|
156
211
|
}
|
|
157
212
|
|
|
213
|
+
// Repo-local annotations section
|
|
158
214
|
if (hasAnnotations) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const annotationText = formatAnnotations(entry);
|
|
165
|
-
html += `<div class="annotation-card">
|
|
166
|
-
<span class="mono">${esc(entry.turn_id || '-')}</span>
|
|
167
|
-
<span class="mono">${esc(getHookName(entry))}</span>
|
|
168
|
-
<span>${esc(annotationText || JSON.stringify(entry))}</span>
|
|
169
|
-
</div>`;
|
|
170
|
-
}
|
|
215
|
+
const sectionTitle = hasCoordinatorData ? 'Repo Hook Annotations' : 'Hook Annotations';
|
|
216
|
+
html += `<div class="section"><h3>${sectionTitle}</h3>`;
|
|
217
|
+
html += renderAnnotationList(annotations);
|
|
218
|
+
html += `</div>`;
|
|
219
|
+
}
|
|
171
220
|
|
|
172
|
-
|
|
221
|
+
// Coordinator annotations section
|
|
222
|
+
if (hasCoordinatorAnnotations) {
|
|
223
|
+
html += `<div class="section"><h3>Coordinator Hook Annotations</h3>`;
|
|
224
|
+
html += renderAnnotationList(coordinatorAnnotations);
|
|
225
|
+
html += `</div>`;
|
|
173
226
|
}
|
|
174
227
|
|
|
175
228
|
html += `</div>`;
|