@leitwerk-dev/ticket-creation
v0.4.0
Published
Provides the generic `ticket_creation_process`. Operators launch it from a durable parent result through the ticket-creation HTTP API. The server snapshots parent context, records a derived-process relation, exposes only the selected capability-marked int
Readme
Ticket creation
Provides the generic ticket_creation_process. Operators launch it from a durable parent result through the ticket-creation HTTP API. The server snapshots parent context, records a derived-process relation, exposes only the selected capability-marked integration tool, and gates the first external write for operator approval.
Ticket adapters register normal integration tools with capability.kind: "ticket_creation" and return { externalId, url, result? }. Adapters may provide dynamic destinations. The launcher snapshots browser-safe destination summaries with the parent context but does not make the operator choose one before the child process starts. The child process asks only when the operator's issue description does not identify a destination. The server resolves that opaque choice into a fresh snapshot before approval and passes it to the tool as ctx.ticketDestination. Optional agentContext is untrusted prompt data and must not contain credentials.
The initial dialog contains only the operator's issue description and, when more than one adapter exists, the ticket system. Ticket refinement and destination clarification stay in the child process's normal UI.
The Forgejo, GitHub, GitLab and Jira extensions provide production adapters.
Load this process extension alongside the required integration and enable its
ticket_creation configuration. GitHub, GitLab and Jira are opt-in; Forgejo retains
its enabled-by-default behavior. See each integration's README for permissions and
configuration. Jira supports its existing Data Center REST v2 integration and
discovers creatable project/issue-type pairs, including required custom fields.
The review shows the destination, title and description before Create issue. Operators can inspect all fields, request changes, or discard the draft. Unchanged launch retries reuse the same child. If worker startup fails after the child is created, the UI opens that child for normal recovery.
Adapters must use the execution context idempotency key with ctx.externalWrites.ensure() and reconcile ambiguous external outcomes before retrying.
The root export provides the process and ticketCreationParamsCodec. The codec
validates nested parent strings/results, artifact identifiers, excerpt focus,
actor fields and destination summaries. Existing parameters without destination
fields, with a resolved snapshot, or with a destination list remain supported.
Destination data is opaque JSON; its adapter validates its meaning. Captured
parent material is never reloaded from the parent during drafting.
For local development, import LocalTicketAdapter from
@leitwerk-dev/ticket-creation/testing. Configure its file, backend URL and
notebook destinations, then explicitly register adapter.extension() alongside
this extension. It contributes the normal local_create_ticket capability and
uses the server's durable external-write log with the execution idempotency key.
injectLostResponse() persists one ticket before losing the adapter response. The tool reconciles
that ticket and records its receipt without creating another. If receipt recording
is interrupted, replay the same execution key after restarting. Serve the returned local receipt URLs from the
composition's controls. There is no production HTTP fallback.
Approval and recovery
Approval feedback revises the draft while retaining its destination. Declining writes no ticket. Captured parent context and the resolved destination survive restart and Retry; later parent edits do not change that context.
Pending approval is retained across shutdown. An interrupted turn parks for Retry. Repeating a launch with the same idempotency key returns the same child, including after restart. Lost provider responses are reconciled without creating another ticket.
API support
The following exported declarations are @public:
@leitwerk-dev/ticket-creation:TicketCreationParams,default,ticketCreationProcess.
Members have individual classifications; these exports do not make every member
public. Both @public and @internal APIs remain usable and fully typed. Source
annotations are authoritative; see the SDK compatibility
policy.
External-write replay
Adapters follow the shared reconciliation contract and return the standard ticket receipt on creation and replay. A logged ticket that cannot be recovered fails without creating another ticket.
