paseo-dsh-direct 0.1.4
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 +21 -0
- package/README.md +64 -0
- package/README.zh.md +64 -0
- package/dsh.svg +11 -0
- package/index.client.tsx +6 -0
- package/index.server.ts +19 -0
- package/package.json +80 -0
- package/paseo-plugin.json +10 -0
- package/scripts/build.mjs +31 -0
- package/scripts/install-lefthook.mjs +743 -0
- package/server/bridge-client.ts +416 -0
- package/server/dsh/bridge.ts +176 -0
- package/server/dsh/host.ts +204 -0
- package/server/dsh/service.ts +890 -0
- package/server/dsh-version.ts +71 -0
- package/server/plugin-version.ts +7 -0
- package/server/prompt-content.ts +120 -0
- package/server/provider.ts +1101 -0
- package/server/timeline.ts +487 -0
- package/server/turn-end.ts +41 -0
- package/server/values.ts +20 -0
- package/server/version-line.ts +50 -0
- package/shared/bridge-protocol.ts +232 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/** The package-owned JSONL boundary. No DSH or Node runtime imports. */
|
|
2
|
+
export const BRIDGE_PROTOCOL_VERSION = 1 as const;
|
|
3
|
+
export type JsonObject = Record<string, unknown>;
|
|
4
|
+
export interface ModelSelection {
|
|
5
|
+
provider: string;
|
|
6
|
+
model: string;
|
|
7
|
+
reasoningEffort?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DshSessionEvent {
|
|
10
|
+
type: string;
|
|
11
|
+
seq: number;
|
|
12
|
+
time: number;
|
|
13
|
+
data: JsonObject;
|
|
14
|
+
surfaceOp?: "append" | { op: "replace"; startSeq: number; endSeq: number };
|
|
15
|
+
sourceEventSeqs?: number[];
|
|
16
|
+
}
|
|
17
|
+
export type DshStreamFrame =
|
|
18
|
+
| {
|
|
19
|
+
type: "start";
|
|
20
|
+
attemptId: string;
|
|
21
|
+
revision: number;
|
|
22
|
+
turn: number;
|
|
23
|
+
step: number;
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
type: "chunk";
|
|
27
|
+
attemptId: string;
|
|
28
|
+
revision: number;
|
|
29
|
+
index: number;
|
|
30
|
+
time: number;
|
|
31
|
+
chunk: JsonObject;
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
type: "end";
|
|
35
|
+
attemptId: string;
|
|
36
|
+
revision: number;
|
|
37
|
+
index: number;
|
|
38
|
+
outcome:
|
|
39
|
+
| { kind: "abandoned" }
|
|
40
|
+
| {
|
|
41
|
+
kind: "committed";
|
|
42
|
+
eventType: "assistant/message" | "assistant/attempt";
|
|
43
|
+
seq: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export interface SessionSummary {
|
|
47
|
+
id: string;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
cwd?: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
parentSession?: string;
|
|
52
|
+
agentPreset?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SessionSnapshot {
|
|
55
|
+
session: SessionSummary;
|
|
56
|
+
events: DshSessionEvent[];
|
|
57
|
+
inheritedEventCount: number;
|
|
58
|
+
}
|
|
59
|
+
export interface BridgeCatalog {
|
|
60
|
+
models: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
provider: string;
|
|
63
|
+
model: string;
|
|
64
|
+
name: string;
|
|
65
|
+
providerName: string;
|
|
66
|
+
reasoningEfforts?: Array<{
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
}>;
|
|
71
|
+
}>;
|
|
72
|
+
presets: Array<{ id: string; name?: string; description?: string }>;
|
|
73
|
+
defaultModel?: ModelSelection;
|
|
74
|
+
defaultPreset?: string;
|
|
75
|
+
permissionPresets?: Array<{ id: string; name: string; description?: string }>;
|
|
76
|
+
defaultPermissionPreset?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface BridgeInitializeResult {
|
|
79
|
+
protocolVersion: 1;
|
|
80
|
+
profile: string;
|
|
81
|
+
capabilities: {
|
|
82
|
+
stream: true;
|
|
83
|
+
approvals: boolean;
|
|
84
|
+
questions: boolean;
|
|
85
|
+
history: true;
|
|
86
|
+
cancel: true;
|
|
87
|
+
};
|
|
88
|
+
catalog: BridgeCatalog;
|
|
89
|
+
}
|
|
90
|
+
export interface SessionOpenParams {
|
|
91
|
+
sessionId?: string;
|
|
92
|
+
resume?: boolean;
|
|
93
|
+
cwd: string;
|
|
94
|
+
model?: ModelSelection;
|
|
95
|
+
preset?: string;
|
|
96
|
+
permissionPreset?: string;
|
|
97
|
+
/** Appended to the DSH system prompt for this agent only. */
|
|
98
|
+
systemPrompt?: string;
|
|
99
|
+
/** Tool names approved without asking, e.g. `mcp__paseo__create_agent`. */
|
|
100
|
+
preapprovedTools?: string[];
|
|
101
|
+
}
|
|
102
|
+
export interface SessionOpenResult {
|
|
103
|
+
sessionId: string;
|
|
104
|
+
cwd: string;
|
|
105
|
+
model?: ModelSelection;
|
|
106
|
+
preset?: string;
|
|
107
|
+
permissionPreset?: string;
|
|
108
|
+
events: DshSessionEvent[];
|
|
109
|
+
}
|
|
110
|
+
export interface QuestionItem {
|
|
111
|
+
id: string;
|
|
112
|
+
question: string;
|
|
113
|
+
detail?: string;
|
|
114
|
+
header?: string;
|
|
115
|
+
options?: Array<{ label: string; description?: string }>;
|
|
116
|
+
multiSelect?: boolean;
|
|
117
|
+
intent?: { kind: "plan-review"; approve: string };
|
|
118
|
+
}
|
|
119
|
+
export interface QuestionAnswer {
|
|
120
|
+
id: string;
|
|
121
|
+
selected: string[];
|
|
122
|
+
custom?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface InteractionRequest {
|
|
125
|
+
sessionId: string;
|
|
126
|
+
requestId: string;
|
|
127
|
+
kind: "approval" | "questions";
|
|
128
|
+
callId?: string;
|
|
129
|
+
toolName?: string;
|
|
130
|
+
reason?: string;
|
|
131
|
+
questions?: QuestionItem[];
|
|
132
|
+
}
|
|
133
|
+
/** Prompt content; the bridge stores images and files in DSH's attachment store. */
|
|
134
|
+
export type PromptPart =
|
|
135
|
+
| { type: "text"; text: string }
|
|
136
|
+
| { type: "image"; mediaType: string; data: string; name?: string }
|
|
137
|
+
| { type: "file"; path: string; name?: string };
|
|
138
|
+
/** The line DSH parses as a slash command or a skill invocation. */
|
|
139
|
+
export function slashLine(name: string, args: string): string {
|
|
140
|
+
return args ? `/${name} ${args}` : `/${name}`;
|
|
141
|
+
}
|
|
142
|
+
/** One slash entry: a DSH registered command or a user-invocable skill. */
|
|
143
|
+
export interface SlashCommand {
|
|
144
|
+
name: string;
|
|
145
|
+
description: string;
|
|
146
|
+
argumentHint?: string;
|
|
147
|
+
kind: "command" | "skill";
|
|
148
|
+
}
|
|
149
|
+
export interface CommandResult {
|
|
150
|
+
kind: "success" | "error";
|
|
151
|
+
text?: string;
|
|
152
|
+
/** Whether the command left the agent running a model turn. */
|
|
153
|
+
running: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface BridgeMethods {
|
|
156
|
+
"bridge.initialize": { params: {}; result: BridgeInitializeResult };
|
|
157
|
+
"session.list": { params: {}; result: { sessions: SessionSummary[] } };
|
|
158
|
+
"session.read": { params: { sessionId: string }; result: SessionSnapshot };
|
|
159
|
+
"session.open": { params: SessionOpenParams; result: SessionOpenResult };
|
|
160
|
+
"session.prompt": {
|
|
161
|
+
params: { sessionId: string; content: PromptPart[] };
|
|
162
|
+
result: { messageId: string };
|
|
163
|
+
};
|
|
164
|
+
"session.steer": {
|
|
165
|
+
params: { sessionId: string; content: PromptPart[] };
|
|
166
|
+
result: { messageId: string };
|
|
167
|
+
};
|
|
168
|
+
"session.configure": {
|
|
169
|
+
params: {
|
|
170
|
+
sessionId: string;
|
|
171
|
+
model?: ModelSelection;
|
|
172
|
+
preset?: string;
|
|
173
|
+
permissionPreset?: string;
|
|
174
|
+
};
|
|
175
|
+
result: {
|
|
176
|
+
model?: ModelSelection;
|
|
177
|
+
preset?: string;
|
|
178
|
+
permissionPreset?: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
"session.commands": {
|
|
182
|
+
params: { sessionId: string };
|
|
183
|
+
result: { commands: SlashCommand[] };
|
|
184
|
+
};
|
|
185
|
+
"session.command": {
|
|
186
|
+
params: { sessionId: string; name: string; arguments: string };
|
|
187
|
+
result: CommandResult;
|
|
188
|
+
};
|
|
189
|
+
"session.rename": {
|
|
190
|
+
params: { sessionId: string; title: string };
|
|
191
|
+
result: {};
|
|
192
|
+
};
|
|
193
|
+
"session.cancel": { params: { sessionId: string }; result: {} };
|
|
194
|
+
"session.close": { params: { sessionId: string }; result: {} };
|
|
195
|
+
"interaction.respond": {
|
|
196
|
+
params: {
|
|
197
|
+
requestId: string;
|
|
198
|
+
outcome?: "allowed-once" | "rejected";
|
|
199
|
+
answers?: QuestionAnswer[];
|
|
200
|
+
};
|
|
201
|
+
result: {};
|
|
202
|
+
};
|
|
203
|
+
"bridge.shutdown": { params: {}; result: {} };
|
|
204
|
+
}
|
|
205
|
+
export interface BridgeNotifications {
|
|
206
|
+
"bridge.ready": { protocolVersion: 1 };
|
|
207
|
+
"session.event": { sessionId: string; event: DshSessionEvent };
|
|
208
|
+
"session.stream": { sessionId: string; frame: DshStreamFrame };
|
|
209
|
+
"session.status": { sessionId: string; status: "idle" | "running" };
|
|
210
|
+
"interaction.request": InteractionRequest;
|
|
211
|
+
"interaction.closed": { requestId: string; sessionId: string };
|
|
212
|
+
}
|
|
213
|
+
export interface RpcRequest {
|
|
214
|
+
jsonrpc: "2.0";
|
|
215
|
+
id: string | number;
|
|
216
|
+
method: keyof BridgeMethods;
|
|
217
|
+
params?: JsonObject;
|
|
218
|
+
}
|
|
219
|
+
export type RpcResponse =
|
|
220
|
+
| { jsonrpc: "2.0"; id: string | number; result: unknown }
|
|
221
|
+
| {
|
|
222
|
+
jsonrpc: "2.0";
|
|
223
|
+
id: string | number | null;
|
|
224
|
+
error: { code: number; message: string };
|
|
225
|
+
};
|
|
226
|
+
export type RpcNotification = {
|
|
227
|
+
[K in keyof BridgeNotifications]: {
|
|
228
|
+
jsonrpc: "2.0";
|
|
229
|
+
method: K;
|
|
230
|
+
params: BridgeNotifications[K];
|
|
231
|
+
};
|
|
232
|
+
}[keyof BridgeNotifications];
|