@hachej/boring-agent 0.1.35 → 0.1.37

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.
@@ -73,6 +73,27 @@ interface AgentHarness {
73
73
  getSystemPrompt?: (sessionId: string) => string | undefined;
74
74
  /** Reload native agent resources/extensions for an existing session. */
75
75
  reloadSession?: (sessionId: string) => Promise<boolean>;
76
+ /** List slash commands registered in the agent runtime for a given session. */
77
+ getSlashCommands?: (sessionId: string, ctx: RunContext) => ReadonlyArray<AgentSlashCommandSummary> | Promise<ReadonlyArray<AgentSlashCommandSummary>>;
78
+ /**
79
+ * Execute a named slash command registered via `pi.registerCommand` in a
80
+ * plugin extension. Calls the handler in-process; the handler may dispatch
81
+ * UI commands (openPanel, notify) through the workspace bridge. Throws if
82
+ * the command is not found or the handler throws.
83
+ */
84
+ executeSlashCommand?: (sessionId: string, name: string, args: string, ctx: RunContext) => Promise<void>;
85
+ }
86
+ interface AgentSlashCommandSummary {
87
+ name: string;
88
+ description?: string;
89
+ source: 'extension' | 'prompt' | 'skill';
90
+ /**
91
+ * Name of the originating plugin/package, when derivable from Pi's
92
+ * sourceInfo (e.g. a `.pi/extensions/<name>` runtime plugin, or an
93
+ * `npm:`/`git/` package). Surfaced as a tag in the slash-command picker.
94
+ * Absent for built-in/top-level commands with no package origin.
95
+ */
96
+ sourcePlugin?: string;
76
97
  }
77
98
  interface MessageAttachment {
78
99
  filename?: string;
@@ -394,5 +415,22 @@ interface PluginRestartWarning {
394
415
  surfaces: string[];
395
416
  message: string;
396
417
  }
418
+ /**
419
+ * Browser CustomEvent name dispatched on `window` when a `showNotification`
420
+ * UI command arrives from the server (e.g. from a plugin slash command that
421
+ * calls `notify()`). `PiChatPanel` listens for this to show the
422
+ * `CommandRunStatus` banner above the composer.
423
+ */
424
+ declare const WORKSPACE_COMMAND_NOTIFY_EVENT = "boring-ui:command-notify";
425
+ /**
426
+ * Payload carried by `WORKSPACE_COMMAND_NOTIFY_EVENT`. Maps directly to
427
+ * what `uiCommandDispatcher` extracts from the `showNotification` command.
428
+ */
429
+ interface CommandNotifyPayload {
430
+ message: string;
431
+ tone: 'success' | 'error' | 'info' | 'warn';
432
+ /** Name of the command that triggered the notification (without leading slash). */
433
+ command?: string;
434
+ }
397
435
 
398
- export { type AgentTool as A, 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, type WorkspaceRuntimeContext as n, noopTelemetry as o, type AgentHarnessFactory as p, type AgentHarnessFactoryInput as q, safeCapture as s };
436
+ 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 AgentHarnessFactory as q, type AgentHarnessFactoryInput as r, safeCapture as s };
@@ -0,0 +1,8 @@
1
+ // src/shared/agentPluginEvents.ts
2
+ var WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT = "boring-ui:agent-plugins-reloaded";
3
+ var WORKSPACE_COMMAND_NOTIFY_EVENT = "boring-ui:command-notify";
4
+
5
+ export {
6
+ WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT,
7
+ WORKSPACE_COMMAND_NOTIFY_EVENT
8
+ };
@@ -118,8 +118,22 @@ type SlashCommandHandler = (args: string, ctx: SlashCommandContext) => SlashComm
118
118
  interface SlashCommand {
119
119
  name: string;
120
120
  description: string;
121
- /** 'skill' commands are forwarded to the PI agent as `skill: <name>\n\n<args>` instead of running locally. */
121
+ /**
122
+ * - local: handled in the browser.
123
+ * - skill: forwarded to the PI agent as `skill: <name>\n\n<args>`.
124
+ * Server commands registered via `useServerCommands` omit `kind` (or set
125
+ * it to `local`) — Pi handles execution natively so no frontend kind-check
126
+ * is needed.
127
+ */
122
128
  kind?: 'local' | 'skill';
129
+ /**
130
+ * Origin of the command, surfaced as a tag in the slash-command picker.
131
+ * Mirrors Pi's command sources for server commands; `local` for built-in
132
+ * browser commands. Display only.
133
+ */
134
+ source?: 'local' | 'extension' | 'prompt' | 'skill';
135
+ /** Originating plugin/package name (when known), shown as a tag. */
136
+ sourcePlugin?: string;
123
137
  handler: SlashCommandHandler;
124
138
  }
125
139
  interface SlashCommandContext {
@@ -146,6 +160,7 @@ interface SlashCommandContext {
146
160
  }
147
161
  interface CommandRegistry {
148
162
  register(cmd: SlashCommand): void;
163
+ unregister(name: string): void;
149
164
  get(name: string): SlashCommand | undefined;
150
165
  list(): SlashCommand[];
151
166
  }