@agimon-ai/doompi-web-contracts 0.0.1-alpha.2 → 0.0.1-alpha.3
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/README.md +36 -17
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/types/webPlugin.d.cts +116 -1
- package/dist/types/webPlugin.d.cts.map +1 -1
- package/dist/types/webPlugin.d.mts +116 -1
- package/dist/types/webPlugin.d.mts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
# @agimon-ai/doompi-web-contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Typed plugin, slot, session-channel, and hub-channel contracts for the DoomPi web cockpit.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This is a library, not a Pi extension. It starts no process and does not belong in `.doom/modes.yaml`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> **Alpha:** web plugin contracts may change between releases.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
the host package's build. It can contribute tabs with panels and badges, session data channels,
|
|
11
|
-
overlays, Leader Space key bindings, command palette commands, rail, selection bar, and
|
|
12
|
-
activity dock sections, and tool renderers: one `message` component per claimed tool (by name,
|
|
13
|
-
or by a `matches` predicate for tools named at runtime) that owns the tool call's whole timeline
|
|
14
|
-
item, composed from the shared components package's `MessageItem` so it looks like every other
|
|
15
|
-
item; `toolResultText` and `toolResultTextLines` read a result's text blocks the same way.
|
|
16
|
-
- An optional hub entry exporting `webHubChannels: readonly WebHubChannel[]`, loaded by the cockpit
|
|
17
|
-
server at startup. A channel watches some data source and answers per-session payloads that reach
|
|
18
|
-
the page as `ChannelFrame` messages whose frame type is the channel name.
|
|
9
|
+
## Install
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
```bash
|
|
12
|
+
npm install @agimon-ai/doompi-web-contracts
|
|
13
|
+
```
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
Web plugin clients also require the package's React, React DOM, and TanStack Store peers when they use
|
|
16
|
+
those surfaces.
|
|
17
|
+
|
|
18
|
+
## Plugin shape
|
|
19
|
+
|
|
20
|
+
A web plugin can have two entries:
|
|
21
|
+
|
|
22
|
+
- A client entry exports `webPlugin: WebPluginDefinition`. It can contribute tabs, slots, Leader
|
|
23
|
+
bindings, commands, session channels, activity surfaces, and tool renderers.
|
|
24
|
+
- An optional hub entry exports `webHubChannels: readonly WebHubChannel[]`. Each channel watches a
|
|
25
|
+
data source and emits per-session `ChannelFrame` payloads to the page.
|
|
26
|
+
|
|
27
|
+
Declare both entries in the plugin package's `doompiWeb` manifest block. The DoomPi cockpit bundler
|
|
28
|
+
reads those declarations and generates the registration modules.
|
|
29
|
+
|
|
30
|
+
Use the definition helpers for checked literals:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import {
|
|
34
|
+
defineSessionChannel,
|
|
35
|
+
defineSessionStore,
|
|
36
|
+
defineSlot,
|
|
37
|
+
defineWebPlugin,
|
|
38
|
+
toolResultText,
|
|
39
|
+
} from '@agimon-ai/doompi-web-contracts';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Import contracts type-only from server code. The `/testing` subpath provides channel, render, slot,
|
|
43
|
+
and tool-message fixtures for plugin tests.
|
|
25
44
|
|
|
26
45
|
## License
|
|
27
46
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActivityGroupContribution, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps } from "./types/webPlugin.cjs";
|
|
1
|
+
import { ActivityGroupContribution, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SettingsFieldContribution, SettingsFieldOption, SettingsSectionContribution, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolPromptContribution, ToolPromptDialog, ToolPromptRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps } from "./types/webPlugin.cjs";
|
|
2
2
|
import { defineSessionChannel, defineSlot, defineWebPlugin } from "./services/define.cjs";
|
|
3
3
|
import { defineSessionStore } from "./services/sessionStore.cjs";
|
|
4
4
|
import { toolResultText, toolResultTextLines } from "./services/toolResult.cjs";
|
|
5
5
|
import { ChannelFrame, HubChannelHost, HubChannelSource, HubSessionScope, WebHubChannel } from "./types/webHub.cjs";
|
|
6
|
-
export { type ActivityGroupContribution, type ChannelFrame, type HubChannelHost, type HubChannelSource, type HubSessionScope, type LeaderBindingContribution, type LeaderKeyContribution, type MinorModeContribution, type PaletteCommandContext, type PaletteCommandContribution, type SelectionAxisContribution, type SessionChannelContribution, type SessionFrameSender, type SessionRecords, type SessionStore, type SessionStoreChannel, type SlotDataFill, type SlotDeclaration, type SlotFillContribution, type SurfaceContribution, type TabContribution, type ToolMessageRenderProps, type ToolRendererContribution, type ToolResultView, type TransientTab, type WebHubChannel, type WebPluginDefinition, type WebPluginRuntime, type WebPluginSlotProps, defineSessionChannel, defineSessionStore, defineSlot, defineWebPlugin, toolResultText, toolResultTextLines };
|
|
6
|
+
export { type ActivityGroupContribution, type ChannelFrame, type HubChannelHost, type HubChannelSource, type HubSessionScope, type LeaderBindingContribution, type LeaderKeyContribution, type MinorModeContribution, type PaletteCommandContext, type PaletteCommandContribution, type SelectionAxisContribution, type SessionChannelContribution, type SessionFrameSender, type SessionRecords, type SessionStore, type SessionStoreChannel, type SettingsFieldContribution, type SettingsFieldOption, type SettingsSectionContribution, type SlotDataFill, type SlotDeclaration, type SlotFillContribution, type SurfaceContribution, type TabContribution, type ToolMessageRenderProps, type ToolPromptContribution, type ToolPromptDialog, type ToolPromptRenderProps, type ToolRendererContribution, type ToolResultView, type TransientTab, type WebHubChannel, type WebPluginDefinition, type WebPluginRuntime, type WebPluginSlotProps, defineSessionChannel, defineSessionStore, defineSlot, defineWebPlugin, toolResultText, toolResultTextLines };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActivityGroupContribution, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps } from "./types/webPlugin.mjs";
|
|
1
|
+
import { ActivityGroupContribution, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SettingsFieldContribution, SettingsFieldOption, SettingsSectionContribution, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolPromptContribution, ToolPromptDialog, ToolPromptRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps } from "./types/webPlugin.mjs";
|
|
2
2
|
import { defineSessionChannel, defineSlot, defineWebPlugin } from "./services/define.mjs";
|
|
3
3
|
import { defineSessionStore } from "./services/sessionStore.mjs";
|
|
4
4
|
import { toolResultText, toolResultTextLines } from "./services/toolResult.mjs";
|
|
5
5
|
import { ChannelFrame, HubChannelHost, HubChannelSource, HubSessionScope, WebHubChannel } from "./types/webHub.mjs";
|
|
6
|
-
export { type ActivityGroupContribution, type ChannelFrame, type HubChannelHost, type HubChannelSource, type HubSessionScope, type LeaderBindingContribution, type LeaderKeyContribution, type MinorModeContribution, type PaletteCommandContext, type PaletteCommandContribution, type SelectionAxisContribution, type SessionChannelContribution, type SessionFrameSender, type SessionRecords, type SessionStore, type SessionStoreChannel, type SlotDataFill, type SlotDeclaration, type SlotFillContribution, type SurfaceContribution, type TabContribution, type ToolMessageRenderProps, type ToolRendererContribution, type ToolResultView, type TransientTab, type WebHubChannel, type WebPluginDefinition, type WebPluginRuntime, type WebPluginSlotProps, defineSessionChannel, defineSessionStore, defineSlot, defineWebPlugin, toolResultText, toolResultTextLines };
|
|
6
|
+
export { type ActivityGroupContribution, type ChannelFrame, type HubChannelHost, type HubChannelSource, type HubSessionScope, type LeaderBindingContribution, type LeaderKeyContribution, type MinorModeContribution, type PaletteCommandContext, type PaletteCommandContribution, type SelectionAxisContribution, type SessionChannelContribution, type SessionFrameSender, type SessionRecords, type SessionStore, type SessionStoreChannel, type SettingsFieldContribution, type SettingsFieldOption, type SettingsSectionContribution, type SlotDataFill, type SlotDeclaration, type SlotFillContribution, type SurfaceContribution, type TabContribution, type ToolMessageRenderProps, type ToolPromptContribution, type ToolPromptDialog, type ToolPromptRenderProps, type ToolRendererContribution, type ToolResultView, type TransientTab, type WebHubChannel, type WebPluginDefinition, type WebPluginRuntime, type WebPluginSlotProps, defineSessionChannel, defineSessionStore, defineSlot, defineWebPlugin, toolResultText, toolResultTextLines };
|
|
@@ -105,6 +105,54 @@ interface TabContribution {
|
|
|
105
105
|
/** A React hook, fully typed inside the plugin; 0 hides the badge. */
|
|
106
106
|
useBadge?: (sessionId: string | null) => number;
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* One field on a settings page, declared as data.
|
|
110
|
+
*
|
|
111
|
+
* Settings are data rather than a component because the host owns what a
|
|
112
|
+
* plugin cannot: which file an edit lands in. A page has one scope switch and
|
|
113
|
+
* one repository, and every field on it reports where its value came from and
|
|
114
|
+
* whether the selected scope may hold it. A plugin drawing its own form would
|
|
115
|
+
* have to reproduce all of that, and each would get it slightly different.
|
|
116
|
+
*/
|
|
117
|
+
interface SettingsFieldContribution {
|
|
118
|
+
/** Unique within the section; also the testid suffix. */
|
|
119
|
+
id: string;
|
|
120
|
+
label: string;
|
|
121
|
+
kind: 'text' | 'select' | 'toggle' | 'info';
|
|
122
|
+
/** The config key this reads and writes, e.g. ['modes','planning','main','model']. */
|
|
123
|
+
keyPath: readonly string[];
|
|
124
|
+
/** One line of help under the field. */
|
|
125
|
+
detail?: string;
|
|
126
|
+
/** Shown while the field is unset, in place of a value. */
|
|
127
|
+
placeholder?: string;
|
|
128
|
+
/** The closed set a 'select' offers, when the plugin knows it. */
|
|
129
|
+
options?: readonly SettingsFieldOption[];
|
|
130
|
+
/**
|
|
131
|
+
* An option set the host supplies instead. A model picker needs the machine's
|
|
132
|
+
* authenticated models, which no plugin can enumerate from the browser; a
|
|
133
|
+
* host that cannot answer leaves the field as free text.
|
|
134
|
+
*/
|
|
135
|
+
optionsFrom?: 'models';
|
|
136
|
+
}
|
|
137
|
+
interface SettingsFieldOption {
|
|
138
|
+
value: string;
|
|
139
|
+
label: string;
|
|
140
|
+
/** Groups entries under a heading, as providers group their models. */
|
|
141
|
+
group?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A page in cockpit settings, contributed by the package that owns the
|
|
145
|
+
* settings on it. The id is the URL segment (/settings/:id), so it is unique
|
|
146
|
+
* across plugins; a collision is an install diagnostic and the first wins.
|
|
147
|
+
*/
|
|
148
|
+
interface SettingsSectionContribution {
|
|
149
|
+
id: string;
|
|
150
|
+
label: string;
|
|
151
|
+
detail: string;
|
|
152
|
+
/** Sort position in the settings menu; lower first, id breaks ties. */
|
|
153
|
+
order?: number;
|
|
154
|
+
fields: readonly SettingsFieldContribution[];
|
|
155
|
+
}
|
|
108
156
|
interface SurfaceContribution {
|
|
109
157
|
id: string;
|
|
110
158
|
component: ComponentType<WebPluginSlotProps>;
|
|
@@ -214,6 +262,19 @@ interface ActivityGroupContribution {
|
|
|
214
262
|
widgetKeys?: string[];
|
|
215
263
|
/** The plugin tab the group's key chip opens; without one the chip is a plain label. */
|
|
216
264
|
tab?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Drop the group entirely while its status key is present but empty, rather
|
|
267
|
+
* than showing a header over "idle".
|
|
268
|
+
*
|
|
269
|
+
* A session publishes a status key once and clears it by publishing nothing,
|
|
270
|
+
* which reaches the page as an empty string, so a group that has reported at
|
|
271
|
+
* all can never stop reporting. For a group whose whole content is the thing
|
|
272
|
+
* the session is doing (a goal, a recording, the files it changed), the
|
|
273
|
+
* header alone is a row that says nothing, and a dock of those buries the
|
|
274
|
+
* groups that do. A group that is also a way in, with a launcher or a tab,
|
|
275
|
+
* leaves this off: its frame is worth keeping when it is idle.
|
|
276
|
+
*/
|
|
277
|
+
hideWhenEmpty?: boolean;
|
|
217
278
|
/** Sort position in the dock; lower first, name breaks ties. */
|
|
218
279
|
order?: number;
|
|
219
280
|
}
|
|
@@ -289,6 +350,51 @@ interface ToolMessageRenderProps extends WebPluginSlotProps {
|
|
|
289
350
|
running: boolean;
|
|
290
351
|
isError: boolean;
|
|
291
352
|
}
|
|
353
|
+
/** The extension UI request a running tool is blocked on, as its prompt sees it. */
|
|
354
|
+
interface ToolPromptDialog {
|
|
355
|
+
id: string;
|
|
356
|
+
method: 'select' | 'confirm' | 'input' | 'editor';
|
|
357
|
+
title: string;
|
|
358
|
+
message: string;
|
|
359
|
+
options: readonly string[];
|
|
360
|
+
placeholder: string;
|
|
361
|
+
prefill: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Everything a tool's composer prompt receives: the timeline item's props,
|
|
365
|
+
* plus the request the tool is waiting on and the two ways to settle it.
|
|
366
|
+
*
|
|
367
|
+
* The dialog frame is deliberately thin, because Pi's own is: a select
|
|
368
|
+
* carries a title and a list of labels and nothing else. A prompt that needs
|
|
369
|
+
* more renders it from `args`, which is the whole call the tool was made
|
|
370
|
+
* with, and answers with whatever its session half agreed to read back.
|
|
371
|
+
*/
|
|
372
|
+
interface ToolPromptRenderProps extends ToolMessageRenderProps {
|
|
373
|
+
dialog: ToolPromptDialog;
|
|
374
|
+
/** Answers the request and unblocks the tool. Bound, so a prompt may destructure it. */
|
|
375
|
+
answer: (value: string) => void;
|
|
376
|
+
/** The reader declined; the tool sees a cancellation. */
|
|
377
|
+
cancel: () => void;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A tool's stand-in for the composer input, shown while the tool is running
|
|
381
|
+
* and holding an extension UI request.
|
|
382
|
+
*
|
|
383
|
+
* A question the agent is blocked on belongs where the reader is already
|
|
384
|
+
* looking and typing, not behind a modal covering the conversation they need
|
|
385
|
+
* in order to answer. While a prompt is up the host's own dialog stands down,
|
|
386
|
+
* so exactly one surface owns the request.
|
|
387
|
+
*/
|
|
388
|
+
interface ToolPromptContribution {
|
|
389
|
+
/**
|
|
390
|
+
* True when this tool owns the open request. Without it the tool claims any
|
|
391
|
+
* request open while it runs, which is wrong the moment a second extension
|
|
392
|
+
* asks something during the same turn; a request it refuses falls back to
|
|
393
|
+
* the host's dialog.
|
|
394
|
+
*/
|
|
395
|
+
claims?(dialog: ToolPromptDialog, args: Record<string, unknown>): boolean;
|
|
396
|
+
component: ComponentType<ToolPromptRenderProps>;
|
|
397
|
+
}
|
|
292
398
|
/**
|
|
293
399
|
* The timeline item for the tools a package registers, the web half of the
|
|
294
400
|
* TUI's renderCall/renderResult with Pi's renderShell 'self': one `message`
|
|
@@ -306,6 +412,8 @@ interface ToolRendererContribution {
|
|
|
306
412
|
*/
|
|
307
413
|
matches?(toolName: string, statuses: Readonly<Record<string, string>>): boolean;
|
|
308
414
|
message: ComponentType<ToolMessageRenderProps>;
|
|
415
|
+
/** Stands in for the composer input while this tool runs and holds a request. */
|
|
416
|
+
prompt?: ToolPromptContribution;
|
|
309
417
|
}
|
|
310
418
|
/** What a plugin's optional runtime may do; both send on the page's hub socket. */
|
|
311
419
|
interface WebPluginRuntime {
|
|
@@ -324,6 +432,8 @@ interface WebPluginDefinition {
|
|
|
324
432
|
leaderBindings?: LeaderBindingContribution[];
|
|
325
433
|
railSections?: SurfaceContribution[];
|
|
326
434
|
selectionBarItems?: SurfaceContribution[];
|
|
435
|
+
/** Compact controls placed in the mobile composer's action row, immediately before queue. */
|
|
436
|
+
composerActions?: SurfaceContribution[];
|
|
327
437
|
toolRenderers?: ToolRendererContribution[];
|
|
328
438
|
/**
|
|
329
439
|
* A section whose id names an activity group any plugin declares renders
|
|
@@ -331,6 +441,11 @@ interface WebPluginDefinition {
|
|
|
331
441
|
* one-line summary; any other section renders after the groups.
|
|
332
442
|
*/
|
|
333
443
|
activitySections?: SurfaceContribution[];
|
|
444
|
+
/**
|
|
445
|
+
* Pages this plugin adds to cockpit settings. The host renders the fields and
|
|
446
|
+
* owns the scope switch, the repository picker, and every write.
|
|
447
|
+
*/
|
|
448
|
+
settingsSections?: SettingsSectionContribution[];
|
|
334
449
|
/** The slots this plugin opens for others, each named '<this plugin id>.<name>'. */
|
|
335
450
|
slots?: SlotDeclaration[];
|
|
336
451
|
/** This plugin's contributions into slots other plugins (or the host) declare. */
|
|
@@ -339,5 +454,5 @@ interface WebPluginDefinition {
|
|
|
339
454
|
start?(runtime: WebPluginRuntime): (() => void) | void;
|
|
340
455
|
}
|
|
341
456
|
//#endregion
|
|
342
|
-
export { ActivityGroupContribution, LeaderBindingBase, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps };
|
|
457
|
+
export { ActivityGroupContribution, LeaderBindingBase, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SettingsFieldContribution, SettingsFieldOption, SettingsSectionContribution, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolPromptContribution, ToolPromptDialog, ToolPromptRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps };
|
|
343
458
|
//# sourceMappingURL=webPlugin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPlugin.d.cts","names":[],"sources":["../../src/types/webPlugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;KAwBY,sBAAsB,mBAAmB,OAAO;;;;;;;;;;UAU3C,gBAAgB;EAC/B;;EAEA,OAAO,iBAAiB;;;UAGT,aAAa;EAC5B;EACA;EACA;EACA,MAAM;;;;;;;;UAQS;;EAEf;EACA;EACA,OAAO,cAAc;;;UAGN;EACf;;EAEA,UAAU;;EAEV,mBAAmB,KAAK;EACxB,oBAAoB;;;;;;EAMpB,eAAe,qBAAqB;;EAEpC,kBAAkB;;EAElB,aAAa,iBAAiB;;EAE9B,WAAW,MAAM,MAAM,gBAAgB,mBAAmB,aAAa;;;;;;;EAOvE,UAAU,SAAS;;;;;;;UAOJ;EACf;EACA;;EAEA;EACA;EACA,YAAY,cAAc;;UAEX;;EAEf;EACA;EACA,OAAO,cAAc;;EAErB,YAAY;;
|
|
1
|
+
{"version":3,"file":"webPlugin.d.cts","names":[],"sources":["../../src/types/webPlugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;KAwBY,sBAAsB,mBAAmB,OAAO;;;;;;;;;;UAU3C,gBAAgB;EAC/B;;EAEA,OAAO,iBAAiB;;;UAGT,aAAa;EAC5B;EACA;EACA;EACA,MAAM;;;;;;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UAAU,SAAS,MAAM;EACnD,KAAK;EACL;;EAEA,QAAQ,SAAS,SAAS,oBAAoB,GAAG,WAAW;;;;;;;UAO7C;EACf;EACA;;;;;;;;;;UAUe,+BAA+B;EAC9C;;EAEA;EACA,MAAM;;EAEN,UAAU,SAAS;;EAEnB,QAAQ;;EAER;;EAEA;EACA;;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;UAWe,8BAA8B;EAC7C,QAAQ;;EAER,SAAS;;EAET;;;;;;;;;;;UAWe;;;;;;;EAOf,QAAQ,QAAQ,kBAAkB,MAAM;EACxC,WAAW,cAAc;;;;;;;;UAQV;;EAEf;;;;;;;EAOA,SAAS,kBAAkB,UAAU,SAAS;EAC9C,SAAS,cAAc;;EAEvB,SAAS;;;UAGM;EACf,kBAAkB;EAClB,aAAa,OAAO;;UAEL;EACf;EACA,OAAO;EACP,WAAW;EACX,gBAAgB;EAChB,aAAa;EACb,iBAAiB;EACjB,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,eAAe;EACf,oBAAoB;;EAEpB,kBAAkB;EAClB,gBAAgB;;;;;;EAMhB,mBAAmB;;;;;EAKnB,mBAAmB;;EAEnB,QAAQ;;EAER,QAAQ;;EAER,OAAO,SAAS"}
|
|
@@ -105,6 +105,54 @@ interface TabContribution {
|
|
|
105
105
|
/** A React hook, fully typed inside the plugin; 0 hides the badge. */
|
|
106
106
|
useBadge?: (sessionId: string | null) => number;
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* One field on a settings page, declared as data.
|
|
110
|
+
*
|
|
111
|
+
* Settings are data rather than a component because the host owns what a
|
|
112
|
+
* plugin cannot: which file an edit lands in. A page has one scope switch and
|
|
113
|
+
* one repository, and every field on it reports where its value came from and
|
|
114
|
+
* whether the selected scope may hold it. A plugin drawing its own form would
|
|
115
|
+
* have to reproduce all of that, and each would get it slightly different.
|
|
116
|
+
*/
|
|
117
|
+
interface SettingsFieldContribution {
|
|
118
|
+
/** Unique within the section; also the testid suffix. */
|
|
119
|
+
id: string;
|
|
120
|
+
label: string;
|
|
121
|
+
kind: 'text' | 'select' | 'toggle' | 'info';
|
|
122
|
+
/** The config key this reads and writes, e.g. ['modes','planning','main','model']. */
|
|
123
|
+
keyPath: readonly string[];
|
|
124
|
+
/** One line of help under the field. */
|
|
125
|
+
detail?: string;
|
|
126
|
+
/** Shown while the field is unset, in place of a value. */
|
|
127
|
+
placeholder?: string;
|
|
128
|
+
/** The closed set a 'select' offers, when the plugin knows it. */
|
|
129
|
+
options?: readonly SettingsFieldOption[];
|
|
130
|
+
/**
|
|
131
|
+
* An option set the host supplies instead. A model picker needs the machine's
|
|
132
|
+
* authenticated models, which no plugin can enumerate from the browser; a
|
|
133
|
+
* host that cannot answer leaves the field as free text.
|
|
134
|
+
*/
|
|
135
|
+
optionsFrom?: 'models';
|
|
136
|
+
}
|
|
137
|
+
interface SettingsFieldOption {
|
|
138
|
+
value: string;
|
|
139
|
+
label: string;
|
|
140
|
+
/** Groups entries under a heading, as providers group their models. */
|
|
141
|
+
group?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A page in cockpit settings, contributed by the package that owns the
|
|
145
|
+
* settings on it. The id is the URL segment (/settings/:id), so it is unique
|
|
146
|
+
* across plugins; a collision is an install diagnostic and the first wins.
|
|
147
|
+
*/
|
|
148
|
+
interface SettingsSectionContribution {
|
|
149
|
+
id: string;
|
|
150
|
+
label: string;
|
|
151
|
+
detail: string;
|
|
152
|
+
/** Sort position in the settings menu; lower first, id breaks ties. */
|
|
153
|
+
order?: number;
|
|
154
|
+
fields: readonly SettingsFieldContribution[];
|
|
155
|
+
}
|
|
108
156
|
interface SurfaceContribution {
|
|
109
157
|
id: string;
|
|
110
158
|
component: ComponentType<WebPluginSlotProps>;
|
|
@@ -214,6 +262,19 @@ interface ActivityGroupContribution {
|
|
|
214
262
|
widgetKeys?: string[];
|
|
215
263
|
/** The plugin tab the group's key chip opens; without one the chip is a plain label. */
|
|
216
264
|
tab?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Drop the group entirely while its status key is present but empty, rather
|
|
267
|
+
* than showing a header over "idle".
|
|
268
|
+
*
|
|
269
|
+
* A session publishes a status key once and clears it by publishing nothing,
|
|
270
|
+
* which reaches the page as an empty string, so a group that has reported at
|
|
271
|
+
* all can never stop reporting. For a group whose whole content is the thing
|
|
272
|
+
* the session is doing (a goal, a recording, the files it changed), the
|
|
273
|
+
* header alone is a row that says nothing, and a dock of those buries the
|
|
274
|
+
* groups that do. A group that is also a way in, with a launcher or a tab,
|
|
275
|
+
* leaves this off: its frame is worth keeping when it is idle.
|
|
276
|
+
*/
|
|
277
|
+
hideWhenEmpty?: boolean;
|
|
217
278
|
/** Sort position in the dock; lower first, name breaks ties. */
|
|
218
279
|
order?: number;
|
|
219
280
|
}
|
|
@@ -289,6 +350,51 @@ interface ToolMessageRenderProps extends WebPluginSlotProps {
|
|
|
289
350
|
running: boolean;
|
|
290
351
|
isError: boolean;
|
|
291
352
|
}
|
|
353
|
+
/** The extension UI request a running tool is blocked on, as its prompt sees it. */
|
|
354
|
+
interface ToolPromptDialog {
|
|
355
|
+
id: string;
|
|
356
|
+
method: 'select' | 'confirm' | 'input' | 'editor';
|
|
357
|
+
title: string;
|
|
358
|
+
message: string;
|
|
359
|
+
options: readonly string[];
|
|
360
|
+
placeholder: string;
|
|
361
|
+
prefill: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Everything a tool's composer prompt receives: the timeline item's props,
|
|
365
|
+
* plus the request the tool is waiting on and the two ways to settle it.
|
|
366
|
+
*
|
|
367
|
+
* The dialog frame is deliberately thin, because Pi's own is: a select
|
|
368
|
+
* carries a title and a list of labels and nothing else. A prompt that needs
|
|
369
|
+
* more renders it from `args`, which is the whole call the tool was made
|
|
370
|
+
* with, and answers with whatever its session half agreed to read back.
|
|
371
|
+
*/
|
|
372
|
+
interface ToolPromptRenderProps extends ToolMessageRenderProps {
|
|
373
|
+
dialog: ToolPromptDialog;
|
|
374
|
+
/** Answers the request and unblocks the tool. Bound, so a prompt may destructure it. */
|
|
375
|
+
answer: (value: string) => void;
|
|
376
|
+
/** The reader declined; the tool sees a cancellation. */
|
|
377
|
+
cancel: () => void;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A tool's stand-in for the composer input, shown while the tool is running
|
|
381
|
+
* and holding an extension UI request.
|
|
382
|
+
*
|
|
383
|
+
* A question the agent is blocked on belongs where the reader is already
|
|
384
|
+
* looking and typing, not behind a modal covering the conversation they need
|
|
385
|
+
* in order to answer. While a prompt is up the host's own dialog stands down,
|
|
386
|
+
* so exactly one surface owns the request.
|
|
387
|
+
*/
|
|
388
|
+
interface ToolPromptContribution {
|
|
389
|
+
/**
|
|
390
|
+
* True when this tool owns the open request. Without it the tool claims any
|
|
391
|
+
* request open while it runs, which is wrong the moment a second extension
|
|
392
|
+
* asks something during the same turn; a request it refuses falls back to
|
|
393
|
+
* the host's dialog.
|
|
394
|
+
*/
|
|
395
|
+
claims?(dialog: ToolPromptDialog, args: Record<string, unknown>): boolean;
|
|
396
|
+
component: ComponentType<ToolPromptRenderProps>;
|
|
397
|
+
}
|
|
292
398
|
/**
|
|
293
399
|
* The timeline item for the tools a package registers, the web half of the
|
|
294
400
|
* TUI's renderCall/renderResult with Pi's renderShell 'self': one `message`
|
|
@@ -306,6 +412,8 @@ interface ToolRendererContribution {
|
|
|
306
412
|
*/
|
|
307
413
|
matches?(toolName: string, statuses: Readonly<Record<string, string>>): boolean;
|
|
308
414
|
message: ComponentType<ToolMessageRenderProps>;
|
|
415
|
+
/** Stands in for the composer input while this tool runs and holds a request. */
|
|
416
|
+
prompt?: ToolPromptContribution;
|
|
309
417
|
}
|
|
310
418
|
/** What a plugin's optional runtime may do; both send on the page's hub socket. */
|
|
311
419
|
interface WebPluginRuntime {
|
|
@@ -324,6 +432,8 @@ interface WebPluginDefinition {
|
|
|
324
432
|
leaderBindings?: LeaderBindingContribution[];
|
|
325
433
|
railSections?: SurfaceContribution[];
|
|
326
434
|
selectionBarItems?: SurfaceContribution[];
|
|
435
|
+
/** Compact controls placed in the mobile composer's action row, immediately before queue. */
|
|
436
|
+
composerActions?: SurfaceContribution[];
|
|
327
437
|
toolRenderers?: ToolRendererContribution[];
|
|
328
438
|
/**
|
|
329
439
|
* A section whose id names an activity group any plugin declares renders
|
|
@@ -331,6 +441,11 @@ interface WebPluginDefinition {
|
|
|
331
441
|
* one-line summary; any other section renders after the groups.
|
|
332
442
|
*/
|
|
333
443
|
activitySections?: SurfaceContribution[];
|
|
444
|
+
/**
|
|
445
|
+
* Pages this plugin adds to cockpit settings. The host renders the fields and
|
|
446
|
+
* owns the scope switch, the repository picker, and every write.
|
|
447
|
+
*/
|
|
448
|
+
settingsSections?: SettingsSectionContribution[];
|
|
334
449
|
/** The slots this plugin opens for others, each named '<this plugin id>.<name>'. */
|
|
335
450
|
slots?: SlotDeclaration[];
|
|
336
451
|
/** This plugin's contributions into slots other plugins (or the host) declare. */
|
|
@@ -339,5 +454,5 @@ interface WebPluginDefinition {
|
|
|
339
454
|
start?(runtime: WebPluginRuntime): (() => void) | void;
|
|
340
455
|
}
|
|
341
456
|
//#endregion
|
|
342
|
-
export { ActivityGroupContribution, LeaderBindingBase, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps };
|
|
457
|
+
export { ActivityGroupContribution, LeaderBindingBase, LeaderBindingContribution, LeaderKeyContribution, MinorModeContribution, PaletteCommandContext, PaletteCommandContribution, SelectionAxisContribution, SessionChannelContribution, SessionFrameSender, SessionRecords, SessionStore, SessionStoreChannel, SettingsFieldContribution, SettingsFieldOption, SettingsSectionContribution, SlotDataFill, SlotDeclaration, SlotFillContribution, SurfaceContribution, TabContribution, ToolMessageRenderProps, ToolPromptContribution, ToolPromptDialog, ToolPromptRenderProps, ToolRendererContribution, ToolResultView, TransientTab, WebPluginDefinition, WebPluginRuntime, WebPluginSlotProps };
|
|
343
458
|
//# sourceMappingURL=webPlugin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPlugin.d.mts","names":[],"sources":["../../src/types/webPlugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;KAwBY,sBAAsB,mBAAmB,OAAO;;;;;;;;;;UAU3C,gBAAgB;EAC/B;;EAEA,OAAO,iBAAiB;;;UAGT,aAAa;EAC5B;EACA;EACA;EACA,MAAM;;;;;;;;UAQS;;EAEf;EACA;EACA,OAAO,cAAc;;;UAGN;EACf;;EAEA,UAAU;;EAEV,mBAAmB,KAAK;EACxB,oBAAoB;;;;;;EAMpB,eAAe,qBAAqB;;EAEpC,kBAAkB;;EAElB,aAAa,iBAAiB;;EAE9B,WAAW,MAAM,MAAM,gBAAgB,mBAAmB,aAAa;;;;;;;EAOvE,UAAU,SAAS;;;;;;;UAOJ;EACf;EACA;;EAEA;EACA;EACA,YAAY,cAAc;;UAEX;;EAEf;EACA;EACA,OAAO,cAAc;;EAErB,YAAY;;
|
|
1
|
+
{"version":3,"file":"webPlugin.d.mts","names":[],"sources":["../../src/types/webPlugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;KAwBY,sBAAsB,mBAAmB,OAAO;;;;;;;;;;UAU3C,gBAAgB;EAC/B;;EAEA,OAAO,iBAAiB;;;UAGT,aAAa;EAC5B;EACA;EACA;EACA,MAAM;;;;;;;;UAQS;;EAEf;EACA;EACA,OAAO,cAAc;;;UAGN;EACf;;EAEA,UAAU;;EAEV,mBAAmB,KAAK;EACxB,oBAAoB;;;;;;EAMpB,eAAe,qBAAqB;;EAEpC,kBAAkB;;EAElB,aAAa,iBAAiB;;EAE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AAS;;EAEnB,QAAQ;;EAER;;EAEA;EACA;;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;UAWe,8BAA8B;EAC7C,QAAQ;;EAER,SAAS;;EAET;;;;;;;;;;;UAWe;;;;;;;EAOf,QAAQ,QAAQ,kBAAkB,MAAM;EACxC,WAAW,cAAc;;;;;;;;UAQV;;EAEf;;;;;;;EAOA,SAAS,kBAAkB,UAAU,SAAS;EAC9C,SAAS,cAAc;;EAEvB,SAAS;;;UAGM;EACf,kBAAkB;EAClB,aAAa,OAAO;;UAEL;EACf;EACA,OAAO;EACP,WAAW;EACX,gBAAgB;EAChB,aAAa;EACb,iBAAiB;EACjB,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,eAAe;EACf,oBAAoB;;EAEpB,kBAAkB;EAClB,gBAAgB;;;;;;EAMhB,mBAAmB;;;;;EAKnB,mBAAmB;;EAEnB,QAAQ;;EAER,QAAQ;;EAER,OAAO,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/doompi-web-contracts",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.3",
|
|
4
4
|
"description": "Web cockpit plugin contracts for DoomPi: plugin definitions, slot contributions, session data channels, and hub channel sources.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|