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.
- package/LICENSE +21 -21
- package/README.md +190 -190
- package/bin/botinabox.mjs +2 -2
- package/dist/channels/slack/index.d.ts +1 -1
- package/dist/{chat-pipeline-BWrtVqEP.d.ts → chat-pipeline-DuNX5WoL.d.ts} +3 -0
- package/dist/cli.js +0 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +64 -27
- package/package.json +100 -99
- package/dist/channels/discord/adapter.d.ts +0 -32
- package/dist/channels/discord/adapter.js +0 -70
- package/dist/channels/discord/inbound.d.ts +0 -25
- package/dist/channels/discord/inbound.js +0 -24
- package/dist/channels/discord/models.d.ts +0 -8
- package/dist/channels/discord/models.js +0 -5
- package/dist/channels/discord/outbound.d.ts +0 -14
- package/dist/channels/discord/outbound.js +0 -38
- package/dist/channels/slack/adapter.d.ts +0 -33
- package/dist/channels/slack/adapter.js +0 -74
- package/dist/channels/slack/inbound.d.ts +0 -59
- package/dist/channels/slack/inbound.js +0 -96
- package/dist/channels/slack/models.d.ts +0 -9
- package/dist/channels/slack/models.js +0 -5
- package/dist/channels/slack/outbound.d.ts +0 -12
- package/dist/channels/slack/outbound.js +0 -18
- package/dist/channels/slack/transcribe.d.ts +0 -41
- package/dist/channels/slack/transcribe.js +0 -106
- package/dist/channels/webhook/adapter.d.ts +0 -23
- package/dist/channels/webhook/adapter.js +0 -86
- package/dist/channels/webhook/hmac.d.ts +0 -13
- package/dist/channels/webhook/hmac.js +0 -26
- package/dist/channels/webhook/models.d.ts +0 -9
- package/dist/channels/webhook/models.js +0 -5
- package/dist/channels/webhook/server.d.ts +0 -20
- package/dist/channels/webhook/server.js +0 -91
- package/dist/chat-pipeline-C-XlLGNl.d.ts +0 -648
- package/dist/chat-pipeline-CR1KF6eX.d.ts +0 -652
- package/dist/chat-pipeline-DisuC8SB.d.ts +0 -643
- package/dist/chunk-2LGXQPEA.js +0 -41
- package/dist/chunk-3X3YKI4T.js +0 -357
- package/dist/chunk-D47AIFOD.js +0 -351
- package/dist/chunk-DSNJKNEW.js +0 -328
- package/dist/chunk-GS2JFL6I.js +0 -144
- package/dist/chunk-J6S6QMUY.js +0 -144
- package/dist/chunk-QLA6YOFN.js +0 -22
- package/dist/chunk-UACT2WXX.js +0 -381
- package/dist/cli/templates/config.yml.d.ts +0 -7
- package/dist/cli/templates/config.yml.js +0 -61
- package/dist/cli/templates/env.d.ts +0 -1
- package/dist/cli/templates/env.js +0 -30
- package/dist/cli/templates/index.ts.d.ts +0 -2
- package/dist/cli/templates/index.ts.js +0 -30
- package/dist/cli/templates/package.json.d.ts +0 -5
- package/dist/cli/templates/package.json.js +0 -28
- package/dist/connector-DDahQw-2.d.ts +0 -63
- package/dist/connectors/google/calendar-connector.d.ts +0 -40
- package/dist/connectors/google/calendar-connector.js +0 -243
- package/dist/connectors/google/gmail-connector.d.ts +0 -42
- package/dist/connectors/google/gmail-connector.js +0 -345
- package/dist/connectors/google/oauth.d.ts +0 -48
- package/dist/connectors/google/oauth.js +0 -112
- package/dist/connectors/google/types.d.ts +0 -78
- package/dist/connectors/google/types.js +0 -2
- package/dist/core/chat/auto-discovery.d.ts +0 -16
- package/dist/core/chat/auto-discovery.js +0 -54
- package/dist/core/chat/channel-registry.d.ts +0 -45
- package/dist/core/chat/channel-registry.js +0 -96
- package/dist/core/chat/chat-pipeline.d.ts +0 -113
- package/dist/core/chat/chat-pipeline.js +0 -395
- package/dist/core/chat/chat-responder.d.ts +0 -90
- package/dist/core/chat/chat-responder.js +0 -185
- package/dist/core/chat/formatter.d.ts +0 -11
- package/dist/core/chat/formatter.js +0 -60
- package/dist/core/chat/index.d.ts +0 -24
- package/dist/core/chat/index.js +0 -18
- package/dist/core/chat/message-interpreter.d.ts +0 -91
- package/dist/core/chat/message-interpreter.js +0 -166
- package/dist/core/chat/message-store.d.ts +0 -66
- package/dist/core/chat/message-store.js +0 -131
- package/dist/core/chat/notification-queue.d.ts +0 -34
- package/dist/core/chat/notification-queue.js +0 -111
- package/dist/core/chat/pipeline.d.ts +0 -38
- package/dist/core/chat/pipeline.js +0 -89
- package/dist/core/chat/policies.d.ts +0 -16
- package/dist/core/chat/policies.js +0 -25
- package/dist/core/chat/routing.d.ts +0 -17
- package/dist/core/chat/routing.js +0 -36
- package/dist/core/chat/session-key.d.ts +0 -30
- package/dist/core/chat/session-key.js +0 -65
- package/dist/core/chat/session-manager.d.ts +0 -17
- package/dist/core/chat/session-manager.js +0 -23
- package/dist/core/chat/text-chunker.d.ts +0 -9
- package/dist/core/chat/text-chunker.js +0 -48
- package/dist/core/chat/triage-router.d.ts +0 -75
- package/dist/core/chat/triage-router.js +0 -142
- package/dist/core/chat/types.d.ts +0 -5
- package/dist/core/chat/types.js +0 -5
- package/dist/core/config/defaults.d.ts +0 -2
- package/dist/core/config/defaults.js +0 -38
- package/dist/core/config/index.d.ts +0 -6
- package/dist/core/config/index.js +0 -4
- package/dist/core/config/interpolate.d.ts +0 -5
- package/dist/core/config/interpolate.js +0 -27
- package/dist/core/config/loader.d.ts +0 -24
- package/dist/core/config/loader.js +0 -59
- package/dist/core/config/schema.d.ts +0 -5
- package/dist/core/config/schema.js +0 -119
- package/dist/core/data/core-entity-contexts.d.ts +0 -14
- package/dist/core/data/core-entity-contexts.js +0 -197
- package/dist/core/data/core-migrations.d.ts +0 -5
- package/dist/core/data/core-migrations.js +0 -45
- package/dist/core/data/core-schema.d.ts +0 -6
- package/dist/core/data/core-schema.js +0 -454
- package/dist/core/data/data-store.d.ts +0 -67
- package/dist/core/data/data-store.js +0 -218
- package/dist/core/data/domain-entity-contexts.d.ts +0 -29
- package/dist/core/data/domain-entity-contexts.js +0 -321
- package/dist/core/data/domain-schema.d.ts +0 -36
- package/dist/core/data/domain-schema.js +0 -323
- package/dist/core/data/index.d.ts +0 -7
- package/dist/core/data/index.js +0 -7
- package/dist/core/data/types.d.ts +0 -111
- package/dist/core/data/types.js +0 -1
- package/dist/core/hooks/hook-bus.d.ts +0 -18
- package/dist/core/hooks/hook-bus.js +0 -120
- package/dist/core/hooks/index.d.ts +0 -2
- package/dist/core/hooks/index.js +0 -1
- package/dist/core/hooks/types.d.ts +0 -19
- package/dist/core/hooks/types.js +0 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.js +0 -4
- package/dist/core/llm/auto-discovery.d.ts +0 -11
- package/dist/core/llm/auto-discovery.js +0 -49
- package/dist/core/llm/cost-tracker.d.ts +0 -6
- package/dist/core/llm/cost-tracker.js +0 -38
- package/dist/core/llm/index.d.ts +0 -4
- package/dist/core/llm/index.js +0 -3
- package/dist/core/llm/model-router.d.ts +0 -25
- package/dist/core/llm/model-router.js +0 -49
- package/dist/core/llm/provider-registry.d.ts +0 -9
- package/dist/core/llm/provider-registry.js +0 -25
- package/dist/core/llm/types.d.ts +0 -2
- package/dist/core/llm/types.js +0 -2
- package/dist/core/orchestrator/adapters/api-adapter.d.ts +0 -34
- package/dist/core/orchestrator/adapters/api-adapter.js +0 -88
- package/dist/core/orchestrator/adapters/cli-adapter.d.ts +0 -22
- package/dist/core/orchestrator/adapters/cli-adapter.js +0 -69
- package/dist/core/orchestrator/adapters/deterministic-adapter.d.ts +0 -35
- package/dist/core/orchestrator/adapters/deterministic-adapter.js +0 -75
- package/dist/core/orchestrator/adapters/env-whitelist.d.ts +0 -4
- package/dist/core/orchestrator/adapters/env-whitelist.js +0 -27
- package/dist/core/orchestrator/adapters/output-extractor.d.ts +0 -11
- package/dist/core/orchestrator/adapters/output-extractor.js +0 -59
- package/dist/core/orchestrator/adapters/process-manager.d.ts +0 -15
- package/dist/core/orchestrator/adapters/process-manager.js +0 -26
- package/dist/core/orchestrator/adapters/tool-loop.d.ts +0 -22
- package/dist/core/orchestrator/adapters/tool-loop.js +0 -66
- package/dist/core/orchestrator/agent-registry.d.ts +0 -31
- package/dist/core/orchestrator/agent-registry.js +0 -135
- package/dist/core/orchestrator/budget-controller.d.ts +0 -19
- package/dist/core/orchestrator/budget-controller.js +0 -73
- package/dist/core/orchestrator/chain-guard.d.ts +0 -14
- package/dist/core/orchestrator/chain-guard.js +0 -23
- package/dist/core/orchestrator/circuit-breaker.d.ts +0 -65
- package/dist/core/orchestrator/circuit-breaker.js +0 -159
- package/dist/core/orchestrator/claude-stream-parser.d.ts +0 -31
- package/dist/core/orchestrator/claude-stream-parser.js +0 -99
- package/dist/core/orchestrator/config-revisions.d.ts +0 -6
- package/dist/core/orchestrator/config-revisions.js +0 -17
- package/dist/core/orchestrator/dependency-resolver.d.ts +0 -20
- package/dist/core/orchestrator/dependency-resolver.js +0 -78
- package/dist/core/orchestrator/governance-gate.d.ts +0 -110
- package/dist/core/orchestrator/governance-gate.js +0 -170
- package/dist/core/orchestrator/learning-pipeline.d.ts +0 -109
- package/dist/core/orchestrator/learning-pipeline.js +0 -249
- package/dist/core/orchestrator/loop-detector.d.ts +0 -51
- package/dist/core/orchestrator/loop-detector.js +0 -133
- package/dist/core/orchestrator/ndjson-logger.d.ts +0 -6
- package/dist/core/orchestrator/ndjson-logger.js +0 -18
- package/dist/core/orchestrator/permission-relay.d.ts +0 -72
- package/dist/core/orchestrator/permission-relay.js +0 -164
- package/dist/core/orchestrator/run-manager.d.ts +0 -31
- package/dist/core/orchestrator/run-manager.js +0 -178
- package/dist/core/orchestrator/scheduler.d.ts +0 -70
- package/dist/core/orchestrator/scheduler.js +0 -198
- package/dist/core/orchestrator/secret-store.d.ts +0 -57
- package/dist/core/orchestrator/secret-store.js +0 -171
- package/dist/core/orchestrator/session-manager.d.ts +0 -13
- package/dist/core/orchestrator/session-manager.js +0 -66
- package/dist/core/orchestrator/task-queue.d.ts +0 -34
- package/dist/core/orchestrator/task-queue.js +0 -83
- package/dist/core/orchestrator/template-interpolate.d.ts +0 -5
- package/dist/core/orchestrator/template-interpolate.js +0 -18
- package/dist/core/orchestrator/user-registry.d.ts +0 -47
- package/dist/core/orchestrator/user-registry.js +0 -76
- package/dist/core/orchestrator/wakeup-queue.d.ts +0 -9
- package/dist/core/orchestrator/wakeup-queue.js +0 -45
- package/dist/core/orchestrator/workflow-engine.d.ts +0 -47
- package/dist/core/orchestrator/workflow-engine.js +0 -204
- package/dist/core/security/audit.d.ts +0 -20
- package/dist/core/security/audit.js +0 -33
- package/dist/core/security/column-validator.d.ts +0 -20
- package/dist/core/security/column-validator.js +0 -37
- package/dist/core/security/index.d.ts +0 -5
- package/dist/core/security/index.js +0 -5
- package/dist/core/security/process-env.d.ts +0 -13
- package/dist/core/security/process-env.js +0 -49
- package/dist/core/security/sanitizer.d.ts +0 -11
- package/dist/core/security/sanitizer.js +0 -39
- package/dist/core/security/types.d.ts +0 -11
- package/dist/core/security/types.js +0 -1
- package/dist/core/update/auto-update.d.ts +0 -21
- package/dist/core/update/auto-update.js +0 -102
- package/dist/core/update/backup-manager.d.ts +0 -7
- package/dist/core/update/backup-manager.js +0 -24
- package/dist/core/update/index.d.ts +0 -8
- package/dist/core/update/index.js +0 -6
- package/dist/core/update/migration-hooks.d.ts +0 -11
- package/dist/core/update/migration-hooks.js +0 -10
- package/dist/core/update/types.d.ts +0 -11
- package/dist/core/update/types.js +0 -1
- package/dist/core/update/update-checker.d.ts +0 -11
- package/dist/core/update/update-checker.js +0 -63
- package/dist/core/update/update-manager.d.ts +0 -25
- package/dist/core/update/update-manager.js +0 -101
- package/dist/core/update/version-utils.d.ts +0 -6
- package/dist/core/update/version-utils.js +0 -34
- package/dist/gmail-connector-2FVYTQJH.js +0 -6
- package/dist/gmail-connector-MNUBRNFM.js +0 -6
- package/dist/gmail-connector-PS2VLGNE.js +0 -6
- package/dist/gmail-connector-ULSMN6X2.js +0 -6
- package/dist/gmail-connector-URRFX6A3.js +0 -6
- package/dist/inbound-AFBUPSPG.js +0 -10
- package/dist/inbound-AFOHYNUY.js +0 -6
- package/dist/inbound-CGIXRXGC.js +0 -8
- package/dist/inbound-MCOLRH6U.js +0 -10
- package/dist/inbound-SNEMBLGA.js +0 -6
- package/dist/inbound-ZJHAYVMF.js +0 -10
- package/dist/provider-qqJYv9nv.d.ts +0 -75
- package/dist/providers/anthropic/models.d.ts +0 -2
- package/dist/providers/anthropic/models.js +0 -29
- package/dist/providers/anthropic/provider.d.ts +0 -13
- package/dist/providers/anthropic/provider.js +0 -119
- package/dist/providers/anthropic/tool-converter.d.ts +0 -10
- package/dist/providers/anthropic/tool-converter.js +0 -7
- package/dist/providers/ollama/provider.d.ts +0 -17
- package/dist/providers/ollama/provider.js +0 -185
- package/dist/providers/openai/models.d.ts +0 -2
- package/dist/providers/openai/models.js +0 -29
- package/dist/providers/openai/provider.d.ts +0 -13
- package/dist/providers/openai/provider.js +0 -163
- package/dist/providers/openai/tool-converter.d.ts +0 -10
- package/dist/providers/openai/tool-converter.js +0 -10
- package/dist/shared/constants.d.ts +0 -50
- package/dist/shared/constants.js +0 -64
- package/dist/shared/index.d.ts +0 -14
- package/dist/shared/index.js +0 -14
- package/dist/shared/types/agent.d.ts +0 -36
- package/dist/shared/types/agent.js +0 -2
- package/dist/shared/types/channel.d.ts +0 -70
- package/dist/shared/types/channel.js +0 -2
- package/dist/shared/types/config.d.ts +0 -111
- package/dist/shared/types/config.js +0 -2
- package/dist/shared/types/connector.d.ts +0 -77
- package/dist/shared/types/connector.js +0 -2
- package/dist/shared/types/execution.d.ts +0 -29
- package/dist/shared/types/execution.js +0 -2
- package/dist/shared/types/provider.d.ts +0 -73
- package/dist/shared/types/provider.js +0 -2
- package/dist/shared/types/task.d.ts +0 -47
- package/dist/shared/types/task.js +0 -2
- package/dist/shared/types/workflow.d.ts +0 -39
- package/dist/shared/types/workflow.js +0 -2
- package/dist/shared/utils.d.ts +0 -6
- package/dist/shared/utils.js +0 -13
- package/dist/update-check.d.ts +0 -5
- 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,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,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,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,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,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
|
-
}
|
package/dist/shared/utils.d.ts
DELETED
package/dist/shared/utils.js
DELETED
|
@@ -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
|
-
}
|
package/dist/update-check.d.ts
DELETED
|
@@ -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>;
|
package/dist/update-check.js
DELETED
|
@@ -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
|
-
}
|