openbot 0.2.14 → 0.3.1
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/agents/openbot/index.js +76 -0
- package/dist/agents/openbot/middleware/approval.js +132 -0
- package/dist/agents/openbot/runtime.js +289 -0
- package/dist/agents/openbot/system-prompt.js +32 -0
- package/dist/agents/openbot/tools/delegation.js +78 -0
- package/dist/agents/openbot/tools/mcp.js +99 -0
- package/dist/agents/openbot/tools/shell.js +91 -0
- package/dist/agents/openbot/tools/storage.js +75 -0
- package/dist/agents/openbot/tools/ui.js +176 -0
- package/dist/agents/system.js +20 -93
- package/dist/app/cli.js +1 -1
- package/dist/app/config.js +4 -1
- package/dist/app/server.js +15 -8
- package/dist/bus/agent-package.js +1 -0
- package/dist/bus/plugin.js +1 -0
- package/dist/bus/services.js +711 -0
- package/dist/bus/types.js +1 -0
- package/dist/harness/context.js +250 -0
- package/dist/harness/event-normalizer.js +59 -0
- package/dist/harness/orchestrator.js +27 -227
- package/dist/harness/process.js +25 -3
- package/dist/harness/queue-processor.js +227 -0
- package/dist/harness/runtime-factory.js +103 -0
- package/dist/plugins/ai-sdk/index.js +37 -0
- package/dist/plugins/ai-sdk/runtime.js +402 -0
- package/dist/plugins/ai-sdk/system-prompt.js +3 -0
- package/dist/plugins/ai-sdk.js +277 -87
- package/dist/plugins/approval/index.js +159 -0
- package/dist/plugins/approval.js +163 -0
- package/dist/plugins/delegation/index.js +79 -0
- package/dist/plugins/delegation.js +67 -11
- package/dist/plugins/mcp/index.js +108 -0
- package/dist/plugins/memory/index.js +71 -0
- package/dist/plugins/shell/index.js +99 -0
- package/dist/plugins/shell.js +123 -0
- package/dist/plugins/storage-tools/index.js +85 -0
- package/dist/plugins/storage.js +240 -5
- package/dist/plugins/ui/index.js +184 -0
- package/dist/plugins/ui.js +185 -21
- package/dist/registry/agents.js +138 -0
- package/dist/registry/plugins.js +93 -50
- package/dist/services/agent-packages.js +103 -0
- package/dist/services/memory.js +152 -0
- package/dist/services/plugins.js +98 -0
- package/dist/services/storage.js +366 -94
- package/docs/agents.md +52 -65
- package/docs/architecture.md +1 -1
- package/docs/plugins.md +70 -58
- package/docs/templates/AGENT.example.md +57 -0
- package/package.json +8 -7
- package/src/app/cli.ts +1 -1
- package/src/app/config.ts +14 -4
- package/src/app/server.ts +23 -10
- package/src/app/types.ts +445 -16
- package/src/assets/icon.svg +4 -1
- package/src/bus/plugin.ts +67 -0
- package/src/bus/services.ts +786 -0
- package/src/bus/types.ts +160 -0
- package/src/harness/context.ts +293 -0
- package/src/harness/event-normalizer.ts +82 -0
- package/src/harness/orchestrator.ts +35 -273
- package/src/harness/process.ts +28 -4
- package/src/harness/queue-processor.ts +309 -0
- package/src/harness/runtime-factory.ts +125 -0
- package/src/plugins/ai-sdk/index.ts +44 -0
- package/src/plugins/ai-sdk/runtime.ts +484 -0
- package/src/plugins/ai-sdk/system-prompt.ts +4 -0
- package/src/plugins/approval/index.ts +228 -0
- package/src/plugins/delegation/index.ts +94 -0
- package/src/plugins/mcp/index.ts +128 -0
- package/src/plugins/memory/index.ts +85 -0
- package/src/plugins/shell/index.ts +123 -0
- package/src/plugins/storage-tools/index.ts +101 -0
- package/src/plugins/ui/index.ts +227 -0
- package/src/registry/plugins.ts +108 -55
- package/src/services/memory.ts +213 -0
- package/src/services/plugins.ts +133 -0
- package/src/services/storage.ts +472 -137
- package/src/agents/system.ts +0 -112
- package/src/plugins/ai-sdk.ts +0 -197
- package/src/plugins/delegation.ts +0 -60
- package/src/plugins/mcp.ts +0 -154
- package/src/plugins/storage.ts +0 -725
- package/src/plugins/ui.ts +0 -57
package/src/app/types.ts
CHANGED
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
AgentDetails,
|
|
4
4
|
Channel,
|
|
5
5
|
ChannelDetails,
|
|
6
|
-
|
|
6
|
+
PluginDescriptor,
|
|
7
7
|
Thread,
|
|
8
8
|
ThreadDetails,
|
|
9
|
-
} from '../
|
|
9
|
+
} from '../bus/types.js';
|
|
10
|
+
import type { PluginRef } from '../bus/plugin.js';
|
|
11
|
+
import type { MemoryRecord } from '../services/memory.js';
|
|
10
12
|
|
|
11
13
|
export interface OpenBotState {
|
|
12
14
|
agentId: string;
|
|
@@ -20,10 +22,11 @@ export interface OpenBotState {
|
|
|
20
22
|
shortTermMessages?: ShortTermMessage[];
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
export type ShortTermMessage =
|
|
24
|
-
role: '
|
|
25
|
-
content: string
|
|
26
|
-
}
|
|
25
|
+
export type ShortTermMessage =
|
|
26
|
+
| { role: 'system'; content: string }
|
|
27
|
+
| { role: 'user'; content: string }
|
|
28
|
+
| { role: 'assistant'; content: string; toolCalls?: any[] }
|
|
29
|
+
| { role: 'tool'; content: string; toolCallId: string; toolName: string };
|
|
27
30
|
|
|
28
31
|
export type BaseEvent = {
|
|
29
32
|
id?: string;
|
|
@@ -76,6 +79,17 @@ export type GetChannelDetailsResultEvent = BaseEvent & {
|
|
|
76
79
|
};
|
|
77
80
|
};
|
|
78
81
|
|
|
82
|
+
export type GetThreadDetailsEvent = BaseEvent & {
|
|
83
|
+
type: 'action:storage:get-thread-details';
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type GetThreadDetailsResultEvent = BaseEvent & {
|
|
87
|
+
type: 'action:storage:get-thread-details-result';
|
|
88
|
+
data: {
|
|
89
|
+
threadDetails: ThreadDetails | null;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
79
93
|
export type GetAgentsEvent = BaseEvent & {
|
|
80
94
|
type: 'action:storage:get-agents';
|
|
81
95
|
};
|
|
@@ -94,7 +108,7 @@ export type GetPluginsEvent = BaseEvent & {
|
|
|
94
108
|
export type GetPluginsResultEvent = BaseEvent & {
|
|
95
109
|
type: 'action:storage:get-plugins-result';
|
|
96
110
|
data: {
|
|
97
|
-
plugins:
|
|
111
|
+
plugins: PluginDescriptor[];
|
|
98
112
|
};
|
|
99
113
|
};
|
|
100
114
|
|
|
@@ -123,6 +137,59 @@ export type GetAgentDetailsResultEvent = BaseEvent & {
|
|
|
123
137
|
};
|
|
124
138
|
};
|
|
125
139
|
|
|
140
|
+
export type CreateAgentEvent = BaseEvent & {
|
|
141
|
+
type: 'action:storage:create-agent';
|
|
142
|
+
data: {
|
|
143
|
+
agentId: string;
|
|
144
|
+
name: string;
|
|
145
|
+
description?: string;
|
|
146
|
+
instructions: string;
|
|
147
|
+
plugins: PluginRef[];
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export type CreateAgentResultEvent = BaseEvent & {
|
|
152
|
+
type: 'action:storage:create-agent-result';
|
|
153
|
+
data: {
|
|
154
|
+
success: boolean;
|
|
155
|
+
error?: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type UpdateAgentEvent = BaseEvent & {
|
|
160
|
+
type: 'action:storage:update-agent';
|
|
161
|
+
data: {
|
|
162
|
+
agentId: string;
|
|
163
|
+
name?: string;
|
|
164
|
+
description?: string;
|
|
165
|
+
instructions?: string;
|
|
166
|
+
plugins?: PluginRef[];
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type UpdateAgentResultEvent = BaseEvent & {
|
|
171
|
+
type: 'action:storage:update-agent-result';
|
|
172
|
+
data: {
|
|
173
|
+
success: boolean;
|
|
174
|
+
error?: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type DeleteAgentEvent = BaseEvent & {
|
|
179
|
+
type: 'action:storage:delete-agent';
|
|
180
|
+
data: {
|
|
181
|
+
agentId: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type DeleteAgentResultEvent = BaseEvent & {
|
|
186
|
+
type: 'action:storage:delete-agent-result';
|
|
187
|
+
data: {
|
|
188
|
+
success: boolean;
|
|
189
|
+
error?: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
|
|
126
193
|
export type StreamThreadEvent = BaseEvent & {
|
|
127
194
|
type: 'stream:thread';
|
|
128
195
|
data: {
|
|
@@ -142,6 +209,38 @@ export type GetVariablesResultEvent = BaseEvent & {
|
|
|
142
209
|
};
|
|
143
210
|
};
|
|
144
211
|
|
|
212
|
+
export type CreateVariableEvent = BaseEvent & {
|
|
213
|
+
type: 'action:storage:create-variable';
|
|
214
|
+
data: {
|
|
215
|
+
key: string;
|
|
216
|
+
value: string;
|
|
217
|
+
secret?: boolean;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export type CreateVariableResultEvent = BaseEvent & {
|
|
222
|
+
type: 'action:storage:create-variable-result';
|
|
223
|
+
data: {
|
|
224
|
+
success: boolean;
|
|
225
|
+
error?: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type DeleteVariableEvent = BaseEvent & {
|
|
230
|
+
type: 'action:storage:delete-variable';
|
|
231
|
+
data: {
|
|
232
|
+
key: string;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export type DeleteVariableResultEvent = BaseEvent & {
|
|
237
|
+
type: 'action:storage:delete-variable-result';
|
|
238
|
+
data: {
|
|
239
|
+
success: boolean;
|
|
240
|
+
error?: string;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
|
|
145
244
|
export type PatchChannelStateEvent = BaseEvent & {
|
|
146
245
|
type: 'action:storage:patch-channel-state';
|
|
147
246
|
data: {
|
|
@@ -346,22 +445,128 @@ export type UpdateChannelResultEvent = BaseEvent & {
|
|
|
346
445
|
};
|
|
347
446
|
};
|
|
348
447
|
|
|
448
|
+
export type UIWidgetAction = {
|
|
449
|
+
id: string;
|
|
450
|
+
label: string;
|
|
451
|
+
value?: unknown;
|
|
452
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
453
|
+
disabled?: boolean;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export type UIWidgetField = {
|
|
457
|
+
id: string;
|
|
458
|
+
label: string;
|
|
459
|
+
type: 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'multiselect' | 'date';
|
|
460
|
+
description?: string;
|
|
461
|
+
placeholder?: string;
|
|
462
|
+
required?: boolean;
|
|
463
|
+
options?: Array<{ label: string; value: string }>;
|
|
464
|
+
defaultValue?: unknown;
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
export type UIWidgetListItem = {
|
|
468
|
+
id: string;
|
|
469
|
+
label: string;
|
|
470
|
+
description?: string;
|
|
471
|
+
status?: 'pending' | 'in_progress' | 'done' | 'error' | 'cancelled';
|
|
472
|
+
metadata?: Record<string, unknown>;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
export type UIWidgetBase = {
|
|
476
|
+
widgetId: string;
|
|
477
|
+
title?: string;
|
|
478
|
+
description?: string;
|
|
479
|
+
body?: string;
|
|
480
|
+
state?: 'open' | 'submitted' | 'cancelled' | 'error';
|
|
481
|
+
metadata?: Record<string, unknown>;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
export type UIMessageWidget = UIWidgetBase & {
|
|
485
|
+
kind: 'message';
|
|
486
|
+
actions?: UIWidgetAction[];
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
export type UIChoiceWidget = UIWidgetBase & {
|
|
490
|
+
kind: 'choice';
|
|
491
|
+
actions: UIWidgetAction[];
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
export type UIFormWidget = UIWidgetBase & {
|
|
495
|
+
kind: 'form';
|
|
496
|
+
fields: UIWidgetField[];
|
|
497
|
+
submitLabel?: string;
|
|
498
|
+
actions?: UIWidgetAction[];
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
export type UIListWidget = UIWidgetBase & {
|
|
502
|
+
kind: 'list';
|
|
503
|
+
items: UIWidgetListItem[];
|
|
504
|
+
actions?: UIWidgetAction[];
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export type UIWidgetSpec = UIMessageWidget | UIChoiceWidget | UIFormWidget | UIListWidget;
|
|
508
|
+
|
|
509
|
+
export type RenderUIWidgetData =
|
|
510
|
+
| (Omit<UIMessageWidget, 'widgetId'> & { widgetId?: string })
|
|
511
|
+
| (Omit<UIChoiceWidget, 'widgetId'> & { widgetId?: string })
|
|
512
|
+
| (Omit<UIFormWidget, 'widgetId'> & { widgetId?: string })
|
|
513
|
+
| (Omit<UIListWidget, 'widgetId'> & { widgetId?: string })
|
|
514
|
+
| {
|
|
515
|
+
kind: 'approval' | 'todo_list';
|
|
516
|
+
widgetId?: string;
|
|
517
|
+
title?: string;
|
|
518
|
+
props?: Record<string, unknown>;
|
|
519
|
+
metadata?: Record<string, unknown>;
|
|
520
|
+
};
|
|
521
|
+
|
|
349
522
|
export type UIWidgetEvent = BaseEvent & {
|
|
350
523
|
type: 'client:ui:widget';
|
|
351
|
-
data:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
props: Record<string, unknown>;
|
|
524
|
+
data: UIWidgetSpec;
|
|
525
|
+
meta: {
|
|
526
|
+
agentId: string;
|
|
527
|
+
threadId?: string;
|
|
356
528
|
};
|
|
357
529
|
};
|
|
358
530
|
|
|
359
531
|
export type RenderUIWidgetEvent = BaseEvent & {
|
|
360
532
|
type: 'action:render_ui_widget';
|
|
533
|
+
data: RenderUIWidgetData;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
export type UIWidgetResponseEvent = BaseEvent & {
|
|
537
|
+
type: 'client:ui:widget:response';
|
|
538
|
+
data: {
|
|
539
|
+
widgetId: string;
|
|
540
|
+
actionId: string;
|
|
541
|
+
values?: Record<string, unknown>;
|
|
542
|
+
metadata?: Record<string, unknown>;
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export type HandoffEvent = BaseEvent & {
|
|
547
|
+
type: 'action:handoff';
|
|
361
548
|
data: {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
549
|
+
agentId: string;
|
|
550
|
+
content: string;
|
|
551
|
+
};
|
|
552
|
+
meta?: {
|
|
553
|
+
toolCallId?: string;
|
|
554
|
+
[key: string]: any;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
export type HandoffResultEvent = BaseEvent & {
|
|
559
|
+
type: 'action:handoff:result';
|
|
560
|
+
data: {
|
|
561
|
+
success: boolean;
|
|
562
|
+
agentId: string;
|
|
563
|
+
accepted: boolean;
|
|
564
|
+
};
|
|
565
|
+
meta: {
|
|
566
|
+
toolCallId: string;
|
|
567
|
+
agentId: string;
|
|
568
|
+
threadId?: string;
|
|
569
|
+
[key: string]: any;
|
|
365
570
|
};
|
|
366
571
|
};
|
|
367
572
|
|
|
@@ -371,9 +576,45 @@ export type DelegateEvent = BaseEvent & {
|
|
|
371
576
|
agentId: string;
|
|
372
577
|
content: string;
|
|
373
578
|
};
|
|
579
|
+
meta?: {
|
|
580
|
+
toolCallId?: string;
|
|
581
|
+
[key: string]: any;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
export type DelegateResultEvent = BaseEvent & {
|
|
586
|
+
type: 'action:delegate:result';
|
|
587
|
+
data: {
|
|
588
|
+
success: boolean;
|
|
589
|
+
agentId: string;
|
|
590
|
+
summary: string;
|
|
591
|
+
};
|
|
374
592
|
meta: {
|
|
375
593
|
toolCallId: string;
|
|
594
|
+
agentId: string;
|
|
595
|
+
threadId?: string;
|
|
596
|
+
[key: string]: any;
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/** Internal routing: delegation plugin → orchestrator only (not stored or broadcast). */
|
|
601
|
+
export type HandoffRequestEvent = BaseEvent & {
|
|
602
|
+
type: 'handoff:request';
|
|
603
|
+
data: {
|
|
604
|
+
agentId: string;
|
|
605
|
+
content: string;
|
|
606
|
+
};
|
|
607
|
+
meta?: Record<string, unknown>;
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
/** Internal routing: delegation plugin → orchestrator only (not stored or broadcast). */
|
|
611
|
+
export type DelegationRequestEvent = BaseEvent & {
|
|
612
|
+
type: 'delegation:request';
|
|
613
|
+
data: {
|
|
614
|
+
agentId: string;
|
|
615
|
+
content: string;
|
|
376
616
|
};
|
|
617
|
+
meta?: Record<string, unknown>;
|
|
377
618
|
};
|
|
378
619
|
|
|
379
620
|
export type MCPListToolsEvent = BaseEvent & {
|
|
@@ -413,6 +654,35 @@ export type MCPCallResultEvent = BaseEvent & {
|
|
|
413
654
|
};
|
|
414
655
|
};
|
|
415
656
|
|
|
657
|
+
export type ShellExecEvent = BaseEvent & {
|
|
658
|
+
type: 'action:shell_exec';
|
|
659
|
+
data: {
|
|
660
|
+
command: string;
|
|
661
|
+
cwd?: string;
|
|
662
|
+
shell?: string;
|
|
663
|
+
timeoutMs?: number;
|
|
664
|
+
};
|
|
665
|
+
meta?: {
|
|
666
|
+
toolCallId?: string;
|
|
667
|
+
approvalId?: string;
|
|
668
|
+
approvalStatus?: 'approved' | 'denied';
|
|
669
|
+
[key: string]: any;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
export type ShellExecResultEvent = BaseEvent & {
|
|
674
|
+
type: 'action:shell_exec:result';
|
|
675
|
+
data: {
|
|
676
|
+
success: boolean;
|
|
677
|
+
approved?: boolean;
|
|
678
|
+
exitCode: number | null;
|
|
679
|
+
stdout: string;
|
|
680
|
+
stderr: string;
|
|
681
|
+
timedOut: boolean;
|
|
682
|
+
error?: string;
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
|
|
416
686
|
export type UserInputEvent = BaseEvent & {
|
|
417
687
|
type: 'user:input';
|
|
418
688
|
data: {
|
|
@@ -425,6 +695,131 @@ export type UserInputEvent = BaseEvent & {
|
|
|
425
695
|
};
|
|
426
696
|
};
|
|
427
697
|
|
|
698
|
+
export type InstallPluginEvent = BaseEvent & {
|
|
699
|
+
type: 'action:plugin:install';
|
|
700
|
+
data: {
|
|
701
|
+
name: string;
|
|
702
|
+
version?: string;
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
export type InstallPluginResultEvent = BaseEvent & {
|
|
707
|
+
type: 'action:plugin:install:result';
|
|
708
|
+
data: {
|
|
709
|
+
success: boolean;
|
|
710
|
+
plugin?: { name: string; version: string };
|
|
711
|
+
error?: string;
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
export type UninstallPluginEvent = BaseEvent & {
|
|
716
|
+
type: 'action:plugin:uninstall';
|
|
717
|
+
data: {
|
|
718
|
+
id: string;
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
export type UninstallPluginResultEvent = BaseEvent & {
|
|
723
|
+
type: 'action:plugin:uninstall:result';
|
|
724
|
+
data: {
|
|
725
|
+
success: boolean;
|
|
726
|
+
error?: string;
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
export type ListMarketplaceAgentsEvent = BaseEvent & {
|
|
731
|
+
type: 'action:marketplace:list';
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
export type ListMarketplaceAgentsResultEvent = BaseEvent & {
|
|
735
|
+
type: 'action:marketplace:list:result';
|
|
736
|
+
data: {
|
|
737
|
+
success: boolean;
|
|
738
|
+
agents: Array<{
|
|
739
|
+
id: string;
|
|
740
|
+
name: string;
|
|
741
|
+
description: string;
|
|
742
|
+
image?: string;
|
|
743
|
+
instructions: string;
|
|
744
|
+
plugins: PluginRef[];
|
|
745
|
+
}>;
|
|
746
|
+
error?: string;
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
export type InstallAgentEvent = BaseEvent & {
|
|
751
|
+
type: 'action:agent:install';
|
|
752
|
+
data: {
|
|
753
|
+
agentId: string;
|
|
754
|
+
name: string;
|
|
755
|
+
description?: string;
|
|
756
|
+
instructions: string;
|
|
757
|
+
plugins: PluginRef[];
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
export type InstallAgentResultEvent = BaseEvent & {
|
|
762
|
+
type: 'action:agent:install:result';
|
|
763
|
+
data: {
|
|
764
|
+
success: boolean;
|
|
765
|
+
agentId: string;
|
|
766
|
+
error?: string;
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
export type MemoryScopeAlias = 'global' | 'agent' | 'channel';
|
|
771
|
+
|
|
772
|
+
export type RememberEvent = BaseEvent & {
|
|
773
|
+
type: 'action:remember';
|
|
774
|
+
data: {
|
|
775
|
+
content: string;
|
|
776
|
+
scope?: MemoryScopeAlias;
|
|
777
|
+
tags?: string[];
|
|
778
|
+
};
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
export type RememberResultEvent = BaseEvent & {
|
|
782
|
+
type: 'action:remember:result';
|
|
783
|
+
data: {
|
|
784
|
+
success: boolean;
|
|
785
|
+
record?: MemoryRecord;
|
|
786
|
+
error?: string;
|
|
787
|
+
};
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
export type RecallEvent = BaseEvent & {
|
|
791
|
+
type: 'action:recall';
|
|
792
|
+
data: {
|
|
793
|
+
query?: string;
|
|
794
|
+
tag?: string;
|
|
795
|
+
scope?: MemoryScopeAlias | 'all';
|
|
796
|
+
limit?: number;
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
export type RecallResultEvent = BaseEvent & {
|
|
801
|
+
type: 'action:recall:result';
|
|
802
|
+
data: {
|
|
803
|
+
success: boolean;
|
|
804
|
+
records: MemoryRecord[];
|
|
805
|
+
error?: string;
|
|
806
|
+
};
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
export type ForgetEvent = BaseEvent & {
|
|
810
|
+
type: 'action:forget';
|
|
811
|
+
data: { id: string };
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
export type ForgetResultEvent = BaseEvent & {
|
|
815
|
+
type: 'action:forget:result';
|
|
816
|
+
data: {
|
|
817
|
+
success: boolean;
|
|
818
|
+
deleted: boolean;
|
|
819
|
+
error?: string;
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
|
|
428
823
|
export type OpenBotEvent =
|
|
429
824
|
| UserInputEvent
|
|
430
825
|
| AgentInvokeEvent
|
|
@@ -438,17 +833,29 @@ export type OpenBotEvent =
|
|
|
438
833
|
| GetThreadsResultEvent
|
|
439
834
|
| GetChannelDetailsEvent
|
|
440
835
|
| GetChannelDetailsResultEvent
|
|
836
|
+
| GetThreadDetailsEvent
|
|
837
|
+
| GetThreadDetailsResultEvent
|
|
441
838
|
| GetAgentsEvent
|
|
442
839
|
| GetAgentsResultEvent
|
|
443
840
|
| GetPluginsEvent
|
|
444
841
|
| GetPluginsResultEvent
|
|
445
842
|
| GetAgentDetailsEvent
|
|
446
843
|
| GetAgentDetailsResultEvent
|
|
844
|
+
| CreateAgentEvent
|
|
845
|
+
| CreateAgentResultEvent
|
|
846
|
+
| UpdateAgentEvent
|
|
847
|
+
| UpdateAgentResultEvent
|
|
848
|
+
| DeleteAgentEvent
|
|
849
|
+
| DeleteAgentResultEvent
|
|
447
850
|
| GetEventsEvent
|
|
448
851
|
| GetEventsResultEvent
|
|
449
852
|
| StreamThreadEvent
|
|
450
853
|
| GetVariablesEvent
|
|
451
854
|
| GetVariablesResultEvent
|
|
855
|
+
| CreateVariableEvent
|
|
856
|
+
| CreateVariableResultEvent
|
|
857
|
+
| DeleteVariableEvent
|
|
858
|
+
| DeleteVariableResultEvent
|
|
452
859
|
| PatchChannelStateEvent
|
|
453
860
|
| PatchChannelStateResultEvent
|
|
454
861
|
| PatchThreadStateEvent
|
|
@@ -469,8 +876,30 @@ export type OpenBotEvent =
|
|
|
469
876
|
| UpdateChannelResultEvent
|
|
470
877
|
| UIWidgetEvent
|
|
471
878
|
| RenderUIWidgetEvent
|
|
879
|
+
| UIWidgetResponseEvent
|
|
880
|
+
| HandoffEvent
|
|
881
|
+
| HandoffResultEvent
|
|
472
882
|
| DelegateEvent
|
|
883
|
+
| DelegateResultEvent
|
|
884
|
+
| HandoffRequestEvent
|
|
885
|
+
| DelegationRequestEvent
|
|
473
886
|
| MCPListToolsEvent
|
|
474
887
|
| MCPListToolsResultEvent
|
|
475
888
|
| MCPCallEvent
|
|
476
|
-
| MCPCallResultEvent
|
|
889
|
+
| MCPCallResultEvent
|
|
890
|
+
| ShellExecEvent
|
|
891
|
+
| ShellExecResultEvent
|
|
892
|
+
| InstallPluginEvent
|
|
893
|
+
| InstallPluginResultEvent
|
|
894
|
+
| UninstallPluginEvent
|
|
895
|
+
| UninstallPluginResultEvent
|
|
896
|
+
| ListMarketplaceAgentsEvent
|
|
897
|
+
| ListMarketplaceAgentsResultEvent
|
|
898
|
+
| InstallAgentEvent
|
|
899
|
+
| InstallAgentResultEvent
|
|
900
|
+
| RememberEvent
|
|
901
|
+
| RememberResultEvent
|
|
902
|
+
| RecallEvent
|
|
903
|
+
| RecallResultEvent
|
|
904
|
+
| ForgetEvent
|
|
905
|
+
| ForgetResultEvent;
|
package/src/assets/icon.svg
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
<svg
|
|
1
|
+
<svg width="60.2" height="58.1" viewBox="262.8 360.5 84.2 82.1" fill="#9333EA" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M301.841 380.896C302.069 380.893 302.297 380.889 302.531 380.885C304.636 380.853 306.741 380.836 308.845 380.822C310.26 380.813 311.675 380.8 313.09 380.775C314.456 380.752 315.822 380.739 317.189 380.735C317.71 380.731 318.231 380.724 318.752 380.712C322.824 380.626 322.824 380.626 323.909 381.43C324.315 382.025 324.561 382.569 324.8 383.246C324.965 383.518 325.13 383.789 325.301 384.068C325.519 384.445 325.519 384.445 325.741 384.83C325.909 385.118 326.077 385.407 326.249 385.704C326.336 385.854 326.423 386.004 326.513 386.159C328.304 389.25 330.137 392.314 332.004 395.361C332.482 396.144 332.957 396.929 333.431 397.715C333.631 398.035 333.631 398.035 333.835 398.361C334.546 399.544 334.969 400.367 334.7 401.777C334.24 402.838 333.683 403.834 333.113 404.839C332.867 405.285 332.621 405.73 332.375 406.176C332.125 406.626 331.874 407.075 331.622 407.525C330.952 408.724 330.296 409.931 329.639 411.137C329.518 411.359 329.397 411.58 329.272 411.807C328.303 413.581 327.349 415.362 326.398 417.144C324.53 420.642 322.621 424.107 320.611 427.525C320.282 428.088 319.962 428.655 319.644 429.224C319.215 429.954 319.215 429.954 318.708 430.462C317.978 430.557 317.978 430.557 317.185 430.462C316.049 429.578 315.42 428.258 314.71 427.035C313.685 425.291 312.637 423.6 311.454 421.96C311.024 421.203 310.906 420.668 310.838 419.8C311.092 419.081 311.092 419.081 311.491 418.343C311.707 417.937 311.707 417.937 311.927 417.522C312.081 417.242 312.235 416.963 312.393 416.675C312.615 416.26 312.615 416.26 312.841 415.836C314.003 413.671 314.003 413.671 314.549 412.797C315.269 411.676 315.269 411.676 315.308 410.387C314.801 409.466 314.268 408.575 313.694 407.695C313.466 407.335 313.238 406.976 313.011 406.616C312.845 406.353 312.845 406.353 312.676 406.085C312.247 405.402 311.829 404.713 311.425 404.014C311.304 403.806 311.183 403.598 311.058 403.384C310.786 402.65 310.848 402.26 311.092 401.523C311.6 401.015 311.6 401.015 312.57 400.967C312.988 400.97 313.407 400.975 313.826 400.982C314.281 400.981 314.737 400.981 315.192 400.98C315.911 400.98 316.629 400.984 317.348 400.995C318.041 401.005 318.733 401.002 319.427 400.998C319.641 401.004 319.854 401.011 320.075 401.017C320.695 401.007 321.171 400.974 321.754 400.762C322.329 400.154 322.665 399.481 323.023 398.731C323.171 398.49 323.318 398.248 323.47 398C323.899 397.287 324.326 396.573 324.752 395.859C324.904 395.608 325.056 395.357 325.212 395.099C325.355 394.859 325.498 394.618 325.646 394.371C325.841 394.045 325.841 394.045 326.04 393.713C326.38 393.138 326.38 393.138 326.323 392.385C326.167 392.384 326.011 392.383 325.85 392.383C322.054 392.368 318.257 392.349 314.461 392.325C312.625 392.313 310.789 392.303 308.953 392.297C307.352 392.291 305.752 392.282 304.152 392.271C303.305 392.265 302.458 392.26 301.61 392.258C300.664 392.256 299.719 392.249 298.773 392.241C298.351 392.241 298.351 392.241 297.921 392.242C297.663 392.238 297.406 392.235 297.14 392.232C296.916 392.231 296.693 392.23 296.462 392.228C295.73 392.109 295.379 391.879 294.846 391.369C294.591 389.978 295.187 388.999 295.837 387.818C295.938 387.63 296.038 387.441 296.142 387.246C296.464 386.646 296.789 386.049 297.115 385.451C297.333 385.045 297.551 384.638 297.769 384.231C299.545 380.925 299.545 380.925 301.841 380.896Z" fill="#9333EA"/>
|
|
3
|
+
<path d="M291.476 372.547C292.795 373.009 293.243 374.055 293.942 375.218C294.23 375.684 294.519 376.15 294.807 376.615C294.945 376.84 295.082 377.065 295.223 377.297C295.544 377.813 295.875 378.314 296.225 378.811C296.388 379.044 296.551 379.277 296.718 379.518C296.856 379.711 296.994 379.903 297.137 380.102C297.492 380.97 297.407 381.615 297.131 382.485C296.704 383.459 296.209 384.39 295.703 385.325C295.497 385.714 295.497 385.714 295.287 386.111C294.44 387.702 293.559 389.255 292.565 390.759C292.217 391.585 292.351 392.026 292.562 392.892C292.955 393.665 292.955 393.665 293.466 394.431C293.555 394.572 293.644 394.713 293.736 394.858C294.019 395.304 294.305 395.748 294.592 396.192C294.971 396.778 295.346 397.365 295.719 397.953C295.886 398.212 296.053 398.471 296.225 398.738C296.646 399.535 296.848 400.115 296.877 401.015C296.559 401.435 296.559 401.435 296.115 401.777C295.364 401.849 294.663 401.877 293.911 401.871C293.467 401.876 293.023 401.88 292.579 401.885C291.879 401.887 291.18 401.888 290.48 401.888C289.804 401.888 289.129 401.895 288.453 401.903C288.244 401.901 288.036 401.899 287.82 401.897C286.637 401.91 286.637 401.91 285.616 402.466C284.844 403.543 284.229 404.69 283.598 405.854C283.455 406.11 283.312 406.365 283.165 406.628C283.031 406.873 282.897 407.118 282.76 407.371C282.637 407.594 282.515 407.818 282.389 408.048C282.071 408.656 282.071 408.656 282.408 409.392C282.559 409.393 282.71 409.394 282.865 409.395C286.539 409.416 290.213 409.439 293.886 409.465C295.663 409.478 297.439 409.49 299.216 409.499C300.929 409.509 302.642 409.521 304.356 409.534C305.011 409.539 305.665 409.543 306.32 409.546C307.235 409.55 308.15 409.557 309.064 409.565C309.473 409.566 309.473 409.566 309.89 409.567C310.139 409.57 310.388 409.573 310.644 409.576C310.861 409.577 311.077 409.578 311.3 409.58C311.854 409.646 311.854 409.646 312.615 410.154C312.797 411.581 312.41 412.577 311.745 413.808C311.656 413.979 311.567 414.15 311.475 414.326C311.288 414.685 311.099 415.042 310.908 415.399C310.616 415.946 310.329 416.495 310.042 417.045C309.859 417.394 309.676 417.743 309.492 418.092C309.363 418.337 309.363 418.337 309.231 418.588C308.881 419.242 308.574 419.78 308.046 420.308C307.364 420.361 306.707 420.382 306.024 420.382C305.815 420.383 305.606 420.385 305.391 420.387C304.698 420.392 304.005 420.392 303.312 420.393C302.832 420.395 302.351 420.396 301.871 420.398C300.862 420.401 299.854 420.402 298.845 420.402C297.552 420.402 296.259 420.409 294.966 420.417C293.973 420.423 292.98 420.424 291.987 420.424C291.51 420.424 291.034 420.427 290.557 420.431C289.89 420.436 289.224 420.434 288.557 420.431C288.36 420.434 288.163 420.437 287.959 420.44C287.061 420.429 286.569 420.386 285.852 419.824C285.47 419.314 285.137 418.817 284.831 418.259C284.718 418.056 284.605 417.852 284.488 417.643C284.367 417.423 284.246 417.203 284.121 416.976C282.907 414.808 281.638 412.679 280.329 410.566C280.156 410.286 279.982 410.006 279.803 409.717C279.469 409.176 279.134 408.636 278.799 408.096C277.871 406.592 276.959 405.077 276.062 403.554C275.968 403.409 275.874 403.264 275.777 403.114C275.143 402.097 274.834 401.442 275.046 400.254C275.425 399.337 275.889 398.475 276.363 397.604C276.568 397.22 276.568 397.22 276.777 396.828C278.005 394.541 279.284 392.283 280.569 390.029C282.224 387.119 283.868 384.197 285.327 381.184C289.509 372.654 289.509 372.654 291.476 372.547Z" fill="#9333EA"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MelonyPlugin } from 'melony';
|
|
2
|
+
import { OpenBotEvent, OpenBotState } from '../app/types.js';
|
|
3
|
+
import { AgentDetails, ConfigSchema, Storage } from './types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reference to a plugin from an agent's AGENT.md frontmatter.
|
|
7
|
+
*
|
|
8
|
+
* The `id` is either a built-in plugin id (e.g. `ai-sdk`, `shell`) or an npm
|
|
9
|
+
* package name (e.g. `openbot-plugin-codex`, `@scope/openbot-plugin-foo`).
|
|
10
|
+
* Each entry may carry plugin-specific `config`.
|
|
11
|
+
*/
|
|
12
|
+
export interface PluginRef {
|
|
13
|
+
id: string;
|
|
14
|
+
config?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Tool definition shape contributed by a plugin and consumed by runtime plugins. */
|
|
18
|
+
export interface ToolDefinition {
|
|
19
|
+
description: string;
|
|
20
|
+
inputSchema: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Context passed to a Plugin factory at runtime.
|
|
25
|
+
*
|
|
26
|
+
* `tools` is the merged tool map collected from every tool plugin attached to
|
|
27
|
+
* the same agent. Runtime plugins read it to feed an LLM; tool plugins ignore
|
|
28
|
+
* it. The agent loader is responsible for the merge and collision detection.
|
|
29
|
+
*/
|
|
30
|
+
export interface PluginContext {
|
|
31
|
+
agentId: string;
|
|
32
|
+
agentDetails: AgentDetails;
|
|
33
|
+
config: Record<string, unknown>;
|
|
34
|
+
storage: Storage;
|
|
35
|
+
tools: Record<string, ToolDefinition>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A Plugin is the single extension unit on the OpenBot bus.
|
|
40
|
+
*
|
|
41
|
+
* The bus does not care whether a plugin owns the LLM loop (a "runtime"
|
|
42
|
+
* plugin), contributes tools (a "tool" plugin), or layers behaviour (e.g.
|
|
43
|
+
* approval middleware). Roles are defined entirely by which events the plugin
|
|
44
|
+
* subscribes to and emits.
|
|
45
|
+
*
|
|
46
|
+
* - Runtime plugins typically handle `agent:invoke` and may consume `tools`.
|
|
47
|
+
* - Tool plugins typically expose `toolDefinitions` and handle `action:<tool>`.
|
|
48
|
+
* - Middleware plugins observe events and (re-)emit them with extra logic.
|
|
49
|
+
*
|
|
50
|
+
* An agent must include at least one plugin that handles `agent:invoke`; the
|
|
51
|
+
* loader cannot enforce this statically (handlers are registered at factory
|
|
52
|
+
* time), so misconfigured agents will simply not respond.
|
|
53
|
+
*/
|
|
54
|
+
export interface Plugin {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
image?: string;
|
|
59
|
+
/** Optional system-prompt body suggested when this plugin is used as the runtime. */
|
|
60
|
+
defaultInstructions?: string;
|
|
61
|
+
/** JSON-schema-like description of `config` accepted in AGENT.md `plugins[].config`. */
|
|
62
|
+
configSchema?: ConfigSchema;
|
|
63
|
+
/** Tool definitions contributed to any runtime plugin attached to the same agent. */
|
|
64
|
+
toolDefinitions?: Record<string, ToolDefinition>;
|
|
65
|
+
/** Build the Melony plugin that wires this plugin onto the bus for one run. */
|
|
66
|
+
factory: (context: PluginContext) => MelonyPlugin<OpenBotState, OpenBotEvent>;
|
|
67
|
+
}
|