botinabox 2.9.1 → 2.9.3

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 (162) hide show
  1. package/README.md +2 -1
  2. package/bin/botinabox.mjs +1 -1
  3. package/dist/channels/discord/adapter.d.ts +32 -0
  4. package/dist/channels/discord/inbound.d.ts +25 -0
  5. package/dist/channels/discord/index.d.ts +8 -84
  6. package/dist/channels/discord/models.d.ts +8 -0
  7. package/dist/channels/discord/outbound.d.ts +14 -0
  8. package/dist/channels/slack/adapter.d.ts +33 -0
  9. package/dist/channels/slack/bolt-adapter.d.ts +31 -0
  10. package/dist/channels/slack/enrichers/enrich.d.ts +12 -0
  11. package/dist/channels/slack/enrichers/image-enricher.d.ts +10 -0
  12. package/dist/channels/slack/enrichers/index.d.ts +4 -0
  13. package/dist/channels/slack/enrichers/pdf-enricher.d.ts +8 -0
  14. package/dist/channels/slack/enrichers/types.d.ts +33 -0
  15. package/dist/channels/slack/inbound.d.ts +59 -0
  16. package/dist/channels/slack/index.d.ts +13 -252
  17. package/dist/channels/slack/media-type.d.ts +14 -0
  18. package/dist/channels/slack/models.d.ts +9 -0
  19. package/dist/channels/slack/outbound.d.ts +12 -0
  20. package/dist/channels/slack/transcribe.d.ts +41 -0
  21. package/dist/channels/webhook/adapter.d.ts +23 -0
  22. package/dist/channels/webhook/hmac.d.ts +13 -0
  23. package/dist/channels/webhook/index.d.ts +7 -70
  24. package/dist/channels/webhook/models.d.ts +9 -0
  25. package/dist/channels/webhook/server.d.ts +20 -0
  26. package/dist/cli/templates/config.yml.d.ts +7 -0
  27. package/dist/cli/templates/env.d.ts +1 -0
  28. package/dist/cli/templates/index.ts.d.ts +2 -0
  29. package/dist/cli/templates/package.json.d.ts +5 -0
  30. package/dist/cli.d.ts +1 -3
  31. package/dist/connectors/google/calendar-connector.d.ts +40 -0
  32. package/dist/connectors/google/drive-connector.d.ts +43 -0
  33. package/dist/connectors/google/drive-read.d.ts +81 -0
  34. package/dist/connectors/google/gmail-connector.d.ts +42 -0
  35. package/dist/connectors/google/index.d.ts +10 -369
  36. package/dist/connectors/google/oauth.d.ts +48 -0
  37. package/dist/connectors/google/types.d.ts +110 -0
  38. package/dist/core/chat/auto-discovery.d.ts +16 -0
  39. package/dist/core/chat/channel-registry.d.ts +45 -0
  40. package/dist/core/chat/chat-pipeline-v2.d.ts +138 -0
  41. package/dist/core/chat/chat-pipeline.d.ts +116 -0
  42. package/dist/core/chat/chat-responder.d.ts +94 -0
  43. package/dist/core/chat/formatter.d.ts +11 -0
  44. package/dist/core/chat/index.d.ts +26 -0
  45. package/dist/core/chat/message-interpreter.d.ts +91 -0
  46. package/dist/core/chat/message-store.d.ts +71 -0
  47. package/dist/core/chat/notification-queue.d.ts +34 -0
  48. package/dist/core/chat/pipeline.d.ts +38 -0
  49. package/dist/core/chat/policies.d.ts +16 -0
  50. package/dist/core/chat/routing.d.ts +17 -0
  51. package/dist/core/chat/session-key.d.ts +30 -0
  52. package/dist/core/chat/session-manager.d.ts +17 -0
  53. package/dist/core/chat/text-chunker.d.ts +9 -0
  54. package/dist/core/chat/triage-router.d.ts +75 -0
  55. package/dist/core/chat/types.d.ts +5 -0
  56. package/dist/core/config/defaults.d.ts +2 -0
  57. package/dist/core/config/index.d.ts +6 -0
  58. package/dist/core/config/interpolate.d.ts +5 -0
  59. package/dist/core/config/loader.d.ts +24 -0
  60. package/dist/core/config/schema.d.ts +5 -0
  61. package/dist/core/data/context-builder.d.ts +27 -0
  62. package/dist/core/data/core-entity-contexts.d.ts +14 -0
  63. package/dist/core/data/core-migrations.d.ts +5 -0
  64. package/dist/core/data/core-schema.d.ts +6 -0
  65. package/dist/core/data/data-store.d.ts +67 -0
  66. package/dist/core/data/domain-entity-contexts.d.ts +35 -0
  67. package/dist/core/data/domain-schema.d.ts +36 -0
  68. package/dist/core/data/index.d.ts +8 -0
  69. package/dist/core/data/types.d.ts +111 -0
  70. package/dist/core/hooks/hook-bus.d.ts +24 -0
  71. package/dist/core/hooks/index.d.ts +2 -0
  72. package/dist/core/hooks/types.d.ts +19 -0
  73. package/dist/core/index.d.ts +4 -0
  74. package/dist/core/llm/auto-discovery.d.ts +11 -0
  75. package/dist/core/llm/cost-tracker.d.ts +6 -0
  76. package/dist/core/llm/default-llm-call.d.ts +35 -0
  77. package/dist/core/llm/index.d.ts +6 -0
  78. package/dist/core/llm/model-router.d.ts +25 -0
  79. package/dist/core/llm/provider-registry.d.ts +9 -0
  80. package/dist/core/llm/types.d.ts +2 -0
  81. package/dist/core/orchestrator/adapters/api-adapter.d.ts +34 -0
  82. package/dist/core/orchestrator/adapters/cli-adapter.d.ts +62 -0
  83. package/dist/core/orchestrator/adapters/deterministic-adapter.d.ts +35 -0
  84. package/dist/core/orchestrator/adapters/env-whitelist.d.ts +4 -0
  85. package/dist/core/orchestrator/adapters/output-extractor.d.ts +11 -0
  86. package/dist/core/orchestrator/adapters/process-manager.d.ts +15 -0
  87. package/dist/core/orchestrator/adapters/tool-loop.d.ts +22 -0
  88. package/dist/core/orchestrator/agent-registry.d.ts +31 -0
  89. package/dist/core/orchestrator/budget-controller.d.ts +19 -0
  90. package/dist/core/orchestrator/chain-guard.d.ts +14 -0
  91. package/dist/core/orchestrator/circuit-breaker.d.ts +65 -0
  92. package/dist/core/orchestrator/claude-stream-parser.d.ts +31 -0
  93. package/dist/core/orchestrator/config-revisions.d.ts +6 -0
  94. package/dist/core/orchestrator/dependency-resolver.d.ts +20 -0
  95. package/dist/core/orchestrator/execution-engine.d.ts +99 -0
  96. package/dist/core/orchestrator/governance-gate.d.ts +110 -0
  97. package/dist/core/orchestrator/learning-pipeline.d.ts +112 -0
  98. package/dist/core/orchestrator/loop-detector.d.ts +51 -0
  99. package/dist/core/orchestrator/ndjson-logger.d.ts +6 -0
  100. package/dist/core/orchestrator/permission-relay.d.ts +72 -0
  101. package/dist/core/orchestrator/run-manager.d.ts +31 -0
  102. package/dist/core/orchestrator/scheduler.d.ts +74 -0
  103. package/dist/core/orchestrator/secret-store.d.ts +57 -0
  104. package/dist/core/orchestrator/session-manager.d.ts +13 -0
  105. package/dist/core/orchestrator/task-queue.d.ts +34 -0
  106. package/dist/core/orchestrator/template-interpolate.d.ts +5 -0
  107. package/dist/core/orchestrator/tools/file-ops.d.ts +12 -0
  108. package/dist/core/orchestrator/tools/index.d.ts +47 -0
  109. package/dist/core/orchestrator/tools/management.d.ts +12 -0
  110. package/dist/core/orchestrator/tools/messaging.d.ts +21 -0
  111. package/dist/core/orchestrator/tools/read-file.d.ts +5 -0
  112. package/dist/core/orchestrator/tools/resolve-agent.d.ts +9 -0
  113. package/dist/core/orchestrator/tools/roster.d.ts +16 -0
  114. package/dist/core/orchestrator/tools/send-file.d.ts +5 -0
  115. package/dist/core/orchestrator/tools/status.d.ts +20 -0
  116. package/dist/core/orchestrator/tools/task-ops.d.ts +13 -0
  117. package/dist/core/orchestrator/user-registry.d.ts +47 -0
  118. package/dist/core/orchestrator/wakeup-queue.d.ts +9 -0
  119. package/dist/core/orchestrator/workflow-engine.d.ts +47 -0
  120. package/dist/core/security/audit.d.ts +20 -0
  121. package/dist/core/security/column-validator.d.ts +20 -0
  122. package/dist/core/security/index.d.ts +5 -0
  123. package/dist/core/security/process-env.d.ts +13 -0
  124. package/dist/core/security/sanitizer.d.ts +11 -0
  125. package/dist/core/security/types.d.ts +11 -0
  126. package/dist/core/update/auto-update.d.ts +21 -0
  127. package/dist/core/update/backup-manager.d.ts +7 -0
  128. package/dist/core/update/index.d.ts +8 -0
  129. package/dist/core/update/migration-hooks.d.ts +11 -0
  130. package/dist/core/update/types.d.ts +11 -0
  131. package/dist/core/update/update-checker.d.ts +11 -0
  132. package/dist/core/update/update-manager.d.ts +25 -0
  133. package/dist/core/update/version-utils.d.ts +6 -0
  134. package/dist/index.d.ts +38 -2366
  135. package/dist/index.js +117 -10
  136. package/dist/providers/anthropic/index.d.ts +5 -20
  137. package/dist/providers/anthropic/models.d.ts +2 -0
  138. package/dist/providers/anthropic/provider.d.ts +13 -0
  139. package/dist/providers/anthropic/tool-converter.d.ts +10 -0
  140. package/dist/providers/ollama/index.d.ts +4 -22
  141. package/dist/providers/ollama/provider.d.ts +17 -0
  142. package/dist/providers/openai/index.d.ts +5 -20
  143. package/dist/providers/openai/models.d.ts +2 -0
  144. package/dist/providers/openai/provider.d.ts +13 -0
  145. package/dist/providers/openai/tool-converter.d.ts +10 -0
  146. package/dist/shared/constants.d.ts +50 -0
  147. package/dist/shared/index.d.ts +14 -0
  148. package/dist/shared/types/agent.d.ts +36 -0
  149. package/dist/{channel-CVm1AWUF.d.ts → shared/types/channel.d.ts} +13 -17
  150. package/dist/shared/types/config.d.ts +160 -0
  151. package/dist/shared/types/connector.d.ts +77 -0
  152. package/dist/shared/types/execution.d.ts +29 -0
  153. package/dist/{provider-BHkqkSdq.d.ts → shared/types/provider.d.ts} +10 -12
  154. package/dist/shared/types/task.d.ts +47 -0
  155. package/dist/shared/types/workflow.d.ts +39 -0
  156. package/dist/shared/utils.d.ts +6 -0
  157. package/dist/update-check.d.ts +5 -0
  158. package/package.json +3 -3
  159. package/dist/channel-DziSPayj.d.ts +0 -73
  160. package/dist/chat-pipeline-BGgmH_ap.d.ts +0 -655
  161. package/dist/chat-pipeline-BWrtVqEP.d.ts +0 -652
  162. package/dist/chat-pipeline-aBSj7a4E.d.ts +0 -655
@@ -0,0 +1,160 @@
1
+ /** Bot configuration types — Story 1.2 / 1.5 */
2
+ export interface DataConfig {
3
+ path: string;
4
+ walMode: boolean;
5
+ backupDir?: string;
6
+ }
7
+ export interface ModelConfig {
8
+ aliases: Record<string, string>;
9
+ default: string;
10
+ routing: Record<string, string>;
11
+ fallbackChain: string[];
12
+ costLimit?: {
13
+ perRunCents?: number;
14
+ };
15
+ }
16
+ export interface SecurityConfig {
17
+ fieldLengthLimits?: Record<string, number>;
18
+ allowedFilePrefixes?: string[];
19
+ }
20
+ export interface RenderConfig {
21
+ outputDir: string;
22
+ watchIntervalMs: number;
23
+ }
24
+ export interface UpdateConfig {
25
+ policy: "auto-all" | "auto-compatible" | "auto-patch" | "notify" | "manual";
26
+ checkIntervalMs: number;
27
+ maintenanceWindow?: {
28
+ utcHourStart: number;
29
+ utcHourEnd: number;
30
+ days?: Array<"mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun">;
31
+ };
32
+ }
33
+ export interface BudgetConfig {
34
+ globalMonthlyCents?: number;
35
+ warnPercent: number;
36
+ }
37
+ export interface EntityColumnDef {
38
+ type: "uuid" | "text" | "integer" | "boolean" | "datetime" | "real";
39
+ required?: boolean;
40
+ default?: string | number | boolean;
41
+ references?: string;
42
+ }
43
+ export interface EntityConfig {
44
+ columns: Record<string, EntityColumnDef>;
45
+ relations?: Array<{
46
+ type: "hasMany" | "manyToMany" | "belongsTo";
47
+ table: string;
48
+ through?: string;
49
+ localKey?: string;
50
+ remoteKey?: string;
51
+ }>;
52
+ }
53
+ export interface AgentConfig {
54
+ slug: string;
55
+ name: string;
56
+ role?: string;
57
+ adapter: string;
58
+ model?: string;
59
+ workdir?: string;
60
+ instructionsFile?: string;
61
+ maxConcurrentRuns?: number;
62
+ budgetMonthlyCents?: number;
63
+ canCreateAgents?: boolean;
64
+ skipPermissions?: boolean;
65
+ config?: Record<string, unknown>;
66
+ }
67
+ export interface ExecutionConfig {
68
+ /** Model for task execution. Default: models.routing.task_execution */
69
+ model?: string;
70
+ /** Max tool loop iterations per task. Default: 5 */
71
+ maxIterations?: number;
72
+ /** Max tokens per LLM call. Default: 4096 */
73
+ maxTokens?: number;
74
+ /** Additional system prompt text appended to agent prompt */
75
+ systemPromptSuffix?: string;
76
+ }
77
+ export interface ChatConfig {
78
+ /** System prompt for the conversational responder */
79
+ systemPrompt?: string;
80
+ /** Max tokens for context window. Default: 4000 */
81
+ contextWindowTokens?: number;
82
+ /** Max recent outbound messages for redundancy check. Default: 10 */
83
+ redundancyWindow?: number;
84
+ /** Message dedup window in ms. Default: 300000 (5 min) */
85
+ dedupWindowMs?: number;
86
+ /** Max tokens for ack responses. Default: 500 */
87
+ responseMaxTokens?: number;
88
+ }
89
+ export interface RoutingConfig {
90
+ /** Routing rules for message triage */
91
+ rules: Array<{
92
+ agentSlug: string;
93
+ keywords?: string[];
94
+ patterns?: string[];
95
+ priority?: number;
96
+ }>;
97
+ /** Default agent when no rule matches */
98
+ fallbackAgent: string;
99
+ /** Use LLM for ambiguous messages. Default: false */
100
+ llmFallback?: boolean;
101
+ }
102
+ export interface SafetyConfig {
103
+ /** Circuit breaker failure threshold. Default: 3 */
104
+ circuitBreakerThreshold?: number;
105
+ /** Circuit breaker reset timeout ms. Default: 300000 (5 min) */
106
+ circuitBreakerResetMs?: number;
107
+ /** Max agent followup chain depth. Default: 5 */
108
+ maxChainDepth?: number;
109
+ /** Stale run detection threshold ms. Default: 1800000 (30 min) */
110
+ staleRunThresholdMs?: number;
111
+ }
112
+ export interface BotConfig {
113
+ data: DataConfig;
114
+ channels: Record<string, {
115
+ enabled: boolean;
116
+ accounts?: Record<string, unknown>;
117
+ } & Record<string, unknown>>;
118
+ connectors?: Record<string, {
119
+ enabled: boolean;
120
+ provider: string;
121
+ accounts?: Record<string, import("./connector.js").ConnectorConfig>;
122
+ } & Record<string, unknown>>;
123
+ agents: AgentConfig[];
124
+ providers: Record<string, {
125
+ enabled: boolean;
126
+ } & Record<string, unknown>>;
127
+ models: ModelConfig;
128
+ entities: Record<string, EntityConfig>;
129
+ security: SecurityConfig;
130
+ render: RenderConfig;
131
+ updates: UpdateConfig;
132
+ budget: BudgetConfig;
133
+ execution?: ExecutionConfig;
134
+ chat?: ChatConfig;
135
+ routing?: RoutingConfig;
136
+ safety?: SafetyConfig;
137
+ workflows?: Record<string, WorkflowConfigEntry>;
138
+ }
139
+ export interface WorkflowConfigEntry {
140
+ name: string;
141
+ description?: string;
142
+ steps: WorkflowStepConfig[];
143
+ trigger?: {
144
+ type: "task_completed" | "event" | "schedule" | "manual";
145
+ filter?: Record<string, unknown>;
146
+ };
147
+ }
148
+ export interface WorkflowStepConfig {
149
+ id: string;
150
+ name: string;
151
+ agentSlug?: string;
152
+ taskTemplate: {
153
+ title: string;
154
+ description: string;
155
+ };
156
+ dependsOn?: string[];
157
+ onComplete?: "next" | "parallel" | "end";
158
+ onFail?: "abort" | "skip" | "retry";
159
+ retryPolicy?: import("./task.js").RetryPolicy;
160
+ }
@@ -0,0 +1,77 @@
1
+ /** Connector types — generic external service integrations. */
2
+ export interface ConnectorMeta {
3
+ displayName: string;
4
+ /** Provider identifier, e.g. "google", "trello", "jira", "salesforce" */
5
+ provider: string;
6
+ /** Data type this connector handles, e.g. "email", "calendar", "board", "crm" */
7
+ dataType: string;
8
+ }
9
+ export interface SyncOptions {
10
+ /** Only sync records after this ISO 8601 timestamp */
11
+ since?: string;
12
+ /** Provider-specific incremental sync token */
13
+ cursor?: string;
14
+ /** Maximum number of records to fetch */
15
+ limit?: number;
16
+ /** Provider-specific query filters */
17
+ filters?: Record<string, unknown>;
18
+ }
19
+ export interface SyncResult<T = Record<string, unknown>> {
20
+ /** Typed records produced by the connector — consumer decides where to store */
21
+ records: T[];
22
+ /** Next incremental sync token (persist for future calls) */
23
+ cursor?: string;
24
+ /** Whether more records are available (pagination) */
25
+ hasMore: boolean;
26
+ /** Errors encountered during sync (non-fatal per-record failures) */
27
+ errors: Array<{
28
+ id?: string;
29
+ error: string;
30
+ }>;
31
+ }
32
+ export interface PushResult {
33
+ success: boolean;
34
+ externalId?: string;
35
+ error?: string;
36
+ }
37
+ export interface AuthResult {
38
+ success: boolean;
39
+ account?: string;
40
+ /** URL the user must visit to authorize (for OAuth flows) */
41
+ authUrl?: string;
42
+ error?: string;
43
+ }
44
+ export type ConnectorConfig = Record<string, unknown>;
45
+ /**
46
+ * Generic connector interface for external service integrations.
47
+ *
48
+ * Connectors pull and optionally push data to/from external services
49
+ * (Gmail, Calendar, Trello, Jira, Salesforce, etc.). They produce
50
+ * typed records — the consuming application decides where to store them.
51
+ *
52
+ * @typeParam T - The record type this connector produces/consumes.
53
+ */
54
+ export interface Connector<T = Record<string, unknown>> {
55
+ readonly id: string;
56
+ readonly meta: ConnectorMeta;
57
+ connect(config: ConnectorConfig): Promise<void>;
58
+ disconnect(): Promise<void>;
59
+ healthCheck(): Promise<{
60
+ ok: boolean;
61
+ account?: string;
62
+ error?: string;
63
+ }>;
64
+ /** Pull records from external source */
65
+ sync(options?: SyncOptions): Promise<SyncResult<T>>;
66
+ /** Push a record to external source (optional) */
67
+ push?(payload: T): Promise<PushResult>;
68
+ /**
69
+ * Run the authentication/authorization flow for this connector.
70
+ * For OAuth connectors, this generates the auth URL and exchanges the code for tokens.
71
+ *
72
+ * @param codeProvider - called with the auth URL; must return the authorization code.
73
+ * For CLI flows, this prints the URL and reads from stdin.
74
+ * For programmatic flows, the caller handles the redirect.
75
+ */
76
+ authenticate?(codeProvider: (authUrl: string) => Promise<string>): Promise<AuthResult>;
77
+ }
@@ -0,0 +1,29 @@
1
+ /** Execution adapter types — Story 1.5 / 3.4 / 3.5 */
2
+ export type RunStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
3
+ export interface RunContext {
4
+ runId: string;
5
+ agentId: string;
6
+ agentSlug: string;
7
+ taskId?: string;
8
+ taskTitle?: string;
9
+ taskDescription?: string;
10
+ model: string;
11
+ workdir: string;
12
+ sessionParams?: unknown;
13
+ abortSignal?: AbortSignal;
14
+ onLog?: (line: string) => void;
15
+ }
16
+ export interface RunResult {
17
+ status: "succeeded" | "failed";
18
+ output?: string;
19
+ error?: string;
20
+ usage?: import("./provider.js").TokenUsage;
21
+ costCents?: number;
22
+ sessionParams?: unknown;
23
+ clearSession?: boolean;
24
+ durationMs: number;
25
+ }
26
+ export interface ExecutionAdapter {
27
+ id: string;
28
+ execute(ctx: RunContext): Promise<RunResult>;
29
+ }
@@ -1,14 +1,14 @@
1
1
  /** LLM provider types — Story 1.5 / 2.1 */
2
- interface ToolDefinition {
2
+ export interface ToolDefinition {
3
3
  name: string;
4
4
  description: string;
5
5
  parameters: Record<string, unknown>;
6
6
  }
7
- interface ChatMessage {
7
+ export interface ChatMessage {
8
8
  role: "user" | "assistant" | "system";
9
9
  content: string | ContentBlock[];
10
10
  }
11
- type ContentBlock = {
11
+ export type ContentBlock = {
12
12
  type: "text";
13
13
  text: string;
14
14
  } | {
@@ -35,7 +35,7 @@ type ContentBlock = {
35
35
  data: string;
36
36
  };
37
37
  };
38
- interface ChatParams {
38
+ export interface ChatParams {
39
39
  messages: ChatMessage[];
40
40
  system?: string;
41
41
  tools?: ToolDefinition[];
@@ -44,25 +44,25 @@ interface ChatParams {
44
44
  model: string;
45
45
  abortSignal?: AbortSignal;
46
46
  }
47
- interface TokenUsage {
47
+ export interface TokenUsage {
48
48
  inputTokens: number;
49
49
  outputTokens: number;
50
50
  cacheReadTokens?: number;
51
51
  cacheWriteTokens?: number;
52
52
  }
53
- interface ChatResult {
53
+ export interface ChatResult {
54
54
  content: string;
55
55
  toolUses?: ToolUse[];
56
56
  usage: TokenUsage;
57
57
  model: string;
58
58
  stopReason: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
59
59
  }
60
- interface ToolUse {
60
+ export interface ToolUse {
61
61
  id: string;
62
62
  name: string;
63
63
  input: unknown;
64
64
  }
65
- interface ModelInfo {
65
+ export interface ModelInfo {
66
66
  id: string;
67
67
  displayName: string;
68
68
  contextWindow: number;
@@ -72,11 +72,11 @@ interface ModelInfo {
72
72
  inputCostPerMToken?: number;
73
73
  outputCostPerMToken?: number;
74
74
  }
75
- interface ResolvedModel {
75
+ export interface ResolvedModel {
76
76
  provider: string;
77
77
  model: string;
78
78
  }
79
- interface LLMProvider {
79
+ export interface LLMProvider {
80
80
  id: string;
81
81
  displayName: string;
82
82
  models: ModelInfo[];
@@ -85,5 +85,3 @@ interface LLMProvider {
85
85
  /** Convert ToolDefinition[] to provider-native format */
86
86
  serializeTools(tools: ToolDefinition[]): unknown;
87
87
  }
88
-
89
- export type { ChatMessage as C, LLMProvider as L, ModelInfo as M, ResolvedModel as R, TokenUsage as T, ChatParams as a, ChatResult as b, ContentBlock as c, ToolUse as d, ToolDefinition as e };
@@ -0,0 +1,47 @@
1
+ /** Task types — Story 1.5 / 3.2 */
2
+ export type TaskStatus = "backlog" | "todo" | "in_progress" | "in_review" | "done" | "blocked" | "cancelled";
3
+ export interface RetryPolicy {
4
+ maxRetries: number;
5
+ backoffMs: number;
6
+ backoffMultiplier: number;
7
+ maxBackoffMs: number;
8
+ }
9
+ export interface TaskDefinition {
10
+ title: string;
11
+ description?: string;
12
+ assigneeId?: string;
13
+ priority?: number;
14
+ parentId?: string;
15
+ dependsOn?: string[];
16
+ followupAgentId?: string;
17
+ followupTemplate?: string;
18
+ chainOriginId?: string;
19
+ chainDepth?: number;
20
+ retryPolicy?: RetryPolicy;
21
+ metadata?: Record<string, unknown>;
22
+ }
23
+ export interface TaskRecord extends Required<Pick<TaskDefinition, "title" | "priority">> {
24
+ id: string;
25
+ description: string;
26
+ assigneeId?: string;
27
+ status: TaskStatus;
28
+ priority: number;
29
+ parentId?: string;
30
+ dependsOn: string[];
31
+ followupAgentId?: string;
32
+ followupTemplate?: string;
33
+ chainOriginId?: string;
34
+ chainDepth: number;
35
+ retryPolicy?: RetryPolicy;
36
+ retryCount: number;
37
+ maxRetries: number;
38
+ nextRetryAt?: string;
39
+ executionRunId?: string;
40
+ result?: string;
41
+ completedOutput?: string;
42
+ metadata?: Record<string, unknown>;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ completedAt?: string;
46
+ deletedAt?: string;
47
+ }
@@ -0,0 +1,39 @@
1
+ /** Workflow types — Story 1.5 / 5.1 */
2
+ export type WorkflowRunStatus = "running" | "completed" | "failed" | "cancelled";
3
+ export interface WorkflowStep {
4
+ id: string;
5
+ name: string;
6
+ agentSlug?: string;
7
+ agentResolver?: string;
8
+ taskTemplate: {
9
+ title: string;
10
+ description: string;
11
+ };
12
+ dependsOn?: string[];
13
+ onComplete?: "next" | "parallel" | "end";
14
+ onFail?: "abort" | "skip" | "retry";
15
+ retryPolicy?: import("./task.js").RetryPolicy;
16
+ condition?: string;
17
+ }
18
+ export interface WorkflowDefinition {
19
+ slug: string;
20
+ name: string;
21
+ description?: string;
22
+ steps: WorkflowStep[];
23
+ trigger?: WorkflowTrigger;
24
+ }
25
+ export interface WorkflowTrigger {
26
+ type: "task_completed" | "event" | "schedule" | "manual";
27
+ filter?: Record<string, unknown>;
28
+ }
29
+ export interface WorkflowRunRecord {
30
+ id: string;
31
+ workflowId: string;
32
+ status: WorkflowRunStatus;
33
+ currentStep: number;
34
+ context: Record<string, unknown>;
35
+ originTaskId?: string;
36
+ startedAt: string;
37
+ finishedAt?: string;
38
+ error?: string;
39
+ }
@@ -0,0 +1,6 @@
1
+ /** Shared utility functions. */
2
+ /**
3
+ * Truncate text at a word boundary, appending "..." if truncated.
4
+ * Returns the original text if it's shorter than maxLen.
5
+ */
6
+ export declare function truncateAtWord(text: string, maxLen: number): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Check the npm registry for a newer version. Caches results for 24 hours.
3
+ * Returns the latest version string if an update is available, null otherwise.
4
+ */
5
+ export declare function checkForUpdate(pkgName: string, currentVersion: string): Promise<string | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "node": ">=18"
51
51
  },
52
52
  "scripts": {
53
- "build": "tsup",
53
+ "build": "tsup && tsc --emitDeclarationOnly",
54
54
  "test": "vitest run",
55
55
  "typecheck": "tsc --noEmit",
56
56
  "check-docs": "echo 'Documentation check passed'",
@@ -60,7 +60,7 @@
60
60
  "@types/uuid": "^10.0.0",
61
61
  "ajv": "^8.17.1",
62
62
  "cron-parser": "^4.9.0",
63
- "latticesql": "^1.6.6",
63
+ "latticesql": "^1.6.10",
64
64
  "uuid": "^13.0.0",
65
65
  "yaml": "^2.7.0"
66
66
  },
@@ -1,73 +0,0 @@
1
- /** Channel adapter types — Story 1.5 / 4.1 */
2
- type ChatType = "direct" | "group" | "channel";
3
- type FormattingMode = "markdown" | "mrkdwn" | "html" | "plain";
4
- interface ChannelCapabilities {
5
- chatTypes: ChatType[];
6
- threads: boolean;
7
- reactions: boolean;
8
- editing: boolean;
9
- media: boolean;
10
- polls: boolean;
11
- maxTextLength: number;
12
- formattingMode: FormattingMode;
13
- }
14
- interface ChannelMeta {
15
- displayName: string;
16
- icon?: string;
17
- homepage?: string;
18
- }
19
- interface InboundMessage {
20
- id: string;
21
- channel: string;
22
- account?: string;
23
- from: string;
24
- userId?: string;
25
- body: string;
26
- threadId?: string;
27
- replyToId?: string;
28
- attachments?: Attachment[];
29
- receivedAt: string;
30
- raw?: unknown;
31
- }
32
- type AttachmentMediaType = "image" | "video" | "audio" | "pdf" | "doc" | "excel" | "presentation" | "html" | "link" | "misc";
33
- interface Attachment {
34
- type: AttachmentMediaType;
35
- url?: string;
36
- mimeType?: string;
37
- filename?: string;
38
- size?: number;
39
- }
40
- interface OutboundPayload {
41
- text: string;
42
- threadId?: string;
43
- replyToId?: string;
44
- attachments?: Attachment[];
45
- }
46
- interface SendResult {
47
- success: boolean;
48
- messageId?: string;
49
- error?: string;
50
- }
51
- interface HealthStatus {
52
- ok: boolean;
53
- latencyMs?: number;
54
- error?: string;
55
- }
56
- type ChannelConfig = Record<string, unknown>;
57
- interface ChannelAdapter {
58
- /** Unique identifier for this adapter instance */
59
- id: string;
60
- meta: ChannelMeta;
61
- capabilities: ChannelCapabilities;
62
- connect(config: ChannelConfig): Promise<void>;
63
- disconnect(): Promise<void>;
64
- healthCheck(): Promise<HealthStatus>;
65
- send(target: {
66
- peerId: string;
67
- threadId?: string;
68
- }, payload: OutboundPayload): Promise<SendResult>;
69
- /** Called when a message arrives — set by the framework */
70
- onMessage?: (message: InboundMessage) => Promise<void>;
71
- }
72
-
73
- export type { Attachment as A, ChannelAdapter as C, FormattingMode as F, HealthStatus as H, InboundMessage as I, OutboundPayload as O, SendResult as S, AttachmentMediaType as a, ChannelCapabilities as b, ChannelConfig as c, ChannelMeta as d, ChatType as e };