import { A as CreateIssueInput, G as PostTicketHumanInputRequest, I as LinearProfile, M as IssuePlace, N as LinearClient, P as LinearIssueMatch, R as PostTicketNote, V as Halt, it as LinearAgentTurnRequest, j as FindIssueInput, jn as TurnObserver, nr as TurnRequest, nt as LinearAgentActivityContent, rr as TurnStepResult, rt as LinearAgentPrompt, z as TicketNote } from "../../index-DJ6CHaMc.js"; import { i as StepRunMetadata, r as RunMetadata } from "../../resources-B6ZjmsZN.js"; import "../../seams-DiYeIR45.js"; import { n as fetchTicketSnapshot, t as resolveLinearIssue } from "../../resolve-CiVTHbqA.js"; //#region src/steps/linear/agent-sessions.d.ts /** * Open a Linear agent session on an issue as the factory's app, showing the run's dashboard when * the service hosts one, and return its id. * * @remarks * Linear starts the session at once. Its create call takes no id of its own, so a retry after a * lost response may open a second session. * * @group Linear agent sessions */ declare function openLinearAgentSession({ installationName, issueId }: { installationName: string; issueId: string; }, metadata: RunMetadata): Promise<{ sessionId: string; }>; /** * Post an activity into a Linear agent session as the factory's app. * * @remarks * Only a `thought` or an `action` may be `ephemeral`; Linear replaces an ephemeral activity with * the next one. Every retry of one step posts the same activity, so a lost response never posts * it twice. With `once`, the activity is posted at most once per key in the session, from any * step. * * @group Linear agent sessions */ declare function postLinearAgentActivity({ installationName, sessionId, content, ephemeral, once }: { installationName: string; sessionId: string; content: LinearAgentActivityContent; ephemeral?: boolean; once?: string; }, metadata: Pick): Promise<{ id: string; createdAt: string; }>; /** * Replace the links a Linear agent session shows, such as a pull request. The run's dashboard * comes first when the service hosts one. * * @group Linear agent sessions */ declare function setLinearAgentSessionUrls({ installationName, sessionId, urls }: { installationName: string; sessionId: string; urls: Array<{ label: string; url: string; }>; }, metadata: RunMetadata): Promise; /** * Read every message people sent into a Linear agent session, oldest first. * * @remarks * The mention that opened the session is not one of them. A message whose `signal` is `"stop"` is * the person pressing stop. * * @group Linear agent sessions */ declare function listLinearAgentSessionPrompts({ installationName, sessionId }: { installationName: string; sessionId: string; }): Promise; //#endregion //#region src/providers/linear-agent.d.ts declare function createLinearAgentApi(linear: Pick): { postActivity: (sessionId: string, content: LinearAgentActivityContent, options?: { ephemeral?: boolean; id?: string; }) => Promise<{ id: string; createdAt: string; }>; postActivityOnce: (sessionId: string, content: LinearAgentActivityContent, id: string, options?: { ephemeral?: boolean; }) => Promise<{ id: string; createdAt: string; }>; findActivity: (id: string) => Promise<{ id: string; createdAt: string; } | null>; createSession: (issueId: string, urls: ReadonlyArray<{ label: string; url: string; }>) => Promise; setExternalUrls: (sessionId: string, urls: ReadonlyArray<{ label: string; url: string; }>) => Promise; listPrompts: (sessionId: string) => Promise; lastAppActivity: (sessionId: string) => Promise<{ type: string; createdAt: string; } | null>; }; type LinearAgentApi = ReturnType; //#endregion //#region src/steps/agents/shared/execute-turn.d.ts /** * Run one turn of a conversation in a worktree, with the checks, environment, lock and run * cancellation of an agent step. While it runs, `liveTurn(request.conversation)` takes more * messages and stops it. `observers` see its activity; their failures are ignored. A failed * just-in-time check comes back as `{ jitFailure }`, as from the agent step. */ declare function executeTurn(request: TurnRequest, metadata: RunMetadata, observers?: readonly TurnObserver[]): Promise; //#endregion //#region src/steps/linear/agent-turn.d.ts type SessionApi = Pick; /** What a Linear agent turn reaches. Tests replace it. */ interface LinearAgentTurnDeps { executeTurn: typeof executeTurn; linear: (installationName: string) => SessionApi; wait: (ms: number) => Promise; } /** * Run one turn of a conversation in a Linear agent session. * * @remarks * The turn takes the opening mention, if given, and every reply in the session not in * `consumed`, so a retry takes the replies that arrived while the turn ran. A stop among them * ends the turn `stopped` before it starts. While the turn runs, a status line is posted as an * ephemeral thought, at most every five seconds, and each answer is posted as a response once * written. * * @group Linear agent sessions */ declare function executeLinearAgentTurn(request: LinearAgentTurnRequest, metadata: StepRunMetadata, deps?: LinearAgentTurnDeps): Promise; //#endregion //#region src/steps/linear/issues.d.ts /** * Post a comment on a ticket. An `id` (UUID v4) names the comment in advance, so a caller can * find it again after a lost response instead of posting twice. * * @group Create and update */ declare function createComment({ installationName, issueId, body, id }: { installationName: string; issueId: string; body: string; id?: string; }): Promise<{ id: string; createdAt: string; }>; /** * Create a ticket in a team, a project or both, optionally with a status and labels. * * @example * ```ts * import { createIssue } from "@jigs-ai/jigs/steps/linear"; * * export async function fileFinding(title: string, description: string) { * "use step"; * return createIssue({ installationName: "linear-acme", team: "ENG", status: "Triage", title, description }); * } * ``` * * @group Create and update */ declare function createIssue({ installationName, ...input }: CreateIssueInput & { installationName: string; }): Promise<{ id: string; identifier: string; url: string; }>; /** * Find the newest ticket in a team or project whose title starts with the given text. * * @group Resolve and read */ declare function findIssue({ installationName, ...input }: FindIssueInput & { installationName: string; }): Promise; //#endregion //#region src/steps/linear/render.d.ts /** * Who the message is for. `mentions` is the final list the message greets, in * order and each person once: the operator (or, without one, the ticket's * creator), the assignee, then any extra people the step was asked to mention. * A custom renderer greets `mentions` rather than working it out again; the * other fields are there for context and may be null. * * @group Rendering/customization */ type TicketParticipants = { creator: LinearProfile | null; assignee: LinearProfile | null; /** The configured operator, or null when none is set or Linear could not find them. */ operator: LinearProfile | null; mentions: LinearProfile[]; }; /** * What the question's footer says about the run that asked it. The factory's * step wrapper builds it from the Workflow SDK's metadata, which the workflow * cannot see. Where the run paused belongs to the halt, not the context: only * the routine that raised it knows. * * @group Rendering/customization */ type HumanInputContext = { runId: string; workflow?: string; }; /** * Renders the question that asks a person to unblock a run. * * @group Rendering/customization */ type RenderHumanInputRequest = (halt: Halt, context: HumanInputContext, participants: TicketParticipants) => string; /** * Renders a note for ticket participants that asks for nothing. * * @group Rendering/customization */ type RenderTicketNote = (note: TicketNote, participants: TicketParticipants) => string; /** * Render the default question as Linear Markdown. * * @group Rendering/customization */ declare const renderHumanInputRequest: RenderHumanInputRequest; /** * Render the default ticket note as Linear Markdown. * * @group Rendering/customization */ declare const renderTicketNote: RenderTicketNote; //#endregion //#region src/steps/linear/status.d.ts /** * The before-and-after state names from a ticket status update. * * @group Create and update */ interface TicketStatusResult { from: string; to: string; changed: boolean; } /** * Set a ticket to one of its team's named states. * * @group Create and update */ declare function setTicketStatus({ installationName, issueId, stateName }: { installationName: string; issueId: string; stateName: string; }): Promise; //#endregion //#region src/steps/linear/ticket-session.d.ts /** * Ask in the run's Linear agent session for a person to help the run continue. * * @remarks * Posts the halt as an elicitation, which shows the session as waiting for input. Mentions the * factory's `linear.operator`, or the ticket's creator when it is not set, then the assignee and * the halt's `mention` emails, each person once. A person Linear cannot find is skipped with a * warning; the question always posts. A changed operator takes effect when the service restarts, * which `jigs up` does. * * @group Human interaction primitives */ declare const postTicketHumanInputRequest: ({ installationName, issueId, sessionId, halt }: Parameters[0], metadata: StepRunMetadata, render?: RenderHumanInputRequest) => ReturnType; /** * Tell ticket participants something in the run's Linear agent session, without waiting for a * reply. * * @remarks * A note that ends the run is the session's final response, even for a failure: Linear offers * Retry on a session that ends in an error, and a run that has ended cannot take it. A note * that waits on people is an elicitation, which shows the session as awaiting input. Any other * note is a response followed by a short thought, which keeps the session working so Stop still * ends the run. Mentions in each of them notify. Mentions the same people as * {@link postTicketHumanInputRequest}, with the note's `mention` emails as the extras. * * @group Human interaction primitives */ declare const postTicketNote: ({ installationName, issueId, sessionId, note }: Parameters[0], metadata: StepRunMetadata, render?: RenderTicketNote) => ReturnType; //#endregion export { type CreateIssueInput, type FindIssueInput, type HumanInputContext, type IssuePlace, type LinearAgentActivityContent, type LinearAgentPrompt, type LinearAgentTurnRequest, type LinearIssueMatch, type RenderHumanInputRequest, type RenderTicketNote, type TicketParticipants, type TicketStatusResult, createComment, createIssue, executeLinearAgentTurn, fetchTicketSnapshot, findIssue, listLinearAgentSessionPrompts, openLinearAgentSession, postLinearAgentActivity, postTicketHumanInputRequest, postTicketNote, renderHumanInputRequest, renderTicketNote, resolveLinearIssue, setLinearAgentSessionUrls, setTicketStatus };