nexus-agentd 0.2.6 → 0.3.1
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 +103 -14
- package/dist/a2a/runtime.d.ts +4 -1
- package/dist/a2a/runtime.js +213 -10
- package/dist/acp/runtime.js +13 -6
- package/dist/artifact-store.d.ts +168 -0
- package/dist/artifact-store.js +1111 -0
- package/dist/cli.js +13 -14
- package/dist/config.js +45 -5
- package/dist/control-plane-validation.d.ts +54 -0
- package/dist/control-plane-validation.js +152 -0
- package/dist/control-plane.d.ts +9 -32
- package/dist/control-plane.js +41 -157
- package/dist/drivers/index.js +12 -0
- package/dist/drivers/pi.js +1 -1
- package/dist/drivers/stdio.d.ts +4 -1
- package/dist/drivers/stdio.js +135 -19
- package/dist/events.d.ts +9 -0
- package/dist/events.js +17 -4
- package/dist/index.js +10 -1
- package/dist/process-tree.js +15 -6
- package/dist/run-store.d.ts +90 -7
- package/dist/run-store.js +254 -22
- package/dist/server/auth-policy.d.ts +27 -0
- package/dist/server/auth-policy.js +143 -0
- package/dist/server/connection.d.ts +8 -0
- package/dist/server/connection.js +67 -0
- package/dist/server/diagnostics.d.ts +40 -0
- package/dist/server/diagnostics.js +130 -0
- package/dist/server/metrics.d.ts +51 -0
- package/dist/server/metrics.js +56 -0
- package/dist/server/quota.d.ts +59 -0
- package/dist/server/quota.js +176 -0
- package/dist/server/validation.d.ts +29 -0
- package/dist/server/validation.js +221 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +737 -419
- package/dist/session/admin-runs.d.ts +73 -0
- package/dist/session/admin-runs.js +298 -0
- package/dist/session/admission.d.ts +32 -0
- package/dist/session/admission.js +62 -0
- package/dist/session/readiness.d.ts +33 -0
- package/dist/session/readiness.js +174 -0
- package/dist/session.d.ts +65 -7
- package/dist/session.js +256 -109
- package/dist/sse-writer.d.ts +7 -0
- package/dist/sse-writer.js +60 -0
- package/dist/types.d.ts +46 -2
- package/dist/types.js +1 -0
- package/dist/webui/app/sources.js +18 -9
- package/dist/webui/icons.d.ts +1 -0
- package/dist/webui/icons.js +1 -0
- package/dist/webui/markup.js +3 -0
- package/dist/webui/styles.js +105 -15
- package/examples/client.mjs +102 -0
- package/nexus-agentd.example.json +19 -0
- package/package.json +3 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** A false write already accepted the chunk. Queue later chunks until drain,
|
|
2
|
+
* with both a byte ceiling and a deadline independent of socket activity. */
|
|
3
|
+
export function createSseWriter(response, close, maxBytes = 512 * 1024, drainMs = 5_000) {
|
|
4
|
+
let stopped = false;
|
|
5
|
+
let blocked = false;
|
|
6
|
+
let queuedBytes = 0;
|
|
7
|
+
const queue = [];
|
|
8
|
+
let deadline;
|
|
9
|
+
const stop = () => {
|
|
10
|
+
if (stopped)
|
|
11
|
+
return;
|
|
12
|
+
stopped = true;
|
|
13
|
+
clearTimeout(deadline);
|
|
14
|
+
response.off('drain', drain);
|
|
15
|
+
queue.length = 0;
|
|
16
|
+
queuedBytes = 0;
|
|
17
|
+
};
|
|
18
|
+
const fail = () => { stop(); close(); };
|
|
19
|
+
const send = (chunk) => {
|
|
20
|
+
try {
|
|
21
|
+
if (!response.write(chunk)) {
|
|
22
|
+
blocked = true;
|
|
23
|
+
deadline = setTimeout(fail, drainMs);
|
|
24
|
+
deadline.unref?.();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
fail();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const drain = () => {
|
|
32
|
+
clearTimeout(deadline);
|
|
33
|
+
blocked = false;
|
|
34
|
+
while (!stopped && !blocked && queue.length) {
|
|
35
|
+
const chunk = queue.shift();
|
|
36
|
+
queuedBytes -= Buffer.byteLength(chunk);
|
|
37
|
+
send(chunk);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
response.on('drain', drain);
|
|
41
|
+
return {
|
|
42
|
+
write(chunk) {
|
|
43
|
+
if (stopped)
|
|
44
|
+
return false;
|
|
45
|
+
const size = Buffer.byteLength(chunk);
|
|
46
|
+
if (response.destroyed || response.writableEnded || size + queuedBytes + response.writableLength > maxBytes) {
|
|
47
|
+
fail();
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (blocked) {
|
|
51
|
+
queue.push(chunk);
|
|
52
|
+
queuedBytes += size;
|
|
53
|
+
}
|
|
54
|
+
else
|
|
55
|
+
send(chunk);
|
|
56
|
+
return !stopped;
|
|
57
|
+
},
|
|
58
|
+
stop
|
|
59
|
+
};
|
|
60
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface AgentdTurnCompletion extends AgentdTurnCompletionProof {
|
|
|
14
14
|
artifactCount: number;
|
|
15
15
|
completedAt: number;
|
|
16
16
|
}
|
|
17
|
-
export declare const agentdDriverKinds: readonly ["opencode", "claude", "codex", "pi", "openclaw", "hermes"];
|
|
17
|
+
export declare const agentdDriverKinds: readonly ["stdio", "opencode", "claude", "codex", "pi", "openclaw", "hermes"];
|
|
18
18
|
export type AgentdDriverKind = (typeof agentdDriverKinds)[number];
|
|
19
19
|
export interface AgentdDriverConfig {
|
|
20
20
|
protocol?: 'acp';
|
|
@@ -25,6 +25,8 @@ export interface AgentdDriverConfig {
|
|
|
25
25
|
workspace?: string;
|
|
26
26
|
command?: string;
|
|
27
27
|
args?: string[];
|
|
28
|
+
/** Arguments used by a command availability probe. */
|
|
29
|
+
probeArgs?: string[];
|
|
28
30
|
inheritEnv?: string[];
|
|
29
31
|
env?: Record<string, string>;
|
|
30
32
|
permissionPolicy?: PermissionPolicy;
|
|
@@ -48,6 +50,10 @@ export interface AgentdA2AConfig {
|
|
|
48
50
|
headerName?: string;
|
|
49
51
|
};
|
|
50
52
|
timeoutMs?: number;
|
|
53
|
+
/** Maximum time allowed for one logical A2A task. Inherits global promptTimeoutMs when omitted. */
|
|
54
|
+
taskTimeoutMs?: number;
|
|
55
|
+
/** Maximum time between bytes/events while reading an A2A stream. Inherits timeoutMs when omitted. */
|
|
56
|
+
streamIdleTimeoutMs?: number;
|
|
51
57
|
}
|
|
52
58
|
export type AgentdAgentConfig = AgentdDriverConfig | AgentdA2AConfig;
|
|
53
59
|
export interface AgentdApiKeyScope {
|
|
@@ -87,6 +93,28 @@ export interface AgentdConfig {
|
|
|
87
93
|
maxConnections?: number;
|
|
88
94
|
adminSessionTtlMs?: number;
|
|
89
95
|
secureAdminCookies?: boolean;
|
|
96
|
+
/** Exact browser origins for named LAN hosts or TLS reverse proxies. */
|
|
97
|
+
publicOrigins?: string[];
|
|
98
|
+
/** Per-client budgets; changes require a restart. */
|
|
99
|
+
quotas?: {
|
|
100
|
+
maxSessionsPerKey: number;
|
|
101
|
+
maxRunningRunsPerKey: number;
|
|
102
|
+
maxSsePerKey: number;
|
|
103
|
+
maxUploadBytesPerKey: number;
|
|
104
|
+
};
|
|
105
|
+
/** Persisted task metadata and output retention; active runs are protected. */
|
|
106
|
+
history?: {
|
|
107
|
+
maxRuns: number;
|
|
108
|
+
retentionDays: number;
|
|
109
|
+
maxBytes: number;
|
|
110
|
+
};
|
|
111
|
+
/** Persisted artifact payload retention and queue limits. */
|
|
112
|
+
artifacts?: {
|
|
113
|
+
retentionDays: number;
|
|
114
|
+
maxBytes: number;
|
|
115
|
+
maxArtifactBytes: number;
|
|
116
|
+
maxQueuedBytes: number;
|
|
117
|
+
};
|
|
90
118
|
agents: Record<string, AgentdAgentConfig>;
|
|
91
119
|
}
|
|
92
120
|
export interface AgentdAgentView {
|
|
@@ -122,6 +150,8 @@ export interface AgentdAgentConfigView {
|
|
|
122
150
|
configured: boolean;
|
|
123
151
|
};
|
|
124
152
|
timeoutMs?: number;
|
|
153
|
+
taskTimeoutMs?: number;
|
|
154
|
+
streamIdleTimeoutMs?: number;
|
|
125
155
|
}
|
|
126
156
|
export interface AgentdControlPlaneView {
|
|
127
157
|
workspaceRoots: string[];
|
|
@@ -235,16 +265,21 @@ export interface AgentdRunArtifactView {
|
|
|
235
265
|
filename?: string;
|
|
236
266
|
mediaType?: string;
|
|
237
267
|
metadata?: Record<string, unknown>;
|
|
268
|
+
size?: number;
|
|
269
|
+
downloadable?: boolean;
|
|
270
|
+
storageStatus?: 'pending' | 'available' | 'metadata_only' | 'expired' | 'evicted' | 'failed';
|
|
271
|
+
createdAt?: number;
|
|
238
272
|
}
|
|
239
273
|
export interface AgentdRunView {
|
|
240
274
|
id: string;
|
|
241
275
|
sessionId: string;
|
|
276
|
+
retryOfRunId?: string;
|
|
242
277
|
agentId: string;
|
|
243
278
|
agentName: string;
|
|
244
279
|
protocol: AgentdProtocol;
|
|
245
280
|
workspace?: string;
|
|
246
281
|
protocolSessionId?: string;
|
|
247
|
-
|
|
282
|
+
taskPreview: string;
|
|
248
283
|
taskTruncated?: boolean;
|
|
249
284
|
state: AgentdSessionState;
|
|
250
285
|
progress: AgentdRunProgress;
|
|
@@ -259,8 +294,17 @@ export interface AgentdRunView {
|
|
|
259
294
|
durationMs?: number;
|
|
260
295
|
}
|
|
261
296
|
export interface AgentdRunDetail extends AgentdRunView {
|
|
297
|
+
task: string;
|
|
262
298
|
output?: string;
|
|
263
299
|
artifacts: AgentdRunArtifactView[];
|
|
300
|
+
controls?: AgentdRunControls;
|
|
301
|
+
}
|
|
302
|
+
export interface AgentdRunControls {
|
|
303
|
+
canCancel: boolean;
|
|
304
|
+
canRetry: boolean;
|
|
305
|
+
canDelete?: boolean;
|
|
306
|
+
pendingRequest?: AgentdPendingRequest;
|
|
307
|
+
unavailableReason?: string;
|
|
264
308
|
}
|
|
265
309
|
export type AgentdEventType = 'session_state' | 'assistant_chunk' | 'thought_chunk' | 'plan' | 'tool_call' | 'tool_update' | 'terminal_output' | 'file_activity' | 'artifact' | 'permission_required' | 'input_required' | 'completed' | 'failed' | 'canceled';
|
|
266
310
|
export interface AgentdEvent {
|