@aexol/spectral 0.9.156 → 0.9.158

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 (62) hide show
  1. package/dist/auth-helper.d.ts +3 -3
  2. package/dist/auth-helper.d.ts.map +1 -1
  3. package/dist/auth-helper.js +3 -3
  4. package/dist/cli.js +5 -13
  5. package/dist/commands/login.d.ts +1 -1
  6. package/dist/commands/login.js +6 -6
  7. package/dist/commands/serve.d.ts.map +1 -1
  8. package/dist/commands/serve.js +8 -20
  9. package/dist/commands/update.d.ts.map +1 -1
  10. package/dist/commands/update.js +6 -15
  11. package/dist/extensions/browser/index.d.ts +1 -1
  12. package/dist/extensions/browser/index.js +1 -1
  13. package/dist/extensions/image-generation/index.js +1 -1
  14. package/dist/memory/compaction.d.ts +0 -89
  15. package/dist/memory/compaction.d.ts.map +1 -1
  16. package/dist/memory/compaction.js +2 -759
  17. package/dist/memory/hooks/compaction-hook.d.ts.map +1 -1
  18. package/dist/memory/hooks/compaction-hook.js +9 -235
  19. package/dist/memory/prompts.d.ts +0 -4
  20. package/dist/memory/prompts.d.ts.map +1 -1
  21. package/dist/memory/prompts.js +0 -165
  22. package/dist/relay/auto-research.d.ts.map +1 -1
  23. package/dist/relay/auto-research.js +0 -1
  24. package/dist/sdk/ai/env-api-keys.d.ts.map +1 -1
  25. package/dist/sdk/ai/env-api-keys.js +0 -4
  26. package/dist/sdk/ai/models.generated.d.ts +0 -399
  27. package/dist/sdk/ai/models.generated.d.ts.map +1 -1
  28. package/dist/sdk/ai/models.generated.js +0 -395
  29. package/dist/sdk/ai/providers/register-builtins.d.ts +0 -4
  30. package/dist/sdk/ai/providers/register-builtins.d.ts.map +1 -1
  31. package/dist/sdk/ai/providers/register-builtins.js +0 -16
  32. package/dist/sdk/ai/types.d.ts +1 -1
  33. package/dist/sdk/ai/types.d.ts.map +1 -1
  34. package/dist/sdk/ai/utils/oauth/index.d.ts +0 -1
  35. package/dist/sdk/ai/utils/oauth/index.d.ts.map +1 -1
  36. package/dist/sdk/ai/utils/oauth/index.js +0 -3
  37. package/dist/sdk/coding-agent/config.d.ts.map +1 -1
  38. package/dist/sdk/coding-agent/config.js +2 -1
  39. package/dist/sdk/coding-agent/core/agent-session.d.ts.map +1 -1
  40. package/dist/sdk/coding-agent/core/agent-session.js +4 -0
  41. package/dist/sdk/coding-agent/core/extensions/native-extensions.d.ts.map +1 -1
  42. package/dist/sdk/coding-agent/core/extensions/native-extensions.js +0 -10
  43. package/dist/sdk/coding-agent/core/model-resolver.d.ts.map +1 -1
  44. package/dist/sdk/coding-agent/core/model-resolver.js +0 -1
  45. package/dist/server/agent-bridge.d.ts.map +1 -1
  46. package/dist/server/agent-bridge.js +0 -2
  47. package/dist/version.d.ts +4 -0
  48. package/dist/version.d.ts.map +1 -0
  49. package/dist/version.js +88 -0
  50. package/package.json +1 -1
  51. package/dist/extensions/kanban-bridge.d.ts +0 -24
  52. package/dist/extensions/kanban-bridge.d.ts.map +0 -1
  53. package/dist/extensions/kanban-bridge.js +0 -858
  54. package/dist/memory/unified-compaction.d.ts +0 -59
  55. package/dist/memory/unified-compaction.d.ts.map +0 -1
  56. package/dist/memory/unified-compaction.js +0 -332
  57. package/dist/sdk/ai/providers/anthropic.d.ts +0 -54
  58. package/dist/sdk/ai/providers/anthropic.d.ts.map +0 -1
  59. package/dist/sdk/ai/providers/anthropic.js +0 -921
  60. package/dist/sdk/ai/utils/oauth/anthropic.d.ts +0 -25
  61. package/dist/sdk/ai/utils/oauth/anthropic.d.ts.map +0 -1
  62. package/dist/sdk/ai/utils/oauth/anthropic.js +0 -334
@@ -1,59 +0,0 @@
1
- /**
2
- * Unified Compaction — single LLM call replacing both:
3
- * 1. Core spectral generateSummary() (narrative conversation summary)
4
- * 2. Sync catch-up observer (observation extraction from gap entries)
5
- *
6
- * Uses a text-based delimited output format (compatible with any model
7
- * without requiring native structured-output support):
8
- *
9
- * ===NARRATIVE===
10
- * ## Goal
11
- * ...
12
- *
13
- * ===OBSERVATIONS===
14
- * [YYYY-MM-DD HH:MM] [relevance] Content line
15
- * ...
16
- */
17
- import type { AgentMessage, ThinkingLevel } from "../sdk/agent-core/index.js";
18
- import type { Model } from "../sdk/ai/index.js";
19
- import type { ObservationRecord } from "./types.js";
20
- export interface UnifiedCompactionInput {
21
- /** Messages to summarize (from core compaction preparation) */
22
- messagesToSummarize: AgentMessage[];
23
- /** Serialized gap entries as text with source entry labels */
24
- gapChunk?: string;
25
- /** Source entry IDs from gap entries */
26
- gapSourceEntryIds?: string[];
27
- /** Model to use */
28
- model: Model<any>;
29
- /** API key */
30
- apiKey: string;
31
- /** Request headers */
32
- headers?: Record<string, string>;
33
- /** Abort signal */
34
- signal?: AbortSignal;
35
- /** Previous compaction summary for iterative update */
36
- previousSummary?: string;
37
- /** Custom instructions for summarization focus */
38
- customInstructions?: string;
39
- /** Thinking level for reasoning models */
40
- thinkingLevel?: ThinkingLevel;
41
- /** Reserve tokens for prompt + output */
42
- reserveTokens: number;
43
- }
44
- export interface UnifiedCompactionOutput {
45
- /** Markdown narrative summary (for CompactionEntry.summary) */
46
- narrativeSummary: string;
47
- /** Observations extracted from the conversation */
48
- observations: ObservationRecord[];
49
- /** Files read */
50
- readFiles: string[];
51
- /** Files modified */
52
- modifiedFiles: string[];
53
- }
54
- /**
55
- * Generate a unified compaction result: narrative summary + observations
56
- * in a single LLM call. Uses delimited text output for broad model compatibility.
57
- */
58
- export declare function generateUnifiedCompaction(input: UnifiedCompactionInput): Promise<UnifiedCompactionOutput>;
59
- //# sourceMappingURL=unified-compaction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unified-compaction.d.ts","sourceRoot":"","sources":["../../src/memory/unified-compaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAUhD,OAAO,KAAK,EAAE,iBAAiB,EAAa,MAAM,YAAY,CAAC;AAkO/D,MAAM,WAAW,sBAAsB;IACtC,+DAA+D;IAC/D,mBAAmB,EAAE,YAAY,EAAE,CAAC;IACpC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,mBAAmB;IACnB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,mBAAmB;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0CAA0C;IAC1C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACvC,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,iBAAiB;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,qBAAqB;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC9C,KAAK,EAAE,sBAAsB,GAC3B,OAAO,CAAC,uBAAuB,CAAC,CA0IlC"}
@@ -1,332 +0,0 @@
1
- /**
2
- * Unified Compaction — single LLM call replacing both:
3
- * 1. Core spectral generateSummary() (narrative conversation summary)
4
- * 2. Sync catch-up observer (observation extraction from gap entries)
5
- *
6
- * Uses a text-based delimited output format (compatible with any model
7
- * without requiring native structured-output support):
8
- *
9
- * ===NARRATIVE===
10
- * ## Goal
11
- * ...
12
- *
13
- * ===OBSERVATIONS===
14
- * [YYYY-MM-DD HH:MM] [relevance] Content line
15
- * ...
16
- */
17
- import { completeSimple } from "../sdk/ai/index.js";
18
- import { extractFileOpsFromMessage, computeFileLists, createFileOps, formatFileOperations, } from "../sdk/coding-agent/core/compaction/utils.js";
19
- import { hashId } from "./ids.js";
20
- import { nowTimestamp, truncateRecordContent } from "./serialize.js";
21
- import { debugLog } from "./debug-log.js";
22
- // ============================================================================
23
- // Section Delimiters
24
- // ============================================================================
25
- const NARRATIVE_SECTION = "===NARRATIVE===";
26
- const OBSERVATIONS_SECTION = "===OBSERVATIONS===";
27
- // ============================================================================
28
- // Prompt Templates
29
- // ============================================================================
30
- const UNIFIED_SYSTEM_PROMPT = `You are a context compression agent. Your task has TWO complementary outputs that MUST be produced together in a single response.
31
-
32
- TASK A — NARRATIVE SUMMARY: Create a structured checkpoint of the conversation progress. This is what another LLM reads to understand where the work stands.
33
-
34
- TASK B — FACTUAL MEMORY: Extract timestamped observations (single-line facts with relevance tags). These records are the assistant's ONLY memory of this conversation after the raw messages fall out of context.
35
-
36
- Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured result using the EXACT format specified.`;
37
- function buildUnifiedPrompt(conversationText, previousSummary, customInstructions, currentTime) {
38
- let prompt = `<conversation>\n${conversationText}\n</conversation>\n\n`;
39
- if (previousSummary) {
40
- prompt += `<previous-summary>\n${previousSummary}\n</previous-summary>\n\n`;
41
- }
42
- prompt += `Current local time: ${currentTime}\n\n`;
43
- prompt += `Output your response in TWO sections delimited by the exact markers shown below.
44
-
45
- SECTION A — ${NARRATIVE_SECTION}
46
-
47
- Produce a structured context checkpoint summary using this EXACT format:
48
-
49
- ## Goal
50
- [What is the user trying to accomplish? Can be multiple items. If updating a previous summary, preserve existing goals and add new ones.]
51
-
52
- ## Constraints & Preferences
53
- - [Any constraints, preferences, or requirements mentioned by user]
54
- - [Or "(none)" if none were mentioned]
55
- [When updating: preserve existing constraints, add new ones.]
56
-
57
- ## Progress
58
- ### Done
59
- - [x] [Completed tasks/changes. Preserve previously completed items, add newly completed ones.]
60
-
61
- ### In Progress
62
- - [ ] [Current work. Update based on progress.]
63
-
64
- ### Blocked
65
- - [Issues preventing progress, if any. Remove blockers that have been resolved.]
66
-
67
- ## Key Decisions
68
- - **[Decision]**: [Brief rationale]
69
- [Preserve all previous decisions, add new ones.]
70
-
71
- ## Next Steps
72
- 1. [Ordered list of what should happen next. Update based on current state.]
73
-
74
- ## Critical Context
75
- - [Any data, examples, or references needed to continue]
76
- - [Or "(none)" if not applicable]
77
-
78
- Keep each section concise. Preserve exact file paths, function names, and error messages.
79
- ${customInstructions ? `\nAdditional focus for the narrative: ${customInstructions}` : ""}
80
-
81
- SECTION B — ${OBSERVATIONS_SECTION}
82
-
83
- Extract NEW timestamped facts from the conversation. Each observation must be on its own line in this exact format:
84
-
85
- [YYYY-MM-DD HH:MM] [relevance] Single-line plain prose fact. No markdown, no bullets.
86
-
87
- Do NOT restate facts already captured in the <previous-summary>. Skip routine, low-information events (tool-call acks, status updates).
88
-
89
- OBSERVATION CONTENT RULES:
90
- - Single line of plain prose. No markdown, no bullets, no code fences, no XML/HTML tags, no emojis.
91
- - Preserve user assertions exactly. When the user STATES something about themselves, their project, or their environment, capture it as an assertion. When the user ASKS something, capture it as a question.
92
- - Use precise action verbs (completed, resolved, implemented, chose, configured etc.).
93
- - Mark concrete completions explicitly: "completed: implemented X at path/to/file.ts; user confirmed tests pass."
94
- - Split compound statements into separate observations (one fact per line).
95
- - Group repeated similar tool calls into a single observation.
96
- - Preserve exact file paths, function names, line numbers, error messages (verbatim), package names, identifiers.
97
- - Use the timestamp from the closest conversation message. Fall back to the current local time if no message timestamp applies.
98
-
99
- RELEVANCE LEVELS (pick one per observation):
100
- - critical: user identity, role, persistent preferences, explicit corrections, concrete completions that future runs MUST NOT redo.
101
- - high: non-trivial technical decisions, architectural direction, unresolved blockers, key constraints.
102
- - medium: task-level context that helps within the current work. Default when unsure between medium and high.
103
- - low: routine tool-call acks, repetitive status updates, trivially re-derivable content. Skip these unless they carry unique detail.
104
-
105
- Do NOT default everything to "high" or "critical". Most observations should be "medium". Use "low" only for truly routine items.
106
-
107
- Focus areas for observations:
108
- - User identity, preferences, constraints, corrections.
109
- - Project goals, architectural decisions, rationale.
110
- - File paths and line numbers of changes.
111
- - Error messages (verbatim).
112
- - Completed work that should not be redone.
113
- - Named identifiers (package names, function/variable names, ticket IDs, commit SHAs).`;
114
- return prompt;
115
- }
116
- // ============================================================================
117
- // Conversation Serialization
118
- // ============================================================================
119
- const TOOL_RESULT_MAX_CHARS = 2000;
120
- const VISION_DESCRIPTION_PREFIX = "[Image description from ";
121
- function stripVisionBlocks(text) {
122
- if (!text.includes(VISION_DESCRIPTION_PREFIX))
123
- return text;
124
- const lines = text.split("\n");
125
- const kept = [];
126
- let skipping = false;
127
- for (const line of lines) {
128
- if (!skipping && line.startsWith(VISION_DESCRIPTION_PREFIX)) {
129
- skipping = true;
130
- continue;
131
- }
132
- if (skipping) {
133
- if (line === "]") {
134
- skipping = false;
135
- }
136
- continue;
137
- }
138
- kept.push(line);
139
- }
140
- return kept.join("\n").replace(/\n{3,}/g, "\n\n").trim();
141
- }
142
- function serializeMessagesForUnified(messages) {
143
- const parts = [];
144
- for (const msg of messages) {
145
- if (msg.role === "user") {
146
- const content = typeof msg.content === "string"
147
- ? msg.content
148
- : Array.isArray(msg.content)
149
- ? msg.content.filter((c) => c.type === "text").map(c => c.text).join("")
150
- : "";
151
- const cleaned = stripVisionBlocks(content);
152
- if (cleaned)
153
- parts.push(`[User]: ${cleaned}`);
154
- }
155
- else if (msg.role === "assistant" && "content" in msg && Array.isArray(msg.content)) {
156
- const textParts = [];
157
- const toolParts = [];
158
- for (const block of msg.content) {
159
- if (block.type === "text" && "text" in block) {
160
- textParts.push(block.text);
161
- }
162
- else if (block.type === "toolCall" && "name" in block) {
163
- const args = block.arguments;
164
- const argsStr = Object.keys(args).sort().map(k => `${k}=${JSON.stringify(args[k])}`).join(", ");
165
- toolParts.push(`${block.name}(${argsStr})`);
166
- }
167
- }
168
- const combined = [...textParts, ...(toolParts.length ? [`[Tools: ${toolParts.join("; ")}]`] : [])];
169
- if (combined.length)
170
- parts.push(`[Assistant]: ${combined.join("\n")}`);
171
- }
172
- else if (msg.role === "toolResult") {
173
- const text = Array.isArray(msg.content)
174
- ? msg.content.filter((c) => c.type === "text").map(c => c.text).join("")
175
- : typeof msg.content === "string" ? msg.content : "";
176
- if (text) {
177
- const truncated = text.length > TOOL_RESULT_MAX_CHARS
178
- ? `${text.slice(0, TOOL_RESULT_MAX_CHARS)}\n[...truncated]`
179
- : text;
180
- parts.push(`[Tool result]: ${truncated}`);
181
- }
182
- }
183
- else if (msg.role === "compactionSummary" && "summary" in msg) {
184
- parts.push(`[Previous compaction summary]: ${msg.summary}`);
185
- }
186
- }
187
- return parts.join("\n\n");
188
- }
189
- // ============================================================================
190
- // Output Parsing
191
- // ============================================================================
192
- const OBSERVATION_LINE_RE = /^\[(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2})\]\s*\[(low|medium|high|critical)\]\s*(.+)$/i;
193
- function parseObservations(text) {
194
- const results = [];
195
- const lines = text.split("\n");
196
- for (const line of lines) {
197
- const trimmed = line.trim();
198
- if (!trimmed || trimmed.startsWith("#") || trimmed === OBSERVATIONS_SECTION)
199
- continue;
200
- const match = trimmed.match(OBSERVATION_LINE_RE);
201
- if (match) {
202
- results.push({
203
- timestamp: match[1],
204
- relevance: match[2].toLowerCase(),
205
- content: match[3].trim(),
206
- });
207
- }
208
- }
209
- return results;
210
- }
211
- function normalizeObservation(raw) {
212
- const content = truncateRecordContent(raw.content);
213
- if (!content)
214
- return undefined;
215
- const validRelevance = ["low", "medium", "high", "critical"];
216
- const relevance = validRelevance.includes(raw.relevance)
217
- ? raw.relevance
218
- : "medium";
219
- return {
220
- id: hashId(content),
221
- content,
222
- timestamp: raw.timestamp,
223
- relevance,
224
- };
225
- }
226
- /**
227
- * Generate a unified compaction result: narrative summary + observations
228
- * in a single LLM call. Uses delimited text output for broad model compatibility.
229
- */
230
- export async function generateUnifiedCompaction(input) {
231
- const { messagesToSummarize, gapChunk, model, apiKey, headers, signal, previousSummary, customInstructions, thinkingLevel, reserveTokens, } = input;
232
- const maxTokens = Math.min(Math.floor(0.8 * reserveTokens), model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY);
233
- // Build conversation text
234
- const parts = [];
235
- const coreText = serializeMessagesForUnified(messagesToSummarize);
236
- if (coreText)
237
- parts.push(coreText);
238
- if (gapChunk?.trim()) {
239
- parts.push(`\n--- Gap entries (unobserved raw conversation) ---\n${gapChunk}`);
240
- }
241
- const conversationText = parts.join("\n\n");
242
- const currentTime = nowTimestamp();
243
- const userPrompt = buildUnifiedPrompt(conversationText, previousSummary, customInstructions, currentTime);
244
- const promptMessages = [
245
- {
246
- role: "user",
247
- content: [{ type: "text", text: userPrompt }],
248
- timestamp: Date.now(),
249
- },
250
- ];
251
- const options = { maxTokens, signal, apiKey, headers };
252
- if (model.reasoning && thinkingLevel && thinkingLevel !== "off") {
253
- options.reasoning = thinkingLevel;
254
- }
255
- debugLog("unified_compaction.start", {
256
- messageCount: messagesToSummarize.length,
257
- hasGap: !!gapChunk?.trim(),
258
- conversationLength: conversationText.length,
259
- });
260
- const response = await completeSimple(model, { systemPrompt: UNIFIED_SYSTEM_PROMPT, messages: promptMessages }, options);
261
- if (response.stopReason === "error") {
262
- throw new Error(`Unified compaction failed: ${response.errorMessage || "Unknown error"}`);
263
- }
264
- if (response.stopReason === "aborted") {
265
- throw new Error("Unified compaction aborted");
266
- }
267
- const fullText = response.content
268
- .filter((c) => c.type === "text")
269
- .map((c) => c.text)
270
- .join("\n");
271
- // Parse the two sections
272
- const narrativeIdx = fullText.indexOf(NARRATIVE_SECTION);
273
- const obsIdx = fullText.indexOf(OBSERVATIONS_SECTION);
274
- let narrativeSummary;
275
- let rawObservationsText;
276
- if (narrativeIdx >= 0 && obsIdx >= 0) {
277
- // Both sections present
278
- if (narrativeIdx < obsIdx) {
279
- narrativeSummary = fullText.slice(narrativeIdx + NARRATIVE_SECTION.length, obsIdx).trim();
280
- }
281
- else {
282
- narrativeSummary = fullText.slice(narrativeIdx + NARRATIVE_SECTION.length).trim();
283
- }
284
- rawObservationsText = fullText.slice(obsIdx + OBSERVATIONS_SECTION.length).trim();
285
- }
286
- else if (narrativeIdx >= 0) {
287
- // Only narrative
288
- narrativeSummary = fullText.slice(narrativeIdx + NARRATIVE_SECTION.length).trim();
289
- rawObservationsText = "";
290
- }
291
- else if (obsIdx >= 0) {
292
- // Only observations (unusual but handle gracefully)
293
- narrativeSummary = fullText.slice(0, obsIdx).trim();
294
- rawObservationsText = fullText.slice(obsIdx + OBSERVATIONS_SECTION.length).trim();
295
- }
296
- else {
297
- // No delimiters found — treat entire output as narrative
298
- debugLog("unified_compaction.no_delimiters", { textLength: fullText.length });
299
- narrativeSummary = fullText;
300
- rawObservationsText = "";
301
- }
302
- // Parse observations
303
- const rawObservations = parseObservations(rawObservationsText);
304
- const observations = [];
305
- const seen = new Set();
306
- for (const raw of rawObservations) {
307
- const normalized = normalizeObservation(raw);
308
- if (normalized && !seen.has(normalized.id)) {
309
- seen.add(normalized.id);
310
- observations.push(normalized);
311
- }
312
- }
313
- // Compute file operations
314
- const fileOps = createFileOps();
315
- for (const msg of messagesToSummarize) {
316
- extractFileOpsFromMessage(msg, fileOps);
317
- }
318
- const { readFiles, modifiedFiles } = computeFileLists(fileOps);
319
- // Append file operations to narrative
320
- const fullNarrativeSummary = narrativeSummary + formatFileOperations(readFiles, modifiedFiles);
321
- debugLog("unified_compaction.result", {
322
- narrativeLength: fullNarrativeSummary.length,
323
- observationCount: observations.length,
324
- rawObservationLines: rawObservations.length,
325
- });
326
- return {
327
- narrativeSummary: fullNarrativeSummary,
328
- observations,
329
- readFiles,
330
- modifiedFiles,
331
- };
332
- }
@@ -1,54 +0,0 @@
1
- import Anthropic from "@anthropic-ai/sdk";
2
- import type { SimpleStreamOptions, StreamFunction, StreamOptions } from "../types.js";
3
- export type AnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
4
- export type AnthropicThinkingDisplay = "summarized" | "omitted";
5
- export interface AnthropicOptions extends StreamOptions {
6
- /**
7
- * Enable extended thinking.
8
- * For Opus 4.6 and Sonnet 4.6: uses adaptive thinking (model decides when/how much to think).
9
- * For older models: uses budget-based thinking with thinkingBudgetTokens.
10
- */
11
- thinkingEnabled?: boolean;
12
- /**
13
- * Token budget for extended thinking (older models only).
14
- * Ignored for Opus 4.6 and Sonnet 4.6, which use adaptive thinking.
15
- */
16
- thinkingBudgetTokens?: number;
17
- /**
18
- * Effort level for adaptive thinking (Opus 4.6+ and Sonnet 4.6).
19
- * Controls how much thinking Claude allocates:
20
- * - "max": Always thinks with no constraints (Opus 4.6 only)
21
- * - "xhigh": Highest reasoning level (Opus 4.7)
22
- * - "high": Always thinks, deep reasoning (default)
23
- * - "medium": Moderate thinking, may skip for simple queries
24
- * - "low": Minimal thinking, skips for simple tasks
25
- * Ignored for older models.
26
- */
27
- effort?: AnthropicEffort;
28
- /**
29
- * Controls how thinking content is returned in API responses.
30
- * - "summarized": Thinking blocks contain summarized thinking text (default here).
31
- * - "omitted": Thinking blocks return an empty thinking field; the encrypted
32
- * signature still travels back for multi-turn continuity. Use for faster
33
- * time-to-first-text-token when your UI does not surface thinking.
34
- *
35
- * Note: Anthropic's API default for Claude Opus 4.7 and Claude Mythos Preview
36
- * is "omitted". We default to "summarized" here to keep behavior consistent
37
- * with older Claude 4 models. Set this explicitly to "omitted" to opt in.
38
- */
39
- thinkingDisplay?: AnthropicThinkingDisplay;
40
- interleavedThinking?: boolean;
41
- toolChoice?: "auto" | "any" | "none" | {
42
- type: "tool";
43
- name: string;
44
- };
45
- /**
46
- * Pre-built Anthropic client instance. When provided, skips internal client
47
- * construction entirely. Use this to inject alternative SDK clients such as
48
- * `AnthropicVertex` that shares the same messaging API.
49
- */
50
- client?: Anthropic;
51
- }
52
- export declare const streamAnthropic: StreamFunction<"anthropic-messages", AnthropicOptions>;
53
- export declare const streamSimpleAnthropic: StreamFunction<"anthropic-messages", SimpleStreamOptions>;
54
- //# sourceMappingURL=anthropic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../../src/sdk/ai/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAU1C,OAAO,KAAK,EASX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AAiIrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;AAmBhE,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACtD;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AA4MD,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,CAyPlF,CAAC;AAyCF,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,oBAAoB,EAAE,mBAAmB,CAyC3F,CAAC"}