@posthog/agent 1.16.1 → 1.16.2

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.
@@ -1148,7 +1148,7 @@ function createAnthropic(options = {}) {
1148
1148
  provider.tools = anthropicTools;
1149
1149
  return provider;
1150
1150
  }
1151
- var anthropic = createAnthropic();
1151
+ createAnthropic();
1152
1152
 
1153
- export { anthropic, createAnthropic };
1153
+ export { createAnthropic };
1154
1154
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../node_modules/@ai-sdk/anthropic/dist/index.mjs"],"sourcesContent":["// src/anthropic-provider.ts\nimport {\n NoSuchModelError\n} from \"@ai-sdk/provider\";\nimport {\n loadApiKey,\n withoutTrailingSlash\n} from \"@ai-sdk/provider-utils\";\n\n// src/anthropic-messages-language-model.ts\nimport {\n UnsupportedFunctionalityError as UnsupportedFunctionalityError3\n} from \"@ai-sdk/provider\";\nimport {\n combineHeaders,\n createEventSourceResponseHandler,\n createJsonResponseHandler,\n parseProviderOptions,\n postJsonToApi,\n resolve\n} from \"@ai-sdk/provider-utils\";\nimport { z as z2 } from \"zod\";\n\n// src/anthropic-error.ts\nimport { createJsonErrorResponseHandler } from \"@ai-sdk/provider-utils\";\nimport { z } from \"zod\";\nvar anthropicErrorDataSchema = z.object({\n type: z.literal(\"error\"),\n error: z.object({\n type: z.string(),\n message: z.string()\n })\n});\nvar anthropicFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: anthropicErrorDataSchema,\n errorToMessage: (data) => data.error.message\n});\n\n// src/anthropic-prepare-tools.ts\nimport {\n UnsupportedFunctionalityError\n} from \"@ai-sdk/provider\";\nfunction prepareTools(mode) {\n var _a;\n const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;\n const toolWarnings = [];\n const betas = /* @__PURE__ */ new Set();\n if (tools == null) {\n return { tools: void 0, tool_choice: void 0, toolWarnings, betas };\n }\n const anthropicTools2 = [];\n for (const tool of tools) {\n switch (tool.type) {\n case \"function\":\n anthropicTools2.push({\n name: tool.name,\n description: tool.description,\n input_schema: tool.parameters\n });\n break;\n case \"provider-defined\":\n switch (tool.id) {\n case \"anthropic.computer_20250124\":\n betas.add(\"computer-use-2025-01-24\");\n anthropicTools2.push({\n name: tool.name,\n type: \"computer_20250124\",\n display_width_px: tool.args.displayWidthPx,\n display_height_px: tool.args.displayHeightPx,\n display_number: tool.args.displayNumber\n });\n break;\n case \"anthropic.computer_20241022\":\n betas.add(\"computer-use-2024-10-22\");\n anthropicTools2.push({\n name: tool.name,\n type: \"computer_20241022\",\n display_width_px: tool.args.displayWidthPx,\n display_height_px: tool.args.displayHeightPx,\n display_number: tool.args.displayNumber\n });\n break;\n case \"anthropic.text_editor_20250124\":\n betas.add(\"computer-use-2025-01-24\");\n anthropicTools2.push({\n name: tool.name,\n type: \"text_editor_20250124\"\n });\n break;\n case \"anthropic.text_editor_20241022\":\n betas.add(\"computer-use-2024-10-22\");\n anthropicTools2.push({\n name: tool.name,\n type: \"text_editor_20241022\"\n });\n break;\n case \"anthropic.bash_20250124\":\n betas.add(\"computer-use-2025-01-24\");\n anthropicTools2.push({\n name: tool.name,\n type: \"bash_20250124\"\n });\n break;\n case \"anthropic.bash_20241022\":\n betas.add(\"computer-use-2024-10-22\");\n anthropicTools2.push({\n name: tool.name,\n type: \"bash_20241022\"\n });\n break;\n default:\n toolWarnings.push({ type: \"unsupported-tool\", tool });\n break;\n }\n break;\n default:\n toolWarnings.push({ type: \"unsupported-tool\", tool });\n break;\n }\n }\n const toolChoice = mode.toolChoice;\n if (toolChoice == null) {\n return {\n tools: anthropicTools2,\n tool_choice: void 0,\n toolWarnings,\n betas\n };\n }\n const type = toolChoice.type;\n switch (type) {\n case \"auto\":\n return {\n tools: anthropicTools2,\n tool_choice: { type: \"auto\" },\n toolWarnings,\n betas\n };\n case \"required\":\n return {\n tools: anthropicTools2,\n tool_choice: { type: \"any\" },\n toolWarnings,\n betas\n };\n case \"none\":\n return { tools: void 0, tool_choice: void 0, toolWarnings, betas };\n case \"tool\":\n return {\n tools: anthropicTools2,\n tool_choice: { type: \"tool\", name: toolChoice.toolName },\n toolWarnings,\n betas\n };\n default: {\n const _exhaustiveCheck = type;\n throw new UnsupportedFunctionalityError({\n functionality: `Unsupported tool choice type: ${_exhaustiveCheck}`\n });\n }\n }\n}\n\n// src/convert-to-anthropic-messages-prompt.ts\nimport {\n UnsupportedFunctionalityError as UnsupportedFunctionalityError2\n} from \"@ai-sdk/provider\";\nimport { convertUint8ArrayToBase64 } from \"@ai-sdk/provider-utils\";\nfunction convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning,\n warnings\n}) {\n var _a, _b, _c, _d;\n const betas = /* @__PURE__ */ new Set();\n const blocks = groupIntoBlocks(prompt);\n let system = void 0;\n const messages = [];\n function getCacheControl(providerMetadata) {\n var _a2;\n const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;\n const cacheControlValue = (_a2 = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a2 : anthropic2 == null ? void 0 : anthropic2.cache_control;\n return cacheControlValue;\n }\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const isLastBlock = i === blocks.length - 1;\n const type = block.type;\n switch (type) {\n case \"system\": {\n if (system != null) {\n throw new UnsupportedFunctionalityError2({\n functionality: \"Multiple system messages that are separated by user/assistant messages\"\n });\n }\n system = block.messages.map(({ content, providerMetadata }) => ({\n type: \"text\",\n text: content,\n cache_control: getCacheControl(providerMetadata)\n }));\n break;\n }\n case \"user\": {\n const anthropicContent = [];\n for (const message of block.messages) {\n const { role, content } = message;\n switch (role) {\n case \"user\": {\n for (let j = 0; j < content.length; j++) {\n const part = content[j];\n const isLastPart = j === content.length - 1;\n const cacheControl = (_a = getCacheControl(part.providerMetadata)) != null ? _a : isLastPart ? getCacheControl(message.providerMetadata) : void 0;\n switch (part.type) {\n case \"text\": {\n anthropicContent.push({\n type: \"text\",\n text: part.text,\n cache_control: cacheControl\n });\n break;\n }\n case \"image\": {\n anthropicContent.push({\n type: \"image\",\n source: part.image instanceof URL ? {\n type: \"url\",\n url: part.image.toString()\n } : {\n type: \"base64\",\n media_type: (_b = part.mimeType) != null ? _b : \"image/jpeg\",\n data: convertUint8ArrayToBase64(part.image)\n },\n cache_control: cacheControl\n });\n break;\n }\n case \"file\": {\n if (part.mimeType !== \"application/pdf\") {\n throw new UnsupportedFunctionalityError2({\n functionality: \"Non-PDF files in user messages\"\n });\n }\n betas.add(\"pdfs-2024-09-25\");\n anthropicContent.push({\n type: \"document\",\n source: part.data instanceof URL ? {\n type: \"url\",\n url: part.data.toString()\n } : {\n type: \"base64\",\n media_type: \"application/pdf\",\n data: part.data\n },\n cache_control: cacheControl\n });\n break;\n }\n }\n }\n break;\n }\n case \"tool\": {\n for (let i2 = 0; i2 < content.length; i2++) {\n const part = content[i2];\n const isLastPart = i2 === content.length - 1;\n const cacheControl = (_c = getCacheControl(part.providerMetadata)) != null ? _c : isLastPart ? getCacheControl(message.providerMetadata) : void 0;\n const toolResultContent = part.content != null ? part.content.map((part2) => {\n var _a2;\n switch (part2.type) {\n case \"text\":\n return {\n type: \"text\",\n text: part2.text,\n cache_control: void 0\n };\n case \"image\":\n return {\n type: \"image\",\n source: {\n type: \"base64\",\n media_type: (_a2 = part2.mimeType) != null ? _a2 : \"image/jpeg\",\n data: part2.data\n },\n cache_control: void 0\n };\n }\n }) : JSON.stringify(part.result);\n anthropicContent.push({\n type: \"tool_result\",\n tool_use_id: part.toolCallId,\n content: toolResultContent,\n is_error: part.isError,\n cache_control: cacheControl\n });\n }\n break;\n }\n default: {\n const _exhaustiveCheck = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n messages.push({ role: \"user\", content: anthropicContent });\n break;\n }\n case \"assistant\": {\n const anthropicContent = [];\n for (let j = 0; j < block.messages.length; j++) {\n const message = block.messages[j];\n const isLastMessage = j === block.messages.length - 1;\n const { content } = message;\n for (let k = 0; k < content.length; k++) {\n const part = content[k];\n const isLastContentPart = k === content.length - 1;\n const cacheControl = (_d = getCacheControl(part.providerMetadata)) != null ? _d : isLastContentPart ? getCacheControl(message.providerMetadata) : void 0;\n switch (part.type) {\n case \"text\": {\n anthropicContent.push({\n type: \"text\",\n text: (\n // trim the last text part if it's the last message in the block\n // because Anthropic does not allow trailing whitespace\n // in pre-filled assistant responses\n isLastBlock && isLastMessage && isLastContentPart ? part.text.trim() : part.text\n ),\n cache_control: cacheControl\n });\n break;\n }\n case \"reasoning\": {\n if (sendReasoning) {\n anthropicContent.push({\n type: \"thinking\",\n thinking: part.text,\n signature: part.signature,\n cache_control: cacheControl\n });\n } else {\n warnings.push({\n type: \"other\",\n message: \"sending reasoning content is disabled for this model\"\n });\n }\n break;\n }\n case \"redacted-reasoning\": {\n anthropicContent.push({\n type: \"redacted_thinking\",\n data: part.data,\n cache_control: cacheControl\n });\n break;\n }\n case \"tool-call\": {\n anthropicContent.push({\n type: \"tool_use\",\n id: part.toolCallId,\n name: part.toolName,\n input: part.args,\n cache_control: cacheControl\n });\n break;\n }\n }\n }\n }\n messages.push({ role: \"assistant\", content: anthropicContent });\n break;\n }\n default: {\n const _exhaustiveCheck = type;\n throw new Error(`Unsupported type: ${_exhaustiveCheck}`);\n }\n }\n }\n return {\n prompt: { system, messages },\n betas\n };\n}\nfunction groupIntoBlocks(prompt) {\n const blocks = [];\n let currentBlock = void 0;\n for (const message of prompt) {\n const { role } = message;\n switch (role) {\n case \"system\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"system\") {\n currentBlock = { type: \"system\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n case \"assistant\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"assistant\") {\n currentBlock = { type: \"assistant\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n case \"user\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"user\") {\n currentBlock = { type: \"user\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n case \"tool\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"user\") {\n currentBlock = { type: \"user\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n default: {\n const _exhaustiveCheck = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n return blocks;\n}\n\n// src/map-anthropic-stop-reason.ts\nfunction mapAnthropicStopReason(finishReason) {\n switch (finishReason) {\n case \"end_turn\":\n case \"stop_sequence\":\n return \"stop\";\n case \"tool_use\":\n return \"tool-calls\";\n case \"max_tokens\":\n return \"length\";\n default:\n return \"unknown\";\n }\n}\n\n// src/anthropic-messages-language-model.ts\nvar AnthropicMessagesLanguageModel = class {\n constructor(modelId, settings, config) {\n this.specificationVersion = \"v1\";\n this.defaultObjectGenerationMode = \"tool\";\n this.modelId = modelId;\n this.settings = settings;\n this.config = config;\n }\n supportsUrl(url) {\n return url.protocol === \"https:\";\n }\n get provider() {\n return this.config.provider;\n }\n get supportsImageUrls() {\n return this.config.supportsImageUrls;\n }\n async getArgs({\n mode,\n prompt,\n maxTokens = 4096,\n // 4096: max model output tokens TODO update default in v5\n temperature,\n topP,\n topK,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n responseFormat,\n seed,\n providerMetadata: providerOptions\n }) {\n var _a, _b, _c;\n const type = mode.type;\n const warnings = [];\n if (frequencyPenalty != null) {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"frequencyPenalty\"\n });\n }\n if (presencePenalty != null) {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"presencePenalty\"\n });\n }\n if (seed != null) {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"seed\"\n });\n }\n if (responseFormat != null && responseFormat.type !== \"text\") {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"responseFormat\",\n details: \"JSON response format is not supported.\"\n });\n }\n const { prompt: messagesPrompt, betas: messagesBetas } = convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning: (_a = this.settings.sendReasoning) != null ? _a : true,\n warnings\n });\n const anthropicOptions = parseProviderOptions({\n provider: \"anthropic\",\n providerOptions,\n schema: anthropicProviderOptionsSchema\n });\n const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === \"enabled\";\n const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;\n const baseArgs = {\n // model id:\n model: this.modelId,\n // standardized settings:\n max_tokens: maxTokens,\n temperature,\n top_k: topK,\n top_p: topP,\n stop_sequences: stopSequences,\n // provider specific settings:\n ...isThinking && {\n thinking: { type: \"enabled\", budget_tokens: thinkingBudget }\n },\n // prompt:\n system: messagesPrompt.system,\n messages: messagesPrompt.messages\n };\n if (isThinking) {\n if (thinkingBudget == null) {\n throw new UnsupportedFunctionalityError3({\n functionality: \"thinking requires a budget\"\n });\n }\n if (baseArgs.temperature != null) {\n baseArgs.temperature = void 0;\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"temperature\",\n details: \"temperature is not supported when thinking is enabled\"\n });\n }\n if (topK != null) {\n baseArgs.top_k = void 0;\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"topK\",\n details: \"topK is not supported when thinking is enabled\"\n });\n }\n if (topP != null) {\n baseArgs.top_p = void 0;\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"topP\",\n details: \"topP is not supported when thinking is enabled\"\n });\n }\n baseArgs.max_tokens = maxTokens + thinkingBudget;\n }\n switch (type) {\n case \"regular\": {\n const {\n tools,\n tool_choice,\n toolWarnings,\n betas: toolsBetas\n } = prepareTools(mode);\n return {\n args: { ...baseArgs, tools, tool_choice },\n warnings: [...warnings, ...toolWarnings],\n betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas])\n };\n }\n case \"object-json\": {\n throw new UnsupportedFunctionalityError3({\n functionality: \"json-mode object generation\"\n });\n }\n case \"object-tool\": {\n const { name, description, parameters } = mode.tool;\n return {\n args: {\n ...baseArgs,\n tools: [{ name, description, input_schema: parameters }],\n tool_choice: { type: \"tool\", name }\n },\n warnings,\n betas: messagesBetas\n };\n }\n default: {\n const _exhaustiveCheck = type;\n throw new Error(`Unsupported type: ${_exhaustiveCheck}`);\n }\n }\n }\n async getHeaders({\n betas,\n headers\n }) {\n return combineHeaders(\n await resolve(this.config.headers),\n betas.size > 0 ? { \"anthropic-beta\": Array.from(betas).join(\",\") } : {},\n headers\n );\n }\n buildRequestUrl(isStreaming) {\n var _a, _b, _c;\n return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;\n }\n transformRequestBody(args) {\n var _a, _b, _c;\n return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;\n }\n async doGenerate(options) {\n var _a, _b, _c, _d;\n const { args, warnings, betas } = await this.getArgs(options);\n const {\n responseHeaders,\n value: response,\n rawValue: rawResponse\n } = await postJsonToApi({\n url: this.buildRequestUrl(false),\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(args),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(\n anthropicMessagesResponseSchema\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch\n });\n const { messages: rawPrompt, ...rawSettings } = args;\n let text = \"\";\n for (const content of response.content) {\n if (content.type === \"text\") {\n text += content.text;\n }\n }\n let toolCalls = void 0;\n if (response.content.some((content) => content.type === \"tool_use\")) {\n toolCalls = [];\n for (const content of response.content) {\n if (content.type === \"tool_use\") {\n toolCalls.push({\n toolCallType: \"function\",\n toolCallId: content.id,\n toolName: content.name,\n args: JSON.stringify(content.input)\n });\n }\n }\n }\n const reasoning = response.content.filter(\n (content) => content.type === \"redacted_thinking\" || content.type === \"thinking\"\n ).map(\n (content) => content.type === \"thinking\" ? {\n type: \"text\",\n text: content.thinking,\n signature: content.signature\n } : {\n type: \"redacted\",\n data: content.data\n }\n );\n return {\n text,\n reasoning: reasoning.length > 0 ? reasoning : void 0,\n toolCalls,\n finishReason: mapAnthropicStopReason(response.stop_reason),\n usage: {\n promptTokens: response.usage.input_tokens,\n completionTokens: response.usage.output_tokens\n },\n rawCall: { rawPrompt, rawSettings },\n rawResponse: {\n headers: responseHeaders,\n body: rawResponse\n },\n response: {\n id: (_a = response.id) != null ? _a : void 0,\n modelId: (_b = response.model) != null ? _b : void 0\n },\n warnings,\n providerMetadata: {\n anthropic: {\n cacheCreationInputTokens: (_c = response.usage.cache_creation_input_tokens) != null ? _c : null,\n cacheReadInputTokens: (_d = response.usage.cache_read_input_tokens) != null ? _d : null\n }\n },\n request: { body: JSON.stringify(args) }\n };\n }\n async doStream(options) {\n const { args, warnings, betas } = await this.getArgs(options);\n const body = { ...args, stream: true };\n const { responseHeaders, value: response } = await postJsonToApi({\n url: this.buildRequestUrl(true),\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(body),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createEventSourceResponseHandler(\n anthropicMessagesChunkSchema\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch\n });\n const { messages: rawPrompt, ...rawSettings } = args;\n let finishReason = \"unknown\";\n const usage = {\n promptTokens: Number.NaN,\n completionTokens: Number.NaN\n };\n const toolCallContentBlocks = {};\n let providerMetadata = void 0;\n let blockType = void 0;\n return {\n stream: response.pipeThrough(\n new TransformStream({\n transform(chunk, controller) {\n var _a, _b, _c, _d;\n if (!chunk.success) {\n controller.enqueue({ type: \"error\", error: chunk.error });\n return;\n }\n const value = chunk.value;\n switch (value.type) {\n case \"ping\": {\n return;\n }\n case \"content_block_start\": {\n const contentBlockType = value.content_block.type;\n blockType = contentBlockType;\n switch (contentBlockType) {\n case \"text\":\n case \"thinking\": {\n return;\n }\n case \"redacted_thinking\": {\n controller.enqueue({\n type: \"redacted-reasoning\",\n data: value.content_block.data\n });\n return;\n }\n case \"tool_use\": {\n toolCallContentBlocks[value.index] = {\n toolCallId: value.content_block.id,\n toolName: value.content_block.name,\n jsonText: \"\"\n };\n return;\n }\n default: {\n const _exhaustiveCheck = contentBlockType;\n throw new Error(\n `Unsupported content block type: ${_exhaustiveCheck}`\n );\n }\n }\n }\n case \"content_block_stop\": {\n if (toolCallContentBlocks[value.index] != null) {\n const contentBlock = toolCallContentBlocks[value.index];\n controller.enqueue({\n type: \"tool-call\",\n toolCallType: \"function\",\n toolCallId: contentBlock.toolCallId,\n toolName: contentBlock.toolName,\n args: contentBlock.jsonText\n });\n delete toolCallContentBlocks[value.index];\n }\n blockType = void 0;\n return;\n }\n case \"content_block_delta\": {\n const deltaType = value.delta.type;\n switch (deltaType) {\n case \"text_delta\": {\n controller.enqueue({\n type: \"text-delta\",\n textDelta: value.delta.text\n });\n return;\n }\n case \"thinking_delta\": {\n controller.enqueue({\n type: \"reasoning\",\n textDelta: value.delta.thinking\n });\n return;\n }\n case \"signature_delta\": {\n if (blockType === \"thinking\") {\n controller.enqueue({\n type: \"reasoning-signature\",\n signature: value.delta.signature\n });\n }\n return;\n }\n case \"input_json_delta\": {\n const contentBlock = toolCallContentBlocks[value.index];\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId: contentBlock.toolCallId,\n toolName: contentBlock.toolName,\n argsTextDelta: value.delta.partial_json\n });\n contentBlock.jsonText += value.delta.partial_json;\n return;\n }\n default: {\n const _exhaustiveCheck = deltaType;\n throw new Error(\n `Unsupported delta type: ${_exhaustiveCheck}`\n );\n }\n }\n }\n case \"message_start\": {\n usage.promptTokens = value.message.usage.input_tokens;\n usage.completionTokens = value.message.usage.output_tokens;\n providerMetadata = {\n anthropic: {\n cacheCreationInputTokens: (_a = value.message.usage.cache_creation_input_tokens) != null ? _a : null,\n cacheReadInputTokens: (_b = value.message.usage.cache_read_input_tokens) != null ? _b : null\n }\n };\n controller.enqueue({\n type: \"response-metadata\",\n id: (_c = value.message.id) != null ? _c : void 0,\n modelId: (_d = value.message.model) != null ? _d : void 0\n });\n return;\n }\n case \"message_delta\": {\n usage.completionTokens = value.usage.output_tokens;\n finishReason = mapAnthropicStopReason(value.delta.stop_reason);\n return;\n }\n case \"message_stop\": {\n controller.enqueue({\n type: \"finish\",\n finishReason,\n usage,\n providerMetadata\n });\n return;\n }\n case \"error\": {\n controller.enqueue({ type: \"error\", error: value.error });\n return;\n }\n default: {\n const _exhaustiveCheck = value;\n throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);\n }\n }\n }\n })\n ),\n rawCall: { rawPrompt, rawSettings },\n rawResponse: { headers: responseHeaders },\n warnings,\n request: { body: JSON.stringify(body) }\n };\n }\n};\nvar anthropicMessagesResponseSchema = z2.object({\n type: z2.literal(\"message\"),\n id: z2.string().nullish(),\n model: z2.string().nullish(),\n content: z2.array(\n z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"text\"),\n text: z2.string()\n }),\n z2.object({\n type: z2.literal(\"thinking\"),\n thinking: z2.string(),\n signature: z2.string()\n }),\n z2.object({\n type: z2.literal(\"redacted_thinking\"),\n data: z2.string()\n }),\n z2.object({\n type: z2.literal(\"tool_use\"),\n id: z2.string(),\n name: z2.string(),\n input: z2.unknown()\n })\n ])\n ),\n stop_reason: z2.string().nullish(),\n usage: z2.object({\n input_tokens: z2.number(),\n output_tokens: z2.number(),\n cache_creation_input_tokens: z2.number().nullish(),\n cache_read_input_tokens: z2.number().nullish()\n })\n});\nvar anthropicMessagesChunkSchema = z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"message_start\"),\n message: z2.object({\n id: z2.string().nullish(),\n model: z2.string().nullish(),\n usage: z2.object({\n input_tokens: z2.number(),\n output_tokens: z2.number(),\n cache_creation_input_tokens: z2.number().nullish(),\n cache_read_input_tokens: z2.number().nullish()\n })\n })\n }),\n z2.object({\n type: z2.literal(\"content_block_start\"),\n index: z2.number(),\n content_block: z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"text\"),\n text: z2.string()\n }),\n z2.object({\n type: z2.literal(\"thinking\"),\n thinking: z2.string()\n }),\n z2.object({\n type: z2.literal(\"tool_use\"),\n id: z2.string(),\n name: z2.string()\n }),\n z2.object({\n type: z2.literal(\"redacted_thinking\"),\n data: z2.string()\n })\n ])\n }),\n z2.object({\n type: z2.literal(\"content_block_delta\"),\n index: z2.number(),\n delta: z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"input_json_delta\"),\n partial_json: z2.string()\n }),\n z2.object({\n type: z2.literal(\"text_delta\"),\n text: z2.string()\n }),\n z2.object({\n type: z2.literal(\"thinking_delta\"),\n thinking: z2.string()\n }),\n z2.object({\n type: z2.literal(\"signature_delta\"),\n signature: z2.string()\n })\n ])\n }),\n z2.object({\n type: z2.literal(\"content_block_stop\"),\n index: z2.number()\n }),\n z2.object({\n type: z2.literal(\"error\"),\n error: z2.object({\n type: z2.string(),\n message: z2.string()\n })\n }),\n z2.object({\n type: z2.literal(\"message_delta\"),\n delta: z2.object({ stop_reason: z2.string().nullish() }),\n usage: z2.object({ output_tokens: z2.number() })\n }),\n z2.object({\n type: z2.literal(\"message_stop\")\n }),\n z2.object({\n type: z2.literal(\"ping\")\n })\n]);\nvar anthropicProviderOptionsSchema = z2.object({\n thinking: z2.object({\n type: z2.union([z2.literal(\"enabled\"), z2.literal(\"disabled\")]),\n budgetTokens: z2.number().optional()\n }).optional()\n});\n\n// src/anthropic-tools.ts\nimport { z as z3 } from \"zod\";\nvar Bash20241022Parameters = z3.object({\n command: z3.string(),\n restart: z3.boolean().optional()\n});\nfunction bashTool_20241022(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.bash_20241022\",\n args: {},\n parameters: Bash20241022Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar Bash20250124Parameters = z3.object({\n command: z3.string(),\n restart: z3.boolean().optional()\n});\nfunction bashTool_20250124(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.bash_20250124\",\n args: {},\n parameters: Bash20250124Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar TextEditor20241022Parameters = z3.object({\n command: z3.enum([\"view\", \"create\", \"str_replace\", \"insert\", \"undo_edit\"]),\n path: z3.string(),\n file_text: z3.string().optional(),\n insert_line: z3.number().int().optional(),\n new_str: z3.string().optional(),\n old_str: z3.string().optional(),\n view_range: z3.array(z3.number().int()).optional()\n});\nfunction textEditorTool_20241022(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.text_editor_20241022\",\n args: {},\n parameters: TextEditor20241022Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar TextEditor20250124Parameters = z3.object({\n command: z3.enum([\"view\", \"create\", \"str_replace\", \"insert\", \"undo_edit\"]),\n path: z3.string(),\n file_text: z3.string().optional(),\n insert_line: z3.number().int().optional(),\n new_str: z3.string().optional(),\n old_str: z3.string().optional(),\n view_range: z3.array(z3.number().int()).optional()\n});\nfunction textEditorTool_20250124(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.text_editor_20250124\",\n args: {},\n parameters: TextEditor20250124Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar Computer20241022Parameters = z3.object({\n action: z3.enum([\n \"key\",\n \"type\",\n \"mouse_move\",\n \"left_click\",\n \"left_click_drag\",\n \"right_click\",\n \"middle_click\",\n \"double_click\",\n \"screenshot\",\n \"cursor_position\"\n ]),\n coordinate: z3.array(z3.number().int()).optional(),\n text: z3.string().optional()\n});\nfunction computerTool_20241022(options) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.computer_20241022\",\n args: {\n displayWidthPx: options.displayWidthPx,\n displayHeightPx: options.displayHeightPx,\n displayNumber: options.displayNumber\n },\n parameters: Computer20241022Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar Computer20250124Parameters = z3.object({\n action: z3.enum([\n \"key\",\n \"hold_key\",\n \"type\",\n \"cursor_position\",\n \"mouse_move\",\n \"left_mouse_down\",\n \"left_mouse_up\",\n \"left_click\",\n \"left_click_drag\",\n \"right_click\",\n \"middle_click\",\n \"double_click\",\n \"triple_click\",\n \"scroll\",\n \"wait\",\n \"screenshot\"\n ]),\n coordinate: z3.tuple([z3.number().int(), z3.number().int()]).optional(),\n duration: z3.number().optional(),\n scroll_amount: z3.number().optional(),\n scroll_direction: z3.enum([\"up\", \"down\", \"left\", \"right\"]).optional(),\n start_coordinate: z3.tuple([z3.number().int(), z3.number().int()]).optional(),\n text: z3.string().optional()\n});\nfunction computerTool_20250124(options) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.computer_20250124\",\n args: {\n displayWidthPx: options.displayWidthPx,\n displayHeightPx: options.displayHeightPx,\n displayNumber: options.displayNumber\n },\n parameters: Computer20250124Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar anthropicTools = {\n bash_20241022: bashTool_20241022,\n bash_20250124: bashTool_20250124,\n textEditor_20241022: textEditorTool_20241022,\n textEditor_20250124: textEditorTool_20250124,\n computer_20241022: computerTool_20241022,\n computer_20250124: computerTool_20250124\n};\n\n// src/anthropic-provider.ts\nfunction createAnthropic(options = {}) {\n var _a;\n const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : \"https://api.anthropic.com/v1\";\n const getHeaders = () => ({\n \"anthropic-version\": \"2023-06-01\",\n \"x-api-key\": loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: \"ANTHROPIC_API_KEY\",\n description: \"Anthropic\"\n }),\n ...options.headers\n });\n const createChatModel = (modelId, settings = {}) => new AnthropicMessagesLanguageModel(modelId, settings, {\n provider: \"anthropic.messages\",\n baseURL,\n headers: getHeaders,\n fetch: options.fetch,\n supportsImageUrls: true\n });\n const provider = function(modelId, settings) {\n if (new.target) {\n throw new Error(\n \"The Anthropic model function cannot be called with the new keyword.\"\n );\n }\n return createChatModel(modelId, settings);\n };\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n provider.textEmbeddingModel = (modelId) => {\n throw new NoSuchModelError({ modelId, modelType: \"textEmbeddingModel\" });\n };\n provider.tools = anthropicTools;\n return provider;\n}\nvar anthropic = createAnthropic();\nexport {\n anthropic,\n createAnthropic\n};\n//# sourceMappingURL=index.mjs.map"],"names":["UnsupportedFunctionalityError2","UnsupportedFunctionalityError3","z2","z3"],"mappings":";;;;AAAA;AA0BA,IAAI,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;AACxC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AAC1B,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;AAClB,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;AACpB,IAAI,OAAO,EAAE,CAAC,CAAC,MAAM;AACrB,GAAG;AACH,CAAC,CAAC;AACF,IAAI,8BAA8B,GAAG,8BAA8B,CAAC;AACpE,EAAE,WAAW,EAAE,wBAAwB;AACvC,EAAE,cAAc,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC;AACvC,CAAC,CAAC;AAMF,SAAS,YAAY,CAAC,IAAI,EAAE;AAC5B,EAAE,IAAI,EAAE;AACR,EAAE,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,GAAG,MAAM,GAAG,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,GAAG,MAAM;AACtF,EAAE,MAAM,YAAY,GAAG,EAAE;AACzB,EAAE,MAAM,KAAK,mBAAmB,IAAI,GAAG,EAAE;AACzC,EAAE,IAAI,KAAK,IAAI,IAAI,EAAE;AACrB,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OAAO,QAAQ;AACjB;AACG,IAAC,SAAS,GAAG,eAAe;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../node_modules/@ai-sdk/anthropic/dist/index.mjs"],"sourcesContent":["// src/anthropic-provider.ts\nimport {\n NoSuchModelError\n} from \"@ai-sdk/provider\";\nimport {\n loadApiKey,\n withoutTrailingSlash\n} from \"@ai-sdk/provider-utils\";\n\n// src/anthropic-messages-language-model.ts\nimport {\n UnsupportedFunctionalityError as UnsupportedFunctionalityError3\n} from \"@ai-sdk/provider\";\nimport {\n combineHeaders,\n createEventSourceResponseHandler,\n createJsonResponseHandler,\n parseProviderOptions,\n postJsonToApi,\n resolve\n} from \"@ai-sdk/provider-utils\";\nimport { z as z2 } from \"zod\";\n\n// src/anthropic-error.ts\nimport { createJsonErrorResponseHandler } from \"@ai-sdk/provider-utils\";\nimport { z } from \"zod\";\nvar anthropicErrorDataSchema = z.object({\n type: z.literal(\"error\"),\n error: z.object({\n type: z.string(),\n message: z.string()\n })\n});\nvar anthropicFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: anthropicErrorDataSchema,\n errorToMessage: (data) => data.error.message\n});\n\n// src/anthropic-prepare-tools.ts\nimport {\n UnsupportedFunctionalityError\n} from \"@ai-sdk/provider\";\nfunction prepareTools(mode) {\n var _a;\n const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;\n const toolWarnings = [];\n const betas = /* @__PURE__ */ new Set();\n if (tools == null) {\n return { tools: void 0, tool_choice: void 0, toolWarnings, betas };\n }\n const anthropicTools2 = [];\n for (const tool of tools) {\n switch (tool.type) {\n case \"function\":\n anthropicTools2.push({\n name: tool.name,\n description: tool.description,\n input_schema: tool.parameters\n });\n break;\n case \"provider-defined\":\n switch (tool.id) {\n case \"anthropic.computer_20250124\":\n betas.add(\"computer-use-2025-01-24\");\n anthropicTools2.push({\n name: tool.name,\n type: \"computer_20250124\",\n display_width_px: tool.args.displayWidthPx,\n display_height_px: tool.args.displayHeightPx,\n display_number: tool.args.displayNumber\n });\n break;\n case \"anthropic.computer_20241022\":\n betas.add(\"computer-use-2024-10-22\");\n anthropicTools2.push({\n name: tool.name,\n type: \"computer_20241022\",\n display_width_px: tool.args.displayWidthPx,\n display_height_px: tool.args.displayHeightPx,\n display_number: tool.args.displayNumber\n });\n break;\n case \"anthropic.text_editor_20250124\":\n betas.add(\"computer-use-2025-01-24\");\n anthropicTools2.push({\n name: tool.name,\n type: \"text_editor_20250124\"\n });\n break;\n case \"anthropic.text_editor_20241022\":\n betas.add(\"computer-use-2024-10-22\");\n anthropicTools2.push({\n name: tool.name,\n type: \"text_editor_20241022\"\n });\n break;\n case \"anthropic.bash_20250124\":\n betas.add(\"computer-use-2025-01-24\");\n anthropicTools2.push({\n name: tool.name,\n type: \"bash_20250124\"\n });\n break;\n case \"anthropic.bash_20241022\":\n betas.add(\"computer-use-2024-10-22\");\n anthropicTools2.push({\n name: tool.name,\n type: \"bash_20241022\"\n });\n break;\n default:\n toolWarnings.push({ type: \"unsupported-tool\", tool });\n break;\n }\n break;\n default:\n toolWarnings.push({ type: \"unsupported-tool\", tool });\n break;\n }\n }\n const toolChoice = mode.toolChoice;\n if (toolChoice == null) {\n return {\n tools: anthropicTools2,\n tool_choice: void 0,\n toolWarnings,\n betas\n };\n }\n const type = toolChoice.type;\n switch (type) {\n case \"auto\":\n return {\n tools: anthropicTools2,\n tool_choice: { type: \"auto\" },\n toolWarnings,\n betas\n };\n case \"required\":\n return {\n tools: anthropicTools2,\n tool_choice: { type: \"any\" },\n toolWarnings,\n betas\n };\n case \"none\":\n return { tools: void 0, tool_choice: void 0, toolWarnings, betas };\n case \"tool\":\n return {\n tools: anthropicTools2,\n tool_choice: { type: \"tool\", name: toolChoice.toolName },\n toolWarnings,\n betas\n };\n default: {\n const _exhaustiveCheck = type;\n throw new UnsupportedFunctionalityError({\n functionality: `Unsupported tool choice type: ${_exhaustiveCheck}`\n });\n }\n }\n}\n\n// src/convert-to-anthropic-messages-prompt.ts\nimport {\n UnsupportedFunctionalityError as UnsupportedFunctionalityError2\n} from \"@ai-sdk/provider\";\nimport { convertUint8ArrayToBase64 } from \"@ai-sdk/provider-utils\";\nfunction convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning,\n warnings\n}) {\n var _a, _b, _c, _d;\n const betas = /* @__PURE__ */ new Set();\n const blocks = groupIntoBlocks(prompt);\n let system = void 0;\n const messages = [];\n function getCacheControl(providerMetadata) {\n var _a2;\n const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;\n const cacheControlValue = (_a2 = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a2 : anthropic2 == null ? void 0 : anthropic2.cache_control;\n return cacheControlValue;\n }\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const isLastBlock = i === blocks.length - 1;\n const type = block.type;\n switch (type) {\n case \"system\": {\n if (system != null) {\n throw new UnsupportedFunctionalityError2({\n functionality: \"Multiple system messages that are separated by user/assistant messages\"\n });\n }\n system = block.messages.map(({ content, providerMetadata }) => ({\n type: \"text\",\n text: content,\n cache_control: getCacheControl(providerMetadata)\n }));\n break;\n }\n case \"user\": {\n const anthropicContent = [];\n for (const message of block.messages) {\n const { role, content } = message;\n switch (role) {\n case \"user\": {\n for (let j = 0; j < content.length; j++) {\n const part = content[j];\n const isLastPart = j === content.length - 1;\n const cacheControl = (_a = getCacheControl(part.providerMetadata)) != null ? _a : isLastPart ? getCacheControl(message.providerMetadata) : void 0;\n switch (part.type) {\n case \"text\": {\n anthropicContent.push({\n type: \"text\",\n text: part.text,\n cache_control: cacheControl\n });\n break;\n }\n case \"image\": {\n anthropicContent.push({\n type: \"image\",\n source: part.image instanceof URL ? {\n type: \"url\",\n url: part.image.toString()\n } : {\n type: \"base64\",\n media_type: (_b = part.mimeType) != null ? _b : \"image/jpeg\",\n data: convertUint8ArrayToBase64(part.image)\n },\n cache_control: cacheControl\n });\n break;\n }\n case \"file\": {\n if (part.mimeType !== \"application/pdf\") {\n throw new UnsupportedFunctionalityError2({\n functionality: \"Non-PDF files in user messages\"\n });\n }\n betas.add(\"pdfs-2024-09-25\");\n anthropicContent.push({\n type: \"document\",\n source: part.data instanceof URL ? {\n type: \"url\",\n url: part.data.toString()\n } : {\n type: \"base64\",\n media_type: \"application/pdf\",\n data: part.data\n },\n cache_control: cacheControl\n });\n break;\n }\n }\n }\n break;\n }\n case \"tool\": {\n for (let i2 = 0; i2 < content.length; i2++) {\n const part = content[i2];\n const isLastPart = i2 === content.length - 1;\n const cacheControl = (_c = getCacheControl(part.providerMetadata)) != null ? _c : isLastPart ? getCacheControl(message.providerMetadata) : void 0;\n const toolResultContent = part.content != null ? part.content.map((part2) => {\n var _a2;\n switch (part2.type) {\n case \"text\":\n return {\n type: \"text\",\n text: part2.text,\n cache_control: void 0\n };\n case \"image\":\n return {\n type: \"image\",\n source: {\n type: \"base64\",\n media_type: (_a2 = part2.mimeType) != null ? _a2 : \"image/jpeg\",\n data: part2.data\n },\n cache_control: void 0\n };\n }\n }) : JSON.stringify(part.result);\n anthropicContent.push({\n type: \"tool_result\",\n tool_use_id: part.toolCallId,\n content: toolResultContent,\n is_error: part.isError,\n cache_control: cacheControl\n });\n }\n break;\n }\n default: {\n const _exhaustiveCheck = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n messages.push({ role: \"user\", content: anthropicContent });\n break;\n }\n case \"assistant\": {\n const anthropicContent = [];\n for (let j = 0; j < block.messages.length; j++) {\n const message = block.messages[j];\n const isLastMessage = j === block.messages.length - 1;\n const { content } = message;\n for (let k = 0; k < content.length; k++) {\n const part = content[k];\n const isLastContentPart = k === content.length - 1;\n const cacheControl = (_d = getCacheControl(part.providerMetadata)) != null ? _d : isLastContentPart ? getCacheControl(message.providerMetadata) : void 0;\n switch (part.type) {\n case \"text\": {\n anthropicContent.push({\n type: \"text\",\n text: (\n // trim the last text part if it's the last message in the block\n // because Anthropic does not allow trailing whitespace\n // in pre-filled assistant responses\n isLastBlock && isLastMessage && isLastContentPart ? part.text.trim() : part.text\n ),\n cache_control: cacheControl\n });\n break;\n }\n case \"reasoning\": {\n if (sendReasoning) {\n anthropicContent.push({\n type: \"thinking\",\n thinking: part.text,\n signature: part.signature,\n cache_control: cacheControl\n });\n } else {\n warnings.push({\n type: \"other\",\n message: \"sending reasoning content is disabled for this model\"\n });\n }\n break;\n }\n case \"redacted-reasoning\": {\n anthropicContent.push({\n type: \"redacted_thinking\",\n data: part.data,\n cache_control: cacheControl\n });\n break;\n }\n case \"tool-call\": {\n anthropicContent.push({\n type: \"tool_use\",\n id: part.toolCallId,\n name: part.toolName,\n input: part.args,\n cache_control: cacheControl\n });\n break;\n }\n }\n }\n }\n messages.push({ role: \"assistant\", content: anthropicContent });\n break;\n }\n default: {\n const _exhaustiveCheck = type;\n throw new Error(`Unsupported type: ${_exhaustiveCheck}`);\n }\n }\n }\n return {\n prompt: { system, messages },\n betas\n };\n}\nfunction groupIntoBlocks(prompt) {\n const blocks = [];\n let currentBlock = void 0;\n for (const message of prompt) {\n const { role } = message;\n switch (role) {\n case \"system\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"system\") {\n currentBlock = { type: \"system\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n case \"assistant\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"assistant\") {\n currentBlock = { type: \"assistant\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n case \"user\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"user\") {\n currentBlock = { type: \"user\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n case \"tool\": {\n if ((currentBlock == null ? void 0 : currentBlock.type) !== \"user\") {\n currentBlock = { type: \"user\", messages: [] };\n blocks.push(currentBlock);\n }\n currentBlock.messages.push(message);\n break;\n }\n default: {\n const _exhaustiveCheck = role;\n throw new Error(`Unsupported role: ${_exhaustiveCheck}`);\n }\n }\n }\n return blocks;\n}\n\n// src/map-anthropic-stop-reason.ts\nfunction mapAnthropicStopReason(finishReason) {\n switch (finishReason) {\n case \"end_turn\":\n case \"stop_sequence\":\n return \"stop\";\n case \"tool_use\":\n return \"tool-calls\";\n case \"max_tokens\":\n return \"length\";\n default:\n return \"unknown\";\n }\n}\n\n// src/anthropic-messages-language-model.ts\nvar AnthropicMessagesLanguageModel = class {\n constructor(modelId, settings, config) {\n this.specificationVersion = \"v1\";\n this.defaultObjectGenerationMode = \"tool\";\n this.modelId = modelId;\n this.settings = settings;\n this.config = config;\n }\n supportsUrl(url) {\n return url.protocol === \"https:\";\n }\n get provider() {\n return this.config.provider;\n }\n get supportsImageUrls() {\n return this.config.supportsImageUrls;\n }\n async getArgs({\n mode,\n prompt,\n maxTokens = 4096,\n // 4096: max model output tokens TODO update default in v5\n temperature,\n topP,\n topK,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n responseFormat,\n seed,\n providerMetadata: providerOptions\n }) {\n var _a, _b, _c;\n const type = mode.type;\n const warnings = [];\n if (frequencyPenalty != null) {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"frequencyPenalty\"\n });\n }\n if (presencePenalty != null) {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"presencePenalty\"\n });\n }\n if (seed != null) {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"seed\"\n });\n }\n if (responseFormat != null && responseFormat.type !== \"text\") {\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"responseFormat\",\n details: \"JSON response format is not supported.\"\n });\n }\n const { prompt: messagesPrompt, betas: messagesBetas } = convertToAnthropicMessagesPrompt({\n prompt,\n sendReasoning: (_a = this.settings.sendReasoning) != null ? _a : true,\n warnings\n });\n const anthropicOptions = parseProviderOptions({\n provider: \"anthropic\",\n providerOptions,\n schema: anthropicProviderOptionsSchema\n });\n const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === \"enabled\";\n const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;\n const baseArgs = {\n // model id:\n model: this.modelId,\n // standardized settings:\n max_tokens: maxTokens,\n temperature,\n top_k: topK,\n top_p: topP,\n stop_sequences: stopSequences,\n // provider specific settings:\n ...isThinking && {\n thinking: { type: \"enabled\", budget_tokens: thinkingBudget }\n },\n // prompt:\n system: messagesPrompt.system,\n messages: messagesPrompt.messages\n };\n if (isThinking) {\n if (thinkingBudget == null) {\n throw new UnsupportedFunctionalityError3({\n functionality: \"thinking requires a budget\"\n });\n }\n if (baseArgs.temperature != null) {\n baseArgs.temperature = void 0;\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"temperature\",\n details: \"temperature is not supported when thinking is enabled\"\n });\n }\n if (topK != null) {\n baseArgs.top_k = void 0;\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"topK\",\n details: \"topK is not supported when thinking is enabled\"\n });\n }\n if (topP != null) {\n baseArgs.top_p = void 0;\n warnings.push({\n type: \"unsupported-setting\",\n setting: \"topP\",\n details: \"topP is not supported when thinking is enabled\"\n });\n }\n baseArgs.max_tokens = maxTokens + thinkingBudget;\n }\n switch (type) {\n case \"regular\": {\n const {\n tools,\n tool_choice,\n toolWarnings,\n betas: toolsBetas\n } = prepareTools(mode);\n return {\n args: { ...baseArgs, tools, tool_choice },\n warnings: [...warnings, ...toolWarnings],\n betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas])\n };\n }\n case \"object-json\": {\n throw new UnsupportedFunctionalityError3({\n functionality: \"json-mode object generation\"\n });\n }\n case \"object-tool\": {\n const { name, description, parameters } = mode.tool;\n return {\n args: {\n ...baseArgs,\n tools: [{ name, description, input_schema: parameters }],\n tool_choice: { type: \"tool\", name }\n },\n warnings,\n betas: messagesBetas\n };\n }\n default: {\n const _exhaustiveCheck = type;\n throw new Error(`Unsupported type: ${_exhaustiveCheck}`);\n }\n }\n }\n async getHeaders({\n betas,\n headers\n }) {\n return combineHeaders(\n await resolve(this.config.headers),\n betas.size > 0 ? { \"anthropic-beta\": Array.from(betas).join(\",\") } : {},\n headers\n );\n }\n buildRequestUrl(isStreaming) {\n var _a, _b, _c;\n return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;\n }\n transformRequestBody(args) {\n var _a, _b, _c;\n return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;\n }\n async doGenerate(options) {\n var _a, _b, _c, _d;\n const { args, warnings, betas } = await this.getArgs(options);\n const {\n responseHeaders,\n value: response,\n rawValue: rawResponse\n } = await postJsonToApi({\n url: this.buildRequestUrl(false),\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(args),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(\n anthropicMessagesResponseSchema\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch\n });\n const { messages: rawPrompt, ...rawSettings } = args;\n let text = \"\";\n for (const content of response.content) {\n if (content.type === \"text\") {\n text += content.text;\n }\n }\n let toolCalls = void 0;\n if (response.content.some((content) => content.type === \"tool_use\")) {\n toolCalls = [];\n for (const content of response.content) {\n if (content.type === \"tool_use\") {\n toolCalls.push({\n toolCallType: \"function\",\n toolCallId: content.id,\n toolName: content.name,\n args: JSON.stringify(content.input)\n });\n }\n }\n }\n const reasoning = response.content.filter(\n (content) => content.type === \"redacted_thinking\" || content.type === \"thinking\"\n ).map(\n (content) => content.type === \"thinking\" ? {\n type: \"text\",\n text: content.thinking,\n signature: content.signature\n } : {\n type: \"redacted\",\n data: content.data\n }\n );\n return {\n text,\n reasoning: reasoning.length > 0 ? reasoning : void 0,\n toolCalls,\n finishReason: mapAnthropicStopReason(response.stop_reason),\n usage: {\n promptTokens: response.usage.input_tokens,\n completionTokens: response.usage.output_tokens\n },\n rawCall: { rawPrompt, rawSettings },\n rawResponse: {\n headers: responseHeaders,\n body: rawResponse\n },\n response: {\n id: (_a = response.id) != null ? _a : void 0,\n modelId: (_b = response.model) != null ? _b : void 0\n },\n warnings,\n providerMetadata: {\n anthropic: {\n cacheCreationInputTokens: (_c = response.usage.cache_creation_input_tokens) != null ? _c : null,\n cacheReadInputTokens: (_d = response.usage.cache_read_input_tokens) != null ? _d : null\n }\n },\n request: { body: JSON.stringify(args) }\n };\n }\n async doStream(options) {\n const { args, warnings, betas } = await this.getArgs(options);\n const body = { ...args, stream: true };\n const { responseHeaders, value: response } = await postJsonToApi({\n url: this.buildRequestUrl(true),\n headers: await this.getHeaders({ betas, headers: options.headers }),\n body: this.transformRequestBody(body),\n failedResponseHandler: anthropicFailedResponseHandler,\n successfulResponseHandler: createEventSourceResponseHandler(\n anthropicMessagesChunkSchema\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch\n });\n const { messages: rawPrompt, ...rawSettings } = args;\n let finishReason = \"unknown\";\n const usage = {\n promptTokens: Number.NaN,\n completionTokens: Number.NaN\n };\n const toolCallContentBlocks = {};\n let providerMetadata = void 0;\n let blockType = void 0;\n return {\n stream: response.pipeThrough(\n new TransformStream({\n transform(chunk, controller) {\n var _a, _b, _c, _d;\n if (!chunk.success) {\n controller.enqueue({ type: \"error\", error: chunk.error });\n return;\n }\n const value = chunk.value;\n switch (value.type) {\n case \"ping\": {\n return;\n }\n case \"content_block_start\": {\n const contentBlockType = value.content_block.type;\n blockType = contentBlockType;\n switch (contentBlockType) {\n case \"text\":\n case \"thinking\": {\n return;\n }\n case \"redacted_thinking\": {\n controller.enqueue({\n type: \"redacted-reasoning\",\n data: value.content_block.data\n });\n return;\n }\n case \"tool_use\": {\n toolCallContentBlocks[value.index] = {\n toolCallId: value.content_block.id,\n toolName: value.content_block.name,\n jsonText: \"\"\n };\n return;\n }\n default: {\n const _exhaustiveCheck = contentBlockType;\n throw new Error(\n `Unsupported content block type: ${_exhaustiveCheck}`\n );\n }\n }\n }\n case \"content_block_stop\": {\n if (toolCallContentBlocks[value.index] != null) {\n const contentBlock = toolCallContentBlocks[value.index];\n controller.enqueue({\n type: \"tool-call\",\n toolCallType: \"function\",\n toolCallId: contentBlock.toolCallId,\n toolName: contentBlock.toolName,\n args: contentBlock.jsonText\n });\n delete toolCallContentBlocks[value.index];\n }\n blockType = void 0;\n return;\n }\n case \"content_block_delta\": {\n const deltaType = value.delta.type;\n switch (deltaType) {\n case \"text_delta\": {\n controller.enqueue({\n type: \"text-delta\",\n textDelta: value.delta.text\n });\n return;\n }\n case \"thinking_delta\": {\n controller.enqueue({\n type: \"reasoning\",\n textDelta: value.delta.thinking\n });\n return;\n }\n case \"signature_delta\": {\n if (blockType === \"thinking\") {\n controller.enqueue({\n type: \"reasoning-signature\",\n signature: value.delta.signature\n });\n }\n return;\n }\n case \"input_json_delta\": {\n const contentBlock = toolCallContentBlocks[value.index];\n controller.enqueue({\n type: \"tool-call-delta\",\n toolCallType: \"function\",\n toolCallId: contentBlock.toolCallId,\n toolName: contentBlock.toolName,\n argsTextDelta: value.delta.partial_json\n });\n contentBlock.jsonText += value.delta.partial_json;\n return;\n }\n default: {\n const _exhaustiveCheck = deltaType;\n throw new Error(\n `Unsupported delta type: ${_exhaustiveCheck}`\n );\n }\n }\n }\n case \"message_start\": {\n usage.promptTokens = value.message.usage.input_tokens;\n usage.completionTokens = value.message.usage.output_tokens;\n providerMetadata = {\n anthropic: {\n cacheCreationInputTokens: (_a = value.message.usage.cache_creation_input_tokens) != null ? _a : null,\n cacheReadInputTokens: (_b = value.message.usage.cache_read_input_tokens) != null ? _b : null\n }\n };\n controller.enqueue({\n type: \"response-metadata\",\n id: (_c = value.message.id) != null ? _c : void 0,\n modelId: (_d = value.message.model) != null ? _d : void 0\n });\n return;\n }\n case \"message_delta\": {\n usage.completionTokens = value.usage.output_tokens;\n finishReason = mapAnthropicStopReason(value.delta.stop_reason);\n return;\n }\n case \"message_stop\": {\n controller.enqueue({\n type: \"finish\",\n finishReason,\n usage,\n providerMetadata\n });\n return;\n }\n case \"error\": {\n controller.enqueue({ type: \"error\", error: value.error });\n return;\n }\n default: {\n const _exhaustiveCheck = value;\n throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);\n }\n }\n }\n })\n ),\n rawCall: { rawPrompt, rawSettings },\n rawResponse: { headers: responseHeaders },\n warnings,\n request: { body: JSON.stringify(body) }\n };\n }\n};\nvar anthropicMessagesResponseSchema = z2.object({\n type: z2.literal(\"message\"),\n id: z2.string().nullish(),\n model: z2.string().nullish(),\n content: z2.array(\n z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"text\"),\n text: z2.string()\n }),\n z2.object({\n type: z2.literal(\"thinking\"),\n thinking: z2.string(),\n signature: z2.string()\n }),\n z2.object({\n type: z2.literal(\"redacted_thinking\"),\n data: z2.string()\n }),\n z2.object({\n type: z2.literal(\"tool_use\"),\n id: z2.string(),\n name: z2.string(),\n input: z2.unknown()\n })\n ])\n ),\n stop_reason: z2.string().nullish(),\n usage: z2.object({\n input_tokens: z2.number(),\n output_tokens: z2.number(),\n cache_creation_input_tokens: z2.number().nullish(),\n cache_read_input_tokens: z2.number().nullish()\n })\n});\nvar anthropicMessagesChunkSchema = z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"message_start\"),\n message: z2.object({\n id: z2.string().nullish(),\n model: z2.string().nullish(),\n usage: z2.object({\n input_tokens: z2.number(),\n output_tokens: z2.number(),\n cache_creation_input_tokens: z2.number().nullish(),\n cache_read_input_tokens: z2.number().nullish()\n })\n })\n }),\n z2.object({\n type: z2.literal(\"content_block_start\"),\n index: z2.number(),\n content_block: z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"text\"),\n text: z2.string()\n }),\n z2.object({\n type: z2.literal(\"thinking\"),\n thinking: z2.string()\n }),\n z2.object({\n type: z2.literal(\"tool_use\"),\n id: z2.string(),\n name: z2.string()\n }),\n z2.object({\n type: z2.literal(\"redacted_thinking\"),\n data: z2.string()\n })\n ])\n }),\n z2.object({\n type: z2.literal(\"content_block_delta\"),\n index: z2.number(),\n delta: z2.discriminatedUnion(\"type\", [\n z2.object({\n type: z2.literal(\"input_json_delta\"),\n partial_json: z2.string()\n }),\n z2.object({\n type: z2.literal(\"text_delta\"),\n text: z2.string()\n }),\n z2.object({\n type: z2.literal(\"thinking_delta\"),\n thinking: z2.string()\n }),\n z2.object({\n type: z2.literal(\"signature_delta\"),\n signature: z2.string()\n })\n ])\n }),\n z2.object({\n type: z2.literal(\"content_block_stop\"),\n index: z2.number()\n }),\n z2.object({\n type: z2.literal(\"error\"),\n error: z2.object({\n type: z2.string(),\n message: z2.string()\n })\n }),\n z2.object({\n type: z2.literal(\"message_delta\"),\n delta: z2.object({ stop_reason: z2.string().nullish() }),\n usage: z2.object({ output_tokens: z2.number() })\n }),\n z2.object({\n type: z2.literal(\"message_stop\")\n }),\n z2.object({\n type: z2.literal(\"ping\")\n })\n]);\nvar anthropicProviderOptionsSchema = z2.object({\n thinking: z2.object({\n type: z2.union([z2.literal(\"enabled\"), z2.literal(\"disabled\")]),\n budgetTokens: z2.number().optional()\n }).optional()\n});\n\n// src/anthropic-tools.ts\nimport { z as z3 } from \"zod\";\nvar Bash20241022Parameters = z3.object({\n command: z3.string(),\n restart: z3.boolean().optional()\n});\nfunction bashTool_20241022(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.bash_20241022\",\n args: {},\n parameters: Bash20241022Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar Bash20250124Parameters = z3.object({\n command: z3.string(),\n restart: z3.boolean().optional()\n});\nfunction bashTool_20250124(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.bash_20250124\",\n args: {},\n parameters: Bash20250124Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar TextEditor20241022Parameters = z3.object({\n command: z3.enum([\"view\", \"create\", \"str_replace\", \"insert\", \"undo_edit\"]),\n path: z3.string(),\n file_text: z3.string().optional(),\n insert_line: z3.number().int().optional(),\n new_str: z3.string().optional(),\n old_str: z3.string().optional(),\n view_range: z3.array(z3.number().int()).optional()\n});\nfunction textEditorTool_20241022(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.text_editor_20241022\",\n args: {},\n parameters: TextEditor20241022Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar TextEditor20250124Parameters = z3.object({\n command: z3.enum([\"view\", \"create\", \"str_replace\", \"insert\", \"undo_edit\"]),\n path: z3.string(),\n file_text: z3.string().optional(),\n insert_line: z3.number().int().optional(),\n new_str: z3.string().optional(),\n old_str: z3.string().optional(),\n view_range: z3.array(z3.number().int()).optional()\n});\nfunction textEditorTool_20250124(options = {}) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.text_editor_20250124\",\n args: {},\n parameters: TextEditor20250124Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar Computer20241022Parameters = z3.object({\n action: z3.enum([\n \"key\",\n \"type\",\n \"mouse_move\",\n \"left_click\",\n \"left_click_drag\",\n \"right_click\",\n \"middle_click\",\n \"double_click\",\n \"screenshot\",\n \"cursor_position\"\n ]),\n coordinate: z3.array(z3.number().int()).optional(),\n text: z3.string().optional()\n});\nfunction computerTool_20241022(options) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.computer_20241022\",\n args: {\n displayWidthPx: options.displayWidthPx,\n displayHeightPx: options.displayHeightPx,\n displayNumber: options.displayNumber\n },\n parameters: Computer20241022Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar Computer20250124Parameters = z3.object({\n action: z3.enum([\n \"key\",\n \"hold_key\",\n \"type\",\n \"cursor_position\",\n \"mouse_move\",\n \"left_mouse_down\",\n \"left_mouse_up\",\n \"left_click\",\n \"left_click_drag\",\n \"right_click\",\n \"middle_click\",\n \"double_click\",\n \"triple_click\",\n \"scroll\",\n \"wait\",\n \"screenshot\"\n ]),\n coordinate: z3.tuple([z3.number().int(), z3.number().int()]).optional(),\n duration: z3.number().optional(),\n scroll_amount: z3.number().optional(),\n scroll_direction: z3.enum([\"up\", \"down\", \"left\", \"right\"]).optional(),\n start_coordinate: z3.tuple([z3.number().int(), z3.number().int()]).optional(),\n text: z3.string().optional()\n});\nfunction computerTool_20250124(options) {\n return {\n type: \"provider-defined\",\n id: \"anthropic.computer_20250124\",\n args: {\n displayWidthPx: options.displayWidthPx,\n displayHeightPx: options.displayHeightPx,\n displayNumber: options.displayNumber\n },\n parameters: Computer20250124Parameters,\n execute: options.execute,\n experimental_toToolResultContent: options.experimental_toToolResultContent\n };\n}\nvar anthropicTools = {\n bash_20241022: bashTool_20241022,\n bash_20250124: bashTool_20250124,\n textEditor_20241022: textEditorTool_20241022,\n textEditor_20250124: textEditorTool_20250124,\n computer_20241022: computerTool_20241022,\n computer_20250124: computerTool_20250124\n};\n\n// src/anthropic-provider.ts\nfunction createAnthropic(options = {}) {\n var _a;\n const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : \"https://api.anthropic.com/v1\";\n const getHeaders = () => ({\n \"anthropic-version\": \"2023-06-01\",\n \"x-api-key\": loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: \"ANTHROPIC_API_KEY\",\n description: \"Anthropic\"\n }),\n ...options.headers\n });\n const createChatModel = (modelId, settings = {}) => new AnthropicMessagesLanguageModel(modelId, settings, {\n provider: \"anthropic.messages\",\n baseURL,\n headers: getHeaders,\n fetch: options.fetch,\n supportsImageUrls: true\n });\n const provider = function(modelId, settings) {\n if (new.target) {\n throw new Error(\n \"The Anthropic model function cannot be called with the new keyword.\"\n );\n }\n return createChatModel(modelId, settings);\n };\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n provider.textEmbeddingModel = (modelId) => {\n throw new NoSuchModelError({ modelId, modelType: \"textEmbeddingModel\" });\n };\n provider.tools = anthropicTools;\n return provider;\n}\nvar anthropic = createAnthropic();\nexport {\n anthropic,\n createAnthropic\n};\n//# sourceMappingURL=index.mjs.map"],"names":["UnsupportedFunctionalityError2","UnsupportedFunctionalityError3","z2","z3"],"mappings":";;;;AAAA;AA0BA,IAAI,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;AACxC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AAC1B,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;AAClB,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;AACpB,IAAI,OAAO,EAAE,CAAC,CAAC,MAAM;AACrB,GAAG;AACH,CAAC,CAAC;AACF,IAAI,8BAA8B,GAAG,8BAA8B,CAAC;AACpE,EAAE,WAAW,EAAE,wBAAwB;AACvC,EAAE,cAAc,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC;AACvC,CAAC,CAAC;AAMF,SAAS,YAAY,CAAC,IAAI,EAAE;AAC5B,EAAE,IAAI,EAAE;AACR,EAAE,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,GAAG,MAAM,GAAG,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,GAAG,MAAM;AACtF,EAAE,MAAM,YAAY,GAAG,EAAE;AACzB,EAAE,MAAM,KAAK,mBAAmB,IAAI,GAAG,EAAE;AACzC,EAAE,IAAI,KAAK,IAAI,IAAI,EAAE;AACrB,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE;AACtE,EAAE;AACF,EAAE,MAAM,eAAe,GAAG,EAAE;AAC5B,EAAE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AAC5B,IAAI,QAAQ,IAAI,CAAC,IAAI;AACrB,MAAM,KAAK,UAAU;AACrB,QAA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AAClD,MAAM,WAAW,EAAE;AACnB,KAAK,CAAC;AACN,IAAI,GAAG,OAAO,CAAC;AACf,GAAG,CAAC;AACJ,EAAE,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,KAAK,IAAI,8BAA8B,CAAC,OAAO,EAAE,QAAQ,EAAE;AAC5G,IAAI,QAAQ,EAAE,oBAAoB;AAClC,IAAI,OAAO;AACX,IAAI,OAAO,EAAE,UAAU;AACvB,IAAI,KAAK,EAAE,OAAO,CAAC,KAAK;AACxB,IAAI,iBAAiB,EAAE;AACvB,GAAG,CAAC;AACJ,EAAE,MAAM,QAAQ,GAAG,SAAS,OAAO,EAAE,QAAQ,EAAE;AAC/C,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE;AACpB,MAAM,MAAM,IAAI,KAAK;AACrB,QAAQ;AACR,OAAO;AACP,IAAI;AACJ,IAAI,OAAO,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC7C,EAAE,CAAC;AACH,EAAE,QAAQ,CAAC,aAAa,GAAG,eAAe;AAC1C,EAAE,QAAQ,CAAC,IAAI,GAAG,eAAe;AACjC,EAAE,QAAQ,CAAC,QAAQ,GAAG,eAAe;AACrC,EAAE,QAAQ,CAAC,kBAAkB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,MAAM,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AAC5E,EAAE,CAAC;AACH,EAAE,QAAQ,CAAC,KAAK,GAAG,cAAc;AACjC,EAAE,OAAO,QAAQ;AACjB;AACgB,eAAe;;;;","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
- import { InvalidArgumentError, LoadAPIKeyError, APICallError, TypeValidationError, EmptyResponseBodyError, JSONParseError } from '../../provider/dist/index.js';
1
+ import { InvalidArgumentError, TypeValidationError, LoadAPIKeyError, APICallError, EmptyResponseBodyError, JSONParseError } from '../../provider/dist/index.js';
2
2
  import { customAlphabet } from '../../../nanoid/non-secure/index.js';
3
3
  import SecureJSON from '../../../secure-json-parse/index.js';
4
4
 
@@ -17,7 +17,7 @@ export declare class Agent {
17
17
  private mcpServers?;
18
18
  private canUseTool?;
19
19
  debug: boolean;
20
- constructor(config?: AgentConfig);
20
+ constructor(config: AgentConfig);
21
21
  /**
22
22
  * Enable or disable debug logging
23
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AASpD,OAAO,EAA4C,KAAK,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAIhJ,qBAAa,KAAK;IACd,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,OAAO,CAAC,CAAuB;IACvC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAC,CAAmB;IACtC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAC,CAAsB;IACxC,OAAO,CAAC,UAAU,CAAC,CAAsB;IACzC,OAAO,CAAC,UAAU,CAAC,CAAa;IACzB,KAAK,EAAE,OAAO,CAAC;gBAEV,MAAM,GAAE,WAAgB;IA+DpC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO;IAKzB;;OAEG;YACW,oBAAoB;IA0B5B,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,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C;IAOxF,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO9F,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuBlH,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB1F,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAczE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUhC,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;YAUvC,iBAAiB;IAmB/B,OAAO,CAAC,sBAAsB;YAiBhB,iBAAiB;IAsC/B,OAAO,CAAC,SAAS;CAapB;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
package/dist/src/agent.js CHANGED
@@ -28,7 +28,7 @@ class Agent {
28
28
  mcpServers;
29
29
  canUseTool;
30
30
  debug;
31
- constructor(config = {}) {
31
+ constructor(config) {
32
32
  this.workingDirectory = config.workingDirectory || process.cwd();
33
33
  this.onEvent = config.onEvent;
34
34
  this.canUseTool = config.canUseTool;
@@ -78,7 +78,7 @@ class Agent {
78
78
  logger: this.logger.child('PromptBuilder')
79
79
  });
80
80
  this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);
81
- this.extractor = new AISDKExtractor(this.logger.child('AISDKExtractor'));
81
+ this.extractor = new AISDKExtractor({ apiKey: config.posthogApiKey, baseURL: config.posthogApiUrl, logger: this.logger.child('AISDKExtractor') });
82
82
  }
83
83
  /**
84
84
  * Enable or disable debug logging
@@ -362,7 +362,7 @@ Generated by PostHog Agent`;
362
362
  process.env.OPENAI_API_KEY = resolvedToken;
363
363
  }
364
364
  if (!this.extractor) {
365
- this.extractor = new AISDKExtractor(this.logger.child('AISDKExtractor'));
365
+ this.extractor = new AISDKExtractor({ apiKey: resolvedToken || '', baseURL: resolvedBaseUrl || '', logger: this.logger.child('AISDKExtractor') });
366
366
  }
367
367
  }
368
368
  async ensurePullRequest(task, stepResults) {
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sources":["../../src/agent.ts"],"sourcesContent":["import { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport type { Task, ExecutionResult, AgentConfig, CanUseTool } from './types.js';\nimport { TaskManager } from './task-manager.js';\nimport { PostHogAPIClient } from './posthog-api.js';\nimport { PostHogFileManager } from './file-manager.js';\nimport { GitManager } from './git-manager.js';\nimport { TemplateManager } from './template-manager.js';\nimport { ClaudeAdapter } from './adapters/claude/claude-adapter.js';\nimport type { ProviderAdapter } from './adapters/types.js';\nimport { Logger } from './utils/logger.js';\nimport { PromptBuilder } from './prompt-builder.js';\nimport { TaskProgressReporter } from './task-progress-reporter.js';\nimport { AISDKExtractor, type StructuredExtractor, type ExtractedQuestion, type ExtractedQuestionWithAnswer } from './structured-extraction.js';\nimport { TASK_WORKFLOW } from './workflow/config.js';\nimport type { WorkflowRuntime } from './workflow/types.js';\n\nexport class Agent {\n private workingDirectory: string;\n private onEvent?: (event: any) => void;\n private taskManager: TaskManager;\n private posthogAPI?: PostHogAPIClient;\n private fileManager: PostHogFileManager;\n private gitManager: GitManager;\n private templateManager: TemplateManager;\n private adapter: ProviderAdapter;\n private logger: Logger;\n private progressReporter: TaskProgressReporter;\n private promptBuilder: PromptBuilder;\n private extractor?: StructuredExtractor;\n private mcpServers?: Record<string, any>;\n private canUseTool?: CanUseTool;\n public debug: boolean;\n\n constructor(config: AgentConfig = {}) {\n this.workingDirectory = config.workingDirectory || process.cwd();\n this.onEvent = config.onEvent;\n this.canUseTool = config.canUseTool;\n this.debug = config.debug || false;\n\n // Build default PostHog MCP server configuration\n const posthogMcpUrl = config.posthogMcpUrl\n || process.env.POSTHOG_MCP_URL\n || 'https://mcp.posthog.com/mcp';\n\n // Add auth if API key provided\n const headers: Record<string, string> = {};\n if (config.posthogApiKey) {\n headers['Authorization'] = `Bearer ${config.posthogApiKey}`;\n }\n\n const defaultMcpServers = {\n posthog: {\n type: 'http' as const,\n url: posthogMcpUrl,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n }\n };\n\n // Merge default PostHog MCP with user-provided servers (user config takes precedence)\n this.mcpServers = {\n ...defaultMcpServers,\n ...config.mcpServers\n };\n this.logger = new Logger({ debug: this.debug, prefix: '[PostHog Agent]' });\n this.taskManager = new TaskManager();\n // Hardcode Claude adapter for now - extensible for other providers later\n this.adapter = new ClaudeAdapter();\n\n this.fileManager = new PostHogFileManager(\n this.workingDirectory,\n this.logger.child('FileManager')\n );\n this.gitManager = new GitManager({\n repositoryPath: this.workingDirectory,\n logger: this.logger.child('GitManager')\n // TODO: Add author config from environment or config\n });\n this.templateManager = new TemplateManager();\n\n if (config.posthogApiUrl && config.posthogApiKey) {\n this.posthogAPI = new PostHogAPIClient({\n apiUrl: config.posthogApiUrl,\n apiKey: config.posthogApiKey,\n });\n }\n\n this.promptBuilder = new PromptBuilder({\n getTaskFiles: (taskId: string) => this.getTaskFiles(taskId),\n generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),\n posthogClient: this.posthogAPI,\n logger: this.logger.child('PromptBuilder')\n });\n this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);\n this.extractor = new AISDKExtractor(this.logger.child('AISDKExtractor'));\n }\n\n /**\n * Enable or disable debug logging\n */\n setDebug(enabled: boolean) {\n this.debug = enabled;\n this.logger.setDebug(enabled);\n }\n\n /**\n * Configure LLM gateway environment variables for Claude Code CLI\n */\n private async _configureLlmGateway(): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n if (process.env.ANTHROPIC_BASE_URL && process.env.ANTHROPIC_AUTH_TOKEN) {\n this.ensureOpenAIGatewayEnv();\n return;\n }\n\n try {\n const gatewayUrl = await this.posthogAPI.getLlmGatewayUrl();\n const apiKey = this.posthogAPI.getApiKey();\n\n process.env.ANTHROPIC_BASE_URL = gatewayUrl;\n process.env.ANTHROPIC_AUTH_TOKEN = apiKey;\n this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);\n\n this.logger.debug('Configured LLM gateway', { gatewayUrl });\n } catch (error) {\n this.logger.error('Failed to configure LLM gateway', error);\n throw error;\n }\n }\n\n // Adaptive task execution orchestrated via workflow steps\n async runTask(taskOrId: Task | string, options: import('./types.js').TaskExecutionOptions = {}): Promise<void> {\n await this._configureLlmGateway();\n\n const task = typeof taskOrId === 'string' ? await this.fetchTask(taskOrId) : taskOrId;\n const cwd = options.repositoryPath || this.workingDirectory;\n const isCloudMode = options.isCloudMode ?? false;\n const taskSlug = (task as any).slug || task.id;\n\n this.logger.info('Starting adaptive task execution', { taskId: task.id, taskSlug, isCloudMode });\n\n // Initialize progress reporter for task run tracking (needed for PR attachment)\n await this.progressReporter.start(task.id, { totalSteps: TASK_WORKFLOW.length });\n this.emitEvent(this.adapter.createStatusEvent('run_started', { runId: this.progressReporter.runId }));\n\n await this.prepareTaskBranch(taskSlug, isCloudMode);\n\n const workflowContext: WorkflowRuntime = {\n task,\n taskSlug,\n cwd,\n isCloudMode,\n options,\n logger: this.logger,\n fileManager: this.fileManager,\n gitManager: this.gitManager,\n promptBuilder: this.promptBuilder,\n progressReporter: this.progressReporter,\n adapter: this.adapter,\n mcpServers: this.mcpServers,\n posthogAPI: this.posthogAPI,\n extractor: this.extractor,\n emitEvent: (event: any) => this.emitEvent(event),\n stepResults: {},\n };\n\n for (const step of TASK_WORKFLOW) {\n const result = await step.run({ step, context: workflowContext });\n if (result.halt) {\n return;\n }\n }\n\n const shouldCreatePR = options.createPR ?? isCloudMode;\n if (shouldCreatePR) {\n await this.ensurePullRequest(task, workflowContext.stepResults);\n }\n\n await this.progressReporter.complete();\n this.logger.info('Task execution complete', { taskId: task.id });\n this.emitEvent(this.adapter.createStatusEvent('task_complete', { taskId: task.id }));\n }\n\n // Direct prompt execution - still supported for low-level usage\n async run(prompt: string, options: { repositoryPath?: string; permissionMode?: import('./types.js').PermissionMode; queryOverrides?: Record<string, any>; canUseTool?: CanUseTool } = {}): Promise<ExecutionResult> {\n await this._configureLlmGateway();\n const baseOptions: Record<string, any> = {\n model: \"claude-sonnet-4-5-20250929\",\n cwd: options.repositoryPath || this.workingDirectory,\n permissionMode: (options.permissionMode as any) || \"default\",\n settingSources: [\"local\"],\n mcpServers: this.mcpServers,\n };\n\n // Add canUseTool hook if provided (options take precedence over instance config)\n const canUseTool = options.canUseTool || this.canUseTool;\n if (canUseTool) {\n baseOptions.canUseTool = canUseTool;\n }\n\n const response = query({\n prompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n const results = [];\n for await (const message of response) {\n this.logger.debug('Received message in direct run', message);\n // Emit raw SDK event\n this.emitEvent(this.adapter.createRawSDKEvent(message));\n // Emit transformed event\n const transformedEvent = this.adapter.transform(message);\n if (transformedEvent) {\n this.emitEvent(transformedEvent);\n }\n results.push(message);\n }\n \n return { results };\n }\n \n // PostHog task operations\n async fetchTask(taskId: string): Promise<Task> {\n this.logger.debug('Fetching task from PostHog', { taskId });\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n return this.posthogAPI.fetchTask(taskId);\n }\n\n getPostHogClient(): PostHogAPIClient | undefined {\n return this.posthogAPI;\n }\n \n async listTasks(filters?: {\n repository?: string;\n organization?: string;\n origin_product?: string;\n }): Promise<Task[]> {\n if (!this.posthogAPI) {\n throw new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n }\n return this.posthogAPI.listTasks(filters);\n }\n \n // File system operations for task artifacts\n async writeTaskFile(taskId: string, fileName: string, content: string, type: 'plan' | 'context' | 'reference' | 'output' = 'reference'): Promise<void> {\n this.logger.debug('Writing task file', { taskId, fileName, type, contentLength: content.length });\n await this.fileManager.writeTaskFile(taskId, { name: fileName, content, type });\n }\n \n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n this.logger.debug('Reading task file', { taskId, fileName });\n return await this.fileManager.readTaskFile(taskId, fileName);\n }\n \n async getTaskFiles(taskId: string): Promise<any[]> {\n this.logger.debug('Getting task files', { taskId });\n const files = await this.fileManager.getTaskFiles(taskId);\n this.logger.debug('Found task files', { taskId, fileCount: files.length });\n return files;\n }\n \n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.info('Writing plan', { taskId, planLength: plan.length });\n await this.fileManager.writePlan(taskId, plan);\n }\n \n async readPlan(taskId: string): Promise<string | null> {\n this.logger.debug('Reading plan', { taskId });\n return await this.fileManager.readPlan(taskId);\n }\n\n async extractQuestionsFromResearch(taskId: string, includeAnswers: boolean = false): Promise<ExtractedQuestion[] | ExtractedQuestionWithAnswer[]> {\n this.logger.info('Extracting questions from research.md', { taskId, includeAnswers });\n \n if (!this.extractor) {\n throw new Error('OpenAI extractor not initialized. Ensure the LLM gateway is configured.');\n }\n\n const researchContent = await this.fileManager.readResearch(taskId);\n if (!researchContent) {\n throw new Error('research.md not found for task ' + taskId);\n }\n\n if (includeAnswers) {\n return await this.extractor.extractQuestionsWithAnswers(researchContent);\n } else {\n return await this.extractor.extractQuestions(researchContent);\n }\n }\n\n // Git operations for task execution\n async createPlanningBranch(taskId: string): Promise<string> {\n this.logger.info('Creating planning branch', { taskId });\n const branchName = await this.gitManager.createTaskPlanningBranch(taskId);\n this.logger.debug('Planning branch created', { taskId, branchName });\n // Only create gitignore after we're on the new branch\n await this.fileManager.ensureGitignore();\n return branchName;\n }\n \n async commitPlan(taskId: string, taskTitle: string): Promise<string> {\n this.logger.info('Committing plan', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitPlan(taskId, taskTitle);\n this.logger.debug('Plan committed', { taskId, commitHash });\n return commitHash;\n }\n \n async createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string> {\n this.logger.info('Creating implementation branch', { taskId, fromBranch: planningBranchName });\n const branchName = await this.gitManager.createTaskImplementationBranch(taskId, planningBranchName);\n this.logger.debug('Implementation branch created', { taskId, branchName });\n return branchName;\n }\n \n async commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string> {\n this.logger.info('Committing implementation', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitImplementation(taskId, taskTitle, planSummary);\n this.logger.debug('Implementation committed', { taskId, commitHash });\n return commitHash;\n }\n\n async createPullRequest(taskId: string, branchName: string, taskTitle: string, taskDescription: string): Promise<string> {\n this.logger.info('Creating pull request', { taskId, branchName, taskTitle });\n\n // Build PR body\n const prBody = `## Task Details\n**Task ID**: ${taskId}\n**Description**: ${taskDescription}\n\n## Changes\nThis PR implements the changes described in the task.\n\nGenerated by PostHog Agent`;\n\n const prUrl = await this.gitManager.createPullRequest(\n branchName,\n taskTitle,\n prBody\n );\n\n this.logger.info('Pull request created', { taskId, prUrl });\n return prUrl;\n }\n\n async attachPullRequestToTask(taskId: string, prUrl: string, branchName?: string): Promise<void> {\n this.logger.info('Attaching PR to task run', { taskId, prUrl, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot attach PR to task.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n const updates: any = {\n output: { pr_url: prUrl }\n };\n if (branchName) {\n updates.branch = branchName;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, updates);\n this.logger.debug('PR attached to task run', { taskId, runId: this.progressReporter.runId, prUrl });\n }\n\n async updateTaskBranch(taskId: string, branchName: string): Promise<void> {\n this.logger.info('Updating task run branch', { taskId, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot update branch.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, { branch: branchName });\n this.logger.debug('Task run branch updated', { taskId, runId: this.progressReporter.runId, branchName });\n }\n\n // Execution management\n cancelTask(taskId: string): void {\n // Find the execution for this task and cancel it\n for (const [executionId, execution] of this.taskManager['executionStates']) {\n if (execution.taskId === taskId && execution.status === 'running') {\n this.taskManager.cancelExecution(executionId);\n break;\n }\n }\n }\n\n getTaskExecutionStatus(taskId: string): string | null {\n // Find the execution for this task\n for (const execution of this.taskManager['executionStates'].values()) {\n if (execution.taskId === taskId) {\n return execution.status;\n }\n }\n return null;\n }\n\n private async prepareTaskBranch(taskSlug: string, isCloudMode: boolean): Promise<void> {\n const existingBranch = await this.gitManager.getTaskBranch(taskSlug);\n if (!existingBranch) {\n const branchName = await this.gitManager.createTaskBranch(taskSlug);\n this.emitEvent(this.adapter.createStatusEvent('branch_created', { branch: branchName }));\n\n await this.fileManager.ensureGitignore();\n await this.gitManager.addAllPostHogFiles();\n if (isCloudMode) {\n await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, { allowEmpty: true });\n } else {\n await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);\n }\n } else {\n this.logger.info('Switching to existing task branch', { branch: existingBranch });\n await this.gitManager.switchToBranch(existingBranch);\n }\n }\n\n private ensureOpenAIGatewayEnv(baseUrl?: string, token?: string): void {\n const resolvedBaseUrl = baseUrl || process.env.ANTHROPIC_BASE_URL;\n const resolvedToken = token || process.env.ANTHROPIC_AUTH_TOKEN;\n\n if (resolvedBaseUrl) {\n process.env.OPENAI_BASE_URL = resolvedBaseUrl;\n }\n\n if (resolvedToken) {\n process.env.OPENAI_API_KEY = resolvedToken;\n }\n\n if (!this.extractor) {\n this.extractor = new AISDKExtractor(this.logger.child('AISDKExtractor'));\n }\n }\n\n private async ensurePullRequest(task: Task, stepResults: Record<string, any>): Promise<void> {\n const latestRun = task.latest_run;\n const existingPr =\n latestRun?.output && typeof latestRun.output === 'object'\n ? (latestRun.output as any).pr_url\n : null;\n\n if (existingPr) {\n this.logger.info('PR already exists, skipping creation', { taskId: task.id, prUrl: existingPr });\n return;\n }\n\n const buildResult = stepResults['build'];\n if (!buildResult?.commitCreated) {\n this.logger.warn('Build step did not produce a commit; skipping PR creation', { taskId: task.id });\n return;\n }\n\n const branchName = await this.gitManager.getCurrentBranch();\n const prUrl = await this.createPullRequest(\n task.id,\n branchName,\n task.title,\n task.description ?? ''\n );\n\n this.emitEvent(this.adapter.createStatusEvent('pr_created', { prUrl }));\n\n try {\n await this.attachPullRequestToTask(task.id, prUrl, branchName);\n this.logger.info('PR attached to task successfully', { taskId: task.id, prUrl });\n } catch (error) {\n this.logger.warn('Could not attach PR to task', {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n private emitEvent(event: any): void {\n if (this.debug && event.type !== 'token') {\n // Log all events except tokens (too verbose)\n this.logger.debug('Emitting event', { type: event.type, ts: event.ts });\n }\n const persistPromise = this.progressReporter.recordEvent(event);\n if (persistPromise && typeof persistPromise.then === 'function') {\n persistPromise.catch((error: Error) =>\n this.logger.debug('Failed to persist agent event', { message: error.message })\n );\n }\n this.onEvent?.(event);\n }\n}\n\nexport { PermissionMode } from './types.js';\nexport type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAgBa,KAAK,CAAA;AACN,IAAA,gBAAgB;AAChB,IAAA,OAAO;AACP,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,eAAe;AACf,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,gBAAgB;AAChB,IAAA,aAAa;AACb,IAAA,SAAS;AACT,IAAA,UAAU;AACV,IAAA,UAAU;AACX,IAAA,KAAK;AAEZ,IAAA,WAAA,CAAY,S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AkC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;QACpF;QAAE,OAAO,KAAK,EAAE;AACZ,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE;AAC5C,gBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAChE,aAAA,CAAC;QACN;IACJ;AAEQ,IAAA,SAAS,CAAC,KAAU,EAAA;QACxB,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;;YAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAC3E;QACA,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC;QAC/D,IAAI,cAAc,IAAI,OAAO,cAAc,CAAC,IAAI,KAAK,UAAU,EAAE;YAC7D,cAAc,CAAC,KAAK,CAAC,CAAC,KAAY,KAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CACjF;QACL;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB;AACH;;;;"}
1
+ {"version":3,"file":"agent.js","sources":["../../src/agent.ts"],"sourcesContent":["import { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport type { Task, ExecutionResult, AgentConfig, CanUseTool } from './types.js';\nimport { TaskManager } from './task-manager.js';\nimport { PostHogAPIClient } from './posthog-api.js';\nimport { PostHogFileManager } from './file-manager.js';\nimport { GitManager } from './git-manager.js';\nimport { TemplateManager } from './template-manager.js';\nimport { ClaudeAdapter } from './adapters/claude/claude-adapter.js';\nimport type { ProviderAdapter } from './adapters/types.js';\nimport { Logger } from './utils/logger.js';\nimport { PromptBuilder } from './prompt-builder.js';\nimport { TaskProgressReporter } from './task-progress-reporter.js';\nimport { AISDKExtractor, type StructuredExtractor, type ExtractedQuestion, type ExtractedQuestionWithAnswer } from './structured-extraction.js';\nimport { TASK_WORKFLOW } from './workflow/config.js';\nimport type { WorkflowRuntime } from './workflow/types.js';\n\nexport class Agent {\n private workingDirectory: string;\n private onEvent?: (event: any) => void;\n private taskManager: TaskManager;\n private posthogAPI?: PostHogAPIClient;\n private fileManager: PostHogFileManager;\n private gitManager: GitManager;\n private templateManager: TemplateManager;\n private adapter: ProviderAdapter;\n private logger: Logger;\n private progressReporter: TaskProgressReporter;\n private promptBuilder: PromptBuilder;\n private extractor?: StructuredExtractor;\n private mcpServers?: Record<string, any>;\n private canUseTool?: CanUseTool;\n public debug: boolean;\n\n constructor(config: AgentConfig) {\n this.workingDirectory = config.workingDirectory || process.cwd();\n this.onEvent = config.onEvent;\n this.canUseTool = config.canUseTool;\n this.debug = config.debug || false;\n\n // Build default PostHog MCP server configuration\n const posthogMcpUrl = config.posthogMcpUrl\n || process.env.POSTHOG_MCP_URL\n || 'https://mcp.posthog.com/mcp';\n\n // Add auth if API key provided\n const headers: Record<string, string> = {};\n if (config.posthogApiKey) {\n headers['Authorization'] = `Bearer ${config.posthogApiKey}`;\n }\n\n const defaultMcpServers = {\n posthog: {\n type: 'http' as const,\n url: posthogMcpUrl,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n }\n };\n\n // Merge default PostHog MCP with user-provided servers (user config takes precedence)\n this.mcpServers = {\n ...defaultMcpServers,\n ...config.mcpServers\n };\n this.logger = new Logger({ debug: this.debug, prefix: '[PostHog Agent]' });\n this.taskManager = new TaskManager();\n // Hardcode Claude adapter for now - extensible for other providers later\n this.adapter = new ClaudeAdapter();\n\n this.fileManager = new PostHogFileManager(\n this.workingDirectory,\n this.logger.child('FileManager')\n );\n this.gitManager = new GitManager({\n repositoryPath: this.workingDirectory,\n logger: this.logger.child('GitManager')\n // TODO: Add author config from environment or config\n });\n this.templateManager = new TemplateManager();\n\n if (config.posthogApiUrl && config.posthogApiKey) {\n this.posthogAPI = new PostHogAPIClient({\n apiUrl: config.posthogApiUrl,\n apiKey: config.posthogApiKey,\n });\n }\n\n this.promptBuilder = new PromptBuilder({\n getTaskFiles: (taskId: string) => this.getTaskFiles(taskId),\n generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),\n posthogClient: this.posthogAPI,\n logger: this.logger.child('PromptBuilder')\n });\n this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);\n this.extractor = new AISDKExtractor({apiKey: config.posthogApiKey, baseURL: config.posthogApiUrl, logger: this.logger.child('AISDKExtractor')});\n }\n\n /**\n * Enable or disable debug logging\n */\n setDebug(enabled: boolean) {\n this.debug = enabled;\n this.logger.setDebug(enabled);\n }\n\n /**\n * Configure LLM gateway environment variables for Claude Code CLI\n */\n private async _configureLlmGateway(): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n if (process.env.ANTHROPIC_BASE_URL && process.env.ANTHROPIC_AUTH_TOKEN) {\n this.ensureOpenAIGatewayEnv();\n return;\n }\n\n try {\n const gatewayUrl = await this.posthogAPI.getLlmGatewayUrl();\n const apiKey = this.posthogAPI.getApiKey();\n\n process.env.ANTHROPIC_BASE_URL = gatewayUrl;\n process.env.ANTHROPIC_AUTH_TOKEN = apiKey;\n this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);\n\n this.logger.debug('Configured LLM gateway', { gatewayUrl });\n } catch (error) {\n this.logger.error('Failed to configure LLM gateway', error);\n throw error;\n }\n }\n\n // Adaptive task execution orchestrated via workflow steps\n async runTask(taskOrId: Task | string, options: import('./types.js').TaskExecutionOptions = {}): Promise<void> {\n await this._configureLlmGateway();\n\n const task = typeof taskOrId === 'string' ? await this.fetchTask(taskOrId) : taskOrId;\n const cwd = options.repositoryPath || this.workingDirectory;\n const isCloudMode = options.isCloudMode ?? false;\n const taskSlug = (task as any).slug || task.id;\n\n this.logger.info('Starting adaptive task execution', { taskId: task.id, taskSlug, isCloudMode });\n\n // Initialize progress reporter for task run tracking (needed for PR attachment)\n await this.progressReporter.start(task.id, { totalSteps: TASK_WORKFLOW.length });\n this.emitEvent(this.adapter.createStatusEvent('run_started', { runId: this.progressReporter.runId }));\n\n await this.prepareTaskBranch(taskSlug, isCloudMode);\n\n const workflowContext: WorkflowRuntime = {\n task,\n taskSlug,\n cwd,\n isCloudMode,\n options,\n logger: this.logger,\n fileManager: this.fileManager,\n gitManager: this.gitManager,\n promptBuilder: this.promptBuilder,\n progressReporter: this.progressReporter,\n adapter: this.adapter,\n mcpServers: this.mcpServers,\n posthogAPI: this.posthogAPI,\n extractor: this.extractor,\n emitEvent: (event: any) => this.emitEvent(event),\n stepResults: {},\n };\n\n for (const step of TASK_WORKFLOW) {\n const result = await step.run({ step, context: workflowContext });\n if (result.halt) {\n return;\n }\n }\n\n const shouldCreatePR = options.createPR ?? isCloudMode;\n if (shouldCreatePR) {\n await this.ensurePullRequest(task, workflowContext.stepResults);\n }\n\n await this.progressReporter.complete();\n this.logger.info('Task execution complete', { taskId: task.id });\n this.emitEvent(this.adapter.createStatusEvent('task_complete', { taskId: task.id }));\n }\n\n // Direct prompt execution - still supported for low-level usage\n async run(prompt: string, options: { repositoryPath?: string; permissionMode?: import('./types.js').PermissionMode; queryOverrides?: Record<string, any>; canUseTool?: CanUseTool } = {}): Promise<ExecutionResult> {\n await this._configureLlmGateway();\n const baseOptions: Record<string, any> = {\n model: \"claude-sonnet-4-5-20250929\",\n cwd: options.repositoryPath || this.workingDirectory,\n permissionMode: (options.permissionMode as any) || \"default\",\n settingSources: [\"local\"],\n mcpServers: this.mcpServers,\n };\n\n // Add canUseTool hook if provided (options take precedence over instance config)\n const canUseTool = options.canUseTool || this.canUseTool;\n if (canUseTool) {\n baseOptions.canUseTool = canUseTool;\n }\n\n const response = query({\n prompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n const results = [];\n for await (const message of response) {\n this.logger.debug('Received message in direct run', message);\n // Emit raw SDK event\n this.emitEvent(this.adapter.createRawSDKEvent(message));\n // Emit transformed event\n const transformedEvent = this.adapter.transform(message);\n if (transformedEvent) {\n this.emitEvent(transformedEvent);\n }\n results.push(message);\n }\n \n return { results };\n }\n \n // PostHog task operations\n async fetchTask(taskId: string): Promise<Task> {\n this.logger.debug('Fetching task from PostHog', { taskId });\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n return this.posthogAPI.fetchTask(taskId);\n }\n\n getPostHogClient(): PostHogAPIClient | undefined {\n return this.posthogAPI;\n }\n \n async listTasks(filters?: {\n repository?: string;\n organization?: string;\n origin_product?: string;\n }): Promise<Task[]> {\n if (!this.posthogAPI) {\n throw new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n }\n return this.posthogAPI.listTasks(filters);\n }\n \n // File system operations for task artifacts\n async writeTaskFile(taskId: string, fileName: string, content: string, type: 'plan' | 'context' | 'reference' | 'output' = 'reference'): Promise<void> {\n this.logger.debug('Writing task file', { taskId, fileName, type, contentLength: content.length });\n await this.fileManager.writeTaskFile(taskId, { name: fileName, content, type });\n }\n \n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n this.logger.debug('Reading task file', { taskId, fileName });\n return await this.fileManager.readTaskFile(taskId, fileName);\n }\n \n async getTaskFiles(taskId: string): Promise<any[]> {\n this.logger.debug('Getting task files', { taskId });\n const files = await this.fileManager.getTaskFiles(taskId);\n this.logger.debug('Found task files', { taskId, fileCount: files.length });\n return files;\n }\n \n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.info('Writing plan', { taskId, planLength: plan.length });\n await this.fileManager.writePlan(taskId, plan);\n }\n \n async readPlan(taskId: string): Promise<string | null> {\n this.logger.debug('Reading plan', { taskId });\n return await this.fileManager.readPlan(taskId);\n }\n\n async extractQuestionsFromResearch(taskId: string, includeAnswers: boolean = false): Promise<ExtractedQuestion[] | ExtractedQuestionWithAnswer[]> {\n this.logger.info('Extracting questions from research.md', { taskId, includeAnswers });\n \n if (!this.extractor) {\n throw new Error('OpenAI extractor not initialized. Ensure the LLM gateway is configured.');\n }\n\n const researchContent = await this.fileManager.readResearch(taskId);\n if (!researchContent) {\n throw new Error('research.md not found for task ' + taskId);\n }\n\n if (includeAnswers) {\n return await this.extractor.extractQuestionsWithAnswers(researchContent);\n } else {\n return await this.extractor.extractQuestions(researchContent);\n }\n }\n\n // Git operations for task execution\n async createPlanningBranch(taskId: string): Promise<string> {\n this.logger.info('Creating planning branch', { taskId });\n const branchName = await this.gitManager.createTaskPlanningBranch(taskId);\n this.logger.debug('Planning branch created', { taskId, branchName });\n // Only create gitignore after we're on the new branch\n await this.fileManager.ensureGitignore();\n return branchName;\n }\n \n async commitPlan(taskId: string, taskTitle: string): Promise<string> {\n this.logger.info('Committing plan', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitPlan(taskId, taskTitle);\n this.logger.debug('Plan committed', { taskId, commitHash });\n return commitHash;\n }\n \n async createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string> {\n this.logger.info('Creating implementation branch', { taskId, fromBranch: planningBranchName });\n const branchName = await this.gitManager.createTaskImplementationBranch(taskId, planningBranchName);\n this.logger.debug('Implementation branch created', { taskId, branchName });\n return branchName;\n }\n \n async commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string> {\n this.logger.info('Committing implementation', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitImplementation(taskId, taskTitle, planSummary);\n this.logger.debug('Implementation committed', { taskId, commitHash });\n return commitHash;\n }\n\n async createPullRequest(taskId: string, branchName: string, taskTitle: string, taskDescription: string): Promise<string> {\n this.logger.info('Creating pull request', { taskId, branchName, taskTitle });\n\n // Build PR body\n const prBody = `## Task Details\n**Task ID**: ${taskId}\n**Description**: ${taskDescription}\n\n## Changes\nThis PR implements the changes described in the task.\n\nGenerated by PostHog Agent`;\n\n const prUrl = await this.gitManager.createPullRequest(\n branchName,\n taskTitle,\n prBody\n );\n\n this.logger.info('Pull request created', { taskId, prUrl });\n return prUrl;\n }\n\n async attachPullRequestToTask(taskId: string, prUrl: string, branchName?: string): Promise<void> {\n this.logger.info('Attaching PR to task run', { taskId, prUrl, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot attach PR to task.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n const updates: any = {\n output: { pr_url: prUrl }\n };\n if (branchName) {\n updates.branch = branchName;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, updates);\n this.logger.debug('PR attached to task run', { taskId, runId: this.progressReporter.runId, prUrl });\n }\n\n async updateTaskBranch(taskId: string, branchName: string): Promise<void> {\n this.logger.info('Updating task run branch', { taskId, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot update branch.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, { branch: branchName });\n this.logger.debug('Task run branch updated', { taskId, runId: this.progressReporter.runId, branchName });\n }\n\n // Execution management\n cancelTask(taskId: string): void {\n // Find the execution for this task and cancel it\n for (const [executionId, execution] of this.taskManager['executionStates']) {\n if (execution.taskId === taskId && execution.status === 'running') {\n this.taskManager.cancelExecution(executionId);\n break;\n }\n }\n }\n\n getTaskExecutionStatus(taskId: string): string | null {\n // Find the execution for this task\n for (const execution of this.taskManager['executionStates'].values()) {\n if (execution.taskId === taskId) {\n return execution.status;\n }\n }\n return null;\n }\n\n private async prepareTaskBranch(taskSlug: string, isCloudMode: boolean): Promise<void> {\n const existingBranch = await this.gitManager.getTaskBranch(taskSlug);\n if (!existingBranch) {\n const branchName = await this.gitManager.createTaskBranch(taskSlug);\n this.emitEvent(this.adapter.createStatusEvent('branch_created', { branch: branchName }));\n\n await this.fileManager.ensureGitignore();\n await this.gitManager.addAllPostHogFiles();\n if (isCloudMode) {\n await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, { allowEmpty: true });\n } else {\n await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);\n }\n } else {\n this.logger.info('Switching to existing task branch', { branch: existingBranch });\n await this.gitManager.switchToBranch(existingBranch);\n }\n }\n\n private ensureOpenAIGatewayEnv(baseUrl?: string, token?: string): void {\n const resolvedBaseUrl = baseUrl || process.env.ANTHROPIC_BASE_URL;\n const resolvedToken = token || process.env.ANTHROPIC_AUTH_TOKEN;\n\n if (resolvedBaseUrl) {\n process.env.OPENAI_BASE_URL = resolvedBaseUrl;\n }\n\n if (resolvedToken) {\n process.env.OPENAI_API_KEY = resolvedToken;\n }\n\n if (!this.extractor) {\n this.extractor = new AISDKExtractor({apiKey: resolvedToken || '', baseURL: resolvedBaseUrl || '', logger: this.logger.child('AISDKExtractor')});\n }\n }\n\n private async ensurePullRequest(task: Task, stepResults: Record<string, any>): Promise<void> {\n const latestRun = task.latest_run;\n const existingPr =\n latestRun?.output && typeof latestRun.output === 'object'\n ? (latestRun.output as any).pr_url\n : null;\n\n if (existingPr) {\n this.logger.info('PR already exists, skipping creation', { taskId: task.id, prUrl: existingPr });\n return;\n }\n\n const buildResult = stepResults['build'];\n if (!buildResult?.commitCreated) {\n this.logger.warn('Build step did not produce a commit; skipping PR creation', { taskId: task.id });\n return;\n }\n\n const branchName = await this.gitManager.getCurrentBranch();\n const prUrl = await this.createPullRequest(\n task.id,\n branchName,\n task.title,\n task.description ?? ''\n );\n\n this.emitEvent(this.adapter.createStatusEvent('pr_created', { prUrl }));\n\n try {\n await this.attachPullRequestToTask(task.id, prUrl, branchName);\n this.logger.info('PR attached to task successfully', { taskId: task.id, prUrl });\n } catch (error) {\n this.logger.warn('Could not attach PR to task', {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n private emitEvent(event: any): void {\n if (this.debug && event.type !== 'token') {\n // Log all events except tokens (too verbose)\n this.logger.debug('Emitting event', { type: event.type, ts: event.ts });\n }\n const persistPromise = this.progressReporter.recordEvent(event);\n if (persistPromise && typeof persistPromise.then === 'function') {\n persistPromise.catch((error: Error) =>\n this.logger.debug('Failed to persist agent event', { message: error.message })\n );\n }\n this.onEvent?.(event);\n }\n}\n\nexport { PermissionMode } from './types.js';\nexport type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAgBa,KAAK,CAAA;AACN,IAAA,gBAAgB;AAChB,IAAA,OAAO;AACP,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,eAAe;AACf,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,gBAAgB;AAChB,IAAA,aAAa;AACb,IAAA,SAAS;AACT,IAAA,UAAU;AACV,IAAA,UAAU;AACX,IAAA,KAAK;AAEZ,IAAA,WAAA,CAAY,MAAmB,EAAA;QAC3B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,EAAE;AAChE,QAAA,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;AAC7B,QAAA,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU;QACnC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,KAAK;;AAGlC,QAAA,MAAM,aAAa,GAAG,MAAM,CAAC;eACtB,OAAO,CAAC,GAAG,CAAC;AACZ,eAAA,6BAA6B;;QAGpC,MAAM,OAAO,GAA2B,EAAE;AAC1C,QAAA,IAAI,MAAM,CAAC,aAAa,EAAE;YACtB,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,MAAM,CAAC,aAAa,CAAA,CAAE;QAC/D;AAEA,QAAA,MAAM,iBAAiB,GAAG;AACtB,YAAA,OAAO,EAAE;AACL,gBAAA,IAAI,EAAE,MAAe;AACrB,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AAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAC3E;QACA,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC;QAC/D,IAAI,cAAc,IAAI,OAAO,cAAc,CAAC,IAAI,KAAK,UAAU,EAAE;YAC7D,cAAc,CAAC,KAAK,CAAC,CAAC,KAAY,KAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CACjF;QACL;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB;AACH;;;;"}
@@ -12,10 +12,16 @@ export interface StructuredExtractor {
12
12
  extractQuestions(researchContent: string): Promise<ExtractedQuestion[]>;
13
13
  extractQuestionsWithAnswers(researchContent: string): Promise<ExtractedQuestionWithAnswer[]>;
14
14
  }
15
+ export type StructuredExtractorConfig = {
16
+ apiKey: string;
17
+ baseURL: string;
18
+ modelName?: string;
19
+ logger?: Logger;
20
+ };
15
21
  export declare class AISDKExtractor implements StructuredExtractor {
16
22
  private logger;
17
23
  private model;
18
- constructor(logger?: Logger);
24
+ constructor(config: StructuredExtractorConfig);
19
25
  extractQuestions(researchContent: string): Promise<ExtractedQuestion[]>;
20
26
  extractQuestionsWithAnswers(researchContent: string): Promise<ExtractedQuestionWithAnswer[]>;
21
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"structured-extraction.d.ts","sourceRoot":"","sources":["../../src/structured-extraction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM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,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,qBAAa,cAAe,YAAW,mBAAmB;IACxD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAM;gBAEP,MAAM,EAAE,yBAAyB;IAmBvC,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAqBvE,2BAA2B,CAC/B,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,2BAA2B,EAAE,CAAC;CAoB1C"}
@@ -1,7 +1,7 @@
1
1
  import { generateObject } from '../node_modules/ai/dist/index.js';
2
- import { anthropic } from '../node_modules/@ai-sdk/anthropic/dist/index.js';
3
2
  import { z } from 'zod';
4
3
  import { Logger } from './utils/logger.js';
4
+ import { getAnthropicModel } from './utils/ai-sdk.js';
5
5
 
6
6
  const questionsOnlySchema = z.object({
7
7
  questions: z.array(z.object({
@@ -22,20 +22,20 @@ const questionsWithAnswersSchema = z.object({
22
22
  class AISDKExtractor {
23
23
  logger;
24
24
  model;
25
- constructor(logger) {
26
- this.logger = logger || new Logger({ debug: false, prefix: '[AISDKExtractor]' });
27
- // Determine which provider to use based on environment variables
28
- // Priority: Anthropic (if ANTHROPIC_BASE_URL is set) > OpenAI
29
- const apiKey = process.env.ANTHROPIC_AUTH_TOKEN
30
- || process.env.ANTHROPIC_API_KEY
31
- || process.env.OPENAI_API_KEY;
32
- if (!apiKey) {
25
+ constructor(config) {
26
+ this.logger = config.logger || new Logger({ debug: false, prefix: '[AISDKExtractor]' });
27
+ if (!config.apiKey) {
33
28
  throw new Error('Missing API key for structured extraction. Ensure the LLM gateway is configured.');
34
29
  }
35
- const baseURL = process.env.ANTHROPIC_BASE_URL || process.env.OPENAI_BASE_URL;
36
- const modelName = 'claude-haiku-4-5';
37
- this.model = anthropic(modelName);
38
- this.logger.debug('Using Anthropic provider for structured extraction', { modelName, baseURL });
30
+ this.model = getAnthropicModel({
31
+ apiKey: config.apiKey,
32
+ baseURL: config.baseURL,
33
+ modelName: config.modelName || 'claude-haiku-4-5',
34
+ });
35
+ this.logger.debug('Using PostHog LLM gateway for structured extraction', {
36
+ modelName: config.modelName || 'claude-haiku-4-5',
37
+ baseURL: config.baseURL
38
+ });
39
39
  }
40
40
  async extractQuestions(researchContent) {
41
41
  this.logger.debug('Extracting questions from research content', {
@@ -1 +1 @@
1
- {"version":3,"file":"structured-extraction.js","sources":["../../src/structured-extraction.ts"],"sourcesContent":["import { generateObject } from 'ai';\nimport { anthropic } from '@ai-sdk/anthropic';\nimport { z } from 'zod';\nimport { Logger } from './utils/logger.js';\n\nexport interface ExtractedQuestion {\n id: string;\n question: string;\n options: string[];\n}\n\nexport interface ExtractedQuestionWithAnswer extends ExtractedQuestion {\n recommendedAnswer: string;\n justification: string;\n}\n\nconst questionsOnlySchema = z.object({\n questions: z.array(\n z.object({\n id: z.string(),\n question: z.string(),\n options: z.array(z.string()),\n })\n ),\n});\n\nconst questionsWithAnswersSchema = z.object({\n questions: z.array(\n z.object({\n id: z.string(),\n question: z.string(),\n options: z.array(z.string()),\n recommendedAnswer: z.string().describe('The letter of the recommended option (e.g., \"a\", \"b\", \"c\")'),\n justification: z.string().describe('Brief explanation for the recommended answer'),\n })\n ),\n});\n\nexport interface StructuredExtractor {\n extractQuestions(researchContent: string): Promise<ExtractedQuestion[]>;\n extractQuestionsWithAnswers(researchContent: string): Promise<ExtractedQuestionWithAnswer[]>;\n}\n\nexport class AISDKExtractor implements StructuredExtractor {\n private logger: Logger;\n private model: any;\n\n constructor(logger?: Logger) {\n this.logger = logger || new Logger({ debug: false, prefix: '[AISDKExtractor]' });\n\n // Determine which provider to use based on environment variables\n // Priority: Anthropic (if ANTHROPIC_BASE_URL is set) > OpenAI\n const apiKey = process.env.ANTHROPIC_AUTH_TOKEN\n || process.env.ANTHROPIC_API_KEY\n || process.env.OPENAI_API_KEY;\n\n if (!apiKey) {\n throw new Error('Missing API key for structured extraction. Ensure the LLM gateway is configured.');\n }\n\n const baseURL = process.env.ANTHROPIC_BASE_URL || process.env.OPENAI_BASE_URL;\n const modelName = 'claude-haiku-4-5';\n this.model = anthropic(modelName);\n this.logger.debug('Using Anthropic provider for structured extraction', { modelName, baseURL });\n }\n\n async extractQuestions(researchContent: string): Promise<ExtractedQuestion[]> {\n this.logger.debug('Extracting questions from research content', {\n contentLength: researchContent.length,\n });\n\n const { object } = await generateObject({\n model: this.model,\n schema: questionsOnlySchema,\n schemaName: 'ResearchQuestions',\n schemaDescription: 'Research questions extracted from markdown content',\n system: 'Extract the research questions from the provided markdown. Return a JSON object matching the schema.',\n prompt: researchContent,\n });\n\n this.logger.info('Successfully extracted questions', {\n questionCount: object.questions.length,\n });\n\n return object.questions;\n }\n\n async extractQuestionsWithAnswers(\n researchContent: string,\n ): Promise<ExtractedQuestionWithAnswer[]> {\n this.logger.debug('Extracting questions with recommended answers', {\n contentLength: researchContent.length,\n });\n\n const { object } = await generateObject({\n model: this.model,\n schema: questionsWithAnswersSchema,\n schemaName: 'ResearchQuestionsWithAnswers',\n schemaDescription: 'Research questions with recommended answers extracted from markdown',\n system: 'Extract the research questions from the markdown and provide recommended answers based on the analysis. For each question, include a recommendedAnswer (the letter: a, b, c, etc.) and a brief justification. Return a JSON object matching the schema.',\n prompt: researchContent,\n });\n\n this.logger.info('Successfully extracted questions with answers', {\n questionCount: object.questions.length,\n });\n\n return object.questions;\n }\n}\n"],"names":[],"mappings":";;;;;AAgBA,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,CAAC,CAAC,MAAM,CAAC;AACP,QAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;AACd,QAAA,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAA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AC,SAAS;IACzB;AACD;;;;"}
1
+ {"version":3,"file":"structured-extraction.js","sources":["../../src/structured-extraction.ts"],"sourcesContent":["import { generateObject } from 'ai';\nimport { z } from 'zod';\nimport { Logger } from './utils/logger.js';\nimport { getAnthropicModel } from './utils/ai-sdk.js';\n\nexport interface ExtractedQuestion {\n id: string;\n question: string;\n options: string[];\n}\n\nexport interface ExtractedQuestionWithAnswer extends ExtractedQuestion {\n recommendedAnswer: string;\n justification: string;\n}\n\nconst questionsOnlySchema = z.object({\n questions: z.array(\n z.object({\n id: z.string(),\n question: z.string(),\n options: z.array(z.string()),\n })\n ),\n});\n\nconst questionsWithAnswersSchema = z.object({\n questions: z.array(\n z.object({\n id: z.string(),\n question: z.string(),\n options: z.array(z.string()),\n recommendedAnswer: z.string().describe('The letter of the recommended option (e.g., \"a\", \"b\", \"c\")'),\n justification: z.string().describe('Brief explanation for the recommended answer'),\n })\n ),\n});\n\nexport interface StructuredExtractor {\n extractQuestions(researchContent: string): Promise<ExtractedQuestion[]>;\n extractQuestionsWithAnswers(researchContent: string): Promise<ExtractedQuestionWithAnswer[]>;\n}\n\nexport type StructuredExtractorConfig = {\n apiKey: string;\n baseURL: string;\n modelName?: string;\n logger?: Logger;\n}\n\nexport class AISDKExtractor implements StructuredExtractor {\n private logger: Logger;\n private model: any;\n\n constructor(config: StructuredExtractorConfig) {\n this.logger = config.logger || new Logger({ debug: false, prefix: '[AISDKExtractor]' });\n\n if (!config.apiKey) {\n throw new Error('Missing API key for structured extraction. Ensure the LLM gateway is configured.');\n }\n\n this.model = getAnthropicModel({\n apiKey: config.apiKey,\n baseURL: config.baseURL,\n modelName: config.modelName || 'claude-haiku-4-5',\n });\n\n this.logger.debug('Using PostHog LLM gateway for structured extraction', {\n modelName: config.modelName || 'claude-haiku-4-5',\n baseURL: config.baseURL\n });\n }\n\n async extractQuestions(researchContent: string): Promise<ExtractedQuestion[]> {\n this.logger.debug('Extracting questions from research content', {\n contentLength: researchContent.length,\n });\n\n const { object } = await generateObject({\n model: this.model,\n schema: questionsOnlySchema,\n schemaName: 'ResearchQuestions',\n schemaDescription: 'Research questions extracted from markdown content',\n system: 'Extract the research questions from the provided markdown. Return a JSON object matching the schema.',\n prompt: researchContent,\n });\n\n this.logger.info('Successfully extracted questions', {\n questionCount: object.questions.length,\n });\n\n return object.questions;\n }\n\n async extractQuestionsWithAnswers(\n researchContent: string,\n ): Promise<ExtractedQuestionWithAnswer[]> {\n this.logger.debug('Extracting questions with recommended answers', {\n contentLength: researchContent.length,\n });\n\n const { object } = await generateObject({\n model: this.model,\n schema: questionsWithAnswersSchema,\n schemaName: 'ResearchQuestionsWithAnswers',\n schemaDescription: 'Research questions with recommended answers extracted from markdown',\n system: 'Extract the research questions from the markdown and provide recommended answers based on the analysis. For each question, include a recommendedAnswer (the letter: a, b, c, etc.) and a brief justification. Return a JSON object matching the schema.',\n prompt: researchContent,\n });\n\n this.logger.info('Successfully extracted questions with answers', {\n questionCount: object.questions.length,\n });\n\n return object.questions;\n }\n}\n"],"names":[],"mappings":";;;;;AAgBA,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,CAAC,CAAC,MAAM,CAAC;AACP,QAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;AACd,QAAA,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AAC7B,KAAA,CAAC,CACH;AACF,CAAA,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,CAAC,CAAC,MAAM,CAAC;AACP,QAAA,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;AACd,QAAA,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,C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U,EAAE,mBAAmB;AAC/B,YAAA,iBAAiB,EAAE,oDAAoD;AACvE,YAAA,MAAM,EAAE,sGAAsG;AAC9G,YAAA,MAAM,EAAE,eAAe;AACxB,SAAA,CAAC;AAEF,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE;AACnD,YAAA,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM;AACvC,SAAA,CAAC;QAEF,OAAO,MAAM,CAAC,SAAS;IACzB;IAEA,MAAM,2BAA2B,CAC/B,eAAuB,EAAA;AAEvB,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+CAA+C,EAAE;YACjE,aAAa,EAAE,eAAe,CAAC,MAAM;AACtC,SAAA,CAAC;AAEF,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC;YACtC,KAAK,EAAE,IAAI,CAAC,KAAK;AACjB,YAAA,MAAM,EAAE,0BAA0B;AAClC,YAAA,UAAU,EAAE,8BAA8B;AAC1C,YAAA,iBAAiB,EAAE,qEAAqE;AACxF,YAAA,MAAM,EAAE,yPAAyP;AACjQ,YAAA,MAAM,EAAE,eAAe;AACxB,SAAA,CAAC;AAEF,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+CAA+C,EAAE;AAChE,YAAA,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM;AACvC,SAAA,CAAC;QAEF,OAAO,MAAM,CAAC,SAAS;IACzB;AACD;;;;"}
@@ -232,8 +232,8 @@ export type McpServerConfig = {
232
232
  export interface AgentConfig {
233
233
  workingDirectory?: string;
234
234
  onEvent?: (event: AgentEvent) => void;
235
- posthogApiUrl?: string;
236
- posthogApiKey?: string;
235
+ posthogApiUrl: string;
236
+ posthogApiKey: string;
237
237
  posthogMcpUrl?: string;
238
238
  mcpServers?: Record<string, McpServerConfig>;
239
239
  debug?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../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E,MAAM,CAAC,CAAC;CAClC,GAAG;IACF,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAGtC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IAGtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAKvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAG7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAIhB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,YAAY,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["\n// import and export to keep a single type file\nimport type { CanUseTool, PermissionResult } from '@anthropic-ai/claude-agent-sdk/sdkTypes.js';\nexport type { CanUseTool, PermissionResult };\n\n// PostHog Task model (matches Array's OpenAPI schema)\nexport interface Task {\n id: string;\n title: string;\n description: string;\n origin_product: 'error_tracking' | 'eval_clusters' | 'user_created' | 'support_queue' | 'session_summaries';\n position?: number;\n github_integration?: number | null;\n repository_config?: unknown; // JSONField\n repository_list: string;\n primary_repository: string;\n created_at: string;\n updated_at: string;\n\n // DEPRECATED: These fields have been moved to TaskRun\n // Use task.latest_run instead\n current_stage?: string | null;\n github_branch?: string | null;\n github_pr_url?: string | null;\n latest_run?: TaskRun;\n}\n\n// Log entry structure for TaskRun.log\nexport interface LogEntry {\n type: string; // e.g., \"info\", \"warning\", \"error\", \"success\", \"debug\"\n message: string;\n [key: string]: unknown; // Allow additional fields\n}\n\n// TaskRun model - represents individual execution runs of tasks\nexport interface TaskRun {\n id: string;\n task: string; // Task ID\n team: number;\n branch: string | null;\n status: 'started' | 'in_progress' | 'completed' | 'failed';\n log: LogEntry[]; // Array of log entry objects\n error_message: string | null;\n output: Record<string, unknown> | null; // Structured output (PR URL, commit SHA, etc.)\n state: Record<string, unknown>; // Intermediate run state (defaults to {}, never null)\n created_at: string;\n updated_at: string;\n completed_at: string | null;\n}\n\nexport interface SupportingFile {\n name: string;\n content: string;\n type: 'plan' | 'context' | 'reference' | 'output';\n created_at: string;\n}\n\nexport enum PermissionMode {\n PLAN = \"plan\",\n DEFAULT = \"default\",\n ACCEPT_EDITS = \"acceptEdits\",\n BYPASS = \"bypassPermissions\"\n}\n\nexport interface ExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n}\n\nexport interface TaskExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n isCloudMode?: boolean; // Determines local vs cloud behavior (local pauses after each phase)\n createPR?: boolean; // Whether to create PR after build (defaults to false if local. This setting has no effect if isCloudMode is true.)\n autoProgress?: boolean;\n queryOverrides?: Record<string, any>;\n // Fine-grained permission control (only applied to build phase)\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\n// Base event with timestamp\ninterface BaseEvent {\n ts: number;\n}\n\n// Streaming content events\nexport interface TokenEvent extends BaseEvent {\n type: 'token';\n content: string;\n contentType?: 'text' | 'thinking' | 'tool_input';\n}\n\nexport interface ContentBlockStartEvent extends BaseEvent {\n type: 'content_block_start';\n index: number;\n contentType: 'text' | 'tool_use' | 'thinking';\n toolName?: string;\n toolId?: string;\n}\n\nexport interface ContentBlockStopEvent extends BaseEvent {\n type: 'content_block_stop';\n index: number;\n}\n\n// Tool events\nexport interface ToolCallEvent extends BaseEvent {\n type: 'tool_call';\n toolName: string;\n callId: string;\n args: Record<string, any>;\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\nexport interface ToolResultEvent extends BaseEvent {\n type: 'tool_result';\n toolName: string;\n callId: string;\n result: any;\n isError?: boolean; // Whether the tool execution failed\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\n// Message lifecycle events\nexport interface MessageStartEvent extends BaseEvent {\n type: 'message_start';\n messageId?: string;\n model?: string;\n}\n\nexport interface MessageDeltaEvent extends BaseEvent {\n type: 'message_delta';\n stopReason?: string;\n stopSequence?: string;\n usage?: {\n outputTokens: number;\n };\n}\n\nexport interface MessageStopEvent extends BaseEvent {\n type: 'message_stop';\n}\n\n// User message events\nexport interface UserMessageEvent extends BaseEvent {\n type: 'user_message';\n content: string;\n isSynthetic?: boolean;\n}\n\n// System events\nexport interface StatusEvent extends BaseEvent {\n type: 'status';\n phase: string;\n // Common optional fields (varies by phase):\n kind?: string; // Kind of status (plan, implementation)\n branch?: string; // Git branch name\n prUrl?: string; // Pull request URL\n taskId?: string; // Task identifier\n messageId?: string; // Claude message ID\n model?: string; // Model name\n [key: string]: any; // Allow additional fields\n}\n\nexport interface InitEvent extends BaseEvent {\n type: 'init';\n model: string;\n tools: string[];\n permissionMode: string;\n cwd: string;\n apiKeySource: string;\n agents?: string[];\n slashCommands?: string[];\n outputStyle?: string;\n mcpServers?: Array<{ name: string; status: string }>;\n}\n\nexport interface CompactBoundaryEvent extends BaseEvent {\n type: 'compact_boundary';\n trigger: 'manual' | 'auto';\n preTokens: number;\n}\n\n// Result events\nexport interface DoneEvent extends BaseEvent {\n type: 'done';\n result?: string; // Final summary text from Claude\n durationMs?: number;\n durationApiMs?: number; // API-only duration (excluding local processing)\n numTurns?: number;\n totalCostUsd?: number;\n usage?: any;\n modelUsage?: { // Per-model usage breakdown\n [modelName: string]: {\n inputTokens: number;\n outputTokens: number;\n cacheReadInputTokens: number;\n cacheCreationInputTokens: number;\n webSearchRequests: number;\n costUSD: number;\n contextWindow: number;\n };\n };\n permissionDenials?: Array<{ // Tools that were denied by permissions\n tool_name: string;\n tool_use_id: string;\n tool_input: Record<string, unknown>;\n }>;\n}\n\nexport interface ErrorEvent extends BaseEvent {\n type: 'error';\n message: string;\n error?: any;\n errorType?: string;\n context?: Record<string, any>; // Partial error context for debugging\n sdkError?: any; // Original SDK error object\n}\n\n// Metric and artifact events (general purpose, not tool-specific)\nexport interface MetricEvent extends BaseEvent {\n type: 'metric';\n key: string;\n value: number;\n unit?: string;\n}\n\nexport interface ArtifactEvent extends BaseEvent {\n type: 'artifact';\n kind: string;\n content: any;\n}\n\nexport interface RawSDKEvent extends BaseEvent {\n type: 'raw_sdk_event';\n sdkMessage: any; // Full SDK message for debugging\n}\n\nexport type AgentEvent =\n | TokenEvent\n | ContentBlockStartEvent\n | ContentBlockStopEvent\n | ToolCallEvent\n | ToolResultEvent\n | MessageStartEvent\n | MessageDeltaEvent\n | MessageStopEvent\n | UserMessageEvent\n | StatusEvent\n | InitEvent\n | CompactBoundaryEvent\n | DoneEvent\n | ErrorEvent\n | MetricEvent\n | ArtifactEvent\n | RawSDKEvent;\n\nexport interface ExecutionResult {\n results: any[];\n}\n\nexport interface PlanResult {\n plan: string;\n}\n\nexport interface TaskExecutionResult {\n task: Task;\n plan?: string;\n executionResult?: ExecutionResult;\n}\n\n// MCP Server configuration types (re-exported from Claude SDK for convenience)\nexport type McpServerConfig = {\n type?: 'stdio';\n command: string;\n args?: string[];\n env?: Record<string, string>;\n} | {\n type: 'sse';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'http';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'sdk';\n name: string;\n instance?: any; // McpServer instance\n};\n\nexport interface AgentConfig {\n workingDirectory?: string;\n onEvent?: (event: AgentEvent) => void;\n\n // PostHog API configuration\n posthogApiUrl?: string;\n posthogApiKey?: string;\n\n // PostHog MCP configuration\n posthogMcpUrl?: string;\n\n // MCP Server configuration\n // Additional MCP servers (PostHog MCP is always included by default)\n // You can override the PostHog MCP config by providing mcpServers.posthog\n mcpServers?: Record<string, McpServerConfig>;\n\n // Logging configuration\n debug?: boolean;\n\n // Fine-grained permission control for direct run() calls\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\nexport interface PostHogAPIConfig {\n apiUrl: string;\n apiKey: string;\n}\n\n// URL mention types\nexport type ResourceType = 'error' | 'experiment' | 'insight' | 'feature_flag' | 'generic';\n\nexport interface PostHogResource {\n type: ResourceType;\n id: string;\n url: string;\n title?: string;\n content: string;\n metadata?: Record<string, any>;\n}\n\nexport interface UrlMention {\n url: string;\n type: ResourceType;\n id?: string;\n label?: string;\n}"],"names":[],"mappings":"IAyDY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,aAA4B;AAC5B,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,mBAA4B;AAC9B,CAAC,EALW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["\n// import and export to keep a single type file\nimport type { CanUseTool, PermissionResult } from '@anthropic-ai/claude-agent-sdk/sdkTypes.js';\nexport type { CanUseTool, PermissionResult };\n\n// PostHog Task model (matches Array's OpenAPI schema)\nexport interface Task {\n id: string;\n title: string;\n description: string;\n origin_product: 'error_tracking' | 'eval_clusters' | 'user_created' | 'support_queue' | 'session_summaries';\n position?: number;\n github_integration?: number | null;\n repository_config?: unknown; // JSONField\n repository_list: string;\n primary_repository: string;\n created_at: string;\n updated_at: string;\n\n // DEPRECATED: These fields have been moved to TaskRun\n // Use task.latest_run instead\n current_stage?: string | null;\n github_branch?: string | null;\n github_pr_url?: string | null;\n latest_run?: TaskRun;\n}\n\n// Log entry structure for TaskRun.log\nexport interface LogEntry {\n type: string; // e.g., \"info\", \"warning\", \"error\", \"success\", \"debug\"\n message: string;\n [key: string]: unknown; // Allow additional fields\n}\n\n// TaskRun model - represents individual execution runs of tasks\nexport interface TaskRun {\n id: string;\n task: string; // Task ID\n team: number;\n branch: string | null;\n status: 'started' | 'in_progress' | 'completed' | 'failed';\n log: LogEntry[]; // Array of log entry objects\n error_message: string | null;\n output: Record<string, unknown> | null; // Structured output (PR URL, commit SHA, etc.)\n state: Record<string, unknown>; // Intermediate run state (defaults to {}, never null)\n created_at: string;\n updated_at: string;\n completed_at: string | null;\n}\n\nexport interface SupportingFile {\n name: string;\n content: string;\n type: 'plan' | 'context' | 'reference' | 'output';\n created_at: string;\n}\n\nexport enum PermissionMode {\n PLAN = \"plan\",\n DEFAULT = \"default\",\n ACCEPT_EDITS = \"acceptEdits\",\n BYPASS = \"bypassPermissions\"\n}\n\nexport interface ExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n}\n\nexport interface TaskExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n isCloudMode?: boolean; // Determines local vs cloud behavior (local pauses after each phase)\n createPR?: boolean; // Whether to create PR after build (defaults to false if local. This setting has no effect if isCloudMode is true.)\n autoProgress?: boolean;\n queryOverrides?: Record<string, any>;\n // Fine-grained permission control (only applied to build phase)\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\n// Base event with timestamp\ninterface BaseEvent {\n ts: number;\n}\n\n// Streaming content events\nexport interface TokenEvent extends BaseEvent {\n type: 'token';\n content: string;\n contentType?: 'text' | 'thinking' | 'tool_input';\n}\n\nexport interface ContentBlockStartEvent extends BaseEvent {\n type: 'content_block_start';\n index: number;\n contentType: 'text' | 'tool_use' | 'thinking';\n toolName?: string;\n toolId?: string;\n}\n\nexport interface ContentBlockStopEvent extends BaseEvent {\n type: 'content_block_stop';\n index: number;\n}\n\n// Tool events\nexport interface ToolCallEvent extends BaseEvent {\n type: 'tool_call';\n toolName: string;\n callId: string;\n args: Record<string, any>;\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\nexport interface ToolResultEvent extends BaseEvent {\n type: 'tool_result';\n toolName: string;\n callId: string;\n result: any;\n isError?: boolean; // Whether the tool execution failed\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\n// Message lifecycle events\nexport interface MessageStartEvent extends BaseEvent {\n type: 'message_start';\n messageId?: string;\n model?: string;\n}\n\nexport interface MessageDeltaEvent extends BaseEvent {\n type: 'message_delta';\n stopReason?: string;\n stopSequence?: string;\n usage?: {\n outputTokens: number;\n };\n}\n\nexport interface MessageStopEvent extends BaseEvent {\n type: 'message_stop';\n}\n\n// User message events\nexport interface UserMessageEvent extends BaseEvent {\n type: 'user_message';\n content: string;\n isSynthetic?: boolean;\n}\n\n// System events\nexport interface StatusEvent extends BaseEvent {\n type: 'status';\n phase: string;\n // Common optional fields (varies by phase):\n kind?: string; // Kind of status (plan, implementation)\n branch?: string; // Git branch name\n prUrl?: string; // Pull request URL\n taskId?: string; // Task identifier\n messageId?: string; // Claude message ID\n model?: string; // Model name\n [key: string]: any; // Allow additional fields\n}\n\nexport interface InitEvent extends BaseEvent {\n type: 'init';\n model: string;\n tools: string[];\n permissionMode: string;\n cwd: string;\n apiKeySource: string;\n agents?: string[];\n slashCommands?: string[];\n outputStyle?: string;\n mcpServers?: Array<{ name: string; status: string }>;\n}\n\nexport interface CompactBoundaryEvent extends BaseEvent {\n type: 'compact_boundary';\n trigger: 'manual' | 'auto';\n preTokens: number;\n}\n\n// Result events\nexport interface DoneEvent extends BaseEvent {\n type: 'done';\n result?: string; // Final summary text from Claude\n durationMs?: number;\n durationApiMs?: number; // API-only duration (excluding local processing)\n numTurns?: number;\n totalCostUsd?: number;\n usage?: any;\n modelUsage?: { // Per-model usage breakdown\n [modelName: string]: {\n inputTokens: number;\n outputTokens: number;\n cacheReadInputTokens: number;\n cacheCreationInputTokens: number;\n webSearchRequests: number;\n costUSD: number;\n contextWindow: number;\n };\n };\n permissionDenials?: Array<{ // Tools that were denied by permissions\n tool_name: string;\n tool_use_id: string;\n tool_input: Record<string, unknown>;\n }>;\n}\n\nexport interface ErrorEvent extends BaseEvent {\n type: 'error';\n message: string;\n error?: any;\n errorType?: string;\n context?: Record<string, any>; // Partial error context for debugging\n sdkError?: any; // Original SDK error object\n}\n\n// Metric and artifact events (general purpose, not tool-specific)\nexport interface MetricEvent extends BaseEvent {\n type: 'metric';\n key: string;\n value: number;\n unit?: string;\n}\n\nexport interface ArtifactEvent extends BaseEvent {\n type: 'artifact';\n kind: string;\n content: any;\n}\n\nexport interface RawSDKEvent extends BaseEvent {\n type: 'raw_sdk_event';\n sdkMessage: any; // Full SDK message for debugging\n}\n\nexport type AgentEvent =\n | TokenEvent\n | ContentBlockStartEvent\n | ContentBlockStopEvent\n | ToolCallEvent\n | ToolResultEvent\n | MessageStartEvent\n | MessageDeltaEvent\n | MessageStopEvent\n | UserMessageEvent\n | StatusEvent\n | InitEvent\n | CompactBoundaryEvent\n | DoneEvent\n | ErrorEvent\n | MetricEvent\n | ArtifactEvent\n | RawSDKEvent;\n\nexport interface ExecutionResult {\n results: any[];\n}\n\nexport interface PlanResult {\n plan: string;\n}\n\nexport interface TaskExecutionResult {\n task: Task;\n plan?: string;\n executionResult?: ExecutionResult;\n}\n\n// MCP Server configuration types (re-exported from Claude SDK for convenience)\nexport type McpServerConfig = {\n type?: 'stdio';\n command: string;\n args?: string[];\n env?: Record<string, string>;\n} | {\n type: 'sse';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'http';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'sdk';\n name: string;\n instance?: any; // McpServer instance\n};\n\nexport interface AgentConfig {\n workingDirectory?: string;\n onEvent?: (event: AgentEvent) => void;\n\n // PostHog API configuration\n posthogApiUrl: string;\n posthogApiKey: string;\n\n // PostHog MCP configuration\n posthogMcpUrl?: string;\n\n // MCP Server configuration\n // Additional MCP servers (PostHog MCP is always included by default)\n // You can override the PostHog MCP config by providing mcpServers.posthog\n mcpServers?: Record<string, McpServerConfig>;\n\n // Logging configuration\n debug?: boolean;\n\n // Fine-grained permission control for direct run() calls\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\nexport interface PostHogAPIConfig {\n apiUrl: string;\n apiKey: string;\n}\n\n// URL mention types\nexport type ResourceType = 'error' | 'experiment' | 'insight' | 'feature_flag' | 'generic';\n\nexport interface PostHogResource {\n type: ResourceType;\n id: string;\n url: string;\n title?: string;\n content: string;\n metadata?: Record<string, any>;\n}\n\nexport interface UrlMention {\n url: string;\n type: ResourceType;\n id?: string;\n label?: string;\n}"],"names":[],"mappings":"IAyDY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,aAA4B;AAC5B,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,mBAA4B;AAC9B,CAAC,EALW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,14 @@
1
+ export interface PostHogGatewayConfig {
2
+ apiKey: string;
3
+ baseURL: string;
4
+ modelName?: string;
5
+ }
6
+ /**
7
+ * Creates an Anthropic model configured for PostHog LLM gateway.
8
+ *
9
+ * Handles two key differences between AI SDK and PostHog gateway:
10
+ * 1. Appends /v1 to baseURL (gateway expects /v1/messages, SDK appends /messages)
11
+ * 2. Converts x-api-key header to Authorization Bearer token
12
+ */
13
+ export declare function getAnthropicModel(config: PostHogGatewayConfig): import("ai").LanguageModelV1;
14
+ //# sourceMappingURL=ai-sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-sdk.d.ts","sourceRoot":"","sources":["../../../src/utils/ai-sdk.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,gCA+B7D"}
@@ -0,0 +1,38 @@
1
+ import { createAnthropic } from '../../node_modules/@ai-sdk/anthropic/dist/index.js';
2
+
3
+ /**
4
+ * Creates an Anthropic model configured for PostHog LLM gateway.
5
+ *
6
+ * Handles two key differences between AI SDK and PostHog gateway:
7
+ * 1. Appends /v1 to baseURL (gateway expects /v1/messages, SDK appends /messages)
8
+ * 2. Converts x-api-key header to Authorization Bearer token
9
+ */
10
+ function getAnthropicModel(config) {
11
+ const modelName = config.modelName || 'claude-haiku-4-5';
12
+ // PostHog gateway expects /v1/messages, but AI SDK appends /messages
13
+ // So we need to append /v1 to the baseURL
14
+ const baseURL = config.baseURL ? `${config.baseURL}/v1` : undefined;
15
+ // Custom fetch to convert x-api-key header to Authorization Bearer
16
+ // PostHog gateway expects Bearer token, but Anthropic SDK sends x-api-key
17
+ const customFetch = async (url, init) => {
18
+ const headers = new Headers(init?.headers);
19
+ if (headers.has('x-api-key')) {
20
+ headers.delete('x-api-key');
21
+ headers.set('Authorization', `Bearer ${config.apiKey}`);
22
+ }
23
+ return fetch(url, {
24
+ ...init,
25
+ headers,
26
+ });
27
+ };
28
+ const anthropic = createAnthropic({
29
+ apiKey: config.apiKey,
30
+ baseURL,
31
+ //@ts-ignore
32
+ fetch: customFetch,
33
+ });
34
+ return anthropic(modelName);
35
+ }
36
+
37
+ export { getAnthropicModel };
38
+ //# sourceMappingURL=ai-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-sdk.js","sources":["../../../src/utils/ai-sdk.ts"],"sourcesContent":["import { createAnthropic } from '@ai-sdk/anthropic';\n\nexport interface PostHogGatewayConfig {\n apiKey: string;\n baseURL: string;\n modelName?: string;\n}\n\n/**\n * Creates an Anthropic model configured for PostHog LLM gateway.\n * \n * Handles two key differences between AI SDK and PostHog gateway:\n * 1. Appends /v1 to baseURL (gateway expects /v1/messages, SDK appends /messages)\n * 2. Converts x-api-key header to Authorization Bearer token\n */\nexport function getAnthropicModel(config: PostHogGatewayConfig) {\n const modelName = config.modelName || 'claude-haiku-4-5';\n \n // PostHog gateway expects /v1/messages, but AI SDK appends /messages\n // So we need to append /v1 to the baseURL\n const baseURL = config.baseURL ? `${config.baseURL}/v1` : undefined;\n\n // Custom fetch to convert x-api-key header to Authorization Bearer\n // PostHog gateway expects Bearer token, but Anthropic SDK sends x-api-key\n const customFetch = async (url: RequestInfo, init?: RequestInit): Promise<Response> => {\n const headers = new Headers(init?.headers);\n\n if (headers.has('x-api-key')) {\n headers.delete('x-api-key');\n headers.set('Authorization', `Bearer ${config.apiKey}`);\n }\n\n return fetch(url, {\n ...init,\n headers,\n });\n };\n\n const anthropic = createAnthropic({\n apiKey: config.apiKey,\n baseURL,\n //@ts-ignore\n fetch: customFetch,\n });\n\n return anthropic(modelName);\n}\n"],"names":[],"mappings":";;AAQA;;;;;;AAMG;AACG,SAAU,iBAAiB,CAAC,MAA4B,EAAA;AAC5D,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,kBAAkB;;;AAIxD,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,GAAG,CAAA,EAAG,MAAM,CAAC,OAAO,CAAA,GAAA,CAAK,GAAG,SAAS;;;IAInE,MAAM,WAAW,GAAG,OAAO,GAAgB,EAAE,IAAkB,KAAuB;QACpF,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;AAE1C,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;AAC5B,YAAA,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAA,OAAA,EAAU,MAAM,CAAC,MAAM,CAAA,CAAE,CAAC;QACzD;QAEA,OAAO,KAAK,CAAC,GAAG,EAAE;AAChB,YAAA,GAAG,IAAI;YACP,OAAO;AACR,SAAA,CAAC;AACJ,IAAA,CAAC;IAED,MAAM,SAAS,GAAG,eAAe,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;;AAEP,QAAA,KAAK,EAAE,WAAW;AACnB,KAAA,CAAC;AAEF,IAAA,OAAO,SAAS,CAAC,SAAS,CAAC;AAC7B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/agent",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
package/src/agent.ts CHANGED
@@ -31,7 +31,7 @@ export class Agent {
31
31
  private canUseTool?: CanUseTool;
32
32
  public debug: boolean;
33
33
 
34
- constructor(config: AgentConfig = {}) {
34
+ constructor(config: AgentConfig) {
35
35
  this.workingDirectory = config.workingDirectory || process.cwd();
36
36
  this.onEvent = config.onEvent;
37
37
  this.canUseTool = config.canUseTool;
@@ -91,7 +91,7 @@ export class Agent {
91
91
  logger: this.logger.child('PromptBuilder')
92
92
  });
93
93
  this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);
94
- this.extractor = new AISDKExtractor(this.logger.child('AISDKExtractor'));
94
+ this.extractor = new AISDKExtractor({apiKey: config.posthogApiKey, baseURL: config.posthogApiUrl, logger: this.logger.child('AISDKExtractor')});
95
95
  }
96
96
 
97
97
  /**
@@ -434,7 +434,7 @@ Generated by PostHog Agent`;
434
434
  }
435
435
 
436
436
  if (!this.extractor) {
437
- this.extractor = new AISDKExtractor(this.logger.child('AISDKExtractor'));
437
+ this.extractor = new AISDKExtractor({apiKey: resolvedToken || '', baseURL: resolvedBaseUrl || '', logger: this.logger.child('AISDKExtractor')});
438
438
  }
439
439
  }
440
440
 
@@ -1,7 +1,7 @@
1
1
  import { generateObject } from 'ai';
2
- import { anthropic } from '@ai-sdk/anthropic';
3
2
  import { z } from 'zod';
4
3
  import { Logger } from './utils/logger.js';
4
+ import { getAnthropicModel } from './utils/ai-sdk.js';
5
5
 
6
6
  export interface ExtractedQuestion {
7
7
  id: string;
@@ -41,27 +41,34 @@ export interface StructuredExtractor {
41
41
  extractQuestionsWithAnswers(researchContent: string): Promise<ExtractedQuestionWithAnswer[]>;
42
42
  }
43
43
 
44
+ export type StructuredExtractorConfig = {
45
+ apiKey: string;
46
+ baseURL: string;
47
+ modelName?: string;
48
+ logger?: Logger;
49
+ }
50
+
44
51
  export class AISDKExtractor implements StructuredExtractor {
45
52
  private logger: Logger;
46
53
  private model: any;
47
54
 
48
- constructor(logger?: Logger) {
49
- this.logger = logger || new Logger({ debug: false, prefix: '[AISDKExtractor]' });
50
-
51
- // Determine which provider to use based on environment variables
52
- // Priority: Anthropic (if ANTHROPIC_BASE_URL is set) > OpenAI
53
- const apiKey = process.env.ANTHROPIC_AUTH_TOKEN
54
- || process.env.ANTHROPIC_API_KEY
55
- || process.env.OPENAI_API_KEY;
55
+ constructor(config: StructuredExtractorConfig) {
56
+ this.logger = config.logger || new Logger({ debug: false, prefix: '[AISDKExtractor]' });
56
57
 
57
- if (!apiKey) {
58
+ if (!config.apiKey) {
58
59
  throw new Error('Missing API key for structured extraction. Ensure the LLM gateway is configured.');
59
60
  }
60
61
 
61
- const baseURL = process.env.ANTHROPIC_BASE_URL || process.env.OPENAI_BASE_URL;
62
- const modelName = 'claude-haiku-4-5';
63
- this.model = anthropic(modelName);
64
- this.logger.debug('Using Anthropic provider for structured extraction', { modelName, baseURL });
62
+ this.model = getAnthropicModel({
63
+ apiKey: config.apiKey,
64
+ baseURL: config.baseURL,
65
+ modelName: config.modelName || 'claude-haiku-4-5',
66
+ });
67
+
68
+ this.logger.debug('Using PostHog LLM gateway for structured extraction', {
69
+ modelName: config.modelName || 'claude-haiku-4-5',
70
+ baseURL: config.baseURL
71
+ });
65
72
  }
66
73
 
67
74
  async extractQuestions(researchContent: string): Promise<ExtractedQuestion[]> {
package/src/types.ts CHANGED
@@ -301,8 +301,8 @@ export interface AgentConfig {
301
301
  onEvent?: (event: AgentEvent) => void;
302
302
 
303
303
  // PostHog API configuration
304
- posthogApiUrl?: string;
305
- posthogApiKey?: string;
304
+ posthogApiUrl: string;
305
+ posthogApiKey: string;
306
306
 
307
307
  // PostHog MCP configuration
308
308
  posthogMcpUrl?: string;
@@ -0,0 +1,47 @@
1
+ import { createAnthropic } from '@ai-sdk/anthropic';
2
+
3
+ export interface PostHogGatewayConfig {
4
+ apiKey: string;
5
+ baseURL: string;
6
+ modelName?: string;
7
+ }
8
+
9
+ /**
10
+ * Creates an Anthropic model configured for PostHog LLM gateway.
11
+ *
12
+ * Handles two key differences between AI SDK and PostHog gateway:
13
+ * 1. Appends /v1 to baseURL (gateway expects /v1/messages, SDK appends /messages)
14
+ * 2. Converts x-api-key header to Authorization Bearer token
15
+ */
16
+ export function getAnthropicModel(config: PostHogGatewayConfig) {
17
+ const modelName = config.modelName || 'claude-haiku-4-5';
18
+
19
+ // PostHog gateway expects /v1/messages, but AI SDK appends /messages
20
+ // So we need to append /v1 to the baseURL
21
+ const baseURL = config.baseURL ? `${config.baseURL}/v1` : undefined;
22
+
23
+ // Custom fetch to convert x-api-key header to Authorization Bearer
24
+ // PostHog gateway expects Bearer token, but Anthropic SDK sends x-api-key
25
+ const customFetch = async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
26
+ const headers = new Headers(init?.headers);
27
+
28
+ if (headers.has('x-api-key')) {
29
+ headers.delete('x-api-key');
30
+ headers.set('Authorization', `Bearer ${config.apiKey}`);
31
+ }
32
+
33
+ return fetch(url, {
34
+ ...init,
35
+ headers,
36
+ });
37
+ };
38
+
39
+ const anthropic = createAnthropic({
40
+ apiKey: config.apiKey,
41
+ baseURL,
42
+ //@ts-ignore
43
+ fetch: customFetch,
44
+ });
45
+
46
+ return anthropic(modelName);
47
+ }