botinabox 2.2.0 → 2.3.0

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/index.d.ts CHANGED
@@ -2041,6 +2041,18 @@ declare const createProjectTool: {
2041
2041
  handler: ToolHandler;
2042
2042
  };
2043
2043
 
2044
+ /**
2045
+ * All native tools bundled for convenience.
2046
+ * Apps can pass this directly to ExecutionEngine config:
2047
+ * tools: nativeTools
2048
+ * or spread to add custom tools:
2049
+ * tools: [...nativeTools, myCustomTool]
2050
+ */
2051
+ declare const nativeTools: {
2052
+ definition: ToolDefinition;
2053
+ handler: ToolHandler;
2054
+ }[];
2055
+
2044
2056
  interface SecretInput {
2045
2057
  name: string;
2046
2058
  type?: string;
@@ -2129,4 +2141,4 @@ declare function isLoginRequired(stdout: string): boolean;
2129
2141
  /** Rewrite local image paths to prevent CLI auto-embedding as vision content. */
2130
2142
  declare function deactivateLocalImagePaths(prompt: string): string;
2131
2143
 
2132
- export { AGENT_STATUSES, type AgentConfig, type AgentDefinition, type AgentFilter, type AgentRecord, AgentRegistry, type AgentStatus, ApiExecutionAdapter, type ApprovalResponse, type ApprovalStatus, AuditEmitter, type AuditEvent, BackupManager, type BotConfig, BreakerState, type BudgetCheck, type BudgetConfig, BudgetController, CORE_MIGRATIONS, ChannelAdapter, ChannelRegistry, ChannelRegistryError, type ChatConfig, ChatMessage, ChatResponderConfig, ChatSessionManager, CircuitBreaker, type CircuitBreakerConfig, CliExecutionAdapter, type ColumnValidator, ColumnValidatorImpl, type ConfigLoadError, type ConfigLoadResult, ConnectorConfig, DEFAULTS, DEFAULT_CONFIG, type DataConfig, DataStore, type DefaultLLMCallConfig, DeterministicAdapter, type DeterministicConfig, type DomainEntityContextOptions, type DomainSchemaOptions, DriftGate, EVENTS, type EntityColumnDef, type EntityConfig, type ExecutionAdapter, type ExecutionConfig, type ExecutionEngineConfig, type FeedbackEntry, type GateFinding, type GateInput, type GateResult, GateRunner, type GateVerdict, GovernanceGate, HealthStatus, HookBus, InboundMessage, LLMProvider, LearningPipeline, type LearningPipelineConfig, type LoopDetection, LoopDetector, type LoopDetectorConfig, LoopType, MAX_CHAIN_DEPTH, MessagePipeline, type ModelConfig, ModelInfo, ModelRouter, NdjsonLogger, NotificationQueue, type PackageMigration, type PackageUpdate, type ParsedStream, type PermissionPrompt, type PermissionProvider, PermissionRelay, type PermissionRelayConfig, type PlaybookEntry, ProviderRegistry, QAGate, QualityGate, RUN_STATUSES, type RenderConfig, ResolvedModel, type RetryPolicy, type RoutingConfig, type RunContext, RunManager, type RunResult, type RunStatus, type SafetyConfig, type SanitizerOptions, type Schedule, type ScheduleDef, Scheduler, type SchemaError, type SecretInput, type SecretMeta, SecretStore, type SecurityConfig, SessionKey, SessionManager, type SkillEntry, type StepRef, type SystemContextOptions, TASK_STATUSES, type TaskDefinition, TaskQueue, type TaskRecord, type TaskStatus, TokenUsage, type ToolContext, type ToolDefinition, type ToolHandler, UpdateChecker, type UpdateConfig, UpdateManager, type UpdateManifest, type UsageSummary, type User, type UserInput, UserRegistry, WakeupQueue, type WorkflowConfigEntry, type WorkflowDefinition$1 as WorkflowDefinition, WorkflowEngine, type WorkflowRunRecord, type WorkflowRunStatus, type WorkflowStep$1 as WorkflowStep, type WorkflowStepConfig, type WorkflowTrigger, _resetConfig, addTaskCommentTool, areDependenciesMet, autoUpdate, buildAgentBindings, buildChainOrigin, buildProcessEnv, buildSystemContext, cancelTaskTool, checkAllowlist, checkChainDepth, checkMentionGate, chunkText, classifyUpdate, compareVersions, createAgentTool, createConfigRevision, createDefaultLLMCall, createProjectTool, deactivateLocalImagePaths, defineCoreEntityContexts, defineCoreTables, defineDomainEntityContexts, defineDomainTables, detectCycle, discoverChannels, discoverProviders, dispatchTaskTool, formatText, getActiveTasksTool, getAgentDetailTool, getAgentStatusTool, getConfig, getSystemStatusTool, getTaskStatusTool, initConfig, interpolate, interpolateEnv, isLoginRequired, isMaxTurns, listAgentsTool, listFilesTool, listProjectsTool, loadConfig, parseClaudeStream, parseVersion, readConversationTool, readFileTool, reassignTaskTool, registerExecutionEngine, registerFileTool, runPackageMigrations, sanitize, searchConversationTool, sendFileTool, sendMessageTool, topologicalSort, truncateAtWord, validateConfig };
2144
+ export { AGENT_STATUSES, type AgentConfig, type AgentDefinition, type AgentFilter, type AgentRecord, AgentRegistry, type AgentStatus, ApiExecutionAdapter, type ApprovalResponse, type ApprovalStatus, AuditEmitter, type AuditEvent, BackupManager, type BotConfig, BreakerState, type BudgetCheck, type BudgetConfig, BudgetController, CORE_MIGRATIONS, ChannelAdapter, ChannelRegistry, ChannelRegistryError, type ChatConfig, ChatMessage, ChatResponderConfig, ChatSessionManager, CircuitBreaker, type CircuitBreakerConfig, CliExecutionAdapter, type ColumnValidator, ColumnValidatorImpl, type ConfigLoadError, type ConfigLoadResult, ConnectorConfig, DEFAULTS, DEFAULT_CONFIG, type DataConfig, DataStore, type DefaultLLMCallConfig, DeterministicAdapter, type DeterministicConfig, type DomainEntityContextOptions, type DomainSchemaOptions, DriftGate, EVENTS, type EntityColumnDef, type EntityConfig, type ExecutionAdapter, type ExecutionConfig, type ExecutionEngineConfig, type FeedbackEntry, type GateFinding, type GateInput, type GateResult, GateRunner, type GateVerdict, GovernanceGate, HealthStatus, HookBus, InboundMessage, LLMProvider, LearningPipeline, type LearningPipelineConfig, type LoopDetection, LoopDetector, type LoopDetectorConfig, LoopType, MAX_CHAIN_DEPTH, MessagePipeline, type ModelConfig, ModelInfo, ModelRouter, NdjsonLogger, NotificationQueue, type PackageMigration, type PackageUpdate, type ParsedStream, type PermissionPrompt, type PermissionProvider, PermissionRelay, type PermissionRelayConfig, type PlaybookEntry, ProviderRegistry, QAGate, QualityGate, RUN_STATUSES, type RenderConfig, ResolvedModel, type RetryPolicy, type RoutingConfig, type RunContext, RunManager, type RunResult, type RunStatus, type SafetyConfig, type SanitizerOptions, type Schedule, type ScheduleDef, Scheduler, type SchemaError, type SecretInput, type SecretMeta, SecretStore, type SecurityConfig, SessionKey, SessionManager, type SkillEntry, type StepRef, type SystemContextOptions, TASK_STATUSES, type TaskDefinition, TaskQueue, type TaskRecord, type TaskStatus, TokenUsage, type ToolContext, type ToolDefinition, type ToolHandler, UpdateChecker, type UpdateConfig, UpdateManager, type UpdateManifest, type UsageSummary, type User, type UserInput, UserRegistry, WakeupQueue, type WorkflowConfigEntry, type WorkflowDefinition$1 as WorkflowDefinition, WorkflowEngine, type WorkflowRunRecord, type WorkflowRunStatus, type WorkflowStep$1 as WorkflowStep, type WorkflowStepConfig, type WorkflowTrigger, _resetConfig, addTaskCommentTool, areDependenciesMet, autoUpdate, buildAgentBindings, buildChainOrigin, buildProcessEnv, buildSystemContext, cancelTaskTool, checkAllowlist, checkChainDepth, checkMentionGate, chunkText, classifyUpdate, compareVersions, createAgentTool, createConfigRevision, createDefaultLLMCall, createProjectTool, deactivateLocalImagePaths, defineCoreEntityContexts, defineCoreTables, defineDomainEntityContexts, defineDomainTables, detectCycle, discoverChannels, discoverProviders, dispatchTaskTool, formatText, getActiveTasksTool, getAgentDetailTool, getAgentStatusTool, getConfig, getSystemStatusTool, getTaskStatusTool, initConfig, interpolate, interpolateEnv, isLoginRequired, isMaxTurns, listAgentsTool, listFilesTool, listProjectsTool, loadConfig, nativeTools, parseClaudeStream, parseVersion, readConversationTool, readFileTool, reassignTaskTool, registerExecutionEngine, registerFileTool, runPackageMigrations, sanitize, searchConversationTool, sendFileTool, sendMessageTool, topologicalSort, truncateAtWord, validateConfig };
package/dist/index.js CHANGED
@@ -1820,23 +1820,6 @@ ${historyContext}` : void 0
1820
1820
  await this.guaranteedTaskDispatch(msg, threadTs, channelId);
1821
1821
  try {
1822
1822
  const result = await this.interpreter.interpret(messageId);
1823
- if (result.memories.length > 0 || result.userContext.length > 0) {
1824
- try {
1825
- const parts = [];
1826
- if (result.memories.length > 0) {
1827
- parts.push(`Noted ${result.memories.length} thing${result.memories.length > 1 ? "s" : ""} to remember.`);
1828
- }
1829
- if (parts.length > 0) {
1830
- await this.responder.sendResponse({
1831
- text: parts.join(" "),
1832
- channel: this.channel,
1833
- threadId: threadTs,
1834
- source: "interpretation"
1835
- });
1836
- }
1837
- } catch {
1838
- }
1839
- }
1840
1823
  } catch (err) {
1841
1824
  const errMsg = err instanceof Error ? err.message : String(err);
1842
1825
  await this.hooks.emit("interpretation.error", {
@@ -6081,17 +6064,22 @@ async function registerExecutionEngine(opts) {
6081
6064
  const toolHandlers = new Map(
6082
6065
  (config.tools ?? []).map((t) => [t.definition.name, t.handler])
6083
6066
  );
6084
- hooks.register("task.created", async (ctx) => {
6085
- const taskId = ctx.id ?? ctx.taskId;
6086
- if (!taskId) return;
6067
+ async function tryExecuteTask(taskId, hintAgentId) {
6087
6068
  const task = await db.get("tasks", { id: taskId });
6088
6069
  if (!task || task.status !== "todo") return;
6089
- const assigneeId = task.assignee_id;
6070
+ const nextRetryAt = task["next_retry_at"];
6071
+ if (nextRetryAt && new Date(nextRetryAt) > /* @__PURE__ */ new Date()) return;
6072
+ const assigneeId = hintAgentId ?? task.assignee_id;
6090
6073
  if (!assigneeId) return;
6091
6074
  if (runs.isLocked(assigneeId)) return;
6092
6075
  const agent = await db.get("agents", { id: assigneeId });
6093
6076
  if (!agent) return;
6094
- const runId = await runs.startRun(assigneeId, taskId, "api");
6077
+ let runId;
6078
+ try {
6079
+ runId = await runs.startRun(assigneeId, taskId, "api");
6080
+ } catch {
6081
+ return;
6082
+ }
6095
6083
  const prompt = task.description ?? task.title ?? "";
6096
6084
  try {
6097
6085
  const toolListing = toolDefs.length > 0 ? `
@@ -6160,6 +6148,25 @@ ${systemContext}` : "",
6160
6148
  const msg = err instanceof Error ? err.message : String(err);
6161
6149
  await runs.finishRun(runId, { exitCode: 1, output: `Execution error: ${msg}` });
6162
6150
  }
6151
+ }
6152
+ hooks.register("task.created", async (ctx) => {
6153
+ const taskId = ctx.id ?? ctx.taskId;
6154
+ if (!taskId) return;
6155
+ await tryExecuteTask(taskId);
6156
+ });
6157
+ hooks.register("agent.wakeup", async (ctx) => {
6158
+ const taskId = ctx.taskId;
6159
+ const agentId = ctx.agentId;
6160
+ if (!taskId) return;
6161
+ await tryExecuteTask(taskId, agentId);
6162
+ });
6163
+ hooks.register("run.completed", async (ctx) => {
6164
+ const agentId = ctx.agentId;
6165
+ if (!agentId) return;
6166
+ const pendingTasks = (await db.query("tasks", { where: { status: "todo" } })).filter((t) => t["assignee_id"] === agentId).sort((a, b) => a["priority"] - b["priority"]);
6167
+ if (pendingTasks.length > 0) {
6168
+ await tryExecuteTask(pendingTasks[0]["id"], agentId);
6169
+ }
6163
6170
  });
6164
6171
  }
6165
6172
 
@@ -6714,6 +6721,30 @@ var createProjectTool = {
6714
6721
  }
6715
6722
  };
6716
6723
 
6724
+ // src/core/orchestrator/tools/index.ts
6725
+ var nativeTools = [
6726
+ sendFileTool,
6727
+ readFileTool,
6728
+ listFilesTool,
6729
+ registerFileTool,
6730
+ dispatchTaskTool,
6731
+ cancelTaskTool,
6732
+ reassignTaskTool,
6733
+ getTaskStatusTool,
6734
+ getAgentStatusTool,
6735
+ getSystemStatusTool,
6736
+ getActiveTasksTool,
6737
+ listAgentsTool,
6738
+ listProjectsTool,
6739
+ getAgentDetailTool,
6740
+ sendMessageTool,
6741
+ addTaskCommentTool,
6742
+ readConversationTool,
6743
+ searchConversationTool,
6744
+ createAgentTool,
6745
+ createProjectTool
6746
+ ];
6747
+
6717
6748
  // src/core/orchestrator/user-registry.ts
6718
6749
  import { v4 as uuidv4 } from "uuid";
6719
6750
  var UserRegistry = class {
@@ -7138,6 +7169,7 @@ export {
7138
7169
  listFilesTool,
7139
7170
  listProjectsTool,
7140
7171
  loadConfig,
7172
+ nativeTools,
7141
7173
  parseClaudeStream,
7142
7174
  parseVersion,
7143
7175
  readConversationTool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",