import { S as ToolOverrides, _ as CommitIdentity, a as GithubTokenInput, c as ApprovalConfig, d as GithubToolPreset, f as PRESET_TOOLS, g as GithubWriteToolName, h as GithubToolName, i as PickGithubTools, l as GITHUB_WRITE_TOOLS, m as GITHUB_TOOL_NAMES, o as resolveGithubToken, p as PresetToolName, r as GithubToolsForPreset, s as GithubToolsContext, t as AllGithubTools, u as CombinedPresetToolNames, v as CommitToolOptions } from "./tool-types-BsfalcyC.mjs"; import { a as createGithubAgent, i as CreateGithubAgentOptions, n as GithubToolsOptions, r as createGithubTools, t as GithubTools } from "./index-JH3DVh1R.mjs"; import { FinishReason, LanguageModel, LanguageModelResponseMetadata, LanguageModelUsage, ModelMessage, StepResult, StopCondition, ToolSet } from "ai"; import { WorkflowAgentOptions, WorkflowAgentStreamOptions, WorkflowAgentStreamResult } from "@ai-sdk/workflow"; import { Context } from "@ai-sdk/provider-utils"; //#region src/workflow.d.ts /** * Result of {@link DurableGithubAgent.generate}. */ export interface DurableGithubAgentGenerateResult { text: string; finishReason: FinishReason; usage: LanguageModelUsage; steps: StepResult[]; response: LanguageModelResponseMetadata & { messages: ModelMessage[]; }; } /** * A wrapper around {@link WorkflowAgent} that adds a non-streaming * `.generate()` method alongside the existing `.stream()`. * * - `.stream()` — delegates to `WorkflowAgent.stream()`. Each tool call is * an individually retriable workflow step. Supports `needsApproval` on tools. * - `.generate()` — uses `generateText` from the AI SDK for non-streaming * execution. Must be called from within a `"use step"` function in * workflow context (the Workflow runtime blocks raw I/O in workflow scope). */ export declare class DurableGithubAgent { private agent; private _model; private _instructions?; private _telemetry?; private _tools; constructor(options: WorkflowAgentOptions); /** The tool set configured for this agent. */ get tools(): TTools; /** * Stream the agent's response. Delegates directly to `WorkflowAgent.stream()`. * Works in workflow context — each tool call is a durable step. */ stream(options: WorkflowAgentStreamOptions): Promise>; /** * Generate a non-streaming response using `generateText` from the AI SDK. * * In workflow context this **must** be called from within a `"use step"` * function, because the Workflow runtime blocks direct I/O (HTTP calls) * at the workflow scope level. */ generate({ prompt, stopWhen }: { prompt: string; stopWhen?: StopCondition | Array>; }): Promise>; } /** * Options for creating a durable GitHub agent via {@link createDurableGithubAgent}. * * Extends all `WorkflowAgentOptions` (temperature, telemetry, callbacks, etc.) * and adds GitHub-specific fields (token, preset, approval config). */ export type CreateDurableGithubAgentOptions = Omit & { model: string | LanguageModel; /** * GitHub personal access token or async token provider. * Falls back to `process.env.GITHUB_TOKEN` when omitted. */ token?: GithubTokenInput; /** * Restrict tools and system prompt to a predefined preset. * * Selects a subset of tools and, when a single preset is passed, * sets a matching system prompt. Combine presets with an array to merge tool sets. * * @see {@link GithubToolPreset} for available presets and included tools. */ preset?: GithubToolPreset | GithubToolPreset[]; /** * Control whether write operations require user approval before execution. * * @see {@link ApprovalConfig} for global and per-tool options. */ requireApproval?: ApprovalConfig; /** * Fully replace the default system prompt. * When set, `preset` system prompts and `additionalInstructions` are ignored. */ instructions?: string; /** * Append text to the preset-specific (or default) system prompt. * Ignored when `instructions` is set. */ additionalInstructions?: string; /** * Default owner / repo / PR / issue / ref values for tools and the system prompt. */ context?: GithubToolsContext; /** * Default author for commit-creating tools. * Falls back to the authenticated user when omitted. */ author?: CommitIdentity; /** * Default committer for commit-creating tools. * Falls back to the authenticated user when omitted. */ committer?: CommitIdentity; /** * Co-authors to attribute on all commits. * Added as "Co-authored-by" trailers to commit messages. */ coAuthors?: CommitIdentity[]; }; /** * Create a pre-configured durable GitHub agent powered by `WorkflowAgent` * from `@ai-sdk/workflow`. * * Returns a {@link DurableGithubAgent} with two interaction modes: * * - `.stream()` — works directly in workflow scope; each tool call is a durable step. * Write tools honor `requireApproval` via `needsApproval` and pause the workflow * until the user approves or denies. * - `.generate()` — uses `generateText` from the AI SDK; must be called from * within a `"use step"` function when running inside a workflow. * * @example Streaming (chat UI — works in workflow scope) * ```ts * import { createDurableGithubAgent } from '@github-tools/sdk/workflow' * import { getWritable } from 'workflow' * import type { ModelMessage, ModelCallStreamPart } from 'ai' * * async function chatWorkflow(messages: ModelMessage[], token: string) { * "use workflow" * const agent = createDurableGithubAgent({ * model: 'anthropic/claude-sonnet-4.6', * token, * preset: 'code-review', * }) * const writable = getWritable() * await agent.stream({ messages, writable }) * } * ``` */ export declare function createDurableGithubAgent(options: CreateDurableGithubAgentOptions & { preset?: undefined; }): DurableGithubAgent; export declare function createDurableGithubAgent

(options: CreateDurableGithubAgentOptions & { preset: P; }): DurableGithubAgent>>; export declare function createDurableGithubAgent

(options: CreateDurableGithubAgentOptions & { preset: P; }): DurableGithubAgent>>; //#endregion export { type AllGithubTools, type ApprovalConfig, type CombinedPresetToolNames, type CommitIdentity, type CommitToolOptions, type CreateGithubAgentOptions, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, type GithubTokenInput, type GithubToolName, type GithubToolPreset, type GithubTools, type GithubToolsContext, type GithubToolsForPreset, type GithubToolsOptions, type GithubWriteToolName, PRESET_TOOLS, type PickGithubTools, type PresetToolName, type ToolOverrides, createGithubAgent, createGithubTools, resolveGithubToken }; //# sourceMappingURL=workflow.d.mts.map