botinabox 2.5.2 → 2.5.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 (276) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +190 -190
  3. package/bin/botinabox.mjs +2 -2
  4. package/dist/{chunk-UACT2WXX.js → chunk-7AGWGYZC.js} +43 -5
  5. package/dist/cli.js +1 -1
  6. package/dist/connectors/google/index.d.ts +10 -1
  7. package/dist/connectors/google/index.js +1 -1
  8. package/dist/{gmail-connector-2FVYTQJH.js → gmail-connector-VP5FF56J.js} +2 -1
  9. package/package.json +100 -100
  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-BWrtVqEP.d.ts +0 -652
  37. package/dist/chat-pipeline-C-XlLGNl.d.ts +0 -648
  38. package/dist/chat-pipeline-CR1KF6eX.d.ts +0 -652
  39. package/dist/chat-pipeline-DisuC8SB.d.ts +0 -643
  40. package/dist/chunk-2LGXQPEA.js +0 -41
  41. package/dist/chunk-3X3YKI4T.js +0 -357
  42. package/dist/chunk-D47AIFOD.js +0 -351
  43. package/dist/chunk-DSNJKNEW.js +0 -328
  44. package/dist/chunk-GS2JFL6I.js +0 -144
  45. package/dist/chunk-J6S6QMUY.js +0 -144
  46. package/dist/chunk-QLA6YOFN.js +0 -22
  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-MNUBRNFM.js +0 -6
  229. package/dist/gmail-connector-PS2VLGNE.js +0 -6
  230. package/dist/gmail-connector-ULSMN6X2.js +0 -6
  231. package/dist/gmail-connector-URRFX6A3.js +0 -6
  232. package/dist/inbound-AFBUPSPG.js +0 -10
  233. package/dist/inbound-AFOHYNUY.js +0 -6
  234. package/dist/inbound-CGIXRXGC.js +0 -8
  235. package/dist/inbound-MCOLRH6U.js +0 -10
  236. package/dist/inbound-SNEMBLGA.js +0 -6
  237. package/dist/inbound-ZJHAYVMF.js +0 -10
  238. package/dist/provider-qqJYv9nv.d.ts +0 -75
  239. package/dist/providers/anthropic/models.d.ts +0 -2
  240. package/dist/providers/anthropic/models.js +0 -29
  241. package/dist/providers/anthropic/provider.d.ts +0 -13
  242. package/dist/providers/anthropic/provider.js +0 -119
  243. package/dist/providers/anthropic/tool-converter.d.ts +0 -10
  244. package/dist/providers/anthropic/tool-converter.js +0 -7
  245. package/dist/providers/ollama/provider.d.ts +0 -17
  246. package/dist/providers/ollama/provider.js +0 -185
  247. package/dist/providers/openai/models.d.ts +0 -2
  248. package/dist/providers/openai/models.js +0 -29
  249. package/dist/providers/openai/provider.d.ts +0 -13
  250. package/dist/providers/openai/provider.js +0 -163
  251. package/dist/providers/openai/tool-converter.d.ts +0 -10
  252. package/dist/providers/openai/tool-converter.js +0 -10
  253. package/dist/shared/constants.d.ts +0 -50
  254. package/dist/shared/constants.js +0 -64
  255. package/dist/shared/index.d.ts +0 -14
  256. package/dist/shared/index.js +0 -14
  257. package/dist/shared/types/agent.d.ts +0 -36
  258. package/dist/shared/types/agent.js +0 -2
  259. package/dist/shared/types/channel.d.ts +0 -70
  260. package/dist/shared/types/channel.js +0 -2
  261. package/dist/shared/types/config.d.ts +0 -111
  262. package/dist/shared/types/config.js +0 -2
  263. package/dist/shared/types/connector.d.ts +0 -77
  264. package/dist/shared/types/connector.js +0 -2
  265. package/dist/shared/types/execution.d.ts +0 -29
  266. package/dist/shared/types/execution.js +0 -2
  267. package/dist/shared/types/provider.d.ts +0 -73
  268. package/dist/shared/types/provider.js +0 -2
  269. package/dist/shared/types/task.d.ts +0 -47
  270. package/dist/shared/types/task.js +0 -2
  271. package/dist/shared/types/workflow.d.ts +0 -39
  272. package/dist/shared/types/workflow.js +0 -2
  273. package/dist/shared/utils.d.ts +0 -6
  274. package/dist/shared/utils.js +0 -13
  275. package/dist/update-check.d.ts +0 -5
  276. package/dist/update-check.js +0 -56
@@ -1,111 +0,0 @@
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 BotConfig {
68
- data: DataConfig;
69
- channels: Record<string, {
70
- enabled: boolean;
71
- accounts?: Record<string, unknown>;
72
- } & Record<string, unknown>>;
73
- connectors?: Record<string, {
74
- enabled: boolean;
75
- provider: string;
76
- accounts?: Record<string, import("./connector.js").ConnectorConfig>;
77
- } & Record<string, unknown>>;
78
- agents: AgentConfig[];
79
- providers: Record<string, {
80
- enabled: boolean;
81
- } & Record<string, unknown>>;
82
- models: ModelConfig;
83
- entities: Record<string, EntityConfig>;
84
- security: SecurityConfig;
85
- render: RenderConfig;
86
- updates: UpdateConfig;
87
- budget: BudgetConfig;
88
- workflows?: Record<string, WorkflowConfigEntry>;
89
- }
90
- export interface WorkflowConfigEntry {
91
- name: string;
92
- description?: string;
93
- steps: WorkflowStepConfig[];
94
- trigger?: {
95
- type: "task_completed" | "event" | "schedule" | "manual";
96
- filter?: Record<string, unknown>;
97
- };
98
- }
99
- export interface WorkflowStepConfig {
100
- id: string;
101
- name: string;
102
- agentSlug?: string;
103
- taskTemplate: {
104
- title: string;
105
- description: string;
106
- };
107
- dependsOn?: string[];
108
- onComplete?: "next" | "parallel" | "end";
109
- onFail?: "abort" | "skip" | "retry";
110
- retryPolicy?: import("./task.js").RetryPolicy;
111
- }
@@ -1,2 +0,0 @@
1
- /** Bot configuration types — Story 1.2 / 1.5 */
2
- export {};
@@ -1,77 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- /** Connector types — generic external service integrations. */
2
- export {};
@@ -1,29 +0,0 @@
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,2 +0,0 @@
1
- /** Execution adapter types — Story 1.5 / 3.4 / 3.5 */
2
- export {};
@@ -1,73 +0,0 @@
1
- /** LLM provider types — Story 1.5 / 2.1 */
2
- export interface ToolDefinition {
3
- name: string;
4
- description: string;
5
- parameters: Record<string, unknown>;
6
- }
7
- export interface ChatMessage {
8
- role: "user" | "assistant" | "system";
9
- content: string | ContentBlock[];
10
- }
11
- export 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
- export 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
- export interface TokenUsage {
34
- inputTokens: number;
35
- outputTokens: number;
36
- cacheReadTokens?: number;
37
- cacheWriteTokens?: number;
38
- }
39
- export 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
- export interface ToolUse {
47
- id: string;
48
- name: string;
49
- input: unknown;
50
- }
51
- export 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
- export interface ResolvedModel {
62
- provider: string;
63
- model: string;
64
- }
65
- export 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
- }
@@ -1,2 +0,0 @@
1
- /** LLM provider types — Story 1.5 / 2.1 */
2
- export {};
@@ -1,47 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- /** Task types — Story 1.5 / 3.2 */
2
- export {};
@@ -1,39 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- /** Workflow types — Story 1.5 / 5.1 */
2
- export {};
@@ -1,6 +0,0 @@
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;
@@ -1,13 +0,0 @@
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 function truncateAtWord(text, maxLen) {
7
- if (text.length <= maxLen)
8
- return text;
9
- const truncated = text.slice(0, maxLen);
10
- const lastSpace = truncated.lastIndexOf(" ");
11
- const cutPoint = lastSpace > maxLen * 0.5 ? lastSpace : maxLen;
12
- return truncated.slice(0, cutPoint) + "...";
13
- }
@@ -1,5 +0,0 @@
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>;
@@ -1,56 +0,0 @@
1
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { homedir } from 'node:os';
4
- const ONE_DAY_MS = 86_400_000;
5
- function isNewer(latest, current) {
6
- const a = latest.split('.').map(Number);
7
- const b = current.split('.').map(Number);
8
- for (let i = 0; i < Math.max(a.length, b.length); i++) {
9
- const av = a[i] ?? 0;
10
- const bv = b[i] ?? 0;
11
- if (av > bv)
12
- return true;
13
- if (av < bv)
14
- return false;
15
- }
16
- return false;
17
- }
18
- /**
19
- * Check the npm registry for a newer version. Caches results for 24 hours.
20
- * Returns the latest version string if an update is available, null otherwise.
21
- */
22
- export async function checkForUpdate(pkgName, currentVersion) {
23
- const cacheDir = join(homedir(), `.${pkgName}`);
24
- const cachePath = join(cacheDir, 'update-check.json');
25
- // Check cache first
26
- try {
27
- if (existsSync(cachePath)) {
28
- const cached = JSON.parse(readFileSync(cachePath, 'utf-8'));
29
- if (Date.now() - cached.checked < ONE_DAY_MS) {
30
- return isNewer(cached.latest, currentVersion) ? cached.latest : null;
31
- }
32
- }
33
- }
34
- catch {
35
- // Cache corrupt or unreadable — proceed to fetch
36
- }
37
- // Fetch latest version from npm
38
- const res = await fetch(`https://registry.npmjs.org/${pkgName}/latest`, {
39
- headers: { accept: 'application/json' },
40
- signal: AbortSignal.timeout(5000),
41
- });
42
- if (!res.ok)
43
- return null;
44
- const data = (await res.json());
45
- const latest = data.version;
46
- // Write cache
47
- try {
48
- if (!existsSync(cacheDir))
49
- mkdirSync(cacheDir, { recursive: true });
50
- writeFileSync(cachePath, JSON.stringify({ latest, checked: Date.now() }));
51
- }
52
- catch {
53
- // Non-critical — skip caching
54
- }
55
- return isNewer(latest, currentVersion) ? latest : null;
56
- }