@boboddy/sdk 0.1.15-alpha → 0.1.16-alpha
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z, type ZodType } from "zod";
|
|
2
2
|
import type { TypedStepDefinitionSpec } from "../steps/define-step";
|
|
3
3
|
import { type AdvanceCtx, type AdvanceResult } from "../advancement-policies/fluent-rules";
|
|
4
|
-
import { type AnyBinding, type PipelineDefinitionSpec, type PipelineStepConfig, type StepOutputBinding, type StepSignalBinding, type WorkItemBinding } from "./define-pipeline";
|
|
4
|
+
import { type AnyBinding, type LiteralBinding, type PipelineDefinitionSpec, type PipelineStepConfig, type StepOutputBinding, type StepSignalBinding, type WorkItemBinding } from "./define-pipeline";
|
|
5
5
|
import { type InputAccessor } from "./input-accessor";
|
|
6
6
|
type AnyTypedStep = TypedStepDefinitionSpec<any, any, any, any>;
|
|
7
7
|
export type StepConfig = {
|
|
@@ -15,6 +15,9 @@ type LastStep<T extends ReadonlyArray<AnyTypedStep>> = T extends readonly [
|
|
|
15
15
|
type LastSignalKeys<T extends ReadonlyArray<AnyTypedStep>> = LastStep<T> extends AnyTypedStep ? LastStep<T>["__signalKeys"] : never;
|
|
16
16
|
type LastSignalTypeMap<T extends ReadonlyArray<AnyTypedStep>> = LastStep<T> extends AnyTypedStep ? LastStep<T>["__signalTypeMap"] : Record<string, unknown>;
|
|
17
17
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
18
|
+
type Prettify<T> = {
|
|
19
|
+
[K in keyof T]: T[K];
|
|
20
|
+
} & {};
|
|
18
21
|
type RequiredInputKeys<T extends object> = {
|
|
19
22
|
[K in keyof T & string]-?: undefined extends T[K] ? never : K;
|
|
20
23
|
}[keyof T & string];
|
|
@@ -29,20 +32,39 @@ type StepInputMapping<S extends AnyTypedStep> = IsAny<S["__inputType"]> extends
|
|
|
29
32
|
export type WorkItemAccessor = {
|
|
30
33
|
readonly title: WorkItemBinding;
|
|
31
34
|
readonly description: WorkItemBinding;
|
|
35
|
+
readonly field: (fieldName: string) => WorkItemBinding;
|
|
32
36
|
};
|
|
37
|
+
type WithWorkItemFields<T> = {
|
|
38
|
+
workItemTitle: string;
|
|
39
|
+
workItemDescription: string | null;
|
|
40
|
+
} & T;
|
|
33
41
|
export type StepInputCtx<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> = {
|
|
34
|
-
input: InputAccessor<TInput["_output"]
|
|
35
|
-
workItem: WorkItemAccessor;
|
|
42
|
+
input: InputAccessor<Prettify<WithWorkItemFields<TInput["_output"]>>>;
|
|
36
43
|
signal: <S extends ElementOf<TSteps>>(step: S, key: S["__signalKeys"]) => StepSignalBinding;
|
|
37
44
|
output: <S extends ElementOf<TSteps>>(step: S) => StepOutputBinding;
|
|
45
|
+
literal: (value: unknown) => LiteralBinding;
|
|
38
46
|
};
|
|
47
|
+
type ReservedPipelineInputKeys = "workItemTitle" | "workItemDescription";
|
|
48
|
+
type NoReservedKeys<T extends ZodType> = T extends {
|
|
49
|
+
shape: infer Shape;
|
|
50
|
+
} ? [string & keyof Shape & ReservedPipelineInputKeys] extends [never] ? T : never : T;
|
|
39
51
|
export type PipelineMeta<TInput extends ZodType = z.ZodUnknown> = {
|
|
40
52
|
key: string;
|
|
41
53
|
name: string;
|
|
42
54
|
description?: string;
|
|
43
55
|
version?: number;
|
|
44
56
|
status?: "draft" | "active";
|
|
45
|
-
|
|
57
|
+
additionalPipelineInput?: {
|
|
58
|
+
schema: NoReservedKeys<TInput>;
|
|
59
|
+
bindings: (ctx: {
|
|
60
|
+
workItem: WorkItemAccessor;
|
|
61
|
+
literal: (value: unknown) => LiteralBinding;
|
|
62
|
+
}) => TInput["_output"] extends object ? {
|
|
63
|
+
[K in RequiredInputKeys<TInput["_output"]>]: AnyBinding;
|
|
64
|
+
} & {
|
|
65
|
+
[K in OptionalInputKeys<TInput["_output"]>]?: AnyBinding;
|
|
66
|
+
} : Partial<Record<string, AnyBinding>>;
|
|
67
|
+
};
|
|
46
68
|
};
|
|
47
69
|
/**
|
|
48
70
|
* Returned by `.step()`. Requires `.advance()` before the pipeline can
|
|
@@ -50,10 +72,11 @@ export type PipelineMeta<TInput extends ZodType = z.ZodUnknown> = {
|
|
|
50
72
|
*/
|
|
51
73
|
export declare class PipelineStepAdvancementBuilder<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> {
|
|
52
74
|
protected readonly inputSchema: TInput;
|
|
53
|
-
protected readonly meta: Omit<PipelineMeta<TInput>, "
|
|
75
|
+
protected readonly meta: Omit<PipelineMeta<TInput>, "additionalPipelineInput">;
|
|
54
76
|
protected readonly steps: PipelineStepConfig[];
|
|
77
|
+
protected readonly pipelineInputBindings: Record<string, AnyBinding>;
|
|
55
78
|
readonly __steps: TSteps;
|
|
56
|
-
constructor(inputSchema: TInput, meta: Omit<PipelineMeta<TInput>, "
|
|
79
|
+
constructor(inputSchema: TInput, meta: Omit<PipelineMeta<TInput>, "additionalPipelineInput">, steps: PipelineStepConfig[], pipelineInputBindings?: Record<string, AnyBinding>);
|
|
57
80
|
advance(callback: (ctx: AdvanceCtx<LastSignalKeys<TSteps>, LastSignalTypeMap<TSteps>>) => AdvanceResult<LastSignalKeys<TSteps>>): PipelineStepBuilder<TInput, TSteps>;
|
|
58
81
|
}
|
|
59
82
|
/**
|
|
@@ -62,10 +85,11 @@ export declare class PipelineStepAdvancementBuilder<TInput extends ZodType, TSte
|
|
|
62
85
|
*/
|
|
63
86
|
export declare class PipelineStepBuilder<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> {
|
|
64
87
|
protected readonly inputSchema: TInput;
|
|
65
|
-
protected readonly meta: Omit<PipelineMeta<TInput>, "
|
|
88
|
+
protected readonly meta: Omit<PipelineMeta<TInput>, "additionalPipelineInput">;
|
|
66
89
|
protected readonly steps: PipelineStepConfig[];
|
|
90
|
+
protected readonly pipelineInputBindings: Record<string, AnyBinding>;
|
|
67
91
|
readonly __steps: TSteps;
|
|
68
|
-
constructor(inputSchema: TInput, meta: Omit<PipelineMeta<TInput>, "
|
|
92
|
+
constructor(inputSchema: TInput, meta: Omit<PipelineMeta<TInput>, "additionalPipelineInput">, steps: PipelineStepConfig[], pipelineInputBindings?: Record<string, AnyBinding>);
|
|
69
93
|
step<S extends AnyTypedStep>(step: S, mapper: (ctx: StepInputCtx<TInput, TSteps>) => StepInputMapping<S>, configFn?: (config: StepConfig) => void): PipelineStepAdvancementBuilder<TInput, [...TSteps, S]>;
|
|
70
94
|
build(): PipelineDefinitionSpec;
|
|
71
95
|
}
|
|
@@ -78,8 +102,10 @@ export declare class PipelineBuilder<TInput extends ZodType> {
|
|
|
78
102
|
private readonly inputSchema;
|
|
79
103
|
private readonly meta;
|
|
80
104
|
private readonly steps;
|
|
105
|
+
private readonly pipelineInputBindings;
|
|
81
106
|
constructor(meta: PipelineMeta<TInput>);
|
|
82
107
|
step<S extends AnyTypedStep>(step: S, mapper: (ctx: StepInputCtx<TInput, []>) => StepInputMapping<S>, configFn?: (config: StepConfig) => void): PipelineStepAdvancementBuilder<TInput, [S]>;
|
|
83
108
|
}
|
|
109
|
+
export declare function literal(value: unknown): LiteralBinding;
|
|
84
110
|
export declare function pipeline<TInput extends ZodType = z.ZodUnknown>(meta: PipelineMeta<TInput>): PipelineBuilder<TInput>;
|
|
85
111
|
export {};
|
|
@@ -10,7 +10,7 @@ export type PipelineInputBinding = {
|
|
|
10
10
|
};
|
|
11
11
|
export type WorkItemBinding = {
|
|
12
12
|
source: "work_item";
|
|
13
|
-
field:
|
|
13
|
+
field: string;
|
|
14
14
|
};
|
|
15
15
|
export type StepSignalBinding = {
|
|
16
16
|
source: "step_signal";
|
|
@@ -21,7 +21,11 @@ export type StepOutputBinding = {
|
|
|
21
21
|
source: "step_output";
|
|
22
22
|
step: AnyTypedStep;
|
|
23
23
|
};
|
|
24
|
-
export type
|
|
24
|
+
export type LiteralBinding = {
|
|
25
|
+
source: "literal";
|
|
26
|
+
value: unknown;
|
|
27
|
+
};
|
|
28
|
+
export type AnyBinding = PipelineInputBinding | WorkItemBinding | StepSignalBinding | StepOutputBinding | LiteralBinding;
|
|
25
29
|
export type PipelineStepConfig<TStep extends AnyTypedStep = AnyTypedStep> = {
|
|
26
30
|
step: TStep;
|
|
27
31
|
/** Maps each step input field to an input source. Extra keys are ignored at runtime. */
|
|
@@ -44,7 +48,7 @@ type SerializedBinding = {
|
|
|
44
48
|
path: string;
|
|
45
49
|
} | {
|
|
46
50
|
source: "work_item";
|
|
47
|
-
field:
|
|
51
|
+
field: string;
|
|
48
52
|
} | {
|
|
49
53
|
source: "step_signal";
|
|
50
54
|
stepKey: string;
|
|
@@ -52,6 +56,9 @@ type SerializedBinding = {
|
|
|
52
56
|
} | {
|
|
53
57
|
source: "step_output";
|
|
54
58
|
stepKey: string;
|
|
59
|
+
} | {
|
|
60
|
+
source: "literal";
|
|
61
|
+
value: unknown;
|
|
55
62
|
};
|
|
56
63
|
export type PipelineDefinitionSpec = {
|
|
57
64
|
key: string;
|
|
@@ -81,5 +88,6 @@ export type DefinePipelineInput = {
|
|
|
81
88
|
status?: "draft" | "active";
|
|
82
89
|
input?: ZodType | null;
|
|
83
90
|
steps: ReadonlyArray<PipelineStepConfig>;
|
|
91
|
+
pipelineInputBindings?: Record<string, AnyBinding>;
|
|
84
92
|
};
|
|
85
93
|
export declare function buildPipelineSpec(config: DefinePipelineInput): PipelineDefinitionSpec;
|
|
@@ -14449,6 +14449,9 @@ function serializeBinding(binding) {
|
|
|
14449
14449
|
signalKey: binding.signalKey
|
|
14450
14450
|
};
|
|
14451
14451
|
}
|
|
14452
|
+
if (binding.source === "literal") {
|
|
14453
|
+
return { source: "literal", value: binding.value };
|
|
14454
|
+
}
|
|
14452
14455
|
return { source: "step_output", stepKey: binding.step.key };
|
|
14453
14456
|
}
|
|
14454
14457
|
function buildPipelineSpec(config2) {
|
|
@@ -14476,16 +14479,31 @@ function buildPipelineSpec(config2) {
|
|
|
14476
14479
|
status: config2.status ?? "active",
|
|
14477
14480
|
inputSchemaJson,
|
|
14478
14481
|
_stepDefinitions: [...stepDefMap.values()],
|
|
14479
|
-
steps: steps.map((stepConfig, index) =>
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14482
|
+
steps: steps.map((stepConfig, index) => {
|
|
14483
|
+
const autoBindings = {
|
|
14484
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
14485
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
14486
|
+
};
|
|
14487
|
+
const pipelineBindings = {};
|
|
14488
|
+
for (const [key, binding] of Object.entries(config2.pipelineInputBindings ?? {})) {
|
|
14489
|
+
pipelineBindings[key] = serializeBinding(binding);
|
|
14490
|
+
}
|
|
14491
|
+
const explicitStepBindings = Object.fromEntries(Object.entries(stepConfig.input ?? {}).filter((entry) => entry[1] !== undefined).map(([key, binding]) => [key, serializeBinding(binding)]));
|
|
14492
|
+
return {
|
|
14493
|
+
stepKey: stepConfig.step.key,
|
|
14494
|
+
stepName: stepConfig.step.name,
|
|
14495
|
+
stepDescription: stepConfig.step.description,
|
|
14496
|
+
position: index + 1,
|
|
14497
|
+
inputBindingsJson: {
|
|
14498
|
+
...autoBindings,
|
|
14499
|
+
...pipelineBindings,
|
|
14500
|
+
...explicitStepBindings
|
|
14501
|
+
},
|
|
14502
|
+
timeoutSeconds: stepConfig.timeout ?? null,
|
|
14503
|
+
advancementPolicyDefinition: serializeAdvancementPolicy(stepConfig.advancement),
|
|
14504
|
+
computedSignalDefinitions: extractInlineComputedSignals(stepConfig.advancement)
|
|
14505
|
+
};
|
|
14506
|
+
})
|
|
14489
14507
|
};
|
|
14490
14508
|
}
|
|
14491
14509
|
// src/definitions/advancement-policies/fluent-rules.ts
|
|
@@ -14630,10 +14648,12 @@ class PipelineStepAdvancementBuilder {
|
|
|
14630
14648
|
inputSchema;
|
|
14631
14649
|
meta;
|
|
14632
14650
|
steps;
|
|
14633
|
-
|
|
14651
|
+
pipelineInputBindings;
|
|
14652
|
+
constructor(inputSchema, meta3, steps, pipelineInputBindings = {}) {
|
|
14634
14653
|
this.inputSchema = inputSchema;
|
|
14635
14654
|
this.meta = meta3;
|
|
14636
14655
|
this.steps = steps;
|
|
14656
|
+
this.pipelineInputBindings = pipelineInputBindings;
|
|
14637
14657
|
}
|
|
14638
14658
|
advance(callback) {
|
|
14639
14659
|
const last = this.steps.at(-1);
|
|
@@ -14644,7 +14664,7 @@ class PipelineStepAdvancementBuilder {
|
|
|
14644
14664
|
...result.rules !== undefined ? { rules: result.rules } : {}
|
|
14645
14665
|
};
|
|
14646
14666
|
last.advancement = policy;
|
|
14647
|
-
return new PipelineStepBuilder(this.inputSchema, this.meta, this.steps);
|
|
14667
|
+
return new PipelineStepBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
14648
14668
|
}
|
|
14649
14669
|
}
|
|
14650
14670
|
|
|
@@ -14652,10 +14672,12 @@ class PipelineStepBuilder {
|
|
|
14652
14672
|
inputSchema;
|
|
14653
14673
|
meta;
|
|
14654
14674
|
steps;
|
|
14655
|
-
|
|
14675
|
+
pipelineInputBindings;
|
|
14676
|
+
constructor(inputSchema, meta3, steps, pipelineInputBindings = {}) {
|
|
14656
14677
|
this.inputSchema = inputSchema;
|
|
14657
14678
|
this.meta = meta3;
|
|
14658
14679
|
this.steps = steps;
|
|
14680
|
+
this.pipelineInputBindings = pipelineInputBindings;
|
|
14659
14681
|
}
|
|
14660
14682
|
step(step, mapper, configFn) {
|
|
14661
14683
|
const ctx = makeStepInputCtx(this.inputSchema);
|
|
@@ -14669,7 +14691,7 @@ class PipelineStepBuilder {
|
|
|
14669
14691
|
stepConfig.timeout = cfg.timeout;
|
|
14670
14692
|
}
|
|
14671
14693
|
this.steps.push(stepConfig);
|
|
14672
|
-
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps);
|
|
14694
|
+
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
14673
14695
|
}
|
|
14674
14696
|
build() {
|
|
14675
14697
|
const config2 = {
|
|
@@ -14679,7 +14701,8 @@ class PipelineStepBuilder {
|
|
|
14679
14701
|
version: this.meta.version,
|
|
14680
14702
|
status: this.meta.status,
|
|
14681
14703
|
input: this.inputSchema,
|
|
14682
|
-
steps: this.steps
|
|
14704
|
+
steps: this.steps,
|
|
14705
|
+
pipelineInputBindings: this.pipelineInputBindings
|
|
14683
14706
|
};
|
|
14684
14707
|
return buildPipelineSpec(config2);
|
|
14685
14708
|
}
|
|
@@ -14689,10 +14712,27 @@ class PipelineBuilder {
|
|
|
14689
14712
|
inputSchema;
|
|
14690
14713
|
meta;
|
|
14691
14714
|
steps = [];
|
|
14715
|
+
pipelineInputBindings;
|
|
14692
14716
|
constructor(meta3) {
|
|
14693
|
-
const {
|
|
14694
|
-
this.inputSchema =
|
|
14717
|
+
const { additionalPipelineInput, ...rest } = meta3;
|
|
14718
|
+
this.inputSchema = additionalPipelineInput?.schema ?? exports_external.unknown();
|
|
14695
14719
|
this.meta = rest;
|
|
14720
|
+
if (additionalPipelineInput) {
|
|
14721
|
+
const raw = additionalPipelineInput.bindings({
|
|
14722
|
+
workItem: WORK_ITEM_ACCESSOR,
|
|
14723
|
+
literal: literal2
|
|
14724
|
+
});
|
|
14725
|
+
if (additionalPipelineInput.schema instanceof exports_external.ZodObject) {
|
|
14726
|
+
const validKeys = new Set(Object.keys(additionalPipelineInput.schema.shape));
|
|
14727
|
+
const unknown2 = Object.keys(raw).filter((k) => !validKeys.has(k));
|
|
14728
|
+
if (unknown2.length > 0) {
|
|
14729
|
+
throw new Error(`additionalPipelineInput.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((k) => `"${k}"`).join(", ")}`);
|
|
14730
|
+
}
|
|
14731
|
+
}
|
|
14732
|
+
this.pipelineInputBindings = normalizeInputMapping(raw) ?? {};
|
|
14733
|
+
} else {
|
|
14734
|
+
this.pipelineInputBindings = {};
|
|
14735
|
+
}
|
|
14696
14736
|
}
|
|
14697
14737
|
step(step, mapper, configFn) {
|
|
14698
14738
|
const ctx = makeStepInputCtx(this.inputSchema);
|
|
@@ -14706,7 +14746,7 @@ class PipelineBuilder {
|
|
|
14706
14746
|
stepConfig.timeout = cfg.timeout;
|
|
14707
14747
|
}
|
|
14708
14748
|
this.steps.push(stepConfig);
|
|
14709
|
-
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps);
|
|
14749
|
+
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
14710
14750
|
}
|
|
14711
14751
|
}
|
|
14712
14752
|
var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
@@ -14714,20 +14754,37 @@ var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
|
14714
14754
|
description: Object.freeze({
|
|
14715
14755
|
source: "work_item",
|
|
14716
14756
|
field: "description"
|
|
14717
|
-
})
|
|
14757
|
+
}),
|
|
14758
|
+
field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
|
|
14718
14759
|
});
|
|
14760
|
+
var WORK_ITEM_FIELD_BINDINGS = {
|
|
14761
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
14762
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
14763
|
+
};
|
|
14719
14764
|
function makeStepInputCtx(inputSchema) {
|
|
14765
|
+
const baseAccessor = createInputAccessor(inputSchema);
|
|
14766
|
+
const input = new Proxy(baseAccessor, {
|
|
14767
|
+
get(target, prop) {
|
|
14768
|
+
if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
|
|
14769
|
+
return WORK_ITEM_FIELD_BINDINGS[prop];
|
|
14770
|
+
}
|
|
14771
|
+
return target[prop];
|
|
14772
|
+
}
|
|
14773
|
+
});
|
|
14720
14774
|
return {
|
|
14721
|
-
input
|
|
14722
|
-
workItem: WORK_ITEM_ACCESSOR,
|
|
14775
|
+
input,
|
|
14723
14776
|
signal(step, key) {
|
|
14724
14777
|
return { source: "step_signal", step, signalKey: key };
|
|
14725
14778
|
},
|
|
14726
14779
|
output(step) {
|
|
14727
14780
|
return { source: "step_output", step };
|
|
14728
|
-
}
|
|
14781
|
+
},
|
|
14782
|
+
literal: literal2
|
|
14729
14783
|
};
|
|
14730
14784
|
}
|
|
14785
|
+
function literal2(value) {
|
|
14786
|
+
return { source: "literal", value };
|
|
14787
|
+
}
|
|
14731
14788
|
function normalizeInputMapping(mapping) {
|
|
14732
14789
|
if (!mapping)
|
|
14733
14790
|
return;
|
|
@@ -16115,6 +16172,7 @@ var buildPipelineDefinitionsClient = (pipelineDefinitions) => {
|
|
|
16115
16172
|
export {
|
|
16116
16173
|
pipeline,
|
|
16117
16174
|
materializeAccessor,
|
|
16175
|
+
literal2 as literal,
|
|
16118
16176
|
isInputAccessor,
|
|
16119
16177
|
createPipelineDefinitionsClient,
|
|
16120
16178
|
createInputAccessor,
|
package/dist/index.js
CHANGED
|
@@ -16033,6 +16033,9 @@ function serializeBinding(binding) {
|
|
|
16033
16033
|
signalKey: binding.signalKey
|
|
16034
16034
|
};
|
|
16035
16035
|
}
|
|
16036
|
+
if (binding.source === "literal") {
|
|
16037
|
+
return { source: "literal", value: binding.value };
|
|
16038
|
+
}
|
|
16036
16039
|
return { source: "step_output", stepKey: binding.step.key };
|
|
16037
16040
|
}
|
|
16038
16041
|
function buildPipelineSpec(config2) {
|
|
@@ -16060,16 +16063,31 @@ function buildPipelineSpec(config2) {
|
|
|
16060
16063
|
status: config2.status ?? "active",
|
|
16061
16064
|
inputSchemaJson,
|
|
16062
16065
|
_stepDefinitions: [...stepDefMap.values()],
|
|
16063
|
-
steps: steps.map((stepConfig, index) =>
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16066
|
+
steps: steps.map((stepConfig, index) => {
|
|
16067
|
+
const autoBindings = {
|
|
16068
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
16069
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
16070
|
+
};
|
|
16071
|
+
const pipelineBindings = {};
|
|
16072
|
+
for (const [key, binding] of Object.entries(config2.pipelineInputBindings ?? {})) {
|
|
16073
|
+
pipelineBindings[key] = serializeBinding(binding);
|
|
16074
|
+
}
|
|
16075
|
+
const explicitStepBindings = Object.fromEntries(Object.entries(stepConfig.input ?? {}).filter((entry) => entry[1] !== undefined).map(([key, binding]) => [key, serializeBinding(binding)]));
|
|
16076
|
+
return {
|
|
16077
|
+
stepKey: stepConfig.step.key,
|
|
16078
|
+
stepName: stepConfig.step.name,
|
|
16079
|
+
stepDescription: stepConfig.step.description,
|
|
16080
|
+
position: index + 1,
|
|
16081
|
+
inputBindingsJson: {
|
|
16082
|
+
...autoBindings,
|
|
16083
|
+
...pipelineBindings,
|
|
16084
|
+
...explicitStepBindings
|
|
16085
|
+
},
|
|
16086
|
+
timeoutSeconds: stepConfig.timeout ?? null,
|
|
16087
|
+
advancementPolicyDefinition: serializeAdvancementPolicy(stepConfig.advancement),
|
|
16088
|
+
computedSignalDefinitions: extractInlineComputedSignals(stepConfig.advancement)
|
|
16089
|
+
};
|
|
16090
|
+
})
|
|
16073
16091
|
};
|
|
16074
16092
|
}
|
|
16075
16093
|
// src/definitions/advancement-policies/fluent-rules.ts
|
|
@@ -16214,10 +16232,12 @@ class PipelineStepAdvancementBuilder {
|
|
|
16214
16232
|
inputSchema;
|
|
16215
16233
|
meta;
|
|
16216
16234
|
steps;
|
|
16217
|
-
|
|
16235
|
+
pipelineInputBindings;
|
|
16236
|
+
constructor(inputSchema, meta3, steps, pipelineInputBindings = {}) {
|
|
16218
16237
|
this.inputSchema = inputSchema;
|
|
16219
16238
|
this.meta = meta3;
|
|
16220
16239
|
this.steps = steps;
|
|
16240
|
+
this.pipelineInputBindings = pipelineInputBindings;
|
|
16221
16241
|
}
|
|
16222
16242
|
advance(callback) {
|
|
16223
16243
|
const last = this.steps.at(-1);
|
|
@@ -16228,7 +16248,7 @@ class PipelineStepAdvancementBuilder {
|
|
|
16228
16248
|
...result.rules !== undefined ? { rules: result.rules } : {}
|
|
16229
16249
|
};
|
|
16230
16250
|
last.advancement = policy;
|
|
16231
|
-
return new PipelineStepBuilder(this.inputSchema, this.meta, this.steps);
|
|
16251
|
+
return new PipelineStepBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
16232
16252
|
}
|
|
16233
16253
|
}
|
|
16234
16254
|
|
|
@@ -16236,10 +16256,12 @@ class PipelineStepBuilder {
|
|
|
16236
16256
|
inputSchema;
|
|
16237
16257
|
meta;
|
|
16238
16258
|
steps;
|
|
16239
|
-
|
|
16259
|
+
pipelineInputBindings;
|
|
16260
|
+
constructor(inputSchema, meta3, steps, pipelineInputBindings = {}) {
|
|
16240
16261
|
this.inputSchema = inputSchema;
|
|
16241
16262
|
this.meta = meta3;
|
|
16242
16263
|
this.steps = steps;
|
|
16264
|
+
this.pipelineInputBindings = pipelineInputBindings;
|
|
16243
16265
|
}
|
|
16244
16266
|
step(step, mapper, configFn) {
|
|
16245
16267
|
const ctx = makeStepInputCtx(this.inputSchema);
|
|
@@ -16253,7 +16275,7 @@ class PipelineStepBuilder {
|
|
|
16253
16275
|
stepConfig.timeout = cfg.timeout;
|
|
16254
16276
|
}
|
|
16255
16277
|
this.steps.push(stepConfig);
|
|
16256
|
-
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps);
|
|
16278
|
+
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
16257
16279
|
}
|
|
16258
16280
|
build() {
|
|
16259
16281
|
const config2 = {
|
|
@@ -16263,7 +16285,8 @@ class PipelineStepBuilder {
|
|
|
16263
16285
|
version: this.meta.version,
|
|
16264
16286
|
status: this.meta.status,
|
|
16265
16287
|
input: this.inputSchema,
|
|
16266
|
-
steps: this.steps
|
|
16288
|
+
steps: this.steps,
|
|
16289
|
+
pipelineInputBindings: this.pipelineInputBindings
|
|
16267
16290
|
};
|
|
16268
16291
|
return buildPipelineSpec(config2);
|
|
16269
16292
|
}
|
|
@@ -16273,10 +16296,27 @@ class PipelineBuilder {
|
|
|
16273
16296
|
inputSchema;
|
|
16274
16297
|
meta;
|
|
16275
16298
|
steps = [];
|
|
16299
|
+
pipelineInputBindings;
|
|
16276
16300
|
constructor(meta3) {
|
|
16277
|
-
const {
|
|
16278
|
-
this.inputSchema =
|
|
16301
|
+
const { additionalPipelineInput, ...rest } = meta3;
|
|
16302
|
+
this.inputSchema = additionalPipelineInput?.schema ?? exports_external.unknown();
|
|
16279
16303
|
this.meta = rest;
|
|
16304
|
+
if (additionalPipelineInput) {
|
|
16305
|
+
const raw = additionalPipelineInput.bindings({
|
|
16306
|
+
workItem: WORK_ITEM_ACCESSOR,
|
|
16307
|
+
literal: literal2
|
|
16308
|
+
});
|
|
16309
|
+
if (additionalPipelineInput.schema instanceof exports_external.ZodObject) {
|
|
16310
|
+
const validKeys = new Set(Object.keys(additionalPipelineInput.schema.shape));
|
|
16311
|
+
const unknown2 = Object.keys(raw).filter((k) => !validKeys.has(k));
|
|
16312
|
+
if (unknown2.length > 0) {
|
|
16313
|
+
throw new Error(`additionalPipelineInput.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((k) => `"${k}"`).join(", ")}`);
|
|
16314
|
+
}
|
|
16315
|
+
}
|
|
16316
|
+
this.pipelineInputBindings = normalizeInputMapping(raw) ?? {};
|
|
16317
|
+
} else {
|
|
16318
|
+
this.pipelineInputBindings = {};
|
|
16319
|
+
}
|
|
16280
16320
|
}
|
|
16281
16321
|
step(step, mapper, configFn) {
|
|
16282
16322
|
const ctx = makeStepInputCtx(this.inputSchema);
|
|
@@ -16290,7 +16330,7 @@ class PipelineBuilder {
|
|
|
16290
16330
|
stepConfig.timeout = cfg.timeout;
|
|
16291
16331
|
}
|
|
16292
16332
|
this.steps.push(stepConfig);
|
|
16293
|
-
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps);
|
|
16333
|
+
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
16294
16334
|
}
|
|
16295
16335
|
}
|
|
16296
16336
|
var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
@@ -16298,20 +16338,37 @@ var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
|
16298
16338
|
description: Object.freeze({
|
|
16299
16339
|
source: "work_item",
|
|
16300
16340
|
field: "description"
|
|
16301
|
-
})
|
|
16341
|
+
}),
|
|
16342
|
+
field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
|
|
16302
16343
|
});
|
|
16344
|
+
var WORK_ITEM_FIELD_BINDINGS = {
|
|
16345
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
16346
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
16347
|
+
};
|
|
16303
16348
|
function makeStepInputCtx(inputSchema) {
|
|
16349
|
+
const baseAccessor = createInputAccessor(inputSchema);
|
|
16350
|
+
const input = new Proxy(baseAccessor, {
|
|
16351
|
+
get(target, prop) {
|
|
16352
|
+
if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
|
|
16353
|
+
return WORK_ITEM_FIELD_BINDINGS[prop];
|
|
16354
|
+
}
|
|
16355
|
+
return target[prop];
|
|
16356
|
+
}
|
|
16357
|
+
});
|
|
16304
16358
|
return {
|
|
16305
|
-
input
|
|
16306
|
-
workItem: WORK_ITEM_ACCESSOR,
|
|
16359
|
+
input,
|
|
16307
16360
|
signal(step, key) {
|
|
16308
16361
|
return { source: "step_signal", step, signalKey: key };
|
|
16309
16362
|
},
|
|
16310
16363
|
output(step) {
|
|
16311
16364
|
return { source: "step_output", step };
|
|
16312
|
-
}
|
|
16365
|
+
},
|
|
16366
|
+
literal: literal2
|
|
16313
16367
|
};
|
|
16314
16368
|
}
|
|
16369
|
+
function literal2(value) {
|
|
16370
|
+
return { source: "literal", value };
|
|
16371
|
+
}
|
|
16315
16372
|
function normalizeInputMapping(mapping) {
|
|
16316
16373
|
if (!mapping)
|
|
16317
16374
|
return;
|
|
@@ -16719,6 +16776,7 @@ export {
|
|
|
16719
16776
|
openCodeMcpLocalConfigSchema,
|
|
16720
16777
|
openCodeMcpEnabledOverrideSchema,
|
|
16721
16778
|
materializeAccessor,
|
|
16779
|
+
literal2 as literal,
|
|
16722
16780
|
isInputAccessor,
|
|
16723
16781
|
defineStep,
|
|
16724
16782
|
createStepExecutionPlaneClient,
|
package/dist/push/index.js
CHANGED
|
@@ -15963,6 +15963,9 @@ function serializeBinding(binding) {
|
|
|
15963
15963
|
signalKey: binding.signalKey
|
|
15964
15964
|
};
|
|
15965
15965
|
}
|
|
15966
|
+
if (binding.source === "literal") {
|
|
15967
|
+
return { source: "literal", value: binding.value };
|
|
15968
|
+
}
|
|
15966
15969
|
return { source: "step_output", stepKey: binding.step.key };
|
|
15967
15970
|
}
|
|
15968
15971
|
function buildPipelineSpec(config2) {
|
|
@@ -15990,16 +15993,31 @@ function buildPipelineSpec(config2) {
|
|
|
15990
15993
|
status: config2.status ?? "active",
|
|
15991
15994
|
inputSchemaJson,
|
|
15992
15995
|
_stepDefinitions: [...stepDefMap.values()],
|
|
15993
|
-
steps: steps.map((stepConfig, index) =>
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
15996
|
+
steps: steps.map((stepConfig, index) => {
|
|
15997
|
+
const autoBindings = {
|
|
15998
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
15999
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
16000
|
+
};
|
|
16001
|
+
const pipelineBindings = {};
|
|
16002
|
+
for (const [key, binding] of Object.entries(config2.pipelineInputBindings ?? {})) {
|
|
16003
|
+
pipelineBindings[key] = serializeBinding(binding);
|
|
16004
|
+
}
|
|
16005
|
+
const explicitStepBindings = Object.fromEntries(Object.entries(stepConfig.input ?? {}).filter((entry) => entry[1] !== undefined).map(([key, binding]) => [key, serializeBinding(binding)]));
|
|
16006
|
+
return {
|
|
16007
|
+
stepKey: stepConfig.step.key,
|
|
16008
|
+
stepName: stepConfig.step.name,
|
|
16009
|
+
stepDescription: stepConfig.step.description,
|
|
16010
|
+
position: index + 1,
|
|
16011
|
+
inputBindingsJson: {
|
|
16012
|
+
...autoBindings,
|
|
16013
|
+
...pipelineBindings,
|
|
16014
|
+
...explicitStepBindings
|
|
16015
|
+
},
|
|
16016
|
+
timeoutSeconds: stepConfig.timeout ?? null,
|
|
16017
|
+
advancementPolicyDefinition: serializeAdvancementPolicy(stepConfig.advancement),
|
|
16018
|
+
computedSignalDefinitions: extractInlineComputedSignals(stepConfig.advancement)
|
|
16019
|
+
};
|
|
16020
|
+
})
|
|
16003
16021
|
};
|
|
16004
16022
|
}
|
|
16005
16023
|
// src/definitions/advancement-policies/fluent-rules.ts
|
|
@@ -16144,10 +16162,12 @@ class PipelineStepAdvancementBuilder {
|
|
|
16144
16162
|
inputSchema;
|
|
16145
16163
|
meta;
|
|
16146
16164
|
steps;
|
|
16147
|
-
|
|
16165
|
+
pipelineInputBindings;
|
|
16166
|
+
constructor(inputSchema, meta3, steps, pipelineInputBindings = {}) {
|
|
16148
16167
|
this.inputSchema = inputSchema;
|
|
16149
16168
|
this.meta = meta3;
|
|
16150
16169
|
this.steps = steps;
|
|
16170
|
+
this.pipelineInputBindings = pipelineInputBindings;
|
|
16151
16171
|
}
|
|
16152
16172
|
advance(callback) {
|
|
16153
16173
|
const last = this.steps.at(-1);
|
|
@@ -16158,7 +16178,7 @@ class PipelineStepAdvancementBuilder {
|
|
|
16158
16178
|
...result.rules !== undefined ? { rules: result.rules } : {}
|
|
16159
16179
|
};
|
|
16160
16180
|
last.advancement = policy;
|
|
16161
|
-
return new PipelineStepBuilder(this.inputSchema, this.meta, this.steps);
|
|
16181
|
+
return new PipelineStepBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
16162
16182
|
}
|
|
16163
16183
|
}
|
|
16164
16184
|
|
|
@@ -16166,10 +16186,12 @@ class PipelineStepBuilder {
|
|
|
16166
16186
|
inputSchema;
|
|
16167
16187
|
meta;
|
|
16168
16188
|
steps;
|
|
16169
|
-
|
|
16189
|
+
pipelineInputBindings;
|
|
16190
|
+
constructor(inputSchema, meta3, steps, pipelineInputBindings = {}) {
|
|
16170
16191
|
this.inputSchema = inputSchema;
|
|
16171
16192
|
this.meta = meta3;
|
|
16172
16193
|
this.steps = steps;
|
|
16194
|
+
this.pipelineInputBindings = pipelineInputBindings;
|
|
16173
16195
|
}
|
|
16174
16196
|
step(step, mapper, configFn) {
|
|
16175
16197
|
const ctx = makeStepInputCtx(this.inputSchema);
|
|
@@ -16183,7 +16205,7 @@ class PipelineStepBuilder {
|
|
|
16183
16205
|
stepConfig.timeout = cfg.timeout;
|
|
16184
16206
|
}
|
|
16185
16207
|
this.steps.push(stepConfig);
|
|
16186
|
-
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps);
|
|
16208
|
+
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
16187
16209
|
}
|
|
16188
16210
|
build() {
|
|
16189
16211
|
const config2 = {
|
|
@@ -16193,7 +16215,8 @@ class PipelineStepBuilder {
|
|
|
16193
16215
|
version: this.meta.version,
|
|
16194
16216
|
status: this.meta.status,
|
|
16195
16217
|
input: this.inputSchema,
|
|
16196
|
-
steps: this.steps
|
|
16218
|
+
steps: this.steps,
|
|
16219
|
+
pipelineInputBindings: this.pipelineInputBindings
|
|
16197
16220
|
};
|
|
16198
16221
|
return buildPipelineSpec(config2);
|
|
16199
16222
|
}
|
|
@@ -16203,10 +16226,27 @@ class PipelineBuilder {
|
|
|
16203
16226
|
inputSchema;
|
|
16204
16227
|
meta;
|
|
16205
16228
|
steps = [];
|
|
16229
|
+
pipelineInputBindings;
|
|
16206
16230
|
constructor(meta3) {
|
|
16207
|
-
const {
|
|
16208
|
-
this.inputSchema =
|
|
16231
|
+
const { additionalPipelineInput, ...rest } = meta3;
|
|
16232
|
+
this.inputSchema = additionalPipelineInput?.schema ?? exports_external.unknown();
|
|
16209
16233
|
this.meta = rest;
|
|
16234
|
+
if (additionalPipelineInput) {
|
|
16235
|
+
const raw = additionalPipelineInput.bindings({
|
|
16236
|
+
workItem: WORK_ITEM_ACCESSOR,
|
|
16237
|
+
literal: literal2
|
|
16238
|
+
});
|
|
16239
|
+
if (additionalPipelineInput.schema instanceof exports_external.ZodObject) {
|
|
16240
|
+
const validKeys = new Set(Object.keys(additionalPipelineInput.schema.shape));
|
|
16241
|
+
const unknown2 = Object.keys(raw).filter((k) => !validKeys.has(k));
|
|
16242
|
+
if (unknown2.length > 0) {
|
|
16243
|
+
throw new Error(`additionalPipelineInput.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((k) => `"${k}"`).join(", ")}`);
|
|
16244
|
+
}
|
|
16245
|
+
}
|
|
16246
|
+
this.pipelineInputBindings = normalizeInputMapping(raw) ?? {};
|
|
16247
|
+
} else {
|
|
16248
|
+
this.pipelineInputBindings = {};
|
|
16249
|
+
}
|
|
16210
16250
|
}
|
|
16211
16251
|
step(step, mapper, configFn) {
|
|
16212
16252
|
const ctx = makeStepInputCtx(this.inputSchema);
|
|
@@ -16220,7 +16260,7 @@ class PipelineBuilder {
|
|
|
16220
16260
|
stepConfig.timeout = cfg.timeout;
|
|
16221
16261
|
}
|
|
16222
16262
|
this.steps.push(stepConfig);
|
|
16223
|
-
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps);
|
|
16263
|
+
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings);
|
|
16224
16264
|
}
|
|
16225
16265
|
}
|
|
16226
16266
|
var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
@@ -16228,20 +16268,37 @@ var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
|
16228
16268
|
description: Object.freeze({
|
|
16229
16269
|
source: "work_item",
|
|
16230
16270
|
field: "description"
|
|
16231
|
-
})
|
|
16271
|
+
}),
|
|
16272
|
+
field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
|
|
16232
16273
|
});
|
|
16274
|
+
var WORK_ITEM_FIELD_BINDINGS = {
|
|
16275
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
16276
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
16277
|
+
};
|
|
16233
16278
|
function makeStepInputCtx(inputSchema) {
|
|
16279
|
+
const baseAccessor = createInputAccessor(inputSchema);
|
|
16280
|
+
const input = new Proxy(baseAccessor, {
|
|
16281
|
+
get(target, prop) {
|
|
16282
|
+
if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
|
|
16283
|
+
return WORK_ITEM_FIELD_BINDINGS[prop];
|
|
16284
|
+
}
|
|
16285
|
+
return target[prop];
|
|
16286
|
+
}
|
|
16287
|
+
});
|
|
16234
16288
|
return {
|
|
16235
|
-
input
|
|
16236
|
-
workItem: WORK_ITEM_ACCESSOR,
|
|
16289
|
+
input,
|
|
16237
16290
|
signal(step, key) {
|
|
16238
16291
|
return { source: "step_signal", step, signalKey: key };
|
|
16239
16292
|
},
|
|
16240
16293
|
output(step) {
|
|
16241
16294
|
return { source: "step_output", step };
|
|
16242
|
-
}
|
|
16295
|
+
},
|
|
16296
|
+
literal: literal2
|
|
16243
16297
|
};
|
|
16244
16298
|
}
|
|
16299
|
+
function literal2(value) {
|
|
16300
|
+
return { source: "literal", value };
|
|
16301
|
+
}
|
|
16245
16302
|
function normalizeInputMapping(mapping) {
|
|
16246
16303
|
if (!mapping)
|
|
16247
16304
|
return;
|