clementine-agent 1.18.48 → 1.18.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/assistant.d.ts +1 -100
- package/dist/agent/assistant.js +96 -3311
- package/dist/agent/run-agent-cron.js +5 -14
- package/dist/agent/wave-scheduler.d.ts +21 -0
- package/dist/agent/wave-scheduler.js +72 -0
- package/dist/agent/workflow-runner.d.ts +2 -2
- package/dist/agent/workflow-runner.js +3 -3
- package/dist/channels/discord-agent-bot.js +1 -80
- package/dist/channels/discord.js +4 -108
- package/dist/gateway/cron-scheduler.js +4 -129
- package/dist/gateway/router.d.ts +2 -21
- package/dist/gateway/router.js +141 -888
- package/package.json +1 -1
- package/dist/agent/complexity-classifier.d.ts +0 -37
- package/dist/agent/complexity-classifier.js +0 -209
- package/dist/agent/fanout-policy.d.ts +0 -92
- package/dist/agent/fanout-policy.js +0 -243
- package/dist/agent/orchestrator.d.ts +0 -88
- package/dist/agent/orchestrator.js +0 -862
- package/dist/gateway/long-task-preflight.d.ts +0 -30
- package/dist/gateway/long-task-preflight.js +0 -290
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
* - Session expiry: sessions expire after 24 hours of inactivity
|
|
10
10
|
* - Env isolation: Claude subprocess doesn't see credential env vars
|
|
11
11
|
*/
|
|
12
|
-
import type { AgentProfile
|
|
12
|
+
import type { AgentProfile } from '../types.js';
|
|
13
13
|
import { AgentManager } from './agent-manager.js';
|
|
14
|
-
import { type ToolsetName } from './toolsets.js';
|
|
15
14
|
/**
|
|
16
15
|
* Estimate token count for Claude.
|
|
17
16
|
*
|
|
@@ -80,9 +79,6 @@ export declare class PersonalAssistant {
|
|
|
80
79
|
private _lastDailyNotePath;
|
|
81
80
|
private memoryStore;
|
|
82
81
|
private _lastUserMessage?;
|
|
83
|
-
private onUnleashedComplete;
|
|
84
|
-
private onPhaseComplete;
|
|
85
|
-
private onPhaseProgress;
|
|
86
82
|
onSkillProposed: ((skill: import('../types.js').SkillDocument) => void) | null;
|
|
87
83
|
private _lastMcpStatus;
|
|
88
84
|
private _lastMcpStatusTime;
|
|
@@ -91,8 +87,6 @@ export declare class PersonalAssistant {
|
|
|
91
87
|
/** Per-session stall nudge — set after a query shows stall signals, consumed on the next query. */
|
|
92
88
|
private stallNudges;
|
|
93
89
|
/** Last contradiction finding per session, consumed by the session transcript writer to splice a correction note. */
|
|
94
|
-
private _lastContradictionFinding;
|
|
95
|
-
private _compactedSessions;
|
|
96
90
|
/** Last auto-matched project per session — exposed for CLI display. */
|
|
97
91
|
private _lastMatchedProject;
|
|
98
92
|
/**
|
|
@@ -100,7 +94,6 @@ export declare class PersonalAssistant {
|
|
|
100
94
|
* post-response outcome scorer can check which actually got referenced.
|
|
101
95
|
* Cleared after each scoring pass.
|
|
102
96
|
*/
|
|
103
|
-
private _lastRetrievedChunks;
|
|
104
97
|
/** Lazy-built SessionStore adapter that mirrors SDK transcripts to SQLite. */
|
|
105
98
|
private _sessionStore;
|
|
106
99
|
/** Hot correction buffer — explicit behavioral corrections applied before nightly SI. */
|
|
@@ -109,11 +102,6 @@ export declare class PersonalAssistant {
|
|
|
109
102
|
private initPromptWatchers;
|
|
110
103
|
/** Log SDK result metrics and store usage. Shared across all query methods. */
|
|
111
104
|
private logQueryResult;
|
|
112
|
-
/** Capture MCP server status from system init messages. */
|
|
113
|
-
private captureMcpStatus;
|
|
114
|
-
setUnleashedCompleteCallback(cb: (jobName: string, result: string) => void): void;
|
|
115
|
-
setPhaseCompleteCallback(cb: (jobName: string, phase: number, totalPhases: number, output: string) => void): void;
|
|
116
|
-
setPhaseProgressCallback(cb: (jobName: string, phase: number, summary: string) => void): void;
|
|
117
105
|
setSkillProposedCallback(cb: (skill: import('../types.js').SkillDocument) => void): void;
|
|
118
106
|
getMcpStatus(): {
|
|
119
107
|
servers: Array<{
|
|
@@ -153,45 +141,6 @@ export declare class PersonalAssistant {
|
|
|
153
141
|
getMemoryChunkCount(): number;
|
|
154
142
|
private buildSystemPrompt;
|
|
155
143
|
private buildOptions;
|
|
156
|
-
private retrieveContext;
|
|
157
|
-
/** Cached active goals — avoids N file reads per query. Refreshes every 30s. */
|
|
158
|
-
private _goalCache;
|
|
159
|
-
private static readonly GOAL_CACHE_TTL_MS;
|
|
160
|
-
private loadGoalsFromCache;
|
|
161
|
-
/**
|
|
162
|
-
* Match a user message against active goals by keyword overlap.
|
|
163
|
-
* Returns formatted goal status block for injection into system prompt,
|
|
164
|
-
* or empty string if no goals match.
|
|
165
|
-
*/
|
|
166
|
-
private matchGoals;
|
|
167
|
-
/**
|
|
168
|
-
* Compact always-on block of active goals. Used when no keyword match
|
|
169
|
-
* fires so the agent still sees what it's supposed to be working on.
|
|
170
|
-
* Scoped: for agent sessions, includes that agent's goals plus any
|
|
171
|
-
* clementine-owned goals it might contribute to.
|
|
172
|
-
*/
|
|
173
|
-
private formatActiveGoalsBlock;
|
|
174
|
-
chat(text: string, sessionKey?: string | null, options?: {
|
|
175
|
-
onText?: OnTextCallback;
|
|
176
|
-
onToolActivity?: OnToolActivityCallback;
|
|
177
|
-
model?: string;
|
|
178
|
-
maxTurns?: number;
|
|
179
|
-
profile?: AgentProfile;
|
|
180
|
-
securityAnnotation?: string;
|
|
181
|
-
projectOverride?: ProjectMeta;
|
|
182
|
-
verboseLevel?: VerboseLevel;
|
|
183
|
-
abortController?: AbortController;
|
|
184
|
-
toolset?: ToolsetName;
|
|
185
|
-
}): Promise<[string, string]>;
|
|
186
|
-
/**
|
|
187
|
-
* Compare retrieved chunks against the response text and record which
|
|
188
|
-
* were referenced. Uses a distinctive-token overlap heuristic — cheap,
|
|
189
|
-
* deterministic, no extra LLM calls. Called right after a turn completes.
|
|
190
|
-
*/
|
|
191
|
-
private scoreRetrievalOutcomes;
|
|
192
|
-
private static readonly RATE_LIMIT_MAX_RETRIES;
|
|
193
|
-
private static readonly RATE_LIMIT_BACKOFF;
|
|
194
|
-
private runQuery;
|
|
195
144
|
/**
|
|
196
145
|
* Compact a session's context when nearing the context window limit.
|
|
197
146
|
*
|
|
@@ -208,11 +157,6 @@ export declare class PersonalAssistant {
|
|
|
208
157
|
summary?: string;
|
|
209
158
|
reason: string;
|
|
210
159
|
};
|
|
211
|
-
/**
|
|
212
|
-
* Expire sessions inactive for more than 24 hours.
|
|
213
|
-
* Called periodically from chat() to prevent unbounded map growth.
|
|
214
|
-
*/
|
|
215
|
-
private expireOldSessions;
|
|
216
160
|
/**
|
|
217
161
|
* Build an instant local summary from in-memory exchange history.
|
|
218
162
|
* No LLM call — returns immediately. Used during session rotation
|
|
@@ -227,36 +171,10 @@ export declare class PersonalAssistant {
|
|
|
227
171
|
* (which represent in-flight messages with no reply yet).
|
|
228
172
|
*/
|
|
229
173
|
private pairTranscriptTurns;
|
|
230
|
-
/**
|
|
231
|
-
* Build a short summary of older turns (older than what's already cached
|
|
232
|
-
* in `lastExchanges`) for restart-restore prompt injection. Returns ''
|
|
233
|
-
* if there's nothing older or no memory store. Capped at 600 chars.
|
|
234
|
-
*/
|
|
235
|
-
private buildOlderTurnsContext;
|
|
236
|
-
/**
|
|
237
|
-
* Reconstruct context after the SDK reports the session is dead
|
|
238
|
-
* ("no conversation found"). Pulls last N turns from the transcripts
|
|
239
|
-
* table (hydrating `lastExchanges` if the cache is too thin) and
|
|
240
|
-
* builds a recovery prefix that gets prepended to the retry prompt.
|
|
241
|
-
* Mirrors the buildContextRecoveredPrompt pattern used by autocompact.
|
|
242
|
-
*/
|
|
243
|
-
private buildSessionDeathRecoveryPrompt;
|
|
244
|
-
/**
|
|
245
|
-
* Auto-save a lightweight handoff file when a session rotates.
|
|
246
|
-
* Uses in-memory exchange history — no LLM call.
|
|
247
|
-
*/
|
|
248
|
-
private saveAutoHandoff;
|
|
249
|
-
/**
|
|
250
|
-
* Load a handoff file for a session if one exists.
|
|
251
|
-
* Returns formatted context string or empty string.
|
|
252
|
-
*/
|
|
253
|
-
private loadHandoff;
|
|
254
174
|
/**
|
|
255
175
|
* Run an LLM summary in the background and save to memoryStore.
|
|
256
176
|
* Does not block the caller — for future retrieval context only.
|
|
257
177
|
*/
|
|
258
|
-
private summarizeSessionAsync;
|
|
259
|
-
private summarizeSession;
|
|
260
178
|
/**
|
|
261
179
|
* Parse a structured checkpoint from an unleashed phase's STATUS SUMMARY output.
|
|
262
180
|
* Returns null if no recognizable structure is found.
|
|
@@ -270,10 +188,6 @@ export declare class PersonalAssistant {
|
|
|
270
188
|
} | null;
|
|
271
189
|
/** Fire-and-forget: extract a reusable skill from a successful execution. */
|
|
272
190
|
private extractSkillFromExecution;
|
|
273
|
-
private preRotationFlush;
|
|
274
|
-
private lastExtractionTimes;
|
|
275
|
-
private memoryExtractionKey;
|
|
276
|
-
private assessMemoryExtraction;
|
|
277
191
|
private logMemoryExtractionSkip;
|
|
278
192
|
/**
|
|
279
193
|
* Public entry point for triggering auto-memory extraction after an
|
|
@@ -298,7 +212,6 @@ export declare class PersonalAssistant {
|
|
|
298
212
|
private spawnMemoryExtraction;
|
|
299
213
|
private static readonly MEMORY_TOOL_NAMES;
|
|
300
214
|
private extractMemory;
|
|
301
|
-
heartbeat(standingInstructions: string, changesSummary?: string, timeContext?: string, dedupContext?: string, profile?: AgentProfile | null): Promise<string>;
|
|
302
215
|
runPlanStep(stepId: string, prompt: string, opts?: {
|
|
303
216
|
tier?: number;
|
|
304
217
|
maxTurns?: number;
|
|
@@ -315,9 +228,6 @@ export declare class PersonalAssistant {
|
|
|
315
228
|
usageLabel?: string;
|
|
316
229
|
usageAgentSlug?: string;
|
|
317
230
|
}): Promise<string>;
|
|
318
|
-
runCronJob(jobName: string, jobPrompt: string, tier?: number, maxTurns?: number, model?: string, workDir?: string, timeoutMs?: number, successCriteria?: string[], agentSlug?: string, opts?: {
|
|
319
|
-
disableAllTools?: boolean;
|
|
320
|
-
}): Promise<string>;
|
|
321
231
|
/**
|
|
322
232
|
* Goal-backward verification pass using Haiku after cron job execution.
|
|
323
233
|
* Instead of vague quality ratings, verifies actual outcomes:
|
|
@@ -326,15 +236,6 @@ export declare class PersonalAssistant {
|
|
|
326
236
|
* 3. Does it connect to the goal / produce actionable results? (wired)
|
|
327
237
|
*/
|
|
328
238
|
private runCronReflection;
|
|
329
|
-
runUnleashedTask(jobName: string, jobPrompt: string, tier?: number, maxTurns?: number, model?: string, workDir?: string, maxHours?: number, agentSlug?: string): Promise<string>;
|
|
330
|
-
/**
|
|
331
|
-
* Run a team message as an unleashed-style autonomous task.
|
|
332
|
-
* Gives team agents the same multi-phase execution as cron jobs,
|
|
333
|
-
* instead of being killed by the 5-minute interactive chat timeout.
|
|
334
|
-
*
|
|
335
|
-
* @param onText Streaming callback for real-time progress updates
|
|
336
|
-
*/
|
|
337
|
-
runTeamTask(fromName: string, fromSlug: string, content: string, profile: AgentProfile, onText?: (token: string) => void, externalAbortController?: AbortController): Promise<string>;
|
|
338
239
|
/**
|
|
339
240
|
* Inject a user/assistant exchange into a session's context without running
|
|
340
241
|
* a query. Used to give the DM session visibility of cron/heartbeat outputs
|