@leitwerk-dev/process-sdk 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TRQJ5PRM.js → chunk-TA4KO53Q.js} +1 -5
- package/dist/chunk-TA4KO53Q.js.map +1 -0
- package/dist/{chunk-5RJZ2E7D.js → chunk-WFY2WWZE.js} +2 -6
- package/dist/{chunk-5RJZ2E7D.js.map → chunk-WFY2WWZE.js.map} +1 -1
- package/dist/core-capabilities.d.ts +70 -34
- package/dist/core-capabilities.d.ts.map +1 -1
- package/dist/define-process.d.ts +17 -49
- package/dist/define-process.d.ts.map +1 -1
- package/dist/{extension-api-BBcwktmc.d.ts → extension-api-CcqZCYJx.d.ts} +136 -70
- package/dist/extension-api.d.ts +115 -7
- package/dist/extension-api.d.ts.map +1 -1
- package/dist/external-action-source.d.ts +7 -0
- package/dist/external-action-source.d.ts.map +1 -0
- package/dist/external-source-poll.d.ts +15 -0
- package/dist/external-source-poll.d.ts.map +1 -0
- package/dist/flow.d.ts +80 -104
- package/dist/flow.d.ts.map +1 -1
- package/dist/fs-utils.d.ts +2 -0
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/git-binary.js +25 -33
- package/dist/git-binary.js.map +1 -1
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4694 -29
- package/dist/index.js.map +1 -1
- package/dist/integration-http.d.ts +21 -0
- package/dist/integration-http.d.ts.map +1 -0
- package/dist/json-data.d.ts +3 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/leaf-outcome-renderer.js +74 -64
- package/dist/leaf-outcome-renderer.js.map +1 -1
- package/dist/leaf-outcomes.d.ts.map +1 -1
- package/dist/model-provider.d.ts.map +1 -1
- package/dist/pi-config.d.ts +1 -5
- package/dist/pi-config.d.ts.map +1 -1
- package/dist/pi-config.js +20 -180
- package/dist/pi-config.js.map +1 -1
- package/dist/process-flow-view.d.ts.map +1 -1
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-watcher-source.d.ts.map +1 -1
- package/dist/project-binding.d.ts +9 -0
- package/dist/project-binding.d.ts.map +1 -0
- package/dist/registry-utils.d.ts.map +1 -1
- package/dist/repository-feedback.d.ts +29 -0
- package/dist/repository-feedback.d.ts.map +1 -0
- package/dist/repository-git-env.d.ts +2 -0
- package/dist/repository-git-env.d.ts.map +1 -1
- package/dist/repository-http.d.ts +19 -0
- package/dist/repository-http.d.ts.map +1 -0
- package/dist/repository-https.d.ts +3 -0
- package/dist/repository-https.d.ts.map +1 -0
- package/dist/repository-issue-watcher.d.ts +31 -0
- package/dist/repository-issue-watcher.d.ts.map +1 -0
- package/dist/repository-source-config.d.ts +32 -0
- package/dist/repository-source-config.d.ts.map +1 -0
- package/dist/repository-types.d.ts +36 -0
- package/dist/repository-types.d.ts.map +1 -0
- package/dist/review-flow.js +12 -43
- package/dist/review-flow.js.map +1 -1
- package/dist/runtime-internals.js +18 -2
- package/dist/runtime-internals.js.map +1 -1
- package/dist/state-helpers.d.ts +2 -0
- package/dist/state-helpers.d.ts.map +1 -1
- package/dist/subprocess-env.d.ts +1 -0
- package/dist/subprocess-env.d.ts.map +1 -1
- package/dist/tool-arguments.d.ts +7 -0
- package/dist/tool-arguments.d.ts.map +1 -0
- package/dist/turn-semantics.d.ts +5 -6
- package/dist/turn-semantics.d.ts.map +1 -1
- package/dist/types.d.ts +5 -15
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/core-capabilities.ts +81 -37
- package/src/define-process.ts +190 -313
- package/src/extension-api.ts +142 -6
- package/src/external-action-source.ts +12 -0
- package/src/external-source-poll.ts +49 -0
- package/src/flow.ts +332 -664
- package/src/fs-utils.ts +17 -2
- package/src/index.ts +54 -13
- package/src/integration-http.ts +58 -0
- package/src/json-data.ts +25 -0
- package/src/leaf-outcomes.ts +1 -9
- package/src/model-provider.ts +10 -23
- package/src/pi-config.ts +1 -6
- package/src/process-flow-view.ts +32 -88
- package/src/process-graph.ts +25 -51
- package/src/process-watcher-source.ts +3 -6
- package/src/project-binding.ts +36 -0
- package/src/registry-utils.ts +1 -5
- package/src/repository-feedback.ts +59 -0
- package/src/repository-git-env.ts +34 -0
- package/src/repository-http.ts +71 -0
- package/src/repository-https.ts +22 -0
- package/src/repository-issue-watcher.ts +92 -0
- package/src/repository-source-config.ts +60 -0
- package/src/repository-types.ts +25 -0
- package/src/state-helpers.ts +8 -4
- package/src/subprocess-env.ts +6 -0
- package/src/tool-arguments.ts +37 -0
- package/src/turn-semantics.ts +31 -75
- package/src/types.ts +5 -15
- package/dist/browser-ui-extension.js +0 -2
- package/dist/browser-ui-extension.js.map +0 -1
- package/dist/capabilities.js +0 -7
- package/dist/capabilities.js.map +0 -1
- package/dist/chunk-TRQJ5PRM.js.map +0 -1
- package/dist/codecs.js +0 -9
- package/dist/codecs.js.map +0 -1
- package/dist/commit-message.js +0 -3
- package/dist/commit-message.js.map +0 -1
- package/dist/core-capabilities.js +0 -6
- package/dist/core-capabilities.js.map +0 -1
- package/dist/define-process.js +0 -1078
- package/dist/define-process.js.map +0 -1
- package/dist/event-bus.js +0 -31
- package/dist/event-bus.js.map +0 -1
- package/dist/extension-api.js +0 -5
- package/dist/extension-api.js.map +0 -1
- package/dist/flow.js +0 -1645
- package/dist/flow.js.map +0 -1
- package/dist/form-contract.js +0 -2
- package/dist/form-contract.js.map +0 -1
- package/dist/fs-utils.js +0 -23
- package/dist/fs-utils.js.map +0 -1
- package/dist/graph-fragments.js +0 -57
- package/dist/graph-fragments.js.map +0 -1
- package/dist/host-capabilities.js +0 -42
- package/dist/host-capabilities.js.map +0 -1
- package/dist/launcher-contract.js +0 -2
- package/dist/launcher-contract.js.map +0 -1
- package/dist/leaf-outcomes.js +0 -52
- package/dist/leaf-outcomes.js.map +0 -1
- package/dist/model-provider.js +0 -171
- package/dist/model-provider.js.map +0 -1
- package/dist/process-definition-internals.js +0 -25
- package/dist/process-definition-internals.js.map +0 -1
- package/dist/process-flow-view.js +0 -418
- package/dist/process-flow-view.js.map +0 -1
- package/dist/process-graph.js +0 -212
- package/dist/process-graph.js.map +0 -1
- package/dist/process-launcher-builder.js +0 -43
- package/dist/process-launcher-builder.js.map +0 -1
- package/dist/process-watcher-builder.js +0 -40
- package/dist/process-watcher-builder.js.map +0 -1
- package/dist/process-watcher-source.js +0 -52
- package/dist/process-watcher-source.js.map +0 -1
- package/dist/registry-utils.js +0 -18
- package/dist/registry-utils.js.map +0 -1
- package/dist/repository-git-env.js +0 -26
- package/dist/repository-git-env.js.map +0 -1
- package/dist/server-events.js +0 -2
- package/dist/server-events.js.map +0 -1
- package/dist/server-process-builder.js +0 -52
- package/dist/server-process-builder.js.map +0 -1
- package/dist/state-helpers.js +0 -18
- package/dist/state-helpers.js.map +0 -1
- package/dist/subprocess-env.js +0 -34
- package/dist/subprocess-env.js.map +0 -1
- package/dist/tool-renderers.js +0 -63
- package/dist/tool-renderers.js.map +0 -1
- package/dist/turn-semantics.js +0 -365
- package/dist/turn-semantics.js.map +0 -1
- package/dist/types.js +0 -23
- package/dist/types.js.map +0 -1
- package/dist/ui-process-builder.js +0 -30
- package/dist/ui-process-builder.js.map +0 -1
- package/dist/worker-process-builder.js +0 -22
- package/dist/worker-process-builder.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as _leitwerk_dev_domain from '@leitwerk-dev/domain';
|
|
2
|
+
import { ProcessInstance, ProcessProject, ProcessTurnRecord, WorkerErrorClass, ProcessLeafOutcomeSnapshot, ProcessQuestionRequest, TurnId, ProcessTurnTerminalLifecycleStatus, TurnAcceptanceState as TurnAcceptanceState$1, ProcessTurnRecordPathType, ProcessSemanticEntryRefKey, TurnProgressReport, ProcessTurnStartSelection, ProcessLifecycleStatus, InputSource, InputKind, ProcessInputTarget, LaunchModelConfigInput, ProcessCustomizableFields, Actor } from '@leitwerk-dev/domain';
|
|
3
|
+
import { UsageTokenCounts, UsageCostSnapshot, WatcherPresentationField } from '@leitwerk-dev/protocol';
|
|
3
4
|
import { ActionFormDefinition } from '@leitwerk-dev/protocol/form-contract';
|
|
4
5
|
import { LauncherCardMetadata, LauncherSchemaDefinition, LauncherFieldOptionDefinition, LauncherValidationError, UiLauncherSummaryBase } from '@leitwerk-dev/protocol/launcher-contract';
|
|
5
6
|
import { ToolCallRendererDefinition } from '@leitwerk-dev/protocol/tool-renderer-contract';
|
|
@@ -166,6 +167,8 @@ interface OutcomeToolSpec {
|
|
|
166
167
|
publishedProduct?: string;
|
|
167
168
|
/** Outcome parameter whose markdown value is captured as the turn result. */
|
|
168
169
|
turnResultMarkdownParameter?: string;
|
|
170
|
+
/** Outcome parameter containing a concise operator-facing summary. */
|
|
171
|
+
resultSummaryParameter?: string;
|
|
169
172
|
}
|
|
170
173
|
interface ProcessToolResult {
|
|
171
174
|
status: string;
|
|
@@ -234,21 +237,8 @@ interface PiCustomTool {
|
|
|
234
237
|
executionMode?: "sequential" | "parallel";
|
|
235
238
|
execute(args: Record<string, unknown>, context?: PiCustomToolExecutionContext): Promise<unknown>;
|
|
236
239
|
}
|
|
237
|
-
interface PiUsageData {
|
|
238
|
-
|
|
239
|
-
output: number;
|
|
240
|
-
/** Provider-reported reasoning/thinking tokens. This is a subset of output tokens. */
|
|
241
|
-
reasoning?: number;
|
|
242
|
-
cacheRead: number;
|
|
243
|
-
cacheWrite: number;
|
|
244
|
-
totalTokens: number;
|
|
245
|
-
cost: {
|
|
246
|
-
input: number;
|
|
247
|
-
output: number;
|
|
248
|
-
cacheRead: number;
|
|
249
|
-
cacheWrite: number;
|
|
250
|
-
total: number;
|
|
251
|
-
};
|
|
240
|
+
interface PiUsageData extends UsageTokenCounts {
|
|
241
|
+
cost: UsageCostSnapshot;
|
|
252
242
|
cacheHitRate: number;
|
|
253
243
|
}
|
|
254
244
|
interface PiRunDetails {
|
|
@@ -399,12 +389,7 @@ type ProcessEmittedEvent = {
|
|
|
399
389
|
type: ProcessEventName;
|
|
400
390
|
data: unknown;
|
|
401
391
|
};
|
|
402
|
-
type ProcessQueuedInput =
|
|
403
|
-
source: InputSource;
|
|
404
|
-
kind: InputKind;
|
|
405
|
-
bodyMarkdown: string;
|
|
406
|
-
target?: ProcessInputTarget;
|
|
407
|
-
};
|
|
392
|
+
type ProcessQueuedInput = Parameters<ServerProcessContext["queueInput"]>[0];
|
|
408
393
|
type MaybePromise<T> = T | Promise<T>;
|
|
409
394
|
type StaticRouteTarget = {
|
|
410
395
|
to?: TurnId;
|
|
@@ -413,6 +398,10 @@ type StaticRouteTarget = {
|
|
|
413
398
|
};
|
|
414
399
|
interface ProcessRuntimeTurnContext<TParams = unknown, TState = unknown> extends WorkerProcessContext<TParams, TState> {
|
|
415
400
|
}
|
|
401
|
+
interface LlmTurnPreparationContext<TParams = unknown, TState = unknown> extends ProcessRuntimeTurnContext<TParams, TState> {
|
|
402
|
+
callIntegrationTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
403
|
+
reportProgress(report: TurnProgressReport): void;
|
|
404
|
+
}
|
|
416
405
|
interface ProcessServerRuntimeContext<TParams = unknown, TState = unknown> {
|
|
417
406
|
readonly process: ServerProcessContext<TParams, TState>["process"];
|
|
418
407
|
readonly projects: ServerProcessContext<TParams, TState>["projects"];
|
|
@@ -514,9 +503,9 @@ interface ProcessToolOutcomeBaseSpec<TParams = unknown, TState = unknown> {
|
|
|
514
503
|
publishedProduct?: string;
|
|
515
504
|
/** Outcome parameter whose markdown value is captured as the turn result. */
|
|
516
505
|
turnResultMarkdownParameter?: string;
|
|
506
|
+
/** Outcome parameter containing a concise operator-facing summary. */
|
|
507
|
+
resultSummaryParameter?: string;
|
|
517
508
|
effect?: ProcessOutcomeEffect<TParams, TState>;
|
|
518
|
-
/** Parks the process on this turn after recording the outcome. */
|
|
519
|
-
wait?: true;
|
|
520
509
|
lifecycleIntent?: ProcessOutcomeLifecycleIntent<TParams, TState>;
|
|
521
510
|
}
|
|
522
511
|
type ProcessToolOutcomeSpec<TParams = unknown, TState = unknown> = ProcessToolOutcomeBaseSpec<TParams, TState> & (StaticRouteTarget | {
|
|
@@ -556,8 +545,12 @@ interface LlmTurnDefinition<TOutcome extends string = string, TParams = unknown,
|
|
|
556
545
|
availableTools: readonly PiBuiltInToolName[];
|
|
557
546
|
/** Server-owned integration tools proxied over authenticated worker IPC. */
|
|
558
547
|
integrationTools?: readonly string[];
|
|
548
|
+
/** Resolve a constrained tool set from validated durable process data at turn start. */
|
|
549
|
+
resolveIntegrationTools?: (params: TParams, state: TState) => readonly string[];
|
|
559
550
|
/** Opt in to the durable, operator-facing ask_questions custom tool. */
|
|
560
551
|
askQuestions?: boolean;
|
|
552
|
+
/** Deterministic worker preparation that must complete before Pi is prompted. */
|
|
553
|
+
prepare?(ctx: LlmTurnPreparationContext<TParams, TState>): MaybePromise<unknown>;
|
|
561
554
|
completionMode?: TurnCompletionMode;
|
|
562
555
|
branchType: TurnBranchType;
|
|
563
556
|
context: TurnContextMode;
|
|
@@ -587,24 +580,6 @@ interface AutomaticTurnDefinition<TOutcome extends string = string, TParams = un
|
|
|
587
580
|
reviewSemanticRef?: ProcessSemanticEntryRefKey;
|
|
588
581
|
run(ctx: ProcessRuntimeTurnContext<TParams, TState>): Promise<WorkerCompleteInput<TOutcome>> | WorkerCompleteInput<TOutcome>;
|
|
589
582
|
}
|
|
590
|
-
interface ServerAutomaticTurnRunResult<TOutcome extends string = string, TState = unknown> extends WorkerCompleteInput<TOutcome> {
|
|
591
|
-
state?: TState;
|
|
592
|
-
}
|
|
593
|
-
type ServerAutomaticTurnRestartBehavior = "rerun" | "fail_running";
|
|
594
|
-
interface ServerAutomaticTurnDefinition<TOutcome extends string = string, TParams = unknown, TState = unknown> {
|
|
595
|
-
kind: "server_automatic";
|
|
596
|
-
description: string;
|
|
597
|
-
outcomes?: Partial<Record<TOutcome, ProcessToolOutcomeSpec<TParams, TState>>>;
|
|
598
|
-
turnEnd?: ProcessTurnEndSpec<TParams, TState, TOutcome>;
|
|
599
|
-
reviewSemanticRef?: ProcessSemanticEntryRefKey;
|
|
600
|
-
/**
|
|
601
|
-
* Controls startup/drainer behavior when a durable running turn record already exists.
|
|
602
|
-
* The default reruns the deterministic handler. Use fail_running for non-idempotent
|
|
603
|
-
* host side effects that must not be replayed after a server crash/restart.
|
|
604
|
-
*/
|
|
605
|
-
restartBehavior?: ServerAutomaticTurnRestartBehavior;
|
|
606
|
-
run(ctx: ProcessServerRuntimeContext<TParams, TState>): Promise<ServerAutomaticTurnRunResult<TOutcome, TState>> | ServerAutomaticTurnRunResult<TOutcome, TState>;
|
|
607
|
-
}
|
|
608
583
|
interface ExternalSourceTransition<TParams = unknown, TState = unknown, TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>> extends StaticRouteTarget {
|
|
609
584
|
source: ExternalActionSource<TParams, TState, TEvent, TInput>;
|
|
610
585
|
effect?: ExternalSourceEffect<TParams, TState, TEvent, TInput>;
|
|
@@ -615,31 +590,15 @@ interface ExternalTurnDefinition<TParams = unknown, TState = unknown> {
|
|
|
615
590
|
transitions: readonly ExternalSourceTransition<TParams, TState>[];
|
|
616
591
|
reviewSemanticRef?: ProcessSemanticEntryRefKey;
|
|
617
592
|
}
|
|
618
|
-
type TurnDefinition<TParams = unknown, TState = unknown> = LlmTurnDefinition<string, TParams, TState> | AutomaticTurnDefinition<string, TParams, TState> |
|
|
593
|
+
type TurnDefinition<TParams = unknown, TState = unknown> = LlmTurnDefinition<string, TParams, TState> | AutomaticTurnDefinition<string, TParams, TState> | HumanTurnDefinition<TParams, TState> | ExternalTurnDefinition<TParams, TState>;
|
|
619
594
|
type TurnDefinitionRecord<TParams = unknown, TState = unknown> = Record<TurnId, TurnDefinition<TParams, TState>>;
|
|
620
595
|
type ProcessDefinition<TParams = unknown, TState = unknown> = ExtensionProcessDefinition<TParams, TState>;
|
|
621
|
-
interface DefinedProcessInput<TParams = unknown, TState = unknown> {
|
|
622
|
-
id: string;
|
|
623
|
-
displayName: string;
|
|
596
|
+
interface DefinedProcessInput<TParams = unknown, TState = unknown> extends Omit<ExtensionProcessDefinition<TParams, TState>, "entryTurnId" | "alternateEntryTurnIds" | "turns"> {
|
|
624
597
|
/** Primary entry used when a launch does not select a start turn explicitly. */
|
|
625
598
|
entry: TurnId;
|
|
626
599
|
/** Additional entry turns that launchers may select explicitly. */
|
|
627
600
|
alternateEntries?: readonly TurnId[];
|
|
628
|
-
happyPath?: readonly TurnId[];
|
|
629
|
-
paramsCodec: Codec<TParams>;
|
|
630
|
-
stateCodec: Codec<TState>;
|
|
631
|
-
initialState(params: TParams): TState;
|
|
632
|
-
repositoryCredentials?(input: {
|
|
633
|
-
params: TParams;
|
|
634
|
-
projects: readonly RepositoryCredentialProject[];
|
|
635
|
-
}): readonly RepositoryCredentialRequirement[];
|
|
636
|
-
piConfig?: ProcessPiConfig;
|
|
637
601
|
turns: TurnDefinitionRecord<TParams, TState>;
|
|
638
|
-
worker?: (api: WorkerProcessAPI<TParams, TState>) => void;
|
|
639
|
-
server?: (api: ServerProcessAPI<TParams, TState>) => void;
|
|
640
|
-
ui?: (api: UiProcessAPI<TParams, TState>) => void;
|
|
641
|
-
launchers?: (api: ProcessLauncherAPI<TParams>) => void;
|
|
642
|
-
watchers?: (api: ProcessWatcherAPI<TParams>) => void;
|
|
643
602
|
}
|
|
644
603
|
declare function getExternalSourceTransitionId(input: {
|
|
645
604
|
turnId: TurnId;
|
|
@@ -662,14 +621,13 @@ declare function resolveHumanTurnView<TParams, TState>(input: {
|
|
|
662
621
|
externalActions: readonly HumanTurnExternalActionView[];
|
|
663
622
|
};
|
|
664
623
|
declare function defineProcess<TParams = unknown, TState = unknown>(input: DefinedProcessInput<TParams, TState>): ProcessDefinition<TParams, TState>;
|
|
665
|
-
type RoutableTurnDefinition<TOutcome extends string, TParams, TState> = LlmTurnDefinition<TOutcome, TParams, TState> | AutomaticTurnDefinition<TOutcome, TParams, TState
|
|
624
|
+
type RoutableTurnDefinition<TOutcome extends string, TParams, TState> = LlmTurnDefinition<TOutcome, TParams, TState> | AutomaticTurnDefinition<TOutcome, TParams, TState>;
|
|
666
625
|
type RoutableOutcome<TTurn> = TTurn extends RoutableTurnDefinition<infer TOutcome, any, any> ? TOutcome : never;
|
|
667
626
|
type RoutableParams<TTurn> = TTurn extends RoutableTurnDefinition<any, infer TParams, any> ? TParams : never;
|
|
668
627
|
type RoutableState<TTurn> = TTurn extends RoutableTurnDefinition<any, any, infer TState> ? TState : never;
|
|
669
628
|
declare function routeTurnOutcomes<TTurn extends RoutableTurnDefinition<string, any, any>>(baseTurn: TTurn, routes: Partial<Record<RoutableOutcome<TTurn>, OutcomeRouteSpec<RoutableParams<TTurn>, RoutableState<TTurn>>>>, options?: OutcomeRouteOptions): TTurn;
|
|
670
629
|
declare function llmTurn<TParams = unknown, TState = unknown, TOutcome extends string = string>(input: Omit<LlmTurnDefinition<TOutcome, TParams, TState>, "kind">): LlmTurnDefinition<TOutcome, TParams, TState>;
|
|
671
630
|
declare function automaticTurn<TParams = unknown, TState = unknown, TOutcome extends string = string>(input: Omit<AutomaticTurnDefinition<TOutcome, TParams, TState>, "kind">): AutomaticTurnDefinition<TOutcome, TParams, TState>;
|
|
672
|
-
declare function serverAutomaticTurn<TParams = unknown, TState = unknown, TOutcome extends string = string>(input: Omit<ServerAutomaticTurnDefinition<TOutcome, TParams, TState>, "kind">): ServerAutomaticTurnDefinition<TOutcome, TParams, TState>;
|
|
673
631
|
declare function humanTurn<TParams = unknown, TState = unknown>(input: Omit<HumanTurnDefinition<TParams, TState>, "kind">): HumanTurnDefinition<TParams, TState>;
|
|
674
632
|
declare function externalTurn<TParams = unknown, TState = unknown>(input: Omit<ExternalTurnDefinition<TParams, TState>, "kind">): ExternalTurnDefinition<TParams, TState>;
|
|
675
633
|
|
|
@@ -945,6 +903,24 @@ type UiLauncherConfigResolution<TParams = unknown> = {
|
|
|
945
903
|
ok: false;
|
|
946
904
|
errors: readonly LauncherValidationError[];
|
|
947
905
|
};
|
|
906
|
+
interface LaunchPreparationContext<TParams = unknown> {
|
|
907
|
+
readonly signal: AbortSignal;
|
|
908
|
+
readonly launchConfig: ProcessLaunchConfig<TParams>;
|
|
909
|
+
readonly logger: {
|
|
910
|
+
info(message: string): void;
|
|
911
|
+
warn(message: string): void;
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
interface LaunchPreparationCheck<TParams = unknown> {
|
|
915
|
+
readonly id: string;
|
|
916
|
+
readonly label: string;
|
|
917
|
+
run(ctx: LaunchPreparationContext<TParams>): Promise<void>;
|
|
918
|
+
}
|
|
919
|
+
/** A launcher check may throw this error to expose bounded operator-safe remediation. */
|
|
920
|
+
declare class SafeLaunchPreparationError extends Error {
|
|
921
|
+
readonly safeSummary: string;
|
|
922
|
+
constructor(message: string, safeSummary: string);
|
|
923
|
+
}
|
|
948
924
|
interface UiLauncherDefinition<TParams = unknown> {
|
|
949
925
|
card: LauncherCardMetadata;
|
|
950
926
|
launchConfigSchema: LauncherSchemaDefinition;
|
|
@@ -955,6 +931,7 @@ interface UiLauncherDefinition<TParams = unknown> {
|
|
|
955
931
|
* the complete input. Launchers override this only for values that must be rebuilt.
|
|
956
932
|
*/
|
|
957
933
|
resolveRelaunchInput?(previousInput: Record<string, unknown>, ctx: LauncherContext): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
934
|
+
preparationChecks?(input: Record<string, unknown>, launchConfig: ProcessLaunchConfig<TParams>): readonly LaunchPreparationCheck<TParams>[];
|
|
958
935
|
resolveLaunchConfig(input: Record<string, unknown>, ctx: LauncherContext): UiLauncherConfigResolution<TParams> | Promise<UiLauncherConfigResolution<TParams>>;
|
|
959
936
|
}
|
|
960
937
|
type ProcessWatcherPresentationField = WatcherPresentationField;
|
|
@@ -982,6 +959,7 @@ interface ProcessWatcherDefinition<TParams = unknown, TEvent = unknown, TConfig
|
|
|
982
959
|
description: string;
|
|
983
960
|
source: ProcessWatcherSource<TConfig, TEvent>;
|
|
984
961
|
matches?(event: TEvent, ctx: LauncherContext): boolean | Promise<boolean>;
|
|
962
|
+
preparationChecks?(event: TEvent, launchConfig: ProcessLaunchConfig<TParams>): readonly LaunchPreparationCheck<TParams>[];
|
|
985
963
|
resolveLaunchConfig(event: TEvent, ctx: LauncherContext): ProcessLaunchConfig<TParams> | Promise<ProcessLaunchConfig<TParams>>;
|
|
986
964
|
}
|
|
987
965
|
interface ProcessLauncherDefinition<TParams = unknown> {
|
|
@@ -1031,6 +1009,7 @@ interface ProcessLauncherService {
|
|
|
1031
1009
|
resolveUiDefaults(launcherId: string, ctx?: LauncherContext): Promise<Record<string, unknown>>;
|
|
1032
1010
|
resolveUiOptions(launcherId: string, input: Record<string, unknown>, ctx?: LauncherContext): Promise<Record<string, readonly LauncherFieldOptionDefinition[]>>;
|
|
1033
1011
|
resolveUiRelaunchInput(launcherId: string, previousInput: Record<string, unknown>, ctx?: LauncherContext): Promise<Record<string, unknown>>;
|
|
1012
|
+
resolvePreparationChecks?(launcherId: string, input: Record<string, unknown>, launchConfig: ProcessLaunchConfig): readonly LaunchPreparationCheck[];
|
|
1034
1013
|
resolveUiLauncher(launcherId: string, input: Record<string, unknown>, ctx?: LauncherContext): Promise<UiLauncherResolutionResult>;
|
|
1035
1014
|
}
|
|
1036
1015
|
/** Resolve a UI launcher summary by id, returning `null` when it is unknown. */
|
|
@@ -1125,10 +1104,17 @@ interface ExternalSourceEffectContext<TParams = unknown, TState = unknown, TEven
|
|
|
1125
1104
|
readonly input: TInput;
|
|
1126
1105
|
}
|
|
1127
1106
|
type ExternalSourceEffect<TParams = unknown, TState = unknown, TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>> = (ctx: ExternalSourceEffectContext<TParams, TState, TEvent, TInput>) => ProcessEffectPlan<TState> | Promise<ProcessEffectPlan<TState> | undefined> | undefined;
|
|
1107
|
+
interface ExternalEventDescription {
|
|
1108
|
+
summary: string;
|
|
1109
|
+
markdown?: string;
|
|
1110
|
+
links?: _leitwerk_dev_domain.TurnProgressLink[];
|
|
1111
|
+
}
|
|
1128
1112
|
interface ExternalActionSource<TParams = unknown, TState = unknown, _TEvent = unknown, _TInput extends Record<string, unknown> = Record<string, unknown>> {
|
|
1129
1113
|
kind: string;
|
|
1130
1114
|
label?: string;
|
|
1131
1115
|
description?: string;
|
|
1116
|
+
/** Pure description captured when the event is consumed. */
|
|
1117
|
+
describeEvent?(event: _TEvent): ExternalEventDescription;
|
|
1132
1118
|
/**
|
|
1133
1119
|
* Extension-owned opaque config. Core may persist, hash, and display it, but must not
|
|
1134
1120
|
* interpret provider-specific fields.
|
|
@@ -1183,15 +1169,18 @@ interface WorkerProcessContext<TParams = unknown, TState = unknown> extends Proc
|
|
|
1183
1169
|
readonly turnResultMarkdownByProduct?: Readonly<Record<string, string>>;
|
|
1184
1170
|
/** Absolute workspace root for the current process instance, when available. */
|
|
1185
1171
|
readonly workspaceRoot?: string;
|
|
1186
|
-
/**
|
|
1172
|
+
/** Durable output produced by this LLM turn's preparation phase, when declared. */
|
|
1173
|
+
readonly prepared?: unknown;
|
|
1174
|
+
/** Invoke a server-owned integration tool authorized for this automatic turn or LLM preparation. */
|
|
1187
1175
|
callIntegrationTool?(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
1188
|
-
/** Replace the durable operator-facing progress report for this
|
|
1176
|
+
/** Replace the durable operator-facing progress report for this turn attempt. */
|
|
1189
1177
|
reportProgress?(report: TurnProgressReport): void;
|
|
1190
1178
|
}
|
|
1191
1179
|
interface WorkerCompleteInput<TOutcome extends string = string> {
|
|
1192
1180
|
outcome: TOutcome;
|
|
1193
1181
|
params?: Record<string, unknown>;
|
|
1194
1182
|
markdown?: string | null;
|
|
1183
|
+
resultSummary?: string;
|
|
1195
1184
|
}
|
|
1196
1185
|
interface WorkerRunHandle<TParams = unknown, TState = unknown> {
|
|
1197
1186
|
readonly ctx: WorkerProcessContext<TParams, TState>;
|
|
@@ -1224,7 +1213,7 @@ interface ProcessWatcherAPI<TParams = unknown> {
|
|
|
1224
1213
|
interface ProcessTurnBinding<TTurn = TurnDefinition> {
|
|
1225
1214
|
definition: TTurn;
|
|
1226
1215
|
}
|
|
1227
|
-
type RepositoryCredentialKind = "git_ssh";
|
|
1216
|
+
type RepositoryCredentialKind = "git_ssh" | "git_https";
|
|
1228
1217
|
/** Non-secret, code-defined repository authentication request. */
|
|
1229
1218
|
interface RepositoryCredentialRequirement {
|
|
1230
1219
|
readonly projectKey: string;
|
|
@@ -1243,13 +1232,28 @@ interface GitSshCredentialMaterial {
|
|
|
1243
1232
|
readonly privateKey: string;
|
|
1244
1233
|
readonly knownHosts: string;
|
|
1245
1234
|
}
|
|
1246
|
-
interface
|
|
1247
|
-
|
|
1248
|
-
|
|
1235
|
+
interface GitHttpsCredentialMaterial {
|
|
1236
|
+
/** HTTPS origin authorized by the credential-owning extension. */
|
|
1237
|
+
readonly origin: string;
|
|
1238
|
+
readonly username: string;
|
|
1239
|
+
readonly password: string;
|
|
1249
1240
|
}
|
|
1241
|
+
type RepositoryCredentialProvider = {
|
|
1242
|
+
readonly kind: "git_ssh";
|
|
1243
|
+
resolve(credentialRef: string): GitSshCredentialMaterial | null;
|
|
1244
|
+
} | {
|
|
1245
|
+
readonly kind: "git_https";
|
|
1246
|
+
resolve(credentialRef: string): GitHttpsCredentialMaterial | null;
|
|
1247
|
+
};
|
|
1250
1248
|
interface RepositoryCredentialRegistrar {
|
|
1251
1249
|
register(provider: RepositoryCredentialProvider): void;
|
|
1252
1250
|
}
|
|
1251
|
+
interface ProcessRuntimeCapabilities {
|
|
1252
|
+
/** Install repository-declared development tools with mise before accepting work. */
|
|
1253
|
+
readonly developmentTools?: boolean;
|
|
1254
|
+
/** Require a Docker CLI connected to a private or explicitly acknowledged daemon. */
|
|
1255
|
+
readonly docker?: boolean;
|
|
1256
|
+
}
|
|
1253
1257
|
interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
|
|
1254
1258
|
id: string;
|
|
1255
1259
|
displayName: string;
|
|
@@ -1268,6 +1272,18 @@ interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
|
|
|
1268
1272
|
paramsCodec: Codec<TParams>;
|
|
1269
1273
|
stateCodec: Codec<TState>;
|
|
1270
1274
|
initialState(params: TParams): TState;
|
|
1275
|
+
/** Process-owned runtime capabilities. All capabilities default to disabled. */
|
|
1276
|
+
runtime?: ProcessRuntimeCapabilities;
|
|
1277
|
+
/**
|
|
1278
|
+
* Server-only Kubernetes process-volume size, derived from extension configuration.
|
|
1279
|
+
* Explicit process storage_size wins; undefined uses the runner default.
|
|
1280
|
+
* Called before provisioning on worker starts. Must be synchronous and side-effect free;
|
|
1281
|
+
* repeated calls never resize or replace an existing volume.
|
|
1282
|
+
*/
|
|
1283
|
+
resolveStorageSize?(input: {
|
|
1284
|
+
params: TParams;
|
|
1285
|
+
projects: readonly ProcessProject[];
|
|
1286
|
+
}): string | undefined;
|
|
1271
1287
|
/** Runtime-only requirements; references are non-secret and remain in opaque params JSON. */
|
|
1272
1288
|
repositoryCredentials?(input: {
|
|
1273
1289
|
params: TParams;
|
|
@@ -1294,11 +1310,59 @@ interface ServerExtensionLogger {
|
|
|
1294
1310
|
warn?(payload: Record<string, unknown>, message?: string): void;
|
|
1295
1311
|
error?(payload: Record<string, unknown>, message?: string): void;
|
|
1296
1312
|
}
|
|
1313
|
+
interface TicketCreationDestinationSummary {
|
|
1314
|
+
/** Adapter-owned opaque identifier. Browsers must not construct or interpret it. */
|
|
1315
|
+
readonly id: string;
|
|
1316
|
+
readonly displayName: string;
|
|
1317
|
+
readonly group?: string;
|
|
1318
|
+
readonly description?: string;
|
|
1319
|
+
}
|
|
1320
|
+
interface TicketCreationDestinationList {
|
|
1321
|
+
readonly destinations: readonly TicketCreationDestinationSummary[];
|
|
1322
|
+
readonly warnings?: readonly string[];
|
|
1323
|
+
}
|
|
1324
|
+
interface TicketCreationDestinationSnapshot {
|
|
1325
|
+
readonly summary: TicketCreationDestinationSummary;
|
|
1326
|
+
/** Adapter-owned, JSON-serializable immutable destination state. */
|
|
1327
|
+
readonly data: unknown;
|
|
1328
|
+
/** Untrusted destination context included in the ticket agent prompt. */
|
|
1329
|
+
readonly agentContext?: string;
|
|
1330
|
+
}
|
|
1331
|
+
interface TicketCreationDestinationContext {
|
|
1332
|
+
readonly actor: Actor;
|
|
1333
|
+
}
|
|
1334
|
+
interface TicketCreationDestinationProvider {
|
|
1335
|
+
list(ctx: TicketCreationDestinationContext): Promise<TicketCreationDestinationList>;
|
|
1336
|
+
resolve(ctx: TicketCreationDestinationContext & {
|
|
1337
|
+
destinationId: string;
|
|
1338
|
+
}): Promise<TicketCreationDestinationSnapshot>;
|
|
1339
|
+
/** Rejects stale, renamed, transferred, or otherwise invalid snapshots. */
|
|
1340
|
+
validate(snapshot: TicketCreationDestinationSnapshot): Promise<void>;
|
|
1341
|
+
}
|
|
1342
|
+
interface TicketCreationCapability {
|
|
1343
|
+
readonly kind: "ticket_creation";
|
|
1344
|
+
readonly displayName: string;
|
|
1345
|
+
/** Extension-owned process launched by the generic derived-ticket route. */
|
|
1346
|
+
readonly processId: string;
|
|
1347
|
+
/** Entry turn selected when the derived process starts. */
|
|
1348
|
+
readonly startTurnId: TurnId;
|
|
1349
|
+
/** RFC 6901 JSON Pointer into the tool arguments. */
|
|
1350
|
+
readonly titlePath?: string;
|
|
1351
|
+
/** RFC 6901 JSON Pointer into the tool arguments. */
|
|
1352
|
+
readonly descriptionPath?: string;
|
|
1353
|
+
readonly destinations?: TicketCreationDestinationProvider;
|
|
1354
|
+
}
|
|
1355
|
+
interface TicketCreationReceipt {
|
|
1356
|
+
readonly externalId: string;
|
|
1357
|
+
readonly url: string;
|
|
1358
|
+
readonly result?: unknown;
|
|
1359
|
+
}
|
|
1297
1360
|
interface IntegrationToolExecutionContext {
|
|
1298
1361
|
readonly process: ProcessInstance;
|
|
1299
1362
|
readonly projects: readonly ProcessProject[];
|
|
1300
1363
|
readonly turn: ProcessTurnRecord;
|
|
1301
1364
|
readonly project: ProcessProject | null;
|
|
1365
|
+
readonly ticketDestination?: TicketCreationDestinationSnapshot;
|
|
1302
1366
|
/** Stable for a single Pi tool call, including reconnect/replay. */
|
|
1303
1367
|
readonly idempotencyKey: string;
|
|
1304
1368
|
/** Aborted when the worker stops waiting for this tool call. */
|
|
@@ -1308,6 +1372,8 @@ interface IntegrationToolDefinition<TArgs = Record<string, unknown>> {
|
|
|
1308
1372
|
readonly name: string;
|
|
1309
1373
|
readonly description: string;
|
|
1310
1374
|
readonly parameters: Record<string, unknown>;
|
|
1375
|
+
/** Sanitized discovery metadata; credentials and adapter configuration never belong here. */
|
|
1376
|
+
readonly capability?: TicketCreationCapability;
|
|
1311
1377
|
parse?(value: unknown): TArgs;
|
|
1312
1378
|
execute(ctx: IntegrationToolExecutionContext, args: TArgs): Promise<unknown>;
|
|
1313
1379
|
}
|
|
@@ -1341,4 +1407,4 @@ interface LeitwerkExtensionModule {
|
|
|
1341
1407
|
setupWorker?(api: WorkerExtensionAPI, config: unknown): void | Promise<void>;
|
|
1342
1408
|
}
|
|
1343
1409
|
|
|
1344
|
-
export { type
|
|
1410
|
+
export { type CapabilityCardinality as $, type AutomaticTurnDefinition as A, type PiBuiltInToolName as B, type Codec as C, type ProcessTurnEndSpec as D, type ExternalActionSource as E, type ProcessRuntimeTurnContext as F, type ProcessActionExecution as G, type HumanTurnDefinition as H, type ProcessActionEffect as I, type LeafOutcomeCaptureResult as J, type ProcessLeafOutcomeDefinition as K, type LauncherContext as L, type ExtensionProcessDefinition as M, type IntegrationToolExecutionContext as N, type OutcomeToolParameterSpec as O, type ProcessLauncherService as P, type ProcessTurnOutcomeEvent as Q, type RepositoryCredentialRegistrar as R, type ServerProcessAPI as S, type TurnResultMarkdownBehavior as T, type UiProcessAPI as U, type ServerProcessContext as V, type WorkerCompleteInput as W, type ProcessCleanupHandler as X, type WorkerTurnHandler as Y, type WorkerProcessAPI as Z, type BuiltinPiProviderReference as _, type ProcessLaunchPlan as a, type PiWorkerContribution as a$, type CatalogExtensionAPI as a0, type ConfiguredPiProviderReference as a1, type ConfiguredProviderModel as a2, type DefinedProcessInput as a3, type ErasedModelProviderDefinition as a4, type ExtensionLifecycleHook as a5, type ExternalEventDescription as a6, type ExternalSourceInputMode as a7, type ExternalSourceResolveContext as a8, type ExternalSourceTransition as a9, type OutcomeToolArrayItemType as aA, type OutcomeToolParameterType as aB, type OutcomeToolSpec as aC, PI_BUILT_IN_TOOL_NAMES as aD, type ParsedModelProviderConfig as aE, type ParsedProcessWatcherConfig as aF, type PiCustomMessageInput as aG, type PiCustomTool as aH, type PiCustomToolExecutionContext as aI, type PiEvent as aJ, type PiEventHandler as aK, type PiEventType as aL, type PiPromptOptions as aM, type PiRunDetails as aN, type PiServerAdapter as aO, type PiServerGenerateTextInput as aP, type PiServerReference as aQ, type PiSessionDiagnostic as aR, type PiSessionDiagnosticHandler as aS, type PiSessionDiagnosticLevel as aT, type PiTerminalAcknowledgementControl as aU, type PiTerminalAcknowledgementState as aV, type PiTreeEntry as aW, type PiTreeHandle as aX, type PiTreeNode as aY, type PiTurnExecutionResult as aZ, type PiUsageData as a_, FRAMEWORK_LLM_TOOL_NAMES as aa, type GitHttpsCredentialMaterial as ab, type GitSshCredentialMaterial as ac, type HumanTurnActionView as ad, type HumanTurnExternalTrigger as ae, type HumanTurnNotesField as af, type IntegrationToolDefinition as ag, type LaunchPreparationContext as ah, type LauncherModelProfileSummary as ai, type LauncherVisibility as aj, type LeafOutcomeCaptureContext as ak, type LeafOutcomeCapturedEvent as al, type LeitwerkExtensionManifest as am, type LeitwerkExtensionModule as an, type LlmTurnPreparationContext as ao, type ModelProviderCredentialDefinition as ap, type ModelProviderDefinition as aq, type ModelProviderModelsContext as ar, type ModelProviderSecretsContext as as, type ModelProviderServer as at, type ModelProviderSet as au, type ModelProviderSetEntry as av, type ModelProviderWorker as aw, type OutcomeRouteOptions as ax, type OutcomeRouteSpec as ay, type OutcomeToolArrayItemSpec as az, type ProcessWatcherPresentation as b, type ServerExtensionLogger as b$, type PiWorkerContributionContext as b0, type PiWorkerReference as b1, type PiWorkerSecretBag as b2, type PlanApprovedEvent as b3, type PlanRevisionRequestedEvent as b4, type ProcessActionBranchSelector as b5, type ProcessActionBranchSpec as b6, type ProcessActionExternalTrigger as b7, type ProcessActionPreviewDefinition as b8, type ProcessActionSchedulingDefinition as b9, type ProviderModelStatus as bA, type ProviderOptionChoice as bB, type ProviderOptionChoicesContext as bC, type ProviderOptionDefaultContext as bD, type ProviderOptionField as bE, type ProviderOptionValidationIssue as bF, type ProviderOptionsDefinition as bG, type ProviderOptionsResolution as bH, type ProviderOptionsResolutionInput as bI, type ProviderWorkerConfigContext as bJ, type ProviderWorkerConfigDefinition as bK, type ProviderWorkerConfigSchema as bL, type QuestionRequestedEvent as bM, RESERVED_INTEGRATION_TOOL_NAMES as bN, type RepositoryCredentialKind as bO, type RepositoryCredentialProject as bP, type RepositoryCredentialProvider as bQ, type RepositoryCredentialRequirement as bR, type ResolvedProcessLauncher as bS, type ResolvedProcessPiConfig as bT, type ReviewCompletedEvent as bU, type ReviewRequestedEvent as bV, SafeLaunchPreparationError as bW, type ServerExtensionAPI as bX, type ServerExtensionEventMap as bY, type ServerExtensionEventName as bZ, type ServerExtensionEventPayloadInputMap as b_, type ProcessActionSchedulingFixedTurnPreview as ba, type ProcessActionSchedulingPreview as bb, type ProcessActionSchedulingTriggerPreview as bc, type ProcessBroadcastEffect as bd, type ProcessContext as be, type ProcessCreatedEvent as bf, type ProcessCustomTool as bg, type ProcessLaunchPlanProcessInput as bh, type ProcessLaunchProjectConfig as bi, type ProcessLifecycleEffects as bj, type ProcessOutcomeBranchSelector as bk, type ProcessOutcomeBranchSpec as bl, type ProcessOutcomeEffect as bm, type ProcessPatchEffect as bn, type ProcessServerRuntimeContext as bo, type ProcessSnapshotContext as bp, type ProcessTitleSourceField as bq, type ProcessToolResult as br, type ProcessTurnBinding as bs, type ProcessUpdatedEvent as bt, type ProcessWatcherPresentationField as bu, type ProviderAvailability as bv, type ProviderCredentialStatus as bw, type ProviderJsonObject as bx, type ProviderJsonPrimitive as by, type ProviderJsonValue as bz, type ProcessLaunchConfig as c, type ServerTransitionEffect as c0, type ServerTransitionRequest as c1, type ServerTransitionRuntime as c2, TURN_COMPLETION_MODES as c3, TURN_CONTEXT_MODES as c4, type TicketCreationCapability as c5, type TicketCreationDestinationContext as c6, type TicketCreationDestinationList as c7, type TicketCreationDestinationProvider as c8, type TicketCreationDestinationSnapshot as c9, defineModelProviders as cA, definePiServerAdapter as cB, definePiWorker as cC, defineProcess as cD, defineProviderOptions as cE, defineWorkerConfig as cF, externalTurn as cG, filterProviderOptionsForDefinition as cH, findUiLauncherById as cI, getExternalActionArmingId as cJ, getExternalActionTransitionTrigger as cK, getExternalSourceTransitionId as cL, humanTurn as cM, llmTurn as cN, piServer as cO, piWorker as cP, resolveHumanTurnView as cQ, resolveProviderOptions as cR, routeTurnOutcomes as cS, type PlanSavedEvent as cT, type TicketCreationDestinationSummary as ca, type TicketCreationReceipt as cb, type TurnAcceptanceState as cc, type TurnBranchType as cd, type TurnCompletionMode as ce, type TurnContextMode as cf, type TurnDefinitionRecord as cg, type TurnFailedEvent as ch, type TurnOptions as ci, type TurnOutcomeEvent as cj, type TurnResult as ck, type TurnSemanticEntryRefKey as cl, type TurnStartedEvent as cm, type UiLauncherConfigResolution as cn, type UiLauncherDefinition as co, type UiLauncherResolutionResult as cp, type UiLauncherSummary as cq, type WorkerExtensionAPI as cr, type WorkerProcessContext as cs, type WorkerRunHandle as ct, automaticTurn as cu, builtinPiProvider as cv, configuredPiProvider as cw, createCapabilityToken as cx, credentialBasedModelStatuses as cy, defineModelProvider as cz, type LaunchPreparationCheck as d, type ProcessWatcherSource as e, type CapabilityToken as f, type EventBus as g, type ProcessHumanTurnExternalActionSpec as h, type ExternalSourceEffect as i, type ProcessOutcomeExecution as j, type ProcessEffectPlan as k, type ProcessToolOutcomeSpec as l, type ExternalTurnDefinition as m, type ExternalSourceEffectContext as n, type LlmTurnDefinition as o, type TurnDefinition as p, type ProcessLauncherAPI as q, type ProcessWatcherAPI as r, type ProcessActionDefinition as s, type ProcessLauncherDefinition as t, type ProcessWatcherDefinition as u, type ProcessDefinition as v, type ProcessPiConfig as w, type ProcessHumanTurnActionSpec as x, type HumanTurnOperatorAttention as y, type LlmModelPurpose as z };
|
package/dist/extension-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputKind, InputSource, LaunchModelConfigInput, ProcessCustomizableFields, ProcessInputTarget, ProcessInstance, ProcessLifecycleStatus, ProcessProject, ProcessSemanticEntryRefKey, ProcessTurnRecord, TurnId, TurnProgressReport } from "@leitwerk-dev/domain";
|
|
1
|
+
import type { Actor, InputKind, InputSource, LaunchModelConfigInput, ProcessCustomizableFields, ProcessInputTarget, ProcessInstance, ProcessLifecycleStatus, ProcessProject, ProcessSemanticEntryRefKey, ProcessTurnRecord, TurnId, TurnProgressReport } from "@leitwerk-dev/domain";
|
|
2
2
|
import type { WatcherPresentationField } from "@leitwerk-dev/protocol";
|
|
3
3
|
import type { CapabilityToken } from "./capabilities.js";
|
|
4
4
|
import type { FormDefinition } from "./form-contract.js";
|
|
@@ -71,6 +71,24 @@ export type UiLauncherConfigResolution<TParams = unknown> = {
|
|
|
71
71
|
ok: false;
|
|
72
72
|
errors: readonly LauncherValidationError[];
|
|
73
73
|
};
|
|
74
|
+
export interface LaunchPreparationContext<TParams = unknown> {
|
|
75
|
+
readonly signal: AbortSignal;
|
|
76
|
+
readonly launchConfig: ProcessLaunchConfig<TParams>;
|
|
77
|
+
readonly logger: {
|
|
78
|
+
info(message: string): void;
|
|
79
|
+
warn(message: string): void;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface LaunchPreparationCheck<TParams = unknown> {
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly label: string;
|
|
85
|
+
run(ctx: LaunchPreparationContext<TParams>): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
/** A launcher check may throw this error to expose bounded operator-safe remediation. */
|
|
88
|
+
export declare class SafeLaunchPreparationError extends Error {
|
|
89
|
+
readonly safeSummary: string;
|
|
90
|
+
constructor(message: string, safeSummary: string);
|
|
91
|
+
}
|
|
74
92
|
export interface UiLauncherDefinition<TParams = unknown> {
|
|
75
93
|
card: LauncherCardMetadata;
|
|
76
94
|
launchConfigSchema: LauncherSchemaDefinition;
|
|
@@ -81,6 +99,7 @@ export interface UiLauncherDefinition<TParams = unknown> {
|
|
|
81
99
|
* the complete input. Launchers override this only for values that must be rebuilt.
|
|
82
100
|
*/
|
|
83
101
|
resolveRelaunchInput?(previousInput: Record<string, unknown>, ctx: LauncherContext): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
102
|
+
preparationChecks?(input: Record<string, unknown>, launchConfig: ProcessLaunchConfig<TParams>): readonly LaunchPreparationCheck<TParams>[];
|
|
84
103
|
resolveLaunchConfig(input: Record<string, unknown>, ctx: LauncherContext): UiLauncherConfigResolution<TParams> | Promise<UiLauncherConfigResolution<TParams>>;
|
|
85
104
|
}
|
|
86
105
|
export type ProcessWatcherPresentationField = WatcherPresentationField;
|
|
@@ -108,6 +127,7 @@ export interface ProcessWatcherDefinition<TParams = unknown, TEvent = unknown, T
|
|
|
108
127
|
description: string;
|
|
109
128
|
source: ProcessWatcherSource<TConfig, TEvent>;
|
|
110
129
|
matches?(event: TEvent, ctx: LauncherContext): boolean | Promise<boolean>;
|
|
130
|
+
preparationChecks?(event: TEvent, launchConfig: ProcessLaunchConfig<TParams>): readonly LaunchPreparationCheck<TParams>[];
|
|
111
131
|
resolveLaunchConfig(event: TEvent, ctx: LauncherContext): ProcessLaunchConfig<TParams> | Promise<ProcessLaunchConfig<TParams>>;
|
|
112
132
|
}
|
|
113
133
|
export interface ProcessLauncherDefinition<TParams = unknown> {
|
|
@@ -157,6 +177,7 @@ export interface ProcessLauncherService {
|
|
|
157
177
|
resolveUiDefaults(launcherId: string, ctx?: LauncherContext): Promise<Record<string, unknown>>;
|
|
158
178
|
resolveUiOptions(launcherId: string, input: Record<string, unknown>, ctx?: LauncherContext): Promise<Record<string, readonly LauncherFieldOptionDefinition[]>>;
|
|
159
179
|
resolveUiRelaunchInput(launcherId: string, previousInput: Record<string, unknown>, ctx?: LauncherContext): Promise<Record<string, unknown>>;
|
|
180
|
+
resolvePreparationChecks?(launcherId: string, input: Record<string, unknown>, launchConfig: ProcessLaunchConfig): readonly LaunchPreparationCheck[];
|
|
160
181
|
resolveUiLauncher(launcherId: string, input: Record<string, unknown>, ctx?: LauncherContext): Promise<UiLauncherResolutionResult>;
|
|
161
182
|
}
|
|
162
183
|
/** Resolve a UI launcher summary by id, returning `null` when it is unknown. */
|
|
@@ -251,10 +272,17 @@ export interface ExternalSourceEffectContext<TParams = unknown, TState = unknown
|
|
|
251
272
|
readonly input: TInput;
|
|
252
273
|
}
|
|
253
274
|
export type ExternalSourceEffect<TParams = unknown, TState = unknown, TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>> = (ctx: ExternalSourceEffectContext<TParams, TState, TEvent, TInput>) => ProcessEffectPlan<TState> | Promise<ProcessEffectPlan<TState> | undefined> | undefined;
|
|
275
|
+
export interface ExternalEventDescription {
|
|
276
|
+
summary: string;
|
|
277
|
+
markdown?: string;
|
|
278
|
+
links?: import("@leitwerk-dev/domain").TurnProgressLink[];
|
|
279
|
+
}
|
|
254
280
|
export interface ExternalActionSource<TParams = unknown, TState = unknown, _TEvent = unknown, _TInput extends Record<string, unknown> = Record<string, unknown>> {
|
|
255
281
|
kind: string;
|
|
256
282
|
label?: string;
|
|
257
283
|
description?: string;
|
|
284
|
+
/** Pure description captured when the event is consumed. */
|
|
285
|
+
describeEvent?(event: _TEvent): ExternalEventDescription;
|
|
258
286
|
/**
|
|
259
287
|
* Extension-owned opaque config. Core may persist, hash, and display it, but must not
|
|
260
288
|
* interpret provider-specific fields.
|
|
@@ -309,15 +337,18 @@ export interface WorkerProcessContext<TParams = unknown, TState = unknown> exten
|
|
|
309
337
|
readonly turnResultMarkdownByProduct?: Readonly<Record<string, string>>;
|
|
310
338
|
/** Absolute workspace root for the current process instance, when available. */
|
|
311
339
|
readonly workspaceRoot?: string;
|
|
312
|
-
/**
|
|
340
|
+
/** Durable output produced by this LLM turn's preparation phase, when declared. */
|
|
341
|
+
readonly prepared?: unknown;
|
|
342
|
+
/** Invoke a server-owned integration tool authorized for this automatic turn or LLM preparation. */
|
|
313
343
|
callIntegrationTool?(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
314
|
-
/** Replace the durable operator-facing progress report for this
|
|
344
|
+
/** Replace the durable operator-facing progress report for this turn attempt. */
|
|
315
345
|
reportProgress?(report: TurnProgressReport): void;
|
|
316
346
|
}
|
|
317
347
|
export interface WorkerCompleteInput<TOutcome extends string = string> {
|
|
318
348
|
outcome: TOutcome;
|
|
319
349
|
params?: Record<string, unknown>;
|
|
320
350
|
markdown?: string | null;
|
|
351
|
+
resultSummary?: string;
|
|
321
352
|
}
|
|
322
353
|
export interface WorkerRunHandle<TParams = unknown, TState = unknown> {
|
|
323
354
|
readonly ctx: WorkerProcessContext<TParams, TState>;
|
|
@@ -350,7 +381,7 @@ export interface ProcessWatcherAPI<TParams = unknown> {
|
|
|
350
381
|
export interface ProcessTurnBinding<TTurn = TurnDefinition> {
|
|
351
382
|
definition: TTurn;
|
|
352
383
|
}
|
|
353
|
-
export type RepositoryCredentialKind = "git_ssh";
|
|
384
|
+
export type RepositoryCredentialKind = "git_ssh" | "git_https";
|
|
354
385
|
/** Non-secret, code-defined repository authentication request. */
|
|
355
386
|
export interface RepositoryCredentialRequirement {
|
|
356
387
|
readonly projectKey: string;
|
|
@@ -369,13 +400,28 @@ export interface GitSshCredentialMaterial {
|
|
|
369
400
|
readonly privateKey: string;
|
|
370
401
|
readonly knownHosts: string;
|
|
371
402
|
}
|
|
372
|
-
export interface
|
|
373
|
-
|
|
374
|
-
|
|
403
|
+
export interface GitHttpsCredentialMaterial {
|
|
404
|
+
/** HTTPS origin authorized by the credential-owning extension. */
|
|
405
|
+
readonly origin: string;
|
|
406
|
+
readonly username: string;
|
|
407
|
+
readonly password: string;
|
|
375
408
|
}
|
|
409
|
+
export type RepositoryCredentialProvider = {
|
|
410
|
+
readonly kind: "git_ssh";
|
|
411
|
+
resolve(credentialRef: string): GitSshCredentialMaterial | null;
|
|
412
|
+
} | {
|
|
413
|
+
readonly kind: "git_https";
|
|
414
|
+
resolve(credentialRef: string): GitHttpsCredentialMaterial | null;
|
|
415
|
+
};
|
|
376
416
|
export interface RepositoryCredentialRegistrar {
|
|
377
417
|
register(provider: RepositoryCredentialProvider): void;
|
|
378
418
|
}
|
|
419
|
+
export interface ProcessRuntimeCapabilities {
|
|
420
|
+
/** Install repository-declared development tools with mise before accepting work. */
|
|
421
|
+
readonly developmentTools?: boolean;
|
|
422
|
+
/** Require a Docker CLI connected to a private or explicitly acknowledged daemon. */
|
|
423
|
+
readonly docker?: boolean;
|
|
424
|
+
}
|
|
379
425
|
export interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
|
|
380
426
|
id: string;
|
|
381
427
|
displayName: string;
|
|
@@ -394,6 +440,18 @@ export interface ExtensionProcessDefinition<TParams = unknown, TState = unknown>
|
|
|
394
440
|
paramsCodec: Codec<TParams>;
|
|
395
441
|
stateCodec: Codec<TState>;
|
|
396
442
|
initialState(params: TParams): TState;
|
|
443
|
+
/** Process-owned runtime capabilities. All capabilities default to disabled. */
|
|
444
|
+
runtime?: ProcessRuntimeCapabilities;
|
|
445
|
+
/**
|
|
446
|
+
* Server-only Kubernetes process-volume size, derived from extension configuration.
|
|
447
|
+
* Explicit process storage_size wins; undefined uses the runner default.
|
|
448
|
+
* Called before provisioning on worker starts. Must be synchronous and side-effect free;
|
|
449
|
+
* repeated calls never resize or replace an existing volume.
|
|
450
|
+
*/
|
|
451
|
+
resolveStorageSize?(input: {
|
|
452
|
+
params: TParams;
|
|
453
|
+
projects: readonly ProcessProject[];
|
|
454
|
+
}): string | undefined;
|
|
397
455
|
/** Runtime-only requirements; references are non-secret and remain in opaque params JSON. */
|
|
398
456
|
repositoryCredentials?(input: {
|
|
399
457
|
params: TParams;
|
|
@@ -420,11 +478,59 @@ export interface ServerExtensionLogger {
|
|
|
420
478
|
warn?(payload: Record<string, unknown>, message?: string): void;
|
|
421
479
|
error?(payload: Record<string, unknown>, message?: string): void;
|
|
422
480
|
}
|
|
481
|
+
export interface TicketCreationDestinationSummary {
|
|
482
|
+
/** Adapter-owned opaque identifier. Browsers must not construct or interpret it. */
|
|
483
|
+
readonly id: string;
|
|
484
|
+
readonly displayName: string;
|
|
485
|
+
readonly group?: string;
|
|
486
|
+
readonly description?: string;
|
|
487
|
+
}
|
|
488
|
+
export interface TicketCreationDestinationList {
|
|
489
|
+
readonly destinations: readonly TicketCreationDestinationSummary[];
|
|
490
|
+
readonly warnings?: readonly string[];
|
|
491
|
+
}
|
|
492
|
+
export interface TicketCreationDestinationSnapshot {
|
|
493
|
+
readonly summary: TicketCreationDestinationSummary;
|
|
494
|
+
/** Adapter-owned, JSON-serializable immutable destination state. */
|
|
495
|
+
readonly data: unknown;
|
|
496
|
+
/** Untrusted destination context included in the ticket agent prompt. */
|
|
497
|
+
readonly agentContext?: string;
|
|
498
|
+
}
|
|
499
|
+
export interface TicketCreationDestinationContext {
|
|
500
|
+
readonly actor: Actor;
|
|
501
|
+
}
|
|
502
|
+
export interface TicketCreationDestinationProvider {
|
|
503
|
+
list(ctx: TicketCreationDestinationContext): Promise<TicketCreationDestinationList>;
|
|
504
|
+
resolve(ctx: TicketCreationDestinationContext & {
|
|
505
|
+
destinationId: string;
|
|
506
|
+
}): Promise<TicketCreationDestinationSnapshot>;
|
|
507
|
+
/** Rejects stale, renamed, transferred, or otherwise invalid snapshots. */
|
|
508
|
+
validate(snapshot: TicketCreationDestinationSnapshot): Promise<void>;
|
|
509
|
+
}
|
|
510
|
+
export interface TicketCreationCapability {
|
|
511
|
+
readonly kind: "ticket_creation";
|
|
512
|
+
readonly displayName: string;
|
|
513
|
+
/** Extension-owned process launched by the generic derived-ticket route. */
|
|
514
|
+
readonly processId: string;
|
|
515
|
+
/** Entry turn selected when the derived process starts. */
|
|
516
|
+
readonly startTurnId: TurnId;
|
|
517
|
+
/** RFC 6901 JSON Pointer into the tool arguments. */
|
|
518
|
+
readonly titlePath?: string;
|
|
519
|
+
/** RFC 6901 JSON Pointer into the tool arguments. */
|
|
520
|
+
readonly descriptionPath?: string;
|
|
521
|
+
readonly destinations?: TicketCreationDestinationProvider;
|
|
522
|
+
}
|
|
523
|
+
export interface TicketCreationReceipt {
|
|
524
|
+
readonly externalId: string;
|
|
525
|
+
readonly url: string;
|
|
526
|
+
readonly result?: unknown;
|
|
527
|
+
}
|
|
423
528
|
export interface IntegrationToolExecutionContext {
|
|
424
529
|
readonly process: ProcessInstance;
|
|
425
530
|
readonly projects: readonly ProcessProject[];
|
|
426
531
|
readonly turn: ProcessTurnRecord;
|
|
427
532
|
readonly project: ProcessProject | null;
|
|
533
|
+
readonly ticketDestination?: TicketCreationDestinationSnapshot;
|
|
428
534
|
/** Stable for a single Pi tool call, including reconnect/replay. */
|
|
429
535
|
readonly idempotencyKey: string;
|
|
430
536
|
/** Aborted when the worker stops waiting for this tool call. */
|
|
@@ -434,6 +540,8 @@ export interface IntegrationToolDefinition<TArgs = Record<string, unknown>> {
|
|
|
434
540
|
readonly name: string;
|
|
435
541
|
readonly description: string;
|
|
436
542
|
readonly parameters: Record<string, unknown>;
|
|
543
|
+
/** Sanitized discovery metadata; credentials and adapter configuration never belong here. */
|
|
544
|
+
readonly capability?: TicketCreationCapability;
|
|
437
545
|
parse?(value: unknown): TArgs;
|
|
438
546
|
execute(ctx: IntegrationToolExecutionContext, args: TArgs): Promise<unknown>;
|
|
439
547
|
}
|