openbot 0.4.7 → 0.5.4

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.
Files changed (130) hide show
  1. package/.claude/agents/runtime-security-reviewer.md +32 -0
  2. package/.claude/hooks/format.sh +18 -0
  3. package/.claude/hooks/protect-secrets.sh +23 -0
  4. package/.claude/settings.json +26 -0
  5. package/.claude/skills/deploy/SKILL.md +26 -0
  6. package/.claude/skills/new-plugin/SKILL.md +46 -0
  7. package/.dockerignore +9 -0
  8. package/.mcp.json +8 -0
  9. package/AGENTS.md +2 -2
  10. package/CLAUDE.md +50 -0
  11. package/Dockerfile +41 -0
  12. package/deploy/README.md +61 -0
  13. package/deploy/entrypoint.sh +6 -0
  14. package/deploy/fly.toml +36 -0
  15. package/dist/app/bootstrap.js +29 -0
  16. package/dist/app/cli.js +3 -1
  17. package/dist/app/cloud-mode.js +26 -0
  18. package/dist/app/config.js +61 -16
  19. package/dist/app/server.js +38 -6
  20. package/dist/plugins/approval/index.js +1 -1
  21. package/dist/plugins/bash/index.js +386 -164
  22. package/dist/plugins/memory/service.js +2 -5
  23. package/dist/plugins/openbot/context.js +17 -1
  24. package/dist/plugins/openbot/index.js +23 -8
  25. package/dist/plugins/openbot/model.js +59 -0
  26. package/dist/plugins/openbot/runtime.js +39 -56
  27. package/dist/plugins/openbot/system-prompt.js +43 -8
  28. package/dist/plugins/preview/index.js +267 -0
  29. package/dist/plugins/storage/index.js +3 -3
  30. package/dist/plugins/storage/service.js +58 -12
  31. package/dist/plugins/todo/index.js +131 -38
  32. package/dist/plugins/todo/service.js +93 -0
  33. package/dist/plugins/ui/index.js +8 -1
  34. package/dist/services/plugins/model-registry.js +101 -0
  35. package/dist/services/plugins/registry.js +6 -4
  36. package/dist/services/plugins/service.js +2 -6
  37. package/docs/agents.md +20 -2
  38. package/docs/architecture.md +1 -1
  39. package/docs/plugins.md +13 -3
  40. package/docs/templates/AGENT.example.md +1 -1
  41. package/package.json +5 -2
  42. package/pnpm-workspace.yaml +2 -0
  43. package/src/app/bootstrap.ts +43 -0
  44. package/src/app/cli.ts +3 -1
  45. package/src/app/cloud-mode.ts +41 -0
  46. package/src/app/config.ts +71 -19
  47. package/src/app/server.ts +45 -6
  48. package/src/app/types.ts +162 -31
  49. package/src/plugins/approval/index.ts +1 -1
  50. package/src/plugins/bash/index.ts +498 -185
  51. package/src/plugins/memory/service.ts +2 -5
  52. package/src/plugins/openbot/context.ts +17 -1
  53. package/src/plugins/openbot/index.ts +25 -10
  54. package/src/plugins/openbot/model.ts +76 -0
  55. package/src/plugins/openbot/runtime.ts +47 -69
  56. package/src/plugins/openbot/system-prompt.ts +43 -8
  57. package/src/plugins/preview/index.ts +323 -0
  58. package/src/plugins/storage/index.ts +5 -8
  59. package/src/plugins/storage/service.ts +79 -15
  60. package/src/plugins/todo/index.ts +166 -0
  61. package/src/plugins/todo/service.ts +123 -0
  62. package/src/plugins/ui/index.ts +8 -1
  63. package/src/services/plugins/domain.ts +2 -0
  64. package/src/services/plugins/model-registry.ts +146 -0
  65. package/src/services/plugins/registry.ts +6 -4
  66. package/src/services/plugins/service.ts +2 -6
  67. package/dist/agents/openbot/index.js +0 -76
  68. package/dist/agents/openbot/middleware/approval.js +0 -132
  69. package/dist/agents/openbot/runtime.js +0 -289
  70. package/dist/agents/openbot/system-prompt.js +0 -32
  71. package/dist/agents/openbot/tools/delegation.js +0 -78
  72. package/dist/agents/openbot/tools/mcp.js +0 -99
  73. package/dist/agents/openbot/tools/shell.js +0 -91
  74. package/dist/agents/openbot/tools/storage.js +0 -75
  75. package/dist/agents/openbot/tools/ui.js +0 -176
  76. package/dist/agents/system.js +0 -33
  77. package/dist/bus/agent-package.js +0 -1
  78. package/dist/bus/plugin.js +0 -1
  79. package/dist/bus/services.js +0 -754
  80. package/dist/bus/types.js +0 -1
  81. package/dist/harness/agent-harness.js +0 -45
  82. package/dist/harness/agent-invoke-run.js +0 -44
  83. package/dist/harness/agent-turn.js +0 -99
  84. package/dist/harness/channel-participants.js +0 -40
  85. package/dist/harness/constants.js +0 -2
  86. package/dist/harness/context-meter.js +0 -97
  87. package/dist/harness/context.js +0 -363
  88. package/dist/harness/dispatch.js +0 -144
  89. package/dist/harness/dispatcher.js +0 -156
  90. package/dist/harness/event-normalizer.js +0 -59
  91. package/dist/harness/history.js +0 -177
  92. package/dist/harness/mcp.js +0 -61
  93. package/dist/harness/orchestration.js +0 -88
  94. package/dist/harness/orchestrator.js +0 -149
  95. package/dist/harness/participants.js +0 -22
  96. package/dist/harness/process.js +0 -29
  97. package/dist/harness/queue-processor.js +0 -187
  98. package/dist/harness/run-harness.js +0 -154
  99. package/dist/harness/run.js +0 -98
  100. package/dist/harness/runtime-factory.js +0 -73
  101. package/dist/harness/runtime.js +0 -57
  102. package/dist/harness/todo-advance.js +0 -93
  103. package/dist/harness/todo-dispatch.js +0 -51
  104. package/dist/harness/todos.js +0 -5
  105. package/dist/harness/turn.js +0 -79
  106. package/dist/harness/types.js +0 -1
  107. package/dist/plugins/ai-sdk/index.js +0 -34
  108. package/dist/plugins/ai-sdk/runtime.js +0 -395
  109. package/dist/plugins/ai-sdk/system-prompt.js +0 -18
  110. package/dist/plugins/ai-sdk.js +0 -331
  111. package/dist/plugins/approval.js +0 -163
  112. package/dist/plugins/delegation.js +0 -108
  113. package/dist/plugins/mcp/index.js +0 -108
  114. package/dist/plugins/mcp.js +0 -140
  115. package/dist/plugins/shell/index.js +0 -100
  116. package/dist/plugins/shell.js +0 -123
  117. package/dist/plugins/storage-tools/index.js +0 -76
  118. package/dist/plugins/storage.js +0 -737
  119. package/dist/plugins/thread-namer/index.js +0 -72
  120. package/dist/plugins/threads/index.js +0 -114
  121. package/dist/plugins/ui.js +0 -211
  122. package/dist/plugins/workflow/index.js +0 -65
  123. package/dist/registry/agents.js +0 -138
  124. package/dist/registry/plugins.js +0 -110
  125. package/dist/services/agent-packages.js +0 -103
  126. package/dist/services/memory.js +0 -152
  127. package/dist/services/plugins.js +0 -98
  128. package/dist/services/storage.js +0 -1028
  129. package/dist/workflow/service.js +0 -106
  130. package/dist/workflow/types.js +0 -3
@@ -1,106 +0,0 @@
1
- import { generateId } from 'melony';
2
- import { storageService } from '../services/storage.js';
3
- import { WORKFLOW_SCHEMA_VERSION, WORKFLOW_THREAD_STATE_KEY, } from './types.js';
4
- const asRecord = (value) => value && typeof value === 'object' && !Array.isArray(value)
5
- ? value
6
- : {};
7
- const isTodoStatus = (value) => value === 'pending' || value === 'done' || value === 'failed';
8
- const parseTodo = (value) => {
9
- const record = asRecord(value);
10
- if (typeof record.id !== 'string' || !record.id)
11
- return null;
12
- if (typeof record.text !== 'string' || !record.text)
13
- return null;
14
- if (!isTodoStatus(record.status))
15
- return null;
16
- return {
17
- id: record.id,
18
- text: record.text,
19
- status: record.status,
20
- summary: typeof record.summary === 'string' ? record.summary : undefined,
21
- };
22
- };
23
- export const parseThreadWorkflow = (state) => {
24
- const record = asRecord(state);
25
- const raw = record[WORKFLOW_THREAD_STATE_KEY];
26
- const workflow = asRecord(raw);
27
- if (typeof workflow.id !== 'string' || !workflow.id)
28
- return null;
29
- if (!Array.isArray(workflow.todos))
30
- return null;
31
- const todos = workflow.todos
32
- .map((todo) => parseTodo(todo))
33
- .filter((todo) => todo !== null);
34
- if (todos.length === 0 && !workflow.title)
35
- return null;
36
- return {
37
- version: typeof workflow.version === 'number' ? workflow.version : WORKFLOW_SCHEMA_VERSION,
38
- id: workflow.id,
39
- title: typeof workflow.title === 'string' ? workflow.title : undefined,
40
- todos,
41
- updatedAt: typeof workflow.updatedAt === 'string' ? workflow.updatedAt : new Date().toISOString(),
42
- };
43
- };
44
- export const loadThreadWorkflow = async (channelId, threadId) => {
45
- const details = await storageService.getThreadDetails({ channelId, threadId });
46
- return parseThreadWorkflow(details.state);
47
- };
48
- export const persistWorkflow = async (channelId, threadId, workflow) => {
49
- const next = {
50
- ...workflow,
51
- version: WORKFLOW_SCHEMA_VERSION,
52
- updatedAt: new Date().toISOString(),
53
- };
54
- await storageService.patchThreadState({
55
- channelId,
56
- threadId,
57
- state: { [WORKFLOW_THREAD_STATE_KEY]: next },
58
- });
59
- return next;
60
- };
61
- export const setWorkflowPlan = async (options) => {
62
- const { channelId, threadId, plan } = options;
63
- const workflow = {
64
- version: WORKFLOW_SCHEMA_VERSION,
65
- id: `wf_${generateId()}`,
66
- title: plan.title,
67
- todos: plan.todos.map((t) => ({
68
- id: t.id || `todo_${generateId()}`,
69
- text: t.text,
70
- status: 'pending',
71
- })),
72
- updatedAt: new Date().toISOString(),
73
- };
74
- return persistWorkflow(channelId, threadId, workflow);
75
- };
76
- export const updateWorkflowTodo = async (options) => {
77
- const { channelId, threadId, update } = options;
78
- const workflow = await loadThreadWorkflow(channelId, threadId);
79
- if (!workflow)
80
- throw new Error('No active workflow found.');
81
- const todos = workflow.todos.map((todo) => {
82
- if (todo.id !== update.todoId)
83
- return todo;
84
- return {
85
- ...todo,
86
- ...(update.status ? { status: update.status } : {}),
87
- ...(update.summary !== undefined ? { summary: update.summary } : {}),
88
- };
89
- });
90
- return persistWorkflow(channelId, threadId, { ...workflow, todos });
91
- };
92
- export const formatWorkflowForPrompt = (workflow) => {
93
- const lines = [
94
- '## Current Workflow Plan',
95
- workflow.title ? `Title: ${workflow.title}` : '',
96
- 'This plan is for your internal coordination. Update it as you progress.',
97
- '',
98
- ].filter(Boolean);
99
- for (const todo of workflow.todos) {
100
- lines.push(`- [${todo.status}] ${todo.id}: ${todo.text}`);
101
- if (todo.summary) {
102
- lines.push(` Result: ${todo.summary}`);
103
- }
104
- }
105
- return lines.join('\n');
106
- };
@@ -1,3 +0,0 @@
1
- export const WORKFLOW_SCHEMA_VERSION = 3;
2
- export const WORKFLOW_THREAD_STATE_KEY = 'workflow';
3
- export const OPENBOT_SYSTEM_AGENT_ID = 'system';