@hachej/boring-agent 0.1.42 → 0.1.43
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-DP-vLNCs.d.ts} +15 -3
- package/dist/{session-BRovhe0D.d.ts → chatSubmitPayload-gC61O4Ni.d.ts} +20 -1
- package/dist/{chunk-IUJ22EFB.js → chunk-BOIV2I3N.js} +2 -10
- package/dist/{chunk-VQ7VSSSX.js → chunk-YUDMSYAO.js} +6 -1
- package/dist/front/index.d.ts +22 -5
- package/dist/front/index.js +155 -103
- package/dist/front/styles.css +0 -6
- package/dist/piChatEvent-DR9a-FVz.d.ts +306 -0
- package/dist/server/index.d.ts +363 -94
- package/dist/server/index.js +1234 -154
- package/dist/shared/index.d.ts +29 -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as SessionStore } from './chatSubmitPayload-gC61O4Ni.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 };
|
|
@@ -24,4 +24,23 @@ interface SessionSummary {
|
|
|
24
24
|
}
|
|
25
25
|
type SessionDetail = SessionSummary;
|
|
26
26
|
|
|
27
|
-
|
|
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
|
+
}
|
|
37
|
+
interface ChatSubmitPayload {
|
|
38
|
+
message: string;
|
|
39
|
+
displayMessage?: string;
|
|
40
|
+
clientNonce: string;
|
|
41
|
+
model?: ChatModelSelection;
|
|
42
|
+
thinkingLevel?: ThinkingLevel;
|
|
43
|
+
attachments?: ChatAttachmentPayload[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
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,
|
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-DR9a-FVz.js';
|
|
6
|
+
import { e as SessionSummary } from '../chatSubmitPayload-gC61O4Ni.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';
|
|
@@ -238,6 +238,10 @@ interface PiChatRuntimeNotice {
|
|
|
238
238
|
level: 'info' | 'warning' | 'error';
|
|
239
239
|
text: string;
|
|
240
240
|
dismissible?: boolean;
|
|
241
|
+
/** Stable, canonical server error code (a shared ErrorCode enum member) when this
|
|
242
|
+
* notice came from a rejected run. Lets a host render a recovery action for a specific
|
|
243
|
+
* code without the agent knowing what the code means. */
|
|
244
|
+
errorCode?: string;
|
|
241
245
|
}
|
|
242
246
|
interface PiChatRetryNotice {
|
|
243
247
|
attempt: number;
|
|
@@ -501,6 +505,8 @@ interface ChatPanelEmptyState {
|
|
|
501
505
|
eyebrow?: string;
|
|
502
506
|
title?: string;
|
|
503
507
|
description?: string;
|
|
508
|
+
/** Optional content rendered below the suggestion grid (e.g. a footer link). */
|
|
509
|
+
footer?: ReactNode;
|
|
504
510
|
}
|
|
505
511
|
interface PiChatPanelProps {
|
|
506
512
|
/** Optional externally selected Pi session id. When provided, session navigation is owned by the host. */
|
|
@@ -530,6 +536,9 @@ interface PiChatPanelProps {
|
|
|
530
536
|
model?: ModelSelection | null;
|
|
531
537
|
defaultModel?: ModelSelection;
|
|
532
538
|
availableModels?: AvailableModel[];
|
|
539
|
+
hideDefaultModelOption?: boolean;
|
|
540
|
+
hideComposerSettings?: boolean;
|
|
541
|
+
suppressPreSubmitCancelledWarning?: boolean;
|
|
533
542
|
thinkingLevel?: ThinkingLevel;
|
|
534
543
|
thinkingControl?: boolean;
|
|
535
544
|
serverResourcesEnabled?: boolean;
|
|
@@ -553,8 +562,16 @@ interface PiChatPanelProps {
|
|
|
553
562
|
composerBlockers?: ComposerBlocker[];
|
|
554
563
|
onComposerStop?: () => void;
|
|
555
564
|
onComposerBlockerAction?: (blocker: ComposerBlocker, action: string) => void;
|
|
556
|
-
|
|
557
|
-
|
|
565
|
+
/** Fired once each time a run settles (busy → idle). Hosts use it to refresh
|
|
566
|
+
* out-of-band state after a turn (e.g. a usage/quota indicator). The agent stays
|
|
567
|
+
* agnostic about what the host does with it. */
|
|
568
|
+
onTurnComplete?: () => void;
|
|
569
|
+
/** Host-supplied action node for a runtime notice, keyed off notice.errorCode.
|
|
570
|
+
* Lets a host attach a recovery action for a specific error code without the agent
|
|
571
|
+
* knowing what the code means or what the action does. */
|
|
572
|
+
renderNoticeAction?: (notice: PiChatRuntimeNotice) => ReactNode;
|
|
573
|
+
}
|
|
574
|
+
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
575
|
|
|
559
576
|
interface DebugDrawerProps {
|
|
560
577
|
apiBaseUrl?: string;
|