@kjerneverk/execution-anthropic 1.0.4-dev.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.
Files changed (42) hide show
  1. package/.kodrdriv-test-cache.json +6 -0
  2. package/LICENSE +18 -0
  3. package/README.md +83 -0
  4. package/dist/index.d.ts +85 -0
  5. package/dist/index.js +123 -0
  6. package/dist/index.js.map +1 -0
  7. package/output/kodrdriv/.kodrdriv-parallel-context.json +584 -0
  8. package/output/kodrdriv/.kodrdriv-parallel-context.json.lock +2 -0
  9. package/output/kodrdriv/260110-1741-release-notes.md +36 -0
  10. package/output/kodrdriv/260112-2201-commit-message.md +1 -0
  11. package/output/kodrdriv/260112-2202-release-notes.md +39 -0
  12. package/output/kodrdriv/260112-2340-commit-message.md +1 -0
  13. package/output/kodrdriv/260113-0022-commit-message.md +1 -0
  14. package/output/kodrdriv/260113-0023-release-notes.md +45 -0
  15. package/output/kodrdriv/260114-0655-commit-message.md +5 -0
  16. package/output/kodrdriv/260115-0616-commit-message.md +4 -0
  17. package/output/kodrdriv/260115-0739-commit-message.md +1 -0
  18. package/output/kodrdriv/260126-0919-commit-message.md +1 -0
  19. package/output/kodrdriv/260126-0921-release-notes.md +34 -0
  20. package/output/kodrdriv/260128-0923-commit-message.md +3 -0
  21. package/output/kodrdriv/260128-0924-release-notes.md +23 -0
  22. package/output/kodrdriv/260130-1638-commit-message.md +1 -0
  23. package/output/kodrdriv/260130-1645-commit-message.md +1 -0
  24. package/output/kodrdriv/260130-1646-release-notes.md +30 -0
  25. package/output/kodrdriv/RELEASE_NOTES.md +28 -0
  26. package/output/kodrdriv/RELEASE_TITLE.md +1 -0
  27. package/output/kodrdriv/agentic-reflection-commit-2026-01-13T06-01-28-797Z.md +97 -0
  28. package/output/kodrdriv/agentic-reflection-commit-2026-01-13T07-40-49-371Z.md +97 -0
  29. package/output/kodrdriv/agentic-reflection-commit-2026-01-13T08-22-38-911Z.md +97 -0
  30. package/output/kodrdriv/agentic-reflection-commit-2026-01-14T14-55-30-939Z.md +118 -0
  31. package/output/kodrdriv/agentic-reflection-commit-2026-01-15T14-16-26-349Z.md +117 -0
  32. package/output/kodrdriv/agentic-reflection-commit-2026-01-15T15-39-45-943Z.md +97 -0
  33. package/output/kodrdriv/agentic-reflection-commit-2026-01-26T17-19-48-407Z.md +188 -0
  34. package/output/kodrdriv/agentic-reflection-commit-2026-01-31T00-38-51-441Z.md +160 -0
  35. package/output/kodrdriv/agentic-reflection-commit-2026-01-31T00-45-53-143Z.md +130 -0
  36. package/output/kodrdriv/agentic-reflection-release-2026-01-11T01-41-03-039Z.md +330 -0
  37. package/output/kodrdriv/agentic-reflection-release-2026-01-13T06-02-11-920Z.md +270 -0
  38. package/output/kodrdriv/agentic-reflection-release-2026-01-13T08-23-08-625Z.md +299 -0
  39. package/output/kodrdriv/agentic-reflection-release-2026-01-26T17-21-17-390Z.md +365 -0
  40. package/output/kodrdriv/agentic-reflection-release-2026-01-31T00-46-16-542Z.md +362 -0
  41. package/package.json +57 -0
  42. package/package.json~ +56 -0
@@ -0,0 +1,365 @@
1
+ # Agentic Workflow - Self-Reflection Report
2
+
3
+ Generated: 2026-01-26T17:21:17.390Z
4
+
5
+ ## Execution Summary
6
+
7
+ - **Iterations**: 4
8
+ - **Tool Calls**: 16
9
+ - **Unique Tools**: 10
10
+
11
+ ## Tool Effectiveness Analysis
12
+
13
+ | Tool | Calls | Success | Failures | Success Rate | Avg Duration |
14
+ |------|-------|---------|----------|--------------|--------------|
15
+ | get_file_content | 5 | 5 | 0 | 100.0% | 1ms |
16
+ | search_codebase | 3 | 3 | 0 | 100.0% | 12ms |
17
+ | get_release_stats | 1 | 1 | 0 | 100.0% | 63ms |
18
+ | get_tag_history | 1 | 1 | 0 | 100.0% | 72ms |
19
+ | analyze_commit_patterns | 1 | 1 | 0 | 100.0% | 13ms |
20
+ | get_breaking_changes | 1 | 1 | 0 | 100.0% | 27ms |
21
+ | group_files_by_concern | 1 | 1 | 0 | 100.0% | 1ms |
22
+ | get_file_dependencies | 1 | 1 | 0 | 100.0% | 18ms |
23
+ | get_file_history | 1 | 1 | 0 | 100.0% | 20ms |
24
+ | get_recent_commits | 1 | 1 | 0 | 100.0% | 13ms |
25
+
26
+ ### Tool Performance Insights
27
+
28
+ **Most Frequently Used:**
29
+ - get_release_stats: 1 calls
30
+ - get_tag_history: 1 calls
31
+ - analyze_commit_patterns: 1 calls
32
+
33
+ ## Recommendations for Improvement
34
+
35
+ - **Underutilized Tools**: Many tools were called only once. Consider whether all tools are necessary or if the agent needs better guidance on when to use them.
36
+
37
+ ## Detailed Execution Timeline
38
+
39
+ | Time | Iteration | Tool | Result | Duration |
40
+ |------|-----------|------|--------|----------|
41
+ | 9:19:54 AM | 1 | get_release_stats | ✅ Success | 63ms |
42
+ | 9:19:54 AM | 1 | get_tag_history | ✅ Success | 72ms |
43
+ | 9:19:54 AM | 1 | analyze_commit_patterns | ✅ Success | 13ms |
44
+ | 9:19:54 AM | 1 | get_breaking_changes | ✅ Success | 27ms |
45
+ | 9:20:00 AM | 2 | group_files_by_concern | ✅ Success | 1ms |
46
+ | 9:20:00 AM | 2 | get_file_content | ✅ Success | 1ms |
47
+ | 9:20:00 AM | 2 | get_file_content | ✅ Success | 0ms |
48
+ | 9:20:00 AM | 2 | get_file_content | ✅ Success | 0ms |
49
+ | 9:20:00 AM | 2 | get_file_content | ✅ Success | 2ms |
50
+ | 9:20:00 AM | 2 | get_file_content | ✅ Success | 0ms |
51
+ | 9:20:00 AM | 2 | get_file_dependencies | ✅ Success | 18ms |
52
+ | 9:20:13 AM | 3 | get_file_history | ✅ Success | 20ms |
53
+ | 9:20:13 AM | 3 | get_recent_commits | ✅ Success | 13ms |
54
+ | 9:20:13 AM | 3 | search_codebase | ✅ Success | 12ms |
55
+ | 9:20:13 AM | 3 | search_codebase | ✅ Success | 11ms |
56
+ | 9:20:13 AM | 3 | search_codebase | ✅ Success | 12ms |
57
+
58
+ ## Conversation History
59
+
60
+ <details>
61
+ <summary>Click to expand full agentic interaction</summary>
62
+
63
+ ```json
64
+ [
65
+ {
66
+ "role": "system",
67
+ "content": "You are a professional software engineer writing release notes for your team and users.\n\n## Available Tools\n\nYou have access to tools to investigate the release:\n- `get_tag_history` - Understand release patterns\n- `get_release_stats` - Quantify scope of changes\n- `compare_previous_release` - See how this compares to previous releases\n- `group_files_by_concern` - Identify themes in changes\n- `analyze_commit_patterns` - Detect patterns in commits\n- `get_file_content` - Read file contents or diffs\n- `analyze_diff_section` - Expand unclear changes\n- `get_file_history` - Understand how code evolved\n- `get_file_dependencies` - Assess impact and reach\n- `search_codebase` - Find usage patterns\n- `get_related_tests` - Understand behavior changes\n- `get_breaking_changes` - Identify breaking changes (always use this)\n\nUse these tools to investigate the changes rather than asking for information upfront.\n\n## Your Task\n\nWrite release notes that clearly explain what's in this release and why it matters. Your notes should help users and developers understand what changed without needing to read every commit.\n\nFocus on:\n- What problems does this release solve?\n- What new capabilities does it add?\n- What's the impact on users and developers?\n- Are there breaking changes or important considerations?\n\nUse the available tools to investigate the changes. The more you understand, the better your notes will be.\n\n**Important**: If additional context is provided (from context files or other sources), use your judgment:\n- If the context is relevant to this specific package/release, incorporate it appropriately\n- If the context describes changes in other packages or unrelated work, ignore it\n- Don't fabricate connections between this package and unrelated context\n- Be honest about what changed - only mention what actually happened in this release\n- Context is supplemental information, not a requirement to include\n\n## Investigation Approach\n\nUse tools based on what you need to know:\n\n**Context:**\n- get_tag_history - understand release patterns\n- get_release_stats - quantify scope\n- compare_previous_release - see how this compares\n\n**Understanding:**\n- group_files_by_concern - identify themes\n- analyze_commit_patterns - detect patterns\n- get_file_content - see full context\n- analyze_diff_section - expand unclear changes\n- get_file_history - understand evolution\n\n**Impact:**\n- get_file_dependencies - assess reach\n- search_codebase - find usage patterns\n- get_related_tests - understand behavior changes\n- get_breaking_changes - identify breaking changes (always use)\n\n## Writing Style\n\nWrite naturally and directly:\n- Use plain language that users can understand\n- Be specific about what changed and why\n- Avoid marketing speak and buzzwords\n- No emojis or excessive punctuation\n- No phrases like \"we're excited to announce\"\n- No meta-commentary about the release itself\n- Focus on facts and implications, not enthusiasm\n\nStructure your notes logically:\n- Start with the most important changes\n- Group related changes together\n- Explain breaking changes clearly\n- Include practical examples when helpful\n\n## Output Format\n\nWhen ready, output your release notes in this exact format:\n\nRELEASE_TITLE:\n[A clear, factual title describing the main changes]\n\nRELEASE_BODY:\n[Detailed release notes in Markdown format]\n\nDo not include any JSON, code blocks, or wrapper syntax. Output plain text and markdown only.\nNo conversational remarks or follow-up offers."
68
+ },
69
+ {
70
+ "role": "user",
71
+ "content": "I need comprehensive release notes for changes from main to HEAD.\n\n**CRITICAL VERSION INSTRUCTION: This is a release for version 1.0.0. You MUST use EXACTLY \"1.0.0\" in your release title. DO NOT use any development/prerelease version numbers you may see in the diff (like 1.0.0-dev.0 or similar). The release version is 1.0.0.**\n\n## Your Analysis Task\n\nUse your tools to investigate the changes between main and HEAD:\n1. Use `get_release_stats` to understand the scope of changes\n2. Use `get_tag_history` or `compare_previous_release` to see release patterns\n3. Use `analyze_commit_patterns` to detect themes\n4. Use `group_files_by_concern` to identify logical groupings\n5. Use `get_breaking_changes` to identify breaking changes (always check this)\n6. Use `get_file_content` or `analyze_diff_section` to understand specific changes\n7. Use `get_file_dependencies` and `search_codebase` to assess impact\n\nWrite clear release notes that answer:\n- What's the main story of this release?\n- What problems does it solve?\n- What's the impact on users and developers?\n- Are there breaking changes?\n\nIf context information is provided, use it only if relevant to this specific package.\nDon't force connections that don't exist - if context describes changes in other packages\nor unrelated features, simply ignore it and focus on what actually changed in this release.\n\nStart by gathering statistics and understanding the scope, then investigate specific changes as needed."
72
+ },
73
+ {
74
+ "role": "assistant",
75
+ "content": null,
76
+ "tool_calls": [
77
+ {
78
+ "id": "call_IHeAAcJhtbTccPf4B03L4JdV",
79
+ "type": "function",
80
+ "function": {
81
+ "name": "get_release_stats",
82
+ "arguments": "{\"fromRef\": \"main\", \"toRef\": \"HEAD\"}"
83
+ }
84
+ },
85
+ {
86
+ "id": "call_8dzHaip6BOttnZdanJ2fahw1",
87
+ "type": "function",
88
+ "function": {
89
+ "name": "get_tag_history",
90
+ "arguments": "{\"limit\": 10, \"pattern\": \"v*\"}"
91
+ }
92
+ },
93
+ {
94
+ "id": "call_oP0TGwKbGlgte8IOKbhVaQKQ",
95
+ "type": "function",
96
+ "function": {
97
+ "name": "analyze_commit_patterns",
98
+ "arguments": "{\"fromRef\": \"main\", \"toRef\": \"HEAD\"}"
99
+ }
100
+ },
101
+ {
102
+ "id": "call_EZMAB6STODZF1DqXZDQqjRmv",
103
+ "type": "function",
104
+ "function": {
105
+ "name": "get_breaking_changes",
106
+ "arguments": "{\"fromRef\": \"main\", \"toRef\": \"HEAD\"}"
107
+ }
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "role": "tool",
113
+ "tool_call_id": "call_IHeAAcJhtbTccPf4B03L4JdV",
114
+ "content": "Total commits: 6\n\nContributors:\n 6\tTim O'Brien\n\n\nFile changes: 5 files changed, 133 insertions(+), 68 deletions(-)\n\nTop 10 most changed files:\n vite.config.ts | 8 ++-\n src/index.ts | 182 +++++++++++++++++++++++++++++++++++++--------------------\n package.json | 8 ++-\n README.md | 2 +\n 5 files changed, 133 insertions(+), 68 deletions(-)\n .gitignore | 1 +\n",
115
+ "name": "get_release_stats"
116
+ },
117
+ {
118
+ "role": "tool",
119
+ "tool_call_id": "call_8dzHaip6BOttnZdanJ2fahw1",
120
+ "content": "Recent release tags:\nv0.0.4: 2026-01-13 00:23:46 -0800 - chore(release): bump @riotprompt/execution-anthropic to 0.0.4 (#7)\nv0.0.3: 2026-01-12 22:03:01 -0800 - chore(release): bump @riotprompt/execution-anthropic to 0.0.3 (#6)\nv0.0.3-dev.0: tag v0.0.3-dev.0\nTagger: Tim O'Brien <tobrien@discursive.com>\n\n0.0.3-dev.0\n2026-01-10 17:45:38 -0800 - 0.0.3-dev.0\nv0.0.2: 2026-01-10 17:41:07 -0800 - Updated and separated tests (#5)\nv0.0.2-dev.0: tag v0.0.2-dev.0\nTagger: Tim O'Brien <tobrien@discursive.com>\n\n0.0.2-dev.0\n2026-01-10 11:23:15 -0800 - 0.0.2-dev.0",
121
+ "name": "get_tag_history"
122
+ },
123
+ {
124
+ "role": "tool",
125
+ "tool_call_id": "call_oP0TGwKbGlgte8IOKbhVaQKQ",
126
+ "content": "Commit types:\n chore: 5\n feat: 1\n\nTop keywords in commits:\n chore: 5\n release: 2\n kodrdriv: 2\n package: 1\n version: 1\n gitignore: 1\n pattern: 1\n ignore: 1\n internal: 1\n files: 1\n precommit: 1\n build: 1\n before: 1\n security: 1\n redact: 1",
127
+ "name": "analyze_commit_patterns"
128
+ },
129
+ {
130
+ "role": "tool",
131
+ "tool_call_id": "call_EZMAB6STODZF1DqXZDQqjRmv",
132
+ "content": "No obvious breaking changes detected. Manual review recommended for API changes.",
133
+ "name": "get_breaking_changes"
134
+ },
135
+ {
136
+ "role": "assistant",
137
+ "content": null,
138
+ "tool_calls": [
139
+ {
140
+ "id": "call_exwEsZHP3am3kb1rE5TleE3Z",
141
+ "type": "function",
142
+ "function": {
143
+ "name": "group_files_by_concern",
144
+ "arguments": "{\"filePaths\": [\"vite.config.ts\", \"src/index.ts\", \"package.json\", \"README.md\", \".gitignore\"]}"
145
+ }
146
+ },
147
+ {
148
+ "id": "call_MEwj4LckGU0kwbqjGdSnR6zu",
149
+ "type": "function",
150
+ "function": {
151
+ "name": "get_file_content",
152
+ "arguments": "{\"filePath\": \"src/index.ts\", \"includeLineNumbers\": true}"
153
+ }
154
+ },
155
+ {
156
+ "id": "call_k2Q9Nn3Bmn3p1sqZ76LUIyuP",
157
+ "type": "function",
158
+ "function": {
159
+ "name": "get_file_content",
160
+ "arguments": "{\"filePath\": \"package.json\", \"includeLineNumbers\": true}"
161
+ }
162
+ },
163
+ {
164
+ "id": "call_NC8bCNBNJFB6y4ChGuomUtcl",
165
+ "type": "function",
166
+ "function": {
167
+ "name": "get_file_content",
168
+ "arguments": "{\"filePath\": \"vite.config.ts\", \"includeLineNumbers\": true}"
169
+ }
170
+ },
171
+ {
172
+ "id": "call_KzWZyZhAyX1chfnbuu9zZmAU",
173
+ "type": "function",
174
+ "function": {
175
+ "name": "get_file_content",
176
+ "arguments": "{\"filePath\": \"README.md\", \"includeLineNumbers\": true}"
177
+ }
178
+ },
179
+ {
180
+ "id": "call_x2JqDalP3iYGNX37AqfwhOcQ",
181
+ "type": "function",
182
+ "function": {
183
+ "name": "get_file_content",
184
+ "arguments": "{\"filePath\": \".gitignore\", \"includeLineNumbers\": true}"
185
+ }
186
+ },
187
+ {
188
+ "id": "call_yQ3yRVq2hyQ8zj5ddqJbszjg",
189
+ "type": "function",
190
+ "function": {
191
+ "name": "get_file_dependencies",
192
+ "arguments": "{\"filePaths\": [\"src/index.ts\"]}"
193
+ }
194
+ }
195
+ ]
196
+ },
197
+ {
198
+ "role": "tool",
199
+ "tool_call_id": "call_exwEsZHP3am3kb1rE5TleE3Z",
200
+ "content": "other (2 files):\n - vite.config.ts\n - .gitignore\n\nsource:src (1 files):\n - src/index.ts\n\ndependencies (1 files):\n - package.json\n\ndocumentation (1 files):\n - README.md\n\nSuggestion: These 4 groups represent different concerns in the release.",
201
+ "name": "group_files_by_concern"
202
+ },
203
+ {
204
+ "role": "tool",
205
+ "tool_call_id": "call_MEwj4LckGU0kwbqjGdSnR6zu",
206
+ "content": "1: /**\n2: * Execution Anthropic Package\n3: *\n4: * Anthropic provider implementation for LLM execution.\n5: *\n6: * @packageDocumentation\n7: */\n8: \n9: import Anthropic from '@anthropic-ai/sdk';\n10: import { getRedactor } from '@theunwalked/offrecord';\n11: import { \n12: createSafeError, \n13: configureErrorSanitizer,\n14: configureSecretGuard,\n15: } from '@theunwalked/spotclean';\n16: \n17: // Register Anthropic API key patterns on module load\n18: const redactor = getRedactor();\n19: redactor.register({\n20: name: 'anthropic',\n21: patterns: [\n22: /sk-ant-[a-zA-Z0-9_-]+/g,\n23: /sk-ant-api\\d+-[a-zA-Z0-9_-]+/g,\n24: ],\n25: validator: (key: string) => /^sk-ant(-api\\d+)?-[a-zA-Z0-9_-]+$/.test(key),\n26: envVar: 'ANTHROPIC_API_KEY',\n27: description: 'Anthropic API keys',\n28: });\n29: \n30: // Configure spotclean for error sanitization\n31: configureErrorSanitizer({\n32: enabled: true,\n33: environment: process.env.NODE_ENV === 'production' ? 'production' : 'development',\n34: includeCorrelationId: true,\n35: sanitizeStackTraces: process.env.NODE_ENV === 'production',\n36: maxMessageLength: 500,\n37: });\n38: \n39: configureSecretGuard({\n40: enabled: true,\n41: redactionText: '[REDACTED]',\n42: preservePartial: false,\n43: preserveLength: 0,\n44: customPatterns: [\n45: { name: 'anthropic', pattern: /sk-ant-[a-zA-Z0-9_-]+/g, description: 'Anthropic API key' },\n46: { name: 'anthropic-api', pattern: /sk-ant-api\\d+-[a-zA-Z0-9_-]+/g, description: 'Anthropic API key' },\n47: ],\n48: });\n49: \n50: // ===== INLINE TYPES (from 'execution' package) =====\n51: \n52: export type Model = string;\n53: \n54: export interface Message {\n55: role: 'user' | 'assistant' | 'system' | 'developer' | 'tool';\n56: content: string | string[] | null;\n57: name?: string;\n58: }\n59: \n60: export interface Request {\n61: messages: Message[];\n62: model: Model;\n63: responseFormat?: any;\n64: validator?: any;\n65: addMessage(message: Message): void;\n66: }\n67: \n68: export interface ProviderResponse {\n69: content: string;\n70: model: string;\n71: usage?: {\n72: inputTokens: number;\n73: outputTokens: number;\n74: };\n75: toolCalls?: Array<{\n76: id: string;\n77: type: 'function';\n78: function: {\n79: name: string;\n80: arguments: string;\n81: };\n82: }>;\n83: }\n84: \n85: export interface ExecutionOptions {\n86: apiKey?: string;\n87: model?: string;\n88: temperature?: number;\n89: maxTokens?: number;\n90: timeout?: number;\n91: retries?: number;\n92: }\n93: \n94: export interface Provider {\n95: readonly name: string;\n96: execute(request: Request, options?: ExecutionOptions): Promise<ProviderResponse>;\n97: supportsModel?(model: Model): boolean;\n98: }\n99: \n100: /**\n101: * Anthropic Provider implementation\n102: */\n103: export class AnthropicProvider implements Provider {\n104: readonly name = 'anthropic';\n105: \n106: /**\n107: * Check if this provider supports a given model\n108: */\n109: supportsModel(model: Model): boolean {\n110: if (!model) return false;\n111: return model.startsWith('claude');\n112: }\n113: \n114: /**\n115: * Execute a request against Anthropic\n116: */\n117: async execute(\n118: request: Request,\n119: options: ExecutionOptions = {}\n120: ): Promise<ProviderResponse> {\n121: const apiKey = options.apiKey || process.env.ANTHROPIC_API_KEY;\n122: \n123: if (!apiKey) {\n124: throw new Error('Anthropic API key is required. Set ANTHROPIC_API_KEY environment variable.');\n125: }\n126: \n127: // Validate key format\n128: const validation = redactor.validateKey(apiKey, 'anthropic');\n129: if (!validation.valid) {\n130: throw new Error('Invalid Anthropic API key format');\n131: }\n132: \n133: try {\n134: const client = new Anthropic({ apiKey });\n135: \n136: const model = options.model || request.model || 'claude-3-opus-20240229';\n137: \n138: // Anthropic separates system prompt from messages\n139: let systemPrompt = '';\n140: const messages: Anthropic.MessageParam[] = [];\n141: \n142: for (const msg of request.messages) {\n143: if (msg.role === 'system' || msg.role === 'developer') {\n144: systemPrompt +=\n145: (typeof msg.content === 'string'\n146: ? msg.content\n147: : JSON.stringify(msg.content)) + '\\n\\n';\n148: } else {\n149: messages.push({\n150: role: msg.role as 'user' | 'assistant',\n151: content:\n152: typeof msg.content === 'string'\n153: ? msg.content\n154: : JSON.stringify(msg.content),\n155: });\n156: }\n157: }\n158: \n159: const response = await client.messages.create({\n160: model: model,\n161: system: systemPrompt.trim() || undefined,\n162: messages: messages,\n163: max_tokens: options.maxTokens || 4096,\n164: temperature: options.temperature,\n165: ...(request.responseFormat?.type === 'json_schema'\n166: ? {\n167: tools: [\n168: {\n169: name: request.responseFormat.json_schema.name,\n170: description:\n171: request.responseFormat.json_schema.description ||\n172: 'Output data in this structured format',\n173: input_schema:\n174: request.responseFormat.json_schema.schema,\n175: },\n176: ],\n177: tool_choice: {\n178: type: 'tool' as const,\n179: name: request.responseFormat.json_schema.name,\n180: },\n181: }\n182: : {}),\n183: });\n184: \n185: // Handle ContentBlock\n186: let text = '';\n187: \n188: if (request.responseFormat?.type === 'json_schema') {\n189: const toolUseBlock = response.content.find(\n190: (block) => block.type === 'tool_use'\n191: );\n192: if (toolUseBlock && toolUseBlock.type === 'tool_use') {\n193: text = JSON.stringify(toolUseBlock.input, null, 2);\n194: }\n195: } else {\n196: const contentBlock = response.content[0];\n197: text = contentBlock.type === 'text' ? contentBlock.text : '';\n198: }\n199: \n200: return {\n201: content: text,\n202: model: response.model,\n203: usage: {\n204: inputTokens: response.usage.input_tokens,\n205: outputTokens: response.usage.output_tokens,\n206: },\n207: };\n208: } catch (error) {\n209: // Sanitize error to remove any API keys from error messages\n210: // Use spotclean for comprehensive error sanitization\n211: throw createSafeError(error as Error, { provider: 'anthropic' });\n212: }\n213: }\n214: }\n215: \n216: /**\n217: * Create a new Anthropic provider instance\n218: */\n219: export function createAnthropicProvider(): AnthropicProvider {\n220: return new AnthropicProvider();\n221: }\n222: \n223: /**\n224: * Package version\n225: */\n226: export const VERSION = '0.0.1';\n227: \n228: export default AnthropicProvider;\n229: ",
207
+ "name": "get_file_content"
208
+ },
209
+ {
210
+ "role": "tool",
211
+ "tool_call_id": "call_k2Q9Nn3Bmn3p1sqZ76LUIyuP",
212
+ "content": "1: {\n2: \"name\": \"@riotprompt/execution-anthropic\",\n3: \"version\": \"1.0.0\",\n4: \"description\": \"Anthropic Claude provider for execution interface\",\n5: \"type\": \"module\",\n6: \"main\": \"./dist/index.js\",\n7: \"types\": \"./dist/index.d.ts\",\n8: \"exports\": {\n9: \".\": {\n10: \"types\": \"./dist/index.d.ts\",\n11: \"import\": \"./dist/index.js\"\n12: }\n13: },\n14: \"engines\": {\n15: \"node\": \">=24.0.0\"\n16: },\n17: \"scripts\": {\n18: \"clean\": \"rm -rf dist\",\n19: \"build\": \"vite build\",\n20: \"test\": \"vitest run --coverage\",\n21: \"test:coverage\": \"vitest run --coverage\",\n22: \"lint\": \"eslint src\",\n23: \"precommit\": \"npm run build && npm run lint && npm run test\",\n24: \"prepublishOnly\": \"npm run clean && npm run build\"\n25: },\n26: \"keywords\": [\n27: \"llm\",\n28: \"anthropic\",\n29: \"claude\",\n30: \"execution\",\n31: \"provider\"\n32: ],\n33: \"author\": \"Tim O'Brien <tobrien@discursive.com>\",\n34: \"license\": \"Apache-2.0\",\n35: \"repository\": {\n36: \"type\": \"git\",\n37: \"url\": \"https://github.com/kjerneverk/execution-anthropic\"\n38: },\n39: \"dependencies\": {\n40: \"@anthropic-ai/sdk\": \"^0.52.0\",\n41: \"@theunwalked/offrecord\": \"^0.0.1\",\n42: \"@theunwalked/spotclean\": \"^0.0.3\"\n43: },\n44: \"devDependencies\": {\n45: \"@types/node\": \"^25.0.6\",\n46: \"@typescript-eslint/eslint-plugin\": \"^8.33.1\",\n47: \"@typescript-eslint/parser\": \"^8.33.1\",\n48: \"@vitest/coverage-v8\": \"^3.2.4\",\n49: \"eslint\": \"^9.28.0\",\n50: \"globals\": \"^16.2.0\",\n51: \"typescript\": \"^5.8.3\",\n52: \"vite\": \"^7.0.4\",\n53: \"vite-plugin-dts\": \"^4.5.4\",\n54: \"vitest\": \"^3.2.4\"\n55: }\n56: }\n57: ",
213
+ "name": "get_file_content"
214
+ },
215
+ {
216
+ "role": "tool",
217
+ "tool_call_id": "call_NC8bCNBNJFB6y4ChGuomUtcl",
218
+ "content": "1: import { defineConfig } from \"vite\";\n2: import dts from \"vite-plugin-dts\";\n3: \n4: export default defineConfig({\n5: build: {\n6: lib: {\n7: entry: \"src/index.ts\",\n8: name: \"execution-anthropic\",\n9: fileName: () => \"index.js\",\n10: formats: [\"es\"],\n11: },\n12: rollupOptions: {\n13: external: [\n14: \"@anthropic-ai/sdk\",\n15: \"execution\",\n16: \"@theunwalked/offrecord\",\n17: \"@theunwalked/spotclean\",\n18: \"node:crypto\",\n19: ],\n20: },\n21: sourcemap: true,\n22: minify: false,\n23: },\n24: plugins: [dts({ rollupTypes: true })],\n25: });\n26: ",
219
+ "name": "get_file_content"
220
+ },
221
+ {
222
+ "role": "tool",
223
+ "tool_call_id": "call_KzWZyZhAyX1chfnbuu9zZmAU",
224
+ "content": "1: # execution-anthropic\n2: \n3: Anthropic Claude provider implementation for LLM execution. Implements the `Provider` interface from the `execution` package.\n4: \n5: ## Installation\n6: \n7: ```bash\n8: npm install execution-anthropic @anthropic-ai/sdk\n9: ```\n10: \n11: ## Usage\n12: \n13: ```typescript\n14: import { AnthropicProvider, createAnthropicProvider } from 'execution-anthropic';\n15: \n16: // Create provider\n17: const provider = createAnthropicProvider();\n18: \n19: // Execute a request\n20: const response = await provider.execute(\n21: {\n22: model: 'claude-3-opus-20240229',\n23: messages: [\n24: { role: 'system', content: 'You are helpful.' },\n25: { role: 'user', content: 'Hello!' }\n26: ],\n27: addMessage: () => {},\n28: },\n29: {\n30: apiKey: process.env.ANTHROPIC_API_KEY,\n31: temperature: 0.7,\n32: maxTokens: 4096,\n33: }\n34: );\n35: \n36: console.log(response.content);\n37: console.log(response.usage); // { inputTokens: X, outputTokens: Y }\n38: ```\n39: \n40: ## Supported Models\n41: \n42: The provider supports all Claude models:\n43: - Claude 3 Opus\n44: - Claude 3 Sonnet\n45: - Claude 3 Haiku\n46: - Claude 3.5 family\n47: \n48: ## API Key\n49: \n50: Set via:\n51: 1. `options.apiKey` parameter\n52: 2. `ANTHROPIC_API_KEY` environment variable\n53: \n54: ## Features\n55: \n56: - Automatic system prompt extraction (Anthropic separates system from messages)\n57: - Structured output via tool use (JSON schema support)\n58: - Full token usage tracking\n59: \n60: ## Response Format\n61: \n62: ```typescript\n63: interface ProviderResponse {\n64: content: string;\n65: model: string;\n66: usage?: {\n67: inputTokens: number;\n68: outputTokens: number;\n69: };\n70: }\n71: ```\n72: \n73: ## Related Packages\n74: \n75: - `execution` - Core interfaces (no SDK dependencies)\n76: - `execution-openai` - OpenAI provider\n77: - `execution-gemini` - Google Gemini provider\n78: \n79: ## License\n80: \n81: Apache-2.0\n82: \n83: <!-- v1.0.0 -->\n84: ",
225
+ "name": "get_file_content"
226
+ },
227
+ {
228
+ "role": "tool",
229
+ "tool_call_id": "call_x2JqDalP3iYGNX37AqfwhOcQ",
230
+ "content": "1: *~\n2: .env \n3: dist\n4: node_modules\n5: *.log\n6: .vscode\n7: coverage/\n8: **/.DS_Store\n9: package-lock.json\n10: \n11: output/\n12: .kodrdriv*\n13: ",
231
+ "name": "get_file_content"
232
+ },
233
+ {
234
+ "role": "tool",
235
+ "tool_call_id": "call_yQ3yRVq2hyQ8zj5ddqJbszjg",
236
+ "content": "No files found that import the specified files",
237
+ "name": "get_file_dependencies"
238
+ },
239
+ {
240
+ "role": "assistant",
241
+ "content": null,
242
+ "tool_calls": [
243
+ {
244
+ "id": "call_4AHStHSGrYiJVRDcfPkgLFUX",
245
+ "type": "function",
246
+ "function": {
247
+ "name": "get_file_history",
248
+ "arguments": "{\"filePaths\": [\"src/index.ts\", \"package.json\", \"vite.config.ts\", \"README.md\", \".gitignore\"], \"limit\": 20, \"format\": \"detailed\"}"
249
+ }
250
+ },
251
+ {
252
+ "id": "call_vNRHGXTHIL5QladaRDUiAhPs",
253
+ "type": "function",
254
+ "function": {
255
+ "name": "get_recent_commits",
256
+ "arguments": "{\"filePaths\": [\"src/index.ts\", \"package.json\", \"vite.config.ts\", \"README.md\", \".gitignore\"], \"since\": \"1 month ago\", \"limit\": 10}"
257
+ }
258
+ },
259
+ {
260
+ "id": "call_p5zAIuROF7xu1GgNAUFbzcgr",
261
+ "type": "function",
262
+ "function": {
263
+ "name": "search_codebase",
264
+ "arguments": "{\"query\": \"VERSION =\", \"fileTypes\": [\"ts\"], \"contextLines\": 2}"
265
+ }
266
+ },
267
+ {
268
+ "id": "call_vAPf9Xn7taPSe6dYhRAFPgot",
269
+ "type": "function",
270
+ "function": {
271
+ "name": "search_codebase",
272
+ "arguments": "{\"query\": \"createSafeError\", \"fileTypes\": [\"ts\"], \"contextLines\": 2}"
273
+ }
274
+ },
275
+ {
276
+ "id": "call_jmRgUzqYK8jY0wL6yBur6CDr",
277
+ "type": "function",
278
+ "function": {
279
+ "name": "search_codebase",
280
+ "arguments": "{\"query\": \"responseFormat?.type === 'json_schema'\", \"fileTypes\": [\"ts\"], \"contextLines\": 2}"
281
+ }
282
+ }
283
+ ]
284
+ },
285
+ {
286
+ "role": "tool",
287
+ "tool_call_id": "call_4AHStHSGrYiJVRDcfPkgLFUX",
288
+ "content": "aec02cc2abf37787692357ebafe61154d24a478a\nTim O'Brien (tobrien@discursive.com)\nMon Jan 26 09:19:48 2026 -0800\nchore(release): bump package version to 1.0.0\n\n\n---\n8b5926eccc4ec0fdcc3bd591c2b499dc77a39cc4\nTim O'Brien (tobrien@discursive.com)\nMon Jan 26 08:51:45 2026 -0800\nchore(gitignore): add .kodrdriv* pattern to ignore kodrdriv internal files\n\n\n---\n7c169222d3325871b5f19a37b78ee14af82a1b7f\nTim O'Brien (tobrien@discursive.com)\nThu Jan 15 07:39:45 2026 -0800\nchore(precommit): run build before lint and test\n\n\n---\n4bc4b784c242f60a33c3722c290cf27e908ddfec\nTim O'Brien (tobrien@discursive.com)\nThu Jan 15 06:16:26 2026 -0800\nchore(release): bump to 1.0.0-dev.0\n\n- update package.json version to 1.0.0-dev.0\n- add v1.0.0 marker to README\n\n---\nf93c63f3adba1028ea8d8d2065530f32a3aa6576\nTim O'Brien (tobrien@discursive.com)\nWed Jan 14 06:55:30 2026 -0800\nfeat(security): redact Anthropic API keys and sanitize provider errors\n\n- add offrecord/spotclean dependencies and mark them as Vite externals\n- register Anthropic key patterns, validate key format, and configure secret guarding\n- wrap Anthropic calls to throw sanitized errors without leaking secrets\n\n---\nb96be060651922862ff21503100eb84ce5c01a08\nTim O'Brien (tobrien@discursive.com)\nTue Jan 13 00:24:39 2026 -0800\nchore: bump to 0.0.4-dev.0\n\n\n---\n78c0bc337f062371cb71eee7014ceddd2739971a\nTim O'Brien (tobrien@discursive.com)\nTue Jan 13 00:23:46 2026 -0800\nchore(release): bump @riotprompt/execution-anthropic to 0.0.4 (#7)\n\n* chore: bump to v0.0.4-dev.0\n\n* chore(build): switch to ESM-only output, target ES2024, and require Node 24\n\n* chore(release): bump @riotprompt/execution-anthropic to 0.0.4\n---\n78e81b101cb0bb7e4a3a6e5069ec1d2ed7d0f7a6\nTim O'Brien (tobrien@discursive.com)\nMon Jan 12 22:03:01 2026 -0800\nchore(release): bump @riotprompt/execution-anthropic to 0.0.3 (#6)\n\n* 0.0.2-dev.0\n\n* Updated and separated tests\n\n* 0.0.3-dev.0\n\n* chore(ci): bump workflows to Node 24 and use npm install\n\n* chore(release): bump @riotprompt/execution-anthropic to 0.0.3\n---\ne5c7e5ef9205658262a326a55e882e8c3598b7a9\nTim O'Brien (tobrien@discursive.com)\nSat Jan 10 17:41:07 2026 -0800\nUpdated and separated tests (#5)\n\n* 0.0.2-dev.0\n\n* Updated and separated tests\n---\nf3a5324e0a075d7201a8d510b41846ac23e6d200\nTim O'Brien (tobrien@discursive.com)\nSat Jan 10 11:22:57 2026 -0800\nFirst commit\n\n\n---\n",
289
+ "name": "get_file_history"
290
+ },
291
+ {
292
+ "role": "tool",
293
+ "tool_call_id": "call_vNRHGXTHIL5QladaRDUiAhPs",
294
+ "content": "aec02cc - chore(release): bump package version to 1.0.0 (Tim O'Brien, 25 seconds ago)\n8b5926e - chore(gitignore): add .kodrdriv* pattern to ignore kodrdriv internal files (Tim O'Brien, 28 minutes ago)\n7c16922 - chore(precommit): run build before lint and test (Tim O'Brien, 11 days ago)\n4bc4b78 - chore(release): bump to 1.0.0-dev.0 (Tim O'Brien, 11 days ago)\nf93c63f - feat(security): redact Anthropic API keys and sanitize provider errors (Tim O'Brien, 12 days ago)\nb96be06 - chore: bump to 0.0.4-dev.0 (Tim O'Brien, 13 days ago)\n78c0bc3 - chore(release): bump @riotprompt/execution-anthropic to 0.0.4 (#7) (Tim O'Brien, 13 days ago)\n78e81b1 - chore(release): bump @riotprompt/execution-anthropic to 0.0.3 (#6) (Tim O'Brien, 13 days ago)\ne5c7e5e - Updated and separated tests (#5) (Tim O'Brien, 2 weeks ago)\nf3a5324 - First commit (Tim O'Brien, 2 weeks ago)\n",
295
+ "name": "get_recent_commits"
296
+ },
297
+ {
298
+ "role": "tool",
299
+ "tool_call_id": "call_p5zAIuROF7xu1GgNAUFbzcgr",
300
+ "content": "src/index.ts-224- * Package version\nsrc/index.ts-225- */\nsrc/index.ts:226:export const VERSION = '0.0.1';\nsrc/index.ts-227-\nsrc/index.ts-228-export default AnthropicProvider;\n",
301
+ "name": "search_codebase"
302
+ },
303
+ {
304
+ "role": "tool",
305
+ "tool_call_id": "call_vAPf9Xn7taPSe6dYhRAFPgot",
306
+ "content": "src/index.ts-10-import { getRedactor } from '@theunwalked/offrecord';\nsrc/index.ts-11-import { \nsrc/index.ts:12: createSafeError, \nsrc/index.ts-13- configureErrorSanitizer,\nsrc/index.ts-14- configureSecretGuard,\n--\nsrc/index.ts-209- // Sanitize error to remove any API keys from error messages\nsrc/index.ts-210- // Use spotclean for comprehensive error sanitization\nsrc/index.ts:211: throw createSafeError(error as Error, { provider: 'anthropic' });\nsrc/index.ts-212- }\nsrc/index.ts-213- }\n",
307
+ "name": "search_codebase"
308
+ },
309
+ {
310
+ "role": "tool",
311
+ "tool_call_id": "call_jmRgUzqYK8jY0wL6yBur6CDr",
312
+ "content": "src/index.ts-163- max_tokens: options.maxTokens || 4096,\nsrc/index.ts-164- temperature: options.temperature,\nsrc/index.ts:165: ...(request.responseFormat?.type === 'json_schema'\nsrc/index.ts-166- ? {\nsrc/index.ts-167- tools: [\n--\nsrc/index.ts-186- let text = '';\nsrc/index.ts-187-\nsrc/index.ts:188: if (request.responseFormat?.type === 'json_schema') {\nsrc/index.ts-189- const toolUseBlock = response.content.find(\nsrc/index.ts-190- (block) => block.type === 'tool_use'\n",
313
+ "name": "search_codebase"
314
+ },
315
+ {
316
+ "role": "assistant",
317
+ "content": "RELEASE_TITLE:\n1.0.0 — Security hardening for Anthropic provider (API key redaction + sanitized errors)\n\nRELEASE_BODY:\n## Main story\nThis 1.0.0 release focuses on **preventing Anthropic API key leakage** and **making provider failures safer to surface in logs and error reporting**, while finalizing the package version for a stable release.\n\n## Security & safety improvements\n- **Automatic API key redaction**\n - Registers Anthropic key patterns on module load (e.g. `sk-ant-...`, `sk-ant-apiX-...`) via `@theunwalked/offrecord`.\n - Configures secret guarding with redaction (`[REDACTED]`) via `@theunwalked/spotclean`.\n- **API key format validation**\n - `execute()` now validates the API key format before attempting an Anthropic API call and throws an error if the key is invalid.\n- **Sanitized provider errors**\n - Errors thrown from Anthropic SDK calls are now wrapped/sanitized using `createSafeError(...)` to reduce the risk of secrets appearing in exception messages or stack traces.\n - Spotclean error sanitization is configured (including correlation IDs; stack traces sanitized in production).\n\n## Developer-impacting behavior changes (review for compatibility)\nThese are not flagged as “obvious breaking changes” by automated detection, but they may affect existing integrations:\n- **Import-time global configuration:** the module configures redaction and error sanitization **at import time**. If your application already configures `@theunwalked/offrecord` / `@theunwalked/spotclean`, verify there’s no conflicting configuration or duplicated behavior.\n- **Error shape/message changes:** callers that relied on raw Anthropic SDK error messages, stack traces, or error types may now see sanitized/wrapped errors instead.\n- **Stricter API key acceptance:** previously accepted but non-matching key strings will now fail validation before making a request.\n\n## Build / packaging updates\n- Added runtime dependencies used for redaction and sanitization:\n - `@theunwalked/offrecord`\n - `@theunwalked/spotclean`\n- Updated Vite build externals to ensure these dependencies are treated as external during bundling.\n- Updated the `precommit` script to run `build` before `lint` and `test`.\n\n## Repo hygiene\n- `.gitignore` now ignores `.kodrdriv*` internal files.\n\n## Notes\n- Package version has been bumped to **1.0.0**.\n- If you surface provider errors to end users or logs, verify your monitoring/alerting still gets the information it needs now that error output is sanitized."
318
+ }
319
+ ]
320
+ ```
321
+
322
+ </details>
323
+
324
+ ## Generated Release Notes
325
+
326
+ ### Title
327
+ ```
328
+ 1.0.0 — Security hardening for Anthropic provider (API key redaction + sanitized errors)
329
+ ```
330
+
331
+ ### Body
332
+ ```markdown
333
+ ## Main story
334
+ This 1.0.0 release focuses on **preventing Anthropic API key leakage** and **making provider failures safer to surface in logs and error reporting**, while finalizing the package version for a stable release.
335
+
336
+ ## Security & safety improvements
337
+ - **Automatic API key redaction**
338
+ - Registers Anthropic key patterns on module load (e.g. `sk-ant-...`, `sk-ant-apiX-...`) via `@theunwalked/offrecord`.
339
+ - Configures secret guarding with redaction (`[REDACTED]`) via `@theunwalked/spotclean`.
340
+ - **API key format validation**
341
+ - `execute()` now validates the API key format before attempting an Anthropic API call and throws an error if the key is invalid.
342
+ - **Sanitized provider errors**
343
+ - Errors thrown from Anthropic SDK calls are now wrapped/sanitized using `createSafeError(...)` to reduce the risk of secrets appearing in exception messages or stack traces.
344
+ - Spotclean error sanitization is configured (including correlation IDs; stack traces sanitized in production).
345
+
346
+ ## Developer-impacting behavior changes (review for compatibility)
347
+ These are not flagged as “obvious breaking changes” by automated detection, but they may affect existing integrations:
348
+ - **Import-time global configuration:** the module configures redaction and error sanitization **at import time**. If your application already configures `@theunwalked/offrecord` / `@theunwalked/spotclean`, verify there’s no conflicting configuration or duplicated behavior.
349
+ - **Error shape/message changes:** callers that relied on raw Anthropic SDK error messages, stack traces, or error types may now see sanitized/wrapped errors instead.
350
+ - **Stricter API key acceptance:** previously accepted but non-matching key strings will now fail validation before making a request.
351
+
352
+ ## Build / packaging updates
353
+ - Added runtime dependencies used for redaction and sanitization:
354
+ - `@theunwalked/offrecord`
355
+ - `@theunwalked/spotclean`
356
+ - Updated Vite build externals to ensure these dependencies are treated as external during bundling.
357
+ - Updated the `precommit` script to run `build` before `lint` and `test`.
358
+
359
+ ## Repo hygiene
360
+ - `.gitignore` now ignores `.kodrdriv*` internal files.
361
+
362
+ ## Notes
363
+ - Package version has been bumped to **1.0.0**.
364
+ - If you surface provider errors to end users or logs, verify your monitoring/alerting still gets the information it needs now that error output is sanitized.
365
+ ```