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,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.services.s3.assets"
},
"dotnet": {
"namespace": "Amazon.CDK.AWS.S3.Assets"
},
"python": {
"module": "aws_cdk.aws_s3_assets"
}
}
}

185
cdk/node_modules/aws-cdk-lib/aws-s3-assets/README.md generated vendored Normal file
View File

@@ -0,0 +1,185 @@
# AWS CDK Assets
Assets are local files or directories which are needed by a CDK app. A common
example is a directory which contains the handler code for a Lambda function,
but assets can represent any artifact that is needed for the app's operation.
When deploying a CDK app that includes constructs with assets, the CDK toolkit
will first upload all the assets to S3, and only then deploy the stacks. The S3
locations of the uploaded assets will be passed in as CloudFormation Parameters
to the relevant stacks.
The following JavaScript example defines a directory asset which is archived as
a .zip file and uploaded to S3 during deployment.
[Example of a ZipDirectoryAsset](./test/integ.assets.directory.lit.ts)
The following JavaScript example defines a file asset, which is uploaded as-is
to an S3 bucket during deployment.
[Example of a FileAsset](./test/integ.assets.file.lit.ts)
## Attributes
`Asset` constructs expose the following deploy-time attributes:
* `s3BucketName` - the name of the assets S3 bucket.
* `s3ObjectKey` - the S3 object key of the asset file (whether it's a file or a zip archive)
* `s3ObjectUrl` - the S3 object URL of the asset (i.e. s3://amzn-s3-demo-bucket/mykey.zip)
* `httpUrl` - the S3 HTTP URL of the asset (i.e. https://s3.us-east-1.amazonaws.com/amzn-s3-demo-bucket/mykey.zip)
In the following example, the various asset attributes are exported as stack outputs:
[Example of referencing an asset](./test/integ.assets.refs.lit.ts)
## Permissions
IAM roles, users or groups which need to be able to read assets in runtime will should be
granted IAM permissions. To do that use the `asset.grantRead(principal)` method:
The following example grants an IAM group read permissions on an asset:
[Example of granting read access to an asset](./test/integ.assets.permissions.lit.ts)
## How does it work
When an asset is defined in a construct, a construct metadata entry
`aws:cdk:asset` is emitted with instructions on where to find the asset and what
type of packaging to perform (`zip` or `file`). Furthermore, the synthesized
CloudFormation template will also include two CloudFormation parameters: one for
the asset's bucket and one for the asset S3 key. Those parameters are used to
reference the deploy-time values of the asset (using `{ Ref: "Param" }`).
Then, when the stack is deployed, the toolkit will package the asset (i.e. zip
the directory), calculate an MD5 hash of the contents and will render an S3 key
for this asset within the toolkit's asset store. If the file doesn't exist in
the asset store, it is uploaded during deployment.
> The toolkit's asset store is an S3 bucket created by the toolkit for each
environment the toolkit operates in (environment = account + region).
Now, when the toolkit deploys the stack, it will set the relevant CloudFormation
Parameters to point to the actual bucket and key for each asset.
## Asset Bundling
When defining an asset, you can use the `bundling` option to specify a command
to run inside a docker container. The command can read the contents of the asset
source from `/asset-input` and is expected to write files under `/asset-output`
(directories mapped inside the container). The files under `/asset-output` will
be zipped and uploaded to S3 as the asset.
The following example uses custom asset bundling to convert a markdown file to html:
[Example of using asset bundling](./test/integ.assets.bundling.lit.ts).
The bundling docker image (`image`) can either come from a registry (`DockerImage.fromRegistry`)
or it can be built from a `Dockerfile` located inside your project (`DockerImage.fromBuild`).
You can set the `CDK_DOCKER` environment variable in order to provide a custom
docker program to execute. This may sometime be needed when building in
environments where the standard docker cannot be executed (see
https://github.com/aws/aws-cdk/issues/8460 for details).
Use `local` to specify a local bundling provider. The provider implements a
method `tryBundle()` which should return `true` if local bundling was performed.
If `false` is returned, docker bundling will be done:
```ts
import * as cdk from 'aws-cdk-lib';
class MyBundle implements cdk.ILocalBundling {
public tryBundle(outputDir: string, options: cdk.BundlingOptions) {
const canRunLocally = true // replace with actual logic
if (canRunLocally) {
// perform local bundling here
return true;
}
return false;
}
}
new Asset(this, 'BundledAsset', {
path: '/path/to/asset',
bundling: {
local: new MyBundle(),
// Docker bundling fallback
image: cdk.DockerImage.fromRegistry('alpine'),
entrypoint: ['/bin/sh', '-c'],
command: ['bundle'],
},
});
```
Although optional, it's recommended to provide a local bundling method which can
greatly improve performance.
If the bundling output contains a single archive file (zip or jar) it will be
uploaded to S3 as-is and will not be zipped. Otherwise the contents of the
output directory will be zipped and the zip file will be uploaded to S3. This
is the default behavior for `bundling.outputType` (`BundlingOutput.AUTO_DISCOVER`).
Use `BundlingOutput.NOT_ARCHIVED` if the bundling output must always be zipped:
```ts
import * as cdk from 'aws-cdk-lib';
const asset = new Asset(this, 'BundledAsset', {
path: '/path/to/asset',
bundling: {
image: cdk.DockerImage.fromRegistry('alpine'),
command: ['command-that-produces-an-archive.sh'],
outputType: cdk.BundlingOutput.NOT_ARCHIVED, // Bundling output will be zipped even though it produces a single archive file.
},
});
```
Use `BundlingOutput.ARCHIVED` if the bundling output contains a single archive file and
you don't want it to be zipped.
### Docker options
Depending on your build environment, you may need to pass certain docker options to the `docker run` command that bundles assets.
This can be done using [BundlingOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html) properties.
Some optional properties to pass to the docker bundling
```ts
import * as lambda from 'aws-cdk-lib/aws-lambda';
const asset = new Asset(this, 'BundledAsset', {
path: '/path/to/asset',
bundling: {
image: lambda.Runtime.PYTHON_3_9.bundlingImage,
command: [
'bash', '-c',
'pip install -r requirements.txt -t /asset-output && cp -au . /asset-output'
],
securityOpt: 'no-new-privileges:true', // https://docs.docker.com/engine/reference/commandline/run/#optional-security-options---security-opt
network: 'host', //https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network---network
},
});
```
## CloudFormation Resource Metadata
> NOTE: This section is relevant for authors of AWS Resource Constructs.
In certain situations, it is desirable for tools to be able to know that a certain CloudFormation
resource is using a local asset. For example, SAM CLI can be used to invoke AWS Lambda functions
locally for debugging purposes.
To enable such use cases, external tools will consult a set of metadata entries on AWS CloudFormation
resources:
* `aws:asset:path` points to the local path of the asset.
* `aws:asset:property` is the name of the resource property where the asset is used
Using these two metadata entries, tools will be able to identify that assets are used
by a certain resource, and enable advanced local experiences.
To add these metadata entries to a resource, use the
`asset.addResourceMetadata(resource, property)` method.
See https://github.com/aws/aws-cdk/issues/1432 for more details

View File

@@ -0,0 +1 @@
export * from './lib';

1
cdk/node_modules/aws-cdk-lib/aws-s3-assets/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});var _noFold;exports.Asset=void 0,Object.defineProperty(exports,_noFold="Asset",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").Asset;return Object.defineProperty(exports,_noFold="Asset",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,139 @@
import { Construct } from 'constructs';
import '../../assets';
import type * as iam from '../../aws-iam';
import * as kms from '../../aws-kms';
import * as s3 from '../../aws-s3';
import * as cdk from '../../core';
export interface AssetOptions extends cdk.FileCopyOptions, cdk.AssetOptions {
/**
* A list of principals that should be able to read this asset from S3.
* You can use `asset.grantRead(principal)` to grant read permissions later.
*
* @default - No principals that can read file asset.
*/
readonly readers?: iam.IGrantable[];
/**
* Whether or not the asset needs to exist beyond deployment time; i.e.
* are copied over to a different location and not needed afterwards.
* Setting this property to true has an impact on the lifecycle of the asset,
* because we will assume that it is safe to delete after the CloudFormation
* deployment succeeds.
*
* For example, Lambda Function assets are copied over to Lambda during
* deployment. Therefore, it is not necessary to store the asset in S3, so
* we consider those deployTime assets.
*
* @default false
*/
readonly deployTime?: boolean;
/**
* The ARN of the KMS key used to encrypt the handler code.
* @default - the default server-side encryption with Amazon S3 managed keys(SSE-S3) key will be used.
*/
readonly sourceKMSKey?: kms.IKeyRef;
/**
* A display name for this asset
*
* If supplied, the display name will be used in locations where the asset
* identifier is printed, like in the CLI progress information. If the same
* asset is added multiple times, the display name of the first occurrence is
* used.
*
* The default is the construct path of the Asset construct, with respect to
* the enclosing stack. If the asset is produced by a construct helper
* function (such as `lambda.Code.fromAsset()`), this will look like
* `MyFunction/Code`.
*
* We use the stack-relative construct path so that in the common case where
* you have multiple stacks with the same asset, we won't show something like
* `/MyBetaStack/MyFunction/Code` when you are actually deploying to
* production.
*
* @default - Stack-relative construct path
*/
readonly displayName?: string;
}
export interface AssetProps extends AssetOptions {
/**
* The disk location of the asset.
*
* The path should refer to one of the following:
* - A regular file or a .zip file, in which case the file will be uploaded as-is to S3.
* - A directory, in which case it will be archived into a .zip file and uploaded to S3.
*/
readonly path: string;
}
/**
* An asset represents a local file or directory, which is automatically uploaded to S3
* and then can be referenced within a CDK application.
*/
export declare class Asset extends Construct implements cdk.IAsset {
/**
* Attribute that represents the name of the bucket this asset exists in.
*/
readonly s3BucketName: string;
/**
* Attribute which represents the S3 object key of this asset.
*/
readonly s3ObjectKey: string;
/**
* Attribute which represents the S3 HTTP URL of this asset.
* For example, `https://s3.us-west-1.amazonaws.com/bucket/key`
*/
readonly httpUrl: string;
/**
* Attribute which represents the S3 URL of this asset.
* For example, `s3://bucket/key`
*/
readonly s3ObjectUrl: string;
/**
* The path to the asset, relative to the current Cloud Assembly
*
* If asset staging is disabled, this will just be the original path.
* If asset staging is enabled it will be the staged path.
*/
readonly assetPath: string;
/**
* The S3 bucket in which this asset resides.
*/
readonly bucket: s3.IBucket;
/**
* Indicates if this asset is a single file. Allows constructs to ensure that the
* correct file type was used.
*/
readonly isFile: boolean;
/**
* Indicates if this asset is a zip archive. Allows constructs to ensure that the
* correct file type was used.
*/
readonly isZipArchive: boolean;
readonly assetHash: string;
/**
* Indicates if this asset got bundled before staged, or not.
*/
private readonly isBundled;
constructor(scope: Construct, id: string, props: AssetProps);
/**
* Adds CloudFormation template metadata to the specified resource with
* information that indicates which resource property is mapped to this local
* asset. This can be used by tools such as SAM CLI to provide local
* experience such as local invocation and debugging of Lambda functions.
*
* Asset metadata will only be included if the stack is synthesized with the
* "aws:cdk:enable-asset-metadata" context key defined, which is the default
* behavior when synthesizing via the CDK Toolkit.
*
* @see https://github.com/aws/aws-cdk/issues/1432
*
* @param resource The CloudFormation resource which is using this asset [disable-awslint:ref-via-interface]
* @param resourceProperty The property name where this asset is referenced
* (e.g. "Code" for AWS::Lambda::Function)
*/
addResourceMetadata(resource: cdk.CfnResource, resourceProperty: string): void;
/**
* Grants read permissions to the principal on the assets bucket.
*
* [disable-awslint:no-grants]
*/
grantRead(grantee: iam.IGrantable): void;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Asset=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var path=()=>{var tmp=require("path");return path=()=>tmp,tmp},constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},compat_1=()=>{var tmp=require("./compat");return compat_1=()=>tmp,tmp},kms=()=>{var tmp=require("../../aws-kms");return kms=()=>tmp,tmp},s3=()=>{var tmp=require("../../aws-s3");return s3=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},cxapi=()=>{var tmp=require("../../cx-api");return cxapi=()=>tmp,tmp};class Asset extends constructs_1().Construct{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_s3_assets.Asset",version:"2.252.0"};s3BucketName;s3ObjectKey;s3Url;httpUrl;s3ObjectUrl;assetPath;bucket;isFile;isZipArchive;sourceHash;assetHash;isBundled;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_assets_AssetProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Asset),error}if(!props.path)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`AssetPathCannotEmpty`,"Asset path cannot be empty",this);this.isBundled=props.bundling!=null;const staging=new(cdk()).AssetStaging(this,"Stage",{...props,sourcePath:path().resolve(props.path),follow:props.followSymlinks??(0,compat_1().toSymlinkFollow)(props.follow),assetHash:props.assetHash??props.sourceHash});this.assetHash=staging.assetHash,this.sourceHash=this.assetHash;const stack=cdk().Stack.of(this);this.assetPath=staging.relativeStagedPath(stack),this.isFile=staging.packaging===cdk().FileAssetPackaging.FILE,this.isZipArchive=staging.isArchive;const location=stack.synthesizer.addFileAsset({packaging:staging.packaging,sourceHash:this.sourceHash,fileName:this.assetPath,deployTime:props.deployTime,displayName:props.displayName??cdk().Names.stackRelativeConstructPath(this)});this.s3BucketName=location.bucketName,this.s3ObjectKey=location.objectKey,this.s3ObjectUrl=location.s3ObjectUrl,this.httpUrl=location.httpUrl,this.s3Url=location.httpUrl;const kmsKey=location.kmsKeyArn?kms().Key.fromKeyArn(this,"Key",location.kmsKeyArn):void 0;this.bucket=s3().Bucket.fromBucketAttributes(this,"AssetBucket",{bucketName:this.s3BucketName,encryptionKey:kmsKey});for(const reader of props.readers??[])this.grantRead(reader)}addResourceMetadata(resource,resourceProperty){try{jsiiDeprecationWarnings().aws_cdk_lib_CfnResource(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addResourceMetadata),error}this.node.tryGetContext(cxapi().ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)&&(resource.cfnOptions.metadata=resource.cfnOptions.metadata||{},resource.cfnOptions.metadata[cxapi().ASSET_RESOURCE_METADATA_PATH_KEY]=this.assetPath,resource.cfnOptions.metadata[cxapi().ASSET_RESOURCE_METADATA_IS_BUNDLED_KEY]=this.isBundled,resource.cfnOptions.metadata[cxapi().ASSET_RESOURCE_METADATA_PROPERTY_KEY]=resourceProperty)}grantRead(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantRead),error}this.bucket.grantRead(grantee)}}exports.Asset=Asset;

View File

@@ -0,0 +1,3 @@
import '../../assets';
import { SymlinkFollowMode } from '../../core';
export declare function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.toSymlinkFollow=toSymlinkFollow;var assets_1=()=>{var tmp=require("../../assets");return assets_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};function toSymlinkFollow(follow){if(follow)switch(follow){case assets_1().FollowMode.NEVER:return core_1().SymlinkFollowMode.NEVER;case assets_1().FollowMode.ALWAYS:return core_1().SymlinkFollowMode.ALWAYS;case assets_1().FollowMode.BLOCK_EXTERNAL:return core_1().SymlinkFollowMode.BLOCK_EXTERNAL;case assets_1().FollowMode.EXTERNAL:return core_1().SymlinkFollowMode.EXTERNAL;default:throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`UnknownFollowMode`,`unknown follow mode: ${follow}`)}}

View File

@@ -0,0 +1 @@
export * from './asset';

View File

@@ -0,0 +1 @@
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});var _noFold;exports.Asset=void 0,Object.defineProperty(exports,_noFold="Asset",{enumerable:!0,configurable:!0,get:()=>{var value=require("./asset").Asset;return Object.defineProperty(exports,_noFold="Asset",{enumerable:!0,configurable:!0,value}),value}});