@hachej/boring-agent 0.1.42 → 0.1.44
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/{DebugDrawer-2PUDZ2RL.js → DebugDrawer-RYEBQ6CO.js} +1 -1
- package/dist/{agentPluginEvents-ZoOjcb5J.d.ts → agentPluginEvents-Dgm57gEU.d.ts} +15 -3
- package/dist/chatSubmitPayload-DHqQL2wD.d.ts +48 -0
- package/dist/{chunk-IUJ22EFB.js → chunk-BOIV2I3N.js} +2 -10
- package/dist/{chunk-VQ7VSSSX.js → chunk-HEEJSOFF.js} +8 -2
- package/dist/front/index.d.ts +24 -4
- package/dist/front/index.js +234 -118
- package/dist/front/styles.css +0 -6
- package/dist/piChatEvent-DNKo77Xw.d.ts +306 -0
- package/dist/server/index.d.ts +363 -94
- package/dist/server/index.js +1288 -170
- package/dist/shared/index.d.ts +37 -23
- package/dist/shared/index.js +1 -1
- package/docs/ERROR_CODES.md +4 -0
- package/package.json +2 -2
- package/dist/piChatEvent-Ck1BAE_m.d.ts +0 -323
- package/dist/session-BRovhe0D.d.ts +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as SessionStore } from './chatSubmitPayload-DHqQL2wD.js';
|
|
2
2
|
|
|
3
3
|
interface TelemetrySink {
|
|
4
4
|
capture(event: TelemetryEvent): void | Promise<void>;
|
|
@@ -229,6 +229,18 @@ type WorkspaceWatcherReadiness = {
|
|
|
229
229
|
reason: string;
|
|
230
230
|
message?: string;
|
|
231
231
|
};
|
|
232
|
+
interface WorkspaceWatchControlEvent {
|
|
233
|
+
type: 'resync-required';
|
|
234
|
+
reason: string;
|
|
235
|
+
}
|
|
236
|
+
interface WorkspaceWatchSubscribeOptions {
|
|
237
|
+
/**
|
|
238
|
+
* Called when the watcher detects a gap where changes may have been
|
|
239
|
+
* missed. Consumers should drop caches/refetch instead of trusting
|
|
240
|
+
* incremental events alone.
|
|
241
|
+
*/
|
|
242
|
+
onControlEvent?: (event: WorkspaceWatchControlEvent) => void;
|
|
243
|
+
}
|
|
232
244
|
interface WorkspaceWatcher {
|
|
233
245
|
/**
|
|
234
246
|
* Add a listener for change events. Returns an unsubscribe fn —
|
|
@@ -236,7 +248,7 @@ interface WorkspaceWatcher {
|
|
|
236
248
|
* itself is disposed, so unsubscribing one listener is cheap and
|
|
237
249
|
* does NOT tear down the watcher.
|
|
238
250
|
*/
|
|
239
|
-
subscribe(listener: (event: WorkspaceChangeEvent) => void): () => void;
|
|
251
|
+
subscribe(listener: (event: WorkspaceChangeEvent) => void, options?: WorkspaceWatchSubscribeOptions): () => void;
|
|
240
252
|
/**
|
|
241
253
|
* Optional readiness probe. Implementations with a startup guard
|
|
242
254
|
* (workspace-size check, native module availability, …) resolve it
|
|
@@ -465,4 +477,4 @@ interface CommandNotifyPayload {
|
|
|
465
477
|
command?: string;
|
|
466
478
|
}
|
|
467
479
|
|
|
468
|
-
export { type AgentTool as A, type CommandNotifyPayload as C, type Entry as E, type FileSearch as F, type IsolatedCodeInput as I, type JSONSchema as J, type PluginRestartWarning as P, type RunContext as R, type Sandbox as S, type TelemetryEvent as T, type Workspace as W, type AgentHarness as a, type ExecOptions as b, type ExecResult as c, type IsolatedCodeOutput as d, type SandboxCapability as e, type SandboxHandleRecord as f, type SandboxHandleStore as g, type SendMessageInput as h, type Stat as i, type TelemetrySink as j, type ToolExecContext as k, type ToolResult as l, WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT as m, WORKSPACE_COMMAND_NOTIFY_EVENT as n, type WorkspaceRuntimeContext as o, noopTelemetry as p, type
|
|
480
|
+
export { type AgentTool as A, type CommandNotifyPayload as C, type Entry as E, type FileSearch as F, type IsolatedCodeInput as I, type JSONSchema as J, type PluginRestartWarning as P, type RunContext as R, type Sandbox as S, type TelemetryEvent as T, type Workspace as W, type AgentHarness as a, type ExecOptions as b, type ExecResult as c, type IsolatedCodeOutput as d, type SandboxCapability as e, type SandboxHandleRecord as f, type SandboxHandleStore as g, type SendMessageInput as h, type Stat as i, type TelemetrySink as j, type ToolExecContext as k, type ToolResult as l, WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT as m, WORKSPACE_COMMAND_NOTIFY_EVENT as n, type WorkspaceRuntimeContext as o, noopTelemetry as p, type WorkspaceChangeEvent as q, type AgentHarnessFactory as r, safeCapture as s, type AgentHarnessFactoryInput as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
interface SessionStore {
|
|
2
|
+
list(ctx: SessionCtx, options?: SessionListOptions): Promise<SessionSummary[]>;
|
|
3
|
+
create(ctx: SessionCtx, init?: {
|
|
4
|
+
title?: string;
|
|
5
|
+
}): Promise<SessionSummary>;
|
|
6
|
+
load(ctx: SessionCtx, sessionId: string): Promise<SessionDetail>;
|
|
7
|
+
delete(ctx: SessionCtx, sessionId: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
interface SessionCtx {
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
userId?: string;
|
|
12
|
+
}
|
|
13
|
+
interface SessionListOptions {
|
|
14
|
+
limit?: number;
|
|
15
|
+
offset?: number;
|
|
16
|
+
includeId?: string;
|
|
17
|
+
}
|
|
18
|
+
interface SessionSummary {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
turnCount: number;
|
|
24
|
+
}
|
|
25
|
+
type SessionDetail = SessionSummary;
|
|
26
|
+
|
|
27
|
+
type ThinkingLevel = 'off' | 'low' | 'medium' | 'high';
|
|
28
|
+
interface ChatModelSelection {
|
|
29
|
+
provider: string;
|
|
30
|
+
id: string;
|
|
31
|
+
}
|
|
32
|
+
interface ChatAttachmentPayload {
|
|
33
|
+
filename?: string;
|
|
34
|
+
mediaType?: string;
|
|
35
|
+
url: string;
|
|
36
|
+
/** Workspace-relative path when the browser upload endpoint persisted the attachment. */
|
|
37
|
+
path?: string;
|
|
38
|
+
}
|
|
39
|
+
interface ChatSubmitPayload {
|
|
40
|
+
message: string;
|
|
41
|
+
displayMessage?: string;
|
|
42
|
+
clientNonce: string;
|
|
43
|
+
model?: ChatModelSelection;
|
|
44
|
+
thinkingLevel?: ThinkingLevel;
|
|
45
|
+
attachments?: ChatAttachmentPayload[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type { ChatAttachmentPayload as C, SessionCtx as S, ThinkingLevel as T, ChatModelSelection as a, ChatSubmitPayload as b, SessionDetail as c, SessionStore as d, SessionSummary as e };
|
|
@@ -81,17 +81,9 @@ function DebugValue({ label, value }) {
|
|
|
81
81
|
] });
|
|
82
82
|
}
|
|
83
83
|
function SessionTab({ sessionId }) {
|
|
84
|
-
const resumeCommand = `pi --session ${sessionId}`;
|
|
85
84
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 overflow-auto p-3 text-[11px] text-muted-foreground dark:text-zinc-300", children: [
|
|
86
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground dark:text-zinc-300", children: "This web chat is backed by a
|
|
87
|
-
/* @__PURE__ */ jsx(DebugValue, { label: "
|
|
88
|
-
/* @__PURE__ */ jsx(DebugValue, { label: "Resume command", value: resumeCommand }),
|
|
89
|
-
/* @__PURE__ */ jsxs("p", { className: "rounded-md border border-border/30 bg-muted/10 p-2 text-[10px] leading-relaxed text-muted-foreground dark:text-zinc-300", children: [
|
|
90
|
-
"Tip: ",
|
|
91
|
-
/* @__PURE__ */ jsx("code", { className: "font-mono text-foreground/80", children: "pi --continue" }),
|
|
92
|
-
" ",
|
|
93
|
-
"opens the most recent session for the current working directory. The explicit command above targets this session directly."
|
|
94
|
-
] })
|
|
85
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground dark:text-zinc-300", children: "This web chat is backed by a runtime session. Use the id below for support or debugging." }),
|
|
86
|
+
/* @__PURE__ */ jsx(DebugValue, { label: "Runtime session id", value: sessionId })
|
|
95
87
|
] });
|
|
96
88
|
}
|
|
97
89
|
var RETRY_DELAY_MS = 2500;
|
|
@@ -29,6 +29,7 @@ function extractToolUiMetadata(output) {
|
|
|
29
29
|
import { z } from "zod";
|
|
30
30
|
var ErrorCode = z.enum([
|
|
31
31
|
// Auth / config
|
|
32
|
+
"UNAUTHORIZED",
|
|
32
33
|
"MISSING_API_KEY",
|
|
33
34
|
"INVALID_API_KEY",
|
|
34
35
|
"OIDC_REFRESH_FAILED",
|
|
@@ -54,8 +55,12 @@ var ErrorCode = z.enum([
|
|
|
54
55
|
"SANDBOX_NOT_READY",
|
|
55
56
|
"SANDBOX_EXPIRED",
|
|
56
57
|
"VERCEL_API_ERROR",
|
|
58
|
+
"REMOTE_WORKER_TIMEOUT",
|
|
59
|
+
"REMOTE_WORKER_STREAM_CLOSED",
|
|
57
60
|
"CIRCUIT_OPEN",
|
|
58
61
|
"ABORTED",
|
|
62
|
+
// Billing / metering
|
|
63
|
+
"PAYMENT_REQUIRED",
|
|
59
64
|
// Session / bridge
|
|
60
65
|
"SESSION_NOT_FOUND",
|
|
61
66
|
"SESSION_LOCKED",
|
|
@@ -208,7 +213,7 @@ var PiChatSnapshotSchema = z2.object({
|
|
|
208
213
|
var baseEvent = z2.object({ seq: seqNumber });
|
|
209
214
|
var PiChatEventSchema = z2.discriminatedUnion("type", [
|
|
210
215
|
baseEvent.extend({ type: z2.literal("agent-start"), turnId: nonEmptyString }),
|
|
211
|
-
baseEvent.extend({ type: z2.literal("agent-end"), turnId: nonEmptyString, status: z2.enum(["ok", "aborted", "error"]) }),
|
|
216
|
+
baseEvent.extend({ type: z2.literal("agent-end"), turnId: nonEmptyString, status: z2.enum(["ok", "aborted", "error"]), willRetry: z2.boolean().optional() }),
|
|
212
217
|
baseEvent.extend({
|
|
213
218
|
type: z2.literal("message-start"),
|
|
214
219
|
messageId: nonEmptyString,
|
|
@@ -286,7 +291,8 @@ var ThinkingLevelSchema = z2.enum(["off", "low", "medium", "high"]);
|
|
|
286
291
|
var ChatAttachmentPayloadSchema = z2.object({
|
|
287
292
|
filename: z2.string().optional(),
|
|
288
293
|
mediaType: z2.string().optional(),
|
|
289
|
-
url: nonEmptyString
|
|
294
|
+
url: nonEmptyString,
|
|
295
|
+
path: z2.string().optional()
|
|
290
296
|
});
|
|
291
297
|
var PromptPayloadSchema = z2.object({
|
|
292
298
|
message: z2.string().min(1).max(1e6),
|
package/dist/front/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FileUIPart, UIMessage, ChatStatus } from 'ai';
|
|
3
2
|
import * as react from 'react';
|
|
4
3
|
import { ComponentType, ReactNode, HTMLAttributes, ComponentProps, FormEvent } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { FileUIPart, UIMessage, ChatStatus } from 'ai';
|
|
5
|
+
import { T as ToolUiMetadata, B as BoringChatPart, d as BoringChatMessage, m as PiChatStatus, r as QueuedUserMessage, C as ChatError, P as PiChatEvent, o as PromptPayload, p as PromptReceipt, F as FollowUpPayload, i as FollowUpReceipt, Q as QueueClearPayload, q as QueueClearReceipt, I as InterruptPayload, e as CommandReceipt, S as StopPayload, s as StopReceipt } from '../piChatEvent-DNKo77Xw.js';
|
|
6
|
+
import { e as SessionSummary } from '../chatSubmitPayload-DHqQL2wD.js';
|
|
7
7
|
import { Button, Collapsible, CollapsibleContent, CollapsibleTrigger, InputGroupAddon, InputGroupButton, InputGroupTextarea } from '@hachej/boring-ui-kit';
|
|
8
8
|
import { Streamdown } from 'streamdown';
|
|
9
9
|
import { StickToBottom } from 'use-stick-to-bottom';
|
|
@@ -15,6 +15,7 @@ interface UploadFileOptions {
|
|
|
15
15
|
workspaceRequestId?: string | null;
|
|
16
16
|
directory?: string;
|
|
17
17
|
sourcePath?: string;
|
|
18
|
+
fetch?: typeof globalThis.fetch;
|
|
18
19
|
}
|
|
19
20
|
interface UploadFileResult {
|
|
20
21
|
url: string;
|
|
@@ -238,6 +239,10 @@ interface PiChatRuntimeNotice {
|
|
|
238
239
|
level: 'info' | 'warning' | 'error';
|
|
239
240
|
text: string;
|
|
240
241
|
dismissible?: boolean;
|
|
242
|
+
/** Stable, canonical server error code (a shared ErrorCode enum member) when this
|
|
243
|
+
* notice came from a rejected run. Lets a host render a recovery action for a specific
|
|
244
|
+
* code without the agent knowing what the code means. */
|
|
245
|
+
errorCode?: string;
|
|
241
246
|
}
|
|
242
247
|
interface PiChatRetryNotice {
|
|
243
248
|
attempt: number;
|
|
@@ -386,6 +391,7 @@ declare class RemotePiSession {
|
|
|
386
391
|
private connectEvents;
|
|
387
392
|
private runEventStream;
|
|
388
393
|
private rehydrateAfterStreamReset;
|
|
394
|
+
private ensureReconnectScheduled;
|
|
389
395
|
private scheduleReconnect;
|
|
390
396
|
private postCommand;
|
|
391
397
|
private rollbackOptimisticMessage;
|
|
@@ -501,6 +507,8 @@ interface ChatPanelEmptyState {
|
|
|
501
507
|
eyebrow?: string;
|
|
502
508
|
title?: string;
|
|
503
509
|
description?: string;
|
|
510
|
+
/** Optional content rendered below the suggestion grid (e.g. a footer link). */
|
|
511
|
+
footer?: ReactNode;
|
|
504
512
|
}
|
|
505
513
|
interface PiChatPanelProps {
|
|
506
514
|
/** Optional externally selected Pi session id. When provided, session navigation is owned by the host. */
|
|
@@ -530,6 +538,9 @@ interface PiChatPanelProps {
|
|
|
530
538
|
model?: ModelSelection | null;
|
|
531
539
|
defaultModel?: ModelSelection;
|
|
532
540
|
availableModels?: AvailableModel[];
|
|
541
|
+
hideDefaultModelOption?: boolean;
|
|
542
|
+
hideComposerSettings?: boolean;
|
|
543
|
+
suppressPreSubmitCancelledWarning?: boolean;
|
|
533
544
|
thinkingLevel?: ThinkingLevel;
|
|
534
545
|
thinkingControl?: boolean;
|
|
535
546
|
serverResourcesEnabled?: boolean;
|
|
@@ -553,8 +564,16 @@ interface PiChatPanelProps {
|
|
|
553
564
|
composerBlockers?: ComposerBlocker[];
|
|
554
565
|
onComposerStop?: () => void;
|
|
555
566
|
onComposerBlockerAction?: (blocker: ComposerBlocker, action: string) => void;
|
|
567
|
+
/** Fired once each time a run settles (busy → idle). Hosts use it to refresh
|
|
568
|
+
* out-of-band state after a turn (e.g. a usage/quota indicator). The agent stays
|
|
569
|
+
* agnostic about what the host does with it. */
|
|
570
|
+
onTurnComplete?: () => void;
|
|
571
|
+
/** Host-supplied action node for a runtime notice, keyed off notice.errorCode.
|
|
572
|
+
* Lets a host attach a recovery action for a specific error code without the agent
|
|
573
|
+
* knowing what the code means or what the action does. */
|
|
574
|
+
renderNoticeAction?: (notice: PiChatRuntimeNotice) => ReactNode;
|
|
556
575
|
}
|
|
557
|
-
declare function PiChatPanel({ sessionId, extraCommands, apiBaseUrl, workspaceId, storageScope, requestHeaders, storage, fetch, className, chrome, debug, showSessions, hotReloadEnabled, suggestions, emptyState, emptyPlacement, composerPlaceholder, initialDraft, autoSubmitInitialDraft, onDraftRestored, onAutoSubmitInitialDraftAccepted, onAutoSubmitInitialDraftSettled, model, defaultModel, availableModels, thinkingLevel, thinkingControl, serverResourcesEnabled, mentionedFiles, commands, excludeBuiltinCommands, toolRenderers, createRemoteSession, remoteSessionOptions, hydrateMessages, workspaceWarmupStatus, onSessionReset, onBeforeSubmit, onReloadAgentPlugins, onCommandResult, onComposerWarning, onMentionedFilesConsumed, onData, onOpenArtifact, composerBlockers, onComposerStop, onComposerBlockerAction, }: PiChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
576
|
+
declare function PiChatPanel({ sessionId, extraCommands, apiBaseUrl, workspaceId, storageScope, requestHeaders, storage, fetch, className, chrome, debug, showSessions, hotReloadEnabled, suggestions, emptyState, emptyPlacement, composerPlaceholder, initialDraft, autoSubmitInitialDraft, onDraftRestored, onAutoSubmitInitialDraftAccepted, onAutoSubmitInitialDraftSettled, model, defaultModel, availableModels, hideDefaultModelOption, hideComposerSettings, suppressPreSubmitCancelledWarning, thinkingLevel, thinkingControl, serverResourcesEnabled, mentionedFiles, commands, excludeBuiltinCommands, toolRenderers, createRemoteSession, remoteSessionOptions, hydrateMessages, workspaceWarmupStatus, onSessionReset, onBeforeSubmit, onReloadAgentPlugins, onCommandResult, onComposerWarning, onMentionedFilesConsumed, onData, onOpenArtifact, composerBlockers, onComposerStop, onComposerBlockerAction, onTurnComplete, renderNoticeAction, }: PiChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
558
577
|
|
|
559
578
|
interface DebugDrawerProps {
|
|
560
579
|
apiBaseUrl?: string;
|
|
@@ -678,6 +697,7 @@ type PromptInputProps = Omit<HTMLAttributes<HTMLFormElement>, "onSubmit" | "onEr
|
|
|
678
697
|
* attachment URL is replaced with the stable server path before submit. */
|
|
679
698
|
onUploadFile?: (file: File) => Promise<{
|
|
680
699
|
url: string;
|
|
700
|
+
path?: string;
|
|
681
701
|
}>;
|
|
682
702
|
};
|
|
683
703
|
declare const PromptInput: ({ className, accept, multiple, globalDrop, syncHiddenInput, maxFiles, maxFileSize, onError, onSubmit, onUploadFile, children, ...props }: PromptInputProps) => react_jsx_runtime.JSX.Element;
|