pikiloom 0.4.37 → 0.4.39
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/dashboard/dist/assets/{AgentTab-DbFzaIyZ.js → AgentTab-Ds8D6yrl.js} +1 -1
- package/dashboard/dist/assets/{ConnectionModal-QNYOWHCU.js → ConnectionModal-Buj2d5L5.js} +1 -1
- package/dashboard/dist/assets/{DirBrowser-BGaKHjFT.js → DirBrowser-BTv7rH8E.js} +1 -1
- package/dashboard/dist/assets/{ExtensionsTab-D4Gv9b8z.js → ExtensionsTab-BnGwxS9U.js} +1 -1
- package/dashboard/dist/assets/{IMAccessTab-DxxoZd84.js → IMAccessTab-DjQnpOmF.js} +1 -1
- package/dashboard/dist/assets/{Modal-Nm2e93s5.js → Modal-DpuinsE3.js} +1 -1
- package/dashboard/dist/assets/{Modals-BwxZmU0U.js → Modals-Bs842H3n.js} +1 -1
- package/dashboard/dist/assets/{Select-SGlII0yx.js → Select-Dvia29HZ.js} +1 -1
- package/dashboard/dist/assets/SessionPanel-CVItEgcH.js +1 -0
- package/dashboard/dist/assets/{SystemTab-BF6lIAYM.js → SystemTab-BzPtwDxq.js} +1 -1
- package/dashboard/dist/assets/index-Bthwt6K_.css +1 -0
- package/dashboard/dist/assets/{index-DZiAiRNt.js → index-S0NmlDEH.js} +14 -14
- package/dashboard/dist/assets/{index-BP8R_bLT.js → index-yZ-iG1qk.js} +2 -2
- package/dashboard/dist/assets/{shared-S0kcs5yP.js → shared-p3kZpiD4.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/agent/kernel-bridge.js +207 -0
- package/dist/agent/mcp/capabilities.js +39 -0
- package/dist/agent/stream.js +19 -1
- package/dist/bot/bot.js +4 -13
- package/dist/cli/kernel-app.js +115 -0
- package/dist/cli/main.js +7 -0
- package/package.json +4 -2
- package/packages/kernel/README.md +305 -0
- package/packages/kernel/dist/contracts/driver.d.ts +95 -0
- package/packages/kernel/dist/contracts/driver.js +1 -0
- package/packages/kernel/dist/contracts/ports.d.ts +84 -0
- package/packages/kernel/dist/contracts/ports.js +1 -0
- package/packages/kernel/dist/contracts/surface.d.ts +92 -0
- package/packages/kernel/dist/contracts/surface.js +1 -0
- package/packages/kernel/dist/drivers/claude.d.ts +34 -0
- package/packages/kernel/dist/drivers/claude.js +500 -0
- package/packages/kernel/dist/drivers/codex.d.ts +24 -0
- package/packages/kernel/dist/drivers/codex.js +415 -0
- package/packages/kernel/dist/drivers/echo.d.ts +20 -0
- package/packages/kernel/dist/drivers/echo.js +61 -0
- package/packages/kernel/dist/drivers/gemini.d.ts +18 -0
- package/packages/kernel/dist/drivers/gemini.js +143 -0
- package/packages/kernel/dist/drivers/hermes.d.ts +14 -0
- package/packages/kernel/dist/drivers/hermes.js +194 -0
- package/packages/kernel/dist/drivers/index.d.ts +5 -0
- package/packages/kernel/dist/drivers/index.js +5 -0
- package/packages/kernel/dist/index.d.ts +18 -0
- package/packages/kernel/dist/index.js +29 -0
- package/packages/kernel/dist/ports/defaults.d.ts +59 -0
- package/packages/kernel/dist/ports/defaults.js +137 -0
- package/packages/kernel/dist/protocol/index.d.ts +309 -0
- package/packages/kernel/dist/protocol/index.js +59 -0
- package/packages/kernel/dist/runtime/hub.d.ts +68 -0
- package/packages/kernel/dist/runtime/hub.js +334 -0
- package/packages/kernel/dist/runtime/loom.d.ts +45 -0
- package/packages/kernel/dist/runtime/loom.js +72 -0
- package/packages/kernel/dist/runtime/pty.d.ts +23 -0
- package/packages/kernel/dist/runtime/pty.js +69 -0
- package/packages/kernel/dist/runtime/session-runner.d.ts +27 -0
- package/packages/kernel/dist/runtime/session-runner.js +210 -0
- package/packages/kernel/dist/runtime/tui.d.ts +8 -0
- package/packages/kernel/dist/runtime/tui.js +35 -0
- package/packages/kernel/dist/runtime/turn.d.ts +17 -0
- package/packages/kernel/dist/runtime/turn.js +16 -0
- package/packages/kernel/dist/surfaces/cli.d.ts +19 -0
- package/packages/kernel/dist/surfaces/cli.js +65 -0
- package/packages/kernel/dist/surfaces/index.d.ts +2 -0
- package/packages/kernel/dist/surfaces/index.js +2 -0
- package/packages/kernel/dist/surfaces/web.d.ts +39 -0
- package/packages/kernel/dist/surfaces/web.js +244 -0
- package/dashboard/dist/assets/SessionPanel-DYfSlreh.js +0 -1
- package/dashboard/dist/assets/index-CtS48Jn-.css +0 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
export declare const PROTOCOL_VERSION: 1;
|
|
2
|
+
export type SessionPhase = 'idle' | 'queued' | 'streaming' | 'done';
|
|
3
|
+
export interface UniversalPlanStep {
|
|
4
|
+
text: string;
|
|
5
|
+
status: 'pending' | 'inProgress' | 'completed';
|
|
6
|
+
}
|
|
7
|
+
export interface UniversalPlan {
|
|
8
|
+
explanation: string | null;
|
|
9
|
+
steps: UniversalPlanStep[];
|
|
10
|
+
}
|
|
11
|
+
export interface UniversalToolCall {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
input?: string | null;
|
|
16
|
+
result?: string | null;
|
|
17
|
+
status: 'running' | 'done' | 'failed';
|
|
18
|
+
}
|
|
19
|
+
export interface UniversalSubAgent {
|
|
20
|
+
id: string;
|
|
21
|
+
kind: string | null;
|
|
22
|
+
description: string | null;
|
|
23
|
+
model: string | null;
|
|
24
|
+
tools: Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
summary: string;
|
|
28
|
+
}>;
|
|
29
|
+
status: 'running' | 'done' | 'failed';
|
|
30
|
+
}
|
|
31
|
+
export interface UniversalUsage {
|
|
32
|
+
inputTokens: number | null;
|
|
33
|
+
outputTokens: number | null;
|
|
34
|
+
cachedInputTokens: number | null;
|
|
35
|
+
contextUsedTokens?: number | null;
|
|
36
|
+
contextPercent: number | null;
|
|
37
|
+
turnOutputTokens?: number | null;
|
|
38
|
+
providerName?: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface UniversalQueuedTask {
|
|
41
|
+
taskId: string;
|
|
42
|
+
prompt: string;
|
|
43
|
+
}
|
|
44
|
+
export interface UniversalArtifact {
|
|
45
|
+
url?: string;
|
|
46
|
+
path?: string;
|
|
47
|
+
fileName: string;
|
|
48
|
+
fileSize?: number;
|
|
49
|
+
mime?: string;
|
|
50
|
+
kind: 'photo' | 'document';
|
|
51
|
+
caption?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface UniversalInteractionQuestion {
|
|
54
|
+
id: string;
|
|
55
|
+
header?: string;
|
|
56
|
+
text: string;
|
|
57
|
+
type?: 'text' | 'select' | string;
|
|
58
|
+
choices?: Array<{
|
|
59
|
+
label: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
value?: string;
|
|
62
|
+
}>;
|
|
63
|
+
allowFreeform?: boolean;
|
|
64
|
+
allowEmpty?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface UniversalInteraction {
|
|
67
|
+
promptId: string;
|
|
68
|
+
kind: 'user-input' | 'permission' | 'confirmation';
|
|
69
|
+
title: string;
|
|
70
|
+
hint?: string | null;
|
|
71
|
+
questions: UniversalInteractionQuestion[];
|
|
72
|
+
currentIndex?: number;
|
|
73
|
+
}
|
|
74
|
+
export interface UniversalSnapshot {
|
|
75
|
+
phase: SessionPhase;
|
|
76
|
+
taskId?: string | null;
|
|
77
|
+
sessionId?: string | null;
|
|
78
|
+
agent?: string | null;
|
|
79
|
+
model?: string | null;
|
|
80
|
+
effort?: string | null;
|
|
81
|
+
prompt?: string | null;
|
|
82
|
+
text?: string;
|
|
83
|
+
reasoning?: string;
|
|
84
|
+
activity?: string;
|
|
85
|
+
plan?: UniversalPlan | null;
|
|
86
|
+
toolCalls?: UniversalToolCall[];
|
|
87
|
+
subAgents?: UniversalSubAgent[];
|
|
88
|
+
usage?: UniversalUsage | null;
|
|
89
|
+
artifacts?: UniversalArtifact[];
|
|
90
|
+
interactions?: UniversalInteraction[];
|
|
91
|
+
queued?: UniversalQueuedTask[];
|
|
92
|
+
error?: string | null;
|
|
93
|
+
incomplete?: boolean;
|
|
94
|
+
startedAt?: number;
|
|
95
|
+
updatedAt: number;
|
|
96
|
+
}
|
|
97
|
+
export interface SessionMeta {
|
|
98
|
+
sessionKey: string;
|
|
99
|
+
agent?: string | null;
|
|
100
|
+
title?: string | null;
|
|
101
|
+
phase?: SessionPhase;
|
|
102
|
+
updatedAt?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface SnapshotPatch {
|
|
105
|
+
full?: UniversalSnapshot;
|
|
106
|
+
appendText?: string;
|
|
107
|
+
appendReasoning?: string;
|
|
108
|
+
set?: Partial<UniversalSnapshot>;
|
|
109
|
+
}
|
|
110
|
+
export declare function emptySnapshot(): UniversalSnapshot;
|
|
111
|
+
export declare function diffSnapshot(prev: UniversalSnapshot, next: UniversalSnapshot): SnapshotPatch;
|
|
112
|
+
export declare function applySnapshotPatch(prev: UniversalSnapshot | null, patch: SnapshotPatch): UniversalSnapshot;
|
|
113
|
+
export interface AgentInfo {
|
|
114
|
+
id: string;
|
|
115
|
+
capabilities?: {
|
|
116
|
+
steer?: boolean;
|
|
117
|
+
interact?: boolean;
|
|
118
|
+
resume?: boolean;
|
|
119
|
+
tui?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface ModelDescriptor {
|
|
123
|
+
id: string;
|
|
124
|
+
label?: string;
|
|
125
|
+
providerName?: string | null;
|
|
126
|
+
contextWindow?: number | null;
|
|
127
|
+
}
|
|
128
|
+
export interface EffortOption {
|
|
129
|
+
id: string;
|
|
130
|
+
label?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface ToolDescriptor {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
enabled?: boolean;
|
|
137
|
+
}
|
|
138
|
+
export interface SkillDescriptor {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
}
|
|
143
|
+
export type TransportKind = 'websocket' | 'webrtc' | 'cli' | string;
|
|
144
|
+
export type HostCapability = 'prompt' | 'stop' | 'steer' | 'interact' | 'subscribe-all' | 'artifacts' | 'history' | 'catalog' | 'tui';
|
|
145
|
+
export interface HostInfo {
|
|
146
|
+
name: string;
|
|
147
|
+
version: string;
|
|
148
|
+
transport: TransportKind;
|
|
149
|
+
capabilities: HostCapability[];
|
|
150
|
+
authRequired?: boolean;
|
|
151
|
+
}
|
|
152
|
+
export interface ClientHello {
|
|
153
|
+
type: 'hello';
|
|
154
|
+
v: number;
|
|
155
|
+
client?: {
|
|
156
|
+
name?: string;
|
|
157
|
+
platform?: string;
|
|
158
|
+
};
|
|
159
|
+
token?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface ClientSubscribe {
|
|
162
|
+
type: 'subscribe';
|
|
163
|
+
sessionKey: string;
|
|
164
|
+
}
|
|
165
|
+
export interface ClientUnsubscribe {
|
|
166
|
+
type: 'unsubscribe';
|
|
167
|
+
sessionKey: string;
|
|
168
|
+
}
|
|
169
|
+
export interface ClientPrompt {
|
|
170
|
+
type: 'prompt';
|
|
171
|
+
sessionKey?: string;
|
|
172
|
+
prompt: string;
|
|
173
|
+
agent?: string;
|
|
174
|
+
workdir?: string;
|
|
175
|
+
model?: string | null;
|
|
176
|
+
effort?: string | null;
|
|
177
|
+
attachments?: string[];
|
|
178
|
+
clientRef?: string;
|
|
179
|
+
}
|
|
180
|
+
export interface ClientStop {
|
|
181
|
+
type: 'stop';
|
|
182
|
+
sessionKey: string;
|
|
183
|
+
}
|
|
184
|
+
export interface ClientSteer {
|
|
185
|
+
type: 'steer';
|
|
186
|
+
taskId: string;
|
|
187
|
+
prompt: string;
|
|
188
|
+
}
|
|
189
|
+
export interface ClientInteract {
|
|
190
|
+
type: 'interact';
|
|
191
|
+
promptId: string;
|
|
192
|
+
action: 'select' | 'text' | 'skip' | 'cancel';
|
|
193
|
+
value?: string;
|
|
194
|
+
}
|
|
195
|
+
export interface ClientGetSnapshot {
|
|
196
|
+
type: 'getSnapshot';
|
|
197
|
+
sessionKey: string;
|
|
198
|
+
}
|
|
199
|
+
export interface ClientListSessions {
|
|
200
|
+
type: 'listSessions';
|
|
201
|
+
}
|
|
202
|
+
export interface ClientGetHistory {
|
|
203
|
+
type: 'getHistory';
|
|
204
|
+
sessionKey: string;
|
|
205
|
+
ref?: string;
|
|
206
|
+
}
|
|
207
|
+
export interface ClientGetCatalog {
|
|
208
|
+
type: 'getCatalog';
|
|
209
|
+
agent?: string;
|
|
210
|
+
model?: string | null;
|
|
211
|
+
workdir?: string;
|
|
212
|
+
ref?: string;
|
|
213
|
+
}
|
|
214
|
+
export interface ClientPing {
|
|
215
|
+
type: 'ping';
|
|
216
|
+
t?: number;
|
|
217
|
+
}
|
|
218
|
+
export interface ClientOpenTui {
|
|
219
|
+
type: 'openTui';
|
|
220
|
+
agent?: string;
|
|
221
|
+
workdir?: string;
|
|
222
|
+
model?: string | null;
|
|
223
|
+
sessionId?: string | null;
|
|
224
|
+
cols?: number;
|
|
225
|
+
rows?: number;
|
|
226
|
+
ref?: string;
|
|
227
|
+
}
|
|
228
|
+
export interface ClientTuiInput {
|
|
229
|
+
type: 'tuiInput';
|
|
230
|
+
tuiId: string;
|
|
231
|
+
data: string;
|
|
232
|
+
}
|
|
233
|
+
export interface ClientTuiResize {
|
|
234
|
+
type: 'tuiResize';
|
|
235
|
+
tuiId: string;
|
|
236
|
+
cols: number;
|
|
237
|
+
rows: number;
|
|
238
|
+
}
|
|
239
|
+
export interface ClientTuiClose {
|
|
240
|
+
type: 'tuiClose';
|
|
241
|
+
tuiId: string;
|
|
242
|
+
}
|
|
243
|
+
export type ClientMessage = ClientHello | ClientSubscribe | ClientUnsubscribe | ClientPrompt | ClientStop | ClientSteer | ClientInteract | ClientGetSnapshot | ClientListSessions | ClientGetHistory | ClientGetCatalog | ClientOpenTui | ClientTuiInput | ClientTuiResize | ClientTuiClose | ClientPing;
|
|
244
|
+
export interface ServerWelcome {
|
|
245
|
+
type: 'welcome';
|
|
246
|
+
v: number;
|
|
247
|
+
host: HostInfo;
|
|
248
|
+
sessions: SessionMeta[];
|
|
249
|
+
}
|
|
250
|
+
export interface ServerSession {
|
|
251
|
+
type: 'session';
|
|
252
|
+
sessionKey: string;
|
|
253
|
+
seq: number;
|
|
254
|
+
patch: SnapshotPatch;
|
|
255
|
+
}
|
|
256
|
+
export interface ServerSessions {
|
|
257
|
+
type: 'sessions';
|
|
258
|
+
sessions: SessionMeta[];
|
|
259
|
+
}
|
|
260
|
+
export interface ServerHistory {
|
|
261
|
+
type: 'history';
|
|
262
|
+
sessionKey: string;
|
|
263
|
+
turns: UniversalSnapshot[];
|
|
264
|
+
ref?: string;
|
|
265
|
+
}
|
|
266
|
+
export interface ServerCatalog {
|
|
267
|
+
type: 'catalog';
|
|
268
|
+
agents: AgentInfo[];
|
|
269
|
+
agent?: string;
|
|
270
|
+
models: ModelDescriptor[];
|
|
271
|
+
effort: EffortOption[];
|
|
272
|
+
tools: ToolDescriptor[];
|
|
273
|
+
skills: SkillDescriptor[];
|
|
274
|
+
ref?: string;
|
|
275
|
+
}
|
|
276
|
+
export interface ServerAccepted {
|
|
277
|
+
type: 'accepted';
|
|
278
|
+
sessionKey: string;
|
|
279
|
+
taskId: string;
|
|
280
|
+
clientRef?: string;
|
|
281
|
+
}
|
|
282
|
+
export interface ServerError {
|
|
283
|
+
type: 'error';
|
|
284
|
+
message: string;
|
|
285
|
+
code?: string;
|
|
286
|
+
clientRef?: string;
|
|
287
|
+
}
|
|
288
|
+
export interface ServerPong {
|
|
289
|
+
type: 'pong';
|
|
290
|
+
t?: number;
|
|
291
|
+
}
|
|
292
|
+
export interface ServerTuiOpened {
|
|
293
|
+
type: 'tuiOpened';
|
|
294
|
+
tuiId: string;
|
|
295
|
+
ref?: string;
|
|
296
|
+
}
|
|
297
|
+
export interface ServerTuiData {
|
|
298
|
+
type: 'tuiData';
|
|
299
|
+
tuiId: string;
|
|
300
|
+
data: string;
|
|
301
|
+
}
|
|
302
|
+
export interface ServerTuiExit {
|
|
303
|
+
type: 'tuiExit';
|
|
304
|
+
tuiId: string;
|
|
305
|
+
exitCode: number;
|
|
306
|
+
signal?: number;
|
|
307
|
+
}
|
|
308
|
+
export type ServerMessage = ServerWelcome | ServerSession | ServerSessions | ServerHistory | ServerCatalog | ServerTuiOpened | ServerTuiData | ServerTuiExit | ServerAccepted | ServerError | ServerPong;
|
|
309
|
+
export declare function isClientMessage(value: unknown): value is ClientMessage;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The wire vocabulary shared by the kernel runtime and every transport/terminal.
|
|
2
|
+
// This is the SSOT shape: a driver-agnostic, accumulating snapshot of one session,
|
|
3
|
+
// plus a small set of control verbs. Ported from pikiloom's pikichannel protocol.
|
|
4
|
+
export const PROTOCOL_VERSION = 1;
|
|
5
|
+
export function emptySnapshot() {
|
|
6
|
+
return { phase: 'idle', updatedAt: 0 };
|
|
7
|
+
}
|
|
8
|
+
const APPEND_FIELDS = ['text', 'reasoning'];
|
|
9
|
+
const STRUCT_FIELDS = ['plan', 'toolCalls', 'subAgents', 'usage', 'artifacts', 'interactions', 'queued'];
|
|
10
|
+
const SCALAR_FIELDS = ['phase', 'taskId', 'sessionId', 'agent', 'model', 'effort', 'prompt', 'activity', 'error', 'incomplete', 'startedAt', 'updatedAt'];
|
|
11
|
+
export function diffSnapshot(prev, next) {
|
|
12
|
+
const patch = {};
|
|
13
|
+
let set;
|
|
14
|
+
// Coerce undefined -> null so a field-clear survives JSON serialization on the wire
|
|
15
|
+
// (JSON.stringify drops undefined-valued keys, which would otherwise leave the
|
|
16
|
+
// receiver's cumulative snapshot holding the previous turn's value).
|
|
17
|
+
const put = (k, v) => { (set ||= {})[k] = v === undefined ? null : v; };
|
|
18
|
+
for (const f of APPEND_FIELDS) {
|
|
19
|
+
const a = prev[f] ?? '';
|
|
20
|
+
const b = next[f] ?? '';
|
|
21
|
+
if (a === b)
|
|
22
|
+
continue;
|
|
23
|
+
if (typeof b === 'string' && typeof a === 'string' && b.startsWith(a)) {
|
|
24
|
+
if (f === 'text')
|
|
25
|
+
patch.appendText = b.slice(a.length);
|
|
26
|
+
else
|
|
27
|
+
patch.appendReasoning = b.slice(a.length);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
put(f, b);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
for (const f of SCALAR_FIELDS) {
|
|
34
|
+
if (prev[f] !== next[f])
|
|
35
|
+
put(f, next[f]);
|
|
36
|
+
}
|
|
37
|
+
for (const f of STRUCT_FIELDS) {
|
|
38
|
+
if (JSON.stringify(prev[f]) !== JSON.stringify(next[f]))
|
|
39
|
+
put(f, next[f]);
|
|
40
|
+
}
|
|
41
|
+
if (set)
|
|
42
|
+
patch.set = set;
|
|
43
|
+
return patch;
|
|
44
|
+
}
|
|
45
|
+
export function applySnapshotPatch(prev, patch) {
|
|
46
|
+
if (patch.full)
|
|
47
|
+
return patch.full;
|
|
48
|
+
const next = prev ? { ...prev } : emptySnapshot();
|
|
49
|
+
if (patch.appendText)
|
|
50
|
+
next.text = (next.text || '') + patch.appendText;
|
|
51
|
+
if (patch.appendReasoning)
|
|
52
|
+
next.reasoning = (next.reasoning || '') + patch.appendReasoning;
|
|
53
|
+
if (patch.set)
|
|
54
|
+
Object.assign(next, patch.set);
|
|
55
|
+
return next;
|
|
56
|
+
}
|
|
57
|
+
export function isClientMessage(value) {
|
|
58
|
+
return !!value && typeof value === 'object' && typeof value.type === 'string';
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type UniversalSnapshot, type SnapshotPatch, type SessionMeta, type AgentInfo, type ModelDescriptor, type EffortOption, type ToolDescriptor, type SkillDescriptor } from '../protocol/index.js';
|
|
2
|
+
import type { AgentDriver, TuiSpec } from '../contracts/driver.js';
|
|
3
|
+
import type { SessionStore, ModelResolver, ToolProvider, SystemPromptBuilder, InteractionHandler, Catalog } from '../contracts/ports.js';
|
|
4
|
+
import type { LoomIO, PromptInput, Plugin } from '../contracts/surface.js';
|
|
5
|
+
export interface HubDeps {
|
|
6
|
+
drivers: Map<string, AgentDriver>;
|
|
7
|
+
defaultAgent: string;
|
|
8
|
+
workdir: string;
|
|
9
|
+
sessionStore: SessionStore;
|
|
10
|
+
modelResolver: ModelResolver;
|
|
11
|
+
toolProvider: ToolProvider;
|
|
12
|
+
systemPromptBuilder: SystemPromptBuilder;
|
|
13
|
+
catalog: Catalog;
|
|
14
|
+
interactionHandler: InteractionHandler;
|
|
15
|
+
plugins: Plugin[];
|
|
16
|
+
serialPerSession?: boolean;
|
|
17
|
+
systemPromptBase?: string;
|
|
18
|
+
log?: (msg: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare class Hub implements LoomIO {
|
|
21
|
+
private readonly deps;
|
|
22
|
+
private readonly sessions;
|
|
23
|
+
private readonly runnersByTask;
|
|
24
|
+
private readonly active;
|
|
25
|
+
private readonly waiting;
|
|
26
|
+
private readonly seqByKey;
|
|
27
|
+
private readonly updateSubs;
|
|
28
|
+
private readonly sessionsSubs;
|
|
29
|
+
constructor(deps: HubDeps);
|
|
30
|
+
listAgents(): string[];
|
|
31
|
+
listAgentInfo(): AgentInfo[];
|
|
32
|
+
listModels(agent: string): Promise<ModelDescriptor[]>;
|
|
33
|
+
listEffort(agent: string, model?: string | null): Promise<EffortOption[]>;
|
|
34
|
+
listTools(agent: string, workdir?: string): Promise<ToolDescriptor[]>;
|
|
35
|
+
listSkills(agent: string, workdir?: string): Promise<SkillDescriptor[]>;
|
|
36
|
+
resolveTui(opts: {
|
|
37
|
+
agent?: string;
|
|
38
|
+
workdir?: string;
|
|
39
|
+
model?: string | null;
|
|
40
|
+
sessionId?: string | null;
|
|
41
|
+
}): Promise<TuiSpec>;
|
|
42
|
+
prompt(input: PromptInput): Promise<{
|
|
43
|
+
sessionKey: string;
|
|
44
|
+
taskId: string;
|
|
45
|
+
}>;
|
|
46
|
+
private enqueue;
|
|
47
|
+
private runNow;
|
|
48
|
+
private promoteNext;
|
|
49
|
+
private queueView;
|
|
50
|
+
private publishQueued;
|
|
51
|
+
private collectTools;
|
|
52
|
+
private mergeSpawn;
|
|
53
|
+
private pluginSpawn;
|
|
54
|
+
private composeSystemPrompt;
|
|
55
|
+
private onRunnerUpdate;
|
|
56
|
+
stop(sessionKey: string): boolean;
|
|
57
|
+
steer(taskId: string, prompt: string, attachments?: string[]): Promise<boolean>;
|
|
58
|
+
interact(promptId: string, action: 'select' | 'text' | 'skip' | 'cancel', value?: string): boolean;
|
|
59
|
+
subscribe(cb: (k: string, s: UniversalSnapshot, p: SnapshotPatch, seq: number) => void): () => void;
|
|
60
|
+
onSessionsChanged(cb: (s: SessionMeta[]) => void): () => void;
|
|
61
|
+
private emitSessionsChanged;
|
|
62
|
+
listSessions(): SessionMeta[];
|
|
63
|
+
getSnapshot(sessionKey: string): {
|
|
64
|
+
snapshot: UniversalSnapshot;
|
|
65
|
+
seq: number;
|
|
66
|
+
} | null;
|
|
67
|
+
getHistory(sessionKey: string): Promise<UniversalSnapshot[]>;
|
|
68
|
+
}
|