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