agent-working-memory 0.7.17 → 0.8.5
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/README.md +156 -15
- package/dist/adapters/common.js +202 -202
- package/dist/adapters/http.js +22 -22
- package/dist/api/routes.d.ts +1 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +258 -79
- package/dist/api/routes.js.map +1 -1
- package/dist/cli/migrate.d.ts +42 -0
- package/dist/cli/migrate.d.ts.map +1 -0
- package/dist/cli/migrate.js +268 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli.js +147 -103
- package/dist/cli.js.map +1 -1
- package/dist/coordination/circuit-breaker.d.ts +24 -0
- package/dist/coordination/circuit-breaker.d.ts.map +1 -0
- package/dist/coordination/circuit-breaker.js +70 -0
- package/dist/coordination/circuit-breaker.js.map +1 -0
- package/dist/coordination/failure-modes.d.ts +21 -0
- package/dist/coordination/failure-modes.d.ts.map +1 -0
- package/dist/coordination/failure-modes.js +49 -0
- package/dist/coordination/failure-modes.js.map +1 -0
- package/dist/coordination/peer-decisions.js +7 -7
- package/dist/coordination/routes.d.ts.map +1 -1
- package/dist/coordination/routes.js +44 -1
- package/dist/coordination/routes.js.map +1 -1
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +18 -0
- package/dist/coordination/schema.js.map +1 -1
- package/dist/coordination/schemas.d.ts +9 -9
- package/dist/coordination/stale.d.ts +9 -1
- package/dist/coordination/stale.d.ts.map +1 -1
- package/dist/coordination/stale.js +53 -9
- package/dist/coordination/stale.js.map +1 -1
- package/dist/core/embeddings.d.ts +16 -10
- package/dist/core/embeddings.d.ts.map +1 -1
- package/dist/core/embeddings.js +54 -38
- package/dist/core/embeddings.js.map +1 -1
- package/dist/core/ml-worker-entry.d.ts +17 -0
- package/dist/core/ml-worker-entry.d.ts.map +1 -0
- package/dist/core/ml-worker-entry.js +193 -0
- package/dist/core/ml-worker-entry.js.map +1 -0
- package/dist/core/ml-worker.d.ts +59 -0
- package/dist/core/ml-worker.d.ts.map +1 -0
- package/dist/core/ml-worker.js +253 -0
- package/dist/core/ml-worker.js.map +1 -0
- package/dist/core/query-expander.d.ts +13 -15
- package/dist/core/query-expander.d.ts.map +1 -1
- package/dist/core/query-expander.js +48 -54
- package/dist/core/query-expander.js.map +1 -1
- package/dist/core/reranker.d.ts +9 -19
- package/dist/core/reranker.d.ts.map +1 -1
- package/dist/core/reranker.js +33 -35
- package/dist/core/reranker.js.map +1 -1
- package/dist/core/salience.d.ts +32 -5
- package/dist/core/salience.d.ts.map +1 -1
- package/dist/core/salience.js +201 -28
- package/dist/core/salience.js.map +1 -1
- package/dist/core/write-pipeline.d.ts +10 -2
- package/dist/core/write-pipeline.d.ts.map +1 -1
- package/dist/core/write-pipeline.js +218 -49
- package/dist/core/write-pipeline.js.map +1 -1
- package/dist/engine/activation.d.ts +2 -2
- package/dist/engine/activation.d.ts.map +1 -1
- package/dist/engine/activation.js +238 -115
- package/dist/engine/activation.js.map +1 -1
- package/dist/engine/confidence.d.ts +62 -0
- package/dist/engine/confidence.d.ts.map +1 -0
- package/dist/engine/confidence.js +100 -0
- package/dist/engine/confidence.js.map +1 -0
- package/dist/engine/connections.d.ts +47 -8
- package/dist/engine/connections.d.ts.map +1 -1
- package/dist/engine/connections.js +83 -22
- package/dist/engine/connections.js.map +1 -1
- package/dist/engine/consolidation-scheduler.d.ts +46 -10
- package/dist/engine/consolidation-scheduler.d.ts.map +1 -1
- package/dist/engine/consolidation-scheduler.js +170 -50
- package/dist/engine/consolidation-scheduler.js.map +1 -1
- package/dist/engine/consolidation.d.ts +16 -2
- package/dist/engine/consolidation.d.ts.map +1 -1
- package/dist/engine/consolidation.js +143 -44
- package/dist/engine/consolidation.js.map +1 -1
- package/dist/engine/eval.d.ts +2 -2
- package/dist/engine/eval.d.ts.map +1 -1
- package/dist/engine/eval.js +9 -9
- package/dist/engine/eval.js.map +1 -1
- package/dist/engine/eviction.d.ts +4 -4
- package/dist/engine/eviction.d.ts.map +1 -1
- package/dist/engine/eviction.js +15 -15
- package/dist/engine/eviction.js.map +1 -1
- package/dist/engine/retraction.d.ts +93 -5
- package/dist/engine/retraction.d.ts.map +1 -1
- package/dist/engine/retraction.js +238 -19
- package/dist/engine/retraction.js.map +1 -1
- package/dist/engine/staging.d.ts +1 -1
- package/dist/engine/staging.d.ts.map +1 -1
- package/dist/engine/staging.js +3 -3
- package/dist/engine/staging.js.map +1 -1
- package/dist/hooks/sidecar.d.ts +1 -1
- package/dist/hooks/sidecar.d.ts.map +1 -1
- package/dist/hooks/sidecar.js +4 -4
- package/dist/hooks/sidecar.js.map +1 -1
- package/dist/index.js +48 -31
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +167 -141
- package/dist/mcp.js.map +1 -1
- package/dist/storage/factory.d.ts +55 -0
- package/dist/storage/factory.d.ts.map +1 -0
- package/dist/storage/factory.js +135 -0
- package/dist/storage/factory.js.map +1 -0
- package/dist/storage/pglite-schema.d.ts +20 -0
- package/dist/storage/pglite-schema.d.ts.map +1 -0
- package/dist/storage/pglite-schema.js +165 -0
- package/dist/storage/pglite-schema.js.map +1 -0
- package/dist/storage/pglite.d.ts +187 -0
- package/dist/storage/pglite.d.ts.map +1 -0
- package/dist/storage/pglite.js +1114 -0
- package/dist/storage/pglite.js.map +1 -0
- package/dist/storage/sqlite.d.ts +117 -0
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +357 -8
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/storage/store.d.ts +63 -0
- package/dist/storage/store.d.ts.map +1 -0
- package/dist/storage/store.js +27 -0
- package/dist/storage/store.js.map +1 -0
- package/dist/types/engram.d.ts +92 -2
- package/dist/types/engram.d.ts.map +1 -1
- package/dist/types/engram.js.map +1 -1
- package/package.json +3 -1
- package/src/adapters/claude-code.ts +218 -218
- package/src/adapters/codex.ts +252 -252
- package/src/adapters/common.ts +411 -411
- package/src/adapters/cursor.ts +135 -135
- package/src/adapters/http.ts +93 -93
- package/src/adapters/index.ts +31 -31
- package/src/adapters/types.ts +75 -75
- package/src/api/index.ts +3 -3
- package/src/api/routes.ts +970 -714
- package/src/cli/migrate.ts +307 -0
- package/src/cli.ts +755 -719
- package/src/coordination/circuit-breaker.ts +83 -0
- package/src/coordination/events.ts +90 -90
- package/src/coordination/failure-modes.ts +50 -0
- package/src/coordination/peer-decisions.ts +105 -105
- package/src/coordination/plugin-loader.ts +60 -60
- package/src/coordination/plugin.ts +44 -44
- package/src/coordination/routes.ts +56 -1
- package/src/coordination/schema.ts +13 -0
- package/src/coordination/stale.ts +80 -11
- package/src/coordination/types.ts +311 -311
- package/src/coordination/write-mutex.ts +69 -69
- package/src/core/auto-tagger.ts +168 -168
- package/src/core/decay.ts +63 -63
- package/src/core/embeddings.ts +110 -93
- package/src/core/index.ts +5 -5
- package/src/core/logger.ts +36 -36
- package/src/core/ml-worker-entry.ts +194 -0
- package/src/core/ml-worker.ts +281 -0
- package/src/core/query-expander.ts +122 -128
- package/src/core/reranker.ts +119 -125
- package/src/core/salience.ts +200 -33
- package/src/core/write-pipeline.ts +521 -343
- package/src/engine/activation.ts +235 -109
- package/src/engine/confidence.ts +120 -0
- package/src/engine/connections.ts +162 -103
- package/src/engine/consolidation-scheduler.ts +242 -125
- package/src/engine/consolidation.ts +138 -45
- package/src/engine/eval.ts +102 -102
- package/src/engine/eviction.ts +101 -101
- package/src/engine/index.ts +8 -8
- package/src/engine/retraction.ts +366 -116
- package/src/engine/staging.ts +74 -74
- package/src/hooks/sidecar.ts +5 -5
- package/src/index.ts +226 -212
- package/src/mcp.ts +1145 -1121
- package/src/storage/factory.ts +147 -0
- package/src/storage/index.ts +3 -3
- package/src/storage/pglite-schema.ts +166 -0
- package/src/storage/pglite.ts +1363 -0
- package/src/storage/sqlite.ts +402 -7
- package/src/storage/store.ts +80 -0
- package/src/types/agent.ts +67 -67
- package/src/types/checkpoint.ts +46 -46
- package/src/types/engram.ts +101 -3
- package/src/types/eval.ts +100 -100
- package/src/types/index.ts +6 -6
|
@@ -1,311 +1,311 @@
|
|
|
1
|
-
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* TypeScript interfaces for coordination API responses.
|
|
5
|
-
* These types support typed API clients consuming the coordination HTTP endpoints.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// ─── Shared Primitives ─────────────────────────────────────────
|
|
9
|
-
|
|
10
|
-
export type AgentRole = 'worker' | 'orchestrator' | 'coordinator' | 'dev-lead';
|
|
11
|
-
export type AgentStatus = 'idle' | 'working' | 'dead';
|
|
12
|
-
export type AssignmentStatus = 'pending' | 'assigned' | 'in_progress' | 'completed' | 'failed' | 'blocked';
|
|
13
|
-
export type CommandType = 'BUILD_FREEZE' | 'PAUSE' | 'RESUME' | 'SHUTDOWN';
|
|
14
|
-
export type FindingSeverity = 'critical' | 'error' | 'warn' | 'info';
|
|
15
|
-
export type FindingStatus = 'open' | 'resolved';
|
|
16
|
-
|
|
17
|
-
// ─── Agent ─────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
export interface CheckinResponse {
|
|
20
|
-
agentId: string;
|
|
21
|
-
action: 'registered' | 'heartbeat' | 'reconnected';
|
|
22
|
-
status: string;
|
|
23
|
-
workspace: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface AgentDetail {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
role: AgentRole;
|
|
30
|
-
status: AgentStatus;
|
|
31
|
-
current_task: string | null;
|
|
32
|
-
pid: number | null;
|
|
33
|
-
capabilities: string | null;
|
|
34
|
-
workspace: string | null;
|
|
35
|
-
metadata: string | null;
|
|
36
|
-
last_seen: string;
|
|
37
|
-
started_at: string | null;
|
|
38
|
-
seconds_since_seen: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface AgentResponse {
|
|
42
|
-
agent: AgentDetail;
|
|
43
|
-
assignment: AssignmentSummary | null;
|
|
44
|
-
locks: LockEntry[];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ─── Assignments ───────────────────────────────────────────────
|
|
48
|
-
|
|
49
|
-
export interface Assignment {
|
|
50
|
-
id: string;
|
|
51
|
-
agent_id: string | null;
|
|
52
|
-
task: string;
|
|
53
|
-
description: string | null;
|
|
54
|
-
status: AssignmentStatus;
|
|
55
|
-
priority: number;
|
|
56
|
-
blocked_by: string | null;
|
|
57
|
-
created_at: string;
|
|
58
|
-
started_at: string | null;
|
|
59
|
-
completed_at: string | null;
|
|
60
|
-
result: string | null;
|
|
61
|
-
commit_sha: string | null;
|
|
62
|
-
workspace: string | null;
|
|
63
|
-
context: string | null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface AssignmentSummary {
|
|
67
|
-
id: string;
|
|
68
|
-
task: string;
|
|
69
|
-
status: AssignmentStatus;
|
|
70
|
-
priority: number;
|
|
71
|
-
created_at: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface AssignmentWithAgent extends Assignment {
|
|
75
|
-
agent_name: string | null;
|
|
76
|
-
is_blocked: 0 | 1;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface AssignCreateResponse {
|
|
80
|
-
assignmentId: string;
|
|
81
|
-
status: 'assigned' | 'pending';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface AssignmentsListResponse {
|
|
85
|
-
assignments: AssignmentWithAgent[];
|
|
86
|
-
total: number;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ─── Next ──────────────────────────────────────────────────────
|
|
90
|
-
|
|
91
|
-
export interface CommandEntry {
|
|
92
|
-
id: number;
|
|
93
|
-
command: CommandType;
|
|
94
|
-
reason: string | null;
|
|
95
|
-
issued_by: string | null;
|
|
96
|
-
issued_at: string;
|
|
97
|
-
workspace: string | null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface NextResponse {
|
|
101
|
-
agentId: string;
|
|
102
|
-
status: string;
|
|
103
|
-
assignment: Assignment | null;
|
|
104
|
-
commands: CommandEntry[];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ─── Locks ─────────────────────────────────────────────────────
|
|
108
|
-
|
|
109
|
-
export interface LockEntry {
|
|
110
|
-
file_path: string;
|
|
111
|
-
locked_at: string;
|
|
112
|
-
reason: string | null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface LockWithAgent extends LockEntry {
|
|
116
|
-
agent_id: string;
|
|
117
|
-
agent_name: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface LocksResponse {
|
|
121
|
-
locks: LockWithAgent[];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// ─── Commands ──────────────────────────────────────────────────
|
|
125
|
-
|
|
126
|
-
export interface CommandResponse {
|
|
127
|
-
active: boolean;
|
|
128
|
-
command?: CommandType;
|
|
129
|
-
reason?: string | null;
|
|
130
|
-
issued_at?: string;
|
|
131
|
-
commands: CommandEntry[];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// ─── Workers ───────────────────────────────────────────────────
|
|
135
|
-
|
|
136
|
-
export interface WorkerEntry {
|
|
137
|
-
id: string;
|
|
138
|
-
name: string;
|
|
139
|
-
role: AgentRole;
|
|
140
|
-
status: AgentStatus;
|
|
141
|
-
currentTask: string | null;
|
|
142
|
-
capabilities: string[];
|
|
143
|
-
workspace: string | null;
|
|
144
|
-
lastSeen: string;
|
|
145
|
-
secondsSinceSeen: number;
|
|
146
|
-
alive: boolean;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface WorkersResponse {
|
|
150
|
-
count: number;
|
|
151
|
-
idle: number;
|
|
152
|
-
working: number;
|
|
153
|
-
workers: WorkerEntry[];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// ─── Events ────────────────────────────────────────────────────
|
|
157
|
-
|
|
158
|
-
export interface EventEntry {
|
|
159
|
-
id: number;
|
|
160
|
-
agent_id: string | null;
|
|
161
|
-
agent_name: string | null;
|
|
162
|
-
event_type: string;
|
|
163
|
-
detail: string | null;
|
|
164
|
-
created_at: string;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface EventsResponse {
|
|
168
|
-
events: EventEntry[];
|
|
169
|
-
last_id: number;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// ─── Decisions ─────────────────────────────────────────────────
|
|
173
|
-
|
|
174
|
-
export interface DecisionEntry {
|
|
175
|
-
id: number;
|
|
176
|
-
author_id: string;
|
|
177
|
-
author_name: string;
|
|
178
|
-
assignment_id: string | null;
|
|
179
|
-
tags: string | null;
|
|
180
|
-
summary: string;
|
|
181
|
-
created_at: string;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export interface DecisionsResponse {
|
|
185
|
-
decisions: DecisionEntry[];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// ─── Findings ──────────────────────────────────────────────────
|
|
189
|
-
|
|
190
|
-
export interface FindingEntry {
|
|
191
|
-
id: number;
|
|
192
|
-
category: string;
|
|
193
|
-
severity: FindingSeverity;
|
|
194
|
-
file_path: string | null;
|
|
195
|
-
line_number: number | null;
|
|
196
|
-
description: string;
|
|
197
|
-
suggestion: string | null;
|
|
198
|
-
status: FindingStatus;
|
|
199
|
-
created_at: string;
|
|
200
|
-
agent_name: string;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface FindingSeverityCount {
|
|
204
|
-
severity: FindingSeverity;
|
|
205
|
-
count: number;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export interface FindingsResponse {
|
|
209
|
-
findings: FindingEntry[];
|
|
210
|
-
stats: FindingSeverityCount[];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// ─── Channel Sessions ─────────────────────────────────────────
|
|
214
|
-
|
|
215
|
-
export interface ChannelSession {
|
|
216
|
-
agent_id: string;
|
|
217
|
-
agent_name: string;
|
|
218
|
-
channel_id: string;
|
|
219
|
-
connected_at: string;
|
|
220
|
-
last_push_at: string | null;
|
|
221
|
-
push_count: number;
|
|
222
|
-
status: string;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export interface ChannelSessionsResponse {
|
|
226
|
-
sessions: ChannelSession[];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// ─── Status ────────────────────────────────────────────────────
|
|
230
|
-
|
|
231
|
-
export interface StatusResponse {
|
|
232
|
-
agents: Array<{
|
|
233
|
-
id: string;
|
|
234
|
-
name: string;
|
|
235
|
-
role: AgentRole;
|
|
236
|
-
status: AgentStatus;
|
|
237
|
-
current_task: string | null;
|
|
238
|
-
last_seen: string;
|
|
239
|
-
seconds_since_seen: number;
|
|
240
|
-
}>;
|
|
241
|
-
assignments: Array<{
|
|
242
|
-
id: string;
|
|
243
|
-
task: string;
|
|
244
|
-
description: string | null;
|
|
245
|
-
status: AssignmentStatus;
|
|
246
|
-
agent_id: string | null;
|
|
247
|
-
agent_name: string | null;
|
|
248
|
-
created_at: string;
|
|
249
|
-
started_at: string | null;
|
|
250
|
-
completed_at: string | null;
|
|
251
|
-
}>;
|
|
252
|
-
locks: LockWithAgent[];
|
|
253
|
-
stats: {
|
|
254
|
-
alive_agents: number;
|
|
255
|
-
busy_agents: number;
|
|
256
|
-
pending_tasks: number;
|
|
257
|
-
active_tasks: number;
|
|
258
|
-
active_locks: number;
|
|
259
|
-
open_findings: number;
|
|
260
|
-
urgent_findings: number;
|
|
261
|
-
};
|
|
262
|
-
recentFindings: Array<{
|
|
263
|
-
id: number;
|
|
264
|
-
category: string;
|
|
265
|
-
severity: FindingSeverity;
|
|
266
|
-
file_path: string | null;
|
|
267
|
-
description: string;
|
|
268
|
-
agent_name: string;
|
|
269
|
-
created_at: string;
|
|
270
|
-
}>;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// ─── Stats ─────────────────────────────────────────────────────
|
|
274
|
-
|
|
275
|
-
export interface StatsResponse {
|
|
276
|
-
workers: {
|
|
277
|
-
total: number;
|
|
278
|
-
alive: number;
|
|
279
|
-
idle: number;
|
|
280
|
-
working: number;
|
|
281
|
-
};
|
|
282
|
-
tasks: {
|
|
283
|
-
total_assigned: number;
|
|
284
|
-
completed: number;
|
|
285
|
-
failed: number;
|
|
286
|
-
pending: number;
|
|
287
|
-
avg_completion_seconds: number | null;
|
|
288
|
-
};
|
|
289
|
-
decisions: {
|
|
290
|
-
total: number;
|
|
291
|
-
last_hour: number;
|
|
292
|
-
};
|
|
293
|
-
uptime_seconds: number;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// ─── Stale ─────────────────────────────────────────────────────
|
|
297
|
-
|
|
298
|
-
export interface StaleAgent {
|
|
299
|
-
id: string;
|
|
300
|
-
name: string;
|
|
301
|
-
role: string;
|
|
302
|
-
status: string;
|
|
303
|
-
last_seen: string;
|
|
304
|
-
seconds_since_seen: number;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export interface StaleResponse {
|
|
308
|
-
stale: StaleAgent[];
|
|
309
|
-
threshold_seconds: number;
|
|
310
|
-
cleaned?: number;
|
|
311
|
-
}
|
|
1
|
+
// Copyright 2026 Robert Winter / Complete Ideas
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript interfaces for coordination API responses.
|
|
5
|
+
* These types support typed API clients consuming the coordination HTTP endpoints.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ─── Shared Primitives ─────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export type AgentRole = 'worker' | 'orchestrator' | 'coordinator' | 'dev-lead';
|
|
11
|
+
export type AgentStatus = 'idle' | 'working' | 'dead';
|
|
12
|
+
export type AssignmentStatus = 'pending' | 'assigned' | 'in_progress' | 'completed' | 'failed' | 'blocked';
|
|
13
|
+
export type CommandType = 'BUILD_FREEZE' | 'PAUSE' | 'RESUME' | 'SHUTDOWN';
|
|
14
|
+
export type FindingSeverity = 'critical' | 'error' | 'warn' | 'info';
|
|
15
|
+
export type FindingStatus = 'open' | 'resolved';
|
|
16
|
+
|
|
17
|
+
// ─── Agent ─────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
export interface CheckinResponse {
|
|
20
|
+
agentId: string;
|
|
21
|
+
action: 'registered' | 'heartbeat' | 'reconnected';
|
|
22
|
+
status: string;
|
|
23
|
+
workspace: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface AgentDetail {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
role: AgentRole;
|
|
30
|
+
status: AgentStatus;
|
|
31
|
+
current_task: string | null;
|
|
32
|
+
pid: number | null;
|
|
33
|
+
capabilities: string | null;
|
|
34
|
+
workspace: string | null;
|
|
35
|
+
metadata: string | null;
|
|
36
|
+
last_seen: string;
|
|
37
|
+
started_at: string | null;
|
|
38
|
+
seconds_since_seen: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface AgentResponse {
|
|
42
|
+
agent: AgentDetail;
|
|
43
|
+
assignment: AssignmentSummary | null;
|
|
44
|
+
locks: LockEntry[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ─── Assignments ───────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
export interface Assignment {
|
|
50
|
+
id: string;
|
|
51
|
+
agent_id: string | null;
|
|
52
|
+
task: string;
|
|
53
|
+
description: string | null;
|
|
54
|
+
status: AssignmentStatus;
|
|
55
|
+
priority: number;
|
|
56
|
+
blocked_by: string | null;
|
|
57
|
+
created_at: string;
|
|
58
|
+
started_at: string | null;
|
|
59
|
+
completed_at: string | null;
|
|
60
|
+
result: string | null;
|
|
61
|
+
commit_sha: string | null;
|
|
62
|
+
workspace: string | null;
|
|
63
|
+
context: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface AssignmentSummary {
|
|
67
|
+
id: string;
|
|
68
|
+
task: string;
|
|
69
|
+
status: AssignmentStatus;
|
|
70
|
+
priority: number;
|
|
71
|
+
created_at: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface AssignmentWithAgent extends Assignment {
|
|
75
|
+
agent_name: string | null;
|
|
76
|
+
is_blocked: 0 | 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface AssignCreateResponse {
|
|
80
|
+
assignmentId: string;
|
|
81
|
+
status: 'assigned' | 'pending';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface AssignmentsListResponse {
|
|
85
|
+
assignments: AssignmentWithAgent[];
|
|
86
|
+
total: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ─── Next ──────────────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
export interface CommandEntry {
|
|
92
|
+
id: number;
|
|
93
|
+
command: CommandType;
|
|
94
|
+
reason: string | null;
|
|
95
|
+
issued_by: string | null;
|
|
96
|
+
issued_at: string;
|
|
97
|
+
workspace: string | null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface NextResponse {
|
|
101
|
+
agentId: string;
|
|
102
|
+
status: string;
|
|
103
|
+
assignment: Assignment | null;
|
|
104
|
+
commands: CommandEntry[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ─── Locks ─────────────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
export interface LockEntry {
|
|
110
|
+
file_path: string;
|
|
111
|
+
locked_at: string;
|
|
112
|
+
reason: string | null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface LockWithAgent extends LockEntry {
|
|
116
|
+
agent_id: string;
|
|
117
|
+
agent_name: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface LocksResponse {
|
|
121
|
+
locks: LockWithAgent[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ─── Commands ──────────────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
export interface CommandResponse {
|
|
127
|
+
active: boolean;
|
|
128
|
+
command?: CommandType;
|
|
129
|
+
reason?: string | null;
|
|
130
|
+
issued_at?: string;
|
|
131
|
+
commands: CommandEntry[];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ─── Workers ───────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
export interface WorkerEntry {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
role: AgentRole;
|
|
140
|
+
status: AgentStatus;
|
|
141
|
+
currentTask: string | null;
|
|
142
|
+
capabilities: string[];
|
|
143
|
+
workspace: string | null;
|
|
144
|
+
lastSeen: string;
|
|
145
|
+
secondsSinceSeen: number;
|
|
146
|
+
alive: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface WorkersResponse {
|
|
150
|
+
count: number;
|
|
151
|
+
idle: number;
|
|
152
|
+
working: number;
|
|
153
|
+
workers: WorkerEntry[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ─── Events ────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
export interface EventEntry {
|
|
159
|
+
id: number;
|
|
160
|
+
agent_id: string | null;
|
|
161
|
+
agent_name: string | null;
|
|
162
|
+
event_type: string;
|
|
163
|
+
detail: string | null;
|
|
164
|
+
created_at: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface EventsResponse {
|
|
168
|
+
events: EventEntry[];
|
|
169
|
+
last_id: number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ─── Decisions ─────────────────────────────────────────────────
|
|
173
|
+
|
|
174
|
+
export interface DecisionEntry {
|
|
175
|
+
id: number;
|
|
176
|
+
author_id: string;
|
|
177
|
+
author_name: string;
|
|
178
|
+
assignment_id: string | null;
|
|
179
|
+
tags: string | null;
|
|
180
|
+
summary: string;
|
|
181
|
+
created_at: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface DecisionsResponse {
|
|
185
|
+
decisions: DecisionEntry[];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ─── Findings ──────────────────────────────────────────────────
|
|
189
|
+
|
|
190
|
+
export interface FindingEntry {
|
|
191
|
+
id: number;
|
|
192
|
+
category: string;
|
|
193
|
+
severity: FindingSeverity;
|
|
194
|
+
file_path: string | null;
|
|
195
|
+
line_number: number | null;
|
|
196
|
+
description: string;
|
|
197
|
+
suggestion: string | null;
|
|
198
|
+
status: FindingStatus;
|
|
199
|
+
created_at: string;
|
|
200
|
+
agent_name: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface FindingSeverityCount {
|
|
204
|
+
severity: FindingSeverity;
|
|
205
|
+
count: number;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface FindingsResponse {
|
|
209
|
+
findings: FindingEntry[];
|
|
210
|
+
stats: FindingSeverityCount[];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ─── Channel Sessions ─────────────────────────────────────────
|
|
214
|
+
|
|
215
|
+
export interface ChannelSession {
|
|
216
|
+
agent_id: string;
|
|
217
|
+
agent_name: string;
|
|
218
|
+
channel_id: string;
|
|
219
|
+
connected_at: string;
|
|
220
|
+
last_push_at: string | null;
|
|
221
|
+
push_count: number;
|
|
222
|
+
status: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface ChannelSessionsResponse {
|
|
226
|
+
sessions: ChannelSession[];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ─── Status ────────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
export interface StatusResponse {
|
|
232
|
+
agents: Array<{
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
role: AgentRole;
|
|
236
|
+
status: AgentStatus;
|
|
237
|
+
current_task: string | null;
|
|
238
|
+
last_seen: string;
|
|
239
|
+
seconds_since_seen: number;
|
|
240
|
+
}>;
|
|
241
|
+
assignments: Array<{
|
|
242
|
+
id: string;
|
|
243
|
+
task: string;
|
|
244
|
+
description: string | null;
|
|
245
|
+
status: AssignmentStatus;
|
|
246
|
+
agent_id: string | null;
|
|
247
|
+
agent_name: string | null;
|
|
248
|
+
created_at: string;
|
|
249
|
+
started_at: string | null;
|
|
250
|
+
completed_at: string | null;
|
|
251
|
+
}>;
|
|
252
|
+
locks: LockWithAgent[];
|
|
253
|
+
stats: {
|
|
254
|
+
alive_agents: number;
|
|
255
|
+
busy_agents: number;
|
|
256
|
+
pending_tasks: number;
|
|
257
|
+
active_tasks: number;
|
|
258
|
+
active_locks: number;
|
|
259
|
+
open_findings: number;
|
|
260
|
+
urgent_findings: number;
|
|
261
|
+
};
|
|
262
|
+
recentFindings: Array<{
|
|
263
|
+
id: number;
|
|
264
|
+
category: string;
|
|
265
|
+
severity: FindingSeverity;
|
|
266
|
+
file_path: string | null;
|
|
267
|
+
description: string;
|
|
268
|
+
agent_name: string;
|
|
269
|
+
created_at: string;
|
|
270
|
+
}>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// ─── Stats ─────────────────────────────────────────────────────
|
|
274
|
+
|
|
275
|
+
export interface StatsResponse {
|
|
276
|
+
workers: {
|
|
277
|
+
total: number;
|
|
278
|
+
alive: number;
|
|
279
|
+
idle: number;
|
|
280
|
+
working: number;
|
|
281
|
+
};
|
|
282
|
+
tasks: {
|
|
283
|
+
total_assigned: number;
|
|
284
|
+
completed: number;
|
|
285
|
+
failed: number;
|
|
286
|
+
pending: number;
|
|
287
|
+
avg_completion_seconds: number | null;
|
|
288
|
+
};
|
|
289
|
+
decisions: {
|
|
290
|
+
total: number;
|
|
291
|
+
last_hour: number;
|
|
292
|
+
};
|
|
293
|
+
uptime_seconds: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ─── Stale ─────────────────────────────────────────────────────
|
|
297
|
+
|
|
298
|
+
export interface StaleAgent {
|
|
299
|
+
id: string;
|
|
300
|
+
name: string;
|
|
301
|
+
role: string;
|
|
302
|
+
status: string;
|
|
303
|
+
last_seen: string;
|
|
304
|
+
seconds_since_seen: number;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface StaleResponse {
|
|
308
|
+
stale: StaleAgent[];
|
|
309
|
+
threshold_seconds: number;
|
|
310
|
+
cleaned?: number;
|
|
311
|
+
}
|