@metabob/minibob 0.1.2
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/ARCHITECTURE.md +255 -0
- package/CHANGELOG.md +112 -0
- package/README.md +380 -0
- package/bin/minibob.js +36 -0
- package/dist/acp-gossip.d.ts +72 -0
- package/dist/acp-gossip.d.ts.map +1 -0
- package/dist/acp-gossip.js +156 -0
- package/dist/acp-gossip.js.map +1 -0
- package/dist/acp.d.ts +62 -0
- package/dist/acp.d.ts.map +1 -0
- package/dist/acp.js +292 -0
- package/dist/acp.js.map +1 -0
- package/dist/activity.d.ts +157 -0
- package/dist/activity.d.ts.map +1 -0
- package/dist/activity.js +518 -0
- package/dist/activity.js.map +1 -0
- package/dist/agent-runtime.d.ts +104 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/boredom.d.ts +125 -0
- package/dist/boredom.d.ts.map +1 -0
- package/dist/boredom.js +244 -0
- package/dist/boredom.js.map +1 -0
- package/dist/cli/acp-server.d.ts +23 -0
- package/dist/cli/acp-server.d.ts.map +1 -0
- package/dist/cli/burrow.d.ts +26 -0
- package/dist/cli/burrow.d.ts.map +1 -0
- package/dist/cli/doctor.d.ts +22 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/goal.d.ts +22 -0
- package/dist/cli/goal.d.ts.map +1 -0
- package/dist/cli/index.d.ts +47 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/instance-registry.d.ts +78 -0
- package/dist/cli/instance-registry.d.ts.map +1 -0
- package/dist/cli/observe.d.ts +35 -0
- package/dist/cli/observe.d.ts.map +1 -0
- package/dist/cli/vessel.d.ts +14 -0
- package/dist/cli/vessel.d.ts.map +1 -0
- package/dist/composition-observer.d.ts +96 -0
- package/dist/composition-observer.d.ts.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +128 -0
- package/dist/config.js.map +1 -0
- package/dist/docker/Dockerfile +35 -0
- package/dist/environment.d.ts +72 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +142 -0
- package/dist/environment.js.map +1 -0
- package/dist/goal-processor.d.ts +165 -0
- package/dist/goal-processor.d.ts.map +1 -0
- package/dist/helm/minibob-cluster/Chart.yaml +13 -0
- package/dist/helm/minibob-cluster/templates/_helpers.tpl +60 -0
- package/dist/helm/minibob-cluster/templates/configmap.yaml +11 -0
- package/dist/helm/minibob-cluster/templates/deployment.yaml +108 -0
- package/dist/helm/minibob-cluster/templates/secret.yaml +10 -0
- package/dist/helm/minibob-cluster/templates/service.yaml +37 -0
- package/dist/helm/minibob-cluster/values-local.yaml +41 -0
- package/dist/helm/minibob-cluster/values-production.yaml +57 -0
- package/dist/helm/minibob-cluster/values-testing-cluster.yaml +43 -0
- package/dist/helm/minibob-cluster/values.yaml +127 -0
- package/dist/improviser.d.ts +74 -0
- package/dist/improviser.d.ts.map +1 -0
- package/dist/impulse-filter.d.ts +74 -0
- package/dist/impulse-filter.d.ts.map +1 -0
- package/dist/impulse.d.ts +92 -0
- package/dist/impulse.d.ts.map +1 -0
- package/dist/impulse.js +234 -0
- package/dist/impulse.js.map +1 -0
- package/dist/lib.d.ts +29 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +18561 -0
- package/dist/lib.js.map +98 -0
- package/dist/lifecycle-hooks.d.ts +99 -0
- package/dist/lifecycle-hooks.d.ts.map +1 -0
- package/dist/lifecycle-hooks.js +135 -0
- package/dist/lifecycle-hooks.js.map +1 -0
- package/dist/llm.d.ts +31 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +349 -0
- package/dist/llm.js.map +1 -0
- package/dist/mcp-activity-bridge.d.ts +66 -0
- package/dist/mcp-activity-bridge.d.ts.map +1 -0
- package/dist/mcp-activity-bridge.js +126 -0
- package/dist/mcp-activity-bridge.js.map +1 -0
- package/dist/mcp.d.ts +216 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +292 -0
- package/dist/mcp.js.map +1 -0
- package/dist/memory-agent.d.ts +92 -0
- package/dist/memory-agent.d.ts.map +1 -0
- package/dist/memory-agent.js +277 -0
- package/dist/memory-agent.js.map +1 -0
- package/dist/runtime-mapping.d.ts +97 -0
- package/dist/runtime-mapping.d.ts.map +1 -0
- package/dist/search-first-executor.d.ts +113 -0
- package/dist/search-first-executor.d.ts.map +1 -0
- package/dist/session.d.ts +48 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/template-extractor.d.ts +9 -0
- package/dist/template-extractor.d.ts.map +1 -0
- package/dist/template-generator.d.ts +12 -0
- package/dist/template-generator.d.ts.map +1 -0
- package/dist/tools.d.ts +58 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +771 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +503 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/understanding/analyzer.d.ts +55 -0
- package/dist/understanding/analyzer.d.ts.map +1 -0
- package/dist/understanding/explorer.d.ts +73 -0
- package/dist/understanding/explorer.d.ts.map +1 -0
- package/dist/understanding/index.d.ts +7 -0
- package/dist/understanding/index.d.ts.map +1 -0
- package/dist/understanding/types.d.ts +136 -0
- package/dist/understanding/types.d.ts.map +1 -0
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +106 -0
- package/dist/validation.js.map +1 -0
- package/dist/vessel-bootstrap.d.ts +190 -0
- package/dist/vessel-bootstrap.d.ts.map +1 -0
- package/dist/vessel-registry.d.ts +229 -0
- package/dist/vessel-registry.d.ts.map +1 -0
- package/index.ts +1329 -0
- package/package.json +54 -0
- package/src/acp-gossip.ts +193 -0
- package/src/acp.ts +362 -0
- package/src/activity.ts +1464 -0
- package/src/agent-runtime.ts +365 -0
- package/src/boredom.ts +423 -0
- package/src/cli/acp-server.ts +377 -0
- package/src/cli/burrow.ts +896 -0
- package/src/cli/doctor.ts +526 -0
- package/src/cli/goal.ts +224 -0
- package/src/cli/index.ts +147 -0
- package/src/cli/instance-registry.ts +271 -0
- package/src/cli/observe.ts +682 -0
- package/src/cli/vessel.ts +287 -0
- package/src/components/SystemOverview.tsx +331 -0
- package/src/composition-observer.ts +449 -0
- package/src/config.ts +172 -0
- package/src/environment.ts +167 -0
- package/src/goal-processor.ts +654 -0
- package/src/improviser.ts +591 -0
- package/src/impulse-filter.ts +273 -0
- package/src/impulse.ts +311 -0
- package/src/lib.ts +147 -0
- package/src/lifecycle-hooks.ts +181 -0
- package/src/llm.ts +434 -0
- package/src/mcp-activity-bridge.ts +158 -0
- package/src/mcp.ts +747 -0
- package/src/memory-agent.ts +316 -0
- package/src/runtime-mapping.ts +527 -0
- package/src/search-first-executor.ts +666 -0
- package/src/session.ts +141 -0
- package/src/template-extractor.ts +256 -0
- package/src/template-generator.ts +130 -0
- package/src/tools.ts +924 -0
- package/src/types.ts +497 -0
- package/src/understanding/analyzer.ts +354 -0
- package/src/understanding/explorer.ts +488 -0
- package/src/understanding/index.ts +27 -0
- package/src/understanding/types.ts +153 -0
- package/src/validation.ts +125 -0
- package/src/vessel-bootstrap.ts +440 -0
- package/src/vessel-registry.ts +621 -0
- package/templates/core/edit-file.json +85 -0
- package/templates/understanding/diagnose-problem.json +32 -0
- package/templates/understanding/explore-codebase-v2.json +57 -0
- package/templates/understanding/explore-codebase.json +37 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* minibob Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Minimal type system for activity execution, impulses, and vessel communication.
|
|
5
|
+
* Designed to be compatible with OpenCode schemas but much simpler.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// IMPULSE SYSTEM
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Impulse pointer types - what the impulse references
|
|
14
|
+
*
|
|
15
|
+
* Architecture principle: MiniBob handles LOCAL types (memo, file).
|
|
16
|
+
* Backend (metabob-activity-api) handles ALL OTHER types via MCP.
|
|
17
|
+
*
|
|
18
|
+
* This keeps minibob flexible - backend can introduce new pointer types
|
|
19
|
+
* without requiring minibob code changes.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Local pointer types (minibob resolves these directly)
|
|
24
|
+
*/
|
|
25
|
+
export type LocalImpulsePointer =
|
|
26
|
+
| { type: "memo"; content: string }
|
|
27
|
+
| { type: "file"; path: string; offset?: number; limit?: number }
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Backend pointer types (resolved via MCP - examples, not exhaustive)
|
|
31
|
+
* Backend can introduce new types without minibob changes.
|
|
32
|
+
*/
|
|
33
|
+
export type BackendImpulsePointer =
|
|
34
|
+
| { type: "activityOutput"; activityId: string; taskId?: string }
|
|
35
|
+
| { type: "activityExecutionTrace"; executionId: string; [key: string]: unknown }
|
|
36
|
+
| { type: "activityTemplate"; templateId: string; [key: string]: unknown }
|
|
37
|
+
| { type: "activityMetrics"; templateId: string; [key: string]: unknown }
|
|
38
|
+
| { type: string; [key: string]: unknown } // Catch-all for backend-defined types
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* All impulse pointer types (local + backend)
|
|
42
|
+
*/
|
|
43
|
+
export type ImpulsePointer = LocalImpulsePointer | BackendImpulsePointer
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Impulse - lazy-loaded context with token budget
|
|
47
|
+
*/
|
|
48
|
+
export interface Impulse {
|
|
49
|
+
id: string
|
|
50
|
+
pointer: ImpulsePointer
|
|
51
|
+
budget: number
|
|
52
|
+
priority: "critical" | "high" | "medium" | "low"
|
|
53
|
+
// State
|
|
54
|
+
loaded: boolean
|
|
55
|
+
content?: string
|
|
56
|
+
tokenCount?: number
|
|
57
|
+
// Metadata
|
|
58
|
+
createdAt: number
|
|
59
|
+
tags?: string[]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// =============================================================================
|
|
63
|
+
// ACTIVITY SYSTEM
|
|
64
|
+
// =============================================================================
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Variable definition for activity templates
|
|
68
|
+
*/
|
|
69
|
+
export interface VariableDefinition {
|
|
70
|
+
name: string
|
|
71
|
+
type: "string" | "number" | "boolean" | "array" | "object"
|
|
72
|
+
required: boolean
|
|
73
|
+
description?: string
|
|
74
|
+
default?: unknown
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Task prompt configuration
|
|
79
|
+
*/
|
|
80
|
+
export interface TaskPrompt {
|
|
81
|
+
template: string
|
|
82
|
+
variables: VariableDefinition[]
|
|
83
|
+
maxTokens?: number
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Validation rules for task completion
|
|
88
|
+
*/
|
|
89
|
+
export interface TaskValidation {
|
|
90
|
+
requiredFiles?: string[]
|
|
91
|
+
/** Check patterns in task output (string array) or in specific files (object array) */
|
|
92
|
+
requiredPatterns?: string[] | Array<{ file: string; pattern: string }>
|
|
93
|
+
forbiddenPatterns?: Array<{ file: string; pattern: string }>
|
|
94
|
+
commands?: Array<{ command: string; expectedOutput?: string }>
|
|
95
|
+
/** Require task to produce non-empty output */
|
|
96
|
+
requireOutput?: boolean
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Activity task - single unit of work
|
|
101
|
+
*/
|
|
102
|
+
export interface ActivityTask {
|
|
103
|
+
id: string
|
|
104
|
+
description: string
|
|
105
|
+
prompt: TaskPrompt
|
|
106
|
+
dependencies?: string[]
|
|
107
|
+
validation?: TaskValidation
|
|
108
|
+
impulseReferences?: string[]
|
|
109
|
+
retry?: {
|
|
110
|
+
maxAttempts: number
|
|
111
|
+
strategy: "simple" | "progressive-context"
|
|
112
|
+
}
|
|
113
|
+
/** Impulse IDs to create from task output (optional) */
|
|
114
|
+
outputImpulses?: string[]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Activity template - blueprint for execution
|
|
119
|
+
*/
|
|
120
|
+
export interface ActivityTemplate {
|
|
121
|
+
id: string
|
|
122
|
+
name: string
|
|
123
|
+
description: string
|
|
124
|
+
category: "feature" | "bugfix" | "refactor" | "tool" | "infrastructure"
|
|
125
|
+
tasks: ActivityTask[]
|
|
126
|
+
contextRequirements?: Array<{
|
|
127
|
+
id: string
|
|
128
|
+
type: "file" | "glob" | "memo" | "custom"
|
|
129
|
+
source: string
|
|
130
|
+
budget: number
|
|
131
|
+
priority: "critical" | "high" | "medium" | "low"
|
|
132
|
+
}>
|
|
133
|
+
variables: VariableDefinition[]
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Optional metadata for provenance tracking
|
|
137
|
+
* Used by ribosome to track template generation history
|
|
138
|
+
*/
|
|
139
|
+
metadata?: {
|
|
140
|
+
generatedFrom?: "execution" | "goal-seeking" | "manual"
|
|
141
|
+
sourceExecutionId?: string
|
|
142
|
+
sourceTemplateId?: string
|
|
143
|
+
firstExecutionMetrics?: {
|
|
144
|
+
duration: number
|
|
145
|
+
cost: number
|
|
146
|
+
tokens: { input: number; output: number }
|
|
147
|
+
status: string
|
|
148
|
+
}
|
|
149
|
+
createdAt?: number
|
|
150
|
+
author?: string
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Activity execution state
|
|
156
|
+
*/
|
|
157
|
+
export type ActivityStatus = "pending" | "executing" | "completed" | "failed" | "cancelled"
|
|
158
|
+
|
|
159
|
+
export interface TaskResult {
|
|
160
|
+
taskId: string
|
|
161
|
+
status: "pending" | "executing" | "completed" | "failed"
|
|
162
|
+
output?: string
|
|
163
|
+
error?: string
|
|
164
|
+
startedAt?: number
|
|
165
|
+
completedAt?: number
|
|
166
|
+
tokens?: { input: number; output: number }
|
|
167
|
+
|
|
168
|
+
// Phase 1.8+: State tracking for ribosome (template generation from traces)
|
|
169
|
+
metadata?: {
|
|
170
|
+
inputState?: ExecutedTask["inputState"]
|
|
171
|
+
outputState?: ExecutedTask["outputState"]
|
|
172
|
+
stateTransition?: ExecutedTask["stateTransition"]
|
|
173
|
+
toolCalls?: ToolCall[]
|
|
174
|
+
actualPrompt?: string
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface ActivityExecution {
|
|
179
|
+
id: string
|
|
180
|
+
templateId: string
|
|
181
|
+
status: ActivityStatus
|
|
182
|
+
variables: Record<string, unknown>
|
|
183
|
+
impulses: Impulse[]
|
|
184
|
+
taskResults: TaskResult[]
|
|
185
|
+
startedAt: number
|
|
186
|
+
completedAt?: number
|
|
187
|
+
/** Error message if execution failed */
|
|
188
|
+
error?: string
|
|
189
|
+
/** Execution trace (if recording enabled) */
|
|
190
|
+
executionTrace?: ExecutionTrace
|
|
191
|
+
metrics?: {
|
|
192
|
+
duration: number
|
|
193
|
+
cost: number
|
|
194
|
+
totalTokens: { input: number; output: number }
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Record of what happened during activity execution
|
|
200
|
+
* Used to generate activity templates from successful goal executions
|
|
201
|
+
*/
|
|
202
|
+
export interface ExecutionTrace {
|
|
203
|
+
/** Tasks executed with full context */
|
|
204
|
+
tasks: ExecutedTask[]
|
|
205
|
+
/** Impulses created during execution */
|
|
206
|
+
impulsesCreated: string[]
|
|
207
|
+
/** Files modified */
|
|
208
|
+
filesModified: string[]
|
|
209
|
+
/** Goal that triggered this execution (if any) */
|
|
210
|
+
goalContext?: {
|
|
211
|
+
goal: string
|
|
212
|
+
intent: string
|
|
213
|
+
context: Record<string, unknown>
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Record of a single task execution
|
|
219
|
+
*/
|
|
220
|
+
export interface ExecutedTask {
|
|
221
|
+
/** Task ID from template */
|
|
222
|
+
id: string
|
|
223
|
+
/** Task description */
|
|
224
|
+
description: string
|
|
225
|
+
/** Actual prompt sent to LLM (after variable substitution) */
|
|
226
|
+
actualPrompt: string
|
|
227
|
+
/** Tools called during task */
|
|
228
|
+
toolCalls: ToolCall[]
|
|
229
|
+
/** LLM response */
|
|
230
|
+
response: string
|
|
231
|
+
/** Validation results */
|
|
232
|
+
validationResults?: {
|
|
233
|
+
requiredFiles: Array<{ path: string; exists: boolean }>
|
|
234
|
+
requiredPatterns: Array<{ pattern: string; found: boolean }>
|
|
235
|
+
forbiddenPatterns: Array<{ pattern: string; found: boolean }>
|
|
236
|
+
}
|
|
237
|
+
/** Task result (mapped to backend schema: success/failure/partial) */
|
|
238
|
+
result: {
|
|
239
|
+
status: "success" | "failure" | "partial"
|
|
240
|
+
error?: string
|
|
241
|
+
metadata?: Record<string, unknown>
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ============================================================================
|
|
245
|
+
// PHASE 1.8: Enhanced State Tracking for Debugging-as-Activity
|
|
246
|
+
// ============================================================================
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Input state captured before task execution
|
|
250
|
+
* Enables debugging activities to analyze what the task had access to
|
|
251
|
+
*/
|
|
252
|
+
inputState?: {
|
|
253
|
+
/** Files available in working directory before execution */
|
|
254
|
+
filesAvailable: string[]
|
|
255
|
+
/** Environment variables at task start */
|
|
256
|
+
environment: Record<string, string>
|
|
257
|
+
/** Impulse IDs referenced by this task */
|
|
258
|
+
impulses: string[]
|
|
259
|
+
/** Variables passed to task (after interpolation) */
|
|
260
|
+
variables: Record<string, unknown>
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Output state captured after task execution
|
|
265
|
+
* Enables debugging activities to analyze what changed
|
|
266
|
+
*/
|
|
267
|
+
outputState?: {
|
|
268
|
+
/** Files modified during execution */
|
|
269
|
+
filesModified: string[]
|
|
270
|
+
/** Files created during execution */
|
|
271
|
+
filesCreated: string[]
|
|
272
|
+
/** Files deleted during execution */
|
|
273
|
+
filesDeleted: string[]
|
|
274
|
+
/** Exit code from bash commands (if any) */
|
|
275
|
+
exitCode?: number
|
|
276
|
+
/** Standard error output (if any) */
|
|
277
|
+
stderr?: string
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* State transition snapshot (lightweight before/after)
|
|
282
|
+
* Enables debugging activities to perform differential analysis
|
|
283
|
+
*/
|
|
284
|
+
stateTransition?: {
|
|
285
|
+
/** Filesystem snapshot before execution (file → hash) */
|
|
286
|
+
before: Record<string, string>
|
|
287
|
+
/** Filesystem snapshot after execution (file → hash) */
|
|
288
|
+
after: Record<string, string>
|
|
289
|
+
/** Working directory at execution time */
|
|
290
|
+
workingDirectory: string
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Record of a tool call (matches backend ExecutionTrace schema)
|
|
296
|
+
* Tool calls are impulse-like data pointers - they reference data
|
|
297
|
+
* that influenced LLM decisions during execution
|
|
298
|
+
*/
|
|
299
|
+
export interface ToolCall {
|
|
300
|
+
/** Unique identifier for this tool call (impulse-like ID) */
|
|
301
|
+
id: string
|
|
302
|
+
/** Tool name */
|
|
303
|
+
name: string
|
|
304
|
+
/** Arguments passed to tool */
|
|
305
|
+
arguments: Record<string, unknown>
|
|
306
|
+
/** Tool result */
|
|
307
|
+
result: {
|
|
308
|
+
success: boolean
|
|
309
|
+
output?: string
|
|
310
|
+
error?: string
|
|
311
|
+
metadata?: Record<string, unknown>
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// =============================================================================
|
|
316
|
+
// TOOL SYSTEM
|
|
317
|
+
// =============================================================================
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Tool definition for LLM function calling
|
|
321
|
+
*/
|
|
322
|
+
export interface ToolDefinition {
|
|
323
|
+
name: string
|
|
324
|
+
description: string
|
|
325
|
+
parameters: {
|
|
326
|
+
type: "object"
|
|
327
|
+
properties: Record<string, {
|
|
328
|
+
type: string
|
|
329
|
+
description: string
|
|
330
|
+
enum?: string[]
|
|
331
|
+
}>
|
|
332
|
+
required: string[]
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Tool execution result
|
|
338
|
+
*/
|
|
339
|
+
export interface ToolResult {
|
|
340
|
+
success: boolean
|
|
341
|
+
output?: string
|
|
342
|
+
error?: string
|
|
343
|
+
metadata?: Record<string, unknown>
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Tool handler function type
|
|
348
|
+
*/
|
|
349
|
+
export type ToolHandler = (params: Record<string, unknown>) => Promise<ToolResult>
|
|
350
|
+
|
|
351
|
+
// =============================================================================
|
|
352
|
+
// LLM SYSTEM
|
|
353
|
+
// =============================================================================
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Message role in conversation
|
|
357
|
+
*/
|
|
358
|
+
export type MessageRole = "system" | "user" | "assistant" | "tool"
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Chat message
|
|
362
|
+
*/
|
|
363
|
+
export interface Message {
|
|
364
|
+
role: MessageRole
|
|
365
|
+
content: string
|
|
366
|
+
toolCalls?: Array<{
|
|
367
|
+
id: string
|
|
368
|
+
name: string
|
|
369
|
+
arguments: Record<string, unknown>
|
|
370
|
+
}>
|
|
371
|
+
toolCallId?: string
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* LLM completion options
|
|
376
|
+
*/
|
|
377
|
+
export interface CompletionOptions {
|
|
378
|
+
model: string
|
|
379
|
+
messages: Message[]
|
|
380
|
+
tools?: ToolDefinition[]
|
|
381
|
+
maxTokens?: number
|
|
382
|
+
temperature?: number
|
|
383
|
+
stream?: boolean
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* LLM completion result
|
|
388
|
+
*/
|
|
389
|
+
export interface CompletionResult {
|
|
390
|
+
content: string
|
|
391
|
+
toolCalls?: Array<{
|
|
392
|
+
id: string
|
|
393
|
+
name: string
|
|
394
|
+
arguments: Record<string, unknown>
|
|
395
|
+
}>
|
|
396
|
+
finishReason: "stop" | "tool_calls" | "length" | "error"
|
|
397
|
+
usage: {
|
|
398
|
+
inputTokens: number
|
|
399
|
+
outputTokens: number
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// =============================================================================
|
|
404
|
+
// ACP PROTOCOL
|
|
405
|
+
// =============================================================================
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* ACP delegate request
|
|
409
|
+
*/
|
|
410
|
+
export interface ACPDelegateRequest {
|
|
411
|
+
target: string // "docker://container" or "tcp://host:port" or "http://url"
|
|
412
|
+
taskDescription: string
|
|
413
|
+
prompt: string
|
|
414
|
+
shareImpulses?: string[]
|
|
415
|
+
timeout?: number
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* ACP delegate response
|
|
420
|
+
*/
|
|
421
|
+
export interface ACPDelegateResponse {
|
|
422
|
+
success: boolean
|
|
423
|
+
sessionId: string
|
|
424
|
+
response?: string
|
|
425
|
+
toolsUsed?: string[]
|
|
426
|
+
error?: string
|
|
427
|
+
metrics?: {
|
|
428
|
+
duration: number
|
|
429
|
+
tokens: { input: number; output: number }
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* ACP session message
|
|
435
|
+
*/
|
|
436
|
+
export type ACPMessage =
|
|
437
|
+
| { type: "hello"; version: string; capabilities: string[] }
|
|
438
|
+
| { type: "prompt"; sessionId: string; messages: Message[]; tools?: ToolDefinition[] }
|
|
439
|
+
| { type: "response"; sessionId: string; content: string; finishReason: string }
|
|
440
|
+
| { type: "tool_call"; sessionId: string; toolCallId: string; name: string; arguments: Record<string, unknown> }
|
|
441
|
+
| { type: "tool_result"; sessionId: string; toolCallId: string; result: ToolResult }
|
|
442
|
+
| { type: "error"; sessionId: string; error: string }
|
|
443
|
+
| { type: "complete"; sessionId: string; metrics: { duration: number; tokens: { input: number; output: number } } }
|
|
444
|
+
|
|
445
|
+
// =============================================================================
|
|
446
|
+
// CONFIGURATION
|
|
447
|
+
// =============================================================================
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* minibob configuration
|
|
451
|
+
*/
|
|
452
|
+
export interface MinibobConfig {
|
|
453
|
+
// Server
|
|
454
|
+
port: number
|
|
455
|
+
host: string
|
|
456
|
+
|
|
457
|
+
// LLM
|
|
458
|
+
provider: "anthropic" | "openai"
|
|
459
|
+
model: string
|
|
460
|
+
apiKey: string
|
|
461
|
+
|
|
462
|
+
// Vessels (MCP connections)
|
|
463
|
+
vessels: Record<string, {
|
|
464
|
+
type: "mcp" | "http"
|
|
465
|
+
endpoint: string
|
|
466
|
+
capabilities: string[]
|
|
467
|
+
}>
|
|
468
|
+
|
|
469
|
+
// Activity
|
|
470
|
+
templatesDir: string
|
|
471
|
+
|
|
472
|
+
// Git
|
|
473
|
+
workingDirectory: string
|
|
474
|
+
autoCommit: boolean
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// =============================================================================
|
|
478
|
+
// VESSEL MANIFEST
|
|
479
|
+
// =============================================================================
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Vessel manifest - describes this vessel's capabilities
|
|
483
|
+
*/
|
|
484
|
+
export interface VesselManifest {
|
|
485
|
+
id: string
|
|
486
|
+
name: string
|
|
487
|
+
version: string
|
|
488
|
+
capabilities: string[]
|
|
489
|
+
tools: string[]
|
|
490
|
+
acpEndpoint: string
|
|
491
|
+
metadata?: {
|
|
492
|
+
environment?: string
|
|
493
|
+
clusterMode?: boolean
|
|
494
|
+
peerCount?: number
|
|
495
|
+
backendAvailable?: boolean
|
|
496
|
+
}
|
|
497
|
+
}
|