@hachej/boring-agent 0.1.63 → 0.1.65
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/{agentPluginEvents-Ddn5DQ5E.d.ts → agentPluginEvents-ChUzG2Lh.d.ts} +3 -134
- package/dist/chatSubmitPayload-DwOHyiqR.d.ts +22 -0
- package/dist/chunk-4LXA7OOV.js +290 -0
- package/dist/chunk-AJZHR626.js +85 -0
- package/dist/chunk-AQBXNPMD.js +17 -0
- package/dist/chunk-HHW2UNBK.js +1812 -0
- package/dist/chunk-NKP5AR4C.js +2755 -0
- package/dist/chunk-WSQ5QNIY.js +18 -0
- package/dist/chunk-XZKU7FBV.js +96 -0
- package/dist/{chunk-HDOSWEXG.js → chunk-ZD7MM2LQ.js} +0 -15
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.js +15 -0
- package/dist/createHarness-LA2OO2DL.js +17 -0
- package/dist/front/index.d.ts +32 -27
- package/dist/front/index.js +84 -30
- package/dist/front/styles.css +67 -70
- package/dist/harness-DN9KdrT7.d.ts +265 -0
- package/dist/piChatCommand-C5ZM-AMG.d.ts +40 -0
- package/dist/{piChatEvent-B6GDifo2.d.ts → piChatEvent-B6Lg9ft-.d.ts} +88 -98
- package/dist/server/index.d.ts +238 -6
- package/dist/server/index.js +3294 -6225
- package/dist/shared/index.d.ts +212 -208
- package/dist/shared/index.js +21 -9
- package/docs/ERROR_CODES.md +3 -0
- package/docs/plans/archive/harness-followup-capabilities.md +1 -1
- package/docs/plans/archive/pi-tools-migration.md +1 -1
- package/docs/plans/archive/vercel-persistent-sandbox-adapter.md +1 -1
- package/docs/runtime.md +22 -9
- package/package.json +39 -34
- package/dist/chatSubmitPayload-DHqQL2wD.d.ts +0 -48
- package/dist/chunk-G6YPXDHR.js +0 -376
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { S as SessionCtx, P as PiChatEvent, a as SessionStore } from './piChatEvent-B6Lg9ft-.js';
|
|
2
|
+
import { AgentSessionEvent, PromptOptions } from '@mariozechner/pi-coding-agent';
|
|
3
|
+
|
|
4
|
+
interface TelemetrySink {
|
|
5
|
+
capture(event: TelemetryEvent): void | Promise<void>;
|
|
6
|
+
flush?(): void | Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
interface TelemetryEvent {
|
|
9
|
+
name: string;
|
|
10
|
+
distinctId?: string;
|
|
11
|
+
properties?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
declare const noopTelemetry: TelemetrySink;
|
|
14
|
+
declare function safeCapture(telemetry: TelemetrySink, event: TelemetryEvent): void;
|
|
15
|
+
|
|
16
|
+
type JSONSchema = Record<string, unknown>;
|
|
17
|
+
type ToolReadinessRequirement = 'workspace-fs' | 'sandbox-exec' | 'ui-bridge' | 'runtime-dependencies' | `runtime:${string}`;
|
|
18
|
+
interface AgentTool {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
/** Optional one-line prompt entry. Pi-built tools should preserve pi's snippet verbatim. */
|
|
22
|
+
promptSnippet?: string;
|
|
23
|
+
readinessRequirements?: ToolReadinessRequirement[];
|
|
24
|
+
parameters: JSONSchema;
|
|
25
|
+
execute(params: Record<string, unknown>, ctx: ToolExecContext): Promise<ToolResult>;
|
|
26
|
+
}
|
|
27
|
+
interface ToolExecContext {
|
|
28
|
+
abortSignal: AbortSignal;
|
|
29
|
+
toolCallId: string;
|
|
30
|
+
onUpdate?: (partial: string) => void;
|
|
31
|
+
/** Agent chat/session id executing this tool, when known. */
|
|
32
|
+
sessionId?: string;
|
|
33
|
+
/** Authenticated human user executing this tool, when known. */
|
|
34
|
+
userId?: string;
|
|
35
|
+
userEmail?: string;
|
|
36
|
+
userEmailVerified?: boolean;
|
|
37
|
+
workspaceId?: string;
|
|
38
|
+
requestId?: string;
|
|
39
|
+
}
|
|
40
|
+
interface ToolResult {
|
|
41
|
+
content: Array<{
|
|
42
|
+
type: 'text';
|
|
43
|
+
text: string;
|
|
44
|
+
}>;
|
|
45
|
+
isError?: boolean;
|
|
46
|
+
details?: unknown;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare const AGENT_NOT_IMPLEMENTED_UNTIL_T1: "ERR_NOT_IMPLEMENTED_UNTIL_T1";
|
|
50
|
+
interface MessageAttachment {
|
|
51
|
+
filename?: string;
|
|
52
|
+
mediaType?: string;
|
|
53
|
+
/** data: URL or remote URL */
|
|
54
|
+
url: string;
|
|
55
|
+
}
|
|
56
|
+
interface AgentActor {
|
|
57
|
+
id?: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
}
|
|
60
|
+
interface AgentMessagePart {
|
|
61
|
+
type: string;
|
|
62
|
+
text?: string;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
type AgentMessageContent = string | AgentMessagePart[];
|
|
66
|
+
interface AgentSendInput {
|
|
67
|
+
sessionId?: string;
|
|
68
|
+
content?: AgentMessageContent;
|
|
69
|
+
/** @deprecated Use content. Present for the P1 SendMessageInput rename window. */
|
|
70
|
+
message?: string;
|
|
71
|
+
attachments?: MessageAttachment[];
|
|
72
|
+
actor?: AgentActor;
|
|
73
|
+
ctx?: SessionCtx;
|
|
74
|
+
originSurface?: string;
|
|
75
|
+
thinkingLevel?: 'off' | 'low' | 'medium' | 'high';
|
|
76
|
+
model?: {
|
|
77
|
+
provider: string;
|
|
78
|
+
id: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
interface AgentStartReceipt {
|
|
82
|
+
sessionId: string;
|
|
83
|
+
startIndex: number;
|
|
84
|
+
}
|
|
85
|
+
interface AgentStreamOptions {
|
|
86
|
+
startIndex: number;
|
|
87
|
+
ctx?: SessionCtx;
|
|
88
|
+
}
|
|
89
|
+
interface AgentEvent {
|
|
90
|
+
v: 1;
|
|
91
|
+
eventIndex: number;
|
|
92
|
+
timestamp: number;
|
|
93
|
+
sessionId: string;
|
|
94
|
+
chunk: PiChatEvent;
|
|
95
|
+
}
|
|
96
|
+
declare function sessionStreamPath(sessionId: string): string;
|
|
97
|
+
interface AgentResolveInputResponse {
|
|
98
|
+
approved?: boolean;
|
|
99
|
+
content?: string;
|
|
100
|
+
value?: unknown;
|
|
101
|
+
}
|
|
102
|
+
interface AgentRuntimeAdapter {
|
|
103
|
+
readonly id: string;
|
|
104
|
+
dispose?(): void | Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
interface AgentReadinessStatus {
|
|
107
|
+
key: string;
|
|
108
|
+
ready: boolean;
|
|
109
|
+
message?: string;
|
|
110
|
+
}
|
|
111
|
+
interface AgentReadiness {
|
|
112
|
+
requirements: string[];
|
|
113
|
+
status(): Promise<AgentReadinessStatus[]>;
|
|
114
|
+
}
|
|
115
|
+
interface AgentConfig {
|
|
116
|
+
harnessFactory?: AgentCoreHarnessFactory;
|
|
117
|
+
runtime: AgentRuntimeAdapter | 'none';
|
|
118
|
+
tools?: AgentTool[];
|
|
119
|
+
readinessRequirements?: string[];
|
|
120
|
+
sessions?: SessionStore;
|
|
121
|
+
systemPromptAppend?: string;
|
|
122
|
+
systemPromptDynamic?: () => string | undefined | Promise<string | undefined>;
|
|
123
|
+
telemetry?: TelemetrySink;
|
|
124
|
+
metering?: unknown;
|
|
125
|
+
sessionStorageRoot?: string;
|
|
126
|
+
workdir?: string;
|
|
127
|
+
}
|
|
128
|
+
interface Agent {
|
|
129
|
+
start(input: AgentSendInput): Promise<AgentStartReceipt>;
|
|
130
|
+
stream(sessionId: string, options: AgentStreamOptions): AsyncIterable<AgentEvent>;
|
|
131
|
+
send(input: AgentSendInput): AsyncIterable<AgentEvent>;
|
|
132
|
+
resolveInput(sessionId: string, requestId: string, response: AgentResolveInputResponse): Promise<never>;
|
|
133
|
+
interrupt(sessionId: string, ctx?: SessionCtx): Promise<unknown>;
|
|
134
|
+
stop(sessionId: string, ctx?: SessionCtx): Promise<unknown>;
|
|
135
|
+
sessions: SessionStore;
|
|
136
|
+
readiness: AgentReadiness;
|
|
137
|
+
dispose(): Promise<void>;
|
|
138
|
+
}
|
|
139
|
+
declare class AgentNotImplementedError extends Error {
|
|
140
|
+
readonly code: "ERR_NOT_IMPLEMENTED_UNTIL_T1";
|
|
141
|
+
constructor(message?: string);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface AgentHarnessFactoryInput {
|
|
145
|
+
tools: AgentTool[];
|
|
146
|
+
/** Host/storage cwd used for harness-owned filesystem resources. */
|
|
147
|
+
cwd: string;
|
|
148
|
+
/** Agent-visible cwd used by Pi/system prompt/session metadata. */
|
|
149
|
+
runtimeCwd?: string;
|
|
150
|
+
systemPromptAppend?: string;
|
|
151
|
+
sessionNamespace?: string;
|
|
152
|
+
sessionRoot?: string;
|
|
153
|
+
sessionDir?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Optional dynamic system-prompt source. Harness calls it whenever it
|
|
156
|
+
* builds or rebuilds a session prompt and appends the returned string.
|
|
157
|
+
* Workspace plugin layer wires this so live-reloaded plugins can contribute
|
|
158
|
+
* prompt context without a workspace-injected harness extension.
|
|
159
|
+
*/
|
|
160
|
+
systemPromptDynamic?: () => string | undefined | Promise<string | undefined>;
|
|
161
|
+
/** Host-provided telemetry sink. Optional and best-effort; harnesses may ignore it. */
|
|
162
|
+
telemetry?: TelemetrySink;
|
|
163
|
+
}
|
|
164
|
+
type AgentHarnessFactory = (input: AgentHarnessFactoryInput) => AgentHarness | Promise<AgentHarness>;
|
|
165
|
+
interface AgentCoreSessionSnapshot {
|
|
166
|
+
state: unknown;
|
|
167
|
+
messages: readonly unknown[];
|
|
168
|
+
isStreaming: boolean;
|
|
169
|
+
isRetrying: boolean;
|
|
170
|
+
retryAttempt: number;
|
|
171
|
+
pendingMessageCount: number;
|
|
172
|
+
steeringMessages: readonly string[];
|
|
173
|
+
followUpMessages: readonly string[];
|
|
174
|
+
followUpMode: 'all' | 'one-at-a-time';
|
|
175
|
+
sessionId: string;
|
|
176
|
+
sessionName?: string;
|
|
177
|
+
}
|
|
178
|
+
type AgentCorePromptInput = string | {
|
|
179
|
+
text: string;
|
|
180
|
+
options?: PromptOptions;
|
|
181
|
+
};
|
|
182
|
+
interface AgentCoreSessionAdapter {
|
|
183
|
+
readSnapshot(): AgentCoreSessionSnapshot;
|
|
184
|
+
subscribe(listener: (event: AgentSessionEvent) => void): () => void;
|
|
185
|
+
prompt(input: AgentCorePromptInput): Promise<void>;
|
|
186
|
+
followUp(text: string, options?: never): Promise<void>;
|
|
187
|
+
clearFollowUp(options?: never): void;
|
|
188
|
+
abort(): Promise<void>;
|
|
189
|
+
abortRetry?: () => void;
|
|
190
|
+
continueQueuedFollowUp?: () => Promise<void>;
|
|
191
|
+
}
|
|
192
|
+
type AgentCoreHarness = AgentHarness & {
|
|
193
|
+
getPiSessionAdapter(input: AgentSendInput, ctx: RunContext): Promise<AgentCoreSessionAdapter>;
|
|
194
|
+
hasPiSession?: (sessionId: string, ctx?: {
|
|
195
|
+
workspaceId?: string;
|
|
196
|
+
userId?: string;
|
|
197
|
+
}) => boolean;
|
|
198
|
+
};
|
|
199
|
+
type AgentCoreHarnessFactory = (input: AgentHarnessFactoryInput) => AgentCoreHarness | Promise<AgentCoreHarness>;
|
|
200
|
+
interface AgentHarness {
|
|
201
|
+
readonly id: string;
|
|
202
|
+
readonly placement: 'server' | 'browser';
|
|
203
|
+
/** Session lifecycle; may delegate to an underlying runtime (e.g. pi's JSONL). */
|
|
204
|
+
sessions: SessionStore;
|
|
205
|
+
/**
|
|
206
|
+
* Resolved system prompt currently in effect for `sessionId`. Returns
|
|
207
|
+
* `undefined` when the underlying runtime hasn't yet instantiated a
|
|
208
|
+
* session (typical pre-first-turn state — pi creates lazily on the first
|
|
209
|
+
* prompt). Optional so non-pi harnesses can opt out cleanly.
|
|
210
|
+
*/
|
|
211
|
+
getSystemPrompt?: (sessionId: string) => string | undefined;
|
|
212
|
+
/** Reload native agent resources/extensions for an existing session. */
|
|
213
|
+
reloadSession?: (sessionId: string) => Promise<boolean>;
|
|
214
|
+
/**
|
|
215
|
+
* Resource (skill/extension) load diagnostics for an existing session.
|
|
216
|
+
* Returns `[]` when the session has no live agent session yet. Lets the
|
|
217
|
+
* /reload route and the `plugin_diagnostics` tool surface silent
|
|
218
|
+
* skill/extension load failures back to the UI and the agent.
|
|
219
|
+
*/
|
|
220
|
+
getResourceDiagnostics?: (sessionId: string) => Array<{
|
|
221
|
+
source: string;
|
|
222
|
+
message: string;
|
|
223
|
+
path?: string;
|
|
224
|
+
}>;
|
|
225
|
+
/** List slash commands registered in the agent runtime for a given session. */
|
|
226
|
+
getSlashCommands?: (sessionId: string, ctx: RunContext) => ReadonlyArray<AgentSlashCommandSummary> | Promise<ReadonlyArray<AgentSlashCommandSummary>>;
|
|
227
|
+
/**
|
|
228
|
+
* Execute a named slash command registered via `pi.registerCommand` in a
|
|
229
|
+
* plugin extension. Calls the handler in-process; the handler may dispatch
|
|
230
|
+
* UI commands (openPanel, notify) through the workspace bridge. Throws if
|
|
231
|
+
* the command is not found or the handler throws.
|
|
232
|
+
*/
|
|
233
|
+
executeSlashCommand?: (sessionId: string, name: string, args: string, ctx: RunContext) => Promise<void>;
|
|
234
|
+
}
|
|
235
|
+
interface AgentSlashCommandSummary {
|
|
236
|
+
name: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
source: 'extension' | 'prompt' | 'skill';
|
|
239
|
+
/**
|
|
240
|
+
* Name of the originating plugin/package, when derivable from Pi's
|
|
241
|
+
* sourceInfo (e.g. a `.pi/extensions/<name>` runtime plugin, or an
|
|
242
|
+
* `npm:`/`git/` package). Surfaced as a tag in the slash-command picker.
|
|
243
|
+
* Absent for built-in/top-level commands with no package origin.
|
|
244
|
+
*/
|
|
245
|
+
sourcePlugin?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** @deprecated Use AgentSendInput.content. Kept so existing shared consumers compile during the P1 rename. */
|
|
249
|
+
type SendMessageInput = AgentSendInput & {
|
|
250
|
+
sessionId: string;
|
|
251
|
+
message: string;
|
|
252
|
+
};
|
|
253
|
+
interface RunContext {
|
|
254
|
+
abortSignal: AbortSignal;
|
|
255
|
+
workdir: string;
|
|
256
|
+
workspaceId?: string;
|
|
257
|
+
requestId?: string;
|
|
258
|
+
userId?: string;
|
|
259
|
+
userEmail?: string;
|
|
260
|
+
userEmailVerified?: boolean;
|
|
261
|
+
/** When false, slash-command fallback through native model prompt must fail closed. */
|
|
262
|
+
allowPromptDispatch?: boolean;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export { type AgentTool as A, sessionStreamPath as B, type ToolReadinessRequirement as C, type AgentHarnessFactory as D, type AgentHarnessFactoryInput as E, type JSONSchema as J, type MessageAttachment as M, type RunContext as R, type SendMessageInput as S, type TelemetryEvent as T, AGENT_NOT_IMPLEMENTED_UNTIL_T1 as a, type Agent as b, type AgentActor as c, type AgentCoreHarness as d, type AgentCoreHarnessFactory as e, type AgentCorePromptInput as f, type AgentCoreSessionAdapter as g, type AgentCoreSessionSnapshot as h, type AgentEvent as i, type AgentHarness as j, type AgentMessageContent as k, type AgentMessagePart as l, AgentNotImplementedError as m, type AgentReadiness as n, type AgentReadinessStatus as o, type AgentResolveInputResponse as p, type AgentRuntimeAdapter as q, type AgentSendInput as r, type AgentStartReceipt as s, type AgentStreamOptions as t, type AgentConfig as u, type TelemetrySink as v, type ToolExecContext as w, type ToolResult as x, noopTelemetry as y, safeCapture as z };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { C as ChatSubmitPayload } from './chatSubmitPayload-DwOHyiqR.js';
|
|
2
|
+
import { Q as QueuedUserMessage } from './piChatEvent-B6Lg9ft-.js';
|
|
3
|
+
|
|
4
|
+
type PromptPayload = ChatSubmitPayload;
|
|
5
|
+
interface FollowUpPayload {
|
|
6
|
+
message: string;
|
|
7
|
+
displayMessage?: string;
|
|
8
|
+
clientNonce: string;
|
|
9
|
+
clientSeq: number;
|
|
10
|
+
}
|
|
11
|
+
interface QueueClearPayload {
|
|
12
|
+
clientNonce?: string;
|
|
13
|
+
clientSeq?: number;
|
|
14
|
+
}
|
|
15
|
+
type InterruptPayload = Record<string, never>;
|
|
16
|
+
type StopPayload = Record<string, never>;
|
|
17
|
+
interface CommandReceipt {
|
|
18
|
+
accepted: true;
|
|
19
|
+
cursor: number;
|
|
20
|
+
}
|
|
21
|
+
type PromptReceipt = CommandReceipt & {
|
|
22
|
+
clientNonce: string;
|
|
23
|
+
duplicate?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type FollowUpReceipt = CommandReceipt & {
|
|
26
|
+
clientNonce: string;
|
|
27
|
+
clientSeq: number;
|
|
28
|
+
queued: true;
|
|
29
|
+
duplicate?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type QueueClearReceipt = CommandReceipt & {
|
|
32
|
+
cleared: number;
|
|
33
|
+
};
|
|
34
|
+
type InterruptReceipt = CommandReceipt;
|
|
35
|
+
type StopReceipt = CommandReceipt & {
|
|
36
|
+
stopped: boolean;
|
|
37
|
+
clearedQueue: QueuedUserMessage[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type { CommandReceipt as C, FollowUpPayload as F, InterruptPayload as I, PromptPayload as P, QueueClearPayload as Q, StopPayload as S, FollowUpReceipt as a, InterruptReceipt as b, PromptReceipt as c, QueueClearReceipt as d, StopReceipt as e };
|