nexus-agentd 0.1.0 → 0.1.6
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/LICENSE +22 -0
- package/README.md +351 -179
- package/dist/a2a/runtime.d.ts +30 -0
- package/dist/a2a/runtime.js +374 -0
- package/dist/acp/runtime.d.ts +12 -3
- package/dist/acp/runtime.js +248 -17
- package/dist/artifact-store.d.ts +41 -0
- package/dist/artifact-store.js +340 -0
- package/dist/auth.d.ts +13 -0
- package/dist/auth.js +77 -0
- package/dist/cli.js +58 -1
- package/dist/config.d.ts +10 -0
- package/dist/config.js +281 -53
- package/dist/control-plane.d.ts +91 -0
- package/dist/control-plane.js +629 -0
- package/dist/drivers/hermes.d.ts +2 -0
- package/dist/drivers/hermes.js +10 -0
- package/dist/drivers/index.js +6 -0
- package/dist/events.js +13 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +15 -3
- package/dist/run-store.d.ts +49 -0
- package/dist/run-store.js +291 -0
- package/dist/server.d.ts +3 -2
- package/dist/server.js +911 -41
- package/dist/session-contract.d.ts +16 -4
- package/dist/session.d.ts +74 -8
- package/dist/session.js +433 -38
- package/dist/types.d.ts +193 -6
- package/dist/types.js +2 -1
- package/dist/webui/app.d.ts +1 -0
- package/dist/webui/app.js +1072 -0
- package/dist/webui/icons.d.ts +9 -0
- package/dist/webui/icons.js +10 -0
- package/dist/webui/index.d.ts +3 -0
- package/dist/webui/index.js +32 -0
- package/dist/webui/markup.d.ts +1 -0
- package/dist/webui/markup.js +68 -0
- package/dist/webui/styles.d.ts +1 -0
- package/dist/webui/styles.js +269 -0
- package/dist/workspace-files.d.ts +48 -0
- package/dist/workspace-files.js +269 -0
- package/nexus-agentd.example.json +30 -27
- package/package.json +6 -6
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import type { AgentdEventType, AgentdPendingRequest, AgentdSessionState } from './types.js';
|
|
2
|
-
export interface
|
|
1
|
+
import type { AgentdArtifact, AgentdEventType, AgentdInputAttachment, AgentdPendingRequest, AgentdSessionState } from './types.js';
|
|
2
|
+
export interface AgentSessionSink {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly state: AgentdSessionState;
|
|
5
|
-
readonly
|
|
6
|
-
|
|
5
|
+
readonly protocolSessionId?: string;
|
|
6
|
+
setProtocolSessionId(id: string): void;
|
|
7
7
|
setState(state: AgentdSessionState, error?: string): void;
|
|
8
8
|
appendOutput(text: string): void;
|
|
9
|
+
addArtifact(artifact: AgentdArtifact): void;
|
|
9
10
|
setPending(request: AgentdPendingRequest): void;
|
|
10
11
|
clearPending(): void;
|
|
11
12
|
emit(type: AgentdEventType, data?: unknown): void;
|
|
12
13
|
}
|
|
14
|
+
export interface AcpSessionSink extends AgentSessionSink {
|
|
15
|
+
readonly acpSessionId?: string;
|
|
16
|
+
setAcpSessionId(id: string): void;
|
|
17
|
+
}
|
|
18
|
+
export interface AgentSessionRuntime {
|
|
19
|
+
start(workspace?: string): Promise<void>;
|
|
20
|
+
prompt(message: string, attachments?: AgentdInputAttachment[]): Promise<void>;
|
|
21
|
+
respondPending(message: string, attachments?: AgentdInputAttachment[]): Promise<void>;
|
|
22
|
+
cancel(): Promise<void>;
|
|
23
|
+
dispose(): Promise<void>;
|
|
24
|
+
}
|
package/dist/session.d.ts
CHANGED
|
@@ -1,26 +1,92 @@
|
|
|
1
1
|
import type { AgentDriver } from './drivers/index.js';
|
|
2
|
+
import { SessionEventLog } from './events.js';
|
|
3
|
+
import { RunStore, type RunListQuery } from './run-store.js';
|
|
4
|
+
import type { AcpSessionSink, AgentSessionRuntime, AgentSessionSink } from './session-contract.js';
|
|
5
|
+
import type { AgentdAgentView, AgentdArtifact, AgentdConfig, AgentdEvent, AgentdEventType, AgentdInputAttachmentView, AgentdPendingRequest, AgentdProtocol, AgentdSessionState, AgentdSessionView } from './types.js';
|
|
2
6
|
import type { WorkspacePolicy } from './workspace.js';
|
|
3
|
-
|
|
7
|
+
export declare class ManagedSession implements AgentSessionSink, AcpSessionSink {
|
|
8
|
+
readonly agentId: string;
|
|
9
|
+
readonly protocol: AgentdProtocol;
|
|
10
|
+
readonly workspace: string | undefined;
|
|
11
|
+
readonly ownerKeyId: string;
|
|
12
|
+
private readonly maxOutputChars;
|
|
13
|
+
private readonly agentName;
|
|
14
|
+
private readonly runStore?;
|
|
15
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
16
|
+
readonly createdAt: number;
|
|
17
|
+
readonly events: SessionEventLog;
|
|
18
|
+
state: AgentdSessionState;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
protocolSessionId?: string;
|
|
21
|
+
acpSessionId?: string;
|
|
22
|
+
output: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
pendingRequest?: AgentdPendingRequest;
|
|
25
|
+
private artifacts;
|
|
26
|
+
private inputAttachments;
|
|
27
|
+
private runtime?;
|
|
28
|
+
constructor(agentId: string, protocol: AgentdProtocol, workspace: string | undefined, ownerKeyId: string, maxEvents: number, maxOutputChars: number, agentName: string, runStore?: RunStore | undefined);
|
|
29
|
+
attach(runtime: AgentSessionRuntime): void;
|
|
30
|
+
setProtocolSessionId(id: string): void;
|
|
31
|
+
setAcpSessionId(id: string): void;
|
|
32
|
+
setState(state: AgentdSessionState, error?: string): void;
|
|
33
|
+
appendOutput(text: string): void;
|
|
34
|
+
addArtifact(artifact: AgentdArtifact): void;
|
|
35
|
+
setPending(request: AgentdPendingRequest): void;
|
|
36
|
+
clearPending(): void;
|
|
37
|
+
emit(type: AgentdEventType, data?: unknown): void;
|
|
38
|
+
addInputAttachment(name: string, mediaType: string | undefined, bytes: Buffer): AgentdInputAttachmentView;
|
|
39
|
+
message(message: string, attachmentIds?: string[]): Promise<void>;
|
|
40
|
+
cancel(): Promise<void>;
|
|
41
|
+
dispose(): Promise<void>;
|
|
42
|
+
snapshot(): AgentdSessionView;
|
|
43
|
+
interruptForShutdown(): void;
|
|
44
|
+
private currentRunId?;
|
|
45
|
+
private syncRun;
|
|
46
|
+
private inputAttachmentsFor;
|
|
47
|
+
}
|
|
4
48
|
export declare class SessionManager {
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
49
|
+
private config;
|
|
50
|
+
private workspacePolicy;
|
|
51
|
+
private drivers;
|
|
52
|
+
private readonly runStore?;
|
|
8
53
|
private sessions;
|
|
9
54
|
private cleanupTimer?;
|
|
10
|
-
|
|
55
|
+
private readinessCache?;
|
|
56
|
+
constructor(config: AgentdConfig, workspacePolicy: WorkspacePolicy, drivers: Map<string, AgentDriver>, runStore?: RunStore | undefined);
|
|
57
|
+
reconfigure(config: AgentdConfig, workspacePolicy: WorkspacePolicy, drivers: Map<string, AgentDriver>): void;
|
|
11
58
|
startCleanup(): void;
|
|
12
|
-
listAgents(): Promise<AgentdAgentView[]>;
|
|
13
|
-
create(agentId: string, workspaceInput: string): Promise<AgentdSessionView>;
|
|
59
|
+
listAgents(agentIds?: Set<string>, force?: boolean): Promise<AgentdAgentView[]>;
|
|
60
|
+
create(agentId: string, workspaceInput: string | undefined, ownerKeyId: string): Promise<AgentdSessionView>;
|
|
14
61
|
get(id: string): AgentdSessionView;
|
|
15
|
-
|
|
62
|
+
owns(id: string, keyId: string): boolean;
|
|
63
|
+
count(): number;
|
|
64
|
+
listRuns(query?: RunListQuery): {
|
|
65
|
+
runs: import("./types.js").AgentdRunView[];
|
|
66
|
+
total: number;
|
|
67
|
+
};
|
|
68
|
+
getRun(id: string): import("./types.js").AgentdRunDetail;
|
|
69
|
+
message(id: string, message: string, attachmentIds?: string[]): Promise<AgentdSessionView>;
|
|
70
|
+
addInputAttachment(id: string, name: string, mediaType: string | undefined, bytes: Buffer): AgentdInputAttachmentView;
|
|
16
71
|
cancel(id: string): Promise<AgentdSessionView>;
|
|
17
72
|
eventsAfter(id: string, after?: string): AgentdEvent[];
|
|
18
73
|
subscribe(id: string, listener: (event: AgentdEvent) => void): () => boolean;
|
|
19
74
|
shutdown(): Promise<void>;
|
|
20
75
|
private require;
|
|
76
|
+
private ensureCapacity;
|
|
21
77
|
private cleanup;
|
|
78
|
+
private restartCleanup;
|
|
79
|
+
private defaultWorkspace;
|
|
22
80
|
}
|
|
23
81
|
export declare class SessionNotFoundError extends Error {
|
|
24
82
|
readonly sessionId: string;
|
|
25
83
|
constructor(sessionId: string);
|
|
26
84
|
}
|
|
85
|
+
export declare class SessionRequestError extends Error {
|
|
86
|
+
readonly status: number;
|
|
87
|
+
constructor(status: number, message: string);
|
|
88
|
+
}
|
|
89
|
+
export declare class RunNotFoundError extends Error {
|
|
90
|
+
readonly runId: string;
|
|
91
|
+
constructor(runId: string);
|
|
92
|
+
}
|