neoctl 0.2.2 → 0.2.3
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/dist/repl/index.js +2 -2
- package/dist/repl/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/core/commands.d.ts +0 -66
- package/dist/core/commands.js +0 -151
- package/dist/core/commands.js.map +0 -1
- package/dist/core/runtime.d.ts +0 -59
- package/dist/core/runtime.js +0 -161
- package/dist/core/runtime.js.map +0 -1
- package/dist/repl/render.d.ts +0 -2
- package/dist/repl/render.js +0 -45
- package/dist/repl/render.js.map +0 -1
- package/dist/repl/status-line.d.ts +0 -19
- package/dist/repl/status-line.js +0 -160
- package/dist/repl/status-line.js.map +0 -1
- package/dist/repl/transcript-flush.d.ts +0 -6
- package/dist/repl/transcript-flush.js +0 -54
- package/dist/repl/transcript-flush.js.map +0 -1
- package/dist/repl/transcript-format.d.ts +0 -16
- package/dist/repl/transcript-format.js +0 -199
- package/dist/repl/transcript-format.js.map +0 -1
- package/dist/server/agent-manager.d.ts +0 -56
- package/dist/server/agent-manager.js +0 -171
- package/dist/server/agent-manager.js.map +0 -1
- package/dist/server/connection-manager.d.ts +0 -18
- package/dist/server/connection-manager.js +0 -52
- package/dist/server/connection-manager.js.map +0 -1
- package/dist/server/event-mapper.d.ts +0 -4
- package/dist/server/event-mapper.js +0 -31
- package/dist/server/event-mapper.js.map +0 -1
- package/dist/server/query-runtime.d.ts +0 -29
- package/dist/server/query-runtime.js +0 -61
- package/dist/server/query-runtime.js.map +0 -1
- package/dist/server/rpc-router.d.ts +0 -24
- package/dist/server/rpc-router.js +0 -165
- package/dist/server/rpc-router.js.map +0 -1
- package/dist/server/rpc-types.d.ts +0 -92
- package/dist/server/rpc-types.js +0 -2
- package/dist/server/rpc-types.js.map +0 -1
- package/dist/server/ws-server.d.ts +0 -22
- package/dist/server/ws-server.js +0 -84
- package/dist/server/ws-server.js.map +0 -1
- package/dist/tasks/task-record.d.ts +0 -50
- package/dist/tasks/task-record.js +0 -50
- package/dist/tasks/task-record.js.map +0 -1
- package/dist/tools/builtins/echo-tool.d.ts +0 -4
- package/dist/tools/builtins/echo-tool.js +0 -26
- package/dist/tools/builtins/echo-tool.js.map +0 -1
- package/dist/tools/builtins/vision-tool.d.ts +0 -38
- package/dist/tools/builtins/vision-tool.js +0 -351
- package/dist/tools/builtins/vision-tool.js.map +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { createCoreRuntime, createQueryEngineRuntime, } from "../core/runtime.js";
|
|
2
|
-
import { QueryRun } from "./query-runtime.js";
|
|
3
|
-
export class AgentManager {
|
|
4
|
-
agents = new Map();
|
|
5
|
-
createRuntime;
|
|
6
|
-
idleAgentTtlMs;
|
|
7
|
-
reconnectGraceMs;
|
|
8
|
-
runningDetachedKeepAliveMs;
|
|
9
|
-
services;
|
|
10
|
-
sessionCwd;
|
|
11
|
-
constructor(options = {}) {
|
|
12
|
-
this.services = options.services;
|
|
13
|
-
this.sessionCwd = options.sessionCwd;
|
|
14
|
-
this.createRuntime = options.createRuntime ?? ((runtimeOptions) => this.services
|
|
15
|
-
? createQueryEngineRuntime(this.services, runtimeOptions)
|
|
16
|
-
: createCoreRuntime(runtimeOptions));
|
|
17
|
-
this.idleAgentTtlMs = options.idleAgentTtlMs ?? 10 * 60_000;
|
|
18
|
-
this.reconnectGraceMs = options.reconnectGraceMs ?? 30_000;
|
|
19
|
-
this.runningDetachedKeepAliveMs = options.runningDetachedKeepAliveMs ?? 60 * 60_000;
|
|
20
|
-
}
|
|
21
|
-
async getOrCreate(identity, options = {}) {
|
|
22
|
-
const key = agentKey(identity);
|
|
23
|
-
const existing = this.agents.get(key);
|
|
24
|
-
if (existing)
|
|
25
|
-
return existing;
|
|
26
|
-
const runtime = await this.createRuntime({
|
|
27
|
-
agentId: identity.agentId,
|
|
28
|
-
sessionId: identity.sessionId,
|
|
29
|
-
sessionCwd: this.sessionCwd,
|
|
30
|
-
resume: options.resume ?? true,
|
|
31
|
-
queryOrigin: "json-rpc-ws",
|
|
32
|
-
});
|
|
33
|
-
const agent = {
|
|
34
|
-
...identity,
|
|
35
|
-
key,
|
|
36
|
-
runtime,
|
|
37
|
-
engine: runtime.engine,
|
|
38
|
-
state: "idle",
|
|
39
|
-
attachedConnections: new Set(),
|
|
40
|
-
createdAt: new Date(),
|
|
41
|
-
updatedAt: new Date(),
|
|
42
|
-
};
|
|
43
|
-
this.agents.set(key, agent);
|
|
44
|
-
return agent;
|
|
45
|
-
}
|
|
46
|
-
get(identity) {
|
|
47
|
-
return this.agents.get(agentKey(identity));
|
|
48
|
-
}
|
|
49
|
-
async attach(connectionId, identity, options = {}) {
|
|
50
|
-
const agent = options.create === false ? this.mustGet(identity) : await this.getOrCreate(identity, { resume: options.resume });
|
|
51
|
-
agent.attachedConnections.add(connectionId);
|
|
52
|
-
agent.lastDetachedAt = undefined;
|
|
53
|
-
agent.updatedAt = new Date();
|
|
54
|
-
agent.state = agent.activeQuery ? "running" : "attached";
|
|
55
|
-
return agent;
|
|
56
|
-
}
|
|
57
|
-
detach(connectionId, identity) {
|
|
58
|
-
const agent = this.get(identity);
|
|
59
|
-
if (!agent)
|
|
60
|
-
return undefined;
|
|
61
|
-
agent.attachedConnections.delete(connectionId);
|
|
62
|
-
agent.updatedAt = new Date();
|
|
63
|
-
if (agent.attachedConnections.size === 0) {
|
|
64
|
-
agent.lastDetachedAt = new Date();
|
|
65
|
-
agent.state = agent.activeQuery ? "detached_running" : "detached_idle";
|
|
66
|
-
}
|
|
67
|
-
return agent;
|
|
68
|
-
}
|
|
69
|
-
detachConnectionFromAll(connectionId) {
|
|
70
|
-
for (const agent of this.agents.values()) {
|
|
71
|
-
if (!agent.attachedConnections.has(connectionId))
|
|
72
|
-
continue;
|
|
73
|
-
agent.attachedConnections.delete(connectionId);
|
|
74
|
-
agent.updatedAt = new Date();
|
|
75
|
-
if (agent.attachedConnections.size === 0) {
|
|
76
|
-
agent.lastDetachedAt = new Date();
|
|
77
|
-
agent.state = agent.activeQuery ? "detached_running" : "detached_idle";
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async startQuery(identity, input) {
|
|
82
|
-
const agent = this.mustGet(identity);
|
|
83
|
-
if (agent.activeQuery && agent.activeQuery.getState() === "running") {
|
|
84
|
-
throw new Error(`agent already has a running query: ${agent.activeQuery.queryId}`);
|
|
85
|
-
}
|
|
86
|
-
const run = new QueryRun(agent.engine, {
|
|
87
|
-
queryId: input.queryId,
|
|
88
|
-
text: input.text,
|
|
89
|
-
displayText: input.displayText,
|
|
90
|
-
disconnectPolicy: input.disconnectPolicy,
|
|
91
|
-
onEvent: input.onEvent,
|
|
92
|
-
});
|
|
93
|
-
agent.activeQuery = run;
|
|
94
|
-
agent.updatedAt = new Date();
|
|
95
|
-
agent.state = agent.attachedConnections.size > 0 ? "running" : "detached_running";
|
|
96
|
-
run.start()
|
|
97
|
-
.catch(() => undefined)
|
|
98
|
-
.finally(() => {
|
|
99
|
-
if (agent.activeQuery === run) {
|
|
100
|
-
agent.activeQuery = undefined;
|
|
101
|
-
agent.updatedAt = new Date();
|
|
102
|
-
agent.state = agent.attachedConnections.size > 0 ? "idle" : "detached_idle";
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
return run;
|
|
106
|
-
}
|
|
107
|
-
cancelQuery(identity, queryId) {
|
|
108
|
-
const agent = this.mustGet(identity);
|
|
109
|
-
if (!agent.activeQuery || agent.activeQuery.queryId !== queryId)
|
|
110
|
-
return false;
|
|
111
|
-
agent.activeQuery.cancel();
|
|
112
|
-
agent.updatedAt = new Date();
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
listSnapshots() {
|
|
116
|
-
return [...this.agents.values()].map((agent) => ({
|
|
117
|
-
key: agent.key,
|
|
118
|
-
userId: agent.userId,
|
|
119
|
-
agentId: agent.agentId,
|
|
120
|
-
state: agent.state,
|
|
121
|
-
attachedConnections: agent.attachedConnections.size,
|
|
122
|
-
activeQueryId: agent.activeQuery?.queryId,
|
|
123
|
-
snapshot: agent.engine.snapshot(),
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
sweep(now = Date.now()) {
|
|
127
|
-
const disposed = [];
|
|
128
|
-
for (const [key, agent] of this.agents) {
|
|
129
|
-
if (agent.attachedConnections.size > 0)
|
|
130
|
-
continue;
|
|
131
|
-
const detachedAt = agent.lastDetachedAt?.getTime() ?? agent.updatedAt.getTime();
|
|
132
|
-
const age = now - detachedAt;
|
|
133
|
-
if (agent.activeQuery) {
|
|
134
|
-
if (agent.activeQuery.getState() === "running") {
|
|
135
|
-
if (age < this.runningDetachedKeepAliveMs)
|
|
136
|
-
continue;
|
|
137
|
-
agent.activeQuery.cancel();
|
|
138
|
-
}
|
|
139
|
-
else if (age < this.idleAgentTtlMs) {
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
if (age < Math.max(this.idleAgentTtlMs, this.reconnectGraceMs))
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
this.dispose(key);
|
|
148
|
-
disposed.push(key);
|
|
149
|
-
}
|
|
150
|
-
return disposed;
|
|
151
|
-
}
|
|
152
|
-
dispose(key) {
|
|
153
|
-
const agent = this.agents.get(key);
|
|
154
|
-
if (!agent)
|
|
155
|
-
return false;
|
|
156
|
-
agent.activeQuery?.cancel();
|
|
157
|
-
agent.state = "disposed";
|
|
158
|
-
this.agents.delete(key);
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
mustGet(identity) {
|
|
162
|
-
const agent = this.get(identity);
|
|
163
|
-
if (!agent)
|
|
164
|
-
throw new Error(`agent not found: ${agentKey(identity)}`);
|
|
165
|
-
return agent;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
export function agentKey(identity) {
|
|
169
|
-
return `${identity.userId}:${identity.sessionId ?? "default"}:${identity.agentId}`;
|
|
170
|
-
}
|
|
171
|
-
//# sourceMappingURL=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O,KAAK,CAAC;IACf,CAAC;CACF;AAED,MAAM,UAAU,QAAQ,CAAC,QAAuB;IAC9C,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,SAAS,IAAI,SAAS,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AgentIdentity } from "./agent-manager.js";
|
|
2
|
-
export interface ConnectionRecord {
|
|
3
|
-
id: string;
|
|
4
|
-
attachedAgents: Map<string, AgentIdentity>;
|
|
5
|
-
openedAt: Date;
|
|
6
|
-
closedAt?: Date;
|
|
7
|
-
}
|
|
8
|
-
export declare class ConnectionManager {
|
|
9
|
-
private readonly connections;
|
|
10
|
-
open(id: string): ConnectionRecord;
|
|
11
|
-
get(id: string): ConnectionRecord | undefined;
|
|
12
|
-
attachAgent(connectionId: string, identity: AgentIdentity): void;
|
|
13
|
-
detachAgent(connectionId: string, identity: AgentIdentity): void;
|
|
14
|
-
listAttachedAgents(connectionId: string): AgentIdentity[];
|
|
15
|
-
listConnectionIdsForAgent(identity: AgentIdentity): string[];
|
|
16
|
-
close(connectionId: string): AgentIdentity[];
|
|
17
|
-
private mustGet;
|
|
18
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export class ConnectionManager {
|
|
2
|
-
connections = new Map();
|
|
3
|
-
open(id) {
|
|
4
|
-
const record = {
|
|
5
|
-
id,
|
|
6
|
-
attachedAgents: new Map(),
|
|
7
|
-
openedAt: new Date(),
|
|
8
|
-
};
|
|
9
|
-
this.connections.set(id, record);
|
|
10
|
-
return record;
|
|
11
|
-
}
|
|
12
|
-
get(id) {
|
|
13
|
-
return this.connections.get(id);
|
|
14
|
-
}
|
|
15
|
-
attachAgent(connectionId, identity) {
|
|
16
|
-
const record = this.mustGet(connectionId);
|
|
17
|
-
record.attachedAgents.set(agentLocatorKey(identity), identity);
|
|
18
|
-
}
|
|
19
|
-
detachAgent(connectionId, identity) {
|
|
20
|
-
this.mustGet(connectionId).attachedAgents.delete(agentLocatorKey(identity));
|
|
21
|
-
}
|
|
22
|
-
listAttachedAgents(connectionId) {
|
|
23
|
-
return [...this.mustGet(connectionId).attachedAgents.values()];
|
|
24
|
-
}
|
|
25
|
-
listConnectionIdsForAgent(identity) {
|
|
26
|
-
const key = agentLocatorKey(identity);
|
|
27
|
-
const results = [];
|
|
28
|
-
for (const [connectionId, record] of this.connections) {
|
|
29
|
-
if (record.attachedAgents.has(key))
|
|
30
|
-
results.push(connectionId);
|
|
31
|
-
}
|
|
32
|
-
return results;
|
|
33
|
-
}
|
|
34
|
-
close(connectionId) {
|
|
35
|
-
const record = this.connections.get(connectionId);
|
|
36
|
-
if (!record)
|
|
37
|
-
return [];
|
|
38
|
-
record.closedAt = new Date();
|
|
39
|
-
this.connections.delete(connectionId);
|
|
40
|
-
return [...record.attachedAgents.values()];
|
|
41
|
-
}
|
|
42
|
-
mustGet(connectionId) {
|
|
43
|
-
const record = this.connections.get(connectionId);
|
|
44
|
-
if (!record)
|
|
45
|
-
throw new Error(`connection not found: ${connectionId}`);
|
|
46
|
-
return record;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function agentLocatorKey(identity) {
|
|
50
|
-
return `${identity.userId}:${identity.sessionId ?? "default"}:${identity.agentId}`;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=connection-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection-manager.js","sourceRoot":"","sources":["../../src/server/connection-manager.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,iBAAiB;IACX,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IAEnE,IAAI,CAAC,EAAU;QACb,MAAM,MAAM,GAAqB;YAC/B,EAAE;YACF,cAAc,EAAE,IAAI,GAAG,EAAE;YACzB,QAAQ,EAAE,IAAI,IAAI,EAAE;SACrB,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,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EAAE,CAAC;QAC7B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAEO,OAAO,CAAC,YAAoB;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,SAAS,eAAe,CAAC,QAAuB;IAC9C,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,SAAS,IAAI,SAAS,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AgentEvent } from "../types/events.js";
|
|
2
|
-
import type { RpcQueryEventEnvelope, SerializedAgentEvent } from "./rpc-types.js";
|
|
3
|
-
export declare function serializeAgentEvent(event: AgentEvent): SerializedAgentEvent;
|
|
4
|
-
export declare function createQueryEventEnvelope(queryId: string, seq: number, event: AgentEvent): RpcQueryEventEnvelope;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export function serializeAgentEvent(event) {
|
|
2
|
-
if (event.type === "error") {
|
|
3
|
-
return {
|
|
4
|
-
...event,
|
|
5
|
-
error: serializeError(event.error),
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
if (event.type === "retrying") {
|
|
9
|
-
return {
|
|
10
|
-
...event,
|
|
11
|
-
error: serializeError(event.error),
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
return event;
|
|
15
|
-
}
|
|
16
|
-
export function createQueryEventEnvelope(queryId, seq, event) {
|
|
17
|
-
return {
|
|
18
|
-
queryId,
|
|
19
|
-
seq,
|
|
20
|
-
event: serializeAgentEvent(event),
|
|
21
|
-
createdAt: new Date().toISOString(),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function serializeError(error) {
|
|
25
|
-
return {
|
|
26
|
-
name: error.name,
|
|
27
|
-
message: error.message,
|
|
28
|
-
stack: error.stack,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=event-mapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-mapper.js","sourceRoot":"","sources":["../../src/server/event-mapper.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC;SACnC,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC;SACnC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAe,EAAE,GAAW,EAAE,KAAiB;IACtF,OAAO;QACL,OAAO;QACP,GAAG;QACH,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC;QACjC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAY;IAClC,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { QueryEngine } from "../core/query-engine.js";
|
|
2
|
-
import type { RpcQueryEventEnvelope } from "./rpc-types.js";
|
|
3
|
-
export interface QueryRunOptions {
|
|
4
|
-
queryId: string;
|
|
5
|
-
text: string;
|
|
6
|
-
displayText?: string;
|
|
7
|
-
disconnectPolicy?: "continue" | "cancel";
|
|
8
|
-
onEvent?: (event: RpcQueryEventEnvelope) => void;
|
|
9
|
-
}
|
|
10
|
-
export type QueryRunState = "running" | "completed" | "cancelled" | "failed";
|
|
11
|
-
export declare class QueryRun {
|
|
12
|
-
private readonly engine;
|
|
13
|
-
private readonly options;
|
|
14
|
-
readonly queryId: string;
|
|
15
|
-
readonly startedAt: Date;
|
|
16
|
-
readonly disconnectPolicy: "continue" | "cancel";
|
|
17
|
-
private readonly controller;
|
|
18
|
-
private readonly buffer;
|
|
19
|
-
private state;
|
|
20
|
-
private seq;
|
|
21
|
-
private completion?;
|
|
22
|
-
constructor(engine: QueryEngine, options: QueryRunOptions);
|
|
23
|
-
start(): Promise<void>;
|
|
24
|
-
cancel(): void;
|
|
25
|
-
getState(): QueryRunState;
|
|
26
|
-
getBufferedEvents(afterSeq?: number): RpcQueryEventEnvelope[];
|
|
27
|
-
private run;
|
|
28
|
-
private pushEvent;
|
|
29
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createQueryEventEnvelope } from "./event-mapper.js";
|
|
2
|
-
export class QueryRun {
|
|
3
|
-
engine;
|
|
4
|
-
options;
|
|
5
|
-
queryId;
|
|
6
|
-
startedAt = new Date();
|
|
7
|
-
disconnectPolicy;
|
|
8
|
-
controller = new AbortController();
|
|
9
|
-
buffer = [];
|
|
10
|
-
state = "running";
|
|
11
|
-
seq = 0;
|
|
12
|
-
completion;
|
|
13
|
-
constructor(engine, options) {
|
|
14
|
-
this.engine = engine;
|
|
15
|
-
this.options = options;
|
|
16
|
-
this.queryId = options.queryId;
|
|
17
|
-
this.disconnectPolicy = options.disconnectPolicy ?? "continue";
|
|
18
|
-
}
|
|
19
|
-
start() {
|
|
20
|
-
if (this.completion)
|
|
21
|
-
return this.completion;
|
|
22
|
-
this.completion = this.run();
|
|
23
|
-
return this.completion;
|
|
24
|
-
}
|
|
25
|
-
cancel() {
|
|
26
|
-
if (this.state !== "running")
|
|
27
|
-
return;
|
|
28
|
-
this.state = "cancelled";
|
|
29
|
-
this.controller.abort();
|
|
30
|
-
}
|
|
31
|
-
getState() {
|
|
32
|
-
return this.state;
|
|
33
|
-
}
|
|
34
|
-
getBufferedEvents(afterSeq = 0) {
|
|
35
|
-
return this.buffer.filter((entry) => entry.seq > afterSeq);
|
|
36
|
-
}
|
|
37
|
-
async run() {
|
|
38
|
-
try {
|
|
39
|
-
for await (const event of this.engine.sendUserText(this.options.text, {
|
|
40
|
-
abortSignal: this.controller.signal,
|
|
41
|
-
displayText: this.options.displayText,
|
|
42
|
-
})) {
|
|
43
|
-
this.pushEvent(event);
|
|
44
|
-
}
|
|
45
|
-
if (this.state === "running")
|
|
46
|
-
this.state = this.controller.signal.aborted ? "cancelled" : "completed";
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
this.state = this.controller.signal.aborted ? "cancelled" : "failed";
|
|
50
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
51
|
-
this.pushEvent({ type: "error", error: normalized });
|
|
52
|
-
throw normalized;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
pushEvent(event) {
|
|
56
|
-
const envelope = createQueryEventEnvelope(this.queryId, ++this.seq, event);
|
|
57
|
-
this.buffer.push(envelope);
|
|
58
|
-
this.options.onEvent?.(envelope);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=query-runtime.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-runtime.js","sourceRoot":"","sources":["../../src/server/query-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAa7D,MAAM,OAAO,QAAQ;IAUU;IAAsC;IAT1D,OAAO,CAAS;IAChB,SAAS,GAA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gBACnC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;aACtC,CAAC,EAAE,CAAC;gBACH,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;gBAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;QACxG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;YACrE,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7E,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;YACrD,MAAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,KAAiB;QACjC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { AgentManager } from "./agent-manager.js";
|
|
2
|
-
import type { ConnectionManager } from "./connection-manager.js";
|
|
3
|
-
import type { JsonRpcError, JsonRpcRequest, JsonRpcSuccess } from "./rpc-types.js";
|
|
4
|
-
export interface RpcRouterOptions {
|
|
5
|
-
agentManager: AgentManager;
|
|
6
|
-
connectionManager: ConnectionManager;
|
|
7
|
-
emitNotification: (connectionId: string, method: string, params: unknown) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare class RpcRouter {
|
|
10
|
-
private readonly options;
|
|
11
|
-
constructor(options: RpcRouterOptions);
|
|
12
|
-
handle(connectionId: string, request: JsonRpcRequest): Promise<JsonRpcSuccess | JsonRpcError | null>;
|
|
13
|
-
private attach;
|
|
14
|
-
private detach;
|
|
15
|
-
private listSessions;
|
|
16
|
-
private deleteSession;
|
|
17
|
-
private startQuery;
|
|
18
|
-
private cancelQuery;
|
|
19
|
-
private resume;
|
|
20
|
-
private requireAttachedIdentity;
|
|
21
|
-
private requireAttachedIdentitySync;
|
|
22
|
-
private ok;
|
|
23
|
-
private error;
|
|
24
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
export class RpcRouter {
|
|
2
|
-
options;
|
|
3
|
-
constructor(options) {
|
|
4
|
-
this.options = options;
|
|
5
|
-
}
|
|
6
|
-
async handle(connectionId, request) {
|
|
7
|
-
try {
|
|
8
|
-
switch (request.method) {
|
|
9
|
-
case "agent.attach":
|
|
10
|
-
return this.ok(request.id, await this.attach(connectionId, request.params));
|
|
11
|
-
case "agent.detach":
|
|
12
|
-
return this.ok(request.id, this.detach(connectionId, request.params));
|
|
13
|
-
case "session.list":
|
|
14
|
-
return this.ok(request.id, await this.listSessions(connectionId, request.params));
|
|
15
|
-
case "session.delete":
|
|
16
|
-
return this.ok(request.id, await this.deleteSession(connectionId, request.params));
|
|
17
|
-
case "query.start":
|
|
18
|
-
return this.ok(request.id, await this.startQuery(connectionId, request.params));
|
|
19
|
-
case "query.cancel":
|
|
20
|
-
return this.ok(request.id, this.cancelQuery(connectionId, request.params));
|
|
21
|
-
case "connection.resume":
|
|
22
|
-
return this.ok(request.id, await this.resume(connectionId, request.params));
|
|
23
|
-
case "agent.list":
|
|
24
|
-
return this.ok(request.id, this.options.agentManager.listSnapshots());
|
|
25
|
-
default:
|
|
26
|
-
return this.error(request.id, -32601, `method not found: ${request.method}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
31
|
-
return this.error(request.id, -32000, normalized.message, { stack: normalized.stack });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async attach(connectionId, params) {
|
|
35
|
-
const identity = normalizeIdentity(params);
|
|
36
|
-
const agent = await this.options.agentManager.attach(connectionId, identity, {
|
|
37
|
-
create: params?.create,
|
|
38
|
-
resume: params?.resume,
|
|
39
|
-
});
|
|
40
|
-
this.options.connectionManager.attachAgent(connectionId, identity);
|
|
41
|
-
return { key: agent.key, state: agent.state, snapshot: agent.engine.snapshot() };
|
|
42
|
-
}
|
|
43
|
-
detach(connectionId, params) {
|
|
44
|
-
const identity = normalizeIdentity(params);
|
|
45
|
-
const agent = this.options.agentManager.detach(connectionId, identity);
|
|
46
|
-
this.options.connectionManager.detachAgent(connectionId, identity);
|
|
47
|
-
return { detached: Boolean(agent), state: agent?.state };
|
|
48
|
-
}
|
|
49
|
-
async listSessions(connectionId, params) {
|
|
50
|
-
const identity = await this.requireAttachedIdentity(connectionId, params);
|
|
51
|
-
const agent = this.options.agentManager.get(identity);
|
|
52
|
-
if (!agent)
|
|
53
|
-
throw new Error(`agent not found: ${identity.agentId}`);
|
|
54
|
-
return {
|
|
55
|
-
current: agent.engine.snapshot().session,
|
|
56
|
-
available: await agent.engine.listSessions(params?.limit ?? 10),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
async deleteSession(connectionId, params) {
|
|
60
|
-
const identity = await this.requireAttachedIdentity(connectionId, params);
|
|
61
|
-
const agent = this.options.agentManager.get(identity);
|
|
62
|
-
if (!agent)
|
|
63
|
-
throw new Error(`agent not found: ${identity.agentId}`);
|
|
64
|
-
return {
|
|
65
|
-
deleted: await agent.engine.deleteSession(required(params?.targetSessionId, "targetSessionId")),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
async startQuery(connectionId, params) {
|
|
69
|
-
const identity = await this.requireAttachedIdentity(connectionId, params);
|
|
70
|
-
const queryId = params?.queryId?.trim() || createId("query");
|
|
71
|
-
const run = await this.options.agentManager.startQuery(identity, {
|
|
72
|
-
queryId,
|
|
73
|
-
text: required(params?.text, "text"),
|
|
74
|
-
displayText: params?.displayText,
|
|
75
|
-
disconnectPolicy: params?.disconnectPolicy,
|
|
76
|
-
onEvent: (event) => {
|
|
77
|
-
for (const target of this.options.connectionManager.listConnectionIdsForAgent(identity)) {
|
|
78
|
-
this.options.emitNotification(target, "query.event", event);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
return { queryId: run.queryId, state: run.getState() };
|
|
83
|
-
}
|
|
84
|
-
cancelQuery(connectionId, params) {
|
|
85
|
-
const identity = this.requireAttachedIdentitySync(connectionId, params);
|
|
86
|
-
return {
|
|
87
|
-
cancelled: this.options.agentManager.cancelQuery(identity, required(params?.queryId, "queryId")),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
async resume(connectionId, params) {
|
|
91
|
-
const agents = params?.agents ?? [];
|
|
92
|
-
const queries = params?.queries ?? [];
|
|
93
|
-
const attached = [];
|
|
94
|
-
for (const locator of agents) {
|
|
95
|
-
const identity = normalizeIdentity(locator);
|
|
96
|
-
const agent = await this.options.agentManager.attach(connectionId, identity, { create: true, resume: true });
|
|
97
|
-
this.options.connectionManager.attachAgent(connectionId, identity);
|
|
98
|
-
attached.push({ key: agent.key, state: agent.state });
|
|
99
|
-
}
|
|
100
|
-
for (const query of queries) {
|
|
101
|
-
for (const identity of this.options.connectionManager.listAttachedAgents(connectionId)) {
|
|
102
|
-
const agent = this.options.agentManager.get(identity);
|
|
103
|
-
if (!agent?.activeQuery || agent.activeQuery.queryId !== query.queryId)
|
|
104
|
-
continue;
|
|
105
|
-
for (const event of agent.activeQuery.getBufferedEvents(query.afterSeq ?? 0)) {
|
|
106
|
-
this.options.emitNotification(connectionId, "query.event", event);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return { attached, replayedQueries: queries.map((item) => item.queryId) };
|
|
111
|
-
}
|
|
112
|
-
async requireAttachedIdentity(connectionId, params) {
|
|
113
|
-
return this.requireAttachedIdentitySync(connectionId, params);
|
|
114
|
-
}
|
|
115
|
-
requireAttachedIdentitySync(connectionId, params) {
|
|
116
|
-
const record = this.options.connectionManager.get(connectionId);
|
|
117
|
-
if (!record)
|
|
118
|
-
throw new Error(`connection not found: ${connectionId}`);
|
|
119
|
-
const requested = params?.userId ? normalizeIdentity(params) : undefined;
|
|
120
|
-
if (requested) {
|
|
121
|
-
const match = record.attachedAgents.get(locatorKey(requested));
|
|
122
|
-
if (match)
|
|
123
|
-
return match;
|
|
124
|
-
throw new Error(`agent is not attached to connection: ${locatorKey(requested)}`);
|
|
125
|
-
}
|
|
126
|
-
const first = record.attachedAgents.values().next().value;
|
|
127
|
-
if (!first)
|
|
128
|
-
throw new Error("no agent attached to connection");
|
|
129
|
-
return first;
|
|
130
|
-
}
|
|
131
|
-
ok(id, result) {
|
|
132
|
-
return {
|
|
133
|
-
jsonrpc: "2.0",
|
|
134
|
-
id: id ?? null,
|
|
135
|
-
result,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
error(id, code, message, data) {
|
|
139
|
-
return {
|
|
140
|
-
jsonrpc: "2.0",
|
|
141
|
-
id: id ?? null,
|
|
142
|
-
error: { code, message, data },
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function normalizeIdentity(params) {
|
|
147
|
-
return {
|
|
148
|
-
userId: required(params?.userId, "userId"),
|
|
149
|
-
agentId: params?.agentId?.trim() || "main",
|
|
150
|
-
sessionId: params?.sessionId?.trim() || undefined,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function required(value, field) {
|
|
154
|
-
const normalized = value?.trim();
|
|
155
|
-
if (!normalized)
|
|
156
|
-
throw new Error(`missing required field: ${field}`);
|
|
157
|
-
return normalized;
|
|
158
|
-
}
|
|
159
|
-
function locatorKey(identity) {
|
|
160
|
-
return `${identity.userId}:${identity.sessionId ?? "default"}:${identity.agentId}`;
|
|
161
|
-
}
|
|
162
|
-
function createId(prefix) {
|
|
163
|
-
return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=rpc-router.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-router.js","sourceRoot":"","sources":["../../src/server/rpc-router.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,SAAS;IACS;IAA7B,YAA6B,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IAAG,CAAC;IAE1D,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,OAAuB;QACxD,IAAI,CAAC;YACH,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;gBACvB,KAAK,cAAc;oBACjB,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,MAAuC,CAAC,CAAC,CAAC;gBAC/G,KAAK,cAAc;oBACjB,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,MAAuC,CAAC,CAAC,CAAC;gBACzG,KAAK,cAAc;oBACjB,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,MAAuC,CAAC,CAAC,CAAC;gBACrH,KAAK,gBAAgB;oBACnB,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,CAAC,aAAa,CAAC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