clementine-agent 1.0.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/.env.example +44 -0
- package/LICENSE +21 -0
- package/README.md +795 -0
- package/dist/agent/agent-manager.d.ts +69 -0
- package/dist/agent/agent-manager.js +441 -0
- package/dist/agent/assistant.d.ts +225 -0
- package/dist/agent/assistant.js +3888 -0
- package/dist/agent/auto-update.d.ts +32 -0
- package/dist/agent/auto-update.js +186 -0
- package/dist/agent/daily-planner.d.ts +24 -0
- package/dist/agent/daily-planner.js +379 -0
- package/dist/agent/execution-advisor.d.ts +10 -0
- package/dist/agent/execution-advisor.js +272 -0
- package/dist/agent/hooks.d.ts +45 -0
- package/dist/agent/hooks.js +564 -0
- package/dist/agent/insight-engine.d.ts +66 -0
- package/dist/agent/insight-engine.js +225 -0
- package/dist/agent/intent-classifier.d.ts +48 -0
- package/dist/agent/intent-classifier.js +214 -0
- package/dist/agent/link-extractor.d.ts +19 -0
- package/dist/agent/link-extractor.js +90 -0
- package/dist/agent/mcp-bridge.d.ts +62 -0
- package/dist/agent/mcp-bridge.js +435 -0
- package/dist/agent/metacognition.d.ts +66 -0
- package/dist/agent/metacognition.js +221 -0
- package/dist/agent/orchestrator.d.ts +81 -0
- package/dist/agent/orchestrator.js +790 -0
- package/dist/agent/profiles.d.ts +22 -0
- package/dist/agent/profiles.js +91 -0
- package/dist/agent/prompt-cache.d.ts +24 -0
- package/dist/agent/prompt-cache.js +68 -0
- package/dist/agent/prompt-evolver.d.ts +28 -0
- package/dist/agent/prompt-evolver.js +279 -0
- package/dist/agent/role-scaffolds.d.ts +28 -0
- package/dist/agent/role-scaffolds.js +433 -0
- package/dist/agent/safe-restart.d.ts +41 -0
- package/dist/agent/safe-restart.js +150 -0
- package/dist/agent/self-improve.d.ts +66 -0
- package/dist/agent/self-improve.js +1706 -0
- package/dist/agent/session-event-log.d.ts +114 -0
- package/dist/agent/session-event-log.js +233 -0
- package/dist/agent/skill-extractor.d.ts +72 -0
- package/dist/agent/skill-extractor.js +435 -0
- package/dist/agent/source-mods.d.ts +61 -0
- package/dist/agent/source-mods.js +230 -0
- package/dist/agent/source-preflight.d.ts +25 -0
- package/dist/agent/source-preflight.js +100 -0
- package/dist/agent/stall-guard.d.ts +62 -0
- package/dist/agent/stall-guard.js +109 -0
- package/dist/agent/strategic-planner.d.ts +60 -0
- package/dist/agent/strategic-planner.js +352 -0
- package/dist/agent/team-bus.d.ts +89 -0
- package/dist/agent/team-bus.js +556 -0
- package/dist/agent/team-router.d.ts +26 -0
- package/dist/agent/team-router.js +37 -0
- package/dist/agent/tool-loop-detector.d.ts +59 -0
- package/dist/agent/tool-loop-detector.js +242 -0
- package/dist/agent/workflow-runner.d.ts +36 -0
- package/dist/agent/workflow-runner.js +317 -0
- package/dist/agent/workflow-variables.d.ts +16 -0
- package/dist/agent/workflow-variables.js +62 -0
- package/dist/channels/discord-agent-bot.d.ts +101 -0
- package/dist/channels/discord-agent-bot.js +881 -0
- package/dist/channels/discord-bot-manager.d.ts +80 -0
- package/dist/channels/discord-bot-manager.js +262 -0
- package/dist/channels/discord-utils.d.ts +51 -0
- package/dist/channels/discord-utils.js +293 -0
- package/dist/channels/discord.d.ts +12 -0
- package/dist/channels/discord.js +1832 -0
- package/dist/channels/slack-agent-bot.d.ts +73 -0
- package/dist/channels/slack-agent-bot.js +320 -0
- package/dist/channels/slack-bot-manager.d.ts +66 -0
- package/dist/channels/slack-bot-manager.js +236 -0
- package/dist/channels/slack-utils.d.ts +39 -0
- package/dist/channels/slack-utils.js +189 -0
- package/dist/channels/slack.d.ts +11 -0
- package/dist/channels/slack.js +196 -0
- package/dist/channels/telegram.d.ts +10 -0
- package/dist/channels/telegram.js +235 -0
- package/dist/channels/webhook.d.ts +9 -0
- package/dist/channels/webhook.js +78 -0
- package/dist/channels/whatsapp.d.ts +11 -0
- package/dist/channels/whatsapp.js +181 -0
- package/dist/cli/chat.d.ts +14 -0
- package/dist/cli/chat.js +220 -0
- package/dist/cli/cron.d.ts +17 -0
- package/dist/cli/cron.js +552 -0
- package/dist/cli/dashboard.d.ts +15 -0
- package/dist/cli/dashboard.js +17677 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +2474 -0
- package/dist/cli/routes/delegations.d.ts +19 -0
- package/dist/cli/routes/delegations.js +154 -0
- package/dist/cli/routes/digest.d.ts +17 -0
- package/dist/cli/routes/digest.js +375 -0
- package/dist/cli/routes/goals.d.ts +14 -0
- package/dist/cli/routes/goals.js +258 -0
- package/dist/cli/routes/workflows.d.ts +18 -0
- package/dist/cli/routes/workflows.js +97 -0
- package/dist/cli/setup.d.ts +8 -0
- package/dist/cli/setup.js +619 -0
- package/dist/cli/tunnel.d.ts +35 -0
- package/dist/cli/tunnel.js +141 -0
- package/dist/config.d.ts +145 -0
- package/dist/config.js +278 -0
- package/dist/events/bus.d.ts +43 -0
- package/dist/events/bus.js +136 -0
- package/dist/gateway/cron-scheduler.d.ts +166 -0
- package/dist/gateway/cron-scheduler.js +1767 -0
- package/dist/gateway/delivery-queue.d.ts +30 -0
- package/dist/gateway/delivery-queue.js +110 -0
- package/dist/gateway/heartbeat-scheduler.d.ts +99 -0
- package/dist/gateway/heartbeat-scheduler.js +1298 -0
- package/dist/gateway/heartbeat.d.ts +3 -0
- package/dist/gateway/heartbeat.js +3 -0
- package/dist/gateway/lanes.d.ts +24 -0
- package/dist/gateway/lanes.js +76 -0
- package/dist/gateway/notifications.d.ts +29 -0
- package/dist/gateway/notifications.js +75 -0
- package/dist/gateway/router.d.ts +210 -0
- package/dist/gateway/router.js +1330 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1015 -0
- package/dist/memory/chunker.d.ts +28 -0
- package/dist/memory/chunker.js +226 -0
- package/dist/memory/consolidation.d.ts +44 -0
- package/dist/memory/consolidation.js +171 -0
- package/dist/memory/context-assembler.d.ts +50 -0
- package/dist/memory/context-assembler.js +149 -0
- package/dist/memory/embeddings.d.ts +38 -0
- package/dist/memory/embeddings.js +180 -0
- package/dist/memory/graph-store.d.ts +66 -0
- package/dist/memory/graph-store.js +613 -0
- package/dist/memory/mmr.d.ts +21 -0
- package/dist/memory/mmr.js +75 -0
- package/dist/memory/search.d.ts +26 -0
- package/dist/memory/search.js +67 -0
- package/dist/memory/store.d.ts +530 -0
- package/dist/memory/store.js +2022 -0
- package/dist/security/integrity.d.ts +24 -0
- package/dist/security/integrity.js +58 -0
- package/dist/security/patterns.d.ts +34 -0
- package/dist/security/patterns.js +110 -0
- package/dist/security/scanner.d.ts +32 -0
- package/dist/security/scanner.js +263 -0
- package/dist/tools/admin-tools.d.ts +12 -0
- package/dist/tools/admin-tools.js +1278 -0
- package/dist/tools/external-tools.d.ts +11 -0
- package/dist/tools/external-tools.js +1327 -0
- package/dist/tools/goal-tools.d.ts +9 -0
- package/dist/tools/goal-tools.js +159 -0
- package/dist/tools/mcp-server.d.ts +13 -0
- package/dist/tools/mcp-server.js +141 -0
- package/dist/tools/memory-tools.d.ts +10 -0
- package/dist/tools/memory-tools.js +568 -0
- package/dist/tools/session-tools.d.ts +6 -0
- package/dist/tools/session-tools.js +146 -0
- package/dist/tools/shared.d.ts +216 -0
- package/dist/tools/shared.js +340 -0
- package/dist/tools/team-tools.d.ts +6 -0
- package/dist/tools/team-tools.js +447 -0
- package/dist/tools/tool-meta.d.ts +34 -0
- package/dist/tools/tool-meta.js +133 -0
- package/dist/tools/vault-tools.d.ts +8 -0
- package/dist/tools/vault-tools.js +457 -0
- package/dist/types.d.ts +716 -0
- package/dist/types.js +16 -0
- package/dist/vault-migrations/0001-add-execution-framework.d.ts +10 -0
- package/dist/vault-migrations/0001-add-execution-framework.js +47 -0
- package/dist/vault-migrations/0002-add-agentic-communication.d.ts +12 -0
- package/dist/vault-migrations/0002-add-agentic-communication.js +79 -0
- package/dist/vault-migrations/0003-update-execution-pipeline-narration.d.ts +11 -0
- package/dist/vault-migrations/0003-update-execution-pipeline-narration.js +73 -0
- package/dist/vault-migrations/helpers.d.ts +14 -0
- package/dist/vault-migrations/helpers.js +44 -0
- package/dist/vault-migrations/runner.d.ts +14 -0
- package/dist/vault-migrations/runner.js +139 -0
- package/dist/vault-migrations/types.d.ts +42 -0
- package/dist/vault-migrations/types.js +9 -0
- package/install.sh +320 -0
- package/package.json +84 -0
- package/scripts/postinstall.js +125 -0
- package/vault/00-System/AGENTS.md +66 -0
- package/vault/00-System/CRON.md +71 -0
- package/vault/00-System/HEARTBEAT.md +58 -0
- package/vault/00-System/MEMORY.md +16 -0
- package/vault/00-System/SOUL.md +96 -0
- package/vault/05-Tasks/TASKS.md +19 -0
- package/vault/06-Templates/_Daily-Template.md +28 -0
- package/vault/06-Templates/_People-Template.md +22 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clementine TypeScript — Shared types.
|
|
3
|
+
*/
|
|
4
|
+
export interface SearchResult {
|
|
5
|
+
sourceFile: string;
|
|
6
|
+
section: string;
|
|
7
|
+
content: string;
|
|
8
|
+
score: float;
|
|
9
|
+
chunkType: string;
|
|
10
|
+
matchType: 'fts' | 'recency' | 'timeline' | 'vector';
|
|
11
|
+
lastUpdated: string;
|
|
12
|
+
chunkId: number;
|
|
13
|
+
salience: number;
|
|
14
|
+
agentSlug?: string | null;
|
|
15
|
+
category?: string | null;
|
|
16
|
+
topic?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export type ChunkCategory = 'facts' | 'events' | 'discoveries' | 'preferences' | 'advice';
|
|
19
|
+
export interface Chunk {
|
|
20
|
+
sourceFile: string;
|
|
21
|
+
section: string;
|
|
22
|
+
content: string;
|
|
23
|
+
chunkType: 'frontmatter' | 'heading' | 'preamble' | 'episodic';
|
|
24
|
+
frontmatterJson: string;
|
|
25
|
+
contentHash: string;
|
|
26
|
+
category?: ChunkCategory | null;
|
|
27
|
+
topic?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface SyncStats {
|
|
30
|
+
filesScanned: number;
|
|
31
|
+
filesUpdated: number;
|
|
32
|
+
filesDeleted: number;
|
|
33
|
+
chunksTotal: number;
|
|
34
|
+
}
|
|
35
|
+
export interface SessionData {
|
|
36
|
+
sessionId: string;
|
|
37
|
+
exchanges: number;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
exchangeHistory: Array<{
|
|
40
|
+
user: string;
|
|
41
|
+
assistant: string;
|
|
42
|
+
}>;
|
|
43
|
+
pendingContext?: Array<{
|
|
44
|
+
user: string;
|
|
45
|
+
assistant: string;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
/** Origin context for a session — who/what created it and with what authority. */
|
|
49
|
+
export interface SessionProvenance {
|
|
50
|
+
/** Channel that originated this session (e.g., 'discord', 'slack', 'cron', 'heartbeat', 'dashboard'). */
|
|
51
|
+
channel: string;
|
|
52
|
+
/** User ID within the channel (e.g., Discord user ID), or 'system' for autonomous. */
|
|
53
|
+
userId: string;
|
|
54
|
+
/** Interaction source determines trust level. */
|
|
55
|
+
source: 'owner-dm' | 'owner-channel' | 'member-channel' | 'autonomous';
|
|
56
|
+
/** Parent session key if spawned by another session (e.g., !plan sub-tasks). */
|
|
57
|
+
spawnedBy?: string;
|
|
58
|
+
/** Depth in the spawn hierarchy: 0 = top-level, 1 = sub-task, etc. */
|
|
59
|
+
spawnDepth: number;
|
|
60
|
+
/** Role assigned at spawn time — immutable once set. */
|
|
61
|
+
role: 'primary' | 'orchestrator' | 'worker';
|
|
62
|
+
/** What this session can control: 'children' = own spawns only, 'none' = no control. */
|
|
63
|
+
controlScope: 'children' | 'none';
|
|
64
|
+
/** ISO timestamp of session creation. */
|
|
65
|
+
createdAt: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ChannelMessage {
|
|
68
|
+
sessionKey: string;
|
|
69
|
+
text: string;
|
|
70
|
+
channel: string;
|
|
71
|
+
userId: string;
|
|
72
|
+
attachments?: Attachment[];
|
|
73
|
+
}
|
|
74
|
+
export interface Attachment {
|
|
75
|
+
name: string;
|
|
76
|
+
url: string;
|
|
77
|
+
mimeType: string;
|
|
78
|
+
localPath?: string;
|
|
79
|
+
}
|
|
80
|
+
/** Declares what a channel can do, enabling graceful degradation. */
|
|
81
|
+
export interface ChannelCapabilities {
|
|
82
|
+
/** Channel supports threaded conversations. */
|
|
83
|
+
threads: boolean;
|
|
84
|
+
/** Channel supports rich text (markdown, formatting). */
|
|
85
|
+
richText: boolean;
|
|
86
|
+
/** Channel supports file/image attachments. */
|
|
87
|
+
attachments: boolean;
|
|
88
|
+
/** Channel supports interactive buttons/actions. */
|
|
89
|
+
buttons: boolean;
|
|
90
|
+
/** Channel supports emoji reactions. */
|
|
91
|
+
reactions: boolean;
|
|
92
|
+
/** Channel supports typing indicators. */
|
|
93
|
+
typingIndicators: boolean;
|
|
94
|
+
/** Channel supports editing previously sent messages. */
|
|
95
|
+
editMessages: boolean;
|
|
96
|
+
/** Channel supports inline images in responses. */
|
|
97
|
+
inlineImages: boolean;
|
|
98
|
+
/** Maximum message length (0 = unlimited). */
|
|
99
|
+
maxMessageLength: number;
|
|
100
|
+
}
|
|
101
|
+
/** Default capabilities for channels that don't declare their own. */
|
|
102
|
+
export declare const DEFAULT_CHANNEL_CAPABILITIES: ChannelCapabilities;
|
|
103
|
+
export type OnTextCallback = (text: string) => Promise<void>;
|
|
104
|
+
export type OnToolActivityCallback = (toolName: string, toolInput: Record<string, unknown>) => Promise<void>;
|
|
105
|
+
export interface NotificationContext {
|
|
106
|
+
agentSlug?: string;
|
|
107
|
+
}
|
|
108
|
+
export type NotificationSender = (text: string, context?: NotificationContext) => Promise<void>;
|
|
109
|
+
/** Policy governing autonomous outbound email sending for an agent. */
|
|
110
|
+
export interface SendPolicy {
|
|
111
|
+
/** Maximum emails this agent can send per calendar day. */
|
|
112
|
+
maxDailyEmails: number;
|
|
113
|
+
/** Glob patterns for allowed email templates (e.g., ['intro-*', 'followup-*']). Omit to allow any. */
|
|
114
|
+
allowedTemplates?: string[];
|
|
115
|
+
/** When human approval is required: 'none' = fully autonomous, 'first-in-sequence' = approve first email per lead, 'all' = approve every send. */
|
|
116
|
+
requiresApproval: 'none' | 'first-in-sequence' | 'all';
|
|
117
|
+
/** If true, restrict sends to 8am–6pm in the system timezone. */
|
|
118
|
+
businessHoursOnly?: boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface TeamAgentConfig {
|
|
121
|
+
channelName: string | string[];
|
|
122
|
+
channels: string[];
|
|
123
|
+
canMessage: string[];
|
|
124
|
+
allowedTools?: string[];
|
|
125
|
+
allowedUsers?: string[];
|
|
126
|
+
teamChat?: boolean;
|
|
127
|
+
respondToAll?: boolean;
|
|
128
|
+
}
|
|
129
|
+
export interface TeamMessage {
|
|
130
|
+
id: string;
|
|
131
|
+
fromAgent: string;
|
|
132
|
+
toAgent: string;
|
|
133
|
+
content: string;
|
|
134
|
+
timestamp: string;
|
|
135
|
+
delivered: boolean;
|
|
136
|
+
depth: number;
|
|
137
|
+
response?: string;
|
|
138
|
+
protocol?: 'fire-and-forget' | 'request' | 'response' | 'broadcast';
|
|
139
|
+
requestId?: string;
|
|
140
|
+
replyTo?: string;
|
|
141
|
+
expectedBy?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface PendingRequest {
|
|
144
|
+
requestId: string;
|
|
145
|
+
fromAgent: string;
|
|
146
|
+
toAgent: string;
|
|
147
|
+
content: string;
|
|
148
|
+
timestamp: string;
|
|
149
|
+
expectedBy?: string;
|
|
150
|
+
status: 'pending' | 'responded' | 'expired';
|
|
151
|
+
responseMessageId?: string;
|
|
152
|
+
}
|
|
153
|
+
export interface AgentProfile {
|
|
154
|
+
slug: string;
|
|
155
|
+
name: string;
|
|
156
|
+
tier: number;
|
|
157
|
+
description: string;
|
|
158
|
+
systemPromptBody: string;
|
|
159
|
+
model?: string;
|
|
160
|
+
avatar?: string;
|
|
161
|
+
team?: TeamAgentConfig;
|
|
162
|
+
project?: string;
|
|
163
|
+
projects?: string[];
|
|
164
|
+
agentDir?: string;
|
|
165
|
+
discordToken?: string;
|
|
166
|
+
discordChannelId?: string;
|
|
167
|
+
slackBotToken?: string;
|
|
168
|
+
slackAppToken?: string;
|
|
169
|
+
slackChannelId?: string;
|
|
170
|
+
sendPolicy?: SendPolicy;
|
|
171
|
+
allowedMcpServers?: string[];
|
|
172
|
+
status?: AgentStatus;
|
|
173
|
+
budgetMonthlyCents?: number;
|
|
174
|
+
spentMonthlyCents?: number;
|
|
175
|
+
strictMemoryIsolation?: boolean;
|
|
176
|
+
}
|
|
177
|
+
export type AgentStatus = 'active' | 'paused' | 'error' | 'terminated';
|
|
178
|
+
export interface HeartbeatReportedTopic {
|
|
179
|
+
topic: string;
|
|
180
|
+
summary: string;
|
|
181
|
+
reportedAt: string;
|
|
182
|
+
agentSlug?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface HeartbeatState {
|
|
185
|
+
fingerprint: string;
|
|
186
|
+
details: Record<string, number | string>;
|
|
187
|
+
timestamp: string;
|
|
188
|
+
reportedTopics?: HeartbeatReportedTopic[];
|
|
189
|
+
consecutiveSilentBeats?: number;
|
|
190
|
+
lastDiscordMessageAt?: string;
|
|
191
|
+
/** Persisted scheduling dates — survive process restarts */
|
|
192
|
+
lastSelfImproveDate?: string;
|
|
193
|
+
lastConsolidationDate?: string;
|
|
194
|
+
lastAgentSiRuns?: Record<string, string>;
|
|
195
|
+
/** Proactive insight engine state */
|
|
196
|
+
insightState?: {
|
|
197
|
+
sentToday: string[];
|
|
198
|
+
lastSentAt?: string;
|
|
199
|
+
unackedCount: number;
|
|
200
|
+
cooldownMultiplier: number;
|
|
201
|
+
currentDate?: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export interface HeartbeatWorkItem {
|
|
205
|
+
id: string;
|
|
206
|
+
description: string;
|
|
207
|
+
prompt: string;
|
|
208
|
+
source: string;
|
|
209
|
+
priority: 'high' | 'normal';
|
|
210
|
+
queuedAt: string;
|
|
211
|
+
maxTurns: number;
|
|
212
|
+
tier: number;
|
|
213
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
214
|
+
completedAt?: string;
|
|
215
|
+
result?: string;
|
|
216
|
+
error?: string;
|
|
217
|
+
agentSlug?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface CronJobDefinition {
|
|
220
|
+
name: string;
|
|
221
|
+
schedule: string;
|
|
222
|
+
prompt: string;
|
|
223
|
+
enabled: boolean;
|
|
224
|
+
tier: number;
|
|
225
|
+
maxTurns?: number;
|
|
226
|
+
model?: string;
|
|
227
|
+
workDir?: string;
|
|
228
|
+
mode?: 'standard' | 'unleashed';
|
|
229
|
+
maxHours?: number;
|
|
230
|
+
maxRetries?: number;
|
|
231
|
+
after?: string;
|
|
232
|
+
agentSlug?: string;
|
|
233
|
+
successCriteria?: string[];
|
|
234
|
+
alwaysDeliver?: boolean;
|
|
235
|
+
context?: string;
|
|
236
|
+
preCheck?: string;
|
|
237
|
+
attachments?: string[];
|
|
238
|
+
requiresConfirmation?: boolean;
|
|
239
|
+
confirmationTimeoutMin?: number;
|
|
240
|
+
}
|
|
241
|
+
export type TerminalReason = 'blocking_limit' | 'rapid_refill_breaker' | 'prompt_too_long' | 'image_error' | 'model_error' | 'aborted_streaming' | 'aborted_tools' | 'stop_hook_prevented' | 'hook_stopped' | 'tool_deferred' | 'max_turns' | 'completed';
|
|
242
|
+
export interface CronRunEntry {
|
|
243
|
+
jobName: string;
|
|
244
|
+
startedAt: string;
|
|
245
|
+
finishedAt: string;
|
|
246
|
+
status: 'ok' | 'error' | 'retried' | 'skipped';
|
|
247
|
+
durationMs: number;
|
|
248
|
+
error?: string;
|
|
249
|
+
errorType?: 'transient' | 'permanent';
|
|
250
|
+
terminalReason?: TerminalReason;
|
|
251
|
+
attempt: number;
|
|
252
|
+
outputPreview?: string;
|
|
253
|
+
deliveryFailed?: boolean;
|
|
254
|
+
deliveryError?: string;
|
|
255
|
+
advisorApplied?: {
|
|
256
|
+
adjustedMaxTurns?: number;
|
|
257
|
+
adjustedModel?: string;
|
|
258
|
+
adjustedTimeoutMs?: number;
|
|
259
|
+
enriched?: boolean;
|
|
260
|
+
escalated?: boolean;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
export interface Models {
|
|
264
|
+
haiku: string;
|
|
265
|
+
sonnet: string;
|
|
266
|
+
opus: string;
|
|
267
|
+
}
|
|
268
|
+
export interface TranscriptTurn {
|
|
269
|
+
sessionKey: string;
|
|
270
|
+
role: string;
|
|
271
|
+
content: string;
|
|
272
|
+
model: string;
|
|
273
|
+
createdAt: string;
|
|
274
|
+
}
|
|
275
|
+
export interface SessionSummary {
|
|
276
|
+
sessionKey: string;
|
|
277
|
+
summary: string;
|
|
278
|
+
exchangeCount: number;
|
|
279
|
+
createdAt: string;
|
|
280
|
+
}
|
|
281
|
+
export interface WikilinkConnection {
|
|
282
|
+
direction: 'incoming' | 'outgoing';
|
|
283
|
+
file: string;
|
|
284
|
+
context: string;
|
|
285
|
+
}
|
|
286
|
+
export interface MemoryExtraction {
|
|
287
|
+
id?: number;
|
|
288
|
+
sessionKey: string;
|
|
289
|
+
userMessage: string;
|
|
290
|
+
toolName: string;
|
|
291
|
+
toolInput: string;
|
|
292
|
+
extractedAt: string;
|
|
293
|
+
status: 'active' | 'corrected' | 'dismissed' | 'dedup_skipped';
|
|
294
|
+
correction?: string;
|
|
295
|
+
agentSlug?: string;
|
|
296
|
+
}
|
|
297
|
+
export interface Feedback {
|
|
298
|
+
id?: number;
|
|
299
|
+
sessionKey?: string;
|
|
300
|
+
channel: string;
|
|
301
|
+
messageSnippet?: string;
|
|
302
|
+
responseSnippet?: string;
|
|
303
|
+
rating: 'positive' | 'negative' | 'mixed';
|
|
304
|
+
comment?: string;
|
|
305
|
+
createdAt?: string;
|
|
306
|
+
}
|
|
307
|
+
export interface BehavioralCorrection {
|
|
308
|
+
correction: string;
|
|
309
|
+
category: 'verbosity' | 'tone' | 'workflow' | 'format' | 'accuracy' | 'proactivity' | 'scope';
|
|
310
|
+
strength: 'explicit' | 'implicit';
|
|
311
|
+
}
|
|
312
|
+
export interface PreferenceLearned {
|
|
313
|
+
preference: string;
|
|
314
|
+
confidence: 'high' | 'medium' | 'low';
|
|
315
|
+
}
|
|
316
|
+
export interface SessionReflection {
|
|
317
|
+
id?: number;
|
|
318
|
+
sessionKey: string;
|
|
319
|
+
exchangeCount: number;
|
|
320
|
+
frictionSignals: string[];
|
|
321
|
+
qualityScore: number;
|
|
322
|
+
behavioralCorrections: BehavioralCorrection[];
|
|
323
|
+
preferencesLearned: PreferenceLearned[];
|
|
324
|
+
agentSlug?: string;
|
|
325
|
+
createdAt?: string;
|
|
326
|
+
}
|
|
327
|
+
export interface ManagedMcpServer {
|
|
328
|
+
name: string;
|
|
329
|
+
type: 'stdio' | 'http' | 'sse';
|
|
330
|
+
command?: string;
|
|
331
|
+
args?: string[];
|
|
332
|
+
url?: string;
|
|
333
|
+
headers?: Record<string, string>;
|
|
334
|
+
env?: Record<string, string>;
|
|
335
|
+
description: string;
|
|
336
|
+
enabled: boolean;
|
|
337
|
+
source: 'auto-detected' | 'user';
|
|
338
|
+
}
|
|
339
|
+
export interface UserModelUpdate {
|
|
340
|
+
field: string;
|
|
341
|
+
value: string;
|
|
342
|
+
evidence: string;
|
|
343
|
+
confidence: 'high' | 'medium' | 'low';
|
|
344
|
+
}
|
|
345
|
+
export interface SkillDocument {
|
|
346
|
+
name: string;
|
|
347
|
+
title: string;
|
|
348
|
+
description: string;
|
|
349
|
+
triggers: string[];
|
|
350
|
+
source: 'unleashed' | 'cron' | 'chat' | 'manual';
|
|
351
|
+
sourceJob?: string;
|
|
352
|
+
agentSlug?: string;
|
|
353
|
+
steps: string;
|
|
354
|
+
toolsUsed: string[];
|
|
355
|
+
useCount: number;
|
|
356
|
+
lastUsed?: string;
|
|
357
|
+
createdAt: string;
|
|
358
|
+
updatedAt: string;
|
|
359
|
+
}
|
|
360
|
+
export interface PlanStep {
|
|
361
|
+
id: string;
|
|
362
|
+
description: string;
|
|
363
|
+
prompt: string;
|
|
364
|
+
dependsOn: string[];
|
|
365
|
+
maxTurns: number;
|
|
366
|
+
tier: number;
|
|
367
|
+
model?: string;
|
|
368
|
+
delegateTo?: string;
|
|
369
|
+
}
|
|
370
|
+
export interface ExecutionPlan {
|
|
371
|
+
goal: string;
|
|
372
|
+
steps: PlanStep[];
|
|
373
|
+
synthesisPrompt: string;
|
|
374
|
+
}
|
|
375
|
+
export interface PlanProgressUpdate {
|
|
376
|
+
stepId: string;
|
|
377
|
+
status: 'waiting' | 'running' | 'done' | 'failed';
|
|
378
|
+
description: string;
|
|
379
|
+
durationMs?: number;
|
|
380
|
+
resultPreview?: string;
|
|
381
|
+
}
|
|
382
|
+
export interface WorkflowInput {
|
|
383
|
+
type: 'string' | 'number';
|
|
384
|
+
default?: string;
|
|
385
|
+
description?: string;
|
|
386
|
+
}
|
|
387
|
+
export interface WorkflowStep {
|
|
388
|
+
id: string;
|
|
389
|
+
prompt: string;
|
|
390
|
+
dependsOn: string[];
|
|
391
|
+
model?: string;
|
|
392
|
+
tier: number;
|
|
393
|
+
maxTurns: number;
|
|
394
|
+
workDir?: string;
|
|
395
|
+
}
|
|
396
|
+
export interface WorkflowDefinition {
|
|
397
|
+
name: string;
|
|
398
|
+
description: string;
|
|
399
|
+
enabled: boolean;
|
|
400
|
+
trigger: {
|
|
401
|
+
schedule?: string;
|
|
402
|
+
manual?: boolean;
|
|
403
|
+
};
|
|
404
|
+
inputs: Record<string, WorkflowInput>;
|
|
405
|
+
steps: WorkflowStep[];
|
|
406
|
+
synthesis?: {
|
|
407
|
+
prompt: string;
|
|
408
|
+
};
|
|
409
|
+
sourceFile: string;
|
|
410
|
+
agentSlug?: string;
|
|
411
|
+
}
|
|
412
|
+
export interface WorkflowRunEntry {
|
|
413
|
+
workflowName: string;
|
|
414
|
+
runId: string;
|
|
415
|
+
startedAt: string;
|
|
416
|
+
finishedAt: string;
|
|
417
|
+
status: 'ok' | 'error' | 'partial';
|
|
418
|
+
durationMs: number;
|
|
419
|
+
inputs: Record<string, string>;
|
|
420
|
+
stepResults: Array<{
|
|
421
|
+
stepId: string;
|
|
422
|
+
status: 'done' | 'failed' | 'skipped';
|
|
423
|
+
durationMs: number;
|
|
424
|
+
outputPreview?: string;
|
|
425
|
+
}>;
|
|
426
|
+
outputPreview?: string;
|
|
427
|
+
error?: string;
|
|
428
|
+
}
|
|
429
|
+
export interface SelfImproveExperiment {
|
|
430
|
+
id: string;
|
|
431
|
+
iteration: number;
|
|
432
|
+
startedAt: string;
|
|
433
|
+
finishedAt: string;
|
|
434
|
+
durationMs: number;
|
|
435
|
+
area: 'soul' | 'cron' | 'workflow' | 'memory' | 'agent' | 'source' | 'communication' | 'goal';
|
|
436
|
+
target: string;
|
|
437
|
+
hypothesis: string;
|
|
438
|
+
proposedChange: string;
|
|
439
|
+
baselineScore: number;
|
|
440
|
+
score: number;
|
|
441
|
+
accepted: boolean;
|
|
442
|
+
approvalStatus: 'pending' | 'approved' | 'denied' | 'expired';
|
|
443
|
+
reason: string;
|
|
444
|
+
error?: string;
|
|
445
|
+
}
|
|
446
|
+
/** Tracks a versioned evolution change for rollback chains. */
|
|
447
|
+
export interface EvolutionVersion {
|
|
448
|
+
experimentId: string;
|
|
449
|
+
area: string;
|
|
450
|
+
target: string;
|
|
451
|
+
appliedAt: string;
|
|
452
|
+
parentVersion?: string;
|
|
453
|
+
rationale: string;
|
|
454
|
+
beforeSnapshot: string;
|
|
455
|
+
rolledBack?: boolean;
|
|
456
|
+
rolledBackAt?: string;
|
|
457
|
+
}
|
|
458
|
+
export interface SelfImproveState {
|
|
459
|
+
status: 'idle' | 'running' | 'completed' | 'failed';
|
|
460
|
+
lastRunAt: string;
|
|
461
|
+
currentIteration: number;
|
|
462
|
+
totalExperiments: number;
|
|
463
|
+
baselineMetrics: {
|
|
464
|
+
feedbackPositiveRatio: number;
|
|
465
|
+
cronSuccessRate: number;
|
|
466
|
+
avgResponseQuality: number;
|
|
467
|
+
};
|
|
468
|
+
pendingApprovals: number;
|
|
469
|
+
/** Version lineage for applied changes — enables rollback chains. */
|
|
470
|
+
evolutionVersions?: EvolutionVersion[];
|
|
471
|
+
/** Set when the loop aborted due to a persistent infrastructure error. */
|
|
472
|
+
infraError?: {
|
|
473
|
+
category: string;
|
|
474
|
+
diagnostic: string;
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
export interface SelfImproveConfig {
|
|
478
|
+
maxIterations: number;
|
|
479
|
+
iterationBudgetMs: number;
|
|
480
|
+
maxDurationMs: number;
|
|
481
|
+
acceptThreshold: number;
|
|
482
|
+
plateauLimit: number;
|
|
483
|
+
areas: ('soul' | 'cron' | 'workflow' | 'memory' | 'agent' | 'source' | 'communication' | 'goal')[];
|
|
484
|
+
/** Enable tiered auto-apply: low-risk changes apply without approval. Default: false. */
|
|
485
|
+
autoApply?: boolean;
|
|
486
|
+
/** Target a specific agent slug (for per-agent improvement cycles). */
|
|
487
|
+
agentSlug?: string;
|
|
488
|
+
/** How to handle source code proposals. 'skip' = drop silently, 'propose-only' = save for human review. Default: 'propose-only'. */
|
|
489
|
+
sourceMode?: 'skip' | 'propose-only';
|
|
490
|
+
}
|
|
491
|
+
export interface RestartSentinel {
|
|
492
|
+
previousPid: number;
|
|
493
|
+
restartedAt: string;
|
|
494
|
+
reason: 'source-edit' | 'update' | 'manual';
|
|
495
|
+
sourceChangeId?: string;
|
|
496
|
+
sessionKey?: string;
|
|
497
|
+
changedFiles?: string[];
|
|
498
|
+
updateDetails?: {
|
|
499
|
+
commitHash?: string;
|
|
500
|
+
commitDate?: string;
|
|
501
|
+
commitsBehind?: number;
|
|
502
|
+
summary?: string;
|
|
503
|
+
modsReapplied?: number;
|
|
504
|
+
modsSuperseded?: number;
|
|
505
|
+
modsNeedReconciliation?: number;
|
|
506
|
+
modsFailed?: number;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
export interface EntityNode {
|
|
510
|
+
label: string;
|
|
511
|
+
id: string;
|
|
512
|
+
properties: Record<string, any>;
|
|
513
|
+
}
|
|
514
|
+
export interface EntityRef {
|
|
515
|
+
label: string;
|
|
516
|
+
id: string;
|
|
517
|
+
}
|
|
518
|
+
export interface RelationshipTriplet {
|
|
519
|
+
from: EntityRef;
|
|
520
|
+
rel: string;
|
|
521
|
+
to: EntityRef;
|
|
522
|
+
context?: string;
|
|
523
|
+
validFrom?: string | null;
|
|
524
|
+
validTo?: string | null;
|
|
525
|
+
}
|
|
526
|
+
export interface TraversalResult {
|
|
527
|
+
entity: EntityNode;
|
|
528
|
+
depth: number;
|
|
529
|
+
path: string[];
|
|
530
|
+
}
|
|
531
|
+
export interface PathResult {
|
|
532
|
+
nodes: EntityNode[];
|
|
533
|
+
relationships: string[];
|
|
534
|
+
length: number;
|
|
535
|
+
}
|
|
536
|
+
export interface GraphSyncStats {
|
|
537
|
+
nodesCreated: number;
|
|
538
|
+
relationshipsCreated: number;
|
|
539
|
+
duration: number;
|
|
540
|
+
}
|
|
541
|
+
export interface PersistentGoal {
|
|
542
|
+
id: string;
|
|
543
|
+
title: string;
|
|
544
|
+
description: string;
|
|
545
|
+
status: 'active' | 'paused' | 'completed' | 'blocked';
|
|
546
|
+
owner: string;
|
|
547
|
+
priority: 'high' | 'medium' | 'low';
|
|
548
|
+
createdAt: string;
|
|
549
|
+
updatedAt: string;
|
|
550
|
+
targetDate?: string;
|
|
551
|
+
progressNotes: string[];
|
|
552
|
+
nextActions: string[];
|
|
553
|
+
blockers?: string[];
|
|
554
|
+
reviewFrequency: 'daily' | 'weekly' | 'on-demand';
|
|
555
|
+
linkedCronJobs?: string[];
|
|
556
|
+
autoSchedule?: boolean;
|
|
557
|
+
}
|
|
558
|
+
export interface GoalProgressEntry {
|
|
559
|
+
timestamp: string;
|
|
560
|
+
goalId: string;
|
|
561
|
+
focus: string;
|
|
562
|
+
source: string;
|
|
563
|
+
madeProgress: boolean;
|
|
564
|
+
newProgressNotes: number;
|
|
565
|
+
resultSnippet: string;
|
|
566
|
+
status: 'progress' | 'no-change' | 'error';
|
|
567
|
+
}
|
|
568
|
+
export interface CronProgress {
|
|
569
|
+
jobName: string;
|
|
570
|
+
lastRunAt: string;
|
|
571
|
+
runCount: number;
|
|
572
|
+
state: Record<string, unknown>;
|
|
573
|
+
completedItems: string[];
|
|
574
|
+
pendingItems: string[];
|
|
575
|
+
notes: string;
|
|
576
|
+
}
|
|
577
|
+
export interface DelegatedTask {
|
|
578
|
+
id: string;
|
|
579
|
+
fromAgent: string;
|
|
580
|
+
toAgent: string;
|
|
581
|
+
task: string;
|
|
582
|
+
expectedOutput: string;
|
|
583
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
584
|
+
createdAt: string;
|
|
585
|
+
updatedAt: string;
|
|
586
|
+
result?: string;
|
|
587
|
+
goalId?: string;
|
|
588
|
+
}
|
|
589
|
+
export type VerboseLevel = 'quiet' | 'normal' | 'detailed';
|
|
590
|
+
export interface ExecutionAdvice {
|
|
591
|
+
adjustedMaxTurns: number | null;
|
|
592
|
+
adjustedModel: string | null;
|
|
593
|
+
adjustedTimeoutMs: number | null;
|
|
594
|
+
promptEnrichment: string;
|
|
595
|
+
shouldEscalate: boolean;
|
|
596
|
+
escalationReason?: string;
|
|
597
|
+
shouldSkip: boolean;
|
|
598
|
+
skipReason?: string;
|
|
599
|
+
}
|
|
600
|
+
export interface AdvisorDecision {
|
|
601
|
+
jobName: string;
|
|
602
|
+
timestamp: string;
|
|
603
|
+
advice: ExecutionAdvice;
|
|
604
|
+
originalModel?: string;
|
|
605
|
+
originalMaxTurns?: number;
|
|
606
|
+
runOutcome?: 'ok' | 'error' | 'skipped';
|
|
607
|
+
runDurationMs?: number;
|
|
608
|
+
}
|
|
609
|
+
export interface DailyPlanPriority {
|
|
610
|
+
type: 'goal' | 'task' | 'cron-fix' | 'inbox';
|
|
611
|
+
id: string;
|
|
612
|
+
action: string;
|
|
613
|
+
urgency: number;
|
|
614
|
+
}
|
|
615
|
+
export interface DailyPlan {
|
|
616
|
+
date: string;
|
|
617
|
+
createdAt: string;
|
|
618
|
+
priorities: DailyPlanPriority[];
|
|
619
|
+
suggestedCronChanges: Array<{
|
|
620
|
+
job: string;
|
|
621
|
+
change: string;
|
|
622
|
+
reason: string;
|
|
623
|
+
}>;
|
|
624
|
+
newWork: Array<{
|
|
625
|
+
description: string;
|
|
626
|
+
goalId?: string;
|
|
627
|
+
suggestedSchedule?: string;
|
|
628
|
+
}>;
|
|
629
|
+
summary: string;
|
|
630
|
+
}
|
|
631
|
+
export interface RemoteAccessConfig {
|
|
632
|
+
enabled: boolean;
|
|
633
|
+
authToken: string;
|
|
634
|
+
tunnelUrl?: string;
|
|
635
|
+
autoPost: boolean;
|
|
636
|
+
lastStarted?: string;
|
|
637
|
+
}
|
|
638
|
+
export interface ConfigRevision {
|
|
639
|
+
id?: number;
|
|
640
|
+
agentSlug: string;
|
|
641
|
+
fileName: string;
|
|
642
|
+
content: string;
|
|
643
|
+
changedBy?: string;
|
|
644
|
+
createdAt?: string;
|
|
645
|
+
}
|
|
646
|
+
export interface Lead {
|
|
647
|
+
id?: number;
|
|
648
|
+
agentSlug: string;
|
|
649
|
+
email: string;
|
|
650
|
+
name: string;
|
|
651
|
+
company?: string;
|
|
652
|
+
title?: string;
|
|
653
|
+
status: 'new' | 'contacted' | 'replied' | 'qualified' | 'meeting_booked' | 'won' | 'lost' | 'opted_out';
|
|
654
|
+
source?: string;
|
|
655
|
+
sfId?: string;
|
|
656
|
+
metadata?: Record<string, unknown>;
|
|
657
|
+
createdAt?: string;
|
|
658
|
+
updatedAt?: string;
|
|
659
|
+
}
|
|
660
|
+
export interface SequenceEnrollment {
|
|
661
|
+
id?: number;
|
|
662
|
+
leadId: number;
|
|
663
|
+
sequenceName: string;
|
|
664
|
+
currentStep: number;
|
|
665
|
+
status: 'active' | 'paused' | 'replied' | 'completed' | 'opted_out';
|
|
666
|
+
nextStepDueAt?: string;
|
|
667
|
+
startedAt?: string;
|
|
668
|
+
updatedAt?: string;
|
|
669
|
+
}
|
|
670
|
+
export interface Activity {
|
|
671
|
+
id?: number;
|
|
672
|
+
leadId?: number;
|
|
673
|
+
agentSlug: string;
|
|
674
|
+
type: 'email_sent' | 'email_received' | 'meeting_booked' | 'call' | 'note' | 'status_change';
|
|
675
|
+
subject?: string;
|
|
676
|
+
detail?: string;
|
|
677
|
+
templateUsed?: string;
|
|
678
|
+
performedAt?: string;
|
|
679
|
+
}
|
|
680
|
+
export interface SuppressionEntry {
|
|
681
|
+
id?: number;
|
|
682
|
+
email: string;
|
|
683
|
+
reason: 'unsubscribe' | 'bounce' | 'manual' | 'complaint';
|
|
684
|
+
addedAt?: string;
|
|
685
|
+
addedBy?: string;
|
|
686
|
+
}
|
|
687
|
+
export interface ApprovalRequest {
|
|
688
|
+
id?: number;
|
|
689
|
+
agentSlug: string;
|
|
690
|
+
actionType: 'email_send' | 'sequence_start' | 'escalation';
|
|
691
|
+
summary: string;
|
|
692
|
+
detail?: Record<string, unknown>;
|
|
693
|
+
status: 'pending' | 'approved' | 'rejected';
|
|
694
|
+
requestedAt?: string;
|
|
695
|
+
resolvedAt?: string;
|
|
696
|
+
resolvedBy?: string;
|
|
697
|
+
}
|
|
698
|
+
export interface SfSyncRecord {
|
|
699
|
+
id?: number;
|
|
700
|
+
localTable: 'leads' | 'activities';
|
|
701
|
+
localId: number;
|
|
702
|
+
sfObjectType: 'Lead' | 'Contact' | 'Opportunity' | 'Task' | 'Event';
|
|
703
|
+
sfId: string;
|
|
704
|
+
syncDirection: 'push' | 'pull';
|
|
705
|
+
syncedAt?: string;
|
|
706
|
+
syncStatus: 'success' | 'error' | 'conflict';
|
|
707
|
+
errorMessage?: string;
|
|
708
|
+
}
|
|
709
|
+
export interface SfFieldMapping {
|
|
710
|
+
localField: string;
|
|
711
|
+
sfField: string;
|
|
712
|
+
direction: 'bidirectional' | 'push-only' | 'pull-only';
|
|
713
|
+
}
|
|
714
|
+
type float = number;
|
|
715
|
+
export {};
|
|
716
|
+
//# sourceMappingURL=types.d.ts.map
|