botinabox 2.4.2 → 2.5.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.
Files changed (277) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +190 -190
  3. package/bin/botinabox.mjs +2 -2
  4. package/dist/channels/slack/index.d.ts +1 -1
  5. package/dist/{chat-pipeline-BWrtVqEP.d.ts → chat-pipeline-DuNX5WoL.d.ts} +3 -0
  6. package/dist/cli.js +0 -0
  7. package/dist/index.d.ts +11 -2
  8. package/dist/index.js +64 -27
  9. package/package.json +100 -99
  10. package/dist/channels/discord/adapter.d.ts +0 -32
  11. package/dist/channels/discord/adapter.js +0 -70
  12. package/dist/channels/discord/inbound.d.ts +0 -25
  13. package/dist/channels/discord/inbound.js +0 -24
  14. package/dist/channels/discord/models.d.ts +0 -8
  15. package/dist/channels/discord/models.js +0 -5
  16. package/dist/channels/discord/outbound.d.ts +0 -14
  17. package/dist/channels/discord/outbound.js +0 -38
  18. package/dist/channels/slack/adapter.d.ts +0 -33
  19. package/dist/channels/slack/adapter.js +0 -74
  20. package/dist/channels/slack/inbound.d.ts +0 -59
  21. package/dist/channels/slack/inbound.js +0 -96
  22. package/dist/channels/slack/models.d.ts +0 -9
  23. package/dist/channels/slack/models.js +0 -5
  24. package/dist/channels/slack/outbound.d.ts +0 -12
  25. package/dist/channels/slack/outbound.js +0 -18
  26. package/dist/channels/slack/transcribe.d.ts +0 -41
  27. package/dist/channels/slack/transcribe.js +0 -106
  28. package/dist/channels/webhook/adapter.d.ts +0 -23
  29. package/dist/channels/webhook/adapter.js +0 -86
  30. package/dist/channels/webhook/hmac.d.ts +0 -13
  31. package/dist/channels/webhook/hmac.js +0 -26
  32. package/dist/channels/webhook/models.d.ts +0 -9
  33. package/dist/channels/webhook/models.js +0 -5
  34. package/dist/channels/webhook/server.d.ts +0 -20
  35. package/dist/channels/webhook/server.js +0 -91
  36. package/dist/chat-pipeline-C-XlLGNl.d.ts +0 -648
  37. package/dist/chat-pipeline-CR1KF6eX.d.ts +0 -652
  38. package/dist/chat-pipeline-DisuC8SB.d.ts +0 -643
  39. package/dist/chunk-2LGXQPEA.js +0 -41
  40. package/dist/chunk-3X3YKI4T.js +0 -357
  41. package/dist/chunk-D47AIFOD.js +0 -351
  42. package/dist/chunk-DSNJKNEW.js +0 -328
  43. package/dist/chunk-GS2JFL6I.js +0 -144
  44. package/dist/chunk-J6S6QMUY.js +0 -144
  45. package/dist/chunk-QLA6YOFN.js +0 -22
  46. package/dist/chunk-UACT2WXX.js +0 -381
  47. package/dist/cli/templates/config.yml.d.ts +0 -7
  48. package/dist/cli/templates/config.yml.js +0 -61
  49. package/dist/cli/templates/env.d.ts +0 -1
  50. package/dist/cli/templates/env.js +0 -30
  51. package/dist/cli/templates/index.ts.d.ts +0 -2
  52. package/dist/cli/templates/index.ts.js +0 -30
  53. package/dist/cli/templates/package.json.d.ts +0 -5
  54. package/dist/cli/templates/package.json.js +0 -28
  55. package/dist/connector-DDahQw-2.d.ts +0 -63
  56. package/dist/connectors/google/calendar-connector.d.ts +0 -40
  57. package/dist/connectors/google/calendar-connector.js +0 -243
  58. package/dist/connectors/google/gmail-connector.d.ts +0 -42
  59. package/dist/connectors/google/gmail-connector.js +0 -345
  60. package/dist/connectors/google/oauth.d.ts +0 -48
  61. package/dist/connectors/google/oauth.js +0 -112
  62. package/dist/connectors/google/types.d.ts +0 -78
  63. package/dist/connectors/google/types.js +0 -2
  64. package/dist/core/chat/auto-discovery.d.ts +0 -16
  65. package/dist/core/chat/auto-discovery.js +0 -54
  66. package/dist/core/chat/channel-registry.d.ts +0 -45
  67. package/dist/core/chat/channel-registry.js +0 -96
  68. package/dist/core/chat/chat-pipeline.d.ts +0 -113
  69. package/dist/core/chat/chat-pipeline.js +0 -395
  70. package/dist/core/chat/chat-responder.d.ts +0 -90
  71. package/dist/core/chat/chat-responder.js +0 -185
  72. package/dist/core/chat/formatter.d.ts +0 -11
  73. package/dist/core/chat/formatter.js +0 -60
  74. package/dist/core/chat/index.d.ts +0 -24
  75. package/dist/core/chat/index.js +0 -18
  76. package/dist/core/chat/message-interpreter.d.ts +0 -91
  77. package/dist/core/chat/message-interpreter.js +0 -166
  78. package/dist/core/chat/message-store.d.ts +0 -66
  79. package/dist/core/chat/message-store.js +0 -131
  80. package/dist/core/chat/notification-queue.d.ts +0 -34
  81. package/dist/core/chat/notification-queue.js +0 -111
  82. package/dist/core/chat/pipeline.d.ts +0 -38
  83. package/dist/core/chat/pipeline.js +0 -89
  84. package/dist/core/chat/policies.d.ts +0 -16
  85. package/dist/core/chat/policies.js +0 -25
  86. package/dist/core/chat/routing.d.ts +0 -17
  87. package/dist/core/chat/routing.js +0 -36
  88. package/dist/core/chat/session-key.d.ts +0 -30
  89. package/dist/core/chat/session-key.js +0 -65
  90. package/dist/core/chat/session-manager.d.ts +0 -17
  91. package/dist/core/chat/session-manager.js +0 -23
  92. package/dist/core/chat/text-chunker.d.ts +0 -9
  93. package/dist/core/chat/text-chunker.js +0 -48
  94. package/dist/core/chat/triage-router.d.ts +0 -75
  95. package/dist/core/chat/triage-router.js +0 -142
  96. package/dist/core/chat/types.d.ts +0 -5
  97. package/dist/core/chat/types.js +0 -5
  98. package/dist/core/config/defaults.d.ts +0 -2
  99. package/dist/core/config/defaults.js +0 -38
  100. package/dist/core/config/index.d.ts +0 -6
  101. package/dist/core/config/index.js +0 -4
  102. package/dist/core/config/interpolate.d.ts +0 -5
  103. package/dist/core/config/interpolate.js +0 -27
  104. package/dist/core/config/loader.d.ts +0 -24
  105. package/dist/core/config/loader.js +0 -59
  106. package/dist/core/config/schema.d.ts +0 -5
  107. package/dist/core/config/schema.js +0 -119
  108. package/dist/core/data/core-entity-contexts.d.ts +0 -14
  109. package/dist/core/data/core-entity-contexts.js +0 -197
  110. package/dist/core/data/core-migrations.d.ts +0 -5
  111. package/dist/core/data/core-migrations.js +0 -45
  112. package/dist/core/data/core-schema.d.ts +0 -6
  113. package/dist/core/data/core-schema.js +0 -454
  114. package/dist/core/data/data-store.d.ts +0 -67
  115. package/dist/core/data/data-store.js +0 -218
  116. package/dist/core/data/domain-entity-contexts.d.ts +0 -29
  117. package/dist/core/data/domain-entity-contexts.js +0 -321
  118. package/dist/core/data/domain-schema.d.ts +0 -36
  119. package/dist/core/data/domain-schema.js +0 -323
  120. package/dist/core/data/index.d.ts +0 -7
  121. package/dist/core/data/index.js +0 -7
  122. package/dist/core/data/types.d.ts +0 -111
  123. package/dist/core/data/types.js +0 -1
  124. package/dist/core/hooks/hook-bus.d.ts +0 -18
  125. package/dist/core/hooks/hook-bus.js +0 -120
  126. package/dist/core/hooks/index.d.ts +0 -2
  127. package/dist/core/hooks/index.js +0 -1
  128. package/dist/core/hooks/types.d.ts +0 -19
  129. package/dist/core/hooks/types.js +0 -1
  130. package/dist/core/index.d.ts +0 -4
  131. package/dist/core/index.js +0 -4
  132. package/dist/core/llm/auto-discovery.d.ts +0 -11
  133. package/dist/core/llm/auto-discovery.js +0 -49
  134. package/dist/core/llm/cost-tracker.d.ts +0 -6
  135. package/dist/core/llm/cost-tracker.js +0 -38
  136. package/dist/core/llm/index.d.ts +0 -4
  137. package/dist/core/llm/index.js +0 -3
  138. package/dist/core/llm/model-router.d.ts +0 -25
  139. package/dist/core/llm/model-router.js +0 -49
  140. package/dist/core/llm/provider-registry.d.ts +0 -9
  141. package/dist/core/llm/provider-registry.js +0 -25
  142. package/dist/core/llm/types.d.ts +0 -2
  143. package/dist/core/llm/types.js +0 -2
  144. package/dist/core/orchestrator/adapters/api-adapter.d.ts +0 -34
  145. package/dist/core/orchestrator/adapters/api-adapter.js +0 -88
  146. package/dist/core/orchestrator/adapters/cli-adapter.d.ts +0 -22
  147. package/dist/core/orchestrator/adapters/cli-adapter.js +0 -69
  148. package/dist/core/orchestrator/adapters/deterministic-adapter.d.ts +0 -35
  149. package/dist/core/orchestrator/adapters/deterministic-adapter.js +0 -75
  150. package/dist/core/orchestrator/adapters/env-whitelist.d.ts +0 -4
  151. package/dist/core/orchestrator/adapters/env-whitelist.js +0 -27
  152. package/dist/core/orchestrator/adapters/output-extractor.d.ts +0 -11
  153. package/dist/core/orchestrator/adapters/output-extractor.js +0 -59
  154. package/dist/core/orchestrator/adapters/process-manager.d.ts +0 -15
  155. package/dist/core/orchestrator/adapters/process-manager.js +0 -26
  156. package/dist/core/orchestrator/adapters/tool-loop.d.ts +0 -22
  157. package/dist/core/orchestrator/adapters/tool-loop.js +0 -66
  158. package/dist/core/orchestrator/agent-registry.d.ts +0 -31
  159. package/dist/core/orchestrator/agent-registry.js +0 -135
  160. package/dist/core/orchestrator/budget-controller.d.ts +0 -19
  161. package/dist/core/orchestrator/budget-controller.js +0 -73
  162. package/dist/core/orchestrator/chain-guard.d.ts +0 -14
  163. package/dist/core/orchestrator/chain-guard.js +0 -23
  164. package/dist/core/orchestrator/circuit-breaker.d.ts +0 -65
  165. package/dist/core/orchestrator/circuit-breaker.js +0 -159
  166. package/dist/core/orchestrator/claude-stream-parser.d.ts +0 -31
  167. package/dist/core/orchestrator/claude-stream-parser.js +0 -99
  168. package/dist/core/orchestrator/config-revisions.d.ts +0 -6
  169. package/dist/core/orchestrator/config-revisions.js +0 -17
  170. package/dist/core/orchestrator/dependency-resolver.d.ts +0 -20
  171. package/dist/core/orchestrator/dependency-resolver.js +0 -78
  172. package/dist/core/orchestrator/governance-gate.d.ts +0 -110
  173. package/dist/core/orchestrator/governance-gate.js +0 -170
  174. package/dist/core/orchestrator/learning-pipeline.d.ts +0 -109
  175. package/dist/core/orchestrator/learning-pipeline.js +0 -249
  176. package/dist/core/orchestrator/loop-detector.d.ts +0 -51
  177. package/dist/core/orchestrator/loop-detector.js +0 -133
  178. package/dist/core/orchestrator/ndjson-logger.d.ts +0 -6
  179. package/dist/core/orchestrator/ndjson-logger.js +0 -18
  180. package/dist/core/orchestrator/permission-relay.d.ts +0 -72
  181. package/dist/core/orchestrator/permission-relay.js +0 -164
  182. package/dist/core/orchestrator/run-manager.d.ts +0 -31
  183. package/dist/core/orchestrator/run-manager.js +0 -178
  184. package/dist/core/orchestrator/scheduler.d.ts +0 -70
  185. package/dist/core/orchestrator/scheduler.js +0 -198
  186. package/dist/core/orchestrator/secret-store.d.ts +0 -57
  187. package/dist/core/orchestrator/secret-store.js +0 -171
  188. package/dist/core/orchestrator/session-manager.d.ts +0 -13
  189. package/dist/core/orchestrator/session-manager.js +0 -66
  190. package/dist/core/orchestrator/task-queue.d.ts +0 -34
  191. package/dist/core/orchestrator/task-queue.js +0 -83
  192. package/dist/core/orchestrator/template-interpolate.d.ts +0 -5
  193. package/dist/core/orchestrator/template-interpolate.js +0 -18
  194. package/dist/core/orchestrator/user-registry.d.ts +0 -47
  195. package/dist/core/orchestrator/user-registry.js +0 -76
  196. package/dist/core/orchestrator/wakeup-queue.d.ts +0 -9
  197. package/dist/core/orchestrator/wakeup-queue.js +0 -45
  198. package/dist/core/orchestrator/workflow-engine.d.ts +0 -47
  199. package/dist/core/orchestrator/workflow-engine.js +0 -204
  200. package/dist/core/security/audit.d.ts +0 -20
  201. package/dist/core/security/audit.js +0 -33
  202. package/dist/core/security/column-validator.d.ts +0 -20
  203. package/dist/core/security/column-validator.js +0 -37
  204. package/dist/core/security/index.d.ts +0 -5
  205. package/dist/core/security/index.js +0 -5
  206. package/dist/core/security/process-env.d.ts +0 -13
  207. package/dist/core/security/process-env.js +0 -49
  208. package/dist/core/security/sanitizer.d.ts +0 -11
  209. package/dist/core/security/sanitizer.js +0 -39
  210. package/dist/core/security/types.d.ts +0 -11
  211. package/dist/core/security/types.js +0 -1
  212. package/dist/core/update/auto-update.d.ts +0 -21
  213. package/dist/core/update/auto-update.js +0 -102
  214. package/dist/core/update/backup-manager.d.ts +0 -7
  215. package/dist/core/update/backup-manager.js +0 -24
  216. package/dist/core/update/index.d.ts +0 -8
  217. package/dist/core/update/index.js +0 -6
  218. package/dist/core/update/migration-hooks.d.ts +0 -11
  219. package/dist/core/update/migration-hooks.js +0 -10
  220. package/dist/core/update/types.d.ts +0 -11
  221. package/dist/core/update/types.js +0 -1
  222. package/dist/core/update/update-checker.d.ts +0 -11
  223. package/dist/core/update/update-checker.js +0 -63
  224. package/dist/core/update/update-manager.d.ts +0 -25
  225. package/dist/core/update/update-manager.js +0 -101
  226. package/dist/core/update/version-utils.d.ts +0 -6
  227. package/dist/core/update/version-utils.js +0 -34
  228. package/dist/gmail-connector-2FVYTQJH.js +0 -6
  229. package/dist/gmail-connector-MNUBRNFM.js +0 -6
  230. package/dist/gmail-connector-PS2VLGNE.js +0 -6
  231. package/dist/gmail-connector-ULSMN6X2.js +0 -6
  232. package/dist/gmail-connector-URRFX6A3.js +0 -6
  233. package/dist/inbound-AFBUPSPG.js +0 -10
  234. package/dist/inbound-AFOHYNUY.js +0 -6
  235. package/dist/inbound-CGIXRXGC.js +0 -8
  236. package/dist/inbound-MCOLRH6U.js +0 -10
  237. package/dist/inbound-SNEMBLGA.js +0 -6
  238. package/dist/inbound-ZJHAYVMF.js +0 -10
  239. package/dist/provider-qqJYv9nv.d.ts +0 -75
  240. package/dist/providers/anthropic/models.d.ts +0 -2
  241. package/dist/providers/anthropic/models.js +0 -29
  242. package/dist/providers/anthropic/provider.d.ts +0 -13
  243. package/dist/providers/anthropic/provider.js +0 -119
  244. package/dist/providers/anthropic/tool-converter.d.ts +0 -10
  245. package/dist/providers/anthropic/tool-converter.js +0 -7
  246. package/dist/providers/ollama/provider.d.ts +0 -17
  247. package/dist/providers/ollama/provider.js +0 -185
  248. package/dist/providers/openai/models.d.ts +0 -2
  249. package/dist/providers/openai/models.js +0 -29
  250. package/dist/providers/openai/provider.d.ts +0 -13
  251. package/dist/providers/openai/provider.js +0 -163
  252. package/dist/providers/openai/tool-converter.d.ts +0 -10
  253. package/dist/providers/openai/tool-converter.js +0 -10
  254. package/dist/shared/constants.d.ts +0 -50
  255. package/dist/shared/constants.js +0 -64
  256. package/dist/shared/index.d.ts +0 -14
  257. package/dist/shared/index.js +0 -14
  258. package/dist/shared/types/agent.d.ts +0 -36
  259. package/dist/shared/types/agent.js +0 -2
  260. package/dist/shared/types/channel.d.ts +0 -70
  261. package/dist/shared/types/channel.js +0 -2
  262. package/dist/shared/types/config.d.ts +0 -111
  263. package/dist/shared/types/config.js +0 -2
  264. package/dist/shared/types/connector.d.ts +0 -77
  265. package/dist/shared/types/connector.js +0 -2
  266. package/dist/shared/types/execution.d.ts +0 -29
  267. package/dist/shared/types/execution.js +0 -2
  268. package/dist/shared/types/provider.d.ts +0 -73
  269. package/dist/shared/types/provider.js +0 -2
  270. package/dist/shared/types/task.d.ts +0 -47
  271. package/dist/shared/types/task.js +0 -2
  272. package/dist/shared/types/workflow.d.ts +0 -39
  273. package/dist/shared/types/workflow.js +0 -2
  274. package/dist/shared/utils.d.ts +0 -6
  275. package/dist/shared/utils.js +0 -13
  276. package/dist/update-check.d.ts +0 -5
  277. package/dist/update-check.js +0 -56
@@ -1,11 +0,0 @@
1
- export interface PackageUpdate {
2
- name: string;
3
- installedVersion: string;
4
- latestVersion: string;
5
- updateType: 'patch' | 'minor' | 'major';
6
- }
7
- export interface UpdateManifest {
8
- checkedAt: string;
9
- packages: PackageUpdate[];
10
- hasUpdates: boolean;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import type { UpdateManifest } from './types.js';
2
- export declare class UpdateChecker {
3
- private nodeModulesPath;
4
- private opts?;
5
- private readonly fetchFn;
6
- constructor(nodeModulesPath: string, opts?: {
7
- fetch?: typeof globalThis.fetch;
8
- } | undefined);
9
- getInstalledPackages(): string[];
10
- check(packageNames?: string[]): Promise<UpdateManifest>;
11
- }
@@ -1,63 +0,0 @@
1
- import { readFileSync, readdirSync } from 'fs';
2
- import { join } from 'path';
3
- import { classifyUpdate, compareVersions } from './version-utils.js';
4
- export class UpdateChecker {
5
- nodeModulesPath;
6
- opts;
7
- fetchFn;
8
- constructor(nodeModulesPath, opts) {
9
- this.nodeModulesPath = nodeModulesPath;
10
- this.opts = opts;
11
- this.fetchFn = opts?.fetch ?? globalThis.fetch;
12
- }
13
- getInstalledPackages() {
14
- try {
15
- const botinaboxPath = join(this.nodeModulesPath, '@botinabox');
16
- const entries = readdirSync(botinaboxPath, { withFileTypes: true });
17
- return entries
18
- .filter((e) => e.isDirectory())
19
- .map((e) => e.name);
20
- }
21
- catch {
22
- return [];
23
- }
24
- }
25
- async check(packageNames) {
26
- const installed = packageNames ?? this.getInstalledPackages();
27
- const updates = [];
28
- for (const pkg of installed) {
29
- try {
30
- const pkgJsonPath = join(this.nodeModulesPath, '@botinabox', pkg, 'package.json');
31
- const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));
32
- const installedVersion = pkgJson.version ?? '0.0.0';
33
- const response = await this.fetchFn(`https://registry.npmjs.org/@botinabox/${pkg}`);
34
- if (!response.ok)
35
- continue;
36
- const data = await response.json();
37
- const latestVersion = data['dist-tags']?.['latest'];
38
- if (!latestVersion)
39
- continue;
40
- if (compareVersions(latestVersion, installedVersion) > 0) {
41
- const updateType = classifyUpdate(installedVersion, latestVersion);
42
- if (updateType !== 'none') {
43
- updates.push({
44
- name: `@botinabox/${pkg}`,
45
- installedVersion,
46
- latestVersion,
47
- updateType,
48
- });
49
- }
50
- }
51
- }
52
- catch {
53
- // Gracefully skip on error
54
- continue;
55
- }
56
- }
57
- return {
58
- checkedAt: new Date().toISOString(),
59
- packages: updates,
60
- hasUpdates: updates.length > 0,
61
- };
62
- }
63
- }
@@ -1,25 +0,0 @@
1
- import type { DataStore } from '../data/data-store.js';
2
- import type { HookBus } from '../hooks/hook-bus.js';
3
- import type { PackageUpdate, UpdateManifest } from './types.js';
4
- import { UpdateChecker } from './update-checker.js';
5
- type UpdatePolicy = 'auto-all' | 'auto-compatible' | 'auto-patch' | 'notify' | 'manual';
6
- export declare class UpdateManager {
7
- private checker;
8
- private db;
9
- private hooks;
10
- private opts?;
11
- private backupManager;
12
- constructor(checker: UpdateChecker, db: DataStore, hooks: HookBus, opts?: {
13
- projectRoot?: string;
14
- policy?: UpdatePolicy;
15
- maintenanceWindow?: {
16
- utcHourStart: number;
17
- utcHourEnd: number;
18
- };
19
- } | undefined);
20
- checkAndNotify(): Promise<UpdateManifest>;
21
- applyUpdates(updates: PackageUpdate[]): Promise<void>;
22
- isInMaintenanceWindow(): boolean;
23
- filterByPolicy(updates: PackageUpdate[]): PackageUpdate[];
24
- }
25
- export {};
@@ -1,101 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { BackupManager } from './backup-manager.js';
3
- export class UpdateManager {
4
- checker;
5
- db;
6
- hooks;
7
- opts;
8
- backupManager;
9
- constructor(checker, db, hooks, opts) {
10
- this.checker = checker;
11
- this.db = db;
12
- this.hooks = hooks;
13
- this.opts = opts;
14
- this.backupManager = new BackupManager(opts?.projectRoot ?? process.cwd());
15
- }
16
- async checkAndNotify() {
17
- const manifest = await this.checker.check();
18
- if (manifest.hasUpdates) {
19
- await this.hooks.emit('update.available', { manifest });
20
- }
21
- return manifest;
22
- }
23
- async applyUpdates(updates) {
24
- const filtered = this.filterByPolicy(updates);
25
- if (filtered.length === 0)
26
- return;
27
- if (!this.isInMaintenanceWindow()) {
28
- await this.hooks.emit('update.deferred', { reason: 'outside maintenance window' });
29
- return;
30
- }
31
- let backupPath;
32
- const historyIds = [];
33
- try {
34
- backupPath = await this.backupManager.backup();
35
- for (const update of filtered) {
36
- const row = await this.db.insert('update_history', {
37
- from_version: update.installedVersion,
38
- to_version: update.latestVersion,
39
- status: 'pending',
40
- });
41
- historyIds.push(row['id']);
42
- }
43
- execSync('pnpm install', {
44
- cwd: this.opts?.projectRoot ?? process.cwd(),
45
- stdio: 'ignore',
46
- });
47
- for (const id of historyIds) {
48
- await this.db.update('update_history', { id }, { status: 'succeeded' });
49
- }
50
- await this.backupManager.cleanup(backupPath);
51
- await this.hooks.emit('update.completed', { updates: filtered });
52
- }
53
- catch (err) {
54
- for (const id of historyIds) {
55
- await this.db.update('update_history', { id }, {
56
- status: 'failed',
57
- migration_log: String(err),
58
- });
59
- }
60
- if (backupPath) {
61
- try {
62
- await this.backupManager.restore(backupPath);
63
- await this.backupManager.cleanup(backupPath);
64
- }
65
- catch {
66
- // best effort restore
67
- }
68
- }
69
- await this.hooks.emit('update.failed', { updates: filtered, error: String(err) });
70
- }
71
- }
72
- isInMaintenanceWindow() {
73
- const window = this.opts?.maintenanceWindow;
74
- if (!window)
75
- return true; // No window configured = always allowed
76
- const nowHour = new Date().getUTCHours();
77
- const { utcHourStart, utcHourEnd } = window;
78
- if (utcHourStart <= utcHourEnd) {
79
- return nowHour >= utcHourStart && nowHour < utcHourEnd;
80
- }
81
- else {
82
- // Wraps midnight
83
- return nowHour >= utcHourStart || nowHour < utcHourEnd;
84
- }
85
- }
86
- filterByPolicy(updates) {
87
- const policy = this.opts?.policy ?? 'notify';
88
- switch (policy) {
89
- case 'auto-all':
90
- return updates;
91
- case 'auto-compatible':
92
- return updates.filter((u) => u.updateType !== 'major');
93
- case 'auto-patch':
94
- return updates.filter((u) => u.updateType === 'patch');
95
- case 'notify':
96
- case 'manual':
97
- default:
98
- return [];
99
- }
100
- }
101
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Simple semver utilities — no external deps.
3
- */
4
- export declare function parseVersion(v: string): [number, number, number];
5
- export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
6
- export declare function classifyUpdate(from: string, to: string): 'patch' | 'minor' | 'major' | 'none';
@@ -1,34 +0,0 @@
1
- /**
2
- * Simple semver utilities — no external deps.
3
- */
4
- export function parseVersion(v) {
5
- // Strip leading 'v' and any pre-release suffix
6
- const cleaned = v.replace(/^v/, '').split('-')[0] ?? v;
7
- const parts = cleaned.split('.');
8
- const major = parseInt(parts[0] ?? '0', 10) || 0;
9
- const minor = parseInt(parts[1] ?? '0', 10) || 0;
10
- const patch = parseInt(parts[2] ?? '0', 10) || 0;
11
- return [major, minor, patch];
12
- }
13
- export function compareVersions(a, b) {
14
- const [aMaj, aMin, aPat] = parseVersion(a);
15
- const [bMaj, bMin, bPat] = parseVersion(b);
16
- if (aMaj !== bMaj)
17
- return aMaj < bMaj ? -1 : 1;
18
- if (aMin !== bMin)
19
- return aMin < bMin ? -1 : 1;
20
- if (aPat !== bPat)
21
- return aPat < bPat ? -1 : 1;
22
- return 0;
23
- }
24
- export function classifyUpdate(from, to) {
25
- const [fMaj, fMin] = parseVersion(from);
26
- const [tMaj, tMin] = parseVersion(to);
27
- if (compareVersions(from, to) === 0)
28
- return 'none';
29
- if (tMaj !== fMaj)
30
- return 'major';
31
- if (tMin !== fMin)
32
- return 'minor';
33
- return 'patch';
34
- }
@@ -1,6 +0,0 @@
1
- import {
2
- GoogleGmailConnector
3
- } from "./chunk-DSNJKNEW.js";
4
- export {
5
- GoogleGmailConnector
6
- };
@@ -1,6 +0,0 @@
1
- import {
2
- GoogleGmailConnector
3
- } from "./chunk-3X3YKI4T.js";
4
- export {
5
- GoogleGmailConnector
6
- };
@@ -1,6 +0,0 @@
1
- import {
2
- GoogleGmailConnector
3
- } from "./chunk-UACT2WXX.js";
4
- export {
5
- GoogleGmailConnector
6
- };
@@ -1,6 +0,0 @@
1
- import {
2
- GoogleGmailConnector
3
- } from "./chunk-XYF5PSB2.js";
4
- export {
5
- GoogleGmailConnector
6
- };
@@ -1,6 +0,0 @@
1
- import {
2
- GoogleGmailConnector
3
- } from "./chunk-D47AIFOD.js";
4
- export {
5
- GoogleGmailConnector
6
- };
@@ -1,10 +0,0 @@
1
- import {
2
- enrichVoiceMessage,
3
- extractVoiceTranscript,
4
- parseSlackEvent
5
- } from "./chunk-GS2JFL6I.js";
6
- export {
7
- enrichVoiceMessage,
8
- extractVoiceTranscript,
9
- parseSlackEvent
10
- };
@@ -1,6 +0,0 @@
1
- import {
2
- parseSlackEvent
3
- } from "./chunk-QLA6YOFN.js";
4
- export {
5
- parseSlackEvent
6
- };
@@ -1,8 +0,0 @@
1
- import {
2
- extractVoiceTranscript,
3
- parseSlackEvent
4
- } from "./chunk-2LGXQPEA.js";
5
- export {
6
- extractVoiceTranscript,
7
- parseSlackEvent
8
- };
@@ -1,10 +0,0 @@
1
- import {
2
- enrichVoiceMessage,
3
- extractVoiceTranscript,
4
- parseSlackEvent
5
- } from "./chunk-J6S6QMUY.js";
6
- export {
7
- enrichVoiceMessage,
8
- extractVoiceTranscript,
9
- parseSlackEvent
10
- };
@@ -1,6 +0,0 @@
1
- import {
2
- parseDiscordEvent
3
- } from "./chunk-DLJKZD3Q.js";
4
- export {
5
- parseDiscordEvent
6
- };
@@ -1,10 +0,0 @@
1
- import {
2
- enrichVoiceMessage,
3
- extractVoiceTranscript,
4
- parseSlackEvent
5
- } from "./chunk-NNPCKR6G.js";
6
- export {
7
- enrichVoiceMessage,
8
- extractVoiceTranscript,
9
- parseSlackEvent
10
- };
@@ -1,75 +0,0 @@
1
- /** LLM provider types — Story 1.5 / 2.1 */
2
- interface ToolDefinition {
3
- name: string;
4
- description: string;
5
- parameters: Record<string, unknown>;
6
- }
7
- interface ChatMessage {
8
- role: "user" | "assistant" | "system";
9
- content: string | ContentBlock[];
10
- }
11
- type ContentBlock = {
12
- type: "text";
13
- text: string;
14
- } | {
15
- type: "tool_use";
16
- id: string;
17
- name: string;
18
- input: unknown;
19
- } | {
20
- type: "tool_result";
21
- tool_use_id: string;
22
- content: string;
23
- };
24
- interface ChatParams {
25
- messages: ChatMessage[];
26
- system?: string;
27
- tools?: ToolDefinition[];
28
- maxTokens?: number;
29
- temperature?: number;
30
- model: string;
31
- abortSignal?: AbortSignal;
32
- }
33
- interface TokenUsage {
34
- inputTokens: number;
35
- outputTokens: number;
36
- cacheReadTokens?: number;
37
- cacheWriteTokens?: number;
38
- }
39
- interface ChatResult {
40
- content: string;
41
- toolUses?: ToolUse[];
42
- usage: TokenUsage;
43
- model: string;
44
- stopReason: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
45
- }
46
- interface ToolUse {
47
- id: string;
48
- name: string;
49
- input: unknown;
50
- }
51
- interface ModelInfo {
52
- id: string;
53
- displayName: string;
54
- contextWindow: number;
55
- maxOutputTokens: number;
56
- capabilities: Array<"chat" | "tools" | "vision" | "streaming">;
57
- /** Cost in micro-cents per 1M tokens */
58
- inputCostPerMToken?: number;
59
- outputCostPerMToken?: number;
60
- }
61
- interface ResolvedModel {
62
- provider: string;
63
- model: string;
64
- }
65
- interface LLMProvider {
66
- id: string;
67
- displayName: string;
68
- models: ModelInfo[];
69
- chat(params: ChatParams): Promise<ChatResult>;
70
- chatStream(params: ChatParams): AsyncGenerator<string, ChatResult, unknown>;
71
- /** Convert ToolDefinition[] to provider-native format */
72
- serializeTools(tools: ToolDefinition[]): unknown;
73
- }
74
-
75
- 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, ToolDefinition as d, ToolUse as e };
@@ -1,2 +0,0 @@
1
- import type { ModelInfo } from "../../shared/index.js";
2
- export declare const MODELS: ModelInfo[];
@@ -1,29 +0,0 @@
1
- export const MODELS = [
2
- {
3
- id: 'claude-opus-4-6',
4
- displayName: 'Claude Opus 4.6',
5
- contextWindow: 200000,
6
- maxOutputTokens: 32000,
7
- inputCostPerMToken: 15,
8
- outputCostPerMToken: 75,
9
- capabilities: ['chat', 'tools', 'vision', 'streaming'],
10
- },
11
- {
12
- id: 'claude-sonnet-4-6',
13
- displayName: 'Claude Sonnet 4.6',
14
- contextWindow: 200000,
15
- maxOutputTokens: 16000,
16
- inputCostPerMToken: 3,
17
- outputCostPerMToken: 15,
18
- capabilities: ['chat', 'tools', 'vision', 'streaming'],
19
- },
20
- {
21
- id: 'claude-haiku-4-5',
22
- displayName: 'Claude Haiku 4.5',
23
- contextWindow: 200000,
24
- maxOutputTokens: 8192,
25
- inputCostPerMToken: 0.8,
26
- outputCostPerMToken: 4,
27
- capabilities: ['chat', 'tools', 'vision', 'streaming'],
28
- },
29
- ];
@@ -1,13 +0,0 @@
1
- import type { LLMProvider, ChatParams, ChatResult, ModelInfo, ToolDefinition } from "../../shared/index.js";
2
- export declare class AnthropicProvider implements LLMProvider {
3
- readonly id = "anthropic";
4
- readonly displayName = "Anthropic";
5
- readonly models: ModelInfo[];
6
- private client;
7
- constructor({ apiKey }: {
8
- apiKey: string;
9
- });
10
- serializeTools(tools: ToolDefinition[]): unknown;
11
- chat(params: ChatParams): Promise<ChatResult>;
12
- chatStream(params: ChatParams): AsyncGenerator<string, ChatResult, unknown>;
13
- }
@@ -1,119 +0,0 @@
1
- import Anthropic from '@anthropic-ai/sdk';
2
- import { MODELS } from './models.js';
3
- import { convertTools } from './tool-converter.js';
4
- export class AnthropicProvider {
5
- id = 'anthropic';
6
- displayName = 'Anthropic';
7
- models = MODELS;
8
- client;
9
- constructor({ apiKey }) {
10
- this.client = new Anthropic({ apiKey });
11
- }
12
- serializeTools(tools) {
13
- return convertTools(tools);
14
- }
15
- async chat(params) {
16
- const { messages, system, tools, maxTokens, temperature, model, abortSignal } = params;
17
- const anthropicMessages = messages
18
- .filter((m) => m.role !== 'system')
19
- .map((m) => ({
20
- role: m.role,
21
- content: typeof m.content === 'string' ? m.content : m.content,
22
- }));
23
- const response = await this.client.messages.create({
24
- model,
25
- max_tokens: maxTokens ?? 4096,
26
- messages: anthropicMessages,
27
- ...(system ? { system } : {}),
28
- ...(tools && tools.length > 0 ? { tools: convertTools(tools) } : {}),
29
- ...(temperature !== undefined ? { temperature } : {}),
30
- }, { signal: abortSignal });
31
- let content = '';
32
- const toolUses = [];
33
- for (const block of response.content) {
34
- if (block.type === 'text') {
35
- content += block.text;
36
- }
37
- else if (block.type === 'tool_use') {
38
- toolUses.push({
39
- id: block.id,
40
- name: block.name,
41
- input: block.input,
42
- });
43
- }
44
- }
45
- const stopReason = mapStopReason(response.stop_reason);
46
- return {
47
- content,
48
- toolUses: toolUses.length > 0 ? toolUses : undefined,
49
- usage: {
50
- inputTokens: response.usage.input_tokens,
51
- outputTokens: response.usage.output_tokens,
52
- },
53
- model: response.model,
54
- stopReason,
55
- };
56
- }
57
- async *chatStream(params) {
58
- const { messages, system, tools, maxTokens, temperature, model, abortSignal } = params;
59
- const anthropicMessages = messages
60
- .filter((m) => m.role !== 'system')
61
- .map((m) => ({
62
- role: m.role,
63
- content: typeof m.content === 'string' ? m.content : m.content,
64
- }));
65
- const stream = this.client.messages.stream({
66
- model,
67
- max_tokens: maxTokens ?? 4096,
68
- messages: anthropicMessages,
69
- ...(system ? { system } : {}),
70
- ...(tools && tools.length > 0 ? { tools: convertTools(tools) } : {}),
71
- ...(temperature !== undefined ? { temperature } : {}),
72
- }, { signal: abortSignal });
73
- for await (const event of stream) {
74
- if (event.type === 'content_block_delta' &&
75
- event.delta.type === 'text_delta') {
76
- yield event.delta.text;
77
- }
78
- }
79
- const finalMessage = await stream.finalMessage();
80
- let content = '';
81
- const toolUses = [];
82
- for (const block of finalMessage.content) {
83
- if (block.type === 'text') {
84
- content += block.text;
85
- }
86
- else if (block.type === 'tool_use') {
87
- toolUses.push({
88
- id: block.id,
89
- name: block.name,
90
- input: block.input,
91
- });
92
- }
93
- }
94
- return {
95
- content,
96
- toolUses: toolUses.length > 0 ? toolUses : undefined,
97
- usage: {
98
- inputTokens: finalMessage.usage.input_tokens,
99
- outputTokens: finalMessage.usage.output_tokens,
100
- },
101
- model: finalMessage.model,
102
- stopReason: mapStopReason(finalMessage.stop_reason),
103
- };
104
- }
105
- }
106
- function mapStopReason(reason) {
107
- switch (reason) {
108
- case 'end_turn':
109
- return 'end_turn';
110
- case 'tool_use':
111
- return 'tool_use';
112
- case 'max_tokens':
113
- return 'max_tokens';
114
- case 'stop_sequence':
115
- return 'stop_sequence';
116
- default:
117
- return 'end_turn';
118
- }
119
- }
@@ -1,10 +0,0 @@
1
- import type { ToolDefinition } from "../../shared/index.js";
2
- export interface AnthropicTool {
3
- name: string;
4
- description: string;
5
- input_schema: {
6
- type: 'object';
7
- [key: string]: unknown;
8
- };
9
- }
10
- export declare function convertTools(tools: ToolDefinition[]): AnthropicTool[];
@@ -1,7 +0,0 @@
1
- export function convertTools(tools) {
2
- return tools.map((tool) => ({
3
- name: tool.name,
4
- description: tool.description,
5
- input_schema: { type: 'object', ...tool.parameters },
6
- }));
7
- }
@@ -1,17 +0,0 @@
1
- import type { LLMProvider, ChatParams, ChatResult, ModelInfo, ToolDefinition } from "../../shared/index.js";
2
- export declare class OllamaProvider implements LLMProvider {
3
- readonly id = "ollama";
4
- readonly displayName = "Ollama";
5
- private baseUrl;
6
- private cachedModels;
7
- private cacheTimestamp;
8
- private readonly cacheTtlMs;
9
- constructor({ baseUrl }?: {
10
- baseUrl?: string;
11
- });
12
- get models(): ModelInfo[];
13
- serializeTools(_tools: ToolDefinition[]): unknown;
14
- getModels(): Promise<ModelInfo[]>;
15
- chat(params: ChatParams): Promise<ChatResult>;
16
- chatStream(params: ChatParams): AsyncGenerator<string, ChatResult, unknown>;
17
- }