openbot 0.4.7 → 0.5.5
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/.claude/agents/runtime-security-reviewer.md +32 -0
- package/.claude/hooks/format.sh +18 -0
- package/.claude/hooks/protect-secrets.sh +23 -0
- package/.claude/settings.json +26 -0
- package/.claude/skills/deploy/SKILL.md +26 -0
- package/.claude/skills/new-plugin/SKILL.md +46 -0
- package/.dockerignore +9 -0
- package/.mcp.json +8 -0
- package/AGENTS.md +2 -2
- package/CLAUDE.md +51 -0
- package/Dockerfile +41 -0
- package/deploy/README.md +59 -0
- package/deploy/entrypoint.sh +6 -0
- package/deploy/fly.toml +36 -0
- package/dist/app/bootstrap.js +29 -0
- package/dist/app/cli.js +5 -1
- package/dist/app/cloud-mode.js +15 -0
- package/dist/app/config.js +61 -16
- package/dist/app/ensure-default-stack.js +54 -0
- package/dist/app/openbot-plugin.js +4 -0
- package/dist/app/server.js +37 -6
- package/dist/harness/index.js +3 -0
- package/dist/plugins/approval/index.js +1 -1
- package/dist/plugins/bash/index.js +386 -164
- package/dist/plugins/memory/service.js +2 -5
- package/dist/plugins/openbot/context.js +17 -1
- package/dist/plugins/openbot/index.js +23 -7
- package/dist/plugins/openbot/model.js +20 -0
- package/dist/plugins/openbot/runtime.js +45 -57
- package/dist/plugins/openbot/system-prompt.js +43 -8
- package/dist/plugins/preview/index.js +267 -0
- package/dist/plugins/storage/index.js +3 -325
- package/dist/plugins/storage/service.js +61 -18
- package/dist/plugins/todo/index.js +131 -38
- package/dist/plugins/todo/service.js +93 -0
- package/dist/plugins/ui/index.js +8 -1
- package/dist/services/plugins/host.js +21 -0
- package/dist/services/plugins/model-registry.js +126 -0
- package/dist/services/plugins/registry.js +28 -42
- package/dist/services/plugins/service.js +2 -6
- package/docs/agents.md +20 -2
- package/docs/architecture.md +1 -1
- package/docs/plugins.md +13 -3
- package/docs/templates/AGENT.example.md +8 -14
- package/package.json +5 -2
- package/pnpm-workspace.yaml +2 -0
- package/src/app/bootstrap.ts +43 -0
- package/src/app/cli.ts +5 -1
- package/src/app/cloud-mode.ts +26 -0
- package/src/app/config.ts +71 -19
- package/src/app/ensure-default-stack.ts +63 -0
- package/src/app/openbot-plugin.ts +5 -0
- package/src/app/server.ts +42 -6
- package/src/app/types.ts +158 -32
- package/src/harness/index.ts +4 -0
- package/src/plugins/memory/service.ts +2 -5
- package/src/plugins/storage/index.ts +3 -371
- package/src/plugins/storage/service.ts +81 -22
- package/src/services/plugins/domain.ts +2 -0
- package/src/services/plugins/host.ts +36 -0
- package/src/services/plugins/model-registry.ts +178 -0
- package/src/services/plugins/registry.ts +30 -43
- package/src/services/plugins/service.ts +8 -17
- package/src/services/plugins/types.ts +36 -2
- package/src/services/todo/types.ts +12 -0
- package/dist/agents/openbot/index.js +0 -76
- package/dist/agents/openbot/middleware/approval.js +0 -132
- package/dist/agents/openbot/runtime.js +0 -289
- package/dist/agents/openbot/system-prompt.js +0 -32
- package/dist/agents/openbot/tools/delegation.js +0 -78
- package/dist/agents/openbot/tools/mcp.js +0 -99
- package/dist/agents/openbot/tools/shell.js +0 -91
- package/dist/agents/openbot/tools/storage.js +0 -75
- package/dist/agents/openbot/tools/ui.js +0 -176
- package/dist/agents/system.js +0 -33
- package/dist/bus/agent-package.js +0 -1
- package/dist/bus/plugin.js +0 -1
- package/dist/bus/services.js +0 -754
- package/dist/harness/agent-harness.js +0 -45
- package/dist/harness/agent-invoke-run.js +0 -44
- package/dist/harness/agent-turn.js +0 -99
- package/dist/harness/channel-participants.js +0 -40
- package/dist/harness/constants.js +0 -2
- package/dist/harness/context-meter.js +0 -97
- package/dist/harness/context.js +0 -363
- package/dist/harness/dispatch.js +0 -144
- package/dist/harness/dispatcher.js +0 -156
- package/dist/harness/event-normalizer.js +0 -59
- package/dist/harness/history.js +0 -177
- package/dist/harness/mcp.js +0 -61
- package/dist/harness/orchestration.js +0 -88
- package/dist/harness/orchestrator.js +0 -149
- package/dist/harness/participants.js +0 -22
- package/dist/harness/process.js +0 -29
- package/dist/harness/queue-processor.js +0 -187
- package/dist/harness/run-harness.js +0 -154
- package/dist/harness/run.js +0 -98
- package/dist/harness/runtime-factory.js +0 -73
- package/dist/harness/runtime.js +0 -57
- package/dist/harness/todo-advance.js +0 -93
- package/dist/harness/todo-dispatch.js +0 -51
- package/dist/harness/todos.js +0 -5
- package/dist/harness/turn.js +0 -79
- package/dist/harness/types.js +0 -1
- package/dist/plugins/ai-sdk/index.js +0 -34
- package/dist/plugins/ai-sdk/runtime.js +0 -395
- package/dist/plugins/ai-sdk/system-prompt.js +0 -18
- package/dist/plugins/ai-sdk.js +0 -331
- package/dist/plugins/approval.js +0 -163
- package/dist/plugins/delegation.js +0 -108
- package/dist/plugins/mcp/index.js +0 -108
- package/dist/plugins/mcp.js +0 -140
- package/dist/plugins/shell/index.js +0 -100
- package/dist/plugins/shell.js +0 -123
- package/dist/plugins/storage-tools/index.js +0 -76
- package/dist/plugins/storage.js +0 -737
- package/dist/plugins/thread-namer/index.js +0 -72
- package/dist/plugins/threads/index.js +0 -114
- package/dist/plugins/ui.js +0 -211
- package/dist/plugins/workflow/index.js +0 -65
- package/dist/registry/agents.js +0 -138
- package/dist/registry/plugins.js +0 -110
- package/dist/services/agent-packages.js +0 -103
- package/dist/services/memory.js +0 -152
- package/dist/services/plugins.js +0 -98
- package/dist/services/storage.js +0 -1028
- package/dist/workflow/service.js +0 -106
- package/dist/workflow/types.js +0 -3
- package/src/plugins/approval/index.ts +0 -147
- package/src/plugins/bash/index.ts +0 -232
- package/src/plugins/delegation/index.ts +0 -153
- package/src/plugins/memory/index.ts +0 -182
- package/src/plugins/openbot/context.ts +0 -121
- package/src/plugins/openbot/history.ts +0 -158
- package/src/plugins/openbot/index.ts +0 -80
- package/src/plugins/openbot/runtime.ts +0 -526
- package/src/plugins/openbot/system-prompt.ts +0 -22
- package/src/plugins/ui/index.ts +0 -123
- /package/dist/{bus → services/todo}/types.js +0 -0
package/src/app/types.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../services/plugins/domain.js';
|
|
10
10
|
import type { PluginRef } from '../services/plugins/types.js';
|
|
11
11
|
import type { MemoryRecord } from '../plugins/memory/service.js';
|
|
12
|
+
import type { TodoList } from '../services/todo/types.js';
|
|
12
13
|
|
|
13
14
|
export interface OpenBotState {
|
|
14
15
|
agentId: string;
|
|
@@ -323,7 +324,7 @@ export type PatchThreadDetailsResultEvent = BaseEvent & {
|
|
|
323
324
|
type: 'action:patch_thread_details:result';
|
|
324
325
|
data: {
|
|
325
326
|
success: boolean;
|
|
326
|
-
updatedFields:
|
|
327
|
+
updatedFields: 'state'[];
|
|
327
328
|
};
|
|
328
329
|
};
|
|
329
330
|
|
|
@@ -657,11 +658,16 @@ export type UIWidgetField = {
|
|
|
657
658
|
defaultValue?: unknown;
|
|
658
659
|
};
|
|
659
660
|
|
|
661
|
+
export type UIWidgetListItemStatusVariant = 'default' | 'success' | 'warning' | 'danger' | 'info';
|
|
662
|
+
|
|
660
663
|
export type UIWidgetListItem = {
|
|
661
664
|
id: string;
|
|
662
665
|
label: string;
|
|
663
666
|
description?: string;
|
|
664
|
-
status
|
|
667
|
+
/** Optional status label shown on the item (e.g. "Pending", "Shipped") */
|
|
668
|
+
status?: string;
|
|
669
|
+
/** Optional semantic hint for status coloring in the client */
|
|
670
|
+
statusVariant?: UIWidgetListItemStatusVariant;
|
|
665
671
|
metadata?: Record<string, unknown>;
|
|
666
672
|
};
|
|
667
673
|
|
|
@@ -737,11 +743,12 @@ export type UIWidgetResponseEvent = BaseEvent & {
|
|
|
737
743
|
};
|
|
738
744
|
};
|
|
739
745
|
|
|
740
|
-
export type
|
|
741
|
-
type: 'action:
|
|
746
|
+
export type ShellExecEvent = BaseEvent & {
|
|
747
|
+
type: 'action:shell_exec';
|
|
742
748
|
data: {
|
|
749
|
+
id: string;
|
|
750
|
+
exec_dir: string;
|
|
743
751
|
command: string;
|
|
744
|
-
restart?: boolean;
|
|
745
752
|
};
|
|
746
753
|
meta?: {
|
|
747
754
|
toolCallId?: string;
|
|
@@ -751,47 +758,116 @@ export type BashEvent = BaseEvent & {
|
|
|
751
758
|
};
|
|
752
759
|
};
|
|
753
760
|
|
|
754
|
-
export type
|
|
755
|
-
type: 'action:
|
|
761
|
+
export type ShellExecResultEvent = BaseEvent & {
|
|
762
|
+
type: 'action:shell_exec:result';
|
|
756
763
|
data: {
|
|
757
764
|
success: boolean;
|
|
758
765
|
approved?: boolean;
|
|
759
|
-
exitCode
|
|
760
|
-
stdout: string;
|
|
761
|
-
stderr: string;
|
|
762
|
-
timedOut: boolean;
|
|
766
|
+
exitCode?: number;
|
|
763
767
|
error?: string;
|
|
768
|
+
output?: string;
|
|
764
769
|
};
|
|
765
770
|
};
|
|
766
771
|
|
|
767
|
-
export type
|
|
768
|
-
type: 'action:
|
|
772
|
+
export type ShellViewEvent = BaseEvent & {
|
|
773
|
+
type: 'action:shell_view';
|
|
769
774
|
data: {
|
|
770
|
-
|
|
775
|
+
id: string;
|
|
771
776
|
};
|
|
772
777
|
};
|
|
773
778
|
|
|
774
|
-
export type
|
|
775
|
-
type: 'action:
|
|
779
|
+
export type ShellViewResultEvent = BaseEvent & {
|
|
780
|
+
type: 'action:shell_view:result';
|
|
776
781
|
data: {
|
|
777
782
|
success: boolean;
|
|
783
|
+
output?: string;
|
|
778
784
|
};
|
|
779
785
|
};
|
|
780
786
|
|
|
781
|
-
export type
|
|
782
|
-
type: 'action:
|
|
783
|
-
data: {
|
|
787
|
+
export type ShellWaitEvent = BaseEvent & {
|
|
788
|
+
type: 'action:shell_wait';
|
|
789
|
+
data: {
|
|
790
|
+
id: string;
|
|
791
|
+
seconds: number;
|
|
792
|
+
};
|
|
784
793
|
};
|
|
785
794
|
|
|
786
|
-
export type
|
|
787
|
-
type: 'action:
|
|
795
|
+
export type ShellWaitResultEvent = BaseEvent & {
|
|
796
|
+
type: 'action:shell_wait:result';
|
|
788
797
|
data: {
|
|
789
798
|
success: boolean;
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
799
|
+
waitedSeconds?: number;
|
|
800
|
+
output?: string;
|
|
801
|
+
};
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
export type ShellWriteToProcessEvent = BaseEvent & {
|
|
805
|
+
type: 'action:shell_write_to_process';
|
|
806
|
+
data: {
|
|
807
|
+
id: string;
|
|
808
|
+
input: string;
|
|
809
|
+
press_enter: boolean;
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
export type ShellWriteToProcessResultEvent = BaseEvent & {
|
|
814
|
+
type: 'action:shell_write_to_process:result';
|
|
815
|
+
data: {
|
|
816
|
+
success: boolean;
|
|
817
|
+
output?: string;
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
export type ShellKillProcessEvent = BaseEvent & {
|
|
822
|
+
type: 'action:shell_kill_process';
|
|
823
|
+
data: {
|
|
824
|
+
id: string;
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
export type ShellKillProcessResultEvent = BaseEvent & {
|
|
829
|
+
type: 'action:shell_kill_process:result';
|
|
830
|
+
data: {
|
|
831
|
+
success: boolean;
|
|
832
|
+
output?: string;
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
export type ExposePortEvent = BaseEvent & {
|
|
837
|
+
type: 'action:expose_port';
|
|
838
|
+
data: {
|
|
839
|
+
port: number;
|
|
840
|
+
};
|
|
841
|
+
meta?: {
|
|
842
|
+
toolCallId?: string;
|
|
843
|
+
approvalId?: string;
|
|
844
|
+
approvalStatus?: 'approved' | 'denied';
|
|
845
|
+
[key: string]: unknown;
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
export type ExposePortResultEvent = BaseEvent & {
|
|
850
|
+
type: 'action:expose_port:result';
|
|
851
|
+
data: {
|
|
852
|
+
success: boolean;
|
|
853
|
+
previewUrl?: string;
|
|
854
|
+
port?: number;
|
|
855
|
+
temporary?: boolean;
|
|
856
|
+
error?: string;
|
|
857
|
+
output?: string;
|
|
858
|
+
};
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
export type UnexposePortEvent = BaseEvent & {
|
|
862
|
+
type: 'action:unexpose_port';
|
|
863
|
+
data?: Record<string, never>;
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
export type UnexposePortResultEvent = BaseEvent & {
|
|
867
|
+
type: 'action:unexpose_port:result';
|
|
868
|
+
data: {
|
|
869
|
+
success: boolean;
|
|
870
|
+
output?: string;
|
|
795
871
|
};
|
|
796
872
|
};
|
|
797
873
|
|
|
@@ -968,6 +1044,44 @@ export type ForgetResultEvent = BaseEvent & {
|
|
|
968
1044
|
};
|
|
969
1045
|
};
|
|
970
1046
|
|
|
1047
|
+
export type TodoWriteEvent = BaseEvent & {
|
|
1048
|
+
type: 'action:todo_write';
|
|
1049
|
+
data: {
|
|
1050
|
+
items: Array<{
|
|
1051
|
+
id: string;
|
|
1052
|
+
content: string;
|
|
1053
|
+
status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
1054
|
+
}>;
|
|
1055
|
+
};
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
export type TodoWriteResultEvent = BaseEvent & {
|
|
1059
|
+
type: 'action:todo_write:result';
|
|
1060
|
+
data: {
|
|
1061
|
+
success: boolean;
|
|
1062
|
+
list?: TodoList;
|
|
1063
|
+
/** Text fed back to the model via history (`data.output`). */
|
|
1064
|
+
output: string;
|
|
1065
|
+
error?: string;
|
|
1066
|
+
};
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
export type TodoReadEvent = BaseEvent & {
|
|
1070
|
+
type: 'action:todo_read';
|
|
1071
|
+
data: Record<string, never>;
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
export type TodoReadResultEvent = BaseEvent & {
|
|
1075
|
+
type: 'action:todo_read:result';
|
|
1076
|
+
data: {
|
|
1077
|
+
success: boolean;
|
|
1078
|
+
list?: TodoList;
|
|
1079
|
+
/** Text fed back to the model via history (`data.output`). */
|
|
1080
|
+
output: string;
|
|
1081
|
+
error?: string;
|
|
1082
|
+
};
|
|
1083
|
+
};
|
|
1084
|
+
|
|
971
1085
|
export type DelegateTaskEvent = BaseEvent & {
|
|
972
1086
|
type: 'action:delegate_task';
|
|
973
1087
|
data: {
|
|
@@ -1101,12 +1215,20 @@ export type OpenBotEvent =
|
|
|
1101
1215
|
| DeleteChannelToolResultEvent
|
|
1102
1216
|
| UIWidgetEvent
|
|
1103
1217
|
| UIWidgetResponseEvent
|
|
1104
|
-
|
|
|
1105
|
-
|
|
|
1106
|
-
|
|
|
1107
|
-
|
|
|
1108
|
-
|
|
|
1109
|
-
|
|
|
1218
|
+
| ShellExecEvent
|
|
1219
|
+
| ShellExecResultEvent
|
|
1220
|
+
| ShellViewEvent
|
|
1221
|
+
| ShellViewResultEvent
|
|
1222
|
+
| ShellWaitEvent
|
|
1223
|
+
| ShellWaitResultEvent
|
|
1224
|
+
| ShellWriteToProcessEvent
|
|
1225
|
+
| ShellWriteToProcessResultEvent
|
|
1226
|
+
| ShellKillProcessEvent
|
|
1227
|
+
| ShellKillProcessResultEvent
|
|
1228
|
+
| ExposePortEvent
|
|
1229
|
+
| ExposePortResultEvent
|
|
1230
|
+
| UnexposePortEvent
|
|
1231
|
+
| UnexposePortResultEvent
|
|
1110
1232
|
| InstallPluginEvent
|
|
1111
1233
|
| InstallPluginResultEvent
|
|
1112
1234
|
| UninstallPluginEvent
|
|
@@ -1123,6 +1245,10 @@ export type OpenBotEvent =
|
|
|
1123
1245
|
| RecallResultEvent
|
|
1124
1246
|
| ForgetEvent
|
|
1125
1247
|
| ForgetResultEvent
|
|
1248
|
+
| TodoWriteEvent
|
|
1249
|
+
| TodoWriteResultEvent
|
|
1250
|
+
| TodoReadEvent
|
|
1251
|
+
| TodoReadResultEvent
|
|
1126
1252
|
| DelegateTaskEvent
|
|
1127
1253
|
| DelegateTaskResultEvent
|
|
1128
1254
|
| RenderWidgetEvent
|
package/src/harness/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ToolDefinition } from '../services/plugins/types.js';
|
|
|
8
8
|
import { abortRegistry, abortKey } from '../services/abort.js';
|
|
9
9
|
import { loadConfig } from '../app/config.js';
|
|
10
10
|
import { getPublicBaseUrl } from '../plugins/storage/files.js';
|
|
11
|
+
import { createPluginHost } from '../services/plugins/host.js';
|
|
11
12
|
|
|
12
13
|
export { STATE_AGENT_ID, ORCHESTRATOR_AGENT_ID };
|
|
13
14
|
|
|
@@ -119,6 +120,8 @@ export async function runAgent(options: RunAgentOptions): Promise<void> {
|
|
|
119
120
|
|
|
120
121
|
const builder = melony<OpenBotState, OpenBotEvent>().initialState(state);
|
|
121
122
|
|
|
123
|
+
const pluginHost = createPluginHost(runAgent);
|
|
124
|
+
|
|
122
125
|
for (const ref of pluginRefs) {
|
|
123
126
|
const plugin = await resolvePlugin(ref.id);
|
|
124
127
|
if (!plugin) continue;
|
|
@@ -132,6 +135,7 @@ export async function runAgent(options: RunAgentOptions): Promise<void> {
|
|
|
132
135
|
tools,
|
|
133
136
|
publicBaseUrl,
|
|
134
137
|
abortSignal,
|
|
138
|
+
host: pluginHost,
|
|
135
139
|
}),
|
|
136
140
|
);
|
|
137
141
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import crypto from 'node:crypto';
|
|
4
|
-
import {
|
|
4
|
+
import { getBaseDir } from '../../app/config.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Global memory service.
|
|
@@ -60,10 +60,7 @@ type LogEntry = AddEntry | DeleteEntry | UpdateEntry;
|
|
|
60
60
|
const DEFAULT_LIMIT = 50;
|
|
61
61
|
const MAX_LIMIT = 500;
|
|
62
62
|
|
|
63
|
-
const getMemoryDir = (): string =>
|
|
64
|
-
const config = loadConfig();
|
|
65
|
-
return path.join(resolvePath(config.baseDir || DEFAULT_BASE_DIR), 'memory');
|
|
66
|
-
};
|
|
63
|
+
const getMemoryDir = (): string => path.join(getBaseDir(), 'memory');
|
|
67
64
|
|
|
68
65
|
const getLogPath = (): string => path.join(getMemoryDir(), 'log.jsonl');
|
|
69
66
|
|