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 @@
"use strict";var i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,f=Object.prototype.hasOwnProperty,g=(e,n)=>{for(var r in n)i(e,r,{get:n[r],enumerable:!0})},y=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!f.call(e,o)&&o!==r&&i(e,o,{get:()=>n[o],enumerable:!(a=l(n,o))||a.enumerable});return e},p=e=>y(i({},"__esModule",{value:!0}),e),P={};g(P,{handler:()=>u}),module.exports=p(P);function w(e){let n=Object.entries(e).filter(([r])=>r.endsWith("Client")&&r!=="__Client");if(n.length==0)throw new Error("There is no *Client class in the package.");if(n.length>1)throw new Error(`There are more than one *Client classes in the package: ${n.map(r=>r[0]).join(",")}`);return n[0][1]}function h(e){return e.charAt(0).toUpperCase()+e.slice(1)}function C(e,n){let r=`${h(n)}Command`,a=Object.entries(e).find(([o])=>o.toLowerCase()===r.toLowerCase())?.[1];if(!a)throw new Error(`Unable to find command named: ${r} for action: ${n} in service package`);return a}var u=async e=>{console.log("Event: ",e);try{let n=require(`@aws-sdk/client-${e.service}`),r=w(n),a=C(n,e.action),o=new r({region:e.region,endpoint:e.endpoint}),c=new a(e.parameters??{}),t=await o.send(c);if(t.Payload&&(t.Payload instanceof Uint8Array||t.Payload instanceof Buffer))try{let s=new TextDecoder().decode(t.Payload);t.Payload=JSON.parse(s)}catch{t.Payload=new TextDecoder().decode(t.Payload)}let d=JSON.stringify(t);return JSON.parse(d)}catch(n){throw console.error("Error: ",n),n}};

View File

@@ -0,0 +1,27 @@
import { Construct } from "constructs";
import * as lambda from "../../../aws-lambda";
export declare class CrossRegionAwsSdkSingletonFunction extends lambda.SingletonFunction {
constructor(scope: Construct, id: string, props: CrossRegionAwsSdkSingletonFunctionProps);
}
/**
* Initialization properties for CrossRegionAwsSdkSingletonFunction
*/
export interface CrossRegionAwsSdkSingletonFunctionProps extends lambda.FunctionOptions {
/**
* A unique identifier to identify this Lambda.
*
* The identifier should be unique across all custom resource providers.
* We recommend generating a UUID per provider.
*/
readonly uuid: string;
/**
* A descriptive name for the purpose of this Lambda.
*
* If the Lambda does not have a physical name, this string will be
* reflected in its generated name. The combination of lambdaPurpose
* and uuid must be unique.
*
* @default SingletonLambda
*/
readonly lambdaPurpose?: string;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CrossRegionAwsSdkSingletonFunction=void 0;const path=require("path"),lambda=require("../../../aws-lambda");class CrossRegionAwsSdkSingletonFunction extends lambda.SingletonFunction{constructor(scope,id,props){super(scope,id,{...props,code:lambda.Code.fromAsset(path.join(__dirname,"cross-region-aws-sdk-handler")),handler:"index.handler",runtime:lambda.determineLatestNodeRuntime(scope)}),this.addMetadata("aws:cdk:is-custom-resource-handler-singleton",!0),this.addMetadata("aws:cdk:is-custom-resource-handler-runtime-family",this.runtime.family),props?.logGroup&&this.logGroup.node.addMetadata("aws:cdk:is-custom-resource-handler-logGroup",!0),props?.logRetention&&this.lambdaFunction._logRetention?.node.addMetadata("aws:cdk:is-custom-resource-handler-logRetention",!0)}}exports.CrossRegionAwsSdkSingletonFunction=CrossRegionAwsSdkSingletonFunction;

View File

@@ -0,0 +1 @@
"use strict";var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty,c=(e,n)=>{for(var s in n)o(e,s,{get:n[s],enumerable:!0})},l=(e,n,s,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of a(n))!p.call(e,r)&&r!==s&&o(e,r,{get:()=>n[r],enumerable:!(t=i(n,r))||t.enumerable});return e},g=e=>l(o({},"__esModule",{value:!0}),e),y={};c(y,{handler:()=>u}),module.exports=g(y);function x(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}async function u(e){console.log("Event: %j",{...e,ResponseURL:"..."});let n=Object.entries(e.expressionAttributeValues).reduce((s,[t,r])=>s.replace(new RegExp(x(t),"g"),JSON.stringify(r)),e.expression);return console.log(`Expression: ${n}`),[eval][0](n)}

View File

@@ -0,0 +1,33 @@
import { Construct } from "constructs";
import * as lambda from "../../../aws-lambda";
export declare class EvalNodejsSingletonFunction extends lambda.SingletonFunction {
constructor(scope: Construct, id: string, props: EvalNodejsSingletonFunctionProps);
}
/**
* Initialization properties for EvalNodejsSingletonFunction
*/
export interface EvalNodejsSingletonFunctionProps extends lambda.FunctionOptions {
/**
* A unique identifier to identify this Lambda.
*
* The identifier should be unique across all custom resource providers.
* We recommend generating a UUID per provider.
*/
readonly uuid: string;
/**
* A descriptive name for the purpose of this Lambda.
*
* If the Lambda does not have a physical name, this string will be
* reflected in its generated name. The combination of lambdaPurpose
* and uuid must be unique.
*
* @default SingletonLambda
*/
readonly lambdaPurpose?: string;
/**
* The runtime that this Lambda will use.
*
* @default - the latest Lambda node runtime available in your region.
*/
readonly runtime?: lambda.Runtime;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EvalNodejsSingletonFunction=void 0;const path=require("path"),lambda=require("../../../aws-lambda");class EvalNodejsSingletonFunction extends lambda.SingletonFunction{constructor(scope,id,props){super(scope,id,{...props,code:lambda.Code.fromAsset(path.join(__dirname,"eval-nodejs-handler")),handler:"index.handler",runtime:props.runtime?props.runtime:lambda.determineLatestNodeRuntime(scope)}),this.addMetadata("aws:cdk:is-custom-resource-handler-singleton",!0),this.addMetadata("aws:cdk:is-custom-resource-handler-runtime-family",this.runtime.family),props?.logGroup&&this.logGroup.node.addMetadata("aws:cdk:is-custom-resource-handler-logGroup",!0),props?.logRetention&&this.lambdaFunction._logRetention?.node.addMetadata("aws:cdk:is-custom-resource-handler-logRetention",!0)}}exports.EvalNodejsSingletonFunction=EvalNodejsSingletonFunction;

View File

@@ -0,0 +1,16 @@
import subprocess as sp
import os
import logging
#https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-stepfunctions#custom-state
def handler(event, context):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
command = ["/opt/awscli/aws", "emr-containers", "update-role-trust-policy", "--cluster-name", f"{event['ResourceProperties']['eksClusterId']}", "--namespace", f"{event['ResourceProperties']['eksNamespace']}", "--role-name", f"{event['ResourceProperties']['roleName']}"]
if event['RequestType'] == 'Create' or event['RequestType'] == 'Update' :
try:
res = sp.check_output(command)
logger.info(f"Successfully ran {command}")
except Exception as e:
logger.info(f"ERROR: {str(e)}")

View File

@@ -0,0 +1,27 @@
import { Construct } from "constructs";
import * as lambda from "../../../aws-lambda";
export declare class RolePolicySingletonFunction extends lambda.SingletonFunction {
constructor(scope: Construct, id: string, props: RolePolicySingletonFunctionProps);
}
/**
* Initialization properties for RolePolicySingletonFunction
*/
export interface RolePolicySingletonFunctionProps extends lambda.FunctionOptions {
/**
* A unique identifier to identify this Lambda.
*
* The identifier should be unique across all custom resource providers.
* We recommend generating a UUID per provider.
*/
readonly uuid: string;
/**
* A descriptive name for the purpose of this Lambda.
*
* If the Lambda does not have a physical name, this string will be
* reflected in its generated name. The combination of lambdaPurpose
* and uuid must be unique.
*
* @default SingletonLambda
*/
readonly lambdaPurpose?: string;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RolePolicySingletonFunction=void 0;const path=require("path"),lambda=require("../../../aws-lambda");class RolePolicySingletonFunction extends lambda.SingletonFunction{constructor(scope,id,props){super(scope,id,{...props,code:lambda.Code.fromAsset(path.join(__dirname,"role-policy-handler")),handler:"index.handler",runtime:lambda.Runtime.PYTHON_3_13}),this.addMetadata("aws:cdk:is-custom-resource-handler-singleton",!0),this.addMetadata("aws:cdk:is-custom-resource-handler-runtime-family",this.runtime.family),props?.logGroup&&this.logGroup.node.addMetadata("aws:cdk:is-custom-resource-handler-logGroup",!0),props?.logRetention&&this.lambdaFunction._logRetention?.node.addMetadata("aws:cdk:is-custom-resource-handler-logRetention",!0)}}exports.RolePolicySingletonFunction=RolePolicySingletonFunction;