agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

View File

@@ -0,0 +1,135 @@
import type { Construct } from 'constructs';
import * as iam from '../../../aws-iam';
import type { IFunction } from '../../../aws-lambda';
import * as sfn from '../../../aws-stepfunctions';
interface CallAwsServiceCrossRegionOptions {
/**
* The AWS service to call in AWS SDK for JavaScript v3 format.
*
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/
* @example 's3'
*/
readonly service: string;
/**
* The API action to call.
*
* Use camelCase.
*/
readonly action: string;
/**
* Parameters for the API action call in AWS SDK for JavaScript v3 format.
*
* @default - no parameters
*/
readonly parameters?: {
[key: string]: any;
};
/**
* The resources for the IAM statement that will be added to the Lambda
* function role's policy to allow the state machine to make the API call.
*/
readonly iamResources: string[];
/**
* The action for the IAM statement that will be added to the Lambda
* function role's policy to allow the state machine to make the API call.
*
* By default the action for this IAM statement will be `service:action`.
*
* Use in the case where the IAM action name does not match with the
* API service/action name, e.g. `s3:ListBuckets` requires `s3:ListAllMyBuckets`.
*
* @default - service:action
*/
readonly iamAction?: string;
/**
* Additional IAM statements that will be added to the state machine
* role's policy.
*
* Use in the case where the call requires more than a single statement to
* be executed, e.g. `rekognition:detectLabels` requires also S3 permissions
* to read the object on which it must act.
*
* @default - no additional statements are added
*/
readonly additionalIamStatements?: iam.PolicyStatement[];
/**
* The AWS region to call this AWS API for.
* @example 'us-east-1'
*/
readonly region: string;
/**
* The AWS API endpoint.
*
* Be aware that if you set this to a value from the Step Functions state
* (e.g. `sfn.JsonPath.stringAt('$.endpoint')`), the endpoint is controlled
* at runtime by whoever can start the state machine execution. This could
* allow them to redirect the authenticated AWS API call to a server they
* control, allowing them to intercept and replay that specific API call.
*
* @default Do not override API endpoint.
*/
readonly endpoint?: string;
/**
* Whether to retry on the backend Lambda service exceptions.
*
* This handles `Lambda.ServiceException`, `Lambda.AWSLambdaException`,
* `Lambda.SdkClientException`, and `Lambda.ClientExecutionTimeoutException`
* with an interval of 2 seconds, a back-off rate
* of 2 and 6 maximum attempts.
*
* @see https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html
*
* @default true
*/
readonly retryOnServiceExceptions?: boolean;
}
/**
* Properties for calling an AWS service's API action using JSONPath from your
* state machine across regions.
*/
export interface CallAwsServiceCrossRegionJsonPathProps extends sfn.TaskStateJsonPathBaseProps, CallAwsServiceCrossRegionOptions {
}
/**
* Properties for calling an AWS service's API action using JSONata from your
* state machine across regions.
*/
export interface CallAwsServiceCrossRegionJsonataProps extends sfn.TaskStateJsonataBaseProps, CallAwsServiceCrossRegionOptions {
}
/**
* Properties for calling an AWS service's API action from your
* state machine across regions.
*/
export interface CallAwsServiceCrossRegionProps extends sfn.TaskStateBaseProps, CallAwsServiceCrossRegionOptions {
}
/**
* A Step Functions task to call an AWS service API across regions.
*
* This task creates a Lambda function to call cross-region AWS API and invokes it.
*/
export declare class CallAwsServiceCrossRegion extends sfn.TaskStateBase {
private readonly props;
/**
* A Step Functions task using JSONPath to call an AWS service API across regions.
*
* This task creates a Lambda function to call cross-region AWS API and invokes it.
*/
static jsonPath(scope: Construct, id: string, props: CallAwsServiceCrossRegionJsonPathProps): CallAwsServiceCrossRegion;
/**
* A Step Functions task using JSONata to call an AWS service API across regions.
*
* This task creates a Lambda function to call cross-region AWS API and invokes it.
*/
static jsonata(scope: Construct, id: string, props: CallAwsServiceCrossRegionJsonataProps): CallAwsServiceCrossRegion;
protected readonly taskMetrics?: sfn.TaskMetricsConfig;
protected readonly taskPolicies?: iam.PolicyStatement[];
protected readonly lambdaFunction: IFunction;
private readonly integrationPattern;
constructor(scope: Construct, id: string, props: CallAwsServiceCrossRegionProps);
/**
* Provides the Lambda Invoke service integration task configuration
*
* @internal
*/
protected _renderTask(topLevelQueryLanguage?: sfn.QueryLanguage): any;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import type * as lambda from '../../../aws-lambda';
import type * as sfn from '../../../aws-stepfunctions';

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InvokeFunction=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var iam=()=>{var tmp=require("../../../aws-iam");return iam=()=>tmp,tmp};class InvokeFunction{lambdaFunction;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_stepfunctions_tasks.InvokeFunction",version:"2.252.0"};constructor(lambdaFunction,props={}){this.lambdaFunction=lambdaFunction,this.props=props}bind(_task){return{resourceArn:this.lambdaFunction.functionArn,policyStatements:[new(iam()).PolicyStatement({resources:this.lambdaFunction.resourceArnsForGrantInvoke,actions:["lambda:InvokeFunction"]})],metricPrefixSingular:"LambdaFunction",metricPrefixPlural:"LambdaFunctions",metricDimensions:{LambdaFunctionArn:this.lambdaFunction.functionArn},parameters:this.props.payload}}}exports.InvokeFunction=InvokeFunction;

View File

@@ -0,0 +1,134 @@
import type { Construct } from 'constructs';
import * as iam from '../../../aws-iam';
import type * as lambda from '../../../aws-lambda';
import * as sfn from '../../../aws-stepfunctions';
interface LambdaInvokeBaseProps {
/**
* Lambda function to invoke
*/
readonly lambdaFunction: lambda.IFunction;
/**
* The JSON that will be supplied as input to the Lambda function
*
* @default - The state input (JSONata: '{% $states.input %}', JSONPath: '$')
*/
readonly payload?: sfn.TaskInput;
/**
* Invocation type of the Lambda function
*
* @default InvocationType.REQUEST_RESPONSE
*/
readonly invocationType?: LambdaInvocationType;
/**
* Up to 3583 bytes of base64-encoded data about the invoking client
* to pass to the function.
*
* @default - No context
*/
readonly clientContext?: string;
/**
* Version or alias to invoke a published version of the function
*
* You only need to supply this if you want the version of the Lambda Function to depend
* on data in the state machine state. If not, you can pass the appropriate Alias or Version object
* directly as the `lambdaFunction` argument.
*
* @default - Version or alias inherent to the `lambdaFunction` object.
* @deprecated pass a Version or Alias object as lambdaFunction instead
*/
readonly qualifier?: string;
/**
* Invoke the Lambda in a way that only returns the payload response without additional metadata.
*
* The `payloadResponseOnly` property cannot be used if `integrationPattern`, `invocationType`,
* `clientContext`, or `qualifier` are specified.
* It always uses the REQUEST_RESPONSE behavior.
*
* @default false
*/
readonly payloadResponseOnly?: boolean;
/**
* Whether to retry on Lambda service exceptions.
*
* This handles `Lambda.ServiceException`, `Lambda.AWSLambdaException`,
* `Lambda.SdkClientException`, and `Lambda.ClientExecutionTimeoutException`
* with an interval of 2 seconds, a back-off rate
* of 2 and 6 maximum attempts.
*
* @see https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html
*
* @default true
*/
readonly retryOnServiceExceptions?: boolean;
}
/**
* Properties for invoking a Lambda function with LambdaInvoke using JsonPath
*/
export interface LambdaInvokeJsonPathProps extends LambdaInvokeBaseProps, sfn.TaskStateJsonPathBaseProps {
}
/**
* Properties for invoking a Lambda function with LambdaInvoke using Jsonata
*/
export interface LambdaInvokeJsonataProps extends LambdaInvokeBaseProps, sfn.TaskStateJsonataBaseProps {
}
/**
* Properties for invoking a Lambda function with LambdaInvoke
*/
export interface LambdaInvokeProps extends LambdaInvokeBaseProps, sfn.TaskStateBaseProps {
}
/**
* Invoke a Lambda function as a Task
*
* @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-lambda.html
*/
export declare class LambdaInvoke extends sfn.TaskStateBase {
private readonly props;
/**
* Invoke a Lambda function as a Task using JSONPath
*
* @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-lambda.html
*/
static jsonPath(scope: Construct, id: string, props: LambdaInvokeJsonPathProps): LambdaInvoke;
/**
* Invoke a Lambda function as a Task using JSONata
*
* @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-lambda.html
*/
static jsonata(scope: Construct, id: string, props: LambdaInvokeJsonataProps): LambdaInvoke;
private static readonly SUPPORTED_INTEGRATION_PATTERNS;
protected readonly taskMetrics?: sfn.TaskMetricsConfig;
protected readonly taskPolicies?: iam.PolicyStatement[];
private readonly integrationPattern;
constructor(scope: Construct, id: string, props: LambdaInvokeProps);
/**
* Provides the Lambda Invoke service integration task configuration
*/
/**
* @internal
*/
protected _renderTask(topLevelQueryLanguage?: sfn.QueryLanguage): any;
}
/**
* Invocation type of a Lambda
*/
export declare enum LambdaInvocationType {
/**
* Invoke the function synchronously.
*
* Keep the connection open until the function returns a response or times out.
* The API response includes the function response and additional data.
*/
REQUEST_RESPONSE = "RequestResponse",
/**
* Invoke the function asynchronously.
*
* Send events that fail multiple times to the function's dead-letter queue (if it's configured).
* The API response only includes a status code.
*/
EVENT = "Event",
/**
* Validate parameter values and verify that the user or role has permission to invoke the function.
*/
DRY_RUN = "DryRun"
}
export {};

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LambdaInvocationType=exports.LambdaInvoke=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var iam=()=>{var tmp=require("../../../aws-iam");return iam=()=>tmp,tmp},sfn=()=>{var tmp=require("../../../aws-stepfunctions");return sfn=()=>tmp,tmp},cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},task_utils_1=()=>{var tmp=require("../private/task-utils");return task_utils_1=()=>tmp,tmp};class LambdaInvoke extends sfn().TaskStateBase{props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke",version:"2.252.0"};static jsonPath(scope,id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_tasks_LambdaInvokeJsonPathProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.jsonPath),error}return new LambdaInvoke(scope,id,props)}static jsonata(scope,id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_tasks_LambdaInvokeJsonataProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.jsonata),error}return new LambdaInvoke(scope,id,{...props,queryLanguage:sfn().QueryLanguage.JSONATA})}static SUPPORTED_INTEGRATION_PATTERNS=[sfn().IntegrationPattern.REQUEST_RESPONSE,sfn().IntegrationPattern.WAIT_FOR_TASK_TOKEN];taskMetrics;taskPolicies;integrationPattern;constructor(scope,id,props){super(scope,id,props),this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_tasks_LambdaInvokeProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,LambdaInvoke),error}if(this.integrationPattern=props.integrationPattern??sfn().IntegrationPattern.REQUEST_RESPONSE,(0,task_utils_1().validatePatternSupported)(this.integrationPattern,LambdaInvoke.SUPPORTED_INTEGRATION_PATTERNS),this.integrationPattern===sfn().IntegrationPattern.WAIT_FOR_TASK_TOKEN&&!sfn().FieldUtils.containsTaskToken(props.payload))throw new(core_1()).ValidationError((0,literal_string_1().lit)`IsRequiredTaskTokenRequired`,"Task Token is required in `payload` for callback. Use JsonPath.taskToken to set the token.",this);if(props.payloadResponseOnly&&(props.integrationPattern||props.invocationType||props.clientContext||props.qualifier))throw new(core_1()).ValidationError((0,literal_string_1().lit)`PayloadResponseOnlyRestriction`,"The 'payloadResponseOnly' property cannot be used if 'integrationPattern', 'invocationType', 'clientContext', or 'qualifier' are specified.",this);this.taskMetrics={metricPrefixSingular:"LambdaFunction",metricPrefixPlural:"LambdaFunctions",metricDimensions:{LambdaFunctionArn:this.props.lambdaFunction.functionArn,...this.props.qualifier&&{Qualifier:this.props.qualifier}}},this.taskPolicies=[new(iam()).PolicyStatement({resources:this.props.lambdaFunction.resourceArnsForGrantInvoke,actions:["lambda:InvokeFunction"]})],(props.retryOnServiceExceptions??!0)&&this.addRetry({errors:["Lambda.ClientExecutionTimeoutException","Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],interval:cdk().Duration.seconds(2),maxAttempts:6,backoffRate:2})}_renderTask(topLevelQueryLanguage){const queryLanguage=sfn()._getActualQueryLanguage(topLevelQueryLanguage,this.props.queryLanguage),[resource,paramOrArg]=this.props.payloadResponseOnly?[this.props.lambdaFunction.functionArn,this.props.payload?.value]:[(0,task_utils_1().integrationResourceArn)("lambda","invoke",this.integrationPattern),{FunctionName:this.props.lambdaFunction.functionArn,Payload:this.props.payload?.value??(queryLanguage===sfn().QueryLanguage.JSONATA?"{% $states.input %}":sfn().TaskInput.fromJsonPathAt("$").value),InvocationType:this.props.invocationType,ClientContext:this.props.clientContext,Qualifier:this.props.qualifier}];return{Resource:resource,...this._renderParametersOrArguments(paramOrArg,queryLanguage)}}}exports.LambdaInvoke=LambdaInvoke;var LambdaInvocationType;(function(LambdaInvocationType2){LambdaInvocationType2.REQUEST_RESPONSE="RequestResponse",LambdaInvocationType2.EVENT="Event",LambdaInvocationType2.DRY_RUN="DryRun"})(LambdaInvocationType||(exports.LambdaInvocationType=LambdaInvocationType={}));

View File

@@ -0,0 +1,2 @@
import type * as lambda from '../../../aws-lambda';
import * as sfn from '../../../aws-stepfunctions';

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InvocationType=exports.RunLambdaTask=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var iam=()=>{var tmp=require("../../../aws-iam");return iam=()=>tmp,tmp},sfn=()=>{var tmp=require("../../../aws-stepfunctions");return sfn=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},resource_arn_suffix_1=()=>{var tmp=require("../resource-arn-suffix");return resource_arn_suffix_1=()=>tmp,tmp};class RunLambdaTask{lambdaFunction;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_stepfunctions_tasks.RunLambdaTask",version:"2.252.0"};integrationPattern;constructor(lambdaFunction,props={}){if(this.lambdaFunction=lambdaFunction,this.props=props,this.integrationPattern=props.integrationPattern||sfn().ServiceIntegrationPattern.FIRE_AND_FORGET,![sfn().ServiceIntegrationPattern.FIRE_AND_FORGET,sfn().ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN].includes(this.integrationPattern))throw new(core_1()).ValidationError((0,literal_string_1().lit)`InvalidServiceIntegrationPattern`,`Invalid Service Integration Pattern: ${this.integrationPattern} is not supported to call Lambda.`,lambdaFunction);if(this.integrationPattern===sfn().ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN&&!sfn().FieldUtils.containsTaskToken(props.payload))throw new(core_1()).ValidationError((0,literal_string_1().lit)`TaskTokenMissingPayloadPass`,"Task Token is missing in payload (pass JsonPath.taskToken somewhere in payload)",lambdaFunction)}bind(_task){return{resourceArn:(0,resource_arn_suffix_1().getResourceArn)("lambda","invoke",this.integrationPattern),policyStatements:[new(iam()).PolicyStatement({resources:this.lambdaFunction.resourceArnsForGrantInvoke,actions:["lambda:InvokeFunction"]})],metricPrefixSingular:"LambdaFunction",metricPrefixPlural:"LambdaFunctions",metricDimensions:{LambdaFunctionArn:this.lambdaFunction.functionArn},parameters:{FunctionName:this.lambdaFunction.functionName,Payload:this.props.payload?this.props.payload.value:sfn().TaskInput.fromJsonPathAt("$").value,InvocationType:this.props.invocationType,ClientContext:this.props.clientContext,Qualifier:this.props.qualifier}}}}exports.RunLambdaTask=RunLambdaTask;var InvocationType;(function(InvocationType2){InvocationType2.REQUEST_RESPONSE="RequestResponse",InvocationType2.EVENT="Event",InvocationType2.DRY_RUN="DryRun"})(InvocationType||(exports.InvocationType=InvocationType={}));