nexus-agentd 0.2.5 → 0.3.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/README.md +359 -250
- package/dist/a2a/runtime.d.ts +7 -1
- package/dist/a2a/runtime.js +290 -17
- package/dist/acp/runtime.d.ts +5 -1
- package/dist/acp/runtime.js +88 -39
- package/dist/artifact-store.d.ts +162 -0
- package/dist/artifact-store.js +1081 -0
- package/dist/cli.js +13 -14
- package/dist/completion-contract.js +1 -1
- 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 +52 -158
- 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.d.ts +1 -1
- package/dist/index.js +33 -6
- package/dist/process-tree.js +15 -6
- package/dist/run-store.d.ts +57 -7
- package/dist/run-store.js +188 -23
- 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 +682 -418
- package/dist/session/admin-runs.d.ts +73 -0
- package/dist/session/admin-runs.js +297 -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-contract.d.ts +1 -0
- package/dist/session.d.ts +64 -7
- package/dist/session.js +321 -159
- package/dist/sse-writer.d.ts +7 -0
- package/dist/sse-writer.js +60 -0
- package/dist/types.d.ts +44 -2
- package/dist/types.js +1 -0
- package/dist/webui/app/sources.js +18 -10
- package/dist/webui/index.js +11 -11
- package/dist/webui/markup.js +69 -66
- package/dist/webui/styles.js +791 -616
- package/dist/workspace.d.ts +30 -0
- package/dist/workspace.js +67 -2
- package/examples/client.mjs +102 -0
- package/nexus-agentd.example.json +21 -2
- package/package.json +6 -3
package/dist/session.d.ts
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import type { AgentDriver } from './drivers/index.js';
|
|
2
2
|
import { SessionEventLog } from './events.js';
|
|
3
3
|
import { RunStore, type RunListQuery } from './run-store.js';
|
|
4
|
+
import { type AdminRetryReservationFactory, type AdminRunOperationResult, type AdminRunControls } from './session/admin-runs.js';
|
|
4
5
|
import type { AcpSessionSink, AgentSessionRuntime, AgentSessionSink } from './session-contract.js';
|
|
5
6
|
import type { AgentdAgentView, AgentdArtifact, AgentdConfig, AgentdEvent, AgentdEventType, AgentdInputAttachmentView, AgentdPendingRequest, AgentdPendingResponse, AgentdProtocol, AgentdSessionState, AgentdSessionView, AgentdTurnCompletionProof } from './types.js';
|
|
6
|
-
import type
|
|
7
|
+
import { type WorkspacePolicy } from './workspace.js';
|
|
8
|
+
/** Optional durable sink for full artifact snapshots. */
|
|
9
|
+
export interface SessionArtifactStore {
|
|
10
|
+
recordArtifacts(runId: string, artifacts: AgentdArtifact[]): unknown | Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
export type SessionLifecycleEvent = {
|
|
13
|
+
type: 'session_created';
|
|
14
|
+
sessionId: string;
|
|
15
|
+
ownerKeyId: string;
|
|
16
|
+
agentId: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'run_updated';
|
|
19
|
+
sessionId: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
ownerKeyId: string;
|
|
22
|
+
state: AgentdSessionState;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'session_closed';
|
|
25
|
+
sessionId: string;
|
|
26
|
+
ownerKeyId: string;
|
|
27
|
+
agentId: string;
|
|
28
|
+
};
|
|
29
|
+
export type SessionLifecycleListener = (event: SessionLifecycleEvent) => void;
|
|
7
30
|
export declare class ManagedSession implements AgentSessionSink, AcpSessionSink {
|
|
8
31
|
readonly agentId: string;
|
|
9
32
|
readonly protocol: AgentdProtocol;
|
|
@@ -27,8 +50,11 @@ export declare class ManagedSession implements AgentSessionSink, AcpSessionSink
|
|
|
27
50
|
private artifacts;
|
|
28
51
|
private inputAttachments;
|
|
29
52
|
private runtime?;
|
|
30
|
-
|
|
53
|
+
private readonly artifactStore?;
|
|
54
|
+
private readonly onRunUpdate?;
|
|
55
|
+
constructor(agentId: string, protocol: AgentdProtocol, workspace: string | undefined, ownerKeyId: string, maxEvents: number, maxOutputChars: number, agentName: string, runStore?: RunStore | undefined, instanceId?: string, artifactStore?: SessionArtifactStore, onRunUpdate?: (runId: string, state: AgentdSessionState) => void);
|
|
31
56
|
attach(runtime: AgentSessionRuntime): void;
|
|
57
|
+
runtimeAvailable(): boolean;
|
|
32
58
|
setProtocolSessionId(id: string): void;
|
|
33
59
|
setAcpSessionId(id: string): void;
|
|
34
60
|
setState(state: AgentdSessionState, error?: string): void;
|
|
@@ -43,7 +69,7 @@ export declare class ManagedSession implements AgentSessionSink, AcpSessionSink
|
|
|
43
69
|
clearPending(): void;
|
|
44
70
|
emit(type: AgentdEventType, data?: unknown): void;
|
|
45
71
|
addInputAttachment(name: string, mediaType: string | undefined, bytes: Buffer): AgentdInputAttachmentView;
|
|
46
|
-
message(message: string, attachmentIds?: string[]): Promise<void>;
|
|
72
|
+
message(message: string, attachmentIds?: string[], retryOfRunId?: string): Promise<void>;
|
|
47
73
|
resolvePending(response: AgentdPendingResponse, attachmentIds?: string[]): Promise<void>;
|
|
48
74
|
cancel(): Promise<void>;
|
|
49
75
|
dispose(): Promise<void>;
|
|
@@ -62,21 +88,43 @@ export declare class SessionManager {
|
|
|
62
88
|
private sessions;
|
|
63
89
|
private sessionLocks;
|
|
64
90
|
private cleanupTimer?;
|
|
65
|
-
private
|
|
66
|
-
|
|
91
|
+
private readonly readiness;
|
|
92
|
+
private readonly admission;
|
|
93
|
+
private readonly adminRuns;
|
|
94
|
+
private readonly artifactStore?;
|
|
95
|
+
private readonly lifecycleListeners;
|
|
96
|
+
constructor(config: AgentdConfig, workspacePolicy: WorkspacePolicy, drivers: Map<string, AgentDriver>, runStore?: RunStore | undefined, artifactStore?: SessionArtifactStore);
|
|
67
97
|
reconfigure(config: AgentdConfig, workspacePolicy: WorkspacePolicy, drivers: Map<string, AgentDriver>): void;
|
|
68
98
|
startCleanup(): void;
|
|
69
99
|
listAgents(agentIds?: Set<string>, force?: boolean): Promise<AgentdAgentView[]>;
|
|
70
100
|
create(agentId: string, workspaceInput: string | undefined, ownerKeyId: string): Promise<AgentdSessionView>;
|
|
101
|
+
private createReserved;
|
|
71
102
|
get(id: string): AgentdSessionView;
|
|
72
103
|
owns(id: string, keyId: string): boolean;
|
|
73
104
|
count(): number;
|
|
105
|
+
subscribeLifecycle(listener: SessionLifecycleListener): () => boolean;
|
|
74
106
|
listRuns(query?: RunListQuery): {
|
|
75
107
|
runs: import("./types.js").AgentdRunView[];
|
|
76
108
|
total: number;
|
|
109
|
+
stats: {
|
|
110
|
+
active: number;
|
|
111
|
+
completed: number;
|
|
112
|
+
failed: number;
|
|
113
|
+
};
|
|
77
114
|
};
|
|
78
115
|
getRun(id: string): import("./types.js").AgentdRunDetail;
|
|
79
|
-
|
|
116
|
+
getRunOwnerKeyId(id: string): string | undefined;
|
|
117
|
+
ownsRun(id: string, keyId: string): boolean;
|
|
118
|
+
getRunArtifacts(id: string): import("./types.js").AgentdRunArtifactView[];
|
|
119
|
+
getStorageMetrics(): ReturnType<RunStore['metrics']> | undefined;
|
|
120
|
+
readRunArtifact(runId: string, artifactId: string): Promise<import("./artifact-store.js").ArtifactReadResult | undefined>;
|
|
121
|
+
getRunArtifact(runId: string, artifactId: string): Promise<import("./artifact-store.js").ArtifactReadResult | undefined>;
|
|
122
|
+
getRunControls(id: string): AdminRunControls;
|
|
123
|
+
cancelRun(id: string): Promise<AdminRunOperationResult>;
|
|
124
|
+
respondRun(id: string, response: AgentdPendingResponse, attachmentIds?: string[]): Promise<AdminRunOperationResult>;
|
|
125
|
+
retryRun(id: string, reserveRetry?: AdminRetryReservationFactory): Promise<AdminRunOperationResult>;
|
|
126
|
+
retryOfRunId(id: string): string | undefined;
|
|
127
|
+
message(id: string, message: string, attachmentIds?: string[], retryOfRunId?: string): Promise<AgentdSessionView>;
|
|
80
128
|
resolvePending(id: string, response: AgentdPendingResponse, attachmentIds?: string[]): Promise<AgentdSessionView>;
|
|
81
129
|
addInputAttachment(id: string, name: string, mediaType: string | undefined, bytes: Buffer): AgentdInputAttachmentView;
|
|
82
130
|
publishFile(id: string, paths: string[]): Promise<{
|
|
@@ -86,14 +134,23 @@ export declare class SessionManager {
|
|
|
86
134
|
cancel(id: string): Promise<AgentdSessionView>;
|
|
87
135
|
close(id: string): Promise<AgentdSessionView>;
|
|
88
136
|
eventsAfter(id: string, after?: string): AgentdEvent[];
|
|
137
|
+
eventReplay(id: string, after?: string): {
|
|
138
|
+
earliestId: string;
|
|
139
|
+
latestId: string;
|
|
140
|
+
reset: {
|
|
141
|
+
reason: string;
|
|
142
|
+
requestedAfter: string | null;
|
|
143
|
+
} | undefined;
|
|
144
|
+
events: AgentdEvent[];
|
|
145
|
+
};
|
|
89
146
|
subscribe(id: string, listener: (event: AgentdEvent) => void): () => boolean;
|
|
90
147
|
shutdown(): Promise<void>;
|
|
91
148
|
private withSessionLock;
|
|
92
149
|
private require;
|
|
93
|
-
private ensureCapacity;
|
|
94
150
|
private cleanup;
|
|
95
151
|
private restartCleanup;
|
|
96
152
|
private defaultWorkspace;
|
|
153
|
+
private notifyLifecycle;
|
|
97
154
|
}
|
|
98
155
|
export declare class SessionNotFoundError extends Error {
|
|
99
156
|
readonly sessionId: string;
|