botinabox 1.9.3 → 1.10.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/channels/discord/index.js +2 -1
- package/dist/channels/slack/index.js +4 -3
- package/dist/channels/webhook/index.js +2 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/cli.js +2 -1
- package/dist/connectors/google/index.js +1 -0
- package/dist/gmail-connector-Z7SO6VOS.js +7 -0
- package/dist/inbound-IBKXBFZF.js +11 -0
- package/dist/inbound-WU7X2HGA.js +7 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +102 -1
- package/dist/providers/anthropic/index.js +2 -0
- package/dist/providers/ollama/index.js +2 -0
- package/dist/providers/openai/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseDiscordEvent
|
|
3
3
|
} from "../../chunk-DLJKZD3Q.js";
|
|
4
|
+
import "../../chunk-3RG5ZIWI.js";
|
|
4
5
|
|
|
5
6
|
// src/channels/discord/outbound.ts
|
|
6
7
|
var DISCORD_MAX_LENGTH = 2e3;
|
|
@@ -80,7 +81,7 @@ var DiscordAdapter = class {
|
|
|
80
81
|
/** Simulate receiving an inbound message (for testing/webhooks). */
|
|
81
82
|
async receive(event) {
|
|
82
83
|
if (this.onMessage) {
|
|
83
|
-
const { parseDiscordEvent: parseDiscordEvent2 } = await import("../../inbound-
|
|
84
|
+
const { parseDiscordEvent: parseDiscordEvent2 } = await import("../../inbound-WU7X2HGA.js");
|
|
84
85
|
const msg = parseDiscordEvent2(event);
|
|
85
86
|
await this.onMessage(msg);
|
|
86
87
|
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
chunkText
|
|
10
10
|
} from "../../chunk-ZTZFPTOQ.js";
|
|
11
|
+
import "../../chunk-3RG5ZIWI.js";
|
|
11
12
|
|
|
12
13
|
// src/channels/slack/outbound.ts
|
|
13
14
|
function formatForSlack(text) {
|
|
@@ -70,8 +71,8 @@ var SlackAdapter = class {
|
|
|
70
71
|
/** Simulate receiving an inbound message (for testing/webhooks). */
|
|
71
72
|
async receive(event) {
|
|
72
73
|
if (this.onMessage) {
|
|
73
|
-
const { parseSlackEvent: parseSlackEvent2 } = await import("../../inbound-
|
|
74
|
-
const { enrichVoiceMessage: enrichVoiceMessage2 } = await import("../../inbound-
|
|
74
|
+
const { parseSlackEvent: parseSlackEvent2 } = await import("../../inbound-IBKXBFZF.js");
|
|
75
|
+
const { enrichVoiceMessage: enrichVoiceMessage2 } = await import("../../inbound-IBKXBFZF.js");
|
|
75
76
|
let msg = parseSlackEvent2(event);
|
|
76
77
|
if (msg.body.includes("[Voice message") && this.config?.botToken) {
|
|
77
78
|
msg = await enrichVoiceMessage2(msg, this.config.botToken);
|
|
@@ -94,7 +95,7 @@ var SlackBoltAdapter = class {
|
|
|
94
95
|
async start() {
|
|
95
96
|
const boltModule = "@slack/bolt";
|
|
96
97
|
const bolt = await import(boltModule);
|
|
97
|
-
const { enrichVoiceMessage: enrichVoiceMessage2 } = await import("../../inbound-
|
|
98
|
+
const { enrichVoiceMessage: enrichVoiceMessage2 } = await import("../../inbound-IBKXBFZF.js");
|
|
98
99
|
const boltApp = new bolt.App({
|
|
99
100
|
token: this.config.botToken,
|
|
100
101
|
appToken: this.config.appToken,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__require
|
|
10
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import "./chunk-3RG5ZIWI.js";
|
|
2
3
|
|
|
3
4
|
// src/cli.ts
|
|
4
5
|
import * as readline from "readline";
|
|
@@ -178,7 +179,7 @@ async function authGoogle(args) {
|
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
181
|
};
|
|
181
|
-
const { GoogleGmailConnector } = await import("./gmail-connector-
|
|
182
|
+
const { GoogleGmailConnector } = await import("./gmail-connector-Z7SO6VOS.js");
|
|
182
183
|
const connector = new GoogleGmailConnector({ tokenLoader, tokenSaver });
|
|
183
184
|
connector.config = {
|
|
184
185
|
account,
|
package/dist/index.d.ts
CHANGED
|
@@ -1835,6 +1835,8 @@ type ToolHandler = (input: Record<string, unknown>, context: {
|
|
|
1835
1835
|
taskId: string;
|
|
1836
1836
|
agentId: string;
|
|
1837
1837
|
hooks: HookBus;
|
|
1838
|
+
/** Resolve a relative file path to an absolute path (environment-aware). */
|
|
1839
|
+
resolveFilePath?: (path: string) => string;
|
|
1838
1840
|
}) => Promise<string>;
|
|
1839
1841
|
interface ExecutionEngineConfig {
|
|
1840
1842
|
/** Anthropic client instance */
|
|
@@ -1869,6 +1871,8 @@ interface ExecutionEngineConfig {
|
|
|
1869
1871
|
systemPromptSuffix?: string;
|
|
1870
1872
|
/** Include system context (users, files, etc). Default: true */
|
|
1871
1873
|
includeSystemContext?: boolean;
|
|
1874
|
+
/** Resolve file paths from DB-relative to absolute (for cross-environment support). */
|
|
1875
|
+
resolveFilePath?: (path: string) => string;
|
|
1872
1876
|
}
|
|
1873
1877
|
declare function registerExecutionEngine(opts: {
|
|
1874
1878
|
db: DataStore;
|
|
@@ -1877,6 +1881,16 @@ declare function registerExecutionEngine(opts: {
|
|
|
1877
1881
|
config: ExecutionEngineConfig;
|
|
1878
1882
|
}): Promise<void>;
|
|
1879
1883
|
|
|
1884
|
+
declare const sendFileTool: {
|
|
1885
|
+
definition: ToolDefinition;
|
|
1886
|
+
handler: ToolHandler;
|
|
1887
|
+
};
|
|
1888
|
+
|
|
1889
|
+
declare const readFileTool: {
|
|
1890
|
+
definition: ToolDefinition;
|
|
1891
|
+
handler: ToolHandler;
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1880
1894
|
interface SecretInput {
|
|
1881
1895
|
name: string;
|
|
1882
1896
|
type?: string;
|
|
@@ -1965,4 +1979,4 @@ declare function isLoginRequired(stdout: string): boolean;
|
|
|
1965
1979
|
/** Rewrite local image paths to prevent CLI auto-embedding as vision content. */
|
|
1966
1980
|
declare function deactivateLocalImagePaths(prompt: string): string;
|
|
1967
1981
|
|
|
1968
|
-
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, 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 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 RunContext, RunManager, type RunResult, type RunStatus, 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 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, areDependenciesMet, autoUpdate, buildAgentBindings, buildChainOrigin, buildProcessEnv, buildSystemContext, checkAllowlist, checkChainDepth, checkMentionGate, chunkText, classifyUpdate, compareVersions, createConfigRevision, createDefaultLLMCall, deactivateLocalImagePaths, defineCoreEntityContexts, defineCoreTables, defineDomainEntityContexts, defineDomainTables, detectCycle, discoverChannels, discoverProviders, formatText, getConfig, initConfig, interpolate, interpolateEnv, isLoginRequired, isMaxTurns, loadConfig, parseClaudeStream, parseVersion, registerExecutionEngine, runPackageMigrations, sanitize, topologicalSort, truncateAtWord, validateConfig };
|
|
1982
|
+
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, 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 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 RunContext, RunManager, type RunResult, type RunStatus, 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 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, areDependenciesMet, autoUpdate, buildAgentBindings, buildChainOrigin, buildProcessEnv, buildSystemContext, checkAllowlist, checkChainDepth, checkMentionGate, chunkText, classifyUpdate, compareVersions, createConfigRevision, createDefaultLLMCall, deactivateLocalImagePaths, defineCoreEntityContexts, defineCoreTables, defineDomainEntityContexts, defineDomainTables, detectCycle, discoverChannels, discoverProviders, formatText, getConfig, initConfig, interpolate, interpolateEnv, isLoginRequired, isMaxTurns, loadConfig, parseClaudeStream, parseVersion, readFileTool, registerExecutionEngine, runPackageMigrations, sanitize, sendFileTool, topologicalSort, truncateAtWord, validateConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chunkText
|
|
3
3
|
} from "./chunk-ZTZFPTOQ.js";
|
|
4
|
+
import {
|
|
5
|
+
__require
|
|
6
|
+
} from "./chunk-3RG5ZIWI.js";
|
|
4
7
|
|
|
5
8
|
// src/shared/constants.ts
|
|
6
9
|
var EVENTS = {
|
|
@@ -6123,7 +6126,7 @@ ${systemContext}` : "",
|
|
|
6123
6126
|
try {
|
|
6124
6127
|
const result = await handler(
|
|
6125
6128
|
toolUse.input,
|
|
6126
|
-
{ taskId, agentId: assigneeId, hooks }
|
|
6129
|
+
{ taskId, agentId: assigneeId, hooks, resolveFilePath: config.resolveFilePath }
|
|
6127
6130
|
);
|
|
6128
6131
|
toolResults.push({ type: "tool_result", tool_use_id: toolUse.id, content: result });
|
|
6129
6132
|
} catch (err) {
|
|
@@ -6152,6 +6155,102 @@ ${systemContext}` : "",
|
|
|
6152
6155
|
});
|
|
6153
6156
|
}
|
|
6154
6157
|
|
|
6158
|
+
// src/core/orchestrator/tools/send-file.ts
|
|
6159
|
+
import { existsSync as existsSync3 } from "fs";
|
|
6160
|
+
import { basename } from "path";
|
|
6161
|
+
var sendFileTool = {
|
|
6162
|
+
definition: {
|
|
6163
|
+
name: "send_file",
|
|
6164
|
+
description: "Send/deliver/attach a file to the user on Slack. Use this when the user asks for a document, contract, report, or any file. The file_path is in the Files section of your system context.",
|
|
6165
|
+
input_schema: {
|
|
6166
|
+
type: "object",
|
|
6167
|
+
properties: {
|
|
6168
|
+
file_path: { type: "string", description: "Path to the file (from system context)" }
|
|
6169
|
+
},
|
|
6170
|
+
required: ["file_path"]
|
|
6171
|
+
}
|
|
6172
|
+
},
|
|
6173
|
+
handler: async (input, context) => {
|
|
6174
|
+
const rawPath = input.file_path;
|
|
6175
|
+
const filePath = context.resolveFilePath?.(rawPath) ?? rawPath;
|
|
6176
|
+
if (!existsSync3(filePath)) return `Error: file not found at ${filePath}`;
|
|
6177
|
+
await context.hooks.emit("file.deliver", {
|
|
6178
|
+
filePath,
|
|
6179
|
+
fileName: basename(filePath),
|
|
6180
|
+
taskId: context.taskId
|
|
6181
|
+
});
|
|
6182
|
+
return `File "${basename(filePath)}" sent to user.`;
|
|
6183
|
+
}
|
|
6184
|
+
};
|
|
6185
|
+
|
|
6186
|
+
// src/core/orchestrator/tools/read-file.ts
|
|
6187
|
+
import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
|
|
6188
|
+
var readFileTool = {
|
|
6189
|
+
definition: {
|
|
6190
|
+
name: "read_file",
|
|
6191
|
+
description: "Read/review the contents of a file. Use this when the user asks about what a document contains, wants you to review a contract, check terms, summarize a report, etc. Supports .docx (Word), .txt, .md, .json, .csv. The file_path is in the Files section of your system context.",
|
|
6192
|
+
input_schema: {
|
|
6193
|
+
type: "object",
|
|
6194
|
+
properties: {
|
|
6195
|
+
file_path: { type: "string", description: "Path to the file (from system context)" }
|
|
6196
|
+
},
|
|
6197
|
+
required: ["file_path"]
|
|
6198
|
+
}
|
|
6199
|
+
},
|
|
6200
|
+
handler: async (input, context) => {
|
|
6201
|
+
const rawPath = input.file_path;
|
|
6202
|
+
const filePath = context.resolveFilePath?.(rawPath) ?? rawPath;
|
|
6203
|
+
if (!existsSync4(filePath)) return `Error: file not found at ${filePath}`;
|
|
6204
|
+
try {
|
|
6205
|
+
if (filePath.endsWith(".docx")) {
|
|
6206
|
+
return extractDocxText(filePath);
|
|
6207
|
+
}
|
|
6208
|
+
return readFileSync6(filePath, "utf8").slice(0, 8e3);
|
|
6209
|
+
} catch (err) {
|
|
6210
|
+
return `Error reading file: ${err instanceof Error ? err.message : String(err)}`;
|
|
6211
|
+
}
|
|
6212
|
+
}
|
|
6213
|
+
};
|
|
6214
|
+
function extractDocxText(filePath) {
|
|
6215
|
+
const data = readFileSync6(filePath);
|
|
6216
|
+
try {
|
|
6217
|
+
const zip = parseZipEntries(data);
|
|
6218
|
+
const docEntry = zip.find((e) => e.name === "word/document.xml");
|
|
6219
|
+
if (!docEntry) return "Error: could not find document.xml in docx";
|
|
6220
|
+
const xml = docEntry.data.toString("utf8");
|
|
6221
|
+
return xml.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim().slice(0, 8e3);
|
|
6222
|
+
} catch {
|
|
6223
|
+
return "Error: could not parse docx file";
|
|
6224
|
+
}
|
|
6225
|
+
}
|
|
6226
|
+
function parseZipEntries(buf) {
|
|
6227
|
+
const entries = [];
|
|
6228
|
+
let offset = 0;
|
|
6229
|
+
while (offset < buf.length - 4) {
|
|
6230
|
+
if (buf[offset] !== 80 || buf[offset + 1] !== 75 || buf[offset + 2] !== 3 || buf[offset + 3] !== 4) {
|
|
6231
|
+
break;
|
|
6232
|
+
}
|
|
6233
|
+
const compressionMethod = buf.readUInt16LE(offset + 8);
|
|
6234
|
+
const compressedSize = buf.readUInt32LE(offset + 18);
|
|
6235
|
+
const nameLen = buf.readUInt16LE(offset + 26);
|
|
6236
|
+
const extraLen = buf.readUInt16LE(offset + 28);
|
|
6237
|
+
const name = buf.slice(offset + 30, offset + 30 + nameLen).toString("utf8");
|
|
6238
|
+
const dataStart = offset + 30 + nameLen + extraLen;
|
|
6239
|
+
if (compressionMethod === 0) {
|
|
6240
|
+
entries.push({ name, data: buf.slice(dataStart, dataStart + compressedSize) });
|
|
6241
|
+
} else if (compressionMethod === 8) {
|
|
6242
|
+
try {
|
|
6243
|
+
const { inflateRawSync } = __require("zlib");
|
|
6244
|
+
const inflated = inflateRawSync(buf.slice(dataStart, dataStart + compressedSize));
|
|
6245
|
+
entries.push({ name, data: inflated });
|
|
6246
|
+
} catch {
|
|
6247
|
+
}
|
|
6248
|
+
}
|
|
6249
|
+
offset = dataStart + compressedSize;
|
|
6250
|
+
}
|
|
6251
|
+
return entries;
|
|
6252
|
+
}
|
|
6253
|
+
|
|
6155
6254
|
// src/core/orchestrator/user-registry.ts
|
|
6156
6255
|
import { v4 as uuidv4 } from "uuid";
|
|
6157
6256
|
var UserRegistry = class {
|
|
@@ -6565,9 +6664,11 @@ export {
|
|
|
6565
6664
|
loadConfig,
|
|
6566
6665
|
parseClaudeStream,
|
|
6567
6666
|
parseVersion,
|
|
6667
|
+
readFileTool,
|
|
6568
6668
|
registerExecutionEngine,
|
|
6569
6669
|
runPackageMigrations,
|
|
6570
6670
|
sanitize,
|
|
6671
|
+
sendFileTool,
|
|
6571
6672
|
topologicalSort,
|
|
6572
6673
|
truncateAtWord,
|
|
6573
6674
|
validateConfig
|